diff options
Diffstat (limited to 'gl/netdb.in.h')
| -rw-r--r-- | gl/netdb.in.h | 105 |
1 files changed, 75 insertions, 30 deletions
diff --git a/gl/netdb.in.h b/gl/netdb.in.h index f800cac8..0da1800a 100644 --- a/gl/netdb.in.h +++ b/gl/netdb.in.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Provide a netdb.h header file for systems lacking it (read: MinGW). | 1 | /* Provide a netdb.h header file for systems lacking it (read: MinGW). |
| 2 | Copyright (C) 2008-2010 Free Software Foundation, Inc. | 2 | Copyright (C) 2008-2013 Free Software Foundation, Inc. |
| 3 | Written by Simon Josefsson. | 3 | Written by Simon Josefsson. |
| 4 | 4 | ||
| 5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
| @@ -13,18 +13,18 @@ | |||
| 13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
| 14 | 14 | ||
| 15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software Foundation, | 16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
| 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
| 18 | 17 | ||
| 19 | /* This file is supposed to be used on platforms that lack <netdb.h>. | 18 | /* This file is supposed to be used on platforms that lack <netdb.h>. |
| 20 | It is intended to provide definitions and prototypes needed by an | 19 | It is intended to provide definitions and prototypes needed by an |
| 21 | application. */ | 20 | application. */ |
| 22 | 21 | ||
| 23 | #ifndef _GL_NETDB_H | 22 | #ifndef _@GUARD_PREFIX@_NETDB_H |
| 24 | 23 | ||
| 25 | #if __GNUC__ >= 3 | 24 | #if __GNUC__ >= 3 |
| 26 | @PRAGMA_SYSTEM_HEADER@ | 25 | @PRAGMA_SYSTEM_HEADER@ |
| 27 | #endif | 26 | #endif |
| 27 | @PRAGMA_COLUMNS@ | ||
| 28 | 28 | ||
| 29 | #if @HAVE_NETDB_H@ | 29 | #if @HAVE_NETDB_H@ |
| 30 | 30 | ||
| @@ -33,12 +33,15 @@ | |||
| 33 | 33 | ||
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | #ifndef _GL_NETDB_H | 36 | #ifndef _@GUARD_PREFIX@_NETDB_H |
| 37 | #define _GL_NETDB_H | 37 | #define _@GUARD_PREFIX@_NETDB_H |
| 38 | 38 | ||
| 39 | /* Get netdb.h definitions such as struct hostent for MinGW. */ | 39 | /* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and |
| 40 | 'struct hostent' on MinGW. */ | ||
| 40 | #include <sys/socket.h> | 41 | #include <sys/socket.h> |
| 41 | 42 | ||
| 43 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | ||
| 44 | |||
| 42 | /* The definition of _GL_ARG_NONNULL is copied here. */ | 45 | /* The definition of _GL_ARG_NONNULL is copied here. */ |
| 43 | 46 | ||
| 44 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 47 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
| @@ -50,6 +53,11 @@ | |||
| 50 | 53 | ||
| 51 | # if !@HAVE_STRUCT_ADDRINFO@ | 54 | # if !@HAVE_STRUCT_ADDRINFO@ |
| 52 | 55 | ||
| 56 | # ifdef __cplusplus | ||
| 57 | extern "C" { | ||
| 58 | # endif | ||
| 59 | |||
| 60 | # if !GNULIB_defined_struct_addrinfo | ||
| 53 | /* Structure to contain information about address of a service provider. */ | 61 | /* Structure to contain information about address of a service provider. */ |
| 54 | struct addrinfo | 62 | struct addrinfo |
| 55 | { | 63 | { |
| @@ -62,11 +70,18 @@ struct addrinfo | |||
| 62 | char *ai_canonname; /* Canonical name for service location. */ | 70 | char *ai_canonname; /* Canonical name for service location. */ |
| 63 | struct addrinfo *ai_next; /* Pointer to next in list. */ | 71 | struct addrinfo *ai_next; /* Pointer to next in list. */ |
| 64 | }; | 72 | }; |
| 73 | # define GNULIB_defined_struct_addrinfo 1 | ||
| 74 | # endif | ||
| 75 | |||
| 76 | # ifdef __cplusplus | ||
| 77 | } | ||
| 78 | # endif | ||
| 79 | |||
| 65 | # endif | 80 | # endif |
| 66 | 81 | ||
| 67 | /* Possible values for `ai_flags' field in `addrinfo' structure. */ | 82 | /* Possible values for 'ai_flags' field in 'addrinfo' structure. */ |
| 68 | # ifndef AI_PASSIVE | 83 | # ifndef AI_PASSIVE |
| 69 | # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ | 84 | # define AI_PASSIVE 0x0001 /* Socket address is intended for 'bind'. */ |
| 70 | # endif | 85 | # endif |
| 71 | # ifndef AI_CANONNAME | 86 | # ifndef AI_CANONNAME |
| 72 | # define AI_CANONNAME 0x0002 /* Request for canonical name. */ | 87 | # define AI_CANONNAME 0x0002 /* Request for canonical name. */ |
| @@ -95,16 +110,16 @@ struct addrinfo | |||
| 95 | returned address type. */ | 110 | returned address type. */ |
| 96 | # endif | 111 | # endif |
| 97 | 112 | ||
| 98 | /* Error values for `getaddrinfo' function. */ | 113 | /* Error values for 'getaddrinfo' function. */ |
| 99 | # ifndef EAI_BADFLAGS | 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 | # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ | 116 | # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ |
| 102 | # define EAI_AGAIN -3 /* Temporary failure in name resolution. */ | 117 | # define EAI_AGAIN -3 /* Temporary failure in name resolution. */ |
| 103 | # define EAI_FAIL -4 /* Non-recoverable failure in name res. */ | 118 | # define EAI_FAIL -4 /* Non-recoverable failure in name res. */ |
| 104 | # define EAI_NODATA -5 /* No address associated with NAME. */ | 119 | # define EAI_NODATA -5 /* No address associated with NAME. */ |
| 105 | # define EAI_FAMILY -6 /* `ai_family' not supported. */ | 120 | # define EAI_FAMILY -6 /* 'ai_family' not supported. */ |
| 106 | # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ | 121 | # define EAI_SOCKTYPE -7 /* 'ai_socktype' not supported. */ |
| 107 | # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ | 122 | # define EAI_SERVICE -8 /* SERVICE not supported for 'ai_socktype'. */ |
| 108 | # define EAI_MEMORY -10 /* Memory allocation failure. */ | 123 | # define EAI_MEMORY -10 /* Memory allocation failure. */ |
| 109 | # endif | 124 | # endif |
| 110 | 125 | ||
| @@ -125,7 +140,7 @@ struct addrinfo | |||
| 125 | # endif | 140 | # endif |
| 126 | # ifndef EAI_SYSTEM | 141 | # ifndef EAI_SYSTEM |
| 127 | /* Not defined on mingw32. */ | 142 | /* Not defined on mingw32. */ |
| 128 | # define EAI_SYSTEM -11 /* System error returned in `errno'. */ | 143 | # define EAI_SYSTEM -11 /* System error returned in 'errno'. */ |
| 129 | # endif | 144 | # endif |
| 130 | 145 | ||
| 131 | # if 0 | 146 | # if 0 |
| @@ -148,37 +163,67 @@ struct addrinfo | |||
| 148 | socket addresses. | 163 | socket addresses. |
| 149 | For more details, see the POSIX:2001 specification | 164 | For more details, see the POSIX:2001 specification |
| 150 | <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */ | 165 | <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */ |
| 151 | extern int getaddrinfo (const char *restrict nodename, | 166 | _GL_FUNCDECL_SYS (getaddrinfo, int, |
| 152 | const char *restrict servname, | 167 | (const char *restrict nodename, |
| 153 | const struct addrinfo *restrict hints, | 168 | const char *restrict servname, |
| 154 | struct addrinfo **restrict res) | 169 | const struct addrinfo *restrict hints, |
| 155 | _GL_ARG_NONNULL ((4)); | 170 | struct addrinfo **restrict res) |
| 171 | _GL_ARG_NONNULL ((4))); | ||
| 156 | # endif | 172 | # endif |
| 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); | ||
| 157 | 179 | ||
| 158 | # if !@HAVE_DECL_FREEADDRINFO@ | 180 | # if !@HAVE_DECL_FREEADDRINFO@ |
| 159 | /* Free `addrinfo' structure AI including associated storage. | 181 | /* Free 'addrinfo' structure AI including associated storage. |
| 160 | For more details, see the POSIX:2001 specification | 182 | For more details, see the POSIX:2001 specification |
| 161 | <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */ | 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))); | ||
| 163 | # endif | 186 | # endif |
| 187 | _GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai)); | ||
| 188 | _GL_CXXALIASWARN (freeaddrinfo); | ||
| 164 | 189 | ||
| 165 | # if !@HAVE_DECL_GAI_STRERROR@ | 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@ | ||
| 166 | /* Convert error return from getaddrinfo() to a string. | 199 | /* Convert error return from getaddrinfo() to a string. |
| 167 | For more details, see the POSIX:2001 specification | 200 | For more details, see the POSIX:2001 specification |
| 168 | <http://www.opengroup.org/susv3xsh/gai_strerror.html>. */ | 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)); |
| 203 | # endif | ||
| 204 | _GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode)); | ||
| 170 | # endif | 205 | # endif |
| 206 | _GL_CXXALIASWARN (gai_strerror); | ||
| 171 | 207 | ||
| 172 | # if !@HAVE_DECL_GETNAMEINFO@ | 208 | # if !@HAVE_DECL_GETNAMEINFO@ |
| 173 | /* Convert socket address to printable node and service names. | 209 | /* Convert socket address to printable node and service names. |
| 174 | For more details, see the POSIX:2001 specification | 210 | For more details, see the POSIX:2001 specification |
| 175 | <http://www.opengroup.org/susv3xsh/getnameinfo.html>. */ | 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, | ||
| 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, | ||
| 177 | char *restrict node, socklen_t nodelen, | 223 | char *restrict node, socklen_t nodelen, |
| 178 | char *restrict service, socklen_t servicelen, | 224 | char *restrict service, socklen_t servicelen, |
| 179 | int flags) | 225 | int flags)); |
| 180 | _GL_ARG_NONNULL ((1)); | 226 | _GL_CXXALIASWARN (getnameinfo); |
| 181 | # endif | ||
| 182 | 227 | ||
| 183 | /* Possible flags for getnameinfo. */ | 228 | /* Possible flags for getnameinfo. */ |
| 184 | # ifndef NI_NUMERICHOST | 229 | # ifndef NI_NUMERICHOST |
| @@ -216,5 +261,5 @@ _GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - " | |||
| 216 | 261 | ||
| 217 | #endif | 262 | #endif |
| 218 | 263 | ||
| 219 | #endif /* _GL_NETDB_H */ | 264 | #endif /* _@GUARD_PREFIX@_NETDB_H */ |
| 220 | #endif /* _GL_NETDB_H */ | 265 | #endif /* _@GUARD_PREFIX@_NETDB_H */ |
