2 #include <resolv/netdb.h>
4 /* Macros for accessing h_errno from inside libc. */
5 # ifdef _LIBC_REENTRANT
10 # define h_errno __libc_h_errno
12 # define h_errno h_errno /* For #ifndef h_errno tests. */
14 extern __thread
int h_errno attribute_tls_model_ie
;
15 # define __set_h_errno(x) (h_errno = (x))
18 __set_h_errno (int __err
)
20 return *__h_errno_location () = __err
;
25 # define __set_h_errno(x) (h_errno = (x))
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
)
41 /* Document internal interfaces. */
42 extern int __gethostent_r (struct hostent
*__restrict __result_buf
,
43 char *__restrict __buf
, size_t __buflen
,
44 struct hostent
**__restrict __result
,
45 int *__restrict __h_errnop
) attribute_hidden
;
46 extern int __old_gethostent_r (struct hostent
*__restrict __result_buf
,
47 char *__restrict __buf
, size_t __buflen
,
48 struct hostent
**__restrict __result
,
49 int *__restrict __h_errnop
);
51 extern int __gethostbyaddr_r (__const
void *__restrict __addr
,
52 socklen_t __len
, int __type
,
53 struct hostent
*__restrict __result_buf
,
54 char *__restrict __buf
, size_t __buflen
,
55 struct hostent
**__restrict __result
,
56 int *__restrict __h_errnop
);
57 extern int __old_gethostbyaddr_r (__const
void *__restrict __addr
,
58 socklen_t __len
, int __type
,
59 struct hostent
*__restrict __result_buf
,
60 char *__restrict __buf
, size_t __buflen
,
61 struct hostent
**__restrict __result
,
62 int *__restrict __h_errnop
);
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 __getnetent_r (struct netent
*__restrict __result_buf
,
87 char *__restrict __buf
, size_t __buflen
,
88 struct netent
**__restrict __result
,
89 int *__restrict __h_errnop
) attribute_hidden
;
90 extern int __old_getnetent_r (struct netent
*__restrict __result_buf
,
91 char *__restrict __buf
, size_t __buflen
,
92 struct netent
**__restrict __result
,
93 int *__restrict __h_errnop
);
95 extern int __getnetbyaddr_r (uint32_t __net
, int __type
,
96 struct netent
*__restrict __result_buf
,
97 char *__restrict __buf
, size_t __buflen
,
98 struct netent
**__restrict __result
,
99 int *__restrict __h_errnop
);
100 extern int __old_getnetbyaddr_r (uint32_t __net
, int __type
,
101 struct netent
*__restrict __result_buf
,
102 char *__restrict __buf
, size_t __buflen
,
103 struct netent
**__restrict __result
,
104 int *__restrict __h_errnop
);
106 extern int __getnetbyname_r (__const
char *__restrict __name
,
107 struct netent
*__restrict __result_buf
,
108 char *__restrict __buf
, size_t __buflen
,
109 struct netent
**__restrict __result
,
110 int *__restrict __h_errnop
);
111 extern int __old_getnetbyname_r (__const
char *__restrict __name
,
112 struct netent
*__restrict __result_buf
,
113 char *__restrict __buf
, size_t __buflen
,
114 struct netent
**__restrict __result
,
115 int *__restrict __h_errnop
);
117 extern int __getservent_r (struct servent
*__restrict __result_buf
,
118 char *__restrict __buf
, size_t __buflen
,
119 struct servent
**__restrict __result
)
121 extern int __old_getservent_r (struct servent
*__restrict __result_buf
,
122 char *__restrict __buf
, size_t __buflen
,
123 struct servent
**__restrict __result
);
125 extern int __getservbyname_r (__const
char *__restrict __name
,
126 __const
char *__restrict __proto
,
127 struct servent
*__restrict __result_buf
,
128 char *__restrict __buf
, size_t __buflen
,
129 struct servent
**__restrict __result
);
130 extern int __old_getservbyname_r (__const
char *__restrict __name
,
131 __const
char *__restrict __proto
,
132 struct servent
*__restrict __result_buf
,
133 char *__restrict __buf
, size_t __buflen
,
134 struct servent
**__restrict __result
);
136 extern int __getservbyport_r (int __port
,
137 __const
char *__restrict __proto
,
138 struct servent
*__restrict __result_buf
,
139 char *__restrict __buf
, size_t __buflen
,
140 struct servent
**__restrict __result
);
141 extern int __old_getservbyport_r (int __port
,
142 __const
char *__restrict __proto
,
143 struct servent
*__restrict __result_buf
,
144 char *__restrict __buf
, size_t __buflen
,
145 struct servent
**__restrict __result
);
147 extern int __getprotoent_r (struct protoent
*__restrict __result_buf
,
148 char *__restrict __buf
, size_t __buflen
,
149 struct protoent
**__restrict __result
)
151 extern int __old_getprotoent_r (struct protoent
*__restrict __result_buf
,
152 char *__restrict __buf
, size_t __buflen
,
153 struct protoent
**__restrict __result
);
155 extern int __getprotobyname_r (__const
char *__restrict __name
,
156 struct protoent
*__restrict __result_buf
,
157 char *__restrict __buf
, size_t __buflen
,
158 struct protoent
**__restrict __result
);
159 extern int __old_getprotobyname_r (__const
char *__restrict __name
,
160 struct protoent
*__restrict __result_buf
,
161 char *__restrict __buf
, size_t __buflen
,
162 struct protoent
**__restrict __result
);
164 extern int __getprotobynumber_r (int __proto
,
165 struct protoent
*__restrict __res_buf
,
166 char *__restrict __buf
, size_t __buflen
,
167 struct protoent
**__restrict __result
);
168 extern int __old_getprotobynumber_r (int __proto
,
169 struct protoent
*__restrict __res_buf
,
170 char *__restrict __buf
, size_t __buflen
,
171 struct protoent
**__restrict __result
);
173 extern int __getnetgrent_r (char **__restrict __hostp
,
174 char **__restrict __userp
,
175 char **__restrict __domainp
,
176 char *__restrict __buffer
, size_t __buflen
);
178 extern int ruserpass (const char *host
, const char **aname
,
180 libc_hidden_proto (ruserpass
)
183 /* The following declarations and definitions have been removed from
184 the public header since we don't want people to use them. */
186 #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */
187 #define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */
188 #define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
189 returned address type. */
190 #define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
192 #include <inet/netgroup.h>
195 extern int _nss_files_parse_protoent (char *line
, struct protoent
*result
,
196 struct parser_data
*data
,
197 size_t datalen
, int *errnop
);
198 extern int _nss_files_parse_servent (char *line
, struct servent
*result
,
199 struct parser_data
*data
,
200 size_t datalen
, int *errnop
);
201 extern int _nss_files_parse_netent (char *line
, struct netent
*result
,
202 struct parser_data
*data
,
203 size_t datalen
, int *errnop
);
204 extern enum nss_status
_nss_netgroup_parseline (char **cursor
,
205 struct __netgrent
*result
,
206 char *buffer
, size_t buflen
,
208 libc_hidden_proto (_nss_files_parse_protoent
)
209 libc_hidden_proto (_nss_files_parse_servent
)
210 libc_hidden_proto (_nss_files_parse_netent
)
212 #define DECLARE_NSS_PROTOTYPES(service) \
213 extern enum nss_status _nss_ ## service ## _setprotoent (int); \
214 extern enum nss_status _nss_ ## service ## _endprotoent (void); \
215 extern enum nss_status _nss_ ## service ## _getprotoent_r \
216 (struct protoent *proto, char *buffer, size_t buflen, \
218 extern enum nss_status _nss_ ## service ## _getprotobyname_r \
219 (const char *name, struct protoent *proto, \
220 char *buffer, size_t buflen, int *errnop); \
221 extern enum nss_status _nss_ ## service ## _getprotobynumber_r \
222 (int number, struct protoent *proto, \
223 char *buffer, size_t buflen, int *errnop); \
224 extern enum nss_status _nss_ ## service ## _sethostent (int); \
225 extern enum nss_status _nss_ ## service ## _endhostent (void); \
226 extern enum nss_status _nss_ ## service ## _gethostent_r \
227 (struct hostent *host, char *buffer, size_t buflen, \
228 int *errnop, int *h_errnop); \
229 extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
230 (const char *name, int af, struct hostent *host, \
231 char *buffer, size_t buflen, int *errnop, \
233 extern enum nss_status _nss_ ## service ## _gethostbyname_r \
234 (const char *name, struct hostent *host, char *buffer, \
235 size_t buflen, int *errnop, int *h_errnop); \
236 extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \
237 (const void *addr, socklen_t addrlen, int af, \
238 struct hostent *host, char *buffer, size_t buflen, \
239 int *errnop, int *h_errnop); \
240 extern enum nss_status _nss_ ## service ## _setservent (int); \
241 extern enum nss_status _nss_ ## service ## _endservent (void); \
242 extern enum nss_status _nss_ ## service ## _getservent_r \
243 (struct servent *serv, char *buffer, size_t buflen, \
245 extern enum nss_status _nss_ ## service ## _getservbyname_r \
246 (const char *name, const char *protocol, \
247 struct servent *serv, char *buffer, size_t buflen, \
249 extern enum nss_status _nss_ ## service ## _getservbyport_r \
250 (int port, const char *protocol, struct servent *serv, \
251 char *buffer, size_t buflen, int *errnop); \
252 extern enum nss_status _nss_ ## service ## _setnetgrent \
253 (const char *group, struct __netgrent *result); \
254 extern enum nss_status _nss_ ## service ## _endnetgrent \
255 (struct __netgrent *result); \
256 extern enum nss_status _nss_ ## service ## _getnetgrent_r \
257 (struct __netgrent *result, char *buffer, \
258 size_t buflen, int *errnop); \
259 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen); \
260 extern enum nss_status _nss_ ## service ## _endnetent (void); \
261 extern enum nss_status _nss_ ## service ## _getnetent_r \
262 (struct netent *net, char *buffer, size_t buflen, \
263 int *errnop, int *herrnop); \
264 extern enum nss_status _nss_ ## service ## _getnetbyname_r \
265 (const char *name, struct netent *net, char *buffer, \
266 size_t buflen, int *errnop, int *herrnop); \
267 extern enum nss_status _nss_ ## service ## _getnetbyaddr_r \
268 (uint32_t addr, int type, struct netent *net, \
269 char *buffer, size_t buflen, int *errnop, \
272 DECLARE_NSS_PROTOTYPES (compat
)
273 DECLARE_NSS_PROTOTYPES (dns
)
274 DECLARE_NSS_PROTOTYPES (files
)
275 DECLARE_NSS_PROTOTYPES (hesiod
)
276 DECLARE_NSS_PROTOTYPES (nis
)
277 DECLARE_NSS_PROTOTYPES (nisplus
)
279 #undef DECLARE_NSS_PROTOTYPES
281 #endif /* !_NETDB_H */