1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* -*- buffer-read-only: t -*- vi: set ro: */
3/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
4#line 1
5/* Provide a netdb.h header file for systems lacking it (read: MinGW).
6   Copyright (C) 2008-2010 Free Software Foundation, Inc.
7   Written by Simon Josefsson.
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 3, or (at your option)
12   any later version.
13
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19   You should have received a copy of the GNU General Public License
20   along with this program; if not, write to the Free Software Foundation,
21   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
22
23/* This file is supposed to be used on platforms that lack <netdb.h>.
24   It is intended to provide definitions and prototypes needed by an
25   application.  */
26
27#ifndef _GL_NETDB_H
28
29#if 1
30
31# if __GNUC__ >= 3
32#pragma GCC system_header
33# endif
34
35/* The include_next requires a split double-inclusion guard.  */
36# include_next <netdb.h>
37
38#endif
39
40#ifndef _GL_NETDB_H
41#define _GL_NETDB_H
42
43/* Get netdb.h definitions such as struct hostent for MinGW.  */
44#include <sys/socket.h>
45
46/* The definition of _GL_ARG_NONNULL is copied here.  */
47/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
48   that the values passed as arguments n, ..., m must be non-NULL pointers.
49   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
50#ifndef _GL_ARG_NONNULL
51# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
52#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
53# else
54#  define _GL_ARG_NONNULL(params)
55# endif
56#endif
57
58/* Declarations for a platform that lacks <netdb.h>, or where it is
59   incomplete.  */
60
61#if 1
62
63# if !1
64
65/* Structure to contain information about address of a service provider.  */
66struct addrinfo
67{
68  int ai_flags;                 /* Input flags.  */
69  int ai_family;                /* Protocol family for socket.  */
70  int ai_socktype;              /* Socket type.  */
71  int ai_protocol;              /* Protocol for socket.  */
72  socklen_t ai_addrlen;         /* Length of socket address.  */
73  struct sockaddr *ai_addr;     /* Socket address for socket.  */
74  char *ai_canonname;           /* Canonical name for service location.  */
75  struct addrinfo *ai_next;     /* Pointer to next in list.  */
76};
77# endif
78
79/* Possible values for `ai_flags' field in `addrinfo' structure.  */
80# ifndef AI_PASSIVE
81#  define AI_PASSIVE    0x0001  /* Socket address is intended for `bind'.  */
82# endif
83# ifndef AI_CANONNAME
84#  define AI_CANONNAME  0x0002  /* Request for canonical name.  */
85# endif
86# ifndef AI_NUMERICSERV
87#  define AI_NUMERICSERV        0x0400  /* Don't use name resolution.  */
88# endif
89
90# if 0
91/* The commented out definitions below are not yet implemented in the
92   GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact,
93   cause conflicts on systems with a getaddrinfo() function which does not
94   define them.
95
96   If they are restored, be sure to protect the definitions with #ifndef.  */
97#  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
98#  define AI_V4MAPPED   0x0008  /* IPv4 mapped addresses are acceptable.  */
99#  define AI_ALL                0x0010  /* Return IPv4 mapped and IPv6 addresses.  */
100#  define AI_ADDRCONFIG 0x0020  /* Use configuration of this host to choose
101                                   returned address type..  */
102# endif /* 0 */
103
104/* Error values for `getaddrinfo' function.  */
105# ifndef EAI_BADFLAGS
106#  define EAI_BADFLAGS    -1    /* Invalid value for `ai_flags' field.  */
107#  define EAI_NONAME      -2    /* NAME or SERVICE is unknown.  */
108#  define EAI_AGAIN       -3    /* Temporary failure in name resolution.  */
109#  define EAI_FAIL        -4    /* Non-recoverable failure in name res.  */
110#  define EAI_NODATA      -5    /* No address associated with NAME.  */
111#  define EAI_FAMILY      -6    /* `ai_family' not supported.  */
112#  define EAI_SOCKTYPE    -7    /* `ai_socktype' not supported.  */
113#  define EAI_SERVICE     -8    /* SERVICE not supported for `ai_socktype'.  */
114#  define EAI_MEMORY      -10   /* Memory allocation failure.  */
115# endif
116
117/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
118   FreeBSD, which does define EAI_BADFLAGS) have removed the definition
119   in favor of EAI_NONAME.  */
120# if !defined EAI_NODATA && defined EAI_NONAME
121#  define EAI_NODATA EAI_NONAME
122# endif
123
124# ifndef EAI_OVERFLOW
125/* Not defined on mingw32 and Haiku. */
126#  define EAI_OVERFLOW    -12   /* Argument buffer overflow.  */
127# endif
128# ifndef EAI_ADDRFAMILY
129/* Not defined on mingw32. */
130#  define EAI_ADDRFAMILY  -9    /* Address family for NAME not supported.  */
131# endif
132# ifndef EAI_SYSTEM
133/* Not defined on mingw32. */
134#  define EAI_SYSTEM      -11   /* System error returned in `errno'.  */
135# endif
136
137# if 0
138/* The commented out definitions below are not yet implemented in the
139   GNULIB getaddrinfo() replacement, so are not yet needed.
140
141   If they are restored, be sure to protect the definitions with #ifndef.  */
142#  ifndef EAI_INPROGRESS
143#   define EAI_INPROGRESS       -100    /* Processing request in progress.  */
144#   define EAI_CANCELED         -101    /* Request canceled.  */
145#   define EAI_NOTCANCELED      -102    /* Request not canceled.  */
146#   define EAI_ALLDONE          -103    /* All requests done.  */
147#   define EAI_INTR             -104    /* Interrupted by a signal.  */
148#   define EAI_IDN_ENCODE       -105    /* IDN encoding failed.  */
149#  endif
150# endif
151
152# if !1
153/* Translate name of a service location and/or a service name to set of
154   socket addresses.
155   For more details, see the POSIX:2001 specification
156   <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
157extern int getaddrinfo (const char *restrict nodename,
158                        const char *restrict servname,
159                        const struct addrinfo *restrict hints,
160                        struct addrinfo **restrict res)
161     _GL_ARG_NONNULL ((4));
162# endif
163
164# if !1
165/* Free `addrinfo' structure AI including associated storage.
166   For more details, see the POSIX:2001 specification
167   <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
168extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
169# endif
170
171# if !1
172/* Convert error return from getaddrinfo() to a string.
173   For more details, see the POSIX:2001 specification
174   <http://www.opengroup.org/susv3xsh/gai_strerror.html>.  */
175extern const char *gai_strerror (int ecode);
176# endif
177
178# if !1
179/* Convert socket address to printable node and service names.
180   For more details, see the POSIX:2001 specification
181   <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
182extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
183                       char *restrict node, socklen_t nodelen,
184                       char *restrict service, socklen_t servicelen,
185                       int flags)
186     _GL_ARG_NONNULL ((1));
187# endif
188
189/* Possible flags for getnameinfo.  */
190# ifndef NI_NUMERICHOST
191#  define NI_NUMERICHOST 1
192# endif
193# ifndef NI_NUMERICSERV
194#  define NI_NUMERICSERV 2
195# endif
196
197#endif /* 1 */
198
199#endif /* _GL_NETDB_H */
200#endif /* _GL_NETDB_H */
201