libs/libc/netdb: Implemented the netdb functions getnameinfo(), getservbyport(), and getservbyport_r().

This commit is contained in:
Michael Jung
2019-06-30 15:12:34 -06:00
committed by Gregory Nutt
parent 53119cd476
commit b9d2e516ef
9 changed files with 475 additions and 44 deletions
+8 -6
View File
@@ -277,32 +277,31 @@ int getaddrinfo(FAR const char *nodename,
FAR const char *servname,
FAR const struct addrinfo *hints,
FAR struct addrinfo **res);
int getnameinfo(FAR const struct sockaddr *sa,
socklen_t salen, FAR char *node,
socklen_t nodelen, FAR char *service,
socklen_t servicelen, int flags);
FAR struct hostent *gethostbyaddr(FAR const void *addr, socklen_t len,
int type);
FAR struct hostent *gethostbyname(FAR const char *name);
FAR struct servent *getservbyport(int port, FAR const char *proto);
FAR struct servent *getservbyname(FAR const char *name,
FAR const char *proto);
#if 0 /* None of these are yet supported */
FAR struct hostent *gethostent(void);
int getnameinfo(FAR const struct sockaddr *sa,
socklen_t salen, FAR char *node,
socklen_t nodelen, FAR char *service,
socklen_t servicelen, int flags);
FAR struct netent *getnetbyaddr(uint32_t net, int type);
FAR struct netent *getnetbyname(FAR const char *name);
FAR struct netent *getnetent(void);
FAR struct protoent *getprotobyname(FAR const char *name);
FAR struct protoent *getprotobynumber(int proto);
FAR struct protoent *getprotoent(void);
FAR struct servent *getservbyport(int port, FAR const char *proto);
FAR struct servent *getservent(void);
void sethostent(int);
void setnetent(int stayopen);
void setprotoent(int stayopen);
void setservent(int);
#endif /* None of these are yet supported */
/* Non-standard interfaces similar to Glibc 2 interfaces */
@@ -312,6 +311,9 @@ int gethostbyaddr_r(FAR const void *addr, socklen_t len, int type,
size_t buflen, int *h_errnop);
int gethostbyname_r(FAR const char *name, FAR struct hostent *host,
FAR char *buf, size_t buflen, int *h_errnop);
int getservbyport_r(int port, FAR const char *proto,
FAR struct servent *result_buf, FAR char *buf,
size_t buflen, FAR struct servent **result);
int getservbyname_r(FAR const char *name, FAR const char *proto,
FAR struct servent *result_buf, FAR char *buf,
size_t buflen, FAR struct servent **result);