1 /* Copyright (C) 1996-2002, 2003, 2004, 2009 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
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
27 #include <netinet/in.h>
29 #if defined __USE_MISC && defined __UCLIBC_HAS_RPC__
30 /* This is necessary to make this include file properly replace the
32 # include <rpc/netdb.h>
36 # define __need_sigevent_t
37 # include <bits/siginfo.h>
38 # define __need_timespec
42 #include <bits/netdb.h>
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"
55 /* Error status for non-reentrant lookup functions.
56 We use a macro to access always the thread-specific `h_errno' variable. */
57 #define h_errno (*__h_errno_location ())
59 /* Function to get address of global `h_errno' variable. */
60 extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
62 extern int weak_const_function *__h_errno_location(void);
65 /* Macros for accessing h_errno from inside libc. */
67 # ifdef __UCLIBC_HAS_THREADS__
68 # if defined __UCLIBC_HAS_TLS__ \
69 && (!defined NOT_IN_libc || defined IS_IN_libpthread)
72 # define h_errno __libc_h_errno
74 # define h_errno h_errno /* For #ifndef h_errno tests. */
76 extern __thread int h_errno attribute_tls_model_ie;
77 # define __set_h_errno(x) (h_errno = (x))
79 static inline int __set_h_errno (int __err)
81 return *__h_errno_location () = __err;
83 # endif /* __UCLIBC_HAS_TLS__ */
86 # define __set_h_errno(x) (h_errno = (x))
88 # endif /* __UCLIBC_HAS_THREADS__ */
91 /* Possible values left in `h_errno'. */
92 #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
93 #define TRY_AGAIN 2 /* Non-Authoritative Host not found,
95 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED,
97 #define NO_DATA 4 /* Valid name, no data record of requested
99 #if defined __USE_MISC || defined __USE_GNU
100 # define NETDB_INTERNAL -1 /* See errno. */
101 # define NETDB_SUCCESS 0 /* No problem. */
102 # define NO_ADDRESS NO_DATA /* No address, look for MX record. */
106 /* Highest reserved Internet port number. */
107 # define IPPORT_RESERVED 1024
111 /* Scope delimiter for getaddrinfo(), getnameinfo(). */
112 # define SCOPE_DELIMITER '%'
115 #if defined __USE_MISC || defined __USE_GNU
116 /* Print error indicated by `h_errno' variable on standard error. STR
117 if non-null is printed before the error string. */
118 extern void herror (const char *__str) __THROW;
119 libc_hidden_proto(herror)
121 /* Return string associated with error ERR_NUM. */
122 extern const char *hstrerror (int __err_num) __THROW;
126 /* Description of data base entry for a single host. */
129 char *h_name; /* Official name of host. */
130 char **h_aliases; /* Alias list. */
131 int h_addrtype; /* Host address type. */
132 int h_length; /* Length of address. */
133 char **h_addr_list; /* List of addresses from name server. */
134 #if defined __USE_MISC || defined __USE_GNU
135 # define h_addr h_addr_list[0] /* Address, for backward compatibility.*/
139 /* Open host data base files and mark them as staying open even after
140 a later search if STAY_OPEN is non-zero.
142 This function is a possible cancellation point and therefore not
143 marked with __THROW. */
144 extern void sethostent (int __stay_open);
146 /* Close host data base files and clear `stay open' flag.
148 This function is a possible cancellation point and therefore not
149 marked with __THROW. */
150 extern void endhostent (void);
152 /* Get next entry from host data base file. Open data base if
155 This function is a possible cancellation point and therefore not
156 marked with __THROW. */
157 extern struct hostent *gethostent (void);
159 /* Return entry from host data base which address match ADDR with
160 length LEN and type TYPE.
162 This function is a possible cancellation point and therefore not
163 marked with __THROW. */
164 extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len,
166 libc_hidden_proto(gethostbyaddr)
168 /* Return entry from host data base for host with NAME.
170 This function is a possible cancellation point and therefore not
171 marked with __THROW. */
172 extern struct hostent *gethostbyname (const char *__name);
173 libc_hidden_proto(gethostbyname)
176 /* Return entry from host data base for host with NAME. AF must be
177 set to the address type which is `AF_INET' for IPv4 or `AF_INET6'
180 This function is not part of POSIX and therefore no official
181 cancellation point. But due to similarity with an POSIX interface
182 or due to the implementation it is a cancellation point and
183 therefore not marked with __THROW. */
184 extern struct hostent *gethostbyname2 (const char *__name, int __af);
185 libc_hidden_proto(gethostbyname2)
187 /* Reentrant versions of the functions above. The additional
188 arguments specify a buffer of BUFLEN starting at BUF. The last
189 argument is a pointer to a variable which gets the value which
190 would be stored in the global variable `herrno' by the
191 non-reentrant functions.
193 These functions are not part of POSIX and therefore no official
194 cancellation point. But due to similarity with an POSIX interface
195 or due to the implementation they are cancellation points and
196 therefore not marked with __THROW. */
197 extern int gethostent_r (struct hostent *__restrict __result_buf,
198 char *__restrict __buf, size_t __buflen,
199 struct hostent **__restrict __result,
200 int *__restrict __h_errnop);
201 libc_hidden_proto(gethostent_r)
203 extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len,
205 struct hostent *__restrict __result_buf,
206 char *__restrict __buf, size_t __buflen,
207 struct hostent **__restrict __result,
208 int *__restrict __h_errnop);
209 libc_hidden_proto(gethostbyaddr_r)
211 extern int gethostbyname_r (const char *__restrict __name,
212 struct hostent *__restrict __result_buf,
213 char *__restrict __buf, size_t __buflen,
214 struct hostent **__restrict __result,
215 int *__restrict __h_errnop);
216 libc_hidden_proto(gethostbyname_r)
218 extern int gethostbyname2_r (const char *__restrict __name, int __af,
219 struct hostent *__restrict __result_buf,
220 char *__restrict __buf, size_t __buflen,
221 struct hostent **__restrict __result,
222 int *__restrict __h_errnop);
223 libc_hidden_proto(gethostbyname2_r)
227 /* Open network data base files and mark them as staying open even
228 after a later search if STAY_OPEN is non-zero.
230 This function is a possible cancellation point and therefore not
231 marked with __THROW. */
232 extern void setnetent (int __stay_open);
233 libc_hidden_proto(setnetent)
235 /* Close network data base files and clear `stay open' flag.
237 This function is a possible cancellation point and therefore not
238 marked with __THROW. */
239 extern void endnetent (void);
240 libc_hidden_proto(endnetent)
242 /* Get next entry from network data base file. Open data base if
245 This function is a possible cancellation point and therefore not
246 marked with __THROW. */
247 extern struct netent *getnetent (void);
249 /* Return entry from network data base which address match NET and
252 This function is a possible cancellation point and therefore not
253 marked with __THROW. */
254 extern struct netent *getnetbyaddr (uint32_t __net, int __type);
256 /* Return entry from network data base for network with NAME.
258 This function is a possible cancellation point and therefore not
259 marked with __THROW. */
260 extern struct netent *getnetbyname (const char *__name);
263 /* Reentrant versions of the functions above. The additional
264 arguments specify a buffer of BUFLEN starting at BUF. The last
265 argument is a pointer to a variable which gets the value which
266 would be stored in the global variable `herrno' by the
267 non-reentrant functions.
269 These functions are not part of POSIX and therefore no official
270 cancellation point. But due to similarity with an POSIX interface
271 or due to the implementation they are cancellation points and
272 therefore not marked with __THROW. */
273 extern int getnetent_r (struct netent *__restrict __result_buf,
274 char *__restrict __buf, size_t __buflen,
275 struct netent **__restrict __result,
276 int *__restrict __h_errnop);
277 libc_hidden_proto(getnetent_r)
279 extern int getnetbyaddr_r (uint32_t __net, int __type,
280 struct netent *__restrict __result_buf,
281 char *__restrict __buf, size_t __buflen,
282 struct netent **__restrict __result,
283 int *__restrict __h_errnop);
284 libc_hidden_proto(getnetbyaddr_r)
286 extern int getnetbyname_r (const char *__restrict __name,
287 struct netent *__restrict __result_buf,
288 char *__restrict __buf, size_t __buflen,
289 struct netent **__restrict __result,
290 int *__restrict __h_errnop);
291 libc_hidden_proto(getnetbyname_r)
292 #endif /* __USE_MISC */
295 /* Description of data base entry for a single service. */
298 char *s_name; /* Official service name. */
299 char **s_aliases; /* Alias list. */
300 int s_port; /* Port number. */
301 char *s_proto; /* Protocol to use. */
304 /* Open service data base files and mark them as staying open even
305 after a later search if STAY_OPEN is non-zero.
307 This function is a possible cancellation point and therefore not
308 marked with __THROW. */
309 extern void setservent (int __stay_open);
310 libc_hidden_proto(setservent)
312 /* Close service data base files and clear `stay open' flag.
314 This function is a possible cancellation point and therefore not
315 marked with __THROW. */
316 extern void endservent (void);
317 libc_hidden_proto(endservent)
319 /* Get next entry from service data base file. Open data base if
322 This function is a possible cancellation point and therefore not
323 marked with __THROW. */
324 extern struct servent *getservent (void);
326 /* Return entry from network data base for network with NAME and
329 This function is a possible cancellation point and therefore not
330 marked with __THROW. */
331 extern struct servent *getservbyname (const char *__name,
332 const char *__proto);
334 /* Return entry from service data base which matches port PORT and
337 This function is a possible cancellation point and therefore not
338 marked with __THROW. */
339 extern struct servent *getservbyport (int __port, const char *__proto);
340 libc_hidden_proto(getservbyport)
344 /* Reentrant versions of the functions above. The additional
345 arguments specify a buffer of BUFLEN starting at BUF.
347 These functions are not part of POSIX and therefore no official
348 cancellation point. But due to similarity with an POSIX interface
349 or due to the implementation they are cancellation points and
350 therefore not marked with __THROW. */
351 extern int getservent_r (struct servent *__restrict __result_buf,
352 char *__restrict __buf, size_t __buflen,
353 struct servent **__restrict __result);
354 libc_hidden_proto(getservent_r)
356 extern int getservbyname_r (const char *__restrict __name,
357 const char *__restrict __proto,
358 struct servent *__restrict __result_buf,
359 char *__restrict __buf, size_t __buflen,
360 struct servent **__restrict __result);
361 libc_hidden_proto(getservbyname_r)
363 extern int getservbyport_r (int __port, const char *__restrict __proto,
364 struct servent *__restrict __result_buf,
365 char *__restrict __buf, size_t __buflen,
366 struct servent **__restrict __result);
367 libc_hidden_proto(getservbyport_r)
371 /* Description of data base entry for a single service. */
374 char *p_name; /* Official protocol name. */
375 char **p_aliases; /* Alias list. */
376 int p_proto; /* Protocol number. */
379 /* Open protocol data base files and mark them as staying open even
380 after a later search if STAY_OPEN is non-zero.
382 This function is a possible cancellation point and therefore not
383 marked with __THROW. */
384 extern void setprotoent (int __stay_open);
385 libc_hidden_proto(setprotoent)
387 /* Close protocol data base files and clear `stay open' flag.
389 This function is a possible cancellation point and therefore not
390 marked with __THROW. */
391 extern void endprotoent (void);
392 libc_hidden_proto(endprotoent)
394 /* Get next entry from protocol data base file. Open data base if
397 This function is a possible cancellation point and therefore not
398 marked with __THROW. */
399 extern struct protoent *getprotoent (void);
401 /* Return entry from protocol data base for network with NAME.
403 This function is a possible cancellation point and therefore not
404 marked with __THROW. */
405 extern struct protoent *getprotobyname (const char *__name);
407 /* Return entry from protocol data base which number is PROTO.
409 This function is a possible cancellation point and therefore not
410 marked with __THROW. */
411 extern struct protoent *getprotobynumber (int __proto);
415 /* Reentrant versions of the functions above. The additional
416 arguments specify a buffer of BUFLEN starting at BUF.
418 These functions are not part of POSIX and therefore no official
419 cancellation point. But due to similarity with an POSIX interface
420 or due to the implementation they are cancellation points and
421 therefore not marked with __THROW. */
422 extern int getprotoent_r (struct protoent *__restrict __result_buf,
423 char *__restrict __buf, size_t __buflen,
424 struct protoent **__restrict __result);
425 libc_hidden_proto(getprotoent_r)
427 extern int getprotobyname_r (const char *__restrict __name,
428 struct protoent *__restrict __result_buf,
429 char *__restrict __buf, size_t __buflen,
430 struct protoent **__restrict __result);
431 libc_hidden_proto(getprotobyname_r)
433 extern int getprotobynumber_r (int __proto,
434 struct protoent *__restrict __result_buf,
435 char *__restrict __buf, size_t __buflen,
436 struct protoent **__restrict __result);
437 libc_hidden_proto(getprotobynumber_r)
440 #ifdef __UCLIBC_HAS_NETGROUP__
441 /* Establish network group NETGROUP for enumeration.
443 This function is not part of POSIX and therefore no official
444 cancellation point. But due to similarity with an POSIX interface
445 or due to the implementation it is a cancellation point and
446 therefore not marked with __THROW. */
447 extern int setnetgrent (const char *__netgroup);
449 /* Free all space allocated by previous `setnetgrent' call.
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 void endnetgrent (void);
457 /* Get next member of netgroup established by last `setnetgrent' call
458 and return pointers to elements in HOSTP, USERP, and DOMAINP.
460 This function is not part of POSIX and therefore no official
461 cancellation point. But due to similarity with an POSIX interface
462 or due to the implementation it is a cancellation point and
463 therefore not marked with __THROW. */
464 extern int getnetgrent (char **__restrict __hostp,
465 char **__restrict __userp,
466 char **__restrict __domainp);
469 /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN).
471 This function is not part of POSIX and therefore no official
472 cancellation point. But due to similarity with an POSIX interface
473 or due to the implementation it is a cancellation point and
474 therefore not marked with __THROW. */
475 extern int innetgr (const char *__netgroup, const char *__host,
476 const char *__user, const char *__domain);
478 /* Reentrant version of `getnetgrent' where result is placed in BUFFER.
480 This function is not part of POSIX and therefore no official
481 cancellation point. But due to similarity with an POSIX interface
482 or due to the implementation it is a cancellation point and
483 therefore not marked with __THROW. */
484 extern int getnetgrent_r (char **__restrict __hostp,
485 char **__restrict __userp,
486 char **__restrict __domainp,
487 char *__restrict __buffer, size_t __buflen);
488 #endif /* UCLIBC_HAS_NETGROUP */
492 /* ruserpass - remote password check.
493 This function also exists in glibc but is undocumented */
494 extern int ruserpass(const char *host, const char **aname, const char **apass);
495 libc_hidden_proto(ruserpass)
499 /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD.
500 The local user is LOCUSER, on the remote machine the command is
501 executed as REMUSER. In *FD2P the descriptor to the socket for the
502 connection is returned. The caller must have the right to use a
503 reserved port. When the function returns *AHOST contains the
506 This function is not part of POSIX and therefore no official
507 cancellation point. But due to similarity with an POSIX interface
508 or due to the implementation it is a cancellation point and
509 therefore not marked with __THROW. */
510 extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
511 const char *__restrict __locuser,
512 const char *__restrict __remuser,
513 const char *__restrict __cmd, int *__restrict __fd2p);
517 /* This is the equivalent function where the protocol can be selected
518 and which therefore can be used for IPv6.
520 This function is not part of POSIX and therefore no official
521 cancellation point. But due to similarity with an POSIX interface
522 or due to the implementation it is a cancellation point and
523 therefore not marked with __THROW. */
524 extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
525 const char *__restrict __locuser,
526 const char *__restrict __remuser,
527 const char *__restrict __cmd, int *__restrict __fd2p,
531 /* Call `rexecd' at port RPORT on remote machine *AHOST to execute
532 CMD. The process runs at the remote machine using the ID of user
533 NAME whose cleartext password is PASSWD. In *FD2P the descriptor
534 to the socket for the connection is returned. When the function
535 returns *AHOST contains the official host name.
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 rexec (char **__restrict __ahost, int __rport,
542 const char *__restrict __name,
543 const char *__restrict __pass,
544 const char *__restrict __cmd, int *__restrict __fd2p);
546 /* This is the equivalent function where the protocol can be selected
547 and which therefore can be used for IPv6.
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 rexec_af (char **__restrict __ahost, int __rport,
554 const char *__restrict __name,
555 const char *__restrict __pass,
556 const char *__restrict __cmd, int *__restrict __fd2p,
558 libc_hidden_proto(rexec_af)
560 /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER.
561 If SUSER is not zero the user tries to become superuser. Return 0 if
564 This function is not part of POSIX and therefore no official
565 cancellation point. But due to similarity with an POSIX interface
566 or due to the implementation it is a cancellation point and
567 therefore not marked with __THROW. */
568 extern int ruserok (const char *__rhost, int __suser,
569 const char *__remuser, const char *__locuser);
573 /* This is the equivalent function where the protocol can be selected
574 and which therefore can be used for IPv6.
576 This function is not part of POSIX and therefore no official
577 cancellation point. But due to similarity with an POSIX interface
578 or due to the implementation it is a cancellation point and
579 therefore not marked with __THROW. */
580 extern int ruserok_af (const char *__rhost, int __suser,
581 const char *__remuser, const char *__locuser,
585 /* Try to allocate reserved port, returning a descriptor for a socket opened
586 at this port or -1 if unsuccessful. The search for an available port
587 will start at ALPORT and continues with lower numbers.
589 This function is not part of POSIX and therefore no official
590 cancellation point. But due to similarity with an POSIX interface
591 or due to the implementation it is a cancellation point and
592 therefore not marked with __THROW. */
593 extern int rresvport (int *__alport);
594 libc_hidden_proto(rresvport)
598 /* This is the equivalent function where the protocol can be selected
599 and which therefore can be used for IPv6.
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 rresvport_af (int *__alport, sa_family_t __af);
610 /* Extension from POSIX.1g. */
612 /* Structure to contain information about address of a service provider. */
615 int ai_flags; /* Input flags. */
616 int ai_family; /* Protocol family for socket. */
617 int ai_socktype; /* Socket type. */
618 int ai_protocol; /* Protocol for socket. */
619 socklen_t ai_addrlen; /* Length of socket address. */
620 struct sockaddr *ai_addr; /* Socket address for socket. */
621 char *ai_canonname; /* Canonical name for service location. */
622 struct addrinfo *ai_next; /* Pointer to next in list. */
625 /* Possible values for `ai_flags' field in `addrinfo' structure. */
626 # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
627 # define AI_CANONNAME 0x0002 /* Request for canonical name. */
628 # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
629 # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
630 # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
631 # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
632 returned address type.. */
634 # define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded
635 in the current locale's character set)
636 before looking it up. */
637 # define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
638 # define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode
640 # define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to
643 # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
645 /* Error values for `getaddrinfo' function. */
646 # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
647 # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
648 # define EAI_AGAIN -3 /* Temporary failure in name resolution. */
649 # define EAI_FAIL -4 /* Non-recoverable failure in name res. */
650 # define EAI_FAMILY -6 /* `ai_family' not supported. */
651 # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
652 # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
653 # define EAI_MEMORY -10 /* Memory allocation failure. */
654 # define EAI_SYSTEM -11 /* System error returned in `errno'. */
655 # define EAI_OVERFLOW -12 /* Argument buffer overflow. */
657 # define EAI_NODATA -5 /* No address associated with NAME. */
658 # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
659 # define EAI_INPROGRESS -100 /* Processing request in progress. */
660 # define EAI_CANCELED -101 /* Request canceled. */
661 # define EAI_NOTCANCELED -102 /* Request not canceled. */
662 # define EAI_ALLDONE -103 /* All requests done. */
663 # define EAI_INTR -104 /* Interrupted by a signal. */
664 # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
668 # define NI_MAXHOST 1025
669 # define NI_MAXSERV 32
672 # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
673 # define NI_NUMERICSERV 2 /* Don't convert port number to name. */
674 # define NI_NOFQDN 4 /* Only return nodename portion. */
675 # define NI_NAMEREQD 8 /* Don't return numeric addresses. */
676 # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
678 # define NI_IDN 32 /* Convert name from IDN format. */
679 # define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode
681 # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to
685 /* Translate name of a service location and/or a service name to set of
688 This function is a possible cancellation point and therefore not
689 marked with __THROW. */
690 extern int getaddrinfo (const char *__restrict __name,
691 const char *__restrict __service,
692 const struct addrinfo *__restrict __req,
693 struct addrinfo **__restrict __pai);
694 libc_hidden_proto(getaddrinfo)
696 /* Free `addrinfo' structure AI including associated storage. */
697 extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
698 libc_hidden_proto(freeaddrinfo)
700 /* Convert error return from getaddrinfo() to a string. */
701 extern const char *gai_strerror (int __ecode) __THROW;
703 /* Translate a socket address to a location and service name.
705 This function is a possible cancellation point and therefore not
706 marked with __THROW. */
707 extern int getnameinfo (const struct sockaddr *__restrict __sa,
708 socklen_t __salen, char *__restrict __host,
709 socklen_t __hostlen, char *__restrict __serv,
710 socklen_t __servlen, unsigned int __flags);
711 libc_hidden_proto(getnameinfo)