open62541 1.4.15
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 * Copyright 2023 (c) Fraunhofer IOSB (Author: Andreas Ebner)
15 */
16
17#ifndef UA_TYPES_H_
18#define UA_TYPES_H_
19
20#include <open62541/config.h>
21#include <open62541/common.h>
23
25
26
27typedef bool UA_Boolean;
28#define UA_TRUE true UA_INTERNAL_DEPRECATED
29#define UA_FALSE false UA_INTERNAL_DEPRECATED
30
31
32typedef int8_t UA_SByte;
33#define UA_SBYTE_MIN (-128)
34#define UA_SBYTE_MAX 127
35
36
37typedef uint8_t UA_Byte;
38#define UA_BYTE_MIN 0
39#define UA_BYTE_MAX 255
40
41
42typedef int16_t UA_Int16;
43#define UA_INT16_MIN (-32768)
44#define UA_INT16_MAX 32767
45
46
47typedef uint16_t UA_UInt16;
48#define UA_UINT16_MIN 0
49#define UA_UINT16_MAX 65535
50
51
52typedef int32_t UA_Int32;
53#define UA_INT32_MIN ((int32_t)-2147483648LL)
54#define UA_INT32_MAX 2147483647L
55
56
57typedef uint32_t UA_UInt32;
58#define UA_UINT32_MIN 0
59#define UA_UINT32_MAX 4294967295UL
60
61
62typedef int64_t UA_Int64;
63#define UA_INT64_MAX (int64_t)9223372036854775807LL
64#define UA_INT64_MIN ((int64_t)-UA_INT64_MAX-1LL)
65
66
67typedef uint64_t UA_UInt64;
68#define UA_UINT64_MIN 0
69#define UA_UINT64_MAX (uint64_t)18446744073709551615ULL
70
71
72typedef float UA_Float;
73#define UA_FLOAT_MIN FLT_MIN
74#define UA_FLOAT_MAX FLT_MAX
75
76
77typedef double UA_Double;
78#define UA_DOUBLE_MIN DBL_MIN
79#define UA_DOUBLE_MAX DBL_MAX
80
81
82typedef uint32_t UA_StatusCode;
83
84/** Returns the human-readable name of the StatusCode. If no matching StatusCode
85 * is found, a default string for "Unknown" is returned. This feature might be
86 * disabled to create a smaller binary with the
87 * UA_ENABLE_STATUSCODE_DESCRIPTIONS build-flag. Then the function returns an
88 * empty string for every StatusCode. */
89UA_EXPORT const char *
91
92/** Extracts the severity from a StatusCode. See Part 4, Section 7.34 for
93 * details. */
95 UA_StatusCode_isBad(UA_StatusCode code), {
96 return ((code >> 30) >= 0x02);
97})
98
100 UA_StatusCode_isUncertain(UA_StatusCode code), {
101 return ((code >> 30) == 0x01);
102})
103
105 UA_StatusCode_isGood(UA_StatusCode code), {
106 return ((code >> 30) == 0x00);
107})
108
109/** Compares the top 16 bits of two StatusCodes for equality. This should only
110 * be used when processing user-defined StatusCodes e.g when processing a ReadResponse.
111 * As a convention, the lower bits of StatusCodes should not be used internally, meaning
112 * can compare them without the use of this function. */
114 UA_StatusCode_isEqualTop(UA_StatusCode s1, UA_StatusCode s2), {
115 return ((s1 & 0xFFFF0000) == (s2 & 0xFFFF0000));
116})
117
118
119typedef struct {
120 size_t length; /* The length of the string */
121 UA_Byte *data; /* The content (not null-terminated) */
122} UA_String;
123
124/** Copies the content on the heap. Returns a null-string when alloc fails */
126UA_String_fromChars(const char *src);
127
130
131UA_EXPORT extern const UA_String UA_STRING_NULL;
132
133
135 UA_STRING(char *chars), {
136 UA_String s;
137 memset(&s, 0, sizeof(s));
138 if(!chars)
139 return s;
140 s.length = strlen(chars); s.data = (UA_Byte*)chars;
141 return s;
142})
143
144#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
145
146/** Define strings at compile time (in ROM) */
147#define UA_STRING_STATIC(CHARS) {sizeof(CHARS)-1, (UA_Byte*)CHARS}
148
149
150
151typedef int64_t UA_DateTime;
152
153/** Multiples to convert durations to DateTime */
154#define UA_DATETIME_USEC 10LL
155#define UA_DATETIME_MSEC (UA_DATETIME_USEC * 1000LL)
156#define UA_DATETIME_SEC (UA_DATETIME_MSEC * 1000LL)
157
158/** The current time in UTC time */
159UA_DateTime UA_DateTime_now(void);
160
161/** Offset between local time and UTC time */
163
164/** CPU clock invariant to system time changes. Use only to measure durations,
165 * not absolute time. */
166UA_DateTime UA_DateTime_nowMonotonic(void);
167
168/** Represents a Datetime as a structure */
180
183
184/** The C99 standard (7.23.1) says: "The range and precision of times
185 * representable in clock_t and time_t are implementation-defined." On most
186 * systems, time_t is a 4 or 8 byte integer counting seconds since the UTC Unix
187 * epoch. The following methods are used for conversion. */
188
189/** Datetime of 1 Jan 1970 00:00 */
190#define UA_DATETIME_UNIX_EPOCH (11644473600LL * UA_DATETIME_SEC)
191
193 UA_DateTime_toUnixTime(UA_DateTime date), {
194 return (date - UA_DATETIME_UNIX_EPOCH) / UA_DATETIME_SEC;
195})
196
197UA_INLINABLE(UA_DateTime
198 UA_DateTime_fromUnixTime(UA_Int64 unixDate), {
199 return (unixDate * UA_DATETIME_SEC) + UA_DATETIME_UNIX_EPOCH;
200})
201
202
209
210UA_EXPORT extern const UA_Guid UA_GUID_NULL;
211
212/** Print a Guid in the human-readable format defined in Part 6, 5.1.3
213 *
214 * Format: C496578A-0DFE-4B8F-870A-745238C6AEAE
215 * | | | | | |
216 * 0 8 13 18 23 36
217 *
218 * This allocates memory if the output argument is an empty string. Tries to use
219 * the given buffer otherwise. */
222
223/** Parse the humand-readable Guid format */
224#ifdef UA_ENABLE_PARSING
226UA_Guid_parse(UA_Guid *guid, const UA_String str);
227
229 UA_GUID(const char *chars), {
231 UA_Guid_parse(&guid, UA_STRING((char*)(uintptr_t)chars));
232 return guid;
233})
234#endif
235
236
238
239UA_EXPORT extern const UA_ByteString UA_BYTESTRING_NULL;
240
241/** Allocates memory of size length for the bytestring.
242 * The content is not set to zero. */
245
246/** Converts a ByteString to the corresponding
247 * base64 representation */
250
251/** Parse a ByteString from a base64 representation */
254 const UA_String *input);
255
256#define UA_BYTESTRING(chars) UA_STRING(chars)
257#define UA_BYTESTRING_ALLOC(chars) UA_STRING_ALLOC(chars)
258
259/** Returns a non-cryptographic hash of a bytestring */
262 const UA_Byte *data, size_t size);
263
264
266
267
269 UA_NODEIDTYPE_NUMERIC = 0, /* In the binary encoding, this can also
270 * become 1 or 2 (two-byte and four-byte
271 * encoding of small numeric nodeids) */
276
287
288UA_EXPORT extern const UA_NodeId UA_NODEID_NULL;
289
291
292/** Print the NodeId in the human-readable format defined in Part 6,
293 * 5.3.1.10.
294 *
295 * Examples:
296 * UA_NODEID("i=13")
297 * UA_NODEID("ns=10;i=1")
298 * UA_NODEID("ns=10;s=Hello:World")
299 * UA_NODEID("g=09087e75-8e5e-499b-954f-f2a9603db28a")
300 * UA_NODEID("ns=1;b=b3BlbjYyNTQxIQ==") // base64
301 *
302 * The method can either use a pre-allocated string buffer or allocates memory
303 * internally if called with an empty output string. */
306
307/** Parse the human-readable NodeId format. Attention! String and
308 * ByteString NodeIds have their identifier malloc'ed and need to be
309 * cleaned up. */
310#ifdef UA_ENABLE_PARSING
312UA_NodeId_parse(UA_NodeId *id, const UA_String str);
313
315 UA_NODEID(const char *chars), {
317 UA_NodeId_parse(&id, UA_STRING((char*)(uintptr_t)chars));
318 return id;
319})
320#endif
321
322
324 UA_NODEID_NUMERIC(UA_UInt16 nsIndex,
325 UA_UInt32 identifier), {
327 memset(&id, 0, sizeof(UA_NodeId));
328 id.namespaceIndex = nsIndex;
329 id.identifierType = UA_NODEIDTYPE_NUMERIC;
330 id.identifier.numeric = identifier;
331 return id;
332})
333
335 UA_NODEID_STRING(UA_UInt16 nsIndex, char *chars), {
337 memset(&id, 0, sizeof(UA_NodeId));
338 id.namespaceIndex = nsIndex;
339 id.identifierType = UA_NODEIDTYPE_STRING;
340 id.identifier.string = UA_STRING(chars);
341 return id;
342})
343
345 UA_NODEID_STRING_ALLOC(UA_UInt16 nsIndex,
346 const char *chars), {
348 memset(&id, 0, sizeof(UA_NodeId));
349 id.namespaceIndex = nsIndex;
350 id.identifierType = UA_NODEIDTYPE_STRING;
351 id.identifier.string = UA_STRING_ALLOC(chars);
352 return id;
353})
354
356 UA_NODEID_GUID(UA_UInt16 nsIndex, UA_Guid guid), {
358 memset(&id, 0, sizeof(UA_NodeId));
359 id.namespaceIndex = nsIndex;
360 id.identifierType = UA_NODEIDTYPE_GUID;
361 id.identifier.guid = guid;
362 return id;
363})
364
366 UA_NODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars), {
368 memset(&id, 0, sizeof(UA_NodeId));
369 id.namespaceIndex = nsIndex;
370 id.identifierType = UA_NODEIDTYPE_BYTESTRING;
371 id.identifier.byteString = UA_BYTESTRING(chars);
372 return id;
373})
374
376 UA_NODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex,
377 const char *chars), {
379 memset(&id, 0, sizeof(UA_NodeId));
380 id.namespaceIndex = nsIndex;
381 id.identifierType = UA_NODEIDTYPE_BYTESTRING;
382 id.identifier.byteString = UA_BYTESTRING_ALLOC(chars);
383 return id;
384})
385
386/** Total ordering of NodeId */
388UA_NodeId_order(const UA_NodeId *n1, const UA_NodeId *n2);
389
390/** Returns a non-cryptographic hash for NodeId */
392
393
399
400UA_EXPORT extern const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL;
401
402/** Print the ExpandedNodeId in the humand-readable format defined in Part 6,
403 * 5.3.1.11:
404 *
405 * svr=<serverindex>;ns=<namespaceindex>;<type>=<value>
406 * or
407 * svr=<serverindex>;nsu=<uri>;<type>=<value>
408 *
409 * The definitions for svr, ns and nsu is omitted if zero / the empty string.
410 *
411 * The method can either use a pre-allocated string buffer or allocates memory
412 * internally if called with an empty output string. */
415
416/** Parse the human-readable NodeId format. Attention! String and
417 * ByteString NodeIds have their identifier malloc'ed and need to be
418 * cleaned up. */
419#ifdef UA_ENABLE_PARSING
421UA_ExpandedNodeId_parse(UA_ExpandedNodeId *id, const UA_String str);
422
424 UA_EXPANDEDNODEID(const char *chars), {
426 UA_ExpandedNodeId_parse(&id, UA_STRING((char*)(uintptr_t)chars));
427 return id;
428})
429#endif
430
431
433 UA_EXPANDEDNODEID_NUMERIC(UA_UInt16 nsIndex, UA_UInt32 identifier), {
434 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_NUMERIC(nsIndex, identifier);
435 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
436})
437
439 UA_EXPANDEDNODEID_STRING(UA_UInt16 nsIndex, char *chars), {
440 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_STRING(nsIndex, chars);
441 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
442})
443
445 UA_EXPANDEDNODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars), {
446 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_STRING_ALLOC(nsIndex, chars);
447 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
448})
449
451 UA_EXPANDEDNODEID_STRING_GUID(UA_UInt16 nsIndex, UA_Guid guid), {
452 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_GUID(nsIndex, guid);
453 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
454})
455
457 UA_EXPANDEDNODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars), {
458 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_BYTESTRING(nsIndex, chars);
459 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
460})
461
463 UA_EXPANDEDNODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex, const char *chars), {
464 UA_ExpandedNodeId id; id.nodeId = UA_NODEID_BYTESTRING_ALLOC(nsIndex, chars);
465 id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
466})
467
469 UA_EXPANDEDNODEID_NODEID(UA_NodeId nodeId), {
470 UA_ExpandedNodeId id; memset(&id, 0, sizeof(UA_ExpandedNodeId));
471 id.nodeId = nodeId; return id;
472})
473
474/** Does the ExpandedNodeId point to a local node? That is, are namespaceUri and
475 * serverIndex empty? */
477UA_ExpandedNodeId_isLocal(const UA_ExpandedNodeId *n);
478
479/** Total ordering of ExpandedNodeId */
482 const UA_ExpandedNodeId *n2);
483
484/** Returns a non-cryptographic hash for ExpandedNodeId. The hash of an
485 * ExpandedNodeId is identical to the hash of the embedded (simple) NodeId if
486 * the ServerIndex is zero and no NamespaceUri is set. */
489
490
495
497 UA_QualifiedName_isNull(const UA_QualifiedName *q), {
498 return (q->namespaceIndex == 0 && q->name.length == 0);
499})
500
501/** Returns a non-cryptographic hash for QualifiedName */
503UA_QualifiedName_hash(const UA_QualifiedName *q);
504
506 UA_QUALIFIEDNAME(UA_UInt16 nsIndex, char *chars), {
508 qn.namespaceIndex = nsIndex;
509 qn.name = UA_STRING(chars);
510 return qn;
511})
512
514 UA_QUALIFIEDNAME_ALLOC(UA_UInt16 nsIndex, const char *chars), {
516 qn.namespaceIndex = nsIndex;
518 return qn;
519})
520
521
526
528 UA_LOCALIZEDTEXT(char *locale, char *text), {
530 lt.locale = UA_STRING(locale);
531 lt.text = UA_STRING(text);
532 return lt;
533})
534
536 UA_LOCALIZEDTEXT_ALLOC(const char *locale, const char *text), {
539 lt.text = UA_STRING_ALLOC(text);
540 return lt;
541})
542
543
548
553
556
558 UA_NUMERICRANGE(const char *s), {
560 memset(&nr, 0, sizeof(nr));
561 UA_NumericRange_parse(&nr, UA_STRING((char*)(uintptr_t)s));
562 return nr;
563})
564
565
566/** Forward declaration. See the section on Generic Type Handling */
567struct UA_DataType;
569
570#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
571
572typedef enum {
573 UA_VARIANT_DATA, /* The data has the same lifecycle as the variant */
574 UA_VARIANT_DATA_NODELETE /* The data is "borrowed" by the variant and is
575 * not deleted when the variant is cleared up.
576 * The array dimensions also borrowed. */
578
579typedef struct {
580 const UA_DataType *type; /* The data type description */
582 size_t arrayLength; /* The number of elements in the data array */
583 void *data; /* Points to the scalar or array data */
584 size_t arrayDimensionsSize; /* The number of dimensions */
585 UA_UInt32 *arrayDimensions; /* The length of each dimension */
586} UA_Variant;
587
588/** Returns true if the variant has no value defined (contains neither an array
589 * nor a scalar value).
590 *
591 * @param v The variant
592 * @return Is the variant empty */
594 UA_Variant_isEmpty(const UA_Variant *v), {
595 return v->type == NULL;
596})
597
598/** Returns true if the variant contains a scalar value. Note that empty variants
599 * contain an array of length -1 (undefined).
600 *
601 * @param v The variant
602 * @return Does the variant contain a scalar value */
604 UA_Variant_isScalar(const UA_Variant *v), {
605 return (v->arrayLength == 0 && v->data > UA_EMPTY_ARRAY_SENTINEL);
606})
607
608/** Returns true if the variant contains a scalar value of the given type.
609 *
610 * @param v The variant
611 * @param type The data type
612 * @return Does the variant contain a scalar value of the given type */
614 UA_Variant_hasScalarType(const UA_Variant *v,
615 const UA_DataType *type), {
616 return UA_Variant_isScalar(v) && type == v->type;
617})
618
619/** Returns true if the variant contains an array of the given type.
620 *
621 * @param v The variant
622 * @param type The data type
623 * @return Does the variant contain an array of the given type */
625 UA_Variant_hasArrayType(const UA_Variant *v,
626 const UA_DataType *type), {
627 return (!UA_Variant_isScalar(v)) && type == v->type;
628})
629
630/** Set the variant to a scalar value that already resides in memory. The value
631 * takes on the lifecycle of the variant and is deleted with it.
632 *
633 * @param v The variant
634 * @param p A pointer to the value data
635 * @param type The datatype of the value in question */
636void
638 const UA_DataType *type);
639
640/** Set the variant to a scalar value that is copied from an existing variable.
641 * @param v The variant
642 * @param p A pointer to the value data
643 * @param type The datatype of the value
644 * @return Indicates whether the operation succeeded or returns an error code */
647 const UA_DataType *type);
648
649/** Set the variant to an array that already resides in memory. The array takes
650 * on the lifecycle of the variant and is deleted with it.
651 *
652 * @param v The variant
653 * @param array A pointer to the array data
654 * @param arraySize The size of the array
655 * @param type The datatype of the array */
656void
658 size_t arraySize, const UA_DataType *type);
659
660/** Set the variant to an array that is copied from an existing array.
661 *
662 * @param v The variant
663 * @param array A pointer to the array data
664 * @param arraySize The size of the array
665 * @param type The datatype of the array
666 * @return Indicates whether the operation succeeded or returns an error code */
669 size_t arraySize, const UA_DataType *type);
670
671/** Copy the variant, but use only a subset of the (multidimensional) array into
672 * a variant. Returns an error code if the variant is not an array or if the
673 * indicated range does not fit.
674 *
675 * @param src The source variant
676 * @param dst The target variant
677 * @param range The range of the copied data
678 * @return Returns UA_STATUSCODE_GOOD or an error code */
681 const UA_NumericRange range);
682
683/** Insert a range of data into an existing variant. The data array cannot be
684 * reused afterwards if it contains types without a fixed size (e.g. strings)
685 * since the members are moved into the variant and take on its lifecycle.
686 *
687 * @param v The variant
688 * @param dataArray The data array. The type must match the variant
689 * @param dataArraySize The length of the data array. This is checked to match
690 * the range size.
691 * @param range The range of where the new data is inserted
692 * @return Returns UA_STATUSCODE_GOOD or an error code */
695 size_t arraySize, const UA_NumericRange range);
696
697/** Deep-copy a range of data into an existing variant.
698 *
699 * @param v The variant
700 * @param dataArray The data array. The type must match the variant
701 * @param dataArraySize The length of the data array. This is checked to match
702 * the range size.
703 * @param range The range of where the new data is inserted
704 * @return Returns UA_STATUSCODE_GOOD or an error code */
707 size_t arraySize, const UA_NumericRange range);
708
709
719
720typedef struct {
722 union {
723 struct {
724 UA_NodeId typeId; /* The nodeid of the datatype */
725 UA_ByteString body; /* The bytestring of the encoded data */
726 } encoded;
727 struct {
729 void *data;
730 } decoded;
731 } content;
733
734/** Initialize the ExtensionObject and set the "decoded" value to the given
735 * pointer. The value will be deleted when the ExtensionObject is cleared. */
736void
738 void *p,
739 const UA_DataType *type);
740
741/** Initialize the ExtensionObject and set the "decoded" value to the given
742 * pointer. The value will *not* be deleted when the ExtensionObject is
743 * cleared. */
744void
746 void *p,
747 const UA_DataType *type);
748
749/** Initialize the ExtensionObject and set the "decoded" value to a fresh copy of
750 * the given value pointer. The value will be deleted when the ExtensionObject
751 * is cleared. */
754 void *p,
755 const UA_DataType *type);
756
757
772
773/** Copy the DataValue, but use only a subset of the (multidimensional) array of
774 * of the variant of the source DataValue. Returns an error code if the variant
775 * of the DataValue is not an array or if the indicated range does not fit.
776 *
777 * @param src The source DataValue
778 * @param dst The target DataValue
779 * @param range The range of the variant of the DataValue to copy
780 * @return Returns UA_STATUSCODE_GOOD or an error code */
783 const UA_NumericRange range);
784
785
802
803
804
805typedef struct {
806#ifdef UA_ENABLE_TYPEDESCRIPTION
807 const char *memberName; /* Human-readable member name */
808#endif
809 const UA_DataType *memberType;/* The member data type description */
810 UA_Byte padding : 6; /* How much padding is there before this
811 member element? For arrays this is the
812 padding before the size_t length member.
813 (No padding between size_t and the
814 following ptr.) For unions, the padding
815 includes the size of the switchfield (the
816 offset from the start of the union
817 type). */
818 UA_Byte isArray : 1; /* The member is an array */
819 UA_Byte isOptional : 1; /* The member is an optional field */
821
822/** The DataType "kind" is an internal type classification. It is used to
823 * dispatch handling to the correct routines. */
824#define UA_DATATYPEKINDS 31
858
860#ifdef UA_ENABLE_TYPEDESCRIPTION
861 const char *typeName;
862#endif
863 UA_NodeId typeId; /* The nodeid of the type */
864 UA_NodeId binaryEncodingId; /* NodeId of datatype when encoded as binary */
865 //UA_NodeId xmlEncodingId; /* NodeId of datatype when encoded as XML */
866 UA_UInt32 memSize : 16; /* Size of the struct in memory */
867 UA_UInt32 typeKind : 6; /* Dispatch index for the handling routines */
868 UA_UInt32 pointerFree : 1; /* The type (and its members) contains no
869 * pointers that need to be freed */
870 UA_UInt32 overlayable : 1; /* The type has the identical memory layout
871 * in memory and on the binary stream. */
872 UA_UInt32 membersSize : 8; /* How many members does the type have? */
874};
875
876/** Datatype arrays with custom type definitions can be added in a linked list to
877 * the client or server configuration. */
878typedef struct UA_DataTypeArray {
879 const struct UA_DataTypeArray *next;
880 const size_t typesSize;
882 UA_Boolean cleanup; /* Free the array structure and its content
883 when the client or server configuration
884 containing it is cleaned up */
886
887/** Returns the offset and type of a structure member. The return value is false
888 * if the member was not found.
889 *
890 * If the member is an array, the offset points to the (size_t) length field.
891 * (The array pointer comes after the length field without any padding.) */
892#ifdef UA_ENABLE_TYPEDESCRIPTION
895 const char *memberName,
896 size_t *outOffset,
897 const UA_DataType **outMemberType,
898 UA_Boolean *outIsArray);
899#endif
900
901/** Test if the data type is a numeric builtin data type (via the typeKind field
902 * of UA_DataType). This includes integers and floating point numbers. Not
903 * included are Boolean, DateTime, StatusCode and Enums. */
906
907
908
909/** Returns the data type description for the type's identifier or NULL if no
910 * matching data type was found. */
911const UA_DataType *
913
914/*
915 * Add custom data types to the search scope of UA_findDataType. */
916
917const UA_DataType *
919 const UA_DataTypeArray *customTypes);
920
921
922
923/** Allocates and initializes a variable of type dataType
924 *
925 * @param type The datatype description
926 * @return Returns the memory location of the variable or NULL if no
927 * memory could be allocated */
928void * UA_new(const UA_DataType *type);
929
930/** Initializes a variable to default values
931 *
932 * @param p The memory location of the variable
933 * @param type The datatype description */
935 UA_init(void *p, const UA_DataType *type), {
936 memset(p, 0, type->memSize);
937})
938
939/** Copies the content of two variables. If copying fails (e.g. because no memory
940 * was available for an array), then dst is emptied and initialized to prevent
941 * memory leaks.
942 *
943 * @param src The memory location of the source variable
944 * @param dst The memory location of the destination variable
945 * @param type The datatype description
946 * @return Indicates whether the operation succeeded or returns an error code */
948UA_copy(const void *src, void *dst, const UA_DataType *type);
949
950/** Deletes the dynamically allocated content of a variable (e.g. resets all
951 * arrays to undefined arrays). Afterwards, the variable can be safely deleted
952 * without causing memory leaks. But the variable is not initialized and may
953 * contain old data that is not memory-relevant.
954 *
955 * @param p The memory location of the variable
956 * @param type The datatype description of the variable */
957void UA_clear(void *p, const UA_DataType *type);
958
959#define UA_deleteMembers(p, type) UA_clear(p, type)
960
961/** Frees a variable and all of its content.
962 *
963 * @param p The memory location of the variable
964 * @param type The datatype description of the variable */
965void UA_delete(void *p, const UA_DataType *type);
966
967/** Pretty-print the value from the datatype. The output is pretty-printed JSON5.
968 * Note that this format is non-standard and should not be sent over the
969 * network. It can however be read by our own JSON decoding.
970 *
971 * @param p The memory location of the variable
972 * @param type The datatype description of the variable
973 * @param output A string that is used for the pretty-printed output. If the
974 * memory for string is already allocated, we try to use the existing
975 * string (the length is adjusted). If the string is empty, memory
976 * is allocated for it.
977 * @return Indicates whether the operation succeeded */
978#ifdef UA_ENABLE_JSON_ENCODING
980UA_print(const void *p, const UA_DataType *type, UA_String *output);
981#endif
982
983/** Compare two values and return their order.
984 *
985 * For numerical types (including StatusCodes and Enums), their natural order is
986 * used. NaN is the "smallest" value for floating point values. Different bit
987 * representations of NaN are considered identical.
988 *
989 * All other types have *some* absolute ordering so that a < b, b < c -> a < c.
990 *
991 * The ordering of arrays (also strings) is in "shortlex": A shorter array is
992 * always smaller than a longer array. Otherwise the first different element
993 * defines the order.
994 *
995 * When members of different types are permitted (in Variants and
996 * ExtensionObjects), the memory address in the "UA_DataType*" pointer
997 * determines which variable is smaller.
998 *
999 * @param p1 The memory location of the first value
1000 * @param p2 The memory location of the first value
1001 * @param type The datatype description of both values */
1003UA_order(const void *p1, const void *p2, const UA_DataType *type);
1004
1005/** Compare if two values have identical content. */
1007 UA_equal(const void *p1, const void *p2, const UA_DataType *type), {
1008 return (UA_order(p1, p2, type) == UA_ORDER_EQ);
1009})
1010
1011
1012
1013/** Returns the number of bytes the value p takes in binary encoding. Returns
1014 * zero if an error occurs. */
1015UA_EXPORT size_t
1016UA_calcSizeBinary(const void *p, const UA_DataType *type);
1017
1018/** Encodes a data-structure in the binary format. If outBuf has a length of
1019 * zero, a buffer of the required size is allocated. Otherwise, encoding into
1020 * the existing outBuf is attempted (and may fail if the buffer is too
1021 * small). */
1022UA_EXPORT UA_StatusCode
1023UA_encodeBinary(const void *p, const UA_DataType *type,
1024 UA_ByteString *outBuf);
1025
1026/** The structure with the decoding options may be extended in the future.
1027 * Zero-out the entire structure initially to ensure code-compatibility when
1028 * more fields are added in a later release. */
1029typedef struct {
1030 const UA_DataTypeArray *customTypes; /* Begin of a linked list with custom
1031 * datatype definitions */
1033
1034/** Decodes a data structure from the input buffer in the binary format. It is
1035 * assumed that `p` points to valid memory (not necessarily zeroed out). The
1036 * options can be NULL and will be disregarded in that case. */
1037UA_EXPORT UA_StatusCode
1039 void *p, const UA_DataType *type,
1040 const UA_DecodeBinaryOptions *options);
1041
1042
1043
1044#ifdef UA_ENABLE_JSON_ENCODING
1045
1046typedef struct {
1047 const UA_String *namespaces;
1048 size_t namespacesSize;
1049 const UA_String *serverUris;
1050 size_t serverUrisSize;
1051 UA_Boolean useReversible;
1052
1053 UA_Boolean prettyPrint; /* Add newlines and spaces for legibility */
1054
1055 /* Enabling the following options leads to non-standard compatible JSON5
1056 * encoding! Use it for pretty-printing, but not for sending messages over
1057 * the network. (Our own decoding can still parse it.) */
1058
1059 UA_Boolean unquotedKeys; /* Don't print quotes around object element keys */
1060 UA_Boolean stringNodeIds; /* String encoding for NodeIds, like "ns=1;i=42" */
1061} UA_EncodeJsonOptions;
1062
1063/** Returns the number of bytes the value src takes in json encoding. Returns
1064 * zero if an error occurs. */
1065UA_EXPORT size_t
1066UA_calcSizeJson(const void *src, const UA_DataType *type,
1067 const UA_EncodeJsonOptions *options);
1068
1069/** Encodes the scalar value described by type to json encoding.
1070 *
1071 * @param src The value. Must not be NULL.
1072 * @param type The value type. Must not be NULL.
1073 * @param outBuf Pointer to ByteString containing the result if the encoding
1074 * was successful
1075 * @return Returns a statuscode whether encoding succeeded. */
1077UA_encodeJson(const void *src, const UA_DataType *type, UA_ByteString *outBuf,
1078 const UA_EncodeJsonOptions *options);
1079
1080/** The structure with the decoding options may be extended in the future.
1081 * Zero-out the entire structure initially to ensure code-compatibility when
1082 * more fields are added in a later release. */
1083typedef struct {
1084 const UA_String *namespaces;
1085 size_t namespacesSize;
1086 const UA_String *serverUris;
1087 size_t serverUrisSize;
1088 const UA_DataTypeArray *customTypes; /* Begin of a linked list with custom
1089 * datatype definitions */
1090} UA_DecodeJsonOptions;
1091
1092/** Decodes a scalar value described by type from json encoding.
1093 *
1094 * @param src The buffer with the json encoded value. Must not be NULL.
1095 * @param dst The target value. Must not be NULL. The target is assumed to have
1096 * size type->memSize. The value is reset to zero before decoding. If
1097 * decoding fails, members are deleted and the value is reset (zeroed)
1098 * again.
1099 * @param type The value type. Must not be NULL.
1100 * @param options The options struct for decoding, currently unused
1101 * @return Returns a statuscode whether decoding succeeded. */
1103UA_decodeJson(const UA_ByteString *src, void *dst, const UA_DataType *type,
1104 const UA_DecodeJsonOptions *options);
1105
1106#endif /* UA_ENABLE_JSON_ENCODING */
1107
1108
1109
1110#ifdef UA_ENABLE_XML_ENCODING
1111
1112typedef struct {
1113 UA_Boolean prettyPrint; /* Add newlines and spaces for legibility */
1114} UA_EncodeXmlOptions;
1115
1116/** Returns the number of bytes the value src takes in xml encoding. Returns
1117 * zero if an error occurs. */
1118UA_EXPORT size_t
1119UA_calcSizeXml(const void *src, const UA_DataType *type,
1120 const UA_EncodeXmlOptions *options);
1121
1122/** Encodes the scalar value described by type to xml encoding.
1123 *
1124 * @param src The value. Must not be NULL.
1125 * @param type The value type. Must not be NULL.
1126 * @param outBuf Pointer to ByteString containing the result if the encoding
1127 * was successful
1128 * @return Returns a statuscode whether encoding succeeded. */
1130UA_encodeXml(const void *src, const UA_DataType *type, UA_ByteString *outBuf,
1131 const UA_EncodeXmlOptions *options);
1132
1133/** The structure with the decoding options may be extended in the future.
1134 * Zero-out the entire structure initially to ensure code-compatibility when
1135 * more fields are added in a later release. */
1136typedef struct {
1137 const UA_DataTypeArray *customTypes; /* Begin of a linked list with custom
1138 * datatype definitions */
1139} UA_DecodeXmlOptions;
1140
1141/** Decodes a scalar value described by type from xml encoding.
1142 *
1143 * @param src The buffer with the xml encoded value. Must not be NULL.
1144 * @param dst The target value. Must not be NULL. The target is assumed to have
1145 * size type->memSize. The value is reset to zero before decoding. If
1146 * decoding fails, members are deleted and the value is reset (zeroed)
1147 * again.
1148 * @param type The value type. Must not be NULL.
1149 * @param options The options struct for decoding, currently unused
1150 * @return Returns a statuscode whether decoding succeeded. */
1152UA_decodeXml(const UA_ByteString *src, void *dst, const UA_DataType *type,
1153 const UA_DecodeXmlOptions *options);
1154
1155#endif /* UA_ENABLE_XML_ENCODING */
1156
1157
1158
1159/** Allocates and initializes an array of variables of a specific type
1160 *
1161 * @param size The requested array length
1162 * @param type The datatype description
1163 * @return Returns the memory location of the variable or NULL if no memory
1164 * could be allocated */
1165void *
1166UA_Array_new(size_t size, const UA_DataType *type);
1167
1168/** Allocates and copies an array
1169 *
1170 * @param src The memory location of the source array
1171 * @param size The size of the array
1172 * @param dst The location of the pointer to the new array
1173 * @param type The datatype of the array members
1174 * @return Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY */
1176UA_Array_copy(const void *src, size_t size, void **dst,
1177 const UA_DataType *type);
1178
1179/** Resizes (and reallocates) an array. The last entries are initialized to zero
1180 * if the array length is increased. If the array length is decreased, the last
1181 * entries are removed if the size is decreased.
1182 *
1183 * @param p Double pointer to the array memory. Can be overwritten by the result
1184 * of a realloc.
1185 * @param size The current size of the array. Overwritten in case of success.
1186 * @param newSize The new size of the array
1187 * @param type The datatype of the array members
1188 * @return Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY. The
1189 * original array is left untouched in the failure case. */
1191UA_Array_resize(void **p, size_t *size, size_t newSize,
1192 const UA_DataType *type);
1193
1194/** Append the given element at the end of the array. The content is moved
1195 * (shallow copy) and the original memory is _init'ed if appending is
1196 * successful.
1197 *
1198 * @param p Double pointer to the array memory. Can be overwritten by the result
1199 * of a realloc.
1200 * @param size The current size of the array. Overwritten in case of success.
1201 * @param newElem The element to be appended. The memory is reset upon success.
1202 * @param type The datatype of the array members
1203 * @return Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY. The
1204 * original array is left untouched in the failure case. */
1206UA_Array_append(void **p, size_t *size, void *newElem,
1207 const UA_DataType *type);
1208
1209/** Append a copy of the given element at the end of the array.
1210 *
1211 * @param p Double pointer to the array memory. Can be overwritten by the result
1212 * of a realloc.
1213 * @param size The current size of the array. Overwritten in case of success.
1214 * @param newElem The element to be appended.
1215 * @param type The datatype of the array members
1216 * @return Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY. The
1217 * original array is left untouched in the failure case. */
1218
1220UA_Array_appendCopy(void **p, size_t *size, const void *newElem,
1221 const UA_DataType *type);
1222
1223/** Deletes an array.
1224 *
1225 * @param p The memory location of the array
1226 * @param size The size of the array
1227 * @param type The datatype of the array members */
1228void
1229UA_Array_delete(void *p, size_t size, const UA_DataType *type);
1230
1231
1232
1233/** stop-doc-generation */
1234
1235/** Helper used to exclude type names in the definition of UA_DataType structures
1236 * if the feature is disabled. */
1237#ifdef UA_ENABLE_TYPEDESCRIPTION
1238# define UA_TYPENAME(name) name,
1239#else
1240# define UA_TYPENAME(name)
1241#endif
1242
1245
1247
1248#endif /* UA_TYPES_H_ */
UA_Order
Definition common.h:114
@ UA_ORDER_EQ
Definition common.h:116
#define UA_INLINABLE(decl, impl)
An inlinable method is typically defined as "static inline".
Definition config.h:169
#define endif
#define _UA_BEGIN_DECLS
#undef UA_DEBUG_DUMP_PKGS
Definition config.h:100
#define _UA_END_DECLS
Definition config.h:107
Datatype arrays with custom type definitions can be added in a linked list to the client or server co...
Definition types.h:878
const UA_DataType * types
Definition types.h:881
const struct UA_DataTypeArray * next
Definition types.h:879
UA_Boolean cleanup
Definition types.h:882
const size_t typesSize
Definition types.h:880
UA_Byte isArray
Definition types.h:818
const UA_DataType * memberType
Definition types.h:809
const char * memberName
Definition types.h:807
UA_Byte padding
Definition types.h:810
UA_Byte isOptional
Definition types.h:819
UA_UInt32 overlayable
Definition types.h:870
UA_UInt32 typeKind
Definition types.h:867
const char * typeName
Definition types.h:861
UA_UInt32 pointerFree
Definition types.h:868
UA_UInt32 memSize
Definition types.h:866
UA_NodeId typeId
Definition types.h:863
UA_DataTypeMember * members
Definition types.h:873
UA_UInt32 membersSize
Definition types.h:872
UA_NodeId binaryEncodingId
Definition types.h:864
UA_Boolean hasSourcePicoseconds
Definition types.h:769
UA_Boolean hasServerTimestamp
Definition types.h:768
UA_UInt16 serverPicoseconds
Definition types.h:763
UA_DateTime serverTimestamp
Definition types.h:761
UA_UInt16 sourcePicoseconds
Definition types.h:762
UA_StatusCode status
Definition types.h:764
UA_Variant value
Definition types.h:759
UA_DateTime sourceTimestamp
Definition types.h:760
UA_Boolean hasStatus
Definition types.h:766
UA_Boolean hasSourceTimestamp
Definition types.h:767
UA_Boolean hasServerPicoseconds
Definition types.h:770
UA_Boolean hasValue
Definition types.h:765
Represents a Datetime as a structure.
Definition types.h:169
UA_UInt16 month
Definition types.h:177
UA_UInt16 milliSec
Definition types.h:172
UA_UInt16 min
Definition types.h:174
UA_Int16 year
Definition types.h:178
UA_UInt16 hour
Definition types.h:175
UA_UInt16 day
Definition types.h:176
UA_UInt16 nanoSec
Definition types.h:170
UA_UInt16 sec
Definition types.h:173
UA_UInt16 microSec
Definition types.h:171
The structure with the decoding options may be extended in the future.
Definition types.h:1029
const UA_DataTypeArray * customTypes
Definition types.h:1030
UA_Boolean hasNamespaceUri
Definition types.h:788
UA_Boolean hasInnerDiagnosticInfo
Definition types.h:793
UA_Boolean hasSymbolicId
Definition types.h:787
UA_String additionalInfo
Definition types.h:798
UA_Int32 locale
Definition types.h:797
UA_Int32 namespaceUri
Definition types.h:795
struct UA_DiagnosticInfo * innerDiagnosticInfo
Definition types.h:800
UA_Boolean hasLocale
Definition types.h:790
UA_Int32 localizedText
Definition types.h:796
UA_Boolean hasLocalizedText
Definition types.h:789
UA_Int32 symbolicId
Definition types.h:794
UA_Boolean hasInnerStatusCode
Definition types.h:792
UA_StatusCode innerStatusCode
Definition types.h:799
UA_Boolean hasAdditionalInfo
Definition types.h:791
UA_NodeId nodeId
Definition types.h:395
UA_UInt32 serverIndex
Definition types.h:397
UA_String namespaceUri
Definition types.h:396
UA_ExtensionObjectEncoding encoding
Definition types.h:721
const UA_DataType * type
Definition types.h:728
UA_NodeId typeId
Definition types.h:724
UA_ByteString body
Definition types.h:725
UA_UInt16 data2
Definition types.h:205
UA_UInt16 data3
Definition types.h:206
UA_UInt32 data1
Definition types.h:204
UA_String text
Definition types.h:524
UA_String locale
Definition types.h:523
enum UA_NodeIdType identifierType
Definition types.h:279
UA_Guid guid
Definition types.h:283
UA_String string
Definition types.h:282
UA_UInt16 namespaceIndex
Definition types.h:278
UA_ByteString byteString
Definition types.h:284
UA_UInt32 numeric
Definition types.h:281
UA_NumericRangeDimension * dimensions
Definition types.h:551
size_t dimensionsSize
Definition types.h:550
UA_String name
Definition types.h:493
UA_UInt16 namespaceIndex
Definition types.h:492
UA_Byte * data
Definition types.h:121
size_t length
Definition types.h:120
UA_VariantStorageType storageType
Definition types.h:581
const UA_DataType * type
Definition types.h:580
size_t arrayLength
Definition types.h:582
void * data
Definition types.h:583
UA_UInt32 * arrayDimensions
Definition types.h:585
size_t arrayDimensionsSize
Definition types.h:584
int32_t UA_Int32
Definition types.h:52
char id nodeId
Definition types.h:440
UA_NodeIdType
Definition types.h:268
@ UA_NODEIDTYPE_STRING
Definition types.h:272
@ UA_NODEIDTYPE_GUID
Definition types.h:273
@ UA_NODEIDTYPE_BYTESTRING
Definition types.h:274
@ UA_NODEIDTYPE_NUMERIC
Definition types.h:269
void UA_ExtensionObject_setValue(UA_ExtensionObject *eo, void *p, const UA_DataType *type)
Initialize the ExtensionObject and set the "decoded" value to the given pointer.
void UA_Array_delete(void *p, size_t size, const UA_DataType *type)
Deletes an array.
_UA_BEGIN_DECLS typedef bool UA_Boolean
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition types.h:27
uint16_t UA_UInt16
Definition types.h:47
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.
UA_UInt32 UA_NodeId_hash(const UA_NodeId *n)
Returns a non-cryptographic hash for NodeId.
#define UA_BYTESTRING_ALLOC(chars)
Definition types.h:257
#define UA_DATETIME_SEC
Definition types.h:156
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:710
@ UA_EXTENSIONOBJECT_ENCODED_XML
Definition types.h:713
@ UA_EXTENSIONOBJECT_ENCODED_BYTESTRING
Definition types.h:712
@ UA_EXTENSIONOBJECT_ENCODED_NOBODY
Definition types.h:711
@ UA_EXTENSIONOBJECT_DECODED
Definition types.h:714
@ UA_EXTENSIONOBJECT_DECODED_NODELETE
Definition types.h:715
UA_EXPORT const UA_Guid UA_GUID_NULL
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:
#define UA_EMPTY_ARRAY_SENTINEL
Definition types.h:570
int16_t UA_Int16
Definition types.h:42
UA_StatusCode UA_Array_resize(void **p, size_t *size, size_t newSize, const UA_DataType *type)
Resizes (and reallocates) an array.
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.
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_StatusCode s2
Definition types.h:114
UA_DateTime UA_DateTime_fromStruct(UA_DateTimeStruct ts)
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.
#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:190
return id
Definition types.h:341
int8_t UA_SByte
Definition types.h:32
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.
return lt
Definition types.h:540
const char lt locale
Definition types.h:538
UA_StatusCode UA_ByteString_fromBase64(UA_ByteString *bs, const UA_String *input)
Parse a ByteString from a base64 representation.
UA_Boolean UA_NodeId_isNull(const UA_NodeId *p)
uint32_t UA_UInt32
Definition types.h:57
UA_String UA_XmlElement
Definition types.h:265
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.
UA_Guid guid
Definition types.h:356
void * dst
Definition types.h:948
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.
UA_EXPORT const char * UA_StatusCode_name(UA_StatusCode code)
Returns the human-readable name of the StatusCode.
char * chars
Definition types.h:335
UA_DataTypeKind
Definition types.h:825
@ UA_DATATYPEKIND_INT64
Definition types.h:833
@ UA_DATATYPEKIND_FLOAT
Definition types.h:835
@ UA_DATATYPEKIND_STATUSCODE
Definition types.h:844
@ UA_DATATYPEKIND_INT32
Definition types.h:831
@ UA_DATATYPEKIND_BOOLEAN
Definition types.h:826
@ UA_DATATYPEKIND_BYTE
Definition types.h:828
@ UA_DATATYPEKIND_ENUM
Definition types.h:852
@ UA_DATATYPEKIND_GUID
Definition types.h:839
@ UA_DATATYPEKIND_EXPANDEDNODEID
Definition types.h:843
@ UA_DATATYPEKIND_UINT16
Definition types.h:830
@ UA_DATATYPEKIND_UNION
Definition types.h:855
@ UA_DATATYPEKIND_DATETIME
Definition types.h:838
@ UA_DATATYPEKIND_QUALIFIEDNAME
Definition types.h:845
@ UA_DATATYPEKIND_VARIANT
Definition types.h:849
@ UA_DATATYPEKIND_DATAVALUE
Definition types.h:848
@ UA_DATATYPEKIND_UINT64
Definition types.h:834
@ UA_DATATYPEKIND_NODEID
Definition types.h:842
@ UA_DATATYPEKIND_OPTSTRUCT
Definition types.h:854
@ UA_DATATYPEKIND_LOCALIZEDTEXT
Definition types.h:846
@ UA_DATATYPEKIND_STRING
Definition types.h:837
@ UA_DATATYPEKIND_INT16
Definition types.h:829
@ UA_DATATYPEKIND_XMLELEMENT
Definition types.h:841
@ UA_DATATYPEKIND_UINT32
Definition types.h:832
@ UA_DATATYPEKIND_DECIMAL
Definition types.h:851
@ UA_DATATYPEKIND_STRUCTURE
Definition types.h:853
@ UA_DATATYPEKIND_BYTESTRING
Definition types.h:840
@ UA_DATATYPEKIND_SBYTE
Definition types.h:827
@ UA_DATATYPEKIND_BITFIELDCLUSTER
Definition types.h:856
@ UA_DATATYPEKIND_DIAGNOSTICINFO
Definition types.h:850
@ UA_DATATYPEKIND_DOUBLE
Definition types.h:836
@ UA_DATATYPEKIND_EXTENSIONOBJECT
Definition types.h:847
UA_StatusCode UA_ByteString_toBase64(const UA_ByteString *bs, UA_String *output)
Converts a ByteString to the corresponding base64 representation.
const UA_DataType * UA_findDataTypeWithCustom(const UA_NodeId *typeId, const UA_DataTypeArray *customTypes)
const char * text
Definition types.h:536
float UA_Float
Definition types.h:72
uint32_t UA_StatusCode
Definition types.h:82
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.
UA_EXPORT const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL
UA_VariantStorageType
Definition types.h:572
@ UA_VARIANT_DATA
Definition types.h:573
@ UA_VARIANT_DATA_NODELETE
Definition types.h:574
#define UA_BYTESTRING(chars)
Definition types.h:256
double UA_Double
Definition types.h:77
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)
Test if the data type is a numeric builtin data type (via the typeKind field of UA_DataType).
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:37
UA_StatusCode UA_Array_append(void **p, size_t *size, void *newElem, const UA_DataType *type)
Append the given element at the end of the array.
#define UA_STRING_ALLOC(CHARS)
UA_Order UA_ExpandedNodeId_order(const UA_ExpandedNodeId *n1, const UA_ExpandedNodeId *n2)
Total ordering of ExpandedNodeId.
uint64_t UA_UInt64
Definition types.h:67
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:62
UA_String UA_String_fromChars(const char *src)
Copies the content on the heap.
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.
return qn
Definition types.h:518
UA_Boolean UA_String_isEmpty(const UA_String *s)
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.
const UA_DataType * type
Definition types.h:626