7#ifndef ARCH_COMMON_LWIP62541_H_
8#define ARCH_COMMON_LWIP62541_H_
20#include <lwip/tcpip.h>
21#include <lwip/netdb.h>
23#include <lwip/sockets.h>
25#define OPTVAL_TYPE int
27#define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
28#define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
30#define UA_IPV6 LWIP_IPV6
32#define UA_INVALID_SOCKET -1
34#define UA_INTERRUPTED EINTR
35#define UA_AGAIN EAGAIN
36#define UA_EAGAIN EAGAIN
37#define UA_WOULDBLOCK EWOULDBLOCK
38#define UA_ERR_CONNECTION_PROGRESS EINPROGRESS
40#define UA_POLLIN POLLIN
41#define UA_POLLOUT POLLOUT
43#define UA_poll lwip_poll
44#define UA_send lwip_send
45#define UA_recv lwip_recv
46#define UA_sendto lwip_sendto
47#define UA_recvfrom lwip_recvfrom
48#define UA_htonl lwip_htonl
49#define UA_ntohl lwip_ntohl
50#define UA_close lwip_close
51#define UA_select lwip_select
52#define UA_shutdown lwip_shutdown
53#define UA_socket lwip_socket
54#define UA_bind lwip_bind
55#define UA_listen lwip_listen
56#define UA_accept lwip_accept
57#define UA_connect lwip_connect
58#define UA_getsockopt lwip_getsockopt
59#define UA_setsockopt lwip_setsockopt
60#define UA_freeaddrinfo lwip_freeaddrinfo
62#define UA_gethostname gethostname_lwip
67#define UA_getsockname lwip_getsockname
69extern int UA_getsockname((
int s,
struct sockaddr *name, socklen_t *namelen);
72#define UA_getaddrinfo lwip_getaddrinfo
74extern int UA_getaddrinfo(
const char *nodename,
const char *servname,
75 const struct addrinfo *hints,
struct addrinfo **res);
79# define UA_inet_pton(af, src, dst) \
80 (((af) == AF_INET6) ? ip6addr_aton((src),(ip6_addr_t*)(dst)) \
81 : (((af) == AF_INET) ? ip4addr_aton((src),(ip4_addr_t*)(dst)) : 0))
83# define UA_inet_pton(af, src, dst) \
84 (((af) == AF_INET) ? ip4addr_aton((src),(ip4_addr_t*)(dst)) : 0)
88# define UA_if_nametoindex lwip_if_nametoindex
90# if LWIP_VERSION_IS_RELEASE
91unsigned int lwip_if_nametoindex(
const char *ifname);
97#define UA_LOG_SOCKET_ERRNO_GAI_WRAP UA_LOG_SOCKET_ERRNO_WRAP
int gethostname_lwip(char *name, size_t len)