1 /* Copyright (C) 1996-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
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). */
21
22#ifndef _NETDB_H
23#define _NETDB_H 1
24
25#include <features.h>
26
27#include <netinet/in.h>
28#include <bits/stdint-uintn.h>
29#ifdef __USE_MISC
30/* This is necessary to make this include file properly replace the
31 Sun version. */
32# include <rpc/netdb.h>
33#endif
34
35#ifdef __USE_GNU
36# include <bits/types/sigevent_t.h>
37# include <bits/types/struct_timespec.h>
38#endif
39
40#include <bits/netdb.h>
41
42/* Absolute file name for network data base files. */
43#define _PATH_HEQUIV "/etc/hosts.equiv"
44#define _PATH_HOSTS "/etc/hosts"
45#define _PATH_NETWORKS "/etc/networks"
46#define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf"
47#define _PATH_PROTOCOLS "/etc/protocols"
48#define _PATH_SERVICES "/etc/services"
49
50
51__BEGIN_DECLS
52
53#if defined __USE_MISC || !defined __USE_XOPEN2K8
54/* Error status for non-reentrant lookup functions.
55 We use a macro to access always the thread-specific `h_errno' variable. */
56# define h_errno (*__h_errno_location ())
57
58/* Function to get address of global `h_errno' variable. */
59extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
60
61
62/* Possible values left in `h_errno'. */
63# define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
64# define TRY_AGAIN 2 /* Non-Authoritative Host not found,
65 or SERVERFAIL. */
66# define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED,
67 NOTIMP. */
68# define NO_DATA 4 /* Valid name, no data record of requested
69 type. */
70#endif
71#ifdef __USE_MISC
72# define NETDB_INTERNAL -1 /* See errno. */
73# define NETDB_SUCCESS 0 /* No problem. */
74# define NO_ADDRESS NO_DATA /* No address, look for MX record. */
75#endif
76
77#if defined __USE_XOPEN2K || defined __USE_XOPEN_EXTENDED
78/* Highest reserved Internet port number. */
79# define IPPORT_RESERVED 1024
80#endif
81
82#ifdef __USE_GNU
83/* Scope delimiter for getaddrinfo(), getnameinfo(). */
84# define SCOPE_DELIMITER '%'
85#endif
86
87#ifdef __USE_MISC
88/* Print error indicated by `h_errno' variable on standard error. STR
89 if non-null is printed before the error string. */
90extern void herror (const char *__str) __THROW;
91
92/* Return string associated with error ERR_NUM. */
93extern const char *hstrerror (int __err_num) __THROW;
94#endif
95
96
97/* Description of data base entry for a single host. */
98struct hostent
99{
100 char *h_name; /* Official name of host. */
101 char **h_aliases; /* Alias list. */
102 int h_addrtype; /* Host address type. */
103 int h_length; /* Length of address. */
104 char **h_addr_list; /* List of addresses from name server. */
105#ifdef __USE_MISC
106# define h_addr h_addr_list[0] /* Address, for backward compatibility.*/
107#endif
108};
109
110/* Open host data base files and mark them as staying open even after
111 a later search if STAY_OPEN is non-zero.
112
113 This function is a possible cancellation point and therefore not
114 marked with __THROW. */
115extern void sethostent (int __stay_open);
116
117/* Close host data base files and clear `stay open' flag.
118
119 This function is a possible cancellation point and therefore not
120 marked with __THROW. */
121extern void endhostent (void);
122
123/* Get next entry from host data base file. Open data base if
124 necessary.
125
126 This function is a possible cancellation point and therefore not
127 marked with __THROW. */
128extern struct hostent *gethostent (void);
129
130/* Return entry from host data base which address match ADDR with
131 length LEN and type TYPE.
132
133 This function is a possible cancellation point and therefore not
134 marked with __THROW. */
135extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len,
136 int __type);
137
138/* Return entry from host data base for host with NAME.
139
140 This function is a possible cancellation point and therefore not
141 marked with __THROW. */
142extern struct hostent *gethostbyname (const char *__name);
143
144#ifdef __USE_MISC
145/* Return entry from host data base for host with NAME. AF must be
146 set to the address type which is `AF_INET' for IPv4 or `AF_INET6'
147 for IPv6.
148
149 This function is not part of POSIX and therefore no official
150 cancellation point. But due to similarity with an POSIX interface
151 or due to the implementation it is a cancellation point and
152 therefore not marked with __THROW. */
153extern struct hostent *gethostbyname2 (const char *__name, int __af);
154
155/* Reentrant versions of the functions above. The additional
156 arguments specify a buffer of BUFLEN starting at BUF. The last
157 argument is a pointer to a variable which gets the value which
158 would be stored in the global variable `herrno' by the
159 non-reentrant functions.
160
161 These functions are not part of POSIX and therefore no official
162 cancellation point. But due to similarity with an POSIX interface
163 or due to the implementation they are cancellation points and
164 therefore not marked with __THROW. */
165extern int gethostent_r (struct hostent *__restrict __result_buf,
166 char *__restrict __buf, size_t __buflen,
167 struct hostent **__restrict __result,
168 int *__restrict __h_errnop);
169
170extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len,
171 int __type,
172 struct hostent *__restrict __result_buf,
173 char *__restrict __buf, size_t __buflen,
174 struct hostent **__restrict __result,
175 int *__restrict __h_errnop);
176
177extern int gethostbyname_r (const char *__restrict __name,
178 struct hostent *__restrict __result_buf,
179 char *__restrict __buf, size_t __buflen,
180 struct hostent **__restrict __result,
181 int *__restrict __h_errnop);
182
183extern int gethostbyname2_r (const char *__restrict __name, int __af,
184 struct hostent *__restrict __result_buf,
185 char *__restrict __buf, size_t __buflen,
186 struct hostent **__restrict __result,
187 int *__restrict __h_errnop);
188#endif /* misc */
189
190
191/* Open network data base files and mark them as staying open even
192 after a later search if STAY_OPEN is non-zero.
193
194 This function is a possible cancellation point and therefore not
195 marked with __THROW. */
196extern void setnetent (int __stay_open);
197
198/* Close network data base files and clear `stay open' flag.
199
200 This function is a possible cancellation point and therefore not
201 marked with __THROW. */
202extern void endnetent (void);
203
204/* Get next entry from network data base file. Open data base if
205 necessary.
206
207 This function is a possible cancellation point and therefore not
208 marked with __THROW. */
209extern struct netent *getnetent (void);
210
211/* Return entry from network data base which address match NET and
212 type TYPE.
213
214 This function is a possible cancellation point and therefore not
215 marked with __THROW. */
216extern struct netent *getnetbyaddr (uint32_t __net, int __type);
217
218/* Return entry from network data base for network with NAME.
219
220 This function is a possible cancellation point and therefore not
221 marked with __THROW. */
222extern struct netent *getnetbyname (const char *__name);
223
224#ifdef __USE_MISC
225/* Reentrant versions of the functions above. The additional
226 arguments specify a buffer of BUFLEN starting at BUF. The last
227 argument is a pointer to a variable which gets the value which
228 would be stored in the global variable `herrno' by the
229 non-reentrant functions.
230
231 These functions are not part of POSIX and therefore no official
232 cancellation point. But due to similarity with an POSIX interface
233 or due to the implementation they are cancellation points and
234 therefore not marked with __THROW. */
235extern int getnetent_r (struct netent *__restrict __result_buf,
236 char *__restrict __buf, size_t __buflen,
237 struct netent **__restrict __result,
238 int *__restrict __h_errnop);
239
240extern int getnetbyaddr_r (uint32_t __net, int __type,
241 struct netent *__restrict __result_buf,
242 char *__restrict __buf, size_t __buflen,
243 struct netent **__restrict __result,
244 int *__restrict __h_errnop);
245
246extern int getnetbyname_r (const char *__restrict __name,
247 struct netent *__restrict __result_buf,
248 char *__restrict __buf, size_t __buflen,
249 struct netent **__restrict __result,
250 int *__restrict __h_errnop);
251#endif /* misc */
252
253
254/* Description of data base entry for a single service. */
255struct servent
256{
257 char *s_name; /* Official service name. */
258 char **s_aliases; /* Alias list. */
259 int s_port; /* Port number. */
260 char *s_proto; /* Protocol to use. */
261};
262
263/* Open service data base files and mark them as staying open even
264 after a later search if STAY_OPEN is non-zero.
265
266 This function is a possible cancellation point and therefore not
267 marked with __THROW. */
268extern void setservent (int __stay_open);
269
270/* Close service data base files and clear `stay open' flag.
271
272 This function is a possible cancellation point and therefore not
273 marked with __THROW. */
274extern void endservent (void);
275
276/* Get next entry from service data base file. Open data base if
277 necessary.
278
279 This function is a possible cancellation point and therefore not
280 marked with __THROW. */
281extern struct servent *getservent (void);
282
283/* Return entry from network data base for network with NAME and
284 protocol PROTO.
285
286 This function is a possible cancellation point and therefore not
287 marked with __THROW. */
288extern struct servent *getservbyname (const char *__name, const char *__proto);
289
290/* Return entry from service data base which matches port PORT and
291 protocol PROTO.
292
293 This function is a possible cancellation point and therefore not
294 marked with __THROW. */
295extern struct servent *getservbyport (int __port, const char *__proto);
296
297
298#ifdef __USE_MISC
299/* Reentrant versions of the functions above. The additional
300 arguments specify a buffer of BUFLEN starting at BUF.
301
302 These functions are not part of POSIX and therefore no official
303 cancellation point. But due to similarity with an POSIX interface
304 or due to the implementation they are cancellation points and
305 therefore not marked with __THROW. */
306extern int getservent_r (struct servent *__restrict __result_buf,
307 char *__restrict __buf, size_t __buflen,
308 struct servent **__restrict __result);
309
310extern int getservbyname_r (const char *__restrict __name,
311 const char *__restrict __proto,
312 struct servent *__restrict __result_buf,
313 char *__restrict __buf, size_t __buflen,
314 struct servent **__restrict __result);
315
316extern int getservbyport_r (int __port, const char *__restrict __proto,
317 struct servent *__restrict __result_buf,
318 char *__restrict __buf, size_t __buflen,
319 struct servent **__restrict __result);
320#endif /* misc */
321
322
323/* Description of data base entry for a single service. */
324struct protoent
325{
326 char *p_name; /* Official protocol name. */
327 char **p_aliases; /* Alias list. */
328 int p_proto; /* Protocol number. */
329};
330
331/* Open protocol data base files and mark them as staying open even
332 after a later search if STAY_OPEN is non-zero.
333
334 This function is a possible cancellation point and therefore not
335 marked with __THROW. */
336extern void setprotoent (int __stay_open);
337
338/* Close protocol data base files and clear `stay open' flag.
339
340 This function is a possible cancellation point and therefore not
341 marked with __THROW. */
342extern void endprotoent (void);
343
344/* Get next entry from protocol data base file. Open data base if
345 necessary.
346
347 This function is a possible cancellation point and therefore not
348 marked with __THROW. */
349extern struct protoent *getprotoent (void);
350
351/* Return entry from protocol data base for network with NAME.
352
353 This function is a possible cancellation point and therefore not
354 marked with __THROW. */
355extern struct protoent *getprotobyname (const char *__name);
356
357/* Return entry from protocol data base which number is PROTO.
358
359 This function is a possible cancellation point and therefore not
360 marked with __THROW. */
361extern struct protoent *getprotobynumber (int __proto);
362
363
364#ifdef __USE_MISC
365/* Reentrant versions of the functions above. The additional
366 arguments specify a buffer of BUFLEN starting at BUF.
367
368 These functions are not part of POSIX and therefore no official
369 cancellation point. But due to similarity with an POSIX interface
370 or due to the implementation they are cancellation points and
371 therefore not marked with __THROW. */
372extern int getprotoent_r (struct protoent *__restrict __result_buf,
373 char *__restrict __buf, size_t __buflen,
374 struct protoent **__restrict __result);
375
376extern int getprotobyname_r (const char *__restrict __name,
377 struct protoent *__restrict __result_buf,
378 char *__restrict __buf, size_t __buflen,
379 struct protoent **__restrict __result);
380
381extern int getprotobynumber_r (int __proto,
382 struct protoent *__restrict __result_buf,
383 char *__restrict __buf, size_t __buflen,
384 struct protoent **__restrict __result);
385
386
387/* Establish network group NETGROUP for enumeration.
388
389 This function is not part of POSIX and therefore no official
390 cancellation point. But due to similarity with an POSIX interface
391 or due to the implementation it is a cancellation point and
392 therefore not marked with __THROW. */
393extern int setnetgrent (const char *__netgroup);
394
395/* Free all space allocated by previous `setnetgrent' call.
396
397 This function is not part of POSIX and therefore no official
398 cancellation point. But due to similarity with an POSIX interface
399 or due to the implementation it is a cancellation point and
400 therefore not marked with __THROW. */
401extern void endnetgrent (void);
402
403/* Get next member of netgroup established by last `setnetgrent' call
404 and return pointers to elements in HOSTP, USERP, and DOMAINP.
405
406 This function is not part of POSIX and therefore no official
407 cancellation point. But due to similarity with an POSIX interface
408 or due to the implementation it is a cancellation point and
409 therefore not marked with __THROW. */
410extern int getnetgrent (char **__restrict __hostp,
411 char **__restrict __userp,
412 char **__restrict __domainp);
413
414
415/* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN).
416
417 This function is not part of POSIX and therefore no official
418 cancellation point. But due to similarity with an POSIX interface
419 or due to the implementation it is a cancellation point and
420 therefore not marked with __THROW. */
421extern int innetgr (const char *__netgroup, const char *__host,
422 const char *__user, const char *__domain);
423
424/* Reentrant version of `getnetgrent' where result is placed in BUFFER.
425
426 This function is not part of POSIX and therefore no official
427 cancellation point. But due to similarity with an POSIX interface
428 or due to the implementation it is a cancellation point and
429 therefore not marked with __THROW. */
430extern int getnetgrent_r (char **__restrict __hostp,
431 char **__restrict __userp,
432 char **__restrict __domainp,
433 char *__restrict __buffer, size_t __buflen);
434#endif /* misc */
435
436
437#ifdef __USE_MISC
438/* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD.
439 The local user is LOCUSER, on the remote machine the command is
440 executed as REMUSER. In *FD2P the descriptor to the socket for the
441 connection is returned. The caller must have the right to use a
442 reserved port. When the function returns *AHOST contains the
443 official host name.
444
445 This function is not part of POSIX and therefore no official
446 cancellation point. But due to similarity with an POSIX interface
447 or due to the implementation it is a cancellation point and
448 therefore not marked with __THROW. */
449extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
450 const char *__restrict __locuser,
451 const char *__restrict __remuser,
452 const char *__restrict __cmd, int *__restrict __fd2p);
453
454/* This is the equivalent function where the protocol can be selected
455 and which therefore can be used for IPv6.
456
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. */
461extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
462 const char *__restrict __locuser,
463 const char *__restrict __remuser,
464 const char *__restrict __cmd, int *__restrict __fd2p,
465 sa_family_t __af);
466
467/* Call `rexecd' at port RPORT on remote machine *AHOST to execute
468 CMD. The process runs at the remote machine using the ID of user
469 NAME whose cleartext password is PASSWD. In *FD2P the descriptor
470 to the socket for the connection is returned. When the function
471 returns *AHOST contains the official host name.
472
473 This function is not part of POSIX and therefore no official
474 cancellation point. But due to similarity with an POSIX interface
475 or due to the implementation it is a cancellation point and
476 therefore not marked with __THROW. */
477extern int rexec (char **__restrict __ahost, int __rport,
478 const char *__restrict __name,
479 const char *__restrict __pass,
480 const char *__restrict __cmd, int *__restrict __fd2p);
481
482/* This is the equivalent function where the protocol can be selected
483 and which therefore can be used for IPv6.
484
485 This function is not part of POSIX and therefore no official
486 cancellation point. But due to similarity with an POSIX interface
487 or due to the implementation it is a cancellation point and
488 therefore not marked with __THROW. */
489extern int rexec_af (char **__restrict __ahost, int __rport,
490 const char *__restrict __name,
491 const char *__restrict __pass,
492 const char *__restrict __cmd, int *__restrict __fd2p,
493 sa_family_t __af);
494
495/* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER.
496 If SUSER is not zero the user tries to become superuser. Return 0 if
497 it is possible.
498
499 This function is not part of POSIX and therefore no official
500 cancellation point. But due to similarity with an POSIX interface
501 or due to the implementation it is a cancellation point and
502 therefore not marked with __THROW. */
503extern int ruserok (const char *__rhost, int __suser,
504 const char *__remuser, const char *__locuser);
505
506/* This is the equivalent function where the protocol can be selected
507 and which therefore can be used for IPv6.
508
509 This function is not part of POSIX and therefore no official
510 cancellation point. But due to similarity with an POSIX interface
511 or due to the implementation it is a cancellation point and
512 therefore not marked with __THROW. */
513extern int ruserok_af (const char *__rhost, int __suser,
514 const char *__remuser, const char *__locuser,
515 sa_family_t __af);
516
517/* Check whether user REMUSER on system indicated by IPv4 address
518 RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are
519 not supported. If SUSER is not zero the user tries to become
520 superuser. Return 0 if it is possible.
521
522 This function is not part of POSIX and therefore no official
523 cancellation point. But due to similarity with an POSIX interface
524 or due to the implementation it is a cancellation point and
525 therefore not marked with __THROW. */
526extern int iruserok (uint32_t __raddr, int __suser,
527 const char *__remuser, const char *__locuser);
528
529/* This is the equivalent function where the pfamiliy if the address
530 pointed to by RADDR is determined by the value of AF. It therefore
531 can be used for IPv6
532
533 This function is not part of POSIX and therefore no official
534 cancellation point. But due to similarity with an POSIX interface
535 or due to the implementation it is a cancellation point and
536 therefore not marked with __THROW. */
537extern int iruserok_af (const void *__raddr, int __suser,
538 const char *__remuser, const char *__locuser,
539 sa_family_t __af);
540
541/* Try to allocate reserved port, returning a descriptor for a socket opened
542 at this port or -1 if unsuccessful. The search for an available port
543 will start at ALPORT and continues with lower numbers.
544
545 This function is not part of POSIX and therefore no official
546 cancellation point. But due to similarity with an POSIX interface
547 or due to the implementation it is a cancellation point and
548 therefore not marked with __THROW. */
549extern int rresvport (int *__alport);
550
551/* This is the equivalent function where the protocol can be selected
552 and which therefore can be used for IPv6.
553
554 This function is not part of POSIX and therefore no official
555 cancellation point. But due to similarity with an POSIX interface
556 or due to the implementation it is a cancellation point and
557 therefore not marked with __THROW. */
558extern int rresvport_af (int *__alport, sa_family_t __af);
559#endif
560
561
562/* Extension from POSIX.1:2001. */
563#ifdef __USE_XOPEN2K
564/* Structure to contain information about address of a service provider. */
565struct addrinfo
566{
567 int ai_flags; /* Input flags. */
568 int ai_family; /* Protocol family for socket. */
569 int ai_socktype; /* Socket type. */
570 int ai_protocol; /* Protocol for socket. */
571 socklen_t ai_addrlen; /* Length of socket address. */
572 struct sockaddr *ai_addr; /* Socket address for socket. */
573 char *ai_canonname; /* Canonical name for service location. */
574 struct addrinfo *ai_next; /* Pointer to next in list. */
575};
576
577# ifdef __USE_GNU
578/* Structure used as control block for asynchronous lookup. */
579struct gaicb
580{
581 const char *ar_name; /* Name to look up. */
582 const char *ar_service; /* Service name. */
583 const struct addrinfo *ar_request; /* Additional request specification. */
584 struct addrinfo *ar_result; /* Pointer to result. */
585 /* The following are internal elements. */
586 int __return;
587 int __glibc_reserved[5];
588};
589
590/* Lookup mode. */
591# define GAI_WAIT 0
592# define GAI_NOWAIT 1
593# endif
594
595/* Possible values for `ai_flags' field in `addrinfo' structure. */
596# define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
597# define AI_CANONNAME 0x0002 /* Request for canonical name. */
598# define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
599# define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
600# define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
601# define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
602 returned address type.. */
603# ifdef __USE_GNU
604# define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded
605 in the current locale's character set)
606 before looking it up. */
607# define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
608# define AI_IDN_ALLOW_UNASSIGNED \
609 __glibc_macro_warning ("AI_IDN_ALLOW_UNASSIGNED is deprecated") 0x0100
610# define AI_IDN_USE_STD3_ASCII_RULES \
611 __glibc_macro_warning ("AI_IDN_USE_STD3_ASCII_RULES is deprecated") 0x0200
612# endif
613# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
614
615/* Error values for `getaddrinfo' function. */
616# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
617# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
618# define EAI_AGAIN -3 /* Temporary failure in name resolution. */
619# define EAI_FAIL -4 /* Non-recoverable failure in name res. */
620# define EAI_FAMILY -6 /* `ai_family' not supported. */
621# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
622# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
623# define EAI_MEMORY -10 /* Memory allocation failure. */
624# define EAI_SYSTEM -11 /* System error returned in `errno'. */
625# define EAI_OVERFLOW -12 /* Argument buffer overflow. */
626# ifdef __USE_GNU
627# define EAI_NODATA -5 /* No address associated with NAME. */
628# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
629# define EAI_INPROGRESS -100 /* Processing request in progress. */
630# define EAI_CANCELED -101 /* Request canceled. */
631# define EAI_NOTCANCELED -102 /* Request not canceled. */
632# define EAI_ALLDONE -103 /* All requests done. */
633# define EAI_INTR -104 /* Interrupted by a signal. */
634# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
635# endif
636
637# ifdef __USE_MISC
638# define NI_MAXHOST 1025
639# define NI_MAXSERV 32
640# endif
641
642# define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
643# define NI_NUMERICSERV 2 /* Don't convert port number to name. */
644# define NI_NOFQDN 4 /* Only return nodename portion. */
645# define NI_NAMEREQD 8 /* Don't return numeric addresses. */
646# define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
647# ifdef __USE_GNU
648# define NI_IDN 32 /* Convert name from IDN format. */
649# define NI_IDN_ALLOW_UNASSIGNED \
650 __glibc_macro_warning ("NI_IDN_ALLOW_UNASSIGNED is deprecated") 64
651# define NI_IDN_USE_STD3_ASCII_RULES \
652 __glibc_macro_warning ("NI_IDN_USE_STD3_ASCII_RULES is deprecated") 128
653# endif
654
655/* Translate name of a service location and/or a service name to set of
656 socket addresses.
657
658 This function is a possible cancellation point and therefore not
659 marked with __THROW. */
660extern int getaddrinfo (const char *__restrict __name,
661 const char *__restrict __service,
662 const struct addrinfo *__restrict __req,
663 struct addrinfo **__restrict __pai);
664
665/* Free `addrinfo' structure AI including associated storage. */
666extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
667
668/* Convert error return from getaddrinfo() to a string. */
669extern const char *gai_strerror (int __ecode) __THROW;
670
671/* Translate a socket address to a location and service name.
672
673 This function is a possible cancellation point and therefore not
674 marked with __THROW. */
675extern int getnameinfo (const struct sockaddr *__restrict __sa,
676 socklen_t __salen, char *__restrict __host,
677 socklen_t __hostlen, char *__restrict __serv,
678 socklen_t __servlen, int __flags);
679#endif /* POSIX */
680
681#ifdef __USE_GNU
682/* Enqueue ENT requests from the LIST. If MODE is GAI_WAIT wait until all
683 requests are handled. If WAIT is GAI_NOWAIT return immediately after
684 queueing the requests and signal completion according to SIG.
685
686 This function is not part of POSIX and therefore no official
687 cancellation point. But due to similarity with an POSIX interface
688 or due to the implementation it is a cancellation point and
689 therefore not marked with __THROW. */
690extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
691 int __ent, struct sigevent *__restrict __sig);
692
693/* Suspend execution of the thread until at least one of the ENT requests
694 in LIST is handled. If TIMEOUT is not a null pointer it specifies the
695 longest time the function keeps waiting before returning with an error.
696
697 This function is not part of POSIX and therefore no official
698 cancellation point. But due to similarity with an POSIX interface
699 or due to the implementation it is a cancellation point and
700 therefore not marked with __THROW. */
701extern int gai_suspend (const struct gaicb *const __list[], int __ent,
702 const struct timespec *__timeout);
703
704# ifdef __USE_TIME_BITS64
705# if defined(__REDIRECT)
706extern int __REDIRECT (gai_suspend, (const struct gaicb *const __list[],
707 int __ent,
708 const struct timespec *__timeout),
709 __gai_suspend_time64);
710# else
711# define gai_suspend __gai_suspend_time64
712# endif
713# endif
714
715/* Get the error status of the request REQ. */
716extern int gai_error (struct gaicb *__req) __THROW;
717
718/* Cancel the requests associated with GAICBP. */
719extern int gai_cancel (struct gaicb *__gaicbp) __THROW;
720#endif /* GNU */
721
722__END_DECLS
723
724#endif /* netdb.h */
725

source code of include/netdb.h