posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
netdb.h File Reference

POSIX network database operations (<netdb.h>) More...

#include <zephyr/net/socket.h>
Include dependency graph for netdb.h:

Go to the source code of this file.

Data Structures

struct  hostent
 Host entry returned by gethostbyname() (legacy). More...
 
struct  netent
 Network entry returned by getnetbyname() (legacy). More...
 
struct  protoent
 Protocol entry returned by getprotobyname() (legacy). More...
 
struct  servent
 Service entry returned by getservbyname() (legacy). More...
 

Macros

#define NI_MAXSERV   32
 Reasonable buffer size for getnameinfo() service names.
 
#define EAI_BADFLAGS   DNS_EAI_BADFLAGS
 Flags argument to getaddrinfo() contained an invalid value.
 
#define EAI_NONAME   DNS_EAI_NONAME
 The name does not resolve for the supplied parameters.
 
#define EAI_AGAIN   DNS_EAI_AGAIN
 Temporary failure in name resolution.
 
#define EAI_FAIL   DNS_EAI_FAIL
 Non-recoverable failure in name resolution.
 
#define EAI_NODATA   DNS_EAI_NODATA
 The requested name is valid but has no address data.
 
#define EAI_MEMORY   DNS_EAI_MEMORY
 Memory allocation failure.
 
#define EAI_SYSTEM   DNS_EAI_SYSTEM
 A system error occurred; errno is set.
 
#define EAI_SERVICE   DNS_EAI_SERVICE
 Requested service not available for the given socket type.
 
#define EAI_SOCKTYPE   DNS_EAI_SOCKTYPE
 Socket type not supported.
 
#define EAI_FAMILY   DNS_EAI_FAMILY
 Address family not supported.
 
#define EAI_OVERFLOW   DNS_EAI_OVERFLOW
 Output buffer overflow.
 
#define addrinfo   zsock_addrinfo
 Address info structure (alias for zsock_addrinfo).
 

Functions

void endhostent (void)
 Close the hosts database (legacy, no-op on most systems).
 
void endnetent (void)
 Close the networks database (legacy, no-op on most systems).
 
void endprotoent (void)
 Close the protocols database (legacy).
 
void endservent (void)
 Close the services database (legacy).
 
void freeaddrinfo (struct zsock_addrinfo *ai)
 Free addrinfo list returned by getaddrinfo().
 
const char * gai_strerror (int errcode)
 Return a string describing a getaddrinfo() error code.
 
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.
 
struct hostentgethostent (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.
 
struct netentgetnetbyaddr (uint32_t net, int type)
 Look up a network by address (legacy).
 
struct netentgetnetbyname (const char *name)
 Look up a network by name (legacy).
 
struct netentgetnetent (void)
 Get the next entry from the networks database (legacy, sequential).
 
struct protoentgetprotobyname (const char *name)
 Look up a protocol by name (legacy).
 
struct protoentgetprotobynumber (int proto)
 Look up a protocol by number (legacy).
 
struct protoentgetprotoent (void)
 Get the next entry from the protocols database (legacy, sequential).
 
struct serventgetservbyname (const char *name, const char *proto)
 Look up a service by name and protocol (legacy).
 
struct serventgetservbyport (int port, const char *proto)
 Look up a service by port number and protocol (legacy).
 
struct serventgetservent (void)
 Get the next entry from the services database (legacy, sequential).
 
void sethostent (int stayopen)
 Open the hosts database (legacy).
 
void setnetent (int stayopen)
 Open the networks database (legacy).
 
void setprotoent (int stayopen)
 Open the protocols database (legacy).
 
void setservent (int stayopen)
 Open the services database (legacy).
 

Detailed Description

POSIX network database operations (<netdb.h>)

Provides hostname and service resolution (getaddrinfo/getnameinfo) and the legacy host/network/protocol/service database functions.

See also
POSIX.1-2017 <netdb.h>

Definition in file netdb.h.