10 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
14 #define __NEED_socklen_t
15 #define __NEED_uint32_t
17 #include <bits/alltypes.h>
26 struct sockaddr *ai_addr;
28 struct addrinfo *ai_next;
31 #define IPPORT_RESERVED 1024
33 #define AI_PASSIVE 0x01
34 #define AI_CANONNAME 0x02
35 #define AI_NUMERICHOST 0x04
36 #define AI_V4MAPPED 0x08
38 #define AI_ADDRCONFIG 0x20
39 #define AI_NUMERICSERV 0x400
42 #define NI_NUMERICHOST 0x01
43 #define NI_NUMERICSERV 0x02
44 #define NI_NOFQDN 0x04
45 #define NI_NAMEREQD 0x08
47 /*#define NI_NUMERICSCOPE */
49 #define EAI_BADFLAGS -1
54 #define EAI_SOCKTYPE -7
55 #define EAI_SERVICE -8
56 #define EAI_MEMORY -10
57 #define EAI_SYSTEM -11
58 #define EAI_OVERFLOW -12
60 int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);
61 void freeaddrinfo (struct addrinfo *);
62 int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);
63 const char *gai_strerror(int);
66 /* Legacy functions follow (marked OBsolete in SUS) */
84 #define h_addr h_addr_list[0]
101 void sethostent (int);
102 void endhostent (void);
103 struct hostent *gethostent (void);
105 void setnetent (int);
106 void endnetent (void);
107 struct netent *getnetent (void);
108 struct netent *getnetbyaddr (uint32_t, int);
109 struct netent *getnetbyname (const char *);
111 void setservent (int);
112 void endservent (void);
113 struct servent *getservent (void);
114 struct servent *getservbyname (const char *, const char *);
115 struct servent *getservbyport (int, const char *);
117 void setprotoent (int);
118 void endprotoent (void);
119 struct protoent *getprotoent (void);
120 struct protoent *getprotobyname (const char *);
121 struct protoent *getprotobynumber (int);
123 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
124 || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
125 || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
126 struct hostent *gethostbyname (const char *);
127 struct hostent *gethostbyaddr (const void *, socklen_t, int);
129 __attribute__((const))
131 int *__h_errno_location(void);
132 #define h_errno (*__h_errno_location())
133 #define HOST_NOT_FOUND 1
135 #define NO_RECOVERY 3
139 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
140 const char *hstrerror(int);
141 int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
142 int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
143 struct hostent *gethostbyname2(const char *, int);
144 int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);
145 int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);
146 int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);
147 #define EAI_NODATA -5
148 #define EAI_ADDRFAMILY -9
149 #define EAI_INPROGRESS -100
150 #define EAI_CANCELED -101
151 #define EAI_NOTCANCELED -102
152 #define EAI_ALLDONE -103
153 #define EAI_INTR -104
154 #define EAI_IDN_ENCODE -105
155 #define NI_MAXHOST 255
156 #define NI_MAXSERV 32