#ifndef _NETDB_H
#define _NETDB_H 1
#include
#include
#include
#ifdef __USE_MISC
# include
#endif
#ifdef __USE_GNU
# define __need_sigevent_t
# include
# define __need_timespec
# include
#endif
#include
#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
#define h_errno (*__h_errno_location ())
extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
#define NETDB_INTERNAL -1
#define NETDB_SUCCESS 0
#define HOST_NOT_FOUND 1
#define TRY_AGAIN 2
or SERVERFAIL. */
#define NO_RECOVERY 3
NOTIMP. */
#define NO_DATA 4
type. */
#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);
extern void endhostent (void);
extern struct hostent *gethostent (void);
extern struct hostent *gethostbyaddr (__const void *__addr, __socklen_t __len,
int __type);
extern struct hostent *gethostbyname (__const char *__name);
#ifdef __USE_MISC
extern struct hostent *gethostbyname2 (__const char *__name, int __af);
extern int gethostent_r (struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
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);
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);
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);
#endif
extern void setnetent (int __stay_open);
extern void endnetent (void);
extern struct netent *getnetent (void);
extern struct netent *getnetbyaddr (uint32_t __net, int __type);
extern struct netent *getnetbyname (__const char *__name);
#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);
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);
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);
#endif
struct servent
{
char *s_name;
char **s_aliases;
int s_port;
char *s_proto;
};
extern void setservent (int __stay_open);
extern void endservent (void);
extern struct servent *getservent (void);
extern struct servent *getservbyname (__const char *__name,
__const char *__proto);
extern struct servent *getservbyport (int __port, __const char *__proto);
#ifdef __USE_MISC
extern int getservent_r (struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
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);
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);
#endif
struct protoent
{
char *p_name;
char **p_aliases;
int p_proto;
};
extern void setprotoent (int __stay_open);
extern void endprotoent (void);
extern struct protoent *getprotoent (void);
extern struct protoent *getprotobyname (__const char *__name);
extern struct protoent *getprotobynumber (int __proto);
#ifdef __USE_MISC
extern int getprotoent_r (struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
extern int getprotobyname_r (__const char *__restrict __name,
struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
extern int getprotobynumber_r (int __proto,
struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
extern int setnetgrent (__const char *__netgroup);
extern void endnetgrent (void);
extern int getnetgrent (char **__restrict __hostp,
char **__restrict __userp,
char **__restrict __domainp);
extern int innetgr (__const char *__netgroup, __const char *__host,
__const char *__user, __const char *domain);
extern int getnetgrent_r (char **__restrict __hostp,
char **__restrict __userp,
char **__restrict __domainp,
char *__restrict __buffer, size_t __buflen);
#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);
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);
extern int rexec (char **__restrict __ahost, int __rport,
__const char *__restrict __name,
__const char *__restrict __pass,
__const char *__restrict __cmd, int *__restrict __fd2p);
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);
extern int ruserok (__const char *__rhost, int __suser,
__const char *__remuser, __const char *__locuser);
extern int ruserok_af (__const char *__rhost, int __suser,
__const char *__remuser, __const char *__locuser,
sa_family_t __af);
extern int rresvport (int *__alport);
extern int rresvport_af (int *__alport, sa_family_t __af);
#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 AI_V4MAPPED 0x0008
# define AI_ALL 0x0010
# define AI_ADDRCONFIG 0x0020
# ifdef __USE_GNU
# define AI_IDN 0x0040
# define AI_CANONIDN 0x0080
# define AI_IDN_ALLOW_UNASSIGNED 0x0100
# define AI_IDN_USE_STD3_ASCII_RULES 0x0200
# endif
# define AI_NUMERICSERV 0x0400
# 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
# define EAI_OVERFLOW -12
# ifdef __USE_GNU
# define EAI_INPROGRESS -100
# define EAI_CANCELED -101
# define EAI_NOTCANCELED -102
# define EAI_ALLDONE -103
# define EAI_INTR -104
# define EAI_IDN_ENCODE -105
# 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
# ifdef __USE_GNU
# define NI_IDN 32
# define NI_IDN_ALLOW_UNASSIGNED 64
# define NI_IDN_USE_STD3_ASCII_RULES 128
# endif
extern int getaddrinfo (__const char *__restrict __name,
__const char *__restrict __service,
__const struct addrinfo *__restrict __req,
struct addrinfo **__restrict __pai);
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);
#endif
#ifdef __USE_GNU
extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
int __ent, struct sigevent *__restrict __sig);
extern int gai_suspend (__const struct gaicb *__const __list[], int __ent,
__const struct timespec *__timeout);
extern int gai_error (struct gaicb *__req) __THROW;
extern int gai_cancel (struct gaicb *__gaicbp) __THROW;
#endif
__END_DECLS
#endif
|