#ifndef _NETDB_H_
#define _NETDB_H_
#include <sys/cdefs.h>
#include <machine/stdint.h>
#ifndef _IN_ADDR_T_DECLARED
typedef __uint32_t in_addr_t;
#define _IN_ADDR_T_DECLARED
#endif
#ifndef _IN_PORT_T_DECLARED
typedef __uint16_t in_port_t;
#define _IN_PORT_T_DECLARED
#endif
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
#ifndef _SOCKLEN_T_DECLARED
typedef __socklen_t socklen_t;
#define _SOCKLEN_T_DECLARED
#endif
#ifndef _UINT32_T_DECLARED
typedef __uint32_t uint32_t;
#define _UINT32_T_DECLARED
#endif
#ifndef _PATH_HEQUIV
# define _PATH_HEQUIV "/etc/hosts.equiv"
#endif
#define _PATH_HOSTS "/etc/hosts"
#define _PATH_NETWORKS "/etc/networks"
#define _PATH_PROTOCOLS "/etc/protocols"
#define _PATH_SERVICES "/etc/services"
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE < 200809)
#define h_errno (*__h_errno())
#endif
struct hostent {
char *h_name;
char **h_aliases;
int h_addrtype;
int h_length;
char **h_addr_list;
#if __BSD_VISIBLE
#define h_addr h_addr_list[0]
#endif
};
struct netent {
char *n_name;
char **n_aliases;
int n_addrtype;
uint32_t n_net;
};
struct servent {
char *s_name;
char **s_aliases;
int s_port;
char *s_proto;
};
struct protoent {
char *p_name;
char **p_aliases;
int p_proto;
};
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
socklen_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
#if __BSD_VISIBLE
#define NETDB_INTERNAL -1
#define NETDB_SUCCESS 0
#endif
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE < 200809)
#define HOST_NOT_FOUND 1
#define TRY_AGAIN 2
#define NO_RECOVERY 3
#define NO_DATA 4
#endif
#if __BSD_VISIBLE
#define NO_ADDRESS NO_DATA
#endif
#if __BSD_VISIBLE
#define EAI_ADDRFAMILY 1
#endif
#define EAI_AGAIN 2
#define EAI_BADFLAGS 3
#define EAI_FAIL 4
#define EAI_FAMILY 5
#define EAI_MEMORY 6
#if __BSD_VISIBLE
#define EAI_NODATA 7
#endif
#define EAI_NONAME 8
#define EAI_SERVICE 9
#define EAI_SOCKTYPE 10
#define EAI_SYSTEM 11
#if __BSD_VISIBLE
#define EAI_BADHINTS 12
#define EAI_PROTOCOL 13
#endif
#define EAI_OVERFLOW 14
#if __BSD_VISIBLE
#define EAI_MAX 15
#endif
#define AI_PASSIVE 0x00000001
#define AI_CANONNAME 0x00000002
#define AI_NUMERICHOST 0x00000004
#define AI_NUMERICSERV 0x00000008
#if __BSD_VISIBLE
#define AI_MASK \
(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
AI_ADDRCONFIG)
#endif
#define AI_ALL 0x00000100
#if __BSD_VISIBLE
#define AI_V4MAPPED_CFG 0x00000200
#endif
#define AI_ADDRCONFIG 0x00000400
#define AI_V4MAPPED 0x00000800
#if __BSD_VISIBLE
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
#endif
#define NI_NOFQDN 0x00000001
#define NI_NUMERICHOST 0x00000002
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#if __BSD_VISIBLE
#define NI_WITHSCOPEID 0x00000020
#endif
#define NI_NUMERICSCOPE 0x00000040
#if __BSD_VISIBLE
#define SCOPE_DELIMITER '%'
#endif
__BEGIN_DECLS
void endhostent(void);
void endnetent(void);
void endprotoent(void);
void endservent(void);
#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE < 200809)
struct hostent *gethostbyaddr(const void *, socklen_t, int);
struct hostent *gethostbyname(const char *);
#endif
struct hostent *gethostent(void);
struct netent *getnetbyaddr(uint32_t, int);
struct netent *getnetbyname(const char *);
struct netent *getnetent(void);
struct protoent *getprotobyname(const char *);
struct protoent *getprotobynumber(int);
struct protoent *getprotoent(void);
struct servent *getservbyname(const char *, const char *);
struct servent *getservbyport(int, const char *);
struct servent *getservent(void);
void sethostent(int);
void setnetent(int);
void setprotoent(int);
int getaddrinfo(const char * __restrict, const char * __restrict,
const struct addrinfo * __restrict,
struct addrinfo ** __restrict);
int getnameinfo(const struct sockaddr * __restrict, socklen_t,
char * __restrict, size_t, char * __restrict, size_t, int);
void freeaddrinfo(struct addrinfo *);
const char *gai_strerror(int);
void setservent(int);
#if __BSD_VISIBLE
void endnetgrent(void);
void freehostent(struct hostent *);
int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *,
char *, size_t, struct hostent **, int *);
int gethostbyname_r(const char *, struct hostent *, char *, size_t,
struct hostent **, int *);
struct hostent *gethostbyname2(const char *, int);
int gethostbyname2_r(const char *, int, struct hostent *, char *,
size_t, struct hostent **, int *);
int gethostent_r(struct hostent *, char *, size_t,
struct hostent **, int *);
struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
struct hostent *getipnodebyname(const char *, int, int, int *);
int getnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t,
struct netent **, int *);
int getnetbyname_r(const char *, struct netent *, char *, size_t,
struct netent **, int *);
int getnetent_r(struct netent *, char *, size_t, struct netent **,
int *);
int getnetgrent(char **, char **, char **);
int getprotobyname_r(const char *, struct protoent *, char *,
size_t, struct protoent **);
int getprotobynumber_r(int, struct protoent *, char *, size_t,
struct protoent **);
int getprotoent_r(struct protoent *, char *, size_t,
struct protoent **);
int getservbyname_r(const char *, const char *, struct servent *,
char *, size_t, struct servent **);
int getservbyport_r(int, const char *, struct servent *, char *,
size_t, struct servent **);
int getservent_r(struct servent *, char *, size_t,
struct servent **);
void herror(const char *);
const char *hstrerror(int);
int innetgr(const char *, const char *, const char *, const char *);
void setnetgrent(const char *);
#endif
int * __h_errno(void);
__END_DECLS
#endif