]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/addrinfo.h
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / PyMod-2.7.10 / Modules / addrinfo.h
CommitLineData
d11973f1
DM
1/** @file\r
2 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
3 This program and the accompanying materials are licensed and made available under\r
4 the terms and conditions of the BSD License that accompanies this distribution.\r
5 The full text of the license may be found at\r
6 http://opensource.org/licenses/bsd-license.\r
7\r
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
10\r
3ec97ca4
DM
11 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.\r
12 * All rights reserved.\r
13 *\r
14 * Redistribution and use in source and binary forms, with or without\r
15 * modification, are permitted provided that the following conditions\r
16 * are met:\r
17 * 1. Redistributions of source code must retain the above copyright\r
18 * notice, this list of conditions and the following disclaimer.\r
19 * 2. Redistributions in binary form must reproduce the above copyright\r
20 * notice, this list of conditions and the following disclaimer in the\r
21 * documentation and/or other materials provided with the distribution.\r
22 * 3. Neither the name of the project nor the names of its contributors\r
23 * may be used to endorse or promote products derived from this software\r
24 * without specific prior written permission.\r
25 *\r
26 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\r
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\r
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
36 * SUCH DAMAGE.\r
d11973f1 37**/\r
3ec97ca4
DM
38\r
39#ifndef HAVE_GETADDRINFO\r
40\r
41/*\r
42 * Error return codes from getaddrinfo()\r
43 */\r
44#ifdef EAI_ADDRFAMILY\r
45/* If this is defined, there is a conflicting implementation\r
46 in the C library, which can't be used for some reason.\r
47 Make sure it won't interfere with this emulation. */\r
48\r
49#undef EAI_ADDRFAMILY\r
50#undef EAI_AGAIN\r
51#undef EAI_BADFLAGS\r
52#undef EAI_FAIL\r
53#undef EAI_FAMILY\r
54#undef EAI_MEMORY\r
55#undef EAI_NODATA\r
56#undef EAI_NONAME\r
57#undef EAI_SERVICE\r
58#undef EAI_SOCKTYPE\r
59#undef EAI_SYSTEM\r
60#undef EAI_BADHINTS\r
61#undef EAI_PROTOCOL\r
62#undef EAI_MAX\r
63#undef getaddrinfo\r
64#define getaddrinfo fake_getaddrinfo\r
65#endif /* EAI_ADDRFAMILY */\r
66\r
67#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */\r
68#define EAI_AGAIN 2 /* temporary failure in name resolution */\r
69#define EAI_BADFLAGS 3 /* invalid value for ai_flags */\r
70#define EAI_FAIL 4 /* non-recoverable failure in name resolution */\r
71#define EAI_FAMILY 5 /* ai_family not supported */\r
72#define EAI_MEMORY 6 /* memory allocation failure */\r
73#define EAI_NODATA 7 /* no address associated with hostname */\r
74#define EAI_NONAME 8 /* hostname nor servname provided, or not known */\r
75#define EAI_SERVICE 9 /* servname not supported for ai_socktype */\r
76#define EAI_SOCKTYPE 10 /* ai_socktype not supported */\r
77#define EAI_SYSTEM 11 /* system error returned in errno */\r
78#define EAI_BADHINTS 12\r
79#define EAI_PROTOCOL 13\r
80#define EAI_MAX 14\r
81\r
82/*\r
83 * Flag values for getaddrinfo()\r
84 */\r
85#ifdef AI_PASSIVE\r
86#undef AI_PASSIVE\r
87#undef AI_CANONNAME\r
88#undef AI_NUMERICHOST\r
89#undef AI_MASK\r
90#undef AI_ALL\r
91#undef AI_V4MAPPED_CFG\r
92#undef AI_ADDRCONFIG\r
93#undef AI_V4MAPPED\r
94#undef AI_DEFAULT\r
95#endif /* AI_PASSIVE */\r
96\r
97#define AI_PASSIVE 0x00000001 /* get address to use bind() */\r
98#define AI_CANONNAME 0x00000002 /* fill ai_canonname */\r
99#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */\r
100/* valid flags for addrinfo */\r
101#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)\r
102\r
103#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */\r
104#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */\r
105#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */\r
106#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */\r
107/* special recommended flags for getipnodebyname */\r
108#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)\r
109\r
110#endif /* !HAVE_GETADDRINFO */\r
111\r
112#ifndef HAVE_GETNAMEINFO\r
113\r
114/*\r
115 * Constants for getnameinfo()\r
116 */\r
117#ifndef NI_MAXHOST\r
118#define NI_MAXHOST 1025\r
119#define NI_MAXSERV 32\r
120#endif /* !NI_MAXHOST */\r
121\r
122/*\r
123 * Flag values for getnameinfo()\r
124 */\r
125#ifndef NI_NOFQDN\r
126#define NI_NOFQDN 0x00000001\r
127#define NI_NUMERICHOST 0x00000002\r
128#define NI_NAMEREQD 0x00000004\r
129#define NI_NUMERICSERV 0x00000008\r
130#define NI_DGRAM 0x00000010\r
131#endif /* !NI_NOFQDN */\r
132\r
133#endif /* !HAVE_GETNAMEINFO */\r
134\r
d11973f1
DM
135#ifndef _SYS_SOCKET_H_\r
136 #ifndef HAVE_ADDRINFO\r
137 struct addrinfo {\r
138 int ai_flags; /* AI_PASSIVE, AI_CANONNAME */\r
139 int ai_family; /* PF_xxx */\r
140 int ai_socktype; /* SOCK_xxx */\r
141 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */\r
142 size_t ai_addrlen; /* length of ai_addr */\r
143 char *ai_canonname; /* canonical name for hostname */\r
144 struct sockaddr *ai_addr; /* binary address */\r
145 struct addrinfo *ai_next; /* next structure in linked list */\r
146 };\r
147 #endif /* !HAVE_ADDRINFO */\r
148\r
149 #ifndef HAVE_SOCKADDR_STORAGE\r
150 /*\r
151 * RFC 2553: protocol-independent placeholder for socket addresses\r
152 */\r
153 #define _SS_MAXSIZE 128\r
154 #ifdef HAVE_LONG_LONG\r
155 #define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG))\r
156 #else\r
157 #define _SS_ALIGNSIZE (sizeof(double))\r
158 #endif /* HAVE_LONG_LONG */\r
159 #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) * 2)\r
160 #define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) * 2 - \\r
161 _SS_PAD1SIZE - _SS_ALIGNSIZE)\r
162\r
163 struct sockaddr_storage {\r
164 #ifdef HAVE_SOCKADDR_SA_LEN\r
165 unsigned char ss_len; /* address length */\r
166 unsigned char ss_family; /* address family */\r
167 #else\r
168 unsigned short ss_family; /* address family */\r
169 #endif /* HAVE_SOCKADDR_SA_LEN */\r
170 char __ss_pad1[_SS_PAD1SIZE];\r
171 #ifdef HAVE_LONG_LONG\r
172 PY_LONG_LONG __ss_align; /* force desired structure storage alignment */\r
173 #else\r
174 double __ss_align; /* force desired structure storage alignment */\r
175 #endif /* HAVE_LONG_LONG */\r
176 char __ss_pad2[_SS_PAD2SIZE];\r
177 };\r
178 #endif /* !HAVE_SOCKADDR_STORAGE */\r
179#endif /* _SYS_SOCKET_H_ */\r
3ec97ca4
DM
180\r
181#ifdef __cplusplus\r
182extern "C" {\r
183#endif\r
184extern void freehostent Py_PROTO((struct hostent *));\r
185#ifdef __cplusplus\r
186}\r
187#endif\r