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