10Sstevel@tonic-gate /* 2*11038SRao.Shoaib@Sun.COM * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 30Sstevel@tonic-gate * Copyright (c) 1996,1999 by Internet Software Consortium. 40Sstevel@tonic-gate * 50Sstevel@tonic-gate * Permission to use, copy, modify, and distribute this software for any 60Sstevel@tonic-gate * purpose with or without fee is hereby granted, provided that the above 70Sstevel@tonic-gate * copyright notice and this permission notice appear in all copies. 80Sstevel@tonic-gate * 9*11038SRao.Shoaib@Sun.COM * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 10*11038SRao.Shoaib@Sun.COM * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11*11038SRao.Shoaib@Sun.COM * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 12*11038SRao.Shoaib@Sun.COM * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13*11038SRao.Shoaib@Sun.COM * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14*11038SRao.Shoaib@Sun.COM * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 15*11038SRao.Shoaib@Sun.COM * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 160Sstevel@tonic-gate */ 170Sstevel@tonic-gate 180Sstevel@tonic-gate /* 19*11038SRao.Shoaib@Sun.COM * $Id: gen_p.h,v 1.3 2005/04/27 04:56:23 sra Exp $ 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate 22*11038SRao.Shoaib@Sun.COM /*! \file 23*11038SRao.Shoaib@Sun.COM * Notes: 240Sstevel@tonic-gate * We hope to create a complete set of thread-safe entry points someday, 250Sstevel@tonic-gate * which will mean a set of getXbyY() functions that take as an argument 260Sstevel@tonic-gate * a pointer to the map class, which will have a pointer to the private 270Sstevel@tonic-gate * data, which will be used preferentially to the static variables that 280Sstevel@tonic-gate * are necessary to support the "classic" interface. This "classic" 290Sstevel@tonic-gate * interface will then be reimplemented as stubs on top of the thread 300Sstevel@tonic-gate * safe modules, and will keep the map class pointers as their only 310Sstevel@tonic-gate * static data. HOWEVER, we are not there yet. So while we will call 320Sstevel@tonic-gate * the just-barely-converted map class methods with map class pointers, 330Sstevel@tonic-gate * right now they probably all still use statics. We're not fooling 340Sstevel@tonic-gate * anybody, and we're not trying to (yet). 350Sstevel@tonic-gate */ 360Sstevel@tonic-gate 370Sstevel@tonic-gate #ifndef _GEN_P_H_INCLUDED 380Sstevel@tonic-gate #define _GEN_P_H_INCLUDED 390Sstevel@tonic-gate 40*11038SRao.Shoaib@Sun.COM /*% 410Sstevel@tonic-gate * These are the access methods. 420Sstevel@tonic-gate */ 430Sstevel@tonic-gate enum irs_acc_id { 44*11038SRao.Shoaib@Sun.COM irs_lcl, /*%< Local. */ 45*11038SRao.Shoaib@Sun.COM irs_dns, /*%< DNS or Hesiod. */ 46*11038SRao.Shoaib@Sun.COM irs_nis, /*%< Sun NIS ("YP"). */ 47*11038SRao.Shoaib@Sun.COM irs_irp, /*%< IR protocol. */ 480Sstevel@tonic-gate irs_nacc 490Sstevel@tonic-gate }; 500Sstevel@tonic-gate 51*11038SRao.Shoaib@Sun.COM /*% 520Sstevel@tonic-gate * These are the map types. 530Sstevel@tonic-gate */ 540Sstevel@tonic-gate enum irs_map_id { 55*11038SRao.Shoaib@Sun.COM irs_gr, /*%< "group" */ 56*11038SRao.Shoaib@Sun.COM irs_pw, /*%< "passwd" */ 57*11038SRao.Shoaib@Sun.COM irs_sv, /*%< "services" */ 58*11038SRao.Shoaib@Sun.COM irs_pr, /*%< "protocols" */ 59*11038SRao.Shoaib@Sun.COM irs_ho, /*%< "hosts" */ 60*11038SRao.Shoaib@Sun.COM irs_nw, /*%< "networks" */ 61*11038SRao.Shoaib@Sun.COM irs_ng, /*%< "netgroup" */ 620Sstevel@tonic-gate irs_nmap 630Sstevel@tonic-gate }; 640Sstevel@tonic-gate 65*11038SRao.Shoaib@Sun.COM /*% 660Sstevel@tonic-gate * This is an accessor instance. 670Sstevel@tonic-gate */ 680Sstevel@tonic-gate struct irs_inst { 690Sstevel@tonic-gate struct irs_acc *acc; 700Sstevel@tonic-gate struct irs_gr * gr; 710Sstevel@tonic-gate struct irs_pw * pw; 720Sstevel@tonic-gate struct irs_sv * sv; 730Sstevel@tonic-gate struct irs_pr * pr; 740Sstevel@tonic-gate struct irs_ho * ho; 750Sstevel@tonic-gate struct irs_nw * nw; 760Sstevel@tonic-gate struct irs_ng * ng; 770Sstevel@tonic-gate }; 780Sstevel@tonic-gate 79*11038SRao.Shoaib@Sun.COM /*% 800Sstevel@tonic-gate * This is a search rule for some map type. 810Sstevel@tonic-gate */ 820Sstevel@tonic-gate struct irs_rule { 830Sstevel@tonic-gate struct irs_rule * next; 840Sstevel@tonic-gate struct irs_inst * inst; 850Sstevel@tonic-gate int flags; 860Sstevel@tonic-gate }; 87*11038SRao.Shoaib@Sun.COM #define IRS_MERGE 0x0001 /*%< Don't stop if acc. has data? */ 88*11038SRao.Shoaib@Sun.COM #define IRS_CONTINUE 0x0002 /*%< Don't stop if acc. has no data? */ 890Sstevel@tonic-gate /* 900Sstevel@tonic-gate * This is the private data for a search access class. 910Sstevel@tonic-gate */ 920Sstevel@tonic-gate struct gen_p { 930Sstevel@tonic-gate char * options; 940Sstevel@tonic-gate struct irs_rule * map_rules[(int)irs_nmap]; 950Sstevel@tonic-gate struct irs_inst accessors[(int)irs_nacc]; 960Sstevel@tonic-gate struct __res_state * res; 970Sstevel@tonic-gate void (*free_res) __P((void *)); 980Sstevel@tonic-gate }; 990Sstevel@tonic-gate 1000Sstevel@tonic-gate /* 1010Sstevel@tonic-gate * Externs. 1020Sstevel@tonic-gate */ 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate extern struct irs_acc * irs_gen_acc __P((const char *, const char *conf_file)); 1050Sstevel@tonic-gate extern struct irs_gr * irs_gen_gr __P((struct irs_acc *)); 1060Sstevel@tonic-gate extern struct irs_pw * irs_gen_pw __P((struct irs_acc *)); 1070Sstevel@tonic-gate extern struct irs_sv * irs_gen_sv __P((struct irs_acc *)); 1080Sstevel@tonic-gate extern struct irs_pr * irs_gen_pr __P((struct irs_acc *)); 1090Sstevel@tonic-gate extern struct irs_ho * irs_gen_ho __P((struct irs_acc *)); 1100Sstevel@tonic-gate extern struct irs_nw * irs_gen_nw __P((struct irs_acc *)); 1110Sstevel@tonic-gate extern struct irs_ng * irs_gen_ng __P((struct irs_acc *)); 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate #endif /*_IRS_P_H_INCLUDED*/ 114