mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
libc/netdb: Add hostent_s to avoid the change of hostent
and let other function call the new internal function gethostentbyname_r Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: Ic6137d6cf03f75d6ed33e23bf04ae74b7264e682
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef CONFIG_LIBC_NETDB
|
||||
|
||||
@@ -78,6 +79,20 @@
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct hostent_s
|
||||
{
|
||||
FAR char *h_name; /* Official name of the host. */
|
||||
FAR char **h_aliases; /* A pointer to an array of pointers to the
|
||||
* alternative host names, terminated by a
|
||||
* null pointer. */
|
||||
FAR int *h_addrtypes; /* A pointer to an array of address type. */
|
||||
FAR int *h_lengths; /* A pointer to an array of the length, in bytes,
|
||||
* of the address. */
|
||||
FAR char **h_addr_list; /* A pointer to an array of pointers to network
|
||||
* addresses (in network byte order) for the host,
|
||||
* terminated by a null pointer. */
|
||||
};
|
||||
|
||||
struct services_db_s
|
||||
{
|
||||
FAR const char *s_name;
|
||||
@@ -105,6 +120,16 @@ EXTERN const struct services_db_s g_services_db[];
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
bool convert_hostent(const FAR struct hostent_s *in,
|
||||
int type, FAR struct hostent *out);
|
||||
|
||||
ssize_t parse_hostfile(FAR FILE *stream, FAR struct hostent_s *host,
|
||||
FAR char *buf, size_t buflen);
|
||||
|
||||
int gethostentbyname_r(FAR const char *name,
|
||||
FAR struct hostent_s *host, FAR char *buf,
|
||||
size_t buflen, FAR int *h_errnop);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user