Line data Source code
1 0 : /*
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
12 : /** Provide a reasonable size for apps using getnameinfo */
13 1 : #define NI_MAXSERV 32
14 : #endif
15 :
16 0 : #define EAI_BADFLAGS DNS_EAI_BADFLAGS
17 0 : #define EAI_NONAME DNS_EAI_NONAME
18 0 : #define EAI_AGAIN DNS_EAI_AGAIN
19 0 : #define EAI_FAIL DNS_EAI_FAIL
20 0 : #define EAI_NODATA DNS_EAI_NODATA
21 0 : #define EAI_MEMORY DNS_EAI_MEMORY
22 0 : #define EAI_SYSTEM DNS_EAI_SYSTEM
23 0 : #define EAI_SERVICE DNS_EAI_SERVICE
24 0 : #define EAI_SOCKTYPE DNS_EAI_SOCKTYPE
25 0 : #define EAI_FAMILY DNS_EAI_FAMILY
26 0 : #define EAI_OVERFLOW DNS_EAI_OVERFLOW
27 :
28 : #ifdef __cplusplus
29 : extern "C" {
30 : #endif
31 :
32 0 : struct hostent {
33 0 : char *h_name;
34 0 : char **h_aliases;
35 0 : int h_addrtype;
36 0 : int h_length;
37 0 : char **h_addr_list;
38 : };
39 :
40 0 : struct netent {
41 0 : char *n_name;
42 0 : char **n_aliases;
43 0 : int n_addrtype;
44 0 : uint32_t n_net;
45 : };
46 :
47 0 : struct protoent {
48 0 : char *p_name;
49 0 : char **p_aliases;
50 0 : int p_proto;
51 : };
52 :
53 0 : struct servent {
54 0 : char *s_name;
55 0 : char **s_aliases;
56 0 : int s_port;
57 0 : char *s_proto;
58 : };
59 :
60 0 : #define addrinfo zsock_addrinfo
61 :
62 0 : void endhostent(void);
63 0 : void endnetent(void);
64 0 : void endprotoent(void);
65 0 : void endservent(void);
66 0 : void freeaddrinfo(struct zsock_addrinfo *ai);
67 0 : const char *gai_strerror(int errcode);
68 0 : int getaddrinfo(const char *host, const char *service, const struct zsock_addrinfo *hints,
69 : struct zsock_addrinfo **res);
70 0 : struct hostent *gethostent(void);
71 0 : int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen,
72 : char *serv, socklen_t servlen, int flags);
73 0 : struct netent *getnetbyaddr(uint32_t net, int type);
74 0 : struct netent *getnetbyname(const char *name);
75 0 : struct netent *getnetent(void);
76 0 : struct protoent *getprotobyname(const char *name);
77 0 : struct protoent *getprotobynumber(int proto);
78 0 : struct protoent *getprotoent(void);
79 0 : struct servent *getservbyname(const char *name, const char *proto);
80 0 : struct servent *getservbyport(int port, const char *proto);
81 0 : struct servent *getservent(void);
82 0 : void sethostent(int stayopen);
83 0 : void setnetent(int stayopen);
84 0 : void setprotoent(int stayopen);
85 0 : void setservent(int stayopen);
86 :
87 : #ifdef __cplusplus
88 : }
89 : #endif
90 :
91 : #endif /* ZEPHYR_INCLUDE_POSIX_NETDB_H_ */
|