diff --git a/.gitignore b/.gitignore index c219dacda..62cef24f6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,169 +9,6 @@ /daemon/CMakeFiles /examples/CMakeFiles /implementation/configuration/include/internal.hpp -/test/network_tests/application_tests/application_test.json -/test/network_tests/application_tests/application_test_daemon.json -/test/network_tests/application_tests/application_test_no_dispatch_threads.json -/test/network_tests/application_tests/application_test_no_dispatch_threads_daemon.json -/test/network_tests/big_payload_tests/big_payload_test_local_tcp_client.json -/test/network_tests/big_payload_tests/big_payload_test_local_tcp_client_limited.json -/test/network_tests/big_payload_tests/big_payload_test_local_tcp_client_queue_limited.json -/test/network_tests/big_payload_tests/big_payload_test_local_tcp_client_random.json -/test/network_tests/big_payload_tests/big_payload_test_local_tcp_service.json -/test/network_tests/big_payload_tests/big_payload_test_local_tcp_service_limited.json -/test/network_tests/big_payload_tests/big_payload_test_local_tcp_service_queue_limited.json -/test/network_tests/big_payload_tests/big_payload_test_local_tcp_service_random.json -/test/network_tests/big_payload_tests/big_payload_test_tcp_client.json -/test/network_tests/big_payload_tests/big_payload_test_tcp_service.json -/test/network_tests/big_payload_tests/big_payload_test_tcp_client_random.json -/test/network_tests/big_payload_tests/big_payload_test_tcp_service_random.json -/test/network_tests/big_payload_tests/big_payload_test_tcp_client_limited_general.json -/test/network_tests/big_payload_tests/big_payload_test_tcp_service_limited_general.json -/test/network_tests/big_payload_tests/big_payload_test_tcp_client_queue_limited_general.json -/test/network_tests/big_payload_tests/big_payload_test_tcp_client_queue_limited_specific.json -/test/network_tests/big_payload_tests/big_payload_test_tcp_service_queue_limited_general.json -/test/network_tests/big_payload_tests/big_payload_test_tcp_service_queue_limited_specific.json -/test/network_tests/big_payload_tests/big_payload_test_udp_client.json -/test/network_tests/big_payload_tests/big_payload_test_udp_service.json -/test/network_tests/magic_cookies_tests/magic_cookies_test_client.json -/test/network_tests/magic_cookies_tests/magic_cookies_test_service.json -/test/network_tests/debounce_frequency_tests/debounce_frequency_test_client.json -/test/network_tests/debounce_frequency_tests/debounce_frequency_test_service.json -/test/network_tests/payload_tests/external_local_payload_test_client_external.json -/test/network_tests/payload_tests/external_local_payload_test_client_local.json -/test/network_tests/payload_tests/external_local_payload_test_service.json -/test/network_tests/routing_tests/external_local_routing_test_client_external.json -/test/network_tests/routing_tests/external_local_routing_test_service.json -/test/network_tests/routing_tests/local_routing_test_starter.sh -/test/network_tests/client_id_tests/client_id_test_diff_client_ids_diff_ports_master.json -/test/network_tests/client_id_tests/client_id_test_diff_client_ids_diff_ports_slave.json -/test/network_tests/client_id_tests/client_id_test_diff_client_ids_same_ports_master.json -/test/network_tests/client_id_tests/client_id_test_diff_client_ids_same_ports_slave.json -/test/network_tests/client_id_tests/client_id_test_diff_client_ids_partial_same_ports_master.json -/test/network_tests/client_id_tests/client_id_test_diff_client_ids_partial_same_ports_slave.json -/test/network_tests/client_id_tests/client_id_test_same_client_ids_diff_ports_master.json -/test/network_tests/client_id_tests/client_id_test_same_client_ids_diff_ports_slave.json -/test/network_tests/client_id_tests/client_id_test_same_client_ids_same_ports_master.json -/test/network_tests/client_id_tests/client_id_test_same_client_ids_same_ports_slave.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_master.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_slave.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_master.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_slave.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_same_client_ids_diff_ports_master.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_same_client_ids_diff_ports_slave.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_same_client_ids_same_ports_master.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_same_client_ids_same_ports_slave.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_master_udp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_slave_udp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_master_udp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_slave_udp.json -/test/network_tests/subscribe_notify_one_tests/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json -/test/network_tests/subscribe_notify_one_tests/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json -/test/network_tests/subscribe_notify_one_tests/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json -/test/network_tests/subscribe_notify_one_tests/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json -/test/network_tests/subscribe_notify_one_tests/subscribe_notify_one_test_diff_client_ids_diff_ports_master_udp.json -/test/network_tests/subscribe_notify_one_tests/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_udp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave_udp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_master_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_master_udp_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master_udp_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave_udp_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_slave_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_slave_udp_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_partial_same_ports_master_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_partial_same_ports_slave_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_master_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_master_tcp_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_master_udp_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_slave_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_same_ports_slave_udp_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_tcp_slave_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_udp_slave_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_same_client_ids_diff_ports_master_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_same_client_ids_diff_ports_slave_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_same_client_ids_same_ports_master_local_tcp.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_same_client_ids_same_ports_slave_local_tcp.json -/test/network_tests/cpu_load_tests/cpu_load_test_client_slave.json -/test/network_tests/cpu_load_tests/cpu_load_test_client_master.json -/test/network_tests/cpu_load_tests/cpu_load_test_service_slave.json -/test/network_tests/cpu_load_tests/cpu_load_test_service_master.json /tools/CMakeFiles -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_master.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_slave.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_partial_same_ports_master.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_partial_same_ports_slave.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_same_ports_master.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_same_ports_slave.json -/test/network_tests/initial_event_tests/initial_event_test_same_client_ids_diff_ports_master.json -/test/network_tests/initial_event_tests/initial_event_test_same_client_ids_diff_ports_slave.json -/test/network_tests/initial_event_tests/initial_event_test_same_client_ids_same_ports_master.json -/test/network_tests/initial_event_tests/initial_event_test_same_client_ids_same_ports_slave.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_master_tcp.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_same_ports_master_tcp.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_same_ports_slave_tcp.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_master_udp.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_diff_ports_slave_udp.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_same_ports_master_udp.json -/test/network_tests/initial_event_tests/initial_event_test_diff_client_ids_same_ports_slave_udp.json -/test/network_tests/offer_tests/offer_test_external_master.json -/test/network_tests/offer_tests/offer_test_external_slave.json -/test/network_tests/offer_tests/offer_test_external_master_starter.sh -/test/network_tests/offer_tests/offer_test_big_sd_msg_master_starter.sh -/test/network_tests/offer_tests/offer_test_big_sd_msg_master.json -/test/network_tests/offer_tests/offer_test_big_sd_msg_slave.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json -/test/network_tests/subscribe_notify_tests/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json -/test/network_tests/security_tests/security_test_config_client_external_allow.json -/test/network_tests/security_tests/security_test_config_client_external_deny.json -/test/network_tests/security_tests/security_test_config_service_external_allow.json -/test/network_tests/security_tests/security_test_config_service_external_deny.json -/test/network_tests/security_tests/security_test_local_config.json -/test/network_tests/pending_subscription_tests/pending_subscription_test_master.json -/test/network_tests/pending_subscription_tests/pending_subscription_test_master_starter.sh -/test/network_tests/malicious_data_tests/malicious_data_test_master.json -/test/network_tests/malicious_data_tests/malicious_data_test_master_starter.sh -/test/network_tests/e2e_tests/e2e_profile_04_test_client_external.json -/test/network_tests/e2e_tests/e2e_profile_04_test_service_external.json -/test/network_tests/e2e_tests/e2e_test_client_external.json -/test/network_tests/e2e_tests/e2e_test_service_external.json -/test/network_tests/event_tests/event_test_master.json -/test/network_tests/event_tests/event_test_slave_tcp.json -/test/network_tests/event_tests/event_test_slave_udp.json -/test/network_tests/npdu_tests/npdu_test_client_no_npdu.json -/test/network_tests/npdu_tests/npdu_test_client_npdu.json -/test/network_tests/npdu_tests/npdu_test_service_no_npdu.json -/test/network_tests/npdu_tests/npdu_test_service_npdu.json -/test/network_tests/someip_tp_tests/someip_tp_test_master.json -/test/network_tests/someip_tp_tests/someip_tp_test_master_starter.sh -/test/network_tests/second_address_tests/second_address_test_master_service_udp.json -/test/network_tests/second_address_tests/second_address_test_master_client.json -/test/network_tests/second_address_tests/second_address_test_slave_client.json -/test/network_tests/second_address_tests/second_address_test_slave_service_udp.json -/test/network_tests/second_address_tests/second_address_test_slave_starter.sh -/test/network_tests/debounce_tests/debounce_test_client.json -/test/network_tests/debounce_tests/debounce_test_service.json -/test/network_tests/debounce_filter_tests/debounce_filter_test_client.json -/test/network_tests/debounce_filter_tests/debounce_filter_test_service.json -/test/network_tests/suspend_resume_tests/suspend_resume_test_client.json -/test/network_tests/suspend_resume_tests/suspend_resume_test_service.json /Testing !build_qnx/* diff --git a/Android.bp b/Android.bp index f314f22b1..702782517 100644 --- a/Android.bp +++ b/Android.bp @@ -80,8 +80,8 @@ cc_library_shared { cflags: [ "-DWITHOUT_SYSTEMD", - "-DVSOMEIP_VERSION=\"3.4.10\"", - "-DVSOMEIP_COMPAT_VERSION=\"3.4.10\"", + "-DVSOMEIP_VERSION=\"3.5.0\"", + "-DVSOMEIP_COMPAT_VERSION=\"3.5.0\"", "-DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\"", "-DUSE_DLT", ], diff --git a/Android.mk b/Android.mk index 67530094e..cadc6e758 100644 --- a/Android.mk +++ b/Android.mk @@ -100,7 +100,7 @@ LOCAL_CFLAGS := \ -frtti \ -fexceptions \ -DWITHOUT_SYSTEMD \ - -DVSOMEIP_VERSION=\"3.4.10\" \ + -DVSOMEIP_VERSION=\"3.5.0\" \ -DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\" \ -Wno-unused-parameter \ -Wno-non-virtual-dtor \ @@ -147,7 +147,7 @@ LOCAL_CFLAGS := \ -frtti \ -fexceptions \ -DWITHOUT_SYSTEMD \ - -DVSOMEIP_VERSION=\"3.4.10\" \ + -DVSOMEIP_VERSION=\"3.5.0\" \ -DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\" \ -Wno-unused-parameter \ -Wno-non-virtual-dtor \ @@ -194,8 +194,8 @@ LOCAL_CFLAGS := \ -frtti \ -fexceptions \ -DWITHOUT_SYSTEMD \ - -DVSOMEIP_VERSION=\"3.4.10\" \ - -DVSOMEIP_COMPAT_VERSION=\"3.4.10\" \ + -DVSOMEIP_VERSION=\"3.5.0\" \ + -DVSOMEIP_COMPAT_VERSION=\"3.5.0\" \ -DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\" \ -Wno-unused-parameter \ -Wno-non-virtual-dtor \ diff --git a/CHANGES b/CHANGES index f4e7081aa..fd7bc3c28 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,27 @@ Changes ======= +v3.5.0 +- Load Policies Lazy Load +- Test - Processing SD messages with unknown type option +- ensure endpoints before deletion +- Improve "end of file" error handling +- Enable debouncing of events & selective events +- Revert "Test - Processing SD messages with unknown type" +- Logs added to points of failure on registration process +- One *.json to ignorem all +- Someip-tp remote address rework +- Fix crash in multicast_receive receive_cb +- Generate network_test configs directly to build +- Fix deadlock if binding of TCP client endpoint fails +- Added missing includes of iomanip to support compilation on Mint +- Cache not yet registered events +- Return true to make sure endpoints are deleted +- Byteorder implementation +- Reorder of prepare_stop method +- Allows applications in the same process using different security configurations +- Fix to not ignore stop offers when sd acceptance is not required + v3.4.10 - Fix QNX build - Fix missing Stop Offer diff --git a/CMakeLists.txt b/CMakeLists.txt index 3501e02c5..75136dd75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ set (VSOMEIP_NAME vsomeip3) set (VSOMEIP_COMPAT_NAME vsomeip) set (VSOMEIP_MAJOR_VERSION 3) -set (VSOMEIP_MINOR_VERSION 4) -set (VSOMEIP_PATCH_VERSION 10) +set (VSOMEIP_MINOR_VERSION 5) +set (VSOMEIP_PATCH_VERSION 0) set (VSOMEIP_HOTFIX_VERSION 0) set (VSOMEIP_VERSION ${VSOMEIP_MAJOR_VERSION}.${VSOMEIP_MINOR_VERSION}.${VSOMEIP_PATCH_VERSION}) @@ -109,6 +109,11 @@ if (ENABLE_SIGNAL_HANDLING) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVSOMEIP_ENABLE_SIGNAL_HANDLING") endif () +# Event caching +if (ENABLE_DEFAULT_EVENT_CACHING) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVSOMEIP_ENABLE_DEFAULT_EVENT_CACHING") +endif () + if (NOT MSVC) # Sanitizers diff --git a/documentation/vsomeipUserGuide b/documentation/vsomeipUserGuide index 4c1f9842e..ea7a6904e 100644 --- a/documentation/vsomeipUserGuide +++ b/documentation/vsomeipUserGuide @@ -689,9 +689,6 @@ Contains the IDs for requests, which are sent from the node to a remote service which can be segmented via SOME/IP-TP if they exceed the maximum message size for UDP communication. If an ID isn't listed here the message will otherwise be dropped if the maximum message size is exceeded. -Please note that the unicast key has to be set to the remote IP address of the -offering node for this setting to take effect. - * `clients` (array) + @@ -756,7 +753,7 @@ specified otherwise the allowed payload sizes are unlimited. The settings in this array only affect communication over TCP. To limit the local payload size `max-payload-size-local` can be used. -** `unicast` +** `unicast` (optional) + On client side: the IP of the remote service for which the payload size should be limited. diff --git a/exportmap.gcc b/exportmap.gcc index 5939e6c4c..8533a761c 100644 --- a/exportmap.gcc +++ b/exportmap.gcc @@ -27,7 +27,7 @@ global: vsomeip_v3::policy_manager::*; *vsomeip_v3::policy_manager_impl; vsomeip_v3::policy_manager_impl::*; - vsomeip_v3::security::authenticate_router; + vsomeip_v3::security::*; *vsomeip_v3::runtime; vsomeip_v3::runtime::get*; vsomeip_v3::runtime::set_property*; diff --git a/implementation/configuration/include/configuration.hpp b/implementation/configuration/include/configuration.hpp index 8b32a0c99..ce460152b 100644 --- a/implementation/configuration/include/configuration.hpp +++ b/implementation/configuration/include/configuration.hpp @@ -39,6 +39,8 @@ namespace vsomeip_v3 { +class policy_manager_impl; +class security; class event; struct debounce_filter_impl_t; @@ -276,10 +278,10 @@ class configuration { // SOME/IP-TP virtual bool is_tp_client( - service_t _service, const std::string &_address, std::uint16_t _port, + service_t _service, instance_t _instance, method_t _method) const = 0; virtual bool is_tp_service( - service_t _service, const std::string &_address, std::uint16_t _port, + service_t _service, instance_t _instance, method_t _method) const = 0; virtual void get_tp_configuration( service_t _service, instance_t _instance, method_t _method, bool _is_client, @@ -309,6 +311,8 @@ class configuration { virtual bool is_security_external() const = 0; virtual bool is_security_audit() const = 0; virtual bool is_remote_access_allowed() const = 0; + virtual std::shared_ptr get_policy_manager() const = 0; + virtual std::shared_ptr get_security() const = 0; }; } // namespace vsomeip_v3 diff --git a/implementation/configuration/include/configuration_impl.hpp b/implementation/configuration/include/configuration_impl.hpp index f30e0ecf5..267368fe1 100644 --- a/implementation/configuration/include/configuration_impl.hpp +++ b/implementation/configuration/include/configuration_impl.hpp @@ -261,11 +261,10 @@ class configuration_impl: VSOMEIP_EXPORT bool is_tp_client( service_t _service, - const std::string &_address, std::uint16_t _port, + instance_t _instance, method_t _method) const; VSOMEIP_EXPORT bool is_tp_service( - service_t _service, const std::string &_ip_service, - std::uint16_t _port_service, method_t _method) const; + service_t _service, instance_t _instance, method_t _method) const; VSOMEIP_EXPORT void get_tp_configuration( service_t _service, instance_t _instance, method_t _method, bool _is_client, std::uint16_t &_max_segment_length, std::uint32_t &_separation_time) const; @@ -297,6 +296,8 @@ class configuration_impl: VSOMEIP_EXPORT bool is_security_audit() const; VSOMEIP_EXPORT bool is_remote_access_allowed() const; + VSOMEIP_EXPORT std::shared_ptr get_policy_manager() const; + VSOMEIP_EXPORT std::shared_ptr get_security() const; private: void read_data(const std::set &_input, std::vector &_elements, @@ -479,6 +480,9 @@ class configuration_impl: std::set mandatory_; + std::shared_ptr policy_manager_; + std::shared_ptr security_; + protected: // Configuration data boost::asio::ip::address unicast_; diff --git a/implementation/configuration/include/configuration_plugin_impl.hpp b/implementation/configuration/include/configuration_plugin_impl.hpp index 3fcfbefcd..695bc6c1b 100644 --- a/implementation/configuration/include/configuration_plugin_impl.hpp +++ b/implementation/configuration/include/configuration_plugin_impl.hpp @@ -32,10 +32,7 @@ class configuration_plugin_impl private: std::mutex mutex_; - std::shared_ptr default_; -#if 0 std::map > configurations_; -#endif }; } // namespace vsomeip_v3 diff --git a/implementation/configuration/src/configuration_impl.cpp b/implementation/configuration/src/configuration_impl.cpp index 380b29060..36f75617b 100644 --- a/implementation/configuration/src/configuration_impl.cpp +++ b/implementation/configuration/src/configuration_impl.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "../include/client.hpp" #include "../include/configuration_impl.hpp" @@ -37,7 +38,6 @@ #include "../../routing/include/event.hpp" #include "../../service_discovery/include/defines.hpp" #include "../../utility/include/utility.hpp" -#include "../../plugin/include/plugin_manager.hpp" #include "../../security/include/policy_manager_impl.hpp" #include "../../security/include/security.hpp" @@ -107,6 +107,8 @@ configuration_impl::configuration_impl(const std::string &_path) is_security_audit_(false), is_remote_access_allowed_(true) { + policy_manager_ = std::make_shared(); + security_ = std::make_shared(policy_manager_); unicast_ = unicast_.from_string(VSOMEIP_UNICAST_ADDRESS); netmask_ = netmask_.from_string(VSOMEIP_NETMASK); for (auto i = 0; i < ET_MAX; i++) @@ -362,7 +364,7 @@ bool configuration_impl::load(const std::string &_name) { bool configuration_impl::lazy_load_security(const std::string &_client_host) { bool result(false); - std::string its_folder = policy_manager_impl::get()->get_policy_extension_path(_client_host); + std::string its_folder = policy_manager_->get_policy_extension_path(_client_host); if (!its_folder.empty()) { std::set its_input; std::set its_failed; @@ -370,7 +372,7 @@ bool configuration_impl::lazy_load_security(const std::string &_client_host) { its_input.insert(its_folder); // load security configuration files from UID_GID sub folder if existing - std::string its_security_config_folder = policy_manager_impl::get()->get_security_config_folder(its_folder); + std::string its_security_config_folder = policy_manager_->get_security_config_folder(its_folder); if (!its_security_config_folder.empty()) its_input.insert(its_security_config_folder); @@ -378,7 +380,7 @@ bool configuration_impl::lazy_load_security(const std::string &_client_host) { read_data(its_input, its_mandatory_elements, its_failed, true, true); for (const auto& e : its_mandatory_elements) { - policy_manager_impl::get()->load(e, true); + policy_manager_->load(e, true); } for (auto f : its_failed) @@ -387,7 +389,7 @@ bool configuration_impl::lazy_load_security(const std::string &_client_host) { result = (its_failed.empty() && !its_mandatory_elements.empty()); if (result) - policy_manager_impl::get()->set_is_policy_extension_loaded(_client_host, true); + policy_manager_->set_is_policy_extension_loaded(_client_host, true); } return result; @@ -399,7 +401,7 @@ configuration_impl::check_routing_credentials( client_t _client, const vsomeip_sec_client_t *_sec_client) const { return (_client != get_id(routing_.host_.name_) || - VSOMEIP_SEC_OK == security::authenticate_router(_sec_client)); + VSOMEIP_SEC_OK == security_->authenticate_router(_sec_client)); } bool configuration_impl::remote_offer_info_add(service_t _service, @@ -534,8 +536,8 @@ void configuration_impl::load_policy_data(const std::string &_input, bool _mandatory_only) { if (is_mandatory(_input) == _mandatory_only) { #ifndef VSOMEIP_DISABLE_SECURITY - if (policy_manager_impl::get()->is_policy_extension(_input)) { - policy_manager_impl::get()->set_policy_extension_base_path(_input); + if (policy_manager_->is_policy_extension(_input)) { + policy_manager_->set_policy_extension_base_path(_input); } #endif boost::property_tree::ptree its_tree; @@ -847,7 +849,7 @@ configuration_impl::load_routing_host(const boost::property_tree::ptree &_tree, } if (has_uid && has_gid) { - policy_manager_impl::get()->set_routing_credentials(its_uid, its_gid, _name); + policy_manager_->set_routing_credentials(its_uid, its_gid, _name); } } catch (...) { @@ -2701,7 +2703,7 @@ void configuration_impl::load_security(const configuration_element &_element) { #ifndef VSOMEIP_DISABLE_SECURITY if (!is_security_external()) - policy_manager_impl::get()->load(_element); + policy_manager_->load(_element); #endif // !VSOMEIP_DISABLE_SECURITY } @@ -4879,13 +4881,13 @@ int configuration_impl::get_udp_receive_buffer_size() const { bool configuration_impl::is_tp_client( service_t _service, - const std::string &_address, std::uint16_t _port, + instance_t _instance, method_t _method) const { bool ret(false); const auto its_service - = find_service(_service, _address, _port); + = find_service(_service, _instance); if (its_service) { ret = (its_service->tp_client_config_.find(_method) @@ -4897,12 +4899,12 @@ bool configuration_impl::is_tp_client( bool configuration_impl::is_tp_service( service_t _service, - const std::string &_address, std::uint16_t _port, + instance_t _instance, method_t _method) const { bool ret(false); const auto its_service - = find_service(_service, _address, _port); + = find_service(_service, _instance); if (its_service) { ret = (its_service->tp_service_config_.find(_method) != its_service->tp_service_config_.end()); @@ -5040,5 +5042,13 @@ configuration_impl::is_remote_access_allowed() const { return is_remote_access_allowed_; } +std::shared_ptr configuration_impl::get_policy_manager() const { + return policy_manager_; +} + +std::shared_ptr configuration_impl::get_security() const { + return security_; +} + } // namespace cfg } // namespace vsomeip_v3 diff --git a/implementation/configuration/src/configuration_plugin_impl.cpp b/implementation/configuration/src/configuration_plugin_impl.cpp index 89f47b6d0..729505069 100644 --- a/implementation/configuration/src/configuration_plugin_impl.cpp +++ b/implementation/configuration/src/configuration_plugin_impl.cpp @@ -25,14 +25,6 @@ std::shared_ptr configuration_plugin_impl::get_configuration(const std::string &_name, const std::string &_path) { - std::lock_guard its_lock(mutex_); - if (!default_) { - default_ = std::make_shared(_path); - default_->load(_name); - } - return default_; - -#if 0 std::shared_ptr its_configuration; auto its_iterator = configurations_.find(_name); if (its_iterator != configurations_.end()) { @@ -44,7 +36,6 @@ configuration_plugin_impl::get_configuration(const std::string &_name, } return its_configuration; -#endif -} +} } // namespace vsomeip_v3 diff --git a/implementation/e2e_protection/src/e2e/profile/profile04/checker.cpp b/implementation/e2e_protection/src/e2e/profile/profile04/checker.cpp index 5e729766b..3e655f1d5 100644 --- a/implementation/e2e_protection/src/e2e/profile/profile04/checker.cpp +++ b/implementation/e2e_protection/src/e2e/profile/profile04/checker.cpp @@ -8,7 +8,7 @@ #include #include "../../../../include/e2e/profile/profile04/checker.hpp" -#include "../../../../../utility/include/byteorder.hpp" +#include "../../../../../utility/include/bithelper.hpp" namespace vsomeip_v3 { namespace e2e { @@ -92,8 +92,7 @@ bool profile_04_checker::read_16(const e2e_buffer &_buffer, uint16_t &_data, size_t _index) const { - _data = VSOMEIP_BYTES_TO_WORD(_buffer[config_.offset_ + _index], - _buffer[config_.offset_ + _index + 1]); + _data = bithelper::read_uint16_be(&_buffer[config_.offset_ + _index]); return true; } @@ -101,10 +100,7 @@ bool profile_04_checker::read_32(const e2e_buffer &_buffer, uint32_t &_data, size_t _index) const { - _data = VSOMEIP_BYTES_TO_LONG(_buffer[config_.offset_ + _index], - _buffer[config_.offset_ + _index + 1], - _buffer[config_.offset_ + _index + 2], - _buffer[config_.offset_ + _index + 3]); + _data = bithelper::read_uint32_be(&_buffer[config_.offset_ + _index]); return true; } diff --git a/implementation/e2e_protection/src/e2e/profile/profile04/protector.cpp b/implementation/e2e_protection/src/e2e/profile/profile04/protector.cpp index 2f9899c4c..e6abf84b9 100644 --- a/implementation/e2e_protection/src/e2e/profile/profile04/protector.cpp +++ b/implementation/e2e_protection/src/e2e/profile/profile04/protector.cpp @@ -7,7 +7,7 @@ #include #include "../../../../include/e2e/profile/profile04/protector.hpp" -#include "../../../../../utility/include/byteorder.hpp" +#include "../../../../../utility/include/bithelper.hpp" namespace vsomeip_v3 { namespace e2e { @@ -27,20 +27,20 @@ protector::protect(e2e_buffer &_buffer, instance_t _instance) { if (verify_inputs(_buffer)) { /** @req [SWS_E2E_00364] */ - write_16(_buffer, static_cast(_buffer.size()), 0); + bithelper::write_uint16_be(static_cast(_buffer.size()), &_buffer[config_.offset_]); /** @req [SWS_E2E_00365] */ - write_16(_buffer, get_counter(_instance), 2); + bithelper::write_uint16_be(get_counter(_instance), &_buffer[config_.offset_ + 2]); /** @req [SWS_E2E_00366] */ uint32_t its_data_id(uint32_t(_instance) << 24 | config_.data_id_); - write_32(_buffer, its_data_id, 4); + bithelper::write_uint32_be(its_data_id, &_buffer[config_.offset_ + 4]); /** @req [SWS_E2E_00367] */ uint32_t its_crc = profile_04::compute_crc(config_, _buffer); /** @req [SWS_E2E_0368] */ - write_32(_buffer, its_crc, 8); + bithelper::write_uint32_be(its_crc, &_buffer[config_.offset_ + 8]); /** @req [SWS_E2E_00369] */ increment_counter(_instance); @@ -54,22 +54,6 @@ protector::verify_inputs(e2e_buffer &_buffer) { && _buffer.size() <= config_.max_data_length_); } -void -protector::write_16(e2e_buffer &_buffer, uint16_t _data, size_t _index) { - - _buffer[config_.offset_ + _index] = VSOMEIP_WORD_BYTE1(_data); - _buffer[config_.offset_ + _index + 1] = VSOMEIP_WORD_BYTE0(_data); -} - -void -protector::write_32(e2e_buffer &_buffer, uint32_t _data, size_t _index) { - - _buffer[config_.offset_ + _index] = VSOMEIP_LONG_BYTE3(_data); - _buffer[config_.offset_ + _index + 1] = VSOMEIP_LONG_BYTE2(_data); - _buffer[config_.offset_ + _index + 2] = VSOMEIP_LONG_BYTE1(_data); - _buffer[config_.offset_ + _index + 3] = VSOMEIP_LONG_BYTE0(_data); -} - uint16_t protector::get_counter(instance_t _instance) const { diff --git a/implementation/e2e_protection/src/e2e/profile/profile05/checker.cpp b/implementation/e2e_protection/src/e2e/profile/profile05/checker.cpp index bb943ba72..964b73ac5 100644 --- a/implementation/e2e_protection/src/e2e/profile/profile05/checker.cpp +++ b/implementation/e2e_protection/src/e2e/profile/profile05/checker.cpp @@ -8,7 +8,7 @@ #include #include "../../../../include/e2e/profile/profile05/checker.hpp" -#include "../../../../../utility/include/byteorder.hpp" +#include "../../../../../utility/include/bithelper.hpp" namespace vsomeip_v3 { namespace e2e { @@ -78,8 +78,7 @@ bool profile_05_checker::read_16(const e2e_buffer &_buffer, uint16_t &_data, size_t _index) const { - _data = VSOMEIP_BYTES_TO_WORD(_buffer[config_.offset_ + _index + 1], - _buffer[config_.offset_ + _index]); + _data = bithelper::read_uint16_be(&_buffer[config_.offset_ + _index]); return true; } diff --git a/implementation/e2e_protection/src/e2e/profile/profile05/protector.cpp b/implementation/e2e_protection/src/e2e/profile/profile05/protector.cpp index f8ab9de4e..46843a6d4 100644 --- a/implementation/e2e_protection/src/e2e/profile/profile05/protector.cpp +++ b/implementation/e2e_protection/src/e2e/profile/profile05/protector.cpp @@ -7,7 +7,7 @@ #include #include "../../../../include/e2e/profile/profile05/protector.hpp" -#include "../../../../../utility/include/byteorder.hpp" +#include "../../../../../utility/include/bithelper.hpp" namespace vsomeip_v3 { namespace e2e { @@ -30,8 +30,7 @@ void protector::protect(e2e_buffer &_buffer, instance_t _instance) { // compute the CRC uint16_t its_crc = profile_05::compute_crc(config_, _buffer); - - write_crc(_buffer, its_crc, 0); + bithelper::write_uint16_be(its_crc, &_buffer[config_.offset_]); // increment the Counter (new value will be used in the next invocation of E2E_P05Protect()), increment_counter(_instance); @@ -44,13 +43,6 @@ protector::write_counter(e2e_buffer &_buffer, uint8_t _data, size_t _index) { _buffer[config_.offset_ + _index] = _data; } -void -protector::write_crc(e2e_buffer &_buffer, uint16_t _data, size_t _index) { - - _buffer[config_.offset_ + _index] = VSOMEIP_WORD_BYTE0(_data); - _buffer[config_.offset_ + _index + 1] = VSOMEIP_WORD_BYTE1(_data); -} - uint8_t protector::get_counter(instance_t _instance) const { diff --git a/implementation/e2e_protection/src/e2e/profile/profile07/checker.cpp b/implementation/e2e_protection/src/e2e/profile/profile07/checker.cpp index f069046bc..eab7439e7 100644 --- a/implementation/e2e_protection/src/e2e/profile/profile07/checker.cpp +++ b/implementation/e2e_protection/src/e2e/profile/profile07/checker.cpp @@ -8,7 +8,7 @@ #include #include "../../../../include/e2e/profile/profile07/checker.hpp" -#include "../../../../../utility/include/byteorder.hpp" +#include "../../../../../utility/include/bithelper.hpp" namespace vsomeip_v3 { namespace e2e { @@ -87,26 +87,16 @@ bool profile_07_checker::read_32(const e2e_buffer &_buffer, uint32_t &_data, size_t _index) const { - _data = VSOMEIP_BYTES_TO_LONG(_buffer[config_.offset_ + _index], - _buffer[config_.offset_ + _index + 1], - _buffer[config_.offset_ + _index + 2], - _buffer[config_.offset_ + _index + 3]); + _data = bithelper::read_uint32_be(&_buffer[config_.offset_ + _index]); return true; } // Read uint64_t as big-endian bool -profile_07_checker::read_64(const e2e_buffer &_buffer, +profile_07_checker::read_64(const e2e_buffer &_buffer, uint64_t &_data, size_t _index) const { - _data = VSOMEIP_BYTES_TO_LONG_LONG(_buffer[config_.offset_ + _index], - _buffer[config_.offset_ + _index + 1], - _buffer[config_.offset_ + _index + 2], - _buffer[config_.offset_ + _index + 3], - _buffer[config_.offset_ + _index + 4], - _buffer[config_.offset_ + _index + 5], - _buffer[config_.offset_ + _index + 6], - _buffer[config_.offset_ + _index + 7]); + _data = bithelper::read_uint64_be(&_buffer[config_.offset_ + _index]); return true; } diff --git a/implementation/e2e_protection/src/e2e/profile/profile07/protector.cpp b/implementation/e2e_protection/src/e2e/profile/profile07/protector.cpp index 311bc5ad5..b470245ac 100644 --- a/implementation/e2e_protection/src/e2e/profile/profile07/protector.cpp +++ b/implementation/e2e_protection/src/e2e/profile/profile07/protector.cpp @@ -7,7 +7,7 @@ #include #include "../../../../include/e2e/profile/profile07/protector.hpp" -#include "../../../../../utility/include/byteorder.hpp" +#include "../../../../../utility/include/bithelper.hpp" namespace vsomeip_v3 { namespace e2e { @@ -22,19 +22,19 @@ protector::protect(e2e_buffer &_buffer, instance_t _instance) { if (verify_inputs(_buffer)) { /** @req [SWS_E2E_00489] */ - write_32(_buffer, static_cast(_buffer.size()), PROFILE_07_SIZE_OFFSET); + bithelper::write_uint32_be(static_cast(_buffer.size()), &_buffer[config_.offset_ + PROFILE_07_SIZE_OFFSET]); /** @req [SWS_E2E_00490] */ - write_32(_buffer, get_counter(_instance), PROFILE_07_COUNTER_OFFSET); + bithelper::write_uint32_be(get_counter(_instance), &_buffer[config_.offset_ + PROFILE_07_COUNTER_OFFSET]); /** @req [SWS_E2E_00491] */ - write_32(_buffer, config_.data_id_, PROFILE_07_DATAID_OFFSET); + bithelper::write_uint32_be(config_.data_id_, &_buffer[config_.offset_ + PROFILE_07_DATAID_OFFSET]); /** @req [SWS_E2E_00492] */ uint64_t its_crc = profile_07::compute_crc(config_, _buffer); /** @req [SWS_E2E_00493] */ - write_64(_buffer, its_crc, PROFILE_07_CRC_OFFSET); + bithelper::write_uint64_be(its_crc, &_buffer[config_.offset_ + PROFILE_07_CRC_OFFSET]); /** @req [SWS_E2E_00494] */ increment_counter(_instance); @@ -48,30 +48,6 @@ protector::verify_inputs(e2e_buffer &_buffer) { && _buffer.size() <= config_.max_data_length_); } -// Write uint32_t as big-endian -void -protector::write_32(e2e_buffer &_buffer, uint32_t _data, size_t _index) { - - _buffer[config_.offset_ + _index] = VSOMEIP_LONG_BYTE3(_data); - _buffer[config_.offset_ + _index + 1] = VSOMEIP_LONG_BYTE2(_data); - _buffer[config_.offset_ + _index + 2] = VSOMEIP_LONG_BYTE1(_data); - _buffer[config_.offset_ + _index + 3] = VSOMEIP_LONG_BYTE0(_data); -} - -// Write uint64_t as big-endian -void -protector::write_64(e2e_buffer &_buffer, uint64_t _data, size_t _index) { - - _buffer[config_.offset_ + _index] = VSOMEIP_LONG_LONG_BYTE7(_data); - _buffer[config_.offset_ + _index + 1] = VSOMEIP_LONG_LONG_BYTE6(_data); - _buffer[config_.offset_ + _index + 2] = VSOMEIP_LONG_LONG_BYTE5(_data); - _buffer[config_.offset_ + _index + 3] = VSOMEIP_LONG_LONG_BYTE4(_data); - _buffer[config_.offset_ + _index + 4] = VSOMEIP_LONG_LONG_BYTE3(_data); - _buffer[config_.offset_ + _index + 5] = VSOMEIP_LONG_LONG_BYTE2(_data); - _buffer[config_.offset_ + _index + 6] = VSOMEIP_LONG_LONG_BYTE1(_data); - _buffer[config_.offset_ + _index + 7] = VSOMEIP_LONG_LONG_BYTE0(_data); -} - uint32_t protector::get_counter(instance_t _instance) const { diff --git a/implementation/endpoints/include/client_endpoint_impl.hpp b/implementation/endpoints/include/client_endpoint_impl.hpp index 92c69aa82..4ffaf5299 100644 --- a/implementation/endpoints/include/client_endpoint_impl.hpp +++ b/implementation/endpoints/include/client_endpoint_impl.hpp @@ -153,7 +153,8 @@ class client_endpoint_impl: public endpoint_impl, public client_endpoi virtual void set_local_port() = 0; virtual std::string get_remote_information() const = 0; virtual bool tp_segmentation_enabled(service_t _service, - method_t _method) const = 0; + instance_t _instance, + method_t _method) const; virtual std::uint32_t get_max_allowed_reconnects() const = 0; virtual void max_allowed_reconnects_reached() = 0; void send_segments(const tp::tp_split_messages_t &_segments, diff --git a/implementation/endpoints/include/local_tcp_client_endpoint_impl.hpp b/implementation/endpoints/include/local_tcp_client_endpoint_impl.hpp index 9ea300756..61d3d0f52 100644 --- a/implementation/endpoints/include/local_tcp_client_endpoint_impl.hpp +++ b/implementation/endpoints/include/local_tcp_client_endpoint_impl.hpp @@ -60,7 +60,6 @@ class local_tcp_client_endpoint_impl: public local_tcp_client_endpoint_base_impl void set_local_port(); std::string get_remote_information() const; bool check_packetizer_space(std::uint32_t _size); - bool tp_segmentation_enabled(service_t _service, method_t _method) const; std::uint32_t get_max_allowed_reconnects() const; void max_allowed_reconnects_reached(); diff --git a/implementation/endpoints/include/local_tcp_server_endpoint_impl.hpp b/implementation/endpoints/include/local_tcp_server_endpoint_impl.hpp index 49b6fcb77..a9ddef2ea 100644 --- a/implementation/endpoints/include/local_tcp_server_endpoint_impl.hpp +++ b/implementation/endpoints/include/local_tcp_server_endpoint_impl.hpp @@ -162,7 +162,6 @@ class local_tcp_server_endpoint_impl bool check_packetizer_space(target_data_iterator_type _queue_iterator, message_buffer_ptr_t* _packetizer, std::uint32_t _size); - bool tp_segmentation_enabled(service_t _service, method_t _method) const; void send_client_identifier(const client_t &_client); }; diff --git a/implementation/endpoints/include/local_uds_client_endpoint_impl.hpp b/implementation/endpoints/include/local_uds_client_endpoint_impl.hpp index e1e1aaa23..0c218c040 100644 --- a/implementation/endpoints/include/local_uds_client_endpoint_impl.hpp +++ b/implementation/endpoints/include/local_uds_client_endpoint_impl.hpp @@ -59,7 +59,6 @@ class local_uds_client_endpoint_impl: public local_uds_client_endpoint_base_impl void set_local_port(); std::string get_remote_information() const; bool check_packetizer_space(std::uint32_t _size); - bool tp_segmentation_enabled(service_t _service, method_t _method) const; std::uint32_t get_max_allowed_reconnects() const; void max_allowed_reconnects_reached(); diff --git a/implementation/endpoints/include/local_uds_server_endpoint_impl.hpp b/implementation/endpoints/include/local_uds_server_endpoint_impl.hpp index a4ed2eb57..e4bfdb14c 100644 --- a/implementation/endpoints/include/local_uds_server_endpoint_impl.hpp +++ b/implementation/endpoints/include/local_uds_server_endpoint_impl.hpp @@ -185,7 +185,6 @@ class local_uds_server_endpoint_impl: public local_uds_server_endpoint_base_impl bool check_packetizer_space(target_data_iterator_type _queue_iterator, message_buffer_ptr_t* _packetizer, std::uint32_t _size); - bool tp_segmentation_enabled(service_t _service, method_t _method) const; void send_client_identifier(const client_t &_client); }; diff --git a/implementation/endpoints/include/server_endpoint_impl.hpp b/implementation/endpoints/include/server_endpoint_impl.hpp index b543d97b4..467a344be 100644 --- a/implementation/endpoints/include/server_endpoint_impl.hpp +++ b/implementation/endpoints/include/server_endpoint_impl.hpp @@ -147,7 +147,8 @@ class server_endpoint_impl: public endpoint_impl, virtual std::string get_remote_information( const endpoint_type& _remote) const = 0; virtual bool tp_segmentation_enabled(service_t _service, - method_t _method) const = 0; + instance_t _instance, + method_t _method) const; void schedule_train(endpoint_data_type &_target); void update_last_departure(endpoint_data_type &_data); diff --git a/implementation/endpoints/include/tcp_client_endpoint_impl.hpp b/implementation/endpoints/include/tcp_client_endpoint_impl.hpp index 56b54e798..6c1b9e784 100644 --- a/implementation/endpoints/include/tcp_client_endpoint_impl.hpp +++ b/implementation/endpoints/include/tcp_client_endpoint_impl.hpp @@ -80,7 +80,6 @@ class tcp_client_endpoint_impl: public tcp_client_endpoint_base_impl { std::string get_remote_information() const; std::shared_ptr get_timing( const service_t& _service, const instance_t& _instance) const; - bool tp_segmentation_enabled(service_t _service, method_t _method) const; std::uint32_t get_max_allowed_reconnects() const; void max_allowed_reconnects_reached(); diff --git a/implementation/endpoints/include/tcp_server_endpoint_impl.hpp b/implementation/endpoints/include/tcp_server_endpoint_impl.hpp index 38834acfa..a1187ab1b 100644 --- a/implementation/endpoints/include/tcp_server_endpoint_impl.hpp +++ b/implementation/endpoints/include/tcp_server_endpoint_impl.hpp @@ -148,7 +148,6 @@ class tcp_server_endpoint_impl: public tcp_server_endpoint_base_impl { std::string get_remote_information( const target_data_iterator_type _it) const; std::string get_remote_information(const endpoint_type& _remote) const; - bool tp_segmentation_enabled(service_t _service, method_t _method) const; }; } // namespace vsomeip_v3 diff --git a/implementation/endpoints/include/udp_client_endpoint_impl.hpp b/implementation/endpoints/include/udp_client_endpoint_impl.hpp index 4d02ab27a..02d7cd028 100644 --- a/implementation/endpoints/include/udp_client_endpoint_impl.hpp +++ b/implementation/endpoints/include/udp_client_endpoint_impl.hpp @@ -65,7 +65,10 @@ class udp_client_endpoint_impl: virtual public udp_client_endpoint_base_impl { std::string get_address_port_remote() const; std::string get_address_port_local() const; std::string get_remote_information() const; - bool tp_segmentation_enabled(service_t _service, method_t _method) const; + bool tp_segmentation_enabled( + service_t _service, + instance_t _instance, + method_t _method) const; std::uint32_t get_max_allowed_reconnects() const; void max_allowed_reconnects_reached(); diff --git a/implementation/endpoints/include/udp_server_endpoint_impl.hpp b/implementation/endpoints/include/udp_server_endpoint_impl.hpp index b9b68fbc0..851104710 100644 --- a/implementation/endpoints/include/udp_server_endpoint_impl.hpp +++ b/implementation/endpoints/include/udp_server_endpoint_impl.hpp @@ -84,7 +84,10 @@ class udp_server_endpoint_impl: public udp_server_endpoint_base_impl { std::string get_remote_information(const endpoint_type& _remote) const; std::string get_address_port_local() const; - bool tp_segmentation_enabled(service_t _service, method_t _method) const; + bool tp_segmentation_enabled( + service_t _service, + instance_t _instance, + method_t _method) const; void on_unicast_received(boost::system::error_code const &_error, std::size_t _bytes); @@ -113,7 +116,7 @@ class udp_server_endpoint_impl: public udp_server_endpoint_base_impl { bool is_v4_; - std::unique_ptr multicast_socket_; + std::shared_ptr multicast_socket_; std::unique_ptr multicast_local_; endpoint_type multicast_remote_; message_buffer_t multicast_recv_buffer_; diff --git a/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp b/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp index 35638cd71..1690ea76b 100644 --- a/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp +++ b/implementation/endpoints/include/udp_server_endpoint_impl_receive_op.hpp @@ -32,7 +32,7 @@ struct storage : public std::enable_shared_from_this { std::recursive_mutex &multicast_mutex_; - socket_type_t &socket_; + std::weak_ptr socket_; endpoint_type_t &sender_; receive_handler_t handler_; byte_t *buffer_ = nullptr; @@ -44,7 +44,7 @@ struct storage : storage( std::recursive_mutex &_multicast_mutex, - socket_type_t &_socket, + std::weak_ptr _socket, endpoint_type_t &_sender, receive_handler_t _handler, byte_t *_buffer, @@ -75,15 +75,21 @@ receive_cb (std::shared_ptr _data) { std::lock_guard its_lock(_data->multicast_mutex_); - if (!_data->socket_.native_non_blocking()) - _data->socket_.native_non_blocking(true, _error); + auto multicast_socket = _data->socket_.lock(); + if (!multicast_socket) { + VSOMEIP_WARNING << "udp_endpoint_receive_op::receive_cb: multicast_socket with id " << int{_data->multicast_id_} << " has expired!"; + return; + } + + if (!multicast_socket->native_non_blocking()) + multicast_socket->native_non_blocking(true, _error); for (;;) { #ifdef _WIN32 GUID WSARecvMsg_GUID = WSAID_WSARECVMSG; LPFN_WSARECVMSG WSARecvMsg; DWORD its_bytes; - SOCKET its_socket { _data->socket_.native_handle() }; + SOCKET its_socket { multicast_socket->native_handle() }; WSAIoctl(its_socket, SIO_GET_EXTENSION_FUNCTION_POINTER, &WSARecvMsg_GUID, sizeof WSARecvMsg_GUID, @@ -146,7 +152,7 @@ receive_cb (std::shared_ptr _data) { if (_error == boost::asio::error::would_block || _error == boost::asio::error::try_again) { - _data->socket_.async_wait( + multicast_socket->async_wait( socket_type_t::wait_read, receive_cb(_data) ); @@ -263,7 +269,7 @@ receive_cb (std::shared_ptr _data) { // Call recvmsg and handle its result errno = 0; - its_result = ::recvmsg(_data->socket_.native_handle(), &its_header, its_flags); + its_result = ::recvmsg(multicast_socket->native_handle(), &its_header, its_flags); _error = boost::system::error_code(its_result < 0 ? errno : 0, boost::asio::error::get_system_category()); @@ -274,7 +280,7 @@ receive_cb (std::shared_ptr _data) { if (_error == boost::asio::error::would_block || _error == boost::asio::error::try_again) { - _data->socket_.async_wait( + multicast_socket->async_wait( socket_type_t::wait_read, receive_cb(_data) ); diff --git a/implementation/endpoints/src/client_endpoint_impl.cpp b/implementation/endpoints/src/client_endpoint_impl.cpp index 58041ecae..5f7e695be 100644 --- a/implementation/endpoints/src/client_endpoint_impl.cpp +++ b/implementation/endpoints/src/client_endpoint_impl.cpp @@ -20,7 +20,7 @@ #include "../include/client_endpoint_impl.hpp" #include "../include/endpoint_host.hpp" #include "../../utility/include/utility.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" namespace vsomeip_v3 { @@ -212,10 +212,9 @@ bool client_endpoint_impl::send(const uint8_t *_data, uint32_t _size) cancel_dispatch_timer(); // STEP 3: Get configured timings - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], _data[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], _data[VSOMEIP_METHOD_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + const service_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + std::chrono::nanoseconds its_debouncing(0), its_retention(0); get_configured_times_from_endpoint(its_service, its_method, &its_debouncing, &its_retention); @@ -289,6 +288,13 @@ bool client_endpoint_impl::send(const uint8_t *_data, uint32_t _size) return true; } +template +bool client_endpoint_impl::tp_segmentation_enabled( + service_t /*_service*/, instance_t /*_instance*/, method_t /*_method*/) const { + + return false; +} + template void client_endpoint_impl::send_segments( const tp::tp_split_messages_t &_segments, std::uint32_t _separation_time) { @@ -299,12 +305,9 @@ void client_endpoint_impl::send_segments( return; } - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - (*(_segments[0]))[VSOMEIP_SERVICE_POS_MIN], - (*(_segments[0]))[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD( - (*(_segments[0]))[VSOMEIP_METHOD_POS_MIN], - (*(_segments[0]))[VSOMEIP_METHOD_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&(*(_segments[0]))[VSOMEIP_SERVICE_POS_MIN]); + const service_t its_method = bithelper::read_uint16_be(&(*(_segments[0]))[VSOMEIP_METHOD_POS_MIN]); + std::chrono::nanoseconds its_debouncing(0), its_retention(0); get_configured_times_from_endpoint(its_service, its_method, &its_debouncing, &its_retention); @@ -538,18 +541,10 @@ void client_endpoint_impl::send_cbk( client_t its_client(0); session_t its_session(0); if (_sent_msg && _sent_msg->size() > VSOMEIP_SESSION_POS_MAX) { - its_service = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_SERVICE_POS_MIN], - (*_sent_msg)[VSOMEIP_SERVICE_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_METHOD_POS_MIN], - (*_sent_msg)[VSOMEIP_METHOD_POS_MAX]); - its_client = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_CLIENT_POS_MIN], - (*_sent_msg)[VSOMEIP_CLIENT_POS_MAX]); - its_session = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_SESSION_POS_MIN], - (*_sent_msg)[VSOMEIP_SESSION_POS_MAX]); + its_service = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_SERVICE_POS_MIN]); + its_method = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_METHOD_POS_MIN]); + its_client = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_CLIENT_POS_MIN]); + its_session = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_SESSION_POS_MIN]); } VSOMEIP_WARNING << "cei::send_cbk received error: " << _error.message() << " (" << std::dec @@ -602,18 +597,10 @@ void client_endpoint_impl::send_cbk( client_t its_client(0); session_t its_session(0); if (_sent_msg && _sent_msg->size() > VSOMEIP_SESSION_POS_MAX) { - its_service = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_SERVICE_POS_MIN], - (*_sent_msg)[VSOMEIP_SERVICE_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_METHOD_POS_MIN], - (*_sent_msg)[VSOMEIP_METHOD_POS_MAX]); - its_client = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_CLIENT_POS_MIN], - (*_sent_msg)[VSOMEIP_CLIENT_POS_MAX]); - its_session = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_SESSION_POS_MIN], - (*_sent_msg)[VSOMEIP_SESSION_POS_MAX]); + its_service = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_SERVICE_POS_MIN]); + its_method = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_METHOD_POS_MIN]); + its_client = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_CLIENT_POS_MIN]); + its_session = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_SESSION_POS_MIN]); } VSOMEIP_WARNING << "cei::send_cbk received error: " << _error.message() << " (" << std::dec << _error.value() << ") " @@ -724,15 +711,12 @@ typename endpoint_impl::cms_ret_e client_endpoint_impl::chec if (endpoint_impl::max_message_size_ != MESSAGE_SIZE_UNLIMITED && _size > endpoint_impl::max_message_size_) { if (endpoint_impl::is_supporting_someip_tp_ && _data != nullptr) { - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], - _data[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); - if (tp_segmentation_enabled(its_service, its_method)) { - instance_t its_instance = this->get_instance(its_service); - if (its_instance != 0xFFFF) { + const service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + const method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + instance_t its_instance = this->get_instance(its_service); + + if (its_instance != ANY_INSTANCE) { + if (tp_segmentation_enabled(its_service, its_instance, its_method)) { std::uint16_t its_max_segment_length; std::uint32_t its_separation_time; this->configuration_->get_tp_configuration( @@ -769,14 +753,10 @@ bool client_endpoint_impl::check_queue_limit(const uint8_t *_data, std // [(Command + lowerbyte sender's client ID). // highbyte sender's client ID + lowbyte command size. // lowbyte methodid + highbyte vsomeip length] - its_service = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_SERVICE_POS_MIN], - _data[VSOMEIP_SERVICE_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); - its_client = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_CLIENT_POS_MIN], - _data[VSOMEIP_CLIENT_POS_MAX]); - its_session = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_SESSION_POS_MIN], - _data[VSOMEIP_SESSION_POS_MAX]); + its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); + its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); } VSOMEIP_ERROR << "cei::check_queue_limit: queue size limit (" << std::dec << endpoint_impl::queue_limit_ diff --git a/implementation/endpoints/src/endpoint_manager_impl.cpp b/implementation/endpoints/src/endpoint_manager_impl.cpp index d423d4590..2c685f5a1 100644 --- a/implementation/endpoints/src/endpoint_manager_impl.cpp +++ b/implementation/endpoints/src/endpoint_manager_impl.cpp @@ -21,7 +21,7 @@ #include "../../routing/include/routing_manager_impl.hpp" #include "../../routing/include/routing_host.hpp" #include "../../utility/include/utility.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #include @@ -957,8 +957,7 @@ void endpoint_manager_impl::on_error( std::uint16_t _remote_port) { instance_t its_instance = 0; if (_length >= VSOMEIP_SERVICE_POS_MAX) { - service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], _data[VSOMEIP_SERVICE_POS_MAX]); + service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); its_instance = find_instance(its_service, _receiver); } static_cast(rm_)->send_error( diff --git a/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp index 693f8f210..f0b85afdd 100644 --- a/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp @@ -355,14 +355,6 @@ std::uint32_t local_tcp_client_endpoint_impl::get_max_allowed_reconnects() const return MAX_RECONNECTS_UNLIMITED; } -bool local_tcp_client_endpoint_impl::tp_segmentation_enabled( - service_t _service, method_t _method) const { - - (void)_service; - (void)_method; - return false; -} - void local_tcp_client_endpoint_impl::max_allowed_reconnects_reached() { VSOMEIP_ERROR << "local_client_endpoint::max_allowed_reconnects_reached: " diff --git a/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp b/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp index e9ff0ee40..bec74ed81 100644 --- a/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_tcp_server_endpoint_impl.cpp @@ -21,7 +21,7 @@ #include "../../routing/include/routing_host.hpp" #include "../../security/include/policy_manager_impl.hpp" #include "../../security/include/security.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #include "../../utility/include/utility.hpp" namespace vsomeip_v3 { @@ -543,12 +543,7 @@ void local_tcp_server_endpoint_impl::connection::receive_cbk( if (!message_is_empty) { if (its_start + protocol::COMMAND_POSITION_SIZE + 3 < recv_buffer_size_ + its_iteration_gap) { - its_command_size = VSOMEIP_BYTES_TO_LONG( - recv_buffer_[its_start + protocol::COMMAND_POSITION_SIZE+3], - recv_buffer_[its_start + protocol::COMMAND_POSITION_SIZE+2], - recv_buffer_[its_start + protocol::COMMAND_POSITION_SIZE+1], - recv_buffer_[its_start + protocol::COMMAND_POSITION_SIZE]); - + its_command_size = bithelper::read_uint32_le(&recv_buffer_[its_start + protocol::COMMAND_POSITION_SIZE]); its_end = its_start + protocol::COMMAND_POSITION_SIZE + 3 + its_command_size; } else { its_end = its_start; @@ -652,7 +647,7 @@ void local_tcp_server_endpoint_impl::connection::receive_cbk( = htonl(uint32_t(its_address.to_v4().to_ulong())); } sec_client_.port = htons(its_port); - security::sync_client(&sec_client_); + its_server->configuration_->get_security()->sync_client(&sec_client_); its_host->on_message(&recv_buffer_[its_start], uint32_t(its_end - its_start), its_server.get(), @@ -706,7 +701,7 @@ void local_tcp_server_endpoint_impl::connection::receive_cbk( || is_error) { shutdown_and_close(); its_server->remove_connection(bound_client_); - policy_manager_impl::get()->remove_client_to_sec_client_mapping(bound_client_); + its_server->configuration_->get_policy_manager()->remove_client_to_sec_client_mapping(bound_client_); } else if (_error != boost::asio::error::bad_descriptor) { start(); } @@ -909,12 +904,4 @@ local_tcp_server_endpoint_impl::send_client_identifier( send(&its_buffer[0], static_cast(its_buffer.size())); } -bool local_tcp_server_endpoint_impl::tp_segmentation_enabled( - service_t _service, method_t _method) const { - - (void)_service; - (void)_method; - return false; -} - } // namespace vsomeip_v3 diff --git a/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp b/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp index 56c621dbc..96f0ecf8f 100644 --- a/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_uds_client_endpoint_impl.cpp @@ -258,6 +258,11 @@ void local_uds_client_endpoint_impl::receive_cbk( if (_error == boost::asio::error::operation_aborted) { // endpoint was stopped return; + } else if (_error == boost::asio::error::eof) { + std::lock_guard its_lock(mutex_); + sending_blocked_ = false; + queue_.clear(); + queue_size_ = 0; } else if (_error == boost::asio::error::connection_reset || _error == boost::asio::error::bad_descriptor) { restart(true); @@ -361,14 +366,6 @@ std::uint32_t local_uds_client_endpoint_impl::get_max_allowed_reconnects() const return 13; } -bool local_uds_client_endpoint_impl::tp_segmentation_enabled( - service_t _service, method_t _method) const { - - (void)_service; - (void)_method; - return false; -} - void local_uds_client_endpoint_impl::max_allowed_reconnects_reached() { VSOMEIP_ERROR << "local_client_endpoint::max_allowed_reconnects_reached: " diff --git a/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp b/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp index 33876c56c..bbc72f861 100644 --- a/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/local_uds_server_endpoint_impl.cpp @@ -23,7 +23,7 @@ #include "../../protocol/include/assign_client_ack_command.hpp" #include "../../routing/include/routing_host.hpp" #include "../../security/include/policy_manager_impl.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #include "../../utility/include/utility.hpp" namespace vsomeip_v3 { @@ -341,7 +341,7 @@ void local_uds_server_endpoint_impl::accept_cbk( std::shared_ptr its_routing_host = routing_host_.lock(); its_routing_host->add_known_client(its_client, its_client_host); - if (!policy_manager_impl::get()->check_credentials(its_client, &its_sec_client)) { + if (!configuration_->get_policy_manager()->check_credentials(its_client, &its_sec_client)) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << its_host->get_client() << " received client credentials from client 0x" << its_client << " which violates the security policy : uid/gid=" @@ -358,8 +358,8 @@ void local_uds_server_endpoint_impl::accept_cbk( add_connection(its_client, _connection); } } else { - policy_manager_impl::get()->store_client_to_sec_client_mapping(its_client, &its_sec_client); - policy_manager_impl::get()->store_sec_client_to_client_mapping(&its_sec_client, its_client); + configuration_->get_policy_manager()->store_client_to_sec_client_mapping(its_client, &its_sec_client); + configuration_->get_policy_manager()->store_sec_client_to_client_mapping(&its_sec_client, its_client); if (!is_routing_endpoint_) { std::shared_ptr its_routing_host = routing_host_.lock(); @@ -677,12 +677,7 @@ void local_uds_server_endpoint_impl::connection::receive_cbk( if (!message_is_empty) { if (its_start + protocol::COMMAND_POSITION_SIZE + 3 < recv_buffer_size_ + its_iteration_gap) { - its_command_size = VSOMEIP_BYTES_TO_LONG( - recv_buffer_[its_start + protocol::COMMAND_POSITION_SIZE+3], - recv_buffer_[its_start + protocol::COMMAND_POSITION_SIZE+2], - recv_buffer_[its_start + protocol::COMMAND_POSITION_SIZE+1], - recv_buffer_[its_start + protocol::COMMAND_POSITION_SIZE]); - + its_command_size = bithelper::read_uint32_le(&recv_buffer_[its_start + protocol::COMMAND_POSITION_SIZE]); its_end = its_start + protocol::COMMAND_POSITION_SIZE + 3 + its_command_size; } else { its_end = its_start; @@ -781,7 +776,7 @@ void local_uds_server_endpoint_impl::connection::receive_cbk( << " because of already existing connection using same client ID"; stop(); return; - } else if (!policy_manager_impl::get()->check_credentials( + } else if (!its_server->configuration_->get_policy_manager()->check_credentials( its_client, &sec_client_)) { VSOMEIP_WARNING << std::hex << "Client 0x" << its_host->get_client() << " received client credentials from client 0x" << its_client @@ -859,7 +854,7 @@ void local_uds_server_endpoint_impl::connection::receive_cbk( || is_error) { shutdown_and_close(); its_server->remove_connection(bound_client_); - policy_manager_impl::get()->remove_client_to_sec_client_mapping(bound_client_); + its_server->configuration_->get_policy_manager()->remove_client_to_sec_client_mapping(bound_client_); } else if (_error != boost::asio::error::bad_descriptor) { start(); } @@ -1070,12 +1065,4 @@ local_uds_server_endpoint_impl::send_client_identifier( send(&its_buffer[0], static_cast(its_buffer.size())); } -bool local_uds_server_endpoint_impl::tp_segmentation_enabled( - service_t _service, method_t _method) const { - - (void)_service; - (void)_method; - return false; -} - } // namespace vsomeip_v3 diff --git a/implementation/endpoints/src/server_endpoint_impl.cpp b/implementation/endpoints/src/server_endpoint_impl.cpp index 120175367..5e1bf820c 100644 --- a/implementation/endpoints/src/server_endpoint_impl.cpp +++ b/implementation/endpoints/src/server_endpoint_impl.cpp @@ -25,7 +25,7 @@ #include "../include/server_endpoint_impl.hpp" #include "../include/endpoint_definition.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #include "../../utility/include/utility.hpp" #include "../../service_discovery/include/defines.hpp" @@ -52,12 +52,23 @@ void server_endpoint_impl::prepare_stop( const endpoint::prepare_stop_handler_t &_handler, service_t _service) { std::lock_guard its_lock(mutex_); - bool queued_train(false); std::vector its_erased; boost::system::error_code ec; - if (_service == ANY_SERVICE) { // endpoint is shutting down completely + if (_service == ANY_SERVICE) { endpoint_impl::sending_blocked_ = true; + if (std::all_of(targets_.begin(), targets_.end(), + [&](const typename target_data_type::value_type &_t) + { return _t.second.queue_.empty(); })) { + // nothing was queued and all queues are empty -> ensure cbk is called + auto ptr = this->shared_from_this(); + endpoint_impl::io_.post([ptr, _handler, _service](){ + _handler(ptr, _service); + }); + } else { + prepare_stop_handlers_[_service] = _handler; + } + for (auto t = targets_.begin(); t != targets_.end(); t++) { auto its_train (t->second.train_); // cancel dispatch timer @@ -65,10 +76,32 @@ void server_endpoint_impl::prepare_stop( if (its_train->buffer_->size() > 0) { if (queue_train(t, its_train)) its_erased.push_back(t); - queued_train = true; } } } else { + // check if any of the queues contains a message of to be stopped service + bool found_service_msg(false); + for (const auto &t : targets_) { + for (const auto &q : t.second.queue_) { + const service_t its_service = bithelper::read_uint16_be(&(*q.first)[VSOMEIP_SERVICE_POS_MIN]); + if (its_service == _service) { + found_service_msg = true; + break; + } + } + if (found_service_msg) { + break; + } + } + if (found_service_msg) { + prepare_stop_handlers_[_service] = _handler; + } else { // no messages of the to be stopped service are or have been queued + auto ptr = this->shared_from_this(); + endpoint_impl::io_.post([ptr, _handler, _service](){ + _handler(ptr, _service); + }); + } + for (auto t = targets_.begin(); t != targets_.end(); t++) { auto its_train(t->second.train_); for (auto const& passenger_iter : its_train->passengers_) { @@ -78,7 +111,6 @@ void server_endpoint_impl::prepare_stop( // TODO: Queue all(!) trains here... if (queue_train(t, its_train)) its_erased.push_back(t); - queued_train = true; break; } } @@ -87,49 +119,6 @@ void server_endpoint_impl::prepare_stop( for (const auto t : its_erased) targets_.erase(t); - - if (!queued_train) { - if (_service == ANY_SERVICE) { - if (std::all_of(targets_.begin(), targets_.end(), - [&](const typename target_data_type::value_type &_t) - { return _t.second.queue_.empty(); })) { - // nothing was queued and all queues are empty -> ensure cbk is called - auto ptr = this->shared_from_this(); - endpoint_impl::io_.post([ptr, _handler, _service](){ - _handler(ptr, _service); - }); - } else { - prepare_stop_handlers_[_service] = _handler; - } - } else { - // check if any of the queues contains a message of to be stopped service - bool found_service_msg(false); - for (const auto &t : targets_) { - for (const auto &q : t.second.queue_) { - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - (*q.first)[VSOMEIP_SERVICE_POS_MIN], - (*q.first)[VSOMEIP_SERVICE_POS_MAX]); - if (its_service == _service) { - found_service_msg = true; - break; - } - } - if (found_service_msg) { - break; - } - } - if (found_service_msg) { - prepare_stop_handlers_[_service] = _handler; - } else { // no messages of the to be stopped service are or have been queued - auto ptr = this->shared_from_this(); - endpoint_impl::io_.post([ptr, _handler, _service](){ - _handler(ptr, _service); - }); - } - } - } else { - prepare_stop_handlers_[_service] = _handler; - } } template @@ -186,12 +175,9 @@ templatebool server_endpoint_impl::send(const uint8 return false; } - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], _data[VSOMEIP_SERVICE_POS_MAX]); - const client_t its_client = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_CLIENT_POS_MIN], _data[VSOMEIP_CLIENT_POS_MAX]); - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SESSION_POS_MIN], _data[VSOMEIP_SESSION_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + const client_t its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); + const session_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); clients_mutex_.lock(); auto found_client = clients_.find(its_client); @@ -205,9 +191,8 @@ templatebool server_endpoint_impl::send(const uint8 VSOMEIP_WARNING << "server_endpoint::send: session_id 0x" << std::hex << its_session << " not found for client 0x" << its_client; - const method_t its_method = - VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); + const method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + if (its_service == VSOMEIP_SD_SERVICE && its_method == VSOMEIP_SD_METHOD) { VSOMEIP_ERROR << "Clearing clients map as a request was " @@ -254,15 +239,11 @@ bool server_endpoint_impl::send_intern( break; } if (!prepare_stop_handlers_.empty()) { - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], _data[VSOMEIP_SERVICE_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); if (prepare_stop_handlers_.find(its_service) != prepare_stop_handlers_.end()) { - const method_t its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], _data[VSOMEIP_METHOD_POS_MAX]); - const client_t its_client = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_CLIENT_POS_MIN], _data[VSOMEIP_CLIENT_POS_MAX]); - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SESSION_POS_MIN], _data[VSOMEIP_SESSION_POS_MAX]); + const method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + const client_t its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); + const session_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); VSOMEIP_WARNING << "server_endpoint::send: Service is stopping, ignoring message: [" << std::hex << std::setfill('0') << std::setw(4) << its_service << "." @@ -294,10 +275,8 @@ bool server_endpoint_impl::send_intern( cancel_dispatch_timer(its_target_iterator); // STEP 3: Get configured timings - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], _data[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + const method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); std::chrono::nanoseconds its_debouncing(0), its_retention(0); if (its_service != VSOMEIP_SD_SERVICE && its_method != VSOMEIP_SD_METHOD) { @@ -374,6 +353,13 @@ bool server_endpoint_impl::send_intern( return true; } +template +bool server_endpoint_impl::tp_segmentation_enabled( + service_t /*_service*/, instance_t /*_instance*/, method_t /*_method*/) const { + + return false; +} + template void server_endpoint_impl::send_segments( const tp::tp_split_messages_t &_segments, std::uint32_t _separation_time, @@ -387,10 +373,8 @@ void server_endpoint_impl::send_segments( auto its_now(std::chrono::steady_clock::now()); - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - (*(_segments[0]))[VSOMEIP_SERVICE_POS_MIN], (*(_segments[0]))[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD( - (*(_segments[0]))[VSOMEIP_METHOD_POS_MIN], (*(_segments[0]))[VSOMEIP_METHOD_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&(*(_segments[0]))[VSOMEIP_SERVICE_POS_MIN]); + const method_t its_method = bithelper::read_uint16_be(&(*(_segments[0]))[VSOMEIP_METHOD_POS_MIN]); std::chrono::nanoseconds its_debouncing(0), its_retention(0); if (its_service != VSOMEIP_SD_SERVICE && its_method != VSOMEIP_SD_METHOD) { @@ -462,15 +446,12 @@ typename endpoint_impl::cms_ret_e server_endpoint_impl::chec if (endpoint_impl::max_message_size_ != MESSAGE_SIZE_UNLIMITED && _size > endpoint_impl::max_message_size_) { if (endpoint_impl::is_supporting_someip_tp_ && _data != nullptr) { - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], - _data[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); - if (tp_segmentation_enabled(its_service, its_method)) { - instance_t its_instance = this->get_instance(its_service); - if (its_instance != 0xFFFF) { + const service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + const method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + instance_t its_instance = this->get_instance(its_service); + + if (its_instance != ANY_INSTANCE) { + if (tp_segmentation_enabled(its_service, its_instance, its_method)) { std::uint16_t its_max_segment_length; std::uint32_t its_separation_time; @@ -509,14 +490,10 @@ bool server_endpoint_impl::check_queue_limit(const uint8_t *_data, std // [(Command + lowerbyte sender's client ID). // highbyte sender's client ID + lowbyte command size. // lowbyte methodid + highbyte vsomeip length] - its_service = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_SERVICE_POS_MIN], - _data[VSOMEIP_SERVICE_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); - its_client = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_CLIENT_POS_MIN], - _data[VSOMEIP_CLIENT_POS_MAX]); - its_session = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_SESSION_POS_MIN], - _data[VSOMEIP_SESSION_POS_MAX]); + its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); + its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); } VSOMEIP_ERROR << "sei::send_intern: queue size limit (" << std::dec << endpoint_impl::queue_limit_ @@ -627,9 +604,7 @@ void server_endpoint_impl::send_cbk( } for (const auto& t : targets_) { for (const auto& e : t.second.queue_ ) { - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - (*e.first)[VSOMEIP_SERVICE_POS_MIN], - (*e.first)[VSOMEIP_SERVICE_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&(*e.first)[VSOMEIP_SERVICE_POS_MIN]); if (its_service == its_stopped_service) { found_service_msg = true; break; @@ -698,18 +673,10 @@ void server_endpoint_impl::send_cbk( session_t& its_session ) { if (buffer && buffer->size() > VSOMEIP_SESSION_POS_MAX) { - its_service = VSOMEIP_BYTES_TO_WORD( - (*buffer)[VSOMEIP_SERVICE_POS_MIN], - (*buffer)[VSOMEIP_SERVICE_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD( - (*buffer)[VSOMEIP_METHOD_POS_MIN], - (*buffer)[VSOMEIP_METHOD_POS_MAX]); - its_client = VSOMEIP_BYTES_TO_WORD( - (*buffer)[VSOMEIP_CLIENT_POS_MIN], - (*buffer)[VSOMEIP_CLIENT_POS_MAX]); - its_session = VSOMEIP_BYTES_TO_WORD( - (*buffer)[VSOMEIP_SESSION_POS_MIN], - (*buffer)[VSOMEIP_SESSION_POS_MAX]); + its_service = bithelper::read_uint16_be(&(*buffer)[VSOMEIP_SERVICE_POS_MIN]); + its_method = bithelper::read_uint16_be(&(*buffer)[VSOMEIP_METHOD_POS_MIN]); + its_client = bithelper::read_uint16_be(&(*buffer)[VSOMEIP_CLIENT_POS_MIN]); + its_session = bithelper::read_uint16_be(&(*buffer)[VSOMEIP_SESSION_POS_MIN]); } }; @@ -798,14 +765,14 @@ void server_endpoint_impl::flush_cbk( template void server_endpoint_impl::remove_stop_handler(service_t _service) { - - std::ostream&& its_services_log{VSOMEIP_INFO}; + std::stringstream its_services_log; its_services_log << __func__ << ": "; std::lock_guard its_lock{mutex_}; for (const auto &its_service : prepare_stop_handlers_) its_services_log << std::hex << std::setw(4) << std::setfill('0') << its_service.first << ' '; + VSOMEIP_INFO << its_services_log.str(); prepare_stop_handlers_.erase(_service); } diff --git a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp index e67551573..ade0990ac 100644 --- a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp @@ -15,7 +15,7 @@ #include "../../routing/include/routing_host.hpp" #include "../include/tcp_client_endpoint_impl.hpp" #include "../../utility/include/utility.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" namespace ip = boost::asio::ip; @@ -102,18 +102,10 @@ void tcp_client_endpoint_impl::restart(bool _force) { { std::lock_guard its_lock(self->mutex_); for (const auto &q : self->queue_) { - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - (*q.first)[VSOMEIP_SERVICE_POS_MIN], - (*q.first)[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD( - (*q.first)[VSOMEIP_METHOD_POS_MIN], - (*q.first)[VSOMEIP_METHOD_POS_MAX]); - const client_t its_client = VSOMEIP_BYTES_TO_WORD( - (*q.first)[VSOMEIP_CLIENT_POS_MIN], - (*q.first)[VSOMEIP_CLIENT_POS_MAX]); - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - (*q.first)[VSOMEIP_SESSION_POS_MIN], - (*q.first)[VSOMEIP_SESSION_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&(*q.first)[VSOMEIP_SERVICE_POS_MIN]); + const method_t its_method = bithelper::read_uint16_be(&(*q.first)[VSOMEIP_METHOD_POS_MIN]); + const client_t its_client = bithelper::read_uint16_be(&(*q.first)[VSOMEIP_CLIENT_POS_MIN]); + const session_t its_session = bithelper::read_uint16_be(&(*q.first)[VSOMEIP_SESSION_POS_MIN]); VSOMEIP_WARNING << "tce::restart: dropping message: " << "remote:" << self->get_address_port_remote() << " (" << std::hex << std::setfill('0') @@ -123,6 +115,7 @@ void tcp_client_endpoint_impl::restart(bool _force) { << std::setw(4) << its_session << "]" << " size: " << std::dec << q.first->size(); } + self->sending_blocked_ = false; self->queue_.clear(); self->queue_size_ = 0; } @@ -137,7 +130,7 @@ void tcp_client_endpoint_impl::restart(bool _force) { void tcp_client_endpoint_impl::connect() { start_connecting_timer(); - std::lock_guard its_lock(socket_mutex_); + std::unique_lock its_lock(socket_mutex_); boost::system::error_code its_error; socket_->open(remote_.protocol(), its_error); @@ -195,6 +188,8 @@ void tcp_client_endpoint_impl::connect() { << " local: " << get_address_port_local() << " remote:" << get_address_port_remote(); + its_lock.unlock(); + std::shared_ptr its_host = endpoint_host_.lock(); if (its_host) { // set new client port depending on service / instance / remote port @@ -327,19 +322,10 @@ void tcp_client_endpoint_impl::receive(message_buffer_ptr_t _recv_buffer, } void tcp_client_endpoint_impl::send_queued(std::pair &_entry) { - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - (*_entry.first)[VSOMEIP_SERVICE_POS_MIN], - (*_entry.first)[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD( - (*_entry.first)[VSOMEIP_METHOD_POS_MIN], - (*_entry.first)[VSOMEIP_METHOD_POS_MAX]); - const client_t its_client = VSOMEIP_BYTES_TO_WORD( - (*_entry.first)[VSOMEIP_CLIENT_POS_MIN], - (*_entry.first)[VSOMEIP_CLIENT_POS_MAX]); - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - (*_entry.first)[VSOMEIP_SESSION_POS_MIN], - (*_entry.first)[VSOMEIP_SESSION_POS_MAX]); - + const service_t its_service = bithelper::read_uint16_be(&(*_entry.first)[VSOMEIP_SERVICE_POS_MIN]); + const method_t its_method = bithelper::read_uint16_be(&(*_entry.first)[VSOMEIP_METHOD_POS_MIN]); + const client_t its_client = bithelper::read_uint16_be(&(*_entry.first)[VSOMEIP_CLIENT_POS_MIN]); + const session_t its_session = bithelper::read_uint16_be(&(*_entry.first)[VSOMEIP_SESSION_POS_MIN]); if (has_enabled_magic_cookies_) { const std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); @@ -976,18 +962,10 @@ void tcp_client_endpoint_impl::send_cbk(boost::system::error_code const &_error, client_t its_client(0); session_t its_session(0); if (_sent_msg && _sent_msg->size() > VSOMEIP_SESSION_POS_MAX) { - its_service = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_SERVICE_POS_MIN], - (*_sent_msg)[VSOMEIP_SERVICE_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_METHOD_POS_MIN], - (*_sent_msg)[VSOMEIP_METHOD_POS_MAX]); - its_client = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_CLIENT_POS_MIN], - (*_sent_msg)[VSOMEIP_CLIENT_POS_MAX]); - its_session = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_SESSION_POS_MIN], - (*_sent_msg)[VSOMEIP_SESSION_POS_MAX]); + its_service = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_SERVICE_POS_MIN]); + its_method = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_METHOD_POS_MIN]); + its_client = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_CLIENT_POS_MIN]); + its_session = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_SESSION_POS_MIN]); } VSOMEIP_WARNING << "tce::send_cbk received error: " << _error.message() << " (" << std::dec @@ -1002,13 +980,6 @@ void tcp_client_endpoint_impl::send_cbk(boost::system::error_code const &_error, } } -bool tcp_client_endpoint_impl::tp_segmentation_enabled(service_t _service, - method_t _method) const { - (void)_service; - (void)_method; - return false; -} - std::uint32_t tcp_client_endpoint_impl::get_max_allowed_reconnects() const { return MAX_RECONNECTS_UNLIMITED; } diff --git a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp index 5aef72be9..38b336e97 100644 --- a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp @@ -16,7 +16,7 @@ #include "../../routing/include/routing_host.hpp" #include "../include/tcp_server_endpoint_impl.hpp" #include "../../utility/include/utility.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" namespace ip = boost::asio::ip; @@ -175,9 +175,7 @@ bool tcp_server_endpoint_impl::send_queued(const target_data_iterator_type _it) for (const auto &its_q : _it->second.queue_) { auto its_buffer(its_q.first); if (its_buffer && its_buffer->size() > VSOMEIP_SESSION_POS_MAX) { - service_t its_service = VSOMEIP_BYTES_TO_WORD( - (*its_buffer)[VSOMEIP_SERVICE_POS_MIN], - (*its_buffer)[VSOMEIP_SERVICE_POS_MAX]); + service_t its_service = bithelper::read_uint16_be(&(*its_buffer)[VSOMEIP_SERVICE_POS_MIN]); its_services.insert(its_service); } } @@ -458,18 +456,10 @@ void tcp_server_endpoint_impl::connection::send_queued( return; } message_buffer_ptr_t its_buffer = _it->second.queue_.front().first; - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - (*its_buffer)[VSOMEIP_SERVICE_POS_MIN], - (*its_buffer)[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD( - (*its_buffer)[VSOMEIP_METHOD_POS_MIN], - (*its_buffer)[VSOMEIP_METHOD_POS_MAX]); - const client_t its_client = VSOMEIP_BYTES_TO_WORD( - (*its_buffer)[VSOMEIP_CLIENT_POS_MIN], - (*its_buffer)[VSOMEIP_CLIENT_POS_MAX]); - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - (*its_buffer)[VSOMEIP_SESSION_POS_MIN], - (*its_buffer)[VSOMEIP_SESSION_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&(*its_buffer)[VSOMEIP_SERVICE_POS_MIN]); + const method_t its_method = bithelper::read_uint16_be(&(*its_buffer)[VSOMEIP_METHOD_POS_MIN]); + const client_t its_client = bithelper::read_uint16_be(&(*its_buffer)[VSOMEIP_CLIENT_POS_MIN]); + const session_t its_session = bithelper::read_uint16_be(&(*its_buffer)[VSOMEIP_SESSION_POS_MIN]); if (magic_cookies_enabled_) { const std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); @@ -594,13 +584,9 @@ void tcp_server_endpoint_impl::connection::receive_cbk( if (utility::is_request( recv_buffer_[its_iteration_gap + VSOMEIP_MESSAGE_TYPE_POS])) { - const client_t its_client = VSOMEIP_BYTES_TO_WORD( - recv_buffer_[its_iteration_gap + VSOMEIP_CLIENT_POS_MIN], - recv_buffer_[its_iteration_gap + VSOMEIP_CLIENT_POS_MAX]); + const client_t its_client = bithelper::read_uint16_be(&recv_buffer_[its_iteration_gap + VSOMEIP_CLIENT_POS_MIN]); if (its_client != MAGIC_COOKIE_CLIENT) { - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - recv_buffer_[its_iteration_gap + VSOMEIP_SESSION_POS_MIN], - recv_buffer_[its_iteration_gap + VSOMEIP_SESSION_POS_MAX]); + const session_t its_session = bithelper::read_uint16_be(&recv_buffer_[its_iteration_gap + VSOMEIP_SESSION_POS_MIN]); its_server->clients_mutex_.lock(); its_server->clients_[its_client][its_session] = remote_; its_server->clients_mutex_.unlock(); @@ -996,13 +982,6 @@ std::string tcp_server_endpoint_impl::get_remote_information( + std::to_string(_remote.port()); } -bool tcp_server_endpoint_impl::tp_segmentation_enabled(service_t _service, - method_t _method) const { - (void)_service; - (void)_method; - return false; -} - void tcp_server_endpoint_impl::connection::wait_until_sent(const boost::system::error_code &_error) { std::shared_ptr its_server(server_.lock()); diff --git a/implementation/endpoints/src/tp.cpp b/implementation/endpoints/src/tp.cpp index 359995086..b0879aafd 100644 --- a/implementation/endpoints/src/tp.cpp +++ b/implementation/endpoints/src/tp.cpp @@ -8,7 +8,6 @@ #include #include "../include/tp.hpp" -#include "../../utility/include/byteorder.hpp" #ifdef ANDROID #include "../../configuration/include/internal_android.hpp" diff --git a/implementation/endpoints/src/tp_message.cpp b/implementation/endpoints/src/tp_message.cpp index 986976f08..6899ebf60 100644 --- a/implementation/endpoints/src/tp_message.cpp +++ b/implementation/endpoints/src/tp_message.cpp @@ -10,7 +10,7 @@ #include "../include/tp_message.hpp" #include "../include/tp.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #ifdef ANDROID #include "../../configuration/include/internal_android.hpp" @@ -47,11 +47,7 @@ tp_message::tp_message(const byte_t* const _data, std::uint32_t _data_length, const length_t its_segment_size = _data_length - VSOMEIP_FULL_HEADER_SIZE - VSOMEIP_TP_HEADER_SIZE; - const tp_header_t its_tp_header = VSOMEIP_BYTES_TO_LONG( - _data[VSOMEIP_TP_HEADER_POS_MIN], - _data[VSOMEIP_TP_HEADER_POS_MIN + 1], - _data[VSOMEIP_TP_HEADER_POS_MIN + 2], - _data[VSOMEIP_TP_HEADER_POS_MAX]); + const tp_header_t its_tp_header = bithelper::read_uint32_be(&_data[VSOMEIP_TP_HEADER_POS_MIN]); if (check_lengths(_data, _data_length, its_segment_size, tp::more_segments(its_tp_header))) { @@ -82,11 +78,7 @@ bool tp_message::add_segment(const byte_t* const _data, const length_t its_segment_size = _data_length - VSOMEIP_FULL_HEADER_SIZE - VSOMEIP_TP_HEADER_SIZE; - const tp_header_t its_tp_header = VSOMEIP_BYTES_TO_LONG( - _data[VSOMEIP_TP_HEADER_POS_MIN], - _data[VSOMEIP_TP_HEADER_POS_MIN + 1], - _data[VSOMEIP_TP_HEADER_POS_MIN + 2], - _data[VSOMEIP_TP_HEADER_POS_MAX]); + const tp_header_t its_tp_header = bithelper::read_uint32_be(&_data[VSOMEIP_TP_HEADER_POS_MIN]); if (check_lengths(_data, _data_length, its_segment_size, tp::more_segments(its_tp_header))) { @@ -259,14 +251,11 @@ std::chrono::steady_clock::time_point tp_message::get_creation_time() const { std::string tp_message::get_message_id(const byte_t* const _data, std::uint32_t _data_length) { std::stringstream ss; if (_data_length >= VSOMEIP_FULL_HEADER_SIZE) { - const service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], _data[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], _data[VSOMEIP_METHOD_POS_MAX]); - const client_t its_client = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_CLIENT_POS_MIN], _data[VSOMEIP_CLIENT_POS_MAX]); - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SESSION_POS_MIN], _data[VSOMEIP_SESSION_POS_MAX]); + + const service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + const service_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + const service_t its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); + const service_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); const interface_version_t its_interface_version = _data[VSOMEIP_INTERFACE_VERSION_POS]; const message_type_e its_msg_type = tp::tp_flag_unset( @@ -282,11 +271,7 @@ std::string tp_message::get_message_id(const byte_t* const _data, std::uint32_t << std::setw(4) << its_session << "] "; if (_data_length > VSOMEIP_TP_HEADER_POS_MAX) { - const tp_header_t its_tp_header = VSOMEIP_BYTES_TO_LONG( - _data[VSOMEIP_TP_HEADER_POS_MIN], - _data[VSOMEIP_TP_HEADER_POS_MIN + 1], - _data[VSOMEIP_TP_HEADER_POS_MIN + 2], - _data[VSOMEIP_TP_HEADER_POS_MAX]); + const tp_header_t its_tp_header = bithelper::read_uint32_be(&_data[VSOMEIP_TP_HEADER_POS_MIN]); const length_t its_offset = tp::get_offset(its_tp_header); ss << " TP offset: 0x" << std::hex << its_offset << " "; } @@ -297,17 +282,11 @@ std::string tp_message::get_message_id(const byte_t* const _data, std::uint32_t bool tp_message::check_lengths(const byte_t* const _data, std::uint32_t _data_length, length_t _segment_size, bool _more_fragments) { - const length_t its_length = VSOMEIP_BYTES_TO_LONG( - _data[VSOMEIP_LENGTH_POS_MIN], - _data[VSOMEIP_LENGTH_POS_MIN + 1], - _data[VSOMEIP_LENGTH_POS_MIN + 2], - _data[VSOMEIP_LENGTH_POS_MAX]); - const tp_header_t its_tp_header = VSOMEIP_BYTES_TO_LONG( - _data[VSOMEIP_TP_HEADER_POS_MIN], - _data[VSOMEIP_TP_HEADER_POS_MIN + 1], - _data[VSOMEIP_TP_HEADER_POS_MIN + 2], - _data[VSOMEIP_TP_HEADER_POS_MAX]); + + const length_t its_length = bithelper::read_uint32_be(&_data[VSOMEIP_LENGTH_POS_MIN]); + const tp_header_t its_tp_header = bithelper::read_uint32_be(&_data[VSOMEIP_TP_HEADER_POS_MIN]); bool ret(true); + if (!tp::tp_flag_is_set(_data[VSOMEIP_MESSAGE_TYPE_POS])) { VSOMEIP_ERROR << __func__ << ": TP flag not set " << get_message_id(_data, _data_length); diff --git a/implementation/endpoints/src/tp_reassembler.cpp b/implementation/endpoints/src/tp_reassembler.cpp index a1d0b45ae..42ad97b88 100644 --- a/implementation/endpoints/src/tp_reassembler.cpp +++ b/implementation/endpoints/src/tp_reassembler.cpp @@ -12,7 +12,7 @@ #include #include "../include/tp.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #ifdef ANDROID #include "../../configuration/include/internal_android.hpp" @@ -39,14 +39,10 @@ std::pair tp_reassembler::process_tp_message( cleanup_timer_start(false); - const service_t its_service = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_SERVICE_POS_MIN], - _data[VSOMEIP_SERVICE_POS_MAX]); - const method_t its_method = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); - const client_t its_client = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_CLIENT_POS_MIN], - _data[VSOMEIP_CLIENT_POS_MAX]); - const session_t its_session = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_SESSION_POS_MIN], - _data[VSOMEIP_SESSION_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + const method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + const client_t its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); + const session_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); const interface_version_t its_interface_version = _data[VSOMEIP_INTERFACE_VERSION_POS]; const message_type_e its_msg_type = tp::tp_flag_unset(_data[VSOMEIP_MESSAGE_TYPE_POS]); diff --git a/implementation/endpoints/src/udp_client_endpoint_impl.cpp b/implementation/endpoints/src/udp_client_endpoint_impl.cpp index f52b23540..6c3c6c00b 100644 --- a/implementation/endpoints/src/udp_client_endpoint_impl.cpp +++ b/implementation/endpoints/src/udp_client_endpoint_impl.cpp @@ -15,7 +15,7 @@ #include "../../routing/include/routing_host.hpp" #include "../include/udp_client_endpoint_impl.hpp" #include "../../utility/include/utility.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" namespace vsomeip_v3 { @@ -560,18 +560,10 @@ void udp_client_endpoint_impl::send_cbk(boost::system::error_code const &_error, client_t its_client(0); session_t its_session(0); if (_sent_msg && _sent_msg->size() > VSOMEIP_SESSION_POS_MAX) { - its_service = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_SERVICE_POS_MIN], - (*_sent_msg)[VSOMEIP_SERVICE_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_METHOD_POS_MIN], - (*_sent_msg)[VSOMEIP_METHOD_POS_MAX]); - its_client = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_CLIENT_POS_MIN], - (*_sent_msg)[VSOMEIP_CLIENT_POS_MAX]); - its_session = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_SESSION_POS_MIN], - (*_sent_msg)[VSOMEIP_SESSION_POS_MAX]); + its_service = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_SERVICE_POS_MIN]); + its_method = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_METHOD_POS_MIN]); + its_client = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_CLIENT_POS_MIN]); + its_session = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_SESSION_POS_MIN]); } VSOMEIP_WARNING << "uce::send_cbk received error: " << _error.message() << " (" << std::dec @@ -636,18 +628,10 @@ void udp_client_endpoint_impl::send_cbk(boost::system::error_code const &_error, client_t its_client(0); session_t its_session(0); if (_sent_msg && _sent_msg->size() > VSOMEIP_SESSION_POS_MAX) { - its_service = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_SERVICE_POS_MIN], - (*_sent_msg)[VSOMEIP_SERVICE_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_METHOD_POS_MIN], - (*_sent_msg)[VSOMEIP_METHOD_POS_MAX]); - its_client = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_CLIENT_POS_MIN], - (*_sent_msg)[VSOMEIP_CLIENT_POS_MAX]); - its_session = VSOMEIP_BYTES_TO_WORD( - (*_sent_msg)[VSOMEIP_SESSION_POS_MIN], - (*_sent_msg)[VSOMEIP_SESSION_POS_MAX]); + its_service = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_SERVICE_POS_MIN]); + its_method = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_METHOD_POS_MIN]); + its_client = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_CLIENT_POS_MIN]); + its_session = bithelper::read_uint16_be(&(*_sent_msg)[VSOMEIP_SESSION_POS_MIN]); } VSOMEIP_WARNING << "uce::send_cbk received error: " << _error.message() << " (" << std::dec << _error.value() << ") " @@ -667,11 +651,9 @@ void udp_client_endpoint_impl::send_cbk(boost::system::error_code const &_error, } bool udp_client_endpoint_impl::tp_segmentation_enabled( - service_t _service, method_t _method) const { + service_t _service, instance_t _instance, method_t _method) const { - return configuration_->is_tp_client(_service, - remote_address_.to_string(), remote_port_, - _method); + return configuration_->is_tp_client(_service, _instance, _method); } bool udp_client_endpoint_impl::is_reliable() const { diff --git a/implementation/endpoints/src/udp_server_endpoint_impl.cpp b/implementation/endpoints/src/udp_server_endpoint_impl.cpp index 587fb94c2..1cc3f562a 100644 --- a/implementation/endpoints/src/udp_server_endpoint_impl.cpp +++ b/implementation/endpoints/src/udp_server_endpoint_impl.cpp @@ -24,7 +24,7 @@ #include "../../configuration/include/configuration.hpp" #include "../../routing/include/routing_host.hpp" #include "../../service_discovery/include/defines.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #include "../../utility/include/utility.hpp" namespace ip = boost::asio::ip; @@ -242,7 +242,7 @@ void udp_server_endpoint_impl::receive_multicast(uint8_t _multicast_id) { #if VSOMEIP_BOOST_VERSION >= 106600 auto its_storage = std::make_shared( multicast_mutex_, - *multicast_socket_, + multicast_socket_, multicast_remote_, std::bind( &udp_server_endpoint_impl::on_multicast_received, @@ -357,7 +357,7 @@ bool udp_server_endpoint_impl::send_queued( ) ); - return false; + return true; } void udp_server_endpoint_impl::get_configured_times_from_endpoint( @@ -631,44 +631,39 @@ void udp_server_endpoint_impl::on_message_received( return; } remaining_bytes -= current_message_size; - const service_t its_service = VSOMEIP_BYTES_TO_WORD(_buffer[i + VSOMEIP_SERVICE_POS_MIN], - _buffer[i + VSOMEIP_SERVICE_POS_MAX]); + const service_t its_service = bithelper::read_uint16_be(&_buffer[i + VSOMEIP_SERVICE_POS_MIN]); + if (utility::is_request( _buffer[i + VSOMEIP_MESSAGE_TYPE_POS])) { - const client_t its_client = VSOMEIP_BYTES_TO_WORD( - _buffer[i + VSOMEIP_CLIENT_POS_MIN], - _buffer[i + VSOMEIP_CLIENT_POS_MAX]); + const client_t its_client = bithelper::read_uint16_be(&_buffer[i + VSOMEIP_CLIENT_POS_MIN]); if (its_client != MAGIC_COOKIE_CLIENT) { - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - _buffer[i + VSOMEIP_SESSION_POS_MIN], - _buffer[i + VSOMEIP_SESSION_POS_MAX]); + const session_t its_session = bithelper::read_uint16_be(&_buffer[i + VSOMEIP_SESSION_POS_MIN]); clients_mutex_.lock(); clients_[its_client][its_session] = _remote; clients_mutex_.unlock(); } } if (tp::tp::tp_flag_is_set(_buffer[i + VSOMEIP_MESSAGE_TYPE_POS])) { - const method_t its_method = VSOMEIP_BYTES_TO_WORD(_buffer[i + VSOMEIP_METHOD_POS_MIN], - _buffer[i + VSOMEIP_METHOD_POS_MAX]); - if (!tp_segmentation_enabled(its_service, its_method)) { - VSOMEIP_WARNING << "use: Received a SomeIP/TP message for service: 0x" << std::hex << its_service - << " method: 0x" << its_method << " which is not configured for TP:" - << " local: " << get_address_port_local() - << " remote: " << its_remote_address << ":" << std::dec << its_remote_port; - return; + const method_t its_method = bithelper::read_uint16_be(&_buffer[i + VSOMEIP_METHOD_POS_MIN]); + instance_t its_instance = this->get_instance(its_service); + + if (its_instance != ANY_INSTANCE) { + if (!tp_segmentation_enabled(its_service, its_instance, its_method)) { + VSOMEIP_WARNING << "use: Received a SomeIP/TP message for service: 0x" << std::hex << its_service + << " method: 0x" << its_method << " which is not configured for TP:" + << " local: " << get_address_port_local() + << " remote: " << its_remote_address << ":" << std::dec << its_remote_port; + return; + } } const auto res = tp_reassembler_->process_tp_message( &_buffer[i], current_message_size, its_remote_address, its_remote_port); if (res.first) { if (utility::is_request(res.second[VSOMEIP_MESSAGE_TYPE_POS])) { - const client_t its_client = VSOMEIP_BYTES_TO_WORD( - res.second[VSOMEIP_CLIENT_POS_MIN], - res.second[VSOMEIP_CLIENT_POS_MAX]); + const client_t its_client = bithelper::read_uint16_be(&res.second[VSOMEIP_CLIENT_POS_MIN]); if (its_client != MAGIC_COOKIE_CLIENT) { - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - res.second[VSOMEIP_SESSION_POS_MIN], - res.second[VSOMEIP_SESSION_POS_MAX]); + const session_t its_session = bithelper::read_uint16_be(&res.second[VSOMEIP_SESSION_POS_MIN]); std::lock_guard its_client_lock(clients_mutex_); clients_[its_client][its_session] = _remote; } @@ -701,8 +696,7 @@ void udp_server_endpoint_impl::on_message_received( << " local: " << get_address_port_local() << " remote: " << its_remote_address << ":" << std::dec << its_remote_port; if (remaining_bytes > VSOMEIP_SERVICE_POS_MAX) { - service_t its_service = VSOMEIP_BYTES_TO_WORD(_buffer[VSOMEIP_SERVICE_POS_MIN], - _buffer[VSOMEIP_SERVICE_POS_MAX]); + service_t its_service = bithelper::read_uint16_be(&_buffer[VSOMEIP_SERVICE_POS_MIN]); if (its_service != VSOMEIP_SD_SERVICE) { if (read_message_size == 0) { VSOMEIP_ERROR << "Ignoring unreliable vSomeIP message with SomeIP message length 0!"; @@ -828,11 +822,9 @@ std::string udp_server_endpoint_impl::get_address_port_local() const { } bool udp_server_endpoint_impl::tp_segmentation_enabled( - service_t _service, method_t _method) const { + service_t _service, instance_t _instance, method_t _method) const { - return configuration_->is_tp_service(_service, - local_.address().to_string(), local_.port(), - _method); + return configuration_->is_tp_service(_service, _instance, _method); } void @@ -988,7 +980,7 @@ udp_server_endpoint_impl::set_multicast_option( multicast_socket_->cancel(ec); - multicast_socket_.reset(nullptr); + multicast_socket_.reset(); multicast_local_.reset(nullptr); } } diff --git a/implementation/message/src/deserializer.cpp b/implementation/message/src/deserializer.cpp index bfa723d34..746b83630 100644 --- a/implementation/message/src/deserializer.cpp +++ b/implementation/message/src/deserializer.cpp @@ -13,7 +13,7 @@ #include "../include/message_impl.hpp" #include "../include/deserializer.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" namespace vsomeip_v3 { @@ -75,7 +75,8 @@ bool deserializer::deserialize(uint16_t& _value) { byte1 = *position_++; remaining_ -= 2; - _value = VSOMEIP_BYTES_TO_WORD(byte0, byte1); + uint8_t payload[2] = {byte0, byte1}; + _value = bithelper::read_uint16_be(payload); return true; } @@ -94,8 +95,8 @@ bool deserializer::deserialize(uint32_t &_value, bool _omit_last_byte) { byte3 = *position_++; remaining_ -= 3; - _value = VSOMEIP_BYTES_TO_LONG( - byte0, byte1, byte2, byte3); + uint8_t payload[4] = {byte0, byte1, byte2, byte3}; + _value = bithelper::read_uint32_be(payload); return true; } @@ -149,7 +150,7 @@ bool deserializer::look_ahead(std::size_t _index, uint16_t &_value) const { std::vector< uint8_t >::iterator i = position_ + static_cast::difference_type>(_index); - _value = VSOMEIP_BYTES_TO_WORD(*i, *(i+1)); + _value = bithelper::read_uint16_be(&(*i)); return true; } @@ -159,7 +160,7 @@ bool deserializer::look_ahead(std::size_t _index, uint32_t &_value) const { return false; std::vector< uint8_t >::const_iterator i = position_ + static_cast::difference_type>(_index); - _value = VSOMEIP_BYTES_TO_LONG(*i, *(i+1), *(i+2), *(i+3)); + _value = bithelper::read_uint32_be(&(*i)); return true; } diff --git a/implementation/message/src/message_base_impl.cpp b/implementation/message/src/message_base_impl.cpp index c1d7da7dd..c64a56f92 100644 --- a/implementation/message/src/message_base_impl.cpp +++ b/implementation/message/src/message_base_impl.cpp @@ -4,7 +4,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "../include/message_impl.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" namespace vsomeip_v3 { @@ -19,12 +19,16 @@ message_base_impl::~message_base_impl() { // header interface message_t message_base_impl::get_message() const { - return VSOMEIP_WORDS_TO_LONG(header_.service_, header_.method_); + const uint8_t header_message[] = {static_cast((header_.service_ & 0xFF00) >> 8), + static_cast( header_.service_ & 0x00FF), + static_cast((header_.method_ & 0xFF00) >> 8), + static_cast( header_.method_ & 0x00FF)}; + return bithelper::read_uint32_be(header_message); } void message_base_impl::set_message(message_t _message) { - header_.service_ = VSOMEIP_LONG_WORD0(_message); - header_.method_ = VSOMEIP_LONG_WORD1(_message); + header_.service_ = bithelper::read_high_word(_message); + header_.method_ = bithelper::read_low_word(_message); } service_t message_base_impl::get_service() const { @@ -52,7 +56,11 @@ void message_base_impl::set_method(method_t _method) { } request_t message_base_impl::get_request() const { - return VSOMEIP_WORDS_TO_LONG(header_.client_, header_.session_); + const uint8_t header_message[] = {static_cast((header_.client_ & 0xFF00) >> 8), + static_cast( header_.client_ & 0x00FF), + static_cast((header_.session_ & 0xFF00) >> 8), + static_cast( header_.session_ & 0x00FF)}; + return bithelper::read_uint32_be(header_message); } client_t message_base_impl::get_client() const { diff --git a/implementation/message/src/message_impl.cpp b/implementation/message/src/message_impl.cpp index 47250c137..09db29722 100644 --- a/implementation/message/src/message_impl.cpp +++ b/implementation/message/src/message_impl.cpp @@ -13,7 +13,6 @@ #else #include "../../configuration/include/internal.hpp" #endif -#include "../../utility/include/byteorder.hpp" namespace vsomeip_v3 { diff --git a/implementation/message/src/serializer.cpp b/implementation/message/src/serializer.cpp index 2bdad8ff8..9f6f03427 100644 --- a/implementation/message/src/serializer.cpp +++ b/implementation/message/src/serializer.cpp @@ -13,7 +13,7 @@ #include #include "../include/serializer.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #include namespace vsomeip_v3 { @@ -37,18 +37,23 @@ bool serializer::serialize(const uint8_t _value) { } bool serializer::serialize(const uint16_t _value) { - data_.push_back(VSOMEIP_WORD_BYTE1(_value)); - data_.push_back(VSOMEIP_WORD_BYTE0(_value)); + uint8_t nvalue[2] = {0}; + bithelper::write_uint16_le(_value, nvalue); + data_.push_back(nvalue[1]); + data_.push_back(nvalue[0]); return true; } bool serializer::serialize(const uint32_t _value, bool _omit_last_byte) { + uint8_t nvalue[4] = {0}; + bithelper::write_uint32_le(_value, nvalue); + if (!_omit_last_byte) { - data_.push_back(VSOMEIP_LONG_BYTE3(_value)); + data_.push_back(nvalue[3]); } - data_.push_back(VSOMEIP_LONG_BYTE2(_value)); - data_.push_back(VSOMEIP_LONG_BYTE1(_value)); - data_.push_back(VSOMEIP_LONG_BYTE0(_value)); + data_.push_back(nvalue[2]); + data_.push_back(nvalue[1]); + data_.push_back(nvalue[0]); return true; } diff --git a/implementation/plugin/include/plugin_manager_impl.hpp b/implementation/plugin/include/plugin_manager_impl.hpp index e88772e60..9f755d60c 100644 --- a/implementation/plugin/include/plugin_manager_impl.hpp +++ b/implementation/plugin/include/plugin_manager_impl.hpp @@ -6,7 +6,7 @@ #ifndef VSOMEIP_V3_PLUGIN_MANAGER_IMPL_HPP #define VSOMEIP_V3_PLUGIN_MANAGER_IMPL_HPP -#include "../include/plugin_manager.hpp" +#include #include #include diff --git a/implementation/routing/include/event.hpp b/implementation/routing/include/event.hpp index fd43638d2..447aff84a 100644 --- a/implementation/routing/include/event.hpp +++ b/implementation/routing/include/event.hpp @@ -179,6 +179,7 @@ class event std::atomic is_cache_placeholder_; epsilon_change_func_t epsilon_change_func_; + bool has_default_epsilon_change_func_; std::atomic reliability_; diff --git a/implementation/routing/include/routing_manager_impl.hpp b/implementation/routing/include/routing_manager_impl.hpp index 987f9d3d2..b0c3c73b8 100644 --- a/implementation/routing/include/routing_manager_impl.hpp +++ b/implementation/routing/include/routing_manager_impl.hpp @@ -442,8 +442,6 @@ class routing_manager_impl: public routing_manager_base, client_t _client, major_version_t _major, minor_version_t _minor); bool erase_offer_command(service_t _service, instance_t _instance); - bool is_last_stop_callback(const uint32_t _callback_id); - std::string get_env(client_t _client) const; std::string get_env_unlocked(client_t _client) const; @@ -465,6 +463,11 @@ class routing_manager_impl: public routing_manager_base, service_t _service, instance_t _instance, const boost::asio::ip::address &_remote_address) const; +#ifdef VSOMEIP_ENABLE_DEFAULT_EVENT_CACHING + bool has_subscribed_eventgroup( + service_t _service, instance_t _instance) const; +#endif // VSOMEIP_ENABLE_DEFAULT_EVENT_CACHING + private: std::shared_ptr stub_; std::shared_ptr discovery_; diff --git a/implementation/routing/src/event.cpp b/implementation/routing/src/event.cpp index 8f5b44ce4..371cba7bd 100644 --- a/implementation/routing/src/event.cpp +++ b/implementation/routing/src/event.cpp @@ -37,6 +37,7 @@ event::event(routing_manager *_routing, bool _is_shadow) is_cache_placeholder_(false), epsilon_change_func_(std::bind(&event::has_changed, this, std::placeholders::_1, std::placeholders::_2)), + has_default_epsilon_change_func_(true), reliability_(reliability_type_e::RT_UNKNOWN) { } @@ -297,6 +298,7 @@ event::set_epsilon_change_function( std::lock_guard its_lock(mutex_); if (_epsilon_change_func) { epsilon_change_func_ = _epsilon_change_func; + has_default_epsilon_change_func_ = false; } } @@ -685,7 +687,8 @@ event::get_filtered_subscribers(bool _force) { if (filters_.empty()) { - bool must_forward = (type_ != event_type_e::ET_FIELD + bool must_forward = ((type_ != event_type_e::ET_FIELD + && has_default_epsilon_change_func_) || _force || epsilon_change_func_(its_payload, its_payload_update)); @@ -704,7 +707,8 @@ event::get_filtered_subscribers(bool _force) { its_filtered_subscribers.insert(s); } else { if (is_allowed == 0xff) { - is_allowed = (type_ != event_type_e::ET_FIELD + is_allowed = ((type_ != event_type_e::ET_FIELD + && has_default_epsilon_change_func_) || _force || epsilon_change_func_(its_payload, its_payload_update) ? 0x01 : 0x00); diff --git a/implementation/routing/src/routing_manager_base.cpp b/implementation/routing/src/routing_manager_base.cpp index 047e6566e..39026c648 100644 --- a/implementation/routing/src/routing_manager_base.cpp +++ b/implementation/routing/src/routing_manager_base.cpp @@ -16,7 +16,7 @@ #ifdef USE_DLT #include "../../tracing/include/connector_impl.hpp" #endif -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #include "../../utility/include/utility.hpp" namespace vsomeip_v3 { @@ -418,12 +418,6 @@ void routing_manager_base::register_event(client_t _client, std::shared_ptr its_debounce = configuration_->get_debounce(host_->get_name(), _service, _instance, _notifier); if (its_debounce) { - VSOMEIP_WARNING << "Using debounce configuration for " - << " SOME/IP event " - << std::hex << std::setfill('0') - << std::setw(4) << _service << "." - << std::setw(4) << _instance << "." - << std::setw(4) << _notifier << "."; std::stringstream its_debounce_parameters; its_debounce_parameters << "(on_change=" << (its_debounce->on_change_ ? "true" : "false") @@ -433,8 +427,18 @@ void routing_manager_base::register_event(client_t _client, << ", " << std::hex << (int)i.second << ") "; its_debounce_parameters << "], interval=" << std::dec << its_debounce->interval_ << ")"; - VSOMEIP_WARNING << "Debounce parameters: " + + VSOMEIP_WARNING << "Using debounce configuration for " + << " SOME/IP event " + << std::hex << std::setw(4) << std::setfill('0') + << _service << "." + << std::hex << std::setw(4) << std::setfill('0') + << _instance << "." + << std::hex << std::setw(4) << std::setfill('0') + << _notifier << "." + << " Debounce parameters: " << its_debounce_parameters.str(); + _epsilon_change_func = [its_debounce]( const std::shared_ptr &_old, const std::shared_ptr &_new) { @@ -503,28 +507,12 @@ void routing_manager_base::register_event(client_t _client, // Create a new callback for this client if filter interval is used register_debounce(its_debounce, _client, its_event); } else { - if (!_is_shadow && is_routing_manager()) { - _epsilon_change_func = [](const std::shared_ptr &_old, - const std::shared_ptr &_new) { - bool is_change = (_old->get_length() != _new->get_length()); - if (!is_change) { - std::size_t its_pos = 0; - const byte_t *its_old_data = _old->get_data(); - const byte_t *its_new_data = _new->get_data(); - while (!is_change && its_pos < _old->get_length()) { - is_change = (*its_old_data++ != *its_new_data++); - its_pos++; - } - } - return is_change; - }; - } - else { + if (_is_shadow || !is_routing_manager()) { _epsilon_change_func = [](const std::shared_ptr &_old, const std::shared_ptr &_new) { - (void)_old; - (void)_new; - return true; + (void)_old; + (void)_new; + return true; }; } } @@ -712,7 +700,7 @@ bool routing_manager_base::is_subscribe_to_any_event_allowed( auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup); if (its_eventgroup) { for (const auto& e : its_eventgroup->get_events()) { - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member( + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( _sec_client, _service, _instance, e->get_event())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << _client << " : routing_manager_base::is_subscribe_to_any_event_allowed: " @@ -734,7 +722,7 @@ void routing_manager_base::add_known_client(client_t _client, const std::string if (configuration_->is_security_enabled() && !configuration_->is_security_external()) { //Ignore if we have already loaded the policy extension policy_manager_impl::policy_loaded_e policy_loaded - = policy_manager_impl::get()->is_policy_extension_loaded(_client_host); + = configuration_->get_policy_manager()->is_policy_extension_loaded(_client_host); if (policy_loaded == policy_manager_impl::policy_loaded_e::POLICY_PATH_FOUND_AND_NOT_LOADED) { @@ -1166,10 +1154,10 @@ void routing_manager_base::remove_local(client_t _client, bool _remove_sec_client) { vsomeip_sec_client_t its_sec_client; - policy_manager_impl::get()->get_client_to_sec_client_mapping(_client, its_sec_client); + configuration_->get_policy_manager()->get_client_to_sec_client_mapping(_client, its_sec_client); if (_remove_sec_client) { - policy_manager_impl::get()->remove_client_to_sec_client_mapping(_client); + configuration_->get_policy_manager()->remove_client_to_sec_client_mapping(_client); } for (auto its_subscription : _subscribed_eventgroups) { host_->on_subscription(std::get<0>(its_subscription), std::get<1>(its_subscription), @@ -1324,10 +1312,8 @@ bool routing_manager_base::send_local_notification(client_t _client, bool has_local(false); #endif bool has_remote(false); - method_t its_method = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); - service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], _data[VSOMEIP_SERVICE_POS_MAX]); + service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); std::shared_ptr its_event = find_event(its_service, _instance, its_method); if (its_event && !its_event->is_shadow()) { diff --git a/implementation/routing/src/routing_manager_client.cpp b/implementation/routing/src/routing_manager_client.cpp index dbb2bd2eb..99d99090d 100644 --- a/implementation/routing/src/routing_manager_client.cpp +++ b/implementation/routing/src/routing_manager_client.cpp @@ -62,7 +62,7 @@ #include "../../security/include/policy.hpp" #include "../../security/include/policy_manager_impl.hpp" #include "../../security/include/security.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #include "../../utility/include/utility.hpp" #ifdef USE_DLT #include "../../tracing/include/connector_impl.hpp" @@ -119,6 +119,10 @@ void routing_manager_client::init() { std::bind(&routing_manager_client::on_net_state_change, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + } else { + VSOMEIP_WARNING << __func__ << ": (" << its_guest_address.to_string() << ":" + << its_host_address.to_string() << ")" + << " local_link_connector not initialized."; } #else receiver_ = ep_mgr_->create_local_server(shared_from_this()); @@ -164,7 +168,8 @@ void routing_manager_client::stop() { while (state_ == inner_state_type_e::ST_REGISTERING) { std::cv_status status = state_condition_.wait_for(its_lock, its_timeout); if (status == std::cv_status::timeout) { - VSOMEIP_WARNING << std::hex << get_client() << " registering timeout on stop"; + VSOMEIP_WARNING << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " registering timeout on stop"; break; } } @@ -175,7 +180,8 @@ void routing_manager_client::stop() { while (state_ == inner_state_type_e::ST_REGISTERED) { std::cv_status status = state_condition_.wait_for(its_lock, its_timeout); if (status == std::cv_status::timeout) { - VSOMEIP_WARNING << std::hex << get_client() << " couldn't deregister application - timeout"; + VSOMEIP_WARNING << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " couldn't deregister application - timeout"; break; } } @@ -216,7 +222,7 @@ void routing_manager_client::stop() { if (configuration_->is_local_routing()) { std::stringstream its_client; its_client << utility::get_base_path(configuration_->get_network()) - << std::hex << get_client(); + << std::hex << std::setw(4) << std::setfill('0') << get_client(); #ifdef _WIN32 ::_unlink(its_client.str().c_str()); #else @@ -646,7 +652,7 @@ void routing_manager_client::send_subscribe(client_t _client, return; } } else { - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member( + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( get_sec_client(), _service, _instance, _event)) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << _client << " : routing_manager_proxy::subscribe: " @@ -828,21 +834,13 @@ bool routing_manager_client::send(client_t _client, const byte_t *_data, } if (client_side_logging_) { if (_size > VSOMEIP_MESSAGE_TYPE_POS) { - service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], - _data[VSOMEIP_SERVICE_POS_MAX]); + service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); if (client_side_logging_filter_.empty() || (1 == client_side_logging_filter_.count(std::make_tuple(its_service, ANY_INSTANCE))) || (1 == client_side_logging_filter_.count(std::make_tuple(its_service, _instance)))) { - method_t its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); - session_t its_session = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SESSION_POS_MIN], - _data[VSOMEIP_SESSION_POS_MAX]); - client_t its_client = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_CLIENT_POS_MIN], - _data[VSOMEIP_CLIENT_POS_MAX]); + method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + session_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); + client_t its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); VSOMEIP_INFO << "routing_manager_client::send: (" << std::hex << std::setfill('0') << std::setw(4) << get_client() << "): [" @@ -864,9 +862,7 @@ bool routing_manager_client::send(client_t _client, const byte_t *_data, std::shared_ptr its_target; if (utility::is_request(_data[VSOMEIP_MESSAGE_TYPE_POS])) { // Request - service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], - _data[VSOMEIP_SERVICE_POS_MAX]); + service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); client_t its_client = find_local_client(its_service, _instance); if (its_client != VSOMEIP_ROUTING_CLIENT) { if (is_client_known(its_client)) { @@ -875,9 +871,7 @@ bool routing_manager_client::send(client_t _client, const byte_t *_data, } } else if (!utility::is_notification(_data[VSOMEIP_MESSAGE_TYPE_POS])) { // Response - client_t its_client = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_CLIENT_POS_MIN], - _data[VSOMEIP_CLIENT_POS_MAX]); + client_t its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); if (its_client != VSOMEIP_ROUTING_CLIENT) { if (is_client_known(its_client)) { its_target = ep_mgr_->find_or_create_local(its_client); @@ -993,9 +987,9 @@ void routing_manager_client::on_disconnect(const std::shared_ptr& _end is_connected_ = !(_endpoint == sender_); } if (!is_connected_) { - VSOMEIP_INFO << "routing_manager_client::on_disconnect: Client 0x" << std::hex - << get_client() << " calling host_->on_state " - << "with DEREGISTERED"; + VSOMEIP_INFO << "routing_manager_client::on_disconnect: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " calling host_->on_state with DEREGISTERED"; host_->on_state(state_type_e::ST_DEREGISTERED); } } @@ -1037,8 +1031,8 @@ void routing_manager_client::on_message( std::vector its_buffer(_data, _data + _size); protocol::error_e its_error; - auto its_security = policy_manager_impl::get(); - if (!its_security) + auto its_policy_manager = configuration_->get_policy_manager(); + if (!its_policy_manager) return; protocol::dummy_command its_dummy_command; @@ -1065,12 +1059,11 @@ void routing_manager_client::on_message( if (configuration_->is_security_enabled() && configuration_->is_local_routing() && !is_from_routing && _bound_client != its_client) { - VSOMEIP_WARNING << std::hex << std::setfill('0') - << "Client " << std::setw(4) << get_client() - << " received a message with command " << int(its_id) - << " from " << std::setw(4) << its_client + VSOMEIP_WARNING << "Client " << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " received a message with command " << int(its_id) << " from " + << std::hex << std::setw(4) << std::setfill('0') << its_client << " which doesn't match the bound client " - << std::setw(4) << _bound_client + << std::hex << std::setw(4) << std::setfill('0') << _bound_client << " ~> skip message!"; return; } @@ -1100,25 +1093,27 @@ void routing_manager_client::on_message( if (utility::is_notification(its_message->get_message_type())) { if (!is_response_allowed(_bound_client, its_message->get_service(), its_message->get_instance(), its_message->get_method())) { - VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() - << " : routing_manager_client::on_message: " - << " received a notification from client 0x" << _bound_client - << " which does not offer service/instance/event " - << its_message->get_service() << "/" << its_message->get_instance() - << "/" << its_message->get_method() - << " ~> Skip message!"; + VSOMEIP_WARNING << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " : routing_manager_client::on_message: " + << " received a notification from client 0x" << _bound_client + << " which does not offer service/instance/event " + << its_message->get_service() << "/" << its_message->get_instance() + << "/" << its_message->get_method() + << " ~> Skip message!"; return; } else { - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member(get_sec_client(), - its_message->get_service(), its_message->get_instance(), + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( + get_sec_client(), its_message->get_service(), its_message->get_instance(), its_message->get_method())) { - VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() - << " : routing_manager_client::on_message: " - << " isn't allowed to receive a notification from service/instance/event " - << its_message->get_service() << "/" << its_message->get_instance() - << "/" << its_message->get_method() - << " respectively from client 0x" << _bound_client - << " ~> Skip message!"; + VSOMEIP_WARNING << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " : routing_manager_client::on_message: " + << " isn't allowed to receive a notification from service/instance/event " + << its_message->get_service() << "/" << its_message->get_instance() + << "/" << its_message->get_method() + << " respectively from client 0x" << _bound_client + << " ~> Skip message!"; return; } cache_event_payload(its_message); @@ -1127,49 +1122,53 @@ void routing_manager_client::on_message( if (configuration_->is_security_enabled() && configuration_->is_local_routing() && its_message->get_client() != _bound_client) { - VSOMEIP_WARNING << std::hex << std::setfill('0') - << "vSomeIP Security: Client 0x" << std::setw(4) << get_client() - << " received a request from client 0x" << std::setw(4) << its_message->get_client() - << " to service/instance/method " - << its_message->get_service() << "/" << its_message->get_instance() - << "/" << its_message->get_method() - << " which doesn't match the bound client 0x" << std::setw(4) << _bound_client - << " ~> skip message!"; + VSOMEIP_WARNING << std::hex << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " received a request from client 0x" + << std::hex << std::setw(4) << std::setfill('0') << its_message->get_client() + << " to service/instance/method " << its_message->get_service() + << "/" << its_message->get_instance() << "/" << its_message->get_method() + << " which doesn't match the bound client 0x" + << std::hex << std::setw(4) << std::setfill('0') << _bound_client + << " ~> skip message!"; return; } - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member(_sec_client, - its_message->get_service(), its_message->get_instance(), + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( + _sec_client, its_message->get_service(), its_message->get_instance(), its_message->get_method())) { - VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << its_message->get_client() - << " : routing_manager_client::on_message: " - << "isn't allowed to send a request to service/instance/method " - << its_message->get_service() << "/" << its_message->get_instance() - << "/" << its_message->get_method() - << " ~> Skip message!"; + VSOMEIP_WARNING << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << its_message->get_client() + << " : routing_manager_client::on_message: " + << "isn't allowed to send a request to service/instance/method " + << its_message->get_service() << "/" << its_message->get_instance() + << "/" << its_message->get_method() + << " ~> Skip message!"; return; } } else { // response if (!is_response_allowed(_bound_client, its_message->get_service(), its_message->get_instance(), its_message->get_method())) { - VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() - << " : routing_manager_client::on_message: " - << " received a response from client 0x" << _bound_client - << " which does not offer service/instance/method " - << its_message->get_service() << "/" << its_message->get_instance() - << "/" << its_message->get_method() - << " ~> Skip message!"; + VSOMEIP_WARNING << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " : routing_manager_client::on_message: " + << " received a response from client 0x" << _bound_client + << " which does not offer service/instance/method " + << its_message->get_service() << "/" << its_message->get_instance() + << "/" << its_message->get_method() + << " ~> Skip message!"; return; } else { - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member(get_sec_client(), - its_message->get_service(), its_message->get_instance(), + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( + get_sec_client(), its_message->get_service(), its_message->get_instance(), its_message->get_method())) { - VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() - << " : routing_manager_client::on_message: " - << " isn't allowed to receive a response from service/instance/method " - << its_message->get_service() << "/" << its_message->get_instance() - << "/" << its_message->get_method() - << " respectively from client 0x" << _bound_client - << " ~> Skip message!"; + VSOMEIP_WARNING << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " : routing_manager_client::on_message: " + << " isn't allowed to receive a response from service/instance/method " + << its_message->get_service() << "/" << its_message->get_instance() + << "/" << its_message->get_method() + << " respectively from client 0x" << _bound_client + << " ~> Skip message!"; return; } } @@ -1178,30 +1177,31 @@ void routing_manager_client::on_message( if (!configuration_->is_remote_access_allowed()) { // if the message is from routing manager, check if // policy allows remote requests. - VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() - << " : routing_manager_client::on_message: " - << std::hex << "Security: Remote clients via routing manager with client ID 0x" << its_client - << " are not allowed to communicate with service/instance/method " - << its_message->get_service() << "/" << its_message->get_instance() - << "/" << its_message->get_method() - << " respectively with client 0x" << get_client() - << " ~> Skip message!"; + VSOMEIP_WARNING << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " : routing_manager_client::on_message: " + << std::hex << "Security: Remote clients via routing manager with client ID 0x" << its_client + << " are not allowed to communicate with service/instance/method " + << its_message->get_service() << "/" << its_message->get_instance() + << "/" << its_message->get_method() + << " respectively with client 0x" << get_client() + << " ~> Skip message!"; return; } else if (utility::is_notification(its_message->get_message_type())) { // As subscription is sent on eventgroup level, incoming remote event ID's // need to be checked as well if remote clients are allowed // and the local policy only allows specific events in the eventgroup to be received. - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member(get_sec_client(), - its_message->get_service(), its_message->get_instance(), + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( + get_sec_client(), its_message->get_service(), its_message->get_instance(), its_message->get_method())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() - << " : routing_manager_client::on_message: " - << " isn't allowed to receive a notification from service/instance/event " - << its_message->get_service() << "/" << its_message->get_instance() - << "/" << its_message->get_method() - << " respectively from remote clients via routing manager with client ID 0x" - << routing_host_id - << " ~> Skip message!"; + << " : routing_manager_client::on_message: " + << " isn't allowed to receive a notification from service/instance/event " + << its_message->get_service() << "/" << its_message->get_instance() + << "/" << its_message->get_method() + << " respectively from remote clients via routing manager with client ID 0x" + << routing_host_id + << " ~> Skip message!"; return; } cache_event_payload(its_message); @@ -1254,7 +1254,8 @@ void routing_manager_client::on_message( on_routing_info(_data, _size); } else { VSOMEIP_WARNING << "routing_manager_client::on_message: " - << std::hex << "Security: Client 0x" << get_client() + << "Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0')<< get_client() << " received an routing info from a client which isn't the routing manager" << " : Skip message!"; } @@ -1355,7 +1356,7 @@ void routing_manager_client::on_message( return; } } else { - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member( + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( _sec_client, its_service, its_instance, its_event)) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << its_client << " : routing_manager_client::on_message: " @@ -1647,8 +1648,8 @@ void routing_manager_client::on_message( uint32_t its_gid; if (its_policy->get_uid_gid(its_uid, its_gid)) { if (is_internal_policy_update - || its_security->is_policy_update_allowed(its_uid, its_policy)) { - its_security->update_security_policy(its_uid, its_gid, its_policy); + || its_policy_manager->is_policy_update_allowed(its_uid, its_policy)) { + its_policy_manager->update_security_policy(its_uid, its_gid, its_policy); send_update_security_policy_response(its_command.get_update_id()); } } else { @@ -1658,10 +1659,11 @@ void routing_manager_client::on_message( VSOMEIP_ERROR << "vSomeIP Security: Policy deserialization failed!"; } } else { - VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() - << " : routing_manager_client::on_message: " - << " received a security policy update from a client which isn't the routing manager" - << " : Skip message!"; + VSOMEIP_WARNING << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " : routing_manager_client::on_message: " + << " received a security policy update from a client which isn't the routing manager" + << " : Skip message!"; } break; } @@ -1676,8 +1678,8 @@ void routing_manager_client::on_message( uid_t its_uid(its_command.get_uid()); gid_t its_gid(its_command.get_gid()); - if (its_security->is_policy_removal_allowed(its_uid)) { - its_security->remove_security_policy(its_uid, its_gid); + if (its_policy_manager->is_policy_removal_allowed(its_uid)) { + its_policy_manager->remove_security_policy(its_uid, its_gid); send_remove_security_policy_response(its_command.get_update_id()); } } else @@ -1686,10 +1688,11 @@ void routing_manager_client::on_message( << static_cast(its_error) << ")"; } else - VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() - << " : routing_manager_client::on_message: " - << "received a security policy removal from a client which isn't the routing manager" - << " : Skip message!"; + VSOMEIP_WARNING << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " : routing_manager_client::on_message: " + << "received a security policy removal from a client which isn't the routing manager" + << " : Skip message!"; break; } @@ -1703,8 +1706,8 @@ void routing_manager_client::on_message( uid_t its_uid; gid_t its_gid; p->get_uid_gid(its_uid, its_gid); - if (its_security->is_policy_update_allowed(its_uid, p)) - its_security->update_security_policy(its_uid, its_gid, p); + if (its_policy_manager->is_policy_update_allowed(its_uid, p)) + its_policy_manager->update_security_policy(its_uid, its_gid, p); } } else VSOMEIP_ERROR << __func__ @@ -1712,10 +1715,11 @@ void routing_manager_client::on_message( << static_cast(its_error) << ")"; } else - VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() - << " : routing_manager_client::on_message: " - << " received a security policy distribution command from a client which isn't the routing manager" - << " : Skip message!"; + VSOMEIP_WARNING << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " : routing_manager_client::on_message: " + << " received a security policy distribution command from a client which isn't the routing manager" + << " : Skip message!"; break; } @@ -1732,10 +1736,11 @@ void routing_manager_client::on_message( << static_cast(its_error) << ")"; } else - VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() - << " : routing_manager_client::on_message: " - << "received a security credential update from a client which isn't the routing manager" - << " : Skip message!"; + VSOMEIP_WARNING << "vSomeIP Security: Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " : routing_manager_client::on_message: " + << "received a security credential update from a client which isn't the routing manager" + << " : Skip message!"; break; } @@ -1754,13 +1759,13 @@ void routing_manager_client::on_routing_info( const byte_t *_data, uint32_t _size) { #if 0 std::stringstream msg; - msg << "rmp::on_routing_info(" << std::hex << get_client() << "): "; + msg << "rmp::on_routing_info(" << std::hex << std::setw(4) << std::setfill('0') << get_client() << "): "; for (uint32_t i = 0; i < _size; ++i) msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; VSOMEIP_INFO << msg.str(); #endif - auto its_security = policy_manager_impl::get(); - if (!its_security) + auto its_policy_manager = configuration_->get_policy_manager(); + if (!its_policy_manager) return; std::vector its_buffer(_data, _data + _size); @@ -1788,11 +1793,12 @@ void routing_manager_client::on_routing_info( } if (its_client == get_client()) { - VSOMEIP_INFO << std::hex << "Application/Client " << get_client() - << " (" << host_->get_name() << ") is registered."; + VSOMEIP_INFO << "Application/Client " + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " (" << host_->get_name() << ") is registered."; #if defined(__linux__) || defined(ANDROID) || defined(__QNX__) - if (!its_security->check_credentials(get_client(), get_sec_client())) { - VSOMEIP_ERROR << "vSomeIP Security: Client 0x" << std::hex << get_client() + if (!its_policy_manager->check_credentials(get_client(), get_sec_client())) { + VSOMEIP_ERROR << "vSomeIP Security: Client 0x" << std::hex << std::setw(4) << std::setfill('0') << get_client() << " : routing_manager_client::on_routing_info: RIE_ADD_CLIENT: isn't allowed" << " to use the server endpoint due to credential check failed!"; deregister_application(); @@ -1828,8 +1834,8 @@ void routing_manager_client::on_routing_info( known_clients_.erase(its_client); } if (its_client == get_client()) { - its_security->remove_client_to_sec_client_mapping(its_client); - VSOMEIP_INFO << std::hex << "Application/Client " << get_client() + its_policy_manager->remove_client_to_sec_client_mapping(its_client); + VSOMEIP_INFO << "Application/Client " << std::hex << std::setw(4) << std::setfill('0') << get_client() << " (" << host_->get_name() << ") is deregistered."; // inform host about its own registration state changes @@ -2026,8 +2032,8 @@ void routing_manager_client::on_offered_services_info( } void routing_manager_client::reconnect(const std::map &_clients) { - auto its_security = policy_manager_impl::get(); - if (!its_security) + auto its_policy_manager = configuration_->get_policy_manager(); + if (!its_policy_manager) return; // inform host about its own registration state changes @@ -2048,12 +2054,13 @@ void routing_manager_client::reconnect(const std::map &_c } } - VSOMEIP_INFO << std::hex << "Application/Client " << get_client() - << ": Reconnecting to routing manager."; + VSOMEIP_INFO << std::hex << "Application/Client " + << std::hex << std::setw(4) << std::setfill('0') << get_client() + <<": Reconnecting to routing manager."; #if defined(__linux__) || defined(ANDROID) || defined(__QNX__) - if (!its_security->check_credentials(get_client(), get_sec_client())) { - VSOMEIP_ERROR << "vSomeIP Security: Client 0x" << std::hex << get_client() + if (!its_policy_manager->check_credentials(get_client(), get_sec_client())) { + VSOMEIP_ERROR << "vSomeIP Security: Client 0x" << std::hex << std::setw(4) << std::setfill('0') << get_client() << " : routing_manager_client::reconnect: isn't allowed" << " to use the server endpoint due to credential check failed!"; std::lock_guard its_lock(sender_mutex_); @@ -2072,6 +2079,9 @@ void routing_manager_client::reconnect(const std::map &_c void routing_manager_client::assign_client() { + VSOMEIP_INFO << __func__ << ": (" << std::hex << std::setw(4) << std::setfill('0') + << get_client() << ":" << host_->get_name() << ")"; + protocol::assign_client_command its_command; its_command.set_client(get_client()); its_command.set_name(host_->get_name()); @@ -2091,8 +2101,11 @@ void routing_manager_client::assign_client() { if (is_connected_) { std::lock_guard its_lock(sender_mutex_); if (sender_) { - if (state_ != inner_state_type_e::ST_DEREGISTERED) + if (state_ != inner_state_type_e::ST_DEREGISTERED) { + VSOMEIP_WARNING << __func__ << ": (" << std::hex << std::setw(4) << std::setfill('0') + << get_client() << ") Non-Deregistered State Set. Returning"; return; + } state_ = inner_state_type_e::ST_ASSIGNING; sender_->send(&its_buffer[0], static_cast(its_buffer.size())); @@ -2105,8 +2118,15 @@ void routing_manager_client::assign_client() { &routing_manager_client::assign_client_timeout_cbk, std::dynamic_pointer_cast(shared_from_this()), std::placeholders::_1)); + } else { + VSOMEIP_WARNING << __func__ << ": (" << std::hex << std::setw(4) << std::setfill('0') + << get_client() << ") sender not initialized. Ignoring client assignment"; } } + else { + VSOMEIP_WARNING << __func__ << ": (" << std::hex << std::setw(4) << std::setfill('0') + << get_client() << ") not connected. Ignoring client assignment"; + } } void routing_manager_client::register_application() { @@ -2329,12 +2349,12 @@ void routing_manager_client::on_subscribe_ack(client_t _client, (void)_client; #if 0 VSOMEIP_ERROR << "routing_manager_client::" << __func__ - << "(" << std::hex << host_->get_client() << "):" + << "(" << std::hex << std::setw(4) << std::setfill('0') << host_->get_client() << "):" << "event=" - << std::hex << _service << "." - << std::hex << _instance << "." - << std::hex << _eventgroup << "." - << std::hex << _event; + << std::hex << std::setw(4) << std::setfill('0') << _service << "." + << std::hex << std::setw(4) << std::setfill('0') << _instance << "." + << std::hex << std::setw(4) << std::setfill('0') << _eventgroup << "." + << std::hex << std::setw(4) << std::setfill('0') << _event; #endif if (_event == ANY_EVENT) { auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup); @@ -2430,13 +2450,13 @@ void routing_manager_client::send_pending_commands() { } void routing_manager_client::init_receiver() { -#if defined(__linux__) || defined(ANDROID) || defined(__QNX__) - auto its_security = policy_manager_impl::get(); - if (!its_security) +#ifdef __linux__ + auto its_policy_manager = configuration_->get_policy_manager(); + if (!its_policy_manager) return; - its_security->store_client_to_sec_client_mapping(get_client(), get_sec_client()); - its_security->store_sec_client_to_client_mapping(get_sec_client(), get_client()); + its_policy_manager->store_client_to_sec_client_mapping(get_client(), get_sec_client()); + its_policy_manager->store_sec_client_to_client_mapping(get_sec_client(), get_client()); #endif if (!receiver_) { receiver_ = ep_mgr_->create_local_server(shared_from_this()); @@ -2543,17 +2563,26 @@ routing_manager_client::assign_client_timeout_cbk( if (state_ != inner_state_type_e::ST_REGISTERED) { state_ = inner_state_type_e::ST_DEREGISTERED; register_again = true; + } else { + VSOMEIP_INFO << __func__ << ": Will not retry registry for Client [0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << "] : already registered "; } } if (register_again) { std::lock_guard its_lock(sender_mutex_); - VSOMEIP_WARNING << std::hex << "Client 0x" << get_client() - << " request client timeout! Trying again..."; + VSOMEIP_WARNING << "Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " request client timeout! Trying again..."; if (sender_) { sender_->restart(); } } + } else if (_error != boost::asio::error::operation_aborted) { //ignore error when timer is deliberately cancelled + VSOMEIP_WARNING << __func__ << ": Ignoring Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " due to error_code: " << _error.value() ; } } @@ -2570,8 +2599,9 @@ void routing_manager_client::register_application_timeout_cbk( } if (register_again) { std::lock_guard its_lock(sender_mutex_); - VSOMEIP_WARNING << std::hex << "Client 0x" << get_client() - << " register timeout! Trying again..."; + VSOMEIP_WARNING << std::hex << "Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " register timeout! Trying again..."; if (sender_) sender_->restart(); @@ -2679,8 +2709,10 @@ void routing_manager_client::register_client_error_handler(client_t _client, void routing_manager_client::handle_client_error(client_t _client) { if (_client != VSOMEIP_ROUTING_CLIENT) { - VSOMEIP_INFO << "Client 0x" << std::hex << get_client() - << " handles a client error(" << std::hex << _client << ")"; + VSOMEIP_INFO << "Client 0x" + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " handles a client error(" + << std::hex << std::setw(4) << std::setfill('0') << _client << ")"; remove_local(_client, true); } else { bool should_reconnect(true); @@ -2826,8 +2858,8 @@ void routing_manager_client::send_remove_security_policy_response( void routing_manager_client::on_update_security_credentials( const protocol::update_security_credentials_command &_command) { - auto its_security = policy_manager_impl::get(); - if (!its_security) + auto its_policy_manager = configuration_->get_policy_manager(); + if (!its_policy_manager) return; for (const auto &c : _command.get_credentials()) { @@ -2843,7 +2875,7 @@ void routing_manager_client::on_update_security_credentials( its_policy->allow_who_ = true; its_policy->allow_what_ = true; - its_security->add_security_credentials(its_uid, its_gid, its_policy, get_client()); + its_policy_manager->add_security_credentials(its_uid, its_gid, its_policy, get_client()); } } #endif @@ -2864,27 +2896,34 @@ void routing_manager_client::on_client_assign_ack(const client_t &_client) { if (receiver_) { receiver_->start(); - VSOMEIP_INFO << std::hex << "Client " << get_client() - << " (" << host_->get_name() - << ") successfully connected to routing ~> registering.."; + VSOMEIP_INFO << "Client " + << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " (" << host_->get_name() << ") successfully connected to routing ~> registering.."; register_application(); } else { + VSOMEIP_WARNING << __func__ << ": (" << host_->get_name() << ":" + << std::hex << std::setw(4) << std::setfill('0') + << _client << ") Receiver not started. Restarting"; state_ = inner_state_type_e::ST_DEREGISTERED; host_->set_client(VSOMEIP_CLIENT_UNSET); sender_->restart(); } + } else { + VSOMEIP_WARNING << __func__ << ": (" << host_->get_name() << ":" + << std::hex << std::setw(4) << std::setfill('0') + << _client << ") Not started. Discarding"; } } else { - VSOMEIP_ERROR << "Didn't receive valid clientID! Won't register application."; + VSOMEIP_ERROR << __func__ << ": (" << host_->get_name() << ":" + << std::hex << std::setw(4) << std::setfill('0') + << _client << ") Invalid clientID"; } } else { - VSOMEIP_WARNING << "Client " << std::hex << get_client() - << " received another client identifier (" - << std::hex << _client - << "). Ignoring it. (" - << (int)state_ << ")"; + VSOMEIP_WARNING << "Client " << std::hex << std::setw(4) << std::setfill('0') << get_client() + << " received another client identifier ("<< _client + << "). Ignoring it. (" << (int)state_ << ")"; } } diff --git a/implementation/routing/src/routing_manager_impl.cpp b/implementation/routing/src/routing_manager_impl.cpp index 79f408045..77a4d67b0 100644 --- a/implementation/routing/src/routing_manager_impl.cpp +++ b/implementation/routing/src/routing_manager_impl.cpp @@ -48,7 +48,7 @@ #include "../../service_discovery/include/defines.hpp" #include "../../service_discovery/include/runtime.hpp" #include "../../service_discovery/include/service_discovery.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #include "../../utility/include/utility.hpp" #ifdef USE_DLT #include "../../tracing/include/connector_impl.hpp" @@ -423,7 +423,7 @@ bool routing_manager_impl::offer_service(client_t _client, // Check if the application hosted by routing manager is allowed to offer // offer_service requests of local proxies are checked in rms::on:message if (_client == get_client()) { - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_offer( + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_offer( get_sec_client(), _service, _instance)) { VSOMEIP_WARNING << "routing_manager_impl::offer_service: " << std::hex << "Security: Client 0x" << _client @@ -877,13 +877,9 @@ bool routing_manager_impl::send(client_t _client, const byte_t *_data, bool is_request = utility::is_request(_data[VSOMEIP_MESSAGE_TYPE_POS]); bool is_notification = utility::is_notification(_data[VSOMEIP_MESSAGE_TYPE_POS]); bool is_response = utility::is_response(_data[VSOMEIP_MESSAGE_TYPE_POS]); - - client_t its_client = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_CLIENT_POS_MIN], - _data[VSOMEIP_CLIENT_POS_MAX]); - service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], _data[VSOMEIP_SERVICE_POS_MAX]); - method_t its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], _data[VSOMEIP_METHOD_POS_MAX]); + client_t its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); + service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); bool is_service_discovery = (its_service == sd::service && its_method == sd::method); @@ -936,10 +932,8 @@ bool routing_manager_impl::send(client_t _client, const byte_t *_data, if (e2e_provider_) { if ( !is_service_discovery) { - service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], _data[VSOMEIP_SERVICE_POS_MAX]); - method_t its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], _data[VSOMEIP_METHOD_POS_MAX]); + service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); #ifndef ANDROID if (e2e_provider_->is_protected({its_service, its_method})) { // Find out where the protected area starts @@ -970,9 +964,7 @@ bool routing_manager_impl::send(client_t _client, const byte_t *_data, #endif is_sent = its_target->send(_data, _size); } else { - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SESSION_POS_MIN], - _data[VSOMEIP_SESSION_POS_MAX]); + const session_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); VSOMEIP_ERROR<< "Routing info for remote service could not be found! (" << std::hex << std::setfill('0') << std::setw(4) << its_client << "): [" @@ -987,8 +979,7 @@ bool routing_manager_impl::send(client_t _client, const byte_t *_data, if (is_notification && !is_service_discovery) { (void)send_local_notification(get_client(), _data, _size, _instance, _reliable, _status_check, _force); - method_t its_method = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); + method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); std::shared_ptr its_event = find_event(its_service, _instance, its_method); if (its_event) { #ifdef USE_DLT @@ -1061,9 +1052,7 @@ bool routing_manager_impl::send(client_t _client, const byte_t *_data, && !its_info->is_local()) { // We received a response/error but neither the hosting application // nor another local client could be found --> drop - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SESSION_POS_MIN], - _data[VSOMEIP_SESSION_POS_MAX]); + const session_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); VSOMEIP_ERROR << "routing_manager_impl::send: Received response/error for unknown client (" << std::hex << std::setfill('0') @@ -1085,9 +1074,7 @@ bool routing_manager_impl::send(client_t _client, const byte_t *_data, #endif is_sent = its_target->send(_data, _size); } else { - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SESSION_POS_MIN], - _data[VSOMEIP_SESSION_POS_MAX]); + const session_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); VSOMEIP_ERROR << "Routing error. Endpoint for service (" << std::hex << std::setfill('0') << std::setw(4) << its_client << "): [" @@ -1100,9 +1087,7 @@ bool routing_manager_impl::send(client_t _client, const byte_t *_data, } } else { if (!is_notification) { - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SESSION_POS_MIN], - _data[VSOMEIP_SESSION_POS_MAX]); + const session_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); VSOMEIP_ERROR << "Routing error. Not hosting service (" << std::hex << std::setfill('0') << std::setw(4) << its_client << "): [" @@ -1133,12 +1118,8 @@ bool routing_manager_impl::send_to( length_t its_size = its_serializer->get_size(); e2e_buffer its_buffer; if (e2e_provider_) { - service_t its_service = VSOMEIP_BYTES_TO_WORD( - its_data[VSOMEIP_SERVICE_POS_MIN], - its_data[VSOMEIP_SERVICE_POS_MAX]); - method_t its_method = VSOMEIP_BYTES_TO_WORD( - its_data[VSOMEIP_METHOD_POS_MIN], - its_data[VSOMEIP_METHOD_POS_MAX]); + service_t its_service = bithelper::read_uint16_be(&its_data[VSOMEIP_SERVICE_POS_MIN]); + method_t its_method = bithelper::read_uint16_be(&its_data[VSOMEIP_METHOD_POS_MIN]); #ifndef ANDROID if (e2e_provider_->is_protected({its_service, its_method})) { auto its_base = e2e_provider_->get_protection_base({its_service, its_method}); @@ -1150,8 +1131,10 @@ bool routing_manager_impl::send_to( #endif } - const_cast(its_data)[VSOMEIP_CLIENT_POS_MIN] = VSOMEIP_WORD_BYTE1(_client); - const_cast(its_data)[VSOMEIP_CLIENT_POS_MAX] = VSOMEIP_WORD_BYTE0(_client); + uint8_t its_client[2] = {0}; + bithelper::write_uint16_le(_client, its_client); + const_cast(its_data)[VSOMEIP_CLIENT_POS_MIN] = its_client[1]; + const_cast(its_data)[VSOMEIP_CLIENT_POS_MAX] = its_client[0]; is_sent = send_to(_target, its_data, its_size, _message->get_instance()); @@ -1496,11 +1479,9 @@ void routing_manager_impl::on_message(const byte_t *_data, length_t _size, #endif if (_size >= VSOMEIP_SOMEIP_HEADER_SIZE) { its_message_type = static_cast(_data[VSOMEIP_MESSAGE_TYPE_POS]); - its_service = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_SERVICE_POS_MIN], - _data[VSOMEIP_SERVICE_POS_MAX]); + its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); if (its_service == VSOMEIP_SD_SERVICE) { - its_method = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); + its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); if (discovery_ && its_method == sd::method) { if (configuration_->get_sd_port() == _remote_port) { if (!_remote_address.is_unspecified()) { @@ -1524,15 +1505,9 @@ void routing_manager_impl::on_message(const byte_t *_data, length_t _size, its_instance = ep_mgr_impl_->find_instance(its_service, _receiver); } if (its_instance == 0xFFFF) { - its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); - const client_t its_client = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_CLIENT_POS_MIN], - _data[VSOMEIP_CLIENT_POS_MAX]); - const session_t its_session = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SESSION_POS_MIN], - _data[VSOMEIP_SESSION_POS_MAX]); + its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + const client_t its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); + const session_t its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); boost::system::error_code ec; VSOMEIP_ERROR << "Received message on invalid port: [" << std::hex << std::setfill('0') @@ -1566,12 +1541,8 @@ void routing_manager_impl::on_message(const byte_t *_data, length_t _size, // Security checks if enabled! if (configuration_->is_security_enabled()) { if (utility::is_request(_data[VSOMEIP_MESSAGE_TYPE_POS])) { - client_t requester = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_CLIENT_POS_MIN], - _data[VSOMEIP_CLIENT_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); + client_t requester = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); + its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); if (!configuration_->is_offered_remote(its_service, its_instance)) { VSOMEIP_WARNING << std::hex << "Security: Received a remote request " << "for service/instance " << its_service << "/" << its_instance @@ -1596,9 +1567,7 @@ void routing_manager_impl::on_message(const byte_t *_data, length_t _size, } } if (e2e_provider_) { - its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); + its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); #ifndef ANDROID if (e2e_provider_->is_checked({its_service, its_method})) { auto its_base = e2e_provider_->get_protection_base({its_service, its_method}); @@ -1664,9 +1633,7 @@ bool routing_manager_impl::on_message(service_t _service, instance_t _instance, if (utility::is_request(_data[VSOMEIP_MESSAGE_TYPE_POS])) { its_client = find_local_client(_service, _instance); } else { - its_client = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_CLIENT_POS_MIN], - _data[VSOMEIP_CLIENT_POS_MAX]); + its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); } #if 0 @@ -1699,8 +1666,7 @@ bool routing_manager_impl::on_message(service_t _service, instance_t _instance, void routing_manager_impl::on_notification(client_t _client, service_t _service, instance_t _instance, const byte_t *_data, length_t _size, bool _notify_one) { - event_t its_event_id = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], _data[VSOMEIP_METHOD_POS_MAX]); + event_t its_event_id = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); std::shared_ptr its_event = find_event(_service, _instance, its_event_id); if (its_event) { uint32_t its_length = utility::get_payload_size(_data, _size); @@ -1728,21 +1694,6 @@ void routing_manager_impl::on_notification(client_t _client, } } -bool routing_manager_impl::is_last_stop_callback(const uint32_t _callback_id) { - bool last_callback(false); - auto found_id = callback_counts_.find(_callback_id); - if (found_id != callback_counts_.end()) { - found_id->second--; - if (found_id->second == 0) { - last_callback = true; - } - } - if (last_callback) { - callback_counts_.erase(_callback_id); - } - return last_callback; -} - void routing_manager_impl::on_stop_offer_service(client_t _client, service_t _service, instance_t _instance, major_version_t _major, minor_version_t _minor) { { @@ -1799,8 +1750,6 @@ void routing_manager_impl::on_stop_offer_service(client_t _client, service_t _se if (its_info) { its_reliable_endpoint = its_info->get_endpoint(true); its_unreliable_endpoint = its_info->get_endpoint(false); - static std::atomic callback_id(0); - const uint32_t its_callback_id = ++callback_id; struct ready_to_stop_t { ready_to_stop_t() : reliable_(false), unreliable_(false){} @@ -1810,45 +1759,33 @@ void routing_manager_impl::on_stop_offer_service(client_t _client, service_t _se auto ready_to_stop = std::make_shared(); auto ptr = shared_from_this(); - auto callback = [&, its_callback_id, ptr, its_info, its_reliable_endpoint, its_unreliable_endpoint, + auto callback = [&, ptr, its_info, its_reliable_endpoint, its_unreliable_endpoint, ready_to_stop, _service, _instance, _major, _minor] (std::shared_ptr _endpoint, service_t _stopped_service) { (void)_stopped_service; - if (its_reliable_endpoint && its_reliable_endpoint == _endpoint) { + if (its_reliable_endpoint && its_reliable_endpoint == _endpoint) ready_to_stop->reliable_ = true; - } - if (its_unreliable_endpoint && its_unreliable_endpoint == _endpoint) { + if (its_unreliable_endpoint && its_unreliable_endpoint == _endpoint) ready_to_stop->unreliable_ = true; - } + if ((its_unreliable_endpoint && !ready_to_stop->unreliable_) || - (its_reliable_endpoint && !ready_to_stop->reliable_)) { - { - std::lock_guard its_lock(callback_counts_mutex_); - if (is_last_stop_callback(its_callback_id)) { - erase_offer_command(_service, _instance); - } - } + (its_reliable_endpoint && !ready_to_stop->reliable_)) { + erase_offer_command(_service, _instance); return; } if (discovery_) { - if (its_info->get_major() == _major && its_info->get_minor() == _minor) { + if (its_info->get_major() == _major && its_info->get_minor() == _minor) discovery_->stop_offer_service(its_info, true); - } } - del_routing_info(_service, _instance, (its_reliable_endpoint != nullptr), - (its_unreliable_endpoint != nullptr)); + del_routing_info(_service, _instance, (its_reliable_endpoint != nullptr), (its_unreliable_endpoint != nullptr)); for (const auto& ep: {its_reliable_endpoint, its_unreliable_endpoint}) { if (ep) { if (ep_mgr_impl_->remove_instance(_service, ep.get())) { - { - std::lock_guard its_lock(callback_counts_mutex_); - callback_counts_[its_callback_id]++; - } // last instance -> pass ANY_INSTANCE and shutdown completely ep->prepare_stop( - [&, _service, _instance, its_callback_id, ptr, its_reliable_endpoint, its_unreliable_endpoint] + [&, _service, _instance, ptr, its_reliable_endpoint, its_unreliable_endpoint] (std::shared_ptr _endpoint, service_t _stopped_service) { (void)_stopped_service; @@ -1857,49 +1794,22 @@ void routing_manager_impl::on_stop_offer_service(client_t _client, service_t _se _endpoint->is_reliable())) { _endpoint->stop(); } - { - std::lock_guard its_lock(callback_counts_mutex_); - if (is_last_stop_callback(its_callback_id)) { - erase_offer_command(_service, _instance); - } - } + erase_offer_command(_service, _instance); }, ANY_SERVICE); } // Clear service info and service group clear_service_info(_service, _instance, ep->is_reliable()); } } - { - std::lock_guard its_lock(callback_counts_mutex_); - if (is_last_stop_callback(its_callback_id)) { - erase_offer_command(_service, _instance); - } - } + erase_offer_command(_service, _instance); }; - // determine callback count - for (const auto& ep : {its_reliable_endpoint, its_unreliable_endpoint}) { - if (ep) { - std::lock_guard its_lock(callback_counts_mutex_); - auto found_id = callback_counts_.find(its_callback_id); - if (found_id != callback_counts_.end()) { - found_id->second++; - } else { - callback_counts_[its_callback_id] = 1; - } - } - } for (const auto& ep : {its_reliable_endpoint, its_unreliable_endpoint}) { - if (ep) { + if (ep) ep->prepare_stop(callback, _service); - } } if (!its_reliable_endpoint && !its_unreliable_endpoint) { - { - std::lock_guard its_lock(callback_counts_mutex_); - callback_counts_.erase(its_callback_id); - } erase_offer_command(_service, _instance); } @@ -1959,8 +1869,8 @@ bool routing_manager_impl::deliver_message(const byte_t *_data, length_t _size, << " ~> Skip message!"; return false; } else { - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member(get_sec_client(), - its_message->get_service(), its_message->get_instance(), + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( + get_sec_client(), its_message->get_service(), its_message->get_instance(), its_message->get_method())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() << " : routing_manager_impl::deliver_message: " @@ -1987,8 +1897,8 @@ bool routing_manager_impl::deliver_message(const byte_t *_data, length_t _size, return false; } - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member(_sec_client, - its_message->get_service(), its_message->get_instance(), + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( + _sec_client, its_message->get_service(), its_message->get_instance(), its_message->get_method())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() << " : routing_manager_impl::deliver_message: " @@ -2010,8 +1920,8 @@ bool routing_manager_impl::deliver_message(const byte_t *_data, length_t _size, << " ~> Skip message!"; return false; } else { - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member(get_sec_client(), - its_message->get_service(), its_message->get_instance(), + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( + get_sec_client(), its_message->get_service(), its_message->get_instance(), its_message->get_method())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() << " : routing_manager_impl::deliver_message: " @@ -2038,8 +1948,8 @@ bool routing_manager_impl::deliver_message(const byte_t *_data, length_t _size, << " ~> Skip message!"; return false; } else if (utility::is_notification(its_message->get_message_type())) { - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member(get_sec_client(), - its_message->get_service(), its_message->get_instance(), + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( + get_sec_client(), its_message->get_service(), its_message->get_instance(), its_message->get_method())) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << get_client() << " : routing_manager_impl::deliver_message: " @@ -2062,16 +1972,34 @@ bool routing_manager_impl::deliver_message(const byte_t *_data, length_t _size, return is_delivered; } +#ifdef VSOMEIP_ENABLE_DEFAULT_EVENT_CACHING +bool +routing_manager_impl::has_subscribed_eventgroup( + service_t _service, instance_t _instance) const { + + std::lock_guard its_lock(eventgroups_mutex_); + auto found_service = eventgroups_.find(_service); + if (found_service != eventgroups_.end()) { + auto found_instance = found_service->second.find(_instance); + if (found_instance != found_service->second.end()) + for (const auto &its_eventgroup : found_instance->second) + for (const auto &e : its_eventgroup.second->get_events()) + if (!e->get_subscribers().empty()) + return true; + } + + return false; +} +#endif // VSOMEIP_ENABLE_DEFAULT_EVENT_CACHING + bool routing_manager_impl::deliver_notification( service_t _service, instance_t _instance, const byte_t *_data, length_t _length, bool _reliable, client_t _bound_client, const vsomeip_sec_client_t *_sec_client, uint8_t _status_check, bool _is_from_remote) { - event_t its_event_id = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], _data[VSOMEIP_METHOD_POS_MAX]); - client_t its_client_id = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_CLIENT_POS_MIN], _data[VSOMEIP_CLIENT_POS_MAX]); + event_t its_event_id = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + client_t its_client_id = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); std::shared_ptr its_event = find_event(_service, _instance, its_event_id); if (its_event) { @@ -2153,6 +2081,42 @@ bool routing_manager_impl::deliver_notification( } } else { +#ifdef VSOMEIP_ENABLE_DEFAULT_EVENT_CACHING + if (has_subscribed_eventgroup(_service, _instance)) { + if (!is_suppress_event(_service, _instance, its_event_id)) { + VSOMEIP_WARNING << __func__ << ": Caching unregistered event [" + << std::hex << std::setw(4) << std::setfill('0') << _service << "." + << std::hex << std::setw(4) << std::setfill('0') << _instance << "." + << std::hex << std::setw(4) << std::setfill('0') << its_event_id << "]"; + } + + routing_manager_base::register_event(host_->get_client(), + _service, _instance, its_event_id, { }, + event_type_e::ET_UNKNOWN, + _reliable ? reliability_type_e::RT_RELIABLE + : reliability_type_e::RT_UNRELIABLE, + std::chrono::milliseconds::zero(), false, true, nullptr, + true, true, true); + + its_event = find_event(_service, _instance, its_event_id); + if (its_event) { + auto its_length = utility::get_payload_size(_data, _length); + auto its_payload = runtime::get()->create_payload( + &_data[VSOMEIP_PAYLOAD_POS], its_length); + its_event->set_payload(its_payload, true); + } else + VSOMEIP_ERROR << __func__ << ": Event registration failed [" + << std::hex << std::setw(4) << std::setfill('0') << _service << "." + << std::hex << std::setw(4) << std::setfill('0') << _instance << "." + << std::hex << std::setw(4) << std::setfill('0') << its_event_id << "]"; + } else if (!is_suppress_event(_service, _instance, its_event_id)) { + VSOMEIP_WARNING << __func__ << ": Dropping unregistered event [" + << std::hex << std::setw(4) << std::setfill('0') << _service << "." + << std::hex << std::setw(4) << std::setfill('0') << _instance << "." + << std::hex << std::setw(4) << std::setfill('0') << its_event_id << "] " + << "Service has no subscribed eventgroup."; + } +#else if (!is_suppress_event(_service, _instance, its_event_id)) { VSOMEIP_WARNING << __func__ << ": Event [" << std::hex << std::setw(4) << std::setfill('0') << _service << "." @@ -2160,6 +2124,7 @@ bool routing_manager_impl::deliver_notification( << std::hex << std::setw(4) << std::setfill('0') << its_event_id << "]" << " is not registered. The message is dropped."; } +#endif // VSOMEIP_ENABLE_DEFAULT_EVENT_CACHING } return true; } @@ -3183,8 +3148,7 @@ void routing_manager_impl::on_subscribe_nack(client_t _client, return_code_e routing_manager_impl::check_error(const byte_t *_data, length_t _size, instance_t _instance) { - service_t its_service = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_SERVICE_POS_MIN], - _data[VSOMEIP_SERVICE_POS_MAX]); + service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); if (_size >= VSOMEIP_PAYLOAD_POS) { if (utility::is_request(_data[VSOMEIP_MESSAGE_TYPE_POS]) @@ -3237,25 +3201,16 @@ void routing_manager_impl::send_error(return_code_e _return_code, session_t its_session = 0; major_version_t its_version = 0; - if (_size >= VSOMEIP_CLIENT_POS_MAX) { - its_client = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_CLIENT_POS_MIN], - _data[VSOMEIP_CLIENT_POS_MAX]); - } - if (_size >= VSOMEIP_SERVICE_POS_MAX) { - its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], _data[VSOMEIP_SERVICE_POS_MAX]); - } - if (_size >= VSOMEIP_METHOD_POS_MAX) { - its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], _data[VSOMEIP_METHOD_POS_MAX]); - } - if (_size >= VSOMEIP_SESSION_POS_MAX) { - its_session = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_SESSION_POS_MIN], - _data[VSOMEIP_SESSION_POS_MAX]); - } - if( _size >= VSOMEIP_INTERFACE_VERSION_POS) { + if (_size >= VSOMEIP_CLIENT_POS_MAX) + its_client = bithelper::read_uint16_be(&_data[VSOMEIP_CLIENT_POS_MIN]); + if (_size >= VSOMEIP_SERVICE_POS_MAX) + its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); + if (_size >= VSOMEIP_METHOD_POS_MAX) + its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); + if (_size >= VSOMEIP_SESSION_POS_MAX) + its_session = bithelper::read_uint16_be(&_data[VSOMEIP_SESSION_POS_MIN]); + if( _size >= VSOMEIP_INTERFACE_VERSION_POS) its_version = _data[VSOMEIP_INTERFACE_VERSION_POS]; - } auto error_message = runtime::get()->create_message(_reliable); error_message->set_client(its_client); @@ -3797,6 +3752,13 @@ void routing_manager_impl::set_routing_state(routing_state_e _routing_state) { << std::hex << std::setw(4) << std::setfill('0') << its_service.first << "." << std::hex << std::setw(4) << std::setfill('0') << its_instance.first << "]"; + // Remove the service from the offer_commands_ and prepare_stop_handlers_ to force the next offer to be processed + offer_commands_.erase(std::make_pair(its_service.first, its_instance.first)); + if (has_reliable) + its_instance.second->get_endpoint(true)->remove_stop_handler(its_service.first); + if (has_unreliable) + its_instance.second->get_endpoint(false)->remove_stop_handler(its_service.first); + del_routing_info(its_service.first, its_instance.first, has_reliable, has_unreliable); std::lock_guard its_lock(pending_offers_mutex_); @@ -3804,12 +3766,6 @@ void routing_manager_impl::set_routing_state(routing_state_e _routing_state) { if (its_pending_offer != pending_offers_.end()) its_pending_offer->second.erase(its_instance.first); - // Remove the service from the offer_commands_ and prepare_stop_handlers_ to force the next offer to be processed - offer_commands_.erase(std::make_pair(its_service.first, its_instance.first)); - if (has_reliable) - its_instance.second->get_endpoint(true)->remove_stop_handler(its_service.first); - if (has_unreliable) - its_instance.second->get_endpoint(false)->remove_stop_handler(its_service.first); } VSOMEIP_WARNING << "Service " << std::hex << std::setfill('0') diff --git a/implementation/routing/src/routing_manager_stub.cpp b/implementation/routing/src/routing_manager_stub.cpp index d0015c3f7..3a6d6a646 100644 --- a/implementation/routing/src/routing_manager_stub.cpp +++ b/implementation/routing/src/routing_manager_stub.cpp @@ -56,7 +56,7 @@ #include "../../protocol/include/update_security_policy_response_command.hpp" #include "../../security/include/policy_manager_impl.hpp" #include "../../security/include/security.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #include "../../utility/include/utility.hpp" namespace vsomeip_v3 { @@ -346,7 +346,7 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, its_major = its_command.get_major(); its_minor = its_command.get_minor(); - if (VSOMEIP_SEC_OK == security::is_client_allowed_to_offer( + if (VSOMEIP_SEC_OK == configuration_->get_security()->is_client_allowed_to_offer( _sec_client, its_service, its_instance)) { host_->offer_service(its_client, its_service, its_instance, its_major, its_minor); @@ -412,7 +412,7 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, << " which violates the security policy ~> Skip subscribe!"; } } else { - if (VSOMEIP_SEC_OK == security::is_client_allowed_to_access_member( + if (VSOMEIP_SEC_OK == configuration_->get_security()->is_client_allowed_to_access_member( _sec_client, its_service, its_instance, its_notifier)) { host_->subscribe(its_client, _sec_client, its_service, its_instance, its_eventgroup, its_major, its_notifier, its_filter); @@ -553,15 +553,9 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, auto its_message_data(its_command.get_message()); if (its_message_data.size() > VSOMEIP_MESSAGE_TYPE_POS) { - its_service = VSOMEIP_BYTES_TO_WORD( - its_message_data[VSOMEIP_SERVICE_POS_MIN], - its_message_data[VSOMEIP_SERVICE_POS_MAX]); - its_method = VSOMEIP_BYTES_TO_WORD( - its_message_data[VSOMEIP_METHOD_POS_MIN], - its_message_data[VSOMEIP_METHOD_POS_MAX]); - its_client = VSOMEIP_BYTES_TO_WORD( - its_message_data[VSOMEIP_CLIENT_POS_MIN], - its_message_data[VSOMEIP_CLIENT_POS_MAX]); + its_service = bithelper::read_uint16_be(&its_message_data[VSOMEIP_SERVICE_POS_MIN]); + its_method = bithelper::read_uint16_be(&its_message_data[VSOMEIP_METHOD_POS_MIN]); + its_client = bithelper::read_uint16_be(&its_message_data[VSOMEIP_CLIENT_POS_MIN]); its_instance = its_command.get_instance(); is_reliable = its_command.is_reliable(); @@ -570,7 +564,7 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, // Allow response messages from local proxies as answer to remote requests // but check requests sent by local proxies to remote against policy. if (utility::is_request(its_message_data[VSOMEIP_MESSAGE_TYPE_POS])) { - if (VSOMEIP_SEC_OK != security::is_client_allowed_to_access_member( + if (VSOMEIP_SEC_OK != configuration_->get_security()->is_client_allowed_to_access_member( _sec_client, its_service, its_instance, its_method)) { VSOMEIP_WARNING << "vSomeIP Security: Client 0x" << std::hex << its_client << " : routing_manager_stub::on_message: " @@ -581,11 +575,7 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, } } // reduce by size of instance, flush, reliable, client and is_valid_crc flag - auto its_contained_size = VSOMEIP_BYTES_TO_LONG( - its_message_data[VSOMEIP_LENGTH_POS_MIN], - its_message_data[VSOMEIP_LENGTH_POS_MIN+1], - its_message_data[VSOMEIP_LENGTH_POS_MIN+2], - its_message_data[VSOMEIP_LENGTH_POS_MIN+3]); + uint32_t its_contained_size = bithelper::read_uint32_be(&its_message_data[VSOMEIP_LENGTH_POS_MIN]); if (its_message_data.size() != its_contained_size + VSOMEIP_SOMEIP_HEADER_SIZE) { VSOMEIP_WARNING << "Received a SEND command containing message with invalid size -> skip!"; break; @@ -609,16 +599,11 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, if (its_message_data.size() > VSOMEIP_MESSAGE_TYPE_POS) { its_client = its_command.get_target(); - its_service = VSOMEIP_BYTES_TO_WORD( - its_message_data[VSOMEIP_SERVICE_POS_MIN], - its_message_data[VSOMEIP_SERVICE_POS_MAX]); + its_service = bithelper::read_uint16_be(&its_message_data[VSOMEIP_SERVICE_POS_MIN]); its_instance = its_command.get_instance(); - auto its_contained_size = VSOMEIP_BYTES_TO_LONG( - its_message_data[VSOMEIP_LENGTH_POS_MIN], - its_message_data[VSOMEIP_LENGTH_POS_MIN+1], - its_message_data[VSOMEIP_LENGTH_POS_MIN+2], - its_message_data[VSOMEIP_LENGTH_POS_MIN+3]); + uint32_t its_contained_size = bithelper::read_uint32_be(&its_message_data[VSOMEIP_LENGTH_POS_MIN]); + if (its_message_data.size() != its_contained_size + VSOMEIP_SOMEIP_HEADER_SIZE) { VSOMEIP_WARNING << "Received a NOTIFY command containing message with invalid size -> skip!"; break; @@ -643,7 +628,7 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size, std::set its_allowed_requests; for (const auto &r : its_requests) { - if (VSOMEIP_SEC_OK == security::is_client_allowed_to_request( + if (VSOMEIP_SEC_OK == configuration_->get_security()->is_client_allowed_to_request( _sec_client, r.service_, r.instance_)) { host_->request_service(its_client, r.service_, r.instance_, r.major_, r.minor_); @@ -836,7 +821,7 @@ void routing_manager_stub::on_register_application(client_t _client) { vsomeip_sec_client_t its_sec_client; std::set > its_policies; - bool has_mapping = policy_manager_impl::get() + bool has_mapping = configuration_->get_policy_manager() ->get_client_to_sec_client_mapping(_client, its_sec_client); if (has_mapping) { if (its_sec_client.port == VSOMEIP_SEC_PORT_UNUSED) { @@ -1222,14 +1207,14 @@ void routing_manager_stub::distribute_credentials(client_t _hoster, service_t _s // search for UID / GID linked with the client ID that offers the requested services vsomeip_sec_client_t its_sec_client; - if (policy_manager_impl::get()->get_client_to_sec_client_mapping(_hoster, its_sec_client)) { + if (configuration_->get_policy_manager()->get_client_to_sec_client_mapping(_hoster, its_sec_client)) { std::pair its_uid_gid; its_uid_gid.first = its_sec_client.user; its_uid_gid.second = its_sec_client.group; its_credentials.insert(its_uid_gid); for (auto its_requesting_client : its_requesting_clients) { vsomeip_sec_client_t its_requester_sec_client; - if (policy_manager_impl::get()->get_client_to_sec_client_mapping( + if (configuration_->get_policy_manager()->get_client_to_sec_client_mapping( its_requesting_client, its_requester_sec_client)) { if (!utility::compare(its_sec_client, its_requester_sec_client)) send_client_credentials(its_requesting_client, its_credentials); @@ -1597,8 +1582,8 @@ void routing_manager_stub::create_local_receiver() { if (local_receiver_) { return; } -#if defined(__linux__) || defined(ANDROID) - else if (!policy_manager_impl::get()->check_credentials(get_client(), host_->get_sec_client())) { +#ifdef __linux__ + else if (!configuration_->get_policy_manager()->check_credentials(get_client(), host_->get_sec_client())) { VSOMEIP_ERROR << "vSomeIP Security: Client 0x" << std::hex << get_client() << " : routing_manager_stub::create_local_receiver: isn't allowed" << " to create a server endpoint due to credential check failed!"; @@ -1794,7 +1779,7 @@ void routing_manager_stub::update_registration(client_t _client, "registering." : "deregistering."); if (_type != registration_type_e::REGISTER) { - policy_manager_impl::get()->remove_client_to_sec_client_mapping(_client); + configuration_->get_policy_manager()->remove_client_to_sec_client_mapping(_client); } else { if (_port > 0 && _port < ILLEGAL_PORT) host_->add_guest(_client, _address, _port); @@ -1845,7 +1830,7 @@ void routing_manager_stub::handle_credentials(const client_t _client, std::set

its_guard(routing_info_mutex_); std::set> its_credentials; vsomeip_sec_client_t its_requester_sec_client; - if (policy_manager_impl::get()->get_client_to_sec_client_mapping(_client, its_requester_sec_client)) { + if (configuration_->get_policy_manager()->get_client_to_sec_client_mapping(_client, its_requester_sec_client)) { // determine credentials of offering clients using current routing info std::set its_offering_clients; @@ -1861,7 +1846,7 @@ void routing_manager_stub::handle_credentials(const client_t _client, std::set

get_client_to_sec_client_mapping(its_offering_client, its_sec_client)) { + if (configuration_->get_policy_manager()->get_client_to_sec_client_mapping(its_offering_client, its_sec_client)) { if (its_sec_client.port == VSOMEIP_SEC_PORT_UNUSED && !utility::compare(its_sec_client, its_requester_sec_client)) { @@ -2212,7 +2197,7 @@ routing_manager_stub::add_requester_policies(uid_t _uid, gid_t _gid, // Check whether clients with uid/gid are already registered. // If yes, update their policy std::unordered_set its_clients; - policy_manager_impl::get()->get_clients(_uid, _gid, its_clients); + configuration_->get_policy_manager()->get_clients(_uid, _gid, its_clients); if (!its_clients.empty()) return send_requester_policies(its_clients, _policies); @@ -2299,17 +2284,15 @@ routing_manager_stub::send_requester_policies(const std::unordered_set its_message.push_back(0); uint32_t its_policy_size = static_cast(its_policy_data.size() + sizeof(uint32_t)); - its_message.push_back(VSOMEIP_LONG_BYTE0(its_policy_size)); - its_message.push_back(VSOMEIP_LONG_BYTE1(its_policy_size)); - its_message.push_back(VSOMEIP_LONG_BYTE2(its_policy_size)); - its_message.push_back(VSOMEIP_LONG_BYTE3(its_policy_size)); - its_policy_id = pending_security_update_add(_clients); - its_message.push_back(VSOMEIP_LONG_BYTE0(its_policy_id)); - its_message.push_back(VSOMEIP_LONG_BYTE1(its_policy_id)); - its_message.push_back(VSOMEIP_LONG_BYTE2(its_policy_id)); - its_message.push_back(VSOMEIP_LONG_BYTE3(its_policy_id)); + uint8_t new_its_policy_size[4] = {0}; + bithelper::write_uint32_le(its_policy_size, new_its_policy_size); + its_message.insert(its_message.end(), new_its_policy_size, new_its_policy_size + sizeof(new_its_policy_size)); + its_policy_id = pending_security_update_add(_clients); + uint8_t new_its_policy_id[4] = {0}; + bithelper::write_uint32_le(its_policy_id, new_its_policy_id); + its_message.insert(its_message.end(), new_its_policy_id, new_its_policy_id + sizeof(new_its_policy_id)); its_message.insert(its_message.end(), its_policy_data.begin(), its_policy_data.end()); for (const auto c : _clients) { @@ -2391,11 +2374,11 @@ bool routing_manager_stub::update_security_policy_configuration( policy_cache_add(_uid, _payload); // update security policy from configuration - policy_manager_impl::get()->update_security_policy(_uid, _gid, _policy); + configuration_->get_policy_manager()->update_security_policy(_uid, _gid, _policy); // Build requester policies for the services offered by the new policy std::set > its_requesters; - policy_manager_impl::get()->get_requester_policies(_policy, its_requesters); + configuration_->get_policy_manager()->get_requester_policies(_policy, its_requesters); // and add them to the requester policy cache add_requester_policies(_uid, _gid, its_requesters); @@ -2454,7 +2437,7 @@ bool routing_manager_stub::remove_security_policy_configuration( // remove security policy from configuration (only if there was a updateACL call before) if (is_policy_cached(_uid)) { - if (!policy_manager_impl::get()->remove_security_policy(_uid, _gid)) { + if (!configuration_->get_policy_manager()->remove_security_policy(_uid, _gid)) { _handler(security_update_state_e::SU_UNKNOWN_USER_ID); ret = false; } else { diff --git a/implementation/runtime/include/application_impl.hpp b/implementation/runtime/include/application_impl.hpp index c647b5316..5a6ba447c 100644 --- a/implementation/runtime/include/application_impl.hpp +++ b/implementation/runtime/include/application_impl.hpp @@ -148,6 +148,7 @@ class application_impl: public application, VSOMEIP_EXPORT void set_sec_client_port(port_t _port); VSOMEIP_EXPORT diagnosis_t get_diagnosis() const; VSOMEIP_EXPORT std::shared_ptr get_configuration() const; + VSOMEIP_EXPORT std::shared_ptr get_policy_manager() const; VSOMEIP_EXPORT std::shared_ptr get_public_configuration() const; VSOMEIP_EXPORT boost::asio::io_context &get_io(); diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp index db880b42d..63b8328e8 100644 --- a/implementation/runtime/src/application_impl.cpp +++ b/implementation/runtime/src/application_impl.cpp @@ -190,9 +190,9 @@ bool application_impl::init() { // Set security mode if (configuration_->is_security_enabled()) { if (configuration_->is_security_external()) { - if (security::load()) { + if (configuration_->get_security()->load()) { VSOMEIP_INFO << "Using external security implementation!"; - auto its_result = security::initialize(); + auto its_result = configuration_->get_security()->initialize(); if (VSOMEIP_SEC_POLICY_OK != its_result) VSOMEIP_ERROR << "Intializing external security implementation failed (" << std::dec << its_result << ')'; @@ -1490,6 +1490,10 @@ std::shared_ptr application_impl::get_configuration() const { return configuration_; } +std::shared_ptr application_impl::get_policy_manager() const { + return configuration_->get_policy_manager(); +} + diagnosis_t application_impl::get_diagnosis() const { return configuration_->get_diagnosis_address(); } diff --git a/implementation/security/include/policy_manager_impl.hpp b/implementation/security/include/policy_manager_impl.hpp index 35c1108ca..6d95aa6da 100644 --- a/implementation/security/include/policy_manager_impl.hpp +++ b/implementation/security/include/policy_manager_impl.hpp @@ -37,8 +37,6 @@ class VSOMEIP_IMPORT_EXPORT policy_manager_impl POLICY_PATH_INEXISTENT = 0x2 }; - static std::shared_ptr get(); - policy_manager_impl(); #ifndef VSOMEIP_DISABLE_SECURITY diff --git a/implementation/security/include/security.hpp b/implementation/security/include/security.hpp index 0eda37f54..5736776fd 100644 --- a/implementation/security/include/security.hpp +++ b/implementation/security/include/security.hpp @@ -6,29 +6,38 @@ #ifndef VSOMEIP_V3_SECURITY_HPP_ #define VSOMEIP_V3_SECURITY_HPP_ +#include +#include + #include #include +#include "policy_manager_impl.hpp" + namespace vsomeip_v3 { class VSOMEIP_IMPORT_EXPORT security { public: - static bool load(); + security(std::shared_ptr _policy_manager); + bool load(); - static decltype(&vsomeip_sec_policy_initialize) initialize; - static decltype(&vsomeip_sec_policy_authenticate_router) authenticate_router; - static decltype(&vsomeip_sec_policy_is_client_allowed_to_offer) is_client_allowed_to_offer; - static decltype(&vsomeip_sec_policy_is_client_allowed_to_request) is_client_allowed_to_request; - static decltype(&vsomeip_sec_policy_is_client_allowed_to_access_member) is_client_allowed_to_access_member; - static decltype(&vsomeip_sec_sync_client) sync_client; + std::function initialize; + std::function authenticate_router; + std::function is_client_allowed_to_offer; + std::function is_client_allowed_to_request; + std::function is_client_allowed_to_access_member; + std::function sync_client; private: - static decltype(vsomeip_sec_policy_initialize) default_initialize; - static decltype(vsomeip_sec_policy_authenticate_router) default_authenticate_router; - static decltype(vsomeip_sec_policy_is_client_allowed_to_offer) default_is_client_allowed_to_offer; - static decltype(vsomeip_sec_policy_is_client_allowed_to_request) default_is_client_allowed_to_request; - static decltype(vsomeip_sec_policy_is_client_allowed_to_access_member) default_is_client_allowed_to_access_member; - static decltype(vsomeip_sec_sync_client) default_sync_client; + + decltype(vsomeip_sec_policy_initialize) default_initialize; + decltype(vsomeip_sec_policy_authenticate_router) default_authenticate_router; + decltype(vsomeip_sec_policy_is_client_allowed_to_offer) default_is_client_allowed_to_offer; + decltype(vsomeip_sec_policy_is_client_allowed_to_request) default_is_client_allowed_to_request; + decltype(vsomeip_sec_policy_is_client_allowed_to_access_member) default_is_client_allowed_to_access_member; + decltype(vsomeip_sec_sync_client) default_sync_client; + + std::shared_ptr policy_manager_; }; } // namespace vsomeip_v3 diff --git a/implementation/security/src/policy.cpp b/implementation/security/src/policy.cpp index da0bbd869..9c30f5193 100644 --- a/implementation/security/src/policy.cpp +++ b/implementation/security/src/policy.cpp @@ -8,7 +8,7 @@ #include #include "../include/policy.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" namespace vsomeip_v3 { @@ -268,7 +268,7 @@ policy::deserialize_u16(const byte_t * &_data, uint32_t &_size, if (_size < sizeof(uint16_t)) return false; - _value = VSOMEIP_BYTES_TO_WORD(_data[0], _data[1]); + _value = bithelper::read_uint16_be(_data); _data += sizeof(uint16_t); _size -= static_cast(sizeof(uint16_t)); @@ -283,7 +283,7 @@ policy::deserialize_u32(const byte_t * &_data, uint32_t &_size, if (_size < sizeof(uint32_t)) return false; - _value = VSOMEIP_BYTES_TO_LONG(_data[0], _data[1], _data[2], _data[3]); + _value = bithelper::read_uint32_be(_data); _data += sizeof(uint32_t); _size -= static_cast(sizeof(uint32_t)); @@ -419,28 +419,25 @@ void policy::serialize_u16(uint16_t _value, std::vector &_data) const { - _data.push_back(VSOMEIP_WORD_BYTE1(_value)); - _data.push_back(VSOMEIP_WORD_BYTE0(_value)); + uint8_t new_buffer[2] = {0}; + bithelper::write_uint16_be(_value, new_buffer); + _data.insert(_data.end(), new_buffer, new_buffer + sizeof(new_buffer)); } void policy::serialize_u32(uint32_t _value, std::vector &_data) const { - _data.push_back(VSOMEIP_LONG_BYTE3(_value)); - _data.push_back(VSOMEIP_LONG_BYTE2(_value)); - _data.push_back(VSOMEIP_LONG_BYTE1(_value)); - _data.push_back(VSOMEIP_LONG_BYTE0(_value)); + uint8_t new_buffer[4] = {0}; + bithelper::write_uint32_be(_value, new_buffer); + _data.insert(_data.end(), new_buffer, new_buffer + sizeof(new_buffer)); } void policy::serialize_u32_at(uint32_t _value, std::vector &_data, size_t _pos) const { - _data[_pos] = VSOMEIP_LONG_BYTE3(_value); - _data[_pos+1] = VSOMEIP_LONG_BYTE2(_value); - _data[_pos+2] = VSOMEIP_LONG_BYTE1(_value); - _data[_pos+3] = VSOMEIP_LONG_BYTE0(_value); + bithelper::write_uint32_be(_value, &_data[_pos]); } void diff --git a/implementation/security/src/policy_manager.cpp b/implementation/security/src/policy_manager.cpp deleted file mode 100644 index ad1b52e49..000000000 --- a/implementation/security/src/policy_manager.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2019 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) -// 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/. - -#include "../include/policy_manager_impl.hpp" - -#ifndef VSOMEIP_DISABLE_SECURITY -namespace vsomeip_v3 { - -std::shared_ptr -policy_manager::get() { - return policy_manager_impl::get(); -} - -} // namespace vsomeip_v3 -#endif diff --git a/implementation/security/src/policy_manager_impl.cpp b/implementation/security/src/policy_manager_impl.cpp index 2dead74af..d4a376cd1 100644 --- a/implementation/security/src/policy_manager_impl.cpp +++ b/implementation/security/src/policy_manager_impl.cpp @@ -1448,43 +1448,4 @@ policy_manager_impl::get_sec_client_to_clients_mapping( return false; } -//////////////////////////////////////////////////////////////////////////////// -// Manage the security object -//////////////////////////////////////////////////////////////////////////////// -static std::shared_ptr *the_policy_manager_ptr__(nullptr); -static std::mutex the_policy_manager_mutex__; - -std::shared_ptr -policy_manager_impl::get() { -#if defined(__linux__) || defined(ANDROID) || defined(__QNX__) - std::lock_guard its_lock(the_policy_manager_mutex__); -#endif - if(the_policy_manager_ptr__ == nullptr) { - the_policy_manager_ptr__ = new std::shared_ptr(); - } - if (the_policy_manager_ptr__ != nullptr) { - if (!(*the_policy_manager_ptr__)) { - *the_policy_manager_ptr__ = std::make_shared(); - } - return *the_policy_manager_ptr__; - } - return nullptr; -} - -#if defined(__linux__) || defined(ANDROID) || defined(__QNX__) -static void security_teardown(void) __attribute__((destructor)); -static void security_teardown(void) -{ - if (the_policy_manager_ptr__ != nullptr) { - // TODO: This mutex is causing a crash due to changes in the way mutexes are defined. - // Since this function only runs on the main thread, no mutex should be needed. Leaving a - // comment pending a refactor. - // std::lock_guard its_lock(the_policy_manager_mutex__); - the_policy_manager_ptr__->reset(); - delete the_policy_manager_ptr__; - the_policy_manager_ptr__ = nullptr; - } -} -#endif - } // namespace vsomeip_v3 diff --git a/implementation/security/src/security.cpp b/implementation/security/src/security.cpp index 19ff73dad..e17e34730 100644 --- a/implementation/security/src/security.cpp +++ b/implementation/security/src/security.cpp @@ -4,14 +4,15 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "../include/security.hpp" -#include "../include/policy_manager_impl.hpp" #include +#include #ifdef ANDROID #include "../../configuration/include/internal_android.hpp" #else #include "../../configuration/include/internal.hpp" #endif -#include "../../plugin/include/plugin_manager.hpp" +#include "../../configuration/include/configuration_plugin.hpp" +#include "../../configuration/include/configuration_impl.hpp" #include #include @@ -21,51 +22,95 @@ #include #endif -#define VSOMEIP_SEC_POLICY_SYMDEF(sym) symdef_t{\ - "vsomeip_sec_policy_"#sym, nullptr, reinterpret_cast(&sym) \ -} +template +std::function security_load_function(void *_library, std::string const &_name) { + void *its_function; +#ifdef _WIN32 + its_function = GetProcAddress(reinterpret_cast(_library), _name.c_str()); +#else + its_function = dlsym(_library, _name.c_str()); +#endif + if (!its_function) { + VSOMEIP_ERROR << __func__ + << ": security library misses \"" + << _name + << "\" function."; + return nullptr; + } -#define VSOMEIP_SEC_SYMDEF(sym) symdef_t{\ - "vsomeip_sec_"#sym, nullptr, reinterpret_cast(&sym) \ + return reinterpret_cast(its_function); } +#define VSOMEIP_SECURITY_LOAD_IMPL(symbol, variable) \ + auto variable = security_load_function(its_library, #symbol); \ + if (!variable) { \ + its_manager->unload_library(its_library); \ + return false; \ + } + +#define VSOMEIP_SECURITY_LOAD(name) \ + VSOMEIP_SECURITY_LOAD_IMPL(vsomeip_sec_##name, loaded_##name) + +#define VSOMEIP_SECURITY_POLICY_LOAD(name) \ + VSOMEIP_SECURITY_LOAD_IMPL(vsomeip_sec_policy_##name, loaded_##name) + +#define VSOMEIP_SECURITY_ASSIGN_FUNCTION(name) \ + name = loaded_##name + namespace vsomeip_v3 { -bool -security::load() { - using symdef_t = std::tuple; - std::array symbol_table{ - VSOMEIP_SEC_POLICY_SYMDEF(initialize), - VSOMEIP_SEC_POLICY_SYMDEF(authenticate_router), - VSOMEIP_SEC_POLICY_SYMDEF(is_client_allowed_to_offer), - VSOMEIP_SEC_POLICY_SYMDEF(is_client_allowed_to_request), - VSOMEIP_SEC_POLICY_SYMDEF(is_client_allowed_to_access_member), - VSOMEIP_SEC_SYMDEF(sync_client) +security::security(std::shared_ptr _policy_manager): + policy_manager_(_policy_manager) { + + initialize = [&]() -> vsomeip_sec_policy_result_t { + return default_initialize(); }; - if (auto manager = plugin_manager::get()) { - if (auto lib = manager->load_library(VSOMEIP_SEC_LIBRARY)) { - // First we load the symbols into the 2nd tuple element - for (auto& symdef : symbol_table) { - auto name = std::get<0>(symdef); - auto& symbol = std::get<1>(symdef); - if (!(symbol = manager->load_symbol(lib, name))) { - VSOMEIP_ERROR << __func__ - << ": security library misses " - << std::quoted(name) - << " function."; - manager->unload_library(lib); - return false; - } - } - - // Now that we have all symbols loaded, - // assign the 2nd tuple element to the 3rd - for (auto& symdef : symbol_table) { - auto symbol = std::get<1>(symdef); - auto& stub = std::get<2>(symdef); - *stub = symbol; - } + authenticate_router = [&](const vsomeip_sec_client_t *_server) -> vsomeip_sec_acl_result_t { + return default_authenticate_router(_server); + }; + + is_client_allowed_to_offer = [&](const vsomeip_sec_client_t *_client, + vsomeip_sec_service_id_t _service, vsomeip_sec_instance_id_t _instance) -> vsomeip_sec_acl_result_t { + return default_is_client_allowed_to_offer(_client, _service, _instance); + }; + + is_client_allowed_to_request = [&](const vsomeip_sec_client_t *_client, + vsomeip_sec_service_id_t _service, vsomeip_sec_instance_id_t _instance) -> vsomeip_sec_acl_result_t { + return default_is_client_allowed_to_request(_client, _service, _instance); + }; + + is_client_allowed_to_access_member = [&](const vsomeip_sec_client_t *_client, + vsomeip_sec_service_id_t _service, vsomeip_sec_instance_id_t _instance, + vsomeip_sec_member_id_t _member) -> vsomeip_sec_acl_result_t { + return default_is_client_allowed_to_access_member(_client, _service, + _instance, _member); + }; + + sync_client = [&](vsomeip_sec_client_t *_client) { + return default_sync_client(_client); + }; +} + +bool +security::load() { + if (auto its_manager = plugin_manager::get()) { + if (auto its_library = its_manager->load_library(VSOMEIP_SEC_LIBRARY)) { + + VSOMEIP_SECURITY_POLICY_LOAD(initialize); + VSOMEIP_SECURITY_POLICY_LOAD(authenticate_router); + VSOMEIP_SECURITY_POLICY_LOAD(is_client_allowed_to_offer); + VSOMEIP_SECURITY_POLICY_LOAD(is_client_allowed_to_request); + VSOMEIP_SECURITY_POLICY_LOAD(is_client_allowed_to_access_member); + VSOMEIP_SECURITY_LOAD(sync_client); + + // All symbols could be loaded, assign them + VSOMEIP_SECURITY_ASSIGN_FUNCTION(initialize); + VSOMEIP_SECURITY_ASSIGN_FUNCTION(authenticate_router); + VSOMEIP_SECURITY_ASSIGN_FUNCTION(is_client_allowed_to_offer); + VSOMEIP_SECURITY_ASSIGN_FUNCTION(is_client_allowed_to_request); + VSOMEIP_SECURITY_ASSIGN_FUNCTION(is_client_allowed_to_access_member); + VSOMEIP_SECURITY_ASSIGN_FUNCTION(sync_client); // Symbol loading complete, success! return true; @@ -81,82 +126,61 @@ security::load() { return false; } -decltype(security::initialize) -security::initialize = security::default_initialize; - -decltype(security::authenticate_router) -security::authenticate_router = security::default_authenticate_router; - -decltype(security::is_client_allowed_to_offer) -security::is_client_allowed_to_offer = security::default_is_client_allowed_to_offer; - -decltype(security::is_client_allowed_to_request) -security::is_client_allowed_to_request = security::default_is_client_allowed_to_request; - -decltype(security::is_client_allowed_to_access_member) -security::is_client_allowed_to_access_member = security::default_is_client_allowed_to_access_member; - -decltype(security::sync_client) -security::sync_client = security::default_sync_client; - // // Default interface implementation // vsomeip_sec_policy_result_t -security::default_initialize(void) { +security::default_initialize() { return VSOMEIP_SEC_POLICY_OK; } vsomeip_sec_acl_result_t -security::default_authenticate_router( - const vsomeip_sec_client_t *_server) { +security::default_authenticate_router(const vsomeip_sec_client_t *_server) { + if (_server && _server->port != VSOMEIP_SEC_PORT_UNUSED) return VSOMEIP_SEC_OK; - if (policy_manager_impl::get()->check_routing_credentials(_server)) + if (policy_manager_->check_routing_credentials(_server)) return VSOMEIP_SEC_OK; else return VSOMEIP_SEC_PERM_DENIED; } vsomeip_sec_acl_result_t -security::default_is_client_allowed_to_offer( - const vsomeip_sec_client_t *_client, - vsomeip_sec_service_id_t _service, - vsomeip_sec_instance_id_t _instance) { +security::default_is_client_allowed_to_offer(const vsomeip_sec_client_t *_client, + vsomeip_sec_service_id_t _service, vsomeip_sec_instance_id_t _instance) { + if (_client && _client->port != VSOMEIP_SEC_PORT_UNUSED) return VSOMEIP_SEC_OK; - if (policy_manager_impl::get()->is_offer_allowed(_client, _service, _instance)) + if (policy_manager_->is_offer_allowed(_client, _service, _instance)) return VSOMEIP_SEC_OK; else return VSOMEIP_SEC_PERM_DENIED; } vsomeip_sec_acl_result_t -security::default_is_client_allowed_to_request( - const vsomeip_sec_client_t *_client, - vsomeip_sec_service_id_t _service, - vsomeip_sec_instance_id_t _instance) { +security::default_is_client_allowed_to_request(const vsomeip_sec_client_t *_client, + vsomeip_sec_service_id_t _service, vsomeip_sec_instance_id_t _instance) { + if (_client && _client->port != VSOMEIP_SEC_PORT_UNUSED) return VSOMEIP_SEC_OK; - if (policy_manager_impl::get()->is_client_allowed(_client, _service, _instance, 0x00, true)) + if (policy_manager_->is_client_allowed(_client, _service, _instance, 0x00, true)) return VSOMEIP_SEC_OK; else return VSOMEIP_SEC_PERM_DENIED; } vsomeip_sec_acl_result_t -security::default_is_client_allowed_to_access_member( - const vsomeip_sec_client_t *_client, - vsomeip_sec_service_id_t _service, - vsomeip_sec_instance_id_t _instance, +security::default_is_client_allowed_to_access_member(const vsomeip_sec_client_t *_client, + vsomeip_sec_service_id_t _service, vsomeip_sec_instance_id_t _instance, vsomeip_sec_member_id_t _member) { + if (_client && _client->port != VSOMEIP_SEC_PORT_UNUSED) return VSOMEIP_SEC_OK; - if (policy_manager_impl::get()->is_client_allowed(_client, _service, _instance, _member, false)) + if (policy_manager_->is_client_allowed(_client, _service, _instance, _member, false)) return VSOMEIP_SEC_OK; else return VSOMEIP_SEC_PERM_DENIED; @@ -164,7 +188,6 @@ security::default_is_client_allowed_to_access_member( void security::default_sync_client(vsomeip_sec_client_t *_client) { - (void)_client; } diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp index c38804575..33c3046c2 100644 --- a/implementation/service_discovery/src/service_discovery_impl.cpp +++ b/implementation/service_discovery/src/service_discovery_impl.cpp @@ -40,7 +40,7 @@ #include "../../routing/include/event.hpp" #include "../../routing/include/eventgroupinfo.hpp" #include "../../routing/include/serviceinfo.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" namespace vsomeip_v3 { namespace sd { @@ -1405,7 +1405,7 @@ service_discovery_impl::process_serviceentry( VSOMEIP_ERROR << __func__ << ": Unsupported service entry type"; } } else if (its_type != entry_type_e::FIND_SERVICE - && (_sd_ac_state.sd_acceptance_required_ || _sd_ac_state.accept_entries_)) { + && (!_sd_ac_state.sd_acceptance_required_ || _sd_ac_state.accept_entries_)) { // stop sending find service in repetition phase update_request(its_service, its_instance); @@ -2767,12 +2767,10 @@ service_discovery_impl::check_ipv4_address( << its_address; is_valid = false; } else { - const std::uint32_t self = VSOMEIP_BYTES_TO_LONG(its_unicast_address[0], - its_unicast_address[1], its_unicast_address[2], its_unicast_address[3]); - const std::uint32_t remote = VSOMEIP_BYTES_TO_LONG(endpoint_address[0], - endpoint_address[1], endpoint_address[2], endpoint_address[3]); - const std::uint32_t netmask = VSOMEIP_BYTES_TO_LONG(its_netmask[0], - its_netmask[1], its_netmask[2], its_netmask[3]); + const std::uint32_t self = bithelper::read_uint32_be(&its_unicast_address[0]); + const std::uint32_t remote = bithelper::read_uint32_be(&endpoint_address[0]); + const std::uint32_t netmask = bithelper::read_uint32_be(&its_netmask[0]); + if ((self & netmask) != (remote & netmask)) { VSOMEIP_ERROR<< "Subscriber's IP isn't in the same subnet as host's IP: " << its_address; diff --git a/implementation/tracing/src/connector_impl.cpp b/implementation/tracing/src/connector_impl.cpp index 2f93bd098..eef8537cc 100644 --- a/implementation/tracing/src/connector_impl.cpp +++ b/implementation/tracing/src/connector_impl.cpp @@ -16,7 +16,7 @@ #include "../include/connector_impl.hpp" #include "../include/defines.hpp" #include "../../configuration/include/trace.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" #ifdef ANDROID #include @@ -220,19 +220,12 @@ void connector_impl::trace(const byte_t *_header, uint16_t _header_size, if (is_sd_message(_data, its_data_size) && !is_sd_enabled_) return; // tracing of service discovery messages is disabled! - service_t its_service = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_SERVICE_POS_MIN], - _data[VSOMEIP_SERVICE_POS_MAX]); + service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]); // Instance is not part of the SOME/IP header, read it from the trace // header - instance_t its_instance = VSOMEIP_BYTES_TO_WORD( - _header[VSOMEIP_TC_INSTANCE_POS_MIN], - _header[VSOMEIP_TC_INSTANCE_POS_MAX]); - - method_t its_method = VSOMEIP_BYTES_TO_WORD( - _data[VSOMEIP_METHOD_POS_MIN], - _data[VSOMEIP_METHOD_POS_MAX]); + instance_t its_instance = bithelper::read_uint16_be(&_header[VSOMEIP_TC_INSTANCE_POS_MIN]); + method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]); // Forward to channel if the filter set of the channel allows std::lock_guard its_channels_lock(channels_mutex_); diff --git a/implementation/tracing/src/header.cpp b/implementation/tracing/src/header.cpp index bea82c38e..924beab5f 100644 --- a/implementation/tracing/src/header.cpp +++ b/implementation/tracing/src/header.cpp @@ -8,7 +8,7 @@ #include "../include/header.hpp" #include "../../endpoints/include/endpoint.hpp" #include "../../endpoints/include/client_endpoint.hpp" -#include "../../utility/include/byteorder.hpp" +#include "../../utility/include/bithelper.hpp" namespace vsomeip_v3 { namespace trace { @@ -54,17 +54,12 @@ bool header::prepare(const endpoint *_endpoint, bool _is_sending, void header::prepare(const boost::asio::ip::address_v4 &_address, std::uint16_t _port, protocol_e _protocol, bool _is_sending, instance_t _instance) { - unsigned long its_address_as_long = _address.to_ulong(); - data_[0] = VSOMEIP_LONG_BYTE3(its_address_as_long); - data_[1] = VSOMEIP_LONG_BYTE2(its_address_as_long); - data_[2] = VSOMEIP_LONG_BYTE1(its_address_as_long); - data_[3] = VSOMEIP_LONG_BYTE0(its_address_as_long); - data_[4] = VSOMEIP_WORD_BYTE1(_port); - data_[5] = VSOMEIP_WORD_BYTE0(_port); - data_[6] = static_cast(_protocol); - data_[7] = static_cast(_is_sending); - data_[8] = VSOMEIP_WORD_BYTE1(_instance); - data_[9] = VSOMEIP_WORD_BYTE0(_instance); + + bithelper::write_uint32_be((uint32_t)_address.to_ulong(), data_); // [0-3] Address + bithelper::write_uint16_be(_port, &data_[4]); // [4-5] Port + data_[6] = static_cast(_protocol); // [6] Protocol + data_[7] = static_cast(_is_sending); // [7] is_sending + bithelper::write_uint16_be(_instance, &data_[8]); // [8-9] Instance } } // namespace trace diff --git a/implementation/utility/include/bithelper.hpp b/implementation/utility/include/bithelper.hpp new file mode 100644 index 000000000..eae200d3b --- /dev/null +++ b/implementation/utility/include/bithelper.hpp @@ -0,0 +1,134 @@ +// Copyright (C) 2014-2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// 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/. + +#ifndef VSOMEIP_V3_BITHELPER_HPP +#define VSOMEIP_V3_BITHELPER_HPP + +#include +#include +#include +#include +#include + +namespace vsomeip_v3 { + +class bithelper { +public: + bithelper() = delete; + + //Write Methods + inline static void write_uint16_be(uint16_t _value, uint8_t* _buffer) { + if (get_endianness() != endianess_e::be) { + _value = swap_endianness(_value); + } + std::memcpy(_buffer, reinterpret_cast(&_value), sizeof(_value)); + } + + inline static void write_uint16_le(uint16_t _value, uint8_t* _buffer) { + if (get_endianness() != endianess_e::le) { + _value = swap_endianness(_value); + } + std::memcpy(_buffer, reinterpret_cast(&_value), sizeof(_value)); + } + + inline static void write_uint32_be(uint32_t _value, uint8_t* _buffer) { + if (get_endianness() != endianess_e::be) { + _value = swap_endianness(_value); + } + std::memcpy(_buffer, reinterpret_cast(&_value), sizeof(_value)); + } + + inline static void write_uint32_le(uint32_t _value, uint8_t* _buffer) { + if (get_endianness() != endianess_e::le) { + _value = swap_endianness(_value); + } + std::memcpy(_buffer, reinterpret_cast(&_value), sizeof(_value)); + } + + inline static void write_uint64_be(uint64_t _value, uint8_t* _buffer) { + if (get_endianness() != endianess_e::be) { + _value = swap_endianness(_value); + } + std::memcpy(_buffer, reinterpret_cast(&_value), sizeof(_value)); + } + + inline static void write_uint64_le(uint64_t _value, uint8_t* _buffer) { + if (get_endianness() != endianess_e::le) { + _value = swap_endianness(_value); + } + std::memcpy(_buffer, reinterpret_cast(&_value), sizeof(_value)); + } + + //Read Methods + inline static uint16_t read_uint16_be(const uint8_t* _buffer) { + uint16_t value = 0; + std::memcpy(&value, _buffer, sizeof(value)); + return get_endianness() == endianess_e::be ? value : swap_endianness(value); + } + + inline static uint16_t read_uint16_le(const uint8_t* _buffer) { + uint16_t value = 0; + std::memcpy(&value, _buffer, sizeof(value)); + return get_endianness() == endianess_e::le ? value : swap_endianness(value); + } + + inline static uint32_t read_uint32_be(const uint8_t* _buffer) { + uint32_t value = 0; + std::memcpy(&value, _buffer, sizeof(value)); + return get_endianness() == endianess_e::be ? value : swap_endianness(value); + } + + inline static uint32_t read_uint32_le(const uint8_t* _buffer) { + uint32_t value = 0; + std::memcpy(&value, _buffer, sizeof(value)); + return get_endianness() == endianess_e::le ? value : swap_endianness(value); + } + + inline static uint64_t read_uint64_be(const uint8_t* _buffer) { + uint64_t value = 0; + std::memcpy(&value, _buffer, sizeof(value)); + return get_endianness() == endianess_e::be ? value : swap_endianness(value); + } + + inline static uint64_t read_uint64_le(const uint8_t* _buffer) { + uint64_t value = 0; + std::memcpy(&value, _buffer, sizeof(value)); + return get_endianness() == endianess_e::le ? value : swap_endianness(value); + } + + inline static uint16_t read_high_word(uint32_t input) { + return uint16_t((input >> 16) & 0xFFFF); + } + + inline static uint16_t read_low_word(uint32_t input) { + return uint16_t((input) & 0xFFFF); + } + + template + static T swap_endianness(T _value) { + static_assert(std::is_integral::value, "Only integral types can be swapped"); + T swapped{}; + const auto src = reinterpret_cast(&_value); + auto dst = reinterpret_cast(&swapped); + std::reverse_copy(src, src + sizeof(T), dst); + return swapped; + } + +#if defined(COMPILE_TIME_ENDIAN) && (COMPILE_TIME_ENDIAN == BYTEORDER_LITTLE_ENDIAN) + static constexpr endianess_e get_endianness() { return endianess_e::le; } +#elif defined(COMPILE_TIME_ENDIAN) && (COMPILE_TIME_ENDIAN == BYTEORDER_BIG_ENDIAN) + static constexpr Endianness get_endianness() { return endianess_e::be; } +#else + // Run-time check + static endianess_e get_endianness() { + uint16_t test{0x0102}; + return (*reinterpret_cast(&test) == 1) ? endianess_e::be : endianess_e::le; + } +#endif +}; + +} + +#endif // VSOMEIP_V3_BITHELPER_HPP diff --git a/implementation/utility/include/byteorder.hpp b/implementation/utility/include/byteorder.hpp index f5ad3f024..929033fd6 100644 --- a/implementation/utility/include/byteorder.hpp +++ b/implementation/utility/include/byteorder.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // 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/. @@ -6,73 +6,44 @@ #ifndef VSOMEIP_V3_BYTEORDER_HPP #define VSOMEIP_V3_BYTEORDER_HPP -#if defined(__linux__) -#include -#elif defined(__freebsd__) -#include -#else -// TEST IF THERE COULD BE AN ERROR! -//#error "Undefined OS (only Linux/FreeBSD are currently supported)" -#endif - -#if __BYTE_ORDER == __LITTLE_ENDIAN - -#define VSOMEIP_BYTES_TO_WORD(x0, x1) (uint16_t((x0) << 8 | (x1))) -#define VSOMEIP_BYTES_TO_LONG(x0, x1, x2, x3) (uint32_t((x0) << 24 | (x1) << 16 | (x2) << 8 | (x3))) -#define VSOMEIP_BYTES_TO_LONG_LONG(x0, x1, x2, x3, x4, x5, x6, x7) (uint64_t (x0) << 56 | uint64_t (x1) << 48 | uint64_t (x2) << 40 | uint64_t (x3) << 32 | uint64_t (x4) << 24 | uint64_t (x5) << 16 | uint64_t (x6) << 8 | uint64_t (x7)) - -#define VSOMEIP_WORDS_TO_LONG(x0, x1) (uint32_t((x0) << 16 | (x1))) - -#define VSOMEIP_WORD_BYTE0(x) (uint8_t((x) & 0xFF)) -#define VSOMEIP_WORD_BYTE1(x) (uint8_t((x) >> 8)) - -#define VSOMEIP_LONG_BYTE0(x) (uint8_t((x) & 0xFF)) -#define VSOMEIP_LONG_BYTE1(x) (uint8_t(((x) >> 8) & 0xFF)) -#define VSOMEIP_LONG_BYTE2(x) (uint8_t(((x) >> 16) & 0xFF)) -#define VSOMEIP_LONG_BYTE3(x) (uint8_t(((x) >> 24) & 0xFF)) - -#define VSOMEIP_LONG_LONG_BYTE0(x) (uint8_t((x) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE1(x) (uint8_t(((x) >> 8) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE2(x) (uint8_t(((x) >> 16) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE3(x) (uint8_t(((x) >> 24) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE4(x) (uint8_t(((x) >> 32) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE5(x) (uint8_t(((x) >> 40) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE6(x) (uint8_t(((x) >> 48) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE7(x) (uint8_t(((x) >> 56) & 0xFF)) - -#define VSOMEIP_LONG_WORD0(x) (uint16_t((x) & 0xFFFF)) -#define VSOMEIP_LONG_WORD1(x) (uint16_t(((x) >> 16) & 0xFFFF)) - -#elif __BYTE_ORDER == __BIG_ENDIAN - -#define VSOMEIP_BYTES_TO_WORD(x0, x1) (uint16_t((x1) << 8 | (x0))) -#define VSOMEIP_BYTES_TO_LONG(x0, x1, x2, x3) (uint32_t((x3) << 24 | (x2) << 16 | (x1) << 8 | (x0))) -#define VSOMEIP_BYTES_TO_LONG_LONG(x0, x1, x2, x3, x4, x5, x6, x7) (uint64_t((x7) << 56 | (x6) << 48 | (x5) << 40 | (x4) << 32 | (x3) << 24 | (x2) << 16 | (x1) << 8 | (x0))) - -#define VSOMEIP_WORD_BYTE0(x) (uint8_t((x) >> 8)) -#define VSOMEIP_WORD_BYTE1(x) (uint8_t((x) & 0xFF)) - -#define VSOMEIP_LONG_BYTE0(x) (uint8_t(((x) >> 24) & 0xFF)) -#define VSOMEIP_LONG_BYTE1(x) (uint8_t(((x) >> 16) & 0xFF)) -#define VSOMEIP_LONG_BYTE2(x) (uint8_t(((x) >> 8) & 0xFF)) -#define VSOMEIP_LONG_BYTE3(x) (uint8_t((x) & 0xFF)) - -#define VSOMEIP_LONG_LONG_BYTE0(x) (uint8_t(((x) >> 56) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE1(x) (uint8_t(((x) >> 48) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE2(x) (uint8_t(((x) >> 40) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE3(x) (uint8_t(((x) >> 32) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE4(x) (uint8_t(((x) >> 24) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE5(x) (uint8_t(((x) >> 16) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE6(x) (uint8_t(((x) >> 8) & 0xFF)) -#define VSOMEIP_LONG_LONG_BYTE7(x) (uint8_t((x) & 0xFF)) - -#define VSOMEIP_LONG_WORD0(x) (uint16_t((((x) >> 16) & 0xFFFF)) -#define VSOMEIP_LONG_WORD1(x) (uint16_t(((x) & 0xFFFF)) - -#else - -#error "__BYTE_ORDER is not defined!" - -#endif - -#endif // VSOMEIP_V3_BYTEORDER_HPP_ +#define BYTEORDER_UNKNOWN 0 +#define BYTEORDER_LITTLE_ENDIAN 1 +#define BYTEORDER_BIG_ENDIAN 2 + +// Detect with GCC 4.6's macro +# ifdef __BYTE_ORDER__ +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define COMPILE_TIME_ENDIAN BYTEORDER_LITTLE_ENDIAN +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define COMPILE_TIME_ENDIAN BYTEORDER_BIG_ENDIAN +# else +# define COMPILE_TIME_ENDIAN BYTEORDER_UNKNOWN +# endif // __BYTE_ORDER__ +// Detect with GLIBC's endian.h +# elif defined(__GLIBC__) +# include +# if (__BYTE_ORDER == __LITTLE_ENDIAN) +# define COMPILE_TIME_ENDIAN BYTEORDER_LITTLE_ENDIAN +# elif (__BYTE_ORDER == __BIG_ENDIAN) +# define COMPILE_TIME_ENDIAN BYTEORDER_BIG_ENDIAN +# else +# define COMPILE_TIME_ENDIAN BYTEORDER_UNKNOWN +# endif // __GLIBC__ +// Detect with _LITTLE_ENDIAN and _BIG_ENDIAN macro +# elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) +# define COMPILE_TIME_ENDIAN BYTEORDER_LITTLE_ENDIAN +# elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) +# define COMPILE_TIME_ENDIAN BYTEORDER_BIG_ENDIAN +// Detect with architecture macros +# elif defined(__sparc) || defined(__sparc__) || defined(_POWER) || defined(__powerpc__) || defined(__ppc__) || defined(__hpux) || defined(__hppa) || defined(_MIPSEB) || defined(_POWER) || defined(__s390__) +# define COMPILE_TIME_ENDIAN BYTEORDER_BIG_ENDIAN +# elif defined(__i386__) || defined(__alpha__) || defined(__ia64) || defined(__ia64__) || defined(_M_IX86) || defined(_M_IA64) || defined(_M_ALPHA) || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || defined(__bfin__) +# define COMPILE_TIME_ENDIAN BYTEORDER_LITTLE_ENDIAN +# elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) +# define COMPILE_TIME_ENDIAN BYTEORDER_LITTLE_ENDIAN +# else +# define COMPILE_TIME_ENDIAN BYTEORDER_UNKNOWN +# endif + + +#endif // VSOMEIP_V3_BYTEORDER_HPP diff --git a/implementation/utility/src/utility.cpp b/implementation/utility/src/utility.cpp index e7065f0c8..50fe3404a 100644 --- a/implementation/utility/src/utility.cpp +++ b/implementation/utility/src/utility.cpp @@ -25,7 +25,7 @@ #include #include -#include "../include/byteorder.hpp" +#include "../include/bithelper.hpp" #include "../include/utility.hpp" #include "../../configuration/include/configuration.hpp" @@ -47,7 +47,7 @@ uint64_t utility::get_message_size(const byte_t *_data, size_t _size) { uint64_t its_size(0); if (VSOMEIP_SOMEIP_HEADER_SIZE <= _size) { its_size = VSOMEIP_SOMEIP_HEADER_SIZE - + VSOMEIP_BYTES_TO_LONG(_data[4], _data[5], _data[6], _data[7]); + + bithelper::read_uint32_be(&_data[4]); } return its_size; } @@ -55,7 +55,7 @@ uint64_t utility::get_message_size(const byte_t *_data, size_t _size) { uint32_t utility::get_payload_size(const byte_t *_data, uint32_t _size) { uint32_t its_size(0); if (VSOMEIP_SOMEIP_HEADER_SIZE <= _size) { - its_size = VSOMEIP_BYTES_TO_LONG(_data[4], _data[5], _data[6], _data[7]) + its_size = bithelper::read_uint32_be(&_data[4]) - VSOMEIP_SOMEIP_HEADER_SIZE; } return its_size; diff --git a/interface/vsomeip/application.hpp b/interface/vsomeip/application.hpp index 4451d4568..6f2cc98ba 100644 --- a/interface/vsomeip/application.hpp +++ b/interface/vsomeip/application.hpp @@ -27,6 +27,7 @@ class configuration_public; class event; class payload; struct policy; +class policy_manager; /** * \defgroup vsomeip @@ -1139,6 +1140,20 @@ class application { instance_t _instance, method_t _method, const message_handler_t &_handler, handler_registration_type_e _type) = 0; + + /** + * \brief Get the configuration + * + * \return configuration shared pointer + */ + virtual std::shared_ptr get_configuration() const = 0; + + /** + * \brief Get the policy_manager + * + * \return policy_manager shared pointer + */ + virtual std::shared_ptr get_policy_manager() const = 0; }; /** @} */ diff --git a/interface/vsomeip/enumeration_types.hpp b/interface/vsomeip/enumeration_types.hpp index 09734b83b..b56690de3 100644 --- a/interface/vsomeip/enumeration_types.hpp +++ b/interface/vsomeip/enumeration_types.hpp @@ -102,6 +102,11 @@ enum class handler_registration_type_e : uint8_t { HRT_UNKNOWN = 0xFF }; +enum class endianess_e { + be, // big-endian + le // little-endian +}; + } // namespace vsomeip_v3 #endif // VSOMEIP_V3_ENUMERATION_TYPES_HPP_ diff --git a/implementation/plugin/include/plugin_manager.hpp b/interface/vsomeip/internal/plugin_manager.hpp similarity index 93% rename from implementation/plugin/include/plugin_manager.hpp rename to interface/vsomeip/internal/plugin_manager.hpp index d398e2457..a8b05b227 100644 --- a/implementation/plugin/include/plugin_manager.hpp +++ b/interface/vsomeip/internal/plugin_manager.hpp @@ -23,6 +23,7 @@ class plugin_manager { VSOMEIP_EXPORT virtual void * load_library(const std::string &_path) = 0; VSOMEIP_EXPORT virtual void * load_symbol(void * _handle, const std::string &_symbol) = 0; VSOMEIP_EXPORT virtual void unload_library(void * _handle) = 0; + VSOMEIP_EXPORT virtual bool unload_plugin(plugin_type_e _type) = 0; }; } // namespace vsomeip_v3 diff --git a/interface/vsomeip/internal/policy_manager.hpp b/interface/vsomeip/internal/policy_manager.hpp index 0d610d9ef..42bfccb2a 100644 --- a/interface/vsomeip/internal/policy_manager.hpp +++ b/interface/vsomeip/internal/policy_manager.hpp @@ -19,10 +19,7 @@ struct policy; class VSOMEIP_IMPORT_EXPORT policy_manager { public: - static std::shared_ptr get(); - - virtual ~policy_manager() {}; - + virtual ~policy_manager() {} virtual std::shared_ptr create_policy() const = 0; virtual void print_policy(const std::shared_ptr &_policy) const = 0; diff --git a/libvsomeip.yaml b/libvsomeip.yaml index 0ad6b7426..ba88909ac 100644 --- a/libvsomeip.yaml +++ b/libvsomeip.yaml @@ -1,5 +1,5 @@ - name: libvsomeip - version: 3.4.10 + version: 3.5.0 vendor: Lynx Team license: concluded: CLOSED and MPLv2 diff --git a/test/network_tests/CMakeLists.txt b/test/network_tests/CMakeLists.txt index 883cc5cf8..18f0c93d5 100644 --- a/test/network_tests/CMakeLists.txt +++ b/test/network_tests/CMakeLists.txt @@ -15,6 +15,7 @@ include_directories( set(TEST_LINK_LIBRARIES gtest) set(NETWORK_TEST_BIN_DIR ${PROJECT_BINARY_DIR}/test/network_tests) set(NETWORK_TEST_SRC_DIR ${PROJECT_SOURCE_DIR}/test/network_tests) +set(HOSTNAME "$ENV{HOSTNAME}") # Function to copy files into the build directory (or anywhere else) # On unixoid systems this function will create symlinks instead @@ -67,6 +68,7 @@ function(copy_to_builddir SOURCE_PATH DESTINATION_PATH TARGET_TO_DEPEND) endif() endfunction() +add_subdirectory(lazy_load_tests) ############################################################################## # configuration-test ############################################################################## @@ -75,7 +77,6 @@ if(NOT ${TESTS_BAT}) add_executable(${TEST_CONFIGURATION} configuration_tests/configuration-test.cpp - ${PROJECT_SOURCE_DIR}/implementation/plugin/src/plugin_manager_impl.cpp ) target_link_libraries(${TEST_CONFIGURATION} ${VSOMEIP_NAME} @@ -163,55 +164,32 @@ endif() set(TEST_APPLICATION_CONFIGURATION_FILE ${TEST_APPLICATION}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE}.in - ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE} - @ONLY) -copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_CONFIGURATION_FILE} - ${TEST_APPLICATION} -) + @ONLY) set(TEST_APPLICATION_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_daemon.json) configure_file( ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}.in - ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} - @ONLY) -copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON} - ${TEST_APPLICATION} -) + @ONLY) set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE ${TEST_APPLICATION}_no_dispatch_threads.json) configure_file( ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}.in - ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} - @ONLY) -copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE} - ${TEST_APPLICATION} -) + @ONLY) set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_no_dispatch_threads_daemon.json) configure_file( ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}.in - ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} - @ONLY) -copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON} - ${TEST_APPLICATION} -) + @ONLY) set(TEST_APPLICATION_STARTER ${TEST_APPLICATION}_starter.sh) - if(${TESTS_BAT}) - configure_file( - ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_STARTER}.bat.in - ${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_STARTER} - @ONLY) - endif() - -copy_to_builddir(${NETWORK_TEST_SRC_DIR}/application_tests/${TEST_APPLICATION_STARTER} -${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_STARTER} -${TEST_APPLICATION} -) +configure_file( + ${NETWORK_TEST_SRC_DIR}/application_tests/conf/${TEST_APPLICATION_STARTER}.bat.in + ${NETWORK_TEST_BIN_DIR}/${TEST_APPLICATION_STARTER} + @ONLY) ############################################################################## # magic-cookies-test-client @@ -247,12 +225,8 @@ if(NOT ${TESTS_BAT}) set(TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE ${TEST_MAGIC_COOKIES_CLIENT}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/magic_cookies_tests/conf/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE} - ${TEST_MAGIC_COOKIES_CLIENT} - ) + @ONLY) # Copy bashscript to start client into $BUILDDIR/test set(TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT ${TEST_MAGIC_COOKIES_CLIENT}_start.sh) @@ -266,12 +240,8 @@ if(NOT ${TESTS_BAT}) set(TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE ${TEST_MAGIC_COOKIES_SERVICE}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/magic_cookies_tests/conf/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE} - ${TEST_MAGIC_COOKIES_SERVICE} - ) + @ONLY) # Copy bashscript to start service into $BUILDDIR/test set(TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT ${TEST_MAGIC_COOKIES_SERVICE}_start.sh) @@ -362,17 +332,10 @@ copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACT # Copy bashscript to start client and server $BUILDDIR/test set(TEST_HEADER_FACTORY_STARTER header_factory_test_send_receive_starter.sh) -if(${TESTS_BAT}) - configure_file( - ${NETWORK_TEST_SRC_DIR}/header_factory_tests/conf/${TEST_HEADER_FACTORY_STARTER}.bat.in - ${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_STARTER} - @ONLY) -endif() - -copy_to_builddir(${NETWORK_TEST_SRC_DIR}/header_factory_tests/${TEST_HEADER_FACTORY_STARTER} +configure_file( + ${NETWORK_TEST_SRC_DIR}/header_factory_tests/conf/${TEST_HEADER_FACTORY_STARTER}.bat.in ${NETWORK_TEST_BIN_DIR}/${TEST_HEADER_FACTORY_STARTER} - ${TEST_HEADER_FACTORY_CLIENT} -) + @ONLY) ############################################################################## # routing-test @@ -439,12 +402,8 @@ if(NOT ${TESTS_BAT}) endif() configure_file( ${NETWORK_TEST_SRC_DIR}/routing_tests/conf/${TEST_LOCAL_ROUTING_STARTER}.in - ${NETWORK_TEST_SRC_DIR}/routing_tests/${TEST_LOCAL_ROUTING_STARTER} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/routing_tests/${TEST_LOCAL_ROUTING_STARTER} ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_ROUTING_STARTER} - ${TEST_LOCAL_ROUTING_CLIENT} - ) + @ONLY) ############################################################################## set(TEST_EXTERNAL_LOCAL_ROUTING_NAME external_local_routing_test) @@ -463,13 +422,8 @@ if(NOT ${TESTS_BAT}) set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/routing_tests/conf/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE} - ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} - ) + @ONLY) # Copy bashscript to start service into $BUILDDIR/test set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}_start.sh) @@ -492,12 +446,8 @@ if(NOT ${TESTS_BAT}) set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/routing_tests/conf/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE} - ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} - ) + @ONLY) # Copy bashscript to start client and server $BUILDDIR/test set(TEST_EXTERNAL_LOCAL_ROUTING_STARTER external_local_routing_test_starter.sh) @@ -562,12 +512,9 @@ else() set(TEST_LOCAL_ROUTING_STARTER local_routing_test_starter.sh) configure_file( ${NETWORK_TEST_SRC_DIR}/routing_tests/conf/${TEST_LOCAL_ROUTING_STARTER}.bat.in - ${NETWORK_TEST_SRC_DIR}/routing_tests/${TEST_LOCAL_ROUTING_STARTER} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/routing_tests/${TEST_LOCAL_ROUTING_STARTER} ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_ROUTING_STARTER} - ${TEST_LOCAL_ROUTING_CLIENT} - ) + @ONLY) + endif() ############################################################################## # restart_routing-test @@ -672,61 +619,36 @@ if (${TEST_SECURITY}) set(TEST_SECURITY_LOCAL_CONFIG_FILE ${TEST_SECURITY_NAME}_local_config.json) configure_file( ${NETWORK_TEST_SRC_DIR}/security_tests/conf/${TEST_SECURITY_LOCAL_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/security_tests/${TEST_SECURITY_LOCAL_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/security_tests/${TEST_SECURITY_LOCAL_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SECURITY_LOCAL_CONFIG_FILE} - ${TEST_SECURITY_SERVICE} - ) + @ONLY) # Copy service config file for external allow tests into $BUILDDIR/test set(TEST_SECURITY_SERVICE_CONFIG_FILE_EXTERNAL ${TEST_SECURITY_NAME}_config_service_external_allow.json) configure_file( ${NETWORK_TEST_SRC_DIR}/security_tests/conf/${TEST_SECURITY_SERVICE_CONFIG_FILE_EXTERNAL}.in - ${NETWORK_TEST_SRC_DIR}/security_tests/${TEST_SECURITY_SERVICE_CONFIG_FILE_EXTERNAL} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/security_tests/${TEST_SECURITY_SERVICE_CONFIG_FILE_EXTERNAL} ${NETWORK_TEST_BIN_DIR}/${TEST_SECURITY_SERVICE_CONFIG_FILE_EXTERNAL} - ${TEST_SECURITY_SERVICE} - ) + @ONLY) # Copy client config file for external allow tests into $BUILDDIR/test set(TEST_SECURITY_CLIENT_CONFIG_FILE_EXTERNAL ${TEST_SECURITY_NAME}_config_client_external_allow.json) configure_file( ${NETWORK_TEST_SRC_DIR}/security_tests/conf/${TEST_SECURITY_CLIENT_CONFIG_FILE_EXTERNAL}.in - ${NETWORK_TEST_SRC_DIR}/security_tests/${TEST_SECURITY_CLIENT_CONFIG_FILE_EXTERNAL} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/security_tests/${TEST_SECURITY_CLIENT_CONFIG_FILE_EXTERNAL} ${NETWORK_TEST_BIN_DIR}/${TEST_SECURITY_CLIENT_CONFIG_FILE_EXTERNAL} - ${TEST_SECURITY_SERVICE} - ) + @ONLY) # Copy service config file for external deny tests into $BUILDDIR/test set(TEST_SECURITY_SERVICE_CONFIG_FILE_EXTERNAL_DENY ${TEST_SECURITY_NAME}_config_service_external_deny.json) configure_file( ${NETWORK_TEST_SRC_DIR}/security_tests/conf/${TEST_SECURITY_SERVICE_CONFIG_FILE_EXTERNAL_DENY}.in - ${NETWORK_TEST_SRC_DIR}/security_tests/${TEST_SECURITY_SERVICE_CONFIG_FILE_EXTERNAL_DENY} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/security_tests/${TEST_SECURITY_SERVICE_CONFIG_FILE_EXTERNAL_DENY} ${NETWORK_TEST_BIN_DIR}/${TEST_SECURITY_SERVICE_CONFIG_FILE_EXTERNAL_DENY} - ${TEST_SECURITY_SERVICE} - ) + @ONLY) # Copy client config file for external deny tests into $BUILDDIR/test set(TEST_SECURITY_CLIENT_CONFIG_FILE_EXTERNAL_DENY ${TEST_SECURITY_NAME}_config_client_external_deny.json) configure_file( ${NETWORK_TEST_SRC_DIR}/security_tests/conf/${TEST_SECURITY_CLIENT_CONFIG_FILE_EXTERNAL_DENY}.in - ${NETWORK_TEST_SRC_DIR}/security_tests/${TEST_SECURITY_CLIENT_CONFIG_FILE_EXTERNAL_DENY} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/security_tests/${TEST_SECURITY_CLIENT_CONFIG_FILE_EXTERNAL_DENY} ${NETWORK_TEST_BIN_DIR}/${TEST_SECURITY_CLIENT_CONFIG_FILE_EXTERNAL_DENY} - ${TEST_SECURITY_SERVICE} - ) + @ONLY) # Copy bashscript to start local test into $BUILDDIR/test set(TEST_SECURITY_SERVICE_LOCAL_START_SCRIPT ${TEST_SECURITY_NAME}_local_start.sh) @@ -832,17 +754,10 @@ copy_to_builddir( # Copy bashscript to start client and server $BUILDDIR/test set(TEST_LOCAL_PAYLOAD_STARTER local_payload_test_starter.sh) -if(${TESTS_BAT}) - configure_file( - ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_LOCAL_PAYLOAD_STARTER}.bat.in - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_STARTER} - @ONLY) -endif() - -copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_STARTER} +configure_file( + ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_LOCAL_PAYLOAD_STARTER}.bat.in ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_STARTER} - ${TEST_PAYLOAD_CLIENT} -) + @ONLY) ############################################################################## set(TEST_EXTERNAL_LOCAL_PAYLOAD_NAME external_local_payload_test) @@ -852,13 +767,8 @@ set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE external_local_payload_test_service) set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE} - ${TEST_PAYLOAD_SERVICE} -) + @ONLY) # Copy bashscript to start service into $BUILDDIR/test set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}_start.sh) @@ -874,13 +784,8 @@ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL external_local_payload_test_client_ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE} - ${TEST_PAYLOAD_CLIENT} -) + @ONLY) # Copy bashscript to start client into $BUILDDIR/test set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}_start.sh) @@ -894,17 +799,11 @@ copy_to_builddir( set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME external_local_payload_test_client_local) set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME}_starter.sh) -if(${TESTS_BAT}) - configure_file( - ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}.bat.in - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} - @ONLY) -endif() - -copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} +configure_file( + ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}.bat.in ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER} - ${TEST_PAYLOAD_CLIENT} -) + @ONLY) + ############################################################################## set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME external_local_payload_test_client_external) set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL external_local_payload_test_client_external) @@ -913,13 +812,8 @@ set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL external_local_payload_test_clie set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE} - ${TEST_PAYLOAD_CLIENT} -) + @ONLY) # Copy bashscript to start client into $BUILDDIR/test set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}_start.sh) @@ -960,17 +854,10 @@ set(TEST_LOCAL_PAYLOAD_HUGE_NAME local_payload_test_huge_payload) # Copy bashscript to start client and server $BUILDDIR/test set(TEST_LOCAL_PAYLOAD_HUGE_STARTER ${TEST_LOCAL_PAYLOAD_HUGE_NAME}_starter.sh) -if(${TESTS_BAT}) - configure_file( - ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_LOCAL_PAYLOAD_HUGE_STARTER}.bat.in - ${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} - @ONLY) -endif() - -copy_to_builddir(${NETWORK_TEST_SRC_DIR}/payload_tests/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} +configure_file( + ${NETWORK_TEST_SRC_DIR}/payload_tests/conf/${TEST_LOCAL_PAYLOAD_HUGE_STARTER}.bat.in ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_PAYLOAD_HUGE_STARTER} - ${TEST_PAYLOAD_CLIENT} -) + @ONLY) ############################################################################## # big_payload_test @@ -1036,234 +923,136 @@ copy_to_builddir( set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_CLIENT} -) + @ONLY) set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client_limited.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_CLIENT} -) + @ONLY) set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service_limited.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client_queue_limited.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED} ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED} - ${TEST_BIG_PAYLOAD_CLIENT} -) + @ONLY) set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service_queue_limited.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED} ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_local_tcp_client_random.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_CLIENT} -) + @ONLY) set(TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_local_tcp_service_random.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_TCP_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_tcp_client.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_CLIENT} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_tcp_service.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_tcp_client_limited_general.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_CLIENT} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_tcp_service_limited_general.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_tcp_client_random.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_CLIENT} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_tcp_service_random.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL ${TEST_BIG_PAYLOAD_NAME}_tcp_client_queue_limited_general.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - ${TEST_BIG_PAYLOAD_CLIENT} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL ${TEST_BIG_PAYLOAD_NAME}_tcp_service_queue_limited_general.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC ${TEST_BIG_PAYLOAD_NAME}_tcp_client_queue_limited_specific.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - ${TEST_BIG_PAYLOAD_CLIENT} -) + @ONLY) # Copy config file for client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC ${TEST_BIG_PAYLOAD_NAME}_tcp_service_queue_limited_specific.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) + # Copy config file for UDP client and service into $BUILDDIR/test set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_udp_service.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_UDP_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) + set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_udp_client.json) configure_file( ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE} - @ONLY) -copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_UDP_CONFIG_FILE} - ${TEST_BIG_PAYLOAD_CLIENT} -) + @ONLY) # Copy bashscript to start client local to $BUILDDIR/test set(TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_client_local_start.sh) @@ -1286,17 +1075,10 @@ set(TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED big_payload_test_local_limited) set(TEST_LOCAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED big_payload_test_local_queue_limited) set(TEST_LOCAL_BIG_PAYLOAD_STARTER ${TEST_LOCAL_BIG_PAYLOAD_NAME}_starter.sh) -if(${TESTS_BAT}) - configure_file( - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_BIG_PAYLOAD_STARTER}.bat.in - ${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_STARTER} - @ONLY) -endif() - -copy_to_builddir(${NETWORK_TEST_SRC_DIR}/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_STARTER} +configure_file( + ${NETWORK_TEST_SRC_DIR}/big_payload_tests/conf/${TEST_LOCAL_BIG_PAYLOAD_STARTER}.bat.in ${NETWORK_TEST_BIN_DIR}/${TEST_LOCAL_BIG_PAYLOAD_STARTER} - ${TEST_BIG_PAYLOAD_SERVICE} -) + @ONLY) # Copy bashscript to start client and server $BUILDDIR/test set(TEST_LOCAL_TCP_BIG_PAYLOAD_NAME big_payload_test_local_tcp) @@ -1377,121 +1159,71 @@ if(NOT ${TESTS_BAT}) ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) + @ONLY) set(TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) + @ONLY) set(TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) + @ONLY) set(TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) + @ONLY) set(TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) + @ONLY) set(TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) + @ONLY) set(TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_same_client_ids_same_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) + @ONLY) set(TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_same_client_ids_same_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) + @ONLY) set(TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_same_client_ids_diff_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) + @ONLY) set(TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_same_client_ids_diff_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_CLIENT_ID_SERVICE} - ) + @ONLY) set(TEST_CLIENT_ID_UTILITY_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_utility.json) copy_to_builddir( @@ -1586,23 +1318,14 @@ if(NOT ${TESTS_BAT}) set(TEST_DEBOUNCE_MASTER_CONFIG_FILE ${TEST_DEBOUNCE_SERVICE}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/debounce_tests/conf/${TEST_DEBOUNCE_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/debounce_tests/${TEST_DEBOUNCE_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/debounce_tests/${TEST_DEBOUNCE_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_MASTER_CONFIG_FILE} - ${TEST_DEBOUNCE_SERVICE} - ) + @ONLY) + set(TEST_DEBOUNCE_SLAVE_CONFIG_FILE ${TEST_DEBOUNCE_CLIENT}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/debounce_tests/conf/${TEST_DEBOUNCE_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/debounce_tests/${TEST_DEBOUNCE_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/debounce_tests/${TEST_DEBOUNCE_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_SLAVE_CONFIG_FILE} - ${TEST_DEBOUNCE_SERVICE} - ) + @ONLY) endif() ############################################################################## @@ -1643,23 +1366,15 @@ if(NOT ${TESTS_BAT}) set(TEST_DEBOUNCE_FILTER_MASTER_CONFIG_FILE ${TEST_DEBOUNCE_FILTER_SERVICE}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/debounce_filter_tests/conf/${TEST_DEBOUNCE_FILTER_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/debounce_filter_tests/${TEST_DEBOUNCE_FILTER_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/debounce_filter_tests/${TEST_DEBOUNCE_FILTER_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_FILTER_MASTER_CONFIG_FILE} - ${TEST_DEBOUNCE_FILTER_SERVICE} - ) + @ONLY) + set(TEST_DEBOUNCE_FILTER_SLAVE_CONFIG_FILE ${TEST_DEBOUNCE_FILTER_CLIENT}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/debounce_filter_tests/conf/${TEST_DEBOUNCE_FILTER_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/debounce_filter_tests/${TEST_DEBOUNCE_FILTER_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/debounce_filter_tests/${TEST_DEBOUNCE_FILTER_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_FILTER_SLAVE_CONFIG_FILE} - ${TEST_DEBOUNCE_FILTER_SERVICE} - ) + @ONLY) + endif() ############################################################################## @@ -1702,23 +1417,15 @@ if(NOT ${TESTS_BAT}) set(TEST_DEBOUNCE_FREQUENCY_MASTER_CONFIG_FILE ${TEST_DEBOUNCE_FREQUENCY_CLIENT}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/debounce_frequency_tests/conf/${TEST_DEBOUNCE_FREQUENCY_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/debounce_frequency_tests/${TEST_DEBOUNCE_FREQUENCY_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/debounce_frequency_tests/${TEST_DEBOUNCE_FREQUENCY_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_FREQUENCY_MASTER_CONFIG_FILE} - ${TEST_DEBOUNCE_FREQUENCY_CLIENT} - ) + @ONLY) + set(TEST_DEBOUNCE_FREQUENCY_SLAVE_CONFIG_FILE ${TEST_DEBOUNCE_FREQUENCY_SERVICE}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/debounce_frequency_tests/conf/${TEST_DEBOUNCE_FREQUENCY_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/debounce_frequency_tests/${TEST_DEBOUNCE_FREQUENCY_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/debounce_frequency_tests/${TEST_DEBOUNCE_FREQUENCY_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_FREQUENCY_SLAVE_CONFIG_FILE} - ${TEST_DEBOUNCE_FREQUENCY_SERVICE} - ) + @ONLY) + endif() ############################################################################## @@ -1759,23 +1466,15 @@ if(NOT ${TESTS_BAT}) set(TEST_DEBOUNCE_CALLBACK_MASTER_CONFIG_FILE ${TEST_DEBOUNCE_CALLBACK_SERVICE}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/conf/${TEST_DEBOUNCE_CALLBACK_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_CALLBACK_MASTER_CONFIG_FILE} - ${TEST_DEBOUNCE_CALLBACK_SERVICE} - ) + @ONLY) + set(TEST_DEBOUNCE_CALLBACK_SLAVE_CONFIG_FILE ${TEST_DEBOUNCE_CALLBACK_CLIENT}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/conf/${TEST_DEBOUNCE_CALLBACK_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/debounce_callback_tests/${TEST_DEBOUNCE_CALLBACK_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_DEBOUNCE_CALLBACK_SLAVE_CONFIG_FILE} - ${TEST_DEBOUNCE_CALLBACK_CLIENT} - ) + @ONLY) + endif() ############################################################################## @@ -1799,265 +1498,155 @@ if(NOT ${TESTS_BAT}) ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_master_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_slave_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_master_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_slave_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_master_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_slave_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_master_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_slave_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_same_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_same_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_diff_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_diff_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_master_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_slave_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_autoconfig_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_autoconfig_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) # copy starter scripts into builddir if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") @@ -2107,36 +1696,22 @@ if(NOT ${TESTS_BAT}) ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_udp_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT} - ) + @ONLY) + set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_tcp_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_master_starter.sh) @@ -2156,265 +1731,155 @@ if(NOT ${TESTS_BAT}) ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_master_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_slave_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_master_tcp_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_slave_tcp_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_master_udp_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_UDP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_slave_udp_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_master_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_slave_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_master_tcp_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_slave_tcp_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_master_udp_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_UDP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_slave_udp_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_master_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_slave_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_same_ports_master_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_same_ports_slave_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_diff_ports_master_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_diff_ports_slave_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_master_udp_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_UDP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_slave_udp_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_autoconfig_master_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_autoconfig_slave_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_SERVICE} - ) + @ONLY) # copy starter scripts into builddir set(TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER ${TEST_SUBSCRIBE_NOTIFY_NAME}_master_starter.sh) @@ -2432,36 +1897,22 @@ if(NOT ${TESTS_BAT}) ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_master_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_udp_slave_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT} - ) + @ONLY) + set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_tcp_slave_local_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_LOCAL_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_master_starter.sh) @@ -2499,73 +1950,43 @@ if(NOT ${TESTS_BAT}) ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_master_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_slave_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_master_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) + @ONLY) set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_slave_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} - ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} - ) + @ONLY) # copy starter scripts into builddir if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") @@ -2609,23 +2030,14 @@ if(NOT ${TESTS_BAT}) set(TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_service_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/conf/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE} - ${TEST_CPU_LOAD_SERVICE} - ) + @ONLY) + set(TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_service_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/conf/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE} - ${TEST_CPU_LOAD_SERVICE} - ) + @ONLY) ############################################################################## set(TEST_CPU_LOAD_CLIENT cpu_load_test_client) @@ -2645,23 +2057,14 @@ if(NOT ${TESTS_BAT}) set(TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_client_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/conf/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE} - ${TEST_CPU_LOAD_CLIENT} - ) + @ONLY) + set(TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_client_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/conf/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE} - ${TEST_CPU_LOAD_CLIENT} - ) + @ONLY) ############################################################################## # copy starter scripts into builddir @@ -2731,243 +2134,144 @@ if(NOT ${TESTS_BAT}) ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) # Copy config files for test into $BUILDDIR/test set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_master_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) # Copy config files for test into $BUILDDIR/test set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_master_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_slave_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_slave_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_master_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_slave_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_master_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_UDP_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_slave_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_UDP_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_same_client_ids_same_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_same_client_ids_same_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_same_client_ids_diff_ports_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) + set(TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_same_client_ids_diff_ports_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE} - ${TEST_INITIAL_EVENT_SERVICE} - ) + @ONLY) # copy starter scripts into builddir if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") @@ -3106,47 +2410,27 @@ if(NOT ${TESTS_BAT}) set(TEST_OFFER_SLAVE_CONFIG_FILE ${TEST_OFFER_NAME}_external_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/offer_tests/conf/${TEST_OFFER_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_OFFER_SLAVE_CONFIG_FILE} - ${TEST_OFFER_SERVICE} - ) + @ONLY) set(TEST_OFFER_MASTER_CONFIG_FILE ${TEST_OFFER_NAME}_external_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/offer_tests/conf/${TEST_OFFER_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_OFFER_MASTER_CONFIG_FILE} - ${TEST_OFFER_SERVICE} - ) + @ONLY) # generate and copy json files into builddir for big SD message test set(TEST_OFFER_BIG_SLAVE_CONFIG_FILE ${TEST_OFFER_BIG_NAME}_slave.json) configure_file( ${NETWORK_TEST_SRC_DIR}/offer_tests/conf/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE} - ${TEST_OFFER_BIG_SERVICE} - ) + @ONLY) set(TEST_OFFER_BIG_MASTER_CONFIG_FILE ${TEST_OFFER_BIG_NAME}_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/offer_tests/conf/${TEST_OFFER_BIG_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_BIG_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_BIG_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_OFFER_BIG_MASTER_CONFIG_FILE} - ${TEST_OFFER_BIG_SERVICE} - ) + @ONLY) # Copy starter scripts for external test to $BUILDDIR/test if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") @@ -3156,12 +2440,9 @@ if(NOT ${TESTS_BAT}) endif() configure_file( ${NETWORK_TEST_SRC_DIR}/offer_tests/conf/${TEST_OFFER_EXTERNAL_MASTER_STARTER}.in - ${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_EXTERNAL_MASTER_STARTER} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_EXTERNAL_MASTER_STARTER} ${NETWORK_TEST_BIN_DIR}/${TEST_OFFER_EXTERNAL_MASTER_STARTER} - ${TEST_OFFER_SERVICE} - ) + @ONLY) + set(TEST_OFFER_EXTERNAL_SLAVE_STARTER ${TEST_OFFER_NAME}_external_slave_starter.sh) copy_to_builddir(${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_EXTERNAL_SLAVE_STARTER} ${NETWORK_TEST_BIN_DIR}/${TEST_OFFER_EXTERNAL_SLAVE_STARTER} @@ -3172,12 +2453,9 @@ if(NOT ${TESTS_BAT}) set(TEST_OFFER_BIG_MASTER_STARTER ${TEST_OFFER_BIG_NAME}_master_starter.sh) configure_file( ${NETWORK_TEST_SRC_DIR}/offer_tests/conf/${TEST_OFFER_BIG_MASTER_STARTER}.in - ${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_BIG_MASTER_STARTER} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_BIG_MASTER_STARTER} ${NETWORK_TEST_BIN_DIR}/${TEST_OFFER_BIG_MASTER_STARTER} - ${TEST_OFFER_BIG_SERVICE} - ) + @ONLY) + # Copy starter scripts for external test to $BUILDDIR/test set(TEST_OFFER_BIG_EXTERNAL_SLAVE_STARTER ${TEST_OFFER_BIG_NAME}_slave_starter.sh) copy_to_builddir(${NETWORK_TEST_SRC_DIR}/offer_tests/${TEST_OFFER_BIG_EXTERNAL_SLAVE_STARTER} @@ -3273,24 +2551,16 @@ if(NOT ${TESTS_BAT}) set(TEST_PENDING_SUBSCRIPTION_MASTER_STARTER ${TEST_PENDING_SUBSCRIPTION_NAME}_master_starter.sh) configure_file( ${NETWORK_TEST_SRC_DIR}/pending_subscription_tests/conf/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER}.in - ${NETWORK_TEST_SRC_DIR}/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} ${NETWORK_TEST_BIN_DIR}/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} - ${TEST_PENDING_SUBSCRIPTION_SERVICE} - ) + @ONLY) # Copy config file for local test into $BUILDDIR/test set(TEST_PENDING_SUBSCRIPTION_CONFIG_FILE ${TEST_PENDING_SUBSCRIPTION_NAME}_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/pending_subscription_tests/conf/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE} - ${TEST_PENDING_SUBSCRIPTION_SERVICE} - ) + @ONLY) + endif() ############################################################################## @@ -3337,24 +2607,16 @@ if(NOT ${TESTS_BAT}) set(TEST_MALICIOUS_DATA_MASTER_STARTER ${TEST_MALICIOUS_DATA_NAME}_master_starter.sh) configure_file( ${NETWORK_TEST_SRC_DIR}/malicious_data_tests/conf/${TEST_MALICIOUS_DATA_MASTER_STARTER}.in - ${NETWORK_TEST_SRC_DIR}/malicious_data_tests/${TEST_MALICIOUS_DATA_MASTER_STARTER} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/malicious_data_tests/${TEST_MALICIOUS_DATA_MASTER_STARTER} ${NETWORK_TEST_BIN_DIR}/${TEST_MALICIOUS_DATA_MASTER_STARTER} - ${TEST_MALICIOUS_DATA_SERVICE} - ) + @ONLY) # Copy config file for local test into $BUILDDIR/test set(TEST_MALICIOUS_DATA_CONFIG_FILE ${TEST_MALICIOUS_DATA_NAME}_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/malicious_data_tests/conf/${TEST_MALICIOUS_DATA_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/malicious_data_tests/${TEST_MALICIOUS_DATA_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/malicious_data_tests/${TEST_MALICIOUS_DATA_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_MALICIOUS_DATA_CONFIG_FILE} - ${TEST_MALICIOUS_DATA_SERVICE} - ) + @ONLY) + endif() ############################################################################## @@ -3392,25 +2654,15 @@ if(NOT ${TESTS_BAT}) set(TEST_E2E_SERVICE_CONFIG_FILE_EXTERNAL ${TEST_E2E_NAME}_service_external.json) configure_file( ${NETWORK_TEST_SRC_DIR}/e2e_tests/conf/${TEST_E2E_SERVICE_CONFIG_FILE_EXTERNAL}.in - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_SERVICE_CONFIG_FILE_EXTERNAL} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_SERVICE_CONFIG_FILE_EXTERNAL} ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_SERVICE_CONFIG_FILE_EXTERNAL} - ${TEST_E2E_SERVICE} - ) + @ONLY) # Copy client config file for external allow tests into $BUILDDIR/test set(TEST_E2E_CLIENT_CONFIG_FILE_EXTERNAL ${TEST_E2E_NAME}_client_external.json) configure_file( ${NETWORK_TEST_SRC_DIR}/e2e_tests/conf/${TEST_E2E_CLIENT_CONFIG_FILE_EXTERNAL}.in - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_CLIENT_CONFIG_FILE_EXTERNAL} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_CLIENT_CONFIG_FILE_EXTERNAL} ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_CLIENT_CONFIG_FILE_EXTERNAL} - ${TEST_E2E_SERVICE} - ) + @ONLY) # Copy bashscript to start external tests (master) into $BUILDDIR/test set(TEST_E2E_EXTERNAL_MASTER_START_SCRIPT ${TEST_E2E_NAME}_external_master_start.sh) @@ -3464,25 +2716,15 @@ if(NOT ${TESTS_BAT} AND ${TEST_E2E_PROFILE_04}) set(TEST_E2E_PROFILE_04_SERVICE_CONFIG_FILE_EXTERNAL ${TEST_E2E_PROFILE_04_NAME}_service_external.json) configure_file( ${NETWORK_TEST_SRC_DIR}/e2e_tests/conf/${TEST_E2E_PROFILE_04_SERVICE_CONFIG_FILE_EXTERNAL}.in - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_04_SERVICE_CONFIG_FILE_EXTERNAL} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_04_SERVICE_CONFIG_FILE_EXTERNAL} ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_PROFILE_04_SERVICE_CONFIG_FILE_EXTERNAL} - ${TEST_E2E_PROFILE_04_SERVICE} - ) + @ONLY) # Copy client config file for external allow tests into $BUILDDIR/test set(TEST_E2E_PROFILE_04_CLIENT_CONFIG_FILE_EXTERNAL ${TEST_E2E_PROFILE_04_NAME}_client_external.json) configure_file( ${NETWORK_TEST_SRC_DIR}/e2e_tests/conf/${TEST_E2E_PROFILE_04_CLIENT_CONFIG_FILE_EXTERNAL}.in - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_04_CLIENT_CONFIG_FILE_EXTERNAL} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_04_CLIENT_CONFIG_FILE_EXTERNAL} ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_PROFILE_04_CLIENT_CONFIG_FILE_EXTERNAL} - ${TEST_E2E_PROFILE_04_SERVICE} - ) + @ONLY) # Copy bashscript to start external tests (master) into $BUILDDIR/test set(TEST_E2E_PROFILE_04_EXTERNAL_MASTER_START_SCRIPT ${TEST_E2E_PROFILE_04_NAME}_external_master_start.sh) @@ -3536,25 +2778,15 @@ if(NOT ${TESTS_BAT} AND ${TEST_E2E_PROFILE_07}) set(TEST_E2E_PROFILE_07_SERVICE_CONFIG_FILE_EXTERNAL ${TEST_E2E_PROFILE_07_NAME}_service_external.json) configure_file( ${NETWORK_TEST_SRC_DIR}/e2e_tests/conf/${TEST_E2E_PROFILE_07_SERVICE_CONFIG_FILE_EXTERNAL}.in - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_07_SERVICE_CONFIG_FILE_EXTERNAL} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_07_SERVICE_CONFIG_FILE_EXTERNAL} ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_PROFILE_07_SERVICE_CONFIG_FILE_EXTERNAL} - ${TEST_E2E_PROFILE_07_SERVICE} - ) + @ONLY) # Copy client config file for external allow tests into $BUILDDIR/test set(TEST_E2E_PROFILE_07_CLIENT_CONFIG_FILE_EXTERNAL ${TEST_E2E_PROFILE_07_NAME}_client_external.json) configure_file( ${NETWORK_TEST_SRC_DIR}/e2e_tests/conf/${TEST_E2E_PROFILE_07_CLIENT_CONFIG_FILE_EXTERNAL}.in - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_07_CLIENT_CONFIG_FILE_EXTERNAL} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/e2e_tests/${TEST_E2E_PROFILE_07_CLIENT_CONFIG_FILE_EXTERNAL} ${NETWORK_TEST_BIN_DIR}/${TEST_E2E_PROFILE_07_CLIENT_CONFIG_FILE_EXTERNAL} - ${TEST_E2E_PROFILE_07_SERVICE} - ) + @ONLY) # Copy bashscript to start external tests (master) into $BUILDDIR/test set(TEST_E2E_PROFILE_07_EXTERNAL_MASTER_START_SCRIPT ${TEST_E2E_PROFILE_07_NAME}_external_master_start.sh) @@ -3607,35 +2839,20 @@ if(NOT ${TESTS_BAT}) set(TEST_EVENT_SLAVE_TCP_CONFIG_FILE ${TEST_EVENT_NAME}_slave_tcp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/event_tests/conf/${TEST_EVENT_SLAVE_TCP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/event_tests/${TEST_EVENT_SLAVE_TCP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/event_tests/${TEST_EVENT_SLAVE_TCP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EVENT_SLAVE_TCP_CONFIG_FILE} - ${TEST_EVENT_SERVICE} - ) + @ONLY) set(TEST_EVENT_SLAVE_UDP_CONFIG_FILE ${TEST_EVENT_NAME}_slave_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/event_tests/conf/${TEST_EVENT_SLAVE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/event_tests/${TEST_EVENT_SLAVE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/event_tests/${TEST_EVENT_SLAVE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EVENT_SLAVE_UDP_CONFIG_FILE} - ${TEST_EVENT_SERVICE} - ) + @ONLY) set(TEST_EVENT_MASTER_CONFIG_FILE ${TEST_EVENT_NAME}_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/event_tests/conf/${TEST_EVENT_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/event_tests/${TEST_EVENT_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/event_tests/${TEST_EVENT_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_EVENT_MASTER_CONFIG_FILE} - ${TEST_EVENT_CLIENT} - ) + @ONLY) # Copy bashscript to start test (master) into $BUILDDIR/test set(TEST_EVENT_MASTER_START_SCRIPT ${TEST_EVENT_NAME}_master_starter.sh) @@ -3746,12 +2963,8 @@ if(NOT ${TESTS_BAT} AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "QNX") set(TEST_NPDU_SERVICE_CONFIG_FILE ${TEST_NPDU_SERVICE}_no_npdu.json) configure_file( ${NETWORK_TEST_SRC_DIR}/npdu_tests/conf/${TEST_NPDU_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/npdu_tests/${TEST_NPDU_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/npdu_tests/${TEST_NPDU_SERVICE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_NPDU_SERVICE_CONFIG_FILE} - ${TEST_NPDU_SERVICE_ONE} - ) + @ONLY) # Copy bashscript to start service w/o npdu into $BUILDDIR/test set(TEST_NPDU_SERVICE_START_SCRIPT ${TEST_NPDU_SERVICE}_no_npdu_start.sh) @@ -3765,12 +2978,8 @@ if(NOT ${TESTS_BAT} AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "QNX") set(TEST_NPDU_SERVICE_CONFIG_FILE ${TEST_NPDU_SERVICE}_npdu.json) configure_file( ${NETWORK_TEST_SRC_DIR}/npdu_tests/conf/${TEST_NPDU_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/npdu_tests/${TEST_NPDU_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/npdu_tests/${TEST_NPDU_SERVICE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_NPDU_SERVICE_CONFIG_FILE} - ${TEST_NPDU_SERVICE_ONE} - ) + @ONLY) # Copy bashscript to start service with npdu into $BUILDDIR/test set(TEST_NPDU_SERVICE_START_SCRIPT ${TEST_NPDU_SERVICE}_npdu_start.sh) @@ -3836,12 +3045,8 @@ if(NOT ${TESTS_BAT} AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "QNX") set(TEST_NPDU_CLIENT_CONFIG_FILE ${TEST_NPDU_CLIENT}_no_npdu.json) configure_file( ${NETWORK_TEST_SRC_DIR}/npdu_tests/conf/${TEST_NPDU_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/npdu_tests/${TEST_NPDU_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/npdu_tests/${TEST_NPDU_CLIENT_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_NPDU_CLIENT_CONFIG_FILE} - ${TEST_NPDU_CLIENT_ONE} - ) + @ONLY) # Copy bashscript to start client w/o npdu into $BUILDDIR/test set(TEST_NPDU_CLIENT_START_SCRIPT ${TEST_NPDU_CLIENT}_no_npdu_start.sh) @@ -3855,12 +3060,8 @@ if(NOT ${TESTS_BAT} AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "QNX") set(TEST_NPDU_CLIENT_CONFIG_FILE ${TEST_NPDU_CLIENT}_npdu.json) configure_file( ${NETWORK_TEST_SRC_DIR}/npdu_tests/conf/${TEST_NPDU_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/npdu_tests/${TEST_NPDU_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir(${NETWORK_TEST_SRC_DIR}/npdu_tests/${TEST_NPDU_CLIENT_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_NPDU_CLIENT_CONFIG_FILE} - ${TEST_NPDU_CLIENT_ONE} - ) + @ONLY) # Copy bashscript to start client with npdu into $BUILDDIR/test set(TEST_NPDU_CLIENT_START_SCRIPT ${TEST_NPDU_CLIENT}_npdu_start.sh) @@ -3928,25 +3129,16 @@ if(NOT ${TESTS_BAT}) set(TEST_SOMEIPTP_MASTER_CONFIG_FILE ${TEST_SOMEIPTP_NAME}_master.json) configure_file( ${NETWORK_TEST_SRC_DIR}/someip_tp_tests/conf/${TEST_SOMEIPTP_MASTER_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/someip_tp_tests/${TEST_SOMEIPTP_MASTER_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/someip_tp_tests/${TEST_SOMEIPTP_MASTER_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SOMEIPTP_MASTER_CONFIG_FILE} - ${TEST_SOMEIPTP_CLIENT} - ) + @ONLY) # Copy bashscript to start test (master) into $BUILDDIR/test set(TEST_SOMEIPTP_MASTER_START_SCRIPT ${TEST_SOMEIPTP_NAME}_master_starter.sh) configure_file( ${NETWORK_TEST_SRC_DIR}/someip_tp_tests/conf/${TEST_SOMEIPTP_MASTER_START_SCRIPT}.in - ${NETWORK_TEST_SRC_DIR}/someip_tp_tests/${TEST_SOMEIPTP_MASTER_START_SCRIPT} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/someip_tp_tests/${TEST_SOMEIPTP_MASTER_START_SCRIPT} ${NETWORK_TEST_BIN_DIR}/${TEST_SOMEIPTP_MASTER_START_SCRIPT} - ${TEST_SOMEIPTP_SERVICE} - ) + @ONLY) + endif() ############################################################################## @@ -3985,46 +3177,26 @@ if(NOT ${TESTS_BAT} AND ${TEST_SECOND_ADDRESS}) set(TEST_SECOND_ADDRESS_MASTER_SERVICE_UDP_CONFIG_FILE ${TEST_SECOND_ADDRESS_NAME}_master_service_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/second_address_tests/conf/${TEST_SECOND_ADDRESS_MASTER_SERVICE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/second_address_tests/${TEST_SECOND_ADDRESS_MASTER_SERVICE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/second_address_tests/${TEST_SECOND_ADDRESS_MASTER_SERVICE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SECOND_ADDRESS_MASTER_SERVICE_UDP_CONFIG_FILE} - ${TEST_SECOND_ADDRESS_SERVICE} - ) + @ONLY) set(TEST_SECOND_ADDRESS_SLAVE_CLIENT_CONFIG_FILE ${TEST_SECOND_ADDRESS_NAME}_slave_client.json) configure_file( ${NETWORK_TEST_SRC_DIR}/second_address_tests/conf/${TEST_SECOND_ADDRESS_SLAVE_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_CLIENT_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SECOND_ADDRESS_SLAVE_CLIENT_CONFIG_FILE} - ${TEST_SECOND_ADDRESS_CLIENT} - ) + @ONLY) set(TEST_SECOND_ADDRESS_MASTER_CLIENT_CONFIG_FILE ${TEST_SECOND_ADDRESS_NAME}_master_client.json) configure_file( ${NETWORK_TEST_SRC_DIR}/second_address_tests/conf/${TEST_SECOND_ADDRESS_MASTER_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/second_address_tests/${TEST_SECOND_ADDRESS_MASTER_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/second_address_tests/${TEST_SECOND_ADDRESS_MASTER_CLIENT_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SECOND_ADDRESS_MASTER_CLIENT_CONFIG_FILE} - ${TEST_SECOND_ADDRESS_CLIENT} - ) + @ONLY) set(TEST_SECOND_ADDRESS_SLAVE_SERVICE_UDP_CONFIG_FILE ${TEST_SECOND_ADDRESS_NAME}_slave_service_udp.json) configure_file( ${NETWORK_TEST_SRC_DIR}/second_address_tests/conf/${TEST_SECOND_ADDRESS_SLAVE_SERVICE_UDP_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_SERVICE_UDP_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_SERVICE_UDP_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SECOND_ADDRESS_SLAVE_SERVICE_UDP_CONFIG_FILE} - ${TEST_SECOND_ADDRESS_SERVICE} - ) + @ONLY) set(TEST_SECOND_ADDRESS_MASTER_START_SCRIPT ${TEST_SECOND_ADDRESS_NAME}_master_starter.sh) copy_to_builddir( @@ -4036,13 +3208,9 @@ if(NOT ${TESTS_BAT} AND ${TEST_SECOND_ADDRESS}) set(TEST_SECOND_ADDRESS_SLAVE_START_SCRIPT ${TEST_SECOND_ADDRESS_NAME}_slave_starter.sh) configure_file( ${NETWORK_TEST_SRC_DIR}/second_address_tests/conf/${TEST_SECOND_ADDRESS_SLAVE_START_SCRIPT}.in - ${NETWORK_TEST_SRC_DIR}/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_START_SCRIPT} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/second_address_tests/${TEST_SECOND_ADDRESS_SLAVE_START_SCRIPT} ${NETWORK_TEST_BIN_DIR}/${TEST_SECOND_ADDRESS_SLAVE_START_SCRIPT} - ${TEST_SECOND_ADDRESS_CLIENT} - ) + @ONLY) + endif() ############################################################################## @@ -4081,24 +3249,14 @@ if(NOT ${TESTS_BAT}) set(TEST_SUSPEND_RESUME_SERVICE_CONFIG_FILE ${TEST_SUSPEND_RESUME_SERVICE}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/suspend_resume_tests/conf/${TEST_SUSPEND_RESUME_SERVICE_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/suspend_resume_tests/${TEST_SUSPEND_RESUME_SERVICE_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/suspend_resume_tests/${TEST_SUSPEND_RESUME_SERVICE_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUSPEND_RESUME_SERVICE_CONFIG_FILE} - ${TEST_SUSPEND_RESUME_CLIENT} - ) + @ONLY) set(TEST_SUSPEND_RESUME_CLIENT_CONFIG_FILE ${TEST_SUSPEND_RESUME_CLIENT}.json) configure_file( ${NETWORK_TEST_SRC_DIR}/suspend_resume_tests/conf/${TEST_SUSPEND_RESUME_CLIENT_CONFIG_FILE}.in - ${NETWORK_TEST_SRC_DIR}/suspend_resume_tests/${TEST_SUSPEND_RESUME_CLIENT_CONFIG_FILE} - @ONLY) - copy_to_builddir( - ${NETWORK_TEST_SRC_DIR}/suspend_resume_tests/${TEST_SUSPEND_RESUME_CLIENT_CONFIG_FILE} ${NETWORK_TEST_BIN_DIR}/${TEST_SUSPEND_RESUME_CLIENT_CONFIG_FILE} - ${TEST_SUSPEND_RESUME_CLIENT} - ) + @ONLY) set(TEST_SUSPEND_RESUME_MASTER_START_SCRIPT ${TEST_SUSPEND_RESUME_NAME}_master_starter.sh) copy_to_builddir( diff --git a/test/network_tests/big_payload_tests/big_payload_test_service.cpp b/test/network_tests/big_payload_tests/big_payload_test_service.cpp index a6bd4d7eb..d37f3d152 100644 --- a/test/network_tests/big_payload_tests/big_payload_test_service.cpp +++ b/test/network_tests/big_payload_tests/big_payload_test_service.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "big_payload_test_service.hpp" #include "big_payload_test_globals.hpp" diff --git a/test/network_tests/big_payload_tests/conf/big_payload_test_udp_client.json.in b/test/network_tests/big_payload_tests/conf/big_payload_test_udp_client.json.in index 5a7ee365b..d28e5952a 100644 --- a/test/network_tests/big_payload_tests/conf/big_payload_test_udp_client.json.in +++ b/test/network_tests/big_payload_tests/conf/big_payload_test_udp_client.json.in @@ -25,7 +25,6 @@ { "service":"0x1240", "instance":"0x01", - "unicast":"@TEST_IP_SLAVE@", "unreliable": "30509", "someip-tp" : { "client-to-service" : [ "0x8421" ] diff --git a/test/network_tests/configuration_tests/configuration-test.cpp b/test/network_tests/configuration_tests/configuration-test.cpp index f2c8f8647..9544552e6 100644 --- a/test/network_tests/configuration_tests/configuration-test.cpp +++ b/test/network_tests/configuration_tests/configuration-test.cpp @@ -13,9 +13,9 @@ #include #include #include +#include #include "../implementation/configuration/include/configuration.hpp" -#include "../../implementation/plugin/include/plugin_manager_impl.hpp" #include "../../implementation/configuration/include/configuration_impl.hpp" #include "../../implementation/configuration/include/configuration_plugin.hpp" #include "../../implementation/protocol/include/protocol.hpp" @@ -167,7 +167,7 @@ void check_file(const std::string &_config_file, // 1. Create configuration object std::shared_ptr its_configuration; - auto its_plugin = vsomeip::plugin_manager_impl::get()->get_plugin( + auto its_plugin = vsomeip::plugin_manager::get()->get_plugin( vsomeip::plugin_type_e::CONFIGURATION_PLUGIN, VSOMEIP_CFG_LIBRARY); if (its_plugin) { auto its_configuration_plugin @@ -572,7 +572,7 @@ void check_file(const std::string &_config_file, vsomeip_sec_client_t its_8000_8000 = utility::create_uds_client(8000, 8000, 0); vsomeip_sec_client_t its_9000_9000 = utility::create_uds_client(9000, 9000, 0); - auto its_security = vsomeip::policy_manager_impl::get(); + auto its_security = its_configuration->get_policy_manager(); EXPECT_TRUE(its_security->is_offer_allowed(&its_1000_1000, 0x1234, 0x5678)); EXPECT_TRUE(its_security->is_offer_allowed(&its_1000_1000, 0x1235, 0x5678)); EXPECT_TRUE(its_security->is_offer_allowed(&its_1000_1000, 0x1236, 0x5678)); @@ -753,7 +753,7 @@ void check_file(const std::string &_config_file, EXPECT_TRUE(check(request_response_delay, static_cast(_expected_request_response_delay), "SD RESPONSE REQUEST DELAY")); EXPECT_EQ(1000u, its_configuration->get_sd_offer_debounce_time()); - ASSERT_TRUE(vsomeip::plugin_manager_impl::get()->unload_plugin(vsomeip::plugin_type_e::CONFIGURATION_PLUGIN)); + ASSERT_TRUE(vsomeip::plugin_manager::get()->unload_plugin(vsomeip::plugin_type_e::CONFIGURATION_PLUGIN)); } TEST(configuration_test, check_config_file) { diff --git a/test/network_tests/cpu_load_tests/cpu_load_test_service.cpp b/test/network_tests/cpu_load_tests/cpu_load_test_service.cpp index 3d935e395..8bf00cf2f 100644 --- a/test/network_tests/cpu_load_tests/cpu_load_test_service.cpp +++ b/test/network_tests/cpu_load_tests/cpu_load_test_service.cpp @@ -7,12 +7,13 @@ #include -#include -#include +#include // for isfinite #include #include +#include +#include #include -#include // for isfinite +#include #include "cpu_load_test_globals.hpp" #include diff --git a/test/network_tests/e2e_tests/e2e_profile_04_test_client.cpp b/test/network_tests/e2e_tests/e2e_profile_04_test_client.cpp index 266865682..f97f038ab 100644 --- a/test/network_tests/e2e_tests/e2e_profile_04_test_client.cpp +++ b/test/network_tests/e2e_tests/e2e_profile_04_test_client.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "e2e_profile_04_test_common.hpp" #include "e2e_profile_04_test_client.hpp" diff --git a/test/network_tests/e2e_tests/e2e_profile_04_test_service.cpp b/test/network_tests/e2e_tests/e2e_profile_04_test_service.cpp index efd48c906..acf34779b 100644 --- a/test/network_tests/e2e_tests/e2e_profile_04_test_service.cpp +++ b/test/network_tests/e2e_tests/e2e_profile_04_test_service.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "e2e_profile_04_test_common.hpp" #include "e2e_profile_04_test_service.hpp" diff --git a/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp b/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp index 606ef9968..58faa3ec6 100644 --- a/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp +++ b/test/network_tests/e2e_tests/e2e_profile_07_test_client.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "e2e_profile_07_test_common.hpp" #include "e2e_profile_07_test_client.hpp" diff --git a/test/network_tests/e2e_tests/e2e_profile_07_test_service.cpp b/test/network_tests/e2e_tests/e2e_profile_07_test_service.cpp index 5426209f5..5e2a09293 100644 --- a/test/network_tests/e2e_tests/e2e_profile_07_test_service.cpp +++ b/test/network_tests/e2e_tests/e2e_profile_07_test_service.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "e2e_profile_07_test_common.hpp" #include "e2e_profile_07_test_service.hpp" diff --git a/test/network_tests/e2e_tests/e2e_test_client.cpp b/test/network_tests/e2e_tests/e2e_test_client.cpp index 260ad7e13..9e270cca2 100644 --- a/test/network_tests/e2e_tests/e2e_test_client.cpp +++ b/test/network_tests/e2e_tests/e2e_test_client.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "e2e_test_client.hpp" static bool is_remote_test = false; diff --git a/test/network_tests/e2e_tests/e2e_test_service.cpp b/test/network_tests/e2e_tests/e2e_test_service.cpp index 46e57ae4e..164716700 100644 --- a/test/network_tests/e2e_tests/e2e_test_service.cpp +++ b/test/network_tests/e2e_tests/e2e_test_service.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "e2e_test_service.hpp" static bool is_remote_test = false; diff --git a/test/network_tests/event_tests/event_test_service.cpp b/test/network_tests/event_tests/event_test_service.cpp index 3728a8276..5f7099ffb 100644 --- a/test/network_tests/event_tests/event_test_service.cpp +++ b/test/network_tests/event_tests/event_test_service.cpp @@ -3,13 +3,14 @@ // 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/. +#include #include #include +#include #include +#include #include #include -#include -#include #include diff --git a/test/network_tests/header_factory_tests/header_factory_test_client.cpp b/test/network_tests/header_factory_tests/header_factory_test_client.cpp index 13b1111ed..59395ee66 100644 --- a/test/network_tests/header_factory_tests/header_factory_test_client.cpp +++ b/test/network_tests/header_factory_tests/header_factory_test_client.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "header_factory_test_client.hpp" header_factory_test_client::header_factory_test_client(bool _use_tcp) : diff --git a/test/network_tests/header_factory_tests/header_factory_test_service.cpp b/test/network_tests/header_factory_tests/header_factory_test_service.cpp index d647fd9b3..8f7255fe8 100644 --- a/test/network_tests/header_factory_tests/header_factory_test_service.cpp +++ b/test/network_tests/header_factory_tests/header_factory_test_service.cpp @@ -3,9 +3,10 @@ // 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/. -#include "header_factory_test_service.hpp" - #include +#include + +#include "header_factory_test_service.hpp" header_factory_test_service::header_factory_test_service(bool _use_static_routing) : app_(vsomeip::runtime::get()->create_application()), diff --git a/test/network_tests/lazy_load_tests/CMakeLists.txt b/test/network_tests/lazy_load_tests/CMakeLists.txt new file mode 100644 index 000000000..ecfa9fa03 --- /dev/null +++ b/test/network_tests/lazy_load_tests/CMakeLists.txt @@ -0,0 +1,106 @@ +# Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# 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/. + +cmake_minimum_required(VERSION 3.4...3.22) + +project(lazy_load_tests LANGUAGES CXX) + +if (${TEST_SECURITY}) + if(NOT ${TESTS_BAT}) + set(LAZY_LOAD_NAME lazy_load_test) + set(LAZY_LOAD_SERVICE lazy_load_test_service) + set(LAZY_LOAD_CLIENT lazy_load_test_client) + set(LAZY_LOAD_LAZY_CLIENT lazy_load_test_lazy_client) + + add_executable(${LAZY_LOAD_SERVICE} + ${LAZY_LOAD_SERVICE}.cpp) + target_link_libraries(${LAZY_LOAD_SERVICE} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + ) + + # Copy main config file into $BUILDDIR/test and $BUILDDIR/test/vsomeip + set(LAZY_LOAD_CONFIG_FILE ${LAZY_LOAD_NAME}_config.json) + configure_file( + ${NETWORK_TEST_SRC_DIR}/lazy_load_tests/conf/${LAZY_LOAD_CONFIG_FILE}.in + ${NETWORK_TEST_SRC_DIR}/lazy_load_tests/${LAZY_LOAD_CONFIG_FILE} + @ONLY) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/lazy_load_tests/${LAZY_LOAD_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/lazy_load_tests/vsomeip/${LAZY_LOAD_CONFIG_FILE} + ${LAZY_LOAD_SERVICE} + ) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/lazy_load_tests/${LAZY_LOAD_CONFIG_FILE} + ${NETWORK_TEST_BIN_DIR}/lazy_load_tests/${LAZY_LOAD_CONFIG_FILE} + ${LAZY_LOAD_SERVICE} + ) + + # Copy vsomeip policy extensions file for tests into $BUILDDIR/test + set(LAZY_LOAD_POLICY_EXTENSIONS vsomeip_policy_extensions.json) + configure_file( + ${NETWORK_TEST_SRC_DIR}/lazy_load_tests/conf/${LAZY_LOAD_POLICY_EXTENSIONS}.in + ${NETWORK_TEST_SRC_DIR}/lazy_load_tests/${LAZY_LOAD_POLICY_EXTENSIONS} + @ONLY) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/lazy_load_tests/${LAZY_LOAD_POLICY_EXTENSIONS} + ${NETWORK_TEST_BIN_DIR}/lazy_load_tests/vsomeip/${LAZY_LOAD_POLICY_EXTENSIONS} + ${LAZY_LOAD_SERVICE} + ) + + # Copy vsomeip security extension to into $BUILDDIR/test + set(LAZY_LOAD_VSOMEIP_SECURITY vsomeip_security.json) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/lazy_load_tests/extensions/1_1/${LAZY_LOAD_VSOMEIP_SECURITY} + ${NETWORK_TEST_BIN_DIR}/lazy_load_tests/vsomeip/vsomeip_ext/1_1/${LAZY_LOAD_VSOMEIP_SECURITY} + ${LAZY_LOAD_SERVICE} + ) + + # Copy bashscript to start local test into $BUILDDIR/test + set(LAZY_LOAD_SERVICE_START_SCRIPT ${LAZY_LOAD_NAME}_start.sh) + copy_to_builddir( + ${NETWORK_TEST_SRC_DIR}/lazy_load_tests/${LAZY_LOAD_SERVICE_START_SCRIPT} + ${NETWORK_TEST_BIN_DIR}/lazy_load_tests/${LAZY_LOAD_SERVICE_START_SCRIPT} + ${LAZY_LOAD_SERVICE} + ) + + add_executable(${LAZY_LOAD_CLIENT} + ${LAZY_LOAD_CLIENT}.cpp + ) + target_link_libraries(${LAZY_LOAD_CLIENT} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + ) + + add_executable(${LAZY_LOAD_LAZY_CLIENT} + ${LAZY_LOAD_LAZY_CLIENT}.cpp + ) + target_link_libraries(${LAZY_LOAD_LAZY_CLIENT} + ${VSOMEIP_NAME} + ${Boost_LIBRARIES} + ${DL_LIBRARY} + ${TEST_LINK_LIBRARIES} + ${DLT_LIBRARIES} + ) + + add_test(NAME ${LAZY_LOAD_NAME} + COMMAND ${NETWORK_TEST_BIN_DIR}/lazy_load_tests/${LAZY_LOAD_SERVICE_START_SCRIPT} + ) + + add_dependencies(${LAZY_LOAD_SERVICE} gtest) + add_dependencies(${LAZY_LOAD_CLIENT} gtest) + add_dependencies(${LAZY_LOAD_LAZY_CLIENT} gtest) + + add_dependencies(build_network_tests ${LAZY_LOAD_SERVICE}) + add_dependencies(build_network_tests ${LAZY_LOAD_CLIENT}) + add_dependencies(build_network_tests ${LAZY_LOAD_LAZY_CLIENT}) + endif() +endif() diff --git a/test/network_tests/lazy_load_tests/conf/lazy_load_test_config.json.in b/test/network_tests/lazy_load_tests/conf/lazy_load_test_config.json.in new file mode 100644 index 000000000..6cfbd80d7 --- /dev/null +++ b/test/network_tests/lazy_load_tests/conf/lazy_load_test_config.json.in @@ -0,0 +1,109 @@ +{ + "unicast" : "@TEST_IP_MASTER@", + "netmask" : "255.255.255.0", + "logging" : + { + "level" : "debug", + "console" : "true", + "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" }, + "dlt" : "true" + }, + "applications" : + [ + { + "name" : "service-sample", + "id" : "0x1277" + }, + { + "name" : "client-sample-normal", + "id" : "0x1255" + }, + { + "name" : "client-sample-lazy", + "id" : "0x1256" + }, + { + "name" : "routingmanagerd", + "id" : "0x1111" + } + ], + "services" : + [ + { + "service" : "0x1234", + "instance" : "0x5678", + "unicast" : "@TEST_IP_MASTER@", + "unreliable" : "30509" + }, + { + "service" : "0x111", + "instance" : "0x5678", + "unicast" : "@TEST_IP_MASTER@", + "unreliable" : "30509" + }, + { + "service" : "0x1234", + "instance" : "0x02", + "unicast" : "@TEST_IP_MASTER@", + "unreliable" : "30509" + } + ], + "security" : + { + "check_credentials" : "true", + "allow_remote_clients" : "true", + "policies" : + [ + { + "credentials" : [ + {"uid" : "@TEST_UID@", "gid" : "@TEST_GID@"} , + {"uid" : "1", "gid" : "1"} + ], + "allow" : + { + "offers": + [ + { + "service" : "0x1234", + "instances" : ["0x5678", "0x02"] + } + ] + } + }, + { + "credentials" : {"uid" : "@TEST_UID@", "gid" : "@TEST_GID@"}, + "allow" : + { + "requests": + [ + { + "service" : "0x1234", + "instances" : + [ + { + "ids" : ["0x5678"], + "methods" : [ {"first" : "0x8421", "last" : "0x8422" }, "0x8001", "0x7777" ] + } + ] + } + ] + } + } + ] + }, + "routing" : "routingmanagerd", + "service-discovery" : + { + "enable" : "true", + "multicast" : "224.0.0.1", + "port" : "30490", + "protocol" : "udp", + "initial_delay_min" : "10", + "initial_delay_max" : "100", + "repetitions_base_delay" : "200", + "repetitions_max" : "3", + "ttl" : "3", + "cyclic_offer_delay" : "2000", + "request_response_delay" : "1500" + } +} diff --git a/test/network_tests/lazy_load_tests/conf/vsomeip_policy_extensions.json.in b/test/network_tests/lazy_load_tests/conf/vsomeip_policy_extensions.json.in new file mode 100644 index 000000000..eb45c40ea --- /dev/null +++ b/test/network_tests/lazy_load_tests/conf/vsomeip_policy_extensions.json.in @@ -0,0 +1,8 @@ +{ + "container_policy_extensions": + [ + { + "container": "@HOSTNAME@", "path": "../..@NETWORK_TEST_BIN_DIR@/lazy_load_tests/vsomeip/vsomeip_ext" + } + ] +} diff --git a/test/network_tests/lazy_load_tests/extensions/1_1/vsomeip_security.json b/test/network_tests/lazy_load_tests/extensions/1_1/vsomeip_security.json new file mode 100644 index 000000000..c1b64997e --- /dev/null +++ b/test/network_tests/lazy_load_tests/extensions/1_1/vsomeip_security.json @@ -0,0 +1,27 @@ +{ + "security" : + { + "policies" : + [ + { + "credentials" : { "uid" : "1", "gid" : "1" }, + "allow" : + { + "requests": + [ + { + "service" : "0x1234", + "instances" : + [ + { + "ids" : ["0x02"], + "methods" : [ {"first" : "0x8421", "last" : "0x8422" }, "0x8002", "0x7777" ] + } + ] + } + ] + } + } + ] + } +} diff --git a/test/network_tests/lazy_load_tests/lazy_load_test_client.cpp b/test/network_tests/lazy_load_tests/lazy_load_test_client.cpp new file mode 100644 index 000000000..e078374d7 --- /dev/null +++ b/test/network_tests/lazy_load_tests/lazy_load_test_client.cpp @@ -0,0 +1,232 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// 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/. + +#include + +#include "lazy_load_test_client.hpp" + +lazy_load_test_client::lazy_load_test_client() + : app_(vsomeip::runtime::get()->create_application()), + current_service_availability_status_(false), + sender_(std::bind(&lazy_load_test_client::run, this)), + received_responses_(0), + received_allowed_events_(0) {} + +bool lazy_load_test_client::init() { + if (!app_->init()) { + ADD_FAILURE() << "Couldn't initialize application"; + return false; + } + + app_->register_state_handler( + std::bind(&lazy_load_test_client::on_state, this, + std::placeholders::_1)); + + app_->register_message_handler(vsomeip::ANY_SERVICE, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD, + std::bind(&lazy_load_test_client::on_message, this, + std::placeholders::_1)); + + app_->register_message_handler(vsomeip::ANY_SERVICE, + TEST_INSTANCE_LAZY, vsomeip::ANY_METHOD, + std::bind(&lazy_load_test_client::on_message, this, + std::placeholders::_1)); + + app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, + std::bind(&lazy_load_test_client::on_availability, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); + + app_->register_availability_handler(SERVICE_TO_BE_REFUSED, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, + std::bind(&lazy_load_test_client::on_availability, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); + + app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, + TEST_INSTANCE_LAZY, + std::bind(&lazy_load_test_client::on_availability, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); + return true; +} + +void lazy_load_test_client::start() { + VSOMEIP_INFO << "Starting..."; + + app_->start(); +} + +void lazy_load_test_client::stop() { + VSOMEIP_INFO << "Stopping..."; + + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + app_->clear_all_handler(); + app_->stop(); +} + +void lazy_load_test_client::on_state(vsomeip::state_type_e _state) { + VSOMEIP_INFO << "CLIENT ON_STATE..."; + if (_state == vsomeip::state_type_e::ST_REGISTERED) { + app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, false); + + // request not allowed service ID + app_->request_service(SERVICE_TO_BE_REFUSED, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, false); + + // request not allowed instance ID + app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, + TEST_INSTANCE_LAZY, false); + + // request events of eventgroup 0x01 which holds events 0x8001 (allowed) and 0x8002 (denied) + std::set its_eventgroups; + its_eventgroups.insert(EVENT_GROUP); + + app_->request_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, + static_cast(EVENT_TO_ACCEPT), + its_eventgroups, vsomeip::event_type_e::ET_FIELD, + vsomeip::reliability_type_e::RT_UNRELIABLE); + app_->request_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, + static_cast(EVENT_TO_REFUSE), + its_eventgroups, vsomeip::event_type_e::ET_FIELD, + vsomeip::reliability_type_e::RT_UNRELIABLE); + + app_->subscribe(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, EVENT_GROUP, + vsomeip::DEFAULT_MAJOR, static_cast(EVENT_TO_ACCEPT)); + + app_->subscribe(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, EVENT_GROUP, + vsomeip::DEFAULT_MAJOR, static_cast(EVENT_TO_REFUSE)); + + } +} + +void lazy_load_test_client::on_availability(vsomeip::service_t _service, + vsomeip::instance_t _instance, bool _is_service_available) { + + VSOMEIP_INFO << "CLIENT ON_AVAILABILITY..."; + VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client() + << " : Service [" << std::setw(4) << std::setfill('0') << std::hex + << _service << '.' << _instance << "] is " + << (_is_service_available ? "available." : "NOT available."); + + // Check that only the allowed service is available + if (_is_service_available) { + EXPECT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _service) + << "Unexpected Service ID on_availability"; + EXPECT_EQ(vsomeip_test::TEST_SERVICE_INSTANCE_ID, _instance) + << "Unexpected Instance ID on_availability"; + } + if (vsomeip_test::TEST_SERVICE_SERVICE_ID == _service + && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) { + std::unique_lock its_lock(mutex_); + if (current_service_availability_status_ && !_is_service_available) { + current_service_availability_status_ = false; + } else if (_is_service_available && !current_service_availability_status_) { + current_service_availability_status_ = true; + condition_.notify_one(); + } + } +} + +void lazy_load_test_client::on_message(const std::shared_ptr &_response) { + VSOMEIP_INFO << "Received a response from Service [" + << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() + << '.' + << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() + << "] to Client/Session [" + << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() + << '/' + << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() + << ']'; + + if (_response->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) { + EXPECT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _response->get_service()) + << "Unexpected Service ID on_message response"; + EXPECT_EQ(vsomeip_test::TEST_SERVICE_INSTANCE_ID, _response->get_instance()) + << "Unexpected Instance ID on_message response"; + EXPECT_EQ(vsomeip_test::TEST_SERVICE_METHOD_ID, _response->get_method()) + << "Unexpected Method ID on_message response"; + + + if (_response->get_service() == vsomeip_test::TEST_SERVICE_SERVICE_ID && + _response->get_instance() == vsomeip_test::TEST_SERVICE_INSTANCE_ID && + _response->get_method() == vsomeip_test::TEST_SERVICE_METHOD_ID) { + received_responses_++; + if (received_responses_ == NUMBER_OF_MESSAGES_TO_SEND) { + VSOMEIP_WARNING << std::hex << app_->get_client() + << ": Received all messages ~> going down!"; + } + } + + } else if (_response->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) { + + // check that only allowed event 0x8001 is received for client-sample-a + EXPECT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _response->get_service()) + << "Unexpected Service ID on_message notification"; + EXPECT_EQ(vsomeip_test::TEST_SERVICE_INSTANCE_ID, _response->get_instance()) + << "Unexpected Instance ID on_message notification"; + EXPECT_EQ(EVENT_TO_ACCEPT, _response->get_method()) + << "Unexpected Method ID on_message notification"; + + received_allowed_events_++; + } +} + +void lazy_load_test_client::run() { + for (std::uint32_t i = 0; i < NUMBER_OF_MESSAGES_TO_SEND; ++i) { + { + std::unique_lock its_lock(mutex_); + while (!current_service_availability_status_) { + condition_.wait(its_lock); + } + } + + auto request = vsomeip::runtime::get()->create_request(false); + + request->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID); + request->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID); + request->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID); + + // send a request which is allowed by policy -> expect answer + app_->send(request); + + // send a request with a not allowed method ID -> expect no answer + request->set_method(METHOD_TO_BE_REFUSED); + app_->send(request); + + std::this_thread::sleep_for(std::chrono::milliseconds(250)); + } + + std::this_thread::sleep_for(std::chrono::milliseconds(250)); + + EXPECT_EQ(NUMBER_OF_MESSAGES_TO_SEND, received_responses_) + << "Unexpected received_responses_ run()"; + EXPECT_EQ(received_allowed_events_, static_cast(EXPECTED_EVENTS)) + << "Unexpected received_allowed_events run()"; + + stop(); +} + +void lazy_load_test_client::join_sender_thread() { + if (sender_.joinable()) { + sender_.join(); + } +} + +TEST(someip_lazy_load_test, normal_client) { + lazy_load_test_client test_client; + if (test_client.init()) { + test_client.start(); + test_client.join_sender_thread(); + } +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/network_tests/lazy_load_tests/lazy_load_test_client.hpp b/test/network_tests/lazy_load_tests/lazy_load_test_client.hpp new file mode 100644 index 000000000..245ac1f2f --- /dev/null +++ b/test/network_tests/lazy_load_tests/lazy_load_test_client.hpp @@ -0,0 +1,61 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// 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/. + +#ifndef LAZY_LOAD_TEST_CLIENT_HPP +#define LAZY_LOAD_TEST_CLIENT_HPP + +#include +#include +#include +#include + +#include +#include + +#include "../someip_test_globals.hpp" + +class lazy_load_test_client { +public: + lazy_load_test_client(); + bool init(); + void start(); + void stop(); + + void on_state(vsomeip::state_type_e _state); + void on_availability(vsomeip::service_t _service, + vsomeip::instance_t _instance, bool _is_available); + void on_message(const std::shared_ptr &_response); + + void run(); + void join_sender_thread(); + +private: + void shutdown_service(); + + std::shared_ptr app_; + + std::mutex mutex_; + std::condition_variable condition_; + bool current_service_availability_status_; + + std::thread sender_; + + std::atomic received_responses_; + std::atomic received_allowed_events_; + + const std::uint16_t METHOD_TO_BE_REFUSED = 0x888; + const std::uint16_t SERVICE_TO_BE_REFUSED = 0x111; + const std::uint16_t TEST_INSTANCE_LAZY = 0x02; + const std::uint16_t EXPECTED_EVENTS = 0x01; + + const std::uint16_t EVENT_GROUP = 0x01; + const std::uint16_t EVENT_TO_ACCEPT = 0x8001; + const std::uint16_t EVENT_TO_REFUSE = 0x8002; + + const std::uint16_t NUMBER_OF_MESSAGES_TO_SEND = 10; + +}; + +#endif // LAZY_LOAD_TEST_CLIENT_HPP diff --git a/test/network_tests/lazy_load_tests/lazy_load_test_lazy_client.cpp b/test/network_tests/lazy_load_tests/lazy_load_test_lazy_client.cpp new file mode 100644 index 000000000..7349b2d10 --- /dev/null +++ b/test/network_tests/lazy_load_tests/lazy_load_test_lazy_client.cpp @@ -0,0 +1,242 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// 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/. + +#include + +#include "lazy_load_test_lazy_client.hpp" + +lazy_load_lazy_client::lazy_load_lazy_client() + : app_(vsomeip::runtime::get()->create_application()), + current_service_availability_status_(false), + sender_(std::bind(&lazy_load_lazy_client::run, this)), + received_responses_(0), + received_allowed_events_(0) {} + +bool lazy_load_lazy_client::init() { + if (!app_->init()) { + ADD_FAILURE() << "Couldn't initialize application"; + return false; + } + + app_->register_state_handler( + std::bind(&lazy_load_lazy_client::on_state, this, + std::placeholders::_1)); + + app_->register_message_handler(vsomeip::ANY_SERVICE, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip::ANY_METHOD, + std::bind(&lazy_load_lazy_client::on_message, this, + std::placeholders::_1)); + + app_->register_message_handler(vsomeip::ANY_SERVICE, + TEST_INSTANCE_LAZY, vsomeip::ANY_METHOD, + std::bind(&lazy_load_lazy_client::on_message, this, + std::placeholders::_1)); + + app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, + std::bind(&lazy_load_lazy_client::on_availability, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); + + app_->register_availability_handler(SERVICE_TO_BE_REFUSED, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, + std::bind(&lazy_load_lazy_client::on_availability, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); + + app_->register_availability_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, + TEST_INSTANCE_LAZY, + std::bind(&lazy_load_lazy_client::on_availability, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); + return true; +} + +void lazy_load_lazy_client::start() { + VSOMEIP_INFO << "Starting..."; + + app_->start(); +} + +void lazy_load_lazy_client::stop() { + VSOMEIP_INFO << "Stopping..."; + shutdown_service(); + + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + app_->clear_all_handler(); + app_->stop(); +} + +void lazy_load_lazy_client::on_state(vsomeip::state_type_e _state) { + VSOMEIP_INFO << "CLIENT ON_STATE..."; + if (_state == vsomeip::state_type_e::ST_REGISTERED) { + // request not allowed instance ID + app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, false); + + // request not allowed service ID + app_->request_service(SERVICE_TO_BE_REFUSED, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, false); + + app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, + TEST_INSTANCE_LAZY, false); + + // request events of eventgroup 0x01 which holds events 0x8001 (denied) and 0x8002 (allowed) + std::set its_eventgroups; + its_eventgroups.insert(EVENT_GROUP); + + app_->request_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, TEST_INSTANCE_LAZY, + static_cast(EVENT_TO_REFUSE_LAZY), + its_eventgroups, vsomeip::event_type_e::ET_FIELD, + vsomeip::reliability_type_e::RT_UNRELIABLE); + app_->request_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, TEST_INSTANCE_LAZY, + static_cast(EVENT_TO_ACCEPT_LAZY), + its_eventgroups, vsomeip::event_type_e::ET_FIELD, + vsomeip::reliability_type_e::RT_UNRELIABLE); + + app_->subscribe(vsomeip_test::TEST_SERVICE_SERVICE_ID, TEST_INSTANCE_LAZY, EVENT_GROUP, + vsomeip::DEFAULT_MAJOR, static_cast(EVENT_TO_REFUSE_LAZY)); + + app_->subscribe(vsomeip_test::TEST_SERVICE_SERVICE_ID, TEST_INSTANCE_LAZY, EVENT_GROUP, + vsomeip::DEFAULT_MAJOR, static_cast(EVENT_TO_ACCEPT_LAZY)); + } +} + +void lazy_load_lazy_client::on_availability(vsomeip::service_t _service, + vsomeip::instance_t _instance, bool _is_service_available) { + + VSOMEIP_INFO << "CLIENT ON_AVAILABILITY..."; + VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client() + << " : Service [" << std::setw(4) << std::setfill('0') << std::hex + << _service << '.' << _instance << "] is " + << (_is_service_available ? "available." : "NOT available."); + + // Check that only the allowed service is available + if (_is_service_available) { + EXPECT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _service) + << "Unexpected Service ID on_available"; + EXPECT_EQ(TEST_INSTANCE_LAZY, _instance) + << "Unexpected Instance ID on_available"; + } + + if (vsomeip_test::TEST_SERVICE_SERVICE_ID == _service + && TEST_INSTANCE_LAZY == _instance) { + std::unique_lock its_lock(mutex_); + if (current_service_availability_status_ && !_is_service_available) { + current_service_availability_status_ = false; + } else if (_is_service_available && !current_service_availability_status_) { + current_service_availability_status_ = true; + condition_.notify_one(); + } + } + +} + +void lazy_load_lazy_client::on_message(const std::shared_ptr &_response) { + VSOMEIP_INFO << "Received a response from Service [" + << std::setw(4) << std::setfill('0') << std::hex << _response->get_service() + << '.' + << std::setw(4) << std::setfill('0') << std::hex << _response->get_instance() + << "] to Client/Session [" + << std::setw(4) << std::setfill('0') << std::hex << _response->get_client() + << '/' + << std::setw(4) << std::setfill('0') << std::hex << _response->get_session() + << ']'; + + if (_response->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) { + EXPECT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _response->get_service()) + << "Unexpected Service ID on_message response"; + EXPECT_EQ(TEST_INSTANCE_LAZY, _response->get_instance()) + << "Unexpected Instance ID on_message response"; + EXPECT_EQ(vsomeip_test::TEST_SERVICE_METHOD_ID, _response->get_method()) + << "Unexpected Method ID on_message response"; + + + if (_response->get_service() == vsomeip_test::TEST_SERVICE_SERVICE_ID && + _response->get_method() == vsomeip_test::TEST_SERVICE_METHOD_ID) { + received_responses_++; + if (received_responses_ == NUMBER_OF_MESSAGES_TO_SEND) { + VSOMEIP_WARNING << std::hex << app_->get_client() + << ": Received all messages ~> going down!"; + } + } + + } else if (_response->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) { + + // check that only allowed event 0x8002 is received for client-sample-lazy + EXPECT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _response->get_service()) + << "Unexpected Service ID on_message notification"; + EXPECT_EQ(TEST_INSTANCE_LAZY, _response->get_instance()) + << "Unexpected Instance ID on_message notification"; + EXPECT_EQ(EVENT_TO_ACCEPT_LAZY, _response->get_method()) + << "Unexpected Method ID on_message notification"; + received_allowed_events_++; + } +} + +void lazy_load_lazy_client::run() { + for (std::uint32_t i = 0; i < NUMBER_OF_MESSAGES_TO_SEND; ++i) { + { + std::unique_lock its_lock(mutex_); + while (!current_service_availability_status_) { + condition_.wait(its_lock); + } + } + + auto request = vsomeip::runtime::get()->create_request(false); + + request->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID); + request->set_instance(TEST_INSTANCE_LAZY); + request->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID); + + + // send a request which is allowed by policy -> expect answer + app_->send(request); + + // send a request with a not allowed method ID -> expect no answer + request->set_method(METHOD_TO_BE_REFUSED); + app_->send(request); + + std::this_thread::sleep_for(std::chrono::milliseconds(250)); + } + + std::this_thread::sleep_for(std::chrono::milliseconds(250)); + + EXPECT_EQ(NUMBER_OF_MESSAGES_TO_SEND,received_responses_) + << "Unexpected received_responses_ run"; + EXPECT_EQ(received_allowed_events_, static_cast(EXPECTED_EVENTS)) + << "Unexpected received_allowed_events_ run"; + + stop(); +} + +void lazy_load_lazy_client::join_sender_thread() { + if (sender_.joinable()) { + sender_.join(); + } +} + +void lazy_load_lazy_client::shutdown_service() { + VSOMEIP_INFO << "SHUTDOWN_SERVICE called from LAZY client"; + auto request = vsomeip::runtime::get()->create_request(false); + request->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID); + request->set_instance(TEST_INSTANCE_LAZY); + request->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN); + app_->send(request); +} + +TEST(someip_lazy_load_test, lazy_client) { + lazy_load_lazy_client test_lazy_client; + if (test_lazy_client.init()) { + test_lazy_client.start(); + test_lazy_client.join_sender_thread(); + } +} + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/network_tests/lazy_load_tests/lazy_load_test_lazy_client.hpp b/test/network_tests/lazy_load_tests/lazy_load_test_lazy_client.hpp new file mode 100644 index 000000000..0d8aaadb6 --- /dev/null +++ b/test/network_tests/lazy_load_tests/lazy_load_test_lazy_client.hpp @@ -0,0 +1,60 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// 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/. + +#ifndef LAZY_LOAD_TEST_LAZY_CLIENT_HPP +#define LAZY_LOAD_TEST_LAZY_CLIENT_HPP + +#include +#include +#include +#include + +#include +#include + +#include "../someip_test_globals.hpp" + +class lazy_load_lazy_client { +public: + lazy_load_lazy_client(); + bool init(); + void start(); + void stop(); + + void on_state(vsomeip::state_type_e _state); + void on_availability(vsomeip::service_t _service, + vsomeip::instance_t _instance, bool _is_available); + void on_message(const std::shared_ptr &_response); + + void run(); + void join_sender_thread(); + +private: + void shutdown_service(); + + std::shared_ptr app_; + + std::mutex mutex_; + std::condition_variable condition_; + bool current_service_availability_status_; + + std::thread sender_; + + std::atomic received_responses_; + std::atomic received_allowed_events_; + + const std::uint16_t METHOD_TO_BE_REFUSED = 0x888; + const std::uint16_t SERVICE_TO_BE_REFUSED = 0x111; + const std::uint16_t TEST_INSTANCE_LAZY = 0x02; + const std::uint16_t EXPECTED_EVENTS = 0x01; + + const std::uint16_t EVENT_GROUP = 0x01; + const std::uint16_t EVENT_TO_ACCEPT_LAZY = 0x8002; + const std::uint16_t EVENT_TO_REFUSE_LAZY = 0x8001; + + const std::uint16_t NUMBER_OF_MESSAGES_TO_SEND = 10; +}; + +#endif // LAZY_LOAD_TEST_LAZY_CLIENT_HPP diff --git a/test/network_tests/lazy_load_tests/lazy_load_test_service.cpp b/test/network_tests/lazy_load_tests/lazy_load_test_service.cpp new file mode 100644 index 000000000..001bff656 --- /dev/null +++ b/test/network_tests/lazy_load_tests/lazy_load_test_service.cpp @@ -0,0 +1,197 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// 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/. + +#include + +#include "lazy_load_test_service.hpp" + +lazy_load_test_service::lazy_load_test_service() : + app_(vsomeip::runtime::get()->create_application()), + is_registered_(false), + blocked_(false), + number_of_received_messages_(0), + offer_thread_(std::bind(&lazy_load_test_service::run, this)) {} + +bool lazy_load_test_service::init() { + std::lock_guard its_lock(mutex_); + + if (!app_->init()) { + ADD_FAILURE() << "Couldn't initialize application"; + return false; + } + app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, + vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID, + std::bind(&lazy_load_test_service::on_message, this, + std::placeholders::_1)); + + app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, + TEST_INSTANCE_LAZY, + vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN, + std::bind(&lazy_load_test_service::on_message_shutdown, this, + std::placeholders::_1)); + + app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID, + TEST_INSTANCE_LAZY, + vsomeip_test::TEST_SERVICE_METHOD_ID, + std::bind(&lazy_load_test_service::on_message, this, + std::placeholders::_1)); + + app_->register_state_handler( + std::bind(&lazy_load_test_service::on_state, this, + std::placeholders::_1)); + + // offer eventgroup 0x01 + std::set its_eventgroups; + its_eventgroups.insert(EVENT_GROUP); + + app_->offer_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, + static_cast(EVENT_TO_ACCEPT_DEFAULT), its_eventgroups, + vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(), + false, true, nullptr, vsomeip::reliability_type_e::RT_UNRELIABLE); + + // also offer field 0x8002 which is not allowed to be received by client + app_->offer_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, + static_cast(EVENT_TO_ACCEPT_LAZY), its_eventgroups, + vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(), + false, true, nullptr, vsomeip::reliability_type_e::RT_UNRELIABLE); + + // Used with lazy client also offer field 0x8001 which is not allowed to be received by lazy client + app_->offer_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, TEST_INSTANCE_LAZY, + static_cast(EVENT_TO_ACCEPT_DEFAULT), its_eventgroups, + vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(), + false, true, nullptr, vsomeip::reliability_type_e::RT_UNRELIABLE); + + app_->offer_event(vsomeip_test::TEST_SERVICE_SERVICE_ID, TEST_INSTANCE_LAZY, + static_cast(EVENT_TO_ACCEPT_LAZY), its_eventgroups, + vsomeip::event_type_e::ET_FIELD, std::chrono::milliseconds::zero(), + false, true, nullptr, vsomeip::reliability_type_e::RT_UNRELIABLE); + + // set value to fields + std::shared_ptr its_payload = + vsomeip::runtime::get()->create_payload(); + vsomeip::byte_t its_data[2]{ + static_cast((vsomeip_test::TEST_SERVICE_SERVICE_ID & 0xFF00) >> 8), + static_cast((vsomeip_test::TEST_SERVICE_SERVICE_ID & 0xFF)) + }; + its_payload->set_data(its_data, 2); + + app_->notify(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, + static_cast(EVENT_TO_ACCEPT_DEFAULT), its_payload); + + app_->notify(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID, + static_cast(EVENT_TO_ACCEPT_LAZY), its_payload); + + app_->notify(vsomeip_test::TEST_SERVICE_SERVICE_ID, TEST_INSTANCE_LAZY, + static_cast(EVENT_TO_ACCEPT_DEFAULT), its_payload); + + app_->notify(vsomeip_test::TEST_SERVICE_SERVICE_ID, TEST_INSTANCE_LAZY, + static_cast(EVENT_TO_ACCEPT_LAZY), its_payload); + + return true; +} + +void lazy_load_test_service::start() { + VSOMEIP_INFO << "Starting..."; + app_->start(); +} + +void lazy_load_test_service::stop() { + VSOMEIP_INFO << "Stopping..."; + stop_offer(); + app_->clear_all_handler(); + app_->stop(); +} + +void lazy_load_test_service::join_offer_thread() { + if (offer_thread_.joinable()) { + offer_thread_.join(); + } +} + +void lazy_load_test_service::offer() { + // Instance used by client a + app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); + + // Instance used by client b + app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, TEST_INSTANCE_LAZY); + + // try to offer a not allowed service ID 0x111 (client requesting the service should not get available) + app_->offer_service(SERVICE_TO_BE_REFUSED, vsomeip_test::TEST_SERVICE_INSTANCE_ID); +} + +void lazy_load_test_service::stop_offer() { + app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID); + app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, TEST_INSTANCE_LAZY); +} + +void lazy_load_test_service::on_state(vsomeip::state_type_e _state) { + VSOMEIP_INFO << "Application " << app_->get_name() << " is " + << (_state == vsomeip::state_type_e::ST_REGISTERED ? "registered." : + "deregistered."); + + if (_state == vsomeip::state_type_e::ST_REGISTERED) { + if (!is_registered_) { + is_registered_ = true; + std::lock_guard its_lock(mutex_); + blocked_ = true; + // "start" the run method thread + condition_.notify_one(); + } + } else { + is_registered_ = false; + } +} + +void lazy_load_test_service::on_message(const std::shared_ptr& _request) { + ASSERT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _request->get_service()); + ASSERT_EQ(vsomeip_test::TEST_SERVICE_METHOD_ID, _request->get_method()); + + VSOMEIP_INFO << "Received a message with Client/Session [" << std::setw(4) + << std::setfill('0') << std::hex << _request->get_client() << '/' + << std::setw(4) << std::setfill('0') << std::hex + << _request->get_session() << "] method: " << _request->get_method() + << " Instance ID: " << _request->get_instance(); + + // send response + std::shared_ptr its_response = + vsomeip::runtime::get()->create_response(_request); + + VSOMEIP_INFO << "service on_message response service : " << its_response->get_service(); + app_->send(its_response); + + number_of_received_messages_++; + if (number_of_received_messages_ == NUMBER_OF_MESSAGES_TO_RECEIVE) { + VSOMEIP_INFO << "Received all messages!"; + } +} + +void lazy_load_test_service::on_message_shutdown( + const std::shared_ptr&) { + VSOMEIP_INFO << "Shutdown method was called, going down now."; + stop(); +} + +void lazy_load_test_service::run() { + std::unique_lock its_lock(mutex_); + while (!blocked_) + condition_.wait(its_lock); + + offer(); +} + +TEST(someip_lazy_load_test, service) { + lazy_load_test_service test_service; + if (test_service.init()) { + test_service.start(); + test_service.join_offer_thread(); + } +} + +#ifdef __linux__ +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} +#endif diff --git a/test/network_tests/lazy_load_tests/lazy_load_test_service.hpp b/test/network_tests/lazy_load_tests/lazy_load_test_service.hpp new file mode 100644 index 000000000..fa347b509 --- /dev/null +++ b/test/network_tests/lazy_load_tests/lazy_load_test_service.hpp @@ -0,0 +1,53 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// 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/. + +#ifndef LAZY_LOAD_TEST_SERVICE_HPP +#define LAZY_LOAD_TEST_SERVICE_HPP + +#include +#include +#include + +#include +#include + +#include "../someip_test_globals.hpp" + +class lazy_load_test_service { +public: + lazy_load_test_service(); + bool init(); + void start(); + void stop(); + void offer(); + void stop_offer(); + void join_offer_thread(); + void on_state(vsomeip::state_type_e _state); + void on_message(const std::shared_ptr &_request); + void on_message_shutdown(const std::shared_ptr &_request); + void run(); + +private: + std::shared_ptr app_; + bool is_registered_; + + std::mutex mutex_; + std::condition_variable condition_; + bool blocked_; + std::uint32_t number_of_received_messages_; + std::thread offer_thread_; + + const std::uint16_t SERVICE_TO_BE_REFUSED = 0x111; + const std::uint16_t TEST_INSTANCE_LAZY = 0x02; + + const std::uint16_t EVENT_GROUP = 0x01; + const std::uint16_t EVENT_TO_ACCEPT_LAZY = 0x8002; + const std::uint16_t EVENT_TO_ACCEPT_DEFAULT = 0x8001; + + // Twice as big as messages to send, account for all messages from both clients + const std::uint16_t NUMBER_OF_MESSAGES_TO_RECEIVE = 20; +}; + +#endif // LAZY_LOAD_TEST_SERVICE_HPP diff --git a/test/network_tests/lazy_load_tests/lazy_load_test_start.sh b/test/network_tests/lazy_load_tests/lazy_load_test_start.sh new file mode 100755 index 000000000..6a3b3381d --- /dev/null +++ b/test/network_tests/lazy_load_tests/lazy_load_test_start.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright (C) 2015-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +# 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/. + +# Purpose: This script is needed to start the services with +# one command. This is necessary as ctest - which is used to run the +# tests - isn't able to start multiple binaries for one testcase. Therefore +# the testcase simply executes this script. This script then runs the services +# and checks that all exit successfully. + +export VSOMEIP_CONFIGURATION=/vsomeip/ +export VSOMEIP_APPLICATION_NAME=routingmanagerd +# start daemon +../../../examples/routingmanagerd/routingmanagerd & +PID_VSOMEIPD=$! + +sleep 1 + +export VSOMEIP_APPLICATION_NAME=service-sample +./lazy_load_test_service & + +sleep 1 + +export VSOMEIP_CONFIGURATION=lazy_load_test_service_config.json +export VSOMEIP_APPLICATION_NAME=client-sample_normal +./lazy_load_test_client & + +sleep 2 + +export VSOMEIP_CONFIGURATION=/vsomeip/ +export VSOMEIP_APPLICATION_NAME=client-sample-lazy +# start lazy client with linux user id 1 and group id 1 to use the 1_1 folder in extensions +setpriv --reuid=1 --regid=1 --clear-groups ./lazy_load_test_lazy_client + +sleep 1 + +kill $PID_VSOMEIPD +wait $PID_VSOMEIPD diff --git a/test/network_tests/lazy_load_tests/readme b/test/network_tests/lazy_load_tests/readme new file mode 100644 index 000000000..e58f99bba --- /dev/null +++ b/test/network_tests/lazy_load_tests/readme @@ -0,0 +1,112 @@ +Lazy Load Test + +Quick description: + +client-sample-normal: communicates with service id 0x1234, instance id 0x5678 without utilizing lazy loading. +client-sample-lazy: communicates with service id 0x1234, instance id 0x02. + +During the test registrations are made to the 0x01 eventgroup for both cases. +the normal client expects to receive the event 0x8001 while the lazy client expects the 0x8002 event. + +Multiple messages are then sent to the 0x8421, and the 0x888 methods of the respective service/instance for each test. Only responses from 0x8421 are expected. + +Details: + +Configs +The lazy load tests consists of 3 config jsons. +Two are configured json.in files, one is a direct json. + +-The lazy_load_test_config.json.in contains the basic app information: + --logging + + default configs + + --applications + + This tests uses 4 applications + "service-sample", "id" : "0x1277" runs the service app and will receive the requests from the clients + "client-sample-normal", "id" : "0x1255" client normal + "client-sample-lazy", "id" : "0x1256" client lazy + "routingmanagerd", "id" : "0x1111" in charge of the routing + + --services + + the list of services to be used in the app + service : "0x1234" holds 2 instance 0x5678 to interact with client a and 0x02 lazy client + service : "0x111" a dummy service which will not be permitted to be offered by policies + + --security: + + The security policy included in this json has the check_credentials set to true to enable the security feature to use Linux UserId and GroupId as credentials. + it always includes a policy that enables the offers of the service 0x1234 instances 0x5678 and 0x02 for the given credentials 0 0 and 1 1 + And holds the request part of the 0 0 credential (client sample) + + The request part of the security for lazy client is loaded subsequently by lazy loading + + --routing + + Routing will be handled by the routingmanagerd app + + --service discovery + default configs + +-The vsomeip_policy_extensions.json.in contains the container_policy_extensions which is a key value pair of the host container to the path of the vsomeip_security.json + +-The vsomeip_security.json contains the security policy for the requests allowed to credentials 1 1 (client-sample-lazy) + + + +The test + +Routingmanagerd app + The routingmanagerd app is brought up using the /vsomeip/ folder as its VSOMEIP_CONFIGURATION + Forcing it to parse the entire folder, and load the lazy_load_test_config.json + as well as the vsomeip_policy_extenions.json + The routingmanagerd is the routing manager and will handle communications between vsomeip apps. + +Service-sample app + The service-sample app is brought up using the same path as the routingmanagerd app. + The service-sample app offers 3 services + service 0x1234, instance 0x5678 (instance to interact with client-sample-normal due to security) + service 0x1234, instance 0x02 (instance to interact with client-sample-lazy due to security) + service 0x111, instance 0x5678 (dummy services offered, to be denied by security policies) + + The service 0x1234 + Contains an eventgroup 0x01 which has two offered events 0x8001 and 0x8002 + Both those events are populated with the payload 1234 and notified + Shutdown method 0x7777, used to shutdown the whole app + Method TEST_SERVICE_METHOD_ID = 0x8421 the method which will receive messages from the clients + + The service 0x111 + Offered but the security policies should prohibit the offer from happening. + Expect no interactions + + The test verifies the service-sample only receives message for the 0x1234 service and 0x8421 method + +Client-sample-normal app + The client-sample-normal app is brought up using direct injection of the lazy_load_test_config.json it will not undergo the lazy load process, used and will be used as the control case in this test. + + The app is initialized, request handlers are registered. + Upon registration of the app (app_state = registered) the client will request all three services offered by the service-sample. The on_availibity handler is the same for all 3 services. And tries to subscribe to both event of the 0x1234 0x5678 eventgroup 0x01 event 0x8001 and 0x8002 + + The first step of the test is to check that only the service 0x1234 instance 0x5678 becomes available to client-sample-normal + + The second step is to verify that only the notification from 0x8001 is received + + The third and final step is to send NUMBER_OF_MESSAGES_TO_SEND (32 as of writing this read me) messages to method 0x8421 and 0x888 of 0x1234 0x02 only responses from 0x8421 are expected. The tests expect to receive a total of NUMBER_OF_MESSAGES_TO_SEND + +Client-sample-lazy app + The client-sample-lazy app is brought up using the /vsomeip/ folder as its VSOMEIP_CONFIGURATION + Forcing it to parse the entire folder, and load the lazy_load_test_config.json + as well as the vsomeip_policy_extenions.json as well as execute the lazy loading of the vsomeip_security.json in the /vsomeip/vsomeip_ext/1_1/ folder + client-sample-lazy is the test case for lazy loading. + client-sample-lazy uses linux user-id uid: 1 and group-id gid: 1 + + The app is initialized, request handlers are registered. + Upon registration of the app (app_state = registered) the client will request all three services offered by the service-sample. The on_availibity handler is the same for all 3 services. And tries to subscribe to both event of the 0x1234 0x02 eventgroup 0x01 event 0x8001 and 0x8002 + + The first step of the test is to check that only the service 0x1234 instance 0x02 becomes available to client-sample-lazy + + The second step is to verify that only the notification from 0x8002 is received + + The third and final step is to send NUMBER_OF_MESSAGES_TO_SEND messages to method 0x8421 and 0x888 of 0x1234 0x02 only responses from 0x8421 are expected. The tests expect to receive a total of NUMBER_OF_MESSAGES_TO_SEND diff --git a/test/network_tests/malicious_data_tests/malicious_data_test_msg_sender.cpp b/test/network_tests/malicious_data_tests/malicious_data_test_msg_sender.cpp index 4c75e9f3f..f5f15927e 100644 --- a/test/network_tests/malicious_data_tests/malicious_data_test_msg_sender.cpp +++ b/test/network_tests/malicious_data_tests/malicious_data_test_msg_sender.cpp @@ -16,7 +16,7 @@ #include -#include "../../implementation/utility/include/byteorder.hpp" +#include "../../implementation/utility/include/bithelper.hpp" #include "../../implementation/message/include/deserializer.hpp" #include "../../implementation/service_discovery/include/service_discovery.hpp" #include "../../implementation/service_discovery/include/message_impl.hpp" @@ -84,10 +84,9 @@ TEST_F(malicious_data, send_malicious_events) #endif vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN], - receive_buffer[VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN], - receive_buffer[VSOMEIP_METHOD_POS_MAX]); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_METHOD_POS_MIN]); + if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) { vsomeip::sd::message_impl sd_msg; EXPECT_TRUE(sd_msg.deserialize(&its_deserializer)); @@ -313,10 +312,9 @@ TEST_F(malicious_data, send_wrong_protocol_version) return; } else { vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN], - receive_buffer[VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN], - receive_buffer[VSOMEIP_METHOD_POS_MAX]); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_METHOD_POS_MIN]); + if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) { vsomeip::sd::message_impl sd_msg; EXPECT_TRUE(sd_msg.deserialize(&its_deserializer)); @@ -700,10 +698,9 @@ TEST_F(malicious_data, send_wrong_message_type) return; } else { vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN], - receive_buffer[VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN], - receive_buffer[VSOMEIP_METHOD_POS_MAX]); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_METHOD_POS_MIN]); + if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) { vsomeip::sd::message_impl sd_msg; EXPECT_TRUE(sd_msg.deserialize(&its_deserializer)); @@ -999,10 +996,9 @@ TEST_F(malicious_data, send_wrong_return_code) return; } else { vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN], - receive_buffer[VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN], - receive_buffer[VSOMEIP_METHOD_POS_MAX]); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_METHOD_POS_MIN]); + if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) { vsomeip::sd::message_impl sd_msg; EXPECT_TRUE(sd_msg.deserialize(&its_deserializer)); @@ -1303,10 +1299,9 @@ TEST_F(malicious_data, wrong_header_fields_udp) return; } else { vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN], - receive_buffer[VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN], - receive_buffer[VSOMEIP_METHOD_POS_MAX]); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_METHOD_POS_MIN]); + if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) { vsomeip::sd::message_impl sd_msg; EXPECT_TRUE(sd_msg.deserialize(&its_deserializer)); diff --git a/test/network_tests/npdu_tests/npdu_test_client.cpp b/test/network_tests/npdu_tests/npdu_test_client.cpp index 08c6dbb41..cba54f281 100644 --- a/test/network_tests/npdu_tests/npdu_test_client.cpp +++ b/test/network_tests/npdu_tests/npdu_test_client.cpp @@ -2,6 +2,9 @@ // 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/. + +#include + #include "../npdu_tests/npdu_test_client.hpp" #include diff --git a/test/network_tests/npdu_tests/npdu_test_service.cpp b/test/network_tests/npdu_tests/npdu_test_service.cpp index 5fdc87dc4..3b13802a5 100644 --- a/test/network_tests/npdu_tests/npdu_test_service.cpp +++ b/test/network_tests/npdu_tests/npdu_test_service.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "../npdu_tests/npdu_test_service.hpp" #include "../npdu_tests/npdu_test_globals.hpp" diff --git a/test/network_tests/payload_tests/payload_test_client.cpp b/test/network_tests/payload_tests/payload_test_client.cpp index 3395668b7..ef5ba631f 100644 --- a/test/network_tests/payload_tests/payload_test_client.cpp +++ b/test/network_tests/payload_tests/payload_test_client.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "payload_test_client.hpp" enum class payloadsize diff --git a/test/network_tests/payload_tests/payload_test_service.cpp b/test/network_tests/payload_tests/payload_test_service.cpp index 0aa55afed..7d4c9243a 100644 --- a/test/network_tests/payload_tests/payload_test_service.cpp +++ b/test/network_tests/payload_tests/payload_test_service.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "payload_test_service.hpp" // this variables are changed via cmdline parameters diff --git a/test/network_tests/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp b/test/network_tests/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp index 47ac36261..ce05f66c3 100644 --- a/test/network_tests/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp +++ b/test/network_tests/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp @@ -16,7 +16,7 @@ #include -#include "../../implementation/utility/include/byteorder.hpp" +#include "../../implementation/utility/include/bithelper.hpp" #include "../../implementation/message/include/deserializer.hpp" #include "../../implementation/service_discovery/include/service_discovery.hpp" #include "../../implementation/service_discovery/include/message_impl.hpp" @@ -85,17 +85,13 @@ TEST_F(pending_subscription, send_multiple_subscriptions) std::uint32_t its_pos = 0; while (bytes_transferred > 0) { - const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG( - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE; + const std::uint32_t its_message_size = vsomeip::bithelper::read_uint32_be(&receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN]) + + VSOMEIP_SOMEIP_HEADER_SIZE; + vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN]); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN], - receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN], - receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]); its_pos += its_message_size; bytes_transferred -= its_message_size; @@ -278,17 +274,13 @@ TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe) std::uint32_t its_pos = 0; while (bytes_transferred > 0) { - const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG( - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE; + const std::uint32_t its_message_size = vsomeip::bithelper::read_uint32_be(&receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN]) + + VSOMEIP_SOMEIP_HEADER_SIZE; + vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN]); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN], - receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN], - receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]); its_pos += its_message_size; bytes_transferred -= its_message_size; @@ -486,16 +478,13 @@ TEST_F(pending_subscription, send_multiple_unsubscriptions) #endif std::uint32_t its_pos = 0; while (bytes_transferred > 0) { - const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG( - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE; + const std::uint32_t its_message_size = vsomeip::bithelper::read_uint32_be(&receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN]) + + VSOMEIP_SOMEIP_HEADER_SIZE; + vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN], - receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN], - receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN]); + its_pos += its_message_size; bytes_transferred -= its_message_size; @@ -693,17 +682,13 @@ TEST_F(pending_subscription, send_alternating_subscribe_nack_unsubscribe) #endif std::uint32_t its_pos = 0; while (bytes_transferred > 0) { - const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG( - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE; + const std::uint32_t its_message_size = vsomeip::bithelper::read_uint32_be(&receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN]) + + VSOMEIP_SOMEIP_HEADER_SIZE; + vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN]); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN], - receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN], - receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]); its_pos += its_message_size; bytes_transferred -= its_message_size; @@ -914,17 +899,13 @@ TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe_same_port) std::uint32_t its_pos = 0; while (bytes_transferred > 0) { - const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG( - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE; + const std::uint32_t its_message_size = vsomeip::bithelper::read_uint32_be(&receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN]) + + VSOMEIP_SOMEIP_HEADER_SIZE; + vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN]); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN], - receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN], - receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]); its_pos += its_message_size; bytes_transferred -= its_message_size; @@ -1125,17 +1106,12 @@ TEST_F(pending_subscription, subscribe_resubscribe_mixed) std::uint32_t its_pos = 0; while (bytes_transfered > 0) { - const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG( - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE; - vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); + const std::uint32_t its_message_size = vsomeip::bithelper::read_uint32_be(&receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN]) + + VSOMEIP_SOMEIP_HEADER_SIZE; - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN], - receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN], - receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]); + vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN]); its_pos += its_message_size; bytes_transfered -= its_message_size; @@ -1362,17 +1338,13 @@ TEST_F(pending_subscription, send_subscribe_stop_subscribe_subscribe) std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl; #endif - const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG( - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE; + const std::uint32_t its_message_size = vsomeip::bithelper::read_uint32_be(&receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN]) + + VSOMEIP_SOMEIP_HEADER_SIZE; + vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN]); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN], - receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN], - receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]); its_pos += its_message_size; bytes_transferred -= its_message_size; @@ -1560,17 +1532,13 @@ TEST_F(pending_subscription, send_request_to_sd_port) } else { std::uint32_t its_pos = 0; while (bytes_transferred > 0) { - const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG( - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE; + const std::uint32_t its_message_size = vsomeip::bithelper::read_uint32_be(&receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN]) + + VSOMEIP_SOMEIP_HEADER_SIZE; + vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN]); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN], - receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN], - receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]); its_pos += its_message_size; bytes_transferred -= its_message_size; diff --git a/test/network_tests/restart_routing_tests/restart_routing_test_client.cpp b/test/network_tests/restart_routing_tests/restart_routing_test_client.cpp index 847594eca..15be4a3b1 100644 --- a/test/network_tests/restart_routing_tests/restart_routing_test_client.cpp +++ b/test/network_tests/restart_routing_tests/restart_routing_test_client.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "restart_routing_test_client.hpp" routing_restart_test_client::routing_restart_test_client() diff --git a/test/network_tests/restart_routing_tests/restart_routing_test_service.cpp b/test/network_tests/restart_routing_tests/restart_routing_test_service.cpp index 92f0ff0a2..61bb615cf 100644 --- a/test/network_tests/restart_routing_tests/restart_routing_test_service.cpp +++ b/test/network_tests/restart_routing_tests/restart_routing_test_service.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "restart_routing_test_service.hpp" routing_restart_test_service::routing_restart_test_service() : diff --git a/test/network_tests/routing_tests/external_local_routing_test_service.cpp b/test/network_tests/routing_tests/external_local_routing_test_service.cpp index ba4cdd0c1..c90f17b12 100644 --- a/test/network_tests/routing_tests/external_local_routing_test_service.cpp +++ b/test/network_tests/routing_tests/external_local_routing_test_service.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "external_local_routing_test_service.hpp" external_local_routing_test_service::external_local_routing_test_service(bool _use_static_routing) : diff --git a/test/network_tests/routing_tests/local_routing_test_client.cpp b/test/network_tests/routing_tests/local_routing_test_client.cpp index 4bde183f4..f7f83c324 100644 --- a/test/network_tests/routing_tests/local_routing_test_client.cpp +++ b/test/network_tests/routing_tests/local_routing_test_client.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "local_routing_test_client.hpp" local_routing_test_client::local_routing_test_client(bool _use_tcp) : diff --git a/test/network_tests/routing_tests/local_routing_test_service.cpp b/test/network_tests/routing_tests/local_routing_test_service.cpp index 2a819e215..5d659e264 100644 --- a/test/network_tests/routing_tests/local_routing_test_service.cpp +++ b/test/network_tests/routing_tests/local_routing_test_service.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "local_routing_test_service.hpp" local_routing_test_service::local_routing_test_service(bool _use_static_routing) : diff --git a/test/network_tests/second_address_tests/second_address_test_service.cpp b/test/network_tests/second_address_tests/second_address_test_service.cpp index fc9d0a281..e6346b704 100644 --- a/test/network_tests/second_address_tests/second_address_test_service.cpp +++ b/test/network_tests/second_address_tests/second_address_test_service.cpp @@ -5,10 +5,11 @@ #include #include +#include #include +#include #include #include -#include #include #include diff --git a/test/network_tests/security_tests/security_test_client.cpp b/test/network_tests/security_tests/security_test_client.cpp index 2890e74bf..9c3c3dd63 100644 --- a/test/network_tests/security_tests/security_test_client.cpp +++ b/test/network_tests/security_tests/security_test_client.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "security_test_client.hpp" static bool is_remote_test = false; diff --git a/test/network_tests/security_tests/security_test_service.cpp b/test/network_tests/security_tests/security_test_service.cpp index fdfb48bee..7843504b8 100644 --- a/test/network_tests/security_tests/security_test_service.cpp +++ b/test/network_tests/security_tests/security_test_service.cpp @@ -3,6 +3,8 @@ // 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/. +#include + #include "security_test_service.hpp" static bool is_remote_test = false; diff --git a/test/network_tests/someip_tp_tests/conf/someip_tp_test_master.json.in b/test/network_tests/someip_tp_tests/conf/someip_tp_test_master.json.in index 6d20e54d0..b3f9ee436 100644 --- a/test/network_tests/someip_tp_tests/conf/someip_tp_test_master.json.in +++ b/test/network_tests/someip_tp_tests/conf/someip_tp_test_master.json.in @@ -25,7 +25,6 @@ { "service":"0x6767", "instance":"0x1", - "unicast" : "@TEST_IP_SLAVE@", "unreliable":"40001", "someip-tp" : { "client-to-service": [ "0x6767", "0x8001" ] diff --git a/test/network_tests/someip_tp_tests/someip_tp_test_msg_sender.cpp b/test/network_tests/someip_tp_tests/someip_tp_test_msg_sender.cpp index 3f79ce6ff..0c9c46a51 100644 --- a/test/network_tests/someip_tp_tests/someip_tp_test_msg_sender.cpp +++ b/test/network_tests/someip_tp_tests/someip_tp_test_msg_sender.cpp @@ -24,7 +24,7 @@ #include -#include "../../implementation/utility/include/byteorder.hpp" +#include "../../implementation/utility/include/bithelper.hpp" #include "../../implementation/message/include/deserializer.hpp" #include "../../implementation/message/include/serializer.hpp" #include "../../implementation/service_discovery/include/service_discovery.hpp" @@ -271,11 +271,7 @@ class someip_tp : public ::testing::TestWithParam { _seg->insert(_seg->begin() + VSOMEIP_TP_PAYLOAD_POS, _amount, 0xff); // decrease offset by amount - const vsomeip::tp::tp_header_t its_tp_header = VSOMEIP_BYTES_TO_LONG( - (*_seg)[VSOMEIP_TP_HEADER_POS_MIN], - (*_seg)[VSOMEIP_TP_HEADER_POS_MIN + 1], - (*_seg)[VSOMEIP_TP_HEADER_POS_MIN + 2], - (*_seg)[VSOMEIP_TP_HEADER_POS_MAX]); + const vsomeip::tp::tp_header_t its_tp_header = vsomeip::bithelper::read_uint32_be(&(*_seg)[VSOMEIP_TP_HEADER_POS_MIN]); std::uint32_t its_offset = vsomeip::tp::tp::get_offset(its_tp_header); its_offset -= _amount; const vsomeip::tp::tp_header_t its_new_tp_header = @@ -311,11 +307,7 @@ class someip_tp : public ::testing::TestWithParam { } _seg->erase(_seg->begin() + VSOMEIP_TP_PAYLOAD_POS, _seg->begin() + VSOMEIP_TP_PAYLOAD_POS + _amount); // increase offset by amount - const vsomeip::tp::tp_header_t its_tp_header = VSOMEIP_BYTES_TO_LONG( - (*_seg)[VSOMEIP_TP_HEADER_POS_MIN], - (*_seg)[VSOMEIP_TP_HEADER_POS_MIN + 1], - (*_seg)[VSOMEIP_TP_HEADER_POS_MIN + 2], - (*_seg)[VSOMEIP_TP_HEADER_POS_MAX]); + const vsomeip::tp::tp_header_t its_tp_header = vsomeip::bithelper::read_uint32_be(&(*_seg)[VSOMEIP_TP_HEADER_POS_MIN]); std::uint32_t its_offset = vsomeip::tp::tp::get_offset(its_tp_header); its_offset += _amount; const vsomeip::tp::tp_header_t its_new_tp_header = @@ -422,10 +414,9 @@ TEST_P(someip_tp, send_in_mode) return; } else { vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN], - receive_buffer[VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN], - receive_buffer[VSOMEIP_METHOD_POS_MAX]); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[VSOMEIP_METHOD_POS_MIN]); + if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) { vsomeip::sd::message_impl sd_msg; EXPECT_TRUE(sd_msg.deserialize(&its_deserializer)); @@ -540,18 +531,15 @@ TEST_P(someip_tp, send_in_mode) std::uint32_t its_pos = 0; while (bytes_transferred > 0) { - const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG( - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE; + const std::uint32_t its_message_size = vsomeip::bithelper::read_uint32_be( + &receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN]) + + VSOMEIP_SOMEIP_HEADER_SIZE; + std::cout << __LINE__ << ": received response " << its_message_size << std::endl; - vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN], - receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN], - receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]); + vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN]); vsomeip::message_impl msg; EXPECT_TRUE(msg.deserialize(&its_deserializer)); @@ -857,9 +845,7 @@ TEST_P(someip_tp, send_in_mode) EXPECT_EQ(someip_tp_test::number_of_fragments, fragments_event_from_master_.size()); // create complete message from event vsomeip::message_buffer_t its_event = create_full_message(fragments_event_from_master_); - vsomeip::session_t its_event_session = - VSOMEIP_BYTES_TO_WORD(its_event[VSOMEIP_SESSION_POS_MIN], - its_event[VSOMEIP_SESSION_POS_MAX]); + vsomeip::session_t its_event_session = vsomeip::bithelper::read_uint16_be(&its_event[VSOMEIP_SESSION_POS_MIN]); std::vector its_cmp_event_fragments; create_fragments(someip_tp_test::number_of_fragments, @@ -1095,12 +1081,9 @@ TEST_P(someip_tp, send_in_mode) someip_tp_test::number_of_fragments * someip_tp_test::max_segment_size, its_request.size()); } - const vsomeip::client_t its_request_client = - VSOMEIP_BYTES_TO_WORD(its_request[VSOMEIP_CLIENT_POS_MIN], - its_request[VSOMEIP_CLIENT_POS_MAX]); - const vsomeip::session_t its_request_session = - VSOMEIP_BYTES_TO_WORD(its_request[VSOMEIP_SESSION_POS_MIN], - its_request[VSOMEIP_SESSION_POS_MAX]); + const vsomeip::client_t its_request_client = vsomeip::bithelper::read_uint16_be(&its_request[VSOMEIP_CLIENT_POS_MIN]); + const vsomeip::session_t its_request_session = vsomeip::bithelper::read_uint16_be(&its_request[VSOMEIP_SESSION_POS_MIN]); + create_fragments(someip_tp_test::number_of_fragments, someip_tp_test::service_slave.service_id, someip_tp_test::service_slave.instance_id, @@ -1296,18 +1279,16 @@ TEST_P(someip_tp, send_in_mode) remote_client_request_port = its_remote_endpoint.port(); std::uint32_t its_pos = 0; while (bytes_transferred > 0) { - const std::uint32_t its_message_size = VSOMEIP_BYTES_TO_LONG( - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 1], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 2], - receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN + 3]) + VSOMEIP_SOMEIP_HEADER_SIZE; + const std::uint32_t its_message_size = vsomeip::bithelper::read_uint32_be( + &receive_buffer[its_pos + VSOMEIP_LENGTH_POS_MIN]) + + VSOMEIP_SOMEIP_HEADER_SIZE; + std::cout << __LINE__ << ": received request from master " << its_message_size << std::endl; + vsomeip::deserializer its_deserializer(&receive_buffer[its_pos], its_message_size, 0); + vsomeip::service_t its_service = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN]); + vsomeip::method_t its_method = vsomeip::bithelper::read_uint16_be(&receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN]); - vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MIN], - receive_buffer[its_pos + VSOMEIP_SERVICE_POS_MAX]); - vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[its_pos + VSOMEIP_METHOD_POS_MIN], - receive_buffer[its_pos + VSOMEIP_METHOD_POS_MAX]); EXPECT_EQ(someip_tp_test::service_slave.service_id, its_service); EXPECT_EQ(someip_tp_test::service_slave.method_id, its_method); vsomeip::message_impl msg; diff --git a/test/network_tests/suspend_resume_tests/suspend_resume_test_service.cpp b/test/network_tests/suspend_resume_tests/suspend_resume_test_service.cpp index 6f099ce7c..1f3c97cbd 100644 --- a/test/network_tests/suspend_resume_tests/suspend_resume_test_service.cpp +++ b/test/network_tests/suspend_resume_tests/suspend_resume_test_service.cpp @@ -3,10 +3,11 @@ // 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/. +#include #include +#include #include #include -#include #include diff --git a/test/unit_tests/utility_tests/ut_ByteOperation.cpp b/test/unit_tests/utility_tests/ut_ByteOperation.cpp new file mode 100644 index 000000000..5eee0d707 --- /dev/null +++ b/test/unit_tests/utility_tests/ut_ByteOperation.cpp @@ -0,0 +1,170 @@ +// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// 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/. + +#include + +#include "../../../implementation/utility/include/bithelper.hpp" + +#include + +TEST(byte_operations, MACRO_VSOMEIP_BYTES_TO_WORD) +{ + uint8_t payload[8] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18}; + + uint16_t its_service = vsomeip_v3::bithelper::read_uint16_be(payload+VSOMEIP_SERVICE_POS_MIN); + uint16_t its_method = vsomeip_v3::bithelper::read_uint16_be(payload+VSOMEIP_METHOD_POS_MIN); + + EXPECT_EQ(its_service, 0x1112); + EXPECT_EQ(its_method, 0x1314); +} + +TEST(byte_operations, MACRO_VSOMEIP_BYTES_TO_LONG) +{ + uint8_t payload[8] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18}; + + uint32_t its_data = vsomeip_v3::bithelper::read_uint32_be(payload+2); + EXPECT_EQ(its_data, 0x13141516); + + uint32_t its_data2 = vsomeip_v3::bithelper::read_uint32_le(payload+2); + EXPECT_EQ(its_data2, 0x16151413); +} + +TEST(byte_operations, MACRO_VSOMEIP_BYTES_TO_LONG_LONG) +{ + uint8_t payload[8] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18}; + + uint64_t its_data = vsomeip_v3::bithelper::read_uint64_be(payload); + EXPECT_EQ(its_data, 0x1112131415161718); +} + +TEST(byte_operations, MACRO_VSOMEIP_WORDS_TO_LONG) { + uint16_t serviceid = 0x1111; + uint16_t methodid = 0x2222; + + const uint8_t request_message[] = {static_cast((serviceid & 0xFF00) >> 8), + static_cast( serviceid & 0x00FF), + static_cast((methodid & 0xFF00) >> 8), + static_cast( methodid & 0x00FF)}; + uint32_t header_method = vsomeip_v3::bithelper::read_uint32_be(request_message); + + EXPECT_EQ(header_method, 0x11112222); +} + +TEST(byte_operations, MACRO_VSOMEIP_WORD_BYTEx) { + uint16_t clientid = 0x1234; + uint8_t client[sizeof(clientid)] = {0}; + + vsomeip_v3::bithelper::write_uint16_be(clientid, client); + EXPECT_EQ(client[0], 0x12); + EXPECT_EQ(client[1], 0x34); + + vsomeip_v3::bithelper::write_uint16_le(clientid, client); + EXPECT_EQ(client[0], 0x34); + EXPECT_EQ(client[1], 0x12); +} + +TEST(byte_operations, MACRO_VSOMEIP_LONG_BYTEx) { + uint32_t payload = 0x12345678; + uint8_t data[sizeof(payload)] = {0}; + + vsomeip_v3::bithelper::write_uint32_be(payload, data); + EXPECT_EQ(data[0], 0x12); + EXPECT_EQ(data[1], 0x34); + EXPECT_EQ(data[2], 0x56); + EXPECT_EQ(data[3], 0x78); + + vsomeip_v3::bithelper::write_uint32_le(payload, data); + EXPECT_EQ(data[0], 0x78); + EXPECT_EQ(data[1], 0x56); + EXPECT_EQ(data[2], 0x34); + EXPECT_EQ(data[3], 0x12); +} + +TEST(byte_operations, MACRO_VSOMEIP_LONG_LONG_BYTEx) { + uint64_t payload = 0x1214161821232527; + uint8_t data[sizeof(payload)] = {0}; + + vsomeip_v3::bithelper::write_uint64_be(payload, data); + EXPECT_EQ(data[0], 0x12); + EXPECT_EQ(data[1], 0x14); + EXPECT_EQ(data[2], 0x16); + EXPECT_EQ(data[3], 0x18); + EXPECT_EQ(data[4], 0x21); + EXPECT_EQ(data[5], 0x23); + EXPECT_EQ(data[6], 0x25); + EXPECT_EQ(data[7], 0x27); + + vsomeip_v3::bithelper::write_uint64_le(payload, data); + EXPECT_EQ(data[0], 0x27); + EXPECT_EQ(data[1], 0x25); + EXPECT_EQ(data[2], 0x23); + EXPECT_EQ(data[3], 0x21); + EXPECT_EQ(data[4], 0x18); + EXPECT_EQ(data[5], 0x16); + EXPECT_EQ(data[6], 0x14); + EXPECT_EQ(data[7], 0x12); + +} + +TEST(byte_operations, MACRO_VSOMEIP_LONG_WORDx) { + uint32_t payload = 0x12345678; + uint8_t data[sizeof(payload)] = {0}; + + vsomeip_v3::bithelper::write_uint32_le(payload, data); + EXPECT_EQ(data[0], 0x78); + EXPECT_EQ(data[1], 0x56); + EXPECT_EQ(data[2], 0x34); + EXPECT_EQ(data[3], 0x12); +} + +TEST(byte_operations, TestUint16) { + uint8_t input[] = {0xab, 0xcd}; + EXPECT_EQ(0xabcd, vsomeip_v3::bithelper::read_uint16_be(input)); + + uint8_t output[sizeof(input)] = {0}; + vsomeip_v3::bithelper::write_uint16_be(0x1234, output); + EXPECT_EQ(0x12, output[0]); + EXPECT_EQ(0x34, output[1]); +} + +TEST(byte_operations, TestUint32_BigEndian) { + uint8_t input[] = {0x12, 0x34, 0x56, 0x78}; + EXPECT_EQ(0x12345678U, vsomeip_v3::bithelper::read_uint32_be(input)); + + uint8_t output[sizeof(uint32_t)] = {0}; + vsomeip_v3::bithelper::write_uint32_be(0xabcd1234, output); + EXPECT_EQ(0xab, output[0]); + EXPECT_EQ(0xcd, output[1]); + EXPECT_EQ(0x12, output[2]); + EXPECT_EQ(0x34, output[3]); +} + +TEST(byte_operations, TestUint32_LittleEndian) { + uint8_t input[] = {0x12, 0x34, 0x56, 0x78}; + EXPECT_EQ(0x78563412U, vsomeip_v3::bithelper::read_uint32_le(input)); + + uint8_t output[sizeof(uint32_t)] = {0}; + vsomeip_v3::bithelper::write_uint32_le(0xabcd1234, output); + EXPECT_EQ(0xab, output[3]); + EXPECT_EQ(0xcd, output[2]); + EXPECT_EQ(0x12, output[1]); + EXPECT_EQ(0x34, output[0]); +} + +TEST(byte_operations, TestUint64) { + uint8_t input[] = {0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef}; + EXPECT_EQ(0x1234567890ABCDEFULL, vsomeip_v3::bithelper::read_uint64_be(input)); + + uint8_t output[sizeof(input)] = {0}; + vsomeip_v3::bithelper::write_uint64_be(0x1234567890ABCDEFULL, output); + EXPECT_EQ(0x12, output[0]); + EXPECT_EQ(0x34, output[1]); + EXPECT_EQ(0x56, output[2]); + EXPECT_EQ(0x78, output[3]); + EXPECT_EQ(0x90, output[4]); + EXPECT_EQ(0xab, output[5]); + EXPECT_EQ(0xcd, output[6]); + EXPECT_EQ(0xef, output[7]); +} diff --git a/tools/vsomeip_ctrl.cpp b/tools/vsomeip_ctrl.cpp index 3e74a8322..fd7cd4102 100644 --- a/tools/vsomeip_ctrl.cpp +++ b/tools/vsomeip_ctrl.cpp @@ -7,7 +7,7 @@ #include #include "../implementation/service_discovery/include/constants.hpp" -#include "../implementation/utility/include/byteorder.hpp" +#include "../implementation/utility/include/bithelper.hpp" #include #include @@ -45,16 +45,12 @@ class vsomeip_sender { "is 16 Bytes, exiting."; exit(EXIT_FAILURE); } - service_id_ = VSOMEIP_BYTES_TO_WORD(user_message_[VSOMEIP_SERVICE_POS_MIN], - user_message_[VSOMEIP_SERVICE_POS_MAX]); - method_id_ = VSOMEIP_BYTES_TO_WORD(user_message_[VSOMEIP_METHOD_POS_MIN], - user_message_[VSOMEIP_METHOD_POS_MAX]); - length_ = VSOMEIP_BYTES_TO_LONG(user_message_[VSOMEIP_LENGTH_POS_MIN], - user_message_[VSOMEIP_LENGTH_POS_MIN+1], - user_message_[VSOMEIP_LENGTH_POS_MIN+2], - user_message_[VSOMEIP_LENGTH_POS_MAX]); - client_id_ = VSOMEIP_BYTES_TO_WORD(user_message_[VSOMEIP_CLIENT_POS_MIN], - user_message_[VSOMEIP_CLIENT_POS_MAX]); + + service_id_ = vsomeip::bithelper::read_uint16_be(&user_message_[VSOMEIP_SERVICE_POS_MIN]); + method_id_ = vsomeip::bithelper::read_uint16_be(&user_message_[VSOMEIP_METHOD_POS_MIN]); + length_ = vsomeip::bithelper::read_uint16_be(&user_message_[VSOMEIP_LENGTH_POS_MIN]); + client_id_ = vsomeip::bithelper::read_uint16_be(&user_message_[VSOMEIP_CLIENT_POS_MIN]); + interface_version_ = user_message_[VSOMEIP_INTERFACE_VERSION_POS]; message_type_ = static_cast(user_message_[VSOMEIP_MESSAGE_TYPE_POS]); return_code_ = static_cast(user_message_[VSOMEIP_RETURN_CODE_POS]); @@ -421,7 +417,8 @@ int main(int argc, char** argv) { exit(EXIT_FAILURE); } } - instance = VSOMEIP_BYTES_TO_WORD(high, low); + uint8_t its_instance[2] = {high, low}; + instance = vsomeip::bithelper::read_uint16_be(its_instance); } }