GDB support: add frame annotators and filters
[bpt/guile.git] / lib / netdb.in.h
CommitLineData
40ff484d 1/* Provide a netdb.h header file for systems lacking it (read: MinGW).
5e69ceb7 2 Copyright (C) 2008-2014 Free Software Foundation, Inc.
40ff484d
LC
3 Written by Simon Josefsson.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
005de2e8 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
40ff484d
LC
17
18/* This file is supposed to be used on platforms that lack <netdb.h>.
19 It is intended to provide definitions and prototypes needed by an
20 application. */
21
3d458a81 22#ifndef _@GUARD_PREFIX@_NETDB_H
40ff484d 23
a927b6c1 24#if __GNUC__ >= 3
40ff484d 25@PRAGMA_SYSTEM_HEADER@
a927b6c1 26#endif
0f00f2c3 27@PRAGMA_COLUMNS@
a927b6c1
LC
28
29#if @HAVE_NETDB_H@
40ff484d
LC
30
31/* The include_next requires a split double-inclusion guard. */
32# @INCLUDE_NEXT@ @NEXT_NETDB_H@
33
34#endif
35
3d458a81
AW
36#ifndef _@GUARD_PREFIX@_NETDB_H
37#define _@GUARD_PREFIX@_NETDB_H
40ff484d 38
dd7d0148
LC
39/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and
40 'struct hostent' on MinGW. */
40ff484d
LC
41#include <sys/socket.h>
42
3d458a81
AW
43/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
44
40ff484d
LC
45/* The definition of _GL_ARG_NONNULL is copied here. */
46
a927b6c1
LC
47/* The definition of _GL_WARN_ON_USE is copied here. */
48
40ff484d
LC
49/* Declarations for a platform that lacks <netdb.h>, or where it is
50 incomplete. */
51
52#if @GNULIB_GETADDRINFO@
53
54# if !@HAVE_STRUCT_ADDRINFO@
55
3d458a81
AW
56# ifdef __cplusplus
57extern "C" {
58# endif
59
49114fd4 60# if !GNULIB_defined_struct_addrinfo
40ff484d
LC
61/* Structure to contain information about address of a service provider. */
62struct addrinfo
63{
64 int ai_flags; /* Input flags. */
65 int ai_family; /* Protocol family for socket. */
66 int ai_socktype; /* Socket type. */
67 int ai_protocol; /* Protocol for socket. */
68 socklen_t ai_addrlen; /* Length of socket address. */
69 struct sockaddr *ai_addr; /* Socket address for socket. */
70 char *ai_canonname; /* Canonical name for service location. */
71 struct addrinfo *ai_next; /* Pointer to next in list. */
72};
49114fd4
LC
73# define GNULIB_defined_struct_addrinfo 1
74# endif
3d458a81
AW
75
76# ifdef __cplusplus
77}
78# endif
79
40ff484d
LC
80# endif
81
f0007cad 82/* Possible values for 'ai_flags' field in 'addrinfo' structure. */
40ff484d 83# ifndef AI_PASSIVE
f0007cad 84# define AI_PASSIVE 0x0001 /* Socket address is intended for 'bind'. */
40ff484d
LC
85# endif
86# ifndef AI_CANONNAME
87# define AI_CANONNAME 0x0002 /* Request for canonical name. */
88# endif
89# ifndef AI_NUMERICSERV
90# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
91# endif
92
93# if 0
40ff484d 94# define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
dde9c5a4
LC
95# endif
96
97/* These symbolic constants are required to be present by POSIX, but
98 our getaddrinfo replacement doesn't use them (yet). Setting them
99 to 0 on systems that doesn't have them avoids causing problems for
100 system getaddrinfo implementations that would be confused by
101 unknown values. */
102# ifndef AI_V4MAPPED
103# define AI_V4MAPPED 0 /* 0x0008: IPv4 mapped addresses are acceptable. */
104# endif
105# ifndef AI_ALL
106# define AI_ALL 0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */
107# endif
108# ifndef AI_ADDRCONFIG
109# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose
110 returned address type. */
111# endif
40ff484d 112
f0007cad 113/* Error values for 'getaddrinfo' function. */
40ff484d 114# ifndef EAI_BADFLAGS
f0007cad 115# define EAI_BADFLAGS -1 /* Invalid value for 'ai_flags' field. */
40ff484d
LC
116# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
117# define EAI_AGAIN -3 /* Temporary failure in name resolution. */
118# define EAI_FAIL -4 /* Non-recoverable failure in name res. */
119# define EAI_NODATA -5 /* No address associated with NAME. */
f0007cad
LC
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'. */
40ff484d
LC
123# define EAI_MEMORY -10 /* Memory allocation failure. */
124# endif
125
126/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
127 FreeBSD, which does define EAI_BADFLAGS) have removed the definition
128 in favor of EAI_NONAME. */
129# if !defined EAI_NODATA && defined EAI_NONAME
130# define EAI_NODATA EAI_NONAME
131# endif
132
133# ifndef EAI_OVERFLOW
134/* Not defined on mingw32 and Haiku. */
135# define EAI_OVERFLOW -12 /* Argument buffer overflow. */
136# endif
137# ifndef EAI_ADDRFAMILY
138/* Not defined on mingw32. */
139# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
140# endif
141# ifndef EAI_SYSTEM
142/* Not defined on mingw32. */
f0007cad 143# define EAI_SYSTEM -11 /* System error returned in 'errno'. */
40ff484d
LC
144# endif
145
146# if 0
147/* The commented out definitions below are not yet implemented in the
148 GNULIB getaddrinfo() replacement, so are not yet needed.
149
150 If they are restored, be sure to protect the definitions with #ifndef. */
151# ifndef EAI_INPROGRESS
152# define EAI_INPROGRESS -100 /* Processing request in progress. */
153# define EAI_CANCELED -101 /* Request canceled. */
154# define EAI_NOTCANCELED -102 /* Request not canceled. */
155# define EAI_ALLDONE -103 /* All requests done. */
156# define EAI_INTR -104 /* Interrupted by a signal. */
157# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
158# endif
159# endif
160
161# if !@HAVE_DECL_GETADDRINFO@
162/* Translate name of a service location and/or a service name to set of
163 socket addresses.
164 For more details, see the POSIX:2001 specification
165 <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
3d458a81
AW
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)));
40ff484d 172# endif
3d458a81
AW
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);
40ff484d
LC
179
180# if !@HAVE_DECL_FREEADDRINFO@
f0007cad 181/* Free 'addrinfo' structure AI including associated storage.
40ff484d
LC
182 For more details, see the POSIX:2001 specification
183 <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
3d458a81
AW
184_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
185 _GL_ARG_NONNULL ((1)));
40ff484d 186# endif
3d458a81
AW
187_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
188_GL_CXXALIASWARN (freeaddrinfo);
40ff484d 189
3d458a81
AW
190# if @REPLACE_GAI_STRERROR@
191# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
192# undef gai_strerror
193# define gai_strerror rpl_gai_strerror
194# endif
195_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode));
196_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
197# else
198# if !@HAVE_DECL_GAI_STRERROR@
40ff484d
LC
199/* Convert error return from getaddrinfo() to a string.
200 For more details, see the POSIX:2001 specification
201 <http://www.opengroup.org/susv3xsh/gai_strerror.html>. */
3d458a81
AW
202_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode));
203# endif
204_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
40ff484d 205# endif
3d458a81 206_GL_CXXALIASWARN (gai_strerror);
40ff484d
LC
207
208# if !@HAVE_DECL_GETNAMEINFO@
209/* Convert socket address to printable node and service names.
210 For more details, see the POSIX:2001 specification
211 <http://www.opengroup.org/susv3xsh/getnameinfo.html>. */
3d458a81
AW
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,
216 int flags)
217 _GL_ARG_NONNULL ((1)));
218# endif
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,
a927b6c1
LC
223 char *restrict node, socklen_t nodelen,
224 char *restrict service, socklen_t servicelen,
3d458a81
AW
225 int flags));
226_GL_CXXALIASWARN (getnameinfo);
40ff484d
LC
227
228/* Possible flags for getnameinfo. */
229# ifndef NI_NUMERICHOST
230# define NI_NUMERICHOST 1
231# endif
232# ifndef NI_NUMERICSERV
233# define NI_NUMERICSERV 2
234# endif
235
a927b6c1
LC
236#elif defined GNULIB_POSIXCHECK
237
238# undef getaddrinfo
239# if HAVE_RAW_DECL_GETADDRINFO
240_GL_WARN_ON_USE (getaddrinfo, "getaddrinfo is unportable - "
241 "use gnulib module getaddrinfo for portability");
242# endif
243
244# undef freeaddrinfo
245# if HAVE_RAW_DECL_FREEADDRINFO
246_GL_WARN_ON_USE (freeaddrinfo, "freeaddrinfo is unportable - "
247 "use gnulib module getaddrinfo for portability");
248# endif
249
250# undef gai_strerror
251# if HAVE_RAW_DECL_GAI_STRERROR
252_GL_WARN_ON_USE (gai_strerror, "gai_strerror is unportable - "
253 "use gnulib module getaddrinfo for portability");
254# endif
255
256# undef getnameinfo
257# if HAVE_RAW_DECL_GETNAMEINFO
258_GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
259 "use gnulib module getaddrinfo for portability");
260# endif
261
262#endif
40ff484d 263
3d458a81
AW
264#endif /* _@GUARD_PREFIX@_NETDB_H */
265#endif /* _@GUARD_PREFIX@_NETDB_H */