1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #ifndef _@GUARD_PREFIX@_NETDB_H
23
24 #if __GNUC__ >= 3
25 @PRAGMA_SYSTEM_HEADER@
26 #endif
27 @PRAGMA_COLUMNS@
28
29 #if @HAVE_NETDB_H@
30
31
32 # @INCLUDE_NEXT@ @NEXT_NETDB_H@
33
34 #endif
35
36 #ifndef _@GUARD_PREFIX@_NETDB_H
37 #define _@GUARD_PREFIX@_NETDB_H
38
39
40
41 #include <sys/socket.h>
42
43
44
45
46
47
48
49
50
51
52 #if @GNULIB_GETADDRINFO@
53
54 # if !@HAVE_STRUCT_ADDRINFO@
55
56 # ifdef __cplusplus
57 extern "C" {
58 # endif
59
60 # if !GNULIB_defined_struct_addrinfo
61
62 struct addrinfo
63 {
64 int ai_flags;
65 int ai_family;
66 int ai_socktype;
67 int ai_protocol;
68 socklen_t ai_addrlen;
69 struct sockaddr *ai_addr;
70 char *ai_canonname;
71 struct addrinfo *ai_next;
72 };
73 # define GNULIB_defined_struct_addrinfo 1
74 # endif
75
76 # ifdef __cplusplus
77 }
78 # endif
79
80 # endif
81
82
83 # ifndef AI_PASSIVE
84 # define AI_PASSIVE 0x0001
85 # endif
86 # ifndef AI_CANONNAME
87 # define AI_CANONNAME 0x0002
88 # endif
89 # ifndef AI_NUMERICSERV
90 # define AI_NUMERICSERV 0x0400
91 # endif
92
93 # if 0
94 # define AI_NUMERICHOST 0x0004
95 # endif
96
97
98
99
100
101
102 # ifndef AI_V4MAPPED
103 # define AI_V4MAPPED 0
104 # endif
105 # ifndef AI_ALL
106 # define AI_ALL 0
107 # endif
108 # ifndef AI_ADDRCONFIG
109 # define AI_ADDRCONFIG 0
110
111 # endif
112
113
114 # ifndef EAI_BADFLAGS
115 # define EAI_BADFLAGS -1
116 # define EAI_NONAME -2
117 # define EAI_AGAIN -3
118 # define EAI_FAIL -4
119 # define EAI_NODATA -5
120 # define EAI_FAMILY -6
121 # define EAI_SOCKTYPE -7
122 # define EAI_SERVICE -8
123 # define EAI_MEMORY -10
124 # endif
125
126
127
128
129 # if !defined EAI_NODATA && defined EAI_NONAME
130 # define EAI_NODATA EAI_NONAME
131 # endif
132
133 # ifndef EAI_OVERFLOW
134
135 # define EAI_OVERFLOW -12
136 # endif
137 # ifndef EAI_ADDRFAMILY
138
139 # define EAI_ADDRFAMILY -9
140 # endif
141 # ifndef EAI_SYSTEM
142
143 # define EAI_SYSTEM -11
144 # endif
145
146 # if 0
147
148
149
150
151 # ifndef EAI_INPROGRESS
152 # define EAI_INPROGRESS -100
153 # define EAI_CANCELED -101
154 # define EAI_NOTCANCELED -102
155 # define EAI_ALLDONE -103
156 # define EAI_INTR -104
157 # define EAI_IDN_ENCODE -105
158 # endif
159 # endif
160
161
162
163
164
165 # if @REPLACE_GETADDRINFO@
166 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
167 # undef getaddrinfo
168 # define getaddrinfo rpl_getaddrinfo
169 # endif
170 _GL_FUNCDECL_RPL (getaddrinfo, int,
171 (const char *restrict nodename,
172 const char *restrict servname,
173 const struct addrinfo *restrict hints,
174 struct addrinfo **restrict res)
175 _GL_ARG_NONNULL ((4)));
176 _GL_CXXALIAS_RPL (getaddrinfo, int,
177 (const char *restrict nodename,
178 const char *restrict servname,
179 const struct addrinfo *restrict hints,
180 struct addrinfo **restrict res));
181 # else
182 # if !@HAVE_DECL_GETADDRINFO@
183 _GL_FUNCDECL_SYS (getaddrinfo, int,
184 (const char *restrict nodename,
185 const char *restrict servname,
186 const struct addrinfo *restrict hints,
187 struct addrinfo **restrict res)
188 _GL_ARG_NONNULL ((4)));
189 # endif
190 _GL_CXXALIAS_SYS (getaddrinfo, int,
191 (const char *restrict nodename,
192 const char *restrict servname,
193 const struct addrinfo *restrict hints,
194 struct addrinfo **restrict res));
195 # endif
196 _GL_CXXALIASWARN (getaddrinfo);
197
198
199
200
201 # if @REPLACE_GETADDRINFO@
202 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
203 # undef freeaddrinfo
204 # define freeaddrinfo rpl_freeaddrinfo
205 # endif
206 _GL_FUNCDECL_RPL (freeaddrinfo, void, (struct addrinfo *ai)
207 _GL_ARG_NONNULL ((1)));
208 _GL_CXXALIAS_RPL (freeaddrinfo, void, (struct addrinfo *ai));
209 # else
210 # if !@HAVE_DECL_FREEADDRINFO@
211 _GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
212 _GL_ARG_NONNULL ((1)));
213 # endif
214 _GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
215 # endif
216 _GL_CXXALIASWARN (freeaddrinfo);
217
218 # if @REPLACE_GAI_STRERROR@
219 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
220 # undef gai_strerror
221 # define gai_strerror rpl_gai_strerror
222 # endif
223 _GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode));
224 _GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
225 # else
226 # if !@HAVE_DECL_GAI_STRERROR@
227
228
229
230 _GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode));
231 # endif
232 _GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
233 # endif
234 # if __GLIBC__ >= 2
235 _GL_CXXALIASWARN (gai_strerror);
236 # endif
237
238 # if !@HAVE_DECL_GETNAMEINFO@
239
240
241
242 _GL_FUNCDECL_SYS (getnameinfo, int,
243 (const struct sockaddr *restrict sa, socklen_t salen,
244 char *restrict node, socklen_t nodelen,
245 char *restrict service, socklen_t servicelen,
246 int flags)
247 _GL_ARG_NONNULL ((1)));
248 # endif
249
250
251 _GL_CXXALIAS_SYS_CAST (getnameinfo, int,
252 (const struct sockaddr *restrict sa, socklen_t salen,
253 char *restrict node, socklen_t nodelen,
254 char *restrict service, socklen_t servicelen,
255 int flags));
256 _GL_CXXALIASWARN (getnameinfo);
257
258
259 # ifndef NI_NUMERICHOST
260 # define NI_NUMERICHOST 1
261 # endif
262 # ifndef NI_NUMERICSERV
263 # define NI_NUMERICSERV 2
264 # endif
265
266 #elif defined GNULIB_POSIXCHECK
267
268 # undef getaddrinfo
269 # if HAVE_RAW_DECL_GETADDRINFO
270 _GL_WARN_ON_USE (getaddrinfo, "getaddrinfo is unportable - "
271 "use gnulib module getaddrinfo for portability");
272 # endif
273
274 # undef freeaddrinfo
275 # if HAVE_RAW_DECL_FREEADDRINFO
276 _GL_WARN_ON_USE (freeaddrinfo, "freeaddrinfo is unportable - "
277 "use gnulib module getaddrinfo for portability");
278 # endif
279
280 # undef gai_strerror
281 # if HAVE_RAW_DECL_GAI_STRERROR
282 _GL_WARN_ON_USE (gai_strerror, "gai_strerror is unportable - "
283 "use gnulib module getaddrinfo for portability");
284 # endif
285
286 # undef getnameinfo
287 # if HAVE_RAW_DECL_GETNAMEINFO
288 _GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
289 "use gnulib module getaddrinfo for portability");
290 # endif
291
292 #endif
293
294 #endif
295 #endif