X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibpsocket.so_src%2Finclude_exp%2Fnetdb.h;h=943d514d5e905fcda1248707b43d7f495033b052;hb=f8cde3fab5eb27ebacf9d76a7ac478a68a36a38b;hp=d0f12b93374272231cbec8666b4659ac2c3b0310;hpb=8cf9dc88c488ba959a211f1ec653a366d16e1531;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libpsocket.so_src/include_exp/netdb.h b/Usermode/Libraries/libpsocket.so_src/include_exp/netdb.h index d0f12b93..943d514d 100644 --- a/Usermode/Libraries/libpsocket.so_src/include_exp/netdb.h +++ b/Usermode/Libraries/libpsocket.so_src/include_exp/netdb.h @@ -3,6 +3,44 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + +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] // backwards compataibility + +struct netent +{ + char *n_name; + char **n_aliases; + int n_addrtype; + uint32_t n_net; +}; + +struct protoent +{ + char *p_name; + char **p_aliases; + int p_proto; +}; + +struct servent +{ + char *s_name; + char **s_aliases; + int s_port; + char *s_proto; +}; + #define AI_PASSIVE 0x001 #define AI_V4MAPPED 0x002 #define AI_ADDRCONFIG 0x004 @@ -15,6 +53,17 @@ #define NI_NUMERICHOST (1<<3) #define NI_NUMERICSERV (1<<4) +#define NI_MAXHOST 1024 // may not be posix + +// Error values from gethostbyaddr/gethostbyname +enum +{ + HOST_NOT_FOUND = 1, + NO_DATA, + NO_RECOVERY, + TRY_AGAIN, +}; + enum { EAI_SUCCESS, @@ -50,6 +99,19 @@ extern int getaddrinfo(const char *node, const char *service, const struct addri extern void freeaddrinfo(struct addrinfo *res); const char *gai_strerror(int errorcode); +extern struct servent *getservbyname(const char *name, const char *proto); +extern struct servent *getservbyport(int port, const char *proto); + +extern struct hostent *gethostbyname(const char *name); +extern struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type); + +extern void setservent(int stayopen); +extern struct servent *getservent(void); +extern void enservent(void); + +#ifdef __cplusplus +} +#endif #endif