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