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