nptl: remove sysdep-cancel ASM macros, convert to C
[uclibc-ng.git] / include / netdb.h
bloba85797956f28cfeae0a6f48817606df6a74a98b3
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
20 system calls). */
22 #ifndef _NETDB_H
23 #define _NETDB_H 1
25 #include <features.h>
27 #include <netinet/in.h>
28 #include <stdint.h>
30 #ifdef __USE_GNU
31 # define __need_sigevent_t
32 # include <bits/siginfo.h>
33 # define __need_timespec
34 # include <time.h>
35 #endif
37 #include <bits/netdb.h>
39 /* Absolute file name for network data base files. */
40 #define _PATH_HEQUIV "/etc/hosts.equiv"
41 #define _PATH_HOSTS "/etc/hosts"
42 #define _PATH_NETWORKS "/etc/networks"
43 #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf"
44 #define _PATH_PROTOCOLS "/etc/protocols"
45 #define _PATH_SERVICES "/etc/services"
48 __BEGIN_DECLS
50 /* Error status for non-reentrant lookup functions.
51 We use a macro to access always the thread-specific `h_errno' variable. */
52 #define h_errno (*__h_errno_location ())
54 /* Function to get address of global `h_errno' variable. */
55 extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
57 /* Macros for accessing h_errno from inside libc. */
58 #ifdef _LIBC
59 # ifdef __UCLIBC_HAS_THREADS__
60 # if defined __UCLIBC_HAS_TLS__ \
61 && (!defined NOT_IN_libc || defined IS_IN_libpthread)
62 # undef h_errno
63 # ifndef NOT_IN_libc
64 # define h_errno __libc_h_errno
65 # else
66 # define h_errno h_errno /* For #ifndef h_errno tests. */
67 # endif
68 extern __thread int h_errno attribute_tls_model_ie;
69 # define __set_h_errno(x) (h_errno = (x))
70 # else
71 static inline int __set_h_errno (int __err)
73 return *__h_errno_location () = __err;
75 # endif /* __UCLIBC_HAS_TLS__ */
76 # else
77 # undef h_errno
78 # define __set_h_errno(x) (h_errno = (x))
79 extern int h_errno;
80 # endif /* __UCLIBC_HAS_THREADS__ */
81 #endif /* _LIBC */
83 /* Possible values left in `h_errno'. */
84 #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
85 #define TRY_AGAIN 2 /* Non-Authoritative Host not found,
86 or SERVERFAIL. */
87 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED,
88 NOTIMP. */
89 #define NO_DATA 4 /* Valid name, no data record of requested
90 type. */
91 #if defined __USE_MISC || defined __USE_GNU
92 # define NETDB_INTERNAL -1 /* See errno. */
93 # define NETDB_SUCCESS 0 /* No problem. */
94 # define NO_ADDRESS NO_DATA /* No address, look for MX record. */
95 #endif
97 #ifdef __USE_XOPEN2K
98 /* Highest reserved Internet port number. */
99 # define IPPORT_RESERVED 1024
100 #endif
102 #ifdef __USE_GNU
103 /* Scope delimiter for getaddrinfo(), getnameinfo(). */
104 # define SCOPE_DELIMITER '%'
105 #endif
107 #if defined __USE_MISC || defined __USE_GNU
108 /* Print error indicated by `h_errno' variable on standard error. STR
109 if non-null is printed before the error string. */
110 extern void herror (const char *__str) __THROW;
111 libc_hidden_proto(herror)
113 /* Return string associated with error ERR_NUM. */
114 extern const char *hstrerror (int __err_num) __THROW;
115 #endif
118 /* Description of data base entry for a single host. */
119 struct hostent
121 char *h_name; /* Official name of host. */
122 char **h_aliases; /* Alias list. */
123 int h_addrtype; /* Host address type. */
124 int h_length; /* Length of address. */
125 char **h_addr_list; /* List of addresses from name server. */
126 #if defined __USE_MISC || defined __USE_GNU
127 # define h_addr h_addr_list[0] /* Address, for backward compatibility.*/
128 #endif
131 /* Open host data base files and mark them as staying open even after
132 a later search if STAY_OPEN is non-zero.
134 This function is a possible cancellation point and therefore not
135 marked with __THROW. */
136 extern void sethostent (int __stay_open);
138 /* Close host data base files and clear `stay open' flag.
140 This function is a possible cancellation point and therefore not
141 marked with __THROW. */
142 extern void endhostent (void);
144 /* Get next entry from host data base file. Open data base if
145 necessary.
147 This function is a possible cancellation point and therefore not
148 marked with __THROW. */
149 extern struct hostent *gethostent (void);
151 /* Return entry from host data base which address match ADDR with
152 length LEN and type TYPE.
154 This function is a possible cancellation point and therefore not
155 marked with __THROW. */
156 extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len,
157 int __type);
158 libc_hidden_proto(gethostbyaddr)
160 /* Return entry from host data base for host with NAME.
162 This function is a possible cancellation point and therefore not
163 marked with __THROW. */
164 extern struct hostent *gethostbyname (const char *__name);
165 libc_hidden_proto(gethostbyname)
167 #ifdef __USE_MISC
168 /* Return entry from host data base for host with NAME. AF must be
169 set to the address type which is `AF_INET' for IPv4 or `AF_INET6'
170 for IPv6.
172 This function is not part of POSIX and therefore no official
173 cancellation point. But due to similarity with an POSIX interface
174 or due to the implementation it is a cancellation point and
175 therefore not marked with __THROW. */
176 extern struct hostent *gethostbyname2 (const char *__name, int __af);
177 libc_hidden_proto(gethostbyname2)
179 /* Reentrant versions of the functions above. The additional
180 arguments specify a buffer of BUFLEN starting at BUF. The last
181 argument is a pointer to a variable which gets the value which
182 would be stored in the global variable `herrno' by the
183 non-reentrant functions.
185 These functions are not part of POSIX and therefore no official
186 cancellation point. But due to similarity with an POSIX interface
187 or due to the implementation they are cancellation points and
188 therefore not marked with __THROW. */
189 extern int gethostent_r (struct hostent *__restrict __result_buf,
190 char *__restrict __buf, size_t __buflen,
191 struct hostent **__restrict __result,
192 int *__restrict __h_errnop);
193 libc_hidden_proto(gethostent_r)
195 extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len,
196 int __type,
197 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(gethostbyaddr_r)
203 extern int gethostbyname_r (const char *__restrict __name,
204 struct hostent *__restrict __result_buf,
205 char *__restrict __buf, size_t __buflen,
206 struct hostent **__restrict __result,
207 int *__restrict __h_errnop);
208 libc_hidden_proto(gethostbyname_r)
210 extern int gethostbyname2_r (const char *__restrict __name, int __af,
211 struct hostent *__restrict __result_buf,
212 char *__restrict __buf, size_t __buflen,
213 struct hostent **__restrict __result,
214 int *__restrict __h_errnop);
215 libc_hidden_proto(gethostbyname2_r)
216 #endif /* misc */
219 /* Open network data base files and mark them as staying open even
220 after a later search if STAY_OPEN is non-zero.
222 This function is a possible cancellation point and therefore not
223 marked with __THROW. */
224 extern void setnetent (int __stay_open);
225 libc_hidden_proto(setnetent)
227 /* Close network data base files and clear `stay open' flag.
229 This function is a possible cancellation point and therefore not
230 marked with __THROW. */
231 extern void endnetent (void);
232 libc_hidden_proto(endnetent)
234 /* Get next entry from network data base file. Open data base if
235 necessary.
237 This function is a possible cancellation point and therefore not
238 marked with __THROW. */
239 extern struct netent *getnetent (void);
241 /* Return entry from network data base which address match NET and
242 type TYPE.
244 This function is a possible cancellation point and therefore not
245 marked with __THROW. */
246 extern struct netent *getnetbyaddr (uint32_t __net, int __type);
248 /* Return entry from network data base for network with NAME.
250 This function is a possible cancellation point and therefore not
251 marked with __THROW. */
252 extern struct netent *getnetbyname (const char *__name);
254 #ifdef __USE_MISC
255 /* Reentrant versions of the functions above. The additional
256 arguments specify a buffer of BUFLEN starting at BUF. The last
257 argument is a pointer to a variable which gets the value which
258 would be stored in the global variable `herrno' by the
259 non-reentrant functions.
261 These functions are not part of POSIX and therefore no official
262 cancellation point. But due to similarity with an POSIX interface
263 or due to the implementation they are cancellation points and
264 therefore not marked with __THROW. */
265 extern int getnetent_r (struct netent *__restrict __result_buf,
266 char *__restrict __buf, size_t __buflen,
267 struct netent **__restrict __result,
268 int *__restrict __h_errnop);
269 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)
278 extern int getnetbyname_r (const char *__restrict __name,
279 struct netent *__restrict __result_buf,
280 char *__restrict __buf, size_t __buflen,
281 struct netent **__restrict __result,
282 int *__restrict __h_errnop);
283 libc_hidden_proto(getnetbyname_r)
284 #endif /* __USE_MISC */
287 /* Description of data base entry for a single service. */
288 struct servent
290 char *s_name; /* Official service name. */
291 char **s_aliases; /* Alias list. */
292 int s_port; /* Port number. */
293 char *s_proto; /* Protocol to use. */
296 /* Open service data base files and mark them as staying open even
297 after a later search if STAY_OPEN is non-zero.
299 This function is a possible cancellation point and therefore not
300 marked with __THROW. */
301 extern void setservent (int __stay_open);
302 libc_hidden_proto(setservent)
304 /* Close service data base files and clear `stay open' flag.
306 This function is a possible cancellation point and therefore not
307 marked with __THROW. */
308 extern void endservent (void);
309 libc_hidden_proto(endservent)
311 /* Get next entry from service data base file. Open data base if
312 necessary.
314 This function is a possible cancellation point and therefore not
315 marked with __THROW. */
316 extern struct servent *getservent (void);
318 /* Return entry from network data base for network with NAME and
319 protocol PROTO.
321 This function is a possible cancellation point and therefore not
322 marked with __THROW. */
323 extern struct servent *getservbyname (const char *__name,
324 const char *__proto);
326 /* Return entry from service data base which matches port PORT and
327 protocol PROTO.
329 This function is a possible cancellation point and therefore not
330 marked with __THROW. */
331 extern struct servent *getservbyport (int __port, const char *__proto);
332 libc_hidden_proto(getservbyport)
335 #ifdef __USE_MISC
336 /* Reentrant versions of the functions above. The additional
337 arguments specify a buffer of BUFLEN starting at BUF.
339 These functions are not part of POSIX and therefore no official
340 cancellation point. But due to similarity with an POSIX interface
341 or due to the implementation they are cancellation points and
342 therefore not marked with __THROW. */
343 extern int getservent_r (struct servent *__restrict __result_buf,
344 char *__restrict __buf, size_t __buflen,
345 struct servent **__restrict __result);
346 libc_hidden_proto(getservent_r)
348 extern int getservbyname_r (const char *__restrict __name,
349 const char *__restrict __proto,
350 struct servent *__restrict __result_buf,
351 char *__restrict __buf, size_t __buflen,
352 struct servent **__restrict __result);
353 libc_hidden_proto(getservbyname_r)
355 extern int getservbyport_r (int __port, const char *__restrict __proto,
356 struct servent *__restrict __result_buf,
357 char *__restrict __buf, size_t __buflen,
358 struct servent **__restrict __result);
359 libc_hidden_proto(getservbyport_r)
360 #endif /* misc */
363 /* Description of data base entry for a single service. */
364 struct protoent
366 char *p_name; /* Official protocol name. */
367 char **p_aliases; /* Alias list. */
368 int p_proto; /* Protocol number. */
371 /* Open protocol data base files and mark them as staying open even
372 after a later search if STAY_OPEN is non-zero.
374 This function is a possible cancellation point and therefore not
375 marked with __THROW. */
376 extern void setprotoent (int __stay_open);
377 libc_hidden_proto(setprotoent)
379 /* Close protocol data base files and clear `stay open' flag.
381 This function is a possible cancellation point and therefore not
382 marked with __THROW. */
383 extern void endprotoent (void);
384 libc_hidden_proto(endprotoent)
386 /* Get next entry from protocol data base file. Open data base if
387 necessary.
389 This function is a possible cancellation point and therefore not
390 marked with __THROW. */
391 extern struct protoent *getprotoent (void);
393 /* Return entry from protocol data base for network with NAME.
395 This function is a possible cancellation point and therefore not
396 marked with __THROW. */
397 extern struct protoent *getprotobyname (const char *__name);
399 /* Return entry from protocol data base which number is PROTO.
401 This function is a possible cancellation point and therefore not
402 marked with __THROW. */
403 extern struct protoent *getprotobynumber (int __proto);
406 #ifdef __USE_MISC
407 /* Reentrant versions of the functions above. The additional
408 arguments specify a buffer of BUFLEN starting at BUF.
410 These functions are not part of POSIX and therefore no official
411 cancellation point. But due to similarity with an POSIX interface
412 or due to the implementation they are cancellation points and
413 therefore not marked with __THROW. */
414 extern int getprotoent_r (struct protoent *__restrict __result_buf,
415 char *__restrict __buf, size_t __buflen,
416 struct protoent **__restrict __result);
417 libc_hidden_proto(getprotoent_r)
419 extern int getprotobyname_r (const char *__restrict __name,
420 struct protoent *__restrict __result_buf,
421 char *__restrict __buf, size_t __buflen,
422 struct protoent **__restrict __result);
423 libc_hidden_proto(getprotobyname_r)
425 extern int getprotobynumber_r (int __proto,
426 struct protoent *__restrict __result_buf,
427 char *__restrict __buf, size_t __buflen,
428 struct protoent **__restrict __result);
429 libc_hidden_proto(getprotobynumber_r)
432 #ifdef __UCLIBC_HAS_NETGROUP__
433 /* Establish network group NETGROUP for enumeration.
435 This function is not part of POSIX and therefore no official
436 cancellation point. But due to similarity with an POSIX interface
437 or due to the implementation it is a cancellation point and
438 therefore not marked with __THROW. */
439 extern int setnetgrent (const char *__netgroup);
441 /* Free all space allocated by previous `setnetgrent' call.
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 void endnetgrent (void);
449 /* Get next member of netgroup established by last `setnetgrent' call
450 and return pointers to elements in HOSTP, USERP, and DOMAINP.
452 This function is not part of POSIX and therefore no official
453 cancellation point. But due to similarity with an POSIX interface
454 or due to the implementation it is a cancellation point and
455 therefore not marked with __THROW. */
456 extern int getnetgrent (char **__restrict __hostp,
457 char **__restrict __userp,
458 char **__restrict __domainp);
461 /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN).
463 This function is not part of POSIX and therefore no official
464 cancellation point. But due to similarity with an POSIX interface
465 or due to the implementation it is a cancellation point and
466 therefore not marked with __THROW. */
467 extern int innetgr (const char *__netgroup, const char *__host,
468 const char *__user, const char *__domain);
470 /* Reentrant version of `getnetgrent' where result is placed in BUFFER.
472 This function is not part of POSIX and therefore no official
473 cancellation point. But due to similarity with an POSIX interface
474 or due to the implementation it is a cancellation point and
475 therefore not marked with __THROW. */
476 extern int getnetgrent_r (char **__restrict __hostp,
477 char **__restrict __userp,
478 char **__restrict __domainp,
479 char *__restrict __buffer, size_t __buflen);
480 #endif /* UCLIBC_HAS_NETGROUP */
481 #endif /* misc */
483 #ifdef __UCLIBC__
484 /* ruserpass - remote password check.
485 This function also exists in glibc but is undocumented */
486 extern int ruserpass(const char *host, const char **aname, const char **apass);
487 libc_hidden_proto(ruserpass)
488 #endif
490 #ifdef __USE_BSD
491 /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD.
492 The local user is LOCUSER, on the remote machine the command is
493 executed as REMUSER. In *FD2P the descriptor to the socket for the
494 connection is returned. The caller must have the right to use a
495 reserved port. When the function returns *AHOST contains the
496 official host name.
498 This function is not part of POSIX and therefore no official
499 cancellation point. But due to similarity with an POSIX interface
500 or due to the implementation it is a cancellation point and
501 therefore not marked with __THROW. */
502 extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
503 const char *__restrict __locuser,
504 const char *__restrict __remuser,
505 const char *__restrict __cmd, int *__restrict __fd2p);
507 #if 0
508 /* FIXME */
509 /* This is the equivalent function where the protocol can be selected
510 and which therefore can be used for IPv6.
512 This function is not part of POSIX and therefore no official
513 cancellation point. But due to similarity with an POSIX interface
514 or due to the implementation it is a cancellation point and
515 therefore not marked with __THROW. */
516 extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
517 const char *__restrict __locuser,
518 const char *__restrict __remuser,
519 const char *__restrict __cmd, int *__restrict __fd2p,
520 sa_family_t __af);
521 #endif
523 /* Call `rexecd' at port RPORT on remote machine *AHOST to execute
524 CMD. The process runs at the remote machine using the ID of user
525 NAME whose cleartext password is PASSWD. In *FD2P the descriptor
526 to the socket for the connection is returned. When the function
527 returns *AHOST contains the official host name.
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. */
533 extern int rexec (char **__restrict __ahost, int __rport,
534 const char *__restrict __name,
535 const char *__restrict __pass,
536 const char *__restrict __cmd, int *__restrict __fd2p);
538 /* This is the equivalent function where the protocol can be selected
539 and which therefore can be used for IPv6.
541 This function is not part of POSIX and therefore no official
542 cancellation point. But due to similarity with an POSIX interface
543 or due to the implementation it is a cancellation point and
544 therefore not marked with __THROW. */
545 extern int rexec_af (char **__restrict __ahost, int __rport,
546 const char *__restrict __name,
547 const char *__restrict __pass,
548 const char *__restrict __cmd, int *__restrict __fd2p,
549 sa_family_t __af);
550 libc_hidden_proto(rexec_af)
552 /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER.
553 If SUSER is not zero the user tries to become superuser. Return 0 if
554 it is possible.
556 This function is not part of POSIX and therefore no official
557 cancellation point. But due to similarity with an POSIX interface
558 or due to the implementation it is a cancellation point and
559 therefore not marked with __THROW. */
560 extern int ruserok (const char *__rhost, int __suser,
561 const char *__remuser, const char *__locuser);
563 #if 0
564 /* FIXME */
565 /* This is the equivalent function where the protocol can be selected
566 and which therefore can be used for IPv6.
568 This function is not part of POSIX and therefore no official
569 cancellation point. But due to similarity with an POSIX interface
570 or due to the implementation it is a cancellation point and
571 therefore not marked with __THROW. */
572 extern int ruserok_af (const char *__rhost, int __suser,
573 const char *__remuser, const char *__locuser,
574 sa_family_t __af);
575 #endif
577 /* Try to allocate reserved port, returning a descriptor for a socket opened
578 at this port or -1 if unsuccessful. The search for an available port
579 will start at ALPORT and continues with lower numbers.
581 This function is not part of POSIX and therefore no official
582 cancellation point. But due to similarity with an POSIX interface
583 or due to the implementation it is a cancellation point and
584 therefore not marked with __THROW. */
585 extern int rresvport (int *__alport);
586 libc_hidden_proto(rresvport)
588 #if 0
589 /* FIXME */
590 /* This is the equivalent function where the protocol can be selected
591 and which therefore can be used for IPv6.
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 rresvport_af (int *__alport, sa_family_t __af);
598 #endif
599 #endif
602 /* Extension from POSIX.1g. */
603 #ifdef __USE_POSIX
604 /* Structure to contain information about address of a service provider. */
605 struct addrinfo
607 int ai_flags; /* Input flags. */
608 int ai_family; /* Protocol family for socket. */
609 int ai_socktype; /* Socket type. */
610 int ai_protocol; /* Protocol for socket. */
611 socklen_t ai_addrlen; /* Length of socket address. */
612 struct sockaddr *ai_addr; /* Socket address for socket. */
613 char *ai_canonname; /* Canonical name for service location. */
614 struct addrinfo *ai_next; /* Pointer to next in list. */
617 /* Possible values for `ai_flags' field in `addrinfo' structure. */
618 # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
619 # define AI_CANONNAME 0x0002 /* Request for canonical name. */
620 # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
621 # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
622 # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
623 # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
624 returned address type.. */
625 # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
627 /* Error values for `getaddrinfo' function. */
628 # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
629 # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
630 # define EAI_AGAIN -3 /* Temporary failure in name resolution. */
631 # define EAI_FAIL -4 /* Non-recoverable failure in name res. */
632 # define EAI_FAMILY -6 /* `ai_family' not supported. */
633 # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
634 # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
635 # define EAI_MEMORY -10 /* Memory allocation failure. */
636 # define EAI_SYSTEM -11 /* System error returned in `errno'. */
637 # define EAI_OVERFLOW -12 /* Argument buffer overflow. */
638 # ifdef __USE_GNU
639 # define EAI_NODATA -5 /* No address associated with NAME. */
640 # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
641 # define EAI_INPROGRESS -100 /* Processing request in progress. */
642 # define EAI_CANCELED -101 /* Request canceled. */
643 # define EAI_NOTCANCELED -102 /* Request not canceled. */
644 # define EAI_ALLDONE -103 /* All requests done. */
645 # define EAI_INTR -104 /* Interrupted by a signal. */
646 # endif
648 # ifdef __USE_MISC
649 # define NI_MAXHOST 1025
650 # define NI_MAXSERV 32
651 # endif
653 # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
654 # define NI_NUMERICSERV 2 /* Don't convert port number to name. */
655 # define NI_NOFQDN 4 /* Only return nodename portion. */
656 # define NI_NAMEREQD 8 /* Don't return numeric addresses. */
657 # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
658 #if 0 /* uClibc: not implemented */
659 /* # ifdef __USE_GNU */
660 # define NI_IDN 32 /* Convert name from IDN format. */
661 # define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode
662 code points. */
663 # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to
664 STD3 rules. */
665 # endif
667 /* Translate name of a service location and/or a service name to set of
668 socket addresses.
670 This function is a possible cancellation point and therefore not
671 marked with __THROW. */
672 extern int getaddrinfo (const char *__restrict __name,
673 const char *__restrict __service,
674 const struct addrinfo *__restrict __req,
675 struct addrinfo **__restrict __pai);
676 libc_hidden_proto(getaddrinfo)
678 /* Free `addrinfo' structure AI including associated storage. */
679 extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
680 libc_hidden_proto(freeaddrinfo)
682 /* Convert error return from getaddrinfo() to a string. */
683 extern const char *gai_strerror (int __ecode) __THROW;
685 /* Translate a socket address to a location and service name.
687 This function is a possible cancellation point and therefore not
688 marked with __THROW. */
689 extern int getnameinfo (const struct sockaddr *__restrict __sa,
690 socklen_t __salen, char *__restrict __host,
691 socklen_t __hostlen, char *__restrict __serv,
692 socklen_t __servlen, unsigned int __flags);
693 libc_hidden_proto(getnameinfo)
694 #endif /* POSIX */
696 __END_DECLS
698 #endif /* netdb.h */