Import upstream 2.3.14
[packages/xinetd.git] / libs / src / portable / fake-getaddrinfo.h
1 #ifndef _FAKE_GETADDRINFO_H
2 #define _FAKE_GETADDRINFO_H
3
4 #include "config.h"
5
6 /*
7 #include "fake-gai-errnos.h"
8 */
9
10 #ifndef AI_PASSIVE
11 # define AI_PASSIVE        1
12 # define AI_CANONNAME      2
13 #endif
14
15 #ifndef NI_NUMERICHOST
16 # define NI_NUMERICHOST    2
17 # define NI_NAMEREQD       4
18 # define NI_NUMERICSERV    8
19 #endif
20
21 #ifndef EAI_NODATA
22 #define EAI_NODATA        -5
23 #endif
24
25 #ifndef EAI_MEMORY
26 #define EAI_MEMORY       -10
27 #endif
28
29 #ifndef HAVE_STRUCT_ADDRINFO
30 struct addrinfo {
31         int     ai_flags;       /* AI_PASSIVE, AI_CANONNAME */
32         int     ai_family;      /* PF_xxx */
33         int     ai_socktype;    /* SOCK_xxx */
34         int     ai_protocol;    /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
35         size_t  ai_addrlen;     /* length of ai_addr */
36         char    *ai_canonname;  /* canonical name for hostname */
37         struct sockaddr *ai_addr;       /* binary address */
38         struct addrinfo *ai_next;       /* next structure in linked list */
39 };
40 #endif /* !HAVE_STRUCT_ADDRINFO */
41
42 #ifndef HAVE_GETADDRINFO
43 int getaddrinfo(const char *hostname, const char *servname, 
44                 const struct addrinfo *hints, struct addrinfo **res);
45 #endif /* !HAVE_GETADDRINFO */
46
47 #ifndef HAVE_GAI_STRERROR
48 char *gai_strerror(int ecode);
49 #endif /* !HAVE_GAI_STRERROR */
50
51 #ifndef HAVE_FREEADDRINFO
52 void freeaddrinfo(struct addrinfo *ai);
53 #endif /* !HAVE_FREEADDRINFO */
54
55 #endif /* _FAKE_GETADDRINFO_H */