Back to index

glibc  2.9
netdb.h
Go to the documentation of this file.
00001 #ifndef       _NETDB_H
00002 #include <resolv/netdb.h>
00003 
00004 /* Macros for accessing h_errno from inside libc.  */
00005 # ifdef _LIBC_REENTRANT
00006 #  include <tls.h>
00007 #  if USE___THREAD
00008 #   undef  h_errno
00009 #   ifndef NOT_IN_libc
00010 #    define h_errno __libc_h_errno
00011 #   else
00012 #    define h_errno h_errno /* For #ifndef h_errno tests.  */
00013 #   endif
00014 extern __thread int h_errno attribute_tls_model_ie;
00015 #   define __set_h_errno(x) (h_errno = (x))
00016 #  else
00017 static inline int
00018 __set_h_errno (int __err)
00019 {
00020   return *__h_errno_location () = __err;
00021 }
00022 #  endif
00023 # else
00024 #  undef  h_errno
00025 #  define __set_h_errno(x) (h_errno = (x))
00026 extern int h_errno;
00027 # endif       /* _LIBC_REENTRANT */
00028 
00029 libc_hidden_proto (hstrerror)
00030 libc_hidden_proto (innetgr)
00031 libc_hidden_proto (rcmd_af)
00032 libc_hidden_proto (rexec_af)
00033 libc_hidden_proto (rresvport_af)
00034 libc_hidden_proto (ruserok_af)
00035 
00036 libc_hidden_proto (getaddrinfo)
00037 libc_hidden_proto (getnameinfo)
00038 libc_hidden_proto (freeaddrinfo)
00039 libc_hidden_proto (gai_strerror)
00040 libc_hidden_proto (__h_errno_location)
00041 
00042 /* Document internal interfaces.  */
00043 extern int __gethostent_r (struct hostent *__restrict __result_buf,
00044                         char *__restrict __buf, size_t __buflen,
00045                         struct hostent **__restrict __result,
00046                         int *__restrict __h_errnop) attribute_hidden;
00047 extern int __old_gethostent_r (struct hostent *__restrict __result_buf,
00048                             char *__restrict __buf, size_t __buflen,
00049                             struct hostent **__restrict __result,
00050                             int *__restrict __h_errnop);
00051 
00052 extern int __gethostbyaddr_r (__const void *__restrict __addr,
00053                            socklen_t __len, int __type,
00054                            struct hostent *__restrict __result_buf,
00055                            char *__restrict __buf, size_t __buflen,
00056                            struct hostent **__restrict __result,
00057                            int *__restrict __h_errnop);
00058 extern int __old_gethostbyaddr_r (__const void *__restrict __addr,
00059                               socklen_t __len, int __type,
00060                               struct hostent *__restrict __result_buf,
00061                               char *__restrict __buf, size_t __buflen,
00062                               struct hostent **__restrict __result,
00063                               int *__restrict __h_errnop);
00064 
00065 extern int __gethostbyaddr2_r (__const void *__restrict __addr,
00066                             socklen_t __len, int __type,
00067                             struct hostent *__restrict __result_buf,
00068                             char *__restrict __buf, size_t __buflen,
00069                             struct hostent **__restrict __result,
00070                             int *__restrict __h_errnop,
00071                             int32_t *ttlp);
00072 
00073 extern int __gethostbyname_r (__const char *__restrict __name,
00074                            struct hostent *__restrict __result_buf,
00075                            char *__restrict __buf, size_t __buflen,
00076                            struct hostent **__restrict __result,
00077                            int *__restrict __h_errnop);
00078 extern int __old_gethostbyname_r (__const char *__restrict __name,
00079                               struct hostent *__restrict __result_buf,
00080                               char *__restrict __buf, size_t __buflen,
00081                               struct hostent **__restrict __result,
00082                               int *__restrict __h_errnop);
00083 
00084 extern int __gethostbyname2_r (__const char *__restrict __name, int __af,
00085                             struct hostent *__restrict __result_buf,
00086                             char *__restrict __buf, size_t __buflen,
00087                             struct hostent **__restrict __result,
00088                             int *__restrict __h_errnop);
00089 extern int __old_gethostbyname2_r (__const char *__restrict __name, int __af,
00090                                struct hostent *__restrict __result_buf,
00091                                char *__restrict __buf, size_t __buflen,
00092                                struct hostent **__restrict __result,
00093                                int *__restrict __h_errnop);
00094 
00095 extern int __gethostbyname3_r (__const char *__restrict __name, int __af,
00096                             struct hostent *__restrict __result_buf,
00097                             char *__restrict __buf, size_t __buflen,
00098                             struct hostent **__restrict __result,
00099                             int *__restrict __h_errnop,
00100                             int32_t *ttlp, char **canonp);
00101 
00102 extern int __getnetent_r (struct netent *__restrict __result_buf,
00103                        char *__restrict __buf, size_t __buflen,
00104                        struct netent **__restrict __result,
00105                        int *__restrict __h_errnop) attribute_hidden;
00106 extern int __old_getnetent_r (struct netent *__restrict __result_buf,
00107                            char *__restrict __buf, size_t __buflen,
00108                            struct netent **__restrict __result,
00109                            int *__restrict __h_errnop);
00110 
00111 extern int __getnetbyaddr_r (uint32_t __net, int __type,
00112                           struct netent *__restrict __result_buf,
00113                           char *__restrict __buf, size_t __buflen,
00114                           struct netent **__restrict __result,
00115                           int *__restrict __h_errnop);
00116 extern int __old_getnetbyaddr_r (uint32_t __net, int __type,
00117                              struct netent *__restrict __result_buf,
00118                              char *__restrict __buf, size_t __buflen,
00119                              struct netent **__restrict __result,
00120                              int *__restrict __h_errnop);
00121 
00122 extern int __getnetbyname_r (__const char *__restrict __name,
00123                           struct netent *__restrict __result_buf,
00124                           char *__restrict __buf, size_t __buflen,
00125                           struct netent **__restrict __result,
00126                           int *__restrict __h_errnop);
00127 extern int __old_getnetbyname_r (__const char *__restrict __name,
00128                              struct netent *__restrict __result_buf,
00129                              char *__restrict __buf, size_t __buflen,
00130                              struct netent **__restrict __result,
00131                              int *__restrict __h_errnop);
00132 
00133 extern int __getservent_r (struct servent *__restrict __result_buf,
00134                         char *__restrict __buf, size_t __buflen,
00135                         struct servent **__restrict __result)
00136      attribute_hidden;
00137 extern int __old_getservent_r (struct servent *__restrict __result_buf,
00138                             char *__restrict __buf, size_t __buflen,
00139                             struct servent **__restrict __result);
00140 
00141 extern int __getservbyname_r (__const char *__restrict __name,
00142                            __const char *__restrict __proto,
00143                            struct servent *__restrict __result_buf,
00144                            char *__restrict __buf, size_t __buflen,
00145                            struct servent **__restrict __result);
00146 extern int __old_getservbyname_r (__const char *__restrict __name,
00147                               __const char *__restrict __proto,
00148                               struct servent *__restrict __result_buf,
00149                               char *__restrict __buf, size_t __buflen,
00150                               struct servent **__restrict __result);
00151 
00152 extern int __getservbyport_r (int __port,
00153                            __const char *__restrict __proto,
00154                            struct servent *__restrict __result_buf,
00155                            char *__restrict __buf, size_t __buflen,
00156                            struct servent **__restrict __result);
00157 extern int __old_getservbyport_r (int __port,
00158                               __const char *__restrict __proto,
00159                               struct servent *__restrict __result_buf,
00160                               char *__restrict __buf, size_t __buflen,
00161                               struct servent **__restrict __result);
00162 
00163 extern int __getprotoent_r (struct protoent *__restrict __result_buf,
00164                          char *__restrict __buf, size_t __buflen,
00165                          struct protoent **__restrict __result)
00166      attribute_hidden;
00167 extern int __old_getprotoent_r (struct protoent *__restrict __result_buf,
00168                             char *__restrict __buf, size_t __buflen,
00169                             struct protoent **__restrict __result);
00170 
00171 extern int __getprotobyname_r (__const char *__restrict __name,
00172                             struct protoent *__restrict __result_buf,
00173                             char *__restrict __buf, size_t __buflen,
00174                             struct protoent **__restrict __result);
00175 extern int __old_getprotobyname_r (__const char *__restrict __name,
00176                                struct protoent *__restrict __result_buf,
00177                                char *__restrict __buf, size_t __buflen,
00178                                struct protoent **__restrict __result);
00179 
00180 extern int __getprotobynumber_r (int __proto,
00181                              struct protoent *__restrict __res_buf,
00182                              char *__restrict __buf, size_t __buflen,
00183                              struct protoent **__restrict __result);
00184 extern int __old_getprotobynumber_r (int __proto,
00185                                  struct protoent *__restrict __res_buf,
00186                                  char *__restrict __buf, size_t __buflen,
00187                                  struct protoent **__restrict __result);
00188 
00189 extern int __getnetgrent_r (char **__restrict __hostp,
00190                          char **__restrict __userp,
00191                          char **__restrict __domainp,
00192                          char *__restrict __buffer, size_t __buflen);
00193 
00194 extern int ruserpass (const char *host, const char **aname,
00195                     const char **apass);
00196 libc_hidden_proto (ruserpass)
00197 
00198 
00199 /* The following definition has been removed from the public header
00200    since we don't want people to use them.  */
00201 
00202 #define AI_DEFAULT    (AI_V4MAPPED | AI_ADDRCONFIG)
00203 
00204 #include <inet/netgroup.h>
00205 
00206 struct parser_data;
00207 extern int _nss_files_parse_protoent (char *line, struct protoent *result,
00208                                   struct parser_data *data,
00209                                   size_t datalen, int *errnop);
00210 extern int _nss_files_parse_servent (char *line, struct servent *result,
00211                                  struct parser_data *data,
00212                                  size_t datalen, int *errnop);
00213 extern int _nss_files_parse_netent (char *line, struct netent *result,
00214                                 struct parser_data *data,
00215                                 size_t datalen, int *errnop);
00216 extern enum nss_status _nss_netgroup_parseline (char **cursor,
00217                                           struct __netgrent *result,
00218                                           char *buffer, size_t buflen,
00219                                           int *errnop);
00220 libnss_files_hidden_proto (_nss_files_parse_protoent)
00221 libnss_files_hidden_proto (_nss_files_parse_servent)
00222 libnss_files_hidden_proto (_nss_files_parse_netent)
00223 libnss_files_hidden_proto (_nss_netgroup_parseline)
00224 
00225 #define DECLARE_NSS_PROTOTYPES(service)                                     \
00226 extern enum nss_status _nss_ ## service ## _setprotoent (int);              \
00227 extern enum nss_status _nss_ ## service ## _endprotoent (void);                    \
00228 extern enum nss_status _nss_ ## service ## _getprotoent_r                   \
00229                      (struct protoent *proto, char *buffer, size_t buflen,  \
00230                      int *errnop);                                   \
00231 extern enum nss_status _nss_ ## service ## _getprotobyname_r                \
00232                      (const char *name, struct protoent *proto,             \
00233                      char *buffer, size_t buflen, int *errnop);             \
00234 extern enum nss_status _nss_ ## service ## _getprotobynumber_r              \
00235                      (int number, struct protoent *proto,                   \
00236                      char *buffer, size_t buflen, int *errnop);             \
00237 extern enum nss_status _nss_ ## service ## _sethostent (int);               \
00238 extern enum nss_status _nss_ ## service ## _endhostent (void);              \
00239 extern enum nss_status _nss_ ## service ## _gethostent_r                    \
00240                      (struct hostent *host, char *buffer, size_t buflen,    \
00241                      int *errnop, int *h_errnop);                           \
00242 extern enum nss_status _nss_ ## service ## _gethostbyname2_r                \
00243                      (const char *name, int af, struct hostent *host,       \
00244                      char *buffer, size_t buflen, int *errnop,       \
00245                      int *h_errnop);                                        \
00246 extern enum nss_status _nss_ ## service ## _gethostbyname_r                 \
00247                      (const char *name, struct hostent *host, char *buffer, \
00248                      size_t buflen, int *errnop, int *h_errnop);            \
00249 extern enum nss_status _nss_ ## service ## _gethostbyaddr_r                 \
00250                      (const void *addr, socklen_t addrlen, int af,          \
00251                      struct hostent *host, char *buffer, size_t buflen,    \
00252                      int *errnop, int *h_errnop);                           \
00253 extern enum nss_status _nss_ ## service ## _setservent (int);               \
00254 extern enum nss_status _nss_ ## service ## _endservent (void);              \
00255 extern enum nss_status _nss_ ## service ## _getservent_r                    \
00256                      (struct servent *serv, char *buffer, size_t buflen,    \
00257                      int *errnop);                                   \
00258 extern enum nss_status _nss_ ## service ## _getservbyname_r                 \
00259                      (const char *name, const char *protocol,               \
00260                      struct servent *serv, char *buffer, size_t buflen,    \
00261                      int *errnop);                                   \
00262 extern enum nss_status _nss_ ## service ## _getservbyport_r                 \
00263                      (int port, const char *protocol, struct servent *serv, \
00264                      char *buffer, size_t buflen, int *errnop);             \
00265 extern enum nss_status _nss_ ## service ## _setnetgrent                     \
00266                      (const char *group, struct __netgrent *result);        \
00267 extern enum nss_status _nss_ ## service ## _endnetgrent                     \
00268                      (struct __netgrent *result);                           \
00269 extern enum nss_status _nss_ ## service ## _getnetgrent_r                   \
00270                      (struct __netgrent *result, char *buffer,       \
00271                      size_t buflen, int *errnop);                           \
00272 extern enum nss_status _nss_ ## service ## _setnetent (int stayopen);       \
00273 extern enum nss_status _nss_ ## service ## _endnetent (void);               \
00274 extern enum nss_status _nss_ ## service ## _getnetent_r                     \
00275                      (struct netent *net, char *buffer, size_t buflen,     \
00276                       int *errnop, int *herrnop);                           \
00277 extern enum nss_status _nss_ ## service ## _getnetbyname_r                  \
00278                      (const char *name, struct netent *net, char *buffer,  \
00279                       size_t buflen, int *errnop, int *herrnop);            \
00280 extern enum nss_status _nss_ ## service ## _getnetbyaddr_r                  \
00281                      (uint32_t addr, int type, struct netent *net,          \
00282                      char *buffer, size_t buflen, int *errnop,       \
00283                      int *herrnop);
00284 
00285 DECLARE_NSS_PROTOTYPES (compat)
00286 DECLARE_NSS_PROTOTYPES (dns)
00287 DECLARE_NSS_PROTOTYPES (files)
00288 DECLARE_NSS_PROTOTYPES (hesiod)
00289 DECLARE_NSS_PROTOTYPES (nis)
00290 DECLARE_NSS_PROTOTYPES (nisplus)
00291 
00292 #undef DECLARE_NSS_PROTOTYPES
00293 
00294 #endif /* !_NETDB_H */