2 #include <resolv/netdb.h>
4 /* Macros for accessing h_errno from inside libc. */
5 # ifdef _LIBC_REENTRANT
7 # if USE_TLS && HAVE___THREAD
9 # define h_errno h_errno /* For #ifndef h_errno tests. */
10 extern __thread
int h_errno
;
11 # define __set_h_errno(x) (h_errno = (x))
14 __set_h_errno (int __err
)
16 return *__h_errno_location () = __err
;
21 # define __set_h_errno(x) (h_errno = (x))
23 # endif /* _LIBC_REENTRANT */
25 libc_hidden_proto (hstrerror
)
26 libc_hidden_proto (innetgr
)
27 libc_hidden_proto (rcmd_af
)
28 libc_hidden_proto (rexec_af
)
29 libc_hidden_proto (rresvport_af
)
30 libc_hidden_proto (ruserok_af
)
32 libc_hidden_proto (getaddrinfo
)
33 libc_hidden_proto (getnameinfo
)
34 libc_hidden_proto (freeaddrinfo
)
35 libc_hidden_proto (gai_strerror
)
37 /* Document internal interfaces. */
38 extern int __gethostent_r (struct hostent
*__restrict __result_buf
,
39 char *__restrict __buf
, size_t __buflen
,
40 struct hostent
**__restrict __result
,
41 int *__restrict __h_errnop
) attribute_hidden
;
42 extern int __old_gethostent_r (struct hostent
*__restrict __result_buf
,
43 char *__restrict __buf
, size_t __buflen
,
44 struct hostent
**__restrict __result
,
45 int *__restrict __h_errnop
);
47 extern int __gethostbyaddr_r (__const
void *__restrict __addr
,
48 socklen_t __len
, int __type
,
49 struct hostent
*__restrict __result_buf
,
50 char *__restrict __buf
, size_t __buflen
,
51 struct hostent
**__restrict __result
,
52 int *__restrict __h_errnop
);
53 extern int __old_gethostbyaddr_r (__const
void *__restrict __addr
,
54 socklen_t __len
, int __type
,
55 struct hostent
*__restrict __result_buf
,
56 char *__restrict __buf
, size_t __buflen
,
57 struct hostent
**__restrict __result
,
58 int *__restrict __h_errnop
);
60 extern int __gethostbyname_r (__const
char *__restrict __name
,
61 struct hostent
*__restrict __result_buf
,
62 char *__restrict __buf
, size_t __buflen
,
63 struct hostent
**__restrict __result
,
64 int *__restrict __h_errnop
);
65 extern int __old_gethostbyname_r (__const
char *__restrict __name
,
66 struct hostent
*__restrict __result_buf
,
67 char *__restrict __buf
, size_t __buflen
,
68 struct hostent
**__restrict __result
,
69 int *__restrict __h_errnop
);
71 extern int __gethostbyname2_r (__const
char *__restrict __name
, int __af
,
72 struct hostent
*__restrict __result_buf
,
73 char *__restrict __buf
, size_t __buflen
,
74 struct hostent
**__restrict __result
,
75 int *__restrict __h_errnop
);
76 extern int __old_gethostbyname2_r (__const
char *__restrict __name
, int __af
,
77 struct hostent
*__restrict __result_buf
,
78 char *__restrict __buf
, size_t __buflen
,
79 struct hostent
**__restrict __result
,
80 int *__restrict __h_errnop
);
82 extern int __getnetent_r (struct netent
*__restrict __result_buf
,
83 char *__restrict __buf
, size_t __buflen
,
84 struct netent
**__restrict __result
,
85 int *__restrict __h_errnop
) attribute_hidden
;
86 extern int __old_getnetent_r (struct netent
*__restrict __result_buf
,
87 char *__restrict __buf
, size_t __buflen
,
88 struct netent
**__restrict __result
,
89 int *__restrict __h_errnop
);
91 extern int __getnetbyaddr_r (uint32_t __net
, int __type
,
92 struct netent
*__restrict __result_buf
,
93 char *__restrict __buf
, size_t __buflen
,
94 struct netent
**__restrict __result
,
95 int *__restrict __h_errnop
);
96 extern int __old_getnetbyaddr_r (uint32_t __net
, int __type
,
97 struct netent
*__restrict __result_buf
,
98 char *__restrict __buf
, size_t __buflen
,
99 struct netent
**__restrict __result
,
100 int *__restrict __h_errnop
);
102 extern int __getnetbyname_r (__const
char *__restrict __name
,
103 struct netent
*__restrict __result_buf
,
104 char *__restrict __buf
, size_t __buflen
,
105 struct netent
**__restrict __result
,
106 int *__restrict __h_errnop
);
107 extern int __old_getnetbyname_r (__const
char *__restrict __name
,
108 struct netent
*__restrict __result_buf
,
109 char *__restrict __buf
, size_t __buflen
,
110 struct netent
**__restrict __result
,
111 int *__restrict __h_errnop
);
113 extern int __getservent_r (struct servent
*__restrict __result_buf
,
114 char *__restrict __buf
, size_t __buflen
,
115 struct servent
**__restrict __result
)
117 extern int __old_getservent_r (struct servent
*__restrict __result_buf
,
118 char *__restrict __buf
, size_t __buflen
,
119 struct servent
**__restrict __result
);
121 extern int __getservbyname_r (__const
char *__restrict __name
,
122 __const
char *__restrict __proto
,
123 struct servent
*__restrict __result_buf
,
124 char *__restrict __buf
, size_t __buflen
,
125 struct servent
**__restrict __result
);
126 extern int __old_getservbyname_r (__const
char *__restrict __name
,
127 __const
char *__restrict __proto
,
128 struct servent
*__restrict __result_buf
,
129 char *__restrict __buf
, size_t __buflen
,
130 struct servent
**__restrict __result
);
132 extern int __getservbyport_r (int __port
,
133 __const
char *__restrict __proto
,
134 struct servent
*__restrict __result_buf
,
135 char *__restrict __buf
, size_t __buflen
,
136 struct servent
**__restrict __result
);
137 extern int __old_getservbyport_r (int __port
,
138 __const
char *__restrict __proto
,
139 struct servent
*__restrict __result_buf
,
140 char *__restrict __buf
, size_t __buflen
,
141 struct servent
**__restrict __result
);
143 extern int __getprotoent_r (struct protoent
*__restrict __result_buf
,
144 char *__restrict __buf
, size_t __buflen
,
145 struct protoent
**__restrict __result
)
147 extern int __old_getprotoent_r (struct protoent
*__restrict __result_buf
,
148 char *__restrict __buf
, size_t __buflen
,
149 struct protoent
**__restrict __result
);
151 extern int __getprotobyname_r (__const
char *__restrict __name
,
152 struct protoent
*__restrict __result_buf
,
153 char *__restrict __buf
, size_t __buflen
,
154 struct protoent
**__restrict __result
);
155 extern int __old_getprotobyname_r (__const
char *__restrict __name
,
156 struct protoent
*__restrict __result_buf
,
157 char *__restrict __buf
, size_t __buflen
,
158 struct protoent
**__restrict __result
);
160 extern int __getprotobynumber_r (int __proto
,
161 struct protoent
*__restrict __res_buf
,
162 char *__restrict __buf
, size_t __buflen
,
163 struct protoent
**__restrict __result
);
164 extern int __old_getprotobynumber_r (int __proto
,
165 struct protoent
*__restrict __res_buf
,
166 char *__restrict __buf
, size_t __buflen
,
167 struct protoent
**__restrict __result
);
169 extern int __getnetgrent_r (char **__restrict __hostp
,
170 char **__restrict __userp
,
171 char **__restrict __domainp
,
172 char *__restrict __buffer
, size_t __buflen
);
174 extern int ruserpass (const char *host
, const char **aname
,
176 libc_hidden_proto (ruserpass
)
179 /* The following declarations and definitions have been removed from
180 the public header since we don't want people to use them. */
182 #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */
183 #define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */
184 #define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
185 returned address type. */
186 #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
188 #include <inet/netgroup.h>
191 extern int _nss_files_parse_protoent (char *line
, struct protoent
*result
,
192 struct parser_data
*data
,
193 size_t datalen
, int *errnop
);
194 extern int _nss_files_parse_servent (char *line
, struct servent
*result
,
195 struct parser_data
*data
,
196 size_t datalen
, int *errnop
);
197 extern int _nss_files_parse_netent (char *line
, struct netent
*result
,
198 struct parser_data
*data
,
199 size_t datalen
, int *errnop
);
200 extern enum nss_status
_nss_netgroup_parseline (char **cursor
,
201 struct __netgrent
*result
,
202 char *buffer
, size_t buflen
,
204 libc_hidden_proto (_nss_files_parse_protoent
)
205 libc_hidden_proto (_nss_files_parse_servent
)
206 libc_hidden_proto (_nss_files_parse_netent
)
208 #define DECLARE_NSS_PROTOTYPES(service) \
209 extern enum nss_status _nss_ ## service ## _setprotoent (int); \
210 extern enum nss_status _nss_ ## service ## _endprotoent (void); \
211 extern enum nss_status _nss_ ## service ## _getprotoent_r \
212 (struct protoent *proto, char *buffer, size_t buflen, \
214 extern enum nss_status _nss_ ## service ## _getprotobyname_r \
215 (const char *name, struct protoent *proto, \
216 char *buffer, size_t buflen, int *errnop); \
217 extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
218 (int number, struct protoent *proto, \
219 char *buffer, size_t buflen, int *errnop); \
220 extern enum nss_status _nss_ ## service ## _sethostent (int); \
221 extern enum nss_status _nss_ ## service ## _endhostent (void); \
222 extern enum nss_status _nss_ ## service ## _gethostent_r \
223 (struct hostent *host, char *buffer, size_t buflen, \
224 int *errnop, int *h_errnop); \
225 extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
226 (const char *name, int af, struct hostent *host, \
227 char *buffer, size_t buflen, int *errnop, \
229 extern enum nss_status _nss_ ## service ## _gethostbyname_r \
230 (const char *name, struct hostent *host, char *buffer, \
231 size_t buflen, int *errnop, int *h_errnop); \
232 extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \
233 (const void *addr, socklen_t addrlen, int af, \
234 struct hostent *host, char *buffer, size_t buflen, \
235 int *errnop, int *h_errnop); \
236 extern enum nss_status _nss_ ## service ## _setservent (int); \
237 extern enum nss_status _nss_ ## service ## _endservent (void); \
238 extern enum nss_status _nss_ ## service ## _getservent_r \
239 (struct servent *serv, char *buffer, size_t buflen, \
241 extern enum nss_status _nss_ ## service ## _getservbyname_r \
242 (const char *name, const char *protocol, \
243 struct servent *serv, char *buffer, size_t buflen, \
245 extern enum nss_status _nss_ ## service ## _getservbyport_r \
246 (int port, const char *protocol, struct servent *serv, \
247 char *buffer, size_t buflen, int *errnop); \
248 extern enum nss_status _nss_ ## service ## _setnetgrent \
249 (const char *group, struct __netgrent *result); \
250 extern enum nss_status _nss_ ## service ## _endnetgrent \
251 (struct __netgrent *result); \
252 extern enum nss_status _nss_ ## service ## _getnetgrent_r \
253 (struct __netgrent *result, char *buffer, \
254 size_t buflen, int *errnop); \
255 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
256 extern enum nss_status _nss_ ## service ## _endnetent (void); \
257 extern enum nss_status _nss_ ## service ## _getnetent_r \
258 (struct netent *net, char *buffer, size_t buflen, \
259 int *errnop, int *herrnop); \
260 extern enum nss_status _nss_ ## service ## _getnetbyname_r \
261 (const char *name, struct netent *net, char *buffer, \
262 size_t buflen, int *errnop, int *herrnop); \
263 extern enum nss_status _nss_ ## service ## _getnetbyaddr_r \
264 (uint32_t addr, int type, struct netent *net, \
265 char *buffer, size_t buflen, int *errnop, \
268 DECLARE_NSS_PROTOTYPES (compat
)
269 DECLARE_NSS_PROTOTYPES (dns
)
270 DECLARE_NSS_PROTOTYPES (files
)
271 DECLARE_NSS_PROTOTYPES (hesiod
)
272 DECLARE_NSS_PROTOTYPES (nis
)
273 DECLARE_NSS_PROTOTYPES (nisplus
)
275 #undef DECLARE_NSS_PROTOTYPES
277 #endif /* !_NETDB_H */