April 2024 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
001: /* Copyright (C) 1996-2004, 2009, 2010, 2011 Free Software Foundation, Inc. 002: This file is part of the GNU C Library. 003: 004: The GNU C Library is free software; you can redistribute it and/or 005: modify it under the terms of the GNU Lesser General Public 006: License as published by the Free Software Foundation; either 007: version 2.1 of the License, or (at your option) any later version. 008: 009: The GNU C Library is distributed in the hope that it will be useful, 010: but WITHOUT ANY WARRANTY; without even the implied warranty of 011: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012: Lesser General Public License for more details. 013: 014: You should have received a copy of the GNU Lesser General Public 015: License along with the GNU C Library; if not, write to the Free 016: Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 017: 02111-1307 USA. */ 018: 019: /* All data returned by the network data base library are supplied in 020: host order and returned in network order (suitable for use in 021: system calls). */ 022: 023: #ifndef _NETDB_H 024: #define _NETDB_H 1 025: 026: #include <features.h> 027: 028: #include <netinet/in.h> 029: #include <stdint.h> 030: #ifdef __USE_MISC 031: /* This is necessary to make this include file properly replace the 032: Sun version. */ 033: # include <rpc/netdb.h> 034: #endif 035: 036: #ifdef __USE_GNU 037: # define __need_sigevent_t 038: # include <bits/siginfo.h> 039: # define __need_timespec 040: # include <time.h> 041: #endif 042: 043: #include <bits/netdb.h> 044: 045: /* Absolute file name for network data base files. */ 046: #define _PATH_HEQUIV "/etc/hosts.equiv" 047: #define _PATH_HOSTS "/etc/hosts" 048: #define _PATH_NETWORKS "/etc/networks" 049: #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" 050: #define _PATH_PROTOCOLS "/etc/protocols" 051: #define _PATH_SERVICES "/etc/services" 052: 053: 054: __BEGIN_DECLS 055: 056: #if defined __USE_MISC || !defined __USE_XOPEN2K8 057: /* Error status for non-reentrant lookup functions. 058: We use a macro to access always the thread-specific `h_errno' variable. */ 059: # define h_errno (*__h_errno_location ()) 060: 061: /* Function to get address of global `h_errno' variable. */ 062: extern int *__h_errno_location (void) __THROW __attribute__ ((__const__)); 063: 064: 065: /* Possible values left in `h_errno'. */ 066: # define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */ 067: # define TRY_AGAIN 2 /* Non-Authoritative Host not found, 068: or SERVERFAIL. */ 069: # define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, 070: NOTIMP. */ 071: # define NO_DATA 4 /* Valid name, no data record of requested 072: type. */ 073: #endif 074: #if defined __USE_MISC || defined __USE_GNU 075: # define NETDB_INTERNAL -1 /* See errno. */ 076: # define NETDB_SUCCESS 0 /* No problem. */ 077: # define NO_ADDRESS NO_DATA /* No address, look for MX record. */ 078: #endif 079: 080: #ifdef __USE_XOPEN2K 081: /* Highest reserved Internet port number. */ 082: # define IPPORT_RESERVED 1024 083: #endif 084: 085: #ifdef __USE_GNU 086: /* Scope delimiter for getaddrinfo(), getnameinfo(). */ 087: # define SCOPE_DELIMITER '%' 088: #endif 089: 090: #ifdef __USE_MISC 091: /* Print error indicated by `h_errno' variable on standard error. STR 092: if non-null is printed before the error string. */ 093: extern void herror (__const char *__str) __THROW; 094: 095: /* Return string associated with error ERR_NUM. */ 096: extern __const char *hstrerror (int __err_num) __THROW; 097: #endif 098: 099: 100: /* Description of data base entry for a single host. */ 101: struct hostent 102: { 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 111: }; 112: 113: /* Open host data base files and mark them as staying open even after 114: a later search if STAY_OPEN is non-zero. 115: 116: This function is a possible cancellation point and therefore not 117: marked with __THROW. */ 118: extern void sethostent (int __stay_open); 119: 120: /* Close host data base files and clear `stay open' flag. 121: 122: This function is a possible cancellation point and therefore not 123: marked with __THROW. */ 124: extern void endhostent (void); 125: 126: /* Get next entry from host data base file. Open data base if 127: necessary. 128: 129: This function is a possible cancellation point and therefore not 130: marked with __THROW. */ 131: extern struct hostent *gethostent (void); 132: 133: /* Return entry from host data base which address match ADDR with 134: length LEN and type TYPE. 135: 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); 140: 141: /* Return entry from host data base for host with NAME. 142: 143: This function is a possible cancellation point and therefore not 144: marked with __THROW. */ 145: extern struct hostent *gethostbyname (__const char *__name); 146: 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. 151: 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); 157: 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. 163: 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); 172: 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); 179: 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); 185: 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 */ 192: 193: 194: /* Open network data base files and mark them as staying open even 195: after a later search if STAY_OPEN is non-zero. 196: 197: This function is a possible cancellation point and therefore not 198: marked with __THROW. */ 199: extern void setnetent (int __stay_open); 200: 201: /* Close network data base files and clear `stay open' flag. 202: 203: This function is a possible cancellation point and therefore not 204: marked with __THROW. */ 205: extern void endnetent (void); 206: 207: /* Get next entry from network data base file. Open data base if 208: necessary. 209: 210: This function is a possible cancellation point and therefore not 211: marked with __THROW. */ 212: extern struct netent *getnetent (void); 213: 214: /* Return entry from network data base which address match NET and 215: type TYPE. 216: 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); 220: 221: /* Return entry from network data base for network with NAME. 222: 223: This function is a possible cancellation point and therefore not 224: marked with __THROW. */ 225: extern struct netent *getnetbyname (__const char *__name); 226: 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. 233: 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); 242: 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); 248: 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 */ 255: 256: 257: /* Description of data base entry for a single service. */ 258: struct servent 259: { 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. */ 264: }; 265: 266: /* Open service data base files and mark them as staying open even 267: after a later search if STAY_OPEN is non-zero. 268: 269: This function is a possible cancellation point and therefore not 270: marked with __THROW. */ 271: extern void setservent (int __stay_open); 272: 273: /* Close service data base files and clear `stay open' flag. 274: 275: This function is a possible cancellation point and therefore not 276: marked with __THROW. */ 277: extern void endservent (void); 278: 279: /* Get next entry from service data base file. Open data base if 280: necessary. 281: 282: This function is a possible cancellation point and therefore not 283: marked with __THROW. */ 284: extern struct servent *getservent (void); 285: 286: /* Return entry from network data base for network with NAME and 287: protocol PROTO. 288: 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); 293: 294: /* Return entry from service data base which matches port PORT and 295: protocol PROTO. 296: 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); 300: 301: 302: #ifdef __USE_MISC 303: /* Reentrant versions of the functions above. The additional 304: arguments specify a buffer of BUFLEN starting at BUF. 305: 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); 313: 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); 319: 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 */ 325: 326: 327: /* Description of data base entry for a single service. */ 328: struct protoent 329: { 330: char *p_name; /* Official protocol name. */ 331: char **p_aliases; /* Alias list. */ 332: int p_proto; /* Protocol number. */ 333: }; 334: 335: /* Open protocol data base files and mark them as staying open even 336: after a later search if STAY_OPEN is non-zero. 337: 338: This function is a possible cancellation point and therefore not 339: marked with __THROW. */ 340: extern void setprotoent (int __stay_open); 341: 342: /* Close protocol data base files and clear `stay open' flag. 343: 344: This function is a possible cancellation point and therefore not 345: marked with __THROW. */ 346: extern void endprotoent (void); 347: 348: /* Get next entry from protocol data base file. Open data base if 349: necessary. 350: 351: This function is a possible cancellation point and therefore not 352: marked with __THROW. */ 353: extern struct protoent *getprotoent (void); 354: 355: /* Return entry from protocol data base for network with NAME. 356: 357: This function is a possible cancellation point and therefore not 358: marked with __THROW. */ 359: extern struct protoent *getprotobyname (__const char *__name); 360: 361: /* Return entry from protocol data base which number is PROTO. 362: 363: This function is a possible cancellation point and therefore not 364: marked with __THROW. */ 365: extern struct protoent *getprotobynumber (int __proto); 366: 367: 368: #ifdef __USE_MISC 369: /* Reentrant versions of the functions above. The additional 370: arguments specify a buffer of BUFLEN starting at BUF. 371: 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); 379: 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); 384: 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); 389: 390: 391: /* Establish network group NETGROUP for enumeration. 392: 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); 398: 399: /* Free all space allocated by previous `setnetgrent' call. 400: 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); 406: 407: /* Get next member of netgroup established by last `setnetgrent' call 408: and return pointers to elements in HOSTP, USERP, and DOMAINP. 409: 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); 417: 418: 419: /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). 420: 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); 427: 428: /* Reentrant version of `getnetgrent' where result is placed in BUFFER. 429: 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 */ 439: 440: 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. 448: 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); 457: 458: /* This is the equivalent function where the protocol can be selected 459: and which therefore can be used for IPv6. 460: 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); 470: 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. 476: 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); 485: 486: /* This is the equivalent function where the protocol can be selected 487: and which therefore can be used for IPv6. 488: 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); 498: 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. 502: 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); 509: 510: /* This is the equivalent function where the protocol can be selected 511: and which therefore can be used for IPv6. 512: 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); 520: 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. 525: 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); 532: 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 536: 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); 544: 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. 548: 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); 554: 555: /* This is the equivalent function where the protocol can be selected 556: and which therefore can be used for IPv6. 557: 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 564: 565: 566: /* Extension from POSIX.1g. */ 567: #ifdef __USE_POSIX 568: /* Structure to contain information about address of a service provider. */ 569: struct addrinfo 570: { 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. */ 579: }; 580: 581: # ifdef __USE_GNU 582: /* Structure used as control block for asynchronous lookup. */ 583: struct gaicb 584: { 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]; 592: }; 593: 594: /* Lookup mode. */ 595: # define GAI_WAIT 0 596: # define GAI_NOWAIT 1 597: # endif 598: 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. */ 618: 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 640: 641: # ifdef __USE_MISC 642: # define NI_MAXHOST 1025 643: # define NI_MAXSERV 32 644: # endif 645: 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 658: 659: /* Translate name of a service location and/or a service name to set of 660: socket addresses. 661: 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); 668: 669: /* Free `addrinfo' structure AI including associated storage. */ 670: extern void freeaddrinfo (struct addrinfo *__ai) __THROW; 671: 672: /* Convert error return from getaddrinfo() to a string. */ 673: extern __const char *gai_strerror (int __ecode) __THROW; 674: 675: /* Translate a socket address to a location and service name. 676: 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, int __flags); 683: #endif /* POSIX */ 684: 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. 689: 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); 696: 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. 700: 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); 707: 708: /* Get the error status of the request REQ. */ 709: extern int gai_error (struct gaicb *__req) __THROW; 710: 711: /* Cancel the requests associated with GAICBP. */ 712: extern int gai_cancel (struct gaicb *__gaicbp) __THROW; 713: #endif /* GNU */ 714: 715: __END_DECLS 716: 717: #endif /* netdb.h */ 718: