* sunrpc/svc_authux.c (_svcauth_unix): Remove spurious printf (ugh!).
[platform/upstream/glibc.git] / include / netdb.h
1 #ifndef _NETDB_H
2 #include <resolv/netdb.h>
3
4 /* Macros for accessing h_errno from inside libc.  */
5 # ifdef _LIBC_REENTRANT
6 #  include <tls.h>
7 #  if USE_TLS && HAVE___THREAD
8 #   undef  h_errno
9 #   define h_errno h_errno      /* For #ifndef h_errno tests.  */
10 extern __thread int h_errno;
11 #   define __set_h_errno(x)     (h_errno = (x))
12 #  else
13 static inline int
14 __set_h_errno (int __err)
15 {
16   return *__h_errno_location () = __err;
17 }
18 #  endif
19 # else
20 #  undef  h_errno
21 #  define __set_h_errno(x) (h_errno = (x))
22 # endif /* _LIBC_REENTRANT */
23
24 libc_hidden_proto (hstrerror)
25 libc_hidden_proto (innetgr)
26 libc_hidden_proto (rcmd_af)
27 libc_hidden_proto (rexec_af)
28 libc_hidden_proto (rresvport_af)
29 libc_hidden_proto (ruserok_af)
30
31 libc_hidden_proto (getaddrinfo)
32 libc_hidden_proto (getnameinfo)
33 libc_hidden_proto (freeaddrinfo)
34 libc_hidden_proto (gai_strerror)
35
36 /* Document internal interfaces.  */
37 extern int __gethostent_r (struct hostent *__restrict __result_buf,
38                            char *__restrict __buf, size_t __buflen,
39                            struct hostent **__restrict __result,
40                            int *__restrict __h_errnop) attribute_hidden;
41 extern int __old_gethostent_r (struct hostent *__restrict __result_buf,
42                                char *__restrict __buf, size_t __buflen,
43                                struct hostent **__restrict __result,
44                                int *__restrict __h_errnop);
45
46 extern int __gethostbyaddr_r (__const void *__restrict __addr,
47                               socklen_t __len, int __type,
48                               struct hostent *__restrict __result_buf,
49                               char *__restrict __buf, size_t __buflen,
50                               struct hostent **__restrict __result,
51                               int *__restrict __h_errnop);
52 extern int __old_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
59 extern int __gethostbyname_r (__const char *__restrict __name,
60                               struct hostent *__restrict __result_buf,
61                               char *__restrict __buf, size_t __buflen,
62                               struct hostent **__restrict __result,
63                               int *__restrict __h_errnop);
64 extern int __old_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
70 extern int __gethostbyname2_r (__const char *__restrict __name, int __af,
71                                struct hostent *__restrict __result_buf,
72                                char *__restrict __buf, size_t __buflen,
73                                struct hostent **__restrict __result,
74                                int *__restrict __h_errnop);
75 extern int __old_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
81 extern int __getnetent_r (struct netent *__restrict __result_buf,
82                           char *__restrict __buf, size_t __buflen,
83                           struct netent **__restrict __result,
84                           int *__restrict __h_errnop) attribute_hidden;
85 extern int __old_getnetent_r (struct netent *__restrict __result_buf,
86                               char *__restrict __buf, size_t __buflen,
87                               struct netent **__restrict __result,
88                               int *__restrict __h_errnop);
89
90 extern int __getnetbyaddr_r (uint32_t __net, int __type,
91                              struct netent *__restrict __result_buf,
92                              char *__restrict __buf, size_t __buflen,
93                              struct netent **__restrict __result,
94                              int *__restrict __h_errnop);
95 extern int __old_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
101 extern int __getnetbyname_r (__const char *__restrict __name,
102                              struct netent *__restrict __result_buf,
103                              char *__restrict __buf, size_t __buflen,
104                              struct netent **__restrict __result,
105                              int *__restrict __h_errnop);
106 extern int __old_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
112 extern int __getservent_r (struct servent *__restrict __result_buf,
113                            char *__restrict __buf, size_t __buflen,
114                            struct servent **__restrict __result)
115      attribute_hidden;
116 extern int __old_getservent_r (struct servent *__restrict __result_buf,
117                                char *__restrict __buf, size_t __buflen,
118                                struct servent **__restrict __result);
119
120 extern int __getservbyname_r (__const char *__restrict __name,
121                               __const char *__restrict __proto,
122                               struct servent *__restrict __result_buf,
123                               char *__restrict __buf, size_t __buflen,
124                               struct servent **__restrict __result);
125 extern int __old_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
131 extern int __getservbyport_r (int __port,
132                               __const char *__restrict __proto,
133                               struct servent *__restrict __result_buf,
134                               char *__restrict __buf, size_t __buflen,
135                               struct servent **__restrict __result);
136 extern int __old_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
142 extern int __getprotoent_r (struct protoent *__restrict __result_buf,
143                             char *__restrict __buf, size_t __buflen,
144                             struct protoent **__restrict __result)
145      attribute_hidden;
146 extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
147                                 char *__restrict __buf, size_t __buflen,
148                                 struct protoent **__restrict __result);
149
150 extern int __getprotobyname_r (__const char *__restrict __name,
151                                struct protoent *__restrict __result_buf,
152                                char *__restrict __buf, size_t __buflen,
153                                struct protoent **__restrict __result);
154 extern int __old_getprotobyname_r (__const char *__restrict __name,
155                                    struct protoent *__restrict __result_buf,
156                                    char *__restrict __buf, size_t __buflen,
157                                    struct protoent **__restrict __result);
158
159 extern int __getprotobynumber_r (int __proto,
160                                  struct protoent *__restrict __res_buf,
161                                  char *__restrict __buf, size_t __buflen,
162                                  struct protoent **__restrict __result);
163 extern int __old_getprotobynumber_r (int __proto,
164                                      struct protoent *__restrict __res_buf,
165                                      char *__restrict __buf, size_t __buflen,
166                                      struct protoent **__restrict __result);
167
168 extern int __getnetgrent_r (char **__restrict __hostp,
169                             char **__restrict __userp,
170                             char **__restrict __domainp,
171                             char *__restrict __buffer, size_t __buflen);
172
173 extern int ruserpass (const char *host, const char **aname,
174                       const char **apass);
175 libc_hidden_proto (ruserpass)
176
177
178 /* The following declarations and definitions have been removed from
179    the public header since we don't want people to use them.  */
180
181 #define AI_V4MAPPED     0x0008  /* IPv4-mapped addresses are acceptable.  */
182 #define AI_ALL          0x0010  /* Return both IPv4 and IPv6 addresses.  */
183 #define AI_ADDRCONFIG   0x0020  /* Use configuration of this host to choose
184                                   returned address type.  */
185 #define AI_DEFAULT    (AI_V4MAPPED | AI_ADDRCONFIG)
186
187 #include <inet/netgroup.h>
188
189 struct parser_data;
190 extern int _nss_files_parse_protoent (char *line, struct protoent *result,
191                                       struct parser_data *data,
192                                       size_t datalen, int *errnop);
193 extern int _nss_files_parse_servent (char *line, struct servent *result,
194                                      struct parser_data *data,
195                                      size_t datalen, int *errnop);
196 extern int _nss_files_parse_netent (char *line, struct netent *result,
197                                     struct parser_data *data,
198                                     size_t datalen, int *errnop);
199 extern enum nss_status _nss_netgroup_parseline (char **cursor,
200                                                 struct __netgrent *result,
201                                                 char *buffer, size_t buflen,
202                                                 int *errnop);
203 libc_hidden_proto (_nss_files_parse_protoent)
204 libc_hidden_proto (_nss_files_parse_servent)
205 libc_hidden_proto (_nss_files_parse_netent)
206
207 #define DECLARE_NSS_PROTOTYPES(service)                                       \
208 extern enum nss_status _nss_ ## service ## _setprotoent (int);                \
209 extern enum nss_status _nss_ ## service ## _endprotoent (void);               \
210 extern enum nss_status _nss_ ## service ## _getprotoent_r                     \
211                        (struct protoent *proto, char *buffer, size_t buflen,  \
212                         int *errnop);                                         \
213 extern enum nss_status _nss_ ## service ## _getprotobyname_r                  \
214                        (const char *name, struct protoent *proto,             \
215                         char *buffer, size_t buflen, int *errnop);            \
216 extern enum nss_status _nss_ ## service ## _getprotobynumber_r                \
217                        (int number, struct protoent *proto,                   \
218                         char *buffer, size_t buflen, int *errnop);            \
219 extern enum nss_status _nss_ ## service ## _sethostent (int);                 \
220 extern enum nss_status _nss_ ## service ## _endhostent (void);                \
221 extern enum nss_status _nss_ ## service ## _gethostent_r                      \
222                        (struct hostent *host, char *buffer, size_t buflen,    \
223                         int *errnop, int *h_errnop);                          \
224 extern enum nss_status _nss_ ## service ## _gethostbyname2_r                  \
225                        (const char *name, int af, struct hostent *host,       \
226                         char *buffer, size_t buflen, int *errnop,             \
227                         int *h_errnop);                                       \
228 extern enum nss_status _nss_ ## service ## _gethostbyname_r                   \
229                        (const char *name, struct hostent *host, char *buffer, \
230                         size_t buflen, int *errnop, int *h_errnop);           \
231 extern enum nss_status _nss_ ## service ## _gethostbyaddr_r                   \
232                        (const void *addr, socklen_t addrlen, int af,          \
233                         struct hostent *host, char *buffer, size_t buflen,    \
234                         int *errnop, int *h_errnop);                          \
235 extern enum nss_status _nss_ ## service ## _setservent (int);                 \
236 extern enum nss_status _nss_ ## service ## _endservent (void);                \
237 extern enum nss_status _nss_ ## service ## _getservent_r                      \
238                        (struct servent *serv, char *buffer, size_t buflen,    \
239                         int *errnop);                                         \
240 extern enum nss_status _nss_ ## service ## _getservbyname_r                   \
241                        (const char *name, const char *protocol,               \
242                         struct servent *serv, char *buffer, size_t buflen,    \
243                         int *errnop);                                         \
244 extern enum nss_status _nss_ ## service ## _getservbyport_r                   \
245                        (int port, const char *protocol, struct servent *serv, \
246                         char *buffer, size_t buflen, int *errnop);            \
247 extern enum nss_status _nss_ ## service ## _setnetgrent                       \
248                        (const char *group, struct __netgrent *result);        \
249 extern enum nss_status _nss_ ## service ## _endnetgrent                       \
250                        (struct __netgrent *result);                           \
251 extern enum nss_status _nss_ ## service ## _getnetgrent_r                     \
252                        (struct __netgrent *result, char *buffer,              \
253                         size_t buflen, int *errnop);                          \
254 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen);         \
255 extern enum nss_status _nss_ ## service ## _endnetent (void);                 \
256 extern enum nss_status _nss_ ## service ## _getnetent_r                       \
257                         (struct netent *net, char *buffer, size_t buflen,     \
258                          int *errnop, int *herrnop);                          \
259 extern enum nss_status _nss_ ## service ## _getnetbyname_r                    \
260                         (const char *name, struct netent *net, char *buffer,  \
261                          size_t buflen, int *errnop, int *herrnop);           \
262 extern enum nss_status _nss_ ## service ## _getnetbyaddr_r                    \
263                        (uint32_t addr, int type, struct netent *net,          \
264                         char *buffer, size_t buflen, int *errnop,             \
265                         int *herrnop);
266
267 DECLARE_NSS_PROTOTYPES (compat)
268 DECLARE_NSS_PROTOTYPES (dns)
269 DECLARE_NSS_PROTOTYPES (files)
270 DECLARE_NSS_PROTOTYPES (hesiod)
271 DECLARE_NSS_PROTOTYPES (nis)
272 DECLARE_NSS_PROTOTYPES (nisplus)
273
274 #undef DECLARE_NSS_PROTOTYPES
275
276 #endif /* !_NETDB_H */