From: Costin Lupu Date: Wed, 4 Sep 2019 19:09:08 +0000 (+0300) Subject: Revisit netdb.h declarations X-Git-Tag: RELEASE-0.4~34 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=883162b5ca6c9791b305d1693184057b99b42948;p=unikraft%2Flibs%2Flwip.git Revisit netdb.h declarations * As we did in commit b0dc593d, we use function wrappers instead of macros for gethostbyname() and gethostbyname_r() * Add missing declarations of functions implemented or stubbed in glue code Signed-off-by: Costin Lupu Reviewed-by: Vlad-Andrei Badoiu --- diff --git a/exportsyms.uk b/exportsyms.uk index 6fe95ec..bcdfed3 100644 --- a/exportsyms.uk +++ b/exportsyms.uk @@ -7,6 +7,8 @@ freeaddrinfo gai_strerror getaddrinfo gethostbyaddr +gethostbyname +gethostbyname_r getnameinfo getpeername getprotobyname diff --git a/host.c b/host.c index 559d186..9c4c8ea 100644 --- a/host.c +++ b/host.c @@ -33,10 +33,29 @@ #include #include +#include + + +#if LWIP_DNS && LWIP_SOCKET + +#if !(LWIP_COMPAT_SOCKETS) +struct hostent *gethostbyname(const char *name) +{ + return lwip_gethostbyname(name); +} + +int gethostbyname_r(const char *name, + struct hostent *ret, char *buf, size_t buflen, + struct hostent **result, int *h_errnop) +{ + return lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop); +} +#endif struct hostent *gethostbyaddr(const void *addr __unused, socklen_t len __unused, int type __unused) { return NULL; } +#endif diff --git a/include/netdb.h b/include/netdb.h index 0856a49..b100136 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -1,10 +1,16 @@ #include -#if LWIP_DNS && LWIP_SOCKET && !(LWIP_COMPAT_SOCKETS) +#if LWIP_DNS && LWIP_SOCKET -#define gethostbyname(name) lwip_gethostbyname(name) -#define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \ - lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop) +#if !(LWIP_COMPAT_SOCKETS) +struct hostent *gethostbyname(const char *name); +int gethostbyname_r(const char *name, + struct hostent *ret, char *buf, size_t buflen, + struct hostent **result, int *h_errnop); +#endif + +struct hostent *gethostbyaddr(const void *addr __unused, + socklen_t len __unused, int type __unused); int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, @@ -13,6 +19,9 @@ void freeaddrinfo(struct addrinfo *res); #endif /* LWIP_DNS && LWIP_SOCKET && !(LWIP_COMPAT_SOCKETS) */ +const char *gai_strerror(int errcode); + + struct servent { char *s_name; /* official service name */ char **s_aliases; /* alias list */ @@ -26,7 +35,11 @@ struct protoent { int p_proto; /* protocol # */ }; -const char *gai_strerror(int errcode); +struct protoent *getprotoent(void); +struct protoent *getprotobyname(const char *name); +struct protoent *getprotobynumber(int num); +void endprotoent(void); +void setprotoent(int stayopen); /* * Constants for getnameinfo()