Augment last change.
[glibc/history.git] / include / netdb.h
blob0bf84c21c0e09983cbcbb062291a99ef2358530f
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 libnss_files_hidden_proto (_nss_files_parse_protoent)
206 libnss_files_hidden_proto (_nss_files_parse_servent)
207 libnss_files_hidden_proto (_nss_files_parse_netent)
208 libnss_files_hidden_proto (_nss_netgroup_parseline)
210 #define DECLARE_NSS_PROTOTYPES(service) \
211 extern enum nss_status _nss_ ## service ## _setprotoent (int); \
212 extern enum nss_status _nss_ ## service ## _endprotoent (void); \
213 extern enum nss_status _nss_ ## service ## _getprotoent_r \
214 (struct protoent *proto, char *buffer, size_t buflen, \
215 int *errnop); \
216 extern enum nss_status _nss_ ## service ## _getprotobyname_r \
217 (const char *name, struct protoent *proto, \
218 char *buffer, size_t buflen, int *errnop); \
219 extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
220 (int number, struct protoent *proto, \
221 char *buffer, size_t buflen, int *errnop); \
222 extern enum nss_status _nss_ ## service ## _sethostent (int); \
223 extern enum nss_status _nss_ ## service ## _endhostent (void); \
224 extern enum nss_status _nss_ ## service ## _gethostent_r \
225 (struct hostent *host, char *buffer, size_t buflen, \
226 int *errnop, int *h_errnop); \
227 extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
228 (const char *name, int af, struct hostent *host, \
229 char *buffer, size_t buflen, int *errnop, \
230 int *h_errnop); \
231 extern enum nss_status _nss_ ## service ## _gethostbyname_r \
232 (const char *name, struct hostent *host, char *buffer, \
233 size_t buflen, int *errnop, int *h_errnop); \
234 extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \
235 (const void *addr, socklen_t addrlen, int af, \
236 struct hostent *host, char *buffer, size_t buflen, \
237 int *errnop, int *h_errnop); \
238 extern enum nss_status _nss_ ## service ## _setservent (int); \
239 extern enum nss_status _nss_ ## service ## _endservent (void); \
240 extern enum nss_status _nss_ ## service ## _getservent_r \
241 (struct servent *serv, char *buffer, size_t buflen, \
242 int *errnop); \
243 extern enum nss_status _nss_ ## service ## _getservbyname_r \
244 (const char *name, const char *protocol, \
245 struct servent *serv, char *buffer, size_t buflen, \
246 int *errnop); \
247 extern enum nss_status _nss_ ## service ## _getservbyport_r \
248 (int port, const char *protocol, struct servent *serv, \
249 char *buffer, size_t buflen, int *errnop); \
250 extern enum nss_status _nss_ ## service ## _setnetgrent \
251 (const char *group, struct __netgrent *result); \
252 extern enum nss_status _nss_ ## service ## _endnetgrent \
253 (struct __netgrent *result); \
254 extern enum nss_status _nss_ ## service ## _getnetgrent_r \
255 (struct __netgrent *result, char *buffer, \
256 size_t buflen, int *errnop); \
257 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
258 extern enum nss_status _nss_ ## service ## _endnetent (void); \
259 extern enum nss_status _nss_ ## service ## _getnetent_r \
260 (struct netent *net, char *buffer, size_t buflen, \
261 int *errnop, int *herrnop); \
262 extern enum nss_status _nss_ ## service ## _getnetbyname_r \
263 (const char *name, struct netent *net, char *buffer, \
264 size_t buflen, int *errnop, int *herrnop); \
265 extern enum nss_status _nss_ ## service ## _getnetbyaddr_r \
266 (uint32_t addr, int type, struct netent *net, \
267 char *buffer, size_t buflen, int *errnop, \
268 int *herrnop);
270 DECLARE_NSS_PROTOTYPES (compat)
271 DECLARE_NSS_PROTOTYPES (dns)
272 DECLARE_NSS_PROTOTYPES (files)
273 DECLARE_NSS_PROTOTYPES (hesiod)
274 DECLARE_NSS_PROTOTYPES (nis)
275 DECLARE_NSS_PROTOTYPES (nisplus)
277 #undef DECLARE_NSS_PROTOTYPES
279 #endif /* !_NETDB_H */