1 /* Copyright (C) 1996-2002, 2003, 2004 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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
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
28 #include <netinet/in.h>
30 #if defined __USE_MISC && defined __UCLIBC_HAS_RPC__
31 /* This is necessary to make this include file properly replace the
33 # include <rpc/netdb.h>
37 # define __need_sigevent_t
38 # include <bits/siginfo.h>
39 # define __need_timespec
43 #include <bits/netdb.h>
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"
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 ())
60 /* Function to get address of global `h_errno' variable. */
61 extern int *__h_errno_location (void) __THROW
__attribute__ ((__const__
));
62 libc_hidden_proto(__h_errno_location
)
64 /* Macros for accessing h_errno from inside libc. */
66 # ifdef __UCLIBC_HAS_THREADS__
67 # if defined __UCLIBC_HAS_TLS__ \
68 && (!defined NOT_IN_libc || defined IS_IN_libpthread)
71 # define h_errno __libc_h_errno
73 # define h_errno h_errno /* For #ifndef h_errno tests. */
75 extern __thread
int h_errno attribute_tls_model_ie
;
76 # define __set_h_errno(x) (h_errno = (x))
78 static inline int __set_h_errno (int __err
)
80 return *__h_errno_location () = __err
;
82 # endif /* __UCLIBC_HAS_TLS__ */
85 # define __set_h_errno(x) (h_errno = (x))
87 # endif /* __UCLIBC_HAS_THREADS__ */
90 /* Possible values left in `h_errno'. */
91 #define NETDB_INTERNAL -1 /* See errno. */
92 #define NETDB_SUCCESS 0 /* No problem. */
93 #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
94 #define TRY_AGAIN 2 /* Non-Authoritative Host not found,
96 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED,
98 #define NO_DATA 4 /* Valid name, no data record of requested
100 #define NO_ADDRESS NO_DATA /* No address, look for MX record. */
103 /* Highest reserved Internet port number. */
104 # define IPPORT_RESERVED 1024
108 /* Scope delimiter for getaddrinfo(), getnameinfo(). */
109 # define SCOPE_DELIMITER '%'
112 /* Print error indicated by `h_errno' variable on standard error. STR
113 if non-null is printed before the error string. */
114 extern void herror (__const
char *__str
) __THROW
;
115 libc_hidden_proto(herror
)
117 /* Return string associated with error ERR_NUM. */
118 extern __const
char *hstrerror (int __err_num
) __THROW
;
121 /* Description of data base entry for a single host. */
124 char *h_name
; /* Official name of host. */
125 char **h_aliases
; /* Alias list. */
126 int h_addrtype
; /* Host address type. */
127 int h_length
; /* Length of address. */
128 char **h_addr_list
; /* List of addresses from name server. */
129 #define h_addr h_addr_list[0] /* Address, for backward compatibility. */
132 /* Open host data base files and mark them as staying open even after
133 a later search if STAY_OPEN is non-zero.
135 This function is a possible cancellation point and therefore not
136 marked with __THROW. */
137 extern void sethostent (int __stay_open
);
139 /* Close host data base files and clear `stay open' flag.
141 This function is a possible cancellation point and therefore not
142 marked with __THROW. */
143 extern void endhostent (void);
145 /* Get next entry from host data base file. Open data base if
148 This function is a possible cancellation point and therefore not
149 marked with __THROW. */
150 extern struct hostent
*gethostent (void);
152 /* Return entry from host data base which address match ADDR with
153 length LEN and type TYPE.
155 This function is a possible cancellation point and therefore not
156 marked with __THROW. */
157 extern struct hostent
*gethostbyaddr (__const
void *__addr
, __socklen_t __len
,
159 libc_hidden_proto(gethostbyaddr
)
161 /* Return entry from host data base for host with NAME.
163 This function is a possible cancellation point and therefore not
164 marked with __THROW. */
165 extern struct hostent
*gethostbyname (__const
char *__name
);
166 libc_hidden_proto(gethostbyname
)
169 /* Return entry from host data base for host with NAME. AF must be
170 set to the address type which is `AF_INET' for IPv4 or `AF_INET6'
173 This function is not part of POSIX and therefore no official
174 cancellation point. But due to similarity with an POSIX interface
175 or due to the implementation it is a cancellation point and
176 therefore not marked with __THROW. */
177 extern struct hostent
*gethostbyname2 (__const
char *__name
, int __af
);
178 libc_hidden_proto(gethostbyname2
)
180 /* Reentrant versions of the functions above. The additional
181 arguments specify a buffer of BUFLEN starting at BUF. The last
182 argument is a pointer to a variable which gets the value which
183 would be stored in the global variable `herrno' by the
184 non-reentrant functions.
186 These functions are not part of POSIX and therefore no official
187 cancellation point. But due to similarity with an POSIX interface
188 or due to the implementation they are cancellation points and
189 therefore not marked with __THROW. */
190 extern int gethostent_r (struct hostent
*__restrict __result_buf
,
191 char *__restrict __buf
, size_t __buflen
,
192 struct hostent
**__restrict __result
,
193 int *__restrict __h_errnop
);
194 libc_hidden_proto(gethostent_r
)
196 extern int gethostbyaddr_r (__const
void *__restrict __addr
, __socklen_t __len
,
198 struct hostent
*__restrict __result_buf
,
199 char *__restrict __buf
, size_t __buflen
,
200 struct hostent
**__restrict __result
,
201 int *__restrict __h_errnop
);
202 libc_hidden_proto(gethostbyaddr_r
)
204 extern int gethostbyname_r (__const
char *__restrict __name
,
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(gethostbyname_r
)
211 extern int gethostbyname2_r (__const
char *__restrict __name
, int __af
,
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(gethostbyname2_r
)
220 /* Open network data base files and mark them as staying open even
221 after a later search if STAY_OPEN is non-zero.
223 This function is a possible cancellation point and therefore not
224 marked with __THROW. */
225 extern void setnetent (int __stay_open
);
226 libc_hidden_proto(setnetent
)
228 /* Close network data base files and clear `stay open' flag.
230 This function is a possible cancellation point and therefore not
231 marked with __THROW. */
232 extern void endnetent (void);
233 libc_hidden_proto(endnetent
)
235 /* Get next entry from network data base file. Open data base if
238 This function is a possible cancellation point and therefore not
239 marked with __THROW. */
240 extern struct netent
*getnetent (void);
242 /* Return entry from network data base which address match NET and
245 This function is a possible cancellation point and therefore not
246 marked with __THROW. */
247 extern struct netent
*getnetbyaddr (uint32_t __net
, int __type
);
249 /* Return entry from network data base for network with NAME.
251 This function is a possible cancellation point and therefore not
252 marked with __THROW. */
253 extern struct netent
*getnetbyname (__const
char *__name
);
256 /* Reentrant versions of the functions above. The additional
257 arguments specify a buffer of BUFLEN starting at BUF. The last
258 argument is a pointer to a variable which gets the value which
259 would be stored in the global variable `herrno' by the
260 non-reentrant functions.
262 These functions are not part of POSIX and therefore no official
263 cancellation point. But due to similarity with an POSIX interface
264 or due to the implementation they are cancellation points and
265 therefore not marked with __THROW. */
266 extern int getnetent_r (struct netent
*__restrict __result_buf
,
267 char *__restrict __buf
, size_t __buflen
,
268 struct netent
**__restrict __result
,
269 int *__restrict __h_errnop
);
270 libc_hidden_proto(getnetent_r
)
271 extern int getnetbyaddr_r (uint32_t __net
, int __type
,
272 struct netent
*__restrict __result_buf
,
273 char *__restrict __buf
, size_t __buflen
,
274 struct netent
**__restrict __result
,
275 int *__restrict __h_errnop
);
276 libc_hidden_proto(getnetbyaddr_r
)
277 extern int getnetbyname_r (__const
char *__restrict __name
,
278 struct netent
*__restrict __result_buf
,
279 char *__restrict __buf
, size_t __buflen
,
280 struct netent
**__restrict __result
,
281 int *__restrict __h_errnop
);
282 libc_hidden_proto(getnetbyname_r
)
283 #endif /* __USE_MISC */
286 /* Description of data base entry for a single service. */
289 char *s_name
; /* Official service name. */
290 char **s_aliases
; /* Alias list. */
291 int s_port
; /* Port number. */
292 char *s_proto
; /* Protocol to use. */
295 /* Open service data base files and mark them as staying open even
296 after a later search if STAY_OPEN is non-zero.
298 This function is a possible cancellation point and therefore not
299 marked with __THROW. */
300 extern void setservent (int __stay_open
);
301 libc_hidden_proto(setservent
)
303 /* Close service data base files and clear `stay open' flag.
305 This function is a possible cancellation point and therefore not
306 marked with __THROW. */
307 extern void endservent (void);
308 libc_hidden_proto(endservent
)
310 /* Get next entry from service data base file. Open data base if
313 This function is a possible cancellation point and therefore not
314 marked with __THROW. */
315 extern struct servent
*getservent (void);
317 /* Return entry from network data base for network with NAME and
320 This function is a possible cancellation point and therefore not
321 marked with __THROW. */
322 extern struct servent
*getservbyname (__const
char *__name
,
323 __const
char *__proto
);
325 /* Return entry from service data base which matches port PORT and
328 This function is a possible cancellation point and therefore not
329 marked with __THROW. */
330 extern struct servent
*getservbyport (int __port
, __const
char *__proto
);
331 libc_hidden_proto(getservbyport
)
335 /* Reentrant versions of the functions above. The additional
336 arguments specify a buffer of BUFLEN starting at BUF.
338 These functions are not part of POSIX and therefore no official
339 cancellation point. But due to similarity with an POSIX interface
340 or due to the implementation they are cancellation points and
341 therefore not marked with __THROW. */
342 extern int getservent_r (struct servent
*__restrict __result_buf
,
343 char *__restrict __buf
, size_t __buflen
,
344 struct servent
**__restrict __result
);
345 libc_hidden_proto(getservent_r
)
347 extern int getservbyname_r (__const
char *__restrict __name
,
348 __const
char *__restrict __proto
,
349 struct servent
*__restrict __result_buf
,
350 char *__restrict __buf
, size_t __buflen
,
351 struct servent
**__restrict __result
);
352 libc_hidden_proto(getservbyname_r
)
354 extern int getservbyport_r (int __port
, __const
char *__restrict __proto
,
355 struct servent
*__restrict __result_buf
,
356 char *__restrict __buf
, size_t __buflen
,
357 struct servent
**__restrict __result
);
358 libc_hidden_proto(getservbyport_r
)
362 /* Description of data base entry for a single service. */
365 char *p_name
; /* Official protocol name. */
366 char **p_aliases
; /* Alias list. */
367 int p_proto
; /* Protocol number. */
370 /* Open protocol data base files and mark them as staying open even
371 after a later search if STAY_OPEN is non-zero.
373 This function is a possible cancellation point and therefore not
374 marked with __THROW. */
375 extern void setprotoent (int __stay_open
);
376 libc_hidden_proto(setprotoent
)
378 /* Close protocol data base files and clear `stay open' flag.
380 This function is a possible cancellation point and therefore not
381 marked with __THROW. */
382 extern void endprotoent (void);
383 libc_hidden_proto(endprotoent
)
385 /* Get next entry from protocol data base file. Open data base if
388 This function is a possible cancellation point and therefore not
389 marked with __THROW. */
390 extern struct protoent
*getprotoent (void);
392 /* Return entry from protocol data base for network with NAME.
394 This function is a possible cancellation point and therefore not
395 marked with __THROW. */
396 extern struct protoent
*getprotobyname (__const
char *__name
);
398 /* Return entry from protocol data base which number is PROTO.
400 This function is a possible cancellation point and therefore not
401 marked with __THROW. */
402 extern struct protoent
*getprotobynumber (int __proto
);
406 /* Reentrant versions of the functions above. The additional
407 arguments specify a buffer of BUFLEN starting at BUF.
409 These functions are 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 they are cancellation points and
412 therefore not marked with __THROW. */
413 extern int getprotoent_r (struct protoent
*__restrict __result_buf
,
414 char *__restrict __buf
, size_t __buflen
,
415 struct protoent
**__restrict __result
);
416 libc_hidden_proto(getprotoent_r
)
418 extern int getprotobyname_r (__const
char *__restrict __name
,
419 struct protoent
*__restrict __result_buf
,
420 char *__restrict __buf
, size_t __buflen
,
421 struct protoent
**__restrict __result
);
422 libc_hidden_proto(getprotobyname_r
)
424 extern int getprotobynumber_r (int __proto
,
425 struct protoent
*__restrict __result_buf
,
426 char *__restrict __buf
, size_t __buflen
,
427 struct protoent
**__restrict __result
);
428 libc_hidden_proto(getprotobynumber_r
)
431 #ifdef __UCLIBC_HAS_NETGROUP__
432 /* Establish network group NETGROUP for enumeration.
434 This function is not part of POSIX and therefore no official
435 cancellation point. But due to similarity with an POSIX interface
436 or due to the implementation it is a cancellation point and
437 therefore not marked with __THROW. */
438 extern int setnetgrent (__const
char *__netgroup
);
440 /* Free all space allocated by previous `setnetgrent' call.
442 This function is not part of POSIX and therefore no official
443 cancellation point. But due to similarity with an POSIX interface
444 or due to the implementation it is a cancellation point and
445 therefore not marked with __THROW. */
446 extern void endnetgrent (void);
448 /* Get next member of netgroup established by last `setnetgrent' call
449 and return pointers to elements in HOSTP, USERP, and DOMAINP.
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 getnetgrent (char **__restrict __hostp
,
456 char **__restrict __userp
,
457 char **__restrict __domainp
);
460 /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN).
462 This function is not part of POSIX and therefore no official
463 cancellation point. But due to similarity with an POSIX interface
464 or due to the implementation it is a cancellation point and
465 therefore not marked with __THROW. */
466 extern int innetgr (__const
char *__netgroup
, __const
char *__host
,
467 __const
char *__user
, __const
char *domain
);
469 /* Reentrant version of `getnetgrent' where result is placed in BUFFER.
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 getnetgrent_r (char **__restrict __hostp
,
476 char **__restrict __userp
,
477 char **__restrict __domainp
,
478 char *__restrict __buffer
, size_t __buflen
);
479 #endif /* UCLIBC_HAS_NETGROUP */
483 /* ruserpass - remote password check.
484 This function also exists in glibc but is undocumented */
485 extern int ruserpass(const char *host
, const char **aname
, const char **apass
);
486 libc_hidden_proto(ruserpass
)
490 /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD.
491 The local user is LOCUSER, on the remote machine the command is
492 executed as REMUSER. In *FD2P the descriptor to the socket for the
493 connection is returned. The caller must have the right to use a
494 reserved port. When the function returns *AHOST contains the
497 This function is not part of POSIX and therefore no official
498 cancellation point. But due to similarity with an POSIX interface
499 or due to the implementation it is a cancellation point and
500 therefore not marked with __THROW. */
501 extern int rcmd (char **__restrict __ahost
, unsigned short int __rport
,
502 __const
char *__restrict __locuser
,
503 __const
char *__restrict __remuser
,
504 __const
char *__restrict __cmd
, int *__restrict __fd2p
);
508 /* This is the equivalent function where the protocol can be selected
509 and which therefore can be used for IPv6.
511 This function is not part of POSIX and therefore no official
512 cancellation point. But due to similarity with an POSIX interface
513 or due to the implementation it is a cancellation point and
514 therefore not marked with __THROW. */
515 extern int rcmd_af (char **__restrict __ahost
, unsigned short int __rport
,
516 __const
char *__restrict __locuser
,
517 __const
char *__restrict __remuser
,
518 __const
char *__restrict __cmd
, int *__restrict __fd2p
,
522 /* Call `rexecd' at port RPORT on remote machine *AHOST to execute
523 CMD. The process runs at the remote machine using the ID of user
524 NAME whose cleartext password is PASSWD. In *FD2P the descriptor
525 to the socket for the connection is returned. When the function
526 returns *AHOST contains the official host name.
528 This function is not part of POSIX and therefore no official
529 cancellation point. But due to similarity with an POSIX interface
530 or due to the implementation it is a cancellation point and
531 therefore not marked with __THROW. */
532 extern int rexec (char **__restrict __ahost
, int __rport
,
533 __const
char *__restrict __name
,
534 __const
char *__restrict __pass
,
535 __const
char *__restrict __cmd
, int *__restrict __fd2p
);
537 /* This is the equivalent function where the protocol can be selected
538 and which therefore can be used for IPv6.
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. */
544 extern int rexec_af (char **__restrict __ahost
, int __rport
,
545 __const
char *__restrict __name
,
546 __const
char *__restrict __pass
,
547 __const
char *__restrict __cmd
, int *__restrict __fd2p
,
549 libc_hidden_proto(rexec_af
)
551 /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER.
552 If SUSER is not zero the user tries to become superuser. Return 0 if
555 This function is not part of POSIX and therefore no official
556 cancellation point. But due to similarity with an POSIX interface
557 or due to the implementation it is a cancellation point and
558 therefore not marked with __THROW. */
559 extern int ruserok (__const
char *__rhost
, int __suser
,
560 __const
char *__remuser
, __const
char *__locuser
);
564 /* This is the equivalent function where the protocol can be selected
565 and which therefore can be used for IPv6.
567 This function is not part of POSIX and therefore no official
568 cancellation point. But due to similarity with an POSIX interface
569 or due to the implementation it is a cancellation point and
570 therefore not marked with __THROW. */
571 extern int ruserok_af (__const
char *__rhost
, int __suser
,
572 __const
char *__remuser
, __const
char *__locuser
,
576 /* Try to allocate reserved port, returning a descriptor for a socket opened
577 at this port or -1 if unsuccessful. The search for an available port
578 will start at ALPORT and continues with lower numbers.
580 This function is not part of POSIX and therefore no official
581 cancellation point. But due to similarity with an POSIX interface
582 or due to the implementation it is a cancellation point and
583 therefore not marked with __THROW. */
584 extern int rresvport (int *__alport
);
585 libc_hidden_proto(rresvport
)
589 /* This is the equivalent function where the protocol can be selected
590 and which therefore can be used for IPv6.
592 This function is not part of POSIX and therefore no official
593 cancellation point. But due to similarity with an POSIX interface
594 or due to the implementation it is a cancellation point and
595 therefore not marked with __THROW. */
596 extern int rresvport_af (int *__alport
, sa_family_t __af
);
601 /* Extension from POSIX.1g. */
603 /* Structure to contain information about address of a service provider. */
606 int ai_flags
; /* Input flags. */
607 int ai_family
; /* Protocol family for socket. */
608 int ai_socktype
; /* Socket type. */
609 int ai_protocol
; /* Protocol for socket. */
610 socklen_t ai_addrlen
; /* Length of socket address. */
611 struct sockaddr
*ai_addr
; /* Socket address for socket. */
612 char *ai_canonname
; /* Canonical name for service location. */
613 struct addrinfo
*ai_next
; /* Pointer to next in list. */
616 /* Possible values for `ai_flags' field in `addrinfo' structure. */
617 # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
618 # define AI_CANONNAME 0x0002 /* Request for canonical name. */
619 # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
620 # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
621 # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
622 # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
623 returned address type.. */
625 # define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded
626 in the current locale's character set)
627 before looking it up. */
628 # define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
629 # define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode
631 # define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to
634 # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
636 /* Error values for `getaddrinfo' function. */
637 # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
638 # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
639 # define EAI_AGAIN -3 /* Temporary failure in name resolution. */
640 # define EAI_FAIL -4 /* Non-recoverable failure in name res. */
641 # define EAI_NODATA -5 /* No address associated with NAME. */
642 # define EAI_FAMILY -6 /* `ai_family' not supported. */
643 # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
644 # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
645 # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
646 # define EAI_MEMORY -10 /* Memory allocation failure. */
647 # define EAI_SYSTEM -11 /* System error returned in `errno'. */
648 # define EAI_OVERFLOW -12 /* Argument buffer overflow. */
650 # define EAI_INPROGRESS -100 /* Processing request in progress. */
651 # define EAI_CANCELED -101 /* Request canceled. */
652 # define EAI_NOTCANCELED -102 /* Request not canceled. */
653 # define EAI_ALLDONE -103 /* All requests done. */
654 # define EAI_INTR -104 /* Interrupted by a signal. */
655 # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
658 # define NI_MAXHOST 1025
659 # define NI_MAXSERV 32
661 # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
662 # define NI_NUMERICSERV 2 /* Don't convert port number to name. */
663 # define NI_NOFQDN 4 /* Only return nodename portion. */
664 # define NI_NAMEREQD 8 /* Don't return numeric addresses. */
665 # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
667 # define NI_IDN 32 /* Convert name from IDN format. */
668 # define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode
670 # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to
674 /* Translate name of a service location and/or a service name to set of
677 This function is a possible cancellation point and therefore not
678 marked with __THROW. */
679 extern int getaddrinfo (__const
char *__restrict __name
,
680 __const
char *__restrict __service
,
681 __const
struct addrinfo
*__restrict __req
,
682 struct addrinfo
**__restrict __pai
);
683 libc_hidden_proto(getaddrinfo
)
685 /* Free `addrinfo' structure AI including associated storage. */
686 extern void freeaddrinfo (struct addrinfo
*__ai
) __THROW
;
687 libc_hidden_proto(freeaddrinfo
)
689 /* Convert error return from getaddrinfo() to a string. */
690 extern __const
char *gai_strerror (int __ecode
) __THROW
;
692 /* Translate a socket address to a location and service name.
694 This function is a possible cancellation point and therefore not
695 marked with __THROW. */
696 extern int getnameinfo (__const
struct sockaddr
*__restrict __sa
,
697 socklen_t __salen
, char *__restrict __host
,
698 socklen_t __hostlen
, char *__restrict __serv
,
699 socklen_t __servlen
, unsigned int __flags
);
700 libc_hidden_proto(getnameinfo
)