9#define UA_OPEN62541_VER_MAJOR 1
10#define UA_OPEN62541_VER_MINOR 4
11#define UA_OPEN62541_VER_PATCH 15
12#define UA_OPEN62541_VER_LABEL "-undefined"
13#define UA_OPEN62541_VER_COMMIT "unknown-commit"
14#define UA_OPEN62541_VERSION "v1.4.15-undefined"
19#define UA_ARCHITECTURE_POSIX
22#if !defined(UA_ARCHITECTURE_WIN32) && !defined(UA_ARCHITECTURE_POSIX)
24# define UA_ARCHITECTURE_WIN32
26# define UA_ARCHITECTURE_POSIX
32#define UA_LOGLEVEL 100
33#ifndef UA_ENABLE_AMALGAMATION
36#define UA_ENABLE_METHODCALLS
37#define UA_ENABLE_NODEMANAGEMENT
38#define UA_ENABLE_SUBSCRIPTIONS
39#define UA_ENABLE_PUBSUB
42#define UA_ENABLE_PUBSUB_INFORMATIONMODEL
44#define UA_ENABLE_DIAGNOSTICS
45#define UA_ENABLE_HISTORIZING
46#define UA_ENABLE_PARSING
47#define UA_ENABLE_SUBSCRIPTIONS_EVENTS
48#define UA_ENABLE_JSON_ENCODING
58#if defined(UA_ENABLE_ENCRYPTION_MBEDTLS) || defined(UA_ENABLE_ENCRYPTION_OPENSSL) || defined(UA_ENABLE_ENCRYPTION_LIBRESSL)
59#define UA_ENABLE_ENCRYPTION
65#define UA_MULTITHREADING 100
68#define UA_ENABLE_STATUSCODE_DESCRIPTIONS
69#define UA_ENABLE_TYPEDESCRIPTION
71#define UA_ENABLE_NODESET_COMPILER_DESCRIPTIONS
73#define UA_ENABLE_DISCOVERY
77#define UA_ENABLE_DISCOVERY_SEMAPHORE
78#define UA_GENERATED_NAMESPACE_ZERO
96#if !defined(_UA_BEGIN_DECLS)
98# define _UA_BEGIN_DECLS extern "C" {
100# define _UA_BEGIN_DECLS
103#if !defined(_UA_END_DECLS)
105# define _UA_END_DECLS }
107# define _UA_END_DECLS
114# define _QNX_SOURCE 1
118#ifdef UA_ARCHITECTURE_POSIX
119# if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__)
120# define _XOPEN_SOURCE 600
122# ifndef _DEFAULT_SOURCE
123# define _DEFAULT_SOURCE
138#define UA_HAS_GETIFADDR 1
164#if defined(UA_ENABLE_INLINABLE_EXPORT) && defined(UA_INLINABLE_IMPL)
165# define UA_INLINABLE(decl, impl) decl; decl impl
166#elif defined(UA_ENABLE_INLINABLE_EXPORT)
167# define UA_INLINABLE(decl, impl) decl;
169# define UA_INLINABLE(decl, impl) static decl impl
173#if UA_MULTITHREADING >= 100
174# if defined(__GNUC__)
175# define UA_THREAD_LOCAL __thread
176# elif defined(_MSC_VER)
177# define UA_THREAD_LOCAL __declspec(thread)
180#ifndef UA_THREAD_LOCAL
181# define UA_THREAD_LOCAL
188#if UA_MULTITHREADING >= 100 && defined(_WIN32)
190# define _NO_WINSOCKAPI_
194# ifdef _NO_WINSOCKAPI_
200UA_atomic_xchg(
void *
volatile * addr,
void *newptr) {
201#if UA_MULTITHREADING >= 100 && defined(_WIN32)
202 return InterlockedExchangePointer(addr, newptr);
203#elif UA_MULTITHREADING >= 100 && defined(__GNUC__)
204 return __sync_lock_test_and_set(addr, newptr);
206# if UA_MULTITHREADING >= 100
207# warning Atomic operations not implemented
216UA_atomic_cmpxchg(
void *
volatile * addr,
void *expected,
void *newptr) {
217#if UA_MULTITHREADING >= 100 && defined(_WIN32)
218 return InterlockedCompareExchangePointer(addr, newptr, expected);
219#elif UA_MULTITHREADING >= 100 && defined(__GNUC__)
220 return __sync_val_compare_and_swap(addr, expected, newptr);
231#ifdef UA_ENABLE_MALLOC_SINGLETON
234extern UA_THREAD_LOCAL void * (*UA_callocSingleton)(
size_t nelem,
size_t elsize);
235extern UA_THREAD_LOCAL void * (*UA_reallocSingleton)(
void *ptr,
size_t size);
236# define UA_malloc(size) UA_mallocSingleton(size)
237# define UA_free(ptr) UA_freeSingleton(ptr)
238# define UA_calloc(num, size) UA_callocSingleton(num, size)
239# define UA_realloc(ptr, size) UA_reallocSingleton(ptr, size)
243# define UA_malloc malloc
244# define UA_calloc calloc
245# define UA_realloc realloc
252# if defined(__GNUC__) || defined(__clang__)
253# define UA_STACKARRAY(TYPE, NAME, SIZE) TYPE NAME[SIZE]
255# if defined(__GNUC__) || defined(__clang__)
256# define UA_alloca(size) __builtin_alloca (size)
257# elif defined(_WIN32)
258# define UA_alloca(SIZE) _alloca(SIZE)
261# define UA_alloca(SIZE) alloca(SIZE)
263# define UA_STACKARRAY(TYPE, NAME, SIZE) \
265 TYPE *(NAME) = (TYPE*)UA_alloca(sizeof(TYPE) * (SIZE))
272# define UA_assert(ignore) assert(ignore)
274# define UA_assert(ignore) do {} while(0)
281#if defined(__cplusplus) && __cplusplus >= 201103L
282# define UA_STATIC_ASSERT(cond,msg) static_assert(cond, #msg)
283#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
284# define UA_STATIC_ASSERT(cond,msg) _Static_assert(cond, #msg)
285#elif defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)
286# define UA_CTASTR2(pre,post) pre ## post
287# define UA_CTASTR(pre,post) UA_CTASTR2(pre,post)
289# define __COUNTER__ __LINE__
291# define UA_STATIC_ASSERT(cond,msg) \
293 unsigned int UA_CTASTR(static_assertion_failed_,msg) : !!(cond); \
294 } UA_CTASTR(static_assertion_failed_,__COUNTER__)
296# define UA_STATIC_ASSERT(cond,msg) typedef char static_assertion_##msg[(cond)?1:-1]
301#if UA_MULTITHREADING < 100
303# define UA_LOCK_INIT(lock)
304# define UA_LOCK_DESTROY(lock)
305# define UA_LOCK(lock)
306# define UA_UNLOCK(lock)
307# define UA_LOCK_ASSERT(lock, num)
309#elif defined(UA_ARCHITECTURE_WIN32)
313 CRITICAL_SECTION mutex;
319 InitializeCriticalSection(&lock->
mutex);
324UA_LOCK_DESTROY(
UA_Lock *lock) {
325 DeleteCriticalSection(&lock->
mutex);
330 EnterCriticalSection(&lock->
mutex);
337 LeaveCriticalSection(&lock->
mutex);
341UA_LOCK_ASSERT(
UA_Lock *lock,
int num) {
342 UA_assert(num <= 0 || lock->mutexCounter > 0);
345#elif defined(UA_ARCHITECTURE_POSIX)
356 pthread_mutexattr_t mattr;
357 pthread_mutexattr_init(&mattr);
358 pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
359 pthread_mutex_init(&lock->
mutex, &mattr);
360 pthread_mutexattr_destroy(&mattr);
365UA_LOCK_DESTROY(
UA_Lock *lock) {
366 pthread_mutex_destroy(&lock->
mutex);
371 pthread_mutex_lock(&lock->
mutex);
378 pthread_mutex_unlock(&lock->
mutex);
382UA_LOCK_ASSERT(
UA_Lock *lock,
int num) {
383 UA_assert(num <= 0 || lock->mutexCounter > 0);
389#if defined(_WIN32) && defined(UA_DYNAMIC_LINKING)
390# ifdef UA_DYNAMIC_LINKING_EXPORT
392# define __attribute__ ((dllexport))
394# define __declspec(dllexport)
398# define __attribute__ ((dllimport))
400# define __declspec(dllimport)
404# if __GNUC__ || __clang__
405# define __attribute__ ((visibility ("default")))
418#elif defined(__GNUC__)
420#elif defined(__CODEGEARC__)
427#if defined(__GNUC__) || defined(__clang__)
428# define UA_LIKELY(x) __builtin_expect((x), 1)
429# define UA_UNLIKELY(x) __builtin_expect((x), 0)
431# define UA_LIKELY(x) x
432# define UA_UNLIKELY(x) x
436#if defined(__GNUC__) || defined(__clang__)
437# define __attribute__((malloc))
438# define UA_FUNC_ATTR_PURE __attribute__ ((pure))
439# define UA_FUNC_ATTR_CONST __attribute__((const))
440# define __attribute__((warn_unused_result))
441# define UA_FORMAT(X,Y) __attribute__ ((format (printf, X, Y)))
442#elif defined(_MSC_VER) && _MSC_VER >= 1800
445# define UA_FUNC_ATTR_PURE
446# define UA_FUNC_ATTR_CONST
447# define _Check_return_
448# define UA_FORMAT(X,Y)
451# define UA_FUNC_ATTR_PURE
452# define UA_FUNC_ATTR_CONST
454# define UA_FORMAT(X,Y)
457#if defined(__GNUC__) || defined(__clang__)
458# define UA_DEPRECATED __attribute__((deprecated))
459#elif defined(_MSC_VER)
460# define UA_DEPRECATED __declspec(deprecated)
462# define UA_DEPRECATED
467#if defined(UA_INTERNAL) && (defined(__GNUC__) || defined(__clang__))
468# define UA_INTERNAL_DEPRECATED \
469 _Pragma ("GCC warning \"Macro is deprecated for internal use\"")
471# define UA_INTERNAL_DEPRECATED
474#if defined(UA_INTERNAL) && (defined(__GNUC__) || defined(__clang__))
475# define UA_INTERNAL_FUNC_ATTR_WARN_UNUSED_RESULT \
476 __attribute__((warn_unused_result))
478# define UA_INTERNAL_FUNC_ATTR_WARN_UNUSED_RESULT
483# define UA_LITTLE_ENDIAN 1
484#elif defined(__i386__) || defined(__x86_64__) || defined(__amd64__)
485# define UA_LITTLE_ENDIAN 1
486#elif (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
487 (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
488# define UA_LITTLE_ENDIAN 1
489#elif defined(__linux__)
491# if __BYTE_ORDER == __LITTLE_ENDIAN
492# define UA_LITTLE_ENDIAN 1
494#elif defined(__OpenBSD__)
495# include <sys/endian.h>
496# if BYTE_ORDER == LITTLE_ENDIAN
497# define UA_LITTLE_ENDIAN 1
499#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
500# include <sys/endian.h>
501# if _BYTE_ORDER == _LITTLE_ENDIAN
502# define UA_LITTLE_ENDIAN 1
504#elif defined(__APPLE__)
505# include <libkern/OSByteOrder.h>
506# if defined(__LITTLE_ENDIAN__)
507# define UA_LITTLE_ENDIAN 1
509#elif defined(__QNX__) || defined(__QNXNTO__)
510# include <gulliver.h>
511# if defined(__LITTLEENDIAN__)
512# define UA_LITTLE_ENDIAN 1
514#elif defined(_OS9000)
515# if defined(_LIL_END)
516# define UA_LITTLE_ENDIAN 1
519#ifndef UA_LITTLE_ENDIAN
520# define UA_LITTLE_ENDIAN 0
526#if (UA_LITTLE_ENDIAN == 1)
527UA_STATIC_ASSERT(
sizeof(
bool) == 1, cannot_overlay_integers_with_large_bool);
528# define UA_BINARY_OVERLAYABLE_INTEGER 1
530# define UA_BINARY_OVERLAYABLE_INTEGER 0
535#ifndef UA_FLOAT_IEEE754
537# define UA_FLOAT_IEEE754 1
538#elif defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || \
539 defined(__ia64__) || defined(__powerpc__) || defined(__sparc__) || \
541# define UA_FLOAT_IEEE754 1
542#elif defined(__STDC_IEC_559__)
543# define UA_FLOAT_IEEE754 1
544#elif defined(ESP_PLATFORM)
545# define UA_FLOAT_IEEE754 1
547# define UA_FLOAT_IEEE754 0
557# define UA_FLOAT_LITTLE_ENDIAN 1
558#elif defined(__i386__) || defined(__x86_64__) || defined(__amd64__)
559# define UA_FLOAT_LITTLE_ENDIAN 1
560#elif defined(__FLOAT_WORD_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
561 (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)
562# define UA_FLOAT_LITTLE_ENDIAN 1
563#elif defined(__FLOAT_WORD_ORDER) && defined(__LITTLE_ENDIAN) && \
564 (__FLOAT_WORD_ORDER == __LITTLE_ENDIAN)
565# define UA_FLOAT_LITTLE_ENDIAN 1
567#ifndef UA_FLOAT_LITTLE_ENDIAN
568# define UA_FLOAT_LITTLE_ENDIAN 0
573#if (UA_FLOAT_IEEE754 == 1) && (UA_FLOAT_LITTLE_ENDIAN == 1)
574# define UA_BINARY_OVERLAYABLE_FLOAT 1
576# define UA_BINARY_OVERLAYABLE_FLOAT 0
#define UA_assert(ignore)
#define UA_STATIC_ASSERT(cond, msg)
Outputs an error message at compile time if the assert fails.