open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
ua_architecture.h
Go to the documentation of this file.
1/** This work is licensed under a Creative Commons CCZero 1.0 Universal License.
2 * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
3 *
4 * Copyright 2016-2017 (c) Julius Pfrommer, Fraunhofer IOSB
5 * Copyright 2017 (c) Stefan Profanter, fortiss GmbH
6 * Copyright (c) 2020 Wind River Systems, Inc.
7 */
8
9#ifdef UA_ARCHITECTURE_VXWORKS
10
11#ifndef PLUGINS_ARCH_VXWORKS_UA_ARCHITECTURE_H_
12#define PLUGINS_ARCH_VXWORKS_UA_ARCHITECTURE_H_
13
14#include <errno.h>
15#include <time.h>
16
17#include <arpa/inet.h>
18#include <netinet/in.h>
19#include <netdb.h>
20#include <sys/ioctl.h>
21
22#include <hostLib.h>
23#include <selectLib.h>
24
25#define UA_sleep_ms(X) \
26 { \
27 struct timespec timeToSleep; \
28 timeToSleep.tv_sec = X / 1000; \
29 timeToSleep.tv_nsec = 1000000 * (X % 1000); \
30 nanosleep(&timeToSleep, NULL); \
31 }
32
33#ifdef UINT32_C
34# undef UINT32_C
35#endif
36
37#define UINT32_C(x) ((x) + (UINT32_MAX - UINT32_MAX))
38
39#ifdef UA_BINARY_OVERLAYABLE_FLOAT
40# undef UA_BINARY_OVERLAYABLE_FLOAT
41#endif
42#define UA_BINARY_OVERLAYABLE_FLOAT 1
43
44#define OPTVAL_TYPE int
45
46#include <fcntl.h>
47#include <unistd.h> // read, write, close
48#include <netinet/tcp.h>
49
50#define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
51#define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
52
53#define UA_access access
54
55#define UA_IPV6 1
56#define UA_SOCKET int
57#define UA_INVALID_SOCKET -1
58#define UA_ERRNO errno
59#define UA_INTERRUPTED EINTR
60#define UA_AGAIN EAGAIN
61#define UA_EAGAIN EAGAIN
62#define UA_WOULDBLOCK EWOULDBLOCK
63#define UA_ERR_CONNECTION_PROGRESS EINPROGRESS
64
65#define UA_ENABLE_LOG_COLORS
66
67#define UA_getnameinfo getnameinfo
68#define UA_send send
69#define UA_recv recv
70#define UA_sendto sendto
71#define UA_recvfrom recvfrom
72#define UA_recvmsg recvmsg
73#define UA_htonl htonl
74#define UA_ntohl ntohl
75#define UA_close close
76#define UA_select select
77#define UA_shutdown shutdown
78#define UA_socket socket
79#define UA_bind bind
80#define UA_listen listen
81#define UA_accept accept
82#define UA_connect connect
83#define UA_getaddrinfo getaddrinfo
84#define UA_getsockopt getsockopt
85#define UA_setsockopt setsockopt
86#define UA_ioctl ioctl
87#define UA_freeaddrinfo freeaddrinfo
88#define UA_gethostname gethostname
89#define UA_getsockname getsockname
90#define UA_inet_pton inet_pton
91#if UA_IPV6
92# define UA_if_nametoindex if_nametoindex
93#endif
94
95#include <stdlib.h>
96#define UA_free free
97#define UA_malloc malloc
98#define UA_calloc calloc
99#define UA_realloc realloc
100
101#include <stdio.h>
102#define UA_snprintf snprintf
103#define UA_strncasecmp strncasecmp
104
105#define UA_LOG_SOCKET_ERRNO_WRAP(LOG) { \
106 char *errno_str = strerror(errno); \
107 LOG; \
108}
109#define UA_LOG_SOCKET_ERRNO_GAI_WRAP(LOG) { \
110 char *errno_str = gai_strerror(errno); \
111 LOG; \
112}
113
114#if UA_MULTITHREADING >= 100
115#error Multithreading unsupported
116#else
117#define UA_LOCK_INIT(lock)
118#define UA_LOCK_DESTROY(lock)
119#define UA_LOCK(lock)
120#define UA_UNLOCK(lock)
121#define UA_LOCK_ASSERT(lock, num)
122#endif
123
125
126#endif /* PLUGINS_ARCH_VXWORKS_UA_ARCHITECTURE_H_ */
127
128#endif /* UA_ARCHITECTURE_VXWORKS */