|
open62541 1.4.15
Open source implementation of OPC UA
|
#include <open62541/config.h>#include <open62541/common.h>#include <open62541/statuscodes.h>#include <open62541/types_generated.h>#include <open62541/types_generated_handling.h>Go to the source code of this file.
Data Structures | |
| struct | UA_String |
| struct | UA_DateTimeStruct |
| struct | UA_Guid |
| struct | UA_NodeId |
| struct | UA_ExpandedNodeId |
| struct | UA_QualifiedName |
| struct | UA_LocalizedText |
| struct | UA_NumericRangeDimension |
| struct | UA_NumericRange |
| struct | UA_Variant |
| struct | UA_ExtensionObject |
| struct | UA_DataValue |
| struct | UA_DiagnosticInfo |
| struct | UA_DataTypeMember |
| struct | UA_DataType |
| struct | UA_DataTypeArray |
| struct | UA_DecodeBinaryOptions |
Macros | |
| #define | UA_TRUE true UA_INTERNAL_DEPRECATED |
| #define | UA_FALSE false UA_INTERNAL_DEPRECATED |
| #define | UA_SBYTE_MIN (-128) |
| #define | UA_SBYTE_MAX 127 |
| #define | UA_BYTE_MIN 0 |
| #define | UA_BYTE_MAX 255 |
| #define | UA_INT16_MIN (-32768) |
| #define | UA_INT16_MAX 32767 |
| #define | UA_UINT16_MIN 0 |
| #define | UA_UINT16_MAX 65535 |
| #define | UA_INT32_MIN ((int32_t)-2147483648LL) |
| #define | UA_INT32_MAX 2147483647L |
| #define | UA_UINT32_MIN 0 |
| #define | UA_UINT32_MAX 4294967295UL |
| #define | UA_INT64_MAX (int64_t)9223372036854775807LL |
| #define | UA_INT64_MIN ((int64_t)-UA_INT64_MAX-1LL) |
| #define | UA_UINT64_MIN 0 |
| #define | UA_UINT64_MAX (uint64_t)18446744073709551615ULL |
| #define | UA_FLOAT_MIN FLT_MIN |
| #define | UA_FLOAT_MAX FLT_MAX |
| #define | UA_DOUBLE_MIN DBL_MIN |
| #define | UA_DOUBLE_MAX DBL_MAX |
| #define | UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS) |
| #define | UA_STRING_STATIC(CHARS) {sizeof(CHARS)-1, (UA_Byte*)CHARS} |
| #define | UA_DATETIME_USEC 10LL |
| #define | UA_DATETIME_MSEC (UA_DATETIME_USEC * 1000LL) |
| #define | UA_DATETIME_SEC (UA_DATETIME_MSEC * 1000LL) |
| #define | UA_DATETIME_UNIX_EPOCH (11644473600LL * UA_DATETIME_SEC) |
| #define | UA_BYTESTRING(chars) UA_STRING(chars) |
| #define | UA_BYTESTRING_ALLOC(chars) UA_STRING_ALLOC(chars) |
| #define | UA_EMPTY_ARRAY_SENTINEL ((void*)0x01) |
| #define | UA_DATATYPEKINDS 31 |
| #define | UA_deleteMembers(p, type) UA_clear(p, type) |
| #define | UA_TYPENAME(name) name, |
Typedefs | |
| typedef int8_t | UA_SByte |
| typedef uint8_t | UA_Byte |
| typedef int16_t | UA_Int16 |
| typedef uint16_t | UA_UInt16 |
| typedef int32_t | UA_Int32 |
| typedef uint32_t | UA_UInt32 |
| typedef int64_t | UA_Int64 |
| typedef uint64_t | UA_UInt64 |
| typedef float | UA_Float |
| typedef double | UA_Double |
| typedef uint32_t | UA_StatusCode |
| typedef struct UA_DateTimeStruct | UA_DateTimeStruct |
| typedef UA_String | UA_ByteString |
| typedef UA_String | UA_XmlElement |
| typedef struct UA_DataType | UA_DataType |
| typedef struct UA_DiagnosticInfo | UA_DiagnosticInfo |
| typedef struct UA_DataTypeArray | UA_DataTypeArray |
Enumerations | |
| enum | UA_NodeIdType |
| enum | UA_VariantStorageType |
| enum | UA_ExtensionObjectEncoding |
| enum | UA_DataTypeKind |
Functions | |
| UA_EXPORT const char * | UA_StatusCode_name (UA_StatusCode code) |
| UA_INLINABLE (UA_Boolean UA_StatusCode_isBad(UA_StatusCode code), { return((code > > 30) >=0x02);}) UA_INLINABLE(UA_Boolean UA_StatusCode_isUncertain(UA_StatusCode code) | |
| UA_INLINABLE (UA_Boolean UA_StatusCode_isGood(UA_StatusCode code), { return((code > > 30)==0x00);}) UA_INLINABLE(UA_Boolean UA_StatusCode_isEqualTop(UA_StatusCode s1 | |
| UA_String | UA_String_fromChars (const char *src) |
| UA_Boolean | UA_String_isEmpty (const UA_String *s) |
| UA_INLINABLE (UA_String UA_STRING(char *chars), { UA_String s;memset(&s, 0, sizeof(s));if(!chars) return s;s.length=strlen(chars);s.data=(UA_Byte *) chars;return s;}) typedef int64_t UA_DateTime | |
| UA_DateTime | UA_DateTime_now (void) |
| UA_Int64 | UA_DateTime_localTimeUtcOffset (void) |
| UA_DateTime | UA_DateTime_nowMonotonic (void) |
| UA_DateTimeStruct | UA_DateTime_toStruct (UA_DateTime t) |
| UA_DateTime | UA_DateTime_fromStruct (UA_DateTimeStruct ts) |
| UA_INLINABLE (UA_Int64 UA_DateTime_toUnixTime(UA_DateTime date), { return(date -(11644473600LL *((10LL *1000LL) *1000LL)))/((10LL *1000LL) *1000LL) ;}) UA_INLINABLE(UA_DateTime UA_DateTime_fromUnixTime(UA_Int64 unixDate) | |
| UA_StatusCode | UA_Guid_print (const UA_Guid *guid, UA_String *output) |
| UA_StatusCode | UA_ByteString_allocBuffer (UA_ByteString *bs, size_t length) |
| UA_StatusCode | UA_ByteString_toBase64 (const UA_ByteString *bs, UA_String *output) |
| UA_StatusCode | UA_ByteString_fromBase64 (UA_ByteString *bs, const UA_String *input) |
| UA_UInt32 | UA_ByteString_hash (UA_UInt32 initialHashValue, const UA_Byte *data, size_t size) |
| UA_Boolean | UA_NodeId_isNull (const UA_NodeId *p) |
| UA_StatusCode | UA_NodeId_print (const UA_NodeId *id, UA_String *output) |
| UA_INLINABLE (UA_NodeId UA_NODEID_NUMERIC(UA_UInt16 nsIndex, UA_UInt32 identifier), { UA_NodeId id;memset(&id, 0, sizeof(UA_NodeId));id.namespaceIndex=nsIndex;id.identifierType=UA_NODEIDTYPE_NUMERIC;id.identifier.numeric=identifier;return id;}) UA_INLINABLE(UA_NodeId UA_NODEID_STRING(UA_UInt16 nsIndex | |
| char memset & | id (UA_NodeId) |
| UA_INLINABLE (UA_NodeId UA_NODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars), { UA_NodeId id;memset(&id, 0, sizeof(UA_NodeId));id.namespaceIndex=nsIndex;id.identifierType=UA_NODEIDTYPE_STRING;id.identifier.string=UA_String_fromChars(chars);return id;}) UA_INLINABLE(UA_NodeId UA_NODEID_GUID(UA_UInt16 nsIndex | |
| UA_INLINABLE (UA_NodeId UA_NODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars), { UA_NodeId id;memset(&id, 0, sizeof(UA_NodeId));id.namespaceIndex=nsIndex;id.identifierType=UA_NODEIDTYPE_BYTESTRING;id.identifier.byteString=UA_STRING(chars);return id;}) UA_INLINABLE(UA_NodeId UA_NODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex | |
| UA_Order | UA_NodeId_order (const UA_NodeId *n1, const UA_NodeId *n2) |
| UA_UInt32 | UA_NodeId_hash (const UA_NodeId *n) |
| UA_StatusCode | UA_ExpandedNodeId_print (const UA_ExpandedNodeId *id, UA_String *output) |
| UA_INLINABLE (UA_ExpandedNodeId UA_EXPANDEDNODEID_NUMERIC(UA_UInt16 nsIndex, UA_UInt32 identifier), { UA_ExpandedNodeId id;id.nodeId=UA_NODEID_NUMERIC(nsIndex, identifier);id.serverIndex=0;id.namespaceUri=UA_STRING_NULL;return id;}) UA_INLINABLE(UA_ExpandedNodeId UA_EXPANDEDNODEID_STRING(UA_UInt16 nsIndex | |
| UA_INLINABLE (UA_ExpandedNodeId UA_EXPANDEDNODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars), { UA_ExpandedNodeId id;id.nodeId=UA_NODEID_STRING_ALLOC(nsIndex, chars);id.serverIndex=0;id.namespaceUri=UA_STRING_NULL;return id;}) UA_INLINABLE(UA_ExpandedNodeId UA_EXPANDEDNODEID_STRING_GUID(UA_UInt16 nsIndex | |
| UA_INLINABLE (UA_ExpandedNodeId UA_EXPANDEDNODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars), { UA_ExpandedNodeId id;id.nodeId=UA_NODEID_BYTESTRING(nsIndex, chars);id.serverIndex=0;id.namespaceUri=UA_STRING_NULL;return id;}) UA_INLINABLE(UA_ExpandedNodeId UA_EXPANDEDNODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex | |
| UA_INLINABLE (UA_ExpandedNodeId UA_EXPANDEDNODEID_NODEID(UA_NodeId nodeId), { UA_ExpandedNodeId id;memset(&id, 0, sizeof(UA_ExpandedNodeId));id.nodeId=nodeId;return id;}) UA_Boolean UA_ExpandedNodeId_isLocal(const UA_ExpandedNodeId *n) | |
| UA_Order | UA_ExpandedNodeId_order (const UA_ExpandedNodeId *n1, const UA_ExpandedNodeId *n2) |
| UA_UInt32 | UA_ExpandedNodeId_hash (const UA_ExpandedNodeId *n) |
| UA_INLINABLE (UA_Boolean UA_QualifiedName_isNull(const UA_QualifiedName *q), { return(q->namespaceIndex==0 &&q->name.length==0);}) UA_UInt32 UA_QualifiedName_hash(const UA_QualifiedName *q) | |
| UA_INLINABLE (UA_QualifiedName UA_QUALIFIEDNAME(UA_UInt16 nsIndex, char *chars), { UA_QualifiedName qn;qn.namespaceIndex=nsIndex;qn.name=UA_STRING(chars);return qn;}) UA_INLINABLE(UA_QualifiedName UA_QUALIFIEDNAME_ALLOC(UA_UInt16 nsIndex | |
| UA_INLINABLE (UA_LocalizedText UA_LOCALIZEDTEXT(char *locale, char *text), { UA_LocalizedText lt;lt.locale=UA_STRING(locale);lt.text=UA_STRING(text);return lt;}) UA_INLINABLE(UA_LocalizedText UA_LOCALIZEDTEXT_ALLOC(const char *locale | |
| UA_StatusCode | UA_NumericRange_parse (UA_NumericRange *range, const UA_String str) |
| UA_INLINABLE (UA_NumericRange UA_NUMERICRANGE(const char *s), { UA_NumericRange nr;memset(&nr, 0, sizeof(nr));UA_NumericRange_parse(&nr, UA_STRING((char *)(uintptr_t) s));return nr;}) struct UA_DataType | |
| UA_INLINABLE (UA_Boolean UA_Variant_isEmpty(const UA_Variant *v), { return v->type==NULL;}) UA_INLINABLE(UA_Boolean UA_Variant_isScalar(const UA_Variant *v) | |
| UA_INLINABLE (UA_Boolean UA_Variant_hasScalarType(const UA_Variant *v, const UA_DataType *type), { return UA_Variant_isScalar(v) &&type==v->type;}) UA_INLINABLE(UA_Boolean UA_Variant_hasArrayType(const UA_Variant *v | |
| const UA_DataType void | UA_Variant_setScalar (UA_Variant *v, void *p, const UA_DataType *type) |
| UA_StatusCode | UA_Variant_setScalarCopy (UA_Variant *v, const void *p, const UA_DataType *type) |
| void | UA_Variant_setArray (UA_Variant *v, void *array, size_t arraySize, const UA_DataType *type) |
| UA_StatusCode | UA_Variant_setArrayCopy (UA_Variant *v, const void *array, size_t arraySize, const UA_DataType *type) |
| UA_StatusCode | UA_Variant_copyRange (const UA_Variant *src, UA_Variant *dst, const UA_NumericRange range) |
| UA_StatusCode | UA_Variant_setRange (UA_Variant *v, void *array, size_t arraySize, const UA_NumericRange range) |
| UA_StatusCode | UA_Variant_setRangeCopy (UA_Variant *v, const void *array, size_t arraySize, const UA_NumericRange range) |
| void | UA_ExtensionObject_setValue (UA_ExtensionObject *eo, void *p, const UA_DataType *type) |
| void | UA_ExtensionObject_setValueNoDelete (UA_ExtensionObject *eo, void *p, const UA_DataType *type) |
| UA_StatusCode | UA_ExtensionObject_setValueCopy (UA_ExtensionObject *eo, void *p, const UA_DataType *type) |
| UA_StatusCode | UA_DataValue_copyVariantRange (const UA_DataValue *src, UA_DataValue *dst, const UA_NumericRange range) |
| UA_Boolean | UA_DataType_getStructMember (const UA_DataType *type, const char *memberName, size_t *outOffset, const UA_DataType **outMemberType, UA_Boolean *outIsArray) |
| UA_Boolean | UA_DataType_isNumeric (const UA_DataType *type) |
| const UA_DataType * | UA_findDataType (const UA_NodeId *typeId) |
| const UA_DataType * | UA_findDataTypeWithCustom (const UA_NodeId *typeId, const UA_DataTypeArray *customTypes) |
| void * | UA_new (const UA_DataType *type) |
| UA_INLINABLE (void UA_init(void *p, const UA_DataType *type), { memset(p, 0, type->memSize);}) UA_StatusCode UA_copy(const void *src | |
| void | UA_clear (void *p, const UA_DataType *type) |
| void | UA_delete (void *p, const UA_DataType *type) |
| UA_Order | UA_order (const void *p1, const void *p2, const UA_DataType *type) |
| UA_INLINABLE (UA_Boolean UA_equal(const void *p1, const void *p2, const UA_DataType *type), { return(UA_order(p1, p2, type)==UA_ORDER_EQ);}) UA_EXPORT size_t UA_calcSizeBinary(const void *p | |
| UA_EXPORT UA_StatusCode | UA_encodeBinary (const void *p, const UA_DataType *type, UA_ByteString *outBuf) |
| UA_EXPORT UA_StatusCode | UA_decodeBinary (const UA_ByteString *inBuf, void *p, const UA_DataType *type, const UA_DecodeBinaryOptions *options) |
| void * | UA_Array_new (size_t size, const UA_DataType *type) |
| UA_StatusCode | UA_Array_copy (const void *src, size_t size, void **dst, const UA_DataType *type) |
| UA_StatusCode | UA_Array_resize (void **p, size_t *size, size_t newSize, const UA_DataType *type) |
| UA_StatusCode | UA_Array_append (void **p, size_t *size, void *newElem, const UA_DataType *type) |
| UA_StatusCode | UA_Array_appendCopy (void **p, size_t *size, const void *newElem, const UA_DataType *type) |
| void | UA_Array_delete (void *p, size_t size, const UA_DataType *type) |
Variables | |
| _UA_BEGIN_DECLS typedef bool | UA_Boolean |
| UA_StatusCode | s2 |
| UA_EXPORT const UA_String | UA_STRING_NULL |
| UA_EXPORT const UA_Guid | UA_GUID_NULL |
| UA_EXPORT const UA_ByteString | UA_BYTESTRING_NULL |
| UA_EXPORT const UA_NodeId | UA_NODEID_NULL |
| char * | chars |
| id | namespaceIndex = nsIndex |
| id | identifierType = UA_NODEIDTYPE_STRING |
| id identifier | string = UA_STRING(chars) |
| return | id |
| UA_Guid | guid = guid |
| id identifier | byteString = UA_String_fromChars( chars ) |
| UA_EXPORT const UA_ExpandedNodeId | UA_EXPANDEDNODEID_NULL |
| char id | nodeId = UA_NODEID_STRING(nsIndex, chars) |
| id | serverIndex = 0 |
| id | namespaceUri = UA_STRING_NULL |
| qn | name = UA_String_fromChars( chars ) |
| return | qn |
| const char * | text = UA_String_fromChars( text ) |
| const char lt | locale = UA_String_fromChars( locale ) |
| return | lt |
| const UA_DataType * | type |
| void * | dst |
| #define UA_BYTESTRING_ALLOC | ( | chars | ) | UA_STRING_ALLOC(chars) |
| #define UA_DATATYPEKINDS 31 |
| #define UA_DATETIME_MSEC (UA_DATETIME_USEC * 1000LL) |
| #define UA_DATETIME_SEC (UA_DATETIME_MSEC * 1000LL) |
| #define UA_DATETIME_UNIX_EPOCH (11644473600LL * UA_DATETIME_SEC) |
The C99 standard (7.23.1) says: "The range and precision of times representable in clock_t and time_t are implementation-defined.
" On most systems, time_t is a 4 or 8 byte integer counting seconds since the UTC Unix epoch. The following methods are used for conversion. Datetime of 1 Jan 1970 00:00
| #define UA_DATETIME_USEC 10LL |
| #define UA_FALSE false UA_INTERNAL_DEPRECATED |
| #define UA_INT64_MIN ((int64_t)-UA_INT64_MAX-1LL) |
| #define UA_STRING_ALLOC | ( | CHARS | ) | UA_String_fromChars(CHARS) |
| #define UA_STRING_STATIC | ( | CHARS | ) | {sizeof(CHARS)-1, (UA_Byte*)CHARS} |
| #define UA_TRUE true UA_INTERNAL_DEPRECATED |
stop-doc-generation
Helper used to exclude type names in the definition of UA_DataType structures if the feature is disabled.
| typedef UA_String UA_ByteString |
| typedef struct UA_DataType UA_DataType |
| typedef struct UA_DataTypeArray UA_DataTypeArray |
Datatype arrays with custom type definitions can be added in a linked list to the client or server configuration.
| typedef struct UA_DateTimeStruct UA_DateTimeStruct |
Represents a Datetime as a structure.
| typedef struct UA_DiagnosticInfo UA_DiagnosticInfo |
| typedef uint32_t UA_StatusCode |
| typedef UA_String UA_XmlElement |
| enum UA_DataTypeKind |
| enum UA_NodeIdType |
| char memset & id | ( | UA_NodeId | ) |
| 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.
The content is moved (shallow copy) and the original memory is _init'ed if appending is successful.
| p | Double pointer to the array memory. Can be overwritten by the result of a realloc. |
| size | The current size of the array. Overwritten in case of success. |
| newElem | The element to be appended. The memory is reset upon success. |
| type | The datatype of the array members |
| 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.
| p | Double pointer to the array memory. Can be overwritten by the result of a realloc. |
| size | The current size of the array. Overwritten in case of success. |
| newElem | The element to be appended. |
| type | The datatype of the array members |
| UA_StatusCode UA_Array_copy | ( | const void * | src, |
| size_t | size, | ||
| void ** | dst, | ||
| const UA_DataType * | type | ||
| ) |
Allocates and copies an array.
| src | The memory location of the source array |
| size | The size of the array |
| dst | The location of the pointer to the new array |
| type | The datatype of the array members |
| void UA_Array_delete | ( | void * | p, |
| size_t | size, | ||
| const UA_DataType * | type | ||
| ) |
Deletes an array.
| p | The memory location of the array |
| size | The size of the array |
| type | The datatype of the array members |
| void * UA_Array_new | ( | size_t | size, |
| const UA_DataType * | type | ||
| ) |
Allocates and initializes an array of variables of a specific type.
| size | The requested array length |
| type | The datatype description |
| UA_StatusCode UA_Array_resize | ( | void ** | p, |
| size_t * | size, | ||
| size_t | newSize, | ||
| const UA_DataType * | type | ||
| ) |
Resizes (and reallocates) an array.
The last entries are initialized to zero if the array length is increased. If the array length is decreased, the last entries are removed if the size is decreased.
| p | Double pointer to the array memory. Can be overwritten by the result of a realloc. |
| size | The current size of the array. Overwritten in case of success. |
| newSize | The new size of the array |
| type | The datatype of the array members |
| UA_StatusCode UA_ByteString_allocBuffer | ( | UA_ByteString * | bs, |
| size_t | length | ||
| ) |
Allocates memory of size length for the bytestring.
The content is not set to zero.
| UA_StatusCode UA_ByteString_fromBase64 | ( | UA_ByteString * | bs, |
| const UA_String * | input | ||
| ) |
Parse a ByteString from a base64 representation.
Returns a non-cryptographic hash of a bytestring.
| UA_StatusCode UA_ByteString_toBase64 | ( | const UA_ByteString * | bs, |
| UA_String * | output | ||
| ) |
Converts a ByteString to the corresponding base64 representation.
| void UA_clear | ( | void * | p, |
| const UA_DataType * | type | ||
| ) |
Deletes the dynamically allocated content of a variable (e.g.
resets all arrays to undefined arrays). Afterwards, the variable can be safely deleted without causing memory leaks. But the variable is not initialized and may contain old data that is not memory-relevant.
| p | The memory location of the variable |
| type | The datatype description of the variable |
| UA_Boolean UA_DataType_getStructMember | ( | const UA_DataType * | type, |
| const char * | memberName, | ||
| size_t * | outOffset, | ||
| const UA_DataType ** | outMemberType, | ||
| UA_Boolean * | outIsArray | ||
| ) |
Returns the offset and type of a structure member.
The return value is false if the member was not found.
If the member is an array, the offset points to the (size_t) length field. (The array pointer comes after the length field without any padding.)
| UA_Boolean UA_DataType_isNumeric | ( | const UA_DataType * | type | ) |
Test if the data type is a numeric builtin data type (via the typeKind field of UA_DataType).
This includes integers and floating point numbers. Not included are Boolean, DateTime, StatusCode and Enums.
| 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 source DataValue.
Returns an error code if the variant of the DataValue is not an array or if the indicated range does not fit.
| src | The source DataValue |
| dst | The target DataValue |
| range | The range of the variant of the DataValue to copy |
| UA_DateTime UA_DateTime_fromStruct | ( | UA_DateTimeStruct | ts | ) |
| UA_Int64 UA_DateTime_localTimeUtcOffset | ( | void | ) |
Offset between local time and UTC time.
| UA_DateTime UA_DateTime_now | ( | void | ) |
The current time in UTC time.
| UA_DateTime UA_DateTime_nowMonotonic | ( | void | ) |
CPU clock invariant to system time changes.
Use only to measure durations, not absolute time.
| UA_DateTimeStruct UA_DateTime_toStruct | ( | UA_DateTime | t | ) |
| 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.
It is assumed that p points to valid memory (not necessarily zeroed out). The options can be NULL and will be disregarded in that case.
| void UA_delete | ( | void * | p, |
| const UA_DataType * | type | ||
| ) |
Frees a variable and all of its content.
| p | The memory location of the variable |
| type | The datatype description of the variable |
| UA_EXPORT UA_StatusCode UA_encodeBinary | ( | const void * | p, |
| const UA_DataType * | type, | ||
| UA_ByteString * | outBuf | ||
| ) |
Encodes a data-structure in the binary format.
If outBuf has a length of zero, a buffer of the required size is allocated. Otherwise, encoding into the existing outBuf is attempted (and may fail if the buffer is too small).
| UA_UInt32 UA_ExpandedNodeId_hash | ( | const UA_ExpandedNodeId * | n | ) |
Returns a non-cryptographic hash for ExpandedNodeId.
The hash of an ExpandedNodeId is identical to the hash of the embedded (simple) NodeId if the ServerIndex is zero and no NamespaceUri is set.
| UA_Order UA_ExpandedNodeId_order | ( | const UA_ExpandedNodeId * | n1, |
| const UA_ExpandedNodeId * | n2 | ||
| ) |
Total ordering of ExpandedNodeId.
| UA_StatusCode UA_ExpandedNodeId_print | ( | const UA_ExpandedNodeId * | id, |
| UA_String * | output | ||
| ) |
Print the ExpandedNodeId in the humand-readable format defined in Part 6, 5.3.1.11:
svr=<serverindex>;ns=<namespaceindex>;<type>=
or svr=<serverindex>;nsu=<uri>;<type>=
The definitions for svr, ns and nsu is omitted if zero / the empty string.
The method can either use a pre-allocated string buffer or allocates memory internally if called with an empty output string.
| 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.
The value will be deleted when the ExtensionObject is cleared.
| 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.
The value will be deleted when the ExtensionObject is cleared.
| 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.
The value will not be deleted when the ExtensionObject is cleared.
| 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 found.
| const UA_DataType * UA_findDataTypeWithCustom | ( | const UA_NodeId * | typeId, |
| const UA_DataTypeArray * | customTypes | ||
| ) |
| UA_StatusCode UA_Guid_print | ( | const UA_Guid * | guid, |
| UA_String * | output | ||
| ) |
Print a Guid in the human-readable format defined in Part 6, 5.1.3.
Format: C496578A-0DFE-4B8F-870A-745238C6AEAE | | | | | | 0 8 13 18 23 36
This allocates memory if the output argument is an empty string. Tries to use the given buffer otherwise.
| UA_INLINABLE | ( | UA_Boolean | UA_equalconst void *p1, const void *p2, const UA_DataType *type, |
| { return(UA_order(p1, p2, type)==UA_ORDER_EQ);} | |||
| ) | const |
Compare if two values have identical content.
Returns the number of bytes the value p takes in binary encoding. Returns zero if an error occurs.
| UA_INLINABLE | ( | UA_Boolean | UA_QualifiedName_isNullconst UA_QualifiedName *q, |
| { return(q->namespaceIndex==0 &&q->name.length==0);} | |||
| ) | const |
Returns a non-cryptographic hash for QualifiedName.
| UA_INLINABLE | ( | UA_Boolean | UA_StatusCode_isBadUA_StatusCode code, |
| { return((code > > 30) >=0x02);} | |||
| ) |
Extracts the severity from a StatusCode.
See Part 4, Section 7.34 for details.
| UA_INLINABLE | ( | UA_Boolean | UA_StatusCode_isGoodUA_StatusCode code, |
| { return((code > > 30)==0x00);} | |||
| ) |
Compares the top 16 bits of two StatusCodes for equality.
This should only be used when processing user-defined StatusCodes e.g when processing a ReadResponse. As a convention, the lower bits of StatusCodes should not be used internally, meaning can compare them without the use of this function.
| UA_INLINABLE | ( | UA_Boolean | UA_Variant_hasScalarTypeconst UA_Variant *v, const UA_DataType *type, |
| { return UA_Variant_isScalar(v) &&type==v->type;} | |||
| ) | const |
Returns true if the variant contains a scalar value of the given type.
| v | The variant |
| type | The data type |
| v | The variant |
| type | The data type |
| UA_INLINABLE | ( | UA_Boolean | UA_Variant_isEmptyconst UA_Variant *v, |
| { return v->type==NULL;} | |||
| ) | const |
Returns true if the variant has no value defined (contains neither an array nor a scalar value).
| v | The variant |
| v | The variant |
| UA_INLINABLE | ( | UA_ExpandedNodeId | UA_EXPANDEDNODEID_BYTESTRINGUA_UInt16 nsIndex, char *chars, |
| { UA_ExpandedNodeId id;id.nodeId=UA_NODEID_BYTESTRING(nsIndex, chars);id.serverIndex=0;id.namespaceUri=UA_STRING_NULL;return id;} | |||
| ) |
| UA_INLINABLE | ( | UA_ExpandedNodeId | UA_EXPANDEDNODEID_NODEIDUA_NodeId nodeId, |
| { UA_ExpandedNodeId id;memset(&id, 0, sizeof(UA_ExpandedNodeId));id.nodeId=nodeId;return id;} | |||
| ) | const |
Does the ExpandedNodeId point to a local node? That is, are namespaceUri and serverIndex empty?
| UA_INLINABLE | ( | UA_ExpandedNodeId | UA_EXPANDEDNODEID_NUMERICUA_UInt16 nsIndex, UA_UInt32 identifier, |
| { UA_ExpandedNodeId id;id.nodeId=UA_NODEID_NUMERIC(nsIndex, identifier);id.serverIndex=0;id.namespaceUri=UA_STRING_NULL;return id;} | |||
| ) |
Parse the human-readable NodeId format.
Attention! String and ByteString NodeIds have their identifier malloc'ed and need to be cleaned up.
| UA_INLINABLE | ( | UA_ExpandedNodeId | UA_EXPANDEDNODEID_STRING_ALLOCUA_UInt16 nsIndex, const char *chars, |
| { UA_ExpandedNodeId id;id.nodeId=UA_NODEID_STRING_ALLOC(nsIndex, chars);id.serverIndex=0;id.namespaceUri=UA_STRING_NULL;return id;} | |||
| ) |
| UA_INLINABLE | ( | UA_Int64 | UA_DateTime_toUnixTimeUA_DateTime date, |
| { return(date -(11644473600LL *((10LL *1000LL) *1000LL)))/((10LL *1000LL) *1000LL) ;} | |||
| ) |
| UA_INLINABLE | ( | UA_LocalizedText | UA_LOCALIZEDTEXTchar *locale, char *text, |
| { UA_LocalizedText lt;lt.locale=UA_STRING(locale);lt.text=UA_STRING(text);return lt;} | |||
| ) | const |
| UA_INLINABLE | ( | UA_NodeId | UA_NODEID_BYTESTRINGUA_UInt16 nsIndex, char *chars, |
| { UA_NodeId id;memset(&id, 0, sizeof(UA_NodeId));id.namespaceIndex=nsIndex;id.identifierType=UA_NODEIDTYPE_BYTESTRING;id.identifier.byteString=UA_STRING(chars);return id;} | |||
| ) |
| UA_INLINABLE | ( | UA_NodeId | UA_NODEID_NUMERICUA_UInt16 nsIndex, UA_UInt32 identifier, |
| { UA_NodeId id;memset(&id, 0, sizeof(UA_NodeId));id.namespaceIndex=nsIndex;id.identifierType=UA_NODEIDTYPE_NUMERIC;id.identifier.numeric=identifier;return id;} | |||
| ) |
Parse the human-readable NodeId format.
Attention! String and ByteString NodeIds have their identifier malloc'ed and need to be cleaned up.
| UA_INLINABLE | ( | UA_NodeId | UA_NODEID_STRING_ALLOCUA_UInt16 nsIndex, const char *chars, |
| { UA_NodeId id;memset(&id, 0, sizeof(UA_NodeId));id.namespaceIndex=nsIndex;id.identifierType=UA_NODEIDTYPE_STRING;id.identifier.string=UA_String_fromChars(chars);return id;} | |||
| ) |
| UA_INLINABLE | ( | UA_NumericRange | UA_NUMERICRANGEconst char *s, |
| { UA_NumericRange nr;memset(&nr, 0, sizeof(nr));UA_NumericRange_parse(&nr, UA_STRING((char *)(uintptr_t) s));return nr;} | |||
| ) |
Forward declaration.
See the section on Generic Type Handling
| UA_INLINABLE | ( | UA_QualifiedName | UA_QUALIFIEDNAMEUA_UInt16 nsIndex, char *chars, |
| { UA_QualifiedName qn;qn.namespaceIndex=nsIndex;qn.name=UA_STRING(chars);return qn;} | |||
| ) |
| UA_INLINABLE | ( | UA_String | UA_STRINGchar *chars, |
| { UA_String s;memset(&s, 0, sizeof(s));if(!chars) return s;s.length=strlen(chars);s.data=(UA_Byte *) chars;return s;} | |||
| ) |
Define strings at compile time (in ROM)
| UA_INLINABLE | ( | void | UA_initvoid *p, const UA_DataType *type, |
| { memset(p, 0, type->memSize);} | |||
| ) | const |
Initializes a variable to default values.
| p | The memory location of the variable |
| type | The datatype description Copies the content of two variables. If copying fails (e.g. because no memory was available for an array), then dst is emptied and initialized to prevent memory leaks. |
| src | The memory location of the source variable |
| dst | The memory location of the destination variable |
| type | The datatype description |
| void * UA_new | ( | const UA_DataType * | type | ) |
Allocates and initializes a variable of type dataType.
| type | The datatype description |
| 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.
Examples: UA_NODEID("i=13") UA_NODEID("ns=10;i=1") UA_NODEID("ns=10;s=Hello:World") UA_NODEID("g=09087e75-8e5e-499b-954f-f2a9603db28a") UA_NODEID("ns=1;b=b3BlbjYyNTQxIQ==") // base64
The method can either use a pre-allocated string buffer or allocates memory internally if called with an empty output string.
| UA_StatusCode UA_NumericRange_parse | ( | UA_NumericRange * | range, |
| const UA_String | str | ||
| ) |
Referenced by UA_INLINABLE().
| UA_Order UA_order | ( | const void * | p1, |
| const void * | p2, | ||
| const UA_DataType * | type | ||
| ) |
Pretty-print the value from the datatype.
The output is pretty-printed JSON5. Note that this format is non-standard and should not be sent over the network. It can however be read by our own JSON decoding.
| p | The memory location of the variable |
| type | The datatype description of the variable |
| output | A string that is used for the pretty-printed output. If the memory for string is already allocated, we try to use the existing string (the length is adjusted). If the string is empty, memory is allocated for it. |
For numerical types (including StatusCodes and Enums), their natural order is used. NaN is the "smallest" value for floating point values. Different bit representations of NaN are considered identical.
All other types have some absolute ordering so that a < b, b < c -> a < c.
The ordering of arrays (also strings) is in "shortlex": A shorter array is always smaller than a longer array. Otherwise the first different element defines the order.
When members of different types are permitted (in Variants and ExtensionObjects), the memory address in the "UA_DataType*" pointer determines which variable is smaller.
| p1 | The memory location of the first value |
| p2 | The memory location of the first value |
| type | The datatype description of both values |
Referenced by UA_INLINABLE().
| UA_EXPORT const char * UA_StatusCode_name | ( | UA_StatusCode | code | ) |
Returns the human-readable name of the StatusCode.
If no matching StatusCode is found, a default string for "Unknown" is returned. This feature might be disabled to create a smaller binary with the UA_ENABLE_STATUSCODE_DESCRIPTIONS build-flag. Then the function returns an empty string for every StatusCode.
| UA_String UA_String_fromChars | ( | const char * | src | ) |
Copies the content on the heap.
Returns a null-string when alloc fails
| UA_Boolean UA_String_isEmpty | ( | const UA_String * | s | ) |
| 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.
Returns an error code if the variant is not an array or if the indicated range does not fit.
| src | The source variant |
| dst | The target variant |
| range | The range of the copied data |
| 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.
The array takes on the lifecycle of the variant and is deleted with it.
| v | The variant |
| array | A pointer to the array data |
| arraySize | The size of the array |
| type | The datatype of the array |
| 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.
| v | The variant |
| array | A pointer to the array data |
| arraySize | The size of the array |
| type | The datatype of the array |
| 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.
The data array cannot be reused afterwards if it contains types without a fixed size (e.g. strings) since the members are moved into the variant and take on its lifecycle.
| v | The variant |
| dataArray | The data array. The type must match the variant |
| dataArraySize | The length of the data array. This is checked to match the range size. |
| range | The range of where the new data is inserted |
| 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.
| v | The variant |
| dataArray | The data array. The type must match the variant |
| dataArraySize | The length of the data array. This is checked to match the range size. |
| range | The range of where the new data is inserted |
| const UA_DataType 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.
The value takes on the lifecycle of the variant and is deleted with it.
| v | The variant |
| p | A pointer to the value data |
| type | The datatype of the value in question |
| 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.
| v | The variant |
| p | A pointer to the value data |
| type | The datatype of the value |
| id identifier byteString = UA_String_fromChars( chars ) |
| const char * chars |
Definition at line 335 of file types.h.
Referenced by UA_INLINABLE(), UA_INLINABLE(), UA_INLINABLE(), UA_INLINABLE(), UA_INLINABLE(), and UA_INLINABLE().
| return id |
Definition at line 341 of file types.h.
Referenced by getTypeDefinitionId(), UA_INLINABLE(), UA_INLINABLE(), UA_INLINABLE(), UA_INLINABLE(), UA_INLINABLE(), UA_INLINABLE(), and UA_INLINABLE().
| id identifierType = UA_NODEIDTYPE_STRING |
| const char lt locale = UA_String_fromChars( locale ) |
Definition at line 538 of file types.h.
Referenced by UA_INLINABLE().
| return lt |
Definition at line 540 of file types.h.
Referenced by UA_INLINABLE().
| qn name = UA_String_fromChars( chars ) |
| id namespaceUri = UA_STRING_NULL |
Definition at line 440 of file types.h.
Referenced by UA_INLINABLE().
| return qn |
Definition at line 518 of file types.h.
Referenced by UA_INLINABLE().
| lt text = UA_String_fromChars( text ) |
Definition at line 536 of file types.h.
Referenced by UA_INLINABLE().
| const UA_DataType * type |
Definition at line 626 of file types.h.
Referenced by UA_INLINABLE(), UA_INLINABLE(), and UA_INLINABLE().
| _UA_BEGIN_DECLS typedef bool UA_Boolean |
This Source Code Form is subject to the terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright 2014 (c) Leon Urbas Copyright 2014, 2016-2017 (c) Florian Palm Copyright 2014-2017 (c) Fraunhofer IOSB (Author: Julius Pfrommer) Copyright 2015-2016 (c) Sten GrĂ¼ner Copyright 2015-2016 (c) Chris Iatrou Copyright 2015 (c) Nick Goossens Copyright 2015-2016 (c) Oleksiy Vasylyev Copyright 2017 (c) Stefan Profanter, fortiss GmbH Copyright 2017 (c) Thomas Stalder, Blue Time Concept SA Copyright 2023 (c) Fraunhofer IOSB (Author: Andreas Ebner)
Definition at line 27 of file types.h.
Referenced by hasReference().
|
extern |
|
extern |
|
extern |
|
extern |
Referenced by getTypeDefinitionId().
|
extern |
Referenced by UA_INLINABLE(), UA_INLINABLE(), and UA_INLINABLE().