open62541 1.3.14
Open source implementation of OPC UA
|
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 (-2147483648) |
#define | UA_INT32_MAX 2147483647 |
#define | UA_UINT32_MIN 0 |
#define | UA_UINT32_MAX 4294967295 |
#define | UA_INT64_MAX (int64_t)9223372036854775807LL |
#define | UA_INT64_MIN ((int64_t)-UA_INT64_MAX-1LL) |
#define | UA_UINT64_MIN (uint64_t)0 |
#define | UA_UINT64_MAX (uint64_t)18446744073709551615ULL |
#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_EMPTY_ARRAY_SENTINEL ((void*)0x01) |
#define | UA_DATATYPEKINDS 31 |
#define | UA_deleteMembers(p, type) UA_clear(p, type) |
#define | UA_TYPENAME(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 int64_t | UA_DateTime |
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 |
Variables | |
_UA_BEGIN_DECLS typedef bool | UA_Boolean |
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 |
UA_EXPORT const UA_ExpandedNodeId | UA_EXPANDEDNODEID_NULL |
#define UA_TRUE true UA_INTERNAL_DEPRECATED |
#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_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) |
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_DATATYPEKINDS 31 |
#define UA_TYPENAME | ( | name | ) |
The following is used to exclude type names in the definition of UA_DataType structures if the feature is disabled.
typedef uint32_t UA_StatusCode |
typedef int64_t UA_DateTime |
typedef struct UA_DateTimeStruct UA_DateTimeStruct |
Represents a Datetime as a structure.
typedef UA_String UA_ByteString |
typedef UA_String UA_XmlElement |
typedef struct UA_DiagnosticInfo UA_DiagnosticInfo |
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.
enum UA_NodeIdType |
enum UA_DataTypeKind |
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_equal | ( | const UA_String * | s1, |
const UA_String * | s2 ) |
UA_DateTime UA_DateTime_now | ( | void | ) |
The current time in UTC time.
UA_Int64 UA_DateTime_localTimeUtcOffset | ( | void | ) |
Offset between local time and 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_DateTime UA_DateTime_fromStruct | ( | UA_DateTimeStruct | ts | ) |
UA_Boolean UA_Guid_equal | ( | const UA_Guid * | g1, |
const UA_Guid * | g2 ) |
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_toBase64 | ( | const UA_ByteString * | bs, |
UA_String * | output ) |
Converts a ByteString to the corresponding base64 representation.
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_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
UA_StatusCode UA_ExpandedNodeId_print | ( | const UA_ExpandedNodeId * | id, |
UA_String * | output ) |
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_Order UA_ExpandedNodeId_order | ( | const UA_ExpandedNodeId * | n1, |
const UA_ExpandedNodeId * | n2 ) |
Total ordering of ExpandedNodeId.
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_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_NumericRange_parse | ( | UA_NumericRange * | range, |
const UA_String | str ) |
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 |
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_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 |
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 |
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.
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.
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.
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_Boolean UA_DataType_isNumeric | ( | const UA_DataType * | type | ) |
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.) 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_Int16 UA_DataType_getPrecedence | ( | const UA_DataType * | type | ) |
Return the Data Type Precedence-Rank defined in Part 4.
If there is no Precedence-Rank assigned with the type -1 is returned.
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.
void * UA_new | ( | const UA_DataType * | type | ) |
Allocates and initializes a variable of type dataType.
type | The datatype description |
UA_StatusCode UA_copy | ( | const void * | src, |
void * | dst, | ||
const UA_DataType * | type ) |
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_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 |
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_Order UA_order | ( | const void * | p1, |
const void * | p2, | ||
const UA_DataType * | type ) |
Pretty-print the value from the datatype.
p | The memory location of the variable |
type | The datatype description of the variable |
output | A string that is memory-allocated for the pretty-printed output |
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 |
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.
Returns zero if an error occurs.
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_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_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_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 |
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_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 |
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_random_seed | ( | UA_UInt64 | seed | ) |
UA_UInt32 UA_UInt32_random | ( | void | ) |
UA_Guid UA_Guid_random | ( | void | ) |
_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
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |