1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * Copyright 1997-2002 Sun Microsystems, Inc. All rights reserved. 3*0Sstevel@tonic-gate * Use is subject to license terms. 4*0Sstevel@tonic-gate */ 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gate /* 7*0Sstevel@tonic-gate * Copyright (c) 1996,1999 by Internet Software Consortium. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * Permission to use, copy, modify, and distribute this software for any 10*0Sstevel@tonic-gate * purpose with or without fee is hereby granted, provided that the above 11*0Sstevel@tonic-gate * copyright notice and this permission notice appear in all copies. 12*0Sstevel@tonic-gate * 13*0Sstevel@tonic-gate * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS 14*0Sstevel@tonic-gate * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 15*0Sstevel@tonic-gate * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE 16*0Sstevel@tonic-gate * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 17*0Sstevel@tonic-gate * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 18*0Sstevel@tonic-gate * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 19*0Sstevel@tonic-gate * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 20*0Sstevel@tonic-gate * SOFTWARE. 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gate /* 26*0Sstevel@tonic-gate * $Id: gen_p.h,v 1.11 2001/05/29 05:48:39 marka Exp $ 27*0Sstevel@tonic-gate */ 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate /* Notes: 30*0Sstevel@tonic-gate * We hope to create a complete set of thread-safe entry points someday, 31*0Sstevel@tonic-gate * which will mean a set of getXbyY() functions that take as an argument 32*0Sstevel@tonic-gate * a pointer to the map class, which will have a pointer to the private 33*0Sstevel@tonic-gate * data, which will be used preferentially to the static variables that 34*0Sstevel@tonic-gate * are necessary to support the "classic" interface. This "classic" 35*0Sstevel@tonic-gate * interface will then be reimplemented as stubs on top of the thread 36*0Sstevel@tonic-gate * safe modules, and will keep the map class pointers as their only 37*0Sstevel@tonic-gate * static data. HOWEVER, we are not there yet. So while we will call 38*0Sstevel@tonic-gate * the just-barely-converted map class methods with map class pointers, 39*0Sstevel@tonic-gate * right now they probably all still use statics. We're not fooling 40*0Sstevel@tonic-gate * anybody, and we're not trying to (yet). 41*0Sstevel@tonic-gate */ 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gate #ifndef _GEN_P_H_INCLUDED 44*0Sstevel@tonic-gate #define _GEN_P_H_INCLUDED 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate /* 47*0Sstevel@tonic-gate * These are the access methods. 48*0Sstevel@tonic-gate */ 49*0Sstevel@tonic-gate enum irs_acc_id { 50*0Sstevel@tonic-gate irs_lcl, /* Local. */ 51*0Sstevel@tonic-gate irs_dns, /* DNS or Hesiod. */ 52*0Sstevel@tonic-gate irs_nis, /* Sun NIS ("YP"). */ 53*0Sstevel@tonic-gate irs_irp, /* IR protocol. */ 54*0Sstevel@tonic-gate irs_nacc 55*0Sstevel@tonic-gate }; 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gate /* 58*0Sstevel@tonic-gate * These are the map types. 59*0Sstevel@tonic-gate */ 60*0Sstevel@tonic-gate enum irs_map_id { 61*0Sstevel@tonic-gate irs_gr, /* "group" */ 62*0Sstevel@tonic-gate irs_pw, /* "passwd" */ 63*0Sstevel@tonic-gate irs_sv, /* "services" */ 64*0Sstevel@tonic-gate irs_pr, /* "protocols" */ 65*0Sstevel@tonic-gate irs_ho, /* "hosts" */ 66*0Sstevel@tonic-gate irs_nw, /* "networks" */ 67*0Sstevel@tonic-gate irs_ng, /* "netgroup" */ 68*0Sstevel@tonic-gate irs_nmap 69*0Sstevel@tonic-gate }; 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate /* 72*0Sstevel@tonic-gate * This is an accessor instance. 73*0Sstevel@tonic-gate */ 74*0Sstevel@tonic-gate struct irs_inst { 75*0Sstevel@tonic-gate struct irs_acc *acc; 76*0Sstevel@tonic-gate struct irs_gr * gr; 77*0Sstevel@tonic-gate struct irs_pw * pw; 78*0Sstevel@tonic-gate struct irs_sv * sv; 79*0Sstevel@tonic-gate struct irs_pr * pr; 80*0Sstevel@tonic-gate struct irs_ho * ho; 81*0Sstevel@tonic-gate struct irs_nw * nw; 82*0Sstevel@tonic-gate struct irs_ng * ng; 83*0Sstevel@tonic-gate }; 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate /* 86*0Sstevel@tonic-gate * This is a search rule for some map type. 87*0Sstevel@tonic-gate */ 88*0Sstevel@tonic-gate struct irs_rule { 89*0Sstevel@tonic-gate struct irs_rule * next; 90*0Sstevel@tonic-gate struct irs_inst * inst; 91*0Sstevel@tonic-gate int flags; 92*0Sstevel@tonic-gate }; 93*0Sstevel@tonic-gate #define IRS_MERGE 0x0001 /* Don't stop if acc. has data? */ 94*0Sstevel@tonic-gate #define IRS_CONTINUE 0x0002 /* Don't stop if acc. has no data? */ 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate /* 97*0Sstevel@tonic-gate * This is the private data for a search access class. 98*0Sstevel@tonic-gate */ 99*0Sstevel@tonic-gate struct gen_p { 100*0Sstevel@tonic-gate char * options; 101*0Sstevel@tonic-gate struct irs_rule * map_rules[(int)irs_nmap]; 102*0Sstevel@tonic-gate struct irs_inst accessors[(int)irs_nacc]; 103*0Sstevel@tonic-gate struct __res_state * res; 104*0Sstevel@tonic-gate void (*free_res) __P((void *)); 105*0Sstevel@tonic-gate }; 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate /* 108*0Sstevel@tonic-gate * Externs. 109*0Sstevel@tonic-gate */ 110*0Sstevel@tonic-gate 111*0Sstevel@tonic-gate extern struct irs_acc * irs_gen_acc __P((const char *, const char *conf_file)); 112*0Sstevel@tonic-gate extern struct irs_gr * irs_gen_gr __P((struct irs_acc *)); 113*0Sstevel@tonic-gate extern struct irs_pw * irs_gen_pw __P((struct irs_acc *)); 114*0Sstevel@tonic-gate extern struct irs_sv * irs_gen_sv __P((struct irs_acc *)); 115*0Sstevel@tonic-gate extern struct irs_pr * irs_gen_pr __P((struct irs_acc *)); 116*0Sstevel@tonic-gate extern struct irs_ho * irs_gen_ho __P((struct irs_acc *)); 117*0Sstevel@tonic-gate extern struct irs_nw * irs_gen_nw __P((struct irs_acc *)); 118*0Sstevel@tonic-gate extern struct irs_ng * irs_gen_ng __P((struct irs_acc *)); 119*0Sstevel@tonic-gate 120*0Sstevel@tonic-gate #endif /*_IRS_P_H_INCLUDED*/ 121