(svn r28004) -Update from Eints:
[openttd.git] / src / 3rdparty / os2 / getaddrinfo.h
blob0a588a40a27867f0d3d3d2401ead07f95c7ac707
1 #ifndef _getaddrinfo_h
2 #define _getaddrinfo_h
4 /*
5 * Shamelessly duplicated from the fetchmail public sources
6 * for use by the Squid Project under GNU Public License.
8 * Update/Maintenance History:
10 * 15-Aug-2007 : Copied from fetchmail 6.3.8
11 * - added protection around libray headers
13 * 16-Aug-2007 : Altered configure checks
14 * Un-hacked slightly to use system gethostbyname()
16 * Original License and code follows.
20 * This file is part of libESMTP, a library for submission of RFC 2822
21 * formatted electronic mail messages using the SMTP protocol described
22 * in RFC 2821.
24 * Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net>
26 * This library is free software; you can redistribute it and/or
27 * modify it under the terms of the GNU Lesser General Public
28 * License as published by the Free Software Foundation; either
29 * version 2.1 of the License, or (at your option) any later version.
31 * This library is distributed in the hope that it will be useful,
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34 * Lesser General Public License for more details.
36 * You should have received a copy of the GNU Lesser General Public
37 * License along with this library; if not, write to the Free Software
38 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41 /* Structure and prototypes taken from RFC 2553 */
43 /* SG 23/09/2007:
44 On Windows the following definitions are already available, may be that
45 this could be needed on some other platform */
46 typedef int socklen_t;
48 struct addrinfo {
49 int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
50 int ai_family; /* PF_xxx */
51 int ai_socktype; /* SOCK_xxx */
52 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
53 socklen_t ai_addrlen; /* length of ai_addr */
54 char *ai_canonname; /* canonical name for nodename */
55 struct sockaddr *ai_addr; /* binary address */
56 struct addrinfo *ai_next; /* next structure in linked list */
59 /* Supposed to be defined in <netdb.h> */
60 #define AI_ADDRCONFIG 0
61 #define AI_PASSIVE 1 /* Socket address is intended for `bind'. */
62 #define AI_CANONNAME 2 /* Request for canonical name. */
63 #define AI_NUMERICHOST 4 /* Don't use name resolution. */
65 /* Supposed to be defined in <netdb.h> */
66 #define EAI_ADDRFAMILY 1 /* address family for nodename not supported */
67 #define EAI_AGAIN 2 /* temporary failure in name resolution */
68 #define EAI_BADFLAGS 3 /* invalid value for ai_flags */
69 #define EAI_FAIL 4 /* non-recoverable failure in name resolution */
70 #define EAI_FAMILY 5 /* ai_family not supported */
71 #define EAI_MEMORY 6 /* memory allocation failure */
72 #define EAI_NODATA 7 /* no address associated with nodename */
73 #define EAI_NONAME 8 /* nodename nor servname provided, or not known */
74 #define EAI_SERVICE 9 /* servname not supported for ai_socktype */
75 #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
77 #ifndef EAI_SYSTEM
78 /* Not defined on mingw32. */
79 #define EAI_SYSTEM 11 /* System error returned in `errno'. */
80 #endif
81 #ifndef EAI_OVERFLOW
82 /* Not defined on mingw32. */
83 #define EAI_OVERFLOW 12 /* Argument buffer overflow. */
84 #endif
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89 /* RFC 2553 / Posix resolver */
90 int getaddrinfo (const char *nodename, const char *servname,
91 const struct addrinfo *hints, struct addrinfo **res);
92 /* Free addrinfo structure and associated storage */
93 void freeaddrinfo (struct addrinfo *ai);
95 /* Convert error return from getaddrinfo() to string */
96 const char *gai_strerror (int code);
97 #ifdef __cplusplus
99 #endif
101 #endif /* _getaddrinfo_h */