]>
Commit | Line | Data |
---|---|---|
76ebf6c4 AC |
1 | /* |
2 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
3 | * All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
13 | * 3. Neither the name of the project nor the names of its contributors | |
14 | * may be used to endorse or promote products derived from this software | |
15 | * without specific prior written permission. | |
16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
27 | * SUCH DAMAGE. | |
28 | * | |
29 | * $Id$ | |
30 | */ | |
31 | ||
32 | struct rb_addrinfo { | |
33 | int ai_flags; | |
34 | int ai_family; | |
35 | int ai_socktype; | |
36 | int ai_protocol; | |
37 | size_t ai_addrlen; | |
38 | char *ai_canonname; | |
39 | struct sockaddr *ai_addr; | |
40 | struct rb_addrinfo *ai_next; | |
41 | }; | |
42 | ||
43 | #ifndef AI_PASSIVE | |
44 | #define AI_PASSIVE 0x00000001 /* get address to use bind() */ | |
45 | #endif /* AI_PASSIVE */ | |
46 | ||
47 | #ifndef AI_NUMERICHOST | |
48 | #define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ | |
49 | #endif /* AI_NUMERICHOST */ | |
50 | ||
51 | #ifndef EAI_FAIL | |
52 | #define EAI_FAIL 4 /* non-recoverable failure in name resolution */ | |
53 | #endif /* EAI_FAIL */ | |
54 | ||
55 | #ifndef EAI_FAMILY | |
56 | #define EAI_FAMILY 5 /* ai_family not supported */ | |
57 | #endif /* EAI_FAMILY */ | |
58 | ||
59 | #ifndef EAI_MEMORY | |
60 | #define EAI_MEMORY 6 /* memory allocation failure */ | |
61 | #endif /* EAI_MEMORY */ | |
62 | ||
63 | #ifndef EAI_NONAME | |
64 | #define EAI_NONAME 8 /* hostname nor servname provided, or not known */ | |
65 | #endif /* EAI_NONAME */ | |
66 | ||
67 | #ifndef EAI_SYSTEM | |
68 | #define EAI_SYSTEM 11 /* system error returned in errno */ | |
69 | #endif /* EAI_SYSTEM */ | |
70 | ||
71 | #ifndef NI_NUMERICHOST | |
72 | #define NI_NUMERICHOST 0x00000002 | |
73 | #endif /* NI_NUMERICHOST */ | |
74 | ||
75 | #ifndef NI_NAMEREQD | |
76 | #define NI_NAMEREQD 0x00000004 | |
77 | #endif /* NI_NAMEREQD */ | |
78 | ||
79 | #ifndef NI_NUMERICSERV | |
80 | #define NI_NUMERICSERV 0x00000008 | |
81 | #endif /* NI_NUMERICSERV */ | |
82 | ||
83 | #ifndef NI_DGRAM | |
84 | #define NI_DGRAM 0x00000010 | |
85 | #endif /* NI_DGRAM */ | |
86 | ||
87 | #ifndef INADDR_NONE | |
88 | #define INADDR_NONE ((unsigned int) 0xffffffff) | |
89 | #endif /* INADDR_NONE */ | |
90 | ||
91 | int rb_getaddrinfo(const char *hostname, const char *servname, | |
92 | const struct rb_addrinfo *hints, struct rb_addrinfo **res); | |
93 | void rb_freeaddrinfo(struct rb_addrinfo *ai); | |
94 | ||
95 | #define SUCCESS 0 | |
96 | #define ANY 0 | |
97 | #define YES 1 | |
98 | #define NO 0 | |
99 | ||
100 | #undef EAI_ADDRFAMILY | |
101 | #undef EAI_AGAIN | |
102 | #undef EAI_BADFLAGS | |
103 | #undef EAI_FAIL | |
104 | #undef EAI_FAMILY | |
105 | #undef EAI_MEMORY | |
106 | #undef EAI_NODATA | |
107 | #undef EAI_NONAME | |
108 | #undef EAI_SERVICE | |
109 | #undef EAI_SOCKTYPE | |
110 | #undef EAI_SYSTEM | |
111 | #undef EAI_BADHINTS | |
112 | #undef EAI_PROTOCOL | |
113 | #undef EAI_MAX | |
114 | #undef AI_MASK | |
115 | ||
116 | #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ | |
117 | #define EAI_AGAIN 2 /* temporary failure in name resolution */ | |
118 | #define EAI_BADFLAGS 3 /* invalid value for ai_flags */ | |
119 | #define EAI_FAIL 4 /* non-recoverable failure in name resolution */ | |
120 | #define EAI_FAMILY 5 /* ai_family not supported */ | |
121 | #define EAI_MEMORY 6 /* memory allocation failure */ | |
122 | #define EAI_NODATA 7 /* no address associated with hostname */ | |
123 | #define EAI_NONAME 8 /* hostname nor servname provided, or not known */ | |
124 | #define EAI_SERVICE 9 /* servname not supported for ai_socktype */ | |
125 | #define EAI_SOCKTYPE 10 /* ai_socktype not supported */ | |
126 | #define EAI_SYSTEM 11 /* system error returned in errno */ | |
127 | #define EAI_BADHINTS 12 | |
128 | #define EAI_PROTOCOL 13 | |
129 | #define EAI_MAX 14 | |
130 | #define AI_MASK (AI_PASSIVE | AI_NUMERICHOST) |