annotate Modules/addrinfo.h @ 58925:eecf1bef052d 2.6

Merged revisions 78207 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line #7930: fix stripid ........
author Ezio Melotti <ezio.melotti@gmail.com>
date Tue, 16 Feb 2010 23:29:44 +0000
parents fdb9377513e4
children fd25030223b0 bce7e4a926a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
1 /*
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
2 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
3 * All rights reserved.
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
4 *
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
5 * Redistribution and use in source and binary forms, with or without
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
6 * modification, are permitted provided that the following conditions
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
7 * are met:
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
8 * 1. Redistributions of source code must retain the above copyright
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
9 * notice, this list of conditions and the following disclaimer.
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
10 * 2. Redistributions in binary form must reproduce the above copyright
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
11 * notice, this list of conditions and the following disclaimer in the
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
12 * documentation and/or other materials provided with the distribution.
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
13 * 3. Neither the name of the project nor the names of its contributors
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
14 * may be used to endorse or promote products derived from this software
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
15 * without specific prior written permission.
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
16 *
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
17 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
27 * SUCH DAMAGE.
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
28 */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
29
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
30 #ifndef HAVE_GETADDRINFO
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
31
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
32 /*
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
33 * Error return codes from getaddrinfo()
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
34 */
21261
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
35 #ifdef EAI_ADDRFAMILY
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
36 /* If this is defined, there is a conflicting implementation
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
37 in the C library, which can't be used for some reason.
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
38 Make sure it won't interfere with this emulation. */
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
39
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
40 #undef EAI_ADDRFAMILY
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
41 #undef EAI_AGAIN
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
42 #undef EAI_BADFLAGS
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
43 #undef EAI_FAIL
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
44 #undef EAI_FAMILY
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
45 #undef EAI_MEMORY
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
46 #undef EAI_NODATA
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
47 #undef EAI_NONAME
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
48 #undef EAI_SERVICE
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
49 #undef EAI_SOCKTYPE
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
50 #undef EAI_SYSTEM
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
51 #undef EAI_BADHINTS
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
52 #undef EAI_PROTOCOL
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
53 #undef EAI_MAX
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
54 #undef getaddrinfo
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
55 #define getaddrinfo fake_getaddrinfo
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
56 #endif /* EAI_ADDRFAMILY */
21261
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
57
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
58 #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
59 #define EAI_AGAIN 2 /* temporary failure in name resolution */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
60 #define EAI_BADFLAGS 3 /* invalid value for ai_flags */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
61 #define EAI_FAIL 4 /* non-recoverable failure in name resolution */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
62 #define EAI_FAMILY 5 /* ai_family not supported */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
63 #define EAI_MEMORY 6 /* memory allocation failure */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
64 #define EAI_NODATA 7 /* no address associated with hostname */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
65 #define EAI_NONAME 8 /* hostname nor servname provided, or not known */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
66 #define EAI_SERVICE 9 /* servname not supported for ai_socktype */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
67 #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
68 #define EAI_SYSTEM 11 /* system error returned in errno */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
69 #define EAI_BADHINTS 12
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
70 #define EAI_PROTOCOL 13
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
71 #define EAI_MAX 14
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
72
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
73 /*
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
74 * Flag values for getaddrinfo()
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
75 */
21261
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
76 #ifdef AI_PASSIVE
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
77 #undef AI_PASSIVE
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
78 #undef AI_CANONNAME
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
79 #undef AI_NUMERICHOST
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
80 #undef AI_MASK
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
81 #undef AI_ALL
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
82 #undef AI_V4MAPPED_CFG
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
83 #undef AI_ADDRCONFIG
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
84 #undef AI_V4MAPPED
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
85 #undef AI_DEFAULT
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
86 #endif /* AI_PASSIVE */
21261
4271da70ed9e Undefine addrinfo.h constants if the system header defined them.
Martin v. Löwis <martin@v.loewis.de>
parents: 19278
diff changeset
87
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
88 #define AI_PASSIVE 0x00000001 /* get address to use bind() */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
89 #define AI_CANONNAME 0x00000002 /* fill ai_canonname */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
90 #define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
91 /* valid flags for addrinfo */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
92 #define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
93
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
94 #define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
95 #define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
96 #define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
97 #define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
98 /* special recommended flags for getipnodebyname */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
99 #define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
100
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
101 #endif /* !HAVE_GETADDRINFO */
19278
1afc3116c602 Fix portability problems with glibc 2.0, as reported in #449157.
Martin v. Löwis <martin@v.loewis.de>
parents: 18743
diff changeset
102
1afc3116c602 Fix portability problems with glibc 2.0, as reported in #449157.
Martin v. Löwis <martin@v.loewis.de>
parents: 18743
diff changeset
103 #ifndef HAVE_GETNAMEINFO
1afc3116c602 Fix portability problems with glibc 2.0, as reported in #449157.
Martin v. Löwis <martin@v.loewis.de>
parents: 18743
diff changeset
104
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
105 /*
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
106 * Constants for getnameinfo()
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
107 */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
108 #ifndef NI_MAXHOST
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
109 #define NI_MAXHOST 1025
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
110 #define NI_MAXSERV 32
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
111 #endif /* !NI_MAXHOST */
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
112
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
113 /*
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
114 * Flag values for getnameinfo()
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
115 */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
116 #ifndef NI_NOFQDN
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
117 #define NI_NOFQDN 0x00000001
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
118 #define NI_NUMERICHOST 0x00000002
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
119 #define NI_NAMEREQD 0x00000004
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
120 #define NI_NUMERICSERV 0x00000008
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
121 #define NI_DGRAM 0x00000010
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
122 #endif /* !NI_NOFQDN */
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
123
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
124 #endif /* !HAVE_GETNAMEINFO */
19278
1afc3116c602 Fix portability problems with glibc 2.0, as reported in #449157.
Martin v. Löwis <martin@v.loewis.de>
parents: 18743
diff changeset
125
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
126 #ifndef HAVE_ADDRINFO
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
127 struct addrinfo {
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
128 int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
129 int ai_family; /* PF_xxx */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
130 int ai_socktype; /* SOCK_xxx */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
131 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
132 size_t ai_addrlen; /* length of ai_addr */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
133 char *ai_canonname; /* canonical name for hostname */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
134 struct sockaddr *ai_addr; /* binary address */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
135 struct addrinfo *ai_next; /* next structure in linked list */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
136 };
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
137 #endif /* !HAVE_ADDRINFO */
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
138
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
139 #ifndef HAVE_SOCKADDR_STORAGE
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
140 /*
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
141 * RFC 2553: protocol-independent placeholder for socket addresses
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
142 */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
143 #define _SS_MAXSIZE 128
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
144 #ifdef HAVE_LONG_LONG
28437
871da703e4c0 Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.
Martin v. Löwis <martin@v.loewis.de>
parents: 21261
diff changeset
145 #define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG))
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
146 #else
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
147 #define _SS_ALIGNSIZE (sizeof(double))
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
148 #endif /* HAVE_LONG_LONG */
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
149 #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) * 2)
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
150 #define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) * 2 - \
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
151 _SS_PAD1SIZE - _SS_ALIGNSIZE)
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
152
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
153 struct sockaddr_storage {
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
154 #ifdef HAVE_SOCKADDR_SA_LEN
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
155 unsigned char ss_len; /* address length */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
156 unsigned char ss_family; /* address family */
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
157 #else
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
158 unsigned short ss_family; /* address family */
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
159 #endif /* HAVE_SOCKADDR_SA_LEN */
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
160 char __ss_pad1[_SS_PAD1SIZE];
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
161 #ifdef HAVE_LONG_LONG
28437
871da703e4c0 Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.
Martin v. Löwis <martin@v.loewis.de>
parents: 21261
diff changeset
162 PY_LONG_LONG __ss_align; /* force desired structure storage alignment */
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
163 #else
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
164 double __ss_align; /* force desired structure storage alignment */
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
165 #endif /* HAVE_LONG_LONG */
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
166 char __ss_pad2[_SS_PAD2SIZE];
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
167 };
32593
fdb9377513e4 Add comments at end of every #endif and fix ones already there when for closing
Brett Cannon <bcannon@gmail.com>
parents: 28437
diff changeset
168 #endif /* !HAVE_SOCKADDR_STORAGE */
18246
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
169
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
170 #ifdef __cplusplus
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
171 extern "C" {
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
172 #endif
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
173 extern void freehostent Py_PROTO((struct hostent *));
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
174 #ifdef __cplusplus
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
175 }
c4db09b87424 Patch #401196: Configuration machinery for IPv6.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
176 #endif