Fix spurious "inexact" exceptions from __kernel_standard_l (bug 18245, bug 18583).
[glibc.git] / resolv / netdb.h
blob44cf6923b2e9d6fef70070d83c05a72785a1d7c6
1 /* Copyright (C) 1996-2015 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, see
16 <http://www.gnu.org/licenses/>. */
18 /* All data returned by the network data base library are supplied in
19 host order and returned in network order (suitable for use in
20 system calls). */
22 #ifndef _NETDB_H
23 #define _NETDB_H 1
25 #include <features.h>
27 #include <netinet/in.h>
28 #include <stdint.h>
29 #ifdef __USE_MISC
30 /* This is necessary to make this include file properly replace the
31 Sun version. */
32 # include <rpc/netdb.h>
33 #endif
35 #ifdef __USE_GNU
36 # define __need_sigevent_t
37 # include <bits/siginfo.h>
38 # define __need_timespec
39 # include <time.h>
40 #endif
42 #include <bits/netdb.h>
44 /* Absolute file name for network data base files. */
45 #define _PATH_HEQUIV "/etc/hosts.equiv"
46 #define _PATH_HOSTS "/etc/hosts"
47 #define _PATH_NETWORKS "/etc/networks"
48 #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf"
49 #define _PATH_PROTOCOLS "/etc/protocols"
50 #define _PATH_SERVICES "/etc/services"
53 __BEGIN_DECLS
55 #if defined __USE_MISC || !defined __USE_XOPEN2K8
56 /* Error status for non-reentrant lookup functions.
57 We use a macro to access always the thread-specific `h_errno' variable. */
58 # define h_errno (*__h_errno_location ())
60 /* Function to get address of global `h_errno' variable. */
61 extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
64 /* Possible values left in `h_errno'. */
65 # define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
66 # define TRY_AGAIN 2 /* Non-Authoritative Host not found,
67 or SERVERFAIL. */
68 # define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED,
69 NOTIMP. */
70 # define NO_DATA 4 /* Valid name, no data record of requested
71 type. */
72 #endif
73 #ifdef __USE_MISC
74 # define NETDB_INTERNAL -1 /* See errno. */
75 # define NETDB_SUCCESS 0 /* No problem. */
76 # define NO_ADDRESS NO_DATA /* No address, look for MX record. */
77 #endif
79 #if defined __USE_XOPEN2K || defined __USE_XOPEN_EXTENDED
80 /* Highest reserved Internet port number. */
81 # define IPPORT_RESERVED 1024
82 #endif
84 #ifdef __USE_GNU
85 /* Scope delimiter for getaddrinfo(), getnameinfo(). */
86 # define SCOPE_DELIMITER '%'
87 #endif
89 #ifdef __USE_MISC
90 /* Print error indicated by `h_errno' variable on standard error. STR
91 if non-null is printed before the error string. */
92 extern void herror (const char *__str) __THROW;
94 /* Return string associated with error ERR_NUM. */
95 extern const char *hstrerror (int __err_num) __THROW;
96 #endif
99 /* Description of data base entry for a single host. */
100 struct hostent
102 char *h_name; /* Official name of host. */
103 char **h_aliases; /* Alias list. */
104 int h_addrtype; /* Host address type. */
105 int h_length; /* Length of address. */
106 char **h_addr_list; /* List of addresses from name server. */
107 #ifdef __USE_MISC
108 # define h_addr h_addr_list[0] /* Address, for backward compatibility.*/
109 #endif
112 /* Open host data base files and mark them as staying open even after
113 a later search if STAY_OPEN is non-zero.
115 This function is a possible cancellation point and therefore not
116 marked with __THROW. */
117 extern void sethostent (int __stay_open);
119 /* Close host data base files and clear `stay open' flag.
121 This function is a possible cancellation point and therefore not
122 marked with __THROW. */
123 extern void endhostent (void);
125 /* Get next entry from host data base file. Open data base if
126 necessary.
128 This function is a possible cancellation point and therefore not
129 marked with __THROW. */
130 extern struct hostent *gethostent (void);
132 /* Return entry from host data base which address match ADDR with
133 length LEN and type TYPE.
135 This function is a possible cancellation point and therefore not
136 marked with __THROW. */
137 extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len,
138 int __type);
140 /* Return entry from host data base for host with NAME.
142 This function is a possible cancellation point and therefore not
143 marked with __THROW. */
144 extern struct hostent *gethostbyname (const char *__name);
146 #ifdef __USE_MISC
147 /* Return entry from host data base for host with NAME. AF must be
148 set to the address type which is `AF_INET' for IPv4 or `AF_INET6'
149 for IPv6.
151 This function is not part of POSIX and therefore no official
152 cancellation point. But due to similarity with an POSIX interface
153 or due to the implementation it is a cancellation point and
154 therefore not marked with __THROW. */
155 extern struct hostent *gethostbyname2 (const char *__name, int __af);
157 /* Reentrant versions of the functions above. The additional
158 arguments specify a buffer of BUFLEN starting at BUF. The last
159 argument is a pointer to a variable which gets the value which
160 would be stored in the global variable `herrno' by the
161 non-reentrant functions.
163 These functions are not part of POSIX and therefore no official
164 cancellation point. But due to similarity with an POSIX interface
165 or due to the implementation they are cancellation points and
166 therefore not marked with __THROW. */
167 extern int gethostent_r (struct hostent *__restrict __result_buf,
168 char *__restrict __buf, size_t __buflen,
169 struct hostent **__restrict __result,
170 int *__restrict __h_errnop);
172 extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len,
173 int __type,
174 struct hostent *__restrict __result_buf,
175 char *__restrict __buf, size_t __buflen,
176 struct hostent **__restrict __result,
177 int *__restrict __h_errnop);
179 extern int gethostbyname_r (const char *__restrict __name,
180 struct hostent *__restrict __result_buf,
181 char *__restrict __buf, size_t __buflen,
182 struct hostent **__restrict __result,
183 int *__restrict __h_errnop);
185 extern int gethostbyname2_r (const char *__restrict __name, int __af,
186 struct hostent *__restrict __result_buf,
187 char *__restrict __buf, size_t __buflen,
188 struct hostent **__restrict __result,
189 int *__restrict __h_errnop);
190 #endif /* misc */
193 /* Open network data base files and mark them as staying open even
194 after a later search if STAY_OPEN is non-zero.
196 This function is a possible cancellation point and therefore not
197 marked with __THROW. */
198 extern void setnetent (int __stay_open);
200 /* Close network data base files and clear `stay open' flag.
202 This function is a possible cancellation point and therefore not
203 marked with __THROW. */
204 extern void endnetent (void);
206 /* Get next entry from network data base file. Open data base if
207 necessary.
209 This function is a possible cancellation point and therefore not
210 marked with __THROW. */
211 extern struct netent *getnetent (void);
213 /* Return entry from network data base which address match NET and
214 type TYPE.
216 This function is a possible cancellation point and therefore not
217 marked with __THROW. */
218 extern struct netent *getnetbyaddr (uint32_t __net, int __type);
220 /* Return entry from network data base for network with NAME.
222 This function is a possible cancellation point and therefore not
223 marked with __THROW. */
224 extern struct netent *getnetbyname (const char *__name);
226 #ifdef __USE_MISC
227 /* Reentrant versions of the functions above. The additional
228 arguments specify a buffer of BUFLEN starting at BUF. The last
229 argument is a pointer to a variable which gets the value which
230 would be stored in the global variable `herrno' by the
231 non-reentrant functions.
233 These functions are not part of POSIX and therefore no official
234 cancellation point. But due to similarity with an POSIX interface
235 or due to the implementation they are cancellation points and
236 therefore not marked with __THROW. */
237 extern int getnetent_r (struct netent *__restrict __result_buf,
238 char *__restrict __buf, size_t __buflen,
239 struct netent **__restrict __result,
240 int *__restrict __h_errnop);
242 extern int getnetbyaddr_r (uint32_t __net, int __type,
243 struct netent *__restrict __result_buf,
244 char *__restrict __buf, size_t __buflen,
245 struct netent **__restrict __result,
246 int *__restrict __h_errnop);
248 extern int getnetbyname_r (const char *__restrict __name,
249 struct netent *__restrict __result_buf,
250 char *__restrict __buf, size_t __buflen,
251 struct netent **__restrict __result,
252 int *__restrict __h_errnop);
253 #endif /* misc */
256 /* Description of data base entry for a single service. */
257 struct servent
259 char *s_name; /* Official service name. */
260 char **s_aliases; /* Alias list. */
261 int s_port; /* Port number. */
262 char *s_proto; /* Protocol to use. */
265 /* Open service data base files and mark them as staying open even
266 after a later search if STAY_OPEN is non-zero.
268 This function is a possible cancellation point and therefore not
269 marked with __THROW. */
270 extern void setservent (int __stay_open);
272 /* Close service data base files and clear `stay open' flag.
274 This function is a possible cancellation point and therefore not
275 marked with __THROW. */
276 extern void endservent (void);
278 /* Get next entry from service data base file. Open data base if
279 necessary.
281 This function is a possible cancellation point and therefore not
282 marked with __THROW. */
283 extern struct servent *getservent (void);
285 /* Return entry from network data base for network with NAME and
286 protocol PROTO.
288 This function is a possible cancellation point and therefore not
289 marked with __THROW. */
290 extern struct servent *getservbyname (const char *__name, const char *__proto);
292 /* Return entry from service data base which matches port PORT and
293 protocol PROTO.
295 This function is a possible cancellation point and therefore not
296 marked with __THROW. */
297 extern struct servent *getservbyport (int __port, const char *__proto);
300 #ifdef __USE_MISC
301 /* Reentrant versions of the functions above. The additional
302 arguments specify a buffer of BUFLEN starting at BUF.
304 These functions are not part of POSIX and therefore no official
305 cancellation point. But due to similarity with an POSIX interface
306 or due to the implementation they are cancellation points and
307 therefore not marked with __THROW. */
308 extern int getservent_r (struct servent *__restrict __result_buf,
309 char *__restrict __buf, size_t __buflen,
310 struct servent **__restrict __result);
312 extern int getservbyname_r (const char *__restrict __name,
313 const char *__restrict __proto,
314 struct servent *__restrict __result_buf,
315 char *__restrict __buf, size_t __buflen,
316 struct servent **__restrict __result);
318 extern int getservbyport_r (int __port, const char *__restrict __proto,
319 struct servent *__restrict __result_buf,
320 char *__restrict __buf, size_t __buflen,
321 struct servent **__restrict __result);
322 #endif /* misc */
325 /* Description of data base entry for a single service. */
326 struct protoent
328 char *p_name; /* Official protocol name. */
329 char **p_aliases; /* Alias list. */
330 int p_proto; /* Protocol number. */
333 /* Open protocol data base files and mark them as staying open even
334 after a later search if STAY_OPEN is non-zero.
336 This function is a possible cancellation point and therefore not
337 marked with __THROW. */
338 extern void setprotoent (int __stay_open);
340 /* Close protocol data base files and clear `stay open' flag.
342 This function is a possible cancellation point and therefore not
343 marked with __THROW. */
344 extern void endprotoent (void);
346 /* Get next entry from protocol data base file. Open data base if
347 necessary.
349 This function is a possible cancellation point and therefore not
350 marked with __THROW. */
351 extern struct protoent *getprotoent (void);
353 /* Return entry from protocol data base for network with NAME.
355 This function is a possible cancellation point and therefore not
356 marked with __THROW. */
357 extern struct protoent *getprotobyname (const char *__name);
359 /* Return entry from protocol data base which number is PROTO.
361 This function is a possible cancellation point and therefore not
362 marked with __THROW. */
363 extern struct protoent *getprotobynumber (int __proto);
366 #ifdef __USE_MISC
367 /* Reentrant versions of the functions above. The additional
368 arguments specify a buffer of BUFLEN starting at BUF.
370 These functions are not part of POSIX and therefore no official
371 cancellation point. But due to similarity with an POSIX interface
372 or due to the implementation they are cancellation points and
373 therefore not marked with __THROW. */
374 extern int getprotoent_r (struct protoent *__restrict __result_buf,
375 char *__restrict __buf, size_t __buflen,
376 struct protoent **__restrict __result);
378 extern int getprotobyname_r (const char *__restrict __name,
379 struct protoent *__restrict __result_buf,
380 char *__restrict __buf, size_t __buflen,
381 struct protoent **__restrict __result);
383 extern int getprotobynumber_r (int __proto,
384 struct protoent *__restrict __result_buf,
385 char *__restrict __buf, size_t __buflen,
386 struct protoent **__restrict __result);
389 /* Establish network group NETGROUP for enumeration.
391 This function is not part of POSIX and therefore no official
392 cancellation point. But due to similarity with an POSIX interface
393 or due to the implementation it is a cancellation point and
394 therefore not marked with __THROW. */
395 extern int setnetgrent (const char *__netgroup);
397 /* Free all space allocated by previous `setnetgrent' call.
399 This function is not part of POSIX and therefore no official
400 cancellation point. But due to similarity with an POSIX interface
401 or due to the implementation it is a cancellation point and
402 therefore not marked with __THROW. */
403 extern void endnetgrent (void);
405 /* Get next member of netgroup established by last `setnetgrent' call
406 and return pointers to elements in HOSTP, USERP, and DOMAINP.
408 This function is not part of POSIX and therefore no official
409 cancellation point. But due to similarity with an POSIX interface
410 or due to the implementation it is a cancellation point and
411 therefore not marked with __THROW. */
412 extern int getnetgrent (char **__restrict __hostp,
413 char **__restrict __userp,
414 char **__restrict __domainp);
417 /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN).
419 This function is not part of POSIX and therefore no official
420 cancellation point. But due to similarity with an POSIX interface
421 or due to the implementation it is a cancellation point and
422 therefore not marked with __THROW. */
423 extern int innetgr (const char *__netgroup, const char *__host,
424 const char *__user, const char *__domain);
426 /* Reentrant version of `getnetgrent' where result is placed in BUFFER.
428 This function is not part of POSIX and therefore no official
429 cancellation point. But due to similarity with an POSIX interface
430 or due to the implementation it is a cancellation point and
431 therefore not marked with __THROW. */
432 extern int getnetgrent_r (char **__restrict __hostp,
433 char **__restrict __userp,
434 char **__restrict __domainp,
435 char *__restrict __buffer, size_t __buflen);
436 #endif /* misc */
439 #ifdef __USE_MISC
440 /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD.
441 The local user is LOCUSER, on the remote machine the command is
442 executed as REMUSER. In *FD2P the descriptor to the socket for the
443 connection is returned. The caller must have the right to use a
444 reserved port. When the function returns *AHOST contains the
445 official host name.
447 This function is not part of POSIX and therefore no official
448 cancellation point. But due to similarity with an POSIX interface
449 or due to the implementation it is a cancellation point and
450 therefore not marked with __THROW. */
451 extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
452 const char *__restrict __locuser,
453 const char *__restrict __remuser,
454 const char *__restrict __cmd, int *__restrict __fd2p);
456 /* This is the equivalent function where the protocol can be selected
457 and which therefore can be used for IPv6.
459 This function is not part of POSIX and therefore no official
460 cancellation point. But due to similarity with an POSIX interface
461 or due to the implementation it is a cancellation point and
462 therefore not marked with __THROW. */
463 extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
464 const char *__restrict __locuser,
465 const char *__restrict __remuser,
466 const char *__restrict __cmd, int *__restrict __fd2p,
467 sa_family_t __af);
469 /* Call `rexecd' at port RPORT on remote machine *AHOST to execute
470 CMD. The process runs at the remote machine using the ID of user
471 NAME whose cleartext password is PASSWD. In *FD2P the descriptor
472 to the socket for the connection is returned. When the function
473 returns *AHOST contains the official host name.
475 This function is not part of POSIX and therefore no official
476 cancellation point. But due to similarity with an POSIX interface
477 or due to the implementation it is a cancellation point and
478 therefore not marked with __THROW. */
479 extern int rexec (char **__restrict __ahost, int __rport,
480 const char *__restrict __name,
481 const char *__restrict __pass,
482 const char *__restrict __cmd, int *__restrict __fd2p);
484 /* This is the equivalent function where the protocol can be selected
485 and which therefore can be used for IPv6.
487 This function is not part of POSIX and therefore no official
488 cancellation point. But due to similarity with an POSIX interface
489 or due to the implementation it is a cancellation point and
490 therefore not marked with __THROW. */
491 extern int rexec_af (char **__restrict __ahost, int __rport,
492 const char *__restrict __name,
493 const char *__restrict __pass,
494 const char *__restrict __cmd, int *__restrict __fd2p,
495 sa_family_t __af);
497 /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER.
498 If SUSER is not zero the user tries to become superuser. Return 0 if
499 it is possible.
501 This function is not part of POSIX and therefore no official
502 cancellation point. But due to similarity with an POSIX interface
503 or due to the implementation it is a cancellation point and
504 therefore not marked with __THROW. */
505 extern int ruserok (const char *__rhost, int __suser,
506 const char *__remuser, const char *__locuser);
508 /* This is the equivalent function where the protocol can be selected
509 and which therefore can be used for IPv6.
511 This function is not part of POSIX and therefore no official
512 cancellation point. But due to similarity with an POSIX interface
513 or due to the implementation it is a cancellation point and
514 therefore not marked with __THROW. */
515 extern int ruserok_af (const char *__rhost, int __suser,
516 const char *__remuser, const char *__locuser,
517 sa_family_t __af);
519 /* Check whether user REMUSER on system indicated by IPv4 address
520 RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are
521 not supported. If SUSER is not zero the user tries to become
522 superuser. Return 0 if it is possible.
524 This function is not part of POSIX and therefore no official
525 cancellation point. But due to similarity with an POSIX interface
526 or due to the implementation it is a cancellation point and
527 therefore not marked with __THROW. */
528 extern int iruserok (uint32_t __raddr, int __suser,
529 const char *__remuser, const char *__locuser);
531 /* This is the equivalent function where the pfamiliy if the address
532 pointed to by RADDR is determined by the value of AF. It therefore
533 can be used for IPv6
535 This function is not part of POSIX and therefore no official
536 cancellation point. But due to similarity with an POSIX interface
537 or due to the implementation it is a cancellation point and
538 therefore not marked with __THROW. */
539 extern int iruserok_af (const void *__raddr, int __suser,
540 const char *__remuser, const char *__locuser,
541 sa_family_t __af);
543 /* Try to allocate reserved port, returning a descriptor for a socket opened
544 at this port or -1 if unsuccessful. The search for an available port
545 will start at ALPORT and continues with lower numbers.
547 This function is not part of POSIX and therefore no official
548 cancellation point. But due to similarity with an POSIX interface
549 or due to the implementation it is a cancellation point and
550 therefore not marked with __THROW. */
551 extern int rresvport (int *__alport);
553 /* This is the equivalent function where the protocol can be selected
554 and which therefore can be used for IPv6.
556 This function is not part of POSIX and therefore no official
557 cancellation point. But due to similarity with an POSIX interface
558 or due to the implementation it is a cancellation point and
559 therefore not marked with __THROW. */
560 extern int rresvport_af (int *__alport, sa_family_t __af);
561 #endif
564 /* Extension from POSIX.1:2001. */
565 #ifdef __USE_XOPEN2K
566 /* Structure to contain information about address of a service provider. */
567 struct addrinfo
569 int ai_flags; /* Input flags. */
570 int ai_family; /* Protocol family for socket. */
571 int ai_socktype; /* Socket type. */
572 int ai_protocol; /* Protocol for socket. */
573 socklen_t ai_addrlen; /* Length of socket address. */
574 struct sockaddr *ai_addr; /* Socket address for socket. */
575 char *ai_canonname; /* Canonical name for service location. */
576 struct addrinfo *ai_next; /* Pointer to next in list. */
579 # ifdef __USE_GNU
580 /* Structure used as control block for asynchronous lookup. */
581 struct gaicb
583 const char *ar_name; /* Name to look up. */
584 const char *ar_service; /* Service name. */
585 const struct addrinfo *ar_request; /* Additional request specification. */
586 struct addrinfo *ar_result; /* Pointer to result. */
587 /* The following are internal elements. */
588 int __return;
589 int __glibc_reserved[5];
592 /* Lookup mode. */
593 # define GAI_WAIT 0
594 # define GAI_NOWAIT 1
595 # endif
597 /* Possible values for `ai_flags' field in `addrinfo' structure. */
598 # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
599 # define AI_CANONNAME 0x0002 /* Request for canonical name. */
600 # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
601 # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
602 # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
603 # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
604 returned address type.. */
605 # ifdef __USE_GNU
606 # define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded
607 in the current locale's character set)
608 before looking it up. */
609 # define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
610 # define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode
611 code points. */
612 # define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to
613 STD3 rules. */
614 # endif
615 # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
617 /* Error values for `getaddrinfo' function. */
618 # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
619 # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
620 # define EAI_AGAIN -3 /* Temporary failure in name resolution. */
621 # define EAI_FAIL -4 /* Non-recoverable failure in name res. */
622 # define EAI_FAMILY -6 /* `ai_family' not supported. */
623 # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
624 # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
625 # define EAI_MEMORY -10 /* Memory allocation failure. */
626 # define EAI_SYSTEM -11 /* System error returned in `errno'. */
627 # define EAI_OVERFLOW -12 /* Argument buffer overflow. */
628 # ifdef __USE_GNU
629 # define EAI_NODATA -5 /* No address associated with NAME. */
630 # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
631 # define EAI_INPROGRESS -100 /* Processing request in progress. */
632 # define EAI_CANCELED -101 /* Request canceled. */
633 # define EAI_NOTCANCELED -102 /* Request not canceled. */
634 # define EAI_ALLDONE -103 /* All requests done. */
635 # define EAI_INTR -104 /* Interrupted by a signal. */
636 # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
637 # endif
639 # ifdef __USE_MISC
640 # define NI_MAXHOST 1025
641 # define NI_MAXSERV 32
642 # endif
644 # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
645 # define NI_NUMERICSERV 2 /* Don't convert port number to name. */
646 # define NI_NOFQDN 4 /* Only return nodename portion. */
647 # define NI_NAMEREQD 8 /* Don't return numeric addresses. */
648 # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
649 # ifdef __USE_GNU
650 # define NI_IDN 32 /* Convert name from IDN format. */
651 # define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode
652 code points. */
653 # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to
654 STD3 rules. */
655 # endif
657 /* Translate name of a service location and/or a service name to set of
658 socket addresses.
660 This function is a possible cancellation point and therefore not
661 marked with __THROW. */
662 extern int getaddrinfo (const char *__restrict __name,
663 const char *__restrict __service,
664 const struct addrinfo *__restrict __req,
665 struct addrinfo **__restrict __pai);
667 /* Free `addrinfo' structure AI including associated storage. */
668 extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
670 /* Convert error return from getaddrinfo() to a string. */
671 extern const char *gai_strerror (int __ecode) __THROW;
673 /* Translate a socket address to a location and service name.
675 This function is a possible cancellation point and therefore not
676 marked with __THROW. */
677 extern int getnameinfo (const struct sockaddr *__restrict __sa,
678 socklen_t __salen, char *__restrict __host,
679 socklen_t __hostlen, char *__restrict __serv,
680 socklen_t __servlen, int __flags);
681 #endif /* POSIX */
683 #ifdef __USE_GNU
684 /* Enqueue ENT requests from the LIST. If MODE is GAI_WAIT wait until all
685 requests are handled. If WAIT is GAI_NOWAIT return immediately after
686 queueing the requests and signal completion according to SIG.
688 This function is not part of POSIX and therefore no official
689 cancellation point. But due to similarity with an POSIX interface
690 or due to the implementation it is a cancellation point and
691 therefore not marked with __THROW. */
692 extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
693 int __ent, struct sigevent *__restrict __sig);
695 /* Suspend execution of the thread until at least one of the ENT requests
696 in LIST is handled. If TIMEOUT is not a null pointer it specifies the
697 longest time the function keeps waiting before returning with an error.
699 This function is not part of POSIX and therefore no official
700 cancellation point. But due to similarity with an POSIX interface
701 or due to the implementation it is a cancellation point and
702 therefore not marked with __THROW. */
703 extern int gai_suspend (const struct gaicb *const __list[], int __ent,
704 const struct timespec *__timeout);
706 /* Get the error status of the request REQ. */
707 extern int gai_error (struct gaicb *__req) __THROW;
709 /* Cancel the requests associated with GAICBP. */
710 extern int gai_cancel (struct gaicb *__gaicbp) __THROW;
711 #endif /* GNU */
713 __END_DECLS
715 #endif /* netdb.h */