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))
22 # endif /* _LIBC_REENTRANT */
24 libc_hidden_proto (innetgr)
25 libc_hidden_proto (rcmd_af)
26 libc_hidden_proto (rexec_af)
27 libc_hidden_proto (rresvport_af)
28 libc_hidden_proto (ruserok_af)
30 /* Document internal interfaces. */
31 extern int __gethostent_r (struct hostent *__restrict __result_buf,
32 char *__restrict __buf, size_t __buflen,
33 struct hostent **__restrict __result,
34 int *__restrict __h_errnop) attribute_hidden;
35 extern int __old_gethostent_r (struct hostent *__restrict __result_buf,
36 char *__restrict __buf, size_t __buflen,
37 struct hostent **__restrict __result,
38 int *__restrict __h_errnop);
40 extern int __gethostbyaddr_r (__const void *__restrict __addr,
41 socklen_t __len, int __type,
42 struct hostent *__restrict __result_buf,
43 char *__restrict __buf, size_t __buflen,
44 struct hostent **__restrict __result,
45 int *__restrict __h_errnop);
46 extern int __old_gethostbyaddr_r (__const void *__restrict __addr,
47 socklen_t __len, int __type,
48 struct hostent *__restrict __result_buf,
49 char *__restrict __buf, size_t __buflen,
50 struct hostent **__restrict __result,
51 int *__restrict __h_errnop);
53 extern int __gethostbyname_r (__const char *__restrict __name,
54 struct hostent *__restrict __result_buf,
55 char *__restrict __buf, size_t __buflen,
56 struct hostent **__restrict __result,
57 int *__restrict __h_errnop);
58 extern int __old_gethostbyname_r (__const char *__restrict __name,
59 struct hostent *__restrict __result_buf,
60 char *__restrict __buf, size_t __buflen,
61 struct hostent **__restrict __result,
62 int *__restrict __h_errnop);
64 extern int __gethostbyname2_r (__const char *__restrict __name, int __af,
65 struct hostent *__restrict __result_buf,
66 char *__restrict __buf, size_t __buflen,
67 struct hostent **__restrict __result,
68 int *__restrict __h_errnop);
69 extern int __old_gethostbyname2_r (__const char *__restrict __name, int __af,
70 struct hostent *__restrict __result_buf,
71 char *__restrict __buf, size_t __buflen,
72 struct hostent **__restrict __result,
73 int *__restrict __h_errnop);
75 extern int __getnetent_r (struct netent *__restrict __result_buf,
76 char *__restrict __buf, size_t __buflen,
77 struct netent **__restrict __result,
78 int *__restrict __h_errnop) attribute_hidden;
79 extern int __old_getnetent_r (struct netent *__restrict __result_buf,
80 char *__restrict __buf, size_t __buflen,
81 struct netent **__restrict __result,
82 int *__restrict __h_errnop);
84 extern int __getnetbyaddr_r (uint32_t __net, int __type,
85 struct netent *__restrict __result_buf,
86 char *__restrict __buf, size_t __buflen,
87 struct netent **__restrict __result,
88 int *__restrict __h_errnop);
89 extern int __old_getnetbyaddr_r (uint32_t __net, int __type,
90 struct netent *__restrict __result_buf,
91 char *__restrict __buf, size_t __buflen,
92 struct netent **__restrict __result,
93 int *__restrict __h_errnop);
95 extern int __getnetbyname_r (__const char *__restrict __name,
96 struct netent *__restrict __result_buf,
97 char *__restrict __buf, size_t __buflen,
98 struct netent **__restrict __result,
99 int *__restrict __h_errnop);
100 extern int __old_getnetbyname_r (__const char *__restrict __name,
101 struct netent *__restrict __result_buf,
102 char *__restrict __buf, size_t __buflen,
103 struct netent **__restrict __result,
104 int *__restrict __h_errnop);
106 extern int __getservent_r (struct servent *__restrict __result_buf,
107 char *__restrict __buf, size_t __buflen,
108 struct servent **__restrict __result)
110 extern int __old_getservent_r (struct servent *__restrict __result_buf,
111 char *__restrict __buf, size_t __buflen,
112 struct servent **__restrict __result);
114 extern int __getservbyname_r (__const char *__restrict __name,
115 __const char *__restrict __proto,
116 struct servent *__restrict __result_buf,
117 char *__restrict __buf, size_t __buflen,
118 struct servent **__restrict __result);
119 extern int __old_getservbyname_r (__const char *__restrict __name,
120 __const char *__restrict __proto,
121 struct servent *__restrict __result_buf,
122 char *__restrict __buf, size_t __buflen,
123 struct servent **__restrict __result);
125 extern int __getservbyport_r (int __port,
126 __const char *__restrict __proto,
127 struct servent *__restrict __result_buf,
128 char *__restrict __buf, size_t __buflen,
129 struct servent **__restrict __result);
130 extern int __old_getservbyport_r (int __port,
131 __const char *__restrict __proto,
132 struct servent *__restrict __result_buf,
133 char *__restrict __buf, size_t __buflen,
134 struct servent **__restrict __result);
136 extern int __getprotoent_r (struct protoent *__restrict __result_buf,
137 char *__restrict __buf, size_t __buflen,
138 struct protoent **__restrict __result)
140 extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
141 char *__restrict __buf, size_t __buflen,
142 struct protoent **__restrict __result);
144 extern int __getprotobyname_r (__const char *__restrict __name,
145 struct protoent *__restrict __result_buf,
146 char *__restrict __buf, size_t __buflen,
147 struct protoent **__restrict __result);
148 extern int __old_getprotobyname_r (__const char *__restrict __name,
149 struct protoent *__restrict __result_buf,
150 char *__restrict __buf, size_t __buflen,
151 struct protoent **__restrict __result);
153 extern int __getprotobynumber_r (int __proto,
154 struct protoent *__restrict __res_buf,
155 char *__restrict __buf, size_t __buflen,
156 struct protoent **__restrict __result);
157 extern int __old_getprotobynumber_r (int __proto,
158 struct protoent *__restrict __res_buf,
159 char *__restrict __buf, size_t __buflen,
160 struct protoent **__restrict __result);
162 extern int __getnetgrent_r (char **__restrict __hostp,
163 char **__restrict __userp,
164 char **__restrict __domainp,
165 char *__restrict __buffer, size_t __buflen);
167 extern int ruserpass (const char *host, const char **aname,
171 /* The following declarations and definitions have been removed from
172 the public header since we don't want people to use them. */
174 #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */
175 #define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */
176 #define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
177 returned address type. */
178 #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
180 #include <inet/netgroup.h>
183 extern int _nss_files_parse_protoent (char *line, struct protoent *result,
184 struct parser_data *data,
185 size_t datalen, int *errnop);
186 extern int _nss_files_parse_servent (char *line, struct servent *result,
187 struct parser_data *data,
188 size_t datalen, int *errnop);
189 extern int _nss_files_parse_netent (char *line, struct netent *result,
190 struct parser_data *data,
191 size_t datalen, int *errnop);
192 extern enum nss_status _nss_netgroup_parseline (char **cursor,
193 struct __netgrent *result,
194 char *buffer, size_t buflen,
198 #define DECLARE_NSS_PROTOTYPES(service) \
199 extern enum nss_status _nss_ ## service ## _setprotoent (int); \
200 extern enum nss_status _nss_ ## service ## _endprotoent (void); \
201 extern enum nss_status _nss_ ## service ## _getprotoent_r \
202 (struct protoent *proto, char *buffer, size_t buflen, \
204 extern enum nss_status _nss_ ## service ## _getprotobyname_r \
205 (const char *name, struct protoent *proto, \
206 char *buffer, size_t buflen, int *errnop); \
207 extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
208 (int number, struct protoent *proto, \
209 char *buffer, size_t buflen, int *errnop); \
210 extern enum nss_status _nss_ ## service ## _sethostent (int); \
211 extern enum nss_status _nss_ ## service ## _endhostent (void); \
212 extern enum nss_status _nss_ ## service ## _gethostent_r \
213 (struct hostent *host, char *buffer, size_t buflen, \
214 int *errnop, int *h_errnop); \
215 extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
216 (const char *name, int af, struct hostent *host, \
217 char *buffer, size_t buflen, int *errnop, \
219 extern enum nss_status _nss_ ## service ## _gethostbyname_r \
220 (const char *name, struct hostent *host, char *buffer, \
221 size_t buflen, int *errnop, int *h_errnop); \
222 extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \
223 (const void *addr, socklen_t addrlen, int af, \
224 struct hostent *host, char *buffer, size_t buflen, \
225 int *errnop, int *h_errnop); \
226 extern enum nss_status _nss_ ## service ## _setservent (int); \
227 extern enum nss_status _nss_ ## service ## _endservent (void); \
228 extern enum nss_status _nss_ ## service ## _getservent_r \
229 (struct servent *serv, char *buffer, size_t buflen, \
231 extern enum nss_status _nss_ ## service ## _getservbyname_r \
232 (const char *name, const char *protocol, \
233 struct servent *serv, char *buffer, size_t buflen, \
235 extern enum nss_status _nss_ ## service ## _getservbyport_r \
236 (int port, const char *protocol, struct servent *serv, \
237 char *buffer, size_t buflen, int *errnop); \
238 extern enum nss_status _nss_ ## service ## _setnetgrent \
239 (const char *group, struct __netgrent *result); \
240 extern enum nss_status _nss_ ## service ## _endnetgrent \
241 (struct __netgrent *result); \
242 extern enum nss_status _nss_ ## service ## _getnetgrent_r \
243 (struct __netgrent *result, char *buffer, \
244 size_t buflen, int *errnop); \
245 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
246 extern enum nss_status _nss_ ## service ## _endnetent (void); \
247 extern enum nss_status _nss_ ## service ## _getnetent_r \
248 (struct netent *net, char *buffer, size_t buflen, \
249 int *errnop, int *herrnop); \
250 extern enum nss_status _nss_ ## service ## _getnetbyname_r \
251 (const char *name, struct netent *net, char *buffer, \
252 size_t buflen, int *errnop, int *herrnop); \
253 extern enum nss_status _nss_ ## service ## _getnetbyaddr_r \
254 (uint32_t addr, int type, struct netent *net, \
255 char *buffer, size_t buflen, int *errnop, \
258 DECLARE_NSS_PROTOTYPES (compat)
259 DECLARE_NSS_PROTOTYPES (dns)
260 DECLARE_NSS_PROTOTYPES (files)
261 DECLARE_NSS_PROTOTYPES (hesiod)
262 DECLARE_NSS_PROTOTYPES (nis)
263 DECLARE_NSS_PROTOTYPES (nisplus)
265 #undef DECLARE_NSS_PROTOTYPES
267 #endif /* !_NETDB_H */