PageRenderTime 18ms CodeModel.GetById 7ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/contrib/bind9/lib/lwres/include/lwres/netdb.h.in

https://bitbucket.org/freebsd/freebsd-head/
Autoconf | 520 lines | 173 code | 89 blank | 258 comment | 13 complexity | 18d4b9727c61d6b958ccd4cced8a6be9 MD5 | raw file
  1/*
  2 * Copyright (C) 2004, 2005, 2007, 2009  Internet Systems Consortium, Inc. ("ISC")
  3 * Copyright (C) 2000, 2001  Internet Software Consortium.
  4 *
  5 * Permission to use, copy, modify, and/or 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 WITH
 10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 11 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 15 * PERFORMANCE OF THIS SOFTWARE.
 16 */
 17
 18/* $Id: netdb.h.in,v 1.41 2009/01/18 23:48:14 tbox Exp $ */
 19
 20/*! \file */
 21
 22#ifndef LWRES_NETDB_H
 23#define LWRES_NETDB_H 1
 24
 25#include <stddef.h>	/* Required on FreeBSD (and  others?) for size_t. */
 26#include <netdb.h>	/* Contractual provision. */
 27
 28#include <lwres/lang.h>
 29
 30/*
 31 * Define if <netdb.h> does not declare struct addrinfo.
 32 */
 33@ISC_LWRES_NEEDADDRINFO@
 34
 35#ifdef ISC_LWRES_NEEDADDRINFO
 36struct addrinfo {
 37	int		ai_flags;      /* AI_PASSIVE, AI_CANONNAME */
 38	int		ai_family;     /* PF_xxx */
 39	int		ai_socktype;   /* SOCK_xxx */
 40	int		ai_protocol;   /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
 41	size_t		ai_addrlen;    /* Length of ai_addr */
 42	char		*ai_canonname; /* Canonical name for hostname */
 43	struct sockaddr	*ai_addr;      /* Binary address */
 44	struct addrinfo	*ai_next;      /* Next structure in linked list */
 45};
 46#endif
 47
 48/*
 49 * Undefine all #defines we are interested in as <netdb.h> may or may not have
 50 * defined them.
 51 */
 52
 53/*
 54 * Error return codes from gethostbyname() and gethostbyaddr()
 55 * (left in extern int h_errno).
 56 */
 57
 58#undef	NETDB_INTERNAL
 59#undef	NETDB_SUCCESS
 60#undef	HOST_NOT_FOUND
 61#undef	TRY_AGAIN
 62#undef	NO_RECOVERY
 63#undef	NO_DATA
 64#undef	NO_ADDRESS
 65
 66#define	NETDB_INTERNAL	-1	/* see errno */
 67#define	NETDB_SUCCESS	0	/* no problem */
 68#define	HOST_NOT_FOUND	1 /* Authoritative Answer Host not found */
 69#define	TRY_AGAIN	2 /* Non-Authoritative Host not found, or SERVERFAIL */
 70#define	NO_RECOVERY	3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
 71#define	NO_DATA		4 /* Valid name, no data record of requested type */
 72#define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
 73
 74/*
 75 * Error return codes from getaddrinfo()
 76 */
 77
 78#undef	EAI_ADDRFAMILY
 79#undef	EAI_AGAIN
 80#undef	EAI_BADFLAGS
 81#undef	EAI_FAIL
 82#undef	EAI_FAMILY
 83#undef	EAI_MEMORY
 84#undef	EAI_NODATA
 85#undef	EAI_NONAME
 86#undef	EAI_SERVICE
 87#undef	EAI_SOCKTYPE
 88#undef	EAI_SYSTEM
 89#undef	EAI_BADHINTS
 90#undef	EAI_PROTOCOL
 91#undef	EAI_MAX
 92
 93#define	EAI_ADDRFAMILY	 1	/* address family for hostname not supported */
 94#define	EAI_AGAIN	 2	/* temporary failure in name resolution */
 95#define	EAI_BADFLAGS	 3	/* invalid value for ai_flags */
 96#define	EAI_FAIL	 4	/* non-recoverable failure in name resolution */
 97#define	EAI_FAMILY	 5	/* ai_family not supported */
 98#define	EAI_MEMORY	 6	/* memory allocation failure */
 99#define	EAI_NODATA	 7	/* no address associated with hostname */
