Fix bug in firstversions.awk version range handling.
[glibc.git] / resolv / netdb.h
blob551b4c7a0a0cf8d56b4de359efcaeb90e28e57ed
1 /* Copyright (C) 1996-2004, 2009-2011, 2012 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 /* All data returned by the network data base library are supplied in
20 host order and returned in network order (suitable for use in
21 system calls). */
23 #ifndef _NETDB_H
24 #define _NETDB_H 1
26 #include <features.h>
28 #include <netinet/in.h>
29 #include <stdint.h>
30 #ifdef __USE_MISC
31 /* This is necessary to make this include file properly replace the
32 Sun version. */
33 # include <rpc/netdb.h>
34 #endif
36 #ifdef __USE_GNU
37 # define __need_sigevent_t
38 # include <bits/siginfo.h>
39 # define __need_timespec
40 # include <time.h>
41 #endif
43 #include <bits/netdb.h>
45 /* Absolute file name for network data base files. */
46 #define _PATH_HEQUIV "/etc/hosts.equiv"
47 #define _PATH_HOSTS "/etc/hosts"
48 #define _PATH_NETWORKS "/etc/networks"
49 #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf"
50 #define _PATH_PROTOCOLS "/etc/protocols"
51 #define _PATH_SERVICES "/etc/services"
54 __BEGIN_DECLS
56 #if defined __USE_MISC || !defined __USE_XOPEN2K8
57 /* Error status for non-reentrant lookup functions.
58 We use a macro to access always the thread-specific `h_errno' variable. */
59 # define h_errno (*__h_errno_location ())
61 /* Function to get address of global `h_errno' variable. */
62 extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
65 /* Possible values left in `h_errno'. */
66 # define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
67 # define TRY_AGAIN 2 /* Non-Authoritative Host not found,
68 or SERVERFAIL. */
69 # define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED,
70 NOTIMP. */
71 # define NO_DATA 4 /* Valid name, no data record of requested
72 type. */
73 #endif
74 #if defined __USE_MISC || defined __USE_GNU
75 # define NETDB_INTERNAL -1 /* See errno. */
76 # define NETDB_SUCCESS 0 /* No problem. */
77 # define NO_ADDRESS NO_DATA /* No address, look for MX record. */
78 #endif
80 #ifdef __USE_XOPEN2K
81 /* Highest reserved Internet port number. */
82 # define IPPORT_RESERVED 1024
83 #endif
85 #ifdef __USE_GNU
86 /* Scope delimiter for getaddrinfo(), getnameinfo(). */
87 # define SCOPE_DELIMITER '%'
88 #endif
90 #ifdef __USE_MISC
91 /* Print error indicated by `h_errno' variable on standard error. STR
92 if non-null is printed before the error string. */
93 extern void herror (const char *__str) __THROW;
95 /* Return string associated with error ERR_NUM. */
96 extern const char *hstrerror (int __err_num) __THROW;
97 #endif
100 /* Description of data base entry for a single host. */
101 struct hostent
103 char *h_name; /* Official name of host. */
104 char **h_aliases; /* Alias list. */
105 int h_addrtype; /* Host address type. */
106 int h_length; /* Length of address. */
107 char **h_addr_list; /* List of addresses from name server. */
108 #if defined __USE_MISC || defined __USE_GNU
109 # define h_addr h_addr_list[0] /* Address, for backward compatibility.*/
110 #endif
113 /* Open host data base files and mark them as staying open even after
114 a later search if STAY_OPEN is non-zero.
116 This function is a possible cancellation point and therefore not
117 marked with __THROW. */
118 extern void sethostent (int __stay_open);
120 /* Close host data base files and clear `stay open' flag.
122 This function is a possible cancellation point and therefore not
123 marked with __THROW. */
124 extern void endhostent (void);
126 /* Get next entry from host data base file. Open data base if
127 necessary.
129 This function is a possible cancellation point and therefore not
130 marked with __THROW. */
131 extern struct hostent *gethostent (void);
133 /* Return entry from host data base which address match ADDR with
134 length LEN and type TYPE.
136 This function is a possible cancellation point and therefore not
137 marked with __THROW. */
138 extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len,
139 int __type);
141 /* Return entry from host data base for host with NAME.
143 This function is a possible cancellation point and therefore not
144 marked with __THROW. */
145 extern struct hostent *gethostbyname (const char *__name);
147 #ifdef __USE_MISC
148 /* Return entry from host data base for host with NAME. AF must be
149 set to the address type which is `AF_INET' for IPv4 or `AF_INET6'
150 for IPv6.
152 This function is not part of POSIX and therefore no official
153 cancellation point. But due to similarity with an POSIX interface
154 or due to the implementation it is a cancellation point and
155 therefore not marked with __THROW. */
156 extern struct hostent *gethostbyname2 (const char *__name, int __af);
158 /* Reentrant versions of the functions above. The additional
159 arguments specify a buffer of BUFLEN starting at BUF. The last
160 argument is a pointer to a variable which gets the value which
161 would be stored in the global variable `herrno' by the
162 non-reentrant functions.
164 These functions are not part of POSIX and therefore no official
165 cancellation point. But due to similarity with an POSIX interface
166 or due to the implementation they are cancellation points and
167 therefore not marked with __THROW. */
168 extern int gethostent_r (struct hostent *__restrict __result_buf,
169 char *__restrict __buf, size_t __buflen,
170 struct hostent **__restrict __result,
171 int *__restrict __h_errnop);
173 extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len,
174 int __type,
175 struct hostent *__restrict __result_buf,
176 char *__restrict __buf, size_t __buflen,
177 struct hostent **__restrict __result,
178 int *__restrict __h_errnop);
180 extern int gethostbyname_r (const char *__restrict __name,
181 struct hostent *__restrict __result_buf,
182 char *__restrict __buf, size_t __buflen,
183 struct hostent **__restrict __result,
184 int *__restrict __h_errnop);
186 extern int gethostbyname2_r (const char *__restrict __name, int __af,
187 struct hostent *__restrict __result_buf,
188 char *__restrict __buf, size_t __buflen,
189 struct hostent **__restrict __result,
190 int *__restrict __h_errnop);
191 #endif /* misc */
194 /* Open network data base files and mark them as staying open even
195 after a later search if STAY_OPEN is non-zero.
197 This function is a possible cancellation point and therefore not
198 marked with __THROW. */
199 extern void setnetent (int __stay_open);
201 /* Close network data base files and clear `stay open' flag.
203 This function is a possible cancellation point and therefore not
204 marked with __THROW. */
205 extern void endnetent (void);
207 /* Get next entry from network data base file. Open data base if
208 necessary.
210 This function is a possible cancellation point and therefore not
211 marked with __THROW. */
212 extern struct netent *getnetent (void);
214 /* Return entry from network data base which address match NET and
215 type TYPE.
217 This function is a possible cancellation point and therefore not
218 marked with __THROW. */
219 extern struct netent *getnetbyaddr (uint32_t __net, int __type);
221 /* Return entry from network data base for network with NAME.
223 This function is a possible cancellation point and therefore not
224 marked with __THROW. */
225 extern struct netent *getnetbyname (const char *__name);
227 #ifdef __USE_MISC
228 /* Reentrant versions of the functions above. The additional
229 arguments specify a buffer of BUFLEN starting at BUF. The last
230 argument is a pointer to a variable which gets the value which
231 would be stored in the global variable `herrno' by the
232 non-reentrant functions.
234 These functions are not part of POSIX and therefore no official
235 cancellation point. But due to similarity with an POSIX interface
236 or due to the implementation they are cancellation points and
237 therefore not marked with __THROW. */
238 extern int getnetent_r (struct netent *__restrict __result_buf,
239 char *__restrict __buf, size_t __buflen,
240 struct netent **__restrict __result,
241 int *__restrict __h_errnop);
243 extern int getnetbyaddr_r (uint32_t __net, int __type,
244 struct netent *__restrict __result_buf,
245 char *__restrict __buf, size_t __buflen,
246 struct netent **__restrict __result,
247 int *__restrict __h_errnop);
249 extern int getnetbyname_r (const char *__restrict __name,
250 struct netent *__restrict __result_buf,
251 char *__restrict __buf, size_t __buflen,
252 struct netent **__restrict __result,
253 int *__restrict __h_errnop);
254 #endif /* misc */
257 /* Description of data base entry for a single service. */
258 struct servent
260 char *s_name; /* Official service name. */
261 char **s_aliases; /* Alias list. */
262 int s_port; /* Port number. */
263 char *s_proto; /* Protocol to use. */
266 /* Open service data base files and mark them as staying open even
267 after a later search if STAY_OPEN is non-zero.
269 This function is a possible cancellation point and therefore not
270 marked with __THROW. */
271 extern void setservent (int __stay_open);
273 /* Close service data base files and clear `stay open' flag.
275 This function is a possible cancellation point and therefore not
276 marked with __THROW. */
277 extern void endservent (void);
279 /* Get next entry from service data base file. Open data base if
280 necessary.
282 This function is a possible cancellation point and therefore not
283 marked with __THROW. */
284 extern struct servent *getservent (void);
286 /* Return entry from network data base for network with NAME and
287 protocol PROTO.
289 This function is a possible cancellation point and therefore not
290 marked with __THROW. */
291 extern struct servent *getservbyname (const char *__name, const char *__proto);
293 /* Return entry from service data base which matches port PORT and
294 protocol PROTO.
296 This function is a possible cancellation point and therefore not
297 marked with __THROW. */
298 extern struct servent *getservbyport (int __port, const char *__proto);
301 #ifdef __USE_MISC
302 /* Reentrant versions of the functions above. The additional
303 arguments specify a buffer of BUFLEN starting at BUF.
305 These functions are not part of POSIX and therefore no official
306 cancellation point. But due to similarity with an POSIX interface
307 or due to the implementation they are cancellation points and
308 therefore not marked with __THROW. */
309 extern int getservent_r (struct servent *__restrict __result_buf,
310 char *__restrict __buf, size_t __buflen,
311 struct servent **__restrict __result);
313 extern int getservbyname_r (const char *__restrict __name,
314 const char *__restrict __proto,
315 struct servent *__restrict __result_buf,
316 char *__restrict __buf, size_t __buflen,
317 struct servent **__restrict __result);
319 extern int getservbyport_r (int __port, const char *__restrict __proto,
320 struct servent *__restrict __result_buf,
321 char *__restrict __buf, size_t __buflen,
322 struct servent **__restrict __result);
323 #endif /* misc */
326 /* Description of data base entry for a single service. */
327 struct protoent
329 char *p_name; /* Official protocol name. */
330 char **p_aliases; /* Alias list. */
331 int p_proto; /* Protocol number. */
334 /* Open protocol data base files and mark them as staying open even
335 after a later search if STAY_OPEN is non-zero.
337 This function is a possible cancellation point and therefore not
338 marked with __THROW. */
339 extern void setprotoent (int __stay_open);
341 /* Close protocol data base files and clear `stay open' flag.
343 This function is a possible cancellation point and therefore not
344 marked with __THROW. */
345 extern void endprotoent (void);
347 /* Get next entry from protocol data base file. Open data base if
348 necessary.
350 This function is a possible cancellation point and therefore not
351 marked with __THROW. */
352 extern struct protoent *getprotoent (void);
354 /* Return entry from protocol data base for network with NAME.
356 This function is a possible cancellation point and therefore not
357 marked with __THROW. */
358 extern struct protoent *getprotobyname (const char *__name);
360 /* Return entry from protocol data base which number is PROTO.
362 This function is a possible cancellation point and therefore not
363 marked with __THROW. */
364 extern struct protoent *getprotobynumber (int __proto);
367 #ifdef __USE_MISC
368 /* Reentrant versions of the functions above. The additional
369 arguments specify a buffer of BUFLEN starting at BUF.
371 These functions are not part of POSIX and therefore no official
372 cancellation point. But due to similarity with an POSIX interface
373 or due to the implementation they are cancellation points and
374 therefore not marked with __THROW. */
375 extern int getprotoent_r (struct protoent *__restrict __result_buf,
376 char *__restrict __buf, size_t __buflen,
377 struct protoent **__restrict __result);
379 extern int getprotobyname_r (const char *__restrict __name,
380 struct protoent *__restrict __result_buf,
381 char *__restrict __buf, size_t __buflen,
382 struct protoent **__restrict __result);
384 extern int getprotobynumber_r (int __proto,
385 struct protoent *__restrict __result_buf,
386 char *__restrict __buf, size_t __buflen,
387 struct protoent **__restrict __result);
390 /* Establish network group NETGROUP for enumeration.
392 This function is not part of POSIX and therefore no official
393 cancellation point. But due to similarity with an POSIX interface
394 or due to the implementation it is a cancellation point and
395 therefore not marked with __THROW. */
396 extern int setnetgrent (const char *__netgroup);
398 /* Free all space allocated by previous `setnetgrent' call.
400 This function is not part of POSIX and therefore no official
401 cancellation point. But due to similarity with an POSIX interface
402 or due to the implementation it is a cancellation point and
403 therefore not marked with __THROW. */
404 extern void endnetgrent (void);
406 /* Get next member of netgroup established by last `setnetgrent' call
407 and return pointers to elements in HOSTP, USERP, and DOMAINP.
409 This function is not part of POSIX and therefore no official
410 cancellation point. But due to similarity with an POSIX interface
411 or due to the implementation it is a cancellation point and
412 therefore not marked with __THROW. */
413 extern int getnetgrent (char **__restrict __hostp,
414 char **__restrict __userp,
415 char **__restrict __domainp);
418 /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN).
420 This function is not part of POSIX and therefore no official
421 cancellation point. But due to similarity with an POSIX interface
422 or due to the implementation it is a cancellation point and
423 therefore not marked with __THROW. */
424 extern int innetgr (const char *__netgroup, const char *__host,
425 const char *__user, const char *__domain);
427 /* Reentrant version of `getnetgrent' where result is placed in BUFFER.
429 This function is not part of POSIX and therefore no official
430 cancellation point. But due to similarity with an POSIX interface
431 or due to the implementation it is a cancellation point and
432 therefore not marked with __THROW. */
433 extern int getnetgrent_r (char **__restrict __hostp,
434 char **__restrict __userp,
435 char **__restrict __domainp,
436 char *__restrict __buffer, size_t __buflen);
437 #endif /* misc */
440 #ifdef __USE_BSD
441 /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD.
442 The local user is LOCUSER, on the remote machine the command is
443 executed as REMUSER. In *FD2P the descriptor to the socket for the
444 connection is returned. The caller must have the right to use a
445 reserved port. When the function returns *AHOST contains the
446 official host name.
448 This function is not part of POSIX and therefore no official
449 cancellation point. But due to similarity with an POSIX interface
450 or due to the implementation it is a cancellation point and
451 therefore not marked with __THROW. */
452 extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
453 const char *__restrict __locuser,
454 const char *__restrict __remuser,
455 const char *__restrict __cmd, int *__restrict __fd2p);
457 /* This is the equivalent function where the protocol can be selected
458 and which therefore can be used for IPv6.
460 This function is not part of POSIX and therefore no official
461 cancellation point. But due to similarity with an POSIX interface
462 or due to the implementation it is a cancellation point and
463 therefore not marked with __THROW. */
464 extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
465 const char *__restrict __locuser,
466 const char *__restrict __remuser,
467 const char *__restrict __cmd, int *__restrict __fd2p,
468 sa_family_t __af);
470 /* Call `rexecd' at port RPORT on remote machine *AHOST to execute
471 CMD. The process runs at the remote machine using the ID of user
472 NAME whose cleartext password is PASSWD. In *FD2P the descriptor
473 to the socket for the connection is returned. When the function
474 returns *AHOST contains the official host name.
476 This function is not part of POSIX and therefore no official
477 cancellation point. But due to similarity with an POSIX interface
478 or due to the implementation it is a cancellation point and
479 therefore not marked with __THROW. */
480 extern int rexec (char **__restrict __ahost, int __rport,
481 const char *__restrict __name,
482 const char *__restrict __pass,
483 const char *__restrict __cmd, int *__restrict __fd2p);
485 /* This is the equivalent function where the protocol can be selected
486 and which therefore can be used for IPv6.
488 This function is not part of POSIX and therefore no official
489 cancellation point. But due to similarity with an POSIX interface
490 or due to the implementation it is a cancellation point and
491 therefore not marked with __THROW. */
492 extern int rexec_af (char **__restrict __ahost, int __rport,
493 const char *__restrict __name,
494 const char *__restrict __pass,
495 const char *__restrict __cmd, int *__restrict __fd2p,
496 sa_family_t __af);
498 /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER.
499 If SUSER is not zero the user tries to become superuser. Return 0 if
500 it is possible.
502 This function is not part of POSIX and therefore no official
503 cancellation point. But due to similarity with an POSIX interface
504 or due to the implementation it is a cancellation point and
505 therefore not marked with __THROW. */
506 extern int ruserok (const char *__rhost, int __suser,
507 const char *__remuser, const char *__locuser);
509 /* This is the equivalent function where the protocol can be selected
510 and which therefore can be used for IPv6.
512 This function is not part of POSIX and therefore no official
513 cancellation point. But due to similarity with an POSIX interface
514 or due to the implementation it is a cancellation point and
515 therefore not marked with __THROW. */
516 extern int ruserok_af (const char *__rhost, int __suser,
517 const char *__remuser, const char *__locuser,
518 sa_family_t __af);
520 /* Check whether user REMUSER on system indicated by IPv4 address
521 RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are
522 not supported. If SUSER is not zero the user tries to become
523 superuser. Return 0 if it is possible.
525 This function is not part of POSIX and therefore no official
526 cancellation point. But due to similarity with an POSIX interface
527 or due to the implementation it is a cancellation point and
528 therefore not marked with __THROW. */
529 extern int iruserok (uint32_t __raddr, int __suser,
530 const char *__remuser, const char *__locuser);
532 /* This is the equivalent function where the pfamiliy if the address
533 pointed to by RADDR is determined by the value of AF. It therefore
534 can be used for IPv6
536 This function is not part of POSIX and therefore no official
537 cancellation point. But due to similarity with an POSIX interface
538 or due to the implementation it is a cancellation point and
539 therefore not marked with __THROW. */
540 extern int iruserok_af (const void *__raddr, int __suser,
541 const char *__remuser, const char *__locuser,
542 sa_family_t __af);
544 /* Try to allocate reserved port, returning a descriptor for a socket opened
545 at this port or -1 if unsuccessful. The search for an available port
546 will start at ALPORT and continues with lower numbers.
548 This function is not part of POSIX and therefore no official
549 cancellation point. But due to similarity with an POSIX interface
550 or due to the implementation it is a cancellation point and
551 therefore not marked with __THROW. */
552 extern int rresvport (int *__alport);
554 /* This is the equivalent function where the protocol can be selected
555 and which therefore can be used for IPv6.
557 This function is not part of POSIX and therefore no official
558 cancellation point. But due to similarity with an POSIX interface
559 or due to the implementation it is a cancellation point and
560 therefore not marked with __THROW. */
561 extern int rresvport_af (int *__alport, sa_family_t __af);
562 #endif
565 /* Extension from POSIX.1g. */
566 #ifdef __USE_POSIX
567 /* Structure to contain information about address of a service provider. */
568 struct addrinfo
570 int ai_flags; /* Input flags. */
571 int ai_family; /* Protocol family for socket. */
572 int ai_socktype; /* Socket type. */
573 int ai_protocol; /* Protocol for socket. */
574 socklen_t ai_addrlen; /* Length of socket address. */
575 struct sockaddr *ai_addr; /* Socket address for socket. */
576 char *ai_canonname; /* Canonical name for service location. */
577 struct addrinfo *ai_next; /* Pointer to next in list. */
580 # ifdef __USE_GNU
581 /* Structure used as control block for asynchronous lookup. */
582 struct gaicb
584 const char *ar_name; /* Name to look up. */
585 const char *ar_service; /* Service name. */
586 const struct addrinfo *ar_request; /* Additional request specification. */
587 struct addrinfo *ar_result; /* Pointer to result. */
588 /* The following are internal elements. */
589 int __return;
590 int __unused[5];
593 /* Lookup mode. */
594 # define GAI_WAIT 0
595 # define GAI_NOWAIT 1
596 # endif
598 /* Possible values for `ai_flags' field in `addrinfo' structure. */
599 # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
600 # define AI_CANONNAME 0x0002 /* Request for canonical name. */
601 # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
602 # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
603 # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
604 # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
605 returned address type.. */
606 # ifdef __USE_GNU
607 # define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded
608 in the current locale's character set)
609 before looking it up. */
610 # define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
611 # define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode
612 code points. */
613 # define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to
614 STD3 rules. */
615 # endif
616 # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
618 /* Error values for `getaddrinfo' function. */
619 # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
620 # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
621 # define EAI_AGAIN -3 /* Temporary failure in name resolution. */
622 # define EAI_FAIL -4 /* Non-recoverable failure in name res. */
623 # define EAI_FAMILY -6 /* `ai_family' not supported. */
624 # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
625 # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
626 # define EAI_MEMORY -10 /* Memory allocation failure. */
627 # define EAI_SYSTEM -11 /* System error returned in `errno'. */
628 # define EAI_OVERFLOW -12 /* Argument buffer overflow. */
629 # ifdef __USE_GNU
630 # define EAI_NODATA -5 /* No address associated with NAME. */
631 # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
632 # define EAI_INPROGRESS -100 /* Processing request in progress. */
633 # define EAI_CANCELED -101 /* Request canceled. */
634 # define EAI_NOTCANCELED -102 /* Request not canceled. */
635 # define EAI_ALLDONE -103 /* All requests done. */
636 # define EAI_INTR -104 /* Interrupted by a signal. */
637 # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
638 # endif
640 # ifdef __USE_MISC
641 # define NI_MAXHOST 1025
642 # define NI_MAXSERV 32
643 # endif
645 # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
646 # define NI_NUMERICSERV 2 /* Don't convert port number to name. */
647 # define NI_NOFQDN 4 /* Only return nodename portion. */
648 # define NI_NAMEREQD 8 /* Don't return numeric addresses. */
649 # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
650 # ifdef __USE_GNU
651 # define NI_IDN 32 /* Convert name from IDN format. */
652 # define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode
653 code points. */
654 # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to
655 STD3 rules. */
656 # endif
658 /* Translate name of a service location and/or a service name to set of
659 socket addresses.
661 This function is a possible cancellation point and therefore not
662 marked with __THROW. */
663 extern int getaddrinfo (const char *__restrict __name,
664 const char *__restrict __service,
665 const struct addrinfo *__restrict __req,
666 struct addrinfo **__restrict __pai);
668 /* Free `addrinfo' structure AI including associated storage. */
669 extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
671 /* Convert error return from getaddrinfo() to a string. */
672 extern const char *gai_strerror (int __ecode) __THROW;
674 /* Translate a socket address to a location and service name.
676 This function is a possible cancellation point and therefore not
677 marked with __THROW. */
678 extern int getnameinfo (const struct sockaddr *__restrict __sa,
679 socklen_t __salen, char *__restrict __host,
680 socklen_t __hostlen, char *__restrict __serv,
681 socklen_t __servlen, int __flags);
682 #endif /* POSIX */
684 #ifdef __USE_GNU
685 /* Enqueue ENT requests from the LIST. If MODE is GAI_WAIT wait until all
686 requests are handled. If WAIT is GAI_NOWAIT return immediately after
687 queueing the requests and signal completion according to SIG.
689 This function is not part of POSIX and therefore no official
690 cancellation point. But due to similarity with an POSIX interface
691 or due to the implementation it is a cancellation point and
692 therefore not marked with __THROW. */
693 extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
694 int __ent, struct sigevent *__restrict __sig);
696 /* Suspend execution of the thread until at least one of the ENT requests
697 in LIST is handled. If TIMEOUT is not a null pointer it specifies the
698 longest time the function keeps waiting before returning with an error.
700 This function is not part of POSIX and therefore no official
701 cancellation point. But due to similarity with an POSIX interface
702 or due to the implementation it is a cancellation point and
703 therefore not marked with __THROW. */
704 extern int gai_suspend (const struct gaicb *const __list[], int __ent,
705 const struct timespec *__timeout);
707 /* Get the error status of the request REQ. */
708 extern int gai_error (struct gaicb *__req) __THROW;
710 /* Cancel the requests associated with GAICBP. */
711 extern int gai_cancel (struct gaicb *__gaicbp) __THROW;
712 #endif /* GNU */
714 __END_DECLS
716 #endif /* netdb.h */