1 #ifndef _LIBPSOCKET__NETDB_H_
2 #define _LIBPSOCKET__NETDB_H_
4 #include <sys/socket.h>
19 #define h_addr h_addr_list[0] // backwards compataibility
44 #define AI_PASSIVE 0x001
45 #define AI_V4MAPPED 0x002
46 #define AI_ADDRCONFIG 0x004
47 #define AI_NUMERICHOST 0x008
48 #define AI_NUMERICSERV 0x010
50 #define NI_NAMEREQD (1<<0)
51 #define NI_DGRAM (1<<1)
52 #define NI_NOFQDN (1<<2)
53 #define NI_NUMERICHOST (1<<3)
54 #define NI_NUMERICSERV (1<<4)
56 #define NI_MAXHOST 1024 // may not be posix
58 // Error values from gethostbyaddr/gethostbyname
92 struct sockaddr *ai_addr;
94 struct addrinfo *ai_next;
97 extern int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
98 extern int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
99 extern void freeaddrinfo(struct addrinfo *res);
100 const char *gai_strerror(int errorcode);
102 extern struct servent *getservbyname(const char *name, const char *proto);
103 extern struct servent *getservbyport(int port, const char *proto);
105 extern struct hostent *gethostbyname(const char *name);
106 extern struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type);
108 extern void setservent(int stayopen);
109 extern struct servent *getservent(void);
110 extern void enservent(void);