arm: use common ret_ERRVAL
[uclibc-ng.git] / include / netdb.h
blob95abe95cb152511fb841ac614bdc7d9bb4608e9f
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>
29 #if defined __USE_MISC && defined __UCLIBC_HAS_RPC__
30 /* This is necessary to make this include file properly replace the
31 Sun version. */
32 # include <rpc/netdb.h>
33 #endif
35 #ifdef __USE_GNU
36 # define __need_sigevent_t
37 # include <bits/siginfo.h>
38 # define __need_timespec
39 # include <time.h>
40 #endif
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"
53 __BEGIN_DECLS
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 /* Macros for accessing h_errno from inside libc. */
63 #ifdef _LIBC
64 # ifdef __UCLIBC_HAS_THREADS__
65 # if defined __UCLIBC_HAS_TLS__ \
66 && (!defined NOT_IN_libc || defined IS_IN_libpthread)
67 # undef h_errno
68 # ifndef NOT_IN_libc
69 # define h_errno __libc_h_errno
70 # else
71 # define h_errno h_errno /* For #ifndef h_errno tests. */
72 # endif
73 extern __thread int h_errno attribute_tls_model_ie;
74 # define __set_h_errno(x) (h_errno = (x))
75 # else
76 static inline int __set_h_errno (int __err)
78 return *__h_errno_location () = __err;
80 # endif /* __UCLIBC_HAS_TLS__ */
81 # else
82 # undef h_errno
83 # define __set_h_errno(x) (h_errno = (x))
84 extern int h_errno;
85 # endif /* __UCLIBC_HAS_THREADS__ */
86 #endif /* _LIBC */
88 /* Possible values left in `h_errno'. */
89 #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
90 #define TRY_AGAIN 2 /* Non-Authoritative Host not found,
91 or SERVERFAIL. */
92 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED,
93 NOTIMP. */
94 #define NO_DATA 4 /* Valid name, no data record of requested
95 type. */
96 #if defined __USE_MISC || defined __USE_GNU
97 # define NETDB_INTERNAL -1 /* See errno. */
98 # define NETDB_SUCCESS 0 /* No problem. */
99 # define NO_ADDRESS NO_DATA /* No address, look for MX record. */
100 #endif
102 #ifdef __USE_XOPEN2K
103 /* Highest reserved Internet port number. */
104 # define IPPORT_RESERVED 1024
105 #endif
107 #ifdef __USE_GNU
108 /* Scope delimiter for getaddrinfo(), getnameinfo(). */
109 # define SCOPE_DELIMITER '%'
110 #endif
112 #if defined __USE_MISC || defined __USE_GNU
113 /* Print error indicated by `h_errno' variable on standard error. STR
114 if non-null is printed before the error string. */
115 extern void herror (const char *__str) __THROW;
116 libc_hidden_proto(herror)
118 /* Return string associated with error ERR_NUM. */
119 extern const char *hstrerror (int __err_num) __THROW;
120 #endif
123 /* Description of data base entry for a single host. */
124 struct hostent
126 char *h_name; /* Official name of host. */
127 char **h_aliases; /* Alias list. */
128 int h_addrtype; /* Host address type. */
129 int h_length; /* Length of address. */
130 char **h_addr_list; /* List of addresses from name server. */
131 #if defined __USE_MISC || defined __USE_GNU
132 # define h_addr h_addr_list[0] /* Address, for backward compatibility.*/
133 #endif
136 /* Open host data base files and mark them as staying open even after
137 a later search if STAY_OPEN is non-zero.
139 This function is a possible cancellation point and therefore not
140 marked with __THROW. */
141 extern void sethostent (int __stay_open);
143 /* Close host data base files and clear `stay open' flag.
145 This function is a possible cancellation point and therefore not
146 marked with __THROW. */
147 extern void endhostent (void);
149 /* Get next entry from host data base file. Open data base if
150 necessary.
152 This function is a possible cancellation point and therefore not
153 marked with __THROW. */
154 extern struct hostent *gethostent (void);
156 /* Return entry from host data base which address match ADDR with
157 length LEN and type TYPE.
159 This function is a possible cancellation point and therefore not
160 marked with __THROW. */
161 extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len,
162 int __type);
163 libc_hidden_proto(gethostbyaddr)
165 /* Return entry from host data base for host with NAME.
167 This function is a possible cancellation point and therefore not
168 marked with __THROW. */
169 extern struct hostent *gethostbyname (const char *__name);
170 libc_hidden_proto(gethostbyname)
172 #ifdef __USE_MISC
173 /* Return entry from host data base for host with NAME. AF must be
174 set to the address type which is `AF_INET' for IPv4 or `AF_INET6'
175 for IPv6.
177 This function is not part of POSIX and therefore no official
178 cancellation point. But due to similarity with an POSIX interface
179 or due to the implementation it is a cancellation point and
180 therefore not marked with __THROW. */
181 extern struct hostent *gethostbyname2 (const char *__name, int __af);
182 libc_hidden_proto(gethostbyname2)
184 /* Reentrant versions of the functions above. The additional
185 arguments specify a buffer of BUFLEN starting at BUF. The last
186 argument is a pointer to a variable which gets the value which
187 would be stored in the global variable `herrno' by the
188 non-reentrant functions.
190 These functions are not part of POSIX and therefore no official
191 cancellation point. But due to similarity with an POSIX interface
192 or due to the implementation they are cancellation points and
193 therefore not marked with __THROW. */
194 extern int gethostent_r (struct hostent *__restrict __result_buf,
195 char *__restrict __buf, size_t __buflen,
196 struct hostent **__restrict __result,
197 int *__restrict __h_errnop);
198 libc_hidden_proto(gethostent_r)
200 extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len,
201 int __type,
202 struct hostent *__restrict __result_buf,
203 char *__restrict __buf, size_t __buflen,
204 struct hostent **__restrict __result,
205 int *__restrict __h_errnop);
206 libc_hidden_proto(gethostbyaddr_r)
208 extern int gethostbyname_r (const char *__restrict __name,
209 struct hostent *__restrict __result_buf,
210 char *__restrict __buf, size_t __buflen,
211 struct hostent **__restrict __result,
212 int *__restrict __h_errnop);
213 libc_hidden_proto(gethostbyname_r)
215 extern int gethostbyname2_r (const char *__restrict __name, int __af,
216 struct hostent *__restrict __result_buf,
217 char *__restrict __buf, size_t __buflen,
218 struct hostent **__restrict __result,
219 int *__restrict __h_errnop);
220 libc_hidden_proto(gethostbyname2_r)
221 #endif /* misc */
224 /* Open network data base files and mark them as staying open even
225 after a later search if STAY_OPEN is non-zero.
227 This function is a possible cancellation point and therefore not
228 marked with __THROW. */
229 extern void setnetent (int __stay_open);
230 libc_hidden_proto(setnetent)
232 /* Close network data base files and clear `stay open' flag.
234 This function is a possible cancellation point and therefore not
235 marked with __THROW. */
236 extern void endnetent (void);
237 libc_hidden_proto(endnetent)
239 /* Get next entry from network data base file. Open data base if
240 necessary.
242 This function is a possible cancellation point and therefore not
243 marked with __THROW. */
244 extern struct netent *getnetent (void);
246 /* Return entry from network data base which address match NET and
247 type TYPE.
249 This function is a possible cancellation point and therefore not
250 marked with __THROW. */
251 extern struct netent *getnetbyaddr (uint32_t __net, int __type);
253 /* Return entry from network data base for network with NAME.
255 This function is a possible cancellation point and therefore not
256 marked with __THROW. */
257 extern struct netent *getnetbyname (const char *__name);
259 #ifdef __USE_MISC
260 /* Reentrant versions of the functions above. The additional
261 arguments specify a buffer of BUFLEN starting at BUF. The last
262 argument is a pointer to a variable which gets the value which
263 would be stored in the global variable `herrno' by the
264 non-reentrant functions.
266 These functions are not part of POSIX and therefore no official
267 cancellation point. But due to similarity with an POSIX interface
268 or due to the implementation they are cancellation points and
269 therefore not marked with __THROW. */
270 extern int getnetent_r (struct netent *__restrict __result_buf,
271 char *__restrict __buf, size_t __buflen,
272 struct netent **__restrict __result,
273 int *__restrict __h_errnop);
274 libc_hidden_proto(getnetent_r)
276 extern int getnetbyaddr_r (uint32_t __net, int __type,
277 struct netent *__restrict __result_buf,
278 char *__restrict __buf, size_t __buflen,
279 struct netent **__restrict __result,
280 int *__restrict __h_errnop);
281 libc_hidden_proto(getnetbyaddr_r)
283 extern int getnetbyname_r (const char *__restrict __name,
284 struct netent *__restrict __result_buf,
285 char *__restrict __buf, size_t __buflen,
286 struct netent **__restrict __result,
287 int *__restrict __h_errnop);
288 libc_hidden_proto(getnetbyname_r)
289 #endif /* __USE_MISC */
292 /* Description of data base entry for a single service. */
293 struct servent
295 char *s_name; /* Official service name. */
296 char **s_aliases; /* Alias list. */
297 int s_port; /* Port number. */
298 char *s_proto; /* Protocol to use. */
301 /* Open service data base files and mark them as staying open even
302 after a later search if STAY_OPEN is non-zero.
304 This function is a possible cancellation point and therefore not
305 marked with __THROW. */
306 extern void setservent (int __stay_open);
307 libc_hidden_proto(setservent)
309 /* Close service data base files and clear `stay open' flag.
311 This function is a possible cancellation point and therefore not
312 marked with __THROW. */
313 extern void endservent (void);
314 libc_hidden_proto(endservent)
316 /* Get next entry from service data base file. Open data base if
317 necessary.
319 This function is a possible cancellation point and therefore not
320 marked with __THROW. */
321 extern struct servent *getservent (void);
323 /* Return entry from network data base for network with NAME and
324 protocol PROTO.
326 This function is a possible cancellation point and therefore not
327 marked with __THROW. */
328 extern struct servent *getservbyname (const char *__name,
329 const char *__proto);
331 /* Return entry from service data base which matches port PORT and
332 protocol PROTO.
334 This function is a possible cancellation point and therefore not
335 marked with __THROW. */
336 extern struct servent *getservbyport (int __port, const char *__proto);
337 libc_hidden_proto(getservbyport)
340 #ifdef __USE_MISC
341 /* Reentrant versions of the functions above. The additional
342 arguments specify a buffer of BUFLEN starting at BUF.
344 These functions are not part of POSIX and therefore no official
345 cancellation point. But due to similarity with an POSIX interface
346 or due to the implementation they are cancellation points and
347 therefore not marked with __THROW. */
348 extern int getservent_r (struct servent *__restrict __result_buf,
349 char *__restrict __buf, size_t __buflen,
350 struct servent **__restrict __result);
351 libc_hidden_proto(getservent_r)
353 extern int getservbyname_r (const char *__restrict __name,
354 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(getservbyname_r)
360 extern int getservbyport_r (int __port, const char *__restrict __proto,
361 struct servent *__restrict __result_buf,
362 char *__restrict __buf, size_t __buflen,
363 struct servent **__restrict __result);
364 libc_hidden_proto(getservbyport_r)
365 #endif /* misc */
368 /* Description of data base entry for a single service. */
369 struct protoent
371 char *p_name; /* Official protocol name. */
372 char **p_aliases; /* Alias list. */
373 int p_proto; /* Protocol number. */
376 /* Open protocol data base files and mark them as staying open even
377 after a later search if STAY_OPEN is non-zero.
379 This function is a possible cancellation point and therefore not
380 marked with __THROW. */
381 extern void setprotoent (int __stay_open);
382 libc_hidden_proto(setprotoent)
384 /* Close protocol data base files and clear `stay open' flag.
386 This function is a possible cancellation point and therefore not
387 marked with __THROW. */
388 extern void endprotoent (void);
389 libc_hidden_proto(endprotoent)
391 /* Get next entry from protocol data base file. Open data base if
392 necessary.
394 This function is a possible cancellation point and therefore not
395 marked with __THROW. */
396 extern struct protoent *getprotoent (void);
398 /* Return entry from protocol data base for network with NAME.
400 This function is a possible cancellation point and therefore not
401 marked with __THROW. */
402 extern struct protoent *getprotobyname (const char *__name);
404 /* Return entry from protocol data base which number is PROTO.
406 This function is a possible cancellation point and therefore not
407 marked with __THROW. */
408 extern struct protoent *getprotobynumber (int __proto);
411 #ifdef __USE_MISC
412 /* Reentrant versions of the functions above. The additional
413 arguments specify a buffer of BUFLEN starting at BUF.
415 These functions are not part of POSIX and therefore no official
416 cancellation point. But due to similarity with an POSIX interface
417 or due to the implementation they are cancellation points and
418 therefore not marked with __THROW. */
419 extern int getprotoent_r (struct protoent *__restrict __result_buf,
420 char *__restrict __buf, size_t __buflen,
421 struct protoent **__restrict __result);
422 libc_hidden_proto(getprotoent_r)
424 extern int getprotobyname_r (const char *__restrict __name,
425 struct protoent *__restrict __result_buf,
426 char *__restrict __buf, size_t __buflen,
427 struct protoent **__restrict __result);
428 libc_hidden_proto(getprotobyname_r)
430 extern int getprotobynumber_r (int __proto,
431 struct protoent *__restrict __result_buf,
432 char *__restrict __buf, size_t __buflen,
433 struct protoent **__restrict __result);
434 libc_hidden_proto(getprotobynumber_r)
437 #ifdef __UCLIBC_HAS_NETGROUP__
438 /* Establish network group NETGROUP for enumeration.
440 This function is not part of POSIX and therefore no official
441 cancellation point. But due to similarity with an POSIX interface
442 or due to the implementation it is a cancellation point and
443 therefore not marked with __THROW. */
444 extern int setnetgrent (const char *__netgroup);
446 /* Free all space allocated by previous `setnetgrent' call.
448 This function is not part of POSIX and therefore no official
449 cancellation point. But due to similarity with an POSIX interface
450 or due to the implementation it is a cancellation point and
451 therefore not marked with __THROW. */
452 extern void endnetgrent (void);
454 /* Get next member of netgroup established by last `setnetgrent' call
455 and return pointers to elements in HOSTP, USERP, and DOMAINP.
457 This function is not part of POSIX and therefore no official
458 cancellation point. But due to similarity with an POSIX interface
459 or due to the implementation it is a cancellation point and
460 therefore not marked with __THROW. */
461 extern int getnetgrent (char **__restrict __hostp,
462 char **__restrict __userp,
463 char **__restrict __domainp);
466 /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN).
468 This function is not part of POSIX and therefore no official
469 cancellation point. But due to similarity with an POSIX interface
470 or due to the implementation it is a cancellation point and
471 therefore not marked with __THROW. */
472 extern int innetgr (const char *__netgroup, const char *__host,
473 const char *__user, const char *__domain);
475 /* Reentrant version of `getnetgrent' where result is placed in BUFFER.
477 This function is not part of POSIX and therefore no official
478 cancellation point. But due to similarity with an POSIX interface
479 or due to the implementation it is a cancellation point and
480 therefore not marked with __THROW. */
481 extern int getnetgrent_r (char **__restrict __hostp,
482 char **__restrict __userp,
483 char **__restrict __domainp,
484 char *__restrict __buffer, size_t __buflen);
485 #endif /* UCLIBC_HAS_NETGROUP */
486 #endif /* misc */
488 #ifdef __UCLIBC__
489 /* ruserpass - remote password check.
490 This function also exists in glibc but is undocumented */
491 extern int ruserpass(const char *host, const char **aname, const char **apass);
492 libc_hidden_proto(ruserpass)
493 #endif
495 #ifdef __USE_BSD
496 /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD.
497 The local user is LOCUSER, on the remote machine the command is
498 executed as REMUSER. In *FD2P the descriptor to the socket for the
499 connection is returned. The caller must have the right to use a
500 reserved port. When the function returns *AHOST contains the
501 official host name.
503 This function is not part of POSIX and therefore no official
504 cancellation point. But due to similarity with an POSIX interface
505 or due to the implementation it is a cancellation point and
506 therefore not marked with __THROW. */
507 extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
508 const char *__restrict __locuser,
509 const char *__restrict __remuser,
510 const char *__restrict __cmd, int *__restrict __fd2p);
512 #if 0
513 /* FIXME */
514 /* This is the equivalent function where the protocol can be selected
515 and which therefore can be used for IPv6.
517 This function is not part of POSIX and therefore no official
518 cancellation point. But due to similarity with an POSIX interface
519 or due to the implementation it is a cancellation point and
520 therefore not marked with __THROW. */
521 extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
522 const char *__restrict __locuser,
523 const char *__restrict __remuser,
524 const char *__restrict __cmd, int *__restrict __fd2p,
525 sa_family_t __af);
526 #endif
528 /* Call `rexecd' at port RPORT on remote machine *AHOST to execute
529 CMD. The process runs at the remote machine using the ID of user
530 NAME whose cleartext password is PASSWD. In *FD2P the descriptor
531 to the socket for the connection is returned. When the function
532 returns *AHOST contains the official host name.
534 This function is not part of POSIX and therefore no official
535 cancellation point. But due to similarity with an POSIX interface
536 or due to the implementation it is a cancellation point and
537 therefore not marked with __THROW. */
538 extern int rexec (char **__restrict __ahost, int __rport,
539 const char *__restrict __name,
540 const char *__restrict __pass,
541 const char *__restrict __cmd, int *__restrict __fd2p);
543 /* This is the equivalent function where the protocol can be selected
544 and which therefore can be used for IPv6.
546 This function is not part of POSIX and therefore no official
547 cancellation point. But due to similarity with an POSIX interface
548 or due to the implementation it is a cancellation point and
549 therefore not marked with __THROW. */
550 extern int rexec_af (char **__restrict __ahost, int __rport,
551 const char *__restrict __name,
552 const char *__restrict __pass,
553 const char *__restrict __cmd, int *__restrict __fd2p,
554 sa_family_t __af);
555 libc_hidden_proto(rexec_af)
557 /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER.
558 If SUSER is not zero the user tries to become superuser. Return 0 if
559 it is possible.
561 This function is not part of POSIX and therefore no official
562 cancellation point. But due to similarity with an POSIX interface
563 or due to the implementation it is a cancellation point and
564 therefore not marked with __THROW. */
565 extern int ruserok (const char *__rhost, int __suser,
566 const char *__remuser, const char *__locuser);
568 #if 0
569 /* FIXME */
570 /* This is the equivalent function where the protocol can be selected
571 and which therefore can be used for IPv6.
573 This function is not part of POSIX and therefore no official
574 cancellation point. But due to similarity with an POSIX interface
575 or due to the implementation it is a cancellation point and
576 therefore not marked with __THROW. */
577 extern int ruserok_af (const char *__rhost, int __suser,
578 const char *__remuser, const char *__locuser,
579 sa_family_t __af);
580 #endif
582 /* Try to allocate reserved port, returning a descriptor for a socket opened
583 at this port or -1 if unsuccessful. The search for an available port
584 will start at ALPORT and continues with lower numbers.
586 This function is not part of POSIX and therefore no official
587 cancellation point. But due to similarity with an POSIX interface
588 or due to the implementation it is a cancellation point and
589 therefore not marked with __THROW. */
590 extern int rresvport (int *__alport);
591 libc_hidden_proto(rresvport)
593 #if 0
594 /* FIXME */
595 /* This is the equivalent function where the protocol can be selected
596 and which therefore can be used for IPv6.
598 This function is not part of POSIX and therefore no official
599 cancellation point. But due to similarity with an POSIX interface
600 or due to the implementation it is a cancellation point and
601 therefore not marked with __THROW. */
602 extern int rresvport_af (int *__alport, sa_family_t __af);
603 #endif
604 #endif
607 /* Extension from POSIX.1g. */
608 #ifdef __USE_POSIX
609 /* Structure to contain information about address of a service provider. */
610 struct addrinfo
612 int ai_flags; /* Input flags. */
613 int ai_family; /* Protocol family for socket. */
614 int ai_socktype; /* Socket type. */
615 int ai_protocol; /* Protocol for socket. */
616 socklen_t ai_addrlen; /* Length of socket address. */
617 struct sockaddr *ai_addr; /* Socket address for socket. */
618 char *ai_canonname; /* Canonical name for service location. */
619 struct addrinfo *ai_next; /* Pointer to next in list. */
622 /* Possible values for `ai_flags' field in `addrinfo' structure. */
623 # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
624 # define AI_CANONNAME 0x0002 /* Request for canonical name. */
625 # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
626 # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
627 # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
628 # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
629 returned address type.. */
630 # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
632 /* Error values for `getaddrinfo' function. */
633 # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
634 # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
635 # define EAI_AGAIN -3 /* Temporary failure in name resolution. */
636 # define EAI_FAIL -4 /* Non-recoverable failure in name res. */
637 # define EAI_FAMILY -6 /* `ai_family' not supported. */
638 # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
639 # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
640 # define EAI_MEMORY -10 /* Memory allocation failure. */
641 # define EAI_SYSTEM -11 /* System error returned in `errno'. */
642 # define EAI_OVERFLOW -12 /* Argument buffer overflow. */
643 # ifdef __USE_GNU
644 # define EAI_NODATA -5 /* No address associated with NAME. */
645 # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
646 # define EAI_INPROGRESS -100 /* Processing request in progress. */
647 # define EAI_CANCELED -101 /* Request canceled. */
648 # define EAI_NOTCANCELED -102 /* Request not canceled. */
649 # define EAI_ALLDONE -103 /* All requests done. */
650 # define EAI_INTR -104 /* Interrupted by a signal. */
651 # endif
653 # ifdef __USE_MISC
654 # define NI_MAXHOST 1025
655 # define NI_MAXSERV 32
656 # endif
658 # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
659 # define NI_NUMERICSERV 2 /* Don't convert port number to name. */
660 # define NI_NOFQDN 4 /* Only return nodename portion. */
661 # define NI_NAMEREQD 8 /* Don't return numeric addresses. */
662 # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
663 #if 0 /* uClibc: not implemented */
664 /* # ifdef __USE_GNU */
665 # define NI_IDN 32 /* Convert name from IDN format. */
666 # define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode
667 code points. */
668 # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to
669 STD3 rules. */
670 # endif
672 /* Translate name of a service location and/or a service name to set of
673 socket addresses.
675 This function is a possible cancellation point and therefore not
676 marked with __THROW. */
677 extern int getaddrinfo (const char *__restrict __name,
678 const char *__restrict __service,
679 const struct addrinfo *__restrict __req,
680 struct addrinfo **__restrict __pai);
681 libc_hidden_proto(getaddrinfo)
683 /* Free `addrinfo' structure AI including associated storage. */
684 extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
685 libc_hidden_proto(freeaddrinfo)
687 /* Convert error return from getaddrinfo() to a string. */
688 extern const char *gai_strerror (int __ecode) __THROW;
690 /* Translate a socket address to a location and service name.
692 This function is a possible cancellation point and therefore not
693 marked with __THROW. */
694 extern int getnameinfo (const struct sockaddr *__restrict __sa,
695 socklen_t __salen, char *__restrict __host,
696 socklen_t __hostlen, char *__restrict __serv,
697 socklen_t __servlen, unsigned int __flags);
698 libc_hidden_proto(getnameinfo)
699 #endif /* POSIX */
701 __END_DECLS
703 #endif /* netdb.h */