27#define UA_TRUE true UA_INTERNAL_DEPRECATED
28#define UA_FALSE false UA_INTERNAL_DEPRECATED
32#define UA_SBYTE_MIN (-128)
33#define UA_SBYTE_MAX 127
38#define UA_BYTE_MAX 255
42#define UA_INT16_MIN (-32768)
43#define UA_INT16_MAX 32767
47#define UA_UINT16_MIN 0
48#define UA_UINT16_MAX 65535
52#define UA_INT32_MIN (-2147483648)
53#define UA_INT32_MAX 2147483647
57#define UA_UINT32_MIN 0
58#define UA_UINT32_MAX 4294967295
62#define UA_INT64_MAX (int64_t)9223372036854775807LL
63#define UA_INT64_MIN ((int64_t)-UA_INT64_MAX-1LL)
67#define UA_UINT64_MIN (uint64_t)0
68#define UA_UINT64_MAX (uint64_t)18446744073709551615ULL
91 return ((code >> 30) >= 0x02);
96 return ((code >> 30) == 0x01);
101 return ((code >> 30) == 0x00);
110 return ((s1 & 0xFFFF0000) == (s2 & 0xFFFF0000));
130UA_STRING(
char *chars) {
137#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
140#define UA_STRING_STATIC(CHARS) {sizeof(CHARS)-1, (UA_Byte*)CHARS}
147#define UA_DATETIME_USEC 10LL
148#define UA_DATETIME_MSEC (UA_DATETIME_USEC * 1000LL)
149#define UA_DATETIME_SEC (UA_DATETIME_MSEC * 1000LL)
183#define UA_DATETIME_UNIX_EPOCH (11644473600LL * UA_DATETIME_SEC)
191UA_DateTime_fromUnixTime(
UA_Int64 unixDate) {
207#ifdef UA_ENABLE_PARSING
216UA_GUID(
const char *chars) {
218 UA_Guid_parse(&guid, UA_STRING((
char*)(uintptr_t)chars));
245UA_BYTESTRING(
char *chars) {
253UA_BYTESTRING_ALLOC(
const char *chars) {
268 const UA_Byte *data,
size_t size);
311#ifdef UA_ENABLE_PARSING
319UA_NODEID(
const char *chars) {
321 UA_NodeId_parse(&
id, UA_STRING((
char*)(uintptr_t)chars));
331 id.identifier.numeric = identifier;
return id;
335UA_NODEID_STRING(
UA_UInt16 nsIndex,
char *chars) {
338 id.identifier.string = UA_STRING(chars);
return id;
342UA_NODEID_STRING_ALLOC(
UA_UInt16 nsIndex,
const char *chars) {
352 id.identifier.guid = guid;
return id;
356UA_NODEID_BYTESTRING(
UA_UInt16 nsIndex,
char *chars) {
359 id.identifier.byteString = UA_BYTESTRING(chars);
return id;
363UA_NODEID_BYTESTRING_ALLOC(
UA_UInt16 nsIndex,
const char *chars) {
366 id.identifier.byteString = UA_BYTESTRING_ALLOC(chars);
return id;
394#ifdef UA_ENABLE_PARSING
407UA_EXPANDEDNODEID(
const char *chars) {
409 UA_ExpandedNodeId_parse(&
id, UA_STRING((
char*)(uintptr_t)chars));
422UA_EXPANDEDNODEID_STRING(
UA_UInt16 nsIndex,
char *chars) {
428UA_EXPANDEDNODEID_STRING_ALLOC(
UA_UInt16 nsIndex,
const char *chars) {
440UA_EXPANDEDNODEID_BYTESTRING(
UA_UInt16 nsIndex,
char *chars) {
446UA_EXPANDEDNODEID_BYTESTRING_ALLOC(
UA_UInt16 nsIndex,
const char *chars) {
452UA_EXPANDEDNODEID_NODEID(
UA_NodeId nodeId) {
495UA_QUALIFIEDNAME(
UA_UInt16 nsIndex,
char *chars) {
497 qn.
name = UA_STRING(chars);
return qn;
501UA_QUALIFIEDNAME_ALLOC(
UA_UInt16 nsIndex,
const char *chars) {
517UA_LOCALIZEDTEXT(
char *locale,
char *text) {
519 lt.
text = UA_STRING(text);
return lt;
523UA_LOCALIZEDTEXT_ALLOC(
const char *locale,
const char *text) {
543UA_NUMERICRANGE(
const char *s) {
553#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
578 return v->
type == NULL;
598 return UA_Variant_isScalar(v) && type == v->
type;
608 return (!UA_Variant_isScalar(v)) && type == v->
type;
787#ifdef UA_ENABLE_TYPEDESCRIPTION
788 const char *memberName;
805#define UA_DATATYPEKINDS 31
841#ifdef UA_ENABLE_TYPEDESCRIPTION
842 const char *typeName;
870#ifdef UA_ENABLE_TYPEDESCRIPTION
872UA_DataType_getStructMember(
const UA_DataType *type,
873 const char *memberName,
935#define UA_deleteMembers(p, type) UA_clear(p, type)
949#ifdef UA_ENABLE_TYPEDESCRIPTION
1008#ifdef UA_ENABLE_JSON_ENCODING
1012 size_t namespacesSize;
1014 size_t serverUrisSize;
1016} UA_EncodeJsonOptions;
1021UA_calcSizeJson(
const void *src,
const UA_DataType *type,
1022 const UA_EncodeJsonOptions *options);
1033 const UA_EncodeJsonOptions *options);
1040 size_t namespacesSize;
1042 size_t serverUrisSize;
1045} UA_DecodeJsonOptions;
1059 const UA_DecodeJsonOptions *options);
1146#ifdef UA_ENABLE_TYPEDESCRIPTION
1147# define UA_TYPENAME(name) name,
1149# define UA_TYPENAME(name)
#define _UA_BEGIN_DECLS
#undef UA_DEBUG_DUMP_PKGS
Datatype arrays with custom type definitions can be added in a linked list to the client or server co...
const UA_DataType * types
const struct UA_DataTypeArray * next
const UA_DataType * memberType
UA_DataTypeMember * members
UA_NodeId binaryEncodingId
UA_Boolean hasSourcePicoseconds
UA_Boolean hasServerTimestamp
UA_UInt16 serverPicoseconds
UA_DateTime serverTimestamp
UA_UInt16 sourcePicoseconds
UA_DateTime sourceTimestamp
UA_Boolean hasSourceTimestamp
UA_Boolean hasServerPicoseconds
Represents a Datetime as a structure.
The structure with the decoding options may be extended in the future.
const UA_DataTypeArray * customTypes
UA_Boolean hasNamespaceUri
UA_Boolean hasInnerDiagnosticInfo
struct UA_DiagnosticInfo * innerDiagnosticInfo
UA_Boolean hasLocalizedText
UA_Boolean hasInnerStatusCode
UA_StatusCode innerStatusCode
UA_Boolean hasAdditionalInfo
UA_ExtensionObjectEncoding encoding
enum UA_NodeIdType identifierType
UA_NumericRangeDimension * dimensions
UA_VariantStorageType storageType
UA_UInt32 * arrayDimensions
size_t arrayDimensionsSize
UA_EXPORT size_t UA_calcSizeBinary(const void *p, const UA_DataType *type)
Returns the number of bytes the value p takes in binary encoding.
@ UA_NODEIDTYPE_BYTESTRING
void UA_ExtensionObject_setValue(UA_ExtensionObject *eo, void *p, const UA_DataType *type)
Initialize the ExtensionObject and set the "decoded" value to the given pointer.
void UA_Array_delete(void *p, size_t size, const UA_DataType *type)
Deletes an array.
UA_StatusCode UA_copy(const void *src, void *dst, const UA_DataType *type)
Copies the content of two variables.
_UA_BEGIN_DECLS typedef bool UA_Boolean
This Source Code Form is subject to the terms of the Mozilla Public License, v.
UA_StatusCode UA_Variant_setRange(UA_Variant *v, void *array, size_t arraySize, const UA_NumericRange range)
Insert a range of data into an existing variant.
struct UA_DataTypeArray UA_DataTypeArray
Datatype arrays with custom type definitions can be added in a linked list to the client or server co...
UA_UInt32 UA_NodeId_hash(const UA_NodeId *n)
Returns a non-cryptographic hash for NodeId.
UA_StatusCode UA_ExtensionObject_setValueCopy(UA_ExtensionObject *eo, void *p, const UA_DataType *type)
Initialize the ExtensionObject and set the "decoded" value to a fresh copy of the given value pointer...
UA_ExtensionObjectEncoding
@ UA_EXTENSIONOBJECT_ENCODED_XML
@ UA_EXTENSIONOBJECT_ENCODED_BYTESTRING
@ UA_EXTENSIONOBJECT_ENCODED_NOBODY
@ UA_EXTENSIONOBJECT_DECODED
@ UA_EXTENSIONOBJECT_DECODED_NODELETE
UA_Boolean UA_String_equal(const UA_String *s1, const UA_String *s2)
UA_EXPORT const UA_Guid UA_GUID_NULL
UA_StatusCode UA_ExpandedNodeId_print(const UA_ExpandedNodeId *id, UA_String *output)
#define UA_EMPTY_ARRAY_SENTINEL
UA_Guid UA_Guid_random(void)
UA_StatusCode UA_Array_resize(void **p, size_t *size, size_t newSize, const UA_DataType *type)
Resizes (and reallocates) an array.
UA_UInt32 UA_UInt32_random(void)
UA_StatusCode UA_Variant_setRangeCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_NumericRange range)
Deep-copy a range of data into an existing variant.
UA_UInt32 UA_ExpandedNodeId_hash(const UA_ExpandedNodeId *n)
Returns a non-cryptographic hash for ExpandedNodeId.
UA_EXPORT const UA_NodeId UA_NODEID_NULL
UA_Order UA_NodeId_order(const UA_NodeId *n1, const UA_NodeId *n2)
Total ordering of NodeId.
UA_DateTime UA_DateTime_fromStruct(UA_DateTimeStruct ts)
struct UA_DateTimeStruct UA_DateTimeStruct
Represents a Datetime as a structure.
#define UA_DATETIME_UNIX_EPOCH
The C99 standard (7.23.1) says: "The range and precision of times representable in clock_t and time_t...
UA_DateTimeStruct UA_DateTime_toStruct(UA_DateTime t)
UA_Order UA_order(const void *p1, const void *p2, const UA_DataType *type)
Pretty-print the value from the datatype.
UA_StatusCode UA_ByteString_fromBase64(UA_ByteString *bs, const UA_String *input)
Parse a ByteString from a base64 representation.
UA_Int16 UA_DataType_getPrecedence(const UA_DataType *type)
Return the Data Type Precedence-Rank defined in Part 4.
UA_Boolean UA_NodeId_isNull(const UA_NodeId *p)
UA_StatusCode UA_NodeId_print(const UA_NodeId *id, UA_String *output)
Print the NodeId in the human-readable format defined in Part 6, 5.3.1.10.
void UA_ExtensionObject_setValueNoDelete(UA_ExtensionObject *eo, void *p, const UA_DataType *type)
Initialize the ExtensionObject and set the "decoded" value to the given pointer.
UA_StatusCode UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length)
Allocates memory of size length for the bytestring.
void UA_Variant_setArray(UA_Variant *v, void *array, size_t arraySize, const UA_DataType *type)
Set the variant to an array that already resides in memory.
void UA_random_seed(UA_UInt64 seed)
UA_EXPORT const char * UA_StatusCode_name(UA_StatusCode code)
Returns the human-readable name of the StatusCode.
@ UA_DATATYPEKIND_STATUSCODE
@ UA_DATATYPEKIND_BOOLEAN
@ UA_DATATYPEKIND_EXPANDEDNODEID
@ UA_DATATYPEKIND_DATETIME
@ UA_DATATYPEKIND_QUALIFIEDNAME
@ UA_DATATYPEKIND_VARIANT
@ UA_DATATYPEKIND_DATAVALUE
@ UA_DATATYPEKIND_OPTSTRUCT
@ UA_DATATYPEKIND_LOCALIZEDTEXT
@ UA_DATATYPEKIND_XMLELEMENT
@ UA_DATATYPEKIND_DECIMAL
@ UA_DATATYPEKIND_STRUCTURE
@ UA_DATATYPEKIND_BYTESTRING
@ UA_DATATYPEKIND_BITFIELDCLUSTER
@ UA_DATATYPEKIND_DIAGNOSTICINFO
@ UA_DATATYPEKIND_EXTENSIONOBJECT
UA_StatusCode UA_ByteString_toBase64(const UA_ByteString *bs, UA_String *output)
Converts a ByteString to the corresponding base64 representation.
UA_Boolean UA_ExpandedNodeId_isLocal(const UA_ExpandedNodeId *n)
Does the ExpandedNodeId point to a local node? That is, are namespaceUri and serverIndex empty?
UA_UInt32 UA_QualifiedName_hash(const UA_QualifiedName *q)
Returns a non-cryptographic hash for QualifiedName.
UA_Boolean UA_QualifiedName_equal(const UA_QualifiedName *qn1, const UA_QualifiedName *qn2)
UA_StatusCode UA_Array_appendCopy(void **p, size_t *size, const void *newElem, const UA_DataType *type)
Append a copy of the given element at the end of the array.
void * UA_new(const UA_DataType *type)
Allocates and initializes a variable of type dataType.
struct UA_DiagnosticInfo UA_DiagnosticInfo
UA_EXPORT const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL
@ UA_VARIANT_DATA_NODELETE
void UA_Variant_setScalar(UA_Variant *v, void *p, const UA_DataType *type)
Set the variant to a scalar value that already resides in memory.
UA_StatusCode UA_NumericRange_parse(UA_NumericRange *range, const UA_String str)
UA_StatusCode UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type)
Set the variant to a scalar value that is copied from an existing variable.
void * UA_Array_new(size_t size, const UA_DataType *type)
Allocates and initializes an array of variables of a specific type.
void UA_clear(void *p, const UA_DataType *type)
Deletes the dynamically allocated content of a variable (e.g.
UA_EXPORT UA_StatusCode UA_decodeBinary(const UA_ByteString *inBuf, void *p, const UA_DataType *type, const UA_DecodeBinaryOptions *options)
Decodes a data structure from the input buffer in the binary format.
UA_Boolean UA_DataType_isNumeric(const UA_DataType *type)
Returns the offset and type of a structure member.
UA_StatusCode UA_DataValue_copyVariantRange(const UA_DataValue *src, UA_DataValue *dst, const UA_NumericRange range)
Copy the DataValue, but use only a subset of the (multidimensional) array of of the variant of the so...
UA_UInt32 UA_ByteString_hash(UA_UInt32 initialHashValue, const UA_Byte *data, size_t size)
Returns a non-cryptographic hash of a bytestring.
void UA_delete(void *p, const UA_DataType *type)
Frees a variable and all of its content.
UA_StatusCode UA_Array_append(void **p, size_t *size, void *newElem, const UA_DataType *type)
Append the given element at the end of the array.
#define UA_STRING_ALLOC(CHARS)
UA_Order UA_ExpandedNodeId_order(const UA_ExpandedNodeId *n1, const UA_ExpandedNodeId *n2)
Total ordering of ExpandedNodeId.
UA_EXPORT UA_StatusCode UA_encodeBinary(const void *p, const UA_DataType *type, UA_ByteString *outBuf)
Encodes a data-structure in the binary format.
UA_EXPORT const UA_String UA_STRING_NULL
UA_DateTime UA_DateTime_nowMonotonic(void)
CPU clock invariant to system time changes.
UA_DateTime UA_DateTime_now(void)
The current time in UTC time.
UA_String UA_String_fromChars(const char *src)
Copies the content on the heap.
UA_Boolean UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2)
UA_StatusCode UA_Variant_setArrayCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_DataType *type)
Set the variant to an array that is copied from an existing array.
const UA_DataType * UA_findDataType(const UA_NodeId *typeId)
Returns the data type description for the type's identifier or NULL if no matching data type was foun...
UA_StatusCode UA_Array_copy(const void *src, size_t size, void **dst, const UA_DataType *type)
Allocates and copies an array.
UA_Int64 UA_DateTime_localTimeUtcOffset(void)
Offset between local time and UTC time.
UA_EXPORT const UA_ByteString UA_BYTESTRING_NULL
UA_StatusCode UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, const UA_NumericRange range)
Copy the variant, but use only a subset of the (multidimensional) array into a variant.