Print this page
Finished obsoleting interfaces for XPG7.
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/netdb.h
+++ new/usr/src/head/netdb.h
1 1 /*
2 2 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
3 3 * Use is subject to license terms.
4 4 */
5 5
6 6 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
7 7 /* All Rights Reserved */
8 8
9 9 /*
10 10 * BIND 4.9.3:
11 11 *
12 12 * Copyright (c) 1980, 1983, 1988, 1993
13 13 * The Regents of the University of California. All rights reserved.
14 14 *
15 15 * Redistribution and use in source and binary forms, with or without
16 16 * modification, are permitted provided that the following conditions
17 17 * are met:
18 18 * 1. Redistributions of source code must retain the above copyright
19 19 * notice, this list of conditions and the following disclaimer.
20 20 * 2. Redistributions in binary form must reproduce the above copyright
21 21 * notice, this list of conditions and the following disclaimer in the
22 22 * documentation and/or other materials provided with the distribution.
23 23 * 3. All advertising materials mentioning features or use of this software
24 24 * must display the following acknowledgement:
25 25 * This product includes software developed by the University of
26 26 * California, Berkeley and its contributors.
27 27 * 4. Neither the name of the University nor the names of its contributors
28 28 * may be used to endorse or promote products derived from this software
29 29 * without specific prior written permission.
30 30 *
31 31 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
32 32 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33 33 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34 34 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35 35 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
39 39 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
40 40 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 41 * SUCH DAMAGE.
42 42 * -
43 43 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
44 44 *
45 45 * Permission to use, copy, modify, and distribute this software for any
46 46 * purpose with or without fee is hereby granted, provided that the above
47 47 * copyright notice and this permission notice appear in all copies, and that
48 48 * the name of Digital Equipment Corporation not be used in advertising or
49 49 * publicity pertaining to distribution of the document or software without
50 50 * specific, written prior permission.
51 51 *
52 52 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
53 53 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
54 54 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
55 55 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
56 56 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
57 57 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
58 58 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
59 59 * SOFTWARE.
60 60 * --Copyright--
61 61 *
62 62 * End BIND 4.9.3
63 63 */
64 64
65 65 /*
66 66 * Structures returned by network data base library.
67 67 * All addresses are supplied in host order, and
68 68 * returned in network order (suitable for use in system calls).
69 69 */
70 70
71 71 #ifndef _NETDB_H
72 72 #define _NETDB_H
73 73
74 74 #include <sys/types.h>
75 75 #include <netinet/in.h>
76 76 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
77 77 #include <sys/socket.h>
78 78 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
79 79 #include <sys/feature_tests.h>
80 80
81 81 #ifdef __cplusplus
82 82 extern "C" {
83 83 #endif
84 84
85 85 #define _PATH_HEQUIV "/etc/hosts.equiv"
86 86 #define _PATH_HOSTS "/etc/hosts"
87 87 #define _PATH_IPNODES "/etc/inet/ipnodes"
88 88 #define _PATH_IPSECALGS "/etc/inet/ipsecalgs"
89 89 #define _PATH_NETMASKS "/etc/netmasks"
90 90 #define _PATH_NETWORKS "/etc/networks"
91 91 #define _PATH_PROTOCOLS "/etc/protocols"
92 92 #define _PATH_SERVICES "/etc/services"
93 93
94 94 struct hostent {
95 95 char *h_name; /* official name of host */
96 96 char **h_aliases; /* alias list */
97 97 int h_addrtype; /* host address type */
98 98 int h_length; /* length of address */
99 99 char **h_addr_list; /* list of addresses from name server */
100 100 #define h_addr h_addr_list[0] /* address, for backward compatiblity */
101 101 };
102 102
103 103
104 104 /*
105 105 * addrinfo introduced with IPv6 for Protocol-Independent Hostname
106 106 * and Service Name Translation.
107 107 */
108 108
109 109 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
110 110 struct addrinfo {
111 111 int ai_flags; /* AI_PASSIVE, AI_CANONNAME, ... */
112 112 int ai_family; /* PF_xxx */
113 113 int ai_socktype; /* SOCK_xxx */
114 114 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
115 115 #ifdef __sparcv9
116 116 int _ai_pad; /* for backwards compat with old size_t */
117 117 #endif /* __sparcv9 */
118 118 socklen_t ai_addrlen;
119 119 char *ai_canonname; /* canonical name for hostname */
120 120 struct sockaddr *ai_addr; /* binary address */
121 121 struct addrinfo *ai_next; /* next structure in linked list */
122 122 };
123 123
124 124
125 125 /* addrinfo flags */
126 126 #define AI_PASSIVE 0x0008 /* intended for bind() + listen() */
127 127 #define AI_CANONNAME 0x0010 /* return canonical version of host */
128 128 #define AI_NUMERICHOST 0x0020 /* use numeric node address string */
129 129 #define AI_NUMERICSERV 0x0040 /* servname is assumed numeric */
130 130
131 131 /* getipnodebyname() flags */
132 132 #define AI_V4MAPPED 0x0001 /* IPv4 mapped addresses if no IPv6 */
133 133 #define AI_ALL 0x0002 /* IPv6 and IPv4 mapped addresses */
134 134 #define AI_ADDRCONFIG 0x0004 /* AAAA or A records only if IPv6/IPv4 cnfg'd */
135 135
136 136
137 137 /*
138 138 * These were defined in RFC 2553 but not SUSv3
139 139 * or RFC 3493 which obsoleted 2553.
140 140 */
141 141 #if !defined(_XPG6) || defined(__EXTENSIONS__)
142 142 #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
143 143
144 144 /* addrinfo errors */
145 145 #define EAI_ADDRFAMILY 1 /* address family not supported */
146 146 #define EAI_NODATA 7 /* no address */
147 147 #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
148 148 #define EAI_AGAIN 2 /* DNS temporary failure */
149 149 #define EAI_BADFLAGS 3 /* invalid ai_flags */
150 150 #define EAI_FAIL 4 /* DNS non-recoverable failure */
151 151 #define EAI_FAMILY 5 /* ai_family not supported */
152 152 #define EAI_MEMORY 6 /* memory allocation failure */
153 153 #define EAI_NONAME 8 /* host/servname not known */
154 154 #define EAI_SERVICE 9 /* servname not supported for ai_socktype */
155 155 #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
156 156 #define EAI_SYSTEM 11 /* system error in errno */
157 157 #define EAI_OVERFLOW 12 /* argument buffer overflow */
158 158 #define EAI_PROTOCOL 13
159 159 #define EAI_MAX 14
160 160
161 161 /* getnameinfo flags */
162 162 #define NI_NOFQDN 0x0001
163 163 #define NI_NUMERICHOST 0x0002 /* return numeric form of address */
164 164 #define NI_NAMEREQD 0x0004 /* request DNS name */
165 165 #define NI_NUMERICSERV 0x0008
166 166 #define NI_DGRAM 0x0010
167 167
168 168 #if !defined(_XPG6) || defined(__EXTENSIONS__)
169 169 /* Not listed in any standards document */
170 170 #define NI_WITHSCOPEID 0x0020
171 171 #define NI_NUMERICSCOPE 0x0040
172 172
173 173 /* getnameinfo max sizes as defined in RFC 2553 obsoleted in RFC 3493 */
174 174 #define NI_MAXHOST 1025
175 175 #define NI_MAXSERV 32
176 176 #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
177 177 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
178 178
179 179 /*
180 180 * Scope delimit character
181 181 */
182 182 #define SCOPE_DELIMITER '%'
183 183
184 184
185 185 /*
186 186 * Algorithm entry for /etc/inet/ipsecalgs which defines IPsec protocols
187 187 * and algorithms.
188 188 */
189 189 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
190 190 typedef struct ipsecalgent {
191 191 char **a_names; /* algorithm names */
192 192 int a_proto_num; /* protocol number */
193 193 int a_alg_num; /* algorithm number */
194 194 char *a_mech_name; /* encryption framework mechanism name */
195 195 int *a_block_sizes; /* supported block sizes */
196 196 int *a_key_sizes; /* supported key sizes */
197 197 int a_key_increment; /* key size increment */
198 198 int *a_mech_params; /* mechanism specific parameters */
199 199 int a_alg_flags; /* algorithm flags */
200 200 } ipsecalgent_t;
201 201
202 202 /* well-known IPsec protocol numbers */
203 203
204 204 #define IPSEC_PROTO_AH 2
205 205 #define IPSEC_PROTO_ESP 3
206 206 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
207 207
208 208 /*
209 209 * Assumption here is that a network number
210 210 * fits in 32 bits -- probably a poor one.
211 211 */
212 212 struct netent {
213 213 char *n_name; /* official name of net */
214 214 char **n_aliases; /* alias list */
215 215 int n_addrtype; /* net address type */
216 216 in_addr_t n_net; /* network # */
217 217 };
218 218
219 219 struct protoent {
220 220 char *p_name; /* official protocol name */
221 221 char **p_aliases; /* alias list */
↓ open down ↓ |
221 lines elided |
↑ open up ↑ |
222 222 int p_proto; /* protocol # */
223 223 };
224 224
225 225 struct servent {
226 226 char *s_name; /* official service name */
227 227 char **s_aliases; /* alias list */
228 228 int s_port; /* port # */
229 229 char *s_proto; /* protocol to use */
230 230 };
231 231
232 -#ifdef __STDC__
233 232 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
234 233 struct hostent *gethostbyname_r
235 234 (const char *, struct hostent *, char *, int, int *h_errnop);
236 235 struct hostent *gethostbyaddr_r
237 236 (const char *, int, int, struct hostent *, char *, int, int *h_errnop);
238 237 struct hostent *getipnodebyname(const char *, int, int, int *);
239 238 struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
240 239 void freehostent(struct hostent *);
241 240 struct hostent *gethostent_r(struct hostent *, char *, int, int *h_errnop);
242 241
243 242 struct servent *getservbyname_r
244 243 (const char *name, const char *, struct servent *, char *, int);
245 244 struct servent *getservbyport_r
246 245 (int port, const char *, struct servent *, char *, int);
247 246 struct servent *getservent_r(struct servent *, char *, int);
248 247
249 248 struct netent *getnetbyname_r
250 249 (const char *, struct netent *, char *, int);
251 250 struct netent *getnetbyaddr_r(long, int, struct netent *, char *, int);
252 251 struct netent *getnetent_r(struct netent *, char *, int);
253 252
254 253 struct protoent *getprotobyname_r
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
255 254 (const char *, struct protoent *, char *, int);
256 255 struct protoent *getprotobynumber_r
257 256 (int, struct protoent *, char *, int);
258 257 struct protoent *getprotoent_r(struct protoent *, char *, int);
259 258
260 259 int getnetgrent_r(char **, char **, char **, char *, int);
261 260 int innetgr(const char *, const char *, const char *, const char *);
262 261 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
263 262
264 263 /* Old interfaces that return a pointer to a static area; MT-unsafe */
264 +#ifndef _STRICT_XPG7
265 265 struct hostent *gethostbyname(const char *);
266 +#endif
266 267 struct hostent *gethostent(void);
267 268 struct netent *getnetbyaddr(in_addr_t, int);
268 269 struct netent *getnetbyname(const char *);
269 270 struct netent *getnetent(void);
270 271 struct protoent *getprotobyname(const char *);
271 272 struct protoent *getprotobynumber(int);
272 273 struct protoent *getprotoent(void);
273 274 struct servent *getservbyname(const char *, const char *);
274 275 struct servent *getservbyport(int, const char *);
275 276 struct servent *getservent(void);
276 277
277 -/* gethostbyaddr() second argument is a size_t only in unix95/unix98 */
278 +/*
279 + * gethostbyaddr() second argument is a size_t only in unix95/unix98,
280 + * removed in XPG issue 7
281 + */
282 +#if !defined(_STRICT_XPG7)
278 283 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
279 284 struct hostent *gethostbyaddr(const void *, socklen_t, int);
280 285 #else
281 286 struct hostent *gethostbyaddr(const void *, size_t, int);
282 287 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
288 +#endif /* !defined(_STRICT_XPG7) */
283 289
284 290 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
285 291 int endhostent(void);
286 292 int endnetent(void);
287 293 int endprotoent(void);
288 294 int endservent(void);
289 295 int sethostent(int);
290 296 int setnetent(int);
291 297 int setprotoent(int);
292 298 int setservent(int);
293 299 #else
294 300 void endhostent(void);
295 301 void endnetent(void);
296 302 void endprotoent(void);
297 303 void endservent(void);
298 304 void sethostent(int);
299 305 void setnetent(int);
300 306 void setprotoent(int);
301 307 void setservent(int);
302 308 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
303 309
304 310 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
305 311
306 312 #ifdef _XPG6
307 313 #ifdef __PRAGMA_REDEFINE_EXTNAME
308 314 #pragma redefine_extname getaddrinfo __xnet_getaddrinfo
309 315 #else /* __PRAGMA_REDEFINE_EXTNAME */
310 316 #define getaddrinfo __xnet_getaddrinfo
311 317 #endif /* __PRAGMA_REDEFINE_EXTNAME */
312 318 #endif /* _XPG6 */
313 319
314 320 int getaddrinfo(const char *_RESTRICT_KYWD,
315 321 const char *_RESTRICT_KYWD,
316 322 const struct addrinfo *_RESTRICT_KYWD,
317 323 struct addrinfo **_RESTRICT_KYWD);
318 324 void freeaddrinfo(struct addrinfo *);
319 325 const char *gai_strerror(int);
320 326 int getnameinfo(const struct sockaddr *_RESTRICT_KYWD,
321 327 socklen_t, char *_RESTRICT_KYWD, socklen_t,
322 328 char *_RESTRICT_KYWD, socklen_t, int);
323 329 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
324 330
325 331 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
326 332 int getnetgrent(char **, char **, char **);
327 333 int setnetgrent(const char *);
328 334 int endnetgrent(void);
329 335 int rcmd(char **, unsigned short,
330 336 const char *, const char *, const char *, int *);
331 337 int rcmd_af(char **, unsigned short,
332 338 const char *, const char *, const char *, int *, int);
333 339 int rresvport_af(int *, int);
334 340 int rresvport_addr(int *, struct sockaddr_storage *);
335 341 int rexec(char **, unsigned short,
336 342 const char *, const char *, const char *, int *);
337 343 int rexec_af(char **, unsigned short,
338 344 const char *, const char *, const char *, int *, int);
339 345 int rresvport(int *);
340 346 int ruserok(const char *, int, const char *, const char *);
341 347 /* BIND */
342 348 struct hostent *gethostbyname2(const char *, int);
343 349 void herror(const char *);
344 350 const char *hstrerror(int);
345 351 /* End BIND */
↓ open down ↓ |
53 lines elided |
↑ open up ↑ |
346 352
347 353 /* IPsec algorithm prototype definitions */
348 354 struct ipsecalgent *getipsecalgbyname(const char *, int, int *);
349 355 struct ipsecalgent *getipsecalgbynum(int, int, int *);
350 356 int getipsecprotobyname(const char *doi_name);
351 357 char *getipsecprotobynum(int doi_domain);
352 358 void freeipsecalgent(struct ipsecalgent *ptr);
353 359 /* END IPsec algorithm prototype definitions */
354 360
355 361 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
356 -#else /* __STDC__ */
357 -struct hostent *gethostbyname_r();
358 -struct hostent *gethostbyaddr_r();
359 -struct hostent *getipnodebyname();
360 -struct hostent *getipnodebyaddr();
361 -void freehostent();
362 -struct hostent *gethostent_r();
363 -struct servent *getservbyname_r();
364 -struct servent *getservbyport_r();
365 -struct servent *getservent_r();
366 -struct netent *getnetbyname_r();
367 -struct netent *getnetbyaddr_r();
368 -struct netent *getnetent_r();
369 -struct protoent *getprotobyname_r();
370 -struct protoent *getprotobynumber_r();
371 -struct protoent *getprotoent_r();
372 -int getnetgrent_r();
373 -int innetgr();
374 362
375 -/* Old interfaces that return a pointer to a static area; MT-unsafe */
376 -struct hostent *gethostbyname();
377 -struct hostent *gethostbyaddr();
378 -struct hostent *gethostent();
379 -struct netent *getnetbyname();
380 -struct netent *getnetbyaddr();
381 -struct netent *getnetent();
382 -struct servent *getservbyname();
383 -struct servent *getservbyport();
384 -struct servent *getservent();
385 -struct protoent *getprotobyname();
386 -struct protoent *getprotobynumber();
387 -struct protoent *getprotoent();
388 -int getnetgrent();
389 -
390 -int sethostent();
391 -int endhostent();
392 -int setnetent();
393 -int endnetent();
394 -int setservent();
395 -int endservent();
396 -int setprotoent();
397 -int endprotoent();
398 -int setnetgrent();
399 -int endnetgrent();
400 -int rcmd();
401 -int rcmd_af();
402 -int rexec();
403 -int rexec_af();
404 -int rresvport();
405 -int rresvport_af();
406 -int rresvport_addr();
407 -int ruserok();
408 -/* BIND */
409 -struct hostent *gethostbyname2();
410 -void herror();
411 -char *hstrerror();
412 -/* IPv6 prototype definitons */
413 -int getaddrinfo();
414 -void freeaddrinfo();
415 -const char *gai_strerror();
416 -int getnameinfo();
417 -/* END IPv6 prototype definitions */
418 -/* End BIND */
419 -
420 -#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
421 -/* IPsec algorithm prototype definitions */
422 -struct ipsecalgent *getalgbyname();
423 -struct ipsecalgent *getalgbydoi();
424 -int getdoidomainbyname();
425 -const char *getdoidomainbynum();
426 -void freealgent();
427 -/* END IPsec algorithm prototype definitions */
428 -#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
429 -
430 -#endif /* __STDC__ */
431 -
432 363 /*
433 364 * Error return codes from gethostbyname() and gethostbyaddr()
434 365 * (when using the resolver)
435 366 */
436 367
368 +/* h_errno was removed in Issue 7 */
369 +#if !defined(_STRICT_XPG7)
437 370 extern int h_errno;
438 371
439 372 #ifdef _REENTRANT
440 -#ifdef __STDC__
441 373 extern int *__h_errno(void);
442 -#else
443 -extern int *__h_errno();
444 -#endif /* __STDC__ */
445 374
446 375 /* Only #define h_errno if there is no conflict with other use */
447 376 #ifdef H_ERRNO_IS_FUNCTION
448 377 #define h_errno (*__h_errno())
449 378 #endif /* NO_H_ERRNO_DEFINE */
450 379 #endif /* _REENTRANT */
451 380
452 381 /*
453 382 * Error return codes from gethostbyname() and gethostbyaddr()
454 383 * (left in extern int h_errno).
455 384 */
456 385 #define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */
457 386 #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
458 387 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
459 388 #define NO_DATA 4 /* Valid name, no data record of requested type */
460 389
461 390 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
462 391 #define NO_ADDRESS NO_DATA /* no address, look for MX record */
463 392
464 393 /* BIND */
465 394 #define NETDB_INTERNAL -1 /* see errno */
466 395 #define NETDB_SUCCESS 0 /* no problem */
467 396 /* End BIND */
468 397
398 +#endif /* !defined(_STRICT_XPG7) */
399 +
469 400 #define MAXHOSTNAMELEN 256
470 401
471 402 #define MAXALIASES 35
472 403 #define MAXADDRS 35
473 404 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
474 405
475 406 #ifdef __cplusplus
476 407 }
477 408 #endif
478 409
479 410 #endif /* _NETDB_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX