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