123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522 |
- #ifndef _NETDB_H
- #define _NETDB_H 1
- #include <features.h>
- #include <netinet/in.h>
- #include <stdint.h>
- #ifdef __USE_MISC
- # include <rpc/netdb.h>
- #endif
- #ifdef __USE_GNU
- # define __need_sigevent_t
- # include <bits/siginfo.h>
- # define __need_timespec
- # include <time.h>
- #endif
- #include <bits/netdb.h>
- #define _PATH_HEQUIV "/etc/hosts.equiv"
- #define _PATH_HOSTS "/etc/hosts"
- #define _PATH_NETWORKS "/etc/networks"
- #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf"
- #define _PATH_PROTOCOLS "/etc/protocols"
- #define _PATH_SERVICES "/etc/services"
- __BEGIN_DECLS
- #include <errno.h>
- #define h_errno errno
- #if 0
- extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
- #ifdef _LIBC
- # ifdef _LIBC_REENTRANT
- static inline int
- __set_h_errno (int __err)
- {
- return *__h_errno_location () = __err;
- }
- # else
- # define __set_h_errno(x) (h_errno = (x))
- # endif
- #endif
- #if !defined _LIBC || defined _LIBC_REENTRANT
- # define h_errno (*__h_errno_location ())
- #endif
- #endif
- #define NETDB_INTERNAL -1
- #define NETDB_SUCCESS 0
- #define HOST_NOT_FOUND 1
- #define TRY_AGAIN 2
- #define NO_RECOVERY 3
- #define NO_DATA 4
- #define NO_ADDRESS NO_DATA
- #ifdef __USE_XOPEN2K
- # define IPPORT_RESERVED 1024
- #endif
- #ifdef __USE_GNU
- # define SCOPE_DELIMITER '%'
- #endif
- extern void herror (__const char *__str) __THROW;
- extern __const char *hstrerror (int __err_num) __THROW;
- struct hostent
- {
- char *h_name;
- char **h_aliases;
- int h_addrtype;
- int h_length;
- char **h_addr_list;
- #define h_addr h_addr_list[0]
- };
- extern void sethostent (int __stay_open) __THROW;
- extern void endhostent (void) __THROW;
- extern struct hostent *gethostent (void) __THROW;
- extern struct hostent *gethostbyaddr (__const void *__addr, __socklen_t __len,
- int __type) __THROW;
- extern struct hostent *gethostbyname (__const char *__name) __THROW;
- #ifdef __USE_MISC
- extern struct hostent *gethostbyname2 (__const char *__name, int __af) __THROW;
- extern int gethostent_r (struct hostent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct hostent **__restrict __result,
- int *__restrict __h_errnop) __THROW;
- extern int gethostbyaddr_r (__const void *__restrict __addr, __socklen_t __len,
- int __type,
- struct hostent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct hostent **__restrict __result,
- int *__restrict __h_errnop) __THROW;
- extern int gethostbyname_r (__const char *__restrict __name,
- struct hostent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct hostent **__restrict __result,
- int *__restrict __h_errnop) __THROW;
- extern int gethostbyname2_r (__const char *__restrict __name, int __af,
- struct hostent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct hostent **__restrict __result,
- int *__restrict __h_errnop) __THROW;
- #endif
- extern void setnetent (int __stay_open) __THROW;
- extern void endnetent (void) __THROW;
- extern struct netent *getnetent (void) __THROW;
- extern struct netent *getnetbyaddr (uint32_t __net, int __type)
- __THROW;
- extern struct netent *getnetbyname (__const char *__name) __THROW;
- #ifdef __USE_MISC
- extern int getnetent_r (struct netent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct netent **__restrict __result,
- int *__restrict __h_errnop) __THROW;
- extern int getnetbyaddr_r (uint32_t __net, int __type,
- struct netent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct netent **__restrict __result,
- int *__restrict __h_errnop) __THROW;
- extern int getnetbyname_r (__const char *__restrict __name,
- struct netent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct netent **__restrict __result,
- int *__restrict __h_errnop) __THROW;
- #endif
- struct servent
- {
- char *s_name;
- char **s_aliases;
- int s_port;
- char *s_proto;
- };
- extern void setservent (int __stay_open) __THROW;
- extern void endservent (void) __THROW;
- extern struct servent *getservent (void) __THROW;
- extern struct servent *getservbyname (__const char *__name,
- __const char *__proto) __THROW;
- extern struct servent *getservbyport (int __port, __const char *__proto)
- __THROW;
- #ifdef __USE_MISC
- extern int getservent_r (struct servent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct servent **__restrict __result) __THROW;
- extern int getservbyname_r (__const char *__restrict __name,
- __const char *__restrict __proto,
- struct servent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct servent **__restrict __result) __THROW;
- extern int getservbyport_r (int __port, __const char *__restrict __proto,
- struct servent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct servent **__restrict __result) __THROW;
- #endif
- struct protoent
- {
- char *p_name;
- char **p_aliases;
- int p_proto;
- };
- extern void setprotoent (int __stay_open) __THROW;
- extern void endprotoent (void) __THROW;
- extern struct protoent *getprotoent (void) __THROW;
- extern struct protoent *getprotobyname (__const char *__name) __THROW;
- extern struct protoent *getprotobynumber (int __proto) __THROW;
- #ifdef __USE_MISC
- extern int getprotoent_r (struct protoent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct protoent **__restrict __result) __THROW;
- extern int getprotobyname_r (__const char *__restrict __name,
- struct protoent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct protoent **__restrict __result) __THROW;
- extern int getprotobynumber_r (int __proto,
- struct protoent *__restrict __result_buf,
- char *__restrict __buf, size_t __buflen,
- struct protoent **__restrict __result) __THROW;
- #endif
- extern int setnetgrent (__const char *__netgroup) __THROW;
- extern void endnetgrent (void) __THROW;
- extern int getnetgrent (char **__restrict __hostp,
- char **__restrict __userp,
- char **__restrict __domainp) __THROW;
- #ifdef __USE_MISC
- extern int innetgr (__const char *__netgroup, __const char *__host,
- __const char *__user, __const char *domain) __THROW;
- extern int getnetgrent_r (char **__restrict __hostp,
- char **__restrict __userp,
- char **__restrict __domainp,
- char *__restrict __buffer, size_t __buflen) __THROW;
- #endif
- #ifdef __USE_BSD
- extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
- __const char *__restrict __locuser,
- __const char *__restrict __remuser,
- __const char *__restrict __cmd, int *__restrict __fd2p)
- __THROW;
- extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
- __const char *__restrict __locuser,
- __const char *__restrict __remuser,
- __const char *__restrict __cmd, int *__restrict __fd2p,
- sa_family_t __af) __THROW;
- extern int rexec (char **__restrict __ahost, int __rport,
- __const char *__restrict __name,
- __const char *__restrict __pass,
- __const char *__restrict __cmd, int *__restrict __fd2p)
- __THROW;
- extern int rexec_af (char **__restrict __ahost, int __rport,
- __const char *__restrict __name,
- __const char *__restrict __pass,
- __const char *__restrict __cmd, int *__restrict __fd2p,
- sa_family_t __af) __THROW;
- extern int ruserok (__const char *__rhost, int __suser,
- __const char *__remuser, __const char *__locuser) __THROW;
- extern int ruserok_af (__const char *__rhost, int __suser,
- __const char *__remuser, __const char *__locuser,
- sa_family_t __af) __THROW;
- extern int rresvport (int *__alport) __THROW;
- extern int rresvport_af (int *__alport, sa_family_t __af) __THROW;
- #endif
- #ifdef __USE_POSIX
- struct addrinfo
- {
- int ai_flags;
- int ai_family;
- int ai_socktype;
- int ai_protocol;
- socklen_t ai_addrlen;
- struct sockaddr *ai_addr;
- char *ai_canonname;
- struct addrinfo *ai_next;
- };
- # ifdef __USE_GNU
- struct gaicb
- {
- const char *ar_name;
- const char *ar_service;
- const struct addrinfo *ar_request;
- struct addrinfo *ar_result;
-
- int __return;
- int __unused[5];
- };
- # define GAI_WAIT 0
- # define GAI_NOWAIT 1
- # endif
- # define AI_PASSIVE 0x0001
- # define AI_CANONNAME 0x0002
- # define AI_NUMERICHOST 0x0004
- # define EAI_BADFLAGS -1
- # define EAI_NONAME -2
- # define EAI_AGAIN -3
- # define EAI_FAIL -4
- # define EAI_NODATA -5
- # define EAI_FAMILY -6
- # define EAI_SOCKTYPE -7
- # define EAI_SERVICE -8
- # define EAI_ADDRFAMILY -9
- # define EAI_MEMORY -10
- # define EAI_SYSTEM -11
- # ifdef __USE_GNU
- # define EAI_INPROGRESS -100
- # define EAI_CANCELED -101
- # define EAI_NOTCANCELED -102
- # define EAI_ALLDONE -103
- # define EAI_INTR -104
- # endif
- # define NI_MAXHOST 1025
- # define NI_MAXSERV 32
- # define NI_NUMERICHOST 1
- # define NI_NUMERICSERV 2
- # define NI_NOFQDN 4
- # define NI_NAMEREQD 8
- # define NI_DGRAM 16
- extern int getaddrinfo (__const char *__restrict __name,
- __const char *__restrict __service,
- __const struct addrinfo *__restrict __req,
- struct addrinfo **__restrict __pai) __THROW;
- extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
- extern __const char *gai_strerror (int __ecode) __THROW;
- extern int getnameinfo (__const struct sockaddr *__restrict __sa,
- socklen_t __salen, char *__restrict __host,
- socklen_t __hostlen, char *__restrict __serv,
- socklen_t __servlen, unsigned int __flags) __THROW;
- # ifdef __USE_GNU
- extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
- int __ent, struct sigevent *__restrict __sig)
- __THROW;
- extern int gai_suspend (__const struct gaicb *__const __list[], int __ent,
- __const struct timespec *__timeout) __THROW;
- extern int gai_error (struct gaicb *__req) __THROW;
- extern int gai_cancel (struct gaicb *__gaicbp) __THROW;
- # endif
- #endif
- __END_DECLS
- #endif
|