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