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