summaryrefslogtreecommitdiffstats
path: root/gl/getaddrinfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/getaddrinfo.h')
-rw-r--r--gl/getaddrinfo.h155
1 files changed, 0 insertions, 155 deletions
diff --git a/gl/getaddrinfo.h b/gl/getaddrinfo.h
deleted file mode 100644
index 050b7935..00000000
--- a/gl/getaddrinfo.h
+++ /dev/null
@@ -1,155 +0,0 @@
1/* Get address information.
2 Copyright (C) 1996-2002, 2003, 2004, 2005, 2006
3 Free Software Foundation, Inc.
4 Contributed by Simon Josefsson <simon@josefsson.org>.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19
20#ifndef GETADDRINFO_H
21#define GETADDRINFO_H
22
23/* sys/socket.h in i386-unknown-freebsd4.10 and
24 powerpc-apple-darwin5.5 require sys/types.h, so include it first.
25 Then we'll also get 'socklen_t' and 'struct sockaddr' which are
26 used below. */
27#include <sys/types.h>
28/* Get all getaddrinfo related declarations, if available. */
29#include <sys/socket.h>
30#ifdef HAVE_NETDB_H
31# include <netdb.h>
32#endif
33
34#ifndef HAVE_STRUCT_ADDRINFO
35
36/* Structure to contain information about address of a service provider. */
37struct addrinfo
38{
39 int ai_flags; /* Input flags. */
40 int ai_family; /* Protocol family for socket. */
41 int ai_socktype; /* Socket type. */
42 int ai_protocol; /* Protocol for socket. */
43 socklen_t ai_addrlen; /* Length of socket address. */
44 struct sockaddr *ai_addr; /* Socket address for socket. */
45 char *ai_canonname; /* Canonical name for service location. */
46 struct addrinfo *ai_next; /* Pointer to next in list. */
47};
48#endif
49
50/* Possible values for `ai_flags' field in `addrinfo' structure. */
51#ifndef AI_PASSIVE
52# define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
53#endif
54#ifndef AI_CANONNAME
55# define AI_CANONNAME 0x0002 /* Request for canonical name. */
56#endif
57#ifndef AI_NUMERICSERV
58# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
59#endif
60
61#if 0
62/* The commented out definitions below are not yet implemented in the
63 GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact,
64 cause conflicts on systems with a getaddrinfo() function which does not
65 define them.
66
67 If they are restored, be sure to protect the definitions with #ifndef. */
68#define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
69#define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
70#define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
71#define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
72 returned address type.. */
73#endif /* 0 */
74
75/* Error values for `getaddrinfo' function. */
76#ifndef EAI_BADFLAGS
77# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
78# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
79# define EAI_AGAIN -3 /* Temporary failure in name resolution. */
80# define EAI_FAIL -4 /* Non-recoverable failure in name res. */
81# define EAI_NODATA -5 /* No address associated with NAME. */
82# define EAI_FAMILY -6 /* `ai_family' not supported. */
83# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
84# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
85# define EAI_MEMORY -10 /* Memory allocation failure. */
86#endif
87#ifndef EAI_OVERFLOW
88/* Not defined on mingw32. */
89# define EAI_OVERFLOW -12 /* Argument buffer overflow. */
90#endif
91#ifndef EAI_ADDRFAMILY
92/* Not defined on mingw32. */
93# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
94#endif
95#ifndef EAI_SYSTEM
96/* Not defined on mingw32. */
97# define EAI_SYSTEM -11 /* System error returned in `errno'. */
98#endif
99
100#ifdef __USE_GNU
101# ifndef EAI_INPROGRESS
102# define EAI_INPROGRESS -100 /* Processing request in progress. */
103# define EAI_CANCELED -101 /* Request canceled. */
104# define EAI_NOTCANCELED -102 /* Request not canceled. */
105# define EAI_ALLDONE -103 /* All requests done. */
106# define EAI_INTR -104 /* Interrupted by a signal. */
107# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
108# endif
109#endif
110
111#if !HAVE_DECL_GETADDRINFO
112/* Translate name of a service location and/or a service name to set of
113 socket addresses.
114 For more details, see the POSIX:2001 specification
115 <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
116extern int getaddrinfo (const char *restrict nodename,
117 const char *restrict servname,
118 const struct addrinfo *restrict hints,
119 struct addrinfo **restrict res);
120#endif
121
122#if !HAVE_DECL_FREEADDRINFO
123/* Free `addrinfo' structure AI including associated storage.
124 For more details, see the POSIX:2001 specification
125 <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
126extern void freeaddrinfo (struct addrinfo *ai);
127#endif
128
129#if !HAVE_DECL_GAI_STRERROR
130/* Convert error return from getaddrinfo() to a string.
131 For more details, see the POSIX:2001 specification
132 <http://www.opengroup.org/susv3xsh/gai_strerror.html>. */
133extern const char *gai_strerror (int ecode);
134#endif
135
136#if !HAVE_DECL_GETNAMEINFO
137/* Convert socket address to printable node and service names.
138 For more details, see the POSIX:2001 specification
139 <http://www.opengroup.org/susv3xsh/getnameinfo.html>. */
140extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
141 char *restrict node, socklen_t nodelen,
142 char *restrict service, socklen_t servicelen,
143 int flags);
144
145#endif
146
147/* Possible flags for getnameinfo. */
148#ifndef NI_NUMERICHOST
149# define NI_NUMERICHOST 1
150#endif
151#ifndef NI_NUMERICSERV
152# define NI_NUMERICSERV 2
153#endif
154
155#endif /* GETADDRINFO_H */