17c478bd9Sstevel@tonic-gate /*
2*9525b14bSRao Shoaib  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
37c478bd9Sstevel@tonic-gate  * Copyright (c) 1996,1999 by Internet Software Consortium.
47c478bd9Sstevel@tonic-gate  *
57c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software for any
67c478bd9Sstevel@tonic-gate  * purpose with or without fee is hereby granted, provided that the above
77c478bd9Sstevel@tonic-gate  * copyright notice and this permission notice appear in all copies.
87c478bd9Sstevel@tonic-gate  *
9*9525b14bSRao Shoaib  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10*9525b14bSRao Shoaib  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*9525b14bSRao Shoaib  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
12*9525b14bSRao Shoaib  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*9525b14bSRao Shoaib  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*9525b14bSRao Shoaib  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15*9525b14bSRao Shoaib  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
167c478bd9Sstevel@tonic-gate  */
177c478bd9Sstevel@tonic-gate 
187c478bd9Sstevel@tonic-gate /*
19*9525b14bSRao Shoaib  * $Id: gen_p.h,v 1.3 2005/04/27 04:56:23 sra Exp $
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate 
22*9525b14bSRao Shoaib /*! \file
23*9525b14bSRao Shoaib  *  Notes:
247c478bd9Sstevel@tonic-gate  *	We hope to create a complete set of thread-safe entry points someday,
257c478bd9Sstevel@tonic-gate  *	which will mean a set of getXbyY() functions that take as an argument
267c478bd9Sstevel@tonic-gate  *	a pointer to the map class, which will have a pointer to the private
277c478bd9Sstevel@tonic-gate  *	data, which will be used preferentially to the static variables that
287c478bd9Sstevel@tonic-gate  *	are necessary to support the "classic" interface.  This "classic"
297c478bd9Sstevel@tonic-gate  *	interface will then be reimplemented as stubs on top of the thread
307c478bd9Sstevel@tonic-gate  *	safe modules, and will keep the map class pointers as their only
317c478bd9Sstevel@tonic-gate  *	static data.  HOWEVER, we are not there yet.  So while we will call
327c478bd9Sstevel@tonic-gate  *	the just-barely-converted map class methods with map class pointers,
337c478bd9Sstevel@tonic-gate  *	right now they probably all still use statics.  We're not fooling
347c478bd9Sstevel@tonic-gate  *	anybody, and we're not trying to (yet).
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifndef _GEN_P_H_INCLUDED
387c478bd9Sstevel@tonic-gate #define _GEN_P_H_INCLUDED
397c478bd9Sstevel@tonic-gate 
40*9525b14bSRao Shoaib /*%
417c478bd9Sstevel@tonic-gate  * These are the access methods.
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate enum irs_acc_id {
44*9525b14bSRao Shoaib 	irs_lcl,	/*%< Local. */
45*9525b14bSRao Shoaib 	irs_dns,	/*%< DNS or Hesiod. */
46*9525b14bSRao Shoaib 	irs_nis,	/*%< Sun NIS ("YP"). */
47*9525b14bSRao Shoaib 	irs_irp,	/*%< IR protocol. */
487c478bd9Sstevel@tonic-gate 	irs_nacc
497c478bd9Sstevel@tonic-gate };
507c478bd9Sstevel@tonic-gate 
51*9525b14bSRao Shoaib /*%
527c478bd9Sstevel@tonic-gate  * These are the map types.
537c478bd9Sstevel@tonic-gate  */
547c478bd9Sstevel@tonic-gate enum irs_map_id {
55*9525b14bSRao Shoaib 	irs_gr,		/*%< "group" */
56*9525b14bSRao Shoaib 	irs_pw,		/*%< "passwd" */
57*9525b14bSRao Shoaib 	irs_sv,		/*%< "services" */
58*9525b14bSRao Shoaib 	irs_pr,		/*%< "protocols" */
59*9525b14bSRao Shoaib 	irs_ho,		/*%< "hosts" */
60*9525b14bSRao Shoaib 	irs_nw,		/*%< "networks" */
61*9525b14bSRao Shoaib 	irs_ng,		/*%< "netgroup" */
627c478bd9Sstevel@tonic-gate 	irs_nmap
637c478bd9Sstevel@tonic-gate };
647c478bd9Sstevel@tonic-gate 
65*9525b14bSRao Shoaib /*%
667c478bd9Sstevel@tonic-gate  * This is an accessor instance.
677c478bd9Sstevel@tonic-gate  */
687c478bd9Sstevel@tonic-gate struct irs_inst {
697c478bd9Sstevel@tonic-gate 	struct irs_acc *acc;
707c478bd9Sstevel@tonic-gate 	struct irs_gr *	gr;
717c478bd9Sstevel@tonic-gate 	struct irs_pw *	pw;
727c478bd9Sstevel@tonic-gate 	struct irs_sv *	sv;
737c478bd9Sstevel@tonic-gate 	struct irs_pr *	pr;
747c478bd9Sstevel@tonic-gate 	struct irs_ho *	ho;
757c478bd9Sstevel@tonic-gate 	struct irs_nw *	nw;
767c478bd9Sstevel@tonic-gate 	struct irs_ng *	ng;
777c478bd9Sstevel@tonic-gate };
787c478bd9Sstevel@tonic-gate 
79*9525b14bSRao Shoaib /*%
807c478bd9Sstevel@tonic-gate  * This is a search rule for some map type.
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate struct irs_rule {
837c478bd9Sstevel@tonic-gate 	struct irs_rule *	next;
847c478bd9Sstevel@tonic-gate 	struct irs_inst *	inst;
857c478bd9Sstevel@tonic-gate 	int			flags;
867c478bd9Sstevel@tonic-gate };
87*9525b14bSRao Shoaib #define IRS_MERGE		0x0001	/*%< Don't stop if acc. has data? */
88*9525b14bSRao Shoaib #define	IRS_CONTINUE		0x0002	/*%< Don't stop if acc. has no data? */
897c478bd9Sstevel@tonic-gate /*
907c478bd9Sstevel@tonic-gate  * This is the private data for a search access class.
917c478bd9Sstevel@tonic-gate  */
927c478bd9Sstevel@tonic-gate struct gen_p {
937c478bd9Sstevel@tonic-gate 	char *			options;
947c478bd9Sstevel@tonic-gate 	struct irs_rule *	map_rules[(int)irs_nmap];
957c478bd9Sstevel@tonic-gate 	struct irs_inst		accessors[(int)irs_nacc];
967c478bd9Sstevel@tonic-gate 	struct __res_state *	res;
977c478bd9Sstevel@tonic-gate 	void			(*free_res) __P((void *));
987c478bd9Sstevel@tonic-gate };
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * Externs.
1027c478bd9Sstevel@tonic-gate  */
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate extern struct irs_acc *	irs_gen_acc __P((const char *, const char *conf_file));
1057c478bd9Sstevel@tonic-gate extern struct irs_gr *	irs_gen_gr __P((struct irs_acc *));
1067c478bd9Sstevel@tonic-gate extern struct irs_pw *	irs_gen_pw __P((struct irs_acc *));
1077c478bd9Sstevel@tonic-gate extern struct irs_sv *	irs_gen_sv __P((struct irs_acc *));
1087c478bd9Sstevel@tonic-gate extern struct irs_pr *	irs_gen_pr __P((struct irs_acc *));
1097c478bd9Sstevel@tonic-gate extern struct irs_ho *	irs_gen_ho __P((struct irs_acc *));
1107c478bd9Sstevel@tonic-gate extern struct irs_nw *	irs_gen_nw __P((struct irs_acc *));
1117c478bd9Sstevel@tonic-gate extern struct irs_ng *	irs_gen_ng __P((struct irs_acc *));
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #endif /*_IRS_P_H_INCLUDED*/
114