20#ifndef ZEPHYR_INCLUDE_POSIX_NETDB_H_
21#define ZEPHYR_INCLUDE_POSIX_NETDB_H_
23#include <zephyr/net/socket.h>
31#define EAI_BADFLAGS DNS_EAI_BADFLAGS
33#define EAI_NONAME DNS_EAI_NONAME
35#define EAI_AGAIN DNS_EAI_AGAIN
37#define EAI_FAIL DNS_EAI_FAIL
39#define EAI_NODATA DNS_EAI_NODATA
41#define EAI_MEMORY DNS_EAI_MEMORY
43#define EAI_SYSTEM DNS_EAI_SYSTEM
45#define EAI_SERVICE DNS_EAI_SERVICE
47#define EAI_SOCKTYPE DNS_EAI_SOCKTYPE
49#define EAI_FAMILY DNS_EAI_FAMILY
51#define EAI_OVERFLOW DNS_EAI_OVERFLOW
90#define addrinfo zsock_addrinfo
128int getaddrinfo(
const char *host,
const char *service,
const struct zsock_addrinfo *hints,
129 struct zsock_addrinfo **res);
152 char *serv,
socklen_t servlen,
int flags);
struct servent * getservbyport(int port, const char *proto)
Look up a service by port number and protocol (legacy).
void setnetent(int stayopen)
Open the networks database (legacy).
struct netent * getnetbyaddr(uint32_t net, int type)
Look up a network by address (legacy).
struct netent * getnetent(void)
Get the next entry from the networks database (legacy, sequential).
struct protoent * getprotobyname(const char *name)
Look up a protocol by name (legacy).
struct netent * getnetbyname(const char *name)
Look up a network by name (legacy).
void endprotoent(void)
Close the protocols database (legacy).
uint32_t socklen_t
Type for socket address length values.
struct hostent * gethostent(void)
Get the next entry from the hosts database (legacy, sequential).
int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)
Translate a socket address to a hostname and service name.
void setprotoent(int stayopen)
Open the protocols database (legacy).
const char * gai_strerror(int errcode)
Return a string describing a getaddrinfo() error code.
struct protoent * getprotoent(void)
Get the next entry from the protocols database (legacy, sequential).
void endnetent(void)
Close the networks database (legacy, no-op on most systems).
struct servent * getservbyname(const char *name, const char *proto)
Look up a service by name and protocol (legacy).
struct servent * getservent(void)
Get the next entry from the services database (legacy, sequential).
void setservent(int stayopen)
Open the services database (legacy).
struct protoent * getprotobynumber(int proto)
Look up a protocol by number (legacy).
void endhostent(void)
Close the hosts database (legacy, no-op on most systems).
void sethostent(int stayopen)
Open the hosts database (legacy).
int getaddrinfo(const char *host, const char *service, const struct zsock_addrinfo *hints, struct zsock_addrinfo **res)
Translate a hostname and service to a list of socket addresses.
void endservent(void)
Close the services database (legacy).
void freeaddrinfo(struct zsock_addrinfo *ai)
Free addrinfo list returned by getaddrinfo().
Host entry returned by gethostbyname() (legacy).
int h_addrtype
Address type (AF_INET, etc.).
char * h_name
Official name of the host.
char ** h_addr_list
NULL-terminated list of addresses.
int h_length
Length of each address in bytes.
char ** h_aliases
NULL-terminated list of alternate names.
Network entry returned by getnetbyname() (legacy).
uint32_t n_net
Network number (host byte order).
char ** n_aliases
NULL-terminated list of alternate names.
char * n_name
Official network name.
int n_addrtype
Address type (AF_INET).
Protocol entry returned by getprotobyname() (legacy).
int p_proto
Protocol number.
char ** p_aliases
NULL-terminated list of alternate names.
char * p_name
Official protocol name.
Service entry returned by getservbyname() (legacy).
char * s_name
Official service name.
char * s_proto
Protocol to use ("tcp" or "udp").
char ** s_aliases
NULL-terminated list of alternate names.
int s_port
Port number (network byte order).