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 (hstrerror)
25 libc_hidden_proto (innetgr)
26 libc_hidden_proto (rcmd_af)
27 libc_hidden_proto (rexec_af)
28 libc_hidden_proto (rresvport_af)
29 libc_hidden_proto (ruserok_af)
31 libc_hidden_proto (getaddrinfo)
32 libc_hidden_proto (getnameinfo)
33 libc_hidden_proto (freeaddrinfo)
35 /* Document internal interfaces. */
36 extern int __gethostent_r (struct hostent *__restrict __result_buf,
37 char *__restrict __buf, size_t __buflen,
38 struct hostent **__restrict __result,
39 int *__restrict __h_errnop) attribute_hidden;
40 extern int __old_gethostent_r (struct hostent *__restrict __result_buf,
41 char *__restrict __buf, size_t __buflen,
42 struct hostent **__restrict __result,
43 int *__restrict __h_errnop);
45 extern int __gethostbyaddr_r (__const void *__restrict __addr,
46 socklen_t __len, int __type,
47 struct hostent *__restrict __result_buf,
48 char *__restrict __buf, size_t __buflen,
49 struct hostent **__restrict __result,
50 int *__restrict __h_errnop);
51 extern int __old_gethostbyaddr_r (__const void *__restrict __addr,
52 socklen_t __len, int __type,
53 struct hostent *__restrict __result_buf,
54 char *__restrict __buf, size_t __buflen,
55 struct hostent **__restrict __result,
56 int *__restrict __h_errnop);
58 extern int __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);
63 extern int __old_gethostbyname_r (__const char *__restrict __name,
64 struct hostent *__restrict __result_buf,
65 char *__restrict __buf, size_t __buflen,
66 struct hostent **__restrict __result,
67 int *__restrict __h_errnop);
69 extern int __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);
74 extern int __old_gethostbyname2_r (__const char *__restrict __name, int __af,
75 struct hostent *__restrict __result_buf,
76 char *__restrict __buf, size_t __buflen,
77 struct hostent **__restrict __result,
78 int *__restrict __h_errnop);
80 extern int __getnetent_r (struct netent *__restrict __result_buf,
81 char *__restrict __buf, size_t __buflen,
82 struct netent **__restrict __result,
83 int *__restrict __h_errnop) attribute_hidden;
84 extern int __old_getnetent_r (struct netent *__restrict __result_buf,
85 char *__restrict __buf, size_t __buflen,
86 struct netent **__restrict __result,
87 int *__restrict __h_errnop);
89 extern int __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);
94 extern int __old_getnetbyaddr_r (uint32_t __net, int __type,
95 struct netent *__restrict __result_buf,
96 char *__restrict __buf, size_t __buflen,
97 struct netent **__restrict __result,
98 int *__restrict __h_errnop);
100 extern int __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);
105 extern int __old_getnetbyname_r (__const char *__restrict __name,
106 struct netent *__restrict __result_buf,
107 char *__restrict __buf, size_t __buflen,
108 struct netent **__restrict __result,
109 int *__restrict __h_errnop);
111 extern int __getservent_r (struct servent *__restrict __result_buf,
112 char *__restrict __buf, size_t __buflen,
113 struct servent **__restrict __result)
115 extern int __old_getservent_r (struct servent *__restrict __result_buf,
116 char *__restrict __buf, size_t __buflen,
117 struct servent **__restrict __result);
119 extern int __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);
124 extern int __old_getservbyname_r (__const char *__restrict __name,
125 __const char *__restrict __proto,
126 struct servent *__restrict __result_buf,
127 char *__restrict __buf, size_t __buflen,
128 struct servent **__restrict __result);
130 extern int __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);
135 extern int __old_getservbyport_r (int __port,
136 __const char *__restrict __proto,
137 struct servent *__restrict __result_buf,
138 char *__restrict __buf, size_t __buflen,
139 struct servent **__restrict __result);
141 extern int __getprotoent_r (struct protoent *__restrict __result_buf,
142 char *__restrict __buf, size_t __buflen,
143 struct protoent **__restrict __result)
145 extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
146 char *__restrict __buf, size_t __buflen,
147 struct protoent **__restrict __result);
149 extern int __getprotobyname_r (__const char *__restrict __name,
150 struct protoent *__restrict __result_buf,
151 char *__restrict __buf, size_t __buflen,
152 struct protoent **__restrict __result);
153 extern int __old_getprotobyname_r (__const char *__restrict __name,
154 struct protoent *__restrict __result_buf,
155 char *__restrict __buf, size_t __buflen,
156 struct protoent **__restrict __result);
158 extern int __getprotobynumber_r (int __proto,
159 struct protoent *__restrict __res_buf,
160 char *__restrict __buf, size_t __buflen,
161 struct protoent **__restrict __result);
162 extern int __old_getprotobynumber_r (int __proto,
163 struct protoent *__restrict __res_buf,
164 char *__restrict __buf, size_t __buflen,
165 struct protoent **__restrict __result);
167 extern int __getnetgrent_r (char **__restrict __hostp,
168 char **__restrict __userp,
169 char **__restrict __domainp,
170 char *__restrict __buffer, size_t __buflen);
172 extern int ruserpass (const char *host, const char **aname,
174 libc_hidden_proto (ruserpass)
177 /* The following declarations and definitions have been removed from
178 the public header since we don't want people to use them. */
180 #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */
181 #define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */
182 #define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
183 returned address type. */
184 #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
186 #include <inet/netgroup.h>
189 extern int _nss_files_parse_protoent (char *line, struct protoent *result,
190 struct parser_data *data,
191 size_t datalen, int *errnop);
192 extern int _nss_files_parse_servent (char *line, struct servent *result,
193 struct parser_data *data,
194 size_t datalen, int *errnop);
195 extern int _nss_files_parse_netent (char *line, struct netent *result,
196 struct parser_data *data,
197 size_t datalen, int *errnop);
198 extern enum nss_status _nss_netgroup_parseline (char **cursor,
199 struct __netgrent *result,
200 char *buffer, size_t buflen,
204 #define DECLARE_NSS_PROTOTYPES(service) \
205 extern enum nss_status _nss_ ## service ## _setprotoent (int); \
206 extern enum nss_status _nss_ ## service ## _endprotoent (void); \
207 extern enum nss_status _nss_ ## service ## _getprotoent_r \
208 (struct protoent *proto, char *buffer, size_t buflen, \
210 extern enum nss_status _nss_ ## service ## _getprotobyname_r \
211 (const char *name, struct protoent *proto, \
212 char *buffer, size_t buflen, int *errnop); \
213 extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
214 (int number, struct protoent *proto, \
215 char *buffer, size_t buflen, int *errnop); \
216 extern enum nss_status _nss_ ## service ## _sethostent (int); \
217 extern enum nss_status _nss_ ## service ## _endhostent (void); \
218 extern enum nss_status _nss_ ## service ## _gethostent_r \
219 (struct hostent *host, char *buffer, size_t buflen, \
220 int *errnop, int *h_errnop); \
221 extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
222 (const char *name, int af, struct hostent *host, \
223 char *buffer, size_t buflen, int *errnop, \
225 extern enum nss_status _nss_ ## service ## _gethostbyname_r \
226 (const char *name, struct hostent *host, char *buffer, \
227 size_t buflen, int *errnop, int *h_errnop); \
228 extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \
229 (const void *addr, socklen_t addrlen, int af, \
230 struct hostent *host, char *buffer, size_t buflen, \
231 int *errnop, int *h_errnop); \
232 extern enum nss_status _nss_ ## service ## _setservent (int); \
233 extern enum nss_status _nss_ ## service ## _endservent (void); \
234 extern enum nss_status _nss_ ## service ## _getservent_r \
235 (struct servent *serv, char *buffer, size_t buflen, \
237 extern enum nss_status _nss_ ## service ## _getservbyname_r \
238 (const char *name, const char *protocol, \
239 struct servent *serv, char *buffer, size_t buflen, \
241 extern enum nss_status _nss_ ## service ## _getservbyport_r \
242 (int port, const char *protocol, struct servent *serv, \
243 char *buffer, size_t buflen, int *errnop); \
244 extern enum nss_status _nss_ ## service ## _setnetgrent \
245 (const char *group, struct __netgrent *result); \
246 extern enum nss_status _nss_ ## service ## _endnetgrent \
247 (struct __netgrent *result); \
248 extern enum nss_status _nss_ ## service ## _getnetgrent_r \
249 (struct __netgrent *result, char *buffer, \
250 size_t buflen, int *errnop); \
251 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
252 extern enum nss_status _nss_ ## service ## _endnetent (void); \
253 extern enum nss_status _nss_ ## service ## _getnetent_r \
254 (struct netent *net, char *buffer, size_t buflen, \
255 int *errnop, int *herrnop); \
256 extern enum nss_status _nss_ ## service ## _getnetbyname_r \
257 (const char *name, struct netent *net, char *buffer, \
258 size_t buflen, int *errnop, int *herrnop); \
259 extern enum nss_status _nss_ ## service ## _getnetbyaddr_r \
260 (uint32_t addr, int type, struct netent *net, \
261 char *buffer, size_t buflen, int *errnop, \
264 DECLARE_NSS_PROTOTYPES (compat)
265 DECLARE_NSS_PROTOTYPES (dns)
266 DECLARE_NSS_PROTOTYPES (files)
267 DECLARE_NSS_PROTOTYPES (hesiod)
268 DECLARE_NSS_PROTOTYPES (nis)
269 DECLARE_NSS_PROTOTYPES (nisplus)
271 #undef DECLARE_NSS_PROTOTYPES
273 #endif /* !_NETDB_H */