feat(server) Support self containing structs in the source and nodeset compiler, cascade nodeset keywords as literals, adjusted the padding calculation in the nodeset compiler for unions
* initial implementation approch for the handling of structures with optional fields and unions
implemented printing structs with optional fields. Tested with optstructs.bsd file.
implemented calculating binary size of structures with optional fields and encoding them. Also implemented printing the right padding for the first member of types with optional fields. Tested with optStructs_test.c
implemented decoding structures with optional fields. Tested with optStructs_test.c
Implemented calculating the binary size of unions. Tested in optStructs_test.c
Implemented encoding and decoding unions. Added returning 4 as binary size, if the SwitchField is too large to avoid later segmentation faults while en-/decoding. Tested with optStructs_test.c
Tested encoding and decoding structs with optional fields and unions with the RtlsLocationResult type from the AutoID nodeset. Works with other clients like UAExpert too now.
Implemented copying and clearing structures with optional fields and unions.
* extended unit testing and examples for unions and optstructs, fixes and cleanups on optstruct and union implementation
* extended custom type example with OPTSTRUCT and UNION
* updated ua-nodeset deps to Tag Errata-1.04.5
* extended nodeset-compiler test with the AutoID companion specification
* reimplemented union representation to match the OPC UA Standard sugestion Part 5 5.2.8 (1.04)
added nodeset compiler support for the new internal union structure
* reimplemented optional struct with internal pointer based representation
added support for the new internal optstruct representation to the nodeset compiler, removed unnecessary type export of union enum field
extended clearStructure function to handle structures with optional fields
* added support for the use of arrays as an optional field
* fixed encoding mask issue, extended read service type-description with the isOptional field and the union type, extended custom types client and server example with arrays, OptStruct and union, removed implementation comments
* added the union datatype to the reduced information model (enables the usage of unions in combination with the reduced information model)
* added UA_ prefix to enum, moved mask copy operation before bail out the funtion
* reduced checks in critical path, added some comments
* fixed horizontal comment alignment
created defined for the binary encoding id for each type
* unify redundant padding logic
Co-authored-by: Grigory Fridman <grigoryfridman@gmail.com>
Co-authored-by: Julius Pfrommer <julius.pfrommer@web.de>
This commit drops the 'ua_' prefix and changes the public includes
to the form `#include <open62541/server.h>` instead of the old
`#include <ua_server.h>`
Makes this example run valgrind clean.
==7424== HEAP SUMMARY:
==7424== in use at exit: 0 bytes in 0 blocks
==7424== total heap usage: 96,908 allocs, 96,908 frees, 190,708,768 bytes allocated
vs.
==5408== HEAP SUMMARY:
==5408== in use at exit: 96 bytes in 2 blocks
==5408== total heap usage: 96,908 allocs, 96,906 frees, 190,708,768 bytes allocated
==5408==
==5408== 96 (48 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 2
==5408== at 0x4C2DBF6: malloc (vg_replace_malloc.c:299)
==5408== by 0x40312A: main (server_types_custom.c:68)
==5408==
==5408== LEAK SUMMARY:
==5408== definitely lost: 48 bytes in 1 blocks
==5408== indirectly lost: 48 bytes in 1 blocks
before
Make use of EXIT_SUCCESS and EXIT_FAILURE from stdlib.h.
The previous approach of returning a value from UA_StatusCode
was often broken as an exit code can (portably) only be between 0 and 125.