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