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 /* Document internal interfaces. */
25 extern int __gethostent_r (struct hostent *__restrict __result_buf,
26 char *__restrict __buf, size_t __buflen,
27 struct hostent **__restrict __result,
28 int *__restrict __h_errnop) attribute_hidden;
29 extern int __old_gethostent_r (struct hostent *__restrict __result_buf,
30 char *__restrict __buf, size_t __buflen,
31 struct hostent **__restrict __result,
32 int *__restrict __h_errnop);
34 extern int __gethostbyaddr_r (__const void *__restrict __addr,
35 socklen_t __len, int __type,
36 struct hostent *__restrict __result_buf,
37 char *__restrict __buf, size_t __buflen,
38 struct hostent **__restrict __result,
39 int *__restrict __h_errnop);
40 extern int __old_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);
47 extern int __gethostbyname_r (__const char *__restrict __name,
48 struct hostent *__restrict __result_buf,
49 char *__restrict __buf, size_t __buflen,
50 struct hostent **__restrict __result,
51 int *__restrict __h_errnop);
52 extern int __old_gethostbyname_r (__const char *__restrict __name,
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 __gethostbyname2_r (__const char *__restrict __name, int __af,
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_gethostbyname2_r (__const char *__restrict __name, int __af,
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 __getnetent_r (struct netent *__restrict __result_buf,
70 char *__restrict __buf, size_t __buflen,
71 struct netent **__restrict __result,
72 int *__restrict __h_errnop) attribute_hidden;
73 extern int __old_getnetent_r (struct netent *__restrict __result_buf,
74 char *__restrict __buf, size_t __buflen,
75 struct netent **__restrict __result,
76 int *__restrict __h_errnop);
78 extern int __getnetbyaddr_r (uint32_t __net, int __type,
79 struct netent *__restrict __result_buf,
80 char *__restrict __buf, size_t __buflen,
81 struct netent **__restrict __result,
82 int *__restrict __h_errnop);
83 extern int __old_getnetbyaddr_r (uint32_t __net, int __type,
84 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 __getnetbyname_r (__const char *__restrict __name,
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_getnetbyname_r (__const char *__restrict __name,
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 __getservent_r (struct servent *__restrict __result_buf,
101 char *__restrict __buf, size_t __buflen,
102 struct servent **__restrict __result)
104 extern int __old_getservent_r (struct servent *__restrict __result_buf,
105 char *__restrict __buf, size_t __buflen,
106 struct servent **__restrict __result);
108 extern int __getservbyname_r (__const char *__restrict __name,
109 __const char *__restrict __proto,
110 struct servent *__restrict __result_buf,
111 char *__restrict __buf, size_t __buflen,
112 struct servent **__restrict __result);
113 extern int __old_getservbyname_r (__const char *__restrict __name,
114 __const char *__restrict __proto,
115 struct servent *__restrict __result_buf,
116 char *__restrict __buf, size_t __buflen,
117 struct servent **__restrict __result);
119 extern int __getservbyport_r (int __port,
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_getservbyport_r (int __port,
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 __getprotoent_r (struct protoent *__restrict __result_buf,
131 char *__restrict __buf, size_t __buflen,
132 struct protoent **__restrict __result)
134 extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
135 char *__restrict __buf, size_t __buflen,
136 struct protoent **__restrict __result);
138 extern int __getprotobyname_r (__const char *__restrict __name,
139 struct protoent *__restrict __result_buf,
140 char *__restrict __buf, size_t __buflen,
141 struct protoent **__restrict __result);
142 extern int __old_getprotobyname_r (__const char *__restrict __name,
143 struct protoent *__restrict __result_buf,
144 char *__restrict __buf, size_t __buflen,
145 struct protoent **__restrict __result);
147 extern int __getprotobynumber_r (int __proto,
148 struct protoent *__restrict __res_buf,
149 char *__restrict __buf, size_t __buflen,
150 struct protoent **__restrict __result);
151 extern int __old_getprotobynumber_r (int __proto,
152 struct protoent *__restrict __res_buf,
153 char *__restrict __buf, size_t __buflen,
154 struct protoent **__restrict __result);
156 extern int __getnetgrent_r (char **__restrict __hostp,
157 char **__restrict __userp,
158 char **__restrict __domainp,
159 char *__restrict __buffer, size_t __buflen);
161 extern int ruserpass (const char *host, const char **aname,
165 /* The following declarations and definitions have been removed from
166 the public header since we don't want people to use them. */
168 #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */
169 #define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */
170 #define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
171 returned address type. */
172 #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
174 #include <inet/netgroup.h>
177 extern int _nss_files_parse_protoent (char *line, struct protoent *result,
178 struct parser_data *data,
179 size_t datalen, int *errnop);
180 extern int _nss_files_parse_servent (char *line, struct servent *result,
181 struct parser_data *data,
182 size_t datalen, int *errnop);
183 extern int _nss_files_parse_netent (char *line, struct netent *result,
184 struct parser_data *data,
185 size_t datalen, int *errnop);
186 extern enum nss_status _nss_netgroup_parseline (char **cursor,
187 struct __netgrent *result,
188 char *buffer, size_t buflen,
192 #define DECLARE_NSS_PROTOTYPES(service) \
193 extern enum nss_status _nss_ ## service ## _setprotoent (int); \
194 extern enum nss_status _nss_ ## service ## _endprotoent (void); \
195 extern enum nss_status _nss_ ## service ## _getprotoent_r \
196 (struct protoent *proto, char *buffer, size_t buflen, \
198 extern enum nss_status _nss_ ## service ## _getprotobyname_r \
199 (const char *name, struct protoent *proto, \
200 char *buffer, size_t buflen, int *errnop); \
201 extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
202 (int number, struct protoent *proto, \
203 char *buffer, size_t buflen, int *errnop); \
204 extern enum nss_status _nss_ ## service ## _sethostent (int); \
205 extern enum nss_status _nss_ ## service ## _endhostent (void); \
206 extern enum nss_status _nss_ ## service ## _gethostent_r \
207 (struct hostent *host, char *buffer, size_t buflen, \
208 int *errnop, int *h_errnop); \
209 extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
210 (const char *name, int af, struct hostent *host, \
211 char *buffer, size_t buflen, int *errnop, \
213 extern enum nss_status _nss_ ## service ## _gethostbyname_r \
214 (const char *name, struct hostent *host, char *buffer, \
215 size_t buflen, int *errnop, int *h_errnop); \
216 extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \
217 (const void *addr, socklen_t addrlen, int af, \
218 struct hostent *host, char *buffer, size_t buflen, \
219 int *errnop, int *h_errnop); \
220 extern enum nss_status _nss_ ## service ## _setservent (int); \
221 extern enum nss_status _nss_ ## service ## _endservent (void); \
222 extern enum nss_status _nss_ ## service ## _getservent_r \
223 (struct servent *serv, char *buffer, size_t buflen, \
225 extern enum nss_status _nss_ ## service ## _getservbyname_r \
226 (const char *name, const char *protocol, \
227 struct servent *serv, char *buffer, size_t buflen, \
229 extern enum nss_status _nss_ ## service ## _getservbyport_r \
230 (int port, const char *protocol, struct servent *serv, \
231 char *buffer, size_t buflen, int *errnop); \
232 extern enum nss_status _nss_ ## service ## _setnetgrent \
233 (const char *group, struct __netgrent *result); \
234 extern enum nss_status _nss_ ## service ## _endnetgrent \
235 (struct __netgrent *result); \
236 extern enum nss_status _nss_ ## service ## _getnetgrent_r \
237 (struct __netgrent *result, char *buffer, \
238 size_t buflen, int *errnop); \
239 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
240 extern enum nss_status _nss_ ## service ## _endnetent (void); \
241 extern enum nss_status _nss_ ## service ## _getnetent_r \
242 (struct netent *net, char *buffer, size_t buflen, \
243 int *errnop, int *herrnop); \
244 extern enum nss_status _nss_ ## service ## _getnetbyname_r \
245 (const char *name, struct netent *net, char *buffer, \
246 size_t buflen, int *errnop, int *herrnop); \
247 extern enum nss_status _nss_ ## service ## _getnetbyaddr_r \
248 (uint32_t addr, int type, struct netent *net, \
249 char *buffer, size_t buflen, int *errnop, \
252 DECLARE_NSS_PROTOTYPES (compat)
253 DECLARE_NSS_PROTOTYPES (dns)
254 DECLARE_NSS_PROTOTYPES (files)
255 DECLARE_NSS_PROTOTYPES (hesiod)
256 DECLARE_NSS_PROTOTYPES (nis)
257 DECLARE_NSS_PROTOTYPES (nisplus)
259 #undef DECLARE_NSS_PROTOTYPES
261 #endif /* !_NETDB_H */