New string function explicit_bzero (from OpenBSD).
[glibc.git] / include / netdb.h
blobe1f051d16ace7563aee78f81e9653c5b2a04456a
1 #ifndef _NETDB_H
2 #include <resolv/netdb.h>
3 #include <stdint.h>
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
14 extern __thread int h_errno attribute_tls_model_ie;
15 # endif /* IS_IN_LIB */
16 # define __set_h_errno(x) (h_errno = (x))
18 libc_hidden_proto (hstrerror)
19 libc_hidden_proto (innetgr)
20 libc_hidden_proto (rcmd_af)
21 libc_hidden_proto (rexec_af)
22 libc_hidden_proto (rresvport_af)
23 libc_hidden_proto (ruserok_af)
25 libc_hidden_proto (getaddrinfo)
26 libc_hidden_proto (getnameinfo)
27 libc_hidden_proto (freeaddrinfo)
28 libc_hidden_proto (gai_strerror)
29 libc_hidden_proto (__h_errno_location)
31 /* Document internal interfaces. */
32 extern 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;
36 extern 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);
41 extern 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);
47 extern 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);
54 extern 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);
62 extern 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);
67 extern 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);
73 extern 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);
78 extern 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);
84 extern 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);
91 extern 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;
95 extern 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);
100 extern 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);
105 extern 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);
111 extern 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);
116 extern 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);
122 extern int __getservent_r (struct servent *__restrict __result_buf,
123 char *__restrict __buf, size_t __buflen,
124 struct servent **__restrict __result)
125 attribute_hidden;
126 extern int __old_getservent_r (struct servent *__restrict __result_buf,
127 char *__restrict __buf, size_t __buflen,
128 struct servent **__restrict __result);
130 extern 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);
135 extern 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);
141 extern 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);
146 extern 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);
152 extern int __getprotoent_r (struct protoent *__restrict __result_buf,
153 char *__restrict __buf, size_t __buflen,
154 struct protoent **__restrict __result)
155 attribute_hidden;
156 extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
157 char *__restrict __buf, size_t __buflen,
158 struct protoent **__restrict __result);
160 extern 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);
164 extern 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);
169 extern int __getprotobynumber_r (int __proto,
170 struct protoent *__restrict __res_buf,
171 char *__restrict __buf, size_t __buflen,
172 struct protoent **__restrict __result);
173 extern int __old_getprotobynumber_r (int __proto,
174 struct protoent *__restrict __res_buf,
175 char *__restrict __buf, size_t __buflen,
176 struct protoent **__restrict __result);
178 extern int __getnetgrent_r (char **__restrict __hostp,
179 char **__restrict __userp,
180 char **__restrict __domainp,
181 char *__restrict __buffer, size_t __buflen);
183 extern int ruserpass (const char *host, const char **aname,
184 const char **apass);
185 libc_hidden_proto (ruserpass)
188 /* The following definition has been removed from the public header
189 since we don't want people to use them. */
191 #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
193 #include <inet/netgroup.h>
195 struct parser_data;
196 extern int _nss_files_parse_protoent (char *line, struct protoent *result,
197 struct parser_data *data,
198 size_t datalen, int *errnop);
199 extern int _nss_files_parse_servent (char *line, struct servent *result,
200 struct parser_data *data,
201 size_t datalen, int *errnop);
202 extern int _nss_files_parse_netent (char *line, struct netent *result,
203 struct parser_data *data,
204 size_t datalen, int *errnop);
205 extern enum nss_status _nss_netgroup_parseline (char **cursor,
206 struct __netgrent *result,
207 char *buffer, size_t buflen,
208 int *errnop);
209 libnss_files_hidden_proto (_nss_files_parse_protoent)
210 libnss_files_hidden_proto (_nss_files_parse_servent)
211 libnss_files_hidden_proto (_nss_files_parse_netent)
212 libnss_files_hidden_proto (_nss_netgroup_parseline)
214 #define DECLARE_NSS_PROTOTYPES(service) \
215 extern enum nss_status _nss_ ## service ## _setprotoent (int); \
216 extern enum nss_status _nss_ ## service ## _endprotoent (void); \
217 extern enum nss_status _nss_ ## service ## _getprotoent_r \
218 (struct protoent *proto, char *buffer, size_t buflen, \
219 int *errnop); \
220 extern enum nss_status _nss_ ## service ## _getprotobyname_r \
221 (const char *name, struct protoent *proto, \
222 char *buffer, size_t buflen, int *errnop); \
223 extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
224 (int number, struct protoent *proto, \
225 char *buffer, size_t buflen, int *errnop); \
226 extern enum nss_status _nss_ ## service ## _sethostent (int); \
227 extern enum nss_status _nss_ ## service ## _endhostent (void); \
228 extern enum nss_status _nss_ ## service ## _gethostent_r \
229 (struct hostent *host, char *buffer, size_t buflen, \
230 int *errnop, int *h_errnop); \
231 extern 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); \
235 extern 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); \
238 extern 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); \
242 extern enum nss_status _nss_ ## service ## _setservent (int); \
243 extern enum nss_status _nss_ ## service ## _endservent (void); \
244 extern enum nss_status _nss_ ## service ## _getservent_r \
245 (struct servent *serv, char *buffer, size_t buflen, \
246 int *errnop); \
247 extern 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); \
251 extern enum nss_status _nss_ ## service ## _getservbyport_r \
252 (int port, const char *protocol, struct servent *serv, \
253 char *buffer, size_t buflen, int *errnop); \
254 extern enum nss_status _nss_ ## service ## _setnetgrent \
255 (const char *group, struct __netgrent *result); \
256 extern enum nss_status _nss_ ## service ## _endnetgrent \
257 (struct __netgrent *result); \
258 extern enum nss_status _nss_ ## service ## _getnetgrent_r \
259 (struct __netgrent *result, char *buffer, \
260 size_t buflen, int *errnop); \
261 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
262 extern enum nss_status _nss_ ## service ## _endnetent (void); \
263 extern enum nss_status _nss_ ## service ## _getnetent_r \
264 (struct netent *net, char *buffer, size_t buflen, \
265 int *errnop, int *herrnop); \
266 extern enum nss_status _nss_ ## service ## _getnetbyname_r \
267 (const char *name, struct netent *net, char *buffer, \
268 size_t buflen, int *errnop, int *herrnop); \
269 extern 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);
274 DECLARE_NSS_PROTOTYPES (compat)
275 DECLARE_NSS_PROTOTYPES (dns)
276 DECLARE_NSS_PROTOTYPES (files)
277 DECLARE_NSS_PROTOTYPES (hesiod)
278 DECLARE_NSS_PROTOTYPES (nis)
279 DECLARE_NSS_PROTOTYPES (nisplus)
281 #undef DECLARE_NSS_PROTOTYPES
282 #endif
284 #endif /* !_NETDB_H */