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