ua_architecture.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. */
  7. #ifdef UA_ARCHITECTURE_VXWORKS
  8. #ifndef PLUGINS_ARCH_VXWORKS_UA_ARCHITECTURE_H_
  9. #define PLUGINS_ARCH_VXWORKS_UA_ARCHITECTURE_H_
  10. #include <errno.h>
  11. #include <arpa/inet.h>
  12. #include <netinet/in.h>
  13. #include <netdb.h>
  14. #include <sys/ioctl.h>
  15. #include <hostLib.h>
  16. #include <selectLib.h>
  17. #define UA_sleep_ms(X) \
  18. { \
  19. struct timespec timeToSleep; \
  20. timeToSleep.tv_sec = X / 1000; \
  21. timeToSleep.tv_nsec = 1000000 * (X % 1000); \
  22. nanosleep(&timeToSleep, NULL); \
  23. }
  24. #ifdef UINT32_C
  25. # undef UINT32_C
  26. #endif
  27. #define UINT32_C(x) ((x) + (UINT32_MAX - UINT32_MAX))
  28. #ifdef UA_BINARY_OVERLAYABLE_FLOAT
  29. # undef UA_BINARY_OVERLAYABLE_FLOAT
  30. #endif
  31. #define UA_BINARY_OVERLAYABLE_FLOAT 1
  32. #define OPTVAL_TYPE int
  33. #include <fcntl.h>
  34. #include <unistd.h> // read, write, close
  35. #include <netinet/tcp.h>
  36. #define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
  37. #define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
  38. #define UA_access access
  39. #define UA_IPV6 1
  40. #define UA_SOCKET int
  41. #define UA_INVALID_SOCKET -1
  42. #define UA_ERRNO errno
  43. #define UA_INTERRUPTED EINTR
  44. #define UA_AGAIN EAGAIN
  45. #define UA_EAGAIN EAGAIN
  46. #define UA_WOULDBLOCK EWOULDBLOCK
  47. #define UA_ERR_CONNECTION_PROGRESS EINPROGRESS
  48. #define UA_ENABLE_LOG_COLORS
  49. #define UA_getnameinfo getnameinfo
  50. #define UA_send send
  51. #define UA_recv recv
  52. #define UA_sendto sendto
  53. #define UA_recvfrom recvfrom
  54. #define UA_htonl htonl
  55. #define UA_ntohl ntohl
  56. #define UA_close close
  57. #define UA_select select
  58. #define UA_shutdown shutdown
  59. #define UA_socket socket
  60. #define UA_bind bind
  61. #define UA_listen listen
  62. #define UA_accept accept
  63. #define UA_connect connect
  64. #define UA_getaddrinfo getaddrinfo
  65. #define UA_getsockopt getsockopt
  66. #define UA_setsockopt setsockopt
  67. #define UA_freeaddrinfo freeaddrinfo
  68. #define UA_gethostname gethostname
  69. #define UA_inet_pton inet_pton
  70. #if UA_IPV6
  71. # define UA_if_nametoindex if_nametoindex
  72. #endif
  73. #include <stdlib.h>
  74. #define UA_free free
  75. #define UA_malloc malloc
  76. #define UA_calloc calloc
  77. #define UA_realloc realloc
  78. #include <stdio.h>
  79. #define UA_snprintf snprintf
  80. #define UA_LOG_SOCKET_ERRNO_WRAP(LOG) { \
  81. char *errno_str = strerror(errno); \
  82. LOG; \
  83. }
  84. #define UA_LOG_SOCKET_ERRNO_GAI_WRAP(LOG) { \
  85. char *errno_str = gai_strerror(errno); \
  86. LOG; \
  87. }
  88. #include "../ua_architecture_functions.h"
  89. #undef SLIST_EMPTY
  90. #undef SLIST_FOREACH
  91. #undef SLIST_INIT
  92. #undef SLIST_REMOVE
  93. #undef LIST_EMPTY
  94. #undef LIST_FOREACH
  95. #undef LIST_INIT
  96. #undef LIST_REMOVE
  97. #undef TAILQ_EMPTY
  98. #undef TAILQ_FOREACH
  99. #undef TAILQ_INIT
  100. #undef TAILQ_REMOVE
  101. #undef TAILQ_FOREACH_REVERSE
  102. #undef CIRCLEQ_EMPTY
  103. #undef CIRCLEQ_FOREACH
  104. #undef CIRCLEQ_INIT
  105. #undef CIRCLEQ_FOREACH_REVERSE
  106. #undef CIRCLEQ_REMOVE
  107. #undef CIRCLEQ_INSERT_TAIL
  108. #undef CIRCLEQ_INSERT_HEAD
  109. #undef CIRCLEQ_INSERT_AFTER
  110. #undef CIRCLEQ_INSERT_BEFORE
  111. #undef SLIST_INSERT_AFTER
  112. #undef SLIST_INSERT_HEAD
  113. #undef SLIST_REMOVE_HEAD
  114. #undef LIST_INSERT_AFTER
  115. #undef LIST_INSERT_BEFORE
  116. #undef LIST_INSERT_HEAD
  117. #undef TAILQ_INSERT_HEAD
  118. #undef TAILQ_INSERT_TAIL
  119. #undef TAILQ_INSERT_AFTER
  120. #undef TAILQ_INSERT_BEFORE
  121. #undef CIRCLEQ_HEAD_INITIALIZER
  122. #undef _SYS_QUEUE_H_
  123. #endif /* PLUGINS_ARCH_VXWORKS_UA_ARCHITECTURE_H_ */
  124. #endif /* UA_ARCHITECTURE_VXWORKS */