getdents64 fallback d_type support
[glibc.git] / resolv / netdb.h
blobe60dc4405b48849c5abefe48844c595aeb9b3681
1 /* Copyright (C) 1996-2004, 2009, 2010 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,
292 __const char *__proto);
294 /* Return entry from service data base which matches port PORT and
295 protocol PROTO.
297 This function is a possible cancellation point and therefore not
298 marked with __THROW. */
299 extern struct servent *getservbyport (int __port, __const char *__proto);
302 #ifdef __USE_MISC
303 /* Reentrant versions of the functions above. The additional
304 arguments specify a buffer of BUFLEN starting at BUF.
306 These functions are not part of POSIX and therefore no official
307 cancellation point. But due to similarity with an POSIX interface
308 or due to the implementation they are cancellation points and
309 therefore not marked with __THROW. */
310 extern int getservent_r (struct servent *__restrict __result_buf,
311 char *__restrict __buf, size_t __buflen,
312 struct servent **__restrict __result);
314 extern int getservbyname_r (__const char *__restrict __name,
315 __const char *__restrict __proto,
316 struct servent *__restrict __result_buf,
317 char *__restrict __buf, size_t __buflen,
318 struct servent **__restrict __result);
320 extern int getservbyport_r (int __port, __const char *__restrict __proto,
321 struct servent *__restrict __result_buf,
322 char *__restrict __buf, size_t __buflen,
323 struct servent **__restrict __result);
324 #endif /* misc */
327 /* Description of data base entry for a single service. */
328 struct protoent
330 char *p_name; /* Official protocol name. */
331 char **p_aliases; /* Alias list. */
332 int p_proto; /* Protocol number. */
335 /* Open protocol data base files and mark them as staying open even
336 after a later search if STAY_OPEN is non-zero.
338 This function is a possible cancellation point and therefore not
339 marked with __THROW. */
340 extern void setprotoent (int __stay_open);
342 /* Close protocol data base files and clear `stay open' flag.
344 This function is a possible cancellation point and therefore not
345 marked with __THROW. */
346 extern void endprotoent (void);
348 /* Get next entry from protocol data base file. Open data base if
349 necessary.
351 This function is a possible cancellation point and therefore not
352 marked with __THROW. */
353 extern struct protoent *getprotoent (void);
355 /* Return entry from protocol data base for network with NAME.
357 This function is a possible cancellation point and therefore not
358 marked with __THROW. */
359 extern struct protoent *getprotobyname (__const char *__name);
361 /* Return entry from protocol data base which number is PROTO.
363 This function is a possible cancellation point and therefore not
364 marked with __THROW. */
365 extern struct protoent *getprotobynumber (int __proto);
368 #ifdef __USE_MISC
369 /* Reentrant versions of the functions above. The additional
370 arguments specify a buffer of BUFLEN starting at BUF.
372 These functions are not part of POSIX and therefore no official
373 cancellation point. But due to similarity with an POSIX interface
374 or due to the implementation they are cancellation points and
375 therefore not marked with __THROW. */
376 extern int getprotoent_r (struct protoent *__restrict __result_buf,
377 char *__restrict __buf, size_t __buflen,
378 struct protoent **__restrict __result);
380 extern int getprotobyname_r (__const char *__restrict __name,
381 struct protoent *__restrict __result_buf,
382 char *__restrict __buf, size_t __buflen,
383 struct protoent **__restrict __result);
385 extern int getprotobynumber_r (int __proto,
386 struct protoent *__restrict __result_buf,
387 char *__restrict __buf, size_t __buflen,
388 struct protoent **__restrict __result);
391 /* Establish network group NETGROUP for enumeration.
393 This function is not part of POSIX and therefore no official
394 cancellation point. But due to similarity with an POSIX interface
395 or due to the implementation it is a cancellation point and
396 therefore not marked with __THROW. */
397 extern int setnetgrent (__const char *__netgroup);
399 /* Free all space allocated by previous `setnetgrent' call.
401 This function is not part of POSIX and therefore no official
402 cancellation point. But due to similarity with an POSIX interface
403 or due to the implementation it is a cancellation point and
404 therefore not marked with __THROW. */
405 extern void endnetgrent (void);
407 /* Get next member of netgroup established by last `setnetgrent' call
408 and return pointers to elements in HOSTP, USERP, and DOMAINP.
410 This function is not part of POSIX and therefore no official
411 cancellation point. But due to similarity with an POSIX interface
412 or due to the implementation it is a cancellation point and
413 therefore not marked with __THROW. */
414 extern int getnetgrent (char **__restrict __hostp,
415 char **__restrict __userp,
416 char **__restrict __domainp);
419 /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN).
421 This function is not part of POSIX and therefore no official
422 cancellation point. But due to similarity with an POSIX interface
423 or due to the implementation it is a cancellation point and
424 therefore not marked with __THROW. */
425 extern int innetgr (__const char *__netgroup, __const char *__host,
426 __const char *__user, __const char *__domain);
428 /* Reentrant version of `getnetgrent' where result is placed in BUFFER.
430 This function is not part of POSIX and therefore no official
431 cancellation point. But due to similarity with an POSIX interface
432 or due to the implementation it is a cancellation point and
433 therefore not marked with __THROW. */
434 extern int getnetgrent_r (char **__restrict __hostp,
435 char **__restrict __userp,
436 char **__restrict __domainp,
437 char *__restrict __buffer, size_t __buflen);
438 #endif /* misc */
441 #ifdef __USE_BSD
442 /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD.
443 The local user is LOCUSER, on the remote machine the command is
444 executed as REMUSER. In *FD2P the descriptor to the socket for the
445 connection is returned. The caller must have the right to use a
446 reserved port. When the function returns *AHOST contains the
447 official host name.
449 This function is not part of POSIX and therefore no official
450 cancellation point. But due to similarity with an POSIX interface
451 or due to the implementation it is a cancellation point and
452 therefore not marked with __THROW. */
453 extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
454 __const char *__restrict __locuser,
455 __const char *__restrict __remuser,
456 __const char *__restrict __cmd, int *__restrict __fd2p);
458 /* This is the equivalent function where the protocol can be selected
459 and which therefore can be used for IPv6.
461 This function is not part of POSIX and therefore no official
462 cancellation point. But due to similarity with an POSIX interface
463 or due to the implementation it is a cancellation point and
464 therefore not marked with __THROW. */
465 extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
466 __const char *__restrict __locuser,
467 __const char *__restrict __remuser,
468 __const char *__restrict __cmd, int *__restrict __fd2p,
469 sa_family_t __af);
471 /* Call `rexecd' at port RPORT on remote machine *AHOST to execute
472 CMD. The process runs at the remote machine using the ID of user
473 NAME whose cleartext password is PASSWD. In *FD2P the descriptor
474 to the socket for the connection is returned. When the function
475 returns *AHOST contains the official host name.
477 This function is not part of POSIX and therefore no official
478 cancellation point. But due to similarity with an POSIX interface
479 or due to the implementation it is a cancellation point and
480 therefore not marked with __THROW. */
481 extern int rexec (char **__restrict __ahost, int __rport,
482 __const char *__restrict __name,
483 __const char *__restrict __pass,
484 __const char *__restrict __cmd, int *__restrict __fd2p);
486 /* This is the equivalent function where the protocol can be selected
487 and which therefore can be used for IPv6.
489 This function is not part of POSIX and therefore no official
490 cancellation point. But due to similarity with an POSIX interface
491 or due to the implementation it is a cancellation point and
492 therefore not marked with __THROW. */
493 extern int rexec_af (char **__restrict __ahost, int __rport,
494 __const char *__restrict __name,
495 __const char *__restrict __pass,
496 __const char *__restrict __cmd, int *__restrict __fd2p,
497 sa_family_t __af);
499 /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER.
500 If SUSER is not zero the user tries to become superuser. Return 0 if
501 it is possible.
503 This function is not part of POSIX and therefore no official
504 cancellation point. But due to similarity with an POSIX interface
505 or due to the implementation it is a cancellation point and
506 therefore not marked with __THROW. */
507 extern int ruserok (__const char *__rhost, int __suser,
508 __const char *__remuser, __const char *__locuser);
510 /* This is the equivalent function where the protocol can be selected
511 and which therefore can be used for IPv6.
513 This function is not part of POSIX and therefore no official
514 cancellation point. But due to similarity with an POSIX interface
515 or due to the implementation it is a cancellation point and
516 therefore not marked with __THROW. */
517 extern int ruserok_af (__const char *__rhost, int __suser,
518 __const char *__remuser, __const char *__locuser,
519 sa_family_t __af);
521 /* Check whether user REMUSER on system indicated by IPv4 address
522 RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are
523 not supported. If SUSER is not zero the user tries to become
524 superuser. Return 0 if it is possible.
526 This function is not part of POSIX and therefore no official
527 cancellation point. But due to similarity with an POSIX interface
528 or due to the implementation it is a cancellation point and
529 therefore not marked with __THROW. */
530 extern int iruserok (uint32_t __raddr, int __suser,
531 __const char *__remuser, __const char *__locuser);
533 /* This is the equivalent function where the pfamiliy if the address
534 pointed to by RADDR is determined by the value of AF. It therefore
535 can be used for IPv6
537 This function is not part of POSIX and therefore no official
538 cancellation point. But due to similarity with an POSIX interface
539 or due to the implementation it is a cancellation point and
540 therefore not marked with __THROW. */
541 extern int iruserok_af (__const void *__raddr, int __suser,
542 __const char *__remuser, __const char *__locuser,
543 sa_family_t __af);
545 /* Try to allocate reserved port, returning a descriptor for a socket opened
546 at this port or -1 if unsuccessful. The search for an available port
547 will start at ALPORT and continues with lower numbers.
549 This function is not part of POSIX and therefore no official
550 cancellation point. But due to similarity with an POSIX interface
551 or due to the implementation it is a cancellation point and
552 therefore not marked with __THROW. */
553 extern int rresvport (int *__alport);
555 /* This is the equivalent function where the protocol can be selected
556 and which therefore can be used for IPv6.
558 This function is not part of POSIX and therefore no official
559 cancellation point. But due to similarity with an POSIX interface
560 or due to the implementation it is a cancellation point and
561 therefore not marked with __THROW. */
562 extern int rresvport_af (int *__alport, sa_family_t __af);
563 #endif
566 /* Extension from POSIX.1g. */
567 #ifdef __USE_POSIX
568 /* Structure to contain information about address of a service provider. */
569 struct addrinfo
571 int ai_flags; /* Input flags. */
572 int ai_family; /* Protocol family for socket. */
573 int ai_socktype; /* Socket type. */
574 int ai_protocol; /* Protocol for socket. */
575 socklen_t ai_addrlen; /* Length of socket address. */
576 struct sockaddr *ai_addr; /* Socket address for socket. */
577 char *ai_canonname; /* Canonical name for service location. */
578 struct addrinfo *ai_next; /* Pointer to next in list. */
581 # ifdef __USE_GNU
582 /* Structure used as control block for asynchronous lookup. */
583 struct gaicb
585 const char *ar_name; /* Name to look up. */
586 const char *ar_service; /* Service name. */
587 const struct addrinfo *ar_request; /* Additional request specification. */
588 struct addrinfo *ar_result; /* Pointer to result. */
589 /* The following are internal elements. */
590 int __return;
591 int __unused[5];
594 /* Lookup mode. */
595 # define GAI_WAIT 0
596 # define GAI_NOWAIT 1
597 # endif
599 /* Possible values for `ai_flags' field in `addrinfo' structure. */
600 # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
601 # define AI_CANONNAME 0x0002 /* Request for canonical name. */
602 # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
603 # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
604 # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
605 # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
606 returned address type.. */
607 # ifdef __USE_GNU
608 # define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded
609 in the current locale's character set)
610 before looking it up. */
611 # define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
612 # define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode
613 code points. */
614 # define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to
615 STD3 rules. */
616 # endif
617 # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
619 /* Error values for `getaddrinfo' function. */
620 # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
621 # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
622 # define EAI_AGAIN -3 /* Temporary failure in name resolution. */
623 # define EAI_FAIL -4 /* Non-recoverable failure in name res. */
624 # define EAI_FAMILY -6 /* `ai_family' not supported. */
625 # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
626 # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
627 # define EAI_MEMORY -10 /* Memory allocation failure. */
628 # define EAI_SYSTEM -11 /* System error returned in `errno'. */
629 # define EAI_OVERFLOW -12 /* Argument buffer overflow. */
630 # ifdef __USE_GNU
631 # define EAI_NODATA -5 /* No address associated with NAME. */
632 # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
633 # define EAI_INPROGRESS -100 /* Processing request in progress. */
634 # define EAI_CANCELED -101 /* Request canceled. */
635 # define EAI_NOTCANCELED -102 /* Request not canceled. */
636 # define EAI_ALLDONE -103 /* All requests done. */
637 # define EAI_INTR -104 /* Interrupted by a signal. */
638 # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
639 # endif
641 # ifdef __USE_MISC
642 # define NI_MAXHOST 1025
643 # define NI_MAXSERV 32
644 # endif
646 # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
647 # define NI_NUMERICSERV 2 /* Don't convert port number to name. */
648 # define NI_NOFQDN 4 /* Only return nodename portion. */
649 # define NI_NAMEREQD 8 /* Don't return numeric addresses. */
650 # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
651 # ifdef __USE_GNU
652 # define NI_IDN 32 /* Convert name from IDN format. */
653 # define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode
654 code points. */
655 # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to
656 STD3 rules. */
657 # endif
659 /* Translate name of a service location and/or a service name to set of
660 socket addresses.
662 This function is a possible cancellation point and therefore not
663 marked with __THROW. */
664 extern int getaddrinfo (__const char *__restrict __name,
665 __const char *__restrict __service,
666 __const struct addrinfo *__restrict __req,
667 struct addrinfo **__restrict __pai);
669 /* Free `addrinfo' structure AI including associated storage. */
670 extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
672 /* Convert error return from getaddrinfo() to a string. */
673 extern __const char *gai_strerror (int __ecode) __THROW;
675 /* Translate a socket address to a location and service name.
677 This function is a possible cancellation point and therefore not
678 marked with __THROW. */
679 extern int getnameinfo (__const struct sockaddr *__restrict __sa,
680 socklen_t __salen, char *__restrict __host,
681 socklen_t __hostlen, char *__restrict __serv,
682 socklen_t __servlen, unsigned int __flags);
683 #endif /* POSIX */
685 #ifdef __USE_GNU
686 /* Enqueue ENT requests from the LIST. If MODE is GAI_WAIT wait until all
687 requests are handled. If WAIT is GAI_NOWAIT return immediately after
688 queueing the requests and signal completion according to SIG.
690 This function is not part of POSIX and therefore no official
691 cancellation point. But due to similarity with an POSIX interface
692 or due to the implementation it is a cancellation point and
693 therefore not marked with __THROW. */
694 extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
695 int __ent, struct sigevent *__restrict __sig);
697 /* Suspend execution of the thread until at least one of the ENT requests
698 in LIST is handled. If TIMEOUT is not a null pointer it specifies the
699 longest time the function keeps waiting before returning with an error.
701 This function is not part of POSIX and therefore no official
702 cancellation point. But due to similarity with an POSIX interface
703 or due to the implementation it is a cancellation point and
704 therefore not marked with __THROW. */
705 extern int gai_suspend (__const struct gaicb *__const __list[], int __ent,
706 __const struct timespec *__timeout);
708 /* Get the error status of the request REQ. */
709 extern int gai_error (struct gaicb *__req) __THROW;
711 /* Cancel the requests associated with GAICBP. */
712 extern int gai_cancel (struct gaicb *__gaicbp) __THROW;
713 #endif /* GNU */
715 __END_DECLS
717 #endif /* netdb.h */