File:
[local] /
rpl /
src /
getaddrinfo.h
Revision
1.12:
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Jun 21 15:26:30 2011 UTC (13 years, 10 months ago) by
bertrand
Branches:
MAIN
CVS tags:
HEAD
Correction d'une réinitialisation sauvage de la pile des variables par niveau
dans la copie de la structure de description du processus. Cela corrige
la fonction SPAWN qui échouait sur un segmentation fault car la pile des
variables par niveau était vide alors même que l'arbre des variables contenait
bien les variables. Passage à la prerelease 2.
1: /*
2: ================================================================================
3: RPL/2 (R) version 4.1.0.prerelease.2
4: Copyright (C) 1989-2011 Dr. BERTRAND Joël
5:
6: This file is part of RPL/2.
7:
8: RPL/2 is free software; you can redistribute it and/or modify it
9: under the terms of the CeCILL V2 License as published by the french
10: CEA, CNRS and INRIA.
11:
12: RPL/2 is distributed in the hope that it will be useful, but WITHOUT
13: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14: FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL V2 License
15: for more details.
16:
17: You should have received a copy of the CeCILL License
18: along with RPL/2. If not, write to info@cecill.info.
19: ================================================================================
20: */
21:
22:
23: #ifndef GETADDRINFO_H
24: #define GETADDRINFO_H
25:
26: #ifdef HAVE_CONFIG_H
27: #include "config.h"
28: #endif
29:
30: #include <sys/types.h>
31:
32: #ifdef WIN32
33: #include <time.h>
34: #include <winsock2.h>
35: #ifdef DO_IPV6
36: #include <ws2tcpip.h>
37: #endif /* DO_IPV6 */
38: #include <windows.h>
39: #else
40: #include <sys/socket.h>
41: #include <netdb.h>
42: #endif
43:
44: #ifdef __INNOTEK_LIBC__
45: typedef int socklen_t;
46: #endif
47:
48: /********************************************************************/
49: /*
50: * Undefine all the macros.
51: * <netdb.h> might defines some of them.
52: */
53: #ifdef EAI_ADDRFAMILY
54: #undef EAI_ADDRFAMILY
55: #endif
56: #ifdef EAI_AGAIN
57: #undef EAI_AGAIN
58: #endif
59: #ifdef EAI_BADFLAGS
60: #undef EAI_BADFLAGS
61: #endif
62: #ifdef EAI_FAIL
63: #undef EAI_FAIL
64: #endif
65: #ifdef EAI_FAMILY
66: #undef EAI_FAMILY
67: #endif
68: #ifdef EAI_MEMORY
69: #undef EAI_MEMORY
70: #endif
71: #ifdef EAI_NONAME
72: #undef EAI_NONAME
73: #endif
74: #ifdef EAI_OVERFLOW
75: #undef EAI_OVERFLOW
76: #endif
77: #ifdef EAI_SERVICE
78: #undef EAI_SERVICE
79: #endif
80: #ifdef EAI_SOCKTYPE
81: #undef EAI_SOCKTYPE
82: #endif
83: #ifdef EAI_SYSTEM
84: #undef EAI_SYSTEM
85: #endif
86:
87: #ifdef AI_PASSIVE
88: #undef AI_PASSIVE
89: #endif
90: #ifdef AI_CANONNAME
91: #undef AI_CANONNAME
92: #endif
93: #ifdef AI_NUMERICHOST
94: #undef AI_NUMERICHOST
95: #endif
96: #ifdef AI_NUMERICSERV
97: #undef AI_NUMERICSERV
98: #endif
99: #ifdef AI_V4MAPPED
100: #undef AI_V4MAPPED
101: #endif
102: #ifdef AI_ALL
103: #undef AI_ALL
104: #endif
105: #ifdef AI_ADDRCONFIG
106: #undef AI_ADDRCONFIG
107: #endif
108: #ifdef AI_DEFAULT
109: #undef AI_DEFAULT
110: #endif
111:
112: #ifdef NI_NOFQDN
113: #undef NI_NOFQDN
114: #endif
115: #ifdef NI_NUMERICHOST
116: #undef NI_NUMERICHOST
117: #endif
118: #ifdef NI_NAMEREQD
119: #undef NI_NAMEREQD
120: #endif
121: #ifdef NI_NUMERICSERV
122: #undef NI_NUMERICSERV
123: #endif
124: #ifdef NI_NUMERICSCOPE
125: #undef NI_NUMERICSCOPE
126: #endif
127:
128: #ifdef NI_DGRAM
129: #undef NI_DGRAM
130: #endif
131: #ifdef NI_MAXHOST
132: #undef NI_MAXHOST
133: #endif
134: #ifdef NI_MAXSERV
135: #undef NI_MAXSERV
136: #endif
137:
138: /*
139: * Fake struct and function names.
140: * <netdb.h> might declares all or some of them.
141: */
142: #if defined(HAVE_GETADDRINFO) || defined(HAVE_GETNAMEINFO)
143: #define addrinfo my_addrinfo
144: #define gai_strerror my_gai_strerror
145: #define freeaddrinfo my_freeaddrinfo
146: #define getaddrinfo my_getaddrinfo
147: #define getnameinfo my_getnameinfo
148: #endif
149:
150: /********************************************************************/
151: /*
152: * Error codes.
153: */
154: #define EAI_ADDRFAMILY 1
155: #define EAI_AGAIN 2
156: #define EAI_BADFLAGS 3
157: #define EAI_FAIL 4
158: #define EAI_FAMILY 5
159: #define EAI_MEMORY 6
160: #define EAI_NONAME 7
161: #define EAI_OVERFLOW 8
162: #define EAI_SERVICE 9
163: #define EAI_SOCKTYPE 10
164: #define EAI_SYSTEM 11
165:
166: /*
167: * Flags for getaddrinfo().
168: */
169: #define AI_ADDRCONFIG 0x0001
170: #define AI_ALL 0x0002
171: #define AI_CANONNAME 0x0004
172: #define AI_NUMERICHOST 0x0008
173: #define AI_NUMERICSERV 0x0010
174: #define AI_PASSIVE 0x0020
175: #define AI_V4MAPPED 0x0040
176: #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
177:
178: /*
179: * Flags for getnameinfo().
180: */
181: #define NI_DGRAM 0x0001
182: #define NI_NAMEREQD 0x0002
183: #define NI_NOFQDN 0x0004
184: #define NI_NUMERICHOST 0x0008
185: #define NI_NUMERICSCOPE 0x0010
186: #define NI_NUMERICSERV 0x0020
187:
188: /*
189: * Maximum length of FQDN and servie name for getnameinfo().
190: */
191: #define NI_MAXHOST 1025
192: #define NI_MAXSERV 32
193:
194: /*
195: * Address families and Protocol families.
196: */
197: #ifndef AF_UNSPEC
198: #define AF_UNSPEC AF_INET
199: #endif
200: #ifndef PF_UNSPEC
201: #define PF_UNSPEC PF_INET
202: #endif
203:
204: /*
205: * struct addrinfo.
206: */
207: struct addrinfo {
208: int ai_flags;
209: int ai_family;
210: int ai_socktype;
211: int ai_protocol;
212: socklen_t ai_addrlen;
213: char *ai_canonname;
214: struct sockaddr *ai_addr;
215: struct addrinfo *ai_next;
216: };
217:
218: /*
219: * Functions.
220: */
221: #ifdef __STDC__
222: #if defined (__cplusplus)
223: extern "C" {
224: #endif
225: const char *gai_strerror(int);
226: void freeaddrinfo(struct addrinfo *);
227: int getaddrinfo(const char *, const char *, const struct addrinfo *,
228: struct addrinfo **);
229: int getnameinfo(const struct sockaddr *, socklen_t, char *,
230: socklen_t, char *, socklen_t, int);
231: #if defined (__cplusplus)
232: }
233: #endif
234: #else
235: const char *gai_strerror();
236: void freeaddrinfo();
237: int getaddrinfo();
238: int getnameinfo();
239: #endif
240:
241: #endif /* not GETADDRINFO_H */
242:
243: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>