2
* Copyright (c) 1996,1999 by Internet Software Consortium.
4
* Permission to use, copy, modify, and distribute this software for any
5
* purpose with or without fee is hereby granted, provided that the above
6
* copyright notice and this permission notice appear in all copies.
8
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
9
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
10
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
11
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
12
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
13
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
14
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
19
* $Id: irs.h,v 2.3 2004/09/10 11:49:09 lukeh Exp $
22
#ifndef _IRS_H_INCLUDED
23
#define _IRS_H_INCLUDED
25
#include <sys/types.h>
27
#include <sys/types.h>
28
#include <netinet/in.h>
29
#include <arpa/nameser.h>
38
# if defined(__STDC__) || defined(__GNUC__)
46
* This is the group map class.
50
void (*close) __P((struct irs_gr *));
51
struct group * (*next) __P((struct irs_gr *));
52
struct group * (*byname) __P((struct irs_gr *, const char *));
53
struct group * (*bygid) __P((struct irs_gr *, gid_t));
54
int (*list) __P((struct irs_gr *, const char *,
55
gid_t, gid_t *, int *));
56
void (*rewind) __P((struct irs_gr *));
57
void (*minimize) __P((struct irs_gr *));
58
struct __res_state * (*res_get) __P((struct irs_gr *));
59
void (*res_set) __P((struct irs_gr *, struct __res_state *,
64
* This is the password map class.
68
void (*close) __P((struct irs_pw *));
69
struct passwd * (*next) __P((struct irs_pw *));
70
struct passwd * (*byname) __P((struct irs_pw *, const char *));
71
struct passwd * (*byuid) __P((struct irs_pw *, uid_t));
72
void (*rewind) __P((struct irs_pw *));
73
void (*minimize) __P((struct irs_pw *));
74
struct __res_state * (*res_get) __P((struct irs_pw *));
75
void (*res_set) __P((struct irs_pw *, struct __res_state *,
80
* This is the service map class.
84
void (*close) __P((struct irs_sv *));
85
struct servent *(*byname) __P((struct irs_sv *,
86
const char *, const char *));
87
struct servent *(*byport) __P((struct irs_sv *, int, const char *));
88
struct servent *(*next) __P((struct irs_sv *));
89
void (*rewind) __P((struct irs_sv *));
90
void (*minimize) __P((struct irs_sv *));
91
struct __res_state * (*res_get) __P((struct irs_sv *));
92
void (*res_set) __P((struct irs_sv *, struct __res_state *,
97
* This is the protocols map class.
101
void (*close) __P((struct irs_pr *));
102
struct protoent *(*byname) __P((struct irs_pr *, const char *));
103
struct protoent *(*bynumber) __P((struct irs_pr *, int));
104
struct protoent *(*next) __P((struct irs_pr *));
105
void (*rewind) __P((struct irs_pr *));
106
void (*minimize) __P((struct irs_pr *));
107
struct __res_state * (*res_get) __P((struct irs_pr *));
108
void (*res_set) __P((struct irs_pr *, struct __res_state *,
113
* This is the hosts map class.
117
void (*close) __P((struct irs_ho *));
118
struct hostent *(*byname) __P((struct irs_ho *, const char *));
119
struct hostent *(*byname2) __P((struct irs_ho *, const char *, int));
120
struct hostent *(*byaddr) __P((struct irs_ho *,
121
const void *, int, int));
122
struct hostent *(*next) __P((struct irs_ho *));
123
void (*rewind) __P((struct irs_ho *));
124
void (*minimize) __P((struct irs_ho *));
125
struct __res_state * (*res_get) __P((struct irs_ho *));
126
void (*res_set) __P((struct irs_ho *, struct __res_state *,
131
* This is the networks map class.
135
void (*close) __P((struct irs_nw *));
136
struct nwent * (*byname) __P((struct irs_nw *, const char *, int));
137
struct nwent * (*byaddr) __P((struct irs_nw *, void *, int, int));
138
struct nwent * (*next) __P((struct irs_nw *));
139
void (*rewind) __P((struct irs_nw *));
140
void (*minimize) __P((struct irs_nw *));
141
struct __res_state * (*res_get) __P((struct irs_nw *));
142
void (*res_set) __P((struct irs_nw *, struct __res_state *,
147
* This is the netgroups map class.
151
void (*close) __P((struct irs_ng *));
152
int (*next) __P((struct irs_ng *, char **, char **,
154
int (*test) __P((struct irs_ng *, const char *,
155
const char *, const char *,
157
void (*rewind) __P((struct irs_ng *, const char *));
158
void (*minimize) __P((struct irs_ng *));
162
* This is the generic map class, which copies the front of all others.
166
void (*close) __P((void *));
170
* This is the accessor class. It contains pointers to all of the
171
* initializers for the map classes for a particular accessor.
175
void (*close) __P((struct irs_acc *));
176
struct irs_gr * (*gr_map) __P((struct irs_acc *));
177
struct irs_pw * (*pw_map) __P((struct irs_acc *));
178
struct irs_sv * (*sv_map) __P((struct irs_acc *));
179
struct irs_pr * (*pr_map) __P((struct irs_acc *));
180
struct irs_ho * (*ho_map) __P((struct irs_acc *));
181
struct irs_nw * (*nw_map) __P((struct irs_acc *));
182
struct irs_ng * (*ng_map) __P((struct irs_acc *));
183
struct __res_state * (*res_get) __P((struct irs_acc *));
184
void (*res_set) __P((struct irs_acc *, struct __res_state *,
189
* This is because the official definition of "struct netent" has no
190
* concept of CIDR even though it allows variant address families (on
191
* output but not input). The compatibility stubs convert the structs
192
* below into "struct netent"'s.
195
char *n_name; /* official name of net */
196
char **n_aliases; /* alias list */
197
int n_addrtype; /* net address type */
198
void *n_addr; /* network address */
199
int n_length; /* address length, in bits */
203
* Hide external function names from POSIX.
205
#define irs_gen_acc __irs_gen_acc
206
#define irs_lcl_acc __irs_lcl_acc
207
#define irs_dns_acc __irs_dns_acc
208
#define irs_nis_acc __irs_nis_acc
209
#define irs_irp_acc __irs_irp_acc
214
extern struct irs_acc * irs_gen_acc __P((const char *options,
215
const char *conf_file));
216
extern struct irs_acc * irs_lcl_acc __P((const char *options));
217
extern struct irs_acc * irs_dns_acc __P((const char *options));
218
extern struct irs_acc * irs_nis_acc __P((const char *options));
219
extern struct irs_acc * irs_irp_acc __P((const char *options));
222
* These forward declarations are for the semi-private functions in
223
* the get*.c files. Each of these funcs implements the real get*
224
* functionality and the standard versions are just wrappers that
225
* call these. Apart from the wrappers, only irpd is expected to
226
* call these directly, hence these decls are put here and not in
227
* the /usr/include replacements.
230
struct net_data; /* forward */
233
* net_data_create gets a singleton net_data object. net_data_init
234
* creates as many net_data objects as times it is called. Clients using
235
* the default interface will use net_data_create by default. Servers will
236
* probably want net_data_init (one call per client)
238
struct net_data *net_data_create(const char *conf_file);
239
struct net_data *net_data_init(const char *conf_file);
240
void net_data_destroy(void *p);
242
extern struct group *getgrent_p __P((struct net_data *net_data));
243
extern struct group *getgrnam_p __P((const char *name,
244
struct net_data *net_data));
245
extern struct group *getgrgid_p __P((gid_t gid,
246
struct net_data *net_data));
247
extern int setgroupent_p __P((int stayopen,
248
struct net_data *net_data));
249
extern void endgrent_p __P((struct net_data *net_data));
250
extern int getgrouplist_p __P((const char *name,
254
struct net_data *net_data));
257
extern void setgrent_p __P((struct net_data *net_data));
259
extern int setgrent_p __P((struct net_data *net_data));
262
extern struct hostent *gethostbyname_p __P((const char *name,
263
struct net_data *net_data));
264
extern struct hostent *gethostbyname2_p __P((const char *name, int af,
265
struct net_data *net_data));
266
extern struct hostent *gethostbyaddr_p __P((const char *addr, int len,
268
struct net_data *net_data));
269
extern struct hostent *gethostent_p __P((struct net_data *net_data));
270
extern void sethostent_p __P((int stayopen,
271
struct net_data *net_data));
272
extern void endhostent_p __P((struct net_data *net_data));
274
extern struct netent *getnetent_p __P((struct net_data *net_data));
275
extern struct netent *getnetbyname_p __P((const char *name,
276
struct net_data *net_data));
277
extern struct netent *getnetbyaddr_p __P((unsigned long net, int type,
278
struct net_data *net_data));
279
extern void setnetent_p __P((int stayopen,
280
struct net_data *net_data));
281
extern void endnetent_p __P((struct net_data *net_data));
283
extern void setnetgrent_p __P((const char *netgroup,
284
struct net_data *net_data));
285
extern void endnetgrent_p __P((struct net_data *net_data));
286
extern int innetgr_p __P((const char *netgroup,
290
struct net_data *net_data));
291
extern int getnetgrent_p __P((char **host, char **user,
293
struct net_data *net_data));
295
extern struct protoent *getprotoent_p __P((struct net_data *net_data));
296
extern struct protoent *getprotobyname_p __P((const char *name,
297
struct net_data *net_data));
298
extern struct protoent *getprotobynumber_p __P((int proto,
299
struct net_data *net_data));
300
extern void setprotoent_p __P((int stayopen,
301
struct net_data *net_data));
302
extern void endprotoent_p __P((struct net_data *net_data));
305
extern struct passwd *getpwent_p __P((struct net_data *net_data));
306
extern struct passwd *getpwnam_p __P((const char *name,
307
struct net_data *net_data));
308
extern struct passwd *getpwuid_p __P((uid_t uid,
309
struct net_data *net_data));
310
extern int setpassent_p __P((int stayopen,
311
struct net_data *net_data));
312
extern void endpwent_p __P((struct net_data *net_data));
315
extern void setpwent_p __P((struct net_data *net_data));
317
extern int setpwent_p __P((struct net_data *net_data));
320
extern struct servent *getservent_p __P((struct net_data *net_data));
321
extern struct servent *getservbyname_p __P((const char *name,
323
struct net_data *net_data));
324
extern struct servent *getservbyport_p __P((int port, const char *proto,
325
struct net_data *net_data));
326
extern void setservent_p __P((int stayopen,
327
struct net_data *net_data));
328
extern void endservent_p __P((struct net_data *net_data));
330
#endif /*_IRS_H_INCLUDED*/