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