modernc.org/cc@v1.0.1/v2/headers/linux_386/usr/include/netdb.h (about) 1 /* Copyright (C) 1996-2018 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 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. 8 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. 13 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/>. */ 17 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). */ 21 22 #ifndef _NETDB_H 23 #define _NETDB_H 1 24 25 #include <features.h> 26 27 #include <netinet/in.h> 28 #include <bits/stdint-uintn.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 34 35 #ifdef __USE_GNU 36 # include <bits/types/sigevent_t.h> 37 # include <bits/types/struct_timespec.h> 38 #endif 39 40 #include <bits/netdb.h> 41 42 /* Absolute file name for network data base files. */ 43 #define _PATH_HEQUIV "/etc/hosts.equiv" 44 #define _PATH_HOSTS "/etc/hosts" 45 #define _PATH_NETWORKS "/etc/networks" 46 #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" 47 #define _PATH_PROTOCOLS "/etc/protocols" 48 #define _PATH_SERVICES "/etc/services" 49 50 __BEGIN_DECLS 51 #if defined __USE_MISC || !defined __USE_XOPEN2K8 52 /* Error status for non-reentrant lookup functions. 53 We use a macro to access always the thread-specific `h_errno' variable. */ 54 # define h_errno (*__h_errno_location ()) 55 /* Function to get address of global `h_errno' variable. */ 56 extern int *__h_errno_location(void) 57 __THROW __attribute__ ((__const__)); 58 59 /* Possible values left in `h_errno'. */ 60 # define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */ 61 # define TRY_AGAIN 2 /* Non-Authoritative Host not found, 62 or SERVERFAIL. */ 63 # define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, 64 NOTIMP. */ 65 # define NO_DATA 4 /* Valid name, no data record of requested 66 type. */ 67 #endif 68 #ifdef __USE_MISC 69 # define NETDB_INTERNAL -1 /* See errno. */ 70 # define NETDB_SUCCESS 0 /* No problem. */ 71 # define NO_ADDRESS NO_DATA /* No address, look for MX record. */ 72 #endif 73 74 #if defined __USE_XOPEN2K || defined __USE_XOPEN_EXTENDED 75 /* Highest reserved Internet port number. */ 76 # define IPPORT_RESERVED 1024 77 #endif 78 79 #ifdef __USE_GNU 80 /* Scope delimiter for getaddrinfo(), getnameinfo(). */ 81 # define SCOPE_DELIMITER '%' 82 #endif 83 84 #ifdef __USE_MISC 85 /* Print error indicated by `h_errno' variable on standard error. STR 86 if non-null is printed before the error string. */ 87 extern void herror(const char *__str) __THROW; 88 89 /* Return string associated with error ERR_NUM. */ 90 extern const char *hstrerror(int __err_num) __THROW; 91 #endif 92 93 /* Description of data base entry for a single host. */ 94 struct hostent { 95 char *h_name; /* Official name of host. */ 96 char **h_aliases; /* Alias list. */ 97 int h_addrtype; /* Host address type. */ 98 int h_length; /* Length of address. */ 99 char **h_addr_list; /* List of addresses from name server. */ 100 #ifdef __USE_MISC 101 # define h_addr h_addr_list[0] /* Address, for backward compatibility. */ 102 #endif 103 }; 104 105 /* Open host data base files and mark them as staying open even after 106 a later search if STAY_OPEN is non-zero. 107 108 This function is a possible cancellation point and therefore not 109 marked with __THROW. */ 110 extern void sethostent(int __stay_open); 111 112 /* Close host data base files and clear `stay open' flag. 113 114 This function is a possible cancellation point and therefore not 115 marked with __THROW. */ 116 extern void endhostent(void); 117 118 /* Get next entry from host data base file. Open data base if 119 necessary. 120 121 This function is a possible cancellation point and therefore not 122 marked with __THROW. */ 123 extern struct hostent *gethostent(void); 124 125 /* Return entry from host data base which address match ADDR with 126 length LEN and type TYPE. 127 128 This function is a possible cancellation point and therefore not 129 marked with __THROW. */ 130 extern struct hostent *gethostbyaddr(const void *__addr, __socklen_t __len, int __type); 131 132 /* Return entry from host data base for host with NAME. 133 134 This function is a possible cancellation point and therefore not 135 marked with __THROW. */ 136 extern struct hostent *gethostbyname(const char *__name); 137 138 #ifdef __USE_MISC 139 /* Return entry from host data base for host with NAME. AF must be 140 set to the address type which is `AF_INET' for IPv4 or `AF_INET6' 141 for IPv6. 142 143 This function is not part of POSIX and therefore no official 144 cancellation point. But due to similarity with an POSIX interface 145 or due to the implementation it is a cancellation point and 146 therefore not marked with __THROW. */ 147 extern struct hostent *gethostbyname2(const char *__name, int __af); 148 149 /* Reentrant versions of the functions above. The additional 150 arguments specify a buffer of BUFLEN starting at BUF. The last 151 argument is a pointer to a variable which gets the value which 152 would be stored in the global variable `herrno' by the 153 non-reentrant functions. 154 155 These functions are not part of POSIX and therefore no official 156 cancellation point. But due to similarity with an POSIX interface 157 or due to the implementation they are cancellation points and 158 therefore not marked with __THROW. */ 159 extern int gethostent_r(struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); 160 161 extern int gethostbyaddr_r(const void *__restrict __addr, __socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); 162 163 extern int gethostbyname_r(const char *__restrict __name, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); 164 165 extern int gethostbyname2_r(const char *__restrict __name, int __af, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); 166 #endif /* misc */ 167 168 /* Open network data base files and mark them as staying open even 169 after a later search if STAY_OPEN is non-zero. 170 171 This function is a possible cancellation point and therefore not 172 marked with __THROW. */ 173 extern void setnetent(int __stay_open); 174 175 /* Close network data base files and clear `stay open' flag. 176 177 This function is a possible cancellation point and therefore not 178 marked with __THROW. */ 179 extern void endnetent(void); 180 181 /* Get next entry from network data base file. Open data base if 182 necessary. 183 184 This function is a possible cancellation point and therefore not 185 marked with __THROW. */ 186 extern struct netent *getnetent(void); 187 188 /* Return entry from network data base which address match NET and 189 type TYPE. 190 191 This function is a possible cancellation point and therefore not 192 marked with __THROW. */ 193 extern struct netent *getnetbyaddr(uint32_t __net, int __type); 194 195 /* Return entry from network data base for network with NAME. 196 197 This function is a possible cancellation point and therefore not 198 marked with __THROW. */ 199 extern struct netent *getnetbyname(const char *__name); 200 201 #ifdef __USE_MISC 202 /* Reentrant versions of the functions above. The additional 203 arguments specify a buffer of BUFLEN starting at BUF. The last 204 argument is a pointer to a variable which gets the value which 205 would be stored in the global variable `herrno' by the 206 non-reentrant functions. 207 208 These functions are not part of POSIX and therefore no official 209 cancellation point. But due to similarity with an POSIX interface 210 or due to the implementation they are cancellation points and 211 therefore not marked with __THROW. */ 212 extern int getnetent_r(struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, int *__restrict __h_errnop); 213 214 extern int getnetbyaddr_r(uint32_t __net, int __type, struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, int *__restrict __h_errnop); 215 216 extern int getnetbyname_r(const char *__restrict __name, struct netent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct netent **__restrict __result, int *__restrict __h_errnop); 217 #endif /* misc */ 218 219 /* Description of data base entry for a single service. */ 220 struct servent { 221 char *s_name; /* Official service name. */ 222 char **s_aliases; /* Alias list. */ 223 int s_port; /* Port number. */ 224 char *s_proto; /* Protocol to use. */ 225 }; 226 227 /* Open service data base files and mark them as staying open even 228 after a later search if STAY_OPEN is non-zero. 229 230 This function is a possible cancellation point and therefore not 231 marked with __THROW. */ 232 extern void setservent(int __stay_open); 233 234 /* Close service data base files and clear `stay open' flag. 235 236 This function is a possible cancellation point and therefore not 237 marked with __THROW. */ 238 extern void endservent(void); 239 240 /* Get next entry from service data base file. Open data base if 241 necessary. 242 243 This function is a possible cancellation point and therefore not 244 marked with __THROW. */ 245 extern struct servent *getservent(void); 246 247 /* Return entry from network data base for network with NAME and 248 protocol PROTO. 249 250 This function is a possible cancellation point and therefore not 251 marked with __THROW. */ 252 extern struct servent *getservbyname(const char *__name, const char *__proto); 253 254 /* Return entry from service data base which matches port PORT and 255 protocol PROTO. 256 257 This function is a possible cancellation point and therefore not 258 marked with __THROW. */ 259 extern struct servent *getservbyport(int __port, const char *__proto); 260 261 #ifdef __USE_MISC 262 /* Reentrant versions of the functions above. The additional 263 arguments specify a buffer of BUFLEN starting at BUF. 264 265 These functions are not part of POSIX and therefore no official 266 cancellation point. But due to similarity with an POSIX interface 267 or due to the implementation they are cancellation points and 268 therefore not marked with __THROW. */ 269 extern int getservent_r(struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct servent **__restrict __result); 270 271 extern int getservbyname_r(const char *__restrict __name, const char *__restrict __proto, struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct servent **__restrict __result); 272 273 extern int getservbyport_r(int __port, const char *__restrict __proto, struct servent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct servent **__restrict __result); 274 #endif /* misc */ 275 276 /* Description of data base entry for a single service. */ 277 struct protoent { 278 char *p_name; /* Official protocol name. */ 279 char **p_aliases; /* Alias list. */ 280 int p_proto; /* Protocol number. */ 281 }; 282 283 /* Open protocol data base files and mark them as staying open even 284 after a later search if STAY_OPEN is non-zero. 285 286 This function is a possible cancellation point and therefore not 287 marked with __THROW. */ 288 extern void setprotoent(int __stay_open); 289 290 /* Close protocol data base files and clear `stay open' flag. 291 292 This function is a possible cancellation point and therefore not 293 marked with __THROW. */ 294 extern void endprotoent(void); 295 296 /* Get next entry from protocol data base file. Open data base if 297 necessary. 298 299 This function is a possible cancellation point and therefore not 300 marked with __THROW. */ 301 extern struct protoent *getprotoent(void); 302 303 /* Return entry from protocol data base for network with NAME. 304 305 This function is a possible cancellation point and therefore not 306 marked with __THROW. */ 307 extern struct protoent *getprotobyname(const char *__name); 308 309 /* Return entry from protocol data base which number is PROTO. 310 311 This function is a possible cancellation point and therefore not 312 marked with __THROW. */ 313 extern struct protoent *getprotobynumber(int __proto); 314 315 #ifdef __USE_MISC 316 /* Reentrant versions of the functions above. The additional 317 arguments specify a buffer of BUFLEN starting at BUF. 318 319 These functions are not part of POSIX and therefore no official 320 cancellation point. But due to similarity with an POSIX interface 321 or due to the implementation they are cancellation points and 322 therefore not marked with __THROW. */ 323 extern int getprotoent_r(struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct protoent **__restrict __result); 324 325 extern int getprotobyname_r(const char *__restrict __name, struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct protoent **__restrict __result); 326 327 extern int getprotobynumber_r(int __proto, struct protoent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct protoent **__restrict __result); 328 329 /* Establish network group NETGROUP for enumeration. 330 331 This function is not part of POSIX and therefore no official 332 cancellation point. But due to similarity with an POSIX interface 333 or due to the implementation it is a cancellation point and 334 therefore not marked with __THROW. */ 335 extern int setnetgrent(const char *__netgroup); 336 337 /* Free all space allocated by previous `setnetgrent' call. 338 339 This function is not part of POSIX and therefore no official 340 cancellation point. But due to similarity with an POSIX interface 341 or due to the implementation it is a cancellation point and 342 therefore not marked with __THROW. */ 343 extern void endnetgrent(void); 344 345 /* Get next member of netgroup established by last `setnetgrent' call 346 and return pointers to elements in HOSTP, USERP, and DOMAINP. 347 348 This function is not part of POSIX and therefore no official 349 cancellation point. But due to similarity with an POSIX interface 350 or due to the implementation it is a cancellation point and 351 therefore not marked with __THROW. */ 352 extern int getnetgrent(char **__restrict __hostp, char **__restrict __userp, char **__restrict __domainp); 353 354 /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). 355 356 This function is not part of POSIX and therefore no official 357 cancellation point. But due to similarity with an POSIX interface 358 or due to the implementation it is a cancellation point and 359 therefore not marked with __THROW. */ 360 extern int innetgr(const char *__netgroup, const char *__host, const char *__user, const char *__domain); 361 362 /* Reentrant version of `getnetgrent' where result is placed in BUFFER. 363 364 This function is not part of POSIX and therefore no official 365 cancellation point. But due to similarity with an POSIX interface 366 or due to the implementation it is a cancellation point and 367 therefore not marked with __THROW. */ 368 extern int getnetgrent_r(char **__restrict __hostp, char **__restrict __userp, char **__restrict __domainp, char *__restrict __buffer, size_t __buflen); 369 #endif /* misc */ 370 371 #ifdef __USE_MISC 372 /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. 373 The local user is LOCUSER, on the remote machine the command is 374 executed as REMUSER. In *FD2P the descriptor to the socket for the 375 connection is returned. The caller must have the right to use a 376 reserved port. When the function returns *AHOST contains the 377 official host name. 378 379 This function is not part of POSIX and therefore no official 380 cancellation point. But due to similarity with an POSIX interface 381 or due to the implementation it is a cancellation point and 382 therefore not marked with __THROW. */ 383 extern int rcmd(char **__restrict __ahost, unsigned short int __rport, const char *__restrict __locuser, const char *__restrict __remuser, const char *__restrict __cmd, int *__restrict __fd2p); 384 385 /* This is the equivalent function where the protocol can be selected 386 and which therefore can be used for IPv6. 387 388 This function is not part of POSIX and therefore no official 389 cancellation point. But due to similarity with an POSIX interface 390 or due to the implementation it is a cancellation point and 391 therefore not marked with __THROW. */ 392 extern int rcmd_af(char **__restrict __ahost, unsigned short int __rport, const char *__restrict __locuser, const char *__restrict __remuser, const char *__restrict __cmd, int *__restrict __fd2p, sa_family_t __af); 393 394 /* Call `rexecd' at port RPORT on remote machine *AHOST to execute 395 CMD. The process runs at the remote machine using the ID of user 396 NAME whose cleartext password is PASSWD. In *FD2P the descriptor 397 to the socket for the connection is returned. When the function 398 returns *AHOST contains the official host name. 399 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 int rexec(char **__restrict __ahost, int __rport, const char *__restrict __name, const char *__restrict __pass, const char *__restrict __cmd, int *__restrict __fd2p); 405 406 /* This is the equivalent function where the protocol can be selected 407 and which therefore can be used for IPv6. 408 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 rexec_af(char **__restrict __ahost, int __rport, const char *__restrict __name, const char *__restrict __pass, const char *__restrict __cmd, int *__restrict __fd2p, sa_family_t __af); 414 415 /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. 416 If SUSER is not zero the user tries to become superuser. Return 0 if 417 it is possible. 418 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 ruserok(const char *__rhost, int __suser, const char *__remuser, const char *__locuser); 424 425 /* This is the equivalent function where the protocol can be selected 426 and which therefore can be used for IPv6. 427 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 ruserok_af(const char *__rhost, int __suser, const char *__remuser, const char *__locuser, sa_family_t __af); 433 434 /* Check whether user REMUSER on system indicated by IPv4 address 435 RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are 436 not supported. If SUSER is not zero the user tries to become 437 superuser. Return 0 if it is possible. 438 439 This function is not part of POSIX and therefore no official 440 cancellation point. But due to similarity with an POSIX interface 441 or due to the implementation it is a cancellation point and 442 therefore not marked with __THROW. */ 443 extern int iruserok(uint32_t __raddr, int __suser, const char *__remuser, const char *__locuser); 444 445 /* This is the equivalent function where the pfamiliy if the address 446 pointed to by RADDR is determined by the value of AF. It therefore 447 can be used for IPv6 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 iruserok_af(const void *__raddr, int __suser, const char *__remuser, const char *__locuser, sa_family_t __af); 454 455 /* Try to allocate reserved port, returning a descriptor for a socket opened 456 at this port or -1 if unsuccessful. The search for an available port 457 will start at ALPORT and continues with lower numbers. 458 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 rresvport(int *__alport); 464 465 /* This is the equivalent function where the protocol can be selected 466 and which therefore can be used for IPv6. 467 468 This function is not part of POSIX and therefore no official 469 cancellation point. But due to similarity with an POSIX interface 470 or due to the implementation it is a cancellation point and 471 therefore not marked with __THROW. */ 472 extern int rresvport_af(int *__alport, sa_family_t __af); 473 #endif 474 475 /* Extension from POSIX.1:2001. */ 476 #ifdef __USE_XOPEN2K 477 /* Structure to contain information about address of a service provider. */ 478 struct addrinfo { 479 int ai_flags; /* Input flags. */ 480 int ai_family; /* Protocol family for socket. */ 481 int ai_socktype; /* Socket type. */ 482 int ai_protocol; /* Protocol for socket. */ 483 socklen_t ai_addrlen; /* Length of socket address. */ 484 struct sockaddr *ai_addr; /* Socket address for socket. */ 485 char *ai_canonname; /* Canonical name for service location. */ 486 struct addrinfo *ai_next; /* Pointer to next in list. */ 487 }; 488 489 # ifdef __USE_GNU 490 /* Structure used as control block for asynchronous lookup. */ 491 struct gaicb { 492 const char *ar_name; /* Name to look up. */ 493 const char *ar_service; /* Service name. */ 494 const struct addrinfo *ar_request; /* Additional request specification. */ 495 struct addrinfo *ar_result; /* Pointer to result. */ 496 /* The following are internal elements. */ 497 int __return; 498 int __glibc_reserved[5]; 499 }; 500 501 /* Lookup mode. */ 502 # define GAI_WAIT 0 503 # define GAI_NOWAIT 1 504 # endif 505 506 /* Possible values for `ai_flags' field in `addrinfo' structure. */ 507 # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ 508 # define AI_CANONNAME 0x0002 /* Request for canonical name. */ 509 # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ 510 # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */ 511 # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */ 512 # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose 513 returned address type.. */ 514 # ifdef __USE_GNU 515 # define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded 516 in the current locale's character set) 517 before looking it up. */ 518 # define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */ 519 # define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode 520 code points. */ 521 # define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to 522 STD3 rules. */ 523 # endif 524 # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ 525 526 /* Error values for `getaddrinfo' function. */ 527 # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ 528 # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ 529 # define EAI_AGAIN -3 /* Temporary failure in name resolution. */ 530 # define EAI_FAIL -4 /* Non-recoverable failure in name res. */ 531 # define EAI_FAMILY -6 /* `ai_family' not supported. */ 532 # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ 533 # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ 534 # define EAI_MEMORY -10 /* Memory allocation failure. */ 535 # define EAI_SYSTEM -11 /* System error returned in `errno'. */ 536 # define EAI_OVERFLOW -12 /* Argument buffer overflow. */ 537 # ifdef __USE_GNU 538 # define EAI_NODATA -5 /* No address associated with NAME. */ 539 # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ 540 # define EAI_INPROGRESS -100 /* Processing request in progress. */ 541 # define EAI_CANCELED -101 /* Request canceled. */ 542 # define EAI_NOTCANCELED -102 /* Request not canceled. */ 543 # define EAI_ALLDONE -103 /* All requests done. */ 544 # define EAI_INTR -104 /* Interrupted by a signal. */ 545 # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ 546 # endif 547 548 # ifdef __USE_MISC 549 # define NI_MAXHOST 1025 550 # define NI_MAXSERV 32 551 # endif 552 553 # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */ 554 # define NI_NUMERICSERV 2 /* Don't convert port number to name. */ 555 # define NI_NOFQDN 4 /* Only return nodename portion. */ 556 # define NI_NAMEREQD 8 /* Don't return numeric addresses. */ 557 # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ 558 # ifdef __USE_GNU 559 # define NI_IDN 32 /* Convert name from IDN format. */ 560 # define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode 561 code points. */ 562 # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to 563 STD3 rules. */ 564 # endif 565 566 /* Translate name of a service location and/or a service name to set of 567 socket addresses. 568 569 This function is a possible cancellation point and therefore not 570 marked with __THROW. */ 571 extern int getaddrinfo(const char *__restrict __name, const char *__restrict __service, const struct addrinfo *__restrict __req, struct addrinfo **__restrict __pai); 572 573 /* Free `addrinfo' structure AI including associated storage. */ 574 extern void freeaddrinfo(struct addrinfo *__ai) __THROW; 575 576 /* Convert error return from getaddrinfo() to a string. */ 577 extern const char *gai_strerror(int __ecode) __THROW; 578 579 /* Translate a socket address to a location and service name. 580 581 This function is a possible cancellation point and therefore not 582 marked with __THROW. */ 583 extern int getnameinfo(const struct sockaddr *__restrict __sa, socklen_t __salen, char *__restrict __host, socklen_t __hostlen, char *__restrict __serv, socklen_t __servlen, int __flags); 584 #endif /* POSIX */ 585 586 #ifdef __USE_GNU 587 /* Enqueue ENT requests from the LIST. If MODE is GAI_WAIT wait until all 588 requests are handled. If WAIT is GAI_NOWAIT return immediately after 589 queueing the requests and signal completion according to SIG. 590 591 This function is not part of POSIX and therefore no official 592 cancellation point. But due to similarity with an POSIX interface 593 or due to the implementation it is a cancellation point and 594 therefore not marked with __THROW. */ 595 extern int getaddrinfo_a(int __mode, struct gaicb *__list[__restrict_arr], int __ent, struct sigevent *__restrict __sig); 596 597 /* Suspend execution of the thread until at least one of the ENT requests 598 in LIST is handled. If TIMEOUT is not a null pointer it specifies the 599 longest time the function keeps waiting before returning with an error. 600 601 This function is not part of POSIX and therefore no official 602 cancellation point. But due to similarity with an POSIX interface 603 or due to the implementation it is a cancellation point and 604 therefore not marked with __THROW. */ 605 extern int gai_suspend(const struct gaicb *const __list[], int __ent, const struct timespec *__timeout); 606 607 /* Get the error status of the request REQ. */ 608 extern int gai_error(struct gaicb *__req) __THROW; 609 610 /* Cancel the requests associated with GAICBP. */ 611 extern int gai_cancel(struct gaicb *__gaicbp) __THROW; 612 #endif /* GNU */ 613 614 __END_DECLS 615 #endif /* netdb.h */