datatypes.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. Data Types
  2. ==========
  3. Introduction
  4. ------------
  5. In open62541, all data types share the same basic API for creation, copying and
  6. deletion. The following functions are present for all data types ``T``.
  7. ``void T_init(T *ptr)``
  8. Initialize the data type. This is synonymous with zeroing out the memory, i.e. *memset(dataptr, 0, sizeof(T))*.
  9. ``T* T_new()``
  10. Allocate and return the memory for the data type. The memory is already initialized.
  11. ``UA_StatusCode T_copy(const T *src, T *dst)``
  12. Copy the content of the data type. Returns *UA_STATUSCODE_GOOD* if it succeeded.
  13. ``void T_deleteMembers(T *ptr)``
  14. Delete the dynamically allocated content of the data type, but not the data type itself.
  15. ``void T_delete(T *ptr)``
  16. Delete the content of the data type and the memory for the data type itself.
  17. The builtin data types
  18. ----------------------
  19. OPC UA defines 25 builtin data types. All other data types are combinations of
  20. the 25 builtin data types.
  21. UA_Boolean
  22. ^^^^^^^^^^
  23. A two-state logical value (true or false).
  24. .. code-block:: c
  25. typedef bool UA_Boolean;
  26. #define UA_TRUE true
  27. #define UA_FALSE false
  28. UA_SByte
  29. ^^^^^^^^
  30. An integer value between -128 and 127.
  31. .. code-block:: c
  32. typedef int8_t UA_SByte;
  33. UA_Byte
  34. ^^^^^^^
  35. An integer value between 0 and 256.
  36. .. code-block:: c
  37. typedef uint8_t UA_Byte;
  38. UA_Int16
  39. ^^^^^^^^
  40. An integer value between -32,768 and 32,767.
  41. .. code-block:: c
  42. typedef int16_t UA_Int16;
  43. UA_UInt16
  44. ^^^^^^^^^
  45. An integer value between 0 and 65,535.
  46. .. code-block:: c
  47. typedef uint16_t UA_UInt16;
  48. UA_Int32
  49. ^^^^^^^^
  50. An integer value between -2,147,483,648 and 2,147,483,647.
  51. .. code-block:: c
  52. typedef int32_t UA_Int32;
  53. UA_UInt32
  54. ^^^^^^^^^
  55. An integer value between 0 and 4,294,967,295.
  56. .. code-block:: c
  57. typedef uint32_t UA_UInt32;
  58. The following functions and definitions are used with UA_UInt32.
  59. .. code-block:: c
  60. /* do not use for cryptographic entropy */
  61. UA_EXPORT UA_UInt32 UA_UInt32_random(void);
  62. UA_Int64
  63. ^^^^^^^^
  64. An integer value between -10,223,372,036,854,775,808 and 9,223,372,036,854,775,807.
  65. .. code-block:: c
  66. typedef int64_t UA_Int64;
  67. UA_UInt64
  68. ^^^^^^^^^
  69. An integer value between 0 and 18,446,744,073,709,551,615.
  70. .. code-block:: c
  71. typedef uint64_t UA_UInt64;
  72. UA_Float
  73. ^^^^^^^^
  74. An IEEE single precision (32 bit) floating point value.
  75. .. code-block:: c
  76. typedef float UA_Float;
  77. UA_Double
  78. ^^^^^^^^^
  79. An IEEE double precision (64 bit) floating point value.
  80. .. code-block:: c
  81. typedef double UA_Double;
  82. UA_DateTime
  83. ^^^^^^^^^^^
  84. An instance in time. A DateTime value is encoded as a 64-bit signed integer
  85. which represents the number of 100 nanosecond intervals since January 1, 1601
  86. (UTC).
  87. .. code-block:: c
  88. typedef UA_Int64 UA_DateTime;
  89. The following functions and definitions are used with UA_DateTime.
  90. .. code-block:: c
  91. UA_DateTime UA_DateTime_now(void);
  92. typedef struct UA_DateTimeStruct {
  93. UA_UInt16 nanoSec;
  94. UA_UInt16 microSec;
  95. UA_UInt16 milliSec;
  96. UA_UInt16 sec;
  97. UA_UInt16 min;
  98. UA_UInt16 hour;
  99. UA_UInt16 day;
  100. UA_UInt16 month;
  101. UA_UInt16 year;
  102. } UA_DateTimeStruct;
  103. UA_DateTimeStruct UA_EXPORT UA_DateTime_toStruct(UA_DateTime time);
  104. UA_String UA_EXPORT UA_DateTime_toString(UA_DateTime time);
  105. UA_Guid
  106. ^^^^^^^
  107. A 16 byte value that can be used as a globally unique identifier.
  108. .. code-block:: c
  109. typedef struct {
  110. UA_UInt32 data1;
  111. UA_UInt16 data2;
  112. UA_UInt16 data3;
  113. UA_Byte data4[8];
  114. } UA_Guid;
  115. The following functions and definitions are used with UA_Guid.
  116. .. code-block:: c
  117. UA_Boolean UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2);
  118. /* do not use for cryptographic entropy */
  119. UA_Guid UA_Guid_random();
  120. UA_String
  121. ^^^^^^^^^
  122. A sequence of Unicode characters. See also the section :ref:`array-handling` for
  123. the usage of arrays in open62541.
  124. .. code-block:: c
  125. typedef struct {
  126. size_t length; // The length of the string
  127. UA_Byte *data; // The string's content (not null-terminated)
  128. } UA_String;
  129. The following functions and definitions are used with UA_String.
  130. .. code-block:: c
  131. extern const UA_String UA_STRING_NULL;
  132. UA_String UA_STRING(char *chars);
  133. #define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
  134. /** Copies the content on the heap. Returns a null-string when alloc fails */
  135. UA_String UA_String_fromChars(char const src[]);
  136. UA_Boolean UA_String_equal(const UA_String *s1, const UA_String *s2);
  137. Here's a small example for the usage of UA_String.
  138. .. code-block:: c
  139. /* The definition of UA_String copied from ua_types.h */
  140. typedef struct {
  141. size_t length; ///< The length of the string
  142. UA_Byte *data; ///< The string's content (not null-terminated)
  143. } UA_String;
  144. UA_String s1 = UA_STRING("test1"); /* s1 points to the statically allocated string buffer */
  145. UA_String_init(&s1); /* Reset s1 (no memleak due to the statically allocated buffer) */
  146. UA_String s2 = UA_STRING_ALLOC("test2"); /* s2 points to a new copy of the string buffer (with malloc) */
  147. UA_String_deleteMembers(&s2); /* Free the content of s2, but not s2 itself */
  148. UA_String *s3 = UA_String_new(); /* The string s3 is malloced and initialized */
  149. *s3 = UA_STRING_ALLOC("test3"); /* s3 points to a new copy of the string buffer */
  150. UA_String s4;
  151. UA_copy(s3, &s4); /* Copy the content of s3 to s4 */
  152. UA_String_delete(s3); /* Free the string buffer and the string itself */
  153. UA_String_deleteMembers(&s4); /* Again, delete only the string buffer */
  154. UA_ByteString
  155. ^^^^^^^^^^^^^
  156. A sequence of octets.
  157. .. code-block:: c
  158. typedef UA_String UA_ByteString;
  159. UA_XmlEelement
  160. ^^^^^^^^^^^^^^
  161. An XML element.
  162. .. code-block:: c
  163. typedef UA_String UA_XmlElement;
  164. UA_NodeId
  165. ^^^^^^^^^
  166. An identifier for a node in the address space of an OPC UA Server.
  167. .. code-block:: c
  168. enum UA_NodeIdType {
  169. UA_NODEIDTYPE_NUMERIC = 0, // On the wire, this can be 0, 1 or 2 (shortened numeric nodeids)
  170. UA_NODEIDTYPE_STRING = 3,
  171. UA_NODEIDTYPE_GUID = 4,
  172. UA_NODEIDTYPE_BYTESTRING = 5
  173. };
  174. typedef struct {
  175. UA_UInt16 namespaceIndex;
  176. enum UA_NodeIdType identifierType;
  177. union {
  178. UA_UInt32 numeric;
  179. UA_String string;
  180. UA_Guid guid;
  181. UA_ByteString byteString;
  182. } identifier;
  183. } UA_NodeId;
  184. The following functions and definitions are used with UA_NodeId.
  185. .. code-block:: c
  186. UA_Boolean UA_NodeId_isNull(const UA_NodeId *p);
  187. UA_Boolean UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2);
  188. extern const UA_NodeId UA_NODEID_NULL;
  189. UA_NodeId UA_NODEID_NUMERIC(UA_UInt16 nsIndex, UA_Int32 identifier);
  190. UA_NodeId UA_NODEID_STRING(UA_UInt16 nsIndex, char *chars) {
  191. UA_NodeId UA_NODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars);
  192. UA_NodeId UA_NODEID_GUID(UA_UInt16 nsIndex, UA_Guid guid);
  193. UA_NodeId UA_NODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars);
  194. UA_NodeId UA_NODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex, const char *chars);
  195. UA_ExpandedNodeId
  196. ^^^^^^^^^^^^^^^^^
  197. A NodeId that allows the namespace URI to be specified instead of an index.
  198. .. code-block:: c
  199. typedef struct {
  200. UA_NodeId nodeId;
  201. UA_String namespaceUri;
  202. UA_UInt32 serverIndex;
  203. } UA_ExpandedNodeId;
  204. The following functions and definitions are used with UA_ExpandedNodeId.
  205. .. code-block:: c
  206. UA_ExpandedNodeId UA_EXPANDEDNODEID_NUMERIC(UA_UInt16 nsIndex, UA_Int32 identifier);
  207. UA_ExpandedNodeId UA_EXPANDEDNODEID_STRING(UA_UInt16 nsIndex, char *chars);
  208. UA_ExpandedNodeId UA_EXPANDEDNODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars);
  209. UA_ExpandedNodeId UA_EXPANDEDNODEID_STRING_GUID(UA_UInt16 nsIndex, UA_Guid guid);
  210. UA_ExpandedNodeId UA_EXPANDEDNODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars);
  211. UA_ExpandedNodeId UA_EXPANDEDNODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex, const char *chars);
  212. UA_QualifiedName
  213. ^^^^^^^^^^^^^^^^
  214. A name qualified by a namespace.
  215. .. code-block:: c
  216. typedef struct {
  217. UA_UInt16 namespaceIndex;
  218. UA_String name;
  219. } UA_QualifiedName;
  220. The following functions and definitions are used with UA_QualifiedName.
  221. .. code-block:: c
  222. UA_QualifiedName UA_QUALIFIEDNAME(UA_UInt16 nsIndex, char *chars);
  223. UA_QualifiedName UA_QUALIFIEDNAME_ALLOC(UA_UInt16 nsIndex, const char *chars);
  224. UA_LocalizedText
  225. ^^^^^^^^^^^^^^^^
  226. Human readable text with an optional locale identifier.
  227. .. code-block:: c
  228. typedef struct {
  229. UA_String locale;
  230. UA_String text;
  231. } UA_LocalizedText;
  232. The following functions and definitions are used with UA_LocalizedText.
  233. .. code-block:: c
  234. UA_LocalizedText UA_LOCALIZEDTEXT(char *locale, char *text);
  235. UA_LocalizedText UA_LOCALIZEDTEXT_ALLOC(const char *locale, const char *text);
  236. UA_ExtensionObject
  237. ^^^^^^^^^^^^^^^^^^
  238. A structure that contains an application specific data type that may not be
  239. recognized by the receiver.
  240. .. code-block:: c
  241. typedef struct {
  242. enum {
  243. UA_EXTENSIONOBJECT_ENCODED_NOBODY = 0,
  244. UA_EXTENSIONOBJECT_ENCODED_BYTESTRING = 1,
  245. UA_EXTENSIONOBJECT_ENCODED_XML = 2,
  246. UA_EXTENSIONOBJECT_DECODED = 3, ///< There is a pointer to the decoded data
  247. UA_EXTENSIONOBJECT_DECODED_NODELETE = 4 ///< Don't delete the decoded data at the lifecycle end
  248. } encoding;
  249. union {
  250. struct {
  251. UA_NodeId typeId; ///< The nodeid of the datatype
  252. UA_ByteString body; ///< The bytestring of the encoded data
  253. } encoded;
  254. struct {
  255. const UA_DataType *type;
  256. void *data;
  257. } decoded;
  258. } content;
  259. } UA_ExtensionObject;
  260. UA_Variant
  261. ^^^^^^^^^^
  262. Stores (arrays of) any data type. Please see section :ref:`generic-handling` for
  263. the usage of UA_DataType. The semantics of the arrayLength field is explained in
  264. section :ref:`array-handling`.
  265. .. code-block:: c
  266. typedef struct {
  267. const UA_DataType *type; // The data type description
  268. enum {
  269. UA_VARIANT_DATA, /* The data has the same lifecycle as the variant */
  270. UA_VARIANT_DATA_NODELETE, /* The data is "borrowed" by the variant and shall not be
  271. deleted at the end of the variant's lifecycle. */
  272. } storageType;
  273. size_t arrayLength; // The number of elements in the data array
  274. void *data; // Points to the scalar or array data
  275. size_t arrayDimensionsSize; // The number of dimensions the data-array has
  276. UA_UInt32 *arrayDimensions; // The length of each dimension of the data-array
  277. } UA_Variant;
  278. /* NumericRanges are used to indicate subsets of a (multidimensional) variant
  279. * array. NumericRange has no official type structure in the standard. On the
  280. * wire, it only exists as an encoded string, such as "1:2,0:3,5". The colon
  281. * separates min/max index and the comma separates dimensions. A single value
  282. * indicates a range with a single element (min==max). */
  283. typedef struct {
  284. size_t dimensionsSize;
  285. struct UA_NumericRangeDimension {
  286. UA_UInt32 min;
  287. UA_UInt32 max;
  288. } *dimensions;
  289. } UA_NumericRange;
  290. The following functions and definitions are used with UA_Variant.
  291. .. code-block:: c
  292. /**
  293. * Returns true if the variant contains a scalar value. Note that empty
  294. * variants contain an array of length -1 (undefined).
  295. *
  296. * @param v The variant
  297. * @return Does the variant contain a scalar value.
  298. */
  299. UA_Boolean UA_Variant_isScalar(const UA_Variant *v);
  300. /**
  301. * Set the variant to a scalar value that already resides in memory. The value
  302. * takes on the lifecycle of the variant and is deleted with it.
  303. *
  304. * @param v The variant
  305. * @param p A pointer to the value data
  306. * @param type The datatype of the value in question
  307. */
  308. UA_Variant_setScalar(UA_Variant *v, void * UA_RESTRICT p, const UA_DataType *type);
  309. /**
  310. * Set the variant to a scalar value that is copied from an existing variable.
  311. *
  312. * @param v The variant
  313. * @param p A pointer to the value data
  314. * @param type The datatype of the value
  315. * @return Indicates whether the operation succeeded or returns an error code
  316. */
  317. UA_StatusCode UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type);
  318. /**
  319. * Set the variant to an array that already resides in memory. The array takes
  320. * on the lifecycle of the variant and is deleted with it.
  321. *
  322. * @param v The variant
  323. * @param array A pointer to the array data
  324. * @param arraySize The size of the array
  325. * @param type The datatype of the array
  326. */
  327. void UA_Variant_setArray(UA_Variant *v, void * UA_RESTRICT array,
  328. size_t arraySize, const UA_DataType *type);
  329. /**
  330. * Set the variant to an array that is copied from an existing array.
  331. *
  332. * @param v The variant
  333. * @param array A pointer to the array data
  334. * @param arraySize The size of the array
  335. * @param type The datatype of the array
  336. * @return Indicates whether the operation succeeded or returns an error code
  337. */
  338. UA_StatusCode UA_Variant_setArrayCopy(UA_Variant *v, const void *array,
  339. size_t arraySize, const UA_DataType *type);
  340. /**
  341. * Copy the variant, but use only a subset of the (multidimensional) array
  342. * into a variant. Returns an error code if the variant is not an array or if
  343. * the indicated range does not fit.
  344. *
  345. * @param src The source variant
  346. * @param dst The target variant
  347. * @param range The range of the copied data
  348. * @return Returns UA_STATUSCODE_GOOD or an error code
  349. */
  350. UA_StatusCode UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst,
  351. const UA_NumericRange range);
  352. /**
  353. * Insert a range of data into an existing variant. The data array can't be
  354. * reused afterwards if it contains types without a fixed size (e.g. strings)
  355. * since the members are moved into the variant and take on its lifecycle.
  356. *
  357. * @param v The variant
  358. * @param dataArray The data array. The type must match the variant
  359. * @param dataArraySize The length of the data array. This is checked to match the range size.
  360. * @param range The range of where the new data is inserted
  361. * @return Returns UA_STATUSCODE_GOOD or an error code
  362. */
  363. UA_StatusCode UA_Variant_setRange(UA_Variant *v, void * UA_RESTRICT array,
  364. size_t arraySize, const UA_NumericRange range);
  365. /**
  366. * Deep-copy a range of data into an existing variant.
  367. *
  368. * @param v The variant
  369. * @param dataArray The data array. The type must match the variant
  370. * @param dataArraySize The length of the data array. This is checked to match the range size.
  371. * @param range The range of where the new data is inserted
  372. * @return Returns UA_STATUSCODE_GOOD or an error code
  373. */
  374. UA_StatusCode UA_Variant_setRangeCopy(UA_Variant *v, const void *array,
  375. size_t arraySize, const UA_NumericRange range);
  376. UA_DataValue
  377. ^^^^^^^^^^^^
  378. A data value with an associated status code and timestamps.
  379. .. code-block:: c
  380. typedef struct {
  381. UA_Boolean hasValue : 1;
  382. UA_Boolean hasStatus : 1;
  383. UA_Boolean hasSourceTimestamp : 1;
  384. UA_Boolean hasServerTimestamp : 1;
  385. UA_Boolean hasSourcePicoseconds : 1;
  386. UA_Boolean hasServerPicoseconds : 1;
  387. UA_Variant value;
  388. UA_StatusCode status;
  389. UA_DateTime sourceTimestamp;
  390. UA_Int16 sourcePicoseconds;
  391. UA_DateTime serverTimestamp;
  392. UA_Int16 serverPicoseconds;
  393. } UA_DataValue;
  394. UA_DiagnosticInfo
  395. ^^^^^^^^^^^^^^^^^
  396. A structure that contains detailed error and diagnostic information associated
  397. with a StatusCode.
  398. .. code-block:: c
  399. typedef struct UA_DiagnosticInfo {
  400. UA_Boolean hasSymbolicId : 1;
  401. UA_Boolean hasNamespaceUri : 1;
  402. UA_Boolean hasLocalizedText : 1;
  403. UA_Boolean hasLocale : 1;
  404. UA_Boolean hasAdditionalInfo : 1;
  405. UA_Boolean hasInnerStatusCode : 1;
  406. UA_Boolean hasInnerDiagnosticInfo : 1;
  407. UA_Int32 symbolicId;
  408. UA_Int32 namespaceUri;
  409. UA_Int32 localizedText;
  410. UA_Int32 locale;
  411. UA_String additionalInfo;
  412. UA_StatusCode innerStatusCode;
  413. struct UA_DiagnosticInfo *innerDiagnosticInfo;
  414. } UA_DiagnosticInfo;
  415. .. _generic-handling:
  416. Generic Data Type Handling
  417. --------------------------
  418. All standard-defined data types are described with an ``UA_DataType`` structure.
  419. In addition to the 25 builtin data types, OPC UA defines many more. But they are
  420. mere combinations of the builtin data types. We handle all types in a unified
  421. way by storing their internal structure. So it is not necessary to define
  422. specialized functions for all additional types.
  423. The ``UA_TYPES`` array contains the description of every standard-defined data
  424. type.
  425. .. code-block:: c
  426. extern const UA_DataType UA_TYPES[UA_TYPES_COUNT];
  427. The following is an excerpt from ``ua_types_generated.h`` with the definition of
  428. OPC UA read requests. This file is auto-generated from the XML-description of
  429. the OPC UA data types that is part of the ISO/IEC 62541 standard.
  430. .. code-block:: c
  431. typedef struct {
  432. UA_RequestHeader requestHeader;
  433. UA_Double maxAge;
  434. UA_TimestampsToReturn timestampsToReturn;
  435. size_t nodesToReadSize;
  436. UA_ReadValueId *nodesToRead;
  437. } UA_ReadRequest;
  438. #define UA_TYPES_READREQUEST 118
  439. static UA_INLINE void UA_ReadRequest_init(UA_ReadRequest *p) {
  440. memset(p, 0, sizeof(UA_ReadRequest)); }
  441. static UA_INLINE void UA_ReadRequest_delete(UA_ReadRequest *p) {
  442. UA_delete(p, &UA_TYPES[UA_TYPES_READREQUEST]); }
  443. static UA_INLINE void UA_ReadRequest_deleteMembers(UA_ReadRequest *p) {
  444. UA_deleteMembers(p, &UA_TYPES[UA_TYPES_READREQUEST]); }
  445. static UA_INLINE UA_ReadRequest * UA_ReadRequest_new(void) {
  446. return (UA_ReadRequest*) UA_new(&UA_TYPES[UA_TYPES_READREQUEST]); }
  447. static UA_INLINE UA_StatusCode
  448. UA_ReadRequest_copy(const UA_ReadRequest *src, UA_ReadRequest *dst) {
  449. return UA_copy(src, dst, &UA_TYPES[UA_TYPES_READREQUEST]); }
  450. .. _array-handling:
  451. Array Handling
  452. --------------
  453. In OPC UA, all arrays can be undefined, have length 0 or a positive length. In
  454. data structures, all arrays are represented by a ``size_t`` length field and an
  455. appropriate pointer directly afterwards. In order to distinguish between
  456. undefined and length-zero arrays, we define the following.
  457. .. code-block:: c
  458. #define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
  459. - size == 0 and data == NULL: The array is undefined
  460. - size == 0 and data == ``UA_EMPTY_ARRAY_SENTINEL``: The array has length 0
  461. - size > 0: The array at the given memory address has the given size
  462. The following functions are defined for array handling.
  463. .. code-block:: c
  464. /**
  465. * Allocates and initializes an array of variables of a specific type
  466. *
  467. * @param size The requested array length
  468. * @param type The datatype description
  469. * @return Returns the memory location of the variable or (void*)0 if no memory could be allocated
  470. */
  471. void * UA_Array_new(size_t size, const UA_DataType *type);
  472. /**
  473. * Allocates and copies an array. dst is set to (void*)0 if not enough memory is available.
  474. *
  475. * @param src The memory location of the source array
  476. * @param src_size The size of the array
  477. * @param dst The location of the pointer to the new array
  478. * @param type The datatype of the array members
  479. * @return Returns whether copying succeeded
  480. */
  481. UA_StatusCode UA_Array_copy(const void *src, size_t src_size, void **dst,
  482. const UA_DataType *type);
  483. /**
  484. * Deletes an array.
  485. *
  486. * @param p The memory location of the array
  487. * @param size The size of the array
  488. * @param type The datatype of the array members
  489. */
  490. void UA_Array_delete(void *p, size_t size, const UA_DataType *type);