summaryrefslogtreecommitdiffstats
path: root/gl/netdb.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/netdb.in.h')
-rw-r--r--gl/netdb.in.h116
1 files changed, 63 insertions, 53 deletions
diff --git a/gl/netdb.in.h b/gl/netdb.in.h
index 363206d..73db46a 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 Free Software Foundation, Inc. 2 Copyright (C) 2008-2010 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
@@ -22,11 +22,11 @@
22 22
23#ifndef _GL_NETDB_H 23#ifndef _GL_NETDB_H
24 24
25#if @HAVE_NETDB_H@ 25#if __GNUC__ >= 3
26
27# if __GNUC__ >= 3
28@PRAGMA_SYSTEM_HEADER@ 26@PRAGMA_SYSTEM_HEADER@
29# endif 27#endif
28
29#if @HAVE_NETDB_H@
30 30
31/* The include_next requires a split double-inclusion guard. */ 31/* The include_next requires a split double-inclusion guard. */
32# @INCLUDE_NEXT@ @NEXT_NETDB_H@ 32# @INCLUDE_NEXT@ @NEXT_NETDB_H@
@@ -39,6 +39,8 @@
39/* Get netdb.h definitions such as struct hostent for MinGW. */ 39/* Get netdb.h definitions such as struct hostent for MinGW. */
40#include <sys/socket.h> 40#include <sys/socket.h>
41 41
42/* The definition of _GL_ARG_NONNULL is copied here. */
43
42/* Declarations for a platform that lacks <netdb.h>, or where it is 44/* Declarations for a platform that lacks <netdb.h>, or where it is
43 incomplete. */ 45 incomplete. */
44 46
@@ -49,53 +51,59 @@
49/* Structure to contain information about address of a service provider. */ 51/* Structure to contain information about address of a service provider. */
50struct addrinfo 52struct addrinfo
51{ 53{
52 int ai_flags; /* Input flags. */ 54 int ai_flags; /* Input flags. */
53 int ai_family; /* Protocol family for socket. */ 55 int ai_family; /* Protocol family for socket. */
54 int ai_socktype; /* Socket type. */ 56 int ai_socktype; /* Socket type. */
55 int ai_protocol; /* Protocol for socket. */ 57 int ai_protocol; /* Protocol for socket. */
56 socklen_t ai_addrlen; /* Length of socket address. */ 58 socklen_t ai_addrlen; /* Length of socket address. */
57 struct sockaddr *ai_addr; /* Socket address for socket. */ 59 struct sockaddr *ai_addr; /* Socket address for socket. */
58 char *ai_canonname; /* Canonical name for service location. */ 60 char *ai_canonname; /* Canonical name for service location. */
59 struct addrinfo *ai_next; /* Pointer to next in list. */ 61 struct addrinfo *ai_next; /* Pointer to next in list. */
60}; 62};
61# endif 63# endif
62 64
63/* Possible values for `ai_flags' field in `addrinfo' structure. */ 65/* Possible values for `ai_flags' field in `addrinfo' structure. */
64# ifndef AI_PASSIVE 66# ifndef AI_PASSIVE
65# define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ 67# define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
66# endif 68# endif
67# ifndef AI_CANONNAME 69# ifndef AI_CANONNAME
68# define AI_CANONNAME 0x0002 /* Request for canonical name. */ 70# define AI_CANONNAME 0x0002 /* Request for canonical name. */
69# endif 71# endif
70# ifndef AI_NUMERICSERV 72# ifndef AI_NUMERICSERV
71# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ 73# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
72# endif 74# endif
73 75
74# if 0 76# if 0
75/* The commented out definitions below are not yet implemented in the 77# define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
76 GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact, 78# endif
77 cause conflicts on systems with a getaddrinfo() function which does not
78 define them.
79 79
80 If they are restored, be sure to protect the definitions with #ifndef. */ 80/* These symbolic constants are required to be present by POSIX, but
81# define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ 81 our getaddrinfo replacement doesn't use them (yet). Setting them
82# define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */ 82 to 0 on systems that doesn't have them avoids causing problems for
83# define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */ 83 system getaddrinfo implementations that would be confused by
84# define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose 84 unknown values. */
85 returned address type.. */ 85# ifndef AI_V4MAPPED
86# endif /* 0 */ 86# define AI_V4MAPPED 0 /* 0x0008: IPv4 mapped addresses are acceptable. */
87# endif
88# ifndef AI_ALL
89# define AI_ALL 0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */
90# endif
91# ifndef AI_ADDRCONFIG
92# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose
93 returned address type. */
94# endif
87 95
88/* Error values for `getaddrinfo' function. */ 96/* Error values for `getaddrinfo' function. */
89# ifndef EAI_BADFLAGS 97# ifndef EAI_BADFLAGS
90# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ 98# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
91# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ 99# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
92# define EAI_AGAIN -3 /* Temporary failure in name resolution. */ 100# define EAI_AGAIN -3 /* Temporary failure in name resolution. */
93# define EAI_FAIL -4 /* Non-recoverable failure in name res. */ 101# define EAI_FAIL -4 /* Non-recoverable failure in name res. */
94# define EAI_NODATA -5 /* No address associated with NAME. */ 102# define EAI_NODATA -5 /* No address associated with NAME. */
95# define EAI_FAMILY -6 /* `ai_family' not supported. */ 103# define EAI_FAMILY -6 /* `ai_family' not supported. */
96# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ 104# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
97# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ 105# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
98# define EAI_MEMORY -10 /* Memory allocation failure. */ 106# define EAI_MEMORY -10 /* Memory allocation failure. */
99# endif 107# endif
100 108
101/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least 109/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
@@ -107,15 +115,15 @@ struct addrinfo
107 115
108# ifndef EAI_OVERFLOW 116# ifndef EAI_OVERFLOW
109/* Not defined on mingw32 and Haiku. */ 117/* Not defined on mingw32 and Haiku. */
110# define EAI_OVERFLOW -12 /* Argument buffer overflow. */ 118# define EAI_OVERFLOW -12 /* Argument buffer overflow. */
111# endif 119# endif
112# ifndef EAI_ADDRFAMILY 120# ifndef EAI_ADDRFAMILY
113/* Not defined on mingw32. */ 121/* Not defined on mingw32. */
114# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ 122# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
115# endif 123# endif
116# ifndef EAI_SYSTEM 124# ifndef EAI_SYSTEM
117/* Not defined on mingw32. */ 125/* Not defined on mingw32. */
118# define EAI_SYSTEM -11 /* System error returned in `errno'. */ 126# define EAI_SYSTEM -11 /* System error returned in `errno'. */
119# endif 127# endif
120 128
121# if 0 129# if 0
@@ -124,12 +132,12 @@ struct addrinfo
124 132
125 If they are restored, be sure to protect the definitions with #ifndef. */ 133 If they are restored, be sure to protect the definitions with #ifndef. */
126# ifndef EAI_INPROGRESS 134# ifndef EAI_INPROGRESS
127# define EAI_INPROGRESS -100 /* Processing request in progress. */ 135# define EAI_INPROGRESS -100 /* Processing request in progress. */
128# define EAI_CANCELED -101 /* Request canceled. */ 136# define EAI_CANCELED -101 /* Request canceled. */
129# define EAI_NOTCANCELED -102 /* Request not canceled. */ 137# define EAI_NOTCANCELED -102 /* Request not canceled. */
130# define EAI_ALLDONE -103 /* All requests done. */ 138# define EAI_ALLDONE -103 /* All requests done. */
131# define EAI_INTR -104 /* Interrupted by a signal. */ 139# define EAI_INTR -104 /* Interrupted by a signal. */
132# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ 140# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
133# endif 141# endif
134# endif 142# endif
135 143
@@ -139,16 +147,17 @@ struct addrinfo
139 For more details, see the POSIX:2001 specification 147 For more details, see the POSIX:2001 specification
140 <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */ 148 <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
141extern int getaddrinfo (const char *restrict nodename, 149extern int getaddrinfo (const char *restrict nodename,
142 const char *restrict servname, 150 const char *restrict servname,
143 const struct addrinfo *restrict hints, 151 const struct addrinfo *restrict hints,
144 struct addrinfo **restrict res); 152 struct addrinfo **restrict res)
153 _GL_ARG_NONNULL ((4));
145# endif 154# endif
146 155
147# if !@HAVE_DECL_FREEADDRINFO@ 156# if !@HAVE_DECL_FREEADDRINFO@
148/* Free `addrinfo' structure AI including associated storage. 157/* Free `addrinfo' structure AI including associated storage.
149 For more details, see the POSIX:2001 specification 158 For more details, see the POSIX:2001 specification
150 <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */ 159 <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
151extern void freeaddrinfo (struct addrinfo *ai); 160extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
152# endif 161# endif
153 162
154# if !@HAVE_DECL_GAI_STRERROR@ 163# if !@HAVE_DECL_GAI_STRERROR@
@@ -162,10 +171,11 @@ extern const char *gai_strerror (int ecode);
162/* Convert socket address to printable node and service names. 171/* Convert socket address to printable node and service names.
163 For more details, see the POSIX:2001 specification 172 For more details, see the POSIX:2001 specification
164 <http://www.opengroup.org/susv3xsh/getnameinfo.html>. */ 173 <http://www.opengroup.org/susv3xsh/getnameinfo.html>. */
165extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, 174extern int getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
166 char *restrict node, socklen_t nodelen, 175 char *restrict node, socklen_t nodelen,
167 char *restrict service, socklen_t servicelen, 176 char *restrict service, socklen_t servicelen,
168 int flags); 177 int flags)
178 _GL_ARG_NONNULL ((1));
169# endif 179# endif
170 180
171/* Possible flags for getnameinfo. */ 181/* Possible flags for getnameinfo. */