100#define	EAI_NONAME	 8	/* hostname nor servname provided, or not known */
101#define	EAI_SERVICE	 9	/* servname not supported for ai_socktype */
102#define	EAI_SOCKTYPE	10	/* ai_socktype not supported */
103#define	EAI_SYSTEM	11	/* system error returned in errno */
104#define EAI_BADHINTS	12
105#define EAI_PROTOCOL	13
106#define EAI_MAX		14
107
108/*
109 * Flag values for getaddrinfo()
110 */
111#undef	AI_PASSIVE
112#undef	AI_CANONNAME
113#undef	AI_NUMERICHOST
114
115#define	AI_PASSIVE	0x00000001
116#define	AI_CANONNAME	0x00000002
117#define AI_NUMERICHOST	0x00000004
118
119/*
120 * Flag values for getipnodebyname()
121 */
122#undef AI_V4MAPPED
123#undef AI_ALL
124#undef AI_ADDRCONFIG
125#undef AI_DEFAULT
126
127#define AI_V4MAPPED	0x00000008
128#define AI_ALL		0x00000010
129#define AI_ADDRCONFIG	0x00000020
130#define AI_DEFAULT	(AI_V4MAPPED|AI_ADDRCONFIG)
131
132/*
133 * Constants for lwres_getnameinfo()
134 */
135#undef	NI_MAXHOST
136#undef	NI_MAXSERV
137
138#define	NI_MAXHOST	1025
139#define	NI_MAXSERV	32
140
141/*
142 * Flag values for lwres_getnameinfo()
143 */
144#undef	NI_NOFQDN
145#undef	NI_NUMERICHOST
146#undef	NI_NAMEREQD
147#undef	NI_NUMERICSERV
148#undef	NI_DGRAM
149#undef	NI_NUMERICSCOPE
150
151#define	NI_NOFQDN	0x00000001
152#define	NI_NUMERICHOST	0x00000002
153#define	NI_NAMEREQD	0x00000004
154#define	NI_NUMERICSERV	0x00000008
155#define	NI_DGRAM	0x00000010
156#define	NI_NUMERICSCOPE	0x00000020	/*2553bis-00*/
157
158/*
159 * Define if <netdb.h> does not declare struct rrsetinfo.
160 */
161@ISC_LWRES_NEEDRRSETINFO@
162
163#ifdef ISC_LWRES_NEEDRRSETINFO
164/*
165 * Structures for getrrsetbyname()
166 */
167struct rdatainfo {
168	unsigned int		rdi_length;
169	unsigned char		*rdi_data;
170};
171
172struct rrsetinfo {
173	unsigned int		rri_flags;
174	int			rri_rdclass;
175	int			rri_rdtype;
176	unsigned int		rri_ttl;
177	unsigned int		rri_nrdatas;
178	unsigned int		rri_nsigs;
179	char			*rri_name;
180	struct rdatainfo	*rri_rdatas;
181	struct rdatainfo	*rri_sigs;
182};
183
184/*
185 * Flags for getrrsetbyname()
186 */
187#define RRSET_VALIDATED		0x00000001
188	/* Set was dnssec validated */
189
190/*
191 * Return codes for getrrsetbyname()
192 */
193#define ERRSET_SUCCESS		0
194#define ERRSET_NOMEMORY		1
195#define ERRSET_FAIL		2
196#define ERRSET_INVAL		3
197#define	ERRSET_NONAME	 	4
198#define	ERRSET_NODATA	 	5
199#endif
200
201/*
202 * Define to map into lwres_ namespace.
203 */
204
205#define LWRES_NAMESPACE
206
207#ifdef LWRES_NAMESPACE
208
209/*
210 * Use our versions not the ones from the C library.
211 */
212
213#ifdef getnameinfo
214#undef getnameinfo
215#endif
216#define getnameinfo lwres_getnameinfo
217
218#ifdef getaddrinfo
219#undef getaddrinfo
220#endif
221#define getaddrinfo lwres_getaddrinfo
222
223#ifdef freeaddrinfo
224#undef freeaddrinfo
225#endif
226#define freeaddrinfo lwres_freeaddrinfo
227
228#ifdef gai_strerror
229#undef gai_strerror
230#endif
231#define gai_strerror lwres_gai_strerror
232
233#ifdef herror
234#undef herror
235#endif
236#define herror lwres_herror
237
238#ifdef hstrerror
239#undef hstrerror
240#endif
241#define hstrerror lwres_hstrerror
242
243#ifdef getipnodebyname
244#undef getipnodebyname
245#endif
246#define getipnodebyname lwres_getipnodebyname
247
248#ifdef getipnodebyaddr
249#undef getipnodebyaddr
250#endif
251#define getipnodebyaddr lwres_getipnodebyaddr
252
253#ifdef freehostent
254#undef freehostent
255#endif
256#define freehostent lwres_freehostent
257
258#ifdef gethostbyname
259#undef gethostbyname
260#endif
261#define gethostbyname lwres_gethostbyname
262
263#ifdef gethostbyname2
264#undef gethostbyname2
265#endif
266#define gethostbyname2 lwres_gethostbyname2
267
268#ifdef gethostbyaddr
269#undef gethostbyaddr
270#endif
271#define gethostbyaddr lwres_gethostbyaddr
272
273#ifdef gethostent
274#undef gethostent
275#endif
276#define gethostent lwres_gethostent
277
278#ifdef sethostent
279#undef sethostent
280#endif
281#define sethostent lwres_sethostent
282
283#ifdef endhostent
284#undef endhostent
285#endif
286#define endhostent lwres_endhostent
287
288/* #define sethostfile lwres_sethostfile */
289
290#ifdef gethostbyname_r
291#undef gethostbyname_r
292#endif
293#define gethostbyname_r lwres_gethostbyname_r
294
295#ifdef gethostbyaddr_r
296#undef gethostbyaddr_r
297#endif
298#define gethostbyaddr_r lwres_gethostbyaddr_r
299
300#ifdef gethostent_r
301#undef gethostent_r
302#endif
303#define gethostent_r lwres_gethostent_r
304
305#ifdef sethostent_r
306#undef sethostent_r
307#endif
308#define sethostent_r lwres_sethostent_r
309
310#ifdef endhostent_r
311#undef endhostent_r
312#endif
313#define endhostent_r lwres_endhostent_r
314
315#ifdef getrrsetbyname
316#undef getrrsetbyname
317#endif
318#define getrrsetbyname lwres_getrrsetbyname
319
320#ifdef freerrset
321#undef freerrset
322#endif
323#define freerrset lwres_freerrset
324
325#ifdef notyet
326#define getservbyname lwres_getservbyname
327#define getservbyport lwres_getservbyport
328#define getservent lwres_getservent
329#define setservent lwres_setservent
330#define endservent lwres_endservent
331
332#define getservbyname_r lwres_getservbyname_r
333#define getservbyport_r lwres_getservbyport_r
334#define getservent_r lwres_getservent_r
335#define setservent_r lwres_setservent_r
336#define endservent_r lwres_endservent_r
337
338#define getprotobyname lwres_getprotobyname
339#define getprotobynumber lwres_getprotobynumber
340#define getprotoent lwres_getprotoent
341#define setprotoent lwres_setprotoent
342#define endprotoent lwres_endprotoent
343
344#define getprotobyname_r lwres_getprotobyname_r
345#define getprotobynumber_r lwres_getprotobynumber_r
346#define getprotoent_r lwres_getprotoent_r
347#define setprotoent_r lwres_setprotoent_r
348#define endprotoent_r lwres_endprotoent_r
349
350#ifdef getnetbyname
351#undef getnetbyname
352#endif
353#define getnetbyname lwres_getnetbyname
354
355#ifdef getnetbyaddr
356#undef getnetbyaddr
357#endif
358#define getnetbyaddr lwres_getnetbyaddr
359
360#ifdef getnetent
361#undef getnetent
362#endif
363#define getnetent lwres_getnetent
364
365#ifdef setnetent
366#undef setnetent
367#endif
368#define setnetent lwres_setnetent
369
370#ifdef endnetent
371#undef endnetent
372#endif
373#define endnetent lwres_endnetent
374
375
376#ifdef getnetbyname_r
377#undef getnetbyname_r
378#endif
379#define getnetbyname_r lwres_getnetbyname_r
380
381#ifdef getnetbyaddr_r
382#undef getnetbyaddr_r
383#endif
384#define getnetbyaddr_r lwres_getnetbyaddr_r
385
386#ifdef getnetent_r
387#undef getnetent_r
388#endif
389#define getnetent_r lwres_getnetent_r
390
391#ifdef setnetent_r
392#undef setnetent_r
393#endif
394#define setnetent_r lwres_setnetent_r
395
396#ifdef endnetent_r
397#undef endnetent_r
398#endif
399#define endnetent_r lwres_endnetent_r
400#endif	/* notyet */
401
402#ifdef h_errno
403#undef h_errno
404#endif
405#define h_errno lwres_h_errno
406
407#endif	/* LWRES_NAMESPACE */
408
409LWRES_LANG_BEGINDECLS
410
411extern int lwres_h_errno;
412
413int		lwres_getaddrinfo(const char *, const char *,
414				 const struct addrinfo *, struct addrinfo **);
415int		lwres_getnameinfo(const struct sockaddr *, size_t, char *,
416				 size_t, char *, size_t, int);
417void		lwres_freeaddrinfo(struct addrinfo *);
418char		*lwres_gai_strerror(int);
419
420struct hostent	*lwres_gethostbyaddr(const char *, int, int);
421struct hostent	*lwres_gethostbyname(const char *);
422struct hostent	*lwres_gethostbyname2(const char *, int);
423struct hostent	*lwres_gethostent(void);
424struct hostent	*lwres_getipnodebyname(const char *, int, int, int *);
425struct hostent	*lwres_getipnodebyaddr(const void *, size_t, int, int *);
426void		lwres_endhostent(void);
427void		lwres_sethostent(int);
428/* void		lwres_sethostfile(const char *); */
429void		lwres_freehostent(struct hostent *);
430
431int		lwres_getrrsetbyname(const char *, unsigned int, unsigned int,
432				     unsigned int, struct rrsetinfo **);
433void		lwres_freerrset(struct rrsetinfo *);
434
435#ifdef notyet
436struct netent	*lwres_getnetbyaddr(unsigned long, int);
437struct netent	*lwres_getnetbyname(const char *);
438struct netent	*lwres_getnetent(void);
439void		lwres_endnetent(void);
440void		lwres_setnetent(int);
441
442struct protoent	*lwres_getprotobyname(const char *);
443struct protoent	*lwres_getprotobynumber(int);
444struct protoent	*lwres_getprotoent(void);
445void		lwres_endprotoent(void);
446void		lwres_setprotoent(int);
447
448struct servent	*lwres_getservbyname(const char *, const char *);
449struct servent	*lwres_getservbyport(int, const char *);
450struct servent	*lwres_getservent(void);
451void		lwres_endservent(void);
452void		lwres_setservent(int);
453#endif /* notyet */
454
455void		lwres_herror(const char *);
456const char	*lwres_hstrerror(int);
457
458
459struct hostent	*lwres_gethostbyaddr_r(const char *, int, int, struct hostent *,
460					char *, int, int *);
461struct hostent	*lwres_gethostbyname_r(const char *, struct hostent *,
462					char *, int, int *);
463struct hostent	*lwres_gethostent_r(struct hostent *, char *, int, int *);
464void		lwres_sethostent_r(int);
465void		lwres_endhostent_r(void);
466
467#ifdef notyet
468struct netent	*lwres_getnetbyname_r(const char *, struct netent *,
469					char *, int);
470struct netent	*lwres_getnetbyaddr_r(long, int, struct netent *,
471					char *, int);
472struct netent	*lwres_getnetent_r(struct netent *, char *, int);
473void		lwres_setnetent_r(int);
474void		lwres_endnetent_r(void);
475
476struct protoent	*lwres_getprotobyname_r(const char *,
477				struct protoent *, char *, int);
478struct protoent	*lwres_getprotobynumber_r(int,
479				struct protoent *, char *, int);
480struct protoent	*lwres_getprotoent_r(struct protoent *, char *, int);
481void		lwres_setprotoent_r(int);
482void		lwres_endprotoent_r(void);
483
484struct servent	*lwres_getservbyname_r(const char *name, const char *,
485					struct servent *, char *, int);
486struct servent	*lwres_getservbyport_r(int port, const char *,
487					struct servent *, char *, int);
488struct servent	*lwres_getservent_r(struct servent *, char *, int);
489void		lwres_setservent_r(int);
490void		lwres_endservent_r(void);
491#endif	/* notyet */
492
493LWRES_LANG_ENDDECLS
494
495#ifdef notyet
496/* This is nec'y to make this include file properly replace the sun version. */
497#ifdef sun
498#ifdef __GNU_LIBRARY__
499#include <rpc/netdb.h>		/* Required. */
500#else /* !__GNU_LIBRARY__ */
501struct rpcent {
502	char	*r_name;	/* name of server for this rpc program */
503	char	**r_aliases;	/* alias list */
504	int	r_number;	/* rpc program number */
505};
506struct rpcent	*lwres_getrpcbyname();
507struct rpcent	*lwres_getrpcbynumber(),
508struct rpcent	*lwres_getrpcent();
509#endif /* __GNU_LIBRARY__ */
510#endif /* sun */
511#endif /* notyet */
512
513/*
514 * Tell Emacs to use C mode on this file.
515 * Local variables:
516 * mode: c
517 * End:
518 */
519
520#endif /* LWRES_NETDB_H */