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