From 9f6842829ac6cd3f923e8b993a515ecd2f2f0470 Mon Sep 17 00:00:00 2001 From: Mike Sul Date: Wed, 10 Apr 2019 16:41:29 +0300 Subject: [PATCH 1/3] OTA-2499: Move IpUptaneSecondary and IpSecondaryDiscovery out of libaktualizr Signed-off-by: Mike Sul --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 1 + src/aktualizr_check_discovery/CMakeLists.txt | 4 +- src/aktualizr_check_discovery/main.cc | 2 +- src/aktualizr_secondary/CMakeLists.txt | 6 ++- .../aktualizr_secondary_discovery.cc | 2 +- .../aktualizr_secondary_discovery_test.cc | 2 +- src/libaktualizr-posix/CMakeLists.txt | 29 +++++++++++++ .../asn1/CMakeLists.txt | 2 +- .../asn1/asn1-cer.cc | 2 +- .../asn1/asn1-cer.h | 0 .../asn1/asn1-cerstream.cc | 3 +- .../asn1/asn1-cerstream.h | 2 +- .../asn1/asn1_message.cc | 2 +- .../asn1/asn1_message.h | 0 .../asn1/asn1_test.cc | 42 ++++++++++++++++++- .../asn1/messages/common.asn1 | 0 .../asn1/messages/cryptosource.asn1 | 0 .../asn1/messages/ipuptane_message.asn1 | 0 .../asn1/messages/tlsconfig.asn1 | 0 .../ipsecondary_discovery_test.cc | 2 +- .../ipsecondarydiscovery.cc | 0 .../ipsecondarydiscovery.h | 0 .../ipuptanesecondary.cc | 0 .../ipuptanesecondary.h | 0 src/libaktualizr/CMakeLists.txt | 3 -- src/libaktualizr/config/config.cc | 39 ----------------- src/libaktualizr/config/config.h | 5 --- src/libaktualizr/primary/sotauptaneclient.cc | 6 --- src/libaktualizr/primary/sotauptaneclient.h | 1 - src/libaktualizr/uptane/CMakeLists.txt | 8 ---- src/libaktualizr/uptane/secondaryfactory.cc | 3 -- 32 files changed, 89 insertions(+), 79 deletions(-) create mode 100644 src/libaktualizr-posix/CMakeLists.txt rename src/{libaktualizr => libaktualizr-posix}/asn1/CMakeLists.txt (84%) rename src/{libaktualizr => libaktualizr-posix}/asn1/asn1-cer.cc (99%) rename src/{libaktualizr => libaktualizr-posix}/asn1/asn1-cer.h (100%) rename src/{libaktualizr => libaktualizr-posix}/asn1/asn1-cerstream.cc (99%) rename src/{libaktualizr => libaktualizr-posix}/asn1/asn1-cerstream.h (99%) rename src/{libaktualizr => libaktualizr-posix}/asn1/asn1_message.cc (99%) rename src/{libaktualizr => libaktualizr-posix}/asn1/asn1_message.h (100%) rename src/{libaktualizr => libaktualizr-posix}/asn1/asn1_test.cc (85%) rename src/{libaktualizr => libaktualizr-posix}/asn1/messages/common.asn1 (100%) rename src/{libaktualizr => libaktualizr-posix}/asn1/messages/cryptosource.asn1 (100%) rename src/{libaktualizr => libaktualizr-posix}/asn1/messages/ipuptane_message.asn1 (100%) rename src/{libaktualizr => libaktualizr-posix}/asn1/messages/tlsconfig.asn1 (100%) rename src/{libaktualizr/uptane => libaktualizr-posix}/ipsecondary_discovery_test.cc (96%) rename src/{libaktualizr/uptane => libaktualizr-posix}/ipsecondarydiscovery.cc (100%) rename src/{libaktualizr/uptane => libaktualizr-posix}/ipsecondarydiscovery.h (100%) rename src/{libaktualizr/uptane => libaktualizr-posix}/ipuptanesecondary.cc (100%) rename src/{libaktualizr/uptane => libaktualizr-posix}/ipuptanesecondary.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0390e522f6..eb36f22f53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ unset(AKTUALIZR_CHECKED_SRCS CACHE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) # find all required libraries -set(BOOST_COMPONENTS log_setup log filesystem program_options) +set(BOOST_COMPONENTS log_setup log system filesystem program_options) set(Boost_USE_STATIC_LIBS OFF) add_definitions(-DBOOST_LOG_DYN_LINK) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e34db7cd57..ab0746056b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,7 @@ endif() add_subdirectory("libaktualizr") add_subdirectory("sota_tools") add_subdirectory("aktualizr_primary") +add_subdirectory("libaktualizr-posix") add_subdirectory("aktualizr_secondary") add_subdirectory("aktualizr_info") add_subdirectory("aktualizr_repo") diff --git a/src/aktualizr_check_discovery/CMakeLists.txt b/src/aktualizr_check_discovery/CMakeLists.txt index efb60a21d8..1bf5d63030 100644 --- a/src/aktualizr_check_discovery/CMakeLists.txt +++ b/src/aktualizr_check_discovery/CMakeLists.txt @@ -2,12 +2,14 @@ set(AKTUALIZR_CHECK_DISCOVERY_SRC main.cc ) add_executable(aktualizr-check-discovery ${AKTUALIZR_CHECK_DISCOVERY_SRC}) -target_link_libraries(aktualizr-check-discovery aktualizr_static_lib ${AKTUALIZR_EXTERNAL_LIBS}) +target_link_libraries(aktualizr-check-discovery aktualizr-posix ${AKTUALIZR_EXTERNAL_LIBS}) install(TARGETS aktualizr-check-discovery COMPONENT aktualizr RUNTIME DESTINATION bin) +target_include_directories(aktualizr-check-discovery PUBLIC ${PROJECT_SOURCE_DIR}/src/libaktualizr-posix) + aktualizr_source_file_checks(${AKTUALIZR_CHECK_DISCOVERY_SRC}) # vim: set tabstop=4 shiftwidth=4 expandtab: diff --git a/src/aktualizr_check_discovery/main.cc b/src/aktualizr_check_discovery/main.cc index fbed0cbdbe..9bc37e93e8 100644 --- a/src/aktualizr_check_discovery/main.cc +++ b/src/aktualizr_check_discovery/main.cc @@ -6,8 +6,8 @@ #include "uptane/secondaryfactory.h" #include "uptane/secondaryinterface.h" +#include "ipsecondarydiscovery.h" #include "logging/logging.h" -#include "uptane/ipsecondarydiscovery.h" namespace po = boost::program_options; diff --git a/src/aktualizr_secondary/CMakeLists.txt b/src/aktualizr_secondary/CMakeLists.txt index 21f83999b9..75ae44be00 100644 --- a/src/aktualizr_secondary/CMakeLists.txt +++ b/src/aktualizr_secondary/CMakeLists.txt @@ -10,8 +10,6 @@ set(AKTUALIZR_SECONDARY_LIB_SRC add_library(aktualizr_secondary_static_lib STATIC ${AKTUALIZR_SECONDARY_LIB_SRC} - $ - $ $ $ $ @@ -22,6 +20,8 @@ add_library(aktualizr_secondary_static_lib STATIC $ $) +target_link_libraries(aktualizr_secondary_static_lib aktualizr-posix) + set(OPCUA_SECONDARY_SRC opcuaserver_secondary_delegate.cc aktualizr_secondary_opcua.cc @@ -39,6 +39,7 @@ endif (BUILD_OPCUA) target_include_directories(aktualizr_secondary_static_lib PUBLIC $ $ + ${PROJECT_SOURCE_DIR}/src/libaktualizr-posix ) add_executable(aktualizr-secondary ${AKTUALIZR_SECONDARY_SRC}) @@ -81,6 +82,7 @@ if(BUILD_OSTREE) add_aktualizr_test(NAME aktualizr_secondary_uptane SOURCES uptane_test.cc + LIBRARIES aktualizr-posix ARGS ${PROJECT_BINARY_DIR}/ostree_repo PROJECT_WORKING_DIRECTORY) else(BUILD_OSTREE) list(APPEND TEST_SOURCES aktualizr_secondary_discovery_test.cc uptane_test.cc) diff --git a/src/aktualizr_secondary/aktualizr_secondary_discovery.cc b/src/aktualizr_secondary/aktualizr_secondary_discovery.cc index 52393f65d0..29a6406df0 100644 --- a/src/aktualizr_secondary/aktualizr_secondary_discovery.cc +++ b/src/aktualizr_secondary/aktualizr_secondary_discovery.cc @@ -5,9 +5,9 @@ #include #include "asn1/asn1-cerstream.h" +#include "ipsecondarydiscovery.h" #include "logging/logging.h" #include "socket_activation/socket_activation.h" -#include "uptane/ipsecondarydiscovery.h" #include "utilities/sockaddr_io.h" #include "utilities/utils.h" diff --git a/src/aktualizr_secondary/aktualizr_secondary_discovery_test.cc b/src/aktualizr_secondary/aktualizr_secondary_discovery_test.cc index 37cf8235f7..3a7f42cf3c 100644 --- a/src/aktualizr_secondary/aktualizr_secondary_discovery_test.cc +++ b/src/aktualizr_secondary/aktualizr_secondary_discovery_test.cc @@ -4,7 +4,7 @@ #include "aktualizr_secondary_discovery.h" #include "config/config.h" -#include "uptane/ipsecondarydiscovery.h" // to test from the other side +#include "ipsecondarydiscovery.h" // to test from the other side #include "logging/logging.h" diff --git a/src/libaktualizr-posix/CMakeLists.txt b/src/libaktualizr-posix/CMakeLists.txt new file mode 100644 index 0000000000..4734e3158a --- /dev/null +++ b/src/libaktualizr-posix/CMakeLists.txt @@ -0,0 +1,29 @@ +add_subdirectory("asn1") + +set(SOURCES + ipuptanesecondary.cc + ipsecondarydiscovery.cc) + +set(HEADERS + ipuptanesecondary.h + ipsecondarydiscovery.h) + +set(TARGET aktualizr-posix) + +add_library(${TARGET} STATIC + ${SOURCES} + $ + $ +) + +get_property(ASN1_INCLUDE_DIRS TARGET asn1_lib PROPERTY INCLUDE_DIRECTORIES) +target_include_directories(${TARGET} PUBLIC ${ASN1_INCLUDE_DIRS}) + +target_link_libraries(${TARGET} aktualizr_static_lib) + +add_aktualizr_test(NAME discovery_secondary + SOURCES ipsecondary_discovery_test.cc + LIBRARIES ${TARGET} + PROJECT_WORKING_DIRECTORY) + +aktualizr_source_file_checks(${HEADERS} ${SOURCES} ipsecondary_discovery_test.cc) diff --git a/src/libaktualizr/asn1/CMakeLists.txt b/src/libaktualizr-posix/asn1/CMakeLists.txt similarity index 84% rename from src/libaktualizr/asn1/CMakeLists.txt rename to src/libaktualizr-posix/asn1/CMakeLists.txt index a36c18aead..e9044ab819 100644 --- a/src/libaktualizr/asn1/CMakeLists.txt +++ b/src/libaktualizr-posix/asn1/CMakeLists.txt @@ -16,6 +16,6 @@ compile_asn1_lib(SOURCES messages/tlsconfig.asn1 ) -add_aktualizr_test(NAME asn1 SOURCES asn1_test.cc) +add_aktualizr_test(NAME asn1 LIBRARIES asn1 asn1_lib SOURCES asn1_test.cc) aktualizr_source_file_checks(${SOURCES} ${HEADERS} ${TEST_SOURCES}) diff --git a/src/libaktualizr/asn1/asn1-cer.cc b/src/libaktualizr-posix/asn1/asn1-cer.cc similarity index 99% rename from src/libaktualizr/asn1/asn1-cer.cc rename to src/libaktualizr-posix/asn1/asn1-cer.cc index 08a769161c..4189b763fb 100644 --- a/src/libaktualizr/asn1/asn1-cer.cc +++ b/src/libaktualizr-posix/asn1/asn1-cer.cc @@ -1,4 +1,4 @@ -#include "asn1/asn1-cer.h" +#include "asn1-cer.h" #include static std::string cer_encode_length(size_t len) { diff --git a/src/libaktualizr/asn1/asn1-cer.h b/src/libaktualizr-posix/asn1/asn1-cer.h similarity index 100% rename from src/libaktualizr/asn1/asn1-cer.h rename to src/libaktualizr-posix/asn1/asn1-cer.h diff --git a/src/libaktualizr/asn1/asn1-cerstream.cc b/src/libaktualizr-posix/asn1/asn1-cerstream.cc similarity index 99% rename from src/libaktualizr/asn1/asn1-cerstream.cc rename to src/libaktualizr-posix/asn1/asn1-cerstream.cc index fa5700d2c5..11c327da0e 100644 --- a/src/libaktualizr/asn1/asn1-cerstream.cc +++ b/src/libaktualizr-posix/asn1/asn1-cerstream.cc @@ -1,4 +1,4 @@ -#include "asn1/asn1-cerstream.h" +#include "asn1-cerstream.h" namespace asn1 { @@ -278,4 +278,5 @@ Deserializer& Deserializer::operator>>(const Token& tok) { // seq_consumed.pop(); return *this; } + } // namespace asn1 diff --git a/src/libaktualizr/asn1/asn1-cerstream.h b/src/libaktualizr-posix/asn1/asn1-cerstream.h similarity index 99% rename from src/libaktualizr/asn1/asn1-cerstream.h rename to src/libaktualizr-posix/asn1/asn1-cerstream.h index 7ac57fd6ef..74eced1ab6 100644 --- a/src/libaktualizr/asn1/asn1-cerstream.h +++ b/src/libaktualizr-posix/asn1/asn1-cerstream.h @@ -1,7 +1,7 @@ #ifndef ASN1_CER_STREAM_H #define ASN1_CER_STREAM_H -#include "asn1/asn1-cer.h" +#include "asn1-cer.h" #include #include diff --git a/src/libaktualizr/asn1/asn1_message.cc b/src/libaktualizr-posix/asn1/asn1_message.cc similarity index 99% rename from src/libaktualizr/asn1/asn1_message.cc rename to src/libaktualizr-posix/asn1/asn1_message.cc index 910e9d24b6..bd2430b5ec 100644 --- a/src/libaktualizr/asn1/asn1_message.cc +++ b/src/libaktualizr-posix/asn1/asn1_message.cc @@ -1,4 +1,4 @@ -#include "asn1/asn1_message.h" +#include "asn1_message.h" #include "logging/logging.h" #include "utilities/dequeue_buffer.h" #include "utilities/sockaddr_io.h" diff --git a/src/libaktualizr/asn1/asn1_message.h b/src/libaktualizr-posix/asn1/asn1_message.h similarity index 100% rename from src/libaktualizr/asn1/asn1_message.h rename to src/libaktualizr-posix/asn1/asn1_message.h diff --git a/src/libaktualizr/asn1/asn1_test.cc b/src/libaktualizr-posix/asn1/asn1_test.cc similarity index 85% rename from src/libaktualizr/asn1/asn1_test.cc rename to src/libaktualizr-posix/asn1/asn1_test.cc index 6dd5969cf4..4ed988638f 100644 --- a/src/libaktualizr/asn1/asn1_test.cc +++ b/src/libaktualizr-posix/asn1/asn1_test.cc @@ -7,10 +7,50 @@ #include #include -#include "asn1/asn1_message.h" +#include "asn1-cerstream.h" +#include "asn1_message.h" #include "config/config.h" #include "der_encoder.h" +asn1::Serializer& operator<<(asn1::Serializer& ser, CryptoSource cs) { + ser << asn1::implicit(static_cast(static_cast(cs))); + + return ser; +} + +asn1::Serializer& operator<<(asn1::Serializer& ser, const TlsConfig& tls_conf) { + ser << asn1::seq << asn1::implicit(tls_conf.server) + << asn1::implicit(tls_conf.server_url_path.string()) << tls_conf.ca_source + << tls_conf.pkey_source << tls_conf.cert_source << asn1::endseq; + return ser; +} + +asn1::Deserializer& operator>>(asn1::Deserializer& des, CryptoSource& cs) { + int32_t cs_i; + des >> asn1::implicit(cs_i); + + if (cs_i < static_cast(CryptoSource::kFile) || cs_i > static_cast(CryptoSource::kPkcs11)) { + throw deserialization_error(); + } + + cs = static_cast(cs_i); + + return des; +} + +asn1::Deserializer& operator>>(asn1::Deserializer& des, boost::filesystem::path& path) { + std::string path_string; + des >> asn1::implicit(path_string); + path = path_string; + return des; +} + +asn1::Deserializer& operator>>(asn1::Deserializer& des, TlsConfig& tls_conf) { + des >> asn1::seq >> asn1::implicit(tls_conf.server) >> tls_conf.server_url_path >> + tls_conf.ca_source >> tls_conf.pkey_source >> tls_conf.cert_source >> asn1::endseq; + return des; +} + void printStringHex(const std::string& s) { for (char c : s) { std::cerr << std::setfill('0') << std::setw(2) << std::hex << (((unsigned int)c) & 0xFF); diff --git a/src/libaktualizr/asn1/messages/common.asn1 b/src/libaktualizr-posix/asn1/messages/common.asn1 similarity index 100% rename from src/libaktualizr/asn1/messages/common.asn1 rename to src/libaktualizr-posix/asn1/messages/common.asn1 diff --git a/src/libaktualizr/asn1/messages/cryptosource.asn1 b/src/libaktualizr-posix/asn1/messages/cryptosource.asn1 similarity index 100% rename from src/libaktualizr/asn1/messages/cryptosource.asn1 rename to src/libaktualizr-posix/asn1/messages/cryptosource.asn1 diff --git a/src/libaktualizr/asn1/messages/ipuptane_message.asn1 b/src/libaktualizr-posix/asn1/messages/ipuptane_message.asn1 similarity index 100% rename from src/libaktualizr/asn1/messages/ipuptane_message.asn1 rename to src/libaktualizr-posix/asn1/messages/ipuptane_message.asn1 diff --git a/src/libaktualizr/asn1/messages/tlsconfig.asn1 b/src/libaktualizr-posix/asn1/messages/tlsconfig.asn1 similarity index 100% rename from src/libaktualizr/asn1/messages/tlsconfig.asn1 rename to src/libaktualizr-posix/asn1/messages/tlsconfig.asn1 diff --git a/src/libaktualizr/uptane/ipsecondary_discovery_test.cc b/src/libaktualizr-posix/ipsecondary_discovery_test.cc similarity index 96% rename from src/libaktualizr/uptane/ipsecondary_discovery_test.cc rename to src/libaktualizr-posix/ipsecondary_discovery_test.cc index bfb779458f..9acc1aeeb5 100644 --- a/src/libaktualizr/uptane/ipsecondary_discovery_test.cc +++ b/src/libaktualizr-posix/ipsecondary_discovery_test.cc @@ -7,9 +7,9 @@ #include #include "config/config.h" +#include "ipsecondarydiscovery.h" #include "logging/logging.h" #include "test_utils.h" -#include "uptane/ipsecondarydiscovery.h" std::string port; diff --git a/src/libaktualizr/uptane/ipsecondarydiscovery.cc b/src/libaktualizr-posix/ipsecondarydiscovery.cc similarity index 100% rename from src/libaktualizr/uptane/ipsecondarydiscovery.cc rename to src/libaktualizr-posix/ipsecondarydiscovery.cc diff --git a/src/libaktualizr/uptane/ipsecondarydiscovery.h b/src/libaktualizr-posix/ipsecondarydiscovery.h similarity index 100% rename from src/libaktualizr/uptane/ipsecondarydiscovery.h rename to src/libaktualizr-posix/ipsecondarydiscovery.h diff --git a/src/libaktualizr/uptane/ipuptanesecondary.cc b/src/libaktualizr-posix/ipuptanesecondary.cc similarity index 100% rename from src/libaktualizr/uptane/ipuptanesecondary.cc rename to src/libaktualizr-posix/ipuptanesecondary.cc diff --git a/src/libaktualizr/uptane/ipuptanesecondary.h b/src/libaktualizr-posix/ipuptanesecondary.h similarity index 100% rename from src/libaktualizr/uptane/ipuptanesecondary.h rename to src/libaktualizr-posix/ipuptanesecondary.h diff --git a/src/libaktualizr/CMakeLists.txt b/src/libaktualizr/CMakeLists.txt index 862c9e1cfe..27389191f2 100644 --- a/src/libaktualizr/CMakeLists.txt +++ b/src/libaktualizr/CMakeLists.txt @@ -1,5 +1,4 @@ add_subdirectory("utilities") -add_subdirectory("asn1") add_subdirectory("bootloader") add_subdirectory("bootstrap") add_subdirectory("campaign") @@ -23,8 +22,6 @@ if (BUILD_OPCUA) endif (BUILD_OPCUA) add_library(aktualizr_static_lib STATIC - $ - $ $ $ $ diff --git a/src/libaktualizr/config/config.cc b/src/libaktualizr/config/config.cc index 2f17ac2150..de10cf2ee4 100644 --- a/src/libaktualizr/config/config.cc +++ b/src/libaktualizr/config/config.cc @@ -275,42 +275,3 @@ void Config::writeToStream(std::ostream& sink) const { WriteSectionToStream(telemetry, "telemetry", sink); WriteSectionToStream(bootloader, "bootloader", sink); } - -asn1::Serializer& operator<<(asn1::Serializer& ser, CryptoSource cs) { - ser << asn1::implicit(static_cast(static_cast(cs))); - - return ser; -} - -asn1::Serializer& operator<<(asn1::Serializer& ser, const TlsConfig& tls_conf) { - ser << asn1::seq << asn1::implicit(tls_conf.server) - << asn1::implicit(tls_conf.server_url_path.string()) << tls_conf.ca_source - << tls_conf.pkey_source << tls_conf.cert_source << asn1::endseq; - return ser; -} - -asn1::Deserializer& operator>>(asn1::Deserializer& des, CryptoSource& cs) { - int32_t cs_i; - des >> asn1::implicit(cs_i); - - if (cs_i < static_cast(CryptoSource::kFile) || cs_i > static_cast(CryptoSource::kPkcs11)) { - throw deserialization_error(); - } - - cs = static_cast(cs_i); - - return des; -} - -asn1::Deserializer& operator>>(asn1::Deserializer& des, boost::filesystem::path& path) { - std::string path_string; - des >> asn1::implicit(path_string); - path = path_string; - return des; -} - -asn1::Deserializer& operator>>(asn1::Deserializer& des, TlsConfig& tls_conf) { - des >> asn1::seq >> asn1::implicit(tls_conf.server) >> tls_conf.server_url_path >> - tls_conf.ca_source >> tls_conf.pkey_source >> tls_conf.cert_source >> asn1::endseq; - return des; -} diff --git a/src/libaktualizr/config/config.h b/src/libaktualizr/config/config.h index 2eae5ad77c..a9b2c7d429 100644 --- a/src/libaktualizr/config/config.h +++ b/src/libaktualizr/config/config.h @@ -9,8 +9,6 @@ #include #include #include - -#include "asn1/asn1-cerstream.h" #include "bootloader/bootloader.h" #include "crypto/keymanager_config.h" #include "crypto/p11_config.h" @@ -48,9 +46,6 @@ struct TlsConfig { void writeToStream(std::ostream& out_stream) const; }; -asn1::Serializer& operator<<(asn1::Serializer& ser, const TlsConfig& tls_conf); -asn1::Deserializer& operator>>(asn1::Deserializer& des, TlsConfig& tls_conf); - struct ProvisionConfig { std::string server; std::string p12_password; diff --git a/src/libaktualizr/primary/sotauptaneclient.cc b/src/libaktualizr/primary/sotauptaneclient.cc index 15a6e7315c..5620697164 100644 --- a/src/libaktualizr/primary/sotauptaneclient.cc +++ b/src/libaktualizr/primary/sotauptaneclient.cc @@ -67,12 +67,6 @@ SotaUptaneClient::SotaUptaneClient(Config &config_in, std::shared_ptrsetBootOK(); } - if (config.discovery.ipuptane) { - IpSecondaryDiscovery ip_uptane_discovery{config.network}; - auto ipuptane_secs = ip_uptane_discovery.discover(); - config.uptane.secondary_configs.insert(config.uptane.secondary_configs.end(), ipuptane_secs.begin(), - ipuptane_secs.end()); - } std::vector::const_iterator it; for (it = config.uptane.secondary_configs.begin(); it != config.uptane.secondary_configs.end(); ++it) { auto sec = Uptane::SecondaryFactory::makeSecondary(*it); diff --git a/src/libaktualizr/primary/sotauptaneclient.h b/src/libaktualizr/primary/sotauptaneclient.h index cdfb450e36..fc805985d0 100644 --- a/src/libaktualizr/primary/sotauptaneclient.h +++ b/src/libaktualizr/primary/sotauptaneclient.h @@ -24,7 +24,6 @@ #include "uptane/exceptions.h" #include "uptane/fetcher.h" #include "uptane/imagesrepository.h" -#include "uptane/ipsecondarydiscovery.h" #include "uptane/iterator.h" #include "uptane/secondaryinterface.h" diff --git a/src/libaktualizr/uptane/CMakeLists.txt b/src/libaktualizr/uptane/CMakeLists.txt index 7fa1199187..d378b40851 100644 --- a/src/libaktualizr/uptane/CMakeLists.txt +++ b/src/libaktualizr/uptane/CMakeLists.txt @@ -1,7 +1,5 @@ set(SOURCES fetcher.cc - ipsecondarydiscovery.cc - ipuptanesecondary.cc iterator.cc managedsecondary.cc metawithkeys.cc @@ -19,8 +17,6 @@ set(SOURCES set(HEADERS exceptions.h fetcher.h - ipsecondarydiscovery.h - ipuptanesecondary.h iterator.h managedsecondary.h partialverificationsecondary.h @@ -46,10 +42,6 @@ if (BUILD_ISOTP) target_include_directories(uptane PRIVATE ${PROJECT_SOURCE_DIR}/third_party/isotp-c/src) endif (BUILD_ISOTP) -get_property(ASN1_INCLUDE_DIRS TARGET asn1_lib PROPERTY INCLUDE_DIRECTORIES) -target_include_directories(uptane PUBLIC ${ASN1_INCLUDE_DIRS}) - -add_aktualizr_test(NAME discovery_secondary SOURCES ipsecondary_discovery_test.cc PROJECT_WORKING_DIRECTORY) add_aktualizr_test(NAME tuf SOURCES tuf_test.cc PROJECT_WORKING_DIRECTORY) add_aktualizr_test(NAME tuf_hash SOURCES tuf_hash_test.cc PROJECT_WORKING_DIRECTORY) diff --git a/src/libaktualizr/uptane/secondaryfactory.cc b/src/libaktualizr/uptane/secondaryfactory.cc index 314cc00a13..01ef64b05a 100644 --- a/src/libaktualizr/uptane/secondaryfactory.cc +++ b/src/libaktualizr/uptane/secondaryfactory.cc @@ -1,7 +1,6 @@ #include "uptane/secondaryfactory.h" #include "logging/logging.h" -#include "uptane/ipuptanesecondary.h" #include "uptane/virtualsecondary.h" #ifdef ISOTP_SECONDARY_ENABLED @@ -21,8 +20,6 @@ std::shared_ptr SecondaryFactory::makeSecondary(const Second case SecondaryType::kLegacy: LOG_ERROR << "Legacy secondary support is deprecated."; return std::shared_ptr(); // NULL-equivalent - case SecondaryType::kIpUptane: - return std::make_shared(sconfig); case SecondaryType::kIsoTpUptane: #ifdef ISOTP_SECONDARY_ENABLED return std::make_shared(sconfig); From f798e2c391e340960c0acd87b8ef2b1201ea301e Mon Sep 17 00:00:00 2001 From: Mike Sul Date: Thu, 11 Apr 2019 11:10:24 +0300 Subject: [PATCH 2/3] OTA-2480: Remove OPC-UA support Signed-off-by: Mike Sul --- .travis.yml | 2 +- CMakeLists.txt | 18 - Jenkinsfile | 1 - README.adoc | 1 - actions.md | 1 - ci/gitlab/.gitlab-ci.yml | 1 - docker/Dockerfile-test-install.ubuntu.bionic | 1 - docker/Dockerfile-test-install.ubuntu.xenial | 1 - docker/Dockerfile.debian.testing | 1 - docker/Dockerfile.ubuntu.bionic | 1 - docker/Dockerfile.ubuntu.xenial | 1 - docs/Doxyfile.in | 1 - docs/README.adoc | 2 - docs/opcua-bridge.adoc | 44 - scripts/test.sh | 2 - src/aktualizr_secondary/CMakeLists.txt | 19 +- .../aktualizr_secondary_opcua.cc | 20 - .../aktualizr_secondary_opcua.h | 27 - src/aktualizr_secondary/main.cc | 24 +- .../opcuaserver_secondary_delegate.cc | 139 - .../opcuaserver_secondary_delegate.h | 30 - src/libaktualizr/CMakeLists.txt | 8 - src/libaktualizr/opcuabridge/CMakeLists.txt | 76 - src/libaktualizr/opcuabridge/boostarch.h | 28 - src/libaktualizr/opcuabridge/common.cc | 160 - src/libaktualizr/opcuabridge/common.h | 353 - src/libaktualizr/opcuabridge/configuration.h | 82 - src/libaktualizr/opcuabridge/currenttime.h | 73 - .../opcuabridge/ecuversionmanifest.h | 52 - .../opcuabridge/ecuversionmanifestsigned.h | 66 - src/libaktualizr/opcuabridge/filedata.h | 55 - src/libaktualizr/opcuabridge/filelist.cc | 53 - src/libaktualizr/opcuabridge/filelist.h | 85 - src/libaktualizr/opcuabridge/hash.h | 44 - src/libaktualizr/opcuabridge/image.h | 52 - src/libaktualizr/opcuabridge/imageblock.h | 71 - src/libaktualizr/opcuabridge/imagefile.h | 69 - src/libaktualizr/opcuabridge/imagerequest.h | 57 - src/libaktualizr/opcuabridge/metadatafile.h | 86 - src/libaktualizr/opcuabridge/metadatafiles.h | 69 - src/libaktualizr/opcuabridge/opcuabridge.h | 23 - .../opcuabridge/opcuabridge_messaging_test.cc | 179 - .../opcuabridge_ostree_repo_sync_client.cc | 83 - .../opcuabridge_ostree_repo_sync_server.cc | 89 - .../opcuabridge/opcuabridge_secondary.cc | 114 - .../opcuabridge_secondary_update_test.cc | 170 - .../opcuabridge/opcuabridge_server.cc | 46 - .../opcuabridge/opcuabridge_test_utils.cc | 51 - .../opcuabridge/opcuabridge_test_utils.h | 88 - .../opcuabridge/opcuabridgeclient.cc | 248 - .../opcuabridge/opcuabridgeclient.h | 84 - .../opcuabridge/opcuabridgeconfig.h | 21 - .../opcuabridge/opcuabridgediscoveryclient.cc | 103 - .../opcuabridge/opcuabridgediscoveryclient.h | 40 - .../opcuabridge/opcuabridgediscoveryserver.cc | 50 - .../opcuabridge/opcuabridgediscoveryserver.h | 36 - .../opcuabridge/opcuabridgediscoverytypes.h | 18 - .../opcuabridge/opcuabridgeserver.cc | 133 - .../opcuabridge/opcuabridgeserver.h | 87 - .../opcuabridge/originalmanifest.h | 60 - .../run_opcuabridge_ostree_repo_sync_test.sh | 34 - src/libaktualizr/opcuabridge/signature.h | 60 - src/libaktualizr/opcuabridge/signed.h | 44 - src/libaktualizr/opcuabridge/utility.h | 51 - src/libaktualizr/opcuabridge/versionreport.h | 72 - src/libaktualizr/primary/sotauptaneclient.cc | 8 +- src/libaktualizr/uptane/CMakeLists.txt | 7 +- src/libaktualizr/uptane/opcuasecondary.cc | 96 - src/libaktualizr/uptane/opcuasecondary.h | 34 - src/libaktualizr/uptane/secondaryconfig.cc | 2 - src/libaktualizr/uptane/secondaryconfig.h | 4 - src/libaktualizr/uptane/secondaryfactory.cc | 11 - third_party/open62541/open62541.c | 36219 ---------------- third_party/open62541/open62541.h | 14536 ------- thirdparty.spdx | 40 - 75 files changed, 6 insertions(+), 54811 deletions(-) delete mode 100644 docs/opcua-bridge.adoc delete mode 100644 src/aktualizr_secondary/aktualizr_secondary_opcua.cc delete mode 100644 src/aktualizr_secondary/aktualizr_secondary_opcua.h delete mode 100644 src/aktualizr_secondary/opcuaserver_secondary_delegate.cc delete mode 100644 src/aktualizr_secondary/opcuaserver_secondary_delegate.h delete mode 100644 src/libaktualizr/opcuabridge/CMakeLists.txt delete mode 100644 src/libaktualizr/opcuabridge/boostarch.h delete mode 100644 src/libaktualizr/opcuabridge/common.cc delete mode 100644 src/libaktualizr/opcuabridge/common.h delete mode 100644 src/libaktualizr/opcuabridge/configuration.h delete mode 100644 src/libaktualizr/opcuabridge/currenttime.h delete mode 100644 src/libaktualizr/opcuabridge/ecuversionmanifest.h delete mode 100644 src/libaktualizr/opcuabridge/ecuversionmanifestsigned.h delete mode 100644 src/libaktualizr/opcuabridge/filedata.h delete mode 100644 src/libaktualizr/opcuabridge/filelist.cc delete mode 100644 src/libaktualizr/opcuabridge/filelist.h delete mode 100644 src/libaktualizr/opcuabridge/hash.h delete mode 100644 src/libaktualizr/opcuabridge/image.h delete mode 100644 src/libaktualizr/opcuabridge/imageblock.h delete mode 100644 src/libaktualizr/opcuabridge/imagefile.h delete mode 100644 src/libaktualizr/opcuabridge/imagerequest.h delete mode 100644 src/libaktualizr/opcuabridge/metadatafile.h delete mode 100644 src/libaktualizr/opcuabridge/metadatafiles.h delete mode 100644 src/libaktualizr/opcuabridge/opcuabridge.h delete mode 100644 src/libaktualizr/opcuabridge/opcuabridge_messaging_test.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridge_ostree_repo_sync_client.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridge_ostree_repo_sync_server.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridge_secondary.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridge_secondary_update_test.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridge_server.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridge_test_utils.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridge_test_utils.h delete mode 100644 src/libaktualizr/opcuabridge/opcuabridgeclient.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridgeclient.h delete mode 100644 src/libaktualizr/opcuabridge/opcuabridgeconfig.h delete mode 100644 src/libaktualizr/opcuabridge/opcuabridgediscoveryclient.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridgediscoveryclient.h delete mode 100644 src/libaktualizr/opcuabridge/opcuabridgediscoveryserver.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridgediscoveryserver.h delete mode 100644 src/libaktualizr/opcuabridge/opcuabridgediscoverytypes.h delete mode 100644 src/libaktualizr/opcuabridge/opcuabridgeserver.cc delete mode 100644 src/libaktualizr/opcuabridge/opcuabridgeserver.h delete mode 100644 src/libaktualizr/opcuabridge/originalmanifest.h delete mode 100755 src/libaktualizr/opcuabridge/run_opcuabridge_ostree_repo_sync_test.sh delete mode 100644 src/libaktualizr/opcuabridge/signature.h delete mode 100644 src/libaktualizr/opcuabridge/signed.h delete mode 100644 src/libaktualizr/opcuabridge/utility.h delete mode 100644 src/libaktualizr/opcuabridge/versionreport.h delete mode 100644 src/libaktualizr/uptane/opcuasecondary.cc delete mode 100644 src/libaktualizr/uptane/opcuasecondary.h delete mode 100644 third_party/open62541/open62541.c delete mode 100644 third_party/open62541/open62541.h diff --git a/.travis.yml b/.travis.yml index 60db402c8e..5d44c23661 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ env: - DOCKERFILE=docker/Dockerfile.ubuntu.bionic SCRIPT=scripts/test.sh DARGS="-eTEST_CMAKE_BUILD_TYPE=Valgrind -eTEST_WITH_COVERAGE=1 -eTEST_WITH_P11=1 -eTEST_WITH_FAULT_INJECTION=1 -eTEST_TESTSUITE_EXCLUDE=credentials -eTEST_SOTA_PACKED_CREDENTIALS=dummy-credentials" - DOCKERFILE=docker/Dockerfile.debian.testing SCRIPT=scripts/test.sh - DARGS="-eTEST_CC=clang -eTEST_WITH_LOAD_TESTS=1 -eTEST_WITH_TESTSUITE=0 -eTEST_WITH_STATICTESTS=1 -eTEST_WITH_OPCUA=1" + DARGS="-eTEST_CC=clang -eTEST_WITH_LOAD_TESTS=1 -eTEST_WITH_TESTSUITE=0 -eTEST_WITH_STATICTESTS=1" - DEPLOY_PKGS=1 RELEASE_NAME=ubuntu_18.04 DOCKERFILE=docker/Dockerfile.ubuntu.bionic INSTALL_DOCKERFILE=docker/Dockerfile-test-install.ubuntu.bionic SCRIPT=scripts/build_ubuntu.sh DARGS="-eTEST_INSTALL_RELEASE_NAME=-ubuntu_18.04" - DEPLOY_PKGS=1 RELEASE_NAME=ubuntu_16.04 DOCKERFILE=docker/Dockerfile.ubuntu.xenial INSTALL_DOCKERFILE=docker/Dockerfile-test-install.ubuntu.xenial SCRIPT=scripts/build_ubuntu.sh DARGS="-eTEST_INSTALL_RELEASE_NAME=-ubuntu_16.04" services: diff --git a/CMakeLists.txt b/CMakeLists.txt index eb36f22f53..f30aa50837 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,6 @@ option(BUILD_OSTREE "Set to ON to compile with ostree support" OFF) option(BUILD_DEB "Set to ON to compile with debian packages support" OFF) option(BUILD_P11 "Support for key storage in a HSM via PKCS#11" OFF) option(BUILD_SOTA_TOOLS "Set to ON to build SOTA tools" OFF) -option(BUILD_OPCUA "Set to ON to compile with OPC-UA protocol support" OFF) option(BUILD_PARTIAL "Set to ON to compile with partial secondaries support" OFF) option(BUILD_ISOTP "Set to ON to compile with ISO/TP protocol support" OFF) option(BUILD_SYSTEMD "Set to ON to compile with systemd additional support" ${BUILD_SYSTEMD_DEFAULT}) @@ -72,10 +71,6 @@ if(ANDROID) endif() endif(ANDROID) -if(BUILD_OPCUA) - list(APPEND BOOST_COMPONENTS serialization iostreams) -endif(BUILD_OPCUA) - # Mac brew library install paths if(EXISTS /usr/local/opt/openssl) @@ -143,13 +138,6 @@ if(BUILD_SOTA_TOOLS) find_program(STRACE NAMES strace) endif(BUILD_SOTA_TOOLS) -if(BUILD_OPCUA) - add_definitions(-DOPCUA_SECONDARY_ENABLED) - if (NOT BUILD_OSTREE) - message(FATAL_ERROR "BUILD_OPCUA requires BUILD_OSTREE") - endif(NOT BUILD_OSTREE) -endif(BUILD_OPCUA) - if(BUILD_ISOTP) add_definitions(-DISOTP_SECONDARY_ENABLED) endif(BUILD_ISOTP) @@ -435,12 +423,6 @@ add_subdirectory("docs") file(GLOB_RECURSE ALL_SOURCE_FILES RELATIVE ${CMAKE_SOURCE_DIR} src/*.cc src/*.c src/*.h) foreach(FILE ${ALL_SOURCE_FILES}) - # ignore opcuabridge - string (FIND ${FILE} "/opcuabridge/" EXCLUDE_DIR_FOUND) - if (NOT ${EXCLUDE_DIR_FOUND} EQUAL -1) - continue() - endif() - string (FIND ${FILE} "/isotp_conn/" EXCLUDE_DIR_FOUND) if (NOT ${EXCLUDE_DIR_FOUND} EQUAL -1) continue() diff --git a/Jenkinsfile b/Jenkinsfile index bfcb3d73da..6d9522741a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -115,7 +115,6 @@ pipeline { TEST_CMAKE_BUILD_TYPE = 'Debug' TEST_TESTSUITE_ONLY = 'crypto' TEST_WITH_STATICTESTS = '1' - TEST_WITH_OPCUA = '1' TEST_WITH_LOAD_TESTS = '1' // build only } steps { diff --git a/README.adoc b/README.adoc index 794032d2e1..557d0a22d0 100644 --- a/README.adoc +++ b/README.adoc @@ -65,7 +65,6 @@ Some features also require additional packages: * For PKCS#11 support, you will need `libp11-2 libp11-dev`. * For systemd support for secondaries, you will need `libsystemd-dev`. * For fault injection, you will need `fiu-utils libfiu-dev`. -* For OPCUA support, you will need `libboost-iostreams-dev libboost-serialization-dev`. * For Debian packagin support, you will need `libdpkg-dev`. ==== Mac support diff --git a/actions.md b/actions.md index 9d16a91166..0892499a15 100644 --- a/actions.md +++ b/actions.md @@ -269,7 +269,6 @@ These are internal requirements that are relatively opaque to the user and/or co - [x] Support virtual partial verification secondaries for testing - [x] Partial verification secondaries generate and store public keys (uptane_secondary_test.cc) - [x] Partial verification secondaries can verify Uptane metadata (uptane_secondary_test.cc) - - [x] Support OPC-UA secondaries (opcuabridge_messaging_test.cc, opcuabridge_secondary_update_test.cc, run_opcuabridge_ostree_repo_sync_test.sh) ### Expected action sequences diff --git a/ci/gitlab/.gitlab-ci.yml b/ci/gitlab/.gitlab-ci.yml index 96ee305182..bb05cdffb0 100644 --- a/ci/gitlab/.gitlab-ci.yml +++ b/ci/gitlab/.gitlab-ci.yml @@ -61,7 +61,6 @@ Debian build and test: TEST_CMAKE_BUILD_TYPE: 'Debug' TEST_TESTSUITE_ONLY: 'crypto' TEST_WITH_STATICTESTS: '1' - TEST_WITH_OPCUA: '1' TEST_WITH_LOAD_TESTS: '1' image: "$DEBIAN_TESTING_PR_IMAGE" stage: Build and Test diff --git a/docker/Dockerfile-test-install.ubuntu.bionic b/docker/Dockerfile-test-install.ubuntu.bionic index f64ab0fbe2..0b9a619ece 100644 --- a/docker/Dockerfile-test-install.ubuntu.bionic +++ b/docker/Dockerfile-test-install.ubuntu.bionic @@ -6,7 +6,6 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get -y install debian-archive-keyring RUN apt-get update && apt-get install -y \ libarchive13 \ - libboost-iostreams1.65.1 \ libboost-log1.65.1 \ libboost-program-options1.65.1 \ libboost-system1.65.1 \ diff --git a/docker/Dockerfile-test-install.ubuntu.xenial b/docker/Dockerfile-test-install.ubuntu.xenial index 16dbebefef..45e6e21c26 100644 --- a/docker/Dockerfile-test-install.ubuntu.xenial +++ b/docker/Dockerfile-test-install.ubuntu.xenial @@ -6,7 +6,6 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get -y install debian-archive-keyring RUN apt-get update && apt-get install -y \ libarchive13 \ - libboost-iostreams1.58.0 \ libboost-log1.58.0 \ libboost-program-options1.58.0 \ libboost-system1.58.0 \ diff --git a/docker/Dockerfile.debian.testing b/docker/Dockerfile.debian.testing index 53a473162d..77b9888593 100644 --- a/docker/Dockerfile.debian.testing +++ b/docker/Dockerfile.debian.testing @@ -25,7 +25,6 @@ RUN apt-get update && apt-get -y install \ lcov \ libarchive-dev \ libboost-dev \ - libboost-iostreams-dev \ libboost-log-dev \ libboost-program-options-dev \ libboost-system-dev \ diff --git a/docker/Dockerfile.ubuntu.bionic b/docker/Dockerfile.ubuntu.bionic index fa33f83363..aad88606ad 100644 --- a/docker/Dockerfile.ubuntu.bionic +++ b/docker/Dockerfile.ubuntu.bionic @@ -22,7 +22,6 @@ RUN apt-get update && apt-get -y install \ lcov \ libarchive-dev \ libboost-dev \ - libboost-iostreams-dev \ libboost-log-dev \ libboost-program-options-dev \ libboost-system-dev \ diff --git a/docker/Dockerfile.ubuntu.xenial b/docker/Dockerfile.ubuntu.xenial index 208d6726de..a64a8c1b2b 100644 --- a/docker/Dockerfile.ubuntu.xenial +++ b/docker/Dockerfile.ubuntu.xenial @@ -23,7 +23,6 @@ RUN apt-get update && apt-get -y install \ lcov \ libarchive-dev \ libboost-dev \ - libboost-iostreams-dev \ libboost-log-dev \ libboost-program-options-dev \ libboost-system-dev \ diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index bed1010a12..0dc9ccfb54 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -805,7 +805,6 @@ INPUT = @CMAKE_SOURCE_DIR@/CONTRIBUTING.md \ @CMAKE_SOURCE_DIR@/src/libaktualizr/crypto \ @CMAKE_SOURCE_DIR@/src/libaktualizr/http \ @CMAKE_SOURCE_DIR@/src/libaktualizr/logging \ - @CMAKE_SOURCE_DIR@/src/libaktualizr/opcuabridge \ @CMAKE_SOURCE_DIR@/src/libaktualizr/package_manager \ @CMAKE_SOURCE_DIR@/src/libaktualizr/primary \ @CMAKE_SOURCE_DIR@/src/libaktualizr/socket_activation \ diff --git a/docs/README.adoc b/docs/README.adoc index b67b8dffc8..ec3640e36c 100644 --- a/docs/README.adoc +++ b/docs/README.adoc @@ -22,8 +22,6 @@ link:./integrating-libaktualizr.adoc[integrating-libaktualizr.adoc] - How to use link:./linux-secondaries.adoc[linux-secondaries.adoc] - A quick how-to demonstrating aktualizr on a secondary ECU, using two QEMU devices. -link:./opcua-bridge.adoc[opcua-bridge.adoc] - Some basic documentation on getting OPC-UA working. OPC-UA is a protocol for in-vehicle inter-ECU communication. - link:./rollback.adoc[rollback.adoc] - Developer documentation on how aktualizr, OSTree, and u-boot can be used to implement automatic rollback of a failed update. link:./schema-migrations.adoc[schema-migrations.adoc] - aktualizr uses a SQLite database for storing some config information and keys. This describes the steps needed for migrating the DB schema. Only useful for aktualizr developers. diff --git a/docs/opcua-bridge.adoc b/docs/opcua-bridge.adoc deleted file mode 100644 index c464f58756..0000000000 --- a/docs/opcua-bridge.adoc +++ /dev/null @@ -1,44 +0,0 @@ -= OPC-UA Bridge - -The document describes communication option between primary and secondary based on OPC-UA protocol. - -== OPC-UA - -OPC Unified Architecture (OPC UA) is a machine to machine communication protocol for industrial automation developed by the OPC Foundation. OPC-UA implementation -https://open62541.org[open62541] is currently in use. - -== Build - -Use build configuration option `BUILD_OPCUA=ON` to enable OPC-UA support. Currently OPC-UA transport support only ostree updates, so `BUILD_OSTREE=ON` is also need to be set. - -== Setup - -Primary is required to have `"secondary_type" : "opcua_uptane"` configured for each secondary OPC-UA bridge is used. - -On secondary side it is required to use `--opcua` command line option to enable OPC-UA support. - -== OPC-UA Bridge Demo Notes - -Check instructions stated in https://docs.ota.here.com/quickstarts/raspberry-pi.html[Raspberry Pi] to prepare primary and secondary images. At the moment no dedicated -SOTA feature is introduced to activate OPC-UA, so ensure that build options mentioned above are set. - -=== Raspberry PI 3 Wireless Support - -Check instructions described in https://raspinterest.wordpress.com/2017/02/28/configure-wlan0-and-bluetooth-in-yocto-raspberry-pi-3/[wlan0 in Yocto Raspberry Pi 3]. -Ensure that required modules (rfkill, cfg80211, brcmutil, brcmfmac) is deployed/added to image. - -=== On-board Wireless Configuration - -After modules are loaded and link is up, use connmanctl (https://wiki.archlinux.org/index.php/ConnMan[ConnMan]) utility to establish connection with access point. - -=== Order of the Devices Activation - -Currently the devices are need to be booted that primary is after secondaries. - -When the primary is need to have additional tunings (WiFi setup etc.) the order may be the following: -[options="compact"] -1. Boot primary -2. Stop aktualizr service on primary -3. Do additional configuration -4. Boot secondary -5. Run aktualizr service on primary diff --git a/scripts/test.sh b/scripts/test.sh index f6bed8cb74..8ba2b96037 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -20,7 +20,6 @@ TEST_WITH_OSTREE=${TEST_WITH_OSTREE:-1} TEST_WITH_DEB=${TEST_WITH_DEB:-1} TEST_WITH_ISOTP=${TEST_WITH_ISOTP:-1} TEST_WITH_PARTIAL=${TEST_WITH_PARTIAL:-1} -TEST_WITH_OPCUA=${TEST_WITH_OPCUA:-0} TEST_WITH_FAULT_INJECTION=${TEST_WITH_FAULT_INJECTION:-0} TEST_WITH_LOAD_TESTS=${TEST_WITH_LOAD_TESTS:-0} @@ -51,7 +50,6 @@ if [[ $TEST_WITH_OSTREE = 1 ]]; then CMAKE_ARGS+=("-DBUILD_OSTREE=ON"); fi if [[ $TEST_WITH_DEB = 1 ]]; then CMAKE_ARGS+=("-DBUILD_DEB=ON"); fi if [[ $TEST_WITH_ISOTP = 1 ]]; then CMAKE_ARGS+=("-DBUILD_ISOTP=ON"); fi if [[ $TEST_WITH_PARTIAL = 1 ]]; then CMAKE_ARGS+=("-DBUILD_PARTIAL=ON"); fi -if [[ $TEST_WITH_OPCUA = 1 ]]; then CMAKE_ARGS+=("-DBUILD_OPCUA=ON"); fi if [[ $TEST_WITH_FAULT_INJECTION = 1 ]]; then CMAKE_ARGS+=("-DFAULT_INJECTION=ON"); fi if [[ $TEST_WITH_LOAD_TESTS = 1 ]]; then CMAKE_ARGS+=("-DBUILD_LOAD_TESTS=ON"); fi if [[ -n $TEST_SOTA_PACKED_CREDENTIALS ]]; then diff --git a/src/aktualizr_secondary/CMakeLists.txt b/src/aktualizr_secondary/CMakeLists.txt index 75ae44be00..42172816ec 100644 --- a/src/aktualizr_secondary/CMakeLists.txt +++ b/src/aktualizr_secondary/CMakeLists.txt @@ -22,20 +22,6 @@ add_library(aktualizr_secondary_static_lib STATIC target_link_libraries(aktualizr_secondary_static_lib aktualizr-posix) -set(OPCUA_SECONDARY_SRC - opcuaserver_secondary_delegate.cc - aktualizr_secondary_opcua.cc - ) - -if (BUILD_OPCUA) - target_sources(aktualizr_secondary_static_lib PRIVATE - ${OPCUA_SECONDARY_SRC} $) - set_source_files_properties(${OPCUA_SECONDARY_SRC} ${AKTUALIZR_SECONDARY_SRC} - PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-float-equal -Wno-logical-op -Wno-unknown-warning-option") - target_include_directories(aktualizr_secondary_static_lib PUBLIC ${PROJECT_SOURCE_DIR}/src/libaktualizr/opcuabridge - ${PROJECT_SOURCE_DIR}/third_party/open62541) -endif (BUILD_OPCUA) - target_include_directories(aktualizr_secondary_static_lib PUBLIC $ $ @@ -58,8 +44,6 @@ set(ALL_AKTUALIZR_SECONDARY_HEADERS aktualizr_secondary_config.h aktualizr_secondary_common.h aktualizr_secondary_discovery.h - aktualizr_secondary_opcua.h - opcuaserver_secondary_delegate.h socket_server.h ) @@ -154,8 +138,7 @@ set_tests_properties(aktualizr_secondary_help_with_other_options aktualizr_source_file_checks(${AKTUALIZR_SECONDARY_SRC} ${AKTUALIZR_SECONDARY_LIB_SRC} - ${ALL_AKTUALIZR_SECONDARY_HEADERS} - ${OPCUA_SECONDARY_SRC} + ${ALL_AKTUALIZR_SECONDARY_HEADERS} ${TEST_SOURCES}) # vim: set tabstop=4 shiftwidth=4 expandtab: diff --git a/src/aktualizr_secondary/aktualizr_secondary_opcua.cc b/src/aktualizr_secondary/aktualizr_secondary_opcua.cc deleted file mode 100644 index 4bd8af8658..0000000000 --- a/src/aktualizr_secondary/aktualizr_secondary_opcua.cc +++ /dev/null @@ -1,20 +0,0 @@ -#include "aktualizr_secondary_opcua.h" -#include "socket_activation.h" - -#include - -AktualizrSecondaryOpcua::AktualizrSecondaryOpcua(const AktualizrSecondaryConfig& config, - std::shared_ptr& storage) - : AktualizrSecondaryCommon(config, storage), running_(true), delegate_(this) { - if (socket_activation::listen_fds(0) >= 1) { - LOG_INFO << "Use socket activation"; - server_ = boost::make_unique(&delegate_, socket_activation::listen_fds_start + 0, - socket_activation::listen_fds_start + 1, config_.network.port); - } else { - server_ = boost::make_unique(&delegate_, config_.network.port); - } -} - -void AktualizrSecondaryOpcua::run() { server_->run(&running_); } - -void AktualizrSecondaryOpcua::stop() { running_ = false; } diff --git a/src/aktualizr_secondary/aktualizr_secondary_opcua.h b/src/aktualizr_secondary/aktualizr_secondary_opcua.h deleted file mode 100644 index 731a1870f0..0000000000 --- a/src/aktualizr_secondary/aktualizr_secondary_opcua.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef AKTUALIZR_SECONDARY_OPCUA_H_ -#define AKTUALIZR_SECONDARY_OPCUA_H_ - -#include - -#include "aktualizr_secondary_common.h" -#include "aktualizr_secondary_config.h" -#include "aktualizr_secondary_interface.h" -#include "opcuaserver_secondary_delegate.h" - -#include - -#include - -class AktualizrSecondaryOpcua : public AktualizrSecondaryInterface, private AktualizrSecondaryCommon { - public: - AktualizrSecondaryOpcua(const AktualizrSecondaryConfig& /*config*/, std::shared_ptr& /*storage*/); - void run() override; - void stop() override; - - private: - bool running_; - OpcuaServerSecondaryDelegate delegate_; - std::unique_ptr server_; -}; - -#endif // AKTUALIZR_SECONDARY_OPCUA_H_ diff --git a/src/aktualizr_secondary/main.cc b/src/aktualizr_secondary/main.cc index 40bff57aff..d0b65f1bf9 100644 --- a/src/aktualizr_secondary/main.cc +++ b/src/aktualizr_secondary/main.cc @@ -9,9 +9,6 @@ #include "aktualizr_secondary.h" #include "aktualizr_secondary_config.h" #include "aktualizr_secondary_discovery.h" -#ifdef OPCUA_SECONDARY_ENABLED -#include "aktualizr_secondary_opcua.h" -#endif #include "utilities/utils.h" #include "logging/logging.h" @@ -44,10 +41,6 @@ class AktualizrSecondaryWithDiscovery : public AktualizrSecondaryInterface { std::thread discovery_thread_; }; -#ifdef OPCUA_SECONDARY_ENABLED -typedef AktualizrSecondaryOpcua AktualizrSecondaryOpcuaWithDiscovery; -#endif - void check_secondary_options(const bpo::options_description &description, const bpo::variables_map &vm) { if (vm.count("help") != 0) { std::cout << description << '\n'; @@ -70,8 +63,7 @@ bpo::variables_map parse_options(int argc, char *argv[]) { ("server-port,p", bpo::value(), "command server listening port") ("discovery-port,d", bpo::value(), "discovery service listening port (0 to disable)") ("ecu-serial", bpo::value(), "serial number of secondary ecu") - ("ecu-hardware-id", bpo::value(), "hardware ID of secondary ecu") - ("opcua", "use OPC-UA protocol"); + ("ecu-hardware-id", bpo::value(), "hardware ID of secondary ecu"); // clang-format on bpo::variables_map vm; @@ -127,20 +119,8 @@ int main(int argc, char *argv[]) { // storage (share class with primary) std::shared_ptr storage = INvStorage::newStorage(config.storage); - std::unique_ptr secondary; - - if (commandline_map.count("opcua") != 0) { -#ifdef OPCUA_SECONDARY_ENABLED - secondary = std_::make_unique(config, storage); -#else - LOG_ERROR << "Built without OPC-UA support!"; - return EXIT_FAILURE; -#endif - } else { - secondary = std_::make_unique(config, storage); - } - + secondary = std_::make_unique(config, storage); secondary->run(); } catch (std::runtime_error &exc) { diff --git a/src/aktualizr_secondary/opcuaserver_secondary_delegate.cc b/src/aktualizr_secondary/opcuaserver_secondary_delegate.cc deleted file mode 100644 index a1688b6656..0000000000 --- a/src/aktualizr_secondary/opcuaserver_secondary_delegate.cc +++ /dev/null @@ -1,139 +0,0 @@ -#include "opcuaserver_secondary_delegate.h" -#include "aktualizr_secondary_common.h" - -#include "logging/logging.h" -#include "package_manager/ostreereposync.h" -#include "package_manager/packagemanagerinterface.h" -#include "utilities/utils.h" - -#include - -#include - -namespace fs = boost::filesystem; - -OpcuaServerSecondaryDelegate::OpcuaServerSecondaryDelegate(AktualizrSecondaryCommon* secondary) - : secondary_(secondary), ostree_sync_working_repo_dir_("opcuabridge-ostree-sync-working-repo") {} - -void OpcuaServerSecondaryDelegate::handleServerInitialized(opcuabridge::ServerModel* model) { - if (secondary_->uptaneInitialize()) { - model->configuration_.setSerial(secondary_->ecu_serial_); - model->configuration_.setHwId(secondary_->hardware_id_); - PublicKey pk = secondary_->keys_.UptanePublicKey(); - model->configuration_.setPublicKeyType(pk.Type()); - model->configuration_.setPublicKey(pk.Value()); - - fs::path ostree_source_repo = ostree_repo_sync::GetOstreeRepoPath(secondary_->config_.pacman.sysroot); - - if (ostree_repo_sync::ArchiveModeRepo(ostree_source_repo)) { - model->file_data_.setBasePath(ostree_source_repo); - } else { - model->file_data_.setBasePath(ostree_sync_working_repo_dir_.Path()); - if (!ostree_repo_sync::LocalPullRepo(ostree_source_repo, ostree_sync_working_repo_dir_.Path())) { - LOG_ERROR << "OSTree repo sync failed: unable to local pull from " << ostree_source_repo.string(); - } - } - } else { - LOG_ERROR << "Secondary: failed to initialize"; - } -} - -void OpcuaServerSecondaryDelegate::handleVersionReportRequested(opcuabridge::ServerModel* model) {} - -void OpcuaServerSecondaryDelegate::handleOriginalManifestRequested(opcuabridge::ServerModel* model) { - auto manifest_signed = - Utils::jsonToStr(secondary_->keys_.signTuf(secondary_->pacman->getManifest(secondary_->ecu_serial_))); - model->original_manifest_.getBlock().resize(manifest_signed.size()); - std::copy(manifest_signed.begin(), manifest_signed.end(), model->original_manifest_.getBlock().begin()); -} - -void OpcuaServerSecondaryDelegate::handleMetaDataFileReceived(opcuabridge::ServerModel* model) { - std::string json(model->metadatafile_.getMetadata().begin(), model->metadatafile_.getMetadata().end()); - auto metadata = Utils::parseJSON(json); - // TODO: parsing as a part of reception is WRONG - if (metadata != Json::nullValue && metadata.isMember("signed")) { - if (metadata["signed"]["_type"].asString() == "Root") { - received_meta_pack_.director_root = json; - } else if (metadata["signed"]["_type"].asString() == "Targets") { - received_meta_pack_.director_targets = json; - } - } -} - -void OpcuaServerSecondaryDelegate::handleAllMetaDataFilesReceived(opcuabridge::ServerModel* model) { - TimeStamp now(TimeStamp::Now()); - secondary_->detected_attack_.clear(); - - std::string root_str; - secondary_->storage_->loadLatestRoot(&root_str, Uptane::RepositoryType::Director()); - secondary_->root_ = Uptane::Root(Uptane::RepositoryType::Director(), Utils::parseJSON(root_str)); - - std::string targets_str; - secondary_->storage_->loadNonRoot(&targets_str, Uptane::RepositoryType::Director(), Uptane::Role::Targets()); - secondary_->meta_targets_ = Uptane::Targets(Utils::parseJSON(targets_str)); - - try { - // TODO: proper root metadata rotation - secondary_->root_ = Uptane::Root(Uptane::RepositoryType::Director(), - Utils::parseJSON(received_meta_pack_.director_root), secondary_->root_); - Uptane::Targets targets(Uptane::RepositoryType::Director(), Uptane::Role::Targets(), - Utils::parseJSON(received_meta_pack_.director_targets), - std::make_shared(secondary_->root_)); - if (secondary_->meta_targets_.version() > targets.version()) { - secondary_->detected_attack_ = "Rollback attack detected"; - LOG_ERROR << "Uptane security check: " << secondary_->detected_attack_; - return; - } - bool target_found = false; - secondary_->meta_targets_ = Uptane::Targets(received_meta_pack_.director_targets); - for (auto it = secondary_->meta_targets_.targets.begin(); it != secondary_->meta_targets_.targets.end(); ++it) { - if (it->IsForSecondary(secondary_->ecu_serial_)) { - if (target_found) { - secondary_->detected_attack_ = "Duplicate entry for this ECU"; - break; - } - target_found = true; - secondary_->target_ = std_::make_unique(*it); - } - } - } catch (const Uptane::SecurityException& ex) { - LOG_ERROR << "Uptane security check: " << ex.what(); - return; - } - secondary_->storage_->storeRoot(received_meta_pack_.director_root, Uptane::RepositoryType::Director(), - Uptane::Version(secondary_->root_.version())); - secondary_->storage_->storeNonRoot(received_meta_pack_.director_targets, Uptane::RepositoryType::Director(), - Uptane::Role::Targets()); -} - -void OpcuaServerSecondaryDelegate::handleDirectoryFilesSynchronized(opcuabridge::ServerModel* model) { - if (secondary_->target_) { - auto target_to_install = *secondary_->target_; - std::thread long_run_op([=]() { - fs::path ostree_source_repo = ostree_repo_sync::GetOstreeRepoPath(secondary_->config_.pacman.sysroot); - if (!ostree_repo_sync::ArchiveModeRepo(ostree_source_repo)) { - if (!ostree_repo_sync::LocalPullRepo(ostree_sync_working_repo_dir_.Path(), ostree_source_repo, - target_to_install.sha256Hash())) { - LOG_ERROR << "OSTree repo sync failed: unable to local pull from " - << ostree_sync_working_repo_dir_.Path().string(); - return; - } - } - data::InstallationResult result = secondary_->pacman->install(target_to_install); - secondary_->storage_->saveEcuInstallationResult(secondary_->ecu_serial_, result); - if (result.result_code.num_code != data::ResultCode::Numeric::kOk) { - LOG_ERROR << "Could not install target (" << result.result_code.toString() << "): " << result.description; - } else { - secondary_->storage_->saveInstalledVersion(secondary_->ecu_serial_.ToString(), target_to_install, - InstalledVersionUpdateMode::kCurrent); - } - }); - long_run_op.detach(); - } else { - LOG_ERROR << "No valid installation target found"; - } -} - -void OpcuaServerSecondaryDelegate::handleDirectoryFileListRequested(opcuabridge::ServerModel* model) { - opcuabridge::UpdateFileList(&model->file_list_, model->file_data_.getBasePath()); -} diff --git a/src/aktualizr_secondary/opcuaserver_secondary_delegate.h b/src/aktualizr_secondary/opcuaserver_secondary_delegate.h deleted file mode 100644 index 6f6049a8d0..0000000000 --- a/src/aktualizr_secondary/opcuaserver_secondary_delegate.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef AKTUALIZR_SECONDARY_OPCUASERVER_SECONDARY_DELEGATE_H_ -#define AKTUALIZR_SECONDARY_OPCUASERVER_SECONDARY_DELEGATE_H_ - -#include -#include -#include "utilities/utils.h" - -#include - -class AktualizrSecondaryCommon; - -class OpcuaServerSecondaryDelegate : public opcuabridge::ServerDelegate { - public: - explicit OpcuaServerSecondaryDelegate(AktualizrSecondaryCommon* /*secondary*/); - - void handleServerInitialized(opcuabridge::ServerModel* model) override; - void handleVersionReportRequested(opcuabridge::ServerModel* model) override; - void handleMetaDataFileReceived(opcuabridge::ServerModel* model) override; - void handleAllMetaDataFilesReceived(opcuabridge::ServerModel* model) override; - void handleDirectoryFilesSynchronized(opcuabridge::ServerModel* model) override; - void handleOriginalManifestRequested(opcuabridge::ServerModel* model) override; - void handleDirectoryFileListRequested(opcuabridge::ServerModel* model) override; - - private: - AktualizrSecondaryCommon* secondary_; - Uptane::RawMetaPack received_meta_pack_; - TemporaryDirectory ostree_sync_working_repo_dir_; -}; - -#endif // AKTUALIZR_SECONDARY_OPCUASERVER_SECONDARY_DELEGATE_H_ diff --git a/src/libaktualizr/CMakeLists.txt b/src/libaktualizr/CMakeLists.txt index 27389191f2..fa270ec186 100644 --- a/src/libaktualizr/CMakeLists.txt +++ b/src/libaktualizr/CMakeLists.txt @@ -17,10 +17,6 @@ if(BUILD_ISOTP) add_subdirectory("isotp_conn") endif(BUILD_ISOTP) -if (BUILD_OPCUA) - add_subdirectory("opcuabridge") -endif (BUILD_OPCUA) - add_library(aktualizr_static_lib STATIC $ $ @@ -38,10 +34,6 @@ add_library(aktualizr_static_lib STATIC $ $) -if (BUILD_OPCUA) - target_sources(aktualizr_static_lib PRIVATE $) -endif (BUILD_OPCUA) - if (BUILD_ISOTP) target_sources(aktualizr_static_lib PRIVATE $) endif (BUILD_ISOTP) diff --git a/src/libaktualizr/opcuabridge/CMakeLists.txt b/src/libaktualizr/opcuabridge/CMakeLists.txt deleted file mode 100644 index 155f62680d..0000000000 --- a/src/libaktualizr/opcuabridge/CMakeLists.txt +++ /dev/null @@ -1,76 +0,0 @@ -set(SOURCES common.cc - filelist.cc - opcuabridgeclient.cc - opcuabridgeserver.cc - opcuabridgediscoveryclient.cc - opcuabridgediscoveryserver.cc - ) - -set(HEADERS boostarch.h - common.h - configuration.h - currenttime.h - ecuversionmanifest.h - ecuversionmanifestsigned.h - filedata.h - filelist.h - hash.h - imageblock.h - imagefile.h - image.h - imagerequest.h - metadatafile.h - metadatafiles.h - opcuabridge.h - opcuabridgeclient.h - opcuabridgeconfig.h - opcuabridgediscoveryclient.h - opcuabridgediscoveryserver.h - opcuabridgediscoverytypes.h - opcuabridgeserver.h - originalmanifest.h - signature.h - signed.h - utility.h - versionreport.h) - -set_source_files_properties(${SOURCES} ${PROJECT_SOURCE_DIR}/third_party/open62541/open62541.c PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-float-equal -Wno-logical-op -Wno-unknown-warning-option -Wno-unused-function -Wno-switch-default -Wno-cast-function-type") -add_library(opcua_bridge OBJECT ${SOURCES} ${PROJECT_SOURCE_DIR}/third_party/open62541/open62541.c) -target_include_directories(opcua_bridge PRIVATE ${PROJECT_SOURCE_DIR}/third_party/open62541/) - -include_directories(${PROJECT_SOURCE_DIR}/third_party/open62541/ ${PROJECT_SOURCE_DIR}/tests) -set_source_files_properties(opcuabridge_test_utils.cc opcuabridge_messaging_test.cc opcuabridge_server.cc - opcuabridge_secondary.cc opcuabridge_secondary_update_test.cc - opcuabridge_ostree_repo_sync_client.cc - opcuabridge_ostree_repo_sync_server.cc - PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-float-equal -Wno-logical-op -Wno-unknown-warning-option") -add_executable(opcuabridge-server opcuabridge_server.cc opcuabridge_test_utils.cc) -target_link_libraries(opcuabridge-server aktualizr_static_lib ${TEST_LIBS}) -add_dependencies(build_tests opcuabridge-server) - -add_aktualizr_test(NAME opcuabridge_messaging - SOURCES opcuabridge_messaging_test.cc opcuabridge_test_utils.cc) - -add_executable(opcuabridge-secondary opcuabridge_secondary.cc opcuabridge_test_utils.cc) -target_link_libraries(opcuabridge-secondary aktualizr_static_lib ${TEST_LIBS}) -add_dependencies(build_tests opcuabridge-secondary) - -add_aktualizr_test(NAME opcuabridge_secondary_update - SOURCES opcuabridge_secondary_update_test.cc opcuabridge_test_utils.cc) -set(TEST_SOURCES ${TEST_SOURCES} opcuabridge_messaging_test.cc opcuabridge_server.cc - opcuabridge_secondary.cc opcuabridge_secondary_update_test.cc - opcuabridge_test_utils.cc) - -add_executable(opcuabridge-ostree-repo-sync-client opcuabridge_ostree_repo_sync_client.cc - opcuabridge_test_utils.cc) -target_link_libraries(opcuabridge-ostree-repo-sync-client aktualizr_static_lib ${TEST_LIBS}) -add_dependencies(build_tests opcuabridge-ostree-repo-sync-client) - -add_executable(opcuabridge-ostree-repo-sync-server opcuabridge_ostree_repo_sync_server.cc - opcuabridge_test_utils.cc) -target_link_libraries(opcuabridge-ostree-repo-sync-server aktualizr_static_lib ${TEST_LIBS}) -add_dependencies(build_tests opcuabridge-ostree-repo-sync-server) - -add_test(NAME opcuabridge-ostree-repo-sync-test - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_opcuabridge_ostree_repo_sync_test.sh - ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/tests ${RUN_VALGRIND}) diff --git a/src/libaktualizr/opcuabridge/boostarch.h b/src/libaktualizr/opcuabridge/boostarch.h deleted file mode 100644 index c5669c8a5b..0000000000 --- a/src/libaktualizr/opcuabridge/boostarch.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef OPCUABRIDGE_BOOST_ARCH_H_ -#define OPCUABRIDGE_BOOST_ARCH_H_ - -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include - -#define DATA_SERIALIZATION_OUT_BIN_STREAM boost::archive::binary_oarchive -#define DATA_SERIALIZATION_IN_BIN_STREAM boost::archive::binary_iarchive - -#define DATA_SERIALIZATION_OUT_XML_STREAM boost::archive::xml_oarchive -#define DATA_SERIALIZATION_IN_XML_STREAM boost::archive::xml_iarchive - -#define DATA_SERIALIZATION_OUT_TEXT_STREAM boost::archive::text_woarchive -#define DATA_SERIALIZATION_IN_TEXT_STREAM boost::archive::text_wiarchive - -#endif // OPCUABRIDGE_BOOST_ARCH_H_ diff --git a/src/libaktualizr/opcuabridge/common.cc b/src/libaktualizr/opcuabridge/common.cc deleted file mode 100644 index 165db32eb4..0000000000 --- a/src/libaktualizr/opcuabridge/common.cc +++ /dev/null @@ -1,160 +0,0 @@ -#include "configuration.h" -#include "currenttime.h" -#include "ecuversionmanifest.h" -#include "ecuversionmanifestsigned.h" -#include "filedata.h" -#include "filelist.h" -#include "hash.h" -#include "image.h" -#include "imageblock.h" -#include "imagefile.h" -#include "imagerequest.h" -#include "metadatafile.h" -#include "metadatafiles.h" -#include "originalmanifest.h" -#include "signature.h" -#include "signed.h" -#include "versionreport.h" - -#include "logging/logging.h" - -#include -#include - -#include - -namespace fs = boost::filesystem; - -namespace opcuabridge { -const UA_UInt16 kNSindex = 1; -const char *kLocale = "en-US"; - -const char *VersionReport::node_id_ = "VersionReport"; -const char *Configuration::node_id_ = "Configuration"; -const char *CurrentTime::node_id_ = "CurrentTime"; -const char *MetadataFiles::node_id_ = "MetadataFiles"; -const char *MetadataFile::node_id_ = "MetadataFile"; -const char *MetadataFile::bin_node_id_ = "MetadataFile_BinaryData"; -const char *ImageRequest::node_id_ = "ImageRequest"; -const char *ImageFile::node_id_ = "ImageFile"; -const char *ImageBlock::node_id_ = "ImageBlock"; -const char *ImageBlock::bin_node_id_ = "ImageBlock_BinaryData"; -const char *FileData::node_id_ = "FileData"; -const char *FileData::bin_node_id_ = "FileData_BinaryData"; -const char *FileList::node_id_ = "FileList"; -const char *FileList::bin_node_id_ = "FileList_BinaryData"; -const char *OriginalManifest::node_id_ = "OriginalManifest"; -const char *OriginalManifest::bin_node_id_ = "OriginalManifest_BinaryData"; -} // namespace opcuabridge - -namespace opcuabridge { - -const std::size_t kLogMsgBuffSize = 256; - -void BoostLogOpcua(UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args) { - char msg_buff[kLogMsgBuffSize]; - vsnprintf(msg_buff, kLogMsgBuffSize, msg, args); - BOOST_LOG_STREAM_WITH_PARAMS( - boost::log::trivial::logger::get(), - (boost::log::keywords::severity = static_cast(level))) - << "OPC-UA " << msg_buff; -} - -template <> -UA_StatusCode read(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, UA_Boolean sourceTimeStamp, - const UA_NumericRange *range, UA_DataValue *dataValue) { - const BinaryDataType &bin_data = *static_cast(nodeContext); - - UA_Variant_setArrayCopy(&dataValue->value, &bin_data[0], bin_data.size(), &UA_TYPES[UA_TYPES_BYTE]); - dataValue->hasValue = !bin_data.empty(); - - return UA_STATUSCODE_GOOD; -} - -template <> -UA_StatusCode write(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, const UA_NumericRange *range, - const UA_DataValue *data) { - if (!UA_Variant_isEmpty(&data->value) && UA_Variant_hasArrayType(&data->value, &UA_TYPES[UA_TYPES_BYTE])) { - auto *bin_data = static_cast(nodeContext); - bin_data->resize(data->value.arrayLength); - const auto *src = static_cast(data->value.data); - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - std::copy(src, src + data->value.arrayLength, bin_data->begin()); - } - return UA_STATUSCODE_GOOD; -} - -template <> -UA_StatusCode read(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, UA_Boolean sourceTimeStamp, - const UA_NumericRange *range, UA_DataValue *dataValue) { - return UA_STATUSCODE_GOOD; -} - -template <> -UA_StatusCode write(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, const UA_NumericRange *range, - const UA_DataValue *data) { - if (!UA_Variant_isEmpty(&data->value) && UA_Variant_hasArrayType(&data->value, &UA_TYPES[UA_TYPES_BYTE])) { - auto *mfd = static_cast(nodeContext); - - fs::path full_file_path = mfd->getFullFilePath(); - if (!fs::exists(full_file_path)) { - fs::create_directories(full_file_path.parent_path()); - } - std::ofstream ofs(full_file_path.c_str(), std::ios::binary | std::ios::app); - if (ofs) { - ofs.write(static_cast(data->value.data), static_cast(data->value.arrayLength)); - if (!ofs) { - LOG_ERROR << "File write error: " << full_file_path.native(); - } - } else { - LOG_ERROR << "File open error: " << full_file_path.native(); - } - } - return UA_STATUSCODE_GOOD; -} - -namespace internal { - -UA_StatusCode ClientWriteFile(UA_Client *client, const char *node_id, const boost::filesystem::path &file_path, - const std::size_t block_size) { - UA_StatusCode retval; - - boost::iostreams::mapped_file_source file(file_path.native()); - boost::iostreams::mapped_file_source::iterator f_it = file.begin(); - - const std::size_t total_size = file.size(); - std::size_t written_size = 0; - UA_Variant *val = UA_Variant_new(); - while (f_it != file.end()) { - std::size_t current_block_size = std::min(block_size, (total_size - written_size)); - UA_Variant_setArray(val, const_cast(&(*f_it)), current_block_size, &UA_TYPES[UA_TYPES_BYTE]); - val->storageType = UA_VARIANT_DATA_NODELETE; - retval = UA_Client_writeValueAttribute(client, UA_NODEID_STRING(kNSindex, const_cast(node_id)), val); - if (retval != UA_STATUSCODE_GOOD) { - return retval; - } - std::advance(f_it, current_block_size); - written_size += current_block_size; - } - UA_Variant_delete(val); - - return UA_STATUSCODE_GOOD; -} - -/** - * Workaround for cppcoreguidelines-pro-bounds-pointer-arithmetic - * TODO: Replace with something that is memory-safe - */ -void parseJson(const char *msg, size_t len, Json::Value *value) { - Json::Reader rd; - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - rd.parse(msg, msg + len, *value); -} - -} // namespace internal - -} // namespace opcuabridge diff --git a/src/libaktualizr/opcuabridge/common.h b/src/libaktualizr/opcuabridge/common.h deleted file mode 100644 index 719a0c314d..0000000000 --- a/src/libaktualizr/opcuabridge/common.h +++ /dev/null @@ -1,353 +0,0 @@ -#ifndef OPCUABRIDGE_COMMON_H_ -#define OPCUABRIDGE_COMMON_H_ - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION -#include "boostarch.h" -#include "utility.h" -#endif - -#include - -#include -#include - -#include -#include -#include - -#include "opcuabridgeconfig.h" - -namespace boost { -namespace filesystem { -class path; -} // namespace filesystem -} // namespace boost - -#define INITSERVERNODESET_FUNCTION_DEFINITION(TYPE) \ - void InitServerNodeset(UA_Server *server) { \ - opcuabridge::internal::AddDataSourceVariable(server, node_id_, this); \ - } - -#define INITSERVERNODESET_BIN_FUNCTION_DEFINITION(TYPE, BINDATA) \ - void InitServerNodeset(UA_Server *server) { \ - opcuabridge::internal::AddDataSourceVariable(server, node_id_, this); \ - opcuabridge::internal::AddDataSourceVariable( \ - server, bin_node_id_, BINDATA, UA_NODEID_STRING(kNSindex, const_cast(node_id_))); \ - } - -#define INITSERVERNODESET_FILE_FUNCTION_DEFINITION(TYPE) \ - void InitServerNodeset(UA_Server *server) { \ - opcuabridge::internal::AddDataSourceVariable(server, node_id_, this); \ - opcuabridge::internal::AddDataSourceVariable( \ - server, bin_node_id_, this, UA_NODEID_STRING(kNSindex, const_cast(node_id_))); \ - } - -#define CLIENTWRITE_FUNCTION_DEFINITION() \ - UA_StatusCode ClientWrite(UA_Client *client) { return opcuabridge::internal::ClientWrite(client, node_id_, this); } - -#define CLIENTWRITE_BIN_FUNCTION_DEFINITION(BINDATA) \ - UA_StatusCode ClientWrite(UA_Client *client) { \ - return opcuabridge::internal::ClientWrite(client, node_id_, this, BINDATA); \ - } - -#define CLIENTWRITE_FILE_FUNCTION_DEFINITION() \ - UA_StatusCode ClientWriteFile(UA_Client *client, const boost::filesystem::path &f) { \ - return opcuabridge::internal::ClientWriteFile(client, node_id_, this, f); \ - } - -#define CLIENTREAD_FUNCTION_DEFINITION() \ - UA_StatusCode ClientRead(UA_Client *client) { return opcuabridge::internal::ClientRead(client, node_id_, this); } - -#define CLIENTREAD_BIN_FUNCTION_DEFINITION(BINDATA) \ - UA_StatusCode ClientRead(UA_Client *client) { \ - return opcuabridge::internal::ClientRead(client, node_id_, this, BINDATA); \ - } - -#define READ_FUNCTION_FRIEND_DECLARATION(TYPE) \ - friend UA_StatusCode read(UA_Server *, const UA_NodeId *, void *, const UA_NodeId *, void *, UA_Boolean, \ - const UA_NumericRange *, UA_DataValue *); - -#define WRITE_FUNCTION_FRIEND_DECLARATION(TYPE) \ - friend UA_StatusCode write(UA_Server *, const UA_NodeId *, void *, const UA_NodeId *, void *, \ - const UA_NumericRange *, const UA_DataValue *); - -#define INTERNAL_FUNCTIONS_FRIEND_DECLARATION(TYPE) \ - friend UA_StatusCode opcuabridge::internal::ClientWrite(UA_Client *, const char *, TYPE *); \ - friend UA_StatusCode opcuabridge::internal::ClientWrite(UA_Client *, const char *, TYPE *, BinaryDataType *); \ - friend UA_StatusCode opcuabridge::internal::ClientRead(UA_Client *, const char *, TYPE *); \ - friend UA_StatusCode opcuabridge::internal::ClientRead(UA_Client *, const char *, TYPE *, BinaryDataType *); \ - friend UA_StatusCode opcuabridge::internal::ClientWriteFile(UA_Client *, const char *, TYPE *, \ - const boost::filesystem::path &); - -#define WRAPMESSAGE_FUCTION_DEFINITION(TYPE) \ - static std::string wrapMessage(TYPE *obj) { \ - Json::Value value = obj->wrapMessage(); \ - Json::FastWriter fw; \ - return fw.write(value); \ - } - -namespace opcuabridge { -namespace internal { -/** - * Workaround for cppcoreguidelines-pro-bounds-pointer-arithmetic - * TODO: Replace with something that is memory-safe - */ -void parseJson(const char *msg, size_t len, Json::Value *value); -} // namespace internal -} // namespace opcuabridge - -#define UNWRAPMESSAGE_FUCTION_DEFINITION(TYPE) \ - static void unwrapMessage(TYPE *obj, const char *msg, size_t len) { \ - Json::Value value; \ - opcuabridge::internal::parseJson(msg, len, &value); \ - obj->unwrapMessage(value); \ - } - -#define DEFINE_SERIALIZE_METHOD() \ - template \ - inline void serialize(Archive &ar, const unsigned int version) - -#define SERIALIZE_FIELD(AR, XML_TAGNAME, FIELD) \ - { utility::make_serialize_field(AR, FIELD)(AR, XML_TAGNAME, FIELD); } - -#define SERIALIZE_FUNCTION_FRIEND_DECLARATION friend class boost::serialization::access; - -namespace opcuabridge { - -extern const UA_UInt16 kNSindex; - -extern const char *kLocale; - -extern void BoostLogOpcua(UA_LogLevel /*level*/, UA_LogCategory /*category*/, const char * /*msg*/, va_list /*args*/); - -enum HashFunction { HASH_FUN_SHA224, HASH_FUN_SHA256, HASH_FUN_SHA384 }; - -enum SignatureMethod { SIG_METHOD_RSASSA_PSS, SIG_METHOD_ED25519 }; - -struct MessageBinaryData {}; -struct MessageFileData { - virtual std::string getFullFilePath() const = 0; - virtual ~MessageFileData() = default; -}; -typedef std::vector BinaryDataType; - -template -struct MessageOnBeforeReadCallback { - typedef std::function type; -}; - -template -struct MessageOnAfterWriteCallback { - typedef std::function type; -}; - -template -UA_StatusCode read(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, - void *nodeContext, UA_Boolean sourceTimeStamp, const UA_NumericRange *range, - UA_DataValue *dataValue) { - auto *obj = static_cast(nodeContext); - - if (obj->on_before_read_cb_) { - obj->on_before_read_cb_(obj); - } - - std::string msg = T::wrapMessage(obj); - - UA_Variant_setArrayCopy(&dataValue->value, msg.c_str(), msg.size(), &UA_TYPES[UA_TYPES_BYTE]); - dataValue->hasValue = true; - - return UA_STATUSCODE_GOOD; -} - -template <> -UA_StatusCode read(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, UA_Boolean sourceTimeStamp, - const UA_NumericRange *range, UA_DataValue *dataValue); - -template <> -UA_StatusCode read(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, UA_Boolean sourceTimeStamp, - const UA_NumericRange *range, UA_DataValue *dataValue); - -template -UA_StatusCode write(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, - void *nodeContext, const UA_NumericRange *range, const UA_DataValue *data) { - auto *obj = static_cast(nodeContext); - - if (!UA_Variant_isEmpty(&data->value) && UA_Variant_hasArrayType(&data->value, &UA_TYPES[UA_TYPES_BYTE])) { - T::unwrapMessage(obj, static_cast(data->value.data), data->value.arrayLength); - } - if (obj->on_after_write_cb_) { - obj->on_after_write_cb_(obj); - } - return UA_STATUSCODE_GOOD; -} - -template <> -UA_StatusCode write(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, const UA_NumericRange *range, - const UA_DataValue *data); - -template <> -UA_StatusCode write(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, const UA_NumericRange *range, - const UA_DataValue *data); - -namespace internal { - -template -inline void AddDataSourceVariable(UA_Server *server, const char *node_id, void *node_context, - const UA_NodeId parent_node_id = UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER)) { - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT(const_cast(kLocale), const_cast(node_id)); - attr.accessLevel = UA_ACCESSLEVELMASK_READ | UA_ACCESSLEVELMASK_WRITE; - UA_DataSource dataSource; - dataSource.read = &opcuabridge::read; - dataSource.write = &opcuabridge::write; - UA_Server_addDataSourceVariableNode(server, UA_NODEID_STRING(kNSindex, const_cast(node_id)), parent_node_id, - UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), - UA_QUALIFIEDNAME(kNSindex, const_cast(node_id)), UA_NODEID_NULL, attr, - dataSource, node_context, nullptr); -} - -template -inline UA_StatusCode ClientWrite(UA_Client *client, const char *node_id, MessageT *obj) { - UA_Variant *val = UA_Variant_new(); - std::string msg = MessageT::wrapMessage(obj); - UA_Variant_setArray(val, const_cast(msg.c_str()), msg.size(), &UA_TYPES[UA_TYPES_BYTE]); - val->storageType = UA_VARIANT_DATA_NODELETE; - UA_StatusCode retval = - UA_Client_writeValueAttribute(client, UA_NODEID_STRING(kNSindex, const_cast(node_id)), val); - UA_Variant_delete(val); - return retval; -} - -template -inline UA_StatusCode ClientWrite(UA_Client *client, const char *node_id, MessageT *obj, BinaryDataType *bin_data) { - // write binary child node - UA_Variant *bin_val = UA_Variant_new(); - UA_Variant_setArray(bin_val, &(*bin_data)[0], bin_data->size(), &UA_TYPES[UA_TYPES_BYTE]); - bin_val->storageType = UA_VARIANT_DATA_NODELETE; - UA_StatusCode retval = - UA_Client_writeValueAttribute(client, UA_NODEID_STRING(kNSindex, const_cast(obj->bin_node_id_)), bin_val); - UA_Variant_delete(bin_val); - - if (retval == UA_STATUSCODE_GOOD) { - UA_Variant *val = UA_Variant_new(); - std::string msg = MessageT::wrapMessage(obj); - UA_Variant_setArray(val, const_cast(msg.c_str()), msg.size(), &UA_TYPES[UA_TYPES_BYTE]); - val->storageType = UA_VARIANT_DATA_NODELETE; - retval = UA_Client_writeValueAttribute(client, UA_NODEID_STRING(kNSindex, const_cast(node_id)), val); - UA_Variant_delete(val); - } - return retval; -} - -UA_StatusCode ClientWriteFile(UA_Client * /*client*/, const char * /*node_id*/, - const boost::filesystem::path & /*file_path*/, - std::size_t block_size = OPCUABRIDGE_FILEDATA_WRITE_BLOCK_SIZE); - -template -inline UA_StatusCode ClientWriteFile(UA_Client *client, const char *node_id, MessageT *obj, - const boost::filesystem::path &file_path) { - UA_StatusCode retval = ClientWrite(client, node_id, obj); - if (retval == UA_STATUSCODE_GOOD) { - retval = ClientWriteFile(client, obj->bin_node_id_, file_path); - } - return retval; -} - -template -inline UA_StatusCode ClientRead(UA_Client *client, const char *node_id, MessageT *obj) { - UA_Variant *val = UA_Variant_new(); - UA_StatusCode retval = - UA_Client_readValueAttribute(client, UA_NODEID_STRING(kNSindex, const_cast(node_id)), val); - if (retval == UA_STATUSCODE_GOOD && UA_Variant_hasArrayType(val, &UA_TYPES[UA_TYPES_BYTE])) { - MessageT::unwrapMessage(obj, static_cast(val->data), val->arrayLength); - } - UA_Variant_delete(val); - return retval; -} - -template -inline UA_StatusCode ClientRead(UA_Client *client, const char *node_id, MessageT *obj, BinaryDataType *bin_data) { - UA_Variant *val = UA_Variant_new(); - UA_StatusCode retval = - UA_Client_readValueAttribute(client, UA_NODEID_STRING(kNSindex, const_cast(node_id)), val); - if (retval == UA_STATUSCODE_GOOD && UA_Variant_hasArrayType(val, &UA_TYPES[UA_TYPES_BYTE])) { - MessageT::unwrapMessage(obj, static_cast(val->data), val->arrayLength); - // read binary child node - UA_Variant *bin_val = UA_Variant_new(); - retval = UA_Client_readValueAttribute( - client, UA_NODEID_STRING(kNSindex, const_cast(obj->bin_node_id_)), bin_val); - if (retval == UA_STATUSCODE_GOOD && UA_Variant_hasArrayType(bin_val, &UA_TYPES[UA_TYPES_BYTE])) { - bin_data->resize(bin_val->arrayLength); - const auto *src = static_cast(bin_val->data); - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - std::copy(src, src + bin_val->arrayLength, bin_data->begin()); - } - UA_Variant_delete(bin_val); - } - UA_Variant_delete(val); - return retval; -} -} // namespace internal - -namespace convert_to { - -template -inline Json::Value jsonArray(const std::vector &v) { - Json::Value jsonArray; - jsonArray.resize(static_cast(v.size())); - for (const auto &i : v) { - jsonArray.append(i.wrapMessage()); - } - return jsonArray; -} - -template <> -inline Json::Value jsonArray(const std::vector &v) { - Json::Value jsonArray; - jsonArray.resize(static_cast(v.size())); - for (const auto &item : v) { - jsonArray.append(static_cast(item)); - } - return jsonArray; -} - -template <> -inline Json::Value jsonArray(const std::vector &v) { - Json::Value jsonArray; - jsonArray.resize(static_cast(v.size())); - for (const auto &item : v) { - jsonArray.append(static_cast(item)); - } - return jsonArray; -} - -template -inline std::vector stdVector(const Json::Value &v) { - std::vector stdv; - for (const auto &i : v) { - T item; - item.unwrapMessage(i); - stdv.push_back(item); - } - return stdv; -} - -template <> -inline std::vector stdVector(const Json::Value &v) { - std::vector stdv; - stdv.reserve(v.size()); - for (const auto &item : v) { - stdv.push_back(item.asInt()); - } - return stdv; -} - -} // namespace convert_to - -} // namespace opcuabridge - -#endif // OPCUABRIDGE_COMMON_H_ diff --git a/src/libaktualizr/opcuabridge/configuration.h b/src/libaktualizr/opcuabridge/configuration.h deleted file mode 100644 index b42599a507..0000000000 --- a/src/libaktualizr/opcuabridge/configuration.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef OPCUABRIDGE_CONFIGURATION_H_ -#define OPCUABRIDGE_CONFIGURATION_H_ - -#include "common.h" - -#include "uptane/tuf.h" -#include "utilities/types.h" - -#include - -namespace opcuabridge { -class Configuration { - public: - Configuration() = default; - virtual ~Configuration() = default; - - const Uptane::EcuSerial& getSerial() const { return serial_; } - void setSerial(const Uptane::EcuSerial& serial) { serial_ = serial; } - Uptane::HardwareIdentifier getHwId() const { return hwid_; } - void setHwId(const Uptane::HardwareIdentifier& hwid) { hwid_ = hwid; } - const KeyType& getPublicKeyType() const { return public_key_type_; } - void setPublicKeyType(const KeyType& public_key_type) { public_key_type_ = public_key_type; } - const std::string& getPublicKey() const { return public_key_; } - void setPublicKey(const std::string& public_key) { public_key_ = public_key; } - - INITSERVERNODESET_FUNCTION_DEFINITION(Configuration) // InitServerNodeset(UA_Server*) - CLIENTREAD_FUNCTION_DEFINITION() // ClientRead(UA_Client*) - CLIENTWRITE_FUNCTION_DEFINITION() // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { - on_before_read_cb_ = std::move(cb); - } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { - on_after_write_cb_ = std::move(cb); - } - - protected: - KeyType public_key_type_{}; - Uptane::HardwareIdentifier hwid_{Uptane::HardwareIdentifier::Unknown()}; - std::string public_key_; - Uptane::EcuSerial serial_{Uptane::EcuSerial::Unknown()}; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - v["hwid"] = getHwId().ToString(); - v["public_key_type"] = static_cast(getPublicKeyType()); - v["public_key"] = getPublicKey(); - v["serial"] = getSerial().ToString(); - return v; - } - void unwrapMessage(Json::Value v) { - setHwId(Uptane::HardwareIdentifier(v["hwid"].asString())); - setPublicKeyType(static_cast(v["public_key_type"].asInt())); - setPublicKey(v["public_key"].asString()); - setSerial(Uptane::EcuSerial(v["serial"].asString())); - } - - WRAPMESSAGE_FUCTION_DEFINITION(Configuration) - UNWRAPMESSAGE_FUCTION_DEFINITION(Configuration) - READ_FUNCTION_FRIEND_DECLARATION(Configuration) - WRITE_FUNCTION_FRIEND_DECLARATION(Configuration) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(Configuration) - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "hwid_", hwid_); - SERIALIZE_FIELD(ar, "serial_", serial_); - SERIALIZE_FIELD(ar, "public_key_", public_key_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_CONFIGURATION_H_ diff --git a/src/libaktualizr/opcuabridge/currenttime.h b/src/libaktualizr/opcuabridge/currenttime.h deleted file mode 100644 index 322c982edb..0000000000 --- a/src/libaktualizr/opcuabridge/currenttime.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef OPCUABRIDGE_CURRENTTIME_H_ -#define OPCUABRIDGE_CURRENTTIME_H_ - -#include - -#include "signature.h" -#include "signed.h" - -#include "common.h" - -namespace opcuabridge { -class CurrentTime { - public: - CurrentTime() = default; - virtual ~CurrentTime() = default; - - const std::vector& getSignatures() const { return signatures_; } - void setSignatures(const std::vector& signatures) { signatures_ = signatures; } - const Signed& getSigned() const { return signed_; } - void setSigned(const Signed& s) { signed_ = s; } - - INITSERVERNODESET_FUNCTION_DEFINITION(CurrentTime) // InitServerNodeset(UA_Server*) - CLIENTREAD_FUNCTION_DEFINITION() // ClientRead(UA_Client*) - CLIENTWRITE_FUNCTION_DEFINITION() // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { - on_before_read_cb_ = std::move(cb); - } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { - on_after_write_cb_ = std::move(cb); - } - - protected: - std::vector signatures_; - Signed signed_; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - v["signatures"] = convert_to::jsonArray(getSignatures()); - v["signed"] = getSigned().wrapMessage(); - return v; - } - void unwrapMessage(Json::Value v) { - setSignatures(convert_to::stdVector(v["signatures"])); - Signed s; - s.unwrapMessage(v["signed"]); - setSigned(s); - } - - WRAPMESSAGE_FUCTION_DEFINITION(CurrentTime) - UNWRAPMESSAGE_FUCTION_DEFINITION(CurrentTime) - READ_FUNCTION_FRIEND_DECLARATION(CurrentTime) - WRITE_FUNCTION_FRIEND_DECLARATION(CurrentTime) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(CurrentTime) - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "signatures_", signatures_); - SERIALIZE_FIELD(ar, "signed_", signed_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_CURRENTTIME_H_ diff --git a/src/libaktualizr/opcuabridge/ecuversionmanifest.h b/src/libaktualizr/opcuabridge/ecuversionmanifest.h deleted file mode 100644 index 84f537c78e..0000000000 --- a/src/libaktualizr/opcuabridge/ecuversionmanifest.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef OPCUABRIDGE_ECUVERSIONMANIFEST_H_ -#define OPCUABRIDGE_ECUVERSIONMANIFEST_H_ - -#include "ecuversionmanifestsigned.h" -#include "signature.h" - -#include "common.h" - -namespace opcuabridge { -class ECUVersionManifest { - public: - ECUVersionManifest() = default; - virtual ~ECUVersionManifest() = default; - - const std::vector& getSignatures() const { return signatures_; } - void setSignatures(const std::vector& signatures) { signatures_ = signatures; } - ECUVersionManifestSigned& getEcuVersionManifestSigned() { return ecuVersionManifestSigned_; } - const ECUVersionManifestSigned& getEcuVersionManifestSigned() const { return ecuVersionManifestSigned_; } - void setEcuVersionManifestSigned(const ECUVersionManifestSigned& ecuVersionManifestSigned) { - ecuVersionManifestSigned_ = ecuVersionManifestSigned; - } - - Json::Value wrapMessage() const { - Json::Value v; - v["signatures"] = convert_to::jsonArray(getSignatures()); - v["signed"] = getEcuVersionManifestSigned().wrapMessage(); - return v; - } - void unwrapMessage(Json::Value v) { - setSignatures(convert_to::stdVector(v["signatures"])); - ECUVersionManifestSigned ms; - ms.unwrapMessage(v["signed"]); - setEcuVersionManifestSigned(ms); - } - - protected: - std::vector signatures_; - ECUVersionManifestSigned ecuVersionManifestSigned_; - - private: -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "signatures_", signatures_); - SERIALIZE_FIELD(ar, "ecuVersionManifestSigned_", ecuVersionManifestSigned_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_ECUVERSIONMANIFEST_H_ diff --git a/src/libaktualizr/opcuabridge/ecuversionmanifestsigned.h b/src/libaktualizr/opcuabridge/ecuversionmanifestsigned.h deleted file mode 100644 index 975748d489..0000000000 --- a/src/libaktualizr/opcuabridge/ecuversionmanifestsigned.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef OPCUABRIDGE_ECUVERSIONMANIFESTSIGNED_H_ -#define OPCUABRIDGE_ECUVERSIONMANIFESTSIGNED_H_ - -#include "image.h" - -#include "common.h" - -namespace opcuabridge { -class ECUVersionManifestSigned { - public: - ECUVersionManifestSigned() = default; - virtual ~ECUVersionManifestSigned() = default; - - const std::string& getEcuIdentifier() const { return ecuIdentifier_; } - void setEcuIdentifier(const std::string& ecuIdentifier) { ecuIdentifier_ = ecuIdentifier; } - const int& getPreviousTime() const { return previousTime_; } - void setPreviousTime(const int& previousTime) { previousTime_ = previousTime; } - const int& getCurrentTime() const { return currentTime_; } - void setCurrentTime(const int& currentTime) { currentTime_ = currentTime; } - const std::string& getSecurityAttack() const { return securityAttack_; } - void setSecurityAttack(const std::string& securityAttack) { securityAttack_ = securityAttack; } - const Image& getInstalledImage() const { return installedImage_; } - void setInstalledImage(const Image& installedImage) { installedImage_ = installedImage; } - - Json::Value wrapMessage() const { - Json::Value v; - v["ecu_serial"] = getEcuIdentifier(); - v["previous_timeserver_time"] = getPreviousTime(); - v["timeserver_time"] = getCurrentTime(); - v["attacks_detected"] = getSecurityAttack(); - v["installed_image"] = getInstalledImage().wrapMessage(); - return v; - } - void unwrapMessage(Json::Value v) { - setEcuIdentifier(v["ecu_serial"].asString()); - setPreviousTime(v["previous_timeserver_time"].asInt()); - setCurrentTime(v["timeserver_time"].asInt()); - setSecurityAttack(v["attacks_detected"].asString()); - Image i; - i.unwrapMessage(v["installed_image"]); - setInstalledImage(i); - } - - protected: - std::string ecuIdentifier_; - int previousTime_{}; - int currentTime_{}; - std::string securityAttack_; - Image installedImage_; - - private: -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "ecuIdentifier_", ecuIdentifier_); - SERIALIZE_FIELD(ar, "previousTime_", previousTime_); - SERIALIZE_FIELD(ar, "currentTime_", currentTime_); - SERIALIZE_FIELD(ar, "securityAttack_", securityAttack_); - SERIALIZE_FIELD(ar, "installedImage_", installedImage_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_ECUVERSIONMANIFESTSIGNED_H_ diff --git a/src/libaktualizr/opcuabridge/filedata.h b/src/libaktualizr/opcuabridge/filedata.h deleted file mode 100644 index 49eafd3261..0000000000 --- a/src/libaktualizr/opcuabridge/filedata.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef OPCUABRIDGE_FILEDATA_H_ -#define OPCUABRIDGE_FILEDATA_H_ - -#include "common.h" - -#include -#include - -namespace opcuabridge { -class FileData : public MessageFileData { - public: - FileData() = default; - explicit FileData(boost::filesystem::path base_path) : base_path_(std::move(base_path)) {} - ~FileData() final = default; - - const boost::filesystem::path& getBasePath() const { return base_path_; } - void setBasePath(const boost::filesystem::path& base_path) { base_path_ = base_path; } - const boost::filesystem::path& getFilePath() const { return file_path_; } - void setFilePath(const boost::filesystem::path& file_path) { file_path_ = file_path; } - - std::string getFullFilePath() const override { return (getBasePath() / getFilePath()).native(); } - - INITSERVERNODESET_FILE_FUNCTION_DEFINITION(FileData) // InitServerNodeset(UA_Server*) - CLIENTWRITE_FILE_FUNCTION_DEFINITION() // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { on_before_read_cb_ = std::move(cb); } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { on_after_write_cb_ = std::move(cb); } - - protected: - boost::filesystem::path base_path_; - boost::filesystem::path file_path_; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - static const char* bin_node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - v["filename"] = getFilePath().native(); - return v; - } - void unwrapMessage(Json::Value v) { setFilePath(v["filename"].asString()); } - - WRAPMESSAGE_FUCTION_DEFINITION(FileData) - UNWRAPMESSAGE_FUCTION_DEFINITION(FileData) - READ_FUNCTION_FRIEND_DECLARATION(FileData) - WRITE_FUNCTION_FRIEND_DECLARATION(FileData) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(FileData) -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_FILEDATA_H_ diff --git a/src/libaktualizr/opcuabridge/filelist.cc b/src/libaktualizr/opcuabridge/filelist.cc deleted file mode 100644 index c13ee994b1..0000000000 --- a/src/libaktualizr/opcuabridge/filelist.cc +++ /dev/null @@ -1,53 +0,0 @@ -#include "filelist.h" - -#include -#include -#include -#include - -namespace fs = boost::filesystem; - -namespace opcuabridge { - -FileSetEntryHash::result_type FileSetEntryHash::operator()(FileSetEntryHash::argument_type const& e) const { - result_type seed = 0; - argument_type x = e; - for (; *x != '\0'; ++x) { - boost::hash_combine(seed, *x); - } - return seed; -} - -bool FileSetEntryEqual::operator()(const FileSetEntryEqual::argument_type& lhs, - const FileSetEntryEqual::argument_type& rhs) const { - return (0 == strcmp(reinterpret_cast(lhs), reinterpret_cast(rhs))); -} - -std::size_t UpdateFileList(FileList* filelist, const fs::path& repo_dir_path) { - FileList::block_type& block = filelist->getBlock(); - std::size_t file_count = 0; - fs::recursive_directory_iterator repo_dir_it_end, repo_dir_it(repo_dir_path); - for (; repo_dir_it != repo_dir_it_end; ++repo_dir_it) { - const fs::path& ent_path = repo_dir_it->path(); - if (fs::is_regular_file(ent_path)) { - fs::path rel_path = fs::relative(ent_path, repo_dir_path); - std::copy(rel_path.native().begin(), rel_path.native().end(), std::back_inserter(block)); - block.push_back('\0'); - ++file_count; - } - } - return file_count; -} - -void UpdateFileUnorderedSet(FileUnorderedSet* file_unordered_set, const FileList& file_list) { - if (!file_list.getBlock().empty()) { - auto block_rev_it = file_list.getBlock().rbegin(), p = block_rev_it, block_rev_end_it = file_list.getBlock().rend(); - for (; block_rev_it != block_rev_end_it; p = block_rev_it) { - if ((block_rev_end_it == ++block_rev_it) || ('\0' == *(block_rev_it))) { - file_unordered_set->insert(&*p); - } - } - } -} - -} // namespace opcuabridge diff --git a/src/libaktualizr/opcuabridge/filelist.h b/src/libaktualizr/opcuabridge/filelist.h deleted file mode 100644 index 148b569a29..0000000000 --- a/src/libaktualizr/opcuabridge/filelist.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef OPCUABRIDGE_FILELIST_H_ -#define OPCUABRIDGE_FILELIST_H_ - -#include "imageblock.h" - -#include -#include - -namespace boost { -namespace filesystem { -class path; -} // namespace filesystem -} // namespace boost - -namespace opcuabridge { - -class FileList { - public: - typedef BinaryDataType block_type; - - FileList() = default; - virtual ~FileList() = default; - - block_type& getBlock() { return block_; } - const block_type& getBlock() const { return block_; } - void setBlock(const block_type& block) { block_ = block; } - INITSERVERNODESET_BIN_FUNCTION_DEFINITION(FileList, &block_) // InitServerNodeset(UA_Server*) - CLIENTREAD_BIN_FUNCTION_DEFINITION(&block_) // ClientRead(UA_Client*) - CLIENTWRITE_BIN_FUNCTION_DEFINITION(&block_) // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { on_before_read_cb_ = std::move(cb); } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { on_after_write_cb_ = std::move(cb); } - - protected: - block_type block_; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - static const char* bin_node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - return v; - } - void unwrapMessage(const Json::Value& v) {} - - WRAPMESSAGE_FUCTION_DEFINITION(FileList) - UNWRAPMESSAGE_FUCTION_DEFINITION(FileList) - READ_FUNCTION_FRIEND_DECLARATION(FileList) - WRITE_FUNCTION_FRIEND_DECLARATION(FileList) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(FileList) - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { SERIALIZE_FIELD(ar, "block_", block_); } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; - -typedef const FileList::block_type::value_type* FileSetEntry; - -struct FileSetEntryHash { - typedef FileSetEntry argument_type; - typedef std::size_t result_type; - - result_type operator()(argument_type const& e) const; -}; - -struct FileSetEntryEqual { - typedef FileSetEntry argument_type; - - bool operator()(const argument_type& lhs, const argument_type& rhs) const; -}; - -typedef std::unordered_set FileUnorderedSet; - -std::size_t UpdateFileList(FileList* /*filelist*/, const boost::filesystem::path& /*repo_dir_path*/); -void UpdateFileUnorderedSet(FileUnorderedSet* /*file_unordered_set*/, const FileList& /*file_list*/); - -} // namespace opcuabridge - -#endif // OPCUABRIDGE_FILELIST_H_ diff --git a/src/libaktualizr/opcuabridge/hash.h b/src/libaktualizr/opcuabridge/hash.h deleted file mode 100644 index cd9767b28a..0000000000 --- a/src/libaktualizr/opcuabridge/hash.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef OPCUABRIDGE_HASH_H_ -#define OPCUABRIDGE_HASH_H_ - -#include "common.h" - -namespace opcuabridge { -class Hash { - public: - Hash() = default; - virtual ~Hash() = default; - - const HashFunction& getFunction() const { return function_; } - void setFunction(const HashFunction& function) { function_ = function; } - const std::string& getDigest() const { return digest_; } - void setDigest(const std::string& digest) { digest_ = digest; } - - Json::Value wrapMessage() const { - Json::Value v; - v["function"] = getFunction(); - v["digest"] = getDigest(); - return v; - } - void unwrapMessage(Json::Value v) { - setFunction(static_cast(v["function"].asInt())); - setDigest(v["digest"].asString()); - } - - protected: - HashFunction function_{}; - std::string digest_; - - private: -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "function_", function_); - SERIALIZE_FIELD(ar, "digest_", digest_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_HASH_H_ diff --git a/src/libaktualizr/opcuabridge/image.h b/src/libaktualizr/opcuabridge/image.h deleted file mode 100644 index be027ca927..0000000000 --- a/src/libaktualizr/opcuabridge/image.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef OPCUABRIDGE_IMAGE_H_ -#define OPCUABRIDGE_IMAGE_H_ - -#include "hash.h" - -#include "common.h" - -namespace opcuabridge { -class Image { - public: - Image() = default; - virtual ~Image() = default; - - const std::string& getFilename() const { return filename_; } - void setFilename(const std::string& filename) { filename_ = filename; } - const std::size_t& getLength() const { return length_; } - void setLength(const std::size_t& length) { length_ = length; } - const std::vector& getHashes() const { return hashes_; } - void setHashes(const std::vector& hashes) { hashes_ = hashes; } - - Json::Value wrapMessage() const { - Json::Value v; - v["filepath"] = getFilename(); - v["fileinfo"]["length"] = static_cast(getLength()); - v["fileinfo"]["hashes"] = convert_to::jsonArray(getHashes()); - return v; - } - void unwrapMessage(Json::Value v) { - setFilename(v["filepath"].asString()); - setLength(v["fileinfo"]["length"].asUInt()); - setHashes(convert_to::stdVector(v["fileinfo"]["hashes"])); - } - - protected: - std::string filename_; - std::size_t length_{}; - std::vector hashes_; - - private: -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "filename_", filename_); - SERIALIZE_FIELD(ar, "length_", length_); - SERIALIZE_FIELD(ar, "hashes_", hashes_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_IMAGE_H_ diff --git a/src/libaktualizr/opcuabridge/imageblock.h b/src/libaktualizr/opcuabridge/imageblock.h deleted file mode 100644 index d236506a71..0000000000 --- a/src/libaktualizr/opcuabridge/imageblock.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef OPCUABRIDGE_IMAGEBLOCK_H_ -#define OPCUABRIDGE_IMAGEBLOCK_H_ - -#include - -#include "common.h" - -namespace opcuabridge { -class ImageBlock { - public: - typedef BinaryDataType block_type; - - ImageBlock() = default; - virtual ~ImageBlock() = default; - - const std::string& getFilename() const { return filename_; } - void setFilename(const std::string& filename) { filename_ = filename; } - const std::size_t& getBlockNumber() const { return blockNumber_; } - void setBlockNumber(const std::size_t& blockNumber) { blockNumber_ = blockNumber; } - block_type& getBlock() { return block_; } - const block_type& getBlock() const { return block_; } - void setBlock(const block_type& block) { block_ = block; } - INITSERVERNODESET_BIN_FUNCTION_DEFINITION(ImageBlock, &block_) // InitServerNodeset(UA_Server*) - CLIENTREAD_BIN_FUNCTION_DEFINITION(&block_) // ClientRead(UA_Client*) - CLIENTWRITE_BIN_FUNCTION_DEFINITION(&block_) // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { on_before_read_cb_ = std::move(cb); } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { on_after_write_cb_ = std::move(cb); } - - protected: - std::string filename_; - std::size_t blockNumber_{0}; - block_type block_; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - static const char* bin_node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - v["filename"] = getFilename(); - v["blockNumber"] = static_cast(getBlockNumber()); - return v; - } - void unwrapMessage(Json::Value v) { - setFilename(v["filename"].asString()); - setBlockNumber(v["blockNumber"].asUInt()); - } - - WRAPMESSAGE_FUCTION_DEFINITION(ImageBlock) - UNWRAPMESSAGE_FUCTION_DEFINITION(ImageBlock) - READ_FUNCTION_FRIEND_DECLARATION(ImageBlock) - WRITE_FUNCTION_FRIEND_DECLARATION(ImageBlock) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(ImageBlock) - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "filename_", filename_); - SERIALIZE_FIELD(ar, "blockNumber_", blockNumber_); - SERIALIZE_FIELD(ar, "block_", block_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_IMAGEBLOCK_H_ diff --git a/src/libaktualizr/opcuabridge/imagefile.h b/src/libaktualizr/opcuabridge/imagefile.h deleted file mode 100644 index bd73faf31b..0000000000 --- a/src/libaktualizr/opcuabridge/imagefile.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef OPCUABRIDGE_IMAGEFILE_H_ -#define OPCUABRIDGE_IMAGEFILE_H_ - -#include - -#include "common.h" - -namespace opcuabridge { -class ImageFile { - public: - ImageFile() = default; - virtual ~ImageFile() = default; - - const std::string& getFilename() const { return filename_; } - void setFilename(const std::string& filename) { filename_ = filename; } - const std::size_t& getNumberOfBlocks() const { return numberOfBlocks_; } - void setNumberOfBlocks(const std::size_t& numberOfBlocks) { numberOfBlocks_ = numberOfBlocks; } - const std::size_t& getBlockSize() const { return blockSize_; } - void setBlockSize(const std::size_t& blockSize) { blockSize_ = blockSize; } - INITSERVERNODESET_FUNCTION_DEFINITION(ImageFile) // InitServerNodeset(UA_Server*) - CLIENTREAD_FUNCTION_DEFINITION() // ClientRead(UA_Client*) - CLIENTWRITE_FUNCTION_DEFINITION() // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { on_before_read_cb_ = std::move(cb); } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { on_after_write_cb_ = std::move(cb); } - - protected: - std::string filename_; - std::size_t numberOfBlocks_{}; - std::size_t blockSize_{}; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - v["filename"] = getFilename(); - v["numberOfBlocks"] = static_cast(getNumberOfBlocks()); - v["blockSize"] = static_cast(getBlockSize()); - return v; - } - void unwrapMessage(Json::Value v) { - setFilename(v["filename"].asString()); - setNumberOfBlocks(v["numberOfBlocks"].asUInt()); - setBlockSize(v["blockSize"].asUInt()); - } - - WRAPMESSAGE_FUCTION_DEFINITION(ImageFile) - UNWRAPMESSAGE_FUCTION_DEFINITION(ImageFile) - READ_FUNCTION_FRIEND_DECLARATION(ImageFile) - WRITE_FUNCTION_FRIEND_DECLARATION(ImageFile) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(ImageFile) - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "filename_", filename_); - SERIALIZE_FIELD(ar, "numberOfBlocks_", numberOfBlocks_); - SERIALIZE_FIELD(ar, "blockSize_", blockSize_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_IMAGEFILE_H_ diff --git a/src/libaktualizr/opcuabridge/imagerequest.h b/src/libaktualizr/opcuabridge/imagerequest.h deleted file mode 100644 index dc90fb719f..0000000000 --- a/src/libaktualizr/opcuabridge/imagerequest.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef OPCUABRIDGE_IMAGEREQUEST_H_ -#define OPCUABRIDGE_IMAGEREQUEST_H_ - -#include - -#include "common.h" - -namespace opcuabridge { -class ImageRequest { - public: - ImageRequest() = default; - virtual ~ImageRequest() = default; - - const std::string& getFilename() const { return filename_; } - void setFilename(const std::string& filename) { filename_ = filename; } - INITSERVERNODESET_FUNCTION_DEFINITION(ImageRequest) // InitServerNodeset(UA_Server*) - CLIENTREAD_FUNCTION_DEFINITION() // ClientRead(UA_Client*) - CLIENTWRITE_FUNCTION_DEFINITION() // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { - on_before_read_cb_ = std::move(cb); - } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { - on_after_write_cb_ = std::move(cb); - } - - protected: - std::string filename_; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - v["filename"] = getFilename(); - return v; - } - void unwrapMessage(Json::Value v) { setFilename(v["filename"].asString()); } - - WRAPMESSAGE_FUCTION_DEFINITION(ImageRequest) - UNWRAPMESSAGE_FUCTION_DEFINITION(ImageRequest) - READ_FUNCTION_FRIEND_DECLARATION(ImageRequest) - WRITE_FUNCTION_FRIEND_DECLARATION(ImageRequest) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(ImageRequest) - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { SERIALIZE_FIELD(ar, "filename_", filename_); } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_IMAGEREQUEST_H_ diff --git a/src/libaktualizr/opcuabridge/metadatafile.h b/src/libaktualizr/opcuabridge/metadatafile.h deleted file mode 100644 index 83d2217560..0000000000 --- a/src/libaktualizr/opcuabridge/metadatafile.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef OPCUABRIDGE_METADATAFILE_H_ -#define OPCUABRIDGE_METADATAFILE_H_ - -#include - -#include "common.h" - -namespace opcuabridge { -class MetadataFile { - public: - typedef BinaryDataType block_type; - - MetadataFile() = default; - virtual ~MetadataFile() = default; - - const int& getGUID() const { return GUID_; } - void setGUID(const int& GUID) { GUID_ = GUID; } - const std::size_t& getFileNumber() const { return fileNumber_; } - void setFileNumber(const std::size_t& fileNumber) { fileNumber_ = fileNumber; } - const std::string& getFilename() const { return filename_; } - void setFilename(const std::string& filename) { filename_ = filename; } - block_type& getMetadata() { return metadata_; } - const block_type& getMetadata() const { return metadata_; } - void setMetadata(const block_type& metadata) { metadata_ = metadata; } - void setMetadata(const Json::Value& metadata) { - Json::FastWriter fw; - std::string s = fw.write(metadata); - metadata_.assign(s.begin(), s.end()); - } - INITSERVERNODESET_BIN_FUNCTION_DEFINITION(MetadataFile, &metadata_) // InitServerNodeset(UA_Server*) - CLIENTREAD_BIN_FUNCTION_DEFINITION(&metadata_) // ClientRead(UA_Client*) - CLIENTWRITE_BIN_FUNCTION_DEFINITION(&metadata_) // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { - on_before_read_cb_ = std::move(cb); - } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { - on_after_write_cb_ = std::move(cb); - } - - protected: - int GUID_{}; - std::size_t fileNumber_{}; - std::string filename_; - block_type metadata_; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - static const char* bin_node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - v["GUID"] = getGUID(); - v["fileNumber"] = static_cast(getFileNumber()); - v["filename"] = getFilename(); - return v; - } - void unwrapMessage(Json::Value v) { - setGUID(v["GUID"].asInt()); - setFileNumber(v["fileNumber"].asUInt()); - setFilename(v["filename"].asString()); - } - - WRAPMESSAGE_FUCTION_DEFINITION(MetadataFile) - UNWRAPMESSAGE_FUCTION_DEFINITION(MetadataFile) - READ_FUNCTION_FRIEND_DECLARATION(MetadataFile) - WRITE_FUNCTION_FRIEND_DECLARATION(MetadataFile) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(MetadataFile) - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "GUID_", GUID_); - SERIALIZE_FIELD(ar, "fileNumber_", fileNumber_); - SERIALIZE_FIELD(ar, "filename_", filename_); - SERIALIZE_FIELD(ar, "metadata_", metadata_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_METADATAFILE_H_ diff --git a/src/libaktualizr/opcuabridge/metadatafiles.h b/src/libaktualizr/opcuabridge/metadatafiles.h deleted file mode 100644 index 39ac4ce8a7..0000000000 --- a/src/libaktualizr/opcuabridge/metadatafiles.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef OPCUABRIDGE_METADATAFILES_H_ -#define OPCUABRIDGE_METADATAFILES_H_ - -#include - -#include "common.h" - -namespace opcuabridge { -class MetadataFiles { - public: - MetadataFiles() = default; - virtual ~MetadataFiles() = default; - - const int& getGUID() const { return GUID_; } - void setGUID(const int& GUID) { GUID_ = GUID; } - const std::size_t& getNumberOfMetadataFiles() const { return numberOfMetadataFiles_; } - void setNumberOfMetadataFiles(const std::size_t& numberOfMetadataFiles) { - numberOfMetadataFiles_ = numberOfMetadataFiles; - } - INITSERVERNODESET_FUNCTION_DEFINITION(MetadataFiles) // InitServerNodeset(UA_Server*) - CLIENTREAD_FUNCTION_DEFINITION() // ClientRead(UA_Client*) - CLIENTWRITE_FUNCTION_DEFINITION() // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { - on_before_read_cb_ = std::move(cb); - } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { - on_after_write_cb_ = std::move(cb); - } - - protected: - int GUID_{-1}; - std::size_t numberOfMetadataFiles_{0}; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - v["GUID"] = getGUID(); - v["numberOfMetadataFiles"] = static_cast(getNumberOfMetadataFiles()); - return v; - } - void unwrapMessage(Json::Value v) { - setGUID(v["GUID"].asInt()); - setNumberOfMetadataFiles(v["numberOfMetadataFiles"].asUInt()); - } - - WRAPMESSAGE_FUCTION_DEFINITION(MetadataFiles) - UNWRAPMESSAGE_FUCTION_DEFINITION(MetadataFiles) - READ_FUNCTION_FRIEND_DECLARATION(MetadataFiles) - WRITE_FUNCTION_FRIEND_DECLARATION(MetadataFiles) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(MetadataFiles) - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "GUID_", GUID_); - SERIALIZE_FIELD(ar, "numberOfMetadataFiles_", numberOfMetadataFiles_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_METADATAFILES_H_ diff --git a/src/libaktualizr/opcuabridge/opcuabridge.h b/src/libaktualizr/opcuabridge/opcuabridge.h deleted file mode 100644 index 28af5bf475..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridge.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef OPCUABRIDGE_H_ -#define OPCUABRIDGE_H_ - -#include "configuration.h" -#include "currenttime.h" -#include "ecuversionmanifest.h" -#include "ecuversionmanifestsigned.h" -#include "filedata.h" -#include "filelist.h" -#include "hash.h" -#include "image.h" -#include "imageblock.h" -#include "imagefile.h" -#include "imagerequest.h" -#include "metadatafile.h" -#include "metadatafiles.h" -#include "opcuabridgeconfig.h" -#include "originalmanifest.h" -#include "signature.h" -#include "signed.h" -#include "versionreport.h" - -#endif // OPCUABRIDGE_H_ diff --git a/src/libaktualizr/opcuabridge/opcuabridge_messaging_test.cc b/src/libaktualizr/opcuabridge/opcuabridge_messaging_test.cc deleted file mode 100644 index 9498174235..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridge_messaging_test.cc +++ /dev/null @@ -1,179 +0,0 @@ -#include - -#include - -#define OPCUABRIDGE_ENABLE_SERIALIZATION - -#include -#include -#include "utilities/utils.h" - -#include "opcuabridge_test_utils.h" -#include "test_utils.h" - -#include -#include - -namespace tutils = opcuabridge_test_utils; - -TemporaryDirectory temp_dir("opcuabridge-messaging-test"); - -template -void LoadTransferCheck(UA_Client* client, const std::string& roottag) { - std::string msg_content = tutils::GetMessageDumpFilePath(temp_dir); - - MessageT m, m_response; - { - std::ifstream file(msg_content.c_str()); - - boost::archive::xml_iarchive ia(file); - ia >> boost::serialization::make_nvp(roottag.c_str(), m); - } - - UA_StatusCode retval = m.ClientWrite(client); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - - retval = m_response.ClientRead(client); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - - std::string msg_response = tutils::GetMessageResponseFilePath(temp_dir); - { - std::ofstream file(msg_response.c_str()); - - boost::archive::xml_oarchive oa(file); - oa << boost::serialization::make_nvp(roottag.c_str(), m_response); - - file.flush(); - } - - std::string diff_cmd = std::string("diff ") + " -q " + msg_content + " " + msg_response; - EXPECT_EQ(0, system(diff_cmd.c_str())); -} - -const std::string kHexValue = "00010203040506070809AABBCCDDEEFF"; - -TEST(opcuabridge, serialization) { - std::mt19937 gen; - gen.seed(static_cast(std::time(0))); - std::uniform_int_distribution random_byte(0x00, 0xFF); - - opcuabridge::Signature s1 = tutils::CreateSignature(kHexValue, opcuabridge::SIG_METHOD_ED25519, kHexValue, kHexValue); - opcuabridge::Signature s2 = tutils::CreateSignature(kHexValue, opcuabridge::SIG_METHOD_ED25519, kHexValue, kHexValue); - - std::vector signatures; - signatures.push_back(s1); - signatures.push_back(s2); - - opcuabridge::Signed s = tutils::CreateSigned(10); - - // VersionReport - - std::vector hashes; - opcuabridge::Hash h; - h.setFunction(opcuabridge::HASH_FUN_SHA256); - h.setDigest(kHexValue); - hashes.push_back(h); - - opcuabridge::Image image; - image.setFilename("IMAGE_FILENAME.EXT"); - image.setLength(0xffff); - image.setHashes(hashes); - - opcuabridge::ECUVersionManifestSigned ecu_version_manifest_signed; - ecu_version_manifest_signed.setEcuIdentifier("XXXXXXXX"); - ecu_version_manifest_signed.setPreviousTime(0); - ecu_version_manifest_signed.setCurrentTime(static_cast(time(NULL))); - ecu_version_manifest_signed.setSecurityAttack(""); - ecu_version_manifest_signed.setInstalledImage(image); - - opcuabridge::ECUVersionManifest ecu_version_manifest; - ecu_version_manifest.setSignatures(signatures); - ecu_version_manifest.setEcuVersionManifestSigned(ecu_version_manifest_signed); - - opcuabridge::VersionReport vr; - vr.setTokenForTimeServer(0); - vr.setEcuVersionManifest(ecu_version_manifest); - - EXPECT_TRUE(tutils::SerializeMessage(temp_dir, "VersionReport", vr)); - - // CurrentTime - - opcuabridge::CurrentTime ct; - ct.setSignatures(signatures); - ct.setSigned(s); - - EXPECT_TRUE(tutils::SerializeMessage(temp_dir, "CurrentTime", ct)); - - // MetadataFiles - - int guid = static_cast(time(NULL)); - opcuabridge::MetadataFiles mds; - mds.setGUID(guid); - mds.setNumberOfMetadataFiles(1); - - EXPECT_TRUE(tutils::SerializeMessage(temp_dir, "MetadataFiles", mds)); - - // MetadataFile - - opcuabridge::MetadataFile md; - md.setGUID(guid); - md.setFileNumber(1); - md.setFilename("METADATA.EXT"); - std::vector metadata(1024); - std::generate(metadata.begin(), metadata.end(), std::bind(random_byte, std::ref(gen))); - md.setMetadata(metadata); - - EXPECT_TRUE(tutils::SerializeMessage(temp_dir, "MetadataFile", md)); - - // ImageRequest - - opcuabridge::ImageRequest ir; - ir.setFilename("IMAGE_FILE.EXT"); - - EXPECT_TRUE(tutils::SerializeMessage(temp_dir, "ImageRequest", ir)); - - // ImageFile - - opcuabridge::ImageFile img_file; - img_file.setFilename("IMAGE_FILE.EXT"); - img_file.setNumberOfBlocks(1); - img_file.setBlockSize(1024); - - EXPECT_TRUE(tutils::SerializeMessage(temp_dir, "ImageFile", img_file)); - - // ImageBlock - - opcuabridge::ImageBlock img_block; - img_block.setFilename("IMAGE_FILE.EXT"); - img_block.setBlockNumber(1); - std::vector block(1024); - std::generate(block.begin(), block.end(), std::bind(random_byte, std::ref(gen))); - img_block.setBlock(block); - - EXPECT_TRUE(tutils::SerializeMessage(temp_dir, "ImageBlock", img_block)); -} - -TEST(opcuabridge, transfer_messages) { - std::string opc_port = TestUtils::getFreePort(); - std::string opc_url = std::string("opc.tcp://localhost:") + opc_port; - - boost::process::child server("./opcuabridge-server", opc_port); - - UA_Client* client = UA_Client_new(UA_ClientConfig_default); - - UA_StatusCode retval = UA_Client_connect(client, opc_url.c_str()); - - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - - BOOST_PP_LIST_FOR_EACH(LOAD_TRANSFER_CHECK, client, OPCUABRIDGE_TEST_MESSAGES_DEFINITION) - - UA_Client_disconnect(client); - UA_Client_delete(client); -} - -#ifndef __NO_MAIN__ -int main(int argc, char* argv[]) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/src/libaktualizr/opcuabridge/opcuabridge_ostree_repo_sync_client.cc b/src/libaktualizr/opcuabridge/opcuabridge_ostree_repo_sync_client.cc deleted file mode 100644 index 0e755dcae4..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridge_ostree_repo_sync_client.cc +++ /dev/null @@ -1,83 +0,0 @@ -#include - -#include -#include "package_manager/ostreereposync.h" - -#include -#include -#include - -#include - -#include "logging/logging.h" -#include "test_utils.h" - -namespace fs = boost::filesystem; - -int main(int argc, char* argv[]) { - logger_init(); - - const char* opc_port = (argc < 3 ? "4840" : argv[2]); - - if (argc < 2) { - std::cout << "Usage: " << argv[0] << " /path/to/repo [port]" << std::endl; - return 0; - } - - TemporaryDirectory temp_dir("opcuabridge-ostree-repo-sync-client"); - - fs::path src_repo_dir(argv[1]); - fs::path working_repo_dir; - - if (ostree_repo_sync::ArchiveModeRepo(src_repo_dir)) { - LOG_INFO << "Source repo is in 'archive' mode - use it directly"; - working_repo_dir = src_repo_dir; - } else { - working_repo_dir = temp_dir.Path(); - - if (!ostree_repo_sync::LocalPullRepo(src_repo_dir, working_repo_dir)) { - LOG_ERROR << "OSTree: local pull to a temp repo is failed"; - } - } - - // init client - UA_Client *client = UA_Client_new(UA_ClientConfig_default); - - std::string opc_url = std::string("opc.tcp://localhost:") + opc_port; - UA_StatusCode retval = UA_Client_connect(client, opc_url.c_str()); - if (retval != UA_STATUSCODE_GOOD) { - UA_Client_delete(client); - return (int)retval; - } - - // sync repo files - opcuabridge::FileList file_list; - opcuabridge::FileData file_data(working_repo_dir); - - file_list.ClientRead(client); - - opcuabridge::FileUnorderedSet file_unordered_set; - opcuabridge::UpdateFileUnorderedSet(&file_unordered_set, file_list); - - fs::recursive_directory_iterator - repo_dir_it_end, repo_dir_it(working_repo_dir); - for (; repo_dir_it != repo_dir_it_end; ++repo_dir_it) { - const fs::path& ent_path = repo_dir_it->path(); - if (fs::is_regular_file(ent_path)) { - fs::path rel_path = fs::relative(ent_path, working_repo_dir); - if (file_unordered_set.count((opcuabridge::FileSetEntry)rel_path.c_str()) == 0) { - file_data.setFilePath(rel_path); - file_data.ClientWriteFile(client, ent_path); - } - } - } - - file_list.getBlock().resize(1); - file_list.getBlock()[0] = '\0'; - file_list.ClientWrite(client); - - UA_Client_disconnect(client); - UA_Client_delete(client); - return static_cast(UA_STATUSCODE_GOOD); -} - diff --git a/src/libaktualizr/opcuabridge/opcuabridge_ostree_repo_sync_server.cc b/src/libaktualizr/opcuabridge/opcuabridge_ostree_repo_sync_server.cc deleted file mode 100644 index eaf4796815..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridge_ostree_repo_sync_server.cc +++ /dev/null @@ -1,89 +0,0 @@ -#include - -#include "logging/logging.h" -#include "opcuabridge/opcuabridge.h" -#include "package_manager/ostreemanager.h" -#include "package_manager/ostreereposync.h" - -#include "opcuabridge_test_utils.h" - -#include -#include -#include - -#include - - -namespace fs = boost::filesystem; - -UA_Boolean running = true; - -static void stopHandler(int) { - LOG_INFO << "received ctrl-c"; - running = false; -} - -int main(int argc, char* argv[]) { - - logger_init(); - - UA_UInt16 port = (argc < 3 ? 4840 : (UA_UInt16)std::atoi(argv[2])); - - if (argc < 2) { - std::cout << "Usage: " << argv[0] << " /path/to/repo [port]" << std::endl; - return 0; - } - - fs::path src_repo_dir(argv[1]); - fs::path working_repo_dir; - - TemporaryDirectory temp_dir("opcuabridge-ostree-repo-sync-server"); - - if (ostree_repo_sync::ArchiveModeRepo(src_repo_dir)) { - LOG_INFO << "Source repo is in 'archive' mode - use it directly"; - working_repo_dir = src_repo_dir; - } else { - working_repo_dir = temp_dir.Path(); - - if (!ostree_repo_sync::LocalPullRepo(src_repo_dir, working_repo_dir)) { - LOG_ERROR << "OSTree: local pull to a temp repo is failed"; - } - } - - // init server - struct sigaction sa; - sa.sa_handler = &stopHandler; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - - sigaction(SIGINT , &sa, NULL); - sigaction(SIGTERM , &sa, NULL); - - UA_ServerConfig *config = UA_ServerConfig_new_minimal(port, NULL); - config->logger = &opcuabridge_test_utils::BoostLogServer; - - UA_Server *server = UA_Server_new(config); - - // expose ostree repo files - opcuabridge::FileList file_list; - opcuabridge::FileData file_data(working_repo_dir); - - opcuabridge::UpdateFileList(&file_list, working_repo_dir); - - file_list.InitServerNodeset(server); - file_data.InitServerNodeset(server); - - file_list.setOnAfterWriteCallback([&src_repo_dir, &working_repo_dir] - (opcuabridge::FileList* file_list_cb) { - if (!file_list_cb->getBlock().empty() && file_list_cb->getBlock()[0] == '\0') - if (!ostree_repo_sync::ArchiveModeRepo(src_repo_dir)) - if (!ostree_repo_sync::LocalPullRepo(working_repo_dir, src_repo_dir)) - LOG_ERROR << "OSTree: local pull to the source repo is failed"; - }); - // run server - UA_StatusCode retval = UA_Server_run(server, &running); - UA_Server_delete(server); - UA_ServerConfig_delete(config); - - return static_cast(retval); -} diff --git a/src/libaktualizr/opcuabridge/opcuabridge_secondary.cc b/src/libaktualizr/opcuabridge/opcuabridge_secondary.cc deleted file mode 100644 index 76ddd89204..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridge_secondary.cc +++ /dev/null @@ -1,114 +0,0 @@ -#include - -#include "crypto/crypto.h" -#include "logging/logging.h" - -#include "opcuabridge_test_utils.h" - -#include -#include -#include - -#include - -namespace fs = boost::filesystem; - -UA_Boolean running = true; -TemporaryDirectory temp_dir("opcuabridge-secondary"); - -static void stopHandler(int sign) { - LOG_INFO << "received ctrl-c"; - running = false; -} - -fs::path metadata_filepath; - -opcuabridge::Image installed_image; - -BOOST_PP_LIST_FOR_EACH(DEFINE_MESSAGE, _, OPCUABRIDGE_TEST_MESSAGES_DEFINITION) - -void OnBeforeReadVersionReport(opcuabridge::VersionReport* version_report) { - opcuabridge::ECUVersionManifestSigned ecu_version_manifest_signed; - ecu_version_manifest_signed.setInstalledImage(installed_image); - - opcuabridge::ECUVersionManifest ecu_version_manifest; - ecu_version_manifest.setEcuVersionManifestSigned(ecu_version_manifest_signed); - - version_report->setEcuVersionManifest(ecu_version_manifest); -} - -void OnAfterWriteMetadataFile(opcuabridge::MetadataFile* metadata_file) { - metadata_filepath = temp_dir / metadata_file->getFilename(); - std::ofstream ofs(metadata_filepath.c_str(), std::ios::binary | std::ios::trunc); - std::copy(metadata_file->getMetadata().begin(), metadata_file->getMetadata().end(), - std::ostreambuf_iterator(ofs.rdbuf())); -} - -void OnBeforeReadImageRequest(opcuabridge::ImageRequest* image_request) { - if (fs::exists(metadata_filepath)) { - std::string image_filename; - std::ifstream ifs(metadata_filepath.c_str()); - ifs >> image_filename; - image_request->setFilename(image_filename); - } -} - -MultiPartSHA256Hasher hasher; -std::size_t image_blocks; - -void OnAfterWriteImageFile(opcuabridge::ImageFile* image_file) { - hasher = MultiPartSHA256Hasher(); - installed_image.setFilename(image_file->getFilename()); - installed_image.setLength(0); - image_blocks = image_file->getNumberOfBlocks(); -} - -void OnAfterWriteImageBlock(opcuabridge::ImageBlock* image_block) { - fs::path image_filepath = temp_dir / installed_image.getFilename(); - std::ofstream ofs(image_filepath.c_str(), std::ios::binary | std::ios::app); - const std::vector& block = image_block->getBlock(); - std::copy(block.begin(), block.end(), std::ostreambuf_iterator(ofs.rdbuf())); - hasher.update(&block[0], block.size()); - installed_image.setLength(installed_image.getLength() + block.size()); - if (--image_blocks == 0) { - std::vector hashes(1); - hashes[0].setFunction(opcuabridge::HASH_FUN_SHA256); - hashes[0].setDigest(hasher.getHexDigest()); - installed_image.setHashes(hashes); - } -} - -int main(int argc, char* argv[]) { - UA_UInt16 port = (argc < 2 ? 4840 : (UA_UInt16)std::atoi(argv[1])); - - logger_init(); - - LOG_INFO << "server port number: " << argv[1]; - - struct sigaction sa; - sa.sa_handler = &stopHandler; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - - sigaction(SIGINT, &sa, NULL); - sigaction(SIGTERM, &sa, NULL); - - UA_ServerConfig* config = UA_ServerConfig_new_minimal(port, NULL); - config->logger = &opcuabridge_test_utils::BoostLogSecondary; - - UA_Server* server = UA_Server_new(config); - - BOOST_PP_LIST_FOR_EACH(INIT_SERVER_NODESET, server, OPCUABRIDGE_TEST_MESSAGES_DEFINITION) - - vr.setOnBeforeReadCallback(&OnBeforeReadVersionReport); - md.setOnAfterWriteCallback(&OnAfterWriteMetadataFile); - ir.setOnBeforeReadCallback(&OnBeforeReadImageRequest); - img_file.setOnAfterWriteCallback(&OnAfterWriteImageFile); - img_block.setOnAfterWriteCallback(&OnAfterWriteImageBlock); - - UA_StatusCode retval = UA_Server_run(server, &running); - UA_Server_delete(server); - UA_ServerConfig_delete(config); - - return static_cast(retval); -} diff --git a/src/libaktualizr/opcuabridge/opcuabridge_secondary_update_test.cc b/src/libaktualizr/opcuabridge/opcuabridge_secondary_update_test.cc deleted file mode 100644 index 9d63f9149b..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridge_secondary_update_test.cc +++ /dev/null @@ -1,170 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include - -#define OPCUABRIDGE_ENABLE_SERIALIZATION - -#include "utilities/utils.h" - -#include "opcuabridge_test_utils.h" -#include "test_utils.h" - -#include "crypto/crypto.h" - -#include - -namespace tutils = opcuabridge_test_utils; -namespace fs = boost::filesystem; - -TemporaryDirectory temp_dir("opcuabridge-secondary-update-test"); - -const char* kMetadataFileName = "METADATA.EXT"; -const char* kUpdateImageFileName = "UPDATE_IMAGE.EXT"; -const std::size_t kUpdateImageBlockSize = 1024; -const std::size_t kUpdateImageSize = 10 * kUpdateImageBlockSize; - -const std::string kHexValue = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - -fs::path kImageFilePath = temp_dir / kUpdateImageFileName; -fs::path kMetadataFilePath = temp_dir / kMetadataFileName; - -TEST(opcuabridge, prepare_update) { - std::mt19937 gen; - gen.seed(static_cast(std::time(0))); - std::uniform_int_distribution random_byte(0x00, 0xFF); - - std::vector block(kUpdateImageBlockSize); - std::ofstream imagefile(kImageFilePath.c_str(), std::ios::binary | std::ios::app); - MultiPartSHA256Hasher hasher; - std::size_t size = 0; - while (size < kUpdateImageSize) { - std::generate(block.begin(), block.end(), std::bind(random_byte, std::ref(gen))); - hasher.update(&block[0], block.size()); - std::copy(block.begin(), block.end(), std::ostreambuf_iterator(imagefile.rdbuf())); - size += std::min(block.size(), kUpdateImageSize - size); - } - - std::ofstream mdfile(kMetadataFilePath.c_str()); - mdfile << kUpdateImageFileName << std::endl; - mdfile << kUpdateImageSize << std::endl; - mdfile << hasher.getHexDigest() << std::endl; - - EXPECT_TRUE(fs::exists(kImageFilePath)); - EXPECT_TRUE(fs::exists(kMetadataFilePath)); -} - -TEST(opcuabridge, secondary_update) { - std::string opc_port = TestUtils::getFreePort(); - std::string opc_url = std::string("opc.tcp://localhost:") + opc_port; - - boost::process::child server("./opcuabridge-secondary", opc_port); - - UA_Client* client = UA_Client_new(UA_ClientConfig_default); - - UA_StatusCode retval = UA_Client_connect(client, opc_url.c_str()); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - - // read initial version report - opcuabridge::VersionReport initial_vr; - retval = initial_vr.ClientRead(client); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - - // write current time - opcuabridge::Signature s1 = tutils::CreateSignature(kHexValue, opcuabridge::SIG_METHOD_ED25519, kHexValue, kHexValue); - opcuabridge::Signature s2 = tutils::CreateSignature(kHexValue, opcuabridge::SIG_METHOD_ED25519, kHexValue, kHexValue); - - std::vector signatures; - signatures.push_back(s1); - signatures.push_back(s2); - - opcuabridge::Signed s = tutils::CreateSigned(5); - - opcuabridge::CurrentTime ct; - ct.setSignatures(signatures); - ct.setSigned(s); - retval = ct.ClientWrite(client); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - - // write metadata files - int guid = static_cast(time(NULL)); - opcuabridge::MetadataFiles mds; - mds.setGUID(guid); - mds.setNumberOfMetadataFiles(1); - retval = mds.ClientWrite(client); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - - std::string image_filename, image_hash; - std::size_t image_size; - EXPECT_TRUE(fs::exists(kMetadataFilePath)); - { - std::ifstream mdfile(kMetadataFilePath.c_str()); - mdfile >> image_filename; - mdfile >> image_size; - mdfile >> image_hash; - } - - opcuabridge::MetadataFile md; - md.setGUID(guid); - md.setFileNumber(1); - md.setFilename(kMetadataFileName); - std::vector metadata; - std::ifstream mdfile(kMetadataFilePath.c_str(), std::ios::binary); - std::copy(std::istreambuf_iterator(mdfile), std::istreambuf_iterator(), std::back_inserter(metadata)); - md.setMetadata(metadata); - retval = md.ClientWrite(client); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - - // check image request - opcuabridge::ImageRequest ir; - retval = ir.ClientRead(client); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - EXPECT_EQ(kUpdateImageFileName, ir.getFilename()); - - // write image - EXPECT_TRUE(fs::exists(kImageFilePath)); - - opcuabridge::ImageFile img_file; - img_file.setFilename(kUpdateImageFileName); - img_file.setNumberOfBlocks(kUpdateImageSize / kUpdateImageBlockSize); - img_file.setBlockSize(kUpdateImageBlockSize); - retval = img_file.ClientWrite(client); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - - opcuabridge::ImageBlock img_block; - img_block.setFilename(image_filename); - std::vector block(kUpdateImageBlockSize); - std::ifstream image_file(kImageFilePath.c_str(), std::ios::binary); - for (std::size_t b = 1; b <= img_file.getNumberOfBlocks(); ++b) { - image_file.read(reinterpret_cast(&block[0]), kUpdateImageBlockSize); - img_block.setBlockNumber(b); - img_block.setBlock(block); - retval = img_block.ClientWrite(client); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - } - - // read version report after update - opcuabridge::VersionReport updated_vr; - retval = updated_vr.ClientRead(client); - EXPECT_EQ(retval, UA_STATUSCODE_GOOD); - - opcuabridge::Image installed_image = - updated_vr.getEcuVersionManifest().getEcuVersionManifestSigned().getInstalledImage(); - EXPECT_EQ(installed_image.getFilename(), kUpdateImageFileName); - EXPECT_EQ(installed_image.getLength(), kUpdateImageSize); - EXPECT_EQ(installed_image.getHashes()[0].getDigest(), image_hash); - - UA_Client_disconnect(client); - UA_Client_delete(client); -} - -#ifndef __NO_MAIN__ -int main(int argc, char* argv[]) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/src/libaktualizr/opcuabridge/opcuabridge_server.cc b/src/libaktualizr/opcuabridge/opcuabridge_server.cc deleted file mode 100644 index 60ccbbdfba..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridge_server.cc +++ /dev/null @@ -1,46 +0,0 @@ -#include - -#include "logging/logging.h" -#include "opcuabridge_test_utils.h" - -#include -#include -#include - -UA_Boolean running = true; - -static void stopHandler(int sign) { - LOG_INFO << "received ctrl-c"; - running = false; -} - -int main(int argc, char *argv[]) { - UA_UInt16 port = (argc < 2 ? 4840 : (UA_UInt16)std::atoi(argv[1])); - - logger_init(); - - LOG_INFO << "server port number: " << argv[1]; - - struct sigaction sa; - sa.sa_handler = &stopHandler; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - - sigaction(SIGINT, &sa, NULL); - sigaction(SIGTERM, &sa, NULL); - - BOOST_PP_LIST_FOR_EACH(DEFINE_MESSAGE, _, OPCUABRIDGE_TEST_MESSAGES_DEFINITION) - - UA_ServerConfig *config = UA_ServerConfig_new_minimal(port, NULL); - config->logger = &opcuabridge_test_utils::BoostLogServer; - - UA_Server *server = UA_Server_new(config); - - BOOST_PP_LIST_FOR_EACH(INIT_SERVER_NODESET, server, OPCUABRIDGE_TEST_MESSAGES_DEFINITION) - - UA_StatusCode retval = UA_Server_run(server, &running); - UA_Server_delete(server); - UA_ServerConfig_delete(config); - - return static_cast(retval); -} diff --git a/src/libaktualizr/opcuabridge/opcuabridge_test_utils.cc b/src/libaktualizr/opcuabridge/opcuabridge_test_utils.cc deleted file mode 100644 index 49bfa77dfd..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridge_test_utils.cc +++ /dev/null @@ -1,51 +0,0 @@ -#include "opcuabridge_test_utils.h" - -#include - -#include "logging/logging.h" - -namespace opcuabridge_test_utils { - -opcuabridge::Signature CreateSignature(const std::string& keyid, const opcuabridge::SignatureMethod& method, - const std::string& hash, const std::string& value) { - opcuabridge::Signature s; - s.setKeyid(keyid); - s.setMethod(method); - opcuabridge::Hash h; - h.setFunction(opcuabridge::HASH_FUN_SHA256); - h.setDigest(hash); - s.setHash(h); - s.setValue(value); - return s; -} - -opcuabridge::Signed CreateSigned(std::size_t n) { - opcuabridge::Signed s; - std::vector tokens(n); - std::iota(tokens.begin(), tokens.end(), 0); - s.setTokens(tokens); - s.setTimestamp(static_cast(time(NULL))); - return s; -} - -const std::size_t log_msg_buff_size = 256; - -void BoostLogServer(UA_LogLevel level, UA_LogCategory category, const char* msg, va_list args) { - char msg_buff[log_msg_buff_size]; - vsnprintf(msg_buff, log_msg_buff_size, msg, args); - BOOST_LOG_STREAM_WITH_PARAMS( - boost::log::trivial::logger::get(), - (boost::log::keywords::severity = static_cast(level))) - << "server " << msg_buff; -} - -void BoostLogSecondary(UA_LogLevel level, UA_LogCategory category, const char* msg, va_list args) { - char msg_buff[log_msg_buff_size]; - vsnprintf(msg_buff, log_msg_buff_size, msg, args); - BOOST_LOG_STREAM_WITH_PARAMS( - boost::log::trivial::logger::get(), - (boost::log::keywords::severity = static_cast(level))) - << "secondary " << msg_buff; -} - -} // namespace opcuabridge_test_utils diff --git a/src/libaktualizr/opcuabridge/opcuabridge_test_utils.h b/src/libaktualizr/opcuabridge/opcuabridge_test_utils.h deleted file mode 100644 index 6b0b5af0e5..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridge_test_utils.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef OPCUABRIDGE_TEST_H_ -#define OPCUABRIDGE_TEST_H_ - -#include "test_utils.h" -#include "opcuabridge/opcuabridge.h" - -#include -#include -#include -#include -#include - -#define OPCUABRIDGE_TEST_MESSAGES_DEFINITION \ - BOOST_PP_TUPLE_TO_LIST(7, \ - ( \ - (VersionReport , vr), \ - (CurrentTime , ct), \ - (MetadataFiles , mds), \ - (MetadataFile , md), \ - (ImageRequest , ir), \ - (ImageFile , img_file), \ - (ImageBlock , img_block) \ - )) - -#define OPCUABRIDGE_TEST_MESSAGES_TYPE(T) BOOST_PP_TUPLE_ELEM(2, 0, T) -#define OPCUABRIDGE_TEST_MESSAGES_ID(T) BOOST_PP_TUPLE_ELEM(2, 1, T) - -#define DEFINE_MESSAGE(r, unused, e) \ - opcuabridge::OPCUABRIDGE_TEST_MESSAGES_TYPE(e) OPCUABRIDGE_TEST_MESSAGES_ID(e); - -#define INIT_SERVER_NODESET(r, SERVER, e) \ - OPCUABRIDGE_TEST_MESSAGES_ID(e).InitServerNodeset(SERVER); - -#define LOAD_TRANSFER_CHECK(r, CLIENT, e) \ - LoadTransferCheck \ - (CLIENT, BOOST_PP_STRINGIZE(OPCUABRIDGE_TEST_MESSAGES_TYPE(e))); - -template inline std::string GetMessageFileName(); - -#define GET_MESSAGE_FILENAME(r, unused, e) \ - template<> inline std::string GetMessageFileName() { \ - return std::string("opcuabridge_") + BOOST_PP_STRINGIZE(OPCUABRIDGE_TEST_MESSAGES_TYPE(e)) + ".xml"; } - -BOOST_PP_LIST_FOR_EACH(GET_MESSAGE_FILENAME, _, OPCUABRIDGE_TEST_MESSAGES_DEFINITION) - -namespace opcuabridge_test_utils { - -opcuabridge::Signature CreateSignature(const std::string& keyid, const opcuabridge::SignatureMethod& method, - const std::string& hash, const std::string& value); - -opcuabridge::Signed CreateSigned(std::size_t n); - -template -std::string GetMessageDumpFilePath(const TemporaryDirectory& temp_dir) { - return (temp_dir / GetMessageFileName()).native(); -} - -template -std::string GetMessageResponseFilePath(const TemporaryDirectory& temp_dir) { - return (temp_dir / (GetMessageFileName() + ".response")).native(); -} - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - -template -bool SerializeMessage(const TemporaryDirectory& temp_dir, - const std::string& roottag, const MessageT& m) { - std::string filename = GetMessageDumpFilePath(temp_dir); - std::ofstream file(filename.c_str()); - - try { - boost::archive::xml_oarchive oa(file); - oa << boost::serialization::make_nvp(roottag.c_str(), m); - file.flush(); - } catch (...) { - return false; - } - return true; -} - -#endif - -void BoostLogServer(UA_LogLevel level, UA_LogCategory category, const char* msg, va_list args); -void BoostLogSecondary(UA_LogLevel level, UA_LogCategory category, const char* msg, va_list args); - -} // namespace opcuabridge_test_utils - -#endif//OPCUABRIDGE_TEST_H_ diff --git a/src/libaktualizr/opcuabridge/opcuabridgeclient.cc b/src/libaktualizr/opcuabridge/opcuabridgeclient.cc deleted file mode 100644 index 4c284c39d8..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridgeclient.cc +++ /dev/null @@ -1,248 +0,0 @@ -#include "opcuabridgeclient.h" -#include "opcuabridgediscoveryclient.h" - -#include "logging/logging.h" - -#include "uptane/secondaryconfig.h" - -#include - -#include -#include -#include -#include - -#include -#include - -namespace fs = boost::filesystem; - -namespace opcuabridge { - -SelectEndPoint::DiscoveredEndPointCacheEntryHash::result_type SelectEndPoint::DiscoveredEndPointCacheEntryHash:: -operator()(SelectEndPoint::DiscoveredEndPointCacheEntryHash::argument_type const& e) const { - result_type seed = 0; - boost::hash_combine(seed, std::hash()(e.serial)); - boost::hash_combine(seed, std::hash()(e.hwid)); - return seed; -} - -bool SelectEndPoint::DiscoveredEndPointCacheEntryEqual::operator()( - const SelectEndPoint::DiscoveredEndPointCacheEntryEqual::argument_type& lhs, - const SelectEndPoint::DiscoveredEndPointCacheEntryEqual::argument_type& rhs) const { - return (lhs.serial == rhs.serial && lhs.hwid == rhs.hwid); -} - -thread_local SelectEndPoint::DiscoveredEndPointCache SelectEndPoint::discovered_end_points_cache_; - -SelectEndPoint::SelectEndPoint(const Uptane::SecondaryConfig& sconfig) { - if (discovered_end_points_cache_.empty()) { - if (!sconfig.opcua_lds_url.empty()) { - considerLdsRegisteredEndPoints(sconfig.opcua_lds_url); - } else { - discovery::Client discovery_client(OPCUA_DISCOVERY_SERVICE_PORT); - for (const discovery::Client::discovered_endpoint& ep : discovery_client.getDiscoveredEndPoints()) { - if (ep.type == discovery::kLDS) { - considerLdsRegisteredEndPoints(makeOpcuaServerUri(ep.address)); - } else if (ep.type == discovery::kNoLDS) { - std::string opcua_server_url = makeOpcuaServerUri(ep.address); - if (endPointConfirmed(opcua_server_url, sconfig)) { - discovered_end_points_cache_.insert(DiscoveredEndPointCacheEntry{ - Uptane::EcuSerial(sconfig.ecu_serial), Uptane::HardwareIdentifier(sconfig.ecu_hardware_id), opcua_server_url}); - } - } else { - LOG_INFO << "OPC-UA discover secondary: unsupported response from " << ep.address; - } - } - } - } - auto ep_it = discovered_end_points_cache_.find(DiscoveredEndPointCacheEntry{ - Uptane::EcuSerial(sconfig.ecu_serial), Uptane::HardwareIdentifier(sconfig.ecu_hardware_id), std::string()}); - if (ep_it != discovered_end_points_cache_.end()) { - url_ = ep_it->opcua_server_url; - } -} - -bool SelectEndPoint::endPointConfirmed(const std::string& opcua_server_url, - const Uptane::SecondaryConfig& sconfig) const { - auto probe_opcua_server_config = Client(opcua_server_url).recvConfiguration(); - return (probe_opcua_server_config.getSerial() == Uptane::EcuSerial(sconfig.ecu_serial) && - probe_opcua_server_config.getHwId() == Uptane::HardwareIdentifier(sconfig.ecu_hardware_id)); -} - -std::string SelectEndPoint::makeOpcuaServerUri(const std::string& address) const { - return "opc.tcp://[" + address + "]:" + std::to_string(OPCUABRIDGE_PORT); -} - -void SelectEndPoint::considerLdsRegisteredEndPoints(const std::string& opcua_lds_url) { - UA_ApplicationDescription* applicationDescriptionArray = nullptr; - size_t applicationDescriptionArraySize = 0; - - UA_StatusCode retval; - { - UA_ClientConfig config = UA_ClientConfig_default; - config.timeout = OPCUABRIDGE_CLIENT_SYNC_RESPONSE_TIMEOUT_MS; - config.logger = &opcuabridge::BoostLogOpcua; - - UA_Client* client = UA_Client_new(config); - retval = UA_Client_findServers(client, opcua_lds_url.c_str(), 0, nullptr, 0, nullptr, - &applicationDescriptionArraySize, &applicationDescriptionArray); - UA_Client_delete(client); - } - - if (retval != UA_STATUSCODE_GOOD) { - LOG_ERROR << "OPC-UA LDS dicovery request: unable to get registered servers on " << opcua_lds_url; - return; - } - - for (size_t i = 0; i < applicationDescriptionArraySize; i++) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - UA_ApplicationDescription* description = &applicationDescriptionArray[i]; - if (description->applicationType != UA_APPLICATIONTYPE_SERVER) { - continue; - } - if (description->discoveryUrlsSize == 0) { - LOG_INFO << "OPC-UA server " << std::string(reinterpret_cast(description->applicationUri.data), - description->applicationUri.length) - << " does not provide any discovery urls"; - continue; - } - - UA_ClientConfig config = UA_ClientConfig_default; - config.timeout = OPCUABRIDGE_CLIENT_SYNC_RESPONSE_TIMEOUT_MS; - config.logger = &opcuabridge::BoostLogOpcua; - UA_Client* client = UA_Client_new(config); - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - std::string discovery_url(reinterpret_cast(description->discoveryUrls[0].data), - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - description->discoveryUrls[0].length); - - UA_EndpointDescription* endpointArray = nullptr; - size_t endpointArraySize = 0; - retval = UA_Client_getEndpoints(client, discovery_url.c_str(), &endpointArraySize, &endpointArray); - - if (retval != UA_STATUSCODE_GOOD) { - UA_Client_disconnect(client); - UA_Client_delete(client); - break; - } - - for (size_t j = 0; j < endpointArraySize; j++) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - UA_EndpointDescription* endpoint = &endpointArray[j]; - std::string opcua_server_url = - std::string(reinterpret_cast(endpoint->endpointUrl.data), endpoint->endpointUrl.length); - auto opcua_server_config = Client(opcua_server_url).recvConfiguration(); - discovered_end_points_cache_.insert(DiscoveredEndPointCacheEntry{ - opcua_server_config.getSerial(), opcua_server_config.getHwId(), opcua_server_url}); - } - UA_Array_delete(endpointArray, endpointArraySize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); - UA_Client_delete(client); - } - UA_Array_delete(applicationDescriptionArray, applicationDescriptionArraySize, - &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION]); -} - -Client::Client(const SelectEndPoint& selector) noexcept : Client(selector.getUrl()) {} - -Client::Client(const std::string& url) noexcept { - UA_ClientConfig config = UA_ClientConfig_default; - config.timeout = OPCUABRIDGE_CLIENT_SYNC_RESPONSE_TIMEOUT_MS; - config.logger = &opcuabridge::BoostLogOpcua; - client_ = UA_Client_new(config); - UA_Client_connect(client_, url.c_str()); -} - -Client::~Client() { - UA_Client_disconnect(client_); - UA_Client_delete(client_); -} - -Client::operator bool() const { return (UA_Client_getState(client_) != UA_CLIENTSTATE_DISCONNECTED); } - -Configuration Client::recvConfiguration() const { - Configuration configuration; - if (UA_Client_getState(client_) != UA_CLIENTSTATE_DISCONNECTED) { - configuration.ClientRead(client_); - } - return configuration; -} - -VersionReport Client::recvVersionReport() const { - VersionReport version_report; - if (UA_Client_getState(client_) != UA_CLIENTSTATE_DISCONNECTED) { - version_report.ClientRead(client_); - } - return version_report; -} - -OriginalManifest Client::recvOriginalManifest() const { - OriginalManifest original_manifest; - if (UA_Client_getState(client_) != UA_CLIENTSTATE_DISCONNECTED) { - original_manifest.ClientRead(client_); - } - return original_manifest; -} - -bool Client::sendMetadataFiles(std::vector& files) const { - MetadataFiles metadatafiles; - bool retval = true; - if (UA_Client_getState(client_) != UA_CLIENTSTATE_DISCONNECTED) { - std::random_device rd; - std::mt19937 gen(rd()); - std::uniform_int_distribution<> dis(1, INT_MAX); - metadatafiles.setGUID(dis(gen)); - metadatafiles.setNumberOfMetadataFiles(files.size()); - metadatafiles.ClientWrite(client_); - - for (auto f_it = files.begin(); f_it != files.end(); ++f_it) { - f_it->setGUID(metadatafiles.getGUID()); - if (UA_STATUSCODE_GOOD != f_it->ClientWrite(client_)) { - retval = false; - break; - } - } - } - if (!retval && UA_Client_getState(client_) != UA_CLIENTSTATE_DISCONNECTED) { - metadatafiles.setNumberOfMetadataFiles(0); // signal cancel to secondary - metadatafiles.ClientWrite(client_); - } - return retval; -} - -bool Client::syncDirectoryFiles(const fs::path& repo_dir) const { - if (UA_Client_getState(client_) == UA_CLIENTSTATE_DISCONNECTED) { - return false; - } - - opcuabridge::FileList file_list; - opcuabridge::FileData file_data(repo_dir); - - if (UA_STATUSCODE_GOOD != file_list.ClientRead(client_)) { - return false; - } - - opcuabridge::FileUnorderedSet file_unordered_set; - opcuabridge::UpdateFileUnorderedSet(&file_unordered_set, file_list); - - bool retval = true; - fs::recursive_directory_iterator repo_dir_it_end, repo_dir_it(repo_dir); - for (; repo_dir_it != repo_dir_it_end; ++repo_dir_it) { - const fs::path& ent_path = repo_dir_it->path(); - if (fs::is_regular_file(ent_path)) { - fs::path rel_path = fs::relative(ent_path, repo_dir); - if (file_unordered_set.count(reinterpret_cast(rel_path.c_str())) == 0) { - file_data.setFilePath(rel_path); - if (UA_STATUSCODE_GOOD != file_data.ClientWriteFile(client_, ent_path)) { - retval = false; - break; - } - } - } - } - file_list.getBlock().resize(1); - file_list.getBlock()[0] = '\0'; - return ((UA_STATUSCODE_GOOD == file_list.ClientWrite(client_)) && retval); -} - -} // namespace opcuabridge diff --git a/src/libaktualizr/opcuabridge/opcuabridgeclient.h b/src/libaktualizr/opcuabridge/opcuabridgeclient.h deleted file mode 100644 index 85ab0c1db3..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridgeclient.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef OPCUABRIDGE_CLIENT_H_ -#define OPCUABRIDGE_CLIENT_H_ - -#include - -#include "opcuabridge.h" - -struct UA_Client; - -namespace boost { -namespace filesystem { -class path; -} // namespace filesystem -} // namespace boost - -namespace Uptane { -class SecondaryConfig; -} // namespace Uptane - -namespace opcuabridge { - -class SelectEndPoint { - public: - explicit SelectEndPoint(const Uptane::SecondaryConfig& /*sconfig*/); - - const std::string& getUrl() const { return url_; } - - private: - struct DiscoveredEndPointCacheEntry { - Uptane::EcuSerial serial; - Uptane::HardwareIdentifier hwid; - std::string opcua_server_url; - }; - - struct DiscoveredEndPointCacheEntryHash { - typedef DiscoveredEndPointCacheEntry argument_type; - typedef std::size_t result_type; - - result_type operator()(argument_type const& e) const; - }; - - struct DiscoveredEndPointCacheEntryEqual { - typedef DiscoveredEndPointCacheEntry argument_type; - - bool operator()(const argument_type& lhs, const argument_type& rhs) const; - }; - - typedef std::unordered_set - DiscoveredEndPointCache; - - bool endPointConfirmed(const std::string& opcua_server_url, const Uptane::SecondaryConfig& /*sconfig*/) const; - std::string makeOpcuaServerUri(const std::string& address) const; - void considerLdsRegisteredEndPoints(const std::string& opcua_lds_url); - - thread_local static DiscoveredEndPointCache discovered_end_points_cache_; - - std::string url_; -}; - -class Client { - public: - explicit Client(const SelectEndPoint& /*selector*/) noexcept; - explicit Client(const std::string& url) noexcept; - ~Client(); - - Client(const Client&) = delete; - Client& operator=(const Client&) = delete; - - explicit operator bool() const; - - Configuration recvConfiguration() const; - VersionReport recvVersionReport() const; - OriginalManifest recvOriginalManifest() const; - bool sendMetadataFiles(std::vector& /*files*/) const; - bool syncDirectoryFiles(const boost::filesystem::path& /*repo_dir*/) const; - - private: - UA_Client* client_; -}; - -} // namespace opcuabridge - -#endif // OPCUABRIDGE_CLIENT_H_ diff --git a/src/libaktualizr/opcuabridge/opcuabridgeconfig.h b/src/libaktualizr/opcuabridge/opcuabridgeconfig.h deleted file mode 100644 index 26f7c3e822..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridgeconfig.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef OPCUABRIDGE_CONFIG_H_ -#define OPCUABRIDGE_CONFIG_H_ - -#define OPCUA_DISCOVERY_SERVICE_PORT (9031) -#define OPCUA_DISCOVERY_SERVICE_ATTEMPTS (32) -#define OPCUA_DISCOVERY_SERVICE_DATASIZE (16) -#define OPCUA_DISCOVERY_SERVICE_TIMEOUT_SEC (5) -#define OPCUA_DISCOVERY_SERVICE_MULTICAST_ADDR "ff02::1" - -#define OPCUA_DISCOVERY_SERVICE_REQUEST \ - { 0xfd, 0xe7, 0x43, 0xa4, 0xbf, 0x7b, 0x44, 0xa3, 0x94, 0x6b, 0x4b, 0x1f, 0xaf, 0x59, 0x1a, 0x68 } -#define OPCUA_DISCOVERY_SERVICE_RESPONSE \ - { 0x95, 0x91, 0xa5, 0xff, 0xec, 0x50, 0x47, 0xe1, 0x9e, 0x74, 0xf8, 0x23, 0x66, 0xa1, 0xad, 0xcd } -#define OPCUA_DISCOVERY_SERVICE_LDS_RESPONSE \ - { 0xe7, 0x99, 0xab, 0xa7, 0xa9, 0x1e, 0x40, 0xc4, 0xb5, 0x70, 0xce, 0xec, 0x70, 0x5c, 0x0d, 0x3c } - -#define OPCUABRIDGE_PORT (9030) -#define OPCUABRIDGE_CLIENT_SYNC_RESPONSE_TIMEOUT_MS (5000) -#define OPCUABRIDGE_FILEDATA_WRITE_BLOCK_SIZE (8192) - -#endif // OPCUABRIDGE_CONFIG_H_ diff --git a/src/libaktualizr/opcuabridge/opcuabridgediscoveryclient.cc b/src/libaktualizr/opcuabridge/opcuabridgediscoveryclient.cc deleted file mode 100644 index 8c7a577263..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridgediscoveryclient.cc +++ /dev/null @@ -1,103 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include - -#include "logging/logging.h" - -#include "opcuabridgediscoveryclient.h" - -using boost::phoenix::arg_names::arg1; -using boost::phoenix::arg_names::arg2; - -namespace ba = boost::asio; -namespace phoenix = boost::phoenix; - -namespace opcuabridge { -namespace discovery { - -Client::endpoints_list_type Client::getDiscoveredEndPoints() { - endpoints_list_type discovered_endpoints_list; - struct ifaddrs *ifaddr = nullptr, *ifa; - - BOOST_SCOPE_EXIT(&ifaddr) { // NOLINT - if (ifaddr != nullptr) { - freeifaddrs(ifaddr); - } - } - BOOST_SCOPE_EXIT_END - - if (getifaddrs(&ifaddr) == -1) { - LOG_ERROR << "OPC-UA discovery client: unable to get available network interfaces"; - return discovered_endpoints_list; - } - std::size_t i = 0; - char addr[NI_MAXHOST]; - for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next, ++i) { - if (ifa->ifa_addr != nullptr && ifa->ifa_addr->sa_family == AF_INET6 && - 0 == getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), addr, NI_MAXHOST, nullptr, 0, NI_NUMERICHOST) && - !ba::ip::address_v6::from_string(addr).is_loopback()) { - collectDiscoveredEndPointsOnIface(if_nametoindex(ifa->ifa_name)); - } - } - for (const auto& ep : discovered_endpoints_) { - discovered_endpoints_list.push_back(discovered_endpoint{ep.first, ep.second}); - } - return discovered_endpoints_list; -} - -void Client::collectDiscoveredEndPointsOnIface(unsigned int iface) { - try { - ba::io_service io_service; - - ba::ip::udp::endpoint ep(ba::ip::address_v6::from_string(OPCUA_DISCOVERY_SERVICE_MULTICAST_ADDR), port_); - - ba::ip::udp::socket s(io_service); - s.open(ba::ip::udp::v6()); - - s.set_option(ba::ip::multicast::outbound_interface(iface)); - - boost::system::error_code error_code; - - bool discovery_timeout_expired = false; - ba::deadline_timer timer(io_service); - timer.expires_from_now(boost::posix_time::seconds(OPCUA_DISCOVERY_SERVICE_TIMEOUT_SEC)); - - timer.async_wait((phoenix::ref(error_code) = arg1, phoenix::ref(discovery_timeout_expired) = true)); - - std::size_t bytes_transferred; - int request_attempts_count = OPCUA_DISCOVERY_SERVICE_ATTEMPTS; - discovery_service_data_type request = OPCUA_DISCOVERY_SERVICE_REQUEST, response; - while (!discovery_timeout_expired) { - if (--request_attempts_count >= 0) { - s.send_to(ba::buffer(request), ep); - } - - ba::ip::udp::endpoint discovered_ep; - error_code = ba::error::would_block; - s.async_receive_from(ba::buffer(response), discovered_ep, - (phoenix::ref(error_code) = arg1, phoenix::ref(bytes_transferred) = arg2)); - do { - io_service.run_one(); - } while (!discovery_timeout_expired && error_code == ba::error::would_block); - std::string discovered_ep_address = discovered_ep.address().to_string(); - if (error_code != boost::system::errc::success) { - throw boost::system::system_error(error_code); - } - if (!discovery_timeout_expired && discovered_endpoints_.count(discovered_ep_address) == 0) { - EndPointServiceType type = - (response == no_lds_response_ ? kNoLDS : response == lds_response_ ? kLDS : kUnknown); - discovered_endpoints_.insert(std::make_pair(discovered_ep_address, type)); - } - } - } catch (std::exception& ex) { - LOG_ERROR << "OPC-UA discovery client: " << ex.what(); - } -} - -} // namespace discovery -} // namespace opcuabridge diff --git a/src/libaktualizr/opcuabridge/opcuabridgediscoveryclient.h b/src/libaktualizr/opcuabridge/opcuabridgediscoveryclient.h deleted file mode 100644 index add1a08693..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridgediscoveryclient.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef OPCUABRIDGE_DISCOVERYCLIENT_H_ -#define OPCUABRIDGE_DISCOVERYCLIENT_H_ - -#include -#include -#include - -#include "opcuabridgeconfig.h" -#include "opcuabridgediscoverytypes.h" - -namespace opcuabridge { -namespace discovery { - -class Client { - public: - explicit Client(uint16_t port) : port_(port) {} - - struct discovered_endpoint { - std::string address; - EndPointServiceType type; - }; - typedef std::list endpoints_list_type; - - endpoints_list_type getDiscoveredEndPoints(); - - private: - void collectDiscoveredEndPointsOnIface(unsigned int /*iface*/); - - std::unordered_map discovered_endpoints_; - - const discovery_service_data_type lds_response_ = OPCUA_DISCOVERY_SERVICE_LDS_RESPONSE, - no_lds_response_ = OPCUA_DISCOVERY_SERVICE_RESPONSE; - - uint16_t port_; -}; - -} // namespace discovery -} // namespace opcuabridge - -#endif // OPCUABRIDGE_DISCOVERYCLIENT_H_ diff --git a/src/libaktualizr/opcuabridge/opcuabridgediscoveryserver.cc b/src/libaktualizr/opcuabridge/opcuabridgediscoveryserver.cc deleted file mode 100644 index 7d34a639c3..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridgediscoveryserver.cc +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -#include - -#include "logging/logging.h" - -#include "opcuabridgediscoveryserver.h" - -namespace ba = boost::asio; - -namespace opcuabridge { -namespace discovery { - -Server::Server(EndPointServiceType type, uint16_t port) : socket_(io_service_) { - ba::ip::udp::endpoint listen_endpoint(ba::ip::address_v6::any(), port); - socket_.open(listen_endpoint.protocol()); - socket_.set_option(ba::ip::udp::socket::reuse_address(true)); - socket_.bind(listen_endpoint); - init(type); -} - -Server::Server(EndPointServiceType type, int socket_fd, uint16_t port) : socket_(io_service_) { - socket_.assign(ba::ip::udp::v6(), socket_fd); - init(type); -} - -void Server::init(EndPointServiceType type) { - socket_.set_option( - ba::ip::multicast::join_group(ba::ip::address_v6::from_string(OPCUA_DISCOVERY_SERVICE_MULTICAST_ADDR))); - - response_ = (type == kNoLDS ? no_lds_response_ : type == kLDS ? lds_response_ : discovery_service_data_type()); -} - -bool Server::run(const volatile bool* running) { - try { - while (running != nullptr) { - discovery_service_data_type data; - ba::ip::udp::endpoint sender_endpoint; - socket_.receive_from(ba::buffer(data), sender_endpoint); - socket_.send_to(ba::buffer(response_), sender_endpoint); - } - } catch (std::exception& ex) { - LOG_ERROR << "OPC-UA discovery server: " << ex.what(); - return false; - } - return true; -} - -} // namespace discovery -} // namespace opcuabridge diff --git a/src/libaktualizr/opcuabridge/opcuabridgediscoveryserver.h b/src/libaktualizr/opcuabridge/opcuabridgediscoveryserver.h deleted file mode 100644 index d568415631..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridgediscoveryserver.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef OPCUABRIDGE_DISCOVERYSERVER_H_ -#define OPCUABRIDGE_DISCOVERYSERVER_H_ - -#include - -#include "opcuabridgeconfig.h" -#include "opcuabridgediscoverytypes.h" - -namespace opcuabridge { -namespace discovery { - -class Server { - public: - Server(EndPointServiceType type, uint16_t port); - Server(EndPointServiceType type, int socket_fd, uint16_t port); - - Server(const Server&) = delete; - Server& operator=(const Server&) = delete; - - bool run(const volatile bool* /*running*/); - - private: - void init(EndPointServiceType /*type*/); - - boost::asio::io_service io_service_; - boost::asio::ip::udp::socket socket_; - discovery_service_data_type response_{}; - - const discovery_service_data_type lds_response_ = OPCUA_DISCOVERY_SERVICE_LDS_RESPONSE, - no_lds_response_ = OPCUA_DISCOVERY_SERVICE_RESPONSE; -}; - -} // namespace discovery -} // namespace opcuabridge - -#endif // OPCUABRIDGE_DISCOVERYSERVER_H_ diff --git a/src/libaktualizr/opcuabridge/opcuabridgediscoverytypes.h b/src/libaktualizr/opcuabridge/opcuabridgediscoverytypes.h deleted file mode 100644 index 4103e77996..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridgediscoverytypes.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef OPCUABRIDGE_DISCOVERYTYPES_H_ -#define OPCUABRIDGE_DISCOVERYTYPES_H_ - -#include - -#include "opcuabridgeconfig.h" - -namespace opcuabridge { -namespace discovery { - -typedef std::array discovery_service_data_type; - -enum EndPointServiceType { kUnknown, kNoLDS, kLDS }; - -} // namespace discovery -} // namespace opcuabridge - -#endif // OPCUABRIDGE_DISCOVERYTYPES_H_ diff --git a/src/libaktualizr/opcuabridge/opcuabridgeserver.cc b/src/libaktualizr/opcuabridge/opcuabridgeserver.cc deleted file mode 100644 index 28400fd342..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridgeserver.cc +++ /dev/null @@ -1,133 +0,0 @@ -#include "opcuabridgeserver.h" -#include "opcuabridgediscoveryserver.h" - -#include - -#include -#include "utilities/utils.h" - -#include -#include -#include - -#include -#include - -namespace opcuabridge { - -ServerModel::ServerModel(UA_Server* server) { -#define INIT_SERVER_NODESET(r, SERVER, e) e.InitServerNodeset(SERVER); - - BOOST_PP_LIST_FOR_EACH(INIT_SERVER_NODESET, server, - BOOST_PP_ARRAY_TO_LIST((6, (configuration_, version_report_, metadatafiles_, metadatafile_, - file_list_, file_data_, original_manifest_)))); -} - -Server::Server(ServerDelegate* delegate, uint16_t port) : delegate_(delegate) { - server_config_ = UA_ServerConfig_new_minimal(port, nullptr); - server_config_->logger = &opcuabridge::BoostLogOpcua; - - server_ = UA_Server_new(server_config_); - - initializeModel(); - - if (delegate_ != nullptr) { - delegate_->handleServerInitialized(model_); - } -} - -Server::Server(ServerDelegate* delegate, int socket_fd, int discovery_socket_fd, uint16_t port) : delegate_(delegate) { - server_config_ = UA_ServerConfig_new_minimal(port, nullptr); - server_config_->logger = &opcuabridge::BoostLogOpcua; - - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - server_config_->networkLayers[0].deleteMembers(&server_config_->networkLayers[0]); - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - server_config_->networkLayers[0] = UA_ServerNetworkLayerTCPSocketActivation(UA_ConnectionConfig_default, socket_fd); - server_config_->networkLayersSize = 1; - - discovery_socket_fd_ = discovery_socket_fd; - use_socket_activation_ = true; - - server_ = UA_Server_new(server_config_); - - initializeModel(); - - if (delegate_ != nullptr) { - delegate_->handleServerInitialized(model_); - } -} - -void Server::initializeModel() { - using std::placeholders::_1; - - model_ = new ServerModel(server_); - - model_->file_list_.setOnBeforeReadCallback(std::bind(&Server::onFileListRequested, this, _1)); - model_->file_list_.setOnAfterWriteCallback(std::bind(&Server::onFileListUpdated, this, _1)); - model_->metadatafile_.setOnAfterWriteCallback(std::bind(&Server::countReceivedMetadataFile, this, _1)); - model_->version_report_.setOnBeforeReadCallback(std::bind(&Server::onVersionReportRequested, this, _1)); - model_->original_manifest_.setOnBeforeReadCallback(std::bind(&Server::onOriginalManifestRequested, this, _1)); -} - -Server::~Server() { - delete model_; - UA_Server_delete(server_); - UA_ServerConfig_delete(server_config_); -} - -bool Server::run(volatile bool* running) { - boost::scoped_thread discovery( - [](bool use_socket_activation, int socket_fd, volatile bool* server_running, ServerDelegate* delegate) { - std::unique_ptr discovery_server; - if (use_socket_activation) { - discovery_server = boost::make_unique(delegate->getServiceType(), socket_fd, - delegate->getDiscoveryPort()); - } else { - discovery_server = - boost::make_unique(delegate->getServiceType(), delegate->getDiscoveryPort()); - } - discovery_server->run(server_running); - }, - use_socket_activation_, discovery_socket_fd_, running, delegate_); - return (UA_STATUSCODE_GOOD == UA_Server_run(server_, running)); -} - -void Server::onVersionReportRequested(VersionReport* version_report) { - if (delegate_ != nullptr) { - delegate_->handleVersionReportRequested(model_); - } -} - -void Server::onOriginalManifestRequested(OriginalManifest* version_report) { - if (delegate_ != nullptr) { - delegate_->handleOriginalManifestRequested(model_); - } -} - -void Server::onFileListRequested(FileList* file_list) { - if (delegate_ != nullptr) { - delegate_->handleDirectoryFileListRequested(model_); - } -} - -void Server::onFileListUpdated(FileList* file_list) { - if (!file_list->getBlock().empty() && file_list->getBlock()[0] == '\0' && (delegate_ != nullptr)) { - delegate_->handleDirectoryFilesSynchronized(model_); - } -} - -void Server::countReceivedMetadataFile(MetadataFile* metadata_file) { - if (model_->metadatafiles_.getGUID() == metadata_file->getGUID()) { - ++model_->received_metadata_files_; - if (delegate_ != nullptr) { - delegate_->handleMetaDataFileReceived(model_); - } - } - if (model_->metadatafiles_.getNumberOfMetadataFiles() == model_->received_metadata_files_ && (delegate_ != nullptr)) { - model_->received_metadata_files_ = 0; - delegate_->handleAllMetaDataFilesReceived(model_); - } -} - -} // namespace opcuabridge diff --git a/src/libaktualizr/opcuabridge/opcuabridgeserver.h b/src/libaktualizr/opcuabridge/opcuabridgeserver.h deleted file mode 100644 index af2c2f533a..0000000000 --- a/src/libaktualizr/opcuabridge/opcuabridgeserver.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef OPCUABRIDGE_SERVER_H_ -#define OPCUABRIDGE_SERVER_H_ - -#include "opcuabridge.h" -#include "opcuabridgeconfig.h" -#include "opcuabridgediscoverytypes.h" - -namespace opcuabridge { - -class Server; - -struct ServerModel { - explicit ServerModel(UA_Server* /*server*/); - - Configuration configuration_; - - VersionReport version_report_; - - MetadataFiles metadatafiles_; - MetadataFile metadatafile_; - - FileList file_list_; - FileData file_data_; - - OriginalManifest original_manifest_; - - friend class Server; - - private: - std::size_t received_metadata_files_ = 0; -}; - -class ServerDelegate { - public: - void setServiceType(discovery::EndPointServiceType service_type) { service_type_ = service_type; } - const discovery::EndPointServiceType& getServiceType() const { return service_type_; } - - void setDiscoveryPort(uint16_t discovery_port) { discovery_port_ = discovery_port; } - const uint16_t& getDiscoveryPort() const { return discovery_port_; } - - virtual ~ServerDelegate() = default; - virtual void handleServerInitialized(ServerModel*) = 0; - virtual void handleVersionReportRequested(ServerModel*) = 0; // on version report is requested - virtual void handleOriginalManifestRequested(ServerModel*) = 0; // on original manifest is requested - virtual void handleMetaDataFileReceived(ServerModel*) = 0; // on after each metadata file recv. - virtual void handleAllMetaDataFilesReceived(ServerModel*) = 0; // after all metadata files recv. - virtual void handleDirectoryFilesSynchronized(ServerModel*) = 0; // when dir. sync. finished - virtual void handleDirectoryFileListRequested(ServerModel*) = 0; // on dir. file list is requested - - private: - discovery::EndPointServiceType service_type_ = discovery::kNoLDS; - uint16_t discovery_port_ = OPCUA_DISCOVERY_SERVICE_PORT; -}; - -class Server { - public: - explicit Server(ServerDelegate* /*delegate*/, uint16_t port = OPCUABRIDGE_PORT); - Server(ServerDelegate* delegate, int socket_fd, int discovery_socket_fd, uint16_t port = OPCUABRIDGE_PORT); - ~Server(); - - Server(const Server&) = delete; - Server& operator=(const Server&) = delete; - - bool run(volatile bool* /*running*/); - - private: - void initializeModel(); - void onFileListUpdated(FileList* /*file_list*/); - void onFileListRequested(FileList* /*file_list*/); - void countReceivedMetadataFile(MetadataFile* /*metadata_file*/); - void onVersionReportRequested(VersionReport* /*version_report*/); - void onOriginalManifestRequested(OriginalManifest* /*version_report*/); - - ServerModel* model_{}; - - ServerDelegate* delegate_; - - UA_Server* server_; - UA_ServerConfig* server_config_; - - int discovery_socket_fd_{}; - bool use_socket_activation_ = false; -}; - -} // namespace opcuabridge - -#endif // OPCUABRIDGE_SERVER_H_ diff --git a/src/libaktualizr/opcuabridge/originalmanifest.h b/src/libaktualizr/opcuabridge/originalmanifest.h deleted file mode 100644 index f3bcd064e4..0000000000 --- a/src/libaktualizr/opcuabridge/originalmanifest.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef OPCUABRIDGE_ORIGINALMANIFEST_H_ -#define OPCUABRIDGE_ORIGINALMANIFEST_H_ - -#include - -#include "common.h" - -namespace opcuabridge { -class OriginalManifest { - public: - typedef BinaryDataType block_type; - - OriginalManifest() = default; - virtual ~OriginalManifest() = default; - - block_type& getBlock() { return block_; } - const block_type& getBlock() const { return block_; } - void setBlock(const block_type& block) { block_ = block; } - INITSERVERNODESET_BIN_FUNCTION_DEFINITION(OriginalManifest, &block_) // InitServerNodeset(UA_Server*) - CLIENTREAD_BIN_FUNCTION_DEFINITION(&block_) // ClientRead(UA_Client*) - CLIENTWRITE_BIN_FUNCTION_DEFINITION(&block_) // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { - on_before_read_cb_ = std::move(cb); - } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { - on_after_write_cb_ = std::move(cb); - } - - protected: - block_type block_; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - static const char* bin_node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - return v; - } - void unwrapMessage(const Json::Value& v) {} - - WRAPMESSAGE_FUCTION_DEFINITION(OriginalManifest) - UNWRAPMESSAGE_FUCTION_DEFINITION(OriginalManifest) - READ_FUNCTION_FRIEND_DECLARATION(OriginalManifest) - WRITE_FUNCTION_FRIEND_DECLARATION(OriginalManifest) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(OriginalManifest) - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { SERIALIZE_FIELD(ar, "block_", block_); } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_ORIGINALMANIFEST_H_ diff --git a/src/libaktualizr/opcuabridge/run_opcuabridge_ostree_repo_sync_test.sh b/src/libaktualizr/opcuabridge/run_opcuabridge_ostree_repo_sync_test.sh deleted file mode 100755 index 9602aaad37..0000000000 --- a/src/libaktualizr/opcuabridge/run_opcuabridge_ostree_repo_sync_test.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash -set -e - -BIN_DIR=$1 -SOURCE_TESTS_DIR=$2 -VALGRIND=${3:-} # $3 can be set to 'valgrind' (or the run-valgrind wrapper) -ORIG_REPO=$SOURCE_TESTS_DIR/sota_tools/repo - -TEST_SRC_REPO=$(mktemp -d) -TEST_DST_REPO=$(mktemp -d) -TEST_REF=master - -cp -R $ORIG_REPO/* $TEST_SRC_REPO -ostree show --repo=$TEST_SRC_REPO $TEST_REF > $TEST_SRC_REPO/__ostree_show_$TEST_REF -ostree init --mode=bare --repo=$TEST_DST_REPO - -PORT=`$SOURCE_TESTS_DIR/get_open_port.py` - -$VALGRIND $BIN_DIR/opcuabridge-ostree-repo-sync-server $TEST_DST_REPO $PORT & -sleep 3 -trap 'kill %1' EXIT - -$VALGRIND $BIN_DIR/opcuabridge-ostree-repo-sync-client $TEST_SRC_REPO $PORT - -ostree show --repo=$TEST_DST_REPO $TEST_REF > $TEST_DST_REPO/__ostree_show_$TEST_REF -diff $TEST_SRC_REPO/__ostree_show_$TEST_REF $TEST_DST_REPO/__ostree_show_$TEST_REF - -RET=$? -kill %1 - -rm -rf $TEST_SRC_REPO -rm -rf $TEST_DST_REPO - -exit ${RET} diff --git a/src/libaktualizr/opcuabridge/signature.h b/src/libaktualizr/opcuabridge/signature.h deleted file mode 100644 index d9caeeb61b..0000000000 --- a/src/libaktualizr/opcuabridge/signature.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef OPCUABRIDGE_SIGNATURE_H_ -#define OPCUABRIDGE_SIGNATURE_H_ - -#include "hash.h" - -#include "common.h" - -namespace opcuabridge { -class Signature { - public: - Signature() = default; - virtual ~Signature() = default; - - const std::string& getKeyid() const { return keyid_; } - void setKeyid(const std::string& keyid) { keyid_ = keyid; } - const SignatureMethod& getMethod() const { return method_; } - void setMethod(const SignatureMethod& method) { method_ = method; } - const Hash& getHash() const { return hash_; } - void setHash(const Hash& hash) { hash_ = hash; } - const std::string& getValue() const { return value_; } - void setValue(const std::string& value) { value_ = value; } - - Json::Value wrapMessage() const { - Json::Value v; - v["keyid"] = getKeyid(); - v["method"] = static_cast(getMethod()); - v["hash"] = getHash().wrapMessage(); - v["sig"] = getValue(); - return v; - } - void unwrapMessage(Json::Value v) { - setKeyid(v["keyid"].asString()); - setMethod(static_cast(v["method"].asInt())); - Hash h; - h.unwrapMessage(v["hash"]); - setHash(h); - setValue(v["sig"].asString()); - } - - protected: - std::string keyid_; - SignatureMethod method_{}; - Hash hash_; - std::string value_; - - private: -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "keyid_", keyid_); - SERIALIZE_FIELD(ar, "method_", method_); - SERIALIZE_FIELD(ar, "hash_", hash_); - SERIALIZE_FIELD(ar, "value_", value_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_SIGNATURE_H_ diff --git a/src/libaktualizr/opcuabridge/signed.h b/src/libaktualizr/opcuabridge/signed.h deleted file mode 100644 index 3d3dceeaa6..0000000000 --- a/src/libaktualizr/opcuabridge/signed.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef OPCUABRIDGE_SIGNED_H_ -#define OPCUABRIDGE_SIGNED_H_ - -#include "common.h" - -namespace opcuabridge { -class Signed { - public: - Signed() = default; - virtual ~Signed() = default; - - const std::vector& getTokens() const { return tokens_; } - void setTokens(const std::vector& tokens) { tokens_ = tokens; } - const int& getTimestamp() const { return timestamp_; } - void setTimestamp(const int& timestamp) { timestamp_ = timestamp; } - - Json::Value wrapMessage() const { - Json::Value v; - v["tokens"] = convert_to::jsonArray(getTokens()); - v["timestamp"] = getTimestamp(); - return v; - } - void unwrapMessage(Json::Value v) { - setTokens(convert_to::stdVector(v["tokens"])); - setTimestamp(v["timestamp"].asInt()); - } - - protected: - std::vector tokens_; - int timestamp_{}; - - private: -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "tokens_", tokens_); - SERIALIZE_FIELD(ar, "timestamp_", timestamp_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_SIGNED_H_ diff --git a/src/libaktualizr/opcuabridge/utility.h b/src/libaktualizr/opcuabridge/utility.h deleted file mode 100644 index f6bcd3b563..0000000000 --- a/src/libaktualizr/opcuabridge/utility.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef OPCUABRIDGE_UTILITY_H_ -#define OPCUABRIDGE_UTILITY_H_ - -namespace opcuabridge { -namespace utility { - -template -struct serialize_field {}; - -// clang-format off -#define SERIALIZE_FIELD_DECL_BEGIN(STREAM) \ - template \ - struct serialize_field { \ - void operator()(STREAM &ar, const std::string &xml_tag, T &d) - -#define SERIALIZE_FIELD_DECL_END \ - }; -//clang-format on - -SERIALIZE_FIELD_DECL_BEGIN(DATA_SERIALIZATION_OUT_XML_STREAM) { - ar &boost::serialization::make_nvp(xml_tag.c_str(), d); -} -SERIALIZE_FIELD_DECL_END - -SERIALIZE_FIELD_DECL_BEGIN(DATA_SERIALIZATION_IN_XML_STREAM) { ar &boost::serialization::make_nvp(xml_tag.c_str(), d); } -SERIALIZE_FIELD_DECL_END - -SERIALIZE_FIELD_DECL_BEGIN(DATA_SERIALIZATION_OUT_BIN_STREAM) { ar &d; } -SERIALIZE_FIELD_DECL_END - -SERIALIZE_FIELD_DECL_BEGIN(DATA_SERIALIZATION_IN_BIN_STREAM) { ar &d; } -SERIALIZE_FIELD_DECL_END - -SERIALIZE_FIELD_DECL_BEGIN(DATA_SERIALIZATION_OUT_TEXT_STREAM) { ar &d; } -SERIALIZE_FIELD_DECL_END - -SERIALIZE_FIELD_DECL_BEGIN(DATA_SERIALIZATION_IN_TEXT_STREAM) { ar &d; } -SERIALIZE_FIELD_DECL_END - -#undef SERIALIZE_FIELD_DECL_BEGIN -#undef SERIALIZE_FIELD_DECL_END - -template -inline serialize_field make_serialize_field(A &ar, T &d) { - return serialize_field(); -} - -} // namespace utility -} // namespace opcuabridge - -#endif // OPCUABRIDGE_UTILITY_H_ diff --git a/src/libaktualizr/opcuabridge/versionreport.h b/src/libaktualizr/opcuabridge/versionreport.h deleted file mode 100644 index 74d6a3e127..0000000000 --- a/src/libaktualizr/opcuabridge/versionreport.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef OPCUABRIDGE_VERSIONREPORT_H_ -#define OPCUABRIDGE_VERSIONREPORT_H_ - -#include - -#include "ecuversionmanifest.h" - -#include "common.h" - -namespace opcuabridge { -class VersionReport { - public: - VersionReport() = default; - virtual ~VersionReport() = default; - - const int& getTokenForTimeServer() const { return tokenForTimeServer_; } - void setTokenForTimeServer(const int& tokenForTimeServer) { tokenForTimeServer_ = tokenForTimeServer; } - ECUVersionManifest& getEcuVersionManifest() { return ecuVersionManifest_; } - const ECUVersionManifest& getEcuVersionManifest() const { return ecuVersionManifest_; } - void setEcuVersionManifest(const ECUVersionManifest& ecuVersionManifest) { ecuVersionManifest_ = ecuVersionManifest; } - INITSERVERNODESET_FUNCTION_DEFINITION(VersionReport) // InitServerNodeset(UA_Server*) - CLIENTREAD_FUNCTION_DEFINITION() // ClientRead(UA_Client*) - CLIENTWRITE_FUNCTION_DEFINITION() // ClientWrite(UA_Client*) - - void setOnBeforeReadCallback(MessageOnBeforeReadCallback::type cb) { - on_before_read_cb_ = std::move(cb); - } - void setOnAfterWriteCallback(MessageOnAfterWriteCallback::type cb) { - on_after_write_cb_ = std::move(cb); - } - - protected: - int tokenForTimeServer_{}; - ECUVersionManifest ecuVersionManifest_; - - MessageOnBeforeReadCallback::type on_before_read_cb_; - MessageOnAfterWriteCallback::type on_after_write_cb_; - - private: - static const char* node_id_; - - Json::Value wrapMessage() const { - Json::Value v; - v["tokenForTimeServer"] = getTokenForTimeServer(); - v["ecuVersionManifest"] = getEcuVersionManifest().wrapMessage(); - return v; - } - void unwrapMessage(Json::Value v) { - setTokenForTimeServer(v["tokenForTimeServer"].asInt()); - ECUVersionManifest vm; - vm.unwrapMessage(v["ecuVersionManifest"]); - setEcuVersionManifest(vm); - } - - WRAPMESSAGE_FUCTION_DEFINITION(VersionReport) - UNWRAPMESSAGE_FUCTION_DEFINITION(VersionReport) - READ_FUNCTION_FRIEND_DECLARATION(VersionReport) - WRITE_FUNCTION_FRIEND_DECLARATION(VersionReport) - INTERNAL_FUNCTIONS_FRIEND_DECLARATION(VersionReport) - -#ifdef OPCUABRIDGE_ENABLE_SERIALIZATION - SERIALIZE_FUNCTION_FRIEND_DECLARATION - - DEFINE_SERIALIZE_METHOD() { - SERIALIZE_FIELD(ar, "tokenForTimeServer_", tokenForTimeServer_); - SERIALIZE_FIELD(ar, "ecuVersionManifest_", ecuVersionManifest_); - } -#endif // OPCUABRIDGE_ENABLE_SERIALIZATION -}; -} // namespace opcuabridge - -#endif // OPCUABRIDGE_VERSIONREPORT_H_ diff --git a/src/libaktualizr/primary/sotauptaneclient.cc b/src/libaktualizr/primary/sotauptaneclient.cc index 5620697164..f1ca47a46e 100644 --- a/src/libaktualizr/primary/sotauptaneclient.cc +++ b/src/libaktualizr/primary/sotauptaneclient.cc @@ -1050,13 +1050,7 @@ std::vector SotaUptaneClient::sendImagesToEcus(const } Uptane::SecondaryInterface &sec = *f->second; - if (sec.sconfig.secondary_type == Uptane::SecondaryType::kOpcuaUptane) { - Json::Value data; - data["sysroot_path"] = config.pacman.sysroot.string(); - data["ref_hash"] = targets_it->sha256Hash(); - firmwareFutures.emplace_back(result::Install::EcuReport(*targets_it, ecu_serial, data::InstallationResult()), - sendFirmwareAsync(sec, std::make_shared(Utils::jsonToStr(data)))); - } else if (targets_it->IsOstree()) { + if (targets_it->IsOstree()) { // empty firmware means OSTree secondaries: pack credentials instead const std::string creds_archive = secondaryTreehubCredentials(); if (creds_archive.empty()) { diff --git a/src/libaktualizr/uptane/CMakeLists.txt b/src/libaktualizr/uptane/CMakeLists.txt index d378b40851..c726f79684 100644 --- a/src/libaktualizr/uptane/CMakeLists.txt +++ b/src/libaktualizr/uptane/CMakeLists.txt @@ -31,11 +31,6 @@ set(HEADERS add_library(uptane OBJECT ${SOURCES}) -if (BUILD_OPCUA) - target_sources(uptane PRIVATE opcuasecondary.cc) - target_include_directories(uptane PRIVATE ${PROJECT_SOURCE_DIR}/third_party/open62541) - set_source_files_properties(opcuasecondary.cc PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter -Wno-float-equal") -endif (BUILD_OPCUA) if (BUILD_ISOTP) target_sources(uptane PRIVATE isotpsecondary.cc) @@ -78,4 +73,4 @@ add_aktualizr_test(NAME uptane_serial SOURCES uptane_serial_test.cc ARGS ${PROJE add_aktualizr_test(NAME uptane_init SOURCES uptane_init_test.cc PROJECT_WORKING_DIRECTORY) -aktualizr_source_file_checks(${SOURCES} ${HEADERS} opcuasecondary.cc opcuasecondary.h isotpsecondary.cc isotpsecondary.h ${TEST_SOURCES}) +aktualizr_source_file_checks(${SOURCES} ${HEADERS} isotpsecondary.cc isotpsecondary.h ${TEST_SOURCES}) diff --git a/src/libaktualizr/uptane/opcuasecondary.cc b/src/libaktualizr/uptane/opcuasecondary.cc deleted file mode 100644 index d01cb2101c..0000000000 --- a/src/libaktualizr/uptane/opcuasecondary.cc +++ /dev/null @@ -1,96 +0,0 @@ -#include "opcuasecondary.h" - -#include "opcuabridge/opcuabridgeclient.h" -#include "secondaryconfig.h" - -#include "logging/logging.h" -#include "package_manager/ostreereposync.h" -#include "utilities/utils.h" - -#include -#include - -#include -#include - -namespace fs = boost::filesystem; - -namespace Uptane { - -OpcuaSecondary::OpcuaSecondary(const SecondaryConfig& sconfig_in) : SecondaryInterface(sconfig_in) {} - -OpcuaSecondary::~OpcuaSecondary() = default; - -Uptane::EcuSerial OpcuaSecondary::getSerial() { - opcuabridge::Client client{opcuabridge::SelectEndPoint(SecondaryInterface::sconfig)}; - return client.recvConfiguration().getSerial(); -} -Uptane::HardwareIdentifier OpcuaSecondary::getHwId() { - opcuabridge::Client client{opcuabridge::SelectEndPoint(SecondaryInterface::sconfig)}; - return Uptane::HardwareIdentifier(client.recvConfiguration().getHwId()); -} -PublicKey OpcuaSecondary::getPublicKey() { - opcuabridge::Client client{opcuabridge::SelectEndPoint(SecondaryInterface::sconfig)}; - return PublicKey(client.recvConfiguration().getPublicKey(), client.recvConfiguration().getPublicKeyType()); -} - -Json::Value OpcuaSecondary::getManifest() { - opcuabridge::Client client{opcuabridge::SelectEndPoint(SecondaryInterface::sconfig)}; - auto original_manifest = client.recvOriginalManifest().getBlock(); - return Utils::parseJSON(std::string(original_manifest.begin(), original_manifest.end())); -} - -bool OpcuaSecondary::putMetadata(const RawMetaPack& meta_pack) { - std::vector metadatafiles; - { - opcuabridge::MetadataFile mf; - mf.setMetadata(meta_pack.director_root); - metadatafiles.push_back(mf); - } - { - opcuabridge::MetadataFile mf; - mf.setMetadata(meta_pack.director_targets); - metadatafiles.push_back(mf); - } - opcuabridge::Client client{opcuabridge::SelectEndPoint(SecondaryInterface::sconfig)}; - return client.sendMetadataFiles(metadatafiles); -} - -bool OpcuaSecondary::sendFirmware(const std::shared_ptr& data) { - Json::Value data_json = Utils::parseJSON(*data); - - const fs::path source_repo_dir_path(ostree_repo_sync::GetOstreeRepoPath(data_json["sysroot_path"].asString())); - - opcuabridge::Client client{opcuabridge::SelectEndPoint(SecondaryInterface::sconfig)}; - if (!client) { - return false; - } - - bool retval = true; - if (ostree_repo_sync::ArchiveModeRepo(source_repo_dir_path)) { - retval = client.syncDirectoryFiles(source_repo_dir_path); - } else { - TemporaryDirectory temp_dir("opcuabridge-ostree-sync-working-repo"); - const fs::path working_repo_dir_path = temp_dir.Path(); - - if (!ostree_repo_sync::LocalPullRepo(source_repo_dir_path, working_repo_dir_path, - data_json["ref_hash"].asString())) { - LOG_ERROR << "OSTree repo sync failed: unable to local pull from " << source_repo_dir_path.native(); - return false; - } - retval = client.syncDirectoryFiles(working_repo_dir_path); - } - return retval; -} - -int OpcuaSecondary::getRootVersion(bool /* director */) { - LOG_ERROR << "OpcuaSecondary::getRootVersion is not implemented yet"; - return 0; -} - -bool OpcuaSecondary::putRoot(const std::string& /* root */, bool /* director */) { - LOG_ERROR << "OpcuaSecondary::putRoot is not implemented yet"; - return false; -} - -} // namespace Uptane diff --git a/src/libaktualizr/uptane/opcuasecondary.h b/src/libaktualizr/uptane/opcuasecondary.h deleted file mode 100644 index 9d961cfb53..0000000000 --- a/src/libaktualizr/uptane/opcuasecondary.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef UPTANE_OPCUASECONDARY_H_ -#define UPTANE_OPCUASECONDARY_H_ - -#include "json/json.h" -#include "secondaryinterface.h" - -#include "utilities/types.h" - -namespace Uptane { - -struct MetaPack; -class SecondaryConfig; - -class OpcuaSecondary : public SecondaryInterface { - public: - explicit OpcuaSecondary(const SecondaryConfig& sconfig_in); - ~OpcuaSecondary() override; - - Uptane::EcuSerial getSerial() override; - Uptane::HardwareIdentifier getHwId() override; - PublicKey getPublicKey() override; - - Json::Value getManifest() override; - bool putMetadata(const RawMetaPack& meta_pack) override; - - bool sendFirmware(const std::shared_ptr& data) override; - - int getRootVersion(bool director) override; - bool putRoot(const std::string& root, bool director) override; -}; - -} // namespace Uptane - -#endif // UPTANE_OPCUASECONDARY_H_ diff --git a/src/libaktualizr/uptane/secondaryconfig.cc b/src/libaktualizr/uptane/secondaryconfig.cc index 3db57188fc..776517cf9f 100644 --- a/src/libaktualizr/uptane/secondaryconfig.cc +++ b/src/libaktualizr/uptane/secondaryconfig.cc @@ -14,8 +14,6 @@ SecondaryConfig::SecondaryConfig(const boost::filesystem::path &config_file) { throw FatalException("Legacy secondaries are deprecated."); } else if (stype == "ip_uptane") { secondary_type = Uptane::SecondaryType::kIpUptane; - } else if (stype == "opcua_uptane") { - secondary_type = Uptane::SecondaryType::kOpcuaUptane; } else if (stype == "isotp_uptane") { secondary_type = Uptane::SecondaryType::kIsoTpUptane; } else { diff --git a/src/libaktualizr/uptane/secondaryconfig.h b/src/libaktualizr/uptane/secondaryconfig.h index 63075c3546..ddc8d987c3 100644 --- a/src/libaktualizr/uptane/secondaryconfig.h +++ b/src/libaktualizr/uptane/secondaryconfig.h @@ -18,8 +18,6 @@ enum class SecondaryType { kLegacy, // Deprecated. Do not use. - kOpcuaUptane, // Uptane protocol over OPC-UA - kIpUptane, // Custom Uptane protocol over TCP/IP network kVirtualUptane, // Partial UPTANE secondary implemented inside primary @@ -39,8 +37,6 @@ class SecondaryConfig { std::string ecu_public_key; KeyType key_type{KeyType::kRSA2048}; - std::string opcua_lds_url; - boost::filesystem::path full_client_dir; // SecondaryType::kVirtual boost::filesystem::path firmware_path; // SecondaryType::kVirtual boost::filesystem::path metadata_path; // SecondaryType::kVirtual diff --git a/src/libaktualizr/uptane/secondaryfactory.cc b/src/libaktualizr/uptane/secondaryfactory.cc index 01ef64b05a..229f45c6bf 100644 --- a/src/libaktualizr/uptane/secondaryfactory.cc +++ b/src/libaktualizr/uptane/secondaryfactory.cc @@ -7,10 +7,6 @@ #include "isotpsecondary.h" #endif -#ifdef OPCUA_SECONDARY_ENABLED -#include "uptane/opcuasecondary.h" -#endif - namespace Uptane { std::shared_ptr SecondaryFactory::makeSecondary(const SecondaryConfig& sconfig) { @@ -26,13 +22,6 @@ std::shared_ptr SecondaryFactory::makeSecondary(const Second #else LOG_ERROR << "libaktualizr was built without ISO/TP secondary support."; return std::shared_ptr(); // NULL-equivalent -#endif - case SecondaryType::kOpcuaUptane: -#ifdef OPCUA_SECONDARY_ENABLED - return std::make_shared(sconfig); -#else - LOG_ERROR << "libaktualizr was built without OPC-UA secondary support."; - return std::shared_ptr(); // NULL-equivalent #endif default: LOG_ERROR << "Unrecognized secondary type: " << static_cast(sconfig.secondary_type); diff --git a/third_party/open62541/open62541.c b/third_party/open62541/open62541.c deleted file mode 100644 index e6981ca7b1..0000000000 --- a/third_party/open62541/open62541.c +++ /dev/null @@ -1,36219 +0,0 @@ -/* THIS IS A SINGLE-FILE DISTRIBUTION CONCATENATED FROM THE OPEN62541 SOURCES - * visit http://open62541.org/ for information about this software - * Git-Revision: undefined - */ - -/* - * Copyright (C) 2014-2016 the contributors as stated in the AUTHORS file - * - * This file is part of open62541. open62541 is free software: you can - * redistribute it and/or modify it under the terms of the Mozilla Public - * License v2.0 as stated in the LICENSE file provided with open62541. - * - * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. - */ - -#ifndef UA_DYNAMIC_LINKING_EXPORT -#define UA_DYNAMIC_LINKING_EXPORT -#define MDNSD_DYNAMIC_LINKING -#endif - -/* Enable POSIX features */ -#if !defined(_XOPEN_SOURCE) && !defined(_WRS_KERNEL) -#define _XOPEN_SOURCE 600 -#endif -#ifndef _DEFAULT_SOURCE -#define _DEFAULT_SOURCE -#endif -/* On older systems we need to define _BSD_SOURCE. - * _DEFAULT_SOURCE is an alias for that. */ -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif - -/* Disable security warnings for BSD sockets on MSVC */ -#ifdef _MSC_VER -#define _CRT_SECURE_NO_WARNINGS -#endif - -#include "open62541.h" - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/deps/queue.h" ***********************************/ - -/* $OpenBSD: queue.h,v 1.38 2013/07/03 15:05:21 fgsch Exp $ */ -/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ - -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)queue.h 8.5 (Berkeley) 8/20/94 - */ - -/* - * This file defines five types of data structures: singly-linked lists, - * lists, simple queues, tail queues, and circular queues. - * - * - * A singly-linked list is headed by a single forward pointer. The elements - * are singly linked for minimum space and pointer manipulation overhead at - * the expense of O(n) removal for arbitrary elements. New elements can be - * added to the list after an existing element or at the head of the list. - * Elements being removed from the head of the list should use the explicit - * macro for this purpose for optimum efficiency. A singly-linked list may - * only be traversed in the forward direction. Singly-linked lists are ideal - * for applications with large datasets and few or no removals or for - * implementing a LIFO queue. - * - * A list is headed by a single forward pointer (or an array of forward - * pointers for a hash table header). The elements are doubly linked - * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may only be traversed in the forward direction. - * - * A simple queue is headed by a pair of pointers, one the head of the - * list and the other to the tail of the list. The elements are singly - * linked to save space, so elements can only be removed from the - * head of the list. New elements can be added to the list before or after - * an existing element, at the head of the list, or at the end of the - * list. A simple queue may only be traversed in the forward direction. - * - * A tail queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may be traversed in either direction. - * - * A circle queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or after - * an existing element, at the head of the list, or at the end of the list. - * A circle queue may be traversed in either direction, but has a more - * complex end of list detection. - * - * For details on the use of these macros, see the queue(3) manual page. - */ - -#if defined(QUEUE_MACRO_DEBUG) || (defined(_KERNEL) && defined(DIAGNOSTIC)) -#define _Q_INVALIDATE(a) (a) = ((void *)-1) -#else -#define _Q_INVALIDATE(a) -#endif - -/* - * Singly-linked List definitions. - */ -#define SLIST_HEAD(name, type) \ - struct name { \ - struct type *slh_first; /* first element */ \ - } - -#define SLIST_HEAD_INITIALIZER(head) \ - { NULL } - -/* Fix redefinition of SLIST_ENTRY on mingw winnt.h */ -#ifdef SLIST_ENTRY -#undef SLIST_ENTRY -#endif - -#define SLIST_ENTRY(type) \ - struct { \ - struct type *sle_next; /* next element */ \ - } - -/* - * Singly-linked List access methods. - */ -#define SLIST_FIRST(head) ((head)->slh_first) -#define SLIST_END(head) NULL -#define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head)) -#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) - -#define SLIST_FOREACH(var, head, field) \ - for ((var) = SLIST_FIRST(head); (var) != SLIST_END(head); (var) = SLIST_NEXT(var, field)) - -#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = SLIST_FIRST(head); (var) && ((tvar) = SLIST_NEXT(var, field), 1); (var) = (tvar)) - -/* - * Singly-linked List functions. - */ -#define SLIST_INIT(head) \ - { SLIST_FIRST(head) = SLIST_END(head); } - -#define SLIST_INSERT_AFTER(slistelm, elm, field) \ - do { \ - (elm)->field.sle_next = (slistelm)->field.sle_next; \ - (slistelm)->field.sle_next = (elm); \ - } while (0) - -#define SLIST_INSERT_HEAD(head, elm, field) \ - do { \ - (elm)->field.sle_next = (head)->slh_first; \ - (head)->slh_first = (elm); \ - } while (0) - -#define SLIST_REMOVE_AFTER(elm, field) \ - do { \ - (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \ - } while (0) - -#define SLIST_REMOVE_HEAD(head, field) \ - do { \ - (head)->slh_first = (head)->slh_first->field.sle_next; \ - } while (0) - -#define SLIST_REMOVE(head, elm, type, field) \ - do { \ - if ((head)->slh_first == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->slh_first; \ - \ - while (curelm->field.sle_next != (elm)) curelm = curelm->field.sle_next; \ - curelm->field.sle_next = curelm->field.sle_next->field.sle_next; \ - _Q_INVALIDATE((elm)->field.sle_next); \ - } \ - } while (0) - -/* - * List definitions. - */ -#define LIST_HEAD(name, type) \ - struct name { \ - struct type *lh_first; /* first element */ \ - } - -#define LIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define LIST_ENTRY(type) \ - struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ - } - -/* - * List access methods - */ -#define LIST_FIRST(head) ((head)->lh_first) -#define LIST_END(head) NULL -#define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head)) -#define LIST_NEXT(elm, field) ((elm)->field.le_next) - -#define LIST_FOREACH(var, head, field) \ - for ((var) = LIST_FIRST(head); (var) != LIST_END(head); (var) = LIST_NEXT(var, field)) - -#define LIST_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = LIST_FIRST(head); (var) && ((tvar) = LIST_NEXT(var, field), 1); (var) = (tvar)) - -/* - * List functions. - */ -#define LIST_INIT(head) \ - do { \ - LIST_FIRST(head) = LIST_END(head); \ - } while (0) - -#define LIST_INSERT_AFTER(listelm, elm, field) \ - do { \ - if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ - (listelm)->field.le_next->field.le_prev = &(elm)->field.le_next; \ - (listelm)->field.le_next = (elm); \ - (elm)->field.le_prev = &(listelm)->field.le_next; \ - } while (0) - -#define LIST_INSERT_BEFORE(listelm, elm, field) \ - do { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - (elm)->field.le_next = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &(elm)->field.le_next; \ - } while (0) - -#define LIST_INSERT_HEAD(head, elm, field) \ - do { \ - if (((elm)->field.le_next = (head)->lh_first) != NULL) (head)->lh_first->field.le_prev = &(elm)->field.le_next; \ - (head)->lh_first = (elm); \ - (elm)->field.le_prev = &(head)->lh_first; \ - } while (0) - -#define LIST_REMOVE(elm, field) \ - do { \ - if ((elm)->field.le_next != NULL) (elm)->field.le_next->field.le_prev = (elm)->field.le_prev; \ - *(elm)->field.le_prev = (elm)->field.le_next; \ - _Q_INVALIDATE((elm)->field.le_prev); \ - _Q_INVALIDATE((elm)->field.le_next); \ - } while (0) - -#define LIST_REPLACE(elm, elm2, field) \ - do { \ - if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \ - (elm2)->field.le_next->field.le_prev = &(elm2)->field.le_next; \ - (elm2)->field.le_prev = (elm)->field.le_prev; \ - *(elm2)->field.le_prev = (elm2); \ - _Q_INVALIDATE((elm)->field.le_prev); \ - _Q_INVALIDATE((elm)->field.le_next); \ - } while (0) - -/* - * Simple queue definitions. - */ -#define SIMPLEQ_HEAD(name, type) \ - struct name { \ - struct type *sqh_first; /* first element */ \ - struct type **sqh_last; /* addr of last next element */ \ - } - -#define SIMPLEQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).sqh_first } - -#define SIMPLEQ_ENTRY(type) \ - struct { \ - struct type *sqe_next; /* next element */ \ - } - -/* - * Simple queue access methods. - */ -#define SIMPLEQ_FIRST(head) ((head)->sqh_first) -#define SIMPLEQ_END(head) NULL -#define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head)) -#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) - -#define SIMPLEQ_FOREACH(var, head, field) \ - for ((var) = SIMPLEQ_FIRST(head); (var) != SIMPLEQ_END(head); (var) = SIMPLEQ_NEXT(var, field)) - -#define SIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = SIMPLEQ_FIRST(head); (var) && ((tvar) = SIMPLEQ_NEXT(var, field), 1); (var) = (tvar)) - -/* - * Simple queue functions. - */ -#define SIMPLEQ_INIT(head) \ - do { \ - (head)->sqh_first = NULL; \ - (head)->sqh_last = &(head)->sqh_first; \ - } while (0) - -#define SIMPLEQ_INSERT_HEAD(head, elm, field) \ - do { \ - if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) (head)->sqh_last = &(elm)->field.sqe_next; \ - (head)->sqh_first = (elm); \ - } while (0) - -#define SIMPLEQ_INSERT_TAIL(head, elm, field) \ - do { \ - (elm)->field.sqe_next = NULL; \ - *(head)->sqh_last = (elm); \ - (head)->sqh_last = &(elm)->field.sqe_next; \ - } while (0) - -#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) \ - do { \ - if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL) (head)->sqh_last = &(elm)->field.sqe_next; \ - (listelm)->field.sqe_next = (elm); \ - } while (0) - -#define SIMPLEQ_REMOVE_HEAD(head, field) \ - do { \ - if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) (head)->sqh_last = &(head)->sqh_first; \ - } while (0) - -#define SIMPLEQ_REMOVE_AFTER(head, elm, field) \ - do { \ - if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) == NULL) \ - (head)->sqh_last = &(elm)->field.sqe_next; \ - } while (0) - -/* - * XOR Simple queue definitions. - */ -#define XSIMPLEQ_HEAD(name, type) \ - struct name { \ - struct type *sqx_first; /* first element */ \ - struct type **sqx_last; /* addr of last next element */ \ - unsigned long sqx_cookie; \ - } - -#define XSIMPLEQ_ENTRY(type) \ - struct { \ - struct type *sqx_next; /* next element */ \ - } - -/* - * XOR Simple queue access methods. - */ -#define XSIMPLEQ_XOR(head, ptr) ((__typeof(ptr))((head)->sqx_cookie ^ (unsigned long)(ptr))) -#define XSIMPLEQ_FIRST(head) XSIMPLEQ_XOR(head, ((head)->sqx_first)) -#define XSIMPLEQ_END(head) NULL -#define XSIMPLEQ_EMPTY(head) (XSIMPLEQ_FIRST(head) == XSIMPLEQ_END(head)) -#define XSIMPLEQ_NEXT(head, elm, field) XSIMPLEQ_XOR(head, ((elm)->field.sqx_next)) - -#define XSIMPLEQ_FOREACH(var, head, field) \ - for ((var) = XSIMPLEQ_FIRST(head); (var) != XSIMPLEQ_END(head); (var) = XSIMPLEQ_NEXT(head, var, field)) - -#define XSIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = XSIMPLEQ_FIRST(head); (var) && ((tvar) = XSIMPLEQ_NEXT(head, var, field), 1); (var) = (tvar)) - -/* - * XOR Simple queue functions. - */ -#define XSIMPLEQ_INIT(head) \ - do { \ - arc4random_buf(&(head)->sqx_cookie, sizeof((head)->sqx_cookie)); \ - (head)->sqx_first = XSIMPLEQ_XOR(head, NULL); \ - (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \ - } while (0) - -#define XSIMPLEQ_INSERT_HEAD(head, elm, field) \ - do { \ - if (((elm)->field.sqx_next = (head)->sqx_first) == XSIMPLEQ_XOR(head, NULL)) \ - (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \ - (head)->sqx_first = XSIMPLEQ_XOR(head, (elm)); \ - } while (0) - -#define XSIMPLEQ_INSERT_TAIL(head, elm, field) \ - do { \ - (elm)->field.sqx_next = XSIMPLEQ_XOR(head, NULL); \ - *(XSIMPLEQ_XOR(head, (head)->sqx_last)) = XSIMPLEQ_XOR(head, (elm)); \ - (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \ - } while (0) - -#define XSIMPLEQ_INSERT_AFTER(head, listelm, elm, field) \ - do { \ - if (((elm)->field.sqx_next = (listelm)->field.sqx_next) == XSIMPLEQ_XOR(head, NULL)) \ - (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \ - (listelm)->field.sqx_next = XSIMPLEQ_XOR(head, (elm)); \ - } while (0) - -#define XSIMPLEQ_REMOVE_HEAD(head, field) \ - do { \ - if (((head)->sqx_first = XSIMPLEQ_XOR(head, (head)->sqx_first)->field.sqx_next) == XSIMPLEQ_XOR(head, NULL)) \ - (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \ - } while (0) - -#define XSIMPLEQ_REMOVE_AFTER(head, elm, field) \ - do { \ - if (((elm)->field.sqx_next = XSIMPLEQ_XOR(head, (elm)->field.sqx_next)->field.sqx_next) == \ - XSIMPLEQ_XOR(head, NULL)) \ - (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \ - } while (0) - -/* - * Tail queue definitions. - */ -#define TAILQ_HEAD(name, type) \ - struct name { \ - struct type *tqh_first; /* first element */ \ - struct type **tqh_last; /* addr of last next element */ \ - } - -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } - -#define TAILQ_ENTRY(type) \ - struct { \ - struct type *tqe_next; /* next element */ \ - struct type **tqe_prev; /* address of previous next element */ \ - } - -/* - * tail queue access methods - */ -#define TAILQ_FIRST(head) ((head)->tqh_first) -#define TAILQ_END(head) NULL -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -#define TAILQ_LAST(head, headname) (*(((struct headname *)((head)->tqh_last))->tqh_last)) -/* XXX */ -#define TAILQ_PREV(elm, headname, field) (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) -#define TAILQ_EMPTY(head) (TAILQ_FIRST(head) == TAILQ_END(head)) - -#define TAILQ_FOREACH(var, head, field) \ - for ((var) = TAILQ_FIRST(head); (var) != TAILQ_END(head); (var) = TAILQ_NEXT(var, field)) - -#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = TAILQ_FIRST(head); (var) != TAILQ_END(head) && ((tvar) = TAILQ_NEXT(var, field), 1); (var) = (tvar)) - -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = TAILQ_LAST(head, headname); (var) != TAILQ_END(head); (var) = TAILQ_PREV(var, headname, field)) - -#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ - for ((var) = TAILQ_LAST(head, headname); (var) != TAILQ_END(head) && ((tvar) = TAILQ_PREV(var, headname, field), 1); \ - (var) = (tvar)) - -/* - * Tail queue functions. - */ -#define TAILQ_INIT(head) \ - do { \ - (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ - } while (0) - -#define TAILQ_INSERT_HEAD(head, elm, field) \ - do { \ - if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ - } while (0) - -#define TAILQ_INSERT_TAIL(head, elm, field) \ - do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - } while (0) - -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) \ - do { \ - if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ - } while (0) - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) \ - do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ - } while (0) - -#define TAILQ_REMOVE(head, elm, field) \ - do { \ - if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = (elm)->field.tqe_prev; \ - else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ - _Q_INVALIDATE((elm)->field.tqe_prev); \ - _Q_INVALIDATE((elm)->field.tqe_next); \ - } while (0) - -#define TAILQ_REPLACE(head, elm, elm2, field) \ - do { \ - if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \ - (elm2)->field.tqe_next->field.tqe_prev = &(elm2)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm2)->field.tqe_next; \ - (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ - *(elm2)->field.tqe_prev = (elm2); \ - _Q_INVALIDATE((elm)->field.tqe_prev); \ - _Q_INVALIDATE((elm)->field.tqe_next); \ - } while (0) - -/* - * Circular queue definitions. - */ -#define CIRCLEQ_HEAD(name, type) \ - struct name { \ - struct type *cqh_first; /* first element */ \ - struct type *cqh_last; /* last element */ \ - } - -#define CIRCLEQ_HEAD_INITIALIZER(head) \ - { CIRCLEQ_END(&head), CIRCLEQ_END(&head) } - -#define CIRCLEQ_ENTRY(type) \ - struct { \ - struct type *cqe_next; /* next element */ \ - struct type *cqe_prev; /* previous element */ \ - } - -/* - * Circular queue access methods - */ -#define CIRCLEQ_FIRST(head) ((head)->cqh_first) -#define CIRCLEQ_LAST(head) ((head)->cqh_last) -#define CIRCLEQ_END(head) ((void *)(head)) -#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) -#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) -#define CIRCLEQ_EMPTY(head) (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head)) - -#define CIRCLEQ_FOREACH(var, head, field) \ - for ((var) = CIRCLEQ_FIRST(head); (var) != CIRCLEQ_END(head); (var) = CIRCLEQ_NEXT(var, field)) - -#define CIRCLEQ_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = CIRCLEQ_FIRST(head); (var) != CIRCLEQ_END(head) && ((tvar) = CIRCLEQ_NEXT(var, field), 1); \ - (var) = (tvar)) - -#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ - for ((var) = CIRCLEQ_LAST(head); (var) != CIRCLEQ_END(head); (var) = CIRCLEQ_PREV(var, field)) - -#define CIRCLEQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ - for ((var) = CIRCLEQ_LAST(head, headname); \ - (var) != CIRCLEQ_END(head) && ((tvar) = CIRCLEQ_PREV(var, headname, field), 1); (var) = (tvar)) - -/* - * Circular queue functions. - */ -#define CIRCLEQ_INIT(head) \ - do { \ - (head)->cqh_first = CIRCLEQ_END(head); \ - (head)->cqh_last = CIRCLEQ_END(head); \ - } while (0) - -#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) \ - do { \ - (elm)->field.cqe_next = (listelm)->field.cqe_next; \ - (elm)->field.cqe_prev = (listelm); \ - if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \ - (head)->cqh_last = (elm); \ - else \ - (listelm)->field.cqe_next->field.cqe_prev = (elm); \ - (listelm)->field.cqe_next = (elm); \ - } while (0) - -#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) \ - do { \ - (elm)->field.cqe_next = (listelm); \ - (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ - if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \ - (head)->cqh_first = (elm); \ - else \ - (listelm)->field.cqe_prev->field.cqe_next = (elm); \ - (listelm)->field.cqe_prev = (elm); \ - } while (0) - -#define CIRCLEQ_INSERT_HEAD(head, elm, field) \ - do { \ - (elm)->field.cqe_next = (head)->cqh_first; \ - (elm)->field.cqe_prev = CIRCLEQ_END(head); \ - if ((head)->cqh_last == CIRCLEQ_END(head)) \ - (head)->cqh_last = (elm); \ - else \ - (head)->cqh_first->field.cqe_prev = (elm); \ - (head)->cqh_first = (elm); \ - } while (0) - -#define CIRCLEQ_INSERT_TAIL(head, elm, field) \ - do { \ - (elm)->field.cqe_next = CIRCLEQ_END(head); \ - (elm)->field.cqe_prev = (head)->cqh_last; \ - if ((head)->cqh_first == CIRCLEQ_END(head)) \ - (head)->cqh_first = (elm); \ - else \ - (head)->cqh_last->field.cqe_next = (elm); \ - (head)->cqh_last = (elm); \ - } while (0) - -#define CIRCLEQ_REMOVE(head, elm, field) \ - do { \ - if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \ - (head)->cqh_last = (elm)->field.cqe_prev; \ - else \ - (elm)->field.cqe_next->field.cqe_prev = (elm)->field.cqe_prev; \ - if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \ - (head)->cqh_first = (elm)->field.cqe_next; \ - else \ - (elm)->field.cqe_prev->field.cqe_next = (elm)->field.cqe_next; \ - _Q_INVALIDATE((elm)->field.cqe_prev); \ - _Q_INVALIDATE((elm)->field.cqe_next); \ - } while (0) - -#define CIRCLEQ_REPLACE(head, elm, elm2, field) \ - do { \ - if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == CIRCLEQ_END(head)) \ - (head)->cqh_last = (elm2); \ - else \ - (elm2)->field.cqe_next->field.cqe_prev = (elm2); \ - if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == CIRCLEQ_END(head)) \ - (head)->cqh_first = (elm2); \ - else \ - (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ - _Q_INVALIDATE((elm)->field.cqe_prev); \ - _Q_INVALIDATE((elm)->field.cqe_next); \ - } while (0) - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/deps/pcg_basic.h" - * ***********************************/ - -/* - * PCG Random Number Generation for C. - * - * Copyright 2014 Melissa O'Neill - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * For additional information about the PCG random number generation scheme, - * including its license and other licensing options, visit - * - * http://www.pcg-random.org - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct pcg_state_setseq_64 { - uint64_t state; /* RNG state. All values are possible. */ - uint64_t inc; /* Controls which RNG sequence (stream) is selected. Must - * *always* be odd. */ -} pcg32_random_t; - -#define PCG32_INITIALIZER \ - { 0x853c49e6748fea9bULL, 0xda3e39cb94b95bdbULL } - -void pcg32_srandom_r(pcg32_random_t *rng, uint64_t initial_state, uint64_t initseq); -uint32_t pcg32_random_r(pcg32_random_t *rng); - -#ifdef __cplusplus -} -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/deps/libc_time.h" - * ***********************************/ - -struct mytm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; - /* long __tm_gmtoff; */ - /* const char *__tm_zone; */ -}; - -int __secs_to_tm(long long t, struct mytm *tm); - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_util.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* BSD Queue Macros */ - -/* Macro-Expand for MSVC workarounds */ -#define UA_MACRO_EXPAND(x) x - -/* Thread-Local Storage - * -------------------- - * Thread-local variables are always enabled. Also when the library is built - * with ``UA_ENABLE_MULTITHREADING`` disabled. Otherwise, if multiple clients - * run in separate threads, race conditions may occur via global variables in - * the encoding layer. */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -#define UA_THREAD_LOCAL _Thread_local /* C11 */ -#elif defined(__cplusplus) && __cplusplus > 199711L -#define UA_THREAD_LOCAL thread_local /* C++11 */ -#elif defined(__GNUC__) && !defined(_WRS_KERNEL) // defining __thread gave error of missing __tls_lookup in VxWorks -#define UA_THREAD_LOCAL __thread /* GNU extension */ -#elif defined(_MSC_VER) -#define UA_THREAD_LOCAL __declspec(thread) /* MSVC extension */ -#else -#warning The compiler does not support thread-local variables -#define UA_THREAD_LOCAL -#endif - -/* Integer Shortnames - * ------------------ - * These are not exposed on the public API, since many user-applications make - * the same definitions in their headers. */ - -typedef UA_Byte u8; -typedef UA_SByte i8; -typedef UA_UInt16 u16; -typedef UA_Int16 i16; -typedef UA_UInt32 u32; -typedef UA_Int32 i32; -typedef UA_UInt64 u64; -typedef UA_Int64 i64; -typedef UA_StatusCode status; - -/* Atomic Operations - * ----------------- - * Atomic operations that synchronize across processor cores (for - * multithreading). Only the inline-functions defined next are used. Replace - * with architecture-specific operations if necessary. */ -#ifndef UA_ENABLE_MULTITHREADING -#define UA_atomic_sync() -#else -#ifdef _MSC_VER /* Visual Studio */ -#define UA_atomic_sync() _ReadWriteBarrier() -#else /* GCC/Clang */ -#define UA_atomic_sync() __sync_synchronize() -#endif -#endif - -static UA_INLINE void *UA_atomic_xchg(void *volatile *addr, void *newptr) { -#ifndef UA_ENABLE_MULTITHREADING - void *old = *addr; - *addr = newptr; - return old; -#else -#ifdef _MSC_VER /* Visual Studio */ - return _InterlockedExchangePointer(addr, newptr); -#else /* GCC/Clang */ - return __sync_lock_test_and_set(addr, newptr); -#endif -#endif -} - -static UA_INLINE void *UA_atomic_cmpxchg(void *volatile *addr, void *expected, void *newptr) { -#ifndef UA_ENABLE_MULTITHREADING - void *old = *addr; - if (old == expected) { - *addr = newptr; - } - return old; -#else -#ifdef _MSC_VER /* Visual Studio */ - return _InterlockedCompareExchangePointer(addr, expected, newptr); -#else /* GCC/Clang */ - return __sync_val_compare_and_swap(addr, expected, newptr); -#endif -#endif -} - -static UA_INLINE uint32_t UA_atomic_add(volatile uint32_t *addr, uint32_t increase) { -#ifndef UA_ENABLE_MULTITHREADING - *addr += increase; - return *addr; -#else -#ifdef _MSC_VER /* Visual Studio */ - return _InterlockedExchangeAdd(addr, increase) + increase; -#else /* GCC/Clang */ - return __sync_add_and_fetch(addr, increase); -#endif -#endif -} - -/* Utility Functions - * ----------------- */ - -/* Convert given byte string to a positive number. Returns the number of valid - * digits. Stops if a non-digit char is found and returns the number of digits - * up to that point. */ -size_t UA_readNumber(u8 *buf, size_t buflen, u32 *number); - -#define MIN(A, B) (A > B ? B : A) -#define MAX(A, B) (A > B ? A : B) - -#ifdef UA_DEBUG_DUMP_PKGS -void UA_EXPORT UA_dump_hex_pkg(UA_Byte *buffer, size_t bufferLen); -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_types_encoding_binary.h" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef UA_StatusCode (*UA_exchangeEncodeBuffer)(void *handle, UA_Byte **bufPos, const UA_Byte **bufEnd); - -/* Encodes the scalar value described by type in the binary encoding. Encoding - * is thread-safe if thread-local variables are enabled. Encoding is also - * reentrant and can be safely called from signal handlers or interrupts. - * - * @param src The value. Must not be NULL. - * @param type The value type. Must not be NULL. - * @param bufPos Points to a pointer to the current position in the encoding - * buffer. Must not be NULL. The pointer is advanced by the number of - * encoded bytes, or, if the buffer is exchanged, to the position in the - * new buffer. - * @param bufEnd Points to a pointer to the end of the encoding buffer (encoding - * always stops before *buf_end). Must not be NULL. The pointer is - * changed when the buffer is exchanged. - * @param exchangeCallback Called when the end of the buffer is reached. This is - used to send out a message chunk before continuing with the encoding. - Is ignored if NULL. - * @param exchangeHandle Custom data passed into the exchangeCallback. - * @return Returns a statuscode whether encoding succeeded. */ -UA_StatusCode UA_encodeBinary(const void *src, const UA_DataType *type, UA_Byte **bufPos, const UA_Byte **bufEnd, - UA_exchangeEncodeBuffer exchangeCallback, - void *exchangeHandle) UA_FUNC_ATTR_WARN_UNUSED_RESULT; - -/* Decodes a scalar value described by type from binary encoding. Decoding - * is thread-safe if thread-local variables are enabled. Decoding is also - * reentrant and can be safely called from signal handlers or interrupts. - * - * @param src The buffer with the binary encoded value. Must not be NULL. - * @param offset The current position in the buffer. Must not be NULL. The value - * is advanced as decoding progresses. - * @param dst The target value. Must not be NULL. The target is assumed to have - * size type->memSize. The value is reset to zero before decoding. If - * decoding fails, members are deleted and the value is reset (zeroed) - * again. - * @param type The value type. Must not be NULL. - * @param customTypesSize The number of non-standard datatypes contained in the - * customTypes array. - * @param customTypes An array of non-standard datatypes (not included in - * UA_TYPES). Can be NULL if customTypesSize is zero. - * @return Returns a statuscode whether decoding succeeded. */ -UA_StatusCode UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst, const UA_DataType *type, - size_t customTypesSize, const UA_DataType *customTypes) UA_FUNC_ATTR_WARN_UNUSED_RESULT; - -/* Returns the number of bytes the value p takes in binary encoding. Returns - * zero if an error occurs. UA_calcSizeBinary is thread-safe and reentrant since - * it does not access global (thread-local) variables. */ -size_t UA_calcSizeBinary(void *p, const UA_DataType *type); - -const UA_DataType *UA_findDataTypeByBinary(const UA_NodeId *typeId); - -#ifdef __cplusplus -} -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_types_generated_encoding_binary.h" - * ***********************************/ - -/* Generated from Opc.Ua.Types.bsd with script - * /home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/tools/generate_datatypes.py - * on host nmpc by user max at 2018-01-05 04:21:09 */ - -/* Boolean */ -static UA_INLINE UA_StatusCode UA_Boolean_encodeBinary(const UA_Boolean *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BOOLEAN], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Boolean_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Boolean *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BOOLEAN], 0, NULL); -} - -/* SByte */ -static UA_INLINE UA_StatusCode UA_SByte_encodeBinary(const UA_SByte *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SBYTE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SByte_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SByte *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SBYTE], 0, NULL); -} - -/* Byte */ -static UA_INLINE UA_StatusCode UA_Byte_encodeBinary(const UA_Byte *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BYTE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Byte_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Byte *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BYTE], 0, NULL); -} - -/* Int16 */ -static UA_INLINE UA_StatusCode UA_Int16_encodeBinary(const UA_Int16 *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT16], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Int16_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int16 *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT16], 0, NULL); -} - -/* UInt16 */ -static UA_INLINE UA_StatusCode UA_UInt16_encodeBinary(const UA_UInt16 *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT16], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_UInt16_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt16 *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT16], 0, NULL); -} - -/* Int32 */ -static UA_INLINE UA_StatusCode UA_Int32_encodeBinary(const UA_Int32 *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT32], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Int32_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int32 *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT32], 0, NULL); -} - -/* UInt32 */ -static UA_INLINE UA_StatusCode UA_UInt32_encodeBinary(const UA_UInt32 *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT32], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_UInt32_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt32 *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT32], 0, NULL); -} - -/* Int64 */ -static UA_INLINE UA_StatusCode UA_Int64_encodeBinary(const UA_Int64 *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT64], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Int64_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int64 *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT64], 0, NULL); -} - -/* UInt64 */ -static UA_INLINE UA_StatusCode UA_UInt64_encodeBinary(const UA_UInt64 *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT64], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_UInt64_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt64 *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT64], 0, NULL); -} - -/* Float */ -static UA_INLINE UA_StatusCode UA_Float_encodeBinary(const UA_Float *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FLOAT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Float_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Float *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FLOAT], 0, NULL); -} - -/* Double */ -static UA_INLINE UA_StatusCode UA_Double_encodeBinary(const UA_Double *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DOUBLE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Double_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Double *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DOUBLE], 0, NULL); -} - -/* String */ -static UA_INLINE UA_StatusCode UA_String_encodeBinary(const UA_String *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STRING], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_String_decodeBinary(const UA_ByteString *src, size_t *offset, UA_String *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STRING], 0, NULL); -} - -/* DateTime */ -static UA_INLINE UA_StatusCode UA_DateTime_encodeBinary(const UA_DateTime *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATETIME], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DateTime_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DateTime *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATETIME], 0, NULL); -} - -/* Guid */ -static UA_INLINE UA_StatusCode UA_Guid_encodeBinary(const UA_Guid *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GUID], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Guid_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Guid *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GUID], 0, NULL); -} - -/* ByteString */ -static UA_INLINE UA_StatusCode UA_ByteString_encodeBinary(const UA_ByteString *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BYTESTRING], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ByteString_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ByteString *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BYTESTRING], 0, NULL); -} - -/* XmlElement */ -static UA_INLINE UA_StatusCode UA_XmlElement_encodeBinary(const UA_XmlElement *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_XMLELEMENT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_XmlElement_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_XmlElement *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_XMLELEMENT], 0, NULL); -} - -/* NodeId */ -static UA_INLINE UA_StatusCode UA_NodeId_encodeBinary(const UA_NodeId *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEID], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_NodeId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeId *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEID], 0, NULL); -} - -/* ExpandedNodeId */ -static UA_INLINE UA_StatusCode UA_ExpandedNodeId_encodeBinary(const UA_ExpandedNodeId *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EXPANDEDNODEID], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ExpandedNodeId_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ExpandedNodeId *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EXPANDEDNODEID], 0, NULL); -} - -/* StatusCode */ -static UA_INLINE UA_StatusCode UA_StatusCode_encodeBinary(const UA_StatusCode *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STATUSCODE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_StatusCode_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_StatusCode *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STATUSCODE], 0, NULL); -} - -/* QualifiedName */ -static UA_INLINE UA_StatusCode UA_QualifiedName_encodeBinary(const UA_QualifiedName *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUALIFIEDNAME], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_QualifiedName_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_QualifiedName *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUALIFIEDNAME], 0, NULL); -} - -/* LocalizedText */ -static UA_INLINE UA_StatusCode UA_LocalizedText_encodeBinary(const UA_LocalizedText *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_LocalizedText_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_LocalizedText *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], 0, NULL); -} - -/* ExtensionObject */ -static UA_INLINE UA_StatusCode UA_ExtensionObject_encodeBinary(const UA_ExtensionObject *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ExtensionObject_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ExtensionObject *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT], 0, NULL); -} - -/* DataValue */ -static UA_INLINE UA_StatusCode UA_DataValue_encodeBinary(const UA_DataValue *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATAVALUE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DataValue_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataValue *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATAVALUE], 0, NULL); -} - -/* Variant */ -static UA_INLINE UA_StatusCode UA_Variant_encodeBinary(const UA_Variant *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIANT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Variant_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Variant *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIANT], 0, NULL); -} - -/* DiagnosticInfo */ -static UA_INLINE UA_StatusCode UA_DiagnosticInfo_encodeBinary(const UA_DiagnosticInfo *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DiagnosticInfo_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DiagnosticInfo *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO], 0, NULL); -} - -/* IdType */ -static UA_INLINE UA_StatusCode UA_IdType_encodeBinary(const UA_IdType *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_IDTYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_IdType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_IdType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_IDTYPE], 0, NULL); -} - -/* NodeClass */ -static UA_INLINE UA_StatusCode UA_NodeClass_encodeBinary(const UA_NodeClass *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODECLASS], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_NodeClass_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeClass *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODECLASS], 0, NULL); -} - -/* ReferenceNode */ -static UA_INLINE UA_StatusCode UA_ReferenceNode_encodeBinary(const UA_ReferenceNode *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCENODE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ReferenceNode_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ReferenceNode *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCENODE], 0, NULL); -} - -/* Argument */ -static UA_INLINE UA_StatusCode UA_Argument_encodeBinary(const UA_Argument *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ARGUMENT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Argument_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Argument *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ARGUMENT], 0, NULL); -} - -/* Duration */ -static UA_INLINE UA_StatusCode UA_Duration_encodeBinary(const UA_Duration *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DURATION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_Duration_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Duration *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DURATION], 0, NULL); -} - -/* UtcTime */ -static UA_INLINE UA_StatusCode UA_UtcTime_encodeBinary(const UA_UtcTime *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UTCTIME], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_UtcTime_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UtcTime *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UTCTIME], 0, NULL); -} - -/* LocaleId */ -static UA_INLINE UA_StatusCode UA_LocaleId_encodeBinary(const UA_LocaleId *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_LOCALEID], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_LocaleId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_LocaleId *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_LOCALEID], 0, NULL); -} - -/* TimeZoneDataType */ -static UA_INLINE UA_StatusCode UA_TimeZoneDataType_encodeBinary(const UA_TimeZoneDataType *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_TIMEZONEDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_TimeZoneDataType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_TimeZoneDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_TIMEZONEDATATYPE], 0, NULL); -} - -/* ApplicationType */ -static UA_INLINE UA_StatusCode UA_ApplicationType_encodeBinary(const UA_ApplicationType *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_APPLICATIONTYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ApplicationType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ApplicationType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_APPLICATIONTYPE], 0, NULL); -} - -/* ApplicationDescription */ -static UA_INLINE UA_StatusCode UA_ApplicationDescription_encodeBinary(const UA_ApplicationDescription *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ApplicationDescription_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ApplicationDescription *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION], 0, NULL); -} - -/* RequestHeader */ -static UA_INLINE UA_StatusCode UA_RequestHeader_encodeBinary(const UA_RequestHeader *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REQUESTHEADER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RequestHeader_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RequestHeader *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REQUESTHEADER], 0, NULL); -} - -/* ResponseHeader */ -static UA_INLINE UA_StatusCode UA_ResponseHeader_encodeBinary(const UA_ResponseHeader *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RESPONSEHEADER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ResponseHeader_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ResponseHeader *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RESPONSEHEADER], 0, NULL); -} - -/* ServiceFault */ -static UA_INLINE UA_StatusCode UA_ServiceFault_encodeBinary(const UA_ServiceFault *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVICEFAULT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ServiceFault_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ServiceFault *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVICEFAULT], 0, NULL); -} - -/* FindServersRequest */ -static UA_INLINE UA_StatusCode UA_FindServersRequest_encodeBinary(const UA_FindServersRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_FindServersRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_FindServersRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST], 0, NULL); -} - -/* FindServersResponse */ -static UA_INLINE UA_StatusCode UA_FindServersResponse_encodeBinary(const UA_FindServersResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_FindServersResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_FindServersResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE], 0, NULL); -} - -/* ServerOnNetwork */ -static UA_INLINE UA_StatusCode UA_ServerOnNetwork_encodeBinary(const UA_ServerOnNetwork *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERONNETWORK], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ServerOnNetwork_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ServerOnNetwork *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERONNETWORK], 0, NULL); -} - -/* FindServersOnNetworkRequest */ -static UA_INLINE UA_StatusCode UA_FindServersOnNetworkRequest_encodeBinary(const UA_FindServersOnNetworkRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_FindServersOnNetworkRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_FindServersOnNetworkRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKREQUEST], 0, NULL); -} - -/* FindServersOnNetworkResponse */ -static UA_INLINE UA_StatusCode UA_FindServersOnNetworkResponse_encodeBinary(const UA_FindServersOnNetworkResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_FindServersOnNetworkResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_FindServersOnNetworkResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKRESPONSE], 0, NULL); -} - -/* MessageSecurityMode */ -static UA_INLINE UA_StatusCode UA_MessageSecurityMode_encodeBinary(const UA_MessageSecurityMode *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MessageSecurityMode_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MessageSecurityMode *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE], 0, NULL); -} - -/* UserTokenType */ -static UA_INLINE UA_StatusCode UA_UserTokenType_encodeBinary(const UA_UserTokenType *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERTOKENTYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_UserTokenType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_UserTokenType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERTOKENTYPE], 0, NULL); -} - -/* UserTokenPolicy */ -static UA_INLINE UA_StatusCode UA_UserTokenPolicy_encodeBinary(const UA_UserTokenPolicy *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERTOKENPOLICY], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_UserTokenPolicy_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_UserTokenPolicy *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERTOKENPOLICY], 0, NULL); -} - -/* EndpointDescription */ -static UA_INLINE UA_StatusCode UA_EndpointDescription_encodeBinary(const UA_EndpointDescription *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_EndpointDescription_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_EndpointDescription *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION], 0, NULL); -} - -/* GetEndpointsRequest */ -static UA_INLINE UA_StatusCode UA_GetEndpointsRequest_encodeBinary(const UA_GetEndpointsRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_GetEndpointsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_GetEndpointsRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST], 0, NULL); -} - -/* GetEndpointsResponse */ -static UA_INLINE UA_StatusCode UA_GetEndpointsResponse_encodeBinary(const UA_GetEndpointsResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_GetEndpointsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_GetEndpointsResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE], 0, NULL); -} - -/* RegisteredServer */ -static UA_INLINE UA_StatusCode UA_RegisteredServer_encodeBinary(const UA_RegisteredServer *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTEREDSERVER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RegisteredServer_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RegisteredServer *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTEREDSERVER], 0, NULL); -} - -/* RegisterServerRequest */ -static UA_INLINE UA_StatusCode UA_RegisterServerRequest_encodeBinary(const UA_RegisterServerRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERSERVERREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RegisterServerRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RegisterServerRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERSERVERREQUEST], 0, NULL); -} - -/* RegisterServerResponse */ -static UA_INLINE UA_StatusCode UA_RegisterServerResponse_encodeBinary(const UA_RegisterServerResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERSERVERRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RegisterServerResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RegisterServerResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERSERVERRESPONSE], 0, NULL); -} - -/* DiscoveryConfiguration */ -static UA_INLINE UA_StatusCode UA_DiscoveryConfiguration_encodeBinary(const UA_DiscoveryConfiguration *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DISCOVERYCONFIGURATION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DiscoveryConfiguration_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DiscoveryConfiguration *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DISCOVERYCONFIGURATION], 0, NULL); -} - -/* MdnsDiscoveryConfiguration */ -static UA_INLINE UA_StatusCode UA_MdnsDiscoveryConfiguration_encodeBinary(const UA_MdnsDiscoveryConfiguration *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MDNSDISCOVERYCONFIGURATION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MdnsDiscoveryConfiguration_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MdnsDiscoveryConfiguration *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MDNSDISCOVERYCONFIGURATION], 0, NULL); -} - -/* RegisterServer2Request */ -static UA_INLINE UA_StatusCode UA_RegisterServer2Request_encodeBinary(const UA_RegisterServer2Request *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERSERVER2REQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RegisterServer2Request_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RegisterServer2Request *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERSERVER2REQUEST], 0, NULL); -} - -/* RegisterServer2Response */ -static UA_INLINE UA_StatusCode UA_RegisterServer2Response_encodeBinary(const UA_RegisterServer2Response *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERSERVER2RESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RegisterServer2Response_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RegisterServer2Response *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERSERVER2RESPONSE], 0, NULL); -} - -/* SecurityTokenRequestType */ -static UA_INLINE UA_StatusCode UA_SecurityTokenRequestType_encodeBinary(const UA_SecurityTokenRequestType *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SecurityTokenRequestType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SecurityTokenRequestType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE], 0, NULL); -} - -/* ChannelSecurityToken */ -static UA_INLINE UA_StatusCode UA_ChannelSecurityToken_encodeBinary(const UA_ChannelSecurityToken *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ChannelSecurityToken_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ChannelSecurityToken *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN], 0, NULL); -} - -/* OpenSecureChannelRequest */ -static UA_INLINE UA_StatusCode UA_OpenSecureChannelRequest_encodeBinary(const UA_OpenSecureChannelRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_OpenSecureChannelRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_OpenSecureChannelRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST], 0, NULL); -} - -/* OpenSecureChannelResponse */ -static UA_INLINE UA_StatusCode UA_OpenSecureChannelResponse_encodeBinary(const UA_OpenSecureChannelResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_OpenSecureChannelResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_OpenSecureChannelResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE], 0, NULL); -} - -/* CloseSecureChannelRequest */ -static UA_INLINE UA_StatusCode UA_CloseSecureChannelRequest_encodeBinary(const UA_CloseSecureChannelRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CloseSecureChannelRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CloseSecureChannelRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST], 0, NULL); -} - -/* CloseSecureChannelResponse */ -static UA_INLINE UA_StatusCode UA_CloseSecureChannelResponse_encodeBinary(const UA_CloseSecureChannelResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CloseSecureChannelResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CloseSecureChannelResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELRESPONSE], 0, NULL); -} - -/* SignedSoftwareCertificate */ -static UA_INLINE UA_StatusCode UA_SignedSoftwareCertificate_encodeBinary(const UA_SignedSoftwareCertificate *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SignedSoftwareCertificate_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SignedSoftwareCertificate *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE], 0, NULL); -} - -/* SignatureData */ -static UA_INLINE UA_StatusCode UA_SignatureData_encodeBinary(const UA_SignatureData *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SIGNATUREDATA], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SignatureData_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SignatureData *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIGNATUREDATA], 0, NULL); -} - -/* CreateSessionRequest */ -static UA_INLINE UA_StatusCode UA_CreateSessionRequest_encodeBinary(const UA_CreateSessionRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CreateSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CreateSessionRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST], 0, NULL); -} - -/* CreateSessionResponse */ -static UA_INLINE UA_StatusCode UA_CreateSessionResponse_encodeBinary(const UA_CreateSessionResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CreateSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CreateSessionResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE], 0, NULL); -} - -/* UserIdentityToken */ -static UA_INLINE UA_StatusCode UA_UserIdentityToken_encodeBinary(const UA_UserIdentityToken *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_UserIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_UserIdentityToken *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN], 0, NULL); -} - -/* AnonymousIdentityToken */ -static UA_INLINE UA_StatusCode UA_AnonymousIdentityToken_encodeBinary(const UA_AnonymousIdentityToken *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_AnonymousIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_AnonymousIdentityToken *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN], 0, NULL); -} - -/* UserNameIdentityToken */ -static UA_INLINE UA_StatusCode UA_UserNameIdentityToken_encodeBinary(const UA_UserNameIdentityToken *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_UserNameIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_UserNameIdentityToken *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN], 0, NULL); -} - -/* ActivateSessionRequest */ -static UA_INLINE UA_StatusCode UA_ActivateSessionRequest_encodeBinary(const UA_ActivateSessionRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ActivateSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ActivateSessionRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST], 0, NULL); -} - -/* ActivateSessionResponse */ -static UA_INLINE UA_StatusCode UA_ActivateSessionResponse_encodeBinary(const UA_ActivateSessionResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ActivateSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ActivateSessionResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE], 0, NULL); -} - -/* CloseSessionRequest */ -static UA_INLINE UA_StatusCode UA_CloseSessionRequest_encodeBinary(const UA_CloseSessionRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CloseSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CloseSessionRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST], 0, NULL); -} - -/* CloseSessionResponse */ -static UA_INLINE UA_StatusCode UA_CloseSessionResponse_encodeBinary(const UA_CloseSessionResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CloseSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CloseSessionResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE], 0, NULL); -} - -/* NodeAttributesMask */ -static UA_INLINE UA_StatusCode UA_NodeAttributesMask_encodeBinary(const UA_NodeAttributesMask *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_NodeAttributesMask_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_NodeAttributesMask *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK], 0, NULL); -} - -/* NodeAttributes */ -static UA_INLINE UA_StatusCode UA_NodeAttributes_encodeBinary(const UA_NodeAttributes *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEATTRIBUTES], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_NodeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_NodeAttributes *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTES], 0, NULL); -} - -/* ObjectAttributes */ -static UA_INLINE UA_StatusCode UA_ObjectAttributes_encodeBinary(const UA_ObjectAttributes *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ObjectAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ObjectAttributes *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], 0, NULL); -} - -/* VariableAttributes */ -static UA_INLINE UA_StatusCode UA_VariableAttributes_encodeBinary(const UA_VariableAttributes *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_VariableAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_VariableAttributes *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES], 0, NULL); -} - -/* MethodAttributes */ -static UA_INLINE UA_StatusCode UA_MethodAttributes_encodeBinary(const UA_MethodAttributes *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_METHODATTRIBUTES], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MethodAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MethodAttributes *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_METHODATTRIBUTES], 0, NULL); -} - -/* ObjectTypeAttributes */ -static UA_INLINE UA_StatusCode UA_ObjectTypeAttributes_encodeBinary(const UA_ObjectTypeAttributes *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ObjectTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ObjectTypeAttributes *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES], 0, NULL); -} - -/* VariableTypeAttributes */ -static UA_INLINE UA_StatusCode UA_VariableTypeAttributes_encodeBinary(const UA_VariableTypeAttributes *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_VariableTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_VariableTypeAttributes *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES], 0, NULL); -} - -/* ReferenceTypeAttributes */ -static UA_INLINE UA_StatusCode UA_ReferenceTypeAttributes_encodeBinary(const UA_ReferenceTypeAttributes *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ReferenceTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ReferenceTypeAttributes *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES], 0, NULL); -} - -/* DataTypeAttributes */ -static UA_INLINE UA_StatusCode UA_DataTypeAttributes_encodeBinary(const UA_DataTypeAttributes *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DataTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DataTypeAttributes *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES], 0, NULL); -} - -/* ViewAttributes */ -static UA_INLINE UA_StatusCode UA_ViewAttributes_encodeBinary(const UA_ViewAttributes *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ViewAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ViewAttributes *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES], 0, NULL); -} - -/* AddNodesItem */ -static UA_INLINE UA_StatusCode UA_AddNodesItem_encodeBinary(const UA_AddNodesItem *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESITEM], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_AddNodesItem_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_AddNodesItem *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESITEM], 0, NULL); -} - -/* AddNodesResult */ -static UA_INLINE UA_StatusCode UA_AddNodesResult_encodeBinary(const UA_AddNodesResult *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESRESULT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_AddNodesResult_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_AddNodesResult *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESRESULT], 0, NULL); -} - -/* AddNodesRequest */ -static UA_INLINE UA_StatusCode UA_AddNodesRequest_encodeBinary(const UA_AddNodesRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_AddNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_AddNodesRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESREQUEST], 0, NULL); -} - -/* AddNodesResponse */ -static UA_INLINE UA_StatusCode UA_AddNodesResponse_encodeBinary(const UA_AddNodesResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_AddNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_AddNodesResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE], 0, NULL); -} - -/* AddReferencesItem */ -static UA_INLINE UA_StatusCode UA_AddReferencesItem_encodeBinary(const UA_AddReferencesItem *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_AddReferencesItem_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_AddReferencesItem *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM], 0, NULL); -} - -/* AddReferencesRequest */ -static UA_INLINE UA_StatusCode UA_AddReferencesRequest_encodeBinary(const UA_AddReferencesRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_AddReferencesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_AddReferencesRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST], 0, NULL); -} - -/* AddReferencesResponse */ -static UA_INLINE UA_StatusCode UA_AddReferencesResponse_encodeBinary(const UA_AddReferencesResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_AddReferencesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_AddReferencesResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE], 0, NULL); -} - -/* DeleteNodesItem */ -static UA_INLINE UA_StatusCode UA_DeleteNodesItem_encodeBinary(const UA_DeleteNodesItem *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESITEM], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeleteNodesItem_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeleteNodesItem *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESITEM], 0, NULL); -} - -/* DeleteNodesRequest */ -static UA_INLINE UA_StatusCode UA_DeleteNodesRequest_encodeBinary(const UA_DeleteNodesRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeleteNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeleteNodesRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESREQUEST], 0, NULL); -} - -/* DeleteNodesResponse */ -static UA_INLINE UA_StatusCode UA_DeleteNodesResponse_encodeBinary(const UA_DeleteNodesResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeleteNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeleteNodesResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE], 0, NULL); -} - -/* DeleteReferencesItem */ -static UA_INLINE UA_StatusCode UA_DeleteReferencesItem_encodeBinary(const UA_DeleteReferencesItem *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeleteReferencesItem_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeleteReferencesItem *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM], 0, NULL); -} - -/* DeleteReferencesRequest */ -static UA_INLINE UA_StatusCode UA_DeleteReferencesRequest_encodeBinary(const UA_DeleteReferencesRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeleteReferencesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeleteReferencesRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST], 0, NULL); -} - -/* DeleteReferencesResponse */ -static UA_INLINE UA_StatusCode UA_DeleteReferencesResponse_encodeBinary(const UA_DeleteReferencesResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeleteReferencesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeleteReferencesResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE], 0, NULL); -} - -/* BrowseDirection */ -static UA_INLINE UA_StatusCode UA_BrowseDirection_encodeBinary(const UA_BrowseDirection *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEDIRECTION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowseDirection_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowseDirection *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEDIRECTION], 0, NULL); -} - -/* ViewDescription */ -static UA_INLINE UA_StatusCode UA_ViewDescription_encodeBinary(const UA_ViewDescription *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ViewDescription_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ViewDescription *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION], 0, NULL); -} - -/* BrowseDescription */ -static UA_INLINE UA_StatusCode UA_BrowseDescription_encodeBinary(const UA_BrowseDescription *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowseDescription_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowseDescription *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION], 0, NULL); -} - -/* BrowseResultMask */ -static UA_INLINE UA_StatusCode UA_BrowseResultMask_encodeBinary(const UA_BrowseResultMask *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESULTMASK], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowseResultMask_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowseResultMask *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESULTMASK], 0, NULL); -} - -/* ReferenceDescription */ -static UA_INLINE UA_StatusCode UA_ReferenceDescription_encodeBinary(const UA_ReferenceDescription *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ReferenceDescription_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ReferenceDescription *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION], 0, NULL); -} - -/* BrowseResult */ -static UA_INLINE UA_StatusCode UA_BrowseResult_encodeBinary(const UA_BrowseResult *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESULT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowseResult_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowseResult *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESULT], 0, NULL); -} - -/* BrowseRequest */ -static UA_INLINE UA_StatusCode UA_BrowseRequest_encodeBinary(const UA_BrowseRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowseRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowseRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEREQUEST], 0, NULL); -} - -/* BrowseResponse */ -static UA_INLINE UA_StatusCode UA_BrowseResponse_encodeBinary(const UA_BrowseResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowseResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowseResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESPONSE], 0, NULL); -} - -/* BrowseNextRequest */ -static UA_INLINE UA_StatusCode UA_BrowseNextRequest_encodeBinary(const UA_BrowseNextRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowseNextRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowseNextRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST], 0, NULL); -} - -/* BrowseNextResponse */ -static UA_INLINE UA_StatusCode UA_BrowseNextResponse_encodeBinary(const UA_BrowseNextResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowseNextResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowseNextResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE], 0, NULL); -} - -/* RelativePathElement */ -static UA_INLINE UA_StatusCode UA_RelativePathElement_encodeBinary(const UA_RelativePathElement *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RelativePathElement_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RelativePathElement *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT], 0, NULL); -} - -/* RelativePath */ -static UA_INLINE UA_StatusCode UA_RelativePath_encodeBinary(const UA_RelativePath *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RELATIVEPATH], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RelativePath_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RelativePath *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RELATIVEPATH], 0, NULL); -} - -/* BrowsePath */ -static UA_INLINE UA_StatusCode UA_BrowsePath_encodeBinary(const UA_BrowsePath *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATH], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowsePath_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowsePath *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATH], 0, NULL); -} - -/* BrowsePathTarget */ -static UA_INLINE UA_StatusCode UA_BrowsePathTarget_encodeBinary(const UA_BrowsePathTarget *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowsePathTarget_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowsePathTarget *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET], 0, NULL); -} - -/* BrowsePathResult */ -static UA_INLINE UA_StatusCode UA_BrowsePathResult_encodeBinary(const UA_BrowsePathResult *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BrowsePathResult_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_BrowsePathResult *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT], 0, NULL); -} - -/* TranslateBrowsePathsToNodeIdsRequest */ -static UA_INLINE UA_StatusCode UA_TranslateBrowsePathsToNodeIdsRequest_encodeBinary( - const UA_TranslateBrowsePathsToNodeIdsRequest *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_TranslateBrowsePathsToNodeIdsRequest_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_TranslateBrowsePathsToNodeIdsRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST], 0, NULL); -} - -/* TranslateBrowsePathsToNodeIdsResponse */ -static UA_INLINE UA_StatusCode UA_TranslateBrowsePathsToNodeIdsResponse_encodeBinary( - const UA_TranslateBrowsePathsToNodeIdsResponse *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_TranslateBrowsePathsToNodeIdsResponse_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_TranslateBrowsePathsToNodeIdsResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE], 0, NULL); -} - -/* RegisterNodesRequest */ -static UA_INLINE UA_StatusCode UA_RegisterNodesRequest_encodeBinary(const UA_RegisterNodesRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RegisterNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RegisterNodesRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST], 0, NULL); -} - -/* RegisterNodesResponse */ -static UA_INLINE UA_StatusCode UA_RegisterNodesResponse_encodeBinary(const UA_RegisterNodesResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RegisterNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RegisterNodesResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE], 0, NULL); -} - -/* UnregisterNodesRequest */ -static UA_INLINE UA_StatusCode UA_UnregisterNodesRequest_encodeBinary(const UA_UnregisterNodesRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_UnregisterNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_UnregisterNodesRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST], 0, NULL); -} - -/* UnregisterNodesResponse */ -static UA_INLINE UA_StatusCode UA_UnregisterNodesResponse_encodeBinary(const UA_UnregisterNodesResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_UnregisterNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_UnregisterNodesResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE], 0, NULL); -} - -/* QueryDataDescription */ -static UA_INLINE UA_StatusCode UA_QueryDataDescription_encodeBinary(const UA_QueryDataDescription *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_QueryDataDescription_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_QueryDataDescription *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION], 0, NULL); -} - -/* NodeTypeDescription */ -static UA_INLINE UA_StatusCode UA_NodeTypeDescription_encodeBinary(const UA_NodeTypeDescription *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_NodeTypeDescription_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_NodeTypeDescription *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION], 0, NULL); -} - -/* FilterOperator */ -static UA_INLINE UA_StatusCode UA_FilterOperator_encodeBinary(const UA_FilterOperator *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FILTEROPERATOR], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_FilterOperator_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_FilterOperator *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FILTEROPERATOR], 0, NULL); -} - -/* QueryDataSet */ -static UA_INLINE UA_StatusCode UA_QueryDataSet_encodeBinary(const UA_QueryDataSet *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYDATASET], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_QueryDataSet_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_QueryDataSet *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYDATASET], 0, NULL); -} - -/* ContentFilterElement */ -static UA_INLINE UA_StatusCode UA_ContentFilterElement_encodeBinary(const UA_ContentFilterElement *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ContentFilterElement_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ContentFilterElement *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT], 0, NULL); -} - -/* ContentFilter */ -static UA_INLINE UA_StatusCode UA_ContentFilter_encodeBinary(const UA_ContentFilter *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ContentFilter_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ContentFilter *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTER], 0, NULL); -} - -/* FilterOperand */ -static UA_INLINE UA_StatusCode UA_FilterOperand_encodeBinary(const UA_FilterOperand *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FILTEROPERAND], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_FilterOperand_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_FilterOperand *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FILTEROPERAND], 0, NULL); -} - -/* SimpleAttributeOperand */ -static UA_INLINE UA_StatusCode UA_SimpleAttributeOperand_encodeBinary(const UA_SimpleAttributeOperand *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SIMPLEATTRIBUTEOPERAND], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SimpleAttributeOperand_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SimpleAttributeOperand *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIMPLEATTRIBUTEOPERAND], 0, NULL); -} - -/* ContentFilterElementResult */ -static UA_INLINE UA_StatusCode UA_ContentFilterElementResult_encodeBinary(const UA_ContentFilterElementResult *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENTRESULT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ContentFilterElementResult_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ContentFilterElementResult *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENTRESULT], 0, NULL); -} - -/* ContentFilterResult */ -static UA_INLINE UA_StatusCode UA_ContentFilterResult_encodeBinary(const UA_ContentFilterResult *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ContentFilterResult_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ContentFilterResult *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT], 0, NULL); -} - -/* ParsingResult */ -static UA_INLINE UA_StatusCode UA_ParsingResult_encodeBinary(const UA_ParsingResult *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PARSINGRESULT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ParsingResult_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ParsingResult *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PARSINGRESULT], 0, NULL); -} - -/* QueryFirstRequest */ -static UA_INLINE UA_StatusCode UA_QueryFirstRequest_encodeBinary(const UA_QueryFirstRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_QueryFirstRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_QueryFirstRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST], 0, NULL); -} - -/* QueryFirstResponse */ -static UA_INLINE UA_StatusCode UA_QueryFirstResponse_encodeBinary(const UA_QueryFirstResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_QueryFirstResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_QueryFirstResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE], 0, NULL); -} - -/* QueryNextRequest */ -static UA_INLINE UA_StatusCode UA_QueryNextRequest_encodeBinary(const UA_QueryNextRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_QueryNextRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_QueryNextRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST], 0, NULL); -} - -/* QueryNextResponse */ -static UA_INLINE UA_StatusCode UA_QueryNextResponse_encodeBinary(const UA_QueryNextResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_QueryNextResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_QueryNextResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE], 0, NULL); -} - -/* TimestampsToReturn */ -static UA_INLINE UA_StatusCode UA_TimestampsToReturn_encodeBinary(const UA_TimestampsToReturn *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_TimestampsToReturn_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_TimestampsToReturn *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN], 0, NULL); -} - -/* ReadValueId */ -static UA_INLINE UA_StatusCode UA_ReadValueId_encodeBinary(const UA_ReadValueId *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READVALUEID], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ReadValueId_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ReadValueId *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READVALUEID], 0, NULL); -} - -/* ReadRequest */ -static UA_INLINE UA_StatusCode UA_ReadRequest_encodeBinary(const UA_ReadRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ReadRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ReadRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READREQUEST], 0, NULL); -} - -/* ReadResponse */ -static UA_INLINE UA_StatusCode UA_ReadResponse_encodeBinary(const UA_ReadResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ReadResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ReadResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READRESPONSE], 0, NULL); -} - -/* WriteValue */ -static UA_INLINE UA_StatusCode UA_WriteValue_encodeBinary(const UA_WriteValue *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITEVALUE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_WriteValue_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_WriteValue *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITEVALUE], 0, NULL); -} - -/* WriteRequest */ -static UA_INLINE UA_StatusCode UA_WriteRequest_encodeBinary(const UA_WriteRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITEREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_WriteRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_WriteRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITEREQUEST], 0, NULL); -} - -/* WriteResponse */ -static UA_INLINE UA_StatusCode UA_WriteResponse_encodeBinary(const UA_WriteResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITERESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_WriteResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_WriteResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITERESPONSE], 0, NULL); -} - -/* CallMethodRequest */ -static UA_INLINE UA_StatusCode UA_CallMethodRequest_encodeBinary(const UA_CallMethodRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CallMethodRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CallMethodRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST], 0, NULL); -} - -/* CallMethodResult */ -static UA_INLINE UA_StatusCode UA_CallMethodResult_encodeBinary(const UA_CallMethodResult *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLMETHODRESULT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CallMethodResult_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CallMethodResult *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLMETHODRESULT], 0, NULL); -} - -/* CallRequest */ -static UA_INLINE UA_StatusCode UA_CallRequest_encodeBinary(const UA_CallRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CallRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CallRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLREQUEST], 0, NULL); -} - -/* CallResponse */ -static UA_INLINE UA_StatusCode UA_CallResponse_encodeBinary(const UA_CallResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CallResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CallResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLRESPONSE], 0, NULL); -} - -/* MonitoringMode */ -static UA_INLINE UA_StatusCode UA_MonitoringMode_encodeBinary(const UA_MonitoringMode *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGMODE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MonitoringMode_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MonitoringMode *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGMODE], 0, NULL); -} - -/* DataChangeTrigger */ -static UA_INLINE UA_StatusCode UA_DataChangeTrigger_encodeBinary(const UA_DataChangeTrigger *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DataChangeTrigger_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DataChangeTrigger *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER], 0, NULL); -} - -/* DeadbandType */ -static UA_INLINE UA_StatusCode UA_DeadbandType_encodeBinary(const UA_DeadbandType *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DEADBANDTYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeadbandType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeadbandType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DEADBANDTYPE], 0, NULL); -} - -/* MonitoringFilter */ -static UA_INLINE UA_StatusCode UA_MonitoringFilter_encodeBinary(const UA_MonitoringFilter *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGFILTER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MonitoringFilter_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MonitoringFilter *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGFILTER], 0, NULL); -} - -/* DataChangeFilter */ -static UA_INLINE UA_StatusCode UA_DataChangeFilter_encodeBinary(const UA_DataChangeFilter *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGEFILTER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DataChangeFilter_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DataChangeFilter *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGEFILTER], 0, NULL); -} - -/* EventFilter */ -static UA_INLINE UA_StatusCode UA_EventFilter_encodeBinary(const UA_EventFilter *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EVENTFILTER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_EventFilter_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_EventFilter *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EVENTFILTER], 0, NULL); -} - -/* MonitoringParameters */ -static UA_INLINE UA_StatusCode UA_MonitoringParameters_encodeBinary(const UA_MonitoringParameters *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MonitoringParameters_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MonitoringParameters *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS], 0, NULL); -} - -/* MonitoredItemCreateRequest */ -static UA_INLINE UA_StatusCode UA_MonitoredItemCreateRequest_encodeBinary(const UA_MonitoredItemCreateRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MonitoredItemCreateRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MonitoredItemCreateRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST], 0, NULL); -} - -/* MonitoredItemCreateResult */ -static UA_INLINE UA_StatusCode UA_MonitoredItemCreateResult_encodeBinary(const UA_MonitoredItemCreateResult *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MonitoredItemCreateResult_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MonitoredItemCreateResult *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT], 0, NULL); -} - -/* CreateMonitoredItemsRequest */ -static UA_INLINE UA_StatusCode UA_CreateMonitoredItemsRequest_encodeBinary(const UA_CreateMonitoredItemsRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CreateMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CreateMonitoredItemsRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST], 0, NULL); -} - -/* CreateMonitoredItemsResponse */ -static UA_INLINE UA_StatusCode UA_CreateMonitoredItemsResponse_encodeBinary(const UA_CreateMonitoredItemsResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CreateMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CreateMonitoredItemsResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE], 0, NULL); -} - -/* MonitoredItemModifyRequest */ -static UA_INLINE UA_StatusCode UA_MonitoredItemModifyRequest_encodeBinary(const UA_MonitoredItemModifyRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MonitoredItemModifyRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MonitoredItemModifyRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST], 0, NULL); -} - -/* MonitoredItemModifyResult */ -static UA_INLINE UA_StatusCode UA_MonitoredItemModifyResult_encodeBinary(const UA_MonitoredItemModifyResult *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MonitoredItemModifyResult_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MonitoredItemModifyResult *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT], 0, NULL); -} - -/* ModifyMonitoredItemsRequest */ -static UA_INLINE UA_StatusCode UA_ModifyMonitoredItemsRequest_encodeBinary(const UA_ModifyMonitoredItemsRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ModifyMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ModifyMonitoredItemsRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST], 0, NULL); -} - -/* ModifyMonitoredItemsResponse */ -static UA_INLINE UA_StatusCode UA_ModifyMonitoredItemsResponse_encodeBinary(const UA_ModifyMonitoredItemsResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ModifyMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ModifyMonitoredItemsResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE], 0, NULL); -} - -/* SetMonitoringModeRequest */ -static UA_INLINE UA_StatusCode UA_SetMonitoringModeRequest_encodeBinary(const UA_SetMonitoringModeRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SetMonitoringModeRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SetMonitoringModeRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST], 0, NULL); -} - -/* SetMonitoringModeResponse */ -static UA_INLINE UA_StatusCode UA_SetMonitoringModeResponse_encodeBinary(const UA_SetMonitoringModeResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SetMonitoringModeResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SetMonitoringModeResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE], 0, NULL); -} - -/* DeleteMonitoredItemsRequest */ -static UA_INLINE UA_StatusCode UA_DeleteMonitoredItemsRequest_encodeBinary(const UA_DeleteMonitoredItemsRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeleteMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeleteMonitoredItemsRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST], 0, NULL); -} - -/* DeleteMonitoredItemsResponse */ -static UA_INLINE UA_StatusCode UA_DeleteMonitoredItemsResponse_encodeBinary(const UA_DeleteMonitoredItemsResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeleteMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeleteMonitoredItemsResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE], 0, NULL); -} - -/* CreateSubscriptionRequest */ -static UA_INLINE UA_StatusCode UA_CreateSubscriptionRequest_encodeBinary(const UA_CreateSubscriptionRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CreateSubscriptionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CreateSubscriptionRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST], 0, NULL); -} - -/* CreateSubscriptionResponse */ -static UA_INLINE UA_StatusCode UA_CreateSubscriptionResponse_encodeBinary(const UA_CreateSubscriptionResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_CreateSubscriptionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_CreateSubscriptionResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE], 0, NULL); -} - -/* ModifySubscriptionRequest */ -static UA_INLINE UA_StatusCode UA_ModifySubscriptionRequest_encodeBinary(const UA_ModifySubscriptionRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ModifySubscriptionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ModifySubscriptionRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST], 0, NULL); -} - -/* ModifySubscriptionResponse */ -static UA_INLINE UA_StatusCode UA_ModifySubscriptionResponse_encodeBinary(const UA_ModifySubscriptionResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ModifySubscriptionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ModifySubscriptionResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE], 0, NULL); -} - -/* SetPublishingModeRequest */ -static UA_INLINE UA_StatusCode UA_SetPublishingModeRequest_encodeBinary(const UA_SetPublishingModeRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SetPublishingModeRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SetPublishingModeRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST], 0, NULL); -} - -/* SetPublishingModeResponse */ -static UA_INLINE UA_StatusCode UA_SetPublishingModeResponse_encodeBinary(const UA_SetPublishingModeResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SetPublishingModeResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SetPublishingModeResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE], 0, NULL); -} - -/* NotificationMessage */ -static UA_INLINE UA_StatusCode UA_NotificationMessage_encodeBinary(const UA_NotificationMessage *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_NotificationMessage_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_NotificationMessage *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE], 0, NULL); -} - -/* MonitoredItemNotification */ -static UA_INLINE UA_StatusCode UA_MonitoredItemNotification_encodeBinary(const UA_MonitoredItemNotification *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MonitoredItemNotification_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MonitoredItemNotification *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION], 0, NULL); -} - -/* EventFieldList */ -static UA_INLINE UA_StatusCode UA_EventFieldList_encodeBinary(const UA_EventFieldList *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EVENTFIELDLIST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_EventFieldList_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_EventFieldList *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EVENTFIELDLIST], 0, NULL); -} - -/* StatusChangeNotification */ -static UA_INLINE UA_StatusCode UA_StatusChangeNotification_encodeBinary(const UA_StatusChangeNotification *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STATUSCHANGENOTIFICATION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_StatusChangeNotification_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_StatusChangeNotification *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STATUSCHANGENOTIFICATION], 0, NULL); -} - -/* SubscriptionAcknowledgement */ -static UA_INLINE UA_StatusCode UA_SubscriptionAcknowledgement_encodeBinary(const UA_SubscriptionAcknowledgement *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SubscriptionAcknowledgement_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SubscriptionAcknowledgement *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT], 0, NULL); -} - -/* PublishRequest */ -static UA_INLINE UA_StatusCode UA_PublishRequest_encodeBinary(const UA_PublishRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PUBLISHREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_PublishRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_PublishRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PUBLISHREQUEST], 0, NULL); -} - -/* PublishResponse */ -static UA_INLINE UA_StatusCode UA_PublishResponse_encodeBinary(const UA_PublishResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_PublishResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_PublishResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE], 0, NULL); -} - -/* RepublishRequest */ -static UA_INLINE UA_StatusCode UA_RepublishRequest_encodeBinary(const UA_RepublishRequest *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RepublishRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RepublishRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST], 0, NULL); -} - -/* RepublishResponse */ -static UA_INLINE UA_StatusCode UA_RepublishResponse_encodeBinary(const UA_RepublishResponse *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RepublishResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RepublishResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE], 0, NULL); -} - -/* DeleteSubscriptionsRequest */ -static UA_INLINE UA_StatusCode UA_DeleteSubscriptionsRequest_encodeBinary(const UA_DeleteSubscriptionsRequest *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeleteSubscriptionsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeleteSubscriptionsRequest *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST], 0, NULL); -} - -/* DeleteSubscriptionsResponse */ -static UA_INLINE UA_StatusCode UA_DeleteSubscriptionsResponse_encodeBinary(const UA_DeleteSubscriptionsResponse *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DeleteSubscriptionsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DeleteSubscriptionsResponse *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE], 0, NULL); -} - -/* BuildInfo */ -static UA_INLINE UA_StatusCode UA_BuildInfo_encodeBinary(const UA_BuildInfo *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BUILDINFO], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_BuildInfo_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BuildInfo *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BUILDINFO], 0, NULL); -} - -/* RedundancySupport */ -static UA_INLINE UA_StatusCode UA_RedundancySupport_encodeBinary(const UA_RedundancySupport *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RedundancySupport_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RedundancySupport *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT], 0, NULL); -} - -/* ServerState */ -static UA_INLINE UA_StatusCode UA_ServerState_encodeBinary(const UA_ServerState *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERSTATE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ServerState_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ServerState *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERSTATE], 0, NULL); -} - -/* RedundantServerDataType */ -static UA_INLINE UA_StatusCode UA_RedundantServerDataType_encodeBinary(const UA_RedundantServerDataType *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REDUNDANTSERVERDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_RedundantServerDataType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_RedundantServerDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REDUNDANTSERVERDATATYPE], 0, NULL); -} - -/* EndpointUrlListDataType */ -static UA_INLINE UA_StatusCode UA_EndpointUrlListDataType_encodeBinary(const UA_EndpointUrlListDataType *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ENDPOINTURLLISTDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_EndpointUrlListDataType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_EndpointUrlListDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ENDPOINTURLLISTDATATYPE], 0, NULL); -} - -/* NetworkGroupDataType */ -static UA_INLINE UA_StatusCode UA_NetworkGroupDataType_encodeBinary(const UA_NetworkGroupDataType *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NETWORKGROUPDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_NetworkGroupDataType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_NetworkGroupDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NETWORKGROUPDATATYPE], 0, NULL); -} - -/* ServerDiagnosticsSummaryDataType */ -static UA_INLINE UA_StatusCode UA_ServerDiagnosticsSummaryDataType_encodeBinary( - const UA_ServerDiagnosticsSummaryDataType *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERDIAGNOSTICSSUMMARYDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ServerDiagnosticsSummaryDataType_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_ServerDiagnosticsSummaryDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERDIAGNOSTICSSUMMARYDATATYPE], 0, NULL); -} - -/* ServerStatusDataType */ -static UA_INLINE UA_StatusCode UA_ServerStatusDataType_encodeBinary(const UA_ServerStatusDataType *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ServerStatusDataType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ServerStatusDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE], 0, NULL); -} - -/* SessionSecurityDiagnosticsDataType */ -static UA_INLINE UA_StatusCode UA_SessionSecurityDiagnosticsDataType_encodeBinary( - const UA_SessionSecurityDiagnosticsDataType *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SESSIONSECURITYDIAGNOSTICSDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SessionSecurityDiagnosticsDataType_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_SessionSecurityDiagnosticsDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SESSIONSECURITYDIAGNOSTICSDATATYPE], 0, NULL); -} - -/* ServiceCounterDataType */ -static UA_INLINE UA_StatusCode UA_ServiceCounterDataType_encodeBinary(const UA_ServiceCounterDataType *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVICECOUNTERDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ServiceCounterDataType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ServiceCounterDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVICECOUNTERDATATYPE], 0, NULL); -} - -/* SubscriptionDiagnosticsDataType */ -static UA_INLINE UA_StatusCode UA_SubscriptionDiagnosticsDataType_encodeBinary( - const UA_SubscriptionDiagnosticsDataType *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SUBSCRIPTIONDIAGNOSTICSDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SubscriptionDiagnosticsDataType_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_SubscriptionDiagnosticsDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SUBSCRIPTIONDIAGNOSTICSDATATYPE], 0, NULL); -} - -/* ModelChangeStructureDataType */ -static UA_INLINE UA_StatusCode UA_ModelChangeStructureDataType_encodeBinary(const UA_ModelChangeStructureDataType *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MODELCHANGESTRUCTUREDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ModelChangeStructureDataType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_ModelChangeStructureDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODELCHANGESTRUCTUREDATATYPE], 0, NULL); -} - -/* SemanticChangeStructureDataType */ -static UA_INLINE UA_StatusCode UA_SemanticChangeStructureDataType_encodeBinary( - const UA_SemanticChangeStructureDataType *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SEMANTICCHANGESTRUCTUREDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SemanticChangeStructureDataType_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_SemanticChangeStructureDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SEMANTICCHANGESTRUCTUREDATATYPE], 0, NULL); -} - -/* DataChangeNotification */ -static UA_INLINE UA_StatusCode UA_DataChangeNotification_encodeBinary(const UA_DataChangeNotification *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_DataChangeNotification_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_DataChangeNotification *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION], 0, NULL); -} - -/* EventNotificationList */ -static UA_INLINE UA_StatusCode UA_EventNotificationList_encodeBinary(const UA_EventNotificationList *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EVENTNOTIFICATIONLIST], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_EventNotificationList_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_EventNotificationList *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EVENTNOTIFICATIONLIST], 0, NULL); -} - -/* SessionDiagnosticsDataType */ -static UA_INLINE UA_StatusCode UA_SessionDiagnosticsDataType_encodeBinary(const UA_SessionDiagnosticsDataType *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SESSIONDIAGNOSTICSDATATYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SessionDiagnosticsDataType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SessionDiagnosticsDataType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SESSIONDIAGNOSTICSDATATYPE], 0, NULL); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_transport_generated.h" - * ***********************************/ - -/* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script - * /home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/tools/generate_datatypes.py - * on host nmpc by user max at 2018-01-05 04:21:09 */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Every type is assigned an index in an array containing the type descriptions. - * These descriptions are used during type handling (copying, deletion, - * binary encoding, ...). */ -#define UA_TRANSPORT_COUNT 12 -extern UA_EXPORT const UA_DataType UA_TRANSPORT[UA_TRANSPORT_COUNT]; - -/** - * MessageType - * ^^^^^^^^^^^ - * Message Type and whether the message contains an intermediate chunk */ -typedef enum { - UA_MESSAGETYPE_ACK = 0x4B4341, - UA_MESSAGETYPE_HEL = 0x4C4548, - UA_MESSAGETYPE_MSG = 0x47534D, - UA_MESSAGETYPE_OPN = 0x4E504F, - UA_MESSAGETYPE_CLO = 0x4F4C43, - UA_MESSAGETYPE_ERR = 0x525245, - __UA_MESSAGETYPE_FORCE32BIT = 0x7fffffff -} UA_MessageType; -UA_STATIC_ASSERT(sizeof(UA_MessageType) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TRANSPORT_MESSAGETYPE 0 - -/** - * ChunkType - * ^^^^^^^^^ - * Type of the chunk */ -typedef enum { - UA_CHUNKTYPE_FINAL = 0x46000000, - UA_CHUNKTYPE_INTERMEDIATE = 0x43000000, - UA_CHUNKTYPE_ABORT = 0x41000000, - __UA_CHUNKTYPE_FORCE32BIT = 0x7fffffff -} UA_ChunkType; -UA_STATIC_ASSERT(sizeof(UA_ChunkType) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TRANSPORT_CHUNKTYPE 1 - -/** - * TcpMessageHeader - * ^^^^^^^^^^^^^^^^ - * TCP Header */ -typedef struct { - UA_UInt32 messageTypeAndChunkType; - UA_UInt32 messageSize; -} UA_TcpMessageHeader; - -#define UA_TRANSPORT_TCPMESSAGEHEADER 2 - -/** - * TcpHelloMessage - * ^^^^^^^^^^^^^^^ - * Hello Message */ -typedef struct { - UA_UInt32 protocolVersion; - UA_UInt32 receiveBufferSize; - UA_UInt32 sendBufferSize; - UA_UInt32 maxMessageSize; - UA_UInt32 maxChunkCount; - UA_String endpointUrl; -} UA_TcpHelloMessage; - -#define UA_TRANSPORT_TCPHELLOMESSAGE 3 - -/** - * TcpAcknowledgeMessage - * ^^^^^^^^^^^^^^^^^^^^^ - * Acknowledge Message */ -typedef struct { - UA_UInt32 protocolVersion; - UA_UInt32 receiveBufferSize; - UA_UInt32 sendBufferSize; - UA_UInt32 maxMessageSize; - UA_UInt32 maxChunkCount; -} UA_TcpAcknowledgeMessage; - -#define UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE 4 - -/** - * TcpErrorMessage - * ^^^^^^^^^^^^^^^ - * Error Message */ -typedef struct { - UA_UInt32 error; - UA_String reason; -} UA_TcpErrorMessage; - -#define UA_TRANSPORT_TCPERRORMESSAGE 5 - -/** - * SecureConversationMessageHeader - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Secure Layer Sequence Header */ -typedef struct { - UA_TcpMessageHeader messageHeader; - UA_UInt32 secureChannelId; -} UA_SecureConversationMessageHeader; - -#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER 6 - -/** - * AsymmetricAlgorithmSecurityHeader - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Security Header */ -typedef struct { - UA_ByteString securityPolicyUri; - UA_ByteString senderCertificate; - UA_ByteString receiverCertificateThumbprint; -} UA_AsymmetricAlgorithmSecurityHeader; - -#define UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER 7 - -/** - * SymmetricAlgorithmSecurityHeader - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Secure Layer Symmetric Algorithm Header */ -typedef struct { UA_UInt32 tokenId; } UA_SymmetricAlgorithmSecurityHeader; - -#define UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER 8 - -/** - * SequenceHeader - * ^^^^^^^^^^^^^^ - * Secure Layer Sequence Header */ -typedef struct { - UA_UInt32 sequenceNumber; - UA_UInt32 requestId; -} UA_SequenceHeader; - -#define UA_TRANSPORT_SEQUENCEHEADER 9 - -/** - * SecureConversationMessageFooter - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Secure Conversation Message Footer */ -typedef struct { - size_t paddingSize; - UA_Byte *padding; - UA_Byte signature; -} UA_SecureConversationMessageFooter; - -#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER 10 - -/** - * SecureConversationMessageAbortBody - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Secure Conversation Message Abort Body */ -typedef struct { - UA_UInt32 error; - UA_String reason; -} UA_SecureConversationMessageAbortBody; - -#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY 11 - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_transport_generated_handling.h" - * ***********************************/ - -/* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script - * /home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/tools/generate_datatypes.py - * on host nmpc by user max at 2018-01-05 04:21:09 */ - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#pragma GCC diagnostic ignored "-Wmissing-braces" -#endif - -/* MessageType */ -static UA_INLINE void UA_MessageType_init(UA_MessageType *p) { memset(p, 0, sizeof(UA_MessageType)); } - -static UA_INLINE UA_MessageType *UA_MessageType_new(void) { - return (UA_MessageType *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]); -} - -static UA_INLINE UA_StatusCode UA_MessageType_copy(const UA_MessageType *src, UA_MessageType *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void UA_MessageType_deleteMembers(UA_MessageType *p) {} - -static UA_INLINE void UA_MessageType_delete(UA_MessageType *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]); -} - -/* ChunkType */ -static UA_INLINE void UA_ChunkType_init(UA_ChunkType *p) { memset(p, 0, sizeof(UA_ChunkType)); } - -static UA_INLINE UA_ChunkType *UA_ChunkType_new(void) { - return (UA_ChunkType *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]); -} - -static UA_INLINE UA_StatusCode UA_ChunkType_copy(const UA_ChunkType *src, UA_ChunkType *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void UA_ChunkType_deleteMembers(UA_ChunkType *p) {} - -static UA_INLINE void UA_ChunkType_delete(UA_ChunkType *p) { UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]); } - -/* TcpMessageHeader */ -static UA_INLINE void UA_TcpMessageHeader_init(UA_TcpMessageHeader *p) { memset(p, 0, sizeof(UA_TcpMessageHeader)); } - -static UA_INLINE UA_TcpMessageHeader *UA_TcpMessageHeader_new(void) { - return (UA_TcpMessageHeader *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]); -} - -static UA_INLINE UA_StatusCode UA_TcpMessageHeader_copy(const UA_TcpMessageHeader *src, UA_TcpMessageHeader *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void UA_TcpMessageHeader_deleteMembers(UA_TcpMessageHeader *p) {} - -static UA_INLINE void UA_TcpMessageHeader_delete(UA_TcpMessageHeader *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]); -} - -/* TcpHelloMessage */ -static UA_INLINE void UA_TcpHelloMessage_init(UA_TcpHelloMessage *p) { memset(p, 0, sizeof(UA_TcpHelloMessage)); } - -static UA_INLINE UA_TcpHelloMessage *UA_TcpHelloMessage_new(void) { - return (UA_TcpHelloMessage *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]); -} - -static UA_INLINE UA_StatusCode UA_TcpHelloMessage_copy(const UA_TcpHelloMessage *src, UA_TcpHelloMessage *dst) { - return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]); -} - -static UA_INLINE void UA_TcpHelloMessage_deleteMembers(UA_TcpHelloMessage *p) { - UA_deleteMembers(p, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]); -} - -static UA_INLINE void UA_TcpHelloMessage_delete(UA_TcpHelloMessage *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]); -} - -/* TcpAcknowledgeMessage */ -static UA_INLINE void UA_TcpAcknowledgeMessage_init(UA_TcpAcknowledgeMessage *p) { - memset(p, 0, sizeof(UA_TcpAcknowledgeMessage)); -} - -static UA_INLINE UA_TcpAcknowledgeMessage *UA_TcpAcknowledgeMessage_new(void) { - return (UA_TcpAcknowledgeMessage *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE]); -} - -static UA_INLINE UA_StatusCode UA_TcpAcknowledgeMessage_copy(const UA_TcpAcknowledgeMessage *src, - UA_TcpAcknowledgeMessage *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void UA_TcpAcknowledgeMessage_deleteMembers(UA_TcpAcknowledgeMessage *p) {} - -static UA_INLINE void UA_TcpAcknowledgeMessage_delete(UA_TcpAcknowledgeMessage *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE]); -} - -/* TcpErrorMessage */ -static UA_INLINE void UA_TcpErrorMessage_init(UA_TcpErrorMessage *p) { memset(p, 0, sizeof(UA_TcpErrorMessage)); } - -static UA_INLINE UA_TcpErrorMessage *UA_TcpErrorMessage_new(void) { - return (UA_TcpErrorMessage *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]); -} - -static UA_INLINE UA_StatusCode UA_TcpErrorMessage_copy(const UA_TcpErrorMessage *src, UA_TcpErrorMessage *dst) { - return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]); -} - -static UA_INLINE void UA_TcpErrorMessage_deleteMembers(UA_TcpErrorMessage *p) { - UA_deleteMembers(p, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]); -} - -static UA_INLINE void UA_TcpErrorMessage_delete(UA_TcpErrorMessage *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]); -} - -/* SecureConversationMessageHeader */ -static UA_INLINE void UA_SecureConversationMessageHeader_init(UA_SecureConversationMessageHeader *p) { - memset(p, 0, sizeof(UA_SecureConversationMessageHeader)); -} - -static UA_INLINE UA_SecureConversationMessageHeader *UA_SecureConversationMessageHeader_new(void) { - return (UA_SecureConversationMessageHeader *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER]); -} - -static UA_INLINE UA_StatusCode UA_SecureConversationMessageHeader_copy(const UA_SecureConversationMessageHeader *src, - UA_SecureConversationMessageHeader *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void UA_SecureConversationMessageHeader_deleteMembers(UA_SecureConversationMessageHeader *p) {} - -static UA_INLINE void UA_SecureConversationMessageHeader_delete(UA_SecureConversationMessageHeader *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER]); -} - -/* AsymmetricAlgorithmSecurityHeader */ -static UA_INLINE void UA_AsymmetricAlgorithmSecurityHeader_init(UA_AsymmetricAlgorithmSecurityHeader *p) { - memset(p, 0, sizeof(UA_AsymmetricAlgorithmSecurityHeader)); -} - -static UA_INLINE UA_AsymmetricAlgorithmSecurityHeader *UA_AsymmetricAlgorithmSecurityHeader_new(void) { - return (UA_AsymmetricAlgorithmSecurityHeader *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]); -} - -static UA_INLINE UA_StatusCode UA_AsymmetricAlgorithmSecurityHeader_copy( - const UA_AsymmetricAlgorithmSecurityHeader *src, UA_AsymmetricAlgorithmSecurityHeader *dst) { - return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]); -} - -static UA_INLINE void UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(UA_AsymmetricAlgorithmSecurityHeader *p) { - UA_deleteMembers(p, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]); -} - -static UA_INLINE void UA_AsymmetricAlgorithmSecurityHeader_delete(UA_AsymmetricAlgorithmSecurityHeader *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]); -} - -/* SymmetricAlgorithmSecurityHeader */ -static UA_INLINE void UA_SymmetricAlgorithmSecurityHeader_init(UA_SymmetricAlgorithmSecurityHeader *p) { - memset(p, 0, sizeof(UA_SymmetricAlgorithmSecurityHeader)); -} - -static UA_INLINE UA_SymmetricAlgorithmSecurityHeader *UA_SymmetricAlgorithmSecurityHeader_new(void) { - return (UA_SymmetricAlgorithmSecurityHeader *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER]); -} - -static UA_INLINE UA_StatusCode UA_SymmetricAlgorithmSecurityHeader_copy(const UA_SymmetricAlgorithmSecurityHeader *src, - UA_SymmetricAlgorithmSecurityHeader *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void UA_SymmetricAlgorithmSecurityHeader_deleteMembers(UA_SymmetricAlgorithmSecurityHeader *p) {} - -static UA_INLINE void UA_SymmetricAlgorithmSecurityHeader_delete(UA_SymmetricAlgorithmSecurityHeader *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER]); -} - -/* SequenceHeader */ -static UA_INLINE void UA_SequenceHeader_init(UA_SequenceHeader *p) { memset(p, 0, sizeof(UA_SequenceHeader)); } - -static UA_INLINE UA_SequenceHeader *UA_SequenceHeader_new(void) { - return (UA_SequenceHeader *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]); -} - -static UA_INLINE UA_StatusCode UA_SequenceHeader_copy(const UA_SequenceHeader *src, UA_SequenceHeader *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void UA_SequenceHeader_deleteMembers(UA_SequenceHeader *p) {} - -static UA_INLINE void UA_SequenceHeader_delete(UA_SequenceHeader *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]); -} - -/* SecureConversationMessageFooter */ -static UA_INLINE void UA_SecureConversationMessageFooter_init(UA_SecureConversationMessageFooter *p) { - memset(p, 0, sizeof(UA_SecureConversationMessageFooter)); -} - -static UA_INLINE UA_SecureConversationMessageFooter *UA_SecureConversationMessageFooter_new(void) { - return (UA_SecureConversationMessageFooter *)UA_new(&UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]); -} - -static UA_INLINE UA_StatusCode UA_SecureConversationMessageFooter_copy(const UA_SecureConversationMessageFooter *src, - UA_SecureConversationMessageFooter *dst) { - return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]); -} - -static UA_INLINE void UA_SecureConversationMessageFooter_deleteMembers(UA_SecureConversationMessageFooter *p) { - UA_deleteMembers(p, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]); -} - -static UA_INLINE void UA_SecureConversationMessageFooter_delete(UA_SecureConversationMessageFooter *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]); -} - -/* SecureConversationMessageAbortBody */ -static UA_INLINE void UA_SecureConversationMessageAbortBody_init(UA_SecureConversationMessageAbortBody *p) { - memset(p, 0, sizeof(UA_SecureConversationMessageAbortBody)); -} - -static UA_INLINE UA_SecureConversationMessageAbortBody *UA_SecureConversationMessageAbortBody_new(void) { - return (UA_SecureConversationMessageAbortBody *)UA_new( - &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]); -} - -static UA_INLINE UA_StatusCode UA_SecureConversationMessageAbortBody_copy( - const UA_SecureConversationMessageAbortBody *src, UA_SecureConversationMessageAbortBody *dst) { - return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]); -} - -static UA_INLINE void UA_SecureConversationMessageAbortBody_deleteMembers(UA_SecureConversationMessageAbortBody *p) { - UA_deleteMembers(p, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]); -} - -static UA_INLINE void UA_SecureConversationMessageAbortBody_delete(UA_SecureConversationMessageAbortBody *p) { - UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]); -} - -#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 -#pragma GCC diagnostic pop -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_transport_generated_encoding_binary.h" - * ***********************************/ - -/* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script - * /home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/tools/generate_datatypes.py - * on host nmpc by user max at 2018-01-05 04:21:09 */ - -/* MessageType */ -static UA_INLINE UA_StatusCode UA_MessageType_encodeBinary(const UA_MessageType *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_MessageType_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_MessageType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE], 0, NULL); -} - -/* ChunkType */ -static UA_INLINE UA_StatusCode UA_ChunkType_encodeBinary(const UA_ChunkType *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_ChunkType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ChunkType *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE], 0, NULL); -} - -/* TcpMessageHeader */ -static UA_INLINE UA_StatusCode UA_TcpMessageHeader_encodeBinary(const UA_TcpMessageHeader *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_TcpMessageHeader_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_TcpMessageHeader *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER], 0, NULL); -} - -/* TcpHelloMessage */ -static UA_INLINE UA_StatusCode UA_TcpHelloMessage_encodeBinary(const UA_TcpHelloMessage *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_TcpHelloMessage_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_TcpHelloMessage *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE], 0, NULL); -} - -/* TcpAcknowledgeMessage */ -static UA_INLINE UA_StatusCode UA_TcpAcknowledgeMessage_encodeBinary(const UA_TcpAcknowledgeMessage *src, - UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_TcpAcknowledgeMessage_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_TcpAcknowledgeMessage *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE], 0, NULL); -} - -/* TcpErrorMessage */ -static UA_INLINE UA_StatusCode UA_TcpErrorMessage_encodeBinary(const UA_TcpErrorMessage *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_TcpErrorMessage_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_TcpErrorMessage *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE], 0, NULL); -} - -/* SecureConversationMessageHeader */ -static UA_INLINE UA_StatusCode UA_SecureConversationMessageHeader_encodeBinary( - const UA_SecureConversationMessageHeader *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SecureConversationMessageHeader_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageHeader *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER], 0, NULL); -} - -/* AsymmetricAlgorithmSecurityHeader */ -static UA_INLINE UA_StatusCode UA_AsymmetricAlgorithmSecurityHeader_encodeBinary( - const UA_AsymmetricAlgorithmSecurityHeader *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER], bufPos, bufEnd, NULL, - NULL); -} -static UA_INLINE UA_StatusCode UA_AsymmetricAlgorithmSecurityHeader_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_AsymmetricAlgorithmSecurityHeader *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER], 0, NULL); -} - -/* SymmetricAlgorithmSecurityHeader */ -static UA_INLINE UA_StatusCode UA_SymmetricAlgorithmSecurityHeader_encodeBinary( - const UA_SymmetricAlgorithmSecurityHeader *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SymmetricAlgorithmSecurityHeader_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_SymmetricAlgorithmSecurityHeader *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER], 0, NULL); -} - -/* SequenceHeader */ -static UA_INLINE UA_StatusCode UA_SequenceHeader_encodeBinary(const UA_SequenceHeader *src, UA_Byte **bufPos, - const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SequenceHeader_decodeBinary(const UA_ByteString *src, size_t *offset, - UA_SequenceHeader *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER], 0, NULL); -} - -/* SecureConversationMessageFooter */ -static UA_INLINE UA_StatusCode UA_SecureConversationMessageFooter_encodeBinary( - const UA_SecureConversationMessageFooter *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER], bufPos, bufEnd, NULL, NULL); -} -static UA_INLINE UA_StatusCode UA_SecureConversationMessageFooter_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageFooter *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER], 0, NULL); -} - -/* SecureConversationMessageAbortBody */ -static UA_INLINE UA_StatusCode UA_SecureConversationMessageAbortBody_encodeBinary( - const UA_SecureConversationMessageAbortBody *src, UA_Byte **bufPos, const UA_Byte **bufEnd) { - return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY], bufPos, bufEnd, NULL, - NULL); -} -static UA_INLINE UA_StatusCode UA_SecureConversationMessageAbortBody_decodeBinary( - const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageAbortBody *dst) { - return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY], 0, NULL); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_connection_internal.h" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* The application can be the client or the server */ -typedef UA_StatusCode (*UA_Connection_processChunk)(void *application, UA_Connection *connection, UA_ByteString *chunk); - -/* The network layer may receive chopped up messages since TCP is a streaming - * protocol. This method calls the processChunk callback on all full chunks that - * were received. Dangling half-complete chunks are buffered in the connection - * and considered for the next received packet. - * - * If an entire chunk is received, it is forwarded directly. But the memory - * needs to be freed with the networklayer-specific mechanism. If a half message - * is received, we copy it into a local buffer. Then, the stack-specific free - * needs to be used. - * - * @param connection The connection - * @param application The client or server application - * @param processCallback The function pointer for processing each chunk - * @param packet The received packet. - * @return Returns UA_STATUSCODE_GOOD or an error code. When an error occurs, - * the ingoing message and the current buffer in the connection are - * freed. */ -UA_StatusCode UA_Connection_processChunks(UA_Connection *connection, void *application, - UA_Connection_processChunk processCallback, const UA_ByteString *packet); - -/* Try to receive at least one complete chunk on the connection. This blocks the - * current thread up to the given timeout. - * - * @param connection The connection - * @param application The client or server application - * @param processCallback The function pointer for processing each chunk - * @param timeout The timeout (in milliseconds) the method will block at most. - * @return Returns UA_STATUSCODE_GOOD or an error code. When an timeout occurs, - * UA_STATUSCODE_GOODNONCRITICALTIMEOUT is returned. */ -UA_StatusCode UA_Connection_receiveChunksBlocking(UA_Connection *connection, void *application, - UA_Connection_processChunk processCallback, UA_UInt32 timeout); - -/* When a fatal error occurs the Server shall send an Error Message to the - * Client and close the socket. When a Client encounters one of these errors, it - * shall also close the socket but does not send an Error Message. After the - * socket is closed a Client shall try to reconnect automatically using the - * mechanisms described in [...]. */ -void UA_Connection_sendError(UA_Connection *connection, UA_TcpErrorMessage *error); - -void UA_Connection_detachSecureChannel(UA_Connection *connection); -void UA_Connection_attachSecureChannel(UA_Connection *connection, UA_SecureChannel *channel); - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_securechannel.h" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define UA_SECURE_CONVERSATION_MESSAGE_HEADER_LENGTH 12 -#define UA_SECURE_MESSAGE_HEADER_LENGTH 24 - -#ifdef UA_ENABLE_UNIT_TEST_FAILURE_HOOKS -extern UA_THREAD_LOCAL UA_StatusCode decrypt_verifySignatureFailure; -extern UA_THREAD_LOCAL UA_StatusCode sendAsym_sendFailure; -extern UA_THREAD_LOCAL UA_StatusCode processSym_seqNumberFailure; -#endif - -struct UA_Session; -typedef struct UA_Session UA_Session; - -struct SessionEntry { - LIST_ENTRY(SessionEntry) pointers; - UA_Session *session; // Just a pointer. The session is held in the session manager or the client -}; - -/* For chunked requests */ -struct ChunkEntry { - LIST_ENTRY(ChunkEntry) pointers; - UA_UInt32 requestId; - UA_ByteString bytes; -}; - -typedef enum { - UA_SECURECHANNELSTATE_FRESH, - UA_SECURECHANNELSTATE_OPEN, - UA_SECURECHANNELSTATE_CLOSED -} UA_SecureChannelState; - -struct UA_SecureChannel { - UA_SecureChannelState state; - UA_MessageSecurityMode securityMode; - UA_ChannelSecurityToken securityToken; /* the channelId is contained in the securityToken */ - UA_ChannelSecurityToken nextSecurityToken; - - /* The endpoint and context of the channel */ - const UA_SecurityPolicy *securityPolicy; - void *channelContext; /* For interaction with the security policy */ - UA_Connection *connection; - - /* Asymmetric encryption info */ - UA_ByteString remoteCertificate; - UA_Byte remoteCertificateThumbprint[20]; /* The thumbprint of the remote certificate */ - - /* Symmetric encryption info */ - UA_ByteString remoteNonce; - UA_ByteString localNonce; - - UA_UInt32 receiveSequenceNumber; - UA_UInt32 sendSequenceNumber; - - LIST_HEAD(session_pointerlist, SessionEntry) sessions; - LIST_HEAD(chunk_pointerlist, ChunkEntry) chunks; -}; - -UA_StatusCode UA_SecureChannel_init(UA_SecureChannel *channel, const UA_SecurityPolicy *securityPolicy, - const UA_ByteString *remoteCertificate); -void UA_SecureChannel_deleteMembersCleanup(UA_SecureChannel *channel); - -/* Generates new keys and sets them in the channel context */ -UA_StatusCode UA_SecureChannel_generateNewKeys(UA_SecureChannel *const channel); - -/* Wrapper function for generating nonces for the supplied channel. - * - * Uses the random generator of the channels security policy to allocate - * and generate a nonce with the specified length. - * - * \param channel the channel to use. - * \param nonceLength the length of the nonce to be generated. - * \param nonce will contain the nonce after being successfully called. - */ -UA_StatusCode UA_SecureChannel_generateNonce(const UA_SecureChannel *const channel, const size_t nonceLength, - UA_ByteString *const nonce); - -void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session); -void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session); -UA_Session *UA_SecureChannel_getSession(UA_SecureChannel *channel, UA_NodeId *token); -UA_StatusCode UA_SecureChannel_revolveTokens(UA_SecureChannel *channel); - -/** - * Sending Messages - * ---------------- */ - -UA_StatusCode UA_SecureChannel_sendSymmetricMessage(UA_SecureChannel *channel, UA_UInt32 requestId, - UA_MessageType messageType, void *payload, - const UA_DataType *payloadType); - -typedef struct { - UA_SecureChannel *channel; - UA_UInt32 requestId; - UA_UInt32 messageType; - - UA_UInt16 chunksSoFar; - size_t messageSizeSoFar; - - UA_ByteString messageBuffer; - UA_Byte *buf_pos; - const UA_Byte *buf_end; - - UA_Boolean final; -} UA_MessageContext; - -/* Start the context of a new symmetric message. */ -UA_StatusCode UA_MessageContext_begin(UA_MessageContext *mc, UA_SecureChannel *channel, UA_UInt32 requestId, - UA_MessageType messageType); - -/* Encode the content and send out full chunks. If the return code is good, then - * the ChunkInfo contains encoded content that has not been sent. If the return - * code is bad, then the ChunkInfo has been cleaned up internally. */ -UA_StatusCode UA_MessageContext_encode(UA_MessageContext *mc, const void *content, const UA_DataType *contentType); - -/* Sends a symmetric message already encoded in the context. The context is - * cleaned up, also in case of errors. */ -UA_StatusCode UA_MessageContext_finish(UA_MessageContext *mc); - -/* To be used when a failure occures when a MessageContext is open. Note that - * the _encode and _finish methods will clean up internally. _abort can be run - * on a MessageContext that has already been cleaned up before. */ -void UA_MessageContext_abort(UA_MessageContext *mc); - -UA_StatusCode UA_SecureChannel_sendAsymmetricOPNMessage(UA_SecureChannel *channel, UA_UInt32 requestId, - const void *content, const UA_DataType *contentType); - -/** - * Process Received Chunks - * ----------------------- */ - -typedef UA_StatusCode(UA_ProcessMessageCallback)(void *application, UA_SecureChannel *channel, - UA_MessageType messageType, UA_UInt32 requestId, - const UA_ByteString *message); - -/* Process a single chunk. This also decrypts the chunk if required. The - * callback function is called with the complete message body if the message is - * complete. - * - * Symmetric callback is ERR, MSG, CLO only - * Asymmetric callback is OPN only - * - * @param channel the channel the chunks were received on. - * @param chunks the memory region where the chunks are stored. - * @param callback the callback function that gets called with the complete - * message body, once a final chunk is processed. - * @param application data pointer to application specific data that gets passed - * on to the callback function. */ -UA_StatusCode UA_SecureChannel_processChunk(UA_SecureChannel *channel, UA_ByteString *chunk, - UA_ProcessMessageCallback callback, void *application); - -/** - * Log Helper - * ---------- - * C99 requires at least one element for the variadic argument. If the log - * statement has no variable arguments, supply an additional NULL. It will be - * ignored by printf. - * - * We have to jump through some hoops to enable the use of format strings - * without arguments since (pedantic) C99 does not allow variadic macros with - * zero arguments. So we add a dummy argument that is not printed (%.0s is - * string of length zero). */ - -#define UA_LOG_TRACE_CHANNEL_INTERNAL(LOGGER, CHANNEL, MSG, ...) \ - UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG "%.0s", \ - ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), (CHANNEL)->securityToken.channelId, \ - __VA_ARGS__) - -#define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, ...) \ - UA_MACRO_EXPAND(UA_LOG_TRACE_CHANNEL_INTERNAL(LOGGER, CHANNEL, __VA_ARGS__, "")) - -#define UA_LOG_DEBUG_CHANNEL_INTERNAL(LOGGER, CHANNEL, MSG, ...) \ - UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG "%.0s", \ - ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), (CHANNEL)->securityToken.channelId, \ - __VA_ARGS__) - -#define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, ...) \ - UA_MACRO_EXPAND(UA_LOG_DEBUG_CHANNEL_INTERNAL(LOGGER, CHANNEL, __VA_ARGS__, "")) - -#define UA_LOG_INFO_CHANNEL_INTERNAL(LOGGER, CHANNEL, MSG, ...) \ - UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG "%.0s", \ - ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), (CHANNEL)->securityToken.channelId, \ - __VA_ARGS__) - -#define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, ...) \ - UA_MACRO_EXPAND(UA_LOG_INFO_CHANNEL_INTERNAL(LOGGER, CHANNEL, __VA_ARGS__, "")) - -#define UA_LOG_WARNING_CHANNEL_INTERNAL(LOGGER, CHANNEL, MSG, ...) \ - UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG "%.0s", \ - ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), (CHANNEL)->securityToken.channelId, \ - __VA_ARGS__) - -#define UA_LOG_WARNING_CHANNEL(LOGGER, CHANNEL, ...) \ - UA_MACRO_EXPAND(UA_LOG_WARNING_CHANNEL_INTERNAL(LOGGER, CHANNEL, __VA_ARGS__, "")) - -#define UA_LOG_ERROR_CHANNEL_INTERNAL(LOGGER, CHANNEL, MSG, ...) \ - UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG "%.0s", \ - ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), (CHANNEL)->securityToken.channelId, \ - __VA_ARGS__) - -#define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, ...) \ - UA_MACRO_EXPAND(UA_LOG_ERROR_CHANNEL_INTERNAL(LOGGER, CHANNEL, __VA_ARGS__, "")) - -#define UA_LOG_FATAL_CHANNEL_INTERNAL(LOGGER, CHANNEL, MSG, ...) \ - UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG "%.0s", \ - ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), (CHANNEL)->securityToken.channelId, \ - __VA_ARGS__) - -#define UA_LOG_FATAL_CHANNEL(LOGGER, CHANNEL, ...) \ - UA_MACRO_EXPAND(UA_LOG_FATAL_CHANNEL_INTERNAL(LOGGER, CHANNEL, __VA_ARGS__, "")) - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_session.h" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define UA_MAXCONTINUATIONPOINTS 5 - -typedef struct ContinuationPointEntry { - LIST_ENTRY(ContinuationPointEntry) pointers; - UA_ByteString identifier; - UA_BrowseDescription browseDescription; - UA_UInt32 maxReferences; - - /* The last point in the node references? */ - size_t referenceKindIndex; - size_t targetIndex; -} ContinuationPointEntry; - -struct UA_Subscription; -typedef struct UA_Subscription UA_Subscription; - -#ifdef UA_ENABLE_SUBSCRIPTIONS -typedef struct UA_PublishResponseEntry { - SIMPLEQ_ENTRY(UA_PublishResponseEntry) listEntry; - UA_UInt32 requestId; - UA_PublishResponse response; -} UA_PublishResponseEntry; -#endif - -struct UA_Session { - UA_ApplicationDescription clientDescription; - UA_String sessionName; - UA_Boolean activated; - void *sessionHandle; // pointer assigned in userland-callback - UA_NodeId authenticationToken; - UA_NodeId sessionId; - UA_UInt32 maxRequestMessageSize; - UA_UInt32 maxResponseMessageSize; - UA_Double timeout; // [ms] - UA_DateTime validTill; - UA_ByteString serverNonce; - UA_SecureChannel *channel; - UA_UInt16 availableContinuationPoints; - LIST_HEAD(ContinuationPointList, ContinuationPointEntry) continuationPoints; -#ifdef UA_ENABLE_SUBSCRIPTIONS - UA_UInt32 lastSubscriptionID; - UA_UInt32 lastSeenSubscriptionID; - LIST_HEAD(UA_ListOfUASubscriptions, UA_Subscription) serverSubscriptions; - SIMPLEQ_HEAD(UA_ListOfQueuedPublishResponses, UA_PublishResponseEntry) responseQueue; - UA_UInt32 numSubscriptions; - UA_UInt32 numPublishReq; -#endif -}; - -/* Local access to the services (for startup and maintenance) uses this Session - * with all possible access rights (Session ID: 1) */ -extern UA_Session adminSession; - -void UA_Session_init(UA_Session *session); -void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server); - -/* If any activity on a session happens, the timeout is extended */ -void UA_Session_updateLifetime(UA_Session *session); - -#ifdef UA_ENABLE_SUBSCRIPTIONS -void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription); - -UA_UInt32 UA_Session_getNumSubscriptions(UA_Session *session); - -UA_Subscription *UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID); - -UA_StatusCode UA_Session_deleteSubscription(UA_Server *server, UA_Session *session, UA_UInt32 subscriptionID); - -UA_UInt32 UA_Session_getUniqueSubscriptionID(UA_Session *session); - -UA_UInt32 UA_Session_getNumPublishReq(UA_Session *session); - -UA_PublishResponseEntry *UA_Session_getPublishReq(UA_Session *session); - -void UA_Session_removePublishReq(UA_Session *session, UA_PublishResponseEntry *entry); - -void UA_Session_addPublishReq(UA_Session *session, UA_PublishResponseEntry *entry); - -#endif - -/** - * Log Helper - * ---------- - * We have to jump through some hoops to enable the use of format strings - * without arguments since (pedantic) C99 does not allow variadic macros with - * zero arguments. So we add a dummy argument that is not printed (%.0s is - * string of length zero). */ - -#define UA_LOG_TRACE_SESSION_INTERNAL(LOGGER, SESSION, MSG, ...) \ - UA_LOG_TRACE( \ - LOGGER, UA_LOGCATEGORY_SESSION, \ - "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG "%.0s", \ - ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \ - ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \ - UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), __VA_ARGS__) - -#define UA_LOG_TRACE_SESSION(LOGGER, SESSION, ...) \ - UA_MACRO_EXPAND(UA_LOG_TRACE_SESSION_INTERNAL(LOGGER, SESSION, __VA_ARGS__, "")) - -#define UA_LOG_DEBUG_SESSION_INTERNAL(LOGGER, SESSION, MSG, ...) \ - UA_LOG_DEBUG( \ - LOGGER, UA_LOGCATEGORY_SESSION, \ - "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG "%.0s", \ - ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \ - ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \ - UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), __VA_ARGS__) - -#define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, ...) \ - UA_MACRO_EXPAND(UA_LOG_DEBUG_SESSION_INTERNAL(LOGGER, SESSION, __VA_ARGS__, "")) - -#define UA_LOG_INFO_SESSION_INTERNAL(LOGGER, SESSION, MSG, ...) \ - UA_LOG_INFO( \ - LOGGER, UA_LOGCATEGORY_SESSION, \ - "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG "%.0s", \ - ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \ - ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \ - UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), __VA_ARGS__) - -#define UA_LOG_INFO_SESSION(LOGGER, SESSION, ...) \ - UA_MACRO_EXPAND(UA_LOG_INFO_SESSION_INTERNAL(LOGGER, SESSION, __VA_ARGS__, "")) - -#define UA_LOG_WARNING_SESSION_INTERNAL(LOGGER, SESSION, MSG, ...) \ - UA_LOG_WARNING( \ - LOGGER, UA_LOGCATEGORY_SESSION, \ - "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG "%.0s", \ - ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \ - ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \ - UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), __VA_ARGS__) - -#define UA_LOG_WARNING_SESSION(LOGGER, SESSION, ...) \ - UA_MACRO_EXPAND(UA_LOG_WARNING_SESSION_INTERNAL(LOGGER, SESSION, __VA_ARGS__, "")) - -#define UA_LOG_ERROR_SESSION_INTERNAL(LOGGER, SESSION, MSG, ...) \ - UA_LOG_ERROR( \ - LOGGER, UA_LOGCATEGORY_SESSION, \ - "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG "%.0s", \ - ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \ - ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \ - UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), __VA_ARGS__) - -#define UA_LOG_ERROR_SESSION(LOGGER, SESSION, ...) \ - UA_MACRO_EXPAND(UA_LOG_ERROR_SESSION_INTERNAL(LOGGER, SESSION, __VA_ARGS__, "")) - -#define UA_LOG_FATAL_SESSION_INTERNAL(LOGGER, SESSION, MSG, ...) \ - UA_LOG_FATAL( \ - LOGGER, UA_LOGCATEGORY_SESSION, \ - "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG "%.0s", \ - ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \ - ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \ - UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), __VA_ARGS__) - -#define UA_LOG_FATAL_SESSION(LOGGER, SESSION, ...) \ - UA_MACRO_EXPAND(UA_LOG_FATAL_SESSION_INTERNAL(LOGGER, SESSION, __VA_ARGS__, "")) - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_timer.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* An (event) timer triggers callbacks with a recurring interval. Adding, - * removing and changing repeated callbacks can be done from independent - * threads. Processing the changes and dispatching callbacks must be done by a - * single "mainloop" process. */ - -/* Forward declaration */ -struct UA_TimerCallbackEntry; -typedef struct UA_TimerCallbackEntry UA_TimerCallbackEntry; - -/* Linked-list definition */ -typedef SLIST_HEAD(UA_TimerCallbackList, UA_TimerCallbackEntry) UA_TimerCallbackList; - -typedef struct { - /* The linked list of callbacks is sorted according to the execution timestamp. */ - UA_TimerCallbackList repeatedCallbacks; - - /* Changes to the repeated callbacks in a multi-producer single-consumer queue */ - UA_TimerCallbackEntry *volatile changes_head; - UA_TimerCallbackEntry *changes_tail; - UA_TimerCallbackEntry *changes_stub; - - UA_UInt64 idCounter; -} UA_Timer; - -/* Initialize the Timer. Not thread-safe. */ -void UA_Timer_init(UA_Timer *t); - -/* Add a repated callback. Thread-safe, can be used in parallel and in parallel - * with UA_Timer_process. */ -typedef void (*UA_TimerCallback)(void *application, void *data); - -UA_StatusCode UA_Timer_addRepeatedCallback(UA_Timer *t, UA_TimerCallback callback, void *data, UA_UInt32 interval, - UA_UInt64 *callbackId); - -/* Change the callback interval. If this is called from within the callback. The - * adjustment is made during the next _process call. */ -UA_StatusCode UA_Timer_changeRepeatedCallbackInterval(UA_Timer *t, UA_UInt64 callbackId, UA_UInt32 interval); - -/* Remove a repated callback. Thread-safe, can be used in parallel and in - * parallel with UA_Timer_process. */ -UA_StatusCode UA_Timer_removeRepeatedCallback(UA_Timer *t, UA_UInt64 callbackId); - -/* Process (dispatch) the repeated callbacks that have timed out. Returns the - * timestamp of the next scheduled repeated callback. Not thread-safe. - * Application is a pointer to the client / server environment for the callback. - * Dispatched is set to true when at least one callback was run / dispatched. */ -typedef void (*UA_TimerDispatchCallback)(void *application, UA_TimerCallback callback, void *data); - -UA_DateTime UA_Timer_process(UA_Timer *t, UA_DateTime nowMonotonic, UA_TimerDispatchCallback dispatchCallback, - void *application); - -/* Remove all repeated callbacks. Not thread-safe. */ -void UA_Timer_deleteMembers(UA_Timer *t); - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_subscription.h" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/*****************/ -/* MonitoredItem */ -/*****************/ - -typedef enum { - UA_MONITOREDITEMTYPE_CHANGENOTIFY = 1, - UA_MONITOREDITEMTYPE_STATUSNOTIFY = 2, - UA_MONITOREDITEMTYPE_EVENTNOTIFY = 4 -} UA_MonitoredItemType; - -typedef struct MonitoredItem_queuedValue { - TAILQ_ENTRY(MonitoredItem_queuedValue) listEntry; - UA_UInt32 clientHandle; - UA_DataValue value; -} MonitoredItem_queuedValue; - -typedef TAILQ_HEAD(QueuedValueQueue, MonitoredItem_queuedValue) QueuedValueQueue; - -typedef struct UA_MonitoredItem { - LIST_ENTRY(UA_MonitoredItem) listEntry; - - /* Settings */ - UA_Subscription *subscription; - UA_UInt32 itemId; - UA_MonitoredItemType monitoredItemType; - UA_TimestampsToReturn timestampsToReturn; - UA_MonitoringMode monitoringMode; - UA_NodeId monitoredNodeId; - UA_UInt32 attributeID; - UA_UInt32 clientHandle; - UA_Double samplingInterval; // [ms] - UA_UInt32 currentQueueSize; - UA_UInt32 maxQueueSize; - UA_Boolean discardOldest; - UA_String indexRange; - // TODO: dataEncoding is hardcoded to UA binary - UA_DataChangeTrigger trigger; - - /* Sample Callback */ - UA_UInt64 sampleCallbackId; - UA_Boolean sampleCallbackIsRegistered; - - /* Sample Queue */ - UA_ByteString lastSampledValue; - QueuedValueQueue queue; -} UA_MonitoredItem; - -UA_MonitoredItem *UA_MonitoredItem_new(void); -void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem); -void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem); -UA_StatusCode MonitoredItem_registerSampleCallback(UA_Server *server, UA_MonitoredItem *mon); -UA_StatusCode MonitoredItem_unregisterSampleCallback(UA_Server *server, UA_MonitoredItem *mon); - -/****************/ -/* Subscription */ -/****************/ - -typedef struct UA_NotificationMessageEntry { - TAILQ_ENTRY(UA_NotificationMessageEntry) listEntry; - UA_NotificationMessage message; -} UA_NotificationMessageEntry; - -/* We use only a subset of the states defined in the standard */ -typedef enum { - /* UA_SUBSCRIPTIONSTATE_CLOSED */ - /* UA_SUBSCRIPTIONSTATE_CREATING */ - UA_SUBSCRIPTIONSTATE_NORMAL, - UA_SUBSCRIPTIONSTATE_LATE, - UA_SUBSCRIPTIONSTATE_KEEPALIVE -} UA_SubscriptionState; - -typedef TAILQ_HEAD(ListOfNotificationMessages, UA_NotificationMessageEntry) ListOfNotificationMessages; - -struct UA_Subscription { - LIST_ENTRY(UA_Subscription) listEntry; - - /* Settings */ - UA_Session *session; - UA_UInt32 lifeTimeCount; - UA_UInt32 maxKeepAliveCount; - UA_Double publishingInterval; /* in ms */ - UA_UInt32 subscriptionID; - UA_UInt32 notificationsPerPublish; - UA_Boolean publishingEnabled; - UA_UInt32 priority; - - /* Runtime information */ - UA_SubscriptionState state; - UA_UInt32 sequenceNumber; - UA_UInt32 currentKeepAliveCount; - UA_UInt32 currentLifetimeCount; - UA_UInt32 lastMonitoredItemId; - UA_UInt32 numMonitoredItems; - /* Publish Callback */ - UA_UInt64 publishCallbackId; - UA_Boolean publishCallbackIsRegistered; - - /* MonitoredItems */ - LIST_HEAD(UA_ListOfUAMonitoredItems, UA_MonitoredItem) monitoredItems; - /* When the last publish response could not hold all available - * notifications, in the next iteration, start at the monitoreditem with - * this id. If zero, start at the first monitoreditem. */ - UA_UInt32 lastSendMonitoredItemId; - - /* Retransmission Queue */ - ListOfNotificationMessages retransmissionQueue; - UA_UInt32 retransmissionQueueSize; -}; - -UA_Subscription *UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID); -void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server); -UA_StatusCode Subscription_registerPublishCallback(UA_Server *server, UA_Subscription *sub); -UA_StatusCode Subscription_unregisterPublishCallback(UA_Server *server, UA_Subscription *sub); - -UA_StatusCode UA_Subscription_deleteMonitoredItem(UA_Server *server, UA_Subscription *sub, UA_UInt32 monitoredItemID); - -void UA_Subscription_addMonitoredItem(UA_Subscription *sub, UA_MonitoredItem *newMon); -UA_UInt32 UA_Subscription_getNumMonitoredItems(UA_Subscription *sub); - -UA_MonitoredItem *UA_Subscription_getMonitoredItem(UA_Subscription *sub, UA_UInt32 monitoredItemID); - -void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub); - -UA_StatusCode UA_Subscription_removeRetransmissionMessage(UA_Subscription *sub, UA_UInt32 sequenceNumber); - -void UA_Subscription_answerPublishRequestsNoSubscription(UA_Server *server, UA_Session *session); - -UA_Boolean UA_Subscription_reachedPublishReqLimit(UA_Server *server, UA_Session *session); - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_session_manager.h" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct session_list_entry { - LIST_ENTRY(session_list_entry) pointers; - UA_Session session; -} session_list_entry; - -typedef struct UA_SessionManager { - LIST_HEAD(session_list, session_list_entry) sessions; // doubly-linked list of sessions - UA_UInt32 currentSessionCount; - UA_Server *server; -} UA_SessionManager; - -UA_StatusCode UA_SessionManager_init(UA_SessionManager *sm, UA_Server *server); - -/* Deletes all sessions */ -void UA_SessionManager_deleteMembers(UA_SessionManager *sm); - -/* Deletes all sessions that have timed out. Deletion is implemented via a - * delayed callback. So all currently scheduled jobs with a pointer to the - * session can complete. */ -void UA_SessionManager_cleanupTimedOut(UA_SessionManager *sm, UA_DateTime nowMonotonic); - -UA_StatusCode UA_SessionManager_createSession(UA_SessionManager *sm, UA_SecureChannel *channel, - const UA_CreateSessionRequest *request, UA_Session **session); - -UA_StatusCode UA_SessionManager_removeSession(UA_SessionManager *sm, const UA_NodeId *token); - -UA_Session *UA_SessionManager_getSessionByToken(UA_SessionManager *sm, const UA_NodeId *token); - -UA_Session *UA_SessionManager_getSessionById(UA_SessionManager *sm, const UA_NodeId *sessionId); - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_securechannel_manager.h" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct channel_list_entry { - UA_SecureChannel channel; - LIST_ENTRY(channel_list_entry) pointers; -} channel_list_entry; - -typedef struct UA_SecureChannelManager { - LIST_HEAD(channel_list, channel_list_entry) channels; // doubly-linked list of channels - UA_UInt32 currentChannelCount; - UA_UInt32 lastChannelId; - UA_UInt32 lastTokenId; - UA_Server *server; -} UA_SecureChannelManager; - -UA_StatusCode UA_SecureChannelManager_init(UA_SecureChannelManager *cm, UA_Server *server); - -/* Remove a all securechannels */ -void UA_SecureChannelManager_deleteMembers(UA_SecureChannelManager *cm); - -/* Remove timed out securechannels with a delayed callback. So all currently - * scheduled jobs with a pointer to a securechannel can finish first. */ -void UA_SecureChannelManager_cleanupTimedOut(UA_SecureChannelManager *cm, UA_DateTime nowMonotonic); - -UA_StatusCode UA_SecureChannelManager_create(UA_SecureChannelManager *const cm, UA_Connection *const connection, - const UA_SecurityPolicy *const securityPolicy, - const UA_AsymmetricAlgorithmSecurityHeader *const asymHeader); - -UA_StatusCode UA_SecureChannelManager_open(UA_SecureChannelManager *cm, UA_SecureChannel *channel, - const UA_OpenSecureChannelRequest *request, - UA_OpenSecureChannelResponse *response); - -UA_StatusCode UA_SecureChannelManager_renew(UA_SecureChannelManager *cm, UA_SecureChannel *channel, - const UA_OpenSecureChannelRequest *request, - UA_OpenSecureChannelResponse *response); - -UA_SecureChannel *UA_SecureChannelManager_get(UA_SecureChannelManager *cm, UA_UInt32 channelId); - -UA_StatusCode UA_SecureChannelManager_close(UA_SecureChannelManager *cm, UA_UInt32 channelId); - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_server_internal.h" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef UA_ENABLE_MULTITHREADING - -/* TODO: Don't depend on liburcu */ -#include -#include - -struct UA_Worker; -typedef struct UA_Worker UA_Worker; - -#endif /* UA_ENABLE_MULTITHREADING */ - -#ifdef UA_ENABLE_DISCOVERY - -typedef struct registeredServer_list_entry { - LIST_ENTRY(registeredServer_list_entry) pointers; - UA_RegisteredServer registeredServer; - UA_DateTime lastSeen; -} registeredServer_list_entry; - -typedef struct periodicServerRegisterCallback_entry { - LIST_ENTRY(periodicServerRegisterCallback_entry) pointers; - struct PeriodicServerRegisterCallback *callback; -} periodicServerRegisterCallback_entry; - -#ifdef UA_ENABLE_DISCOVERY_MULTICAST - -typedef struct serverOnNetwork_list_entry { - LIST_ENTRY(serverOnNetwork_list_entry) pointers; - UA_ServerOnNetwork serverOnNetwork; - UA_DateTime created; - UA_DateTime lastSeen; - UA_Boolean txtSet; - UA_Boolean srvSet; - char *pathTmp; -} serverOnNetwork_list_entry; - -#define SERVER_ON_NETWORK_HASH_PRIME 1009 -typedef struct serverOnNetwork_hash_entry { - serverOnNetwork_list_entry *entry; - struct serverOnNetwork_hash_entry *next; -} serverOnNetwork_hash_entry; - -#endif /* UA_ENABLE_DISCOVERY_MULTICAST */ -#endif /* UA_ENABLE_DISCOVERY */ - -struct UA_Server { - /* Meta */ - UA_DateTime startTime; - - /* Security */ - UA_SecureChannelManager secureChannelManager; - UA_SessionManager sessionManager; - -#ifdef UA_ENABLE_DISCOVERY - /* Discovery */ - LIST_HEAD(registeredServer_list, registeredServer_list_entry) - registeredServers; // doubly-linked list of registered servers - size_t registeredServersSize; - LIST_HEAD(periodicServerRegisterCallback_list, periodicServerRegisterCallback_entry) - periodicServerRegisterCallbacks; // doubly-linked list of current register callbacks - UA_Server_registerServerCallback registerServerCallback; - void *registerServerCallbackData; -#ifdef UA_ENABLE_DISCOVERY_MULTICAST - mdns_daemon_t *mdnsDaemon; -#ifdef _WIN32 - SOCKET mdnsSocket; -#else - int mdnsSocket; -#endif - UA_Boolean mdnsMainSrvAdded; -#ifdef UA_ENABLE_MULTITHREADING - pthread_t mdnsThread; - UA_Boolean mdnsRunning; -#endif - - LIST_HEAD(serverOnNetwork_list, serverOnNetwork_list_entry) - serverOnNetwork; // doubly-linked list of servers on the network (from mDNS) - size_t serverOnNetworkSize; - UA_UInt32 serverOnNetworkRecordIdCounter; - UA_DateTime serverOnNetworkRecordIdLastReset; - // hash mapping domain name to serverOnNetwork list entry - struct serverOnNetwork_hash_entry *serverOnNetworkHash[SERVER_ON_NETWORK_HASH_PRIME]; - - UA_Server_serverOnNetworkCallback serverOnNetworkCallback; - void *serverOnNetworkCallbackData; - -#endif -#endif - - /* Namespaces */ - size_t namespacesSize; - UA_String *namespaces; - - /* Callbacks with a repetition interval */ - UA_Timer timer; - - /* Delayed callbacks */ - SLIST_HEAD(DelayedCallbacksList, UA_DelayedCallback) delayedCallbacks; - -/* Worker threads */ -#ifdef UA_ENABLE_MULTITHREADING - /* Dispatch queue head for the worker threads (the tail should not be in the same cache line) */ - struct cds_wfcq_head dispatchQueue_head; - UA_Worker *workers; /* there are nThread workers in a running server */ - pthread_cond_t dispatchQueue_condition; /* so the workers don't spin if the queue is empty */ - pthread_mutex_t dispatchQueue_mutex; /* mutex for access to condition variable */ - struct cds_wfcq_tail dispatchQueue_tail; /* Dispatch queue tail for the worker threads */ -#endif - - /* For bootstrapping, omit some consistency checks, creating a reference to - * the parent and member instantiation */ - UA_Boolean bootstrapNS0; - - /* Config */ - UA_ServerConfig config; -}; - -/*****************/ -/* Node Handling */ -/*****************/ - -#define UA_Nodestore_get(SERVER, NODEID) (SERVER)->config.nodestore.getNode((SERVER)->config.nodestore.context, NODEID) - -#define UA_Nodestore_release(SERVER, NODEID) \ - (SERVER)->config.nodestore.releaseNode((SERVER)->config.nodestore.context, NODEID) - -#define UA_Nodestore_new(SERVER, NODECLASS) \ - (SERVER)->config.nodestore.newNode((SERVER)->config.nodestore.context, NODECLASS) - -#define UA_Nodestore_getCopy(SERVER, NODEID, OUTNODE) \ - (SERVER)->config.nodestore.getNodeCopy((SERVER)->config.nodestore.context, NODEID, OUTNODE) - -#define UA_Nodestore_insert(SERVER, NODE, OUTNODEID) \ - (SERVER)->config.nodestore.insertNode((SERVER)->config.nodestore.context, NODE, OUTNODEID) - -#define UA_Nodestore_delete(SERVER, NODE) \ - (SERVER)->config.nodestore.deleteNode((SERVER)->config.nodestore.context, NODE) - -#define UA_Nodestore_remove(SERVER, NODEID) \ - (SERVER)->config.nodestore.removeNode((SERVER)->config.nodestore.context, NODEID) - -/* Calls the callback with the node retrieved from the nodestore on top of the - * stack. Either a copy or the original node for in-situ editing. Depends on - * multithreading and the nodestore.*/ -typedef UA_StatusCode (*UA_EditNodeCallback)(UA_Server *, UA_Session *, UA_Node *node, const void *); -UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, - UA_EditNodeCallback callback, const void *data); - -/*************/ -/* Callbacks */ -/*************/ - -/* Delayed callbacks are executed when all previously dispatched callbacks are - * finished */ -UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data); - -/* Callback is executed in the same thread or, if possible, dispatched to one of - * the worker threads. */ -void UA_Server_workerCallback(UA_Server *server, UA_ServerCallback callback, void *data); - -/*********************/ -/* Utility Functions */ -/*********************/ - -/* A few global NodeId definitions */ -extern const UA_NodeId subtypeId; - -UA_StatusCode UA_NumericRange_parseFromString(UA_NumericRange *range, const UA_String *str); - -UA_UInt16 addNamespace(UA_Server *server, const UA_String name); - -UA_Boolean UA_Node_hasSubTypeOrInstances(const UA_Node *node); - -/* Recursively searches "upwards" in the tree following specific reference types */ -UA_Boolean isNodeInTree(UA_Nodestore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind, - const UA_NodeId *referenceTypeIds, size_t referenceTypeIdsSize); - -/* Returns an array with the hierarchy of type nodes. The returned array starts - * at the leaf and continues "upwards" in the hierarchy based on the - * ``hasSubType`` references. Since multiple-inheritance is possible in general, - * duplicate entries are removed. */ -UA_StatusCode getTypeHierarchy(UA_Nodestore *ns, const UA_NodeId *leafType, UA_NodeId **typeHierarchy, - size_t *typeHierarchySize); - -/* Returns the type node from the node on the stack top. The type node is pushed - * on the stack and returned. */ -const UA_Node *getNodeType(UA_Server *server, const UA_Node *node); - -/* Many services come as an array of operations. This function generalizes the - * processing of the operations. */ -typedef void (*UA_ServiceOperation)(UA_Server *server, UA_Session *session, const void *requestOperation, - void *responseOperation); - -UA_StatusCode UA_Server_processServiceOperations(UA_Server *server, UA_Session *session, - UA_ServiceOperation operationCallback, const size_t *requestOperations, - const UA_DataType *requestOperationsType, size_t *responseOperations, - const UA_DataType *responseOperationsType); - -/***************************************/ -/* Check Information Model Consistency */ -/***************************************/ - -UA_StatusCode readValueAttribute(UA_Server *server, UA_Session *session, const UA_VariableNode *vn, UA_DataValue *v); - -/* Test whether the value matches a variable definition given by - * - datatype - * - valueranke - * - array dimensions. - * Sometimes it can be necessary to transform the content of the value, e.g. - * byte array to bytestring or uint32 to some enum. If editableValue is non-NULL, - * we try to create a matching variant that points to the original data. */ -UA_Boolean compatibleValue(UA_Server *server, const UA_NodeId *targetDataTypeId, UA_Int32 targetValueRank, - size_t targetArrayDimensionsSize, const UA_UInt32 *targetArrayDimensions, - const UA_Variant *value, const UA_NumericRange *range); - -UA_Boolean compatibleArrayDimensions(size_t constraintArrayDimensionsSize, const UA_UInt32 *constraintArrayDimensions, - size_t testArrayDimensionsSize, const UA_UInt32 *testArrayDimensions); - -UA_Boolean compatibleValueArrayDimensions(const UA_Variant *value, size_t targetArrayDimensionsSize, - const UA_UInt32 *targetArrayDimensions); - -UA_Boolean compatibleValueRankArrayDimensions(UA_Int32 valueRank, size_t arrayDimensionsSize); - -UA_Boolean compatibleDataType(UA_Server *server, const UA_NodeId *dataType, const UA_NodeId *constraintDataType); - -UA_Boolean compatibleValueRanks(UA_Int32 valueRank, UA_Int32 constraintValueRank); - -/*******************/ -/* Single-Services */ -/*******************/ - -/* Some services take an array of "independent" requests. The single-services - * are stored here to keep ua_services.h clean for documentation purposes. */ - -void Service_Browse_single(UA_Server *server, UA_Session *session, struct ContinuationPointEntry *cp, - const UA_BrowseDescription *descr, UA_UInt32 maxrefs, UA_BrowseResult *result); - -UA_DataValue UA_Server_readWithSession(UA_Server *server, UA_Session *session, const UA_ReadValueId *item, - UA_TimestampsToReturn timestampsToReturn); - -/* Checks if a registration timed out and removes that registration. - * Should be called periodically in main loop */ -void UA_Discovery_cleanupTimedOut(UA_Server *server, UA_DateTime nowMonotonic); - -#ifdef UA_ENABLE_DISCOVERY_MULTICAST - -UA_StatusCode initMulticastDiscoveryServer(UA_Server *server); - -void startMulticastDiscoveryServer(UA_Server *server); - -void stopMulticastDiscoveryServer(UA_Server *server); - -UA_StatusCode iterateMulticastDiscoveryServer(UA_Server *server, UA_DateTime *nextRepeat, UA_Boolean processIn); - -void destroyMulticastDiscoveryServer(UA_Server *server); - -typedef enum { - UA_DISCOVERY_TCP, /* OPC UA TCP mapping */ - UA_DISCOVERY_TLS /* OPC UA HTTPS mapping */ -} UA_DiscoveryProtocol; - -/* Send a multicast probe to find any other OPC UA server on the network through mDNS. */ -UA_StatusCode UA_Discovery_multicastQuery(UA_Server *server); - -UA_StatusCode UA_Discovery_addRecord(UA_Server *server, const UA_String *servername, const UA_String *hostname, - UA_UInt16 port, const UA_String *path, const UA_DiscoveryProtocol protocol, - UA_Boolean createTxt, const UA_String *capabilites, size_t *capabilitiesSize); -UA_StatusCode UA_Discovery_removeRecord(UA_Server *server, const UA_String *servername, const UA_String *hostname, - UA_UInt16 port, UA_Boolean removeTxt); - -#endif - -/*****************************/ -/* AddNodes Begin and Finish */ -/*****************************/ - -/* Creates a new node in the nodestore. */ -UA_StatusCode Operation_addNode_begin(UA_Server *server, UA_Session *session, const UA_AddNodesItem *item, - void *nodeContext, UA_NodeId *outNewNodeId); - -/* Children, references, type-checking, constructors. */ -UA_StatusCode Operation_addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, - const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId, - const UA_NodeId *typeDefinitionId); - -UA_StatusCode UA_Server_addMethodNode_finish(UA_Server *server, const UA_NodeId nodeId, const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, UA_MethodCallback method, - size_t inputArgumentsSize, const UA_Argument *inputArguments, - size_t outputArgumentsSize, const UA_Argument *outputArguments); - -/**********************/ -/* Create Namespace 0 */ -/**********************/ - -UA_StatusCode UA_Server_initNS0(UA_Server *server); - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_services.h" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * .. _services: - * - * Services - * ======== - * - * In OPC UA, all communication is based on service calls, each consisting of a - * request and a response message. These messages are defined as data structures - * with a binary encoding and listed in :ref:`generated-types`. Since all - * Services are pre-defined in the standard, they cannot be modified by the - * user. But you can use the :ref:`Call ` service to invoke - * user-defined methods on the server. - * - * The following service signatures are internal and *not visible to users*. - * Still, we present them here for an overview of the capabilities of OPC UA. - * Please refer to the :ref:`client` and :ref:`server` API where the services - * are exposed to end users. Please see part 4 of the OPC UA standard for the - * authoritative definition of the service and their behaviour. - * - * Most services take as input the server, the current session and pointers to - * the request and response structures. Possible error codes are returned as - * part of the response. */ - -typedef void (*UA_Service)(UA_Server *, UA_Session *, const void *request, void *response); - -typedef UA_StatusCode (*UA_InSituService)(UA_Server *, UA_Session *, UA_MessageContext *mc, const void *request, - UA_ResponseHeader *rh); - -/** - * Discovery Service Set - * --------------------- - * This Service Set defines Services used to discover the Endpoints implemented - * by a Server and to read the security configuration for those Endpoints. - * - * FindServers Service - * ^^^^^^^^^^^^^^^^^^^ - * Returns the Servers known to a Server or Discovery Server. The Client may - * reduce the number of results returned by specifying filter criteria */ -void Service_FindServers(UA_Server *server, UA_Session *session, const UA_FindServersRequest *request, - UA_FindServersResponse *response); - -/** - * GetEndpoints Service - * ^^^^^^^^^^^^^^^^^^^^ - * Returns the Endpoints supported by a Server and all of the configuration - * information required to establish a SecureChannel and a Session. */ -void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEndpointsRequest *request, - UA_GetEndpointsResponse *response); - -#ifdef UA_ENABLE_DISCOVERY - -#ifdef UA_ENABLE_DISCOVERY_MULTICAST - -/** - * FindServersOnNetwork Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Returns the Servers known to a Discovery Server. Unlike FindServer, - * this Service is only implemented by Discovery Servers. It additionally - * Returns servery which may have been detected trough Multicast */ -void Service_FindServersOnNetwork(UA_Server *server, UA_Session *session, const UA_FindServersOnNetworkRequest *request, - UA_FindServersOnNetworkResponse *response); - -#endif /* UA_ENABLE_DISCOVERY_MULTICAST */ - -/** - * RegisterServer - * ^^^^^^^^^^^^^^ - * Registers a remote server in the local discovery service. */ -void Service_RegisterServer(UA_Server *server, UA_Session *session, const UA_RegisterServerRequest *request, - UA_RegisterServerResponse *response); - -/** - * RegisterServer2 - * ^^^^^^^^^^^^^^^ - * This Service allows a Server to register its DiscoveryUrls and capabilities - * with a Discovery Server. It extends the registration information from - * RegisterServer with information necessary for FindServersOnNetwork. */ -void Service_RegisterServer2(UA_Server *server, UA_Session *session, const UA_RegisterServer2Request *request, - UA_RegisterServer2Response *response); - -#endif /* UA_ENABLE_DISCOVERY */ - -/** - * SecureChannel Service Set - * ------------------------- - * This Service Set defines Services used to open a communication channel that - * ensures the confidentiality and Integrity of all Messages exchanged with the - * Server. - * - * OpenSecureChannel Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - * Open or renew a SecureChannel that can be used to ensure Confidentiality and - * Integrity for Message exchange during a Session. */ -void Service_OpenSecureChannel(UA_Server *server, UA_SecureChannel *channel, const UA_OpenSecureChannelRequest *request, - UA_OpenSecureChannelResponse *response); - -/** - * CloseSecureChannel Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Used to terminate a SecureChannel. */ -void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel); - -/** - * Session Service Set - * ------------------- - * This Service Set defines Services for an application layer connection - * establishment in the context of a Session. - * - * CreateSession Service - * ^^^^^^^^^^^^^^^^^^^^^ - * Used by an OPC UA Client to create a Session and the Server returns two - * values which uniquely identify the Session. The first value is the sessionId - * which is used to identify the Session in the audit logs and in the Server's - * address space. The second is the authenticationToken which is used to - * associate an incoming request with a Session. */ -void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, - UA_CreateSessionResponse *response); - -/** - * ActivateSession - * ^^^^^^^^^^^^^^^ - * Used by the Client to submit its SoftwareCertificates to the Server for - * validation and to specify the identity of the user associated with the - * Session. This Service request shall be issued by the Client before it issues - * any other Service request after CreateSession. Failure to do so shall cause - * the Server to close the Session. */ -void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, UA_Session *session, - const UA_ActivateSessionRequest *request, UA_ActivateSessionResponse *response); - -/** - * CloseSession - * ^^^^^^^^^^^^ - * Used to terminate a Session. */ -void Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request, - UA_CloseSessionResponse *response); - -/** - * Cancel Service - * ^^^^^^^^^^^^^^ - * Used to cancel outstanding Service requests. Successfully cancelled service - * requests shall respond with Bad_RequestCancelledByClient. */ -/* Not Implemented */ - -/** - * NodeManagement Service Set - * -------------------------- - * This Service Set defines Services to add and delete AddressSpace Nodes and - * References between them. All added Nodes continue to exist in the - * AddressSpace even if the Client that created them disconnects from the - * Server. - * - * AddNodes Service - * ^^^^^^^^^^^^^^^^ - * Used to add one or more Nodes into the AddressSpace hierarchy. */ -void Service_AddNodes(UA_Server *server, UA_Session *session, const UA_AddNodesRequest *request, - UA_AddNodesResponse *response); - -/** - * AddReferences Service - * ^^^^^^^^^^^^^^^^^^^^^ - * Used to add one or more References to one or more Nodes. */ -void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddReferencesRequest *request, - UA_AddReferencesResponse *response); - -/** - * DeleteNodes Service - * ^^^^^^^^^^^^^^^^^^^ - * Used to delete one or more Nodes from the AddressSpace. */ -void Service_DeleteNodes(UA_Server *server, UA_Session *session, const UA_DeleteNodesRequest *request, - UA_DeleteNodesResponse *response); - -/** - * DeleteReferences - * ^^^^^^^^^^^^^^^^ - * Used to delete one or more References of a Node. */ -void Service_DeleteReferences(UA_Server *server, UA_Session *session, const UA_DeleteReferencesRequest *request, - UA_DeleteReferencesResponse *response); - -/** - * .. _view-services: - * - * View Service Set - * ---------------- - * Clients use the browse Services of the View Service Set to navigate through - * the AddressSpace or through a View which is a subset of the AddressSpace. - * - * Browse Service - * ^^^^^^^^^^^^^^ - * Used to discover the References of a specified Node. The browse can be - * further limited by the use of a View. This Browse Service also supports a - * primitive filtering capability. */ -void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request, - UA_BrowseResponse *response); - -/** - * BrowseNext Service - * ^^^^^^^^^^^^^^^^^^ - * Used to request the next set of Browse or BrowseNext response information - * that is too large to be sent in a single response. "Too large" in this - * context means that the Server is not able to return a larger response or that - * the number of results to return exceeds the maximum number of results to - * return that was specified by the Client in the original Browse request. */ -void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request, - UA_BrowseNextResponse *response); - -/** - * TranslateBrowsePathsToNodeIds Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Used to translate textual node paths to their respective ids. */ -void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session, - const UA_TranslateBrowsePathsToNodeIdsRequest *request, - UA_TranslateBrowsePathsToNodeIdsResponse *response); - -/** - * RegisterNodes Service - * ^^^^^^^^^^^^^^^^^^^^^ - * Used by Clients to register the Nodes that they know they will access - * repeatedly (e.g. Write, Call). It allows Servers to set up anything needed so - * that the access operations will be more efficient. */ -void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request, - UA_RegisterNodesResponse *response); - -/** - * UnregisterNodes Service - * ^^^^^^^^^^^^^^^^^^^^^^^ - * This Service is used to unregister NodeIds that have been obtained via the - * RegisterNodes service. */ -void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request, - UA_UnregisterNodesResponse *response); - -/** - * Query Service Set - * ----------------- - * This Service Set is used to issue a Query to a Server. OPC UA Query is - * generic in that it provides an underlying storage mechanism independent Query - * capability that can be used to access a wide variety of OPC UA data stores - * and information management systems. OPC UA Query permits a Client to access - * data maintained by a Server without any knowledge of the logical schema used - * for internal storage of the data. Knowledge of the AddressSpace is - * sufficient. - * - * QueryFirst Service - * ^^^^^^^^^^^^^^^^^^ - * This Service is used to issue a Query request to the Server. */ -/* Not Implemented */ - -/** - * QueryNext Service - * ^^^^^^^^^^^^^^^^^ - * This Service is used to request the next set of QueryFirst or QueryNext - * response information that is too large to be sent in a single response. */ -/* Not Impelemented */ - -/** - * Attribute Service Set - * --------------------- - * This Service Set provides Services to access Attributes that are part of - * Nodes. - * - * Read Service - * ^^^^^^^^^^^^ - * Used to read attributes of nodes. For constructed attribute values whose - * elements are indexed, such as an array, this Service allows Clients to read - * the entire set of indexed values as a composite, to read individual elements - * or to read ranges of elements of the composite. */ -UA_StatusCode Service_Read(UA_Server *server, UA_Session *session, UA_MessageContext *mc, const UA_ReadRequest *request, - UA_ResponseHeader *responseHeader); - -/** - * Write Service - * ^^^^^^^^^^^^^ - * Used to write attributes of nodes. For constructed attribute values whose - * elements are indexed, such as an array, this Service allows Clients to write - * the entire set of indexed values as a composite, to write individual elements - * or to write ranges of elements of the composite. */ -void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest *request, UA_WriteResponse *response); - -/** - * HistoryRead Service - * ^^^^^^^^^^^^^^^^^^^ - * Used to read historical values or Events of one or more Nodes. Servers may - * make historical values available to Clients using this Service, although the - * historical values themselves are not visible in the AddressSpace. */ -/* Not Implemented */ - -/** - * HistoryUpdate Service - * ^^^^^^^^^^^^^^^^^^^^^ - * Used to update historical values or Events of one or more Nodes. Several - * request parameters indicate how the Server is to update the historical value - * or Event. Valid actions are Insert, Replace or Delete. */ -/* Not Implemented */ - -/** - * .. _method-services: - * - * Method Service Set - * ------------------ - * The Method Service Set defines the means to invoke methods. A method shall be - * a component of an Object. See the section on :ref:`MethodNodes ` - * for more information. - * - * Call Service - * ^^^^^^^^^^^^ - * Used to call (invoke) a methods. Each method call is invoked within the - * context of an existing Session. If the Session is terminated, the results of - * the method's execution cannot be returned to the Client and are discarded. */ -void Service_Call(UA_Server *server, UA_Session *session, const UA_CallRequest *request, UA_CallResponse *response); - -/** - * MonitoredItem Service Set - * ------------------------- - * Clients define MonitoredItems to subscribe to data and Events. Each - * MonitoredItem identifies the item to be monitored and the Subscription to use - * to send Notifications. The item to be monitored may be any Node Attribute. - * - * CreateMonitoredItems Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Used to create and add one or more MonitoredItems to a Subscription. A - * MonitoredItem is deleted automatically by the Server when the Subscription is - * deleted. Deleting a MonitoredItem causes its entire set of triggered item - * links to be deleted, but has no effect on the MonitoredItems referenced by - * the triggered items. */ -void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session, const UA_CreateMonitoredItemsRequest *request, - UA_CreateMonitoredItemsResponse *response); - -/** - * DeleteMonitoredItems Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Used to remove one or more MonitoredItems of a Subscription. When a - * MonitoredItem is deleted, its triggered item links are also deleted. */ -void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session, const UA_DeleteMonitoredItemsRequest *request, - UA_DeleteMonitoredItemsResponse *response); - -/** - * ModifyMonitoredItems Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Used to modify MonitoredItems of a Subscription. Changes to the MonitoredItem - * settings shall be applied immediately by the Server. They take effect as soon - * as practical but not later than twice the new revisedSamplingInterval. - * - * Illegal request values for parameters that can be revised do not generate - * errors. Instead the server will choose default values and indicate them in - * the corresponding revised parameter. */ -void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session, const UA_ModifyMonitoredItemsRequest *request, - UA_ModifyMonitoredItemsResponse *response); - -/** - * SetMonitoringMode Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - * Used to set the monitoring mode for one or more MonitoredItems of a - * Subscription. */ -void Service_SetMonitoringMode(UA_Server *server, UA_Session *session, const UA_SetMonitoringModeRequest *request, - UA_SetMonitoringModeResponse *response); - -/** - * SetTriggering Service - * ^^^^^^^^^^^^^^^^^^^^^ - * Used to create and delete triggering links for a triggering item. */ -/* Not Implemented */ - -/** - * Subscription Service Set - * ------------------------ - * Subscriptions are used to report Notifications to the Client. - * - * CreateSubscription Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Used to create a Subscription. Subscriptions monitor a set of MonitoredItems - * for Notifications and return them to the Client in response to Publish - * requests. */ -void Service_CreateSubscription(UA_Server *server, UA_Session *session, const UA_CreateSubscriptionRequest *request, - UA_CreateSubscriptionResponse *response); - -/** - * ModifySubscription Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Used to modify a Subscription. */ -void Service_ModifySubscription(UA_Server *server, UA_Session *session, const UA_ModifySubscriptionRequest *request, - UA_ModifySubscriptionResponse *response); - -/** - * SetPublishingMode Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - * Used to enable sending of Notifications on one or more Subscriptions. */ -void Service_SetPublishingMode(UA_Server *server, UA_Session *session, const UA_SetPublishingModeRequest *request, - UA_SetPublishingModeResponse *response); - -/** - * Publish Service - * ^^^^^^^^^^^^^^^ - * Used for two purposes. First, it is used to acknowledge the receipt of - * NotificationMessages for one or more Subscriptions. Second, it is used to - * request the Server to return a NotificationMessage or a keep-alive - * Message. - * - * Note that the service signature is an exception and does not contain a - * pointer to a PublishResponse. That is because the service queues up publish - * requests internally and sends responses asynchronously based on timeouts. */ -void Service_Publish(UA_Server *server, UA_Session *session, const UA_PublishRequest *request, UA_UInt32 requestId); - -/** - * Republish Service - * ^^^^^^^^^^^^^^^^^ - * Requests the Subscription to republish a NotificationMessage from its - * retransmission queue. */ -void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request, - UA_RepublishResponse *response); - -/** - * DeleteSubscriptions Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Invoked to delete one or more Subscriptions that belong to the Client's - * Session. */ -void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session, const UA_DeleteSubscriptionsRequest *request, - UA_DeleteSubscriptionsResponse *response); - -/** - * TransferSubscription Service - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Used to transfer a Subscription and its MonitoredItems from one Session to - * another. For example, a Client may need to reopen a Session and then transfer - * its Subscriptions to that Session. It may also be used by one Client to take - * over a Subscription from another Client by transferring the Subscription to - * its Session. */ -/* Not Implemented */ - -#ifdef __cplusplus -} // extern "C" -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_namespace0.h" - * ***********************************/ - -/* WARNING: This is a generated file. - * Any manual changes will be overwritten. */ - -#ifndef UA_NAMESPACE0_H_ -#define UA_NAMESPACE0_H_ - -#ifdef UA_NO_AMALGAMATION - -#else -#endif - -extern UA_StatusCode ua_namespace0(UA_Server *server); - -#endif /* UA_NAMESPACE0_H_ */ - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/client/ua_client_internal.h" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/**************************/ -/* Subscriptions Handling */ -/**************************/ - -#ifdef UA_ENABLE_SUBSCRIPTIONS - -typedef struct UA_Client_NotificationsAckNumber { - LIST_ENTRY(UA_Client_NotificationsAckNumber) listEntry; - UA_SubscriptionAcknowledgement subAck; -} UA_Client_NotificationsAckNumber; - -typedef struct UA_Client_MonitoredItem { - LIST_ENTRY(UA_Client_MonitoredItem) listEntry; - UA_UInt32 monitoredItemId; - UA_UInt32 monitoringMode; - UA_NodeId monitoredNodeId; - UA_UInt32 attributeID; - UA_UInt32 clientHandle; - UA_Double samplingInterval; - UA_UInt32 queueSize; - UA_Boolean discardOldest; - void (*handler)(UA_UInt32 monId, UA_DataValue *value, void *context); - void *handlerContext; - void (*handlerEvents)(const UA_UInt32 monId, const size_t nEventFields, const UA_Variant *eventFields, void *context); - void *handlerEventsContext; -} UA_Client_MonitoredItem; - -typedef struct UA_Client_Subscription { - LIST_ENTRY(UA_Client_Subscription) listEntry; - UA_UInt32 lifeTime; - UA_UInt32 keepAliveCount; - UA_Double publishingInterval; - UA_UInt32 subscriptionID; - UA_UInt32 notificationsPerPublish; - UA_UInt32 priority; - LIST_HEAD(UA_ListOfClientMonitoredItems, UA_Client_MonitoredItem) monitoredItems; -} UA_Client_Subscription; - -void UA_Client_Subscriptions_forceDelete(UA_Client *client, UA_Client_Subscription *sub); - -#endif - -/**********/ -/* Client */ -/**********/ - -typedef struct AsyncServiceCall { - LIST_ENTRY(AsyncServiceCall) pointers; - UA_UInt32 requestId; - UA_ClientAsyncServiceCallback callback; - const UA_DataType *responseType; - void *userdata; -} AsyncServiceCall; - -typedef enum { UA_CLIENTAUTHENTICATION_NONE, UA_CLIENTAUTHENTICATION_USERNAME } UA_Client_Authentication; - -struct UA_Client { - /* State */ - UA_ClientState state; - UA_ClientConfig config; - - /* Connection */ - UA_Connection connection; - UA_String endpointUrl; - - /* SecureChannel */ - UA_SecurityPolicy securityPolicy; - UA_SecureChannel channel; - UA_UInt32 requestId; - UA_DateTime nextChannelRenewal; - - /* Authentication */ - UA_Client_Authentication authenticationMethod; - UA_String username; - UA_String password; - - /* Session */ - UA_UserTokenPolicy token; - UA_NodeId authenticationToken; - UA_UInt32 requestHandle; - - /* Async Service */ - LIST_HEAD(ListOfAsyncServiceCall, AsyncServiceCall) asyncServiceCalls; - -/* Subscriptions */ -#ifdef UA_ENABLE_SUBSCRIPTIONS - UA_UInt32 monitoredItemHandles; - LIST_HEAD(ListOfUnacknowledgedNotifications, UA_Client_NotificationsAckNumber) pendingNotificationsAcks; - LIST_HEAD(ListOfClientSubscriptionItems, UA_Client_Subscription) subscriptions; -#endif -}; - -UA_StatusCode UA_Client_connectInternal(UA_Client *client, const char *endpointUrl, UA_Boolean endpointsHandshake, - UA_Boolean createNewSession); - -UA_StatusCode UA_Client_getEndpointsInternal(UA_Client *client, size_t *endpointDescriptionsSize, - UA_EndpointDescription **endpointDescriptions); - -/* Receive and process messages until a synchronous message arrives or the - * timout finishes */ -UA_StatusCode receiveServiceResponse(UA_Client *client, void *response, const UA_DataType *responseType, - UA_DateTime maxDate, UA_UInt32 *synchronousRequestId); - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_types.c" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* Datatype Handling - * ----------------- - * This file contains handling functions for the builtin types and functions - * handling of structured types and arrays. These need type descriptions in a - * UA_DataType structure. The UA_DataType structures as well as all non-builtin - * datatypes are autogenerated. */ - -/* Global definition of NULL type instances. These are always zeroed out, as - * mandated by the C/C++ standard for global values with no initializer. */ -const UA_String UA_STRING_NULL = {0, NULL}; -const UA_ByteString UA_BYTESTRING_NULL = {0, NULL}; -const UA_Guid UA_GUID_NULL = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}}; -const UA_NodeId UA_NODEID_NULL = {0, UA_NODEIDTYPE_NUMERIC, {0}}; -const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL = {{0, UA_NODEIDTYPE_NUMERIC, {0}}, {0, NULL}, 0}; - -/* TODO: The standard-defined types are ordered. See if binary search is - * more efficient. */ -const UA_DataType *UA_findDataType(const UA_NodeId *typeId) { - if (typeId->identifierType != UA_NODEIDTYPE_NUMERIC || typeId->namespaceIndex != 0) return NULL; - for (size_t i = 0; i < UA_TYPES_COUNT; ++i) { - if (UA_TYPES[i].typeId.identifier.numeric == typeId->identifier.numeric) return &UA_TYPES[i]; - } - return NULL; -} - -/***************************/ -/* Random Number Generator */ -/***************************/ - -static UA_THREAD_LOCAL pcg32_random_t UA_rng = PCG32_INITIALIZER; - -void UA_random_seed(u64 seed) { pcg32_srandom_r(&UA_rng, seed, (u64)UA_DateTime_now()); } - -u32 UA_UInt32_random(void) { return (u32)pcg32_random_r(&UA_rng); } - -/*****************/ -/* Builtin Types */ -/*****************/ - -static void deleteMembers_noInit(void *p, const UA_DataType *type); -static UA_StatusCode copy_noInit(const void *src, void *dst, const UA_DataType *type); - -UA_String UA_String_fromChars(char const src[]) { - UA_String str; - str.length = strlen(src); - if (str.length > 0) { - str.data = (u8 *)UA_malloc(str.length); - if (!str.data) return UA_STRING_NULL; - memcpy(str.data, src, str.length); - } else { - str.data = (u8 *)UA_EMPTY_ARRAY_SENTINEL; - } - return str; -} - -UA_Boolean UA_String_equal(const UA_String *s1, const UA_String *s2) { - if (s1->length != s2->length) return false; - i32 is = memcmp((char const *)s1->data, (char const *)s2->data, s1->length); - return (is == 0) ? true : false; -} - -static void String_deleteMembers(UA_String *s, const UA_DataType *_) { - UA_free((void *)((uintptr_t)s->data & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL)); -} - -/* DateTime */ -UA_DateTimeStruct UA_DateTime_toStruct(UA_DateTime t) { - /* Calculating the the milli-, micro- and nanoseconds */ - UA_DateTimeStruct dateTimeStruct; - dateTimeStruct.nanoSec = (u16)((t % 10) * 100); - dateTimeStruct.microSec = (u16)((t % 10000) / 10); - dateTimeStruct.milliSec = (u16)((t % 10000000) / 10000); - - /* Calculating the unix time with #include */ - long long secSinceUnixEpoch = (long long)((t - UA_DATETIME_UNIX_EPOCH) / UA_DATETIME_SEC); - struct mytm ts; - memset(&ts, 0, sizeof(struct mytm)); - __secs_to_tm(secSinceUnixEpoch, &ts); - dateTimeStruct.sec = (u16)ts.tm_sec; - dateTimeStruct.min = (u16)ts.tm_min; - dateTimeStruct.hour = (u16)ts.tm_hour; - dateTimeStruct.day = (u16)ts.tm_mday; - dateTimeStruct.month = (u16)(ts.tm_mon + 1); - dateTimeStruct.year = (u16)(ts.tm_year + 1900); - return dateTimeStruct; -} - -static void printNumber(u16 n, u8 *pos, size_t digits) { - for (size_t i = digits; i > 0; --i) { - pos[i - 1] = (u8)((n % 10) + '0'); - n = n / 10; - } -} - -UA_String UA_DateTime_toString(UA_DateTime t) { - /* length of the string is 31 (plus \0 at the end) */ - UA_String str = {31, (u8 *)UA_malloc(32)}; - if (!str.data) return UA_STRING_NULL; - UA_DateTimeStruct tSt = UA_DateTime_toStruct(t); - printNumber(tSt.month, str.data, 2); - str.data[2] = '/'; - printNumber(tSt.day, &str.data[3], 2); - str.data[5] = '/'; - printNumber(tSt.year, &str.data[6], 4); - str.data[10] = ' '; - printNumber(tSt.hour, &str.data[11], 2); - str.data[13] = ':'; - printNumber(tSt.min, &str.data[14], 2); - str.data[16] = ':'; - printNumber(tSt.sec, &str.data[17], 2); - str.data[19] = '.'; - printNumber(tSt.milliSec, &str.data[20], 3); - str.data[23] = '.'; - printNumber(tSt.microSec, &str.data[24], 3); - str.data[27] = '.'; - printNumber(tSt.nanoSec, &str.data[28], 3); - return str; -} - -/* Guid */ -UA_Boolean UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2) { - if (memcmp(g1, g2, sizeof(UA_Guid)) == 0) return true; - return false; -} - -UA_Guid UA_Guid_random(void) { - UA_Guid result; - result.data1 = (u32)pcg32_random_r(&UA_rng); - u32 r = (u32)pcg32_random_r(&UA_rng); - result.data2 = (u16)r; - result.data3 = (u16)(r >> 16); - r = (u32)pcg32_random_r(&UA_rng); - result.data4[0] = (u8)r; - result.data4[1] = (u8)(r >> 4); - result.data4[2] = (u8)(r >> 8); - result.data4[3] = (u8)(r >> 12); - r = (u32)pcg32_random_r(&UA_rng); - result.data4[4] = (u8)r; - result.data4[5] = (u8)(r >> 4); - result.data4[6] = (u8)(r >> 8); - result.data4[7] = (u8)(r >> 12); - return result; -} - -/* ByteString */ -UA_StatusCode UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length) { - UA_ByteString_init(bs); - if (length == 0) return UA_STATUSCODE_GOOD; - bs->data = (u8 *)UA_malloc(length); - if (!bs->data) return UA_STATUSCODE_BADOUTOFMEMORY; - bs->length = length; - return UA_STATUSCODE_GOOD; -} - -/* NodeId */ -static void NodeId_deleteMembers(UA_NodeId *p, const UA_DataType *_) { - switch (p->identifierType) { - case UA_NODEIDTYPE_STRING: - case UA_NODEIDTYPE_BYTESTRING: - String_deleteMembers(&p->identifier.string, NULL); - break; - default: - break; - } -} - -static UA_StatusCode NodeId_copy(UA_NodeId const *src, UA_NodeId *dst, const UA_DataType *_) { - UA_StatusCode retval = UA_STATUSCODE_GOOD; - switch (src->identifierType) { - case UA_NODEIDTYPE_NUMERIC: - *dst = *src; - return UA_STATUSCODE_GOOD; - case UA_NODEIDTYPE_STRING: - retval |= UA_String_copy(&src->identifier.string, &dst->identifier.string); - break; - case UA_NODEIDTYPE_GUID: - retval |= UA_Guid_copy(&src->identifier.guid, &dst->identifier.guid); - break; - case UA_NODEIDTYPE_BYTESTRING: - retval |= UA_ByteString_copy(&src->identifier.byteString, &dst->identifier.byteString); - break; - default: - return UA_STATUSCODE_BADINTERNALERROR; - } - dst->namespaceIndex = src->namespaceIndex; - dst->identifierType = src->identifierType; - return retval; -} - -UA_Boolean UA_NodeId_isNull(const UA_NodeId *p) { - if (p->namespaceIndex != 0) return false; - switch (p->identifierType) { - case UA_NODEIDTYPE_NUMERIC: - return (p->identifier.numeric == 0); - case UA_NODEIDTYPE_GUID: - return (p->identifier.guid.data1 == 0 && p->identifier.guid.data2 == 0 && p->identifier.guid.data3 == 0 && - p->identifier.guid.data4[0] == 0 && p->identifier.guid.data4[1] == 0 && - p->identifier.guid.data4[2] == 0 && p->identifier.guid.data4[3] == 0 && - p->identifier.guid.data4[4] == 0 && p->identifier.guid.data4[5] == 0 && - p->identifier.guid.data4[6] == 0 && p->identifier.guid.data4[7] == 0); - default: - break; - } - return (p->identifier.string.length == 0); -} - -UA_Boolean UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2) { - if (n1->namespaceIndex != n2->namespaceIndex || n1->identifierType != n2->identifierType) return false; - switch (n1->identifierType) { - case UA_NODEIDTYPE_NUMERIC: - if (n1->identifier.numeric == n2->identifier.numeric) - return true; - else - return false; - case UA_NODEIDTYPE_STRING: - return UA_String_equal(&n1->identifier.string, &n2->identifier.string); - case UA_NODEIDTYPE_GUID: - return UA_Guid_equal(&n1->identifier.guid, &n2->identifier.guid); - case UA_NODEIDTYPE_BYTESTRING: - return UA_ByteString_equal(&n1->identifier.byteString, &n2->identifier.byteString); - } - return false; -} - -/* FNV non-cryptographic hash function. See - * https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function */ -#define FNV_PRIME_32 16777619 -static u32 fnv32(u32 fnv, const u8 *buf, size_t size) { - for (size_t i = 0; i < size; ++i) { - fnv = fnv ^ (buf[i]); - fnv = fnv * FNV_PRIME_32; - } - return fnv; -} - -u32 UA_NodeId_hash(const UA_NodeId *n) { - switch (n->identifierType) { - case UA_NODEIDTYPE_NUMERIC: - default: - // shift knuth multiplication to use highest 32 bits and after addition make sure we don't have an integer - // overflow - return (u32)((n->namespaceIndex + ((n->identifier.numeric * (u64)2654435761) >> (32))) & - UINT32_C(4294967295)); /* Knuth's multiplicative hashing */ - case UA_NODEIDTYPE_STRING: - case UA_NODEIDTYPE_BYTESTRING: - return fnv32(n->namespaceIndex, n->identifier.string.data, n->identifier.string.length); - case UA_NODEIDTYPE_GUID: - return fnv32(n->namespaceIndex, (const u8 *)&n->identifier.guid, sizeof(UA_Guid)); - } -} - -/* ExpandedNodeId */ -static void ExpandedNodeId_deleteMembers(UA_ExpandedNodeId *p, const UA_DataType *_) { - NodeId_deleteMembers(&p->nodeId, _); - String_deleteMembers(&p->namespaceUri, NULL); -} - -static UA_StatusCode ExpandedNodeId_copy(UA_ExpandedNodeId const *src, UA_ExpandedNodeId *dst, const UA_DataType *_) { - UA_StatusCode retval = NodeId_copy(&src->nodeId, &dst->nodeId, NULL); - retval |= UA_String_copy(&src->namespaceUri, &dst->namespaceUri); - dst->serverIndex = src->serverIndex; - return retval; -} - -/* ExtensionObject */ -static void ExtensionObject_deleteMembers(UA_ExtensionObject *p, const UA_DataType *_) { - switch (p->encoding) { - case UA_EXTENSIONOBJECT_ENCODED_NOBODY: - case UA_EXTENSIONOBJECT_ENCODED_BYTESTRING: - case UA_EXTENSIONOBJECT_ENCODED_XML: - NodeId_deleteMembers(&p->content.encoded.typeId, NULL); - String_deleteMembers(&p->content.encoded.body, NULL); - break; - case UA_EXTENSIONOBJECT_DECODED: - if (p->content.decoded.data) UA_delete(p->content.decoded.data, p->content.decoded.type); - break; - default: - break; - } -} - -static UA_StatusCode ExtensionObject_copy(UA_ExtensionObject const *src, UA_ExtensionObject *dst, - const UA_DataType *_) { - UA_StatusCode retval = UA_STATUSCODE_GOOD; - switch (src->encoding) { - case UA_EXTENSIONOBJECT_ENCODED_NOBODY: - case UA_EXTENSIONOBJECT_ENCODED_BYTESTRING: - case UA_EXTENSIONOBJECT_ENCODED_XML: - dst->encoding = src->encoding; - retval = NodeId_copy(&src->content.encoded.typeId, &dst->content.encoded.typeId, NULL); - retval |= UA_ByteString_copy(&src->content.encoded.body, &dst->content.encoded.body); - break; - case UA_EXTENSIONOBJECT_DECODED: - case UA_EXTENSIONOBJECT_DECODED_NODELETE: - if (!src->content.decoded.type || !src->content.decoded.data) return UA_STATUSCODE_BADINTERNALERROR; - dst->encoding = UA_EXTENSIONOBJECT_DECODED; - dst->content.decoded.type = src->content.decoded.type; - retval = UA_Array_copy(src->content.decoded.data, 1, &dst->content.decoded.data, src->content.decoded.type); - break; - default: - break; - } - return retval; -} - -/* Variant */ -static void Variant_deletemembers(UA_Variant *p, const UA_DataType *_) { - if (p->storageType != UA_VARIANT_DATA) return; - if (p->type && p->data > UA_EMPTY_ARRAY_SENTINEL) { - if (p->arrayLength == 0) p->arrayLength = 1; - UA_Array_delete(p->data, p->arrayLength, p->type); - } - if ((void *)p->arrayDimensions > UA_EMPTY_ARRAY_SENTINEL) UA_free(p->arrayDimensions); -} - -static UA_StatusCode Variant_copy(UA_Variant const *src, UA_Variant *dst, const UA_DataType *_) { - size_t length = src->arrayLength; - if (UA_Variant_isScalar(src)) length = 1; - UA_StatusCode retval = UA_Array_copy(src->data, length, &dst->data, src->type); - if (retval != UA_STATUSCODE_GOOD) return retval; - dst->arrayLength = src->arrayLength; - dst->type = src->type; - if (src->arrayDimensions) { - retval = UA_Array_copy(src->arrayDimensions, src->arrayDimensionsSize, (void **)&dst->arrayDimensions, - &UA_TYPES[UA_TYPES_INT32]); - if (retval != UA_STATUSCODE_GOOD) return retval; - dst->arrayDimensionsSize = src->arrayDimensionsSize; - } - return UA_STATUSCODE_GOOD; -} - -void UA_Variant_setScalar(UA_Variant *v, void *UA_RESTRICT p, const UA_DataType *type) { - UA_Variant_init(v); - v->type = type; - v->arrayLength = 0; - v->data = p; -} - -UA_StatusCode UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type) { - void *n = UA_malloc(type->memSize); - if (!n) return UA_STATUSCODE_BADOUTOFMEMORY; - UA_StatusCode retval = UA_copy(p, n, type); - if (retval != UA_STATUSCODE_GOOD) { - UA_free(n); - // cppcheck-suppress memleak - return retval; - } - UA_Variant_setScalar(v, n, type); - // cppcheck-suppress memleak - return UA_STATUSCODE_GOOD; -} - -void UA_Variant_setArray(UA_Variant *v, void *UA_RESTRICT array, size_t arraySize, const UA_DataType *type) { - UA_Variant_init(v); - v->data = array; - v->arrayLength = arraySize; - v->type = type; -} - -UA_StatusCode UA_Variant_setArrayCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_DataType *type) { - UA_Variant_init(v); - UA_StatusCode retval = UA_Array_copy(array, arraySize, &v->data, type); - if (retval != UA_STATUSCODE_GOOD) return retval; - v->arrayLength = arraySize; - v->type = type; - return UA_STATUSCODE_GOOD; -} - -/* Test if a range is compatible with a variant. If yes, the following values - * are set: - * - total: how many elements are in the range - * - block: how big is each contiguous block of elements in the variant that - * maps into the range - * - stride: how many elements are between the blocks (beginning to beginning) - * - first: where does the first block begin */ -static UA_StatusCode computeStrides(const UA_Variant *v, const UA_NumericRange range, size_t *total, size_t *block, - size_t *stride, size_t *first) { -/* Test for max array size (64bit only) */ -#if (SIZE_MAX > 0xffffffff) - if (v->arrayLength > UA_UINT32_MAX) return UA_STATUSCODE_BADINTERNALERROR; -#endif - - /* Test the integrity of the source variant dimensions, make dimensions - * vector of one dimension if none defined */ - u32 arrayLength = (u32)v->arrayLength; - const u32 *dims = &arrayLength; - size_t dims_count = 1; - if (v->arrayDimensionsSize > 0) { - size_t elements = 1; - dims_count = v->arrayDimensionsSize; - dims = (u32 *)v->arrayDimensions; - for (size_t i = 0; i < dims_count; ++i) elements *= dims[i]; - if (elements != v->arrayLength) return UA_STATUSCODE_BADINTERNALERROR; - } - UA_assert(dims_count > 0); - - /* Test the integrity of the range and compute the max index used for every - * dimension. The standard says in Part 4, Section 7.22: - * - * When reading a value, the indexes may not specify a range that is within - * the bounds of the array. The Server shall return a partial result if some - * elements exist within the range. */ - size_t count = 1; - UA_UInt32 *realmax = (UA_UInt32 *)UA_alloca(sizeof(UA_UInt32) * dims_count); - if (range.dimensionsSize != dims_count) return UA_STATUSCODE_BADINDEXRANGENODATA; - for (size_t i = 0; i < dims_count; ++i) { - if (range.dimensions[i].min > range.dimensions[i].max) return UA_STATUSCODE_BADINDEXRANGEINVALID; - if (range.dimensions[i].min >= dims[i]) return UA_STATUSCODE_BADINDEXRANGENODATA; - - if (range.dimensions[i].max < dims[i]) - realmax[i] = range.dimensions[i].max; - else - realmax[i] = dims[i] - 1; - - count *= (realmax[i] - range.dimensions[i].min) + 1; - } - - *total = count; - - /* Compute the stride length and the position of the first element */ - *block = count; /* Assume the range describes the entire array. */ - *stride = v->arrayLength; /* So it can be copied as a contiguous block. */ - *first = 0; - size_t running_dimssize = 1; - bool found_contiguous = false; - for (size_t k = dims_count; k > 0;) { - --k; - size_t dimrange = 1 + realmax[k] - range.dimensions[k].min; - if (!found_contiguous && dimrange != dims[k]) { - /* Found the maximum block that can be copied contiguously */ - found_contiguous = true; - *block = running_dimssize * dimrange; - *stride = running_dimssize * dims[k]; - } - *first += running_dimssize * range.dimensions[k].min; - running_dimssize *= dims[k]; - } - return UA_STATUSCODE_GOOD; -} - -/* Is the type string-like? */ -static bool isStringLike(const UA_DataType *type) { - if (type->membersSize == 1 && type->members[0].isArray && type->members[0].namespaceZero && - type->members[0].memberTypeIndex == UA_TYPES_BYTE) - return true; - return false; -} - -/* Returns the part of the string that lies within the rangedimension */ -static UA_StatusCode copySubString(const UA_String *src, UA_String *dst, const UA_NumericRangeDimension *dim) { - if (dim->min > dim->max) return UA_STATUSCODE_BADINDEXRANGEINVALID; - if (dim->min >= src->length) return UA_STATUSCODE_BADINDEXRANGENODATA; - - size_t length; - if (dim->max < src->length) - length = dim->max - dim->min + 1; - else - length = src->length - dim->min; - - UA_StatusCode retval = UA_ByteString_allocBuffer(dst, length); - if (retval != UA_STATUSCODE_GOOD) return retval; - - memcpy(dst->data, &src->data[dim->min], length); - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, const UA_NumericRange range) { - if (!src->type) return UA_STATUSCODE_BADINVALIDARGUMENT; - bool isScalar = UA_Variant_isScalar(src); - bool stringLike = isStringLike(src->type); - UA_Variant arraySrc; - - /* Extract the range for copying at this level. The remaining range is dealt - * with in the "scalar" type that may define an array by itself (string, - * variant, ...). */ - UA_NumericRange thisrange, nextrange; - UA_NumericRangeDimension scalarThisDimension = {0, 0}; /* a single entry */ - if (isScalar) { - /* Replace scalar src with array of length 1 */ - arraySrc = *src; - arraySrc.arrayLength = 1; - src = &arraySrc; - /* Deal with all range dimensions within the scalar */ - thisrange.dimensions = &scalarThisDimension; - thisrange.dimensionsSize = 1; - nextrange = range; - } else { - /* Deal with as many range dimensions as possible right now */ - size_t dims = src->arrayDimensionsSize; - if (dims == 0) dims = 1; - if (dims > range.dimensionsSize) return UA_STATUSCODE_BADINDEXRANGEINVALID; - thisrange = range; - thisrange.dimensionsSize = dims; - nextrange.dimensions = &range.dimensions[dims]; - nextrange.dimensionsSize = range.dimensionsSize - dims; - } - - /* Compute the strides */ - size_t count, block, stride, first; - UA_StatusCode retval = computeStrides(src, thisrange, &count, &block, &stride, &first); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Allocate the array */ - UA_Variant_init(dst); - dst->data = UA_Array_new(count, src->type); - if (!dst->data) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Copy the range */ - size_t block_count = count / block; - size_t elem_size = src->type->memSize; - uintptr_t nextdst = (uintptr_t)dst->data; - uintptr_t nextsrc = (uintptr_t)src->data + (elem_size * first); - if (nextrange.dimensionsSize == 0) { - /* no nextrange */ - if (src->type->pointerFree) { - for (size_t i = 0; i < block_count; ++i) { - memcpy((void *)nextdst, (void *)nextsrc, elem_size * block); - nextdst += block * elem_size; - nextsrc += stride * elem_size; - } - } else { - for (size_t i = 0; i < block_count; ++i) { - for (size_t j = 0; j < block; ++j) { - retval = UA_copy((const void *)nextsrc, (void *)nextdst, src->type); - nextdst += elem_size; - nextsrc += elem_size; - } - nextsrc += (stride - block) * elem_size; - } - } - } else { - /* nextrange can only be used for variants and stringlike with remaining - * range of dimension 1 */ - if (src->type != &UA_TYPES[UA_TYPES_VARIANT]) { - if (!stringLike) retval = UA_STATUSCODE_BADINDEXRANGENODATA; - if (nextrange.dimensionsSize != 1) retval = UA_STATUSCODE_BADINDEXRANGENODATA; - } - - /* Copy the content */ - for (size_t i = 0; i < block_count; ++i) { - for (size_t j = 0; j < block && retval == UA_STATUSCODE_GOOD; ++j) { - if (stringLike) - retval = copySubString((const UA_String *)nextsrc, (UA_String *)nextdst, nextrange.dimensions); - else - retval = UA_Variant_copyRange((const UA_Variant *)nextsrc, (UA_Variant *)nextdst, nextrange); - nextdst += elem_size; - nextsrc += elem_size; - } - nextsrc += (stride - block) * elem_size; - } - } - - /* Clean up if copying failed */ - if (retval != UA_STATUSCODE_GOOD) { - UA_Array_delete(dst->data, count, src->type); - dst->data = NULL; - return retval; - } - - /* Done if scalar */ - dst->type = src->type; - if (isScalar) return retval; - - /* Copy array dimensions */ - dst->arrayLength = count; - if (src->arrayDimensionsSize > 0) { - dst->arrayDimensions = (u32 *)UA_Array_new(thisrange.dimensionsSize, &UA_TYPES[UA_TYPES_UINT32]); - if (!dst->arrayDimensions) { - Variant_deletemembers(dst, NULL); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - dst->arrayDimensionsSize = thisrange.dimensionsSize; - for (size_t k = 0; k < thisrange.dimensionsSize; ++k) - dst->arrayDimensions[k] = thisrange.dimensions[k].max - thisrange.dimensions[k].min + 1; - } - return UA_STATUSCODE_GOOD; -} - -/* TODO: Allow ranges to reach inside a scalars that are array-like, e.g. - * variant and strings. This is already possible for reading... */ -static UA_StatusCode Variant_setRange(UA_Variant *v, void *array, size_t arraySize, const UA_NumericRange range, - bool copy) { - /* Compute the strides */ - size_t count, block, stride, first; - UA_StatusCode retval = computeStrides(v, range, &count, &block, &stride, &first); - if (retval != UA_STATUSCODE_GOOD) return retval; - if (count != arraySize) return UA_STATUSCODE_BADINDEXRANGEINVALID; - - /* Move/copy the elements */ - size_t block_count = count / block; - size_t elem_size = v->type->memSize; - uintptr_t nextdst = (uintptr_t)v->data + (first * elem_size); - uintptr_t nextsrc = (uintptr_t)array; - if (v->type->pointerFree || !copy) { - for (size_t i = 0; i < block_count; ++i) { - memcpy((void *)nextdst, (void *)nextsrc, elem_size * block); - nextsrc += block * elem_size; - nextdst += stride * elem_size; - } - } else { - for (size_t i = 0; i < block_count; ++i) { - for (size_t j = 0; j < block; ++j) { - deleteMembers_noInit((void *)nextdst, v->type); - retval |= UA_copy((void *)nextsrc, (void *)nextdst, v->type); - nextdst += elem_size; - nextsrc += elem_size; - } - nextdst += (stride - block) * elem_size; - } - } - - /* If members were moved, initialize original array to prevent reuse */ - if (!copy && !v->type->pointerFree) memset(array, 0, sizeof(elem_size) * arraySize); - - return retval; -} - -UA_StatusCode UA_Variant_setRange(UA_Variant *v, void *UA_RESTRICT array, size_t arraySize, - const UA_NumericRange range) { - return Variant_setRange(v, array, arraySize, range, false); -} - -UA_StatusCode UA_Variant_setRangeCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_NumericRange range) { - return Variant_setRange(v, (void *)(uintptr_t)array, arraySize, range, true); -} - -/* LocalizedText */ -static void LocalizedText_deleteMembers(UA_LocalizedText *p, const UA_DataType *_) { - String_deleteMembers(&p->locale, NULL); - String_deleteMembers(&p->text, NULL); -} - -static UA_StatusCode LocalizedText_copy(UA_LocalizedText const *src, UA_LocalizedText *dst, const UA_DataType *_) { - UA_StatusCode retval = UA_String_copy(&src->locale, &dst->locale); - retval |= UA_String_copy(&src->text, &dst->text); - return retval; -} - -/* DataValue */ -static void DataValue_deleteMembers(UA_DataValue *p, const UA_DataType *_) { Variant_deletemembers(&p->value, NULL); } - -static UA_StatusCode DataValue_copy(UA_DataValue const *src, UA_DataValue *dst, const UA_DataType *_) { - memcpy(dst, src, sizeof(UA_DataValue)); - UA_Variant_init(&dst->value); - UA_StatusCode retval = Variant_copy(&src->value, &dst->value, NULL); - if (retval != UA_STATUSCODE_GOOD) DataValue_deleteMembers(dst, NULL); - return retval; -} - -/* DiagnosticInfo */ -static void DiagnosticInfo_deleteMembers(UA_DiagnosticInfo *p, const UA_DataType *_) { - String_deleteMembers(&p->additionalInfo, NULL); - if (p->hasInnerDiagnosticInfo && p->innerDiagnosticInfo) { - DiagnosticInfo_deleteMembers(p->innerDiagnosticInfo, NULL); - UA_free(p->innerDiagnosticInfo); - } -} - -static UA_StatusCode DiagnosticInfo_copy(UA_DiagnosticInfo const *src, UA_DiagnosticInfo *dst, const UA_DataType *_) { - memcpy(dst, src, sizeof(UA_DiagnosticInfo)); - UA_String_init(&dst->additionalInfo); - dst->innerDiagnosticInfo = NULL; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (src->hasAdditionalInfo) retval = UA_String_copy(&src->additionalInfo, &dst->additionalInfo); - if (src->hasInnerDiagnosticInfo && src->innerDiagnosticInfo) { - dst->innerDiagnosticInfo = (UA_DiagnosticInfo *)UA_malloc(sizeof(UA_DiagnosticInfo)); - if (dst->innerDiagnosticInfo) { - retval |= DiagnosticInfo_copy(src->innerDiagnosticInfo, dst->innerDiagnosticInfo, NULL); - dst->hasInnerDiagnosticInfo = true; - } else { - dst->hasInnerDiagnosticInfo = false; - retval |= UA_STATUSCODE_BADOUTOFMEMORY; - } - } - return retval; -} - -/********************/ -/* Structured Types */ -/********************/ - -void *UA_new(const UA_DataType *type) { - void *p = UA_calloc(1, type->memSize); - return p; -} - -static UA_StatusCode copyByte(const u8 *src, u8 *dst, const UA_DataType *_) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode copy2Byte(const u16 *src, u16 *dst, const UA_DataType *_) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode copy4Byte(const u32 *src, u32 *dst, const UA_DataType *_) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode copy8Byte(const u64 *src, u64 *dst, const UA_DataType *_) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode copyGuid(const UA_Guid *src, UA_Guid *dst, const UA_DataType *_) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -typedef UA_StatusCode (*UA_copySignature)(const void *src, void *dst, const UA_DataType *type); - -static const UA_copySignature copyJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = { - (UA_copySignature)copyByte, // Boolean - (UA_copySignature)copyByte, // SByte - (UA_copySignature)copyByte, // Byte - (UA_copySignature)copy2Byte, // Int16 - (UA_copySignature)copy2Byte, // UInt16 - (UA_copySignature)copy4Byte, // Int32 - (UA_copySignature)copy4Byte, // UInt32 - (UA_copySignature)copy8Byte, // Int64 - (UA_copySignature)copy8Byte, // UInt64 - (UA_copySignature)copy4Byte, // Float - (UA_copySignature)copy8Byte, // Double - (UA_copySignature)copy_noInit, // String - (UA_copySignature)copy8Byte, // DateTime - (UA_copySignature)copyGuid, // Guid - (UA_copySignature)copy_noInit, // ByteString - (UA_copySignature)copy_noInit, // XmlElement - (UA_copySignature)NodeId_copy, - (UA_copySignature)ExpandedNodeId_copy, - (UA_copySignature)copy4Byte, // StatusCode - (UA_copySignature)copy_noInit, // QualifiedName - (UA_copySignature)LocalizedText_copy, // LocalizedText - (UA_copySignature)ExtensionObject_copy, - (UA_copySignature)DataValue_copy, - (UA_copySignature)Variant_copy, - (UA_copySignature)DiagnosticInfo_copy, - (UA_copySignature)copy_noInit // all others -}; - -static UA_StatusCode copy_noInit(const void *src, void *dst, const UA_DataType *type) { - UA_StatusCode retval = UA_STATUSCODE_GOOD; - uintptr_t ptrs = (uintptr_t)src; - uintptr_t ptrd = (uintptr_t)dst; - u8 membersSize = type->membersSize; - for (size_t i = 0; i < membersSize; ++i) { - const UA_DataTypeMember *m = &type->members[i]; - const UA_DataType *typelists[2] = {UA_TYPES, &type[-type->typeIndex]}; - const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex]; - if (!m->isArray) { - ptrs += m->padding; - ptrd += m->padding; - size_t fi = mt->builtin ? mt->typeIndex : UA_BUILTIN_TYPES_COUNT; - retval |= copyJumpTable[fi]((const void *)ptrs, (void *)ptrd, mt); - ptrs += mt->memSize; - ptrd += mt->memSize; - } else { - ptrs += m->padding; - ptrd += m->padding; - size_t *dst_size = (size_t *)ptrd; - const size_t size = *((const size_t *)ptrs); - ptrs += sizeof(size_t); - ptrd += sizeof(size_t); - retval |= UA_Array_copy(*(void *const *)ptrs, size, (void **)ptrd, mt); - if (retval == UA_STATUSCODE_GOOD) - *dst_size = size; - else - *dst_size = 0; - ptrs += sizeof(void *); - ptrd += sizeof(void *); - } - } - return retval; -} - -UA_StatusCode UA_copy(const void *src, void *dst, const UA_DataType *type) { - memset(dst, 0, type->memSize); /* init */ - UA_StatusCode retval = copy_noInit(src, dst, type); - if (retval != UA_STATUSCODE_GOOD) UA_deleteMembers(dst, type); - return retval; -} - -static void nopDeleteMembers(void *p, const UA_DataType *type) {} - -typedef void (*UA_deleteMembersSignature)(void *p, const UA_DataType *type); - -static const UA_deleteMembersSignature deleteMembersJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = { - (UA_deleteMembersSignature)nopDeleteMembers, // Boolean - (UA_deleteMembersSignature)nopDeleteMembers, // SByte - (UA_deleteMembersSignature)nopDeleteMembers, // Byte - (UA_deleteMembersSignature)nopDeleteMembers, // Int16 - (UA_deleteMembersSignature)nopDeleteMembers, // UInt16 - (UA_deleteMembersSignature)nopDeleteMembers, // Int32 - (UA_deleteMembersSignature)nopDeleteMembers, // UInt32 - (UA_deleteMembersSignature)nopDeleteMembers, // Int64 - (UA_deleteMembersSignature)nopDeleteMembers, // UInt64 - (UA_deleteMembersSignature)nopDeleteMembers, // Float - (UA_deleteMembersSignature)nopDeleteMembers, // Double - (UA_deleteMembersSignature)String_deleteMembers, // String - (UA_deleteMembersSignature)nopDeleteMembers, // DateTime - (UA_deleteMembersSignature)nopDeleteMembers, // Guid - (UA_deleteMembersSignature)String_deleteMembers, // ByteString - (UA_deleteMembersSignature)String_deleteMembers, // XmlElement - (UA_deleteMembersSignature)NodeId_deleteMembers, - (UA_deleteMembersSignature)ExpandedNodeId_deleteMembers, // ExpandedNodeId - (UA_deleteMembersSignature)nopDeleteMembers, // StatusCode - (UA_deleteMembersSignature)deleteMembers_noInit, // QualifiedName - (UA_deleteMembersSignature)LocalizedText_deleteMembers, // LocalizedText - (UA_deleteMembersSignature)ExtensionObject_deleteMembers, - (UA_deleteMembersSignature)DataValue_deleteMembers, - (UA_deleteMembersSignature)Variant_deletemembers, - (UA_deleteMembersSignature)DiagnosticInfo_deleteMembers, - (UA_deleteMembersSignature)deleteMembers_noInit, -}; - -static void deleteMembers_noInit(void *p, const UA_DataType *type) { - uintptr_t ptr = (uintptr_t)p; - u8 membersSize = type->membersSize; - for (size_t i = 0; i < membersSize; ++i) { - const UA_DataTypeMember *m = &type->members[i]; - const UA_DataType *typelists[2] = {UA_TYPES, &type[-type->typeIndex]}; - const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex]; - if (!m->isArray) { - ptr += m->padding; - size_t fi = mt->builtin ? mt->typeIndex : UA_BUILTIN_TYPES_COUNT; - deleteMembersJumpTable[fi]((void *)ptr, mt); - ptr += mt->memSize; - } else { - ptr += m->padding; - size_t length = *(size_t *)ptr; - ptr += sizeof(size_t); - UA_Array_delete(*(void **)ptr, length, mt); - ptr += sizeof(void *); - } - } -} - -void UA_deleteMembers(void *p, const UA_DataType *type) { - deleteMembers_noInit(p, type); - memset(p, 0, type->memSize); /* init */ -} - -void UA_delete(void *p, const UA_DataType *type) { - deleteMembers_noInit(p, type); - UA_free(p); -} - -/******************/ -/* Array Handling */ -/******************/ - -void *UA_Array_new(size_t size, const UA_DataType *type) { - if (size > UA_INT32_MAX) return NULL; - if (size == 0) return UA_EMPTY_ARRAY_SENTINEL; - return UA_calloc(size, type->memSize); -} - -UA_StatusCode UA_Array_copy(const void *src, size_t size, void **dst, const UA_DataType *type) { - if (size == 0) { - if (src == NULL) - *dst = NULL; - else - *dst = UA_EMPTY_ARRAY_SENTINEL; - return UA_STATUSCODE_GOOD; - } - - if (!type) return UA_STATUSCODE_BADINTERNALERROR; - - /* calloc, so we don't have to check retval in every iteration of copying */ - *dst = UA_calloc(size, type->memSize); - if (!*dst) return UA_STATUSCODE_BADOUTOFMEMORY; - - if (type->pointerFree) { - memcpy(*dst, src, type->memSize * size); - return UA_STATUSCODE_GOOD; - } - - uintptr_t ptrs = (uintptr_t)src; - uintptr_t ptrd = (uintptr_t)*dst; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - for (size_t i = 0; i < size; ++i) { - retval |= UA_copy((void *)ptrs, (void *)ptrd, type); - ptrs += type->memSize; - ptrd += type->memSize; - } - if (retval != UA_STATUSCODE_GOOD) { - UA_Array_delete(*dst, size, type); - *dst = NULL; - } - return retval; -} - -void UA_Array_delete(void *p, size_t size, const UA_DataType *type) { - if (!type->pointerFree) { - uintptr_t ptr = (uintptr_t)p; - for (size_t i = 0; i < size; ++i) { - UA_deleteMembers((void *)ptr, type); - ptr += type->memSize; - } - } - UA_free((void *)((uintptr_t)p & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL)); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_types_encoding_binary.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * Throw a warning if numeric types cannot be overlayed - * ---------------------------------------------------- */ - -#if defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-W#warnings" -#endif - -#ifndef UA_BINARY_OVERLAYABLE_INTEGER -#warning Integer endianness could not be detected to be little endian. \ - Use slow generic encoding. -#endif - -/* There is no robust way to detect float endianness in clang. - * UA_BINARY_OVERLAYABLE_FLOAT can be manually set if the target is known to be - * little endian with floats in the IEEE 754 format. */ -#ifndef UA_BINARY_OVERLAYABLE_FLOAT -#warning Float endianness could not be detected to be little endian in the IEEE \ - 754 format. Use slow generic encoding. -#endif - -#if defined(__clang__) -#pragma GCC diagnostic pop -#endif - -/** - * Type Encoding and Decoding - * -------------------------- - * The following methods contain encoding and decoding functions for the builtin - * data types and generic functions that operate on all types and arrays. This - * requires the type description from a UA_DataType structure. - * - * Breaking a message into chunks is integrated with the encoding. When the end - * of a buffer is reached, a callback is executed that sends the current buffer - * as a chunk and exchanges the encoding buffer "underneath" the ongoing - * encoding. This enables fast sending of large messages as spurious copying is - * avoided. */ - -/* Jumptables for de-/encoding and computing the buffer length. The methods in - * the decoding jumptable do not all clean up their allocated memory when an - * error occurs. So a final _deleteMembers needs to be called before returning - * to the user. */ -typedef status (*UA_encodeBinarySignature)(const void *UA_RESTRICT src, const UA_DataType *type); -extern const UA_encodeBinarySignature encodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1]; - -typedef status (*UA_decodeBinarySignature)(void *UA_RESTRICT dst, const UA_DataType *type); -extern const UA_decodeBinarySignature decodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1]; - -typedef size_t (*UA_calcSizeBinarySignature)(const void *UA_RESTRICT p, const UA_DataType *contenttype); -extern const UA_calcSizeBinarySignature calcSizeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1]; - -/* Pointer to custom datatypes in the server or client. Set inside - * UA_decodeBinary */ -static UA_THREAD_LOCAL size_t g_customTypesArraySize; -static UA_THREAD_LOCAL const UA_DataType *g_customTypesArray; - -/* Pointers to the current position and the last position in the buffer */ -static UA_THREAD_LOCAL u8 *g_pos; -static UA_THREAD_LOCAL const u8 *g_end; - -/* In UA_encodeBinaryInternal, we store a pointer to the last "good" position in - * the buffer. When encoding reaches the end of the buffer, send out a chunk - * until that position, replace the buffer and retry encoding after the last - * "checkpoint". The status code UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED is used - * exclusively to indicate that the end of the buffer was reached. - * - * In order to prevent restoring to an old buffer position (where the buffer was - * exchanged within a call from UA_encodeBinaryInternal and is no longer - * valied), no methods must return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED after - * calling exchangeBuffer(). This needs to be ensured for the following methods: - * - * UA_encodeBinaryInternal - * Array_encodeBinary - * NodeId_encodeBinary - * ExpandedNodeId_encodeBinary - * LocalizedText_encodeBinary - * ExtensionObject_encodeBinary - * Variant_encodeBinary - * DataValue_encodeBinary - * DiagnosticInfo_encodeBinary */ - -/* Thread-local buffers used for exchanging the buffer for chunking */ -static UA_THREAD_LOCAL UA_exchangeEncodeBuffer g_exchangeBufferCallback; -static UA_THREAD_LOCAL void *g_exchangeBufferCallbackHandle; - -/* Send the current chunk and replace the buffer */ -static status exchangeBuffer(void) { - if (!g_exchangeBufferCallback) return UA_STATUSCODE_BADENCODINGERROR; - return g_exchangeBufferCallback(g_exchangeBufferCallbackHandle, &g_pos, &g_end); -} - -/*****************/ -/* Integer Types */ -/*****************/ - -#if !UA_BINARY_OVERLAYABLE_INTEGER - -/* These en/decoding functions are only used when the architecture isn't little-endian. */ -static void UA_encode16(const u16 v, u8 buf[2]) { - buf[0] = (u8)v; - buf[1] = (u8)(v >> 8); -} - -static void UA_decode16(const u8 buf[2], u16 *v) { *v = (u16)((u16)buf[0] + (((u16)buf[1]) << 8)); } - -static void UA_encode32(const u32 v, u8 buf[4]) { - buf[0] = (u8)v; - buf[1] = (u8)(v >> 8); - buf[2] = (u8)(v >> 16); - buf[3] = (u8)(v >> 24); -} - -static void UA_decode32(const u8 buf[4], u32 *v) { - *v = (u32)((u32)buf[0] + (((u32)buf[1]) << 8) + (((u32)buf[2]) << 16) + (((u32)buf[3]) << 24)); -} - -static void UA_encode64(const u64 v, u8 buf[8]) { - buf[0] = (u8)v; - buf[1] = (u8)(v >> 8); - buf[2] = (u8)(v >> 16); - buf[3] = (u8)(v >> 24); - buf[4] = (u8)(v >> 32); - buf[5] = (u8)(v >> 40); - buf[6] = (u8)(v >> 48); - buf[7] = (u8)(v >> 56); -} - -static void UA_decode64(const u8 buf[8], u64 *v) { - *v = (u64)((u64)buf[0] + (((u64)buf[1]) << 8) + (((u64)buf[2]) << 16) + (((u64)buf[3]) << 24) + - (((u64)buf[4]) << 32) + (((u64)buf[5]) << 40) + (((u64)buf[6]) << 48) + (((u64)buf[7]) << 56)); -} - -#endif /* !UA_BINARY_OVERLAYABLE_INTEGER */ - -/* Boolean */ -static status Boolean_encodeBinary(const bool *src, const UA_DataType *_) { - if (g_pos + sizeof(bool) > g_end) return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED; - *g_pos = *(const u8 *)src; - ++g_pos; - return UA_STATUSCODE_GOOD; -} - -static status Boolean_decodeBinary(bool *dst, const UA_DataType *_) { - if (g_pos + sizeof(bool) > g_end) return UA_STATUSCODE_BADDECODINGERROR; - *dst = (*g_pos > 0) ? true : false; - ++g_pos; - return UA_STATUSCODE_GOOD; -} - -/* Byte */ -static status Byte_encodeBinary(const u8 *src, const UA_DataType *_) { - if (g_pos + sizeof(u8) > g_end) return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED; - *g_pos = *(const u8 *)src; - ++g_pos; - return UA_STATUSCODE_GOOD; -} - -static status Byte_decodeBinary(u8 *dst, const UA_DataType *_) { - if (g_pos + sizeof(u8) > g_end) return UA_STATUSCODE_BADDECODINGERROR; - *dst = *g_pos; - ++g_pos; - return UA_STATUSCODE_GOOD; -} - -/* UInt16 */ -static status UInt16_encodeBinary(u16 const *src, const UA_DataType *_) { - if (g_pos + sizeof(u16) > g_end) return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED; -#if UA_BINARY_OVERLAYABLE_INTEGER - memcpy(g_pos, src, sizeof(u16)); -#else - UA_encode16(*src, g_pos); -#endif - g_pos += 2; - return UA_STATUSCODE_GOOD; -} - -static status UInt16_decodeBinary(u16 *dst, const UA_DataType *_) { - if (g_pos + sizeof(u16) > g_end) return UA_STATUSCODE_BADDECODINGERROR; -#if UA_BINARY_OVERLAYABLE_INTEGER - memcpy(dst, g_pos, sizeof(u16)); -#else - UA_decode16(g_pos, dst); -#endif - g_pos += 2; - return UA_STATUSCODE_GOOD; -} - -/* UInt32 */ -static status UInt32_encodeBinary(u32 const *src, const UA_DataType *_) { - if (g_pos + sizeof(u32) > g_end) return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED; -#if UA_BINARY_OVERLAYABLE_INTEGER - memcpy(g_pos, src, sizeof(u32)); -#else - UA_encode32(*src, g_pos); -#endif - g_pos += 4; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE status Int32_encodeBinary(i32 const *src) { return UInt32_encodeBinary((const u32 *)src, NULL); } - -static status UInt32_decodeBinary(u32 *dst, const UA_DataType *_) { - if (g_pos + sizeof(u32) > g_end) return UA_STATUSCODE_BADDECODINGERROR; -#if UA_BINARY_OVERLAYABLE_INTEGER - memcpy(dst, g_pos, sizeof(u32)); -#else - UA_decode32(g_pos, dst); -#endif - g_pos += 4; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE status Int32_decodeBinary(i32 *dst) { return UInt32_decodeBinary((u32 *)dst, NULL); } - -static UA_INLINE status StatusCode_decodeBinary(status *dst) { return UInt32_decodeBinary((u32 *)dst, NULL); } - -/* UInt64 */ -static status UInt64_encodeBinary(u64 const *src, const UA_DataType *_) { - if (g_pos + sizeof(u64) > g_end) return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED; -#if UA_BINARY_OVERLAYABLE_INTEGER - memcpy(g_pos, src, sizeof(u64)); -#else - UA_encode64(*src, g_pos); -#endif - g_pos += 8; - return UA_STATUSCODE_GOOD; -} - -static status UInt64_decodeBinary(u64 *dst, const UA_DataType *_) { - if (g_pos + sizeof(u64) > g_end) return UA_STATUSCODE_BADDECODINGERROR; -#if UA_BINARY_OVERLAYABLE_INTEGER - memcpy(dst, g_pos, sizeof(u64)); -#else - UA_decode64(g_pos, dst); -#endif - g_pos += 8; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE status DateTime_decodeBinary(UA_DateTime *dst) { return UInt64_decodeBinary((u64 *)dst, NULL); } - -/************************/ -/* Floating Point Types */ -/************************/ - -#if UA_BINARY_OVERLAYABLE_FLOAT -#define Float_encodeBinary UInt32_encodeBinary -#define Float_decodeBinary UInt32_decodeBinary -#define Double_encodeBinary UInt64_encodeBinary -#define Double_decodeBinary UInt64_decodeBinary -#else - -#include - -/* Handling of IEEE754 floating point values was taken from Beej's Guide to - * Network Programming (http://beej.us/guide/bgnet/) and enhanced to cover the - * edge cases +/-0, +/-inf and nan. */ -static uint64_t pack754(long double f, unsigned bits, unsigned expbits) { - unsigned significandbits = bits - expbits - 1; - long double fnorm; - long long sign; - if (f < 0) { - sign = 1; - fnorm = -f; - } else { - sign = 0; - fnorm = f; - } - int shift = 0; - while (fnorm >= 2.0) { - fnorm /= 2.0; - ++shift; - } - while (fnorm < 1.0) { - fnorm *= 2.0; - --shift; - } - fnorm = fnorm - 1.0; - long long significand = (long long)(fnorm * ((float)(1LL << significandbits) + 0.5f)); - long long exponent = shift + ((1 << (expbits - 1)) - 1); - return (uint64_t)((sign << (bits - 1)) | (exponent << (bits - expbits - 1)) | significand); -} - -static long double unpack754(uint64_t i, unsigned bits, unsigned expbits) { - unsigned significandbits = bits - expbits - 1; - long double result = (long double)(i & (uint64_t)((1LL << significandbits) - 1)); - result /= (1LL << significandbits); - result += 1.0f; - unsigned bias = (unsigned)(1 << (expbits - 1)) - 1; - long long shift = (long long)((i >> significandbits) & (uint64_t)((1LL << expbits) - 1)) - bias; - while (shift > 0) { - result *= 2.0; - --shift; - } - while (shift < 0) { - result /= 2.0; - ++shift; - } - result *= ((i >> (bits - 1)) & 1) ? -1.0 : 1.0; - return result; -} - -/* Float */ -#define FLOAT_NAN 0xffc00000 -#define FLOAT_INF 0x7f800000 -#define FLOAT_NEG_INF 0xff800000 -#define FLOAT_NEG_ZERO 0x80000000 - -static status Float_encodeBinary(UA_Float const *src, const UA_DataType *_) { - UA_Float f = *src; - u32 encoded; - // cppcheck-suppress duplicateExpression - if (f != f) - encoded = FLOAT_NAN; - else if (f == 0.0f) - encoded = signbit(f) ? FLOAT_NEG_ZERO : 0; - // cppcheck-suppress duplicateExpression - else if (f / f != f / f) - encoded = f > 0 ? FLOAT_INF : FLOAT_NEG_INF; - else - encoded = (u32)pack754(f, 32, 8); - return UInt32_encodeBinary(&encoded, NULL); -} - -static status Float_decodeBinary(UA_Float *dst, const UA_DataType *_) { - u32 decoded; - status ret = UInt32_decodeBinary(&decoded, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - if (decoded == 0) - *dst = 0.0f; - else if (decoded == FLOAT_NEG_ZERO) - *dst = -0.0f; - else if (decoded == FLOAT_INF) - *dst = INFINITY; - else if (decoded == FLOAT_NEG_INF) - *dst = -INFINITY; - else if ((decoded >= 0x7f800001 && decoded <= 0x7fffffff) || (decoded >= 0xff800001)) - *dst = NAN; - else - *dst = (UA_Float)unpack754(decoded, 32, 8); - return UA_STATUSCODE_GOOD; -} - -/* Double */ -#define DOUBLE_NAN 0xfff8000000000000L -#define DOUBLE_INF 0x7ff0000000000000L -#define DOUBLE_NEG_INF 0xfff0000000000000L -#define DOUBLE_NEG_ZERO 0x8000000000000000L - -static status Double_encodeBinary(UA_Double const *src, const UA_DataType *_) { - UA_Double d = *src; - u64 encoded; - // cppcheck-suppress duplicateExpression - if (d != d) - encoded = DOUBLE_NAN; - else if (d == 0.0) - encoded = signbit(d) ? DOUBLE_NEG_ZERO : 0; - // cppcheck-suppress duplicateExpression - else if (d / d != d / d) - encoded = d > 0 ? DOUBLE_INF : DOUBLE_NEG_INF; - else - encoded = pack754(d, 64, 11); - return UInt64_encodeBinary(&encoded, NULL); -} - -static status Double_decodeBinary(UA_Double *dst, const UA_DataType *_) { - u64 decoded; - status ret = UInt64_decodeBinary(&decoded, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - if (decoded == 0) - *dst = 0.0; - else if (decoded == DOUBLE_NEG_ZERO) - *dst = -0.0; - else if (decoded == DOUBLE_INF) - *dst = INFINITY; - else if (decoded == DOUBLE_NEG_INF) - *dst = -INFINITY; - // cppcheck-suppress redundantCondition - else if ((decoded >= 0x7ff0000000000001L && decoded <= 0x7fffffffffffffffL) || (decoded >= 0xfff0000000000001L)) - *dst = NAN; - else - *dst = (UA_Double)unpack754(decoded, 64, 11); - return UA_STATUSCODE_GOOD; -} - -#endif - -/* If encoding fails, exchange the buffer and try again. It is assumed that - * encoding of numerical types never fails on a fresh buffer. */ -static status encodeNumericWithExchangeBuffer(const void *ptr, UA_encodeBinarySignature encodeFunc) { - status ret = encodeFunc(ptr, NULL); - if (ret == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED) { - ret = exchangeBuffer(); - if (ret != UA_STATUSCODE_GOOD) return ret; - encodeFunc(ptr, NULL); - } - return UA_STATUSCODE_GOOD; -} - -/* If the type is more complex, wrap encoding into the following method to - * ensure that the buffer is exchanged with intermediate checkpoints. */ -static status UA_encodeBinaryInternal(const void *src, const UA_DataType *type); - -/******************/ -/* Array Handling */ -/******************/ - -static status Array_encodeBinaryOverlayable(uintptr_t ptr, size_t length, size_t elementMemSize) { - /* Store the number of already encoded elements */ - size_t finished = 0; - - /* Loop as long as more elements remain than fit into the chunk */ - while (g_end < g_pos + (elementMemSize * (length - finished))) { - size_t possible = ((uintptr_t)g_end - (uintptr_t)g_pos) / (sizeof(u8) * elementMemSize); - size_t possibleMem = possible * elementMemSize; - memcpy(g_pos, (void *)ptr, possibleMem); - g_pos += possibleMem; - ptr += possibleMem; - finished += possible; - status ret = exchangeBuffer(); - if (ret != UA_STATUSCODE_GOOD) return ret; - } - - /* Encode the remaining elements */ - memcpy(g_pos, (void *)ptr, elementMemSize * (length - finished)); - g_pos += elementMemSize * (length - finished); - return UA_STATUSCODE_GOOD; -} - -static status Array_encodeBinaryComplex(uintptr_t ptr, size_t length, const UA_DataType *type) { - /* Get the encoding function for the data type. The jumptable at - * UA_BUILTIN_TYPES_COUNT points to the generic UA_encodeBinary method */ - size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT; - UA_encodeBinarySignature encodeType = encodeBinaryJumpTable[encode_index]; - - /* Encode every element */ - for (size_t i = 0; i < length; ++i) { - u8 *oldpos = g_pos; - status ret = encodeType((const void *)ptr, type); - ptr += type->memSize; - /* Encoding failed, switch to the next chunk when possible */ - if (ret != UA_STATUSCODE_GOOD) { - if (ret == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED) { - g_pos = oldpos; /* Set buffer position to the end of the last encoded element */ - ret = exchangeBuffer(); - ptr -= type->memSize; /* Undo to retry encoding the ith element */ - --i; - } - UA_assert(ret != UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED); - if (ret != UA_STATUSCODE_GOOD) return ret; /* Unrecoverable fail */ - } - } - return UA_STATUSCODE_GOOD; -} - -static status Array_encodeBinary(const void *src, size_t length, const UA_DataType *type) { - /* Check and convert the array length to int32 */ - i32 signed_length = -1; - if (length > UA_INT32_MAX) return UA_STATUSCODE_BADINTERNALERROR; - if (length > 0) - signed_length = (i32)length; - else if (src == UA_EMPTY_ARRAY_SENTINEL) - signed_length = 0; - - /* Encode the array length */ - status ret = encodeNumericWithExchangeBuffer(&signed_length, (UA_encodeBinarySignature)UInt32_encodeBinary); - - /* Quit early? */ - if (ret != UA_STATUSCODE_GOOD || length == 0) return ret; - - /* Encode the content */ - if (!type->overlayable) return Array_encodeBinaryComplex((uintptr_t)src, length, type); - return Array_encodeBinaryOverlayable((uintptr_t)src, length, type->memSize); -} - -static status Array_decodeBinary(void *UA_RESTRICT *UA_RESTRICT dst, size_t *out_length, const UA_DataType *type) { - /* Decode the length */ - i32 signed_length; - status ret = Int32_decodeBinary(&signed_length); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Return early for empty arrays */ - if (signed_length <= 0) { - *out_length = 0; - if (signed_length < 0) - *dst = NULL; - else - *dst = UA_EMPTY_ARRAY_SENTINEL; - return UA_STATUSCODE_GOOD; - } - - /* Filter out arrays that can obviously not be decoded, because the message - * is too small for the array length. This prevents the allocation of very - * long arrays for bogus messages.*/ - size_t length = (size_t)signed_length; - if (g_pos + ((type->memSize * length) / 32) > g_end) return UA_STATUSCODE_BADDECODINGERROR; - - /* Allocate memory */ - *dst = UA_calloc(length, type->memSize); - if (!*dst) return UA_STATUSCODE_BADOUTOFMEMORY; - - if (type->overlayable) { - /* memcpy overlayable array */ - if (g_end < g_pos + (type->memSize * length)) { - UA_free(*dst); - *dst = NULL; - return UA_STATUSCODE_BADDECODINGERROR; - } - memcpy(*dst, g_pos, type->memSize * length); - g_pos += type->memSize * length; - } else { - /* Decode array members */ - uintptr_t ptr = (uintptr_t)*dst; - size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT; - for (size_t i = 0; i < length; ++i) { - ret = decodeBinaryJumpTable[decode_index]((void *)ptr, type); - if (ret != UA_STATUSCODE_GOOD) { - // +1 because last element is also already initialized - UA_Array_delete(*dst, i + 1, type); - *dst = NULL; - return ret; - } - ptr += type->memSize; - } - } - *out_length = length; - return UA_STATUSCODE_GOOD; -} - -/*****************/ -/* Builtin Types */ -/*****************/ - -static status String_encodeBinary(UA_String const *src, const UA_DataType *_) { - return Array_encodeBinary(src->data, src->length, &UA_TYPES[UA_TYPES_BYTE]); -} - -static status String_decodeBinary(UA_String *dst, const UA_DataType *_) { - return Array_decodeBinary((void **)&dst->data, &dst->length, &UA_TYPES[UA_TYPES_BYTE]); -} - -static UA_INLINE status ByteString_encodeBinary(UA_ByteString const *src) { - return String_encodeBinary((const UA_String *)src, NULL); -} - -static UA_INLINE status ByteString_decodeBinary(UA_ByteString *dst) { - return String_decodeBinary((UA_ByteString *)dst, NULL); -} - -/* Guid */ -static status Guid_encodeBinary(UA_Guid const *src, const UA_DataType *_) { - status ret = UInt32_encodeBinary(&src->data1, NULL); - ret |= UInt16_encodeBinary(&src->data2, NULL); - ret |= UInt16_encodeBinary(&src->data3, NULL); - if (g_pos + (8 * sizeof(u8)) > g_end) return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED; - memcpy(g_pos, src->data4, 8 * sizeof(u8)); - g_pos += 8; - return ret; -} - -static status Guid_decodeBinary(UA_Guid *dst, const UA_DataType *_) { - status ret = UInt32_decodeBinary(&dst->data1, NULL); - ret |= UInt16_decodeBinary(&dst->data2, NULL); - ret |= UInt16_decodeBinary(&dst->data3, NULL); - if (g_pos + (8 * sizeof(u8)) > g_end) return UA_STATUSCODE_BADDECODINGERROR; - memcpy(dst->data4, g_pos, 8 * sizeof(u8)); - g_pos += 8; - return ret; -} - -/* NodeId */ -#define UA_NODEIDTYPE_NUMERIC_TWOBYTE 0 -#define UA_NODEIDTYPE_NUMERIC_FOURBYTE 1 -#define UA_NODEIDTYPE_NUMERIC_COMPLETE 2 - -#define UA_EXPANDEDNODEID_SERVERINDEX_FLAG 0x40 -#define UA_EXPANDEDNODEID_NAMESPACEURI_FLAG 0x80 - -/* For ExpandedNodeId, we prefill the encoding mask. We can return - * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED before encoding the string, as the - * buffer is not replaced. */ -static status NodeId_encodeBinaryWithEncodingMask(UA_NodeId const *src, u8 encoding) { - status ret = UA_STATUSCODE_GOOD; - switch (src->identifierType) { - case UA_NODEIDTYPE_NUMERIC: - if (src->identifier.numeric > UA_UINT16_MAX || src->namespaceIndex > UA_BYTE_MAX) { - encoding |= UA_NODEIDTYPE_NUMERIC_COMPLETE; - ret |= Byte_encodeBinary(&encoding, NULL); - ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL); - ret |= UInt32_encodeBinary(&src->identifier.numeric, NULL); - } else if (src->identifier.numeric > UA_BYTE_MAX || src->namespaceIndex > 0) { - encoding |= UA_NODEIDTYPE_NUMERIC_FOURBYTE; - ret |= Byte_encodeBinary(&encoding, NULL); - u8 nsindex = (u8)src->namespaceIndex; - ret |= Byte_encodeBinary(&nsindex, NULL); - u16 identifier16 = (u16)src->identifier.numeric; - ret |= UInt16_encodeBinary(&identifier16, NULL); - } else { - encoding |= UA_NODEIDTYPE_NUMERIC_TWOBYTE; - ret |= Byte_encodeBinary(&encoding, NULL); - u8 identifier8 = (u8)src->identifier.numeric; - ret |= Byte_encodeBinary(&identifier8, NULL); - } - break; - case UA_NODEIDTYPE_STRING: - encoding |= UA_NODEIDTYPE_STRING; - ret |= Byte_encodeBinary(&encoding, NULL); - ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - ret = String_encodeBinary(&src->identifier.string, NULL); - break; - case UA_NODEIDTYPE_GUID: - encoding |= UA_NODEIDTYPE_GUID; - ret |= Byte_encodeBinary(&encoding, NULL); - ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL); - ret |= Guid_encodeBinary(&src->identifier.guid, NULL); - break; - case UA_NODEIDTYPE_BYTESTRING: - encoding |= UA_NODEIDTYPE_BYTESTRING; - ret |= Byte_encodeBinary(&encoding, NULL); - ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - ret = ByteString_encodeBinary(&src->identifier.byteString); - break; - default: - return UA_STATUSCODE_BADINTERNALERROR; - } - return ret; -} - -static status NodeId_encodeBinary(UA_NodeId const *src, const UA_DataType *_) { - return NodeId_encodeBinaryWithEncodingMask(src, 0); -} - -static status NodeId_decodeBinary(UA_NodeId *dst, const UA_DataType *_) { - u8 dstByte = 0, encodingByte = 0; - u16 dstUInt16 = 0; - - /* Decode the encoding bitfield */ - status ret = Byte_decodeBinary(&encodingByte, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Filter out the bits used only for ExpandedNodeIds */ - encodingByte &= (u8) ~(UA_EXPANDEDNODEID_SERVERINDEX_FLAG | UA_EXPANDEDNODEID_NAMESPACEURI_FLAG); - - /* Decode the namespace and identifier */ - switch (encodingByte) { - case UA_NODEIDTYPE_NUMERIC_TWOBYTE: - dst->identifierType = UA_NODEIDTYPE_NUMERIC; - ret = Byte_decodeBinary(&dstByte, NULL); - dst->identifier.numeric = dstByte; - dst->namespaceIndex = 0; - break; - case UA_NODEIDTYPE_NUMERIC_FOURBYTE: - dst->identifierType = UA_NODEIDTYPE_NUMERIC; - ret |= Byte_decodeBinary(&dstByte, NULL); - dst->namespaceIndex = dstByte; - ret |= UInt16_decodeBinary(&dstUInt16, NULL); - dst->identifier.numeric = dstUInt16; - break; - case UA_NODEIDTYPE_NUMERIC_COMPLETE: - dst->identifierType = UA_NODEIDTYPE_NUMERIC; - ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL); - ret |= UInt32_decodeBinary(&dst->identifier.numeric, NULL); - break; - case UA_NODEIDTYPE_STRING: - dst->identifierType = UA_NODEIDTYPE_STRING; - ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL); - ret |= String_decodeBinary(&dst->identifier.string, NULL); - break; - case UA_NODEIDTYPE_GUID: - dst->identifierType = UA_NODEIDTYPE_GUID; - ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL); - ret |= Guid_decodeBinary(&dst->identifier.guid, NULL); - break; - case UA_NODEIDTYPE_BYTESTRING: - dst->identifierType = UA_NODEIDTYPE_BYTESTRING; - ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL); - ret |= ByteString_decodeBinary(&dst->identifier.byteString); - break; - default: - ret |= UA_STATUSCODE_BADINTERNALERROR; - break; - } - return ret; -} - -/* ExpandedNodeId */ -static status ExpandedNodeId_encodeBinary(UA_ExpandedNodeId const *src, const UA_DataType *_) { - /* Set up the encoding mask */ - u8 encoding = 0; - if ((void *)src->namespaceUri.data > UA_EMPTY_ARRAY_SENTINEL) encoding |= UA_EXPANDEDNODEID_NAMESPACEURI_FLAG; - if (src->serverIndex > 0) encoding |= UA_EXPANDEDNODEID_SERVERINDEX_FLAG; - - /* Encode the NodeId */ - status ret = NodeId_encodeBinaryWithEncodingMask(&src->nodeId, encoding); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Encode the namespace. Do not return - * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED afterwards. */ - if ((void *)src->namespaceUri.data > UA_EMPTY_ARRAY_SENTINEL) { - ret = String_encodeBinary(&src->namespaceUri, NULL); - UA_assert(ret != UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED); - if (ret != UA_STATUSCODE_GOOD) return ret; - } - - /* Encode the serverIndex */ - if (src->serverIndex > 0) - ret = encodeNumericWithExchangeBuffer(&src->serverIndex, (UA_encodeBinarySignature)UInt32_encodeBinary); - UA_assert(ret != UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED); - return ret; -} - -static status ExpandedNodeId_decodeBinary(UA_ExpandedNodeId *dst, const UA_DataType *_) { - /* Decode the encoding mask */ - if (g_pos >= g_end) return UA_STATUSCODE_BADDECODINGERROR; - u8 encoding = *g_pos; - - /* Decode the NodeId */ - status ret = NodeId_decodeBinary(&dst->nodeId, NULL); - - /* Decode the NamespaceUri */ - if (encoding & UA_EXPANDEDNODEID_NAMESPACEURI_FLAG) { - dst->nodeId.namespaceIndex = 0; - ret |= String_decodeBinary(&dst->namespaceUri, NULL); - } - - /* Decode the ServerIndex */ - if (encoding & UA_EXPANDEDNODEID_SERVERINDEX_FLAG) ret |= UInt32_decodeBinary(&dst->serverIndex, NULL); - return ret; -} - -/* LocalizedText */ -#define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE 0x01 -#define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT 0x02 - -static status LocalizedText_encodeBinary(UA_LocalizedText const *src, const UA_DataType *_) { - /* Set up the encoding mask */ - u8 encoding = 0; - if (src->locale.data) encoding |= UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE; - if (src->text.data) encoding |= UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT; - - /* Encode the encoding byte */ - status ret = Byte_encodeBinary(&encoding, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Encode the strings */ - if (encoding & UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE) ret |= String_encodeBinary(&src->locale, NULL); - if (encoding & UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT) ret |= String_encodeBinary(&src->text, NULL); - UA_assert(ret != UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED); - return ret; -} - -static status LocalizedText_decodeBinary(UA_LocalizedText *dst, const UA_DataType *_) { - /* Decode the encoding mask */ - u8 encoding = 0; - status ret = Byte_decodeBinary(&encoding, NULL); - - /* Decode the content */ - if (encoding & UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE) ret |= String_decodeBinary(&dst->locale, NULL); - if (encoding & UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT) ret |= String_decodeBinary(&dst->text, NULL); - return ret; -} - -/* The binary encoding has a different nodeid from the data type. So it is not - * possible to reuse UA_findDataType */ -const UA_DataType *UA_findDataTypeByBinary(const UA_NodeId *typeId) { - /* We only store a numeric identifier for the encoding nodeid of data types */ - if (typeId->identifierType != UA_NODEIDTYPE_NUMERIC) return NULL; - - /* Custom or standard data type? */ - const UA_DataType *types = UA_TYPES; - size_t typesSize = UA_TYPES_COUNT; - if (typeId->namespaceIndex != 0) { - types = g_customTypesArray; - typesSize = g_customTypesArraySize; - } - - /* Iterate over the array */ - for (size_t i = 0; i < typesSize; ++i) { - if (types[i].binaryEncodingId == typeId->identifier.numeric && - types[i].typeId.namespaceIndex == typeId->namespaceIndex) - return &types[i]; - } - return NULL; -} - -/* ExtensionObject */ -static status ExtensionObject_encodeBinary(UA_ExtensionObject const *src, const UA_DataType *_) { - u8 encoding = (u8)src->encoding; - - /* No content or already encoded content. Do not return - * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED after encoding the NodeId. */ - if (encoding <= UA_EXTENSIONOBJECT_ENCODED_XML) { - status ret = NodeId_encodeBinary(&src->content.encoded.typeId, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - ret = encodeNumericWithExchangeBuffer(&encoding, (UA_encodeBinarySignature)Byte_encodeBinary); - if (ret != UA_STATUSCODE_GOOD) return ret; - switch (src->encoding) { - case UA_EXTENSIONOBJECT_ENCODED_NOBODY: - break; - case UA_EXTENSIONOBJECT_ENCODED_BYTESTRING: - case UA_EXTENSIONOBJECT_ENCODED_XML: - ret = ByteString_encodeBinary(&src->content.encoded.body); - break; - default: - ret = UA_STATUSCODE_BADINTERNALERROR; - } - return ret; - } - - /* Cannot encode with no data or no type description */ - if (!src->content.decoded.type || !src->content.decoded.data) return UA_STATUSCODE_BADENCODINGERROR; - - /* Write the NodeId for the binary encoded type. The NodeId is always - * numeric, so no buffer replacement is taking place. */ - UA_NodeId typeId = src->content.decoded.type->typeId; - if (typeId.identifierType != UA_NODEIDTYPE_NUMERIC) return UA_STATUSCODE_BADENCODINGERROR; - typeId.identifier.numeric = src->content.decoded.type->binaryEncodingId; - status ret = NodeId_encodeBinary(&typeId, NULL); - - /* Write the encoding byte */ - encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING; - ret |= Byte_encodeBinary(&encoding, NULL); - - /* Compute the content length */ - const UA_DataType *type = src->content.decoded.type; - size_t len = UA_calcSizeBinary(src->content.decoded.data, type); - - /* Encode the content length */ - if (len > UA_INT32_MAX) return UA_STATUSCODE_BADENCODINGERROR; - i32 signed_len = (i32)len; - ret |= Int32_encodeBinary(&signed_len); - - /* Return early upon failures (no buffer exchange until here) */ - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Encode the content */ - return UA_encodeBinaryInternal(src->content.decoded.data, type); -} - -static status ExtensionObject_decodeBinaryContent(UA_ExtensionObject *dst, const UA_NodeId *typeId) { - /* Lookup the datatype */ - const UA_DataType *type = UA_findDataTypeByBinary(typeId); - - /* Unknown type, just take the binary content */ - if (!type) { - dst->encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING; - UA_NodeId_copy(typeId, &dst->content.encoded.typeId); - return ByteString_decodeBinary(&dst->content.encoded.body); - } - - /* Allocate memory */ - dst->content.decoded.data = UA_new(type); - if (!dst->content.decoded.data) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Jump over the length field (TODO: check if the decoded length matches) */ - g_pos += 4; - - /* Decode */ - dst->encoding = UA_EXTENSIONOBJECT_DECODED; - dst->content.decoded.type = type; - size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT; - return decodeBinaryJumpTable[decode_index](dst->content.decoded.data, type); -} - -static status ExtensionObject_decodeBinary(UA_ExtensionObject *dst, const UA_DataType *_) { - u8 encoding = 0; - UA_NodeId binTypeId; /* Can contain a string nodeid. But no corresponding - * type is then found in open62541. We only store - * numerical nodeids of the binary encoding identifier. - * The extenionobject will be decoded to contain a - * binary blob. */ - UA_NodeId_init(&binTypeId); - status ret = NodeId_decodeBinary(&binTypeId, NULL); - ret |= Byte_decodeBinary(&encoding, NULL); - if (ret != UA_STATUSCODE_GOOD) { - UA_NodeId_deleteMembers(&binTypeId); - return ret; - } - - if (encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) { - ret = ExtensionObject_decodeBinaryContent(dst, &binTypeId); - UA_NodeId_deleteMembers(&binTypeId); - } else if (encoding == UA_EXTENSIONOBJECT_ENCODED_NOBODY) { - dst->encoding = (UA_ExtensionObjectEncoding)encoding; - dst->content.encoded.typeId = binTypeId; /* move to dst */ - dst->content.encoded.body = UA_BYTESTRING_NULL; - } else if (encoding == UA_EXTENSIONOBJECT_ENCODED_XML) { - dst->encoding = (UA_ExtensionObjectEncoding)encoding; - dst->content.encoded.typeId = binTypeId; /* move to dst */ - ret = ByteString_decodeBinary(&dst->content.encoded.body); - if (ret != UA_STATUSCODE_GOOD) UA_NodeId_deleteMembers(&dst->content.encoded.typeId); - } else { - UA_NodeId_deleteMembers(&binTypeId); - ret = UA_STATUSCODE_BADDECODINGERROR; - } - - return ret; -} - -/* Variant */ - -/* Never returns UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED */ -static status Variant_encodeBinaryWrapExtensionObject(const UA_Variant *src, const bool isArray) { - /* Default to 1 for a scalar. */ - size_t length = 1; - - /* Encode the array length if required */ - status ret = UA_STATUSCODE_GOOD; - if (isArray) { - if (src->arrayLength > UA_INT32_MAX) return UA_STATUSCODE_BADENCODINGERROR; - length = src->arrayLength; - i32 encodedLength = (i32)src->arrayLength; - ret = Int32_encodeBinary(&encodedLength); - if (ret != UA_STATUSCODE_GOOD) return ret; - } - - /* Set up the ExtensionObject */ - UA_ExtensionObject eo; - UA_ExtensionObject_init(&eo); - eo.encoding = UA_EXTENSIONOBJECT_DECODED; - eo.content.decoded.type = src->type; - const u16 memSize = src->type->memSize; - uintptr_t ptr = (uintptr_t)src->data; - - /* Iterate over the array */ - for (size_t i = 0; i < length && ret == UA_STATUSCODE_GOOD; ++i) { - eo.content.decoded.data = (void *)ptr; - ret = UA_encodeBinaryInternal(&eo, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]); - ptr += memSize; - } - return ret; -} - -enum UA_VARIANT_ENCODINGMASKTYPE { - UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK = 0x3F, // bits 0:5 - UA_VARIANT_ENCODINGMASKTYPE_DIMENSIONS = (0x01 << 6), // bit 6 - UA_VARIANT_ENCODINGMASKTYPE_ARRAY = (0x01 << 7) // bit 7 -}; - -static status Variant_encodeBinary(const UA_Variant *src, const UA_DataType *_) { - /* Quit early for the empty variant */ - u8 encoding = 0; - if (!src->type) return Byte_encodeBinary(&encoding, NULL); - - /* Set the content type in the encoding mask */ - const bool isBuiltin = src->type->builtin; - if (isBuiltin) - encoding |= UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK & (u8)(src->type->typeIndex + 1); - else - encoding |= UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK & (u8)(UA_TYPES_EXTENSIONOBJECT + 1); - - /* Set the array type in the encoding mask */ - const bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL; - const bool hasDimensions = isArray && src->arrayDimensionsSize > 0; - if (isArray) { - encoding |= UA_VARIANT_ENCODINGMASKTYPE_ARRAY; - if (hasDimensions) encoding |= UA_VARIANT_ENCODINGMASKTYPE_DIMENSIONS; - } - - /* Encode the encoding byte */ - status ret = Byte_encodeBinary(&encoding, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Encode the content */ - if (!isBuiltin) - ret = Variant_encodeBinaryWrapExtensionObject(src, isArray); - else if (!isArray) - ret = UA_encodeBinaryInternal(src->data, src->type); - else - ret = Array_encodeBinary(src->data, src->arrayLength, src->type); - - /* Encode the array dimensions */ - if (hasDimensions && ret == UA_STATUSCODE_GOOD) - ret = Array_encodeBinary(src->arrayDimensions, src->arrayDimensionsSize, &UA_TYPES[UA_TYPES_INT32]); - return ret; -} - -static status Variant_decodeBinaryUnwrapExtensionObject(UA_Variant *dst) { - /* Save the position in the ByteString. If unwrapping is not possible, start - * from here to decode a normal ExtensionObject. */ - u8 *old_pos = g_pos; - - /* Decode the DataType */ - UA_NodeId typeId; - UA_NodeId_init(&typeId); - status ret = NodeId_decodeBinary(&typeId, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Decode the EncodingByte */ - u8 encoding; - ret = Byte_decodeBinary(&encoding, NULL); - if (ret != UA_STATUSCODE_GOOD) { - UA_NodeId_deleteMembers(&typeId); - return ret; - } - - /* Search for the datatype. Default to ExtensionObject. */ - if (encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING && (dst->type = UA_findDataTypeByBinary(&typeId)) != NULL) { - /* Jump over the length field (TODO: check if length matches) */ - g_pos += 4; - } else { - /* Reset and decode as ExtensionObject */ - dst->type = &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]; - g_pos = old_pos; - UA_NodeId_deleteMembers(&typeId); - } - - /* Allocate memory */ - dst->data = UA_new(dst->type); - if (!dst->data) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Decode the content */ - size_t decode_index = dst->type->builtin ? dst->type->typeIndex : UA_BUILTIN_TYPES_COUNT; - return decodeBinaryJumpTable[decode_index](dst->data, dst->type); -} - -/* The resulting variant always has the storagetype UA_VARIANT_DATA. */ -static status Variant_decodeBinary(UA_Variant *dst, const UA_DataType *_) { - /* Decode the encoding byte */ - u8 encodingByte; - status ret = Byte_decodeBinary(&encodingByte, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Return early for an empty variant (was already _inited) */ - if (encodingByte == 0) return UA_STATUSCODE_GOOD; - - /* Does the variant contain an array? */ - const bool isArray = (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_ARRAY) > 0; - - /* Get the datatype of the content. The type must be a builtin data type. - * All not-builtin types are wrapped in an ExtensionObject. - * The content can not be a variant again, otherwise we may run into a stack overflow problem. - * See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4233 */ - size_t typeIndex = (size_t)((encodingByte & UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK) - 1); - if (typeIndex > UA_TYPES_DIAGNOSTICINFO || typeIndex == UA_TYPES_VARIANT) return UA_STATUSCODE_BADDECODINGERROR; - dst->type = &UA_TYPES[typeIndex]; - - /* Decode the content */ - if (isArray) { - ret = Array_decodeBinary(&dst->data, &dst->arrayLength, dst->type); - } else if (typeIndex != UA_TYPES_EXTENSIONOBJECT) { - dst->data = UA_new(dst->type); - if (!dst->data) return UA_STATUSCODE_BADOUTOFMEMORY; - ret = decodeBinaryJumpTable[typeIndex](dst->data, dst->type); - } else { - ret = Variant_decodeBinaryUnwrapExtensionObject(dst); - } - - /* Decode array dimensions */ - if (isArray && (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_DIMENSIONS) > 0) - ret |= Array_decodeBinary((void **)&dst->arrayDimensions, &dst->arrayDimensionsSize, &UA_TYPES[UA_TYPES_INT32]); - return ret; -} - -/* DataValue */ -static status DataValue_encodeBinary(UA_DataValue const *src, const UA_DataType *_) { - /* Set up the encoding mask */ - u8 encodingMask = (u8)(((u8)src->hasValue) | ((u8)src->hasStatus << 1) | ((u8)src->hasSourceTimestamp << 2) | - ((u8)src->hasServerTimestamp << 3) | ((u8)src->hasSourcePicoseconds << 4) | - ((u8)src->hasServerPicoseconds << 5)); - - /* Encode the encoding byte */ - status ret = Byte_encodeBinary(&encodingMask, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Encode the variant. Afterwards, do not return - * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, as the buffer might have been - * exchanged during encoding of the variant. */ - if (src->hasValue) { - ret = Variant_encodeBinary(&src->value, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - } - - if (src->hasStatus) - ret |= encodeNumericWithExchangeBuffer(&src->status, (UA_encodeBinarySignature)UInt32_encodeBinary); - if (src->hasSourceTimestamp) - ret |= encodeNumericWithExchangeBuffer(&src->sourceTimestamp, (UA_encodeBinarySignature)UInt64_encodeBinary); - if (src->hasSourcePicoseconds) - ret |= encodeNumericWithExchangeBuffer(&src->sourcePicoseconds, (UA_encodeBinarySignature)UInt16_encodeBinary); - if (src->hasServerTimestamp) - ret |= encodeNumericWithExchangeBuffer(&src->serverTimestamp, (UA_encodeBinarySignature)UInt64_encodeBinary); - if (src->hasServerPicoseconds) - ret |= encodeNumericWithExchangeBuffer(&src->serverPicoseconds, (UA_encodeBinarySignature)UInt16_encodeBinary); - UA_assert(ret != UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED); - return ret; -} - -#define MAX_PICO_SECONDS 9999 - -static status DataValue_decodeBinary(UA_DataValue *dst, const UA_DataType *_) { - /* Decode the encoding mask */ - u8 encodingMask; - status ret = Byte_decodeBinary(&encodingMask, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Decode the content */ - if (encodingMask & 0x01) { - dst->hasValue = true; - ret |= Variant_decodeBinary(&dst->value, NULL); - } - if (encodingMask & 0x02) { - dst->hasStatus = true; - ret |= StatusCode_decodeBinary(&dst->status); - } - if (encodingMask & 0x04) { - dst->hasSourceTimestamp = true; - ret |= DateTime_decodeBinary(&dst->sourceTimestamp); - } - if (encodingMask & 0x10) { - dst->hasSourcePicoseconds = true; - ret |= UInt16_decodeBinary(&dst->sourcePicoseconds, NULL); - if (dst->sourcePicoseconds > MAX_PICO_SECONDS) dst->sourcePicoseconds = MAX_PICO_SECONDS; - } - if (encodingMask & 0x08) { - dst->hasServerTimestamp = true; - ret |= DateTime_decodeBinary(&dst->serverTimestamp); - } - if (encodingMask & 0x20) { - dst->hasServerPicoseconds = true; - ret |= UInt16_decodeBinary(&dst->serverPicoseconds, NULL); - if (dst->serverPicoseconds > MAX_PICO_SECONDS) dst->serverPicoseconds = MAX_PICO_SECONDS; - } - return ret; -} - -/* DiagnosticInfo */ -static status DiagnosticInfo_encodeBinary(const UA_DiagnosticInfo *src, const UA_DataType *_) { - /* Set up the encoding mask */ - u8 encodingMask = - (u8)((u8)src->hasSymbolicId | ((u8)src->hasNamespaceUri << 1) | ((u8)src->hasLocalizedText << 2) | - ((u8)src->hasLocale << 3) | ((u8)src->hasAdditionalInfo << 4) | ((u8)src->hasInnerDiagnosticInfo << 5)); - - /* Encode the numeric content */ - status ret = Byte_encodeBinary(&encodingMask, NULL); - if (src->hasSymbolicId) ret |= Int32_encodeBinary(&src->symbolicId); - if (src->hasNamespaceUri) ret |= Int32_encodeBinary(&src->namespaceUri); - if (src->hasLocalizedText) ret |= Int32_encodeBinary(&src->localizedText); - if (src->hasLocale) ret |= Int32_encodeBinary(&src->locale); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Encode the additional info */ - if (src->hasAdditionalInfo) { - ret = String_encodeBinary(&src->additionalInfo, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - } - - /* From here on, do not return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, as - * the buffer might have been exchanged during encoding of the string. */ - - /* Encode the inner status code */ - if (src->hasInnerStatusCode) { - ret = encodeNumericWithExchangeBuffer(&src->innerStatusCode, (UA_encodeBinarySignature)UInt32_encodeBinary); - UA_assert(ret != UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED); - if (ret != UA_STATUSCODE_GOOD) return ret; - } - - /* Encode the inner diagnostic info */ - if (src->hasInnerDiagnosticInfo) - ret = UA_encodeBinaryInternal(src->innerDiagnosticInfo, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO]); - - UA_assert(ret != UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED); - return ret; -} - -static status DiagnosticInfo_decodeBinary(UA_DiagnosticInfo *dst, const UA_DataType *_) { - /* Decode the encoding mask */ - u8 encodingMask; - status ret = Byte_decodeBinary(&encodingMask, NULL); - if (ret != UA_STATUSCODE_GOOD) return ret; - - /* Decode the content */ - if (encodingMask & 0x01) { - dst->hasSymbolicId = true; - ret |= Int32_decodeBinary(&dst->symbolicId); - } - if (encodingMask & 0x02) { - dst->hasNamespaceUri = true; - ret |= Int32_decodeBinary(&dst->namespaceUri); - } - if (encodingMask & 0x04) { - dst->hasLocalizedText = true; - ret |= Int32_decodeBinary(&dst->localizedText); - } - if (encodingMask & 0x08) { - dst->hasLocale = true; - ret |= Int32_decodeBinary(&dst->locale); - } - if (encodingMask & 0x10) { - dst->hasAdditionalInfo = true; - ret |= String_decodeBinary(&dst->additionalInfo, NULL); - } - if (encodingMask & 0x20) { - dst->hasInnerStatusCode = true; - ret |= StatusCode_decodeBinary(&dst->innerStatusCode); - } - if (encodingMask & 0x40) { - /* innerDiagnosticInfo is allocated on the heap */ - dst->innerDiagnosticInfo = (UA_DiagnosticInfo *)UA_calloc(1, sizeof(UA_DiagnosticInfo)); - if (!dst->innerDiagnosticInfo) return UA_STATUSCODE_BADOUTOFMEMORY; - dst->hasInnerDiagnosticInfo = true; - ret |= DiagnosticInfo_decodeBinary(dst->innerDiagnosticInfo, NULL); - } - return ret; -} - -/********************/ -/* Structured Types */ -/********************/ - -static status UA_decodeBinaryInternal(void *dst, const UA_DataType *type); - -const UA_encodeBinarySignature encodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = { - (UA_encodeBinarySignature)Boolean_encodeBinary, - (UA_encodeBinarySignature)Byte_encodeBinary, // SByte - (UA_encodeBinarySignature)Byte_encodeBinary, - (UA_encodeBinarySignature)UInt16_encodeBinary, // Int16 - (UA_encodeBinarySignature)UInt16_encodeBinary, - (UA_encodeBinarySignature)UInt32_encodeBinary, // Int32 - (UA_encodeBinarySignature)UInt32_encodeBinary, - (UA_encodeBinarySignature)UInt64_encodeBinary, // Int64 - (UA_encodeBinarySignature)UInt64_encodeBinary, (UA_encodeBinarySignature)Float_encodeBinary, - (UA_encodeBinarySignature)Double_encodeBinary, (UA_encodeBinarySignature)String_encodeBinary, - (UA_encodeBinarySignature)UInt64_encodeBinary, // DateTime - (UA_encodeBinarySignature)Guid_encodeBinary, - (UA_encodeBinarySignature)String_encodeBinary, // ByteString - (UA_encodeBinarySignature)String_encodeBinary, // XmlElement - (UA_encodeBinarySignature)NodeId_encodeBinary, (UA_encodeBinarySignature)ExpandedNodeId_encodeBinary, - (UA_encodeBinarySignature)UInt32_encodeBinary, // StatusCode - (UA_encodeBinarySignature)UA_encodeBinaryInternal, // QualifiedName - (UA_encodeBinarySignature)LocalizedText_encodeBinary, (UA_encodeBinarySignature)ExtensionObject_encodeBinary, - (UA_encodeBinarySignature)DataValue_encodeBinary, (UA_encodeBinarySignature)Variant_encodeBinary, - (UA_encodeBinarySignature)DiagnosticInfo_encodeBinary, (UA_encodeBinarySignature)UA_encodeBinaryInternal, -}; - -static status UA_encodeBinaryInternal(const void *src, const UA_DataType *type) { - uintptr_t ptr = (uintptr_t)src; - status ret = UA_STATUSCODE_GOOD; - u8 membersSize = type->membersSize; - const UA_DataType *typelists[2] = {UA_TYPES, &type[-type->typeIndex]}; - for (size_t i = 0; i < membersSize && ret == UA_STATUSCODE_GOOD; ++i) { - const UA_DataTypeMember *member = &type->members[i]; - const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex]; - if (!member->isArray) { - ptr += member->padding; - size_t encode_index = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT; - size_t memSize = membertype->memSize; - u8 *oldpos = g_pos; - ret = encodeBinaryJumpTable[encode_index]((const void *)ptr, membertype); - ptr += memSize; - if (ret == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED) { - g_pos = oldpos; /* exchange/send the buffer */ - ret = exchangeBuffer(); - ptr -= member->padding + memSize; /* encode the same member in the next iteration */ - if (ret == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED || g_pos + memSize > g_end) { - /* the send buffer is too small to encode the member, even after exchangeBuffer */ - return UA_STATUSCODE_BADRESPONSETOOLARGE; - } - --i; - } - } else { - ptr += member->padding; - const size_t length = *((const size_t *)ptr); - ptr += sizeof(size_t); - ret = Array_encodeBinary(*(void *UA_RESTRICT const *)ptr, length, membertype); - ptr += sizeof(void *); - } - } - UA_assert(ret != UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED); - return ret; -} - -status UA_encodeBinary(const void *src, const UA_DataType *type, u8 **bufPos, const u8 **bufEnd, - UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle) { - /* Save global (thread-local) values to make UA_encodeBinary reentrant */ - u8 *save_pos = g_pos; - const u8 *save_end = g_end; - UA_exchangeEncodeBuffer save_exchangeBufferCallback = g_exchangeBufferCallback; - void *save_exchangeBufferCallbackHandle = g_exchangeBufferCallbackHandle; - - /* Set the (thread-local) pointers to save function arguments */ - g_pos = *bufPos; - g_end = *bufEnd; - g_exchangeBufferCallback = exchangeCallback; - g_exchangeBufferCallbackHandle = exchangeHandle; - - /* Encode */ - status ret = UA_encodeBinaryInternal(src, type); - - /* Set the new buffer position for the output. Beware that the buffer might - * have been exchanged internally. */ - *bufPos = g_pos; - *bufEnd = g_end; - - /* Restore global (thread-local) values */ - g_pos = save_pos; - g_end = save_end; - g_exchangeBufferCallback = save_exchangeBufferCallback; - g_exchangeBufferCallbackHandle = save_exchangeBufferCallbackHandle; - return ret; -} - -const UA_decodeBinarySignature decodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = { - (UA_decodeBinarySignature)Boolean_decodeBinary, - (UA_decodeBinarySignature)Byte_decodeBinary, // SByte - (UA_decodeBinarySignature)Byte_decodeBinary, - (UA_decodeBinarySignature)UInt16_decodeBinary, // Int16 - (UA_decodeBinarySignature)UInt16_decodeBinary, - (UA_decodeBinarySignature)UInt32_decodeBinary, // Int32 - (UA_decodeBinarySignature)UInt32_decodeBinary, - (UA_decodeBinarySignature)UInt64_decodeBinary, // Int64 - (UA_decodeBinarySignature)UInt64_decodeBinary, (UA_decodeBinarySignature)Float_decodeBinary, - (UA_decodeBinarySignature)Double_decodeBinary, (UA_decodeBinarySignature)String_decodeBinary, - (UA_decodeBinarySignature)UInt64_decodeBinary, // DateTime - (UA_decodeBinarySignature)Guid_decodeBinary, - (UA_decodeBinarySignature)String_decodeBinary, // ByteString - (UA_decodeBinarySignature)String_decodeBinary, // XmlElement - (UA_decodeBinarySignature)NodeId_decodeBinary, (UA_decodeBinarySignature)ExpandedNodeId_decodeBinary, - (UA_decodeBinarySignature)UInt32_decodeBinary, // StatusCode - (UA_decodeBinarySignature)UA_decodeBinaryInternal, // QualifiedName - (UA_decodeBinarySignature)LocalizedText_decodeBinary, (UA_decodeBinarySignature)ExtensionObject_decodeBinary, - (UA_decodeBinarySignature)DataValue_decodeBinary, (UA_decodeBinarySignature)Variant_decodeBinary, - (UA_decodeBinarySignature)DiagnosticInfo_decodeBinary, (UA_decodeBinarySignature)UA_decodeBinaryInternal}; - -static status UA_decodeBinaryInternal(void *dst, const UA_DataType *type) { - uintptr_t ptr = (uintptr_t)dst; - status ret = UA_STATUSCODE_GOOD; - u8 membersSize = type->membersSize; - const UA_DataType *typelists[2] = {UA_TYPES, &type[-type->typeIndex]}; - for (size_t i = 0; i < membersSize && ret == UA_STATUSCODE_GOOD; ++i) { - const UA_DataTypeMember *member = &type->members[i]; - const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex]; - if (!member->isArray) { - ptr += member->padding; - size_t fi = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT; - size_t memSize = membertype->memSize; - ret |= decodeBinaryJumpTable[fi]((void *UA_RESTRICT)ptr, membertype); - ptr += memSize; - } else { - ptr += member->padding; - size_t *length = (size_t *)ptr; - ptr += sizeof(size_t); - ret |= Array_decodeBinary((void *UA_RESTRICT *UA_RESTRICT)ptr, length, membertype); - ptr += sizeof(void *); - } - } - return ret; -} - -status UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst, const UA_DataType *type, - size_t customTypesSize, const UA_DataType *customTypes) { - /* Save global (thread-local) values to make UA_decodeBinary reentrant */ - size_t save_customTypesArraySize = g_customTypesArraySize; - const UA_DataType *save_customTypesArray = g_customTypesArray; - u8 *save_pos = g_pos; - const u8 *save_end = g_end; - - /* Global pointers to the custom datatypes. */ - g_customTypesArraySize = customTypesSize; - g_customTypesArray = customTypes; - - /* Global position pointers */ - g_pos = &src->data[*offset]; - g_end = &src->data[src->length]; - - /* Initialize the value */ - memset(dst, 0, type->memSize); - - /* Decode */ - status ret = UA_decodeBinaryInternal(dst, type); - - if (ret == UA_STATUSCODE_GOOD) { - /* Set the new offset */ - *offset = (size_t)(g_pos - src->data) / sizeof(u8); - } else { - /* Clean up */ - UA_deleteMembers(dst, type); - memset(dst, 0, type->memSize); - } - - /* Restore global (thread-local) values */ - g_customTypesArraySize = save_customTypesArraySize; - g_customTypesArray = save_customTypesArray; - g_pos = save_pos; - g_end = save_end; - - return ret; -} - -/** - * Compute the Message Size - * ------------------------ - * The following methods are used to compute the length of a datum in binary - * encoding. */ - -static size_t Array_calcSizeBinary(const void *src, size_t length, const UA_DataType *type) { - size_t s = 4; // length - if (type->overlayable) { - s += type->memSize * length; - return s; - } - uintptr_t ptr = (uintptr_t)src; - size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT; - for (size_t i = 0; i < length; ++i) { - s += calcSizeBinaryJumpTable[encode_index]((const void *)ptr, type); - ptr += type->memSize; - } - return s; -} - -static size_t calcSizeBinaryMemSize(const void *UA_RESTRICT p, const UA_DataType *type) { return type->memSize; } - -static size_t String_calcSizeBinary(const UA_String *UA_RESTRICT p, const UA_DataType *_) { return 4 + p->length; } - -static size_t Guid_calcSizeBinary(const UA_Guid *UA_RESTRICT p, const UA_DataType *_) { return 16; } - -static size_t NodeId_calcSizeBinary(const UA_NodeId *UA_RESTRICT src, const UA_DataType *_) { - size_t s = 1; // encoding byte - switch (src->identifierType) { - case UA_NODEIDTYPE_NUMERIC: - if (src->identifier.numeric > UA_UINT16_MAX || src->namespaceIndex > UA_BYTE_MAX) { - s += 6; - } else if (src->identifier.numeric > UA_BYTE_MAX || src->namespaceIndex > 0) { - s += 3; - } else { - s += 1; - } - break; - case UA_NODEIDTYPE_BYTESTRING: - case UA_NODEIDTYPE_STRING: - s += 2; - s += String_calcSizeBinary(&src->identifier.string, NULL); - break; - case UA_NODEIDTYPE_GUID: - s += 18; - break; - default: - return 0; - } - return s; -} - -static size_t ExpandedNodeId_calcSizeBinary(const UA_ExpandedNodeId *src, const UA_DataType *_) { - size_t s = NodeId_calcSizeBinary(&src->nodeId, NULL); - if (src->namespaceUri.length > 0) s += String_calcSizeBinary(&src->namespaceUri, NULL); - if (src->serverIndex > 0) s += 4; - return s; -} - -static size_t LocalizedText_calcSizeBinary(const UA_LocalizedText *src, UA_DataType *_) { - size_t s = 1; // encoding byte - if (src->locale.data) s += String_calcSizeBinary(&src->locale, NULL); - if (src->text.data) s += String_calcSizeBinary(&src->text, NULL); - return s; -} - -static size_t ExtensionObject_calcSizeBinary(const UA_ExtensionObject *src, UA_DataType *_) { - size_t s = 1; // encoding byte - if (src->encoding > UA_EXTENSIONOBJECT_ENCODED_XML) { - if (!src->content.decoded.type || !src->content.decoded.data) return 0; - if (src->content.decoded.type->typeId.identifierType != UA_NODEIDTYPE_NUMERIC) return 0; - s += NodeId_calcSizeBinary(&src->content.decoded.type->typeId, NULL); - s += 4; // length - const UA_DataType *type = src->content.decoded.type; - size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT; - s += calcSizeBinaryJumpTable[encode_index](src->content.decoded.data, type); - } else { - s += NodeId_calcSizeBinary(&src->content.encoded.typeId, NULL); - switch (src->encoding) { - case UA_EXTENSIONOBJECT_ENCODED_NOBODY: - break; - case UA_EXTENSIONOBJECT_ENCODED_BYTESTRING: - case UA_EXTENSIONOBJECT_ENCODED_XML: - s += String_calcSizeBinary(&src->content.encoded.body, NULL); - break; - default: - return 0; - } - } - return s; -} - -static size_t Variant_calcSizeBinary(UA_Variant const *src, UA_DataType *_) { - size_t s = 1; /* encoding byte */ - if (!src->type) return s; - - bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL; - bool hasDimensions = isArray && src->arrayDimensionsSize > 0; - bool isBuiltin = src->type->builtin; - - UA_NodeId typeId; - UA_NodeId_init(&typeId); - size_t encode_index = src->type->typeIndex; - if (!isBuiltin) { - encode_index = UA_BUILTIN_TYPES_COUNT; - typeId = src->type->typeId; - if (typeId.identifierType != UA_NODEIDTYPE_NUMERIC) return 0; - } - - size_t length = src->arrayLength; - if (isArray) - s += 4; - else - length = 1; - - uintptr_t ptr = (uintptr_t)src->data; - size_t memSize = src->type->memSize; - for (size_t i = 0; i < length; ++i) { - if (!isBuiltin) { - /* The type is wrapped inside an extensionobject */ - s += NodeId_calcSizeBinary(&typeId, NULL); - s += 1 + 4; // encoding byte + length - } - s += calcSizeBinaryJumpTable[encode_index]((const void *)ptr, src->type); - ptr += memSize; - } - - if (hasDimensions) - s += Array_calcSizeBinary(src->arrayDimensions, src->arrayDimensionsSize, &UA_TYPES[UA_TYPES_INT32]); - return s; -} - -static size_t DataValue_calcSizeBinary(const UA_DataValue *src, UA_DataType *_) { - size_t s = 1; // encoding byte - if (src->hasValue) s += Variant_calcSizeBinary(&src->value, NULL); - if (src->hasStatus) s += 4; - if (src->hasSourceTimestamp) s += 8; - if (src->hasSourcePicoseconds) s += 2; - if (src->hasServerTimestamp) s += 8; - if (src->hasServerPicoseconds) s += 2; - return s; -} - -static size_t DiagnosticInfo_calcSizeBinary(const UA_DiagnosticInfo *src, UA_DataType *_) { - size_t s = 1; // encoding byte - if (src->hasSymbolicId) s += 4; - if (src->hasNamespaceUri) s += 4; - if (src->hasLocalizedText) s += 4; - if (src->hasLocale) s += 4; - if (src->hasAdditionalInfo) s += String_calcSizeBinary(&src->additionalInfo, NULL); - if (src->hasInnerStatusCode) s += 4; - if (src->hasInnerDiagnosticInfo) s += DiagnosticInfo_calcSizeBinary(src->innerDiagnosticInfo, NULL); - return s; -} - -const UA_calcSizeBinarySignature calcSizeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = { - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Boolean - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Byte - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int16 - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int32 - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int64 - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Float - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Double - (UA_calcSizeBinarySignature)String_calcSizeBinary, - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // DateTime - (UA_calcSizeBinarySignature)Guid_calcSizeBinary, - (UA_calcSizeBinarySignature)String_calcSizeBinary, // ByteString - (UA_calcSizeBinarySignature)String_calcSizeBinary, // XmlElement - (UA_calcSizeBinarySignature)NodeId_calcSizeBinary, - (UA_calcSizeBinarySignature)ExpandedNodeId_calcSizeBinary, - (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // StatusCode - (UA_calcSizeBinarySignature)UA_calcSizeBinary, // QualifiedName - (UA_calcSizeBinarySignature)LocalizedText_calcSizeBinary, - (UA_calcSizeBinarySignature)ExtensionObject_calcSizeBinary, - (UA_calcSizeBinarySignature)DataValue_calcSizeBinary, - (UA_calcSizeBinarySignature)Variant_calcSizeBinary, - (UA_calcSizeBinarySignature)DiagnosticInfo_calcSizeBinary, - (UA_calcSizeBinarySignature)UA_calcSizeBinary}; - -size_t UA_calcSizeBinary(void *p, const UA_DataType *type) { - size_t s = 0; - uintptr_t ptr = (uintptr_t)p; - u8 membersSize = type->membersSize; - const UA_DataType *typelists[2] = {UA_TYPES, &type[-type->typeIndex]}; - for (size_t i = 0; i < membersSize; ++i) { - const UA_DataTypeMember *member = &type->members[i]; - const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex]; - if (!member->isArray) { - ptr += member->padding; - size_t encode_index = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT; - s += calcSizeBinaryJumpTable[encode_index]((const void *)ptr, membertype); - ptr += membertype->memSize; - } else { - ptr += member->padding; - const size_t length = *((const size_t *)ptr); - ptr += sizeof(size_t); - s += Array_calcSizeBinary(*(void *UA_RESTRICT const *)ptr, length, membertype); - ptr += sizeof(void *); - } - } - return s; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_types_generated.c" - * ***********************************/ - -/* Generated from Opc.Ua.Types.bsd with script - * /home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/tools/generate_datatypes.py - * on host nmpc by user max at 2018-01-05 04:21:09 */ - -/* Boolean */ -static UA_DataTypeMember Boolean_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SByte */ -static UA_DataTypeMember SByte_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_SBYTE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* Byte */ -static UA_DataTypeMember Byte_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* Int16 */ -static UA_DataTypeMember Int16_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT16, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* UInt16 */ -static UA_DataTypeMember UInt16_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_UINT16, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* Int32 */ -static UA_DataTypeMember Int32_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* UInt32 */ -static UA_DataTypeMember UInt32_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* Int64 */ -static UA_DataTypeMember Int64_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT64, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* UInt64 */ -static UA_DataTypeMember UInt64_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_UINT64, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* Float */ -static UA_DataTypeMember Float_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_FLOAT, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* Double */ -static UA_DataTypeMember Double_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* String */ -static UA_DataTypeMember String_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* DateTime */ -static UA_DataTypeMember DateTime_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* Guid */ -static UA_DataTypeMember Guid_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_GUID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ByteString */ -static UA_DataTypeMember ByteString_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* XmlElement */ -static UA_DataTypeMember XmlElement_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* NodeId */ -static UA_DataTypeMember NodeId_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ExpandedNodeId */ -static UA_DataTypeMember ExpandedNodeId_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* StatusCode */ -static UA_DataTypeMember StatusCode_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* QualifiedName */ -static UA_DataTypeMember QualifiedName_members[2] = { - { - UA_TYPENAME("namespaceIndex") /* .memberName */ - UA_TYPES_INT16, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("name") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_QualifiedName, name) - offsetof(UA_QualifiedName, namespaceIndex) - sizeof(UA_Int16), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* LocalizedText */ -static UA_DataTypeMember LocalizedText_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ExtensionObject */ -static UA_DataTypeMember ExtensionObject_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* DataValue */ -static UA_DataTypeMember DataValue_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_DATAVALUE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* Variant */ -static UA_DataTypeMember Variant_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_VARIANT, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* DiagnosticInfo */ -static UA_DataTypeMember DiagnosticInfo_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* IdType */ -static UA_DataTypeMember IdType_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* NodeClass */ -static UA_DataTypeMember NodeClass_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ReferenceNode */ -static UA_DataTypeMember ReferenceNode_members[3] = { - { - UA_TYPENAME("referenceTypeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("isInverse") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_ReferenceNode, isInverse) - offsetof(UA_ReferenceNode, referenceTypeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("targetId") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - offsetof(UA_ReferenceNode, targetId) - offsetof(UA_ReferenceNode, isInverse) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* Argument */ -static UA_DataTypeMember Argument_members[5] = { - { - UA_TYPENAME("name") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("dataType") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_Argument, dataType) - offsetof(UA_Argument, name) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("valueRank") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - offsetof(UA_Argument, valueRank) - offsetof(UA_Argument, dataType) - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("arrayDimensions") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_Argument, arrayDimensionsSize) - offsetof(UA_Argument, valueRank) - sizeof(UA_Int32), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("description") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_Argument, description) - offsetof(UA_Argument, arrayDimensions) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* Duration */ -static UA_DataTypeMember Duration_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* UtcTime */ -static UA_DataTypeMember UtcTime_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* LocaleId */ -static UA_DataTypeMember LocaleId_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* TimeZoneDataType */ -static UA_DataTypeMember TimeZoneDataType_members[2] = { - { - UA_TYPENAME("offset") /* .memberName */ - UA_TYPES_INT16, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("daylightSavingInOffset") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_TimeZoneDataType, daylightSavingInOffset) - offsetof(UA_TimeZoneDataType, offset) - - sizeof(UA_Int16), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ApplicationType */ -static UA_DataTypeMember ApplicationType_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ApplicationDescription */ -static UA_DataTypeMember ApplicationDescription_members[7] = { - { - UA_TYPENAME("applicationUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("productUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_ApplicationDescription, productUri) - offsetof(UA_ApplicationDescription, applicationUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("applicationName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ApplicationDescription, applicationName) - offsetof(UA_ApplicationDescription, productUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("applicationType") /* .memberName */ - UA_TYPES_APPLICATIONTYPE, /* .memberTypeIndex */ - offsetof(UA_ApplicationDescription, applicationType) - offsetof(UA_ApplicationDescription, applicationName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("gatewayServerUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_ApplicationDescription, gatewayServerUri) - offsetof(UA_ApplicationDescription, applicationType) - - sizeof(UA_ApplicationType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("discoveryProfileUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_ApplicationDescription, discoveryProfileUri) - - offsetof(UA_ApplicationDescription, gatewayServerUri) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("discoveryUrls") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_ApplicationDescription, discoveryUrlsSize) - - offsetof(UA_ApplicationDescription, discoveryProfileUri) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* RequestHeader */ -static UA_DataTypeMember RequestHeader_members[7] = { - { - UA_TYPENAME("authenticationToken") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("timestamp") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - offsetof(UA_RequestHeader, timestamp) - offsetof(UA_RequestHeader, authenticationToken) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestHandle") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_RequestHeader, requestHandle) - offsetof(UA_RequestHeader, timestamp) - - sizeof(UA_DateTime), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("returnDiagnostics") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_RequestHeader, returnDiagnostics) - offsetof(UA_RequestHeader, requestHandle) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("auditEntryId") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_RequestHeader, auditEntryId) - offsetof(UA_RequestHeader, returnDiagnostics) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("timeoutHint") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_RequestHeader, timeoutHint) - offsetof(UA_RequestHeader, auditEntryId) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("additionalHeader") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - offsetof(UA_RequestHeader, additionalHeader) - offsetof(UA_RequestHeader, timeoutHint) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ResponseHeader */ -static UA_DataTypeMember ResponseHeader_members[6] = { - { - UA_TYPENAME("timestamp") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestHandle") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ResponseHeader, requestHandle) - offsetof(UA_ResponseHeader, timestamp) - - sizeof(UA_DateTime), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serviceResult") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_ResponseHeader, serviceResult) - offsetof(UA_ResponseHeader, requestHandle) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serviceDiagnostics") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_ResponseHeader, serviceDiagnostics) - offsetof(UA_ResponseHeader, serviceResult) - - sizeof(UA_StatusCode), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("stringTable") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_ResponseHeader, stringTableSize) - offsetof(UA_ResponseHeader, serviceDiagnostics) - - sizeof(UA_DiagnosticInfo), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("additionalHeader") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - offsetof(UA_ResponseHeader, additionalHeader) - offsetof(UA_ResponseHeader, stringTable) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ServiceFault */ -static UA_DataTypeMember ServiceFault_members[1] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* FindServersRequest */ -static UA_DataTypeMember FindServersRequest_members[4] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("endpointUrl") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_FindServersRequest, endpointUrl) - offsetof(UA_FindServersRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("localeIds") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_FindServersRequest, localeIdsSize) - offsetof(UA_FindServersRequest, endpointUrl) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("serverUris") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_FindServersRequest, serverUrisSize) - offsetof(UA_FindServersRequest, localeIds) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* FindServersResponse */ -static UA_DataTypeMember FindServersResponse_members[2] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("servers") /* .memberName */ - UA_TYPES_APPLICATIONDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_FindServersResponse, serversSize) - offsetof(UA_FindServersResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* ServerOnNetwork */ -static UA_DataTypeMember ServerOnNetwork_members[4] = { - { - UA_TYPENAME("recordId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverName") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_ServerOnNetwork, serverName) - offsetof(UA_ServerOnNetwork, recordId) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("discoveryUrl") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_ServerOnNetwork, discoveryUrl) - offsetof(UA_ServerOnNetwork, serverName) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverCapabilities") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_ServerOnNetwork, serverCapabilitiesSize) - offsetof(UA_ServerOnNetwork, discoveryUrl) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* FindServersOnNetworkRequest */ -static UA_DataTypeMember FindServersOnNetworkRequest_members[4] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("startingRecordId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_FindServersOnNetworkRequest, startingRecordId) - - offsetof(UA_FindServersOnNetworkRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxRecordsToReturn") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_FindServersOnNetworkRequest, maxRecordsToReturn) - - offsetof(UA_FindServersOnNetworkRequest, startingRecordId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverCapabilityFilter") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_FindServersOnNetworkRequest, serverCapabilityFilterSize) - - offsetof(UA_FindServersOnNetworkRequest, maxRecordsToReturn) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* FindServersOnNetworkResponse */ -static UA_DataTypeMember FindServersOnNetworkResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("lastCounterResetTime") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - offsetof(UA_FindServersOnNetworkResponse, lastCounterResetTime) - - offsetof(UA_FindServersOnNetworkResponse, responseHeader) - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("servers") /* .memberName */ - UA_TYPES_SERVERONNETWORK, /* .memberTypeIndex */ - offsetof(UA_FindServersOnNetworkResponse, serversSize) - - offsetof(UA_FindServersOnNetworkResponse, lastCounterResetTime) - sizeof(UA_DateTime), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* MessageSecurityMode */ -static UA_DataTypeMember MessageSecurityMode_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* UserTokenType */ -static UA_DataTypeMember UserTokenType_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* UserTokenPolicy */ -static UA_DataTypeMember UserTokenPolicy_members[5] = { - { - UA_TYPENAME("policyId") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("tokenType") /* .memberName */ - UA_TYPES_USERTOKENTYPE, /* .memberTypeIndex */ - offsetof(UA_UserTokenPolicy, tokenType) - offsetof(UA_UserTokenPolicy, policyId) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("issuedTokenType") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_UserTokenPolicy, issuedTokenType) - offsetof(UA_UserTokenPolicy, tokenType) - - sizeof(UA_UserTokenType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("issuerEndpointUrl") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_UserTokenPolicy, issuerEndpointUrl) - offsetof(UA_UserTokenPolicy, issuedTokenType) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("securityPolicyUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_UserTokenPolicy, securityPolicyUri) - offsetof(UA_UserTokenPolicy, issuerEndpointUrl) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* EndpointDescription */ -static UA_DataTypeMember EndpointDescription_members[8] = { - { - UA_TYPENAME("endpointUrl") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("server") /* .memberName */ - UA_TYPES_APPLICATIONDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_EndpointDescription, server) - offsetof(UA_EndpointDescription, endpointUrl) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverCertificate") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_EndpointDescription, serverCertificate) - offsetof(UA_EndpointDescription, server) - - sizeof(UA_ApplicationDescription), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("securityMode") /* .memberName */ - UA_TYPES_MESSAGESECURITYMODE, /* .memberTypeIndex */ - offsetof(UA_EndpointDescription, securityMode) - offsetof(UA_EndpointDescription, serverCertificate) - - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("securityPolicyUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_EndpointDescription, securityPolicyUri) - offsetof(UA_EndpointDescription, securityMode) - - sizeof(UA_MessageSecurityMode), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userIdentityTokens") /* .memberName */ - UA_TYPES_USERTOKENPOLICY, /* .memberTypeIndex */ - offsetof(UA_EndpointDescription, userIdentityTokensSize) - offsetof(UA_EndpointDescription, securityPolicyUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("transportProfileUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_EndpointDescription, transportProfileUri) - offsetof(UA_EndpointDescription, userIdentityTokens) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("securityLevel") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_EndpointDescription, securityLevel) - offsetof(UA_EndpointDescription, transportProfileUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* GetEndpointsRequest */ -static UA_DataTypeMember GetEndpointsRequest_members[4] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("endpointUrl") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_GetEndpointsRequest, endpointUrl) - offsetof(UA_GetEndpointsRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("localeIds") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_GetEndpointsRequest, localeIdsSize) - offsetof(UA_GetEndpointsRequest, endpointUrl) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("profileUris") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_GetEndpointsRequest, profileUrisSize) - offsetof(UA_GetEndpointsRequest, localeIds) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* GetEndpointsResponse */ -static UA_DataTypeMember GetEndpointsResponse_members[2] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("endpoints") /* .memberName */ - UA_TYPES_ENDPOINTDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_GetEndpointsResponse, endpointsSize) - offsetof(UA_GetEndpointsResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* RegisteredServer */ -static UA_DataTypeMember RegisteredServer_members[8] = { - { - UA_TYPENAME("serverUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("productUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_RegisteredServer, productUri) - offsetof(UA_RegisteredServer, serverUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverNames") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_RegisteredServer, serverNamesSize) - offsetof(UA_RegisteredServer, productUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("serverType") /* .memberName */ - UA_TYPES_APPLICATIONTYPE, /* .memberTypeIndex */ - offsetof(UA_RegisteredServer, serverType) - offsetof(UA_RegisteredServer, serverNames) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("gatewayServerUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_RegisteredServer, gatewayServerUri) - offsetof(UA_RegisteredServer, serverType) - - sizeof(UA_ApplicationType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("discoveryUrls") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_RegisteredServer, discoveryUrlsSize) - offsetof(UA_RegisteredServer, gatewayServerUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("semaphoreFilePath") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_RegisteredServer, semaphoreFilePath) - offsetof(UA_RegisteredServer, discoveryUrls) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("isOnline") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_RegisteredServer, isOnline) - offsetof(UA_RegisteredServer, semaphoreFilePath) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* RegisterServerRequest */ -static UA_DataTypeMember RegisterServerRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("server") /* .memberName */ - UA_TYPES_REGISTEREDSERVER, /* .memberTypeIndex */ - offsetof(UA_RegisterServerRequest, server) - offsetof(UA_RegisterServerRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* RegisterServerResponse */ -static UA_DataTypeMember RegisterServerResponse_members[1] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* DiscoveryConfiguration */ -#define DiscoveryConfiguration_members NULL - -/* MdnsDiscoveryConfiguration */ -static UA_DataTypeMember MdnsDiscoveryConfiguration_members[2] = { - { - UA_TYPENAME("mdnsServerName") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverCapabilities") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_MdnsDiscoveryConfiguration, serverCapabilitiesSize) - - offsetof(UA_MdnsDiscoveryConfiguration, mdnsServerName) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* RegisterServer2Request */ -static UA_DataTypeMember RegisterServer2Request_members[3] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("server") /* .memberName */ - UA_TYPES_REGISTEREDSERVER, /* .memberTypeIndex */ - offsetof(UA_RegisterServer2Request, server) - offsetof(UA_RegisterServer2Request, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("discoveryConfiguration") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - offsetof(UA_RegisterServer2Request, discoveryConfigurationSize) - offsetof(UA_RegisterServer2Request, server) - - sizeof(UA_RegisteredServer), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* RegisterServer2Response */ -static UA_DataTypeMember RegisterServer2Response_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("configurationResults") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_RegisterServer2Response, configurationResultsSize) - - offsetof(UA_RegisterServer2Response, responseHeader) - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_RegisterServer2Response, diagnosticInfosSize) - - offsetof(UA_RegisterServer2Response, configurationResults) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* SecurityTokenRequestType */ -static UA_DataTypeMember SecurityTokenRequestType_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ChannelSecurityToken */ -static UA_DataTypeMember ChannelSecurityToken_members[4] = { - { - UA_TYPENAME("channelId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("tokenId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ChannelSecurityToken, tokenId) - offsetof(UA_ChannelSecurityToken, channelId) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("createdAt") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - offsetof(UA_ChannelSecurityToken, createdAt) - offsetof(UA_ChannelSecurityToken, tokenId) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedLifetime") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ChannelSecurityToken, revisedLifetime) - offsetof(UA_ChannelSecurityToken, createdAt) - - sizeof(UA_DateTime), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* OpenSecureChannelRequest */ -static UA_DataTypeMember OpenSecureChannelRequest_members[6] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientProtocolVersion") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_OpenSecureChannelRequest, clientProtocolVersion) - - offsetof(UA_OpenSecureChannelRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestType") /* .memberName */ - UA_TYPES_SECURITYTOKENREQUESTTYPE, /* .memberTypeIndex */ - offsetof(UA_OpenSecureChannelRequest, requestType) - - offsetof(UA_OpenSecureChannelRequest, clientProtocolVersion) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("securityMode") /* .memberName */ - UA_TYPES_MESSAGESECURITYMODE, /* .memberTypeIndex */ - offsetof(UA_OpenSecureChannelRequest, securityMode) - offsetof(UA_OpenSecureChannelRequest, requestType) - - sizeof(UA_SecurityTokenRequestType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientNonce") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_OpenSecureChannelRequest, clientNonce) - offsetof(UA_OpenSecureChannelRequest, securityMode) - - sizeof(UA_MessageSecurityMode), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedLifetime") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_OpenSecureChannelRequest, requestedLifetime) - offsetof(UA_OpenSecureChannelRequest, clientNonce) - - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* OpenSecureChannelResponse */ -static UA_DataTypeMember OpenSecureChannelResponse_members[4] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverProtocolVersion") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_OpenSecureChannelResponse, serverProtocolVersion) - - offsetof(UA_OpenSecureChannelResponse, responseHeader) - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("securityToken") /* .memberName */ - UA_TYPES_CHANNELSECURITYTOKEN, /* .memberTypeIndex */ - offsetof(UA_OpenSecureChannelResponse, securityToken) - - offsetof(UA_OpenSecureChannelResponse, serverProtocolVersion) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverNonce") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_OpenSecureChannelResponse, serverNonce) - offsetof(UA_OpenSecureChannelResponse, securityToken) - - sizeof(UA_ChannelSecurityToken), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* CloseSecureChannelRequest */ -static UA_DataTypeMember CloseSecureChannelRequest_members[1] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* CloseSecureChannelResponse */ -static UA_DataTypeMember CloseSecureChannelResponse_members[1] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SignedSoftwareCertificate */ -static UA_DataTypeMember SignedSoftwareCertificate_members[2] = { - { - UA_TYPENAME("certificateData") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("signature") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_SignedSoftwareCertificate, signature) - offsetof(UA_SignedSoftwareCertificate, certificateData) - - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SignatureData */ -static UA_DataTypeMember SignatureData_members[2] = { - { - UA_TYPENAME("algorithm") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("signature") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_SignatureData, signature) - offsetof(UA_SignatureData, algorithm) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* CreateSessionRequest */ -static UA_DataTypeMember CreateSessionRequest_members[9] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientDescription") /* .memberName */ - UA_TYPES_APPLICATIONDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_CreateSessionRequest, clientDescription) - offsetof(UA_CreateSessionRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_CreateSessionRequest, serverUri) - offsetof(UA_CreateSessionRequest, clientDescription) - - sizeof(UA_ApplicationDescription), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("endpointUrl") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_CreateSessionRequest, endpointUrl) - offsetof(UA_CreateSessionRequest, serverUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("sessionName") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_CreateSessionRequest, sessionName) - offsetof(UA_CreateSessionRequest, endpointUrl) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientNonce") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_CreateSessionRequest, clientNonce) - offsetof(UA_CreateSessionRequest, sessionName) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientCertificate") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_CreateSessionRequest, clientCertificate) - offsetof(UA_CreateSessionRequest, clientNonce) - - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedSessionTimeout") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_CreateSessionRequest, requestedSessionTimeout) - - offsetof(UA_CreateSessionRequest, clientCertificate) - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxResponseMessageSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_CreateSessionRequest, maxResponseMessageSize) - - offsetof(UA_CreateSessionRequest, requestedSessionTimeout) - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* CreateSessionResponse */ -static UA_DataTypeMember CreateSessionResponse_members[10] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("sessionId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_CreateSessionResponse, sessionId) - offsetof(UA_CreateSessionResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("authenticationToken") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_CreateSessionResponse, authenticationToken) - offsetof(UA_CreateSessionResponse, sessionId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedSessionTimeout") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_CreateSessionResponse, revisedSessionTimeout) - - offsetof(UA_CreateSessionResponse, authenticationToken) - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverNonce") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_CreateSessionResponse, serverNonce) - offsetof(UA_CreateSessionResponse, revisedSessionTimeout) - - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverCertificate") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_CreateSessionResponse, serverCertificate) - offsetof(UA_CreateSessionResponse, serverNonce) - - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverEndpoints") /* .memberName */ - UA_TYPES_ENDPOINTDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_CreateSessionResponse, serverEndpointsSize) - - offsetof(UA_CreateSessionResponse, serverCertificate) - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("serverSoftwareCertificates") /* .memberName */ - UA_TYPES_SIGNEDSOFTWARECERTIFICATE, /* .memberTypeIndex */ - offsetof(UA_CreateSessionResponse, serverSoftwareCertificatesSize) - - offsetof(UA_CreateSessionResponse, serverEndpoints) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("serverSignature") /* .memberName */ - UA_TYPES_SIGNATUREDATA, /* .memberTypeIndex */ - offsetof(UA_CreateSessionResponse, serverSignature) - - offsetof(UA_CreateSessionResponse, serverSoftwareCertificates) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxRequestMessageSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_CreateSessionResponse, maxRequestMessageSize) - - offsetof(UA_CreateSessionResponse, serverSignature) - sizeof(UA_SignatureData), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* UserIdentityToken */ -static UA_DataTypeMember UserIdentityToken_members[1] = { - { - UA_TYPENAME("policyId") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* AnonymousIdentityToken */ -static UA_DataTypeMember AnonymousIdentityToken_members[1] = { - { - UA_TYPENAME("policyId") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* UserNameIdentityToken */ -static UA_DataTypeMember UserNameIdentityToken_members[4] = { - { - UA_TYPENAME("policyId") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userName") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_UserNameIdentityToken, userName) - offsetof(UA_UserNameIdentityToken, policyId) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("password") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_UserNameIdentityToken, password) - offsetof(UA_UserNameIdentityToken, userName) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("encryptionAlgorithm") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_UserNameIdentityToken, encryptionAlgorithm) - offsetof(UA_UserNameIdentityToken, password) - - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ActivateSessionRequest */ -static UA_DataTypeMember ActivateSessionRequest_members[6] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientSignature") /* .memberName */ - UA_TYPES_SIGNATUREDATA, /* .memberTypeIndex */ - offsetof(UA_ActivateSessionRequest, clientSignature) - offsetof(UA_ActivateSessionRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientSoftwareCertificates") /* .memberName */ - UA_TYPES_SIGNEDSOFTWARECERTIFICATE, /* .memberTypeIndex */ - offsetof(UA_ActivateSessionRequest, clientSoftwareCertificatesSize) - - offsetof(UA_ActivateSessionRequest, clientSignature) - sizeof(UA_SignatureData), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("localeIds") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_ActivateSessionRequest, localeIdsSize) - - offsetof(UA_ActivateSessionRequest, clientSoftwareCertificates) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("userIdentityToken") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - offsetof(UA_ActivateSessionRequest, userIdentityToken) - offsetof(UA_ActivateSessionRequest, localeIds) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userTokenSignature") /* .memberName */ - UA_TYPES_SIGNATUREDATA, /* .memberTypeIndex */ - offsetof(UA_ActivateSessionRequest, userTokenSignature) - - offsetof(UA_ActivateSessionRequest, userIdentityToken) - sizeof(UA_ExtensionObject), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ActivateSessionResponse */ -static UA_DataTypeMember ActivateSessionResponse_members[4] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverNonce") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_ActivateSessionResponse, serverNonce) - offsetof(UA_ActivateSessionResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_ActivateSessionResponse, resultsSize) - offsetof(UA_ActivateSessionResponse, serverNonce) - - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_ActivateSessionResponse, diagnosticInfosSize) - offsetof(UA_ActivateSessionResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* CloseSessionRequest */ -static UA_DataTypeMember CloseSessionRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("deleteSubscriptions") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_CloseSessionRequest, deleteSubscriptions) - offsetof(UA_CloseSessionRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* CloseSessionResponse */ -static UA_DataTypeMember CloseSessionResponse_members[1] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* NodeAttributesMask */ -static UA_DataTypeMember NodeAttributesMask_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* NodeAttributes */ -static UA_DataTypeMember NodeAttributes_members[5] = { - { - UA_TYPENAME("specifiedAttributes") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("displayName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_NodeAttributes, displayName) - offsetof(UA_NodeAttributes, specifiedAttributes) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("description") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_NodeAttributes, description) - offsetof(UA_NodeAttributes, displayName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("writeMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_NodeAttributes, writeMask) - offsetof(UA_NodeAttributes, description) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userWriteMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_NodeAttributes, userWriteMask) - offsetof(UA_NodeAttributes, writeMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ObjectAttributes */ -static UA_DataTypeMember ObjectAttributes_members[6] = { - { - UA_TYPENAME("specifiedAttributes") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("displayName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ObjectAttributes, displayName) - offsetof(UA_ObjectAttributes, specifiedAttributes) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("description") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ObjectAttributes, description) - offsetof(UA_ObjectAttributes, displayName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("writeMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ObjectAttributes, writeMask) - offsetof(UA_ObjectAttributes, description) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userWriteMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ObjectAttributes, userWriteMask) - offsetof(UA_ObjectAttributes, writeMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("eventNotifier") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_ObjectAttributes, eventNotifier) - offsetof(UA_ObjectAttributes, userWriteMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* VariableAttributes */ -static UA_DataTypeMember VariableAttributes_members[13] = { - { - UA_TYPENAME("specifiedAttributes") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("displayName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, displayName) - offsetof(UA_VariableAttributes, specifiedAttributes) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("description") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, description) - offsetof(UA_VariableAttributes, displayName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("writeMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, writeMask) - offsetof(UA_VariableAttributes, description) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userWriteMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, userWriteMask) - offsetof(UA_VariableAttributes, writeMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("value") /* .memberName */ - UA_TYPES_VARIANT, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, value) - offsetof(UA_VariableAttributes, userWriteMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("dataType") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, dataType) - offsetof(UA_VariableAttributes, value) - - sizeof(UA_Variant), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("valueRank") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, valueRank) - offsetof(UA_VariableAttributes, dataType) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("arrayDimensions") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, arrayDimensionsSize) - offsetof(UA_VariableAttributes, valueRank) - - sizeof(UA_Int32), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("accessLevel") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, accessLevel) - offsetof(UA_VariableAttributes, arrayDimensions) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userAccessLevel") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, userAccessLevel) - offsetof(UA_VariableAttributes, accessLevel) - - sizeof(UA_Byte), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("minimumSamplingInterval") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, minimumSamplingInterval) - offsetof(UA_VariableAttributes, userAccessLevel) - - sizeof(UA_Byte), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("historizing") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_VariableAttributes, historizing) - offsetof(UA_VariableAttributes, minimumSamplingInterval) - - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* MethodAttributes */ -static UA_DataTypeMember MethodAttributes_members[7] = { - { - UA_TYPENAME("specifiedAttributes") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("displayName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_MethodAttributes, displayName) - offsetof(UA_MethodAttributes, specifiedAttributes) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("description") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_MethodAttributes, description) - offsetof(UA_MethodAttributes, displayName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("writeMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_MethodAttributes, writeMask) - offsetof(UA_MethodAttributes, description) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userWriteMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_MethodAttributes, userWriteMask) - offsetof(UA_MethodAttributes, writeMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("executable") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_MethodAttributes, executable) - offsetof(UA_MethodAttributes, userWriteMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userExecutable") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_MethodAttributes, userExecutable) - offsetof(UA_MethodAttributes, executable) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ObjectTypeAttributes */ -static UA_DataTypeMember ObjectTypeAttributes_members[6] = { - { - UA_TYPENAME("specifiedAttributes") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("displayName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ObjectTypeAttributes, displayName) - offsetof(UA_ObjectTypeAttributes, specifiedAttributes) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("description") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ObjectTypeAttributes, description) - offsetof(UA_ObjectTypeAttributes, displayName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("writeMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ObjectTypeAttributes, writeMask) - offsetof(UA_ObjectTypeAttributes, description) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userWriteMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ObjectTypeAttributes, userWriteMask) - offsetof(UA_ObjectTypeAttributes, writeMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("isAbstract") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_ObjectTypeAttributes, isAbstract) - offsetof(UA_ObjectTypeAttributes, userWriteMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* VariableTypeAttributes */ -static UA_DataTypeMember VariableTypeAttributes_members[10] = { - { - UA_TYPENAME("specifiedAttributes") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("displayName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_VariableTypeAttributes, displayName) - offsetof(UA_VariableTypeAttributes, specifiedAttributes) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("description") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_VariableTypeAttributes, description) - offsetof(UA_VariableTypeAttributes, displayName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("writeMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_VariableTypeAttributes, writeMask) - offsetof(UA_VariableTypeAttributes, description) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userWriteMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_VariableTypeAttributes, userWriteMask) - offsetof(UA_VariableTypeAttributes, writeMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("value") /* .memberName */ - UA_TYPES_VARIANT, /* .memberTypeIndex */ - offsetof(UA_VariableTypeAttributes, value) - offsetof(UA_VariableTypeAttributes, userWriteMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("dataType") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_VariableTypeAttributes, dataType) - offsetof(UA_VariableTypeAttributes, value) - - sizeof(UA_Variant), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("valueRank") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - offsetof(UA_VariableTypeAttributes, valueRank) - offsetof(UA_VariableTypeAttributes, dataType) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("arrayDimensions") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_VariableTypeAttributes, arrayDimensionsSize) - offsetof(UA_VariableTypeAttributes, valueRank) - - sizeof(UA_Int32), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("isAbstract") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_VariableTypeAttributes, isAbstract) - offsetof(UA_VariableTypeAttributes, arrayDimensions) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ReferenceTypeAttributes */ -static UA_DataTypeMember ReferenceTypeAttributes_members[8] = { - { - UA_TYPENAME("specifiedAttributes") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("displayName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ReferenceTypeAttributes, displayName) - offsetof(UA_ReferenceTypeAttributes, specifiedAttributes) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("description") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ReferenceTypeAttributes, description) - offsetof(UA_ReferenceTypeAttributes, displayName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("writeMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ReferenceTypeAttributes, writeMask) - offsetof(UA_ReferenceTypeAttributes, description) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userWriteMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ReferenceTypeAttributes, userWriteMask) - offsetof(UA_ReferenceTypeAttributes, writeMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("isAbstract") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_ReferenceTypeAttributes, isAbstract) - offsetof(UA_ReferenceTypeAttributes, userWriteMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("symmetric") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_ReferenceTypeAttributes, symmetric) - offsetof(UA_ReferenceTypeAttributes, isAbstract) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("inverseName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ReferenceTypeAttributes, inverseName) - offsetof(UA_ReferenceTypeAttributes, symmetric) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* DataTypeAttributes */ -static UA_DataTypeMember DataTypeAttributes_members[6] = { - { - UA_TYPENAME("specifiedAttributes") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("displayName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_DataTypeAttributes, displayName) - offsetof(UA_DataTypeAttributes, specifiedAttributes) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("description") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_DataTypeAttributes, description) - offsetof(UA_DataTypeAttributes, displayName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("writeMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_DataTypeAttributes, writeMask) - offsetof(UA_DataTypeAttributes, description) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userWriteMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_DataTypeAttributes, userWriteMask) - offsetof(UA_DataTypeAttributes, writeMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("isAbstract") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_DataTypeAttributes, isAbstract) - offsetof(UA_DataTypeAttributes, userWriteMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ViewAttributes */ -static UA_DataTypeMember ViewAttributes_members[7] = { - { - UA_TYPENAME("specifiedAttributes") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("displayName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ViewAttributes, displayName) - offsetof(UA_ViewAttributes, specifiedAttributes) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("description") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ViewAttributes, description) - offsetof(UA_ViewAttributes, displayName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("writeMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ViewAttributes, writeMask) - offsetof(UA_ViewAttributes, description) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("userWriteMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ViewAttributes, userWriteMask) - offsetof(UA_ViewAttributes, writeMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("containsNoLoops") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_ViewAttributes, containsNoLoops) - offsetof(UA_ViewAttributes, userWriteMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("eventNotifier") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_ViewAttributes, eventNotifier) - offsetof(UA_ViewAttributes, containsNoLoops) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* AddNodesItem */ -static UA_DataTypeMember AddNodesItem_members[7] = { - { - UA_TYPENAME("parentNodeId") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("referenceTypeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_AddNodesItem, referenceTypeId) - offsetof(UA_AddNodesItem, parentNodeId) - - sizeof(UA_ExpandedNodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedNewNodeId") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - offsetof(UA_AddNodesItem, requestedNewNodeId) - offsetof(UA_AddNodesItem, referenceTypeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("browseName") /* .memberName */ - UA_TYPES_QUALIFIEDNAME, /* .memberTypeIndex */ - offsetof(UA_AddNodesItem, browseName) - offsetof(UA_AddNodesItem, requestedNewNodeId) - - sizeof(UA_ExpandedNodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodeClass") /* .memberName */ - UA_TYPES_NODECLASS, /* .memberTypeIndex */ - offsetof(UA_AddNodesItem, nodeClass) - offsetof(UA_AddNodesItem, browseName) - - sizeof(UA_QualifiedName), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodeAttributes") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - offsetof(UA_AddNodesItem, nodeAttributes) - offsetof(UA_AddNodesItem, nodeClass) - - sizeof(UA_NodeClass), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("typeDefinition") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - offsetof(UA_AddNodesItem, typeDefinition) - offsetof(UA_AddNodesItem, nodeAttributes) - - sizeof(UA_ExtensionObject), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* AddNodesResult */ -static UA_DataTypeMember AddNodesResult_members[2] = { - { - UA_TYPENAME("statusCode") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("addedNodeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_AddNodesResult, addedNodeId) - offsetof(UA_AddNodesResult, statusCode) - - sizeof(UA_StatusCode), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* AddNodesRequest */ -static UA_DataTypeMember AddNodesRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodesToAdd") /* .memberName */ - UA_TYPES_ADDNODESITEM, /* .memberTypeIndex */ - offsetof(UA_AddNodesRequest, nodesToAddSize) - offsetof(UA_AddNodesRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* AddNodesResponse */ -static UA_DataTypeMember AddNodesResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_ADDNODESRESULT, /* .memberTypeIndex */ - offsetof(UA_AddNodesResponse, resultsSize) - offsetof(UA_AddNodesResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_AddNodesResponse, diagnosticInfosSize) - offsetof(UA_AddNodesResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* AddReferencesItem */ -static UA_DataTypeMember AddReferencesItem_members[6] = { - { - UA_TYPENAME("sourceNodeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("referenceTypeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_AddReferencesItem, referenceTypeId) - offsetof(UA_AddReferencesItem, sourceNodeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("isForward") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_AddReferencesItem, isForward) - offsetof(UA_AddReferencesItem, referenceTypeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("targetServerUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_AddReferencesItem, targetServerUri) - offsetof(UA_AddReferencesItem, isForward) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("targetNodeId") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - offsetof(UA_AddReferencesItem, targetNodeId) - offsetof(UA_AddReferencesItem, targetServerUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("targetNodeClass") /* .memberName */ - UA_TYPES_NODECLASS, /* .memberTypeIndex */ - offsetof(UA_AddReferencesItem, targetNodeClass) - offsetof(UA_AddReferencesItem, targetNodeId) - - sizeof(UA_ExpandedNodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* AddReferencesRequest */ -static UA_DataTypeMember AddReferencesRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("referencesToAdd") /* .memberName */ - UA_TYPES_ADDREFERENCESITEM, /* .memberTypeIndex */ - offsetof(UA_AddReferencesRequest, referencesToAddSize) - offsetof(UA_AddReferencesRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* AddReferencesResponse */ -static UA_DataTypeMember AddReferencesResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_AddReferencesResponse, resultsSize) - offsetof(UA_AddReferencesResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_AddReferencesResponse, diagnosticInfosSize) - offsetof(UA_AddReferencesResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* DeleteNodesItem */ -static UA_DataTypeMember DeleteNodesItem_members[2] = { - { - UA_TYPENAME("nodeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("deleteTargetReferences") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_DeleteNodesItem, deleteTargetReferences) - offsetof(UA_DeleteNodesItem, nodeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* DeleteNodesRequest */ -static UA_DataTypeMember DeleteNodesRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodesToDelete") /* .memberName */ - UA_TYPES_DELETENODESITEM, /* .memberTypeIndex */ - offsetof(UA_DeleteNodesRequest, nodesToDeleteSize) - offsetof(UA_DeleteNodesRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* DeleteNodesResponse */ -static UA_DataTypeMember DeleteNodesResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_DeleteNodesResponse, resultsSize) - offsetof(UA_DeleteNodesResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_DeleteNodesResponse, diagnosticInfosSize) - offsetof(UA_DeleteNodesResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* DeleteReferencesItem */ -static UA_DataTypeMember DeleteReferencesItem_members[5] = { - { - UA_TYPENAME("sourceNodeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("referenceTypeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_DeleteReferencesItem, referenceTypeId) - offsetof(UA_DeleteReferencesItem, sourceNodeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("isForward") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_DeleteReferencesItem, isForward) - offsetof(UA_DeleteReferencesItem, referenceTypeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("targetNodeId") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - offsetof(UA_DeleteReferencesItem, targetNodeId) - offsetof(UA_DeleteReferencesItem, isForward) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("deleteBidirectional") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_DeleteReferencesItem, deleteBidirectional) - offsetof(UA_DeleteReferencesItem, targetNodeId) - - sizeof(UA_ExpandedNodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* DeleteReferencesRequest */ -static UA_DataTypeMember DeleteReferencesRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("referencesToDelete") /* .memberName */ - UA_TYPES_DELETEREFERENCESITEM, /* .memberTypeIndex */ - offsetof(UA_DeleteReferencesRequest, referencesToDeleteSize) - - offsetof(UA_DeleteReferencesRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* DeleteReferencesResponse */ -static UA_DataTypeMember DeleteReferencesResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_DeleteReferencesResponse, resultsSize) - offsetof(UA_DeleteReferencesResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_DeleteReferencesResponse, diagnosticInfosSize) - offsetof(UA_DeleteReferencesResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* BrowseDirection */ -static UA_DataTypeMember BrowseDirection_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ViewDescription */ -static UA_DataTypeMember ViewDescription_members[3] = { - { - UA_TYPENAME("viewId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("timestamp") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - offsetof(UA_ViewDescription, timestamp) - offsetof(UA_ViewDescription, viewId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("viewVersion") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ViewDescription, viewVersion) - offsetof(UA_ViewDescription, timestamp) - - sizeof(UA_DateTime), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* BrowseDescription */ -static UA_DataTypeMember BrowseDescription_members[6] = { - { - UA_TYPENAME("nodeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("browseDirection") /* .memberName */ - UA_TYPES_BROWSEDIRECTION, /* .memberTypeIndex */ - offsetof(UA_BrowseDescription, browseDirection) - offsetof(UA_BrowseDescription, nodeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("referenceTypeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_BrowseDescription, referenceTypeId) - offsetof(UA_BrowseDescription, browseDirection) - - sizeof(UA_BrowseDirection), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("includeSubtypes") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_BrowseDescription, includeSubtypes) - offsetof(UA_BrowseDescription, referenceTypeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodeClassMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_BrowseDescription, nodeClassMask) - offsetof(UA_BrowseDescription, includeSubtypes) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("resultMask") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_BrowseDescription, resultMask) - offsetof(UA_BrowseDescription, nodeClassMask) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* BrowseResultMask */ -static UA_DataTypeMember BrowseResultMask_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ReferenceDescription */ -static UA_DataTypeMember ReferenceDescription_members[7] = { - { - UA_TYPENAME("referenceTypeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("isForward") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_ReferenceDescription, isForward) - offsetof(UA_ReferenceDescription, referenceTypeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodeId") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - offsetof(UA_ReferenceDescription, nodeId) - offsetof(UA_ReferenceDescription, isForward) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("browseName") /* .memberName */ - UA_TYPES_QUALIFIEDNAME, /* .memberTypeIndex */ - offsetof(UA_ReferenceDescription, browseName) - offsetof(UA_ReferenceDescription, nodeId) - - sizeof(UA_ExpandedNodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("displayName") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ReferenceDescription, displayName) - offsetof(UA_ReferenceDescription, browseName) - - sizeof(UA_QualifiedName), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodeClass") /* .memberName */ - UA_TYPES_NODECLASS, /* .memberTypeIndex */ - offsetof(UA_ReferenceDescription, nodeClass) - offsetof(UA_ReferenceDescription, displayName) - - sizeof(UA_LocalizedText), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("typeDefinition") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - offsetof(UA_ReferenceDescription, typeDefinition) - offsetof(UA_ReferenceDescription, nodeClass) - - sizeof(UA_NodeClass), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* BrowseResult */ -static UA_DataTypeMember BrowseResult_members[3] = { - { - UA_TYPENAME("statusCode") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("continuationPoint") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_BrowseResult, continuationPoint) - offsetof(UA_BrowseResult, statusCode) - - sizeof(UA_StatusCode), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("references") /* .memberName */ - UA_TYPES_REFERENCEDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_BrowseResult, referencesSize) - offsetof(UA_BrowseResult, continuationPoint) - - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* BrowseRequest */ -static UA_DataTypeMember BrowseRequest_members[4] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("view") /* .memberName */ - UA_TYPES_VIEWDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_BrowseRequest, view) - offsetof(UA_BrowseRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedMaxReferencesPerNode") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_BrowseRequest, requestedMaxReferencesPerNode) - offsetof(UA_BrowseRequest, view) - - sizeof(UA_ViewDescription), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodesToBrowse") /* .memberName */ - UA_TYPES_BROWSEDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_BrowseRequest, nodesToBrowseSize) - offsetof(UA_BrowseRequest, requestedMaxReferencesPerNode) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* BrowseResponse */ -static UA_DataTypeMember BrowseResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_BROWSERESULT, /* .memberTypeIndex */ - offsetof(UA_BrowseResponse, resultsSize) - offsetof(UA_BrowseResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_BrowseResponse, diagnosticInfosSize) - offsetof(UA_BrowseResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* BrowseNextRequest */ -static UA_DataTypeMember BrowseNextRequest_members[3] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("releaseContinuationPoints") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_BrowseNextRequest, releaseContinuationPoints) - offsetof(UA_BrowseNextRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("continuationPoints") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_BrowseNextRequest, continuationPointsSize) - - offsetof(UA_BrowseNextRequest, releaseContinuationPoints) - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* BrowseNextResponse */ -static UA_DataTypeMember BrowseNextResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_BROWSERESULT, /* .memberTypeIndex */ - offsetof(UA_BrowseNextResponse, resultsSize) - offsetof(UA_BrowseNextResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_BrowseNextResponse, diagnosticInfosSize) - offsetof(UA_BrowseNextResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* RelativePathElement */ -static UA_DataTypeMember RelativePathElement_members[4] = { - { - UA_TYPENAME("referenceTypeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("isInverse") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_RelativePathElement, isInverse) - offsetof(UA_RelativePathElement, referenceTypeId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("includeSubtypes") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_RelativePathElement, includeSubtypes) - offsetof(UA_RelativePathElement, isInverse) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("targetName") /* .memberName */ - UA_TYPES_QUALIFIEDNAME, /* .memberTypeIndex */ - offsetof(UA_RelativePathElement, targetName) - offsetof(UA_RelativePathElement, includeSubtypes) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* RelativePath */ -static UA_DataTypeMember RelativePath_members[1] = { - { - UA_TYPENAME("elements") /* .memberName */ - UA_TYPES_RELATIVEPATHELEMENT, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* BrowsePath */ -static UA_DataTypeMember BrowsePath_members[2] = { - { - UA_TYPENAME("startingNode") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("relativePath") /* .memberName */ - UA_TYPES_RELATIVEPATH, /* .memberTypeIndex */ - offsetof(UA_BrowsePath, relativePath) - offsetof(UA_BrowsePath, startingNode) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* BrowsePathTarget */ -static UA_DataTypeMember BrowsePathTarget_members[2] = { - { - UA_TYPENAME("targetId") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("remainingPathIndex") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_BrowsePathTarget, remainingPathIndex) - offsetof(UA_BrowsePathTarget, targetId) - - sizeof(UA_ExpandedNodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* BrowsePathResult */ -static UA_DataTypeMember BrowsePathResult_members[2] = { - { - UA_TYPENAME("statusCode") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("targets") /* .memberName */ - UA_TYPES_BROWSEPATHTARGET, /* .memberTypeIndex */ - offsetof(UA_BrowsePathResult, targetsSize) - offsetof(UA_BrowsePathResult, statusCode) - - sizeof(UA_StatusCode), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* TranslateBrowsePathsToNodeIdsRequest */ -static UA_DataTypeMember TranslateBrowsePathsToNodeIdsRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("browsePaths") /* .memberName */ - UA_TYPES_BROWSEPATH, /* .memberTypeIndex */ - offsetof(UA_TranslateBrowsePathsToNodeIdsRequest, browsePathsSize) - - offsetof(UA_TranslateBrowsePathsToNodeIdsRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* TranslateBrowsePathsToNodeIdsResponse */ -static UA_DataTypeMember TranslateBrowsePathsToNodeIdsResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_BROWSEPATHRESULT, /* .memberTypeIndex */ - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, resultsSize) - - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, diagnosticInfosSize) - - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, results) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* RegisterNodesRequest */ -static UA_DataTypeMember RegisterNodesRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodesToRegister") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_RegisterNodesRequest, nodesToRegisterSize) - offsetof(UA_RegisterNodesRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* RegisterNodesResponse */ -static UA_DataTypeMember RegisterNodesResponse_members[2] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("registeredNodeIds") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_RegisterNodesResponse, registeredNodeIdsSize) - offsetof(UA_RegisterNodesResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* UnregisterNodesRequest */ -static UA_DataTypeMember UnregisterNodesRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodesToUnregister") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_UnregisterNodesRequest, nodesToUnregisterSize) - - offsetof(UA_UnregisterNodesRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* UnregisterNodesResponse */ -static UA_DataTypeMember UnregisterNodesResponse_members[1] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* QueryDataDescription */ -static UA_DataTypeMember QueryDataDescription_members[3] = { - { - UA_TYPENAME("relativePath") /* .memberName */ - UA_TYPES_RELATIVEPATH, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("attributeId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_QueryDataDescription, attributeId) - offsetof(UA_QueryDataDescription, relativePath) - - sizeof(UA_RelativePath), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("indexRange") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_QueryDataDescription, indexRange) - offsetof(UA_QueryDataDescription, attributeId) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* NodeTypeDescription */ -static UA_DataTypeMember NodeTypeDescription_members[3] = { - { - UA_TYPENAME("typeDefinitionNode") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("includeSubTypes") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_NodeTypeDescription, includeSubTypes) - offsetof(UA_NodeTypeDescription, typeDefinitionNode) - - sizeof(UA_ExpandedNodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("dataToReturn") /* .memberName */ - UA_TYPES_QUERYDATADESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_NodeTypeDescription, dataToReturnSize) - offsetof(UA_NodeTypeDescription, includeSubTypes) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* FilterOperator */ -static UA_DataTypeMember FilterOperator_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* QueryDataSet */ -static UA_DataTypeMember QueryDataSet_members[3] = { - { - UA_TYPENAME("nodeId") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("typeDefinitionNode") /* .memberName */ - UA_TYPES_EXPANDEDNODEID, /* .memberTypeIndex */ - offsetof(UA_QueryDataSet, typeDefinitionNode) - offsetof(UA_QueryDataSet, nodeId) - - sizeof(UA_ExpandedNodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("values") /* .memberName */ - UA_TYPES_VARIANT, /* .memberTypeIndex */ - offsetof(UA_QueryDataSet, valuesSize) - offsetof(UA_QueryDataSet, typeDefinitionNode) - - sizeof(UA_ExpandedNodeId), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* ContentFilterElement */ -static UA_DataTypeMember ContentFilterElement_members[2] = { - { - UA_TYPENAME("filterOperator") /* .memberName */ - UA_TYPES_FILTEROPERATOR, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("filterOperands") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - offsetof(UA_ContentFilterElement, filterOperandsSize) - offsetof(UA_ContentFilterElement, filterOperator) - - sizeof(UA_FilterOperator), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* ContentFilter */ -static UA_DataTypeMember ContentFilter_members[1] = { - { - UA_TYPENAME("elements") /* .memberName */ - UA_TYPES_CONTENTFILTERELEMENT, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* FilterOperand */ -#define FilterOperand_members NULL - -/* SimpleAttributeOperand */ -static UA_DataTypeMember SimpleAttributeOperand_members[4] = { - { - UA_TYPENAME("typeDefinitionId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("browsePath") /* .memberName */ - UA_TYPES_QUALIFIEDNAME, /* .memberTypeIndex */ - offsetof(UA_SimpleAttributeOperand, browsePathSize) - offsetof(UA_SimpleAttributeOperand, typeDefinitionId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("attributeId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SimpleAttributeOperand, attributeId) - offsetof(UA_SimpleAttributeOperand, browsePath) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("indexRange") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SimpleAttributeOperand, indexRange) - offsetof(UA_SimpleAttributeOperand, attributeId) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ContentFilterElementResult */ -static UA_DataTypeMember ContentFilterElementResult_members[3] = { - { - UA_TYPENAME("statusCode") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("operandStatusCodes") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_ContentFilterElementResult, operandStatusCodesSize) - - offsetof(UA_ContentFilterElementResult, statusCode) - sizeof(UA_StatusCode), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("operandDiagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_ContentFilterElementResult, operandDiagnosticInfosSize) - - offsetof(UA_ContentFilterElementResult, operandStatusCodes) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* ContentFilterResult */ -static UA_DataTypeMember ContentFilterResult_members[2] = { - { - UA_TYPENAME("elementResults") /* .memberName */ - UA_TYPES_CONTENTFILTERELEMENTRESULT, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("elementDiagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_ContentFilterResult, elementDiagnosticInfosSize) - - offsetof(UA_ContentFilterResult, elementResults) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* ParsingResult */ -static UA_DataTypeMember ParsingResult_members[3] = { - { - UA_TYPENAME("statusCode") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("dataStatusCodes") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_ParsingResult, dataStatusCodesSize) - offsetof(UA_ParsingResult, statusCode) - - sizeof(UA_StatusCode), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("dataDiagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_ParsingResult, dataDiagnosticInfosSize) - offsetof(UA_ParsingResult, dataStatusCodes) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* QueryFirstRequest */ -static UA_DataTypeMember QueryFirstRequest_members[6] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("view") /* .memberName */ - UA_TYPES_VIEWDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_QueryFirstRequest, view) - offsetof(UA_QueryFirstRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodeTypes") /* .memberName */ - UA_TYPES_NODETYPEDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_QueryFirstRequest, nodeTypesSize) - offsetof(UA_QueryFirstRequest, view) - - sizeof(UA_ViewDescription), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("filter") /* .memberName */ - UA_TYPES_CONTENTFILTER, /* .memberTypeIndex */ - offsetof(UA_QueryFirstRequest, filter) - offsetof(UA_QueryFirstRequest, nodeTypes) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxDataSetsToReturn") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_QueryFirstRequest, maxDataSetsToReturn) - offsetof(UA_QueryFirstRequest, filter) - - sizeof(UA_ContentFilter), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxReferencesToReturn") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_QueryFirstRequest, maxReferencesToReturn) - offsetof(UA_QueryFirstRequest, maxDataSetsToReturn) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* QueryFirstResponse */ -static UA_DataTypeMember QueryFirstResponse_members[6] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("queryDataSets") /* .memberName */ - UA_TYPES_QUERYDATASET, /* .memberTypeIndex */ - offsetof(UA_QueryFirstResponse, queryDataSetsSize) - offsetof(UA_QueryFirstResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("continuationPoint") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_QueryFirstResponse, continuationPoint) - offsetof(UA_QueryFirstResponse, queryDataSets) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("parsingResults") /* .memberName */ - UA_TYPES_PARSINGRESULT, /* .memberTypeIndex */ - offsetof(UA_QueryFirstResponse, parsingResultsSize) - offsetof(UA_QueryFirstResponse, continuationPoint) - - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_QueryFirstResponse, diagnosticInfosSize) - offsetof(UA_QueryFirstResponse, parsingResults) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("filterResult") /* .memberName */ - UA_TYPES_CONTENTFILTERRESULT, /* .memberTypeIndex */ - offsetof(UA_QueryFirstResponse, filterResult) - offsetof(UA_QueryFirstResponse, diagnosticInfos) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* QueryNextRequest */ -static UA_DataTypeMember QueryNextRequest_members[3] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("releaseContinuationPoint") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_QueryNextRequest, releaseContinuationPoint) - offsetof(UA_QueryNextRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("continuationPoint") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_QueryNextRequest, continuationPoint) - offsetof(UA_QueryNextRequest, releaseContinuationPoint) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* QueryNextResponse */ -static UA_DataTypeMember QueryNextResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("queryDataSets") /* .memberName */ - UA_TYPES_QUERYDATASET, /* .memberTypeIndex */ - offsetof(UA_QueryNextResponse, queryDataSetsSize) - offsetof(UA_QueryNextResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("revisedContinuationPoint") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_QueryNextResponse, revisedContinuationPoint) - offsetof(UA_QueryNextResponse, queryDataSets) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* TimestampsToReturn */ -static UA_DataTypeMember TimestampsToReturn_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ReadValueId */ -static UA_DataTypeMember ReadValueId_members[4] = { - { - UA_TYPENAME("nodeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("attributeId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ReadValueId, attributeId) - offsetof(UA_ReadValueId, nodeId) - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("indexRange") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_ReadValueId, indexRange) - offsetof(UA_ReadValueId, attributeId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("dataEncoding") /* .memberName */ - UA_TYPES_QUALIFIEDNAME, /* .memberTypeIndex */ - offsetof(UA_ReadValueId, dataEncoding) - offsetof(UA_ReadValueId, indexRange) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ReadRequest */ -static UA_DataTypeMember ReadRequest_members[4] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxAge") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_ReadRequest, maxAge) - offsetof(UA_ReadRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("timestampsToReturn") /* .memberName */ - UA_TYPES_TIMESTAMPSTORETURN, /* .memberTypeIndex */ - offsetof(UA_ReadRequest, timestampsToReturn) - offsetof(UA_ReadRequest, maxAge) - - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodesToRead") /* .memberName */ - UA_TYPES_READVALUEID, /* .memberTypeIndex */ - offsetof(UA_ReadRequest, nodesToReadSize) - offsetof(UA_ReadRequest, timestampsToReturn) - - sizeof(UA_TimestampsToReturn), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* ReadResponse */ -static UA_DataTypeMember ReadResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_DATAVALUE, /* .memberTypeIndex */ - offsetof(UA_ReadResponse, resultsSize) - offsetof(UA_ReadResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_ReadResponse, diagnosticInfosSize) - offsetof(UA_ReadResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* WriteValue */ -static UA_DataTypeMember WriteValue_members[4] = { - { - UA_TYPENAME("nodeId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("attributeId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_WriteValue, attributeId) - offsetof(UA_WriteValue, nodeId) - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("indexRange") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_WriteValue, indexRange) - offsetof(UA_WriteValue, attributeId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("value") /* .memberName */ - UA_TYPES_DATAVALUE, /* .memberTypeIndex */ - offsetof(UA_WriteValue, value) - offsetof(UA_WriteValue, indexRange) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* WriteRequest */ -static UA_DataTypeMember WriteRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nodesToWrite") /* .memberName */ - UA_TYPES_WRITEVALUE, /* .memberTypeIndex */ - offsetof(UA_WriteRequest, nodesToWriteSize) - offsetof(UA_WriteRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* WriteResponse */ -static UA_DataTypeMember WriteResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_WriteResponse, resultsSize) - offsetof(UA_WriteResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_WriteResponse, diagnosticInfosSize) - offsetof(UA_WriteResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* CallMethodRequest */ -static UA_DataTypeMember CallMethodRequest_members[3] = { - { - UA_TYPENAME("objectId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("methodId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_CallMethodRequest, methodId) - offsetof(UA_CallMethodRequest, objectId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("inputArguments") /* .memberName */ - UA_TYPES_VARIANT, /* .memberTypeIndex */ - offsetof(UA_CallMethodRequest, inputArgumentsSize) - offsetof(UA_CallMethodRequest, methodId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* CallMethodResult */ -static UA_DataTypeMember CallMethodResult_members[4] = { - { - UA_TYPENAME("statusCode") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("inputArgumentResults") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_CallMethodResult, inputArgumentResultsSize) - offsetof(UA_CallMethodResult, statusCode) - - sizeof(UA_StatusCode), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("inputArgumentDiagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_CallMethodResult, inputArgumentDiagnosticInfosSize) - - offsetof(UA_CallMethodResult, inputArgumentResults) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("outputArguments") /* .memberName */ - UA_TYPES_VARIANT, /* .memberTypeIndex */ - offsetof(UA_CallMethodResult, outputArgumentsSize) - - offsetof(UA_CallMethodResult, inputArgumentDiagnosticInfos) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* CallRequest */ -static UA_DataTypeMember CallRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("methodsToCall") /* .memberName */ - UA_TYPES_CALLMETHODREQUEST, /* .memberTypeIndex */ - offsetof(UA_CallRequest, methodsToCallSize) - offsetof(UA_CallRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* CallResponse */ -static UA_DataTypeMember CallResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_CALLMETHODRESULT, /* .memberTypeIndex */ - offsetof(UA_CallResponse, resultsSize) - offsetof(UA_CallResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_CallResponse, diagnosticInfosSize) - offsetof(UA_CallResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* MonitoringMode */ -static UA_DataTypeMember MonitoringMode_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* DataChangeTrigger */ -static UA_DataTypeMember DataChangeTrigger_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* DeadbandType */ -static UA_DataTypeMember DeadbandType_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* MonitoringFilter */ -#define MonitoringFilter_members NULL - -/* DataChangeFilter */ -static UA_DataTypeMember DataChangeFilter_members[3] = { - { - UA_TYPENAME("trigger") /* .memberName */ - UA_TYPES_DATACHANGETRIGGER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("deadbandType") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_DataChangeFilter, deadbandType) - offsetof(UA_DataChangeFilter, trigger) - - sizeof(UA_DataChangeTrigger), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("deadbandValue") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_DataChangeFilter, deadbandValue) - offsetof(UA_DataChangeFilter, deadbandType) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* EventFilter */ -static UA_DataTypeMember EventFilter_members[2] = { - { - UA_TYPENAME("selectClauses") /* .memberName */ - UA_TYPES_SIMPLEATTRIBUTEOPERAND, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("whereClause") /* .memberName */ - UA_TYPES_CONTENTFILTER, /* .memberTypeIndex */ - offsetof(UA_EventFilter, whereClause) - offsetof(UA_EventFilter, selectClauses) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* MonitoringParameters */ -static UA_DataTypeMember MonitoringParameters_members[5] = { - { - UA_TYPENAME("clientHandle") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("samplingInterval") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_MonitoringParameters, samplingInterval) - offsetof(UA_MonitoringParameters, clientHandle) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("filter") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - offsetof(UA_MonitoringParameters, filter) - offsetof(UA_MonitoringParameters, samplingInterval) - - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("queueSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_MonitoringParameters, queueSize) - offsetof(UA_MonitoringParameters, filter) - - sizeof(UA_ExtensionObject), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("discardOldest") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_MonitoringParameters, discardOldest) - offsetof(UA_MonitoringParameters, queueSize) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* MonitoredItemCreateRequest */ -static UA_DataTypeMember MonitoredItemCreateRequest_members[3] = { - { - UA_TYPENAME("itemToMonitor") /* .memberName */ - UA_TYPES_READVALUEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("monitoringMode") /* .memberName */ - UA_TYPES_MONITORINGMODE, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemCreateRequest, monitoringMode) - - offsetof(UA_MonitoredItemCreateRequest, itemToMonitor) - sizeof(UA_ReadValueId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedParameters") /* .memberName */ - UA_TYPES_MONITORINGPARAMETERS, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemCreateRequest, requestedParameters) - - offsetof(UA_MonitoredItemCreateRequest, monitoringMode) - sizeof(UA_MonitoringMode), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* MonitoredItemCreateResult */ -static UA_DataTypeMember MonitoredItemCreateResult_members[5] = { - { - UA_TYPENAME("statusCode") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("monitoredItemId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemCreateResult, monitoredItemId) - offsetof(UA_MonitoredItemCreateResult, statusCode) - - sizeof(UA_StatusCode), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedSamplingInterval") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemCreateResult, revisedSamplingInterval) - - offsetof(UA_MonitoredItemCreateResult, monitoredItemId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedQueueSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemCreateResult, revisedQueueSize) - - offsetof(UA_MonitoredItemCreateResult, revisedSamplingInterval) - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("filterResult") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemCreateResult, filterResult) - - offsetof(UA_MonitoredItemCreateResult, revisedQueueSize) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* CreateMonitoredItemsRequest */ -static UA_DataTypeMember CreateMonitoredItemsRequest_members[4] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_CreateMonitoredItemsRequest, subscriptionId) - - offsetof(UA_CreateMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("timestampsToReturn") /* .memberName */ - UA_TYPES_TIMESTAMPSTORETURN, /* .memberTypeIndex */ - offsetof(UA_CreateMonitoredItemsRequest, timestampsToReturn) - - offsetof(UA_CreateMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("itemsToCreate") /* .memberName */ - UA_TYPES_MONITOREDITEMCREATEREQUEST, /* .memberTypeIndex */ - offsetof(UA_CreateMonitoredItemsRequest, itemsToCreateSize) - - offsetof(UA_CreateMonitoredItemsRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* CreateMonitoredItemsResponse */ -static UA_DataTypeMember CreateMonitoredItemsResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_MONITOREDITEMCREATERESULT, /* .memberTypeIndex */ - offsetof(UA_CreateMonitoredItemsResponse, resultsSize) - - offsetof(UA_CreateMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_CreateMonitoredItemsResponse, diagnosticInfosSize) - - offsetof(UA_CreateMonitoredItemsResponse, results) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* MonitoredItemModifyRequest */ -static UA_DataTypeMember MonitoredItemModifyRequest_members[2] = { - { - UA_TYPENAME("monitoredItemId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedParameters") /* .memberName */ - UA_TYPES_MONITORINGPARAMETERS, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemModifyRequest, requestedParameters) - - offsetof(UA_MonitoredItemModifyRequest, monitoredItemId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* MonitoredItemModifyResult */ -static UA_DataTypeMember MonitoredItemModifyResult_members[4] = { - { - UA_TYPENAME("statusCode") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedSamplingInterval") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemModifyResult, revisedSamplingInterval) - - offsetof(UA_MonitoredItemModifyResult, statusCode) - sizeof(UA_StatusCode), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedQueueSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemModifyResult, revisedQueueSize) - - offsetof(UA_MonitoredItemModifyResult, revisedSamplingInterval) - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("filterResult") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemModifyResult, filterResult) - - offsetof(UA_MonitoredItemModifyResult, revisedQueueSize) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ModifyMonitoredItemsRequest */ -static UA_DataTypeMember ModifyMonitoredItemsRequest_members[4] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ModifyMonitoredItemsRequest, subscriptionId) - - offsetof(UA_ModifyMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("timestampsToReturn") /* .memberName */ - UA_TYPES_TIMESTAMPSTORETURN, /* .memberTypeIndex */ - offsetof(UA_ModifyMonitoredItemsRequest, timestampsToReturn) - - offsetof(UA_ModifyMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("itemsToModify") /* .memberName */ - UA_TYPES_MONITOREDITEMMODIFYREQUEST, /* .memberTypeIndex */ - offsetof(UA_ModifyMonitoredItemsRequest, itemsToModifySize) - - offsetof(UA_ModifyMonitoredItemsRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* ModifyMonitoredItemsResponse */ -static UA_DataTypeMember ModifyMonitoredItemsResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_MONITOREDITEMMODIFYRESULT, /* .memberTypeIndex */ - offsetof(UA_ModifyMonitoredItemsResponse, resultsSize) - - offsetof(UA_ModifyMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_ModifyMonitoredItemsResponse, diagnosticInfosSize) - - offsetof(UA_ModifyMonitoredItemsResponse, results) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* SetMonitoringModeRequest */ -static UA_DataTypeMember SetMonitoringModeRequest_members[4] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SetMonitoringModeRequest, subscriptionId) - offsetof(UA_SetMonitoringModeRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("monitoringMode") /* .memberName */ - UA_TYPES_MONITORINGMODE, /* .memberTypeIndex */ - offsetof(UA_SetMonitoringModeRequest, monitoringMode) - offsetof(UA_SetMonitoringModeRequest, subscriptionId) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("monitoredItemIds") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SetMonitoringModeRequest, monitoredItemIdsSize) - - offsetof(UA_SetMonitoringModeRequest, monitoringMode) - sizeof(UA_MonitoringMode), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* SetMonitoringModeResponse */ -static UA_DataTypeMember SetMonitoringModeResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_SetMonitoringModeResponse, resultsSize) - offsetof(UA_SetMonitoringModeResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_SetMonitoringModeResponse, diagnosticInfosSize) - offsetof(UA_SetMonitoringModeResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* DeleteMonitoredItemsRequest */ -static UA_DataTypeMember DeleteMonitoredItemsRequest_members[3] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_DeleteMonitoredItemsRequest, subscriptionId) - - offsetof(UA_DeleteMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("monitoredItemIds") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_DeleteMonitoredItemsRequest, monitoredItemIdsSize) - - offsetof(UA_DeleteMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* DeleteMonitoredItemsResponse */ -static UA_DataTypeMember DeleteMonitoredItemsResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_DeleteMonitoredItemsResponse, resultsSize) - - offsetof(UA_DeleteMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_DeleteMonitoredItemsResponse, diagnosticInfosSize) - - offsetof(UA_DeleteMonitoredItemsResponse, results) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* CreateSubscriptionRequest */ -static UA_DataTypeMember CreateSubscriptionRequest_members[7] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedPublishingInterval") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_CreateSubscriptionRequest, requestedPublishingInterval) - - offsetof(UA_CreateSubscriptionRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedLifetimeCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_CreateSubscriptionRequest, requestedLifetimeCount) - - offsetof(UA_CreateSubscriptionRequest, requestedPublishingInterval) - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedMaxKeepAliveCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_CreateSubscriptionRequest, requestedMaxKeepAliveCount) - - offsetof(UA_CreateSubscriptionRequest, requestedLifetimeCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxNotificationsPerPublish") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_CreateSubscriptionRequest, maxNotificationsPerPublish) - - offsetof(UA_CreateSubscriptionRequest, requestedMaxKeepAliveCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("publishingEnabled") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_CreateSubscriptionRequest, publishingEnabled) - - offsetof(UA_CreateSubscriptionRequest, maxNotificationsPerPublish) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("priority") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_CreateSubscriptionRequest, priority) - offsetof(UA_CreateSubscriptionRequest, publishingEnabled) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* CreateSubscriptionResponse */ -static UA_DataTypeMember CreateSubscriptionResponse_members[5] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_CreateSubscriptionResponse, subscriptionId) - - offsetof(UA_CreateSubscriptionResponse, responseHeader) - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedPublishingInterval") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_CreateSubscriptionResponse, revisedPublishingInterval) - - offsetof(UA_CreateSubscriptionResponse, subscriptionId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedLifetimeCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_CreateSubscriptionResponse, revisedLifetimeCount) - - offsetof(UA_CreateSubscriptionResponse, revisedPublishingInterval) - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedMaxKeepAliveCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_CreateSubscriptionResponse, revisedMaxKeepAliveCount) - - offsetof(UA_CreateSubscriptionResponse, revisedLifetimeCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ModifySubscriptionRequest */ -static UA_DataTypeMember ModifySubscriptionRequest_members[7] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ModifySubscriptionRequest, subscriptionId) - offsetof(UA_ModifySubscriptionRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedPublishingInterval") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_ModifySubscriptionRequest, requestedPublishingInterval) - - offsetof(UA_ModifySubscriptionRequest, subscriptionId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedLifetimeCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ModifySubscriptionRequest, requestedLifetimeCount) - - offsetof(UA_ModifySubscriptionRequest, requestedPublishingInterval) - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestedMaxKeepAliveCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ModifySubscriptionRequest, requestedMaxKeepAliveCount) - - offsetof(UA_ModifySubscriptionRequest, requestedLifetimeCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxNotificationsPerPublish") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ModifySubscriptionRequest, maxNotificationsPerPublish) - - offsetof(UA_ModifySubscriptionRequest, requestedMaxKeepAliveCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("priority") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_ModifySubscriptionRequest, priority) - - offsetof(UA_ModifySubscriptionRequest, maxNotificationsPerPublish) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ModifySubscriptionResponse */ -static UA_DataTypeMember ModifySubscriptionResponse_members[4] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedPublishingInterval") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_ModifySubscriptionResponse, revisedPublishingInterval) - - offsetof(UA_ModifySubscriptionResponse, responseHeader) - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedLifetimeCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ModifySubscriptionResponse, revisedLifetimeCount) - - offsetof(UA_ModifySubscriptionResponse, revisedPublishingInterval) - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("revisedMaxKeepAliveCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ModifySubscriptionResponse, revisedMaxKeepAliveCount) - - offsetof(UA_ModifySubscriptionResponse, revisedLifetimeCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SetPublishingModeRequest */ -static UA_DataTypeMember SetPublishingModeRequest_members[3] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("publishingEnabled") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_SetPublishingModeRequest, publishingEnabled) - - offsetof(UA_SetPublishingModeRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionIds") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SetPublishingModeRequest, subscriptionIdsSize) - - offsetof(UA_SetPublishingModeRequest, publishingEnabled) - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* SetPublishingModeResponse */ -static UA_DataTypeMember SetPublishingModeResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_SetPublishingModeResponse, resultsSize) - offsetof(UA_SetPublishingModeResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_SetPublishingModeResponse, diagnosticInfosSize) - offsetof(UA_SetPublishingModeResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* NotificationMessage */ -static UA_DataTypeMember NotificationMessage_members[3] = { - { - UA_TYPENAME("sequenceNumber") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("publishTime") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - offsetof(UA_NotificationMessage, publishTime) - offsetof(UA_NotificationMessage, sequenceNumber) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("notificationData") /* .memberName */ - UA_TYPES_EXTENSIONOBJECT, /* .memberTypeIndex */ - offsetof(UA_NotificationMessage, notificationDataSize) - offsetof(UA_NotificationMessage, publishTime) - - sizeof(UA_DateTime), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* MonitoredItemNotification */ -static UA_DataTypeMember MonitoredItemNotification_members[2] = { - { - UA_TYPENAME("clientHandle") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("value") /* .memberName */ - UA_TYPES_DATAVALUE, /* .memberTypeIndex */ - offsetof(UA_MonitoredItemNotification, value) - offsetof(UA_MonitoredItemNotification, clientHandle) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* EventFieldList */ -static UA_DataTypeMember EventFieldList_members[2] = { - { - UA_TYPENAME("clientHandle") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("eventFields") /* .memberName */ - UA_TYPES_VARIANT, /* .memberTypeIndex */ - offsetof(UA_EventFieldList, eventFieldsSize) - offsetof(UA_EventFieldList, clientHandle) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* StatusChangeNotification */ -static UA_DataTypeMember StatusChangeNotification_members[2] = { - { - UA_TYPENAME("status") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfo") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_StatusChangeNotification, diagnosticInfo) - offsetof(UA_StatusChangeNotification, status) - - sizeof(UA_StatusCode), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SubscriptionAcknowledgement */ -static UA_DataTypeMember SubscriptionAcknowledgement_members[2] = { - { - UA_TYPENAME("subscriptionId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("sequenceNumber") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionAcknowledgement, sequenceNumber) - - offsetof(UA_SubscriptionAcknowledgement, subscriptionId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* PublishRequest */ -static UA_DataTypeMember PublishRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionAcknowledgements") /* .memberName */ - UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT, /* .memberTypeIndex */ - offsetof(UA_PublishRequest, subscriptionAcknowledgementsSize) - offsetof(UA_PublishRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* PublishResponse */ -static UA_DataTypeMember PublishResponse_members[7] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_PublishResponse, subscriptionId) - offsetof(UA_PublishResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("availableSequenceNumbers") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_PublishResponse, availableSequenceNumbersSize) - offsetof(UA_PublishResponse, subscriptionId) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("moreNotifications") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_PublishResponse, moreNotifications) - offsetof(UA_PublishResponse, availableSequenceNumbers) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("notificationMessage") /* .memberName */ - UA_TYPES_NOTIFICATIONMESSAGE, /* .memberTypeIndex */ - offsetof(UA_PublishResponse, notificationMessage) - offsetof(UA_PublishResponse, moreNotifications) - - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_PublishResponse, resultsSize) - offsetof(UA_PublishResponse, notificationMessage) - - sizeof(UA_NotificationMessage), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_PublishResponse, diagnosticInfosSize) - offsetof(UA_PublishResponse, results) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* RepublishRequest */ -static UA_DataTypeMember RepublishRequest_members[3] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_RepublishRequest, subscriptionId) - offsetof(UA_RepublishRequest, requestHeader) - - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("retransmitSequenceNumber") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_RepublishRequest, retransmitSequenceNumber) - offsetof(UA_RepublishRequest, subscriptionId) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* RepublishResponse */ -static UA_DataTypeMember RepublishResponse_members[2] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("notificationMessage") /* .memberName */ - UA_TYPES_NOTIFICATIONMESSAGE, /* .memberTypeIndex */ - offsetof(UA_RepublishResponse, notificationMessage) - offsetof(UA_RepublishResponse, responseHeader) - - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* DeleteSubscriptionsRequest */ -static UA_DataTypeMember DeleteSubscriptionsRequest_members[2] = { - { - UA_TYPENAME("requestHeader") /* .memberName */ - UA_TYPES_REQUESTHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionIds") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_DeleteSubscriptionsRequest, subscriptionIdsSize) - - offsetof(UA_DeleteSubscriptionsRequest, requestHeader) - sizeof(UA_RequestHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* DeleteSubscriptionsResponse */ -static UA_DataTypeMember DeleteSubscriptionsResponse_members[3] = { - { - UA_TYPENAME("responseHeader") /* .memberName */ - UA_TYPES_RESPONSEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("results") /* .memberName */ - UA_TYPES_STATUSCODE, /* .memberTypeIndex */ - offsetof(UA_DeleteSubscriptionsResponse, resultsSize) - - offsetof(UA_DeleteSubscriptionsResponse, responseHeader) - sizeof(UA_ResponseHeader), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_DeleteSubscriptionsResponse, diagnosticInfosSize) - - offsetof(UA_DeleteSubscriptionsResponse, results) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* BuildInfo */ -static UA_DataTypeMember BuildInfo_members[6] = { - { - UA_TYPENAME("productUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("manufacturerName") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_BuildInfo, manufacturerName) - offsetof(UA_BuildInfo, productUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("productName") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_BuildInfo, productName) - offsetof(UA_BuildInfo, manufacturerName) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("softwareVersion") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_BuildInfo, softwareVersion) - offsetof(UA_BuildInfo, productName) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("buildNumber") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_BuildInfo, buildNumber) - offsetof(UA_BuildInfo, softwareVersion) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("buildDate") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - offsetof(UA_BuildInfo, buildDate) - offsetof(UA_BuildInfo, buildNumber) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* RedundancySupport */ -static UA_DataTypeMember RedundancySupport_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ServerState */ -static UA_DataTypeMember ServerState_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* RedundantServerDataType */ -static UA_DataTypeMember RedundantServerDataType_members[3] = { - { - UA_TYPENAME("serverId") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serviceLevel") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_RedundantServerDataType, serviceLevel) - offsetof(UA_RedundantServerDataType, serverId) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverState") /* .memberName */ - UA_TYPES_SERVERSTATE, /* .memberTypeIndex */ - offsetof(UA_RedundantServerDataType, serverState) - offsetof(UA_RedundantServerDataType, serviceLevel) - - sizeof(UA_Byte), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* EndpointUrlListDataType */ -static UA_DataTypeMember EndpointUrlListDataType_members[1] = { - { - UA_TYPENAME("endpointUrlList") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* NetworkGroupDataType */ -static UA_DataTypeMember NetworkGroupDataType_members[2] = { - { - UA_TYPENAME("serverUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("networkPaths") /* .memberName */ - UA_TYPES_ENDPOINTURLLISTDATATYPE, /* .memberTypeIndex */ - offsetof(UA_NetworkGroupDataType, networkPathsSize) - offsetof(UA_NetworkGroupDataType, serverUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* ServerDiagnosticsSummaryDataType */ -static UA_DataTypeMember ServerDiagnosticsSummaryDataType_members[12] = { - { - UA_TYPENAME("serverViewCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("currentSessionCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, currentSessionCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, serverViewCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("cumulatedSessionCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, cumulatedSessionCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, currentSessionCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("securityRejectedSessionCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, securityRejectedSessionCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, cumulatedSessionCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("rejectedSessionCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, rejectedSessionCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, securityRejectedSessionCount) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("sessionTimeoutCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, sessionTimeoutCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, rejectedSessionCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("sessionAbortCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, sessionAbortCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, sessionTimeoutCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("currentSubscriptionCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, currentSubscriptionCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, sessionAbortCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("cumulatedSubscriptionCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, cumulatedSubscriptionCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, currentSubscriptionCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("publishingIntervalCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, publishingIntervalCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, cumulatedSubscriptionCount) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("securityRejectedRequestsCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, securityRejectedRequestsCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, publishingIntervalCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("rejectedRequestsCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerDiagnosticsSummaryDataType, rejectedRequestsCount) - - offsetof(UA_ServerDiagnosticsSummaryDataType, securityRejectedRequestsCount) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ServerStatusDataType */ -static UA_DataTypeMember ServerStatusDataType_members[6] = { - { - UA_TYPENAME("startTime") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("currentTime") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - offsetof(UA_ServerStatusDataType, currentTime) - offsetof(UA_ServerStatusDataType, startTime) - - sizeof(UA_DateTime), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("state") /* .memberName */ - UA_TYPES_SERVERSTATE, /* .memberTypeIndex */ - offsetof(UA_ServerStatusDataType, state) - offsetof(UA_ServerStatusDataType, currentTime) - - sizeof(UA_DateTime), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("buildInfo") /* .memberName */ - UA_TYPES_BUILDINFO, /* .memberTypeIndex */ - offsetof(UA_ServerStatusDataType, buildInfo) - offsetof(UA_ServerStatusDataType, state) - - sizeof(UA_ServerState), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("secondsTillShutdown") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServerStatusDataType, secondsTillShutdown) - offsetof(UA_ServerStatusDataType, buildInfo) - - sizeof(UA_BuildInfo), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("shutdownReason") /* .memberName */ - UA_TYPES_LOCALIZEDTEXT, /* .memberTypeIndex */ - offsetof(UA_ServerStatusDataType, shutdownReason) - offsetof(UA_ServerStatusDataType, secondsTillShutdown) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SessionSecurityDiagnosticsDataType */ -static UA_DataTypeMember SessionSecurityDiagnosticsDataType_members[9] = { - { - UA_TYPENAME("sessionId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientUserIdOfSession") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SessionSecurityDiagnosticsDataType, clientUserIdOfSession) - - offsetof(UA_SessionSecurityDiagnosticsDataType, sessionId) - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientUserIdHistory") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SessionSecurityDiagnosticsDataType, clientUserIdHistorySize) - - offsetof(UA_SessionSecurityDiagnosticsDataType, clientUserIdOfSession) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("authenticationMechanism") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SessionSecurityDiagnosticsDataType, authenticationMechanism) - - offsetof(UA_SessionSecurityDiagnosticsDataType, clientUserIdHistory) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("encoding") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SessionSecurityDiagnosticsDataType, encoding) - - offsetof(UA_SessionSecurityDiagnosticsDataType, authenticationMechanism) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("transportProtocol") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SessionSecurityDiagnosticsDataType, transportProtocol) - - offsetof(UA_SessionSecurityDiagnosticsDataType, encoding) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("securityMode") /* .memberName */ - UA_TYPES_MESSAGESECURITYMODE, /* .memberTypeIndex */ - offsetof(UA_SessionSecurityDiagnosticsDataType, securityMode) - - offsetof(UA_SessionSecurityDiagnosticsDataType, transportProtocol) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("securityPolicyUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SessionSecurityDiagnosticsDataType, securityPolicyUri) - - offsetof(UA_SessionSecurityDiagnosticsDataType, securityMode) - - sizeof(UA_MessageSecurityMode), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientCertificate") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_SessionSecurityDiagnosticsDataType, clientCertificate) - - offsetof(UA_SessionSecurityDiagnosticsDataType, securityPolicyUri) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ServiceCounterDataType */ -static UA_DataTypeMember ServiceCounterDataType_members[2] = { - { - UA_TYPENAME("totalCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("errorCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_ServiceCounterDataType, errorCount) - offsetof(UA_ServiceCounterDataType, totalCount) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SubscriptionDiagnosticsDataType */ -static UA_DataTypeMember SubscriptionDiagnosticsDataType_members[31] = { - { - UA_TYPENAME("sessionId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("subscriptionId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, subscriptionId) - - offsetof(UA_SubscriptionDiagnosticsDataType, sessionId) - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("priority") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, priority) - - offsetof(UA_SubscriptionDiagnosticsDataType, subscriptionId) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("publishingInterval") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, publishingInterval) - - offsetof(UA_SubscriptionDiagnosticsDataType, priority) - sizeof(UA_Byte), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxKeepAliveCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, maxKeepAliveCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, publishingInterval) - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxLifetimeCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, maxLifetimeCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, maxKeepAliveCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxNotificationsPerPublish") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, maxNotificationsPerPublish) - - offsetof(UA_SubscriptionDiagnosticsDataType, maxLifetimeCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("publishingEnabled") /* .memberName */ - UA_TYPES_BOOLEAN, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, publishingEnabled) - - offsetof(UA_SubscriptionDiagnosticsDataType, maxNotificationsPerPublish) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("modifyCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, modifyCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, publishingEnabled) - sizeof(UA_Boolean), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("enableCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, enableCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, modifyCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("disableCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, disableCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, enableCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("republishRequestCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, republishRequestCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, disableCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("republishMessageRequestCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, republishMessageRequestCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, republishRequestCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("republishMessageCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, republishMessageCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, republishMessageRequestCount) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("transferRequestCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, transferRequestCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, republishMessageCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("transferredToAltClientCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, transferredToAltClientCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, transferRequestCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("transferredToSameClientCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, transferredToSameClientCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, transferredToAltClientCount) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("publishRequestCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, publishRequestCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, transferredToSameClientCount) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("dataChangeNotificationsCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, dataChangeNotificationsCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, publishRequestCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("eventNotificationsCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, eventNotificationsCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, dataChangeNotificationsCount) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("notificationsCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, notificationsCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, eventNotificationsCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("latePublishRequestCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, latePublishRequestCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, notificationsCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("currentKeepAliveCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, currentKeepAliveCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, latePublishRequestCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("currentLifetimeCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, currentLifetimeCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, currentKeepAliveCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("unacknowledgedMessageCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, unacknowledgedMessageCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, currentLifetimeCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("discardedMessageCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, discardedMessageCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, unacknowledgedMessageCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("monitoredItemCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, monitoredItemCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, discardedMessageCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("disabledMonitoredItemCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, disabledMonitoredItemCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, monitoredItemCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("monitoringQueueOverflowCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, monitoringQueueOverflowCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, disabledMonitoredItemCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("nextSequenceNumber") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, nextSequenceNumber) - - offsetof(UA_SubscriptionDiagnosticsDataType, monitoringQueueOverflowCount) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("eventQueueOverFlowCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SubscriptionDiagnosticsDataType, eventQueueOverFlowCount) - - offsetof(UA_SubscriptionDiagnosticsDataType, nextSequenceNumber) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ModelChangeStructureDataType */ -static UA_DataTypeMember ModelChangeStructureDataType_members[3] = { - { - UA_TYPENAME("affected") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("affectedType") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_ModelChangeStructureDataType, affectedType) - offsetof(UA_ModelChangeStructureDataType, affected) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("verb") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_ModelChangeStructureDataType, verb) - offsetof(UA_ModelChangeStructureDataType, affectedType) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SemanticChangeStructureDataType */ -static UA_DataTypeMember SemanticChangeStructureDataType_members[2] = { - { - UA_TYPENAME("affected") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("affectedType") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - offsetof(UA_SemanticChangeStructureDataType, affectedType) - - offsetof(UA_SemanticChangeStructureDataType, affected) - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* DataChangeNotification */ -static UA_DataTypeMember DataChangeNotification_members[2] = { - { - UA_TYPENAME("monitoredItems") /* .memberName */ - UA_TYPES_MONITOREDITEMNOTIFICATION, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("diagnosticInfos") /* .memberName */ - UA_TYPES_DIAGNOSTICINFO, /* .memberTypeIndex */ - offsetof(UA_DataChangeNotification, diagnosticInfosSize) - offsetof(UA_DataChangeNotification, monitoredItems) - - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* EventNotificationList */ -static UA_DataTypeMember EventNotificationList_members[1] = { - { - UA_TYPENAME("events") /* .memberName */ - UA_TYPES_EVENTFIELDLIST, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, -}; - -/* SessionDiagnosticsDataType */ -static UA_DataTypeMember SessionDiagnosticsDataType_members[43] = { - { - UA_TYPENAME("sessionId") /* .memberName */ - UA_TYPES_NODEID, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("sessionName") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, sessionName) - offsetof(UA_SessionDiagnosticsDataType, sessionId) - - sizeof(UA_NodeId), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientDescription") /* .memberName */ - UA_TYPES_APPLICATIONDESCRIPTION, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, clientDescription) - - offsetof(UA_SessionDiagnosticsDataType, sessionName) - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("serverUri") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, serverUri) - - offsetof(UA_SessionDiagnosticsDataType, clientDescription) - - sizeof(UA_ApplicationDescription), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("endpointUrl") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, endpointUrl) - offsetof(UA_SessionDiagnosticsDataType, serverUri) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("localeIds") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, localeIdsSize) - offsetof(UA_SessionDiagnosticsDataType, endpointUrl) - - sizeof(UA_String), /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("actualSessionTimeout") /* .memberName */ - UA_TYPES_DOUBLE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, actualSessionTimeout) - - offsetof(UA_SessionDiagnosticsDataType, localeIds) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxResponseMessageSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, maxResponseMessageSize) - - offsetof(UA_SessionDiagnosticsDataType, actualSessionTimeout) - sizeof(UA_Double), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientConnectionTime") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, clientConnectionTime) - - offsetof(UA_SessionDiagnosticsDataType, maxResponseMessageSize) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("clientLastContactTime") /* .memberName */ - UA_TYPES_DATETIME, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, clientLastContactTime) - - offsetof(UA_SessionDiagnosticsDataType, clientConnectionTime) - sizeof(UA_DateTime), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("currentSubscriptionsCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, currentSubscriptionsCount) - - offsetof(UA_SessionDiagnosticsDataType, clientLastContactTime) - sizeof(UA_DateTime), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("currentMonitoredItemsCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, currentMonitoredItemsCount) - - offsetof(UA_SessionDiagnosticsDataType, currentSubscriptionsCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("currentPublishRequestsInQueue") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, currentPublishRequestsInQueue) - - offsetof(UA_SessionDiagnosticsDataType, currentMonitoredItemsCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("totalRequestCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, totalRequestCount) - - offsetof(UA_SessionDiagnosticsDataType, currentPublishRequestsInQueue) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("unauthorizedRequestCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, unauthorizedRequestCount) - - offsetof(UA_SessionDiagnosticsDataType, totalRequestCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("readCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, readCount) - - offsetof(UA_SessionDiagnosticsDataType, unauthorizedRequestCount) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("historyReadCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, historyReadCount) - offsetof(UA_SessionDiagnosticsDataType, readCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("writeCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, writeCount) - - offsetof(UA_SessionDiagnosticsDataType, historyReadCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("historyUpdateCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, historyUpdateCount) - - offsetof(UA_SessionDiagnosticsDataType, writeCount) - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("callCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, callCount) - - offsetof(UA_SessionDiagnosticsDataType, historyUpdateCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("createMonitoredItemsCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, createMonitoredItemsCount) - - offsetof(UA_SessionDiagnosticsDataType, callCount) - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("modifyMonitoredItemsCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, modifyMonitoredItemsCount) - - offsetof(UA_SessionDiagnosticsDataType, createMonitoredItemsCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("setMonitoringModeCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, setMonitoringModeCount) - - offsetof(UA_SessionDiagnosticsDataType, modifyMonitoredItemsCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("setTriggeringCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, setTriggeringCount) - - offsetof(UA_SessionDiagnosticsDataType, setMonitoringModeCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("deleteMonitoredItemsCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, deleteMonitoredItemsCount) - - offsetof(UA_SessionDiagnosticsDataType, setTriggeringCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("createSubscriptionCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, createSubscriptionCount) - - offsetof(UA_SessionDiagnosticsDataType, deleteMonitoredItemsCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("modifySubscriptionCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, modifySubscriptionCount) - - offsetof(UA_SessionDiagnosticsDataType, createSubscriptionCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("setPublishingModeCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, setPublishingModeCount) - - offsetof(UA_SessionDiagnosticsDataType, modifySubscriptionCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("publishCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, publishCount) - - offsetof(UA_SessionDiagnosticsDataType, setPublishingModeCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("republishCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, republishCount) - - offsetof(UA_SessionDiagnosticsDataType, publishCount) - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("transferSubscriptionsCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, transferSubscriptionsCount) - - offsetof(UA_SessionDiagnosticsDataType, republishCount) - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("deleteSubscriptionsCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, deleteSubscriptionsCount) - - offsetof(UA_SessionDiagnosticsDataType, transferSubscriptionsCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("addNodesCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, addNodesCount) - - offsetof(UA_SessionDiagnosticsDataType, deleteSubscriptionsCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("addReferencesCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, addReferencesCount) - - offsetof(UA_SessionDiagnosticsDataType, addNodesCount) - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("deleteNodesCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, deleteNodesCount) - - offsetof(UA_SessionDiagnosticsDataType, addReferencesCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("deleteReferencesCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, deleteReferencesCount) - - offsetof(UA_SessionDiagnosticsDataType, deleteNodesCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("browseCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, browseCount) - - offsetof(UA_SessionDiagnosticsDataType, deleteReferencesCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("browseNextCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, browseNextCount) - - offsetof(UA_SessionDiagnosticsDataType, browseCount) - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("translateBrowsePathsToNodeIdsCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, translateBrowsePathsToNodeIdsCount) - - offsetof(UA_SessionDiagnosticsDataType, browseNextCount) - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("queryFirstCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, queryFirstCount) - - offsetof(UA_SessionDiagnosticsDataType, translateBrowsePathsToNodeIdsCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("queryNextCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, queryNextCount) - - offsetof(UA_SessionDiagnosticsDataType, queryFirstCount) - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("registerNodesCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, registerNodesCount) - - offsetof(UA_SessionDiagnosticsDataType, queryNextCount) - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("unregisterNodesCount") /* .memberName */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .memberTypeIndex */ - offsetof(UA_SessionDiagnosticsDataType, unregisterNodesCount) - - offsetof(UA_SessionDiagnosticsDataType, registerNodesCount) - - sizeof(UA_ServiceCounterDataType), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; -const UA_DataType UA_TYPES[UA_TYPES_COUNT] = { - - /* Boolean */ - { - UA_TYPENAME("Boolean") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {1}}, /* .typeId */ - sizeof(UA_Boolean), /* .memSize */ - UA_TYPES_BOOLEAN, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - true, /* .overlayable */ - 0, /* .binaryEncodingId */ - Boolean_members /* .members */ - }, - - /* SByte */ - { - UA_TYPENAME("SByte") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {2}}, /* .typeId */ - sizeof(UA_SByte), /* .memSize */ - UA_TYPES_SBYTE, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - true, /* .overlayable */ - 0, /* .binaryEncodingId */ - SByte_members /* .members */ - }, - - /* Byte */ - { - UA_TYPENAME("Byte") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {3}}, /* .typeId */ - sizeof(UA_Byte), /* .memSize */ - UA_TYPES_BYTE, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - true, /* .overlayable */ - 0, /* .binaryEncodingId */ - Byte_members /* .members */ - }, - - /* Int16 */ - { - UA_TYPENAME("Int16") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {4}}, /* .typeId */ - sizeof(UA_Int16), /* .memSize */ - UA_TYPES_INT16, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - Int16_members /* .members */ - }, - - /* UInt16 */ - { - UA_TYPENAME("UInt16") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {5}}, /* .typeId */ - sizeof(UA_UInt16), /* .memSize */ - UA_TYPES_UINT16, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - UInt16_members /* .members */ - }, - - /* Int32 */ - { - UA_TYPENAME("Int32") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {6}}, /* .typeId */ - sizeof(UA_Int32), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - Int32_members /* .members */ - }, - - /* UInt32 */ - { - UA_TYPENAME("UInt32") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {7}}, /* .typeId */ - sizeof(UA_UInt32), /* .memSize */ - UA_TYPES_UINT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - UInt32_members /* .members */ - }, - - /* Int64 */ - { - UA_TYPENAME("Int64") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {8}}, /* .typeId */ - sizeof(UA_Int64), /* .memSize */ - UA_TYPES_INT64, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - Int64_members /* .members */ - }, - - /* UInt64 */ - { - UA_TYPENAME("UInt64") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {9}}, /* .typeId */ - sizeof(UA_UInt64), /* .memSize */ - UA_TYPES_UINT64, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - UInt64_members /* .members */ - }, - - /* Float */ - { - UA_TYPENAME("Float") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {10}}, /* .typeId */ - sizeof(UA_Float), /* .memSize */ - UA_TYPES_FLOAT, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_FLOAT, /* .overlayable */ - 0, /* .binaryEncodingId */ - Float_members /* .members */ - }, - - /* Double */ - { - UA_TYPENAME("Double") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {11}}, /* .typeId */ - sizeof(UA_Double), /* .memSize */ - UA_TYPES_DOUBLE, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_FLOAT, /* .overlayable */ - 0, /* .binaryEncodingId */ - Double_members /* .members */ - }, - - /* String */ - { - UA_TYPENAME("String") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {12}}, /* .typeId */ - sizeof(UA_String), /* .memSize */ - UA_TYPES_STRING, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - String_members /* .members */ - }, - - /* DateTime */ - { - UA_TYPENAME("DateTime") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {13}}, /* .typeId */ - sizeof(UA_DateTime), /* .memSize */ - UA_TYPES_DATETIME, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - DateTime_members /* .members */ - }, - - /* Guid */ - { - UA_TYPENAME("Guid") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {14}}, /* .typeId */ - sizeof(UA_Guid), /* .memSize */ - UA_TYPES_GUID, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - (UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_Guid, data2) == sizeof(UA_UInt32) && - offsetof(UA_Guid, data3) == (sizeof(UA_UInt16) + sizeof(UA_UInt32)) && - offsetof(UA_Guid, data4) == (2 * sizeof(UA_UInt32))), /* .overlayable */ - 0, /* .binaryEncodingId */ - Guid_members /* .members */ - }, - - /* ByteString */ - { - UA_TYPENAME("ByteString") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {15}}, /* .typeId */ - sizeof(UA_ByteString), /* .memSize */ - UA_TYPES_BYTESTRING, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - ByteString_members /* .members */ - }, - - /* XmlElement */ - { - UA_TYPENAME("XmlElement") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {16}}, /* .typeId */ - sizeof(UA_XmlElement), /* .memSize */ - UA_TYPES_XMLELEMENT, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - XmlElement_members /* .members */ - }, - - /* NodeId */ - { - UA_TYPENAME("NodeId") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {17}}, /* .typeId */ - sizeof(UA_NodeId), /* .memSize */ - UA_TYPES_NODEID, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - NodeId_members /* .members */ - }, - - /* ExpandedNodeId */ - { - UA_TYPENAME("ExpandedNodeId") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {18}}, /* .typeId */ - sizeof(UA_ExpandedNodeId), /* .memSize */ - UA_TYPES_EXPANDEDNODEID, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - ExpandedNodeId_members /* .members */ - }, - - /* StatusCode */ - { - UA_TYPENAME("StatusCode") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {19}}, /* .typeId */ - sizeof(UA_StatusCode), /* .memSize */ - UA_TYPES_STATUSCODE, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - StatusCode_members /* .members */ - }, - - /* QualifiedName */ - { - UA_TYPENAME("QualifiedName") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {20}}, /* .typeId */ - sizeof(UA_QualifiedName), /* .memSize */ - UA_TYPES_QUALIFIEDNAME, /* .typeIndex */ - 2, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - QualifiedName_members /* .members */ - }, - - /* LocalizedText */ - { - UA_TYPENAME("LocalizedText") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {21}}, /* .typeId */ - sizeof(UA_LocalizedText), /* .memSize */ - UA_TYPES_LOCALIZEDTEXT, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - LocalizedText_members /* .members */ - }, - - /* ExtensionObject */ - { - UA_TYPENAME("ExtensionObject") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {22}}, /* .typeId */ - sizeof(UA_ExtensionObject), /* .memSize */ - UA_TYPES_EXTENSIONOBJECT, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - ExtensionObject_members /* .members */ - }, - - /* DataValue */ - { - UA_TYPENAME("DataValue") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {23}}, /* .typeId */ - sizeof(UA_DataValue), /* .memSize */ - UA_TYPES_DATAVALUE, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - DataValue_members /* .members */ - }, - - /* Variant */ - { - UA_TYPENAME("Variant") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {24}}, /* .typeId */ - sizeof(UA_Variant), /* .memSize */ - UA_TYPES_VARIANT, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - Variant_members /* .members */ - }, - - /* DiagnosticInfo */ - { - UA_TYPENAME("DiagnosticInfo") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {25}}, /* .typeId */ - sizeof(UA_DiagnosticInfo), /* .memSize */ - UA_TYPES_DIAGNOSTICINFO, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - DiagnosticInfo_members /* .members */ - }, - - /* IdType */ - { - UA_TYPENAME("IdType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {256}}, /* .typeId */ - sizeof(UA_IdType), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - IdType_members /* .members */ - }, - - /* NodeClass */ - { - UA_TYPENAME("NodeClass") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {257}}, /* .typeId */ - sizeof(UA_NodeClass), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - NodeClass_members /* .members */ - }, - - /* ReferenceNode */ - { - UA_TYPENAME("ReferenceNode") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {285}}, /* .typeId */ - sizeof(UA_ReferenceNode), /* .memSize */ - UA_TYPES_REFERENCENODE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 287, /* .binaryEncodingId */ - ReferenceNode_members /* .members */ - }, - - /* Argument */ - { - UA_TYPENAME("Argument") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {296}}, /* .typeId */ - sizeof(UA_Argument), /* .memSize */ - UA_TYPES_ARGUMENT, /* .typeIndex */ - 5, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 298, /* .binaryEncodingId */ - Argument_members /* .members */ - }, - - /* Duration */ - { - UA_TYPENAME("Duration") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {290}}, /* .typeId */ - sizeof(UA_Duration), /* .memSize */ - UA_TYPES_DURATION, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - Duration_members /* .members */ - }, - - /* UtcTime */ - { - UA_TYPENAME("UtcTime") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {294}}, /* .typeId */ - sizeof(UA_UtcTime), /* .memSize */ - UA_TYPES_UTCTIME, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - UtcTime_members /* .members */ - }, - - /* LocaleId */ - { - UA_TYPENAME("LocaleId") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {295}}, /* .typeId */ - sizeof(UA_LocaleId), /* .memSize */ - UA_TYPES_LOCALEID, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - LocaleId_members /* .members */ - }, - - /* TimeZoneDataType */ - { - UA_TYPENAME("TimeZoneDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {8912}}, /* .typeId */ - sizeof(UA_TimeZoneDataType), /* .memSize */ - UA_TYPES_TIMEZONEDATATYPE, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && UA_BINARY_OVERLAYABLE_INTEGER && true && - offsetof(UA_TimeZoneDataType, daylightSavingInOffset) == - (offsetof(UA_TimeZoneDataType, offset) + sizeof(UA_Int16)), /* .overlayable */ - 8917, /* .binaryEncodingId */ - TimeZoneDataType_members /* .members */ - }, - - /* ApplicationType */ - { - UA_TYPENAME("ApplicationType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {307}}, /* .typeId */ - sizeof(UA_ApplicationType), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - ApplicationType_members /* .members */ - }, - - /* ApplicationDescription */ - { - UA_TYPENAME("ApplicationDescription") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {308}}, /* .typeId */ - sizeof(UA_ApplicationDescription), /* .memSize */ - UA_TYPES_APPLICATIONDESCRIPTION, /* .typeIndex */ - 7, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 310, /* .binaryEncodingId */ - ApplicationDescription_members /* .members */ - }, - - /* RequestHeader */ - { - UA_TYPENAME("RequestHeader") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {389}}, /* .typeId */ - sizeof(UA_RequestHeader), /* .memSize */ - UA_TYPES_REQUESTHEADER, /* .typeIndex */ - 7, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 391, /* .binaryEncodingId */ - RequestHeader_members /* .members */ - }, - - /* ResponseHeader */ - { - UA_TYPENAME("ResponseHeader") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {392}}, /* .typeId */ - sizeof(UA_ResponseHeader), /* .memSize */ - UA_TYPES_RESPONSEHEADER, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 394, /* .binaryEncodingId */ - ResponseHeader_members /* .members */ - }, - - /* ServiceFault */ - { - UA_TYPENAME("ServiceFault") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {395}}, /* .typeId */ - sizeof(UA_ServiceFault), /* .memSize */ - UA_TYPES_SERVICEFAULT, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 397, /* .binaryEncodingId */ - ServiceFault_members /* .members */ - }, - - /* FindServersRequest */ - { - UA_TYPENAME("FindServersRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {420}}, /* .typeId */ - sizeof(UA_FindServersRequest), /* .memSize */ - UA_TYPES_FINDSERVERSREQUEST, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 422, /* .binaryEncodingId */ - FindServersRequest_members /* .members */ - }, - - /* FindServersResponse */ - { - UA_TYPENAME("FindServersResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {423}}, /* .typeId */ - sizeof(UA_FindServersResponse), /* .memSize */ - UA_TYPES_FINDSERVERSRESPONSE, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 425, /* .binaryEncodingId */ - FindServersResponse_members /* .members */ - }, - - /* ServerOnNetwork */ - { - UA_TYPENAME("ServerOnNetwork") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {12189}}, /* .typeId */ - sizeof(UA_ServerOnNetwork), /* .memSize */ - UA_TYPES_SERVERONNETWORK, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 12207, /* .binaryEncodingId */ - ServerOnNetwork_members /* .members */ - }, - - /* FindServersOnNetworkRequest */ - { - UA_TYPENAME("FindServersOnNetworkRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {12190}}, /* .typeId */ - sizeof(UA_FindServersOnNetworkRequest), /* .memSize */ - UA_TYPES_FINDSERVERSONNETWORKREQUEST, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 12208, /* .binaryEncodingId */ - FindServersOnNetworkRequest_members /* .members */ - }, - - /* FindServersOnNetworkResponse */ - { - UA_TYPENAME("FindServersOnNetworkResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {12191}}, /* .typeId */ - sizeof(UA_FindServersOnNetworkResponse), /* .memSize */ - UA_TYPES_FINDSERVERSONNETWORKRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 12209, /* .binaryEncodingId */ - FindServersOnNetworkResponse_members /* .members */ - }, - - /* MessageSecurityMode */ - { - UA_TYPENAME("MessageSecurityMode") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {302}}, /* .typeId */ - sizeof(UA_MessageSecurityMode), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - MessageSecurityMode_members /* .members */ - }, - - /* UserTokenType */ - { - UA_TYPENAME("UserTokenType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {303}}, /* .typeId */ - sizeof(UA_UserTokenType), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - UserTokenType_members /* .members */ - }, - - /* UserTokenPolicy */ - { - UA_TYPENAME("UserTokenPolicy") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {304}}, /* .typeId */ - sizeof(UA_UserTokenPolicy), /* .memSize */ - UA_TYPES_USERTOKENPOLICY, /* .typeIndex */ - 5, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 306, /* .binaryEncodingId */ - UserTokenPolicy_members /* .members */ - }, - - /* EndpointDescription */ - { - UA_TYPENAME("EndpointDescription") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {312}}, /* .typeId */ - sizeof(UA_EndpointDescription), /* .memSize */ - UA_TYPES_ENDPOINTDESCRIPTION, /* .typeIndex */ - 8, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 314, /* .binaryEncodingId */ - EndpointDescription_members /* .members */ - }, - - /* GetEndpointsRequest */ - { - UA_TYPENAME("GetEndpointsRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {426}}, /* .typeId */ - sizeof(UA_GetEndpointsRequest), /* .memSize */ - UA_TYPES_GETENDPOINTSREQUEST, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 428, /* .binaryEncodingId */ - GetEndpointsRequest_members /* .members */ - }, - - /* GetEndpointsResponse */ - { - UA_TYPENAME("GetEndpointsResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {429}}, /* .typeId */ - sizeof(UA_GetEndpointsResponse), /* .memSize */ - UA_TYPES_GETENDPOINTSRESPONSE, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 431, /* .binaryEncodingId */ - GetEndpointsResponse_members /* .members */ - }, - - /* RegisteredServer */ - { - UA_TYPENAME("RegisteredServer") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {432}}, /* .typeId */ - sizeof(UA_RegisteredServer), /* .memSize */ - UA_TYPES_REGISTEREDSERVER, /* .typeIndex */ - 8, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 434, /* .binaryEncodingId */ - RegisteredServer_members /* .members */ - }, - - /* RegisterServerRequest */ - { - UA_TYPENAME("RegisterServerRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {435}}, /* .typeId */ - sizeof(UA_RegisterServerRequest), /* .memSize */ - UA_TYPES_REGISTERSERVERREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 437, /* .binaryEncodingId */ - RegisterServerRequest_members /* .members */ - }, - - /* RegisterServerResponse */ - { - UA_TYPENAME("RegisterServerResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {438}}, /* .typeId */ - sizeof(UA_RegisterServerResponse), /* .memSize */ - UA_TYPES_REGISTERSERVERRESPONSE, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 440, /* .binaryEncodingId */ - RegisterServerResponse_members /* .members */ - }, - - /* DiscoveryConfiguration */ - { - UA_TYPENAME("DiscoveryConfiguration") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {12890}}, /* .typeId */ - sizeof(UA_DiscoveryConfiguration), /* .memSize */ - UA_TYPES_DISCOVERYCONFIGURATION, /* .typeIndex */ - 0, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true, /* .overlayable */ - 12900, /* .binaryEncodingId */ - DiscoveryConfiguration_members /* .members */ - }, - - /* MdnsDiscoveryConfiguration */ - { - UA_TYPENAME("MdnsDiscoveryConfiguration") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {12891}}, /* .typeId */ - sizeof(UA_MdnsDiscoveryConfiguration), /* .memSize */ - UA_TYPES_MDNSDISCOVERYCONFIGURATION, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 12901, /* .binaryEncodingId */ - MdnsDiscoveryConfiguration_members /* .members */ - }, - - /* RegisterServer2Request */ - { - UA_TYPENAME("RegisterServer2Request") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {12193}}, /* .typeId */ - sizeof(UA_RegisterServer2Request), /* .memSize */ - UA_TYPES_REGISTERSERVER2REQUEST, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 12211, /* .binaryEncodingId */ - RegisterServer2Request_members /* .members */ - }, - - /* RegisterServer2Response */ - { - UA_TYPENAME("RegisterServer2Response") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {12194}}, /* .typeId */ - sizeof(UA_RegisterServer2Response), /* .memSize */ - UA_TYPES_REGISTERSERVER2RESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 12212, /* .binaryEncodingId */ - RegisterServer2Response_members /* .members */ - }, - - /* SecurityTokenRequestType */ - { - UA_TYPENAME("SecurityTokenRequestType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {315}}, /* .typeId */ - sizeof(UA_SecurityTokenRequestType), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - SecurityTokenRequestType_members /* .members */ - }, - - /* ChannelSecurityToken */ - { - UA_TYPENAME("ChannelSecurityToken") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {441}}, /* .typeId */ - sizeof(UA_ChannelSecurityToken), /* .memSize */ - UA_TYPES_CHANNELSECURITYTOKEN, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && - UA_BINARY_OVERLAYABLE_INTEGER &&UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ChannelSecurityToken, - tokenId) == - (offsetof(UA_ChannelSecurityToken, channelId) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ChannelSecurityToken, createdAt) == - (offsetof(UA_ChannelSecurityToken, tokenId) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ChannelSecurityToken, revisedLifetime) == - (offsetof(UA_ChannelSecurityToken, createdAt) + sizeof(UA_DateTime)), /* .overlayable */ - 443, /* .binaryEncodingId */ - ChannelSecurityToken_members /* .members */ - }, - - /* OpenSecureChannelRequest */ - { - UA_TYPENAME("OpenSecureChannelRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {444}}, /* .typeId */ - sizeof(UA_OpenSecureChannelRequest), /* .memSize */ - UA_TYPES_OPENSECURECHANNELREQUEST, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 446, /* .binaryEncodingId */ - OpenSecureChannelRequest_members /* .members */ - }, - - /* OpenSecureChannelResponse */ - { - UA_TYPENAME("OpenSecureChannelResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {447}}, /* .typeId */ - sizeof(UA_OpenSecureChannelResponse), /* .memSize */ - UA_TYPES_OPENSECURECHANNELRESPONSE, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 449, /* .binaryEncodingId */ - OpenSecureChannelResponse_members /* .members */ - }, - - /* CloseSecureChannelRequest */ - { - UA_TYPENAME("CloseSecureChannelRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {450}}, /* .typeId */ - sizeof(UA_CloseSecureChannelRequest), /* .memSize */ - UA_TYPES_CLOSESECURECHANNELREQUEST, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 452, /* .binaryEncodingId */ - CloseSecureChannelRequest_members /* .members */ - }, - - /* CloseSecureChannelResponse */ - { - UA_TYPENAME("CloseSecureChannelResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {453}}, /* .typeId */ - sizeof(UA_CloseSecureChannelResponse), /* .memSize */ - UA_TYPES_CLOSESECURECHANNELRESPONSE, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 455, /* .binaryEncodingId */ - CloseSecureChannelResponse_members /* .members */ - }, - - /* SignedSoftwareCertificate */ - { - UA_TYPENAME("SignedSoftwareCertificate") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {344}}, /* .typeId */ - sizeof(UA_SignedSoftwareCertificate), /* .memSize */ - UA_TYPES_SIGNEDSOFTWARECERTIFICATE, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 346, /* .binaryEncodingId */ - SignedSoftwareCertificate_members /* .members */ - }, - - /* SignatureData */ - { - UA_TYPENAME("SignatureData") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {456}}, /* .typeId */ - sizeof(UA_SignatureData), /* .memSize */ - UA_TYPES_SIGNATUREDATA, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 458, /* .binaryEncodingId */ - SignatureData_members /* .members */ - }, - - /* CreateSessionRequest */ - { - UA_TYPENAME("CreateSessionRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {459}}, /* .typeId */ - sizeof(UA_CreateSessionRequest), /* .memSize */ - UA_TYPES_CREATESESSIONREQUEST, /* .typeIndex */ - 9, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 461, /* .binaryEncodingId */ - CreateSessionRequest_members /* .members */ - }, - - /* CreateSessionResponse */ - { - UA_TYPENAME("CreateSessionResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {462}}, /* .typeId */ - sizeof(UA_CreateSessionResponse), /* .memSize */ - UA_TYPES_CREATESESSIONRESPONSE, /* .typeIndex */ - 10, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 464, /* .binaryEncodingId */ - CreateSessionResponse_members /* .members */ - }, - - /* UserIdentityToken */ - { - UA_TYPENAME("UserIdentityToken") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {316}}, /* .typeId */ - sizeof(UA_UserIdentityToken), /* .memSize */ - UA_TYPES_USERIDENTITYTOKEN, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 318, /* .binaryEncodingId */ - UserIdentityToken_members /* .members */ - }, - - /* AnonymousIdentityToken */ - { - UA_TYPENAME("AnonymousIdentityToken") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {319}}, /* .typeId */ - sizeof(UA_AnonymousIdentityToken), /* .memSize */ - UA_TYPES_ANONYMOUSIDENTITYTOKEN, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 321, /* .binaryEncodingId */ - AnonymousIdentityToken_members /* .members */ - }, - - /* UserNameIdentityToken */ - { - UA_TYPENAME("UserNameIdentityToken") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {322}}, /* .typeId */ - sizeof(UA_UserNameIdentityToken), /* .memSize */ - UA_TYPES_USERNAMEIDENTITYTOKEN, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 324, /* .binaryEncodingId */ - UserNameIdentityToken_members /* .members */ - }, - - /* ActivateSessionRequest */ - { - UA_TYPENAME("ActivateSessionRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {465}}, /* .typeId */ - sizeof(UA_ActivateSessionRequest), /* .memSize */ - UA_TYPES_ACTIVATESESSIONREQUEST, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 467, /* .binaryEncodingId */ - ActivateSessionRequest_members /* .members */ - }, - - /* ActivateSessionResponse */ - { - UA_TYPENAME("ActivateSessionResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {468}}, /* .typeId */ - sizeof(UA_ActivateSessionResponse), /* .memSize */ - UA_TYPES_ACTIVATESESSIONRESPONSE, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 470, /* .binaryEncodingId */ - ActivateSessionResponse_members /* .members */ - }, - - /* CloseSessionRequest */ - { - UA_TYPENAME("CloseSessionRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {471}}, /* .typeId */ - sizeof(UA_CloseSessionRequest), /* .memSize */ - UA_TYPES_CLOSESESSIONREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 473, /* .binaryEncodingId */ - CloseSessionRequest_members /* .members */ - }, - - /* CloseSessionResponse */ - { - UA_TYPENAME("CloseSessionResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {474}}, /* .typeId */ - sizeof(UA_CloseSessionResponse), /* .memSize */ - UA_TYPES_CLOSESESSIONRESPONSE, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 476, /* .binaryEncodingId */ - CloseSessionResponse_members /* .members */ - }, - - /* NodeAttributesMask */ - { - UA_TYPENAME("NodeAttributesMask") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {348}}, /* .typeId */ - sizeof(UA_NodeAttributesMask), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - NodeAttributesMask_members /* .members */ - }, - - /* NodeAttributes */ - { - UA_TYPENAME("NodeAttributes") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {349}}, /* .typeId */ - sizeof(UA_NodeAttributes), /* .memSize */ - UA_TYPES_NODEATTRIBUTES, /* .typeIndex */ - 5, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 351, /* .binaryEncodingId */ - NodeAttributes_members /* .members */ - }, - - /* ObjectAttributes */ - { - UA_TYPENAME("ObjectAttributes") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {352}}, /* .typeId */ - sizeof(UA_ObjectAttributes), /* .memSize */ - UA_TYPES_OBJECTATTRIBUTES, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 354, /* .binaryEncodingId */ - ObjectAttributes_members /* .members */ - }, - - /* VariableAttributes */ - { - UA_TYPENAME("VariableAttributes") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {355}}, /* .typeId */ - sizeof(UA_VariableAttributes), /* .memSize */ - UA_TYPES_VARIABLEATTRIBUTES, /* .typeIndex */ - 13, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 357, /* .binaryEncodingId */ - VariableAttributes_members /* .members */ - }, - - /* MethodAttributes */ - { - UA_TYPENAME("MethodAttributes") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {358}}, /* .typeId */ - sizeof(UA_MethodAttributes), /* .memSize */ - UA_TYPES_METHODATTRIBUTES, /* .typeIndex */ - 7, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 360, /* .binaryEncodingId */ - MethodAttributes_members /* .members */ - }, - - /* ObjectTypeAttributes */ - { - UA_TYPENAME("ObjectTypeAttributes") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {361}}, /* .typeId */ - sizeof(UA_ObjectTypeAttributes), /* .memSize */ - UA_TYPES_OBJECTTYPEATTRIBUTES, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 363, /* .binaryEncodingId */ - ObjectTypeAttributes_members /* .members */ - }, - - /* VariableTypeAttributes */ - { - UA_TYPENAME("VariableTypeAttributes") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {364}}, /* .typeId */ - sizeof(UA_VariableTypeAttributes), /* .memSize */ - UA_TYPES_VARIABLETYPEATTRIBUTES, /* .typeIndex */ - 10, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 366, /* .binaryEncodingId */ - VariableTypeAttributes_members /* .members */ - }, - - /* ReferenceTypeAttributes */ - { - UA_TYPENAME("ReferenceTypeAttributes") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {367}}, /* .typeId */ - sizeof(UA_ReferenceTypeAttributes), /* .memSize */ - UA_TYPES_REFERENCETYPEATTRIBUTES, /* .typeIndex */ - 8, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 369, /* .binaryEncodingId */ - ReferenceTypeAttributes_members /* .members */ - }, - - /* DataTypeAttributes */ - { - UA_TYPENAME("DataTypeAttributes") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {370}}, /* .typeId */ - sizeof(UA_DataTypeAttributes), /* .memSize */ - UA_TYPES_DATATYPEATTRIBUTES, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 372, /* .binaryEncodingId */ - DataTypeAttributes_members /* .members */ - }, - - /* ViewAttributes */ - { - UA_TYPENAME("ViewAttributes") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {373}}, /* .typeId */ - sizeof(UA_ViewAttributes), /* .memSize */ - UA_TYPES_VIEWATTRIBUTES, /* .typeIndex */ - 7, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 375, /* .binaryEncodingId */ - ViewAttributes_members /* .members */ - }, - - /* AddNodesItem */ - { - UA_TYPENAME("AddNodesItem") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {376}}, /* .typeId */ - sizeof(UA_AddNodesItem), /* .memSize */ - UA_TYPES_ADDNODESITEM, /* .typeIndex */ - 7, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 378, /* .binaryEncodingId */ - AddNodesItem_members /* .members */ - }, - - /* AddNodesResult */ - { - UA_TYPENAME("AddNodesResult") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {483}}, /* .typeId */ - sizeof(UA_AddNodesResult), /* .memSize */ - UA_TYPES_ADDNODESRESULT, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 485, /* .binaryEncodingId */ - AddNodesResult_members /* .members */ - }, - - /* AddNodesRequest */ - { - UA_TYPENAME("AddNodesRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {486}}, /* .typeId */ - sizeof(UA_AddNodesRequest), /* .memSize */ - UA_TYPES_ADDNODESREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 488, /* .binaryEncodingId */ - AddNodesRequest_members /* .members */ - }, - - /* AddNodesResponse */ - { - UA_TYPENAME("AddNodesResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {489}}, /* .typeId */ - sizeof(UA_AddNodesResponse), /* .memSize */ - UA_TYPES_ADDNODESRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 491, /* .binaryEncodingId */ - AddNodesResponse_members /* .members */ - }, - - /* AddReferencesItem */ - { - UA_TYPENAME("AddReferencesItem") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {379}}, /* .typeId */ - sizeof(UA_AddReferencesItem), /* .memSize */ - UA_TYPES_ADDREFERENCESITEM, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 381, /* .binaryEncodingId */ - AddReferencesItem_members /* .members */ - }, - - /* AddReferencesRequest */ - { - UA_TYPENAME("AddReferencesRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {492}}, /* .typeId */ - sizeof(UA_AddReferencesRequest), /* .memSize */ - UA_TYPES_ADDREFERENCESREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 494, /* .binaryEncodingId */ - AddReferencesRequest_members /* .members */ - }, - - /* AddReferencesResponse */ - { - UA_TYPENAME("AddReferencesResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {495}}, /* .typeId */ - sizeof(UA_AddReferencesResponse), /* .memSize */ - UA_TYPES_ADDREFERENCESRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 497, /* .binaryEncodingId */ - AddReferencesResponse_members /* .members */ - }, - - /* DeleteNodesItem */ - { - UA_TYPENAME("DeleteNodesItem") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {382}}, /* .typeId */ - sizeof(UA_DeleteNodesItem), /* .memSize */ - UA_TYPES_DELETENODESITEM, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 384, /* .binaryEncodingId */ - DeleteNodesItem_members /* .members */ - }, - - /* DeleteNodesRequest */ - { - UA_TYPENAME("DeleteNodesRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {498}}, /* .typeId */ - sizeof(UA_DeleteNodesRequest), /* .memSize */ - UA_TYPES_DELETENODESREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 500, /* .binaryEncodingId */ - DeleteNodesRequest_members /* .members */ - }, - - /* DeleteNodesResponse */ - { - UA_TYPENAME("DeleteNodesResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {501}}, /* .typeId */ - sizeof(UA_DeleteNodesResponse), /* .memSize */ - UA_TYPES_DELETENODESRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 503, /* .binaryEncodingId */ - DeleteNodesResponse_members /* .members */ - }, - - /* DeleteReferencesItem */ - { - UA_TYPENAME("DeleteReferencesItem") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {385}}, /* .typeId */ - sizeof(UA_DeleteReferencesItem), /* .memSize */ - UA_TYPES_DELETEREFERENCESITEM, /* .typeIndex */ - 5, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 387, /* .binaryEncodingId */ - DeleteReferencesItem_members /* .members */ - }, - - /* DeleteReferencesRequest */ - { - UA_TYPENAME("DeleteReferencesRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {504}}, /* .typeId */ - sizeof(UA_DeleteReferencesRequest), /* .memSize */ - UA_TYPES_DELETEREFERENCESREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 506, /* .binaryEncodingId */ - DeleteReferencesRequest_members /* .members */ - }, - - /* DeleteReferencesResponse */ - { - UA_TYPENAME("DeleteReferencesResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {507}}, /* .typeId */ - sizeof(UA_DeleteReferencesResponse), /* .memSize */ - UA_TYPES_DELETEREFERENCESRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 509, /* .binaryEncodingId */ - DeleteReferencesResponse_members /* .members */ - }, - - /* BrowseDirection */ - { - UA_TYPENAME("BrowseDirection") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {510}}, /* .typeId */ - sizeof(UA_BrowseDirection), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - BrowseDirection_members /* .members */ - }, - - /* ViewDescription */ - { - UA_TYPENAME("ViewDescription") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {511}}, /* .typeId */ - sizeof(UA_ViewDescription), /* .memSize */ - UA_TYPES_VIEWDESCRIPTION, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 513, /* .binaryEncodingId */ - ViewDescription_members /* .members */ - }, - - /* BrowseDescription */ - { - UA_TYPENAME("BrowseDescription") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {514}}, /* .typeId */ - sizeof(UA_BrowseDescription), /* .memSize */ - UA_TYPES_BROWSEDESCRIPTION, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 516, /* .binaryEncodingId */ - BrowseDescription_members /* .members */ - }, - - /* BrowseResultMask */ - { - UA_TYPENAME("BrowseResultMask") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {517}}, /* .typeId */ - sizeof(UA_BrowseResultMask), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - BrowseResultMask_members /* .members */ - }, - - /* ReferenceDescription */ - { - UA_TYPENAME("ReferenceDescription") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {518}}, /* .typeId */ - sizeof(UA_ReferenceDescription), /* .memSize */ - UA_TYPES_REFERENCEDESCRIPTION, /* .typeIndex */ - 7, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 520, /* .binaryEncodingId */ - ReferenceDescription_members /* .members */ - }, - - /* BrowseResult */ - { - UA_TYPENAME("BrowseResult") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {522}}, /* .typeId */ - sizeof(UA_BrowseResult), /* .memSize */ - UA_TYPES_BROWSERESULT, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 524, /* .binaryEncodingId */ - BrowseResult_members /* .members */ - }, - - /* BrowseRequest */ - { - UA_TYPENAME("BrowseRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {525}}, /* .typeId */ - sizeof(UA_BrowseRequest), /* .memSize */ - UA_TYPES_BROWSEREQUEST, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 527, /* .binaryEncodingId */ - BrowseRequest_members /* .members */ - }, - - /* BrowseResponse */ - { - UA_TYPENAME("BrowseResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {528}}, /* .typeId */ - sizeof(UA_BrowseResponse), /* .memSize */ - UA_TYPES_BROWSERESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 530, /* .binaryEncodingId */ - BrowseResponse_members /* .members */ - }, - - /* BrowseNextRequest */ - { - UA_TYPENAME("BrowseNextRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {531}}, /* .typeId */ - sizeof(UA_BrowseNextRequest), /* .memSize */ - UA_TYPES_BROWSENEXTREQUEST, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 533, /* .binaryEncodingId */ - BrowseNextRequest_members /* .members */ - }, - - /* BrowseNextResponse */ - { - UA_TYPENAME("BrowseNextResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {534}}, /* .typeId */ - sizeof(UA_BrowseNextResponse), /* .memSize */ - UA_TYPES_BROWSENEXTRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 536, /* .binaryEncodingId */ - BrowseNextResponse_members /* .members */ - }, - - /* RelativePathElement */ - { - UA_TYPENAME("RelativePathElement") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {537}}, /* .typeId */ - sizeof(UA_RelativePathElement), /* .memSize */ - UA_TYPES_RELATIVEPATHELEMENT, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 539, /* .binaryEncodingId */ - RelativePathElement_members /* .members */ - }, - - /* RelativePath */ - { - UA_TYPENAME("RelativePath") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {540}}, /* .typeId */ - sizeof(UA_RelativePath), /* .memSize */ - UA_TYPES_RELATIVEPATH, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 542, /* .binaryEncodingId */ - RelativePath_members /* .members */ - }, - - /* BrowsePath */ - { - UA_TYPENAME("BrowsePath") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {543}}, /* .typeId */ - sizeof(UA_BrowsePath), /* .memSize */ - UA_TYPES_BROWSEPATH, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 545, /* .binaryEncodingId */ - BrowsePath_members /* .members */ - }, - - /* BrowsePathTarget */ - { - UA_TYPENAME("BrowsePathTarget") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {546}}, /* .typeId */ - sizeof(UA_BrowsePathTarget), /* .memSize */ - UA_TYPES_BROWSEPATHTARGET, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 548, /* .binaryEncodingId */ - BrowsePathTarget_members /* .members */ - }, - - /* BrowsePathResult */ - { - UA_TYPENAME("BrowsePathResult") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {549}}, /* .typeId */ - sizeof(UA_BrowsePathResult), /* .memSize */ - UA_TYPES_BROWSEPATHRESULT, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 551, /* .binaryEncodingId */ - BrowsePathResult_members /* .members */ - }, - - /* TranslateBrowsePathsToNodeIdsRequest */ - { - UA_TYPENAME("TranslateBrowsePathsToNodeIdsRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {552}}, /* .typeId */ - sizeof(UA_TranslateBrowsePathsToNodeIdsRequest), /* .memSize */ - UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 554, /* .binaryEncodingId */ - TranslateBrowsePathsToNodeIdsRequest_members /* .members */ - }, - - /* TranslateBrowsePathsToNodeIdsResponse */ - { - UA_TYPENAME("TranslateBrowsePathsToNodeIdsResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {555}}, /* .typeId */ - sizeof(UA_TranslateBrowsePathsToNodeIdsResponse), /* .memSize */ - UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 557, /* .binaryEncodingId */ - TranslateBrowsePathsToNodeIdsResponse_members /* .members */ - }, - - /* RegisterNodesRequest */ - { - UA_TYPENAME("RegisterNodesRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {558}}, /* .typeId */ - sizeof(UA_RegisterNodesRequest), /* .memSize */ - UA_TYPES_REGISTERNODESREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 560, /* .binaryEncodingId */ - RegisterNodesRequest_members /* .members */ - }, - - /* RegisterNodesResponse */ - { - UA_TYPENAME("RegisterNodesResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {561}}, /* .typeId */ - sizeof(UA_RegisterNodesResponse), /* .memSize */ - UA_TYPES_REGISTERNODESRESPONSE, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 563, /* .binaryEncodingId */ - RegisterNodesResponse_members /* .members */ - }, - - /* UnregisterNodesRequest */ - { - UA_TYPENAME("UnregisterNodesRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {564}}, /* .typeId */ - sizeof(UA_UnregisterNodesRequest), /* .memSize */ - UA_TYPES_UNREGISTERNODESREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 566, /* .binaryEncodingId */ - UnregisterNodesRequest_members /* .members */ - }, - - /* UnregisterNodesResponse */ - { - UA_TYPENAME("UnregisterNodesResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {567}}, /* .typeId */ - sizeof(UA_UnregisterNodesResponse), /* .memSize */ - UA_TYPES_UNREGISTERNODESRESPONSE, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 569, /* .binaryEncodingId */ - UnregisterNodesResponse_members /* .members */ - }, - - /* QueryDataDescription */ - { - UA_TYPENAME("QueryDataDescription") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {570}}, /* .typeId */ - sizeof(UA_QueryDataDescription), /* .memSize */ - UA_TYPES_QUERYDATADESCRIPTION, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 572, /* .binaryEncodingId */ - QueryDataDescription_members /* .members */ - }, - - /* NodeTypeDescription */ - { - UA_TYPENAME("NodeTypeDescription") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {573}}, /* .typeId */ - sizeof(UA_NodeTypeDescription), /* .memSize */ - UA_TYPES_NODETYPEDESCRIPTION, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 575, /* .binaryEncodingId */ - NodeTypeDescription_members /* .members */ - }, - - /* FilterOperator */ - { - UA_TYPENAME("FilterOperator") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {576}}, /* .typeId */ - sizeof(UA_FilterOperator), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - FilterOperator_members /* .members */ - }, - - /* QueryDataSet */ - { - UA_TYPENAME("QueryDataSet") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {577}}, /* .typeId */ - sizeof(UA_QueryDataSet), /* .memSize */ - UA_TYPES_QUERYDATASET, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 579, /* .binaryEncodingId */ - QueryDataSet_members /* .members */ - }, - - /* ContentFilterElement */ - { - UA_TYPENAME("ContentFilterElement") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {583}}, /* .typeId */ - sizeof(UA_ContentFilterElement), /* .memSize */ - UA_TYPES_CONTENTFILTERELEMENT, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 585, /* .binaryEncodingId */ - ContentFilterElement_members /* .members */ - }, - - /* ContentFilter */ - { - UA_TYPENAME("ContentFilter") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {586}}, /* .typeId */ - sizeof(UA_ContentFilter), /* .memSize */ - UA_TYPES_CONTENTFILTER, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 588, /* .binaryEncodingId */ - ContentFilter_members /* .members */ - }, - - /* FilterOperand */ - { - UA_TYPENAME("FilterOperand") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {589}}, /* .typeId */ - sizeof(UA_FilterOperand), /* .memSize */ - UA_TYPES_FILTEROPERAND, /* .typeIndex */ - 0, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true, /* .overlayable */ - 591, /* .binaryEncodingId */ - FilterOperand_members /* .members */ - }, - - /* SimpleAttributeOperand */ - { - UA_TYPENAME("SimpleAttributeOperand") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {601}}, /* .typeId */ - sizeof(UA_SimpleAttributeOperand), /* .memSize */ - UA_TYPES_SIMPLEATTRIBUTEOPERAND, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 603, /* .binaryEncodingId */ - SimpleAttributeOperand_members /* .members */ - }, - - /* ContentFilterElementResult */ - { - UA_TYPENAME("ContentFilterElementResult") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {604}}, /* .typeId */ - sizeof(UA_ContentFilterElementResult), /* .memSize */ - UA_TYPES_CONTENTFILTERELEMENTRESULT, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 606, /* .binaryEncodingId */ - ContentFilterElementResult_members /* .members */ - }, - - /* ContentFilterResult */ - { - UA_TYPENAME("ContentFilterResult") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {607}}, /* .typeId */ - sizeof(UA_ContentFilterResult), /* .memSize */ - UA_TYPES_CONTENTFILTERRESULT, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 609, /* .binaryEncodingId */ - ContentFilterResult_members /* .members */ - }, - - /* ParsingResult */ - { - UA_TYPENAME("ParsingResult") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {610}}, /* .typeId */ - sizeof(UA_ParsingResult), /* .memSize */ - UA_TYPES_PARSINGRESULT, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 612, /* .binaryEncodingId */ - ParsingResult_members /* .members */ - }, - - /* QueryFirstRequest */ - { - UA_TYPENAME("QueryFirstRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {613}}, /* .typeId */ - sizeof(UA_QueryFirstRequest), /* .memSize */ - UA_TYPES_QUERYFIRSTREQUEST, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 615, /* .binaryEncodingId */ - QueryFirstRequest_members /* .members */ - }, - - /* QueryFirstResponse */ - { - UA_TYPENAME("QueryFirstResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {616}}, /* .typeId */ - sizeof(UA_QueryFirstResponse), /* .memSize */ - UA_TYPES_QUERYFIRSTRESPONSE, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 618, /* .binaryEncodingId */ - QueryFirstResponse_members /* .members */ - }, - - /* QueryNextRequest */ - { - UA_TYPENAME("QueryNextRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {619}}, /* .typeId */ - sizeof(UA_QueryNextRequest), /* .memSize */ - UA_TYPES_QUERYNEXTREQUEST, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 621, /* .binaryEncodingId */ - QueryNextRequest_members /* .members */ - }, - - /* QueryNextResponse */ - { - UA_TYPENAME("QueryNextResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {622}}, /* .typeId */ - sizeof(UA_QueryNextResponse), /* .memSize */ - UA_TYPES_QUERYNEXTRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 624, /* .binaryEncodingId */ - QueryNextResponse_members /* .members */ - }, - - /* TimestampsToReturn */ - { - UA_TYPENAME("TimestampsToReturn") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {625}}, /* .typeId */ - sizeof(UA_TimestampsToReturn), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - TimestampsToReturn_members /* .members */ - }, - - /* ReadValueId */ - { - UA_TYPENAME("ReadValueId") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {626}}, /* .typeId */ - sizeof(UA_ReadValueId), /* .memSize */ - UA_TYPES_READVALUEID, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 628, /* .binaryEncodingId */ - ReadValueId_members /* .members */ - }, - - /* ReadRequest */ - { - UA_TYPENAME("ReadRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {629}}, /* .typeId */ - sizeof(UA_ReadRequest), /* .memSize */ - UA_TYPES_READREQUEST, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 631, /* .binaryEncodingId */ - ReadRequest_members /* .members */ - }, - - /* ReadResponse */ - { - UA_TYPENAME("ReadResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {632}}, /* .typeId */ - sizeof(UA_ReadResponse), /* .memSize */ - UA_TYPES_READRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 634, /* .binaryEncodingId */ - ReadResponse_members /* .members */ - }, - - /* WriteValue */ - { - UA_TYPENAME("WriteValue") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {668}}, /* .typeId */ - sizeof(UA_WriteValue), /* .memSize */ - UA_TYPES_WRITEVALUE, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 670, /* .binaryEncodingId */ - WriteValue_members /* .members */ - }, - - /* WriteRequest */ - { - UA_TYPENAME("WriteRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {671}}, /* .typeId */ - sizeof(UA_WriteRequest), /* .memSize */ - UA_TYPES_WRITEREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 673, /* .binaryEncodingId */ - WriteRequest_members /* .members */ - }, - - /* WriteResponse */ - { - UA_TYPENAME("WriteResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {674}}, /* .typeId */ - sizeof(UA_WriteResponse), /* .memSize */ - UA_TYPES_WRITERESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 676, /* .binaryEncodingId */ - WriteResponse_members /* .members */ - }, - - /* CallMethodRequest */ - { - UA_TYPENAME("CallMethodRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {704}}, /* .typeId */ - sizeof(UA_CallMethodRequest), /* .memSize */ - UA_TYPES_CALLMETHODREQUEST, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 706, /* .binaryEncodingId */ - CallMethodRequest_members /* .members */ - }, - - /* CallMethodResult */ - { - UA_TYPENAME("CallMethodResult") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {707}}, /* .typeId */ - sizeof(UA_CallMethodResult), /* .memSize */ - UA_TYPES_CALLMETHODRESULT, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 709, /* .binaryEncodingId */ - CallMethodResult_members /* .members */ - }, - - /* CallRequest */ - { - UA_TYPENAME("CallRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {710}}, /* .typeId */ - sizeof(UA_CallRequest), /* .memSize */ - UA_TYPES_CALLREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 712, /* .binaryEncodingId */ - CallRequest_members /* .members */ - }, - - /* CallResponse */ - { - UA_TYPENAME("CallResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {713}}, /* .typeId */ - sizeof(UA_CallResponse), /* .memSize */ - UA_TYPES_CALLRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 715, /* .binaryEncodingId */ - CallResponse_members /* .members */ - }, - - /* MonitoringMode */ - { - UA_TYPENAME("MonitoringMode") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {716}}, /* .typeId */ - sizeof(UA_MonitoringMode), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - MonitoringMode_members /* .members */ - }, - - /* DataChangeTrigger */ - { - UA_TYPENAME("DataChangeTrigger") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {717}}, /* .typeId */ - sizeof(UA_DataChangeTrigger), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - DataChangeTrigger_members /* .members */ - }, - - /* DeadbandType */ - { - UA_TYPENAME("DeadbandType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {718}}, /* .typeId */ - sizeof(UA_DeadbandType), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - DeadbandType_members /* .members */ - }, - - /* MonitoringFilter */ - { - UA_TYPENAME("MonitoringFilter") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {719}}, /* .typeId */ - sizeof(UA_MonitoringFilter), /* .memSize */ - UA_TYPES_MONITORINGFILTER, /* .typeIndex */ - 0, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true, /* .overlayable */ - 721, /* .binaryEncodingId */ - MonitoringFilter_members /* .members */ - }, - - /* DataChangeFilter */ - { - UA_TYPENAME("DataChangeFilter") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {722}}, /* .typeId */ - sizeof(UA_DataChangeFilter), /* .memSize */ - UA_TYPES_DATACHANGEFILTER, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && - UA_BINARY_OVERLAYABLE_INTEGER &&UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_DataChangeFilter, - deadbandType) == - (offsetof(UA_DataChangeFilter, trigger) + sizeof(UA_DataChangeTrigger)) && - UA_BINARY_OVERLAYABLE_FLOAT &&offsetof(UA_DataChangeFilter, deadbandValue) == - (offsetof(UA_DataChangeFilter, deadbandType) + sizeof(UA_UInt32)), /* .overlayable */ - 724, /* .binaryEncodingId */ - DataChangeFilter_members /* .members */ - }, - - /* EventFilter */ - { - UA_TYPENAME("EventFilter") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {725}}, /* .typeId */ - sizeof(UA_EventFilter), /* .memSize */ - UA_TYPES_EVENTFILTER, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 727, /* .binaryEncodingId */ - EventFilter_members /* .members */ - }, - - /* MonitoringParameters */ - { - UA_TYPENAME("MonitoringParameters") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {740}}, /* .typeId */ - sizeof(UA_MonitoringParameters), /* .memSize */ - UA_TYPES_MONITORINGPARAMETERS, /* .typeIndex */ - 5, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 742, /* .binaryEncodingId */ - MonitoringParameters_members /* .members */ - }, - - /* MonitoredItemCreateRequest */ - { - UA_TYPENAME("MonitoredItemCreateRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {743}}, /* .typeId */ - sizeof(UA_MonitoredItemCreateRequest), /* .memSize */ - UA_TYPES_MONITOREDITEMCREATEREQUEST, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 745, /* .binaryEncodingId */ - MonitoredItemCreateRequest_members /* .members */ - }, - - /* MonitoredItemCreateResult */ - { - UA_TYPENAME("MonitoredItemCreateResult") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {746}}, /* .typeId */ - sizeof(UA_MonitoredItemCreateResult), /* .memSize */ - UA_TYPES_MONITOREDITEMCREATERESULT, /* .typeIndex */ - 5, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 748, /* .binaryEncodingId */ - MonitoredItemCreateResult_members /* .members */ - }, - - /* CreateMonitoredItemsRequest */ - { - UA_TYPENAME("CreateMonitoredItemsRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {749}}, /* .typeId */ - sizeof(UA_CreateMonitoredItemsRequest), /* .memSize */ - UA_TYPES_CREATEMONITOREDITEMSREQUEST, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 751, /* .binaryEncodingId */ - CreateMonitoredItemsRequest_members /* .members */ - }, - - /* CreateMonitoredItemsResponse */ - { - UA_TYPENAME("CreateMonitoredItemsResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {752}}, /* .typeId */ - sizeof(UA_CreateMonitoredItemsResponse), /* .memSize */ - UA_TYPES_CREATEMONITOREDITEMSRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 754, /* .binaryEncodingId */ - CreateMonitoredItemsResponse_members /* .members */ - }, - - /* MonitoredItemModifyRequest */ - { - UA_TYPENAME("MonitoredItemModifyRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {755}}, /* .typeId */ - sizeof(UA_MonitoredItemModifyRequest), /* .memSize */ - UA_TYPES_MONITOREDITEMMODIFYREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 757, /* .binaryEncodingId */ - MonitoredItemModifyRequest_members /* .members */ - }, - - /* MonitoredItemModifyResult */ - { - UA_TYPENAME("MonitoredItemModifyResult") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {758}}, /* .typeId */ - sizeof(UA_MonitoredItemModifyResult), /* .memSize */ - UA_TYPES_MONITOREDITEMMODIFYRESULT, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 760, /* .binaryEncodingId */ - MonitoredItemModifyResult_members /* .members */ - }, - - /* ModifyMonitoredItemsRequest */ - { - UA_TYPENAME("ModifyMonitoredItemsRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {761}}, /* .typeId */ - sizeof(UA_ModifyMonitoredItemsRequest), /* .memSize */ - UA_TYPES_MODIFYMONITOREDITEMSREQUEST, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 763, /* .binaryEncodingId */ - ModifyMonitoredItemsRequest_members /* .members */ - }, - - /* ModifyMonitoredItemsResponse */ - { - UA_TYPENAME("ModifyMonitoredItemsResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {764}}, /* .typeId */ - sizeof(UA_ModifyMonitoredItemsResponse), /* .memSize */ - UA_TYPES_MODIFYMONITOREDITEMSRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 766, /* .binaryEncodingId */ - ModifyMonitoredItemsResponse_members /* .members */ - }, - - /* SetMonitoringModeRequest */ - { - UA_TYPENAME("SetMonitoringModeRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {767}}, /* .typeId */ - sizeof(UA_SetMonitoringModeRequest), /* .memSize */ - UA_TYPES_SETMONITORINGMODEREQUEST, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 769, /* .binaryEncodingId */ - SetMonitoringModeRequest_members /* .members */ - }, - - /* SetMonitoringModeResponse */ - { - UA_TYPENAME("SetMonitoringModeResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {770}}, /* .typeId */ - sizeof(UA_SetMonitoringModeResponse), /* .memSize */ - UA_TYPES_SETMONITORINGMODERESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 772, /* .binaryEncodingId */ - SetMonitoringModeResponse_members /* .members */ - }, - - /* DeleteMonitoredItemsRequest */ - { - UA_TYPENAME("DeleteMonitoredItemsRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {779}}, /* .typeId */ - sizeof(UA_DeleteMonitoredItemsRequest), /* .memSize */ - UA_TYPES_DELETEMONITOREDITEMSREQUEST, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 781, /* .binaryEncodingId */ - DeleteMonitoredItemsRequest_members /* .members */ - }, - - /* DeleteMonitoredItemsResponse */ - { - UA_TYPENAME("DeleteMonitoredItemsResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {782}}, /* .typeId */ - sizeof(UA_DeleteMonitoredItemsResponse), /* .memSize */ - UA_TYPES_DELETEMONITOREDITEMSRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 784, /* .binaryEncodingId */ - DeleteMonitoredItemsResponse_members /* .members */ - }, - - /* CreateSubscriptionRequest */ - { - UA_TYPENAME("CreateSubscriptionRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {785}}, /* .typeId */ - sizeof(UA_CreateSubscriptionRequest), /* .memSize */ - UA_TYPES_CREATESUBSCRIPTIONREQUEST, /* .typeIndex */ - 7, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 787, /* .binaryEncodingId */ - CreateSubscriptionRequest_members /* .members */ - }, - - /* CreateSubscriptionResponse */ - { - UA_TYPENAME("CreateSubscriptionResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {788}}, /* .typeId */ - sizeof(UA_CreateSubscriptionResponse), /* .memSize */ - UA_TYPES_CREATESUBSCRIPTIONRESPONSE, /* .typeIndex */ - 5, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 790, /* .binaryEncodingId */ - CreateSubscriptionResponse_members /* .members */ - }, - - /* ModifySubscriptionRequest */ - { - UA_TYPENAME("ModifySubscriptionRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {791}}, /* .typeId */ - sizeof(UA_ModifySubscriptionRequest), /* .memSize */ - UA_TYPES_MODIFYSUBSCRIPTIONREQUEST, /* .typeIndex */ - 7, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 793, /* .binaryEncodingId */ - ModifySubscriptionRequest_members /* .members */ - }, - - /* ModifySubscriptionResponse */ - { - UA_TYPENAME("ModifySubscriptionResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {794}}, /* .typeId */ - sizeof(UA_ModifySubscriptionResponse), /* .memSize */ - UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE, /* .typeIndex */ - 4, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 796, /* .binaryEncodingId */ - ModifySubscriptionResponse_members /* .members */ - }, - - /* SetPublishingModeRequest */ - { - UA_TYPENAME("SetPublishingModeRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {797}}, /* .typeId */ - sizeof(UA_SetPublishingModeRequest), /* .memSize */ - UA_TYPES_SETPUBLISHINGMODEREQUEST, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 799, /* .binaryEncodingId */ - SetPublishingModeRequest_members /* .members */ - }, - - /* SetPublishingModeResponse */ - { - UA_TYPENAME("SetPublishingModeResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {800}}, /* .typeId */ - sizeof(UA_SetPublishingModeResponse), /* .memSize */ - UA_TYPES_SETPUBLISHINGMODERESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 802, /* .binaryEncodingId */ - SetPublishingModeResponse_members /* .members */ - }, - - /* NotificationMessage */ - { - UA_TYPENAME("NotificationMessage") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {803}}, /* .typeId */ - sizeof(UA_NotificationMessage), /* .memSize */ - UA_TYPES_NOTIFICATIONMESSAGE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 805, /* .binaryEncodingId */ - NotificationMessage_members /* .members */ - }, - - /* MonitoredItemNotification */ - { - UA_TYPENAME("MonitoredItemNotification") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {806}}, /* .typeId */ - sizeof(UA_MonitoredItemNotification), /* .memSize */ - UA_TYPES_MONITOREDITEMNOTIFICATION, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 808, /* .binaryEncodingId */ - MonitoredItemNotification_members /* .members */ - }, - - /* EventFieldList */ - { - UA_TYPENAME("EventFieldList") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {917}}, /* .typeId */ - sizeof(UA_EventFieldList), /* .memSize */ - UA_TYPES_EVENTFIELDLIST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 919, /* .binaryEncodingId */ - EventFieldList_members /* .members */ - }, - - /* StatusChangeNotification */ - { - UA_TYPENAME("StatusChangeNotification") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {818}}, /* .typeId */ - sizeof(UA_StatusChangeNotification), /* .memSize */ - UA_TYPES_STATUSCHANGENOTIFICATION, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 820, /* .binaryEncodingId */ - StatusChangeNotification_members /* .members */ - }, - - /* SubscriptionAcknowledgement */ - { - UA_TYPENAME("SubscriptionAcknowledgement") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {821}}, /* .typeId */ - sizeof(UA_SubscriptionAcknowledgement), /* .memSize */ - UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && - UA_BINARY_OVERLAYABLE_INTEGER &&UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_SubscriptionAcknowledgement, - sequenceNumber) == - (offsetof(UA_SubscriptionAcknowledgement, subscriptionId) + sizeof(UA_UInt32)), /* .overlayable */ - 823, /* .binaryEncodingId */ - SubscriptionAcknowledgement_members /* .members */ - }, - - /* PublishRequest */ - { - UA_TYPENAME("PublishRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {824}}, /* .typeId */ - sizeof(UA_PublishRequest), /* .memSize */ - UA_TYPES_PUBLISHREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 826, /* .binaryEncodingId */ - PublishRequest_members /* .members */ - }, - - /* PublishResponse */ - { - UA_TYPENAME("PublishResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {827}}, /* .typeId */ - sizeof(UA_PublishResponse), /* .memSize */ - UA_TYPES_PUBLISHRESPONSE, /* .typeIndex */ - 7, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 829, /* .binaryEncodingId */ - PublishResponse_members /* .members */ - }, - - /* RepublishRequest */ - { - UA_TYPENAME("RepublishRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {830}}, /* .typeId */ - sizeof(UA_RepublishRequest), /* .memSize */ - UA_TYPES_REPUBLISHREQUEST, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 832, /* .binaryEncodingId */ - RepublishRequest_members /* .members */ - }, - - /* RepublishResponse */ - { - UA_TYPENAME("RepublishResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {833}}, /* .typeId */ - sizeof(UA_RepublishResponse), /* .memSize */ - UA_TYPES_REPUBLISHRESPONSE, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 835, /* .binaryEncodingId */ - RepublishResponse_members /* .members */ - }, - - /* DeleteSubscriptionsRequest */ - { - UA_TYPENAME("DeleteSubscriptionsRequest") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {845}}, /* .typeId */ - sizeof(UA_DeleteSubscriptionsRequest), /* .memSize */ - UA_TYPES_DELETESUBSCRIPTIONSREQUEST, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 847, /* .binaryEncodingId */ - DeleteSubscriptionsRequest_members /* .members */ - }, - - /* DeleteSubscriptionsResponse */ - { - UA_TYPENAME("DeleteSubscriptionsResponse") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {848}}, /* .typeId */ - sizeof(UA_DeleteSubscriptionsResponse), /* .memSize */ - UA_TYPES_DELETESUBSCRIPTIONSRESPONSE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 850, /* .binaryEncodingId */ - DeleteSubscriptionsResponse_members /* .members */ - }, - - /* BuildInfo */ - { - UA_TYPENAME("BuildInfo") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {338}}, /* .typeId */ - sizeof(UA_BuildInfo), /* .memSize */ - UA_TYPES_BUILDINFO, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 340, /* .binaryEncodingId */ - BuildInfo_members /* .members */ - }, - - /* RedundancySupport */ - { - UA_TYPENAME("RedundancySupport") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {851}}, /* .typeId */ - sizeof(UA_RedundancySupport), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - RedundancySupport_members /* .members */ - }, - - /* ServerState */ - { - UA_TYPENAME("ServerState") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {852}}, /* .typeId */ - sizeof(UA_ServerState), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - ServerState_members /* .members */ - }, - - /* RedundantServerDataType */ - { - UA_TYPENAME("RedundantServerDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {853}}, /* .typeId */ - sizeof(UA_RedundantServerDataType), /* .memSize */ - UA_TYPES_REDUNDANTSERVERDATATYPE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 855, /* .binaryEncodingId */ - RedundantServerDataType_members /* .members */ - }, - - /* EndpointUrlListDataType */ - { - UA_TYPENAME("EndpointUrlListDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {11943}}, /* .typeId */ - sizeof(UA_EndpointUrlListDataType), /* .memSize */ - UA_TYPES_ENDPOINTURLLISTDATATYPE, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 11957, /* .binaryEncodingId */ - EndpointUrlListDataType_members /* .members */ - }, - - /* NetworkGroupDataType */ - { - UA_TYPENAME("NetworkGroupDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {11944}}, /* .typeId */ - sizeof(UA_NetworkGroupDataType), /* .memSize */ - UA_TYPES_NETWORKGROUPDATATYPE, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 11958, /* .binaryEncodingId */ - NetworkGroupDataType_members /* .members */ - }, - - /* ServerDiagnosticsSummaryDataType */ - { - UA_TYPENAME("ServerDiagnosticsSummaryDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {859}}, /* .typeId */ - sizeof(UA_ServerDiagnosticsSummaryDataType), /* .memSize */ - UA_TYPES_SERVERDIAGNOSTICSSUMMARYDATATYPE, /* .typeIndex */ - 12, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && - UA_BINARY_OVERLAYABLE_INTEGER &&UA_BINARY_OVERLAYABLE_INTEGER &&offsetof( - UA_ServerDiagnosticsSummaryDataType, currentSessionCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, serverViewCount) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServerDiagnosticsSummaryDataType, cumulatedSessionCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, currentSessionCount) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServerDiagnosticsSummaryDataType, - securityRejectedSessionCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, cumulatedSessionCount) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServerDiagnosticsSummaryDataType, rejectedSessionCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, securityRejectedSessionCount) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServerDiagnosticsSummaryDataType, sessionTimeoutCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, rejectedSessionCount) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServerDiagnosticsSummaryDataType, sessionAbortCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, sessionTimeoutCount) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServerDiagnosticsSummaryDataType, currentSubscriptionCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, sessionAbortCount) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServerDiagnosticsSummaryDataType, cumulatedSubscriptionCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, currentSubscriptionCount) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServerDiagnosticsSummaryDataType, publishingIntervalCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, cumulatedSubscriptionCount) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServerDiagnosticsSummaryDataType, - securityRejectedRequestsCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, publishingIntervalCount) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServerDiagnosticsSummaryDataType, rejectedRequestsCount) == - (offsetof(UA_ServerDiagnosticsSummaryDataType, securityRejectedRequestsCount) + - sizeof(UA_UInt32)), /* .overlayable */ - 861, /* .binaryEncodingId */ - ServerDiagnosticsSummaryDataType_members /* .members */ - }, - - /* ServerStatusDataType */ - { - UA_TYPENAME("ServerStatusDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {862}}, /* .typeId */ - sizeof(UA_ServerStatusDataType), /* .memSize */ - UA_TYPES_SERVERSTATUSDATATYPE, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 864, /* .binaryEncodingId */ - ServerStatusDataType_members /* .members */ - }, - - /* SessionSecurityDiagnosticsDataType */ - { - UA_TYPENAME("SessionSecurityDiagnosticsDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {868}}, /* .typeId */ - sizeof(UA_SessionSecurityDiagnosticsDataType), /* .memSize */ - UA_TYPES_SESSIONSECURITYDIAGNOSTICSDATATYPE, /* .typeIndex */ - 9, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 870, /* .binaryEncodingId */ - SessionSecurityDiagnosticsDataType_members /* .members */ - }, - - /* ServiceCounterDataType */ - { - UA_TYPENAME("ServiceCounterDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {871}}, /* .typeId */ - sizeof(UA_ServiceCounterDataType), /* .memSize */ - UA_TYPES_SERVICECOUNTERDATATYPE, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && - UA_BINARY_OVERLAYABLE_INTEGER &&UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_ServiceCounterDataType, - errorCount) == - (offsetof(UA_ServiceCounterDataType, totalCount) + sizeof(UA_UInt32)), /* .overlayable */ - 873, /* .binaryEncodingId */ - ServiceCounterDataType_members /* .members */ - }, - - /* SubscriptionDiagnosticsDataType */ - { - UA_TYPENAME("SubscriptionDiagnosticsDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {874}}, /* .typeId */ - sizeof(UA_SubscriptionDiagnosticsDataType), /* .memSize */ - UA_TYPES_SUBSCRIPTIONDIAGNOSTICSDATATYPE, /* .typeIndex */ - 31, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 876, /* .binaryEncodingId */ - SubscriptionDiagnosticsDataType_members /* .members */ - }, - - /* ModelChangeStructureDataType */ - { - UA_TYPENAME("ModelChangeStructureDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {877}}, /* .typeId */ - sizeof(UA_ModelChangeStructureDataType), /* .memSize */ - UA_TYPES_MODELCHANGESTRUCTUREDATATYPE, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 879, /* .binaryEncodingId */ - ModelChangeStructureDataType_members /* .members */ - }, - - /* SemanticChangeStructureDataType */ - { - UA_TYPENAME("SemanticChangeStructureDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {897}}, /* .typeId */ - sizeof(UA_SemanticChangeStructureDataType), /* .memSize */ - UA_TYPES_SEMANTICCHANGESTRUCTUREDATATYPE, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 899, /* .binaryEncodingId */ - SemanticChangeStructureDataType_members /* .members */ - }, - - /* DataChangeNotification */ - { - UA_TYPENAME("DataChangeNotification") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {809}}, /* .typeId */ - sizeof(UA_DataChangeNotification), /* .memSize */ - UA_TYPES_DATACHANGENOTIFICATION, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 811, /* .binaryEncodingId */ - DataChangeNotification_members /* .members */ - }, - - /* EventNotificationList */ - { - UA_TYPENAME("EventNotificationList") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {914}}, /* .typeId */ - sizeof(UA_EventNotificationList), /* .memSize */ - UA_TYPES_EVENTNOTIFICATIONLIST, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 916, /* .binaryEncodingId */ - EventNotificationList_members /* .members */ - }, - - /* SessionDiagnosticsDataType */ - { - UA_TYPENAME("SessionDiagnosticsDataType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {865}}, /* .typeId */ - sizeof(UA_SessionDiagnosticsDataType), /* .memSize */ - UA_TYPES_SESSIONDIAGNOSTICSDATATYPE, /* .typeIndex */ - 43, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 867, /* .binaryEncodingId */ - SessionDiagnosticsDataType_members /* .members */ - }, -}; - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_transport_generated.c" - * ***********************************/ - -/* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script - * /home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/tools/generate_datatypes.py - * on host nmpc by user max at 2018-01-05 04:21:09 */ - -/* MessageType */ -static UA_DataTypeMember MessageType_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* ChunkType */ -static UA_DataTypeMember ChunkType_members[1] = { - { - UA_TYPENAME("") /* .memberName */ - UA_TYPES_INT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* TcpMessageHeader */ -static UA_DataTypeMember TcpMessageHeader_members[2] = { - { - UA_TYPENAME("messageTypeAndChunkType") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("messageSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_TcpMessageHeader, messageSize) - offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* TcpHelloMessage */ -static UA_DataTypeMember TcpHelloMessage_members[6] = { - { - UA_TYPENAME("protocolVersion") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("receiveBufferSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_TcpHelloMessage, receiveBufferSize) - offsetof(UA_TcpHelloMessage, protocolVersion) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("sendBufferSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_TcpHelloMessage, sendBufferSize) - offsetof(UA_TcpHelloMessage, receiveBufferSize) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxMessageSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_TcpHelloMessage, maxMessageSize) - offsetof(UA_TcpHelloMessage, sendBufferSize) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxChunkCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_TcpHelloMessage, maxChunkCount) - offsetof(UA_TcpHelloMessage, maxMessageSize) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("endpointUrl") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_TcpHelloMessage, endpointUrl) - offsetof(UA_TcpHelloMessage, maxChunkCount) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* TcpAcknowledgeMessage */ -static UA_DataTypeMember TcpAcknowledgeMessage_members[5] = { - { - UA_TYPENAME("protocolVersion") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("receiveBufferSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) - offsetof(UA_TcpAcknowledgeMessage, protocolVersion) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("sendBufferSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) - offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxMessageSize") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) - offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("maxChunkCount") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_TcpAcknowledgeMessage, maxChunkCount) - offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* TcpErrorMessage */ -static UA_DataTypeMember TcpErrorMessage_members[2] = { - { - UA_TYPENAME("error") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("reason") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_TcpErrorMessage, reason) - offsetof(UA_TcpErrorMessage, error) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SecureConversationMessageHeader */ -static UA_DataTypeMember SecureConversationMessageHeader_members[2] = { - { - UA_TYPENAME("messageHeader") /* .memberName */ - UA_TRANSPORT_TCPMESSAGEHEADER, /* .memberTypeIndex */ - 0, /* .padding */ - false, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("secureChannelId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SecureConversationMessageHeader, secureChannelId) - - offsetof(UA_SecureConversationMessageHeader, messageHeader) - sizeof(UA_TcpMessageHeader), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* AsymmetricAlgorithmSecurityHeader */ -static UA_DataTypeMember AsymmetricAlgorithmSecurityHeader_members[3] = { - { - UA_TYPENAME("securityPolicyUri") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("senderCertificate") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_AsymmetricAlgorithmSecurityHeader, senderCertificate) - - offsetof(UA_AsymmetricAlgorithmSecurityHeader, securityPolicyUri) - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("receiverCertificateThumbprint") /* .memberName */ - UA_TYPES_BYTESTRING, /* .memberTypeIndex */ - offsetof(UA_AsymmetricAlgorithmSecurityHeader, receiverCertificateThumbprint) - - offsetof(UA_AsymmetricAlgorithmSecurityHeader, senderCertificate) - sizeof(UA_ByteString), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SymmetricAlgorithmSecurityHeader */ -static UA_DataTypeMember SymmetricAlgorithmSecurityHeader_members[1] = { - { - UA_TYPENAME("tokenId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SequenceHeader */ -static UA_DataTypeMember SequenceHeader_members[2] = { - { - UA_TYPENAME("sequenceNumber") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("requestId") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - offsetof(UA_SequenceHeader, requestId) - offsetof(UA_SequenceHeader, sequenceNumber) - - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SecureConversationMessageFooter */ -static UA_DataTypeMember SecureConversationMessageFooter_members[2] = { - { - UA_TYPENAME("padding") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - true /* .isArray */ - }, - { - UA_TYPENAME("signature") /* .memberName */ - UA_TYPES_BYTE, /* .memberTypeIndex */ - offsetof(UA_SecureConversationMessageFooter, signature) - - offsetof(UA_SecureConversationMessageFooter, padding) - sizeof(void *), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; - -/* SecureConversationMessageAbortBody */ -static UA_DataTypeMember SecureConversationMessageAbortBody_members[2] = { - { - UA_TYPENAME("error") /* .memberName */ - UA_TYPES_UINT32, /* .memberTypeIndex */ - 0, /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, - { - UA_TYPENAME("reason") /* .memberName */ - UA_TYPES_STRING, /* .memberTypeIndex */ - offsetof(UA_SecureConversationMessageAbortBody, reason) - - offsetof(UA_SecureConversationMessageAbortBody, error) - sizeof(UA_UInt32), /* .padding */ - true, /* .namespaceZero */ - false /* .isArray */ - }, -}; -const UA_DataType UA_TRANSPORT[UA_TRANSPORT_COUNT] = { - - /* MessageType */ - { - UA_TYPENAME("MessageType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_MessageType), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - MessageType_members /* .members */ - }, - - /* ChunkType */ - { - UA_TYPENAME("ChunkType") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_ChunkType), /* .memSize */ - UA_TYPES_INT32, /* .typeIndex */ - 1, /* .membersSize */ - true, /* .builtin */ - true, /* .pointerFree */ - UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - ChunkType_members /* .members */ - }, - - /* TcpMessageHeader */ - { - UA_TYPENAME("TcpMessageHeader") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_TcpMessageHeader), /* .memSize */ - UA_TRANSPORT_TCPMESSAGEHEADER, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && - UA_BINARY_OVERLAYABLE_INTEGER &&UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_TcpMessageHeader, - messageSize) == - (offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) + sizeof(UA_UInt32)), /* .overlayable */ - 0, /* .binaryEncodingId */ - TcpMessageHeader_members /* .members */ - }, - - /* TcpHelloMessage */ - { - UA_TYPENAME("TcpHelloMessage") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_TcpHelloMessage), /* .memSize */ - UA_TRANSPORT_TCPHELLOMESSAGE, /* .typeIndex */ - 6, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - TcpHelloMessage_members /* .members */ - }, - - /* TcpAcknowledgeMessage */ - { - UA_TYPENAME("TcpAcknowledgeMessage") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_TcpAcknowledgeMessage), /* .memSize */ - UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE, /* .typeIndex */ - 5, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && - UA_BINARY_OVERLAYABLE_INTEGER &&UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_TcpAcknowledgeMessage, - receiveBufferSize) == - (offsetof(UA_TcpAcknowledgeMessage, protocolVersion) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) == - (offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) == - (offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_TcpAcknowledgeMessage, maxChunkCount) == - (offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) + sizeof(UA_UInt32)), /* .overlayable */ - 0, /* .binaryEncodingId */ - TcpAcknowledgeMessage_members /* .members */ - }, - - /* TcpErrorMessage */ - { - UA_TYPENAME("TcpErrorMessage") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_TcpErrorMessage), /* .memSize */ - UA_TRANSPORT_TCPERRORMESSAGE, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - TcpErrorMessage_members /* .members */ - }, - - /* SecureConversationMessageHeader */ - { - UA_TYPENAME("SecureConversationMessageHeader") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_SecureConversationMessageHeader), /* .memSize */ - UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && true && - UA_BINARY_OVERLAYABLE_INTEGER &&UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_TcpMessageHeader, - messageSize) == - (offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) + sizeof(UA_UInt32)) && - UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_SecureConversationMessageHeader, secureChannelId) == - (offsetof(UA_SecureConversationMessageHeader, messageHeader) + - sizeof(UA_TcpMessageHeader)), /* .overlayable */ - 0, /* .binaryEncodingId */ - SecureConversationMessageHeader_members /* .members */ - }, - - /* AsymmetricAlgorithmSecurityHeader */ - { - UA_TYPENAME("AsymmetricAlgorithmSecurityHeader") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_AsymmetricAlgorithmSecurityHeader), /* .memSize */ - UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER, /* .typeIndex */ - 3, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - AsymmetricAlgorithmSecurityHeader_members /* .members */ - }, - - /* SymmetricAlgorithmSecurityHeader */ - { - UA_TYPENAME("SymmetricAlgorithmSecurityHeader") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_SymmetricAlgorithmSecurityHeader), /* .memSize */ - UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER, /* .typeIndex */ - 1, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && UA_BINARY_OVERLAYABLE_INTEGER, /* .overlayable */ - 0, /* .binaryEncodingId */ - SymmetricAlgorithmSecurityHeader_members /* .members */ - }, - - /* SequenceHeader */ - { - UA_TYPENAME("SequenceHeader") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_SequenceHeader), /* .memSize */ - UA_TRANSPORT_SEQUENCEHEADER, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - true, /* .pointerFree */ - true && - UA_BINARY_OVERLAYABLE_INTEGER &&UA_BINARY_OVERLAYABLE_INTEGER &&offsetof(UA_SequenceHeader, requestId) == - (offsetof(UA_SequenceHeader, sequenceNumber) + sizeof(UA_UInt32)), /* .overlayable */ - 0, /* .binaryEncodingId */ - SequenceHeader_members /* .members */ - }, - - /* SecureConversationMessageFooter */ - { - UA_TYPENAME("SecureConversationMessageFooter") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_SecureConversationMessageFooter), /* .memSize */ - UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - SecureConversationMessageFooter_members /* .members */ - }, - - /* SecureConversationMessageAbortBody */ - { - UA_TYPENAME("SecureConversationMessageAbortBody") /* .typeName */ - {0, UA_NODEIDTYPE_NUMERIC, {0}}, /* .typeId */ - sizeof(UA_SecureConversationMessageAbortBody), /* .memSize */ - UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY, /* .typeIndex */ - 2, /* .membersSize */ - false, /* .builtin */ - false, /* .pointerFree */ - false, /* .overlayable */ - 0, /* .binaryEncodingId */ - SecureConversationMessageAbortBody_members /* .members */ - }, -}; - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_statuscode_descriptions.c" - * ***********************************/ - -/********************************************************** - * Autogenerated -- do not modify - * Generated from /home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/tools/schema/Opc.Ua.StatusCodes.csv - *with script /home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/tools/generate_statuscode_descriptions.py - *********************************************************/ - -/* Definition for the deprecated StatusCode description API */ -const UA_StatusCodeDescription statusCodeExplanation_default = {0xffffffff, "", ""}; - -typedef struct { - UA_StatusCode code; - const char *name; -} UA_StatusCodeName; - -#ifndef UA_ENABLE_STATUSCODE_DESCRIPTIONS -static const char *emptyStatusCodeName = ""; -const char *UA_StatusCode_name(UA_StatusCode code) { return emptyStatusCodeName; } -#else -static const size_t statusCodeDescriptionsSize = 229; -static const UA_StatusCodeName statusCodeDescriptions[229] = { - {UA_STATUSCODE_GOOD, "Good"}, - - { - UA_STATUSCODE_BADUNEXPECTEDERROR, "BadUnexpectedError", - }, - { - UA_STATUSCODE_BADINTERNALERROR, "BadInternalError", - }, - { - UA_STATUSCODE_BADOUTOFMEMORY, "BadOutOfMemory", - }, - { - UA_STATUSCODE_BADRESOURCEUNAVAILABLE, "BadResourceUnavailable", - }, - { - UA_STATUSCODE_BADCOMMUNICATIONERROR, "BadCommunicationError", - }, - { - UA_STATUSCODE_BADENCODINGERROR, "BadEncodingError", - }, - { - UA_STATUSCODE_BADDECODINGERROR, "BadDecodingError", - }, - { - UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, "BadEncodingLimitsExceeded", - }, - { - UA_STATUSCODE_BADREQUESTTOOLARGE, "BadRequestTooLarge", - }, - { - UA_STATUSCODE_BADRESPONSETOOLARGE, "BadResponseTooLarge", - }, - { - UA_STATUSCODE_BADUNKNOWNRESPONSE, "BadUnknownResponse", - }, - { - UA_STATUSCODE_BADTIMEOUT, "BadTimeout", - }, - { - UA_STATUSCODE_BADSERVICEUNSUPPORTED, "BadServiceUnsupported", - }, - { - UA_STATUSCODE_BADSHUTDOWN, "BadShutdown", - }, - { - UA_STATUSCODE_BADSERVERNOTCONNECTED, "BadServerNotConnected", - }, - { - UA_STATUSCODE_BADSERVERHALTED, "BadServerHalted", - }, - { - UA_STATUSCODE_BADNOTHINGTODO, "BadNothingToDo", - }, - { - UA_STATUSCODE_BADTOOMANYOPERATIONS, "BadTooManyOperations", - }, - { - UA_STATUSCODE_BADTOOMANYMONITOREDITEMS, "BadTooManyMonitoredItems", - }, - { - UA_STATUSCODE_BADDATATYPEIDUNKNOWN, "BadDataTypeIdUnknown", - }, - { - UA_STATUSCODE_BADCERTIFICATEINVALID, "BadCertificateInvalid", - }, - { - UA_STATUSCODE_BADSECURITYCHECKSFAILED, "BadSecurityChecksFailed", - }, - { - UA_STATUSCODE_BADCERTIFICATETIMEINVALID, "BadCertificateTimeInvalid", - }, - { - UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID, "BadCertificateIssuerTimeInvalid", - }, - { - UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID, "BadCertificateHostNameInvalid", - }, - { - UA_STATUSCODE_BADCERTIFICATEURIINVALID, "BadCertificateUriInvalid", - }, - { - UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED, "BadCertificateUseNotAllowed", - }, - { - UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED, "BadCertificateIssuerUseNotAllowed", - }, - { - UA_STATUSCODE_BADCERTIFICATEUNTRUSTED, "BadCertificateUntrusted", - }, - { - UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN, "BadCertificateRevocationUnknown", - }, - { - UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN, "BadCertificateIssuerRevocationUnknown", - }, - { - UA_STATUSCODE_BADCERTIFICATEREVOKED, "BadCertificateRevoked", - }, - { - UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED, "BadCertificateIssuerRevoked", - }, - { - UA_STATUSCODE_BADCERTIFICATECHAININCOMPLETE, "BadCertificateChainIncomplete", - }, - { - UA_STATUSCODE_BADUSERACCESSDENIED, "BadUserAccessDenied", - }, - { - UA_STATUSCODE_BADIDENTITYTOKENINVALID, "BadIdentityTokenInvalid", - }, - { - UA_STATUSCODE_BADIDENTITYTOKENREJECTED, "BadIdentityTokenRejected", - }, - { - UA_STATUSCODE_BADSECURECHANNELIDINVALID, "BadSecureChannelIdInvalid", - }, - { - UA_STATUSCODE_BADINVALIDTIMESTAMP, "BadInvalidTimestamp", - }, - { - UA_STATUSCODE_BADNONCEINVALID, "BadNonceInvalid", - }, - { - UA_STATUSCODE_BADSESSIONIDINVALID, "BadSessionIdInvalid", - }, - { - UA_STATUSCODE_BADSESSIONCLOSED, "BadSessionClosed", - }, - { - UA_STATUSCODE_BADSESSIONNOTACTIVATED, "BadSessionNotActivated", - }, - { - UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID, "BadSubscriptionIdInvalid", - }, - { - UA_STATUSCODE_BADREQUESTHEADERINVALID, "BadRequestHeaderInvalid", - }, - { - UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID, "BadTimestampsToReturnInvalid", - }, - { - UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT, "BadRequestCancelledByClient", - }, - { - UA_STATUSCODE_BADTOOMANYARGUMENTS, "BadTooManyArguments", - }, - { - UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED, "GoodSubscriptionTransferred", - }, - { - UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY, "GoodCompletesAsynchronously", - }, - { - UA_STATUSCODE_GOODOVERLOAD, "GoodOverload", - }, - { - UA_STATUSCODE_GOODCLAMPED, "GoodClamped", - }, - { - UA_STATUSCODE_BADNOCOMMUNICATION, "BadNoCommunication", - }, - { - UA_STATUSCODE_BADWAITINGFORINITIALDATA, "BadWaitingForInitialData", - }, - { - UA_STATUSCODE_BADNODEIDINVALID, "BadNodeIdInvalid", - }, - { - UA_STATUSCODE_BADNODEIDUNKNOWN, "BadNodeIdUnknown", - }, - { - UA_STATUSCODE_BADATTRIBUTEIDINVALID, "BadAttributeIdInvalid", - }, - { - UA_STATUSCODE_BADINDEXRANGEINVALID, "BadIndexRangeInvalid", - }, - { - UA_STATUSCODE_BADINDEXRANGENODATA, "BadIndexRangeNoData", - }, - { - UA_STATUSCODE_BADDATAENCODINGINVALID, "BadDataEncodingInvalid", - }, - { - UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED, "BadDataEncodingUnsupported", - }, - { - UA_STATUSCODE_BADNOTREADABLE, "BadNotReadable", - }, - { - UA_STATUSCODE_BADNOTWRITABLE, "BadNotWritable", - }, - { - UA_STATUSCODE_BADOUTOFRANGE, "BadOutOfRange", - }, - { - UA_STATUSCODE_BADNOTSUPPORTED, "BadNotSupported", - }, - { - UA_STATUSCODE_BADNOTFOUND, "BadNotFound", - }, - { - UA_STATUSCODE_BADOBJECTDELETED, "BadObjectDeleted", - }, - { - UA_STATUSCODE_BADNOTIMPLEMENTED, "BadNotImplemented", - }, - { - UA_STATUSCODE_BADMONITORINGMODEINVALID, "BadMonitoringModeInvalid", - }, - { - UA_STATUSCODE_BADMONITOREDITEMIDINVALID, "BadMonitoredItemIdInvalid", - }, - { - UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID, "BadMonitoredItemFilterInvalid", - }, - { - UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED, "BadMonitoredItemFilterUnsupported", - }, - { - UA_STATUSCODE_BADFILTERNOTALLOWED, "BadFilterNotAllowed", - }, - { - UA_STATUSCODE_BADSTRUCTUREMISSING, "BadStructureMissing", - }, - { - UA_STATUSCODE_BADEVENTFILTERINVALID, "BadEventFilterInvalid", - }, - { - UA_STATUSCODE_BADCONTENTFILTERINVALID, "BadContentFilterInvalid", - }, - { - UA_STATUSCODE_BADFILTEROPERATORINVALID, "BadFilterOperatorInvalid", - }, - { - UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED, "BadFilterOperatorUnsupported", - }, - { - UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH, "BadFilterOperandCountMismatch", - }, - { - UA_STATUSCODE_BADFILTEROPERANDINVALID, "BadFilterOperandInvalid", - }, - { - UA_STATUSCODE_BADFILTERELEMENTINVALID, "BadFilterElementInvalid", - }, - { - UA_STATUSCODE_BADFILTERLITERALINVALID, "BadFilterLiteralInvalid", - }, - { - UA_STATUSCODE_BADCONTINUATIONPOINTINVALID, "BadContinuationPointInvalid", - }, - { - UA_STATUSCODE_BADNOCONTINUATIONPOINTS, "BadNoContinuationPoints", - }, - { - UA_STATUSCODE_BADREFERENCETYPEIDINVALID, "BadReferenceTypeIdInvalid", - }, - { - UA_STATUSCODE_BADBROWSEDIRECTIONINVALID, "BadBrowseDirectionInvalid", - }, - { - UA_STATUSCODE_BADNODENOTINVIEW, "BadNodeNotInView", - }, - { - UA_STATUSCODE_BADSERVERURIINVALID, "BadServerUriInvalid", - }, - { - UA_STATUSCODE_BADSERVERNAMEMISSING, "BadServerNameMissing", - }, - { - UA_STATUSCODE_BADDISCOVERYURLMISSING, "BadDiscoveryUrlMissing", - }, - { - UA_STATUSCODE_BADSEMPAHOREFILEMISSING, "BadSempahoreFileMissing", - }, - { - UA_STATUSCODE_BADREQUESTTYPEINVALID, "BadRequestTypeInvalid", - }, - { - UA_STATUSCODE_BADSECURITYMODEREJECTED, "BadSecurityModeRejected", - }, - { - UA_STATUSCODE_BADSECURITYPOLICYREJECTED, "BadSecurityPolicyRejected", - }, - { - UA_STATUSCODE_BADTOOMANYSESSIONS, "BadTooManySessions", - }, - { - UA_STATUSCODE_BADUSERSIGNATUREINVALID, "BadUserSignatureInvalid", - }, - { - UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID, "BadApplicationSignatureInvalid", - }, - { - UA_STATUSCODE_BADNOVALIDCERTIFICATES, "BadNoValidCertificates", - }, - { - UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED, "BadIdentityChangeNotSupported", - }, - { - UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST, "BadRequestCancelledByRequest", - }, - { - UA_STATUSCODE_BADPARENTNODEIDINVALID, "BadParentNodeIdInvalid", - }, - { - UA_STATUSCODE_BADREFERENCENOTALLOWED, "BadReferenceNotAllowed", - }, - { - UA_STATUSCODE_BADNODEIDREJECTED, "BadNodeIdRejected", - }, - { - UA_STATUSCODE_BADNODEIDEXISTS, "BadNodeIdExists", - }, - { - UA_STATUSCODE_BADNODECLASSINVALID, "BadNodeClassInvalid", - }, - { - UA_STATUSCODE_BADBROWSENAMEINVALID, "BadBrowseNameInvalid", - }, - { - UA_STATUSCODE_BADBROWSENAMEDUPLICATED, "BadBrowseNameDuplicated", - }, - { - UA_STATUSCODE_BADNODEATTRIBUTESINVALID, "BadNodeAttributesInvalid", - }, - { - UA_STATUSCODE_BADTYPEDEFINITIONINVALID, "BadTypeDefinitionInvalid", - }, - { - UA_STATUSCODE_BADSOURCENODEIDINVALID, "BadSourceNodeIdInvalid", - }, - { - UA_STATUSCODE_BADTARGETNODEIDINVALID, "BadTargetNodeIdInvalid", - }, - { - UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED, "BadDuplicateReferenceNotAllowed", - }, - { - UA_STATUSCODE_BADINVALIDSELFREFERENCE, "BadInvalidSelfReference", - }, - { - UA_STATUSCODE_BADREFERENCELOCALONLY, "BadReferenceLocalOnly", - }, - { - UA_STATUSCODE_BADNODELETERIGHTS, "BadNoDeleteRights", - }, - { - UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED, "UncertainReferenceNotDeleted", - }, - { - UA_STATUSCODE_BADSERVERINDEXINVALID, "BadServerIndexInvalid", - }, - { - UA_STATUSCODE_BADVIEWIDUNKNOWN, "BadViewIdUnknown", - }, - { - UA_STATUSCODE_BADVIEWTIMESTAMPINVALID, "BadViewTimestampInvalid", - }, - { - UA_STATUSCODE_BADVIEWPARAMETERMISMATCH, "BadViewParameterMismatch", - }, - { - UA_STATUSCODE_BADVIEWVERSIONINVALID, "BadViewVersionInvalid", - }, - { - UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE, "UncertainNotAllNodesAvailable", - }, - { - UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE, "GoodResultsMayBeIncomplete", - }, - { - UA_STATUSCODE_BADNOTTYPEDEFINITION, "BadNotTypeDefinition", - }, - { - UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER, "UncertainReferenceOutOfServer", - }, - { - UA_STATUSCODE_BADTOOMANYMATCHES, "BadTooManyMatches", - }, - { - UA_STATUSCODE_BADQUERYTOOCOMPLEX, "BadQueryTooComplex", - }, - { - UA_STATUSCODE_BADNOMATCH, "BadNoMatch", - }, - { - UA_STATUSCODE_BADMAXAGEINVALID, "BadMaxAgeInvalid", - }, - { - UA_STATUSCODE_BADSECURITYMODEINSUFFICIENT, "BadSecurityModeInsufficient", - }, - { - UA_STATUSCODE_BADHISTORYOPERATIONINVALID, "BadHistoryOperationInvalid", - }, - { - UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED, "BadHistoryOperationUnsupported", - }, - { - UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT, "BadInvalidTimestampArgument", - }, - { - UA_STATUSCODE_BADWRITENOTSUPPORTED, "BadWriteNotSupported", - }, - { - UA_STATUSCODE_BADTYPEMISMATCH, "BadTypeMismatch", - }, - { - UA_STATUSCODE_BADMETHODINVALID, "BadMethodInvalid", - }, - { - UA_STATUSCODE_BADARGUMENTSMISSING, "BadArgumentsMissing", - }, - { - UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS, "BadTooManySubscriptions", - }, - { - UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS, "BadTooManyPublishRequests", - }, - { - UA_STATUSCODE_BADNOSUBSCRIPTION, "BadNoSubscription", - }, - { - UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN, "BadSequenceNumberUnknown", - }, - { - UA_STATUSCODE_BADMESSAGENOTAVAILABLE, "BadMessageNotAvailable", - }, - { - UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE, "BadInsufficientClientProfile", - }, - { - UA_STATUSCODE_BADSTATENOTACTIVE, "BadStateNotActive", - }, - { - UA_STATUSCODE_BADTCPSERVERTOOBUSY, "BadTcpServerTooBusy", - }, - { - UA_STATUSCODE_BADTCPMESSAGETYPEINVALID, "BadTcpMessageTypeInvalid", - }, - { - UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN, "BadTcpSecureChannelUnknown", - }, - { - UA_STATUSCODE_BADTCPMESSAGETOOLARGE, "BadTcpMessageTooLarge", - }, - { - UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES, "BadTcpNotEnoughResources", - }, - { - UA_STATUSCODE_BADTCPINTERNALERROR, "BadTcpInternalError", - }, - { - UA_STATUSCODE_BADTCPENDPOINTURLINVALID, "BadTcpEndpointUrlInvalid", - }, - { - UA_STATUSCODE_BADREQUESTINTERRUPTED, "BadRequestInterrupted", - }, - { - UA_STATUSCODE_BADREQUESTTIMEOUT, "BadRequestTimeout", - }, - { - UA_STATUSCODE_BADSECURECHANNELCLOSED, "BadSecureChannelClosed", - }, - { - UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN, "BadSecureChannelTokenUnknown", - }, - { - UA_STATUSCODE_BADSEQUENCENUMBERINVALID, "BadSequenceNumberInvalid", - }, - { - UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED, "BadProtocolVersionUnsupported", - }, - { - UA_STATUSCODE_BADCONFIGURATIONERROR, "BadConfigurationError", - }, - { - UA_STATUSCODE_BADNOTCONNECTED, "BadNotConnected", - }, - { - UA_STATUSCODE_BADDEVICEFAILURE, "BadDeviceFailure", - }, - { - UA_STATUSCODE_BADSENSORFAILURE, "BadSensorFailure", - }, - { - UA_STATUSCODE_BADOUTOFSERVICE, "BadOutOfService", - }, - { - UA_STATUSCODE_BADDEADBANDFILTERINVALID, "BadDeadbandFilterInvalid", - }, - { - UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE, "UncertainNoCommunicationLastUsableValue", - }, - { - UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE, "UncertainLastUsableValue", - }, - { - UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE, "UncertainSubstituteValue", - }, - { - UA_STATUSCODE_UNCERTAININITIALVALUE, "UncertainInitialValue", - }, - { - UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE, "UncertainSensorNotAccurate", - }, - { - UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED, "UncertainEngineeringUnitsExceeded", - }, - { - UA_STATUSCODE_UNCERTAINSUBNORMAL, "UncertainSubNormal", - }, - { - UA_STATUSCODE_GOODLOCALOVERRIDE, "GoodLocalOverride", - }, - { - UA_STATUSCODE_BADREFRESHINPROGRESS, "BadRefreshInProgress", - }, - { - UA_STATUSCODE_BADCONDITIONALREADYDISABLED, "BadConditionAlreadyDisabled", - }, - { - UA_STATUSCODE_BADCONDITIONALREADYENABLED, "BadConditionAlreadyEnabled", - }, - { - UA_STATUSCODE_BADCONDITIONDISABLED, "BadConditionDisabled", - }, - { - UA_STATUSCODE_BADEVENTIDUNKNOWN, "BadEventIdUnknown", - }, - { - UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE, "BadEventNotAcknowledgeable", - }, - { - UA_STATUSCODE_BADDIALOGNOTACTIVE, "BadDialogNotActive", - }, - { - UA_STATUSCODE_BADDIALOGRESPONSEINVALID, "BadDialogResponseInvalid", - }, - { - UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED, "BadConditionBranchAlreadyAcked", - }, - { - UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED, "BadConditionBranchAlreadyConfirmed", - }, - { - UA_STATUSCODE_BADCONDITIONALREADYSHELVED, "BadConditionAlreadyShelved", - }, - { - UA_STATUSCODE_BADCONDITIONNOTSHELVED, "BadConditionNotShelved", - }, - { - UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE, "BadShelvingTimeOutOfRange", - }, - { - UA_STATUSCODE_BADNODATA, "BadNoData", - }, - { - UA_STATUSCODE_BADBOUNDNOTFOUND, "BadBoundNotFound", - }, - { - UA_STATUSCODE_BADBOUNDNOTSUPPORTED, "BadBoundNotSupported", - }, - { - UA_STATUSCODE_BADDATALOST, "BadDataLost", - }, - { - UA_STATUSCODE_BADDATAUNAVAILABLE, "BadDataUnavailable", - }, - { - UA_STATUSCODE_BADENTRYEXISTS, "BadEntryExists", - }, - { - UA_STATUSCODE_BADNOENTRYEXISTS, "BadNoEntryExists", - }, - { - UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED, "BadTimestampNotSupported", - }, - { - UA_STATUSCODE_GOODENTRYINSERTED, "GoodEntryInserted", - }, - { - UA_STATUSCODE_GOODENTRYREPLACED, "GoodEntryReplaced", - }, - { - UA_STATUSCODE_UNCERTAINDATASUBNORMAL, "UncertainDataSubNormal", - }, - { - UA_STATUSCODE_GOODNODATA, "GoodNoData", - }, - { - UA_STATUSCODE_GOODMOREDATA, "GoodMoreData", - }, - { - UA_STATUSCODE_BADAGGREGATELISTMISMATCH, "BadAggregateListMismatch", - }, - { - UA_STATUSCODE_BADAGGREGATENOTSUPPORTED, "BadAggregateNotSupported", - }, - { - UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS, "BadAggregateInvalidInputs", - }, - { - UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED, "BadAggregateConfigurationRejected", - }, - { - UA_STATUSCODE_GOODDATAIGNORED, "GoodDataIgnored", - }, - { - UA_STATUSCODE_BADREQUESTNOTALLOWED, "BadRequestNotAllowed", - }, - { - UA_STATUSCODE_GOODEDITED, "GoodEdited", - }, - { - UA_STATUSCODE_GOODPOSTACTIONFAILED, "GoodPostActionFailed", - }, - { - UA_STATUSCODE_UNCERTAINDOMINANTVALUECHANGED, "UncertainDominantValueChanged", - }, - { - UA_STATUSCODE_GOODDEPENDENTVALUECHANGED, "GoodDependentValueChanged", - }, - { - UA_STATUSCODE_BADDOMINANTVALUECHANGED, "BadDominantValueChanged", - }, - { - UA_STATUSCODE_UNCERTAINDEPENDENTVALUECHANGED, "UncertainDependentValueChanged", - }, - { - UA_STATUSCODE_BADDEPENDENTVALUECHANGED, "BadDependentValueChanged", - }, - { - UA_STATUSCODE_GOODCOMMUNICATIONEVENT, "GoodCommunicationEvent", - }, - { - UA_STATUSCODE_GOODSHUTDOWNEVENT, "GoodShutdownEvent", - }, - { - UA_STATUSCODE_GOODCALLAGAIN, "GoodCallAgain", - }, - { - UA_STATUSCODE_GOODNONCRITICALTIMEOUT, "GoodNonCriticalTimeout", - }, - { - UA_STATUSCODE_BADINVALIDARGUMENT, "BadInvalidArgument", - }, - { - UA_STATUSCODE_BADCONNECTIONREJECTED, "BadConnectionRejected", - }, - { - UA_STATUSCODE_BADDISCONNECT, "BadDisconnect", - }, - { - UA_STATUSCODE_BADCONNECTIONCLOSED, "BadConnectionClosed", - }, - { - UA_STATUSCODE_BADINVALIDSTATE, "BadInvalidState", - }, - { - UA_STATUSCODE_BADENDOFSTREAM, "BadEndOfStream", - }, - { - UA_STATUSCODE_BADNODATAAVAILABLE, "BadNoDataAvailable", - }, - { - UA_STATUSCODE_BADWAITINGFORRESPONSE, "BadWaitingForResponse", - }, - { - UA_STATUSCODE_BADOPERATIONABANDONED, "BadOperationAbandoned", - }, - { - UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK, "BadExpectedStreamToBlock", - }, - { - UA_STATUSCODE_BADWOULDBLOCK, "BadWouldBlock", - }, - { - UA_STATUSCODE_BADSYNTAXERROR, "BadSyntaxError", - }, - { - UA_STATUSCODE_BADMAXCONNECTIONSREACHED, "BadMaxConnectionsReached", - }, - {0xffffffff, "Unknown StatusCode"}}; - -const char *UA_StatusCode_name(UA_StatusCode code) { - for (size_t i = 0; i < statusCodeDescriptionsSize; ++i) { - if (statusCodeDescriptions[i].code == code) return statusCodeDescriptions[i].name; - } - return statusCodeDescriptions[statusCodeDescriptionsSize - 1].name; -} - -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_util.c" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -size_t UA_readNumber(u8 *buf, size_t buflen, u32 *number) { - UA_assert(buf); - UA_assert(number); - u32 n = 0; - size_t progress = 0; - /* read numbers until the end or a non-number character appears */ - while (progress < buflen) { - u8 c = buf[progress]; - if (c < '0' || c > '9') break; - n = (n * 10) + (u32)(c - '0'); - ++progress; - } - *number = n; - return progress; -} - -UA_StatusCode UA_parseEndpointUrl(const UA_String *endpointUrl, UA_String *outHostname, u16 *outPort, - UA_String *outPath) { - /* Url must begin with "opc.tcp://" */ - if (endpointUrl->length < 11 || strncmp((char *)endpointUrl->data, "opc.tcp://", 10) != 0) - return UA_STATUSCODE_BADTCPENDPOINTURLINVALID; - - /* Where does the hostname end? */ - size_t curr = 10; - if (endpointUrl->data[curr] == '[') { - /* IPv6: opc.tcp://[2001:0db8:85a3::8a2e:0370:7334]:1234/path */ - for (; curr < endpointUrl->length; ++curr) { - if (endpointUrl->data[curr] == ']') break; - } - if (curr == endpointUrl->length) return UA_STATUSCODE_BADTCPENDPOINTURLINVALID; - curr++; - } else { - /* IPv4 or hostname: opc.tcp://something.something:1234/path */ - for (; curr < endpointUrl->length; ++curr) { - if (endpointUrl->data[curr] == ':' || endpointUrl->data[curr] == '/') break; - } - } - - /* Set the hostname */ - outHostname->data = &endpointUrl->data[10]; - outHostname->length = curr - 10; - if (curr == endpointUrl->length) return UA_STATUSCODE_GOOD; - - /* Set the port */ - if (endpointUrl->data[curr] == ':') { - if (++curr == endpointUrl->length) return UA_STATUSCODE_BADTCPENDPOINTURLINVALID; - u32 largeNum; - size_t progress = UA_readNumber(&endpointUrl->data[curr], endpointUrl->length - curr, &largeNum); - if (progress == 0 || largeNum > 65535) return UA_STATUSCODE_BADTCPENDPOINTURLINVALID; - /* Test if the end of a valid port was reached */ - curr += progress; - if (curr == endpointUrl->length || endpointUrl->data[curr] == '/') *outPort = (u16)largeNum; - if (curr == endpointUrl->length) return UA_STATUSCODE_GOOD; - } - - /* Set the path */ - UA_assert(curr < endpointUrl->length); - if (endpointUrl->data[curr] != '/') return UA_STATUSCODE_BADTCPENDPOINTURLINVALID; - if (++curr == endpointUrl->length) return UA_STATUSCODE_GOOD; - outPath->data = &endpointUrl->data[curr]; - outPath->length = endpointUrl->length - curr; - - /* Remove trailing slash from the path */ - if (endpointUrl->data[endpointUrl->length - 1] == '/') outPath->length--; - - return UA_STATUSCODE_GOOD; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_timer.c" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* Only one thread operates on the repeated jobs. This is usually the "main" - * thread with the event loop. All other threads introduce changes via a - * multi-producer single-consumer (MPSC) queue. The queue is based on a design - * by Dmitry Vyukov. - * http://www.1024cores.net/home/lock-free-algorithms/queues/intrusive-mpsc-node-based-queue - * - * The RepeatedCallback structure is used both in the sorted list of callbacks - * and in the MPSC changes queue. For the changes queue, we differentiate - * between three cases encoded in the callback pointer. - * - * callback > 0x01: add the new repeated callback to the sorted list - * callback == 0x00: remove the callback with the same id - * callback == 0x01: change the interval of the existing callback */ - -#define REMOVE_SENTINEL 0x00 -#define CHANGE_SENTINEL 0x01 - -struct UA_TimerCallbackEntry { - SLIST_ENTRY(UA_TimerCallbackEntry) next; /* Next element in the list */ - UA_DateTime nextTime; /* The next time when the callbacks - * are to be executed */ - UA_UInt64 interval; /* Interval in 100ns resolution */ - UA_UInt64 id; /* Id of the repeated callback */ - - UA_TimerCallback callback; - void *data; -}; - -void UA_Timer_init(UA_Timer *t) { - SLIST_INIT(&t->repeatedCallbacks); - t->changes_head = (UA_TimerCallbackEntry *)&t->changes_stub; - t->changes_tail = (UA_TimerCallbackEntry *)&t->changes_stub; - t->changes_stub = NULL; - t->idCounter = 0; -} - -static void enqueueChange(UA_Timer *t, UA_TimerCallbackEntry *tc) { - tc->next.sle_next = NULL; - UA_TimerCallbackEntry *prev = (UA_TimerCallbackEntry *)UA_atomic_xchg((void *volatile *)&t->changes_head, tc); - /* Nothing can be dequeued while the producer is blocked here */ - prev->next.sle_next = tc; /* Once this change is visible in the consumer, - * the node is dequeued in the following - * iteration */ -} - -static UA_TimerCallbackEntry *dequeueChange(UA_Timer *t) { - UA_TimerCallbackEntry *tail = t->changes_tail; - UA_TimerCallbackEntry *next = tail->next.sle_next; - if (tail == (UA_TimerCallbackEntry *)&t->changes_stub) { - if (!next) return NULL; - t->changes_tail = next; - tail = next; - next = next->next.sle_next; - } - if (next) { - t->changes_tail = next; - return tail; - } - UA_TimerCallbackEntry *head = t->changes_head; - if (tail != head) return NULL; - enqueueChange(t, (UA_TimerCallbackEntry *)&t->changes_stub); - next = tail->next.sle_next; - if (next) { - t->changes_tail = next; - return tail; - } - return NULL; -} - -/* Adding repeated callbacks: Add an entry with the "nextTime" timestamp in the - * future. This will be picked up in the next iteration and inserted at the - * correct place. So that the next execution takes place ät "nextTime". */ -UA_StatusCode UA_Timer_addRepeatedCallback(UA_Timer *t, UA_TimerCallback callback, void *data, UA_UInt32 interval, - UA_UInt64 *callbackId) { - /* A callback method needs to be present */ - if (!callback) return UA_STATUSCODE_BADINTERNALERROR; - - /* The interval needs to be at least 5ms */ - if (interval < 5) return UA_STATUSCODE_BADINTERNALERROR; - - /* Allocate the repeated callback structure */ - UA_TimerCallbackEntry *tc = (UA_TimerCallbackEntry *)UA_malloc(sizeof(UA_TimerCallbackEntry)); - if (!tc) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Set the repeated callback */ - tc->interval = (UA_UInt64)interval * UA_DATETIME_MSEC; - tc->id = ++t->idCounter; - tc->callback = callback; - tc->data = data; - tc->nextTime = UA_DateTime_nowMonotonic() + (UA_DateTime)tc->interval; - - /* Set the output identifier */ - if (callbackId) *callbackId = tc->id; - - /* Enqueue the changes in the MPSC queue */ - enqueueChange(t, tc); - return UA_STATUSCODE_GOOD; -} - -static void addTimerCallbackEntry(UA_Timer *t, UA_TimerCallbackEntry *UA_RESTRICT tc) { - /* Find the last entry before this callback */ - UA_TimerCallbackEntry *tmpTc, *afterTc = NULL; - SLIST_FOREACH(tmpTc, &t->repeatedCallbacks, next) { - if (tmpTc->nextTime >= tc->nextTime) break; - afterTc = tmpTc; - - /* The goal is to have many repeated callbacks with the same repetition - * interval in a "block" in order to reduce linear search for re-entry - * to the sorted list after processing. Allow the first execution to lie - * between "nextTime - 1s" and "nextTime" if this adjustment groups - * callbacks with the same repetition interval. */ - if (tmpTc->interval == tc->interval && tmpTc->nextTime > (tc->nextTime - UA_DATETIME_SEC)) - tc->nextTime = tmpTc->nextTime; - } - - /* Add the repeated callback */ - if (afterTc) - SLIST_INSERT_AFTER(afterTc, tc, next); - else - SLIST_INSERT_HEAD(&t->repeatedCallbacks, tc, next); -} - -UA_StatusCode UA_Timer_changeRepeatedCallbackInterval(UA_Timer *t, UA_UInt64 callbackId, UA_UInt32 interval) { - /* The interval needs to be at least 5ms */ - if (interval < 5) return UA_STATUSCODE_BADINTERNALERROR; - - /* Allocate the repeated callback structure */ - UA_TimerCallbackEntry *tc = (UA_TimerCallbackEntry *)UA_malloc(sizeof(UA_TimerCallbackEntry)); - if (!tc) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Set the repeated callback */ - tc->interval = (UA_UInt64)interval * UA_DATETIME_MSEC; - tc->id = callbackId; - tc->nextTime = UA_DateTime_nowMonotonic() + (UA_DateTime)tc->interval; - tc->callback = (UA_TimerCallback)CHANGE_SENTINEL; - - /* Enqueue the changes in the MPSC queue */ - enqueueChange(t, tc); - return UA_STATUSCODE_GOOD; -} - -static void changeTimerCallbackEntryInterval(UA_Timer *t, UA_UInt64 callbackId, UA_UInt64 interval, - UA_DateTime nextTime) { - /* Remove from the sorted list */ - UA_TimerCallbackEntry *tc, *prev = NULL; - SLIST_FOREACH(tc, &t->repeatedCallbacks, next) { - if (callbackId == tc->id) { - if (prev) - SLIST_REMOVE_AFTER(prev, next); - else - SLIST_REMOVE_HEAD(&t->repeatedCallbacks, next); - break; - } - prev = tc; - } - if (!tc) return; - - /* Adjust settings */ - tc->interval = interval; - tc->nextTime = nextTime; - - /* Reinsert at the new position */ - addTimerCallbackEntry(t, tc); -} - -/* Removing a repeated callback: Add an entry with the "nextTime" timestamp set - * to UA_INT64_MAX. The next iteration picks this up and removes the repated - * callback from the linked list. */ -UA_StatusCode UA_Timer_removeRepeatedCallback(UA_Timer *t, UA_UInt64 callbackId) { - /* Allocate the repeated callback structure */ - UA_TimerCallbackEntry *tc = (UA_TimerCallbackEntry *)UA_malloc(sizeof(UA_TimerCallbackEntry)); - if (!tc) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Set the repeated callback with the sentinel nextTime */ - tc->id = callbackId; - tc->callback = (UA_TimerCallback)REMOVE_SENTINEL; - - /* Enqueue the changes in the MPSC queue */ - enqueueChange(t, tc); - return UA_STATUSCODE_GOOD; -} - -static void removeRepeatedCallback(UA_Timer *t, UA_UInt64 callbackId) { - UA_TimerCallbackEntry *tc, *prev = NULL; - SLIST_FOREACH(tc, &t->repeatedCallbacks, next) { - if (callbackId == tc->id) { - if (prev) - SLIST_REMOVE_AFTER(prev, next); - else - SLIST_REMOVE_HEAD(&t->repeatedCallbacks, next); - UA_free(tc); - break; - } - prev = tc; - } -} - -/* Process the changes that were added to the MPSC queue (by other threads) */ -static void processChanges(UA_Timer *t) { - UA_TimerCallbackEntry *change; - while ((change = dequeueChange(t))) { - switch ((uintptr_t)change->callback) { - case REMOVE_SENTINEL: - removeRepeatedCallback(t, change->id); - UA_free(change); - break; - case CHANGE_SENTINEL: - changeTimerCallbackEntryInterval(t, change->id, change->interval, change->nextTime); - UA_free(change); - break; - default: - addTimerCallbackEntry(t, change); - } - } -} - -UA_DateTime UA_Timer_process(UA_Timer *t, UA_DateTime nowMonotonic, UA_TimerDispatchCallback dispatchCallback, - void *application) { - /* Insert and remove callbacks */ - processChanges(t); - - /* Find the last callback to be executed now */ - UA_TimerCallbackEntry *firstAfter, *lastNow = NULL; - SLIST_FOREACH(firstAfter, &t->repeatedCallbacks, next) { - if (firstAfter->nextTime > nowMonotonic) break; - lastNow = firstAfter; - } - - /* Nothing to do */ - if (!lastNow) { - if (firstAfter) return firstAfter->nextTime; - return UA_INT64_MAX; - } - - /* Put the callbacks that are executed now in a separate list */ - UA_TimerCallbackList executedNowList; - executedNowList.slh_first = SLIST_FIRST(&t->repeatedCallbacks); - lastNow->next.sle_next = NULL; - - /* Fake entry to represent the first element in the newly-sorted list */ - UA_TimerCallbackEntry tmp_first; - tmp_first.nextTime = nowMonotonic - 1; /* never matches for last_dispatched */ - tmp_first.next.sle_next = firstAfter; - UA_TimerCallbackEntry *last_dispatched = &tmp_first; - - /* Iterate over the list of callbacks to process now */ - UA_TimerCallbackEntry *tc; - while ((tc = SLIST_FIRST(&executedNowList))) { - /* Remove from the list */ - SLIST_REMOVE_HEAD(&executedNowList, next); - - /* Dispatch/process callback */ - dispatchCallback(application, tc->callback, tc->data); - - /* Set the time for the next execution. Prevent an infinite loop by - * forcing the next processing into the next iteration. */ - tc->nextTime += (UA_Int64)tc->interval; - if (tc->nextTime < nowMonotonic) tc->nextTime = nowMonotonic + 1; - - /* Find the new position for tc to keep the list sorted */ - UA_TimerCallbackEntry *prev_tc; - if (last_dispatched->nextTime == tc->nextTime) { - /* We try to "batch" repeatedCallbacks with the same interval. This - * saves a linear search when the last dispatched entry has the same - * nextTime timestamp as this entry. */ - UA_assert(last_dispatched != &tmp_first); - prev_tc = last_dispatched; - } else { - /* Find the position for the next execution by a linear search - * starting at last_dispatched or the first element */ - if (last_dispatched->nextTime < tc->nextTime) - prev_tc = last_dispatched; - else - prev_tc = &tmp_first; - - while (true) { - UA_TimerCallbackEntry *n = SLIST_NEXT(prev_tc, next); - if (!n || n->nextTime >= tc->nextTime) break; - prev_tc = n; - } - - /* Update last_dispatched */ - last_dispatched = tc; - } - - /* Add entry to the new position in the sorted list */ - SLIST_INSERT_AFTER(prev_tc, tc, next); - } - - /* Set the entry-point for the newly sorted list */ - t->repeatedCallbacks.slh_first = tmp_first.next.sle_next; - - /* Re-repeat processAddRemoved since one of the callbacks might have removed - * or added a callback. So we return a correct timeout. */ - processChanges(t); - - /* Return timestamp of next repetition */ - tc = SLIST_FIRST(&t->repeatedCallbacks); - if (!tc) return UA_INT64_MAX; /* Main-loop has a max timeout / will continue earlier */ - return tc->nextTime; -} - -void UA_Timer_deleteMembers(UA_Timer *t) { - /* Process changes to empty the MPSC queue */ - processChanges(t); - - /* Remove repeated callbacks */ - UA_TimerCallbackEntry *current; - while ((current = SLIST_FIRST(&t->repeatedCallbacks))) { - SLIST_REMOVE_HEAD(&t->repeatedCallbacks, next); - UA_free(current); - } -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_session.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef UA_ENABLE_SUBSCRIPTIONS -#endif - -UA_Session adminSession = { - {{0, NULL}, - {0, NULL}, - {{0, NULL}, {0, NULL}}, - UA_APPLICATIONTYPE_CLIENT, - {0, NULL}, - {0, NULL}, - 0, - NULL}, /* .clientDescription */ - {sizeof("Administrator Session") - 1, (UA_Byte *)"Administrator Session"}, /* .sessionName */ - false, /* .activated */ - NULL, /* .sessionHandle */ - {0, UA_NODEIDTYPE_NUMERIC, {1}}, /* .authenticationToken */ - {0, UA_NODEIDTYPE_NUMERIC, {1}}, /* .sessionId */ - UA_UINT32_MAX, /* .maxRequestMessageSize */ - UA_UINT32_MAX, /* .maxResponseMessageSize */ - (UA_Double)UA_INT64_MAX, /* .timeout */ - UA_INT64_MAX, /* .validTill */ - {0, NULL}, - NULL, /* .channel */ - UA_MAXCONTINUATIONPOINTS, /* .availableContinuationPoints */ - {NULL}, /* .continuationPoints */ -#ifdef UA_ENABLE_SUBSCRIPTIONS - 0, /* .lastSubscriptionID */ - 0, /* .lastSeenSubscriptionID */ - {NULL}, /* .serverSubscriptions */ - {NULL, NULL}, /* .responseQueue */ - 0, /* numSubscriptions */ - 0 /* numPublishReq */ -#endif -}; - -void UA_Session_init(UA_Session *session) { - UA_ApplicationDescription_init(&session->clientDescription); - session->activated = false; - UA_NodeId_init(&session->authenticationToken); - UA_NodeId_init(&session->sessionId); - UA_String_init(&session->sessionName); - UA_ByteString_init(&session->serverNonce); - session->maxRequestMessageSize = 0; - session->maxResponseMessageSize = 0; - session->timeout = 0; - UA_DateTime_init(&session->validTill); - session->channel = NULL; - session->availableContinuationPoints = UA_MAXCONTINUATIONPOINTS; - LIST_INIT(&session->continuationPoints); -#ifdef UA_ENABLE_SUBSCRIPTIONS - LIST_INIT(&session->serverSubscriptions); - session->lastSubscriptionID = 0; - session->lastSeenSubscriptionID = 0; - SIMPLEQ_INIT(&session->responseQueue); - session->numSubscriptions = 0; - session->numPublishReq = 0; -#endif -} - -void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server) { - UA_ApplicationDescription_deleteMembers(&session->clientDescription); - UA_NodeId_deleteMembers(&session->authenticationToken); - UA_NodeId_deleteMembers(&session->sessionId); - UA_String_deleteMembers(&session->sessionName); - UA_ByteString_deleteMembers(&session->serverNonce); - struct ContinuationPointEntry *cp, *temp; - LIST_FOREACH_SAFE(cp, &session->continuationPoints, pointers, temp) { - LIST_REMOVE(cp, pointers); - UA_ByteString_deleteMembers(&cp->identifier); - UA_BrowseDescription_deleteMembers(&cp->browseDescription); - UA_free(cp); - } - if (session->channel) UA_SecureChannel_detachSession(session->channel, session); -#ifdef UA_ENABLE_SUBSCRIPTIONS - UA_Subscription *currents, *temps; - LIST_FOREACH_SAFE(currents, &session->serverSubscriptions, listEntry, temps) { - LIST_REMOVE(currents, listEntry); - UA_Subscription_deleteMembers(currents, server); - UA_free(currents); - } - UA_PublishResponseEntry *entry; - while ((entry = UA_Session_getPublishReq(session))) { - UA_Session_removePublishReq(session, entry); - UA_PublishResponse_deleteMembers(&entry->response); - UA_free(entry); - } -#endif -} - -void UA_Session_updateLifetime(UA_Session *session) { - session->validTill = UA_DateTime_nowMonotonic() + (UA_DateTime)(session->timeout * UA_DATETIME_MSEC); -} - -#ifdef UA_ENABLE_SUBSCRIPTIONS - -void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription) { - session->numSubscriptions++; - LIST_INSERT_HEAD(&session->serverSubscriptions, newSubscription, listEntry); -} - -UA_StatusCode UA_Session_deleteSubscription(UA_Server *server, UA_Session *session, UA_UInt32 subscriptionID) { - UA_Subscription *sub = UA_Session_getSubscriptionByID(session, subscriptionID); - if (!sub) return UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - - LIST_REMOVE(sub, listEntry); - UA_Subscription_deleteMembers(sub, server); - UA_free(sub); - if (session->numSubscriptions > 0) { - session->numSubscriptions--; - } else { - return UA_STATUSCODE_BADINTERNALERROR; - } - - return UA_STATUSCODE_GOOD; -} - -UA_UInt32 UA_Session_getNumSubscriptions(UA_Session *session) { return session->numSubscriptions; } - -UA_Subscription *UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID) { - UA_Subscription *sub; - LIST_FOREACH(sub, &session->serverSubscriptions, listEntry) { - if (sub->subscriptionID == subscriptionID) break; - } - return sub; -} - -UA_UInt32 UA_Session_getUniqueSubscriptionID(UA_Session *session) { return ++(session->lastSubscriptionID); } - -UA_UInt32 UA_Session_getNumPublishReq(UA_Session *session) { return session->numPublishReq; } - -UA_PublishResponseEntry *UA_Session_getPublishReq(UA_Session *session) { - return SIMPLEQ_FIRST(&session->responseQueue); -} - -void UA_Session_removePublishReq(UA_Session *session, UA_PublishResponseEntry *entry) { - UA_PublishResponseEntry *firstEntry; - firstEntry = SIMPLEQ_FIRST(&session->responseQueue); - - /* Remove the response from the response queue */ - if ((firstEntry != 0) && (firstEntry == entry)) { - SIMPLEQ_REMOVE_HEAD(&session->responseQueue, listEntry); - session->numPublishReq--; - } -} - -void UA_Session_addPublishReq(UA_Session *session, UA_PublishResponseEntry *entry) { - SIMPLEQ_INSERT_TAIL(&session->responseQueue, entry, listEntry); - session->numPublishReq++; -} - -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_connection.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void UA_Connection_deleteMembers(UA_Connection *connection) { - UA_ByteString_deleteMembers(&connection->incompleteMessage); -} - -/* Hides somme errors before sending them to a client according to the - * standard. */ -static void hideErrors(UA_TcpErrorMessage *const error) { - switch (error->error) { - case UA_STATUSCODE_BADCERTIFICATEUNTRUSTED: - error->error = UA_STATUSCODE_BADSECURITYCHECKSFAILED; - error->reason = UA_STRING_NULL; - break; - case UA_STATUSCODE_BADCERTIFICATEREVOKED: - error->error = UA_STATUSCODE_BADSECURITYCHECKSFAILED; - error->reason = UA_STRING_NULL; - break; - // TODO: Check if these are all cases that need to be covered. - default: - break; - } -} - -void UA_Connection_sendError(UA_Connection *connection, UA_TcpErrorMessage *error) { - hideErrors(error); - - UA_TcpMessageHeader header; - header.messageTypeAndChunkType = UA_MESSAGETYPE_ERR + UA_CHUNKTYPE_FINAL; - // Header + ErrorMessage (error + reasonLength_field + length) - header.messageSize = 8 + (4 + 4 + (UA_UInt32)error->reason.length); - - /* Get the send buffer from the network layer */ - UA_ByteString msg = UA_BYTESTRING_NULL; - UA_StatusCode retval = connection->getSendBuffer(connection, header.messageSize, &msg); - if (retval != UA_STATUSCODE_GOOD) return; - - /* Encode and send the response */ - UA_Byte *bufPos = msg.data; - const UA_Byte *bufEnd = &msg.data[msg.length]; - UA_TcpMessageHeader_encodeBinary(&header, &bufPos, &bufEnd); - UA_TcpErrorMessage_encodeBinary(error, &bufPos, &bufEnd); - msg.length = header.messageSize; - connection->send(connection, &msg); -} - -static UA_StatusCode prependIncompleteChunk(UA_Connection *connection, UA_ByteString *message) { - /* Allocate the new message buffer */ - size_t length = connection->incompleteMessage.length + message->length; - UA_Byte *data = (UA_Byte *)UA_realloc(connection->incompleteMessage.data, length); - if (!data) { - UA_ByteString_deleteMembers(&connection->incompleteMessage); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - - /* Copy / release the current message buffer */ - memcpy(&data[connection->incompleteMessage.length], message->data, message->length); - message->length = length; - message->data = data; - connection->incompleteMessage = UA_BYTESTRING_NULL; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode bufferIncompleteChunk(UA_Connection *connection, const UA_Byte *pos, const UA_Byte *end) { - size_t length = (uintptr_t)end - (uintptr_t)pos; - UA_StatusCode retval = UA_ByteString_allocBuffer(&connection->incompleteMessage, length); - if (retval != UA_STATUSCODE_GOOD) return retval; - memcpy(connection->incompleteMessage.data, pos, length); - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode processChunk(UA_Connection *connection, void *application, - UA_Connection_processChunk processCallback, const UA_Byte **posp, const UA_Byte *end, - UA_Boolean *done) { - const UA_Byte *pos = *posp; - size_t length = (uintptr_t)end - (uintptr_t)pos; - - /* At least 8 byte needed for the header. Wait for the next chunk. */ - if (length < 8) { - bufferIncompleteChunk(connection, pos, end); - *done = true; - return UA_STATUSCODE_GOOD; - } - - /* Check the message type */ - UA_MessageType msgtype = (UA_MessageType)((UA_UInt32)pos[0] + ((UA_UInt32)pos[1] << 8) + ((UA_UInt32)pos[2] << 16)); - if (msgtype != UA_MESSAGETYPE_MSG && msgtype != UA_MESSAGETYPE_ERR && msgtype != UA_MESSAGETYPE_OPN && - msgtype != UA_MESSAGETYPE_HEL && msgtype != UA_MESSAGETYPE_ACK && msgtype != UA_MESSAGETYPE_CLO) { - /* The message type is not recognized */ - return UA_STATUSCODE_BADTCPMESSAGETYPEINVALID; - } - - UA_Byte isFinal = pos[3]; - if (isFinal != 'C' && isFinal != 'F' && isFinal != 'A') { - /* The message type is not recognized */ - return UA_STATUSCODE_BADTCPMESSAGETYPEINVALID; - } - - UA_UInt32 chunk_length = 0; - UA_ByteString temp = {8, (UA_Byte *)(uintptr_t)pos}; /* At least 8 byte left */ - size_t temp_offset = 4; - /* Decoding the UInt32 cannot fail */ - UA_UInt32_decodeBinary(&temp, &temp_offset, &chunk_length); - - /* The message size is not allowed */ - if (chunk_length < 16 || chunk_length > connection->localConf.recvBufferSize) - return UA_STATUSCODE_BADTCPMESSAGETOOLARGE; - - /* Wait for the next packet to process the complete chunk */ - if (chunk_length > length) { - bufferIncompleteChunk(connection, pos, end); - *done = true; - return UA_STATUSCODE_GOOD; - } - - /* Process the chunk; forward the position pointer */ - temp.length = chunk_length; - *posp += chunk_length; - *done = false; - return processCallback(application, connection, &temp); -} - -UA_StatusCode UA_Connection_processChunks(UA_Connection *connection, void *application, - UA_Connection_processChunk processCallback, const UA_ByteString *packet) { - /* If we have stored an incomplete chunk, prefix to the received message. - * After this block, connection->incompleteMessage is always empty. The - * message and the buffer is released if allocating the memory fails. */ - UA_Boolean realloced = false; - UA_ByteString message = *packet; - UA_StatusCode retval; - if (connection->incompleteMessage.length > 0) { - retval = prependIncompleteChunk(connection, &message); - if (retval != UA_STATUSCODE_GOOD) return retval; - realloced = true; - } - - /* Loop over the received chunks. pos is increased with each chunk. */ - const UA_Byte *pos = message.data; - const UA_Byte *end = &message.data[message.length]; - UA_Boolean done = true; - do { - retval = processChunk(connection, application, processCallback, &pos, end, &done); - } while (!done && retval == UA_STATUSCODE_GOOD); - - if (realloced) UA_ByteString_deleteMembers(&message); - return retval; -} - -/* In order to know whether a chunk was processed, we insert an indirection into - * the callback. */ -struct completeChunkTrampolineData { - UA_Boolean called; - void *application; - UA_Connection_processChunk processCallback; -}; - -static UA_StatusCode completeChunkTrampoline(void *application, UA_Connection *connection, UA_ByteString *chunk) { - struct completeChunkTrampolineData *data = (struct completeChunkTrampolineData *)application; - data->called = true; - return data->processCallback(data->application, connection, chunk); -} - -UA_StatusCode UA_Connection_receiveChunksBlocking(UA_Connection *connection, void *application, - UA_Connection_processChunk processCallback, UA_UInt32 timeout) { - UA_DateTime now = UA_DateTime_nowMonotonic(); - UA_DateTime maxDate = now + (timeout * UA_DATETIME_MSEC); - - struct completeChunkTrampolineData data; - data.called = false; - data.application = application; - data.processCallback = processCallback; - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - while (true) { - /* Listen for messages to arrive */ - UA_ByteString packet = UA_BYTESTRING_NULL; - retval = connection->recv(connection, &packet, timeout); - if (retval != UA_STATUSCODE_GOOD) break; - - /* Try to process one complete chunk */ - retval = UA_Connection_processChunks(connection, &data, completeChunkTrampoline, &packet); - connection->releaseRecvBuffer(connection, &packet); - if (data.called) break; - - /* We received a message. But the chunk is incomplete. Compute the - * remaining timeout. */ - now = UA_DateTime_nowMonotonic(); - - /* >= avoid timeout to be set to 0 */ - if (now >= maxDate) return UA_STATUSCODE_GOODNONCRITICALTIMEOUT; - - /* round always to upper value to avoid timeout to be set to 0 - * if (maxDate - now) < (UA_DATETIME_MSEC/2) */ - timeout = (UA_UInt32)(((maxDate - now) + (UA_DATETIME_MSEC - 1)) / UA_DATETIME_MSEC); - } - return retval; -} - -void UA_Connection_detachSecureChannel(UA_Connection *connection) { - UA_SecureChannel *channel = connection->channel; - if (channel) /* only replace when the channel points to this connection */ - UA_atomic_cmpxchg((void **)&channel->connection, connection, NULL); - UA_atomic_xchg((void **)&connection->channel, NULL); -} - -// TODO: Return an error code -void UA_Connection_attachSecureChannel(UA_Connection *connection, UA_SecureChannel *channel) { - if (UA_atomic_cmpxchg((void **)&channel->connection, NULL, connection) == NULL) - UA_atomic_xchg((void **)&connection->channel, (void *)channel); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/ua_securechannel.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#define UA_BITMASK_MESSAGETYPE 0x00ffffff -#define UA_BITMASK_CHUNKTYPE 0xff000000 -#define UA_ASYMMETRIC_ALG_SECURITY_HEADER_FIXED_LENGTH 12 -#define UA_SYMMETRIC_ALG_SECURITY_HEADER_LENGTH 4 -#define UA_SEQUENCE_HEADER_LENGTH 8 -#define UA_SECUREMH_AND_SYMALGH_LENGTH \ - (UA_SECURE_CONVERSATION_MESSAGE_HEADER_LENGTH + UA_SYMMETRIC_ALG_SECURITY_HEADER_LENGTH) - -const UA_ByteString UA_SECURITY_POLICY_NONE_URI = {47, (UA_Byte *)"http://opcfoundation.org/UA/SecurityPolicy#None"}; - -#ifdef UA_ENABLE_UNIT_TEST_FAILURE_HOOKS -UA_THREAD_LOCAL UA_StatusCode decrypt_verifySignatureFailure; -UA_THREAD_LOCAL UA_StatusCode sendAsym_sendFailure; -UA_THREAD_LOCAL UA_StatusCode processSym_seqNumberFailure; -#endif - -UA_StatusCode UA_SecureChannel_init(UA_SecureChannel *channel, const UA_SecurityPolicy *securityPolicy, - const UA_ByteString *remoteCertificate) { - if (channel == NULL || securityPolicy == NULL || remoteCertificate == NULL) return UA_STATUSCODE_BADINTERNALERROR; - - memset(channel, 0, sizeof(UA_SecureChannel)); - channel->state = UA_SECURECHANNELSTATE_FRESH; - channel->securityPolicy = securityPolicy; - - UA_StatusCode retval = - securityPolicy->channelModule.newContext(securityPolicy, remoteCertificate, &channel->channelContext); - if (retval != UA_STATUSCODE_GOOD) return retval; - - retval = UA_ByteString_copy(remoteCertificate, &channel->remoteCertificate); - if (retval != UA_STATUSCODE_GOOD) return retval; - - UA_ByteString remoteCertificateThumbprint = {20, channel->remoteCertificateThumbprint}; - retval = securityPolicy->asymmetricModule.makeCertificateThumbprint(securityPolicy, &channel->remoteCertificate, - &remoteCertificateThumbprint); - - return retval; - /* Linked lists are also initialized by zeroing out */ - /* LIST_INIT(&channel->sessions); */ - /* LIST_INIT(&channel->chunks); */ -} - -void UA_SecureChannel_deleteMembersCleanup(UA_SecureChannel *channel) { - if (channel == NULL) return; - - /* Delete members */ - UA_ByteString_deleteMembers(&channel->remoteCertificate); - UA_ByteString_deleteMembers(&channel->localNonce); - UA_ByteString_deleteMembers(&channel->remoteNonce); - UA_ChannelSecurityToken_deleteMembers(&channel->securityToken); - UA_ChannelSecurityToken_deleteMembers(&channel->nextSecurityToken); - - /* Delete the channel context for the security policy */ - if (channel->securityPolicy) channel->securityPolicy->channelModule.deleteContext(channel->channelContext); - - /* Detach from the connection and close the connection */ - if (channel->connection) { - if (channel->connection->state != UA_CONNECTION_CLOSED) { - channel->connection->close(channel->connection); - } - UA_Connection_detachSecureChannel(channel->connection); - } - - /* Remove session pointers (not the sessions) */ - struct SessionEntry *se, *temp; - LIST_FOREACH_SAFE(se, &channel->sessions, pointers, temp) { - if (se->session) se->session->channel = NULL; - LIST_REMOVE(se, pointers); - UA_free(se); - } - - /* Remove the buffered chunks */ - struct ChunkEntry *ch, *temp_ch; - LIST_FOREACH_SAFE(ch, &channel->chunks, pointers, temp_ch) { - UA_ByteString_deleteMembers(&ch->bytes); - LIST_REMOVE(ch, pointers); - UA_free(ch); - } -} - -UA_StatusCode UA_SecureChannel_generateNonce(const UA_SecureChannel *const channel, const size_t nonceLength, - UA_ByteString *const nonce) { - if (channel == NULL || nonce == NULL) return UA_STATUSCODE_BADINTERNALERROR; - - UA_ByteString_deleteMembers(nonce); - UA_StatusCode retval = UA_ByteString_allocBuffer(nonce, nonceLength); - if (retval != UA_STATUSCODE_GOOD) return retval; - - return channel->securityPolicy->symmetricModule.generateNonce(channel->securityPolicy, nonce); -} - -UA_StatusCode UA_SecureChannel_generateNewKeys(UA_SecureChannel *const channel) { - if (channel == NULL) return UA_STATUSCODE_BADINTERNALERROR; - - const UA_SecurityPolicy *const securityPolicy = channel->securityPolicy; - const UA_SecurityPolicyChannelModule *channelModule = &securityPolicy->channelModule; - const UA_SecurityPolicySymmetricModule *symmetricModule = &securityPolicy->symmetricModule; - - /* Symmetric key length */ - size_t encryptionKeyLength = - symmetricModule->cryptoModule.getLocalEncryptionKeyLength(securityPolicy, channel->channelContext); - const size_t buffSize = - symmetricModule->encryptionBlockSize + symmetricModule->signingKeyLength + encryptionKeyLength; - UA_ByteString buffer = {buffSize, (UA_Byte *)UA_alloca(buffSize)}; - - /* Remote keys */ - UA_StatusCode retval = - symmetricModule->generateKey(securityPolicy, &channel->localNonce, &channel->remoteNonce, &buffer); - if (retval != UA_STATUSCODE_GOOD) return retval; - const UA_ByteString remoteSigningKey = {symmetricModule->signingKeyLength, buffer.data}; - const UA_ByteString remoteEncryptingKey = {encryptionKeyLength, buffer.data + symmetricModule->signingKeyLength}; - const UA_ByteString remoteIv = {symmetricModule->encryptionBlockSize, - buffer.data + symmetricModule->signingKeyLength + encryptionKeyLength}; - retval = channelModule->setRemoteSymSigningKey(channel->channelContext, &remoteSigningKey); - retval |= channelModule->setRemoteSymEncryptingKey(channel->channelContext, &remoteEncryptingKey); - retval |= channelModule->setRemoteSymIv(channel->channelContext, &remoteIv); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Local keys */ - retval = symmetricModule->generateKey(securityPolicy, &channel->remoteNonce, &channel->localNonce, &buffer); - if (retval != UA_STATUSCODE_GOOD) return retval; - const UA_ByteString localSigningKey = {symmetricModule->signingKeyLength, buffer.data}; - const UA_ByteString localEncryptingKey = {encryptionKeyLength, buffer.data + symmetricModule->signingKeyLength}; - const UA_ByteString localIv = {symmetricModule->encryptionBlockSize, - buffer.data + symmetricModule->signingKeyLength + encryptionKeyLength}; - retval = channelModule->setLocalSymSigningKey(channel->channelContext, &localSigningKey); - retval |= channelModule->setLocalSymEncryptingKey(channel->channelContext, &localEncryptingKey); - retval |= channelModule->setLocalSymIv(channel->channelContext, &localIv); - return retval; -} - -void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session) { - struct SessionEntry *se = (struct SessionEntry *)UA_malloc(sizeof(struct SessionEntry)); - if (!se) return; - se->session = session; - if (UA_atomic_cmpxchg((void **)&session->channel, NULL, channel) != NULL) { - UA_free(se); - return; - } - LIST_INSERT_HEAD(&channel->sessions, se, pointers); -} - -void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session) { - if (session) session->channel = NULL; - struct SessionEntry *se; - LIST_FOREACH(se, &channel->sessions, pointers) { - if (se->session == session) break; - } - if (!se) return; - LIST_REMOVE(se, pointers); - UA_free(se); -} - -UA_Session *UA_SecureChannel_getSession(UA_SecureChannel *channel, UA_NodeId *token) { - struct SessionEntry *se; - LIST_FOREACH(se, &channel->sessions, pointers) { - if (UA_NodeId_equal(&se->session->authenticationToken, token)) break; - } - if (!se) return NULL; - return se->session; -} - -UA_StatusCode UA_SecureChannel_revolveTokens(UA_SecureChannel *channel) { - if (channel->nextSecurityToken.tokenId == 0) // no security token issued - return UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN; - - // FIXME: not thread-safe - memcpy(&channel->securityToken, &channel->nextSecurityToken, sizeof(UA_ChannelSecurityToken)); - UA_ChannelSecurityToken_init(&channel->nextSecurityToken); - return UA_SecureChannel_generateNewKeys(channel); -} -/***************************/ -/* Send Asymmetric Message */ -/***************************/ - -static UA_UInt16 calculatePaddingAsym(const UA_SecurityPolicy *securityPolicy, const void *channelContext, - size_t bytesToWrite, UA_Byte *paddingSize, UA_Byte *extraPaddingSize) { - size_t plainTextBlockSize = securityPolicy->channelModule.getRemoteAsymPlainTextBlockSize(channelContext); - size_t signatureSize = - securityPolicy->asymmetricModule.cryptoModule.getLocalSignatureSize(securityPolicy, channelContext); - size_t paddingBytes = 1; - if (securityPolicy->asymmetricModule.cryptoModule.getRemoteEncryptionKeyLength(securityPolicy, channelContext) > 2048) - ++paddingBytes; - size_t padding = (plainTextBlockSize - ((bytesToWrite + signatureSize + paddingBytes) % plainTextBlockSize)); - *paddingSize = (UA_Byte)(padding & 0xff); - *extraPaddingSize = (UA_Byte)(padding >> 8); - return (UA_UInt16)padding; -} - -static size_t calculateAsymAlgSecurityHeaderLength(const UA_SecureChannel *channel) { - size_t asymHeaderLength = UA_ASYMMETRIC_ALG_SECURITY_HEADER_FIXED_LENGTH + channel->securityPolicy->policyUri.length; - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { - // OPN is always encrypted even if mode sign only - asymHeaderLength += 20; /* Thumbprints are always 20 byte long */ - asymHeaderLength += channel->securityPolicy->localCertificate.length; - } - return asymHeaderLength; -} - -static void hideBytesAsym(UA_SecureChannel *const channel, UA_Byte **const buf_start, const UA_Byte **const buf_end) { - const UA_SecurityPolicy *const securityPolicy = channel->securityPolicy; - *buf_start += UA_SECURE_CONVERSATION_MESSAGE_HEADER_LENGTH + UA_SEQUENCE_HEADER_LENGTH; - - /* Add the SecurityHeaderLength */ - *buf_start += calculateAsymAlgSecurityHeaderLength(channel); - size_t potentialEncryptionMaxSize = (size_t)(*buf_end - *buf_start) + UA_SEQUENCE_HEADER_LENGTH; - - /* Hide bytes for signature and padding */ - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { - *buf_end -= - securityPolicy->asymmetricModule.cryptoModule.getLocalSignatureSize(securityPolicy, channel->channelContext); - *buf_end -= 2; // padding byte and extraPadding byte - - /* Add some overhead length due to RSA implementations adding a signature themselves */ - *buf_end -= securityPolicy->channelModule.getRemoteAsymEncryptionBufferLengthOverhead(channel->channelContext, - potentialEncryptionMaxSize); - } -} - -/* Sends an OPN message using asymmetric encryption if defined */ -UA_StatusCode UA_SecureChannel_sendAsymmetricOPNMessage(UA_SecureChannel *channel, UA_UInt32 requestId, - const void *content, const UA_DataType *contentType) { - if (channel == NULL || content == NULL || contentType == NULL) return UA_STATUSCODE_BADINTERNALERROR; - - if (channel->securityMode == UA_MESSAGESECURITYMODE_INVALID) return UA_STATUSCODE_BADSECURITYMODEREJECTED; - - const UA_SecurityPolicy *const securityPolicy = channel->securityPolicy; - UA_Connection *connection = channel->connection; - if (!connection) return UA_STATUSCODE_BADINTERNALERROR; - - /* Allocate the message buffer */ - UA_ByteString buf = UA_BYTESTRING_NULL; - UA_StatusCode retval = connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &buf); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Restrict buffer to the available space for the payload */ - UA_Byte *buf_pos = buf.data; - const UA_Byte *buf_end = &buf.data[buf.length]; - hideBytesAsym(channel, &buf_pos, &buf_end); - - /* Encode the message type and content */ - UA_NodeId typeId = UA_NODEID_NUMERIC(0, contentType->binaryEncodingId); - retval = UA_encodeBinary(&typeId, &UA_TYPES[UA_TYPES_NODEID], &buf_pos, &buf_end, NULL, NULL); - retval |= UA_encodeBinary(content, contentType, &buf_pos, &buf_end, NULL, NULL); - if (retval != UA_STATUSCODE_GOOD) { - connection->releaseSendBuffer(connection, &buf); - return retval; - } - - /* Compute the length of the asym header */ - const size_t securityHeaderLength = calculateAsymAlgSecurityHeaderLength(channel); - - /* Pad the message. Also if securitymode is only sign, since we are using - * asymmetric communication to exchange keys and thus need to encrypt. */ - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { - const UA_Byte *buf_body_start = - &buf.data[UA_SECURE_CONVERSATION_MESSAGE_HEADER_LENGTH + UA_SEQUENCE_HEADER_LENGTH + securityHeaderLength]; - const size_t bytesToWrite = (uintptr_t)buf_pos - (uintptr_t)buf_body_start + UA_SEQUENCE_HEADER_LENGTH; - UA_Byte paddingSize = 0; - UA_Byte extraPaddingSize = 0; - UA_UInt16 totalPaddingSize = - calculatePaddingAsym(securityPolicy, channel->channelContext, bytesToWrite, &paddingSize, &extraPaddingSize); - - // This is <= because the paddingSize byte also has to be written. - for (UA_UInt16 i = 0; i <= totalPaddingSize; ++i) { - *buf_pos = paddingSize; - ++buf_pos; - } - if (securityPolicy->asymmetricModule.cryptoModule.getRemoteEncryptionKeyLength(securityPolicy, - channel->channelContext) > 2048) { - *buf_pos = extraPaddingSize; - ++buf_pos; - } - } - - /* The total message length */ - size_t pre_sig_length = (uintptr_t)buf_pos - (uintptr_t)buf.data; - size_t total_length = pre_sig_length; - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) - total_length += - securityPolicy->asymmetricModule.cryptoModule.getLocalSignatureSize(securityPolicy, channel->channelContext); - - /* Encode the headers at the beginning of the message */ - UA_Byte *header_pos = buf.data; - size_t dataToEncryptLength = total_length - (UA_SECURE_CONVERSATION_MESSAGE_HEADER_LENGTH + securityHeaderLength); - UA_SecureConversationMessageHeader respHeader; - respHeader.messageHeader.messageTypeAndChunkType = UA_MESSAGETYPE_OPN + UA_CHUNKTYPE_FINAL; - respHeader.messageHeader.messageSize = - (UA_UInt32)(total_length + - securityPolicy->channelModule.getRemoteAsymEncryptionBufferLengthOverhead(channel->channelContext, - dataToEncryptLength)); - respHeader.secureChannelId = channel->securityToken.channelId; - retval = UA_encodeBinary(&respHeader, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER], &header_pos, - &buf_end, NULL, NULL); - - UA_AsymmetricAlgorithmSecurityHeader asymHeader; - UA_AsymmetricAlgorithmSecurityHeader_init(&asymHeader); - asymHeader.securityPolicyUri = channel->securityPolicy->policyUri; - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { - asymHeader.senderCertificate = channel->securityPolicy->localCertificate; - asymHeader.receiverCertificateThumbprint.length = 20; - asymHeader.receiverCertificateThumbprint.data = channel->remoteCertificateThumbprint; - } - retval |= UA_encodeBinary(&asymHeader, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER], &header_pos, - &buf_end, NULL, NULL); - - UA_SequenceHeader seqHeader; - seqHeader.requestId = requestId; - seqHeader.sequenceNumber = UA_atomic_add(&channel->sendSequenceNumber, 1); - retval |= UA_encodeBinary(&seqHeader, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER], &header_pos, &buf_end, NULL, NULL); - - /* Did encoding the header succeed? */ - if (retval != UA_STATUSCODE_GOOD) { - connection->releaseSendBuffer(connection, &buf); - return retval; - } - - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { - /* Sign message */ - const UA_ByteString dataToSign = {pre_sig_length, buf.data}; - size_t sigsize = - securityPolicy->asymmetricModule.cryptoModule.getLocalSignatureSize(securityPolicy, channel->channelContext); - UA_ByteString signature = {sigsize, buf.data + pre_sig_length}; - retval = securityPolicy->asymmetricModule.cryptoModule.sign(securityPolicy, channel->channelContext, &dataToSign, - &signature); - if (retval != UA_STATUSCODE_GOOD) { - connection->releaseSendBuffer(connection, &buf); - return retval; - } - - /* Specification part 6, 6.7.4: The OpenSecureChannel Messages are - * signed and encrypted if the SecurityMode is not None (even if the - * SecurityMode is SignOnly). */ - size_t unencrypted_length = UA_SECURE_CONVERSATION_MESSAGE_HEADER_LENGTH + securityHeaderLength; - UA_ByteString dataToEncrypt = {total_length - unencrypted_length, &buf.data[unencrypted_length]}; - retval = - securityPolicy->asymmetricModule.cryptoModule.encrypt(securityPolicy, channel->channelContext, &dataToEncrypt); - if (retval != UA_STATUSCODE_GOOD) { - connection->releaseSendBuffer(connection, &buf); - return retval; - } - } - - /* Send the message, the buffer is freed in the network layer */ - buf.length = respHeader.messageHeader.messageSize; - retval = connection->send(connection, &buf); -#ifdef UA_ENABLE_UNIT_TEST_FAILURE_HOOKS - retval |= sendAsym_sendFailure -#endif - return retval; -} - -/**************************/ -/* Send Symmetric Message */ -/**************************/ - -static UA_UInt16 calculatePaddingSym(const UA_SecurityPolicy *securityPolicy, const void *channelContext, - size_t bytesToWrite, UA_Byte *paddingSize, UA_Byte *extraPaddingSize) { - UA_UInt16 padding = (UA_UInt16)( - securityPolicy->symmetricModule.encryptionBlockSize - - ((bytesToWrite + - securityPolicy->symmetricModule.cryptoModule.getLocalSignatureSize(securityPolicy, channelContext) + 1) % - securityPolicy->symmetricModule.encryptionBlockSize)); - *paddingSize = (UA_Byte)padding; - *extraPaddingSize = (UA_Byte)(padding >> 8); - return padding; -} - -static void setBufPos(UA_MessageContext *mc) { - const UA_SecureChannel *channel = mc->channel; - const UA_SecurityPolicy *securityPolicy = channel->securityPolicy; - - /* Forward the data pointer so that the payload is encoded after the - * message header */ - mc->buf_pos = &mc->messageBuffer.data[UA_SECURE_MESSAGE_HEADER_LENGTH]; - mc->buf_end = &mc->messageBuffer.data[mc->messageBuffer.length]; - - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) - mc->buf_end -= - securityPolicy->symmetricModule.cryptoModule.getLocalSignatureSize(securityPolicy, channel->channelContext); - - /* Hide a byte needed for padding */ - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) mc->buf_end -= 2; -} - -static UA_StatusCode sendSymmetricChunk(UA_MessageContext *mc) { - UA_StatusCode res = UA_STATUSCODE_GOOD; - UA_SecureChannel *const channel = mc->channel; - const UA_SecurityPolicy *securityPolicy = channel->securityPolicy; - UA_Connection *const connection = channel->connection; - if (!connection) return UA_STATUSCODE_BADINTERNALERROR; - - /* Will this chunk surpass the capacity of the SecureChannel for the message? */ - UA_Byte *buf_body_start = mc->messageBuffer.data + UA_SECURE_MESSAGE_HEADER_LENGTH; - const UA_Byte *buf_body_end = mc->buf_pos; - size_t bodyLength = (uintptr_t)buf_body_end - (uintptr_t)buf_body_start; - mc->messageSizeSoFar += bodyLength; - mc->chunksSoFar++; - if (mc->messageSizeSoFar > connection->remoteConf.maxMessageSize && connection->remoteConf.maxMessageSize != 0) - res = UA_STATUSCODE_BADRESPONSETOOLARGE; - if (mc->chunksSoFar > connection->remoteConf.maxChunkCount && connection->remoteConf.maxChunkCount != 0) - res = UA_STATUSCODE_BADRESPONSETOOLARGE; - if (res != UA_STATUSCODE_GOOD) { - connection->releaseSendBuffer(channel->connection, &mc->messageBuffer); - return res; - } - - /* Pad the message. The bytes for the padding and signature were removed - * from buf_end before encoding the payload. So we don't check here. */ - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { - size_t bytesToWrite = bodyLength + UA_SEQUENCE_HEADER_LENGTH; - UA_Byte paddingSize = 0; - UA_Byte extraPaddingSize = 0; - UA_UInt16 totalPaddingSize = - calculatePaddingSym(securityPolicy, channel->channelContext, bytesToWrite, &paddingSize, &extraPaddingSize); - - // This is <= because the paddingSize byte also has to be written. - for (UA_UInt16 i = 0; i <= totalPaddingSize; ++i) { - *mc->buf_pos = paddingSize; - ++(mc->buf_pos); - } - if (extraPaddingSize > 0) { - *mc->buf_pos = extraPaddingSize; - ++(mc->buf_pos); - } - } - - /* The total message length */ - size_t pre_sig_length = (uintptr_t)(mc->buf_pos) - (uintptr_t)mc->messageBuffer.data; - size_t total_length = pre_sig_length; - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) - total_length += - securityPolicy->symmetricModule.cryptoModule.getLocalSignatureSize(securityPolicy, channel->channelContext); - mc->messageBuffer.length = total_length; /* For giving the buffer to the network layer */ - - /* Encode the chunk headers at the beginning of the buffer */ - UA_assert(res == UA_STATUSCODE_GOOD); - UA_Byte *header_pos = mc->messageBuffer.data; - UA_SecureConversationMessageHeader respHeader; - respHeader.secureChannelId = channel->securityToken.channelId; - respHeader.messageHeader.messageTypeAndChunkType = mc->messageType; - respHeader.messageHeader.messageSize = (UA_UInt32)total_length; - if (mc->final) - respHeader.messageHeader.messageTypeAndChunkType += UA_CHUNKTYPE_FINAL; - else - respHeader.messageHeader.messageTypeAndChunkType += UA_CHUNKTYPE_INTERMEDIATE; - res = UA_encodeBinary(&respHeader, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER], &header_pos, - &mc->buf_end, NULL, NULL); - - UA_SymmetricAlgorithmSecurityHeader symSecHeader; - symSecHeader.tokenId = channel->securityToken.tokenId; - res |= UA_encodeBinary(&symSecHeader.tokenId, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER], - &header_pos, &mc->buf_end, NULL, NULL); - - UA_SequenceHeader seqHeader; - seqHeader.requestId = mc->requestId; - seqHeader.sequenceNumber = UA_atomic_add(&channel->sendSequenceNumber, 1); - res |= UA_encodeBinary(&seqHeader, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER], &header_pos, &mc->buf_end, NULL, NULL); - - /* Sign message */ - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { - UA_ByteString dataToSign = mc->messageBuffer; - dataToSign.length = pre_sig_length; - UA_ByteString signature; - signature.length = - securityPolicy->symmetricModule.cryptoModule.getLocalSignatureSize(securityPolicy, channel->channelContext); - signature.data = mc->buf_pos; - res |= securityPolicy->symmetricModule.cryptoModule.sign(securityPolicy, channel->channelContext, &dataToSign, - &signature); - } - - /* Encrypt message */ - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { - UA_ByteString dataToEncrypt; - dataToEncrypt.data = mc->messageBuffer.data + UA_SECUREMH_AND_SYMALGH_LENGTH; - dataToEncrypt.length = total_length - UA_SECUREMH_AND_SYMALGH_LENGTH; - res |= - securityPolicy->symmetricModule.cryptoModule.encrypt(securityPolicy, channel->channelContext, &dataToEncrypt); - } - - if (res != UA_STATUSCODE_GOOD) { - connection->releaseSendBuffer(channel->connection, &mc->messageBuffer); - return res; - } - - /* Send the chunk, the buffer is freed in the network layer */ - return connection->send(channel->connection, &mc->messageBuffer); -} - -/* Callback from the encoding layer. Send the chunk and replace the buffer. */ -static UA_StatusCode sendSymmetricEncodingCallback(void *data, UA_Byte **buf_pos, const UA_Byte **buf_end) { - /* Set buf values from encoding in the messagecontext */ - UA_MessageContext *mc = (UA_MessageContext *)data; - mc->buf_pos = *buf_pos; - mc->buf_end = *buf_end; - - /* Send out */ - UA_StatusCode retval = sendSymmetricChunk(mc); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Set a new buffer for the next chunk */ - UA_Connection *connection = mc->channel->connection; - retval = connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &mc->messageBuffer); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Hide bytes for header, padding and signature */ - setBufPos(mc); - *buf_pos = mc->buf_pos; - *buf_end = mc->buf_end; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_MessageContext_begin(UA_MessageContext *mc, UA_SecureChannel *channel, UA_UInt32 requestId, - UA_MessageType messageType) { - UA_Connection *connection = channel->connection; - if (!connection) return UA_STATUSCODE_BADINTERNALERROR; - - /* Create the chunking info structure */ - mc->channel = channel; - mc->requestId = requestId; - mc->chunksSoFar = 0; - mc->messageSizeSoFar = 0; - mc->final = false; - mc->messageBuffer = UA_BYTESTRING_NULL; - mc->messageType = messageType; - - /* Minimum required size */ - if (connection->localConf.sendBufferSize <= UA_SECURE_MESSAGE_HEADER_LENGTH) return UA_STATUSCODE_BADRESPONSETOOLARGE; - - /* Allocate the message buffer */ - UA_StatusCode retval = - connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &mc->messageBuffer); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Hide bytes for header, padding and signature */ - setBufPos(mc); - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_MessageContext_encode(UA_MessageContext *mc, const void *content, const UA_DataType *contentType) { - UA_StatusCode retval = - UA_encodeBinary(content, contentType, &mc->buf_pos, &mc->buf_end, sendSymmetricEncodingCallback, mc); - if (retval != UA_STATUSCODE_GOOD) { - /* TODO: Send the abort message */ - if (mc->messageBuffer.length > 0) { - UA_Connection *connection = mc->channel->connection; - connection->releaseSendBuffer(connection, &mc->messageBuffer); - } - } - return retval; -} - -UA_StatusCode UA_MessageContext_finish(UA_MessageContext *mc) { - mc->final = true; - return sendSymmetricChunk(mc); -} - -void UA_MessageContext_abort(UA_MessageContext *mc) { UA_ByteString_deleteMembers(&mc->messageBuffer); } - -UA_StatusCode UA_SecureChannel_sendSymmetricMessage(UA_SecureChannel *channel, UA_UInt32 requestId, - UA_MessageType messageType, void *payload, - const UA_DataType *payloadType) { - UA_MessageContext mc; - UA_StatusCode retval; - UA_NodeId typeId = UA_NODEID_NUMERIC(0, payloadType->binaryEncodingId); - retval = UA_MessageContext_begin(&mc, channel, requestId, UA_MESSAGETYPE_MSG); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Assert's required for clang-analyzer */ - UA_assert(mc.buf_pos == &mc.messageBuffer.data[UA_SECURE_MESSAGE_HEADER_LENGTH]); - UA_assert(mc.buf_end == &mc.messageBuffer.data[mc.messageBuffer.length]); - - retval |= UA_MessageContext_encode(&mc, &typeId, &UA_TYPES[UA_TYPES_NODEID]); - if (retval != UA_STATUSCODE_GOOD) return retval; - - retval |= UA_MessageContext_encode(&mc, payload, payloadType); - if (retval != UA_STATUSCODE_GOOD) return retval; - - return UA_MessageContext_finish(&mc); -} - -/*****************************/ -/* Assemble Complete Message */ -/*****************************/ - -static void UA_SecureChannel_removeChunks(UA_SecureChannel *channel, UA_UInt32 requestId) { - struct ChunkEntry *ch; - LIST_FOREACH(ch, &channel->chunks, pointers) { - if (ch->requestId == requestId) { - UA_ByteString_deleteMembers(&ch->bytes); - LIST_REMOVE(ch, pointers); - UA_free(ch); - return; - } - } -} - -static UA_StatusCode appendChunk(struct ChunkEntry *const chunkEntry, const UA_ByteString *const chunkBody) { - UA_Byte *new_bytes = (UA_Byte *)UA_realloc(chunkEntry->bytes.data, chunkEntry->bytes.length + chunkBody->length); - if (!new_bytes) { - UA_ByteString_deleteMembers(&chunkEntry->bytes); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - chunkEntry->bytes.data = new_bytes; - memcpy(&chunkEntry->bytes.data[chunkEntry->bytes.length], chunkBody->data, chunkBody->length); - chunkEntry->bytes.length += chunkBody->length; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode UA_SecureChannel_appendChunk(UA_SecureChannel *channel, UA_UInt32 requestId, - const UA_ByteString *chunkBody) { - struct ChunkEntry *ch; - LIST_FOREACH(ch, &channel->chunks, pointers) { - if (ch->requestId == requestId) break; - } - - /* No chunkentry on the channel, create one */ - if (!ch) { - ch = (struct ChunkEntry *)UA_malloc(sizeof(struct ChunkEntry)); - if (!ch) return UA_STATUSCODE_BADOUTOFMEMORY; - ch->requestId = requestId; - UA_ByteString_init(&ch->bytes); - LIST_INSERT_HEAD(&channel->chunks, ch, pointers); - } - - return appendChunk(ch, chunkBody); -} - -static UA_StatusCode UA_SecureChannel_finalizeChunk(UA_SecureChannel *channel, UA_UInt32 requestId, - const UA_ByteString *const chunkBody, UA_MessageType messageType, - UA_ProcessMessageCallback callback, void *application) { - struct ChunkEntry *chunkEntry; - LIST_FOREACH(chunkEntry, &channel->chunks, pointers) { - if (chunkEntry->requestId == requestId) break; - } - - UA_ByteString bytes; - if (!chunkEntry) { - bytes = *chunkBody; - } else { - UA_StatusCode retval = appendChunk(chunkEntry, chunkBody); - if (retval != UA_STATUSCODE_GOOD) return retval; - bytes = chunkEntry->bytes; - LIST_REMOVE(chunkEntry, pointers); - UA_free(chunkEntry); - } - - UA_StatusCode retval = callback(application, channel, messageType, requestId, &bytes); - if (chunkEntry) UA_ByteString_deleteMembers(&bytes); - return retval; -} - -/****************************/ -/* Process a received Chunk */ -/****************************/ - -static UA_StatusCode decryptChunk(UA_SecureChannel *channel, const UA_SecurityPolicyCryptoModule *cryptoModule, - UA_ByteString *chunk, size_t offset, UA_UInt32 *requestId, UA_UInt32 *sequenceNumber, - UA_ByteString *payload, UA_MessageType messageType) { - UA_StatusCode retval = UA_STATUSCODE_GOOD; - const UA_SecurityPolicy *securityPolicy = channel->securityPolicy; - size_t chunkSizeAfterDecryption = chunk->length; - - if (cryptoModule == NULL) return UA_STATUSCODE_BADINTERNALERROR; - - /* Decrypt the chunk. Always decrypt opn messages if mode not none */ - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT || messageType == UA_MESSAGETYPE_OPN) { - UA_ByteString cipherText = {chunk->length - offset, chunk->data + offset}; - size_t sizeBeforeDecryption = cipherText.length; - retval = cryptoModule->decrypt(securityPolicy, channel->channelContext, &cipherText); - chunkSizeAfterDecryption -= (sizeBeforeDecryption - cipherText.length); - if (retval != UA_STATUSCODE_GOOD) return retval; - } - - /* Verify the chunk signature */ - size_t sigsize = 0; - size_t paddingSize = 0; - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT || messageType == UA_MESSAGETYPE_OPN) { - /* Compute the padding size */ - sigsize = cryptoModule->getRemoteSignatureSize(securityPolicy, channel->channelContext); - - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT || - (messageType == UA_MESSAGETYPE_OPN && channel->securityMode != UA_MESSAGESECURITYMODE_NONE)) { - paddingSize = chunk->data[chunkSizeAfterDecryption - sigsize - 1]; - - size_t keyLength = cryptoModule->getRemoteEncryptionKeyLength(securityPolicy, channel->channelContext); - if (keyLength > 2048) { - paddingSize <<= 8; /* Extra padding size */ - paddingSize += chunk->data[chunkSizeAfterDecryption - sigsize - 2]; - } - } - if (offset + paddingSize + sigsize >= chunkSizeAfterDecryption) return UA_STATUSCODE_BADSECURITYCHECKSFAILED; - - /* Verify the signature */ - const UA_ByteString chunkDataToVerify = {chunkSizeAfterDecryption - sigsize, chunk->data}; - const UA_ByteString signature = {sigsize, chunk->data + chunkSizeAfterDecryption - sigsize}; - retval = cryptoModule->verify(securityPolicy, channel->channelContext, &chunkDataToVerify, &signature); -#ifdef UA_ENABLE_UNIT_TEST_FAILURE_HOOKS - retval |= decrypt_verifySignatureFailure; -#endif - if (retval != UA_STATUSCODE_GOOD) return retval; - } - - /* Decode the sequence header */ - UA_SequenceHeader sequenceHeader; - retval = UA_SequenceHeader_decodeBinary(chunk, &offset, &sequenceHeader); - if (retval != UA_STATUSCODE_GOOD) return retval; - - if (offset + paddingSize + sigsize >= chunk->length) return UA_STATUSCODE_BADSECURITYCHECKSFAILED; - - *requestId = sequenceHeader.requestId; - *sequenceNumber = sequenceHeader.sequenceNumber; - payload->data = chunk->data + offset; - payload->length = chunkSizeAfterDecryption - offset - sigsize - paddingSize; - return UA_STATUSCODE_GOOD; -} - -typedef UA_StatusCode (*UA_SequenceNumberCallback)(UA_SecureChannel *channel, UA_UInt32 sequenceNumber); - -static UA_StatusCode processSequenceNumberAsym(UA_SecureChannel *const channel, UA_UInt32 sequenceNumber) { - channel->receiveSequenceNumber = sequenceNumber; - - return UA_STATUSCODE_GOOD; -} - -// TODO: We somehow need to make sure that a sequence number is never reused for the same tokenId -static UA_StatusCode processSequenceNumberSym(UA_SecureChannel *const channel, UA_UInt32 sequenceNumber) { -/* Failure mode hook for unit tests */ -#ifdef UA_ENABLE_UNIT_TEST_FAILURE_HOOKS - if (processSym_seqNumberFailure != UA_STATUSCODE_GOOD) return processSym_seqNumberFailure; -#endif - - /* Does the sequence number match? */ - if (sequenceNumber != channel->receiveSequenceNumber + 1) { - if (channel->receiveSequenceNumber + 1 > 4294966271 && sequenceNumber < 1024) // FIXME: Remove magic numbers :( - channel->receiveSequenceNumber = sequenceNumber - 1; /* Roll over */ - else - return UA_STATUSCODE_BADSECURITYCHECKSFAILED; - } - ++channel->receiveSequenceNumber; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode checkAsymHeader(UA_SecureChannel *const channel, - UA_AsymmetricAlgorithmSecurityHeader *const asymHeader) { - UA_StatusCode retval = UA_STATUSCODE_GOOD; - const UA_SecurityPolicy *const securityPolicy = channel->securityPolicy; - - if (!UA_ByteString_equal(&securityPolicy->policyUri, &asymHeader->securityPolicyUri)) { - return UA_STATUSCODE_BADSECURITYPOLICYREJECTED; - } - - // TODO: Verify certificate using certificate plugin. This will come with a new PR - /* Something like this - retval = certificateManager->verify(certificateStore??, &asymHeader->senderCertificate); - if(retval != UA_STATUSCODE_GOOD) - return retval; - */ - retval = securityPolicy->asymmetricModule.compareCertificateThumbprint(securityPolicy, - &asymHeader->receiverCertificateThumbprint); - if (retval != UA_STATUSCODE_GOOD) { - return retval; - } - - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode checkSymHeader(UA_SecureChannel *const channel, const UA_UInt32 tokenId) { - if (tokenId != channel->securityToken.tokenId) { - if (tokenId != channel->nextSecurityToken.tokenId) return UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN; - return UA_SecureChannel_revolveTokens(channel); - } - - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_SecureChannel_processChunk(UA_SecureChannel *channel, UA_ByteString *chunk, - UA_ProcessMessageCallback callback, void *application) { - /* Decode message header */ - size_t offset = 0; - UA_SecureConversationMessageHeader messageHeader; - UA_StatusCode retval = UA_SecureConversationMessageHeader_decodeBinary(chunk, &offset, &messageHeader); - if (retval != UA_STATUSCODE_GOOD) return retval; - -#if !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) - /* The wrong ChannelId. Non-opened channels have the id zero. */ - if (messageHeader.secureChannelId != channel->securityToken.channelId && - channel->state != UA_SECURECHANNELSTATE_FRESH) - return UA_STATUSCODE_BADSECURECHANNELIDINVALID; -#endif - - UA_MessageType messageType = - (UA_MessageType)(messageHeader.messageHeader.messageTypeAndChunkType & UA_BITMASK_MESSAGETYPE); - UA_ChunkType chunkType = (UA_ChunkType)(messageHeader.messageHeader.messageTypeAndChunkType & UA_BITMASK_CHUNKTYPE); - - /* ERR message (not encrypted) */ - UA_UInt32 requestId = 0; - UA_UInt32 sequenceNumber = 0; - UA_ByteString chunkPayload; - const UA_SecurityPolicyCryptoModule *cryptoModule = NULL; - UA_SequenceNumberCallback sequenceNumberCallback = NULL; - - switch (messageType) { - case UA_MESSAGETYPE_ERR: { - if (chunkType != UA_CHUNKTYPE_FINAL) return UA_STATUSCODE_BADTCPMESSAGETYPEINVALID; - chunkPayload.length = chunk->length - offset; - chunkPayload.data = chunk->data + offset; - return callback(application, channel, messageType, requestId, &chunkPayload); - } - - case UA_MESSAGETYPE_MSG: - case UA_MESSAGETYPE_CLO: { - /* Decode and check the symmetric security header (tokenId) */ - UA_SymmetricAlgorithmSecurityHeader symmetricSecurityHeader; - UA_SymmetricAlgorithmSecurityHeader_init(&symmetricSecurityHeader); - retval = UA_SymmetricAlgorithmSecurityHeader_decodeBinary(chunk, &offset, &symmetricSecurityHeader); - if (retval != UA_STATUSCODE_GOOD) return retval; - -#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION - // let's help fuzzing by setting the correct tokenId - symmetricSecurityHeader.tokenId = channel->securityToken.tokenId; -#endif - - retval = checkSymHeader(channel, symmetricSecurityHeader.tokenId); - if (retval != UA_STATUSCODE_GOOD) return retval; - - cryptoModule = &channel->securityPolicy->symmetricModule.cryptoModule; - sequenceNumberCallback = processSequenceNumberSym; - - break; - } - case UA_MESSAGETYPE_OPN: { - /* Chunking not allowed for OPN */ - if (chunkType != UA_CHUNKTYPE_FINAL) return UA_STATUSCODE_BADTCPMESSAGETYPEINVALID; - - // Decode the asymmetric algorithm security header and - // call the callback to perform checks. - UA_AsymmetricAlgorithmSecurityHeader asymHeader; - UA_AsymmetricAlgorithmSecurityHeader_init(&asymHeader); - offset = UA_SECURE_CONVERSATION_MESSAGE_HEADER_LENGTH; - retval = UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(chunk, &offset, &asymHeader); - if (retval != UA_STATUSCODE_GOOD) break; - - retval = checkAsymHeader(channel, &asymHeader); - UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader); - if (retval != UA_STATUSCODE_GOOD) break; - - cryptoModule = &channel->securityPolicy->asymmetricModule.cryptoModule; - sequenceNumberCallback = processSequenceNumberAsym; - - break; - } - default: - return UA_STATUSCODE_BADTCPMESSAGETYPEINVALID; - } - - /* Decrypt message */ - retval = decryptChunk(channel, cryptoModule, chunk, offset, &requestId, &sequenceNumber, &chunkPayload, messageType); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Check the sequence number */ - if (sequenceNumberCallback == NULL) return UA_STATUSCODE_BADINTERNALERROR; - retval = sequenceNumberCallback(channel, sequenceNumber); - - /* Skip sequence number checking for fuzzer to improve coverage */ - if (retval != UA_STATUSCODE_GOOD) { -#if !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) - return retval; -#else - retval = UA_STATUSCODE_GOOD; -#endif - } - - /* Process the payload */ - if (chunkType == UA_CHUNKTYPE_FINAL) { - retval = UA_SecureChannel_finalizeChunk(channel, requestId, &chunkPayload, messageType, callback, application); - } else if (chunkType == UA_CHUNKTYPE_INTERMEDIATE) { - retval = UA_SecureChannel_appendChunk(channel, requestId, &chunkPayload); - } else if (chunkType == UA_CHUNKTYPE_ABORT) { - UA_SecureChannel_removeChunks(channel, requestId); - } else { - retval = UA_STATUSCODE_BADTCPMESSAGETYPEINVALID; - } - return retval; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_nodes.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* There is no UA_Node_new() method here. Creating nodes is part of the - * NodeStore layer */ - -void UA_Node_deleteMembers(UA_Node *node) { - /* Delete standard content */ - UA_NodeId_deleteMembers(&node->nodeId); - UA_QualifiedName_deleteMembers(&node->browseName); - UA_LocalizedText_deleteMembers(&node->displayName); - UA_LocalizedText_deleteMembers(&node->description); - - /* Delete references */ - UA_Node_deleteReferences(node); - - /* Delete unique content of the nodeclass */ - switch (node->nodeClass) { - case UA_NODECLASS_OBJECT: - break; - case UA_NODECLASS_METHOD: - break; - case UA_NODECLASS_OBJECTTYPE: - break; - case UA_NODECLASS_VARIABLE: - case UA_NODECLASS_VARIABLETYPE: { - UA_VariableNode *p = (UA_VariableNode *)node; - UA_NodeId_deleteMembers(&p->dataType); - UA_Array_delete(p->arrayDimensions, p->arrayDimensionsSize, &UA_TYPES[UA_TYPES_INT32]); - p->arrayDimensions = NULL; - p->arrayDimensionsSize = 0; - if (p->valueSource == UA_VALUESOURCE_DATA) UA_DataValue_deleteMembers(&p->value.data.value); - break; - } - case UA_NODECLASS_REFERENCETYPE: { - UA_ReferenceTypeNode *p = (UA_ReferenceTypeNode *)node; - UA_LocalizedText_deleteMembers(&p->inverseName); - break; - } - case UA_NODECLASS_DATATYPE: - break; - case UA_NODECLASS_VIEW: - break; - default: - break; - } -} - -static UA_StatusCode UA_ObjectNode_copy(const UA_ObjectNode *src, UA_ObjectNode *dst) { - dst->eventNotifier = src->eventNotifier; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode UA_CommonVariableNode_copy(const UA_VariableNode *src, UA_VariableNode *dst) { - UA_StatusCode retval = UA_Array_copy(src->arrayDimensions, src->arrayDimensionsSize, (void **)&dst->arrayDimensions, - &UA_TYPES[UA_TYPES_INT32]); - if (retval != UA_STATUSCODE_GOOD) return retval; - dst->arrayDimensionsSize = src->arrayDimensionsSize; - retval = UA_NodeId_copy(&src->dataType, &dst->dataType); - dst->valueRank = src->valueRank; - dst->valueSource = src->valueSource; - if (src->valueSource == UA_VALUESOURCE_DATA) { - retval |= UA_DataValue_copy(&src->value.data.value, &dst->value.data.value); - dst->value.data.callback = src->value.data.callback; - } else - dst->value.dataSource = src->value.dataSource; - return retval; -} - -static UA_StatusCode UA_VariableNode_copy(const UA_VariableNode *src, UA_VariableNode *dst) { - UA_StatusCode retval = UA_CommonVariableNode_copy(src, dst); - dst->accessLevel = src->accessLevel; - dst->minimumSamplingInterval = src->minimumSamplingInterval; - dst->historizing = src->historizing; - return retval; -} - -static UA_StatusCode UA_VariableTypeNode_copy(const UA_VariableTypeNode *src, UA_VariableTypeNode *dst) { - UA_StatusCode retval = UA_CommonVariableNode_copy((const UA_VariableNode *)src, (UA_VariableNode *)dst); - dst->isAbstract = src->isAbstract; - return retval; -} - -static UA_StatusCode UA_MethodNode_copy(const UA_MethodNode *src, UA_MethodNode *dst) { - dst->executable = src->executable; - dst->method = src->method; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode UA_ObjectTypeNode_copy(const UA_ObjectTypeNode *src, UA_ObjectTypeNode *dst) { - dst->isAbstract = src->isAbstract; - dst->lifecycle = src->lifecycle; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode UA_ReferenceTypeNode_copy(const UA_ReferenceTypeNode *src, UA_ReferenceTypeNode *dst) { - UA_StatusCode retval = UA_LocalizedText_copy(&src->inverseName, &dst->inverseName); - dst->isAbstract = src->isAbstract; - dst->symmetric = src->symmetric; - return retval; -} - -static UA_StatusCode UA_DataTypeNode_copy(const UA_DataTypeNode *src, UA_DataTypeNode *dst) { - dst->isAbstract = src->isAbstract; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode UA_ViewNode_copy(const UA_ViewNode *src, UA_ViewNode *dst) { - dst->containsNoLoops = src->containsNoLoops; - dst->eventNotifier = src->eventNotifier; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Node_copy(const UA_Node *src, UA_Node *dst) { - if (src->nodeClass != dst->nodeClass) return UA_STATUSCODE_BADINTERNALERROR; - - /* Copy standard content */ - UA_StatusCode retval = UA_NodeId_copy(&src->nodeId, &dst->nodeId); - retval |= UA_QualifiedName_copy(&src->browseName, &dst->browseName); - retval |= UA_LocalizedText_copy(&src->displayName, &dst->displayName); - retval |= UA_LocalizedText_copy(&src->description, &dst->description); - dst->writeMask = src->writeMask; - dst->context = src->context; - if (retval != UA_STATUSCODE_GOOD) { - UA_Node_deleteMembers(dst); - return retval; - } - - /* Copy the references */ - dst->references = NULL; - if (src->referencesSize > 0) { - dst->references = (UA_NodeReferenceKind *)UA_calloc(src->referencesSize, sizeof(UA_NodeReferenceKind)); - if (!dst->references) { - UA_Node_deleteMembers(dst); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - dst->referencesSize = src->referencesSize; - - for (size_t i = 0; i < src->referencesSize; ++i) { - UA_NodeReferenceKind *srefs = &src->references[i]; - UA_NodeReferenceKind *drefs = &dst->references[i]; - drefs->isInverse = srefs->isInverse; - retval = UA_NodeId_copy(&srefs->referenceTypeId, &drefs->referenceTypeId); - if (retval != UA_STATUSCODE_GOOD) break; - retval = UA_Array_copy(srefs->targetIds, srefs->targetIdsSize, (void **)&drefs->targetIds, - &UA_TYPES[UA_TYPES_EXPANDEDNODEID]); - if (retval != UA_STATUSCODE_GOOD) break; - drefs->targetIdsSize = srefs->targetIdsSize; - } - if (retval != UA_STATUSCODE_GOOD) { - UA_Node_deleteMembers(dst); - return retval; - } - } - - /* Copy unique content of the nodeclass */ - switch (src->nodeClass) { - case UA_NODECLASS_OBJECT: - retval = UA_ObjectNode_copy((const UA_ObjectNode *)src, (UA_ObjectNode *)dst); - break; - case UA_NODECLASS_VARIABLE: - retval = UA_VariableNode_copy((const UA_VariableNode *)src, (UA_VariableNode *)dst); - break; - case UA_NODECLASS_METHOD: - retval = UA_MethodNode_copy((const UA_MethodNode *)src, (UA_MethodNode *)dst); - break; - case UA_NODECLASS_OBJECTTYPE: - retval = UA_ObjectTypeNode_copy((const UA_ObjectTypeNode *)src, (UA_ObjectTypeNode *)dst); - break; - case UA_NODECLASS_VARIABLETYPE: - retval = UA_VariableTypeNode_copy((const UA_VariableTypeNode *)src, (UA_VariableTypeNode *)dst); - break; - case UA_NODECLASS_REFERENCETYPE: - retval = UA_ReferenceTypeNode_copy((const UA_ReferenceTypeNode *)src, (UA_ReferenceTypeNode *)dst); - break; - case UA_NODECLASS_DATATYPE: - retval = UA_DataTypeNode_copy((const UA_DataTypeNode *)src, (UA_DataTypeNode *)dst); - break; - case UA_NODECLASS_VIEW: - retval = UA_ViewNode_copy((const UA_ViewNode *)src, (UA_ViewNode *)dst); - break; - default: - break; - } - - if (retval != UA_STATUSCODE_GOOD) UA_Node_deleteMembers(dst); - - return retval; -} - -UA_Node *UA_Node_copy_alloc(const UA_Node *src) { - // use dstPtr to trick static code analysis in accepting dirty cast - void *dstPtr; - switch (src->nodeClass) { - case UA_NODECLASS_OBJECT: - dstPtr = UA_malloc(sizeof(UA_ObjectNode)); - break; - case UA_NODECLASS_VARIABLE: - dstPtr = UA_malloc(sizeof(UA_VariableNode)); - break; - case UA_NODECLASS_METHOD: - dstPtr = UA_malloc(sizeof(UA_MethodNode)); - break; - case UA_NODECLASS_OBJECTTYPE: - dstPtr = UA_malloc(sizeof(UA_ObjectTypeNode)); - break; - case UA_NODECLASS_VARIABLETYPE: - dstPtr = UA_malloc(sizeof(UA_VariableTypeNode)); - break; - case UA_NODECLASS_REFERENCETYPE: - dstPtr = UA_malloc(sizeof(UA_ReferenceTypeNode)); - break; - case UA_NODECLASS_DATATYPE: - dstPtr = UA_malloc(sizeof(UA_DataTypeNode)); - break; - case UA_NODECLASS_VIEW: - dstPtr = UA_malloc(sizeof(UA_ViewNode)); - break; - default: - return NULL; - } - UA_Node *dst = (UA_Node *)dstPtr; - dst->nodeClass = src->nodeClass; - - UA_StatusCode retval = UA_Node_copy(src, dst); - if (retval != UA_STATUSCODE_GOOD) { - UA_free(dst); - return NULL; - } - return dst; -} -/******************************/ -/* Copy Attributes into Nodes */ -/******************************/ - -static UA_StatusCode copyStandardAttributes(UA_Node *node, const UA_NodeAttributes *attr) { - /* retval = UA_NodeId_copy(&item->requestedNewNodeId.nodeId, &node->nodeId); */ - /* retval |= UA_QualifiedName_copy(&item->browseName, &node->browseName); */ - UA_StatusCode retval = UA_LocalizedText_copy(&attr->displayName, &node->displayName); - retval |= UA_LocalizedText_copy(&attr->description, &node->description); - node->writeMask = attr->writeMask; - return retval; -} - -static UA_StatusCode copyCommonVariableAttributes(UA_VariableNode *node, const UA_VariableAttributes *attr) { - /* Copy the array dimensions */ - UA_StatusCode retval = UA_Array_copy(attr->arrayDimensions, attr->arrayDimensionsSize, - (void **)&node->arrayDimensions, &UA_TYPES[UA_TYPES_UINT32]); - if (retval != UA_STATUSCODE_GOOD) return retval; - node->arrayDimensionsSize = attr->arrayDimensionsSize; - - /* Data type and value rank */ - retval |= UA_NodeId_copy(&attr->dataType, &node->dataType); - node->valueRank = attr->valueRank; - - /* Copy the value */ - node->valueSource = UA_VALUESOURCE_DATA; - UA_NodeId extensionObject = UA_NODEID_NUMERIC(0, UA_NS0ID_STRUCTURE); - /* if we have an extension object which is still encoded (e.g. from the nodeset compiler) - * we need to decode it and set the decoded value instead of the encoded object */ - UA_Boolean valueSet = false; - if (attr->value.type != NULL && UA_NodeId_equal(&attr->value.type->typeId, &extensionObject)) { - const UA_ExtensionObject *obj = (const UA_ExtensionObject *)attr->value.data; - if (obj->encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) { - /* TODO: Once we generate type description in the nodeset compiler, - * UA_findDatatypeByBinary can be made internal to the decoding - * layer. */ - const UA_DataType *type = UA_findDataTypeByBinary(&obj->content.encoded.typeId); - - if (type) { - void *dst = UA_Array_new(attr->value.arrayLength, type); - uint8_t *tmpPos = (uint8_t *)dst; - - for (size_t i = 0; i < attr->value.arrayLength; i++) { - size_t offset = 0; - const UA_ExtensionObject *curr = &((const UA_ExtensionObject *)attr->value.data)[i]; - UA_StatusCode ret = UA_decodeBinary(&curr->content.encoded.body, &offset, tmpPos, type, 0, NULL); - if (ret != UA_STATUSCODE_GOOD) { - return ret; - } - tmpPos += type->memSize; - } - - UA_Variant_setArray(&node->value.data.value.value, dst, attr->value.arrayLength, type); - valueSet = true; - } - } - } - - if (!valueSet) retval |= UA_Variant_copy(&attr->value, &node->value.data.value.value); - - node->value.data.value.hasValue = true; - - return retval; -} - -static UA_StatusCode copyVariableNodeAttributes(UA_VariableNode *vnode, const UA_VariableAttributes *attr) { - vnode->accessLevel = attr->accessLevel; - vnode->historizing = attr->historizing; - vnode->minimumSamplingInterval = attr->minimumSamplingInterval; - return copyCommonVariableAttributes(vnode, attr); -} - -static UA_StatusCode copyVariableTypeNodeAttributes(UA_VariableTypeNode *vtnode, - const UA_VariableTypeAttributes *attr) { - vtnode->isAbstract = attr->isAbstract; - return copyCommonVariableAttributes((UA_VariableNode *)vtnode, (const UA_VariableAttributes *)attr); -} - -static UA_StatusCode copyObjectNodeAttributes(UA_ObjectNode *onode, const UA_ObjectAttributes *attr) { - onode->eventNotifier = attr->eventNotifier; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode copyReferenceTypeNodeAttributes(UA_ReferenceTypeNode *rtnode, - const UA_ReferenceTypeAttributes *attr) { - rtnode->isAbstract = attr->isAbstract; - rtnode->symmetric = attr->symmetric; - return UA_LocalizedText_copy(&attr->inverseName, &rtnode->inverseName); -} - -static UA_StatusCode copyObjectTypeNodeAttributes(UA_ObjectTypeNode *otnode, const UA_ObjectTypeAttributes *attr) { - otnode->isAbstract = attr->isAbstract; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode copyViewNodeAttributes(UA_ViewNode *vnode, const UA_ViewAttributes *attr) { - vnode->containsNoLoops = attr->containsNoLoops; - vnode->eventNotifier = attr->eventNotifier; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode copyDataTypeNodeAttributes(UA_DataTypeNode *dtnode, const UA_DataTypeAttributes *attr) { - dtnode->isAbstract = attr->isAbstract; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode copyMethodNodeAttributes(UA_MethodNode *mnode, const UA_MethodAttributes *attr) { - mnode->executable = attr->executable; - return UA_STATUSCODE_GOOD; -} - -#define CHECK_ATTRIBUTES(TYPE) \ - if (attributeType != &UA_TYPES[UA_TYPES_##TYPE]) { \ - retval = UA_STATUSCODE_BADNODEATTRIBUTESINVALID; \ - break; \ - } - -UA_StatusCode UA_Node_setAttributes(UA_Node *node, const void *attributes, const UA_DataType *attributeType) { - /* Copy the attributes into the node */ - UA_StatusCode retval = UA_STATUSCODE_GOOD; - switch (node->nodeClass) { - case UA_NODECLASS_OBJECT: - CHECK_ATTRIBUTES(OBJECTATTRIBUTES); - retval = copyObjectNodeAttributes((UA_ObjectNode *)node, (const UA_ObjectAttributes *)attributes); - break; - case UA_NODECLASS_VARIABLE: - CHECK_ATTRIBUTES(VARIABLEATTRIBUTES); - retval = copyVariableNodeAttributes((UA_VariableNode *)node, (const UA_VariableAttributes *)attributes); - break; - case UA_NODECLASS_OBJECTTYPE: - CHECK_ATTRIBUTES(OBJECTTYPEATTRIBUTES); - retval = copyObjectTypeNodeAttributes((UA_ObjectTypeNode *)node, (const UA_ObjectTypeAttributes *)attributes); - break; - case UA_NODECLASS_VARIABLETYPE: - CHECK_ATTRIBUTES(VARIABLETYPEATTRIBUTES); - retval = - copyVariableTypeNodeAttributes((UA_VariableTypeNode *)node, (const UA_VariableTypeAttributes *)attributes); - break; - case UA_NODECLASS_REFERENCETYPE: - CHECK_ATTRIBUTES(REFERENCETYPEATTRIBUTES); - retval = - copyReferenceTypeNodeAttributes((UA_ReferenceTypeNode *)node, (const UA_ReferenceTypeAttributes *)attributes); - break; - case UA_NODECLASS_DATATYPE: - CHECK_ATTRIBUTES(DATATYPEATTRIBUTES); - retval = copyDataTypeNodeAttributes((UA_DataTypeNode *)node, (const UA_DataTypeAttributes *)attributes); - break; - case UA_NODECLASS_VIEW: - CHECK_ATTRIBUTES(VIEWATTRIBUTES); - retval = copyViewNodeAttributes((UA_ViewNode *)node, (const UA_ViewAttributes *)attributes); - break; - case UA_NODECLASS_METHOD: - CHECK_ATTRIBUTES(METHODATTRIBUTES); - retval = copyMethodNodeAttributes((UA_MethodNode *)node, (const UA_MethodAttributes *)attributes); - break; - case UA_NODECLASS_UNSPECIFIED: - default: - retval = UA_STATUSCODE_BADNODECLASSINVALID; - } - - if (retval == UA_STATUSCODE_GOOD) retval = copyStandardAttributes(node, (const UA_NodeAttributes *)attributes); - if (retval != UA_STATUSCODE_GOOD) UA_Node_deleteMembers(node); - return retval; -} - -/*********************/ -/* Manage References */ -/*********************/ - -static UA_StatusCode addReferenceTarget(UA_NodeReferenceKind *refs, const UA_ExpandedNodeId *target) { - UA_ExpandedNodeId *targets = - (UA_ExpandedNodeId *)UA_realloc(refs->targetIds, sizeof(UA_ExpandedNodeId) * (refs->targetIdsSize + 1)); - if (!targets) return UA_STATUSCODE_BADOUTOFMEMORY; - - refs->targetIds = targets; - UA_StatusCode retval = UA_ExpandedNodeId_copy(target, &refs->targetIds[refs->targetIdsSize]); - - if (retval == UA_STATUSCODE_GOOD) { - refs->targetIdsSize++; - } else if (refs->targetIdsSize == 0) { - /* We had zero references before (realloc was a malloc) */ - UA_free(refs->targetIds); - refs->targetIds = NULL; - } - return retval; -} - -static UA_StatusCode addReferenceKind(UA_Node *node, const UA_AddReferencesItem *item) { - UA_NodeReferenceKind *refs = - (UA_NodeReferenceKind *)UA_realloc(node->references, sizeof(UA_NodeReferenceKind) * (node->referencesSize + 1)); - if (!refs) return UA_STATUSCODE_BADOUTOFMEMORY; - node->references = refs; - UA_NodeReferenceKind *newRef = &refs[node->referencesSize]; - memset(newRef, 0, sizeof(UA_NodeReferenceKind)); - - newRef->isInverse = !item->isForward; - UA_StatusCode retval = UA_NodeId_copy(&item->referenceTypeId, &newRef->referenceTypeId); - retval |= addReferenceTarget(newRef, &item->targetNodeId); - - if (retval == UA_STATUSCODE_GOOD) { - node->referencesSize++; - } else { - UA_NodeId_deleteMembers(&newRef->referenceTypeId); - if (node->referencesSize == 0) { - UA_free(node->references); - node->references = NULL; - } - } - return retval; -} - -UA_StatusCode UA_Node_addReference(UA_Node *node, const UA_AddReferencesItem *item) { - for (size_t i = 0; i < node->referencesSize; ++i) { - UA_NodeReferenceKind *refs = &node->references[i]; - if (refs->isInverse == item->isForward) continue; - if (!UA_NodeId_equal(&refs->referenceTypeId, &item->referenceTypeId)) continue; - return addReferenceTarget(refs, &item->targetNodeId); - } - return addReferenceKind(node, item); -} - -UA_StatusCode UA_Node_deleteReference(UA_Node *node, const UA_DeleteReferencesItem *item) { - for (size_t i = node->referencesSize; i > 0; --i) { - UA_NodeReferenceKind *refs = &node->references[i - 1]; - if (item->isForward == refs->isInverse) continue; - if (!UA_NodeId_equal(&item->referenceTypeId, &refs->referenceTypeId)) continue; - - for (size_t j = refs->targetIdsSize; j > 0; --j) { - if (!UA_NodeId_equal(&item->targetNodeId.nodeId, &refs->targetIds[j - 1].nodeId)) continue; - - /* Ok, delete the reference */ - UA_ExpandedNodeId_deleteMembers(&refs->targetIds[j - 1]); - refs->targetIdsSize--; - - /* One matching target remaining */ - if (refs->targetIdsSize > 0) { - if (j - 1 != refs->targetIdsSize) // avoid valgrind error: Source - // and destination overlap in - // memcpy - refs->targetIds[j - 1] = refs->targetIds[refs->targetIdsSize]; - return UA_STATUSCODE_GOOD; - } - - /* Remove refs */ - UA_free(refs->targetIds); - UA_NodeId_deleteMembers(&refs->referenceTypeId); - node->referencesSize--; - if (node->referencesSize > 0) { - if (i - 1 != node->referencesSize) // avoid valgrind error: Source - // and destination overlap in - // memcpy - node->references[i - 1] = node->references[node->referencesSize]; - return UA_STATUSCODE_GOOD; - } - - /* Remove the node references */ - UA_free(node->references); - node->references = NULL; - return UA_STATUSCODE_GOOD; - } - } - return UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED; -} - -void UA_Node_deleteReferences(UA_Node *node) { - for (size_t i = 0; i < node->referencesSize; ++i) { - UA_NodeReferenceKind *refs = &node->references[i]; - UA_Array_delete(refs->targetIds, refs->targetIdsSize, &UA_TYPES[UA_TYPES_EXPANDEDNODEID]); - UA_NodeId_deleteMembers(&refs->referenceTypeId); - } - if (node->references) UA_free(node->references); - node->references = NULL; - node->referencesSize = 0; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_server.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef UA_ENABLE_GENERATE_NAMESPACE0 -#endif - -/**********************/ -/* Namespace Handling */ -/**********************/ - -UA_UInt16 addNamespace(UA_Server *server, const UA_String name) { - /* Check if the namespace already exists in the server's namespace array */ - for (UA_UInt16 i = 0; i < server->namespacesSize; ++i) { - if (UA_String_equal(&name, &server->namespaces[i])) return i; - } - - /* Make the array bigger */ - UA_String *newNS = (UA_String *)UA_realloc(server->namespaces, sizeof(UA_String) * (server->namespacesSize + 1)); - if (!newNS) return 0; - server->namespaces = newNS; - - /* Copy the namespace string */ - UA_StatusCode retval = UA_String_copy(&name, &server->namespaces[server->namespacesSize]); - if (retval != UA_STATUSCODE_GOOD) return 0; - - /* Announce the change (otherwise, the array appears unchanged) */ - ++server->namespacesSize; - return (UA_UInt16)(server->namespacesSize - 1); -} - -UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char *name) { - /* Override const attribute to get string (dirty hack) */ - UA_String nameString; - nameString.length = strlen(name); - nameString.data = (UA_Byte *)(uintptr_t)name; - return addNamespace(server, nameString); -} - -UA_StatusCode UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId, - UA_NodeIteratorCallback callback, void *handle) { - const UA_Node *parent = server->config.nodestore.getNode(server->config.nodestore.context, &parentNodeId); - if (!parent) return UA_STATUSCODE_BADNODEIDINVALID; - - /* TODO: We need to do an ugly copy of the references array since users may - * delete references from within the callback. In single-threaded mode this - * changes the same node we point at here. In multi-threaded mode, this - * creates a new copy as nodes are truly immutable. - * The callback could remove a node via the regular public API. - * This can remove a member of the nodes-array we iterate over... - * */ - UA_Node *parentCopy = UA_Node_copy_alloc(parent); - if (!parentCopy) { - server->config.nodestore.releaseNode(server->config.nodestore.context, parent); - return UA_STATUSCODE_BADUNEXPECTEDERROR; - } - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - for (size_t i = parentCopy->referencesSize; i > 0; --i) { - UA_NodeReferenceKind *ref = &parentCopy->references[i - 1]; - for (size_t j = 0; j < ref->targetIdsSize; j++) - retval |= callback(ref->targetIds[j].nodeId, ref->isInverse, ref->referenceTypeId, handle); - } - UA_Node_deleteMembers(parentCopy); - UA_free(parentCopy); - - server->config.nodestore.releaseNode(server->config.nodestore.context, parent); - return retval; -} - -/********************/ -/* Server Lifecycle */ -/********************/ - -/* The server needs to be stopped before it can be deleted */ -void UA_Server_delete(UA_Server *server) { - /* Delete all internal data */ - UA_SecureChannelManager_deleteMembers(&server->secureChannelManager); - UA_SessionManager_deleteMembers(&server->sessionManager); - UA_Array_delete(server->namespaces, server->namespacesSize, &UA_TYPES[UA_TYPES_STRING]); - -#ifdef UA_ENABLE_DISCOVERY - registeredServer_list_entry *rs, *rs_tmp; - LIST_FOREACH_SAFE(rs, &server->registeredServers, pointers, rs_tmp) { - LIST_REMOVE(rs, pointers); - UA_RegisteredServer_deleteMembers(&rs->registeredServer); - UA_free(rs); - } - periodicServerRegisterCallback_entry *ps, *ps_tmp; - LIST_FOREACH_SAFE(ps, &server->periodicServerRegisterCallbacks, pointers, ps_tmp) { - LIST_REMOVE(ps, pointers); - UA_free(ps->callback); - UA_free(ps); - } - -#ifdef UA_ENABLE_DISCOVERY_MULTICAST - if (server->config.applicationDescription.applicationType == UA_APPLICATIONTYPE_DISCOVERYSERVER) - destroyMulticastDiscoveryServer(server); - - serverOnNetwork_list_entry *son, *son_tmp; - LIST_FOREACH_SAFE(son, &server->serverOnNetwork, pointers, son_tmp) { - LIST_REMOVE(son, pointers); - UA_ServerOnNetwork_deleteMembers(&son->serverOnNetwork); - if (son->pathTmp) UA_free(son->pathTmp); - UA_free(son); - } - - for (size_t i = 0; i < SERVER_ON_NETWORK_HASH_PRIME; i++) { - serverOnNetwork_hash_entry *currHash = server->serverOnNetworkHash[i]; - while (currHash) { - serverOnNetwork_hash_entry *nextHash = currHash->next; - UA_free(currHash); - currHash = nextHash; - } - } -#endif - -#endif - -#ifdef UA_ENABLE_MULTITHREADING - pthread_cond_destroy(&server->dispatchQueue_condition); - pthread_mutex_destroy(&server->dispatchQueue_mutex); -#endif - - /* Delete the timed work */ - UA_Timer_deleteMembers(&server->timer); - - /* Delete the server itself */ - UA_free(server); -} - -/* Recurring cleanup. Removing unused and timed-out channels and sessions */ -static void UA_Server_cleanup(UA_Server *server, void *_) { - UA_DateTime nowMonotonic = UA_DateTime_nowMonotonic(); - UA_SessionManager_cleanupTimedOut(&server->sessionManager, nowMonotonic); - UA_SecureChannelManager_cleanupTimedOut(&server->secureChannelManager, nowMonotonic); -#ifdef UA_ENABLE_DISCOVERY - UA_Discovery_cleanupTimedOut(server, nowMonotonic); -#endif -} - -/********************/ -/* Server Lifecycle */ -/********************/ - -UA_Server *UA_Server_new(const UA_ServerConfig *config) { - UA_Server *server = (UA_Server *)UA_calloc(1, sizeof(UA_Server)); - if (!server) return NULL; - - if (config->endpointsSize == 0) { - UA_LOG_FATAL(config->logger, UA_LOGCATEGORY_SERVER, "There has to be at least one endpoint."); - UA_free(server); - return NULL; - } - - server->config = *config; - - /* Init start time to zero, the actual start time will be sampled in - * UA_Server_run_startup() */ - server->startTime = 0; - -/* Set a seed for non-cyptographic randomness */ -#ifndef UA_ENABLE_DETERMINISTIC_RNG - UA_random_seed((UA_UInt64)UA_DateTime_now()); -#endif - - /* Initialize the handling of repeated callbacks */ - UA_Timer_init(&server->timer); - -/* Initialized the linked list for delayed callbacks */ -#ifndef UA_ENABLE_MULTITHREADING - SLIST_INIT(&server->delayedCallbacks); -#endif - -/* Initialized the dispatch queue for worker threads */ -#ifdef UA_ENABLE_MULTITHREADING - cds_wfcq_init(&server->dispatchQueue_head, &server->dispatchQueue_tail); -#endif - - /* Create Namespaces 0 and 1 */ - server->namespaces = (UA_String *)UA_Array_new(2, &UA_TYPES[UA_TYPES_STRING]); - server->namespaces[0] = UA_STRING_ALLOC("http://opcfoundation.org/UA/"); - UA_String_copy(&server->config.applicationDescription.applicationUri, &server->namespaces[1]); - server->namespacesSize = 2; - - /* Initialized SecureChannel and Session managers */ - UA_SecureChannelManager_init(&server->secureChannelManager, server); - UA_SessionManager_init(&server->sessionManager, server); - - /* Add a regular callback for cleanup and maintenance */ - UA_Server_addRepeatedCallback(server, (UA_ServerCallback)UA_Server_cleanup, NULL, 10000, NULL); - -/* Initialized discovery database */ -#ifdef UA_ENABLE_DISCOVERY - LIST_INIT(&server->registeredServers); - server->registeredServersSize = 0; - LIST_INIT(&server->periodicServerRegisterCallbacks); - server->registerServerCallback = NULL; - server->registerServerCallbackData = NULL; -#endif - -/* Initialize multicast discovery */ -#if defined(UA_ENABLE_DISCOVERY) && defined(UA_ENABLE_DISCOVERY_MULTICAST) - server->mdnsDaemon = NULL; -#ifdef _WIN32 - server->mdnsSocket = INVALID_SOCKET; -#else - server->mdnsSocket = -1; -#endif - server->mdnsMainSrvAdded = UA_FALSE; - if (server->config.applicationDescription.applicationType == UA_APPLICATIONTYPE_DISCOVERYSERVER) - initMulticastDiscoveryServer(server); - - LIST_INIT(&server->serverOnNetwork); - server->serverOnNetworkSize = 0; - server->serverOnNetworkRecordIdCounter = 0; - server->serverOnNetworkRecordIdLastReset = UA_DateTime_now(); - memset(server->serverOnNetworkHash, 0, sizeof(struct serverOnNetwork_hash_entry *) * SERVER_ON_NETWORK_HASH_PRIME); - - server->serverOnNetworkCallback = NULL; - server->serverOnNetworkCallbackData = NULL; -#endif - - /* Initialize namespace 0*/ - UA_StatusCode retVal = UA_Server_initNS0(server); - if (retVal != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(config->logger, UA_LOGCATEGORY_SERVER, - "Initialization of Namespace 0 failed with %s. See previous outputs for any error messages.", - UA_StatusCode_name(retVal)); - UA_Server_delete(server); - return NULL; - } - - return server; -} - -/*****************/ -/* Repeated Jobs */ -/*****************/ - -UA_StatusCode UA_Server_addRepeatedCallback(UA_Server *server, UA_ServerCallback callback, void *data, - UA_UInt32 interval, UA_UInt64 *callbackId) { - return UA_Timer_addRepeatedCallback(&server->timer, (UA_TimerCallback)callback, data, interval, callbackId); -} - -UA_StatusCode UA_Server_changeRepeatedCallbackInterval(UA_Server *server, UA_UInt64 callbackId, UA_UInt32 interval) { - return UA_Timer_changeRepeatedCallbackInterval(&server->timer, callbackId, interval); -} - -UA_StatusCode UA_Server_removeRepeatedCallback(UA_Server *server, UA_UInt64 callbackId) { - return UA_Timer_removeRepeatedCallback(&server->timer, callbackId); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_server_ns0.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/*****************/ -/* Node Creation */ -/*****************/ - -static UA_StatusCode addNode_begin(UA_Server *server, UA_NodeClass nodeClass, UA_UInt32 nodeId, char *name, - void *attributes, const UA_DataType *attributesType) { - UA_AddNodesItem item; - UA_AddNodesItem_init(&item); - item.nodeClass = nodeClass; - item.requestedNewNodeId.nodeId = UA_NODEID_NUMERIC(0, nodeId); - item.browseName = UA_QUALIFIEDNAME(0, name); - item.nodeAttributes.encoding = UA_EXTENSIONOBJECT_DECODED_NODELETE; - item.nodeAttributes.content.decoded.data = attributes; - item.nodeAttributes.content.decoded.type = attributesType; - return Operation_addNode_begin(server, &adminSession, &item, NULL, NULL); -} - -static UA_StatusCode addNode_finish(UA_Server *server, UA_UInt32 nodeId, UA_UInt32 parentNodeId, - UA_UInt32 referenceTypeId, UA_UInt32 typeDefinitionId) { - UA_NodeId node = UA_NODEID_NUMERIC(0, nodeId); - UA_NodeId parentNode = UA_NODEID_NUMERIC(0, parentNodeId); - UA_NodeId referenceType = UA_NODEID_NUMERIC(0, referenceTypeId); - UA_NodeId typeDefinition = UA_NODEID_NUMERIC(0, typeDefinitionId); - return Operation_addNode_finish(server, &adminSession, &node, &parentNode, &referenceType, &typeDefinition); -} - -static UA_StatusCode addDataTypeNode(UA_Server *server, char *name, UA_UInt32 datatypeid, UA_Boolean isAbstract, - UA_UInt32 parentid) { - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", name); - attr.isAbstract = isAbstract; - return UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(0, datatypeid), UA_NODEID_NUMERIC(0, parentid), - UA_NODEID_NULL, UA_QUALIFIEDNAME(0, name), attr, NULL, NULL); -} - -static UA_StatusCode addObjectTypeNode(UA_Server *server, char *name, UA_UInt32 objecttypeid, UA_Boolean isAbstract, - UA_UInt32 parentid) { - UA_ObjectTypeAttributes attr = UA_ObjectTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", name); - attr.isAbstract = isAbstract; - return UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(0, objecttypeid), UA_NODEID_NUMERIC(0, parentid), - UA_NODEID_NULL, UA_QUALIFIEDNAME(0, name), attr, NULL, NULL); -} - -static UA_StatusCode addObjectNode(UA_Server *server, char *name, UA_UInt32 objectid, UA_UInt32 parentid, - UA_UInt32 referenceid, UA_UInt32 type_id) { - UA_ObjectAttributes object_attr = UA_ObjectAttributes_default; - object_attr.displayName = UA_LOCALIZEDTEXT("", name); - return UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(0, objectid), UA_NODEID_NUMERIC(0, parentid), - UA_NODEID_NUMERIC(0, referenceid), UA_QUALIFIEDNAME(0, name), - UA_NODEID_NUMERIC(0, type_id), object_attr, NULL, NULL); -} - -static UA_StatusCode addReferenceTypeNode(UA_Server *server, char *name, char *inverseName, UA_UInt32 referencetypeid, - UA_Boolean isabstract, UA_Boolean symmetric, UA_UInt32 parentid) { - UA_ReferenceTypeAttributes reference_attr = UA_ReferenceTypeAttributes_default; - reference_attr.displayName = UA_LOCALIZEDTEXT("", name); - reference_attr.isAbstract = isabstract; - reference_attr.symmetric = symmetric; - if (inverseName) reference_attr.inverseName = UA_LOCALIZEDTEXT("", inverseName); - return UA_Server_addReferenceTypeNode(server, UA_NODEID_NUMERIC(0, referencetypeid), UA_NODEID_NUMERIC(0, parentid), - UA_NODEID_NULL, UA_QUALIFIEDNAME(0, name), reference_attr, NULL, NULL); -} - -static UA_StatusCode addVariableTypeNode(UA_Server *server, char *name, UA_UInt32 variabletypeid, UA_Boolean isAbstract, - UA_Int32 valueRank, UA_UInt32 dataType, const UA_DataType *type, - UA_UInt32 parentid) { - UA_VariableTypeAttributes attr = UA_VariableTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", name); - attr.dataType = UA_NODEID_NUMERIC(0, dataType); - attr.isAbstract = isAbstract; - attr.valueRank = valueRank; - if (type) { - void *val = UA_alloca(type->memSize); - UA_init(val, type); - UA_Variant_setScalar(&attr.value, val, type); - } - return UA_Server_addVariableTypeNode(server, UA_NODEID_NUMERIC(0, variabletypeid), UA_NODEID_NUMERIC(0, parentid), - UA_NODEID_NULL, UA_QUALIFIEDNAME(0, name), UA_NODEID_NULL, attr, NULL, NULL); -} - -/**********************/ -/* Create Namespace 0 */ -/**********************/ - -/* Creates the basic nodes which are expected by the nodeset compiler to be - * already created. This is necessary to reduce the dependencies for the nodeset - * compiler. */ -static UA_StatusCode UA_Server_createNS0_base(UA_Server *server) { - UA_StatusCode ret = UA_STATUSCODE_GOOD; - /*********************************/ - /* Bootstrap reference hierarchy */ - /*********************************/ - - /* Bootstrap References and HasSubtype */ - UA_ReferenceTypeAttributes references_attr = UA_ReferenceTypeAttributes_default; - references_attr.displayName = UA_LOCALIZEDTEXT("", "References"); - references_attr.isAbstract = true; - references_attr.symmetric = true; - references_attr.inverseName = UA_LOCALIZEDTEXT("", "References"); - ret |= addNode_begin(server, UA_NODECLASS_REFERENCETYPE, UA_NS0ID_REFERENCES, "References", &references_attr, - &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES]); - - UA_ReferenceTypeAttributes hassubtype_attr = UA_ReferenceTypeAttributes_default; - hassubtype_attr.displayName = UA_LOCALIZEDTEXT("", "HasSubtype"); - hassubtype_attr.isAbstract = false; - hassubtype_attr.symmetric = false; - hassubtype_attr.inverseName = UA_LOCALIZEDTEXT("", "HasSupertype"); - ret |= addNode_begin(server, UA_NODECLASS_REFERENCETYPE, UA_NS0ID_HASSUBTYPE, "HasSubtype", &hassubtype_attr, - &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES]); - - ret |= addReferenceTypeNode(server, "HierarchicalReferences", NULL, UA_NS0ID_HIERARCHICALREFERENCES, true, false, - UA_NS0ID_REFERENCES); - - ret |= addReferenceTypeNode(server, "NonHierarchicalReferences", NULL, UA_NS0ID_NONHIERARCHICALREFERENCES, true, - false, UA_NS0ID_REFERENCES); - - ret |= - addReferenceTypeNode(server, "HasChild", NULL, UA_NS0ID_HASCHILD, true, false, UA_NS0ID_HIERARCHICALREFERENCES); - - ret |= addReferenceTypeNode(server, "Organizes", "OrganizedBy", UA_NS0ID_ORGANIZES, false, false, - UA_NS0ID_HIERARCHICALREFERENCES); - - ret |= addReferenceTypeNode(server, "HasEventSource", "EventSourceOf", UA_NS0ID_HASEVENTSOURCE, false, false, - UA_NS0ID_HIERARCHICALREFERENCES); - - ret |= addReferenceTypeNode(server, "HasModellingRule", "ModellingRuleOf", UA_NS0ID_HASMODELLINGRULE, false, false, - UA_NS0ID_NONHIERARCHICALREFERENCES); - - ret |= addReferenceTypeNode(server, "HasEncoding", "EncodingOf", UA_NS0ID_HASENCODING, false, false, - UA_NS0ID_NONHIERARCHICALREFERENCES); - - ret |= addReferenceTypeNode(server, "HasDescription", "DescriptionOf", UA_NS0ID_HASDESCRIPTION, false, false, - UA_NS0ID_NONHIERARCHICALREFERENCES); - - ret |= addReferenceTypeNode(server, "HasTypeDefinition", "TypeDefinitionOf", UA_NS0ID_HASTYPEDEFINITION, false, false, - UA_NS0ID_NONHIERARCHICALREFERENCES); - - ret |= addReferenceTypeNode(server, "GeneratesEvent", "GeneratedBy", UA_NS0ID_GENERATESEVENT, false, false, - UA_NS0ID_NONHIERARCHICALREFERENCES); - - ret |= - addReferenceTypeNode(server, "Aggregates", "AggregatedBy", UA_NS0ID_AGGREGATES, false, false, UA_NS0ID_HASCHILD); - - /* Complete bootstrap of HasSubtype */ - ret |= addNode_finish(server, UA_NS0ID_HASSUBTYPE, UA_NS0ID_HASCHILD, UA_NS0ID_HASSUBTYPE, 0); - - ret |= addReferenceTypeNode(server, "HasProperty", "PropertyOf", UA_NS0ID_HASPROPERTY, false, false, - UA_NS0ID_AGGREGATES); - - ret |= addReferenceTypeNode(server, "HasComponent", "ComponentOf", UA_NS0ID_HASCOMPONENT, false, false, - UA_NS0ID_AGGREGATES); - - ret |= addReferenceTypeNode(server, "HasNotifier", "NotifierOf", UA_NS0ID_HASNOTIFIER, false, false, - UA_NS0ID_HASEVENTSOURCE); - - ret |= addReferenceTypeNode(server, "HasOrderedComponent", "OrderedComponentOf", UA_NS0ID_HASORDEREDCOMPONENT, false, - false, UA_NS0ID_HASCOMPONENT); - - /**************/ - /* Data Types */ - /**************/ - - /* Bootstrap BaseDataType */ - UA_DataTypeAttributes basedatatype_attr = UA_DataTypeAttributes_default; - basedatatype_attr.displayName = UA_LOCALIZEDTEXT("", "BaseDataType"); - basedatatype_attr.isAbstract = true; - ret |= addNode_begin(server, UA_NODECLASS_DATATYPE, UA_NS0ID_BASEDATATYPE, "BaseDataType", &basedatatype_attr, - &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES]); - - ret |= addDataTypeNode(server, "Number", UA_NS0ID_NUMBER, true, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "Integer", UA_NS0ID_INTEGER, true, UA_NS0ID_NUMBER); - ret |= addDataTypeNode(server, "UInteger", UA_NS0ID_UINTEGER, true, UA_NS0ID_NUMBER); - ret |= addDataTypeNode(server, "Boolean", UA_NS0ID_BOOLEAN, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "SByte", UA_NS0ID_SBYTE, false, UA_NS0ID_INTEGER); - ret |= addDataTypeNode(server, "Byte", UA_NS0ID_BYTE, false, UA_NS0ID_UINTEGER); - ret |= addDataTypeNode(server, "Int16", UA_NS0ID_INT16, false, UA_NS0ID_INTEGER); - ret |= addDataTypeNode(server, "UInt16", UA_NS0ID_UINT16, false, UA_NS0ID_UINTEGER); - ret |= addDataTypeNode(server, "Int32", UA_NS0ID_INT32, false, UA_NS0ID_INTEGER); - ret |= addDataTypeNode(server, "UInt32", UA_NS0ID_UINT32, false, UA_NS0ID_UINTEGER); - ret |= addDataTypeNode(server, "Int64", UA_NS0ID_INT64, false, UA_NS0ID_INTEGER); - ret |= addDataTypeNode(server, "UInt64", UA_NS0ID_UINT64, false, UA_NS0ID_UINTEGER); - ret |= addDataTypeNode(server, "Float", UA_NS0ID_FLOAT, false, UA_NS0ID_NUMBER); - ret |= addDataTypeNode(server, "Double", UA_NS0ID_DOUBLE, false, UA_NS0ID_NUMBER); - ret |= addDataTypeNode(server, "DateTime", UA_NS0ID_DATETIME, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "String", UA_NS0ID_STRING, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "ByteString", UA_NS0ID_BYTESTRING, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "Guid", UA_NS0ID_GUID, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "XmlElement", UA_NS0ID_XMLELEMENT, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "NodeId", UA_NS0ID_NODEID, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "ExpandedNodeId", UA_NS0ID_EXPANDEDNODEID, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "QualifiedName", UA_NS0ID_QUALIFIEDNAME, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "LocalizedText", UA_NS0ID_LOCALIZEDTEXT, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "StatusCode", UA_NS0ID_STATUSCODE, false, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "Structure", UA_NS0ID_STRUCTURE, true, UA_NS0ID_BASEDATATYPE); - ret |= addDataTypeNode(server, "Decimal128", UA_NS0ID_DECIMAL128, false, UA_NS0ID_NUMBER); - - ret |= addDataTypeNode(server, "Duration", UA_NS0ID_DURATION, false, UA_NS0ID_DOUBLE); - ret |= addDataTypeNode(server, "UtcTime", UA_NS0ID_UTCTIME, false, UA_NS0ID_DATETIME); - ret |= addDataTypeNode(server, "LocaleId", UA_NS0ID_LOCALEID, false, UA_NS0ID_STRING); - - /*****************/ - /* VariableTypes */ - /*****************/ - - /* Bootstrap BaseVariableType */ - UA_VariableTypeAttributes basevar_attr = UA_VariableTypeAttributes_default; - basevar_attr.displayName = UA_LOCALIZEDTEXT("", "BaseVariableType"); - basevar_attr.isAbstract = true; - basevar_attr.valueRank = -2; - basevar_attr.dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE); - ret |= addNode_begin(server, UA_NODECLASS_VARIABLETYPE, UA_NS0ID_BASEVARIABLETYPE, "BaseVariableType", &basevar_attr, - &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES]); - - ret |= addVariableTypeNode(server, "BaseDataVariableType", UA_NS0ID_BASEDATAVARIABLETYPE, false, -2, - UA_NS0ID_BASEDATATYPE, NULL, UA_NS0ID_BASEVARIABLETYPE); - - /***************/ - /* ObjectTypes */ - /***************/ - - /* Bootstrap BaseObjectType */ - UA_ObjectTypeAttributes baseobj_attr = UA_ObjectTypeAttributes_default; - baseobj_attr.displayName = UA_LOCALIZEDTEXT("", "BaseObjectType"); - ret |= addNode_begin(server, UA_NODECLASS_OBJECTTYPE, UA_NS0ID_BASEOBJECTTYPE, "BaseObjectType", &baseobj_attr, - &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES]); - - ret |= addObjectTypeNode(server, "FolderType", UA_NS0ID_FOLDERTYPE, false, UA_NS0ID_BASEOBJECTTYPE); - - /******************/ - /* Root and below */ - /******************/ - - ret |= addObjectNode(server, "Root", UA_NS0ID_ROOTFOLDER, 0, 0, UA_NS0ID_FOLDERTYPE); - - ret |= addObjectNode(server, "Objects", UA_NS0ID_OBJECTSFOLDER, UA_NS0ID_ROOTFOLDER, UA_NS0ID_ORGANIZES, - UA_NS0ID_FOLDERTYPE); - - ret |= addObjectNode(server, "Types", UA_NS0ID_TYPESFOLDER, UA_NS0ID_ROOTFOLDER, UA_NS0ID_ORGANIZES, - UA_NS0ID_FOLDERTYPE); - - ret |= addObjectNode(server, "ReferenceTypes", UA_NS0ID_REFERENCETYPESFOLDER, UA_NS0ID_TYPESFOLDER, - UA_NS0ID_ORGANIZES, UA_NS0ID_FOLDERTYPE); - ret |= addNode_finish(server, UA_NS0ID_REFERENCES, UA_NS0ID_REFERENCETYPESFOLDER, UA_NS0ID_ORGANIZES, 0); - - ret |= addObjectNode(server, "DataTypes", UA_NS0ID_DATATYPESFOLDER, UA_NS0ID_TYPESFOLDER, UA_NS0ID_ORGANIZES, - UA_NS0ID_FOLDERTYPE); - - ret |= addNode_finish(server, UA_NS0ID_BASEDATATYPE, UA_NS0ID_DATATYPESFOLDER, UA_NS0ID_ORGANIZES, 0); - - ret |= addObjectNode(server, "VariableTypes", UA_NS0ID_VARIABLETYPESFOLDER, UA_NS0ID_TYPESFOLDER, UA_NS0ID_ORGANIZES, - UA_NS0ID_FOLDERTYPE); - - ret |= addNode_finish(server, UA_NS0ID_BASEVARIABLETYPE, UA_NS0ID_VARIABLETYPESFOLDER, UA_NS0ID_ORGANIZES, 0); - - ret |= addObjectNode(server, "ObjectTypes", UA_NS0ID_OBJECTTYPESFOLDER, UA_NS0ID_TYPESFOLDER, UA_NS0ID_ORGANIZES, - UA_NS0ID_FOLDERTYPE); - ret |= addNode_finish(server, UA_NS0ID_BASEOBJECTTYPE, UA_NS0ID_OBJECTTYPESFOLDER, UA_NS0ID_ORGANIZES, 0); - - ret |= addObjectNode(server, "EventTypes", UA_NS0ID_EVENTTYPESFOLDER, UA_NS0ID_TYPESFOLDER, UA_NS0ID_ORGANIZES, - UA_NS0ID_FOLDERTYPE); - - ret |= addObjectNode(server, "Views", UA_NS0ID_VIEWSFOLDER, UA_NS0ID_ROOTFOLDER, UA_NS0ID_ORGANIZES, - UA_NS0ID_FOLDERTYPE); - - if (ret != UA_STATUSCODE_GOOD) return UA_STATUSCODE_BADINTERNALERROR; - return UA_STATUSCODE_GOOD; -} - -/****************/ -/* Data Sources */ -/****************/ - -static UA_StatusCode readStatus(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, UA_Boolean sourceTimestamp, - const UA_NumericRange *range, UA_DataValue *value) { - if (range) { - value->hasStatus = true; - value->status = UA_STATUSCODE_BADINDEXRANGEINVALID; - return UA_STATUSCODE_GOOD; - } - - UA_ServerStatusDataType *statustype = UA_ServerStatusDataType_new(); - statustype->startTime = server->startTime; - statustype->currentTime = UA_DateTime_now(); - statustype->state = UA_SERVERSTATE_RUNNING; - statustype->secondsTillShutdown = 0; - UA_BuildInfo_copy(&server->config.buildInfo, &statustype->buildInfo); - - value->value.type = &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]; - value->value.arrayLength = 0; - value->value.data = statustype; - value->value.arrayDimensionsSize = 0; - value->value.arrayDimensions = NULL; - value->hasValue = true; - if (sourceTimestamp) { - value->hasSourceTimestamp = true; - value->sourceTimestamp = UA_DateTime_now(); - } - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode readServiceLevel(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, UA_Boolean includeSourceTimeStamp, - const UA_NumericRange *range, UA_DataValue *value) { - if (range) { - value->hasStatus = true; - value->status = UA_STATUSCODE_BADINDEXRANGEINVALID; - return UA_STATUSCODE_GOOD; - } - - value->value.type = &UA_TYPES[UA_TYPES_BYTE]; - value->value.arrayLength = 0; - UA_Byte *byte = UA_Byte_new(); - *byte = 255; - value->value.data = byte; - value->value.arrayDimensionsSize = 0; - value->value.arrayDimensions = NULL; - value->hasValue = true; - if (includeSourceTimeStamp) { - value->hasSourceTimestamp = true; - value->sourceTimestamp = UA_DateTime_now(); - } - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode readAuditing(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext, UA_Boolean includeSourceTimeStamp, - const UA_NumericRange *range, UA_DataValue *value) { - if (range) { - value->hasStatus = true; - value->status = UA_STATUSCODE_BADINDEXRANGEINVALID; - return UA_STATUSCODE_GOOD; - } - - value->value.type = &UA_TYPES[UA_TYPES_BOOLEAN]; - value->value.arrayLength = 0; - UA_Boolean *boolean = UA_Boolean_new(); - *boolean = false; - value->value.data = boolean; - value->value.arrayDimensionsSize = 0; - value->value.arrayDimensions = NULL; - value->hasValue = true; - if (includeSourceTimeStamp) { - value->hasSourceTimestamp = true; - value->sourceTimestamp = UA_DateTime_now(); - } - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode readNamespaces(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeid, void *nodeContext, UA_Boolean includeSourceTimeStamp, - const UA_NumericRange *range, UA_DataValue *value) { - if (range) { - value->hasStatus = true; - value->status = UA_STATUSCODE_BADINDEXRANGEINVALID; - return UA_STATUSCODE_GOOD; - } - UA_StatusCode retval; - retval = - UA_Variant_setArrayCopy(&value->value, server->namespaces, server->namespacesSize, &UA_TYPES[UA_TYPES_STRING]); - if (retval != UA_STATUSCODE_GOOD) return retval; - value->hasValue = true; - if (includeSourceTimeStamp) { - value->hasSourceTimestamp = true; - value->sourceTimestamp = UA_DateTime_now(); - } - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode writeNamespaces(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeid, void *nodeContext, const UA_NumericRange *range, - const UA_DataValue *value) { - /* Check the data type */ - if (!value->hasValue || value->value.type != &UA_TYPES[UA_TYPES_STRING]) return UA_STATUSCODE_BADTYPEMISMATCH; - - /* Check that the variant is not empty */ - if (!value->value.data) return UA_STATUSCODE_BADTYPEMISMATCH; - - /* TODO: Writing with a range is not implemented */ - if (range) return UA_STATUSCODE_BADINTERNALERROR; - - UA_String *newNamespaces = (UA_String *)value->value.data; - size_t newNamespacesSize = value->value.arrayLength; - - /* Test if we append to the existing namespaces */ - if (newNamespacesSize <= server->namespacesSize) return UA_STATUSCODE_BADTYPEMISMATCH; - - /* Test if the existing namespaces are unchanged */ - for (size_t i = 0; i < server->namespacesSize; ++i) { - if (!UA_String_equal(&server->namespaces[i], &newNamespaces[i])) return UA_STATUSCODE_BADINTERNALERROR; - } - - /* Add namespaces */ - for (size_t i = server->namespacesSize; i < newNamespacesSize; ++i) addNamespace(server, newNamespaces[i]); - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode readCurrentTime(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeid, void *nodeContext, UA_Boolean sourceTimeStamp, - const UA_NumericRange *range, UA_DataValue *value) { - if (range) { - value->hasStatus = true; - value->status = UA_STATUSCODE_BADINDEXRANGEINVALID; - return UA_STATUSCODE_GOOD; - } - UA_DateTime currentTime = UA_DateTime_now(); - UA_StatusCode retval = UA_Variant_setScalarCopy(&value->value, ¤tTime, &UA_TYPES[UA_TYPES_DATETIME]); - if (retval != UA_STATUSCODE_GOOD) return retval; - value->hasValue = true; - if (sourceTimeStamp) { - value->hasSourceTimestamp = true; - value->sourceTimestamp = currentTime; - } - return UA_STATUSCODE_GOOD; -} - -#if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS) -static UA_StatusCode readMonitoredItems(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *methodId, void *methodContext, const UA_NodeId *objectId, - void *objectContext, size_t inputSize, const UA_Variant *input, - size_t outputSize, UA_Variant *output) { - UA_Session *session = UA_SessionManager_getSessionById(&server->sessionManager, sessionId); - if (!session) return UA_STATUSCODE_BADINTERNALERROR; - UA_UInt32 subscriptionId = *((UA_UInt32 *)(input[0].data)); - UA_Subscription *subscription = UA_Session_getSubscriptionByID(session, subscriptionId); - if (!subscription) return UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - - UA_UInt32 sizeOfOutput = 0; - UA_MonitoredItem *monitoredItem; - LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) { ++sizeOfOutput; } - if (sizeOfOutput == 0) return UA_STATUSCODE_GOOD; - - UA_UInt32 *clientHandles = (UA_UInt32 *)UA_Array_new(sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]); - UA_UInt32 *serverHandles = (UA_UInt32 *)UA_Array_new(sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]); - UA_UInt32 i = 0; - LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) { - clientHandles[i] = monitoredItem->clientHandle; - serverHandles[i] = monitoredItem->itemId; - ++i; - } - UA_Variant_setArray(&output[0], clientHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setArray(&output[1], serverHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]); - return UA_STATUSCODE_GOOD; -} -#endif /* defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS) */ - -static UA_StatusCode writeNs0Variable(UA_Server *server, UA_UInt32 id, void *v, const UA_DataType *type) { - UA_Variant var; - UA_Variant_init(&var); - UA_Variant_setScalar(&var, v, type); - return UA_Server_writeValue(server, UA_NODEID_NUMERIC(0, id), var); -} - -static UA_StatusCode writeNs0VariableArray(UA_Server *server, UA_UInt32 id, void *v, size_t length, - const UA_DataType *type) { - UA_Variant var; - UA_Variant_init(&var); - UA_Variant_setArray(&var, v, length, type); - return UA_Server_writeValue(server, UA_NODEID_NUMERIC(0, id), var); -} - -/* Initialize the nodeset 0 by using the generated code of the nodeset compiler. - * This also initialized the data sources for various variables, such as for - * example server time. */ -UA_StatusCode UA_Server_initNS0(UA_Server *server) { - /* Initialize base nodes which are always required an cannot be created - * through the NS compiler */ - server->bootstrapNS0 = true; - UA_StatusCode retVal = UA_Server_createNS0_base(server); - server->bootstrapNS0 = false; - if (retVal != UA_STATUSCODE_GOOD) return retVal; - - /* Load nodes and references generated from the XML ns0 definition */ - server->bootstrapNS0 = true; - retVal = ua_namespace0(server); - server->bootstrapNS0 = false; - if (retVal != UA_STATUSCODE_GOOD) return retVal; - - /* NamespaceArray */ - UA_DataSource namespaceDataSource = {readNamespaces, NULL}; - retVal |= UA_Server_setVariableNode_dataSource(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_NAMESPACEARRAY), - namespaceDataSource); - - /* ServerArray */ - retVal |= writeNs0VariableArray(server, UA_NS0ID_SERVER_SERVERARRAY, - &server->config.applicationDescription.applicationUri, 1, &UA_TYPES[UA_TYPES_STRING]); - - /* LocaleIdArray */ - UA_LocaleId locale_en = UA_STRING("en"); - retVal |= writeNs0VariableArray(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY, &locale_en, 1, - &UA_TYPES[UA_TYPES_LOCALEID]); - - /* MaxBrowseContinuationPoints */ - UA_UInt16 maxBrowseContinuationPoints = UA_MAXCONTINUATIONPOINTS; - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXBROWSECONTINUATIONPOINTS, - &maxBrowseContinuationPoints, &UA_TYPES[UA_TYPES_UINT16]); - - /* ServerProfileArray */ - UA_String profileArray[4]; - UA_UInt16 profileArraySize = 0; -#define ADDPROFILEARRAY(x) profileArray[profileArraySize++] = UA_STRING_ALLOC(x) - ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NanoEmbeddedDevice"); -#ifdef UA_ENABLE_NODEMANAGEMENT - ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NodeManagement"); -#endif -#ifdef UA_ENABLE_METHODCALLS - ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/Methods"); -#endif -#ifdef UA_ENABLE_SUBSCRIPTIONS - ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/EmbeddedDataChangeSubscription"); -#endif - - retVal |= writeNs0VariableArray(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_SERVERPROFILEARRAY, profileArray, - profileArraySize, &UA_TYPES[UA_TYPES_STRING]); - for (int i = 0; i < profileArraySize; i++) { - UA_String_deleteMembers(&profileArray[i]); - } - - /* MaxQueryContinuationPoints */ - UA_UInt16 maxQueryContinuationPoints = 0; - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXQUERYCONTINUATIONPOINTS, - &maxQueryContinuationPoints, &UA_TYPES[UA_TYPES_UINT16]); - - /* MaxHistoryContinuationPoints */ - UA_UInt16 maxHistoryContinuationPoints = 0; - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXHISTORYCONTINUATIONPOINTS, - &maxHistoryContinuationPoints, &UA_TYPES[UA_TYPES_UINT16]); - - /* MinSupportedSampleRate */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_MINSUPPORTEDSAMPLERATE, - &server->config.samplingIntervalLimits.min, &UA_TYPES[UA_TYPES_DURATION]); - - /* ServerDiagnostics - ServerDiagnosticsSummary */ - UA_ServerDiagnosticsSummaryDataType serverDiagnosticsSummary; - UA_ServerDiagnosticsSummaryDataType_init(&serverDiagnosticsSummary); - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY, - &serverDiagnosticsSummary, &UA_TYPES[UA_TYPES_SERVERDIAGNOSTICSSUMMARYDATATYPE]); - - /* ServerDiagnostics - EnabledFlag */ - UA_Boolean enabledFlag = false; - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERDIAGNOSTICS_ENABLEDFLAG, &enabledFlag, - &UA_TYPES[UA_TYPES_BOOLEAN]); - - /* ServerStatus */ - UA_DataSource serverStatus = {readStatus, NULL}; - retVal |= - UA_Server_setVariableNode_dataSource(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS), serverStatus); - - /* StartTime will be sampled in UA_Server_run_startup()*/ - - /* CurrentTime */ - UA_DataSource currentTime = {readCurrentTime, NULL}; - retVal |= UA_Server_setVariableNode_dataSource(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME), - currentTime); - - /* State */ - UA_ServerState state = UA_SERVERSTATE_RUNNING; - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERSTATUS_STATE, &state, &UA_TYPES[UA_TYPES_SERVERSTATE]); - - /* BuildInfo */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO, &server->config.buildInfo, - &UA_TYPES[UA_TYPES_BUILDINFO]); - - /* BuildInfo - ProductUri */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTURI, - &server->config.buildInfo.productUri, &UA_TYPES[UA_TYPES_STRING]); - - /* BuildInfo - ManufacturerName */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_MANUFACTURERNAME, - &server->config.buildInfo.manufacturerName, &UA_TYPES[UA_TYPES_STRING]); - - /* BuildInfo - ProductName */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTNAME, - &server->config.buildInfo.productName, &UA_TYPES[UA_TYPES_STRING]); - - /* BuildInfo - SoftwareVersion */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_SOFTWAREVERSION, - &server->config.buildInfo.softwareVersion, &UA_TYPES[UA_TYPES_STRING]); - - /* BuildInfo - BuildNumber */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDNUMBER, - &server->config.buildInfo.buildNumber, &UA_TYPES[UA_TYPES_STRING]); - - /* BuildInfo - BuildDate */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDDATE, - &server->config.buildInfo.buildDate, &UA_TYPES[UA_TYPES_DATETIME]); - - /* SecondsTillShutdown */ - UA_UInt32 secondsTillShutdown = 0; - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERSTATUS_SECONDSTILLSHUTDOWN, &secondsTillShutdown, - &UA_TYPES[UA_TYPES_UINT32]); - - /* ShutDownReason */ - UA_LocalizedText shutdownReason; - UA_LocalizedText_init(&shutdownReason); - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERSTATUS_SHUTDOWNREASON, &shutdownReason, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); - - /* ServiceLevel */ - UA_DataSource serviceLevel = {readServiceLevel, NULL}; - retVal |= - UA_Server_setVariableNode_dataSource(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVICELEVEL), serviceLevel); - - /* Auditing */ - UA_DataSource auditing = {readAuditing, NULL}; - retVal |= UA_Server_setVariableNode_dataSource(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_AUDITING), auditing); - - /* NamespaceArray */ - UA_DataSource nsarray_datasource = {readNamespaces, writeNamespaces}; - retVal |= UA_Server_setVariableNode_dataSource(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_NAMESPACEARRAY), - nsarray_datasource); - - /* Redundancy Support */ - UA_RedundancySupport redundancySupport = UA_REDUNDANCYSUPPORT_NONE; - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANCYSUPPORT, &redundancySupport, - &UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT]); - - /* ServerCapabilities - OperationLimits - MaxNodesPerRead */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERREAD, - &server->config.maxNodesPerRead, &UA_TYPES[UA_TYPES_UINT32]); - - /* ServerCapabilities - OperationLimits - maxNodesPerWrite */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERWRITE, - &server->config.maxNodesPerWrite, &UA_TYPES[UA_TYPES_UINT32]); - - /* ServerCapabilities - OperationLimits - MaxNodesPerMethodCall */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERMETHODCALL, - &server->config.maxNodesPerMethodCall, &UA_TYPES[UA_TYPES_UINT32]); - - /* ServerCapabilities - OperationLimits - MaxNodesPerBrowse */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERBROWSE, - &server->config.maxNodesPerBrowse, &UA_TYPES[UA_TYPES_UINT32]); - - /* ServerCapabilities - OperationLimits - MaxNodesPerRegisterNodes */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERREGISTERNODES, - &server->config.maxNodesPerRegisterNodes, &UA_TYPES[UA_TYPES_UINT32]); - - /* ServerCapabilities - OperationLimits - MaxNodesPerTranslateBrowsePathsToNodeIds */ - retVal |= writeNs0Variable( - server, UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERTRANSLATEBROWSEPATHSTONODEIDS, - &server->config.maxNodesPerTranslateBrowsePathsToNodeIds, &UA_TYPES[UA_TYPES_UINT32]); - - /* ServerCapabilities - OperationLimits - MaxNodesPerNodeManagement */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERNODEMANAGEMENT, - &server->config.maxNodesPerNodeManagement, &UA_TYPES[UA_TYPES_UINT32]); - - /* ServerCapabilities - OperationLimits - MaxMonitoredItemsPerCall */ - retVal |= writeNs0Variable(server, UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXMONITOREDITEMSPERCALL, - &server->config.maxMonitoredItemsPerCall, &UA_TYPES[UA_TYPES_UINT32]); - -#if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS) - retVal |= UA_Server_setMethodNode_callback(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_GETMONITOREDITEMS), - readMonitoredItems); -#endif - return retVal; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_namespace0.c" - * ***********************************/ - -/* WARNING: This is a generated file. - * Any manual changes will be overwritten. */ - -/* HasHistoricalConfiguration - ns=0;i=56 */ - -static UA_StatusCode function_ua_namespace0_0(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ReferenceTypeAttributes attr = UA_ReferenceTypeAttributes_default; - attr.inverseName = UA_LOCALIZEDTEXT("", "HistoricalConfigurationOf"); - attr.displayName = UA_LOCALIZEDTEXT("", "HasHistoricalConfiguration"); - attr.description = - UA_LOCALIZEDTEXT("", "The type for a reference to the historical configuration for a data variable."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addReferenceTypeNode(server, UA_NODEID_NUMERIC(ns[0], 56), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "HasHistoricalConfiguration"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 56), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 44), false); - return retVal; -} - -/* HasEffect - ns=0;i=54 */ - -static UA_StatusCode function_ua_namespace0_1(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ReferenceTypeAttributes attr = UA_ReferenceTypeAttributes_default; - attr.inverseName = UA_LOCALIZEDTEXT("", "MayBeEffectedBy"); - attr.displayName = UA_LOCALIZEDTEXT("", "HasEffect"); - attr.description = - UA_LOCALIZEDTEXT("", "The type for a reference to an event that may be raised when a transition occurs."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addReferenceTypeNode(server, UA_NODEID_NUMERIC(ns[0], 54), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "HasEffect"), attr, - NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 54), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 32), false); - return retVal; -} - -/* HasCause - ns=0;i=53 */ - -static UA_StatusCode function_ua_namespace0_2(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ReferenceTypeAttributes attr = UA_ReferenceTypeAttributes_default; - attr.inverseName = UA_LOCALIZEDTEXT("", "MayBeCausedBy"); - attr.displayName = UA_LOCALIZEDTEXT("", "HasCause"); - attr.description = UA_LOCALIZEDTEXT("", "The type for a reference to a method that can cause a transition to occur."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addReferenceTypeNode(server, UA_NODEID_NUMERIC(ns[0], 53), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "HasCause"), attr, NULL, - NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 53), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 32), false); - return retVal; -} - -/* ToState - ns=0;i=52 */ - -static UA_StatusCode function_ua_namespace0_3(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ReferenceTypeAttributes attr = UA_ReferenceTypeAttributes_default; - attr.inverseName = UA_LOCALIZEDTEXT("", "FromTransition"); - attr.displayName = UA_LOCALIZEDTEXT("", "ToState"); - attr.description = UA_LOCALIZEDTEXT("", "The type for a reference to the state after a transition."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= - UA_Server_addReferenceTypeNode(server, UA_NODEID_NUMERIC(ns[0], 52), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ToState"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 52), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 32), false); - return retVal; -} - -/* FromState - ns=0;i=51 */ - -static UA_StatusCode function_ua_namespace0_4(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ReferenceTypeAttributes attr = UA_ReferenceTypeAttributes_default; - attr.inverseName = UA_LOCALIZEDTEXT("", "ToTransition"); - attr.displayName = UA_LOCALIZEDTEXT("", "FromState"); - attr.description = UA_LOCALIZEDTEXT("", "The type for a reference to the state before a transition."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addReferenceTypeNode(server, UA_NODEID_NUMERIC(ns[0], 51), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "FromState"), attr, - NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 51), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 32), false); - return retVal; -} - -/* Default Binary - ns=0;i=3062 */ - -static UA_StatusCode function_ua_namespace0_5(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "Default Binary"); - attr.description = UA_LOCALIZEDTEXT("", "The default binary encoding for a data type."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 3062), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Default Binary"), - UA_NODEID_NUMERIC(ns[0], 58), attr, NULL, NULL); - return retVal; -} - -/* Default XML - ns=0;i=3063 */ - -static UA_StatusCode function_ua_namespace0_6(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "Default XML"); - attr.description = UA_LOCALIZEDTEXT("", "The default XML encoding for a data type."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 3063), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Default XML"), - UA_NODEID_NUMERIC(ns[0], 58), attr, NULL, NULL); - return retVal; -} - -/* Enumeration - ns=0;i=29 */ - -static UA_StatusCode function_ua_namespace0_7(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.isAbstract = true; - attr.displayName = UA_LOCALIZEDTEXT("", "Enumeration"); - attr.description = UA_LOCALIZEDTEXT("", "Describes a value that is an enumerated DataType."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= - UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 29), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Enumeration"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 29), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 24), false); - return retVal; -} - -/* NamingRuleType - ns=0;i=120 */ - -static UA_StatusCode function_ua_namespace0_8(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "NamingRuleType"); - attr.description = UA_LOCALIZEDTEXT( - "", "Describes a value that specifies the significance of the BrowseName for an instance declaration."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 120), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "NamingRuleType"), attr, - NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 120), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 29), false); - return retVal; -} - -/* ServerState - ns=0;i=852 */ - -static UA_StatusCode function_ua_namespace0_9(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ServerState"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= - UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 852), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerState"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 852), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 29), false); - return retVal; -} - -/* RedundancySupport - ns=0;i=851 */ - -static UA_StatusCode function_ua_namespace0_10(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "RedundancySupport"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 851), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "RedundancySupport"), attr, - NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 851), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 29), false); - return retVal; -} - -/* DataValue - ns=0;i=23 */ - -static UA_StatusCode function_ua_namespace0_11(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "DataValue"); - attr.description = - UA_LOCALIZEDTEXT("", "Describes a value that is a structure containing a value, a status code and timestamps."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= - UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 23), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "DataValue"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 23), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 24), false); - return retVal; -} - -/* DiagnosticInfo - ns=0;i=25 */ - -static UA_StatusCode function_ua_namespace0_12(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "DiagnosticInfo"); - attr.description = UA_LOCALIZEDTEXT( - "", "Describes a value that is a structure containing diagnostics associated with a StatusCode."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 25), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "DiagnosticInfo"), attr, - NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 25), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 24), false); - return retVal; -} - -/* Image - ns=0;i=30 */ - -static UA_StatusCode function_ua_namespace0_13(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.isAbstract = true; - attr.displayName = UA_LOCALIZEDTEXT("", "Image"); - attr.description = UA_LOCALIZEDTEXT("", "Describes a value that is an image encoded as a string of bytes."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 30), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Image"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 30), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 15), false); - return retVal; -} - -/* Decimal - ns=0;i=50 */ - -static UA_StatusCode function_ua_namespace0_14(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "Decimal"); - attr.description = UA_LOCALIZEDTEXT("", "Describes an arbitrary precision decimal value."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= - UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 50), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Decimal"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 50), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 26), false); - return retVal; -} - -/* PropertyType - ns=0;i=68 */ - -static UA_StatusCode function_ua_namespace0_15(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableTypeAttributes attr = UA_VariableTypeAttributes_default; - attr.valueRank = (UA_Int32)-2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 24); - attr.displayName = UA_LOCALIZEDTEXT("", "PropertyType"); - attr.description = UA_LOCALIZEDTEXT("", "The type for variable that represents a property of another node."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableTypeNode(server, UA_NODEID_NUMERIC(ns[0], 68), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "PropertyType"), - UA_NODEID_NUMERIC(ns[0], 62), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 68), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 62), false); - return retVal; -} - -/* EnumStrings - ns=0;i=7611 */ - -static UA_StatusCode function_ua_namespace0_16(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = 1; - attr.arrayDimensionsSize = 1; - attr.arrayDimensions = (UA_UInt32 *)UA_Array_new(1, &UA_TYPES[UA_TYPES_UINT32]); - attr.arrayDimensions[0] = 0; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 21); - UA_LocalizedText variablenode_ns_0_i_7611_variant_DataContents[6]; - variablenode_ns_0_i_7611_variant_DataContents[0] = UA_LOCALIZEDTEXT("", "None"); - variablenode_ns_0_i_7611_variant_DataContents[1] = UA_LOCALIZEDTEXT("", "Cold"); - variablenode_ns_0_i_7611_variant_DataContents[2] = UA_LOCALIZEDTEXT("", "Warm"); - variablenode_ns_0_i_7611_variant_DataContents[3] = UA_LOCALIZEDTEXT("", "Hot"); - variablenode_ns_0_i_7611_variant_DataContents[4] = UA_LOCALIZEDTEXT("", "Transparent"); - variablenode_ns_0_i_7611_variant_DataContents[5] = UA_LOCALIZEDTEXT("", "HotAndMirrored"); - UA_Variant_setArray(&attr.value, &variablenode_ns_0_i_7611_variant_DataContents, (UA_Int32)6, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); - attr.displayName = UA_LOCALIZEDTEXT("", "EnumStrings"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 7611), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "EnumStrings"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Array_delete(attr.arrayDimensions, 1, &UA_TYPES[UA_TYPES_UINT32]); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 7611), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 851), false); - return retVal; -} - -/* DataTypeDescriptionType - ns=0;i=69 */ - -static UA_StatusCode function_ua_namespace0_17(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableTypeAttributes attr = UA_VariableTypeAttributes_default; - attr.valueRank = (UA_Int32)-2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 24); - attr.displayName = UA_LOCALIZEDTEXT("", "DataTypeDescriptionType"); - attr.description = - UA_LOCALIZEDTEXT("", "The type for variable that represents the description of a data type encoding."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableTypeNode( - server, UA_NODEID_NUMERIC(ns[0], 69), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "DataTypeDescriptionType"), UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 69), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 63), false); - return retVal; -} - -/* DictionaryFragment - ns=0;i=105 */ - -static UA_StatusCode function_ua_namespace0_18(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 15); - void *variablenode_ns_0_i_105_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_BYTESTRING].memSize); - UA_init(variablenode_ns_0_i_105_variant_DataContents, &UA_TYPES[UA_TYPES_BYTESTRING]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_105_variant_DataContents, &UA_TYPES[UA_TYPES_BYTESTRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "DictionaryFragment"); - attr.description = UA_LOCALIZEDTEXT("", "A fragment of a data type dictionary that defines the data type."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 105), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "DictionaryFragment"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 105), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 69), false); - return retVal; -} - -/* DataTypeVersion - ns=0;i=104 */ - -static UA_StatusCode function_ua_namespace0_19(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - void *variablenode_ns_0_i_104_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize); - UA_init(variablenode_ns_0_i_104_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_104_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "DataTypeVersion"); - attr.description = UA_LOCALIZEDTEXT("", "The version number for the data type description."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 104), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "DataTypeVersion"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 104), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 69), false); - return retVal; -} - -/* DataTypeDictionaryType - ns=0;i=72 */ - -static UA_StatusCode function_ua_namespace0_20(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableTypeAttributes attr = UA_VariableTypeAttributes_default; - attr.valueRank = (UA_Int32)-2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 24); - attr.displayName = UA_LOCALIZEDTEXT("", "DataTypeDictionaryType"); - attr.description = - UA_LOCALIZEDTEXT("", "The type for variable that represents the collection of data type decriptions."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableTypeNode( - server, UA_NODEID_NUMERIC(ns[0], 72), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "DataTypeDictionaryType"), UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 72), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 63), false); - return retVal; -} - -/* DataTypeVersion - ns=0;i=106 */ - -static UA_StatusCode function_ua_namespace0_21(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - void *variablenode_ns_0_i_106_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize); - UA_init(variablenode_ns_0_i_106_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_106_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "DataTypeVersion"); - attr.description = UA_LOCALIZEDTEXT("", "The version number for the data type dictionary."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 106), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "DataTypeVersion"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 106), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 72), false); - return retVal; -} - -/* NamespaceUri - ns=0;i=107 */ - -static UA_StatusCode function_ua_namespace0_22(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - void *variablenode_ns_0_i_107_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize); - UA_init(variablenode_ns_0_i_107_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_107_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "NamespaceUri"); - attr.description = UA_LOCALIZEDTEXT("", "A URI that uniquely identifies the dictionary."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 107), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "NamespaceUri"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 107), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 72), false); - return retVal; -} - -/* DataTypeSystemType - ns=0;i=75 */ - -static UA_StatusCode function_ua_namespace0_23(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectTypeAttributes attr = UA_ObjectTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "DataTypeSystemType"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(ns[0], 75), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "DataTypeSystemType"), - attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 75), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 58), false); - return retVal; -} - -/* OPC Binary - ns=0;i=93 */ - -static UA_StatusCode function_ua_namespace0_24(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "OPC Binary"); - attr.description = - UA_LOCALIZEDTEXT("", "A type system which uses OPC binary schema to describe the encoding of data types."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 93), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "OPC Binary"), - UA_NODEID_NUMERIC(ns[0], 75), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 93), UA_NODEID_NUMERIC(ns[0], 35), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 90), false); - return retVal; -} - -/* Opc.Ua - ns=0;i=7617 */ - -static UA_StatusCode function_ua_namespace0_25(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 15); - UA_ByteString *variablenode_ns_0_i_7617_variant_DataContents = UA_ByteString_new(); - *variablenode_ns_0_i_7617_variant_DataContents = UA_BYTESTRING_ALLOC( - "An XML element encoded as a UTF-8 string.The " - "possible encodings for a NodeId value.An identifier for a node " - "in a UA server address space.An identifier for a node " - "in a UA server address space qualifie" - "d with a complete namespace string.A 32-bit status code " - "value.A " - "recursive structure containing diagnostic information associated with a status " - "code.A string qualified with a " - "namespace index.A string qualified with a namespace " - "index.A value with an associated timestamp, and " - "quality.A serialized object prefixed with its data type identifi" - "er.<" - "opc:Documentation>A union of several types.An argument for a method.A mapping between a value o" - "f an enumerated type and a name and description."); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_7617_variant_DataContents, &UA_TYPES[UA_TYPES_BYTESTRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "Opc.Ua"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 7617), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Opc.Ua"), - UA_NODEID_NUMERIC(ns[0], 72), attr, NULL, NULL); - UA_ByteString_delete(variablenode_ns_0_i_7617_variant_DataContents); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 7617), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 93), false); - return retVal; -} - -/* EnumValueType - ns=0;i=7656 */ - -static UA_StatusCode function_ua_namespace0_26(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - UA_String *variablenode_ns_0_i_7656_variant_DataContents = UA_String_new(); - *variablenode_ns_0_i_7656_variant_DataContents = UA_STRING_ALLOC("EnumValueType"); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_7656_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "EnumValueType"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 7656), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "EnumValueType"), - UA_NODEID_NUMERIC(ns[0], 69), attr, NULL, NULL); - UA_String_delete(variablenode_ns_0_i_7656_variant_DataContents); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 7656), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 7617), false); - return retVal; -} - -/* Argument - ns=0;i=7650 */ - -static UA_StatusCode function_ua_namespace0_27(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - UA_String *variablenode_ns_0_i_7650_variant_DataContents = UA_String_new(); - *variablenode_ns_0_i_7650_variant_DataContents = UA_STRING_ALLOC("Argument"); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_7650_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "Argument"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 7650), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Argument"), - UA_NODEID_NUMERIC(ns[0], 69), attr, NULL, NULL); - UA_String_delete(variablenode_ns_0_i_7650_variant_DataContents); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 7650), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 7617), false); - return retVal; -} - -/* DataTypeEncodingType - ns=0;i=76 */ - -static UA_StatusCode function_ua_namespace0_28(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectTypeAttributes attr = UA_ObjectTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "DataTypeEncodingType"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(ns[0], 76), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "DataTypeEncodingType"), - attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 76), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 58), false); - return retVal; -} - -/* ModellingRuleType - ns=0;i=77 */ - -static UA_StatusCode function_ua_namespace0_29(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectTypeAttributes attr = UA_ObjectTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ModellingRuleType"); - attr.description = UA_LOCALIZEDTEXT( - "", "The type for an object that describes how an instance declaration is used when a type is instantiated."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(ns[0], 77), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ModellingRuleType"), attr, - NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 77), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 58), false); - return retVal; -} - -/* NamingRule - ns=0;i=111 */ - -static UA_StatusCode function_ua_namespace0_30(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 120); - UA_Int32 *variablenode_ns_0_i_111_variant_DataContents = UA_Int32_new(); - *variablenode_ns_0_i_111_variant_DataContents = (UA_Int32)1; - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_111_variant_DataContents, &UA_TYPES[UA_TYPES_INT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "NamingRule"); - attr.description = UA_LOCALIZEDTEXT("", "Specified the significances of the BrowseName when a type is instantiated."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 111), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "NamingRule"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Int32_delete(variablenode_ns_0_i_111_variant_DataContents); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 111), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 77), false); - return retVal; -} - -/* Optional - ns=0;i=80 */ - -static UA_StatusCode function_ua_namespace0_31(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "Optional"); - attr.description = UA_LOCALIZEDTEXT("", - "Specifies that an instance with the attributes and references of the instance " - "declaration may appear when a type is instantiated."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 80), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Optional"), - UA_NODEID_NUMERIC(ns[0], 77), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 80), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 104), false); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 80), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 106), false); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 80), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 107), false); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 80), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 105), false); - return retVal; -} - -/* NamingRule - ns=0;i=113 */ - -static UA_StatusCode function_ua_namespace0_32(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 120); - UA_Int32 *variablenode_ns_0_i_113_variant_DataContents = UA_Int32_new(); - *variablenode_ns_0_i_113_variant_DataContents = (UA_Int32)2; - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_113_variant_DataContents, &UA_TYPES[UA_TYPES_INT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "NamingRule"); - attr.description = UA_LOCALIZEDTEXT("", "Specified the significances of the BrowseName when a type is instantiated."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 113), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "NamingRule"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Int32_delete(variablenode_ns_0_i_113_variant_DataContents); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 113), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 80), false); - return retVal; -} - -/* Mandatory - ns=0;i=78 */ - -static UA_StatusCode function_ua_namespace0_33(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "Mandatory"); - attr.description = UA_LOCALIZEDTEXT("", - "Specifies that an instance with the attributes and references of the instance " - "declaration must appear when a type is instantiated."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 78), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Mandatory"), - UA_NODEID_NUMERIC(ns[0], 77), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 78), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 7611), false); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 78), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 111), false); - return retVal; -} - -/* NamingRule - ns=0;i=112 */ - -static UA_StatusCode function_ua_namespace0_34(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 120); - UA_Int32 *variablenode_ns_0_i_112_variant_DataContents = UA_Int32_new(); - *variablenode_ns_0_i_112_variant_DataContents = (UA_Int32)1; - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_112_variant_DataContents, &UA_TYPES[UA_TYPES_INT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "NamingRule"); - attr.description = UA_LOCALIZEDTEXT("", "Specified the significances of the BrowseName when a type is instantiated."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 112), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "NamingRule"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Int32_delete(variablenode_ns_0_i_112_variant_DataContents); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 112), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), false); - return retVal; -} - -/* ServerType - ns=0;i=2004 */ - -static UA_StatusCode function_ua_namespace0_35(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectTypeAttributes attr = UA_ObjectTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ServerType"); - attr.description = UA_LOCALIZEDTEXT("", "Specifies the current status and capabilities of the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= - UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(ns[0], 2004), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerType"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2004), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 58), false); - return retVal; -} - -/* Server - ns=0;i=2253 */ - -static UA_StatusCode function_ua_namespace0_36(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.eventNotifier = true; - attr.displayName = UA_LOCALIZEDTEXT("", "Server"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 2253), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Server"), - UA_NODEID_NUMERIC(ns[0], 2004), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2253), UA_NODEID_NUMERIC(ns[0], 35), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 85), false); - return retVal; -} - -/* ServiceLevel - ns=0;i=2267 */ - -static UA_StatusCode function_ua_namespace0_37(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 3); - void *variablenode_ns_0_i_2267_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_BYTE].memSize); - UA_init(variablenode_ns_0_i_2267_variant_DataContents, &UA_TYPES[UA_TYPES_BYTE]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2267_variant_DataContents, &UA_TYPES[UA_TYPES_BYTE]); - attr.displayName = UA_LOCALIZEDTEXT("", "ServiceLevel"); - attr.description = - UA_LOCALIZEDTEXT("", "A value indicating the level of service the server can provide. 255 indicates the best."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2267), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServiceLevel"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2267), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2253), false); - return retVal; -} - -/* NamespaceArray - ns=0;i=2255 */ - -static UA_StatusCode function_ua_namespace0_38(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = 1; - attr.arrayDimensionsSize = 1; - attr.arrayDimensions = (UA_UInt32 *)UA_Array_new(1, &UA_TYPES[UA_TYPES_UINT32]); - attr.arrayDimensions[0] = 0; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - UA_String *variablenode_ns_0_i_2255_variant_DataContents = - (UA_String *)UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize * 1); - UA_init(&variablenode_ns_0_i_2255_variant_DataContents[0], &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setArray(&attr.value, variablenode_ns_0_i_2255_variant_DataContents, (UA_Int32)1, - &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "NamespaceArray"); - attr.description = UA_LOCALIZEDTEXT("", "The list of namespace URIs used by the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2255), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "NamespaceArray"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Array_delete(attr.arrayDimensions, 1, &UA_TYPES[UA_TYPES_UINT32]); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2255), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2253), false); - return retVal; -} - -/* GetMonitoredItems - ns=0;i=11492 */ - -static UA_StatusCode function_ua_namespace0_39(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_MethodAttributes attr = UA_MethodAttributes_default; - attr.executable = true; - attr.userExecutable = true; - attr.displayName = UA_LOCALIZEDTEXT("", "GetMonitoredItems"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(ns[0], 11492), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "GetMonitoredItems"), attr, - NULL, 0, NULL, 0, NULL, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11492), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2253), false); - return retVal; -} - -/* ServerArray - ns=0;i=2254 */ - -static UA_StatusCode function_ua_namespace0_40(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = 1; - attr.arrayDimensionsSize = 1; - attr.arrayDimensions = (UA_UInt32 *)UA_Array_new(1, &UA_TYPES[UA_TYPES_UINT32]); - attr.arrayDimensions[0] = 0; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - UA_String *variablenode_ns_0_i_2254_variant_DataContents = - (UA_String *)UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize * 1); - UA_init(&variablenode_ns_0_i_2254_variant_DataContents[0], &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setArray(&attr.value, variablenode_ns_0_i_2254_variant_DataContents, (UA_Int32)1, - &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "ServerArray"); - attr.description = UA_LOCALIZEDTEXT("", "The list of server URIs used by the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2254), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerArray"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Array_delete(attr.arrayDimensions, 1, &UA_TYPES[UA_TYPES_UINT32]); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2254), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2253), false); - return retVal; -} - -/* Auditing - ns=0;i=2994 */ - -static UA_StatusCode function_ua_namespace0_41(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 1); - void *variablenode_ns_0_i_2994_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_BOOLEAN].memSize); - UA_init(variablenode_ns_0_i_2994_variant_DataContents, &UA_TYPES[UA_TYPES_BOOLEAN]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2994_variant_DataContents, &UA_TYPES[UA_TYPES_BOOLEAN]); - attr.displayName = UA_LOCALIZEDTEXT("", "Auditing"); - attr.description = UA_LOCALIZEDTEXT("", "A flag indicating whether the server is currently generating audit events."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2994), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Auditing"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2994), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2253), false); - return retVal; -} - -/* ServerCapabilitiesType - ns=0;i=2013 */ - -static UA_StatusCode function_ua_namespace0_42(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectTypeAttributes attr = UA_ObjectTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ServerCapabilitiesType"); - attr.description = UA_LOCALIZEDTEXT("", "Describes the capabilities supported by the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(ns[0], 2013), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerCapabilitiesType"), - attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2013), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 58), false); - return retVal; -} - -/* ServerCapabilities - ns=0;i=2268 */ - -static UA_StatusCode function_ua_namespace0_43(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ServerCapabilities"); - attr.description = UA_LOCALIZEDTEXT("", "Describes capabilities supported by the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 2268), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerCapabilities"), - UA_NODEID_NUMERIC(ns[0], 2013), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2268), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2253), false); - return retVal; -} - -/* MaxBrowseContinuationPoints - ns=0;i=2735 */ - -static UA_StatusCode function_ua_namespace0_44(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 5); - void *variablenode_ns_0_i_2735_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT16].memSize); - UA_init(variablenode_ns_0_i_2735_variant_DataContents, &UA_TYPES[UA_TYPES_UINT16]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2735_variant_DataContents, &UA_TYPES[UA_TYPES_UINT16]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxBrowseContinuationPoints"); - attr.description = - UA_LOCALIZEDTEXT("", "The maximum number of continuation points for Browse operations per session."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode( - server, UA_NODEID_NUMERIC(ns[0], 2735), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "MaxBrowseContinuationPoints"), UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2735), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2268), false); - return retVal; -} - -/* ServerProfileArray - ns=0;i=2269 */ - -static UA_StatusCode function_ua_namespace0_45(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = 1; - attr.arrayDimensionsSize = 1; - attr.arrayDimensions = (UA_UInt32 *)UA_Array_new(1, &UA_TYPES[UA_TYPES_UINT32]); - attr.arrayDimensions[0] = 0; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - UA_String *variablenode_ns_0_i_2269_variant_DataContents = - (UA_String *)UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize * 1); - UA_init(&variablenode_ns_0_i_2269_variant_DataContents[0], &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setArray(&attr.value, variablenode_ns_0_i_2269_variant_DataContents, (UA_Int32)1, - &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "ServerProfileArray"); - attr.description = UA_LOCALIZEDTEXT("", "A list of profiles supported by the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2269), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerProfileArray"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Array_delete(attr.arrayDimensions, 1, &UA_TYPES[UA_TYPES_UINT32]); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2269), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2268), false); - return retVal; -} - -/* MinSupportedSampleRate - ns=0;i=2272 */ - -static UA_StatusCode function_ua_namespace0_46(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 11); - void *variablenode_ns_0_i_2272_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_DOUBLE].memSize); - UA_init(variablenode_ns_0_i_2272_variant_DataContents, &UA_TYPES[UA_TYPES_DOUBLE]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2272_variant_DataContents, &UA_TYPES[UA_TYPES_DOUBLE]); - attr.displayName = UA_LOCALIZEDTEXT("", "MinSupportedSampleRate"); - attr.description = UA_LOCALIZEDTEXT("", "The minimum sampling interval supported by the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2272), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MinSupportedSampleRate"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2272), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2268), false); - return retVal; -} - -/* LocaleIdArray - ns=0;i=2271 */ - -static UA_StatusCode function_ua_namespace0_47(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = 1; - attr.arrayDimensionsSize = 1; - attr.arrayDimensions = (UA_UInt32 *)UA_Array_new(1, &UA_TYPES[UA_TYPES_UINT32]); - attr.arrayDimensions[0] = 0; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - UA_String *variablenode_ns_0_i_2271_variant_DataContents = - (UA_String *)UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize * 1); - UA_init(&variablenode_ns_0_i_2271_variant_DataContents[0], &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setArray(&attr.value, variablenode_ns_0_i_2271_variant_DataContents, (UA_Int32)1, - &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "LocaleIdArray"); - attr.description = UA_LOCALIZEDTEXT("", "A list of locales supported by the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2271), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "LocaleIdArray"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Array_delete(attr.arrayDimensions, 1, &UA_TYPES[UA_TYPES_UINT32]); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2271), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2268), false); - return retVal; -} - -/* MaxHistoryContinuationPoints - ns=0;i=2737 */ - -static UA_StatusCode function_ua_namespace0_48(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 5); - void *variablenode_ns_0_i_2737_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT16].memSize); - UA_init(variablenode_ns_0_i_2737_variant_DataContents, &UA_TYPES[UA_TYPES_UINT16]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2737_variant_DataContents, &UA_TYPES[UA_TYPES_UINT16]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxHistoryContinuationPoints"); - attr.description = - UA_LOCALIZEDTEXT("", "The maximum number of continuation points for ReadHistory operations per session."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode( - server, UA_NODEID_NUMERIC(ns[0], 2737), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "MaxHistoryContinuationPoints"), UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2737), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2268), false); - return retVal; -} - -/* MaxQueryContinuationPoints - ns=0;i=2736 */ - -static UA_StatusCode function_ua_namespace0_49(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 5); - void *variablenode_ns_0_i_2736_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT16].memSize); - UA_init(variablenode_ns_0_i_2736_variant_DataContents, &UA_TYPES[UA_TYPES_UINT16]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2736_variant_DataContents, &UA_TYPES[UA_TYPES_UINT16]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxQueryContinuationPoints"); - attr.description = - UA_LOCALIZEDTEXT("", "The maximum number of continuation points for Query operations per session."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode( - server, UA_NODEID_NUMERIC(ns[0], 2736), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "MaxQueryContinuationPoints"), UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2736), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2268), false); - return retVal; -} - -/* ServerDiagnosticsType - ns=0;i=2020 */ - -static UA_StatusCode function_ua_namespace0_50(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectTypeAttributes attr = UA_ObjectTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ServerDiagnosticsType"); - attr.description = UA_LOCALIZEDTEXT("", "The diagnostics information for a server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(ns[0], 2020), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerDiagnosticsType"), - attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2020), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 58), false); - return retVal; -} - -/* ServerDiagnostics - ns=0;i=2274 */ - -static UA_StatusCode function_ua_namespace0_51(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ServerDiagnostics"); - attr.description = UA_LOCALIZEDTEXT("", "Reports diagnostics about the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 2274), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerDiagnostics"), - UA_NODEID_NUMERIC(ns[0], 2020), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2274), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2253), false); - return retVal; -} - -/* EnabledFlag - ns=0;i=2294 */ - -static UA_StatusCode function_ua_namespace0_52(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 3; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 1); - void *variablenode_ns_0_i_2294_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_BOOLEAN].memSize); - UA_init(variablenode_ns_0_i_2294_variant_DataContents, &UA_TYPES[UA_TYPES_BOOLEAN]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2294_variant_DataContents, &UA_TYPES[UA_TYPES_BOOLEAN]); - attr.displayName = UA_LOCALIZEDTEXT("", "EnabledFlag"); - attr.description = UA_LOCALIZEDTEXT("", "If TRUE the diagnostics collection is enabled."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2294), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "EnabledFlag"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2294), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2274), false); - return retVal; -} - -/* ServerRedundancyType - ns=0;i=2034 */ - -static UA_StatusCode function_ua_namespace0_53(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectTypeAttributes attr = UA_ObjectTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ServerRedundancyType"); - attr.description = UA_LOCALIZEDTEXT("", "A base type for an object that describe how a server supports redundancy."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(ns[0], 2034), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerRedundancyType"), - attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2034), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 58), false); - return retVal; -} - -/* RedundancySupport - ns=0;i=2035 */ - -static UA_StatusCode function_ua_namespace0_54(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 851); - void *variablenode_ns_0_i_2035_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT].memSize); - UA_init(variablenode_ns_0_i_2035_variant_DataContents, &UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2035_variant_DataContents, - &UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT]); - attr.displayName = UA_LOCALIZEDTEXT("", "RedundancySupport"); - attr.description = UA_LOCALIZEDTEXT("", "Indicates what style of redundancy is supported by the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2035), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "RedundancySupport"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2035), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2035), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2034), false); - return retVal; -} - -/* ServerRedundancy - ns=0;i=2296 */ - -static UA_StatusCode function_ua_namespace0_55(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ServerRedundancy"); - attr.description = UA_LOCALIZEDTEXT("", "Describes the redundancy capabilities of the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 2296), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerRedundancy"), - UA_NODEID_NUMERIC(ns[0], 2034), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2296), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2253), false); - return retVal; -} - -/* RedundancySupport - ns=0;i=3709 */ - -static UA_StatusCode function_ua_namespace0_56(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 851); - void *variablenode_ns_0_i_3709_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT].memSize); - UA_init(variablenode_ns_0_i_3709_variant_DataContents, &UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_3709_variant_DataContents, - &UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT]); - attr.displayName = UA_LOCALIZEDTEXT("", "RedundancySupport"); - attr.description = UA_LOCALIZEDTEXT("", "Indicates what style of redundancy is supported by the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 3709), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "RedundancySupport"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 3709), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2296), false); - return retVal; -} - -/* OperationLimitsType - ns=0;i=11564 */ - -static UA_StatusCode function_ua_namespace0_57(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectTypeAttributes attr = UA_ObjectTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "OperationLimitsType"); - attr.description = UA_LOCALIZEDTEXT("", "Identifies the operation limits imposed by the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectTypeNode(server, UA_NODEID_NUMERIC(ns[0], 11564), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "OperationLimitsType"), - attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11564), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 61), false); - return retVal; -} - -/* MaxNodesPerWrite - ns=0;i=11567 */ - -static UA_StatusCode function_ua_namespace0_58(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11567_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11567_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11567_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerWrite"); - attr.description = UA_LOCALIZEDTEXT("", "The maximum number of operations in a single Write request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11567), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerWrite"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11567), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 80), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11567), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11564), false); - return retVal; -} - -/* MaxNodesPerNodeManagement - ns=0;i=11573 */ - -static UA_StatusCode function_ua_namespace0_59(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11573_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11573_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11573_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerNodeManagement"); - attr.description = UA_LOCALIZEDTEXT( - "", - "The maximum number of operations in a single AddNodes, AddReferences, DeleteNodes or DeleteReferences request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11573), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerNodeManagement"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11573), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 80), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11573), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11564), false); - return retVal; -} - -/* MaxNodesPerRead - ns=0;i=11565 */ - -static UA_StatusCode function_ua_namespace0_60(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11565_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11565_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11565_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerRead"); - attr.description = UA_LOCALIZEDTEXT("", "The maximum number of operations in a single Read request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11565), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerRead"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11565), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 80), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11565), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11564), false); - return retVal; -} - -/* MaxNodesPerTranslateBrowsePathsToNodeIds - ns=0;i=11572 */ - -static UA_StatusCode function_ua_namespace0_61(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11572_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11572_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11572_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerTranslateBrowsePathsToNodeIds"); - attr.description = - UA_LOCALIZEDTEXT("", "The maximum number of operations in a single TranslateBrowsePathsToNodeIds request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11572), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "MaxNodesPerTranslateBrowsePathsToNodeIds"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11572), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 80), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11572), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11564), false); - return retVal; -} - -/* MaxNodesPerBrowse - ns=0;i=11570 */ - -static UA_StatusCode function_ua_namespace0_62(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11570_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11570_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11570_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerBrowse"); - attr.description = UA_LOCALIZEDTEXT("", "The maximum number of operations in a single Browse request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11570), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerBrowse"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11570), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 80), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11570), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11564), false); - return retVal; -} - -/* MaxNodesPerRegisterNodes - ns=0;i=11571 */ - -static UA_StatusCode function_ua_namespace0_63(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11571_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11571_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11571_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerRegisterNodes"); - attr.description = UA_LOCALIZEDTEXT("", "The maximum number of operations in a single RegisterNodes request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11571), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerRegisterNodes"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11571), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 80), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11571), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11564), false); - return retVal; -} - -/* MaxNodesPerMethodCall - ns=0;i=11569 */ - -static UA_StatusCode function_ua_namespace0_64(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11569_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11569_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11569_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerMethodCall"); - attr.description = UA_LOCALIZEDTEXT("", "The maximum number of operations in a single Call request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11569), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerMethodCall"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11569), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 80), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11569), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11564), false); - return retVal; -} - -/* MaxMonitoredItemsPerCall - ns=0;i=11574 */ - -static UA_StatusCode function_ua_namespace0_65(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11574_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11574_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11574_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxMonitoredItemsPerCall"); - attr.description = - UA_LOCALIZEDTEXT("", "The maximum number of operations in a single MonitoredItem related request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11574), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxMonitoredItemsPerCall"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11574), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 80), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11574), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11564), false); - return retVal; -} - -/* OperationLimits - ns=0;i=11551 */ - -static UA_StatusCode function_ua_namespace0_66(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "OperationLimits"); - attr.description = UA_LOCALIZEDTEXT("", "Defines the limits supported by the server for different operations."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 11551), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "OperationLimits"), - UA_NODEID_NUMERIC(ns[0], 11564), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11551), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 80), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11551), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2013), false); - return retVal; -} - -/* OperationLimits - ns=0;i=11704 */ - -static UA_StatusCode function_ua_namespace0_67(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "OperationLimits"); - attr.description = UA_LOCALIZEDTEXT("", "Defines the limits supported by the server for different operations."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 11704), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "OperationLimits"), - UA_NODEID_NUMERIC(ns[0], 11564), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11704), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2268), false); - return retVal; -} - -/* MaxNodesPerWrite - ns=0;i=11707 */ - -static UA_StatusCode function_ua_namespace0_68(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11707_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11707_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11707_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerWrite"); - attr.description = UA_LOCALIZEDTEXT("", "The maximum number of operations in a single Write request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11707), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerWrite"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11707), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11704), false); - return retVal; -} - -/* MaxNodesPerMethodCall - ns=0;i=11709 */ - -static UA_StatusCode function_ua_namespace0_69(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11709_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11709_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11709_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerMethodCall"); - attr.description = UA_LOCALIZEDTEXT("", "The maximum number of operations in a single Call request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11709), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerMethodCall"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11709), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11704), false); - return retVal; -} - -/* MaxNodesPerNodeManagement - ns=0;i=11713 */ - -static UA_StatusCode function_ua_namespace0_70(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11713_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11713_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11713_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerNodeManagement"); - attr.description = UA_LOCALIZEDTEXT( - "", - "The maximum number of operations in a single AddNodes, AddReferences, DeleteNodes or DeleteReferences request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11713), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerNodeManagement"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11713), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11704), false); - return retVal; -} - -/* MaxNodesPerRead - ns=0;i=11705 */ - -static UA_StatusCode function_ua_namespace0_71(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11705_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11705_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11705_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerRead"); - attr.description = UA_LOCALIZEDTEXT("", "The maximum number of operations in a single Read request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11705), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerRead"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11705), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11704), false); - return retVal; -} - -/* MaxNodesPerTranslateBrowsePathsToNodeIds - ns=0;i=11712 */ - -static UA_StatusCode function_ua_namespace0_72(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11712_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11712_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11712_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerTranslateBrowsePathsToNodeIds"); - attr.description = - UA_LOCALIZEDTEXT("", "The maximum number of operations in a single TranslateBrowsePathsToNodeIds request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11712), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "MaxNodesPerTranslateBrowsePathsToNodeIds"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11712), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11704), false); - return retVal; -} - -/* MaxNodesPerRegisterNodes - ns=0;i=11711 */ - -static UA_StatusCode function_ua_namespace0_73(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11711_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11711_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11711_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerRegisterNodes"); - attr.description = UA_LOCALIZEDTEXT("", "The maximum number of operations in a single RegisterNodes request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11711), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerRegisterNodes"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11711), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11704), false); - return retVal; -} - -/* MaxNodesPerBrowse - ns=0;i=11710 */ - -static UA_StatusCode function_ua_namespace0_74(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11710_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11710_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11710_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxNodesPerBrowse"); - attr.description = UA_LOCALIZEDTEXT("", "The maximum number of operations in a single Browse request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11710), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxNodesPerBrowse"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11710), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11704), false); - return retVal; -} - -/* MaxMonitoredItemsPerCall - ns=0;i=11714 */ - -static UA_StatusCode function_ua_namespace0_75(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_11714_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_11714_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_11714_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "MaxMonitoredItemsPerCall"); - attr.description = - UA_LOCALIZEDTEXT("", "The maximum number of operations in a single MonitoredItem related request."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11714), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "MaxMonitoredItemsPerCall"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11714), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11704), false); - return retVal; -} - -/* ServerStatusType - ns=0;i=2138 */ - -static UA_StatusCode function_ua_namespace0_76(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableTypeAttributes attr = UA_VariableTypeAttributes_default; - attr.valueRank = (UA_Int32)-2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 24); - attr.displayName = UA_LOCALIZEDTEXT("", "ServerStatusType"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableTypeNode(server, UA_NODEID_NUMERIC(ns[0], 2138), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerStatusType"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2138), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 63), false); - return retVal; -} - -/* BuildInfoType - ns=0;i=3051 */ - -static UA_StatusCode function_ua_namespace0_77(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableTypeAttributes attr = UA_VariableTypeAttributes_default; - attr.valueRank = (UA_Int32)-2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 24); - attr.displayName = UA_LOCALIZEDTEXT("", "BuildInfoType"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableTypeNode(server, UA_NODEID_NUMERIC(ns[0], 3051), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "BuildInfoType"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 3051), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 63), false); - return retVal; -} - -/* ServerDiagnosticsSummaryType - ns=0;i=2150 */ - -static UA_StatusCode function_ua_namespace0_78(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableTypeAttributes attr = UA_VariableTypeAttributes_default; - attr.valueRank = (UA_Int32)-2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 24); - attr.displayName = UA_LOCALIZEDTEXT("", "ServerDiagnosticsSummaryType"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableTypeNode( - server, UA_NODEID_NUMERIC(ns[0], 2150), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "ServerDiagnosticsSummaryType"), UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2150), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 63), false); - return retVal; -} - -/* CumulatedSessionCount - ns=0;i=2153 */ - -static UA_StatusCode function_ua_namespace0_79(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2153_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2153_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2153_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "CumulatedSessionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2153), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "CumulatedSessionCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2153), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2153), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* SecurityRejectedSessionCount - ns=0;i=2154 */ - -static UA_StatusCode function_ua_namespace0_80(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2154_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2154_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2154_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "SecurityRejectedSessionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode( - server, UA_NODEID_NUMERIC(ns[0], 2154), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "SecurityRejectedSessionCount"), UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2154), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2154), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* RejectedRequestsCount - ns=0;i=2163 */ - -static UA_StatusCode function_ua_namespace0_81(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2163_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2163_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2163_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "RejectedRequestsCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2163), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "RejectedRequestsCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2163), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2163), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* SessionAbortCount - ns=0;i=2157 */ - -static UA_StatusCode function_ua_namespace0_82(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2157_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2157_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2157_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "SessionAbortCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2157), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "SessionAbortCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2157), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2157), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* CurrentSubscriptionCount - ns=0;i=2160 */ - -static UA_StatusCode function_ua_namespace0_83(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2160_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2160_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2160_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "CurrentSubscriptionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2160), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "CurrentSubscriptionCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2160), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2160), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* CumulatedSubscriptionCount - ns=0;i=2161 */ - -static UA_StatusCode function_ua_namespace0_84(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2161_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2161_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2161_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "CumulatedSubscriptionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode( - server, UA_NODEID_NUMERIC(ns[0], 2161), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "CumulatedSubscriptionCount"), UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2161), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2161), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* RejectedSessionCount - ns=0;i=2155 */ - -static UA_StatusCode function_ua_namespace0_85(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2155_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2155_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2155_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "RejectedSessionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2155), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "RejectedSessionCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2155), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2155), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* PublishingIntervalCount - ns=0;i=2159 */ - -static UA_StatusCode function_ua_namespace0_86(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2159_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2159_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2159_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "PublishingIntervalCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2159), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "PublishingIntervalCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2159), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2159), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* SecurityRejectedRequestsCount - ns=0;i=2162 */ - -static UA_StatusCode function_ua_namespace0_87(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2162_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2162_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2162_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "SecurityRejectedRequestsCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode( - server, UA_NODEID_NUMERIC(ns[0], 2162), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "SecurityRejectedRequestsCount"), UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2162), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2162), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* ServerViewCount - ns=0;i=2151 */ - -static UA_StatusCode function_ua_namespace0_88(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2151_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2151_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2151_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "ServerViewCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2151), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerViewCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2151), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2151), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* SessionTimeoutCount - ns=0;i=2156 */ - -static UA_StatusCode function_ua_namespace0_89(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2156_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2156_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2156_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "SessionTimeoutCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2156), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "SessionTimeoutCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2156), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2156), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* CurrentSessionCount - ns=0;i=2152 */ - -static UA_StatusCode function_ua_namespace0_90(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2152_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2152_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2152_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "CurrentSessionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2152), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "CurrentSessionCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2152), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2152), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2150), false); - return retVal; -} - -/* Argument - ns=0;i=296 */ - -static UA_StatusCode function_ua_namespace0_91(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "Argument"); - attr.description = UA_LOCALIZEDTEXT("", "An argument for a method."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= - UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 296), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Argument"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 296), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 22), false); - return retVal; -} - -/* Default Binary - ns=0;i=298 */ - -static UA_StatusCode function_ua_namespace0_92(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "Default Binary"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 298), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Default Binary"), - UA_NODEID_NUMERIC(ns[0], 76), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 298), UA_NODEID_NUMERIC(ns[0], 39), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 7650), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 298), UA_NODEID_NUMERIC(ns[0], 38), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 296), false); - return retVal; -} - -/* OutputArguments - ns=0;i=11494 */ - -static UA_StatusCode function_ua_namespace0_93(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = 1; - attr.arrayDimensionsSize = 1; - attr.arrayDimensions = (UA_UInt32 *)UA_Array_new(1, &UA_TYPES[UA_TYPES_UINT32]); - attr.arrayDimensions[0] = 0; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 296); - - struct { - UA_String Name; - UA_NodeId DataType; - UA_Int32 ValueRank; - UA_Int32 ArrayDimensionsSize; - UA_UInt32 *ArrayDimensions; - UA_LocalizedText Description; - } variablenode_ns_0_i_11494_Argument_0_0_struct; - variablenode_ns_0_i_11494_Argument_0_0_struct.Name = UA_STRING("ServerHandles"); - variablenode_ns_0_i_11494_Argument_0_0_struct.DataType = UA_NODEID_NUMERIC(ns[0], 7); - variablenode_ns_0_i_11494_Argument_0_0_struct.ValueRank = (UA_Int32)1; - variablenode_ns_0_i_11494_Argument_0_0_struct.ArrayDimensionsSize = 1; - variablenode_ns_0_i_11494_Argument_0_0_struct.ArrayDimensions = (UA_UInt32 *)UA_malloc(sizeof(UA_UInt32)); - variablenode_ns_0_i_11494_Argument_0_0_struct.ArrayDimensions[0] = (UA_UInt32)0; - variablenode_ns_0_i_11494_Argument_0_0_struct.Description = UA_LOCALIZEDTEXT("", ""); - UA_ExtensionObject *variablenode_ns_0_i_11494_Argument_0_0 = UA_ExtensionObject_new(); - variablenode_ns_0_i_11494_Argument_0_0->encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING; - variablenode_ns_0_i_11494_Argument_0_0->content.encoded.typeId = UA_NODEID_NUMERIC(0, 298); - if (UA_ByteString_allocBuffer(&variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body, 65000) != - UA_STATUSCODE_GOOD) { - } - UA_Byte *posvariablenode_ns_0_i_11494_Argument_0_0 = - variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data; - const UA_Byte *endvariablenode_ns_0_i_11494_Argument_0_0 = - &variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data[65000]; - { - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_0_0_struct.Name, &UA_TYPES[UA_TYPES_STRING], - &posvariablenode_ns_0_i_11494_Argument_0_0, &endvariablenode_ns_0_i_11494_Argument_0_0, - NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_0_0_struct.DataType, &UA_TYPES[UA_TYPES_NODEID], - &posvariablenode_ns_0_i_11494_Argument_0_0, &endvariablenode_ns_0_i_11494_Argument_0_0, - NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_0_0_struct.ValueRank, &UA_TYPES[UA_TYPES_INT32], - &posvariablenode_ns_0_i_11494_Argument_0_0, &endvariablenode_ns_0_i_11494_Argument_0_0, - NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_0_0_struct.ArrayDimensions[0], - &UA_TYPES[UA_TYPES_UINT32], &posvariablenode_ns_0_i_11494_Argument_0_0, - &endvariablenode_ns_0_i_11494_Argument_0_0, NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_0_0_struct.Description, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_11494_Argument_0_0, - &endvariablenode_ns_0_i_11494_Argument_0_0, NULL, NULL); - } - size_t variablenode_ns_0_i_11494_Argument_0_0_encOffset = (uintptr_t)( - posvariablenode_ns_0_i_11494_Argument_0_0 - variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data); - variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.length = - variablenode_ns_0_i_11494_Argument_0_0_encOffset; - UA_Byte *variablenode_ns_0_i_11494_Argument_0_0_newBody = - (UA_Byte *)UA_malloc(variablenode_ns_0_i_11494_Argument_0_0_encOffset); - memcpy(variablenode_ns_0_i_11494_Argument_0_0_newBody, - variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data, - variablenode_ns_0_i_11494_Argument_0_0_encOffset); - UA_Byte *variablenode_ns_0_i_11494_Argument_0_0_oldBody = - variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data; - variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data = variablenode_ns_0_i_11494_Argument_0_0_newBody; - UA_free(variablenode_ns_0_i_11494_Argument_0_0_oldBody); - - struct { - UA_String Name; - UA_NodeId DataType; - UA_Int32 ValueRank; - UA_Int32 ArrayDimensionsSize; - UA_UInt32 *ArrayDimensions; - UA_LocalizedText Description; - } variablenode_ns_0_i_11494_Argument_1_0_struct; - variablenode_ns_0_i_11494_Argument_1_0_struct.Name = UA_STRING("ClientHandles"); - variablenode_ns_0_i_11494_Argument_1_0_struct.DataType = UA_NODEID_NUMERIC(ns[0], 7); - variablenode_ns_0_i_11494_Argument_1_0_struct.ValueRank = (UA_Int32)1; - variablenode_ns_0_i_11494_Argument_1_0_struct.ArrayDimensionsSize = 1; - variablenode_ns_0_i_11494_Argument_1_0_struct.ArrayDimensions = (UA_UInt32 *)UA_malloc(sizeof(UA_UInt32)); - variablenode_ns_0_i_11494_Argument_1_0_struct.ArrayDimensions[0] = (UA_UInt32)0; - variablenode_ns_0_i_11494_Argument_1_0_struct.Description = UA_LOCALIZEDTEXT("", ""); - UA_ExtensionObject *variablenode_ns_0_i_11494_Argument_1_0 = UA_ExtensionObject_new(); - variablenode_ns_0_i_11494_Argument_1_0->encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING; - variablenode_ns_0_i_11494_Argument_1_0->content.encoded.typeId = UA_NODEID_NUMERIC(0, 298); - if (UA_ByteString_allocBuffer(&variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body, 65000) != - UA_STATUSCODE_GOOD) { - } - UA_Byte *posvariablenode_ns_0_i_11494_Argument_1_0 = - variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data; - const UA_Byte *endvariablenode_ns_0_i_11494_Argument_1_0 = - &variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data[65000]; - { - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_1_0_struct.Name, &UA_TYPES[UA_TYPES_STRING], - &posvariablenode_ns_0_i_11494_Argument_1_0, &endvariablenode_ns_0_i_11494_Argument_1_0, - NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_1_0_struct.DataType, &UA_TYPES[UA_TYPES_NODEID], - &posvariablenode_ns_0_i_11494_Argument_1_0, &endvariablenode_ns_0_i_11494_Argument_1_0, - NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_1_0_struct.ValueRank, &UA_TYPES[UA_TYPES_INT32], - &posvariablenode_ns_0_i_11494_Argument_1_0, &endvariablenode_ns_0_i_11494_Argument_1_0, - NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_1_0_struct.ArrayDimensions[0], - &UA_TYPES[UA_TYPES_UINT32], &posvariablenode_ns_0_i_11494_Argument_1_0, - &endvariablenode_ns_0_i_11494_Argument_1_0, NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_1_0_struct.Description, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_11494_Argument_1_0, - &endvariablenode_ns_0_i_11494_Argument_1_0, NULL, NULL); - } - size_t variablenode_ns_0_i_11494_Argument_1_0_encOffset = (uintptr_t)( - posvariablenode_ns_0_i_11494_Argument_1_0 - variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data); - variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.length = - variablenode_ns_0_i_11494_Argument_1_0_encOffset; - UA_Byte *variablenode_ns_0_i_11494_Argument_1_0_newBody = - (UA_Byte *)UA_malloc(variablenode_ns_0_i_11494_Argument_1_0_encOffset); - memcpy(variablenode_ns_0_i_11494_Argument_1_0_newBody, - variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data, - variablenode_ns_0_i_11494_Argument_1_0_encOffset); - UA_Byte *variablenode_ns_0_i_11494_Argument_1_0_oldBody = - variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data; - variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data = variablenode_ns_0_i_11494_Argument_1_0_newBody; - UA_free(variablenode_ns_0_i_11494_Argument_1_0_oldBody); - - UA_ExtensionObject variablenode_ns_0_i_11494_variant_DataContents[2]; - variablenode_ns_0_i_11494_variant_DataContents[0] = *variablenode_ns_0_i_11494_Argument_0_0; - variablenode_ns_0_i_11494_variant_DataContents[1] = *variablenode_ns_0_i_11494_Argument_1_0; - UA_Variant_setArray(&attr.value, &variablenode_ns_0_i_11494_variant_DataContents, (UA_Int32)2, - &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]); - attr.displayName = UA_LOCALIZEDTEXT("", "OutputArguments"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11494), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "OutputArguments"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Array_delete(attr.arrayDimensions, 1, &UA_TYPES[UA_TYPES_UINT32]); - - UA_free(variablenode_ns_0_i_11494_Argument_0_0_struct.ArrayDimensions); - UA_ExtensionObject_delete(variablenode_ns_0_i_11494_Argument_0_0); - - UA_free(variablenode_ns_0_i_11494_Argument_1_0_struct.ArrayDimensions); - UA_ExtensionObject_delete(variablenode_ns_0_i_11494_Argument_1_0); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11494), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11492), false); - return retVal; -} - -/* InputArguments - ns=0;i=11493 */ - -static UA_StatusCode function_ua_namespace0_94(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = 1; - attr.arrayDimensionsSize = 1; - attr.arrayDimensions = (UA_UInt32 *)UA_Array_new(1, &UA_TYPES[UA_TYPES_UINT32]); - attr.arrayDimensions[0] = 0; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 296); - - struct { - UA_String Name; - UA_NodeId DataType; - UA_Int32 ValueRank; - UA_Int32 ArrayDimensionsSize; - UA_UInt32 *ArrayDimensions; - UA_LocalizedText Description; - } variablenode_ns_0_i_11493_Argument_0_0_struct; - variablenode_ns_0_i_11493_Argument_0_0_struct.Name = UA_STRING("SubscriptionId"); - variablenode_ns_0_i_11493_Argument_0_0_struct.DataType = UA_NODEID_NUMERIC(ns[0], 7); - variablenode_ns_0_i_11493_Argument_0_0_struct.ValueRank = (UA_Int32)-1; - variablenode_ns_0_i_11493_Argument_0_0_struct.ArrayDimensionsSize = 1; - variablenode_ns_0_i_11493_Argument_0_0_struct.ArrayDimensions = (UA_UInt32 *)UA_malloc(sizeof(UA_UInt32)); - variablenode_ns_0_i_11493_Argument_0_0_struct.ArrayDimensions[0] = (UA_UInt32)0; - variablenode_ns_0_i_11493_Argument_0_0_struct.Description = UA_LOCALIZEDTEXT("", ""); - UA_ExtensionObject *variablenode_ns_0_i_11493_Argument_0_0 = UA_ExtensionObject_new(); - variablenode_ns_0_i_11493_Argument_0_0->encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING; - variablenode_ns_0_i_11493_Argument_0_0->content.encoded.typeId = UA_NODEID_NUMERIC(0, 298); - if (UA_ByteString_allocBuffer(&variablenode_ns_0_i_11493_Argument_0_0->content.encoded.body, 65000) != - UA_STATUSCODE_GOOD) { - } - UA_Byte *posvariablenode_ns_0_i_11493_Argument_0_0 = - variablenode_ns_0_i_11493_Argument_0_0->content.encoded.body.data; - const UA_Byte *endvariablenode_ns_0_i_11493_Argument_0_0 = - &variablenode_ns_0_i_11493_Argument_0_0->content.encoded.body.data[65000]; - { - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11493_Argument_0_0_struct.Name, &UA_TYPES[UA_TYPES_STRING], - &posvariablenode_ns_0_i_11493_Argument_0_0, &endvariablenode_ns_0_i_11493_Argument_0_0, - NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11493_Argument_0_0_struct.DataType, &UA_TYPES[UA_TYPES_NODEID], - &posvariablenode_ns_0_i_11493_Argument_0_0, &endvariablenode_ns_0_i_11493_Argument_0_0, - NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11493_Argument_0_0_struct.ValueRank, &UA_TYPES[UA_TYPES_INT32], - &posvariablenode_ns_0_i_11493_Argument_0_0, &endvariablenode_ns_0_i_11493_Argument_0_0, - NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11493_Argument_0_0_struct.ArrayDimensions[0], - &UA_TYPES[UA_TYPES_UINT32], &posvariablenode_ns_0_i_11493_Argument_0_0, - &endvariablenode_ns_0_i_11493_Argument_0_0, NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_11493_Argument_0_0_struct.Description, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_11493_Argument_0_0, - &endvariablenode_ns_0_i_11493_Argument_0_0, NULL, NULL); - } - size_t variablenode_ns_0_i_11493_Argument_0_0_encOffset = (uintptr_t)( - posvariablenode_ns_0_i_11493_Argument_0_0 - variablenode_ns_0_i_11493_Argument_0_0->content.encoded.body.data); - variablenode_ns_0_i_11493_Argument_0_0->content.encoded.body.length = - variablenode_ns_0_i_11493_Argument_0_0_encOffset; - UA_Byte *variablenode_ns_0_i_11493_Argument_0_0_newBody = - (UA_Byte *)UA_malloc(variablenode_ns_0_i_11493_Argument_0_0_encOffset); - memcpy(variablenode_ns_0_i_11493_Argument_0_0_newBody, - variablenode_ns_0_i_11493_Argument_0_0->content.encoded.body.data, - variablenode_ns_0_i_11493_Argument_0_0_encOffset); - UA_Byte *variablenode_ns_0_i_11493_Argument_0_0_oldBody = - variablenode_ns_0_i_11493_Argument_0_0->content.encoded.body.data; - variablenode_ns_0_i_11493_Argument_0_0->content.encoded.body.data = variablenode_ns_0_i_11493_Argument_0_0_newBody; - UA_free(variablenode_ns_0_i_11493_Argument_0_0_oldBody); - - UA_ExtensionObject variablenode_ns_0_i_11493_variant_DataContents[1]; - variablenode_ns_0_i_11493_variant_DataContents[0] = *variablenode_ns_0_i_11493_Argument_0_0; - UA_Variant_setArray(&attr.value, &variablenode_ns_0_i_11493_variant_DataContents, (UA_Int32)1, - &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]); - attr.displayName = UA_LOCALIZEDTEXT("", "InputArguments"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 11493), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "InputArguments"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Array_delete(attr.arrayDimensions, 1, &UA_TYPES[UA_TYPES_UINT32]); - - UA_free(variablenode_ns_0_i_11493_Argument_0_0_struct.ArrayDimensions); - UA_ExtensionObject_delete(variablenode_ns_0_i_11493_Argument_0_0); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11493), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 11492), false); - return retVal; -} - -/* EnumValueType - ns=0;i=7594 */ - -static UA_StatusCode function_ua_namespace0_95(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "EnumValueType"); - attr.description = - UA_LOCALIZEDTEXT("", "A mapping between a value of an enumerated type and a name and description."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 7594), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "EnumValueType"), attr, NULL, - NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 7594), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 22), false); - return retVal; -} - -/* Default Binary - ns=0;i=8251 */ - -static UA_StatusCode function_ua_namespace0_96(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_ObjectAttributes attr = UA_ObjectAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "Default Binary"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(ns[0], 8251), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "Default Binary"), - UA_NODEID_NUMERIC(ns[0], 76), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 8251), UA_NODEID_NUMERIC(ns[0], 39), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 7656), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 8251), UA_NODEID_NUMERIC(ns[0], 38), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 7594), false); - return retVal; -} - -/* EnumValues - ns=0;i=12169 */ - -static UA_StatusCode function_ua_namespace0_97(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = 1; - attr.arrayDimensionsSize = 1; - attr.arrayDimensions = (UA_UInt32 *)UA_Array_new(1, &UA_TYPES[UA_TYPES_UINT32]); - attr.arrayDimensions[0] = 0; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7594); - - struct { - UA_Int64 Value; - UA_LocalizedText DisplayName; - UA_LocalizedText Description; - } variablenode_ns_0_i_12169_EnumValueType_0_0_struct; - variablenode_ns_0_i_12169_EnumValueType_0_0_struct.Value = (UA_Int64)1; - variablenode_ns_0_i_12169_EnumValueType_0_0_struct.DisplayName = UA_LOCALIZEDTEXT("", "Mandatory"); - variablenode_ns_0_i_12169_EnumValueType_0_0_struct.Description = - UA_LOCALIZEDTEXT("", "The BrowseName must appear in all instances of the type."); - UA_ExtensionObject *variablenode_ns_0_i_12169_EnumValueType_0_0 = UA_ExtensionObject_new(); - variablenode_ns_0_i_12169_EnumValueType_0_0->encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING; - variablenode_ns_0_i_12169_EnumValueType_0_0->content.encoded.typeId = UA_NODEID_NUMERIC(0, 8251); - if (UA_ByteString_allocBuffer(&variablenode_ns_0_i_12169_EnumValueType_0_0->content.encoded.body, 65000) != - UA_STATUSCODE_GOOD) { - } - UA_Byte *posvariablenode_ns_0_i_12169_EnumValueType_0_0 = - variablenode_ns_0_i_12169_EnumValueType_0_0->content.encoded.body.data; - const UA_Byte *endvariablenode_ns_0_i_12169_EnumValueType_0_0 = - &variablenode_ns_0_i_12169_EnumValueType_0_0->content.encoded.body.data[65000]; - { - retVal |= UA_encodeBinary(&variablenode_ns_0_i_12169_EnumValueType_0_0_struct.Value, &UA_TYPES[UA_TYPES_INT64], - &posvariablenode_ns_0_i_12169_EnumValueType_0_0, - &endvariablenode_ns_0_i_12169_EnumValueType_0_0, NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_12169_EnumValueType_0_0_struct.DisplayName, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_12169_EnumValueType_0_0, - &endvariablenode_ns_0_i_12169_EnumValueType_0_0, NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_12169_EnumValueType_0_0_struct.Description, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_12169_EnumValueType_0_0, - &endvariablenode_ns_0_i_12169_EnumValueType_0_0, NULL, NULL); - } - size_t variablenode_ns_0_i_12169_EnumValueType_0_0_encOffset = - (uintptr_t)(posvariablenode_ns_0_i_12169_EnumValueType_0_0 - - variablenode_ns_0_i_12169_EnumValueType_0_0->content.encoded.body.data); - variablenode_ns_0_i_12169_EnumValueType_0_0->content.encoded.body.length = - variablenode_ns_0_i_12169_EnumValueType_0_0_encOffset; - UA_Byte *variablenode_ns_0_i_12169_EnumValueType_0_0_newBody = - (UA_Byte *)UA_malloc(variablenode_ns_0_i_12169_EnumValueType_0_0_encOffset); - memcpy(variablenode_ns_0_i_12169_EnumValueType_0_0_newBody, - variablenode_ns_0_i_12169_EnumValueType_0_0->content.encoded.body.data, - variablenode_ns_0_i_12169_EnumValueType_0_0_encOffset); - UA_Byte *variablenode_ns_0_i_12169_EnumValueType_0_0_oldBody = - variablenode_ns_0_i_12169_EnumValueType_0_0->content.encoded.body.data; - variablenode_ns_0_i_12169_EnumValueType_0_0->content.encoded.body.data = - variablenode_ns_0_i_12169_EnumValueType_0_0_newBody; - UA_free(variablenode_ns_0_i_12169_EnumValueType_0_0_oldBody); - - struct { - UA_Int64 Value; - UA_LocalizedText DisplayName; - UA_LocalizedText Description; - } variablenode_ns_0_i_12169_EnumValueType_1_0_struct; - variablenode_ns_0_i_12169_EnumValueType_1_0_struct.Value = (UA_Int64)2; - variablenode_ns_0_i_12169_EnumValueType_1_0_struct.DisplayName = UA_LOCALIZEDTEXT("", "Optional"); - variablenode_ns_0_i_12169_EnumValueType_1_0_struct.Description = - UA_LOCALIZEDTEXT("", "The BrowseName may appear in an instance of the type."); - UA_ExtensionObject *variablenode_ns_0_i_12169_EnumValueType_1_0 = UA_ExtensionObject_new(); - variablenode_ns_0_i_12169_EnumValueType_1_0->encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING; - variablenode_ns_0_i_12169_EnumValueType_1_0->content.encoded.typeId = UA_NODEID_NUMERIC(0, 8251); - if (UA_ByteString_allocBuffer(&variablenode_ns_0_i_12169_EnumValueType_1_0->content.encoded.body, 65000) != - UA_STATUSCODE_GOOD) { - } - UA_Byte *posvariablenode_ns_0_i_12169_EnumValueType_1_0 = - variablenode_ns_0_i_12169_EnumValueType_1_0->content.encoded.body.data; - const UA_Byte *endvariablenode_ns_0_i_12169_EnumValueType_1_0 = - &variablenode_ns_0_i_12169_EnumValueType_1_0->content.encoded.body.data[65000]; - { - retVal |= UA_encodeBinary(&variablenode_ns_0_i_12169_EnumValueType_1_0_struct.Value, &UA_TYPES[UA_TYPES_INT64], - &posvariablenode_ns_0_i_12169_EnumValueType_1_0, - &endvariablenode_ns_0_i_12169_EnumValueType_1_0, NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_12169_EnumValueType_1_0_struct.DisplayName, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_12169_EnumValueType_1_0, - &endvariablenode_ns_0_i_12169_EnumValueType_1_0, NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_12169_EnumValueType_1_0_struct.Description, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_12169_EnumValueType_1_0, - &endvariablenode_ns_0_i_12169_EnumValueType_1_0, NULL, NULL); - } - size_t variablenode_ns_0_i_12169_EnumValueType_1_0_encOffset = - (uintptr_t)(posvariablenode_ns_0_i_12169_EnumValueType_1_0 - - variablenode_ns_0_i_12169_EnumValueType_1_0->content.encoded.body.data); - variablenode_ns_0_i_12169_EnumValueType_1_0->content.encoded.body.length = - variablenode_ns_0_i_12169_EnumValueType_1_0_encOffset; - UA_Byte *variablenode_ns_0_i_12169_EnumValueType_1_0_newBody = - (UA_Byte *)UA_malloc(variablenode_ns_0_i_12169_EnumValueType_1_0_encOffset); - memcpy(variablenode_ns_0_i_12169_EnumValueType_1_0_newBody, - variablenode_ns_0_i_12169_EnumValueType_1_0->content.encoded.body.data, - variablenode_ns_0_i_12169_EnumValueType_1_0_encOffset); - UA_Byte *variablenode_ns_0_i_12169_EnumValueType_1_0_oldBody = - variablenode_ns_0_i_12169_EnumValueType_1_0->content.encoded.body.data; - variablenode_ns_0_i_12169_EnumValueType_1_0->content.encoded.body.data = - variablenode_ns_0_i_12169_EnumValueType_1_0_newBody; - UA_free(variablenode_ns_0_i_12169_EnumValueType_1_0_oldBody); - - struct { - UA_Int64 Value; - UA_LocalizedText DisplayName; - UA_LocalizedText Description; - } variablenode_ns_0_i_12169_EnumValueType_2_0_struct; - variablenode_ns_0_i_12169_EnumValueType_2_0_struct.Value = (UA_Int64)3; - variablenode_ns_0_i_12169_EnumValueType_2_0_struct.DisplayName = UA_LOCALIZEDTEXT("", "Constraint"); - variablenode_ns_0_i_12169_EnumValueType_2_0_struct.Description = UA_LOCALIZEDTEXT( - "", "The modelling rule defines a constraint and the BrowseName is not used in an instance of the type."); - UA_ExtensionObject *variablenode_ns_0_i_12169_EnumValueType_2_0 = UA_ExtensionObject_new(); - variablenode_ns_0_i_12169_EnumValueType_2_0->encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING; - variablenode_ns_0_i_12169_EnumValueType_2_0->content.encoded.typeId = UA_NODEID_NUMERIC(0, 8251); - if (UA_ByteString_allocBuffer(&variablenode_ns_0_i_12169_EnumValueType_2_0->content.encoded.body, 65000) != - UA_STATUSCODE_GOOD) { - } - UA_Byte *posvariablenode_ns_0_i_12169_EnumValueType_2_0 = - variablenode_ns_0_i_12169_EnumValueType_2_0->content.encoded.body.data; - const UA_Byte *endvariablenode_ns_0_i_12169_EnumValueType_2_0 = - &variablenode_ns_0_i_12169_EnumValueType_2_0->content.encoded.body.data[65000]; - { - retVal |= UA_encodeBinary(&variablenode_ns_0_i_12169_EnumValueType_2_0_struct.Value, &UA_TYPES[UA_TYPES_INT64], - &posvariablenode_ns_0_i_12169_EnumValueType_2_0, - &endvariablenode_ns_0_i_12169_EnumValueType_2_0, NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_12169_EnumValueType_2_0_struct.DisplayName, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_12169_EnumValueType_2_0, - &endvariablenode_ns_0_i_12169_EnumValueType_2_0, NULL, NULL); - retVal |= UA_encodeBinary(&variablenode_ns_0_i_12169_EnumValueType_2_0_struct.Description, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_12169_EnumValueType_2_0, - &endvariablenode_ns_0_i_12169_EnumValueType_2_0, NULL, NULL); - } - size_t variablenode_ns_0_i_12169_EnumValueType_2_0_encOffset = - (uintptr_t)(posvariablenode_ns_0_i_12169_EnumValueType_2_0 - - variablenode_ns_0_i_12169_EnumValueType_2_0->content.encoded.body.data); - variablenode_ns_0_i_12169_EnumValueType_2_0->content.encoded.body.length = - variablenode_ns_0_i_12169_EnumValueType_2_0_encOffset; - UA_Byte *variablenode_ns_0_i_12169_EnumValueType_2_0_newBody = - (UA_Byte *)UA_malloc(variablenode_ns_0_i_12169_EnumValueType_2_0_encOffset); - memcpy(variablenode_ns_0_i_12169_EnumValueType_2_0_newBody, - variablenode_ns_0_i_12169_EnumValueType_2_0->content.encoded.body.data, - variablenode_ns_0_i_12169_EnumValueType_2_0_encOffset); - UA_Byte *variablenode_ns_0_i_12169_EnumValueType_2_0_oldBody = - variablenode_ns_0_i_12169_EnumValueType_2_0->content.encoded.body.data; - variablenode_ns_0_i_12169_EnumValueType_2_0->content.encoded.body.data = - variablenode_ns_0_i_12169_EnumValueType_2_0_newBody; - UA_free(variablenode_ns_0_i_12169_EnumValueType_2_0_oldBody); - - UA_ExtensionObject variablenode_ns_0_i_12169_variant_DataContents[3]; - variablenode_ns_0_i_12169_variant_DataContents[0] = *variablenode_ns_0_i_12169_EnumValueType_0_0; - variablenode_ns_0_i_12169_variant_DataContents[1] = *variablenode_ns_0_i_12169_EnumValueType_1_0; - variablenode_ns_0_i_12169_variant_DataContents[2] = *variablenode_ns_0_i_12169_EnumValueType_2_0; - UA_Variant_setArray(&attr.value, &variablenode_ns_0_i_12169_variant_DataContents, (UA_Int32)3, - &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]); - attr.displayName = UA_LOCALIZEDTEXT("", "EnumValues"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 12169), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "EnumValues"), - UA_NODEID_NUMERIC(ns[0], 68), attr, NULL, NULL); - UA_Array_delete(attr.arrayDimensions, 1, &UA_TYPES[UA_TYPES_UINT32]); - - UA_ExtensionObject_delete(variablenode_ns_0_i_12169_EnumValueType_0_0); - - UA_ExtensionObject_delete(variablenode_ns_0_i_12169_EnumValueType_1_0); - - UA_ExtensionObject_delete(variablenode_ns_0_i_12169_EnumValueType_2_0); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 12169), UA_NODEID_NUMERIC(ns[0], 37), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 78), true); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 12169), UA_NODEID_NUMERIC(ns[0], 46), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 120), false); - return retVal; -} - -/* BuildInfo - ns=0;i=338 */ - -static UA_StatusCode function_ua_namespace0_98(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "BuildInfo"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= - UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 338), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "BuildInfo"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 338), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 22), false); - return retVal; -} - -/* ServerDiagnosticsSummaryDataType - ns=0;i=859 */ - -static UA_StatusCode function_ua_namespace0_99(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ServerDiagnosticsSummaryDataType"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 859), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "ServerDiagnosticsSummaryDataType"), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 859), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 22), false); - return retVal; -} - -/* ServerDiagnosticsSummary - ns=0;i=2275 */ - -static UA_StatusCode function_ua_namespace0_100(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 859); - void *variablenode_ns_0_i_2275_variant_DataContents = - UA_alloca(UA_TYPES[UA_TYPES_SERVERDIAGNOSTICSSUMMARYDATATYPE].memSize); - UA_init(variablenode_ns_0_i_2275_variant_DataContents, &UA_TYPES[UA_TYPES_SERVERDIAGNOSTICSSUMMARYDATATYPE]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2275_variant_DataContents, - &UA_TYPES[UA_TYPES_SERVERDIAGNOSTICSSUMMARYDATATYPE]); - attr.displayName = UA_LOCALIZEDTEXT("", "ServerDiagnosticsSummary"); - attr.description = UA_LOCALIZEDTEXT("", "A summary of server level diagnostics."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2275), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerDiagnosticsSummary"), - UA_NODEID_NUMERIC(ns[0], 2150), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2275), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2274), false); - return retVal; -} - -/* SessionAbortCount - ns=0;i=2282 */ - -static UA_StatusCode function_ua_namespace0_101(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2282_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2282_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2282_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "SessionAbortCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2282), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "SessionAbortCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2282), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* SecurityRejectedSessionCount - ns=0;i=2279 */ - -static UA_StatusCode function_ua_namespace0_102(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2279_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2279_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2279_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "SecurityRejectedSessionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode( - server, UA_NODEID_NUMERIC(ns[0], 2279), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "SecurityRejectedSessionCount"), UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2279), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* RejectedRequestsCount - ns=0;i=2288 */ - -static UA_StatusCode function_ua_namespace0_103(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2288_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2288_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2288_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "RejectedRequestsCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2288), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "RejectedRequestsCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2288), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* RejectedSessionCount - ns=0;i=3705 */ - -static UA_StatusCode function_ua_namespace0_104(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_3705_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_3705_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_3705_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "RejectedSessionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 3705), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "RejectedSessionCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 3705), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* SecurityRejectedRequestsCount - ns=0;i=2287 */ - -static UA_StatusCode function_ua_namespace0_105(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2287_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2287_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2287_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "SecurityRejectedRequestsCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode( - server, UA_NODEID_NUMERIC(ns[0], 2287), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "SecurityRejectedRequestsCount"), UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2287), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* CurrentSubscriptionCount - ns=0;i=2285 */ - -static UA_StatusCode function_ua_namespace0_106(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2285_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2285_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2285_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "CurrentSubscriptionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2285), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "CurrentSubscriptionCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2285), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* PublishingIntervalCount - ns=0;i=2284 */ - -static UA_StatusCode function_ua_namespace0_107(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2284_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2284_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2284_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "PublishingIntervalCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2284), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "PublishingIntervalCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2284), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* CumulatedSubscriptionCount - ns=0;i=2286 */ - -static UA_StatusCode function_ua_namespace0_108(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2286_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2286_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2286_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "CumulatedSubscriptionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode( - server, UA_NODEID_NUMERIC(ns[0], 2286), UA_NODEID_NUMERIC(ns[0], 0), UA_NODEID_NUMERIC(ns[0], 0), - UA_QUALIFIEDNAME(ns[0], "CumulatedSubscriptionCount"), UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2286), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* SessionTimeoutCount - ns=0;i=2281 */ - -static UA_StatusCode function_ua_namespace0_109(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2281_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2281_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2281_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "SessionTimeoutCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2281), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "SessionTimeoutCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2281), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* CumulatedSessionCount - ns=0;i=2278 */ - -static UA_StatusCode function_ua_namespace0_110(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2278_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2278_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2278_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "CumulatedSessionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2278), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "CumulatedSessionCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2278), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* CurrentSessionCount - ns=0;i=2277 */ - -static UA_StatusCode function_ua_namespace0_111(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2277_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2277_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2277_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "CurrentSessionCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2277), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "CurrentSessionCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2277), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* ServerViewCount - ns=0;i=2276 */ - -static UA_StatusCode function_ua_namespace0_112(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2276_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2276_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2276_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "ServerViewCount"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2276), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerViewCount"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2276), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2275), false); - return retVal; -} - -/* ServerStatusDataType - ns=0;i=862 */ - -static UA_StatusCode function_ua_namespace0_113(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_DataTypeAttributes attr = UA_DataTypeAttributes_default; - attr.displayName = UA_LOCALIZEDTEXT("", "ServerStatusDataType"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addDataTypeNode(server, UA_NODEID_NUMERIC(ns[0], 862), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerStatusDataType"), - attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 862), UA_NODEID_NUMERIC(ns[0], 45), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 22), false); - return retVal; -} - -/* ServerStatus - ns=0;i=2256 */ - -static UA_StatusCode function_ua_namespace0_114(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 862); - void *variablenode_ns_0_i_2256_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE].memSize); - UA_init(variablenode_ns_0_i_2256_variant_DataContents, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2256_variant_DataContents, - &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]); - attr.displayName = UA_LOCALIZEDTEXT("", "ServerStatus"); - attr.description = UA_LOCALIZEDTEXT("", "The current status of the server."); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2256), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ServerStatus"), - UA_NODEID_NUMERIC(ns[0], 2138), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2256), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2253), false); - return retVal; -} - -/* SecondsTillShutdown - ns=0;i=2992 */ - -static UA_StatusCode function_ua_namespace0_115(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 7); - void *variablenode_ns_0_i_2992_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_UINT32].memSize); - UA_init(variablenode_ns_0_i_2992_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2992_variant_DataContents, &UA_TYPES[UA_TYPES_UINT32]); - attr.displayName = UA_LOCALIZEDTEXT("", "SecondsTillShutdown"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2992), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "SecondsTillShutdown"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2992), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2256), false); - return retVal; -} - -/* ShutdownReason - ns=0;i=2993 */ - -static UA_StatusCode function_ua_namespace0_116(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 21); - void *variablenode_ns_0_i_2993_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_LOCALIZEDTEXT].memSize); - UA_init(variablenode_ns_0_i_2993_variant_DataContents, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2993_variant_DataContents, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); - attr.displayName = UA_LOCALIZEDTEXT("", "ShutdownReason"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2993), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ShutdownReason"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2993), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2256), false); - return retVal; -} - -/* CurrentTime - ns=0;i=2258 */ - -static UA_StatusCode function_ua_namespace0_117(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 13); - void *variablenode_ns_0_i_2258_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_DATETIME].memSize); - UA_init(variablenode_ns_0_i_2258_variant_DataContents, &UA_TYPES[UA_TYPES_DATETIME]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2258_variant_DataContents, &UA_TYPES[UA_TYPES_DATETIME]); - attr.displayName = UA_LOCALIZEDTEXT("", "CurrentTime"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2258), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "CurrentTime"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2258), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2256), false); - return retVal; -} - -/* StartTime - ns=0;i=2257 */ - -static UA_StatusCode function_ua_namespace0_118(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 13); - void *variablenode_ns_0_i_2257_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_DATETIME].memSize); - UA_init(variablenode_ns_0_i_2257_variant_DataContents, &UA_TYPES[UA_TYPES_DATETIME]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2257_variant_DataContents, &UA_TYPES[UA_TYPES_DATETIME]); - attr.displayName = UA_LOCALIZEDTEXT("", "StartTime"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2257), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "StartTime"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2257), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2256), false); - return retVal; -} - -/* BuildInfo - ns=0;i=2260 */ - -static UA_StatusCode function_ua_namespace0_119(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 338); - void *variablenode_ns_0_i_2260_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_BUILDINFO].memSize); - UA_init(variablenode_ns_0_i_2260_variant_DataContents, &UA_TYPES[UA_TYPES_BUILDINFO]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2260_variant_DataContents, &UA_TYPES[UA_TYPES_BUILDINFO]); - attr.displayName = UA_LOCALIZEDTEXT("", "BuildInfo"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2260), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "BuildInfo"), - UA_NODEID_NUMERIC(ns[0], 3051), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2260), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2256), false); - return retVal; -} - -/* BuildDate - ns=0;i=2266 */ - -static UA_StatusCode function_ua_namespace0_120(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 13); - void *variablenode_ns_0_i_2266_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_DATETIME].memSize); - UA_init(variablenode_ns_0_i_2266_variant_DataContents, &UA_TYPES[UA_TYPES_DATETIME]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2266_variant_DataContents, &UA_TYPES[UA_TYPES_DATETIME]); - attr.displayName = UA_LOCALIZEDTEXT("", "BuildDate"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2266), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "BuildDate"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2266), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2260), false); - return retVal; -} - -/* ProductName - ns=0;i=2261 */ - -static UA_StatusCode function_ua_namespace0_121(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - void *variablenode_ns_0_i_2261_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize); - UA_init(variablenode_ns_0_i_2261_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2261_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "ProductName"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2261), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ProductName"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2261), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2260), false); - return retVal; -} - -/* SoftwareVersion - ns=0;i=2264 */ - -static UA_StatusCode function_ua_namespace0_122(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - void *variablenode_ns_0_i_2264_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize); - UA_init(variablenode_ns_0_i_2264_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2264_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "SoftwareVersion"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2264), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "SoftwareVersion"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2264), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2260), false); - return retVal; -} - -/* BuildNumber - ns=0;i=2265 */ - -static UA_StatusCode function_ua_namespace0_123(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - void *variablenode_ns_0_i_2265_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize); - UA_init(variablenode_ns_0_i_2265_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2265_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "BuildNumber"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2265), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "BuildNumber"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2265), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2260), false); - return retVal; -} - -/* ProductUri - ns=0;i=2262 */ - -static UA_StatusCode function_ua_namespace0_124(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - void *variablenode_ns_0_i_2262_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize); - UA_init(variablenode_ns_0_i_2262_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2262_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "ProductUri"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2262), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ProductUri"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2262), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2260), false); - return retVal; -} - -/* ManufacturerName - ns=0;i=2263 */ - -static UA_StatusCode function_ua_namespace0_125(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 1000.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 12); - void *variablenode_ns_0_i_2263_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_STRING].memSize); - UA_init(variablenode_ns_0_i_2263_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2263_variant_DataContents, &UA_TYPES[UA_TYPES_STRING]); - attr.displayName = UA_LOCALIZEDTEXT("", "ManufacturerName"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2263), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "ManufacturerName"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2263), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2260), false); - return retVal; -} - -/* State - ns=0;i=2259 */ - -static UA_StatusCode function_ua_namespace0_126(UA_Server *server, UA_UInt16 *ns) { - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - UA_VariableAttributes attr = UA_VariableAttributes_default; - attr.minimumSamplingInterval = 0.000000; - attr.userAccessLevel = 1; - attr.accessLevel = 1; - attr.valueRank = -2; - attr.dataType = UA_NODEID_NUMERIC(ns[0], 852); - void *variablenode_ns_0_i_2259_variant_DataContents = UA_alloca(UA_TYPES[UA_TYPES_SERVERSTATE].memSize); - UA_init(variablenode_ns_0_i_2259_variant_DataContents, &UA_TYPES[UA_TYPES_SERVERSTATE]); - UA_Variant_setScalar(&attr.value, variablenode_ns_0_i_2259_variant_DataContents, &UA_TYPES[UA_TYPES_SERVERSTATE]); - attr.displayName = UA_LOCALIZEDTEXT("", "State"); - attr.description = UA_LOCALIZEDTEXT("", ""); - attr.writeMask = 0; - attr.userWriteMask = 0; - retVal |= UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(ns[0], 2259), UA_NODEID_NUMERIC(ns[0], 0), - UA_NODEID_NUMERIC(ns[0], 0), UA_QUALIFIEDNAME(ns[0], "State"), - UA_NODEID_NUMERIC(ns[0], 63), attr, NULL, NULL); - retVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 2259), UA_NODEID_NUMERIC(ns[0], 47), - UA_EXPANDEDNODEID_NUMERIC(ns[0], 2256), false); - return retVal; -} - -UA_StatusCode ua_namespace0(UA_Server *server) { // NOLINT - - UA_StatusCode retVal = UA_STATUSCODE_GOOD; - /* Use namespace ids generated by the server */ - UA_UInt16 ns[1]; - ns[0] = UA_Server_addNamespace(server, "http://opcfoundation.org/UA/"); - retVal |= function_ua_namespace0_0(server, ns); - retVal |= function_ua_namespace0_1(server, ns); - retVal |= function_ua_namespace0_2(server, ns); - retVal |= function_ua_namespace0_3(server, ns); - retVal |= function_ua_namespace0_4(server, ns); - retVal |= function_ua_namespace0_5(server, ns); - retVal |= function_ua_namespace0_6(server, ns); - retVal |= function_ua_namespace0_7(server, ns); - retVal |= function_ua_namespace0_8(server, ns); - retVal |= function_ua_namespace0_9(server, ns); - retVal |= function_ua_namespace0_10(server, ns); - retVal |= function_ua_namespace0_11(server, ns); - retVal |= function_ua_namespace0_12(server, ns); - retVal |= function_ua_namespace0_13(server, ns); - retVal |= function_ua_namespace0_14(server, ns); - retVal |= function_ua_namespace0_15(server, ns); - retVal |= function_ua_namespace0_16(server, ns); - retVal |= function_ua_namespace0_17(server, ns); - retVal |= function_ua_namespace0_18(server, ns); - retVal |= function_ua_namespace0_19(server, ns); - retVal |= function_ua_namespace0_20(server, ns); - retVal |= function_ua_namespace0_21(server, ns); - retVal |= function_ua_namespace0_22(server, ns); - retVal |= function_ua_namespace0_23(server, ns); - retVal |= function_ua_namespace0_24(server, ns); - retVal |= function_ua_namespace0_25(server, ns); - retVal |= function_ua_namespace0_26(server, ns); - retVal |= function_ua_namespace0_27(server, ns); - retVal |= function_ua_namespace0_28(server, ns); - retVal |= function_ua_namespace0_29(server, ns); - retVal |= function_ua_namespace0_30(server, ns); - retVal |= function_ua_namespace0_31(server, ns); - retVal |= function_ua_namespace0_32(server, ns); - retVal |= function_ua_namespace0_33(server, ns); - retVal |= function_ua_namespace0_34(server, ns); - retVal |= function_ua_namespace0_35(server, ns); - retVal |= function_ua_namespace0_36(server, ns); - retVal |= function_ua_namespace0_37(server, ns); - retVal |= function_ua_namespace0_38(server, ns); - retVal |= function_ua_namespace0_39(server, ns); - retVal |= function_ua_namespace0_40(server, ns); - retVal |= function_ua_namespace0_41(server, ns); - retVal |= function_ua_namespace0_42(server, ns); - retVal |= function_ua_namespace0_43(server, ns); - retVal |= function_ua_namespace0_44(server, ns); - retVal |= function_ua_namespace0_45(server, ns); - retVal |= function_ua_namespace0_46(server, ns); - retVal |= function_ua_namespace0_47(server, ns); - retVal |= function_ua_namespace0_48(server, ns); - retVal |= function_ua_namespace0_49(server, ns); - retVal |= function_ua_namespace0_50(server, ns); - retVal |= function_ua_namespace0_51(server, ns); - retVal |= function_ua_namespace0_52(server, ns); - retVal |= function_ua_namespace0_53(server, ns); - retVal |= function_ua_namespace0_54(server, ns); - retVal |= function_ua_namespace0_55(server, ns); - retVal |= function_ua_namespace0_56(server, ns); - retVal |= function_ua_namespace0_57(server, ns); - retVal |= function_ua_namespace0_58(server, ns); - retVal |= function_ua_namespace0_59(server, ns); - retVal |= function_ua_namespace0_60(server, ns); - retVal |= function_ua_namespace0_61(server, ns); - retVal |= function_ua_namespace0_62(server, ns); - retVal |= function_ua_namespace0_63(server, ns); - retVal |= function_ua_namespace0_64(server, ns); - retVal |= function_ua_namespace0_65(server, ns); - retVal |= function_ua_namespace0_66(server, ns); - retVal |= function_ua_namespace0_67(server, ns); - retVal |= function_ua_namespace0_68(server, ns); - retVal |= function_ua_namespace0_69(server, ns); - retVal |= function_ua_namespace0_70(server, ns); - retVal |= function_ua_namespace0_71(server, ns); - retVal |= function_ua_namespace0_72(server, ns); - retVal |= function_ua_namespace0_73(server, ns); - retVal |= function_ua_namespace0_74(server, ns); - retVal |= function_ua_namespace0_75(server, ns); - retVal |= function_ua_namespace0_76(server, ns); - retVal |= function_ua_namespace0_77(server, ns); - retVal |= function_ua_namespace0_78(server, ns); - retVal |= function_ua_namespace0_79(server, ns); - retVal |= function_ua_namespace0_80(server, ns); - retVal |= function_ua_namespace0_81(server, ns); - retVal |= function_ua_namespace0_82(server, ns); - retVal |= function_ua_namespace0_83(server, ns); - retVal |= function_ua_namespace0_84(server, ns); - retVal |= function_ua_namespace0_85(server, ns); - retVal |= function_ua_namespace0_86(server, ns); - retVal |= function_ua_namespace0_87(server, ns); - retVal |= function_ua_namespace0_88(server, ns); - retVal |= function_ua_namespace0_89(server, ns); - retVal |= function_ua_namespace0_90(server, ns); - retVal |= function_ua_namespace0_91(server, ns); - retVal |= function_ua_namespace0_92(server, ns); - retVal |= function_ua_namespace0_93(server, ns); - retVal |= function_ua_namespace0_94(server, ns); - retVal |= function_ua_namespace0_95(server, ns); - retVal |= function_ua_namespace0_96(server, ns); - retVal |= function_ua_namespace0_97(server, ns); - retVal |= function_ua_namespace0_98(server, ns); - retVal |= function_ua_namespace0_99(server, ns); - retVal |= function_ua_namespace0_100(server, ns); - retVal |= function_ua_namespace0_101(server, ns); - retVal |= function_ua_namespace0_102(server, ns); - retVal |= function_ua_namespace0_103(server, ns); - retVal |= function_ua_namespace0_104(server, ns); - retVal |= function_ua_namespace0_105(server, ns); - retVal |= function_ua_namespace0_106(server, ns); - retVal |= function_ua_namespace0_107(server, ns); - retVal |= function_ua_namespace0_108(server, ns); - retVal |= function_ua_namespace0_109(server, ns); - retVal |= function_ua_namespace0_110(server, ns); - retVal |= function_ua_namespace0_111(server, ns); - retVal |= function_ua_namespace0_112(server, ns); - retVal |= function_ua_namespace0_113(server, ns); - retVal |= function_ua_namespace0_114(server, ns); - retVal |= function_ua_namespace0_115(server, ns); - retVal |= function_ua_namespace0_116(server, ns); - retVal |= function_ua_namespace0_117(server, ns); - retVal |= function_ua_namespace0_118(server, ns); - retVal |= function_ua_namespace0_119(server, ns); - retVal |= function_ua_namespace0_120(server, ns); - retVal |= function_ua_namespace0_121(server, ns); - retVal |= function_ua_namespace0_122(server, ns); - retVal |= function_ua_namespace0_123(server, ns); - retVal |= function_ua_namespace0_124(server, ns); - retVal |= function_ua_namespace0_125(server, ns); - retVal |= function_ua_namespace0_126(server, ns); - return retVal; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_server_binary.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -// store the authentication token and session ID so we can help fuzzing by setting -// these values in the next request automatically -UA_NodeId unsafe_fuzz_authenticationToken = {0, UA_NODEIDTYPE_NUMERIC, {0}}; -#endif - -#ifdef UA_DEBUG_DUMP_PKGS_FILE -void UA_debug_dumpCompleteChunk(UA_Server *const server, UA_Connection *const connection, UA_ByteString *messageBuffer); -#endif - -/********************/ -/* Helper Functions */ -/********************/ - -/* This is not an ERR message, the connection is not closed afterwards */ -static UA_StatusCode sendServiceFault(UA_SecureChannel *channel, const UA_ByteString *msg, size_t offset, - const UA_DataType *responseType, UA_UInt32 requestId, UA_StatusCode error) { - UA_RequestHeader requestHeader; - UA_StatusCode retval = UA_RequestHeader_decodeBinary(msg, &offset, &requestHeader); - if (retval != UA_STATUSCODE_GOOD) return retval; - void *response = UA_alloca(responseType->memSize); - UA_init(response, responseType); - UA_ResponseHeader *responseHeader = (UA_ResponseHeader *)response; - responseHeader->requestHandle = requestHeader.requestHandle; - responseHeader->timestamp = UA_DateTime_now(); - responseHeader->serviceResult = error; - - // Send error message. Message type is MSG and not ERR, since we are on a securechannel! - retval = UA_SecureChannel_sendSymmetricMessage(channel, requestId, UA_MESSAGETYPE_MSG, response, responseType); - - UA_RequestHeader_deleteMembers(&requestHeader); - UA_LOG_DEBUG(channel->securityPolicy->logger, UA_LOGCATEGORY_SERVER, "Sent ServiceFault with error code %s", - UA_StatusCode_name(error)); - return retval; -} - -typedef enum { UA_SERVICETYPE_NORMAL, UA_SERVICETYPE_INSITU, UA_SERVICETYPE_CUSTOM } UA_ServiceType; - -static void getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType, - const UA_DataType **responseType, UA_Service *service, UA_Boolean *requiresSession, - UA_ServiceType *serviceType) { - switch (requestTypeId) { - case UA_NS0ID_GETENDPOINTSREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_GetEndpoints; - *requestType = &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]; - *requiresSession = false; - break; - case UA_NS0ID_FINDSERVERSREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_FindServers; - *requestType = &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE]; - *requiresSession = false; - break; -#ifdef UA_ENABLE_DISCOVERY -#ifdef UA_ENABLE_DISCOVERY_MULTICAST - case UA_NS0ID_FINDSERVERSONNETWORKREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_FindServersOnNetwork; - *requestType = &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKRESPONSE]; - *requiresSession = false; - break; -#endif - case UA_NS0ID_REGISTERSERVERREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_RegisterServer; - *requestType = &UA_TYPES[UA_TYPES_REGISTERSERVERREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_REGISTERSERVERRESPONSE]; - *requiresSession = false; - break; - case UA_NS0ID_REGISTERSERVER2REQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_RegisterServer2; - *requestType = &UA_TYPES[UA_TYPES_REGISTERSERVER2REQUEST]; - *responseType = &UA_TYPES[UA_TYPES_REGISTERSERVER2RESPONSE]; - *requiresSession = false; - break; -#endif - case UA_NS0ID_CREATESESSIONREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_CreateSession; - *requestType = &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE]; - *requiresSession = false; - *serviceType = UA_SERVICETYPE_CUSTOM; - break; - case UA_NS0ID_ACTIVATESESSIONREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_ActivateSession; - *requestType = &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE]; - *serviceType = UA_SERVICETYPE_CUSTOM; - break; - case UA_NS0ID_CLOSESESSIONREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_CloseSession; - *requestType = &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]; - break; - case UA_NS0ID_READREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_Read; - *requestType = &UA_TYPES[UA_TYPES_READREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_READRESPONSE]; - *serviceType = UA_SERVICETYPE_INSITU; - break; - case UA_NS0ID_WRITEREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_Write; - *requestType = &UA_TYPES[UA_TYPES_WRITEREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_WRITERESPONSE]; - break; - case UA_NS0ID_BROWSEREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_Browse; - *requestType = &UA_TYPES[UA_TYPES_BROWSEREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_BROWSERESPONSE]; - break; - case UA_NS0ID_BROWSENEXTREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_BrowseNext; - *requestType = &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]; - break; - case UA_NS0ID_REGISTERNODESREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_RegisterNodes; - *requestType = &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]; - break; - case UA_NS0ID_UNREGISTERNODESREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_UnregisterNodes; - *requestType = &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]; - break; - case UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_TranslateBrowsePathsToNodeIds; - *requestType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE]; - break; - -#ifdef UA_ENABLE_SUBSCRIPTIONS - case UA_NS0ID_CREATESUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_CreateSubscription; - *requestType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]; - break; - case UA_NS0ID_PUBLISHREQUEST_ENCODING_DEFAULTBINARY: - *requestType = &UA_TYPES[UA_TYPES_PUBLISHREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]; - break; - case UA_NS0ID_REPUBLISHREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_Republish; - *requestType = &UA_TYPES[UA_TYPES_REPUBLISHREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE]; - break; - case UA_NS0ID_MODIFYSUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_ModifySubscription; - *requestType = &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]; - break; - case UA_NS0ID_SETPUBLISHINGMODEREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_SetPublishingMode; - *requestType = &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE]; - break; - case UA_NS0ID_DELETESUBSCRIPTIONSREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_DeleteSubscriptions; - *requestType = &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE]; - break; - case UA_NS0ID_CREATEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_CreateMonitoredItems; - *requestType = &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE]; - break; - case UA_NS0ID_DELETEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_DeleteMonitoredItems; - *requestType = &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE]; - break; - case UA_NS0ID_MODIFYMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_ModifyMonitoredItems; - *requestType = &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE]; - break; - case UA_NS0ID_SETMONITORINGMODEREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_SetMonitoringMode; - *requestType = &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE]; - break; -#endif - -#ifdef UA_ENABLE_METHODCALLS - case UA_NS0ID_CALLREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_Call; - *requestType = &UA_TYPES[UA_TYPES_CALLREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_CALLRESPONSE]; - break; -#endif - -#ifdef UA_ENABLE_NODEMANAGEMENT - case UA_NS0ID_ADDNODESREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_AddNodes; - *requestType = &UA_TYPES[UA_TYPES_ADDNODESREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]; - break; - case UA_NS0ID_ADDREFERENCESREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_AddReferences; - *requestType = &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE]; - break; - case UA_NS0ID_DELETENODESREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_DeleteNodes; - *requestType = &UA_TYPES[UA_TYPES_DELETENODESREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]; - break; - case UA_NS0ID_DELETEREFERENCESREQUEST_ENCODING_DEFAULTBINARY: - *service = (UA_Service)Service_DeleteReferences; - *requestType = &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST]; - *responseType = &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE]; - break; -#endif - - default: - break; - } -} - -/*************************/ -/* Process Message Types */ -/*************************/ - -/* HEL -> Open up the connection */ -static UA_StatusCode processHEL(UA_Server *server, UA_Connection *connection, const UA_ByteString *msg, - size_t *offset) { - UA_TcpHelloMessage helloMessage; - UA_StatusCode retval = UA_TcpHelloMessage_decodeBinary(msg, offset, &helloMessage); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Parameterize the connection */ - connection->remoteConf.maxChunkCount = helloMessage.maxChunkCount; /* zero -> unlimited */ - connection->remoteConf.maxMessageSize = helloMessage.maxMessageSize; /* zero -> unlimited */ - connection->remoteConf.protocolVersion = helloMessage.protocolVersion; - connection->remoteConf.recvBufferSize = helloMessage.receiveBufferSize; - if (connection->localConf.sendBufferSize > helloMessage.receiveBufferSize) - connection->localConf.sendBufferSize = helloMessage.receiveBufferSize; - connection->remoteConf.sendBufferSize = helloMessage.sendBufferSize; - if (connection->localConf.recvBufferSize > helloMessage.sendBufferSize) - connection->localConf.recvBufferSize = helloMessage.sendBufferSize; - UA_String_deleteMembers(&helloMessage.endpointUrl); - - if (connection->remoteConf.recvBufferSize == 0) { - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_NETWORK, - "Connection %i | Remote end indicated a receive buffer size of 0. " - "Not able to send any messages.", - connection->sockfd); - return UA_STATUSCODE_BADINTERNALERROR; - } - - connection->state = UA_CONNECTION_ESTABLISHED; - - /* Build acknowledge response */ - UA_TcpAcknowledgeMessage ackMessage; - ackMessage.protocolVersion = connection->localConf.protocolVersion; - ackMessage.receiveBufferSize = connection->localConf.recvBufferSize; - ackMessage.sendBufferSize = connection->localConf.sendBufferSize; - ackMessage.maxMessageSize = connection->localConf.maxMessageSize; - ackMessage.maxChunkCount = connection->localConf.maxChunkCount; - UA_TcpMessageHeader ackHeader; - ackHeader.messageTypeAndChunkType = UA_MESSAGETYPE_ACK + UA_CHUNKTYPE_FINAL; - ackHeader.messageSize = 8 + 20; /* ackHeader + ackMessage */ - - /* Get the send buffer from the network layer */ - UA_ByteString ack_msg; - UA_ByteString_init(&ack_msg); - retval = connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &ack_msg); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Encode and send the response */ - UA_Byte *bufPos = ack_msg.data; - const UA_Byte *bufEnd = &ack_msg.data[ack_msg.length]; - - retval = UA_TcpMessageHeader_encodeBinary(&ackHeader, &bufPos, &bufEnd); - if (retval != UA_STATUSCODE_GOOD) { - connection->releaseSendBuffer(connection, &ack_msg); - return retval; - } - - retval = UA_TcpAcknowledgeMessage_encodeBinary(&ackMessage, &bufPos, &bufEnd); - if (retval != UA_STATUSCODE_GOOD) { - connection->releaseSendBuffer(connection, &ack_msg); - return retval; - } - ack_msg.length = ackHeader.messageSize; - return connection->send(connection, &ack_msg); -} - -/* OPN -> Open up/renew the securechannel */ -static UA_StatusCode processOPN(UA_Server *server, UA_SecureChannel *channel, const UA_UInt32 requestId, - const UA_ByteString *msg) { - /* Decode the request */ - size_t offset = 0; - UA_NodeId requestType; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - UA_OpenSecureChannelRequest openSecureChannelRequest; - retval |= UA_NodeId_decodeBinary(msg, &offset, &requestType); - retval |= UA_OpenSecureChannelRequest_decodeBinary(msg, &offset, &openSecureChannelRequest); - - /* Error occurred */ - if (retval != UA_STATUSCODE_GOOD || - requestType.identifier.numeric != UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST].binaryEncodingId) { - UA_NodeId_deleteMembers(&requestType); - UA_OpenSecureChannelRequest_deleteMembers(&openSecureChannelRequest); - UA_LOG_INFO_CHANNEL(server->config.logger, channel, "Could not decode the OPN message. Closing the connection."); - UA_SecureChannelManager_close(&server->secureChannelManager, channel->securityToken.channelId); - return retval; - } - UA_NodeId_deleteMembers(&requestType); - - /* Call the service */ - UA_OpenSecureChannelResponse openScResponse; - UA_OpenSecureChannelResponse_init(&openScResponse); - Service_OpenSecureChannel(server, channel, &openSecureChannelRequest, &openScResponse); - UA_OpenSecureChannelRequest_deleteMembers(&openSecureChannelRequest); - if (openScResponse.responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_CHANNEL(server->config.logger, channel, - "Could not open a SecureChannel. " - "Closing the connection."); - UA_SecureChannelManager_close(&server->secureChannelManager, channel->securityToken.channelId); - return openScResponse.responseHeader.serviceResult; - } - - /* Send the response */ - retval = UA_SecureChannel_sendAsymmetricOPNMessage(channel, requestId, &openScResponse, - &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]); - UA_OpenSecureChannelResponse_deleteMembers(&openScResponse); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_CHANNEL(server->config.logger, channel, "Could not send the OPN answer with error code %s", - UA_StatusCode_name(retval)); - UA_SecureChannelManager_close(&server->secureChannelManager, channel->securityToken.channelId); - } - return retval; -} - -static UA_StatusCode processMSG(UA_Server *server, UA_SecureChannel *channel, UA_UInt32 requestId, - const UA_ByteString *msg) { - /* At 0, the nodeid starts... */ - size_t offset = 0; - - /* Decode the nodeid */ - UA_NodeId requestTypeId; - UA_StatusCode retval = UA_NodeId_decodeBinary(msg, &offset, &requestTypeId); - if (retval != UA_STATUSCODE_GOOD) return retval; - if (requestTypeId.identifierType != UA_NODEIDTYPE_NUMERIC) - UA_NodeId_deleteMembers(&requestTypeId); /* leads to badserviceunsupported */ - - /* Store the start-position of the request */ - size_t requestPos = offset; - - /* Get the service pointers */ - UA_Service service = NULL; - const UA_DataType *requestType = NULL; - const UA_DataType *responseType = NULL; - UA_Boolean sessionRequired = true; - UA_ServiceType serviceType = UA_SERVICETYPE_NORMAL; - getServicePointers(requestTypeId.identifier.numeric, &requestType, &responseType, &service, &sessionRequired, - &serviceType); - if (!requestType) { - if (requestTypeId.identifier.numeric == 787) { - UA_LOG_INFO_CHANNEL(server->config.logger, channel, - "Client requested a subscription, " - "but those are not enabled in the build"); - } else { - UA_LOG_INFO_CHANNEL(server->config.logger, channel, "Unknown request with type identifier %i", - requestTypeId.identifier.numeric); - } - return sendServiceFault(channel, msg, requestPos, &UA_TYPES[UA_TYPES_SERVICEFAULT], requestId, - UA_STATUSCODE_BADSERVICEUNSUPPORTED); - } - UA_assert(responseType); - - /* Decode the request */ - void *request = UA_alloca(requestType->memSize); - UA_RequestHeader *requestHeader = (UA_RequestHeader *)request; - retval = UA_decodeBinary(msg, &offset, request, requestType, server->config.customDataTypesSize, - server->config.customDataTypes); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Could not decode the request"); - return sendServiceFault(channel, msg, requestPos, responseType, requestId, retval); - } - - /* Prepare the respone */ - void *response = UA_alloca(responseType->memSize); - UA_init(response, responseType); - UA_Session *session = NULL; /* must be initialized before goto send_response */ - - /* CreateSession doesn't need a session */ - if (requestType == &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]) { - Service_CreateSession(server, channel, (const UA_CreateSessionRequest *)request, - (UA_CreateSessionResponse *)response); -#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION - // store the authentication token and session ID so we can help fuzzing by setting - // these values in the next request automatically - UA_CreateSessionResponse *res = (UA_CreateSessionResponse *)response; - UA_NodeId_copy(&res->authenticationToken, &unsafe_fuzz_authenticationToken); -#endif - goto send_response; - } - -#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION - // set the authenticationToken from the create session request to help fuzzing cover more lines - if (!UA_NodeId_isNull(&unsafe_fuzz_authenticationToken)) - UA_NodeId_copy(&unsafe_fuzz_authenticationToken, &requestHeader->authenticationToken); -#endif - - /* Find the matching session */ - session = UA_SecureChannel_getSession(channel, &requestHeader->authenticationToken); - if (!session && !UA_NodeId_isNull(&requestHeader->authenticationToken)) - session = UA_SessionManager_getSessionByToken(&server->sessionManager, &requestHeader->authenticationToken); - - if (requestType == &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]) { - if (!session) { - UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, - "Trying to activate a session that is " - "not known in the server"); - UA_deleteMembers(request, requestType); - return sendServiceFault(channel, msg, requestPos, responseType, requestId, UA_STATUSCODE_BADSESSIONIDINVALID); - } - Service_ActivateSession(server, channel, session, (const UA_ActivateSessionRequest *)request, - (UA_ActivateSessionResponse *)response); - goto send_response; - } - - /* Set an anonymous, inactive session for services that need no session */ - UA_Session anonymousSession; - if (!session) { - if (sessionRequired) { - UA_LOG_WARNING_CHANNEL(server->config.logger, channel, "Service request %i without a valid session", - requestType->binaryEncodingId); - UA_deleteMembers(request, requestType); - return sendServiceFault(channel, msg, requestPos, responseType, requestId, UA_STATUSCODE_BADSESSIONIDINVALID); - } - - UA_Session_init(&anonymousSession); - anonymousSession.sessionId = UA_NODEID_GUID(0, UA_GUID_NULL); - anonymousSession.channel = channel; - session = &anonymousSession; - } - - /* Trying to use a non-activated session? */ - if (sessionRequired && !session->activated) { - UA_LOG_WARNING_SESSION(server->config.logger, session, "Calling service %i on a non-activated session", - requestType->binaryEncodingId); - UA_SessionManager_removeSession(&server->sessionManager, &session->authenticationToken); - UA_deleteMembers(request, requestType); - return sendServiceFault(channel, msg, requestPos, responseType, requestId, UA_STATUSCODE_BADSESSIONNOTACTIVATED); - } - - /* The session is bound to another channel */ - if (session != &anonymousSession && session->channel != channel) { - UA_LOG_WARNING_CHANNEL(server->config.logger, channel, - "Client tries to use a Session that is not " - "bound to this SecureChannel"); - UA_deleteMembers(request, requestType); - return sendServiceFault(channel, msg, requestPos, responseType, requestId, UA_STATUSCODE_BADSESSIONNOTACTIVATED); - } - - /* Update the session lifetime */ - UA_Session_updateLifetime(session); - -#ifdef UA_ENABLE_SUBSCRIPTIONS - /* The publish request is not answered immediately */ - if (requestType == &UA_TYPES[UA_TYPES_PUBLISHREQUEST]) { - Service_Publish(server, session, (const UA_PublishRequest *)request, requestId); - UA_deleteMembers(request, requestType); - return UA_STATUSCODE_GOOD; - } -#endif - -send_response: - - /* Prepare the ResponseHeader */ - ((UA_ResponseHeader *)response)->requestHandle = requestHeader->requestHandle; - ((UA_ResponseHeader *)response)->timestamp = UA_DateTime_now(); - - /* Start the message */ - UA_NodeId typeId = UA_NODEID_NUMERIC(0, responseType->binaryEncodingId); - UA_MessageContext mc; - retval = UA_MessageContext_begin(&mc, channel, requestId, UA_MESSAGETYPE_MSG); - if (retval != UA_STATUSCODE_GOOD) goto cleanup; - - /* Assert's required for clang-analyzer */ - UA_assert(mc.buf_pos == &mc.messageBuffer.data[UA_SECURE_MESSAGE_HEADER_LENGTH]); - UA_assert(mc.buf_end == &mc.messageBuffer.data[mc.messageBuffer.length]); - - retval = UA_MessageContext_encode(&mc, &typeId, &UA_TYPES[UA_TYPES_NODEID]); - if (retval != UA_STATUSCODE_GOOD) goto cleanup; - - switch (serviceType) { - case UA_SERVICETYPE_CUSTOM: - /* Was processed before...*/ - retval = UA_MessageContext_encode(&mc, response, responseType); - break; - case UA_SERVICETYPE_INSITU: - retval = ((UA_InSituService)service)(server, session, &mc, request, (UA_ResponseHeader *)response); - break; - case UA_SERVICETYPE_NORMAL: - default: - service(server, session, request, response); - retval = UA_MessageContext_encode(&mc, response, responseType); - break; - } - - /* Finish sending the message */ - if (retval != UA_STATUSCODE_GOOD) { - UA_MessageContext_abort(&mc); - goto cleanup; - } - - retval = UA_MessageContext_finish(&mc); - -cleanup: - if (retval != UA_STATUSCODE_GOOD) - UA_LOG_INFO_CHANNEL(server->config.logger, channel, - "Could not send the message over the SecureChannel " - "with StatusCode %s", - UA_StatusCode_name(retval)); - /* Clean up */ - UA_deleteMembers(request, requestType); - UA_deleteMembers(response, responseType); - return retval; -} - -/* Takes decoded messages starting at the nodeid of the content type. */ -static UA_StatusCode processSecureChannelMessage(void *application, UA_SecureChannel *channel, - UA_MessageType messagetype, UA_UInt32 requestId, - const UA_ByteString *message) { - UA_Server *server = (UA_Server *)application; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - switch (messagetype) { - case UA_MESSAGETYPE_OPN: - UA_LOG_TRACE_CHANNEL(server->config.logger, channel, "Process an OPN on an open channel"); - retval = processOPN(server, channel, requestId, message); - break; - case UA_MESSAGETYPE_MSG: - UA_LOG_TRACE_CHANNEL(server->config.logger, channel, "Process a MSG"); - retval = processMSG(server, channel, requestId, message); - break; - case UA_MESSAGETYPE_CLO: - UA_LOG_TRACE_CHANNEL(server->config.logger, channel, "Process a CLO"); - Service_CloseSecureChannel(server, channel); - break; - default: - UA_LOG_TRACE_CHANNEL(server->config.logger, channel, "Invalid message type"); - retval = UA_STATUSCODE_BADTCPMESSAGETYPEINVALID; - break; - } - return retval; -} - -static UA_StatusCode createSecureChannel(void *application, UA_Connection *connection, - UA_AsymmetricAlgorithmSecurityHeader *asymHeader) { - UA_Server *server = (UA_Server *)application; - - /* Iterate over available endpoints and choose the correct one */ - UA_Endpoint *endpoint = NULL; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - for (size_t i = 0; i < server->config.endpointsSize; ++i) { - UA_Endpoint *endpointCandidate = &server->config.endpoints[i]; - if (!UA_ByteString_equal(&asymHeader->securityPolicyUri, &endpointCandidate->securityPolicy.policyUri)) continue; - retval = endpointCandidate->securityPolicy.asymmetricModule.compareCertificateThumbprint( - &endpointCandidate->securityPolicy, &asymHeader->receiverCertificateThumbprint); - if (retval != UA_STATUSCODE_GOOD) continue; - - /* We found the correct endpoint (except for security mode) The endpoint - * needs to be changed by the client / server to match the security - * mode. The server does this in the securechannel manager */ - endpoint = endpointCandidate; - break; - } - - if (!endpoint) return UA_STATUSCODE_BADSECURITYPOLICYREJECTED; - - /* Create a new channel */ - return UA_SecureChannelManager_create(&server->secureChannelManager, connection, &endpoint->securityPolicy, - asymHeader); -} - -static UA_StatusCode processCompleteChunkWithoutChannel(UA_Server *server, UA_Connection *connection, - UA_ByteString *message) { - /* Process chunk without a channel; must be OPN */ - UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK, - "Connection %i | No channel attached to the connection. " - "Process the chunk directly", - connection->sockfd); - size_t offset = 0; - UA_TcpMessageHeader tcpMessageHeader; - UA_StatusCode retval = UA_TcpMessageHeader_decodeBinary(message, &offset, &tcpMessageHeader); - if (retval != UA_STATUSCODE_GOOD) return retval; - - // Only HEL and OPN messages possible without a channel (on the server side) - switch (tcpMessageHeader.messageTypeAndChunkType & 0x00ffffff) { - case UA_MESSAGETYPE_HEL: - retval = processHEL(server, connection, message, &offset); - break; - case UA_MESSAGETYPE_OPN: { - UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK, "Connection %i | Process OPN message", - connection->sockfd); - - /* Called before HEL */ - if (connection->state != UA_CONNECTION_ESTABLISHED) { - retval = UA_STATUSCODE_BADCOMMUNICATIONERROR; - break; - } - - // Decode the asymmetric algorithm security header since it is not encrypted and - // needed to decide what security policy to use. - UA_AsymmetricAlgorithmSecurityHeader asymHeader; - UA_AsymmetricAlgorithmSecurityHeader_init(&asymHeader); - size_t messageHeaderOffset = UA_SECURE_CONVERSATION_MESSAGE_HEADER_LENGTH; - retval = UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(message, &messageHeaderOffset, &asymHeader); - if (retval != UA_STATUSCODE_GOOD) break; - - retval = createSecureChannel(server, connection, &asymHeader); - UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader); - if (retval != UA_STATUSCODE_GOOD) break; - - retval = UA_SecureChannel_processChunk(connection->channel, message, processSecureChannelMessage, server); - if (retval != UA_STATUSCODE_GOOD) break; - break; - } - default: - UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK, - "Connection %i | Expected OPN or HEL message on a connection " - "without a SecureChannel", - connection->sockfd); - retval = UA_STATUSCODE_BADTCPMESSAGETYPEINVALID; - break; - } - return retval; -} - -static UA_StatusCode processCompleteChunk(void *const application, UA_Connection *const connection, - UA_ByteString *const chunk) { - UA_Server *const server = (UA_Server *)application; -#ifdef UA_DEBUG_DUMP_PKGS_FILE - UA_debug_dumpCompleteChunk(server, connection, chunk); -#endif - if (!connection->channel) return processCompleteChunkWithoutChannel(server, connection, chunk); - return UA_SecureChannel_processChunk(connection->channel, chunk, processSecureChannelMessage, server); -} - -static void processBinaryMessage(UA_Server *server, UA_Connection *connection, UA_ByteString *message) { - UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK, "Connection %i | Received a packet.", connection->sockfd); -#ifdef UA_DEBUG_DUMP_PKGS - UA_dump_hex_pkg(message->data, message->length); -#endif - - UA_StatusCode retval = UA_Connection_processChunks(connection, server, processCompleteChunk, message); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_NETWORK, - "Connection %i | Processing the message failed with " - "error %s", - connection->sockfd, UA_StatusCode_name(retval)); - /* Send an ERR message and close the connection */ - UA_TcpErrorMessage error; - error.error = retval; - error.reason = UA_STRING_NULL; - UA_Connection_sendError(connection, &error); - connection->close(connection); - } -} - -#ifndef UA_ENABLE_MULTITHREADING - -void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection, UA_ByteString *message) { - processBinaryMessage(server, connection, message); -} - -#else - -typedef struct { - UA_Connection *connection; - UA_ByteString message; -} ConnectionMessage; - -static void workerProcessBinaryMessage(UA_Server *server, ConnectionMessage *cm) { - processBinaryMessage(server, cm->connection, &cm->message); - UA_free(cm); -} - -void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection, UA_ByteString *message) { - /* Allocate the memory for the callback data */ - ConnectionMessage *cm = (ConnectionMessage *)UA_malloc(sizeof(ConnectionMessage)); - - /* If malloc failed, execute immediately */ - if (!cm) { - processBinaryMessage(server, connection, message); - return; - } - - /* Dispatch to the workers */ - cm->connection = connection; - cm->message = *message; - UA_Server_workerCallback(server, (UA_ServerCallback)workerProcessBinaryMessage, cm); -} - -static void deleteConnectionTrampoline(UA_Server *server, void *data) { - UA_Connection *connection = (UA_Connection *)data; - connection->free(connection); -} -#endif - -void UA_Server_removeConnection(UA_Server *server, UA_Connection *connection) { - UA_Connection_detachSecureChannel(connection); -#ifndef UA_ENABLE_MULTITHREADING - connection->free(connection); -#else - UA_Server_delayedCallback(server, deleteConnectionTrampoline, connection); -#endif -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_server_utils.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/**********************/ -/* Parse NumericRange */ -/**********************/ - -static size_t readDimension(UA_Byte *buf, size_t buflen, UA_NumericRangeDimension *dim) { - size_t progress = UA_readNumber(buf, buflen, &dim->min); - if (progress == 0) return 0; - if (buflen <= progress + 1 || buf[progress] != ':') { - dim->max = dim->min; - return progress; - } - - ++progress; - size_t progress2 = UA_readNumber(&buf[progress], buflen - progress, &dim->max); - if (progress2 == 0) return 0; - - /* invalid range */ - if (dim->min >= dim->max) return 0; - - return progress + progress2; -} - -UA_StatusCode UA_NumericRange_parseFromString(UA_NumericRange *range, const UA_String *str) { - size_t idx = 0; - size_t dimensionsMax = 0; - UA_NumericRangeDimension *dimensions = NULL; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - size_t offset = 0; - while (true) { - /* alloc dimensions */ - if (idx >= dimensionsMax) { - UA_NumericRangeDimension *newds; - size_t newdssize = sizeof(UA_NumericRangeDimension) * (dimensionsMax + 2); - newds = (UA_NumericRangeDimension *)UA_realloc(dimensions, newdssize); - if (!newds) { - retval = UA_STATUSCODE_BADOUTOFMEMORY; - break; - } - dimensions = newds; - dimensionsMax = dimensionsMax + 2; - } - - /* read the dimension */ - size_t progress = readDimension(&str->data[offset], str->length - offset, &dimensions[idx]); - if (progress == 0) { - retval = UA_STATUSCODE_BADINDEXRANGEINVALID; - break; - } - offset += progress; - ++idx; - - /* loop into the next dimension */ - if (offset >= str->length) break; - - if (str->data[offset] != ',') { - retval = UA_STATUSCODE_BADINDEXRANGEINVALID; - break; - } - ++offset; - } - - if (retval == UA_STATUSCODE_GOOD && idx > 0) { - range->dimensions = dimensions; - range->dimensionsSize = idx; - } else - UA_free(dimensions); - - return retval; -} - -/********************************/ -/* Information Model Operations */ -/********************************/ - -UA_Boolean isNodeInTree(UA_Nodestore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind, - const UA_NodeId *referenceTypeIds, size_t referenceTypeIdsSize) { - if (UA_NodeId_equal(nodeToFind, leafNode)) return true; - - const UA_Node *node = ns->getNode(ns->context, leafNode); - if (!node) return false; - - for (size_t i = 0; i < node->referencesSize; ++i) { - UA_NodeReferenceKind *refs = &node->references[i]; - /* Search upwards in the tree */ - if (!refs->isInverse) continue; - - /* Consider only the indicated reference types */ - UA_Boolean match = false; - for (size_t j = 0; j < referenceTypeIdsSize; ++j) { - if (UA_NodeId_equal(&refs->referenceTypeId, &referenceTypeIds[j])) { - match = true; - break; - } - } - if (!match) continue; - - /* Match the targets or recurse */ - for (size_t j = 0; j < refs->targetIdsSize; ++j) { - if (isNodeInTree(ns, &refs->targetIds[j].nodeId, nodeToFind, referenceTypeIds, referenceTypeIdsSize)) { - ns->releaseNode(ns->context, node); - return true; - } - } - } - - ns->releaseNode(ns->context, node); - return false; -} - -const UA_Node *getNodeType(UA_Server *server, const UA_Node *node) { - /* The reference to the parent is different for variable and variabletype */ - UA_NodeId parentRef; - UA_Boolean inverse; - UA_NodeClass typeNodeClass; - switch (node->nodeClass) { - case UA_NODECLASS_OBJECT: - parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION); - inverse = false; - typeNodeClass = UA_NODECLASS_OBJECTTYPE; - break; - case UA_NODECLASS_VARIABLE: - parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION); - inverse = false; - typeNodeClass = UA_NODECLASS_VARIABLETYPE; - break; - case UA_NODECLASS_OBJECTTYPE: - case UA_NODECLASS_VARIABLETYPE: - case UA_NODECLASS_REFERENCETYPE: - case UA_NODECLASS_DATATYPE: - parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE); - inverse = true; - typeNodeClass = node->nodeClass; - break; - default: - return NULL; - } - - /* Return the first matching candidate */ - for (size_t i = 0; i < node->referencesSize; ++i) { - if (node->references[i].isInverse != inverse) continue; - if (!UA_NodeId_equal(&node->references[i].referenceTypeId, &parentRef)) continue; - UA_assert(node->references[i].targetIdsSize > 0); - const UA_NodeId *targetId = &node->references[i].targetIds[0].nodeId; - const UA_Node *type = UA_Nodestore_get(server, targetId); - if (!type) continue; - if (type->nodeClass == typeNodeClass) return type; - UA_Nodestore_release(server, type); - } - - return NULL; -} - -UA_Boolean UA_Node_hasSubTypeOrInstances(const UA_Node *node) { - const UA_NodeId hasSubType = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE); - const UA_NodeId hasTypeDefinition = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION); - for (size_t i = 0; i < node->referencesSize; ++i) { - if (node->references[i].isInverse == false && UA_NodeId_equal(&node->references[i].referenceTypeId, &hasSubType)) - return true; - if (node->references[i].isInverse == true && - UA_NodeId_equal(&node->references[i].referenceTypeId, &hasTypeDefinition)) - return true; - } - return false; -} - -static const UA_NodeId hasSubtypeNodeId = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_HASSUBTYPE}}; - -static UA_StatusCode getTypeHierarchyFromNode(UA_NodeId **results_ptr, size_t *results_count, size_t *results_size, - const UA_Node *node) { - UA_NodeId *results = *results_ptr; - for (size_t i = 0; i < node->referencesSize; ++i) { - /* Is the reference kind relevant? */ - UA_NodeReferenceKind *refs = &node->references[i]; - if (!refs->isInverse) continue; - if (!UA_NodeId_equal(&hasSubtypeNodeId, &refs->referenceTypeId)) continue; - - /* Append all targets of the reference kind .. if not a duplicate */ - for (size_t j = 0; j < refs->targetIdsSize; ++j) { - /* Is the target a duplicate? (multi-inheritance) */ - UA_NodeId *targetId = &refs->targetIds[j].nodeId; - UA_Boolean duplicate = false; - for (size_t k = 0; k < *results_count; ++k) { - if (UA_NodeId_equal(targetId, &results[k])) { - duplicate = true; - break; - } - } - if (duplicate) continue; - - /* Increase array length if necessary */ - if (*results_count >= *results_size) { - size_t new_size = sizeof(UA_NodeId) * (*results_size) * 2; - UA_NodeId *new_results = (UA_NodeId *)UA_realloc(results, new_size); - if (!new_results) { - UA_Array_delete(results, *results_count, &UA_TYPES[UA_TYPES_NODEID]); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - results = new_results; - *results_ptr = results; - *results_size *= 2; - } - - /* Copy new nodeid to the end of the list */ - UA_StatusCode retval = UA_NodeId_copy(targetId, &results[*results_count]); - if (retval != UA_STATUSCODE_GOOD) { - UA_Array_delete(results, *results_count, &UA_TYPES[UA_TYPES_NODEID]); - return retval; - } - *results_count += 1; - } - } - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode getTypeHierarchy(UA_Nodestore *ns, const UA_NodeId *leafType, UA_NodeId **typeHierarchy, - size_t *typeHierarchySize) { - /* Allocate the results array. Probably too big, but saves mallocs. */ - size_t results_size = 20; - UA_NodeId *results = (UA_NodeId *)UA_malloc(sizeof(UA_NodeId) * results_size); - if (!results) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* The leaf is the first element */ - size_t results_count = 1; - UA_StatusCode retval = UA_NodeId_copy(leafType, &results[0]); - if (retval != UA_STATUSCODE_GOOD) { - UA_free(results); - return retval; - } - - /* Loop over the array members .. and add new elements to the end */ - for (size_t idx = 0; idx < results_count; ++idx) { - /* Get the node */ - const UA_Node *node = ns->getNode(ns->context, &results[idx]); - - /* Invalid node, remove from the array */ - if (!node) { - for (size_t i = idx; i < results_count - 1; ++i) results[i] = results[i + 1]; - results_count--; - continue; - } - - /* Add references from the current node to the end of the array */ - retval = getTypeHierarchyFromNode(&results, &results_count, &results_size, node); - - /* Release the node */ - ns->releaseNode(ns->context, node); - - if (retval != UA_STATUSCODE_GOOD) { - UA_Array_delete(results, results_count, &UA_TYPES[UA_TYPES_NODEID]); - return retval; - } - } - - /* Zero results. The leaf node was not found */ - if (results_count == 0) { - UA_free(results); - results = NULL; - } - - *typeHierarchy = results; - *typeHierarchySize = results_count; - return UA_STATUSCODE_GOOD; -} - -/* For mulithreading: make a copy of the node, edit and replace. - * For singlethreading: edit the original */ -UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, - UA_EditNodeCallback callback, const void *data) { -#ifndef UA_ENABLE_MULTITHREADING - const UA_Node *node = UA_Nodestore_get(server, nodeId); - if (!node) return UA_STATUSCODE_BADNODEIDUNKNOWN; - UA_StatusCode retval = callback(server, session, (UA_Node *)(uintptr_t)node, data); - UA_Nodestore_release(server, node); - return retval; -#else - UA_StatusCode retval; - do { - UA_Node *node; - retval = server->config.nodestore.getNodeCopy(server->config.nodestore.context, nodeId, &node); - if (retval != UA_STATUSCODE_GOOD) return retval; - retval = callback(server, session, node, data); - if (retval != UA_STATUSCODE_GOOD) { - server->config.nodestore.deleteNode(server->config.nodestore.context, node); - return retval; - } - retval = server->config.nodestore.replaceNode(server->config.nodestore.context, node); - } while (retval != UA_STATUSCODE_GOOD); - return retval; -#endif -} - -UA_StatusCode UA_Server_processServiceOperations(UA_Server *server, UA_Session *session, - UA_ServiceOperation operationCallback, const size_t *requestOperations, - const UA_DataType *requestOperationsType, size_t *responseOperations, - const UA_DataType *responseOperationsType) { - size_t ops = *requestOperations; - if (ops == 0) return UA_STATUSCODE_BADNOTHINGTODO; - - /* No padding after size_t */ - void **respPos = (void **)((uintptr_t)responseOperations + sizeof(size_t)); - *respPos = UA_Array_new(ops, responseOperationsType); - if (!(*respPos)) return UA_STATUSCODE_BADOUTOFMEMORY; - - *responseOperations = ops; - uintptr_t respOp = (uintptr_t)*respPos; - /* No padding after size_t */ - uintptr_t reqOp = *(uintptr_t *)((uintptr_t)requestOperations + sizeof(size_t)); - for (size_t i = 0; i < ops; i++) { - operationCallback(server, session, (void *)reqOp, (void *)respOp); - reqOp += requestOperationsType->memSize; - respOp += responseOperationsType->memSize; - } - return UA_STATUSCODE_GOOD; -} - -/*********************************/ -/* Default attribute definitions */ -/*********************************/ - -const UA_ObjectAttributes UA_ObjectAttributes_default = { - 0, /* specifiedAttributes */ - {{0, NULL}, {0, NULL}}, /* displayName */ - {{0, NULL}, {0, NULL}}, /* description */ - 0, - 0, /* writeMask (userWriteMask) */ - 0 /* eventNotifier */ -}; - -const UA_VariableAttributes UA_VariableAttributes_default = { - 0, /* specifiedAttributes */ - {{0, NULL}, {0, NULL}}, /* displayName */ - {{0, NULL}, {0, NULL}}, /* description */ - 0, - 0, /* writeMask (userWriteMask) */ - {NULL, UA_VARIANT_DATA, 0, NULL, 0, NULL}, /* value */ - {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_BASEDATATYPE}}, /* dataType */ - -2, /* valueRank */ - 0, - NULL, /* arrayDimensions */ - UA_ACCESSLEVELMASK_READ, - 0, /* accessLevel (userAccessLevel) */ - 0.0, /* minimumSamplingInterval */ - false /* historizing */ -}; - -const UA_MethodAttributes UA_MethodAttributes_default = { - 0, /* specifiedAttributes */ - {{0, NULL}, {0, NULL}}, /* displayName */ - {{0, NULL}, {0, NULL}}, /* description */ - 0, - 0, /* writeMask (userWriteMask) */ - true, - true /* executable (userExecutable) */ -}; - -const UA_ObjectTypeAttributes UA_ObjectTypeAttributes_default = { - 0, /* specifiedAttributes */ - {{0, NULL}, {0, NULL}}, /* displayName */ - {{0, NULL}, {0, NULL}}, /* description */ - 0, - 0, /* writeMask (userWriteMask) */ - false /* isAbstract */ -}; - -const UA_VariableTypeAttributes UA_VariableTypeAttributes_default = { - 0, /* specifiedAttributes */ - {{0, NULL}, {0, NULL}}, /* displayName */ - {{0, NULL}, {0, NULL}}, /* description */ - 0, - 0, /* writeMask (userWriteMask) */ - {NULL, UA_VARIANT_DATA, 0, NULL, 0, NULL}, /* value */ - {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_BASEDATATYPE}}, /* dataType */ - -2, /* valueRank */ - 0, - NULL, /* arrayDimensions */ - false /* isAbstract */ -}; - -const UA_ReferenceTypeAttributes UA_ReferenceTypeAttributes_default = { - 0, /* specifiedAttributes */ - {{0, NULL}, {0, NULL}}, /* displayName */ - {{0, NULL}, {0, NULL}}, /* description */ - 0, - 0, /* writeMask (userWriteMask) */ - false, /* isAbstract */ - false, /* symmetric */ - {{0, NULL}, {0, NULL}} /* inverseName */ -}; - -const UA_DataTypeAttributes UA_DataTypeAttributes_default = { - 0, /* specifiedAttributes */ - {{0, NULL}, {0, NULL}}, /* displayName */ - {{0, NULL}, {0, NULL}}, /* description */ - 0, - 0, /* writeMask (userWriteMask) */ - false /* isAbstract */ -}; - -const UA_ViewAttributes UA_ViewAttributes_default = { - 0, /* specifiedAttributes */ - {{0, NULL}, {0, NULL}}, /* displayName */ - {{0, NULL}, {0, NULL}}, /* description */ - 0, - 0, /* writeMask (userWriteMask) */ - false, /* containsNoLoops */ - 0 /* eventNotifier */ -}; - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_server_worker.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#define UA_MAXTIMEOUT 50 /* Max timeout in ms between main-loop iterations */ - -/** - * Worker Threads and Dispatch Queue - * --------------------------------- - * The worker threads dequeue callbacks from a central Multi-Producer - * Multi-Consumer Queue (MPMC). When there are no callbacks, workers go idle. - * The condition to wake them up is triggered whenever a callback is - * dispatched. - * - * Future Plans: Use work-stealing to load-balance between cores. - * Le, Nhat Minh, et al. "Correct and efficient work-stealing for weak memory - * models." ACM SIGPLAN Notices. Vol. 48. No. 8. ACM, 2013. */ - -#ifdef UA_ENABLE_MULTITHREADING - -struct UA_Worker { - UA_Server *server; - pthread_t thr; - UA_UInt32 counter; - volatile UA_Boolean running; - - /* separate cache lines */ - char padding[64 - sizeof(void *) - sizeof(pthread_t) - sizeof(UA_UInt32) - sizeof(UA_Boolean)]; -}; - -typedef struct { - struct cds_wfcq_node node; - UA_ServerCallback callback; - void *data; - - UA_Boolean delayed; /* Is it a delayed callback? */ - UA_Boolean countersSampled; /* Have the worker counters been sampled? */ - UA_UInt32 workerCounters[]; /* Counter value for each worker */ -} WorkerCallback; - -/* Forward Declaration */ -static void processDelayedCallback(UA_Server *server, WorkerCallback *dc); - -static void *workerLoop(UA_Worker *worker) { - UA_Server *server = worker->server; - UA_UInt32 *counter = &worker->counter; - volatile UA_Boolean *running = &worker->running; - - /* Initialize the (thread local) random seed with the ram address - * of the worker. Not for security-critical entropy! */ - UA_random_seed((uintptr_t)worker); - - while (*running) { - UA_atomic_add(counter, 1); - WorkerCallback *dc = - (WorkerCallback *)cds_wfcq_dequeue_blocking(&server->dispatchQueue_head, &server->dispatchQueue_tail); - if (!dc) { - /* Nothing to do. Sleep until a callback is dispatched */ - pthread_mutex_lock(&server->dispatchQueue_mutex); - pthread_cond_wait(&server->dispatchQueue_condition, &server->dispatchQueue_mutex); - pthread_mutex_unlock(&server->dispatchQueue_mutex); - continue; - } - - if (dc->delayed) { - processDelayedCallback(server, dc); - continue; - } - - dc->callback(server, dc->data); - UA_free(dc); - } - - UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, "Worker shut down"); - return NULL; -} - -static void emptyDispatchQueue(UA_Server *server) { - while (!cds_wfcq_empty(&server->dispatchQueue_head, &server->dispatchQueue_tail)) { - WorkerCallback *dc = - (WorkerCallback *)cds_wfcq_dequeue_blocking(&server->dispatchQueue_head, &server->dispatchQueue_tail); - dc->callback(server, dc->data); - UA_free(dc); - } -} - -#endif - -/** - * Repeated Callbacks - * ------------------ - * Repeated Callbacks are handled by UA_Timer (used in both client and server). - * In the multi-threaded case, callbacks are dispatched to workers. Otherwise, - * they are executed immediately. */ - -void UA_Server_workerCallback(UA_Server *server, UA_ServerCallback callback, void *data) { -#ifndef UA_ENABLE_MULTITHREADING - /* Execute immediately */ - callback(server, data); -#else - /* Execute immediately if memory could not be allocated */ - WorkerCallback *dc = (WorkerCallback *)UA_malloc(sizeof(WorkerCallback)); - if (!dc) { - callback(server, data); - return; - } - - /* Enqueue for the worker threads */ - dc->callback = callback; - dc->data = data; - dc->delayed = false; - cds_wfcq_node_init(&dc->node); - cds_wfcq_enqueue(&server->dispatchQueue_head, &server->dispatchQueue_tail, &dc->node); - - /* Wake up sleeping workers */ - pthread_cond_broadcast(&server->dispatchQueue_condition); -#endif -} - -/** - * Delayed Callbacks - * ----------------- - * - * Delayed Callbacks are called only when all callbacks that were dispatched - * prior are finished. In the single-threaded case, the callback is added to a - * singly-linked list that is processed at the end of the server's main-loop. In - * the multi-threaded case, the delay is ensure by a three-step procedure: - * - * 1. The delayed callback is dispatched to the worker queue. So it is only - * dequeued when all prior callbacks have been dequeued. - * - * 2. When the callback is first dequeued by a worker, sample the counter of all - * workers. Once all counters have advanced, the callback is ready. - * - * 3. Check regularly if the callback is ready by adding it back to the dispatch - * queue. */ - -#ifndef UA_ENABLE_MULTITHREADING - -typedef struct UA_DelayedCallback { - SLIST_ENTRY(UA_DelayedCallback) next; - UA_ServerCallback callback; - void *data; -} UA_DelayedCallback; - -UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data) { - UA_DelayedCallback *dc = (UA_DelayedCallback *)UA_malloc(sizeof(UA_DelayedCallback)); - if (!dc) return UA_STATUSCODE_BADOUTOFMEMORY; - - dc->callback = callback; - dc->data = data; - SLIST_INSERT_HEAD(&server->delayedCallbacks, dc, next); - return UA_STATUSCODE_GOOD; -} - -static void processDelayedCallbacks(UA_Server *server) { - UA_DelayedCallback *dc, *dc_tmp; - SLIST_FOREACH_SAFE(dc, &server->delayedCallbacks, next, dc_tmp) { - SLIST_REMOVE(&server->delayedCallbacks, dc, UA_DelayedCallback, next); - dc->callback(server, dc->data); - UA_free(dc); - } -} - -#else /* UA_ENABLE_MULTITHREADING */ - -UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data) { - size_t dcsize = sizeof(WorkerCallback) + (sizeof(UA_UInt32) * server->config.nThreads); - WorkerCallback *dc = (WorkerCallback *)UA_malloc(dcsize); - if (!dc) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Enqueue for the worker threads */ - dc->callback = callback; - dc->data = data; - dc->delayed = true; - dc->countersSampled = false; - cds_wfcq_node_init(&dc->node); - cds_wfcq_enqueue(&server->dispatchQueue_head, &server->dispatchQueue_tail, &dc->node); - - /* Wake up sleeping workers */ - pthread_cond_broadcast(&server->dispatchQueue_condition); - return UA_STATUSCODE_GOOD; -} - -/* Called from the worker loop */ -static void processDelayedCallback(UA_Server *server, WorkerCallback *dc) { - /* Set the worker counters */ - if (!dc->countersSampled) { - for (size_t i = 0; i < server->config.nThreads; ++i) dc->workerCounters[i] = server->workers[i].counter; - dc->countersSampled = true; - - /* Re-add to the dispatch queue */ - cds_wfcq_node_init(&dc->node); - cds_wfcq_enqueue(&server->dispatchQueue_head, &server->dispatchQueue_tail, &dc->node); - - /* Wake up sleeping workers */ - pthread_cond_broadcast(&server->dispatchQueue_condition); - return; - } - - /* Have all other jobs finished? */ - UA_Boolean ready = true; - for (size_t i = 0; i < server->config.nThreads; ++i) { - if (dc->workerCounters[i] == server->workers[i].counter) { - ready = false; - break; - } - } - - /* Re-add to the dispatch queue. - * TODO: What is the impact of this loop? - * Can we add a small delay here? */ - if (!ready) { - cds_wfcq_node_init(&dc->node); - cds_wfcq_enqueue(&server->dispatchQueue_head, &server->dispatchQueue_tail, &dc->node); - - /* Wake up sleeping workers */ - pthread_cond_broadcast(&server->dispatchQueue_condition); - return; - } - - /* Execute the callback */ - dc->callback(server, dc->data); - UA_free(dc); -} - -#endif - -/** - * Main Server Loop - * ---------------- - * Start: Spin up the workers and the network layer and sample the server's - * start time. - * Iterate: Process repeated callbacks and events in the network layer. - * This part can be driven from an external main-loop in an - * event-driven single-threaded architecture. - * Stop: Stop workers, finish all callbacks, stop the network layer, - * clean up */ - -UA_StatusCode UA_Server_run_startup(UA_Server *server) { - UA_Variant var; - UA_StatusCode result = UA_STATUSCODE_GOOD; - - /* Sample the start time and set it to the Server object */ - server->startTime = UA_DateTime_now(); - UA_Variant_init(&var); - UA_Variant_setScalar(&var, &server->startTime, &UA_TYPES[UA_TYPES_DATETIME]); - UA_Server_writeValue(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME), var); - - /* Start the networklayers */ - for (size_t i = 0; i < server->config.networkLayersSize; ++i) { - UA_ServerNetworkLayer *nl = &server->config.networkLayers[i]; - result |= nl->start(nl, &server->config.customHostname); - } - -/* Spin up the worker threads */ -#ifdef UA_ENABLE_MULTITHREADING - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER, "Spinning up %u worker thread(s)", server->config.nThreads); - pthread_cond_init(&server->dispatchQueue_condition, 0); - pthread_mutex_init(&server->dispatchQueue_mutex, 0); - server->workers = (UA_Worker *)UA_malloc(server->config.nThreads * sizeof(UA_Worker)); - if (!server->workers) return UA_STATUSCODE_BADOUTOFMEMORY; - for (size_t i = 0; i < server->config.nThreads; ++i) { - UA_Worker *worker = &server->workers[i]; - worker->server = server; - worker->counter = 0; - worker->running = true; - pthread_create(&worker->thr, NULL, (void *(*)(void *))workerLoop, worker); - } -#endif - -/* Start the multicast discovery server */ -#ifdef UA_ENABLE_DISCOVERY_MULTICAST - if (server->config.applicationDescription.applicationType == UA_APPLICATIONTYPE_DISCOVERYSERVER) - startMulticastDiscoveryServer(server); -#endif - - return result; -} - -UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal) { - /* Process repeated work */ - UA_DateTime now = UA_DateTime_nowMonotonic(); - UA_DateTime nextRepeated = - UA_Timer_process(&server->timer, now, (UA_TimerDispatchCallback)UA_Server_workerCallback, server); - UA_DateTime latest = now + (UA_MAXTIMEOUT * UA_DATETIME_MSEC); - if (nextRepeated > latest) nextRepeated = latest; - - UA_UInt16 timeout = 0; - - /* round always to upper value to avoid timeout to be set to 0 - * if (nextRepeated - now) < (UA_DATETIME_MSEC/2) */ - if (waitInternal) timeout = (UA_UInt16)(((nextRepeated - now) + (UA_DATETIME_MSEC - 1)) / UA_DATETIME_MSEC); - - /* Listen on the networklayer */ - for (size_t i = 0; i < server->config.networkLayersSize; ++i) { - UA_ServerNetworkLayer *nl = &server->config.networkLayers[i]; - nl->listen(nl, server, timeout); - } - -#ifndef UA_ENABLE_MULTITHREADING - /* Process delayed callbacks when all callbacks and - * network events are done */ - processDelayedCallbacks(server); -#endif - -#if defined(UA_ENABLE_DISCOVERY_MULTICAST) && !defined(UA_ENABLE_MULTITHREADING) - if (server->config.applicationDescription.applicationType == UA_APPLICATIONTYPE_DISCOVERYSERVER) { - // TODO multicastNextRepeat does not consider new input data (requests) - // on the socket. It will be handled on the next call. if needed, we - // need to use select with timeout on the multicast socket - // server->mdnsSocket (see example in mdnsd library) on higher level. - UA_DateTime multicastNextRepeat = 0; - UA_StatusCode hasNext = iterateMulticastDiscoveryServer(server, &multicastNextRepeat, UA_TRUE); - if (hasNext == UA_STATUSCODE_GOOD && multicastNextRepeat < nextRepeated) nextRepeated = multicastNextRepeat; - } -#endif - - now = UA_DateTime_nowMonotonic(); - timeout = 0; - if (nextRepeated > now) timeout = (UA_UInt16)((nextRepeated - now) / UA_DATETIME_MSEC); - return timeout; -} - -UA_StatusCode UA_Server_run_shutdown(UA_Server *server) { - /* Stop the netowrk layer */ - for (size_t i = 0; i < server->config.networkLayersSize; ++i) { - UA_ServerNetworkLayer *nl = &server->config.networkLayers[i]; - nl->stop(nl, server); - } - -#ifndef UA_ENABLE_MULTITHREADING - /* Process remaining delayed callbacks */ - processDelayedCallbacks(server); -#else - /* Shut down the workers */ - if (server->workers) { - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER, "Shutting down %u worker thread(s)", - server->config.nThreads); - for (size_t i = 0; i < server->config.nThreads; ++i) server->workers[i].running = false; - pthread_cond_broadcast(&server->dispatchQueue_condition); - for (size_t i = 0; i < server->config.nThreads; ++i) pthread_join(server->workers[i].thr, NULL); - UA_free(server->workers); - server->workers = NULL; - } - - /* Execute the remaining callbacks in the dispatch queue. - * This also executes the delayed callbacks. */ - emptyDispatchQueue(server); - -#endif - -/* Stop multicast discovery */ -#ifdef UA_ENABLE_DISCOVERY_MULTICAST - if (server->config.applicationDescription.applicationType == UA_APPLICATIONTYPE_DISCOVERYSERVER) - stopMulticastDiscoveryServer(server); -#endif - - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Server_run(UA_Server *server, volatile UA_Boolean *running) { - UA_StatusCode retval = UA_Server_run_startup(server); - if (retval != UA_STATUSCODE_GOOD) return retval; - while (*running) UA_Server_run_iterate(server, true); - return UA_Server_run_shutdown(server); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_server_discovery.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef UA_ENABLE_DISCOVERY - -static UA_StatusCode register_server_with_discovery_server(UA_Server *server, const char *discoveryServerUrl, - const UA_Boolean isUnregister, - const char *semaphoreFilePath) { - if (!discoveryServerUrl) { - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, "No discovery server url provided"); - return UA_STATUSCODE_BADINTERNALERROR; - } - - /* Create the client */ - UA_Client *client = UA_Client_new(UA_ClientConfig_default); - if (!client) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Connect the client */ - UA_StatusCode retval = UA_Client_connect(client, discoveryServerUrl); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_CLIENT, - "Connecting to the discovery server failed with statuscode %s", UA_StatusCode_name(retval)); - UA_Client_disconnect(client); - UA_Client_delete(client); - return retval; - } - - /* Prepare the request. Do not cleanup the request after the service call, - * as the members are stack-allocated or point into the server config. */ - UA_RegisterServer2Request request; - UA_RegisterServer2Request_init(&request); - request.requestHeader.timestamp = UA_DateTime_now(); - request.requestHeader.timeoutHint = 10000; - - request.server.isOnline = !isUnregister; - request.server.serverUri = server->config.applicationDescription.applicationUri; - request.server.productUri = server->config.applicationDescription.productUri; - request.server.serverType = server->config.applicationDescription.applicationType; - request.server.gatewayServerUri = server->config.applicationDescription.gatewayServerUri; - - if (semaphoreFilePath) { -#ifdef UA_ENABLE_DISCOVERY_SEMAPHORE - request.server.semaphoreFilePath = UA_STRING((char *)(uintptr_t)semaphoreFilePath); /* dirty cast */ -#else - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_CLIENT, - "Ignoring semaphore file path. open62541 not compiled " - "with UA_ENABLE_DISCOVERY_SEMAPHORE=ON"); -#endif - } - - request.server.serverNames = &server->config.applicationDescription.applicationName; - request.server.serverNamesSize = 1; - - /* Copy the discovery urls from the server config and the network layers*/ - size_t config_discurls = server->config.applicationDescription.discoveryUrlsSize; - size_t nl_discurls = server->config.networkLayersSize; - size_t total_discurls = config_discurls + nl_discurls; - request.server.discoveryUrls = (UA_String *)UA_alloca(sizeof(UA_String) * total_discurls); - if (!request.server.discoveryUrls) { - UA_Client_disconnect(client); - UA_Client_delete(client); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - request.server.discoveryUrlsSize = total_discurls; - - for (size_t i = 0; i < config_discurls; ++i) - request.server.discoveryUrls[i] = server->config.applicationDescription.discoveryUrls[i]; - - /* TODO: Add nl only if discoveryUrl not already present */ - for (size_t i = 0; i < nl_discurls; ++i) { - UA_ServerNetworkLayer *nl = &server->config.networkLayers[i]; - request.server.discoveryUrls[config_discurls + i] = nl->discoveryUrl; - } - - UA_MdnsDiscoveryConfiguration mdnsConfig; - UA_MdnsDiscoveryConfiguration_init(&mdnsConfig); - - request.discoveryConfigurationSize = 1; - request.discoveryConfiguration = UA_ExtensionObject_new(); - UA_ExtensionObject_init(&request.discoveryConfiguration[0]); - request.discoveryConfiguration[0].encoding = UA_EXTENSIONOBJECT_DECODED_NODELETE; - request.discoveryConfiguration[0].content.decoded.type = &UA_TYPES[UA_TYPES_MDNSDISCOVERYCONFIGURATION]; - request.discoveryConfiguration[0].content.decoded.data = &mdnsConfig; - - mdnsConfig.mdnsServerName = server->config.mdnsServerName; - mdnsConfig.serverCapabilities = server->config.serverCapabilities; - mdnsConfig.serverCapabilitiesSize = server->config.serverCapabilitiesSize; - - // First try with RegisterServer2, if that isn't implemented, use RegisterServer - UA_RegisterServer2Response response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_REGISTERSERVER2REQUEST], &response, - &UA_TYPES[UA_TYPES_REGISTERSERVER2RESPONSE]); - - UA_StatusCode serviceResult = response.responseHeader.serviceResult; - UA_RegisterServer2Response_deleteMembers(&response); - UA_ExtensionObject_delete(request.discoveryConfiguration); - - if (serviceResult == UA_STATUSCODE_BADNOTIMPLEMENTED || serviceResult == UA_STATUSCODE_BADSERVICEUNSUPPORTED) { - /* Try RegisterServer */ - UA_RegisterServerRequest request_fallback; - UA_RegisterServerRequest_init(&request_fallback); - /* Copy from RegisterServer2 request */ - request_fallback.requestHeader = request.requestHeader; - request_fallback.server = request.server; - - UA_RegisterServerResponse response_fallback; - - __UA_Client_Service(client, &request_fallback, &UA_TYPES[UA_TYPES_REGISTERSERVERREQUEST], &response_fallback, - &UA_TYPES[UA_TYPES_REGISTERSERVERRESPONSE]); - - serviceResult = response_fallback.responseHeader.serviceResult; - UA_RegisterServerResponse_deleteMembers(&response_fallback); - } - - if (serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_CLIENT, - "RegisterServer/RegisterServer2 failed with statuscode %s", UA_StatusCode_name(serviceResult)); - } - - UA_Client_disconnect(client); - UA_Client_delete(client); - return serviceResult; -} - -UA_StatusCode UA_Server_register_discovery(UA_Server *server, const char *discoveryServerUrl, - const char *semaphoreFilePath) { - return register_server_with_discovery_server(server, discoveryServerUrl, UA_FALSE, semaphoreFilePath); -} - -UA_StatusCode UA_Server_unregister_discovery(UA_Server *server, const char *discoveryServerUrl) { - return register_server_with_discovery_server(server, discoveryServerUrl, UA_TRUE, NULL); -} - -#endif /* UA_ENABLE_DISCOVERY */ - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_securechannel_manager.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#define STARTCHANNELID 1 -#define STARTTOKENID 1 - -UA_StatusCode UA_SecureChannelManager_init(UA_SecureChannelManager *cm, UA_Server *server) { - LIST_INIT(&cm->channels); - // TODO: use an ID that is likely to be unique after a restart - cm->lastChannelId = STARTCHANNELID; - cm->lastTokenId = STARTTOKENID; - cm->currentChannelCount = 0; - cm->server = server; - return UA_STATUSCODE_GOOD; -} - -void UA_SecureChannelManager_deleteMembers(UA_SecureChannelManager *cm) { - channel_list_entry *entry, *temp; - LIST_FOREACH_SAFE(entry, &cm->channels, pointers, temp) { - LIST_REMOVE(entry, pointers); - UA_SecureChannel_deleteMembersCleanup(&entry->channel); - UA_free(entry); - } -} - -static void removeSecureChannelCallback(UA_Server *server, void *entry) { - channel_list_entry *centry = (channel_list_entry *)entry; - UA_SecureChannel_deleteMembersCleanup(¢ry->channel); - UA_free(entry); -} - -static UA_StatusCode removeSecureChannel(UA_SecureChannelManager *cm, channel_list_entry *entry) { - /* Add a delayed callback to remove the channel when the currently - * scheduled jobs have completed */ - UA_StatusCode retval = UA_Server_delayedCallback(cm->server, removeSecureChannelCallback, entry); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(cm->server->config.logger, UA_LOGCATEGORY_SESSION, - "Could not remove the secure channel with error code %s", UA_StatusCode_name(retval)); - return retval; /* Try again next time */ - } - - /* Detach the channel and make the capacity available */ - LIST_REMOVE(entry, pointers); - UA_atomic_add(&cm->currentChannelCount, (UA_UInt32)-1); - return UA_STATUSCODE_GOOD; -} - -/* remove channels that were not renewed or who have no connection attached */ -void UA_SecureChannelManager_cleanupTimedOut(UA_SecureChannelManager *cm, UA_DateTime nowMonotonic) { - channel_list_entry *entry, *temp; - LIST_FOREACH_SAFE(entry, &cm->channels, pointers, temp) { - UA_DateTime timeout = entry->channel.securityToken.createdAt + - (UA_DateTime)(entry->channel.securityToken.revisedLifetime * UA_DATETIME_MSEC); - if (timeout < nowMonotonic || !entry->channel.connection) { - UA_LOG_INFO_CHANNEL(cm->server->config.logger, &entry->channel, "SecureChannel has timed out"); - removeSecureChannel(cm, entry); - } else if (entry->channel.nextSecurityToken.tokenId > 0) { - UA_SecureChannel_revolveTokens(&entry->channel); - } - } -} - -/* remove the first channel that has no session attached */ -static UA_Boolean purgeFirstChannelWithoutSession(UA_SecureChannelManager *cm) { - channel_list_entry *entry; - LIST_FOREACH(entry, &cm->channels, pointers) { - if (LIST_EMPTY(&(entry->channel.sessions))) { - UA_LOG_DEBUG_CHANNEL(cm->server->config.logger, &entry->channel, - "Channel was purged since maxSecureChannels was " - "reached and channel had no session attached"); - removeSecureChannel(cm, entry); - UA_assert(entry != LIST_FIRST(&cm->channels)); - return true; - } - } - return false; -} - -UA_StatusCode UA_SecureChannelManager_create(UA_SecureChannelManager *const cm, UA_Connection *const connection, - const UA_SecurityPolicy *const securityPolicy, - const UA_AsymmetricAlgorithmSecurityHeader *const asymHeader) { - /* connection already has a channel attached. */ - if (connection->channel != NULL) return UA_STATUSCODE_BADINTERNALERROR; - - /* Check if there exists a free SC, otherwise try to purge one SC without a - * session the purge has been introduced to pass CTT, it is not clear what - * strategy is expected here */ - if (cm->currentChannelCount >= cm->server->config.maxSecureChannels && !purgeFirstChannelWithoutSession(cm)) - return UA_STATUSCODE_BADOUTOFMEMORY; - - UA_LOG_INFO(cm->server->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "Creating a new SecureChannel"); - - channel_list_entry *entry = (channel_list_entry *)UA_malloc(sizeof(channel_list_entry)); - if (!entry) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Create the channel context and parse the sender (remote) certificate used for the - * secureChannel. */ - UA_StatusCode retval = UA_SecureChannel_init(&entry->channel, securityPolicy, &asymHeader->senderCertificate); - if (retval != UA_STATUSCODE_GOOD) { - UA_free(entry); - return retval; - } - - /* Channel state is fresh (0) */ - entry->channel.securityToken.channelId = 0; - entry->channel.securityToken.tokenId = cm->lastTokenId++; - entry->channel.securityToken.createdAt = UA_DateTime_now(); - entry->channel.securityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime; - - LIST_INSERT_HEAD(&cm->channels, entry, pointers); - UA_atomic_add(&cm->currentChannelCount, 1); - UA_Connection_attachSecureChannel(connection, &entry->channel); - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_SecureChannelManager_open(UA_SecureChannelManager *cm, UA_SecureChannel *channel, - const UA_OpenSecureChannelRequest *request, - UA_OpenSecureChannelResponse *response) { - if (channel->state != UA_SECURECHANNELSTATE_FRESH) { - UA_LOG_ERROR_CHANNEL(cm->server->config.logger, channel, "Called open on already open or closed channel"); - return UA_STATUSCODE_BADINTERNALERROR; - } - - if (request->securityMode != UA_MESSAGESECURITYMODE_NONE && - UA_ByteString_equal(&channel->securityPolicy->policyUri, &UA_SECURITY_POLICY_NONE_URI)) { - return UA_STATUSCODE_BADSECURITYMODEREJECTED; - } - - channel->securityToken.channelId = cm->lastChannelId++; - channel->securityToken.createdAt = UA_DateTime_now(); - channel->securityToken.revisedLifetime = (request->requestedLifetime > cm->server->config.maxSecurityTokenLifetime) - ? cm->server->config.maxSecurityTokenLifetime - : request->requestedLifetime; - if (channel->securityToken.revisedLifetime == 0) // lifetime 0 -> set the maximum possible - channel->securityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime; - UA_ByteString_copy(&request->clientNonce, &channel->remoteNonce); - channel->securityMode = request->securityMode; - const size_t keyLength = channel->securityPolicy->symmetricModule.cryptoModule.getLocalEncryptionKeyLength( - channel->securityPolicy, channel->channelContext); - UA_SecureChannel_generateNonce(channel, keyLength, &channel->localNonce); - - UA_SecureChannel_generateNewKeys(channel); - - // Set the response - UA_ByteString_copy(&channel->localNonce, &response->serverNonce); - UA_ChannelSecurityToken_copy(&channel->securityToken, &response->securityToken); - response->responseHeader.timestamp = UA_DateTime_now(); - response->responseHeader.requestHandle = request->requestHeader.requestHandle; - - // Now overwrite the creation date with the internal monotonic clock - channel->securityToken.createdAt = UA_DateTime_nowMonotonic(); - - channel->state = UA_SECURECHANNELSTATE_OPEN; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_SecureChannelManager_renew(UA_SecureChannelManager *cm, UA_SecureChannel *channel, - const UA_OpenSecureChannelRequest *request, - UA_OpenSecureChannelResponse *response) { - if (channel->state != UA_SECURECHANNELSTATE_OPEN) { - UA_LOG_ERROR_CHANNEL(cm->server->config.logger, channel, "Called renew on channel which is not open"); - return UA_STATUSCODE_BADINTERNALERROR; - } - - /* If no security token is already issued */ - if (channel->nextSecurityToken.tokenId == 0) { - channel->nextSecurityToken.channelId = channel->securityToken.channelId; - channel->nextSecurityToken.tokenId = cm->lastTokenId++; - channel->nextSecurityToken.createdAt = UA_DateTime_now(); - channel->nextSecurityToken.revisedLifetime = - (request->requestedLifetime > cm->server->config.maxSecurityTokenLifetime) - ? cm->server->config.maxSecurityTokenLifetime - : request->requestedLifetime; - if (channel->nextSecurityToken.revisedLifetime == 0) /* lifetime 0 -> return the max lifetime */ - channel->nextSecurityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime; - } - - /* Replace the nonces */ - UA_ByteString_deleteMembers(&channel->remoteNonce); - UA_ByteString_copy(&request->clientNonce, &channel->remoteNonce); - - const size_t keyLength = channel->securityPolicy->symmetricModule.cryptoModule.getLocalEncryptionKeyLength( - channel->securityPolicy, channel->channelContext); - UA_ByteString_deleteMembers(&channel->localNonce); - UA_SecureChannel_generateNonce(channel, keyLength, &channel->localNonce); - - /* Set the response */ - response->responseHeader.requestHandle = request->requestHeader.requestHandle; - UA_ByteString_copy(&channel->localNonce, &response->serverNonce); - UA_ChannelSecurityToken_copy(&channel->nextSecurityToken, &response->securityToken); - - /* Reset the internal creation date to the monotonic clock */ - channel->nextSecurityToken.createdAt = UA_DateTime_nowMonotonic(); - return UA_STATUSCODE_GOOD; -} - -UA_SecureChannel *UA_SecureChannelManager_get(UA_SecureChannelManager *cm, UA_UInt32 channelId) { - channel_list_entry *entry; - LIST_FOREACH(entry, &cm->channels, pointers) { - if (entry->channel.securityToken.channelId == channelId) return &entry->channel; - } - return NULL; -} - -UA_StatusCode UA_SecureChannelManager_close(UA_SecureChannelManager *cm, UA_UInt32 channelId) { - channel_list_entry *entry; - LIST_FOREACH(entry, &cm->channels, pointers) { - if (entry->channel.securityToken.channelId == channelId) break; - } - if (!entry) return UA_STATUSCODE_BADINTERNALERROR; - return removeSecureChannel(cm, entry); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_session_manager.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -UA_StatusCode UA_SessionManager_init(UA_SessionManager *sm, UA_Server *server) { - LIST_INIT(&sm->sessions); - sm->currentSessionCount = 0; - sm->server = server; - return UA_STATUSCODE_GOOD; -} - -void UA_SessionManager_deleteMembers(UA_SessionManager *sm) { - session_list_entry *current, *temp; - LIST_FOREACH_SAFE(current, &sm->sessions, pointers, temp) { - LIST_REMOVE(current, pointers); - UA_Session_deleteMembersCleanup(¤t->session, sm->server); - UA_free(current); - } -} - -/* Delayed callback to free the session memory */ -static void removeSessionCallback(UA_Server *server, void *entry) { - session_list_entry *sentry = (session_list_entry *)entry; - UA_Session_deleteMembersCleanup(&sentry->session, server); - UA_free(sentry); -} - -static UA_StatusCode removeSession(UA_SessionManager *sm, session_list_entry *sentry) { - /* Deactivate the session */ - sentry->session.activated = false; - - /* Add a delayed callback to remove the session when the currently - * scheduled jobs have completed */ - UA_StatusCode retval = UA_Server_delayedCallback(sm->server, removeSessionCallback, sentry); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(sm->server->config.logger, &sentry->session, "Could not remove session with error code %s", - UA_StatusCode_name(retval)); - return retval; /* Try again next time */ - } - - /* Detach the session and make the capacity available */ - LIST_REMOVE(sentry, pointers); - UA_atomic_add(&sm->currentSessionCount, (UA_UInt32)-1); - return UA_STATUSCODE_GOOD; -} - -void UA_SessionManager_cleanupTimedOut(UA_SessionManager *sm, UA_DateTime nowMonotonic) { - session_list_entry *sentry, *temp; - LIST_FOREACH_SAFE(sentry, &sm->sessions, pointers, temp) { - /* Session has timed out? */ - if (sentry->session.validTill >= nowMonotonic) continue; - UA_LOG_INFO_SESSION(sm->server->config.logger, &sentry->session, "Session has timed out"); - sm->server->config.accessControl.closeSession(&sentry->session.sessionId, sentry->session.sessionHandle); - removeSession(sm, sentry); - } -} - -UA_Session *UA_SessionManager_getSessionByToken(UA_SessionManager *sm, const UA_NodeId *token) { - session_list_entry *current = NULL; - LIST_FOREACH(current, &sm->sessions, pointers) { - /* Token does not match */ - if (!UA_NodeId_equal(¤t->session.authenticationToken, token)) continue; - - /* Session has timed out */ - if (UA_DateTime_nowMonotonic() > current->session.validTill) { - UA_LOG_INFO_SESSION(sm->server->config.logger, ¤t->session, - "Client tries to use a session that has timed out"); - return NULL; - } - - /* Ok, return */ - return ¤t->session; - } - - /* Session not found */ - UA_LOG_INFO(sm->server->config.logger, UA_LOGCATEGORY_SESSION, - "Try to use Session with token " UA_PRINTF_GUID_FORMAT " but is not found", - UA_PRINTF_GUID_DATA(token->identifier.guid)); - return NULL; -} - -UA_Session *UA_SessionManager_getSessionById(UA_SessionManager *sm, const UA_NodeId *sessionId) { - session_list_entry *current = NULL; - LIST_FOREACH(current, &sm->sessions, pointers) { - /* Token does not match */ - if (!UA_NodeId_equal(¤t->session.sessionId, sessionId)) continue; - - /* Session has timed out */ - if (UA_DateTime_nowMonotonic() > current->session.validTill) { - UA_LOG_INFO_SESSION(sm->server->config.logger, ¤t->session, - "Client tries to use a session that has timed out"); - return NULL; - } - - /* Ok, return */ - return ¤t->session; - } - - /* Session not found */ - UA_LOG_INFO(sm->server->config.logger, UA_LOGCATEGORY_SESSION, - "Try to use Session with identifier " UA_PRINTF_GUID_FORMAT " but is not found", - UA_PRINTF_GUID_DATA(sessionId->identifier.guid)); - return NULL; -} - -/* Creates and adds a session. But it is not yet attached to a secure channel. */ -UA_StatusCode UA_SessionManager_createSession(UA_SessionManager *sm, UA_SecureChannel *channel, - const UA_CreateSessionRequest *request, UA_Session **session) { - if (sm->currentSessionCount >= sm->server->config.maxSessions) return UA_STATUSCODE_BADTOOMANYSESSIONS; - - session_list_entry *newentry = (session_list_entry *)UA_malloc(sizeof(session_list_entry)); - if (!newentry) return UA_STATUSCODE_BADOUTOFMEMORY; - - UA_atomic_add(&sm->currentSessionCount, 1); - UA_Session_init(&newentry->session); - newentry->session.sessionId = UA_NODEID_GUID(1, UA_Guid_random()); - newentry->session.authenticationToken = UA_NODEID_GUID(1, UA_Guid_random()); - - if (request->requestedSessionTimeout <= sm->server->config.maxSessionTimeout && request->requestedSessionTimeout > 0) - newentry->session.timeout = request->requestedSessionTimeout; - else - newentry->session.timeout = sm->server->config.maxSessionTimeout; - - UA_Session_updateLifetime(&newentry->session); - LIST_INSERT_HEAD(&sm->sessions, newentry, pointers); - *session = &newentry->session; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_SessionManager_removeSession(UA_SessionManager *sm, const UA_NodeId *token) { - session_list_entry *current; - LIST_FOREACH(current, &sm->sessions, pointers) { - if (UA_NodeId_equal(¤t->session.authenticationToken, token)) break; - } - if (!current) return UA_STATUSCODE_BADSESSIONIDINVALID; - return removeSession(sm, current); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_subscription.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */ - -UA_Subscription *UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID) { - /* Allocate the memory */ - UA_Subscription *newItem = (UA_Subscription *)UA_calloc(1, sizeof(UA_Subscription)); - if (!newItem) return NULL; - - /* Remaining members are covered by calloc zeroing out the memory */ - newItem->session = session; - newItem->subscriptionID = subscriptionID; - newItem->numMonitoredItems = 0; - newItem->state = UA_SUBSCRIPTIONSTATE_NORMAL; /* The first publish response is sent immediately */ - TAILQ_INIT(&newItem->retransmissionQueue); - return newItem; -} - -void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server) { - Subscription_unregisterPublishCallback(server, subscription); - - /* Delete monitored Items */ - UA_MonitoredItem *mon, *tmp_mon; - LIST_FOREACH_SAFE(mon, &subscription->monitoredItems, listEntry, tmp_mon) { - LIST_REMOVE(mon, listEntry); - MonitoredItem_delete(server, mon); - } - - /* Delete Retransmission Queue */ - UA_NotificationMessageEntry *nme, *nme_tmp; - TAILQ_FOREACH_SAFE(nme, &subscription->retransmissionQueue, listEntry, nme_tmp) { - TAILQ_REMOVE(&subscription->retransmissionQueue, nme, listEntry); - UA_NotificationMessage_deleteMembers(&nme->message); - UA_free(nme); - } - subscription->retransmissionQueueSize = 0; -} - -UA_MonitoredItem *UA_Subscription_getMonitoredItem(UA_Subscription *sub, UA_UInt32 monitoredItemID) { - UA_MonitoredItem *mon; - LIST_FOREACH(mon, &sub->monitoredItems, listEntry) { - if (mon->itemId == monitoredItemID) break; - } - return mon; -} - -UA_StatusCode UA_Subscription_deleteMonitoredItem(UA_Server *server, UA_Subscription *sub, UA_UInt32 monitoredItemID) { - /* Find the MonitoredItem */ - UA_MonitoredItem *mon; - LIST_FOREACH(mon, &sub->monitoredItems, listEntry) { - if (mon->itemId == monitoredItemID) break; - } - if (!mon) return UA_STATUSCODE_BADMONITOREDITEMIDINVALID; - - /* Remove the MonitoredItem */ - LIST_REMOVE(mon, listEntry); - MonitoredItem_delete(server, mon); - sub->numMonitoredItems--; - return UA_STATUSCODE_GOOD; -} - -void UA_Subscription_addMonitoredItem(UA_Subscription *sub, UA_MonitoredItem *newMon) { - sub->numMonitoredItems++; - LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry); -} - -UA_UInt32 UA_Subscription_getNumMonitoredItems(UA_Subscription *sub) { return sub->numMonitoredItems; } - -static size_t countQueuedNotifications(UA_Subscription *sub, UA_Boolean *moreNotifications) { - if (!sub->publishingEnabled) return 0; - - size_t notifications = 0; - UA_MonitoredItem *mon; - LIST_FOREACH(mon, &sub->monitoredItems, listEntry) { - MonitoredItem_queuedValue *qv; - TAILQ_FOREACH(qv, &mon->queue, listEntry) { - if (notifications >= sub->notificationsPerPublish) { - *moreNotifications = true; - break; - } - ++notifications; - } - } - return notifications; -} - -static void UA_Subscription_addRetransmissionMessage(UA_Server *server, UA_Subscription *sub, - UA_NotificationMessageEntry *entry) { - /* Release the oldest entry if there is not enough space */ - if (server->config.maxRetransmissionQueueSize > 0 && - sub->retransmissionQueueSize >= server->config.maxRetransmissionQueueSize) { - UA_NotificationMessageEntry *lastentry = TAILQ_LAST(&sub->retransmissionQueue, ListOfNotificationMessages); - TAILQ_REMOVE(&sub->retransmissionQueue, lastentry, listEntry); - --sub->retransmissionQueueSize; - UA_NotificationMessage_deleteMembers(&lastentry->message); - UA_free(lastentry); - } - - /* Add entry */ - TAILQ_INSERT_HEAD(&sub->retransmissionQueue, entry, listEntry); - ++sub->retransmissionQueueSize; -} - -UA_StatusCode UA_Subscription_removeRetransmissionMessage(UA_Subscription *sub, UA_UInt32 sequenceNumber) { - /* Find the retransmission message */ - UA_NotificationMessageEntry *entry; - TAILQ_FOREACH(entry, &sub->retransmissionQueue, listEntry) { - if (entry->message.sequenceNumber == sequenceNumber) break; - } - if (!entry) return UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN; - - /* Remove the retransmission message */ - TAILQ_REMOVE(&sub->retransmissionQueue, entry, listEntry); - --sub->retransmissionQueueSize; - UA_NotificationMessage_deleteMembers(&entry->message); - UA_free(entry); - return UA_STATUSCODE_GOOD; -} - -static UA_MonitoredItem *selectFirstMonToIterate(UA_Subscription *sub) { - UA_MonitoredItem *mon = LIST_FIRST(&sub->monitoredItems); - if (sub->lastSendMonitoredItemId > 0) { - while (mon) { - if (mon->itemId == sub->lastSendMonitoredItemId) break; - mon = LIST_NEXT(mon, listEntry); - } - if (!mon) mon = LIST_FIRST(&sub->monitoredItems); - } - return mon; -} - -/* Iterate over the monitoreditems of the subscription, starting at mon, and - * move notifications into the response. */ -static void moveNotificationsFromMonitoredItems(UA_Subscription *sub, UA_MonitoredItem *mon, - UA_MonitoredItemNotification *mins, size_t minsSize, size_t *pos) { - MonitoredItem_queuedValue *qv, *qv_tmp; - while (mon) { - sub->lastSendMonitoredItemId = mon->itemId; - TAILQ_FOREACH_SAFE(qv, &mon->queue, listEntry, qv_tmp) { - if (*pos >= minsSize) return; - UA_MonitoredItemNotification *min = &mins[*pos]; - min->clientHandle = qv->clientHandle; - min->value = qv->value; - TAILQ_REMOVE(&mon->queue, qv, listEntry); - UA_free(qv); - --mon->currentQueueSize; - ++(*pos); - } - mon = LIST_NEXT(mon, listEntry); - } -} - -static UA_StatusCode prepareNotificationMessage(UA_Subscription *sub, UA_NotificationMessage *message, - size_t notifications) { - /* Array of ExtensionObject to hold different kinds of notifications - * (currently only DataChangeNotifications) */ - message->notificationData = UA_ExtensionObject_new(); - if (!message->notificationData) return UA_STATUSCODE_BADOUTOFMEMORY; - message->notificationDataSize = 1; - - /* Allocate Notification */ - UA_DataChangeNotification *dcn = UA_DataChangeNotification_new(); - if (!dcn) { - UA_NotificationMessage_deleteMembers(message); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - UA_ExtensionObject *data = message->notificationData; - data->encoding = UA_EXTENSIONOBJECT_DECODED; - data->content.decoded.data = dcn; - data->content.decoded.type = &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION]; - - /* Allocate array of notifications */ - dcn->monitoredItems = - (UA_MonitoredItemNotification *)UA_Array_new(notifications, &UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION]); - if (!dcn->monitoredItems) { - UA_NotificationMessage_deleteMembers(message); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - dcn->monitoredItemsSize = notifications; - - /* Move notifications into the response .. the point of no return */ - - /* Select the first monitoredItem or the first monitoreditem after the last - * that was processed. */ - UA_MonitoredItem *mon = selectFirstMonToIterate(sub); - - /* Move notifications into the response */ - size_t l = 0; - moveNotificationsFromMonitoredItems(sub, mon, dcn->monitoredItems, notifications, &l); - if (l < notifications) { - /* Not done. We skipped MonitoredItems. Restart at the beginning. */ - moveNotificationsFromMonitoredItems(sub, LIST_FIRST(&sub->monitoredItems), dcn->monitoredItems, notifications, &l); - } - - return UA_STATUSCODE_GOOD; -} - -void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub) { - UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | Publish Callback", sub->subscriptionID); - - /* Count the available notifications */ - UA_Boolean moreNotifications = false; - size_t notifications = countQueuedNotifications(sub, &moreNotifications); - - /* Return if nothing to do */ - if (notifications == 0) { - ++sub->currentKeepAliveCount; - if (sub->currentKeepAliveCount < sub->maxKeepAliveCount) return; - UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | Sending a KeepAlive", - sub->subscriptionID); - } - - /* Check if the securechannel is valid */ - UA_SecureChannel *channel = sub->session->channel; - if (!channel) return; - - /* Dequeue a response */ - UA_PublishResponseEntry *pre = UA_Session_getPublishReq(sub->session); - - /* Cannot publish without a response */ - if (!pre) { - UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, - "Subscription %u | Cannot send a publish " - "response since the publish queue is empty", - sub->subscriptionID); - if (sub->state != UA_SUBSCRIPTIONSTATE_LATE) { - sub->state = UA_SUBSCRIPTIONSTATE_LATE; - } else { - ++sub->currentLifetimeCount; - if (sub->currentLifetimeCount > sub->lifeTimeCount) { - UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, - "Subscription %u | End of lifetime " - "for subscription", - sub->subscriptionID); - UA_Session_deleteSubscription(server, sub->session, sub->subscriptionID); - } - } - return; - } - - UA_PublishResponse *response = &pre->response; - UA_NotificationMessage *message = &response->notificationMessage; - UA_NotificationMessageEntry *retransmission = NULL; - if (notifications > 0) { - /* Allocate the retransmission entry */ - retransmission = (UA_NotificationMessageEntry *)UA_malloc(sizeof(UA_NotificationMessageEntry)); - if (!retransmission) { - UA_LOG_WARNING_SESSION(server->config.logger, sub->session, - "Subscription %u | Could not allocate memory " - "for retransmission", - sub->subscriptionID); - return; - } - - /* Prepare the response */ - UA_StatusCode retval = prepareNotificationMessage(sub, message, notifications); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(server->config.logger, sub->session, - "Subscription %u | Could not prepare the " - "notification message", - sub->subscriptionID); - UA_free(retransmission); - return; - } - } - - /* <-- The point of no return --> */ - - /* Remove the response from the response queue */ - UA_Session_removePublishReq(sub->session, pre); - - /* Set up the response */ - response->responseHeader.timestamp = UA_DateTime_now(); - response->subscriptionId = sub->subscriptionID; - response->moreNotifications = moreNotifications; - message->publishTime = response->responseHeader.timestamp; - if (notifications == 0) { - /* Send sequence number for the next notification */ - message->sequenceNumber = sub->sequenceNumber + 1; - } else { - /* Increase the sequence number */ - message->sequenceNumber = ++sub->sequenceNumber; - - /* Put the notification message into the retransmission queue. This - * needs to be done here, so that the message itself is included in the - * available sequence numbers for acknowledgement. */ - retransmission->message = response->notificationMessage; - UA_Subscription_addRetransmissionMessage(server, sub, retransmission); - } - - /* Get the available sequence numbers from the retransmission queue */ - size_t available = sub->retransmissionQueueSize; - if (available > 0) { - response->availableSequenceNumbers = (UA_UInt32 *)UA_alloca(available * sizeof(UA_UInt32)); - response->availableSequenceNumbersSize = available; - size_t i = 0; - UA_NotificationMessageEntry *nme; - TAILQ_FOREACH(nme, &sub->retransmissionQueue, listEntry) { - response->availableSequenceNumbers[i] = nme->message.sequenceNumber; - ++i; - } - } - - /* Send the response */ - UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, - "Subscription %u | Sending out a publish response " - "with %u notifications", - sub->subscriptionID, (UA_UInt32)notifications); - UA_SecureChannel_sendSymmetricMessage(sub->session->channel, pre->requestId, UA_MESSAGETYPE_MSG, response, - &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]); - - /* Reset subscription state to normal. */ - sub->state = UA_SUBSCRIPTIONSTATE_NORMAL; - sub->currentKeepAliveCount = 0; - sub->currentLifetimeCount = 0; - - /* Free the response */ - UA_Array_delete(response->results, response->resultsSize, &UA_TYPES[UA_TYPES_UINT32]); - UA_free(pre); /* no need for UA_PublishResponse_deleteMembers */ - - if (!moreNotifications) { - /* All notifications were sent. The next time, just start at the first - * monitoreditem. */ - sub->lastSendMonitoredItemId = 0; - } else { - /* Repeat sending responses right away if there are more notifications - * to send */ - UA_Subscription_publishCallback(server, sub); - } -} - -UA_Boolean UA_Subscription_reachedPublishReqLimit(UA_Server *server, UA_Session *session) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Reached number of publish request limit"); - - /* Dequeue a response */ - UA_PublishResponseEntry *pre = UA_Session_getPublishReq(session); - - /* Cannot publish without a response */ - if (!pre) { - UA_LOG_FATAL_SESSION(server->config.logger, session, "No publish requests available"); - return false; - } - - UA_PublishResponse *response = &pre->response; - UA_NotificationMessage *message = &response->notificationMessage; - - /* <-- The point of no return --> */ - - /* Remove the response from the response queue */ - UA_Session_removePublishReq(session, pre); - - /* Set up the response. Note that this response has no related subscription id */ - response->responseHeader.timestamp = UA_DateTime_now(); - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS; - response->subscriptionId = 0; - response->moreNotifications = false; - message->publishTime = response->responseHeader.timestamp; - message->sequenceNumber = 0; - response->availableSequenceNumbersSize = 0; - - /* Send the response */ - UA_LOG_DEBUG_SESSION(server->config.logger, session, - "Sending out a publish response triggered by too many publish requests"); - UA_SecureChannel_sendSymmetricMessage(session->channel, pre->requestId, UA_MESSAGETYPE_MSG, response, - &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]); - - /* Free the response */ - UA_Array_delete(response->results, response->resultsSize, &UA_TYPES[UA_TYPES_UINT32]); - UA_free(pre); /* no need for UA_PublishResponse_deleteMembers */ - - return true; -} - -UA_StatusCode Subscription_registerPublishCallback(UA_Server *server, UA_Subscription *sub) { - UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, - "Subscription %u | Register subscription " - "publishing callback", - sub->subscriptionID); - - if (sub->publishCallbackIsRegistered) return UA_STATUSCODE_GOOD; - - UA_StatusCode retval = UA_Server_addRepeatedCallback(server, (UA_ServerCallback)UA_Subscription_publishCallback, sub, - (UA_UInt32)sub->publishingInterval, &sub->publishCallbackId); - if (retval != UA_STATUSCODE_GOOD) return retval; - - sub->publishCallbackIsRegistered = true; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode Subscription_unregisterPublishCallback(UA_Server *server, UA_Subscription *sub) { - UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, - "Subscription %u | Unregister subscription " - "publishing callback", - sub->subscriptionID); - - if (!sub->publishCallbackIsRegistered) return UA_STATUSCODE_GOOD; - - UA_StatusCode retval = UA_Server_removeRepeatedCallback(server, sub->publishCallbackId); - if (retval != UA_STATUSCODE_GOOD) return retval; - - sub->publishCallbackIsRegistered = false; - return UA_STATUSCODE_GOOD; -} - -/* When the session has publish requests stored but the last subscription is - * deleted... Send out empty responses */ -void UA_Subscription_answerPublishRequestsNoSubscription(UA_Server *server, UA_Session *session) { - /* No session or there are remaining subscriptions */ - if (!session || LIST_FIRST(&session->serverSubscriptions)) return; - - /* Send a response for every queued request */ - UA_PublishResponseEntry *pre; - while ((pre = UA_Session_getPublishReq(session))) { - UA_Session_removePublishReq(session, pre); - UA_PublishResponse *response = &pre->response; - response->responseHeader.serviceResult = UA_STATUSCODE_BADNOSUBSCRIPTION; - response->responseHeader.timestamp = UA_DateTime_now(); - UA_SecureChannel_sendSymmetricMessage(session->channel, pre->requestId, UA_MESSAGETYPE_MSG, response, - &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]); - UA_PublishResponse_deleteMembers(response); - UA_free(pre); - } -} - -#endif /* UA_ENABLE_SUBSCRIPTIONS */ - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_subscription_datachange.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */ - -#define UA_VALUENCODING_MAXSTACK 512 - -UA_MonitoredItem *UA_MonitoredItem_new(void) { - /* Allocate the memory */ - UA_MonitoredItem *newItem = (UA_MonitoredItem *)UA_calloc(1, sizeof(UA_MonitoredItem)); - if (!newItem) return NULL; - - /* Remaining members are covered by calloc zeroing out the memory */ - newItem->monitoredItemType = UA_MONITOREDITEMTYPE_CHANGENOTIFY; /* currently hardcoded */ - newItem->timestampsToReturn = UA_TIMESTAMPSTORETURN_SOURCE; - TAILQ_INIT(&newItem->queue); - return newItem; -} - -void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem) { - /* Remove the sampling callback */ - MonitoredItem_unregisterSampleCallback(server, monitoredItem); - - /* Clear the queued samples */ - MonitoredItem_queuedValue *val, *val_tmp; - TAILQ_FOREACH_SAFE(val, &monitoredItem->queue, listEntry, val_tmp) { - TAILQ_REMOVE(&monitoredItem->queue, val, listEntry); - UA_DataValue_deleteMembers(&val->value); - UA_free(val); - } - monitoredItem->currentQueueSize = 0; - - /* Remove the monitored item */ - LIST_REMOVE(monitoredItem, listEntry); - UA_String_deleteMembers(&monitoredItem->indexRange); - UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue); - UA_NodeId_deleteMembers(&monitoredItem->monitoredNodeId); - UA_free(monitoredItem); // TODO: Use a delayed free -} - -static void ensureSpaceInMonitoredItemQueue(UA_MonitoredItem *mon) { - /* Enough space, nothing to do here */ - if (mon->currentQueueSize < mon->maxQueueSize) return; - - /* Get the item to remove */ - MonitoredItem_queuedValue *queueItem; - if (mon->discardOldest) - queueItem = TAILQ_FIRST(&mon->queue); - else - queueItem = TAILQ_LAST(&mon->queue, QueuedValueQueue); - UA_assert(queueItem); - - /* Remove the item */ - TAILQ_REMOVE(&mon->queue, queueItem, listEntry); - UA_DataValue_deleteMembers(&queueItem->value); - UA_free(queueItem); - --mon->currentQueueSize; -} - -/* Errors are returned as no change detected */ -static UA_Boolean detectValueChangeWithFilter(UA_MonitoredItem *mon, UA_DataValue *value, UA_ByteString *encoding) { - /* Encode the data for comparison */ - size_t binsize = UA_calcSizeBinary(value, &UA_TYPES[UA_TYPES_DATAVALUE]); - if (binsize == 0) return false; - - /* Allocate buffer on the heap if necessary */ - if (binsize > UA_VALUENCODING_MAXSTACK && UA_ByteString_allocBuffer(encoding, binsize) != UA_STATUSCODE_GOOD) - return false; - - /* Encode the value */ - UA_Byte *bufPos = encoding->data; - const UA_Byte *bufEnd = &encoding->data[encoding->length]; - UA_StatusCode retval = UA_encodeBinary(value, &UA_TYPES[UA_TYPES_DATAVALUE], &bufPos, &bufEnd, NULL, NULL); - if (retval != UA_STATUSCODE_GOOD) return false; - - /* The value has changed */ - encoding->length = (uintptr_t)bufPos - (uintptr_t)encoding->data; - return !mon->lastSampledValue.data || !UA_String_equal(encoding, &mon->lastSampledValue); -} - -/* Has this sample changed from the last one? The method may allocate additional - * space for the encoding buffer. Detect the change in encoding->data. */ -static UA_Boolean detectValueChange(UA_MonitoredItem *mon, UA_DataValue *value, UA_ByteString *encoding) { - /* Apply Filter */ - UA_Boolean hasValue = value->hasValue; - if (mon->trigger == UA_DATACHANGETRIGGER_STATUS) value->hasValue = false; - - UA_Boolean hasServerTimestamp = value->hasServerTimestamp; - UA_Boolean hasServerPicoseconds = value->hasServerPicoseconds; - value->hasServerTimestamp = false; - value->hasServerPicoseconds = false; - - UA_Boolean hasSourceTimestamp = value->hasSourceTimestamp; - UA_Boolean hasSourcePicoseconds = value->hasSourcePicoseconds; - if (mon->trigger < UA_DATACHANGETRIGGER_STATUSVALUETIMESTAMP) { - value->hasSourceTimestamp = false; - value->hasSourcePicoseconds = false; - } - - /* Detect the Value Change */ - UA_Boolean res = detectValueChangeWithFilter(mon, value, encoding); - - /* Reset the filter */ - value->hasValue = hasValue; - value->hasServerTimestamp = hasServerTimestamp; - value->hasServerPicoseconds = hasServerPicoseconds; - value->hasSourceTimestamp = hasSourceTimestamp; - value->hasSourcePicoseconds = hasSourcePicoseconds; - return res; -} - -/* Returns whether a new sample was created */ -static UA_Boolean sampleCallbackWithValue(UA_Server *server, UA_Subscription *sub, UA_MonitoredItem *monitoredItem, - UA_DataValue *value, UA_ByteString *valueEncoding) { - /* Store the pointer to the stack-allocated bytestring to see if a heap-allocation - * was necessary */ - UA_Byte *stackValueEncoding = valueEncoding->data; - - /* Has the value changed? */ - UA_Boolean changed = detectValueChange(monitoredItem, value, valueEncoding); - if (!changed) return false; - - /* Allocate the entry for the publish queue */ - MonitoredItem_queuedValue *newQueueItem = (MonitoredItem_queuedValue *)UA_malloc(sizeof(MonitoredItem_queuedValue)); - if (!newQueueItem) { - UA_LOG_WARNING_SESSION(server->config.logger, sub->session, - "Subscription %u | MonitoredItem %i | " - "Item for the publishing queue could not be allocated", - sub->subscriptionID, monitoredItem->itemId); - return false; - } - - /* Copy valueEncoding on the heap for the next comparison (if not already done) */ - if (valueEncoding->data == stackValueEncoding) { - UA_ByteString cbs; - if (UA_ByteString_copy(valueEncoding, &cbs) != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(server->config.logger, sub->session, - "Subscription %u | MonitoredItem %i | " - "ByteString to compare values could not be created", - sub->subscriptionID, monitoredItem->itemId); - UA_free(newQueueItem); - return false; - } - *valueEncoding = cbs; - } - - /* Prepare the newQueueItem */ - if (value->hasValue && value->value.storageType == UA_VARIANT_DATA_NODELETE) { - /* Make a deep copy of the value */ - UA_StatusCode retval = UA_DataValue_copy(value, &newQueueItem->value); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING_SESSION(server->config.logger, sub->session, - "Subscription %u | MonitoredItem %i | " - "Item for the publishing queue could not be prepared", - sub->subscriptionID, monitoredItem->itemId); - UA_free(newQueueItem); - return false; - } - } else { - newQueueItem->value = *value; /* Just copy the value and do not release it */ - } - newQueueItem->clientHandle = monitoredItem->clientHandle; - - /* <-- Point of no return --> */ - - UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | MonitoredItem %u | Sampled a new value", - sub->subscriptionID, monitoredItem->itemId); - - /* Replace the encoding for comparison */ - UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue); - monitoredItem->lastSampledValue = *valueEncoding; - - /* Add the sample to the queue for publication */ - ensureSpaceInMonitoredItemQueue(monitoredItem); - TAILQ_INSERT_TAIL(&monitoredItem->queue, newQueueItem, listEntry); - ++monitoredItem->currentQueueSize; - return true; - ; -} - -void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem) { - UA_Subscription *sub = monitoredItem->subscription; - if (monitoredItem->monitoredItemType != UA_MONITOREDITEMTYPE_CHANGENOTIFY) { - UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, - "Subscription %u | MonitoredItem %i | " - "Not a data change notification", - sub->subscriptionID, monitoredItem->itemId); - return; - } - - /* Read the value */ - UA_ReadValueId rvid; - UA_ReadValueId_init(&rvid); - rvid.nodeId = monitoredItem->monitoredNodeId; - rvid.attributeId = monitoredItem->attributeID; - rvid.indexRange = monitoredItem->indexRange; - UA_DataValue value = UA_Server_readWithSession(server, sub->session, &rvid, monitoredItem->timestampsToReturn); - - /* Stack-allocate some memory for the value encoding. We might heap-allocate - * more memory if needed. This is just enough for scalars and small - * structures. */ - UA_Byte *stackValueEncoding = (UA_Byte *)UA_alloca(UA_VALUENCODING_MAXSTACK); - UA_ByteString valueEncoding; - valueEncoding.data = stackValueEncoding; - valueEncoding.length = UA_VALUENCODING_MAXSTACK; - - /* Create a sample and compare with the last value */ - UA_Boolean newNotification = sampleCallbackWithValue(server, sub, monitoredItem, &value, &valueEncoding); - - /* Clean up */ - if (!newNotification) { - if (valueEncoding.data != stackValueEncoding) UA_ByteString_deleteMembers(&valueEncoding); - UA_DataValue_deleteMembers(&value); - } -} - -UA_StatusCode MonitoredItem_registerSampleCallback(UA_Server *server, UA_MonitoredItem *mon) { - UA_StatusCode retval = UA_Server_addRepeatedCallback(server, (UA_ServerCallback)UA_MoniteredItem_SampleCallback, mon, - (UA_UInt32)mon->samplingInterval, &mon->sampleCallbackId); - if (retval == UA_STATUSCODE_GOOD) mon->sampleCallbackIsRegistered = true; - return retval; -} - -UA_StatusCode MonitoredItem_unregisterSampleCallback(UA_Server *server, UA_MonitoredItem *mon) { - if (!mon->sampleCallbackIsRegistered) return UA_STATUSCODE_GOOD; - mon->sampleCallbackIsRegistered = false; - return UA_Server_removeRepeatedCallback(server, mon->sampleCallbackId); -} - -#endif /* UA_ENABLE_SUBSCRIPTIONS */ - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_services_view.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* Target node on top of the stack */ -static UA_StatusCode fillReferenceDescription(UA_Server *server, const UA_Node *curr, const UA_NodeReferenceKind *ref, - UA_UInt32 mask, UA_ReferenceDescription *descr) { - UA_ReferenceDescription_init(descr); - UA_StatusCode retval = UA_NodeId_copy(&curr->nodeId, &descr->nodeId.nodeId); - if (mask & UA_BROWSERESULTMASK_REFERENCETYPEID) - retval |= UA_NodeId_copy(&ref->referenceTypeId, &descr->referenceTypeId); - if (mask & UA_BROWSERESULTMASK_ISFORWARD) descr->isForward = !ref->isInverse; - if (mask & UA_BROWSERESULTMASK_NODECLASS) retval |= UA_NodeClass_copy(&curr->nodeClass, &descr->nodeClass); - if (mask & UA_BROWSERESULTMASK_BROWSENAME) retval |= UA_QualifiedName_copy(&curr->browseName, &descr->browseName); - if (mask & UA_BROWSERESULTMASK_DISPLAYNAME) retval |= UA_LocalizedText_copy(&curr->displayName, &descr->displayName); - if (mask & UA_BROWSERESULTMASK_TYPEDEFINITION) { - if (curr->nodeClass == UA_NODECLASS_OBJECT || curr->nodeClass == UA_NODECLASS_VARIABLE) { - const UA_Node *type = getNodeType(server, curr); - if (type) { - retval |= UA_NodeId_copy(&type->nodeId, &descr->typeDefinition.nodeId); - UA_Nodestore_release(server, type); - } - } - } - return retval; -} - -static void removeCp(ContinuationPointEntry *cp, UA_Session *session) { - LIST_REMOVE(cp, pointers); - UA_ByteString_deleteMembers(&cp->identifier); - UA_BrowseDescription_deleteMembers(&cp->browseDescription); - UA_free(cp); - ++session->availableContinuationPoints; -} - -static UA_Boolean relevantReference(UA_Server *server, UA_Boolean includeSubtypes, const UA_NodeId *rootRef, - const UA_NodeId *testRef) { - if (!includeSubtypes) return UA_NodeId_equal(rootRef, testRef); - - const UA_NodeId hasSubType = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE); - return isNodeInTree(&server->config.nodestore, testRef, rootRef, &hasSubType, 1); -} - -/* Returns whether the node / continuationpoint is done */ -static UA_Boolean browseReferences(UA_Server *server, const UA_Node *node, const UA_BrowseDescription *descr, - UA_BrowseResult *result, ContinuationPointEntry *cp) { - UA_assert(cp != NULL); - - /* If the node has no references, just return */ - if (node->referencesSize == 0) { - result->referencesSize = 0; - return true; - ; - } - - /* Follow all references? */ - UA_Boolean browseAll = UA_NodeId_isNull(&descr->referenceTypeId); - - /* How many references can we return at most? */ - size_t maxrefs = cp->maxReferences; - if (maxrefs == 0) { - if (server->config.maxReferencesPerNode != 0) { - maxrefs = server->config.maxReferencesPerNode; - } else { - maxrefs = UA_INT32_MAX; - } - } else { - if (server->config.maxReferencesPerNode != 0 && maxrefs > server->config.maxReferencesPerNode) { - maxrefs = server->config.maxReferencesPerNode; - } - } - - /* Allocate the results array */ - size_t refs_size = 2; /* True size of the array */ - result->references = (UA_ReferenceDescription *)UA_Array_new(refs_size, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]); - if (!result->references) { - result->statusCode = UA_STATUSCODE_BADOUTOFMEMORY; - return false; - } - - size_t referenceKindIndex = cp->referenceKindIndex; - size_t targetIndex = cp->targetIndex; - - /* Loop over the node's references */ - for (; referenceKindIndex < node->referencesSize; ++referenceKindIndex) { - UA_NodeReferenceKind *rk = &node->references[referenceKindIndex]; - - /* Reference in the right direction? */ - if (rk->isInverse && descr->browseDirection == UA_BROWSEDIRECTION_FORWARD) continue; - if (!rk->isInverse && descr->browseDirection == UA_BROWSEDIRECTION_INVERSE) continue; - - /* Is the reference part of the hierarchy of references we look for? */ - if (!browseAll && !relevantReference(server, descr->includeSubtypes, &descr->referenceTypeId, &rk->referenceTypeId)) - continue; - - /* Loop over the targets */ - for (; targetIndex < rk->targetIdsSize; ++targetIndex) { - /* Get the node */ - const UA_Node *target = UA_Nodestore_get(server, &rk->targetIds[targetIndex].nodeId); - if (!target) continue; - - /* Test if the node class matches */ - if (descr->nodeClassMask != 0 && (target->nodeClass & descr->nodeClassMask) == 0) { - UA_Nodestore_release(server, target); - continue; - } - - /* A match! Can we return it? */ - if (result->referencesSize >= maxrefs) { - /* There are references we could not return */ - cp->referenceKindIndex = referenceKindIndex; - cp->targetIndex = targetIndex; - UA_Nodestore_release(server, target); - return false; - } - - /* Make enough space in the array */ - if (result->referencesSize >= refs_size) { - refs_size *= 2; - if (refs_size > maxrefs) refs_size = maxrefs; - UA_ReferenceDescription *rd = - (UA_ReferenceDescription *)UA_realloc(result->references, sizeof(UA_ReferenceDescription) * refs_size); - if (!rd) { - result->statusCode = UA_STATUSCODE_BADOUTOFMEMORY; - UA_Nodestore_release(server, target); - goto error_recovery; - } - result->references = rd; - } - - /* Copy the node description. Target is on top of the stack */ - result->statusCode = - fillReferenceDescription(server, target, rk, descr->resultMask, &result->references[result->referencesSize]); - - UA_Nodestore_release(server, target); - - if (result->statusCode != UA_STATUSCODE_GOOD) goto error_recovery; - - /* Increase the counter */ - result->referencesSize++; - } - - targetIndex = 0; /* Start at index 0 for the next reference kind */ - } - - /* No relevant references, return array of length zero */ - if (result->referencesSize == 0) { - UA_free(result->references); - result->references = (UA_ReferenceDescription *)UA_EMPTY_ARRAY_SENTINEL; - } - - /* The node is done */ - return true; - -error_recovery: - if (result->referencesSize == 0) - UA_free(result->references); - else - UA_Array_delete(result->references, result->referencesSize, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]); - result->references = NULL; - result->referencesSize = 0; - return false; -} - -/* Results for a single browsedescription. This is the inner loop for both - * Browse and BrowseNext - * - * @param session Session to save continuationpoints - * @param ns The nodstore where the to-be-browsed node can be found - * @param cp If cp is not null, we continue from here If cp is null, we can add - * a new continuation point if possible and necessary. - * @param descr If no cp is set, we take the browsedescription from there - * @param maxrefs The maximum number of references the client has requested. If 0, - * all matching references are returned at once. - * @param result The entry in the request */ -void Service_Browse_single(UA_Server *server, UA_Session *session, ContinuationPointEntry *cp, - const UA_BrowseDescription *descr, UA_UInt32 maxrefs, UA_BrowseResult *result) { - ContinuationPointEntry *internal_cp = cp; - if (!internal_cp) { - /* If there is no continuation point, stack-allocate one. It gets copied - * on the heap when this is required at a later point. */ - internal_cp = (ContinuationPointEntry *)UA_alloca(sizeof(ContinuationPointEntry)); - memset(internal_cp, 0, sizeof(ContinuationPointEntry)); - internal_cp->maxReferences = maxrefs; - } else { - /* Set the browsedescription if a cp is given */ - descr = &cp->browseDescription; - } - - /* Is the browsedirection valid? */ - if (descr->browseDirection != UA_BROWSEDIRECTION_BOTH && descr->browseDirection != UA_BROWSEDIRECTION_FORWARD && - descr->browseDirection != UA_BROWSEDIRECTION_INVERSE) { - result->statusCode = UA_STATUSCODE_BADBROWSEDIRECTIONINVALID; - return; - } - - /* Is the reference type valid? */ - if (!UA_NodeId_isNull(&descr->referenceTypeId)) { - const UA_Node *reftype = UA_Nodestore_get(server, &descr->referenceTypeId); - if (!reftype) { - result->statusCode = UA_STATUSCODE_BADREFERENCETYPEIDINVALID; - return; - } - - UA_Boolean isRef = (reftype->nodeClass == UA_NODECLASS_REFERENCETYPE); - UA_Nodestore_release(server, reftype); - - if (!isRef) { - result->statusCode = UA_STATUSCODE_BADREFERENCETYPEIDINVALID; - return; - } - } - - const UA_Node *node = UA_Nodestore_get(server, &descr->nodeId); - if (!node) { - result->statusCode = UA_STATUSCODE_BADNODEIDUNKNOWN; - return; - } - - /* Browse the references */ - UA_Boolean done = browseReferences(server, node, descr, result, internal_cp); - - UA_Nodestore_release(server, node); - - /* Exit early if an error occurred */ - if (result->statusCode != UA_STATUSCODE_GOOD) return; - - /* A continuation point exists already */ - if (cp) { - if (done) { - removeCp(cp, session); /* All done, remove a finished continuationPoint */ - } else { - /* Return the cp identifier */ - UA_ByteString_copy(&cp->identifier, &result->continuationPoint); - } - return; - } - - /* Create a new continuation point */ - if (!done) { - if (session->availableContinuationPoints <= 0 || - !(cp = (ContinuationPointEntry *)UA_malloc(sizeof(ContinuationPointEntry)))) { - result->statusCode = UA_STATUSCODE_BADNOCONTINUATIONPOINTS; - return; - } - UA_BrowseDescription_copy(descr, &cp->browseDescription); - cp->referenceKindIndex = internal_cp->referenceKindIndex; - cp->targetIndex = internal_cp->targetIndex; - cp->maxReferences = internal_cp->maxReferences; - - /* Create a random bytestring via a Guid */ - UA_Guid *ident = UA_Guid_new(); - *ident = UA_Guid_random(); - cp->identifier.data = (UA_Byte *)ident; - cp->identifier.length = sizeof(UA_Guid); - - /* Return the cp identifier */ - UA_ByteString_copy(&cp->identifier, &result->continuationPoint); - - /* Attach the cp to the session */ - LIST_INSERT_HEAD(&session->continuationPoints, cp, pointers); - --session->availableContinuationPoints; - } -} - -void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request, - UA_BrowseResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing BrowseRequest"); - - if (!UA_NodeId_isNull(&request->view.viewId)) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADVIEWIDUNKNOWN; - return; - } - - if (request->nodesToBrowseSize <= 0) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO; - return; - } - - if (server->config.maxNodesPerBrowse != 0 && request->nodesToBrowseSize > server->config.maxNodesPerBrowse) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - size_t size = request->nodesToBrowseSize; - response->results = (UA_BrowseResult *)UA_Array_new(size, &UA_TYPES[UA_TYPES_BROWSERESULT]); - if (!response->results) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - response->resultsSize = size; - - for (size_t i = 0; i < size; ++i) - Service_Browse_single(server, session, NULL, &request->nodesToBrowse[i], request->requestedMaxReferencesPerNode, - &response->results[i]); -} - -UA_BrowseResult UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, const UA_BrowseDescription *descr) { - UA_BrowseResult result; - UA_BrowseResult_init(&result); - Service_Browse_single(server, &adminSession, NULL, descr, maxrefs, &result); - return result; -} - -/* Thread-local variables to pass additional arguments into the operation */ -static UA_THREAD_LOCAL UA_Boolean op_releaseContinuationPoint; - -static void Operation_BrowseNext(UA_Server *server, UA_Session *session, const UA_ByteString *continuationPoint, - UA_BrowseResult *result) { - /* Find the continuation point */ - ContinuationPointEntry *cp; - LIST_FOREACH(cp, &session->continuationPoints, pointers) { - if (UA_ByteString_equal(&cp->identifier, continuationPoint)) break; - } - if (!cp) { - result->statusCode = UA_STATUSCODE_BADCONTINUATIONPOINTINVALID; - return; - } - - /* Do the work */ - if (!op_releaseContinuationPoint) - Service_Browse_single(server, session, cp, NULL, 0, result); - else - removeCp(cp, session); -} - -void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request, - UA_BrowseNextResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing BrowseNextRequest"); - - op_releaseContinuationPoint = request->releaseContinuationPoints; - - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)Operation_BrowseNext, &request->continuationPointsSize, - &UA_TYPES[UA_TYPES_BYTESTRING], &response->resultsSize, &UA_TYPES[UA_TYPES_BROWSERESULT]); -} - -UA_BrowseResult UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint, - const UA_ByteString *continuationPoint) { - UA_BrowseResult result; - UA_BrowseResult_init(&result); - op_releaseContinuationPoint = releaseContinuationPoint; - Operation_BrowseNext(server, &adminSession, continuationPoint, &result); - return result; -} - -/***********************/ -/* TranslateBrowsePath */ -/***********************/ - -static void walkBrowsePathElementReferenceTargets(UA_BrowsePathResult *result, size_t *targetsSize, UA_NodeId **next, - size_t *nextSize, size_t *nextCount, UA_UInt32 elemDepth, - const UA_NodeReferenceKind *rk) { - /* Loop over the targets */ - for (size_t i = 0; i < rk->targetIdsSize; i++) { - UA_ExpandedNodeId *targetId = &rk->targetIds[i]; - - /* Does the reference point to an external server? Then add to the - * targets with the right path depth. */ - if (targetId->serverIndex != 0) { - UA_BrowsePathTarget *tempTargets = - (UA_BrowsePathTarget *)UA_realloc(result->targets, sizeof(UA_BrowsePathTarget) * (*targetsSize) * 2); - if (!tempTargets) { - result->statusCode = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - result->targets = tempTargets; - (*targetsSize) *= 2; - result->statusCode = UA_ExpandedNodeId_copy(targetId, &result->targets[result->targetsSize].targetId); - result->targets[result->targetsSize].remainingPathIndex = elemDepth; - continue; - } - - /* Can we store the node in the array of candidates for deep-search? */ - if (*nextSize <= *nextCount) { - UA_NodeId *tempNext = (UA_NodeId *)UA_realloc(*next, sizeof(UA_NodeId) * (*nextSize) * 2); - if (!tempNext) { - result->statusCode = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - *next = tempNext; - (*nextSize) *= 2; - } - - /* Add the node to the next array for the following path element */ - result->statusCode = UA_NodeId_copy(&targetId->nodeId, &(*next)[*nextCount]); - if (result->statusCode != UA_STATUSCODE_GOOD) return; - ++(*nextCount); - } -} - -static void walkBrowsePathElement(UA_Server *server, UA_Session *session, UA_BrowsePathResult *result, - size_t *targetsSize, const UA_RelativePathElement *elem, UA_UInt32 elemDepth, - const UA_QualifiedName *targetName, const UA_NodeId *current, - const size_t currentCount, UA_NodeId **next, size_t *nextSize, size_t *nextCount) { - /* Return all references? */ - UA_Boolean all_refs = UA_NodeId_isNull(&elem->referenceTypeId); - if (!all_refs) { - const UA_Node *rootRef = UA_Nodestore_get(server, &elem->referenceTypeId); - if (!rootRef) return; - UA_Boolean match = (rootRef->nodeClass == UA_NODECLASS_REFERENCETYPE); - UA_Nodestore_release(server, rootRef); - if (!match) return; - } - - /* Iterate over all nodes at the current depth-level */ - for (size_t i = 0; i < currentCount; ++i) { - /* Get the node */ - const UA_Node *node = UA_Nodestore_get(server, ¤t[i]); - if (!node) { - /* If we cannot find the node at depth 0, the starting node does not exist */ - if (elemDepth == 0) result->statusCode = UA_STATUSCODE_BADNODEIDUNKNOWN; - continue; - } - - /* Test whether the current node has the target name required in the - * previous path element */ - if (targetName && (targetName->namespaceIndex != node->browseName.namespaceIndex || - !UA_String_equal(&targetName->name, &node->browseName.name))) { - UA_Nodestore_release(server, node); - continue; - } - - /* Loop over the nodes references */ - for (size_t r = 0; r < node->referencesSize && result->statusCode == UA_STATUSCODE_GOOD; ++r) { - UA_NodeReferenceKind *rk = &node->references[r]; - - /* Does the direction of the reference match? */ - if (rk->isInverse != elem->isInverse) continue; - - /* Is the node relevant? */ - if (!all_refs && !relevantReference(server, elem->includeSubtypes, &elem->referenceTypeId, &rk->referenceTypeId)) - continue; - - /* Walk over the reference targets */ - walkBrowsePathElementReferenceTargets(result, targetsSize, next, nextSize, nextCount, elemDepth, rk); - } - - UA_Nodestore_release(server, node); - } -} - -/* This assumes that result->targets has enough room for all currentCount elements */ -static void addBrowsePathTargets(UA_Server *server, UA_Session *session, UA_BrowsePathResult *result, - const UA_QualifiedName *targetName, UA_NodeId *current, size_t currentCount) { - for (size_t i = 0; i < currentCount; i++) { - const UA_Node *node = UA_Nodestore_get(server, ¤t[i]); - if (!node) { - UA_NodeId_deleteMembers(¤t[i]); - continue; - } - - /* Test whether the current node has the target name required in the - * previous path element */ - UA_Boolean valid = targetName->namespaceIndex == node->browseName.namespaceIndex && - UA_String_equal(&targetName->name, &node->browseName.name); - - UA_Nodestore_release(server, node); - - if (!valid) { - UA_NodeId_deleteMembers(¤t[i]); - continue; - } - - /* Move the nodeid to the target array */ - UA_BrowsePathTarget_init(&result->targets[result->targetsSize]); - result->targets[result->targetsSize].targetId.nodeId = current[i]; - result->targets[result->targetsSize].remainingPathIndex = UA_UINT32_MAX; - ++result->targetsSize; - } -} - -static void walkBrowsePath(UA_Server *server, UA_Session *session, const UA_BrowsePath *path, - UA_BrowsePathResult *result, size_t targetsSize, UA_NodeId **current, size_t *currentSize, - size_t *currentCount, UA_NodeId **next, size_t *nextSize, size_t *nextCount) { - UA_assert(*currentCount == 1); - UA_assert(*nextCount == 0); - - /* Points to the targetName of the _previous_ path element */ - const UA_QualifiedName *targetName = NULL; - - /* Iterate over path elements */ - UA_assert(path->relativePath.elementsSize > 0); - for (UA_UInt32 i = 0; i < path->relativePath.elementsSize; ++i) { - walkBrowsePathElement(server, session, result, &targetsSize, &path->relativePath.elements[i], i, targetName, - *current, *currentCount, next, nextSize, nextCount); - - /* Clean members of current */ - for (size_t j = 0; j < *currentCount; j++) UA_NodeId_deleteMembers(&(*current)[j]); - *currentCount = 0; - - /* When no targets are left or an error occurred. None of next's - * elements will be copied to result->targets */ - if (*nextCount == 0 || result->statusCode != UA_STATUSCODE_GOOD) { - UA_assert(*currentCount == 0); - UA_assert(*nextCount == 0); - return; - } - - /* Exchange current and next for the next depth */ - size_t tSize = *currentSize; - size_t tCount = *currentCount; - UA_NodeId *tT = *current; - *currentSize = *nextSize; - *currentCount = *nextCount; - *current = *next; - *nextSize = tSize; - *nextCount = tCount; - *next = tT; - - /* Store the target name of the previous path element */ - targetName = &path->relativePath.elements[i].targetName; - } - - UA_assert(targetName != NULL); - UA_assert(*nextCount == 0); - - /* After the last BrowsePathElement, move members from current to the - * result targets */ - - /* Realloc if more space is needed */ - if (targetsSize < result->targetsSize + (*currentCount)) { - UA_BrowsePathTarget *newTargets = (UA_BrowsePathTarget *)UA_realloc( - result->targets, sizeof(UA_BrowsePathTarget) * (result->targetsSize + (*currentCount))); - if (!newTargets) { - result->statusCode = UA_STATUSCODE_BADOUTOFMEMORY; - for (size_t i = 0; i < *currentCount; ++i) UA_NodeId_deleteMembers(&(*current)[i]); - *currentCount = 0; - return; - } - result->targets = newTargets; - } - - /* Move the elements of current to the targets */ - addBrowsePathTargets(server, session, result, targetName, *current, *currentCount); - *currentCount = 0; -} - -static void Operation_TranslateBrowsePathToNodeIds(UA_Server *server, UA_Session *session, const UA_BrowsePath *path, - UA_BrowsePathResult *result) { - if (path->relativePath.elementsSize <= 0) { - result->statusCode = UA_STATUSCODE_BADNOTHINGTODO; - return; - } - - /* RelativePath elements must not have an empty targetName */ - for (size_t i = 0; i < path->relativePath.elementsSize; ++i) { - if (UA_QualifiedName_isNull(&path->relativePath.elements[i].targetName)) { - result->statusCode = UA_STATUSCODE_BADBROWSENAMEINVALID; - return; - } - } - - /* Allocate memory for the targets */ - size_t targetsSize = 10; /* When to realloc; the member count is stored in - * result->targetsSize */ - result->targets = (UA_BrowsePathTarget *)UA_malloc(sizeof(UA_BrowsePathTarget) * targetsSize); - if (!result->targets) { - result->statusCode = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - - /* Allocate memory for two temporary arrays. One with the results for the - * previous depth of the path. The other for the new results at the current - * depth. The two arrays alternate as we descend down the tree. */ - size_t currentSize = 10; /* When to realloc */ - size_t currentCount = 0; /* Current elements */ - UA_NodeId *current = (UA_NodeId *)UA_malloc(sizeof(UA_NodeId) * currentSize); - if (!current) { - result->statusCode = UA_STATUSCODE_BADOUTOFMEMORY; - UA_free(result->targets); - return; - } - size_t nextSize = 10; /* When to realloc */ - size_t nextCount = 0; /* Current elements */ - UA_NodeId *next = (UA_NodeId *)UA_malloc(sizeof(UA_NodeId) * nextSize); - if (!next) { - result->statusCode = UA_STATUSCODE_BADOUTOFMEMORY; - UA_free(result->targets); - UA_free(current); - return; - } - - /* Copy the starting node into current */ - result->statusCode = UA_NodeId_copy(&path->startingNode, ¤t[0]); - if (result->statusCode != UA_STATUSCODE_GOOD) { - UA_free(result->targets); - UA_free(current); - UA_free(next); - return; - } - currentCount = 1; - - /* Walk the path elements */ - walkBrowsePath(server, session, path, result, targetsSize, ¤t, ¤tSize, ¤tCount, &next, &nextSize, - &nextCount); - - UA_assert(currentCount == 0); - UA_assert(nextCount == 0); - - /* No results => BadNoMatch status code */ - if (result->targetsSize == 0 && result->statusCode == UA_STATUSCODE_GOOD) - result->statusCode = UA_STATUSCODE_BADNOMATCH; - - /* Clean up the temporary arrays and the targets */ - UA_free(current); - UA_free(next); - if (result->statusCode != UA_STATUSCODE_GOOD) { - for (size_t i = 0; i < result->targetsSize; ++i) UA_BrowsePathTarget_deleteMembers(&result->targets[i]); - UA_free(result->targets); - result->targets = NULL; - result->targetsSize = 0; - } -} - -UA_BrowsePathResult UA_Server_translateBrowsePathToNodeIds(UA_Server *server, const UA_BrowsePath *browsePath) { - UA_BrowsePathResult result; - UA_BrowsePathResult_init(&result); - Operation_TranslateBrowsePathToNodeIds(server, &adminSession, browsePath, &result); - return result; -} - -void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session, - const UA_TranslateBrowsePathsToNodeIdsRequest *request, - UA_TranslateBrowsePathsToNodeIdsResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing TranslateBrowsePathsToNodeIdsRequest"); - - if (server->config.maxNodesPerTranslateBrowsePathsToNodeIds != 0 && - request->browsePathsSize > server->config.maxNodesPerTranslateBrowsePathsToNodeIds) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)Operation_TranslateBrowsePathToNodeIds, &request->browsePathsSize, - &UA_TYPES[UA_TYPES_BROWSEPATH], &response->resultsSize, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT]); -} - -void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request, - UA_RegisterNodesResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RegisterNodesRequest"); - - // TODO: hang the nodeids to the session if really needed - if (request->nodesToRegisterSize == 0) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO; - return; - } - - if (server->config.maxNodesPerRegisterNodes != 0 && - request->nodesToRegisterSize > server->config.maxNodesPerRegisterNodes) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - response->responseHeader.serviceResult = - UA_Array_copy(request->nodesToRegister, request->nodesToRegisterSize, (void **)&response->registeredNodeIds, - &UA_TYPES[UA_TYPES_NODEID]); - if (response->responseHeader.serviceResult == UA_STATUSCODE_GOOD) - response->registeredNodeIdsSize = request->nodesToRegisterSize; -} - -void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request, - UA_UnregisterNodesResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing UnRegisterNodesRequest"); - - // TODO: remove the nodeids from the session if really needed - if (request->nodesToUnregisterSize == 0) response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTHINGTODO; - - if (server->config.maxNodesPerRegisterNodes != 0 && - request->nodesToUnregisterSize > server->config.maxNodesPerRegisterNodes) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_services_call.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef UA_ENABLE_METHODCALLS /* conditional compilation */ - -static const UA_VariableNode *getArgumentsVariableNode(UA_Server *server, const UA_MethodNode *ofMethod, - UA_String withBrowseName) { - UA_NodeId hasProperty = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY); - for (size_t i = 0; i < ofMethod->referencesSize; ++i) { - UA_NodeReferenceKind *rk = &ofMethod->references[i]; - - if (rk->isInverse != false) continue; - - if (!UA_NodeId_equal(&hasProperty, &rk->referenceTypeId)) continue; - - for (size_t j = 0; j < rk->targetIdsSize; ++j) { - const UA_Node *refTarget = - server->config.nodestore.getNode(server->config.nodestore.context, &rk->targetIds[j].nodeId); - if (!refTarget) continue; - if (refTarget->nodeClass == UA_NODECLASS_VARIABLE && refTarget->browseName.namespaceIndex == 0 && - UA_String_equal(&withBrowseName, &refTarget->browseName.name)) { - return (const UA_VariableNode *)refTarget; - } - server->config.nodestore.releaseNode(server->config.nodestore.context, refTarget); - } - } - return NULL; -} - -static UA_StatusCode typeCheckArguments(UA_Server *server, const UA_VariableNode *argRequirements, size_t argsSize, - UA_Variant *args) { - /* Verify that we have a Variant containing UA_Argument (scalar or array) in - * the "InputArguments" node */ - if (argRequirements->valueSource != UA_VALUESOURCE_DATA) return UA_STATUSCODE_BADINTERNALERROR; - if (!argRequirements->value.data.value.hasValue) return UA_STATUSCODE_BADINTERNALERROR; - if (argRequirements->value.data.value.value.type != &UA_TYPES[UA_TYPES_ARGUMENT]) - return UA_STATUSCODE_BADINTERNALERROR; - - /* Verify the number of arguments. A scalar argument value is interpreted as - * an array of length 1. */ - size_t argReqsSize = argRequirements->value.data.value.value.arrayLength; - if (UA_Variant_isScalar(&argRequirements->value.data.value.value)) argReqsSize = 1; - if (argReqsSize > argsSize) return UA_STATUSCODE_BADARGUMENTSMISSING; - if (argReqsSize < argsSize) return UA_STATUSCODE_BADTOOMANYARGUMENTS; - - /* Type-check every argument against the definition */ - UA_Argument *argReqs = (UA_Argument *)argRequirements->value.data.value.value.data; - for (size_t i = 0; i < argReqsSize; ++i) { - if (!compatibleValue(server, &argReqs[i].dataType, argReqs[i].valueRank, argReqs[i].arrayDimensionsSize, - argReqs[i].arrayDimensions, &args[i], NULL)) - return UA_STATUSCODE_BADTYPEMISMATCH; - } - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode validMethodArguments(UA_Server *server, const UA_MethodNode *method, - const UA_CallMethodRequest *request) { - /* Get the input arguments node */ - const UA_VariableNode *inputArguments = getArgumentsVariableNode(server, method, UA_STRING("InputArguments")); - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (!inputArguments) { - if (request->inputArgumentsSize > 0) retval = UA_STATUSCODE_BADINVALIDARGUMENT; - return retval; - } - - /* Verify the request */ - retval = typeCheckArguments(server, inputArguments, request->inputArgumentsSize, request->inputArguments); - - /* Release the input arguments node */ - server->config.nodestore.releaseNode(server->config.nodestore.context, (const UA_Node *)inputArguments); - return retval; -} - -static const UA_NodeId hasComponentNodeId = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_HASCOMPONENT}}; -static const UA_NodeId hasSubTypeNodeId = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_HASSUBTYPE}}; - -static void callWithMethodAndObject(UA_Server *server, UA_Session *session, const UA_CallMethodRequest *request, - UA_CallMethodResult *result, const UA_MethodNode *method, - const UA_ObjectNode *object) { - /* Verify the object's NodeClass */ - if (object->nodeClass != UA_NODECLASS_OBJECT && object->nodeClass != UA_NODECLASS_OBJECTTYPE) { - result->statusCode = UA_STATUSCODE_BADNODECLASSINVALID; - return; - } - - /* Verify the method's NodeClass */ - if (method->nodeClass != UA_NODECLASS_METHOD) { - result->statusCode = UA_STATUSCODE_BADNODECLASSINVALID; - return; - } - - /* Is there a method to execute? */ - if (!method->method) { - result->statusCode = UA_STATUSCODE_BADINTERNALERROR; - return; - } - - /* Verify method/object relations. Object must have a hasComponent or a - * subtype of hasComponent reference to the method node. Therefore, check - * every reference between the parent object and the method node if there is - * a hasComponent (or subtype) reference */ - UA_Boolean found = false; - for (size_t i = 0; i < object->referencesSize && !found; ++i) { - UA_NodeReferenceKind *rk = &object->references[i]; - if (rk->isInverse) continue; - if (!isNodeInTree(&server->config.nodestore, &rk->referenceTypeId, &hasComponentNodeId, &hasSubTypeNodeId, 1)) - continue; - for (size_t j = 0; j < rk->targetIdsSize; ++j) { - if (UA_NodeId_equal(&rk->targetIds[j].nodeId, &request->methodId)) { - found = true; - break; - } - } - } - if (!found) { - result->statusCode = UA_STATUSCODE_BADMETHODINVALID; - return; - } - - /* Verify access rights */ - UA_Boolean executable = method->executable; - if (session != &adminSession) - executable = executable && - server->config.accessControl.getUserExecutableOnObject(&session->sessionId, session->sessionHandle, - &request->methodId, method->context, - &request->objectId, object->context); - if (!executable) { - result->statusCode = UA_STATUSCODE_BADNOTWRITABLE; // There is no NOTEXECUTABLE? - return; - } - - /* Verify Input Arguments */ - result->statusCode = validMethodArguments(server, method, request); - if (result->statusCode != UA_STATUSCODE_GOOD) return; - - /* Get the output arguments node */ - const UA_VariableNode *outputArguments = getArgumentsVariableNode(server, method, UA_STRING("OutputArguments")); - - /* Allocate the output arguments array */ - if (outputArguments) { - if (outputArguments->value.data.value.value.arrayLength > 0) { - result->outputArguments = - (UA_Variant *)UA_Array_new(outputArguments->value.data.value.value.arrayLength, &UA_TYPES[UA_TYPES_VARIANT]); - if (!result->outputArguments) { - result->statusCode = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - result->outputArgumentsSize = outputArguments->value.data.value.value.arrayLength; - } - - /* Release the output arguments node */ - server->config.nodestore.releaseNode(server->config.nodestore.context, (const UA_Node *)outputArguments); - } - - /* Call the method */ - result->statusCode = method->method(server, &session->sessionId, session->sessionHandle, &method->nodeId, - (void *)(uintptr_t)method->context, &object->nodeId, - (void *)(uintptr_t)&object->context, request->inputArgumentsSize, - request->inputArguments, result->outputArgumentsSize, result->outputArguments); - /* TODO: Verify Output matches the argument definition */ -} - -static void Operation_CallMethod(UA_Server *server, UA_Session *session, const UA_CallMethodRequest *request, - UA_CallMethodResult *result) { - /* Get the method node */ - const UA_MethodNode *method = - (const UA_MethodNode *)server->config.nodestore.getNode(server->config.nodestore.context, &request->methodId); - if (!method) { - result->statusCode = UA_STATUSCODE_BADMETHODINVALID; - return; - } - - /* Get the object node */ - const UA_ObjectNode *object = - (const UA_ObjectNode *)server->config.nodestore.getNode(server->config.nodestore.context, &request->objectId); - if (!object) { - result->statusCode = UA_STATUSCODE_BADNODEIDINVALID; - server->config.nodestore.releaseNode(server->config.nodestore.context, (const UA_Node *)method); - return; - } - - /* Continue with method and object as context */ - callWithMethodAndObject(server, session, request, result, method, object); - - /* Release the method and object node */ - server->config.nodestore.releaseNode(server->config.nodestore.context, (const UA_Node *)method); - server->config.nodestore.releaseNode(server->config.nodestore.context, (const UA_Node *)object); -} - -void Service_Call(UA_Server *server, UA_Session *session, const UA_CallRequest *request, UA_CallResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing CallRequest"); - - if (server->config.maxNodesPerMethodCall != 0 && request->methodsToCallSize > server->config.maxNodesPerMethodCall) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)Operation_CallMethod, &request->methodsToCallSize, - &UA_TYPES[UA_TYPES_CALLMETHODREQUEST], &response->resultsSize, &UA_TYPES[UA_TYPES_CALLMETHODRESULT]); -} - -UA_CallMethodResult UA_EXPORT UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request) { - UA_CallMethodResult result; - UA_CallMethodResult_init(&result); - Operation_CallMethod(server, &adminSession, request, &result); - return result; -} - -#endif /* UA_ENABLE_METHODCALLS */ - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_services_session.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* Create a signed nonce */ -static UA_StatusCode nonceAndSignCreateSessionResponse(UA_Server *server, UA_SecureChannel *channel, - UA_Session *session, const UA_CreateSessionRequest *request, - UA_CreateSessionResponse *response) { - if (channel->securityMode != UA_MESSAGESECURITYMODE_SIGN && - channel->securityMode != UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) - return UA_STATUSCODE_GOOD; - - const UA_SecurityPolicy *const securityPolicy = channel->securityPolicy; - UA_SignatureData *signatureData = &response->serverSignature; - - /* Generate Nonce - * FIXME: remove magic number??? */ - UA_StatusCode retval = UA_SecureChannel_generateNonce(channel, 32, &response->serverNonce); - UA_ByteString_deleteMembers(&session->serverNonce); - retval |= UA_ByteString_copy(&response->serverNonce, &session->serverNonce); - if (retval != UA_STATUSCODE_GOOD) { - UA_SessionManager_removeSession(&server->sessionManager, &session->authenticationToken); - return retval; - } - - size_t signatureSize = - securityPolicy->asymmetricModule.cryptoModule.getLocalSignatureSize(securityPolicy, channel->channelContext); - - retval |= UA_ByteString_allocBuffer(&signatureData->signature, signatureSize); - if (retval != UA_STATUSCODE_GOOD) { - UA_SessionManager_removeSession(&server->sessionManager, &session->authenticationToken); - return retval; - } - - UA_ByteString dataToSign; - retval |= UA_ByteString_allocBuffer(&dataToSign, request->clientCertificate.length + request->clientNonce.length); - if (retval != UA_STATUSCODE_GOOD) { - UA_SignatureData_deleteMembers(signatureData); - UA_SessionManager_removeSession(&server->sessionManager, &session->authenticationToken); - return retval; - } - - memcpy(dataToSign.data, request->clientCertificate.data, request->clientCertificate.length); - memcpy(dataToSign.data + request->clientCertificate.length, request->clientNonce.data, request->clientNonce.length); - - retval |= - UA_String_copy(&securityPolicy->asymmetricModule.cryptoModule.signatureAlgorithmUri, &signatureData->algorithm); - retval |= securityPolicy->asymmetricModule.cryptoModule.sign(securityPolicy, channel->channelContext, &dataToSign, - &signatureData->signature); - - UA_ByteString_deleteMembers(&dataToSign); - if (retval != UA_STATUSCODE_GOOD) { - UA_SignatureData_deleteMembers(signatureData); - UA_SessionManager_removeSession(&server->sessionManager, &session->authenticationToken); - } - return retval; -} - -void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, - UA_CreateSessionResponse *response) { - if (channel == NULL) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADINTERNALERROR; - return; - } - - if (channel->connection == NULL) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADINTERNALERROR; - return; - } - - UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Trying to create session"); - - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { - if (!UA_ByteString_equal(&request->clientCertificate, &channel->remoteCertificate)) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADCERTIFICATEINVALID; - return; - } - } - if (channel->securityToken.channelId == 0) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADSECURECHANNELIDINVALID; - return; - } - - if (!UA_ByteString_equal(&channel->securityPolicy->policyUri, &UA_SECURITY_POLICY_NONE_URI) && - request->clientNonce.length < 32) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADNONCEINVALID; - return; - } - - ////////////////////// TODO: Compare application URI with certificate uri (decode certificate) - - /* Allocate the response */ - response->serverEndpoints = - (UA_EndpointDescription *)UA_Array_new(server->config.endpointsSize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); - if (!response->serverEndpoints) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - response->serverEndpointsSize = server->config.endpointsSize; - - /* Copy the server's endpointdescriptions into the response */ - for (size_t i = 0; i < server->config.endpointsSize; ++i) - response->responseHeader.serviceResult |= - UA_EndpointDescription_copy(&server->config.endpoints[i].endpointDescription, &response->serverEndpoints[i]); - if (response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) return; - - /* Mirror back the endpointUrl */ - for (size_t i = 0; i < response->serverEndpointsSize; ++i) { - UA_String_deleteMembers(&response->serverEndpoints[i].endpointUrl); - UA_String_copy(&request->endpointUrl, &response->serverEndpoints[i].endpointUrl); - } - - UA_Session *newSession; - response->responseHeader.serviceResult = - UA_SessionManager_createSession(&server->sessionManager, channel, request, &newSession); - if (response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Processing CreateSessionRequest failed"); - return; - } - - /* Fill the session with more information */ - newSession->maxResponseMessageSize = request->maxResponseMessageSize; - newSession->maxRequestMessageSize = channel->connection->localConf.maxMessageSize; - response->responseHeader.serviceResult |= - UA_ApplicationDescription_copy(&request->clientDescription, &newSession->clientDescription); - - /* Prepare the response */ - response->sessionId = newSession->sessionId; - response->revisedSessionTimeout = (UA_Double)newSession->timeout; - response->authenticationToken = newSession->authenticationToken; - response->responseHeader.serviceResult = UA_String_copy(&request->sessionName, &newSession->sessionName); - - if (server->config.endpointsSize > 0) - response->responseHeader.serviceResult |= - UA_ByteString_copy(&channel->securityPolicy->localCertificate, &response->serverCertificate); - - /* Create a signed nonce */ - response->responseHeader.serviceResult = - nonceAndSignCreateSessionResponse(server, channel, newSession, request, response); - - /* Failure -> remove the session */ - if (response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_SessionManager_removeSession(&server->sessionManager, &newSession->authenticationToken); - return; - } - - UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Session " UA_PRINTF_GUID_FORMAT " created", - UA_PRINTF_GUID_DATA(newSession->sessionId.identifier.guid)); -} - -static void checkSignature(const UA_Server *server, const UA_SecureChannel *channel, UA_Session *session, - const UA_ActivateSessionRequest *request, UA_ActivateSessionResponse *response) { - if (channel->securityMode == UA_MESSAGESECURITYMODE_SIGN || - channel->securityMode == UA_MESSAGESECURITYMODE_SIGNANDENCRYPT) { - const UA_SecurityPolicy *const securityPolicy = channel->securityPolicy; - const UA_ByteString *const localCertificate = &securityPolicy->localCertificate; - - UA_ByteString dataToVerify; - UA_StatusCode retval = - UA_ByteString_allocBuffer(&dataToVerify, localCertificate->length + session->serverNonce.length); - - if (retval != UA_STATUSCODE_GOOD) { - response->responseHeader.serviceResult = retval; - UA_LOG_DEBUG_SESSION(server->config.logger, session, - "Failed to allocate buffer for signature verification! %#10x", retval); - return; - } - - memcpy(dataToVerify.data, localCertificate->data, localCertificate->length); - memcpy(dataToVerify.data + localCertificate->length, session->serverNonce.data, session->serverNonce.length); - - retval = securityPolicy->asymmetricModule.cryptoModule.verify(securityPolicy, channel->channelContext, - &dataToVerify, &request->clientSignature.signature); - if (retval != UA_STATUSCODE_GOOD) { - response->responseHeader.serviceResult = retval; - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Failed to verify the client signature! %#10x", retval); - UA_ByteString_deleteMembers(&dataToVerify); - return; - } - - retval = UA_SecureChannel_generateNonce(channel, 32, &response->serverNonce); - UA_ByteString_deleteMembers(&session->serverNonce); - retval |= UA_ByteString_copy(&response->serverNonce, &session->serverNonce); - if (retval != UA_STATUSCODE_GOOD) { - response->responseHeader.serviceResult = retval; - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Failed to generate a new nonce! %#10x", retval); - UA_ByteString_deleteMembers(&dataToVerify); - return; - } - - UA_ByteString_deleteMembers(&dataToVerify); - } -} - -void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, UA_Session *session, - const UA_ActivateSessionRequest *request, UA_ActivateSessionResponse *response) { - if (session->validTill < UA_DateTime_nowMonotonic()) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "ActivateSession: SecureChannel %i wants " - "to activate, but the session has timed out", - channel->securityToken.channelId); - response->responseHeader.serviceResult = UA_STATUSCODE_BADSESSIONIDINVALID; - return; - } - - checkSignature(server, channel, session, request, response); - if (response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) return; - - /* Callback into userland access control */ - response->responseHeader.serviceResult = server->config.accessControl.activateSession( - &session->sessionId, &request->userIdentityToken, &session->sessionHandle); - if (response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) return; - - /* Detach the old SecureChannel */ - if (session->channel && session->channel != channel) { - UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Detach from old channel"); - UA_SecureChannel_detachSession(session->channel, session); - } - - /* Attach to the SecureChannel and activate */ - UA_SecureChannel_attachSession(channel, session); - session->activated = true; - UA_Session_updateLifetime(session); - UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Session activated"); -} - -void Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request, - UA_CloseSessionResponse *response) { - UA_LOG_INFO_SESSION(server->config.logger, session, "CloseSession"); - - /* Callback into userland access control */ - server->config.accessControl.closeSession(&session->sessionId, session->sessionHandle); - response->responseHeader.serviceResult = - UA_SessionManager_removeSession(&server->sessionManager, &session->authenticationToken); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_services_attribute.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/******************/ -/* Access Control */ -/******************/ - -static UA_UInt32 getUserWriteMask(UA_Server *server, const UA_Session *session, const UA_Node *node) { - if (session == &adminSession) return 0xFFFFFFFF; /* the local admin user has all rights */ - return node->writeMask & - server->config.accessControl.getUserRightsMask(&session->sessionId, session->sessionHandle, &node->nodeId, - node->context); -} - -static UA_Byte getAccessLevel(UA_Server *server, const UA_Session *session, const UA_VariableNode *node) { - if (session == &adminSession) return 0xFF; /* the local admin user has all rights */ - return node->accessLevel; -} - -static UA_Byte getUserAccessLevel(UA_Server *server, const UA_Session *session, const UA_VariableNode *node) { - if (session == &adminSession) return 0xFF; /* the local admin user has all rights */ - return node->accessLevel & - server->config.accessControl.getUserAccessLevel(&session->sessionId, session->sessionHandle, &node->nodeId, - node->context); -} - -static UA_Boolean getUserExecutable(UA_Server *server, const UA_Session *session, const UA_MethodNode *node) { - if (session == &adminSession) return true; /* the local admin user has all rights */ - return node->executable & - server->config.accessControl.getUserExecutable(&session->sessionId, session->sessionHandle, &node->nodeId, - node->context); -} - -/****************/ -/* Read Service */ -/****************/ - -static UA_StatusCode readArrayDimensionsAttribute(const UA_VariableNode *vn, UA_DataValue *v) { - UA_Variant_setArray(&v->value, vn->arrayDimensions, vn->arrayDimensionsSize, &UA_TYPES[UA_TYPES_UINT32]); - v->value.storageType = UA_VARIANT_DATA_NODELETE; - return UA_STATUSCODE_GOOD; -} - -static void setScalarNoDelete(UA_Variant *v, const void *UA_RESTRICT p, const UA_DataType *type) { - UA_Variant_setScalar(v, (void *)(uintptr_t)p, type); - v->storageType = UA_VARIANT_DATA_NODELETE; -} - -static UA_StatusCode readIsAbstractAttribute(const UA_Node *node, UA_Variant *v) { - const UA_Boolean *isAbstract; - switch (node->nodeClass) { - case UA_NODECLASS_REFERENCETYPE: - isAbstract = &((const UA_ReferenceTypeNode *)node)->isAbstract; - break; - case UA_NODECLASS_OBJECTTYPE: - isAbstract = &((const UA_ObjectTypeNode *)node)->isAbstract; - break; - case UA_NODECLASS_VARIABLETYPE: - isAbstract = &((const UA_VariableTypeNode *)node)->isAbstract; - break; - case UA_NODECLASS_DATATYPE: - isAbstract = &((const UA_DataTypeNode *)node)->isAbstract; - break; - default: - return UA_STATUSCODE_BADATTRIBUTEIDINVALID; - } - - setScalarNoDelete(v, isAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]); - v->storageType = UA_VARIANT_DATA_NODELETE; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode readValueAttributeFromNode(UA_Server *server, UA_Session *session, const UA_VariableNode *vn, - UA_DataValue *v, UA_NumericRange *rangeptr) { - if (vn->value.data.callback.onRead) { - vn->value.data.callback.onRead(server, &session->sessionId, session->sessionHandle, &vn->nodeId, vn->context, - rangeptr, &vn->value.data.value); - const UA_Node *old = (const UA_Node *)vn; - /* Reopen the node to see the changes from onRead */ - vn = (const UA_VariableNode *)UA_Nodestore_get(server, &vn->nodeId); - UA_Nodestore_release(server, old); - } - if (rangeptr) return UA_Variant_copyRange(&vn->value.data.value.value, &v->value, *rangeptr); - *v = vn->value.data.value; - v->value.storageType = UA_VARIANT_DATA_NODELETE; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode readValueAttributeFromDataSource(UA_Server *server, UA_Session *session, const UA_VariableNode *vn, - UA_DataValue *v, UA_TimestampsToReturn timestamps, - UA_NumericRange *rangeptr) { - if (!vn->value.dataSource.read) return UA_STATUSCODE_BADINTERNALERROR; - UA_Boolean sourceTimeStamp = (timestamps == UA_TIMESTAMPSTORETURN_SOURCE || timestamps == UA_TIMESTAMPSTORETURN_BOTH); - return vn->value.dataSource.read(server, &session->sessionId, session->sessionHandle, &vn->nodeId, vn->context, - sourceTimeStamp, rangeptr, v); -} - -static UA_StatusCode readValueAttributeComplete(UA_Server *server, UA_Session *session, const UA_VariableNode *vn, - UA_TimestampsToReturn timestamps, const UA_String *indexRange, - UA_DataValue *v) { - /* Compute the index range */ - UA_NumericRange range; - UA_NumericRange *rangeptr = NULL; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (indexRange && indexRange->length > 0) { - retval = UA_NumericRange_parseFromString(&range, indexRange); - if (retval != UA_STATUSCODE_GOOD) return retval; - rangeptr = ⦥ - } - - /* Read the value */ - if (vn->valueSource == UA_VALUESOURCE_DATA) - retval = readValueAttributeFromNode(server, session, vn, v, rangeptr); - else - retval = readValueAttributeFromDataSource(server, session, vn, v, timestamps, rangeptr); - - /* Clean up */ - if (rangeptr) UA_free(range.dimensions); - return retval; -} - -UA_StatusCode readValueAttribute(UA_Server *server, UA_Session *session, const UA_VariableNode *vn, UA_DataValue *v) { - return readValueAttributeComplete(server, session, vn, UA_TIMESTAMPSTORETURN_NEITHER, NULL, v); -} - -static const UA_String binEncoding = {sizeof("Default Binary") - 1, (UA_Byte *)"Default Binary"}; -/* static const UA_String xmlEncoding = {sizeof("Default Xml")-1, (UA_Byte*)"Default Xml"}; */ - -#define CHECK_NODECLASS(CLASS) \ - if (!(node->nodeClass & (CLASS))) { \ - retval = UA_STATUSCODE_BADATTRIBUTEIDINVALID; \ - break; \ - } - -/* Returns a datavalue that may point into the node via the - * UA_VARIANT_DATA_NODELETE tag. Don't access the returned DataValue once the - * node has been released! */ -static void Read(const UA_Node *node, UA_Server *server, UA_Session *session, UA_TimestampsToReturn timestampsToReturn, - const UA_ReadValueId *id, UA_DataValue *v) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Read the attribute %i", id->attributeId); - - /* XML encoding is not supported */ - if (id->dataEncoding.name.length > 0 && !UA_String_equal(&binEncoding, &id->dataEncoding.name)) { - v->hasStatus = true; - v->status = UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED; - return; - } - - /* Index range for an attribute other than value */ - if (id->indexRange.length > 0 && id->attributeId != UA_ATTRIBUTEID_VALUE) { - v->hasStatus = true; - v->status = UA_STATUSCODE_BADINDEXRANGENODATA; - return; - } - - /* Read the attribute */ - UA_StatusCode retval = UA_STATUSCODE_GOOD; - switch (id->attributeId) { - case UA_ATTRIBUTEID_NODEID: - setScalarNoDelete(&v->value, &node->nodeId, &UA_TYPES[UA_TYPES_NODEID]); - break; - case UA_ATTRIBUTEID_NODECLASS: - setScalarNoDelete(&v->value, &node->nodeClass, &UA_TYPES[UA_TYPES_NODECLASS]); - break; - case UA_ATTRIBUTEID_BROWSENAME: - setScalarNoDelete(&v->value, &node->browseName, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]); - break; - case UA_ATTRIBUTEID_DISPLAYNAME: - setScalarNoDelete(&v->value, &node->displayName, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); - break; - case UA_ATTRIBUTEID_DESCRIPTION: - setScalarNoDelete(&v->value, &node->description, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); - break; - case UA_ATTRIBUTEID_WRITEMASK: - setScalarNoDelete(&v->value, &node->writeMask, &UA_TYPES[UA_TYPES_UINT32]); - break; - case UA_ATTRIBUTEID_USERWRITEMASK: { - UA_UInt32 userWriteMask = getUserWriteMask(server, session, node); - retval = UA_Variant_setScalarCopy(&v->value, &userWriteMask, &UA_TYPES[UA_TYPES_UINT32]); - break; - } - case UA_ATTRIBUTEID_ISABSTRACT: - retval = readIsAbstractAttribute(node, &v->value); - break; - case UA_ATTRIBUTEID_SYMMETRIC: - CHECK_NODECLASS(UA_NODECLASS_REFERENCETYPE); - setScalarNoDelete(&v->value, &((const UA_ReferenceTypeNode *)node)->symmetric, &UA_TYPES[UA_TYPES_BOOLEAN]); - break; - case UA_ATTRIBUTEID_INVERSENAME: - CHECK_NODECLASS(UA_NODECLASS_REFERENCETYPE); - setScalarNoDelete(&v->value, &((const UA_ReferenceTypeNode *)node)->inverseName, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); - break; - case UA_ATTRIBUTEID_CONTAINSNOLOOPS: - CHECK_NODECLASS(UA_NODECLASS_VIEW); - setScalarNoDelete(&v->value, &((const UA_ViewNode *)node)->containsNoLoops, &UA_TYPES[UA_TYPES_BOOLEAN]); - break; - case UA_ATTRIBUTEID_EVENTNOTIFIER: - CHECK_NODECLASS(UA_NODECLASS_VIEW | UA_NODECLASS_OBJECT); - setScalarNoDelete(&v->value, &((const UA_ViewNode *)node)->eventNotifier, &UA_TYPES[UA_TYPES_BYTE]); - break; - case UA_ATTRIBUTEID_VALUE: { - CHECK_NODECLASS(UA_NODECLASS_VARIABLE | UA_NODECLASS_VARIABLETYPE); - /* VariableTypes don't have the AccessLevel concept. Always allow reading the value. */ - if (node->nodeClass == UA_NODECLASS_VARIABLE) { - /* The access to a value variable is granted via the AccessLevel - * and UserAccessLevel attributes */ - UA_Byte accessLevel = getAccessLevel(server, session, (const UA_VariableNode *)node); - if (!(accessLevel & (UA_ACCESSLEVELMASK_READ))) { - retval = UA_STATUSCODE_BADNOTREADABLE; - break; - } - accessLevel = getUserAccessLevel(server, session, (const UA_VariableNode *)node); - if (!(accessLevel & (UA_ACCESSLEVELMASK_READ))) { - retval = UA_STATUSCODE_BADUSERACCESSDENIED; - break; - } - } - retval = readValueAttributeComplete(server, session, (const UA_VariableNode *)node, timestampsToReturn, - &id->indexRange, v); - break; - } - case UA_ATTRIBUTEID_DATATYPE: - CHECK_NODECLASS(UA_NODECLASS_VARIABLE | UA_NODECLASS_VARIABLETYPE); - setScalarNoDelete(&v->value, &((const UA_VariableTypeNode *)node)->dataType, &UA_TYPES[UA_TYPES_NODEID]); - break; - case UA_ATTRIBUTEID_VALUERANK: - CHECK_NODECLASS(UA_NODECLASS_VARIABLE | UA_NODECLASS_VARIABLETYPE); - setScalarNoDelete(&v->value, &((const UA_VariableTypeNode *)node)->valueRank, &UA_TYPES[UA_TYPES_INT32]); - break; - case UA_ATTRIBUTEID_ARRAYDIMENSIONS: - CHECK_NODECLASS(UA_NODECLASS_VARIABLE | UA_NODECLASS_VARIABLETYPE); - retval = readArrayDimensionsAttribute((const UA_VariableNode *)node, v); - break; - case UA_ATTRIBUTEID_ACCESSLEVEL: - CHECK_NODECLASS(UA_NODECLASS_VARIABLE); - setScalarNoDelete(&v->value, &((const UA_VariableNode *)node)->accessLevel, &UA_TYPES[UA_TYPES_BYTE]); - break; - case UA_ATTRIBUTEID_USERACCESSLEVEL: { - CHECK_NODECLASS(UA_NODECLASS_VARIABLE); - UA_Byte userAccessLevel = getUserAccessLevel(server, session, (const UA_VariableNode *)node); - retval = UA_Variant_setScalarCopy(&v->value, &userAccessLevel, &UA_TYPES[UA_TYPES_BYTE]); - break; - } - case UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL: - CHECK_NODECLASS(UA_NODECLASS_VARIABLE); - setScalarNoDelete(&v->value, &((const UA_VariableNode *)node)->minimumSamplingInterval, - &UA_TYPES[UA_TYPES_DOUBLE]); - break; - case UA_ATTRIBUTEID_HISTORIZING: - CHECK_NODECLASS(UA_NODECLASS_VARIABLE); - setScalarNoDelete(&v->value, &((const UA_VariableNode *)node)->historizing, &UA_TYPES[UA_TYPES_BOOLEAN]); - break; - case UA_ATTRIBUTEID_EXECUTABLE: - CHECK_NODECLASS(UA_NODECLASS_METHOD); - setScalarNoDelete(&v->value, &((const UA_MethodNode *)node)->executable, &UA_TYPES[UA_TYPES_BOOLEAN]); - break; - case UA_ATTRIBUTEID_USEREXECUTABLE: { - CHECK_NODECLASS(UA_NODECLASS_METHOD); - UA_Boolean userExecutable = getUserExecutable(server, session, (const UA_MethodNode *)node); - retval = UA_Variant_setScalarCopy(&v->value, &userExecutable, &UA_TYPES[UA_TYPES_BOOLEAN]); - break; - } - default: - retval = UA_STATUSCODE_BADATTRIBUTEIDINVALID; - } - - /* Return error code when reading has failed */ - if (retval != UA_STATUSCODE_GOOD) { - v->hasStatus = true; - v->status = retval; - return; - } - - v->hasValue = true; - - /* Create server timestamp */ - if (timestampsToReturn == UA_TIMESTAMPSTORETURN_SERVER || timestampsToReturn == UA_TIMESTAMPSTORETURN_BOTH) { - v->serverTimestamp = UA_DateTime_now(); - v->hasServerTimestamp = true; - } - - /* Handle source time stamp */ - if (id->attributeId == UA_ATTRIBUTEID_VALUE) { - if (timestampsToReturn == UA_TIMESTAMPSTORETURN_SERVER || timestampsToReturn == UA_TIMESTAMPSTORETURN_NEITHER) { - v->hasSourceTimestamp = false; - v->hasSourcePicoseconds = false; - } else if (!v->hasSourceTimestamp) { - v->sourceTimestamp = UA_DateTime_now(); - v->hasSourceTimestamp = true; - } - } -} - -static UA_StatusCode Operation_Read(UA_Server *server, UA_Session *session, UA_MessageContext *mc, - UA_TimestampsToReturn timestampsToReturn, const UA_ReadValueId *id) { - UA_DataValue dv; - UA_DataValue_init(&dv); - - /* Get the node */ - const UA_Node *node = UA_Nodestore_get(server, &id->nodeId); - - /* Perform the read operation */ - if (node) { - Read(node, server, session, timestampsToReturn, id, &dv); - } else { - dv.hasStatus = true; - dv.status = UA_STATUSCODE_BADNODEIDUNKNOWN; - } - - /* Encode (and send) the results */ - UA_StatusCode retval = UA_MessageContext_encode(mc, &dv, &UA_TYPES[UA_TYPES_DATAVALUE]); - - /* Free copied data and release the node */ - UA_Variant_deleteMembers(&dv.value); - UA_Nodestore_release(server, node); - return retval; -} - -UA_StatusCode Service_Read(UA_Server *server, UA_Session *session, UA_MessageContext *mc, const UA_ReadRequest *request, - UA_ResponseHeader *responseHeader) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing ReadRequest"); - - /* Check if the timestampstoreturn is valid */ - if (request->timestampsToReturn > UA_TIMESTAMPSTORETURN_NEITHER) - responseHeader->serviceResult = UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID; - - if (request->nodesToReadSize == 0) responseHeader->serviceResult = UA_STATUSCODE_BADNOTHINGTODO; - - /* Check if maxAge is valid */ - if (request->maxAge < 0) responseHeader->serviceResult = UA_STATUSCODE_BADMAXAGEINVALID; - - /* Check if there are too many operations */ - if (server->config.maxNodesPerRead != 0 && request->nodesToReadSize > server->config.maxNodesPerRead) - responseHeader->serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - - /* Encode the response header */ - UA_StatusCode retval = UA_MessageContext_encode(mc, responseHeader, &UA_TYPES[UA_TYPES_RESPONSEHEADER]); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Process nothing if we return an error code for the entire service */ - UA_Int32 arraySize = (UA_Int32)request->nodesToReadSize; - if (responseHeader->serviceResult != UA_STATUSCODE_GOOD) arraySize = 0; - - /* Process all ReadValueIds */ - retval = UA_MessageContext_encode(mc, &arraySize, &UA_TYPES[UA_TYPES_INT32]); - if (retval != UA_STATUSCODE_GOOD) return retval; - - for (UA_Int32 i = 0; i < arraySize; i++) { - retval = Operation_Read(server, session, mc, request->timestampsToReturn, &request->nodesToRead[i]); - if (retval != UA_STATUSCODE_GOOD) return retval; - } - - /* Don't return any DiagnosticInfo */ - arraySize = -1; - return UA_MessageContext_encode(mc, &arraySize, &UA_TYPES[UA_TYPES_INT32]); -} - -UA_DataValue UA_Server_readWithSession(UA_Server *server, UA_Session *session, const UA_ReadValueId *item, - UA_TimestampsToReturn timestampsToReturn) { - UA_DataValue dv; - UA_DataValue_init(&dv); - - /* Get the node */ - const UA_Node *node = UA_Nodestore_get(server, &item->nodeId); - if (!node) { - dv.hasStatus = true; - dv.status = UA_STATUSCODE_BADNODEIDUNKNOWN; - return dv; - } - - /* Perform the read operation */ - Read(node, server, session, timestampsToReturn, item, &dv); - - /* Do we have to copy the result before releasing the node? */ - if (dv.hasValue && dv.value.storageType == UA_VARIANT_DATA_NODELETE) { - UA_DataValue dv2; - UA_StatusCode retval = UA_DataValue_copy(&dv, &dv2); - if (retval == UA_STATUSCODE_GOOD) { - dv = dv2; - } else { - UA_DataValue_init(&dv); - dv.hasStatus = true; - dv.status = retval; - } - } - - /* Release the node and return */ - UA_Nodestore_release(server, node); - return dv; -} - -/* Exposes the Read service to local users */ -UA_DataValue UA_Server_read(UA_Server *server, const UA_ReadValueId *item, UA_TimestampsToReturn timestamps) { - return UA_Server_readWithSession(server, &adminSession, item, timestamps); -} - -/* Used in inline functions exposing the Read service with more syntactic sugar - * for individual attributes */ -UA_StatusCode __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, void *v) { - /* Call the read service */ - UA_ReadValueId item; - UA_ReadValueId_init(&item); - item.nodeId = *nodeId; - item.attributeId = attributeId; - UA_DataValue dv = UA_Server_read(server, &item, UA_TIMESTAMPSTORETURN_NEITHER); - - /* Check the return value */ - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (dv.hasStatus) - retval = dv.status; - else if (!dv.hasValue) - retval = UA_STATUSCODE_BADUNEXPECTEDERROR; - if (retval != UA_STATUSCODE_GOOD) { - UA_DataValue_deleteMembers(&dv); - return retval; - } - - if (attributeId == UA_ATTRIBUTEID_VALUE || attributeId == UA_ATTRIBUTEID_ARRAYDIMENSIONS) { - /* Return the entire variant */ - memcpy(v, &dv.value, sizeof(UA_Variant)); - } else { - /* Return the variant content only */ - memcpy(v, dv.value.data, dv.value.type->memSize); - UA_free(dv.value.data); - } - return retval; -} - -/*****************/ -/* Type Checking */ -/*****************/ - -enum type_equivalence { TYPE_EQUIVALENCE_NONE, TYPE_EQUIVALENCE_ENUM, TYPE_EQUIVALENCE_OPAQUE }; - -static enum type_equivalence typeEquivalence(const UA_DataType *t) { - if (t->membersSize != 1 || !t->members[0].namespaceZero) return TYPE_EQUIVALENCE_NONE; - if (t->members[0].memberTypeIndex == UA_TYPES_INT32) return TYPE_EQUIVALENCE_ENUM; - if (t->members[0].memberTypeIndex == UA_TYPES_BYTE && t->members[0].isArray) return TYPE_EQUIVALENCE_OPAQUE; - return TYPE_EQUIVALENCE_NONE; -} - -const UA_NodeId subtypeId = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_HASSUBTYPE}}; -static const UA_NodeId enumNodeId = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_ENUMERATION}}; - -UA_Boolean compatibleDataType(UA_Server *server, const UA_NodeId *dataType, const UA_NodeId *constraintDataType) { - /* Do not allow empty datatypes */ - if (UA_NodeId_isNull(dataType)) return false; - - /* No constraint (TODO: use variant instead) */ - if (UA_NodeId_isNull(constraintDataType)) return true; - - /* Variant allows any subtype */ - if (UA_NodeId_equal(constraintDataType, &UA_TYPES[UA_TYPES_VARIANT].typeId)) return true; - - /* Is the value-type a subtype of the required type? */ - if (isNodeInTree(&server->config.nodestore, dataType, constraintDataType, &subtypeId, 1)) return true; - - /* If value is a built-in type: The target data type may be a sub type of - * the built-in type. (e.g. UtcTime is sub-type of DateTime and has a - * DateTime value). A type is builtin if its NodeId is in Namespace 0 and - * has a numeric identifier <= 25 (DiagnosticInfo) */ - if (dataType->namespaceIndex == 0 && dataType->identifierType == UA_NODEIDTYPE_NUMERIC && - dataType->identifier.numeric <= 25 && - isNodeInTree(&server->config.nodestore, constraintDataType, dataType, &subtypeId, 1)) - return true; - - /* Enum allows Int32 (only) */ - if (UA_NodeId_equal(dataType, &UA_TYPES[UA_TYPES_INT32].typeId) && - isNodeInTree(&server->config.nodestore, constraintDataType, &enumNodeId, &subtypeId, 1)) - return true; - - return false; -} - -/* Test whether a valurank and the given arraydimensions are compatible. zero - * array dimensions indicate a scalar */ -UA_Boolean compatibleValueRankArrayDimensions(UA_Int32 valueRank, size_t arrayDimensionsSize) { - switch (valueRank) { - case -3: /* the value can be a scalar or a one dimensional array */ - if (arrayDimensionsSize > 1) return false; - break; - case -2: /* the value can be a scalar or an array with any number of dimensions */ - break; - case -1: /* the value is a scalar */ - if (arrayDimensionsSize > 0) return false; - break; - case 0: /* the value is an array with one or more dimensions */ - if (arrayDimensionsSize < 1) return false; - break; - default: /* >= 1: the value is an array with the specified number of dimensions */ - if (valueRank < 0) return false; - /* Must hold if the array has a defined length. Null arrays (length -1) - * need to be caught before. */ - if (arrayDimensionsSize != (size_t)valueRank) return false; - } - return true; -} - -UA_Boolean compatibleValueRanks(UA_Int32 valueRank, UA_Int32 constraintValueRank) { - /* Check if the valuerank of the variabletype allows the change. */ - switch (constraintValueRank) { - case -3: /* the value can be a scalar or a one dimensional array */ - if (valueRank != -1 && valueRank != 1) return false; - break; - case -2: /* the value can be a scalar or an array with any number of dimensions */ - break; - case -1: /* the value is a scalar */ - if (valueRank != -1) return false; - break; - case 0: /* the value is an array with one or more dimensions */ - if (valueRank < 0) return false; - break; - default: /* >= 1: the value is an array with the specified number of dimensions */ - if (valueRank != constraintValueRank) return false; - break; - } - return true; -} - -/* Check if the valuerank allows for the value dimension */ -static UA_Boolean compatibleValueRankValue(UA_Int32 valueRank, const UA_Variant *value) { - /* empty arrays (-1) always match */ - if (!value->data) return false; - - size_t arrayDims = value->arrayDimensionsSize; - if (!UA_Variant_isScalar(value)) arrayDims = 1; /* array but no arraydimensions -> implicit array dimension 1 */ - return compatibleValueRankArrayDimensions(valueRank, arrayDims); -} - -UA_Boolean compatibleArrayDimensions(size_t constraintArrayDimensionsSize, const UA_UInt32 *constraintArrayDimensions, - size_t testArrayDimensionsSize, const UA_UInt32 *testArrayDimensions) { - /* No array dimensions defined -> everything is permitted if the value rank fits */ - if (constraintArrayDimensionsSize == 0) return true; - - /* Dimension count must match */ - if (testArrayDimensionsSize != constraintArrayDimensionsSize) return false; - - /* Dimension lengths must match; zero in the constraint is a wildcard */ - for (size_t i = 0; i < constraintArrayDimensionsSize; ++i) { - if (constraintArrayDimensions[i] != testArrayDimensions[i] && constraintArrayDimensions[i] != 0) return false; - } - return true; -} - -UA_Boolean compatibleValueArrayDimensions(const UA_Variant *value, size_t targetArrayDimensionsSize, - const UA_UInt32 *targetArrayDimensions) { - size_t valueArrayDimensionsSize = value->arrayDimensionsSize; - UA_UInt32 *valueArrayDimensions = value->arrayDimensions; - UA_UInt32 tempArrayDimensions; - if (valueArrayDimensions == 0 && !UA_Variant_isScalar(value)) { - valueArrayDimensionsSize = 1; - tempArrayDimensions = (UA_UInt32)value->arrayLength; - valueArrayDimensions = &tempArrayDimensions; - } - return compatibleArrayDimensions(targetArrayDimensionsSize, targetArrayDimensions, valueArrayDimensionsSize, - valueArrayDimensions); -} - -UA_Boolean compatibleValue(UA_Server *server, const UA_NodeId *targetDataTypeId, UA_Int32 targetValueRank, - size_t targetArrayDimensionsSize, const UA_UInt32 *targetArrayDimensions, - const UA_Variant *value, const UA_NumericRange *range) { - /* Empty variant is only allowed for BaseDataType */ - if (!value->type) { - if (UA_NodeId_equal(targetDataTypeId, &UA_TYPES[UA_TYPES_VARIANT].typeId) || - UA_NodeId_equal(targetDataTypeId, &UA_NODEID_NULL)) - return true; - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER, - "Only Variables with data type BaseDataType may contain " - "a null (empty) value"); - return false; - } - - /* Has the value a subtype of the required type? BaseDataType (Variant) can - * be anything... */ - if (!compatibleDataType(server, &value->type->typeId, targetDataTypeId)) return false; - - /* Array dimensions are checked later when writing the range */ - if (range) return true; - - /* See if the array dimensions match. */ - if (!compatibleValueArrayDimensions(value, targetArrayDimensionsSize, targetArrayDimensions)) return false; - - /* Check if the valuerank allows for the value dimension */ - return compatibleValueRankValue(targetValueRank, value); -} - -/*****************/ -/* Write Service */ -/*****************/ - -static void adjustValue(UA_Server *server, UA_Variant *value, const UA_NodeId *targetDataTypeId) { - const UA_DataType *targetDataType = UA_findDataType(targetDataTypeId); - if (!targetDataType) return; - - /* A string is written to a byte array. the valuerank and array dimensions - * are checked later */ - if (targetDataType == &UA_TYPES[UA_TYPES_BYTE] && value->type == &UA_TYPES[UA_TYPES_BYTESTRING] && - UA_Variant_isScalar(value)) { - UA_ByteString *str = (UA_ByteString *)value->data; - value->type = &UA_TYPES[UA_TYPES_BYTE]; - value->arrayLength = str->length; - value->data = str->data; - return; - } - - /* An enum was sent as an int32, or an opaque type as a bytestring. This - * is detected with the typeIndex indicating the "true" datatype. */ - enum type_equivalence te1 = typeEquivalence(targetDataType); - enum type_equivalence te2 = typeEquivalence(value->type); - if (te1 != TYPE_EQUIVALENCE_NONE && te1 == te2) { - value->type = targetDataType; - return; - } - - /* No more possible equivalencies */ -} - -/* Stack layout: ... | node | type */ -static UA_StatusCode writeArrayDimensionsAttribute(UA_Server *server, UA_Session *session, UA_VariableNode *node, - const UA_VariableTypeNode *type, size_t arrayDimensionsSize, - UA_UInt32 *arrayDimensions) { - UA_assert(node != NULL); - UA_assert(type != NULL); - - /* If this is a variabletype, there must be no instances or subtypes of it - * when we do the change */ - if (node->nodeClass == UA_NODECLASS_VARIABLETYPE && UA_Node_hasSubTypeOrInstances((UA_Node *)node)) { - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER, "Cannot change a variable type with existing instances"); - return UA_STATUSCODE_BADINTERNALERROR; - } - - /* Check that the array dimensions match with the valuerank */ - if (!compatibleValueRankArrayDimensions(node->valueRank, arrayDimensionsSize)) { - UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, - "The current value rank does not match the new array dimensions"); - return UA_STATUSCODE_BADTYPEMISMATCH; - } - - /* Check if the array dimensions match with the wildcards in the - * variabletype (dimension length 0) */ - if (type->arrayDimensions && - !compatibleArrayDimensions(type->arrayDimensionsSize, type->arrayDimensions, arrayDimensionsSize, - arrayDimensions)) { - UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, "Array dimensions in the variable type do not match"); - return UA_STATUSCODE_BADTYPEMISMATCH; - } - - /* Check if the current value is compatible with the array dimensions */ - UA_DataValue value; - UA_DataValue_init(&value); - UA_StatusCode retval = readValueAttribute(server, session, node, &value); - if (retval != UA_STATUSCODE_GOOD) return retval; - if (value.hasValue) { - if (!compatibleValueArrayDimensions(&value.value, arrayDimensionsSize, arrayDimensions)) - retval = UA_STATUSCODE_BADTYPEMISMATCH; - UA_DataValue_deleteMembers(&value); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, "Array dimensions in the current value do not match"); - return retval; - } - } - - /* Ok, apply */ - UA_UInt32 *oldArrayDimensions = node->arrayDimensions; - retval = - UA_Array_copy(arrayDimensions, arrayDimensionsSize, (void **)&node->arrayDimensions, &UA_TYPES[UA_TYPES_UINT32]); - if (retval != UA_STATUSCODE_GOOD) return retval; - UA_free(oldArrayDimensions); - node->arrayDimensionsSize = arrayDimensionsSize; - return UA_STATUSCODE_GOOD; -} - -/* Stack layout: ... | node | type */ -static UA_StatusCode writeValueRankAttribute(UA_Server *server, UA_Session *session, UA_VariableNode *node, - const UA_VariableTypeNode *type, UA_Int32 valueRank) { - UA_assert(node != NULL); - UA_assert(type != NULL); - - UA_Int32 constraintValueRank = type->valueRank; - - /* If this is a variabletype, there must be no instances or subtypes of it - * when we do the change */ - if (node->nodeClass == UA_NODECLASS_VARIABLETYPE && UA_Node_hasSubTypeOrInstances((const UA_Node *)node)) - return UA_STATUSCODE_BADINTERNALERROR; - - /* Check if the valuerank of the variabletype allows the change. */ - if (!compatibleValueRanks(valueRank, constraintValueRank)) return UA_STATUSCODE_BADTYPEMISMATCH; - - /* Check if the new valuerank is compatible with the array dimensions. Use - * the read service to handle data sources. */ - size_t arrayDims = node->arrayDimensionsSize; - if (arrayDims == 0) { - /* the value could be an array with no arrayDimensions defined. - dimensions zero indicate a scalar for compatibleValueRankArrayDimensions. */ - UA_DataValue value; - UA_DataValue_init(&value); - UA_StatusCode retval = readValueAttribute(server, session, node, &value); - if (retval != UA_STATUSCODE_GOOD) return retval; - if (!value.hasValue || !value.value.type) { - /* no value -> apply */ - node->valueRank = valueRank; - return UA_STATUSCODE_GOOD; - } - if (!UA_Variant_isScalar(&value.value)) arrayDims = 1; - UA_DataValue_deleteMembers(&value); - } - if (!compatibleValueRankArrayDimensions(valueRank, arrayDims)) return UA_STATUSCODE_BADTYPEMISMATCH; - - /* All good, apply the change */ - node->valueRank = valueRank; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode writeDataTypeAttribute(UA_Server *server, UA_Session *session, UA_VariableNode *node, - const UA_VariableTypeNode *type, const UA_NodeId *dataType) { - UA_assert(node != NULL); - UA_assert(type != NULL); - - /* If this is a variabletype, there must be no instances or subtypes of it - when we do the change */ - if (node->nodeClass == UA_NODECLASS_VARIABLETYPE && UA_Node_hasSubTypeOrInstances((const UA_Node *)node)) - return UA_STATUSCODE_BADINTERNALERROR; - - /* Does the new type match the constraints of the variabletype? */ - if (!compatibleDataType(server, dataType, &type->dataType)) return UA_STATUSCODE_BADTYPEMISMATCH; - - /* Check if the current value would match the new type */ - UA_DataValue value; - UA_DataValue_init(&value); - UA_StatusCode retval = readValueAttribute(server, session, node, &value); - if (retval != UA_STATUSCODE_GOOD) return retval; - if (value.hasValue) { - if (!compatibleValue(server, dataType, node->valueRank, node->arrayDimensionsSize, node->arrayDimensions, - &value.value, NULL)) - retval = UA_STATUSCODE_BADTYPEMISMATCH; - UA_DataValue_deleteMembers(&value); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, "The current value does not match the new data type"); - return retval; - } - } - - /* Replace the datatype nodeid */ - UA_NodeId dtCopy = node->dataType; - retval = UA_NodeId_copy(dataType, &node->dataType); - if (retval != UA_STATUSCODE_GOOD) { - node->dataType = dtCopy; - return retval; - } - UA_NodeId_deleteMembers(&dtCopy); - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode writeValueAttributeWithoutRange(UA_VariableNode *node, const UA_DataValue *value) { - UA_DataValue new_value; - UA_StatusCode retval = UA_DataValue_copy(value, &new_value); - if (retval != UA_STATUSCODE_GOOD) return retval; - UA_DataValue_deleteMembers(&node->value.data.value); - node->value.data.value = new_value; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode writeValueAttributeWithRange(UA_VariableNode *node, const UA_DataValue *value, - const UA_NumericRange *rangeptr) { - /* Value on both sides? */ - if (value->status != node->value.data.value.status || !value->hasValue || !node->value.data.value.hasValue) - return UA_STATUSCODE_BADINDEXRANGEINVALID; - - /* Make scalar a one-entry array for range matching */ - UA_Variant editableValue; - const UA_Variant *v = &value->value; - if (UA_Variant_isScalar(&value->value)) { - editableValue = value->value; - editableValue.arrayLength = 1; - v = &editableValue; - } - - /* Write the value */ - UA_StatusCode retval = UA_Variant_setRangeCopy(&node->value.data.value.value, v->data, v->arrayLength, *rangeptr); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Write the status and timestamps */ - node->value.data.value.hasStatus = value->hasStatus; - node->value.data.value.status = value->status; - node->value.data.value.hasSourceTimestamp = value->hasSourceTimestamp; - node->value.data.value.sourceTimestamp = value->sourceTimestamp; - node->value.data.value.hasSourcePicoseconds = value->hasSourcePicoseconds; - node->value.data.value.sourcePicoseconds = value->sourcePicoseconds; - return UA_STATUSCODE_GOOD; -} - -/* Stack layout: ... | node */ -static UA_StatusCode writeValueAttribute(UA_Server *server, UA_Session *session, UA_VariableNode *node, - const UA_DataValue *value, const UA_String *indexRange) { - UA_assert(node != NULL); - - /* Parse the range */ - UA_NumericRange range; - UA_NumericRange *rangeptr = NULL; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (indexRange && indexRange->length > 0) { - retval = UA_NumericRange_parseFromString(&range, indexRange); - if (retval != UA_STATUSCODE_GOOD) return retval; - rangeptr = ⦥ - } - - /* Created an editable version. The data is not touched. Only the variant - * "container". */ - UA_DataValue adjustedValue = *value; - - /* Type checking. May change the type of editableValue */ - if (value->hasValue && value->value.type) { - adjustValue(server, &adjustedValue.value, &node->dataType); - - /* The value may be an extension object, especially the nodeset compiler uses - * extension objects to write variable values. - * If value is an extension object we check if the current node value is also an extension object. - */ - UA_Boolean compatible; - if (value->value.type->typeId.identifierType == UA_NODEIDTYPE_NUMERIC && - value->value.type->typeId.identifier.numeric == UA_NS0ID_STRUCTURE) { - const UA_NodeId nodeDataType = UA_NODEID_NUMERIC(0, UA_NS0ID_STRUCTURE); - compatible = compatibleValue(server, &nodeDataType, node->valueRank, node->arrayDimensionsSize, - node->arrayDimensions, &adjustedValue.value, rangeptr); - } else { - compatible = compatibleValue(server, &node->dataType, node->valueRank, node->arrayDimensionsSize, - node->arrayDimensions, &adjustedValue.value, rangeptr); - } - - if (!compatible) { - if (rangeptr) UA_free(range.dimensions); - return UA_STATUSCODE_BADTYPEMISMATCH; - } - } - - /* Set the source timestamp if there is none */ - if (!adjustedValue.hasSourceTimestamp) { - adjustedValue.sourceTimestamp = UA_DateTime_now(); - adjustedValue.hasSourceTimestamp = true; - } - - /* Ok, do it */ - if (node->valueSource == UA_VALUESOURCE_DATA) { - if (!rangeptr) - retval = writeValueAttributeWithoutRange(node, &adjustedValue); - else - retval = writeValueAttributeWithRange(node, &adjustedValue, rangeptr); - - /* Callback after writing */ - if (retval == UA_STATUSCODE_GOOD && node->value.data.callback.onWrite) - node->value.data.callback.onWrite(server, &session->sessionId, session->sessionHandle, &node->nodeId, - node->context, rangeptr, &adjustedValue); - } else { - if (node->value.dataSource.write) { - retval = node->value.dataSource.write(server, &session->sessionId, session->sessionHandle, &node->nodeId, - node->context, rangeptr, &adjustedValue); - } else { - retval = UA_STATUSCODE_BADWRITENOTSUPPORTED; - } - } - - /* Clean up */ - if (rangeptr) UA_free(range.dimensions); - return retval; -} - -static UA_StatusCode writeIsAbstractAttribute(UA_Node *node, UA_Boolean value) { - switch (node->nodeClass) { - case UA_NODECLASS_OBJECTTYPE: - ((UA_ObjectTypeNode *)node)->isAbstract = value; - break; - case UA_NODECLASS_REFERENCETYPE: - ((UA_ReferenceTypeNode *)node)->isAbstract = value; - break; - case UA_NODECLASS_VARIABLETYPE: - ((UA_VariableTypeNode *)node)->isAbstract = value; - break; - case UA_NODECLASS_DATATYPE: - ((UA_DataTypeNode *)node)->isAbstract = value; - break; - default: - return UA_STATUSCODE_BADNODECLASSINVALID; - } - return UA_STATUSCODE_GOOD; -} - -/*****************/ -/* Write Service */ -/*****************/ - -#define CHECK_DATATYPE_SCALAR(EXP_DT) \ - if (!wvalue->value.hasValue || &UA_TYPES[UA_TYPES_##EXP_DT] != wvalue->value.value.type || \ - !UA_Variant_isScalar(&wvalue->value.value)) { \ - retval = UA_STATUSCODE_BADTYPEMISMATCH; \ - break; \ - } - -#define CHECK_DATATYPE_ARRAY(EXP_DT) \ - if (!wvalue->value.hasValue || &UA_TYPES[UA_TYPES_##EXP_DT] != wvalue->value.value.type || \ - UA_Variant_isScalar(&wvalue->value.value)) { \ - retval = UA_STATUSCODE_BADTYPEMISMATCH; \ - break; \ - } - -#define CHECK_NODECLASS_WRITE(CLASS) \ - if ((node->nodeClass & (CLASS)) == 0) { \ - retval = UA_STATUSCODE_BADNODECLASSINVALID; \ - break; \ - } - -#define CHECK_USERWRITEMASK(mask) \ - if (!(userWriteMask & (mask))) { \ - retval = UA_STATUSCODE_BADUSERACCESSDENIED; \ - break; \ - } - -#define GET_NODETYPE \ - type = (const UA_VariableTypeNode *)getNodeType(server, node); \ - if (!type) { \ - retval = UA_STATUSCODE_BADTYPEMISMATCH; \ - break; \ - } - -/* This function implements the main part of the write service and operates on a - copy of the node (not in single-threaded mode). */ -static UA_StatusCode copyAttributeIntoNode(UA_Server *server, UA_Session *session, UA_Node *node, - const UA_WriteValue *wvalue) { - const void *value = wvalue->value.value.data; - UA_UInt32 userWriteMask = getUserWriteMask(server, session, node); - UA_StatusCode retval = UA_STATUSCODE_GOOD; - - const UA_VariableTypeNode *type; - - switch (wvalue->attributeId) { - case UA_ATTRIBUTEID_NODEID: - case UA_ATTRIBUTEID_NODECLASS: - case UA_ATTRIBUTEID_USERWRITEMASK: - case UA_ATTRIBUTEID_USERACCESSLEVEL: - case UA_ATTRIBUTEID_USEREXECUTABLE: - retval = UA_STATUSCODE_BADWRITENOTSUPPORTED; - break; - case UA_ATTRIBUTEID_BROWSENAME: - CHECK_USERWRITEMASK(UA_WRITEMASK_BROWSENAME); - CHECK_DATATYPE_SCALAR(QUALIFIEDNAME); - UA_QualifiedName_deleteMembers(&node->browseName); - UA_QualifiedName_copy((const UA_QualifiedName *)value, &node->browseName); - break; - case UA_ATTRIBUTEID_DISPLAYNAME: - CHECK_USERWRITEMASK(UA_WRITEMASK_DISPLAYNAME); - CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT); - UA_LocalizedText_deleteMembers(&node->displayName); - UA_LocalizedText_copy((const UA_LocalizedText *)value, &node->displayName); - break; - case UA_ATTRIBUTEID_DESCRIPTION: - CHECK_USERWRITEMASK(UA_WRITEMASK_DESCRIPTION); - CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT); - UA_LocalizedText_deleteMembers(&node->description); - UA_LocalizedText_copy((const UA_LocalizedText *)value, &node->description); - break; - case UA_ATTRIBUTEID_WRITEMASK: - CHECK_USERWRITEMASK(UA_WRITEMASK_WRITEMASK); - CHECK_DATATYPE_SCALAR(UINT32); - node->writeMask = *(const UA_UInt32 *)value; - break; - case UA_ATTRIBUTEID_ISABSTRACT: - CHECK_USERWRITEMASK(UA_WRITEMASK_ISABSTRACT); - CHECK_DATATYPE_SCALAR(BOOLEAN); - retval = writeIsAbstractAttribute(node, *(const UA_Boolean *)value); - break; - case UA_ATTRIBUTEID_SYMMETRIC: - CHECK_NODECLASS_WRITE(UA_NODECLASS_REFERENCETYPE); - CHECK_USERWRITEMASK(UA_WRITEMASK_SYMMETRIC); - CHECK_DATATYPE_SCALAR(BOOLEAN); - ((UA_ReferenceTypeNode *)node)->symmetric = *(const UA_Boolean *)value; - break; - case UA_ATTRIBUTEID_INVERSENAME: - CHECK_NODECLASS_WRITE(UA_NODECLASS_REFERENCETYPE); - CHECK_USERWRITEMASK(UA_WRITEMASK_INVERSENAME); - CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT); - UA_LocalizedText_deleteMembers(&((UA_ReferenceTypeNode *)node)->inverseName); - UA_LocalizedText_copy((const UA_LocalizedText *)value, &((UA_ReferenceTypeNode *)node)->inverseName); - break; - case UA_ATTRIBUTEID_CONTAINSNOLOOPS: - CHECK_NODECLASS_WRITE(UA_NODECLASS_VIEW); - CHECK_USERWRITEMASK(UA_WRITEMASK_CONTAINSNOLOOPS); - CHECK_DATATYPE_SCALAR(BOOLEAN); - ((UA_ViewNode *)node)->containsNoLoops = *(const UA_Boolean *)value; - break; - case UA_ATTRIBUTEID_EVENTNOTIFIER: - CHECK_NODECLASS_WRITE(UA_NODECLASS_VIEW | UA_NODECLASS_OBJECT); - CHECK_USERWRITEMASK(UA_WRITEMASK_EVENTNOTIFIER); - CHECK_DATATYPE_SCALAR(BYTE); - ((UA_ViewNode *)node)->eventNotifier = *(const UA_Byte *)value; - break; - case UA_ATTRIBUTEID_VALUE: - CHECK_NODECLASS_WRITE(UA_NODECLASS_VARIABLE | UA_NODECLASS_VARIABLETYPE); - if (node->nodeClass == UA_NODECLASS_VARIABLE) { - /* The access to a value variable is granted via the AccessLevel - * and UserAccessLevel attributes */ - UA_Byte accessLevel = getAccessLevel(server, session, (const UA_VariableNode *)node); - if (!(accessLevel & (UA_ACCESSLEVELMASK_WRITE))) { - retval = UA_STATUSCODE_BADNOTWRITABLE; - break; - } - accessLevel = getUserAccessLevel(server, session, (const UA_VariableNode *)node); - if (!(accessLevel & (UA_ACCESSLEVELMASK_WRITE))) { - retval = UA_STATUSCODE_BADUSERACCESSDENIED; - break; - } - } else { /* UA_NODECLASS_VARIABLETYPE */ - CHECK_USERWRITEMASK(UA_WRITEMASK_VALUEFORVARIABLETYPE); - } - retval = writeValueAttribute(server, session, (UA_VariableNode *)node, &wvalue->value, &wvalue->indexRange); - break; - case UA_ATTRIBUTEID_DATATYPE: - CHECK_NODECLASS_WRITE(UA_NODECLASS_VARIABLE | UA_NODECLASS_VARIABLETYPE); - CHECK_USERWRITEMASK(UA_WRITEMASK_DATATYPE); - CHECK_DATATYPE_SCALAR(NODEID); - GET_NODETYPE - retval = writeDataTypeAttribute(server, session, (UA_VariableNode *)node, type, (const UA_NodeId *)value); - UA_Nodestore_release(server, (const UA_Node *)type); - break; - case UA_ATTRIBUTEID_VALUERANK: - CHECK_NODECLASS_WRITE(UA_NODECLASS_VARIABLE | UA_NODECLASS_VARIABLETYPE); - CHECK_USERWRITEMASK(UA_WRITEMASK_VALUERANK); - CHECK_DATATYPE_SCALAR(INT32); - GET_NODETYPE - retval = writeValueRankAttribute(server, session, (UA_VariableNode *)node, type, *(const UA_Int32 *)value); - UA_Nodestore_release(server, (const UA_Node *)type); - break; - case UA_ATTRIBUTEID_ARRAYDIMENSIONS: - CHECK_NODECLASS_WRITE(UA_NODECLASS_VARIABLE | UA_NODECLASS_VARIABLETYPE); - CHECK_USERWRITEMASK(UA_WRITEMASK_ARRRAYDIMENSIONS); - CHECK_DATATYPE_ARRAY(UINT32); - GET_NODETYPE - retval = writeArrayDimensionsAttribute(server, session, (UA_VariableNode *)node, type, - wvalue->value.value.arrayLength, (UA_UInt32 *)wvalue->value.value.data); - UA_Nodestore_release(server, (const UA_Node *)type); - break; - case UA_ATTRIBUTEID_ACCESSLEVEL: - CHECK_NODECLASS_WRITE(UA_NODECLASS_VARIABLE); - CHECK_USERWRITEMASK(UA_WRITEMASK_ACCESSLEVEL); - CHECK_DATATYPE_SCALAR(BYTE); - ((UA_VariableNode *)node)->accessLevel = *(const UA_Byte *)value; - break; - case UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL: - CHECK_NODECLASS_WRITE(UA_NODECLASS_VARIABLE); - CHECK_USERWRITEMASK(UA_WRITEMASK_MINIMUMSAMPLINGINTERVAL); - CHECK_DATATYPE_SCALAR(DOUBLE); - ((UA_VariableNode *)node)->minimumSamplingInterval = *(const UA_Double *)value; - break; - case UA_ATTRIBUTEID_HISTORIZING: - CHECK_NODECLASS_WRITE(UA_NODECLASS_VARIABLE); - CHECK_USERWRITEMASK(UA_WRITEMASK_HISTORIZING); - CHECK_DATATYPE_SCALAR(BOOLEAN); - ((UA_VariableNode *)node)->historizing = *(const UA_Boolean *)value; - break; - case UA_ATTRIBUTEID_EXECUTABLE: - CHECK_NODECLASS_WRITE(UA_NODECLASS_METHOD); - CHECK_USERWRITEMASK(UA_WRITEMASK_EXECUTABLE); - CHECK_DATATYPE_SCALAR(BOOLEAN); - ((UA_MethodNode *)node)->executable = *(const UA_Boolean *)value; - break; - default: - retval = UA_STATUSCODE_BADATTRIBUTEIDINVALID; - break; - } - if (retval != UA_STATUSCODE_GOOD) - UA_LOG_INFO_SESSION(server->config.logger, session, "WriteRequest returned status code %s", - UA_StatusCode_name(retval)); - return retval; -} - -static void Operation_Write(UA_Server *server, UA_Session *session, UA_WriteValue *wv, UA_StatusCode *result) { - *result = UA_Server_editNode(server, session, &wv->nodeId, (UA_EditNodeCallback)copyAttributeIntoNode, wv); -} - -void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest *request, UA_WriteResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing WriteRequest"); - - if (server->config.maxNodesPerWrite != 0 && request->nodesToWriteSize > server->config.maxNodesPerWrite) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)Operation_Write, &request->nodesToWriteSize, &UA_TYPES[UA_TYPES_WRITEVALUE], - &response->resultsSize, &UA_TYPES[UA_TYPES_STATUSCODE]); -} - -UA_StatusCode UA_Server_write(UA_Server *server, const UA_WriteValue *value) { - UA_StatusCode retval = - UA_Server_editNode(server, &adminSession, &value->nodeId, (UA_EditNodeCallback)copyAttributeIntoNode, value); - return retval; -} - -/* Convenience function to be wrapped into inline functions */ -UA_StatusCode __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, - const UA_DataType *attr_type, const void *attr) { - UA_WriteValue wvalue; - UA_WriteValue_init(&wvalue); - wvalue.nodeId = *nodeId; - wvalue.attributeId = attributeId; - wvalue.value.hasValue = true; - if (attr_type != &UA_TYPES[UA_TYPES_VARIANT]) { - /* hacked cast. the target WriteValue is used as const anyway */ - UA_Variant_setScalar(&wvalue.value.value, (void *)(uintptr_t)attr, attr_type); - } else { - wvalue.value.value = *(const UA_Variant *)attr; - } - return UA_Server_write(server, &wvalue); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_services_discovery.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef _MSC_VER -#ifndef UNDER_CE -#include //access -#define access _access -#endif -#else -#include //access -#endif - -#ifdef UA_ENABLE_DISCOVERY - -static UA_StatusCode setApplicationDescriptionFromRegisteredServer(const UA_FindServersRequest *request, - UA_ApplicationDescription *target, - const UA_RegisteredServer *registeredServer) { - UA_StatusCode retval = UA_STATUSCODE_GOOD; - - UA_ApplicationDescription_init(target); - retval |= UA_String_copy(®isteredServer->serverUri, &target->applicationUri); - retval |= UA_String_copy(®isteredServer->productUri, &target->productUri); - - // if the client requests a specific locale, select the corresponding server name - if (request->localeIdsSize) { - UA_Boolean appNameFound = UA_FALSE; - for (size_t i = 0; i < request->localeIdsSize && !appNameFound; i++) { - for (size_t j = 0; j < registeredServer->serverNamesSize; j++) { - if (UA_String_equal(&request->localeIds[i], ®isteredServer->serverNames[j].locale)) { - retval |= UA_LocalizedText_copy(®isteredServer->serverNames[j], &target->applicationName); - appNameFound = UA_TRUE; - break; - } - } - } - - // server does not have the requested local, therefore we can select the - // most suitable one - if (!appNameFound && registeredServer->serverNamesSize) - retval |= UA_LocalizedText_copy(®isteredServer->serverNames[0], &target->applicationName); - } else if (registeredServer->serverNamesSize) { - // just take the first name - retval |= UA_LocalizedText_copy(®isteredServer->serverNames[0], &target->applicationName); - } - - target->applicationType = registeredServer->serverType; - retval |= UA_String_copy(®isteredServer->gatewayServerUri, &target->gatewayServerUri); - // TODO where do we get the discoveryProfileUri for application data? - - target->discoveryUrlsSize = registeredServer->discoveryUrlsSize; - if (registeredServer->discoveryUrlsSize) { - size_t duSize = sizeof(UA_String) * registeredServer->discoveryUrlsSize; - target->discoveryUrls = (UA_String *)UA_malloc(duSize); - if (!target->discoveryUrls) return UA_STATUSCODE_BADOUTOFMEMORY; - for (size_t i = 0; i < registeredServer->discoveryUrlsSize; i++) - retval |= UA_String_copy(®isteredServer->discoveryUrls[i], &target->discoveryUrls[i]); - } - - return retval; -} -#endif - -static UA_StatusCode setApplicationDescriptionFromServer(UA_ApplicationDescription *target, const UA_Server *server) { - /* Copy ApplicationDescription from the config */ - - UA_StatusCode result = UA_ApplicationDescription_copy(&server->config.applicationDescription, target); - if (result != UA_STATUSCODE_GOOD) { - return result; - } - // UaExpert does not list DiscoveryServer, thus set it to Server - // See http://forum.unified-automation.com/topic1987.html - if (target->applicationType == UA_APPLICATIONTYPE_DISCOVERYSERVER) - target->applicationType = UA_APPLICATIONTYPE_SERVER; - - /* add the discoveryUrls from the networklayers */ - size_t discSize = sizeof(UA_String) * (target->discoveryUrlsSize + server->config.networkLayersSize); - UA_String *disc = (UA_String *)UA_realloc(target->discoveryUrls, discSize); - if (!disc) { - return UA_STATUSCODE_BADOUTOFMEMORY; - } - size_t existing = target->discoveryUrlsSize; - target->discoveryUrls = disc; - target->discoveryUrlsSize += server->config.networkLayersSize; - - // TODO: Add nl only if discoveryUrl not already present - for (size_t i = 0; i < server->config.networkLayersSize; i++) { - UA_ServerNetworkLayer *nl = &server->config.networkLayers[i]; - UA_String_copy(&nl->discoveryUrl, &target->discoveryUrls[existing + i]); - } - return UA_STATUSCODE_GOOD; -} - -void Service_FindServers(UA_Server *server, UA_Session *session, const UA_FindServersRequest *request, - UA_FindServersResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing FindServersRequest"); - - size_t foundServersSize = 0; - UA_ApplicationDescription *foundServers = NULL; - - UA_Boolean addSelf = UA_FALSE; - // temporarily store all the pointers which we found to avoid reiterating - // through the list - UA_RegisteredServer **foundServerFilteredPointer = NULL; - -#ifdef UA_ENABLE_DISCOVERY - // check if client only requested a specific set of servers - if (request->serverUrisSize) { - size_t fsfpSize = sizeof(UA_RegisteredServer *) * server->registeredServersSize; - foundServerFilteredPointer = (UA_RegisteredServer **)UA_malloc(fsfpSize); - if (!foundServerFilteredPointer) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - - for (size_t i = 0; i < request->serverUrisSize; i++) { - if (!addSelf && UA_String_equal(&request->serverUris[i], &server->config.applicationDescription.applicationUri)) { - addSelf = UA_TRUE; - } else { - registeredServer_list_entry *current; - LIST_FOREACH(current, &server->registeredServers, pointers) { - if (UA_String_equal(¤t->registeredServer.serverUri, &request->serverUris[i])) { - // check if entry already in list: - UA_Boolean existing = false; - for (size_t j = 0; j < foundServersSize; j++) { - if (UA_String_equal(&foundServerFilteredPointer[j]->serverUri, &request->serverUris[i])) { - existing = true; - break; - } - } - if (!existing) foundServerFilteredPointer[foundServersSize++] = ¤t->registeredServer; - break; - } - } - } - } - - if (addSelf) foundServersSize++; - - } else { - addSelf = true; - // self + registered servers - foundServersSize = 1 + server->registeredServersSize; - } -#else - if (request->serverUrisSize) { - for (size_t i = 0; i < request->serverUrisSize; i++) { - if (UA_String_equal(&request->serverUris[i], &server->config.applicationDescription.applicationUri)) { - addSelf = UA_TRUE; - foundServersSize = 1; - break; - } - } - } else { - addSelf = UA_TRUE; - foundServersSize = 1; - } -#endif - - if (foundServersSize) { - size_t fsSize = sizeof(UA_ApplicationDescription) * foundServersSize; - foundServers = (UA_ApplicationDescription *)UA_malloc(fsSize); - if (!foundServers) { - if (foundServerFilteredPointer) UA_free(foundServerFilteredPointer); - response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - - if (addSelf) { - response->responseHeader.serviceResult = setApplicationDescriptionFromServer(&foundServers[0], server); - if (response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_free(foundServers); - if (foundServerFilteredPointer) UA_free(foundServerFilteredPointer); - return; - } - } - -#ifdef UA_ENABLE_DISCOVERY - size_t currentIndex = 0; - if (addSelf) currentIndex++; - - // add all the registered servers to the list - - if (foundServerFilteredPointer) { - // use filtered list because client only requested specific uris - // -1 because foundServersSize also includes this self server - size_t iterCount = addSelf ? foundServersSize - 1 : foundServersSize; - for (size_t i = 0; i < iterCount; i++) { - response->responseHeader.serviceResult = setApplicationDescriptionFromRegisteredServer( - request, &foundServers[currentIndex++], foundServerFilteredPointer[i]); - if (response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_free(foundServers); - UA_free(foundServerFilteredPointer); - return; - } - } - UA_free(foundServerFilteredPointer); - foundServerFilteredPointer = NULL; - } else { - registeredServer_list_entry *current; - LIST_FOREACH(current, &server->registeredServers, pointers) { - response->responseHeader.serviceResult = setApplicationDescriptionFromRegisteredServer( - request, &foundServers[currentIndex++], ¤t->registeredServer); - if (response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_free(foundServers); - return; - } - } - } -#endif - } - - if (foundServerFilteredPointer) UA_free(foundServerFilteredPointer); - - response->servers = foundServers; - response->serversSize = foundServersSize; -} - -void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEndpointsRequest *request, - UA_GetEndpointsResponse *response) { - /* If the client expects to see a specific endpointurl, mirror it back. If - not, clone the endpoints with the discovery url of all networklayers. */ - const UA_String *endpointUrl = &request->endpointUrl; - if (endpointUrl->length > 0) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, - "Processing GetEndpointsRequest with endpointUrl " UA_PRINTF_STRING_FORMAT, - UA_PRINTF_STRING_DATA(*endpointUrl)); - } else { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing GetEndpointsRequest with an empty endpointUrl"); - } - - /* test if the supported binary profile shall be returned */ - size_t reSize = sizeof(UA_Boolean) * server->config.endpointsSize; - UA_Boolean *relevant_endpoints = (UA_Boolean *)UA_alloca(reSize); - memset(relevant_endpoints, 0, sizeof(UA_Boolean) * server->config.endpointsSize); - size_t relevant_count = 0; - if (request->profileUrisSize == 0) { - for (size_t j = 0; j < server->config.endpointsSize; ++j) relevant_endpoints[j] = true; - relevant_count = server->config.endpointsSize; - } else { - for (size_t j = 0; j < server->config.endpointsSize; ++j) { - for (size_t i = 0; i < request->profileUrisSize; ++i) { - if (!UA_String_equal(&request->profileUris[i], - &server->config.endpoints[j].endpointDescription.transportProfileUri)) - continue; - relevant_endpoints[j] = true; - ++relevant_count; - break; - } - } - } - - if (relevant_count == 0) { - response->endpointsSize = 0; - return; - } - - /* Clone the endpoint for each networklayer? */ - size_t clone_times = 1; - UA_Boolean nl_endpointurl = false; - if (endpointUrl->length == 0) { - clone_times = server->config.networkLayersSize; - nl_endpointurl = true; - } - - response->endpoints = - (UA_EndpointDescription *)UA_Array_new(relevant_count * clone_times, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); - if (!response->endpoints) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - response->endpointsSize = relevant_count * clone_times; - - size_t k = 0; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - for (size_t i = 0; i < clone_times; ++i) { - if (nl_endpointurl) endpointUrl = &server->config.networkLayers[i].discoveryUrl; - for (size_t j = 0; j < server->config.endpointsSize; ++j) { - if (!relevant_endpoints[j]) continue; - retval |= UA_EndpointDescription_copy(&server->config.endpoints[j].endpointDescription, &response->endpoints[k]); - retval |= UA_String_copy(endpointUrl, &response->endpoints[k].endpointUrl); - ++k; - } - } - - if (retval != UA_STATUSCODE_GOOD) { - response->responseHeader.serviceResult = retval; - UA_Array_delete(response->endpoints, response->endpointsSize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); - response->endpoints = NULL; - response->endpointsSize = 0; - return; - } -} - -#ifdef UA_ENABLE_DISCOVERY - -#ifdef UA_ENABLE_MULTITHREADING -static void freeEntry(UA_Server *server, void *entry) { UA_free(entry); } -#endif - -static void process_RegisterServer(UA_Server *server, UA_Session *session, const UA_RequestHeader *requestHeader, - const UA_RegisteredServer *requestServer, - const size_t requestDiscoveryConfigurationSize, - const UA_ExtensionObject *requestDiscoveryConfiguration, - UA_ResponseHeader *responseHeader, size_t *responseConfigurationResultsSize, - UA_StatusCode **responseConfigurationResults, size_t *responseDiagnosticInfosSize, - UA_DiagnosticInfo *responseDiagnosticInfos) { - /* Find the server from the request in the registered list */ - registeredServer_list_entry *current; - registeredServer_list_entry *registeredServer_entry = NULL; - LIST_FOREACH(current, &server->registeredServers, pointers) { - if (UA_String_equal(¤t->registeredServer.serverUri, &requestServer->serverUri)) { - registeredServer_entry = current; - break; - } - } - - UA_MdnsDiscoveryConfiguration *mdnsConfig = NULL; - - const UA_String *mdnsServerName = NULL; - if (requestDiscoveryConfigurationSize) { - *responseConfigurationResults = - (UA_StatusCode *)UA_Array_new(requestDiscoveryConfigurationSize, &UA_TYPES[UA_TYPES_STATUSCODE]); - if (!(*responseConfigurationResults)) { - responseHeader->serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - *responseConfigurationResultsSize = requestDiscoveryConfigurationSize; - - for (size_t i = 0; i < requestDiscoveryConfigurationSize; i++) { - const UA_ExtensionObject *object = &requestDiscoveryConfiguration[i]; - if (!mdnsConfig && - (object->encoding == UA_EXTENSIONOBJECT_DECODED || object->encoding == UA_EXTENSIONOBJECT_DECODED_NODELETE) && - (object->content.decoded.type == &UA_TYPES[UA_TYPES_MDNSDISCOVERYCONFIGURATION])) { - mdnsConfig = (UA_MdnsDiscoveryConfiguration *)object->content.decoded.data; - mdnsServerName = &mdnsConfig->mdnsServerName; - (*responseConfigurationResults)[i] = UA_STATUSCODE_GOOD; - } else { - (*responseConfigurationResults)[i] = UA_STATUSCODE_BADNOTSUPPORTED; - } - } - } - - if (!mdnsServerName && requestServer->serverNamesSize) mdnsServerName = &requestServer->serverNames[0].text; - - if (!mdnsServerName) { - responseHeader->serviceResult = UA_STATUSCODE_BADSERVERNAMEMISSING; - return; - } - - if (requestServer->discoveryUrlsSize == 0) { - responseHeader->serviceResult = UA_STATUSCODE_BADDISCOVERYURLMISSING; - return; - } - - if (requestServer->semaphoreFilePath.length) { -#ifdef UA_ENABLE_DISCOVERY_SEMAPHORE - char *filePath = (char *)UA_malloc(sizeof(char) * requestServer->semaphoreFilePath.length + 1); - if (!filePath) { - UA_LOG_ERROR_SESSION(server->config.logger, session, "Cannot allocate memory for semaphore path. Out of memory."); - responseHeader->serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - memcpy(filePath, requestServer->semaphoreFilePath.data, requestServer->semaphoreFilePath.length); - filePath[requestServer->semaphoreFilePath.length] = '\0'; - if (access(filePath, 0) == -1) { - responseHeader->serviceResult = UA_STATUSCODE_BADSEMPAHOREFILEMISSING; - UA_free(filePath); - return; - } - UA_free(filePath); -#else - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_CLIENT, - "Ignoring semaphore file path. open62541 not compiled " - "with UA_ENABLE_DISCOVERY_SEMAPHORE=ON"); -#endif - } - -#ifdef UA_ENABLE_DISCOVERY_MULTICAST - if (server->config.applicationDescription.applicationType == UA_APPLICATIONTYPE_DISCOVERYSERVER) { - for (size_t i = 0; i < requestServer->discoveryUrlsSize; i++) { - /* create TXT if is online and first index, delete TXT if is offline and last index */ - UA_Boolean updateTxt = - (requestServer->isOnline && i == 0) || (!requestServer->isOnline && i == requestServer->discoveryUrlsSize); - UA_Discovery_update_MdnsForDiscoveryUrl(server, mdnsServerName, mdnsConfig, &requestServer->discoveryUrls[i], - requestServer->isOnline, updateTxt); - } - } -#endif - - if (!requestServer->isOnline) { - // server is shutting down. Remove it from the registered servers list - if (!registeredServer_entry) { - // server not found, show warning - UA_LOG_WARNING_SESSION(server->config.logger, session, "Could not unregister server %.*s. Not registered.", - (int)requestServer->serverUri.length, requestServer->serverUri.data); - responseHeader->serviceResult = UA_STATUSCODE_BADNOTHINGTODO; - return; - } - - if (server->registerServerCallback) - server->registerServerCallback(requestServer, server->registerServerCallbackData); - - // server found, remove from list - LIST_REMOVE(registeredServer_entry, pointers); - UA_RegisteredServer_deleteMembers(®isteredServer_entry->registeredServer); -#ifndef UA_ENABLE_MULTITHREADING - UA_free(registeredServer_entry); - server->registeredServersSize--; -#else - server->registeredServersSize = uatomic_add_return(&server->registeredServersSize, -1); - UA_Server_delayedCallback(server, freeEntry, registeredServer_entry); -#endif - responseHeader->serviceResult = UA_STATUSCODE_GOOD; - return; - } - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (!registeredServer_entry) { - // server not yet registered, register it by adding it to the list - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Registering new server: %.*s", - (int)requestServer->serverUri.length, requestServer->serverUri.data); - - registeredServer_entry = (registeredServer_list_entry *)UA_malloc(sizeof(registeredServer_list_entry)); - if (!registeredServer_entry) { - responseHeader->serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - - LIST_INSERT_HEAD(&server->registeredServers, registeredServer_entry, pointers); -#ifndef UA_ENABLE_MULTITHREADING - server->registeredServersSize++; -#else - server->registeredServersSize = uatomic_add_return(&server->registeredServersSize, 1); -#endif - - if (server->registerServerCallback) - server->registerServerCallback(requestServer, server->registerServerCallbackData); - } else { - UA_RegisteredServer_deleteMembers(®isteredServer_entry->registeredServer); - } - - // copy the data from the request into the list - UA_RegisteredServer_copy(requestServer, ®isteredServer_entry->registeredServer); - registeredServer_entry->lastSeen = UA_DateTime_nowMonotonic(); - responseHeader->serviceResult = retval; -} - -void Service_RegisterServer(UA_Server *server, UA_Session *session, const UA_RegisterServerRequest *request, - UA_RegisterServerResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RegisterServerRequest"); - process_RegisterServer(server, session, &request->requestHeader, &request->server, 0, NULL, &response->responseHeader, - 0, NULL, 0, NULL); -} - -void Service_RegisterServer2(UA_Server *server, UA_Session *session, const UA_RegisterServer2Request *request, - UA_RegisterServer2Response *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RegisterServer2Request"); - process_RegisterServer(server, session, &request->requestHeader, &request->server, - request->discoveryConfigurationSize, request->discoveryConfiguration, - &response->responseHeader, &response->configurationResultsSize, - &response->configurationResults, &response->diagnosticInfosSize, response->diagnosticInfos); -} - -/* Cleanup server registration: If the semaphore file path is set, then it just - * checks the existence of the file. When it is deleted, the registration is - * removed. If there is no semaphore file, then the registration will be removed - * if it is older than 60 minutes. */ -void UA_Discovery_cleanupTimedOut(UA_Server *server, UA_DateTime nowMonotonic) { - UA_DateTime timedOut = nowMonotonic; - // registration is timed out if lastSeen is older than 60 minutes (default - // value, can be modified by user). - if (server->config.discoveryCleanupTimeout) timedOut -= server->config.discoveryCleanupTimeout * UA_DATETIME_SEC; - - registeredServer_list_entry *current, *temp; - LIST_FOREACH_SAFE(current, &server->registeredServers, pointers, temp) { - UA_Boolean semaphoreDeleted = UA_FALSE; - -#ifdef UA_ENABLE_DISCOVERY_SEMAPHORE - if (current->registeredServer.semaphoreFilePath.length) { - size_t fpSize = sizeof(char) * current->registeredServer.semaphoreFilePath.length + 1; - // todo: malloc may fail: return a statuscode - char *filePath = (char *)UA_malloc(fpSize); - if (filePath) { - memcpy(filePath, current->registeredServer.semaphoreFilePath.data, - current->registeredServer.semaphoreFilePath.length); - filePath[current->registeredServer.semaphoreFilePath.length] = '\0'; -#ifdef UNDER_CE - FILE *fp = fopen(filePath, "rb"); - semaphoreDeleted = (fp == NULL); - if (fp) fclose(fp); -#else - semaphoreDeleted = access(filePath, 0) == -1; -#endif - UA_free(filePath); - } else { - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, - "Cannot check registration semaphore. Out of memory"); - } - } -#endif - - if (semaphoreDeleted || (server->config.discoveryCleanupTimeout && current->lastSeen < timedOut)) { - if (semaphoreDeleted) { - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER, - "Registration of server with URI %.*s is removed because " - "the semaphore file '%.*s' was deleted.", - (int)current->registeredServer.serverUri.length, current->registeredServer.serverUri.data, - (int)current->registeredServer.semaphoreFilePath.length, - current->registeredServer.semaphoreFilePath.data); - } else { - // cppcheck-suppress unreadVariable - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER, - "Registration of server with URI %.*s has timed out and is removed.", - (int)current->registeredServer.serverUri.length, current->registeredServer.serverUri.data); - } - LIST_REMOVE(current, pointers); - UA_RegisteredServer_deleteMembers(¤t->registeredServer); -#ifndef UA_ENABLE_MULTITHREADING - UA_free(current); - server->registeredServersSize--; -#else - server->registeredServersSize = uatomic_add_return(&server->registeredServersSize, -1); - UA_Server_delayedCallback(server, freeEntry, current); -#endif - } - } -} - -struct PeriodicServerRegisterCallback { - UA_UInt64 id; - UA_UInt32 this_interval; - UA_UInt32 default_interval; - UA_Boolean registered; - const char *discovery_server_url; -}; - -/* Called by the UA_Server callback. The OPC UA specification says: - * - * > If an error occurs during registration (e.g. the Discovery Server is not running) then the Server - * > must periodically re-attempt registration. The frequency of these attempts should start at 1 second - * > but gradually increase until the registration frequency is the same as what it would be if not - * > errors occurred. The recommended approach would double the period each attempt until reaching the maximum. - * - * We will do so by using the additional data parameter which holds information - * if the next interval is default or if it is a repeaded call. */ -static void periodicServerRegister(UA_Server *server, void *data) { - UA_assert(data != NULL); - - struct PeriodicServerRegisterCallback *cb = (struct PeriodicServerRegisterCallback *)data; - - /* Which URL to register on */ - // fixme: remove magic url - const char *server_url; - if (cb->discovery_server_url != NULL) - server_url = cb->discovery_server_url; - else - server_url = "opc.tcp://localhost:4840"; - - /* Register - You can also use a semaphore file. That file must exist. When the file is - deleted, the server is automatically unregistered. The semaphore file has - to be accessible by the discovery server - - UA_StatusCode retval = UA_Server_register_discovery(server, - "opc.tcp://localhost:4840", "/path/to/some/file"); - */ - UA_StatusCode retval = UA_Server_register_discovery(server, server_url, NULL); - - /* Registering failed */ - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, - "Could not register server with discovery server. " - "Is the discovery server started? StatusCode %s", - UA_StatusCode_name(retval)); - - /* If the server was previously registered, retry in one second, - * else, double the previous interval */ - UA_UInt32 nextInterval = 1000; - if (!cb->registered) nextInterval = cb->this_interval * 2; - - /* The interval should be smaller than the default interval */ - if (nextInterval > cb->default_interval) nextInterval = cb->default_interval; - - cb->this_interval = nextInterval; - UA_Server_changeRepeatedCallbackInterval(server, cb->id, nextInterval); - return; - } - - /* Registering succeeded */ - UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, - "Server successfully registered. Next periodical register will be in %d seconds", - (int)(cb->default_interval / 1000)); - - if (!cb->registered) { - retval = UA_Server_changeRepeatedCallbackInterval(server, cb->id, cb->default_interval); - /* If changing the interval fails, try again after the next registering */ - if (retval == UA_STATUSCODE_GOOD) cb->registered = true; - } -} - -UA_StatusCode UA_Server_addPeriodicServerRegisterCallback(UA_Server *server, const char *discoveryServerUrl, - UA_UInt32 intervalMs, UA_UInt32 delayFirstRegisterMs, - UA_UInt64 *periodicCallbackId) { - /* No valid server URL */ - if (!discoveryServerUrl) { - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, "No discovery server URL provided"); - return UA_STATUSCODE_BADINTERNALERROR; - } - - /* check if we are already registering with the given discovery url and remove the old periodic call */ - { - periodicServerRegisterCallback_entry *rs, *rs_tmp; - LIST_FOREACH_SAFE(rs, &server->periodicServerRegisterCallbacks, pointers, rs_tmp) { - if (strcmp(rs->callback->discovery_server_url, discoveryServerUrl) == 0) { - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER, - "There is already a register callback for '%s' in place. Removing the older one.", - discoveryServerUrl); - UA_Server_removeRepeatedCallback(server, rs->callback->id); - LIST_REMOVE(rs, pointers); - UA_free(rs->callback); - UA_free(rs); - break; - } - } - } - - /* Allocate and initialize */ - struct PeriodicServerRegisterCallback *cb = - (struct PeriodicServerRegisterCallback *)UA_malloc(sizeof(struct PeriodicServerRegisterCallback)); - if (!cb) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Start repeating a failed register after 1s, then increase the delay. Set - * to 500ms, as the delay is doubled before changing the callback - * interval.*/ - cb->this_interval = 500; - cb->default_interval = intervalMs; - cb->registered = false; - cb->discovery_server_url = discoveryServerUrl; - - /* Add the callback */ - UA_StatusCode retval = - UA_Server_addRepeatedCallback(server, periodicServerRegister, cb, delayFirstRegisterMs, &cb->id); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, - "Could not create periodic job for server register. " - "StatusCode %s", - UA_StatusCode_name(retval)); - UA_free(cb); - return retval; - } - -#ifndef __clang_analyzer__ - // the analyzer reports on LIST_INSERT_HEAD a use after free false positive - periodicServerRegisterCallback_entry *newEntry = - (periodicServerRegisterCallback_entry *)UA_malloc(sizeof(periodicServerRegisterCallback_entry)); - if (!newEntry) { - UA_Server_removeRepeatedCallback(server, cb->id); - UA_free(cb); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - newEntry->callback = cb; - LIST_INSERT_HEAD(&server->periodicServerRegisterCallbacks, newEntry, pointers); -#endif - - if (periodicCallbackId) *periodicCallbackId = cb->id; - return UA_STATUSCODE_GOOD; -} - -void UA_Server_setRegisterServerCallback(UA_Server *server, UA_Server_registerServerCallback cb, void *data) { - server->registerServerCallback = cb; - server->registerServerCallbackData = data; -} - -#endif /* UA_ENABLE_DISCOVERY */ - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_services_subscription.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */ - -#define UA_BOUNDEDVALUE_SETWBOUNDS(BOUNDS, SRC, DST) \ - { \ - if (SRC > BOUNDS.max) \ - DST = BOUNDS.max; \ - else if (SRC < BOUNDS.min) \ - DST = BOUNDS.min; \ - else \ - DST = SRC; \ - } - -static void setSubscriptionSettings(UA_Server *server, UA_Subscription *subscription, - UA_Double requestedPublishingInterval, UA_UInt32 requestedLifetimeCount, - UA_UInt32 requestedMaxKeepAliveCount, UA_UInt32 maxNotificationsPerPublish, - UA_Byte priority) { - /* deregister the callback if required */ - UA_StatusCode retval = Subscription_unregisterPublishCallback(server, subscription); - if (retval != UA_STATUSCODE_GOOD) - UA_LOG_DEBUG_SESSION(server->config.logger, subscription->session, - "Subscription %u | " - "Could not unregister publish callback with error code %s", - subscription->subscriptionID, UA_StatusCode_name(retval)); - - /* re-parameterize the subscription */ - subscription->publishingInterval = requestedPublishingInterval; - UA_BOUNDEDVALUE_SETWBOUNDS(server->config.publishingIntervalLimits, requestedPublishingInterval, - subscription->publishingInterval); - /* check for nan*/ - if (requestedPublishingInterval != requestedPublishingInterval) - subscription->publishingInterval = server->config.publishingIntervalLimits.min; - UA_BOUNDEDVALUE_SETWBOUNDS(server->config.keepAliveCountLimits, requestedMaxKeepAliveCount, - subscription->maxKeepAliveCount); - UA_BOUNDEDVALUE_SETWBOUNDS(server->config.lifeTimeCountLimits, requestedLifetimeCount, subscription->lifeTimeCount); - if (subscription->lifeTimeCount < 3 * subscription->maxKeepAliveCount) - subscription->lifeTimeCount = 3 * subscription->maxKeepAliveCount; - subscription->notificationsPerPublish = maxNotificationsPerPublish; - if (maxNotificationsPerPublish == 0 || maxNotificationsPerPublish > server->config.maxNotificationsPerPublish) - subscription->notificationsPerPublish = server->config.maxNotificationsPerPublish; - subscription->priority = priority; - - retval = Subscription_registerPublishCallback(server, subscription); - if (retval != UA_STATUSCODE_GOOD) - UA_LOG_DEBUG_SESSION(server->config.logger, subscription->session, - "Subscription %u | " - "Could not register publish callback with error code %s", - subscription->subscriptionID, UA_StatusCode_name(retval)); -} - -void Service_CreateSubscription(UA_Server *server, UA_Session *session, const UA_CreateSubscriptionRequest *request, - UA_CreateSubscriptionResponse *response) { - if ((server->config.maxSubscriptionsPerSession != 0) && - (UA_Session_getNumSubscriptions(session) >= server->config.maxSubscriptionsPerSession)) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS; - return; - } - /* Create the subscription */ - UA_Subscription *newSubscription = UA_Subscription_new(session, response->subscriptionId); - if (!newSubscription) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing CreateSubscriptionRequest failed"); - response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - newSubscription->subscriptionID = UA_Session_getUniqueSubscriptionID(session); - UA_Session_addSubscription(session, newSubscription); - - /* Set the subscription parameters */ - newSubscription->publishingEnabled = request->publishingEnabled; - setSubscriptionSettings(server, newSubscription, request->requestedPublishingInterval, - request->requestedLifetimeCount, request->requestedMaxKeepAliveCount, - request->maxNotificationsPerPublish, request->priority); - newSubscription->currentKeepAliveCount = newSubscription->maxKeepAliveCount; /* set settings first */ - - /* Prepare the response */ - response->subscriptionId = newSubscription->subscriptionID; - response->revisedPublishingInterval = newSubscription->publishingInterval; - response->revisedLifetimeCount = newSubscription->lifeTimeCount; - response->revisedMaxKeepAliveCount = newSubscription->maxKeepAliveCount; - - UA_LOG_DEBUG_SESSION(server->config.logger, session, - "CreateSubscriptionRequest: Created Subscription %u " - "with a publishing interval of %f ms", - response->subscriptionId, newSubscription->publishingInterval); -} - -void Service_ModifySubscription(UA_Server *server, UA_Session *session, const UA_ModifySubscriptionRequest *request, - UA_ModifySubscriptionResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing ModifySubscriptionRequest"); - - UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId); - if (!sub) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - return; - } - - setSubscriptionSettings(server, sub, request->requestedPublishingInterval, request->requestedLifetimeCount, - request->requestedMaxKeepAliveCount, request->maxNotificationsPerPublish, request->priority); - sub->currentLifetimeCount = 0; /* Reset the subscription lifetime */ - response->revisedPublishingInterval = sub->publishingInterval; - response->revisedLifetimeCount = sub->lifeTimeCount; - response->revisedMaxKeepAliveCount = sub->maxKeepAliveCount; -} - -static UA_THREAD_LOCAL UA_Boolean op_publishingEnabled; - -static void Operation_SetPublishingMode(UA_Server *Server, UA_Session *session, UA_UInt32 *subscriptionId, - UA_StatusCode *result) { - UA_Subscription *sub = UA_Session_getSubscriptionByID(session, *subscriptionId); - if (!sub) { - *result = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - return; - } - - /* Reset the subscription lifetime */ - sub->currentLifetimeCount = 0; - - /* Set the publishing mode */ - sub->publishingEnabled = op_publishingEnabled; -} - -void Service_SetPublishingMode(UA_Server *server, UA_Session *session, const UA_SetPublishingModeRequest *request, - UA_SetPublishingModeResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing SetPublishingModeRequest"); - - op_publishingEnabled = request->publishingEnabled; - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)Operation_SetPublishingMode, &request->subscriptionIdsSize, - &UA_TYPES[UA_TYPES_UINT32], &response->resultsSize, &UA_TYPES[UA_TYPES_STATUSCODE]); -} - -static void setMonitoredItemSettings(UA_Server *server, UA_MonitoredItem *mon, UA_MonitoringMode monitoringMode, - const UA_MonitoringParameters *params) { - MonitoredItem_unregisterSampleCallback(server, mon); - mon->monitoringMode = monitoringMode; - - /* ClientHandle */ - mon->clientHandle = params->clientHandle; - - /* SamplingInterval */ - UA_Double samplingInterval = params->samplingInterval; - if (mon->attributeID == UA_ATTRIBUTEID_VALUE) { - const UA_VariableNode *vn = (const UA_VariableNode *)UA_Nodestore_get(server, &mon->monitoredNodeId); - if (vn) { - if (vn->nodeClass == UA_NODECLASS_VARIABLE && samplingInterval < vn->minimumSamplingInterval) - samplingInterval = vn->minimumSamplingInterval; - UA_Nodestore_release(server, (const UA_Node *)vn); - } - } else if (mon->attributeID == UA_ATTRIBUTEID_EVENTNOTIFIER) { - /* TODO: events should not need a samplinginterval */ - samplingInterval = 10000.0f; // 10 seconds to reduce the load - } - mon->samplingInterval = samplingInterval; - UA_BOUNDEDVALUE_SETWBOUNDS(server->config.samplingIntervalLimits, samplingInterval, mon->samplingInterval); - if (samplingInterval != samplingInterval) /* Check for nan */ - mon->samplingInterval = server->config.samplingIntervalLimits.min; - - /* Filter */ - if (params->filter.encoding != UA_EXTENSIONOBJECT_DECODED || - params->filter.content.decoded.type != &UA_TYPES[UA_TYPES_DATACHANGEFILTER]) { - /* Default: Trigger only on the value and the statuscode */ - mon->trigger = UA_DATACHANGETRIGGER_STATUSVALUE; - } else { - UA_DataChangeFilter *filter = (UA_DataChangeFilter *)params->filter.content.decoded.data; - mon->trigger = filter->trigger; - } - - /* QueueSize */ - UA_BOUNDEDVALUE_SETWBOUNDS(server->config.queueSizeLimits, params->queueSize, mon->maxQueueSize); - - /* DiscardOldest */ - mon->discardOldest = params->discardOldest; - - /* Register sample callback if reporting is enabled */ - if (monitoringMode == UA_MONITORINGMODE_REPORTING) MonitoredItem_registerSampleCallback(server, mon); -} - -static const UA_String binaryEncoding = {sizeof("Default Binary") - 1, (UA_Byte *)"Default Binary"}; - -/* Thread-local variables to pass additional arguments into the operation */ -static UA_THREAD_LOCAL UA_Subscription *op_sub; -static UA_THREAD_LOCAL UA_TimestampsToReturn op_timestampsToReturn2; - -static void Operation_CreateMonitoredItem(UA_Server *server, UA_Session *session, - const UA_MonitoredItemCreateRequest *request, - UA_MonitoredItemCreateResult *result) { - /* Make an example read to get errors in the itemToMonitor. Allow return - * codes "good" and "uncertain", as well as a list of statuscodes that might - * be repaired inside the data source. */ - UA_DataValue v = UA_Server_readWithSession(server, session, &request->itemToMonitor, op_timestampsToReturn2); - if (v.hasStatus && (v.status >> 30) > 1 && v.status != UA_STATUSCODE_BADRESOURCEUNAVAILABLE && - v.status != UA_STATUSCODE_BADCOMMUNICATIONERROR && v.status != UA_STATUSCODE_BADWAITINGFORINITIALDATA && - v.status != UA_STATUSCODE_BADUSERACCESSDENIED && v.status != UA_STATUSCODE_BADNOTREADABLE && - v.status != UA_STATUSCODE_BADINDEXRANGENODATA) { - result->statusCode = v.status; - UA_DataValue_deleteMembers(&v); - return; - } - UA_DataValue_deleteMembers(&v); - - /* Check if the encoding is supported */ - if (request->itemToMonitor.dataEncoding.name.length > 0 && - (!UA_String_equal(&binaryEncoding, &request->itemToMonitor.dataEncoding.name) || - request->itemToMonitor.dataEncoding.namespaceIndex != 0)) { - result->statusCode = UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED; - return; - } - - /* Check if the encoding is set for a value */ - if (request->itemToMonitor.attributeId != UA_ATTRIBUTEID_VALUE && - request->itemToMonitor.dataEncoding.name.length > 0) { - result->statusCode = UA_STATUSCODE_BADDATAENCODINGINVALID; - return; - } - - /* Create the monitoreditem */ - UA_MonitoredItem *newMon = UA_MonitoredItem_new(); - if (!newMon) { - result->statusCode = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - UA_StatusCode retval = UA_NodeId_copy(&request->itemToMonitor.nodeId, &newMon->monitoredNodeId); - if (retval != UA_STATUSCODE_GOOD) { - result->statusCode = retval; - MonitoredItem_delete(server, newMon); - return; - } - newMon->subscription = op_sub; - newMon->attributeID = request->itemToMonitor.attributeId; - newMon->itemId = ++(op_sub->lastMonitoredItemId); - newMon->timestampsToReturn = op_timestampsToReturn2; - setMonitoredItemSettings(server, newMon, request->monitoringMode, &request->requestedParameters); - - UA_Subscription_addMonitoredItem(op_sub, newMon); - - /* Create the first sample */ - if (request->monitoringMode == UA_MONITORINGMODE_REPORTING) UA_MoniteredItem_SampleCallback(server, newMon); - - /* Prepare the response */ - UA_String_copy(&request->itemToMonitor.indexRange, &newMon->indexRange); - result->revisedSamplingInterval = newMon->samplingInterval; - result->revisedQueueSize = newMon->maxQueueSize; - result->monitoredItemId = newMon->itemId; -} - -void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session, const UA_CreateMonitoredItemsRequest *request, - UA_CreateMonitoredItemsResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing CreateMonitoredItemsRequest"); - - if (server->config.maxMonitoredItemsPerCall != 0 && - request->itemsToCreateSize > server->config.maxMonitoredItemsPerCall) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - /* Check if the timestampstoreturn is valid */ - op_timestampsToReturn2 = request->timestampsToReturn; - if (op_timestampsToReturn2 > UA_TIMESTAMPSTORETURN_NEITHER) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID; - return; - } - - /* Find the subscription */ - op_sub = UA_Session_getSubscriptionByID(session, request->subscriptionId); - if (!op_sub) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - return; - } - - if ((server->config.maxMonitoredItemsPerSubscription != 0) && - ((UA_Subscription_getNumMonitoredItems(op_sub) + request->itemsToCreateSize) > - server->config.maxMonitoredItemsPerSubscription)) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYMONITOREDITEMS; - return; - } - - /* Reset the subscription lifetime */ - op_sub->currentLifetimeCount = 0; - - response->responseHeader.serviceResult = - UA_Server_processServiceOperations(server, session, (UA_ServiceOperation)Operation_CreateMonitoredItem, - &request->itemsToCreateSize, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST], - &response->resultsSize, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT]); -} - -static void Operation_ModifyMonitoredItem(UA_Server *server, UA_Session *session, - const UA_MonitoredItemModifyRequest *request, - UA_MonitoredItemModifyResult *result) { - /* Get the MonitoredItem */ - UA_MonitoredItem *mon = UA_Subscription_getMonitoredItem(op_sub, request->monitoredItemId); - if (!mon) { - result->statusCode = UA_STATUSCODE_BADMONITOREDITEMIDINVALID; - return; - } - - setMonitoredItemSettings(server, mon, mon->monitoringMode, &request->requestedParameters); - result->revisedSamplingInterval = mon->samplingInterval; - result->revisedQueueSize = mon->maxQueueSize; -} - -void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session, const UA_ModifyMonitoredItemsRequest *request, - UA_ModifyMonitoredItemsResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing ModifyMonitoredItemsRequest"); - - if (server->config.maxMonitoredItemsPerCall != 0 && - request->itemsToModifySize > server->config.maxMonitoredItemsPerCall) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - /* Check if the timestampstoreturn is valid */ - if (request->timestampsToReturn > UA_TIMESTAMPSTORETURN_NEITHER) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID; - return; - } - - /* Get the subscription */ - op_sub = UA_Session_getSubscriptionByID(session, request->subscriptionId); - if (!op_sub) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - return; - } - - /* Reset the subscription lifetime */ - op_sub->currentLifetimeCount = 0; - - response->responseHeader.serviceResult = - UA_Server_processServiceOperations(server, session, (UA_ServiceOperation)Operation_ModifyMonitoredItem, - &request->itemsToModifySize, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST], - &response->resultsSize, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT]); -} - -/* Get the additional argument into the operation */ -static UA_THREAD_LOCAL UA_MonitoringMode op_monitoringMode; - -static void Operation_SetMonitoringMode(UA_Server *server, UA_Session *session, UA_UInt32 *monitoredItemId, - UA_StatusCode *result) { - UA_MonitoredItem *mon = UA_Subscription_getMonitoredItem(op_sub, *monitoredItemId); - if (!mon) { - *result = UA_STATUSCODE_BADMONITOREDITEMIDINVALID; - return; - } - - if (mon->monitoringMode == op_monitoringMode) return; - - mon->monitoringMode = op_monitoringMode; - if (mon->monitoringMode == UA_MONITORINGMODE_REPORTING) - MonitoredItem_registerSampleCallback(server, mon); - else - MonitoredItem_unregisterSampleCallback(server, mon); -} - -void Service_SetMonitoringMode(UA_Server *server, UA_Session *session, const UA_SetMonitoringModeRequest *request, - UA_SetMonitoringModeResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing SetMonitoringMode"); - - if (server->config.maxMonitoredItemsPerCall != 0 && - request->monitoredItemIdsSize > server->config.maxMonitoredItemsPerCall) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - /* Get the subscription */ - op_sub = UA_Session_getSubscriptionByID(session, request->subscriptionId); - if (!op_sub) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - return; - } - - /* Reset the subscription lifetime */ - op_sub->currentLifetimeCount = 0; - - op_monitoringMode = request->monitoringMode; - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)Operation_SetMonitoringMode, &request->monitoredItemIdsSize, - &UA_TYPES[UA_TYPES_UINT32], &response->resultsSize, &UA_TYPES[UA_TYPES_STATUSCODE]); -} - -/* TODO: Unify with senderror in ua_server_binary.c */ -static void subscriptionSendError(UA_SecureChannel *channel, UA_UInt32 requestHandle, UA_UInt32 requestId, - UA_StatusCode error) { - UA_PublishResponse err_response; - UA_PublishResponse_init(&err_response); - err_response.responseHeader.requestHandle = requestHandle; - err_response.responseHeader.timestamp = UA_DateTime_now(); - err_response.responseHeader.serviceResult = error; - UA_SecureChannel_sendSymmetricMessage(channel, requestId, UA_MESSAGETYPE_MSG, &err_response, - &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]); -} - -void Service_Publish(UA_Server *server, UA_Session *session, const UA_PublishRequest *request, UA_UInt32 requestId) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing PublishRequest"); - - /* Return an error if the session has no subscription */ - if (LIST_EMPTY(&session->serverSubscriptions)) { - subscriptionSendError(session->channel, request->requestHeader.requestHandle, requestId, - UA_STATUSCODE_BADNOSUBSCRIPTION); - return; - } - - /* Handle too many subscriptions to free resources before trying to allocate - * resources for the new publish request. If the limit has been reached the - * oldest publish request shall be responded */ - if ((server->config.maxPublishReqPerSession != 0) && - (UA_Session_getNumPublishReq(session) >= server->config.maxPublishReqPerSession)) { - if (!UA_Subscription_reachedPublishReqLimit(server, session)) { - subscriptionSendError(session->channel, requestId, request->requestHeader.requestHandle, - UA_STATUSCODE_BADINTERNALERROR); - return; - } - } - - UA_PublishResponseEntry *entry = (UA_PublishResponseEntry *)UA_malloc(sizeof(UA_PublishResponseEntry)); - if (!entry) { - subscriptionSendError(session->channel, requestId, request->requestHeader.requestHandle, - UA_STATUSCODE_BADOUTOFMEMORY); - return; - } - entry->requestId = requestId; - - /* Build the response */ - UA_PublishResponse *response = &entry->response; - UA_PublishResponse_init(response); - response->responseHeader.requestHandle = request->requestHeader.requestHandle; - if (request->subscriptionAcknowledgementsSize > 0) { - response->results = - (UA_StatusCode *)UA_Array_new(request->subscriptionAcknowledgementsSize, &UA_TYPES[UA_TYPES_STATUSCODE]); - if (!response->results) { - UA_free(entry); - subscriptionSendError(session->channel, requestId, request->requestHeader.requestHandle, - UA_STATUSCODE_BADOUTOFMEMORY); - return; - } - response->resultsSize = request->subscriptionAcknowledgementsSize; - } - - /* Delete Acknowledged Subscription Messages */ - for (size_t i = 0; i < request->subscriptionAcknowledgementsSize; ++i) { - UA_SubscriptionAcknowledgement *ack = &request->subscriptionAcknowledgements[i]; - UA_Subscription *sub = UA_Session_getSubscriptionByID(session, ack->subscriptionId); - if (!sub) { - response->results[i] = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Cannot process acknowledgements subscription %u", - ack->subscriptionId); - continue; - } - /* Remove the acked transmission from the retransmission queue */ - response->results[i] = UA_Subscription_removeRetransmissionMessage(sub, ack->sequenceNumber); - } - - /* Queue the publish response */ - UA_Session_addPublishReq(session, entry); - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Queued a publication message"); - - /* Answer immediately to a late subscription */ - UA_Subscription *immediate; - UA_Boolean found = true; - int loopCount = 1; - - if (session->lastSeenSubscriptionID > 0) { - /* If we found anything one the first loop or if there are LATE - * in the list before lastSeenSubscriptionID and not LATE after - * lastSeenSubscriptionID we need a second loop. - */ - loopCount = 2; - /* We must find the last seen subscription id */ - found = false; - } - - for (int i = 0; i < loopCount; i++) { - LIST_FOREACH(immediate, &session->serverSubscriptions, listEntry) { - if (!found) { - if (session->lastSeenSubscriptionID == immediate->subscriptionID) { - found = true; - } - } else { - if (immediate->state == UA_SUBSCRIPTIONSTATE_LATE) { - session->lastSeenSubscriptionID = immediate->subscriptionID; - UA_LOG_DEBUG_SESSION(server->config.logger, session, - "Subscription %u | " - "Response on a late subscription", - immediate->subscriptionID); - UA_Subscription_publishCallback(server, immediate); - return; - } - } - } - /* after the first loop, we can publish the first subscription with UA_SUBSCRIPTIONSTATE_LATE */ - found = true; - } - session->lastSeenSubscriptionID = 0; -} - -static void Operation_DeleteSubscription(UA_Server *server, UA_Session *session, UA_UInt32 *subscriptionId, - UA_StatusCode *result) { - *result = UA_Session_deleteSubscription(server, session, *subscriptionId); - if (*result == UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Subscription %u | Subscription deleted", *subscriptionId); - } else { - UA_LOG_DEBUG_SESSION(server->config.logger, session, - "Deleting Subscription with Id %u failed with error " - "code %s", - *subscriptionId, UA_StatusCode_name(*result)); - } -} - -void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session, const UA_DeleteSubscriptionsRequest *request, - UA_DeleteSubscriptionsResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing DeleteSubscriptionsRequest"); - - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)Operation_DeleteSubscription, &request->subscriptionIdsSize, - &UA_TYPES[UA_TYPES_UINT32], &response->resultsSize, &UA_TYPES[UA_TYPES_STATUSCODE]); - - /* The session has at least one subscription */ - if (LIST_FIRST(&session->serverSubscriptions)) return; - - /* Send remaining publish responses if the last subscription was removed */ - UA_Subscription_answerPublishRequestsNoSubscription(server, session); -} - -static void Operation_DeleteMonitoredItem(UA_Server *server, UA_Session *session, UA_UInt32 *monitoredItemId, - UA_StatusCode *result) { - *result = UA_Subscription_deleteMonitoredItem(server, op_sub, *monitoredItemId); -} - -void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session, const UA_DeleteMonitoredItemsRequest *request, - UA_DeleteMonitoredItemsResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing DeleteMonitoredItemsRequest"); - - if (server->config.maxMonitoredItemsPerCall != 0 && - request->monitoredItemIdsSize > server->config.maxMonitoredItemsPerCall) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - /* Get the subscription */ - op_sub = UA_Session_getSubscriptionByID(session, request->subscriptionId); - if (!op_sub) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - return; - } - - /* Reset the subscription lifetime */ - op_sub->currentLifetimeCount = 0; - - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)Operation_DeleteMonitoredItem, &request->monitoredItemIdsSize, - &UA_TYPES[UA_TYPES_UINT32], &response->resultsSize, &UA_TYPES[UA_TYPES_STATUSCODE]); -} - -void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request, - UA_RepublishResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RepublishRequest"); - - /* Get the subscription */ - UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId); - if (!sub) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - return; - } - - /* Reset the subscription lifetime */ - sub->currentLifetimeCount = 0; - - /* Find the notification in the retransmission queue */ - UA_NotificationMessageEntry *entry; - TAILQ_FOREACH(entry, &sub->retransmissionQueue, listEntry) { - if (entry->message.sequenceNumber == request->retransmitSequenceNumber) break; - } - if (!entry) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADMESSAGENOTAVAILABLE; - return; - } - - response->responseHeader.serviceResult = UA_NotificationMessage_copy(&entry->message, &response->notificationMessage); -} - -#endif /* UA_ENABLE_SUBSCRIPTIONS */ - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_services_securechannel.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -void Service_OpenSecureChannel(UA_Server *server, UA_SecureChannel *channel, const UA_OpenSecureChannelRequest *request, - UA_OpenSecureChannelResponse *response) { - if (request->requestType == UA_SECURITYTOKENREQUESTTYPE_RENEW) { - /* Renew the channel */ - response->responseHeader.serviceResult = - UA_SecureChannelManager_renew(&server->secureChannelManager, channel, request, response); - - /* Logging */ - if (response->responseHeader.serviceResult == UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "SecureChannel renewed"); - } else { - UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Renewing SecureChannel failed"); - } - return; - } - - /* Must be ISSUE or RENEW */ - if (request->requestType != UA_SECURITYTOKENREQUESTTYPE_ISSUE) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADINTERNALERROR; - return; - } - - /* Open the channel */ - response->responseHeader.serviceResult = - UA_SecureChannelManager_open(&server->secureChannelManager, channel, request, response); - - /* Logging */ - if (response->responseHeader.serviceResult == UA_STATUSCODE_GOOD) { - UA_LOG_INFO_CHANNEL(server->config.logger, channel, "Opened SecureChannel"); - } else { - UA_LOG_INFO_CHANNEL(server->config.logger, channel, "Opening a SecureChannel failed"); - } -} - -/* The server does not send a CloseSecureChannel response */ -void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel) { - UA_LOG_INFO_CHANNEL(server->config.logger, channel, "CloseSecureChannel"); - UA_SecureChannelManager_close(&server->secureChannelManager, channel->securityToken.channelId); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_services_nodemanagement.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/*********************/ -/* Edit Node Context */ -/*********************/ - -UA_StatusCode UA_Server_getNodeContext(UA_Server *server, UA_NodeId nodeId, void **nodeContext) { - const UA_Node *node = UA_Nodestore_get(server, &nodeId); - if (!node) return UA_STATUSCODE_BADNODEIDUNKNOWN; - - *nodeContext = node->context; - UA_Nodestore_release(server, node); - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode editNodeContext(UA_Server *server, UA_Session *session, UA_Node *node, void *context) { - node->context = context; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Server_setNodeContext(UA_Server *server, UA_NodeId nodeId, void *nodeContext) { - UA_StatusCode retval = - UA_Server_editNode(server, &adminSession, &nodeId, (UA_EditNodeCallback)editNodeContext, nodeContext); - return retval; -} - -/**********************/ -/* Consistency Checks */ -/**********************/ - -/* Check if the requested parent node exists, has the right node class and is - * referenced with an allowed (hierarchical) reference type. For "type" nodes, - * only hasSubType references are allowed. */ -static UA_StatusCode checkParentReference(UA_Server *server, UA_Session *session, UA_NodeClass nodeClass, - const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId) { - /* Objects do not need a parent (e.g. mandatory/optional modellingrules) */ - if (nodeClass == UA_NODECLASS_OBJECT && UA_NodeId_isNull(parentNodeId) && UA_NodeId_isNull(referenceTypeId)) - return UA_STATUSCODE_GOOD; - - /* Omit checks during bootstrap */ - if (server->bootstrapNS0) return UA_STATUSCODE_GOOD; - - /* See if the parent exists */ - const UA_Node *parent = UA_Nodestore_get(server, parentNodeId); - if (!parent) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Parent node not found"); - return UA_STATUSCODE_BADPARENTNODEIDINVALID; - } - - UA_NodeClass parentNodeClass = parent->nodeClass; - UA_Nodestore_release(server, parent); - - /* Check the referencetype exists */ - const UA_ReferenceTypeNode *referenceType = (const UA_ReferenceTypeNode *)UA_Nodestore_get(server, referenceTypeId); - if (!referenceType) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Reference type to the parent not found"); - return UA_STATUSCODE_BADREFERENCETYPEIDINVALID; - } - - UA_NodeClass referenceTypeNodeClass = referenceType->nodeClass; - UA_Boolean referenceTypeIsAbstract = referenceType->isAbstract; - UA_Nodestore_release(server, (const UA_Node *)referenceType); - - /* Check if the referencetype is a reference type node */ - if (referenceTypeNodeClass != UA_NODECLASS_REFERENCETYPE) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Reference type to the parent invalid"); - return UA_STATUSCODE_BADREFERENCETYPEIDINVALID; - } - - /* Check that the reference type is not abstract */ - if (referenceTypeIsAbstract == true) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Abstract reference type to the parent not allowed"); - return UA_STATUSCODE_BADREFERENCENOTALLOWED; - } - - /* Check hassubtype relation for type nodes */ - if (nodeClass == UA_NODECLASS_DATATYPE || nodeClass == UA_NODECLASS_VARIABLETYPE || - nodeClass == UA_NODECLASS_OBJECTTYPE || nodeClass == UA_NODECLASS_REFERENCETYPE) { - /* type needs hassubtype reference to the supertype */ - if (!UA_NodeId_equal(referenceTypeId, &subtypeId)) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: New type node need to have a " - "HasSubType reference"); - return UA_STATUSCODE_BADREFERENCENOTALLOWED; - } - /* supertype needs to be of the same node type */ - if (parentNodeClass != nodeClass) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: New type node needs to be of the same " - "node type as the parent"); - return UA_STATUSCODE_BADPARENTNODEIDINVALID; - } - return UA_STATUSCODE_GOOD; - } - - /* Test if the referencetype is hierarchical */ - const UA_NodeId hierarchicalReference = UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES); - if (!isNodeInTree(&server->config.nodestore, referenceTypeId, &hierarchicalReference, &subtypeId, 1)) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Reference type is not hierarchical"); - return UA_STATUSCODE_BADREFERENCETYPEIDINVALID; - } - - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode typeCheckVariableNode(UA_Server *server, UA_Session *session, const UA_VariableNode *node, - const UA_VariableTypeNode *vt, const UA_NodeId *parentNodeId) { - /* The value might come from a datasource, so we perform a - * regular read. */ - UA_DataValue value; - UA_DataValue_init(&value); - UA_StatusCode retval = readValueAttribute(server, session, node, &value); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Check the datatype against the vt */ - if (!compatibleDataType(server, &node->dataType, &vt->dataType)) return UA_STATUSCODE_BADTYPEMISMATCH; - - /* Get the array dimensions */ - size_t arrayDims = node->arrayDimensionsSize; - if (arrayDims == 0 && value.hasValue && value.value.type && !UA_Variant_isScalar(&value.value)) { - arrayDims = 1; /* No array dimensions on an array implies one dimension */ - } - - /* Check valueRank against array dimensions */ - if (!(node->nodeClass == UA_NODECLASS_VARIABLETYPE && ((const UA_VariableTypeNode *)node)->isAbstract && - node->valueRank == 0) && - !compatibleValueRankArrayDimensions(node->valueRank, arrayDims)) - return UA_STATUSCODE_BADTYPEMISMATCH; - - /* If variable node is created below BaseObjectType and has its default valueRank of -2, - * skip the test */ - const UA_NodeId objectTypes = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE); - const UA_NodeId refs[2] = {UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE), UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT)}; - if (node->valueRank != vt->valueRank && node->valueRank != UA_VariableAttributes_default.valueRank && - !isNodeInTree(&server->config.nodestore, parentNodeId, &objectTypes, refs, 2)) { - /* Check valueRank against the vt */ - if (!compatibleValueRanks(node->valueRank, vt->valueRank)) return UA_STATUSCODE_BADTYPEMISMATCH; - } - - /* Check array dimensions against the vt */ - if (!compatibleArrayDimensions(vt->arrayDimensionsSize, vt->arrayDimensions, node->arrayDimensionsSize, - node->arrayDimensions)) - return UA_STATUSCODE_BADTYPEMISMATCH; - - /* Typecheck the value */ - if (!server->bootstrapNS0 && value.hasValue) { - /* If the type-check failed write the same value again. The - * write-service tries to convert to the correct type... */ - if (!compatibleValue(server, &node->dataType, node->valueRank, node->arrayDimensionsSize, node->arrayDimensions, - &value.value, NULL)) - retval = UA_Server_writeValue(server, node->nodeId, value.value); - UA_DataValue_deleteMembers(&value); - } - return retval; -} - -/********************/ -/* Instantiate Node */ -/********************/ - -static const UA_NodeId baseDataVariableType = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_BASEDATAVARIABLETYPE}}; -static const UA_NodeId baseObjectType = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_BASEOBJECTTYPE}}; - -/* Use attributes from the variable type wherever required */ -static UA_StatusCode useVariableTypeAttributes(UA_Server *server, UA_Session *session, UA_VariableNode *node, - const UA_AddNodesItem *item) { - const UA_VariableAttributes *attributes = (const UA_VariableAttributes *)item->nodeAttributes.content.decoded.data; - - /* Select the type definition */ - const UA_NodeId *typeDefinition; - if (node->nodeClass == UA_NODECLASS_VARIABLE) - typeDefinition = &item->typeDefinition.nodeId; - else /* UA_NODECLASS_VARIABLETYPE */ - typeDefinition = &item->parentNodeId.nodeId; - - /* Replace an empty typeDefinition with the most permissive default */ - if (UA_NodeId_isNull(typeDefinition)) typeDefinition = &baseDataVariableType; - - const UA_VariableTypeNode *vt = (const UA_VariableTypeNode *)UA_Nodestore_get(server, typeDefinition); - if (!vt || vt->nodeClass != UA_NODECLASS_VARIABLETYPE) return UA_STATUSCODE_BADTYPEMISMATCH; - - /* If no value is set, see if the vt provides one and copy it. This needs to - * be done before copying the datatype from the vt, as setting the datatype - * triggers a typecheck. */ - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (!attributes->value.type) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, - "AddNodes: No value given; Copy the value" - "from the TypeDefinition"); - UA_DataValue vt_value; - UA_DataValue_init(&vt_value); - retval = readValueAttribute(server, session, (const UA_VariableNode *)vt, &vt_value); - if (retval == UA_STATUSCODE_GOOD && vt_value.hasValue) { - retval = UA_Variant_copy(&vt_value.value, &node->value.data.value.value); - node->value.data.value.hasValue = true; - } - UA_DataValue_deleteMembers(&vt_value); - } - - /* If no datatype is given, use the datatype of the vt */ - if (retval == UA_STATUSCODE_GOOD && UA_NodeId_isNull(&node->dataType)) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: " - "No datatype given; Copy the datatype attribute " - "from the TypeDefinition"); - retval = UA_NodeId_copy(&vt->dataType, &node->dataType); - } - - /* TODO: If the vt has arraydimensions but this variable does not, copy */ - - UA_Nodestore_release(server, (const UA_Node *)vt); - return retval; -} - -/* Search for an instance of "browseName" in node searchInstance. Used during - * copyChildNodes to find overwritable/mergable nodes. Does not touch - * outInstanceNodeId if no child is found. */ -static UA_StatusCode findChildByBrowsename(UA_Server *server, UA_Session *session, const UA_NodeId *searchInstance, - const UA_QualifiedName *browseName, UA_NodeId *outInstanceNodeId) { - UA_BrowseDescription bd; - UA_BrowseDescription_init(&bd); - bd.nodeId = *searchInstance; - bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES); - bd.includeSubtypes = true; - bd.browseDirection = UA_BROWSEDIRECTION_FORWARD; - bd.nodeClassMask = UA_NODECLASS_OBJECT | UA_NODECLASS_VARIABLE | UA_NODECLASS_METHOD; - bd.resultMask = UA_BROWSERESULTMASK_NODECLASS | UA_BROWSERESULTMASK_BROWSENAME; - - UA_BrowseResult br; - UA_BrowseResult_init(&br); - Service_Browse_single(server, session, NULL, &bd, 0, &br); - if (br.statusCode != UA_STATUSCODE_GOOD) return br.statusCode; - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - for (size_t i = 0; i < br.referencesSize; ++i) { - UA_ReferenceDescription *rd = &br.references[i]; - if (rd->browseName.namespaceIndex == browseName->namespaceIndex && - UA_String_equal(&rd->browseName.name, &browseName->name)) { - retval = UA_NodeId_copy(&rd->nodeId.nodeId, outInstanceNodeId); - break; - } - } - - UA_BrowseResult_deleteMembers(&br); - return retval; -} - -static const UA_NodeId mandatoryId = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_MODELLINGRULE_MANDATORY}}; -static const UA_NodeId hasModellingRuleId = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_HASMODELLINGRULE}}; - -static UA_Boolean isMandatoryChild(UA_Server *server, UA_Session *session, const UA_NodeId *childNodeId) { - /* Get the child */ - const UA_Node *child = UA_Nodestore_get(server, childNodeId); - if (!child) return false; - - /* Look for the reference making the child mandatory */ - for (size_t i = 0; i < child->referencesSize; ++i) { - UA_NodeReferenceKind *refs = &child->references[i]; - if (!UA_NodeId_equal(&hasModellingRuleId, &refs->referenceTypeId)) continue; - if (refs->isInverse) continue; - for (size_t j = 0; j < refs->targetIdsSize; ++j) { - if (UA_NodeId_equal(&mandatoryId, &refs->targetIds[j].nodeId)) { - UA_Nodestore_release(server, child); - return true; - } - } - } - - UA_Nodestore_release(server, child); - return false; -} - -static UA_StatusCode copyChildNodes(UA_Server *server, UA_Session *session, const UA_NodeId *sourceNodeId, - const UA_NodeId *destinationNodeId); - -static void addReference(UA_Server *server, UA_Session *session, const UA_AddReferencesItem *item, - UA_StatusCode *retval); - -/* - * This method only deletes references from the node which are not matching any type in the given array. - * Could be used to e.g. delete all the references, except 'HASMODELINGRULE' - */ -static void deleteReferencesSubset(UA_Node *node, size_t referencesSkipSize, UA_NodeId *referencesSkip) { - if (referencesSkipSize == 0) { - UA_Node_deleteReferences(node); - return; - } - - /* Let's count if there are references left. If not just delete all the references. - * It's faster */ - size_t newSize = 0; - for (size_t i = 0; i < node->referencesSize; ++i) { - for (size_t j = 0; j < referencesSkipSize; j++) { - if (UA_NodeId_equal(&node->references[i].referenceTypeId, &referencesSkip[j])) { - newSize++; - } - } - } - if (newSize == 0) { - UA_Node_deleteReferences(node); - return; - } - - /* Now copy the remaining references to a new array */ - UA_NodeReferenceKind *newReferences = (UA_NodeReferenceKind *)UA_malloc(sizeof(UA_NodeReferenceKind) * (newSize)); - size_t curr = 0; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - for (size_t i = 0; i < node->referencesSize && retval == UA_STATUSCODE_GOOD; ++i) { - for (size_t j = 0; j < referencesSkipSize; j++) { - if (!UA_NodeId_equal(&node->references[i].referenceTypeId, &referencesSkip[j])) continue; - - // copy the reference - UA_NodeReferenceKind *srefs = &node->references[i]; - UA_NodeReferenceKind *drefs = &newReferences[curr++]; - drefs->isInverse = srefs->isInverse; - retval = UA_NodeId_copy(&srefs->referenceTypeId, &drefs->referenceTypeId); - if (retval != UA_STATUSCODE_GOOD) break; - retval = UA_Array_copy(srefs->targetIds, srefs->targetIdsSize, (void **)&drefs->targetIds, - &UA_TYPES[UA_TYPES_EXPANDEDNODEID]); - if (retval != UA_STATUSCODE_GOOD) break; - drefs->targetIdsSize = srefs->targetIdsSize; - break; - } - if (retval != UA_STATUSCODE_GOOD) { - for (size_t k = 0; k < i; k++) { - UA_NodeReferenceKind *refs = &newReferences[i]; - for (size_t j = 0; j < refs->targetIdsSize; ++j) UA_ExpandedNodeId_deleteMembers(&refs->targetIds[j]); - UA_Array_delete(refs->targetIds, refs->targetIdsSize, &UA_TYPES[UA_TYPES_EXPANDEDNODEID]); - UA_NodeId_deleteMembers(&refs->referenceTypeId); - } - } - } - - UA_Node_deleteReferences(node); - if (retval == UA_STATUSCODE_GOOD) { - node->references = newReferences; - node->referencesSize = newSize; - } else { - UA_free(newReferences); - } -} - -static UA_StatusCode copyChildNode(UA_Server *server, UA_Session *session, const UA_NodeId *destinationNodeId, - const UA_ReferenceDescription *rd) { - UA_NodeId existingChild = UA_NODEID_NULL; - UA_StatusCode retval = findChildByBrowsename(server, session, destinationNodeId, &rd->browseName, &existingChild); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Have a child with that browseName. Try to deep-copy missing members. */ - if (!UA_NodeId_isNull(&existingChild)) { - if (rd->nodeClass == UA_NODECLASS_VARIABLE || rd->nodeClass == UA_NODECLASS_OBJECT) - retval = copyChildNodes(server, session, &rd->nodeId.nodeId, &existingChild); - UA_NodeId_deleteMembers(&existingChild); - return retval; - } - - /* Is the child mandatory? If not, skip */ - if (!isMandatoryChild(server, session, &rd->nodeId.nodeId)) return UA_STATUSCODE_GOOD; - - /* No existing child with that browsename. Create it. */ - if (rd->nodeClass == UA_NODECLASS_METHOD) { - /* Add a reference to the method in the objecttype */ - UA_AddReferencesItem newItem; - UA_AddReferencesItem_init(&newItem); - newItem.sourceNodeId = *destinationNodeId; - newItem.referenceTypeId = rd->referenceTypeId; - newItem.isForward = true; - newItem.targetNodeId = rd->nodeId; - newItem.targetNodeClass = UA_NODECLASS_METHOD; - addReference(server, session, &newItem, &retval); - return retval; - } - - /* Node exists and is a variable or object. Instantiate missing mandatory - * children */ - if (rd->nodeClass == UA_NODECLASS_VARIABLE || rd->nodeClass == UA_NODECLASS_OBJECT) { - /* Get the node */ - UA_Node *node; - retval = UA_Nodestore_getCopy(server, &rd->nodeId.nodeId, &node); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Get the type */ - const UA_Node *type = getNodeType(server, node); - const UA_NodeId *typeId; - if (type) - typeId = &type->nodeId; - else - typeId = &UA_NODEID_NULL; - - /* Reset the NodeId (random numeric id will be assigned in the nodestore) */ - UA_NodeId_deleteMembers(&node->nodeId); - node->nodeId.namespaceIndex = destinationNodeId->namespaceIndex; - - /* Remove references, they are re-created from scratch in addnode_finish */ - /* TODO: Be more clever in removing references that are re-added during - * addnode_finish. That way, we can call addnode_finish also on children that were - * manually added by the user during addnode_begin and addnode_finish. */ - /* For now we keep all the modelling rule references and delete all others */ - UA_NodeId modellingRuleReferenceId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE); - deleteReferencesSubset(node, 1, &modellingRuleReferenceId); - - /* Add the node to the nodestore */ - UA_NodeId newNodeId; - retval = UA_Nodestore_insert(server, node, &newNodeId); - if (retval != UA_STATUSCODE_GOOD) { - UA_Nodestore_release(server, type); - return retval; - } - - /* Add all the children of this child to the new child node to make sure we take - * the values from the nearest inherited object first. - */ - copyChildNodes(server, session, &rd->nodeId.nodeId, &newNodeId); - - /* Call addnode_finish, this recursively adds additional members, the type - * definition and so on of the base type of this child, if they are not yet - * in the destination */ - retval = Operation_addNode_finish(server, session, &newNodeId, destinationNodeId, &rd->referenceTypeId, typeId); - UA_NodeId_deleteMembers(&newNodeId); - UA_Nodestore_release(server, type); - } - return retval; -} - -/* Copy any children of Node sourceNodeId to another node destinationNodeId. */ -static UA_StatusCode copyChildNodes(UA_Server *server, UA_Session *session, const UA_NodeId *sourceNodeId, - const UA_NodeId *destinationNodeId) { - /* Browse to get all children of the source */ - UA_BrowseDescription bd; - UA_BrowseDescription_init(&bd); - bd.nodeId = *sourceNodeId; - bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES); - bd.includeSubtypes = true; - bd.browseDirection = UA_BROWSEDIRECTION_FORWARD; - bd.nodeClassMask = UA_NODECLASS_OBJECT | UA_NODECLASS_VARIABLE | UA_NODECLASS_METHOD; - bd.resultMask = UA_BROWSERESULTMASK_REFERENCETYPEID | UA_BROWSERESULTMASK_NODECLASS | UA_BROWSERESULTMASK_BROWSENAME; - - UA_BrowseResult br; - UA_BrowseResult_init(&br); - Service_Browse_single(server, session, NULL, &bd, 0, &br); - if (br.statusCode != UA_STATUSCODE_GOOD) return br.statusCode; - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - for (size_t i = 0; i < br.referencesSize; ++i) { - UA_ReferenceDescription *rd = &br.references[i]; - retval |= copyChildNode(server, session, destinationNodeId, rd); - } - - UA_BrowseResult_deleteMembers(&br); - return retval; -} - -static UA_StatusCode addChildren(UA_Server *server, UA_Session *session, const UA_Node *node, const UA_Node *type) { - /* Get the hierarchy of the type and all its supertypes */ - UA_NodeId *hierarchy = NULL; - size_t hierarchySize = 0; - UA_StatusCode retval = getTypeHierarchy(&server->config.nodestore, &type->nodeId, &hierarchy, &hierarchySize); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Copy members of the type and supertypes (and instantiate them) */ - for (size_t i = 0; i < hierarchySize; ++i) retval |= copyChildNodes(server, session, &hierarchy[i], &node->nodeId); - UA_Array_delete(hierarchy, hierarchySize, &UA_TYPES[UA_TYPES_NODEID]); - return retval; -} - -/* Calls the global destructor internally of the global constructor succeeds and - * the type-level constructor fails. */ -static UA_StatusCode callConstructors(UA_Server *server, UA_Session *session, const UA_Node *node, - const UA_Node *type) { - /* Get the node type constructor */ - const UA_NodeTypeLifecycle *lifecycle = NULL; - if (node->nodeClass == UA_NODECLASS_OBJECT) { - const UA_ObjectTypeNode *ot = (const UA_ObjectTypeNode *)type; - lifecycle = &ot->lifecycle; - } else if (node->nodeClass == UA_NODECLASS_VARIABLE) { - const UA_VariableTypeNode *vt = (const UA_VariableTypeNode *)type; - lifecycle = &vt->lifecycle; - } - - /* Call the global constructor */ - void *context = node->context; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (server->config.nodeLifecycle.constructor) - retval = server->config.nodeLifecycle.constructor(server, &session->sessionId, session->sessionHandle, - &node->nodeId, &context); - - /* Call the type constructor */ - if (retval == UA_STATUSCODE_GOOD && lifecycle && lifecycle->constructor) - retval = lifecycle->constructor(server, &session->sessionId, session->sessionHandle, &type->nodeId, type->context, - &node->nodeId, &context); - - /* Set the context *and* mark the node as constructed */ - if (retval == UA_STATUSCODE_GOOD) - retval = UA_Server_editNode(server, &adminSession, &node->nodeId, (UA_EditNodeCallback)editNodeContext, context); - - /* Fail. Call the global destructor. */ - if (retval != UA_STATUSCODE_GOOD && server->config.nodeLifecycle.destructor) - server->config.nodeLifecycle.destructor(server, &session->sessionId, session->sessionHandle, &node->nodeId, - context); - - return retval; -} - -static UA_StatusCode addTypeDefRef(UA_Server *server, UA_Session *session, const UA_Node *node, const UA_Node *type) { - UA_StatusCode retval = UA_STATUSCODE_GOOD; - UA_AddReferencesItem addref; - UA_AddReferencesItem_init(&addref); - addref.sourceNodeId = node->nodeId; - addref.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION); - addref.isForward = true; - addref.targetNodeId.nodeId = type->nodeId; - addReference(server, session, &addref, &retval); - return retval; -} - -static UA_StatusCode addParentRef(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, - const UA_NodeId *referenceTypeId, const UA_NodeId *parentNodeId) { - UA_StatusCode retval = UA_STATUSCODE_GOOD; - UA_AddReferencesItem ref_item; - UA_AddReferencesItem_init(&ref_item); - ref_item.sourceNodeId = *nodeId; - ref_item.referenceTypeId = *referenceTypeId; - ref_item.isForward = false; - ref_item.targetNodeId.nodeId = *parentNodeId; - addReference(server, session, &ref_item, &retval); - return retval; -} - -/************/ -/* Add Node */ -/************/ - -/* Prepare the node, then add it to the nodestore */ -UA_StatusCode Operation_addNode_begin(UA_Server *server, UA_Session *session, const UA_AddNodesItem *item, - void *nodeContext, UA_NodeId *outNewNodeId) { - /* Check the namespaceindex */ - if (item->requestedNewNodeId.nodeId.namespaceIndex >= server->namespacesSize) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Namespace invalid"); - return UA_STATUSCODE_BADNODEIDINVALID; - } - - if (item->nodeAttributes.encoding != UA_EXTENSIONOBJECT_DECODED && - item->nodeAttributes.encoding != UA_EXTENSIONOBJECT_DECODED_NODELETE) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Node attributes invalid"); - return UA_STATUSCODE_BADINTERNALERROR; - } - - /* Create a node */ - UA_Node *node = UA_Nodestore_new(server, item->nodeClass); - if (!node) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: Node could not create a node " - "in the nodestore"); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - - /* Fill the node */ - node->context = nodeContext; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - retval |= UA_NodeId_copy(&item->requestedNewNodeId.nodeId, &node->nodeId); - retval |= UA_QualifiedName_copy(&item->browseName, &node->browseName); - retval |= - UA_Node_setAttributes(node, item->nodeAttributes.content.decoded.data, item->nodeAttributes.content.decoded.type); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: Node could not create a node " - "with error code %s", - UA_StatusCode_name(retval)); - UA_Nodestore_delete(server, node); - return retval; - } - - if (server->bootstrapNS0) goto finished_checks; - - /* Use attributes from the typedefinition */ - if (node->nodeClass == UA_NODECLASS_VARIABLE || node->nodeClass == UA_NODECLASS_VARIABLETYPE) { - /* Use attributes from the type. The value and value constraints are the - * same for the variable and variabletype attribute structs. */ - retval = useVariableTypeAttributes(server, session, (UA_VariableNode *)node, item); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: Using attributes from the variable type " - "failed with error code %s", - UA_StatusCode_name(retval)); - UA_Nodestore_delete(server, node); - return retval; - } - } - -finished_checks: - /* Add the node to the nodestore */ - retval = UA_Nodestore_insert(server, node, outNewNodeId); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: Node could not add the new node " - "to the nodestore with error code %s", - UA_StatusCode_name(retval)); - } - return retval; -} - -static void removeDeconstructedNode(UA_Server *server, UA_Session *session, const UA_Node *node, - UA_Boolean removeTargetRefs); - -static const UA_NodeId hasSubtype = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_HASSUBTYPE}}; - -/* Children, references, type-checking, constructors. */ -UA_StatusCode Operation_addNode_finish(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, - const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId, - const UA_NodeId *typeDefinitionId) { - UA_StatusCode retval = UA_STATUSCODE_GOOD; - const UA_Node *type = NULL; - - /* Get the node */ - const UA_Node *node = UA_Nodestore_get(server, nodeId); - if (!node) return UA_STATUSCODE_BADNODEIDUNKNOWN; - - /* Use the typeDefinition as parent for type-nodes */ - if (node->nodeClass == UA_NODECLASS_VARIABLETYPE || node->nodeClass == UA_NODECLASS_OBJECTTYPE || - node->nodeClass == UA_NODECLASS_REFERENCETYPE || node->nodeClass == UA_NODECLASS_DATATYPE) { - if (UA_NodeId_equal(referenceTypeId, &UA_NODEID_NULL)) referenceTypeId = &hasSubtype; - const UA_Node *parentNode = UA_Nodestore_get(server, parentNodeId); - if (parentNode) { - if (parentNode->nodeClass == node->nodeClass) typeDefinitionId = parentNodeId; - UA_Nodestore_release(server, parentNode); - } - } - - if (server->bootstrapNS0) goto get_type; - - /* Check parent reference. Objects may have no parent. */ - retval = checkParentReference(server, session, node->nodeClass, parentNodeId, referenceTypeId); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: The parent reference is invalid"); - UA_Nodestore_release(server, node); - UA_Server_deleteNode(server, *nodeId, true); - return retval; - } - - /* Replace empty typeDefinition with the most permissive default */ - if ((node->nodeClass == UA_NODECLASS_VARIABLE || node->nodeClass == UA_NODECLASS_OBJECT) && - UA_NodeId_isNull(typeDefinitionId)) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: No TypeDefinition; Use the default " - "TypeDefinition for the Variable/Object"); - if (node->nodeClass == UA_NODECLASS_VARIABLE) - typeDefinitionId = &baseDataVariableType; - else - typeDefinitionId = &baseObjectType; - } - -get_type: - /* Get the node type. There must be a typedefinition for variables, objects - * and type-nodes. See the above checks. */ - if (!UA_NodeId_isNull(typeDefinitionId)) { - /* Get the type node */ - type = UA_Nodestore_get(server, typeDefinitionId); - if (!type) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Node type not found in nodestore"); - retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; - goto cleanup; - } - - UA_Boolean typeOk = UA_FALSE; - switch (node->nodeClass) { - case UA_NODECLASS_DATATYPE: - typeOk = type->nodeClass == UA_NODECLASS_DATATYPE; - break; - case UA_NODECLASS_METHOD: - typeOk = type->nodeClass == UA_NODECLASS_METHOD; - break; - case UA_NODECLASS_OBJECT: - typeOk = type->nodeClass == UA_NODECLASS_OBJECTTYPE; - break; - case UA_NODECLASS_OBJECTTYPE: - typeOk = type->nodeClass == UA_NODECLASS_OBJECTTYPE; - break; - case UA_NODECLASS_REFERENCETYPE: - typeOk = type->nodeClass == UA_NODECLASS_REFERENCETYPE; - break; - case UA_NODECLASS_VARIABLE: - typeOk = type->nodeClass == UA_NODECLASS_VARIABLETYPE; - break; - case UA_NODECLASS_VARIABLETYPE: - typeOk = type->nodeClass == UA_NODECLASS_VARIABLETYPE; - break; - case UA_NODECLASS_VIEW: - typeOk = type->nodeClass == UA_NODECLASS_VIEW; - break; - default: - typeOk = UA_FALSE; - } - if (!typeOk) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Type does not match node class"); - retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; - goto cleanup; - } - - /* See if the type has the correct node class. For type-nodes, we know - * that type has the same nodeClass from checkParentReference. */ - if (!server->bootstrapNS0 && node->nodeClass == UA_NODECLASS_VARIABLE) { - if (((const UA_VariableTypeNode *)type)->isAbstract) { - /* Abstract variable is allowed if parent is a children of a base data variable */ - const UA_NodeId variableTypes = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE); - /* A variable may be of an object type which again is below BaseObjectType */ - const UA_NodeId objectTypes = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE); - const UA_NodeId refs[2] = {UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE), - UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT)}; - if (!isNodeInTree(&server->config.nodestore, parentNodeId, &variableTypes, refs, 2) && - !isNodeInTree(&server->config.nodestore, parentNodeId, &objectTypes, refs, 2)) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: Type of variable node must " - "be VariableType and not cannot be abstract"); - retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; - goto cleanup; - } - } - } - - if (!server->bootstrapNS0 && node->nodeClass == UA_NODECLASS_OBJECT) { - if (((const UA_ObjectTypeNode *)type)->isAbstract) { - /* Object node created of an abstract ObjectType. Only allowed if within BaseObjectType folder */ - const UA_NodeId objectTypes = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE); - const UA_NodeId refs[2] = {UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE), - UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT)}; - if (!isNodeInTree(&server->config.nodestore, parentNodeId, &objectTypes, refs, 2)) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: Type of object node must " - "be ObjectType and not be abstract"); - retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; - goto cleanup; - } - } - } - } - - /* Check if all attributes hold the constraints of the type now. The initial - * attributes must type-check. The constructor might change the attributes - * again. Then, the changes are type-checked by the normal write service. */ - if (type && (node->nodeClass == UA_NODECLASS_VARIABLE || node->nodeClass == UA_NODECLASS_VARIABLETYPE)) { - retval = typeCheckVariableNode(server, session, (const UA_VariableNode *)node, (const UA_VariableTypeNode *)type, - parentNodeId); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: Type-checking the variable node " - "failed with error code %s", - UA_StatusCode_name(retval)); - goto cleanup; - } - } - - /* Instantiate variables and objects */ - if (node->nodeClass == UA_NODECLASS_VARIABLE || node->nodeClass == UA_NODECLASS_OBJECT) { - UA_assert(type != NULL); /* see above */ - /* Add (mandatory) child nodes from the type definition */ - if (!server->bootstrapNS0) { - retval = addChildren(server, session, node, type); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Adding child nodes failed with error code %s", - UA_StatusCode_name(retval)); - goto cleanup; - } - } - - /* Add a hasTypeDefinition reference */ - retval = addTypeDefRef(server, session, node, type); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: Adding a reference to the type " - "definition failed with error code %s", - UA_StatusCode_name(retval)); - goto cleanup; - } - } - - /* Add reference to the parent */ - if (!UA_NodeId_isNull(parentNodeId)) { - if (UA_NodeId_isNull(referenceTypeId)) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Reference to parent cannot be null"); - retval = UA_STATUSCODE_BADTYPEDEFINITIONINVALID; - goto cleanup; - } - - retval = addParentRef(server, session, nodeId, referenceTypeId, parentNodeId); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Adding reference to parent failed"); - goto cleanup; - } - } - - /* Call the constructor(s) */ - retval = callConstructors(server, session, node, type); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "AddNodes: Calling the node constructor(s) failed " - "with status code %s", - UA_StatusCode_name(retval)); - } - -cleanup: - if (type) UA_Nodestore_release(server, type); - if (retval != UA_STATUSCODE_GOOD) removeDeconstructedNode(server, session, node, true); - UA_Nodestore_release(server, node); - return retval; -} - -static void Operation_addNode(UA_Server *server, UA_Session *session, const UA_AddNodesItem *item, void *nodeContext, - UA_AddNodesResult *result) { - /* Do not check access for server */ - if (session != &adminSession && server->config.accessControl.allowAddNode && - !server->config.accessControl.allowAddNode(&session->sessionId, session->sessionHandle, item)) { - result->statusCode = UA_STATUSCODE_BADUSERACCESSDENIED; - return; - } - - result->statusCode = Operation_addNode_begin(server, session, item, nodeContext, &result->addedNodeId); - if (result->statusCode != UA_STATUSCODE_GOOD) return; - - /* AddNodes_finish */ - result->statusCode = Operation_addNode_finish(server, session, &result->addedNodeId, &item->parentNodeId.nodeId, - &item->referenceTypeId, &item->typeDefinition.nodeId); - - /* If finishing failed, the node was deleted */ - if (result->statusCode != UA_STATUSCODE_GOOD) UA_NodeId_deleteMembers(&result->addedNodeId); -} - -static void Service_AddNode(UA_Server *server, UA_Session *session, const UA_AddNodesItem *item, - UA_AddNodesResult *result) { - Operation_addNode(server, session, item, NULL, result); -} - -void Service_AddNodes(UA_Server *server, UA_Session *session, const UA_AddNodesRequest *request, - UA_AddNodesResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing AddNodesRequest"); - - if (server->config.maxNodesPerNodeManagement != 0 && - request->nodesToAddSize > server->config.maxNodesPerNodeManagement) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)Service_AddNode, &request->nodesToAddSize, &UA_TYPES[UA_TYPES_ADDNODESITEM], - &response->resultsSize, &UA_TYPES[UA_TYPES_ADDNODESRESULT]); -} - -UA_StatusCode __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass, const UA_NodeId *requestedNewNodeId, - const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId, - const UA_QualifiedName browseName, const UA_NodeId *typeDefinition, - const UA_NodeAttributes *attr, const UA_DataType *attributeType, void *nodeContext, - UA_NodeId *outNewNodeId) { - /* Create the AddNodesItem */ - UA_AddNodesItem item; - UA_AddNodesItem_init(&item); - item.nodeClass = nodeClass; - item.requestedNewNodeId.nodeId = *requestedNewNodeId; - item.browseName = browseName; - item.parentNodeId.nodeId = *parentNodeId; - item.referenceTypeId = *referenceTypeId; - item.typeDefinition.nodeId = *typeDefinition; - item.nodeAttributes.encoding = UA_EXTENSIONOBJECT_DECODED_NODELETE; - item.nodeAttributes.content.decoded.type = attributeType; - item.nodeAttributes.content.decoded.data = (void *)(uintptr_t)attr; - - /* Call the normal addnodes service */ - UA_AddNodesResult result; - UA_AddNodesResult_init(&result); - Operation_addNode(server, &adminSession, &item, nodeContext, &result); - if (outNewNodeId) - *outNewNodeId = result.addedNodeId; - else - UA_NodeId_deleteMembers(&result.addedNodeId); - return result.statusCode; -} - -UA_StatusCode UA_Server_addNode_begin(UA_Server *server, const UA_NodeClass nodeClass, - const UA_NodeId requestedNewNodeId, const UA_QualifiedName browseName, - const UA_NodeId typeDefinition, const void *attr, - const UA_DataType *attributeType, void *nodeContext, UA_NodeId *outNewNodeId) { - UA_AddNodesItem item; - UA_AddNodesItem_init(&item); - item.nodeClass = nodeClass; - item.requestedNewNodeId.nodeId = requestedNewNodeId; - item.browseName = browseName; - item.typeDefinition.nodeId = typeDefinition; - item.nodeAttributes.encoding = UA_EXTENSIONOBJECT_DECODED_NODELETE; - item.nodeAttributes.content.decoded.type = attributeType; - item.nodeAttributes.content.decoded.data = (void *)(uintptr_t)attr; - return Operation_addNode_begin(server, &adminSession, &item, nodeContext, outNewNodeId); -} - -UA_StatusCode UA_Server_addNode_finish(UA_Server *server, const UA_NodeId nodeId, const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, const UA_NodeId typeDefinitionId) { - return Operation_addNode_finish(server, &adminSession, &nodeId, &parentNodeId, &referenceTypeId, &typeDefinitionId); -} - -/****************/ -/* Delete Nodes */ -/****************/ - -static void deleteReference(UA_Server *server, UA_Session *session, const UA_DeleteReferencesItem *item, - UA_StatusCode *retval); - -/* Remove references to this node (in the other nodes) */ -static void removeIncomingReferences(UA_Server *server, UA_Session *session, const UA_Node *node) { - UA_DeleteReferencesItem item; - UA_DeleteReferencesItem_init(&item); - item.targetNodeId.nodeId = node->nodeId; - item.deleteBidirectional = false; - UA_StatusCode dummy; - for (size_t i = 0; i < node->referencesSize; ++i) { - UA_NodeReferenceKind *refs = &node->references[i]; - item.isForward = refs->isInverse; - item.referenceTypeId = refs->referenceTypeId; - for (size_t j = 0; j < refs->targetIdsSize; ++j) { - item.sourceNodeId = refs->targetIds[j].nodeId; - deleteReference(server, session, &item, &dummy); - } - } -} - -static void deconstructNode(UA_Server *server, UA_Session *session, const UA_Node *node) { - /* Call the type-level destructor */ - void *context = node->context; /* No longer needed after this function */ - if (node->nodeClass == UA_NODECLASS_OBJECT || node->nodeClass == UA_NODECLASS_VARIABLE) { - const UA_Node *type = getNodeType(server, node); - if (type) { - const UA_NodeTypeLifecycle *lifecycle; - if (node->nodeClass == UA_NODECLASS_OBJECT) - lifecycle = &((const UA_ObjectTypeNode *)type)->lifecycle; - else - lifecycle = &((const UA_VariableTypeNode *)type)->lifecycle; - if (lifecycle->destructor) - lifecycle->destructor(server, &session->sessionId, session->sessionHandle, &type->nodeId, type->context, - &node->nodeId, &context); - UA_Nodestore_release(server, type); - } - } - - /* Call the global destructor */ - if (server->config.nodeLifecycle.destructor) - server->config.nodeLifecycle.destructor(server, &session->sessionId, session->sessionHandle, &node->nodeId, - context); -} - -static void deleteNodeOperation(UA_Server *server, UA_Session *session, const UA_DeleteNodesItem *item, - UA_StatusCode *result); - -static void removeChildren(UA_Server *server, UA_Session *session, const UA_Node *node) { - /* Browse to get all children of the node */ - UA_BrowseDescription bd; - UA_BrowseDescription_init(&bd); - bd.nodeId = node->nodeId; - bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES); - bd.includeSubtypes = true; - bd.browseDirection = UA_BROWSEDIRECTION_FORWARD; - bd.nodeClassMask = UA_NODECLASS_OBJECT | UA_NODECLASS_VARIABLE | UA_NODECLASS_METHOD; - bd.resultMask = UA_BROWSERESULTMASK_NONE; - - UA_BrowseResult br; - UA_BrowseResult_init(&br); - Service_Browse_single(server, session, NULL, &bd, 0, &br); - if (br.statusCode != UA_STATUSCODE_GOOD) return; - - UA_DeleteNodesItem item; - item.deleteTargetReferences = true; - - /* Remove every child */ - for (size_t i = 0; i < br.referencesSize; ++i) { - UA_ReferenceDescription *rd = &br.references[i]; - item.nodeId = rd->nodeId.nodeId; - UA_StatusCode retval; - deleteNodeOperation(server, session, &item, &retval); - } - - UA_BrowseResult_deleteMembers(&br); -} - -static void removeDeconstructedNode(UA_Server *server, UA_Session *session, const UA_Node *node, - UA_Boolean removeTargetRefs) { - /* Remove all children of the node */ - removeChildren(server, session, node); - - /* Remove references to the node (not the references going out, as the node - * will be deleted anyway) */ - if (removeTargetRefs) removeIncomingReferences(server, session, node); - - /* Remove the node in the nodestore */ - UA_Nodestore_remove(server, &node->nodeId); -} - -static void deleteNodeOperation(UA_Server *server, UA_Session *session, const UA_DeleteNodesItem *item, - UA_StatusCode *result) { - /* Do not check access for server */ - if (session != &adminSession && server->config.accessControl.allowDeleteNode && - !server->config.accessControl.allowDeleteNode(&session->sessionId, session->sessionHandle, item)) { - *result = UA_STATUSCODE_BADUSERACCESSDENIED; - return; - } - - const UA_Node *node = UA_Nodestore_get(server, &item->nodeId); - if (!node) { - *result = UA_STATUSCODE_BADNODEIDUNKNOWN; - return; - } - - if (UA_Node_hasSubTypeOrInstances(node)) { - UA_LOG_INFO_SESSION(server->config.logger, session, - "Delete Nodes: Cannot delete a type node " - "with active instances or subtypes"); - UA_Nodestore_release(server, node); - *result = UA_STATUSCODE_BADINTERNALERROR; - return; - } - - /* TODO: Check if the information model consistency is violated */ - /* TODO: Check if the node is a mandatory child of a parent */ - - deconstructNode(server, session, node); - removeDeconstructedNode(server, session, node, item->deleteTargetReferences); - UA_Nodestore_release(server, node); -} - -void Service_DeleteNodes(UA_Server *server, UA_Session *session, const UA_DeleteNodesRequest *request, - UA_DeleteNodesResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing DeleteNodesRequest"); - - if (server->config.maxNodesPerNodeManagement != 0 && - request->nodesToDeleteSize > server->config.maxNodesPerNodeManagement) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)deleteNodeOperation, &request->nodesToDeleteSize, - &UA_TYPES[UA_TYPES_DELETENODESITEM], &response->resultsSize, &UA_TYPES[UA_TYPES_STATUSCODE]); -} - -UA_StatusCode UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId, UA_Boolean deleteReferences) { - UA_DeleteNodesItem item; - item.deleteTargetReferences = deleteReferences; - item.nodeId = nodeId; - UA_StatusCode retval = UA_STATUSCODE_GOOD; - deleteNodeOperation(server, &adminSession, &item, &retval); - return retval; -} - -/******************/ -/* Add References */ -/******************/ - -static UA_StatusCode addOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node, - const UA_AddReferencesItem *item) { - return UA_Node_addReference(node, item); -} - -static UA_StatusCode deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node, - const UA_DeleteReferencesItem *item) { - return UA_Node_deleteReference(node, item); -} - -static void addReference(UA_Server *server, UA_Session *session, const UA_AddReferencesItem *item, - UA_StatusCode *retval) { - /* Do not check access for server */ - if (session != &adminSession && server->config.accessControl.allowAddReference && - !server->config.accessControl.allowAddReference(&session->sessionId, session->sessionHandle, item)) { - *retval = UA_STATUSCODE_BADUSERACCESSDENIED; - return; - } - - /* Currently no expandednodeids are allowed */ - if (item->targetServerUri.length > 0) { - *retval = UA_STATUSCODE_BADNOTIMPLEMENTED; - return; - } - - /* Add the first direction */ - *retval = UA_Server_editNode(server, session, &item->sourceNodeId, (UA_EditNodeCallback)addOneWayReference, item); - if (*retval != UA_STATUSCODE_GOOD) return; - - /* Add the second direction */ - UA_AddReferencesItem secondItem; - UA_AddReferencesItem_init(&secondItem); - secondItem.sourceNodeId = item->targetNodeId.nodeId; - secondItem.referenceTypeId = item->referenceTypeId; - secondItem.isForward = !item->isForward; - secondItem.targetNodeId.nodeId = item->sourceNodeId; - /* keep default secondItem.targetNodeClass = UA_NODECLASS_UNSPECIFIED */ - *retval = UA_Server_editNode(server, session, &secondItem.sourceNodeId, (UA_EditNodeCallback)addOneWayReference, - &secondItem); - - /* remove reference if the second direction failed */ - if (*retval != UA_STATUSCODE_GOOD) { - UA_DeleteReferencesItem deleteItem; - deleteItem.sourceNodeId = item->sourceNodeId; - deleteItem.referenceTypeId = item->referenceTypeId; - deleteItem.isForward = item->isForward; - deleteItem.targetNodeId = item->targetNodeId; - deleteItem.deleteBidirectional = false; - /* ignore returned status code */ - UA_Server_editNode(server, session, &item->sourceNodeId, (UA_EditNodeCallback)deleteOneWayReference, &deleteItem); - } -} - -void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddReferencesRequest *request, - UA_AddReferencesResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing AddReferencesRequest"); - - if (server->config.maxNodesPerNodeManagement != 0 && - request->referencesToAddSize > server->config.maxNodesPerNodeManagement) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)addReference, &request->referencesToAddSize, - &UA_TYPES[UA_TYPES_ADDREFERENCESITEM], &response->resultsSize, &UA_TYPES[UA_TYPES_STATUSCODE]); -} - -UA_StatusCode UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId, const UA_NodeId refTypeId, - const UA_ExpandedNodeId targetId, UA_Boolean isForward) { - UA_AddReferencesItem item; - UA_AddReferencesItem_init(&item); - item.sourceNodeId = sourceId; - item.referenceTypeId = refTypeId; - item.isForward = isForward; - item.targetNodeId = targetId; - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - addReference(server, &adminSession, &item, &retval); - return retval; -} - -/*********************/ -/* Delete References */ -/*********************/ - -static void deleteReference(UA_Server *server, UA_Session *session, const UA_DeleteReferencesItem *item, - UA_StatusCode *retval) { - /* Do not check access for server */ - if (session != &adminSession && server->config.accessControl.allowDeleteReference && - !server->config.accessControl.allowDeleteReference(&session->sessionId, session->sessionHandle, item)) { - *retval = UA_STATUSCODE_BADUSERACCESSDENIED; - return; - } - - // TODO: Check consistency constraints, remove the references. - *retval = UA_Server_editNode(server, session, &item->sourceNodeId, (UA_EditNodeCallback)deleteOneWayReference, item); - if (*retval != UA_STATUSCODE_GOOD) return; - - if (!item->deleteBidirectional || item->targetNodeId.serverIndex != 0) return; - - UA_DeleteReferencesItem secondItem; - UA_DeleteReferencesItem_init(&secondItem); - secondItem.isForward = !item->isForward; - secondItem.sourceNodeId = item->targetNodeId.nodeId; - secondItem.targetNodeId.nodeId = item->sourceNodeId; - secondItem.referenceTypeId = item->referenceTypeId; - *retval = UA_Server_editNode(server, session, &secondItem.sourceNodeId, (UA_EditNodeCallback)deleteOneWayReference, - &secondItem); -} - -void Service_DeleteReferences(UA_Server *server, UA_Session *session, const UA_DeleteReferencesRequest *request, - UA_DeleteReferencesResponse *response) { - UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing DeleteReferencesRequest"); - - if (server->config.maxNodesPerNodeManagement != 0 && - request->referencesToDeleteSize > server->config.maxNodesPerNodeManagement) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADTOOMANYOPERATIONS; - return; - } - - response->responseHeader.serviceResult = UA_Server_processServiceOperations( - server, session, (UA_ServiceOperation)deleteReference, &request->referencesToDeleteSize, - &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM], &response->resultsSize, &UA_TYPES[UA_TYPES_STATUSCODE]); -} - -UA_StatusCode UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId, - const UA_NodeId referenceTypeId, UA_Boolean isForward, - const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional) { - UA_DeleteReferencesItem item; - item.sourceNodeId = sourceNodeId; - item.referenceTypeId = referenceTypeId; - item.isForward = isForward; - item.targetNodeId = targetNodeId; - item.deleteBidirectional = deleteBidirectional; - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - deleteReference(server, &adminSession, &item, &retval); - return retval; -} - -/**********************/ -/* Set Value Callback */ -/**********************/ - -static UA_StatusCode setValueCallback(UA_Server *server, UA_Session *session, UA_VariableNode *node, - UA_ValueCallback *callback) { - if (node->nodeClass != UA_NODECLASS_VARIABLE) return UA_STATUSCODE_BADNODECLASSINVALID; - node->value.data.callback = *callback; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId, - const UA_ValueCallback callback) { - return UA_Server_editNode(server, &adminSession, &nodeId, (UA_EditNodeCallback)setValueCallback, &callback); -} - -/***************************************************/ -/* Special Handling of Variables with Data Sources */ -/***************************************************/ - -UA_StatusCode UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, const UA_NodeId typeDefinition, - const UA_VariableAttributes attr, const UA_DataSource dataSource, - void *nodeContext, UA_NodeId *outNewNodeId) { - UA_AddNodesItem item; - UA_AddNodesItem_init(&item); - item.nodeClass = UA_NODECLASS_VARIABLE; - item.requestedNewNodeId.nodeId = requestedNewNodeId; - item.browseName = browseName; - item.nodeAttributes.encoding = UA_EXTENSIONOBJECT_DECODED_NODELETE; - item.nodeAttributes.content.decoded.data = (void *)(uintptr_t)&attr; - item.nodeAttributes.content.decoded.type = &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES]; - UA_NodeId newNodeId; - UA_Boolean deleteNodeId = UA_FALSE; - if (!outNewNodeId) { - newNodeId = UA_NODEID_NULL; - outNewNodeId = &newNodeId; - deleteNodeId = UA_TRUE; - } - UA_StatusCode retval = Operation_addNode_begin(server, &adminSession, &item, nodeContext, outNewNodeId); - if (retval != UA_STATUSCODE_GOOD) return retval; - retval = UA_Server_setVariableNode_dataSource(server, *outNewNodeId, dataSource); - if (retval == UA_STATUSCODE_GOOD) - retval = - Operation_addNode_finish(server, &adminSession, outNewNodeId, &parentNodeId, &referenceTypeId, &typeDefinition); - if (retval != UA_STATUSCODE_GOOD || deleteNodeId) UA_NodeId_deleteMembers(outNewNodeId); - return retval; -} - -static UA_StatusCode setDataSource(UA_Server *server, UA_Session *session, UA_VariableNode *node, - UA_DataSource *dataSource) { - if (node->nodeClass != UA_NODECLASS_VARIABLE) return UA_STATUSCODE_BADNODECLASSINVALID; - if (node->valueSource == UA_VALUESOURCE_DATA) UA_DataValue_deleteMembers(&node->value.data.value); - node->value.dataSource = *dataSource; - node->valueSource = UA_VALUESOURCE_DATASOURCE; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId, - const UA_DataSource dataSource) { - return UA_Server_editNode(server, &adminSession, &nodeId, (UA_EditNodeCallback)setDataSource, &dataSource); -} - -/************************************/ -/* Special Handling of Method Nodes */ -/************************************/ - -#ifdef UA_ENABLE_METHODCALLS - -static const UA_NodeId hasproperty = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_HASPROPERTY}}; -static const UA_NodeId propertytype = {0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_PROPERTYTYPE}}; - -UA_StatusCode UA_Server_addMethodNode_finish(UA_Server *server, const UA_NodeId nodeId, const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, UA_MethodCallback method, - size_t inputArgumentsSize, const UA_Argument *inputArguments, - size_t outputArgumentsSize, const UA_Argument *outputArguments) { - /* Browse to see which argument nodes exist */ - UA_BrowseDescription bd; - UA_BrowseDescription_init(&bd); - bd.nodeId = nodeId; - bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY); - bd.includeSubtypes = false; - bd.browseDirection = UA_BROWSEDIRECTION_FORWARD; - bd.nodeClassMask = UA_NODECLASS_VARIABLE; - bd.resultMask = UA_BROWSERESULTMASK_BROWSENAME; - - UA_BrowseResult br; - UA_BrowseResult_init(&br); - Service_Browse_single(server, &adminSession, NULL, &bd, 0, &br); - - UA_StatusCode retval = br.statusCode; - if (retval != UA_STATUSCODE_GOOD) { - UA_Server_deleteNode(server, nodeId, true); - UA_BrowseResult_deleteMembers(&br); - return retval; - } - - /* Filter out the argument nodes */ - UA_NodeId inputArgsId = UA_NODEID_NULL; - UA_NodeId outputArgsId = UA_NODEID_NULL; - const UA_NodeId newArgsId = UA_NODEID_NUMERIC(nodeId.namespaceIndex, 0); - const UA_QualifiedName inputArgsName = UA_QUALIFIEDNAME(0, "InputArguments"); - const UA_QualifiedName outputArgsName = UA_QUALIFIEDNAME(0, "OutputArguments"); - for (size_t i = 0; i < br.referencesSize; i++) { - UA_ReferenceDescription *rd = &br.references[i]; - if (rd->browseName.namespaceIndex == 0 && UA_String_equal(&rd->browseName.name, &inputArgsName.name)) - inputArgsId = rd->nodeId.nodeId; - else if (rd->browseName.namespaceIndex == 0 && UA_String_equal(&rd->browseName.name, &outputArgsName.name)) - outputArgsId = rd->nodeId.nodeId; - } - - /* Add the Input Arguments VariableNode */ - if (inputArgumentsSize > 0 && UA_NodeId_isNull(&inputArgsId)) { - UA_VariableAttributes inputargs = UA_VariableAttributes_default; - inputargs.displayName = UA_LOCALIZEDTEXT("", "InputArguments"); - /* UAExpert creates a monitoreditem on inputarguments ... */ - inputargs.minimumSamplingInterval = 100000.0f; - inputargs.valueRank = 1; - inputargs.dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE); - /* dirty-cast, but is treated as const ... */ - UA_Variant_setArray(&inputargs.value, (void *)(uintptr_t)inputArguments, inputArgumentsSize, - &UA_TYPES[UA_TYPES_ARGUMENT]); - retval = UA_Server_addVariableNode(server, newArgsId, nodeId, hasproperty, inputArgsName, propertytype, inputargs, - NULL, &inputArgsId); - } - - /* Add the Output Arguments VariableNode */ - if (outputArgumentsSize > 0 && UA_NodeId_isNull(&outputArgsId)) { - UA_VariableAttributes outputargs = UA_VariableAttributes_default; - outputargs.displayName = UA_LOCALIZEDTEXT("", "OutputArguments"); - /* UAExpert creates a monitoreditem on outputarguments ... */ - outputargs.minimumSamplingInterval = 100000.0f; - outputargs.valueRank = 1; - outputargs.dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE); - /* dirty-cast, but is treated as const ... */ - UA_Variant_setArray(&outputargs.value, (void *)(uintptr_t)outputArguments, outputArgumentsSize, - &UA_TYPES[UA_TYPES_ARGUMENT]); - retval |= UA_Server_addVariableNode(server, newArgsId, nodeId, hasproperty, outputArgsName, propertytype, - outputargs, NULL, &outputArgsId); - } - - retval |= UA_Server_setMethodNode_callback(server, nodeId, method); - - /* Call finish to add the parent reference */ - retval |= Operation_addNode_finish(server, &adminSession, &nodeId, &parentNodeId, &referenceTypeId, &UA_NODEID_NULL); - - if (retval != UA_STATUSCODE_GOOD) { - UA_Server_deleteNode(server, nodeId, true); - UA_Server_deleteNode(server, inputArgsId, true); - UA_Server_deleteNode(server, outputArgsId, true); - } - UA_BrowseResult_deleteMembers(&br); - return retval; -} - -UA_StatusCode UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, const UA_MethodAttributes attr, - UA_MethodCallback method, size_t inputArgumentsSize, - const UA_Argument *inputArguments, size_t outputArgumentsSize, - const UA_Argument *outputArguments, void *nodeContext, UA_NodeId *outNewNodeId) { - UA_AddNodesItem item; - UA_AddNodesItem_init(&item); - item.nodeClass = UA_NODECLASS_METHOD; - item.requestedNewNodeId.nodeId = requestedNewNodeId; - item.browseName = browseName; - item.nodeAttributes.encoding = UA_EXTENSIONOBJECT_DECODED_NODELETE; - item.nodeAttributes.content.decoded.data = (void *)(uintptr_t)&attr; - item.nodeAttributes.content.decoded.type = &UA_TYPES[UA_TYPES_METHODATTRIBUTES]; - - UA_NodeId newId; - if (!outNewNodeId) { - UA_NodeId_init(&newId); - outNewNodeId = &newId; - } - - UA_StatusCode retval = Operation_addNode_begin(server, &adminSession, &item, nodeContext, outNewNodeId); - if (retval != UA_STATUSCODE_GOOD) return retval; - - retval = UA_Server_addMethodNode_finish(server, *outNewNodeId, parentNodeId, referenceTypeId, method, - inputArgumentsSize, inputArguments, outputArgumentsSize, outputArguments); - - if (outNewNodeId == &newId) UA_NodeId_deleteMembers(&newId); - return retval; -} - -static UA_StatusCode editMethodCallback(UA_Server *server, UA_Session *session, UA_Node *node, void *handle) { - if (node->nodeClass != UA_NODECLASS_METHOD) return UA_STATUSCODE_BADNODECLASSINVALID; - UA_MethodNode *mnode = (UA_MethodNode *)node; - mnode->method = (UA_MethodCallback)(uintptr_t)handle; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Server_setMethodNode_callback(UA_Server *server, const UA_NodeId methodNodeId, - UA_MethodCallback methodCallback) { - return UA_Server_editNode(server, &adminSession, &methodNodeId, (UA_EditNodeCallback)editMethodCallback, - (void *)(uintptr_t)methodCallback); -} - -#endif - -/************************/ -/* Lifecycle Management */ -/************************/ - -static UA_StatusCode setNodeTypeLifecycle(UA_Server *server, UA_Session *session, UA_Node *node, - UA_NodeTypeLifecycle *lifecycle) { - if (node->nodeClass == UA_NODECLASS_OBJECTTYPE) { - UA_ObjectTypeNode *ot = (UA_ObjectTypeNode *)node; - ot->lifecycle = *lifecycle; - return UA_STATUSCODE_GOOD; - } - - if (node->nodeClass == UA_NODECLASS_VARIABLETYPE) { - UA_VariableTypeNode *vt = (UA_VariableTypeNode *)node; - vt->lifecycle = *lifecycle; - return UA_STATUSCODE_GOOD; - } - - return UA_STATUSCODE_BADNODECLASSINVALID; -} - -UA_StatusCode UA_Server_setNodeTypeLifecycle(UA_Server *server, UA_NodeId nodeId, UA_NodeTypeLifecycle lifecycle) { - return UA_Server_editNode(server, &adminSession, &nodeId, (UA_EditNodeCallback)setNodeTypeLifecycle, &lifecycle); -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/server/ua_services_discovery_multicast.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* Enable POSIX features */ -#if !defined(_XOPEN_SOURCE) && !defined(_WRS_KERNEL) -#define _XOPEN_SOURCE 600 -#endif -#ifndef _DEFAULT_SOURCE -#define _DEFAULT_SOURCE -#endif -/* On older systems we need to define _BSD_SOURCE. - * _DEFAULT_SOURCE is an alias for that. */ -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif - -#if defined(UA_ENABLE_DISCOVERY) && defined(UA_ENABLE_DISCOVERY_MULTICAST) - -#ifdef _MSC_VER -#ifndef UNDER_CE -#include //access -#define access _access -#endif -#else -#include //access -#endif - -#include -#include -#ifdef _WIN32 -#define CLOSESOCKET(S) closesocket((SOCKET)S) -#define errno__ WSAGetLastError() -#else -#define CLOSESOCKET(S) close(S) -#define errno__ errno -#endif - -#ifdef UA_ENABLE_MULTITHREADING - -static void *multicastWorkerLoop(UA_Server *server) { - struct timeval next_sleep = {.tv_sec = 0, .tv_usec = 0}; - volatile UA_Boolean *running = &server->mdnsRunning; - fd_set fds; - - while (*running) { - FD_ZERO(&fds); - FD_SET(server->mdnsSocket, &fds); - select(server->mdnsSocket + 1, &fds, 0, 0, &next_sleep); - - if (!*running) break; - - unsigned short retVal = - mdnsd_step(server->mdnsDaemon, server->mdnsSocket, FD_ISSET(server->mdnsSocket, &fds), true, &next_sleep); - if (retVal == 1) { - UA_LOG_SOCKET_ERRNO_WRAP(UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, - "Multicast error: Can not read from socket. %s", errno_str)); - break; - } else if (retVal == 2) { - UA_LOG_SOCKET_ERRNO_WRAP(UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, - "Multicast error: Can not write to socket. %s", errno_str)); - break; - } - } - return NULL; -} - -static UA_StatusCode multicastListenStart(UA_Server *server) { - int err = pthread_create(&server->mdnsThread, NULL, (void *(*)(void *))multicastWorkerLoop, server); - if (err != 0) { - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, "Multicast error: Can not create multicast thread."); - return UA_STATUSCODE_BADUNEXPECTEDERROR; - } - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode multicastListenStop(UA_Server *server) { - mdnsd_shutdown(server->mdnsDaemon); - // wake up select - write(server->mdnsSocket, "\0", 1); - if (pthread_join(server->mdnsThread, NULL)) { - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, "Multicast error: Can not stop thread."); - return UA_STATUSCODE_BADUNEXPECTEDERROR; - } - return UA_STATUSCODE_BADNOTIMPLEMENTED; -} - -#endif /* UA_ENABLE_MULTITHREADING */ - -static UA_StatusCode addMdnsRecordForNetworkLayer(UA_Server *server, const UA_String *appName, - const UA_ServerNetworkLayer *nl) { - UA_String hostname = UA_STRING_NULL; - UA_UInt16 port = 4840; - UA_String path = UA_STRING_NULL; - UA_StatusCode retval = UA_parseEndpointUrl(&nl->discoveryUrl, &hostname, &port, &path); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_NETWORK, "Server url is invalid: %.*s", - (int)nl->discoveryUrl.length, nl->discoveryUrl.data); - return retval; - } - UA_Discovery_addRecord(server, appName, &hostname, port, &path, UA_DISCOVERY_TCP, UA_TRUE, - server->config.serverCapabilities, &server->config.serverCapabilitiesSize); - return UA_STATUSCODE_GOOD; -} - -void startMulticastDiscoveryServer(UA_Server *server) { - UA_String *appName = &server->config.mdnsServerName; - for (size_t i = 0; i < server->config.networkLayersSize; i++) - addMdnsRecordForNetworkLayer(server, appName, &server->config.networkLayers[i]); - - /* find any other server on the net */ - UA_Discovery_multicastQuery(server); - -#ifdef UA_ENABLE_MULTITHREADING - multicastListenStart(server); -#endif -} - -void stopMulticastDiscoveryServer(UA_Server *server) { - char hostname[256]; - if (gethostname(hostname, 255) == 0) { - UA_String hnString = UA_STRING(hostname); - UA_Discovery_removeRecord(server, &server->config.mdnsServerName, &hnString, 4840, UA_TRUE); - } else { - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, "Could not get hostname for multicast discovery."); - } - -#ifdef UA_ENABLE_MULTITHREADING - multicastListenStop(server); -#else - // send out last package with TTL = 0 - iterateMulticastDiscoveryServer(server, NULL, UA_FALSE); -#endif -} - -/* All filter criteria must be fulfilled */ -static UA_Boolean filterServerRecord(size_t serverCapabilityFilterSize, UA_String *serverCapabilityFilter, - serverOnNetwork_list_entry *current) { - for (size_t i = 0; i < serverCapabilityFilterSize; i++) { - for (size_t j = 0; j < current->serverOnNetwork.serverCapabilitiesSize; j++) - if (!UA_String_equal(&serverCapabilityFilter[i], ¤t->serverOnNetwork.serverCapabilities[j])) return false; - } - return true; -} - -void Service_FindServersOnNetwork(UA_Server *server, UA_Session *session, const UA_FindServersOnNetworkRequest *request, - UA_FindServersOnNetworkResponse *response) { - /* Set LastCounterResetTime */ - UA_DateTime_copy(&server->serverOnNetworkRecordIdLastReset, &response->lastCounterResetTime); - - /* Compute the max number of records to return */ - UA_UInt32 recordCount = 0; - if (request->startingRecordId < server->serverOnNetworkRecordIdCounter) - recordCount = server->serverOnNetworkRecordIdCounter - request->startingRecordId; - if (request->maxRecordsToReturn && recordCount > request->maxRecordsToReturn) - recordCount = MIN(recordCount, request->maxRecordsToReturn); - if (recordCount == 0) { - response->serversSize = 0; - return; - } - - /* Iterate over all records and add to filtered list */ - UA_UInt32 filteredCount = 0; - UA_ServerOnNetwork **filtered = (UA_ServerOnNetwork **)UA_alloca(sizeof(UA_ServerOnNetwork *) * recordCount); - serverOnNetwork_list_entry *current; - LIST_FOREACH(current, &server->serverOnNetwork, pointers) { - if (filteredCount >= recordCount) break; - if (current->serverOnNetwork.recordId < request->startingRecordId) continue; - if (!filterServerRecord(request->serverCapabilityFilterSize, request->serverCapabilityFilter, current)) continue; - filtered[filteredCount++] = ¤t->serverOnNetwork; - } - - if (filteredCount == 0) return; - - /* Allocate the array for the response */ - response->servers = (UA_ServerOnNetwork *)UA_malloc(sizeof(UA_ServerOnNetwork) * filteredCount); - if (!response->servers) { - response->responseHeader.serviceResult = UA_STATUSCODE_BADOUTOFMEMORY; - return; - } - response->serversSize = filteredCount; - - /* Copy the server names */ - for (size_t i = 0; i < filteredCount; i++) - UA_ServerOnNetwork_copy(filtered[i], &response->servers[filteredCount - i - 1]); -} - -void UA_Discovery_update_MdnsForDiscoveryUrl(UA_Server *server, const UA_String *serverName, - const UA_MdnsDiscoveryConfiguration *mdnsConfig, - const UA_String *discoveryUrl, UA_Boolean isOnline, UA_Boolean updateTxt) { - UA_String hostname = UA_STRING_NULL; - UA_UInt16 port = 4840; - UA_String path = UA_STRING_NULL; - UA_StatusCode retval = UA_parseEndpointUrl(discoveryUrl, &hostname, &port, &path); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_NETWORK, "Server url invalid: %.*s", (int)discoveryUrl->length, - discoveryUrl->data); - return; - } - - if (!isOnline) { - UA_StatusCode removeRetval = UA_Discovery_removeRecord(server, serverName, &hostname, port, updateTxt); - if (removeRetval != UA_STATUSCODE_GOOD) - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER, "Could not remove mDNS record for hostname %.*s.", - (int)serverName->length, serverName->data); - return; - } - - UA_String *capabilities = NULL; - size_t capabilitiesSize = 0; - if (mdnsConfig) { - capabilities = mdnsConfig->serverCapabilities; - capabilitiesSize = mdnsConfig->serverCapabilitiesSize; - } - - UA_StatusCode addRetval = UA_Discovery_addRecord(server, serverName, &hostname, port, &path, UA_DISCOVERY_TCP, - updateTxt, capabilities, &capabilitiesSize); - if (addRetval != UA_STATUSCODE_GOOD) - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER, "Could not add mDNS record for hostname %.*s.", - (int)serverName->length, serverName->data); -} - -void UA_Server_setServerOnNetworkCallback(UA_Server *server, UA_Server_serverOnNetworkCallback cb, void *data) { - server->serverOnNetworkCallback = cb; - server->serverOnNetworkCallbackData = data; -} - -static void socket_mdns_set_nonblocking(int sockfd) { -#ifdef _WIN32 - u_long iMode = 1; - ioctlsocket(sockfd, FIONBIO, &iMode); -#else - int opts = fcntl(sockfd, F_GETFL); - fcntl(sockfd, F_SETFL, opts | O_NONBLOCK); -#endif -} - -/* Create multicast 224.0.0.251:5353 socket */ -#ifdef _WIN32 -static SOCKET -#else -static int -#endif -discovery_createMulticastSocket(void) { -#ifdef _WIN32 - SOCKET s; -#else - int s; -#endif - int flag = 1, ittl = 255; - struct sockaddr_in in; - struct ip_mreq mc; - char ttl = (char)255; // publish to complete net, not only subnet. See: - // https://docs.oracle.com/cd/E23824_01/html/821-1602/sockets-137.html - - memset(&in, 0, sizeof(in)); - in.sin_family = AF_INET; - in.sin_port = htons(5353); - in.sin_addr.s_addr = 0; - -#ifdef _WIN32 - if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_SOCKET) return INVALID_SOCKET; -#else - if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) return -1; -#endif - -#ifdef SO_REUSEPORT - setsockopt(s, SOL_SOCKET, SO_REUSEPORT, (char *)&flag, sizeof(flag)); -#endif - setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof(flag)); - if (bind(s, (struct sockaddr *)&in, sizeof(in))) { - CLOSESOCKET(s); -#ifdef _WIN32 - return INVALID_SOCKET; -#else - return -1; -#endif - } - - mc.imr_multiaddr.s_addr = inet_addr("224.0.0.251"); - mc.imr_interface.s_addr = htonl(INADDR_ANY); - setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mc, sizeof(mc)); - setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(ttl)); - setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ittl, sizeof(ittl)); - - socket_mdns_set_nonblocking(s); - return s; -} - -UA_StatusCode initMulticastDiscoveryServer(UA_Server *server) { - server->mdnsDaemon = mdnsd_new(QCLASS_IN, 1000); -#ifdef _WIN32 - WORD wVersionRequested = MAKEWORD(2, 2); - WSADATA wsaData; - WSAStartup(wVersionRequested, &wsaData); -#endif - -#ifdef _WIN32 - if ((server->mdnsSocket = discovery_createMulticastSocket()) == INVALID_SOCKET) { -#else - if ((server->mdnsSocket = discovery_createMulticastSocket()) < 0) { -#endif - UA_LOG_SOCKET_ERRNO_WRAP(UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, - "Could not create multicast socket. Error: %s", errno_str)); - return UA_STATUSCODE_BADUNEXPECTEDERROR; - } - mdnsd_register_receive_callback(server->mdnsDaemon, mdns_record_received, server); - return UA_STATUSCODE_GOOD; -} - -void destroyMulticastDiscoveryServer(UA_Server *server) { - mdnsd_shutdown(server->mdnsDaemon); - mdnsd_free(server->mdnsDaemon); -#ifdef _WIN32 - if (server->mdnsSocket != INVALID_SOCKET) { -#else - if (server->mdnsSocket >= 0) { -#endif - CLOSESOCKET(server->mdnsSocket); -#ifdef _WIN32 - server->mdnsSocket = INVALID_SOCKET; -#else - server->mdnsSocket = -1; -#endif - } -} - -static void UA_Discovery_multicastConflict(char *name, int type, void *arg) { - // cppcheck-suppress unreadVariable - UA_Server *server = (UA_Server *)arg; - UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, - "Multicast DNS name conflict detected: " - "'%s' for type %d", - name, type); -} - -/* Create a service domain with the format [servername]-[hostname]._opcua-tcp._tcp.local. */ -static void createFullServiceDomain(char *outServiceDomain, size_t maxLen, const UA_String *servername, - const UA_String *hostname) { - size_t hostnameLen = hostname->length; - size_t servernameLen = servername->length; - - maxLen -= 24; /* the length we have remaining before the opc ua postfix and - * the trailing zero */ - - /* Can we use hostname and servername with full length? */ - if (hostnameLen + servernameLen + 1 > maxLen) { - if (servernameLen + 2 > maxLen) { - servernameLen = maxLen; - hostnameLen = 0; - } else { - hostnameLen = maxLen - servernameLen - 1; - } - } - - /* Copy into outServiceDomain */ - size_t offset = 0; - memcpy(&outServiceDomain[offset], servername->data, servernameLen); - offset += servernameLen; - if (hostnameLen > 0) { - memcpy(&outServiceDomain[offset], "-", 1); - ++offset; - memcpy(&outServiceDomain[offset], hostname->data, hostnameLen); - offset += hostnameLen; - } - memcpy(&outServiceDomain[offset], "._opcua-tcp._tcp.local.", 23); - offset += 23; - outServiceDomain[offset] = 0; -} - -/* Check if mDNS already has an entry for given hostname and port combination */ -static UA_Boolean UA_Discovery_recordExists(UA_Server *server, const char *fullServiceDomain, unsigned short port, - const UA_DiscoveryProtocol protocol) { - // [servername]-[hostname]._opcua-tcp._tcp.local. 86400 IN SRV 0 5 port [hostname]. - mdns_record_t *r = mdnsd_get_published(server->mdnsDaemon, fullServiceDomain); - while (r) { - const mdns_answer_t *data = mdnsd_record_data(r); - if (data->type == QTYPE_SRV && (port == 0 || data->srv.port == port)) return UA_TRUE; - r = mdnsd_record_next(r); - } - return UA_FALSE; -} - -static int discovery_multicastQueryAnswer(mdns_answer_t *a, void *arg) { - UA_Server *server = (UA_Server *)arg; - if (a->type != QTYPE_PTR) return 0; - - if (a->rdname == NULL) return 0; - - /* Skip, if we already know about this server */ - UA_Boolean exists = UA_Discovery_recordExists(server, a->rdname, 0, UA_DISCOVERY_TCP); - if (exists == UA_TRUE) return 0; - - if (mdnsd_has_query(server->mdnsDaemon, a->rdname)) return 0; - - UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, "mDNS send query for: %s SRV&TXT %s", a->name, a->rdname); - - mdnsd_query(server->mdnsDaemon, a->rdname, QTYPE_SRV, discovery_multicastQueryAnswer, server); - mdnsd_query(server->mdnsDaemon, a->rdname, QTYPE_TXT, discovery_multicastQueryAnswer, server); - return 0; -} - -UA_StatusCode UA_Discovery_multicastQuery(UA_Server *server) { - mdnsd_query(server->mdnsDaemon, "_opcua-tcp._tcp.local.", QTYPE_PTR, discovery_multicastQueryAnswer, server); - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Discovery_addRecord(UA_Server *server, const UA_String *servername, const UA_String *hostname, - UA_UInt16 port, const UA_String *path, const UA_DiscoveryProtocol protocol, - UA_Boolean createTxt, const UA_String *capabilites, size_t *capabilitiesSize) { - if (!capabilitiesSize || (*capabilitiesSize > 0 && !capabilites)) return UA_STATUSCODE_BADINVALIDARGUMENT; - - size_t hostnameLen = hostname->length; - size_t servernameLen = servername->length; - if (hostnameLen == 0 || servernameLen == 0) return UA_STATUSCODE_BADOUTOFRANGE; - - // use a limit for the hostname length to make sure full string fits into 63 - // chars (limited by DNS spec) - if (hostnameLen + servernameLen + 1 > 63) { // include dash between servername-hostname - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER, - "Multicast DNS: Combination of hostname+servername exceeds " - "maximum of 62 chars. It will be truncated."); - } else if (hostnameLen > 63) { - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER, - "Multicast DNS: Hostname length exceeds maximum of 63 chars. " - "It will be truncated."); - } - - if (!server->mdnsMainSrvAdded) { - mdns_record_t *r = mdnsd_shared(server->mdnsDaemon, "_services._dns-sd._udp.local.", QTYPE_PTR, 600); - mdnsd_set_host(server->mdnsDaemon, r, "_opcua-tcp._tcp.local."); - server->mdnsMainSrvAdded = UA_TRUE; - } - - // [servername]-[hostname]._opcua-tcp._tcp.local. - char fullServiceDomain[63 + 24]; - createFullServiceDomain(fullServiceDomain, 63 + 24, servername, hostname); - - UA_Boolean exists = UA_Discovery_recordExists(server, fullServiceDomain, port, protocol); - if (exists == UA_TRUE) return UA_STATUSCODE_GOOD; - - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER, "Multicast DNS: add record for domain: %s", - fullServiceDomain); - - // _services._dns-sd._udp.local. PTR _opcua-tcp._tcp.local - - // check if there is already a PTR entry for the given service. - - // _opcua-tcp._tcp.local. PTR [servername]-[hostname]._opcua-tcp._tcp.local. - mdns_record_t *r = mdns_find_record(server->mdnsDaemon, QTYPE_PTR, "_opcua-tcp._tcp.local.", fullServiceDomain); - if (!r) { - r = mdnsd_shared(server->mdnsDaemon, "_opcua-tcp._tcp.local.", QTYPE_PTR, 600); - mdnsd_set_host(server->mdnsDaemon, r, fullServiceDomain); - } - - /* The first 63 characters of the hostname (or less) */ - size_t maxHostnameLen = MIN(hostnameLen, 63); - char localDomain[65]; - memcpy(localDomain, hostname->data, maxHostnameLen); - localDomain[maxHostnameLen] = '.'; - localDomain[maxHostnameLen + 1] = '\0'; - - // [servername]-[hostname]._opcua-tcp._tcp.local. 86400 IN SRV 0 5 port [hostname]. - r = mdnsd_unique(server->mdnsDaemon, fullServiceDomain, QTYPE_SRV, 600, UA_Discovery_multicastConflict, server); - mdnsd_set_srv(server->mdnsDaemon, r, 0, 0, port, localDomain); - - // A/AAAA record for all ip addresses. - // [servername]-[hostname]._opcua-tcp._tcp.local. A [ip]. - // [hostname]. A [ip]. - mdns_set_address_record(server, fullServiceDomain, localDomain); - - // TXT record: [servername]-[hostname]._opcua-tcp._tcp.local. TXT path=/ caps=NA,DA,... - if (createTxt) { - char *pathChars = (char *)UA_alloca(path->length + 1); - memcpy(pathChars, path->data, path->length); - pathChars[path->length] = 0; - mdns_create_txt(server, fullServiceDomain, pathChars, capabilites, capabilitiesSize, - UA_Discovery_multicastConflict); - } - - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Discovery_removeRecord(UA_Server *server, const UA_String *servername, const UA_String *hostname, - UA_UInt16 port, UA_Boolean removeTxt) { - // use a limit for the hostname length to make sure full string fits into 63 - // chars (limited by DNS spec) - size_t hostnameLen = hostname->length; - size_t servernameLen = servername->length; - if (hostnameLen == 0 || servernameLen == 0) return UA_STATUSCODE_BADOUTOFRANGE; - - if (hostnameLen + servernameLen + 1 > 63) { // include dash between servername-hostname - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER, - "Multicast DNS: Combination of hostname+servername exceeds " - "maximum of 62 chars. It will be truncated."); - } - - // [servername]-[hostname]._opcua-tcp._tcp.local. - char fullServiceDomain[63 + 24]; - createFullServiceDomain(fullServiceDomain, 63 + 24, servername, hostname); - - UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER, "Multicast DNS: remove record for domain: %s", - fullServiceDomain); - - // _opcua-tcp._tcp.local. PTR [servername]-[hostname]._opcua-tcp._tcp.local. - mdns_record_t *r = mdns_find_record(server->mdnsDaemon, QTYPE_PTR, "_opcua-tcp._tcp.local.", fullServiceDomain); - if (!r) { - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER, - "Multicast DNS: could not remove record. " - "PTR Record not found for domain: %s", - fullServiceDomain); - return UA_STATUSCODE_BADNOTHINGTODO; - } - mdnsd_done(server->mdnsDaemon, r); - - // looks for [servername]-[hostname]._opcua-tcp._tcp.local. 86400 IN SRV 0 5 port hostname.local. - // and TXT record: [servername]-[hostname]._opcua-tcp._tcp.local. TXT path=/ caps=NA,DA,... - // and A record: [servername]-[hostname]._opcua-tcp._tcp.local. A [ip] - mdns_record_t *r2 = mdnsd_get_published(server->mdnsDaemon, fullServiceDomain); - if (!r2) { - UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER, - "Multicast DNS: could not remove record. Record not " - "found for domain: %s", - fullServiceDomain); - return UA_STATUSCODE_BADNOTHINGTODO; - } - - while (r2) { - const mdns_answer_t *data = mdnsd_record_data(r2); - mdns_record_t *next = mdnsd_record_next(r2); - if ((removeTxt && data->type == QTYPE_TXT) || (removeTxt && data->type == QTYPE_A) || data->srv.port == port) { - mdnsd_done(server->mdnsDaemon, r2); - } - r2 = next; - } - - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode iterateMulticastDiscoveryServer(UA_Server *server, UA_DateTime *nextRepeat, UA_Boolean processIn) { - struct timeval next_sleep = {0, 0}; - unsigned short retval = mdnsd_step(server->mdnsDaemon, server->mdnsSocket, processIn, true, &next_sleep); - if (retval == 1) { - UA_LOG_SOCKET_ERRNO_WRAP(UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, - "Multicast error: Can not read from socket. %s", errno_str)); - return UA_STATUSCODE_BADNOCOMMUNICATION; - } else if (retval == 2) { - UA_LOG_SOCKET_ERRNO_WRAP(UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER, - "Multicast error: Can not write to socket. %s", errno_str)); - return UA_STATUSCODE_BADNOCOMMUNICATION; - } - - if (nextRepeat) - *nextRepeat = UA_DateTime_now() + - (UA_DateTime)((next_sleep.tv_sec * UA_DATETIME_SEC) + (next_sleep.tv_usec * UA_DATETIME_USEC)); - return UA_STATUSCODE_GOOD; -} - -#endif /* defined(UA_ENABLE_DISCOVERY) && defined(UA_ENABLE_DISCOVERY_MULTICAST) */ - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/client/ua_client.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/********************/ -/* Client Lifecycle */ -/********************/ - -static void UA_Client_init(UA_Client *client, UA_ClientConfig config) { - memset(client, 0, sizeof(UA_Client)); - /* TODO: Select policy according to the endpoint */ - UA_SecurityPolicy_None(&client->securityPolicy, UA_BYTESTRING_NULL, config.logger); - client->channel.securityPolicy = &client->securityPolicy; - client->channel.securityMode = UA_MESSAGESECURITYMODE_NONE; - client->config = config; -} - -UA_Client *UA_Client_new(UA_ClientConfig config) { - UA_Client *client = (UA_Client *)UA_malloc(sizeof(UA_Client)); - if (!client) return NULL; - UA_Client_init(client, config); - return client; -} - -static void UA_Client_deleteMembers(UA_Client *client) { - UA_Client_disconnect(client); - client->securityPolicy.deleteMembers(&client->securityPolicy); - UA_SecureChannel_deleteMembersCleanup(&client->channel); - UA_Connection_deleteMembers(&client->connection); - if (client->endpointUrl.data) UA_String_deleteMembers(&client->endpointUrl); - UA_UserTokenPolicy_deleteMembers(&client->token); - UA_NodeId_deleteMembers(&client->authenticationToken); - if (client->username.data) UA_String_deleteMembers(&client->username); - if (client->password.data) UA_String_deleteMembers(&client->password); - - /* Delete the async service calls */ - AsyncServiceCall *ac, *ac_tmp; - LIST_FOREACH_SAFE(ac, &client->asyncServiceCalls, pointers, ac_tmp) { - LIST_REMOVE(ac, pointers); - UA_free(ac); - } - -/* Delete the subscriptions */ -#ifdef UA_ENABLE_SUBSCRIPTIONS - UA_Client_NotificationsAckNumber *n, *tmp; - LIST_FOREACH_SAFE(n, &client->pendingNotificationsAcks, listEntry, tmp) { - LIST_REMOVE(n, listEntry); - UA_free(n); - } - UA_Client_Subscription *sub, *tmps; - LIST_FOREACH_SAFE(sub, &client->subscriptions, listEntry, tmps) - UA_Client_Subscriptions_forceDelete(client, sub); /* force local removal */ -#endif -} - -void UA_Client_reset(UA_Client *client) { - UA_Client_deleteMembers(client); - UA_Client_init(client, client->config); -} - -void UA_Client_delete(UA_Client *client) { - UA_Client_deleteMembers(client); - UA_free(client); -} - -UA_ClientState UA_Client_getState(UA_Client *client) { return client->state; } - -/****************/ -/* Raw Services */ -/****************/ - -/* For synchronous service calls. Execute async responses with a callback. When - * the response with the correct requestId turns up, return it via the - * SyncResponseDescription pointer. */ -typedef struct { - UA_Client *client; - UA_Boolean received; - UA_UInt32 requestId; - void *response; - const UA_DataType *responseType; -} SyncResponseDescription; - -/* For both synchronous and asynchronous service calls */ -static UA_StatusCode sendSymmetricServiceRequest(UA_Client *client, const void *request, const UA_DataType *requestType, - UA_UInt32 *requestId) { - /* Make sure we have a valid session */ - UA_StatusCode retval = UA_Client_manuallyRenewSecureChannel(client); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Adjusting the request header. The const attribute is violated, but we - * only touch the following members: */ - UA_RequestHeader *rr = (UA_RequestHeader *)(uintptr_t)request; - rr->authenticationToken = client->authenticationToken; /* cleaned up at the end */ - rr->timestamp = UA_DateTime_now(); - rr->requestHandle = ++client->requestHandle; - - /* Send the request */ - UA_UInt32 rqId = ++client->requestId; - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT, "Sending a request of type %i", - requestType->typeId.identifier.numeric); - retval = UA_SecureChannel_sendSymmetricMessage(&client->channel, rqId, UA_MESSAGETYPE_MSG, rr, requestType); - UA_NodeId_init(&rr->authenticationToken); /* Do not return the token to the user */ - if (retval != UA_STATUSCODE_GOOD) return retval; - - *requestId = rqId; - return UA_STATUSCODE_GOOD; -} - -/* Look for the async callback in the linked list, execute and delete it */ -static UA_StatusCode processAsyncResponse(UA_Client *client, UA_UInt32 requestId, UA_NodeId *responseTypeId, - const UA_ByteString *responseMessage, size_t *offset) { - /* Find the callback */ - AsyncServiceCall *ac; - LIST_FOREACH(ac, &client->asyncServiceCalls, pointers) { - if (ac->requestId == requestId) break; - } - if (!ac) return UA_STATUSCODE_BADREQUESTHEADERINVALID; - - /* Decode the response */ - void *response = UA_alloca(ac->responseType->memSize); - UA_StatusCode retval = UA_decodeBinary(responseMessage, offset, response, ac->responseType, 0, NULL); - - /* Call the callback */ - if (retval == UA_STATUSCODE_GOOD) { - ac->callback(client, ac->userdata, requestId, response); - UA_deleteMembers(response, ac->responseType); - } else { - UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT, "Could not decodee the response with Id %u", requestId); - } - - /* Remove the callback */ - LIST_REMOVE(ac, pointers); - UA_free(ac); - return retval; -} - -/* Processes the received service response. Either with an async callback or by - * decoding the message and returning it "upwards" in the - * SyncResponseDescription. */ -static UA_StatusCode processServiceResponse(void *application, UA_SecureChannel *channel, UA_MessageType messageType, - UA_UInt32 requestId, const UA_ByteString *message) { - SyncResponseDescription *rd = (SyncResponseDescription *)application; - - /* Must be OPN or MSG */ - if (messageType != UA_MESSAGETYPE_OPN && messageType != UA_MESSAGETYPE_MSG) { - UA_LOG_TRACE_CHANNEL(rd->client->config.logger, channel, "Invalid message type"); - return UA_STATUSCODE_BADTCPMESSAGETYPEINVALID; - } - - /* Has the SecureChannel timed out? - * TODO: Solve this for client and server together */ - if (rd->client->state >= UA_CLIENTSTATE_SECURECHANNEL && - (channel->securityToken.createdAt + (channel->securityToken.revisedLifetime * UA_DATETIME_MSEC)) < - UA_DateTime_nowMonotonic()) - return UA_STATUSCODE_BADSECURECHANNELCLOSED; - - /* Forward declaration for the goto */ - UA_NodeId expectedNodeId; - const UA_NodeId serviceFaultNodeId = UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_SERVICEFAULT].binaryEncodingId); - - /* Decode the data type identifier of the response */ - size_t offset = 0; - UA_NodeId responseId; - UA_StatusCode retval = UA_NodeId_decodeBinary(message, &offset, &responseId); - if (retval != UA_STATUSCODE_GOOD) goto finish; - - /* Got an asynchronous response. Don't expected a synchronous response - * (responseType NULL) or the id does not match. */ - if (!rd->responseType || requestId != rd->requestId) { - retval = processAsyncResponse(rd->client, requestId, &responseId, message, &offset); - goto finish; - } - - /* Got the synchronous response */ - rd->received = true; - - /* Check that the response type matches */ - expectedNodeId = UA_NODEID_NUMERIC(0, rd->responseType->binaryEncodingId); - if (UA_NodeId_equal(&responseId, &expectedNodeId)) { - /* Decode the response */ - retval = UA_decodeBinary(message, &offset, rd->response, rd->responseType, rd->client->config.customDataTypesSize, - rd->client->config.customDataTypes); - } else { - UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT, "Reply contains the wrong service response"); - if (UA_NodeId_equal(&responseId, &serviceFaultNodeId)) { - /* Decode only the message header with the servicefault */ - retval = UA_decodeBinary(message, &offset, rd->response, &UA_TYPES[UA_TYPES_SERVICEFAULT], 0, NULL); - } else { - /* Close the connection */ - retval = UA_STATUSCODE_BADCOMMUNICATIONERROR; - } - } - -finish: - if (retval == UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG(rd->client->config.logger, UA_LOGCATEGORY_CLIENT, "Received a response of type %i", - responseId.identifier.numeric); - } else { - if (retval == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED) retval = UA_STATUSCODE_BADRESPONSETOOLARGE; - UA_LOG_INFO(rd->client->config.logger, UA_LOGCATEGORY_CLIENT, "Error receiving the response with status code %s", - UA_StatusCode_name(retval)); - - if (rd->response) { - UA_ResponseHeader *respHeader = (UA_ResponseHeader *)rd->response; - respHeader->serviceResult = retval; - } - } - UA_NodeId_deleteMembers(&responseId); - - return retval; -} - -/* Forward complete chunks directly to the securechannel */ -static UA_StatusCode client_processChunk(void *application, UA_Connection *connection, UA_ByteString *chunk) { - SyncResponseDescription *rd = (SyncResponseDescription *)application; - return UA_SecureChannel_processChunk(&rd->client->channel, chunk, processServiceResponse, rd); -} - -/* Receive and process messages until a synchronous message arrives or the - * timout finishes */ -UA_StatusCode receiveServiceResponse(UA_Client *client, void *response, const UA_DataType *responseType, - UA_DateTime maxDate, UA_UInt32 *synchronousRequestId) { - /* Prepare the response and the structure we give into processServiceResponse */ - SyncResponseDescription rd = {client, false, 0, response, responseType}; - - /* Return upon receiving the synchronized response. All other responses are - * processed with a callback "in the background". */ - if (synchronousRequestId) rd.requestId = *synchronousRequestId; - - UA_StatusCode retval; - do { - UA_DateTime now = UA_DateTime_nowMonotonic(); - - /* >= avoid timeout to be set to 0 */ - if (now >= maxDate) return UA_STATUSCODE_GOODNONCRITICALTIMEOUT; - - /* round always to upper value to avoid timeout to be set to 0 - * if (maxDate - now) < (UA_DATETIME_MSEC/2) */ - UA_UInt32 timeout = (UA_UInt32)(((maxDate - now) + (UA_DATETIME_MSEC - 1)) / UA_DATETIME_MSEC); - - retval = UA_Connection_receiveChunksBlocking(&client->connection, &rd, client_processChunk, timeout); - - if (retval != UA_STATUSCODE_GOOD && retval != UA_STATUSCODE_GOODNONCRITICALTIMEOUT) { - if (retval == UA_STATUSCODE_BADCONNECTIONCLOSED) client->state = UA_CLIENTSTATE_DISCONNECTED; - UA_Client_close(client); - break; - } - } while (!rd.received); - return retval; -} - -void __UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType, void *response, - const UA_DataType *responseType) { - UA_init(response, responseType); - UA_ResponseHeader *respHeader = (UA_ResponseHeader *)response; - - /* Send the request */ - UA_UInt32 requestId; - UA_StatusCode retval = sendSymmetricServiceRequest(client, request, requestType, &requestId); - if (retval != UA_STATUSCODE_GOOD) { - if (retval == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED) - respHeader->serviceResult = UA_STATUSCODE_BADREQUESTTOOLARGE; - else - respHeader->serviceResult = retval; - UA_Client_close(client); - return; - } - - /* Retrieve the response */ - UA_DateTime maxDate = UA_DateTime_nowMonotonic() + (client->config.timeout * UA_DATETIME_MSEC); - retval = receiveServiceResponse(client, response, responseType, maxDate, &requestId); - if (retval == UA_STATUSCODE_GOODNONCRITICALTIMEOUT) { - /* In synchronous service, if we have don't have a reply we need to close the connection */ - UA_Client_close(client); - retval = UA_STATUSCODE_BADCONNECTIONCLOSED; - } - if (retval != UA_STATUSCODE_GOOD) respHeader->serviceResult = retval; -} - -UA_StatusCode __UA_Client_AsyncService(UA_Client *client, const void *request, const UA_DataType *requestType, - UA_ClientAsyncServiceCallback callback, const UA_DataType *responseType, - void *userdata, UA_UInt32 *requestId) { - /* Prepare the entry for the linked list */ - AsyncServiceCall *ac = (AsyncServiceCall *)UA_malloc(sizeof(AsyncServiceCall)); - if (!ac) return UA_STATUSCODE_BADOUTOFMEMORY; - ac->callback = callback; - ac->responseType = responseType; - ac->userdata = userdata; - - /* Call the service and set the requestId */ - UA_StatusCode retval = sendSymmetricServiceRequest(client, request, requestType, &ac->requestId); - if (retval != UA_STATUSCODE_GOOD) { - UA_free(ac); - return retval; - } - - /* Store the entry for async processing */ - LIST_INSERT_HEAD(&client->asyncServiceCalls, ac, pointers); - if (requestId) *requestId = ac->requestId; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Client_runAsync(UA_Client *client, UA_UInt16 timeout) { - /* TODO: Call repeated jobs that are scheduled */ - UA_DateTime maxDate = UA_DateTime_nowMonotonic() + (timeout * UA_DATETIME_MSEC); - UA_StatusCode retval = receiveServiceResponse(client, NULL, NULL, maxDate, NULL); - if (retval == UA_STATUSCODE_GOODNONCRITICALTIMEOUT) retval = UA_STATUSCODE_GOOD; - return retval; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/client/ua_client_connect.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#define UA_MINMESSAGESIZE 8192 - -/***********************/ -/* Open the Connection */ -/***********************/ - -static UA_StatusCode processACKResponse(void *application, UA_Connection *connection, UA_ByteString *chunk) { - UA_Client *client = (UA_Client *)application; - - /* Decode the message */ - size_t offset = 0; - UA_StatusCode retval; - UA_TcpMessageHeader messageHeader; - UA_TcpAcknowledgeMessage ackMessage; - retval = UA_TcpMessageHeader_decodeBinary(chunk, &offset, &messageHeader); - retval |= UA_TcpAcknowledgeMessage_decodeBinary(chunk, &offset, &ackMessage); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK, "Decoding ACK message failed"); - return retval; - } - - /* Store remote connection settings and adjust local configuration to not - * exceed the limits */ - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK, "Received ACK message"); - connection->remoteConf.maxChunkCount = ackMessage.maxChunkCount; /* may be zero -> unlimited */ - connection->remoteConf.maxMessageSize = ackMessage.maxMessageSize; /* may be zero -> unlimited */ - connection->remoteConf.protocolVersion = ackMessage.protocolVersion; - connection->remoteConf.sendBufferSize = ackMessage.sendBufferSize; - connection->remoteConf.recvBufferSize = ackMessage.receiveBufferSize; - if (connection->remoteConf.recvBufferSize < connection->localConf.sendBufferSize) - connection->localConf.sendBufferSize = connection->remoteConf.recvBufferSize; - if (connection->remoteConf.sendBufferSize < connection->localConf.recvBufferSize) - connection->localConf.recvBufferSize = connection->remoteConf.sendBufferSize; - connection->state = UA_CONNECTION_ESTABLISHED; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode HelAckHandshake(UA_Client *client) { - /* Get a buffer */ - UA_ByteString message; - UA_Connection *conn = &client->connection; - UA_StatusCode retval = conn->getSendBuffer(conn, UA_MINMESSAGESIZE, &message); - if (retval != UA_STATUSCODE_GOOD) return retval; - - /* Prepare the HEL message and encode at offset 8 */ - UA_TcpHelloMessage hello; - UA_String_copy(&client->endpointUrl, &hello.endpointUrl); /* must be less than 4096 bytes */ - hello.maxChunkCount = conn->localConf.maxChunkCount; - hello.maxMessageSize = conn->localConf.maxMessageSize; - hello.protocolVersion = conn->localConf.protocolVersion; - hello.receiveBufferSize = conn->localConf.recvBufferSize; - hello.sendBufferSize = conn->localConf.sendBufferSize; - - UA_Byte *bufPos = &message.data[8]; /* skip the header */ - const UA_Byte *bufEnd = &message.data[message.length]; - retval = UA_TcpHelloMessage_encodeBinary(&hello, &bufPos, &bufEnd); - UA_TcpHelloMessage_deleteMembers(&hello); - - /* Encode the message header at offset 0 */ - UA_TcpMessageHeader messageHeader; - messageHeader.messageTypeAndChunkType = UA_CHUNKTYPE_FINAL + UA_MESSAGETYPE_HEL; - messageHeader.messageSize = (UA_UInt32)((uintptr_t)bufPos - (uintptr_t)message.data); - bufPos = message.data; - retval |= UA_TcpMessageHeader_encodeBinary(&messageHeader, &bufPos, &bufEnd); - if (retval != UA_STATUSCODE_GOOD) { - conn->releaseSendBuffer(conn, &message); - return retval; - } - - /* Send the HEL message */ - message.length = messageHeader.messageSize; - retval = conn->send(conn, &message); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK, "Sending HEL failed"); - return retval; - } - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK, "Sent HEL message"); - - /* Loop until we have a complete chunk */ - retval = UA_Connection_receiveChunksBlocking(conn, client, processACKResponse, client->config.timeout); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK, "Receiving ACK message failed"); - if (retval == UA_STATUSCODE_BADCONNECTIONCLOSED) client->state = UA_CLIENTSTATE_DISCONNECTED; - UA_Client_close(client); - } - return retval; -} - -static void processDecodedOPNResponse(UA_Client *client, UA_OpenSecureChannelResponse *response) { - /* Replace the token */ - UA_ChannelSecurityToken_deleteMembers(&client->channel.securityToken); - client->channel.securityToken = response->securityToken; - UA_ChannelSecurityToken_init(&response->securityToken); - - /* Replace the nonce */ - UA_ByteString_deleteMembers(&client->channel.remoteNonce); - client->channel.remoteNonce = response->serverNonce; - UA_ByteString_init(&response->serverNonce); - - if (client->channel.state == UA_SECURECHANNELSTATE_OPEN) - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "SecureChannel in the server renewed"); - else - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, - "Opened SecureChannel acknowledged by the server"); - - /* Response.securityToken.revisedLifetime is UInt32 we need to cast it to - * DateTime=Int64 we take 75% of lifetime to start renewing as described in - * standard */ - client->channel.state = UA_SECURECHANNELSTATE_OPEN; - client->nextChannelRenewal = - UA_DateTime_nowMonotonic() + - (UA_DateTime)(client->channel.securityToken.revisedLifetime * (UA_Double)UA_DATETIME_MSEC * 0.75); -} - -static UA_StatusCode openSecureChannel(UA_Client *client, UA_Boolean renew) { - /* Check if sc is still valid */ - if (renew && client->nextChannelRenewal > UA_DateTime_nowMonotonic()) return UA_STATUSCODE_GOOD; - - UA_Connection *conn = &client->connection; - if (conn->state != UA_CONNECTION_ESTABLISHED) return UA_STATUSCODE_BADSERVERNOTCONNECTED; - - /* Prepare the OpenSecureChannelRequest */ - UA_OpenSecureChannelRequest opnSecRq; - UA_OpenSecureChannelRequest_init(&opnSecRq); - opnSecRq.requestHeader.timestamp = UA_DateTime_now(); - opnSecRq.requestHeader.authenticationToken = client->authenticationToken; - if (renew) { - opnSecRq.requestType = UA_SECURITYTOKENREQUESTTYPE_RENEW; - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "Requesting to renew the SecureChannel"); - } else { - opnSecRq.requestType = UA_SECURITYTOKENREQUESTTYPE_ISSUE; - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "Requesting to open a SecureChannel"); - } - opnSecRq.securityMode = UA_MESSAGESECURITYMODE_NONE; - opnSecRq.clientNonce = client->channel.localNonce; - opnSecRq.requestedLifetime = client->config.secureChannelLifeTime; - - /* Send the OPN message */ - UA_UInt32 requestId = ++client->requestId; - UA_StatusCode retval = UA_SecureChannel_sendAsymmetricOPNMessage(&client->channel, requestId, &opnSecRq, - &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST]); - if (retval != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "Sending OPN message failed with error %s", - UA_StatusCode_name(retval)); - UA_Client_close(client); - return retval; - } - - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "OPN message sent"); - - /* Receive / decrypt / decode the OPN response. Process async services in - * the background until the OPN response arrives. */ - UA_OpenSecureChannelResponse response; - retval = receiveServiceResponse(client, &response, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE], - UA_DateTime_nowMonotonic() + ((UA_DateTime)client->config.timeout * UA_DATETIME_MSEC), - &requestId); - - if (retval != UA_STATUSCODE_GOOD) { - UA_Client_close(client); - return retval; - } - - processDecodedOPNResponse(client, &response); - UA_OpenSecureChannelResponse_deleteMembers(&response); - return retval; -} - -static UA_StatusCode activateSession(UA_Client *client) { - UA_ActivateSessionRequest request; - UA_ActivateSessionRequest_init(&request); - request.requestHeader.requestHandle = ++client->requestHandle; - request.requestHeader.timestamp = UA_DateTime_now(); - request.requestHeader.timeoutHint = 600000; - - // manual ExtensionObject encoding of the identityToken - if (client->authenticationMethod == UA_CLIENTAUTHENTICATION_NONE) { - UA_AnonymousIdentityToken *identityToken = UA_AnonymousIdentityToken_new(); - UA_AnonymousIdentityToken_init(identityToken); - UA_String_copy(&client->token.policyId, &identityToken->policyId); - request.userIdentityToken.encoding = UA_EXTENSIONOBJECT_DECODED; - request.userIdentityToken.content.decoded.type = &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN]; - request.userIdentityToken.content.decoded.data = identityToken; - } else { - UA_UserNameIdentityToken *identityToken = UA_UserNameIdentityToken_new(); - UA_UserNameIdentityToken_init(identityToken); - UA_String_copy(&client->token.policyId, &identityToken->policyId); - UA_String_copy(&client->username, &identityToken->userName); - UA_String_copy(&client->password, &identityToken->password); - request.userIdentityToken.encoding = UA_EXTENSIONOBJECT_DECODED; - request.userIdentityToken.content.decoded.type = &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]; - request.userIdentityToken.content.decoded.data = identityToken; - } - - UA_ActivateSessionResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST], &response, - &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE]); - - if (response.responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT, "ActivateSession failed with error code %s", - UA_StatusCode_name(response.responseHeader.serviceResult)); - } - - UA_StatusCode retval = response.responseHeader.serviceResult; - UA_ActivateSessionRequest_deleteMembers(&request); - UA_ActivateSessionResponse_deleteMembers(&response); - return retval; -} - -/* Gets a list of endpoints. Memory is allocated for endpointDescription array */ -UA_StatusCode UA_Client_getEndpointsInternal(UA_Client *client, size_t *endpointDescriptionsSize, - UA_EndpointDescription **endpointDescriptions) { - UA_GetEndpointsRequest request; - UA_GetEndpointsRequest_init(&request); - request.requestHeader.timestamp = UA_DateTime_now(); - request.requestHeader.timeoutHint = 10000; - // assume the endpointurl outlives the service call - request.endpointUrl = client->endpointUrl; - - UA_GetEndpointsResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST], &response, - &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]); - - if (response.responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_StatusCode retval = response.responseHeader.serviceResult; - UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT, "GetEndpointRequest failed with error code %s", - UA_StatusCode_name(retval)); - UA_GetEndpointsResponse_deleteMembers(&response); - return retval; - } - *endpointDescriptions = response.endpoints; - *endpointDescriptionsSize = response.endpointsSize; - response.endpoints = NULL; - response.endpointsSize = 0; - UA_GetEndpointsResponse_deleteMembers(&response); - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode getEndpoints(UA_Client *client) { - UA_EndpointDescription *endpointArray = NULL; - size_t endpointArraySize = 0; - UA_StatusCode retval = UA_Client_getEndpointsInternal(client, &endpointArraySize, &endpointArray); - if (retval != UA_STATUSCODE_GOOD) return retval; - - UA_Boolean endpointFound = false; - UA_Boolean tokenFound = false; - UA_String securityNone = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None"); - UA_String binaryTransport = UA_STRING( - "http://opcfoundation.org/UA-Profile/" - "Transport/uatcp-uasc-uabinary"); - - // TODO: compare endpoint information with client->endpointUri - for (size_t i = 0; i < endpointArraySize; ++i) { - UA_EndpointDescription *endpoint = &endpointArray[i]; - /* look out for binary transport endpoints */ - /* Note: Siemens returns empty ProfileUrl, we will accept it as binary */ - if (endpoint->transportProfileUri.length != 0 && !UA_String_equal(&endpoint->transportProfileUri, &binaryTransport)) - continue; - /* look out for an endpoint without security */ - if (!UA_String_equal(&endpoint->securityPolicyUri, &securityNone)) continue; - - /* endpoint with no security found */ - endpointFound = true; - - /* look for a user token policy with an anonymous token */ - for (size_t j = 0; j < endpoint->userIdentityTokensSize; ++j) { - UA_UserTokenPolicy *userToken = &endpoint->userIdentityTokens[j]; - - /* Usertokens also have a security policy... */ - if (userToken->securityPolicyUri.length > 0 && !UA_String_equal(&userToken->securityPolicyUri, &securityNone)) - continue; - - /* UA_CLIENTAUTHENTICATION_NONE == UA_USERTOKENTYPE_ANONYMOUS - * UA_CLIENTAUTHENTICATION_USERNAME == UA_USERTOKENTYPE_USERNAME - * TODO: Check equivalence for other types when adding the support */ - if ((int)client->authenticationMethod != (int)userToken->tokenType) continue; - - /* Endpoint with matching usertokenpolicy found */ - tokenFound = true; - UA_UserTokenPolicy_deleteMembers(&client->token); - UA_UserTokenPolicy_copy(userToken, &client->token); - break; - } - } - - UA_Array_delete(endpointArray, endpointArraySize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); - - if (!endpointFound) { - UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT, "No suitable endpoint found"); - retval = UA_STATUSCODE_BADINTERNALERROR; - } else if (!tokenFound) { - UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT, - "No suitable UserTokenPolicy found for the possible endpoints"); - retval = UA_STATUSCODE_BADINTERNALERROR; - } - return retval; -} - -static UA_StatusCode createSession(UA_Client *client) { - UA_CreateSessionRequest request; - UA_CreateSessionRequest_init(&request); - - request.requestHeader.timestamp = UA_DateTime_now(); - request.requestHeader.timeoutHint = 10000; - UA_ByteString_copy(&client->channel.localNonce, &request.clientNonce); - request.requestedSessionTimeout = 1200000; - request.maxResponseMessageSize = UA_INT32_MAX; - UA_String_copy(&client->endpointUrl, &request.endpointUrl); - - UA_CreateSessionResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST], &response, - &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE]); - - UA_NodeId_copy(&response.authenticationToken, &client->authenticationToken); - - UA_StatusCode retval = response.responseHeader.serviceResult; - UA_CreateSessionRequest_deleteMembers(&request); - UA_CreateSessionResponse_deleteMembers(&response); - return retval; -} - -UA_StatusCode UA_Client_connectInternal(UA_Client *client, const char *endpointUrl, UA_Boolean endpointsHandshake, - UA_Boolean createNewSession) { - if (client->state >= UA_CLIENTSTATE_CONNECTED) return UA_STATUSCODE_GOOD; - UA_ChannelSecurityToken_init(&client->channel.securityToken); - client->channel.state = UA_SECURECHANNELSTATE_FRESH; - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - client->connection = - client->config.connectionFunc(client->config.localConnectionConfig, endpointUrl, client->config.timeout); - if (client->connection.state != UA_CONNECTION_OPENING) { - retval = UA_STATUSCODE_BADCONNECTIONCLOSED; - goto cleanup; - } - - UA_String_deleteMembers(&client->endpointUrl); - client->endpointUrl = UA_STRING_ALLOC(endpointUrl); - if (!client->endpointUrl.data) { - retval = UA_STATUSCODE_BADOUTOFMEMORY; - goto cleanup; - } - - /* Open a TCP connection */ - client->connection.localConf = client->config.localConnectionConfig; - retval = HelAckHandshake(client); - if (retval != UA_STATUSCODE_GOOD) goto cleanup; - client->state = UA_CLIENTSTATE_CONNECTED; - - /* Open a SecureChannel. TODO: Select with endpoint */ - client->channel.connection = &client->connection; - retval = openSecureChannel(client, false); - if (retval != UA_STATUSCODE_GOOD) goto cleanup; - client->state = UA_CLIENTSTATE_SECURECHANNEL; - - /* Try to activate an existing Session for this SecureChannel */ - if ((!UA_NodeId_equal(&client->authenticationToken, &UA_NODEID_NULL)) && (createNewSession)) { - retval = activateSession(client); - if (retval == UA_STATUSCODE_BADSESSIONIDINVALID) { - /* Could not recover an old session. Remove authenticationToken */ - UA_NodeId_deleteMembers(&client->authenticationToken); - } else { - if (retval != UA_STATUSCODE_GOOD) goto cleanup; - client->state = UA_CLIENTSTATE_SESSION; - return retval; - } - } else { - UA_NodeId_deleteMembers(&client->authenticationToken); - } - - /* Get Endpoints */ - if (endpointsHandshake) { - retval = getEndpoints(client); - if (retval != UA_STATUSCODE_GOOD) goto cleanup; - } - - /* Create the Session for this SecureChannel */ - if (createNewSession) { - retval = createSession(client); - if (retval != UA_STATUSCODE_GOOD) goto cleanup; - retval = activateSession(client); - } - - if (retval != UA_STATUSCODE_GOOD) goto cleanup; - client->state = UA_CLIENTSTATE_SESSION; - return retval; - -cleanup: - UA_Client_close(client); - return retval; -} - -UA_StatusCode UA_Client_connect(UA_Client *client, const char *endpointUrl) { - return UA_Client_connectInternal(client, endpointUrl, UA_TRUE, UA_TRUE); -} - -UA_StatusCode UA_Client_connect_username(UA_Client *client, const char *endpointUrl, const char *username, - const char *password) { - client->authenticationMethod = UA_CLIENTAUTHENTICATION_USERNAME; - client->username = UA_STRING_ALLOC(username); - client->password = UA_STRING_ALLOC(password); - return UA_Client_connect(client, endpointUrl); -} - -UA_StatusCode UA_Client_manuallyRenewSecureChannel(UA_Client *client) { - UA_StatusCode retval = openSecureChannel(client, true); - if (retval != UA_STATUSCODE_GOOD) UA_Client_close(client); - - return retval; -} - -/************************/ -/* Close the Connection */ -/************************/ - -static void sendCloseSession(UA_Client *client) { - UA_CloseSessionRequest request; - UA_CloseSessionRequest_init(&request); - - request.requestHeader.timestamp = UA_DateTime_now(); - request.requestHeader.timeoutHint = 10000; - request.deleteSubscriptions = true; - UA_CloseSessionResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST], &response, - &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]); - UA_CloseSessionRequest_deleteMembers(&request); - UA_CloseSessionResponse_deleteMembers(&response); -} - -static void sendCloseSecureChannel(UA_Client *client) { - UA_SecureChannel *channel = &client->channel; - UA_CloseSecureChannelRequest request; - UA_CloseSecureChannelRequest_init(&request); - request.requestHeader.requestHandle = ++client->requestHandle; - request.requestHeader.timestamp = UA_DateTime_now(); - request.requestHeader.timeoutHint = 10000; - request.requestHeader.authenticationToken = client->authenticationToken; - UA_SecureChannel_sendSymmetricMessage(channel, ++client->requestId, UA_MESSAGETYPE_CLO, &request, - &UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST]); - UA_CloseSecureChannelRequest_deleteMembers(&request); - UA_SecureChannel_deleteMembersCleanup(&client->channel); -} - -UA_StatusCode UA_Client_disconnect(UA_Client *client) { - /* Is a session established? */ - if (client->state == UA_CLIENTSTATE_SESSION) { - client->state = UA_CLIENTSTATE_SESSION_DISCONNECTED; - sendCloseSession(client); - } - UA_NodeId_deleteMembers(&client->authenticationToken); - client->requestHandle = 0; - - /* Is a secure channel established? */ - if (client->state >= UA_CLIENTSTATE_SECURECHANNEL) sendCloseSecureChannel(client); - - /* Close the TCP connection */ - if (client->connection.state != UA_CONNECTION_CLOSED) client->connection.close(&client->connection); - - client->state = UA_CLIENTSTATE_DISCONNECTED; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Client_close(UA_Client *client) { - client->requestHandle = 0; - - if (client->state >= UA_CLIENTSTATE_SECURECHANNEL) UA_SecureChannel_deleteMembersCleanup(&client->channel); - - /* Close the TCP connection */ - if (client->connection.state != UA_CONNECTION_CLOSED) client->connection.close(&client->connection); - - client->state = UA_CLIENTSTATE_DISCONNECTED; - return UA_STATUSCODE_GOOD; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/client/ua_client_discovery.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -UA_StatusCode UA_Client_getEndpoints(UA_Client *client, const char *serverUrl, size_t *endpointDescriptionsSize, - UA_EndpointDescription **endpointDescriptions) { - UA_Boolean connected = (client->state > UA_CLIENTSTATE_DISCONNECTED); - /* Client is already connected to a different server */ - if (connected && strncmp((const char *)client->endpointUrl.data, serverUrl, client->endpointUrl.length) != 0) { - return UA_STATUSCODE_BADINVALIDARGUMENT; - } - - UA_StatusCode retval; - if (!connected) { - retval = UA_Client_connectInternal(client, serverUrl, UA_FALSE, UA_FALSE); - if (retval != UA_STATUSCODE_GOOD) return retval; - } - retval = UA_Client_getEndpointsInternal(client, endpointDescriptionsSize, endpointDescriptions); - - if (!connected) UA_Client_disconnect(client); - return retval; -} - -UA_StatusCode UA_Client_findServers(UA_Client *client, const char *serverUrl, size_t serverUrisSize, - UA_String *serverUris, size_t localeIdsSize, UA_String *localeIds, - size_t *registeredServersSize, UA_ApplicationDescription **registeredServers) { - UA_Boolean connected = (client->state > UA_CLIENTSTATE_DISCONNECTED); - /* Client is already connected to a different server */ - if (connected && strncmp((const char *)client->endpointUrl.data, serverUrl, client->endpointUrl.length) != 0) { - return UA_STATUSCODE_BADINVALIDARGUMENT; - } - - if (!connected) { - UA_StatusCode retval = UA_Client_connectInternal(client, serverUrl, UA_TRUE, UA_FALSE); - if (retval != UA_STATUSCODE_GOOD) return retval; - } - - /* Prepare the request */ - UA_FindServersRequest request; - UA_FindServersRequest_init(&request); - request.serverUrisSize = serverUrisSize; - request.serverUris = serverUris; - request.localeIdsSize = localeIdsSize; - request.localeIds = localeIds; - - /* Send the request */ - UA_FindServersResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST], &response, - &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE]); - - /* Process the response */ - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval == UA_STATUSCODE_GOOD) { - *registeredServersSize = response.serversSize; - *registeredServers = response.servers; - response.serversSize = 0; - response.servers = NULL; - } else { - *registeredServersSize = 0; - *registeredServers = NULL; - } - - /* Clean up */ - UA_FindServersResponse_deleteMembers(&response); - if (!connected) UA_Client_disconnect(client); - return retval; -} - -UA_StatusCode UA_Client_findServersOnNetwork(UA_Client *client, const char *serverUrl, UA_UInt32 startingRecordId, - UA_UInt32 maxRecordsToReturn, size_t serverCapabilityFilterSize, - UA_String *serverCapabilityFilter, size_t *serverOnNetworkSize, - UA_ServerOnNetwork **serverOnNetwork) { - UA_Boolean connected = (client->state > UA_CLIENTSTATE_DISCONNECTED); - /* Client is already connected to a different server */ - if (connected && strncmp((const char *)client->endpointUrl.data, serverUrl, client->endpointUrl.length) != 0) { - return UA_STATUSCODE_BADINVALIDARGUMENT; - } - - if (!connected) { - UA_StatusCode retval = UA_Client_connectInternal(client, serverUrl, UA_TRUE, UA_FALSE); - if (retval != UA_STATUSCODE_GOOD) return retval; - } - - /* Prepare the request */ - UA_FindServersOnNetworkRequest request; - UA_FindServersOnNetworkRequest_init(&request); - request.startingRecordId = startingRecordId; - request.maxRecordsToReturn = maxRecordsToReturn; - request.serverCapabilityFilterSize = serverCapabilityFilterSize; - request.serverCapabilityFilter = serverCapabilityFilter; - - /* Send the request */ - UA_FindServersOnNetworkResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKREQUEST], &response, - &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKRESPONSE]); - - /* Process the response */ - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval == UA_STATUSCODE_GOOD) { - *serverOnNetworkSize = response.serversSize; - *serverOnNetwork = response.servers; - response.serversSize = 0; - response.servers = NULL; - } else { - *serverOnNetworkSize = 0; - *serverOnNetwork = NULL; - } - - /* Clean up */ - UA_FindServersOnNetworkResponse_deleteMembers(&response); - if (!connected) UA_Client_disconnect(client); - return retval; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/client/ua_client_highlevel.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -UA_StatusCode UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri, UA_UInt16 *namespaceIndex) { - UA_ReadRequest request; - UA_ReadRequest_init(&request); - UA_ReadValueId id; - UA_ReadValueId_init(&id); - id.attributeId = UA_ATTRIBUTEID_VALUE; - id.nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_NAMESPACEARRAY); - request.nodesToRead = &id; - request.nodesToReadSize = 1; - - UA_ReadResponse response = UA_Client_Service_read(client, request); - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (response.responseHeader.serviceResult != UA_STATUSCODE_GOOD) - retval = response.responseHeader.serviceResult; - else if (response.resultsSize != 1 || !response.results[0].hasValue) - retval = UA_STATUSCODE_BADNODEATTRIBUTESINVALID; - else if (response.results[0].value.type != &UA_TYPES[UA_TYPES_STRING]) - retval = UA_STATUSCODE_BADTYPEMISMATCH; - - if (retval != UA_STATUSCODE_GOOD) { - UA_ReadResponse_deleteMembers(&response); - return retval; - } - - retval = UA_STATUSCODE_BADNOTFOUND; - UA_String *ns = (UA_String *)response.results[0].value.data; - for (size_t i = 0; i < response.results[0].value.arrayLength; ++i) { - if (UA_String_equal(namespaceUri, &ns[i])) { - *namespaceIndex = (UA_UInt16)i; - retval = UA_STATUSCODE_GOOD; - break; - } - } - - UA_ReadResponse_deleteMembers(&response); - return retval; -} - -UA_StatusCode UA_Client_forEachChildNodeCall(UA_Client *client, UA_NodeId parentNodeId, - UA_NodeIteratorCallback callback, void *handle) { - UA_BrowseRequest bReq; - UA_BrowseRequest_init(&bReq); - bReq.requestedMaxReferencesPerNode = 0; - bReq.nodesToBrowse = UA_BrowseDescription_new(); - bReq.nodesToBrowseSize = 1; - UA_NodeId_copy(&parentNodeId, &bReq.nodesToBrowse[0].nodeId); - bReq.nodesToBrowse[0].resultMask = UA_BROWSERESULTMASK_ALL; // return everything - bReq.nodesToBrowse[0].browseDirection = UA_BROWSEDIRECTION_BOTH; - - UA_BrowseResponse bResp = UA_Client_Service_browse(client, bReq); - - UA_StatusCode retval = bResp.responseHeader.serviceResult; - if (retval == UA_STATUSCODE_GOOD) { - for (size_t i = 0; i < bResp.resultsSize; ++i) { - for (size_t j = 0; j < bResp.results[i].referencesSize; ++j) { - UA_ReferenceDescription *ref = &bResp.results[i].references[j]; - retval |= callback(ref->nodeId.nodeId, !ref->isForward, ref->referenceTypeId, handle); - } - } - } - - UA_BrowseRequest_deleteMembers(&bReq); - UA_BrowseResponse_deleteMembers(&bResp); - return retval; -} - -/*******************/ -/* Node Management */ -/*******************/ - -UA_StatusCode UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, - UA_Boolean isForward, const UA_String targetServerUri, - const UA_ExpandedNodeId targetNodeId, UA_NodeClass targetNodeClass) { - UA_AddReferencesItem item; - UA_AddReferencesItem_init(&item); - item.sourceNodeId = sourceNodeId; - item.referenceTypeId = referenceTypeId; - item.isForward = isForward; - item.targetServerUri = targetServerUri; - item.targetNodeId = targetNodeId; - item.targetNodeClass = targetNodeClass; - UA_AddReferencesRequest request; - UA_AddReferencesRequest_init(&request); - request.referencesToAdd = &item; - request.referencesToAddSize = 1; - UA_AddReferencesResponse response = UA_Client_Service_addReferences(client, request); - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval != UA_STATUSCODE_GOOD) { - UA_AddReferencesResponse_deleteMembers(&response); - return retval; - } - if (response.resultsSize != 1) { - UA_AddReferencesResponse_deleteMembers(&response); - return UA_STATUSCODE_BADUNEXPECTEDERROR; - } - retval = response.results[0]; - UA_AddReferencesResponse_deleteMembers(&response); - return retval; -} - -UA_StatusCode UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId, - const UA_NodeId referenceTypeId, UA_Boolean isForward, - const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional) { - UA_DeleteReferencesItem item; - UA_DeleteReferencesItem_init(&item); - item.sourceNodeId = sourceNodeId; - item.referenceTypeId = referenceTypeId; - item.isForward = isForward; - item.targetNodeId = targetNodeId; - item.deleteBidirectional = deleteBidirectional; - UA_DeleteReferencesRequest request; - UA_DeleteReferencesRequest_init(&request); - request.referencesToDelete = &item; - request.referencesToDeleteSize = 1; - UA_DeleteReferencesResponse response = UA_Client_Service_deleteReferences(client, request); - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval != UA_STATUSCODE_GOOD) { - UA_DeleteReferencesResponse_deleteMembers(&response); - return retval; - } - if (response.resultsSize != 1) { - UA_DeleteReferencesResponse_deleteMembers(&response); - return UA_STATUSCODE_BADUNEXPECTEDERROR; - } - retval = response.results[0]; - UA_DeleteReferencesResponse_deleteMembers(&response); - return retval; -} - -UA_StatusCode UA_Client_deleteNode(UA_Client *client, const UA_NodeId nodeId, UA_Boolean deleteTargetReferences) { - UA_DeleteNodesItem item; - UA_DeleteNodesItem_init(&item); - item.nodeId = nodeId; - item.deleteTargetReferences = deleteTargetReferences; - UA_DeleteNodesRequest request; - UA_DeleteNodesRequest_init(&request); - request.nodesToDelete = &item; - request.nodesToDeleteSize = 1; - UA_DeleteNodesResponse response = UA_Client_Service_deleteNodes(client, request); - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval != UA_STATUSCODE_GOOD) { - UA_DeleteNodesResponse_deleteMembers(&response); - return retval; - } - if (response.resultsSize != 1) { - UA_DeleteNodesResponse_deleteMembers(&response); - return UA_STATUSCODE_BADUNEXPECTEDERROR; - } - retval = response.results[0]; - UA_DeleteNodesResponse_deleteMembers(&response); - return retval; -} - -UA_StatusCode __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, const UA_NodeId typeDefinition, - const UA_NodeAttributes *attr, const UA_DataType *attributeType, - UA_NodeId *outNewNodeId) { - UA_AddNodesRequest request; - UA_AddNodesRequest_init(&request); - UA_AddNodesItem item; - UA_AddNodesItem_init(&item); - item.parentNodeId.nodeId = parentNodeId; - item.referenceTypeId = referenceTypeId; - item.requestedNewNodeId.nodeId = requestedNewNodeId; - item.browseName = browseName; - item.nodeClass = nodeClass; - item.typeDefinition.nodeId = typeDefinition; - item.nodeAttributes.encoding = UA_EXTENSIONOBJECT_DECODED_NODELETE; - item.nodeAttributes.content.decoded.type = attributeType; - item.nodeAttributes.content.decoded.data = (void *)(uintptr_t)attr; // hack. is not written into. - request.nodesToAdd = &item; - request.nodesToAddSize = 1; - UA_AddNodesResponse response = UA_Client_Service_addNodes(client, request); - - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval != UA_STATUSCODE_GOOD) { - UA_AddNodesResponse_deleteMembers(&response); - return retval; - } - - if (response.resultsSize != 1) { - UA_AddNodesResponse_deleteMembers(&response); - return UA_STATUSCODE_BADUNEXPECTEDERROR; - } - - /* Move the id of the created node */ - retval = response.results[0].statusCode; - if (retval == UA_STATUSCODE_GOOD && outNewNodeId) { - *outNewNodeId = response.results[0].addedNodeId; - UA_NodeId_init(&response.results[0].addedNodeId); - } - - UA_AddNodesResponse_deleteMembers(&response); - return retval; -} - -/********/ -/* Call */ -/********/ - -#ifdef UA_ENABLE_METHODCALLS - -UA_StatusCode UA_Client_call(UA_Client *client, const UA_NodeId objectId, const UA_NodeId methodId, size_t inputSize, - const UA_Variant *input, size_t *outputSize, UA_Variant **output) { - /* Set up the request */ - UA_CallRequest request; - UA_CallRequest_init(&request); - UA_CallMethodRequest item; - UA_CallMethodRequest_init(&item); - item.methodId = methodId; - item.objectId = objectId; - item.inputArguments = (UA_Variant *)(void *)(uintptr_t)input; // cast const... - item.inputArgumentsSize = inputSize; - request.methodsToCall = &item; - request.methodsToCallSize = 1; - - /* Call the service */ - UA_CallResponse response = UA_Client_Service_call(client, request); - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval == UA_STATUSCODE_GOOD) { - if (response.resultsSize == 1) - retval = response.results[0].statusCode; - else - retval = UA_STATUSCODE_BADUNEXPECTEDERROR; - } - if (retval != UA_STATUSCODE_GOOD) { - UA_CallResponse_deleteMembers(&response); - return retval; - } - - /* Move the output arguments */ - if (output != NULL && outputSize != NULL) { - *output = response.results[0].outputArguments; - *outputSize = response.results[0].outputArgumentsSize; - response.results[0].outputArguments = NULL; - response.results[0].outputArgumentsSize = 0; - } - UA_CallResponse_deleteMembers(&response); - return retval; -} - -#endif - -/********************/ -/* Write Attributes */ -/********************/ - -UA_StatusCode __UA_Client_writeAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId, - const void *in, const UA_DataType *inDataType) { - if (!in) return UA_STATUSCODE_BADTYPEMISMATCH; - - UA_WriteValue wValue; - UA_WriteValue_init(&wValue); - wValue.nodeId = *nodeId; - wValue.attributeId = attributeId; - if (attributeId == UA_ATTRIBUTEID_VALUE) - wValue.value.value = *(const UA_Variant *)in; - else - /* hack. is never written into. */ - UA_Variant_setScalar(&wValue.value.value, (void *)(uintptr_t)in, inDataType); - wValue.value.hasValue = true; - UA_WriteRequest wReq; - UA_WriteRequest_init(&wReq); - wReq.nodesToWrite = &wValue; - wReq.nodesToWriteSize = 1; - - UA_WriteResponse wResp = UA_Client_Service_write(client, wReq); - - UA_StatusCode retval = wResp.responseHeader.serviceResult; - if (retval == UA_STATUSCODE_GOOD) { - if (wResp.resultsSize == 1) - retval = wResp.results[0]; - else - retval = UA_STATUSCODE_BADUNEXPECTEDERROR; - } - - UA_WriteResponse_deleteMembers(&wResp); - return retval; -} - -UA_StatusCode UA_Client_writeArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, - size_t newArrayDimensionsSize, - const UA_UInt32 *newArrayDimensions) { - if (!newArrayDimensions) return UA_STATUSCODE_BADTYPEMISMATCH; - - UA_WriteValue wValue; - UA_WriteValue_init(&wValue); - wValue.nodeId = nodeId; - wValue.attributeId = UA_ATTRIBUTEID_ARRAYDIMENSIONS; - UA_Variant_setArray(&wValue.value.value, (void *)(uintptr_t)newArrayDimensions, newArrayDimensionsSize, - &UA_TYPES[UA_TYPES_UINT32]); - wValue.value.hasValue = true; - UA_WriteRequest wReq; - UA_WriteRequest_init(&wReq); - wReq.nodesToWrite = &wValue; - wReq.nodesToWriteSize = 1; - - UA_WriteResponse wResp = UA_Client_Service_write(client, wReq); - - UA_StatusCode retval = wResp.responseHeader.serviceResult; - if (retval == UA_STATUSCODE_GOOD) { - if (wResp.resultsSize == 1) - retval = wResp.results[0]; - else - retval = UA_STATUSCODE_BADUNEXPECTEDERROR; - } - UA_WriteResponse_deleteMembers(&wResp); - return retval; -} - -/*******************/ -/* Read Attributes */ -/*******************/ - -UA_StatusCode __UA_Client_readAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId, - void *out, const UA_DataType *outDataType) { - UA_ReadValueId item; - UA_ReadValueId_init(&item); - item.nodeId = *nodeId; - item.attributeId = attributeId; - UA_ReadRequest request; - UA_ReadRequest_init(&request); - request.nodesToRead = &item; - request.nodesToReadSize = 1; - UA_ReadResponse response = UA_Client_Service_read(client, request); - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval == UA_STATUSCODE_GOOD) { - if (response.resultsSize == 1) - retval = response.results[0].status; - else - retval = UA_STATUSCODE_BADUNEXPECTEDERROR; - } - if (retval != UA_STATUSCODE_GOOD) { - UA_ReadResponse_deleteMembers(&response); - return retval; - } - - /* Set the StatusCode */ - UA_DataValue *res = response.results; - if (res->hasStatus) retval = res->status; - - /* Return early of no value is given */ - if (!res->hasValue) { - if (retval == UA_STATUSCODE_GOOD) retval = UA_STATUSCODE_BADUNEXPECTEDERROR; - UA_ReadResponse_deleteMembers(&response); - return retval; - } - - /* Copy value into out */ - if (attributeId == UA_ATTRIBUTEID_VALUE) { - memcpy(out, &res->value, sizeof(UA_Variant)); - UA_Variant_init(&res->value); - } else if (attributeId == UA_ATTRIBUTEID_NODECLASS) { - memcpy(out, (UA_NodeClass *)res->value.data, sizeof(UA_NodeClass)); - } else if (UA_Variant_isScalar(&res->value) && res->value.type == outDataType) { - memcpy(out, res->value.data, res->value.type->memSize); - UA_free(res->value.data); - res->value.data = NULL; - } else { - retval = UA_STATUSCODE_BADUNEXPECTEDERROR; - } - - UA_ReadResponse_deleteMembers(&response); - return retval; -} - -static UA_StatusCode processReadArrayDimensionsResult(UA_ReadResponse *response, UA_UInt32 **outArrayDimensions, - size_t *outArrayDimensionsSize) { - UA_StatusCode retval = response->responseHeader.serviceResult; - if (retval != UA_STATUSCODE_GOOD) return retval; - - if (response->resultsSize != 1) return UA_STATUSCODE_BADUNEXPECTEDERROR; - - retval = response->results[0].status; - if (retval != UA_STATUSCODE_GOOD) return retval; - - UA_DataValue *res = &response->results[0]; - if (!res->hasValue || UA_Variant_isScalar(&res->value) || res->value.type != &UA_TYPES[UA_TYPES_UINT32]) - return UA_STATUSCODE_BADUNEXPECTEDERROR; - - /* Move results */ - *outArrayDimensions = (UA_UInt32 *)res->value.data; - *outArrayDimensionsSize = res->value.arrayLength; - res->value.data = NULL; - res->value.arrayLength = 0; - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Client_readArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, - size_t *outArrayDimensionsSize, UA_UInt32 **outArrayDimensions) { - UA_ReadValueId item; - UA_ReadValueId_init(&item); - item.nodeId = nodeId; - item.attributeId = UA_ATTRIBUTEID_ARRAYDIMENSIONS; - UA_ReadRequest request; - UA_ReadRequest_init(&request); - request.nodesToRead = &item; - request.nodesToReadSize = 1; - - UA_ReadResponse response = UA_Client_Service_read(client, request); - UA_StatusCode retval = processReadArrayDimensionsResult(&response, outArrayDimensions, outArrayDimensionsSize); - UA_ReadResponse_deleteMembers(&response); - return retval; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/src/client/ua_client_highlevel_subscriptions.c" - * ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */ - -UA_StatusCode UA_Client_Subscriptions_new(UA_Client *client, UA_SubscriptionSettings settings, - UA_UInt32 *newSubscriptionId) { - UA_CreateSubscriptionRequest request; - UA_CreateSubscriptionRequest_init(&request); - request.requestedPublishingInterval = settings.requestedPublishingInterval; - request.requestedLifetimeCount = settings.requestedLifetimeCount; - request.requestedMaxKeepAliveCount = settings.requestedMaxKeepAliveCount; - request.maxNotificationsPerPublish = settings.maxNotificationsPerPublish; - request.publishingEnabled = settings.publishingEnabled; - request.priority = settings.priority; - - UA_CreateSubscriptionResponse response = UA_Client_Service_createSubscription(client, request); - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval != UA_STATUSCODE_GOOD) { - UA_CreateSubscriptionResponse_deleteMembers(&response); - return retval; - } - - UA_Client_Subscription *newSub = (UA_Client_Subscription *)UA_malloc(sizeof(UA_Client_Subscription)); - if (!newSub) { - UA_CreateSubscriptionResponse_deleteMembers(&response); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - - LIST_INIT(&newSub->monitoredItems); - newSub->lifeTime = response.revisedLifetimeCount; - newSub->keepAliveCount = response.revisedMaxKeepAliveCount; - newSub->publishingInterval = response.revisedPublishingInterval; - newSub->subscriptionID = response.subscriptionId; - newSub->notificationsPerPublish = request.maxNotificationsPerPublish; - newSub->priority = request.priority; - LIST_INSERT_HEAD(&client->subscriptions, newSub, listEntry); - - if (newSubscriptionId) *newSubscriptionId = newSub->subscriptionID; - - UA_CreateSubscriptionResponse_deleteMembers(&response); - return UA_STATUSCODE_GOOD; -} - -static UA_Client_Subscription *findSubscription(const UA_Client *client, UA_UInt32 subscriptionId) { - UA_Client_Subscription *sub = NULL; - LIST_FOREACH(sub, &client->subscriptions, listEntry) { - if (sub->subscriptionID == subscriptionId) break; - } - return sub; -} - -/* remove the subscription remotely */ -UA_StatusCode UA_Client_Subscriptions_remove(UA_Client *client, UA_UInt32 subscriptionId) { - UA_Client_Subscription *sub = findSubscription(client, subscriptionId); - if (!sub) return UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - UA_Client_MonitoredItem *mon, *tmpmon; - LIST_FOREACH_SAFE(mon, &sub->monitoredItems, listEntry, tmpmon) { - retval = UA_Client_Subscriptions_removeMonitoredItem(client, sub->subscriptionID, mon->monitoredItemId); - if (retval != UA_STATUSCODE_GOOD) return retval; - } - - /* remove the subscription remotely */ - UA_DeleteSubscriptionsRequest request; - UA_DeleteSubscriptionsRequest_init(&request); - request.subscriptionIdsSize = 1; - request.subscriptionIds = &sub->subscriptionID; - UA_DeleteSubscriptionsResponse response = UA_Client_Service_deleteSubscriptions(client, request); - retval = response.responseHeader.serviceResult; - if (retval == UA_STATUSCODE_GOOD && response.resultsSize > 0) retval = response.results[0]; - UA_DeleteSubscriptionsResponse_deleteMembers(&response); - - if (retval != UA_STATUSCODE_GOOD && retval != UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID) { - UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT, "Could not remove subscription %u with error code %s", - sub->subscriptionID, UA_StatusCode_name(retval)); - return retval; - } - - UA_Client_Subscriptions_forceDelete(client, sub); - return UA_STATUSCODE_GOOD; -} - -void UA_Client_Subscriptions_forceDelete(UA_Client *client, UA_Client_Subscription *sub) { - UA_Client_MonitoredItem *mon, *mon_tmp; - LIST_FOREACH_SAFE(mon, &sub->monitoredItems, listEntry, mon_tmp) { - UA_NodeId_deleteMembers(&mon->monitoredNodeId); - LIST_REMOVE(mon, listEntry); - UA_free(mon); - } - LIST_REMOVE(sub, listEntry); - UA_free(sub); -} - -UA_StatusCode UA_Client_Subscriptions_addMonitoredEvent( - UA_Client *client, const UA_UInt32 subscriptionId, const UA_NodeId nodeId, const UA_UInt32 attributeID, - UA_SimpleAttributeOperand *selectClause, const size_t nSelectClauses, UA_ContentFilterElement *whereClause, - const size_t nWhereClauses, const UA_MonitoredEventHandlingFunction hf, void *hfContext, - UA_UInt32 *newMonitoredItemId) { - UA_Client_Subscription *sub = findSubscription(client, subscriptionId); - if (!sub) return UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - - /* Send the request */ - UA_CreateMonitoredItemsRequest request; - UA_CreateMonitoredItemsRequest_init(&request); - request.subscriptionId = subscriptionId; - - UA_MonitoredItemCreateRequest item; - UA_MonitoredItemCreateRequest_init(&item); - item.itemToMonitor.nodeId = nodeId; - item.itemToMonitor.attributeId = attributeID; - item.monitoringMode = UA_MONITORINGMODE_REPORTING; - item.requestedParameters.clientHandle = ++(client->monitoredItemHandles); - item.requestedParameters.samplingInterval = 0; - item.requestedParameters.discardOldest = false; - - UA_EventFilter *evFilter = UA_EventFilter_new(); - if (!evFilter) { - return UA_STATUSCODE_BADOUTOFMEMORY; - } - UA_EventFilter_init(evFilter); - evFilter->selectClausesSize = nSelectClauses; - evFilter->selectClauses = selectClause; - evFilter->whereClause.elementsSize = nWhereClauses; - evFilter->whereClause.elements = whereClause; - - item.requestedParameters.filter.encoding = UA_EXTENSIONOBJECT_DECODED_NODELETE; - item.requestedParameters.filter.content.decoded.type = &UA_TYPES[UA_TYPES_EVENTFILTER]; - item.requestedParameters.filter.content.decoded.data = evFilter; - - request.itemsToCreate = &item; - request.itemsToCreateSize = 1; - UA_CreateMonitoredItemsResponse response = UA_Client_Service_createMonitoredItems(client, request); - - // slight misuse of retval here to check if the deletion was successful. - UA_StatusCode retval; - if (response.resultsSize == 0) - retval = response.responseHeader.serviceResult; - else - retval = response.results[0].statusCode; - if (retval != UA_STATUSCODE_GOOD) { - UA_CreateMonitoredItemsResponse_deleteMembers(&response); - UA_EventFilter_delete(evFilter); - return retval; - } - - /* Create the handler */ - UA_Client_MonitoredItem *newMon = (UA_Client_MonitoredItem *)UA_malloc(sizeof(UA_Client_MonitoredItem)); - if (!newMon) { - UA_CreateMonitoredItemsResponse_deleteMembers(&response); - UA_EventFilter_delete(evFilter); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - - newMon->monitoringMode = UA_MONITORINGMODE_REPORTING; - UA_NodeId_copy(&nodeId, &newMon->monitoredNodeId); - newMon->attributeID = attributeID; - newMon->clientHandle = client->monitoredItemHandles; - newMon->samplingInterval = 0; - newMon->queueSize = 0; - newMon->discardOldest = false; - - newMon->handlerEvents = hf; - newMon->handlerEventsContext = hfContext; - newMon->monitoredItemId = response.results[0].monitoredItemId; - LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry); - *newMonitoredItemId = newMon->monitoredItemId; - - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT, "Created a monitored item with client handle %u", - client->monitoredItemHandles); - - UA_EventFilter_delete(evFilter); - UA_CreateMonitoredItemsResponse_deleteMembers(&response); - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Client_Subscriptions_addMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId, UA_NodeId nodeId, - UA_UInt32 attributeID, UA_MonitoredItemHandlingFunction hf, - void *hfContext, UA_UInt32 *newMonitoredItemId, - UA_Double samplingInterval) { - UA_Client_Subscription *sub = findSubscription(client, subscriptionId); - if (!sub) return UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - - /* Create the handler */ - UA_Client_MonitoredItem *newMon = (UA_Client_MonitoredItem *)UA_malloc(sizeof(UA_Client_MonitoredItem)); - if (!newMon) return UA_STATUSCODE_BADOUTOFMEMORY; - - /* Send the request */ - UA_CreateMonitoredItemsRequest request; - UA_CreateMonitoredItemsRequest_init(&request); - request.subscriptionId = subscriptionId; - UA_MonitoredItemCreateRequest item; - UA_MonitoredItemCreateRequest_init(&item); - item.itemToMonitor.nodeId = nodeId; - item.itemToMonitor.attributeId = attributeID; - item.monitoringMode = UA_MONITORINGMODE_REPORTING; - item.requestedParameters.clientHandle = ++(client->monitoredItemHandles); - item.requestedParameters.samplingInterval = samplingInterval; - item.requestedParameters.discardOldest = true; - item.requestedParameters.queueSize = 1; - request.itemsToCreate = &item; - request.itemsToCreateSize = 1; - UA_CreateMonitoredItemsResponse response = UA_Client_Service_createMonitoredItems(client, request); - - // slight misuse of retval here to check if the addition was successful. - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval == UA_STATUSCODE_GOOD) { - if (response.resultsSize == 1) - retval = response.results[0].statusCode; - else - retval = UA_STATUSCODE_BADUNEXPECTEDERROR; - } - if (retval != UA_STATUSCODE_GOOD) { - UA_free(newMon); - UA_CreateMonitoredItemsResponse_deleteMembers(&response); - return retval; - } - - /* Set the handler */ - newMon->monitoringMode = UA_MONITORINGMODE_REPORTING; - UA_NodeId_copy(&nodeId, &newMon->monitoredNodeId); - newMon->attributeID = attributeID; - newMon->clientHandle = client->monitoredItemHandles; - newMon->samplingInterval = samplingInterval; - newMon->queueSize = 1; - newMon->discardOldest = true; - newMon->handler = hf; - newMon->handlerContext = hfContext; - newMon->monitoredItemId = response.results[0].monitoredItemId; - LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry); - *newMonitoredItemId = newMon->monitoredItemId; - - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT, "Created a monitored item with client handle %u", - client->monitoredItemHandles); - - UA_CreateMonitoredItemsResponse_deleteMembers(&response); - return UA_STATUSCODE_GOOD; -} - -UA_StatusCode UA_Client_Subscriptions_removeMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId, - UA_UInt32 monitoredItemId) { - UA_Client_Subscription *sub = findSubscription(client, subscriptionId); - if (!sub) return UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID; - - UA_Client_MonitoredItem *mon; - LIST_FOREACH(mon, &sub->monitoredItems, listEntry) { - if (mon->monitoredItemId == monitoredItemId) break; - } - if (!mon) return UA_STATUSCODE_BADMONITOREDITEMIDINVALID; - - /* remove the monitoreditem remotely */ - UA_DeleteMonitoredItemsRequest request; - UA_DeleteMonitoredItemsRequest_init(&request); - request.subscriptionId = sub->subscriptionID; - request.monitoredItemIdsSize = 1; - request.monitoredItemIds = &mon->monitoredItemId; - UA_DeleteMonitoredItemsResponse response = UA_Client_Service_deleteMonitoredItems(client, request); - - UA_StatusCode retval = response.responseHeader.serviceResult; - if (retval == UA_STATUSCODE_GOOD && response.resultsSize > 1) retval = response.results[0]; - UA_DeleteMonitoredItemsResponse_deleteMembers(&response); - if (retval != UA_STATUSCODE_GOOD && retval != UA_STATUSCODE_BADMONITOREDITEMIDINVALID) { - UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT, "Could not remove monitoreditem %u with error code %s", - monitoredItemId, UA_StatusCode_name(retval)); - return retval; - } - - LIST_REMOVE(mon, listEntry); - UA_NodeId_deleteMembers(&mon->monitoredNodeId); - UA_free(mon); - return UA_STATUSCODE_GOOD; -} - -static void UA_Client_processPublishResponse(UA_Client *client, UA_PublishRequest *request, - UA_PublishResponse *response) { - if (response->responseHeader.serviceResult != UA_STATUSCODE_GOOD) return; - - UA_Client_Subscription *sub = findSubscription(client, response->subscriptionId); - if (!sub) return; - - /* Check if the server has acknowledged any of the sent ACKs */ - for (size_t i = 0; i < response->resultsSize && i < request->subscriptionAcknowledgementsSize; ++i) { - /* remove also acks that are unknown to the server */ - if (response->results[i] != UA_STATUSCODE_GOOD && response->results[i] != UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN) - continue; - - /* Remove the ack from the list */ - UA_SubscriptionAcknowledgement *orig_ack = &request->subscriptionAcknowledgements[i]; - UA_Client_NotificationsAckNumber *ack; - LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) { - if (ack->subAck.subscriptionId == orig_ack->subscriptionId && - ack->subAck.sequenceNumber == orig_ack->sequenceNumber) { - LIST_REMOVE(ack, listEntry); - UA_free(ack); - UA_assert(ack != LIST_FIRST(&client->pendingNotificationsAcks)); - break; - } - } - } - - /* Process the notification messages */ - UA_NotificationMessage *msg = &response->notificationMessage; - for (size_t k = 0; k < msg->notificationDataSize; ++k) { - if (msg->notificationData[k].encoding != UA_EXTENSIONOBJECT_DECODED) continue; - - if (msg->notificationData[k].content.decoded.type == &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION]) { - UA_DataChangeNotification *dataChangeNotification = - (UA_DataChangeNotification *)msg->notificationData[k].content.decoded.data; - for (size_t j = 0; j < dataChangeNotification->monitoredItemsSize; ++j) { - UA_MonitoredItemNotification *mitemNot = &dataChangeNotification->monitoredItems[j]; - UA_Client_MonitoredItem *mon; - LIST_FOREACH(mon, &sub->monitoredItems, listEntry) { - if (mon->clientHandle == mitemNot->clientHandle) { - mon->handler(mon->monitoredItemId, &mitemNot->value, mon->handlerContext); - break; - } - } - if (!mon) - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT, - "Could not process a notification with clienthandle %u on subscription %u", - mitemNot->clientHandle, sub->subscriptionID); - } - } else if (msg->notificationData[k].content.decoded.type == &UA_TYPES[UA_TYPES_EVENTNOTIFICATIONLIST]) { - UA_EventNotificationList *eventNotificationList = - (UA_EventNotificationList *)msg->notificationData[k].content.decoded.data; - for (size_t j = 0; j < eventNotificationList->eventsSize; ++j) { - UA_EventFieldList *eventFieldList = &eventNotificationList->events[j]; - UA_Client_MonitoredItem *mon; - LIST_FOREACH(mon, &sub->monitoredItems, listEntry) { - if (mon->clientHandle == eventFieldList->clientHandle) { - mon->handlerEvents(mon->monitoredItemId, eventFieldList->eventFieldsSize, eventFieldList->eventFields, - mon->handlerContext); - break; - } - } - if (!mon) - UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT, - "Could not process a notification with clienthandle %u on subscription %u", - eventFieldList->clientHandle, sub->subscriptionID); - } - } else { - continue; // no other types are supported - } - } - - /* Add to the list of pending acks */ - UA_Client_NotificationsAckNumber *tmpAck = - (UA_Client_NotificationsAckNumber *)UA_malloc(sizeof(UA_Client_NotificationsAckNumber)); - if (!tmpAck) { - UA_LOG_WARNING(client->config.logger, UA_LOGCATEGORY_CLIENT, - "Not enough memory to store the acknowledgement for a publish " - "message on subscription %u", - sub->subscriptionID); - return; - } - tmpAck->subAck.sequenceNumber = msg->sequenceNumber; - tmpAck->subAck.subscriptionId = sub->subscriptionID; - LIST_INSERT_HEAD(&client->pendingNotificationsAcks, tmpAck, listEntry); -} - -UA_StatusCode UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) { - if (client->state < UA_CLIENTSTATE_SESSION) return UA_STATUSCODE_BADSERVERNOTCONNECTED; - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - - UA_DateTime now = UA_DateTime_nowMonotonic(); - UA_DateTime maxDate = now + (UA_DateTime)(client->config.timeout * UA_DATETIME_MSEC); - - UA_Boolean moreNotifications = true; - while (moreNotifications) { - UA_PublishRequest request; - UA_PublishRequest_init(&request); - request.subscriptionAcknowledgementsSize = 0; - - UA_Client_NotificationsAckNumber *ack; - LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) - ++request.subscriptionAcknowledgementsSize; - if (request.subscriptionAcknowledgementsSize > 0) { - request.subscriptionAcknowledgements = (UA_SubscriptionAcknowledgement *)UA_malloc( - sizeof(UA_SubscriptionAcknowledgement) * request.subscriptionAcknowledgementsSize); - if (!request.subscriptionAcknowledgements) return UA_STATUSCODE_BADOUTOFMEMORY; - } - - int i = 0; - LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) { - request.subscriptionAcknowledgements[i].sequenceNumber = ack->subAck.sequenceNumber; - request.subscriptionAcknowledgements[i].subscriptionId = ack->subAck.subscriptionId; - ++i; - } - - UA_PublishResponse response = UA_Client_Service_publish(client, request); - UA_Client_processPublishResponse(client, &request, &response); - - now = UA_DateTime_nowMonotonic(); - if (now > maxDate) { - moreNotifications = UA_FALSE; - retval = UA_STATUSCODE_GOODNONCRITICALTIMEOUT; - } else { - moreNotifications = response.moreNotifications; - } - - UA_PublishResponse_deleteMembers(&response); - UA_PublishRequest_deleteMembers(&request); - } - - if (client->state < UA_CLIENTSTATE_SESSION) return UA_STATUSCODE_BADSERVERNOTCONNECTED; - - return retval; -} - -#endif /* UA_ENABLE_SUBSCRIPTIONS */ - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/deps/libc_time.c" - * ***********************************/ - -/* Originally released by the musl project (http://www.musl-libc.org/) under the - * MIT license. Taken from the file /src/time/__secs_to_tm.c */ - -#include - -/* 2000-03-01 (mod 400 year, immediately after feb29 */ -#define LEAPOCH (946684800LL + 86400 * (31 + 29)) - -#define DAYS_PER_400Y (365 * 400 + 97) -#define DAYS_PER_100Y (365 * 100 + 24) -#define DAYS_PER_4Y (365 * 4 + 1) - -int __secs_to_tm(long long t, struct mytm *tm) { - long long days, secs, years; - int remdays, remsecs, remyears; - int qc_cycles, c_cycles, q_cycles; - int months; - int wday, yday, leap; - static const char days_in_month[] = {31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 29}; - - /* Reject time_t values whose year would overflow int */ - if (t < INT_MIN * 31622400LL || t > INT_MAX * 31622400LL) return -1; - - secs = t - LEAPOCH; - days = secs / 86400LL; - remsecs = (int)(secs % 86400); - if (remsecs < 0) { - remsecs += 86400; - --days; - } - - wday = (int)((3 + days) % 7); - if (wday < 0) wday += 7; - - qc_cycles = (int)(days / DAYS_PER_400Y); - remdays = (int)(days % DAYS_PER_400Y); - if (remdays < 0) { - remdays += DAYS_PER_400Y; - --qc_cycles; - } - - c_cycles = remdays / DAYS_PER_100Y; - if (c_cycles == 4) --c_cycles; - remdays -= c_cycles * DAYS_PER_100Y; - - q_cycles = remdays / DAYS_PER_4Y; - if (q_cycles == 25) --q_cycles; - remdays -= q_cycles * DAYS_PER_4Y; - - remyears = remdays / 365; - if (remyears == 4) --remyears; - remdays -= remyears * 365; - - leap = !remyears && (q_cycles || !c_cycles); - yday = remdays + 31 + 28 + leap; - if (yday >= 365 + leap) yday -= 365 + leap; - - years = remyears + 4 * q_cycles + 100 * c_cycles + 400LL * qc_cycles; - - for (months = 0; days_in_month[months] <= remdays; ++months) remdays -= days_in_month[months]; - - if (years + 100 > INT_MAX || years + 100 < INT_MIN) return -1; - - tm->tm_year = (int)(years + 100); - tm->tm_mon = months + 2; - if (tm->tm_mon >= 12) { - tm->tm_mon -= 12; - ++tm->tm_year; - } - tm->tm_mday = remdays + 1; - tm->tm_wday = wday; - tm->tm_yday = yday; - - tm->tm_hour = remsecs / 3600; - tm->tm_min = remsecs / 60 % 60; - tm->tm_sec = remsecs % 60; - - return 0; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/deps/pcg_basic.c" - * ***********************************/ - -/* - * PCG Random Number Generation for C. - * - * Copyright 2014 Melissa O'Neill - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * For additional information about the PCG random number generation scheme, - * including its license and other licensing options, visit - * - * http://www.pcg-random.org - */ - -void pcg32_srandom_r(pcg32_random_t *rng, uint64_t initial_state, uint64_t initseq) { - rng->state = 0U; - rng->inc = (initseq << 1u) | 1u; - pcg32_random_r(rng); - rng->state += initial_state; - pcg32_random_r(rng); -} - -uint32_t pcg32_random_r(pcg32_random_t *rng) { - uint64_t oldstate = rng->state; - rng->state = oldstate * 6364136223846793005ULL + rng->inc; - uint32_t xorshifted = (uint32_t)(((oldstate >> 18u) ^ oldstate) >> 27u); - uint32_t rot = (uint32_t)(oldstate >> 59u); - return (xorshifted >> rot) | - (xorshifted << ((~rot + 1u) & 31)); /* was (xorshifted >> rot) | (xorshifted << ((-rot) & 31)) */ -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_network_tcp.c" - * ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - -/* Enable POSIX features */ -#if !defined(_XOPEN_SOURCE) && !defined(_WRS_KERNEL) -#define _XOPEN_SOURCE 600 -#endif -#ifndef _DEFAULT_SOURCE -#define _DEFAULT_SOURCE -#endif -/* On older systems we need to define _BSD_SOURCE. - * _DEFAULT_SOURCE is an alias for that. */ -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif - -/* Disable some security warnings on MSVC */ -#ifdef _MSC_VER -#define _CRT_SECURE_NO_WARNINGS -#endif - -/* Assume that Windows versions are newer than Windows XP */ -#if defined(__MINGW32__) && (!defined(WINVER) || WINVER < 0x501) -#undef WINVER -#undef _WIN32_WINDOWS -#undef _WIN32_WINNT -#define WINVER 0x0501 -#define _WIN32_WINDOWS 0x0501 -#define _WIN32_WINNT 0x0501 -#endif - -#include -#include // snprintf -#include // memset - -#ifdef _WIN32 -#include -#include -#define CLOSESOCKET(S) closesocket((SOCKET)S) -#define ssize_t int -#define WIN32_INT (int) -#define OPTVAL_TYPE char -#define ERR_CONNECTION_PROGRESS WSAEWOULDBLOCK -#define UA_sleep_ms(X) Sleep(X) -#else -#define CLOSESOCKET(S) close(S) -#define SOCKET int -#define WIN32_INT -#define OPTVAL_TYPE int -#define ERR_CONNECTION_PROGRESS EINPROGRESS -#include -#include -#ifndef _WRS_KERNEL -#include -#define UA_sleep_ms(X) usleep(X * 1000) -#else -#include -#include -#define UA_sleep_ms(X) \ - { \ - struct timespec timeToSleep; \ - timeToSleep.tv_sec = X / 1000; \ - timeToSleep.tv_nsec = 1000000 * (X % 1000); \ - nanosleep(&timeToSleep, NULL); \ - } -#endif -#include -#include -#include -#include // read, write, close -#ifdef __QNX__ -#include -#endif -#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) -#include -#if defined(BSD) -#include -#endif -#endif -#ifndef __CYGWIN__ -#include -#endif -#endif - -/* unsigned int for windows and workaround to a glibc bug */ -/* Additionally if GNU_LIBRARY is not defined, it may be using - * musl libc (e.g. Docker Alpine) */ -#if defined(_WIN32) || defined(__OpenBSD__) || \ - (defined(__GNU_LIBRARY__) && (__GNU_LIBRARY__ <= 6) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 16) || \ - !defined(__GNU_LIBRARY__)) -#define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds) -#define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds) -#else -#define UA_fd_set(fd, fds) FD_SET(fd, fds) -#define UA_fd_isset(fd, fds) FD_ISSET(fd, fds) -#endif - -#ifdef UNDER_CE -#define errno WSAGetLastError() -#endif - -#ifdef _WIN32 -#define errno__ WSAGetLastError() -#define INTERRUPTED WSAEINTR -#define WOULDBLOCK WSAEWOULDBLOCK -#define AGAIN WSAEWOULDBLOCK -#else -#define errno__ errno -#define INTERRUPTED EINTR -#define WOULDBLOCK EWOULDBLOCK -#define AGAIN EAGAIN -#endif - -/****************************/ -/* Generic Socket Functions */ -/****************************/ - -static UA_StatusCode connection_getsendbuffer(UA_Connection *connection, size_t length, UA_ByteString *buf) { - if (length > connection->remoteConf.recvBufferSize) return UA_STATUSCODE_BADCOMMUNICATIONERROR; - return UA_ByteString_allocBuffer(buf, length); -} - -static void connection_releasesendbuffer(UA_Connection *connection, UA_ByteString *buf) { - UA_ByteString_deleteMembers(buf); -} - -static void connection_releaserecvbuffer(UA_Connection *connection, UA_ByteString *buf) { - UA_ByteString_deleteMembers(buf); -} - -static UA_StatusCode connection_write(UA_Connection *connection, UA_ByteString *buf) { - if (connection->state == UA_CONNECTION_CLOSED) return UA_STATUSCODE_BADCONNECTIONCLOSED; - /* Prevent OS signals when sending to a closed socket */ - int flags = 0; -#ifdef MSG_NOSIGNAL - flags |= MSG_NOSIGNAL; -#endif - - /* Send the full buffer. This may require several calls to send */ - size_t nWritten = 0; - do { - ssize_t n = 0; - do { - size_t bytes_to_send = buf->length - nWritten; - n = send((SOCKET)connection->sockfd, (const char *)buf->data + nWritten, WIN32_INT bytes_to_send, flags); - if (n < 0 && errno__ != INTERRUPTED && errno__ != AGAIN) { - connection->close(connection); - UA_ByteString_deleteMembers(buf); - return UA_STATUSCODE_BADCONNECTIONCLOSED; - } - } while (n < 0); - nWritten += (size_t)n; - } while (nWritten < buf->length); - - /* Free the buffer */ - UA_ByteString_deleteMembers(buf); - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode connection_recv(UA_Connection *connection, UA_ByteString *response, UA_UInt32 timeout) { - if (connection->state == UA_CONNECTION_CLOSED) return UA_STATUSCODE_BADCONNECTIONCLOSED; - /* Listen on the socket for the given timeout until a message arrives */ - if (timeout > 0) { - fd_set fdset; - FD_ZERO(&fdset); - UA_fd_set(connection->sockfd, &fdset); - UA_UInt32 timeout_usec = timeout * 1000; - struct timeval tmptv = {(long int)(timeout_usec / 1000000), (long int)(timeout_usec % 1000000)}; - int resultsize = select(connection->sockfd + 1, &fdset, NULL, NULL, &tmptv); - - /* No result */ - if (resultsize == 0) return UA_STATUSCODE_GOODNONCRITICALTIMEOUT; - } - - response->data = (UA_Byte *)UA_malloc(connection->localConf.recvBufferSize); - if (!response->data) { - response->length = 0; - return UA_STATUSCODE_BADOUTOFMEMORY; /* not enough memory retry */ - } - - /* Get the received packet(s) */ - ssize_t ret = recv(connection->sockfd, (char *)response->data, connection->localConf.recvBufferSize, 0); - - /* The remote side closed the connection */ - if (ret == 0) { - UA_ByteString_deleteMembers(response); - connection->close(connection); - return UA_STATUSCODE_BADCONNECTIONCLOSED; - } - - /* Error case */ - if (ret < 0) { - UA_ByteString_deleteMembers(response); - if (errno__ == INTERRUPTED || (timeout > 0) ? false : (errno__ == EAGAIN || errno__ == WOULDBLOCK)) - return UA_STATUSCODE_GOOD; /* statuscode_good but no data -> retry */ - connection->close(connection); - return UA_STATUSCODE_BADCONNECTIONCLOSED; - } - - /* Set the length of the received buffer */ - response->length = (size_t)ret; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode socket_set_nonblocking(SOCKET sockfd) { -#ifdef _WIN32 - u_long iMode = 1; - if (ioctlsocket(sockfd, FIONBIO, &iMode) != NO_ERROR) return UA_STATUSCODE_BADINTERNALERROR; -#elif defined(_WRS_KERNEL) - int on = TRUE; - if (ioctl(sockfd, FIONBIO, &on) < 0) return UA_STATUSCODE_BADINTERNALERROR; -#else - int opts = fcntl(sockfd, F_GETFL); - if (opts < 0 || fcntl(sockfd, F_SETFL, opts | O_NONBLOCK) < 0) return UA_STATUSCODE_BADINTERNALERROR; -#endif - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode socket_set_blocking(SOCKET sockfd) { -#ifdef _WIN32 - u_long iMode = 0; - if (ioctlsocket(sockfd, FIONBIO, &iMode) != NO_ERROR) return UA_STATUSCODE_BADINTERNALERROR; -#elif defined(_WRS_KERNEL) - int on = FALSE; - if (ioctl(sockfd, FIONBIO, &on) < 0) return UA_STATUSCODE_BADINTERNALERROR; -#else - int opts = fcntl(sockfd, F_GETFL); - if (opts < 0 || fcntl(sockfd, F_SETFL, opts & (~O_NONBLOCK)) < 0) return UA_STATUSCODE_BADINTERNALERROR; -#endif - return UA_STATUSCODE_GOOD; -} - -/***************************/ -/* Server NetworkLayer TCP */ -/***************************/ - -#define MAXBACKLOG 100 -#define NOHELLOTIMEOUT \ - 120000 /* timeout in ms before close the connection \ - * if server does not receive Hello Message */ - -typedef struct ConnectionEntry { - UA_Connection connection; - LIST_ENTRY(ConnectionEntry) pointers; -} ConnectionEntry; - -typedef struct { - UA_ConnectionConfig conf; - UA_UInt16 port; - UA_Int32 serverSockets[FD_SETSIZE]; - UA_UInt16 serverSocketsSize; - LIST_HEAD(, ConnectionEntry) connections; -} ServerNetworkLayerTCP; - -static void ServerNetworkLayerTCP_freeConnection(UA_Connection *connection) { - UA_Connection_deleteMembers(connection); - UA_free(connection); -} - -/* This performs only 'shutdown'. 'close' is called when the shutdown - * socket is returned from select. */ -static void ServerNetworkLayerTCP_close(UA_Connection *connection) { - if (connection->state == UA_CONNECTION_CLOSED) return; - shutdown((SOCKET)connection->sockfd, 2); - connection->state = UA_CONNECTION_CLOSED; -} - -static UA_StatusCode ServerNetworkLayerTCP_add(ServerNetworkLayerTCP *layer, UA_Int32 newsockfd, - struct sockaddr_storage *remote) { - /* Set nonblocking */ - socket_set_nonblocking(newsockfd); - - /* Do not merge packets on the socket (disable Nagle's algorithm) */ - int dummy = 1; - if (setsockopt(newsockfd, IPPROTO_TCP, TCP_NODELAY, (const char *)&dummy, sizeof(dummy)) < 0) { - UA_LOG_SOCKET_ERRNO_WRAP(UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, - "Cannot set socket option TCP_NODELAY. Error: %s", errno_str)); - return UA_STATUSCODE_BADUNEXPECTEDERROR; - } - - /* Get the peer name for logging */ - char remote_name[100]; - int res = getnameinfo((struct sockaddr *)remote, sizeof(struct sockaddr_storage), remote_name, sizeof(remote_name), - NULL, 0, NI_NUMERICHOST); - if (res == 0) { - UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Connection %i | New connection over TCP from %s", - (int)newsockfd, remote_name); - } else { - UA_LOG_SOCKET_ERRNO_WRAP(UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, - "Connection %i | New connection over TCP, " - "getnameinfo failed with error: %s", - (int)newsockfd, errno_str)); - } - - /* Allocate and initialize the connection */ - ConnectionEntry *e = (ConnectionEntry *)UA_malloc(sizeof(ConnectionEntry)); - if (!e) { - CLOSESOCKET(newsockfd); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - - UA_Connection *c = &e->connection; - memset(c, 0, sizeof(UA_Connection)); - c->sockfd = newsockfd; - c->handle = layer; - c->localConf = layer->conf; - c->remoteConf = layer->conf; - c->send = connection_write; - c->close = ServerNetworkLayerTCP_close; - c->free = ServerNetworkLayerTCP_freeConnection; - c->getSendBuffer = connection_getsendbuffer; - c->releaseSendBuffer = connection_releasesendbuffer; - c->releaseRecvBuffer = connection_releaserecvbuffer; - c->state = UA_CONNECTION_OPENING; - c->openingDate = UA_DateTime_nowMonotonic(); - - /* Add to the linked list */ - LIST_INSERT_HEAD(&layer->connections, e, pointers); - return UA_STATUSCODE_GOOD; -} - -static void addServerSocket(ServerNetworkLayerTCP *layer, struct addrinfo *ai) { - /* Create the server socket */ - SOCKET newsock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); -#ifdef _WIN32 - if (newsock == INVALID_SOCKET) -#else - if (newsock < 0) -#endif - { - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Error opening the server socket"); - return; - } - - /* Some Linux distributions have net.ipv6.bindv6only not activated. So - * sockets can double-bind to IPv4 and IPv6. This leads to problems. Use - * AF_INET6 sockets only for IPv6. */ - int optval = 1; - if (ai->ai_family == AF_INET6 && - setsockopt(newsock, IPPROTO_IPV6, IPV6_V6ONLY, (const char *)&optval, sizeof(optval)) == -1) { - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Could not set an IPv6 socket to IPv6 only"); - CLOSESOCKET(newsock); - return; - } - - if (setsockopt(newsock, SOL_SOCKET, SO_REUSEADDR, (const char *)&optval, sizeof(optval)) == -1) { - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Could not make the socket reusable"); - CLOSESOCKET(newsock); - return; - } - - if (socket_set_nonblocking(newsock) != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Could not set the server socket to nonblocking"); - CLOSESOCKET(newsock); - return; - } - - /* Bind socket to address */ - if (bind(newsock, ai->ai_addr, WIN32_INT ai->ai_addrlen) < 0) { - UA_LOG_SOCKET_ERRNO_WRAP( - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Error binding a server socket: %s", errno_str)); - CLOSESOCKET(newsock); - return; - } - - /* Start listening */ - if (listen(newsock, MAXBACKLOG) < 0) { - UA_LOG_SOCKET_ERRNO_WRAP( - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Error listening on server socket: %s", errno_str)); - CLOSESOCKET(newsock); - return; - } - - layer->serverSockets[layer->serverSocketsSize] = (UA_Int32)newsock; - layer->serverSocketsSize++; -} - -static UA_StatusCode ServerNetworkLayerTCP_start(UA_ServerNetworkLayer *nl, const UA_String *customHostname) { -#ifdef _WIN32 - WORD wVersionRequested = MAKEWORD(2, 2); - WSADATA wsaData; - WSAStartup(wVersionRequested, &wsaData); -#endif - - ServerNetworkLayerTCP *layer = (ServerNetworkLayerTCP *)nl->handle; - - /* Get the discovery url from the hostname */ - UA_String du = UA_STRING_NULL; - if (customHostname->length) { - char discoveryUrl[256]; -#ifndef _MSC_VER - du.length = (size_t)snprintf(discoveryUrl, 255, "opc.tcp://%.*s:%d/", (int)customHostname->length, - customHostname->data, layer->port); -#else - du.length = (size_t)_snprintf_s(discoveryUrl, 255, _TRUNCATE, "opc.tcp://%.*s:%d/", (int)customHostname->length, - customHostname->data, layer->port); -#endif - du.data = (UA_Byte *)discoveryUrl; - } else { - char hostname[256]; - if (gethostname(hostname, 255) == 0) { - char discoveryUrl[256]; -#ifndef _MSC_VER - du.length = (size_t)snprintf(discoveryUrl, 255, "opc.tcp://%s:%d/", hostname, layer->port); -#else - du.length = (size_t)_snprintf_s(discoveryUrl, 255, _TRUNCATE, "opc.tcp://%s:%d/", hostname, layer->port); -#endif - du.data = (UA_Byte *)discoveryUrl; - } - } - UA_String_copy(&du, &nl->discoveryUrl); - - /* Get addrinfo of the server and create server sockets */ - char portno[6]; -#ifndef _MSC_VER - snprintf(portno, 6, "%d", layer->port); -#else - _snprintf_s(portno, 6, _TRUNCATE, "%d", layer->port); -#endif - struct addrinfo hints, *res; - memset(&hints, 0, sizeof hints); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_PASSIVE; - if (getaddrinfo(NULL, portno, &hints, &res) != 0) return UA_STATUSCODE_BADINTERNALERROR; - - /* There might be serveral addrinfos (for different network cards, - * IPv4/IPv6). Add a server socket for all of them. */ - struct addrinfo *ai = res; - for (layer->serverSocketsSize = 0; layer->serverSocketsSize < FD_SETSIZE && ai != NULL; ai = ai->ai_next) - addServerSocket(layer, ai); - freeaddrinfo(res); - - UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "TCP network layer listening on %.*s", - (int)nl->discoveryUrl.length, nl->discoveryUrl.data); - return UA_STATUSCODE_GOOD; -} - -/* After every select, reset the sockets to listen on */ -static UA_Int32 setFDSet(ServerNetworkLayerTCP *layer, fd_set *fdset) { - FD_ZERO(fdset); - UA_Int32 highestfd = 0; - for (UA_UInt16 i = 0; i < layer->serverSocketsSize; i++) { - UA_fd_set(layer->serverSockets[i], fdset); - if (layer->serverSockets[i] > highestfd) highestfd = layer->serverSockets[i]; - } - - ConnectionEntry *e; - LIST_FOREACH(e, &layer->connections, pointers) { - UA_fd_set(e->connection.sockfd, fdset); - if (e->connection.sockfd > highestfd) highestfd = e->connection.sockfd; - } - - return highestfd; -} - -static UA_StatusCode ServerNetworkLayerTCP_listen(UA_ServerNetworkLayer *nl, UA_Server *server, UA_UInt16 timeout) { - /* Every open socket can generate two jobs */ - ServerNetworkLayerTCP *layer = (ServerNetworkLayerTCP *)nl->handle; - - if (layer->serverSocketsSize == 0) return UA_STATUSCODE_GOOD; - - /* Listen on open sockets (including the server) */ - fd_set fdset, errset; - UA_Int32 highestfd = setFDSet(layer, &fdset); - setFDSet(layer, &errset); - struct timeval tmptv = {0, timeout * 1000}; - if (select(highestfd + 1, &fdset, NULL, &errset, &tmptv) < 0) { - UA_LOG_SOCKET_ERRNO_WRAP( - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Socket select failed with %s", errno_str)); - // we will retry, so do not return bad - return UA_STATUSCODE_GOOD; - } - - /* Accept new connections via the server sockets */ - for (UA_UInt16 i = 0; i < layer->serverSocketsSize; i++) { - if (!UA_fd_isset(layer->serverSockets[i], &fdset)) continue; - - struct sockaddr_storage remote; - socklen_t remote_size = sizeof(remote); - SOCKET newsockfd = accept((SOCKET)layer->serverSockets[i], (struct sockaddr *)&remote, &remote_size); -#ifdef _WIN32 - if (newsockfd == INVALID_SOCKET) -#else - if (newsockfd < 0) -#endif - continue; - - UA_LOG_TRACE(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Connection %i | New TCP connection on server socket %i", - (int)newsockfd, layer->serverSockets[i]); - - ServerNetworkLayerTCP_add(layer, (UA_Int32)newsockfd, &remote); - } - - /* Read from established sockets */ - ConnectionEntry *e, *e_tmp; - UA_DateTime now = UA_DateTime_nowMonotonic(); - LIST_FOREACH_SAFE(e, &layer->connections, pointers, e_tmp) { - if ((e->connection.state == UA_CONNECTION_OPENING) && - (now > (e->connection.openingDate + (NOHELLOTIMEOUT * UA_DATETIME_MSEC)))) { - UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Connection %i | Closed by the server (no Hello Message)", - e->connection.sockfd); - LIST_REMOVE(e, pointers); - CLOSESOCKET(e->connection.sockfd); - UA_Server_removeConnection(server, &e->connection); - continue; - } - - if (!UA_fd_isset(e->connection.sockfd, &errset) && !UA_fd_isset(e->connection.sockfd, &fdset)) continue; - - UA_LOG_TRACE(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Connection %i | Activity on the socket", e->connection.sockfd); - - UA_ByteString buf = UA_BYTESTRING_NULL; - UA_StatusCode retval = connection_recv(&e->connection, &buf, 0); - - if (retval == UA_STATUSCODE_GOOD) { - /* Process packets */ - UA_Server_processBinaryMessage(server, &e->connection, &buf); - connection_releaserecvbuffer(&e->connection, &buf); - } else if (retval == UA_STATUSCODE_BADCONNECTIONCLOSED) { - /* The socket is shutdown but not closed */ - if (e->connection.state != UA_CONNECTION_CLOSED) { - UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Connection %i | Closed by the client", - e->connection.sockfd); - } else { - UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Connection %i | Closed by the server", - e->connection.sockfd); - } - LIST_REMOVE(e, pointers); - CLOSESOCKET(e->connection.sockfd); - UA_Server_removeConnection(server, &e->connection); - } - } - return UA_STATUSCODE_GOOD; -} - -static void ServerNetworkLayerTCP_stop(UA_ServerNetworkLayer *nl, UA_Server *server) { - ServerNetworkLayerTCP *layer = (ServerNetworkLayerTCP *)nl->handle; - UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Shutting down the TCP network layer"); - - /* Close the server sockets */ - for (UA_UInt16 i = 0; i < layer->serverSocketsSize; i++) { - shutdown((SOCKET)layer->serverSockets[i], 2); - CLOSESOCKET(layer->serverSockets[i]); - } - layer->serverSocketsSize = 0; - - /* Close open connections */ - ConnectionEntry *e; - LIST_FOREACH(e, &layer->connections, pointers) - ServerNetworkLayerTCP_close(&e->connection); - - /* Run recv on client sockets. This picks up the closed sockets and frees - * the connection. */ - ServerNetworkLayerTCP_listen(nl, server, 0); - -#ifdef _WIN32 - WSACleanup(); -#endif -} - -/* run only when the server is stopped */ -static void ServerNetworkLayerTCP_deleteMembers(UA_ServerNetworkLayer *nl) { - ServerNetworkLayerTCP *layer = (ServerNetworkLayerTCP *)nl->handle; - UA_String_deleteMembers(&nl->discoveryUrl); - - /* Hard-close and remove remaining connections. The server is no longer - * running. So this is safe. */ - ConnectionEntry *e, *e_tmp; - LIST_FOREACH_SAFE(e, &layer->connections, pointers, e_tmp) { - LIST_REMOVE(e, pointers); - CLOSESOCKET(e->connection.sockfd); - UA_free(e); - } - - /* Free the layer */ - UA_free(layer); -} - -UA_ServerNetworkLayer UA_ServerNetworkLayerTCP(UA_ConnectionConfig conf, UA_UInt16 port) { - UA_ServerNetworkLayer nl; - memset(&nl, 0, sizeof(UA_ServerNetworkLayer)); - ServerNetworkLayerTCP *layer = (ServerNetworkLayerTCP *)UA_calloc(1, sizeof(ServerNetworkLayerTCP)); - if (!layer) return nl; - - layer->conf = conf; - layer->port = port; - - nl.handle = layer; - nl.start = ServerNetworkLayerTCP_start; - nl.listen = ServerNetworkLayerTCP_listen; - nl.stop = ServerNetworkLayerTCP_stop; - nl.deleteMembers = ServerNetworkLayerTCP_deleteMembers; - return nl; -} - -/***************************/ -/* Server NetworkLayer TCP * - * with socket activation */ -/***************************/ - -static UA_StatusCode ServerNetworkLayerTCPSocketActivation_start(UA_ServerNetworkLayer *nl, - const UA_String *customHostname) { - return UA_STATUSCODE_GOOD; -} - -static void ServerNetworkLayerTCPSocketActivation_stop(UA_ServerNetworkLayer *nl, UA_Server *server) { - ServerNetworkLayerTCP *layer = (ServerNetworkLayerTCP *)nl->handle; - shutdown((SOCKET)layer->serverSockets[0], 2); - layer->serverSocketsSize = 0; - - ServerNetworkLayerTCP_stop(nl, server); -} - -UA_ServerNetworkLayer UA_ServerNetworkLayerTCPSocketActivation(UA_ConnectionConfig conf, UA_Int32 socketFd) { - UA_ServerNetworkLayer nl; - memset(&nl, 0, sizeof(UA_ServerNetworkLayer)); - ServerNetworkLayerTCP *layer = (ServerNetworkLayerTCP *)UA_calloc(1, sizeof(ServerNetworkLayerTCP)); - if (!layer) return nl; - - layer->conf = conf; - layer->serverSockets[0] = socketFd; - layer->serverSocketsSize = 1; - - nl.handle = layer; - nl.start = ServerNetworkLayerTCPSocketActivation_start; - nl.listen = ServerNetworkLayerTCP_listen; - nl.stop = ServerNetworkLayerTCPSocketActivation_stop; - nl.deleteMembers = ServerNetworkLayerTCP_deleteMembers; - return nl; -} - -/***************************/ -/* Client NetworkLayer TCP */ -/***************************/ - -static void ClientNetworkLayerTCP_close(UA_Connection *connection) { - if (connection->state == UA_CONNECTION_CLOSED) return; - shutdown((SOCKET)connection->sockfd, 2); - CLOSESOCKET(connection->sockfd); - connection->state = UA_CONNECTION_CLOSED; -} - -UA_Connection UA_ClientConnectionTCP(UA_ConnectionConfig conf, const char *endpointUrl, const UA_UInt32 timeout) { -#ifdef _WIN32 - WORD wVersionRequested; - WSADATA wsaData; - wVersionRequested = MAKEWORD(2, 2); - WSAStartup(wVersionRequested, &wsaData); -#endif - - UA_Connection connection; - memset(&connection, 0, sizeof(UA_Connection)); - connection.state = UA_CONNECTION_OPENING; - connection.localConf = conf; - connection.remoteConf = conf; - connection.send = connection_write; - connection.recv = connection_recv; - connection.close = ClientNetworkLayerTCP_close; - connection.free = NULL; - connection.getSendBuffer = connection_getsendbuffer; - connection.releaseSendBuffer = connection_releasesendbuffer; - connection.releaseRecvBuffer = connection_releaserecvbuffer; - - UA_String endpointUrlString = UA_STRING((char *)(uintptr_t)endpointUrl); - UA_String hostnameString = UA_STRING_NULL; - UA_String pathString = UA_STRING_NULL; - UA_UInt16 port = 0; - char hostname[512]; - - UA_StatusCode parse_retval = UA_parseEndpointUrl(&endpointUrlString, &hostnameString, &port, &pathString); - if (parse_retval != UA_STATUSCODE_GOOD || hostnameString.length > 511) { - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Server url is invalid: %s", endpointUrl); - return connection; - } - bool hostnameIpv6NumericAddr = false; - if (hostnameString.length > 2 && hostnameString.data[0] == '[' && - hostnameString.data[hostnameString.length - 1] == ']') { - size_t hostnameLength = hostnameString.length - 2; - memcpy(hostname, &hostnameString.data[1], hostnameLength); - hostname[hostnameLength] = 0; - hostnameIpv6NumericAddr = true; - } else { - memcpy(hostname, hostnameString.data, hostnameString.length); - hostname[hostnameString.length] = 0; - } - if (port == 0) { - port = 4840; - UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "No port defined, using default port %d", port); - } - - struct addrinfo hints, *server; - memset(&hints, 0, sizeof(hints)); - if (hostnameIpv6NumericAddr) hints.ai_flags = AI_NUMERICHOST; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - char portStr[6]; -#ifndef _MSC_VER - snprintf(portStr, 6, "%d", port); -#else - _snprintf_s(portStr, 6, _TRUNCATE, "%d", port); -#endif - int error = getaddrinfo(hostname, portStr, &hints, &server); - if (error != 0 || !server) { - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "DNS lookup of %s failed with error %s", hostname, - gai_strerror(error)); - return connection; - } - - UA_Boolean connected = UA_FALSE; - UA_DateTime dtTimeout = timeout * UA_DATETIME_MSEC; - UA_DateTime connStart = UA_DateTime_nowMonotonic(); - SOCKET clientsockfd; - - /* On linux connect may immediately return with ECONNREFUSED but we still - * want to try to connect. So use a loop and retry until timeout is - * reached. */ - do { - connection.state = UA_CONNECTION_OPENING; - - /* Get a socket */ - clientsockfd = socket(server->ai_family, server->ai_socktype, server->ai_protocol); -#ifdef _WIN32 - if (clientsockfd == INVALID_SOCKET) { -#else - if (clientsockfd < 0) { -#endif - UA_LOG_SOCKET_ERRNO_WRAP( - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Could not create client socket: %s", errno_str)); - freeaddrinfo(server); - return connection; - } - - /* Connect to the server */ - connection.sockfd = (UA_Int32)clientsockfd; /* cast for win32 */ - - /* Non blocking connect to be able to timeout */ - if (socket_set_nonblocking(clientsockfd) != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Could not set the client socket to nonblocking"); - ClientNetworkLayerTCP_close(&connection); - freeaddrinfo(server); - return connection; - } - - /* Non blocking connect */ - error = connect(clientsockfd, server->ai_addr, WIN32_INT server->ai_addrlen); - - if ((error == -1) && (errno__ != ERR_CONNECTION_PROGRESS)) { - ClientNetworkLayerTCP_close(&connection); - UA_LOG_SOCKET_ERRNO_WRAP(UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, - "Connection to %s failed with error: %s", endpointUrl, errno_str)); - freeaddrinfo(server); - return connection; - } - - /* Use select to wait and check if connected */ - if (error == -1 && (errno__ == ERR_CONNECTION_PROGRESS)) { - /* connection in progress. Wait until connected using select */ - UA_DateTime timeSinceStart = UA_DateTime_nowMonotonic() - connStart; - if (timeSinceStart > dtTimeout) break; - - fd_set fdset; - FD_ZERO(&fdset); - UA_fd_set(clientsockfd, &fdset); - UA_DateTime timeout_usec = (dtTimeout - timeSinceStart) / UA_DATETIME_USEC; - struct timeval tmptv = {(long int)(timeout_usec / 1000000), (long int)(timeout_usec % 1000000)}; - - int resultsize = select((UA_Int32)(clientsockfd + 1), NULL, &fdset, NULL, &tmptv); - - if (resultsize == 1) { -#ifdef _WIN32 - /* Windows does not have any getsockopt equivalent and it is not - * needed there */ - connected = true; - break; -#else - OPTVAL_TYPE so_error; - socklen_t len = sizeof so_error; - - int ret = getsockopt(clientsockfd, SOL_SOCKET, SO_ERROR, &so_error, &len); - - if (ret != 0 || so_error != 0) { - /* on connection refused we should still try to connect */ - /* connection refused happens on localhost or local ip without timeout */ - if (so_error != ECONNREFUSED) { - ClientNetworkLayerTCP_close(&connection); - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Connection to %s failed with error: %s", endpointUrl, - strerror(ret == 0 ? so_error : errno__)); - freeaddrinfo(server); - return connection; - } - /* wait until we try a again. Do not make this too small, otherwise the - * timeout is somehow wrong */ - UA_sleep_ms(100); - } else { - connected = true; - break; - } -#endif - } - } else { - connected = true; - break; - } - ClientNetworkLayerTCP_close(&connection); - - } while ((UA_DateTime_nowMonotonic() - connStart) < dtTimeout); - - freeaddrinfo(server); - - if (!connected) { - /* connection timeout */ - if (connection.state != UA_CONNECTION_CLOSED) ClientNetworkLayerTCP_close(&connection); - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Trying to connect to %s timed out", endpointUrl); - return connection; - } - - /* We are connected. Reset socket to blocking */ - if (socket_set_blocking(clientsockfd) != UA_STATUSCODE_GOOD) { - UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Could not set the client socket to blocking"); - ClientNetworkLayerTCP_close(&connection); - return connection; - } - -#ifdef SO_NOSIGPIPE - int val = 1; - int sso_result = setsockopt(connection.sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&val, sizeof(val)); - if (sso_result < 0) UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK, "Couldn't set SO_NOSIGPIPE"); -#endif - - return connection; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_clock.c" - * ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - -/* Enable POSIX features */ -#if !defined(_XOPEN_SOURCE) && !defined(_WRS_KERNEL) -#define _XOPEN_SOURCE 600 -#endif -#ifndef _DEFAULT_SOURCE -#define _DEFAULT_SOURCE -#endif -/* On older systems we need to define _BSD_SOURCE. - * _DEFAULT_SOURCE is an alias for that. */ -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif - -#include -#ifdef _WIN32 -/* Backup definition of SLIST_ENTRY on mingw winnt.h */ -#ifdef SLIST_ENTRY -#pragma push_macro("SLIST_ENTRY") -#undef SLIST_ENTRY -#define POP_SLIST_ENTRY -#endif -#include -/* restore definition */ -#ifdef POP_SLIST_ENTRY -#undef SLIST_ENTRY -#undef POP_SLIST_ENTRY -#pragma pop_macro("SLIST_ENTRY") -#endif -#else -#include -#endif - -#if defined(__APPLE__) || defined(__MACH__) -#include -#include -#endif - -UA_DateTime UA_DateTime_now(void) { -#if defined(_WIN32) - /* Windows filetime has the same definition as UA_DateTime */ - FILETIME ft; - SYSTEMTIME st; - GetSystemTime(&st); - SystemTimeToFileTime(&st, &ft); - ULARGE_INTEGER ul; - ul.LowPart = ft.dwLowDateTime; - ul.HighPart = ft.dwHighDateTime; - return (UA_DateTime)ul.QuadPart; -#else - struct timeval tv; - gettimeofday(&tv, NULL); - return (tv.tv_sec * UA_DATETIME_SEC) + (tv.tv_usec * UA_DATETIME_USEC) + UA_DATETIME_UNIX_EPOCH; -#endif -} - -/* Credit to https://stackoverflow.com/questions/13804095/get-the-time-zone-gmt-offset-in-c */ -UA_Int64 UA_DateTime_localTimeUtcOffset(void) { - time_t gmt, rawtime = time(NULL); - -#ifdef _WIN32 - struct tm ptm; - gmtime_s(&ptm, &rawtime); - // Request that mktime() looksup dst in timezone database - ptm.tm_isdst = -1; - gmt = mktime(&ptm); -#else - struct tm *ptm; - struct tm gbuf; - ptm = gmtime_r(&rawtime, &gbuf); - // Request that mktime() looksup dst in timezone database - ptm->tm_isdst = -1; - gmt = mktime(ptm); -#endif - - return (UA_Int64)(difftime(rawtime, gmt) * UA_DATETIME_SEC); -} - -UA_DateTime UA_DateTime_nowMonotonic(void) { -#if defined(_WIN32) - LARGE_INTEGER freq, ticks; - QueryPerformanceFrequency(&freq); - QueryPerformanceCounter(&ticks); - UA_Double ticks2dt = UA_DATETIME_SEC / (UA_Double)freq.QuadPart; - return (UA_DateTime)(ticks.QuadPart * ticks2dt); -#elif defined(__APPLE__) || defined(__MACH__) - /* OS X does not have clock_gettime, use clock_get_time */ - clock_serv_t cclock; - mach_timespec_t mts; - host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock); - clock_get_time(cclock, &mts); - mach_port_deallocate(mach_task_self(), cclock); - return (mts.tv_sec * UA_DATETIME_SEC) + (mts.tv_nsec / 100); -#elif !defined(CLOCK_MONOTONIC_RAW) - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - return (ts.tv_sec * UA_DATETIME_SEC) + (ts.tv_nsec / 100); -#else - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - return (ts.tv_sec * UA_DATETIME_SEC) + (ts.tv_nsec / 100); -#endif -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_log_stdout.c" - * ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - -#include - -/* ANSI escape sequences for color output taken from here: - * https://stackoverflow.com/questions/3219393/stdlib-and-colored-output-in-c*/ - -#ifdef _WIN32 -#define ANSI_COLOR_RED "" -#define ANSI_COLOR_GREEN "" -#define ANSI_COLOR_YELLOW "" -#define ANSI_COLOR_BLUE "" -#define ANSI_COLOR_MAGENTA "" -#define ANSI_COLOR_CYAN "" -#define ANSI_COLOR_RESET "" -#else -#define ANSI_COLOR_RED "\x1b[31m" -#define ANSI_COLOR_GREEN "\x1b[32m" -#define ANSI_COLOR_YELLOW "\x1b[33m" -#define ANSI_COLOR_BLUE "\x1b[34m" -#define ANSI_COLOR_MAGENTA "\x1b[35m" -#define ANSI_COLOR_CYAN "\x1b[36m" -#define ANSI_COLOR_RESET "\x1b[0m" -#endif - -#ifdef UA_ENABLE_MULTITHREADING -#include -static pthread_mutex_t printf_mutex = PTHREAD_MUTEX_INITIALIZER; -#endif - -const char *logLevelNames[6] = {"trace", - "debug", - ANSI_COLOR_GREEN "info", - ANSI_COLOR_YELLOW "warn", - ANSI_COLOR_RED "error", - ANSI_COLOR_MAGENTA "fatal"}; -const char *logCategoryNames[7] = {"network", "channel", "session", "server", "client", "userland", "securitypolicy"}; - -#ifdef __clang__ -__attribute__((__format__(__printf__, 3 , 0))) -#endif -void -UA_Log_Stdout(UA_LogLevel level, UA_LogCategory category, - const char *msg, va_list args) { - UA_Int64 tOffset = UA_DateTime_localTimeUtcOffset(); - UA_DateTimeStruct dts = UA_DateTime_toStruct(UA_DateTime_now() + tOffset); - -#ifdef UA_ENABLE_MULTITHREADING - pthread_mutex_lock(&printf_mutex); -#endif - - printf("[%04u-%02u-%02u %02u:%02u:%02u.%03u (UTC%+05d)] %s/%s" ANSI_COLOR_RESET "\t", dts.year, dts.month, dts.day, - dts.hour, dts.min, dts.sec, dts.milliSec, (int)(tOffset / UA_DATETIME_SEC / 36), logLevelNames[level], - logCategoryNames[category]); - vprintf(msg, args); - printf("\n"); - fflush(stdout); - -#ifdef UA_ENABLE_MULTITHREADING - pthread_mutex_unlock(&printf_mutex); -#endif -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_accesscontrol_default.c" - * ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - -/* Example access control management. Anonymous and username / password login. - * The access rights are maximally permissive. */ - -#define ANONYMOUS_POLICY "open62541-anonymous-policy" -#define USERNAME_POLICY "open62541-username-policy" - -// TODO: There should be one definition of these strings in the endpoint. -// Put the endpoint definition in the access control struct? -#define UA_STRING_STATIC(s) \ - { sizeof(s) - 1, (UA_Byte *)s } -const UA_String anonymous_policy = UA_STRING_STATIC(ANONYMOUS_POLICY); -const UA_String username_policy = UA_STRING_STATIC(USERNAME_POLICY); - -typedef struct { - UA_String username; - UA_String password; -} UA_UsernamePasswordLogin; - -const size_t usernamePasswordsSize = 2; -UA_UsernamePasswordLogin usernamePasswords[2] = {{UA_STRING_STATIC("user1"), UA_STRING_STATIC("password")}, - {UA_STRING_STATIC("user2"), UA_STRING_STATIC("password1")}}; - -UA_StatusCode activateSession_default(const UA_NodeId *sessionId, const UA_ExtensionObject *userIdentityToken, - void **sessionContext) { - /* Could the token be decoded? */ - if (userIdentityToken->encoding < UA_EXTENSIONOBJECT_DECODED) return UA_STATUSCODE_BADIDENTITYTOKENINVALID; - - /* Anonymous login */ - if (userIdentityToken->content.decoded.type == &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN]) { - const UA_AnonymousIdentityToken *token = (UA_AnonymousIdentityToken *)userIdentityToken->content.decoded.data; - - /* Compatibility notice: Siemens OPC Scout v10 provides an empty - * policyId. This is not compliant. For compatibility, assume that empty - * policyId == ANONYMOUS_POLICY */ - if (token->policyId.data && !UA_String_equal(&token->policyId, &anonymous_policy)) - return UA_STATUSCODE_BADIDENTITYTOKENINVALID; - - /* No userdata atm */ - *sessionContext = NULL; - return UA_STATUSCODE_GOOD; - } - - /* Username and password */ - if (userIdentityToken->content.decoded.type == &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]) { - const UA_UserNameIdentityToken *token = (UA_UserNameIdentityToken *)userIdentityToken->content.decoded.data; - if (!UA_String_equal(&token->policyId, &username_policy) || token->encryptionAlgorithm.length > 0) - return UA_STATUSCODE_BADIDENTITYTOKENINVALID; - - /* Empty username and password */ - if (token->userName.length == 0 && token->password.length == 0) return UA_STATUSCODE_BADIDENTITYTOKENINVALID; - - /* Try to match username/pw */ - UA_Boolean match = false; - for (size_t i = 0; i < usernamePasswordsSize; i++) { - const UA_String *user = &usernamePasswords[i].username; - const UA_String *pw = &usernamePasswords[i].password; - if (UA_String_equal(&token->userName, user) && UA_String_equal(&token->password, pw)) { - match = true; - break; - } - } - if (!match) return UA_STATUSCODE_BADUSERACCESSDENIED; - - /* No userdata atm */ - *sessionContext = NULL; - return UA_STATUSCODE_GOOD; - } - - /* Unsupported token type */ - return UA_STATUSCODE_BADIDENTITYTOKENINVALID; -} - -void closeSession_default(const UA_NodeId *sessionId, void *sessionContext) { /* no context to clean up */ } - -UA_UInt32 getUserRightsMask_default(const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, - void *nodeContext) { - return 0xFFFFFFFF; -} - -UA_Byte getUserAccessLevel_default(const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *nodeId, - void *nodeContext) { - return 0xFF; -} - -UA_Boolean getUserExecutable_default(const UA_NodeId *sessionId, void *sessionContext, const UA_NodeId *methodId, - void *methodContext) { - return true; -} - -UA_Boolean getUserExecutableOnObject_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *methodId, void *methodContext, const UA_NodeId *objectId, - void *objectContext) { - return true; -} - -UA_Boolean allowAddNode_default(const UA_NodeId *sessionId, void *sessionContext, const UA_AddNodesItem *item) { - return true; -} - -UA_Boolean allowAddReference_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_AddReferencesItem *item) { - return true; -} - -UA_Boolean allowDeleteNode_default(const UA_NodeId *sessionId, void *sessionContext, const UA_DeleteNodesItem *item) { - return true; -} - -UA_Boolean allowDeleteReference_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_DeleteReferencesItem *item) { - return true; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_nodestore_default.c" - * ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - -/* container_of */ -#define container_of(ptr, type, member) (type *)((uintptr_t)ptr - offsetof(type, member)) - -#ifdef UA_ENABLE_MULTITHREADING -#include -#define BEGIN_CRITSECT(NODEMAP) pthread_mutex_lock(&(NODEMAP)->mutex) -#define END_CRITSECT(NODEMAP) pthread_mutex_unlock(&(NODEMAP)->mutex) -#else -#define BEGIN_CRITSECT(NODEMAP) -#define END_CRITSECT(NODEMAP) -#endif - -/* The default Nodestore is simply a hash-map from NodeIds to Nodes. To find an - * entry, iterate over candidate positions according to the NodeId hash. - * - * - Tombstone or non-matching NodeId: continue searching - * - Matching NodeId: Return the entry - * - NULL: Abort the search */ - -typedef struct UA_NodeMapEntry { - struct UA_NodeMapEntry *orig; /* the version this is a copy from (or NULL) */ - UA_UInt16 refCount; /* How many consumers have a reference to the node? */ - UA_Boolean deleted; /* Node was marked as deleted and can be deleted when refCount == 0 */ - UA_Node node; -} UA_NodeMapEntry; - -#define UA_NODEMAP_MINSIZE 64 -#define UA_NODEMAP_TOMBSTONE ((UA_NodeMapEntry *)0x01) - -typedef struct { - UA_NodeMapEntry **entries; - UA_UInt32 size; - UA_UInt32 count; - UA_UInt32 sizePrimeIndex; -#ifdef UA_ENABLE_MULTITHREADING - pthread_mutex_t mutex; /* Protect access */ -#endif -} UA_NodeMap; - -/*********************/ -/* HashMap Utilities */ -/*********************/ - -/* The size of the hash-map is always a prime number. They are chosen to be - * close to the next power of 2. So the size ca. doubles with each prime. */ -static UA_UInt32 const primes[] = { - 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, - 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, - 8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909, 1073741789, 2147483647, 4294967291}; - -static UA_UInt32 mod(UA_UInt32 h, UA_UInt32 size) { return h % size; } -static UA_UInt32 mod2(UA_UInt32 h, UA_UInt32 size) { return 1 + (h % (size - 2)); } - -static UA_UInt16 higher_prime_index(UA_UInt32 n) { - UA_UInt16 low = 0; - UA_UInt16 high = (UA_UInt16)(sizeof(primes) / sizeof(UA_UInt32)); - while (low != high) { - UA_UInt16 mid = (UA_UInt16)(low + ((high - low) / 2)); - if (n > primes[mid]) - low = (UA_UInt16)(mid + 1); - else - high = mid; - } - return low; -} - -/* returns an empty slot or null if the nodeid exists */ -static UA_NodeMapEntry **findFreeSlot(const UA_NodeMap *ns, const UA_NodeId *nodeid) { - UA_UInt32 h = UA_NodeId_hash(nodeid); - UA_UInt32 size = ns->size; - UA_UInt32 idx = mod(h, size); - UA_UInt32 hash2 = mod2(h, size); - - while (true) { - UA_NodeMapEntry *e = ns->entries[idx]; - if (e > UA_NODEMAP_TOMBSTONE && UA_NodeId_equal(&e->node.nodeId, nodeid)) return NULL; - if (ns->entries[idx] <= UA_NODEMAP_TOMBSTONE) return &ns->entries[idx]; - idx += hash2; - if (idx >= size) idx -= size; - } - - /* NOTREACHED */ - return NULL; -} - -/* The occupancy of the table after the call will be about 50% */ -static UA_StatusCode expand(UA_NodeMap *ns) { - UA_UInt32 osize = ns->size; - UA_UInt32 count = ns->count; - /* Resize only when table after removal of unused elements is either too - full or too empty */ - if (count * 2 < osize && (count * 8 > osize || osize <= UA_NODEMAP_MINSIZE)) return UA_STATUSCODE_GOOD; - - UA_NodeMapEntry **oentries = ns->entries; - UA_UInt32 nindex = higher_prime_index(count * 2); - UA_UInt32 nsize = primes[nindex]; - UA_NodeMapEntry **nentries = (UA_NodeMapEntry **)UA_calloc(nsize, sizeof(UA_NodeMapEntry *)); - if (!nentries) return UA_STATUSCODE_BADOUTOFMEMORY; - - ns->entries = nentries; - ns->size = nsize; - ns->sizePrimeIndex = nindex; - - /* recompute the position of every entry and insert the pointer */ - for (size_t i = 0, j = 0; i < osize && j < count; ++i) { - if (oentries[i] <= UA_NODEMAP_TOMBSTONE) continue; - UA_NodeMapEntry **e = findFreeSlot(ns, &oentries[i]->node.nodeId); - UA_assert(e); - *e = oentries[i]; - ++j; - } - - UA_free(oentries); - return UA_STATUSCODE_GOOD; -} - -static UA_NodeMapEntry *newEntry(UA_NodeClass nodeClass) { - size_t size = sizeof(UA_NodeMapEntry) - sizeof(UA_Node); - switch (nodeClass) { - case UA_NODECLASS_OBJECT: - size += sizeof(UA_ObjectNode); - break; - case UA_NODECLASS_VARIABLE: - size += sizeof(UA_VariableNode); - break; - case UA_NODECLASS_METHOD: - size += sizeof(UA_MethodNode); - break; - case UA_NODECLASS_OBJECTTYPE: - size += sizeof(UA_ObjectTypeNode); - break; - case UA_NODECLASS_VARIABLETYPE: - size += sizeof(UA_VariableTypeNode); - break; - case UA_NODECLASS_REFERENCETYPE: - size += sizeof(UA_ReferenceTypeNode); - break; - case UA_NODECLASS_DATATYPE: - size += sizeof(UA_DataTypeNode); - break; - case UA_NODECLASS_VIEW: - size += sizeof(UA_ViewNode); - break; - default: - return NULL; - } - UA_NodeMapEntry *entry = (UA_NodeMapEntry *)UA_calloc(1, size); - if (!entry) return NULL; - entry->node.nodeClass = nodeClass; - return entry; -} - -static void deleteEntry(UA_NodeMapEntry *entry) { - UA_Node_deleteMembers(&entry->node); - UA_free(entry); -} - -static void cleanupEntry(UA_NodeMapEntry *entry) { - if (entry->deleted && entry->refCount == 0) deleteEntry(entry); -} - -static UA_StatusCode clearSlot(UA_NodeMap *ns, UA_NodeMapEntry **slot) { - (*slot)->deleted = true; - cleanupEntry(*slot); - *slot = UA_NODEMAP_TOMBSTONE; - --ns->count; - /* Downsize the hashmap if it is very empty */ - if (ns->count * 8 < ns->size && ns->size > 32) expand(ns); /* Can fail. Just continue with the bigger hashmap. */ - return UA_STATUSCODE_GOOD; -} - -static UA_NodeMapEntry **findOccupiedSlot(const UA_NodeMap *ns, const UA_NodeId *nodeid) { - UA_UInt32 h = UA_NodeId_hash(nodeid); - UA_UInt32 size = ns->size; - UA_UInt32 idx = mod(h, size); - UA_UInt32 hash2 = mod2(h, size); - - while (true) { - UA_NodeMapEntry *e = ns->entries[idx]; - if (!e) return NULL; - if (e > UA_NODEMAP_TOMBSTONE && UA_NodeId_equal(&e->node.nodeId, nodeid)) return &ns->entries[idx]; - idx += hash2; - if (idx >= size) idx -= size; - } - - /* NOTREACHED */ - return NULL; -} - -/***********************/ -/* Interface functions */ -/***********************/ - -static UA_Node *UA_NodeMap_newNode(void *context, UA_NodeClass nodeClass) { - UA_NodeMapEntry *entry = newEntry(nodeClass); - if (!entry) return NULL; - return &entry->node; -} - -static void UA_NodeMap_deleteNode(void *context, UA_Node *node) { -#ifdef UA_ENABLE_MULTITHREADING - UA_NodeMap *ns = (UA_NodeMap *)context; -#endif - BEGIN_CRITSECT(ns); - UA_NodeMapEntry *entry = container_of(node, UA_NodeMapEntry, node); - UA_assert(&entry->node == node); - deleteEntry(entry); - END_CRITSECT(ns); -} - -static const UA_Node *UA_NodeMap_getNode(void *context, const UA_NodeId *nodeid) { - UA_NodeMap *ns = (UA_NodeMap *)context; - BEGIN_CRITSECT(ns); - UA_NodeMapEntry **entry = findOccupiedSlot(ns, nodeid); - if (!entry) { - END_CRITSECT(ns); - return NULL; - } - ++(*entry)->refCount; - END_CRITSECT(ns); - return (const UA_Node *)&(*entry)->node; -} - -static void UA_NodeMap_releaseNode(void *context, const UA_Node *node) { - if (!node) return; -#ifdef UA_ENABLE_MULTITHREADING - UA_NodeMap *ns = (UA_NodeMap *)context; -#endif - BEGIN_CRITSECT(ns); - UA_NodeMapEntry *entry = container_of(node, UA_NodeMapEntry, node); - UA_assert(&entry->node == node); - UA_assert(entry->refCount > 0); - --entry->refCount; - cleanupEntry(entry); - END_CRITSECT(ns); -} - -static UA_StatusCode UA_NodeMap_getNodeCopy(void *context, const UA_NodeId *nodeid, UA_Node **outNode) { - UA_NodeMap *ns = (UA_NodeMap *)context; - BEGIN_CRITSECT(ns); - UA_NodeMapEntry **slot = findOccupiedSlot(ns, nodeid); - if (!slot) { - END_CRITSECT(ns); - return UA_STATUSCODE_BADNODEIDUNKNOWN; - } - UA_NodeMapEntry *entry = *slot; - UA_NodeMapEntry *newItem = newEntry(entry->node.nodeClass); - if (!newItem) { - END_CRITSECT(ns); - return UA_STATUSCODE_BADOUTOFMEMORY; - } - UA_StatusCode retval = UA_Node_copy(&entry->node, &newItem->node); - if (retval == UA_STATUSCODE_GOOD) { - newItem->orig = entry; // store the pointer to the original - *outNode = &newItem->node; - } else { - deleteEntry(newItem); - } - END_CRITSECT(ns); - return retval; -} - -static UA_StatusCode UA_NodeMap_removeNode(void *context, const UA_NodeId *nodeid) { - UA_NodeMap *ns = (UA_NodeMap *)context; - BEGIN_CRITSECT(ns); - UA_NodeMapEntry **slot = findOccupiedSlot(ns, nodeid); - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (slot) - retval = clearSlot(ns, slot); - else - retval = UA_STATUSCODE_BADNODEIDUNKNOWN; - END_CRITSECT(ns); - return retval; -} - -static UA_StatusCode UA_NodeMap_insertNode(void *context, UA_Node *node, UA_NodeId *addedNodeId) { - UA_NodeMap *ns = (UA_NodeMap *)context; - BEGIN_CRITSECT(ns); - if (ns->size * 3 <= ns->count * 4) { - if (expand(ns) != UA_STATUSCODE_GOOD) { - END_CRITSECT(ns); - return UA_STATUSCODE_BADINTERNALERROR; - } - } - - UA_NodeId tempNodeid; - tempNodeid = node->nodeId; - tempNodeid.namespaceIndex = 0; - UA_NodeMapEntry **slot; - if (tempNodeid.identifierType == UA_NODEIDTYPE_NUMERIC && tempNodeid.identifier.numeric == 0) { - /* create a random nodeid */ - /* start at least with 50,000 to make sure we don not conflict with nodes from the spec */ - /* E.g. adding a nodeset will create children while there are still other nodes which need to be created */ - /* Thus the node id's may collide */ - UA_UInt32 identifier = 50000 + ns->count + 1; // start value - UA_UInt32 size = ns->size; - UA_UInt32 increase = mod2(ns->count + 1, size); - while (true) { - node->nodeId.identifier.numeric = identifier; - slot = findFreeSlot(ns, &node->nodeId); - if (slot) break; - identifier += increase; - if (identifier >= size) identifier -= size; - } - } else { - slot = findFreeSlot(ns, &node->nodeId); - if (!slot) { - deleteEntry(container_of(node, UA_NodeMapEntry, node)); - END_CRITSECT(ns); - return UA_STATUSCODE_BADNODEIDEXISTS; - } - } - - *slot = container_of(node, UA_NodeMapEntry, node); - ++ns->count; - UA_assert(&(*slot)->node == node); - - UA_StatusCode retval = UA_STATUSCODE_GOOD; - if (addedNodeId) { - retval = UA_NodeId_copy(&node->nodeId, addedNodeId); - if (retval != UA_STATUSCODE_GOOD) clearSlot(ns, slot); - } - - END_CRITSECT(ns); - return retval; -} - -static UA_StatusCode UA_NodeMap_replaceNode(void *context, UA_Node *node) { - UA_NodeMap *ns = (UA_NodeMap *)context; - BEGIN_CRITSECT(ns); - UA_NodeMapEntry **slot = findOccupiedSlot(ns, &node->nodeId); - if (!slot) { - END_CRITSECT(ns); - return UA_STATUSCODE_BADNODEIDUNKNOWN; - } - UA_NodeMapEntry *newEntryContainer = container_of(node, UA_NodeMapEntry, node); - if (*slot != newEntryContainer->orig) { - /* The node was updated since the copy was made */ - deleteEntry(newEntryContainer); - END_CRITSECT(ns); - return UA_STATUSCODE_BADINTERNALERROR; - } - (*slot)->deleted = true; - cleanupEntry(*slot); - *slot = newEntryContainer; - END_CRITSECT(ns); - return UA_STATUSCODE_GOOD; -} - -static void UA_NodeMap_iterate(void *context, void *visitorContext, UA_NodestoreVisitor visitor) { - UA_NodeMap *ns = (UA_NodeMap *)context; - BEGIN_CRITSECT(ns); - for (UA_UInt32 i = 0; i < ns->size; ++i) { - if (ns->entries[i] > UA_NODEMAP_TOMBSTONE) { - END_CRITSECT(ns); - UA_NodeMapEntry *entry = ns->entries[i]; - entry->refCount++; - visitor(visitorContext, &entry->node); - entry->refCount--; - cleanupEntry(entry); - BEGIN_CRITSECT(ns); - } - } - END_CRITSECT(ns); -} - -static void UA_NodeMap_delete(void *context) { - UA_NodeMap *ns = (UA_NodeMap *)context; -#ifdef UA_ENABLE_MULTITHREADING - pthread_mutex_destroy(&ns->mutex); -#endif - UA_UInt32 size = ns->size; - UA_NodeMapEntry **entries = ns->entries; - for (UA_UInt32 i = 0; i < size; ++i) { - if (entries[i] > UA_NODEMAP_TOMBSTONE) { - /* On debugging builds, check that all nodes were release */ - UA_assert(entries[i]->refCount == 0); - /* Delete the node */ - deleteEntry(entries[i]); - } - } - UA_free(ns->entries); - UA_free(ns); -} - -UA_StatusCode UA_Nodestore_default_new(UA_Nodestore *ns) { - /* Allocate and initialize the nodemap */ - UA_NodeMap *nodemap = (UA_NodeMap *)UA_malloc(sizeof(UA_NodeMap)); - if (!nodemap) return UA_STATUSCODE_BADOUTOFMEMORY; - nodemap->sizePrimeIndex = higher_prime_index(UA_NODEMAP_MINSIZE); - nodemap->size = primes[nodemap->sizePrimeIndex]; - nodemap->count = 0; - nodemap->entries = (UA_NodeMapEntry **)UA_calloc(nodemap->size, sizeof(UA_NodeMapEntry *)); - if (!nodemap->entries) { - UA_free(nodemap); - return UA_STATUSCODE_BADOUTOFMEMORY; - } -#ifdef UA_ENABLE_MULTITHREADING - pthread_mutex_init(&nodemap->mutex, NULL); -#endif - - /* Populate the nodestore */ - ns->context = nodemap; - ns->deleteNodestore = UA_NodeMap_delete; - ns->inPlaceEditAllowed = true; - ns->newNode = UA_NodeMap_newNode; - ns->deleteNode = UA_NodeMap_deleteNode; - ns->getNode = UA_NodeMap_getNode; - ns->releaseNode = UA_NodeMap_releaseNode; - ns->getNodeCopy = UA_NodeMap_getNodeCopy; - ns->insertNode = UA_NodeMap_insertNode; - ns->replaceNode = UA_NodeMap_replaceNode; - ns->removeNode = UA_NodeMap_removeNode; - ns->iterate = UA_NodeMap_iterate; - - return UA_STATUSCODE_GOOD; -} - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_config_default.c" - * ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - -#define ANONYMOUS_POLICY "open62541-anonymous-policy" -#define USERNAME_POLICY "open62541-username-policy" - -/* Struct initialization works across ANSI C/C99/C++ if it is done when the - * variable is first declared. Assigning values to existing structs is - * heterogeneous across the three. */ -static UA_INLINE UA_UInt32Range UA_UINT32RANGE(UA_UInt32 min, UA_UInt32 max) { - UA_UInt32Range range = {min, max}; - return range; -} - -static UA_INLINE UA_DurationRange UA_DURATIONRANGE(UA_Double min, UA_Double max) { - UA_DurationRange range = {min, max}; - return range; -} - -/*******************************/ -/* Default Connection Settings */ -/*******************************/ - -const UA_ConnectionConfig UA_ConnectionConfig_default = { - 0, /* .protocolVersion */ - 65535, /* .sendBufferSize, 64k per chunk */ - 65535, /* .recvBufferSize, 64k per chunk */ - 0, /* .maxMessageSize, 0 -> unlimited */ - 0 /* .maxChunkCount, 0 -> unlimited */ -}; - -/***************************/ -/* Default Server Settings */ -/***************************/ - -#define MANUFACTURER_NAME "open62541" -#define PRODUCT_NAME "open62541 OPC UA Server" -#define PRODUCT_URI "http://open62541.org" -#define APPLICATION_NAME "open62541-based OPC UA Application" -#define APPLICATION_URI "urn:unconfigured:application" - -#define STRINGIFY(arg) #arg -#define VERSION(MAJOR, MINOR, PATCH, LABEL) STRINGIFY(MAJOR) "." STRINGIFY(MINOR) "." STRINGIFY(PATCH) LABEL - -static UA_StatusCode createSecurityPolicyNoneEndpoint(UA_ServerConfig *conf, UA_Endpoint *endpoint, - const UA_ByteString localCertificate) { - UA_EndpointDescription_init(&endpoint->endpointDescription); - - UA_SecurityPolicy_None(&endpoint->securityPolicy, localCertificate, conf->logger); - endpoint->endpointDescription.securityMode = UA_MESSAGESECURITYMODE_NONE; - endpoint->endpointDescription.securityPolicyUri = UA_STRING_ALLOC("http://opcfoundation.org/UA/SecurityPolicy#None"); - endpoint->endpointDescription.transportProfileUri = - UA_STRING_ALLOC("http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary"); - - /* enable anonymous and username/password */ - size_t policies = 2; - endpoint->endpointDescription.userIdentityTokens = - (UA_UserTokenPolicy *)UA_Array_new(policies, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]); - if (!endpoint->endpointDescription.userIdentityTokens) return UA_STATUSCODE_BADOUTOFMEMORY; - endpoint->endpointDescription.userIdentityTokensSize = policies; - - endpoint->endpointDescription.userIdentityTokens[0].tokenType = UA_USERTOKENTYPE_ANONYMOUS; - endpoint->endpointDescription.userIdentityTokens[0].policyId = UA_STRING_ALLOC(ANONYMOUS_POLICY); - - endpoint->endpointDescription.userIdentityTokens[1].tokenType = UA_USERTOKENTYPE_USERNAME; - endpoint->endpointDescription.userIdentityTokens[1].policyId = UA_STRING_ALLOC(USERNAME_POLICY); - - UA_String_copy(&localCertificate, &endpoint->endpointDescription.serverCertificate); - - UA_ApplicationDescription_copy(&conf->applicationDescription, &endpoint->endpointDescription.server); - - return UA_STATUSCODE_GOOD; -} - -void UA_ServerConfig_set_customHostname(UA_ServerConfig *config, const UA_String customHostname) { - if (!config) return; - UA_String_deleteMembers(&config->customHostname); - UA_String_copy(&customHostname, &config->customHostname); -} - -UA_ServerConfig *UA_ServerConfig_new_minimal(UA_UInt16 portNumber, const UA_ByteString *certificate) { - UA_ServerConfig *conf = (UA_ServerConfig *)UA_malloc(sizeof(UA_ServerConfig)); - if (!conf) return NULL; - - /* Zero out.. All members have a valid initial value */ - memset(conf, 0, sizeof(UA_ServerConfig)); - - /* --> Start setting the default static config <-- */ - conf->nThreads = 1; - conf->logger = UA_Log_Stdout; - - /* Server Description */ - conf->buildInfo.productUri = UA_STRING_ALLOC(PRODUCT_URI); - conf->buildInfo.manufacturerName = UA_STRING_ALLOC(MANUFACTURER_NAME); - conf->buildInfo.productName = UA_STRING_ALLOC(PRODUCT_NAME); - conf->buildInfo.softwareVersion = UA_STRING_ALLOC( - VERSION(UA_OPEN62541_VER_MAJOR, UA_OPEN62541_VER_MINOR, UA_OPEN62541_VER_PATCH, UA_OPEN62541_VER_LABEL)); - conf->buildInfo.buildNumber = UA_STRING_ALLOC(__DATE__ " " __TIME__); - conf->buildInfo.buildDate = 0; - - conf->applicationDescription.applicationUri = UA_STRING_ALLOC(APPLICATION_URI); - conf->applicationDescription.productUri = UA_STRING_ALLOC(PRODUCT_URI); - conf->applicationDescription.applicationName = UA_LOCALIZEDTEXT_ALLOC("en", APPLICATION_NAME); - conf->applicationDescription.applicationType = UA_APPLICATIONTYPE_SERVER; -/* conf->applicationDescription.gatewayServerUri = UA_STRING_NULL; */ -/* conf->applicationDescription.discoveryProfileUri = UA_STRING_NULL; */ -/* conf->applicationDescription.discoveryUrlsSize = 0; */ -/* conf->applicationDescription.discoveryUrls = NULL; */ - -#ifdef UA_ENABLE_DISCOVERY -/* conf->mdnsServerName = UA_STRING_NULL; */ -/* conf->serverCapabilitiesSize = 0; */ -/* conf->serverCapabilities = NULL; */ -#endif - - /* Custom DataTypes */ - /* conf->customDataTypesSize = 0; */ - /* conf->customDataTypes = NULL; */ - - /* Networking */ - /* conf->networkLayersSize = 0; */ - /* conf->networkLayers = NULL; */ - /* conf->customHostname = UA_STRING_NULL; */ - - /* Endpoints */ - /* conf->endpoints = {0, NULL}; */ - - /* Global Node Lifecycle */ - conf->nodeLifecycle.constructor = NULL; - conf->nodeLifecycle.destructor = NULL; - - /* Access Control */ - conf->accessControl.enableAnonymousLogin = true; - conf->accessControl.enableUsernamePasswordLogin = true; - conf->accessControl.activateSession = activateSession_default; - conf->accessControl.closeSession = closeSession_default; - conf->accessControl.getUserRightsMask = getUserRightsMask_default; - conf->accessControl.getUserAccessLevel = getUserAccessLevel_default; - conf->accessControl.getUserExecutable = getUserExecutable_default; - conf->accessControl.getUserExecutableOnObject = getUserExecutableOnObject_default; - conf->accessControl.allowAddNode = allowAddNode_default; - conf->accessControl.allowAddReference = allowAddReference_default; - conf->accessControl.allowDeleteNode = allowDeleteNode_default; - conf->accessControl.allowDeleteReference = allowDeleteReference_default; - - /* Limits for SecureChannels */ - conf->maxSecureChannels = 40; - conf->maxSecurityTokenLifetime = 10 * 60 * 1000; /* 10 minutes */ - - /* Limits for Sessions */ - conf->maxSessions = 100; - conf->maxSessionTimeout = 60.0 * 60.0 * 1000.0; /* 1h */ - - /* Limits for Subscriptions */ - conf->publishingIntervalLimits = UA_DURATIONRANGE(100.0, 3600.0 * 1000.0); - conf->lifeTimeCountLimits = UA_UINT32RANGE(3, 15000); - conf->keepAliveCountLimits = UA_UINT32RANGE(1, 100); - conf->maxNotificationsPerPublish = 1000; - conf->maxRetransmissionQueueSize = 0; /* unlimited */ - - /* Limits for MonitoredItems */ - conf->samplingIntervalLimits = UA_DURATIONRANGE(50.0, 24.0 * 3600.0 * 1000.0); - conf->queueSizeLimits = UA_UINT32RANGE(1, 100); - -#ifdef UA_ENABLE_DISCOVERY - conf->discoveryCleanupTimeout = 60 * 60; -#endif - - /* --> Finish setting the default static config <-- */ - - UA_StatusCode retval = UA_Nodestore_default_new(&conf->nodestore); - if (retval != UA_STATUSCODE_GOOD) { - UA_ServerConfig_delete(conf); - return NULL; - } - - /* Add a network layer */ - conf->networkLayers = (UA_ServerNetworkLayer *)UA_malloc(sizeof(UA_ServerNetworkLayer)); - if (!conf->networkLayers) { - UA_ServerConfig_delete(conf); - return NULL; - } - conf->networkLayers[0] = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_default, portNumber); - conf->networkLayersSize = 1; - - /* Allocate the endpoint */ - conf->endpointsSize = 1; - conf->endpoints = (UA_Endpoint *)UA_malloc(sizeof(UA_Endpoint)); - if (!conf->endpoints) { - UA_ServerConfig_delete(conf); - return NULL; - } - - /* Populate the endpoint */ - UA_ByteString localCertificate = UA_BYTESTRING_NULL; - if (certificate) localCertificate = *certificate; - retval = createSecurityPolicyNoneEndpoint(conf, &conf->endpoints[0], localCertificate); - if (retval != UA_STATUSCODE_GOOD) { - UA_ServerConfig_delete(conf); - return NULL; - } - - return conf; -} - -void UA_ServerConfig_delete(UA_ServerConfig *config) { - if (!config) return; - - /* Server Description */ - UA_BuildInfo_deleteMembers(&config->buildInfo); - UA_ApplicationDescription_deleteMembers(&config->applicationDescription); -#ifdef UA_ENABLE_DISCOVERY - UA_String_deleteMembers(&config->mdnsServerName); - UA_Array_delete(config->serverCapabilities, config->serverCapabilitiesSize, &UA_TYPES[UA_TYPES_STRING]); - config->serverCapabilities = NULL; - config->serverCapabilitiesSize = 0; -#endif - - /* Nodestore */ - if (config->nodestore.deleteNodestore) config->nodestore.deleteNodestore(config->nodestore.context); - - /* Custom DataTypes */ - for (size_t i = 0; i < config->customDataTypesSize; ++i) UA_free(config->customDataTypes[i].members); - UA_free(config->customDataTypes); - config->customDataTypes = NULL; - config->customDataTypesSize = 0; - - /* Networking */ - for (size_t i = 0; i < config->networkLayersSize; ++i) - config->networkLayers[i].deleteMembers(&config->networkLayers[i]); - UA_free(config->networkLayers); - config->networkLayers = NULL; - config->networkLayersSize = 0; - UA_String_deleteMembers(&config->customHostname); - config->customHostname = UA_STRING_NULL; - - for (size_t i = 0; i < config->endpointsSize; ++i) { - UA_SecurityPolicy *policy = &config->endpoints[i].securityPolicy; - policy->deleteMembers(policy); - UA_EndpointDescription_deleteMembers(&config->endpoints[i].endpointDescription); - } - UA_free(config->endpoints); - config->endpoints = NULL; - config->endpointsSize = 0; - - UA_free(config); -} - -/***************************/ -/* Default Client Settings */ -/***************************/ - -const UA_ClientConfig UA_ClientConfig_default = { - 5000, /* .timeout, 5 seconds */ - 10 * 60 * 1000, /* .secureChannelLifeTime, 10 minutes */ - UA_Log_Stdout, /* .logger */ - /* .localConnectionConfig */ - {0, /* .protocolVersion */ - 65535, /* .sendBufferSize, 64k per chunk */ - 65535, /* .recvBufferSize, 64k per chunk */ - 0, /* .maxMessageSize, 0 -> unlimited */ - 0}, /* .maxChunkCount, 0 -> unlimited */ - UA_ClientConnectionTCP, /* .connectionFunc */ - - 0, /* .customDataTypesSize */ - NULL /*.customDataTypes */ -}; - -/****************************************/ -/* Default Client Subscription Settings */ -/****************************************/ - -#ifdef UA_ENABLE_SUBSCRIPTIONS - -const UA_SubscriptionSettings UA_SubscriptionSettings_default = { - 500.0, /* .requestedPublishingInterval */ - 10000, /* .requestedLifetimeCount */ - 1, /* .requestedMaxKeepAliveCount */ - 0, /* .maxNotificationsPerPublish */ - true, /* .publishingEnabled */ - 0 /* .priority */ -}; - -#endif - -/*********************************** amalgamated original file - * "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_securitypolicy_none.c" - * ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - -static UA_StatusCode verify_none(const UA_SecurityPolicy *securityPolicy, const void *channelContext, - const UA_ByteString *message, const UA_ByteString *signature) { - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode sign_none(const UA_SecurityPolicy *securityPolicy, const void *channelContext, - const UA_ByteString *message, UA_ByteString *signature) { - return UA_STATUSCODE_GOOD; -} - -static size_t length_none(const UA_SecurityPolicy *securityPolicy, const void *channelContext) { return 0; } - -static UA_StatusCode encrypt_none(const UA_SecurityPolicy *securityPolicy, const void *channelContext, - UA_ByteString *data) { - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode decrypt_none(const UA_SecurityPolicy *securityPolicy, const void *channelContext, - UA_ByteString *data) { - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode makeThumbprint_none(const UA_SecurityPolicy *securityPolicy, const UA_ByteString *certificate, - UA_ByteString *thumbprint) { - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode compareThumbprint_none(const UA_SecurityPolicy *securityPolicy, - const UA_ByteString *certificateThumbprint) { - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode generateKey_none(const UA_SecurityPolicy *securityPolicy, const UA_ByteString *secret, - const UA_ByteString *seed, UA_ByteString *out) { - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode generateNonce_none(const UA_SecurityPolicy *securityPolicy, UA_ByteString *out) { - if (securityPolicy == NULL || out == NULL) return UA_STATUSCODE_BADINTERNALERROR; - if (out->length != 0) return UA_STATUSCODE_BADINTERNALERROR; - - if (out->data != NULL) UA_ByteString_deleteMembers(out); - - out->data = (UA_Byte *)UA_EMPTY_ARRAY_SENTINEL; - return UA_STATUSCODE_GOOD; -} - -static UA_StatusCode newContext_none(const UA_SecurityPolicy *securityPolicy, const UA_ByteString *remoteCertificate, - void **channelContext) { - return UA_STATUSCODE_GOOD; -} - -static void deleteContext_none(void *channelContext) {} - -static UA_StatusCode setContextValue_none(void *channelContext, const UA_ByteString *key) { return UA_STATUSCODE_GOOD; } - -static size_t getRemoteAsymPlainTextBlockSize_none(const void *channelContext) { return 0; } - -static size_t getRemoteAsymEncryptionBufferLengthOverhead_none(const void *channelContext, size_t maxEncryptionLength) { - return 0; -} - -static UA_StatusCode compareCertificate_none(const void *channelContext, const UA_ByteString *certificate) { - return UA_STATUSCODE_GOOD; -} - -static void policy_deletemembers_none(UA_SecurityPolicy *policy) { - UA_ByteString_deleteMembers(&policy->localCertificate); -} - -UA_StatusCode UA_SecurityPolicy_None(UA_SecurityPolicy *policy, const UA_ByteString localCertificate, - UA_Logger logger) { - policy->policyContext = (void *)(uintptr_t)logger; - policy->policyUri = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None"); - policy->logger = logger; - UA_ByteString_copy(&localCertificate, &policy->localCertificate); - - policy->asymmetricModule.makeCertificateThumbprint = makeThumbprint_none; - policy->asymmetricModule.compareCertificateThumbprint = compareThumbprint_none; - policy->asymmetricModule.cryptoModule.signatureAlgorithmUri = UA_STRING_NULL; - policy->asymmetricModule.cryptoModule.verify = verify_none; - policy->asymmetricModule.cryptoModule.sign = sign_none; - policy->asymmetricModule.cryptoModule.getLocalSignatureSize = length_none; - policy->asymmetricModule.cryptoModule.getRemoteSignatureSize = length_none; - policy->asymmetricModule.cryptoModule.encrypt = encrypt_none; - policy->asymmetricModule.cryptoModule.decrypt = decrypt_none; - policy->asymmetricModule.cryptoModule.getLocalEncryptionKeyLength = length_none; - policy->asymmetricModule.cryptoModule.getRemoteEncryptionKeyLength = length_none; - - policy->symmetricModule.generateKey = generateKey_none; - policy->symmetricModule.generateNonce = generateNonce_none; - policy->symmetricModule.cryptoModule.signatureAlgorithmUri = UA_STRING_NULL; - policy->symmetricModule.cryptoModule.verify = verify_none; - policy->symmetricModule.cryptoModule.sign = sign_none; - policy->symmetricModule.cryptoModule.getLocalSignatureSize = length_none; - policy->symmetricModule.cryptoModule.getRemoteSignatureSize = length_none; - policy->symmetricModule.cryptoModule.encrypt = encrypt_none; - policy->symmetricModule.cryptoModule.decrypt = decrypt_none; - policy->symmetricModule.cryptoModule.getLocalEncryptionKeyLength = length_none; - policy->symmetricModule.cryptoModule.getRemoteEncryptionKeyLength = length_none; - policy->symmetricModule.encryptionBlockSize = 0; - policy->symmetricModule.signingKeyLength = 0; - - policy->channelModule.newContext = newContext_none; - policy->channelModule.deleteContext = deleteContext_none; - policy->channelModule.setLocalSymEncryptingKey = setContextValue_none; - policy->channelModule.setLocalSymSigningKey = setContextValue_none; - policy->channelModule.setLocalSymIv = setContextValue_none; - policy->channelModule.setRemoteSymEncryptingKey = setContextValue_none; - policy->channelModule.setRemoteSymSigningKey = setContextValue_none; - policy->channelModule.setRemoteSymIv = setContextValue_none; - policy->channelModule.compareCertificate = compareCertificate_none; - policy->channelModule.getRemoteAsymPlainTextBlockSize = getRemoteAsymPlainTextBlockSize_none; - policy->channelModule.getRemoteAsymEncryptionBufferLengthOverhead = getRemoteAsymEncryptionBufferLengthOverhead_none; - policy->deleteMembers = policy_deletemembers_none; - - return UA_STATUSCODE_GOOD; -} diff --git a/third_party/open62541/open62541.h b/third_party/open62541/open62541.h deleted file mode 100644 index a6af92da38..0000000000 --- a/third_party/open62541/open62541.h +++ /dev/null @@ -1,14536 +0,0 @@ -/* THIS IS A SINGLE-FILE DISTRIBUTION CONCATENATED FROM THE OPEN62541 SOURCES - * visit http://open62541.org/ for information about this software - * Git-Revision: undefined - */ - -/* - * Copyright (C) 2014-2016 the contributors as stated in the AUTHORS file - * - * This file is part of open62541. open62541 is free software: you can - * redistribute it and/or modify it under the terms of the Mozilla Public - * License v2.0 as stated in the LICENSE file provided with open62541. - * - * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. - */ - -#ifndef OPEN62541_H_ -#define OPEN62541_H_ - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_config.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * open62541 Version - * ----------------- */ -#define UA_OPEN62541_VER_MAJOR 0 -#define UA_OPEN62541_VER_MINOR 3 -#define UA_OPEN62541_VER_PATCH 0 -#define UA_OPEN62541_VER_LABEL "dev" /* Release candidate label, etc. */ -#define UA_OPEN62541_VER_COMMIT "undefined" - -/** - * Feature Options - * --------------- - * Changing the feature options has no effect on a pre-compiled library. */ -#define UA_LOGLEVEL 300 -#define UA_ENABLE_METHODCALLS -#define UA_ENABLE_NODEMANAGEMENT -#define UA_ENABLE_SUBSCRIPTIONS -/* #undef UA_ENABLE_MULTITHREADING */ - -/* Advanced Options */ -#define UA_ENABLE_STATUSCODE_DESCRIPTIONS -#define UA_ENABLE_TYPENAMES -/* #undef UA_ENABLE_DETERMINISTIC_RNG */ -/* #undef UA_ENABLE_GENERATE_NAMESPACE0 */ -/* #undef UA_ENABLE_NONSTANDARD_UDP */ -#define UA_ENABLE_DISCOVERY -/* #undef UA_ENABLE_DISCOVERY_MULTICAST */ -#define UA_ENABLE_DISCOVERY_SEMAPHORE -/* #undef UA_ENABLE_UNIT_TEST_FAILURE_HOOKS */ - -/* Options for Debugging */ -#define UA_DEBUG -/* #undef UA_DEBUG_DUMP_PKGS */ - -/** - * C99 Definitions - * --------------- */ -#include -#include - -/* Include stdint.h and stdbool.h or workaround for older Visual Studios */ -#if !defined(_MSC_VER) || _MSC_VER >= 1600 -# include -# include /* C99 Boolean */ -# if defined(_WRS_KERNEL) -# define UINT32_C(x) ((x) + (UINT32_MAX - UINT32_MAX)) -# endif -#else -# if !defined(__bool_true_false_are_defined) -# define bool short -# define true 1 -# define false 0 -# define __bool_true_false_are_defined -# endif -#endif - -/** - * Assertions - * ---------- - * The assert macro is disabled by defining NDEBUG. It is often forgotten to - * include -DNDEBUG in the compiler flags when using the single-file release. So - * we make assertions dependent on the UA_DEBUG definition handled by CMake. */ -#ifdef UA_DEBUG -# include -# define UA_assert(ignore) assert(ignore) -#else -# define UA_assert(ignore) -#endif - -/* Outputs an error message at compile time if the assert fails. - * Example usage: - * UA_STATIC_ASSERT(sizeof(long)==7, use_another_compiler_luke) - * See: https://stackoverflow.com/a/4815532/869402 */ -#if defined(__cplusplus) && __cplusplus >= 201103L /* C++11 or above */ -# define UA_STATIC_ASSERT(cond,msg) static_assert(cond, #msg) -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L /* C11 or above */ -# define UA_STATIC_ASSERT(cond,msg) _Static_assert(cond, #msg) -#elif defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER) /* GCC, Clang, MSC */ -# define UA_CTASTR2(pre,post) pre ## post -# define UA_CTASTR(pre,post) UA_CTASTR2(pre,post) -# define UA_STATIC_ASSERT(cond,msg) \ - typedef struct { \ - int UA_CTASTR(static_assertion_failed_,msg) : !!(cond); \ - } UA_CTASTR(static_assertion_failed_,__COUNTER__) -#else /* Everybody else */ -# define UA_STATIC_ASSERT(cond,msg) typedef char static_assertion_##msg[(cond)?1:-1] -#endif - -/** - * Memory Management - * ----------------- - * The default is to use the malloc implementation from ``stdlib.h``. Override - * if required. Changing the settings has no effect on a pre-compiled - * library. */ -#include -#if defined(_WIN32) && !defined(__clang__) -# include -#endif - -#define UA_free(ptr) free(ptr) -#define UA_malloc(size) malloc(size) -#define UA_calloc(num, size) calloc(num, size) -#define UA_realloc(ptr, size) realloc(ptr, size) - -#if defined(__GNUC__) || defined(__clang__) -# define UA_alloca(size) __builtin_alloca (size) -#elif defined(_WIN32) -# define UA_alloca(SIZE) _alloca(SIZE) -#else -# include -# define UA_alloca(SIZE) alloca(SIZE) -#endif - -/** - * Function Export - * --------------- - * On Win32: Define ``UA_DYNAMIC_LINKING`` and ``UA_DYNAMIC_LINKING_EXPORT`` in - * order to export symbols for a DLL. Define ``UA_DYNAMIC_LINKING`` only to - * import symbols from a DLL.*/ -/* #undef UA_DYNAMIC_LINKING */ - -#if defined(_WIN32) && defined(UA_DYNAMIC_LINKING) -# ifdef UA_DYNAMIC_LINKING_EXPORT /* export dll */ -# ifdef __GNUC__ -# define UA_EXPORT __attribute__ ((dllexport)) -# else -# define UA_EXPORT __declspec(dllexport) -# endif -# else /* import dll */ -# ifdef __GNUC__ -# define UA_EXPORT __attribute__ ((dllimport)) -# else -# define UA_EXPORT __declspec(dllimport) -# endif -# endif -#else /* non win32 */ -# if __GNUC__ || __clang__ -# define UA_EXPORT __attribute__ ((visibility ("default"))) -# endif -#endif -#ifndef UA_EXPORT -# define UA_EXPORT /* fallback to default */ -#endif - -/** - * Inline Functions - * ---------------- */ -#ifdef _MSC_VER -# define UA_INLINE __inline -#else -# define UA_INLINE inline -#endif - -/** - * Non-aliasing pointers - * -------------------- */ -#ifdef _MSC_VER -# define UA_RESTRICT __restrict -#elif defined(__GNUC__) -# define UA_RESTRICT __restrict__ -#else -# define UA_RESTRICT restrict -#endif - -/** - * Function attributes - * ------------------- */ -#if defined(__GNUC__) || defined(__clang__) -# define UA_FUNC_ATTR_MALLOC __attribute__((malloc)) -# define UA_FUNC_ATTR_PURE __attribute__ ((pure)) -# define UA_FUNC_ATTR_CONST __attribute__((const)) -# define UA_FUNC_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -# define UA_FORMAT(X,Y) __attribute__ ((format (printf, X, Y))) -#else -# define UA_FUNC_ATTR_MALLOC -# define UA_FUNC_ATTR_PURE -# define UA_FUNC_ATTR_CONST -# define UA_FUNC_ATTR_WARN_UNUSED_RESULT -# define UA_FORMAT(X,Y) -#endif - -#if defined(__GNUC__) || defined(__clang__) -# define UA_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) -# define UA_DEPRECATED __declspec(deprecated) -#else -# define UA_DEPRECATED -#endif - -/** - * Detect Binary Overlaying for Encoding - * ------------------------------------- - * Integers and floating point numbers are transmitted in little-endian (IEEE 754 - * for floating point) encoding. If the target architecture uses the same - * format, numeral datatypes can be memcpy'd (overlayed) on the binary stream. - * This speeds up encoding. - * - * Integer Endianness - * ^^^^^^^^^^^^^^^^^^ - * The definition ``UA_BINARY_OVERLAYABLE_INTEGER`` is true when the integer - * representation of the target architecture is little-endian. */ -#if defined(_WIN32) -# define UA_BINARY_OVERLAYABLE_INTEGER 1 -#elif (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ - (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) -# define UA_BINARY_OVERLAYABLE_INTEGER 1 -#elif defined(__linux__) /* Linux (including Android) */ -# include -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define UA_BINARY_OVERLAYABLE_INTEGER 1 -# endif -#elif defined(__OpenBSD__) /* OpenBSD */ -# include -# if BYTE_ORDER == LITTLE_ENDIAN -# define UA_BINARY_OVERLAYABLE_INTEGER 1 -# endif -#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) /* Other BSD */ -# include -# if _BYTE_ORDER == _LITTLE_ENDIAN -# define UA_BINARY_OVERLAYABLE_INTEGER 1 -# endif -#elif defined(__APPLE__) /* Apple (MacOS, iOS) */ -# include -# if defined(__LITTLE_ENDIAN__) -# define UA_BINARY_OVERLAYABLE_INTEGER 1 -# endif -#elif defined(__QNX__) || defined(__QNXNTO__) /* QNX */ -# include -# if defined(__LITTLEENDIAN__) -# define UA_BINARY_OVERLAYABLE_INTEGER 1 -# endif -#endif - -#ifndef UA_BINARY_OVERLAYABLE_INTEGER -# define UA_BINARY_OVERLAYABLE_INTEGER 0 -#endif - -/** - * Float Endianness - * ^^^^^^^^^^^^^^^^ - * The definition ``UA_BINARY_OVERLAYABLE_FLOAT`` is true when the floating - * point number representation of the target architecture is IEEE 754. Note that - * this cannot be reliable detected with macros for the clang compiler - * (beginning of 2017). Just override if necessary. */ -#if defined(_WIN32) -# define UA_BINARY_OVERLAYABLE_FLOAT 1 -#elif defined(__FLOAT_WORD_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ - (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__) /* Defined only in GCC */ -# define UA_BINARY_OVERLAYABLE_FLOAT 1 -#elif defined(__FLOAT_WORD_ORDER) && defined(__LITTLE_ENDIAN) && \ - (__FLOAT_WORD_ORDER == __LITTLE_ENDIAN) /* Defined only in GCC */ -# define UA_BINARY_OVERLAYABLE_FLOAT 1 -#elif defined(__linux__) /* Linux (including Android) */ -# include -# if __FLOAT_WORD_ORDER == __LITTLE_ENDIAN -# define UA_BINARY_OVERLAYABLE_FLOAT 1 -# endif -#elif defined(_WRS_KERNEL) -# define UA_BINARY_OVERLAYABLE_FLOAT 1 -#endif - -#ifndef UA_BINARY_OVERLAYABLE_FLOAT -# define UA_BINARY_OVERLAYABLE_FLOAT 0 -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/deps/ms_stdint.h" ***********************************/ - -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2013 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the product nor the names of its contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#if !defined(_MSC_VER) || _MSC_VER >= 1600 // [ -#include -#else - - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifndef UNDER_CE -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -// These #ifndef's are needed to prevent collisions with . -// Check out Issue 9 for the details. -#ifndef INTMAX_C // [ -# define INTMAX_C INT64_C -#endif // INTMAX_C ] -#ifndef UINTMAX_C // [ -# define UINTMAX_C UINT64_C -#endif // UINTMAX_C ] - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // !defined(_MSC_VER) || _MSC_VER >= 1600 ] - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_constants.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Standard-Defined Constants - * ========================== - * This section contains numerical and string constants that are defined in the - * OPC UA standard. - * - * .. _attribute-id: - * - * Attribute Id - * ------------ - * Every node in an OPC UA information model contains attributes depending on - * the node type. Possible attributes are as follows: */ - -typedef enum { - UA_ATTRIBUTEID_NODEID = 1, - UA_ATTRIBUTEID_NODECLASS = 2, - UA_ATTRIBUTEID_BROWSENAME = 3, - UA_ATTRIBUTEID_DISPLAYNAME = 4, - UA_ATTRIBUTEID_DESCRIPTION = 5, - UA_ATTRIBUTEID_WRITEMASK = 6, - UA_ATTRIBUTEID_USERWRITEMASK = 7, - UA_ATTRIBUTEID_ISABSTRACT = 8, - UA_ATTRIBUTEID_SYMMETRIC = 9, - UA_ATTRIBUTEID_INVERSENAME = 10, - UA_ATTRIBUTEID_CONTAINSNOLOOPS = 11, - UA_ATTRIBUTEID_EVENTNOTIFIER = 12, - UA_ATTRIBUTEID_VALUE = 13, - UA_ATTRIBUTEID_DATATYPE = 14, - UA_ATTRIBUTEID_VALUERANK = 15, - UA_ATTRIBUTEID_ARRAYDIMENSIONS = 16, - UA_ATTRIBUTEID_ACCESSLEVEL = 17, - UA_ATTRIBUTEID_USERACCESSLEVEL = 18, - UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL = 19, - UA_ATTRIBUTEID_HISTORIZING = 20, - UA_ATTRIBUTEID_EXECUTABLE = 21, - UA_ATTRIBUTEID_USEREXECUTABLE = 22 -} UA_AttributeId; - -/** - * Access Level Masks - * ------------------ - * The access level to a node is given by the following constants that are ANDed - * with the overall access level. */ - -#define UA_ACCESSLEVELMASK_READ (0x01<<0) -#define UA_ACCESSLEVELMASK_WRITE (0x01<<1) -#define UA_ACCESSLEVELMASK_HISTORYREAD (0x01<<2) -#define UA_ACCESSLEVELMASK_HISTORYWRITE (0x01<<3) -#define UA_ACCESSLEVELMASK_SEMANTICCHANGE (0x01<<4) -#define UA_ACCESSLEVELMASK_STATUSWRITE (0x01<<5) -#define UA_ACCESSLEVELMASK_TIMESTAMPWRITE (0x01<<6) - -/** - * Write Masks - * ----------- - * The write mask and user write mask is given by the following constants that - * are ANDed for the overall write mask. Part 3: 5.2.7 Table 2 */ - -#define UA_WRITEMASK_ACCESSLEVEL (0x01<<0) -#define UA_WRITEMASK_ARRRAYDIMENSIONS (0x01<<1) -#define UA_WRITEMASK_BROWSENAME (0x01<<2) -#define UA_WRITEMASK_CONTAINSNOLOOPS (0x01<<3) -#define UA_WRITEMASK_DATATYPE (0x01<<4) -#define UA_WRITEMASK_DESCRIPTION (0x01<<5) -#define UA_WRITEMASK_DISPLAYNAME (0x01<<6) -#define UA_WRITEMASK_EVENTNOTIFIER (0x01<<7) -#define UA_WRITEMASK_EXECUTABLE (0x01<<8) -#define UA_WRITEMASK_HISTORIZING (0x01<<9) -#define UA_WRITEMASK_INVERSENAME (0x01<<10) -#define UA_WRITEMASK_ISABSTRACT (0x01<<11) -#define UA_WRITEMASK_MINIMUMSAMPLINGINTERVAL (0x01<<12) -#define UA_WRITEMASK_NODECLASS (0x01<<13) -#define UA_WRITEMASK_NODEID (0x01<<14) -#define UA_WRITEMASK_SYMMETRIC (0x01<<15) -#define UA_WRITEMASK_USERACCESSLEVEL (0x01<<16) -#define UA_WRITEMASK_USEREXECUTABLE (0x01<<17) -#define UA_WRITEMASK_USERWRITEMASK (0x01<<18) -#define UA_WRITEMASK_VALUERANK (0x01<<19) -#define UA_WRITEMASK_WRITEMASK (0x01<<20) -#define UA_WRITEMASK_VALUEFORVARIABLETYPE (0x01<<21) - -/** - * .. _statuscodes: - * - * StatusCodes - * ----------- - * StatusCodes are extensively used in the OPC UA protocol and in the open62541 - * API. They are represented by the :ref:`statuscode` data type. The following - * definitions are autogenerated from the ``Opc.Ua.StatusCodes.csv`` file provided - * with the OPC UA standard. */ - -#define UA_STATUSCODE_GOOD 0x00 -#define UA_STATUSCODE_BADUNEXPECTEDERROR 0x80010000 // An unexpected error occurred. -#define UA_STATUSCODE_BADINTERNALERROR 0x80020000 // An internal error occurred as a result of a programming or configuration error. -#define UA_STATUSCODE_BADOUTOFMEMORY 0x80030000 // Not enough memory to complete the operation. -#define UA_STATUSCODE_BADRESOURCEUNAVAILABLE 0x80040000 // An operating system resource is not available. -#define UA_STATUSCODE_BADCOMMUNICATIONERROR 0x80050000 // A low level communication error occurred. -#define UA_STATUSCODE_BADENCODINGERROR 0x80060000 // Encoding halted because of invalid data in the objects being serialized. -#define UA_STATUSCODE_BADDECODINGERROR 0x80070000 // Decoding halted because of invalid data in the stream. -#define UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED 0x80080000 // The message encoding/decoding limits imposed by the stack have been exceeded. -#define UA_STATUSCODE_BADREQUESTTOOLARGE 0x80b80000 // The request message size exceeds limits set by the server. -#define UA_STATUSCODE_BADRESPONSETOOLARGE 0x80b90000 // The response message size exceeds limits set by the client. -#define UA_STATUSCODE_BADUNKNOWNRESPONSE 0x80090000 // An unrecognized response was received from the server. -#define UA_STATUSCODE_BADTIMEOUT 0x800a0000 // The operation timed out. -#define UA_STATUSCODE_BADSERVICEUNSUPPORTED 0x800b0000 // The server does not support the requested service. -#define UA_STATUSCODE_BADSHUTDOWN 0x800c0000 // The operation was cancelled because the application is shutting down. -#define UA_STATUSCODE_BADSERVERNOTCONNECTED 0x800d0000 // The operation could not complete because the client is not connected to the server. -#define UA_STATUSCODE_BADSERVERHALTED 0x800e0000 // The server has stopped and cannot process any requests. -#define UA_STATUSCODE_BADNOTHINGTODO 0x800f0000 // There was nothing to do because the client passed a list of operations with no elements. -#define UA_STATUSCODE_BADTOOMANYOPERATIONS 0x80100000 // The request could not be processed because it specified too many operations. -#define UA_STATUSCODE_BADTOOMANYMONITOREDITEMS 0x80db0000 // The request could not be processed because there are too many monitored items in the subscription. -#define UA_STATUSCODE_BADDATATYPEIDUNKNOWN 0x80110000 // The extension object cannot be (de)serialized because the data type id is not recognized. -#define UA_STATUSCODE_BADCERTIFICATEINVALID 0x80120000 // The certificate provided as a parameter is not valid. -#define UA_STATUSCODE_BADSECURITYCHECKSFAILED 0x80130000 // An error occurred verifying security. -#define UA_STATUSCODE_BADCERTIFICATETIMEINVALID 0x80140000 // The Certificate has expired or is not yet valid. -#define UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID 0x80150000 // An Issuer Certificate has expired or is not yet valid. -#define UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID 0x80160000 // The HostName used to connect to a Server does not match a HostName in the Certificate. -#define UA_STATUSCODE_BADCERTIFICATEURIINVALID 0x80170000 // The URI specified in the ApplicationDescription does not match the URI in the Certificate. -#define UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED 0x80180000 // The Certificate may not be used for the requested operation. -#define UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED 0x80190000 // The Issuer Certificate may not be used for the requested operation. -#define UA_STATUSCODE_BADCERTIFICATEUNTRUSTED 0x801a0000 // The Certificate is not trusted. -#define UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN 0x801b0000 // It was not possible to determine if the Certificate has been revoked. -#define UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN 0x801c0000 // It was not possible to determine if the Issuer Certificate has been revoked. -#define UA_STATUSCODE_BADCERTIFICATEREVOKED 0x801d0000 // The certificate has been revoked. -#define UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED 0x801e0000 // The issuer certificate has been revoked. -#define UA_STATUSCODE_BADCERTIFICATECHAININCOMPLETE 0x810d0000 // The certificate chain is incomplete. -#define UA_STATUSCODE_BADUSERACCESSDENIED 0x801f0000 // User does not have permission to perform the requested operation. -#define UA_STATUSCODE_BADIDENTITYTOKENINVALID 0x80200000 // The user identity token is not valid. -#define UA_STATUSCODE_BADIDENTITYTOKENREJECTED 0x80210000 // The user identity token is valid but the server has rejected it. -#define UA_STATUSCODE_BADSECURECHANNELIDINVALID 0x80220000 // The specified secure channel is no longer valid. -#define UA_STATUSCODE_BADINVALIDTIMESTAMP 0x80230000 // The timestamp is outside the range allowed by the server. -#define UA_STATUSCODE_BADNONCEINVALID 0x80240000 // The nonce does appear to be not a random value or it is not the correct length. -#define UA_STATUSCODE_BADSESSIONIDINVALID 0x80250000 // The session id is not valid. -#define UA_STATUSCODE_BADSESSIONCLOSED 0x80260000 // The session was closed by the client. -#define UA_STATUSCODE_BADSESSIONNOTACTIVATED 0x80270000 // The session cannot be used because ActivateSession has not been called. -#define UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID 0x80280000 // The subscription id is not valid. -#define UA_STATUSCODE_BADREQUESTHEADERINVALID 0x802a0000 // The header for the request is missing or invalid. -#define UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID 0x802b0000 // The timestamps to return parameter is invalid. -#define UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT 0x802c0000 // The request was cancelled by the client. -#define UA_STATUSCODE_BADTOOMANYARGUMENTS 0x80e50000 // Too many arguments were provided. -#define UA_STATUSCODE_BADLICENSEEXPIRED 0x810E0000 // The server requires a license to operate in general or to perform a service or operation, but existing license is expired. -#define UA_STATUSCODE_BADLICENSELIMITSEXCEEDED 0x810F0000 // The server has limits on number of allowed operations / objects, based on installed licenses, and these limits where exceeded. -#define UA_STATUSCODE_BADLICENSENOTAVAILABLE 0x81100000 // The server does not have a license which is required to operate in general or to perform a service or operation. -#define UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED 0x002d0000 // The subscription was transferred to another session. -#define UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY 0x002e0000 // The processing will complete asynchronously. -#define UA_STATUSCODE_GOODOVERLOAD 0x002f0000 // Sampling has slowed down due to resource limitations. -#define UA_STATUSCODE_GOODCLAMPED 0x00300000 // The value written was accepted but was clamped. -#define UA_STATUSCODE_BADNOCOMMUNICATION 0x80310000 // Communication with the data source is defined -#define UA_STATUSCODE_BADWAITINGFORINITIALDATA 0x80320000 // Waiting for the server to obtain values from the underlying data source. -#define UA_STATUSCODE_BADNODEIDINVALID 0x80330000 // The syntax of the node id is not valid. -#define UA_STATUSCODE_BADNODEIDUNKNOWN 0x80340000 // The node id refers to a node that does not exist in the server address space. -#define UA_STATUSCODE_BADATTRIBUTEIDINVALID 0x80350000 // The attribute is not supported for the specified Node. -#define UA_STATUSCODE_BADINDEXRANGEINVALID 0x80360000 // The syntax of the index range parameter is invalid. -#define UA_STATUSCODE_BADINDEXRANGENODATA 0x80370000 // No data exists within the range of indexes specified. -#define UA_STATUSCODE_BADDATAENCODINGINVALID 0x80380000 // The data encoding is invalid. -#define UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED 0x80390000 // The server does not support the requested data encoding for the node. -#define UA_STATUSCODE_BADNOTREADABLE 0x803a0000 // The access level does not allow reading or subscribing to the Node. -#define UA_STATUSCODE_BADNOTWRITABLE 0x803b0000 // The access level does not allow writing to the Node. -#define UA_STATUSCODE_BADOUTOFRANGE 0x803c0000 // The value was out of range. -#define UA_STATUSCODE_BADNOTSUPPORTED 0x803d0000 // The requested operation is not supported. -#define UA_STATUSCODE_BADNOTFOUND 0x803e0000 // A requested item was not found or a search operation ended without success. -#define UA_STATUSCODE_BADOBJECTDELETED 0x803f0000 // The object cannot be used because it has been deleted. -#define UA_STATUSCODE_BADNOTIMPLEMENTED 0x80400000 // Requested operation is not implemented. -#define UA_STATUSCODE_BADMONITORINGMODEINVALID 0x80410000 // The monitoring mode is invalid. -#define UA_STATUSCODE_BADMONITOREDITEMIDINVALID 0x80420000 // The monitoring item id does not refer to a valid monitored item. -#define UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID 0x80430000 // The monitored item filter parameter is not valid. -#define UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED 0x80440000 // The server does not support the requested monitored item filter. -#define UA_STATUSCODE_BADFILTERNOTALLOWED 0x80450000 // A monitoring filter cannot be used in combination with the attribute specified. -#define UA_STATUSCODE_BADSTRUCTUREMISSING 0x80460000 // A mandatory structured parameter was missing or null. -#define UA_STATUSCODE_BADEVENTFILTERINVALID 0x80470000 // The event filter is not valid. -#define UA_STATUSCODE_BADCONTENTFILTERINVALID 0x80480000 // The content filter is not valid. -#define UA_STATUSCODE_BADFILTEROPERATORINVALID 0x80c10000 // An unregognized operator was provided in a filter. -#define UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED 0x80c20000 // A valid operator was provided -#define UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH 0x80c30000 // The number of operands provided for the filter operator was less then expected for the operand provided. -#define UA_STATUSCODE_BADFILTEROPERANDINVALID 0x80490000 // The operand used in a content filter is not valid. -#define UA_STATUSCODE_BADFILTERELEMENTINVALID 0x80c40000 // The referenced element is not a valid element in the content filter. -#define UA_STATUSCODE_BADFILTERLITERALINVALID 0x80c50000 // The referenced literal is not a valid value. -#define UA_STATUSCODE_BADCONTINUATIONPOINTINVALID 0x804a0000 // The continuation point provide is longer valid. -#define UA_STATUSCODE_BADNOCONTINUATIONPOINTS 0x804b0000 // The operation could not be processed because all continuation points have been allocated. -#define UA_STATUSCODE_BADREFERENCETYPEIDINVALID 0x804c0000 // The operation could not be processed because all continuation points have been allocated. -#define UA_STATUSCODE_BADBROWSEDIRECTIONINVALID 0x804d0000 // The browse direction is not valid. -#define UA_STATUSCODE_BADNODENOTINVIEW 0x804e0000 // The node is not part of the view. -#define UA_STATUSCODE_BADSERVERURIINVALID 0x804f0000 // The ServerUri is not a valid URI. -#define UA_STATUSCODE_BADSERVERNAMEMISSING 0x80500000 // No ServerName was specified. -#define UA_STATUSCODE_BADDISCOVERYURLMISSING 0x80510000 // No DiscoveryUrl was specified. -#define UA_STATUSCODE_BADSEMPAHOREFILEMISSING 0x80520000 // The semaphore file specified by the client is not valid. -#define UA_STATUSCODE_BADREQUESTTYPEINVALID 0x80530000 // The security token request type is not valid. -#define UA_STATUSCODE_BADSECURITYMODEREJECTED 0x80540000 // The security mode does not meet the requirements set by the Server. -#define UA_STATUSCODE_BADSECURITYPOLICYREJECTED 0x80550000 // The security policy does not meet the requirements set by the Server. -#define UA_STATUSCODE_BADTOOMANYSESSIONS 0x80560000 // The server has reached its maximum number of sessions. -#define UA_STATUSCODE_BADUSERSIGNATUREINVALID 0x80570000 // The user token signature is missing or invalid. -#define UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID 0x80580000 // The signature generated with the client certificate is missing or invalid. -#define UA_STATUSCODE_BADNOVALIDCERTIFICATES 0x80590000 // The client did not provide at least one software certificate that is valid and meets the profile requirements for the server. -#define UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED 0x80c60000 // The Server does not support changing the user identity assigned to the session. -#define UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST 0x805a0000 // The request was cancelled by the client with the Cancel service. -#define UA_STATUSCODE_BADPARENTNODEIDINVALID 0x805b0000 // The parent node id does not to refer to a valid node. -#define UA_STATUSCODE_BADREFERENCENOTALLOWED 0x805c0000 // The reference could not be created because it violates constraints imposed by the data model. -#define UA_STATUSCODE_BADNODEIDREJECTED 0x805d0000 // The requested node id was reject because it was either invalid or server does not allow node ids to be specified by the client. -#define UA_STATUSCODE_BADNODEIDEXISTS 0x805e0000 // The requested node id is already used by another node. -#define UA_STATUSCODE_BADNODECLASSINVALID 0x805f0000 // The node class is not valid. -#define UA_STATUSCODE_BADBROWSENAMEINVALID 0x80600000 // The browse name is invalid. -#define UA_STATUSCODE_BADBROWSENAMEDUPLICATED 0x80610000 // The browse name is not unique among nodes that share the same relationship with the parent. -#define UA_STATUSCODE_BADNODEATTRIBUTESINVALID 0x80620000 // The node attributes are not valid for the node class. -#define UA_STATUSCODE_BADTYPEDEFINITIONINVALID 0x80630000 // The type definition node id does not reference an appropriate type node. -#define UA_STATUSCODE_BADSOURCENODEIDINVALID 0x80640000 // The source node id does not reference a valid node. -#define UA_STATUSCODE_BADTARGETNODEIDINVALID 0x80650000 // The target node id does not reference a valid node. -#define UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED 0x80660000 // The reference type between the nodes is already defined. -#define UA_STATUSCODE_BADINVALIDSELFREFERENCE 0x80670000 // The server does not allow this type of self reference on this node. -#define UA_STATUSCODE_BADREFERENCELOCALONLY 0x80680000 // The reference type is not valid for a reference to a remote server. -#define UA_STATUSCODE_BADNODELETERIGHTS 0x80690000 // The server will not allow the node to be deleted. -#define UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED 0x40bc0000 // The server was not able to delete all target references. -#define UA_STATUSCODE_BADSERVERINDEXINVALID 0x806a0000 // The server index is not valid. -#define UA_STATUSCODE_BADVIEWIDUNKNOWN 0x806b0000 // The view id does not refer to a valid view node. -#define UA_STATUSCODE_BADVIEWTIMESTAMPINVALID 0x80c90000 // The view timestamp is not available or not supported. -#define UA_STATUSCODE_BADVIEWPARAMETERMISMATCH 0x80ca0000 // The view parameters are not consistent with each other. -#define UA_STATUSCODE_BADVIEWVERSIONINVALID 0x80cb0000 // The view version is not available or not supported. -#define UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE 0x40c00000 // The list of references may not be complete because the underlying system is not available. -#define UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE 0x00ba0000 // The server should have followed a reference to a node in a remote server but did not. The result set may be incomplete. -#define UA_STATUSCODE_BADNOTTYPEDEFINITION 0x80c80000 // The provided Nodeid was not a type definition nodeid. -#define UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER 0x406c0000 // One of the references to follow in the relative path references to a node in the address space in another server. -#define UA_STATUSCODE_BADTOOMANYMATCHES 0x806d0000 // The requested operation has too many matches to return. -#define UA_STATUSCODE_BADQUERYTOOCOMPLEX 0x806e0000 // The requested operation requires too many resources in the server. -#define UA_STATUSCODE_BADNOMATCH 0x806f0000 // The requested operation has no match to return. -#define UA_STATUSCODE_BADMAXAGEINVALID 0x80700000 // The max age parameter is invalid. -#define UA_STATUSCODE_BADSECURITYMODEINSUFFICIENT 0x80e60000 // The operation is not permitted over the current secure channel. -#define UA_STATUSCODE_BADHISTORYOPERATIONINVALID 0x80710000 // The history details parameter is not valid. -#define UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED 0x80720000 // The server does not support the requested operation. -#define UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT 0x80bd0000 // The defined timestamp to return was invalid. -#define UA_STATUSCODE_BADWRITENOTSUPPORTED 0x80730000 // The server not does support writing the combination of value -#define UA_STATUSCODE_BADTYPEMISMATCH 0x80740000 // The value supplied for the attribute is not of the same type as the attribute's value. -#define UA_STATUSCODE_BADMETHODINVALID 0x80750000 // The method id does not refer to a method for the specified object. -#define UA_STATUSCODE_BADARGUMENTSMISSING 0x80760000 // The client did not specify all of the input arguments for the method. -#define UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS 0x80770000 // The server has reached its maximum number of subscriptions. -#define UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS 0x80780000 // The server has reached the maximum number of queued publish requests. -#define UA_STATUSCODE_BADNOSUBSCRIPTION 0x80790000 // There is no subscription available for this session. -#define UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN 0x807a0000 // The sequence number is unknown to the server. -#define UA_STATUSCODE_BADMESSAGENOTAVAILABLE 0x807b0000 // The requested notification message is no longer available. -#define UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE 0x807c0000 // The Client of the current Session does not support one or more Profiles that are necessary for the Subscription. -#define UA_STATUSCODE_BADSTATENOTACTIVE 0x80bf0000 // The sub-state machine is not currently active. -#define UA_STATUSCODE_BADTCPSERVERTOOBUSY 0x807d0000 // The server cannot process the request because it is too busy. -#define UA_STATUSCODE_BADTCPMESSAGETYPEINVALID 0x807e0000 // The type of the message specified in the header invalid. -#define UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN 0x807f0000 // The SecureChannelId and/or TokenId are not currently in use. -#define UA_STATUSCODE_BADTCPMESSAGETOOLARGE 0x80800000 // The size of the message specified in the header is too large. -#define UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES 0x80810000 // There are not enough resources to process the request. -#define UA_STATUSCODE_BADTCPINTERNALERROR 0x80820000 // An internal error occurred. -#define UA_STATUSCODE_BADTCPENDPOINTURLINVALID 0x80830000 // The Server does not recognize the QueryString specified. -#define UA_STATUSCODE_BADREQUESTINTERRUPTED 0x80840000 // The request could not be sent because of a network interruption. -#define UA_STATUSCODE_BADREQUESTTIMEOUT 0x80850000 // Timeout occurred while processing the request. -#define UA_STATUSCODE_BADSECURECHANNELCLOSED 0x80860000 // The secure channel has been closed. -#define UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN 0x80870000 // The token has expired or is not recognized. -#define UA_STATUSCODE_BADSEQUENCENUMBERINVALID 0x80880000 // The sequence number is not valid. -#define UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED 0x80be0000 // The applications do not have compatible protocol versions. -#define UA_STATUSCODE_BADCONFIGURATIONERROR 0x80890000 // There is a problem with the configuration that affects the usefulness of the value. -#define UA_STATUSCODE_BADNOTCONNECTED 0x808a0000 // The variable should receive its value from another variable -#define UA_STATUSCODE_BADDEVICEFAILURE 0x808b0000 // There has been a failure in the device/data source that generates the value that has affected the value. -#define UA_STATUSCODE_BADSENSORFAILURE 0x808c0000 // There has been a failure in the sensor from which the value is derived by the device/data source. -#define UA_STATUSCODE_BADOUTOFSERVICE 0x808d0000 // The source of the data is not operational. -#define UA_STATUSCODE_BADDEADBANDFILTERINVALID 0x808e0000 // The deadband filter is not valid. -#define UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE 0x408f0000 // Communication to the data source has failed. The variable value is the last value that had a good quality. -#define UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE 0x40900000 // Whatever was updating this value has stopped doing so. -#define UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE 0x40910000 // The value is an operational value that was manually overwritten. -#define UA_STATUSCODE_UNCERTAININITIALVALUE 0x40920000 // The value is an initial value for a variable that normally receives its value from another variable. -#define UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE 0x40930000 // The value is at one of the sensor limits. -#define UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED 0x40940000 // The value is outside of the range of values defined for this parameter. -#define UA_STATUSCODE_UNCERTAINSUBNORMAL 0x40950000 // The value is derived from multiple sources and has less than the required number of Good sources. -#define UA_STATUSCODE_GOODLOCALOVERRIDE 0x00960000 // The value has been overridden. -#define UA_STATUSCODE_BADREFRESHINPROGRESS 0x80970000 // This Condition refresh failed -#define UA_STATUSCODE_BADCONDITIONALREADYDISABLED 0x80980000 // This condition has already been disabled. -#define UA_STATUSCODE_BADCONDITIONALREADYENABLED 0x80cc0000 // This condition has already been enabled. -#define UA_STATUSCODE_BADCONDITIONDISABLED 0x80990000 // Property not available -#define UA_STATUSCODE_BADEVENTIDUNKNOWN 0x809a0000 // The specified event id is not recognized. -#define UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE 0x80bb0000 // The event cannot be acknowledged. -#define UA_STATUSCODE_BADDIALOGNOTACTIVE 0x80cd0000 // The dialog condition is not active. -#define UA_STATUSCODE_BADDIALOGRESPONSEINVALID 0x80ce0000 // The response is not valid for the dialog. -#define UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED 0x80cf0000 // The condition branch has already been acknowledged. -#define UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED 0x80d00000 // The condition branch has already been confirmed. -#define UA_STATUSCODE_BADCONDITIONALREADYSHELVED 0x80d10000 // The condition has already been shelved. -#define UA_STATUSCODE_BADCONDITIONNOTSHELVED 0x80d20000 // The condition is not currently shelved. -#define UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE 0x80d30000 // The shelving time not within an acceptable range. -#define UA_STATUSCODE_BADNODATA 0x809b0000 // No data exists for the requested time range or event filter. -#define UA_STATUSCODE_BADBOUNDNOTFOUND 0x80d70000 // No data found to provide upper or lower bound value. -#define UA_STATUSCODE_BADBOUNDNOTSUPPORTED 0x80d80000 // The server cannot retrieve a bound for the variable. -#define UA_STATUSCODE_BADDATALOST 0x809d0000 // Data is missing due to collection started/stopped/lost. -#define UA_STATUSCODE_BADDATAUNAVAILABLE 0x809e0000 // Expected data is unavailable for the requested time range due to an un-mounted volume -#define UA_STATUSCODE_BADENTRYEXISTS 0x809f0000 // The data or event was not successfully inserted because a matching entry exists. -#define UA_STATUSCODE_BADNOENTRYEXISTS 0x80a00000 // The data or event was not successfully updated because no matching entry exists. -#define UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED 0x80a10000 // The client requested history using a timestamp format the server does not support (i.e requested ServerTimestamp when server only supports SourceTimestamp). -#define UA_STATUSCODE_GOODENTRYINSERTED 0x00a20000 // The data or event was successfully inserted into the historical database. -#define UA_STATUSCODE_GOODENTRYREPLACED 0x00a30000 // The data or event field was successfully replaced in the historical database. -#define UA_STATUSCODE_UNCERTAINDATASUBNORMAL 0x40a40000 // The value is derived from multiple values and has less than the required number of Good values. -#define UA_STATUSCODE_GOODNODATA 0x00a50000 // No data exists for the requested time range or event filter. -#define UA_STATUSCODE_GOODMOREDATA 0x00a60000 // The data or event field was successfully replaced in the historical database. -#define UA_STATUSCODE_BADAGGREGATELISTMISMATCH 0x80d40000 // The requested number of Aggregates does not match the requested number of NodeIds. -#define UA_STATUSCODE_BADAGGREGATENOTSUPPORTED 0x80d50000 // The requested Aggregate is not support by the server. -#define UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS 0x80d60000 // The aggregate value could not be derived due to invalid data inputs. -#define UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED 0x80da0000 // The aggregate configuration is not valid for specified node. -#define UA_STATUSCODE_GOODDATAIGNORED 0x00d90000 // The request pecifies fields which are not valid for the EventType or cannot be saved by the historian. -#define UA_STATUSCODE_BADREQUESTNOTALLOWED 0x80e40000 // The request was rejected by the server because it did not meet the criteria set by the server. -#define UA_STATUSCODE_GOODEDITED 0x00dc0000 // The value does not come from the real source and has been edited by the server. -#define UA_STATUSCODE_GOODPOSTACTIONFAILED 0x00dd0000 // There was an error in execution of these post-actions. -#define UA_STATUSCODE_UNCERTAINDOMINANTVALUECHANGED 0x40de0000 // The related EngineeringUnit has been changed but the Variable Value is still provided based on the previous unit. -#define UA_STATUSCODE_GOODDEPENDENTVALUECHANGED 0x00e00000 // A dependent value has been changed but the change has not been applied to the device. -#define UA_STATUSCODE_BADDOMINANTVALUECHANGED 0x80e10000 // The related EngineeringUnit has been changed but this change has not been applied to the device. The Variable Value is still dependent on the previous unit but its status is currently Bad. -#define UA_STATUSCODE_UNCERTAINDEPENDENTVALUECHANGED 0x40e20000 // A dependent value has been changed but the change has not been applied to the device. The quality of the dominant variable is uncertain. -#define UA_STATUSCODE_BADDEPENDENTVALUECHANGED 0x80e30000 // A dependent value has been changed but the change has not been applied to the device. The quality of the dominant variable is Bad. -#define UA_STATUSCODE_GOODCOMMUNICATIONEVENT 0x00a70000 // The communication layer has raised an event. -#define UA_STATUSCODE_GOODSHUTDOWNEVENT 0x00a80000 // The system is shutting down. -#define UA_STATUSCODE_GOODCALLAGAIN 0x00a90000 // The operation is not finished and needs to be called again. -#define UA_STATUSCODE_GOODNONCRITICALTIMEOUT 0x00aa0000 // A non-critical timeout occurred. -#define UA_STATUSCODE_BADINVALIDARGUMENT 0x80ab0000 // One or more arguments are invalid. -#define UA_STATUSCODE_BADCONNECTIONREJECTED 0x80ac0000 // Could not establish a network connection to remote server. -#define UA_STATUSCODE_BADDISCONNECT 0x80ad0000 // The server has disconnected from the client. -#define UA_STATUSCODE_BADCONNECTIONCLOSED 0x80ae0000 // The network connection has been closed. -#define UA_STATUSCODE_BADINVALIDSTATE 0x80af0000 // The operation cannot be completed because the object is closed -#define UA_STATUSCODE_BADENDOFSTREAM 0x80b00000 // Cannot move beyond end of the stream. -#define UA_STATUSCODE_BADNODATAAVAILABLE 0x80b10000 // No data is currently available for reading from a non-blocking stream. -#define UA_STATUSCODE_BADWAITINGFORRESPONSE 0x80b20000 // The asynchronous operation is waiting for a response. -#define UA_STATUSCODE_BADOPERATIONABANDONED 0x80b30000 // The asynchronous operation was abandoned by the caller. -#define UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK 0x80b40000 // The stream did not return all data requested (possibly because it is a non-blocking stream). -#define UA_STATUSCODE_BADWOULDBLOCK 0x80b50000 // Non blocking behaviour is required and the operation would block. -#define UA_STATUSCODE_BADSYNTAXERROR 0x80b60000 // A value had an invalid syntax. -#define UA_STATUSCODE_BADMAXCONNECTIONSREACHED 0x80b70000 // The operation could not be finished because all available connections are in use. - -/** - * Namespace Zero NodeIds - * ---------------------- - * Numeric identifiers of standard-defined nodes in namespace zero. The - * following definitions are autogenerated from the ``NodeIds.csv`` file - * provided with the OPC UA standard. */ - -#define UA_NS0ID_BOOLEAN 1 // DataType -#define UA_NS0ID_SBYTE 2 // DataType -#define UA_NS0ID_BYTE 3 // DataType -#define UA_NS0ID_INT16 4 // DataType -#define UA_NS0ID_UINT16 5 // DataType -#define UA_NS0ID_INT32 6 // DataType -#define UA_NS0ID_UINT32 7 // DataType -#define UA_NS0ID_INT64 8 // DataType -#define UA_NS0ID_UINT64 9 // DataType -#define UA_NS0ID_FLOAT 10 // DataType -#define UA_NS0ID_DOUBLE 11 // DataType -#define UA_NS0ID_STRING 12 // DataType -#define UA_NS0ID_DATETIME 13 // DataType -#define UA_NS0ID_GUID 14 // DataType -#define UA_NS0ID_BYTESTRING 15 // DataType -#define UA_NS0ID_XMLELEMENT 16 // DataType -#define UA_NS0ID_NODEID 17 // DataType -#define UA_NS0ID_EXPANDEDNODEID 18 // DataType -#define UA_NS0ID_STATUSCODE 19 // DataType -#define UA_NS0ID_QUALIFIEDNAME 20 // DataType -#define UA_NS0ID_LOCALIZEDTEXT 21 // DataType -#define UA_NS0ID_STRUCTURE 22 // DataType -#define UA_NS0ID_DATAVALUE 23 // DataType -#define UA_NS0ID_BASEDATATYPE 24 // DataType -#define UA_NS0ID_DIAGNOSTICINFO 25 // DataType -#define UA_NS0ID_NUMBER 26 // DataType -#define UA_NS0ID_INTEGER 27 // DataType -#define UA_NS0ID_UINTEGER 28 // DataType -#define UA_NS0ID_ENUMERATION 29 // DataType -#define UA_NS0ID_IMAGE 30 // DataType -#define UA_NS0ID_REFERENCES 31 // ReferenceType -#define UA_NS0ID_NONHIERARCHICALREFERENCES 32 // ReferenceType -#define UA_NS0ID_HIERARCHICALREFERENCES 33 // ReferenceType -#define UA_NS0ID_HASCHILD 34 // ReferenceType -#define UA_NS0ID_ORGANIZES 35 // ReferenceType -#define UA_NS0ID_HASEVENTSOURCE 36 // ReferenceType -#define UA_NS0ID_HASMODELLINGRULE 37 // ReferenceType -#define UA_NS0ID_HASENCODING 38 // ReferenceType -#define UA_NS0ID_HASDESCRIPTION 39 // ReferenceType -#define UA_NS0ID_HASTYPEDEFINITION 40 // ReferenceType -#define UA_NS0ID_GENERATESEVENT 41 // ReferenceType -#define UA_NS0ID_AGGREGATES 44 // ReferenceType -#define UA_NS0ID_HASSUBTYPE 45 // ReferenceType -#define UA_NS0ID_HASPROPERTY 46 // ReferenceType -#define UA_NS0ID_HASCOMPONENT 47 // ReferenceType -#define UA_NS0ID_HASNOTIFIER 48 // ReferenceType -#define UA_NS0ID_HASORDEREDCOMPONENT 49 // ReferenceType -#define UA_NS0ID_FROMSTATE 51 // ReferenceType -#define UA_NS0ID_TOSTATE 52 // ReferenceType -#define UA_NS0ID_HASCAUSE 53 // ReferenceType -#define UA_NS0ID_HASEFFECT 54 // ReferenceType -#define UA_NS0ID_HASHISTORICALCONFIGURATION 56 // ReferenceType -#define UA_NS0ID_BASEOBJECTTYPE 58 // ObjectType -#define UA_NS0ID_FOLDERTYPE 61 // ObjectType -#define UA_NS0ID_BASEVARIABLETYPE 62 // VariableType -#define UA_NS0ID_BASEDATAVARIABLETYPE 63 // VariableType -#define UA_NS0ID_PROPERTYTYPE 68 // VariableType -#define UA_NS0ID_DATATYPEDESCRIPTIONTYPE 69 // VariableType -#define UA_NS0ID_DATATYPEDICTIONARYTYPE 72 // VariableType -#define UA_NS0ID_DATATYPESYSTEMTYPE 75 // ObjectType -#define UA_NS0ID_DATATYPEENCODINGTYPE 76 // ObjectType -#define UA_NS0ID_MODELLINGRULETYPE 77 // ObjectType -#define UA_NS0ID_MODELLINGRULE_MANDATORY 78 // Object -#define UA_NS0ID_MODELLINGRULE_MANDATORYSHARED 79 // Object -#define UA_NS0ID_MODELLINGRULE_OPTIONAL 80 // Object -#define UA_NS0ID_MODELLINGRULE_EXPOSESITSARRAY 83 // Object -#define UA_NS0ID_ROOTFOLDER 84 // Object -#define UA_NS0ID_OBJECTSFOLDER 85 // Object -#define UA_NS0ID_TYPESFOLDER 86 // Object -#define UA_NS0ID_VIEWSFOLDER 87 // Object -#define UA_NS0ID_OBJECTTYPESFOLDER 88 // Object -#define UA_NS0ID_VARIABLETYPESFOLDER 89 // Object -#define UA_NS0ID_DATATYPESFOLDER 90 // Object -#define UA_NS0ID_REFERENCETYPESFOLDER 91 // Object -#define UA_NS0ID_XMLSCHEMA_TYPESYSTEM 92 // Object -#define UA_NS0ID_OPCBINARYSCHEMA_TYPESYSTEM 93 // Object -#define UA_NS0ID_MODELLINGRULE_MANDATORY_NAMINGRULE 112 // Variable -#define UA_NS0ID_MODELLINGRULE_OPTIONAL_NAMINGRULE 113 // Variable -#define UA_NS0ID_MODELLINGRULE_EXPOSESITSARRAY_NAMINGRULE 114 // Variable -#define UA_NS0ID_MODELLINGRULE_MANDATORYSHARED_NAMINGRULE 116 // Variable -#define UA_NS0ID_HASSUBSTATEMACHINE 117 // ReferenceType -#define UA_NS0ID_NAMINGRULETYPE 120 // DataType -#define UA_NS0ID_DECIMAL128 121 // DataType -#define UA_NS0ID_IDTYPE 256 // DataType -#define UA_NS0ID_NODECLASS 257 // DataType -#define UA_NS0ID_NODE 258 // DataType -#define UA_NS0ID_NODE_ENCODING_DEFAULTXML 259 // Object -#define UA_NS0ID_NODE_ENCODING_DEFAULTBINARY 260 // Object -#define UA_NS0ID_OBJECTNODE 261 // DataType -#define UA_NS0ID_OBJECTNODE_ENCODING_DEFAULTXML 262 // Object -#define UA_NS0ID_OBJECTNODE_ENCODING_DEFAULTBINARY 263 // Object -#define UA_NS0ID_OBJECTTYPENODE 264 // DataType -#define UA_NS0ID_OBJECTTYPENODE_ENCODING_DEFAULTXML 265 // Object -#define UA_NS0ID_OBJECTTYPENODE_ENCODING_DEFAULTBINARY 266 // Object -#define UA_NS0ID_VARIABLENODE 267 // DataType -#define UA_NS0ID_VARIABLENODE_ENCODING_DEFAULTXML 268 // Object -#define UA_NS0ID_VARIABLENODE_ENCODING_DEFAULTBINARY 269 // Object -#define UA_NS0ID_VARIABLETYPENODE 270 // DataType -#define UA_NS0ID_VARIABLETYPENODE_ENCODING_DEFAULTXML 271 // Object -#define UA_NS0ID_VARIABLETYPENODE_ENCODING_DEFAULTBINARY 272 // Object -#define UA_NS0ID_REFERENCETYPENODE 273 // DataType -#define UA_NS0ID_REFERENCETYPENODE_ENCODING_DEFAULTXML 274 // Object -#define UA_NS0ID_REFERENCETYPENODE_ENCODING_DEFAULTBINARY 275 // Object -#define UA_NS0ID_METHODNODE 276 // DataType -#define UA_NS0ID_METHODNODE_ENCODING_DEFAULTXML 277 // Object -#define UA_NS0ID_METHODNODE_ENCODING_DEFAULTBINARY 278 // Object -#define UA_NS0ID_VIEWNODE 279 // DataType -#define UA_NS0ID_VIEWNODE_ENCODING_DEFAULTXML 280 // Object -#define UA_NS0ID_VIEWNODE_ENCODING_DEFAULTBINARY 281 // Object -#define UA_NS0ID_DATATYPENODE 282 // DataType -#define UA_NS0ID_DATATYPENODE_ENCODING_DEFAULTXML 283 // Object -#define UA_NS0ID_DATATYPENODE_ENCODING_DEFAULTBINARY 284 // Object -#define UA_NS0ID_REFERENCENODE 285 // DataType -#define UA_NS0ID_REFERENCENODE_ENCODING_DEFAULTXML 286 // Object -#define UA_NS0ID_REFERENCENODE_ENCODING_DEFAULTBINARY 287 // Object -#define UA_NS0ID_INTEGERID 288 // DataType -#define UA_NS0ID_COUNTER 289 // DataType -#define UA_NS0ID_DURATION 290 // DataType -#define UA_NS0ID_NUMERICRANGE 291 // DataType -#define UA_NS0ID_TIME 292 // DataType -#define UA_NS0ID_DATE 293 // DataType -#define UA_NS0ID_UTCTIME 294 // DataType -#define UA_NS0ID_LOCALEID 295 // DataType -#define UA_NS0ID_ARGUMENT 296 // DataType -#define UA_NS0ID_ARGUMENT_ENCODING_DEFAULTXML 297 // Object -#define UA_NS0ID_ARGUMENT_ENCODING_DEFAULTBINARY 298 // Object -#define UA_NS0ID_STATUSRESULT 299 // DataType -#define UA_NS0ID_STATUSRESULT_ENCODING_DEFAULTXML 300 // Object -#define UA_NS0ID_STATUSRESULT_ENCODING_DEFAULTBINARY 301 // Object -#define UA_NS0ID_MESSAGESECURITYMODE 302 // DataType -#define UA_NS0ID_USERTOKENTYPE 303 // DataType -#define UA_NS0ID_USERTOKENPOLICY 304 // DataType -#define UA_NS0ID_USERTOKENPOLICY_ENCODING_DEFAULTXML 305 // Object -#define UA_NS0ID_USERTOKENPOLICY_ENCODING_DEFAULTBINARY 306 // Object -#define UA_NS0ID_APPLICATIONTYPE 307 // DataType -#define UA_NS0ID_APPLICATIONDESCRIPTION 308 // DataType -#define UA_NS0ID_APPLICATIONDESCRIPTION_ENCODING_DEFAULTXML 309 // Object -#define UA_NS0ID_APPLICATIONDESCRIPTION_ENCODING_DEFAULTBINARY 310 // Object -#define UA_NS0ID_APPLICATIONINSTANCECERTIFICATE 311 // DataType -#define UA_NS0ID_ENDPOINTDESCRIPTION 312 // DataType -#define UA_NS0ID_ENDPOINTDESCRIPTION_ENCODING_DEFAULTXML 313 // Object -#define UA_NS0ID_ENDPOINTDESCRIPTION_ENCODING_DEFAULTBINARY 314 // Object -#define UA_NS0ID_SECURITYTOKENREQUESTTYPE 315 // DataType -#define UA_NS0ID_USERIDENTITYTOKEN 316 // DataType -#define UA_NS0ID_USERIDENTITYTOKEN_ENCODING_DEFAULTXML 317 // Object -#define UA_NS0ID_USERIDENTITYTOKEN_ENCODING_DEFAULTBINARY 318 // Object -#define UA_NS0ID_ANONYMOUSIDENTITYTOKEN 319 // DataType -#define UA_NS0ID_ANONYMOUSIDENTITYTOKEN_ENCODING_DEFAULTXML 320 // Object -#define UA_NS0ID_ANONYMOUSIDENTITYTOKEN_ENCODING_DEFAULTBINARY 321 // Object -#define UA_NS0ID_USERNAMEIDENTITYTOKEN 322 // DataType -#define UA_NS0ID_USERNAMEIDENTITYTOKEN_ENCODING_DEFAULTXML 323 // Object -#define UA_NS0ID_USERNAMEIDENTITYTOKEN_ENCODING_DEFAULTBINARY 324 // Object -#define UA_NS0ID_X509IDENTITYTOKEN 325 // DataType -#define UA_NS0ID_X509IDENTITYTOKEN_ENCODING_DEFAULTXML 326 // Object -#define UA_NS0ID_X509IDENTITYTOKEN_ENCODING_DEFAULTBINARY 327 // Object -#define UA_NS0ID_ENDPOINTCONFIGURATION 331 // DataType -#define UA_NS0ID_ENDPOINTCONFIGURATION_ENCODING_DEFAULTXML 332 // Object -#define UA_NS0ID_ENDPOINTCONFIGURATION_ENCODING_DEFAULTBINARY 333 // Object -#define UA_NS0ID_BUILDINFO 338 // DataType -#define UA_NS0ID_BUILDINFO_ENCODING_DEFAULTXML 339 // Object -#define UA_NS0ID_BUILDINFO_ENCODING_DEFAULTBINARY 340 // Object -#define UA_NS0ID_SIGNEDSOFTWARECERTIFICATE 344 // DataType -#define UA_NS0ID_SIGNEDSOFTWARECERTIFICATE_ENCODING_DEFAULTXML 345 // Object -#define UA_NS0ID_SIGNEDSOFTWARECERTIFICATE_ENCODING_DEFAULTBINARY 346 // Object -#define UA_NS0ID_ATTRIBUTEWRITEMASK 347 // DataType -#define UA_NS0ID_NODEATTRIBUTESMASK 348 // DataType -#define UA_NS0ID_NODEATTRIBUTES 349 // DataType -#define UA_NS0ID_NODEATTRIBUTES_ENCODING_DEFAULTXML 350 // Object -#define UA_NS0ID_NODEATTRIBUTES_ENCODING_DEFAULTBINARY 351 // Object -#define UA_NS0ID_OBJECTATTRIBUTES 352 // DataType -#define UA_NS0ID_OBJECTATTRIBUTES_ENCODING_DEFAULTXML 353 // Object -#define UA_NS0ID_OBJECTATTRIBUTES_ENCODING_DEFAULTBINARY 354 // Object -#define UA_NS0ID_VARIABLEATTRIBUTES 355 // DataType -#define UA_NS0ID_VARIABLEATTRIBUTES_ENCODING_DEFAULTXML 356 // Object -#define UA_NS0ID_VARIABLEATTRIBUTES_ENCODING_DEFAULTBINARY 357 // Object -#define UA_NS0ID_METHODATTRIBUTES 358 // DataType -#define UA_NS0ID_METHODATTRIBUTES_ENCODING_DEFAULTXML 359 // Object -#define UA_NS0ID_METHODATTRIBUTES_ENCODING_DEFAULTBINARY 360 // Object -#define UA_NS0ID_OBJECTTYPEATTRIBUTES 361 // DataType -#define UA_NS0ID_OBJECTTYPEATTRIBUTES_ENCODING_DEFAULTXML 362 // Object -#define UA_NS0ID_OBJECTTYPEATTRIBUTES_ENCODING_DEFAULTBINARY 363 // Object -#define UA_NS0ID_VARIABLETYPEATTRIBUTES 364 // DataType -#define UA_NS0ID_VARIABLETYPEATTRIBUTES_ENCODING_DEFAULTXML 365 // Object -#define UA_NS0ID_VARIABLETYPEATTRIBUTES_ENCODING_DEFAULTBINARY 366 // Object -#define UA_NS0ID_REFERENCETYPEATTRIBUTES 367 // DataType -#define UA_NS0ID_REFERENCETYPEATTRIBUTES_ENCODING_DEFAULTXML 368 // Object -#define UA_NS0ID_REFERENCETYPEATTRIBUTES_ENCODING_DEFAULTBINARY 369 // Object -#define UA_NS0ID_DATATYPEATTRIBUTES 370 // DataType -#define UA_NS0ID_DATATYPEATTRIBUTES_ENCODING_DEFAULTXML 371 // Object -#define UA_NS0ID_DATATYPEATTRIBUTES_ENCODING_DEFAULTBINARY 372 // Object -#define UA_NS0ID_VIEWATTRIBUTES 373 // DataType -#define UA_NS0ID_VIEWATTRIBUTES_ENCODING_DEFAULTXML 374 // Object -#define UA_NS0ID_VIEWATTRIBUTES_ENCODING_DEFAULTBINARY 375 // Object -#define UA_NS0ID_ADDNODESITEM 376 // DataType -#define UA_NS0ID_ADDNODESITEM_ENCODING_DEFAULTXML 377 // Object -#define UA_NS0ID_ADDNODESITEM_ENCODING_DEFAULTBINARY 378 // Object -#define UA_NS0ID_ADDREFERENCESITEM 379 // DataType -#define UA_NS0ID_ADDREFERENCESITEM_ENCODING_DEFAULTXML 380 // Object -#define UA_NS0ID_ADDREFERENCESITEM_ENCODING_DEFAULTBINARY 381 // Object -#define UA_NS0ID_DELETENODESITEM 382 // DataType -#define UA_NS0ID_DELETENODESITEM_ENCODING_DEFAULTXML 383 // Object -#define UA_NS0ID_DELETENODESITEM_ENCODING_DEFAULTBINARY 384 // Object -#define UA_NS0ID_DELETEREFERENCESITEM 385 // DataType -#define UA_NS0ID_DELETEREFERENCESITEM_ENCODING_DEFAULTXML 386 // Object -#define UA_NS0ID_DELETEREFERENCESITEM_ENCODING_DEFAULTBINARY 387 // Object -#define UA_NS0ID_SESSIONAUTHENTICATIONTOKEN 388 // DataType -#define UA_NS0ID_REQUESTHEADER 389 // DataType -#define UA_NS0ID_REQUESTHEADER_ENCODING_DEFAULTXML 390 // Object -#define UA_NS0ID_REQUESTHEADER_ENCODING_DEFAULTBINARY 391 // Object -#define UA_NS0ID_RESPONSEHEADER 392 // DataType -#define UA_NS0ID_RESPONSEHEADER_ENCODING_DEFAULTXML 393 // Object -#define UA_NS0ID_RESPONSEHEADER_ENCODING_DEFAULTBINARY 394 // Object -#define UA_NS0ID_SERVICEFAULT 395 // DataType -#define UA_NS0ID_SERVICEFAULT_ENCODING_DEFAULTXML 396 // Object -#define UA_NS0ID_SERVICEFAULT_ENCODING_DEFAULTBINARY 397 // Object -#define UA_NS0ID_FINDSERVERSREQUEST 420 // DataType -#define UA_NS0ID_FINDSERVERSREQUEST_ENCODING_DEFAULTXML 421 // Object -#define UA_NS0ID_FINDSERVERSREQUEST_ENCODING_DEFAULTBINARY 422 // Object -#define UA_NS0ID_FINDSERVERSRESPONSE 423 // DataType -#define UA_NS0ID_FINDSERVERSRESPONSE_ENCODING_DEFAULTXML 424 // Object -#define UA_NS0ID_FINDSERVERSRESPONSE_ENCODING_DEFAULTBINARY 425 // Object -#define UA_NS0ID_GETENDPOINTSREQUEST 426 // DataType -#define UA_NS0ID_GETENDPOINTSREQUEST_ENCODING_DEFAULTXML 427 // Object -#define UA_NS0ID_GETENDPOINTSREQUEST_ENCODING_DEFAULTBINARY 428 // Object -#define UA_NS0ID_GETENDPOINTSRESPONSE 429 // DataType -#define UA_NS0ID_GETENDPOINTSRESPONSE_ENCODING_DEFAULTXML 430 // Object -#define UA_NS0ID_GETENDPOINTSRESPONSE_ENCODING_DEFAULTBINARY 431 // Object -#define UA_NS0ID_REGISTEREDSERVER 432 // DataType -#define UA_NS0ID_REGISTEREDSERVER_ENCODING_DEFAULTXML 433 // Object -#define UA_NS0ID_REGISTEREDSERVER_ENCODING_DEFAULTBINARY 434 // Object -#define UA_NS0ID_REGISTERSERVERREQUEST 435 // DataType -#define UA_NS0ID_REGISTERSERVERREQUEST_ENCODING_DEFAULTXML 436 // Object -#define UA_NS0ID_REGISTERSERVERREQUEST_ENCODING_DEFAULTBINARY 437 // Object -#define UA_NS0ID_REGISTERSERVERRESPONSE 438 // DataType -#define UA_NS0ID_REGISTERSERVERRESPONSE_ENCODING_DEFAULTXML 439 // Object -#define UA_NS0ID_REGISTERSERVERRESPONSE_ENCODING_DEFAULTBINARY 440 // Object -#define UA_NS0ID_CHANNELSECURITYTOKEN 441 // DataType -#define UA_NS0ID_CHANNELSECURITYTOKEN_ENCODING_DEFAULTXML 442 // Object -#define UA_NS0ID_CHANNELSECURITYTOKEN_ENCODING_DEFAULTBINARY 443 // Object -#define UA_NS0ID_OPENSECURECHANNELREQUEST 444 // DataType -#define UA_NS0ID_OPENSECURECHANNELREQUEST_ENCODING_DEFAULTXML 445 // Object -#define UA_NS0ID_OPENSECURECHANNELREQUEST_ENCODING_DEFAULTBINARY 446 // Object -#define UA_NS0ID_OPENSECURECHANNELRESPONSE 447 // DataType -#define UA_NS0ID_OPENSECURECHANNELRESPONSE_ENCODING_DEFAULTXML 448 // Object -#define UA_NS0ID_OPENSECURECHANNELRESPONSE_ENCODING_DEFAULTBINARY 449 // Object -#define UA_NS0ID_CLOSESECURECHANNELREQUEST 450 // DataType -#define UA_NS0ID_CLOSESECURECHANNELREQUEST_ENCODING_DEFAULTXML 451 // Object -#define UA_NS0ID_CLOSESECURECHANNELREQUEST_ENCODING_DEFAULTBINARY 452 // Object -#define UA_NS0ID_CLOSESECURECHANNELRESPONSE 453 // DataType -#define UA_NS0ID_CLOSESECURECHANNELRESPONSE_ENCODING_DEFAULTXML 454 // Object -#define UA_NS0ID_CLOSESECURECHANNELRESPONSE_ENCODING_DEFAULTBINARY 455 // Object -#define UA_NS0ID_SIGNATUREDATA 456 // DataType -#define UA_NS0ID_SIGNATUREDATA_ENCODING_DEFAULTXML 457 // Object -#define UA_NS0ID_SIGNATUREDATA_ENCODING_DEFAULTBINARY 458 // Object -#define UA_NS0ID_CREATESESSIONREQUEST 459 // DataType -#define UA_NS0ID_CREATESESSIONREQUEST_ENCODING_DEFAULTXML 460 // Object -#define UA_NS0ID_CREATESESSIONREQUEST_ENCODING_DEFAULTBINARY 461 // Object -#define UA_NS0ID_CREATESESSIONRESPONSE 462 // DataType -#define UA_NS0ID_CREATESESSIONRESPONSE_ENCODING_DEFAULTXML 463 // Object -#define UA_NS0ID_CREATESESSIONRESPONSE_ENCODING_DEFAULTBINARY 464 // Object -#define UA_NS0ID_ACTIVATESESSIONREQUEST 465 // DataType -#define UA_NS0ID_ACTIVATESESSIONREQUEST_ENCODING_DEFAULTXML 466 // Object -#define UA_NS0ID_ACTIVATESESSIONREQUEST_ENCODING_DEFAULTBINARY 467 // Object -#define UA_NS0ID_ACTIVATESESSIONRESPONSE 468 // DataType -#define UA_NS0ID_ACTIVATESESSIONRESPONSE_ENCODING_DEFAULTXML 469 // Object -#define UA_NS0ID_ACTIVATESESSIONRESPONSE_ENCODING_DEFAULTBINARY 470 // Object -#define UA_NS0ID_CLOSESESSIONREQUEST 471 // DataType -#define UA_NS0ID_CLOSESESSIONREQUEST_ENCODING_DEFAULTXML 472 // Object -#define UA_NS0ID_CLOSESESSIONREQUEST_ENCODING_DEFAULTBINARY 473 // Object -#define UA_NS0ID_CLOSESESSIONRESPONSE 474 // DataType -#define UA_NS0ID_CLOSESESSIONRESPONSE_ENCODING_DEFAULTXML 475 // Object -#define UA_NS0ID_CLOSESESSIONRESPONSE_ENCODING_DEFAULTBINARY 476 // Object -#define UA_NS0ID_CANCELREQUEST 477 // DataType -#define UA_NS0ID_CANCELREQUEST_ENCODING_DEFAULTXML 478 // Object -#define UA_NS0ID_CANCELREQUEST_ENCODING_DEFAULTBINARY 479 // Object -#define UA_NS0ID_CANCELRESPONSE 480 // DataType -#define UA_NS0ID_CANCELRESPONSE_ENCODING_DEFAULTXML 481 // Object -#define UA_NS0ID_CANCELRESPONSE_ENCODING_DEFAULTBINARY 482 // Object -#define UA_NS0ID_ADDNODESRESULT 483 // DataType -#define UA_NS0ID_ADDNODESRESULT_ENCODING_DEFAULTXML 484 // Object -#define UA_NS0ID_ADDNODESRESULT_ENCODING_DEFAULTBINARY 485 // Object -#define UA_NS0ID_ADDNODESREQUEST 486 // DataType -#define UA_NS0ID_ADDNODESREQUEST_ENCODING_DEFAULTXML 487 // Object -#define UA_NS0ID_ADDNODESREQUEST_ENCODING_DEFAULTBINARY 488 // Object -#define UA_NS0ID_ADDNODESRESPONSE 489 // DataType -#define UA_NS0ID_ADDNODESRESPONSE_ENCODING_DEFAULTXML 490 // Object -#define UA_NS0ID_ADDNODESRESPONSE_ENCODING_DEFAULTBINARY 491 // Object -#define UA_NS0ID_ADDREFERENCESREQUEST 492 // DataType -#define UA_NS0ID_ADDREFERENCESREQUEST_ENCODING_DEFAULTXML 493 // Object -#define UA_NS0ID_ADDREFERENCESREQUEST_ENCODING_DEFAULTBINARY 494 // Object -#define UA_NS0ID_ADDREFERENCESRESPONSE 495 // DataType -#define UA_NS0ID_ADDREFERENCESRESPONSE_ENCODING_DEFAULTXML 496 // Object -#define UA_NS0ID_ADDREFERENCESRESPONSE_ENCODING_DEFAULTBINARY 497 // Object -#define UA_NS0ID_DELETENODESREQUEST 498 // DataType -#define UA_NS0ID_DELETENODESREQUEST_ENCODING_DEFAULTXML 499 // Object -#define UA_NS0ID_DELETENODESREQUEST_ENCODING_DEFAULTBINARY 500 // Object -#define UA_NS0ID_DELETENODESRESPONSE 501 // DataType -#define UA_NS0ID_DELETENODESRESPONSE_ENCODING_DEFAULTXML 502 // Object -#define UA_NS0ID_DELETENODESRESPONSE_ENCODING_DEFAULTBINARY 503 // Object -#define UA_NS0ID_DELETEREFERENCESREQUEST 504 // DataType -#define UA_NS0ID_DELETEREFERENCESREQUEST_ENCODING_DEFAULTXML 505 // Object -#define UA_NS0ID_DELETEREFERENCESREQUEST_ENCODING_DEFAULTBINARY 506 // Object -#define UA_NS0ID_DELETEREFERENCESRESPONSE 507 // DataType -#define UA_NS0ID_DELETEREFERENCESRESPONSE_ENCODING_DEFAULTXML 508 // Object -#define UA_NS0ID_DELETEREFERENCESRESPONSE_ENCODING_DEFAULTBINARY 509 // Object -#define UA_NS0ID_BROWSEDIRECTION 510 // DataType -#define UA_NS0ID_VIEWDESCRIPTION 511 // DataType -#define UA_NS0ID_VIEWDESCRIPTION_ENCODING_DEFAULTXML 512 // Object -#define UA_NS0ID_VIEWDESCRIPTION_ENCODING_DEFAULTBINARY 513 // Object -#define UA_NS0ID_BROWSEDESCRIPTION 514 // DataType -#define UA_NS0ID_BROWSEDESCRIPTION_ENCODING_DEFAULTXML 515 // Object -#define UA_NS0ID_BROWSEDESCRIPTION_ENCODING_DEFAULTBINARY 516 // Object -#define UA_NS0ID_BROWSERESULTMASK 517 // DataType -#define UA_NS0ID_REFERENCEDESCRIPTION 518 // DataType -#define UA_NS0ID_REFERENCEDESCRIPTION_ENCODING_DEFAULTXML 519 // Object -#define UA_NS0ID_REFERENCEDESCRIPTION_ENCODING_DEFAULTBINARY 520 // Object -#define UA_NS0ID_CONTINUATIONPOINT 521 // DataType -#define UA_NS0ID_BROWSERESULT 522 // DataType -#define UA_NS0ID_BROWSERESULT_ENCODING_DEFAULTXML 523 // Object -#define UA_NS0ID_BROWSERESULT_ENCODING_DEFAULTBINARY 524 // Object -#define UA_NS0ID_BROWSEREQUEST 525 // DataType -#define UA_NS0ID_BROWSEREQUEST_ENCODING_DEFAULTXML 526 // Object -#define UA_NS0ID_BROWSEREQUEST_ENCODING_DEFAULTBINARY 527 // Object -#define UA_NS0ID_BROWSERESPONSE 528 // DataType -#define UA_NS0ID_BROWSERESPONSE_ENCODING_DEFAULTXML 529 // Object -#define UA_NS0ID_BROWSERESPONSE_ENCODING_DEFAULTBINARY 530 // Object -#define UA_NS0ID_BROWSENEXTREQUEST 531 // DataType -#define UA_NS0ID_BROWSENEXTREQUEST_ENCODING_DEFAULTXML 532 // Object -#define UA_NS0ID_BROWSENEXTREQUEST_ENCODING_DEFAULTBINARY 533 // Object -#define UA_NS0ID_BROWSENEXTRESPONSE 534 // DataType -#define UA_NS0ID_BROWSENEXTRESPONSE_ENCODING_DEFAULTXML 535 // Object -#define UA_NS0ID_BROWSENEXTRESPONSE_ENCODING_DEFAULTBINARY 536 // Object -#define UA_NS0ID_RELATIVEPATHELEMENT 537 // DataType -#define UA_NS0ID_RELATIVEPATHELEMENT_ENCODING_DEFAULTXML 538 // Object -#define UA_NS0ID_RELATIVEPATHELEMENT_ENCODING_DEFAULTBINARY 539 // Object -#define UA_NS0ID_RELATIVEPATH 540 // DataType -#define UA_NS0ID_RELATIVEPATH_ENCODING_DEFAULTXML 541 // Object -#define UA_NS0ID_RELATIVEPATH_ENCODING_DEFAULTBINARY 542 // Object -#define UA_NS0ID_BROWSEPATH 543 // DataType -#define UA_NS0ID_BROWSEPATH_ENCODING_DEFAULTXML 544 // Object -#define UA_NS0ID_BROWSEPATH_ENCODING_DEFAULTBINARY 545 // Object -#define UA_NS0ID_BROWSEPATHTARGET 546 // DataType -#define UA_NS0ID_BROWSEPATHTARGET_ENCODING_DEFAULTXML 547 // Object -#define UA_NS0ID_BROWSEPATHTARGET_ENCODING_DEFAULTBINARY 548 // Object -#define UA_NS0ID_BROWSEPATHRESULT 549 // DataType -#define UA_NS0ID_BROWSEPATHRESULT_ENCODING_DEFAULTXML 550 // Object -#define UA_NS0ID_BROWSEPATHRESULT_ENCODING_DEFAULTBINARY 551 // Object -#define UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSREQUEST 552 // DataType -#define UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSREQUEST_ENCODING_DEFAULTXML 553 // Object -#define UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSREQUEST_ENCODING_DEFAULTBINARY 554 // Object -#define UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE 555 // DataType -#define UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE_ENCODING_DEFAULTXML 556 // Object -#define UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE_ENCODING_DEFAULTBINARY 557 // Object -#define UA_NS0ID_REGISTERNODESREQUEST 558 // DataType -#define UA_NS0ID_REGISTERNODESREQUEST_ENCODING_DEFAULTXML 559 // Object -#define UA_NS0ID_REGISTERNODESREQUEST_ENCODING_DEFAULTBINARY 560 // Object -#define UA_NS0ID_REGISTERNODESRESPONSE 561 // DataType -#define UA_NS0ID_REGISTERNODESRESPONSE_ENCODING_DEFAULTXML 562 // Object -#define UA_NS0ID_REGISTERNODESRESPONSE_ENCODING_DEFAULTBINARY 563 // Object -#define UA_NS0ID_UNREGISTERNODESREQUEST 564 // DataType -#define UA_NS0ID_UNREGISTERNODESREQUEST_ENCODING_DEFAULTXML 565 // Object -#define UA_NS0ID_UNREGISTERNODESREQUEST_ENCODING_DEFAULTBINARY 566 // Object -#define UA_NS0ID_UNREGISTERNODESRESPONSE 567 // DataType -#define UA_NS0ID_UNREGISTERNODESRESPONSE_ENCODING_DEFAULTXML 568 // Object -#define UA_NS0ID_UNREGISTERNODESRESPONSE_ENCODING_DEFAULTBINARY 569 // Object -#define UA_NS0ID_QUERYDATADESCRIPTION 570 // DataType -#define UA_NS0ID_QUERYDATADESCRIPTION_ENCODING_DEFAULTXML 571 // Object -#define UA_NS0ID_QUERYDATADESCRIPTION_ENCODING_DEFAULTBINARY 572 // Object -#define UA_NS0ID_NODETYPEDESCRIPTION 573 // DataType -#define UA_NS0ID_NODETYPEDESCRIPTION_ENCODING_DEFAULTXML 574 // Object -#define UA_NS0ID_NODETYPEDESCRIPTION_ENCODING_DEFAULTBINARY 575 // Object -#define UA_NS0ID_FILTEROPERATOR 576 // DataType -#define UA_NS0ID_QUERYDATASET 577 // DataType -#define UA_NS0ID_QUERYDATASET_ENCODING_DEFAULTXML 578 // Object -#define UA_NS0ID_QUERYDATASET_ENCODING_DEFAULTBINARY 579 // Object -#define UA_NS0ID_NODEREFERENCE 580 // DataType -#define UA_NS0ID_NODEREFERENCE_ENCODING_DEFAULTXML 581 // Object -#define UA_NS0ID_NODEREFERENCE_ENCODING_DEFAULTBINARY 582 // Object -#define UA_NS0ID_CONTENTFILTERELEMENT 583 // DataType -#define UA_NS0ID_CONTENTFILTERELEMENT_ENCODING_DEFAULTXML 584 // Object -#define UA_NS0ID_CONTENTFILTERELEMENT_ENCODING_DEFAULTBINARY 585 // Object -#define UA_NS0ID_CONTENTFILTER 586 // DataType -#define UA_NS0ID_CONTENTFILTER_ENCODING_DEFAULTXML 587 // Object -#define UA_NS0ID_CONTENTFILTER_ENCODING_DEFAULTBINARY 588 // Object -#define UA_NS0ID_FILTEROPERAND 589 // DataType -#define UA_NS0ID_FILTEROPERAND_ENCODING_DEFAULTXML 590 // Object -#define UA_NS0ID_FILTEROPERAND_ENCODING_DEFAULTBINARY 591 // Object -#define UA_NS0ID_ELEMENTOPERAND 592 // DataType -#define UA_NS0ID_ELEMENTOPERAND_ENCODING_DEFAULTXML 593 // Object -#define UA_NS0ID_ELEMENTOPERAND_ENCODING_DEFAULTBINARY 594 // Object -#define UA_NS0ID_LITERALOPERAND 595 // DataType -#define UA_NS0ID_LITERALOPERAND_ENCODING_DEFAULTXML 596 // Object -#define UA_NS0ID_LITERALOPERAND_ENCODING_DEFAULTBINARY 597 // Object -#define UA_NS0ID_ATTRIBUTEOPERAND 598 // DataType -#define UA_NS0ID_ATTRIBUTEOPERAND_ENCODING_DEFAULTXML 599 // Object -#define UA_NS0ID_ATTRIBUTEOPERAND_ENCODING_DEFAULTBINARY 600 // Object -#define UA_NS0ID_SIMPLEATTRIBUTEOPERAND 601 // DataType -#define UA_NS0ID_SIMPLEATTRIBUTEOPERAND_ENCODING_DEFAULTXML 602 // Object -#define UA_NS0ID_SIMPLEATTRIBUTEOPERAND_ENCODING_DEFAULTBINARY 603 // Object -#define UA_NS0ID_CONTENTFILTERELEMENTRESULT 604 // DataType -#define UA_NS0ID_CONTENTFILTERELEMENTRESULT_ENCODING_DEFAULTXML 605 // Object -#define UA_NS0ID_CONTENTFILTERELEMENTRESULT_ENCODING_DEFAULTBINARY 606 // Object -#define UA_NS0ID_CONTENTFILTERRESULT 607 // DataType -#define UA_NS0ID_CONTENTFILTERRESULT_ENCODING_DEFAULTXML 608 // Object -#define UA_NS0ID_CONTENTFILTERRESULT_ENCODING_DEFAULTBINARY 609 // Object -#define UA_NS0ID_PARSINGRESULT 610 // DataType -#define UA_NS0ID_PARSINGRESULT_ENCODING_DEFAULTXML 611 // Object -#define UA_NS0ID_PARSINGRESULT_ENCODING_DEFAULTBINARY 612 // Object -#define UA_NS0ID_QUERYFIRSTREQUEST 613 // DataType -#define UA_NS0ID_QUERYFIRSTREQUEST_ENCODING_DEFAULTXML 614 // Object -#define UA_NS0ID_QUERYFIRSTREQUEST_ENCODING_DEFAULTBINARY 615 // Object -#define UA_NS0ID_QUERYFIRSTRESPONSE 616 // DataType -#define UA_NS0ID_QUERYFIRSTRESPONSE_ENCODING_DEFAULTXML 617 // Object -#define UA_NS0ID_QUERYFIRSTRESPONSE_ENCODING_DEFAULTBINARY 618 // Object -#define UA_NS0ID_QUERYNEXTREQUEST 619 // DataType -#define UA_NS0ID_QUERYNEXTREQUEST_ENCODING_DEFAULTXML 620 // Object -#define UA_NS0ID_QUERYNEXTREQUEST_ENCODING_DEFAULTBINARY 621 // Object -#define UA_NS0ID_QUERYNEXTRESPONSE 622 // DataType -#define UA_NS0ID_QUERYNEXTRESPONSE_ENCODING_DEFAULTXML 623 // Object -#define UA_NS0ID_QUERYNEXTRESPONSE_ENCODING_DEFAULTBINARY 624 // Object -#define UA_NS0ID_TIMESTAMPSTORETURN 625 // DataType -#define UA_NS0ID_READVALUEID 626 // DataType -#define UA_NS0ID_READVALUEID_ENCODING_DEFAULTXML 627 // Object -#define UA_NS0ID_READVALUEID_ENCODING_DEFAULTBINARY 628 // Object -#define UA_NS0ID_READREQUEST 629 // DataType -#define UA_NS0ID_READREQUEST_ENCODING_DEFAULTXML 630 // Object -#define UA_NS0ID_READREQUEST_ENCODING_DEFAULTBINARY 631 // Object -#define UA_NS0ID_READRESPONSE 632 // DataType -#define UA_NS0ID_READRESPONSE_ENCODING_DEFAULTXML 633 // Object -#define UA_NS0ID_READRESPONSE_ENCODING_DEFAULTBINARY 634 // Object -#define UA_NS0ID_HISTORYREADVALUEID 635 // DataType -#define UA_NS0ID_HISTORYREADVALUEID_ENCODING_DEFAULTXML 636 // Object -#define UA_NS0ID_HISTORYREADVALUEID_ENCODING_DEFAULTBINARY 637 // Object -#define UA_NS0ID_HISTORYREADRESULT 638 // DataType -#define UA_NS0ID_HISTORYREADRESULT_ENCODING_DEFAULTXML 639 // Object -#define UA_NS0ID_HISTORYREADRESULT_ENCODING_DEFAULTBINARY 640 // Object -#define UA_NS0ID_HISTORYREADDETAILS 641 // DataType -#define UA_NS0ID_HISTORYREADDETAILS_ENCODING_DEFAULTXML 642 // Object -#define UA_NS0ID_HISTORYREADDETAILS_ENCODING_DEFAULTBINARY 643 // Object -#define UA_NS0ID_READEVENTDETAILS 644 // DataType -#define UA_NS0ID_READEVENTDETAILS_ENCODING_DEFAULTXML 645 // Object -#define UA_NS0ID_READEVENTDETAILS_ENCODING_DEFAULTBINARY 646 // Object -#define UA_NS0ID_READRAWMODIFIEDDETAILS 647 // DataType -#define UA_NS0ID_READRAWMODIFIEDDETAILS_ENCODING_DEFAULTXML 648 // Object -#define UA_NS0ID_READRAWMODIFIEDDETAILS_ENCODING_DEFAULTBINARY 649 // Object -#define UA_NS0ID_READPROCESSEDDETAILS 650 // DataType -#define UA_NS0ID_READPROCESSEDDETAILS_ENCODING_DEFAULTXML 651 // Object -#define UA_NS0ID_READPROCESSEDDETAILS_ENCODING_DEFAULTBINARY 652 // Object -#define UA_NS0ID_READATTIMEDETAILS 653 // DataType -#define UA_NS0ID_READATTIMEDETAILS_ENCODING_DEFAULTXML 654 // Object -#define UA_NS0ID_READATTIMEDETAILS_ENCODING_DEFAULTBINARY 655 // Object -#define UA_NS0ID_HISTORYDATA 656 // DataType -#define UA_NS0ID_HISTORYDATA_ENCODING_DEFAULTXML 657 // Object -#define UA_NS0ID_HISTORYDATA_ENCODING_DEFAULTBINARY 658 // Object -#define UA_NS0ID_HISTORYEVENT 659 // DataType -#define UA_NS0ID_HISTORYEVENT_ENCODING_DEFAULTXML 660 // Object -#define UA_NS0ID_HISTORYEVENT_ENCODING_DEFAULTBINARY 661 // Object -#define UA_NS0ID_HISTORYREADREQUEST 662 // DataType -#define UA_NS0ID_HISTORYREADREQUEST_ENCODING_DEFAULTXML 663 // Object -#define UA_NS0ID_HISTORYREADREQUEST_ENCODING_DEFAULTBINARY 664 // Object -#define UA_NS0ID_HISTORYREADRESPONSE 665 // DataType -#define UA_NS0ID_HISTORYREADRESPONSE_ENCODING_DEFAULTXML 666 // Object -#define UA_NS0ID_HISTORYREADRESPONSE_ENCODING_DEFAULTBINARY 667 // Object -#define UA_NS0ID_WRITEVALUE 668 // DataType -#define UA_NS0ID_WRITEVALUE_ENCODING_DEFAULTXML 669 // Object -#define UA_NS0ID_WRITEVALUE_ENCODING_DEFAULTBINARY 670 // Object -#define UA_NS0ID_WRITEREQUEST 671 // DataType -#define UA_NS0ID_WRITEREQUEST_ENCODING_DEFAULTXML 672 // Object -#define UA_NS0ID_WRITEREQUEST_ENCODING_DEFAULTBINARY 673 // Object -#define UA_NS0ID_WRITERESPONSE 674 // DataType -#define UA_NS0ID_WRITERESPONSE_ENCODING_DEFAULTXML 675 // Object -#define UA_NS0ID_WRITERESPONSE_ENCODING_DEFAULTBINARY 676 // Object -#define UA_NS0ID_HISTORYUPDATEDETAILS 677 // DataType -#define UA_NS0ID_HISTORYUPDATEDETAILS_ENCODING_DEFAULTXML 678 // Object -#define UA_NS0ID_HISTORYUPDATEDETAILS_ENCODING_DEFAULTBINARY 679 // Object -#define UA_NS0ID_UPDATEDATADETAILS 680 // DataType -#define UA_NS0ID_UPDATEDATADETAILS_ENCODING_DEFAULTXML 681 // Object -#define UA_NS0ID_UPDATEDATADETAILS_ENCODING_DEFAULTBINARY 682 // Object -#define UA_NS0ID_UPDATEEVENTDETAILS 683 // DataType -#define UA_NS0ID_UPDATEEVENTDETAILS_ENCODING_DEFAULTXML 684 // Object -#define UA_NS0ID_UPDATEEVENTDETAILS_ENCODING_DEFAULTBINARY 685 // Object -#define UA_NS0ID_DELETERAWMODIFIEDDETAILS 686 // DataType -#define UA_NS0ID_DELETERAWMODIFIEDDETAILS_ENCODING_DEFAULTXML 687 // Object -#define UA_NS0ID_DELETERAWMODIFIEDDETAILS_ENCODING_DEFAULTBINARY 688 // Object -#define UA_NS0ID_DELETEATTIMEDETAILS 689 // DataType -#define UA_NS0ID_DELETEATTIMEDETAILS_ENCODING_DEFAULTXML 690 // Object -#define UA_NS0ID_DELETEATTIMEDETAILS_ENCODING_DEFAULTBINARY 691 // Object -#define UA_NS0ID_DELETEEVENTDETAILS 692 // DataType -#define UA_NS0ID_DELETEEVENTDETAILS_ENCODING_DEFAULTXML 693 // Object -#define UA_NS0ID_DELETEEVENTDETAILS_ENCODING_DEFAULTBINARY 694 // Object -#define UA_NS0ID_HISTORYUPDATERESULT 695 // DataType -#define UA_NS0ID_HISTORYUPDATERESULT_ENCODING_DEFAULTXML 696 // Object -#define UA_NS0ID_HISTORYUPDATERESULT_ENCODING_DEFAULTBINARY 697 // Object -#define UA_NS0ID_HISTORYUPDATEREQUEST 698 // DataType -#define UA_NS0ID_HISTORYUPDATEREQUEST_ENCODING_DEFAULTXML 699 // Object -#define UA_NS0ID_HISTORYUPDATEREQUEST_ENCODING_DEFAULTBINARY 700 // Object -#define UA_NS0ID_HISTORYUPDATERESPONSE 701 // DataType -#define UA_NS0ID_HISTORYUPDATERESPONSE_ENCODING_DEFAULTXML 702 // Object -#define UA_NS0ID_HISTORYUPDATERESPONSE_ENCODING_DEFAULTBINARY 703 // Object -#define UA_NS0ID_CALLMETHODREQUEST 704 // DataType -#define UA_NS0ID_CALLMETHODREQUEST_ENCODING_DEFAULTXML 705 // Object -#define UA_NS0ID_CALLMETHODREQUEST_ENCODING_DEFAULTBINARY 706 // Object -#define UA_NS0ID_CALLMETHODRESULT 707 // DataType -#define UA_NS0ID_CALLMETHODRESULT_ENCODING_DEFAULTXML 708 // Object -#define UA_NS0ID_CALLMETHODRESULT_ENCODING_DEFAULTBINARY 709 // Object -#define UA_NS0ID_CALLREQUEST 710 // DataType -#define UA_NS0ID_CALLREQUEST_ENCODING_DEFAULTXML 711 // Object -#define UA_NS0ID_CALLREQUEST_ENCODING_DEFAULTBINARY 712 // Object -#define UA_NS0ID_CALLRESPONSE 713 // DataType -#define UA_NS0ID_CALLRESPONSE_ENCODING_DEFAULTXML 714 // Object -#define UA_NS0ID_CALLRESPONSE_ENCODING_DEFAULTBINARY 715 // Object -#define UA_NS0ID_MONITORINGMODE 716 // DataType -#define UA_NS0ID_DATACHANGETRIGGER 717 // DataType -#define UA_NS0ID_DEADBANDTYPE 718 // DataType -#define UA_NS0ID_MONITORINGFILTER 719 // DataType -#define UA_NS0ID_MONITORINGFILTER_ENCODING_DEFAULTXML 720 // Object -#define UA_NS0ID_MONITORINGFILTER_ENCODING_DEFAULTBINARY 721 // Object -#define UA_NS0ID_DATACHANGEFILTER 722 // DataType -#define UA_NS0ID_DATACHANGEFILTER_ENCODING_DEFAULTXML 723 // Object -#define UA_NS0ID_DATACHANGEFILTER_ENCODING_DEFAULTBINARY 724 // Object -#define UA_NS0ID_EVENTFILTER 725 // DataType -#define UA_NS0ID_EVENTFILTER_ENCODING_DEFAULTXML 726 // Object -#define UA_NS0ID_EVENTFILTER_ENCODING_DEFAULTBINARY 727 // Object -#define UA_NS0ID_AGGREGATEFILTER 728 // DataType -#define UA_NS0ID_AGGREGATEFILTER_ENCODING_DEFAULTXML 729 // Object -#define UA_NS0ID_AGGREGATEFILTER_ENCODING_DEFAULTBINARY 730 // Object -#define UA_NS0ID_MONITORINGFILTERRESULT 731 // DataType -#define UA_NS0ID_MONITORINGFILTERRESULT_ENCODING_DEFAULTXML 732 // Object -#define UA_NS0ID_MONITORINGFILTERRESULT_ENCODING_DEFAULTBINARY 733 // Object -#define UA_NS0ID_EVENTFILTERRESULT 734 // DataType -#define UA_NS0ID_EVENTFILTERRESULT_ENCODING_DEFAULTXML 735 // Object -#define UA_NS0ID_EVENTFILTERRESULT_ENCODING_DEFAULTBINARY 736 // Object -#define UA_NS0ID_AGGREGATEFILTERRESULT 737 // DataType -#define UA_NS0ID_AGGREGATEFILTERRESULT_ENCODING_DEFAULTXML 738 // Object -#define UA_NS0ID_AGGREGATEFILTERRESULT_ENCODING_DEFAULTBINARY 739 // Object -#define UA_NS0ID_MONITORINGPARAMETERS 740 // DataType -#define UA_NS0ID_MONITORINGPARAMETERS_ENCODING_DEFAULTXML 741 // Object -#define UA_NS0ID_MONITORINGPARAMETERS_ENCODING_DEFAULTBINARY 742 // Object -#define UA_NS0ID_MONITOREDITEMCREATEREQUEST 743 // DataType -#define UA_NS0ID_MONITOREDITEMCREATEREQUEST_ENCODING_DEFAULTXML 744 // Object -#define UA_NS0ID_MONITOREDITEMCREATEREQUEST_ENCODING_DEFAULTBINARY 745 // Object -#define UA_NS0ID_MONITOREDITEMCREATERESULT 746 // DataType -#define UA_NS0ID_MONITOREDITEMCREATERESULT_ENCODING_DEFAULTXML 747 // Object -#define UA_NS0ID_MONITOREDITEMCREATERESULT_ENCODING_DEFAULTBINARY 748 // Object -#define UA_NS0ID_CREATEMONITOREDITEMSREQUEST 749 // DataType -#define UA_NS0ID_CREATEMONITOREDITEMSREQUEST_ENCODING_DEFAULTXML 750 // Object -#define UA_NS0ID_CREATEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY 751 // Object -#define UA_NS0ID_CREATEMONITOREDITEMSRESPONSE 752 // DataType -#define UA_NS0ID_CREATEMONITOREDITEMSRESPONSE_ENCODING_DEFAULTXML 753 // Object -#define UA_NS0ID_CREATEMONITOREDITEMSRESPONSE_ENCODING_DEFAULTBINARY 754 // Object -#define UA_NS0ID_MONITOREDITEMMODIFYREQUEST 755 // DataType -#define UA_NS0ID_MONITOREDITEMMODIFYREQUEST_ENCODING_DEFAULTXML 756 // Object -#define UA_NS0ID_MONITOREDITEMMODIFYREQUEST_ENCODING_DEFAULTBINARY 757 // Object -#define UA_NS0ID_MONITOREDITEMMODIFYRESULT 758 // DataType -#define UA_NS0ID_MONITOREDITEMMODIFYRESULT_ENCODING_DEFAULTXML 759 // Object -#define UA_NS0ID_MONITOREDITEMMODIFYRESULT_ENCODING_DEFAULTBINARY 760 // Object -#define UA_NS0ID_MODIFYMONITOREDITEMSREQUEST 761 // DataType -#define UA_NS0ID_MODIFYMONITOREDITEMSREQUEST_ENCODING_DEFAULTXML 762 // Object -#define UA_NS0ID_MODIFYMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY 763 // Object -#define UA_NS0ID_MODIFYMONITOREDITEMSRESPONSE 764 // DataType -#define UA_NS0ID_MODIFYMONITOREDITEMSRESPONSE_ENCODING_DEFAULTXML 765 // Object -#define UA_NS0ID_MODIFYMONITOREDITEMSRESPONSE_ENCODING_DEFAULTBINARY 766 // Object -#define UA_NS0ID_SETMONITORINGMODEREQUEST 767 // DataType -#define UA_NS0ID_SETMONITORINGMODEREQUEST_ENCODING_DEFAULTXML 768 // Object -#define UA_NS0ID_SETMONITORINGMODEREQUEST_ENCODING_DEFAULTBINARY 769 // Object -#define UA_NS0ID_SETMONITORINGMODERESPONSE 770 // DataType -#define UA_NS0ID_SETMONITORINGMODERESPONSE_ENCODING_DEFAULTXML 771 // Object -#define UA_NS0ID_SETMONITORINGMODERESPONSE_ENCODING_DEFAULTBINARY 772 // Object -#define UA_NS0ID_SETTRIGGERINGREQUEST 773 // DataType -#define UA_NS0ID_SETTRIGGERINGREQUEST_ENCODING_DEFAULTXML 774 // Object -#define UA_NS0ID_SETTRIGGERINGREQUEST_ENCODING_DEFAULTBINARY 775 // Object -#define UA_NS0ID_SETTRIGGERINGRESPONSE 776 // DataType -#define UA_NS0ID_SETTRIGGERINGRESPONSE_ENCODING_DEFAULTXML 777 // Object -#define UA_NS0ID_SETTRIGGERINGRESPONSE_ENCODING_DEFAULTBINARY 778 // Object -#define UA_NS0ID_DELETEMONITOREDITEMSREQUEST 779 // DataType -#define UA_NS0ID_DELETEMONITOREDITEMSREQUEST_ENCODING_DEFAULTXML 780 // Object -#define UA_NS0ID_DELETEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY 781 // Object -#define UA_NS0ID_DELETEMONITOREDITEMSRESPONSE 782 // DataType -#define UA_NS0ID_DELETEMONITOREDITEMSRESPONSE_ENCODING_DEFAULTXML 783 // Object -#define UA_NS0ID_DELETEMONITOREDITEMSRESPONSE_ENCODING_DEFAULTBINARY 784 // Object -#define UA_NS0ID_CREATESUBSCRIPTIONREQUEST 785 // DataType -#define UA_NS0ID_CREATESUBSCRIPTIONREQUEST_ENCODING_DEFAULTXML 786 // Object -#define UA_NS0ID_CREATESUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY 787 // Object -#define UA_NS0ID_CREATESUBSCRIPTIONRESPONSE 788 // DataType -#define UA_NS0ID_CREATESUBSCRIPTIONRESPONSE_ENCODING_DEFAULTXML 789 // Object -#define UA_NS0ID_CREATESUBSCRIPTIONRESPONSE_ENCODING_DEFAULTBINARY 790 // Object -#define UA_NS0ID_MODIFYSUBSCRIPTIONREQUEST 791 // DataType -#define UA_NS0ID_MODIFYSUBSCRIPTIONREQUEST_ENCODING_DEFAULTXML 792 // Object -#define UA_NS0ID_MODIFYSUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY 793 // Object -#define UA_NS0ID_MODIFYSUBSCRIPTIONRESPONSE 794 // DataType -#define UA_NS0ID_MODIFYSUBSCRIPTIONRESPONSE_ENCODING_DEFAULTXML 795 // Object -#define UA_NS0ID_MODIFYSUBSCRIPTIONRESPONSE_ENCODING_DEFAULTBINARY 796 // Object -#define UA_NS0ID_SETPUBLISHINGMODEREQUEST 797 // DataType -#define UA_NS0ID_SETPUBLISHINGMODEREQUEST_ENCODING_DEFAULTXML 798 // Object -#define UA_NS0ID_SETPUBLISHINGMODEREQUEST_ENCODING_DEFAULTBINARY 799 // Object -#define UA_NS0ID_SETPUBLISHINGMODERESPONSE 800 // DataType -#define UA_NS0ID_SETPUBLISHINGMODERESPONSE_ENCODING_DEFAULTXML 801 // Object -#define UA_NS0ID_SETPUBLISHINGMODERESPONSE_ENCODING_DEFAULTBINARY 802 // Object -#define UA_NS0ID_NOTIFICATIONMESSAGE 803 // DataType -#define UA_NS0ID_NOTIFICATIONMESSAGE_ENCODING_DEFAULTXML 804 // Object -#define UA_NS0ID_NOTIFICATIONMESSAGE_ENCODING_DEFAULTBINARY 805 // Object -#define UA_NS0ID_MONITOREDITEMNOTIFICATION 806 // DataType -#define UA_NS0ID_MONITOREDITEMNOTIFICATION_ENCODING_DEFAULTXML 807 // Object -#define UA_NS0ID_MONITOREDITEMNOTIFICATION_ENCODING_DEFAULTBINARY 808 // Object -#define UA_NS0ID_DATACHANGENOTIFICATION 809 // DataType -#define UA_NS0ID_DATACHANGENOTIFICATION_ENCODING_DEFAULTXML 810 // Object -#define UA_NS0ID_DATACHANGENOTIFICATION_ENCODING_DEFAULTBINARY 811 // Object -#define UA_NS0ID_STATUSCHANGENOTIFICATION 818 // DataType -#define UA_NS0ID_STATUSCHANGENOTIFICATION_ENCODING_DEFAULTXML 819 // Object -#define UA_NS0ID_STATUSCHANGENOTIFICATION_ENCODING_DEFAULTBINARY 820 // Object -#define UA_NS0ID_SUBSCRIPTIONACKNOWLEDGEMENT 821 // DataType -#define UA_NS0ID_SUBSCRIPTIONACKNOWLEDGEMENT_ENCODING_DEFAULTXML 822 // Object -#define UA_NS0ID_SUBSCRIPTIONACKNOWLEDGEMENT_ENCODING_DEFAULTBINARY 823 // Object -#define UA_NS0ID_PUBLISHREQUEST 824 // DataType -#define UA_NS0ID_PUBLISHREQUEST_ENCODING_DEFAULTXML 825 // Object -#define UA_NS0ID_PUBLISHREQUEST_ENCODING_DEFAULTBINARY 826 // Object -#define UA_NS0ID_PUBLISHRESPONSE 827 // DataType -#define UA_NS0ID_PUBLISHRESPONSE_ENCODING_DEFAULTXML 828 // Object -#define UA_NS0ID_PUBLISHRESPONSE_ENCODING_DEFAULTBINARY 829 // Object -#define UA_NS0ID_REPUBLISHREQUEST 830 // DataType -#define UA_NS0ID_REPUBLISHREQUEST_ENCODING_DEFAULTXML 831 // Object -#define UA_NS0ID_REPUBLISHREQUEST_ENCODING_DEFAULTBINARY 832 // Object -#define UA_NS0ID_REPUBLISHRESPONSE 833 // DataType -#define UA_NS0ID_REPUBLISHRESPONSE_ENCODING_DEFAULTXML 834 // Object -#define UA_NS0ID_REPUBLISHRESPONSE_ENCODING_DEFAULTBINARY 835 // Object -#define UA_NS0ID_TRANSFERRESULT 836 // DataType -#define UA_NS0ID_TRANSFERRESULT_ENCODING_DEFAULTXML 837 // Object -#define UA_NS0ID_TRANSFERRESULT_ENCODING_DEFAULTBINARY 838 // Object -#define UA_NS0ID_TRANSFERSUBSCRIPTIONSREQUEST 839 // DataType -#define UA_NS0ID_TRANSFERSUBSCRIPTIONSREQUEST_ENCODING_DEFAULTXML 840 // Object -#define UA_NS0ID_TRANSFERSUBSCRIPTIONSREQUEST_ENCODING_DEFAULTBINARY 841 // Object -#define UA_NS0ID_TRANSFERSUBSCRIPTIONSRESPONSE 842 // DataType -#define UA_NS0ID_TRANSFERSUBSCRIPTIONSRESPONSE_ENCODING_DEFAULTXML 843 // Object -#define UA_NS0ID_TRANSFERSUBSCRIPTIONSRESPONSE_ENCODING_DEFAULTBINARY 844 // Object -#define UA_NS0ID_DELETESUBSCRIPTIONSREQUEST 845 // DataType -#define UA_NS0ID_DELETESUBSCRIPTIONSREQUEST_ENCODING_DEFAULTXML 846 // Object -#define UA_NS0ID_DELETESUBSCRIPTIONSREQUEST_ENCODING_DEFAULTBINARY 847 // Object -#define UA_NS0ID_DELETESUBSCRIPTIONSRESPONSE 848 // DataType -#define UA_NS0ID_DELETESUBSCRIPTIONSRESPONSE_ENCODING_DEFAULTXML 849 // Object -#define UA_NS0ID_DELETESUBSCRIPTIONSRESPONSE_ENCODING_DEFAULTBINARY 850 // Object -#define UA_NS0ID_REDUNDANCYSUPPORT 851 // DataType -#define UA_NS0ID_SERVERSTATE 852 // DataType -#define UA_NS0ID_REDUNDANTSERVERDATATYPE 853 // DataType -#define UA_NS0ID_SAMPLINGINTERVALDIAGNOSTICSDATATYPE 856 // DataType -#define UA_NS0ID_SERVERDIAGNOSTICSSUMMARYDATATYPE 859 // DataType -#define UA_NS0ID_SERVERSTATUSDATATYPE 862 // DataType -#define UA_NS0ID_SESSIONDIAGNOSTICSDATATYPE 865 // DataType -#define UA_NS0ID_SESSIONSECURITYDIAGNOSTICSDATATYPE 868 // DataType -#define UA_NS0ID_SERVICECOUNTERDATATYPE 871 // DataType -#define UA_NS0ID_SUBSCRIPTIONDIAGNOSTICSDATATYPE 874 // DataType -#define UA_NS0ID_MODELCHANGESTRUCTUREDATATYPE 877 // DataType -#define UA_NS0ID_RANGE 884 // DataType -#define UA_NS0ID_RANGE_ENCODING_DEFAULTXML 885 // Object -#define UA_NS0ID_RANGE_ENCODING_DEFAULTBINARY 886 // Object -#define UA_NS0ID_EUINFORMATION 887 // DataType -#define UA_NS0ID_EUINFORMATION_ENCODING_DEFAULTXML 888 // Object -#define UA_NS0ID_EUINFORMATION_ENCODING_DEFAULTBINARY 889 // Object -#define UA_NS0ID_EXCEPTIONDEVIATIONFORMAT 890 // DataType -#define UA_NS0ID_ANNOTATION 891 // DataType -#define UA_NS0ID_ANNOTATION_ENCODING_DEFAULTXML 892 // Object -#define UA_NS0ID_ANNOTATION_ENCODING_DEFAULTBINARY 893 // Object -#define UA_NS0ID_PROGRAMDIAGNOSTICDATATYPE 894 // DataType -#define UA_NS0ID_SEMANTICCHANGESTRUCTUREDATATYPE 897 // DataType -#define UA_NS0ID_EVENTNOTIFICATIONLIST 914 // DataType -#define UA_NS0ID_EVENTNOTIFICATIONLIST_ENCODING_DEFAULTXML 915 // Object -#define UA_NS0ID_EVENTNOTIFICATIONLIST_ENCODING_DEFAULTBINARY 916 // Object -#define UA_NS0ID_EVENTFIELDLIST 917 // DataType -#define UA_NS0ID_EVENTFIELDLIST_ENCODING_DEFAULTXML 918 // Object -#define UA_NS0ID_EVENTFIELDLIST_ENCODING_DEFAULTBINARY 919 // Object -#define UA_NS0ID_HISTORYEVENTFIELDLIST 920 // DataType -#define UA_NS0ID_HISTORYEVENTFIELDLIST_ENCODING_DEFAULTXML 921 // Object -#define UA_NS0ID_HISTORYEVENTFIELDLIST_ENCODING_DEFAULTBINARY 922 // Object -#define UA_NS0ID_ISSUEDIDENTITYTOKEN 938 // DataType -#define UA_NS0ID_ISSUEDIDENTITYTOKEN_ENCODING_DEFAULTXML 939 // Object -#define UA_NS0ID_ISSUEDIDENTITYTOKEN_ENCODING_DEFAULTBINARY 940 // Object -#define UA_NS0ID_NOTIFICATIONDATA 945 // DataType -#define UA_NS0ID_NOTIFICATIONDATA_ENCODING_DEFAULTXML 946 // Object -#define UA_NS0ID_NOTIFICATIONDATA_ENCODING_DEFAULTBINARY 947 // Object -#define UA_NS0ID_AGGREGATECONFIGURATION 948 // DataType -#define UA_NS0ID_AGGREGATECONFIGURATION_ENCODING_DEFAULTXML 949 // Object -#define UA_NS0ID_AGGREGATECONFIGURATION_ENCODING_DEFAULTBINARY 950 // Object -#define UA_NS0ID_IMAGEBMP 2000 // DataType -#define UA_NS0ID_IMAGEGIF 2001 // DataType -#define UA_NS0ID_IMAGEJPG 2002 // DataType -#define UA_NS0ID_IMAGEPNG 2003 // DataType -#define UA_NS0ID_SERVERTYPE 2004 // ObjectType -#define UA_NS0ID_SERVERCAPABILITIESTYPE 2013 // ObjectType -#define UA_NS0ID_SERVERDIAGNOSTICSTYPE 2020 // ObjectType -#define UA_NS0ID_SESSIONSDIAGNOSTICSSUMMARYTYPE 2026 // ObjectType -#define UA_NS0ID_SESSIONDIAGNOSTICSOBJECTTYPE 2029 // ObjectType -#define UA_NS0ID_VENDORSERVERINFOTYPE 2033 // ObjectType -#define UA_NS0ID_SERVERREDUNDANCYTYPE 2034 // ObjectType -#define UA_NS0ID_TRANSPARENTREDUNDANCYTYPE 2036 // ObjectType -#define UA_NS0ID_NONTRANSPARENTREDUNDANCYTYPE 2039 // ObjectType -#define UA_NS0ID_BASEEVENTTYPE 2041 // ObjectType -#define UA_NS0ID_AUDITEVENTTYPE 2052 // ObjectType -#define UA_NS0ID_AUDITSECURITYEVENTTYPE 2058 // ObjectType -#define UA_NS0ID_AUDITCHANNELEVENTTYPE 2059 // ObjectType -#define UA_NS0ID_AUDITOPENSECURECHANNELEVENTTYPE 2060 // ObjectType -#define UA_NS0ID_AUDITSESSIONEVENTTYPE 2069 // ObjectType -#define UA_NS0ID_AUDITCREATESESSIONEVENTTYPE 2071 // ObjectType -#define UA_NS0ID_AUDITACTIVATESESSIONEVENTTYPE 2075 // ObjectType -#define UA_NS0ID_AUDITCANCELEVENTTYPE 2078 // ObjectType -#define UA_NS0ID_AUDITCERTIFICATEEVENTTYPE 2080 // ObjectType -#define UA_NS0ID_AUDITCERTIFICATEDATAMISMATCHEVENTTYPE 2082 // ObjectType -#define UA_NS0ID_AUDITCERTIFICATEEXPIREDEVENTTYPE 2085 // ObjectType -#define UA_NS0ID_AUDITCERTIFICATEINVALIDEVENTTYPE 2086 // ObjectType -#define UA_NS0ID_AUDITCERTIFICATEUNTRUSTEDEVENTTYPE 2087 // ObjectType -#define UA_NS0ID_AUDITCERTIFICATEREVOKEDEVENTTYPE 2088 // ObjectType -#define UA_NS0ID_AUDITCERTIFICATEMISMATCHEVENTTYPE 2089 // ObjectType -#define UA_NS0ID_AUDITNODEMANAGEMENTEVENTTYPE 2090 // ObjectType -#define UA_NS0ID_AUDITADDNODESEVENTTYPE 2091 // ObjectType -#define UA_NS0ID_AUDITDELETENODESEVENTTYPE 2093 // ObjectType -#define UA_NS0ID_AUDITADDREFERENCESEVENTTYPE 2095 // ObjectType -#define UA_NS0ID_AUDITDELETEREFERENCESEVENTTYPE 2097 // ObjectType -#define UA_NS0ID_AUDITUPDATEEVENTTYPE 2099 // ObjectType -#define UA_NS0ID_AUDITWRITEUPDATEEVENTTYPE 2100 // ObjectType -#define UA_NS0ID_AUDITHISTORYUPDATEEVENTTYPE 2104 // ObjectType -#define UA_NS0ID_AUDITUPDATEMETHODEVENTTYPE 2127 // ObjectType -#define UA_NS0ID_SYSTEMEVENTTYPE 2130 // ObjectType -#define UA_NS0ID_DEVICEFAILUREEVENTTYPE 2131 // ObjectType -#define UA_NS0ID_BASEMODELCHANGEEVENTTYPE 2132 // ObjectType -#define UA_NS0ID_GENERALMODELCHANGEEVENTTYPE 2133 // ObjectType -#define UA_NS0ID_SERVERVENDORCAPABILITYTYPE 2137 // VariableType -#define UA_NS0ID_SERVERSTATUSTYPE 2138 // VariableType -#define UA_NS0ID_SERVERDIAGNOSTICSSUMMARYTYPE 2150 // VariableType -#define UA_NS0ID_SAMPLINGINTERVALDIAGNOSTICSARRAYTYPE 2164 // VariableType -#define UA_NS0ID_SAMPLINGINTERVALDIAGNOSTICSTYPE 2165 // VariableType -#define UA_NS0ID_SUBSCRIPTIONDIAGNOSTICSARRAYTYPE 2171 // VariableType -#define UA_NS0ID_SUBSCRIPTIONDIAGNOSTICSTYPE 2172 // VariableType -#define UA_NS0ID_SESSIONDIAGNOSTICSARRAYTYPE 2196 // VariableType -#define UA_NS0ID_SESSIONDIAGNOSTICSVARIABLETYPE 2197 // VariableType -#define UA_NS0ID_SESSIONSECURITYDIAGNOSTICSARRAYTYPE 2243 // VariableType -#define UA_NS0ID_SESSIONSECURITYDIAGNOSTICSTYPE 2244 // VariableType -#define UA_NS0ID_SERVER 2253 // Object -#define UA_NS0ID_SERVER_SERVERARRAY 2254 // Variable -#define UA_NS0ID_SERVER_NAMESPACEARRAY 2255 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS 2256 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME 2257 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME 2258 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_STATE 2259 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO 2260 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTNAME 2261 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTURI 2262 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_MANUFACTURERNAME 2263 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_SOFTWAREVERSION 2264 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDNUMBER 2265 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDDATE 2266 // Variable -#define UA_NS0ID_SERVER_SERVICELEVEL 2267 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES 2268 // Object -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_SERVERPROFILEARRAY 2269 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY 2271 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MINSUPPORTEDSAMPLERATE 2272 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS 2274 // Object -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY 2275 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_SERVERVIEWCOUNT 2276 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_CURRENTSESSIONCOUNT 2277 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_CUMULATEDSESSIONCOUNT 2278 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_SECURITYREJECTEDSESSIONCOUNT 2279 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_SESSIONTIMEOUTCOUNT 2281 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_SESSIONABORTCOUNT 2282 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_PUBLISHINGINTERVALCOUNT 2284 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_CURRENTSUBSCRIPTIONCOUNT 2285 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_CUMULATEDSUBSCRIPTIONCOUNT 2286 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_SECURITYREJECTEDREQUESTSCOUNT 2287 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_REJECTEDREQUESTSCOUNT 2288 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SAMPLINGINTERVALDIAGNOSTICSARRAY 2289 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SUBSCRIPTIONDIAGNOSTICSARRAY 2290 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_ENABLEDFLAG 2294 // Variable -#define UA_NS0ID_SERVER_VENDORSERVERINFO 2295 // Object -#define UA_NS0ID_SERVER_SERVERREDUNDANCY 2296 // Object -#define UA_NS0ID_STATEMACHINETYPE 2299 // ObjectType -#define UA_NS0ID_STATETYPE 2307 // ObjectType -#define UA_NS0ID_INITIALSTATETYPE 2309 // ObjectType -#define UA_NS0ID_TRANSITIONTYPE 2310 // ObjectType -#define UA_NS0ID_TRANSITIONEVENTTYPE 2311 // ObjectType -#define UA_NS0ID_AUDITUPDATESTATEEVENTTYPE 2315 // ObjectType -#define UA_NS0ID_HISTORICALDATACONFIGURATIONTYPE 2318 // ObjectType -#define UA_NS0ID_HISTORYSERVERCAPABILITIESTYPE 2330 // ObjectType -#define UA_NS0ID_AGGREGATEFUNCTIONTYPE 2340 // ObjectType -#define UA_NS0ID_AGGREGATEFUNCTION_INTERPOLATIVE 2341 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_AVERAGE 2342 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_TIMEAVERAGE 2343 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_TOTAL 2344 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_MINIMUM 2346 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_MAXIMUM 2347 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_MINIMUMACTUALTIME 2348 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_MAXIMUMACTUALTIME 2349 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_RANGE 2350 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_ANNOTATIONCOUNT 2351 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_COUNT 2352 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_NUMBEROFTRANSITIONS 2355 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_START 2357 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_END 2358 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_DELTA 2359 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_DURATIONGOOD 2360 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_DURATIONBAD 2361 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_PERCENTGOOD 2362 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_PERCENTBAD 2363 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_WORSTQUALITY 2364 // Object -#define UA_NS0ID_DATAITEMTYPE 2365 // VariableType -#define UA_NS0ID_ANALOGITEMTYPE 2368 // VariableType -#define UA_NS0ID_DISCRETEITEMTYPE 2372 // VariableType -#define UA_NS0ID_TWOSTATEDISCRETETYPE 2373 // VariableType -#define UA_NS0ID_MULTISTATEDISCRETETYPE 2376 // VariableType -#define UA_NS0ID_PROGRAMTRANSITIONEVENTTYPE 2378 // ObjectType -#define UA_NS0ID_PROGRAMDIAGNOSTICTYPE 2380 // VariableType -#define UA_NS0ID_PROGRAMSTATEMACHINETYPE 2391 // ObjectType -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXBROWSECONTINUATIONPOINTS 2735 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXQUERYCONTINUATIONPOINTS 2736 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXHISTORYCONTINUATIONPOINTS 2737 // Variable -#define UA_NS0ID_SEMANTICCHANGEEVENTTYPE 2738 // ObjectType -#define UA_NS0ID_AUDITURLMISMATCHEVENTTYPE 2748 // ObjectType -#define UA_NS0ID_STATEVARIABLETYPE 2755 // VariableType -#define UA_NS0ID_FINITESTATEVARIABLETYPE 2760 // VariableType -#define UA_NS0ID_TRANSITIONVARIABLETYPE 2762 // VariableType -#define UA_NS0ID_FINITETRANSITIONVARIABLETYPE 2767 // VariableType -#define UA_NS0ID_FINITESTATEMACHINETYPE 2771 // ObjectType -#define UA_NS0ID_CONDITIONTYPE 2782 // ObjectType -#define UA_NS0ID_REFRESHSTARTEVENTTYPE 2787 // ObjectType -#define UA_NS0ID_REFRESHENDEVENTTYPE 2788 // ObjectType -#define UA_NS0ID_REFRESHREQUIREDEVENTTYPE 2789 // ObjectType -#define UA_NS0ID_AUDITCONDITIONEVENTTYPE 2790 // ObjectType -#define UA_NS0ID_AUDITCONDITIONENABLEEVENTTYPE 2803 // ObjectType -#define UA_NS0ID_AUDITCONDITIONCOMMENTEVENTTYPE 2829 // ObjectType -#define UA_NS0ID_DIALOGCONDITIONTYPE 2830 // ObjectType -#define UA_NS0ID_ACKNOWLEDGEABLECONDITIONTYPE 2881 // ObjectType -#define UA_NS0ID_ALARMCONDITIONTYPE 2915 // ObjectType -#define UA_NS0ID_SHELVEDSTATEMACHINETYPE 2929 // ObjectType -#define UA_NS0ID_LIMITALARMTYPE 2955 // ObjectType -#define UA_NS0ID_SERVER_SERVERSTATUS_SECONDSTILLSHUTDOWN 2992 // Variable -#define UA_NS0ID_SERVER_SERVERSTATUS_SHUTDOWNREASON 2993 // Variable -#define UA_NS0ID_SERVER_AUDITING 2994 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MODELLINGRULES 2996 // Object -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_AGGREGATEFUNCTIONS 2997 // Object -#define UA_NS0ID_AUDITHISTORYEVENTUPDATEEVENTTYPE 2999 // ObjectType -#define UA_NS0ID_AUDITHISTORYVALUEUPDATEEVENTTYPE 3006 // ObjectType -#define UA_NS0ID_AUDITHISTORYDELETEEVENTTYPE 3012 // ObjectType -#define UA_NS0ID_AUDITHISTORYRAWMODIFYDELETEEVENTTYPE 3014 // ObjectType -#define UA_NS0ID_AUDITHISTORYATTIMEDELETEEVENTTYPE 3019 // ObjectType -#define UA_NS0ID_AUDITHISTORYEVENTDELETEEVENTTYPE 3022 // ObjectType -#define UA_NS0ID_EVENTQUEUEOVERFLOWEVENTTYPE 3035 // ObjectType -#define UA_NS0ID_EVENTTYPESFOLDER 3048 // Object -#define UA_NS0ID_BUILDINFOTYPE 3051 // VariableType -#define UA_NS0ID_DEFAULTBINARY 3062 // Object -#define UA_NS0ID_DEFAULTXML 3063 // Object -#define UA_NS0ID_ALWAYSGENERATESEVENT 3065 // ReferenceType -#define UA_NS0ID_ICON 3067 // Variable -#define UA_NS0ID_NODEVERSION 3068 // Variable -#define UA_NS0ID_LOCALTIME 3069 // Variable -#define UA_NS0ID_ALLOWNULLS 3070 // Variable -#define UA_NS0ID_ENUMVALUES 3071 // Variable -#define UA_NS0ID_INPUTARGUMENTS 3072 // Variable -#define UA_NS0ID_OUTPUTARGUMENTS 3073 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_SOFTWARECERTIFICATES 3704 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SERVERDIAGNOSTICSSUMMARY_REJECTEDSESSIONCOUNT 3705 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SESSIONSDIAGNOSTICSSUMMARY 3706 // Object -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SESSIONSDIAGNOSTICSSUMMARY_SESSIONDIAGNOSTICSARRAY 3707 // Variable -#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_SESSIONSDIAGNOSTICSSUMMARY_SESSIONSECURITYDIAGNOSTICSARRAY 3708 // Variable -#define UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANCYSUPPORT 3709 // Variable -#define UA_NS0ID_PROGRAMTRANSITIONAUDITEVENTTYPE 3806 // ObjectType -#define UA_NS0ID_ADDCOMMENTMETHODTYPE 3863 // Method -#define UA_NS0ID_TIMEDSHELVEMETHODTYPE 6102 // Method -#define UA_NS0ID_ENUMVALUETYPE 7594 // DataType -#define UA_NS0ID_MESSAGESECURITYMODE_ENUMSTRINGS 7595 // Variable -#define UA_NS0ID_BROWSEDIRECTION_ENUMSTRINGS 7603 // Variable -#define UA_NS0ID_FILTEROPERATOR_ENUMSTRINGS 7605 // Variable -#define UA_NS0ID_TIMESTAMPSTORETURN_ENUMSTRINGS 7606 // Variable -#define UA_NS0ID_MONITORINGMODE_ENUMSTRINGS 7608 // Variable -#define UA_NS0ID_DATACHANGETRIGGER_ENUMSTRINGS 7609 // Variable -#define UA_NS0ID_REDUNDANCYSUPPORT_ENUMSTRINGS 7611 // Variable -#define UA_NS0ID_SERVERSTATE_ENUMSTRINGS 7612 // Variable -#define UA_NS0ID_EXCEPTIONDEVIATIONFORMAT_ENUMSTRINGS 7614 // Variable -#define UA_NS0ID_TIMEZONEDATATYPE 8912 // DataType -#define UA_NS0ID_AUDITCONDITIONRESPONDEVENTTYPE 8927 // ObjectType -#define UA_NS0ID_AUDITCONDITIONACKNOWLEDGEEVENTTYPE 8944 // ObjectType -#define UA_NS0ID_AUDITCONDITIONCONFIRMEVENTTYPE 8961 // ObjectType -#define UA_NS0ID_TWOSTATEVARIABLETYPE 8995 // VariableType -#define UA_NS0ID_CONDITIONVARIABLETYPE 9002 // VariableType -#define UA_NS0ID_HASTRUESUBSTATE 9004 // ReferenceType -#define UA_NS0ID_HASFALSESUBSTATE 9005 // ReferenceType -#define UA_NS0ID_HASCONDITION 9006 // ReferenceType -#define UA_NS0ID_CONDITIONREFRESHMETHODTYPE 9007 // Method -#define UA_NS0ID_DIALOGRESPONSEMETHODTYPE 9031 // Method -#define UA_NS0ID_EXCLUSIVELIMITSTATEMACHINETYPE 9318 // ObjectType -#define UA_NS0ID_EXCLUSIVELIMITALARMTYPE 9341 // ObjectType -#define UA_NS0ID_EXCLUSIVELEVELALARMTYPE 9482 // ObjectType -#define UA_NS0ID_EXCLUSIVERATEOFCHANGEALARMTYPE 9623 // ObjectType -#define UA_NS0ID_EXCLUSIVEDEVIATIONALARMTYPE 9764 // ObjectType -#define UA_NS0ID_NONEXCLUSIVELIMITALARMTYPE 9906 // ObjectType -#define UA_NS0ID_NONEXCLUSIVELEVELALARMTYPE 10060 // ObjectType -#define UA_NS0ID_NONEXCLUSIVERATEOFCHANGEALARMTYPE 10214 // ObjectType -#define UA_NS0ID_NONEXCLUSIVEDEVIATIONALARMTYPE 10368 // ObjectType -#define UA_NS0ID_DISCRETEALARMTYPE 10523 // ObjectType -#define UA_NS0ID_OFFNORMALALARMTYPE 10637 // ObjectType -#define UA_NS0ID_TRIPALARMTYPE 10751 // ObjectType -#define UA_NS0ID_AUDITCONDITIONSHELVINGEVENTTYPE 11093 // ObjectType -#define UA_NS0ID_BASECONDITIONCLASSTYPE 11163 // ObjectType -#define UA_NS0ID_PROCESSCONDITIONCLASSTYPE 11164 // ObjectType -#define UA_NS0ID_MAINTENANCECONDITIONCLASSTYPE 11165 // ObjectType -#define UA_NS0ID_SYSTEMCONDITIONCLASSTYPE 11166 // ObjectType -#define UA_NS0ID_AGGREGATECONFIGURATIONTYPE 11187 // ObjectType -#define UA_NS0ID_HISTORYSERVERCAPABILITIES 11192 // Object -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_ACCESSHISTORYDATACAPABILITY 11193 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_INSERTDATACAPABILITY 11196 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_REPLACEDATACAPABILITY 11197 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_UPDATEDATACAPABILITY 11198 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_DELETERAWCAPABILITY 11199 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_DELETEATTIMECAPABILITY 11200 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_AGGREGATEFUNCTIONS 11201 // Object -#define UA_NS0ID_HACONFIGURATION 11202 // Object -#define UA_NS0ID_HACONFIGURATION_AGGREGATECONFIGURATION 11203 // Object -#define UA_NS0ID_HACONFIGURATION_AGGREGATECONFIGURATION_TREATUNCERTAINASBAD 11204 // Variable -#define UA_NS0ID_HACONFIGURATION_AGGREGATECONFIGURATION_PERCENTDATABAD 11205 // Variable -#define UA_NS0ID_HACONFIGURATION_AGGREGATECONFIGURATION_PERCENTDATAGOOD 11206 // Variable -#define UA_NS0ID_HACONFIGURATION_AGGREGATECONFIGURATION_USESLOPEDEXTRAPOLATION 11207 // Variable -#define UA_NS0ID_HACONFIGURATION_STEPPED 11208 // Variable -#define UA_NS0ID_HACONFIGURATION_DEFINITION 11209 // Variable -#define UA_NS0ID_HACONFIGURATION_MAXTIMEINTERVAL 11210 // Variable -#define UA_NS0ID_HACONFIGURATION_MINTIMEINTERVAL 11211 // Variable -#define UA_NS0ID_HACONFIGURATION_EXCEPTIONDEVIATION 11212 // Variable -#define UA_NS0ID_HACONFIGURATION_EXCEPTIONDEVIATIONFORMAT 11213 // Variable -#define UA_NS0ID_ANNOTATIONS 11214 // Variable -#define UA_NS0ID_HISTORICALEVENTFILTER 11215 // Variable -#define UA_NS0ID_MODIFICATIONINFO 11216 // DataType -#define UA_NS0ID_HISTORYMODIFIEDDATA 11217 // DataType -#define UA_NS0ID_MODIFICATIONINFO_ENCODING_DEFAULTXML 11218 // Object -#define UA_NS0ID_HISTORYMODIFIEDDATA_ENCODING_DEFAULTXML 11219 // Object -#define UA_NS0ID_MODIFICATIONINFO_ENCODING_DEFAULTBINARY 11226 // Object -#define UA_NS0ID_HISTORYMODIFIEDDATA_ENCODING_DEFAULTBINARY 11227 // Object -#define UA_NS0ID_HISTORYUPDATETYPE 11234 // DataType -#define UA_NS0ID_MULTISTATEVALUEDISCRETETYPE 11238 // VariableType -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_ACCESSHISTORYEVENTSCAPABILITY 11242 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_MAXRETURNDATAVALUES 11273 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_MAXRETURNEVENTVALUES 11274 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_INSERTANNOTATIONCAPABILITY 11275 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_INSERTEVENTCAPABILITY 11281 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_REPLACEEVENTCAPABILITY 11282 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_UPDATEEVENTCAPABILITY 11283 // Variable -#define UA_NS0ID_AGGREGATEFUNCTION_TIMEAVERAGE2 11285 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_MINIMUM2 11286 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_MAXIMUM2 11287 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_RANGE2 11288 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_WORSTQUALITY2 11292 // Object -#define UA_NS0ID_PERFORMUPDATETYPE 11293 // DataType -#define UA_NS0ID_UPDATESTRUCTUREDATADETAILS 11295 // DataType -#define UA_NS0ID_UPDATESTRUCTUREDATADETAILS_ENCODING_DEFAULTXML 11296 // Object -#define UA_NS0ID_UPDATESTRUCTUREDATADETAILS_ENCODING_DEFAULTBINARY 11300 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_TOTAL2 11304 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_MINIMUMACTUALTIME2 11305 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_MAXIMUMACTUALTIME2 11306 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_DURATIONINSTATEZERO 11307 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_DURATIONINSTATENONZERO 11308 // Object -#define UA_NS0ID_SERVER_SERVERREDUNDANCY_CURRENTSERVERID 11312 // Variable -#define UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANTSERVERARRAY 11313 // Variable -#define UA_NS0ID_SERVER_SERVERREDUNDANCY_SERVERURIARRAY 11314 // Variable -#define UA_NS0ID_AGGREGATEFUNCTION_STANDARDDEVIATIONSAMPLE 11426 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_STANDARDDEVIATIONPOPULATION 11427 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_VARIANCESAMPLE 11428 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_VARIANCEPOPULATION 11429 // Object -#define UA_NS0ID_ENUMSTRINGS 11432 // Variable -#define UA_NS0ID_VALUEASTEXT 11433 // Variable -#define UA_NS0ID_PROGRESSEVENTTYPE 11436 // ObjectType -#define UA_NS0ID_SYSTEMSTATUSCHANGEEVENTTYPE 11446 // ObjectType -#define UA_NS0ID_OPTIONSETTYPE 11487 // VariableType -#define UA_NS0ID_SERVER_GETMONITOREDITEMS 11492 // Method -#define UA_NS0ID_SERVER_GETMONITOREDITEMS_INPUTARGUMENTS 11493 // Variable -#define UA_NS0ID_SERVER_GETMONITOREDITEMS_OUTPUTARGUMENTS 11494 // Variable -#define UA_NS0ID_GETMONITOREDITEMSMETHODTYPE 11495 // Method -#define UA_NS0ID_MAXSTRINGLENGTH 11498 // Variable -#define UA_NS0ID_HISTORYSERVERCAPABILITIES_DELETEEVENTCAPABILITY 11502 // Variable -#define UA_NS0ID_HACONFIGURATION_STARTOFARCHIVE 11503 // Variable -#define UA_NS0ID_HACONFIGURATION_STARTOFONLINEARCHIVE 11504 // Variable -#define UA_NS0ID_AGGREGATEFUNCTION_STARTBOUND 11505 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_ENDBOUND 11506 // Object -#define UA_NS0ID_AGGREGATEFUNCTION_DELTABOUNDS 11507 // Object -#define UA_NS0ID_MODELLINGRULE_OPTIONALPLACEHOLDER 11508 // Object -#define UA_NS0ID_MODELLINGRULE_OPTIONALPLACEHOLDER_NAMINGRULE 11509 // Variable -#define UA_NS0ID_MODELLINGRULE_MANDATORYPLACEHOLDER 11510 // Object -#define UA_NS0ID_MODELLINGRULE_MANDATORYPLACEHOLDER_NAMINGRULE 11511 // Variable -#define UA_NS0ID_MAXARRAYLENGTH 11512 // Variable -#define UA_NS0ID_ENGINEERINGUNITS 11513 // Variable -#define UA_NS0ID_OPERATIONLIMITSTYPE 11564 // ObjectType -#define UA_NS0ID_FILETYPE 11575 // ObjectType -#define UA_NS0ID_ADDRESSSPACEFILETYPE 11595 // ObjectType -#define UA_NS0ID_NAMESPACEMETADATATYPE 11616 // ObjectType -#define UA_NS0ID_NAMESPACESTYPE 11645 // ObjectType -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXARRAYLENGTH 11702 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXSTRINGLENGTH 11703 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS 11704 // Object -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERREAD 11705 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERWRITE 11707 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERMETHODCALL 11709 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERBROWSE 11710 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERREGISTERNODES 11711 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERTRANSLATEBROWSEPATHSTONODEIDS 11712 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERNODEMANAGEMENT 11713 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXMONITOREDITEMSPERCALL 11714 // Variable -#define UA_NS0ID_SERVER_NAMESPACES 11715 // Object -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE 11716 // Object -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_SIZE 11717 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_OPENCOUNT 11720 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_OPEN 11721 // Method -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_OPEN_INPUTARGUMENTS 11722 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_OPEN_OUTPUTARGUMENTS 11723 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_CLOSE 11724 // Method -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_CLOSE_INPUTARGUMENTS 11725 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_READ 11726 // Method -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_READ_INPUTARGUMENTS 11727 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_READ_OUTPUTARGUMENTS 11728 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_WRITE 11729 // Method -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_WRITE_INPUTARGUMENTS 11730 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_GETPOSITION 11731 // Method -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_GETPOSITION_INPUTARGUMENTS 11732 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_GETPOSITION_OUTPUTARGUMENTS 11733 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_SETPOSITION 11734 // Method -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_SETPOSITION_INPUTARGUMENTS 11735 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_EXPORTNAMESPACE 11736 // Method -#define UA_NS0ID_BITFIELDMASKDATATYPE 11737 // DataType -#define UA_NS0ID_OPENMETHODTYPE 11738 // Method -#define UA_NS0ID_CLOSEMETHODTYPE 11741 // Method -#define UA_NS0ID_READMETHODTYPE 11743 // Method -#define UA_NS0ID_WRITEMETHODTYPE 11746 // Method -#define UA_NS0ID_GETPOSITIONMETHODTYPE 11748 // Method -#define UA_NS0ID_SETPOSITIONMETHODTYPE 11751 // Method -#define UA_NS0ID_SYSTEMOFFNORMALALARMTYPE 11753 // ObjectType -#define UA_NS0ID_AUDITPROGRAMTRANSITIONEVENTTYPE 11856 // ObjectType -#define UA_NS0ID_HACONFIGURATION_AGGREGATEFUNCTIONS 11877 // Object -#define UA_NS0ID_NODECLASS_ENUMVALUES 11878 // Variable -#define UA_NS0ID_INSTANCENODE 11879 // DataType -#define UA_NS0ID_TYPENODE 11880 // DataType -#define UA_NS0ID_NODEATTRIBUTESMASK_ENUMVALUES 11881 // Variable -#define UA_NS0ID_ATTRIBUTEWRITEMASK_ENUMVALUES 11882 // Variable -#define UA_NS0ID_BROWSERESULTMASK_ENUMVALUES 11883 // Variable -#define UA_NS0ID_INSTANCENODE_ENCODING_DEFAULTXML 11887 // Object -#define UA_NS0ID_TYPENODE_ENCODING_DEFAULTXML 11888 // Object -#define UA_NS0ID_INSTANCENODE_ENCODING_DEFAULTBINARY 11889 // Object -#define UA_NS0ID_TYPENODE_ENCODING_DEFAULTBINARY 11890 // Object -#define UA_NS0ID_OPENFILEMODE 11939 // DataType -#define UA_NS0ID_OPENFILEMODE_ENUMVALUES 11940 // Variable -#define UA_NS0ID_MODELCHANGESTRUCTUREVERBMASK 11941 // DataType -#define UA_NS0ID_MODELCHANGESTRUCTUREVERBMASK_ENUMVALUES 11942 // Variable -#define UA_NS0ID_ENDPOINTURLLISTDATATYPE 11943 // DataType -#define UA_NS0ID_NETWORKGROUPDATATYPE 11944 // DataType -#define UA_NS0ID_NONTRANSPARENTNETWORKREDUNDANCYTYPE 11945 // ObjectType -#define UA_NS0ID_ARRAYITEMTYPE 12021 // VariableType -#define UA_NS0ID_YARRAYITEMTYPE 12029 // VariableType -#define UA_NS0ID_XYARRAYITEMTYPE 12038 // VariableType -#define UA_NS0ID_IMAGEITEMTYPE 12047 // VariableType -#define UA_NS0ID_CUBEITEMTYPE 12057 // VariableType -#define UA_NS0ID_NDIMENSIONARRAYITEMTYPE 12068 // VariableType -#define UA_NS0ID_AXISSCALEENUMERATION 12077 // DataType -#define UA_NS0ID_AXISSCALEENUMERATION_ENUMSTRINGS 12078 // Variable -#define UA_NS0ID_AXISINFORMATION 12079 // DataType -#define UA_NS0ID_XVTYPE 12080 // DataType -#define UA_NS0ID_AXISINFORMATION_ENCODING_DEFAULTXML 12081 // Object -#define UA_NS0ID_AXISINFORMATION_ENCODING_DEFAULTBINARY 12089 // Object -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERHISTORYREADDATA 12165 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERHISTORYREADEVENTS 12166 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERHISTORYUPDATEDATA 12167 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_OPERATIONLIMITS_MAXNODESPERHISTORYUPDATEEVENTS 12168 // Variable -#define UA_NS0ID_VIEWVERSION 12170 // Variable -#define UA_NS0ID_COMPLEXNUMBERTYPE 12171 // DataType -#define UA_NS0ID_DOUBLECOMPLEXNUMBERTYPE 12172 // DataType -#define UA_NS0ID_SERVERONNETWORK 12189 // DataType -#define UA_NS0ID_FINDSERVERSONNETWORKREQUEST 12190 // DataType -#define UA_NS0ID_FINDSERVERSONNETWORKRESPONSE 12191 // DataType -#define UA_NS0ID_REGISTERSERVER2REQUEST 12193 // DataType -#define UA_NS0ID_REGISTERSERVER2RESPONSE 12194 // DataType -#define UA_NS0ID_SERVERONNETWORK_ENCODING_DEFAULTXML 12195 // Object -#define UA_NS0ID_FINDSERVERSONNETWORKREQUEST_ENCODING_DEFAULTXML 12196 // Object -#define UA_NS0ID_FINDSERVERSONNETWORKRESPONSE_ENCODING_DEFAULTXML 12197 // Object -#define UA_NS0ID_REGISTERSERVER2REQUEST_ENCODING_DEFAULTXML 12199 // Object -#define UA_NS0ID_REGISTERSERVER2RESPONSE_ENCODING_DEFAULTXML 12200 // Object -#define UA_NS0ID_SERVERONNETWORK_ENCODING_DEFAULTBINARY 12207 // Object -#define UA_NS0ID_FINDSERVERSONNETWORKREQUEST_ENCODING_DEFAULTBINARY 12208 // Object -#define UA_NS0ID_FINDSERVERSONNETWORKRESPONSE_ENCODING_DEFAULTBINARY 12209 // Object -#define UA_NS0ID_REGISTERSERVER2REQUEST_ENCODING_DEFAULTBINARY 12211 // Object -#define UA_NS0ID_REGISTERSERVER2RESPONSE_ENCODING_DEFAULTBINARY 12212 // Object -#define UA_NS0ID_OPENWITHMASKSMETHODTYPE 12513 // Method -#define UA_NS0ID_CLOSEANDUPDATEMETHODTYPE 12516 // Method -#define UA_NS0ID_ADDCERTIFICATEMETHODTYPE 12518 // Method -#define UA_NS0ID_REMOVECERTIFICATEMETHODTYPE 12520 // Method -#define UA_NS0ID_TRUSTLISTTYPE 12522 // ObjectType -#define UA_NS0ID_TRUSTLISTMASKS 12552 // DataType -#define UA_NS0ID_TRUSTLISTMASKS_ENUMVALUES 12553 // Variable -#define UA_NS0ID_TRUSTLISTDATATYPE 12554 // DataType -#define UA_NS0ID_CERTIFICATEGROUPTYPE 12555 // ObjectType -#define UA_NS0ID_CERTIFICATETYPE 12556 // ObjectType -#define UA_NS0ID_APPLICATIONCERTIFICATETYPE 12557 // ObjectType -#define UA_NS0ID_HTTPSCERTIFICATETYPE 12558 // ObjectType -#define UA_NS0ID_RSAMINAPPLICATIONCERTIFICATETYPE 12559 // ObjectType -#define UA_NS0ID_RSASHA256APPLICATIONCERTIFICATETYPE 12560 // ObjectType -#define UA_NS0ID_TRUSTLISTUPDATEDAUDITEVENTTYPE 12561 // ObjectType -#define UA_NS0ID_UPDATECERTIFICATEMETHODTYPE 12578 // Method -#define UA_NS0ID_SERVERCONFIGURATIONTYPE 12581 // ObjectType -#define UA_NS0ID_CERTIFICATEUPDATEDAUDITEVENTTYPE 12620 // ObjectType -#define UA_NS0ID_SERVERCONFIGURATION 12637 // Object -#define UA_NS0ID_SERVERCONFIGURATION_SUPPORTEDPRIVATEKEYFORMATS 12639 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_MAXTRUSTLISTSIZE 12640 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_MULTICASTDNSENABLED 12641 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST 12642 // Object -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_SIZE 12643 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_OPENCOUNT 12646 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_OPEN 12647 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_OPEN_INPUTARGUMENTS 12648 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_OPEN_OUTPUTARGUMENTS 12649 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_CLOSE 12650 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_CLOSE_INPUTARGUMENTS 12651 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_READ 12652 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_READ_INPUTARGUMENTS 12653 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_READ_OUTPUTARGUMENTS 12654 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_WRITE 12655 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_WRITE_INPUTARGUMENTS 12656 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_GETPOSITION 12657 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_GETPOSITION_INPUTARGUMENTS 12658 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_GETPOSITION_OUTPUTARGUMENTS 12659 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_SETPOSITION 12660 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_SETPOSITION_INPUTARGUMENTS 12661 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_LASTUPDATETIME 12662 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_OPENWITHMASKS 12663 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_OPENWITHMASKS_INPUTARGUMENTS 12664 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_OPENWITHMASKS_OUTPUTARGUMENTS 12665 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_CLOSEANDUPDATE 12666 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_CLOSEANDUPDATE_OUTPUTARGUMENTS 12667 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_ADDCERTIFICATE 12668 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_ADDCERTIFICATE_INPUTARGUMENTS 12669 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_REMOVECERTIFICATE 12670 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_REMOVECERTIFICATE_INPUTARGUMENTS 12671 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_WRITABLE 12696 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_USERWRITABLE 12697 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_SERVERCAPABILITIES 12710 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CREATESIGNINGREQUEST 12737 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CREATESIGNINGREQUEST_INPUTARGUMENTS 12738 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CREATESIGNINGREQUEST_OUTPUTARGUMENTS 12739 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_APPLYCHANGES 12740 // Method -#define UA_NS0ID_CREATESIGNINGREQUESTMETHODTYPE 12741 // Method -#define UA_NS0ID_OPTIONSETVALUES 12745 // Variable -#define UA_NS0ID_SERVER_SETSUBSCRIPTIONDURABLE 12749 // Method -#define UA_NS0ID_SERVER_SETSUBSCRIPTIONDURABLE_INPUTARGUMENTS 12750 // Variable -#define UA_NS0ID_SERVER_SETSUBSCRIPTIONDURABLE_OUTPUTARGUMENTS 12751 // Variable -#define UA_NS0ID_SETSUBSCRIPTIONDURABLEMETHODTYPE 12752 // Method -#define UA_NS0ID_OPTIONSET 12755 // DataType -#define UA_NS0ID_UNION 12756 // DataType -#define UA_NS0ID_OPTIONSET_ENCODING_DEFAULTXML 12757 // Object -#define UA_NS0ID_UNION_ENCODING_DEFAULTXML 12758 // Object -#define UA_NS0ID_OPTIONSET_ENCODING_DEFAULTBINARY 12765 // Object -#define UA_NS0ID_UNION_ENCODING_DEFAULTBINARY 12766 // Object -#define UA_NS0ID_GETREJECTEDLISTMETHODTYPE 12773 // Method -#define UA_NS0ID_SERVERCONFIGURATION_GETREJECTEDLIST 12777 // Method -#define UA_NS0ID_SERVERCONFIGURATION_GETREJECTEDLIST_OUTPUTARGUMENTS 12778 // Variable -#define UA_NS0ID_SERVER_RESENDDATA 12873 // Method -#define UA_NS0ID_SERVER_RESENDDATA_INPUTARGUMENTS 12874 // Variable -#define UA_NS0ID_RESENDDATAMETHODTYPE 12875 // Method -#define UA_NS0ID_NORMALIZEDSTRING 12877 // DataType -#define UA_NS0ID_DECIMALSTRING 12878 // DataType -#define UA_NS0ID_DURATIONSTRING 12879 // DataType -#define UA_NS0ID_TIMESTRING 12880 // DataType -#define UA_NS0ID_DATESTRING 12881 // DataType -#define UA_NS0ID_SERVER_ESTIMATEDRETURNTIME 12885 // Variable -#define UA_NS0ID_SERVER_REQUESTSERVERSTATECHANGE 12886 // Method -#define UA_NS0ID_SERVER_REQUESTSERVERSTATECHANGE_INPUTARGUMENTS 12887 // Variable -#define UA_NS0ID_REQUESTSERVERSTATECHANGEMETHODTYPE 12888 // Method -#define UA_NS0ID_DISCOVERYCONFIGURATION 12890 // DataType -#define UA_NS0ID_MDNSDISCOVERYCONFIGURATION 12891 // DataType -#define UA_NS0ID_DISCOVERYCONFIGURATION_ENCODING_DEFAULTXML 12892 // Object -#define UA_NS0ID_MDNSDISCOVERYCONFIGURATION_ENCODING_DEFAULTXML 12893 // Object -#define UA_NS0ID_DISCOVERYCONFIGURATION_ENCODING_DEFAULTBINARY 12900 // Object -#define UA_NS0ID_MDNSDISCOVERYCONFIGURATION_ENCODING_DEFAULTBINARY 12901 // Object -#define UA_NS0ID_MAXBYTESTRINGLENGTH 12908 // Variable -#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXBYTESTRINGLENGTH 12911 // Variable -#define UA_NS0ID_CONDITIONREFRESH2METHODTYPE 12914 // Method -#define UA_NS0ID_CERTIFICATEEXPIRATIONALARMTYPE 13225 // ObjectType -#define UA_NS0ID_CREATEDIRECTORYMETHODTYPE 13342 // Method -#define UA_NS0ID_CREATEFILEMETHODTYPE 13345 // Method -#define UA_NS0ID_DELETEFILEMETHODTYPE 13348 // Method -#define UA_NS0ID_MOVEORCOPYMETHODTYPE 13350 // Method -#define UA_NS0ID_FILEDIRECTORYTYPE 13353 // ObjectType -#define UA_NS0ID_SERVER_NAMESPACES_ADDRESSSPACEFILE_MIMETYPE 13402 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_UPDATECERTIFICATE 13737 // Method -#define UA_NS0ID_SERVERCONFIGURATION_UPDATECERTIFICATE_INPUTARGUMENTS 13738 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_UPDATECERTIFICATE_OUTPUTARGUMENTS 13739 // Variable -#define UA_NS0ID_CERTIFICATEGROUPFOLDERTYPE 13813 // ObjectType -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS 14053 // Object -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP 14088 // Object -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST 14089 // Object -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_SIZE 14090 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_WRITABLE 14091 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_USERWRITABLE 14092 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_OPENCOUNT 14093 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_MIMETYPE 14094 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_OPEN 14095 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_OPEN_INPUTARGUMENTS 14096 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_OPEN_OUTPUTARGUMENTS 14097 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_CLOSE 14098 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_CLOSE_INPUTARGUMENTS 14099 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_READ 14100 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_READ_INPUTARGUMENTS 14101 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_READ_OUTPUTARGUMENTS 14102 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_WRITE 14103 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_WRITE_INPUTARGUMENTS 14104 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_GETPOSITION 14105 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_GETPOSITION_INPUTARGUMENTS 14106 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_GETPOSITION_OUTPUTARGUMENTS 14107 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_SETPOSITION 14108 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_SETPOSITION_INPUTARGUMENTS 14109 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_LASTUPDATETIME 14110 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_OPENWITHMASKS 14111 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_OPENWITHMASKS_INPUTARGUMENTS 14112 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_OPENWITHMASKS_OUTPUTARGUMENTS 14113 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_CLOSEANDUPDATE 14114 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_CLOSEANDUPDATE_INPUTARGUMENTS 14115 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_CLOSEANDUPDATE_OUTPUTARGUMENTS 14116 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_ADDCERTIFICATE 14117 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_ADDCERTIFICATE_INPUTARGUMENTS 14118 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_REMOVECERTIFICATE 14119 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_TRUSTLIST_REMOVECERTIFICATE_INPUTARGUMENTS 14120 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTHTTPSGROUP_CERTIFICATETYPES 14121 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP 14122 // Object -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST 14123 // Object -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_SIZE 14124 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_WRITABLE 14125 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_USERWRITABLE 14126 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_OPENCOUNT 14127 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_MIMETYPE 14128 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_OPEN 14129 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_OPEN_INPUTARGUMENTS 14130 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_OPEN_OUTPUTARGUMENTS 14131 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_CLOSE 14132 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_CLOSE_INPUTARGUMENTS 14133 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_READ 14134 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_READ_INPUTARGUMENTS 14135 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_READ_OUTPUTARGUMENTS 14136 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_WRITE 14137 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_WRITE_INPUTARGUMENTS 14138 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_GETPOSITION 14139 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_GETPOSITION_INPUTARGUMENTS 14140 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_GETPOSITION_OUTPUTARGUMENTS 14141 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_SETPOSITION 14142 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_SETPOSITION_INPUTARGUMENTS 14143 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_LASTUPDATETIME 14144 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_OPENWITHMASKS 14145 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_OPENWITHMASKS_INPUTARGUMENTS 14146 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_OPENWITHMASKS_OUTPUTARGUMENTS 14147 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_CLOSEANDUPDATE 14148 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_CLOSEANDUPDATE_INPUTARGUMENTS 14149 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_CLOSEANDUPDATE_OUTPUTARGUMENTS 14150 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_ADDCERTIFICATE 14151 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_ADDCERTIFICATE_INPUTARGUMENTS 14152 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_REMOVECERTIFICATE 14153 // Method -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_TRUSTLIST_REMOVECERTIFICATE_INPUTARGUMENTS 14154 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTUSERTOKENGROUP_CERTIFICATETYPES 14155 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP 14156 // Object -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_WRITABLE 14157 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_USERWRITABLE 14158 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_MIMETYPE 14159 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_TRUSTLIST_CLOSEANDUPDATE_INPUTARGUMENTS 14160 // Variable -#define UA_NS0ID_SERVERCONFIGURATION_CERTIFICATEGROUPS_DEFAULTAPPLICATIONGROUP_CERTIFICATETYPES 14161 // Variable -#define UA_NS0ID_SERVER_SERVERREDUNDANCY_SERVERNETWORKGROUPS 14415 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI 15182 // Object -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEURI 15183 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEVERSION 15184 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEPUBLICATIONDATE 15185 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_ISNAMESPACESUBSET 15186 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_STATICNODEIDTYPES 15187 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_STATICNUMERICNODEIDRANGE 15188 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_STATICSTRINGNODEIDPATTERN 15189 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE 15190 // Object -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_SIZE 15191 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_WRITABLE 15192 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_USERWRITABLE 15193 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_OPENCOUNT 15194 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_MIMETYPE 15195 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_OPEN 15196 // Method -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_OPEN_INPUTARGUMENTS 15197 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_OPEN_OUTPUTARGUMENTS 15198 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_CLOSE 15199 // Method -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_CLOSE_INPUTARGUMENTS 15200 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_READ 15201 // Method -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_READ_INPUTARGUMENTS 15202 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_READ_OUTPUTARGUMENTS 15203 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_WRITE 15204 // Method -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_WRITE_INPUTARGUMENTS 15205 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_GETPOSITION 15206 // Method -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_GETPOSITION_INPUTARGUMENTS 15207 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_GETPOSITION_OUTPUTARGUMENTS 15208 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_SETPOSITION 15209 // Method -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_SETPOSITION_INPUTARGUMENTS 15210 // Variable -#define UA_NS0ID_SERVER_NAMESPACES_OPCUANAMESPACEURI_NAMESPACEFILE_EXPORTNAMESPACE 15211 // Method -#define UA_NS0ID_HASMODELPARENT 50 // ReferenceType - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_types.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -#define UA_BUILTIN_TYPES_COUNT 25U - -/** - * .. _types: - * - * Data Types - * ========== - * - * The OPC UA protocol defines 25 builtin data types and three ways of combining - * them into higher-order types: arrays, structures and unions. In open62541, - * only the builtin data types are defined manually. All other data types are - * generated from standard XML definitions. Their exact definitions can be - * looked up at https://opcfoundation.org/UA/schemas/Opc.Ua.Types.bsd.xml. - * - * For users that are new to open62541, take a look at the :ref:`tutorial for - * working with data types` before diving into the - * implementation details. - * - * Builtin Types - * ------------- - * - * Boolean - * ^^^^^^^ - * A two-state logical value (true or false). */ -typedef bool UA_Boolean; -#define UA_TRUE true -#define UA_FALSE false - -/** - * SByte - * ^^^^^ - * An integer value between -128 and 127. */ -typedef int8_t UA_SByte; -#define UA_SBYTE_MIN (-128) -#define UA_SBYTE_MAX 127 - -/** - * Byte - * ^^^^ - * An integer value between 0 and 255. */ -typedef uint8_t UA_Byte; -#define UA_BYTE_MIN 0 -#define UA_BYTE_MAX 255 - -/** - * Int16 - * ^^^^^ - * An integer value between -32 768 and 32 767. */ -typedef int16_t UA_Int16; -#define UA_INT16_MIN (-32768) -#define UA_INT16_MAX 32767 - -/** - * UInt16 - * ^^^^^^ - * An integer value between 0 and 65 535. */ -typedef uint16_t UA_UInt16; -#define UA_UINT16_MIN 0 -#define UA_UINT16_MAX 65535 - -/** - * Int32 - * ^^^^^ - * An integer value between -2 147 483 648 and 2 147 483 647. */ -typedef int32_t UA_Int32; -#define UA_INT32_MIN (-2147483648) -#define UA_INT32_MAX 2147483647 - -/** - * UInt32 - * ^^^^^^ - * An integer value between 0 and 4 294 967 295. */ -typedef uint32_t UA_UInt32; -#define UA_UINT32_MIN 0 -#define UA_UINT32_MAX 4294967295 - -/** - * Int64 - * ^^^^^ - * An integer value between -9 223 372 036 854 775 808 and - * 9 223 372 036 854 775 807. */ -typedef int64_t UA_Int64; -#define UA_INT64_MIN ((int64_t)-9223372036854775808) -#define UA_INT64_MAX (int64_t)9223372036854775807 - -/** - * UInt64 - * ^^^^^^ - * An integer value between 0 and 18 446 744 073 709 551 615. */ -typedef uint64_t UA_UInt64; -#define UA_UINT64_MIN (int64_t)0 -#define UA_UINT64_MAX (int64_t)18446744073709551615 - -/** - * Float - * ^^^^^ - * An IEEE single precision (32 bit) floating point value. */ -typedef float UA_Float; - -/** - * Double - * ^^^^^^ - * An IEEE double precision (64 bit) floating point value. */ -typedef double UA_Double; - -/** - * .. _statuscode: - * - * StatusCode - * ^^^^^^^^^^ - * A numeric identifier for a error or condition that is associated with a value - * or an operation. See the section :ref:`statuscodes` for the meaning of a - * specific code. */ -typedef uint32_t UA_StatusCode; - -/* Returns the human-readable name of the StatusCode. If no matching StatusCode - * is found, a default string for "Unknown" is returned. This feature might be - * disabled to create a smaller binary with the - * UA_ENABLE_STATUSCODE_DESCRIPTIONS build-flag. Then the function returns an - * empty string for every StatusCode. */ -UA_EXPORT const char * -UA_StatusCode_name(UA_StatusCode code); - -/** - * String - * ^^^^^^ - * A sequence of Unicode characters. Strings are just an array of UA_Byte. */ -typedef struct { - size_t length; /* The length of the string */ - UA_Byte *data; /* The content (not null-terminated) */ -} UA_String; - -/* Copies the content on the heap. Returns a null-string when alloc fails */ -UA_String UA_EXPORT UA_String_fromChars(char const src[]) UA_FUNC_ATTR_WARN_UNUSED_RESULT; - -UA_Boolean UA_EXPORT UA_String_equal(const UA_String *s1, const UA_String *s2); - -UA_EXPORT extern const UA_String UA_STRING_NULL; - -/** - * ``UA_STRING`` returns a string pointing to the original char-array. - * ``UA_STRING_ALLOC`` is shorthand for ``UA_String_fromChars`` and makes a copy - * of the char-array. */ -static UA_INLINE UA_String -UA_STRING(char *chars) { - UA_String str; str.length = strlen(chars); - str.data = (UA_Byte*)chars; return str; -} - -#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS) - -/** - * .. _datetime: - * - * DateTime - * ^^^^^^^^ - * An instance in time. A DateTime value is encoded as a 64-bit signed integer - * which represents the number of 100 nanosecond intervals since January 1, 1601 - * (UTC). - * - * The methods providing an interface to the system clock are provided by a - * "plugin" that is statically linked with the library. */ - -typedef int64_t UA_DateTime; - -/* Multiples to convert durations to DateTime */ -#define UA_DATETIME_USEC 10LL -#define UA_DATETIME_MSEC (UA_DATETIME_USEC * 1000LL) -#define UA_DATETIME_SEC (UA_DATETIME_MSEC * 1000LL) - -/* The current time in UTC time */ -UA_DateTime UA_EXPORT UA_DateTime_now(void); - -/* Offset between local time and UTC time */ -UA_Int64 UA_EXPORT UA_DateTime_localTimeUtcOffset(void); - -/* CPU clock invariant to system time changes. Use only to measure durations, - * not absolute time. */ -UA_DateTime UA_EXPORT UA_DateTime_nowMonotonic(void); - -/* Represents a Datetime as a structure */ -typedef struct UA_DateTimeStruct { - UA_UInt16 nanoSec; - UA_UInt16 microSec; - UA_UInt16 milliSec; - UA_UInt16 sec; - UA_UInt16 min; - UA_UInt16 hour; - UA_UInt16 day; - UA_UInt16 month; - UA_UInt16 year; -} UA_DateTimeStruct; - -UA_DateTimeStruct UA_EXPORT UA_DateTime_toStruct(UA_DateTime t); - -/* The C99 standard (7.23.1) says: "The range and precision of times - * representable in clock_t and time_t are implementation-defined." On most - * systems, time_t is a 4 or 8 byte integer counting seconds since the UTC Unix - * epoch. The following methods are used for conversion. */ - -/* Datetime of 1 Jan 1970 00:00 */ -#define UA_DATETIME_UNIX_EPOCH (11644473600LL * UA_DATETIME_SEC) - -static UA_INLINE UA_Int64 -UA_DateTime_toUnixTime(UA_DateTime date) { - return (date - UA_DATETIME_UNIX_EPOCH) / UA_DATETIME_SEC; -} - -static UA_INLINE UA_DateTime -UA_DateTime_fromUnixTime(UA_Int64 unixDate) { - return (unixDate * UA_DATETIME_SEC) + UA_DATETIME_UNIX_EPOCH; -} - -/** - * Guid - * ^^^^ - * A 16 byte value that can be used as a globally unique identifier. */ -typedef struct { - UA_UInt32 data1; - UA_UInt16 data2; - UA_UInt16 data3; - UA_Byte data4[8]; -} UA_Guid; - -UA_Boolean UA_EXPORT UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2); - -UA_EXPORT extern const UA_Guid UA_GUID_NULL; - -/** - * ByteString - * ^^^^^^^^^^ - * A sequence of octets. */ -typedef UA_String UA_ByteString; - -static UA_INLINE UA_Boolean -UA_ByteString_equal(const UA_ByteString *string1, - const UA_ByteString *string2) { - return UA_String_equal((const UA_String*)string1, - (const UA_String*)string2); -} - -/* Allocates memory of size length for the bytestring. - * The content is not set to zero. */ -UA_StatusCode UA_EXPORT -UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length); - -UA_EXPORT extern const UA_ByteString UA_BYTESTRING_NULL; - -static UA_INLINE UA_ByteString -UA_BYTESTRING(char *chars) { - UA_ByteString str; str.length = strlen(chars); - str.data = (UA_Byte*)chars; return str; -} - -static UA_INLINE UA_ByteString -UA_BYTESTRING_ALLOC(const char *chars) { - UA_String str = UA_String_fromChars(chars); UA_ByteString bstr; - bstr.length = str.length; bstr.data = str.data; return bstr; -} - -/** - * XmlElement - * ^^^^^^^^^^ - * An XML element. */ -typedef UA_String UA_XmlElement; - -/** - * .. _nodeid: - * - * NodeId - * ^^^^^^ - * An identifier for a node in the address space of an OPC UA Server. */ -enum UA_NodeIdType { - UA_NODEIDTYPE_NUMERIC = 0, /* In the binary encoding, this can also - become 1 or 2 (2byte and 4byte encoding of - small numeric nodeids) */ - UA_NODEIDTYPE_STRING = 3, - UA_NODEIDTYPE_GUID = 4, - UA_NODEIDTYPE_BYTESTRING = 5 -}; - -typedef struct { - UA_UInt16 namespaceIndex; - enum UA_NodeIdType identifierType; - union { - UA_UInt32 numeric; - UA_String string; - UA_Guid guid; - UA_ByteString byteString; - } identifier; -} UA_NodeId; - -UA_EXPORT extern const UA_NodeId UA_NODEID_NULL; - -UA_Boolean UA_EXPORT UA_NodeId_isNull(const UA_NodeId *p); - -UA_Boolean UA_EXPORT UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2); - -/* Returns a non-cryptographic hash for the NodeId */ -UA_UInt32 UA_EXPORT UA_NodeId_hash(const UA_NodeId *n); - -/** The following functions are shorthand for creating NodeIds. */ -static UA_INLINE UA_NodeId -UA_NODEID_NUMERIC(UA_UInt16 nsIndex, UA_UInt32 identifier) { - UA_NodeId id; id.namespaceIndex = nsIndex; - id.identifierType = UA_NODEIDTYPE_NUMERIC; - id.identifier.numeric = identifier; return id; -} - -static UA_INLINE UA_NodeId -UA_NODEID_STRING(UA_UInt16 nsIndex, char *chars) { - UA_NodeId id; id.namespaceIndex = nsIndex; - id.identifierType = UA_NODEIDTYPE_STRING; - id.identifier.string = UA_STRING(chars); return id; -} - -static UA_INLINE UA_NodeId -UA_NODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars) { - UA_NodeId id; id.namespaceIndex = nsIndex; - id.identifierType = UA_NODEIDTYPE_STRING; - id.identifier.string = UA_STRING_ALLOC(chars); return id; -} - -static UA_INLINE UA_NodeId -UA_NODEID_GUID(UA_UInt16 nsIndex, UA_Guid guid) { - UA_NodeId id; id.namespaceIndex = nsIndex; - id.identifierType = UA_NODEIDTYPE_GUID; - id.identifier.guid = guid; return id; -} - -static UA_INLINE UA_NodeId -UA_NODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars) { - UA_NodeId id; id.namespaceIndex = nsIndex; - id.identifierType = UA_NODEIDTYPE_BYTESTRING; - id.identifier.byteString = UA_BYTESTRING(chars); return id; -} - -static UA_INLINE UA_NodeId -UA_NODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex, const char *chars) { - UA_NodeId id; id.namespaceIndex = nsIndex; - id.identifierType = UA_NODEIDTYPE_BYTESTRING; - id.identifier.byteString = UA_BYTESTRING_ALLOC(chars); return id; -} - -/** - * ExpandedNodeId - * ^^^^^^^^^^^^^^ - * A NodeId that allows the namespace URI to be specified instead of an index. */ -typedef struct { - UA_NodeId nodeId; - UA_String namespaceUri; - UA_UInt32 serverIndex; -} UA_ExpandedNodeId; - -UA_EXPORT extern const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL; - -/** The following functions are shorthand for creating ExpandedNodeIds. */ -static UA_INLINE UA_ExpandedNodeId -UA_EXPANDEDNODEID_NUMERIC(UA_UInt16 nsIndex, UA_UInt32 identifier) { - UA_ExpandedNodeId id; id.nodeId = UA_NODEID_NUMERIC(nsIndex, identifier); - id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; -} - -static UA_INLINE UA_ExpandedNodeId -UA_EXPANDEDNODEID_STRING(UA_UInt16 nsIndex, char *chars) { - UA_ExpandedNodeId id; id.nodeId = UA_NODEID_STRING(nsIndex, chars); - id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; -} - -static UA_INLINE UA_ExpandedNodeId -UA_EXPANDEDNODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars) { - UA_ExpandedNodeId id; id.nodeId = UA_NODEID_STRING_ALLOC(nsIndex, chars); - id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; -} - -static UA_INLINE UA_ExpandedNodeId -UA_EXPANDEDNODEID_STRING_GUID(UA_UInt16 nsIndex, UA_Guid guid) { - UA_ExpandedNodeId id; id.nodeId = UA_NODEID_GUID(nsIndex, guid); - id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; -} - -static UA_INLINE UA_ExpandedNodeId -UA_EXPANDEDNODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars) { - UA_ExpandedNodeId id; id.nodeId = UA_NODEID_BYTESTRING(nsIndex, chars); - id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; -} - -static UA_INLINE UA_ExpandedNodeId -UA_EXPANDEDNODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex, const char *chars) { - UA_ExpandedNodeId id; id.nodeId = UA_NODEID_BYTESTRING_ALLOC(nsIndex, chars); - id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; -} - -/** - * .. _qualifiedname: - * - * QualifiedName - * ^^^^^^^^^^^^^ - * A name qualified by a namespace. */ -typedef struct { - UA_UInt16 namespaceIndex; - UA_String name; -} UA_QualifiedName; - -static UA_INLINE UA_Boolean -UA_QualifiedName_isNull(const UA_QualifiedName *q) { - return (q->namespaceIndex == 0 && q->name.length == 0); -} - -static UA_INLINE UA_QualifiedName -UA_QUALIFIEDNAME(UA_UInt16 nsIndex, char *chars) { - UA_QualifiedName qn; qn.namespaceIndex = nsIndex; - qn.name = UA_STRING(chars); return qn; -} - -static UA_INLINE UA_QualifiedName -UA_QUALIFIEDNAME_ALLOC(UA_UInt16 nsIndex, const char *chars) { - UA_QualifiedName qn; qn.namespaceIndex = nsIndex; - qn.name = UA_STRING_ALLOC(chars); return qn; -} - -/** - * LocalizedText - * ^^^^^^^^^^^^^ - * Human readable text with an optional locale identifier. */ -typedef struct { - UA_String locale; - UA_String text; -} UA_LocalizedText; - -static UA_INLINE UA_LocalizedText -UA_LOCALIZEDTEXT(char *locale, char *text) { - UA_LocalizedText lt; lt.locale = UA_STRING(locale); - lt.text = UA_STRING(text); return lt; -} - -static UA_INLINE UA_LocalizedText -UA_LOCALIZEDTEXT_ALLOC(const char *locale, const char *text) { - UA_LocalizedText lt; lt.locale = UA_STRING_ALLOC(locale); - lt.text = UA_STRING_ALLOC(text); return lt; -} - -/** - * .. _numericrange: - * - * NumericRange - * ^^^^^^^^^^^^ - * - * NumericRanges are used to indicate subsets of a (multidimensional) array. - * They no official data type in the OPC UA standard and are transmitted only - * with a string encoding, such as "1:2,0:3,5". The colon separates min/max - * index and the comma separates dimensions. A single value indicates a range - * with a single element (min==max). */ -typedef struct { - UA_UInt32 min; - UA_UInt32 max; -} UA_NumericRangeDimension; - -typedef struct { - size_t dimensionsSize; - UA_NumericRangeDimension *dimensions; -} UA_NumericRange; - -/** - * .. _variant: - * - * Variant - * ^^^^^^^ - * - * Variants may contain values of any type together with a description of the - * content. See the section on :ref:`generic-types` on how types are described. - * The standard mandates that variants contain built-in data types only. If the - * value is not of a builtin type, it is wrapped into an :ref:`extensionobject`. - * open62541 hides this wrapping transparently in the encoding layer. If the - * data type is unknown to the receiver, the variant contains the original - * ExtensionObject in binary or XML encoding. - * - * Variants may contain a scalar value or an array. For details on the handling - * of arrays, see the section on :ref:`array-handling`. Array variants can have - * an additional dimensionality (matrix, 3-tensor, ...) defined in an array of - * dimension lengths. The actual values are kept in an array of dimensions one. - * For users who work with higher-dimensions arrays directly, keep in mind that - * dimensions of higher rank are serialized first (the highest rank dimension - * has stride 1 and elements follow each other directly). Usually it is simplest - * to interact with higher-dimensional arrays via ``UA_NumericRange`` - * descriptions (see :ref:`array-handling`). - * - * To differentiate between scalar / array variants, the following definition is - * used. ``UA_Variant_isScalar`` provides simplified access to these checks. - * - * - ``arrayLength == 0 && data == NULL``: undefined array of length -1 - * - ``arrayLength == 0 && data == UA_EMPTY_ARRAY_SENTINEL``: array of length 0 - * - ``arrayLength == 0 && data > UA_EMPTY_ARRAY_SENTINEL``: scalar value - * - ``arrayLength > 0``: array of the given length - * - * Variants can also be *empty*. Then, the pointer to the type description is - * ``NULL``. */ -/* Forward declaration. See the section on Generic Type Handling */ -struct UA_DataType; -typedef struct UA_DataType UA_DataType; - -#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01) - -typedef enum { - UA_VARIANT_DATA, /* The data has the same lifecycle as the - variant */ - UA_VARIANT_DATA_NODELETE /* The data is "borrowed" by the variant and - shall not be deleted at the end of the - variant's lifecycle. */ -} UA_VariantStorageType; - -typedef struct { - const UA_DataType *type; /* The data type description */ - UA_VariantStorageType storageType; - size_t arrayLength; /* The number of elements in the data array */ - void *data; /* Points to the scalar or array data */ - size_t arrayDimensionsSize; /* The number of dimensions */ - UA_UInt32 *arrayDimensions; /* The length of each dimension */ -} UA_Variant; - -/* Returns true if the variant has no value defined (contains neither an array - * nor a scalar value). - * - * @param v The variant - * @return Is the variant empty */ -static UA_INLINE UA_Boolean -UA_Variant_isEmpty(const UA_Variant *v) { - return v->type == NULL; -} - -/* Returns true if the variant contains a scalar value. Note that empty variants - * contain an array of length -1 (undefined). - * - * @param v The variant - * @return Does the variant contain a scalar value */ -static UA_INLINE UA_Boolean -UA_Variant_isScalar(const UA_Variant *v) { - return (v->arrayLength == 0 && v->data > UA_EMPTY_ARRAY_SENTINEL); -} - -/* Returns true if the variant contains a scalar value of the given type. - * - * @param v The variant - * @param type The data type - * @return Does the variant contain a scalar value of the given type */ -static UA_INLINE UA_Boolean -UA_Variant_hasScalarType(const UA_Variant *v, const UA_DataType *type) { - return UA_Variant_isScalar(v) && type == v->type; -} - -/* Returns true if the variant contains an array of the given type. - * - * @param v The variant - * @param type The data type - * @return Does the variant contain an array of the given type */ -static UA_INLINE UA_Boolean -UA_Variant_hasArrayType(const UA_Variant *v, const UA_DataType *type) { - return (!UA_Variant_isScalar(v)) && type == v->type; -} - -/* Set the variant to a scalar value that already resides in memory. The value - * takes on the lifecycle of the variant and is deleted with it. - * - * @param v The variant - * @param p A pointer to the value data - * @param type The datatype of the value in question */ -void UA_EXPORT -UA_Variant_setScalar(UA_Variant *v, void * UA_RESTRICT p, - const UA_DataType *type); - -/* Set the variant to a scalar value that is copied from an existing variable. - * @param v The variant - * @param p A pointer to the value data - * @param type The datatype of the value - * @return Indicates whether the operation succeeded or returns an error code */ -UA_StatusCode UA_EXPORT -UA_Variant_setScalarCopy(UA_Variant *v, const void *p, - const UA_DataType *type); - -/* Set the variant to an array that already resides in memory. The array takes - * on the lifecycle of the variant and is deleted with it. - * - * @param v The variant - * @param array A pointer to the array data - * @param arraySize The size of the array - * @param type The datatype of the array */ -void UA_EXPORT -UA_Variant_setArray(UA_Variant *v, void * UA_RESTRICT array, - size_t arraySize, const UA_DataType *type); - -/* Set the variant to an array that is copied from an existing array. - * - * @param v The variant - * @param array A pointer to the array data - * @param arraySize The size of the array - * @param type The datatype of the array - * @return Indicates whether the operation succeeded or returns an error code */ -UA_StatusCode UA_EXPORT -UA_Variant_setArrayCopy(UA_Variant *v, const void *array, - size_t arraySize, const UA_DataType *type); - -/* Copy the variant, but use only a subset of the (multidimensional) array into - * a variant. Returns an error code if the variant is not an array or if the - * indicated range does not fit. - * - * @param src The source variant - * @param dst The target variant - * @param range The range of the copied data - * @return Returns UA_STATUSCODE_GOOD or an error code */ -UA_StatusCode UA_EXPORT -UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, - const UA_NumericRange range); - -/* Insert a range of data into an existing variant. The data array can't be - * reused afterwards if it contains types without a fixed size (e.g. strings) - * since the members are moved into the variant and take on its lifecycle. - * - * @param v The variant - * @param dataArray The data array. The type must match the variant - * @param dataArraySize The length of the data array. This is checked to match - * the range size. - * @param range The range of where the new data is inserted - * @return Returns UA_STATUSCODE_GOOD or an error code */ -UA_StatusCode UA_EXPORT -UA_Variant_setRange(UA_Variant *v, void * UA_RESTRICT array, - size_t arraySize, const UA_NumericRange range); - -/* Deep-copy a range of data into an existing variant. - * - * @param v The variant - * @param dataArray The data array. The type must match the variant - * @param dataArraySize The length of the data array. This is checked to match - * the range size. - * @param range The range of where the new data is inserted - * @return Returns UA_STATUSCODE_GOOD or an error code */ -UA_StatusCode UA_EXPORT -UA_Variant_setRangeCopy(UA_Variant *v, const void *array, - size_t arraySize, const UA_NumericRange range); - -/** - * .. _extensionobject: - * - * ExtensionObject - * ^^^^^^^^^^^^^^^ - * - * ExtensionObjects may contain scalars of any data type. Even those that are - * unknown to the receiver. See the section on :ref:`generic-types` on how types - * are described. If the received data type is unknown, the encoded string and - * target NodeId is stored instead of the decoded value. */ -typedef enum { - UA_EXTENSIONOBJECT_ENCODED_NOBODY = 0, - UA_EXTENSIONOBJECT_ENCODED_BYTESTRING = 1, - UA_EXTENSIONOBJECT_ENCODED_XML = 2, - UA_EXTENSIONOBJECT_DECODED = 3, - UA_EXTENSIONOBJECT_DECODED_NODELETE = 4 /* Don't delete the content - together with the - ExtensionObject */ -} UA_ExtensionObjectEncoding; - -typedef struct { - UA_ExtensionObjectEncoding encoding; - union { - struct { - UA_NodeId typeId; /* The nodeid of the datatype */ - UA_ByteString body; /* The bytestring of the encoded data */ - } encoded; - struct { - const UA_DataType *type; - void *data; - } decoded; - } content; -} UA_ExtensionObject; - -/** - * .. _datavalue: - * - * DataValue - * ^^^^^^^^^ - * A data value with an associated status code and timestamps. */ -typedef struct { - UA_Boolean hasValue : 1; - UA_Boolean hasStatus : 1; - UA_Boolean hasSourceTimestamp : 1; - UA_Boolean hasServerTimestamp : 1; - UA_Boolean hasSourcePicoseconds : 1; - UA_Boolean hasServerPicoseconds : 1; - UA_Variant value; - UA_StatusCode status; - UA_DateTime sourceTimestamp; - UA_UInt16 sourcePicoseconds; - UA_DateTime serverTimestamp; - UA_UInt16 serverPicoseconds; -} UA_DataValue; - -/** - * DiagnosticInfo - * ^^^^^^^^^^^^^^ - * A structure that contains detailed error and diagnostic information - * associated with a StatusCode. */ -typedef struct UA_DiagnosticInfo { - UA_Boolean hasSymbolicId : 1; - UA_Boolean hasNamespaceUri : 1; - UA_Boolean hasLocalizedText : 1; - UA_Boolean hasLocale : 1; - UA_Boolean hasAdditionalInfo : 1; - UA_Boolean hasInnerStatusCode : 1; - UA_Boolean hasInnerDiagnosticInfo : 1; - UA_Int32 symbolicId; - UA_Int32 namespaceUri; - UA_Int32 localizedText; - UA_Int32 locale; - UA_String additionalInfo; - UA_StatusCode innerStatusCode; - struct UA_DiagnosticInfo *innerDiagnosticInfo; -} UA_DiagnosticInfo; - -/** - * .. _generic-types: - * - * Generic Type Handling - * --------------------- - * - * All information about a (builtin/structured) data type is stored in a - * ``UA_DataType``. The array ``UA_TYPES`` contains the description of all - * standard-defined types. This type description is used for the following - * generic operations that work on all types: - * - * - ``void T_init(T *ptr)``: Initialize the data type. This is synonymous with - * zeroing out the memory, i.e. ``memset(ptr, 0, sizeof(T))``. - * - ``T* T_new()``: Allocate and return the memory for the data type. The - * value is already initialized. - * - ``UA_StatusCode T_copy(const T *src, T *dst)``: Copy the content of the - * data type. Returns ``UA_STATUSCODE_GOOD`` or - * ``UA_STATUSCODE_BADOUTOFMEMORY``. - * - ``void T_deleteMembers(T *ptr)``: Delete the dynamically allocated content - * of the data type and perform a ``T_init`` to reset the type. - * - ``void T_delete(T *ptr)``: Delete the content of the data type and the - * memory for the data type itself. - * - * Specializations, such as ``UA_Int32_new()`` are derived from the generic - * type operations as static inline functions. */ - -typedef struct { -#ifdef UA_ENABLE_TYPENAMES - const char *memberName; -#endif - UA_UInt16 memberTypeIndex; /* Index of the member in the array of data - types */ - UA_Byte padding; /* How much padding is there before this - member element? For arrays this is the - padding before the size_t length member. - (No padding between size_t and the - following ptr.) */ - UA_Boolean namespaceZero : 1; /* The type of the member is defined in - namespace zero. In this implementation, - types from custom namespace may contain - members from the same namespace or - namespace zero only.*/ - UA_Boolean isArray : 1; /* The member is an array */ -} UA_DataTypeMember; - -struct UA_DataType { -#ifdef UA_ENABLE_TYPENAMES - const char *typeName; -#endif - UA_NodeId typeId; /* The nodeid of the type */ - UA_UInt16 memSize; /* Size of the struct in memory */ - UA_UInt16 typeIndex; /* Index of the type in the datatypetable */ - UA_Byte membersSize; /* How many members does the type have? */ - UA_Boolean builtin : 1; /* The type is "builtin" and has dedicated de- - and encoding functions */ - UA_Boolean pointerFree : 1; /* The type (and its members) contains no - pointers that need to be freed */ - UA_Boolean overlayable : 1; /* The type has the identical memory layout in - memory and on the binary stream. */ - UA_UInt16 binaryEncodingId; /* NodeId of datatype when encoded as binary */ - //UA_UInt16 xmlEncodingId; /* NodeId of datatype when encoded as XML */ - UA_DataTypeMember *members; -}; - -/* The following is used to exclude type names in the definition of UA_DataType - * structures if the feature is disabled. */ -#ifdef UA_ENABLE_TYPENAMES -# define UA_TYPENAME(name) name, -#else -# define UA_TYPENAME(name) -#endif - -/** - * Builtin data types can be accessed as UA_TYPES[UA_TYPES_XXX], where XXX is - * the name of the data type. If only the NodeId of a type is known, use the - * following method to retrieve the data type description. */ - -/* Returns the data type description for the type's identifier or NULL if no - * matching data type was found. */ -const UA_DataType UA_EXPORT * -UA_findDataType(const UA_NodeId *typeId); - -/** The following functions are used for generic handling of data types. */ - -/* Allocates and initializes a variable of type dataType - * - * @param type The datatype description - * @return Returns the memory location of the variable or NULL if no - * memory could be allocated */ -void UA_EXPORT * UA_new(const UA_DataType *type) UA_FUNC_ATTR_MALLOC; - -/* Initializes a variable to default values - * - * @param p The memory location of the variable - * @param type The datatype description */ -static UA_INLINE void -UA_init(void *p, const UA_DataType *type) { - memset(p, 0, type->memSize); -} - -/* Copies the content of two variables. If copying fails (e.g. because no memory - * was available for an array), then dst is emptied and initialized to prevent - * memory leaks. - * - * @param src The memory location of the source variable - * @param dst The memory location of the destination variable - * @param type The datatype description - * @return Indicates whether the operation succeeded or returns an error code */ -UA_StatusCode UA_EXPORT -UA_copy(const void *src, void *dst, const UA_DataType *type); - -/* Deletes the dynamically allocated content of a variable (e.g. resets all - * arrays to undefined arrays). Afterwards, the variable can be safely deleted - * without causing memory leaks. But the variable is not initialized and may - * contain old data that is not memory-relevant. - * - * @param p The memory location of the variable - * @param type The datatype description of the variable */ -void UA_EXPORT UA_deleteMembers(void *p, const UA_DataType *type); - -/* Frees a variable and all of its content. - * - * @param p The memory location of the variable - * @param type The datatype description of the variable */ -void UA_EXPORT UA_delete(void *p, const UA_DataType *type); - -/** - * .. _array-handling: - * - * Array handling - * -------------- - * In OPC UA, arrays can have a length of zero or more with the usual meaning. - * In addition, arrays can be undefined. Then, they don't even have a length. In - * the binary encoding, this is indicated by an array of length -1. - * - * In open62541 however, we use ``size_t`` for array lengths. An undefined array - * has length 0 and the data pointer is ``NULL``. An array of length 0 also has - * length 0 but a data pointer ``UA_EMPTY_ARRAY_SENTINEL``. */ -/* Allocates and initializes an array of variables of a specific type - * - * @param size The requested array length - * @param type The datatype description - * @return Returns the memory location of the variable or NULL if no memory - could be allocated */ -void UA_EXPORT * UA_Array_new(size_t size, const UA_DataType *type) UA_FUNC_ATTR_MALLOC; - -/* Allocates and copies an array - * - * @param src The memory location of the source array - * @param size The size of the array - * @param dst The location of the pointer to the new array - * @param type The datatype of the array members - * @return Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY */ -UA_StatusCode UA_EXPORT -UA_Array_copy(const void *src, size_t size, void **dst, - const UA_DataType *type) UA_FUNC_ATTR_WARN_UNUSED_RESULT; - -/* Deletes an array. - * - * @param p The memory location of the array - * @param size The size of the array - * @param type The datatype of the array members */ -void UA_EXPORT UA_Array_delete(void *p, size_t size, const UA_DataType *type); - -/** - * Random Number Generator - * ----------------------- - * If UA_ENABLE_MULTITHREADING is defined, then the seed is stored in thread - * local storage. The seed is initialized for every thread in the - * server/client. */ -void UA_EXPORT UA_random_seed(UA_UInt64 seed); -UA_UInt32 UA_EXPORT UA_UInt32_random(void); /* no cryptographic entropy */ -UA_Guid UA_EXPORT UA_Guid_random(void); /* no cryptographic entropy */ - -/** - * .. _generated-types: - * - * Generated Data Type Definitions - * ------------------------------- - * - * The following data types were auto-generated from a definition in XML format. - * - * .. toctree:: - * - * types_generated */ - -/** - * Deprecated Data Types API - * ------------------------- - * The following definitions are deprecated and will be removed in future - * releases of open62541. */ - -typedef struct { - UA_StatusCode code; /* The numeric value of the StatusCode */ - const char* name; /* The symbolic name */ - const char* explanation; /* Short message explaining the StatusCode */ -} UA_StatusCodeDescription; - -UA_EXPORT extern const UA_StatusCodeDescription statusCodeExplanation_default; - -UA_DEPRECATED static UA_INLINE const UA_StatusCodeDescription * -UA_StatusCode_description(UA_StatusCode code) { - return &statusCodeExplanation_default; -} - -UA_DEPRECATED static UA_INLINE const char * -UA_StatusCode_explanation(UA_StatusCode code) { - return statusCodeExplanation_default.name; -} - -UA_DEPRECATED UA_String -UA_DateTime_toString(UA_DateTime t); - -/* The old DateTime conversion macros */ -UA_DEPRECATED static UA_INLINE double -deprecatedDateTimeMultiple(double multiple) { - return multiple; -} - -#define UA_USEC_TO_DATETIME deprecatedDateTimeMultiple((UA_Double)UA_DATETIME_USEC) -#define UA_MSEC_TO_DATETIME deprecatedDateTimeMultiple((UA_Double)UA_DATETIME_MSEC) -#define UA_SEC_TO_DATETIME deprecatedDateTimeMultiple((UA_Double)UA_DATETIME_SEC) -#define UA_DATETIME_TO_USEC deprecatedDateTimeMultiple(1.0 / ((UA_Double)UA_DATETIME_USEC)) -#define UA_DATETIME_TO_MSEC deprecatedDateTimeMultiple(1.0 / ((UA_Double)UA_DATETIME_MSEC)) -#define UA_DATETIME_TO_SEC deprecatedDateTimeMultiple(1.0 / ((UA_Double)UA_DATETIME_SEC)) - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_types_generated.h" ***********************************/ - -/* Generated from Opc.Ua.Types.bsd with script /home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/tools/generate_datatypes.py - * on host nmpc by user max at 2018-01-05 04:21:09 */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Every type is assigned an index in an array containing the type descriptions. - * These descriptions are used during type handling (copying, deletion, - * binary encoding, ...). */ -#define UA_TYPES_COUNT 195 -extern UA_EXPORT const UA_DataType UA_TYPES[UA_TYPES_COUNT]; - -/** - * Boolean - * ^^^^^^^ - */ -#define UA_TYPES_BOOLEAN 0 - -/** - * SByte - * ^^^^^ - */ -#define UA_TYPES_SBYTE 1 - -/** - * Byte - * ^^^^ - */ -#define UA_TYPES_BYTE 2 - -/** - * Int16 - * ^^^^^ - */ -#define UA_TYPES_INT16 3 - -/** - * UInt16 - * ^^^^^^ - */ -#define UA_TYPES_UINT16 4 - -/** - * Int32 - * ^^^^^ - */ -#define UA_TYPES_INT32 5 - -/** - * UInt32 - * ^^^^^^ - */ -#define UA_TYPES_UINT32 6 - -/** - * Int64 - * ^^^^^ - */ -#define UA_TYPES_INT64 7 - -/** - * UInt64 - * ^^^^^^ - */ -#define UA_TYPES_UINT64 8 - -/** - * Float - * ^^^^^ - */ -#define UA_TYPES_FLOAT 9 - -/** - * Double - * ^^^^^^ - */ -#define UA_TYPES_DOUBLE 10 - -/** - * String - * ^^^^^^ - */ -#define UA_TYPES_STRING 11 - -/** - * DateTime - * ^^^^^^^^ - */ -#define UA_TYPES_DATETIME 12 - -/** - * Guid - * ^^^^ - */ -#define UA_TYPES_GUID 13 - -/** - * ByteString - * ^^^^^^^^^^ - */ -#define UA_TYPES_BYTESTRING 14 - -/** - * XmlElement - * ^^^^^^^^^^ - */ -#define UA_TYPES_XMLELEMENT 15 - -/** - * NodeId - * ^^^^^^ - */ -#define UA_TYPES_NODEID 16 - -/** - * ExpandedNodeId - * ^^^^^^^^^^^^^^ - */ -#define UA_TYPES_EXPANDEDNODEID 17 - -/** - * StatusCode - * ^^^^^^^^^^ - */ -#define UA_TYPES_STATUSCODE 18 - -/** - * QualifiedName - * ^^^^^^^^^^^^^ - */ -#define UA_TYPES_QUALIFIEDNAME 19 - -/** - * LocalizedText - * ^^^^^^^^^^^^^ - */ -#define UA_TYPES_LOCALIZEDTEXT 20 - -/** - * ExtensionObject - * ^^^^^^^^^^^^^^^ - */ -#define UA_TYPES_EXTENSIONOBJECT 21 - -/** - * DataValue - * ^^^^^^^^^ - */ -#define UA_TYPES_DATAVALUE 22 - -/** - * Variant - * ^^^^^^^ - */ -#define UA_TYPES_VARIANT 23 - -/** - * DiagnosticInfo - * ^^^^^^^^^^^^^^ - */ -#define UA_TYPES_DIAGNOSTICINFO 24 - -/** - * IdType - * ^^^^^^ - * The type of identifier used in a node id. */ -typedef enum { - UA_IDTYPE_NUMERIC = 0, - UA_IDTYPE_STRING = 1, - UA_IDTYPE_GUID = 2, - UA_IDTYPE_OPAQUE = 3, - __UA_IDTYPE_FORCE32BIT = 0x7fffffff -} UA_IdType; -UA_STATIC_ASSERT(sizeof(UA_IdType) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_IDTYPE 25 - -/** - * NodeClass - * ^^^^^^^^^ - * A mask specifying the class of the node. */ -typedef enum { - UA_NODECLASS_UNSPECIFIED = 0, - UA_NODECLASS_OBJECT = 1, - UA_NODECLASS_VARIABLE = 2, - UA_NODECLASS_METHOD = 4, - UA_NODECLASS_OBJECTTYPE = 8, - UA_NODECLASS_VARIABLETYPE = 16, - UA_NODECLASS_REFERENCETYPE = 32, - UA_NODECLASS_DATATYPE = 64, - UA_NODECLASS_VIEW = 128, - __UA_NODECLASS_FORCE32BIT = 0x7fffffff -} UA_NodeClass; -UA_STATIC_ASSERT(sizeof(UA_NodeClass) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_NODECLASS 26 - -/** - * ReferenceNode - * ^^^^^^^^^^^^^ - * Specifies a reference which belongs to a node. */ -typedef struct { - UA_NodeId referenceTypeId; - UA_Boolean isInverse; - UA_ExpandedNodeId targetId; -} UA_ReferenceNode; - -#define UA_TYPES_REFERENCENODE 27 - -/** - * Argument - * ^^^^^^^^ - * An argument for a method. */ -typedef struct { - UA_String name; - UA_NodeId dataType; - UA_Int32 valueRank; - size_t arrayDimensionsSize; - UA_UInt32 *arrayDimensions; - UA_LocalizedText description; -} UA_Argument; - -#define UA_TYPES_ARGUMENT 28 - -/** - * Duration - * ^^^^^^^^ - * A period of time measured in milliseconds. */ -typedef UA_Double UA_Duration; - -#define UA_TYPES_DURATION 29 - -/** - * UtcTime - * ^^^^^^^ - * A date/time value specified in Universal Coordinated Time (UTC). */ -typedef UA_DateTime UA_UtcTime; - -#define UA_TYPES_UTCTIME 30 - -/** - * LocaleId - * ^^^^^^^^ - * An identifier for a user locale. */ -typedef UA_String UA_LocaleId; - -#define UA_TYPES_LOCALEID 31 - -/** - * TimeZoneDataType - * ^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_Int16 offset; - UA_Boolean daylightSavingInOffset; -} UA_TimeZoneDataType; - -#define UA_TYPES_TIMEZONEDATATYPE 32 - -/** - * ApplicationType - * ^^^^^^^^^^^^^^^ - * The types of applications. */ -typedef enum { - UA_APPLICATIONTYPE_SERVER = 0, - UA_APPLICATIONTYPE_CLIENT = 1, - UA_APPLICATIONTYPE_CLIENTANDSERVER = 2, - UA_APPLICATIONTYPE_DISCOVERYSERVER = 3, - __UA_APPLICATIONTYPE_FORCE32BIT = 0x7fffffff -} UA_ApplicationType; -UA_STATIC_ASSERT(sizeof(UA_ApplicationType) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_APPLICATIONTYPE 33 - -/** - * ApplicationDescription - * ^^^^^^^^^^^^^^^^^^^^^^ - * Describes an application and how to find it. */ -typedef struct { - UA_String applicationUri; - UA_String productUri; - UA_LocalizedText applicationName; - UA_ApplicationType applicationType; - UA_String gatewayServerUri; - UA_String discoveryProfileUri; - size_t discoveryUrlsSize; - UA_String *discoveryUrls; -} UA_ApplicationDescription; - -#define UA_TYPES_APPLICATIONDESCRIPTION 34 - -/** - * RequestHeader - * ^^^^^^^^^^^^^ - * The header passed with every server request. */ -typedef struct { - UA_NodeId authenticationToken; - UA_DateTime timestamp; - UA_UInt32 requestHandle; - UA_UInt32 returnDiagnostics; - UA_String auditEntryId; - UA_UInt32 timeoutHint; - UA_ExtensionObject additionalHeader; -} UA_RequestHeader; - -#define UA_TYPES_REQUESTHEADER 35 - -/** - * ResponseHeader - * ^^^^^^^^^^^^^^ - * The header passed with every server response. */ -typedef struct { - UA_DateTime timestamp; - UA_UInt32 requestHandle; - UA_StatusCode serviceResult; - UA_DiagnosticInfo serviceDiagnostics; - size_t stringTableSize; - UA_String *stringTable; - UA_ExtensionObject additionalHeader; -} UA_ResponseHeader; - -#define UA_TYPES_RESPONSEHEADER 36 - -/** - * ServiceFault - * ^^^^^^^^^^^^ - * The response returned by all services when there is a service level error. */ -typedef struct { - UA_ResponseHeader responseHeader; -} UA_ServiceFault; - -#define UA_TYPES_SERVICEFAULT 37 - -/** - * FindServersRequest - * ^^^^^^^^^^^^^^^^^^ - * Finds the servers known to the discovery server. */ -typedef struct { - UA_RequestHeader requestHeader; - UA_String endpointUrl; - size_t localeIdsSize; - UA_String *localeIds; - size_t serverUrisSize; - UA_String *serverUris; -} UA_FindServersRequest; - -#define UA_TYPES_FINDSERVERSREQUEST 38 - -/** - * FindServersResponse - * ^^^^^^^^^^^^^^^^^^^ - * Finds the servers known to the discovery server. */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t serversSize; - UA_ApplicationDescription *servers; -} UA_FindServersResponse; - -#define UA_TYPES_FINDSERVERSRESPONSE 39 - -/** - * ServerOnNetwork - * ^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_UInt32 recordId; - UA_String serverName; - UA_String discoveryUrl; - size_t serverCapabilitiesSize; - UA_String *serverCapabilities; -} UA_ServerOnNetwork; - -#define UA_TYPES_SERVERONNETWORK 40 - -/** - * FindServersOnNetworkRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_UInt32 startingRecordId; - UA_UInt32 maxRecordsToReturn; - size_t serverCapabilityFilterSize; - UA_String *serverCapabilityFilter; -} UA_FindServersOnNetworkRequest; - -#define UA_TYPES_FINDSERVERSONNETWORKREQUEST 41 - -/** - * FindServersOnNetworkResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - UA_DateTime lastCounterResetTime; - size_t serversSize; - UA_ServerOnNetwork *servers; -} UA_FindServersOnNetworkResponse; - -#define UA_TYPES_FINDSERVERSONNETWORKRESPONSE 42 - -/** - * MessageSecurityMode - * ^^^^^^^^^^^^^^^^^^^ - * The type of security to use on a message. */ -typedef enum { - UA_MESSAGESECURITYMODE_INVALID = 0, - UA_MESSAGESECURITYMODE_NONE = 1, - UA_MESSAGESECURITYMODE_SIGN = 2, - UA_MESSAGESECURITYMODE_SIGNANDENCRYPT = 3, - __UA_MESSAGESECURITYMODE_FORCE32BIT = 0x7fffffff -} UA_MessageSecurityMode; -UA_STATIC_ASSERT(sizeof(UA_MessageSecurityMode) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_MESSAGESECURITYMODE 43 - -/** - * UserTokenType - * ^^^^^^^^^^^^^ - * The possible user token types. */ -typedef enum { - UA_USERTOKENTYPE_ANONYMOUS = 0, - UA_USERTOKENTYPE_USERNAME = 1, - UA_USERTOKENTYPE_CERTIFICATE = 2, - UA_USERTOKENTYPE_ISSUEDTOKEN = 3, - __UA_USERTOKENTYPE_FORCE32BIT = 0x7fffffff -} UA_UserTokenType; -UA_STATIC_ASSERT(sizeof(UA_UserTokenType) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_USERTOKENTYPE 44 - -/** - * UserTokenPolicy - * ^^^^^^^^^^^^^^^ - * Describes a user token that can be used with a server. */ -typedef struct { - UA_String policyId; - UA_UserTokenType tokenType; - UA_String issuedTokenType; - UA_String issuerEndpointUrl; - UA_String securityPolicyUri; -} UA_UserTokenPolicy; - -#define UA_TYPES_USERTOKENPOLICY 45 - -/** - * EndpointDescription - * ^^^^^^^^^^^^^^^^^^^ - * The description of a endpoint that can be used to access a server. */ -typedef struct { - UA_String endpointUrl; - UA_ApplicationDescription server; - UA_ByteString serverCertificate; - UA_MessageSecurityMode securityMode; - UA_String securityPolicyUri; - size_t userIdentityTokensSize; - UA_UserTokenPolicy *userIdentityTokens; - UA_String transportProfileUri; - UA_Byte securityLevel; -} UA_EndpointDescription; - -#define UA_TYPES_ENDPOINTDESCRIPTION 46 - -/** - * GetEndpointsRequest - * ^^^^^^^^^^^^^^^^^^^ - * Gets the endpoints used by the server. */ -typedef struct { - UA_RequestHeader requestHeader; - UA_String endpointUrl; - size_t localeIdsSize; - UA_String *localeIds; - size_t profileUrisSize; - UA_String *profileUris; -} UA_GetEndpointsRequest; - -#define UA_TYPES_GETENDPOINTSREQUEST 47 - -/** - * GetEndpointsResponse - * ^^^^^^^^^^^^^^^^^^^^ - * Gets the endpoints used by the server. */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t endpointsSize; - UA_EndpointDescription *endpoints; -} UA_GetEndpointsResponse; - -#define UA_TYPES_GETENDPOINTSRESPONSE 48 - -/** - * RegisteredServer - * ^^^^^^^^^^^^^^^^ - * The information required to register a server with a discovery server. */ -typedef struct { - UA_String serverUri; - UA_String productUri; - size_t serverNamesSize; - UA_LocalizedText *serverNames; - UA_ApplicationType serverType; - UA_String gatewayServerUri; - size_t discoveryUrlsSize; - UA_String *discoveryUrls; - UA_String semaphoreFilePath; - UA_Boolean isOnline; -} UA_RegisteredServer; - -#define UA_TYPES_REGISTEREDSERVER 49 - -/** - * RegisterServerRequest - * ^^^^^^^^^^^^^^^^^^^^^ - * Registers a server with the discovery server. */ -typedef struct { - UA_RequestHeader requestHeader; - UA_RegisteredServer server; -} UA_RegisterServerRequest; - -#define UA_TYPES_REGISTERSERVERREQUEST 50 - -/** - * RegisterServerResponse - * ^^^^^^^^^^^^^^^^^^^^^^ - * Registers a server with the discovery server. */ -typedef struct { - UA_ResponseHeader responseHeader; -} UA_RegisterServerResponse; - -#define UA_TYPES_REGISTERSERVERRESPONSE 51 - -/** - * DiscoveryConfiguration - * ^^^^^^^^^^^^^^^^^^^^^^ - * A base type for discovery configuration information. */ -typedef void * UA_DiscoveryConfiguration; - -#define UA_TYPES_DISCOVERYCONFIGURATION 52 - -/** - * MdnsDiscoveryConfiguration - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - * The discovery information needed for mDNS registration. */ -typedef struct { - UA_String mdnsServerName; - size_t serverCapabilitiesSize; - UA_String *serverCapabilities; -} UA_MdnsDiscoveryConfiguration; - -#define UA_TYPES_MDNSDISCOVERYCONFIGURATION 53 - -/** - * RegisterServer2Request - * ^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_RegisteredServer server; - size_t discoveryConfigurationSize; - UA_ExtensionObject *discoveryConfiguration; -} UA_RegisterServer2Request; - -#define UA_TYPES_REGISTERSERVER2REQUEST 54 - -/** - * RegisterServer2Response - * ^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t configurationResultsSize; - UA_StatusCode *configurationResults; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_RegisterServer2Response; - -#define UA_TYPES_REGISTERSERVER2RESPONSE 55 - -/** - * SecurityTokenRequestType - * ^^^^^^^^^^^^^^^^^^^^^^^^ - * Indicates whether a token if being created or renewed. */ -typedef enum { - UA_SECURITYTOKENREQUESTTYPE_ISSUE = 0, - UA_SECURITYTOKENREQUESTTYPE_RENEW = 1, - __UA_SECURITYTOKENREQUESTTYPE_FORCE32BIT = 0x7fffffff -} UA_SecurityTokenRequestType; -UA_STATIC_ASSERT(sizeof(UA_SecurityTokenRequestType) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_SECURITYTOKENREQUESTTYPE 56 - -/** - * ChannelSecurityToken - * ^^^^^^^^^^^^^^^^^^^^ - * The token that identifies a set of keys for an active secure channel. */ -typedef struct { - UA_UInt32 channelId; - UA_UInt32 tokenId; - UA_DateTime createdAt; - UA_UInt32 revisedLifetime; -} UA_ChannelSecurityToken; - -#define UA_TYPES_CHANNELSECURITYTOKEN 57 - -/** - * OpenSecureChannelRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^ - * Creates a secure channel with a server. */ -typedef struct { - UA_RequestHeader requestHeader; - UA_UInt32 clientProtocolVersion; - UA_SecurityTokenRequestType requestType; - UA_MessageSecurityMode securityMode; - UA_ByteString clientNonce; - UA_UInt32 requestedLifetime; -} UA_OpenSecureChannelRequest; - -#define UA_TYPES_OPENSECURECHANNELREQUEST 58 - -/** - * OpenSecureChannelResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - * Creates a secure channel with a server. */ -typedef struct { - UA_ResponseHeader responseHeader; - UA_UInt32 serverProtocolVersion; - UA_ChannelSecurityToken securityToken; - UA_ByteString serverNonce; -} UA_OpenSecureChannelResponse; - -#define UA_TYPES_OPENSECURECHANNELRESPONSE 59 - -/** - * CloseSecureChannelRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - * Closes a secure channel. */ -typedef struct { - UA_RequestHeader requestHeader; -} UA_CloseSecureChannelRequest; - -#define UA_TYPES_CLOSESECURECHANNELREQUEST 60 - -/** - * CloseSecureChannelResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Closes a secure channel. */ -typedef struct { - UA_ResponseHeader responseHeader; -} UA_CloseSecureChannelResponse; - -#define UA_TYPES_CLOSESECURECHANNELRESPONSE 61 - -/** - * SignedSoftwareCertificate - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - * A software certificate with a digital signature. */ -typedef struct { - UA_ByteString certificateData; - UA_ByteString signature; -} UA_SignedSoftwareCertificate; - -#define UA_TYPES_SIGNEDSOFTWARECERTIFICATE 62 - -/** - * SignatureData - * ^^^^^^^^^^^^^ - * A digital signature. */ -typedef struct { - UA_String algorithm; - UA_ByteString signature; -} UA_SignatureData; - -#define UA_TYPES_SIGNATUREDATA 63 - -/** - * CreateSessionRequest - * ^^^^^^^^^^^^^^^^^^^^ - * Creates a new session with the server. */ -typedef struct { - UA_RequestHeader requestHeader; - UA_ApplicationDescription clientDescription; - UA_String serverUri; - UA_String endpointUrl; - UA_String sessionName; - UA_ByteString clientNonce; - UA_ByteString clientCertificate; - UA_Double requestedSessionTimeout; - UA_UInt32 maxResponseMessageSize; -} UA_CreateSessionRequest; - -#define UA_TYPES_CREATESESSIONREQUEST 64 - -/** - * CreateSessionResponse - * ^^^^^^^^^^^^^^^^^^^^^ - * Creates a new session with the server. */ -typedef struct { - UA_ResponseHeader responseHeader; - UA_NodeId sessionId; - UA_NodeId authenticationToken; - UA_Double revisedSessionTimeout; - UA_ByteString serverNonce; - UA_ByteString serverCertificate; - size_t serverEndpointsSize; - UA_EndpointDescription *serverEndpoints; - size_t serverSoftwareCertificatesSize; - UA_SignedSoftwareCertificate *serverSoftwareCertificates; - UA_SignatureData serverSignature; - UA_UInt32 maxRequestMessageSize; -} UA_CreateSessionResponse; - -#define UA_TYPES_CREATESESSIONRESPONSE 65 - -/** - * UserIdentityToken - * ^^^^^^^^^^^^^^^^^ - * A base type for a user identity token. */ -typedef struct { - UA_String policyId; -} UA_UserIdentityToken; - -#define UA_TYPES_USERIDENTITYTOKEN 66 - -/** - * AnonymousIdentityToken - * ^^^^^^^^^^^^^^^^^^^^^^ - * A token representing an anonymous user. */ -typedef struct { - UA_String policyId; -} UA_AnonymousIdentityToken; - -#define UA_TYPES_ANONYMOUSIDENTITYTOKEN 67 - -/** - * UserNameIdentityToken - * ^^^^^^^^^^^^^^^^^^^^^ - * A token representing a user identified by a user name and password. */ -typedef struct { - UA_String policyId; - UA_String userName; - UA_ByteString password; - UA_String encryptionAlgorithm; -} UA_UserNameIdentityToken; - -#define UA_TYPES_USERNAMEIDENTITYTOKEN 68 - -/** - * ActivateSessionRequest - * ^^^^^^^^^^^^^^^^^^^^^^ - * Activates a session with the server. */ -typedef struct { - UA_RequestHeader requestHeader; - UA_SignatureData clientSignature; - size_t clientSoftwareCertificatesSize; - UA_SignedSoftwareCertificate *clientSoftwareCertificates; - size_t localeIdsSize; - UA_String *localeIds; - UA_ExtensionObject userIdentityToken; - UA_SignatureData userTokenSignature; -} UA_ActivateSessionRequest; - -#define UA_TYPES_ACTIVATESESSIONREQUEST 69 - -/** - * ActivateSessionResponse - * ^^^^^^^^^^^^^^^^^^^^^^^ - * Activates a session with the server. */ -typedef struct { - UA_ResponseHeader responseHeader; - UA_ByteString serverNonce; - size_t resultsSize; - UA_StatusCode *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_ActivateSessionResponse; - -#define UA_TYPES_ACTIVATESESSIONRESPONSE 70 - -/** - * CloseSessionRequest - * ^^^^^^^^^^^^^^^^^^^ - * Closes a session with the server. */ -typedef struct { - UA_RequestHeader requestHeader; - UA_Boolean deleteSubscriptions; -} UA_CloseSessionRequest; - -#define UA_TYPES_CLOSESESSIONREQUEST 71 - -/** - * CloseSessionResponse - * ^^^^^^^^^^^^^^^^^^^^ - * Closes a session with the server. */ -typedef struct { - UA_ResponseHeader responseHeader; -} UA_CloseSessionResponse; - -#define UA_TYPES_CLOSESESSIONRESPONSE 72 - -/** - * NodeAttributesMask - * ^^^^^^^^^^^^^^^^^^ - * The bits used to specify default attributes for a new node. */ -typedef enum { - UA_NODEATTRIBUTESMASK_NONE = 0, - UA_NODEATTRIBUTESMASK_ACCESSLEVEL = 1, - UA_NODEATTRIBUTESMASK_ARRAYDIMENSIONS = 2, - UA_NODEATTRIBUTESMASK_BROWSENAME = 4, - UA_NODEATTRIBUTESMASK_CONTAINSNOLOOPS = 8, - UA_NODEATTRIBUTESMASK_DATATYPE = 16, - UA_NODEATTRIBUTESMASK_DESCRIPTION = 32, - UA_NODEATTRIBUTESMASK_DISPLAYNAME = 64, - UA_NODEATTRIBUTESMASK_EVENTNOTIFIER = 128, - UA_NODEATTRIBUTESMASK_EXECUTABLE = 256, - UA_NODEATTRIBUTESMASK_HISTORIZING = 512, - UA_NODEATTRIBUTESMASK_INVERSENAME = 1024, - UA_NODEATTRIBUTESMASK_ISABSTRACT = 2048, - UA_NODEATTRIBUTESMASK_MINIMUMSAMPLINGINTERVAL = 4096, - UA_NODEATTRIBUTESMASK_NODECLASS = 8192, - UA_NODEATTRIBUTESMASK_NODEID = 16384, - UA_NODEATTRIBUTESMASK_SYMMETRIC = 32768, - UA_NODEATTRIBUTESMASK_USERACCESSLEVEL = 65536, - UA_NODEATTRIBUTESMASK_USEREXECUTABLE = 131072, - UA_NODEATTRIBUTESMASK_USERWRITEMASK = 262144, - UA_NODEATTRIBUTESMASK_VALUERANK = 524288, - UA_NODEATTRIBUTESMASK_WRITEMASK = 1048576, - UA_NODEATTRIBUTESMASK_VALUE = 2097152, - UA_NODEATTRIBUTESMASK_DATATYPEDEFINITION = 4194304, - UA_NODEATTRIBUTESMASK_ROLEPERMISSIONS = 8388608, - UA_NODEATTRIBUTESMASK_ACCESSRESTRICTIONS = 16777216, - UA_NODEATTRIBUTESMASK_ALL = 33554431, - UA_NODEATTRIBUTESMASK_BASENODE = 26501220, - UA_NODEATTRIBUTESMASK_OBJECT = 26501348, - UA_NODEATTRIBUTESMASK_OBJECTTYPE = 26503268, - UA_NODEATTRIBUTESMASK_VARIABLE = 26571383, - UA_NODEATTRIBUTESMASK_VARIABLETYPE = 28600438, - UA_NODEATTRIBUTESMASK_METHOD = 26632548, - UA_NODEATTRIBUTESMASK_REFERENCETYPE = 26537060, - UA_NODEATTRIBUTESMASK_VIEW = 26501356, - __UA_NODEATTRIBUTESMASK_FORCE32BIT = 0x7fffffff -} UA_NodeAttributesMask; -UA_STATIC_ASSERT(sizeof(UA_NodeAttributesMask) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_NODEATTRIBUTESMASK 73 - -/** - * NodeAttributes - * ^^^^^^^^^^^^^^ - * The base attributes for all nodes. */ -typedef struct { - UA_UInt32 specifiedAttributes; - UA_LocalizedText displayName; - UA_LocalizedText description; - UA_UInt32 writeMask; - UA_UInt32 userWriteMask; -} UA_NodeAttributes; - -#define UA_TYPES_NODEATTRIBUTES 74 - -/** - * ObjectAttributes - * ^^^^^^^^^^^^^^^^ - * The attributes for an object node. */ -typedef struct { - UA_UInt32 specifiedAttributes; - UA_LocalizedText displayName; - UA_LocalizedText description; - UA_UInt32 writeMask; - UA_UInt32 userWriteMask; - UA_Byte eventNotifier; -} UA_ObjectAttributes; - -#define UA_TYPES_OBJECTATTRIBUTES 75 - -/** - * VariableAttributes - * ^^^^^^^^^^^^^^^^^^ - * The attributes for a variable node. */ -typedef struct { - UA_UInt32 specifiedAttributes; - UA_LocalizedText displayName; - UA_LocalizedText description; - UA_UInt32 writeMask; - UA_UInt32 userWriteMask; - UA_Variant value; - UA_NodeId dataType; - UA_Int32 valueRank; - size_t arrayDimensionsSize; - UA_UInt32 *arrayDimensions; - UA_Byte accessLevel; - UA_Byte userAccessLevel; - UA_Double minimumSamplingInterval; - UA_Boolean historizing; -} UA_VariableAttributes; - -#define UA_TYPES_VARIABLEATTRIBUTES 76 - -/** - * MethodAttributes - * ^^^^^^^^^^^^^^^^ - * The attributes for a method node. */ -typedef struct { - UA_UInt32 specifiedAttributes; - UA_LocalizedText displayName; - UA_LocalizedText description; - UA_UInt32 writeMask; - UA_UInt32 userWriteMask; - UA_Boolean executable; - UA_Boolean userExecutable; -} UA_MethodAttributes; - -#define UA_TYPES_METHODATTRIBUTES 77 - -/** - * ObjectTypeAttributes - * ^^^^^^^^^^^^^^^^^^^^ - * The attributes for an object type node. */ -typedef struct { - UA_UInt32 specifiedAttributes; - UA_LocalizedText displayName; - UA_LocalizedText description; - UA_UInt32 writeMask; - UA_UInt32 userWriteMask; - UA_Boolean isAbstract; -} UA_ObjectTypeAttributes; - -#define UA_TYPES_OBJECTTYPEATTRIBUTES 78 - -/** - * VariableTypeAttributes - * ^^^^^^^^^^^^^^^^^^^^^^ - * The attributes for a variable type node. */ -typedef struct { - UA_UInt32 specifiedAttributes; - UA_LocalizedText displayName; - UA_LocalizedText description; - UA_UInt32 writeMask; - UA_UInt32 userWriteMask; - UA_Variant value; - UA_NodeId dataType; - UA_Int32 valueRank; - size_t arrayDimensionsSize; - UA_UInt32 *arrayDimensions; - UA_Boolean isAbstract; -} UA_VariableTypeAttributes; - -#define UA_TYPES_VARIABLETYPEATTRIBUTES 79 - -/** - * ReferenceTypeAttributes - * ^^^^^^^^^^^^^^^^^^^^^^^ - * The attributes for a reference type node. */ -typedef struct { - UA_UInt32 specifiedAttributes; - UA_LocalizedText displayName; - UA_LocalizedText description; - UA_UInt32 writeMask; - UA_UInt32 userWriteMask; - UA_Boolean isAbstract; - UA_Boolean symmetric; - UA_LocalizedText inverseName; -} UA_ReferenceTypeAttributes; - -#define UA_TYPES_REFERENCETYPEATTRIBUTES 80 - -/** - * DataTypeAttributes - * ^^^^^^^^^^^^^^^^^^ - * The attributes for a data type node. */ -typedef struct { - UA_UInt32 specifiedAttributes; - UA_LocalizedText displayName; - UA_LocalizedText description; - UA_UInt32 writeMask; - UA_UInt32 userWriteMask; - UA_Boolean isAbstract; -} UA_DataTypeAttributes; - -#define UA_TYPES_DATATYPEATTRIBUTES 81 - -/** - * ViewAttributes - * ^^^^^^^^^^^^^^ - * The attributes for a view node. */ -typedef struct { - UA_UInt32 specifiedAttributes; - UA_LocalizedText displayName; - UA_LocalizedText description; - UA_UInt32 writeMask; - UA_UInt32 userWriteMask; - UA_Boolean containsNoLoops; - UA_Byte eventNotifier; -} UA_ViewAttributes; - -#define UA_TYPES_VIEWATTRIBUTES 82 - -/** - * AddNodesItem - * ^^^^^^^^^^^^ - * A request to add a node to the server address space. */ -typedef struct { - UA_ExpandedNodeId parentNodeId; - UA_NodeId referenceTypeId; - UA_ExpandedNodeId requestedNewNodeId; - UA_QualifiedName browseName; - UA_NodeClass nodeClass; - UA_ExtensionObject nodeAttributes; - UA_ExpandedNodeId typeDefinition; -} UA_AddNodesItem; - -#define UA_TYPES_ADDNODESITEM 83 - -/** - * AddNodesResult - * ^^^^^^^^^^^^^^ - * A result of an add node operation. */ -typedef struct { - UA_StatusCode statusCode; - UA_NodeId addedNodeId; -} UA_AddNodesResult; - -#define UA_TYPES_ADDNODESRESULT 84 - -/** - * AddNodesRequest - * ^^^^^^^^^^^^^^^ - * Adds one or more nodes to the server address space. */ -typedef struct { - UA_RequestHeader requestHeader; - size_t nodesToAddSize; - UA_AddNodesItem *nodesToAdd; -} UA_AddNodesRequest; - -#define UA_TYPES_ADDNODESREQUEST 85 - -/** - * AddNodesResponse - * ^^^^^^^^^^^^^^^^ - * Adds one or more nodes to the server address space. */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_AddNodesResult *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_AddNodesResponse; - -#define UA_TYPES_ADDNODESRESPONSE 86 - -/** - * AddReferencesItem - * ^^^^^^^^^^^^^^^^^ - * A request to add a reference to the server address space. */ -typedef struct { - UA_NodeId sourceNodeId; - UA_NodeId referenceTypeId; - UA_Boolean isForward; - UA_String targetServerUri; - UA_ExpandedNodeId targetNodeId; - UA_NodeClass targetNodeClass; -} UA_AddReferencesItem; - -#define UA_TYPES_ADDREFERENCESITEM 87 - -/** - * AddReferencesRequest - * ^^^^^^^^^^^^^^^^^^^^ - * Adds one or more references to the server address space. */ -typedef struct { - UA_RequestHeader requestHeader; - size_t referencesToAddSize; - UA_AddReferencesItem *referencesToAdd; -} UA_AddReferencesRequest; - -#define UA_TYPES_ADDREFERENCESREQUEST 88 - -/** - * AddReferencesResponse - * ^^^^^^^^^^^^^^^^^^^^^ - * Adds one or more references to the server address space. */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_StatusCode *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_AddReferencesResponse; - -#define UA_TYPES_ADDREFERENCESRESPONSE 89 - -/** - * DeleteNodesItem - * ^^^^^^^^^^^^^^^ - * A request to delete a node to the server address space. */ -typedef struct { - UA_NodeId nodeId; - UA_Boolean deleteTargetReferences; -} UA_DeleteNodesItem; - -#define UA_TYPES_DELETENODESITEM 90 - -/** - * DeleteNodesRequest - * ^^^^^^^^^^^^^^^^^^ - * Delete one or more nodes from the server address space. */ -typedef struct { - UA_RequestHeader requestHeader; - size_t nodesToDeleteSize; - UA_DeleteNodesItem *nodesToDelete; -} UA_DeleteNodesRequest; - -#define UA_TYPES_DELETENODESREQUEST 91 - -/** - * DeleteNodesResponse - * ^^^^^^^^^^^^^^^^^^^ - * Delete one or more nodes from the server address space. */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_StatusCode *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_DeleteNodesResponse; - -#define UA_TYPES_DELETENODESRESPONSE 92 - -/** - * DeleteReferencesItem - * ^^^^^^^^^^^^^^^^^^^^ - * A request to delete a node from the server address space. */ -typedef struct { - UA_NodeId sourceNodeId; - UA_NodeId referenceTypeId; - UA_Boolean isForward; - UA_ExpandedNodeId targetNodeId; - UA_Boolean deleteBidirectional; -} UA_DeleteReferencesItem; - -#define UA_TYPES_DELETEREFERENCESITEM 93 - -/** - * DeleteReferencesRequest - * ^^^^^^^^^^^^^^^^^^^^^^^ - * Delete one or more references from the server address space. */ -typedef struct { - UA_RequestHeader requestHeader; - size_t referencesToDeleteSize; - UA_DeleteReferencesItem *referencesToDelete; -} UA_DeleteReferencesRequest; - -#define UA_TYPES_DELETEREFERENCESREQUEST 94 - -/** - * DeleteReferencesResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^ - * Delete one or more references from the server address space. */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_StatusCode *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_DeleteReferencesResponse; - -#define UA_TYPES_DELETEREFERENCESRESPONSE 95 - -/** - * BrowseDirection - * ^^^^^^^^^^^^^^^ - * The directions of the references to return. */ -typedef enum { - UA_BROWSEDIRECTION_FORWARD = 0, - UA_BROWSEDIRECTION_INVERSE = 1, - UA_BROWSEDIRECTION_BOTH = 2, - UA_BROWSEDIRECTION_INVALID = 3, - __UA_BROWSEDIRECTION_FORCE32BIT = 0x7fffffff -} UA_BrowseDirection; -UA_STATIC_ASSERT(sizeof(UA_BrowseDirection) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_BROWSEDIRECTION 96 - -/** - * ViewDescription - * ^^^^^^^^^^^^^^^ - * The view to browse. */ -typedef struct { - UA_NodeId viewId; - UA_DateTime timestamp; - UA_UInt32 viewVersion; -} UA_ViewDescription; - -#define UA_TYPES_VIEWDESCRIPTION 97 - -/** - * BrowseDescription - * ^^^^^^^^^^^^^^^^^ - * A request to browse the the references from a node. */ -typedef struct { - UA_NodeId nodeId; - UA_BrowseDirection browseDirection; - UA_NodeId referenceTypeId; - UA_Boolean includeSubtypes; - UA_UInt32 nodeClassMask; - UA_UInt32 resultMask; -} UA_BrowseDescription; - -#define UA_TYPES_BROWSEDESCRIPTION 98 - -/** - * BrowseResultMask - * ^^^^^^^^^^^^^^^^ - * A bit mask which specifies what should be returned in a browse response. */ -typedef enum { - UA_BROWSERESULTMASK_NONE = 0, - UA_BROWSERESULTMASK_REFERENCETYPEID = 1, - UA_BROWSERESULTMASK_ISFORWARD = 2, - UA_BROWSERESULTMASK_NODECLASS = 4, - UA_BROWSERESULTMASK_BROWSENAME = 8, - UA_BROWSERESULTMASK_DISPLAYNAME = 16, - UA_BROWSERESULTMASK_TYPEDEFINITION = 32, - UA_BROWSERESULTMASK_ALL = 63, - UA_BROWSERESULTMASK_REFERENCETYPEINFO = 3, - UA_BROWSERESULTMASK_TARGETINFO = 60, - __UA_BROWSERESULTMASK_FORCE32BIT = 0x7fffffff -} UA_BrowseResultMask; -UA_STATIC_ASSERT(sizeof(UA_BrowseResultMask) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_BROWSERESULTMASK 99 - -/** - * ReferenceDescription - * ^^^^^^^^^^^^^^^^^^^^ - * The description of a reference. */ -typedef struct { - UA_NodeId referenceTypeId; - UA_Boolean isForward; - UA_ExpandedNodeId nodeId; - UA_QualifiedName browseName; - UA_LocalizedText displayName; - UA_NodeClass nodeClass; - UA_ExpandedNodeId typeDefinition; -} UA_ReferenceDescription; - -#define UA_TYPES_REFERENCEDESCRIPTION 100 - -/** - * BrowseResult - * ^^^^^^^^^^^^ - * The result of a browse operation. */ -typedef struct { - UA_StatusCode statusCode; - UA_ByteString continuationPoint; - size_t referencesSize; - UA_ReferenceDescription *references; -} UA_BrowseResult; - -#define UA_TYPES_BROWSERESULT 101 - -/** - * BrowseRequest - * ^^^^^^^^^^^^^ - * Browse the references for one or more nodes from the server address space. */ -typedef struct { - UA_RequestHeader requestHeader; - UA_ViewDescription view; - UA_UInt32 requestedMaxReferencesPerNode; - size_t nodesToBrowseSize; - UA_BrowseDescription *nodesToBrowse; -} UA_BrowseRequest; - -#define UA_TYPES_BROWSEREQUEST 102 - -/** - * BrowseResponse - * ^^^^^^^^^^^^^^ - * Browse the references for one or more nodes from the server address space. */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_BrowseResult *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_BrowseResponse; - -#define UA_TYPES_BROWSERESPONSE 103 - -/** - * BrowseNextRequest - * ^^^^^^^^^^^^^^^^^ - * Continues one or more browse operations. */ -typedef struct { - UA_RequestHeader requestHeader; - UA_Boolean releaseContinuationPoints; - size_t continuationPointsSize; - UA_ByteString *continuationPoints; -} UA_BrowseNextRequest; - -#define UA_TYPES_BROWSENEXTREQUEST 104 - -/** - * BrowseNextResponse - * ^^^^^^^^^^^^^^^^^^ - * Continues one or more browse operations. */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_BrowseResult *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_BrowseNextResponse; - -#define UA_TYPES_BROWSENEXTRESPONSE 105 - -/** - * RelativePathElement - * ^^^^^^^^^^^^^^^^^^^ - * An element in a relative path. */ -typedef struct { - UA_NodeId referenceTypeId; - UA_Boolean isInverse; - UA_Boolean includeSubtypes; - UA_QualifiedName targetName; -} UA_RelativePathElement; - -#define UA_TYPES_RELATIVEPATHELEMENT 106 - -/** - * RelativePath - * ^^^^^^^^^^^^ - * A relative path constructed from reference types and browse names. */ -typedef struct { - size_t elementsSize; - UA_RelativePathElement *elements; -} UA_RelativePath; - -#define UA_TYPES_RELATIVEPATH 107 - -/** - * BrowsePath - * ^^^^^^^^^^ - * A request to translate a path into a node id. */ -typedef struct { - UA_NodeId startingNode; - UA_RelativePath relativePath; -} UA_BrowsePath; - -#define UA_TYPES_BROWSEPATH 108 - -/** - * BrowsePathTarget - * ^^^^^^^^^^^^^^^^ - * The target of the translated path. */ -typedef struct { - UA_ExpandedNodeId targetId; - UA_UInt32 remainingPathIndex; -} UA_BrowsePathTarget; - -#define UA_TYPES_BROWSEPATHTARGET 109 - -/** - * BrowsePathResult - * ^^^^^^^^^^^^^^^^ - * The result of a translate opearation. */ -typedef struct { - UA_StatusCode statusCode; - size_t targetsSize; - UA_BrowsePathTarget *targets; -} UA_BrowsePathResult; - -#define UA_TYPES_BROWSEPATHRESULT 110 - -/** - * TranslateBrowsePathsToNodeIdsRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Translates one or more paths in the server address space. */ -typedef struct { - UA_RequestHeader requestHeader; - size_t browsePathsSize; - UA_BrowsePath *browsePaths; -} UA_TranslateBrowsePathsToNodeIdsRequest; - -#define UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST 111 - -/** - * TranslateBrowsePathsToNodeIdsResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Translates one or more paths in the server address space. */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_BrowsePathResult *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_TranslateBrowsePathsToNodeIdsResponse; - -#define UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE 112 - -/** - * RegisterNodesRequest - * ^^^^^^^^^^^^^^^^^^^^ - * Registers one or more nodes for repeated use within a session. */ -typedef struct { - UA_RequestHeader requestHeader; - size_t nodesToRegisterSize; - UA_NodeId *nodesToRegister; -} UA_RegisterNodesRequest; - -#define UA_TYPES_REGISTERNODESREQUEST 113 - -/** - * RegisterNodesResponse - * ^^^^^^^^^^^^^^^^^^^^^ - * Registers one or more nodes for repeated use within a session. */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t registeredNodeIdsSize; - UA_NodeId *registeredNodeIds; -} UA_RegisterNodesResponse; - -#define UA_TYPES_REGISTERNODESRESPONSE 114 - -/** - * UnregisterNodesRequest - * ^^^^^^^^^^^^^^^^^^^^^^ - * Unregisters one or more previously registered nodes. */ -typedef struct { - UA_RequestHeader requestHeader; - size_t nodesToUnregisterSize; - UA_NodeId *nodesToUnregister; -} UA_UnregisterNodesRequest; - -#define UA_TYPES_UNREGISTERNODESREQUEST 115 - -/** - * UnregisterNodesResponse - * ^^^^^^^^^^^^^^^^^^^^^^^ - * Unregisters one or more previously registered nodes. */ -typedef struct { - UA_ResponseHeader responseHeader; -} UA_UnregisterNodesResponse; - -#define UA_TYPES_UNREGISTERNODESRESPONSE 116 - -/** - * QueryDataDescription - * ^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RelativePath relativePath; - UA_UInt32 attributeId; - UA_String indexRange; -} UA_QueryDataDescription; - -#define UA_TYPES_QUERYDATADESCRIPTION 117 - -/** - * NodeTypeDescription - * ^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ExpandedNodeId typeDefinitionNode; - UA_Boolean includeSubTypes; - size_t dataToReturnSize; - UA_QueryDataDescription *dataToReturn; -} UA_NodeTypeDescription; - -#define UA_TYPES_NODETYPEDESCRIPTION 118 - -/** - * FilterOperator - * ^^^^^^^^^^^^^^ - */ -typedef enum { - UA_FILTEROPERATOR_EQUALS = 0, - UA_FILTEROPERATOR_ISNULL = 1, - UA_FILTEROPERATOR_GREATERTHAN = 2, - UA_FILTEROPERATOR_LESSTHAN = 3, - UA_FILTEROPERATOR_GREATERTHANOREQUAL = 4, - UA_FILTEROPERATOR_LESSTHANOREQUAL = 5, - UA_FILTEROPERATOR_LIKE = 6, - UA_FILTEROPERATOR_NOT = 7, - UA_FILTEROPERATOR_BETWEEN = 8, - UA_FILTEROPERATOR_INLIST = 9, - UA_FILTEROPERATOR_AND = 10, - UA_FILTEROPERATOR_OR = 11, - UA_FILTEROPERATOR_CAST = 12, - UA_FILTEROPERATOR_INVIEW = 13, - UA_FILTEROPERATOR_OFTYPE = 14, - UA_FILTEROPERATOR_RELATEDTO = 15, - UA_FILTEROPERATOR_BITWISEAND = 16, - UA_FILTEROPERATOR_BITWISEOR = 17, - __UA_FILTEROPERATOR_FORCE32BIT = 0x7fffffff -} UA_FilterOperator; -UA_STATIC_ASSERT(sizeof(UA_FilterOperator) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_FILTEROPERATOR 119 - -/** - * QueryDataSet - * ^^^^^^^^^^^^ - */ -typedef struct { - UA_ExpandedNodeId nodeId; - UA_ExpandedNodeId typeDefinitionNode; - size_t valuesSize; - UA_Variant *values; -} UA_QueryDataSet; - -#define UA_TYPES_QUERYDATASET 120 - -/** - * ContentFilterElement - * ^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_FilterOperator filterOperator; - size_t filterOperandsSize; - UA_ExtensionObject *filterOperands; -} UA_ContentFilterElement; - -#define UA_TYPES_CONTENTFILTERELEMENT 121 - -/** - * ContentFilter - * ^^^^^^^^^^^^^ - */ -typedef struct { - size_t elementsSize; - UA_ContentFilterElement *elements; -} UA_ContentFilter; - -#define UA_TYPES_CONTENTFILTER 122 - -/** - * FilterOperand - * ^^^^^^^^^^^^^ - */ -typedef void * UA_FilterOperand; - -#define UA_TYPES_FILTEROPERAND 123 - -/** - * SimpleAttributeOperand - * ^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_NodeId typeDefinitionId; - size_t browsePathSize; - UA_QualifiedName *browsePath; - UA_UInt32 attributeId; - UA_String indexRange; -} UA_SimpleAttributeOperand; - -#define UA_TYPES_SIMPLEATTRIBUTEOPERAND 124 - -/** - * ContentFilterElementResult - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_StatusCode statusCode; - size_t operandStatusCodesSize; - UA_StatusCode *operandStatusCodes; - size_t operandDiagnosticInfosSize; - UA_DiagnosticInfo *operandDiagnosticInfos; -} UA_ContentFilterElementResult; - -#define UA_TYPES_CONTENTFILTERELEMENTRESULT 125 - -/** - * ContentFilterResult - * ^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - size_t elementResultsSize; - UA_ContentFilterElementResult *elementResults; - size_t elementDiagnosticInfosSize; - UA_DiagnosticInfo *elementDiagnosticInfos; -} UA_ContentFilterResult; - -#define UA_TYPES_CONTENTFILTERRESULT 126 - -/** - * ParsingResult - * ^^^^^^^^^^^^^ - */ -typedef struct { - UA_StatusCode statusCode; - size_t dataStatusCodesSize; - UA_StatusCode *dataStatusCodes; - size_t dataDiagnosticInfosSize; - UA_DiagnosticInfo *dataDiagnosticInfos; -} UA_ParsingResult; - -#define UA_TYPES_PARSINGRESULT 127 - -/** - * QueryFirstRequest - * ^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_ViewDescription view; - size_t nodeTypesSize; - UA_NodeTypeDescription *nodeTypes; - UA_ContentFilter filter; - UA_UInt32 maxDataSetsToReturn; - UA_UInt32 maxReferencesToReturn; -} UA_QueryFirstRequest; - -#define UA_TYPES_QUERYFIRSTREQUEST 128 - -/** - * QueryFirstResponse - * ^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t queryDataSetsSize; - UA_QueryDataSet *queryDataSets; - UA_ByteString continuationPoint; - size_t parsingResultsSize; - UA_ParsingResult *parsingResults; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; - UA_ContentFilterResult filterResult; -} UA_QueryFirstResponse; - -#define UA_TYPES_QUERYFIRSTRESPONSE 129 - -/** - * QueryNextRequest - * ^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_Boolean releaseContinuationPoint; - UA_ByteString continuationPoint; -} UA_QueryNextRequest; - -#define UA_TYPES_QUERYNEXTREQUEST 130 - -/** - * QueryNextResponse - * ^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t queryDataSetsSize; - UA_QueryDataSet *queryDataSets; - UA_ByteString revisedContinuationPoint; -} UA_QueryNextResponse; - -#define UA_TYPES_QUERYNEXTRESPONSE 131 - -/** - * TimestampsToReturn - * ^^^^^^^^^^^^^^^^^^ - */ -typedef enum { - UA_TIMESTAMPSTORETURN_SOURCE = 0, - UA_TIMESTAMPSTORETURN_SERVER = 1, - UA_TIMESTAMPSTORETURN_BOTH = 2, - UA_TIMESTAMPSTORETURN_NEITHER = 3, - UA_TIMESTAMPSTORETURN_INVALID = 4, - __UA_TIMESTAMPSTORETURN_FORCE32BIT = 0x7fffffff -} UA_TimestampsToReturn; -UA_STATIC_ASSERT(sizeof(UA_TimestampsToReturn) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_TIMESTAMPSTORETURN 132 - -/** - * ReadValueId - * ^^^^^^^^^^^ - */ -typedef struct { - UA_NodeId nodeId; - UA_UInt32 attributeId; - UA_String indexRange; - UA_QualifiedName dataEncoding; -} UA_ReadValueId; - -#define UA_TYPES_READVALUEID 133 - -/** - * ReadRequest - * ^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_Double maxAge; - UA_TimestampsToReturn timestampsToReturn; - size_t nodesToReadSize; - UA_ReadValueId *nodesToRead; -} UA_ReadRequest; - -#define UA_TYPES_READREQUEST 134 - -/** - * ReadResponse - * ^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_DataValue *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_ReadResponse; - -#define UA_TYPES_READRESPONSE 135 - -/** - * WriteValue - * ^^^^^^^^^^ - */ -typedef struct { - UA_NodeId nodeId; - UA_UInt32 attributeId; - UA_String indexRange; - UA_DataValue value; -} UA_WriteValue; - -#define UA_TYPES_WRITEVALUE 136 - -/** - * WriteRequest - * ^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - size_t nodesToWriteSize; - UA_WriteValue *nodesToWrite; -} UA_WriteRequest; - -#define UA_TYPES_WRITEREQUEST 137 - -/** - * WriteResponse - * ^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_StatusCode *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_WriteResponse; - -#define UA_TYPES_WRITERESPONSE 138 - -/** - * CallMethodRequest - * ^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_NodeId objectId; - UA_NodeId methodId; - size_t inputArgumentsSize; - UA_Variant *inputArguments; -} UA_CallMethodRequest; - -#define UA_TYPES_CALLMETHODREQUEST 139 - -/** - * CallMethodResult - * ^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_StatusCode statusCode; - size_t inputArgumentResultsSize; - UA_StatusCode *inputArgumentResults; - size_t inputArgumentDiagnosticInfosSize; - UA_DiagnosticInfo *inputArgumentDiagnosticInfos; - size_t outputArgumentsSize; - UA_Variant *outputArguments; -} UA_CallMethodResult; - -#define UA_TYPES_CALLMETHODRESULT 140 - -/** - * CallRequest - * ^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - size_t methodsToCallSize; - UA_CallMethodRequest *methodsToCall; -} UA_CallRequest; - -#define UA_TYPES_CALLREQUEST 141 - -/** - * CallResponse - * ^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_CallMethodResult *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_CallResponse; - -#define UA_TYPES_CALLRESPONSE 142 - -/** - * MonitoringMode - * ^^^^^^^^^^^^^^ - */ -typedef enum { - UA_MONITORINGMODE_DISABLED = 0, - UA_MONITORINGMODE_SAMPLING = 1, - UA_MONITORINGMODE_REPORTING = 2, - __UA_MONITORINGMODE_FORCE32BIT = 0x7fffffff -} UA_MonitoringMode; -UA_STATIC_ASSERT(sizeof(UA_MonitoringMode) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_MONITORINGMODE 143 - -/** - * DataChangeTrigger - * ^^^^^^^^^^^^^^^^^ - */ -typedef enum { - UA_DATACHANGETRIGGER_STATUS = 0, - UA_DATACHANGETRIGGER_STATUSVALUE = 1, - UA_DATACHANGETRIGGER_STATUSVALUETIMESTAMP = 2, - __UA_DATACHANGETRIGGER_FORCE32BIT = 0x7fffffff -} UA_DataChangeTrigger; -UA_STATIC_ASSERT(sizeof(UA_DataChangeTrigger) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_DATACHANGETRIGGER 144 - -/** - * DeadbandType - * ^^^^^^^^^^^^ - */ -typedef enum { - UA_DEADBANDTYPE_NONE = 0, - UA_DEADBANDTYPE_ABSOLUTE = 1, - UA_DEADBANDTYPE_PERCENT = 2, - __UA_DEADBANDTYPE_FORCE32BIT = 0x7fffffff -} UA_DeadbandType; -UA_STATIC_ASSERT(sizeof(UA_DeadbandType) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_DEADBANDTYPE 145 - -/** - * MonitoringFilter - * ^^^^^^^^^^^^^^^^ - */ -typedef void * UA_MonitoringFilter; - -#define UA_TYPES_MONITORINGFILTER 146 - -/** - * DataChangeFilter - * ^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_DataChangeTrigger trigger; - UA_UInt32 deadbandType; - UA_Double deadbandValue; -} UA_DataChangeFilter; - -#define UA_TYPES_DATACHANGEFILTER 147 - -/** - * EventFilter - * ^^^^^^^^^^^ - */ -typedef struct { - size_t selectClausesSize; - UA_SimpleAttributeOperand *selectClauses; - UA_ContentFilter whereClause; -} UA_EventFilter; - -#define UA_TYPES_EVENTFILTER 148 - -/** - * MonitoringParameters - * ^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_UInt32 clientHandle; - UA_Double samplingInterval; - UA_ExtensionObject filter; - UA_UInt32 queueSize; - UA_Boolean discardOldest; -} UA_MonitoringParameters; - -#define UA_TYPES_MONITORINGPARAMETERS 149 - -/** - * MonitoredItemCreateRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ReadValueId itemToMonitor; - UA_MonitoringMode monitoringMode; - UA_MonitoringParameters requestedParameters; -} UA_MonitoredItemCreateRequest; - -#define UA_TYPES_MONITOREDITEMCREATEREQUEST 150 - -/** - * MonitoredItemCreateResult - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_StatusCode statusCode; - UA_UInt32 monitoredItemId; - UA_Double revisedSamplingInterval; - UA_UInt32 revisedQueueSize; - UA_ExtensionObject filterResult; -} UA_MonitoredItemCreateResult; - -#define UA_TYPES_MONITOREDITEMCREATERESULT 151 - -/** - * CreateMonitoredItemsRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_UInt32 subscriptionId; - UA_TimestampsToReturn timestampsToReturn; - size_t itemsToCreateSize; - UA_MonitoredItemCreateRequest *itemsToCreate; -} UA_CreateMonitoredItemsRequest; - -#define UA_TYPES_CREATEMONITOREDITEMSREQUEST 152 - -/** - * CreateMonitoredItemsResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_MonitoredItemCreateResult *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_CreateMonitoredItemsResponse; - -#define UA_TYPES_CREATEMONITOREDITEMSRESPONSE 153 - -/** - * MonitoredItemModifyRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_UInt32 monitoredItemId; - UA_MonitoringParameters requestedParameters; -} UA_MonitoredItemModifyRequest; - -#define UA_TYPES_MONITOREDITEMMODIFYREQUEST 154 - -/** - * MonitoredItemModifyResult - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_StatusCode statusCode; - UA_Double revisedSamplingInterval; - UA_UInt32 revisedQueueSize; - UA_ExtensionObject filterResult; -} UA_MonitoredItemModifyResult; - -#define UA_TYPES_MONITOREDITEMMODIFYRESULT 155 - -/** - * ModifyMonitoredItemsRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_UInt32 subscriptionId; - UA_TimestampsToReturn timestampsToReturn; - size_t itemsToModifySize; - UA_MonitoredItemModifyRequest *itemsToModify; -} UA_ModifyMonitoredItemsRequest; - -#define UA_TYPES_MODIFYMONITOREDITEMSREQUEST 156 - -/** - * ModifyMonitoredItemsResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_MonitoredItemModifyResult *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_ModifyMonitoredItemsResponse; - -#define UA_TYPES_MODIFYMONITOREDITEMSRESPONSE 157 - -/** - * SetMonitoringModeRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_UInt32 subscriptionId; - UA_MonitoringMode monitoringMode; - size_t monitoredItemIdsSize; - UA_UInt32 *monitoredItemIds; -} UA_SetMonitoringModeRequest; - -#define UA_TYPES_SETMONITORINGMODEREQUEST 158 - -/** - * SetMonitoringModeResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_StatusCode *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_SetMonitoringModeResponse; - -#define UA_TYPES_SETMONITORINGMODERESPONSE 159 - -/** - * DeleteMonitoredItemsRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_UInt32 subscriptionId; - size_t monitoredItemIdsSize; - UA_UInt32 *monitoredItemIds; -} UA_DeleteMonitoredItemsRequest; - -#define UA_TYPES_DELETEMONITOREDITEMSREQUEST 160 - -/** - * DeleteMonitoredItemsResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_StatusCode *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_DeleteMonitoredItemsResponse; - -#define UA_TYPES_DELETEMONITOREDITEMSRESPONSE 161 - -/** - * CreateSubscriptionRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_Double requestedPublishingInterval; - UA_UInt32 requestedLifetimeCount; - UA_UInt32 requestedMaxKeepAliveCount; - UA_UInt32 maxNotificationsPerPublish; - UA_Boolean publishingEnabled; - UA_Byte priority; -} UA_CreateSubscriptionRequest; - -#define UA_TYPES_CREATESUBSCRIPTIONREQUEST 162 - -/** - * CreateSubscriptionResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - UA_UInt32 subscriptionId; - UA_Double revisedPublishingInterval; - UA_UInt32 revisedLifetimeCount; - UA_UInt32 revisedMaxKeepAliveCount; -} UA_CreateSubscriptionResponse; - -#define UA_TYPES_CREATESUBSCRIPTIONRESPONSE 163 - -/** - * ModifySubscriptionRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_UInt32 subscriptionId; - UA_Double requestedPublishingInterval; - UA_UInt32 requestedLifetimeCount; - UA_UInt32 requestedMaxKeepAliveCount; - UA_UInt32 maxNotificationsPerPublish; - UA_Byte priority; -} UA_ModifySubscriptionRequest; - -#define UA_TYPES_MODIFYSUBSCRIPTIONREQUEST 164 - -/** - * ModifySubscriptionResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - UA_Double revisedPublishingInterval; - UA_UInt32 revisedLifetimeCount; - UA_UInt32 revisedMaxKeepAliveCount; -} UA_ModifySubscriptionResponse; - -#define UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE 165 - -/** - * SetPublishingModeRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_Boolean publishingEnabled; - size_t subscriptionIdsSize; - UA_UInt32 *subscriptionIds; -} UA_SetPublishingModeRequest; - -#define UA_TYPES_SETPUBLISHINGMODEREQUEST 166 - -/** - * SetPublishingModeResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_StatusCode *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_SetPublishingModeResponse; - -#define UA_TYPES_SETPUBLISHINGMODERESPONSE 167 - -/** - * NotificationMessage - * ^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_UInt32 sequenceNumber; - UA_DateTime publishTime; - size_t notificationDataSize; - UA_ExtensionObject *notificationData; -} UA_NotificationMessage; - -#define UA_TYPES_NOTIFICATIONMESSAGE 168 - -/** - * MonitoredItemNotification - * ^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_UInt32 clientHandle; - UA_DataValue value; -} UA_MonitoredItemNotification; - -#define UA_TYPES_MONITOREDITEMNOTIFICATION 169 - -/** - * EventFieldList - * ^^^^^^^^^^^^^^ - */ -typedef struct { - UA_UInt32 clientHandle; - size_t eventFieldsSize; - UA_Variant *eventFields; -} UA_EventFieldList; - -#define UA_TYPES_EVENTFIELDLIST 170 - -/** - * StatusChangeNotification - * ^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_StatusCode status; - UA_DiagnosticInfo diagnosticInfo; -} UA_StatusChangeNotification; - -#define UA_TYPES_STATUSCHANGENOTIFICATION 171 - -/** - * SubscriptionAcknowledgement - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_UInt32 subscriptionId; - UA_UInt32 sequenceNumber; -} UA_SubscriptionAcknowledgement; - -#define UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT 172 - -/** - * PublishRequest - * ^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - size_t subscriptionAcknowledgementsSize; - UA_SubscriptionAcknowledgement *subscriptionAcknowledgements; -} UA_PublishRequest; - -#define UA_TYPES_PUBLISHREQUEST 173 - -/** - * PublishResponse - * ^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - UA_UInt32 subscriptionId; - size_t availableSequenceNumbersSize; - UA_UInt32 *availableSequenceNumbers; - UA_Boolean moreNotifications; - UA_NotificationMessage notificationMessage; - size_t resultsSize; - UA_StatusCode *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_PublishResponse; - -#define UA_TYPES_PUBLISHRESPONSE 174 - -/** - * RepublishRequest - * ^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - UA_UInt32 subscriptionId; - UA_UInt32 retransmitSequenceNumber; -} UA_RepublishRequest; - -#define UA_TYPES_REPUBLISHREQUEST 175 - -/** - * RepublishResponse - * ^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - UA_NotificationMessage notificationMessage; -} UA_RepublishResponse; - -#define UA_TYPES_REPUBLISHRESPONSE 176 - -/** - * DeleteSubscriptionsRequest - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_RequestHeader requestHeader; - size_t subscriptionIdsSize; - UA_UInt32 *subscriptionIds; -} UA_DeleteSubscriptionsRequest; - -#define UA_TYPES_DELETESUBSCRIPTIONSREQUEST 177 - -/** - * DeleteSubscriptionsResponse - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_ResponseHeader responseHeader; - size_t resultsSize; - UA_StatusCode *results; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_DeleteSubscriptionsResponse; - -#define UA_TYPES_DELETESUBSCRIPTIONSRESPONSE 178 - -/** - * BuildInfo - * ^^^^^^^^^ - */ -typedef struct { - UA_String productUri; - UA_String manufacturerName; - UA_String productName; - UA_String softwareVersion; - UA_String buildNumber; - UA_DateTime buildDate; -} UA_BuildInfo; - -#define UA_TYPES_BUILDINFO 179 - -/** - * RedundancySupport - * ^^^^^^^^^^^^^^^^^ - */ -typedef enum { - UA_REDUNDANCYSUPPORT_NONE = 0, - UA_REDUNDANCYSUPPORT_COLD = 1, - UA_REDUNDANCYSUPPORT_WARM = 2, - UA_REDUNDANCYSUPPORT_HOT = 3, - UA_REDUNDANCYSUPPORT_TRANSPARENT = 4, - UA_REDUNDANCYSUPPORT_HOTANDMIRRORED = 5, - __UA_REDUNDANCYSUPPORT_FORCE32BIT = 0x7fffffff -} UA_RedundancySupport; -UA_STATIC_ASSERT(sizeof(UA_RedundancySupport) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_REDUNDANCYSUPPORT 180 - -/** - * ServerState - * ^^^^^^^^^^^ - */ -typedef enum { - UA_SERVERSTATE_RUNNING = 0, - UA_SERVERSTATE_FAILED = 1, - UA_SERVERSTATE_NOCONFIGURATION = 2, - UA_SERVERSTATE_SUSPENDED = 3, - UA_SERVERSTATE_SHUTDOWN = 4, - UA_SERVERSTATE_TEST = 5, - UA_SERVERSTATE_COMMUNICATIONFAULT = 6, - UA_SERVERSTATE_UNKNOWN = 7, - __UA_SERVERSTATE_FORCE32BIT = 0x7fffffff -} UA_ServerState; -UA_STATIC_ASSERT(sizeof(UA_ServerState) == sizeof(UA_Int32), enum_must_be_32bit); - -#define UA_TYPES_SERVERSTATE 181 - -/** - * RedundantServerDataType - * ^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_String serverId; - UA_Byte serviceLevel; - UA_ServerState serverState; -} UA_RedundantServerDataType; - -#define UA_TYPES_REDUNDANTSERVERDATATYPE 182 - -/** - * EndpointUrlListDataType - * ^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - size_t endpointUrlListSize; - UA_String *endpointUrlList; -} UA_EndpointUrlListDataType; - -#define UA_TYPES_ENDPOINTURLLISTDATATYPE 183 - -/** - * NetworkGroupDataType - * ^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_String serverUri; - size_t networkPathsSize; - UA_EndpointUrlListDataType *networkPaths; -} UA_NetworkGroupDataType; - -#define UA_TYPES_NETWORKGROUPDATATYPE 184 - -/** - * ServerDiagnosticsSummaryDataType - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_UInt32 serverViewCount; - UA_UInt32 currentSessionCount; - UA_UInt32 cumulatedSessionCount; - UA_UInt32 securityRejectedSessionCount; - UA_UInt32 rejectedSessionCount; - UA_UInt32 sessionTimeoutCount; - UA_UInt32 sessionAbortCount; - UA_UInt32 currentSubscriptionCount; - UA_UInt32 cumulatedSubscriptionCount; - UA_UInt32 publishingIntervalCount; - UA_UInt32 securityRejectedRequestsCount; - UA_UInt32 rejectedRequestsCount; -} UA_ServerDiagnosticsSummaryDataType; - -#define UA_TYPES_SERVERDIAGNOSTICSSUMMARYDATATYPE 185 - -/** - * ServerStatusDataType - * ^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_DateTime startTime; - UA_DateTime currentTime; - UA_ServerState state; - UA_BuildInfo buildInfo; - UA_UInt32 secondsTillShutdown; - UA_LocalizedText shutdownReason; -} UA_ServerStatusDataType; - -#define UA_TYPES_SERVERSTATUSDATATYPE 186 - -/** - * SessionSecurityDiagnosticsDataType - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_NodeId sessionId; - UA_String clientUserIdOfSession; - size_t clientUserIdHistorySize; - UA_String *clientUserIdHistory; - UA_String authenticationMechanism; - UA_String encoding; - UA_String transportProtocol; - UA_MessageSecurityMode securityMode; - UA_String securityPolicyUri; - UA_ByteString clientCertificate; -} UA_SessionSecurityDiagnosticsDataType; - -#define UA_TYPES_SESSIONSECURITYDIAGNOSTICSDATATYPE 187 - -/** - * ServiceCounterDataType - * ^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_UInt32 totalCount; - UA_UInt32 errorCount; -} UA_ServiceCounterDataType; - -#define UA_TYPES_SERVICECOUNTERDATATYPE 188 - -/** - * SubscriptionDiagnosticsDataType - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_NodeId sessionId; - UA_UInt32 subscriptionId; - UA_Byte priority; - UA_Double publishingInterval; - UA_UInt32 maxKeepAliveCount; - UA_UInt32 maxLifetimeCount; - UA_UInt32 maxNotificationsPerPublish; - UA_Boolean publishingEnabled; - UA_UInt32 modifyCount; - UA_UInt32 enableCount; - UA_UInt32 disableCount; - UA_UInt32 republishRequestCount; - UA_UInt32 republishMessageRequestCount; - UA_UInt32 republishMessageCount; - UA_UInt32 transferRequestCount; - UA_UInt32 transferredToAltClientCount; - UA_UInt32 transferredToSameClientCount; - UA_UInt32 publishRequestCount; - UA_UInt32 dataChangeNotificationsCount; - UA_UInt32 eventNotificationsCount; - UA_UInt32 notificationsCount; - UA_UInt32 latePublishRequestCount; - UA_UInt32 currentKeepAliveCount; - UA_UInt32 currentLifetimeCount; - UA_UInt32 unacknowledgedMessageCount; - UA_UInt32 discardedMessageCount; - UA_UInt32 monitoredItemCount; - UA_UInt32 disabledMonitoredItemCount; - UA_UInt32 monitoringQueueOverflowCount; - UA_UInt32 nextSequenceNumber; - UA_UInt32 eventQueueOverFlowCount; -} UA_SubscriptionDiagnosticsDataType; - -#define UA_TYPES_SUBSCRIPTIONDIAGNOSTICSDATATYPE 189 - -/** - * ModelChangeStructureDataType - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_NodeId affected; - UA_NodeId affectedType; - UA_Byte verb; -} UA_ModelChangeStructureDataType; - -#define UA_TYPES_MODELCHANGESTRUCTUREDATATYPE 190 - -/** - * SemanticChangeStructureDataType - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_NodeId affected; - UA_NodeId affectedType; -} UA_SemanticChangeStructureDataType; - -#define UA_TYPES_SEMANTICCHANGESTRUCTUREDATATYPE 191 - -/** - * DataChangeNotification - * ^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - size_t monitoredItemsSize; - UA_MonitoredItemNotification *monitoredItems; - size_t diagnosticInfosSize; - UA_DiagnosticInfo *diagnosticInfos; -} UA_DataChangeNotification; - -#define UA_TYPES_DATACHANGENOTIFICATION 192 - -/** - * EventNotificationList - * ^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - size_t eventsSize; - UA_EventFieldList *events; -} UA_EventNotificationList; - -#define UA_TYPES_EVENTNOTIFICATIONLIST 193 - -/** - * SessionDiagnosticsDataType - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ - */ -typedef struct { - UA_NodeId sessionId; - UA_String sessionName; - UA_ApplicationDescription clientDescription; - UA_String serverUri; - UA_String endpointUrl; - size_t localeIdsSize; - UA_String *localeIds; - UA_Double actualSessionTimeout; - UA_UInt32 maxResponseMessageSize; - UA_DateTime clientConnectionTime; - UA_DateTime clientLastContactTime; - UA_UInt32 currentSubscriptionsCount; - UA_UInt32 currentMonitoredItemsCount; - UA_UInt32 currentPublishRequestsInQueue; - UA_ServiceCounterDataType totalRequestCount; - UA_UInt32 unauthorizedRequestCount; - UA_ServiceCounterDataType readCount; - UA_ServiceCounterDataType historyReadCount; - UA_ServiceCounterDataType writeCount; - UA_ServiceCounterDataType historyUpdateCount; - UA_ServiceCounterDataType callCount; - UA_ServiceCounterDataType createMonitoredItemsCount; - UA_ServiceCounterDataType modifyMonitoredItemsCount; - UA_ServiceCounterDataType setMonitoringModeCount; - UA_ServiceCounterDataType setTriggeringCount; - UA_ServiceCounterDataType deleteMonitoredItemsCount; - UA_ServiceCounterDataType createSubscriptionCount; - UA_ServiceCounterDataType modifySubscriptionCount; - UA_ServiceCounterDataType setPublishingModeCount; - UA_ServiceCounterDataType publishCount; - UA_ServiceCounterDataType republishCount; - UA_ServiceCounterDataType transferSubscriptionsCount; - UA_ServiceCounterDataType deleteSubscriptionsCount; - UA_ServiceCounterDataType addNodesCount; - UA_ServiceCounterDataType addReferencesCount; - UA_ServiceCounterDataType deleteNodesCount; - UA_ServiceCounterDataType deleteReferencesCount; - UA_ServiceCounterDataType browseCount; - UA_ServiceCounterDataType browseNextCount; - UA_ServiceCounterDataType translateBrowsePathsToNodeIdsCount; - UA_ServiceCounterDataType queryFirstCount; - UA_ServiceCounterDataType queryNextCount; - UA_ServiceCounterDataType registerNodesCount; - UA_ServiceCounterDataType unregisterNodesCount; -} UA_SessionDiagnosticsDataType; - -#define UA_TYPES_SESSIONDIAGNOSTICSDATATYPE 194 - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/.build/src_generated/ua_types_generated_handling.h" ***********************************/ - -/* Generated from Opc.Ua.Types.bsd with script /home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/tools/generate_datatypes.py - * on host nmpc by user max at 2018-01-05 04:21:09 */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wmissing-field-initializers" -# pragma GCC diagnostic ignored "-Wmissing-braces" -#endif - - -/* Boolean */ -static UA_INLINE void -UA_Boolean_init(UA_Boolean *p) { - memset(p, 0, sizeof(UA_Boolean)); -} - -static UA_INLINE UA_Boolean * -UA_Boolean_new(void) { - return (UA_Boolean*)UA_new(&UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Boolean_copy(const UA_Boolean *src, UA_Boolean *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_Boolean_deleteMembers(UA_Boolean *p) { } - -static UA_INLINE void -UA_Boolean_delete(UA_Boolean *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -/* SByte */ -static UA_INLINE void -UA_SByte_init(UA_SByte *p) { - memset(p, 0, sizeof(UA_SByte)); -} - -static UA_INLINE UA_SByte * -UA_SByte_new(void) { - return (UA_SByte*)UA_new(&UA_TYPES[UA_TYPES_SBYTE]); -} - -static UA_INLINE UA_StatusCode -UA_SByte_copy(const UA_SByte *src, UA_SByte *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_SByte_deleteMembers(UA_SByte *p) { } - -static UA_INLINE void -UA_SByte_delete(UA_SByte *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SBYTE]); -} - -/* Byte */ -static UA_INLINE void -UA_Byte_init(UA_Byte *p) { - memset(p, 0, sizeof(UA_Byte)); -} - -static UA_INLINE UA_Byte * -UA_Byte_new(void) { - return (UA_Byte*)UA_new(&UA_TYPES[UA_TYPES_BYTE]); -} - -static UA_INLINE UA_StatusCode -UA_Byte_copy(const UA_Byte *src, UA_Byte *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_Byte_deleteMembers(UA_Byte *p) { } - -static UA_INLINE void -UA_Byte_delete(UA_Byte *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BYTE]); -} - -/* Int16 */ -static UA_INLINE void -UA_Int16_init(UA_Int16 *p) { - memset(p, 0, sizeof(UA_Int16)); -} - -static UA_INLINE UA_Int16 * -UA_Int16_new(void) { - return (UA_Int16*)UA_new(&UA_TYPES[UA_TYPES_INT16]); -} - -static UA_INLINE UA_StatusCode -UA_Int16_copy(const UA_Int16 *src, UA_Int16 *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_Int16_deleteMembers(UA_Int16 *p) { } - -static UA_INLINE void -UA_Int16_delete(UA_Int16 *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_INT16]); -} - -/* UInt16 */ -static UA_INLINE void -UA_UInt16_init(UA_UInt16 *p) { - memset(p, 0, sizeof(UA_UInt16)); -} - -static UA_INLINE UA_UInt16 * -UA_UInt16_new(void) { - return (UA_UInt16*)UA_new(&UA_TYPES[UA_TYPES_UINT16]); -} - -static UA_INLINE UA_StatusCode -UA_UInt16_copy(const UA_UInt16 *src, UA_UInt16 *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_UInt16_deleteMembers(UA_UInt16 *p) { } - -static UA_INLINE void -UA_UInt16_delete(UA_UInt16 *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_UINT16]); -} - -/* Int32 */ -static UA_INLINE void -UA_Int32_init(UA_Int32 *p) { - memset(p, 0, sizeof(UA_Int32)); -} - -static UA_INLINE UA_Int32 * -UA_Int32_new(void) { - return (UA_Int32*)UA_new(&UA_TYPES[UA_TYPES_INT32]); -} - -static UA_INLINE UA_StatusCode -UA_Int32_copy(const UA_Int32 *src, UA_Int32 *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_Int32_deleteMembers(UA_Int32 *p) { } - -static UA_INLINE void -UA_Int32_delete(UA_Int32 *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_INT32]); -} - -/* UInt32 */ -static UA_INLINE void -UA_UInt32_init(UA_UInt32 *p) { - memset(p, 0, sizeof(UA_UInt32)); -} - -static UA_INLINE UA_UInt32 * -UA_UInt32_new(void) { - return (UA_UInt32*)UA_new(&UA_TYPES[UA_TYPES_UINT32]); -} - -static UA_INLINE UA_StatusCode -UA_UInt32_copy(const UA_UInt32 *src, UA_UInt32 *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_UInt32_deleteMembers(UA_UInt32 *p) { } - -static UA_INLINE void -UA_UInt32_delete(UA_UInt32 *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_UINT32]); -} - -/* Int64 */ -static UA_INLINE void -UA_Int64_init(UA_Int64 *p) { - memset(p, 0, sizeof(UA_Int64)); -} - -static UA_INLINE UA_Int64 * -UA_Int64_new(void) { - return (UA_Int64*)UA_new(&UA_TYPES[UA_TYPES_INT64]); -} - -static UA_INLINE UA_StatusCode -UA_Int64_copy(const UA_Int64 *src, UA_Int64 *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_Int64_deleteMembers(UA_Int64 *p) { } - -static UA_INLINE void -UA_Int64_delete(UA_Int64 *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_INT64]); -} - -/* UInt64 */ -static UA_INLINE void -UA_UInt64_init(UA_UInt64 *p) { - memset(p, 0, sizeof(UA_UInt64)); -} - -static UA_INLINE UA_UInt64 * -UA_UInt64_new(void) { - return (UA_UInt64*)UA_new(&UA_TYPES[UA_TYPES_UINT64]); -} - -static UA_INLINE UA_StatusCode -UA_UInt64_copy(const UA_UInt64 *src, UA_UInt64 *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_UInt64_deleteMembers(UA_UInt64 *p) { } - -static UA_INLINE void -UA_UInt64_delete(UA_UInt64 *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_UINT64]); -} - -/* Float */ -static UA_INLINE void -UA_Float_init(UA_Float *p) { - memset(p, 0, sizeof(UA_Float)); -} - -static UA_INLINE UA_Float * -UA_Float_new(void) { - return (UA_Float*)UA_new(&UA_TYPES[UA_TYPES_FLOAT]); -} - -static UA_INLINE UA_StatusCode -UA_Float_copy(const UA_Float *src, UA_Float *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_Float_deleteMembers(UA_Float *p) { } - -static UA_INLINE void -UA_Float_delete(UA_Float *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_FLOAT]); -} - -/* Double */ -static UA_INLINE void -UA_Double_init(UA_Double *p) { - memset(p, 0, sizeof(UA_Double)); -} - -static UA_INLINE UA_Double * -UA_Double_new(void) { - return (UA_Double*)UA_new(&UA_TYPES[UA_TYPES_DOUBLE]); -} - -static UA_INLINE UA_StatusCode -UA_Double_copy(const UA_Double *src, UA_Double *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_Double_deleteMembers(UA_Double *p) { } - -static UA_INLINE void -UA_Double_delete(UA_Double *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DOUBLE]); -} - -/* String */ -static UA_INLINE void -UA_String_init(UA_String *p) { - memset(p, 0, sizeof(UA_String)); -} - -static UA_INLINE UA_String * -UA_String_new(void) { - return (UA_String*)UA_new(&UA_TYPES[UA_TYPES_STRING]); -} - -static UA_INLINE UA_StatusCode -UA_String_copy(const UA_String *src, UA_String *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_STRING]); -} - -static UA_INLINE void -UA_String_deleteMembers(UA_String *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_STRING]); -} - -static UA_INLINE void -UA_String_delete(UA_String *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_STRING]); -} - -/* DateTime */ -static UA_INLINE void -UA_DateTime_init(UA_DateTime *p) { - memset(p, 0, sizeof(UA_DateTime)); -} - -static UA_INLINE UA_DateTime * -UA_DateTime_new(void) { - return (UA_DateTime*)UA_new(&UA_TYPES[UA_TYPES_DATETIME]); -} - -static UA_INLINE UA_StatusCode -UA_DateTime_copy(const UA_DateTime *src, UA_DateTime *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_DateTime_deleteMembers(UA_DateTime *p) { } - -static UA_INLINE void -UA_DateTime_delete(UA_DateTime *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DATETIME]); -} - -/* Guid */ -static UA_INLINE void -UA_Guid_init(UA_Guid *p) { - memset(p, 0, sizeof(UA_Guid)); -} - -static UA_INLINE UA_Guid * -UA_Guid_new(void) { - return (UA_Guid*)UA_new(&UA_TYPES[UA_TYPES_GUID]); -} - -static UA_INLINE UA_StatusCode -UA_Guid_copy(const UA_Guid *src, UA_Guid *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_Guid_deleteMembers(UA_Guid *p) { } - -static UA_INLINE void -UA_Guid_delete(UA_Guid *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_GUID]); -} - -/* ByteString */ -static UA_INLINE void -UA_ByteString_init(UA_ByteString *p) { - memset(p, 0, sizeof(UA_ByteString)); -} - -static UA_INLINE UA_ByteString * -UA_ByteString_new(void) { - return (UA_ByteString*)UA_new(&UA_TYPES[UA_TYPES_BYTESTRING]); -} - -static UA_INLINE UA_StatusCode -UA_ByteString_copy(const UA_ByteString *src, UA_ByteString *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BYTESTRING]); -} - -static UA_INLINE void -UA_ByteString_deleteMembers(UA_ByteString *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BYTESTRING]); -} - -static UA_INLINE void -UA_ByteString_delete(UA_ByteString *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BYTESTRING]); -} - -/* XmlElement */ -static UA_INLINE void -UA_XmlElement_init(UA_XmlElement *p) { - memset(p, 0, sizeof(UA_XmlElement)); -} - -static UA_INLINE UA_XmlElement * -UA_XmlElement_new(void) { - return (UA_XmlElement*)UA_new(&UA_TYPES[UA_TYPES_XMLELEMENT]); -} - -static UA_INLINE UA_StatusCode -UA_XmlElement_copy(const UA_XmlElement *src, UA_XmlElement *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_XMLELEMENT]); -} - -static UA_INLINE void -UA_XmlElement_deleteMembers(UA_XmlElement *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_XMLELEMENT]); -} - -static UA_INLINE void -UA_XmlElement_delete(UA_XmlElement *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_XMLELEMENT]); -} - -/* NodeId */ -static UA_INLINE void -UA_NodeId_init(UA_NodeId *p) { - memset(p, 0, sizeof(UA_NodeId)); -} - -static UA_INLINE UA_NodeId * -UA_NodeId_new(void) { - return (UA_NodeId*)UA_new(&UA_TYPES[UA_TYPES_NODEID]); -} - -static UA_INLINE UA_StatusCode -UA_NodeId_copy(const UA_NodeId *src, UA_NodeId *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_NODEID]); -} - -static UA_INLINE void -UA_NodeId_deleteMembers(UA_NodeId *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_NODEID]); -} - -static UA_INLINE void -UA_NodeId_delete(UA_NodeId *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_NODEID]); -} - -/* ExpandedNodeId */ -static UA_INLINE void -UA_ExpandedNodeId_init(UA_ExpandedNodeId *p) { - memset(p, 0, sizeof(UA_ExpandedNodeId)); -} - -static UA_INLINE UA_ExpandedNodeId * -UA_ExpandedNodeId_new(void) { - return (UA_ExpandedNodeId*)UA_new(&UA_TYPES[UA_TYPES_EXPANDEDNODEID]); -} - -static UA_INLINE UA_StatusCode -UA_ExpandedNodeId_copy(const UA_ExpandedNodeId *src, UA_ExpandedNodeId *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_EXPANDEDNODEID]); -} - -static UA_INLINE void -UA_ExpandedNodeId_deleteMembers(UA_ExpandedNodeId *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_EXPANDEDNODEID]); -} - -static UA_INLINE void -UA_ExpandedNodeId_delete(UA_ExpandedNodeId *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_EXPANDEDNODEID]); -} - -/* StatusCode */ -static UA_INLINE void -UA_StatusCode_init(UA_StatusCode *p) { - memset(p, 0, sizeof(UA_StatusCode)); -} - -static UA_INLINE UA_StatusCode * -UA_StatusCode_new(void) { - return (UA_StatusCode*)UA_new(&UA_TYPES[UA_TYPES_STATUSCODE]); -} - -static UA_INLINE UA_StatusCode -UA_StatusCode_copy(const UA_StatusCode *src, UA_StatusCode *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_StatusCode_deleteMembers(UA_StatusCode *p) { } - -static UA_INLINE void -UA_StatusCode_delete(UA_StatusCode *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_STATUSCODE]); -} - -/* QualifiedName */ -static UA_INLINE void -UA_QualifiedName_init(UA_QualifiedName *p) { - memset(p, 0, sizeof(UA_QualifiedName)); -} - -static UA_INLINE UA_QualifiedName * -UA_QualifiedName_new(void) { - return (UA_QualifiedName*)UA_new(&UA_TYPES[UA_TYPES_QUALIFIEDNAME]); -} - -static UA_INLINE UA_StatusCode -UA_QualifiedName_copy(const UA_QualifiedName *src, UA_QualifiedName *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]); -} - -static UA_INLINE void -UA_QualifiedName_deleteMembers(UA_QualifiedName *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]); -} - -static UA_INLINE void -UA_QualifiedName_delete(UA_QualifiedName *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]); -} - -/* LocalizedText */ -static UA_INLINE void -UA_LocalizedText_init(UA_LocalizedText *p) { - memset(p, 0, sizeof(UA_LocalizedText)); -} - -static UA_INLINE UA_LocalizedText * -UA_LocalizedText_new(void) { - return (UA_LocalizedText*)UA_new(&UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); -} - -static UA_INLINE UA_StatusCode -UA_LocalizedText_copy(const UA_LocalizedText *src, UA_LocalizedText *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); -} - -static UA_INLINE void -UA_LocalizedText_deleteMembers(UA_LocalizedText *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); -} - -static UA_INLINE void -UA_LocalizedText_delete(UA_LocalizedText *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); -} - -/* ExtensionObject */ -static UA_INLINE void -UA_ExtensionObject_init(UA_ExtensionObject *p) { - memset(p, 0, sizeof(UA_ExtensionObject)); -} - -static UA_INLINE UA_ExtensionObject * -UA_ExtensionObject_new(void) { - return (UA_ExtensionObject*)UA_new(&UA_TYPES[UA_TYPES_EXTENSIONOBJECT]); -} - -static UA_INLINE UA_StatusCode -UA_ExtensionObject_copy(const UA_ExtensionObject *src, UA_ExtensionObject *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]); -} - -static UA_INLINE void -UA_ExtensionObject_deleteMembers(UA_ExtensionObject *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]); -} - -static UA_INLINE void -UA_ExtensionObject_delete(UA_ExtensionObject *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]); -} - -/* DataValue */ -static UA_INLINE void -UA_DataValue_init(UA_DataValue *p) { - memset(p, 0, sizeof(UA_DataValue)); -} - -static UA_INLINE UA_DataValue * -UA_DataValue_new(void) { - return (UA_DataValue*)UA_new(&UA_TYPES[UA_TYPES_DATAVALUE]); -} - -static UA_INLINE UA_StatusCode -UA_DataValue_copy(const UA_DataValue *src, UA_DataValue *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DATAVALUE]); -} - -static UA_INLINE void -UA_DataValue_deleteMembers(UA_DataValue *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DATAVALUE]); -} - -static UA_INLINE void -UA_DataValue_delete(UA_DataValue *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DATAVALUE]); -} - -/* Variant */ -static UA_INLINE void -UA_Variant_init(UA_Variant *p) { - memset(p, 0, sizeof(UA_Variant)); -} - -static UA_INLINE UA_Variant * -UA_Variant_new(void) { - return (UA_Variant*)UA_new(&UA_TYPES[UA_TYPES_VARIANT]); -} - -static UA_INLINE UA_StatusCode -UA_Variant_copy(const UA_Variant *src, UA_Variant *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_VARIANT]); -} - -static UA_INLINE void -UA_Variant_deleteMembers(UA_Variant *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_VARIANT]); -} - -static UA_INLINE void -UA_Variant_delete(UA_Variant *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_VARIANT]); -} - -/* DiagnosticInfo */ -static UA_INLINE void -UA_DiagnosticInfo_init(UA_DiagnosticInfo *p) { - memset(p, 0, sizeof(UA_DiagnosticInfo)); -} - -static UA_INLINE UA_DiagnosticInfo * -UA_DiagnosticInfo_new(void) { - return (UA_DiagnosticInfo*)UA_new(&UA_TYPES[UA_TYPES_DIAGNOSTICINFO]); -} - -static UA_INLINE UA_StatusCode -UA_DiagnosticInfo_copy(const UA_DiagnosticInfo *src, UA_DiagnosticInfo *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO]); -} - -static UA_INLINE void -UA_DiagnosticInfo_deleteMembers(UA_DiagnosticInfo *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO]); -} - -static UA_INLINE void -UA_DiagnosticInfo_delete(UA_DiagnosticInfo *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO]); -} - -/* IdType */ -static UA_INLINE void -UA_IdType_init(UA_IdType *p) { - memset(p, 0, sizeof(UA_IdType)); -} - -static UA_INLINE UA_IdType * -UA_IdType_new(void) { - return (UA_IdType*)UA_new(&UA_TYPES[UA_TYPES_IDTYPE]); -} - -static UA_INLINE UA_StatusCode -UA_IdType_copy(const UA_IdType *src, UA_IdType *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_IdType_deleteMembers(UA_IdType *p) { } - -static UA_INLINE void -UA_IdType_delete(UA_IdType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_IDTYPE]); -} - -/* NodeClass */ -static UA_INLINE void -UA_NodeClass_init(UA_NodeClass *p) { - memset(p, 0, sizeof(UA_NodeClass)); -} - -static UA_INLINE UA_NodeClass * -UA_NodeClass_new(void) { - return (UA_NodeClass*)UA_new(&UA_TYPES[UA_TYPES_NODECLASS]); -} - -static UA_INLINE UA_StatusCode -UA_NodeClass_copy(const UA_NodeClass *src, UA_NodeClass *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_NodeClass_deleteMembers(UA_NodeClass *p) { } - -static UA_INLINE void -UA_NodeClass_delete(UA_NodeClass *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_NODECLASS]); -} - -/* ReferenceNode */ -static UA_INLINE void -UA_ReferenceNode_init(UA_ReferenceNode *p) { - memset(p, 0, sizeof(UA_ReferenceNode)); -} - -static UA_INLINE UA_ReferenceNode * -UA_ReferenceNode_new(void) { - return (UA_ReferenceNode*)UA_new(&UA_TYPES[UA_TYPES_REFERENCENODE]); -} - -static UA_INLINE UA_StatusCode -UA_ReferenceNode_copy(const UA_ReferenceNode *src, UA_ReferenceNode *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REFERENCENODE]); -} - -static UA_INLINE void -UA_ReferenceNode_deleteMembers(UA_ReferenceNode *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REFERENCENODE]); -} - -static UA_INLINE void -UA_ReferenceNode_delete(UA_ReferenceNode *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REFERENCENODE]); -} - -/* Argument */ -static UA_INLINE void -UA_Argument_init(UA_Argument *p) { - memset(p, 0, sizeof(UA_Argument)); -} - -static UA_INLINE UA_Argument * -UA_Argument_new(void) { - return (UA_Argument*)UA_new(&UA_TYPES[UA_TYPES_ARGUMENT]); -} - -static UA_INLINE UA_StatusCode -UA_Argument_copy(const UA_Argument *src, UA_Argument *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ARGUMENT]); -} - -static UA_INLINE void -UA_Argument_deleteMembers(UA_Argument *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ARGUMENT]); -} - -static UA_INLINE void -UA_Argument_delete(UA_Argument *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ARGUMENT]); -} - -/* Duration */ -static UA_INLINE void -UA_Duration_init(UA_Duration *p) { - memset(p, 0, sizeof(UA_Duration)); -} - -static UA_INLINE UA_Duration * -UA_Duration_new(void) { - return (UA_Duration*)UA_new(&UA_TYPES[UA_TYPES_DURATION]); -} - -static UA_INLINE UA_StatusCode -UA_Duration_copy(const UA_Duration *src, UA_Duration *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DURATION]); -} - -static UA_INLINE void -UA_Duration_deleteMembers(UA_Duration *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DURATION]); -} - -static UA_INLINE void -UA_Duration_delete(UA_Duration *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DURATION]); -} - -/* UtcTime */ -static UA_INLINE void -UA_UtcTime_init(UA_UtcTime *p) { - memset(p, 0, sizeof(UA_UtcTime)); -} - -static UA_INLINE UA_UtcTime * -UA_UtcTime_new(void) { - return (UA_UtcTime*)UA_new(&UA_TYPES[UA_TYPES_UTCTIME]); -} - -static UA_INLINE UA_StatusCode -UA_UtcTime_copy(const UA_UtcTime *src, UA_UtcTime *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_UTCTIME]); -} - -static UA_INLINE void -UA_UtcTime_deleteMembers(UA_UtcTime *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_UTCTIME]); -} - -static UA_INLINE void -UA_UtcTime_delete(UA_UtcTime *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_UTCTIME]); -} - -/* LocaleId */ -static UA_INLINE void -UA_LocaleId_init(UA_LocaleId *p) { - memset(p, 0, sizeof(UA_LocaleId)); -} - -static UA_INLINE UA_LocaleId * -UA_LocaleId_new(void) { - return (UA_LocaleId*)UA_new(&UA_TYPES[UA_TYPES_LOCALEID]); -} - -static UA_INLINE UA_StatusCode -UA_LocaleId_copy(const UA_LocaleId *src, UA_LocaleId *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_LOCALEID]); -} - -static UA_INLINE void -UA_LocaleId_deleteMembers(UA_LocaleId *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_LOCALEID]); -} - -static UA_INLINE void -UA_LocaleId_delete(UA_LocaleId *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_LOCALEID]); -} - -/* TimeZoneDataType */ -static UA_INLINE void -UA_TimeZoneDataType_init(UA_TimeZoneDataType *p) { - memset(p, 0, sizeof(UA_TimeZoneDataType)); -} - -static UA_INLINE UA_TimeZoneDataType * -UA_TimeZoneDataType_new(void) { - return (UA_TimeZoneDataType*)UA_new(&UA_TYPES[UA_TYPES_TIMEZONEDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_TimeZoneDataType_copy(const UA_TimeZoneDataType *src, UA_TimeZoneDataType *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_TimeZoneDataType_deleteMembers(UA_TimeZoneDataType *p) { } - -static UA_INLINE void -UA_TimeZoneDataType_delete(UA_TimeZoneDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_TIMEZONEDATATYPE]); -} - -/* ApplicationType */ -static UA_INLINE void -UA_ApplicationType_init(UA_ApplicationType *p) { - memset(p, 0, sizeof(UA_ApplicationType)); -} - -static UA_INLINE UA_ApplicationType * -UA_ApplicationType_new(void) { - return (UA_ApplicationType*)UA_new(&UA_TYPES[UA_TYPES_APPLICATIONTYPE]); -} - -static UA_INLINE UA_StatusCode -UA_ApplicationType_copy(const UA_ApplicationType *src, UA_ApplicationType *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_ApplicationType_deleteMembers(UA_ApplicationType *p) { } - -static UA_INLINE void -UA_ApplicationType_delete(UA_ApplicationType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_APPLICATIONTYPE]); -} - -/* ApplicationDescription */ -static UA_INLINE void -UA_ApplicationDescription_init(UA_ApplicationDescription *p) { - memset(p, 0, sizeof(UA_ApplicationDescription)); -} - -static UA_INLINE UA_ApplicationDescription * -UA_ApplicationDescription_new(void) { - return (UA_ApplicationDescription*)UA_new(&UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION]); -} - -static UA_INLINE UA_StatusCode -UA_ApplicationDescription_copy(const UA_ApplicationDescription *src, UA_ApplicationDescription *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION]); -} - -static UA_INLINE void -UA_ApplicationDescription_deleteMembers(UA_ApplicationDescription *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION]); -} - -static UA_INLINE void -UA_ApplicationDescription_delete(UA_ApplicationDescription *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION]); -} - -/* RequestHeader */ -static UA_INLINE void -UA_RequestHeader_init(UA_RequestHeader *p) { - memset(p, 0, sizeof(UA_RequestHeader)); -} - -static UA_INLINE UA_RequestHeader * -UA_RequestHeader_new(void) { - return (UA_RequestHeader*)UA_new(&UA_TYPES[UA_TYPES_REQUESTHEADER]); -} - -static UA_INLINE UA_StatusCode -UA_RequestHeader_copy(const UA_RequestHeader *src, UA_RequestHeader *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REQUESTHEADER]); -} - -static UA_INLINE void -UA_RequestHeader_deleteMembers(UA_RequestHeader *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REQUESTHEADER]); -} - -static UA_INLINE void -UA_RequestHeader_delete(UA_RequestHeader *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REQUESTHEADER]); -} - -/* ResponseHeader */ -static UA_INLINE void -UA_ResponseHeader_init(UA_ResponseHeader *p) { - memset(p, 0, sizeof(UA_ResponseHeader)); -} - -static UA_INLINE UA_ResponseHeader * -UA_ResponseHeader_new(void) { - return (UA_ResponseHeader*)UA_new(&UA_TYPES[UA_TYPES_RESPONSEHEADER]); -} - -static UA_INLINE UA_StatusCode -UA_ResponseHeader_copy(const UA_ResponseHeader *src, UA_ResponseHeader *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_RESPONSEHEADER]); -} - -static UA_INLINE void -UA_ResponseHeader_deleteMembers(UA_ResponseHeader *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_RESPONSEHEADER]); -} - -static UA_INLINE void -UA_ResponseHeader_delete(UA_ResponseHeader *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_RESPONSEHEADER]); -} - -/* ServiceFault */ -static UA_INLINE void -UA_ServiceFault_init(UA_ServiceFault *p) { - memset(p, 0, sizeof(UA_ServiceFault)); -} - -static UA_INLINE UA_ServiceFault * -UA_ServiceFault_new(void) { - return (UA_ServiceFault*)UA_new(&UA_TYPES[UA_TYPES_SERVICEFAULT]); -} - -static UA_INLINE UA_StatusCode -UA_ServiceFault_copy(const UA_ServiceFault *src, UA_ServiceFault *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SERVICEFAULT]); -} - -static UA_INLINE void -UA_ServiceFault_deleteMembers(UA_ServiceFault *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SERVICEFAULT]); -} - -static UA_INLINE void -UA_ServiceFault_delete(UA_ServiceFault *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SERVICEFAULT]); -} - -/* FindServersRequest */ -static UA_INLINE void -UA_FindServersRequest_init(UA_FindServersRequest *p) { - memset(p, 0, sizeof(UA_FindServersRequest)); -} - -static UA_INLINE UA_FindServersRequest * -UA_FindServersRequest_new(void) { - return (UA_FindServersRequest*)UA_new(&UA_TYPES[UA_TYPES_FINDSERVERSREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_FindServersRequest_copy(const UA_FindServersRequest *src, UA_FindServersRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST]); -} - -static UA_INLINE void -UA_FindServersRequest_deleteMembers(UA_FindServersRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST]); -} - -static UA_INLINE void -UA_FindServersRequest_delete(UA_FindServersRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST]); -} - -/* FindServersResponse */ -static UA_INLINE void -UA_FindServersResponse_init(UA_FindServersResponse *p) { - memset(p, 0, sizeof(UA_FindServersResponse)); -} - -static UA_INLINE UA_FindServersResponse * -UA_FindServersResponse_new(void) { - return (UA_FindServersResponse*)UA_new(&UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_FindServersResponse_copy(const UA_FindServersResponse *src, UA_FindServersResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE]); -} - -static UA_INLINE void -UA_FindServersResponse_deleteMembers(UA_FindServersResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE]); -} - -static UA_INLINE void -UA_FindServersResponse_delete(UA_FindServersResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE]); -} - -/* ServerOnNetwork */ -static UA_INLINE void -UA_ServerOnNetwork_init(UA_ServerOnNetwork *p) { - memset(p, 0, sizeof(UA_ServerOnNetwork)); -} - -static UA_INLINE UA_ServerOnNetwork * -UA_ServerOnNetwork_new(void) { - return (UA_ServerOnNetwork*)UA_new(&UA_TYPES[UA_TYPES_SERVERONNETWORK]); -} - -static UA_INLINE UA_StatusCode -UA_ServerOnNetwork_copy(const UA_ServerOnNetwork *src, UA_ServerOnNetwork *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SERVERONNETWORK]); -} - -static UA_INLINE void -UA_ServerOnNetwork_deleteMembers(UA_ServerOnNetwork *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SERVERONNETWORK]); -} - -static UA_INLINE void -UA_ServerOnNetwork_delete(UA_ServerOnNetwork *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SERVERONNETWORK]); -} - -/* FindServersOnNetworkRequest */ -static UA_INLINE void -UA_FindServersOnNetworkRequest_init(UA_FindServersOnNetworkRequest *p) { - memset(p, 0, sizeof(UA_FindServersOnNetworkRequest)); -} - -static UA_INLINE UA_FindServersOnNetworkRequest * -UA_FindServersOnNetworkRequest_new(void) { - return (UA_FindServersOnNetworkRequest*)UA_new(&UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_FindServersOnNetworkRequest_copy(const UA_FindServersOnNetworkRequest *src, UA_FindServersOnNetworkRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKREQUEST]); -} - -static UA_INLINE void -UA_FindServersOnNetworkRequest_deleteMembers(UA_FindServersOnNetworkRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKREQUEST]); -} - -static UA_INLINE void -UA_FindServersOnNetworkRequest_delete(UA_FindServersOnNetworkRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKREQUEST]); -} - -/* FindServersOnNetworkResponse */ -static UA_INLINE void -UA_FindServersOnNetworkResponse_init(UA_FindServersOnNetworkResponse *p) { - memset(p, 0, sizeof(UA_FindServersOnNetworkResponse)); -} - -static UA_INLINE UA_FindServersOnNetworkResponse * -UA_FindServersOnNetworkResponse_new(void) { - return (UA_FindServersOnNetworkResponse*)UA_new(&UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_FindServersOnNetworkResponse_copy(const UA_FindServersOnNetworkResponse *src, UA_FindServersOnNetworkResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKRESPONSE]); -} - -static UA_INLINE void -UA_FindServersOnNetworkResponse_deleteMembers(UA_FindServersOnNetworkResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKRESPONSE]); -} - -static UA_INLINE void -UA_FindServersOnNetworkResponse_delete(UA_FindServersOnNetworkResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_FINDSERVERSONNETWORKRESPONSE]); -} - -/* MessageSecurityMode */ -static UA_INLINE void -UA_MessageSecurityMode_init(UA_MessageSecurityMode *p) { - memset(p, 0, sizeof(UA_MessageSecurityMode)); -} - -static UA_INLINE UA_MessageSecurityMode * -UA_MessageSecurityMode_new(void) { - return (UA_MessageSecurityMode*)UA_new(&UA_TYPES[UA_TYPES_MESSAGESECURITYMODE]); -} - -static UA_INLINE UA_StatusCode -UA_MessageSecurityMode_copy(const UA_MessageSecurityMode *src, UA_MessageSecurityMode *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_MessageSecurityMode_deleteMembers(UA_MessageSecurityMode *p) { } - -static UA_INLINE void -UA_MessageSecurityMode_delete(UA_MessageSecurityMode *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE]); -} - -/* UserTokenType */ -static UA_INLINE void -UA_UserTokenType_init(UA_UserTokenType *p) { - memset(p, 0, sizeof(UA_UserTokenType)); -} - -static UA_INLINE UA_UserTokenType * -UA_UserTokenType_new(void) { - return (UA_UserTokenType*)UA_new(&UA_TYPES[UA_TYPES_USERTOKENTYPE]); -} - -static UA_INLINE UA_StatusCode -UA_UserTokenType_copy(const UA_UserTokenType *src, UA_UserTokenType *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_UserTokenType_deleteMembers(UA_UserTokenType *p) { } - -static UA_INLINE void -UA_UserTokenType_delete(UA_UserTokenType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_USERTOKENTYPE]); -} - -/* UserTokenPolicy */ -static UA_INLINE void -UA_UserTokenPolicy_init(UA_UserTokenPolicy *p) { - memset(p, 0, sizeof(UA_UserTokenPolicy)); -} - -static UA_INLINE UA_UserTokenPolicy * -UA_UserTokenPolicy_new(void) { - return (UA_UserTokenPolicy*)UA_new(&UA_TYPES[UA_TYPES_USERTOKENPOLICY]); -} - -static UA_INLINE UA_StatusCode -UA_UserTokenPolicy_copy(const UA_UserTokenPolicy *src, UA_UserTokenPolicy *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]); -} - -static UA_INLINE void -UA_UserTokenPolicy_deleteMembers(UA_UserTokenPolicy *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]); -} - -static UA_INLINE void -UA_UserTokenPolicy_delete(UA_UserTokenPolicy *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]); -} - -/* EndpointDescription */ -static UA_INLINE void -UA_EndpointDescription_init(UA_EndpointDescription *p) { - memset(p, 0, sizeof(UA_EndpointDescription)); -} - -static UA_INLINE UA_EndpointDescription * -UA_EndpointDescription_new(void) { - return (UA_EndpointDescription*)UA_new(&UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); -} - -static UA_INLINE UA_StatusCode -UA_EndpointDescription_copy(const UA_EndpointDescription *src, UA_EndpointDescription *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); -} - -static UA_INLINE void -UA_EndpointDescription_deleteMembers(UA_EndpointDescription *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); -} - -static UA_INLINE void -UA_EndpointDescription_delete(UA_EndpointDescription *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); -} - -/* GetEndpointsRequest */ -static UA_INLINE void -UA_GetEndpointsRequest_init(UA_GetEndpointsRequest *p) { - memset(p, 0, sizeof(UA_GetEndpointsRequest)); -} - -static UA_INLINE UA_GetEndpointsRequest * -UA_GetEndpointsRequest_new(void) { - return (UA_GetEndpointsRequest*)UA_new(&UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_GetEndpointsRequest_copy(const UA_GetEndpointsRequest *src, UA_GetEndpointsRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST]); -} - -static UA_INLINE void -UA_GetEndpointsRequest_deleteMembers(UA_GetEndpointsRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST]); -} - -static UA_INLINE void -UA_GetEndpointsRequest_delete(UA_GetEndpointsRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST]); -} - -/* GetEndpointsResponse */ -static UA_INLINE void -UA_GetEndpointsResponse_init(UA_GetEndpointsResponse *p) { - memset(p, 0, sizeof(UA_GetEndpointsResponse)); -} - -static UA_INLINE UA_GetEndpointsResponse * -UA_GetEndpointsResponse_new(void) { - return (UA_GetEndpointsResponse*)UA_new(&UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_GetEndpointsResponse_copy(const UA_GetEndpointsResponse *src, UA_GetEndpointsResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]); -} - -static UA_INLINE void -UA_GetEndpointsResponse_deleteMembers(UA_GetEndpointsResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]); -} - -static UA_INLINE void -UA_GetEndpointsResponse_delete(UA_GetEndpointsResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]); -} - -/* RegisteredServer */ -static UA_INLINE void -UA_RegisteredServer_init(UA_RegisteredServer *p) { - memset(p, 0, sizeof(UA_RegisteredServer)); -} - -static UA_INLINE UA_RegisteredServer * -UA_RegisteredServer_new(void) { - return (UA_RegisteredServer*)UA_new(&UA_TYPES[UA_TYPES_REGISTEREDSERVER]); -} - -static UA_INLINE UA_StatusCode -UA_RegisteredServer_copy(const UA_RegisteredServer *src, UA_RegisteredServer *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REGISTEREDSERVER]); -} - -static UA_INLINE void -UA_RegisteredServer_deleteMembers(UA_RegisteredServer *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REGISTEREDSERVER]); -} - -static UA_INLINE void -UA_RegisteredServer_delete(UA_RegisteredServer *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REGISTEREDSERVER]); -} - -/* RegisterServerRequest */ -static UA_INLINE void -UA_RegisterServerRequest_init(UA_RegisterServerRequest *p) { - memset(p, 0, sizeof(UA_RegisterServerRequest)); -} - -static UA_INLINE UA_RegisterServerRequest * -UA_RegisterServerRequest_new(void) { - return (UA_RegisterServerRequest*)UA_new(&UA_TYPES[UA_TYPES_REGISTERSERVERREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_RegisterServerRequest_copy(const UA_RegisterServerRequest *src, UA_RegisterServerRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REGISTERSERVERREQUEST]); -} - -static UA_INLINE void -UA_RegisterServerRequest_deleteMembers(UA_RegisterServerRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REGISTERSERVERREQUEST]); -} - -static UA_INLINE void -UA_RegisterServerRequest_delete(UA_RegisterServerRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REGISTERSERVERREQUEST]); -} - -/* RegisterServerResponse */ -static UA_INLINE void -UA_RegisterServerResponse_init(UA_RegisterServerResponse *p) { - memset(p, 0, sizeof(UA_RegisterServerResponse)); -} - -static UA_INLINE UA_RegisterServerResponse * -UA_RegisterServerResponse_new(void) { - return (UA_RegisterServerResponse*)UA_new(&UA_TYPES[UA_TYPES_REGISTERSERVERRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_RegisterServerResponse_copy(const UA_RegisterServerResponse *src, UA_RegisterServerResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REGISTERSERVERRESPONSE]); -} - -static UA_INLINE void -UA_RegisterServerResponse_deleteMembers(UA_RegisterServerResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REGISTERSERVERRESPONSE]); -} - -static UA_INLINE void -UA_RegisterServerResponse_delete(UA_RegisterServerResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REGISTERSERVERRESPONSE]); -} - -/* DiscoveryConfiguration */ -static UA_INLINE void -UA_DiscoveryConfiguration_init(UA_DiscoveryConfiguration *p) { - memset(p, 0, sizeof(UA_DiscoveryConfiguration)); -} - -static UA_INLINE UA_DiscoveryConfiguration * -UA_DiscoveryConfiguration_new(void) { - return (UA_DiscoveryConfiguration*)UA_new(&UA_TYPES[UA_TYPES_DISCOVERYCONFIGURATION]); -} - -static UA_INLINE UA_StatusCode -UA_DiscoveryConfiguration_copy(const UA_DiscoveryConfiguration *src, UA_DiscoveryConfiguration *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_DiscoveryConfiguration_deleteMembers(UA_DiscoveryConfiguration *p) { } - -static UA_INLINE void -UA_DiscoveryConfiguration_delete(UA_DiscoveryConfiguration *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DISCOVERYCONFIGURATION]); -} - -/* MdnsDiscoveryConfiguration */ -static UA_INLINE void -UA_MdnsDiscoveryConfiguration_init(UA_MdnsDiscoveryConfiguration *p) { - memset(p, 0, sizeof(UA_MdnsDiscoveryConfiguration)); -} - -static UA_INLINE UA_MdnsDiscoveryConfiguration * -UA_MdnsDiscoveryConfiguration_new(void) { - return (UA_MdnsDiscoveryConfiguration*)UA_new(&UA_TYPES[UA_TYPES_MDNSDISCOVERYCONFIGURATION]); -} - -static UA_INLINE UA_StatusCode -UA_MdnsDiscoveryConfiguration_copy(const UA_MdnsDiscoveryConfiguration *src, UA_MdnsDiscoveryConfiguration *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MDNSDISCOVERYCONFIGURATION]); -} - -static UA_INLINE void -UA_MdnsDiscoveryConfiguration_deleteMembers(UA_MdnsDiscoveryConfiguration *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MDNSDISCOVERYCONFIGURATION]); -} - -static UA_INLINE void -UA_MdnsDiscoveryConfiguration_delete(UA_MdnsDiscoveryConfiguration *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MDNSDISCOVERYCONFIGURATION]); -} - -/* RegisterServer2Request */ -static UA_INLINE void -UA_RegisterServer2Request_init(UA_RegisterServer2Request *p) { - memset(p, 0, sizeof(UA_RegisterServer2Request)); -} - -static UA_INLINE UA_RegisterServer2Request * -UA_RegisterServer2Request_new(void) { - return (UA_RegisterServer2Request*)UA_new(&UA_TYPES[UA_TYPES_REGISTERSERVER2REQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_RegisterServer2Request_copy(const UA_RegisterServer2Request *src, UA_RegisterServer2Request *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REGISTERSERVER2REQUEST]); -} - -static UA_INLINE void -UA_RegisterServer2Request_deleteMembers(UA_RegisterServer2Request *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REGISTERSERVER2REQUEST]); -} - -static UA_INLINE void -UA_RegisterServer2Request_delete(UA_RegisterServer2Request *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REGISTERSERVER2REQUEST]); -} - -/* RegisterServer2Response */ -static UA_INLINE void -UA_RegisterServer2Response_init(UA_RegisterServer2Response *p) { - memset(p, 0, sizeof(UA_RegisterServer2Response)); -} - -static UA_INLINE UA_RegisterServer2Response * -UA_RegisterServer2Response_new(void) { - return (UA_RegisterServer2Response*)UA_new(&UA_TYPES[UA_TYPES_REGISTERSERVER2RESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_RegisterServer2Response_copy(const UA_RegisterServer2Response *src, UA_RegisterServer2Response *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REGISTERSERVER2RESPONSE]); -} - -static UA_INLINE void -UA_RegisterServer2Response_deleteMembers(UA_RegisterServer2Response *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REGISTERSERVER2RESPONSE]); -} - -static UA_INLINE void -UA_RegisterServer2Response_delete(UA_RegisterServer2Response *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REGISTERSERVER2RESPONSE]); -} - -/* SecurityTokenRequestType */ -static UA_INLINE void -UA_SecurityTokenRequestType_init(UA_SecurityTokenRequestType *p) { - memset(p, 0, sizeof(UA_SecurityTokenRequestType)); -} - -static UA_INLINE UA_SecurityTokenRequestType * -UA_SecurityTokenRequestType_new(void) { - return (UA_SecurityTokenRequestType*)UA_new(&UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE]); -} - -static UA_INLINE UA_StatusCode -UA_SecurityTokenRequestType_copy(const UA_SecurityTokenRequestType *src, UA_SecurityTokenRequestType *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_SecurityTokenRequestType_deleteMembers(UA_SecurityTokenRequestType *p) { } - -static UA_INLINE void -UA_SecurityTokenRequestType_delete(UA_SecurityTokenRequestType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE]); -} - -/* ChannelSecurityToken */ -static UA_INLINE void -UA_ChannelSecurityToken_init(UA_ChannelSecurityToken *p) { - memset(p, 0, sizeof(UA_ChannelSecurityToken)); -} - -static UA_INLINE UA_ChannelSecurityToken * -UA_ChannelSecurityToken_new(void) { - return (UA_ChannelSecurityToken*)UA_new(&UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN]); -} - -static UA_INLINE UA_StatusCode -UA_ChannelSecurityToken_copy(const UA_ChannelSecurityToken *src, UA_ChannelSecurityToken *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_ChannelSecurityToken_deleteMembers(UA_ChannelSecurityToken *p) { } - -static UA_INLINE void -UA_ChannelSecurityToken_delete(UA_ChannelSecurityToken *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN]); -} - -/* OpenSecureChannelRequest */ -static UA_INLINE void -UA_OpenSecureChannelRequest_init(UA_OpenSecureChannelRequest *p) { - memset(p, 0, sizeof(UA_OpenSecureChannelRequest)); -} - -static UA_INLINE UA_OpenSecureChannelRequest * -UA_OpenSecureChannelRequest_new(void) { - return (UA_OpenSecureChannelRequest*)UA_new(&UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_OpenSecureChannelRequest_copy(const UA_OpenSecureChannelRequest *src, UA_OpenSecureChannelRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST]); -} - -static UA_INLINE void -UA_OpenSecureChannelRequest_deleteMembers(UA_OpenSecureChannelRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST]); -} - -static UA_INLINE void -UA_OpenSecureChannelRequest_delete(UA_OpenSecureChannelRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST]); -} - -/* OpenSecureChannelResponse */ -static UA_INLINE void -UA_OpenSecureChannelResponse_init(UA_OpenSecureChannelResponse *p) { - memset(p, 0, sizeof(UA_OpenSecureChannelResponse)); -} - -static UA_INLINE UA_OpenSecureChannelResponse * -UA_OpenSecureChannelResponse_new(void) { - return (UA_OpenSecureChannelResponse*)UA_new(&UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_OpenSecureChannelResponse_copy(const UA_OpenSecureChannelResponse *src, UA_OpenSecureChannelResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]); -} - -static UA_INLINE void -UA_OpenSecureChannelResponse_deleteMembers(UA_OpenSecureChannelResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]); -} - -static UA_INLINE void -UA_OpenSecureChannelResponse_delete(UA_OpenSecureChannelResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]); -} - -/* CloseSecureChannelRequest */ -static UA_INLINE void -UA_CloseSecureChannelRequest_init(UA_CloseSecureChannelRequest *p) { - memset(p, 0, sizeof(UA_CloseSecureChannelRequest)); -} - -static UA_INLINE UA_CloseSecureChannelRequest * -UA_CloseSecureChannelRequest_new(void) { - return (UA_CloseSecureChannelRequest*)UA_new(&UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_CloseSecureChannelRequest_copy(const UA_CloseSecureChannelRequest *src, UA_CloseSecureChannelRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST]); -} - -static UA_INLINE void -UA_CloseSecureChannelRequest_deleteMembers(UA_CloseSecureChannelRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST]); -} - -static UA_INLINE void -UA_CloseSecureChannelRequest_delete(UA_CloseSecureChannelRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST]); -} - -/* CloseSecureChannelResponse */ -static UA_INLINE void -UA_CloseSecureChannelResponse_init(UA_CloseSecureChannelResponse *p) { - memset(p, 0, sizeof(UA_CloseSecureChannelResponse)); -} - -static UA_INLINE UA_CloseSecureChannelResponse * -UA_CloseSecureChannelResponse_new(void) { - return (UA_CloseSecureChannelResponse*)UA_new(&UA_TYPES[UA_TYPES_CLOSESECURECHANNELRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_CloseSecureChannelResponse_copy(const UA_CloseSecureChannelResponse *src, UA_CloseSecureChannelResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELRESPONSE]); -} - -static UA_INLINE void -UA_CloseSecureChannelResponse_deleteMembers(UA_CloseSecureChannelResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELRESPONSE]); -} - -static UA_INLINE void -UA_CloseSecureChannelResponse_delete(UA_CloseSecureChannelResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELRESPONSE]); -} - -/* SignedSoftwareCertificate */ -static UA_INLINE void -UA_SignedSoftwareCertificate_init(UA_SignedSoftwareCertificate *p) { - memset(p, 0, sizeof(UA_SignedSoftwareCertificate)); -} - -static UA_INLINE UA_SignedSoftwareCertificate * -UA_SignedSoftwareCertificate_new(void) { - return (UA_SignedSoftwareCertificate*)UA_new(&UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE]); -} - -static UA_INLINE UA_StatusCode -UA_SignedSoftwareCertificate_copy(const UA_SignedSoftwareCertificate *src, UA_SignedSoftwareCertificate *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE]); -} - -static UA_INLINE void -UA_SignedSoftwareCertificate_deleteMembers(UA_SignedSoftwareCertificate *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE]); -} - -static UA_INLINE void -UA_SignedSoftwareCertificate_delete(UA_SignedSoftwareCertificate *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE]); -} - -/* SignatureData */ -static UA_INLINE void -UA_SignatureData_init(UA_SignatureData *p) { - memset(p, 0, sizeof(UA_SignatureData)); -} - -static UA_INLINE UA_SignatureData * -UA_SignatureData_new(void) { - return (UA_SignatureData*)UA_new(&UA_TYPES[UA_TYPES_SIGNATUREDATA]); -} - -static UA_INLINE UA_StatusCode -UA_SignatureData_copy(const UA_SignatureData *src, UA_SignatureData *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SIGNATUREDATA]); -} - -static UA_INLINE void -UA_SignatureData_deleteMembers(UA_SignatureData *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SIGNATUREDATA]); -} - -static UA_INLINE void -UA_SignatureData_delete(UA_SignatureData *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SIGNATUREDATA]); -} - -/* CreateSessionRequest */ -static UA_INLINE void -UA_CreateSessionRequest_init(UA_CreateSessionRequest *p) { - memset(p, 0, sizeof(UA_CreateSessionRequest)); -} - -static UA_INLINE UA_CreateSessionRequest * -UA_CreateSessionRequest_new(void) { - return (UA_CreateSessionRequest*)UA_new(&UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_CreateSessionRequest_copy(const UA_CreateSessionRequest *src, UA_CreateSessionRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]); -} - -static UA_INLINE void -UA_CreateSessionRequest_deleteMembers(UA_CreateSessionRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]); -} - -static UA_INLINE void -UA_CreateSessionRequest_delete(UA_CreateSessionRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]); -} - -/* CreateSessionResponse */ -static UA_INLINE void -UA_CreateSessionResponse_init(UA_CreateSessionResponse *p) { - memset(p, 0, sizeof(UA_CreateSessionResponse)); -} - -static UA_INLINE UA_CreateSessionResponse * -UA_CreateSessionResponse_new(void) { - return (UA_CreateSessionResponse*)UA_new(&UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_CreateSessionResponse_copy(const UA_CreateSessionResponse *src, UA_CreateSessionResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE]); -} - -static UA_INLINE void -UA_CreateSessionResponse_deleteMembers(UA_CreateSessionResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE]); -} - -static UA_INLINE void -UA_CreateSessionResponse_delete(UA_CreateSessionResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE]); -} - -/* UserIdentityToken */ -static UA_INLINE void -UA_UserIdentityToken_init(UA_UserIdentityToken *p) { - memset(p, 0, sizeof(UA_UserIdentityToken)); -} - -static UA_INLINE UA_UserIdentityToken * -UA_UserIdentityToken_new(void) { - return (UA_UserIdentityToken*)UA_new(&UA_TYPES[UA_TYPES_USERIDENTITYTOKEN]); -} - -static UA_INLINE UA_StatusCode -UA_UserIdentityToken_copy(const UA_UserIdentityToken *src, UA_UserIdentityToken *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN]); -} - -static UA_INLINE void -UA_UserIdentityToken_deleteMembers(UA_UserIdentityToken *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN]); -} - -static UA_INLINE void -UA_UserIdentityToken_delete(UA_UserIdentityToken *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN]); -} - -/* AnonymousIdentityToken */ -static UA_INLINE void -UA_AnonymousIdentityToken_init(UA_AnonymousIdentityToken *p) { - memset(p, 0, sizeof(UA_AnonymousIdentityToken)); -} - -static UA_INLINE UA_AnonymousIdentityToken * -UA_AnonymousIdentityToken_new(void) { - return (UA_AnonymousIdentityToken*)UA_new(&UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN]); -} - -static UA_INLINE UA_StatusCode -UA_AnonymousIdentityToken_copy(const UA_AnonymousIdentityToken *src, UA_AnonymousIdentityToken *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN]); -} - -static UA_INLINE void -UA_AnonymousIdentityToken_deleteMembers(UA_AnonymousIdentityToken *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN]); -} - -static UA_INLINE void -UA_AnonymousIdentityToken_delete(UA_AnonymousIdentityToken *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN]); -} - -/* UserNameIdentityToken */ -static UA_INLINE void -UA_UserNameIdentityToken_init(UA_UserNameIdentityToken *p) { - memset(p, 0, sizeof(UA_UserNameIdentityToken)); -} - -static UA_INLINE UA_UserNameIdentityToken * -UA_UserNameIdentityToken_new(void) { - return (UA_UserNameIdentityToken*)UA_new(&UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]); -} - -static UA_INLINE UA_StatusCode -UA_UserNameIdentityToken_copy(const UA_UserNameIdentityToken *src, UA_UserNameIdentityToken *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]); -} - -static UA_INLINE void -UA_UserNameIdentityToken_deleteMembers(UA_UserNameIdentityToken *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]); -} - -static UA_INLINE void -UA_UserNameIdentityToken_delete(UA_UserNameIdentityToken *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]); -} - -/* ActivateSessionRequest */ -static UA_INLINE void -UA_ActivateSessionRequest_init(UA_ActivateSessionRequest *p) { - memset(p, 0, sizeof(UA_ActivateSessionRequest)); -} - -static UA_INLINE UA_ActivateSessionRequest * -UA_ActivateSessionRequest_new(void) { - return (UA_ActivateSessionRequest*)UA_new(&UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_ActivateSessionRequest_copy(const UA_ActivateSessionRequest *src, UA_ActivateSessionRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]); -} - -static UA_INLINE void -UA_ActivateSessionRequest_deleteMembers(UA_ActivateSessionRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]); -} - -static UA_INLINE void -UA_ActivateSessionRequest_delete(UA_ActivateSessionRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]); -} - -/* ActivateSessionResponse */ -static UA_INLINE void -UA_ActivateSessionResponse_init(UA_ActivateSessionResponse *p) { - memset(p, 0, sizeof(UA_ActivateSessionResponse)); -} - -static UA_INLINE UA_ActivateSessionResponse * -UA_ActivateSessionResponse_new(void) { - return (UA_ActivateSessionResponse*)UA_new(&UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_ActivateSessionResponse_copy(const UA_ActivateSessionResponse *src, UA_ActivateSessionResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE]); -} - -static UA_INLINE void -UA_ActivateSessionResponse_deleteMembers(UA_ActivateSessionResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE]); -} - -static UA_INLINE void -UA_ActivateSessionResponse_delete(UA_ActivateSessionResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE]); -} - -/* CloseSessionRequest */ -static UA_INLINE void -UA_CloseSessionRequest_init(UA_CloseSessionRequest *p) { - memset(p, 0, sizeof(UA_CloseSessionRequest)); -} - -static UA_INLINE UA_CloseSessionRequest * -UA_CloseSessionRequest_new(void) { - return (UA_CloseSessionRequest*)UA_new(&UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_CloseSessionRequest_copy(const UA_CloseSessionRequest *src, UA_CloseSessionRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST]); -} - -static UA_INLINE void -UA_CloseSessionRequest_deleteMembers(UA_CloseSessionRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST]); -} - -static UA_INLINE void -UA_CloseSessionRequest_delete(UA_CloseSessionRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST]); -} - -/* CloseSessionResponse */ -static UA_INLINE void -UA_CloseSessionResponse_init(UA_CloseSessionResponse *p) { - memset(p, 0, sizeof(UA_CloseSessionResponse)); -} - -static UA_INLINE UA_CloseSessionResponse * -UA_CloseSessionResponse_new(void) { - return (UA_CloseSessionResponse*)UA_new(&UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_CloseSessionResponse_copy(const UA_CloseSessionResponse *src, UA_CloseSessionResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]); -} - -static UA_INLINE void -UA_CloseSessionResponse_deleteMembers(UA_CloseSessionResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]); -} - -static UA_INLINE void -UA_CloseSessionResponse_delete(UA_CloseSessionResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]); -} - -/* NodeAttributesMask */ -static UA_INLINE void -UA_NodeAttributesMask_init(UA_NodeAttributesMask *p) { - memset(p, 0, sizeof(UA_NodeAttributesMask)); -} - -static UA_INLINE UA_NodeAttributesMask * -UA_NodeAttributesMask_new(void) { - return (UA_NodeAttributesMask*)UA_new(&UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK]); -} - -static UA_INLINE UA_StatusCode -UA_NodeAttributesMask_copy(const UA_NodeAttributesMask *src, UA_NodeAttributesMask *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_NodeAttributesMask_deleteMembers(UA_NodeAttributesMask *p) { } - -static UA_INLINE void -UA_NodeAttributesMask_delete(UA_NodeAttributesMask *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK]); -} - -/* NodeAttributes */ -static UA_INLINE void -UA_NodeAttributes_init(UA_NodeAttributes *p) { - memset(p, 0, sizeof(UA_NodeAttributes)); -} - -static UA_INLINE UA_NodeAttributes * -UA_NodeAttributes_new(void) { - return (UA_NodeAttributes*)UA_new(&UA_TYPES[UA_TYPES_NODEATTRIBUTES]); -} - -static UA_INLINE UA_StatusCode -UA_NodeAttributes_copy(const UA_NodeAttributes *src, UA_NodeAttributes *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTES]); -} - -static UA_INLINE void -UA_NodeAttributes_deleteMembers(UA_NodeAttributes *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_NODEATTRIBUTES]); -} - -static UA_INLINE void -UA_NodeAttributes_delete(UA_NodeAttributes *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_NODEATTRIBUTES]); -} - -/* ObjectAttributes */ -static UA_INLINE void -UA_ObjectAttributes_init(UA_ObjectAttributes *p) { - memset(p, 0, sizeof(UA_ObjectAttributes)); -} - -static UA_INLINE UA_ObjectAttributes * -UA_ObjectAttributes_new(void) { - return (UA_ObjectAttributes*)UA_new(&UA_TYPES[UA_TYPES_OBJECTATTRIBUTES]); -} - -static UA_INLINE UA_StatusCode -UA_ObjectAttributes_copy(const UA_ObjectAttributes *src, UA_ObjectAttributes *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES]); -} - -static UA_INLINE void -UA_ObjectAttributes_deleteMembers(UA_ObjectAttributes *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES]); -} - -static UA_INLINE void -UA_ObjectAttributes_delete(UA_ObjectAttributes *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES]); -} - -/* VariableAttributes */ -static UA_INLINE void -UA_VariableAttributes_init(UA_VariableAttributes *p) { - memset(p, 0, sizeof(UA_VariableAttributes)); -} - -static UA_INLINE UA_VariableAttributes * -UA_VariableAttributes_new(void) { - return (UA_VariableAttributes*)UA_new(&UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES]); -} - -static UA_INLINE UA_StatusCode -UA_VariableAttributes_copy(const UA_VariableAttributes *src, UA_VariableAttributes *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES]); -} - -static UA_INLINE void -UA_VariableAttributes_deleteMembers(UA_VariableAttributes *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES]); -} - -static UA_INLINE void -UA_VariableAttributes_delete(UA_VariableAttributes *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES]); -} - -/* MethodAttributes */ -static UA_INLINE void -UA_MethodAttributes_init(UA_MethodAttributes *p) { - memset(p, 0, sizeof(UA_MethodAttributes)); -} - -static UA_INLINE UA_MethodAttributes * -UA_MethodAttributes_new(void) { - return (UA_MethodAttributes*)UA_new(&UA_TYPES[UA_TYPES_METHODATTRIBUTES]); -} - -static UA_INLINE UA_StatusCode -UA_MethodAttributes_copy(const UA_MethodAttributes *src, UA_MethodAttributes *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_METHODATTRIBUTES]); -} - -static UA_INLINE void -UA_MethodAttributes_deleteMembers(UA_MethodAttributes *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_METHODATTRIBUTES]); -} - -static UA_INLINE void -UA_MethodAttributes_delete(UA_MethodAttributes *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_METHODATTRIBUTES]); -} - -/* ObjectTypeAttributes */ -static UA_INLINE void -UA_ObjectTypeAttributes_init(UA_ObjectTypeAttributes *p) { - memset(p, 0, sizeof(UA_ObjectTypeAttributes)); -} - -static UA_INLINE UA_ObjectTypeAttributes * -UA_ObjectTypeAttributes_new(void) { - return (UA_ObjectTypeAttributes*)UA_new(&UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES]); -} - -static UA_INLINE UA_StatusCode -UA_ObjectTypeAttributes_copy(const UA_ObjectTypeAttributes *src, UA_ObjectTypeAttributes *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES]); -} - -static UA_INLINE void -UA_ObjectTypeAttributes_deleteMembers(UA_ObjectTypeAttributes *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES]); -} - -static UA_INLINE void -UA_ObjectTypeAttributes_delete(UA_ObjectTypeAttributes *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES]); -} - -/* VariableTypeAttributes */ -static UA_INLINE void -UA_VariableTypeAttributes_init(UA_VariableTypeAttributes *p) { - memset(p, 0, sizeof(UA_VariableTypeAttributes)); -} - -static UA_INLINE UA_VariableTypeAttributes * -UA_VariableTypeAttributes_new(void) { - return (UA_VariableTypeAttributes*)UA_new(&UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES]); -} - -static UA_INLINE UA_StatusCode -UA_VariableTypeAttributes_copy(const UA_VariableTypeAttributes *src, UA_VariableTypeAttributes *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES]); -} - -static UA_INLINE void -UA_VariableTypeAttributes_deleteMembers(UA_VariableTypeAttributes *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES]); -} - -static UA_INLINE void -UA_VariableTypeAttributes_delete(UA_VariableTypeAttributes *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES]); -} - -/* ReferenceTypeAttributes */ -static UA_INLINE void -UA_ReferenceTypeAttributes_init(UA_ReferenceTypeAttributes *p) { - memset(p, 0, sizeof(UA_ReferenceTypeAttributes)); -} - -static UA_INLINE UA_ReferenceTypeAttributes * -UA_ReferenceTypeAttributes_new(void) { - return (UA_ReferenceTypeAttributes*)UA_new(&UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES]); -} - -static UA_INLINE UA_StatusCode -UA_ReferenceTypeAttributes_copy(const UA_ReferenceTypeAttributes *src, UA_ReferenceTypeAttributes *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES]); -} - -static UA_INLINE void -UA_ReferenceTypeAttributes_deleteMembers(UA_ReferenceTypeAttributes *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES]); -} - -static UA_INLINE void -UA_ReferenceTypeAttributes_delete(UA_ReferenceTypeAttributes *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES]); -} - -/* DataTypeAttributes */ -static UA_INLINE void -UA_DataTypeAttributes_init(UA_DataTypeAttributes *p) { - memset(p, 0, sizeof(UA_DataTypeAttributes)); -} - -static UA_INLINE UA_DataTypeAttributes * -UA_DataTypeAttributes_new(void) { - return (UA_DataTypeAttributes*)UA_new(&UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES]); -} - -static UA_INLINE UA_StatusCode -UA_DataTypeAttributes_copy(const UA_DataTypeAttributes *src, UA_DataTypeAttributes *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES]); -} - -static UA_INLINE void -UA_DataTypeAttributes_deleteMembers(UA_DataTypeAttributes *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES]); -} - -static UA_INLINE void -UA_DataTypeAttributes_delete(UA_DataTypeAttributes *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES]); -} - -/* ViewAttributes */ -static UA_INLINE void -UA_ViewAttributes_init(UA_ViewAttributes *p) { - memset(p, 0, sizeof(UA_ViewAttributes)); -} - -static UA_INLINE UA_ViewAttributes * -UA_ViewAttributes_new(void) { - return (UA_ViewAttributes*)UA_new(&UA_TYPES[UA_TYPES_VIEWATTRIBUTES]); -} - -static UA_INLINE UA_StatusCode -UA_ViewAttributes_copy(const UA_ViewAttributes *src, UA_ViewAttributes *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES]); -} - -static UA_INLINE void -UA_ViewAttributes_deleteMembers(UA_ViewAttributes *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES]); -} - -static UA_INLINE void -UA_ViewAttributes_delete(UA_ViewAttributes *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES]); -} - -/* AddNodesItem */ -static UA_INLINE void -UA_AddNodesItem_init(UA_AddNodesItem *p) { - memset(p, 0, sizeof(UA_AddNodesItem)); -} - -static UA_INLINE UA_AddNodesItem * -UA_AddNodesItem_new(void) { - return (UA_AddNodesItem*)UA_new(&UA_TYPES[UA_TYPES_ADDNODESITEM]); -} - -static UA_INLINE UA_StatusCode -UA_AddNodesItem_copy(const UA_AddNodesItem *src, UA_AddNodesItem *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ADDNODESITEM]); -} - -static UA_INLINE void -UA_AddNodesItem_deleteMembers(UA_AddNodesItem *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ADDNODESITEM]); -} - -static UA_INLINE void -UA_AddNodesItem_delete(UA_AddNodesItem *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ADDNODESITEM]); -} - -/* AddNodesResult */ -static UA_INLINE void -UA_AddNodesResult_init(UA_AddNodesResult *p) { - memset(p, 0, sizeof(UA_AddNodesResult)); -} - -static UA_INLINE UA_AddNodesResult * -UA_AddNodesResult_new(void) { - return (UA_AddNodesResult*)UA_new(&UA_TYPES[UA_TYPES_ADDNODESRESULT]); -} - -static UA_INLINE UA_StatusCode -UA_AddNodesResult_copy(const UA_AddNodesResult *src, UA_AddNodesResult *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ADDNODESRESULT]); -} - -static UA_INLINE void -UA_AddNodesResult_deleteMembers(UA_AddNodesResult *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ADDNODESRESULT]); -} - -static UA_INLINE void -UA_AddNodesResult_delete(UA_AddNodesResult *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ADDNODESRESULT]); -} - -/* AddNodesRequest */ -static UA_INLINE void -UA_AddNodesRequest_init(UA_AddNodesRequest *p) { - memset(p, 0, sizeof(UA_AddNodesRequest)); -} - -static UA_INLINE UA_AddNodesRequest * -UA_AddNodesRequest_new(void) { - return (UA_AddNodesRequest*)UA_new(&UA_TYPES[UA_TYPES_ADDNODESREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_AddNodesRequest_copy(const UA_AddNodesRequest *src, UA_AddNodesRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ADDNODESREQUEST]); -} - -static UA_INLINE void -UA_AddNodesRequest_deleteMembers(UA_AddNodesRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ADDNODESREQUEST]); -} - -static UA_INLINE void -UA_AddNodesRequest_delete(UA_AddNodesRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ADDNODESREQUEST]); -} - -/* AddNodesResponse */ -static UA_INLINE void -UA_AddNodesResponse_init(UA_AddNodesResponse *p) { - memset(p, 0, sizeof(UA_AddNodesResponse)); -} - -static UA_INLINE UA_AddNodesResponse * -UA_AddNodesResponse_new(void) { - return (UA_AddNodesResponse*)UA_new(&UA_TYPES[UA_TYPES_ADDNODESRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_AddNodesResponse_copy(const UA_AddNodesResponse *src, UA_AddNodesResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]); -} - -static UA_INLINE void -UA_AddNodesResponse_deleteMembers(UA_AddNodesResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]); -} - -static UA_INLINE void -UA_AddNodesResponse_delete(UA_AddNodesResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]); -} - -/* AddReferencesItem */ -static UA_INLINE void -UA_AddReferencesItem_init(UA_AddReferencesItem *p) { - memset(p, 0, sizeof(UA_AddReferencesItem)); -} - -static UA_INLINE UA_AddReferencesItem * -UA_AddReferencesItem_new(void) { - return (UA_AddReferencesItem*)UA_new(&UA_TYPES[UA_TYPES_ADDREFERENCESITEM]); -} - -static UA_INLINE UA_StatusCode -UA_AddReferencesItem_copy(const UA_AddReferencesItem *src, UA_AddReferencesItem *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM]); -} - -static UA_INLINE void -UA_AddReferencesItem_deleteMembers(UA_AddReferencesItem *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM]); -} - -static UA_INLINE void -UA_AddReferencesItem_delete(UA_AddReferencesItem *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM]); -} - -/* AddReferencesRequest */ -static UA_INLINE void -UA_AddReferencesRequest_init(UA_AddReferencesRequest *p) { - memset(p, 0, sizeof(UA_AddReferencesRequest)); -} - -static UA_INLINE UA_AddReferencesRequest * -UA_AddReferencesRequest_new(void) { - return (UA_AddReferencesRequest*)UA_new(&UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_AddReferencesRequest_copy(const UA_AddReferencesRequest *src, UA_AddReferencesRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST]); -} - -static UA_INLINE void -UA_AddReferencesRequest_deleteMembers(UA_AddReferencesRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST]); -} - -static UA_INLINE void -UA_AddReferencesRequest_delete(UA_AddReferencesRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST]); -} - -/* AddReferencesResponse */ -static UA_INLINE void -UA_AddReferencesResponse_init(UA_AddReferencesResponse *p) { - memset(p, 0, sizeof(UA_AddReferencesResponse)); -} - -static UA_INLINE UA_AddReferencesResponse * -UA_AddReferencesResponse_new(void) { - return (UA_AddReferencesResponse*)UA_new(&UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_AddReferencesResponse_copy(const UA_AddReferencesResponse *src, UA_AddReferencesResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE]); -} - -static UA_INLINE void -UA_AddReferencesResponse_deleteMembers(UA_AddReferencesResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE]); -} - -static UA_INLINE void -UA_AddReferencesResponse_delete(UA_AddReferencesResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE]); -} - -/* DeleteNodesItem */ -static UA_INLINE void -UA_DeleteNodesItem_init(UA_DeleteNodesItem *p) { - memset(p, 0, sizeof(UA_DeleteNodesItem)); -} - -static UA_INLINE UA_DeleteNodesItem * -UA_DeleteNodesItem_new(void) { - return (UA_DeleteNodesItem*)UA_new(&UA_TYPES[UA_TYPES_DELETENODESITEM]); -} - -static UA_INLINE UA_StatusCode -UA_DeleteNodesItem_copy(const UA_DeleteNodesItem *src, UA_DeleteNodesItem *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DELETENODESITEM]); -} - -static UA_INLINE void -UA_DeleteNodesItem_deleteMembers(UA_DeleteNodesItem *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DELETENODESITEM]); -} - -static UA_INLINE void -UA_DeleteNodesItem_delete(UA_DeleteNodesItem *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DELETENODESITEM]); -} - -/* DeleteNodesRequest */ -static UA_INLINE void -UA_DeleteNodesRequest_init(UA_DeleteNodesRequest *p) { - memset(p, 0, sizeof(UA_DeleteNodesRequest)); -} - -static UA_INLINE UA_DeleteNodesRequest * -UA_DeleteNodesRequest_new(void) { - return (UA_DeleteNodesRequest*)UA_new(&UA_TYPES[UA_TYPES_DELETENODESREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_DeleteNodesRequest_copy(const UA_DeleteNodesRequest *src, UA_DeleteNodesRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DELETENODESREQUEST]); -} - -static UA_INLINE void -UA_DeleteNodesRequest_deleteMembers(UA_DeleteNodesRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DELETENODESREQUEST]); -} - -static UA_INLINE void -UA_DeleteNodesRequest_delete(UA_DeleteNodesRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DELETENODESREQUEST]); -} - -/* DeleteNodesResponse */ -static UA_INLINE void -UA_DeleteNodesResponse_init(UA_DeleteNodesResponse *p) { - memset(p, 0, sizeof(UA_DeleteNodesResponse)); -} - -static UA_INLINE UA_DeleteNodesResponse * -UA_DeleteNodesResponse_new(void) { - return (UA_DeleteNodesResponse*)UA_new(&UA_TYPES[UA_TYPES_DELETENODESRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_DeleteNodesResponse_copy(const UA_DeleteNodesResponse *src, UA_DeleteNodesResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]); -} - -static UA_INLINE void -UA_DeleteNodesResponse_deleteMembers(UA_DeleteNodesResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]); -} - -static UA_INLINE void -UA_DeleteNodesResponse_delete(UA_DeleteNodesResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]); -} - -/* DeleteReferencesItem */ -static UA_INLINE void -UA_DeleteReferencesItem_init(UA_DeleteReferencesItem *p) { - memset(p, 0, sizeof(UA_DeleteReferencesItem)); -} - -static UA_INLINE UA_DeleteReferencesItem * -UA_DeleteReferencesItem_new(void) { - return (UA_DeleteReferencesItem*)UA_new(&UA_TYPES[UA_TYPES_DELETEREFERENCESITEM]); -} - -static UA_INLINE UA_StatusCode -UA_DeleteReferencesItem_copy(const UA_DeleteReferencesItem *src, UA_DeleteReferencesItem *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM]); -} - -static UA_INLINE void -UA_DeleteReferencesItem_deleteMembers(UA_DeleteReferencesItem *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM]); -} - -static UA_INLINE void -UA_DeleteReferencesItem_delete(UA_DeleteReferencesItem *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM]); -} - -/* DeleteReferencesRequest */ -static UA_INLINE void -UA_DeleteReferencesRequest_init(UA_DeleteReferencesRequest *p) { - memset(p, 0, sizeof(UA_DeleteReferencesRequest)); -} - -static UA_INLINE UA_DeleteReferencesRequest * -UA_DeleteReferencesRequest_new(void) { - return (UA_DeleteReferencesRequest*)UA_new(&UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_DeleteReferencesRequest_copy(const UA_DeleteReferencesRequest *src, UA_DeleteReferencesRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST]); -} - -static UA_INLINE void -UA_DeleteReferencesRequest_deleteMembers(UA_DeleteReferencesRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST]); -} - -static UA_INLINE void -UA_DeleteReferencesRequest_delete(UA_DeleteReferencesRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST]); -} - -/* DeleteReferencesResponse */ -static UA_INLINE void -UA_DeleteReferencesResponse_init(UA_DeleteReferencesResponse *p) { - memset(p, 0, sizeof(UA_DeleteReferencesResponse)); -} - -static UA_INLINE UA_DeleteReferencesResponse * -UA_DeleteReferencesResponse_new(void) { - return (UA_DeleteReferencesResponse*)UA_new(&UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_DeleteReferencesResponse_copy(const UA_DeleteReferencesResponse *src, UA_DeleteReferencesResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE]); -} - -static UA_INLINE void -UA_DeleteReferencesResponse_deleteMembers(UA_DeleteReferencesResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE]); -} - -static UA_INLINE void -UA_DeleteReferencesResponse_delete(UA_DeleteReferencesResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE]); -} - -/* BrowseDirection */ -static UA_INLINE void -UA_BrowseDirection_init(UA_BrowseDirection *p) { - memset(p, 0, sizeof(UA_BrowseDirection)); -} - -static UA_INLINE UA_BrowseDirection * -UA_BrowseDirection_new(void) { - return (UA_BrowseDirection*)UA_new(&UA_TYPES[UA_TYPES_BROWSEDIRECTION]); -} - -static UA_INLINE UA_StatusCode -UA_BrowseDirection_copy(const UA_BrowseDirection *src, UA_BrowseDirection *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_BrowseDirection_deleteMembers(UA_BrowseDirection *p) { } - -static UA_INLINE void -UA_BrowseDirection_delete(UA_BrowseDirection *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSEDIRECTION]); -} - -/* ViewDescription */ -static UA_INLINE void -UA_ViewDescription_init(UA_ViewDescription *p) { - memset(p, 0, sizeof(UA_ViewDescription)); -} - -static UA_INLINE UA_ViewDescription * -UA_ViewDescription_new(void) { - return (UA_ViewDescription*)UA_new(&UA_TYPES[UA_TYPES_VIEWDESCRIPTION]); -} - -static UA_INLINE UA_StatusCode -UA_ViewDescription_copy(const UA_ViewDescription *src, UA_ViewDescription *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION]); -} - -static UA_INLINE void -UA_ViewDescription_deleteMembers(UA_ViewDescription *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION]); -} - -static UA_INLINE void -UA_ViewDescription_delete(UA_ViewDescription *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION]); -} - -/* BrowseDescription */ -static UA_INLINE void -UA_BrowseDescription_init(UA_BrowseDescription *p) { - memset(p, 0, sizeof(UA_BrowseDescription)); -} - -static UA_INLINE UA_BrowseDescription * -UA_BrowseDescription_new(void) { - return (UA_BrowseDescription*)UA_new(&UA_TYPES[UA_TYPES_BROWSEDESCRIPTION]); -} - -static UA_INLINE UA_StatusCode -UA_BrowseDescription_copy(const UA_BrowseDescription *src, UA_BrowseDescription *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION]); -} - -static UA_INLINE void -UA_BrowseDescription_deleteMembers(UA_BrowseDescription *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION]); -} - -static UA_INLINE void -UA_BrowseDescription_delete(UA_BrowseDescription *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION]); -} - -/* BrowseResultMask */ -static UA_INLINE void -UA_BrowseResultMask_init(UA_BrowseResultMask *p) { - memset(p, 0, sizeof(UA_BrowseResultMask)); -} - -static UA_INLINE UA_BrowseResultMask * -UA_BrowseResultMask_new(void) { - return (UA_BrowseResultMask*)UA_new(&UA_TYPES[UA_TYPES_BROWSERESULTMASK]); -} - -static UA_INLINE UA_StatusCode -UA_BrowseResultMask_copy(const UA_BrowseResultMask *src, UA_BrowseResultMask *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_BrowseResultMask_deleteMembers(UA_BrowseResultMask *p) { } - -static UA_INLINE void -UA_BrowseResultMask_delete(UA_BrowseResultMask *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSERESULTMASK]); -} - -/* ReferenceDescription */ -static UA_INLINE void -UA_ReferenceDescription_init(UA_ReferenceDescription *p) { - memset(p, 0, sizeof(UA_ReferenceDescription)); -} - -static UA_INLINE UA_ReferenceDescription * -UA_ReferenceDescription_new(void) { - return (UA_ReferenceDescription*)UA_new(&UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]); -} - -static UA_INLINE UA_StatusCode -UA_ReferenceDescription_copy(const UA_ReferenceDescription *src, UA_ReferenceDescription *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]); -} - -static UA_INLINE void -UA_ReferenceDescription_deleteMembers(UA_ReferenceDescription *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]); -} - -static UA_INLINE void -UA_ReferenceDescription_delete(UA_ReferenceDescription *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]); -} - -/* BrowseResult */ -static UA_INLINE void -UA_BrowseResult_init(UA_BrowseResult *p) { - memset(p, 0, sizeof(UA_BrowseResult)); -} - -static UA_INLINE UA_BrowseResult * -UA_BrowseResult_new(void) { - return (UA_BrowseResult*)UA_new(&UA_TYPES[UA_TYPES_BROWSERESULT]); -} - -static UA_INLINE UA_StatusCode -UA_BrowseResult_copy(const UA_BrowseResult *src, UA_BrowseResult *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BROWSERESULT]); -} - -static UA_INLINE void -UA_BrowseResult_deleteMembers(UA_BrowseResult *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BROWSERESULT]); -} - -static UA_INLINE void -UA_BrowseResult_delete(UA_BrowseResult *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSERESULT]); -} - -/* BrowseRequest */ -static UA_INLINE void -UA_BrowseRequest_init(UA_BrowseRequest *p) { - memset(p, 0, sizeof(UA_BrowseRequest)); -} - -static UA_INLINE UA_BrowseRequest * -UA_BrowseRequest_new(void) { - return (UA_BrowseRequest*)UA_new(&UA_TYPES[UA_TYPES_BROWSEREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_BrowseRequest_copy(const UA_BrowseRequest *src, UA_BrowseRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BROWSEREQUEST]); -} - -static UA_INLINE void -UA_BrowseRequest_deleteMembers(UA_BrowseRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BROWSEREQUEST]); -} - -static UA_INLINE void -UA_BrowseRequest_delete(UA_BrowseRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSEREQUEST]); -} - -/* BrowseResponse */ -static UA_INLINE void -UA_BrowseResponse_init(UA_BrowseResponse *p) { - memset(p, 0, sizeof(UA_BrowseResponse)); -} - -static UA_INLINE UA_BrowseResponse * -UA_BrowseResponse_new(void) { - return (UA_BrowseResponse*)UA_new(&UA_TYPES[UA_TYPES_BROWSERESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_BrowseResponse_copy(const UA_BrowseResponse *src, UA_BrowseResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BROWSERESPONSE]); -} - -static UA_INLINE void -UA_BrowseResponse_deleteMembers(UA_BrowseResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BROWSERESPONSE]); -} - -static UA_INLINE void -UA_BrowseResponse_delete(UA_BrowseResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSERESPONSE]); -} - -/* BrowseNextRequest */ -static UA_INLINE void -UA_BrowseNextRequest_init(UA_BrowseNextRequest *p) { - memset(p, 0, sizeof(UA_BrowseNextRequest)); -} - -static UA_INLINE UA_BrowseNextRequest * -UA_BrowseNextRequest_new(void) { - return (UA_BrowseNextRequest*)UA_new(&UA_TYPES[UA_TYPES_BROWSENEXTREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_BrowseNextRequest_copy(const UA_BrowseNextRequest *src, UA_BrowseNextRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST]); -} - -static UA_INLINE void -UA_BrowseNextRequest_deleteMembers(UA_BrowseNextRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST]); -} - -static UA_INLINE void -UA_BrowseNextRequest_delete(UA_BrowseNextRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST]); -} - -/* BrowseNextResponse */ -static UA_INLINE void -UA_BrowseNextResponse_init(UA_BrowseNextResponse *p) { - memset(p, 0, sizeof(UA_BrowseNextResponse)); -} - -static UA_INLINE UA_BrowseNextResponse * -UA_BrowseNextResponse_new(void) { - return (UA_BrowseNextResponse*)UA_new(&UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_BrowseNextResponse_copy(const UA_BrowseNextResponse *src, UA_BrowseNextResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]); -} - -static UA_INLINE void -UA_BrowseNextResponse_deleteMembers(UA_BrowseNextResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]); -} - -static UA_INLINE void -UA_BrowseNextResponse_delete(UA_BrowseNextResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]); -} - -/* RelativePathElement */ -static UA_INLINE void -UA_RelativePathElement_init(UA_RelativePathElement *p) { - memset(p, 0, sizeof(UA_RelativePathElement)); -} - -static UA_INLINE UA_RelativePathElement * -UA_RelativePathElement_new(void) { - return (UA_RelativePathElement*)UA_new(&UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]); -} - -static UA_INLINE UA_StatusCode -UA_RelativePathElement_copy(const UA_RelativePathElement *src, UA_RelativePathElement *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]); -} - -static UA_INLINE void -UA_RelativePathElement_deleteMembers(UA_RelativePathElement *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]); -} - -static UA_INLINE void -UA_RelativePathElement_delete(UA_RelativePathElement *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]); -} - -/* RelativePath */ -static UA_INLINE void -UA_RelativePath_init(UA_RelativePath *p) { - memset(p, 0, sizeof(UA_RelativePath)); -} - -static UA_INLINE UA_RelativePath * -UA_RelativePath_new(void) { - return (UA_RelativePath*)UA_new(&UA_TYPES[UA_TYPES_RELATIVEPATH]); -} - -static UA_INLINE UA_StatusCode -UA_RelativePath_copy(const UA_RelativePath *src, UA_RelativePath *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_RELATIVEPATH]); -} - -static UA_INLINE void -UA_RelativePath_deleteMembers(UA_RelativePath *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_RELATIVEPATH]); -} - -static UA_INLINE void -UA_RelativePath_delete(UA_RelativePath *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_RELATIVEPATH]); -} - -/* BrowsePath */ -static UA_INLINE void -UA_BrowsePath_init(UA_BrowsePath *p) { - memset(p, 0, sizeof(UA_BrowsePath)); -} - -static UA_INLINE UA_BrowsePath * -UA_BrowsePath_new(void) { - return (UA_BrowsePath*)UA_new(&UA_TYPES[UA_TYPES_BROWSEPATH]); -} - -static UA_INLINE UA_StatusCode -UA_BrowsePath_copy(const UA_BrowsePath *src, UA_BrowsePath *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BROWSEPATH]); -} - -static UA_INLINE void -UA_BrowsePath_deleteMembers(UA_BrowsePath *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BROWSEPATH]); -} - -static UA_INLINE void -UA_BrowsePath_delete(UA_BrowsePath *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSEPATH]); -} - -/* BrowsePathTarget */ -static UA_INLINE void -UA_BrowsePathTarget_init(UA_BrowsePathTarget *p) { - memset(p, 0, sizeof(UA_BrowsePathTarget)); -} - -static UA_INLINE UA_BrowsePathTarget * -UA_BrowsePathTarget_new(void) { - return (UA_BrowsePathTarget*)UA_new(&UA_TYPES[UA_TYPES_BROWSEPATHTARGET]); -} - -static UA_INLINE UA_StatusCode -UA_BrowsePathTarget_copy(const UA_BrowsePathTarget *src, UA_BrowsePathTarget *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET]); -} - -static UA_INLINE void -UA_BrowsePathTarget_deleteMembers(UA_BrowsePathTarget *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET]); -} - -static UA_INLINE void -UA_BrowsePathTarget_delete(UA_BrowsePathTarget *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET]); -} - -/* BrowsePathResult */ -static UA_INLINE void -UA_BrowsePathResult_init(UA_BrowsePathResult *p) { - memset(p, 0, sizeof(UA_BrowsePathResult)); -} - -static UA_INLINE UA_BrowsePathResult * -UA_BrowsePathResult_new(void) { - return (UA_BrowsePathResult*)UA_new(&UA_TYPES[UA_TYPES_BROWSEPATHRESULT]); -} - -static UA_INLINE UA_StatusCode -UA_BrowsePathResult_copy(const UA_BrowsePathResult *src, UA_BrowsePathResult *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT]); -} - -static UA_INLINE void -UA_BrowsePathResult_deleteMembers(UA_BrowsePathResult *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT]); -} - -static UA_INLINE void -UA_BrowsePathResult_delete(UA_BrowsePathResult *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT]); -} - -/* TranslateBrowsePathsToNodeIdsRequest */ -static UA_INLINE void -UA_TranslateBrowsePathsToNodeIdsRequest_init(UA_TranslateBrowsePathsToNodeIdsRequest *p) { - memset(p, 0, sizeof(UA_TranslateBrowsePathsToNodeIdsRequest)); -} - -static UA_INLINE UA_TranslateBrowsePathsToNodeIdsRequest * -UA_TranslateBrowsePathsToNodeIdsRequest_new(void) { - return (UA_TranslateBrowsePathsToNodeIdsRequest*)UA_new(&UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_TranslateBrowsePathsToNodeIdsRequest_copy(const UA_TranslateBrowsePathsToNodeIdsRequest *src, UA_TranslateBrowsePathsToNodeIdsRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST]); -} - -static UA_INLINE void -UA_TranslateBrowsePathsToNodeIdsRequest_deleteMembers(UA_TranslateBrowsePathsToNodeIdsRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST]); -} - -static UA_INLINE void -UA_TranslateBrowsePathsToNodeIdsRequest_delete(UA_TranslateBrowsePathsToNodeIdsRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST]); -} - -/* TranslateBrowsePathsToNodeIdsResponse */ -static UA_INLINE void -UA_TranslateBrowsePathsToNodeIdsResponse_init(UA_TranslateBrowsePathsToNodeIdsResponse *p) { - memset(p, 0, sizeof(UA_TranslateBrowsePathsToNodeIdsResponse)); -} - -static UA_INLINE UA_TranslateBrowsePathsToNodeIdsResponse * -UA_TranslateBrowsePathsToNodeIdsResponse_new(void) { - return (UA_TranslateBrowsePathsToNodeIdsResponse*)UA_new(&UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_TranslateBrowsePathsToNodeIdsResponse_copy(const UA_TranslateBrowsePathsToNodeIdsResponse *src, UA_TranslateBrowsePathsToNodeIdsResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE]); -} - -static UA_INLINE void -UA_TranslateBrowsePathsToNodeIdsResponse_deleteMembers(UA_TranslateBrowsePathsToNodeIdsResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE]); -} - -static UA_INLINE void -UA_TranslateBrowsePathsToNodeIdsResponse_delete(UA_TranslateBrowsePathsToNodeIdsResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE]); -} - -/* RegisterNodesRequest */ -static UA_INLINE void -UA_RegisterNodesRequest_init(UA_RegisterNodesRequest *p) { - memset(p, 0, sizeof(UA_RegisterNodesRequest)); -} - -static UA_INLINE UA_RegisterNodesRequest * -UA_RegisterNodesRequest_new(void) { - return (UA_RegisterNodesRequest*)UA_new(&UA_TYPES[UA_TYPES_REGISTERNODESREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_RegisterNodesRequest_copy(const UA_RegisterNodesRequest *src, UA_RegisterNodesRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST]); -} - -static UA_INLINE void -UA_RegisterNodesRequest_deleteMembers(UA_RegisterNodesRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST]); -} - -static UA_INLINE void -UA_RegisterNodesRequest_delete(UA_RegisterNodesRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST]); -} - -/* RegisterNodesResponse */ -static UA_INLINE void -UA_RegisterNodesResponse_init(UA_RegisterNodesResponse *p) { - memset(p, 0, sizeof(UA_RegisterNodesResponse)); -} - -static UA_INLINE UA_RegisterNodesResponse * -UA_RegisterNodesResponse_new(void) { - return (UA_RegisterNodesResponse*)UA_new(&UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_RegisterNodesResponse_copy(const UA_RegisterNodesResponse *src, UA_RegisterNodesResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]); -} - -static UA_INLINE void -UA_RegisterNodesResponse_deleteMembers(UA_RegisterNodesResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]); -} - -static UA_INLINE void -UA_RegisterNodesResponse_delete(UA_RegisterNodesResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]); -} - -/* UnregisterNodesRequest */ -static UA_INLINE void -UA_UnregisterNodesRequest_init(UA_UnregisterNodesRequest *p) { - memset(p, 0, sizeof(UA_UnregisterNodesRequest)); -} - -static UA_INLINE UA_UnregisterNodesRequest * -UA_UnregisterNodesRequest_new(void) { - return (UA_UnregisterNodesRequest*)UA_new(&UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_UnregisterNodesRequest_copy(const UA_UnregisterNodesRequest *src, UA_UnregisterNodesRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST]); -} - -static UA_INLINE void -UA_UnregisterNodesRequest_deleteMembers(UA_UnregisterNodesRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST]); -} - -static UA_INLINE void -UA_UnregisterNodesRequest_delete(UA_UnregisterNodesRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST]); -} - -/* UnregisterNodesResponse */ -static UA_INLINE void -UA_UnregisterNodesResponse_init(UA_UnregisterNodesResponse *p) { - memset(p, 0, sizeof(UA_UnregisterNodesResponse)); -} - -static UA_INLINE UA_UnregisterNodesResponse * -UA_UnregisterNodesResponse_new(void) { - return (UA_UnregisterNodesResponse*)UA_new(&UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_UnregisterNodesResponse_copy(const UA_UnregisterNodesResponse *src, UA_UnregisterNodesResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]); -} - -static UA_INLINE void -UA_UnregisterNodesResponse_deleteMembers(UA_UnregisterNodesResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]); -} - -static UA_INLINE void -UA_UnregisterNodesResponse_delete(UA_UnregisterNodesResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]); -} - -/* QueryDataDescription */ -static UA_INLINE void -UA_QueryDataDescription_init(UA_QueryDataDescription *p) { - memset(p, 0, sizeof(UA_QueryDataDescription)); -} - -static UA_INLINE UA_QueryDataDescription * -UA_QueryDataDescription_new(void) { - return (UA_QueryDataDescription*)UA_new(&UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION]); -} - -static UA_INLINE UA_StatusCode -UA_QueryDataDescription_copy(const UA_QueryDataDescription *src, UA_QueryDataDescription *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION]); -} - -static UA_INLINE void -UA_QueryDataDescription_deleteMembers(UA_QueryDataDescription *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION]); -} - -static UA_INLINE void -UA_QueryDataDescription_delete(UA_QueryDataDescription *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION]); -} - -/* NodeTypeDescription */ -static UA_INLINE void -UA_NodeTypeDescription_init(UA_NodeTypeDescription *p) { - memset(p, 0, sizeof(UA_NodeTypeDescription)); -} - -static UA_INLINE UA_NodeTypeDescription * -UA_NodeTypeDescription_new(void) { - return (UA_NodeTypeDescription*)UA_new(&UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION]); -} - -static UA_INLINE UA_StatusCode -UA_NodeTypeDescription_copy(const UA_NodeTypeDescription *src, UA_NodeTypeDescription *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION]); -} - -static UA_INLINE void -UA_NodeTypeDescription_deleteMembers(UA_NodeTypeDescription *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION]); -} - -static UA_INLINE void -UA_NodeTypeDescription_delete(UA_NodeTypeDescription *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION]); -} - -/* FilterOperator */ -static UA_INLINE void -UA_FilterOperator_init(UA_FilterOperator *p) { - memset(p, 0, sizeof(UA_FilterOperator)); -} - -static UA_INLINE UA_FilterOperator * -UA_FilterOperator_new(void) { - return (UA_FilterOperator*)UA_new(&UA_TYPES[UA_TYPES_FILTEROPERATOR]); -} - -static UA_INLINE UA_StatusCode -UA_FilterOperator_copy(const UA_FilterOperator *src, UA_FilterOperator *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_FilterOperator_deleteMembers(UA_FilterOperator *p) { } - -static UA_INLINE void -UA_FilterOperator_delete(UA_FilterOperator *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_FILTEROPERATOR]); -} - -/* QueryDataSet */ -static UA_INLINE void -UA_QueryDataSet_init(UA_QueryDataSet *p) { - memset(p, 0, sizeof(UA_QueryDataSet)); -} - -static UA_INLINE UA_QueryDataSet * -UA_QueryDataSet_new(void) { - return (UA_QueryDataSet*)UA_new(&UA_TYPES[UA_TYPES_QUERYDATASET]); -} - -static UA_INLINE UA_StatusCode -UA_QueryDataSet_copy(const UA_QueryDataSet *src, UA_QueryDataSet *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_QUERYDATASET]); -} - -static UA_INLINE void -UA_QueryDataSet_deleteMembers(UA_QueryDataSet *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_QUERYDATASET]); -} - -static UA_INLINE void -UA_QueryDataSet_delete(UA_QueryDataSet *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_QUERYDATASET]); -} - -/* ContentFilterElement */ -static UA_INLINE void -UA_ContentFilterElement_init(UA_ContentFilterElement *p) { - memset(p, 0, sizeof(UA_ContentFilterElement)); -} - -static UA_INLINE UA_ContentFilterElement * -UA_ContentFilterElement_new(void) { - return (UA_ContentFilterElement*)UA_new(&UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT]); -} - -static UA_INLINE UA_StatusCode -UA_ContentFilterElement_copy(const UA_ContentFilterElement *src, UA_ContentFilterElement *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT]); -} - -static UA_INLINE void -UA_ContentFilterElement_deleteMembers(UA_ContentFilterElement *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT]); -} - -static UA_INLINE void -UA_ContentFilterElement_delete(UA_ContentFilterElement *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT]); -} - -/* ContentFilter */ -static UA_INLINE void -UA_ContentFilter_init(UA_ContentFilter *p) { - memset(p, 0, sizeof(UA_ContentFilter)); -} - -static UA_INLINE UA_ContentFilter * -UA_ContentFilter_new(void) { - return (UA_ContentFilter*)UA_new(&UA_TYPES[UA_TYPES_CONTENTFILTER]); -} - -static UA_INLINE UA_StatusCode -UA_ContentFilter_copy(const UA_ContentFilter *src, UA_ContentFilter *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CONTENTFILTER]); -} - -static UA_INLINE void -UA_ContentFilter_deleteMembers(UA_ContentFilter *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CONTENTFILTER]); -} - -static UA_INLINE void -UA_ContentFilter_delete(UA_ContentFilter *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CONTENTFILTER]); -} - -/* FilterOperand */ -static UA_INLINE void -UA_FilterOperand_init(UA_FilterOperand *p) { - memset(p, 0, sizeof(UA_FilterOperand)); -} - -static UA_INLINE UA_FilterOperand * -UA_FilterOperand_new(void) { - return (UA_FilterOperand*)UA_new(&UA_TYPES[UA_TYPES_FILTEROPERAND]); -} - -static UA_INLINE UA_StatusCode -UA_FilterOperand_copy(const UA_FilterOperand *src, UA_FilterOperand *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_FilterOperand_deleteMembers(UA_FilterOperand *p) { } - -static UA_INLINE void -UA_FilterOperand_delete(UA_FilterOperand *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_FILTEROPERAND]); -} - -/* SimpleAttributeOperand */ -static UA_INLINE void -UA_SimpleAttributeOperand_init(UA_SimpleAttributeOperand *p) { - memset(p, 0, sizeof(UA_SimpleAttributeOperand)); -} - -static UA_INLINE UA_SimpleAttributeOperand * -UA_SimpleAttributeOperand_new(void) { - return (UA_SimpleAttributeOperand*)UA_new(&UA_TYPES[UA_TYPES_SIMPLEATTRIBUTEOPERAND]); -} - -static UA_INLINE UA_StatusCode -UA_SimpleAttributeOperand_copy(const UA_SimpleAttributeOperand *src, UA_SimpleAttributeOperand *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SIMPLEATTRIBUTEOPERAND]); -} - -static UA_INLINE void -UA_SimpleAttributeOperand_deleteMembers(UA_SimpleAttributeOperand *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SIMPLEATTRIBUTEOPERAND]); -} - -static UA_INLINE void -UA_SimpleAttributeOperand_delete(UA_SimpleAttributeOperand *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SIMPLEATTRIBUTEOPERAND]); -} - -/* ContentFilterElementResult */ -static UA_INLINE void -UA_ContentFilterElementResult_init(UA_ContentFilterElementResult *p) { - memset(p, 0, sizeof(UA_ContentFilterElementResult)); -} - -static UA_INLINE UA_ContentFilterElementResult * -UA_ContentFilterElementResult_new(void) { - return (UA_ContentFilterElementResult*)UA_new(&UA_TYPES[UA_TYPES_CONTENTFILTERELEMENTRESULT]); -} - -static UA_INLINE UA_StatusCode -UA_ContentFilterElementResult_copy(const UA_ContentFilterElementResult *src, UA_ContentFilterElementResult *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENTRESULT]); -} - -static UA_INLINE void -UA_ContentFilterElementResult_deleteMembers(UA_ContentFilterElementResult *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENTRESULT]); -} - -static UA_INLINE void -UA_ContentFilterElementResult_delete(UA_ContentFilterElementResult *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENTRESULT]); -} - -/* ContentFilterResult */ -static UA_INLINE void -UA_ContentFilterResult_init(UA_ContentFilterResult *p) { - memset(p, 0, sizeof(UA_ContentFilterResult)); -} - -static UA_INLINE UA_ContentFilterResult * -UA_ContentFilterResult_new(void) { - return (UA_ContentFilterResult*)UA_new(&UA_TYPES[UA_TYPES_CONTENTFILTERRESULT]); -} - -static UA_INLINE UA_StatusCode -UA_ContentFilterResult_copy(const UA_ContentFilterResult *src, UA_ContentFilterResult *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT]); -} - -static UA_INLINE void -UA_ContentFilterResult_deleteMembers(UA_ContentFilterResult *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT]); -} - -static UA_INLINE void -UA_ContentFilterResult_delete(UA_ContentFilterResult *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT]); -} - -/* ParsingResult */ -static UA_INLINE void -UA_ParsingResult_init(UA_ParsingResult *p) { - memset(p, 0, sizeof(UA_ParsingResult)); -} - -static UA_INLINE UA_ParsingResult * -UA_ParsingResult_new(void) { - return (UA_ParsingResult*)UA_new(&UA_TYPES[UA_TYPES_PARSINGRESULT]); -} - -static UA_INLINE UA_StatusCode -UA_ParsingResult_copy(const UA_ParsingResult *src, UA_ParsingResult *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_PARSINGRESULT]); -} - -static UA_INLINE void -UA_ParsingResult_deleteMembers(UA_ParsingResult *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_PARSINGRESULT]); -} - -static UA_INLINE void -UA_ParsingResult_delete(UA_ParsingResult *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_PARSINGRESULT]); -} - -/* QueryFirstRequest */ -static UA_INLINE void -UA_QueryFirstRequest_init(UA_QueryFirstRequest *p) { - memset(p, 0, sizeof(UA_QueryFirstRequest)); -} - -static UA_INLINE UA_QueryFirstRequest * -UA_QueryFirstRequest_new(void) { - return (UA_QueryFirstRequest*)UA_new(&UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_QueryFirstRequest_copy(const UA_QueryFirstRequest *src, UA_QueryFirstRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST]); -} - -static UA_INLINE void -UA_QueryFirstRequest_deleteMembers(UA_QueryFirstRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST]); -} - -static UA_INLINE void -UA_QueryFirstRequest_delete(UA_QueryFirstRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST]); -} - -/* QueryFirstResponse */ -static UA_INLINE void -UA_QueryFirstResponse_init(UA_QueryFirstResponse *p) { - memset(p, 0, sizeof(UA_QueryFirstResponse)); -} - -static UA_INLINE UA_QueryFirstResponse * -UA_QueryFirstResponse_new(void) { - return (UA_QueryFirstResponse*)UA_new(&UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_QueryFirstResponse_copy(const UA_QueryFirstResponse *src, UA_QueryFirstResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]); -} - -static UA_INLINE void -UA_QueryFirstResponse_deleteMembers(UA_QueryFirstResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]); -} - -static UA_INLINE void -UA_QueryFirstResponse_delete(UA_QueryFirstResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]); -} - -/* QueryNextRequest */ -static UA_INLINE void -UA_QueryNextRequest_init(UA_QueryNextRequest *p) { - memset(p, 0, sizeof(UA_QueryNextRequest)); -} - -static UA_INLINE UA_QueryNextRequest * -UA_QueryNextRequest_new(void) { - return (UA_QueryNextRequest*)UA_new(&UA_TYPES[UA_TYPES_QUERYNEXTREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_QueryNextRequest_copy(const UA_QueryNextRequest *src, UA_QueryNextRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST]); -} - -static UA_INLINE void -UA_QueryNextRequest_deleteMembers(UA_QueryNextRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST]); -} - -static UA_INLINE void -UA_QueryNextRequest_delete(UA_QueryNextRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST]); -} - -/* QueryNextResponse */ -static UA_INLINE void -UA_QueryNextResponse_init(UA_QueryNextResponse *p) { - memset(p, 0, sizeof(UA_QueryNextResponse)); -} - -static UA_INLINE UA_QueryNextResponse * -UA_QueryNextResponse_new(void) { - return (UA_QueryNextResponse*)UA_new(&UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_QueryNextResponse_copy(const UA_QueryNextResponse *src, UA_QueryNextResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE]); -} - -static UA_INLINE void -UA_QueryNextResponse_deleteMembers(UA_QueryNextResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE]); -} - -static UA_INLINE void -UA_QueryNextResponse_delete(UA_QueryNextResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE]); -} - -/* TimestampsToReturn */ -static UA_INLINE void -UA_TimestampsToReturn_init(UA_TimestampsToReturn *p) { - memset(p, 0, sizeof(UA_TimestampsToReturn)); -} - -static UA_INLINE UA_TimestampsToReturn * -UA_TimestampsToReturn_new(void) { - return (UA_TimestampsToReturn*)UA_new(&UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN]); -} - -static UA_INLINE UA_StatusCode -UA_TimestampsToReturn_copy(const UA_TimestampsToReturn *src, UA_TimestampsToReturn *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_TimestampsToReturn_deleteMembers(UA_TimestampsToReturn *p) { } - -static UA_INLINE void -UA_TimestampsToReturn_delete(UA_TimestampsToReturn *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN]); -} - -/* ReadValueId */ -static UA_INLINE void -UA_ReadValueId_init(UA_ReadValueId *p) { - memset(p, 0, sizeof(UA_ReadValueId)); -} - -static UA_INLINE UA_ReadValueId * -UA_ReadValueId_new(void) { - return (UA_ReadValueId*)UA_new(&UA_TYPES[UA_TYPES_READVALUEID]); -} - -static UA_INLINE UA_StatusCode -UA_ReadValueId_copy(const UA_ReadValueId *src, UA_ReadValueId *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_READVALUEID]); -} - -static UA_INLINE void -UA_ReadValueId_deleteMembers(UA_ReadValueId *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_READVALUEID]); -} - -static UA_INLINE void -UA_ReadValueId_delete(UA_ReadValueId *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_READVALUEID]); -} - -/* ReadRequest */ -static UA_INLINE void -UA_ReadRequest_init(UA_ReadRequest *p) { - memset(p, 0, sizeof(UA_ReadRequest)); -} - -static UA_INLINE UA_ReadRequest * -UA_ReadRequest_new(void) { - return (UA_ReadRequest*)UA_new(&UA_TYPES[UA_TYPES_READREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_ReadRequest_copy(const UA_ReadRequest *src, UA_ReadRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_READREQUEST]); -} - -static UA_INLINE void -UA_ReadRequest_deleteMembers(UA_ReadRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_READREQUEST]); -} - -static UA_INLINE void -UA_ReadRequest_delete(UA_ReadRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_READREQUEST]); -} - -/* ReadResponse */ -static UA_INLINE void -UA_ReadResponse_init(UA_ReadResponse *p) { - memset(p, 0, sizeof(UA_ReadResponse)); -} - -static UA_INLINE UA_ReadResponse * -UA_ReadResponse_new(void) { - return (UA_ReadResponse*)UA_new(&UA_TYPES[UA_TYPES_READRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_ReadResponse_copy(const UA_ReadResponse *src, UA_ReadResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_READRESPONSE]); -} - -static UA_INLINE void -UA_ReadResponse_deleteMembers(UA_ReadResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_READRESPONSE]); -} - -static UA_INLINE void -UA_ReadResponse_delete(UA_ReadResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_READRESPONSE]); -} - -/* WriteValue */ -static UA_INLINE void -UA_WriteValue_init(UA_WriteValue *p) { - memset(p, 0, sizeof(UA_WriteValue)); -} - -static UA_INLINE UA_WriteValue * -UA_WriteValue_new(void) { - return (UA_WriteValue*)UA_new(&UA_TYPES[UA_TYPES_WRITEVALUE]); -} - -static UA_INLINE UA_StatusCode -UA_WriteValue_copy(const UA_WriteValue *src, UA_WriteValue *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_WRITEVALUE]); -} - -static UA_INLINE void -UA_WriteValue_deleteMembers(UA_WriteValue *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_WRITEVALUE]); -} - -static UA_INLINE void -UA_WriteValue_delete(UA_WriteValue *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_WRITEVALUE]); -} - -/* WriteRequest */ -static UA_INLINE void -UA_WriteRequest_init(UA_WriteRequest *p) { - memset(p, 0, sizeof(UA_WriteRequest)); -} - -static UA_INLINE UA_WriteRequest * -UA_WriteRequest_new(void) { - return (UA_WriteRequest*)UA_new(&UA_TYPES[UA_TYPES_WRITEREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_WriteRequest_copy(const UA_WriteRequest *src, UA_WriteRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_WRITEREQUEST]); -} - -static UA_INLINE void -UA_WriteRequest_deleteMembers(UA_WriteRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_WRITEREQUEST]); -} - -static UA_INLINE void -UA_WriteRequest_delete(UA_WriteRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_WRITEREQUEST]); -} - -/* WriteResponse */ -static UA_INLINE void -UA_WriteResponse_init(UA_WriteResponse *p) { - memset(p, 0, sizeof(UA_WriteResponse)); -} - -static UA_INLINE UA_WriteResponse * -UA_WriteResponse_new(void) { - return (UA_WriteResponse*)UA_new(&UA_TYPES[UA_TYPES_WRITERESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_WriteResponse_copy(const UA_WriteResponse *src, UA_WriteResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_WRITERESPONSE]); -} - -static UA_INLINE void -UA_WriteResponse_deleteMembers(UA_WriteResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_WRITERESPONSE]); -} - -static UA_INLINE void -UA_WriteResponse_delete(UA_WriteResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_WRITERESPONSE]); -} - -/* CallMethodRequest */ -static UA_INLINE void -UA_CallMethodRequest_init(UA_CallMethodRequest *p) { - memset(p, 0, sizeof(UA_CallMethodRequest)); -} - -static UA_INLINE UA_CallMethodRequest * -UA_CallMethodRequest_new(void) { - return (UA_CallMethodRequest*)UA_new(&UA_TYPES[UA_TYPES_CALLMETHODREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_CallMethodRequest_copy(const UA_CallMethodRequest *src, UA_CallMethodRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST]); -} - -static UA_INLINE void -UA_CallMethodRequest_deleteMembers(UA_CallMethodRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST]); -} - -static UA_INLINE void -UA_CallMethodRequest_delete(UA_CallMethodRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST]); -} - -/* CallMethodResult */ -static UA_INLINE void -UA_CallMethodResult_init(UA_CallMethodResult *p) { - memset(p, 0, sizeof(UA_CallMethodResult)); -} - -static UA_INLINE UA_CallMethodResult * -UA_CallMethodResult_new(void) { - return (UA_CallMethodResult*)UA_new(&UA_TYPES[UA_TYPES_CALLMETHODRESULT]); -} - -static UA_INLINE UA_StatusCode -UA_CallMethodResult_copy(const UA_CallMethodResult *src, UA_CallMethodResult *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CALLMETHODRESULT]); -} - -static UA_INLINE void -UA_CallMethodResult_deleteMembers(UA_CallMethodResult *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CALLMETHODRESULT]); -} - -static UA_INLINE void -UA_CallMethodResult_delete(UA_CallMethodResult *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CALLMETHODRESULT]); -} - -/* CallRequest */ -static UA_INLINE void -UA_CallRequest_init(UA_CallRequest *p) { - memset(p, 0, sizeof(UA_CallRequest)); -} - -static UA_INLINE UA_CallRequest * -UA_CallRequest_new(void) { - return (UA_CallRequest*)UA_new(&UA_TYPES[UA_TYPES_CALLREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_CallRequest_copy(const UA_CallRequest *src, UA_CallRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CALLREQUEST]); -} - -static UA_INLINE void -UA_CallRequest_deleteMembers(UA_CallRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CALLREQUEST]); -} - -static UA_INLINE void -UA_CallRequest_delete(UA_CallRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CALLREQUEST]); -} - -/* CallResponse */ -static UA_INLINE void -UA_CallResponse_init(UA_CallResponse *p) { - memset(p, 0, sizeof(UA_CallResponse)); -} - -static UA_INLINE UA_CallResponse * -UA_CallResponse_new(void) { - return (UA_CallResponse*)UA_new(&UA_TYPES[UA_TYPES_CALLRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_CallResponse_copy(const UA_CallResponse *src, UA_CallResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CALLRESPONSE]); -} - -static UA_INLINE void -UA_CallResponse_deleteMembers(UA_CallResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CALLRESPONSE]); -} - -static UA_INLINE void -UA_CallResponse_delete(UA_CallResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CALLRESPONSE]); -} - -/* MonitoringMode */ -static UA_INLINE void -UA_MonitoringMode_init(UA_MonitoringMode *p) { - memset(p, 0, sizeof(UA_MonitoringMode)); -} - -static UA_INLINE UA_MonitoringMode * -UA_MonitoringMode_new(void) { - return (UA_MonitoringMode*)UA_new(&UA_TYPES[UA_TYPES_MONITORINGMODE]); -} - -static UA_INLINE UA_StatusCode -UA_MonitoringMode_copy(const UA_MonitoringMode *src, UA_MonitoringMode *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_MonitoringMode_deleteMembers(UA_MonitoringMode *p) { } - -static UA_INLINE void -UA_MonitoringMode_delete(UA_MonitoringMode *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MONITORINGMODE]); -} - -/* DataChangeTrigger */ -static UA_INLINE void -UA_DataChangeTrigger_init(UA_DataChangeTrigger *p) { - memset(p, 0, sizeof(UA_DataChangeTrigger)); -} - -static UA_INLINE UA_DataChangeTrigger * -UA_DataChangeTrigger_new(void) { - return (UA_DataChangeTrigger*)UA_new(&UA_TYPES[UA_TYPES_DATACHANGETRIGGER]); -} - -static UA_INLINE UA_StatusCode -UA_DataChangeTrigger_copy(const UA_DataChangeTrigger *src, UA_DataChangeTrigger *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_DataChangeTrigger_deleteMembers(UA_DataChangeTrigger *p) { } - -static UA_INLINE void -UA_DataChangeTrigger_delete(UA_DataChangeTrigger *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER]); -} - -/* DeadbandType */ -static UA_INLINE void -UA_DeadbandType_init(UA_DeadbandType *p) { - memset(p, 0, sizeof(UA_DeadbandType)); -} - -static UA_INLINE UA_DeadbandType * -UA_DeadbandType_new(void) { - return (UA_DeadbandType*)UA_new(&UA_TYPES[UA_TYPES_DEADBANDTYPE]); -} - -static UA_INLINE UA_StatusCode -UA_DeadbandType_copy(const UA_DeadbandType *src, UA_DeadbandType *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_DeadbandType_deleteMembers(UA_DeadbandType *p) { } - -static UA_INLINE void -UA_DeadbandType_delete(UA_DeadbandType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DEADBANDTYPE]); -} - -/* MonitoringFilter */ -static UA_INLINE void -UA_MonitoringFilter_init(UA_MonitoringFilter *p) { - memset(p, 0, sizeof(UA_MonitoringFilter)); -} - -static UA_INLINE UA_MonitoringFilter * -UA_MonitoringFilter_new(void) { - return (UA_MonitoringFilter*)UA_new(&UA_TYPES[UA_TYPES_MONITORINGFILTER]); -} - -static UA_INLINE UA_StatusCode -UA_MonitoringFilter_copy(const UA_MonitoringFilter *src, UA_MonitoringFilter *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_MonitoringFilter_deleteMembers(UA_MonitoringFilter *p) { } - -static UA_INLINE void -UA_MonitoringFilter_delete(UA_MonitoringFilter *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MONITORINGFILTER]); -} - -/* DataChangeFilter */ -static UA_INLINE void -UA_DataChangeFilter_init(UA_DataChangeFilter *p) { - memset(p, 0, sizeof(UA_DataChangeFilter)); -} - -static UA_INLINE UA_DataChangeFilter * -UA_DataChangeFilter_new(void) { - return (UA_DataChangeFilter*)UA_new(&UA_TYPES[UA_TYPES_DATACHANGEFILTER]); -} - -static UA_INLINE UA_StatusCode -UA_DataChangeFilter_copy(const UA_DataChangeFilter *src, UA_DataChangeFilter *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_DataChangeFilter_deleteMembers(UA_DataChangeFilter *p) { } - -static UA_INLINE void -UA_DataChangeFilter_delete(UA_DataChangeFilter *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DATACHANGEFILTER]); -} - -/* EventFilter */ -static UA_INLINE void -UA_EventFilter_init(UA_EventFilter *p) { - memset(p, 0, sizeof(UA_EventFilter)); -} - -static UA_INLINE UA_EventFilter * -UA_EventFilter_new(void) { - return (UA_EventFilter*)UA_new(&UA_TYPES[UA_TYPES_EVENTFILTER]); -} - -static UA_INLINE UA_StatusCode -UA_EventFilter_copy(const UA_EventFilter *src, UA_EventFilter *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_EVENTFILTER]); -} - -static UA_INLINE void -UA_EventFilter_deleteMembers(UA_EventFilter *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_EVENTFILTER]); -} - -static UA_INLINE void -UA_EventFilter_delete(UA_EventFilter *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_EVENTFILTER]); -} - -/* MonitoringParameters */ -static UA_INLINE void -UA_MonitoringParameters_init(UA_MonitoringParameters *p) { - memset(p, 0, sizeof(UA_MonitoringParameters)); -} - -static UA_INLINE UA_MonitoringParameters * -UA_MonitoringParameters_new(void) { - return (UA_MonitoringParameters*)UA_new(&UA_TYPES[UA_TYPES_MONITORINGPARAMETERS]); -} - -static UA_INLINE UA_StatusCode -UA_MonitoringParameters_copy(const UA_MonitoringParameters *src, UA_MonitoringParameters *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS]); -} - -static UA_INLINE void -UA_MonitoringParameters_deleteMembers(UA_MonitoringParameters *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS]); -} - -static UA_INLINE void -UA_MonitoringParameters_delete(UA_MonitoringParameters *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS]); -} - -/* MonitoredItemCreateRequest */ -static UA_INLINE void -UA_MonitoredItemCreateRequest_init(UA_MonitoredItemCreateRequest *p) { - memset(p, 0, sizeof(UA_MonitoredItemCreateRequest)); -} - -static UA_INLINE UA_MonitoredItemCreateRequest * -UA_MonitoredItemCreateRequest_new(void) { - return (UA_MonitoredItemCreateRequest*)UA_new(&UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_MonitoredItemCreateRequest_copy(const UA_MonitoredItemCreateRequest *src, UA_MonitoredItemCreateRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST]); -} - -static UA_INLINE void -UA_MonitoredItemCreateRequest_deleteMembers(UA_MonitoredItemCreateRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST]); -} - -static UA_INLINE void -UA_MonitoredItemCreateRequest_delete(UA_MonitoredItemCreateRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST]); -} - -/* MonitoredItemCreateResult */ -static UA_INLINE void -UA_MonitoredItemCreateResult_init(UA_MonitoredItemCreateResult *p) { - memset(p, 0, sizeof(UA_MonitoredItemCreateResult)); -} - -static UA_INLINE UA_MonitoredItemCreateResult * -UA_MonitoredItemCreateResult_new(void) { - return (UA_MonitoredItemCreateResult*)UA_new(&UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT]); -} - -static UA_INLINE UA_StatusCode -UA_MonitoredItemCreateResult_copy(const UA_MonitoredItemCreateResult *src, UA_MonitoredItemCreateResult *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT]); -} - -static UA_INLINE void -UA_MonitoredItemCreateResult_deleteMembers(UA_MonitoredItemCreateResult *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT]); -} - -static UA_INLINE void -UA_MonitoredItemCreateResult_delete(UA_MonitoredItemCreateResult *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT]); -} - -/* CreateMonitoredItemsRequest */ -static UA_INLINE void -UA_CreateMonitoredItemsRequest_init(UA_CreateMonitoredItemsRequest *p) { - memset(p, 0, sizeof(UA_CreateMonitoredItemsRequest)); -} - -static UA_INLINE UA_CreateMonitoredItemsRequest * -UA_CreateMonitoredItemsRequest_new(void) { - return (UA_CreateMonitoredItemsRequest*)UA_new(&UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_CreateMonitoredItemsRequest_copy(const UA_CreateMonitoredItemsRequest *src, UA_CreateMonitoredItemsRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST]); -} - -static UA_INLINE void -UA_CreateMonitoredItemsRequest_deleteMembers(UA_CreateMonitoredItemsRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST]); -} - -static UA_INLINE void -UA_CreateMonitoredItemsRequest_delete(UA_CreateMonitoredItemsRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST]); -} - -/* CreateMonitoredItemsResponse */ -static UA_INLINE void -UA_CreateMonitoredItemsResponse_init(UA_CreateMonitoredItemsResponse *p) { - memset(p, 0, sizeof(UA_CreateMonitoredItemsResponse)); -} - -static UA_INLINE UA_CreateMonitoredItemsResponse * -UA_CreateMonitoredItemsResponse_new(void) { - return (UA_CreateMonitoredItemsResponse*)UA_new(&UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_CreateMonitoredItemsResponse_copy(const UA_CreateMonitoredItemsResponse *src, UA_CreateMonitoredItemsResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE]); -} - -static UA_INLINE void -UA_CreateMonitoredItemsResponse_deleteMembers(UA_CreateMonitoredItemsResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE]); -} - -static UA_INLINE void -UA_CreateMonitoredItemsResponse_delete(UA_CreateMonitoredItemsResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE]); -} - -/* MonitoredItemModifyRequest */ -static UA_INLINE void -UA_MonitoredItemModifyRequest_init(UA_MonitoredItemModifyRequest *p) { - memset(p, 0, sizeof(UA_MonitoredItemModifyRequest)); -} - -static UA_INLINE UA_MonitoredItemModifyRequest * -UA_MonitoredItemModifyRequest_new(void) { - return (UA_MonitoredItemModifyRequest*)UA_new(&UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_MonitoredItemModifyRequest_copy(const UA_MonitoredItemModifyRequest *src, UA_MonitoredItemModifyRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST]); -} - -static UA_INLINE void -UA_MonitoredItemModifyRequest_deleteMembers(UA_MonitoredItemModifyRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST]); -} - -static UA_INLINE void -UA_MonitoredItemModifyRequest_delete(UA_MonitoredItemModifyRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST]); -} - -/* MonitoredItemModifyResult */ -static UA_INLINE void -UA_MonitoredItemModifyResult_init(UA_MonitoredItemModifyResult *p) { - memset(p, 0, sizeof(UA_MonitoredItemModifyResult)); -} - -static UA_INLINE UA_MonitoredItemModifyResult * -UA_MonitoredItemModifyResult_new(void) { - return (UA_MonitoredItemModifyResult*)UA_new(&UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT]); -} - -static UA_INLINE UA_StatusCode -UA_MonitoredItemModifyResult_copy(const UA_MonitoredItemModifyResult *src, UA_MonitoredItemModifyResult *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT]); -} - -static UA_INLINE void -UA_MonitoredItemModifyResult_deleteMembers(UA_MonitoredItemModifyResult *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT]); -} - -static UA_INLINE void -UA_MonitoredItemModifyResult_delete(UA_MonitoredItemModifyResult *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT]); -} - -/* ModifyMonitoredItemsRequest */ -static UA_INLINE void -UA_ModifyMonitoredItemsRequest_init(UA_ModifyMonitoredItemsRequest *p) { - memset(p, 0, sizeof(UA_ModifyMonitoredItemsRequest)); -} - -static UA_INLINE UA_ModifyMonitoredItemsRequest * -UA_ModifyMonitoredItemsRequest_new(void) { - return (UA_ModifyMonitoredItemsRequest*)UA_new(&UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_ModifyMonitoredItemsRequest_copy(const UA_ModifyMonitoredItemsRequest *src, UA_ModifyMonitoredItemsRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST]); -} - -static UA_INLINE void -UA_ModifyMonitoredItemsRequest_deleteMembers(UA_ModifyMonitoredItemsRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST]); -} - -static UA_INLINE void -UA_ModifyMonitoredItemsRequest_delete(UA_ModifyMonitoredItemsRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST]); -} - -/* ModifyMonitoredItemsResponse */ -static UA_INLINE void -UA_ModifyMonitoredItemsResponse_init(UA_ModifyMonitoredItemsResponse *p) { - memset(p, 0, sizeof(UA_ModifyMonitoredItemsResponse)); -} - -static UA_INLINE UA_ModifyMonitoredItemsResponse * -UA_ModifyMonitoredItemsResponse_new(void) { - return (UA_ModifyMonitoredItemsResponse*)UA_new(&UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_ModifyMonitoredItemsResponse_copy(const UA_ModifyMonitoredItemsResponse *src, UA_ModifyMonitoredItemsResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE]); -} - -static UA_INLINE void -UA_ModifyMonitoredItemsResponse_deleteMembers(UA_ModifyMonitoredItemsResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE]); -} - -static UA_INLINE void -UA_ModifyMonitoredItemsResponse_delete(UA_ModifyMonitoredItemsResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE]); -} - -/* SetMonitoringModeRequest */ -static UA_INLINE void -UA_SetMonitoringModeRequest_init(UA_SetMonitoringModeRequest *p) { - memset(p, 0, sizeof(UA_SetMonitoringModeRequest)); -} - -static UA_INLINE UA_SetMonitoringModeRequest * -UA_SetMonitoringModeRequest_new(void) { - return (UA_SetMonitoringModeRequest*)UA_new(&UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_SetMonitoringModeRequest_copy(const UA_SetMonitoringModeRequest *src, UA_SetMonitoringModeRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST]); -} - -static UA_INLINE void -UA_SetMonitoringModeRequest_deleteMembers(UA_SetMonitoringModeRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST]); -} - -static UA_INLINE void -UA_SetMonitoringModeRequest_delete(UA_SetMonitoringModeRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST]); -} - -/* SetMonitoringModeResponse */ -static UA_INLINE void -UA_SetMonitoringModeResponse_init(UA_SetMonitoringModeResponse *p) { - memset(p, 0, sizeof(UA_SetMonitoringModeResponse)); -} - -static UA_INLINE UA_SetMonitoringModeResponse * -UA_SetMonitoringModeResponse_new(void) { - return (UA_SetMonitoringModeResponse*)UA_new(&UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_SetMonitoringModeResponse_copy(const UA_SetMonitoringModeResponse *src, UA_SetMonitoringModeResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE]); -} - -static UA_INLINE void -UA_SetMonitoringModeResponse_deleteMembers(UA_SetMonitoringModeResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE]); -} - -static UA_INLINE void -UA_SetMonitoringModeResponse_delete(UA_SetMonitoringModeResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE]); -} - -/* DeleteMonitoredItemsRequest */ -static UA_INLINE void -UA_DeleteMonitoredItemsRequest_init(UA_DeleteMonitoredItemsRequest *p) { - memset(p, 0, sizeof(UA_DeleteMonitoredItemsRequest)); -} - -static UA_INLINE UA_DeleteMonitoredItemsRequest * -UA_DeleteMonitoredItemsRequest_new(void) { - return (UA_DeleteMonitoredItemsRequest*)UA_new(&UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_DeleteMonitoredItemsRequest_copy(const UA_DeleteMonitoredItemsRequest *src, UA_DeleteMonitoredItemsRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST]); -} - -static UA_INLINE void -UA_DeleteMonitoredItemsRequest_deleteMembers(UA_DeleteMonitoredItemsRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST]); -} - -static UA_INLINE void -UA_DeleteMonitoredItemsRequest_delete(UA_DeleteMonitoredItemsRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST]); -} - -/* DeleteMonitoredItemsResponse */ -static UA_INLINE void -UA_DeleteMonitoredItemsResponse_init(UA_DeleteMonitoredItemsResponse *p) { - memset(p, 0, sizeof(UA_DeleteMonitoredItemsResponse)); -} - -static UA_INLINE UA_DeleteMonitoredItemsResponse * -UA_DeleteMonitoredItemsResponse_new(void) { - return (UA_DeleteMonitoredItemsResponse*)UA_new(&UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_DeleteMonitoredItemsResponse_copy(const UA_DeleteMonitoredItemsResponse *src, UA_DeleteMonitoredItemsResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE]); -} - -static UA_INLINE void -UA_DeleteMonitoredItemsResponse_deleteMembers(UA_DeleteMonitoredItemsResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE]); -} - -static UA_INLINE void -UA_DeleteMonitoredItemsResponse_delete(UA_DeleteMonitoredItemsResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE]); -} - -/* CreateSubscriptionRequest */ -static UA_INLINE void -UA_CreateSubscriptionRequest_init(UA_CreateSubscriptionRequest *p) { - memset(p, 0, sizeof(UA_CreateSubscriptionRequest)); -} - -static UA_INLINE UA_CreateSubscriptionRequest * -UA_CreateSubscriptionRequest_new(void) { - return (UA_CreateSubscriptionRequest*)UA_new(&UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_CreateSubscriptionRequest_copy(const UA_CreateSubscriptionRequest *src, UA_CreateSubscriptionRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST]); -} - -static UA_INLINE void -UA_CreateSubscriptionRequest_deleteMembers(UA_CreateSubscriptionRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST]); -} - -static UA_INLINE void -UA_CreateSubscriptionRequest_delete(UA_CreateSubscriptionRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST]); -} - -/* CreateSubscriptionResponse */ -static UA_INLINE void -UA_CreateSubscriptionResponse_init(UA_CreateSubscriptionResponse *p) { - memset(p, 0, sizeof(UA_CreateSubscriptionResponse)); -} - -static UA_INLINE UA_CreateSubscriptionResponse * -UA_CreateSubscriptionResponse_new(void) { - return (UA_CreateSubscriptionResponse*)UA_new(&UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_CreateSubscriptionResponse_copy(const UA_CreateSubscriptionResponse *src, UA_CreateSubscriptionResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]); -} - -static UA_INLINE void -UA_CreateSubscriptionResponse_deleteMembers(UA_CreateSubscriptionResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]); -} - -static UA_INLINE void -UA_CreateSubscriptionResponse_delete(UA_CreateSubscriptionResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]); -} - -/* ModifySubscriptionRequest */ -static UA_INLINE void -UA_ModifySubscriptionRequest_init(UA_ModifySubscriptionRequest *p) { - memset(p, 0, sizeof(UA_ModifySubscriptionRequest)); -} - -static UA_INLINE UA_ModifySubscriptionRequest * -UA_ModifySubscriptionRequest_new(void) { - return (UA_ModifySubscriptionRequest*)UA_new(&UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_ModifySubscriptionRequest_copy(const UA_ModifySubscriptionRequest *src, UA_ModifySubscriptionRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST]); -} - -static UA_INLINE void -UA_ModifySubscriptionRequest_deleteMembers(UA_ModifySubscriptionRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST]); -} - -static UA_INLINE void -UA_ModifySubscriptionRequest_delete(UA_ModifySubscriptionRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST]); -} - -/* ModifySubscriptionResponse */ -static UA_INLINE void -UA_ModifySubscriptionResponse_init(UA_ModifySubscriptionResponse *p) { - memset(p, 0, sizeof(UA_ModifySubscriptionResponse)); -} - -static UA_INLINE UA_ModifySubscriptionResponse * -UA_ModifySubscriptionResponse_new(void) { - return (UA_ModifySubscriptionResponse*)UA_new(&UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_ModifySubscriptionResponse_copy(const UA_ModifySubscriptionResponse *src, UA_ModifySubscriptionResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]); -} - -static UA_INLINE void -UA_ModifySubscriptionResponse_deleteMembers(UA_ModifySubscriptionResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]); -} - -static UA_INLINE void -UA_ModifySubscriptionResponse_delete(UA_ModifySubscriptionResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]); -} - -/* SetPublishingModeRequest */ -static UA_INLINE void -UA_SetPublishingModeRequest_init(UA_SetPublishingModeRequest *p) { - memset(p, 0, sizeof(UA_SetPublishingModeRequest)); -} - -static UA_INLINE UA_SetPublishingModeRequest * -UA_SetPublishingModeRequest_new(void) { - return (UA_SetPublishingModeRequest*)UA_new(&UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_SetPublishingModeRequest_copy(const UA_SetPublishingModeRequest *src, UA_SetPublishingModeRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST]); -} - -static UA_INLINE void -UA_SetPublishingModeRequest_deleteMembers(UA_SetPublishingModeRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST]); -} - -static UA_INLINE void -UA_SetPublishingModeRequest_delete(UA_SetPublishingModeRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST]); -} - -/* SetPublishingModeResponse */ -static UA_INLINE void -UA_SetPublishingModeResponse_init(UA_SetPublishingModeResponse *p) { - memset(p, 0, sizeof(UA_SetPublishingModeResponse)); -} - -static UA_INLINE UA_SetPublishingModeResponse * -UA_SetPublishingModeResponse_new(void) { - return (UA_SetPublishingModeResponse*)UA_new(&UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_SetPublishingModeResponse_copy(const UA_SetPublishingModeResponse *src, UA_SetPublishingModeResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE]); -} - -static UA_INLINE void -UA_SetPublishingModeResponse_deleteMembers(UA_SetPublishingModeResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE]); -} - -static UA_INLINE void -UA_SetPublishingModeResponse_delete(UA_SetPublishingModeResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE]); -} - -/* NotificationMessage */ -static UA_INLINE void -UA_NotificationMessage_init(UA_NotificationMessage *p) { - memset(p, 0, sizeof(UA_NotificationMessage)); -} - -static UA_INLINE UA_NotificationMessage * -UA_NotificationMessage_new(void) { - return (UA_NotificationMessage*)UA_new(&UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE]); -} - -static UA_INLINE UA_StatusCode -UA_NotificationMessage_copy(const UA_NotificationMessage *src, UA_NotificationMessage *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE]); -} - -static UA_INLINE void -UA_NotificationMessage_deleteMembers(UA_NotificationMessage *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE]); -} - -static UA_INLINE void -UA_NotificationMessage_delete(UA_NotificationMessage *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE]); -} - -/* MonitoredItemNotification */ -static UA_INLINE void -UA_MonitoredItemNotification_init(UA_MonitoredItemNotification *p) { - memset(p, 0, sizeof(UA_MonitoredItemNotification)); -} - -static UA_INLINE UA_MonitoredItemNotification * -UA_MonitoredItemNotification_new(void) { - return (UA_MonitoredItemNotification*)UA_new(&UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION]); -} - -static UA_INLINE UA_StatusCode -UA_MonitoredItemNotification_copy(const UA_MonitoredItemNotification *src, UA_MonitoredItemNotification *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION]); -} - -static UA_INLINE void -UA_MonitoredItemNotification_deleteMembers(UA_MonitoredItemNotification *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION]); -} - -static UA_INLINE void -UA_MonitoredItemNotification_delete(UA_MonitoredItemNotification *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION]); -} - -/* EventFieldList */ -static UA_INLINE void -UA_EventFieldList_init(UA_EventFieldList *p) { - memset(p, 0, sizeof(UA_EventFieldList)); -} - -static UA_INLINE UA_EventFieldList * -UA_EventFieldList_new(void) { - return (UA_EventFieldList*)UA_new(&UA_TYPES[UA_TYPES_EVENTFIELDLIST]); -} - -static UA_INLINE UA_StatusCode -UA_EventFieldList_copy(const UA_EventFieldList *src, UA_EventFieldList *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_EVENTFIELDLIST]); -} - -static UA_INLINE void -UA_EventFieldList_deleteMembers(UA_EventFieldList *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_EVENTFIELDLIST]); -} - -static UA_INLINE void -UA_EventFieldList_delete(UA_EventFieldList *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_EVENTFIELDLIST]); -} - -/* StatusChangeNotification */ -static UA_INLINE void -UA_StatusChangeNotification_init(UA_StatusChangeNotification *p) { - memset(p, 0, sizeof(UA_StatusChangeNotification)); -} - -static UA_INLINE UA_StatusChangeNotification * -UA_StatusChangeNotification_new(void) { - return (UA_StatusChangeNotification*)UA_new(&UA_TYPES[UA_TYPES_STATUSCHANGENOTIFICATION]); -} - -static UA_INLINE UA_StatusCode -UA_StatusChangeNotification_copy(const UA_StatusChangeNotification *src, UA_StatusChangeNotification *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_STATUSCHANGENOTIFICATION]); -} - -static UA_INLINE void -UA_StatusChangeNotification_deleteMembers(UA_StatusChangeNotification *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_STATUSCHANGENOTIFICATION]); -} - -static UA_INLINE void -UA_StatusChangeNotification_delete(UA_StatusChangeNotification *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_STATUSCHANGENOTIFICATION]); -} - -/* SubscriptionAcknowledgement */ -static UA_INLINE void -UA_SubscriptionAcknowledgement_init(UA_SubscriptionAcknowledgement *p) { - memset(p, 0, sizeof(UA_SubscriptionAcknowledgement)); -} - -static UA_INLINE UA_SubscriptionAcknowledgement * -UA_SubscriptionAcknowledgement_new(void) { - return (UA_SubscriptionAcknowledgement*)UA_new(&UA_TYPES[UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT]); -} - -static UA_INLINE UA_StatusCode -UA_SubscriptionAcknowledgement_copy(const UA_SubscriptionAcknowledgement *src, UA_SubscriptionAcknowledgement *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_SubscriptionAcknowledgement_deleteMembers(UA_SubscriptionAcknowledgement *p) { } - -static UA_INLINE void -UA_SubscriptionAcknowledgement_delete(UA_SubscriptionAcknowledgement *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT]); -} - -/* PublishRequest */ -static UA_INLINE void -UA_PublishRequest_init(UA_PublishRequest *p) { - memset(p, 0, sizeof(UA_PublishRequest)); -} - -static UA_INLINE UA_PublishRequest * -UA_PublishRequest_new(void) { - return (UA_PublishRequest*)UA_new(&UA_TYPES[UA_TYPES_PUBLISHREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_PublishRequest_copy(const UA_PublishRequest *src, UA_PublishRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_PUBLISHREQUEST]); -} - -static UA_INLINE void -UA_PublishRequest_deleteMembers(UA_PublishRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_PUBLISHREQUEST]); -} - -static UA_INLINE void -UA_PublishRequest_delete(UA_PublishRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_PUBLISHREQUEST]); -} - -/* PublishResponse */ -static UA_INLINE void -UA_PublishResponse_init(UA_PublishResponse *p) { - memset(p, 0, sizeof(UA_PublishResponse)); -} - -static UA_INLINE UA_PublishResponse * -UA_PublishResponse_new(void) { - return (UA_PublishResponse*)UA_new(&UA_TYPES[UA_TYPES_PUBLISHRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_PublishResponse_copy(const UA_PublishResponse *src, UA_PublishResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]); -} - -static UA_INLINE void -UA_PublishResponse_deleteMembers(UA_PublishResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]); -} - -static UA_INLINE void -UA_PublishResponse_delete(UA_PublishResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]); -} - -/* RepublishRequest */ -static UA_INLINE void -UA_RepublishRequest_init(UA_RepublishRequest *p) { - memset(p, 0, sizeof(UA_RepublishRequest)); -} - -static UA_INLINE UA_RepublishRequest * -UA_RepublishRequest_new(void) { - return (UA_RepublishRequest*)UA_new(&UA_TYPES[UA_TYPES_REPUBLISHREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_RepublishRequest_copy(const UA_RepublishRequest *src, UA_RepublishRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST]); -} - -static UA_INLINE void -UA_RepublishRequest_deleteMembers(UA_RepublishRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST]); -} - -static UA_INLINE void -UA_RepublishRequest_delete(UA_RepublishRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST]); -} - -/* RepublishResponse */ -static UA_INLINE void -UA_RepublishResponse_init(UA_RepublishResponse *p) { - memset(p, 0, sizeof(UA_RepublishResponse)); -} - -static UA_INLINE UA_RepublishResponse * -UA_RepublishResponse_new(void) { - return (UA_RepublishResponse*)UA_new(&UA_TYPES[UA_TYPES_REPUBLISHRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_RepublishResponse_copy(const UA_RepublishResponse *src, UA_RepublishResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE]); -} - -static UA_INLINE void -UA_RepublishResponse_deleteMembers(UA_RepublishResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE]); -} - -static UA_INLINE void -UA_RepublishResponse_delete(UA_RepublishResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE]); -} - -/* DeleteSubscriptionsRequest */ -static UA_INLINE void -UA_DeleteSubscriptionsRequest_init(UA_DeleteSubscriptionsRequest *p) { - memset(p, 0, sizeof(UA_DeleteSubscriptionsRequest)); -} - -static UA_INLINE UA_DeleteSubscriptionsRequest * -UA_DeleteSubscriptionsRequest_new(void) { - return (UA_DeleteSubscriptionsRequest*)UA_new(&UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST]); -} - -static UA_INLINE UA_StatusCode -UA_DeleteSubscriptionsRequest_copy(const UA_DeleteSubscriptionsRequest *src, UA_DeleteSubscriptionsRequest *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST]); -} - -static UA_INLINE void -UA_DeleteSubscriptionsRequest_deleteMembers(UA_DeleteSubscriptionsRequest *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST]); -} - -static UA_INLINE void -UA_DeleteSubscriptionsRequest_delete(UA_DeleteSubscriptionsRequest *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST]); -} - -/* DeleteSubscriptionsResponse */ -static UA_INLINE void -UA_DeleteSubscriptionsResponse_init(UA_DeleteSubscriptionsResponse *p) { - memset(p, 0, sizeof(UA_DeleteSubscriptionsResponse)); -} - -static UA_INLINE UA_DeleteSubscriptionsResponse * -UA_DeleteSubscriptionsResponse_new(void) { - return (UA_DeleteSubscriptionsResponse*)UA_new(&UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE]); -} - -static UA_INLINE UA_StatusCode -UA_DeleteSubscriptionsResponse_copy(const UA_DeleteSubscriptionsResponse *src, UA_DeleteSubscriptionsResponse *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE]); -} - -static UA_INLINE void -UA_DeleteSubscriptionsResponse_deleteMembers(UA_DeleteSubscriptionsResponse *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE]); -} - -static UA_INLINE void -UA_DeleteSubscriptionsResponse_delete(UA_DeleteSubscriptionsResponse *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE]); -} - -/* BuildInfo */ -static UA_INLINE void -UA_BuildInfo_init(UA_BuildInfo *p) { - memset(p, 0, sizeof(UA_BuildInfo)); -} - -static UA_INLINE UA_BuildInfo * -UA_BuildInfo_new(void) { - return (UA_BuildInfo*)UA_new(&UA_TYPES[UA_TYPES_BUILDINFO]); -} - -static UA_INLINE UA_StatusCode -UA_BuildInfo_copy(const UA_BuildInfo *src, UA_BuildInfo *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_BUILDINFO]); -} - -static UA_INLINE void -UA_BuildInfo_deleteMembers(UA_BuildInfo *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_BUILDINFO]); -} - -static UA_INLINE void -UA_BuildInfo_delete(UA_BuildInfo *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_BUILDINFO]); -} - -/* RedundancySupport */ -static UA_INLINE void -UA_RedundancySupport_init(UA_RedundancySupport *p) { - memset(p, 0, sizeof(UA_RedundancySupport)); -} - -static UA_INLINE UA_RedundancySupport * -UA_RedundancySupport_new(void) { - return (UA_RedundancySupport*)UA_new(&UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT]); -} - -static UA_INLINE UA_StatusCode -UA_RedundancySupport_copy(const UA_RedundancySupport *src, UA_RedundancySupport *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_RedundancySupport_deleteMembers(UA_RedundancySupport *p) { } - -static UA_INLINE void -UA_RedundancySupport_delete(UA_RedundancySupport *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REDUNDANCYSUPPORT]); -} - -/* ServerState */ -static UA_INLINE void -UA_ServerState_init(UA_ServerState *p) { - memset(p, 0, sizeof(UA_ServerState)); -} - -static UA_INLINE UA_ServerState * -UA_ServerState_new(void) { - return (UA_ServerState*)UA_new(&UA_TYPES[UA_TYPES_SERVERSTATE]); -} - -static UA_INLINE UA_StatusCode -UA_ServerState_copy(const UA_ServerState *src, UA_ServerState *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_ServerState_deleteMembers(UA_ServerState *p) { } - -static UA_INLINE void -UA_ServerState_delete(UA_ServerState *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SERVERSTATE]); -} - -/* RedundantServerDataType */ -static UA_INLINE void -UA_RedundantServerDataType_init(UA_RedundantServerDataType *p) { - memset(p, 0, sizeof(UA_RedundantServerDataType)); -} - -static UA_INLINE UA_RedundantServerDataType * -UA_RedundantServerDataType_new(void) { - return (UA_RedundantServerDataType*)UA_new(&UA_TYPES[UA_TYPES_REDUNDANTSERVERDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_RedundantServerDataType_copy(const UA_RedundantServerDataType *src, UA_RedundantServerDataType *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_REDUNDANTSERVERDATATYPE]); -} - -static UA_INLINE void -UA_RedundantServerDataType_deleteMembers(UA_RedundantServerDataType *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_REDUNDANTSERVERDATATYPE]); -} - -static UA_INLINE void -UA_RedundantServerDataType_delete(UA_RedundantServerDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_REDUNDANTSERVERDATATYPE]); -} - -/* EndpointUrlListDataType */ -static UA_INLINE void -UA_EndpointUrlListDataType_init(UA_EndpointUrlListDataType *p) { - memset(p, 0, sizeof(UA_EndpointUrlListDataType)); -} - -static UA_INLINE UA_EndpointUrlListDataType * -UA_EndpointUrlListDataType_new(void) { - return (UA_EndpointUrlListDataType*)UA_new(&UA_TYPES[UA_TYPES_ENDPOINTURLLISTDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_EndpointUrlListDataType_copy(const UA_EndpointUrlListDataType *src, UA_EndpointUrlListDataType *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_ENDPOINTURLLISTDATATYPE]); -} - -static UA_INLINE void -UA_EndpointUrlListDataType_deleteMembers(UA_EndpointUrlListDataType *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_ENDPOINTURLLISTDATATYPE]); -} - -static UA_INLINE void -UA_EndpointUrlListDataType_delete(UA_EndpointUrlListDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_ENDPOINTURLLISTDATATYPE]); -} - -/* NetworkGroupDataType */ -static UA_INLINE void -UA_NetworkGroupDataType_init(UA_NetworkGroupDataType *p) { - memset(p, 0, sizeof(UA_NetworkGroupDataType)); -} - -static UA_INLINE UA_NetworkGroupDataType * -UA_NetworkGroupDataType_new(void) { - return (UA_NetworkGroupDataType*)UA_new(&UA_TYPES[UA_TYPES_NETWORKGROUPDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_NetworkGroupDataType_copy(const UA_NetworkGroupDataType *src, UA_NetworkGroupDataType *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_NETWORKGROUPDATATYPE]); -} - -static UA_INLINE void -UA_NetworkGroupDataType_deleteMembers(UA_NetworkGroupDataType *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_NETWORKGROUPDATATYPE]); -} - -static UA_INLINE void -UA_NetworkGroupDataType_delete(UA_NetworkGroupDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_NETWORKGROUPDATATYPE]); -} - -/* ServerDiagnosticsSummaryDataType */ -static UA_INLINE void -UA_ServerDiagnosticsSummaryDataType_init(UA_ServerDiagnosticsSummaryDataType *p) { - memset(p, 0, sizeof(UA_ServerDiagnosticsSummaryDataType)); -} - -static UA_INLINE UA_ServerDiagnosticsSummaryDataType * -UA_ServerDiagnosticsSummaryDataType_new(void) { - return (UA_ServerDiagnosticsSummaryDataType*)UA_new(&UA_TYPES[UA_TYPES_SERVERDIAGNOSTICSSUMMARYDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_ServerDiagnosticsSummaryDataType_copy(const UA_ServerDiagnosticsSummaryDataType *src, UA_ServerDiagnosticsSummaryDataType *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_ServerDiagnosticsSummaryDataType_deleteMembers(UA_ServerDiagnosticsSummaryDataType *p) { } - -static UA_INLINE void -UA_ServerDiagnosticsSummaryDataType_delete(UA_ServerDiagnosticsSummaryDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SERVERDIAGNOSTICSSUMMARYDATATYPE]); -} - -/* ServerStatusDataType */ -static UA_INLINE void -UA_ServerStatusDataType_init(UA_ServerStatusDataType *p) { - memset(p, 0, sizeof(UA_ServerStatusDataType)); -} - -static UA_INLINE UA_ServerStatusDataType * -UA_ServerStatusDataType_new(void) { - return (UA_ServerStatusDataType*)UA_new(&UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_ServerStatusDataType_copy(const UA_ServerStatusDataType *src, UA_ServerStatusDataType *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]); -} - -static UA_INLINE void -UA_ServerStatusDataType_deleteMembers(UA_ServerStatusDataType *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]); -} - -static UA_INLINE void -UA_ServerStatusDataType_delete(UA_ServerStatusDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]); -} - -/* SessionSecurityDiagnosticsDataType */ -static UA_INLINE void -UA_SessionSecurityDiagnosticsDataType_init(UA_SessionSecurityDiagnosticsDataType *p) { - memset(p, 0, sizeof(UA_SessionSecurityDiagnosticsDataType)); -} - -static UA_INLINE UA_SessionSecurityDiagnosticsDataType * -UA_SessionSecurityDiagnosticsDataType_new(void) { - return (UA_SessionSecurityDiagnosticsDataType*)UA_new(&UA_TYPES[UA_TYPES_SESSIONSECURITYDIAGNOSTICSDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_SessionSecurityDiagnosticsDataType_copy(const UA_SessionSecurityDiagnosticsDataType *src, UA_SessionSecurityDiagnosticsDataType *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SESSIONSECURITYDIAGNOSTICSDATATYPE]); -} - -static UA_INLINE void -UA_SessionSecurityDiagnosticsDataType_deleteMembers(UA_SessionSecurityDiagnosticsDataType *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SESSIONSECURITYDIAGNOSTICSDATATYPE]); -} - -static UA_INLINE void -UA_SessionSecurityDiagnosticsDataType_delete(UA_SessionSecurityDiagnosticsDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SESSIONSECURITYDIAGNOSTICSDATATYPE]); -} - -/* ServiceCounterDataType */ -static UA_INLINE void -UA_ServiceCounterDataType_init(UA_ServiceCounterDataType *p) { - memset(p, 0, sizeof(UA_ServiceCounterDataType)); -} - -static UA_INLINE UA_ServiceCounterDataType * -UA_ServiceCounterDataType_new(void) { - return (UA_ServiceCounterDataType*)UA_new(&UA_TYPES[UA_TYPES_SERVICECOUNTERDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_ServiceCounterDataType_copy(const UA_ServiceCounterDataType *src, UA_ServiceCounterDataType *dst) { - *dst = *src; - return UA_STATUSCODE_GOOD; -} - -static UA_INLINE void -UA_ServiceCounterDataType_deleteMembers(UA_ServiceCounterDataType *p) { } - -static UA_INLINE void -UA_ServiceCounterDataType_delete(UA_ServiceCounterDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SERVICECOUNTERDATATYPE]); -} - -/* SubscriptionDiagnosticsDataType */ -static UA_INLINE void -UA_SubscriptionDiagnosticsDataType_init(UA_SubscriptionDiagnosticsDataType *p) { - memset(p, 0, sizeof(UA_SubscriptionDiagnosticsDataType)); -} - -static UA_INLINE UA_SubscriptionDiagnosticsDataType * -UA_SubscriptionDiagnosticsDataType_new(void) { - return (UA_SubscriptionDiagnosticsDataType*)UA_new(&UA_TYPES[UA_TYPES_SUBSCRIPTIONDIAGNOSTICSDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_SubscriptionDiagnosticsDataType_copy(const UA_SubscriptionDiagnosticsDataType *src, UA_SubscriptionDiagnosticsDataType *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SUBSCRIPTIONDIAGNOSTICSDATATYPE]); -} - -static UA_INLINE void -UA_SubscriptionDiagnosticsDataType_deleteMembers(UA_SubscriptionDiagnosticsDataType *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SUBSCRIPTIONDIAGNOSTICSDATATYPE]); -} - -static UA_INLINE void -UA_SubscriptionDiagnosticsDataType_delete(UA_SubscriptionDiagnosticsDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SUBSCRIPTIONDIAGNOSTICSDATATYPE]); -} - -/* ModelChangeStructureDataType */ -static UA_INLINE void -UA_ModelChangeStructureDataType_init(UA_ModelChangeStructureDataType *p) { - memset(p, 0, sizeof(UA_ModelChangeStructureDataType)); -} - -static UA_INLINE UA_ModelChangeStructureDataType * -UA_ModelChangeStructureDataType_new(void) { - return (UA_ModelChangeStructureDataType*)UA_new(&UA_TYPES[UA_TYPES_MODELCHANGESTRUCTUREDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_ModelChangeStructureDataType_copy(const UA_ModelChangeStructureDataType *src, UA_ModelChangeStructureDataType *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_MODELCHANGESTRUCTUREDATATYPE]); -} - -static UA_INLINE void -UA_ModelChangeStructureDataType_deleteMembers(UA_ModelChangeStructureDataType *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_MODELCHANGESTRUCTUREDATATYPE]); -} - -static UA_INLINE void -UA_ModelChangeStructureDataType_delete(UA_ModelChangeStructureDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_MODELCHANGESTRUCTUREDATATYPE]); -} - -/* SemanticChangeStructureDataType */ -static UA_INLINE void -UA_SemanticChangeStructureDataType_init(UA_SemanticChangeStructureDataType *p) { - memset(p, 0, sizeof(UA_SemanticChangeStructureDataType)); -} - -static UA_INLINE UA_SemanticChangeStructureDataType * -UA_SemanticChangeStructureDataType_new(void) { - return (UA_SemanticChangeStructureDataType*)UA_new(&UA_TYPES[UA_TYPES_SEMANTICCHANGESTRUCTUREDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_SemanticChangeStructureDataType_copy(const UA_SemanticChangeStructureDataType *src, UA_SemanticChangeStructureDataType *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SEMANTICCHANGESTRUCTUREDATATYPE]); -} - -static UA_INLINE void -UA_SemanticChangeStructureDataType_deleteMembers(UA_SemanticChangeStructureDataType *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SEMANTICCHANGESTRUCTUREDATATYPE]); -} - -static UA_INLINE void -UA_SemanticChangeStructureDataType_delete(UA_SemanticChangeStructureDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SEMANTICCHANGESTRUCTUREDATATYPE]); -} - -/* DataChangeNotification */ -static UA_INLINE void -UA_DataChangeNotification_init(UA_DataChangeNotification *p) { - memset(p, 0, sizeof(UA_DataChangeNotification)); -} - -static UA_INLINE UA_DataChangeNotification * -UA_DataChangeNotification_new(void) { - return (UA_DataChangeNotification*)UA_new(&UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION]); -} - -static UA_INLINE UA_StatusCode -UA_DataChangeNotification_copy(const UA_DataChangeNotification *src, UA_DataChangeNotification *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION]); -} - -static UA_INLINE void -UA_DataChangeNotification_deleteMembers(UA_DataChangeNotification *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION]); -} - -static UA_INLINE void -UA_DataChangeNotification_delete(UA_DataChangeNotification *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION]); -} - -/* EventNotificationList */ -static UA_INLINE void -UA_EventNotificationList_init(UA_EventNotificationList *p) { - memset(p, 0, sizeof(UA_EventNotificationList)); -} - -static UA_INLINE UA_EventNotificationList * -UA_EventNotificationList_new(void) { - return (UA_EventNotificationList*)UA_new(&UA_TYPES[UA_TYPES_EVENTNOTIFICATIONLIST]); -} - -static UA_INLINE UA_StatusCode -UA_EventNotificationList_copy(const UA_EventNotificationList *src, UA_EventNotificationList *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_EVENTNOTIFICATIONLIST]); -} - -static UA_INLINE void -UA_EventNotificationList_deleteMembers(UA_EventNotificationList *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_EVENTNOTIFICATIONLIST]); -} - -static UA_INLINE void -UA_EventNotificationList_delete(UA_EventNotificationList *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_EVENTNOTIFICATIONLIST]); -} - -/* SessionDiagnosticsDataType */ -static UA_INLINE void -UA_SessionDiagnosticsDataType_init(UA_SessionDiagnosticsDataType *p) { - memset(p, 0, sizeof(UA_SessionDiagnosticsDataType)); -} - -static UA_INLINE UA_SessionDiagnosticsDataType * -UA_SessionDiagnosticsDataType_new(void) { - return (UA_SessionDiagnosticsDataType*)UA_new(&UA_TYPES[UA_TYPES_SESSIONDIAGNOSTICSDATATYPE]); -} - -static UA_INLINE UA_StatusCode -UA_SessionDiagnosticsDataType_copy(const UA_SessionDiagnosticsDataType *src, UA_SessionDiagnosticsDataType *dst) { - return UA_copy(src, dst, &UA_TYPES[UA_TYPES_SESSIONDIAGNOSTICSDATATYPE]); -} - -static UA_INLINE void -UA_SessionDiagnosticsDataType_deleteMembers(UA_SessionDiagnosticsDataType *p) { - UA_deleteMembers(p, &UA_TYPES[UA_TYPES_SESSIONDIAGNOSTICSDATATYPE]); -} - -static UA_INLINE void -UA_SessionDiagnosticsDataType_delete(UA_SessionDiagnosticsDataType *p) { - UA_delete(p, &UA_TYPES[UA_TYPES_SESSIONDIAGNOSTICSDATATYPE]); -} - -#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 -# pragma GCC diagnostic pop -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_server.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -struct UA_ServerConfig; -typedef struct UA_ServerConfig UA_ServerConfig; - -struct UA_Server; -typedef struct UA_Server UA_Server; - -/** - * .. _server: - * - * Server - * ====== - * - * .. _server-lifecycle: - * - * Server Lifecycle - * ---------------- */ - -UA_Server UA_EXPORT * UA_Server_new(const UA_ServerConfig *config); -void UA_EXPORT UA_Server_delete(UA_Server *server); - -/* Runs the main loop of the server. In each iteration, this calls into the - * networklayers to see if messages have arrived. - * - * @param server The server object. - * @param running The loop is run as long as *running is true. - * Otherwise, the server shuts down. - * @return Returns the statuscode of the UA_Server_run_shutdown method */ -UA_StatusCode UA_EXPORT -UA_Server_run(UA_Server *server, volatile UA_Boolean *running); - -/* The prologue part of UA_Server_run (no need to use if you call - * UA_Server_run) */ -UA_StatusCode UA_EXPORT -UA_Server_run_startup(UA_Server *server); - -/* Executes a single iteration of the server's main loop. - * - * @param server The server object. - * @param waitInternal Should we wait for messages in the networklayer? - * Otherwise, the timouts for the networklayers are set to zero. - * The default max wait time is 50millisec. - * @return Returns how long we can wait until the next scheduled - * callback (in ms) */ -UA_UInt16 UA_EXPORT -UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal); - -/* The epilogue part of UA_Server_run (no need to use if you call - * UA_Server_run) */ -UA_StatusCode UA_EXPORT -UA_Server_run_shutdown(UA_Server *server); - -/** - * Repeated Callbacks - * ------------------ */ -typedef void (*UA_ServerCallback)(UA_Server *server, void *data); - -/* Add a callback for cyclic repetition to the server. - * - * @param server The server object. - * @param callback The callback that shall be added. - * @param interval The callback shall be repeatedly executed with the given interval - * (in ms). The interval must be larger than 5ms. The first execution - * occurs at now() + interval at the latest. - * @param callbackId Set to the identifier of the repeated callback . This can be used to cancel - * the callback later on. If the pointer is null, the identifier is not set. - * @return Upon success, UA_STATUSCODE_GOOD is returned. - * An error code otherwise. */ -UA_StatusCode UA_EXPORT -UA_Server_addRepeatedCallback(UA_Server *server, UA_ServerCallback callback, - void *data, UA_UInt32 interval, UA_UInt64 *callbackId); - -UA_StatusCode UA_EXPORT -UA_Server_changeRepeatedCallbackInterval(UA_Server *server, UA_UInt64 callbackId, - UA_UInt32 interval); - -/* Remove a repeated callback. - * - * @param server The server object. - * @param callbackId The id of the callback that shall be removed. - * @return Upon success, UA_STATUSCODE_GOOD is returned. - * An error code otherwise. */ -UA_StatusCode UA_EXPORT -UA_Server_removeRepeatedCallback(UA_Server *server, UA_UInt64 callbackId); - -/** - * Reading and Writing Node Attributes - * ----------------------------------- - * The functions for reading and writing node attributes call the regular read - * and write service in the background that are also used over the network. - * - * The following attributes cannot be read, since the local "admin" user always - * has full rights. - * - * - UserWriteMask - * - UserAccessLevel - * - UserExecutable */ -/* Read an attribute of a node. The specialized functions below provide a more - * concise syntax. - * - * @param server The server object. - * @param item ReadValueIds contain the NodeId of the target node, the id of the - * attribute to read and (optionally) an index range to read parts - * of an array only. See the section on NumericRange for the format - * used for array ranges. - * @param timestamps Which timestamps to return for the attribute. - * @return Returns a DataValue that contains either an error code, or a variant - * with the attribute value and the timestamps. */ -UA_DataValue UA_EXPORT -UA_Server_read(UA_Server *server, const UA_ReadValueId *item, - UA_TimestampsToReturn timestamps); - -/* Don't use this function. There are typed versions for every supported - * attribute. */ -UA_StatusCode UA_EXPORT -__UA_Server_read(UA_Server *server, const UA_NodeId *nodeId, - UA_AttributeId attributeId, void *v); - -static UA_INLINE UA_StatusCode -UA_Server_readNodeId(UA_Server *server, const UA_NodeId nodeId, - UA_NodeId *outNodeId) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_NODEID, outNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Server_readNodeClass(UA_Server *server, const UA_NodeId nodeId, - UA_NodeClass *outNodeClass) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_NODECLASS, - outNodeClass); -} - -static UA_INLINE UA_StatusCode -UA_Server_readBrowseName(UA_Server *server, const UA_NodeId nodeId, - UA_QualifiedName *outBrowseName) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_BROWSENAME, - outBrowseName); -} - -static UA_INLINE UA_StatusCode -UA_Server_readDisplayName(UA_Server *server, const UA_NodeId nodeId, - UA_LocalizedText *outDisplayName) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME, - outDisplayName); -} - -static UA_INLINE UA_StatusCode -UA_Server_readDescription(UA_Server *server, const UA_NodeId nodeId, - UA_LocalizedText *outDescription) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DESCRIPTION, - outDescription); -} - -static UA_INLINE UA_StatusCode -UA_Server_readWriteMask(UA_Server *server, const UA_NodeId nodeId, - UA_UInt32 *outWriteMask) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_WRITEMASK, - outWriteMask); -} - -static UA_INLINE UA_StatusCode -UA_Server_readIsAbstract(UA_Server *server, const UA_NodeId nodeId, - UA_Boolean *outIsAbstract) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ISABSTRACT, - outIsAbstract); -} - -static UA_INLINE UA_StatusCode -UA_Server_readSymmetric(UA_Server *server, const UA_NodeId nodeId, - UA_Boolean *outSymmetric) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_SYMMETRIC, - outSymmetric); -} - -static UA_INLINE UA_StatusCode -UA_Server_readInverseName(UA_Server *server, const UA_NodeId nodeId, - UA_LocalizedText *outInverseName) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_INVERSENAME, - outInverseName); -} - -static UA_INLINE UA_StatusCode -UA_Server_readContainsNoLoop(UA_Server *server, const UA_NodeId nodeId, - UA_Boolean *outContainsNoLoops) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_CONTAINSNOLOOPS, - outContainsNoLoops); -} - -static UA_INLINE UA_StatusCode -UA_Server_readEventNotifier(UA_Server *server, const UA_NodeId nodeId, - UA_Byte *outEventNotifier) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER, - outEventNotifier); -} - -static UA_INLINE UA_StatusCode -UA_Server_readValue(UA_Server *server, const UA_NodeId nodeId, - UA_Variant *outValue) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_VALUE, outValue); -} - -static UA_INLINE UA_StatusCode -UA_Server_readDataType(UA_Server *server, const UA_NodeId nodeId, - UA_NodeId *outDataType) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DATATYPE, - outDataType); -} - -static UA_INLINE UA_StatusCode -UA_Server_readValueRank(UA_Server *server, const UA_NodeId nodeId, - UA_Int32 *outValueRank) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_VALUERANK, - outValueRank); -} - -/* Returns a variant with an int32 array */ -static UA_INLINE UA_StatusCode -UA_Server_readArrayDimensions(UA_Server *server, const UA_NodeId nodeId, - UA_Variant *outArrayDimensions) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ARRAYDIMENSIONS, - outArrayDimensions); -} - -static UA_INLINE UA_StatusCode -UA_Server_readAccessLevel(UA_Server *server, const UA_NodeId nodeId, - UA_Byte *outAccessLevel) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL, - outAccessLevel); -} - -static UA_INLINE UA_StatusCode -UA_Server_readMinimumSamplingInterval(UA_Server *server, const UA_NodeId nodeId, - UA_Double *outMinimumSamplingInterval) { - return __UA_Server_read(server, &nodeId, - UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL, - outMinimumSamplingInterval); -} - -static UA_INLINE UA_StatusCode -UA_Server_readHistorizing(UA_Server *server, const UA_NodeId nodeId, - UA_Boolean *outHistorizing) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_HISTORIZING, - outHistorizing); -} - -static UA_INLINE UA_StatusCode -UA_Server_readExecutable(UA_Server *server, const UA_NodeId nodeId, - UA_Boolean *outExecutable) { - return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_EXECUTABLE, - outExecutable); -} - -/** - * The following node attributes cannot be changed once a node has been created: - * - * - NodeClass - * - NodeId - * - Symmetric - * - ContainsNoLoop - * - * The following attributes cannot be written from the server, as they are - * specific to the different users and set by the access control callback: - * - * - UserWriteMask - * - UserAccessLevel - * - UserExecutable - * - * Historizing is currently unsupported */ - -/* Overwrite an attribute of a node. The specialized functions below provide a - * more concise syntax. - * - * @param server The server object. - * @param value WriteValues contain the NodeId of the target node, the id of the - * attribute to overwritten, the actual value and (optionally) an - * index range to replace parts of an array only. of an array only. - * See the section on NumericRange for the format used for array - * ranges. - * @return Returns a status code. */ -UA_StatusCode UA_EXPORT -UA_Server_write(UA_Server *server, const UA_WriteValue *value); - -/* Don't use this function. There are typed versions with no additional - * overhead. */ -UA_StatusCode UA_EXPORT -__UA_Server_write(UA_Server *server, const UA_NodeId *nodeId, - const UA_AttributeId attributeId, - const UA_DataType *attr_type, const void *attr); - -static UA_INLINE UA_StatusCode -UA_Server_writeBrowseName(UA_Server *server, const UA_NodeId nodeId, - const UA_QualifiedName browseName) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_BROWSENAME, - &UA_TYPES[UA_TYPES_QUALIFIEDNAME], &browseName); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeDisplayName(UA_Server *server, const UA_NodeId nodeId, - const UA_LocalizedText displayName) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &displayName); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeDescription(UA_Server *server, const UA_NodeId nodeId, - const UA_LocalizedText description) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_DESCRIPTION, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &description); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeWriteMask(UA_Server *server, const UA_NodeId nodeId, - const UA_UInt32 writeMask) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_WRITEMASK, - &UA_TYPES[UA_TYPES_UINT32], &writeMask); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeIsAbstract(UA_Server *server, const UA_NodeId nodeId, - const UA_Boolean isAbstract) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_ISABSTRACT, - &UA_TYPES[UA_TYPES_BOOLEAN], &isAbstract); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeInverseName(UA_Server *server, const UA_NodeId nodeId, - const UA_LocalizedText inverseName) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_INVERSENAME, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &inverseName); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeEventNotifier(UA_Server *server, const UA_NodeId nodeId, - const UA_Byte eventNotifier) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER, - &UA_TYPES[UA_TYPES_BYTE], &eventNotifier); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeValue(UA_Server *server, const UA_NodeId nodeId, - const UA_Variant value) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_VALUE, - &UA_TYPES[UA_TYPES_VARIANT], &value); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeDataType(UA_Server *server, const UA_NodeId nodeId, - const UA_NodeId dataType) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_DATATYPE, - &UA_TYPES[UA_TYPES_NODEID], &dataType); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeValueRank(UA_Server *server, const UA_NodeId nodeId, - const UA_Int32 valueRank) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_VALUERANK, - &UA_TYPES[UA_TYPES_INT32], &valueRank); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeArrayDimensions(UA_Server *server, const UA_NodeId nodeId, - const UA_Variant arrayDimensions) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_VALUE, - &UA_TYPES[UA_TYPES_VARIANT], &arrayDimensions); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeAccessLevel(UA_Server *server, const UA_NodeId nodeId, - const UA_Byte accessLevel) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL, - &UA_TYPES[UA_TYPES_BYTE], &accessLevel); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeMinimumSamplingInterval(UA_Server *server, const UA_NodeId nodeId, - const UA_Double miniumSamplingInterval) { - return __UA_Server_write(server, &nodeId, - UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL, - &UA_TYPES[UA_TYPES_DOUBLE], - &miniumSamplingInterval); -} - -static UA_INLINE UA_StatusCode -UA_Server_writeExecutable(UA_Server *server, const UA_NodeId nodeId, - const UA_Boolean executable) { - return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_EXECUTABLE, - &UA_TYPES[UA_TYPES_BOOLEAN], &executable); } - -/** - * Browsing - * -------- */ -UA_BrowseResult UA_EXPORT -UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, - const UA_BrowseDescription *descr); - -UA_BrowseResult UA_EXPORT -UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint, - const UA_ByteString *continuationPoint); - -UA_BrowsePathResult UA_EXPORT -UA_Server_translateBrowsePathToNodeIds(UA_Server *server, - const UA_BrowsePath *browsePath); - -#ifndef HAVE_NODEITER_CALLBACK -#define HAVE_NODEITER_CALLBACK -/* Iterate over all nodes referenced by parentNodeId by calling the callback - * function for each child node (in ifdef because GCC/CLANG handle include order - * differently) */ -typedef UA_StatusCode -(*UA_NodeIteratorCallback)(UA_NodeId childId, UA_Boolean isInverse, - UA_NodeId referenceTypeId, void *handle); -#endif - -UA_StatusCode UA_EXPORT -UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId, - UA_NodeIteratorCallback callback, void *handle); - -#ifdef UA_ENABLE_DISCOVERY - -/** - * Discovery - * --------- */ -/* Register the given server instance at the discovery server. - * This should be called periodically. - * The semaphoreFilePath is optional. If the given file is deleted, - * the server will automatically be unregistered. This could be - * for example a pid file which is deleted if the server crashes. - * - * When the server shuts down you need to call unregister. - * - * @param server - * @param discoveryServerUrl if set to NULL, the default value - * 'opc.tcp://localhost:4840' will be used - * @param semaphoreFilePath optional parameter pointing to semaphore file. */ -UA_StatusCode UA_EXPORT -UA_Server_register_discovery(UA_Server *server, const char* discoveryServerUrl, - const char* semaphoreFilePath); - -/* Unregister the given server instance from the discovery server. - * This should only be called when the server is shutting down. - * @param server - * @param discoveryServerUrl if set to NULL, the default value - * 'opc.tcp://localhost:4840' will be used */ -UA_StatusCode UA_EXPORT -UA_Server_unregister_discovery(UA_Server *server, const char* discoveryServerUrl); - - /* Adds a periodic callback to register the server with the LDS (local discovery server) - * periodically. The interval between each register call is given as second parameter. - * It should be 10 minutes by default (= 10*60*1000). - * - * The delayFirstRegisterMs parameter indicates the delay for the first register call. - * If it is 0, the first register call will be after intervalMs milliseconds, - * otherwise the server's first register will be after delayFirstRegisterMs. - * - * When you manually unregister the server, you also need to cancel the - * periodic callback, otherwise it will be automatically be registered again. - * - * If you call this method multiple times for the same discoveryServerUrl, the older - * periodic callback will be removed. - * - * @param server - * @param discoveryServerUrl if set to NULL, the default value - * 'opc.tcp://localhost:4840' will be used - * @param intervalMs - * @param delayFirstRegisterMs - * @param periodicCallbackId */ -UA_StatusCode UA_EXPORT -UA_Server_addPeriodicServerRegisterCallback(UA_Server *server, const char* discoveryServerUrl, - UA_UInt32 intervalMs, - UA_UInt32 delayFirstRegisterMs, - UA_UInt64 *periodicCallbackId); - -/* Callback for RegisterServer. Data is passed from the register call */ -typedef void (*UA_Server_registerServerCallback)(const UA_RegisteredServer *registeredServer, - void* data); - -/* Set the callback which is called if another server registeres or unregisters - * with this instance. If called multiple times, previous data will be - * overwritten. - * - * @param server - * @param cb the callback - * @param data data passed to the callback - * @return UA_STATUSCODE_SUCCESS on success */ -void UA_EXPORT -UA_Server_setRegisterServerCallback(UA_Server *server, UA_Server_registerServerCallback cb, - void* data); - -#ifdef UA_ENABLE_DISCOVERY_MULTICAST - -/* Callback for server detected through mDNS. Data is passed from the register - * call - * - * @param isServerAnnounce indicates if the server has just been detected. If - * set to false, this means the server is shutting down. - * @param isTxtReceived indicates if we already received the corresponding TXT - * record with the path and caps data */ -typedef void (*UA_Server_serverOnNetworkCallback)(const UA_ServerOnNetwork *serverOnNetwork, - UA_Boolean isServerAnnounce, - UA_Boolean isTxtReceived, void* data); - -/* Set the callback which is called if another server is found through mDNS or - * deleted. It will be called for any mDNS message from the remote server, thus - * it may be called multiple times for the same instance. Also the SRV and TXT - * records may arrive later, therefore for the first call the server - * capabilities may not be set yet. If called multiple times, previous data will - * be overwritten. - * - * @param server - * @param cb the callback - * @param data data passed to the callback - * @return UA_STATUSCODE_SUCCESS on success */ -void UA_EXPORT -UA_Server_setServerOnNetworkCallback(UA_Server *server, - UA_Server_serverOnNetworkCallback cb, - void* data); - -#endif /* UA_ENABLE_DISCOVERY_MULTICAST */ - -#endif /* UA_ENABLE_DISCOVERY */ - -/** - * Information Model Callbacks - * --------------------------- - * - * There are three places where a callback from an information model to - * user-defined code can happen. - * - * - Custom node constructors and destructors - * - Linking VariableNodes with an external data source - * - MethodNode callbacks - * - * .. _node-lifecycle: - * - * Node Lifecycle: Constructors, Destructors and Node Contexts - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * - * To finalize the instantiation of a node, a (user-defined) constructor - * callback is executed. There can be both a global constructor for all nodes - * and node-type constructor specific to the TypeDefinition of the new node - * (attached to an ObjectTypeNode or VariableTypeNode). - * - * In the hierarchy of ObjectTypes and VariableTypes, only the constructor of - * the (lowest) type defined for the new node is executed. Note that every - * Object and Variable can have only one ``isTypeOf`` reference. But type-nodes - * can technically have several ``hasSubType`` references to implement multiple - * inheritance. Issues of (multiple) inheritance in the constructor need to be - * solved by the user. - * - * When a node is destroyed, the node-type destructor is called before the - * global destructor. So the overall node lifecycle is as follows: - * - * 1. Global Constructor (set in the server config) - * 2. Node-Type Constructor (for VariableType or ObjectTypes) - * 3. (Usage-period of the Node) - * 4. Node-Type Destructor - * 5. Global Destructor - * - * The constructor and destructor callbacks can be set to ``NULL`` and are not - * used in that case. If the node-type constructor fails, the global destructor - * will be called before removing the node. The destructors are assumed to never - * fail. - * - * Every node carries a user-context and a constructor-context pointer. The - * user-context is used to attach custom data to a node. But the (user-defined) - * constructors and destructors may replace the user-context pointer if they - * wish to do so. The initial value for the constructor-context is ``NULL``. - * When the ``AddNodes`` service is used over the network, the user-context - * pointer of the new node is also initially set to ``NULL``. */ - -/* To be set in the server config. */ -typedef struct { - /* Can be NULL. May replace the nodeContext */ - UA_StatusCode (*constructor)(UA_Server *server, - const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void **nodeContext); - - /* Can be NULL. The context cannot be replaced since the node is destroyed - * immediately afterwards anyway. */ - void (*destructor)(UA_Server *server, - const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext); -} UA_GlobalNodeLifecycle; - -typedef struct { - /* Can be NULL. May replace the nodeContext */ - UA_StatusCode (*constructor)(UA_Server *server, - const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *typeNodeId, void *typeNodeContext, - const UA_NodeId *nodeId, void **nodeContext); - - /* Can be NULL. May replace the nodeContext. */ - void (*destructor)(UA_Server *server, - const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *typeNodeId, void *typeNodeContext, - const UA_NodeId *nodeId, void **nodeContext); -} UA_NodeTypeLifecycle; - -UA_StatusCode UA_EXPORT -UA_Server_setNodeTypeLifecycle(UA_Server *server, UA_NodeId nodeId, - UA_NodeTypeLifecycle lifecycle); - -UA_StatusCode UA_EXPORT -UA_Server_getNodeContext(UA_Server *server, UA_NodeId nodeId, - void **nodeContext); - -/* Careful! The user has to ensure that the destructor callbacks still work. */ -UA_StatusCode UA_EXPORT -UA_Server_setNodeContext(UA_Server *server, UA_NodeId nodeId, - void *nodeContext); - -/** - * .. _datasource: - * - * Data Source Callback - * ^^^^^^^^^^^^^^^^^^^^ - * - * The server has a unique way of dealing with the content of variables. Instead - * of storing a variant attached to the variable node, the node can point to a - * function with a local data provider. Whenever the value attribute is read, - * the function will be called and asked to provide a UA_DataValue return value - * that contains the value content and additional timestamps. - * - * It is expected that the read callback is implemented. The write callback can - * be set to a null-pointer. */ -typedef struct { - /* Copies the data from the source into the provided value. - * - * !! ZERO-COPY OPERATIONS POSSIBLE !! - * It is not required to return a copy of the actual content data. You can - * return a pointer to memory owned by the user. Memory can be reused - * between read callbacks of a DataSource, as the result is already encoded - * on the network buffer between each read operation. - * - * To use zero-copy reads, set the value of the `value->value` Variant - * without copying, e.g. with `UA_Variant_setScalar`. Then, also set - * `value->value.storageType` to `UA_VARIANT_DATA_NODELETE` to prevent the - * memory being cleaned up. Don't forget to also set `value->hasValue` to - * true to indicate the presence of a value. - * - * @param handle An optional pointer to user-defined data for the - * specific data source - * @param nodeid Id of the read node - * @param includeSourceTimeStamp If true, then the datasource is expected to - * set the source timestamp in the returned value - * @param range If not null, then the datasource shall return only a - * selection of the (nonscalar) data. Set - * UA_STATUSCODE_BADINDEXRANGEINVALID in the value if this does not - * apply. - * @param value The (non-null) DataValue that is returned to the client. The - * data source sets the read data, the result status and optionally a - * sourcetimestamp. - * @return Returns a status code for logging. Error codes intended for the - * original caller are set in the value. If an error is returned, - * then no releasing of the value is done. */ - UA_StatusCode (*read)(UA_Server *server, const UA_NodeId *sessionId, - void *sessionContext, const UA_NodeId *nodeId, - void *nodeContext, UA_Boolean includeSourceTimeStamp, - const UA_NumericRange *range, UA_DataValue *value); - - /* Write into a data source. This method pointer can be NULL if the - * operation is unsupported. - * - * @param handle An optional pointer to user-defined data for the - * specific data source - * @param nodeid Id of the node being written to - * @param data The data to be written into the data source - * @param range An optional data range. If the data source is scalar or does - * not support writing of ranges, then an error code is returned. - * @return Returns a status code that is returned to the user */ - UA_StatusCode (*write)(UA_Server *server, const UA_NodeId *sessionId, - void *sessionContext, const UA_NodeId *nodeId, - void *nodeContext, const UA_NumericRange *range, - const UA_DataValue *value); -} UA_DataSource; - -UA_StatusCode UA_EXPORT -UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId, - const UA_DataSource dataSource); - -/** - * .. _value-callback: - * - * Value Callback - * ^^^^^^^^^^^^^^ - * Value Callbacks can be attached to variable and variable type nodes. If - * not ``NULL``, they are called before reading and after writing respectively. */ -typedef struct { - /* Called before the value attribute is read. It is possible to write into the - * value attribute during onRead (using the write service). The node is - * re-opened afterwards so that changes are considered in the following read - * operation. - * - * @param handle Points to user-provided data for the callback. - * @param nodeid The identifier of the node. - * @param data Points to the current node value. - * @param range Points to the numeric range the client wants to read from - * (or NULL). */ - void (*onRead)(UA_Server *server, const UA_NodeId *sessionId, - void *sessionContext, const UA_NodeId *nodeid, - void *nodeContext, const UA_NumericRange *range, - const UA_DataValue *value); - - /* Called after writing the value attribute. The node is re-opened after - * writing so that the new value is visible in the callback. - * - * @param server The server executing the callback - * @sessionId The identifier of the session - * @sessionContext Additional data attached to the session - * in the access control layer - * @param nodeid The identifier of the node. - * @param nodeUserContext Additional data attached to the node by - * the user. - * @param nodeConstructorContext Additional data attached to the node - * by the type constructor(s). - * @param range Points to the numeric range the client wants to write to (or - * NULL). */ - void (*onWrite)(UA_Server *server, const UA_NodeId *sessionId, - void *sessionContext, const UA_NodeId *nodeId, - void *nodeContext, const UA_NumericRange *range, - const UA_DataValue *data); -} UA_ValueCallback; - -UA_StatusCode UA_EXPORT -UA_Server_setVariableNode_valueCallback(UA_Server *server, - const UA_NodeId nodeId, - const UA_ValueCallback callback); - -/** - * Method Callbacks - * ^^^^^^^^^^^^^^^^ - * Method callbacks are set to `NULL` (not executable) when a method node is added - * over the network. In theory, it is possible to add a callback via - * ``UA_Server_setMethodNode_callback`` within the global constructor when adding - * methods over the network is really wanted. */ - -typedef UA_StatusCode -(*UA_MethodCallback)(UA_Server *server, const UA_NodeId *sessionId, - void *sessionContext, const UA_NodeId *methodId, - void *methodContext, const UA_NodeId *objectId, - void *objectContext, size_t inputSize, - const UA_Variant *input, size_t outputSize, - UA_Variant *output); - -#ifdef UA_ENABLE_METHODCALLS - -UA_StatusCode UA_EXPORT -UA_Server_setMethodNode_callback(UA_Server *server, - const UA_NodeId methodNodeId, - UA_MethodCallback methodCallback); -UA_CallMethodResult UA_EXPORT -UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request); - -#endif - -/** - * .. _addnodes: - * - * Node Addition and Deletion - * -------------------------- - * When creating dynamic node instances at runtime, chances are that you will - * not care about the specific NodeId of the new node, as long as you can - * reference it later. When passing numeric NodeIds with a numeric identifier 0, - * the stack evaluates this as "select a random unassigned numeric NodeId in - * that namespace". To find out which NodeId was actually assigned to the new - * node, you may pass a pointer `outNewNodeId`, which will (after a successful - * node insertion) contain the nodeId of the new node. You may also pass a - * ``NULL`` pointer if this result is not needed. - * - * See the Section :ref:`node-lifecycle` on constructors and on attaching - * user-defined data to nodes. - * - * The methods for node addition and deletion take mostly const arguments that - * are not modified. When creating a node, a deep copy of the node identifier, - * node attributes, etc. is created. Therefore, it is possible to call for - * example ``UA_Server_addVariablenode`` with a value attribute (a - * :ref:`variant`) pointing to a memory location on the stack. If you need - * changes to a variable value to manifest at a specific memory location, please - * use a :ref:`datasource` or a :ref:`value-callback`. */ - -/* Protect against redundant definitions for server/client */ -#ifndef UA_DEFAULT_ATTRIBUTES_DEFINED -#define UA_DEFAULT_ATTRIBUTES_DEFINED -/* The default for variables is "BaseDataType" for the datatype, -2 for the - * valuerank and a read-accesslevel. */ -UA_EXPORT extern const UA_VariableAttributes UA_VariableAttributes_default; -UA_EXPORT extern const UA_VariableTypeAttributes UA_VariableTypeAttributes_default; -/* Methods are executable by default */ -UA_EXPORT extern const UA_MethodAttributes UA_MethodAttributes_default; -/* The remaining attribute definitions are currently all zeroed out */ -UA_EXPORT extern const UA_ObjectAttributes UA_ObjectAttributes_default; -UA_EXPORT extern const UA_ObjectTypeAttributes UA_ObjectTypeAttributes_default; -UA_EXPORT extern const UA_ReferenceTypeAttributes UA_ReferenceTypeAttributes_default; -UA_EXPORT extern const UA_DataTypeAttributes UA_DataTypeAttributes_default; -UA_EXPORT extern const UA_ViewAttributes UA_ViewAttributes_default; -#endif - -/* Don't use this function. There are typed versions as inline functions. */ -UA_StatusCode UA_EXPORT -__UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass, - const UA_NodeId *requestedNewNodeId, - const UA_NodeId *parentNodeId, - const UA_NodeId *referenceTypeId, - const UA_QualifiedName browseName, - const UA_NodeId *typeDefinition, - const UA_NodeAttributes *attr, - const UA_DataType *attributeType, - void *nodeContext, UA_NodeId *outNewNodeId); - -static UA_INLINE UA_StatusCode -UA_Server_addVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_NodeId typeDefinition, - const UA_VariableAttributes attr, - void *nodeContext, UA_NodeId *outNewNodeId) { - return __UA_Server_addNode(server, UA_NODECLASS_VARIABLE, &requestedNewNodeId, - &parentNodeId, &referenceTypeId, browseName, - &typeDefinition, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES], - nodeContext, outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Server_addVariableTypeNode(UA_Server *server, - const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_NodeId typeDefinition, - const UA_VariableTypeAttributes attr, - void *nodeContext, UA_NodeId *outNewNodeId) { - return __UA_Server_addNode(server, UA_NODECLASS_VARIABLETYPE, - &requestedNewNodeId, &parentNodeId, &referenceTypeId, - browseName, &typeDefinition, - (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES], - nodeContext, outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Server_addObjectNode(UA_Server *server, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_NodeId typeDefinition, - const UA_ObjectAttributes attr, - void *nodeContext, UA_NodeId *outNewNodeId) { - return __UA_Server_addNode(server, UA_NODECLASS_OBJECT, &requestedNewNodeId, - &parentNodeId, &referenceTypeId, browseName, - &typeDefinition, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], - nodeContext, outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Server_addObjectTypeNode(UA_Server *server, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_ObjectTypeAttributes attr, - void *nodeContext, UA_NodeId *outNewNodeId) { - return __UA_Server_addNode(server, UA_NODECLASS_OBJECTTYPE, &requestedNewNodeId, - &parentNodeId, &referenceTypeId, browseName, - &UA_NODEID_NULL, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES], - nodeContext, outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Server_addViewNode(UA_Server *server, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_ViewAttributes attr, - void *nodeContext, UA_NodeId *outNewNodeId) { - return __UA_Server_addNode(server, UA_NODECLASS_VIEW, &requestedNewNodeId, - &parentNodeId, &referenceTypeId, browseName, - &UA_NODEID_NULL, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_VIEWATTRIBUTES], - nodeContext, outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Server_addReferenceTypeNode(UA_Server *server, - const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_ReferenceTypeAttributes attr, - void *nodeContext, UA_NodeId *outNewNodeId) { - return __UA_Server_addNode(server, UA_NODECLASS_REFERENCETYPE, - &requestedNewNodeId, &parentNodeId, &referenceTypeId, - browseName, &UA_NODEID_NULL, - (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES], - nodeContext, outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Server_addDataTypeNode(UA_Server *server, - const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_DataTypeAttributes attr, - void *nodeContext, UA_NodeId *outNewNodeId) { - return __UA_Server_addNode(server, UA_NODECLASS_DATATYPE, &requestedNewNodeId, - &parentNodeId, &referenceTypeId, browseName, - &UA_NODEID_NULL, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES], - nodeContext, outNewNodeId); -} - -UA_StatusCode UA_EXPORT -UA_Server_addDataSourceVariableNode(UA_Server *server, - const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_NodeId typeDefinition, - const UA_VariableAttributes attr, - const UA_DataSource dataSource, - void *nodeContext, UA_NodeId *outNewNodeId); - -UA_StatusCode UA_EXPORT -UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_MethodAttributes attr, UA_MethodCallback method, - size_t inputArgumentsSize, const UA_Argument* inputArguments, - size_t outputArgumentsSize, const UA_Argument* outputArguments, - void *nodeContext, UA_NodeId *outNewNodeId); - - -/** - * The method pair UA_Server_addNode_begin and _finish splits the AddNodes - * service in two parts. This is useful if the node shall be modified before - * finish the instantiation. For example to add children with specific NodeIds. - * Otherwise, mandatory children (e.g. of an ObjectType) are added with - * pseudo-random unique NodeIds. Existing children are detected during the - * _finish part via their matching BrowseName. - * - * The _begin method prepares the node and adds it to the nodestore. It may copy - * some unassigned attributes from the TypeDefinition node internally. The - * _finish method adds the references to the parent (and the TypeDefinition if - * applicable), copies mandatory children, performs type-checking of variables - * and calls the node constructor(s) at the end. The _finish method may remove - * the node if it encounters an error. */ - -/* The ``attr`` argument must have a type according to the NodeClass. - * ``VariableAttributes`` for variables, ``ObjectAttributes`` for objects, and - * so on. Missing attributes are taken from the TypeDefinition node if - * applicable. */ -UA_StatusCode UA_EXPORT -UA_Server_addNode_begin(UA_Server *server, const UA_NodeClass nodeClass, - const UA_NodeId requestedNewNodeId, - const UA_QualifiedName browseName, - const UA_NodeId typeDefinition, - const void *attr, const UA_DataType *attributeType, - void *nodeContext, UA_NodeId *outNewNodeId); - -UA_StatusCode UA_EXPORT -UA_Server_addNode_finish(UA_Server *server, const UA_NodeId nodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_NodeId typeDefinitionId); - -/* Deletes a node and optionally all references leading to the node. */ -UA_StatusCode UA_EXPORT -UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId, - UA_Boolean deleteReferences); - -/** - * Reference Management - * -------------------- */ -UA_StatusCode UA_EXPORT -UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId, - const UA_NodeId refTypeId, - const UA_ExpandedNodeId targetId, UA_Boolean isForward); - -UA_StatusCode UA_EXPORT -UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId, - const UA_NodeId referenceTypeId, UA_Boolean isForward, - const UA_ExpandedNodeId targetNodeId, - UA_Boolean deleteBidirectional); - -/** - * Utility Functions - * ----------------- */ -/* Add a new namespace to the server. Returns the index of the new namespace */ -UA_UInt16 UA_EXPORT UA_Server_addNamespace(UA_Server *server, const char* name); - -/** - * Deprecated Server API - * --------------------- - * This file contains outdated API definitions that are kept for backwards - * compatibility. Please switch to the new API, as the following definitions - * will be removed eventually. - * - * UA_Job API - * ^^^^^^^^^^ - * UA_Job was replaced since it unnecessarily exposed server internals to the - * end-user. Please use plain UA_ServerCallbacks instead. The following UA_Job - * definition contains just the fraction of the original struct that was useful - * to end-users. */ - -typedef enum { - UA_JOBTYPE_METHODCALL -} UA_JobType; - -typedef struct { - UA_JobType type; - union { - struct { - void *data; - UA_ServerCallback method; - } methodCall; - } job; -} UA_Job; - -UA_DEPRECATED static UA_INLINE UA_StatusCode -UA_Server_addRepeatedJob(UA_Server *server, UA_Job job, - UA_UInt32 interval, UA_Guid *jobId) { - return UA_Server_addRepeatedCallback(server, job.job.methodCall.method, - job.job.methodCall.data, interval, - (UA_UInt64*)(uintptr_t)jobId); -} - -UA_DEPRECATED static UA_INLINE UA_StatusCode -UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId) { - return UA_Server_removeRepeatedCallback(server, - *(UA_UInt64*)(uintptr_t)&jobId); -} - -#ifdef __cplusplus -} -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_plugin_network.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Forward declarations */ -struct UA_Connection; -typedef struct UA_Connection UA_Connection; - -struct UA_SecureChannel; -typedef struct UA_SecureChannel UA_SecureChannel; - -struct UA_ServerNetworkLayer; -typedef struct UA_ServerNetworkLayer UA_ServerNetworkLayer; - -/** - * .. _networking: - * - * Networking Plugin API - * ===================== - * - * Connection - * ---------- - * Client-server connections are represented by a `UA_Connection`. The - * connection is stateful and stores partially received messages, and so on. In - * addition, the connection contains function pointers to the underlying - * networking implementation. An example for this is the `send` function. So the - * connection encapsulates all the required networking functionality. This lets - * users on embedded (or otherwise exotic) systems implement their own - * networking plugins with a clear interface to the main open62541 library. */ - -typedef struct { - UA_UInt32 protocolVersion; - UA_UInt32 sendBufferSize; - UA_UInt32 recvBufferSize; - UA_UInt32 maxMessageSize; - UA_UInt32 maxChunkCount; -} UA_ConnectionConfig; - -typedef enum { - UA_CONNECTION_OPENING, /* The socket is open, but the HEL/ACK handshake - * is not done */ - UA_CONNECTION_ESTABLISHED, /* The socket is open and the connection - * configured */ - UA_CONNECTION_CLOSED /* The socket has been closed and the connection - * will be deleted */ -} UA_ConnectionState; - -struct UA_Connection { - UA_ConnectionState state; - UA_ConnectionConfig localConf; - UA_ConnectionConfig remoteConf; - UA_SecureChannel *channel; /* The securechannel that is attached to - * this connection */ - UA_Int32 sockfd; /* Most connectivity solutions run on - * sockets. Having the socket id here - * simplifies the design. */ - UA_DateTime openingDate; /* The date the connection was created */ - void *handle; /* A pointer to internal data */ - UA_ByteString incompleteMessage; /* A half-received message (TCP is a - * streaming protocol) is stored here */ - - /* Get a buffer for sending */ - UA_StatusCode (*getSendBuffer)(UA_Connection *connection, size_t length, - UA_ByteString *buf); - - /* Release the send buffer manually */ - void (*releaseSendBuffer)(UA_Connection *connection, UA_ByteString *buf); - - /* Sends a message over the connection. The message buffer is always freed, - * even if sending fails. - * - * @param connection The connection - * @param buf The message buffer - * @return Returns an error code or UA_STATUSCODE_GOOD. */ - UA_StatusCode (*send)(UA_Connection *connection, UA_ByteString *buf); - - /* Receive a message from the remote connection - * - * @param connection The connection - * @param response The response string. It is allocated by the connection - * and needs to be freed with connection->releaseBuffer - * @param timeout Timeout of the recv operation in milliseconds - * @return Returns UA_STATUSCODE_BADCOMMUNICATIONERROR if the recv operation - * can be repeated, UA_STATUSCODE_GOOD if it succeeded and - * UA_STATUSCODE_BADCONNECTIONCLOSED if the connection was - * closed. */ - UA_StatusCode (*recv)(UA_Connection *connection, UA_ByteString *response, - UA_UInt32 timeout); - - /* Release the buffer of a received message */ - void (*releaseRecvBuffer)(UA_Connection *connection, UA_ByteString *buf); - - /* Close the connection. The network layer closes the socket. This is picked - * up during the next 'listen' and the connection is freed in the network - * layer. */ - void (*close)(UA_Connection *connection); - - /* To be called only from within the server (and not the network layer). - * Frees up the connection's memory. */ - void (*free)(UA_Connection *connection); -}; - -/* Cleans up half-received messages, and so on. Called from connection->free. */ -void UA_EXPORT -UA_Connection_deleteMembers(UA_Connection *connection); - -/** - * Server Network Layer - * -------------------- - * The server exposes two functions to interact with remote clients: - * `processBinaryMessage` and `removeConnection`. These functions are called by - * the server network layer. - * - * It is the job of the server network layer to listen on a TCP socket, to - * accept new connections, to call the server with received messages and to - * signal closed connections to the server. - * - * The network layer is part of the server config. So users can provide a custom - * implementation if the provided example does not fit their architecture. The - * network layer is invoked only from the server's main loop. So the network - * layer does not need to be thread-safe. If the networklayer receives a - * positive duration for blocking listening, the server's main loop will block - * until a message is received or the duration times out. */ - -/* Process a binary message (TCP packet). The message can contain partial - * chunks. (TCP is a streaming protocol and packets may be split/merge during - * transport.) After processing, the message is freed with - * connection->releaseRecvBuffer. */ -void UA_EXPORT -UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection, - UA_ByteString *message); - -/* The server internally cleans up the connection and then calls - * connection->free. */ -void UA_EXPORT -UA_Server_removeConnection(UA_Server *server, UA_Connection *connection); - -struct UA_ServerNetworkLayer { - void *handle; /* Internal data */ - UA_String discoveryUrl; - - /* Start listening on the networklayer. - * - * @param nl The network layer - * @return Returns UA_STATUSCODE_GOOD or an error code. */ - UA_StatusCode (*start)(UA_ServerNetworkLayer *nl, const UA_String *customHostname); - - /* Listen for new and closed connections and arriving packets. Calls - * UA_Server_processBinaryMessage for the arriving packets. Closed - * connections are picked up here and forwarded to - * UA_Server_removeConnection where they are cleaned up and freed. - * - * @param nl The network layer - * @param server The server for processing the incoming packets and for - * closing connections. - * @param timeout The timeout during which an event must arrive in - * milliseconds - * @return A statuscode for the status of the network layer. */ - UA_StatusCode (*listen)(UA_ServerNetworkLayer *nl, UA_Server *server, - UA_UInt16 timeout); - - /* Close the network socket and all open connections. Afterwards, the - * network layer can be safely deleted. - * - * @param nl The network layer - * @param server The server that processes the incoming packets and for - * closing connections before deleting them. - * @return A statuscode for the status of the closing operation. */ - void (*stop)(UA_ServerNetworkLayer *nl, UA_Server *server); - - /* Deletes the network layer context. Call only after stopping. */ - void (*deleteMembers)(UA_ServerNetworkLayer *nl); -}; - -/** - * Client Network Layer - * -------------------- - * The client has only a single connection used for sending and receiving binary - * messages. */ - -/* @param localConf the connection config for this client - * @param endpointUrl to where to connect - * @param timeout in ms until the connection try times out if remote not reachable */ -typedef UA_Connection -(*UA_ConnectClientConnection)(UA_ConnectionConfig localConf, const char *endpointUrl, - const UA_UInt32 timeout); - -/** - * Endpoint URL Parser - * ------------------- - * The endpoint URL parser is generally useful for the implementation of network - * layer plugins. */ - -/* Split the given endpoint url into hostname, port and path. All arguments must - * be non-NULL. EndpointUrls have the form "opc.tcp://hostname:port/path", port - * and path may be omitted (together with the prefix colon and slash). - * - * @param endpointUrl The endpoint URL. - * @param outHostname Set to the parsed hostname. The string points into the - * original endpointUrl, so no memory is allocated. If an IPv6 address is - * given, hostname contains e.g. '[2001:0db8:85a3::8a2e:0370:7334]' - * @param outPort Set to the port of the url or left unchanged. - * @param outPath Set to the path if one is present in the endpointUrl. - * Starting or trailing '/' are NOT included in the path. The string - * points into the original endpointUrl, so no memory is allocated. - * @return Returns UA_STATUSCODE_BADTCPENDPOINTURLINVALID if parsing failed. */ -UA_StatusCode UA_EXPORT -UA_parseEndpointUrl(const UA_String *endpointUrl, UA_String *outHostname, - UA_UInt16 *outPort, UA_String *outPath); - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_plugin_log.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** - * Logging Plugin API - * ================== - * - * Servers and clients must define a logger in their configuration. The logger - * is just a function pointer. Every log-message consists of a log-level, a - * log-category and a string message content. The timestamp of the log-message - * is created within the logger. */ - -typedef enum { - UA_LOGLEVEL_TRACE, - UA_LOGLEVEL_DEBUG, - UA_LOGLEVEL_INFO, - UA_LOGLEVEL_WARNING, - UA_LOGLEVEL_ERROR, - UA_LOGLEVEL_FATAL -} UA_LogLevel; - -typedef enum { - UA_LOGCATEGORY_NETWORK, - UA_LOGCATEGORY_SECURECHANNEL, - UA_LOGCATEGORY_SESSION, - UA_LOGCATEGORY_SERVER, - UA_LOGCATEGORY_CLIENT, - UA_LOGCATEGORY_USERLAND, - UA_LOGCATEGORY_SECURITYPOLICY -} UA_LogCategory; - -/** - * The message string and following varargs are formatted according to the rules - * of the printf command. Do not call the logger directly. Instead, make use of - * the convenience macros that take the minimum log-level defined in ua_config.h - * into account. */ - -typedef void (*UA_Logger)(UA_LogLevel level, UA_LogCategory category, - const char *msg, va_list args); - -static UA_INLINE UA_FORMAT(3,4) void -UA_LOG_TRACE(UA_Logger logger, UA_LogCategory category, const char *msg, ...) { -#if UA_LOGLEVEL <= 100 - va_list args; va_start(args, msg); - logger(UA_LOGLEVEL_TRACE, category, msg, args); - va_end(args); -#endif -} - -static UA_INLINE UA_FORMAT(3,4) void -UA_LOG_DEBUG(UA_Logger logger, UA_LogCategory category, const char *msg, ...) { -#if UA_LOGLEVEL <= 200 - va_list args; va_start(args, msg); - logger(UA_LOGLEVEL_DEBUG, category, msg, args); - va_end(args); -#endif -} - -static UA_INLINE UA_FORMAT(3,4) void -UA_LOG_INFO(UA_Logger logger, UA_LogCategory category, const char *msg, ...) { -#if UA_LOGLEVEL <= 300 - va_list args; va_start(args, msg); - logger(UA_LOGLEVEL_INFO, category, msg, args); - va_end(args); -#endif -} - -static UA_INLINE UA_FORMAT(3,4) void -UA_LOG_WARNING(UA_Logger logger, UA_LogCategory category, const char *msg, ...) { -#if UA_LOGLEVEL <= 400 - va_list args; va_start(args, msg); - logger(UA_LOGLEVEL_WARNING, category, msg, args); - va_end(args); -#endif -} - -static UA_INLINE UA_FORMAT(3,4) void -UA_LOG_ERROR(UA_Logger logger, UA_LogCategory category, const char *msg, ...) { -#if UA_LOGLEVEL <= 500 - va_list args; va_start(args, msg); - logger(UA_LOGLEVEL_ERROR, category, msg, args); - va_end(args); -#endif -} - -static UA_INLINE UA_FORMAT(3,4) void -UA_LOG_FATAL(UA_Logger logger, UA_LogCategory category, const char *msg, ...) { -#if UA_LOGLEVEL <= 600 - va_list args; va_start(args, msg); - logger(UA_LOGLEVEL_FATAL, category, msg, args); - va_end(args); -#endif -} - -/** - * Convenience macros for complex types - * ------------------------------------ */ -#define UA_PRINTF_GUID_FORMAT "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" -#define UA_PRINTF_GUID_DATA(GUID) (GUID).data1, (GUID).data2, (GUID).data3, \ - (GUID).data4[0], (GUID).data4[1], (GUID).data4[2], (GUID).data4[3], \ - (GUID).data4[4], (GUID).data4[5], (GUID).data4[6], (GUID).data4[7] - -#define UA_PRINTF_STRING_FORMAT "\"%.*s\"" -#define UA_PRINTF_STRING_DATA(STRING) (int)(STRING).length, (STRING).data - - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_plugin_access_control.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Access Control Plugin API - * ========================= - * The access control callback is used to authenticate sessions and grant access - * rights accordingly. */ - -typedef struct { - /* These booleans are used to create endpoints for the possible - * authentication methods */ - UA_Boolean enableAnonymousLogin; - UA_Boolean enableUsernamePasswordLogin; - - /* Authenticate a session. The session context is attached to the session and - * later passed into the node-based access control callbacks. */ - UA_StatusCode (*activateSession)(const UA_NodeId *sessionId, - const UA_ExtensionObject *userIdentityToken, - void **sessionContext); - - /* Deauthenticate a session and cleanup */ - void (*closeSession)(const UA_NodeId *sessionId, void *sessionContext); - - /* Access control for all nodes*/ - UA_UInt32 (*getUserRightsMask)(const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext); - - /* Additional access control for variable nodes */ - UA_Byte (*getUserAccessLevel)(const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext); - - /* Additional access control for method nodes */ - UA_Boolean (*getUserExecutable)(const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *methodId, void *methodContext); - - /* Additional access control for calling a method node in the context of a - * specific object */ - UA_Boolean (*getUserExecutableOnObject)(const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *methodId, void *methodContext, - const UA_NodeId *objectId, void *objectContext); - - /* Allow adding a node */ - UA_Boolean (*allowAddNode)(const UA_NodeId *sessionId, void *sessionContext, - const UA_AddNodesItem *item); - - /* Allow adding a reference */ - UA_Boolean (*allowAddReference)(const UA_NodeId *sessionId, void *sessionContext, - const UA_AddReferencesItem *item); - - /* Allow deleting a node */ - UA_Boolean (*allowDeleteNode)(const UA_NodeId *sessionId, void *sessionContext, - const UA_DeleteNodesItem *item); - - /* Allow deleting a reference */ - UA_Boolean (*allowDeleteReference)(const UA_NodeId *sessionId, void *sessionContext, - const UA_DeleteReferencesItem *item); -} UA_AccessControl; - -#ifdef __cplusplus -} -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_plugin_securitypolicy.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -extern const UA_ByteString UA_SECURITY_POLICY_NONE_URI; - -struct UA_SecurityPolicy; -typedef struct UA_SecurityPolicy UA_SecurityPolicy; - -typedef struct { - UA_String signatureAlgorithmUri; - - /* Verifies the signature of the message using the provided keys in the context. - * - * @param securityPolicy the securityPolicy the function is invoked on. - * @param channelContext the channelContext that contains the key to verify - * the supplied message with. - * @param message the message to which the signature is supposed to belong. - * @param signature the signature of the message, that should be verified. */ - UA_StatusCode (*verify)(const UA_SecurityPolicy *securityPolicy, - const void *channelContext, const UA_ByteString *message, - const UA_ByteString *signature) UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Signs the given message using this policys signing algorithm and the - * provided keys in the context. - * - * @param securityPolicy the securityPolicy the function is invoked on. - * @param channelContext the channelContext that contains the key to sign - * the supplied message with. - * @param message the message to sign. - * @param signature an output buffer to which the signature is written. The - * buffer needs to be allocated by the caller. The - * necessary size can be acquired with the signatureSize - * attribute of this module. */ - UA_StatusCode (*sign)(const UA_SecurityPolicy *securityPolicy, - const void *channelContext, const UA_ByteString *message, - UA_ByteString *signature) UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Gets the signature size that depends on the local (private) key. - * - * @param securityPolicy the securityPolicy the function is invoked on. - * @param channelContext the channelContext that contains the - * certificate/key. - * @return the size of the local signature. Returns 0 if no local - * certificate was set. */ - size_t (*getLocalSignatureSize)(const UA_SecurityPolicy *securityPolicy, - const void *channelContext); - - /* Gets the signature size that depends on the remote (public) key. - * - * @param securityPolicy the securityPolicy the function is invoked on. - * @param channelContext the context to retrieve data from. - * @return the size of the remote signature. Returns 0 if no - * remote certificate was set previousely. */ - size_t (*getRemoteSignatureSize)(const UA_SecurityPolicy *securityPolicy, - const void *channelContext); - - UA_String encryptionAlgorithmUri; - - /* Encrypt the given data in place using an asymmetric algorithm and keys. - * - * @param securityPolicy the securityPolicy the function is invoked on. - * @param channelContext the channelContext which contains information about - * the keys to encrypt data. - * @param data the data that is encrypted. The encrypted data will overwrite - * the data that was supplied. */ - UA_StatusCode(*encrypt)(const UA_SecurityPolicy *securityPolicy, - const void *channelContext, - UA_ByteString *data) UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Decrypts the given ciphertext in place using an asymmetric algorithm and - * key. - * - * @param securityPolicy the securityPolicy the function is invoked on. - * @param channelContext the channelContext which contains information about - * the keys needed to decrypt the message. - * @param data the data to decrypt. The decryption is done in place. */ - UA_StatusCode(*decrypt)(const UA_SecurityPolicy *securityPolicy, - const void *channelContext, - UA_ByteString *data) UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Returns the length of the key used locally to encrypt messages in bits - * - * @param securityPolicy the securityPolicy the function is invoked on. - * @param channelContext the context to retrieve data from. - * @return the length of the local key. Returns 0 if no - * key length is known. */ - size_t (*getLocalEncryptionKeyLength)(const UA_SecurityPolicy *securityPolicy, - const void *channelContext); - - /* Returns the length of the key used remotely to encrypt messages in bits - * - * @param securityPolicy the securityPolicy the function is invoked on. - * @param channelContext the context to retrieve data from. - * @return the length of the remote key. Returns 0 if no - * key length is known. */ - size_t (*getRemoteEncryptionKeyLength)(const UA_SecurityPolicy *securityPolicy, - const void *channelContext); -} UA_SecurityPolicyCryptoModule; - -typedef struct { - /* Generates a thumbprint for the specified certificate. - * - * @param securityPolicy the securityPolicy the function is invoked on. - * @param certificate the certificate to make a thumbprint of. - * @param thumbprint an output buffer for the resulting thumbprint. Always - * has the length specified in the thumbprintLength in the - * asymmetricModule. */ - UA_StatusCode (*makeCertificateThumbprint)(const UA_SecurityPolicy *securityPolicy, - const UA_ByteString *certificate, - UA_ByteString *thumbprint) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Compares the supplied certificate with the certificate in the endpoit context. - * - * @param securityPolicy the policy data that contains the certificate - * to compare to. - * @param certificateThumbprint the certificate thumbprint to compare to the - * one stored in the context. - * @return if the thumbprints match UA_STATUSCODE_GOOD is returned. If they - * don't match or an error occurred an error code is returned. */ - UA_StatusCode (*compareCertificateThumbprint)(const UA_SecurityPolicy *securityPolicy, - const UA_ByteString *certificateThumbprint) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - UA_SecurityPolicyCryptoModule cryptoModule; -} UA_SecurityPolicyAsymmetricModule; - -typedef struct { - /* Pseudo random function that is used to generate the symmetric keys. - * - * For information on what parameters this function receives in what situation, - * refer to the OPC UA specification 1.03 Part6 Table 33 - * - * @param securityPolicy the securityPolicy the function is invoked on. - * @param secret - * @param seed - * @param out an output to write the data to. The length defines the maximum - * number of output bytes that are produced. */ - UA_StatusCode (*generateKey)(const UA_SecurityPolicy *securityPolicy, - const UA_ByteString *secret, - const UA_ByteString *seed, UA_ByteString *out) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - /* Random generator for generating nonces. - * - * @param securityPolicy the securityPolicy this function is invoked on. - * Example: myPolicy->generateNonce(myPolicy, - * &outBuff); - * @param out pointer to a buffer to store the nonce in. Needs to be - * allocated by the caller. The buffer is filled with random - * data. */ - UA_StatusCode (*generateNonce)(const UA_SecurityPolicy *securityPolicy, - UA_ByteString *out) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - UA_SecurityPolicyCryptoModule cryptoModule; - size_t encryptionBlockSize; - size_t signingKeyLength; -} UA_SecurityPolicySymmetricModule; - -typedef struct { - /* This method creates a new context data object. - * - * The caller needs to call delete on the received object to free allocated - * memory. Memory is only allocated if the function succeeds so there is no - * need to manually free the memory pointed to by *channelContext or to - * call delete in case of failure. - * - * @param securityPolicy the policy context of the endpoint that is connected - * to. It will be stored in the channelContext for - * further access by the policy. - * @param remoteCertificate the remote certificate contains the remote - * asymmetric key. The certificate will be verified - * and then stored in the context so that its - * details may be accessed. - * @param channelContext the initialized channelContext that is passed to - * functions that work on a context. */ - UA_StatusCode (*newContext)(const UA_SecurityPolicy *securityPolicy, - const UA_ByteString *remoteCertificate, - void **channelContext) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Deletes the the security context. */ - void (*deleteContext)(void *channelContext); - - /* Sets the local encrypting key in the supplied context. - * - * @param channelContext the context to work on. - * @param key the local encrypting key to store in the context. */ - UA_StatusCode (*setLocalSymEncryptingKey)(void *channelContext, - const UA_ByteString *key) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Sets the local signing key in the supplied context. - * - * @param channelContext the context to work on. - * @param key the local signing key to store in the context. */ - UA_StatusCode (*setLocalSymSigningKey)(void *channelContext, - const UA_ByteString *key) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Sets the local initialization vector in the supplied context. - * - * @param channelContext the context to work on. - * @param iv the local initialization vector to store in the context. */ - UA_StatusCode (*setLocalSymIv)(void *channelContext, - const UA_ByteString *iv) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Sets the remote encrypting key in the supplied context. - * - * @param channelContext the context to work on. - * @param key the remote encrypting key to store in the context. */ - UA_StatusCode (*setRemoteSymEncryptingKey)(void *channelContext, - const UA_ByteString *key) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Sets the remote signing key in the supplied context. - * - * @param channelContext the context to work on. - * @param key the remote signing key to store in the context. */ - UA_StatusCode (*setRemoteSymSigningKey)(void *channelContext, - const UA_ByteString *key) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Sets the remote initialization vector in the supplied context. - * - * @param channelContext the context to work on. - * @param iv the remote initialization vector to store in the context. */ - UA_StatusCode (*setRemoteSymIv)(void *channelContext, - const UA_ByteString *iv) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Compares the supplied certificate with the certificate in the channel - * context. - * - * @param channelContext the channel context data that contains the - * certificate to compare to. - * @param certificate the certificate to compare to the one stored in the context. - * @return if the certificates match UA_STATUSCODE_GOOD is returned. If they - * don't match or an errror occurred an error code is returned. */ - UA_StatusCode (*compareCertificate)(const void *channelContext, - const UA_ByteString *certificate) - UA_FUNC_ATTR_WARN_UNUSED_RESULT; - - /* Gets the plaintext block size that depends on the remote public key. - * - * @param channelContext the context to retrieve data from. - * @return the size of the plain text block size when encrypting with the - * remote public key. Returns 0 as long as no remote certificate was - * set previousely. */ - size_t (*getRemoteAsymPlainTextBlockSize)(const void *channelContext); - - /* Gets the number of bytes that are needed by the encryption function in - * addition to the length of the plaintext message. This is needed, since - * most RSA encryption methods have their own padding mechanism included. - * This makes the encrypted message larger than the plainText, so we need to - * have enough room in the buffer for the overhead. - * - * @param channelContext the retrieve data from. - * @param maxEncryptionLength the maximum number of bytes that the data to - * encrypt can be. */ - size_t (*getRemoteAsymEncryptionBufferLengthOverhead)(const void *channelContext, - size_t maxEncryptionLength); -} UA_SecurityPolicyChannelModule; - -struct UA_SecurityPolicy { - /* Additional data */ - void *policyContext; - - /* The policy uri that identifies the implemented algorithms */ - UA_ByteString policyUri; - - /* The local certificate is specific for each SecurityPolicy since it - * depends on the used key length. */ - UA_ByteString localCertificate; - - /* Function pointers grouped into modules */ - UA_SecurityPolicyAsymmetricModule asymmetricModule; - UA_SecurityPolicySymmetricModule symmetricModule; - UA_SecurityPolicyChannelModule channelModule; - - UA_Logger logger; - - /* Deletes the dynamic content of the policy */ - void (*deleteMembers)(UA_SecurityPolicy *policy); -}; - -typedef struct { - UA_SecurityPolicy securityPolicy; - UA_EndpointDescription endpointDescription; -} UA_Endpoint; - -#ifdef __cplusplus -} -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_plugin_nodestore.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -/* !!! Warning !!! - * - * If you are not developing a nodestore plugin, then you should not work with - * the definitions from this file directly. The underlying node structures are - * not meant to be used directly by end users. Please use the public server API - * / OPC UA services to interact with the information model. */ - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * .. _information-modelling: - * - * Information Modelling - * ===================== - * - * Information modelling in OPC UA combines concepts from object-orientation and - * semantic modelling. At the core, an OPC UA information model is a graph made - * up of - * - * - Nodes: There are eight possible Node types (variable, object, method, ...) - * - References: Typed and directed relations between two nodes - * - * Every node is identified by a unique (within the server) :ref:`nodeid`. - * Reference are triples of the form ``(source-nodeid, referencetype-nodeid, - * target-nodeid)``. An example reference between nodes is a - * ``hasTypeDefinition`` reference between a Variable and its VariableType. Some - * ReferenceTypes are *hierarchic* and must not form *directed loops*. See the - * section on :ref:`ReferenceTypes ` for more details on - * possible references and their semantics. - * - * **Warning!!** The structures defined in this section are only relevant for - * the developers of custom Nodestores. The interaction with the information - * model is possible only via the OPC UA :ref:`services`. So the following - * sections are purely informational so that users may have a clear mental - * model of the underlying representation. - * - * Base Node Attributes - * -------------------- - * - * Nodes contain attributes according to their node type. The base node - * attributes are common to all node types. In the OPC UA :ref:`services`, - * attributes are referred to via the :ref:`nodeid` of the containing node and - * an integer :ref:`attribute-id`. - * - * Internally, open62541 uses ``UA_Node`` in places where the exact node type is - * not known or not important. The ``nodeClass`` attribute is used to ensure the - * correctness of casting from ``UA_Node`` to a specific node type. */ - -/* List of reference targets with the same reference type and direction */ -typedef struct { - UA_NodeId referenceTypeId; - UA_Boolean isInverse; - size_t targetIdsSize; - UA_ExpandedNodeId *targetIds; -} UA_NodeReferenceKind; - -#define UA_NODE_BASEATTRIBUTES \ - UA_NodeId nodeId; \ - UA_NodeClass nodeClass; \ - UA_QualifiedName browseName; \ - UA_LocalizedText displayName; \ - UA_LocalizedText description; \ - UA_UInt32 writeMask; \ - size_t referencesSize; \ - UA_NodeReferenceKind *references; \ - \ - /* Members specific to open62541 */ \ - void *context; - -typedef struct { - UA_NODE_BASEATTRIBUTES -} UA_Node; - -/** - * VariableNode - * ------------ - * - * Variables store values in a :ref:`datavalue` together with - * metadata for introspection. Most notably, the attributes data type, value - * rank and array dimensions constrain the possible values the variable can take - * on. - * - * Variables come in two flavours: properties and datavariables. Properties are - * related to a parent with a ``hasProperty`` reference and may not have child - * nodes themselves. Datavariables may contain properties (``hasProperty``) and - * also datavariables (``hasComponents``). - * - * All variables are instances of some :ref:`variabletypenode` in return - * constraining the possible data type, value rank and array dimensions - * attributes. - * - * Data Type - * ^^^^^^^^^ - * - * The (scalar) data type of the variable is constrained to be of a specific - * type or one of its children in the type hierarchy. The data type is given as - * a NodeId pointing to a :ref:`datatypenode` in the type hierarchy. See the - * Section :ref:`datatypenode` for more details. - * - * If the data type attribute points to ``UInt32``, then the value attribute - * must be of that exact type since ``UInt32`` does not have children in the - * type hierarchy. If the data type attribute points ``Number``, then the type - * of the value attribute may still be ``UInt32``, but also ``Float`` or - * ``Byte``. - * - * Consistency between the data type attribute in the variable and its - * :ref:`VariableTypeNode` is ensured. - * - * Value Rank - * ^^^^^^^^^^ - * - * This attribute indicates whether the value attribute of the variable is an - * array and how many dimensions the array has. It may have the following - * values: - * - * - ``n >= 1``: the value is an array with the specified number of dimensions - * - ``n = 0``: the value is an array with one or more dimensions - * - ``n = -1``: the value is a scalar - * - ``n = -2``: the value can be a scalar or an array with any number of dimensions - * - ``n = -3``: the value can be a scalar or a one dimensional array - * - * Consistency between the value rank attribute in the variable and its - * :ref:`variabletypenode` is ensured. - * - * Array Dimensions - * ^^^^^^^^^^^^^^^^ - * - * If the value rank permits the value to be a (multi-dimensional) array, the - * exact length in each dimensions can be further constrained with this - * attribute. - * - * - For positive lengths, the variable value is guaranteed to be of the same - * length in this dimension. - * - The dimension length zero is a wildcard and the actual value may have any - * length in this dimension. - * - * Consistency between the array dimensions attribute in the variable and its - * :ref:`variabletypenode` is ensured. */ - -/* Indicates whether a variable contains data inline or whether it points to an - * external data source */ -typedef enum { - UA_VALUESOURCE_DATA, - UA_VALUESOURCE_DATASOURCE -} UA_ValueSource; - -#define UA_NODE_VARIABLEATTRIBUTES \ - /* Constraints on possible values */ \ - UA_NodeId dataType; \ - UA_Int32 valueRank; \ - size_t arrayDimensionsSize; \ - UA_UInt32 *arrayDimensions; \ - \ - /* The current value */ \ - UA_ValueSource valueSource; \ - union { \ - struct { \ - UA_DataValue value; \ - UA_ValueCallback callback; \ - } data; \ - UA_DataSource dataSource; \ - } value; - -typedef struct { - UA_NODE_BASEATTRIBUTES - UA_NODE_VARIABLEATTRIBUTES - UA_Byte accessLevel; - UA_Double minimumSamplingInterval; - UA_Boolean historizing; /* currently unsupported */ -} UA_VariableNode; - -/** - * .. _variabletypenode: - * - * VariableTypeNode - * ---------------- - * - * VariableTypes are used to provide type definitions for variables. - * VariableTypes constrain the data type, value rank and array dimensions - * attributes of variable instances. Furthermore, instantiating from a specific - * variable type may provide semantic information. For example, an instance from - * ``MotorTemperatureVariableType`` is more meaningful than a float variable - * instantiated from ``BaseDataVariable``. */ - -typedef struct { - UA_NODE_BASEATTRIBUTES - UA_NODE_VARIABLEATTRIBUTES - UA_Boolean isAbstract; - - /* Members specific to open62541 */ - UA_NodeTypeLifecycle lifecycle; -} UA_VariableTypeNode; - -/** - * .. _methodnode: - * - * MethodNode - * ---------- - * - * Methods define callable functions and are invoked using the :ref:`Call - * ` service. MethodNodes may have special properties (variable - * childen with a ``hasProperty`` reference) with the :ref:`qualifiedname` ``(0, - * "InputArguments")`` and ``(0, "OutputArguments")``. The input and output - * arguments are both described via an array of ``UA_Argument``. While the Call - * service uses a generic array of :ref:`variant` for input and output, the - * actual argument values are checked to match the signature of the MethodNode. - * - * Note that the same MethodNode may be referenced from several objects (and - * object types). For this, the NodeId of the method *and of the object - * providing context* is part of a Call request message. */ - -typedef struct { - UA_NODE_BASEATTRIBUTES - UA_Boolean executable; - - /* Members specific to open62541 */ - UA_MethodCallback method; -} UA_MethodNode; - -/** - * ObjectNode - * ---------- - * - * Objects are used to represent systems, system components, real-world objects - * and software objects. Objects are instances of an :ref:`object - * type` and may contain variables, methods and further - * objects. */ - -typedef struct { - UA_NODE_BASEATTRIBUTES - UA_Byte eventNotifier; -} UA_ObjectNode; - -/** - * .. _objecttypenode: - * - * ObjectTypeNode - * -------------- - * - * ObjectTypes provide definitions for Objects. Abstract objects cannot be - * instantiated. See :ref:`node-lifecycle` for the use of constructor and - * destructor callbacks. */ - -typedef struct { - UA_NODE_BASEATTRIBUTES - UA_Boolean isAbstract; - - /* Members specific to open62541 */ - UA_NodeTypeLifecycle lifecycle; -} UA_ObjectTypeNode; - -/** - * .. _referencetypenode: - * - * ReferenceTypeNode - * ----------------- - * - * Each reference between two nodes is typed with a ReferenceType that gives - * meaning to the relation. The OPC UA standard defines a set of ReferenceTypes - * as a mandatory part of OPC UA information models. - * - * - Abstract ReferenceTypes cannot be used in actual references and are only - * used to structure the ReferenceTypes hierarchy - * - Symmetric references have the same meaning from the perspective of the - * source and target node - * - * The figure below shows the hierarchy of the standard ReferenceTypes (arrows - * indicate a ``hasSubType`` relation). Refer to Part 3 of the OPC UA - * specification for the full semantics of each ReferenceType. - * - * .. graphviz:: - * - * digraph tree { - * - * node [height=0, shape=box, fillcolor="#E5E5E5", concentrate=true] - * - * references [label="References\n(Abstract, Symmetric)"] - * hierarchical_references [label="HierarchicalReferences\n(Abstract)"] - * references -> hierarchical_references - * - * nonhierarchical_references [label="NonHierarchicalReferences\n(Abstract, Symmetric)"] - * references -> nonhierarchical_references - * - * haschild [label="HasChild\n(Abstract)"] - * hierarchical_references -> haschild - * - * aggregates [label="Aggregates\n(Abstract)"] - * haschild -> aggregates - * - * organizes [label="Organizes"] - * hierarchical_references -> organizes - * - * hascomponent [label="HasComponent"] - * aggregates -> hascomponent - * - * hasorderedcomponent [label="HasOrderedComponent"] - * hascomponent -> hasorderedcomponent - * - * hasproperty [label="HasProperty"] - * aggregates -> hasproperty - * - * hassubtype [label="HasSubtype"] - * haschild -> hassubtype - * - * hasmodellingrule [label="HasModellingRule"] - * nonhierarchical_references -> hasmodellingrule - * - * hastypedefinition [label="HasTypeDefinition"] - * nonhierarchical_references -> hastypedefinition - * - * hasencoding [label="HasEncoding"] - * nonhierarchical_references -> hasencoding - * - * hasdescription [label="HasDescription"] - * nonhierarchical_references -> hasdescription - * - * haseventsource [label="HasEventSource"] - * hierarchical_references -> haseventsource - * - * hasnotifier [label="HasNotifier"] - * hierarchical_references -> hasnotifier - * - * generatesevent [label="GeneratesEvent"] - * nonhierarchical_references -> generatesevent - * - * alwaysgeneratesevent [label="AlwaysGeneratesEvent"] - * generatesevent -> alwaysgeneratesevent - * - * {rank=same hierarchical_references nonhierarchical_references} - * {rank=same generatesevent haseventsource hasmodellingrule - * hasencoding hassubtype} - * {rank=same alwaysgeneratesevent hasproperty} - * - * } - * - * The ReferenceType hierarchy can be extended with user-defined ReferenceTypes. - * Many Companion Specifications for OPC UA define new ReferenceTypes to be used - * in their domain of interest. - * - * For the following example of custom ReferenceTypes, we attempt to model the - * structure of a technical system. For this, we introduce two custom - * ReferenceTypes. First, the hierarchical ``contains`` ReferenceType indicates - * that a system (represented by an OPC UA object) contains a component (or - * subsystem). This gives rise to a tree-structure of containment relations. For - * example, the motor (object) is contained in the car and the crankshaft is - * contained in the motor. Second, the symmetric ``connectedTo`` ReferenceType - * indicates that two components are connected. For example, the motor's - * crankshaft is connected to the gear box. Connections are independent of the - * containment hierarchy and can induce a general graph-structure. Further - * subtypes of ``connectedTo`` could be used to differentiate between physical, - * electrical and information related connections. A client can then learn the - * layout of a (physical) system represented in an OPC UA information model - * based on a common understanding of just two custom reference types. */ - -typedef struct { - UA_NODE_BASEATTRIBUTES - UA_Boolean isAbstract; - UA_Boolean symmetric; - UA_LocalizedText inverseName; -} UA_ReferenceTypeNode; - -/** - * .. _datatypenode: - * - * DataTypeNode - * ------------ - * - * DataTypes represent simple and structured data types. DataTypes may contain - * arrays. But they always describe the structure of a single instance. In - * open62541, DataTypeNodes in the information model hierarchy are matched to - * ``UA_DataType`` type descriptions for :ref:`generic-types` via their NodeId. - * - * Abstract DataTypes (e.g. ``Number``) cannot be the type of actual values. - * They are used to constrain values to possible child DataTypes (e.g. - * ``UInt32``). */ - -typedef struct { - UA_NODE_BASEATTRIBUTES - UA_Boolean isAbstract; -} UA_DataTypeNode; - -/** - * ViewNode - * -------- - * - * Each View defines a subset of the Nodes in the AddressSpace. Views can be - * used when browsing an information model to focus on a subset of nodes and - * references only. ViewNodes can be created and be interacted with. But their - * use in the :ref:`Browse` service is currently unsupported in - * open62541. */ - -typedef struct { - UA_NODE_BASEATTRIBUTES - UA_Byte eventNotifier; - UA_Boolean containsNoLoops; -} UA_ViewNode; - -/** - * Nodestore Plugin API - * -------------------- - * The following definitions are used for implementing custom node storage - * backends. **Most users will want to use the default nodestore and don't need - * to work with the nodestore API**. - * - * Outside of custom nodestore implementations, users should not manually edit - * nodes. Please use the OPC UA services for that. Otherwise, all consistency - * checks are omitted. This can crash the application eventually. */ - -typedef void (*UA_NodestoreVisitor)(void *visitorContext, const UA_Node *node); - -typedef struct { - /* Nodestore context and lifecycle */ - void *context; - void (*deleteNodestore)(void *nodestoreContext); - - /* For non-multithreaded access, some nodestores allow that nodes are edited - * without a copy/replace. This is not possible when the node is only an - * intermediate representation and stored e.g. in a database backend. */ - UA_Boolean inPlaceEditAllowed; - - /* The following definitions are used to create empty nodes of the different - * node types. The memory is managed by the nodestore. Therefore, the node - * has to be removed via a special deleteNode function. (If the new node is - * not added to the nodestore.) */ - UA_Node * (*newNode)(void *nodestoreContext, UA_NodeClass nodeClass); - - void (*deleteNode)(void *nodestoreContext, UA_Node *node); - - /* ``Get`` returns a pointer to an immutable node. ``Release`` indicates - * that the pointer is no longer accessed afterwards. */ - - const UA_Node * (*getNode)(void *nodestoreContext, const UA_NodeId *nodeId); - - void (*releaseNode)(void *nodestoreContext, const UA_Node *node); - - /* Returns an editable copy of a node (needs to be deleted with the - * deleteNode function or inserted / replaced into the nodestore). */ - UA_StatusCode (*getNodeCopy)(void *nodestoreContext, const UA_NodeId *nodeId, - UA_Node **outNode); - - /* Inserts a new node into the nodestore. If the NodeId is zero, then a - * fresh numeric NodeId is assigned. If insertion fails, the node is - * deleted. */ - UA_StatusCode (*insertNode)(void *nodestoreContext, UA_Node *node, - UA_NodeId *addedNodeId); - - /* To replace a node, get an editable copy of the node, edit and replace - * with this function. If the node was already replaced since the copy was - * made, UA_STATUSCODE_BADINTERNALERROR is returned. If the NodeId is not - * found, UA_STATUSCODE_BADNODEIDUNKNOWN is returned. In both error cases, - * the editable node is deleted. */ - UA_StatusCode (*replaceNode)(void *nodestoreContext, UA_Node *node); - - /* Removes a node from the nodestore. */ - UA_StatusCode (*removeNode)(void *nodestoreContext, const UA_NodeId *nodeId); - - /* Execute a callback for every node in the nodestore. */ - void (*iterate)(void *nodestoreContext, void* visitorContext, - UA_NodestoreVisitor visitor); -} UA_Nodestore; - -/** - * The following methods specialize internally for the different node classes - * (distinguished by the nodeClass member) */ - -/* Attributes must be of a matching type (VariableAttributes, ObjectAttributes, - * and so on). The attributes are copied. Note that the attributes structs do - * not contain NodeId, NodeClass and BrowseName. The NodeClass of the node needs - * to be correctly set before calling this method. UA_Node_deleteMembers is - * called on the node when an error occurs internally. */ -UA_StatusCode UA_EXPORT -UA_Node_setAttributes(UA_Node *node, const void *attributes, - const UA_DataType *attributeType); - -/* Reset the destination node and copy the content of the source */ -UA_StatusCode UA_EXPORT -UA_Node_copy(const UA_Node *src, UA_Node *dst); - -/* Allocate new node and copy the values from src */ -UA_EXPORT UA_Node * -UA_Node_copy_alloc(const UA_Node *src); - -/* Add a single reference to the node */ -UA_StatusCode UA_EXPORT -UA_Node_addReference(UA_Node *node, const UA_AddReferencesItem *item); - -/* Delete a single reference from the node */ -UA_StatusCode UA_EXPORT -UA_Node_deleteReference(UA_Node *node, const UA_DeleteReferencesItem *item); - -/* Delete all references of the node */ -void UA_EXPORT -UA_Node_deleteReferences(UA_Node *node); - -/* Remove all malloc'ed members of the node */ -void UA_EXPORT -UA_Node_deleteMembers(UA_Node *node); - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_server_config.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Server Configuration - * ==================== - * The configuration structure is passed to the server during initialization. */ - -typedef struct { - UA_UInt32 min; - UA_UInt32 max; -} UA_UInt32Range; - -typedef struct { - UA_Duration min; - UA_Duration max; -} UA_DurationRange; - -struct UA_ServerConfig { - UA_UInt16 nThreads; /* only if multithreading is enabled */ - UA_Logger logger; - - /* Server Description */ - UA_BuildInfo buildInfo; - UA_ApplicationDescription applicationDescription; - UA_ByteString serverCertificate; -#ifdef UA_ENABLE_DISCOVERY - UA_String mdnsServerName; - size_t serverCapabilitiesSize; - UA_String *serverCapabilities; -#endif - - /* Custom DataTypes */ - size_t customDataTypesSize; - UA_DataType *customDataTypes; - - /* Nodestore */ - UA_Nodestore nodestore; - - /* Networking */ - size_t networkLayersSize; - UA_ServerNetworkLayer *networkLayers; - UA_String customHostname; - - /* Available endpoints */ - size_t endpointsSize; - UA_Endpoint *endpoints; - - /* Global Node Lifecycle */ - UA_GlobalNodeLifecycle nodeLifecycle; - - /* Access Control */ - UA_AccessControl accessControl; - - /* Limits for SecureChannels */ - UA_UInt16 maxSecureChannels; - UA_UInt32 maxSecurityTokenLifetime; /* in ms */ - - /* Limits for Sessions */ - UA_UInt16 maxSessions; - UA_Double maxSessionTimeout; /* in ms */ - - /* Operation limits */ - UA_UInt32 maxNodesPerRead; - UA_UInt32 maxNodesPerWrite; - UA_UInt32 maxNodesPerMethodCall; - UA_UInt32 maxNodesPerBrowse; - UA_UInt32 maxNodesPerRegisterNodes; - UA_UInt32 maxNodesPerTranslateBrowsePathsToNodeIds; - UA_UInt32 maxNodesPerNodeManagement; - UA_UInt32 maxMonitoredItemsPerCall; - - /* Limits for Requests */ - UA_UInt32 maxReferencesPerNode; - - /* Limits for Subscriptions */ - UA_UInt32 maxSubscriptionsPerSession; - UA_DurationRange publishingIntervalLimits; - UA_UInt32Range lifeTimeCountLimits; - UA_UInt32Range keepAliveCountLimits; - UA_UInt32 maxNotificationsPerPublish; - UA_UInt32 maxRetransmissionQueueSize; /* 0 -> unlimited size */ - - /* Limits for MonitoredItems */ - UA_UInt32 maxMonitoredItemsPerSubscription; - UA_DurationRange samplingIntervalLimits; - UA_UInt32Range queueSizeLimits; /* Negotiated with the client */ - - /* Limits for PublishRequests */ - UA_UInt32 maxPublishReqPerSession; - - /* Discovery */ -#ifdef UA_ENABLE_DISCOVERY - /* Timeout in seconds when to automatically remove a registered server from - * the list, if it doesn't re-register within the given time frame. A value - * of 0 disables automatic removal. Default is 60 Minutes (60*60). Must be - * bigger than 10 seconds, because cleanup is only triggered approximately - * ervery 10 seconds. The server will still be removed depending on the - * state of the semaphore file. */ - UA_UInt32 discoveryCleanupTimeout; -#endif -}; - -#ifdef __cplusplus -} -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_client.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * .. _client: - * - * Client - * ====== - * - * The client implementation allows remote access to all OPC UA services. For - * convenience, some functionality has been wrapped in :ref:`high-level - * abstractions `. - * - * **However**: At this time, the client does not yet contain its own thread or - * event-driven main-loop. So the client will not perform any actions - * automatically in the background. This is especially relevant for - * subscriptions. The user will have to periodically call - * `UA_Client_Subscriptions_manuallySendPublishRequest`. See also :ref:`here - * `. - * - * Client Configuration - * -------------------- */ - -typedef struct UA_ClientConfig { - UA_UInt32 timeout; /* Sync response timeout in ms */ - UA_UInt32 secureChannelLifeTime; /* Lifetime in ms (then the channel needs - to be renewed) */ - UA_Logger logger; - UA_ConnectionConfig localConnectionConfig; - UA_ConnectClientConnection connectionFunc; - - /* Custom DataTypes */ - size_t customDataTypesSize; - const UA_DataType *customDataTypes; -} UA_ClientConfig; - -/** - * Client Lifecycle - * ---------------- */ - -typedef enum { - UA_CLIENTSTATE_DISCONNECTED, /* The client is not connected */ - UA_CLIENTSTATE_CONNECTED, /* A TCP connection to the server is open */ - UA_CLIENTSTATE_SECURECHANNEL, /* A SecureChannel to the server is open */ - UA_CLIENTSTATE_SESSION, /* A session with the server is open */ - UA_CLIENTSTATE_SESSION_DISCONNECTED /* A session with the server is open. - * But the SecureChannel was lost. Try - * to establish a new SecureChannel and - * reattach the existing session. */ -} UA_ClientState; - -struct UA_Client; -typedef struct UA_Client UA_Client; - -/* Create a new client */ -UA_Client UA_EXPORT * -UA_Client_new(UA_ClientConfig config); - -/* Get the client connection status */ -UA_ClientState UA_EXPORT -UA_Client_getState(UA_Client *client); - -/* Reset a client */ -void UA_EXPORT -UA_Client_reset(UA_Client *client); - -/* Delete a client */ -void UA_EXPORT -UA_Client_delete(UA_Client *client); - -/** - * Connect to a Server - * ------------------- */ - -/* Connect to the server - * - * @param client to use - * @param endpointURL to connect (for example "opc.tcp://localhost:16664") - * @return Indicates whether the operation succeeded or returns an error code */ -UA_StatusCode UA_EXPORT -UA_Client_connect(UA_Client *client, const char *endpointUrl); - -/* Connect to the selected server with the given username and password - * - * @param client to use - * @param endpointURL to connect (for example "opc.tcp://localhost:16664") - * @param username - * @param password - * @return Indicates whether the operation succeeded or returns an error code */ -UA_StatusCode UA_EXPORT -UA_Client_connect_username(UA_Client *client, const char *endpointUrl, - const char *username, const char *password); - -/* Disconnect and close a connection to the selected server */ -UA_StatusCode UA_EXPORT -UA_Client_disconnect(UA_Client *client); - -/* Close a connection to the selected server */ -UA_StatusCode UA_EXPORT -UA_Client_close(UA_Client *client); - -/* Renew the underlying secure channel */ -UA_StatusCode UA_EXPORT -UA_Client_manuallyRenewSecureChannel(UA_Client *client); - -/** - * Discovery - * --------- */ - -/* Gets a list of endpoints of a server - * - * @param client to use. Must be connected to the same endpoint given in - * serverUrl or otherwise in disconnected state. - * @param serverUrl url to connect (for example "opc.tcp://localhost:16664") - * @param endpointDescriptionsSize size of the array of endpoint descriptions - * @param endpointDescriptions array of endpoint descriptions that is allocated - * by the function (you need to free manually) - * @return Indicates whether the operation succeeded or returns an error code */ -UA_StatusCode UA_EXPORT -UA_Client_getEndpoints(UA_Client *client, const char *serverUrl, - size_t* endpointDescriptionsSize, - UA_EndpointDescription** endpointDescriptions); - -/* Gets a list of all registered servers at the given server. - * - * You can pass an optional filter for serverUris. If the given server is not registered, - * an empty array will be returned. If the server is registered, only that application - * description will be returned. - * - * Additionally you can optionally indicate which locale you want for the server name - * in the returned application description. The array indicates the order of preference. - * A server may have localized names. - * - * @param client to use. Must be connected to the same endpoint given in - * serverUrl or otherwise in disconnected state. - * @param serverUrl url to connect (for example "opc.tcp://localhost:16664") - * @param serverUrisSize Optional filter for specific server uris - * @param serverUris Optional filter for specific server uris - * @param localeIdsSize Optional indication which locale you prefer - * @param localeIds Optional indication which locale you prefer - * @param registeredServersSize size of returned array, i.e., number of found/registered servers - * @param registeredServers array containing found/registered servers - * @return Indicates whether the operation succeeded or returns an error code */ -UA_StatusCode UA_EXPORT -UA_Client_findServers(UA_Client *client, const char *serverUrl, - size_t serverUrisSize, UA_String *serverUris, - size_t localeIdsSize, UA_String *localeIds, - size_t *registeredServersSize, - UA_ApplicationDescription **registeredServers); - -/* Get a list of all known server in the network. Only supported by LDS servers. - * - * @param client to use. Must be connected to the same endpoint given in - * serverUrl or otherwise in disconnected state. - * @param serverUrl url to connect (for example "opc.tcp://localhost:16664") - * @param startingRecordId optional. Only return the records with an ID higher - * or equal the given. Can be used for pagination to only get a subset of - * the full list - * @param maxRecordsToReturn optional. Only return this number of records - - * @param serverCapabilityFilterSize optional. Filter the returned list to only - * get servers with given capabilities, e.g. "LDS" - * @param serverCapabilityFilter optional. Filter the returned list to only get - * servers with given capabilities, e.g. "LDS" - * @param serverOnNetworkSize size of returned array, i.e., number of - * known/registered servers - * @param serverOnNetwork array containing known/registered servers - * @return Indicates whether the operation succeeded or returns an error code */ -UA_StatusCode UA_EXPORT -UA_Client_findServersOnNetwork(UA_Client *client, const char *serverUrl, - UA_UInt32 startingRecordId, UA_UInt32 maxRecordsToReturn, - size_t serverCapabilityFilterSize, UA_String *serverCapabilityFilter, - size_t *serverOnNetworkSize, UA_ServerOnNetwork **serverOnNetwork); - -/** - * .. _client-services: - * - * Services - * -------- - * The raw OPC UA services are exposed to the client. But most of them time, it - * is better to use the convenience functions from ``ua_client_highlevel.h`` - * that wrap the raw services. */ -/* Don't use this function. Use the type versions below instead. */ -void UA_EXPORT -__UA_Client_Service(UA_Client *client, const void *request, - const UA_DataType *requestType, void *response, - const UA_DataType *responseType); - -/** - * Attribute Service Set - * ^^^^^^^^^^^^^^^^^^^^^ */ -static UA_INLINE UA_ReadResponse -UA_Client_Service_read(UA_Client *client, const UA_ReadRequest request) { - UA_ReadResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_READREQUEST], - &response, &UA_TYPES[UA_TYPES_READRESPONSE]); - return response; -} - -static UA_INLINE UA_WriteResponse -UA_Client_Service_write(UA_Client *client, const UA_WriteRequest request) { - UA_WriteResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_WRITEREQUEST], - &response, &UA_TYPES[UA_TYPES_WRITERESPONSE]); - return response; -} - -/** - * Method Service Set - * ^^^^^^^^^^^^^^^^^^ */ -#ifdef UA_ENABLE_METHODCALLS -static UA_INLINE UA_CallResponse -UA_Client_Service_call(UA_Client *client, const UA_CallRequest request) { - UA_CallResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_CALLREQUEST], - &response, &UA_TYPES[UA_TYPES_CALLRESPONSE]); - return response; -} -#endif - -/** - * NodeManagement Service Set - * ^^^^^^^^^^^^^^^^^^^^^^^^^^ */ -static UA_INLINE UA_AddNodesResponse -UA_Client_Service_addNodes(UA_Client *client, const UA_AddNodesRequest request) { - UA_AddNodesResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_ADDNODESREQUEST], - &response, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]); - return response; -} - -static UA_INLINE UA_AddReferencesResponse -UA_Client_Service_addReferences(UA_Client *client, - const UA_AddReferencesRequest request) { - UA_AddReferencesResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST], - &response, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE]); - return response; -} - -static UA_INLINE UA_DeleteNodesResponse -UA_Client_Service_deleteNodes(UA_Client *client, - const UA_DeleteNodesRequest request) { - UA_DeleteNodesResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_DELETENODESREQUEST], - &response, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]); - return response; -} - -static UA_INLINE UA_DeleteReferencesResponse -UA_Client_Service_deleteReferences(UA_Client *client, - const UA_DeleteReferencesRequest request) { - UA_DeleteReferencesResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST], - &response, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE]); - return response; -} - -/** - * View Service Set - * ^^^^^^^^^^^^^^^^ */ -static UA_INLINE UA_BrowseResponse -UA_Client_Service_browse(UA_Client *client, const UA_BrowseRequest request) { - UA_BrowseResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_BROWSEREQUEST], - &response, &UA_TYPES[UA_TYPES_BROWSERESPONSE]); - return response; -} - -static UA_INLINE UA_BrowseNextResponse -UA_Client_Service_browseNext(UA_Client *client, - const UA_BrowseNextRequest request) { - UA_BrowseNextResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST], - &response, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]); - return response; -} - -static UA_INLINE UA_TranslateBrowsePathsToNodeIdsResponse -UA_Client_Service_translateBrowsePathsToNodeIds(UA_Client *client, - const UA_TranslateBrowsePathsToNodeIdsRequest request) { - UA_TranslateBrowsePathsToNodeIdsResponse response; - __UA_Client_Service(client, &request, - &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST], - &response, - &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE]); - return response; -} - -static UA_INLINE UA_RegisterNodesResponse -UA_Client_Service_registerNodes(UA_Client *client, - const UA_RegisterNodesRequest request) { - UA_RegisterNodesResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST], - &response, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]); - return response; -} - -static UA_INLINE UA_UnregisterNodesResponse -UA_Client_Service_unregisterNodes(UA_Client *client, - const UA_UnregisterNodesRequest request) { - UA_UnregisterNodesResponse response; - __UA_Client_Service(client, &request, - &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST], - &response, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]); - return response; -} - -/** - * Query Service Set - * ^^^^^^^^^^^^^^^^^ */ -static UA_INLINE UA_QueryFirstResponse -UA_Client_Service_queryFirst(UA_Client *client, - const UA_QueryFirstRequest request) { - UA_QueryFirstResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST], - &response, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]); - return response; -} - -static UA_INLINE UA_QueryNextResponse -UA_Client_Service_queryNext(UA_Client *client, - const UA_QueryNextRequest request) { - UA_QueryNextResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST], - &response, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]); - return response; -} - -#ifdef UA_ENABLE_SUBSCRIPTIONS - -/** - * MonitoredItem Service Set - * ^^^^^^^^^^^^^^^^^^^^^^^^^ */ -static UA_INLINE UA_CreateMonitoredItemsResponse -UA_Client_Service_createMonitoredItems(UA_Client *client, - const UA_CreateMonitoredItemsRequest request) { - UA_CreateMonitoredItemsResponse response; - __UA_Client_Service(client, &request, - &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST], &response, - &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE]); - return response; -} - -static UA_INLINE UA_DeleteMonitoredItemsResponse -UA_Client_Service_deleteMonitoredItems(UA_Client *client, - const UA_DeleteMonitoredItemsRequest request) { - UA_DeleteMonitoredItemsResponse response; - __UA_Client_Service(client, &request, - &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST], &response, - &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE]); - return response; -} - -/** - * Subscription Service Set - * ^^^^^^^^^^^^^^^^^^^^^^^^ */ -static UA_INLINE UA_CreateSubscriptionResponse -UA_Client_Service_createSubscription(UA_Client *client, - const UA_CreateSubscriptionRequest request) { - UA_CreateSubscriptionResponse response; - __UA_Client_Service(client, &request, - &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST], &response, - &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]); - return response; -} - -static UA_INLINE UA_ModifySubscriptionResponse -UA_Client_Service_modifySubscription(UA_Client *client, - const UA_ModifySubscriptionRequest request) { - UA_ModifySubscriptionResponse response; - __UA_Client_Service(client, &request, - &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST], &response, - &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]); - return response; -} - -static UA_INLINE UA_DeleteSubscriptionsResponse -UA_Client_Service_deleteSubscriptions(UA_Client *client, - const UA_DeleteSubscriptionsRequest request) { - UA_DeleteSubscriptionsResponse response; - __UA_Client_Service(client, &request, - &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST], &response, - &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE]); - return response; -} - -static UA_INLINE UA_PublishResponse -UA_Client_Service_publish(UA_Client *client, const UA_PublishRequest request) { - UA_PublishResponse response; - __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_PUBLISHREQUEST], - &response, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]); - return response; -} - -#endif - -/** - * .. _client-async-services: - * - * Asynchronous Services - * --------------------- - * All OPC UA services are asynchronous in nature. So several service calls can - * be made without waiting for a response first. Responess may come in a - * different ordering. */ - -typedef void -(*UA_ClientAsyncServiceCallback)(UA_Client *client, void *userdata, - UA_UInt32 requestId, const void *response); - -/* Don't use this function. Use the type versions below instead. */ -UA_StatusCode UA_EXPORT -__UA_Client_AsyncService(UA_Client *client, const void *request, - const UA_DataType *requestType, - UA_ClientAsyncServiceCallback callback, - const UA_DataType *responseType, - void *userdata, UA_UInt32 *requestId); - -UA_StatusCode UA_EXPORT -UA_Client_runAsync(UA_Client *client, UA_UInt16 timeout); - -/** - * .. toctree:: - * - * client_highlevel */ - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/include/ua_client_highlevel.h" ***********************************/ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * .. _client-highlevel: - * - * Highlevel Client Functionality - * ------------------------------ - * - * The following definitions are convenience functions making use of the - * standard OPC UA services in the background. This is a less flexible way of - * handling the stack, because at many places sensible defaults are presumed; at - * the same time using these functions is the easiest way of implementing an OPC - * UA application, as you will not have to consider all the details that go into - * the OPC UA services. If more flexibility is needed, you can always achieve - * the same functionality using the raw :ref:`OPC UA services - * `. - * - * Read Attributes - * ^^^^^^^^^^^^^^^ - * The following functions can be used to retrieve a single node attribute. Use - * the regular service to read several attributes at once. */ - -/* Don't call this function, use the typed versions */ -UA_StatusCode UA_EXPORT -__UA_Client_readAttribute(UA_Client *client, const UA_NodeId *nodeId, - UA_AttributeId attributeId, void *out, - const UA_DataType *outDataType); - -static UA_INLINE UA_StatusCode -UA_Client_readNodeIdAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_NodeId *outNodeId) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_NODEID, - outNodeId, &UA_TYPES[UA_TYPES_NODEID]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readNodeClassAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_NodeClass *outNodeClass) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_NODECLASS, - outNodeClass, &UA_TYPES[UA_TYPES_NODECLASS]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readBrowseNameAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_QualifiedName *outBrowseName) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_BROWSENAME, - outBrowseName, - &UA_TYPES[UA_TYPES_QUALIFIEDNAME]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readDisplayNameAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_LocalizedText *outDisplayName) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME, - outDisplayName, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readDescriptionAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_LocalizedText *outDescription) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_DESCRIPTION, - outDescription, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_UInt32 *outWriteMask) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_WRITEMASK, - outWriteMask, &UA_TYPES[UA_TYPES_UINT32]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readUserWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_UInt32 *outUserWriteMask) { - return __UA_Client_readAttribute(client, &nodeId, - UA_ATTRIBUTEID_USERWRITEMASK, - outUserWriteMask, - &UA_TYPES[UA_TYPES_UINT32]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readIsAbstractAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Boolean *outIsAbstract) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_ISABSTRACT, - outIsAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readSymmetricAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Boolean *outSymmetric) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_SYMMETRIC, - outSymmetric, &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readInverseNameAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_LocalizedText *outInverseName) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_INVERSENAME, - outInverseName, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readContainsNoLoopsAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Boolean *outContainsNoLoops) { - return __UA_Client_readAttribute(client, &nodeId, - UA_ATTRIBUTEID_CONTAINSNOLOOPS, - outContainsNoLoops, - &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readEventNotifierAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Byte *outEventNotifier) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER, - outEventNotifier, &UA_TYPES[UA_TYPES_BYTE]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readValueAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Variant *outValue) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUE, - outValue, &UA_TYPES[UA_TYPES_VARIANT]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readDataTypeAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_NodeId *outDataType) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_DATATYPE, - outDataType, &UA_TYPES[UA_TYPES_NODEID]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readValueRankAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Int32 *outValueRank) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUERANK, - outValueRank, &UA_TYPES[UA_TYPES_INT32]); -} - -UA_StatusCode UA_EXPORT -UA_Client_readArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, - size_t *outArrayDimensionsSize, - UA_UInt32 **outArrayDimensions); - -static UA_INLINE UA_StatusCode -UA_Client_readAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Byte *outAccessLevel) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL, - outAccessLevel, &UA_TYPES[UA_TYPES_BYTE]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readUserAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Byte *outUserAccessLevel) { - return __UA_Client_readAttribute(client, &nodeId, - UA_ATTRIBUTEID_USERACCESSLEVEL, - outUserAccessLevel, - &UA_TYPES[UA_TYPES_BYTE]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readMinimumSamplingIntervalAttribute(UA_Client *client, - const UA_NodeId nodeId, - UA_Double *outMinSamplingInterval) { - return __UA_Client_readAttribute(client, &nodeId, - UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL, - outMinSamplingInterval, - &UA_TYPES[UA_TYPES_DOUBLE]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readHistorizingAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Boolean *outHistorizing) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_HISTORIZING, - outHistorizing, &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readExecutableAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Boolean *outExecutable) { - return __UA_Client_readAttribute(client, &nodeId, UA_ATTRIBUTEID_EXECUTABLE, - outExecutable, &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Client_readUserExecutableAttribute(UA_Client *client, const UA_NodeId nodeId, - UA_Boolean *outUserExecutable) { - return __UA_Client_readAttribute(client, &nodeId, - UA_ATTRIBUTEID_USEREXECUTABLE, - outUserExecutable, - &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -/** - * Write Attributes - * ^^^^^^^^^^^^^^^^ - * - * The following functions can be use to write a single node attribute at a - * time. Use the regular write service to write several attributes at once. */ -/* Don't call this function, use the typed versions */ -UA_StatusCode UA_EXPORT -__UA_Client_writeAttribute(UA_Client *client, const UA_NodeId *nodeId, - UA_AttributeId attributeId, const void *in, - const UA_DataType *inDataType); - -static UA_INLINE UA_StatusCode -UA_Client_writeNodeIdAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_NodeId *newNodeId) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_NODEID, - newNodeId, &UA_TYPES[UA_TYPES_NODEID]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeNodeClassAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_NodeClass *newNodeClass) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_NODECLASS, - newNodeClass, &UA_TYPES[UA_TYPES_NODECLASS]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeBrowseNameAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_QualifiedName *newBrowseName) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_BROWSENAME, - newBrowseName, - &UA_TYPES[UA_TYPES_QUALIFIEDNAME]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeDisplayNameAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_LocalizedText *newDisplayName) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME, - newDisplayName, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeDescriptionAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_LocalizedText *newDescription) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_DESCRIPTION, - newDescription, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_UInt32 *newWriteMask) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_WRITEMASK, - newWriteMask, &UA_TYPES[UA_TYPES_UINT32]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeUserWriteMaskAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_UInt32 *newUserWriteMask) { - return __UA_Client_writeAttribute(client, &nodeId, - UA_ATTRIBUTEID_USERWRITEMASK, - newUserWriteMask, - &UA_TYPES[UA_TYPES_UINT32]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeIsAbstractAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Boolean *newIsAbstract) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_ISABSTRACT, - newIsAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeSymmetricAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Boolean *newSymmetric) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_SYMMETRIC, - newSymmetric, &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeInverseNameAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_LocalizedText *newInverseName) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_INVERSENAME, - newInverseName, - &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeContainsNoLoopsAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Boolean *newContainsNoLoops) { - return __UA_Client_writeAttribute(client, &nodeId, - UA_ATTRIBUTEID_CONTAINSNOLOOPS, - newContainsNoLoops, - &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeEventNotifierAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Byte *newEventNotifier) { - return __UA_Client_writeAttribute(client, &nodeId, - UA_ATTRIBUTEID_EVENTNOTIFIER, - newEventNotifier, - &UA_TYPES[UA_TYPES_BYTE]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeValueAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Variant *newValue) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUE, - newValue, &UA_TYPES[UA_TYPES_VARIANT]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeDataTypeAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_NodeId *newDataType) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_DATATYPE, - newDataType, &UA_TYPES[UA_TYPES_NODEID]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeValueRankAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Int32 *newValueRank) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_VALUERANK, - newValueRank, &UA_TYPES[UA_TYPES_INT32]); -} - -UA_StatusCode UA_EXPORT -UA_Client_writeArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, - size_t newArrayDimensionsSize, - const UA_UInt32 *newArrayDimensions); - -static UA_INLINE UA_StatusCode -UA_Client_writeAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Byte *newAccessLevel) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL, - newAccessLevel, &UA_TYPES[UA_TYPES_BYTE]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeUserAccessLevelAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Byte *newUserAccessLevel) { - return __UA_Client_writeAttribute(client, &nodeId, - UA_ATTRIBUTEID_USERACCESSLEVEL, - newUserAccessLevel, - &UA_TYPES[UA_TYPES_BYTE]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeMinimumSamplingIntervalAttribute(UA_Client *client, - const UA_NodeId nodeId, - const UA_Double *newMinInterval) { - return __UA_Client_writeAttribute(client, &nodeId, - UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL, - newMinInterval, &UA_TYPES[UA_TYPES_DOUBLE]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeHistorizingAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Boolean *newHistorizing) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_HISTORIZING, - newHistorizing, &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeExecutableAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Boolean *newExecutable) { - return __UA_Client_writeAttribute(client, &nodeId, UA_ATTRIBUTEID_EXECUTABLE, - newExecutable, &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -static UA_INLINE UA_StatusCode -UA_Client_writeUserExecutableAttribute(UA_Client *client, const UA_NodeId nodeId, - const UA_Boolean *newUserExecutable) { - return __UA_Client_writeAttribute(client, &nodeId, - UA_ATTRIBUTEID_USEREXECUTABLE, - newUserExecutable, - &UA_TYPES[UA_TYPES_BOOLEAN]); -} - -/** - * Method Calling - * ^^^^^^^^^^^^^^ */ -UA_StatusCode UA_EXPORT -UA_Client_call(UA_Client *client, const UA_NodeId objectId, - const UA_NodeId methodId, size_t inputSize, const UA_Variant *input, - size_t *outputSize, UA_Variant **output); - -/** - * Node Management - * ^^^^^^^^^^^^^^^ - * See the section on :ref:`server-side node management `. */ -UA_StatusCode UA_EXPORT -UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId, - const UA_NodeId referenceTypeId, UA_Boolean isForward, - const UA_String targetServerUri, - const UA_ExpandedNodeId targetNodeId, - UA_NodeClass targetNodeClass); - -UA_StatusCode UA_EXPORT -UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId, - const UA_NodeId referenceTypeId, UA_Boolean isForward, - const UA_ExpandedNodeId targetNodeId, - UA_Boolean deleteBidirectional); - -UA_StatusCode UA_EXPORT -UA_Client_deleteNode(UA_Client *client, const UA_NodeId nodeId, - UA_Boolean deleteTargetReferences); - -/* Protect against redundant definitions for server/client */ -#ifndef UA_DEFAULT_ATTRIBUTES_DEFINED -#define UA_DEFAULT_ATTRIBUTES_DEFINED -/* The default for variables is "BaseDataType" for the datatype, -2 for the - * valuerank and a read-accesslevel. */ -UA_EXPORT extern const UA_VariableAttributes UA_VariableAttributes_default; -UA_EXPORT extern const UA_VariableTypeAttributes UA_VariableTypeAttributes_default; -/* Methods are executable by default */ -UA_EXPORT extern const UA_MethodAttributes UA_MethodAttributes_default; -/* The remaining attribute definitions are currently all zeroed out */ -UA_EXPORT extern const UA_ObjectAttributes UA_ObjectAttributes_default; -UA_EXPORT extern const UA_ObjectTypeAttributes UA_ObjectTypeAttributes_default; -UA_EXPORT extern const UA_ReferenceTypeAttributes UA_ReferenceTypeAttributes_default; -UA_EXPORT extern const UA_DataTypeAttributes UA_DataTypeAttributes_default; -UA_EXPORT extern const UA_ViewAttributes UA_ViewAttributes_default; -#endif - -/* Don't call this function, use the typed versions */ -UA_StatusCode UA_EXPORT -__UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass, - const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_NodeId typeDefinition, const UA_NodeAttributes *attr, - const UA_DataType *attributeType, UA_NodeId *outNewNodeId); - -static UA_INLINE UA_StatusCode -UA_Client_addVariableNode(UA_Client *client, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_NodeId typeDefinition, - const UA_VariableAttributes attr, - UA_NodeId *outNewNodeId) { - return __UA_Client_addNode(client, UA_NODECLASS_VARIABLE, requestedNewNodeId, - parentNodeId, referenceTypeId, browseName, - typeDefinition, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES], - outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Client_addVariableTypeNode(UA_Client *client, - const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_VariableTypeAttributes attr, - UA_NodeId *outNewNodeId) { - return __UA_Client_addNode(client, UA_NODECLASS_VARIABLETYPE, - requestedNewNodeId, - parentNodeId, referenceTypeId, browseName, - UA_NODEID_NULL, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES], - outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Client_addObjectNode(UA_Client *client, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_NodeId typeDefinition, - const UA_ObjectAttributes attr, UA_NodeId *outNewNodeId) { - return __UA_Client_addNode(client, UA_NODECLASS_OBJECT, requestedNewNodeId, - parentNodeId, referenceTypeId, browseName, - typeDefinition, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Client_addObjectTypeNode(UA_Client *client, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_ObjectTypeAttributes attr, - UA_NodeId *outNewNodeId) { - return __UA_Client_addNode(client, UA_NODECLASS_OBJECTTYPE, requestedNewNodeId, - parentNodeId, referenceTypeId, browseName, - UA_NODEID_NULL, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES], - outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Client_addViewNode(UA_Client *client, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_ViewAttributes attr, - UA_NodeId *outNewNodeId) { - return __UA_Client_addNode(client, UA_NODECLASS_VIEW, requestedNewNodeId, - parentNodeId, referenceTypeId, browseName, - UA_NODEID_NULL, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_VIEWATTRIBUTES], outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Client_addReferenceTypeNode(UA_Client *client, - const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_ReferenceTypeAttributes attr, - UA_NodeId *outNewNodeId) { - return __UA_Client_addNode(client, UA_NODECLASS_REFERENCETYPE, - requestedNewNodeId, - parentNodeId, referenceTypeId, browseName, - UA_NODEID_NULL, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES], - outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Client_addDataTypeNode(UA_Client *client, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_DataTypeAttributes attr, - UA_NodeId *outNewNodeId) { - return __UA_Client_addNode(client, UA_NODECLASS_DATATYPE, requestedNewNodeId, - parentNodeId, referenceTypeId, browseName, - UA_NODEID_NULL, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES], - outNewNodeId); -} - -static UA_INLINE UA_StatusCode -UA_Client_addMethodNode(UA_Client *client, const UA_NodeId requestedNewNodeId, - const UA_NodeId parentNodeId, - const UA_NodeId referenceTypeId, - const UA_QualifiedName browseName, - const UA_MethodAttributes attr, - UA_NodeId *outNewNodeId) { - return __UA_Client_addNode(client, UA_NODECLASS_METHOD, requestedNewNodeId, - parentNodeId, referenceTypeId, browseName, - UA_NODEID_NULL, (const UA_NodeAttributes*)&attr, - &UA_TYPES[UA_TYPES_METHODATTRIBUTES], outNewNodeId); -} - -/** - * .. _client-subscriptions: - * - * Subscriptions Handling - * ^^^^^^^^^^^^^^^^^^^^^^ - * At this time, the client does not yet contain its own thread or event-driven - * main-loop. So the client will not perform any actions automatically in the - * background. This is especially relevant for subscriptions. The user will have - * to periodically call `UA_Client_Subscriptions_manuallySendPublishRequest`. - * See also :ref:`here `. */ -#ifdef UA_ENABLE_SUBSCRIPTIONS - -typedef struct { - UA_Double requestedPublishingInterval; - UA_UInt32 requestedLifetimeCount; - UA_UInt32 requestedMaxKeepAliveCount; - UA_UInt32 maxNotificationsPerPublish; - UA_Boolean publishingEnabled; - UA_Byte priority; -} UA_SubscriptionSettings; - -extern const UA_EXPORT UA_SubscriptionSettings UA_SubscriptionSettings_default; - -UA_StatusCode UA_EXPORT -UA_Client_Subscriptions_new(UA_Client *client, UA_SubscriptionSettings settings, - UA_UInt32 *newSubscriptionId); - -UA_StatusCode UA_EXPORT -UA_Client_Subscriptions_remove(UA_Client *client, UA_UInt32 subscriptionId); - -UA_StatusCode UA_EXPORT -UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client); - -typedef void (*UA_MonitoredEventHandlingFunction)(const UA_UInt32 monId, - const size_t nEventFields, - const UA_Variant *eventFields, - void *context); - -UA_StatusCode UA_EXPORT -UA_Client_Subscriptions_addMonitoredEvent(UA_Client *client, const UA_UInt32 subscriptionId, - const UA_NodeId nodeId, const UA_UInt32 attributeID, - UA_SimpleAttributeOperand *selectClause, - const size_t nSelectClauses, - UA_ContentFilterElement *whereClause, - const size_t nWhereClauses, - const UA_MonitoredEventHandlingFunction hf, - void *hfContext, UA_UInt32 *newMonitoredItemId); - -typedef void (*UA_MonitoredItemHandlingFunction)(UA_UInt32 monId, - UA_DataValue *value, - void *context); - -UA_StatusCode UA_EXPORT -UA_Client_Subscriptions_addMonitoredItem(UA_Client *client, - UA_UInt32 subscriptionId, - UA_NodeId nodeId, UA_UInt32 attributeID, - UA_MonitoredItemHandlingFunction hf, - void *hfContext, - UA_UInt32 *newMonitoredItemId, - UA_Double samplingInterval); - -UA_StatusCode UA_EXPORT -UA_Client_Subscriptions_removeMonitoredItem(UA_Client *client, - UA_UInt32 subscriptionId, - UA_UInt32 monitoredItemId); - -#endif - -/** - * Misc Highlevel Functionality - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ -/* Get the namespace-index of a namespace-URI - * - * @param client The UA_Client struct for this connection - * @param namespaceUri The interested namespace URI - * @param namespaceIndex The namespace index of the URI. The value is unchanged - * in case of an error - * @return Indicates whether the operation succeeded or returns an error code */ -UA_StatusCode UA_EXPORT -UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri, - UA_UInt16 *namespaceIndex); - -#ifndef HAVE_NODEITER_CALLBACK -#define HAVE_NODEITER_CALLBACK -/* Iterate over all nodes referenced by parentNodeId by calling the callback - function for each child node */ -typedef UA_StatusCode (*UA_NodeIteratorCallback)(UA_NodeId childId, - UA_Boolean isInverse, - UA_NodeId referenceTypeId, - void *handle); -#endif - -UA_StatusCode UA_EXPORT -UA_Client_forEachChildNodeCall(UA_Client *client, UA_NodeId parentNodeId, - UA_NodeIteratorCallback callback, void *handle) ; - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_network_tcp.h" ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -UA_ServerNetworkLayer UA_EXPORT -UA_ServerNetworkLayerTCP(UA_ConnectionConfig conf, UA_UInt16 port); - -UA_ServerNetworkLayer -UA_ServerNetworkLayerTCPSocketActivation(UA_ConnectionConfig conf, UA_Int32 socketFd); - -UA_Connection UA_EXPORT -UA_ClientConnectionTCP(UA_ConnectionConfig conf, const char *endpointUrl, const UA_UInt32 timeout); - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_accesscontrol_default.h" ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - - - -#ifdef __cplusplus -extern "C" { -#endif - -UA_StatusCode UA_EXPORT -activateSession_default(const UA_NodeId *sessionId, - const UA_ExtensionObject *userIdentityToken, - void **sessionContext); - -void UA_EXPORT -closeSession_default(const UA_NodeId *sessionId, void *sessionContext); - -UA_UInt32 UA_EXPORT -getUserRightsMask_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext); - -UA_Byte UA_EXPORT -getUserAccessLevel_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *nodeId, void *nodeContext); - -UA_Boolean UA_EXPORT -getUserExecutable_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *methodId, void *methodContext); - -UA_Boolean UA_EXPORT -getUserExecutableOnObject_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_NodeId *methodId, void *methodContext, - const UA_NodeId *objectId, void *objectContext); - -UA_Boolean UA_EXPORT -allowAddNode_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_AddNodesItem *item); - -UA_Boolean UA_EXPORT -allowAddReference_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_AddReferencesItem *item); - -UA_Boolean UA_EXPORT -allowDeleteNode_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_DeleteNodesItem *item); - -UA_Boolean UA_EXPORT -allowDeleteReference_default(const UA_NodeId *sessionId, void *sessionContext, - const UA_DeleteReferencesItem *item); - -#ifdef __cplusplus -} -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_log_stdout.h" ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - - - -#ifdef __cplusplus -extern "C" { -#endif - -void UA_EXPORT -UA_Log_Stdout(UA_LogLevel level, UA_LogCategory category, - const char *msg, va_list args); - -#ifdef __cplusplus -} -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_nodestore_default.h" ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - - - -#ifdef __cplusplus -extern "C" { -#endif - -/* Initializes the nodestore, sets the context and function pointers */ -UA_StatusCode UA_EXPORT -UA_Nodestore_default_new(UA_Nodestore *ns); - -#ifdef __cplusplus -} // extern "C" -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_config_default.h" ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/**********************/ -/* Default Connection */ -/**********************/ - -extern const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_default; - -/*************************/ -/* Default Server Config */ -/*************************/ - -/* Creates a new server config with one endpoint. - * - * The config will set the tcp network layer to the given port and adds a single - * endpoint with the security policy ``SecurityPolicy#None`` to the server. A - * server certificate may be supplied but is optional. - * - * @param portNumber The port number for the tcp network layer - * @param certificate Optional certificate for the server endpoint. Can be - * ``NULL``. */ -UA_EXPORT UA_ServerConfig * -UA_ServerConfig_new_minimal(UA_UInt16 portNumber, - const UA_ByteString *certificate); - -/* Creates a server config on the default port 4840 with no server - * certificate. */ -static UA_INLINE UA_ServerConfig * -UA_ServerConfig_new_default(void) { - return UA_ServerConfig_new_minimal(4840, NULL); -} - -/* Set a custom hostname in server configuration - * - * @param config A valid server configuration - * @param customHostname The custom hostname used by the server */ - -UA_EXPORT void -UA_ServerConfig_set_customHostname(UA_ServerConfig *config, - const UA_String customHostname); - -/* Frees allocated memory in the server config */ -UA_EXPORT void -UA_ServerConfig_delete(UA_ServerConfig *config); - -/*************************/ -/* Default Client Config */ -/*************************/ - -extern const UA_EXPORT UA_ClientConfig UA_ClientConfig_default; - -#ifdef __cplusplus -} -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_securitypolicy_none.h" ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -UA_StatusCode UA_EXPORT -UA_SecurityPolicy_None(UA_SecurityPolicy *policy, const UA_ByteString localCertificate, - UA_Logger logger); - -#ifdef __cplusplus -} -#endif - - -/*********************************** amalgamated original file "/home/max/work/innoteka/OPC-UA_OTA_Service/src/open62541-master/plugins/ua_log_socket_error.h" ***********************************/ - -/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. - * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */ - - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _WIN32 -#include -#define UA_LOG_SOCKET_ERRNO_WRAP(LOG) { \ - char *errno_str = NULL; \ - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, \ - NULL, WSAGetLastError(), \ - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), \ - (LPSTR)&errno_str, 0, NULL); \ - LOG; \ - LocalFree(errno_str); \ -} -#else -#define UA_LOG_SOCKET_ERRNO_WRAP(LOG) { \ - char *errno_str = strerror(errno); \ - LOG; \ -} -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif /* OPEN62541_H_ */ diff --git a/thirdparty.spdx b/thirdparty.spdx index c364e9a78c..3df10151fe 100644 --- a/thirdparty.spdx +++ b/thirdparty.spdx @@ -5,13 +5,10 @@ Creator: Organization: HERE Technologies Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-googletest Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-jsoncpp Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-HdrHistogram_c -Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-open62541 Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-boost-program-options-accumulator Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-boost-filesystem Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-boost-program-options Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-boost-log -Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-boost-serialization -Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-boost-iostreams Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-libcurl Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-openssl Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-libarchive @@ -66,18 +63,6 @@ FilesAnalyzed: false PackageComment: Testing only. -PackageName: open62541 -SPDXID: SPDXRef-open62541 -PackageDownloadLocation: https://github.com/open62541/open62541/archive/0.3-rc2.tar.gz -PackageHomePage: https://open62541.org/ -PackageLicenseConcluded: MPL-2.0 -PackageLicenseDeclared: MPL-2.0 -PackageLicenseInfoFromFiles: MPL-2.0 -PackageCopyrightText: NONE -FilesAnalyzed: false -PackageComment: OPCUA only. - - PackageName: boost-program-options-accumulator SPDXID: SPDXRef-boost-program-options-accumulator PackageDownloadLocation: https://github.com/bskari/sqlassie/blob/master/src/accumulator.hpp @@ -122,31 +107,6 @@ PackageCopyrightText: Copyright © 2007-2016 Andrey Semashev FilesAnalyzed: false -PackageName: boost-serialization -SPDXID: SPDXRef-boost-serialization -PackageDownloadLocation: https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2 -PackageHomePage: http://www.boost.org/ -PackageLicenseConcluded: BSL-1.0 -PackageLicenseDeclared: BSL-1.0 -PackageLicenseInfoFromFiles: BSL-1.0 -PackageCopyrightText: © Copyright Robert Ramey 2002-2004 -FilesAnalyzed: false -PackageComment: OPCUA only. - - -PackageName: boost-iostreams -SPDXID: SPDXRef-boost-iostreams -PackageDownloadLocation: https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2 -PackageHomePage: http://www.boost.org/ -PackageLicenseConcluded: BSL-1.0 -PackageLicenseDeclared: BSL-1.0 -PackageLicenseInfoFromFiles: BSL-1.0 -PackageCopyrightText: © Copyright 2008 CodeRage, LLC -© Copyright 2004-2007 Jonathan Turkanis -FilesAnalyzed: false -PackageComment: OPCUA only. - - PackageName: libcurl SPDXID: SPDXRef-libcurl PackageDownloadLocation: https://github.com/curl/curl/archive/master.zip From dbae2e1e55f999bd1560e1a706d8065e0ae92cc9 Mon Sep 17 00:00:00 2001 From: Mike Sul Date: Thu, 11 Apr 2019 15:02:18 +0300 Subject: [PATCH 3/3] OTA-2499: use asn1 objects instead of linking it as a library Signed-off-by: Mike Sul --- src/libaktualizr-posix/asn1/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libaktualizr-posix/asn1/CMakeLists.txt b/src/libaktualizr-posix/asn1/CMakeLists.txt index e9044ab819..2a29a2cbba 100644 --- a/src/libaktualizr-posix/asn1/CMakeLists.txt +++ b/src/libaktualizr-posix/asn1/CMakeLists.txt @@ -16,6 +16,6 @@ compile_asn1_lib(SOURCES messages/tlsconfig.asn1 ) -add_aktualizr_test(NAME asn1 LIBRARIES asn1 asn1_lib SOURCES asn1_test.cc) +add_aktualizr_test(NAME asn1 SOURCES $ $ asn1_test.cc) -aktualizr_source_file_checks(${SOURCES} ${HEADERS} ${TEST_SOURCES}) +aktualizr_source_file_checks(${SOURCES} ${HEADERS} asn1_test.cc)