95
110
returned address type. */
98
/* Error values for `getaddrinfo' function. */
113
/* Error values for 'getaddrinfo' function. */
99
114
# ifndef EAI_BADFLAGS
100
# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
115
# define EAI_BADFLAGS -1 /* Invalid value for 'ai_flags' field. */
101
116
# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
102
117
# define EAI_AGAIN -3 /* Temporary failure in name resolution. */
103
118
# define EAI_FAIL -4 /* Non-recoverable failure in name res. */
104
119
# define EAI_NODATA -5 /* No address associated with NAME. */
105
# define EAI_FAMILY -6 /* `ai_family' not supported. */
106
# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
107
# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
120
# define EAI_FAMILY -6 /* 'ai_family' not supported. */
121
# define EAI_SOCKTYPE -7 /* 'ai_socktype' not supported. */
122
# define EAI_SERVICE -8 /* SERVICE not supported for 'ai_socktype'. */
108
123
# define EAI_MEMORY -10 /* Memory allocation failure. */
148
163
socket addresses.
149
164
For more details, see the POSIX:2001 specification
150
165
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
151
extern int getaddrinfo (const char *restrict nodename,
152
const char *restrict servname,
153
const struct addrinfo *restrict hints,
154
struct addrinfo **restrict res)
155
_GL_ARG_NONNULL ((4));
166
_GL_FUNCDECL_SYS (getaddrinfo, int,
167
(const char *restrict nodename,
168
const char *restrict servname,
169
const struct addrinfo *restrict hints,
170
struct addrinfo **restrict res)
171
_GL_ARG_NONNULL ((4)));
173
_GL_CXXALIAS_SYS (getaddrinfo, int,
174
(const char *restrict nodename,
175
const char *restrict servname,
176
const struct addrinfo *restrict hints,
177
struct addrinfo **restrict res));
178
_GL_CXXALIASWARN (getaddrinfo);
158
180
# if !@HAVE_DECL_FREEADDRINFO@
159
/* Free `addrinfo' structure AI including associated storage.
181
/* Free 'addrinfo' structure AI including associated storage.
160
182
For more details, see the POSIX:2001 specification
161
183
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
162
extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
184
_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
185
_GL_ARG_NONNULL ((1)));
187
_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
188
_GL_CXXALIASWARN (freeaddrinfo);
165
# if !@HAVE_DECL_GAI_STRERROR@
190
# if @REPLACE_GAI_STRERROR@
191
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
193
# define gai_strerror rpl_gai_strerror
195
_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode));
196
_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
198
# if !@HAVE_DECL_GAI_STRERROR@
166
199
/* Convert error return from getaddrinfo() to a string.
167
200
For more details, see the POSIX:2001 specification
168
201
<http://www.opengroup.org/susv3xsh/gai_strerror.html>. */
169
extern const char *gai_strerror (int ecode);
202
_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode));
204
_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
206
_GL_CXXALIASWARN (gai_strerror);
172
208
# if !@HAVE_DECL_GETNAMEINFO@
173
209
/* Convert socket address to printable node and service names.
174
210
For more details, see the POSIX:2001 specification
175
211
<http://www.opengroup.org/susv3xsh/getnameinfo.html>. */
176
extern int getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
212
_GL_FUNCDECL_SYS (getnameinfo, int,
213
(const struct sockaddr *restrict sa, socklen_t salen,
214
char *restrict node, socklen_t nodelen,
215
char *restrict service, socklen_t servicelen,
217
_GL_ARG_NONNULL ((1)));
219
/* Need to cast, because on glibc systems, the seventh parameter is
220
unsigned int flags. */
221
_GL_CXXALIAS_SYS_CAST (getnameinfo, int,
222
(const struct sockaddr *restrict sa, socklen_t salen,
177
223
char *restrict node, socklen_t nodelen,
178
224
char *restrict service, socklen_t servicelen,
180
_GL_ARG_NONNULL ((1));
226
_GL_CXXALIASWARN (getnameinfo);
183
228
/* Possible flags for getnameinfo. */
184
229
# ifndef NI_NUMERICHOST