open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1/** This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 *
5 * Copyright 2014 (c) Leon Urbas
6 * Copyright 2014, 2016-2017 (c) Florian Palm
7 * Copyright 2014-2017 (c) Fraunhofer IOSB (Author: Julius Pfrommer)
8 * Copyright 2015-2016 (c) Sten GrĂ¼ner
9 * Copyright 2015-2016 (c) Chris Iatrou
10 * Copyright 2015 (c) Nick Goossens
11 * Copyright 2015-2016 (c) Oleksiy Vasylyev
12 * Copyright 2017 (c) Stefan Profanter, fortiss GmbH
13 * Copyright 2017 (c) Thomas Stalder, Blue Time Concept SA
14 */
15
16#ifndef UA_TYPES_H_
17#define UA_TYPES_H_
18
19#include <open62541/config.h>
20#include <open62541/common.h>
22
24
25
26typedef bool UA_Boolean;
27#define UA_TRUE true UA_INTERNAL_DEPRECATED
28#define UA_FALSE false UA_INTERNAL_DEPRECATED
29
30
31typedef int8_t UA_SByte;
32#define UA_SBYTE_MIN (-128)
33#define UA_SBYTE_MAX 127
34
35
36typedef uint8_t UA_Byte;
37#define UA_BYTE_MIN 0
38#define UA_BYTE_MAX 255
39
40
41typedef int16_t UA_Int16;
42#define UA_INT16_MIN (-32768)
43#define UA_INT16_MAX 32767
44
45
46typedef uint16_t UA_UInt16;
47#define UA_UINT16_MIN 0
48#define UA_UINT16_MAX 65535
49
50
51typedef int32_t UA_Int32;
52#define UA_INT32_MIN (-2147483648)
53#define UA_INT32_MAX 2147483647
54
55
56typedef uint32_t UA_UInt32;
57#define UA_UINT32_MIN 0
58#define UA_UINT32_MAX 4294967295
59
60
61typedef int64_t UA_Int64;
62#define UA_INT64_MAX (int64_t)9223372036854775807LL
63#define UA_INT64_MIN ((int64_t)-UA_INT64_MAX-1LL)
64
65
66typedef uint64_t UA_UInt64;
67#define UA_UINT64_MIN (uint64_t)0
68#define UA_UINT64_MAX (uint64_t)18446744073709551615ULL
69
70
71typedef float UA_Float;
72
73
74typedef double UA_Double;
75
76
77typedef uint32_t UA_StatusCode;
78
79/** Returns the human-readable name of the StatusCode. If no matching StatusCode
80 * is found, a default string for "Unknown" is returned. This feature might be
81 * disabled to create a smaller binary with the
82 * UA_ENABLE_STATUSCODE_DESCRIPTIONS build-flag. Then the function returns an
83 * empty string for every StatusCode. */
84UA_EXPORT const char *
86
87/** Extracts the severity from a StatusCode. See Part 4, Section 7.34 for
88 * details. */
89static UA_Boolean
90UA_StatusCode_isBad(UA_StatusCode code) {
91 return ((code >> 30) >= 0x02);
92}
93
94static UA_Boolean
95UA_StatusCode_isUncertain(UA_StatusCode code) {
96 return ((code >> 30) == 0x01);
97}
98
99static UA_Boolean
100UA_StatusCode_isGood(UA_StatusCode code) {
101 return ((code >> 30) == 0x00);
102}
103
104/** Compares the top 16 bits of two StatusCodes for equality. This should only
105 * be used when processing user-defined StatusCodes e.g when processing a ReadResponse.
106 * As a convention, the lower bits of StatusCodes should not be used internally, meaning
107 * can compare them without the use of this function. */
108static UA_Boolean
109UA_StatusCode_isEqualTop (UA_StatusCode s1, UA_StatusCode s2) {
110 return ((s1 & 0xFFFF0000) == (s2 & 0xFFFF0000));
111}
112
113
114typedef struct {
115 size_t length; /* The length of the string */
116 UA_Byte *data; /* The content (not null-terminated) */
117} UA_String;
118
119/** Copies the content on the heap. Returns a null-string when alloc fails */
121UA_String_fromChars(const char *src);
122
124UA_String_equal(const UA_String *s1, const UA_String *s2);
125
126UA_EXPORT extern const UA_String UA_STRING_NULL;
127
128
129static UA_String
130UA_STRING(char *chars) {
131 UA_String s; s.length = 0; s.data = NULL;
132 if(!chars)
133 return s;
134 s.length = strlen(chars); s.data = (UA_Byte*)chars; return s;
135}
136
137#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
138
139/** Define strings at compile time (in ROM) */
140#define UA_STRING_STATIC(CHARS) {sizeof(CHARS)-1, (UA_Byte*)CHARS}
141
142
143
144typedef int64_t UA_DateTime;
145
146/** Multiples to convert durations to DateTime */
147#define UA_DATETIME_USEC 10LL
148#define UA_DATETIME_MSEC (UA_DATETIME_USEC * 1000LL)
149#define UA_DATETIME_SEC (UA_DATETIME_MSEC * 1000LL)
150
151/** The current time in UTC time */
153
154/** Offset between local time and UTC time */
156
157/** CPU clock invariant to system time changes. Use only to measure durations,
158 * not absolute time. */
160
161/** Represents a Datetime as a structure */
173
176
177/** The C99 standard (7.23.1) says: "The range and precision of times
178 * representable in clock_t and time_t are implementation-defined." On most
179 * systems, time_t is a 4 or 8 byte integer counting seconds since the UTC Unix
180 * epoch. The following methods are used for conversion. */
181
182/** Datetime of 1 Jan 1970 00:00 */
183#define UA_DATETIME_UNIX_EPOCH (11644473600LL * UA_DATETIME_SEC)
184
185static UA_Int64
186UA_DateTime_toUnixTime(UA_DateTime date) {
187 return (date - UA_DATETIME_UNIX_EPOCH) / UA_DATETIME_SEC;
188}
189
190static UA_DateTime
191UA_DateTime_fromUnixTime(UA_Int64 unixDate) {
192 return (unixDate * UA_DATETIME_SEC) + UA_DATETIME_UNIX_EPOCH;
193}
194
195
202
203UA_EXPORT extern const UA_Guid UA_GUID_NULL;
204
206
207#ifdef UA_ENABLE_PARSING
208/** Parse the Guid format defined in Part 6, 5.1.3.
209 * Format: C496578A-0DFE-4B8F-870A-745238C6AEAE
210 * | | | | | |
211 * 0 8 13 18 23 36 */
213UA_Guid_parse(UA_Guid *guid, const UA_String str);
214
215static UA_Guid
216UA_GUID(const char *chars) {
217 UA_Guid guid;
218 UA_Guid_parse(&guid, UA_STRING((char*)(uintptr_t)chars));
219 return guid;
220}
221#endif
222
223
225
226UA_EXPORT extern const UA_ByteString UA_BYTESTRING_NULL;
227
228/** Allocates memory of size length for the bytestring.
229 * The content is not set to zero. */
232
233/** Converts a ByteString to the corresponding
234 * base64 representation */
237 UA_String *output);
238
239/** Parse a ByteString from a base64 representation */
242 const UA_String *input);
243
244static UA_ByteString
245UA_BYTESTRING(char *chars) {
246 UA_ByteString bs; bs.length = 0; bs.data = NULL;
247 if(!chars)
248 return bs;
249 bs.length = strlen(chars); bs.data = (UA_Byte*)chars; return bs;
250}
251
252static UA_ByteString
253UA_BYTESTRING_ALLOC(const char *chars) {
255 bstr.length = str.length; bstr.data = str.data; return bstr;
256}
257
258static UA_Boolean
259UA_ByteString_equal(const UA_ByteString *string1,
260 const UA_ByteString *string2) {
261 return UA_String_equal((const UA_String*)string1,
262 (const UA_String*)string2);
263}
264
265/** Returns a non-cryptographic hash of a bytestring */
268 const UA_Byte *data, size_t size);
269
270
272
273
275 UA_NODEIDTYPE_NUMERIC = 0, /* In the binary encoding, this can also
276 * become 1 or 2 (two-byte and four-byte
277 * encoding of small numeric nodeids) */
282
293
294UA_EXPORT extern const UA_NodeId UA_NODEID_NULL;
295
297
298/** Print the NodeId in the human-readable format defined in Part 6,
299 * 5.3.1.10.
300 *
301 * Examples:
302 * UA_NODEID("i=13")
303 * UA_NODEID("ns=10;i=1")
304 * UA_NODEID("ns=10;s=Hello:World")
305 * UA_NODEID("g=09087e75-8e5e-499b-954f-f2a9603db28a")
306 * UA_NODEID("ns=1;b=b3BlbjYyNTQxIQ==") // base64
307 * */
310
311#ifdef UA_ENABLE_PARSING
312/** Parse the human-readable NodeId format. Attention! String and
313 * ByteString NodeIds have their identifier malloc'ed and need to be
314 * cleaned up. */
316UA_NodeId_parse(UA_NodeId *id, const UA_String str);
317
318static UA_NodeId
319UA_NODEID(const char *chars) {
320 UA_NodeId id;
321 UA_NodeId_parse(&id, UA_STRING((char*)(uintptr_t)chars));
322 return id;
323}
324#endif
325
326
327static UA_NodeId
328UA_NODEID_NUMERIC(UA_UInt16 nsIndex, UA_UInt32 identifier) {
329 UA_NodeId id; id.namespaceIndex = nsIndex;
330 id.identifierType = UA_NODEIDTYPE_NUMERIC;
331 id.identifier.numeric = identifier; return id;
332}
333
334static UA_NodeId
335UA_NODEID_STRING(UA_UInt16 nsIndex, char *chars) {
336 UA_NodeId id; id.namespaceIndex = nsIndex;
337 id.identifierType = UA_NODEIDTYPE_STRING;
338 id.identifier.string = UA_STRING(chars); return id;
339}
340
341static UA_NodeId
342UA_NODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars) {
343 UA_NodeId id; id.namespaceIndex = nsIndex;
344 id.identifierType = UA_NODEIDTYPE_STRING;
345 id.identifier.string = UA_STRING_ALLOC(chars); return id;
346}
347
348static UA_NodeId
349UA_NODEID_GUID(UA_UInt16 nsIndex, UA_Guid guid) {
350 UA_NodeId id; id.namespaceIndex = nsIndex;
351 id.identifierType = UA_NODEIDTYPE_GUID;
352 id.identifier.guid = guid; return id;
353}
354
355static UA_NodeId
356UA_NODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars) {
357 UA_NodeId id; id.namespaceIndex = nsIndex;
358 id.identifierType = UA_NODEIDTYPE_BYTESTRING;
359 id.identifier.byteString = UA_BYTESTRING(chars); return id;
360}
361
362static UA_NodeId
363UA_NODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex, const char *chars) {
364 UA_NodeId id; id.namespaceIndex = nsIndex;
365 id.identifierType = UA_NODEIDTYPE_BYTESTRING;
366 id.identifier.byteString = UA_BYTESTRING_ALLOC(chars); return id;
367}
368
369/** Total ordering of NodeId */
371UA_NodeId_order(const UA_NodeId *n1, const UA_NodeId *n2);
372
373/** Check for equality */
374static UA_Boolean
375UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2) {
376 return (UA_NodeId_order(n1, n2) == UA_ORDER_EQ);
377}
378
379/** Returns a non-cryptographic hash for NodeId */
381
382
388
389UA_EXPORT extern const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL;
390
393
394#ifdef UA_ENABLE_PARSING
395/** Parse the ExpandedNodeId format defined in Part 6, 5.3.1.11:
396 *
397 * svr=<serverindex>;ns=<namespaceindex>;<type>=<value>
398 * or
399 * svr=<serverindex>;nsu=<uri>;<type>=<value>
400 *
401 * The definitions for svr, ns and nsu can be omitted and will be set to zero /
402 * the empty string.*/
404UA_ExpandedNodeId_parse(UA_ExpandedNodeId *id, const UA_String str);
405
407UA_EXPANDEDNODEID(const char *chars) {
409 UA_ExpandedNodeId_parse(&id, UA_STRING((char*)(uintptr_t)chars));
410 return id;
411}
412#endif
413
414
416UA_EXPANDEDNODEID_NUMERIC(UA_UInt16 nsIndex, UA_UInt32 identifier) {
417 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_NUMERIC(nsIndex, identifier);
418 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
419}
420
422UA_EXPANDEDNODEID_STRING(UA_UInt16 nsIndex, char *chars) {
423 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_STRING(nsIndex, chars);
424 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
425}
426
428UA_EXPANDEDNODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars) {
429 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_STRING_ALLOC(nsIndex, chars);
430 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
431}
432
434UA_EXPANDEDNODEID_STRING_GUID(UA_UInt16 nsIndex, UA_Guid guid) {
435 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_GUID(nsIndex, guid);
436 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
437}
438
440UA_EXPANDEDNODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars) {
441 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_BYTESTRING(nsIndex, chars);
442 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
443}
444
446UA_EXPANDEDNODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex, const char *chars) {
447 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_BYTESTRING_ALLOC(nsIndex, chars);
448 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
449}
450
452UA_EXPANDEDNODEID_NODEID(UA_NodeId nodeId) {
453 UA_ExpandedNodeId id = {0}; id.nodeId = nodeId; return id;
454}
455
456/** Does the ExpandedNodeId point to a local node? That is, are namespaceUri and
457 * serverIndex empty? */
460
461/** Total ordering of ExpandedNodeId */
464 const UA_ExpandedNodeId *n2);
465
466/** Check for equality */
467static UA_Boolean
468UA_ExpandedNodeId_equal(const UA_ExpandedNodeId *n1,
469 const UA_ExpandedNodeId *n2) {
470 return (UA_ExpandedNodeId_order(n1, n2) == UA_ORDER_EQ);
471}
472
473/** Returns a non-cryptographic hash for ExpandedNodeId. The hash of an
474 * ExpandedNodeId is identical to the hash of the embedded (simple) NodeId if
475 * the ServerIndex is zero and no NamespaceUri is set. */
478
479
484
485static UA_Boolean
486UA_QualifiedName_isNull(const UA_QualifiedName *q) {
487 return (q->namespaceIndex == 0 && q->name.length == 0);
488}
489
490/** Returns a non-cryptographic hash for QualifiedName */
493
494static UA_QualifiedName
495UA_QUALIFIEDNAME(UA_UInt16 nsIndex, char *chars) {
496 UA_QualifiedName qn; qn.namespaceIndex = nsIndex;
497 qn.name = UA_STRING(chars); return qn;
498}
499
500static UA_QualifiedName
501UA_QUALIFIEDNAME_ALLOC(UA_UInt16 nsIndex, const char *chars) {
502 UA_QualifiedName qn; qn.namespaceIndex = nsIndex;
503 qn.name = UA_STRING_ALLOC(chars); return qn;
504}
505
508 const UA_QualifiedName *qn2);
509
510
515
516static UA_LocalizedText
517UA_LOCALIZEDTEXT(char *locale, char *text) {
518 UA_LocalizedText lt; lt.locale = UA_STRING(locale);
519 lt.text = UA_STRING(text); return lt;
520}
521
522static UA_LocalizedText
523UA_LOCALIZEDTEXT_ALLOC(const char *locale, const char *text) {
524 UA_LocalizedText lt; lt.locale = UA_STRING_ALLOC(locale);
525 lt.text = UA_STRING_ALLOC(text); return lt;
526}
527
528
533
538
541
542static UA_NumericRange
543UA_NUMERICRANGE(const char *s) {
544 UA_NumericRange nr; nr.dimensionsSize = 0; nr.dimensions = NULL;
545 UA_NumericRange_parse(&nr, UA_STRING((char*)(uintptr_t)s)); return nr;
546}
547
548
549/** Forward declaration. See the section on Generic Type Handling */
550struct UA_DataType;
552
553#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
554
555typedef enum {
556 UA_VARIANT_DATA, /* The data has the same lifecycle as the variant */
557 UA_VARIANT_DATA_NODELETE /* The data is "borrowed" by the variant and is
558 * not deleted when the variant is cleared up.
559 * The array dimensions also borrowed. */
561
562typedef struct {
563 const UA_DataType *type; /* The data type description */
565 size_t arrayLength; /* The number of elements in the data array */
566 void *data; /* Points to the scalar or array data */
567 size_t arrayDimensionsSize; /* The number of dimensions */
568 UA_UInt32 *arrayDimensions; /* The length of each dimension */
569} UA_Variant;
570
571/** Returns true if the variant has no value defined (contains neither an array
572 * nor a scalar value).
573 *
574 * @param v The variant
575 * @return Is the variant empty */
576static UA_Boolean
577UA_Variant_isEmpty(const UA_Variant *v) {
578 return v->type == NULL;
579}
580
581/** Returns true if the variant contains a scalar value. Note that empty variants
582 * contain an array of length -1 (undefined).
583 *
584 * @param v The variant
585 * @return Does the variant contain a scalar value */
586static UA_Boolean
587UA_Variant_isScalar(const UA_Variant *v) {
588 return (v->arrayLength == 0 && v->data > UA_EMPTY_ARRAY_SENTINEL);
589}
590
591/** Returns true if the variant contains a scalar value of the given type.
592 *
593 * @param v The variant
594 * @param type The data type
595 * @return Does the variant contain a scalar value of the given type */
596static UA_Boolean
597UA_Variant_hasScalarType(const UA_Variant *v, const UA_DataType *type) {
598 return UA_Variant_isScalar(v) && type == v->type;
599}
600
601/** Returns true if the variant contains an array of the given type.
602 *
603 * @param v The variant
604 * @param type The data type
605 * @return Does the variant contain an array of the given type */
606static UA_Boolean
607UA_Variant_hasArrayType(const UA_Variant *v, const UA_DataType *type) {
608 return (!UA_Variant_isScalar(v)) && type == v->type;
609}
610
611/** Set the variant to a scalar value that already resides in memory. The value
612 * takes on the lifecycle of the variant and is deleted with it.
613 *
614 * @param v The variant
615 * @param p A pointer to the value data
616 * @param type The datatype of the value in question */
617void
619 const UA_DataType *type);
620
621/** Set the variant to a scalar value that is copied from an existing variable.
622 * @param v The variant
623 * @param p A pointer to the value data
624 * @param type The datatype of the value
625 * @return Indicates whether the operation succeeded or returns an error code */
628 const UA_DataType *type);
629
630/** Set the variant to an array that already resides in memory. The array takes
631 * on the lifecycle of the variant and is deleted with it.
632 *
633 * @param v The variant
634 * @param array A pointer to the array data
635 * @param arraySize The size of the array
636 * @param type The datatype of the array */
637void
639 size_t arraySize, const UA_DataType *type);
640
641/** Set the variant to an array that is copied from an existing array.
642 *
643 * @param v The variant
644 * @param array A pointer to the array data
645 * @param arraySize The size of the array
646 * @param type The datatype of the array
647 * @return Indicates whether the operation succeeded or returns an error code */
650 size_t arraySize, const UA_DataType *type);
651
652/** Copy the variant, but use only a subset of the (multidimensional) array into
653 * a variant. Returns an error code if the variant is not an array or if the
654 * indicated range does not fit.
655 *
656 * @param src The source variant
657 * @param dst The target variant
658 * @param range The range of the copied data
659 * @return Returns UA_STATUSCODE_GOOD or an error code */
662 const UA_NumericRange range);
663
664/** Insert a range of data into an existing variant. The data array cannot be
665 * reused afterwards if it contains types without a fixed size (e.g. strings)
666 * since the members are moved into the variant and take on its lifecycle.
667 *
668 * @param v The variant
669 * @param dataArray The data array. The type must match the variant
670 * @param dataArraySize The length of the data array. This is checked to match
671 * the range size.
672 * @param range The range of where the new data is inserted
673 * @return Returns UA_STATUSCODE_GOOD or an error code */
676 size_t arraySize, const UA_NumericRange range);
677
678/** Deep-copy a range of data into an existing variant.
679 *
680 * @param v The variant
681 * @param dataArray The data array. The type must match the variant
682 * @param dataArraySize The length of the data array. This is checked to match
683 * the range size.
684 * @param range The range of where the new data is inserted
685 * @return Returns UA_STATUSCODE_GOOD or an error code */
688 size_t arraySize, const UA_NumericRange range);
689
690
700
701typedef struct {
703 union {
704 struct {
705 UA_NodeId typeId; /* The nodeid of the datatype */
706 UA_ByteString body; /* The bytestring of the encoded data */
707 } encoded;
708 struct {
710 void *data;
711 } decoded;
712 } content;
714
715/** Initialize the ExtensionObject and set the "decoded" value to the given
716 * pointer. The value will be deleted when the ExtensionObject is cleared. */
717void
719 void *p,
720 const UA_DataType *type);
721
722/** Initialize the ExtensionObject and set the "decoded" value to the given
723 * pointer. The value will *not* be deleted when the ExtensionObject is
724 * cleared. */
725void
727 void *p,
728 const UA_DataType *type);
729
730/** Initialize the ExtensionObject and set the "decoded" value to a fresh copy of
731 * the given value pointer. The value will be deleted when the ExtensionObject
732 * is cleared. */
735 void *p,
736 const UA_DataType *type);
737
738
753
754/** Copy the DataValue, but use only a subset of the (multidimensional) array of
755 * of the variant of the source DataValue. Returns an error code if the variant
756 * of the DataValue is not an array or if the indicated range does not fit.
757 *
758 * @param src The source DataValue
759 * @param dst The target DataValue
760 * @param range The range of the variant of the DataValue to copy
761 * @return Returns UA_STATUSCODE_GOOD or an error code */
764 const UA_NumericRange range);
765
766
783
784
785
786typedef struct {
787#ifdef UA_ENABLE_TYPEDESCRIPTION
788 const char *memberName; /* Human-readable member name */
789#endif
790 const UA_DataType *memberType;/* The member data type description */
791 UA_Byte padding : 6; /* How much padding is there before this
792 member element? For arrays this is the
793 padding before the size_t length member.
794 (No padding between size_t and the
795 following ptr.) For unions, the padding
796 includes the size of the switchfield (the
797 offset from the start of the union
798 type). */
799 UA_Byte isArray : 1; /* The member is an array */
800 UA_Byte isOptional : 1; /* The member is an optional field */
802
803/** The DataType "kind" is an internal type classification. It is used to
804 * dispatch handling to the correct routines. */
805#define UA_DATATYPEKINDS 31
839
841#ifdef UA_ENABLE_TYPEDESCRIPTION
842 const char *typeName;
843#endif
844 UA_NodeId typeId; /* The nodeid of the type */
845 UA_NodeId binaryEncodingId; /* NodeId of datatype when encoded as binary */
846 //UA_NodeId xmlEncodingId; /* NodeId of datatype when encoded as XML */
847 UA_UInt32 memSize : 16; /* Size of the struct in memory */
848 UA_UInt32 typeKind : 6; /* Dispatch index for the handling routines */
849 UA_UInt32 pointerFree : 1; /* The type (and its members) contains no
850 * pointers that need to be freed */
851 UA_UInt32 overlayable : 1; /* The type has the identical memory layout
852 * in memory and on the binary stream. */
853 UA_UInt32 membersSize : 8; /* How many members does the type have? */
855};
856
857/** Datatype arrays with custom type definitions can be added in a linked list to
858 * the client or server configuration. */
864
865/** Returns the offset and type of a structure member. The return value is false
866 * if the member was not found.
867 *
868 * If the member is an array, the offset points to the (size_t) length field.
869 * (The array pointer comes after the length field without any padding.) */
870#ifdef UA_ENABLE_TYPEDESCRIPTION
872UA_DataType_getStructMember(const UA_DataType *type,
873 const char *memberName,
874 size_t *outOffset,
875 const UA_DataType **outMemberType,
876 UA_Boolean *outIsArray);
877#endif
878
879/** Test if the data type is a numeric builtin data type (via the typeKind field
880 * of UA_DataType). This includes integers and floating point numbers. Not
881 * included are Boolean, DateTime, StatusCode and Enums. */
884
885/** Return the Data Type Precedence-Rank defined in Part 4.
886 * If there is no Precedence-Rank assigned with the type -1 is returned.*/
889
890
891
892/** Returns the data type description for the type's identifier or NULL if no
893 * matching data type was found. */
894const UA_DataType *
896
897
898
899/** Allocates and initializes a variable of type dataType
900 *
901 * @param type The datatype description
902 * @return Returns the memory location of the variable or NULL if no
903 * memory could be allocated */
904void * UA_new(const UA_DataType *type);
905
906/** Initializes a variable to default values
907 *
908 * @param p The memory location of the variable
909 * @param type The datatype description */
910static void
911UA_init(void *p, const UA_DataType *type) {
912 memset(p, 0, type->memSize);
913}
914
915/** Copies the content of two variables. If copying fails (e.g. because no memory
916 * was available for an array), then dst is emptied and initialized to prevent
917 * memory leaks.
918 *
919 * @param src The memory location of the source variable
920 * @param dst The memory location of the destination variable
921 * @param type The datatype description
922 * @return Indicates whether the operation succeeded or returns an error code */
924UA_copy(const void *src, void *dst, const UA_DataType *type);
925
926/** Deletes the dynamically allocated content of a variable (e.g. resets all
927 * arrays to undefined arrays). Afterwards, the variable can be safely deleted
928 * without causing memory leaks. But the variable is not initialized and may
929 * contain old data that is not memory-relevant.
930 *
931 * @param p The memory location of the variable
932 * @param type The datatype description of the variable */
933void UA_clear(void *p, const UA_DataType *type);
934
935#define UA_deleteMembers(p, type) UA_clear(p, type)
936
937/** Frees a variable and all of its content.
938 *
939 * @param p The memory location of the variable
940 * @param type The datatype description of the variable */
941void UA_delete(void *p, const UA_DataType *type);
942
943/** Pretty-print the value from the datatype.
944 *
945 * @param p The memory location of the variable
946 * @param type The datatype description of the variable
947 * @param output A string that is memory-allocated for the pretty-printed output
948 * @return Indicates whether the operation succeeded*/
949#ifdef UA_ENABLE_TYPEDESCRIPTION
951UA_print(const void *p, const UA_DataType *type, UA_String *output);
952#endif
953
954/** Compare two variables and return their order. This can also be used to test
955 * for equality of two values.
956 *
957 * For numerical types (including StatusCodes and Enums), their natural order is
958 * used. NaN is the "smallest" value for floating point values. Different bit
959 * representations of NaN are considered identical.
960 *
961 * All other types have *some* absolute ordering so that a < b, b < c -> a < c.
962 *
963 * The ordering of arrays (also strings) is in "shortlex": A shorter array is
964 * always smaller than a longer array. Otherwise the first different element
965 * defines the order.
966 *
967 * When members of different types are permitted (in Variants and
968 * ExtensionObjects), the memory address in the "UA_DataType*" pointer
969 * determines which variable is smaller.
970 *
971 * @param p1 The memory location of the first value
972 * @param p2 The memory location of the first value
973 * @param type The datatype description of both values */
975UA_order(const void *p1, const void *p2, const UA_DataType *type);
976
977
978
979/** Returns the number of bytes the value p takes in binary encoding. Returns
980 * zero if an error occurs. */
981UA_EXPORT size_t
982UA_calcSizeBinary(const void *p, const UA_DataType *type);
983
984/** Encodes a data-structure in the binary format. If outBuf has a length of
985 * zero, a buffer of the required size is allocated. Otherwise, encoding into
986 * the existing outBuf is attempted (and may fail if the buffer is too
987 * small). */
988UA_EXPORT UA_StatusCode
989UA_encodeBinary(const void *p, const UA_DataType *type,
990 UA_ByteString *outBuf);
991
992/** The structure with the decoding options may be extended in the future.
993 * Zero-out the entire structure initially to ensure code-compatibility when
994 * more fields are added in a later release. */
995typedef struct {
996 const UA_DataTypeArray *customTypes; /* Begin of a linked list with custom
997 * datatype definitions */
999
1000/** Decodes a data structure from the input buffer in the binary format. It is
1001 * assumed that `p` points to valid memory (not necessarily zeroed out). The
1002 * options can be NULL and will be disregarded in that case. */
1003UA_EXPORT UA_StatusCode
1005 void *p, const UA_DataType *type,
1006 const UA_DecodeBinaryOptions *options);
1007
1008#ifdef UA_ENABLE_JSON_ENCODING
1009
1010typedef struct {
1011 const UA_String *namespaces;
1012 size_t namespacesSize;
1013 const UA_String *serverUris;
1014 size_t serverUrisSize;
1015 UA_Boolean useReversible;
1016} UA_EncodeJsonOptions;
1017
1018/** Returns the number of bytes the value src takes in json encoding. Returns
1019 * zero if an error occurs. */
1020UA_EXPORT size_t
1021UA_calcSizeJson(const void *src, const UA_DataType *type,
1022 const UA_EncodeJsonOptions *options);
1023
1024/** Encodes the scalar value described by type to json encoding.
1025 *
1026 * @param src The value. Must not be NULL.
1027 * @param type The value type. Must not be NULL.
1028 * @param outBuf Pointer to ByteString containing the result if the encoding
1029 * was successful
1030 * @return Returns a statuscode whether encoding succeeded. */
1032UA_encodeJson(const void *src, const UA_DataType *type, UA_ByteString *outBuf,
1033 const UA_EncodeJsonOptions *options);
1034
1035/** The structure with the decoding options may be extended in the future.
1036 * Zero-out the entire structure initially to ensure code-compatibility when
1037 * more fields are added in a later release. */
1038typedef struct {
1039 const UA_String *namespaces;
1040 size_t namespacesSize;
1041 const UA_String *serverUris;
1042 size_t serverUrisSize;
1043 const UA_DataTypeArray *customTypes; /* Begin of a linked list with custom
1044 * datatype definitions */
1045} UA_DecodeJsonOptions;
1046
1047/** Decodes a scalar value described by type from json encoding.
1048 *
1049 * @param src The buffer with the json encoded value. Must not be NULL.
1050 * @param dst The target value. Must not be NULL. The target is assumed to have
1051 * size type->memSize. The value is reset to zero before decoding. If
1052 * decoding fails, members are deleted and the value is reset (zeroed)
1053 * again.
1054 * @param type The value type. Must not be NULL.
1055 * @param options The options struct for decoding, currently unused
1056 * @return Returns a statuscode whether decoding succeeded. */
1058UA_decodeJson(const UA_ByteString *src, void *dst, const UA_DataType *type,
1059 const UA_DecodeJsonOptions *options);
1060
1061#endif /* UA_ENABLE_JSON_ENCODING */
1062
1063
1064
1065/** Allocates and initializes an array of variables of a specific type
1066 *
1067 * @param size The requested array length
1068 * @param type The datatype description
1069 * @return Returns the memory location of the variable or NULL if no memory
1070 * could be allocated */
1071void *
1072UA_Array_new(size_t size, const UA_DataType *type);
1073
1074/** Allocates and copies an array
1075 *
1076 * @param src The memory location of the source array
1077 * @param size The size of the array
1078 * @param dst The location of the pointer to the new array
1079 * @param type The datatype of the array members
1080 * @return Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY */
1082UA_Array_copy(const void *src, size_t size, void **dst,
1083 const UA_DataType *type);
1084
1085/** Resizes (and reallocates) an array. The last entries are initialized to zero
1086 * if the array length is increased. If the array length is decreased, the last
1087 * entries are removed if the size is decreased.
1088 *
1089 * @param p Double pointer to the array memory. Can be overwritten by the result
1090 * of a realloc.
1091 * @param size The current size of the array. Overwritten in case of success.
1092 * @param newSize The new size of the array
1093 * @param type The datatype of the array members
1094 * @return Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY. The
1095 * original array is left untouched in the failure case. */
1097UA_Array_resize(void **p, size_t *size, size_t newSize,
1098 const UA_DataType *type);
1099
1100/** Append the given element at the end of the array. The content is moved
1101 * (shallow copy) and the original memory is _init'ed if appending is
1102 * successful.
1103 *
1104 * @param p Double pointer to the array memory. Can be overwritten by the result
1105 * of a realloc.
1106 * @param size The current size of the array. Overwritten in case of success.
1107 * @param newElem The element to be appended. The memory is reset upon success.
1108 * @param type The datatype of the array members
1109 * @return Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY. The
1110 * original array is left untouched in the failure case. */
1112UA_Array_append(void **p, size_t *size, void *newElem,
1113 const UA_DataType *type);
1114
1115/** Append a copy of the given element at the end of the array.
1116 *
1117 * @param p Double pointer to the array memory. Can be overwritten by the result
1118 * of a realloc.
1119 * @param size The current size of the array. Overwritten in case of success.
1120 * @param newElem The element to be appended.
1121 * @param type The datatype of the array members
1122 * @return Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY. The
1123 * original array is left untouched in the failure case. */
1124
1126UA_Array_appendCopy(void **p, size_t *size, const void *newElem,
1127 const UA_DataType *type);
1128
1129/** Deletes an array.
1130 *
1131 * @param p The memory location of the array
1132 * @param size The size of the array
1133 * @param type The datatype of the array members */
1134void
1135UA_Array_delete(void *p, size_t size, const UA_DataType *type);
1136
1137
1139UA_UInt32 UA_UInt32_random(void); /* no cryptographic entropy */
1140UA_Guid UA_Guid_random(void); /* no cryptographic entropy */
1141
1142
1143
1144/** The following is used to exclude type names in the definition of UA_DataType
1145 * structures if the feature is disabled. */
1146#ifdef UA_ENABLE_TYPEDESCRIPTION
1147# define UA_TYPENAME(name) name,
1148#else
1149# define UA_TYPENAME(name)
1150#endif
1151
1152
1153
1155
1156#endif /* UA_TYPES_H_ */
UA_Order
Definition common.h:112
@ UA_ORDER_EQ
Definition common.h:114
#define _UA_BEGIN_DECLS
#undef UA_DEBUG_DUMP_PKGS
Definition config.h:89
#define _UA_END_DECLS
Definition config.h:96
Datatype arrays with custom type definitions can be added in a linked list to the client or server co...
Definition types.h:859
const UA_DataType * types
Definition types.h:862
const struct UA_DataTypeArray * next
Definition types.h:860
const size_t typesSize
Definition types.h:861
UA_Byte isArray
Definition types.h:799
const UA_DataType * memberType
Definition types.h:790
UA_Byte padding
Definition types.h:791
UA_Byte isOptional
Definition types.h:800
UA_UInt32 overlayable
Definition types.h:851
UA_UInt32 typeKind
Definition types.h:848
UA_UInt32 pointerFree
Definition types.h:849
UA_UInt32 memSize
Definition types.h:847
UA_NodeId typeId
Definition types.h:844
UA_DataTypeMember * members
Definition types.h:854
UA_UInt32 membersSize
Definition types.h:853
UA_NodeId binaryEncodingId
Definition types.h:845
UA_Boolean hasSourcePicoseconds
Definition types.h:750
UA_Boolean hasServerTimestamp
Definition types.h:749
UA_UInt16 serverPicoseconds
Definition types.h:744
UA_DateTime serverTimestamp
Definition types.h:742
UA_UInt16 sourcePicoseconds
Definition types.h:743
UA_StatusCode status
Definition types.h:745
UA_Variant value
Definition types.h:740
UA_DateTime sourceTimestamp
Definition types.h:741
UA_Boolean hasStatus
Definition types.h:747
UA_Boolean hasSourceTimestamp
Definition types.h:748
UA_Boolean hasServerPicoseconds
Definition types.h:751
UA_Boolean hasValue
Definition types.h:746
Represents a Datetime as a structure.
Definition types.h:162
UA_UInt16 month
Definition types.h:170
UA_UInt16 milliSec
Definition types.h:165
UA_UInt16 min
Definition types.h:167
UA_Int16 year
Definition types.h:171
UA_UInt16 hour
Definition types.h:168
UA_UInt16 day
Definition types.h:169
UA_UInt16 nanoSec
Definition types.h:163
UA_UInt16 sec
Definition types.h:166
UA_UInt16 microSec
Definition types.h:164
The structure with the decoding options may be extended in the future.
Definition types.h:995
const UA_DataTypeArray * customTypes
Definition types.h:996
UA_Boolean hasNamespaceUri
Definition types.h:769
UA_Boolean hasInnerDiagnosticInfo
Definition types.h:774
UA_Boolean hasSymbolicId
Definition types.h:768
UA_String additionalInfo
Definition types.h:779
UA_Int32 locale
Definition types.h:778
UA_Int32 namespaceUri
Definition types.h:776
struct UA_DiagnosticInfo * innerDiagnosticInfo
Definition types.h:781
UA_Boolean hasLocale
Definition types.h:771
UA_Int32 localizedText
Definition types.h:777
UA_Boolean hasLocalizedText
Definition types.h:770
UA_Int32 symbolicId
Definition types.h:775
UA_Boolean hasInnerStatusCode
Definition types.h:773
UA_StatusCode innerStatusCode
Definition types.h:780
UA_Boolean hasAdditionalInfo
Definition types.h:772
UA_NodeId nodeId
Definition types.h:384
UA_UInt32 serverIndex
Definition types.h:386
UA_String namespaceUri
Definition types.h:385
UA_ExtensionObjectEncoding encoding
Definition types.h:702
const UA_DataType * type
Definition types.h:709
UA_NodeId typeId
Definition types.h:705
UA_ByteString body
Definition types.h:706
UA_UInt16 data2
Definition types.h:198
UA_UInt16 data3
Definition types.h:199
UA_UInt32 data1
Definition types.h:197
UA_String text
Definition types.h:513
UA_String locale
Definition types.h:512
enum UA_NodeIdType identifierType
Definition types.h:285
UA_Guid guid
Definition types.h:289
UA_String string
Definition types.h:288
UA_UInt16 namespaceIndex
Definition types.h:284
UA_ByteString byteString
Definition types.h:290
UA_UInt32 numeric
Definition types.h:287
UA_NumericRangeDimension * dimensions
Definition types.h:536
size_t dimensionsSize
Definition types.h:535
UA_String name
Definition types.h:482
UA_UInt16 namespaceIndex
Definition types.h:481
UA_Byte * data
Definition types.h:116
size_t length
Definition types.h:115
UA_VariantStorageType storageType
Definition types.h:564
const UA_DataType * type
Definition types.h:563
size_t arrayLength
Definition types.h:565
void * data
Definition types.h:566
UA_UInt32 * arrayDimensions
Definition types.h:568
size_t arrayDimensionsSize
Definition types.h:567
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.
int32_t UA_Int32
Definition types.h:51
UA_NodeIdType
Definition types.h:274
@ UA_NODEIDTYPE_STRING
Definition types.h:278
@ UA_NODEIDTYPE_GUID
Definition types.h:279
@ UA_NODEIDTYPE_BYTESTRING
Definition types.h:280
@ UA_NODEIDTYPE_NUMERIC
Definition types.h:275
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.
UA_String UA_ByteString
Definition types.h:224
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.
Definition types.h:26
uint16_t UA_UInt16
Definition types.h:46
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.
#define UA_DATETIME_SEC
Definition types.h:149
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
Definition types.h:691
@ UA_EXTENSIONOBJECT_ENCODED_XML
Definition types.h:694
@ UA_EXTENSIONOBJECT_ENCODED_BYTESTRING
Definition types.h:693
@ UA_EXTENSIONOBJECT_ENCODED_NOBODY
Definition types.h:692
@ UA_EXTENSIONOBJECT_DECODED
Definition types.h:695
@ UA_EXTENSIONOBJECT_DECODED_NODELETE
Definition types.h:696
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
Definition types.h:553
int16_t UA_Int16
Definition types.h:41
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...
Definition types.h:183
int8_t UA_SByte
Definition types.h:31
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)
uint32_t UA_UInt32
Definition types.h:56
UA_String UA_XmlElement
Definition types.h:271
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.
int64_t UA_DateTime
Definition types.h:144
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
Definition types.h:806
@ UA_DATATYPEKIND_INT64
Definition types.h:814
@ UA_DATATYPEKIND_FLOAT
Definition types.h:816
@ UA_DATATYPEKIND_STATUSCODE
Definition types.h:825
@ UA_DATATYPEKIND_INT32
Definition types.h:812
@ UA_DATATYPEKIND_BOOLEAN
Definition types.h:807
@ UA_DATATYPEKIND_BYTE
Definition types.h:809
@ UA_DATATYPEKIND_ENUM
Definition types.h:833
@ UA_DATATYPEKIND_GUID
Definition types.h:820
@ UA_DATATYPEKIND_EXPANDEDNODEID
Definition types.h:824
@ UA_DATATYPEKIND_UINT16
Definition types.h:811
@ UA_DATATYPEKIND_UNION
Definition types.h:836
@ UA_DATATYPEKIND_DATETIME
Definition types.h:819
@ UA_DATATYPEKIND_QUALIFIEDNAME
Definition types.h:826
@ UA_DATATYPEKIND_VARIANT
Definition types.h:830
@ UA_DATATYPEKIND_DATAVALUE
Definition types.h:829
@ UA_DATATYPEKIND_UINT64
Definition types.h:815
@ UA_DATATYPEKIND_NODEID
Definition types.h:823
@ UA_DATATYPEKIND_OPTSTRUCT
Definition types.h:835
@ UA_DATATYPEKIND_LOCALIZEDTEXT
Definition types.h:827
@ UA_DATATYPEKIND_STRING
Definition types.h:818
@ UA_DATATYPEKIND_INT16
Definition types.h:810
@ UA_DATATYPEKIND_XMLELEMENT
Definition types.h:822
@ UA_DATATYPEKIND_UINT32
Definition types.h:813
@ UA_DATATYPEKIND_DECIMAL
Definition types.h:832
@ UA_DATATYPEKIND_STRUCTURE
Definition types.h:834
@ UA_DATATYPEKIND_BYTESTRING
Definition types.h:821
@ UA_DATATYPEKIND_SBYTE
Definition types.h:808
@ UA_DATATYPEKIND_BITFIELDCLUSTER
Definition types.h:837
@ UA_DATATYPEKIND_DIAGNOSTICINFO
Definition types.h:831
@ UA_DATATYPEKIND_DOUBLE
Definition types.h:817
@ UA_DATATYPEKIND_EXTENSIONOBJECT
Definition types.h:828
UA_StatusCode UA_ByteString_toBase64(const UA_ByteString *bs, UA_String *output)
Converts a ByteString to the corresponding base64 representation.
float UA_Float
Definition types.h:71
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.
uint32_t UA_StatusCode
Definition types.h:77
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_VariantStorageType
Definition types.h:555
@ UA_VARIANT_DATA
Definition types.h:556
@ UA_VARIANT_DATA_NODELETE
Definition types.h:557
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.
double UA_Double
Definition types.h:74
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.
uint8_t UA_Byte
Definition types.h:36
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)
Definition types.h:137
UA_Order UA_ExpandedNodeId_order(const UA_ExpandedNodeId *n1, const UA_ExpandedNodeId *n2)
Total ordering of ExpandedNodeId.
uint64_t UA_UInt64
Definition types.h:66
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.
int64_t UA_Int64
Definition types.h:61
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.