Fix error checking in iconv.
[glibc.git] / include / netdb.h
blob9bbe31b438da6e339e4ae5a393f6c922c2d0143b
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 __gethostbyaddr2_r (__const void *__restrict __addr,
66 socklen_t __len, int __type,
67 struct hostent *__restrict __result_buf,
68 char *__restrict __buf, size_t __buflen,
69 struct hostent **__restrict __result,
70 int *__restrict __h_errnop,
71 int32_t *ttlp);
73 extern int __gethostbyname_r (__const char *__restrict __name,
74 struct hostent *__restrict __result_buf,
75 char *__restrict __buf, size_t __buflen,
76 struct hostent **__restrict __result,
77 int *__restrict __h_errnop);
78 extern int __old_gethostbyname_r (__const char *__restrict __name,
79 struct hostent *__restrict __result_buf,
80 char *__restrict __buf, size_t __buflen,
81 struct hostent **__restrict __result,
82 int *__restrict __h_errnop);
84 extern int __gethostbyname2_r (__const char *__restrict __name, int __af,
85 struct hostent *__restrict __result_buf,
86 char *__restrict __buf, size_t __buflen,
87 struct hostent **__restrict __result,
88 int *__restrict __h_errnop);
89 extern int __old_gethostbyname2_r (__const char *__restrict __name, int __af,
90 struct hostent *__restrict __result_buf,
91 char *__restrict __buf, size_t __buflen,
92 struct hostent **__restrict __result,
93 int *__restrict __h_errnop);
95 extern int __gethostbyname3_r (__const char *__restrict __name, int __af,
96 struct hostent *__restrict __result_buf,
97 char *__restrict __buf, size_t __buflen,
98 struct hostent **__restrict __result,
99 int *__restrict __h_errnop,
100 int32_t *ttlp, char **canonp);
102 extern int __getnetent_r (struct netent *__restrict __result_buf,
103 char *__restrict __buf, size_t __buflen,
104 struct netent **__restrict __result,
105 int *__restrict __h_errnop) attribute_hidden;
106 extern int __old_getnetent_r (struct netent *__restrict __result_buf,
107 char *__restrict __buf, size_t __buflen,
108 struct netent **__restrict __result,
109 int *__restrict __h_errnop);
111 extern int __getnetbyaddr_r (uint32_t __net, int __type,
112 struct netent *__restrict __result_buf,
113 char *__restrict __buf, size_t __buflen,
114 struct netent **__restrict __result,
115 int *__restrict __h_errnop);
116 extern int __old_getnetbyaddr_r (uint32_t __net, int __type,
117 struct netent *__restrict __result_buf,
118 char *__restrict __buf, size_t __buflen,
119 struct netent **__restrict __result,
120 int *__restrict __h_errnop);
122 extern int __getnetbyname_r (__const char *__restrict __name,
123 struct netent *__restrict __result_buf,
124 char *__restrict __buf, size_t __buflen,
125 struct netent **__restrict __result,
126 int *__restrict __h_errnop);
127 extern int __old_getnetbyname_r (__const char *__restrict __name,
128 struct netent *__restrict __result_buf,
129 char *__restrict __buf, size_t __buflen,
130 struct netent **__restrict __result,
131 int *__restrict __h_errnop);
133 extern int __getservent_r (struct servent *__restrict __result_buf,
134 char *__restrict __buf, size_t __buflen,
135 struct servent **__restrict __result)
136 attribute_hidden;
137 extern int __old_getservent_r (struct servent *__restrict __result_buf,
138 char *__restrict __buf, size_t __buflen,
139 struct servent **__restrict __result);
141 extern int __getservbyname_r (__const char *__restrict __name,
142 __const char *__restrict __proto,
143 struct servent *__restrict __result_buf,
144 char *__restrict __buf, size_t __buflen,
145 struct servent **__restrict __result);
146 extern int __old_getservbyname_r (__const char *__restrict __name,
147 __const char *__restrict __proto,
148 struct servent *__restrict __result_buf,
149 char *__restrict __buf, size_t __buflen,
150 struct servent **__restrict __result);
152 extern int __getservbyport_r (int __port,
153 __const char *__restrict __proto,
154 struct servent *__restrict __result_buf,
155 char *__restrict __buf, size_t __buflen,
156 struct servent **__restrict __result);
157 extern int __old_getservbyport_r (int __port,
158 __const char *__restrict __proto,
159 struct servent *__restrict __result_buf,
160 char *__restrict __buf, size_t __buflen,
161 struct servent **__restrict __result);
163 extern int __getprotoent_r (struct protoent *__restrict __result_buf,
164 char *__restrict __buf, size_t __buflen,
165 struct protoent **__restrict __result)
166 attribute_hidden;
167 extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
168 char *__restrict __buf, size_t __buflen,
169 struct protoent **__restrict __result);
171 extern int __getprotobyname_r (__const char *__restrict __name,
172 struct protoent *__restrict __result_buf,
173 char *__restrict __buf, size_t __buflen,
174 struct protoent **__restrict __result);
175 extern int __old_getprotobyname_r (__const char *__restrict __name,
176 struct protoent *__restrict __result_buf,
177 char *__restrict __buf, size_t __buflen,
178 struct protoent **__restrict __result);
180 extern int __getprotobynumber_r (int __proto,
181 struct protoent *__restrict __res_buf,
182 char *__restrict __buf, size_t __buflen,
183 struct protoent **__restrict __result);
184 extern int __old_getprotobynumber_r (int __proto,
185 struct protoent *__restrict __res_buf,
186 char *__restrict __buf, size_t __buflen,
187 struct protoent **__restrict __result);
189 extern int __getnetgrent_r (char **__restrict __hostp,
190 char **__restrict __userp,
191 char **__restrict __domainp,
192 char *__restrict __buffer, size_t __buflen);
194 extern int ruserpass (const char *host, const char **aname,
195 const char **apass);
196 libc_hidden_proto (ruserpass)
199 /* The following definition has been removed from the public header
200 since we don't want people to use them. */
202 #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
204 #include <inet/netgroup.h>
206 struct parser_data;
207 extern int _nss_files_parse_protoent (char *line, struct protoent *result,
208 struct parser_data *data,
209 size_t datalen, int *errnop);
210 extern int _nss_files_parse_servent (char *line, struct servent *result,
211 struct parser_data *data,
212 size_t datalen, int *errnop);
213 extern int _nss_files_parse_netent (char *line, struct netent *result,
214 struct parser_data *data,
215 size_t datalen, int *errnop);
216 extern enum nss_status _nss_netgroup_parseline (char **cursor,
217 struct __netgrent *result,
218 char *buffer, size_t buflen,
219 int *errnop);
220 libnss_files_hidden_proto (_nss_files_parse_protoent)
221 libnss_files_hidden_proto (_nss_files_parse_servent)
222 libnss_files_hidden_proto (_nss_files_parse_netent)
223 libnss_files_hidden_proto (_nss_netgroup_parseline)
225 #define DECLARE_NSS_PROTOTYPES(service) \
226 extern enum nss_status _nss_ ## service ## _setprotoent (int); \
227 extern enum nss_status _nss_ ## service ## _endprotoent (void); \
228 extern enum nss_status _nss_ ## service ## _getprotoent_r \
229 (struct protoent *proto, char *buffer, size_t buflen, \
230 int *errnop); \
231 extern enum nss_status _nss_ ## service ## _getprotobyname_r \
232 (const char *name, struct protoent *proto, \
233 char *buffer, size_t buflen, int *errnop); \
234 extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
235 (int number, struct protoent *proto, \
236 char *buffer, size_t buflen, int *errnop); \
237 extern enum nss_status _nss_ ## service ## _sethostent (int); \
238 extern enum nss_status _nss_ ## service ## _endhostent (void); \
239 extern enum nss_status _nss_ ## service ## _gethostent_r \
240 (struct hostent *host, char *buffer, size_t buflen, \
241 int *errnop, int *h_errnop); \
242 extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
243 (const char *name, int af, struct hostent *host, \
244 char *buffer, size_t buflen, int *errnop, \
245 int *h_errnop); \
246 extern enum nss_status _nss_ ## service ## _gethostbyname_r \
247 (const char *name, struct hostent *host, char *buffer, \
248 size_t buflen, int *errnop, int *h_errnop); \
249 extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \
250 (const void *addr, socklen_t addrlen, int af, \
251 struct hostent *host, char *buffer, size_t buflen, \
252 int *errnop, int *h_errnop); \
253 extern enum nss_status _nss_ ## service ## _setservent (int); \
254 extern enum nss_status _nss_ ## service ## _endservent (void); \
255 extern enum nss_status _nss_ ## service ## _getservent_r \
256 (struct servent *serv, char *buffer, size_t buflen, \
257 int *errnop); \
258 extern enum nss_status _nss_ ## service ## _getservbyname_r \
259 (const char *name, const char *protocol, \
260 struct servent *serv, char *buffer, size_t buflen, \
261 int *errnop); \
262 extern enum nss_status _nss_ ## service ## _getservbyport_r \
263 (int port, const char *protocol, struct servent *serv, \
264 char *buffer, size_t buflen, int *errnop); \
265 extern enum nss_status _nss_ ## service ## _setnetgrent \
266 (const char *group, struct __netgrent *result); \
267 extern enum nss_status _nss_ ## service ## _endnetgrent \
268 (struct __netgrent *result); \
269 extern enum nss_status _nss_ ## service ## _getnetgrent_r \
270 (struct __netgrent *result, char *buffer, \
271 size_t buflen, int *errnop); \
272 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
273 extern enum nss_status _nss_ ## service ## _endnetent (void); \
274 extern enum nss_status _nss_ ## service ## _getnetent_r \
275 (struct netent *net, char *buffer, size_t buflen, \
276 int *errnop, int *herrnop); \
277 extern enum nss_status _nss_ ## service ## _getnetbyname_r \
278 (const char *name, struct netent *net, char *buffer, \
279 size_t buflen, int *errnop, int *herrnop); \
280 extern enum nss_status _nss_ ## service ## _getnetbyaddr_r \
281 (uint32_t addr, int type, struct netent *net, \
282 char *buffer, size_t buflen, int *errnop, \
283 int *herrnop);
285 DECLARE_NSS_PROTOTYPES (compat)
286 DECLARE_NSS_PROTOTYPES (dns)
287 DECLARE_NSS_PROTOTYPES (files)
288 DECLARE_NSS_PROTOTYPES (hesiod)
289 DECLARE_NSS_PROTOTYPES (nis)
290 DECLARE_NSS_PROTOTYPES (nisplus)
292 #undef DECLARE_NSS_PROTOTYPES
294 #endif /* !_NETDB_H */