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