2 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (c) 1996,1999 by Internet Software Consortium.
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.
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.
19 * $Id: irs.h,v 1.2.2.1.4.1 2004/03/09 08:33:29 marka Exp $
22 #ifndef _IRS_H_INCLUDED
23 #define _IRS_H_INCLUDED
25 #include <sys/types.h>
27 #include <arpa/nameser.h>
35 * This is the group map class.
39 void (*close) __P((struct irs_gr *));
40 struct group * (*next) __P((struct irs_gr *));
41 struct group * (*byname) __P((struct irs_gr *, const char *));
42 struct group * (*bygid) __P((struct irs_gr *, gid_t));
43 int (*list) __P((struct irs_gr *, const char *,
44 gid_t, gid_t *, int *));
45 void (*rewind) __P((struct irs_gr *));
46 void (*minimize) __P((struct irs_gr *));
47 struct __res_state * (*res_get) __P((struct irs_gr *));
48 void (*res_set) __P((struct irs_gr *, res_state,
53 * This is the password map class.
57 void (*close) __P((struct irs_pw *));
58 struct passwd * (*next) __P((struct irs_pw *));
59 struct passwd * (*byname) __P((struct irs_pw *, const char *));
60 struct passwd * (*byuid) __P((struct irs_pw *, uid_t));
61 void (*rewind) __P((struct irs_pw *));
62 void (*minimize) __P((struct irs_pw *));
63 struct __res_state * (*res_get) __P((struct irs_pw *));
64 void (*res_set) __P((struct irs_pw *, res_state,
69 * This is the service map class.
73 void (*close) __P((struct irs_sv *));
74 struct servent *(*byname) __P((struct irs_sv *,
75 const char *, const char *));
76 struct servent *(*byport) __P((struct irs_sv *, int, const char *));
77 struct servent *(*next) __P((struct irs_sv *));
78 void (*rewind) __P((struct irs_sv *));
79 void (*minimize) __P((struct irs_sv *));
80 struct __res_state * (*res_get) __P((struct irs_sv *));
81 void (*res_set) __P((struct irs_sv *, res_state,
86 * This is the protocols map class.
90 void (*close) __P((struct irs_pr *));
91 struct protoent *(*byname) __P((struct irs_pr *, const char *));
92 struct protoent *(*bynumber) __P((struct irs_pr *, int));
93 struct protoent *(*next) __P((struct irs_pr *));
94 void (*rewind) __P((struct irs_pr *));
95 void (*minimize) __P((struct irs_pr *));
96 struct __res_state * (*res_get) __P((struct irs_pr *));
97 void (*res_set) __P((struct irs_pr *, res_state,
102 * This is the hosts map class.
106 void (*close) __P((struct irs_ho *));
107 struct hostent *(*byname) __P((struct irs_ho *, const char *));
108 struct hostent *(*byname2) __P((struct irs_ho *, const char *, int));
109 struct hostent *(*byaddr) __P((struct irs_ho *,
110 const void *, int, int));
111 struct hostent *(*next) __P((struct irs_ho *));
112 void (*rewind) __P((struct irs_ho *));
113 void (*minimize) __P((struct irs_ho *));
114 struct __res_state * (*res_get) __P((struct irs_ho *));
115 void (*res_set) __P((struct irs_ho *, res_state,
117 struct addrinfo *(*addrinfo) __P((struct irs_ho *, const char *,
118 const struct addrinfo *));
122 * This is the networks map class.
126 void (*close) __P((struct irs_nw *));
127 struct nwent * (*byname) __P((struct irs_nw *, const char *, int));
128 struct nwent * (*byaddr) __P((struct irs_nw *, void *, int, int));
129 struct nwent * (*next) __P((struct irs_nw *));
130 void (*rewind) __P((struct irs_nw *));
131 void (*minimize) __P((struct irs_nw *));
132 struct __res_state * (*res_get) __P((struct irs_nw *));
133 void (*res_set) __P((struct irs_nw *, res_state,
138 * This is the netgroups map class.
142 void (*close) __P((struct irs_ng *));
143 int (*next) __P((struct irs_ng *, const char **,
144 const char **, const char **));
145 int (*test) __P((struct irs_ng *, const char *,
146 const char *, const char *,
148 void (*rewind) __P((struct irs_ng *, const char *));
149 void (*minimize) __P((struct irs_ng *));
153 * This is the generic map class, which copies the front of all others.
157 void (*close) __P((void *));
161 * This is the accessor class. It contains pointers to all of the
162 * initializers for the map classes for a particular accessor.
166 void (*close) __P((struct irs_acc *));
167 struct irs_gr * (*gr_map) __P((struct irs_acc *));
168 struct irs_pw * (*pw_map) __P((struct irs_acc *));
169 struct irs_sv * (*sv_map) __P((struct irs_acc *));
170 struct irs_pr * (*pr_map) __P((struct irs_acc *));
171 struct irs_ho * (*ho_map) __P((struct irs_acc *));
172 struct irs_nw * (*nw_map) __P((struct irs_acc *));
173 struct irs_ng * (*ng_map) __P((struct irs_acc *));
174 struct __res_state * (*res_get) __P((struct irs_acc *));
175 void (*res_set) __P((struct irs_acc *, res_state,
180 * This is because the official definition of "struct netent" has no
181 * concept of CIDR even though it allows variant address families (on
182 * output but not input). The compatibility stubs convert the structs
183 * below into "struct netent"'s.
186 char *n_name; /* official name of net */
187 char **n_aliases; /* alias list */
188 int n_addrtype; /* net address type */
189 void *n_addr; /* network address */
190 int n_length; /* address length, in bits */
194 * Hide external function names from POSIX.
196 #define irs_gen_acc __irs_gen_acc
197 #define irs_lcl_acc __irs_lcl_acc
198 #define irs_dns_acc __irs_dns_acc
199 #define irs_nis_acc __irs_nis_acc
200 #define irs_irp_acc __irs_irp_acc
201 #define irs_destroy __irs_destroy
202 #define irs_dns_gr __irs_dns_gr
203 #define irs_dns_ho __irs_dns_ho
204 #define irs_dns_nw __irs_dns_nw
205 #define irs_dns_pr __irs_dns_pr
206 #define irs_dns_pw __irs_dns_pw
207 #define irs_dns_sv __irs_dns_sv
208 #define irs_gen_gr __irs_gen_gr
209 #define irs_gen_ho __irs_gen_ho
210 #define irs_gen_ng __irs_gen_ng
211 #define irs_gen_nw __irs_gen_nw
212 #define irs_gen_pr __irs_gen_pr
213 #define irs_gen_pw __irs_gen_pw
214 #define irs_gen_sv __irs_gen_sv
215 #define irs_irp_get_full_response __irs_irp_get_full_response
216 #define irs_irp_gr __irs_irp_gr
217 #define irs_irp_ho __irs_irp_ho
218 #define irs_irp_is_connected __irs_irp_is_connected
219 #define irs_irp_ng __irs_irp_ng
220 #define irs_irp_nw __irs_irp_nw
221 #define irs_irp_pr __irs_irp_pr
222 #define irs_irp_pw __irs_irp_pw
223 #define irs_irp_read_line __irs_irp_read_line
224 #define irs_irp_sv __irs_irp_sv
225 #define irs_lcl_gr __irs_lcl_gr
226 #define irs_lcl_ho __irs_lcl_ho
227 #define irs_lcl_ng __irs_lcl_ng
228 #define irs_lcl_nw __irs_lcl_nw
229 #define irs_lcl_pr __irs_lcl_pr
230 #define irs_lcl_pw __irs_lcl_pw
231 #define irs_lcl_sv __irs_lcl_sv
232 #define irs_nis_gr __irs_nis_gr
233 #define irs_nis_ho __irs_nis_ho
234 #define irs_nis_ng __irs_nis_ng
235 #define irs_nis_nw __irs_nis_nw
236 #define irs_nis_pr __irs_nis_pr
237 #define irs_nis_pw __irs_nis_pw
238 #define irs_nis_sv __irs_nis_sv
239 #define net_data_create __net_data_create
240 #define net_data_destroy __net_data_destroy
241 #define net_data_minimize __net_data_minimize
246 extern struct irs_acc * irs_gen_acc __P((const char *, const char *));
247 extern struct irs_acc * irs_lcl_acc __P((const char *));
248 extern struct irs_acc * irs_dns_acc __P((const char *));
249 extern struct irs_acc * irs_nis_acc __P((const char *));
250 extern struct irs_acc * irs_irp_acc __P((const char *));
252 extern void irs_destroy __P((void));
255 * These forward declarations are for the semi-private functions in
256 * the get*.c files. Each of these funcs implements the real get*
257 * functionality and the standard versions are just wrappers that
258 * call these. Apart from the wrappers, only irpd is expected to
259 * call these directly, hence these decls are put here and not in
260 * the /usr/include replacements.
263 struct net_data; /* forward */
266 * net_data_create gets a singleton net_data object. net_data_init
267 * creates as many net_data objects as times it is called. Clients using
268 * the default interface will use net_data_create by default. Servers will
269 * probably want net_data_init (one call per client)
271 struct net_data *net_data_create __P((const char *));
272 struct net_data *net_data_init __P((const char *));
273 void net_data_destroy __P((void *));
275 extern struct group *getgrent_p __P((struct net_data *));
276 extern struct group *getgrnam_p __P((const char *, struct net_data *));
277 extern struct group *getgrgid_p __P((gid_t, struct net_data *));
278 extern int setgroupent_p __P((int, struct net_data *));
279 extern void endgrent_p __P((struct net_data *));
280 extern int getgrouplist_p __P((const char *, gid_t, gid_t *, int *,
284 extern void setgrent_p __P((struct net_data *));
286 extern int setgrent_p __P((struct net_data *));
289 extern struct hostent *gethostbyname_p __P((const char *,
291 extern struct hostent *gethostbyname2_p __P((const char *, int,
293 extern struct hostent *gethostbyaddr_p __P((const char *, int, int,
295 extern struct hostent *gethostent_p __P((struct net_data *));
296 extern void sethostent_p __P((int, struct net_data *));
297 extern void endhostent_p __P((struct net_data *));
298 extern struct hostent *getipnodebyname_p __P((const char *, int, int, int *,
300 extern struct hostent *getipnodebyaddr_p __P((const void *, size_t,
301 int, int *, struct net_data *));
303 extern struct netent *getnetent_p __P((struct net_data *));
304 extern struct netent *getnetbyname_p __P((const char *, struct net_data *));
305 extern struct netent *getnetbyaddr_p __P((unsigned long, int,
307 extern void setnetent_p __P((int, struct net_data *));
308 extern void endnetent_p __P((struct net_data *));
310 extern void setnetgrent_p __P((const char *, struct net_data *));
311 extern void endnetgrent_p __P((struct net_data *));
312 extern int innetgr_p __P((const char *, const char *, const char *,
313 const char *, struct net_data *));
314 extern int getnetgrent_p __P((const char **, const char **,
315 const char **, struct net_data *));
317 extern struct protoent *getprotoent_p __P((struct net_data *));
318 extern struct protoent *getprotobyname_p __P((const char *,
320 extern struct protoent *getprotobynumber_p __P((int, struct net_data *));
321 extern void setprotoent_p __P((int, struct net_data *));
322 extern void endprotoent_p __P((struct net_data *));
325 extern struct passwd *getpwent_p __P((struct net_data *));
326 extern struct passwd *getpwnam_p __P((const char *, struct net_data *));
327 extern struct passwd *getpwuid_p __P((uid_t, struct net_data *));
328 extern int setpassent_p __P((int, struct net_data *));
329 extern void endpwent_p __P((struct net_data *));
332 extern void setpwent_p __P((struct net_data *));
334 extern int setpwent_p __P((struct net_data *));
337 extern struct servent *getservent_p __P((struct net_data *));
338 extern struct servent *getservbyname_p __P((const char *, const char *,
340 extern struct servent *getservbyport_p __P((int, const char *,
342 extern void setservent_p __P((int, struct net_data *));
343 extern void endservent_p __P((struct net_data *));
345 #endif /*_IRS_H_INCLUDED*/