High Performance OPC UA Server SDK
1.4.2.279
|
Abstraction layer for different platforms. More...
Modules | |
guid | |
Platform level guid abstraction. | |
hostname | |
Functionality for retrieving local hostname information. | |
ipc_mem | |
memory | |
Wrapper for common memory operations. | |
mutex | |
Mutex that can be locked and unlocked for mutual exclusion of different processes. | |
platform | |
General platform specfic defines and initialization/cleanup for platform layer. | |
process | |
Functionality for starting and stopping processes. | |
semaphore | |
Semaphore for managing shared resources. | |
shutdown | |
Functionality for server shutdown and configuration reload. | |
time | |
Retrieve current time in different formats and sleep. | |
#define | UA_BEGIN_EXTERN_C |
#define | UA_END_EXTERN_C |
#define | UA_UNUSED(x) (void)(x) |
Indicates to the compiler that the parameter with the specified name is not used in the body of a function. More... | |
#define | UA_LITTLE_ENDIAN __LITTLE_ENDIAN |
#define | UA_BIG_ENDIAN __BIG_ENDIAN |
#define | UA_PDP_ENDIAN __PDP_ENDIAN |
#define | UA_BYTE_ORDER __BYTE_ORDER |
#define | UA_FLOAT_BYTE_ORDER __BYTE_ORDER |
#define | UA_DOUBLE_BYTE_ORDER __BYTE_ORDER |
#define | container_of(ptr, type, member) |
container_of returns the base address of the structure containing the field 'member'. More... | |
#define | GCC_VERSION |
#define | BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) |
Force a compilation error if condition is true, but also produce a result (of value 0 and type size_t), so the expression can be used e.g. More... | |
#define | __must_be_array(a) BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) |
Ensures the given argument is an array. More... | |
#define | countof(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) |
Returns the size of an array (number of elements). More... | |
#define | ua_bswap16(x) ((((uint16_t)(x))>> 8) | (((uint16_t)(x)) << 8)) |
#define | ua_bswap32(x) |
#define | ua_bswap64(x) |
#define | ua_htole16(x) (x) |
#define | ua_htole32(x) (x) |
#define | ua_htole64(x) (x) |
#define | ua_letoh16(x) ua_htole16(x) |
#define | ua_letoh32(x) ua_htole32(x) |
#define | ua_letoh64(x) ua_htole64(x) |
#define | ua_offsetof offsetof |
The offsetof macro as defined in C89 and C99, but certain platforms need workarounds. More... | |
#define | UA_FORMAT_ARGUMENT(fmt, va) |
Marks arguments to be format specifier which allows further static checks by GCC and Clang. More... | |
#define | UA_WEAK_SYMBOL |
#define | UA_CONST_FUNCTION __attribute__ ((const)) |
Const function, has no side effects only reads parameters, it does not modifiy anything. | |
#define | UA_PURE_FUNCTION __attribute__ ((pure)) |
Pure function, has no side effects only reads parameters and global state, it does not modifiy anything. | |
#define | UA_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) |
Mark non null parameters. More... | |
#define | UA_HAVE_NONNULL_SUPPORT |
Pointer checks of arguments defined as NONNULL produce warnings. More... | |
#define | UA_DEPRECATED __attribute((__deprecated__)) |
Macro for marking functions as deprecated. More... | |
#define | UA_WARN_UNUSED_RESULT __attribute((__warn_unused_result__)) |
Macro to force checking the return values (missing error handling) | |
#define | UA_NORETURN __attribute((noreturn)) |
Function marked with this macro might never return. More... | |
#define | PRIuSIZE_T "zu" |
format specifier for size_t (unsigned) | |
#define | PRIiSIZE_T "zi" |
format specifier for ssize_t (signed, but also not supported at all by MS) | |
#define | UA_ASSERT(cond) assert(cond) |
portable wrapper for assert function/macro | |
#define | UA_STATIC_ASSERT(cond, msg) |
A static assert macro as defined by C11. More... | |
#define | UA_SAFESTR(x) (x) ? (x) : "(NULL)" |
allows to safely print strings which may be NULL | |
#define | UA_MIN(a, b) ({ typeof (a) _a = (a); typeof (b) _b = (b); _a < _b ? _a : _b; }) |
#define | UA_MAX(a, b) ({ typeof (a) _a = (a); typeof (b) _b = (b); _a > _b ? _a : _b; }) |
#define | UA_P_TRACE_INFO(msg, ...) fprintf(stdout, msg, ##__VA_ARGS__) |
Platform layer trace macro which prints to stdout. More... | |
#define | UA_P_TRACE_ERROR(msg, ...) fprintf(stderr, msg, ##__VA_ARGS__) |
Platform layer trace macro which prints to stderr. More... | |
int | ua_p_platform_init (void) |
int | ua_p_platform_cleanup (void) |
void | ua_p_platform_panic (const char *msg, const char *file, int line) UA_NORETURN |
Abstraction layer for different platforms.
#define __must_be_array | ( | a | ) | BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) |
Ensures the given argument is an array.
Returns zero if arr is an array or produces an error using BUILD_BUG_ON_ZERO.
#define BUILD_BUG_ON_ZERO | ( | e | ) | (sizeof(struct { int:-!!(e); })) |
Force a compilation error if condition is true, but also produce a result (of value 0 and type size_t), so the expression can be used e.g.
in a structure initializer (or where-ever else comma expressions aren't permitted).
#define container_of | ( | ptr, | |
type, | |||
member | |||
) |
container_of returns the base address of the structure containing the field 'member'.
So it does the same as offsetof() macro which is part of the C standard, just in the opposite direction. Indeed it uses offsetof() to calculate the address.
Assume you have the address of the field bar and want to get the address of test. Do the following.
#define countof | ( | arr | ) | (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) |
Returns the size of an array (number of elements).
We use some GCC magic to make it more typesafe, if this macro is used on a pointer it will break the build instead of producing incorrect results.
#define GCC_VERSION |
#define ua_bswap32 | ( | x | ) |
#define ua_bswap64 | ( | x | ) |
#define UA_DEPRECATED __attribute((__deprecated__)) |
Macro for marking functions as deprecated.
#define UA_FORMAT_ARGUMENT | ( | fmt, | |
va | |||
) |
Marks arguments to be format specifier which allows further static checks by GCC and Clang.
fmt | index of the format string (starting from 1) |
va | index of the first variable argument (starting from 1) |
#define UA_HAVE_NONNULL_SUPPORT |
Pointer checks of arguments defined as NONNULL produce warnings.
So we do this only if the compiler does not support the nonnull attribute, otherwise we need those checks.
#define UA_NONNULL | ( | ... | ) | __attribute__((nonnull(__VA_ARGS__))) |
Mark non null parameters.
Example: my_memcpy (void *dest, const void *src, size_t len) UA_NONNULL(1, 2);
#define UA_NORETURN __attribute((noreturn)) |
Function marked with this macro might never return.
Example: my_exit() UA_NORETURN;
#define ua_offsetof offsetof |
The offsetof macro as defined in C89 and C99, but certain platforms need workarounds.
#define UA_P_TRACE_ERROR | ( | msg, | |
... | |||
) | fprintf(stderr, msg, ##__VA_ARGS__) |
Platform layer trace macro which prints to stderr.
#define UA_P_TRACE_INFO | ( | msg, | |
... | |||
) | fprintf(stdout, msg, ##__VA_ARGS__) |
Platform layer trace macro which prints to stdout.
#define UA_STATIC_ASSERT | ( | cond, | |
msg | |||
) |
A static assert macro as defined by C11.
For compilers which don't support it, this will be an empty define.
#define UA_UNUSED | ( | x | ) | (void)(x) |
Indicates to the compiler that the parameter with the specified name is not used in the body of a function.
This can be used to suppress compiler warnings while allowing functions to be defined with meaningful parameter names in their signatures.