1#ifndef _NETDB_H
2#include <resolv/netdb.h>
3#include <stdint.h>
4
5#ifndef _ISOMAC
6/* Macros for accessing h_errno from inside libc. */
7# if IS_IN_LIB
8# undef h_errno
9# if IS_IN (libc)
10# define h_errno __libc_h_errno
11# else
12# define h_errno __h_errno
13# endif
14extern __thread int h_errno attribute_tls_model_ie;
15# endif /* IS_IN_LIB */
16# define __set_h_errno(x) (h_errno = (x))
17
18libc_hidden_proto (hstrerror)
19libc_hidden_proto (innetgr)
20libc_hidden_proto (rcmd_af)
21libc_hidden_proto (rexec_af)
22libc_hidden_proto (rresvport_af)
23libc_hidden_proto (ruserok_af)
24
25libc_hidden_proto (getaddrinfo)
26libc_hidden_proto (getnameinfo)
27libc_hidden_proto (freeaddrinfo)
28libc_hidden_proto (gai_strerror)
29libc_hidden_proto (__h_errno_location)
30
31/* Document internal interfaces. */
32extern int __gethostent_r (struct hostent *__restrict __result_buf,
33 char *__restrict __buf, size_t __buflen,
34 struct hostent **__restrict __result,
35 int *__restrict __h_errnop) attribute_hidden;
36extern int __old_gethostent_r (struct hostent *__restrict __result_buf,
37 char *__restrict __buf, size_t __buflen,
38 struct hostent **__restrict __result,
39 int *__restrict __h_errnop);
40
41extern int __gethostbyaddr_r (const void *__restrict __addr,
42 socklen_t __len, int __type,
43 struct hostent *__restrict __result_buf,
44 char *__restrict __buf, size_t __buflen,
45 struct hostent **__restrict __result,
46 int *__restrict __h_errnop);
47extern int __old_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
54extern int __gethostbyaddr2_r (const void *__restrict __addr,
55 socklen_t __len, int __type,
56 struct hostent *__restrict __result_buf,
57 char *__restrict __buf, size_t __buflen,
58 struct hostent **__restrict __result,
59 int *__restrict __h_errnop,
60 int32_t *ttlp);
61
62extern int __gethostbyname_r (const char *__restrict __name,
63 struct hostent *__restrict __result_buf,
64 char *__restrict __buf, size_t __buflen,
65 struct hostent **__restrict __result,
66 int *__restrict __h_errnop);
67extern int __old_gethostbyname_r (const char *__restrict __name,
68 struct hostent *__restrict __result_buf,
69 char *__restrict __buf, size_t __buflen,
70 struct hostent **__restrict __result,
71 int *__restrict __h_errnop);
72
73extern int __gethostbyname2_r (const char *__restrict __name, int __af,
74 struct hostent *__restrict __result_buf,
75 char *__restrict __buf, size_t __buflen,
76 struct hostent **__restrict __result,
77 int *__restrict __h_errnop);
78extern int __old_gethostbyname2_r (const char *__restrict __name, int __af,
79 struct hostent *__restrict __result_buf,
80 char *__restrict __buf, size_t __buflen,
81 struct hostent **__restrict __result,
82 int *__restrict __h_errnop);
83
84extern int __gethostbyname3_r (const char *__restrict __name, int __af,
85 struct hostent *__restrict __result_buf,
86 char *__restrict __buf, size_t __buflen,
87 struct hostent **__restrict __result,
88 int *__restrict __h_errnop,
89 int32_t *ttlp, char **canonp);
90
91extern int __getnetent_r (struct netent *__restrict __result_buf,
92 char *__restrict __buf, size_t __buflen,
93 struct netent **__restrict __result,
94 int *__restrict __h_errnop) attribute_hidden;
95extern int __old_getnetent_r (struct netent *__restrict __result_buf,
96 char *__restrict __buf, size_t __buflen,
97 struct netent **__restrict __result,
98 int *__restrict __h_errnop);
99
100extern int __getnetbyaddr_r (uint32_t __net, int __type,
101 struct netent *__restrict __result_buf,
102 char *__restrict __buf, size_t __buflen,
103 struct netent **__restrict __result,
104 int *__restrict __h_errnop);
105extern int __old_getnetbyaddr_r (uint32_t __net, int __type,
106 struct netent *__restrict __result_buf,
107 char *__restrict __buf, size_t __buflen,
108 struct netent **__restrict __result,
109 int *__restrict __h_errnop);
110
111extern int __getnetbyname_r (const char *__restrict __name,
112 struct netent *__restrict __result_buf,
113 char *__restrict __buf, size_t __buflen,
114 struct netent **__restrict __result,
115 int *__restrict __h_errnop);
116extern int __old_getnetbyname_r (const char *__restrict __name,
117 struct netent *__restrict __result_buf,
118 char *__restrict __buf, size_t __buflen,
119 struct netent **__restrict __result,
120 int *__restrict __h_errnop);
121
122extern int __getservent_r (struct servent *__restrict __result_buf,
123 char *__restrict __buf, size_t __buflen,
124 struct servent **__restrict __result)
125 attribute_hidden;
126extern int __old_getservent_r (struct servent *__restrict __result_buf,
127 char *__restrict __buf, size_t __buflen,
128 struct servent **__restrict __result);
129
130extern int __getservbyname_r (const char *__restrict __name,
131 const char *__restrict __proto,
132 struct servent *__restrict __result_buf,
133 char *__restrict __buf, size_t __buflen,
134 struct servent **__restrict __result);
135extern int __old_getservbyname_r (const char *__restrict __name,
136 const char *__restrict __proto,
137 struct servent *__restrict __result_buf,
138 char *__restrict __buf, size_t __buflen,
139 struct servent **__restrict __result);
140
141extern int __getservbyport_r (int __port,
142 const char *__restrict __proto,
143 struct servent *__restrict __result_buf,
144 char *__restrict __buf, size_t __buflen,
145 struct servent **__restrict __result);
146extern int __old_getservbyport_r (int __port,
147 const char *__restrict __proto,
148 struct servent *__restrict __result_buf,
149 char *__restrict __buf, size_t __buflen,
150 struct servent **__restrict __result);
151
152extern int __getprotoent_r (struct protoent *__restrict __result_buf,
153 char *__restrict __buf, size_t __buflen,
154 struct protoent **__restrict __result)
155 attribute_hidden;
156extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
157 char *__restrict __buf, size_t __buflen,
158 struct protoent **__restrict __result);
159
160extern int __getprotobyname_r (const char *__restrict __name,
161 struct protoent *__restrict __result_buf,
162 char *__restrict __buf, size_t __buflen,
163 struct protoent **__restrict __result);
164extern int __old_getprotobyname_r (const char *__restrict __name,
165 struct protoent *__restrict __result_buf,
166 char *__restrict __buf, size_t __buflen,
167 struct protoent **__restrict __result);
168
169extern int __getprotobynumber_r (int __proto,
170 struct protoent *__restrict __res_buf,
171 char *__restrict __buf, size_t __buflen,
172 struct protoent **__restrict __result);
173extern int __old_getprotobynumber_r (int __proto,
174 struct protoent *__restrict __res_buf,
175 char *__restrict __buf, size_t __buflen,
176 struct protoent **__restrict __result);
177
178extern int __getnetgrent_r (char **__restrict __hostp,
179 char **__restrict __userp,
180 char **__restrict __domainp,
181 char *__restrict __buffer, size_t __buflen);
182
183extern int ruserpass (const char *host, const char **aname,
184 const char **apass);
185libc_hidden_proto (ruserpass)
186
187
188/* The following definition has been removed from the public header
189 since we don't want people to use them. */
190
191#define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
192
193#include <inet/netgroup.h>
194
195struct parser_data;
196extern int _nss_files_parse_protoent (char *line, struct protoent *result,
197 struct parser_data *data,
198 size_t datalen, int *errnop);
199extern int _nss_files_parse_servent (char *line, struct servent *result,
200 struct parser_data *data,
201 size_t datalen, int *errnop);
202extern int _nss_files_parse_netent (char *line, struct netent *result,
203 struct parser_data *data,
204 size_t datalen, int *errnop);
205extern enum nss_status _nss_netgroup_parseline (char **cursor,
206 struct __netgrent *result,
207 char *buffer, size_t buflen,
208 int *errnop);
209libnss_files_hidden_proto (_nss_files_parse_protoent)
210libnss_files_hidden_proto (_nss_files_parse_servent)
211libnss_files_hidden_proto (_nss_files_parse_netent)
212libnss_files_hidden_proto (_nss_netgroup_parseline)
213
214#define DECLARE_NSS_PROTOTYPES(service) \
215extern enum nss_status _nss_ ## service ## _setprotoent (int); \
216extern enum nss_status _nss_ ## service ## _endprotoent (void); \
217extern enum nss_status _nss_ ## service ## _getprotoent_r \
218 (struct protoent *proto, char *buffer, size_t buflen, \
219 int *errnop); \
220extern enum nss_status _nss_ ## service ## _getprotobyname_r \
221 (const char *name, struct protoent *proto, \
222 char *buffer, size_t buflen, int *errnop); \
223extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
224 (int number, struct protoent *proto, \
225 char *buffer, size_t buflen, int *errnop); \
226extern enum nss_status _nss_ ## service ## _sethostent (int); \
227extern enum nss_status _nss_ ## service ## _endhostent (void); \
228extern enum nss_status _nss_ ## service ## _gethostent_r \
229 (struct hostent *host, char *buffer, size_t buflen, \
230 int *errnop, int *h_errnop); \
231extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
232 (const char *name, int af, struct hostent *host, \
233 char *buffer, size_t buflen, int *errnop, \
234 int *h_errnop); \
235extern enum nss_status _nss_ ## service ## _gethostbyname_r \
236 (const char *name, struct hostent *host, char *buffer, \
237 size_t buflen, int *errnop, int *h_errnop); \
238extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \
239 (const void *addr, socklen_t addrlen, int af, \
240 struct hostent *host, char *buffer, size_t buflen, \
241 int *errnop, int *h_errnop); \
242extern enum nss_status _nss_ ## service ## _setservent (int); \
243extern enum nss_status _nss_ ## service ## _endservent (void); \
244extern enum nss_status _nss_ ## service ## _getservent_r \
245 (struct servent *serv, char *buffer, size_t buflen, \
246 int *errnop); \
247extern enum nss_status _nss_ ## service ## _getservbyname_r \
248 (const char *name, const char *protocol, \
249 struct servent *serv, char *buffer, size_t buflen, \
250 int *errnop); \
251extern enum nss_status _nss_ ## service ## _getservbyport_r \
252 (int port, const char *protocol, struct servent *serv, \
253 char *buffer, size_t buflen, int *errnop); \
254extern enum nss_status _nss_ ## service ## _setnetgrent \
255 (const char *group, struct __netgrent *result); \
256extern enum nss_status _nss_ ## service ## _endnetgrent \
257 (struct __netgrent *result); \
258extern enum nss_status _nss_ ## service ## _getnetgrent_r \
259 (struct __netgrent *result, char *buffer, \
260 size_t buflen, int *errnop); \
261extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
262extern enum nss_status _nss_ ## service ## _endnetent (void); \
263extern enum nss_status _nss_ ## service ## _getnetent_r \
264 (struct netent *net, char *buffer, size_t buflen, \
265 int *errnop, int *herrnop); \
266extern enum nss_status _nss_ ## service ## _getnetbyname_r \
267 (const char *name, struct netent *net, char *buffer, \
268 size_t buflen, int *errnop, int *herrnop); \
269extern enum nss_status _nss_ ## service ## _getnetbyaddr_r \
270 (uint32_t addr, int type, struct netent *net, \
271 char *buffer, size_t buflen, int *errnop, \
272 int *herrnop);
273
274DECLARE_NSS_PROTOTYPES (compat)
275DECLARE_NSS_PROTOTYPES (dns)
276DECLARE_NSS_PROTOTYPES (files)
277DECLARE_NSS_PROTOTYPES (hesiod)
278DECLARE_NSS_PROTOTYPES (nis)
279DECLARE_NSS_PROTOTYPES (nisplus)
280
281#undef DECLARE_NSS_PROTOTYPES
282#endif
283
284#endif /* !_NETDB_H */
285