Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
netdb.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Linaro Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_POSIX_NETDB_H_
7#define ZEPHYR_INCLUDE_POSIX_NETDB_H_
8
9#include <zephyr/net/socket.h>
10
11#ifndef NI_MAXSERV
13#define NI_MAXSERV 32
14#endif
15
16#define EAI_BADFLAGS DNS_EAI_BADFLAGS
17#define EAI_NONAME DNS_EAI_NONAME
18#define EAI_AGAIN DNS_EAI_AGAIN
19#define EAI_FAIL DNS_EAI_FAIL
20#define EAI_NODATA DNS_EAI_NODATA
21#define EAI_MEMORY DNS_EAI_MEMORY
22#define EAI_SYSTEM DNS_EAI_SYSTEM
23#define EAI_SERVICE DNS_EAI_SERVICE
24#define EAI_SOCKTYPE DNS_EAI_SOCKTYPE
25#define EAI_FAMILY DNS_EAI_FAMILY
26#define EAI_OVERFLOW DNS_EAI_OVERFLOW
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32struct hostent {
33 char *h_name;
34 char **h_aliases;
38};
39
40struct netent {
41 char *n_name;
42 char **n_aliases;
45};
46
47struct protoent {
48 char *p_name;
49 char **p_aliases;
51};
52
53struct servent {
54 char *s_name;
55 char **s_aliases;
56 int s_port;
57 char *s_proto;
58};
59
60#define addrinfo zsock_addrinfo
61
62void endhostent(void);
63void endnetent(void);
64void endprotoent(void);
65void endservent(void);
67const char *gai_strerror(int errcode);
68int getaddrinfo(const char *host, const char *service, const struct zsock_addrinfo *hints,
69 struct zsock_addrinfo **res);
70struct hostent *gethostent(void);
71int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen,
72 char *serv, socklen_t servlen, int flags);
73struct netent *getnetbyaddr(uint32_t net, int type);
74struct netent *getnetbyname(const char *name);
75struct netent *getnetent(void);
76struct protoent *getprotobyname(const char *name);
77struct protoent *getprotobynumber(int proto);
78struct protoent *getprotoent(void);
79struct servent *getservbyname(const char *name, const char *proto);
80struct servent *getservbyport(int port, const char *proto);
81struct servent *getservent(void);
82void sethostent(int stayopen);
83void setnetent(int stayopen);
84void setprotoent(int stayopen);
85void setservent(int stayopen);
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif /* ZEPHYR_INCLUDE_POSIX_NETDB_H_ */
size_t socklen_t
Length of a socket address.
Definition net_ip.h:171
BSD Sockets compatible API definitions.
struct servent * getservbyport(int port, const char *proto)
void setnetent(int stayopen)
struct netent * getnetbyaddr(uint32_t net, int type)
struct netent * getnetent(void)
struct protoent * getprotobyname(const char *name)
struct netent * getnetbyname(const char *name)
void endprotoent(void)
struct hostent * gethostent(void)
int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)
void setprotoent(int stayopen)
const char * gai_strerror(int errcode)
struct protoent * getprotoent(void)
void endnetent(void)
struct servent * getservbyname(const char *name, const char *proto)
struct servent * getservent(void)
void setservent(int stayopen)
struct protoent * getprotobynumber(int proto)
void endhostent(void)
void sethostent(int stayopen)
int getaddrinfo(const char *host, const char *service, const struct zsock_addrinfo *hints, struct zsock_addrinfo **res)
void endservent(void)
void freeaddrinfo(struct zsock_addrinfo *ai)
flags
Definition parser.h:96
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
Definition netdb.h:32
int h_addrtype
Definition netdb.h:35
char * h_name
Definition netdb.h:33
char ** h_addr_list
Definition netdb.h:37
int h_length
Definition netdb.h:36
char ** h_aliases
Definition netdb.h:34
Definition netdb.h:40
uint32_t n_net
Definition netdb.h:44
char ** n_aliases
Definition netdb.h:42
char * n_name
Definition netdb.h:41
int n_addrtype
Definition netdb.h:43
Definition netdb.h:47
int p_proto
Definition netdb.h:50
char ** p_aliases
Definition netdb.h:49
char * p_name
Definition netdb.h:48
Definition netdb.h:53
char * s_name
Definition netdb.h:54
char * s_proto
Definition netdb.h:57
char ** s_aliases
Definition netdb.h:55
int s_port
Definition netdb.h:56
Generic sockaddr struct.
Definition net_ip.h:388
Definition used when querying address information.
Definition socket.h:276