summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Gehring <juergen.gehring@bmw.de>2018-05-22 02:54:41 -0700
committerJuergen Gehring <juergen.gehring@bmw.de>2018-05-22 02:54:41 -0700
commit3f591262507bbce2a57e182ef8a1c40951a31018 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904
parent4808f3130c97cea3f0168005b9df029282060539 (diff)
downloadvSomeIP-3f591262507bbce2a57e182ef8a1c40951a31018.tar.gz
vsomeip 2.10.11 2.10.12 2.10.13 2.10.14 2.10.15 2.10.16 2.10.17 2.10.18 2.10.19 2.10.20 2.10.21
-rw-r--r--AUTHORS1
-rw-r--r--CHANGES516
-rw-r--r--CMakeLists.txt489
-rw-r--r--LICENSE373
-rw-r--r--LICENSE_boost25
-rw-r--r--README.md81
-rw-r--r--config/vsomeip-local-security.json75
-rw-r--r--config/vsomeip-local-tcp-client.json84
-rw-r--r--config/vsomeip-local-tcp-service.json75
-rw-r--r--config/vsomeip-local-tracing.json86
-rw-r--r--config/vsomeip-local.json82
-rw-r--r--config/vsomeip-tcp-client-security.json74
-rw-r--r--config/vsomeip-tcp-client.json53
-rw-r--r--config/vsomeip-tcp-service-security.json88
-rw-r--r--config/vsomeip-tcp-service.json85
-rw-r--r--config/vsomeip-udp-client-security.json74
-rw-r--r--config/vsomeip-udp-client.json53
-rw-r--r--config/vsomeip-udp-service-security.json88
-rw-r--r--config/vsomeip-udp-service.json88
-rw-r--r--config/vsomeip.json55
-rw-r--r--daemon/CMakeLists.txt17
-rw-r--r--daemon/vsomeipd.cpp185
-rw-r--r--documentation/doxygen.in1814
-rw-r--r--documentation/multicast.txt6
-rw-r--r--documentation/todo.txt3
-rwxr-xr-xdocumentation/vsomeip.eapbin1705984 -> 0 bytes
-rw-r--r--documentation/vsomeipUserGuide1655
-rw-r--r--examples/CMakeLists.txt37
-rw-r--r--examples/hello_world/CMakeLists.txt27
-rw-r--r--examples/hello_world/hello_world_client.cpp161
-rw-r--r--examples/hello_world/hello_world_service.cpp155
-rw-r--r--examples/hello_world/helloworld-local.json36
-rw-r--r--examples/hello_world/readme48
-rw-r--r--examples/notify-sample.cpp260
-rw-r--r--examples/readme.txt17
-rw-r--r--examples/request-sample.cpp236
-rw-r--r--examples/response-sample.cpp187
-rw-r--r--examples/sample-ids.hpp23
-rw-r--r--examples/subscribe-sample.cpp189
-rw-r--r--exportmap.gcc47
-rw-r--r--implementation/configuration/include/client.hpp34
-rw-r--r--implementation/configuration/include/configuration.hpp176
-rw-r--r--implementation/configuration/include/configuration_impl.hpp406
-rw-r--r--implementation/configuration/include/debounce.hpp39
-rw-r--r--implementation/configuration/include/e2e.hpp69
-rw-r--r--implementation/configuration/include/event.hpp33
-rw-r--r--implementation/configuration/include/eventgroup.hpp29
-rw-r--r--implementation/configuration/include/internal.hpp.in185
-rw-r--r--implementation/configuration/include/policy.hpp34
-rw-r--r--implementation/configuration/include/service.hpp41
-rw-r--r--implementation/configuration/include/service_instance_range.hpp24
-rw-r--r--implementation/configuration/include/trace.hpp69
-rw-r--r--implementation/configuration/include/watchdog.hpp26
-rw-r--r--implementation/configuration/src/configuration_impl.cpp3158
-rw-r--r--implementation/e2e_protection/include/buffer/buffer.hpp48
-rw-r--r--implementation/e2e_protection/include/crc/crc.hpp32
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp38
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp56
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp46
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_custom/checker.hpp41
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp41
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_custom/protector.hpp38
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_interface/checker.hpp27
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_interface/profile_interface.hpp27
-rw-r--r--implementation/e2e_protection/include/e2e/profile/profile_interface/protector.hpp25
-rw-r--r--implementation/e2e_protection/include/e2exf/config.hpp28
-rw-r--r--implementation/e2e_protection/src/buffer/buffer.cpp22
-rw-r--r--implementation/e2e_protection/src/crc/crc.cpp182
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile01/checker.cpp42
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile01/profile_01.cpp110
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile01/protector.cpp79
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile_custom/checker.cpp49
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile_custom/profile_custom.cpp28
-rw-r--r--implementation/e2e_protection/src/e2e/profile/profile_custom/protector.cpp40
-rw-r--r--implementation/e2e_protection/src/e2exf/config.cpp16
-rw-r--r--implementation/endpoints/include/buffer.hpp22
-rw-r--r--implementation/endpoints/include/client_endpoint.hpp24
-rw-r--r--implementation/endpoints/include/client_endpoint_impl.hpp112
-rw-r--r--implementation/endpoints/include/credentials.hpp26
-rw-r--r--implementation/endpoints/include/endpoint.hpp61
-rw-r--r--implementation/endpoints/include/endpoint_definition.hpp56
-rw-r--r--implementation/endpoints/include/endpoint_host.hpp47
-rw-r--r--implementation/endpoints/include/endpoint_impl.hpp98
-rw-r--r--implementation/endpoints/include/local_client_endpoint_impl.hpp70
-rw-r--r--implementation/endpoints/include/local_server_endpoint_impl.hpp148
-rw-r--r--implementation/endpoints/include/netlink_connector.hpp187
-rw-r--r--implementation/endpoints/include/server_endpoint_impl.hpp84
-rw-r--r--implementation/endpoints/include/tcp_client_endpoint_impl.hpp87
-rw-r--r--implementation/endpoints/include/tcp_server_endpoint_impl.hpp147
-rw-r--r--implementation/endpoints/include/udp_client_endpoint_impl.hpp63
-rw-r--r--implementation/endpoints/include/udp_server_endpoint_impl.hpp85
-rw-r--r--implementation/endpoints/include/virtual_server_endpoint_impl.hpp68
-rw-r--r--implementation/endpoints/src/client_endpoint_impl.cpp435
-rw-r--r--implementation/endpoints/src/credentials.cpp109
-rw-r--r--implementation/endpoints/src/endpoint_definition.cpp80
-rw-r--r--implementation/endpoints/src/endpoint_impl.cpp153
-rw-r--r--implementation/endpoints/src/local_client_endpoint_impl.cpp292
-rw-r--r--implementation/endpoints/src/local_server_endpoint_impl.cpp692
-rw-r--r--implementation/endpoints/src/netlink_connector.cpp438
-rw-r--r--implementation/endpoints/src/server_endpoint_impl.cpp310
-rw-r--r--implementation/endpoints/src/tcp_client_endpoint_impl.cpp651
-rw-r--r--implementation/endpoints/src/tcp_server_endpoint_impl.cpp785
-rw-r--r--implementation/endpoints/src/udp_client_endpoint_impl.cpp290
-rw-r--r--implementation/endpoints/src/udp_server_endpoint_impl.cpp428
-rw-r--r--implementation/endpoints/src/virtual_server_endpoint_impl.cpp129
-rw-r--r--implementation/helper/boost/asio/basic_datagram_socket_ext.hpp954
-rw-r--r--implementation/helper/boost/asio/datagram_socket_service_ext.hpp437
-rw-r--r--implementation/helper/boost/asio/detail/handler_type_requirements_ext.hpp520
-rw-r--r--implementation/helper/boost/asio/detail/impl/reactive_socket_service_base_ext.ipp270
-rw-r--r--implementation/helper/boost/asio/detail/impl/socket_ops_ext.ipp210
-rw-r--r--implementation/helper/boost/asio/detail/reactive_socket_recv_op_ext.hpp126
-rw-r--r--implementation/helper/boost/asio/detail/reactive_socket_recvfrom_op_ext.hpp136
-rw-r--r--implementation/helper/boost/asio/detail/reactive_socket_recvmsg_op_ext.hpp128
-rw-r--r--implementation/helper/boost/asio/detail/reactive_socket_service_base_ext.hpp455
-rw-r--r--implementation/helper/boost/asio/detail/reactive_socket_service_ext.hpp462
-rw-r--r--implementation/helper/boost/asio/detail/reactor_op_ext.hpp42
-rw-r--r--implementation/helper/boost/asio/detail/socket_ops_ext.hpp62
-rw-r--r--implementation/helper/boost/asio/ip/udp_ext.hpp115
-rw-r--r--implementation/logging/include/defines.hpp15
-rw-r--r--implementation/logging/include/dlt_sink_backend.hpp46
-rw-r--r--implementation/logging/include/logger.hpp48
-rw-r--r--implementation/logging/include/logger_impl.hpp70
-rw-r--r--implementation/logging/src/dlt_sink_backend.cpp70
-rw-r--r--implementation/logging/src/logger.cpp14
-rw-r--r--implementation/logging/src/logger_impl.cpp190
-rw-r--r--implementation/message/include/deserializer.hpp67
-rw-r--r--implementation/message/include/message_base_impl.hpp77
-rw-r--r--implementation/message/include/message_header_impl.hpp47
-rw-r--r--implementation/message/include/message_impl.hpp50
-rw-r--r--implementation/message/include/payload_impl.hpp46
-rw-r--r--implementation/message/include/serializer.hpp50
-rw-r--r--implementation/message/src/deserializer.cpp224
-rw-r--r--implementation/message/src/message_base_impl.cpp131
-rw-r--r--implementation/message/src/message_header_impl.cpp80
-rw-r--r--implementation/message/src/message_impl.cpp50
-rw-r--r--implementation/message/src/payload_impl.cpp79
-rw-r--r--implementation/message/src/serializer.cpp122
-rw-r--r--implementation/plugin/include/plugin_manager.hpp55
-rw-r--r--implementation/plugin/src/plugin_manager.cpp210
-rw-r--r--implementation/routing/include/event.hpp163
-rw-r--r--implementation/routing/include/eventgroupinfo.hpp119
-rw-r--r--implementation/routing/include/routing_manager.hpp109
-rw-r--r--implementation/routing/include/routing_manager_adapter.hpp24
-rw-r--r--implementation/routing/include/routing_manager_base.hpp284
-rw-r--r--implementation/routing/include/routing_manager_host.hpp47
-rw-r--r--implementation/routing/include/routing_manager_impl.hpp469
-rw-r--r--implementation/routing/include/routing_manager_proxy.hpp250
-rw-r--r--implementation/routing/include/routing_manager_stub.hpp190
-rw-r--r--implementation/routing/include/routing_manager_stub_host.hpp98
-rw-r--r--implementation/routing/include/serviceinfo.hpp76
-rw-r--r--implementation/routing/include/types.hpp124
-rw-r--r--implementation/routing/src/event.cpp475
-rw-r--r--implementation/routing/src/eventgroupinfo.cpp352
-rw-r--r--implementation/routing/src/routing_manager_base.cpp1210
-rw-r--r--implementation/routing/src/routing_manager_impl.cpp4563
-rw-r--r--implementation/routing/src/routing_manager_proxy.cpp2067
-rw-r--r--implementation/routing/src/routing_manager_stub.cpp1856
-rw-r--r--implementation/routing/src/serviceinfo.cpp109
-rw-r--r--implementation/runtime/include/application_impl.hpp429
-rw-r--r--implementation/runtime/include/runtime_impl.hpp57
-rw-r--r--implementation/runtime/src/application_impl.cpp2280
-rw-r--r--implementation/runtime/src/error.cpp14
-rw-r--r--implementation/runtime/src/runtime.cpp24
-rw-r--r--implementation/runtime/src/runtime_impl.cpp131
-rw-r--r--implementation/service_discovery/include/configuration_option_impl.hpp46
-rw-r--r--implementation/service_discovery/include/constants.hpp37
-rw-r--r--implementation/service_discovery/include/defines.hpp49
-rwxr-xr-ximplementation/service_discovery/include/deserializer.hpp30
-rwxr-xr-ximplementation/service_discovery/include/entry_impl.hpp81
-rw-r--r--implementation/service_discovery/include/enumeration_types.hpp52
-rwxr-xr-ximplementation/service_discovery/include/eventgroupentry_impl.hpp68
-rw-r--r--implementation/service_discovery/include/ip_option_impl.hpp41
-rw-r--r--implementation/service_discovery/include/ipv4_option_impl.hpp36
-rw-r--r--implementation/service_discovery/include/ipv6_option_impl.hpp36
-rwxr-xr-ximplementation/service_discovery/include/load_balancing_option_impl.hpp38
-rwxr-xr-ximplementation/service_discovery/include/message_element_impl.hpp28
-rwxr-xr-ximplementation/service_discovery/include/message_impl.hpp122
-rw-r--r--implementation/service_discovery/include/option_impl.hpp44
-rw-r--r--implementation/service_discovery/include/primitive_types.hpp28
-rwxr-xr-ximplementation/service_discovery/include/protection_option_impl.hpp38
-rw-r--r--implementation/service_discovery/include/request.hpp46
-rw-r--r--implementation/service_discovery/include/runtime.hpp33
-rw-r--r--implementation/service_discovery/include/runtime_impl.hpp30
-rw-r--r--implementation/service_discovery/include/service_discovery.hpp77
-rw-r--r--implementation/service_discovery/include/service_discovery_host.hpp108
-rw-r--r--implementation/service_discovery/include/service_discovery_impl.hpp442
-rw-r--r--implementation/service_discovery/include/serviceentry_impl.hpp32
-rw-r--r--implementation/service_discovery/include/subscription.hpp67
-rwxr-xr-ximplementation/service_discovery/src/configuration_option_impl.cpp126
-rw-r--r--implementation/service_discovery/src/deserializer.cpp41
-rwxr-xr-ximplementation/service_discovery/src/entry_impl.cpp189
-rwxr-xr-ximplementation/service_discovery/src/eventgroupentry_impl.cpp242
-rw-r--r--implementation/service_discovery/src/ip_option_impl.cpp49
-rw-r--r--implementation/service_discovery/src/ipv4_option_impl.cpp75
-rwxr-xr-ximplementation/service_discovery/src/ipv6_option_impl.cpp75
-rwxr-xr-ximplementation/service_discovery/src/load_balancing_option_impl.cpp70
-rwxr-xr-ximplementation/service_discovery/src/message_element_impl.cpp24
-rwxr-xr-ximplementation/service_discovery/src/message_impl.cpp439
-rwxr-xr-ximplementation/service_discovery/src/option_impl.cpp68
-rwxr-xr-ximplementation/service_discovery/src/protection_option_impl.cpp70
-rw-r--r--implementation/service_discovery/src/request.cpp48
-rw-r--r--implementation/service_discovery/src/runtime_impl.cpp50
-rw-r--r--implementation/service_discovery/src/service_discovery_impl.cpp3650
-rwxr-xr-ximplementation/service_discovery/src/serviceentry_impl.cpp60
-rw-r--r--implementation/service_discovery/src/subscription.cpp83
-rw-r--r--implementation/tracing/include/defines.hpp13
-rw-r--r--implementation/tracing/include/enumeration_types.hpp26
-rw-r--r--implementation/tracing/include/trace_connector.hpp107
-rw-r--r--implementation/tracing/include/trace_header.hpp45
-rw-r--r--implementation/tracing/src/trace_connector.cpp381
-rw-r--r--implementation/tracing/src/trace_header.cpp71
-rw-r--r--implementation/utility/include/byteorder.hpp58
-rw-r--r--implementation/utility/include/criticalsection.hpp46
-rw-r--r--implementation/utility/include/utility.hpp137
-rw-r--r--implementation/utility/src/criticalsection.cpp41
-rw-r--r--implementation/utility/src/utility.cpp758
-rw-r--r--interface/vsomeip/application.hpp954
-rw-r--r--interface/vsomeip/constants.hpp61
-rw-r--r--interface/vsomeip/defines.hpp40
-rw-r--r--interface/vsomeip/enumeration_types.hpp74
-rw-r--r--interface/vsomeip/error.hpp26
-rw-r--r--interface/vsomeip/export.hpp30
-rw-r--r--interface/vsomeip/function_types.hpp22
-rw-r--r--interface/vsomeip/handler.hpp33
-rw-r--r--interface/vsomeip/internal/deserializable.hpp24
-rw-r--r--interface/vsomeip/internal/serializable.hpp30
-rw-r--r--interface/vsomeip/message.hpp52
-rw-r--r--interface/vsomeip/message_base.hpp212
-rw-r--r--interface/vsomeip/payload.hpp106
-rw-r--r--interface/vsomeip/plugin.hpp89
-rw-r--r--interface/vsomeip/plugins/application_plugin.hpp42
-rw-r--r--interface/vsomeip/plugins/pre_configuration_plugin.hpp29
-rw-r--r--interface/vsomeip/primitive_types.hpp49
-rw-r--r--interface/vsomeip/runtime.hpp216
-rw-r--r--interface/vsomeip/vsomeip.hpp20
-rw-r--r--test/CMakeLists.txt2832
-rw-r--r--test/application_tests/application_test.cpp454
-rw-r--r--test/application_tests/application_test_availability.cpp39
-rwxr-xr-xtest/application_tests/application_test_availability_starter.sh10
-rw-r--r--test/application_tests/application_test_client.cpp199
-rw-r--r--test/application_tests/application_test_client_availability.cpp203
-rw-r--r--test/application_tests/application_test_daemon.cpp42
-rw-r--r--test/application_tests/application_test_globals.hpp28
-rw-r--r--test/application_tests/application_test_service.cpp130
-rw-r--r--test/application_tests/application_test_single_process.cpp47
-rw-r--r--test/application_tests/application_test_single_process.json14
-rwxr-xr-xtest/application_tests/application_test_single_process_starter.sh23
-rwxr-xr-xtest/application_tests/application_test_starter.sh61
-rw-r--r--test/application_tests/conf/application_test.json.in38
-rw-r--r--test/application_tests/conf/application_test_daemon.json.in38
-rw-r--r--test/application_tests/conf/application_test_no_dispatch_threads.json.in37
-rw-r--r--test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in37
-rw-r--r--test/big_payload_tests/big_payload_test_client.cpp289
-rw-r--r--test/big_payload_tests/big_payload_test_client.hpp53
-rwxr-xr-xtest/big_payload_tests/big_payload_test_client_local_start.sh10
-rwxr-xr-xtest/big_payload_tests/big_payload_test_client_start.sh10
-rwxr-xr-xtest/big_payload_tests/big_payload_test_external_starter.sh85
-rw-r--r--test/big_payload_tests/big_payload_test_globals.hpp40
-rw-r--r--test/big_payload_tests/big_payload_test_local.json54
-rw-r--r--test/big_payload_tests/big_payload_test_local_limited.json42
-rw-r--r--test/big_payload_tests/big_payload_test_local_queue_limited.json42
-rw-r--r--test/big_payload_tests/big_payload_test_local_random.json44
-rwxr-xr-xtest/big_payload_tests/big_payload_test_local_starter.sh52
-rw-r--r--test/big_payload_tests/big_payload_test_service.cpp246
-rw-r--r--test/big_payload_tests/big_payload_test_service.hpp48
-rwxr-xr-xtest/big_payload_tests/big_payload_test_service_external_start.sh26
-rwxr-xr-xtest/big_payload_tests/big_payload_test_service_local_start.sh10
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_client.json.in43
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_client_limited_general.json.in31
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_general.json.in31
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_specific.json.in43
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_client_random.json.in32
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_service.json.in81
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_service_limited_general.json.in69
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_general.json.in87
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_specific.json.in99
-rw-r--r--test/big_payload_tests/conf/big_payload_test_tcp_service_random.json.in70
-rw-r--r--test/client_id_tests/client_id_test_globals.hpp33
-rwxr-xr-xtest/client_id_tests/client_id_test_master_starter.sh85
-rw-r--r--test/client_id_tests/client_id_test_service.cpp266
-rwxr-xr-xtest/client_id_tests/client_id_test_slave_starter.sh50
-rw-r--r--test/client_id_tests/client_id_test_utility.cpp474
-rw-r--r--test/client_id_tests/client_id_test_utility.json35
-rw-r--r--test/client_id_tests/client_id_test_utility_masked_127.json36
-rw-r--r--test/client_id_tests/client_id_test_utility_masked_4095.json36
-rw-r--r--test/client_id_tests/client_id_test_utility_masked_511.json36
-rw-r--r--test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_master.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_slave.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in70
-rw-r--r--test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in70
-rw-r--r--test/configuration_tests/configuration-test-deprecated.json366
-rw-r--r--test/configuration_tests/configuration-test.cpp626
-rw-r--r--test/configuration_tests/configuration-test.json336
-rw-r--r--test/cpu_load_tests/conf/cpu_load_test_client_master.json.in32
-rw-r--r--test/cpu_load_tests/conf/cpu_load_test_client_slave.json.in32
-rw-r--r--test/cpu_load_tests/conf/cpu_load_test_service_master.json.in46
-rw-r--r--test/cpu_load_tests/conf/cpu_load_test_service_slave.json.in46
-rw-r--r--test/cpu_load_tests/cpu_load_measurer.cpp158
-rw-r--r--test/cpu_load_tests/cpu_load_measurer.hpp35
-rw-r--r--test/cpu_load_tests/cpu_load_test_client.cpp390
-rw-r--r--test/cpu_load_tests/cpu_load_test_globals.hpp18
-rwxr-xr-xtest/cpu_load_tests/cpu_load_test_master_starter.sh80
-rw-r--r--test/cpu_load_tests/cpu_load_test_service.cpp208
-rwxr-xr-xtest/cpu_load_tests/cpu_load_test_slave_starter.sh52
-rw-r--r--test/header_factory_tests/header_factory_test.cpp119
-rw-r--r--test/header_factory_tests/header_factory_test_client.cpp171
-rw-r--r--test/header_factory_tests/header_factory_test_client.hpp50
-rw-r--r--test/header_factory_tests/header_factory_test_client.json97
-rwxr-xr-xtest/header_factory_tests/header_factory_test_client_start.sh8
-rwxr-xr-xtest/header_factory_tests/header_factory_test_send_receive_starter.sh39
-rw-r--r--test/header_factory_tests/header_factory_test_service.cpp170
-rw-r--r--test/header_factory_tests/header_factory_test_service.hpp45
-rw-r--r--test/header_factory_tests/header_factory_test_service.json105
-rwxr-xr-xtest/header_factory_tests/header_factory_test_service_start.sh9
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in81
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in165
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in81
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in82
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in82
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json.in166
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in81
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in82
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in81
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in165
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in82
-rw-r--r--test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_tcp.json.in166
-rw-r--r--test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in81
-rw-r--r--test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in82
-rw-r--r--test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in81
-rw-r--r--test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in82
-rw-r--r--test/initial_event_tests/initial_event_test_availability_checker.cpp164
-rw-r--r--test/initial_event_tests/initial_event_test_client.cpp457
-rw-r--r--test/initial_event_tests/initial_event_test_globals.hpp51
-rwxr-xr-xtest/initial_event_tests/initial_event_test_master_starter.sh161
-rw-r--r--test/initial_event_tests/initial_event_test_service.cpp150
-rwxr-xr-xtest/initial_event_tests/initial_event_test_slave_starter.sh121
-rw-r--r--test/initial_event_tests/initial_event_test_stop_service.cpp274
-rw-r--r--test/magic_cookies_tests/conf/magic_cookies_test_client.json.in85
-rw-r--r--test/magic_cookies_tests/conf/magic_cookies_test_service.json.in88
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_client.cpp248
-rwxr-xr-xtest/magic_cookies_tests/magic_cookies_test_client_start.sh9
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_service.cpp168
-rwxr-xr-xtest/magic_cookies_tests/magic_cookies_test_service_start.sh9
-rwxr-xr-xtest/magic_cookies_tests/magic_cookies_test_starter.sh59
-rw-r--r--test/malicious_data_tests/conf/malicious_data_test_master.json.in44
-rwxr-xr-xtest/malicious_data_tests/conf/malicious_data_test_master_starter.sh.in66
-rw-r--r--test/malicious_data_tests/malicious_data_test_globals.hpp32
-rw-r--r--test/malicious_data_tests/malicious_data_test_msg_sender.cpp283
-rw-r--r--test/malicious_data_tests/malicious_data_test_service.cpp170
-rw-r--r--test/offer_tests/conf/offer_test_big_sd_msg_master.json.in31
-rwxr-xr-xtest/offer_tests/conf/offer_test_big_sd_msg_master_starter.sh.in82
-rw-r--r--test/offer_tests/conf/offer_test_big_sd_msg_slave.json.in334
-rw-r--r--test/offer_tests/conf/offer_test_external_master.json.in36
-rwxr-xr-xtest/offer_tests/conf/offer_test_external_master_starter.sh.in164
-rw-r--r--test/offer_tests/conf/offer_test_external_slave.json.in36
-rw-r--r--test/offer_tests/offer_test_big_sd_msg_client.cpp235
-rw-r--r--test/offer_tests/offer_test_big_sd_msg_service.cpp131
-rwxr-xr-xtest/offer_tests/offer_test_big_sd_msg_slave_starter.sh45
-rw-r--r--test/offer_tests/offer_test_client.cpp285
-rw-r--r--test/offer_tests/offer_test_external_sd_msg_sender.cpp74
-rwxr-xr-xtest/offer_tests/offer_test_external_slave_starter.sh45
-rw-r--r--test/offer_tests/offer_test_globals.hpp29
-rw-r--r--test/offer_tests/offer_test_local.json20
-rwxr-xr-xtest/offer_tests/offer_test_local_starter.sh298
-rw-r--r--test/offer_tests/offer_test_service.cpp169
-rw-r--r--test/offer_tests/offer_test_service_external.cpp155
-rw-r--r--test/offered_services_info_test/offered_services_info_test_client.cpp332
-rw-r--r--test/offered_services_info_test/offered_services_info_test_globals.hpp29
-rw-r--r--test/offered_services_info_test/offered_services_info_test_local.json57
-rwxr-xr-xtest/offered_services_info_test/offered_services_info_test_local_starter.sh58
-rw-r--r--test/offered_services_info_test/offered_services_info_test_service.cpp260
-rw-r--r--test/payload_tests/conf/external_local_payload_test_client_external.json.in48
-rw-r--r--test/payload_tests/conf/external_local_payload_test_client_local.json.in49
-rw-r--r--test/payload_tests/conf/external_local_payload_test_service.json.in46
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_external_start.sh13
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_external_starter.sh126
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_local_and_external_starter.sh144
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_local_start.sh9
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_local_starter.sh91
-rwxr-xr-xtest/payload_tests/external_local_payload_test_service_client_external_start.sh12
-rwxr-xr-xtest/payload_tests/external_local_payload_test_service_start.sh9
-rw-r--r--test/payload_tests/local_payload_test_client.json36
-rwxr-xr-xtest/payload_tests/local_payload_test_client_start.sh9
-rwxr-xr-xtest/payload_tests/local_payload_test_huge_payload_starter.sh43
-rw-r--r--test/payload_tests/local_payload_test_service.json40
-rwxr-xr-xtest/payload_tests/local_payload_test_service_start.sh9
-rwxr-xr-xtest/payload_tests/local_payload_test_starter.sh69
-rw-r--r--test/payload_tests/payload_test_client.cpp415
-rw-r--r--test/payload_tests/payload_test_client.hpp71
-rw-r--r--test/payload_tests/payload_test_service.cpp186
-rw-r--r--test/payload_tests/payload_test_service.hpp47
-rw-r--r--test/payload_tests/stopwatch.cpp38
-rw-r--r--test/payload_tests/stopwatch.hpp58
-rw-r--r--test/pending_subscription_tests/conf/pending_subscription_test_master.json.in44
-rwxr-xr-xtest/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in75
-rw-r--r--test/pending_subscription_tests/pending_subscription_test_globals.hpp32
-rw-r--r--test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp826
-rw-r--r--test/pending_subscription_tests/pending_subscription_test_service.cpp311
-rw-r--r--test/readme.txt522
-rw-r--r--test/restart_routing_tests/restart_routing_test_autoconfig.json24
-rw-r--r--test/restart_routing_tests/restart_routing_test_client.cpp158
-rw-r--r--test/restart_routing_tests/restart_routing_test_client.hpp50
-rw-r--r--test/restart_routing_tests/restart_routing_test_client.json48
-rwxr-xr-xtest/restart_routing_tests/restart_routing_test_client_start.sh9
-rw-r--r--test/restart_routing_tests/restart_routing_test_service.cpp133
-rw-r--r--test/restart_routing_tests/restart_routing_test_service.hpp44
-rw-r--r--test/restart_routing_tests/restart_routing_test_service.json44
-rwxr-xr-xtest/restart_routing_tests/restart_routing_test_service_start.sh9
-rwxr-xr-xtest/restart_routing_tests/restart_routing_test_starter.sh312
-rw-r--r--test/routing_tests/conf/external_local_routing_test_client_external.json.in44
-rw-r--r--test/routing_tests/conf/external_local_routing_test_service.json.in42
-rwxr-xr-xtest/routing_tests/conf/local_routing_test_starter.sh.bat.in69
-rwxr-xr-xtest/routing_tests/conf/local_routing_test_starter.sh.in79
-rwxr-xr-xtest/routing_tests/external_local_routing_test_client_external_start.sh9
-rw-r--r--test/routing_tests/external_local_routing_test_service.cpp185
-rw-r--r--test/routing_tests/external_local_routing_test_service.hpp46
-rwxr-xr-xtest/routing_tests/external_local_routing_test_service_start.sh9
-rwxr-xr-xtest/routing_tests/external_local_routing_test_starter.sh126
-rw-r--r--test/routing_tests/local_routing_test_client.cpp168
-rw-r--r--test/routing_tests/local_routing_test_client.hpp49
-rw-r--r--test/routing_tests/local_routing_test_client.json38
-rwxr-xr-xtest/routing_tests/local_routing_test_client_start.sh9
-rw-r--r--test/routing_tests/local_routing_test_service.cpp164
-rw-r--r--test/routing_tests/local_routing_test_service.hpp45
-rw-r--r--test/routing_tests/local_routing_test_service.json41
-rwxr-xr-xtest/routing_tests/local_routing_test_service_start.sh9
-rw-r--r--test/security_tests/conf/security_test_config.json.in71
-rw-r--r--test/security_tests/security_test_client.cpp158
-rw-r--r--test/security_tests/security_test_client.hpp50
-rwxr-xr-xtest/security_tests/security_test_client_start.sh9
-rw-r--r--test/security_tests/security_test_service.cpp133
-rw-r--r--test/security_tests/security_test_service.hpp44
-rwxr-xr-xtest/security_tests/security_test_start.sh15
-rw-r--r--test/someip_test_globals.hpp44
-rw-r--r--test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in80
-rw-r--r--test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in104
-rw-r--r--test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in80
-rw-r--r--test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in104
-rw-r--r--test/subscribe_notify_one_tests/subscribe_notify_one_test_globals.hpp35
-rwxr-xr-xtest/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh106
-rw-r--r--test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp512
-rwxr-xr-xtest/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh72
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in60
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in60
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in100
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json.in100
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in100
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json.in100
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_master.json.in31
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json.in39
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json.in39
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in76
-rw-r--r--test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in76
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_globals.hpp55
-rwxr-xr-xtest/subscribe_notify_tests/subscribe_notify_test_master_starter.sh111
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp380
-rwxr-xr-xtest/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_starter.sh88
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_service.cpp212
-rwxr-xr-xtest/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh45
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_service.cpp520
-rwxr-xr-xtest/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh73
-rw-r--r--tools/CMakeLists.txt18
-rw-r--r--tools/vsomeip_ctrl.cpp442
-rw-r--r--vsomeip.pc.in11
-rw-r--r--vsomeip.xml167
-rw-r--r--vsomeipConfig.cmake.in15
-rw-r--r--vsomeipConfigVersion.cmake.in11
483 files changed, 0 insertions, 79790 deletions
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index 632e479..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1 +0,0 @@
-Bayerische Motoren Werke Aktiengesellschaft (BMW AG) \ No newline at end of file
diff --git a/CHANGES b/CHANGES
deleted file mode 100644
index 26f1445..0000000
--- a/CHANGES
+++ /dev/null
@@ -1,516 +0,0 @@
-Changes
-=======
-v2.10.10
-- Fix concurrency issue leading to a crash
-
-v2.10.9
-- Improve handling of service discovery messages with entries
- referencing too many options.
-- Prevent sending of duplicate remote subscriptions to local clients
- if the local client processes incoming subscriptions too slow.
-- Remote (un)subscriptions to the same eventgroup are now queued in
- the routing manager until the local client has processed the
- previous (un)subscription for this eventgroup.
-- Introduce new json configuration parameter 'diagnosis_mask' to
- control the number of bits in the client ID used for the diagnosis
- address. This can be used to enable more than 254 concurrent clients
- on a node. For more information see the vsomeipUserGuide.
-- If the service discovery is enabled it is is only started if a
- matching multicast route for the configured service discovery
- multicast group is present in the system. This applies only to
- Linux.
-- Rework security configuration:
- - Allow policy specifications without client specification.
- - Allow policies to be specified for ranges of uids/gids.
- For more information see the vsomeipUserGuide.
-
-v2.10.8
-- Change dispatching of availability states in case an availability
- handler of a service instance is blocked in user code: Availability
- states of a service instance are now never dispatched parallel. The
- next availability state for a service instance is only dispatched
- after the blocked availability handler returned from user code. If
- the availability of the service instance changes in the meantime,
- subsequent incoming messages of the service instance are queued
- until the availability change was reported to the user code.
-- Subscriptions to remotely offered services are now always done based
- on the protocol(s) the remote service is offered with. The
- subscription_type parameter of the application::subscribe method is
- ignored.
-- Added wildcard support ("any") for the uid and gid json parameters
- in the security configuration.
-- Fix possible deadlock on application shutdown
-
-v2.10.7
-- Fix potential deadlock when expiring remote subscriptions
-- Rework restarting of tcp client endpoints to prevent heap corruption
- under high load situations
-
-v2.10.6
-- Fix concurrency issue leading to a crash when asynchronous
- subscription handlers were used.
-- Improved packing of subscriptions sent out as answer to incoming
- offer service messages.
-
-v2.10.5
-- Fix possible deadlock on application shutdown
-- Try to reestablish TCP connection on resubscription if the remote
- closed the connection
-- Introduce new configuration file parameters to control
- interpretation of TTL field of incoming remote offers and
- subscriptions:
- - service-discovery > ttl_factor_offers (optional array of
- service/instance/TTL factor tuples)
- - service-discovery > ttl_factor_subscriptions (optional array of
- service/instance/TTL factor tuples)
-- Added possibility to debounce external events/fields
- based on time or change of data in the payload (maskable) via new
- configuration file parameter:
- - debounce (optional array)
- For more information see the vsomeipUserGuide.
-- Added possibility to limit amount of memory used to cache outgoing
- messages on IP port basis or globally via configuration file
- parameter:
- - endpoint-queue-limits (array): to limit on IP:Port (endpoint)
- level
- - endpoint-queue-limit-external: to generally limit all external
- endpoints.
- - endpoint-queue-limit-local: to limit queue sizes for local
- communication
- For more information see the vsomeipUserGuide.
-
-
-v2.10.4
-- Extended diagnosis plugin to handle requests for
- "disableRxAndEnableTx" and "disableRxAndTx".
-- Catch unhandled user code exceptions thrown from called handlers.
-- Don't send SubscribeEventGroupNACK for pending subscriptions on next
- offer to reduce the amount of StopSubscribe/Subscribe messages.
-- Added possibility to apply filter for client side logging
- using VSOMEIP_CLIENTSIDELOGGING environment variable.
-
-v2.10.3
-- Interpret all incoming TTLs five times longer in service discovery
- to prevent inadvertent expiration of remote offers during high load
- situations.
-
-v2.10.2
-- Fix deadlock in routing manager when processing subscription
- acknowledgment from a local client if the corresponding service
- instance was stopped in the meanwhile.
-- Introduce status_log_interval and memory_log_interval json file
- parameters which can be used to cyclically log memory consumption
- and/or internal status of the routing manager in a given interval
-- Add Debug Diagnosis Job plug-in
-- Support definition of multiple client port ranges in configuration
-
-v2.10.1
-- Fix possible memory corruption in routing manager on TCP connection
- reset
-
-v2.10.0
-- Add register_async_subscription_handler to application interface
-- Ensure faster stopping of UDP and TCP endpoints
-- StopSubscribe eventgroup entries of StopSubscribe/Subscribe
- eventgroup entry sequences in incoming SD messages are now
- completely handled in the service discovery module
-
-v2.9.5
-- Change magic cookie behaviour to only send a magic cookie every 10
- seconds instead of in front of every SOME/IP message
-- Fixed bug which prevented resubscription after resuming from
- suspended state
-
-v2.9.4
-- Fixed deadlock on suspend to RAM / resume, triggered
- by signal handler.
-
-v2.9.3
-- Fixed race condition on application shutdown
-- Fixed bug that application object was not destroyed
-- Enabled client side logging of received messages
- to DLT if environment variable VSOMEIP_CLIENTSIDELOGGING
- is set to empty string or another arbitrary value.
-- Ensure that the correct source port is used for sending events
-
-v2.9.2
-- fix handling of received response messages for unknown
- clients.
-- Ensure that all external services are marked as offline when
- routing_state is set to RS_SUSPENDED
-- Ensure to start sending out FindService messages for requested
- services after resuming.
-- Ensure that the service info is also deleted if no unreliable
- communication happened before the service TTL has expired.
-
-v2.9.1
-- Don't ignore service requests for UDP-only remote services done
- before corresponding OfferService message was received.
-- Ensure that main dispatcher thread waits until newly started
- dispatcher threads are finished with their call into the user code
- before starting to dispatch again after a blocking call occurred.
-
-v2.9.0
-- Added get_offered_services_async method to application interface to
- read the currently offered services
-- Added set_watchdog_handler method to application interface which can
- be used to register a handler invoked in a given interval.
-- Optimize processing time of incoming service discovery messages
-- Events are now sent based on their configuration in the json file
-- If a remote service is offered reliable and unreliable subscriptions
- are now done always with both endpoint options.
-- Incoming subscriptions are now not acknowledged if not all events of
- the eventgroup can be served with the given endpoint options.
-
-v2.8.1
-- Support negative filter in trace connector
-
-v2.8.0
-- Change behaviour of register_subscription_status_handler method of
- the application interface: Registered handlers will only be called
- if the subscription was accepted by the remote side.
-- Add 2nd register_subscription_status_handler method to application
- interface with additional flag to enable calling of the registered
- handler if the subscription is rejected by the remote side.
-
-v.2.7.3
-- Fix deadlock when stopping client endpoints to remote services
-- Fix deadlock during construction of Subscribe Eventgroup entries
-
-v.2.7.2
-- Avoid deadlock when printing error message about too large messages
-
-v2.7.1
-- Prevent processing of too short messages received via UDP
-- Avoid catching SIGABRT in vsomeipd
-- Prevent duplicate logging of remote messages
-- Log message cleanup/enhancement
-
-v2.7.0
-- Add possibility to register a subscription status handler via
- application interface. The handler will be called if a subscription
- is acknowledged / not acknowledged by the application hosting the
- target service instance of the subscription
-- The default subscription type of application::subscribe method was
- changed from RELIABLE_AND_UNRELIABLE to PREFER_RELIABLE to harmonize
- initial event behaviour
-- Add generic plug-in concept
-- Fix bug which caused sending out subscription messages containing
- endpoint options with port set to zero
-- Make magic cookie detection TCP connection based
-- Avoid sending unneeded SIGKILLs to current routing manager
-- Forward service's instance IDs to DLT
-- Fixed performance loss on "client ID" lookup needed for ingoing
- remote subscriptions
-- Add signal handling for starting stopping the service discovery to
- vsomeipd
-- The message object can now be asked for CRC check state:
- is_valid_crc()
-- Incoming remote responses where the CRC check fails will trigger:
- set_is_valid_crc(false)
-
-v2.6.4
-- Fix bug in reboot detection of other nodes
-- Improve restarting of TCP connections
-
-v2.6.3
-- Improve reboot detection of other nodes
-- Introduce 'max-payload-size-reliable' json file parameter which can be used to
- globally limit the maximum allowed payload size for TCP communication
-- Added CRC checksum calculation for bit optimized messages
-
-v2.6.2
-- Service-Disovery performance improvements
-- Made Routing Manager restartable
-- Fixed file handle leak caused by remote ECU reboot
-- Activate TCP-Keep-Alive for TCP endpoints
-- Debouncing of request-service messages (routing info performance)
-- Fixed false session-id handling of identification request
-
-v2.6.1
-- Fixed clearing of subscribers on stop offer service
-
-v2.6.0
-- Fixed races and crashes
-- Fixed repetition phase timings for find service messages
-- Reworked internal event/field distribution to reduce CPU load
-- Reworked internal routing info distribution leading to fewer and smaller
- messages and lower CPU load
-- Extend public application interface with second unsubscribe method with
- additional event parameter
-
-v2.5.3
-- Fixed races and crashes
-- The minor version of a service instance is considered again when reporting the
- service instance's availability (this was removed with v2.4.2). If the minor
- version should not be considered use ANY_MINOR or DEFAULT_MINOR when
- registering availability handlers.
-- Fixed initial events on unsubscription
-- Improved dispatcher handling for blocking calls
-- Crashed applications are now automatically unsubscribed
-
-v2.5.2
-- Fixed deadlock and crashes
-- Prevent race of initial attributes
-- Allow incomplete application configurations
-- Unit test timeouts increased to avoid failures on (slow) build servers
-
-v2.5.1
-- Removed payload size limit. By default messages with an arbitrary length can
- now be sent locally and via TCP. The payload-sizes configuration file array is
- now used to limit the payload size for the specified endpoints instead of
- increasing it. There are two new configuration file parameters:
- - max-payload-size-local: limit maximum allowed payload size for node internal
- communication.
- - buffer-shrink-threshold: variable to control buffer memory deallocation
- after big messages have been processed. For more information see the
- vsomeipUserGuide.
-- Fixed cleanup of endpoints for subscriptions using an exclusive proxy
- (selective) which unnecessarily increased the number of open file descriptors.
-- Fixed assignment of predefined application IDs via autoconfiguration.
-- Decouple start of routing manager from network availability.
-- Made number of internal threads per application configurable.
-- Postpone notify_one events sent from subscription handler to ensure correct
- message order on receiver side.
-
-v2.5.0
-- Added notify-/notify_one-methods to enable flush control for notifications.
-- Restructured configuration to be a separate module (preparation to enable
- the usage of compiled configurations to speed-up startup)
-- Added vSomeIP-Security: Socket authentication based on Linux-credentials
- together with further security checks using configurable policies.
-- Fixed pending subscriptions had not sent out if subscribing application
- hosts the routing manager.
-- Fixed crash in vsomeipd due to concurrent access when closing/shutdown socket.
-- The service discovery now debounces newly offered service instances to avoid
- sending out the offers of the same service instance with a too high frequency.
- The default debounce time is set to 500ms. It can be changed via the new json
- file parameter service-discovery/offer_debounce_time.
-
-v2.4.3
-- Fix receiving of UDP frames containing multiple SOME/IP messages via UDP from
- external service instances
-
-v2.4.2
-- TCP connections for services no longer requested aren't reestablished anymore
-- The minor version of a service instance is no longer considered when reporting
- the service instance's availability
-- Introduce new internal_services json file parameter to define the internal
- service instances. This parameter can be used to control the sending behaviour
- for find service entries
-- Fixed event processing if service and client shared the same application
-- Incoming find service entries with unicast flag set to 0 are now replied with
- a unicast offer service message instead of a multicast offer service message.
-- application::stop() now blocks until the shutdown has finished completely
-
-v2.4.1
-- Extended number of endpoints that can be referenced from entries array in
- service discovery messages
-- Remove DLT contexts on application shutdown
-- Avoid initialization of vsomeip-applications if the maximum number of
- applications (client identifiers) has been reached
-- Prevent sending of OfferService entry as a reply to FindService message for
- internal services
-- Fixed deregistration of vsomeip-applications that became unresponsive
-- Fixed loop in endpoints causing high load during shutdown of vsomeip
- applications
-- Fixed loop in endpoints causing temporary high load if other devices become
- unavailable without deregistering
-
-v2.4.0
-- Disabled tracing SOME/IP-SD messages by default. Set "tracing/sd_enable"
- switch to "true" to enable it.
-- Trace notification events once instead of per target.
-
-v2.3.5
-- Fix TTL in Subscribe Eventgroup Entries
-
-v2.3.4
-- Exhaust client id range before reuse
-- Provide public interface to ask for available instances
-
-v2.3.3
-- Added -q/--quiet switch to the daemon to allow it to be started without
- DLT logging
-- Fix event caching in routing manager
-
-v2.3.2
-- Fix client deregistration during the client registration
-- Fix handling of pending commands during registration
-
-v2.3.1
-- Fix shutdown crashes (logger & application shutdown)
-- Fix race condition in client identifier configuration
-- Fix vsomeipd crash
-- Fixed handling of notifications (compliance)
-
-v2.3.0
-- Extend the API to force field notifications
-- Implemented cyclic updated for events/fields
-- Implemented epsilon updates (the used can provide a function to decide
- whether or not a value update shall be considered as a change)
-- Fixed lifecycle: Wait acknowledge of de/register application
-- Periodically log version information
-- Avoid (shadow) event registrations for services only offered locally
-- Fixed determination of routing manager host in case auto-configuration
- fails
-- Removed initial flag from internal message format
-- Fixed calling of registered message handlers for cases where wildcards
- were used during registration.
-- Fixed availability reporting of reliable (TCP) remote services offered
- on the same port
-
-v2.2.4
-- Set default log level to DEBUG
-- Improved segmentation of service discovery messages
-- Fixed a race condition during subscriptions
-
-v2.2.3
-- Ensure service discovery messages to not exceed maximum packet size
-
-v2.2.2
-- Ensure multicast messages are sent by the network adapter that is configured
- to be used for unicasts instead of relying on the configured routes
-
-v2.2.1
-- Backward compatibility fixes
-
-v2.2.0
-- Implemented Peer-to-Peer data exchange for notifications
-- Fixed handling of minor version during service discovery
-- Made initialization of application objects reentrant
-- Routing manager proxies now reconnect to the routing manager if the
- connection got lost
-- Auto-configuration supports multiple (different) configuration files
-- The opening of TCP connections is no longer done without an explicit request
-- Request No Respose messages are no longer answered in case of errors
-- Notifications over IP were fixed
-
-v2.1.2
-- Ensure correct message order
-
-v2.1.1
-- Ensure SD FindService-messages are sent after client re-registration
-- Corrected configuration of MagicCookies
-- Make client ports configurable
-- Implemented FindService message optimization
-- Extended configuration consistency checks
-
-v2.1.0
-- Avoid duplicate notifications if a selective event is in more than one
- eventgroup
-- Ensure SD messages are sent from the SD port
-- Ignore SD messages with wrong message identifier
-- Accept unreliable subscription for eventgroups without configured multicast
- address
-- Reject subscriptions that contain invalid IP address or port
-- Reject subscriptions for TCP if the connection is not established
-- Exclude vsomeip_ctrl from default installation
-- Only accept SD messages from SD port
-- Acknowledge multiple subscriptions sent within the same message with a single
- message
-- Allow to specify an application specific DLT application
-- Ensure correct ordering of availability notifications
-- Automatically expire subscription based on the given TTL
-- Do not include internal services in SD offer messages
-- Consider all fields of SD subscribe messages
-- Made the watchdog configurable
-- Support destination address resolution on Windows (for reboot detection)
-- Support auto-configuration (client identifiers, routing manager) on Windows
-
-v2.0.6
-- Diagnosis address can be configured at runtime
-
-v2.0.5
-- Fixed reboot detection behavior
-
-v2.0.4
-- Service Discovery now used configured Client ID prefixes (=DIAGNOSIS_ADDRESS)
-- Reworked reboot detection (now based on the destination address)
-- Aligned default TTL setting (was 5 in vsomeip and 0xFFFFFF in vsomeip-sd, now
- its constently 0xFFFFFF)
-
-v2.0.3
-- Fixed shutdown and application re-registering
-
-v2.0.2
-- Fixed endpoint flushing
-- Improved handling of Selective Broadcasts (CommonAPI)
-- Trace connector was added
-- Added reboot detection
-- Reworked handling of TCP connections
-- Support multiple multicast eventgroups per service
-- Improved handling of multicasts
-- Extended Service Discovery to send FindMessage messages for unknown services
-- Support multiple SOME/IP messages in a single UDP datagram
-
-v2.0.1
-- Ensure Unicast flag is set in all Service Discovery messages
-- Allow "local" as alias for unicast address in Magic Cookie configuration
-- Correctly set layer 4 protocol in multicast options
-- Increased robustness of deserialization of configuration options
-- Fixed handling of unknown Service Discovery options
-
-v2.0.0
-- Buffer sizes were adapted to the transport protocols
-- Added support for IPv6 multicast
-- Improved handling of endpoints
-- Report service state changes instead of service state to the application
-- Set and process TTL field in Service Discovery to support detection of "lost"
- services
-- Support automatic configuration of local communication
-- Added compile time variable DIAGNOSIS_ADDRESS (which maps to the high byte of
- the SOME/IP client identifier)
-- Configuration of events was moved from configuration file to API.
-- Fixed routing of notication events.
-- Increased robustness of configuration loader
-- Changed default watchdog cycle from 1s to 5s
-- Removed TTL arguments from public interface
-- Allow Service Discovery to report non-SOME/IP services by setting the
- configuration variable "protocol"
-- Fixed serialization of major version in Eventgroup entries
-- Magic Cookies are no longer forwarded to the routing manager but handled in
- the receiving endpoint
-- vsomeip daemon was added
-
-v1.3.0
-- Fixed SD library loading on Windows
-- Changed cmake directory name (CMake --> cmake)
-- Corrected check for multicast address in Service Discovery
-- Added default setting for Service Discovery timings
-- Ensure only local services are reported by the Service Discovery
-- Fixed a crash in case of a wrong unicast address definition
-- Protected forwarding of availability information
-- Improved handling of notification events
-- Added initial support for selective broadcasts (CommonAPI)
-- Avoid deadlock when offering services
-- Correct handling of events
-- Added initial support for managed interfaces (CommonAPI)
-
-v1.2.0
-- Added (optional) thread pool for distribution of messages to the application
-- Made configuration of service groups optional (as it is unneeded in pure
- client applications)
-- Support specification of transportation mode (reliable (TCP) / unreliable
- (UDP)) when creating messages
-- Fixed internal distribution of notication events
-- Block messages that are received on the wrong port
-- Fixed deregistration of local clients
-- Fixed startup of applications that were started earlier than the routing
- manager
-- Resetting all events of a service if it becomes unavailable (to ensure initial
- events are sent when it becomes available again)
-- Ensure consistency of version information
-- Fixed Service Discovery state machine
-
-v1.1.0
-- Local communication in multiprocessor environments was fixed
-- Runtime access was changed from raw to shared pointer
-- vsomeip logger is used whereever possible (replacing std::cerr calls)
-- Ensure the logger is not deleted before issueing tha last log message when
- shutting down
-- Fixed shutdown crash by checking the existence of endpoint host before
- accessing it
-- Routing info processing in case of multiple instances of the same service
- was fixed
-- Support for local communication on Windows was added
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 39d64af..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,489 +0,0 @@
-# Copyright (C) 2015-2017 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 2.8.12)
-project (vsomeip)
-
-set (VSOMEIP_MAJOR_VERSION 2)
-set (VSOMEIP_MINOR_VERSION 10)
-set (VSOMEIP_PATCH_VERSION 10)
-set (VSOMEIP_VERSION ${VSOMEIP_MAJOR_VERSION}.${VSOMEIP_MINOR_VERSION}.${VSOMEIP_PATCH_VERSION})
-set (PACKAGE_VERSION ${VSOMEIP_VERSION}) # Used in documentatin/doxygen.in
-set (CMAKE_VERBOSE_MAKEFILE off)
-
-###################################################################################################
-# see http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file
-###################################################################################################
-
-# Offer the user the choice of overriding the installation directories
-set (INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
-set (INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
-set (INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
-
-if (WIN32 AND NOT CYGWIN)
- set (DEF_INSTALL_CMAKE_DIR CMake)
-else ()
- set (DEF_INSTALL_CMAKE_DIR lib/cmake/vsomeip)
-endif ()
-
-set (INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files")
-
-# Make relative paths absolute (needed later on)
-foreach (p LIB BIN INCLUDE CMAKE)
- set (var INSTALL_${p}_DIR)
- if (NOT IS_ABSOLUTE "${${var}}")
- set (ABSOLUTE_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") # Add all targets to the build-tree export set
- endif ()
-endforeach ()
-
-###################################################################################################
-# Set a default build type if none was specified
-set(default_build_type "RelWithDebInfo")
-if(NOT CMAKE_BUILD_TYPE)
- message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
- set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
- # Set the possible values of build type for cmake-gui
- set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
-endif()
-
-# OS
-if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
- set(OS "LINUX")
- set(DL_LIBRARY "dl")
- set(EXPORTSYMBOLS "-Wl,-export-dynamic -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exportmap.gcc")
- set(NO_DEPRECATED "")
- set(OPTIMIZE "")
- set(OS_CXX_FLAGS "-D_GLIBCXX_USE_NANOSLEEP -pthread -O -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector -fasynchronous-unwind-tables -fno-omit-frame-pointer -D_FORTIFY_SOURCE=2")
-endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
-
-if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
- set(OS "FREEBSD")
- set(DL_LIBRARY "")
- set(EXPORTSYMBOLS "")
- set(NO_DEPRECATED "-Wno-deprecated")
- set(OPTIMIZE "")
- set(OS_CXX_FLAGS "-pthread")
-endif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
-
-# Signal handling
-if (ENABLE_SIGNAL_HANDLING)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVSOMEIP_ENABLE_SIGNAL_HANDLING")
-endif ()
-
-include_directories(
- "interface"
-)
-
-# Threads
-find_package(Threads REQUIRED)
-
-# Boost
-find_package( Boost 1.55 COMPONENTS system thread log REQUIRED )
-include_directories( ${Boost_INCLUDE_DIR} )
-
-if(Boost_FOUND)
- if(Boost_LIBRARY_DIR)
- MESSAGE( STATUS "Boost_LIBRARY_DIR not empty using it: ${Boost_LIBRARY_DIR}" )
- else()
- if(BOOST_LIBRARYDIR)
- MESSAGE( STATUS "Boost_LIBRARY_DIR empty but BOOST_LIBRARYDIR is set setting Boost_LIBRARY_DIR to: ${BOOST_LIBRARYDIR}" )
- set(Boost_LIBRARY_DIR ${BOOST_LIBRARYDIR})
- endif()
- endif()
-else()
- MESSAGE( STATUS "Boost was not found!")
-endif()
-
-# DLT
-find_package(PkgConfig)
-pkg_check_modules(DLT "automotive-dlt >= 2.11")
-IF(DLT_FOUND)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_DLT")
-ENDIF(DLT_FOUND)
-
-# SystemD
-pkg_check_modules(SystemD "libsystemd")
-
-if(NOT SystemD_FOUND)
-MESSAGE( STATUS "Systemd was not found, watchdog disabled!")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITHOUT_SYSTEMD")
-endif(NOT SystemD_FOUND)
-
-include_directories(
- include
- implementation/helper
- ${DLT_INCLUDE_DIRS}
-)
-
-link_directories(
- ${DLT_LIBDIR}
-)
-
-# Base library
-file(GLOB vsomeip_SRC
- "implementation/endpoints/src/*.cpp"
- "implementation/logging/src/*.cpp"
- "implementation/tracing/src/*.cpp"
- "implementation/message/src/*.cpp"
- "implementation/routing/src/*.cpp"
- "implementation/runtime/src/*.cpp"
- "implementation/utility/src/*.cpp"
- "implementation/plugin/src/*.cpp"
-)
-
-file(GLOB_RECURSE vsomeip_e2e_SRC
- "implementation/e2e_protection/src/*.cpp"
-)
-
-list(SORT vsomeip_SRC)
-list(SORT vsomeip_e2e_SRC)
-
-add_definitions(-DVSOMEIP_VERSION="${VSOMEIP_VERSION}")
-
-if (MSVC)
- message("using MSVC Compiler")
- # add_definitions(-DVSOMEIP_DLL_COMPILATION) now it is controlled per target
- SET(BOOST_WINDOWS_VERSION "0x600" CACHE STRING "Set the same Version as the Version with which Boost was built, otherwise there will be errors. (normaly 0x600 is for Windows 7 and 0x501 is for Windows XP)")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=${BOOST_WINDOWS_VERSION} -DWIN32 -DBOOST_LOG_DYN_LINK -DBOOST_ASIO_DISABLE_IOCP /EHsc")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=${BOOST_WINDOWS_VERSION} -DWIN32 -DBOOST_LOG_DYN_LINK -DBOOST_ASIO_DISABLE_IOCP /EHsc")
- set(USE_RT "")
- set(Boost_LIBRARIES "")
- link_directories(${Boost_LIBRARY_DIR_DEBUG})
- ADD_DEFINITIONS( -DBOOST_ALL_DYN_LINK )
-else()
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${OS} ${OS_CXX_FLAGS} -DBOOST_LOG_DYN_LINK -g ${OPTIMIZE} -std=c++11 ${NO_DEPRECATED} ${EXPORTSYMBOLS}")
- set(USE_RT "rt")
-endif()
-
-add_library(vsomeip SHARED ${vsomeip_SRC} ${vsomeip_e2e_SRC})
-set_target_properties (vsomeip PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
-# PRIVATE means the listed libraries won't be included in the "link interface",
-# meaning the exported vsomeipTargets.cmake targets won't try to link against
-# them (which shouldn't be required). ${Boost_LIBRARIES} includes absolute
-# build host paths as of writing, which also makes this important as it breaks
-# the build.
-target_link_libraries(vsomeip PRIVATE ${Boost_LIBRARIES} ${USE_RT} ${DL_LIBRARY} ${DLT_LIBRARIES} ${SystemD_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
-
-# Configuration library
-file(GLOB vsomeip-cfg_SRC
- "implementation/configuration/src/*.cpp"
-)
-list(SORT vsomeip-cfg_SRC)
-
-add_library(vsomeip-cfg SHARED ${vsomeip-cfg_SRC})
-set_target_properties (vsomeip-cfg PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
-target_link_libraries(vsomeip-cfg vsomeip ${Boost_LIBRARIES} ${USE_RT} ${DL_LIBRARY} ${SystemD_LIBRARIES})
-
-# Service-Discovery library
-file(GLOB vsomeip-sd_SRC
- "implementation/service_discovery/src/*.cpp"
-)
-list(SORT vsomeip-sd_SRC)
-
-add_library(vsomeip-sd SHARED ${vsomeip-sd_SRC})
-set_target_properties (vsomeip-sd PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
-target_link_libraries(vsomeip-sd vsomeip ${Boost_LIBRARIES} ${USE_RT} ${DL_LIBRARY} ${SystemD_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
-
-if (MSVC)
- set_target_properties(vsomeip-cfg PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
- set_target_properties(vsomeip-sd PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
- set_target_properties(vsomeip PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION")
-endif()
-
-# Configuration files
-
-set(EXAMPLE_CONFIG_FILES
- "config/vsomeip.json"
- "config/vsomeip-local.json"
- "config/vsomeip-tcp-client.json"
- "config/vsomeip-tcp-service.json"
- "config/vsomeip-udp-client.json"
- "config/vsomeip-udp-service.json"
-)
-
-###################################################################################################
-set (VSOMEIP_DIAGNOSIS_ADDRESS "0x00")
-if (DIAGNOSIS_ADDRESS)
-set (VSOMEIP_DIAGNOSIS_ADDRESS ${DIAGNOSIS_ADDRESS})
-endif ()
-set (VSOMEIP_UNICAST_ADDRESS "127.0.0.1")
-if (UNICAST_ADDRESS)
-set (VSOMEIP_UNICAST_ADDRESS ${UNICAST_ADDRESS})
-endif ()
-set (VSOMEIP_ROUTING "vsomeipd")
-if (ROUTING)
-set (VSOMEIP_ROUTING ${ROUTING})
-endif ()
-set (VSOMEIP_ROUTING_READY_MESSAGE "SOME/IP routing ready.")
-if (ROUTING_READY_MESSAGE)
-set (VSOMEIP_ROUTING_READY_MESSAGE ${ROUTING_READY_MESSAGE})
-endif ()
-message("Predefined unicast address: ${VSOMEIP_UNICAST_ADDRESS}")
-message("Predefined diagnosis address: ${VSOMEIP_DIAGNOSIS_ADDRESS}")
-message("Predefined routing application: ${VSOMEIP_ROUTING}")
-
-###################################################################################################
-
-set(INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/interface/vsomeip")
-
-file (GLOB_RECURSE vsomeip_INCLUDE RELATIVE ${INCLUDE_PATH} "interface/*.hpp" )
-list (SORT vsomeip_INCLUDE)
-
-foreach ( file ${vsomeip_INCLUDE} )
- get_filename_component( dir ${file} DIRECTORY )
- install( FILES "${INCLUDE_PATH}/${file}" DESTINATION "${INSTALL_INCLUDE_DIR}/vsomeip/${dir}" COMPONENT dev)
-endforeach()
-
-install (
- TARGETS vsomeip
- # IMPORTANT: Add the vsomeip library to the "export-set"
- EXPORT vsomeipTargets
- RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT
- LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT
- ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
- COMPONENT dev
-)
-
-install (
- TARGETS vsomeip-cfg
- LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib
- RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin
-)
-
-install (
- TARGETS vsomeip-sd
- LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib
- RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin
-)
-
-install (
- FILES ${EXAMPLE_CONFIG_FILES} DESTINATION etc/vsomeip COMPONENT config
-)
-
-# Add all targets to the build-tree export set
-export (TARGETS vsomeip FILE "${PROJECT_BINARY_DIR}/vsomeipTargets.cmake")
-
-# Export the package for use from the build-tree
-# (this registers the build-tree with a global CMake-registry)
-export (PACKAGE vsomeip)
-
-# Create the vsomeipConfig.cmake and vsomeipConfigVersion files
-file (RELATIVE_PATH REL_INCLUDE_DIR "${ABSOLUTE_INSTALL_CMAKE_DIR}" "${ABSOLUTE_INSTALL_INCLUDE_DIR}")
-
-# ... for the build tree
-set (CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/interface" "${PROJECT_BINARY_DIR}")
-configure_file (vsomeipConfig.cmake.in "${PROJECT_BINARY_DIR}/vsomeipConfig.cmake" @ONLY)
-
-# ... for the install tree
-set (CONF_INCLUDE_DIRS "\${VSOMEIP_CMAKE_DIR}/${REL_INCLUDE_DIR}")
-configure_file (vsomeipConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vsomeipConfig.cmake" @ONLY)
-
-# ... for both
-configure_file (vsomeipConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/vsomeipConfigVersion.cmake" @ONLY)
-
-# confugure internal.hpp for correct version number
-configure_file (
- "${PROJECT_SOURCE_DIR}/implementation/configuration/include/internal.hpp.in"
- "${PROJECT_SOURCE_DIR}/implementation/configuration/include/internal.hpp"
-)
-
-# Install the vsomeipConfig.cmake and vsomeipConfigVersion.cmake
-install (
- FILES
- "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vsomeipConfig.cmake"
- "${PROJECT_BINARY_DIR}/vsomeipConfigVersion.cmake"
- DESTINATION "${INSTALL_CMAKE_DIR}"
- COMPONENT dev
-)
-
-# Install the export set for use with the install-tree
-install (
- EXPORT vsomeipTargets
- DESTINATION "${INSTALL_CMAKE_DIR}"
- COMPONENT dev
-)
-
-##############################################################################
-# build documentation
-##############################################################################
-add_custom_target(doc)
-
-find_package(Doxygen)
-if (NOT DOXYGEN_FOUND)
- message(WARNING "Doxygen is not installed. Documentation can not be built.")
-else()
- # set configuration variables for doxygen.in
- set(PROJECT "vsomeip")
- set(DOCDIR documentation)
- set(SRCDIR .)
- set(GENERATE_HTML YES)
- set(GENERATE_HTMLHELP NO)
- set(GENERATE_CHI NO)
- set(GENERATE_LATEX NO)
- set(GENERATE_PDF NO)
- set(GENERATE_RTF NO)
- set(GENERATE_MAN NO)
- set(GENERATE_XML NO)
- set(HAVE_DOT YES)
-
- if(HAVE_DOT)
- # Note: the @DOT_PATH@ variable won't be used in doxygen.in as doxygen
- # somehow manages to strip the last slash from the path and therfore no
- # graphs are generated. Therefore dot should be available in your $PATH
- FIND_PROGRAM(DOT_PATH dot)
- if ("${DOT_PATH}" STREQUAL "DOT_PATH-NOTFOUND")
- message(WARNING "dot (graphviz) is not installed. Graphs in documentation can't be generated.")
- else()
- message("dot found")
- endif()
- endif()
-
- configure_file(documentation/doxygen.in ${PROJECT_BINARY_DIR}/Doxyfile @ONLY)
- add_custom_target(doxygen-doc
- COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
- SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
-
- add_dependencies(doc doxygen-doc)
-endif()
-
-find_program(ASCIIDOC_PATH asciidoc)
-find_program(SOURCE_HIGHLIGHT_PATH source-highlight)
-if ("${ASCIIDOC_PATH}" STREQUAL "ASCIIDOC_PATH-NOTFOUND")
- message(WARNING "asciidoc is not installed. Readme can not be built.")
-elseif("${SOURCE_HIGHLIGHT_PATH}" STREQUAL "SOURCE_HIGHLIGHT_PATH-NOTFOUND")
- message(WARNING "source-highlight is not installed. Readme can not be built.")
-else()
- message("asciidoc found")
- message("source-highlight found")
- add_custom_command(TARGET doc
- POST_BUILD
- COMMAND asciidoc
- -a version=${VSOMEIP_VERSION}
- -b html
- -o documentation/vsomeipUserGuide.html
- ${PROJECT_BINARY_DIR}/../documentation/vsomeipUserGuide)
-endif()
-
-##############################################################################
-# create pkg-config file
-if(NOT WIN32)
- configure_file(vsomeip.pc.in ${PROJECT_BINARY_DIR}/vsomeip.pc @ONLY)
- install(FILES ${PROJECT_BINARY_DIR}/vsomeip.pc DESTINATION lib/pkgconfig)
-endif()
-
-##############################################################################
-# build daemon (Non-Windows only)
-if (NOT MSVC)
-add_custom_target( daemon )
-add_subdirectory( daemon )
-endif()
-
-# build tools
-add_custom_target( tools )
-add_subdirectory( tools )
-
-# build examples
-add_custom_target( examples )
-add_subdirectory( examples EXCLUDE_FROM_ALL )
-
-# build plugins located directly in the build tree
-# (Non-Windows only)
-if (NOT MSVC)
- if(EXISTS "${PROJECT_SOURCE_DIR}/plugins/CMakeLists.txt")
- # build plugins if available
- message("Plugins CMakeList.txt found: Build plugins")
- add_subdirectory( plugins )
- endif()
-endif()
-
-
-##############################################################################
-# Test section
-##############################################################################
-
-##############################################################################
-# google test
-
-# check for set environment variable
-if(DEFINED ENV{GTEST_ROOT})
- message("GTEST_ROOT is set. GTEST_ROOT = $ENV{GTEST_ROOT}")
-else()
- message("GTEST_ROOT is not defined. For building the tests environment variable
- GTEST_ROOT have to be defined. Tests can not be built.")
- # early exit
- return() # test can not be build -> make commands build_tests and check are not available
-endif()
-
-# build google test as static library (always) -> therefore deactivate BUILD_SHARED_LIBS in case it is active
-set(BUILD_SHARED_LIBS_AUTOMATIC_OFF 0)
-if ("${BUILD_SHARED_LIBS}" STREQUAL "ON")
- set(BUILD_SHARED_LIBS OFF)
- set(BUILD_SHARED_LIBS_AUTOMATIC_OFF 1)
-endif()
-add_subdirectory($ENV{GTEST_ROOT} ${CMAKE_CURRENT_BINARY_DIR}/gtest EXCLUDE_FROM_ALL)
-if ("${BUILD_SHARED_LIBS_AUTOMATIC_OFF}" STREQUAL "1")
- set(BUILD_SHARED_LIBS ON)
- set(BUILD_SHARED_LIBS_AUTOMATIC_OFF 0)
-endif()
-
-
-
-##############################################################################
-# build tests
-
-enable_testing()
-SET(TESTS_BAT "OFF" CACHE BOOL
- "Controls whether only BAT tests should be build or not")
-SET(TEST_SYMLINK_CONFIG_FILES "OFF" CACHE BOOL
- "Controls if the json and scripts needed needed to run the tests are copied or symlinked into the build directroy (ignored on Windows)")
-SET(TEST_SYMLINK_CONFIG_FILES_RELATIVE "OFF" CACHE BOOL
- "Controls if the json and scripts needed needed to run the tests are symlinked relatively into the build directroy (ignored on Windows)")
-
-SET(TEST_IP_DEFAULT_VALUE "XXX.XXX.XXX.XXX")
-SET(TEST_IP_MASTER "${TEST_IP_DEFAULT_VALUE}" CACHE STRING
- "The IP address of the interface which will act as test master")
-SET(TEST_IP_SLAVE "${TEST_IP_DEFAULT_VALUE}" CACHE STRING
- "The IP address of the interface which will act as test slave")
-
-if((${TEST_IP_MASTER} STREQUAL ${TEST_IP_DEFAULT_VALUE}) OR
- (${TEST_IP_SLAVE} STREQUAL ${TEST_IP_DEFAULT_VALUE}))
- message(WARNING "TEST_IP_MASTER and/or TEST_IP_SLAVE isn't set. "
- "Only local tests will be runnable "
- "Please specify them via for example "
- "-DTEST_IP_MASTER=10.0.3.1 -DTEST_IP_SLAVE=10.0.3.125")
-endif()
-
-SET(TEST_UID_DEFAULT_VALUE "123456789")
-SET(TEST_UID "${TEST_UID_DEFAULT_VALUE}" CACHE STRING
- "The User ID of the user running the test: Needed for security")
-SET(TEST_GID_DEFAULT_VALUE "123456789")
-SET(TEST_GID "${TEST_GID_DEFAULT_VALUE}" CACHE STRING
- "The Group ID of the user running the test: Needed for security")
-
-SET(TEST_SECURITY "ON" CACHE BOOL
- "Controls whether security tests should run or not")
-
-if((${TEST_UID} STREQUAL ${TEST_UID_DEFAULT_VALUE}) OR
- (${TEST_GID} STREQUAL ${TEST_GID_DEFAULT_VALUE}))
- message(WARNING "TEST_UID and/or TEST_GID isn't set. "
- "Security Tests are not runnable "
- "Please specify them for example "
- "-DTEST_UID=1000 -DTEST_GID=1000")
- SET(TEST_SECURITY "OFF")
-endif()
-
-add_custom_target(build_tests)
-add_dependencies(build_tests vsomeip)
-add_dependencies(build_tests vsomeip-sd)
-
-set(CMAKE_CTEST_COMMAND ctest -V)
-add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
-
-add_dependencies(check build_tests)
-
-##############################################################################
-# add test directory
-
-add_subdirectory( test EXCLUDE_FROM_ALL )
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 14e2f77..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- 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/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/LICENSE_boost b/LICENSE_boost
deleted file mode 100644
index eff5f98..0000000
--- a/LICENSE_boost
+++ /dev/null
@@ -1,25 +0,0 @@
-This license applies to all files in directory implementation/helper/boost:
-
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
deleted file mode 100644
index efcfe94..0000000
--- a/README.md
+++ /dev/null
@@ -1,81 +0,0 @@
-### vsomeip
-
-##### Copyright
-Copyright (C) 2015-2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-
-##### License
-
-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/.
-
-##### vsomeip Overview
-----------------
-The vsomeip stack implements the http://some-ip.com/ (Scalable service-Oriented
-MiddlewarE over IP (SOME/IP)) protocol. The stack consists out of:
-
-* a shared library for SOME/IP (`libvsomeip.so`)
-* a second shared library for SOME/IP's service discovery (`libvsomeip-sd.so`)
- which is loaded during runtime if the service discovery is enabled.
-
-##### Build Instructions
-
-###### Dependencies
-
-- A C++11 enabled compiler like gcc >= 4.8 is needed.
-- vsomeip uses CMake as buildsystem.
-- vsomeip uses Boost >= 1.55:
-
-Ubuntu 14.04:
-
-`sudo apt-get install libboost-system1.55-dev libboost-thread1.55-dev libboost-log1.55-dev`
-
-Ubuntu 12.04: a PPA is necessary to use version 1.54 of Boost:
--- URL: https://launchpad.net/~boost-latest/+archive/ubuntu/ppa
---`sudo add-apt-repository ppa:boost-latest/ppa`
---`sudo apt-get install libboost-system1.55-dev libboost-thread1.55-dev
- libboost-log1.55-dev`
-
-For the tests Google's test framework https://code.google.com/p/googletest/[gtest] in version 1.7.0 is needed.
--- URL: https://googletest.googlecode.com/files/gtest-1.7.0.zip
-
-To build the documentation asciidoc, source-highlight, doxygen and graphviz is needed:
---`sudo apt-get install asciidoc source-highlight doxygen graphviz`
-
-###### Compilation
-
-For compilation call:
-
-```bash
-mkdir build
-cd build
-cmake ..
-make
-```
-
-To specify a installation directory (like `--prefix=` if you're used to autotools) call cmake like:
-```bash
-cmake -DCMAKE_INSTALL_PREFIX:PATH=$YOUR_PATH ..
-make
-make install
-```
-
-###### Compilation with predefined unicast and/or diagnosis address
-To predefine the unicast address, call cmake like:
-```bash
-cmake -DUNICAST_ADDRESS=<YOUR IP ADDRESS> ..
-```
-
-To predefine the diagnosis address, call cmake like:
-```bash
-cmake -DDIAGNOSIS_ADDRESS=<YOUR DIAGNOSIS ADDRESS> ..
-```
-The diagnosis address is a single byte value.
-
-###### Compilation with signal handling
-
-To compile vsomeip with signal handling (SIGINT/SIGTERM) enabled, call cmake like:
-```bash
-cmake -DENABLE_SIGNAL_HANDLING=1 ..
-```
-In the default setting, the application has to take care of shutting down vsomeip in case these signals are received.
diff --git a/config/vsomeip-local-security.json b/config/vsomeip-local-security.json
deleted file mode 100644
index 0f8096f..0000000
--- a/config/vsomeip-local-security.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "unicast" : "10.0.3.1",
- "logging" :
- {
- "level" : "info",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "service-sample",
- "id" : "0x1277"
- },
- {
- "name" : "client-sample",
- "id" : "0x1344"
- }
- ],
- "security" :
- {
- "check_credentials" : "true",
- "policies" :
- [
- {
- "client" : "0x1277",
- "credentials" : { "uid" : "1000", "gid" : "1000" },
- "allow" :
- {
- "offers":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678"
- }
- ]
- }
- },
- {
- "client" : "0x1344",
- "credentials" : { "uid" : "1000", "gid" : "1000" },
- "allow" :
- {
- "requests":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
- }
- }
- ]
- },
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip-local-tcp-client.json b/config/vsomeip-local-tcp-client.json
deleted file mode 100644
index 863356f..0000000
--- a/config/vsomeip-local-tcp-client.json
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- "unicast" : "192.168.56.101",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "info",
- "console" : "true",
- "file" : { "enable" : "true", "path" : "/var/log/vsomeip.log" },
- "dlt" : "true"
- },
- "applications" :
- [
- {
- "name" : "client-sample",
- "id" : "0x1343"
- },
- {
- "name" : "second-client-sample",
- "id" : "0x1344"
- },
- {
- "name" : "third-client-sample",
- "id" : "0x1345"
- },
- {
- "name" : "fourth-client-sample",
- "id" : "0x1346"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unicast" : "192.168.56.102",
- "reliable" : { "port" : "30509", "magic-cookies" : false },
- "events" :
- [
- {
- "event" : "0x0777",
- "is_field" : "true"
- },
- {
- "event" : "0x0778",
- "is_field" : "false"
- },
- {
- "event" : "0x0779",
- "is_field" : "true"
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4455",
- "events" : [ "0x777", "0x778" ]
- },
- {
- "eventgroup" : "0x4465",
- "events" : [ "0x778", "0x779" ]
- },
- {
- "eventgroup" : "0x4555",
- "events" : [ "0x777", "0x779" ]
- }
- ]
- }
- ],
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.0.0.1",
- "port" : "30491",
- "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/config/vsomeip-local-tcp-service.json b/config/vsomeip-local-tcp-service.json
deleted file mode 100644
index 621d099..0000000
--- a/config/vsomeip-local-tcp-service.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "unicast" : "192.168.56.102",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "service-sample",
- "id" : "0x1277"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "reliable" : { "port" : "30509", "magic-cookies" : "false" },
- "events" :
- [
- {
- "event" : "0x0777",
- "is_field" : "false",
- "is_reliable" : "true",
- "update-cycle" : 2000
- },
- {
- "event" : "0x0778",
- "is_field" : "true",
- "is_reliable" : "true",
- "update-cycle" : 0
- },
- {
- "event" : "0x0779",
- "is_field" : "false",
- "is_reliable" : "true"
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4455",
- "events" : [ "0x777", "0x778" ]
- },
- {
- "eventgroup" : "0x4465",
- "events" : [ "0x778", "0x779" ]
- },
- {
- "eventgroup" : "0x4555",
- "events" : [ "0x777", "0x779" ]
- }
- ]
- }
- ],
- "routing" : "service-sample",
- "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/config/vsomeip-local-tracing.json b/config/vsomeip-local-tracing.json
deleted file mode 100644
index ba3a6bf..0000000
--- a/config/vsomeip-local-tracing.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "unicast" : "10.0.2.15",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "tracing" :
- {
- "enable" : "true"
- },
- "applications" :
- [
- {
- "name" : "service-sample",
- "id" : "0x1277"
- },
- {
- "name" : "client-sample",
- "id" : "0x1344"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "multicast" :
- {
- "address" : "224.225.226.233",
- "port" : "32344"
- },
- "events" :
- [
- {
- "event" : "0x0777",
- "is_field" : "true",
- "update-cycle" : 2000
- },
- {
- "event" : "0x0778",
- "is_field" : "true",
- "update-cycle" : 0
- },
- {
- "event" : "0x0779",
- "is_field" : "true"
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4455",
- "events" : [ "0x777", "0x778" ]
- },
- {
- "eventgroup" : "0x4465",
- "events" : [ "0x778", "0x779" ],
- "is_multicast" : "true"
- },
- {
- "eventgroup" : "0x4555",
- "events" : [ "0x777", "0x779" ]
- }
- ]
- }
- ],
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip-local.json b/config/vsomeip-local.json
deleted file mode 100644
index 967a9af..0000000
--- a/config/vsomeip-local.json
+++ /dev/null
@@ -1,82 +0,0 @@
-{
- "unicast" : "10.0.2.15",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "service-sample",
- "id" : "0x1277"
- },
- {
- "name" : "client-sample",
- "id" : "0x1344"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "multicast" :
- {
- "address" : "224.225.226.233",
- "port" : "32344"
- },
- "events" :
- [
- {
- "event" : "0x0777",
- "is_field" : "true",
- "update-cycle" : 2000
- },
- {
- "event" : "0x0778",
- "is_field" : "true",
- "update-cycle" : 0
- },
- {
- "event" : "0x0779",
- "is_field" : "true"
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4455",
- "events" : [ "0x777", "0x778" ]
- },
- {
- "eventgroup" : "0x4465",
- "events" : [ "0x778", "0x779" ],
- "is_multicast" : "true"
- },
- {
- "eventgroup" : "0x4555",
- "events" : [ "0x777", "0x779" ]
- }
- ]
- }
- ],
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip-tcp-client-security.json b/config/vsomeip-tcp-client-security.json
deleted file mode 100644
index 319e6b1..0000000
--- a/config/vsomeip-tcp-client-security.json
+++ /dev/null
@@ -1,74 +0,0 @@
-{
- "unicast" : "10.0.3.28",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "info",
- "console" : "true",
- "file" : { "enable" : "true", "path" : "/var/log/vsomeip.log" },
- "dlt" : "true"
- },
- "applications" :
- [
- {
- "name" : "client-sample",
- "id" : "0x1343"
- },
- {
- "name" : "second-client-sample",
- "id" : "0x1344"
- },
- {
- "name" : "third-client-sample",
- "id" : "0x1345"
- },
- {
- "name" : "fourth-client-sample",
- "id" : "0x1346"
- }
- ],
- "clients" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "reliable" : [ "41234" ]
- }
- ],
- "security" :
- {
- "check_credentials" : "true",
- "policies" :
- [
- {
- "client" : { "first" : "0x1343", "last" : "0x1346" },
- "credentials" : { "uid" : "0", "gid" : "0" },
- "allow" :
- {
- "requests":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
- }
- }
- ]
- },
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip-tcp-client.json b/config/vsomeip-tcp-client.json
deleted file mode 100644
index b3d58cf..0000000
--- a/config/vsomeip-tcp-client.json
+++ /dev/null
@@ -1,53 +0,0 @@
-{
- "unicast" : "192.168.56.101",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "info",
- "console" : "true",
- "file" : { "enable" : "true", "path" : "/var/log/vsomeip.log" },
- "dlt" : "true"
- },
- "applications" :
- [
- {
- "name" : "client-sample",
- "id" : "0x1343"
- },
- {
- "name" : "second-client-sample",
- "id" : "0x1344"
- },
- {
- "name" : "third-client-sample",
- "id" : "0x1345"
- },
- {
- "name" : "fourth-client-sample",
- "id" : "0x1346"
- }
- ],
- "clients" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "reliable" : [ "41234" ]
- }
- ],
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip-tcp-service-security.json b/config/vsomeip-tcp-service-security.json
deleted file mode 100644
index d1a8521..0000000
--- a/config/vsomeip-tcp-service-security.json
+++ /dev/null
@@ -1,88 +0,0 @@
-{
- "unicast" : "10.0.3.1",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "service-sample",
- "id" : "0x1277"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" }
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "multicast" :
- {
- "address" : "224.225.226.234",
- "port" : "32344"
- }
- }
- ],
- "security" :
- {
- "check_credentials" : "true",
- "policies" :
- [
- {
- "client" : "0x1277",
- "credentials" : { "uid" : "1000", "gid" : "1000" },
- "allow" :
- {
- "offers":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678"
- }
- ]
- }
- },
- {
- "client" : { "first" : "0x1343", "last" : "0x1346" },
- "allow" :
- {
- "requests":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
- }
- }
- ]
- },
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip-tcp-service.json b/config/vsomeip-tcp-service.json
deleted file mode 100644
index a2445ee..0000000
--- a/config/vsomeip-tcp-service.json
+++ /dev/null
@@ -1,85 +0,0 @@
-{
- "unicast" : "192.168.56.101",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "service-sample",
- "id" : "0x1277"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" },
- "events" :
- [
- {
- "event" : "0x8777",
- "is_field" : "false",
- "is_reliable" : "true",
- "update-cycle" : "2000"
- },
- {
- "event" : "0x8778",
- "is_field" : "true",
- "is_reliable" : "true",
- "update-cycle" : "0"
- },
- {
- "event" : "0x8779",
- "is_field" : "false",
- "is_reliable" : "true"
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4455",
- "events" : [ "0x8777", "0x8778" ]
- },
- {
- "eventgroup" : "0x4465",
- "events" : [ "0x8778", "0x8779" ]
- },
- {
- "eventgroup" : "0x4555",
- "events" : [ "0x8777", "0x8779" ]
- }
- ]
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "multicast" :
- {
- "address" : "224.225.226.234",
- "port" : "32344"
- }
- }
- ],
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip-udp-client-security.json b/config/vsomeip-udp-client-security.json
deleted file mode 100644
index 661e092..0000000
--- a/config/vsomeip-udp-client-security.json
+++ /dev/null
@@ -1,74 +0,0 @@
-{
- "unicast" : "10.0.3.28",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "true", "path" : "/var/log/vsomeip.log" },
- "dlt" : "true"
- },
- "applications" :
- [
- {
- "name" : "client-sample",
- "id" : "0x1343"
- },
- {
- "name" : "second-client-sample",
- "id" : "0x1344"
- },
- {
- "name" : "third-client-sample",
- "id" : "0x1345"
- },
- {
- "name" : "fourth-client-sample",
- "id" : "0x1346"
- }
- ],
- "clients" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : [ 40000, 40002 ]
- }
- ],
- "security" :
- {
- "check_credentials" : "true",
- "policies" :
- [
- {
- "client" : { "first" : "0x1343", "last" : "0x1346" },
- "credentials" : { "uid" : "0", "gid" : "0" },
- "allow" :
- {
- "requests":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
- }
- }
- ]
- },
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip-udp-client.json b/config/vsomeip-udp-client.json
deleted file mode 100644
index 909eab5..0000000
--- a/config/vsomeip-udp-client.json
+++ /dev/null
@@ -1,53 +0,0 @@
-{
- "unicast" : "192.168.56.101",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "true", "path" : "/var/log/vsomeip.log" },
- "dlt" : "true"
- },
- "applications" :
- [
- {
- "name" : "client-sample",
- "id" : "0x1343"
- },
- {
- "name" : "second-client-sample",
- "id" : "0x1344"
- },
- {
- "name" : "third-client-sample",
- "id" : "0x1345"
- },
- {
- "name" : "fourth-client-sample",
- "id" : "0x1346"
- }
- ],
- "clients" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : [ 40000, 40002 ]
- }
- ],
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip-udp-service-security.json b/config/vsomeip-udp-service-security.json
deleted file mode 100644
index 8dcff8e..0000000
--- a/config/vsomeip-udp-service-security.json
+++ /dev/null
@@ -1,88 +0,0 @@
-{
- "unicast" : "10.0.3.1",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "service-sample",
- "id" : "0x1277"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509"
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "multicast" :
- {
- "address" : "224.225.226.234",
- "port" : "32344"
- }
- }
- ],
- "security" :
- {
- "check_credentials" : "true",
- "policies" :
- [
- {
- "client" : "0x1277",
- "credentials" : { "uid" : "1000", "gid" : "1000" },
- "allow" :
- {
- "offers":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678"
- }
- ]
- }
- },
- {
- "client" : { "first" : "0x1343", "last" : "0x1346" },
- "allow" :
- {
- "requests":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
- }
- }
- ]
- },
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip-udp-service.json b/config/vsomeip-udp-service.json
deleted file mode 100644
index 6850a7f..0000000
--- a/config/vsomeip-udp-service.json
+++ /dev/null
@@ -1,88 +0,0 @@
-{
- "unicast" : "192.168.56.101",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "service-sample",
- "id" : "0x1277"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "events" :
- [
- {
- "event" : "0x8777",
- "is_field" : "true",
- "update-cycle" : 2000
- },
- {
- "event" : "0x8778",
- "is_field" : "true",
- "update-cycle" : 0
- },
- {
- "event" : "0x8779",
- "is_field" : "true"
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4455",
- "events" : [ "0x8777", "0x8778" ]
-
- },
- {
- "eventgroup" : "0x4465",
- "events" : [ "0x8778", "0x8779" ],
- "multicast" :
- {
- "address" : "224.225.226.233",
- "port" : "32344"
- }
- },
- {
- "eventgroup" : "0x4555",
- "events" : [ "0x8777", "0x8779" ]
- }
- ]
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "multicast" :
- {
- "address" : "224.225.226.234",
- "port" : "32344"
- }
- }
- ],
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/config/vsomeip.json b/config/vsomeip.json
deleted file mode 100644
index b119c07..0000000
--- a/config/vsomeip.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "unicast" : "192.168.56.101",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "client-sample",
- "id" : "0x1343"
- },
- {
- "name" : "other-client-sample",
- "id" : "0x1344"
- },
- {
- "name" : "service-sample",
- "id" : "0x1277"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" },
- "unreliable" : "31000"
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678",
- "reliable" : { "port" : "30506", "enable-magic-cookies" : false },
- "unreliable" : "31000"
- }
- ],
- "routing" : "client-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/daemon/CMakeLists.txt b/daemon/CMakeLists.txt
deleted file mode 100644
index 2c04ab3..0000000
--- a/daemon/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (C) 2015-2017 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 2.8)
-
-# Daemon
-add_executable(vsomeipd vsomeipd.cpp)
-target_link_libraries(vsomeipd vsomeip ${Boost_LIBRARIES} ${DL_LIBRARY} ${DLT_LIBRARIES})
-
-install (
- TARGETS vsomeipd
- RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin
-)
-
-###################################################################################################
diff --git a/daemon/vsomeipd.cpp b/daemon/vsomeipd.cpp
deleted file mode 100644
index b9a27d0..0000000
--- a/daemon/vsomeipd.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (C) 2015-2017 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 <sys/types.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <unistd.h>
-#include <thread>
-#include <condition_variable>
-#include <mutex>
-
-#include <iostream>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../implementation/configuration/include/internal.hpp"
-#include "../implementation/logging/include/logger.hpp"
-
-#ifdef USE_DLT
-#include <dlt/dlt.h>
-#include "../implementation/logging/include/defines.hpp"
-#endif
-
-static std::shared_ptr<vsomeip::application> its_application;
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
-static vsomeip::routing_state_e routing_state = vsomeip::routing_state_e::RS_RUNNING;
-static bool stop_application = false;
-static bool stop_sighandler = false;
-static std::condition_variable_any sighandler_condition;
-static std::recursive_mutex sighandler_mutex;
-#endif
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
-/*
- * Handle signal to stop the daemon
- */
-void vsomeipd_stop(int _signal) {
- // Do not log messages in signal handler as this can cause deadlock in boost logger
- if (_signal == SIGINT || _signal == SIGTERM) {
- stop_application = true;
- }
- if (_signal == SIGUSR1) {
- routing_state = vsomeip::routing_state_e::RS_SUSPENDED;
- }
- if (_signal == SIGUSR2) {
- routing_state = vsomeip::routing_state_e::RS_RESUMED;
- }
- std::unique_lock<std::recursive_mutex> its_lock(sighandler_mutex);
- sighandler_condition.notify_one();
-}
-#endif
-
-/*
- * Create a vsomeip application object and start it.
- */
-int vsomeipd_process(bool _is_quiet) {
-#ifdef USE_DLT
- if (!_is_quiet)
- DLT_REGISTER_APP(VSOMEIP_LOG_DEFAULT_APPLICATION_ID, VSOMEIP_LOG_DEFAULT_APPLICATION_NAME);
-#else
- (void)_is_quiet;
-#endif
-
- std::shared_ptr<vsomeip::runtime> its_runtime
- = vsomeip::runtime::get();
-
- if (!its_runtime) {
- return -1;
- }
-
- // Create the application object
- its_application = its_runtime->create_application(VSOMEIP_ROUTING);
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- std::thread sighandler_thread([]() {
- // Unblock signals for this thread only
- sigset_t handler_mask;
- sigemptyset(&handler_mask);
- sigaddset(&handler_mask, SIGUSR2);
- sigaddset(&handler_mask, SIGUSR1);
- sigaddset(&handler_mask, SIGTERM);
- sigaddset(&handler_mask, SIGINT);
- sigaddset(&handler_mask, SIGSEGV);
- sigaddset(&handler_mask, SIGABRT);
- pthread_sigmask(SIG_UNBLOCK, &handler_mask, NULL);
-
- // Handle the following signals
- signal(SIGINT, vsomeipd_stop);
- signal(SIGTERM, vsomeipd_stop);
- signal(SIGUSR1, vsomeipd_stop);
- signal(SIGUSR2, vsomeipd_stop);
-
- while (!stop_sighandler) {
- std::unique_lock<std::recursive_mutex> its_lock(sighandler_mutex);
- sighandler_condition.wait(its_lock);
-
- if (stop_application) {
- its_application->stop();
- return;
- } else if (routing_state == vsomeip::routing_state_e::RS_RESUMED ||
- routing_state == vsomeip::routing_state_e::RS_SUSPENDED){
- VSOMEIP_INFO << "Received signal for setting routing_state to: 0x"
- << std::hex << static_cast<int>(routing_state );
- its_application->set_routing_state(routing_state);
- }
- }
- });
-#endif
- if (its_application->init()) {
- if (its_application->is_routing()) {
- its_application->start();
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- sighandler_thread.join();
-#endif
- return 0;
- }
- VSOMEIP_ERROR << "vsomeipd has not been configured as routing - abort";
- }
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- std::unique_lock<std::recursive_mutex> its_lock(sighandler_mutex);
- stop_sighandler = true;
- sighandler_condition.notify_one();
- sighandler_thread.join();
-#endif
- return -1;
-}
-
-/*
- * Parse command line options
- * -h | --help print usage information
- * -d | --daemonize start background processing by forking the process
- * -q | --quiet do _not_ use dlt logging
- *
- * and start processing.
- */
-int main(int argc, char **argv) {
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- // Block all signals
- sigset_t mask;
- sigfillset(&mask);
- sigprocmask(SIG_SETMASK, &mask, NULL);
-#endif
- bool must_daemonize(false);
- bool is_quiet(false);
- if (argc > 1) {
- for (int i = 0; i < argc; i++) {
- std::string its_argument(argv[i]);
- if (its_argument == "-d" || its_argument == "--daemonize") {
- must_daemonize = true;
- } else if (its_argument == "-q" || its_argument == "--quiet") {
- is_quiet = true;
- } else if (its_argument == "-h" || its_argument == "--help") {
- std::cout << "usage: "
- << argv[0] << " [-h|--help][-d|--daemonize][-q|--quiet]"
- << std::endl;
- return 0;
- }
- }
- }
-
- /* Fork the process if processing shall be done in the background */
- if (must_daemonize) {
- pid_t its_process, its_signature;
-
- its_process = fork();
-
- if (its_process < 0) {
- return EXIT_FAILURE;
- }
-
- if (its_process > 0) {
- return EXIT_SUCCESS;
- }
-
- umask(0);
-
- its_signature = setsid();
- if (its_signature < 0) {
- return EXIT_FAILURE;
- }
- }
-
- return vsomeipd_process(is_quiet);
-}
diff --git a/documentation/doxygen.in b/documentation/doxygen.in
deleted file mode 100644
index 9090b73..0000000
--- a/documentation/doxygen.in
+++ /dev/null
@@ -1,1814 +0,0 @@
-# Doxyfile 1.7.6.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or sequence of words) that should
-# identify the project. Note that if you do not use Doxywizard you need
-# to put quotes around the project name if it contains spaces.
-
-PROJECT_NAME = "@PROJECT_NAME@-@PACKAGE_VERSION@"
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER =
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer
-# a quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF =
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is
-# included in the documentation. The maximum height of the logo should not
-# exceed 55 pixels and the maximum width should not exceed 200 pixels.
-# Doxygen will copy the logo to the output directory.
-
-PROJECT_LOGO =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/@DOCDIR@
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful if your file system
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding
-# "class=itcl::class" will allow you to use the command class in the
-# itcl::class meaning.
-
-TCL_SUBST =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this
-# tag. The format is ext=language, where ext is a file extension, and language
-# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
-# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
-# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
-# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
-# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also makes the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
-# unions are shown inside the group in which they are included (e.g. using
-# @ingroup) instead of on a separate page (for HTML and Man pages) or
-# section (for LaTeX and RTF).
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
-# unions with only public data fields will be shown inline in the documentation
-# of the scope in which they are defined (i.e. file, namespace, or group
-# documentation), provided this scope is documented. If set to NO (the default),
-# structs, classes, and unions are shown on a separate page (for HTML and Man
-# pages) or section (for LaTeX and RTF).
-
-INLINE_SIMPLE_STRUCTS = NO
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penalty.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will roughly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols.
-
-SYMBOL_CACHE_SIZE = 0
-
-# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
-# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
-# their name and scope. Since this can be an expensive process and often the
-# same symbol appear multiple times in the code, doxygen keeps a cache of
-# pre-resolved symbols. If the cache is too small doxygen will become slower.
-# If the cache is too large, memory is wasted. The cache size is given by this
-# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols.
-
-LOOKUP_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespaces are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
-# will sort the (brief and detailed) documentation of class members so that
-# constructors and destructors are listed first. If set to NO (the default)
-# the constructors will appear in the respective orders defined by
-# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
-# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
-# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
-# do proper type resolution of all parameters of a function it will reject a
-# match between the prototype and the implementation of a member function even
-# if there is only one candidate or it is obvious which candidate to choose
-# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
-# will still accept a match between prototype and implementation in such cases.
-
-STRICT_PROTO_MATCHING = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or macro consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and macros in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = NO
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page. This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. The create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option.
-# You can optionally specify a file name after the option, if omitted
-# DoxygenLayout.xml will be used as the name of the layout file.
-
-LAYOUT_FILE =
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files
-# containing the references data. This must be a list of .bib files. The
-# .bib extension is automatically appended if omitted. Using this command
-# requires the bibtex tool to be installed. See also
-# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
-# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
-# feature you need bibtex and perl available in the search path.
-
-CITE_BIB_FILES =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# The WARN_NO_PARAMDOC option can be enabled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = @PROJECT_SOURCE_DIR@/implementation \
- @PROJECT_SOURCE_DIR@/interface
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
-# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
-# *.f90 *.f *.for *.vhd *.vhdl
-
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.d \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
- *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.idl \
- *.odl \
- *.cs \
- *.php \
- *.php3 \
- *.inc \
- *.m \
- *.mm \
- *.dox \
- *.py \
- *.f90 \
- *.f \
- *.for \
- *.vhd \
- *.vhdl
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty or if
-# non of the patterns match the file name, INPUT_FILTER is applied.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
-# and it is also possible to disable source filtering for a specific pattern
-# using *.ext= (so without naming a filter). This option only has effect when
-# FILTER_SOURCE_FILES is enabled.
-
-FILTER_SOURCE_PATTERNS =
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code. Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = @GENERATE_HTML@
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header. Note that when using a custom header you are responsible
-# for the proper inclusion of any scripts and style sheets that doxygen
-# needs, which is dependent on the configuration options used.
-# It is advised to generate a default header using "doxygen -w html
-# header.html footer.html stylesheet.css YourConfigFile" and then modify
-# that header. Note that the header is subject to change so you typically
-# have to redo this when upgrading to a newer version of doxygen or when
-# changing the value of configuration settings such as GENERATE_TREEVIEW!
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# style sheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that
-# the files will be copied as-is; there are no commands or markers available.
-
-HTML_EXTRA_FILES =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
-# Doxygen will adjust the colors in the style sheet and background images
-# according to this color. Hue is specified as an angle on a colorwheel,
-# see http://en.wikipedia.org/wiki/Hue for more information.
-# For instance the value 0 represents red, 60 is yellow, 120 is green,
-# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
-# The allowed range is 0 to 359.
-
-HTML_COLORSTYLE_HUE = 220
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
-# the colors in the HTML output. For a value of 0 the output will use
-# grayscales only. A value of 255 will produce the most vivid colors.
-
-HTML_COLORSTYLE_SAT = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
-# the luminance component of the colors in the HTML output. Values below
-# 100 gradually make the output lighter, whereas values above 100 make
-# the output darker. The value divided by 100 is the actual gamma applied,
-# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
-# and 100 does not change the gamma.
-
-HTML_COLORSTYLE_GAMMA = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = YES
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = NO
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-
-DOCSET_PUBLISHER_ID = org.doxygen.Publisher
-
-# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
-
-DOCSET_PUBLISHER_NAME = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = @GENERATE_HTMLHELP@
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE = ../@PROJECT@.chm
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION = @HHC_PATH@
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = @GENERATE_CHI@
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
-# that can be used as input for Qt's qhelpgenerator to generate a
-# Qt Compressed Help (.qch) of the generated HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
-# add. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
-# Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
-# Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
-# the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
-# at top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it. Since the tabs have the same information as the
-# navigation tree you can set this option to NO if you already set
-# GENERATE_TREEVIEW to YES.
-
-DISABLE_INDEX = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-# Since the tree basically has the same information as the tab index you
-# could consider to set DISABLE_INDEX to NO when enabling this option.
-
-GENERATE_TREEVIEW = YES
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
-# (range [0,1..20]) that doxygen will group on one line in the generated HTML
-# documentation. Note that a value of 0 will completely suppress the enum
-# values from appearing in the overview section.
-
-ENUM_VALUES_PER_LINE = 4
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
-# links to external symbols imported via tag files in a separate window.
-
-EXT_LINKS_IN_WINDOW = NO
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are
-# not supported properly for IE 6.0, but are supported on all modern browsers.
-# Note that when changing this option you need to delete any form_*.png files
-# in the HTML output before the changes have effect.
-
-FORMULA_TRANSPARENT = YES
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
-# (see http://www.mathjax.org) which uses client side Javascript for the
-# rendering instead of using prerendered bitmaps. Use this if you do not
-# have LaTeX installed or if you want to formulas look prettier in the HTML
-# output. When enabled you also need to install MathJax separately and
-# configure the path to it using the MATHJAX_RELPATH option.
-
-USE_MATHJAX = NO
-
-# When MathJax is enabled you need to specify the location relative to the
-# HTML output directory using the MATHJAX_RELPATH option. The destination
-# directory should contain the MathJax.js script. For instance, if the mathjax
-# directory is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to the
-# mathjax.org site, so you can quickly see the result without installing
-# MathJax, but it is strongly recommended to install a local copy of MathJax
-# before deployment.
-
-MATHJAX_RELPATH = http://www.mathjax.org/mathjax
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
-# names that should be enabled during MathJax rendering.
-
-MATHJAX_EXTENSIONS =
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box
-# for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using
-# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
-# (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = YES
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a PHP enabled web server instead of at the web client
-# using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server
-# based approach is that it scales better to large projects and allows
-# full text search. The disadvantages are that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = @GENERATE_LATEX@
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = YES
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = @PAPER_SIZE@
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
-# the generated latex document. The footer should contain everything after
-# the last chapter. If it is left blank doxygen will generate a
-# standard footer. Notice: only use this tag if you know what you are doing!
-
-LATEX_FOOTER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = @GENERATE_PDF@
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = YES
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include
-# source code with syntax highlighting in the LaTeX output.
-# Note that which sources are shown also depends on other settings
-# such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
-# http://en.wikipedia.org/wiki/BibTeX for more info.
-
-LATEX_BIB_STYLE = plain
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = @GENERATE_RTF@
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = YES
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load style sheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = @GENERATE_MAN@
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = @GENERATE_XML@
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# pointed to by INCLUDE_PATH will be searched when a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition that
-# overrules the definition found in the source code.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all references to function-like macros
-# that are alone on a line, have an all uppercase name, and do not end with a
-# semicolon, because these will confuse the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE = @DOCDIR@/@PROJECT@.tag
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option also works with HAVE_DOT disabled, but it is recommended to
-# install and use dot, since it yields more powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = @HAVE_DOT@
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
-# allowed to run in parallel. When set to 0 (the default) doxygen will
-# base this on the number of processors available in the system. You can set it
-# explicitly to a value larger than 0 to get control over the balance
-# between CPU load and processing speed.
-
-DOT_NUM_THREADS = 0
-
-# By default doxygen will use the Helvetica font for all dot files that
-# doxygen generates. When you want a differently looking font you can specify
-# the font name using DOT_FONTNAME. You need to make sure dot is able to find
-# the font, which can be done by putting it in a standard location or by setting
-# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
-# directory containing the font.
-
-DOT_FONTNAME = Helvetica
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the Helvetica font.
-# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
-# set the path where dot can find it.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will generate a graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are svg, png, jpg, or gif.
-# If left blank png will be used. If you choose svg you need to set
-# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
-# visible in IE 9+ (other browsers do not have this requirement).
-
-DOT_IMAGE_FORMAT = svg
-
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-# Note that this requires a modern browser other than Internet Explorer.
-# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
-# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
-# visible. Older versions of IE do not have SVG support.
-
-INTERACTIVE_SVG = NO
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the
-# \mscfile command).
-
-MSCFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
diff --git a/documentation/multicast.txt b/documentation/multicast.txt
deleted file mode 100644
index 4b9c324..0000000
--- a/documentation/multicast.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-To use IP multicast, the route must be added. In Linux this can be done
-by:
-
-# route add -net 224.0.0.0/4 dev eth0
-
-Other OSes may have different ways to do this.
diff --git a/documentation/todo.txt b/documentation/todo.txt
deleted file mode 100644
index 1933fd8..0000000
--- a/documentation/todo.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-TODO:
-
-- update the EA model to match the current implementation
diff --git a/documentation/vsomeip.eap b/documentation/vsomeip.eap
deleted file mode 100755
index dfe4c26..0000000
--- a/documentation/vsomeip.eap
+++ /dev/null
Binary files differ
diff --git a/documentation/vsomeipUserGuide b/documentation/vsomeipUserGuide
deleted file mode 100644
index 9996063..0000000
--- a/documentation/vsomeipUserGuide
+++ /dev/null
@@ -1,1655 +0,0 @@
-vsomeip
-=======
-// This enables a nice TOC as a sidebar
-:toc2:
-// Show all headings in TOC
-:toclevels: 4
-// Show icons if e.g. TIP: or IMPORTANT is used
-:icons:
-// Set the directory where the default icons can be found
-:iconsdir: {asciidoc-confdir}/{iconsdir}
-// number all headings
-:numbered:
-// this embeds images (e.g. the icons for TIP: $TEXT) into the html file
-:data-uri:
-
-Copyright
-+++++++++
-Copyright (C) 2015-2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-
-License
-+++++++
-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/.
-
-Version
-+++++++
-// set the version to the one we get from cmake
-// or pass it via -a version=$VSOMEIP_VERSION to asciidoc
-This documentation was generated for version {version} of vsomeip.
-
-vsomeip Overview
-----------------
-The vsomeip stack implements the http://some-ip.com/[Scalable service-Oriented
-MiddlewarE over IP (SOME/IP)] protocol. The stack consists out of:
-
-* a shared library for SOME/IP (`libvsomeip.so`)
-* a second shared library for SOME/IP's service discovery (`libvsomeip-sd.so`)
- which is loaded during runtime if the service discovery is enabled.
-
-Build Instructions
-------------------
-Dependencies
-~~~~~~~~~~~~
-* A C++11 enabled compiler like gcc >= 4.8 is needed.
-* vsomeip uses cmake as buildsystem.
-* vsomeip uses Boost >= 1.55:
-** Ubuntu 14.04:
-*** `sudo apt-get install libboost-system1.55-dev libboost-thread1.55-dev
- libboost-log1.55-dev`
-** Ubuntu 12.04: a PPA is necessary to use version 1.54 of Boost:
-*** URL: https://launchpad.net/~boost-latest/+archive/ubuntu/ppa
-*** `sudo add-apt-repository ppa:boost-latest/ppa`
-*** `sudo apt-get install libboost-system1.55-dev libboost-thread1.55-dev
- libboost-log1.55-dev`
-* For the tests Google's test framework
- https://code.google.com/p/googletest/[gtest] in version 1.7.0 is needed
-** URL: https://googletest.googlecode.com/files/gtest-1.7.0.zip[direct link,
- version 1.7.0]
-* To build the documentation asciidoc, source-highlight, doxygen and graphviz is needed:
-** `sudo apt-get install asciidoc source-highlight doxygen graphviz`
-
-Compilation
-~~~~~~~~~~~
-anchor:Compilation[]
-For compilation call:
-[source, bash]
-----
-mkdir build
-cd build
-cmake ..
-make
-----
-
-To specify a installation directory (like `--prefix=` if you're used to
-autotools) call cmake like:
-[source, bash]
-----
-cmake -DCMAKE_INSTALL_PREFIX:PATH=$YOUR_PATH ..
-make
-make install
-----
-
-Compilation with predefined unicast and/or diagnosis address
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-To predefine the unicast address, call cmake like:
-[source,bash]
-----
-cmake -DUNICAST_ADDRESS=<YOUR IP ADDRESS> ..
-----
-
-To predefine the diagnosis address, call cmake like:
-[source,bash]
-----
-cmake -DDIAGNOSIS_ADDRESS=<YOUR DIAGNOSIS ADDRESS> ..
-----
-The diagnosis address is a single byte value.
-
-Compilation with signal handling
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-To compile vsomeip with signal handling (SIGINT/SIGTERM) enabled,
-call cmake like:
-[source,bash]
-----
-cmake -DENABLE_SIGNAL_HANDLING=1 ..
-----
-In the default setting, the application has to take care of shutting
-down vsomeip in case these signals are received.
-
-Compilation with user defined "READY" message
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-To compile vsomeip with a user defined message signal the IP routing
-to be ready to send/receive messages, call cmake like:
-[source,bash]
-----
-cmake -DROUTING_READY_MESSAGE=<YOUR MESSAGE> ..
-----
-
-Compilation of examples
-^^^^^^^^^^^^^^^^^^^^^^^
-For compilation of the examples call:
-[source, bash]
-----
-mkdir build
-cd build
-cmake ..
-make examples
-----
-
-Compilation of tests
-^^^^^^^^^^^^^^^^^^^^
-To compile the tests, first unzip gtest to location of your desire.
-Some of the tests require a second node on the same network. There are two cmake
-variables which are used to automatically adapt the json files to the used
-network setup:
-
-* `TEST_IP_MASTER`: The IP address of the interface which will act as test
- master.
-* `TEST_IP_SLAVE`: The IP address of the interface of the second node which will
- act as test slave.
-
-If one of this variables isn't specified, only the tests using local
-communication exclusively will be runnable.
-
-Additionally the unit tests require enabled signal handling which can be enabled
-via the `ENABLE_SIGNAL_HANDLING` cmake variable.
-
-Example, compilation of tests:
-[source, bash]
-----
-mkdir build
-cd build
-export GTEST_ROOT=$PATH_TO_GTEST/gtest-1.7.0/
-cmake -DENABLE_SIGNAL_HANDLING=1 -DTEST_IP_MASTER=10.0.3.1 -DTEST_IP_SLAVE=10.0.3.125 ..
-make check
-----
-
-Additional make targets for the tests:
-
-* Call `make build_tests` to only compile the tests
-* Call `ctest` in the build directory to execute the tests without a verbose
- output
-* To run single tests call `ctest --verbose --tests-regex $TESTNAME` short
- form: `ctest -V -R $TESTNAME`
-* To list all available tests run `ctest -N`.
-* For further information about the tests please have a look at the
- `readme.txt` in the `test` subdirectory.
-
-For development purposes two cmake variables exist which control if the
-json files and test scripts are copied (default) or symlinked into the build
-directory. These settings are ignored on Windows.
-
-* `TEST_SYMLINK_CONFIG_FILES`: Controls if the json and scripts needed
- to run the tests are copied or symlinked into the build directory. (Default:
- OFF, ignored on Windows)
-* `TEST_SYMLINK_CONFIG_FILES_RELATIVE`: Controls if the json and scripts needed
- to run the tests are symlinked relatively into the build directory.
- (Default: OFF, ignored on Windows)
-
-Example cmake call:
-[source, bash]
-----
-cmake -DTEST_SYMLINK_CONFIG_FILES=ON -DTEST_SYMLINK_CONFIG_FILES_RELATIVE=ON ..
-----
-
-For compilation of only a subset of tests (for a quick
-functionality check) the cmake variable `TESTS_BAT` has
-to be set:
-
-Example cmake call:
-[source, bash]
-----
-cmake -DTESTS_BAT=ON ..
-----
-
-Compilation of vsomeip_ctrl
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-For compilation of the <<vsomeip_ctrl>> utility call:
-[source, bash]
-----
-mkdir build
-cd build
-cmake ..
-make vsomeip_ctrl
-----
-
-Generating the documentation
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-To generate the documentation call cmake as described in <<Compilation>> and
-then call `make doc`.
-This will generate:
-
-* The README file in html: `$BUILDDIR/documentation/README.html`
-* A doxygen documentation in `$BUILDDIR/documentation/html/index.html`
-
-Starting vsomeip Applications / Used environment variables
-----------------------------------------------------------
-On startup the following environment variables are read out:
-
-* `VSOMEIP_APPLICATION_NAME`: This environment variable is used to specify the
- name of the application. This name is later used to map a client id to the
- application in the configuration file. It is independent from the
- application's binary name.
-* `VSOMEIP_CONFIGURATION`: vsomeip uses the default configuration file `/etc/vsomeip.json`
- and/or the default configuration folder `/etc/vsomeip`. This can be overridden by a
- local configuration file `./vsomeip.json` and/or a local configuration folder `./vsomeip`.
- If `VSOMEIP_CONFIGURATION` is set to a valid file or directory path, this is used instead
- of the standard configuration (thus neither default nor local file/folder will be parsed).
-* `VSOMEIP_MANDATORY_CONFIGURATION_FILES`: vsomeip allows to specify mandatory configuration
- files to speed-up application startup. While mandatory configuration files are read by all
- applications, all other configuration files are only read by the application that is
- responsible for connections to external devices. If this configuration variable is not set,
- the default mandatory files vsomeip_std.json, vsomeip_app.json and vsomeip_plc.json are used.
-* `VSOMEIP_CLIENTSIDELOGGING`: Set this variable to an empty string to enable logging of
- any received messages to DLT in all applications acting as routing manager proxies. For
- example add the following line to the application's systemd service file:
- `Environment=VSOMEIP_CLIENTSIDELOGGING=""`
- To enable service-specific logs, provide a space- or colon-separated list of ServiceIDs (using
- 4-digit hexadecimal notation, optionally followed by dot-separted InstanceID). For example:
- `Environment=VSOMEIP_CLIENTSIDELOGGING="b003.0001 f013.000a 1001 1002"`
- `Environment=VSOMEIP_CLIENTSIDELOGGING="b003.0001:f013.000a:1001:1002"`
-
-NOTE: If the file/folder that is configured by `VSOMEIP_CONFIGURATION` does _not_ exist,
-the default configuration locations will be used.
-
-NOTE: vsomeip will parse and use the configuration from all files in a configuration folder
-but will _not_ consider directories within the configuration folder.
-
-In the following example the application `my_vsomeip_application` is started.
-The settings are read from the file `my_settings.json` in the current working
-directory. The client id for the application can be found under the name
-`my_vsomeip_client` in the configuration file.
-
-[source, bash]
-----
-#!/bin/bash
-export VSOMEIP_APPLICATION_NAME=my_vsomeip_client
-export VSOMEIP_CONFIGURATION=my_settings.json
-./my_vsomeip_application
-----
-
-Configuration File Structure
-----------------------------
-The configuration files for vsomeip are http://www.json.org/[JSON]-Files and are
-composed out of multiple key value pairs and arrays.
-
-[quote, , json.org]
-____
-* An object is an unordered set of name/value pairs. An object begins with `{
-(left brace)` and ends with `} (right brace)`. Each name is followed by `:
-(colon)` and the name/value pairs are separated by `, (comma)`.
-
-* An array is an ordered collection of values. An array begins with `[ (left
-bracket)` and ends with `] (right bracket)`. Values are separated by `,
-(comma)`.
-
-* A value can be a _string_ in double quotes, or a _number_, or `true` or `false`
-or `null`, or an _object_ or an _array_. These structures can be nested.
-____
-
-Configuration file element explanation:
-
-
-* 'unicast'
-+
-The IP address of the host system.
-+
-* 'netmask'
-+
-The netmask to specify the subnet of the host system.
-+
-* 'diagnosis'
-+
-The diagnosis address (byte) that will be used to build client identifiers. The
-diagnosis address is assigned to the most significant byte in all client
-identifiers if not specified otherwise (for example through a predefined client
-ID).
-+
-* 'diagnosis_mask'
-+
-The diagnosis mask (2 byte) is used to control the amount of bits used for the
-diagnosis address in client identifiers. The default value is `0xFF00` meaning
-the most significant byte of the client ID is reserved for the diagnosis
-address. Setting the mask to `0xFE00` allows to only use the 7 most
-significant bits of the client ID as a diagnosis address. This can be used to
-increase the maximum amount of concurrent active clients on an ECU.
-
-* 'network'
-+
-Network identifier used to support multiple routing managers on one host. This
-setting changes the name of the shared memory segment in `/dev/shm` and the name
-of the unix domain sockets in `/tmp/`. Defaults to `vsomeip` meaning the shared
-memory will be named `/dev/shm/vsomeip` and the unix domain sockets will be
-named `/tmp/vsomeip-$CLIENTID`
-+
-//Logging
-* 'logging'
-+
-** 'level'
-+
-Specifies the log level (valid values: _trace_, _debug_, _info_, _warning_,
-_error_, _fatal_).
-+
-** 'console'
-+
-Specifies whether logging via console is enabled (valid values: _true, false_).
-+
-** 'file'
-+
-*** 'enable'
-+
-Specifies whether a log file should be created (valid values: _true, false_).
-+
-*** 'path'
-+
-The absolute path of the log file.
-+
-** 'dlt'
-+
-Specifies whether Diagnostic Log and Trace (DLT) is enabled (valid values:
-_true, false_).
-+
-** 'version'
-+
-Configures logging of the vsomeip version
-+
-*** 'enable'
-+
-Enable or disable cyclic logging of vsomeip version, defaults to true (valid
-values: _true, false_)
-+
-*** 'interval'
-+
-Configures interval in seconds to log the vsomeip version. Default value is 10.
-+
-** 'memory_log_interval'
-+
-Configures interval in seconds in which the routing manager logs its used
-memory. Setting a value greater than zero enables the logging.
-+
-** 'status_log_interval'
-+
-Configures interval in seconds in which the routing manager logs its internal
-status. Setting a value greater than zero enables the logging.
-+
-//Tracing
-* anchor:config-tracing[]'tracing' (optional)
-+
-** 'enable'
-+
-Specifies whether the tracing of the SOME/IP messages is enabled
-(valid values: _true, false_). Default value is _false_.
-If tracing is enabled, the messages will be forwarded to DLT by
-the <<traceconnector, Trace Connector>>
-+
-** 'sd_enable'
-+
-Specifies whether the tracing of the SOME/IP service discovery messages is
-enabled (valid values: _true, false_). Default value is _false_.
-+
-** 'channels (array)' (optional)
-+
-Contains the channels to DLT.
-+
-NOTE: You can set up multiple channels to DLT over that you can forward the
-messages.
-+
-*** 'name'
-+
-The name of the channel.
-+
-*** 'id'
-+
-The id of the channel.
-+
-** 'filters (array)' (optional)
-+
-Contains the filters that are applied on the messages.
-+
-NOTE: You can apply filters respectively filter rules on the messages with
-specific criterias and expressions. So only the filtered messages are forwarded
-to DLT.
-+
-*** 'channel' (optional)
-+
-The id of the channel over that the filtered messages are forwarded to DLT. If
-no channel is specified the default channel is used.
-+
-IMPORTANT: If multiple filters are used, the channel MUST always be
-specified and accordingly defined! Each filter needs its own channel!
-+
-*** 'services (array)' (optional)
-+
-Contains the service ids. The messages that relates to the specified services will be filtered.
-+
-*** 'methods (array)' (optional)
-+
-Contains the method ids. The messages that relates to the specified methods will be filtered.
-+
-*** 'clients (array)' (optional)
-+
-Contains the client ids. The messages that relates to the specified clients will
-be filtered.
-+
-*** 'type' (optional)
-+
-Specifies the filter type (valid values: "positive", "negative"). When a positive
-filter is used and a message matches one of the filter rules, the message will be
-traced/forwarded to DLT. With a negative filter messages can be excluded. So when a
-message matches one of the filter rules, the message will not be traced/forwarded to
-DLT. Default value is "positive".
-+
-//Applications
-* 'applications (array)'
-+
-Contains the applications of the host system that use this config file.
-+
-** 'name'
-+
-The name of the application.
-+
-** 'id'
-+
-The id of the application. Usually its high byte is equal to the diagnosis address. In this
-case the low byte must be different from zero. Thus, if the diagnosis address is 0x63, valid
-values range from 0x6301 until 0x63FF. It is also possible to use id values with a high byte
-different from the diagnosis address.
-+
-** 'max_dispatchers'
-+
-The maximum number of threads that shall be used to execute the application callbacks.
-+
-** 'max_dispatch_time'
-+
-The maximum time that an application callback may consume before the callback is
-considered to be blocked (and an additional thread is used to execute pending
-callbacks if max_dispatchers is configured greater than 0).
-+
-** 'threads' (optional)
-+
-The number of internal threads to process messages and events within an application.
-Valid values are 1-255. Default is 2.
-+
-** 'request_debounce_time' (optional)
-+
-Specifies a debounce-time interval in ms in which request-service messages are sent to
-the routing manager. If an application requests many services in short same time
-the load of sent messages to the routing manager and furthermore the replies from the
-routing manager (which contains the routing info for the requested service if available)
-can be heavily reduced. The default value if not specified is 10ms.
-+
-* `services` (array)
-+
-Contains the services of the service provider.
-
-** `service`
-+
-The id of the service.
-
-** `instance`
-+
-The id of the service instance.
-
-** `protocol` (optional)
-+
-The protocol that is used to implement the service instance. The default setting
-is _someip_. If a different setting is provided, vsomeip does not open the specified
-port (server side) or does not connect to the specified port (client side). Thus,
-this option can be used to let the service discovery announce a service that is
-externally implemented.
-
-** `unicast` (optional)
-+
-The unicast that hosts the service instance.
-+
-NOTE: The unicast address is needed if external service instances shall be used,
-but service discovery is disabled. In this case, the provided unicast address
-is used to access the service instance.
-
-** `reliable`
-+
-Specifies that the communication with the service is reliable respectively the
-TCP protocol is used for communication.
-
-*** `port`
-+
-The port of the TCP endpoint.
-
-*** `enable-magic-cookies`
-+
-Specifies whether magic cookies are enabled (valid values: _true_, _false_).
-
-** `unreliable`
-+
-Specifies that the communication with the service is unreliable respectively the
-UDP protocol is used for communication (valid values: the _port_ of the UDP
-endpoint).
-
-** `events` (array)
-+
-Contains the events of the service.
-
-*** `event`
-+
-The id of the event.
-
-*** `is_field`
-+
-Specifies whether the event is of type field.
-+
-NOTE: A field is a combination of getter, setter and notification event. It
-contains at least a getter, a setter, or a notifier. The notifier sends an event
-message that transports the current value of a field on change.
-
-*** `is_reliable`
-+
-Specifies whether the communication is reliable respectively whether the event
-is sent with the TCP protocol (valid values: _true_,_false_).
-+
-If the value is _false_ the UDP protocol will be used.
-
-** `eventgroups` (array)
-+
-Events can be grouped together into on event group. For a client it is thus
-possible to subscribe for an event group and to receive the appropriate events
-within the group.
-
-*** `eventgroup`
-+
-The id of the event group.
-
-*** `events` (array)
-+
-Contains the ids of the appropriate events.
-
-*** `multicast`
-+
-Specifies the multicast that is used to publish the eventgroup.
-
-**** `address`
-+
-The multicast address.
-
-**** `port`
-+
-The multicast port.
-
-*** `threshold`
-+
-Specifies when to use multicast and when to use unicast to send a notification event.
-Must be set to a non-negative number. If it is set to zero, all events of the eventgroup
-will be sent by unicast. Otherwise, the events will be sent by unicast as long as the
-number of subscribers is lower than the threshold and by multicast if the number
-of subscribers is greater or equal. This means, a threshold of 1 will lead to all events
-being sent by multicast. The default value is _0_.
-
-* `clients` (array)
-+
-The client-side ports that shall be used to connect to a specific service.
-For each service, an array of ports to be used for reliable / unreliable
-communication can be specified. vsomeip will take the first free port of
-the list. If no free port can be found, the connection will fail. If
-vsomeip is asked to connect to a service instance without specified port(s),
-the port will be selected by the system. This implies that the user has
-to ensure that the ports configured here do not overlap with the ports
-automatically selected by the IP stack.
-
-** `service`
-** `instance`
-+
-Together they specify the service instance the port configuration shall be applied to.
-
-** `reliable` (array)
-+
-The list of client ports to be used for reliable (TCP) communication to the given
-service instance.
-
-** `unreliable` (array)
-+
-The list of client ports to be used for unreliable (UDP) communication to the given
-service instance.
-
-+
-Additionally there is the possibility to configure mappings between ranges of client
-ports and ranges of remote service ports.
-(If a client port is configured for a specific service / instance, the port range mapping is ignored)
-
-** `reliable_remote_ports`
-+
-Specifies a range of reliable remote service ports
-
-** `unreliable_remote_ports`
-+
-Specifies a range of unreliable remote service ports
-
-** `reliable_client_ports`
-+
-Specifies the range of reliable client ports to be mapped to the reliable_remote_ports range
-
-** `unreliable_client_ports`
-+
-Specifies the range of unreliable client ports to be mapped to the unreliable_remote_ports range
-
-
-** `first`
-+
-Specifies the lower bound of a port range
-
-** `last`
-+
-Specifies the upper bound of a port range
-
-* `payload-sizes` (array)
-+
-Array to limit the maximum allowed payload sizes per IP and port. If not
-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`
-+
-On client side: the IP of the remote service for which the payload size should
-be limited.
-+
-On service side: the IP of the offered service for which the payload size for
-receiving and sending should be limited.
-
-** `ports` (array)
-+
-Array which holds pairs of port and payload size statements.
-
-*** `port`
-+
-On client side: the port of the remote service for which the payload size should
-be limited.
-+
-On service side: the port of the offered service for which the payload size for
-receiving and sending should be limited.
-
-*** `max-payload-size`
-+
-On client side: the payload size limit in bytes of a message sent to the
-remote service hosted on beforehand specified IP and port.
-+
-On service side: the payload size limit in bytes of messages received and sent
-by the service offered on previously specified IP and port.
-+
-If multiple services are hosted on the same port they all share the limit
-specified.
-
-* `max-payload-size-local`
-+
-The maximum allowed payload size for node internal communication in bytes. By
-default the payload size for node internal communication is unlimited. It can be
-limited via this setting.
-
-* `max-payload-size-reliable`
-+
-The maximum allowed payload size for TCP communication in
-bytes. By default the payload size for TCP communication is
-unlimited. It can be limited via this setting.
-
-* `endpoint-queue-limits` (array)
-+
-Array to limit the maximum allowed size in bytes of cached outgoing messages per
-IP and port (message queue size per endpoint). If not specified otherwise the
-allowed queue size is unlimited. The settings in this array only affect external
-communication. To limit the local queue size `endpoint-queue-limit-local` can
-be used.
-
-** `unicast`
-+
-On client side: the IP of the remote service for which the queue size of sent
-requests should be limited.
-+
-On service side: the IP of the offered service for which the queue size for
-sent responses should be limited. This IP address is therefore
-identical to the IP address specified via `unicast` setting on top level of the
-json file.
-
-** `ports` (array)
-+
-Array which holds pairs of port and queue size statements.
-
-*** `port`
-+
-On client side: the port of the remote service for which the queue size of sent
-requests should be limited.
-+
-On service side: the port of the offered service for which the queue size for
-send responses should be limited.
-
-*** `queue-size-limit`
-+
-On client side: the queue size limit in bytes of messages sent to the
-remote service hosted on beforehand specified IP and port.
-+
-On service side: the queue size limit in bytes for responses sent by the service
-offered on previously specified IP and port.
-+
-If multiple services are hosted on the same port they all share the limit
-specified.
-
-* `endpoint-queue-limit-external`
-+
-Setting to limit the maximum allowed size in bytes of cached outgoing messages
-for external communication (message queue size per endpoint). By default the
-queue size for external communication is unlimited. It can be limited via this
-setting. Settings done in the `endpoint-queue-limits` array override this
-setting.
-
-* `endpoint-queue-limit-local`
-+
-Setting to limit the maximum allowed size in bytes of cached outgoing messages
-for local communication (message queue size per endpoint). By default the queue
-size for node internal communication is unlimited. It can be limited via this
-setting.
-
-* `buffer-shrink-threshold`
-+
-The number of processed messages which are half the size or smaller than the
-allocated buffer used to process them before the memory for the buffer is
-released and starts to grow dynamically again. This setting can be useful in
-scenarios where only a small number of the overall messages are a lot bigger
-then the rest and the memory allocated to process them should be released in a
-timely manner. If not specified via this setting the buffer sizes by default
-aren't reseted and are as big as the biggest processed message.
-+
-Example: `buffer-shrink-threshold` is set to 50. A message with 500 bytes has to
-be processed and the buffers grow accordingly. After this message 50 consecutive
-messages smaller than 250 bytes have to be processed before the buffer size is
-reduced and starts to grow dynamically again.
-
-* `internal_services` (optional array)
-+
-Specifies service/instance ranges for pure internal service-instances.
-This information is used by vsomeip to avoid sending Find-Service messages
-via the Service-Discovery when a client is requesting a not available service-
-instance. Its can either be done on service/instance level or on service level
-only which then includes all instance from 0x0000-0xffff.
-
-** `first`
-+
-The lowest entry of the internal service range.
-
-*** `service`
-+
-The lowest Service-ID in hex of the internal service range.
-
-*** `instance` (optional)
-+
-The lowest Instance-ID in hex of a internal service-instance range.
-If not specified the lowest Instance-ID is 0x0000.
-
-** `last`
-+
-The highest entry of the internal service range.
-
-*** `service`
-+
-The highest Service-ID in hex of a internal service range.
-
-*** `instance` (optional)
-+
-The highest Instance-ID in hex of a internal service-instance range.
-If not specified the highest Instance-ID is 0xFFFF.
-
-* `debounce` (optional array)
-+
-Events/fields sent by external devices will be forwarded to the
-applications only if a configurable function evaluates to true. The
-function checks whether the event/field payload has changed and whether
-a specified interval has been elapsed since the last forwarding.
-
-** `service`
-+
-Service ID which hosts the events to be debounced.
-
-** `instance`
-+
-Instance ID which hosts the events to be debounced.
-
-** `events`
-+
-Array of events which shall be debounced based on the following
-configuration options.
-
-*** `event`
-+
-Event ID.
-
-*** `on_change`
-+
-Specifies whether the event is only forwared on
-paylaod change or not. (valid values: _true_, _false_).
-
-*** `ignore`
-+
-Array of payload indexes with given bit mask (optional)
-to be ignored in payload change evaluation.
-Instead of specifying an index / bitmask pair, one can only define the paylaod index
-which shall be ignored in the evaluation.
-
-**** `index`
-+
-Payload index to be checked with given bitmask.
-
-**** `mask`
-+
-1Byte bitmask applied to byte at given payload index.
-Example mask: 0x0f ignores payload changes in low nibble of the byte at given index.
-
-*** `interval`
-+
-Specifies if the event shall be debounced based on elapsed time interval.
-(valid values: _time in ms_, _never_).
-
-*** `on_change_resets_interval_` (optional)
-Specifies if interval timer is reset when payload change was detected.
-(valid values: _false_, _true_).
-
-* `routing`
-+
-The name of the application that is responsible for the routing.
-
-* `service-discovery`
-+
-Contains settings related to the Service Discovery of the host application.
-
-** `enable`
-+
-Specifies whether the Service Discovery is enabled (valid values: _true_,
-_false_). The default value is _true_.
-
-** `multicast`
-+
-The multicast address which the messages of the Service Discovery will be sent
-to. The default value is _224.0.0.1_.
-
-** `port`
-+
-The port of the Service Discovery. The default setting is _30490_.
-
-** `protocol`
-+
-The protocol that is used for sending the Service Discovery messages (valid
-values: _tcp_, _udp_). The default setting is _udp_.
-
-** `initial_delay_min`
-+
-Minimum delay before first offer message.
-
-** `initial_delay_max`
-+
-Maximum delay before first offer message.
-
-** `repetitions_base_delay`
-+
-Base delay sending offer messages within the repetition phase.
-
-** `repetitions_max`
-+
-Maximum number of repetitions for provided services within the
-repetition phase.
-
-** `ttl`
-+
-Lifetime of entries for provided services as well as consumed services and eventgroups.
-
-** `ttl_factor_offers` (optional array)
-+
-Array which holds correction factors for incoming remote offers. If a value
-greater than one is specified for a service instance, the TTL field of the
-corresponding service entry will be multiplied with the specified factor. +
-Example: An offer of a service is received with a TTL of 3 sec and the TTL
-factor is set to 5. The remote node stops offering the service w/o sending a
-StopOffer message. The service will then expire (marked as unavailable) 15 seconds
-after the last offer has been received.
-
-*** `service`
-+
-The id of the service.
-
-*** `instance`
-+
-The id of the service instance.
-
-*** `ttl_factor`
-+
-TTL correction factor
-
-** `ttl_factor_subscriptions` (optional array)
-+
-Array which holds correction factors for incoming remote subscriptions. If a
-value greater than one is specified for a service instance, the TTL field of the
-corresponding eventgroup entry will be multiplied with the specified factor. +
-Example: A remote subscription to an offered service is received with a TTL of 3
-sec and the TTL factor is set to 5. The remote node stops resubscribing to the
-service w/o sending a StopSubscribeEventgroup message. The subscription will
-then expire 15 seconds after the last resubscription has been received.
-
-*** `service`
-+
-The id of the service.
-
-*** `instance`
-+
-The id of the service instance.
-
-*** `ttl_factor`
-+
-TTL correction factor
-
-** `cyclic_offer_delay`
-+
-Cycle of the OfferService messages in the main phase.
-
-
-** `request_response_delay`
-+
-Minimum delay of a unicast message to a multicast message for
-provided services and eventgroups.
-+
-
-** `offer_debounce_time`
-+
-Time which the stack collects new service offers before they enter the
-repetition phase. This can be used to reduce the number of
-sent messages during startup. The default setting is _500ms_.
-+
-//Watchdog
-* anchor:config-watchdog[]'watchdog' (optional)
-+
-The Watchdog sends periodically pings to all known local clients.
-If a client isn't responding within a configurred time/amount of pongs
-the watchdog deregisters this application/client.
-If not configured the watchdog isn't activated.
-+
-** 'enable'
-+
-Specifies whether the watchdog is enabled or disabled.
-(valid values: _true, false_), (default is _false_).
-+
-** 'timeout'
-+
-Specifies the timeout in ms the watchdog gets activated if a ping
-isn't answered with a pong by a local client within that time.
-(valid values: _2 - 2^32_), (default is _5000_ ms).
-+
-** 'allowed_missing_pongs'
-+
-Specifies the amount of allowed missing pongs.
-(valid values: _1 - 2^32_), (default is _3_ pongs).
-+
-//CAPI-Selective Broadcasts support
-* anchor:config-supports_selective_broadcasts[]'supports_selective_broadcasts' (optional)
-+
-This nodes allow to add a list of IP addresses on which CAPI-Selective-Broadcasts feature is supported.
-If not specified the feature can't be used and the subscription behavior of the stack is same as with
-normal events.
-+
-** 'address'
-+
-Specifies an IP-Address (in IPv4 or IPv6 notation) on which the "selective"-feature is supported.
-Multiple addresses can be configuered.
-
-Security
---------
-vsomeip has a security implementation based on UNIX credentials.
-If activated every local connection is authenticated during connect using the standard UNIX credential passing mechanism.
-During authentification a client transfers its client identifier together with its credentials (UID / GID) to the server which is then matched against the configuration.
-If received credentials don't match the policy the socket will be immediately closed by the server and an message is logged.
-If accepted the client identifier is bound to the receiving socket and can therefore be used to do further security checks on incoming messages (vsomeip messages as well as internal commands).
-
-In general clients can be configured to be allowed/denied to request (means communicate with) and offer different service instances.
-Every incoming vsomeip message (request/response/notifcation) as well as offer service requests or local subscriptions are then checked against the policy.
-If an incoming vsomeip message or another operation (e.g. offer/subscribe) violates the configured policies it is skipped and a message is logged.
-
-Furthermore if an application receives informations about other clients/services in the system, it must be received from the authenticated routing manager.
-This is to avoid malicious applications faking the routing manager and therefore being able to wrongly inform other clients about services running on the system.
-Therefore, whenever the "security" tag is specified, the routing manager (e.g. vsomeipd) must be a configured application with a fixed client identifier.
-See chapter "Configuration File Structure" on how to configure an application to use a specific client identifier.
-
-Credential passing is only possible via Unix-Domain-Sockets and therefore only available for local communication.
-However if security is activated method calls from remote clients to local services are checked as well which means remote clients needs to be explicitly allowed.
-Such a policy looks same in case for local clients except the _credentials_ tag can be skipped.
-
-Security configuration
-~~~~~~~~~~~~~~~~~~~~~~
-The available configuration switches for the security feature are:
-
-// Security
-* anchor:config-policy[]'security' (optional)
-+
-If specified the credential passing mechanism is activated. However no credential or security checks are done as long as _check_credentials_ isn't set to _true_, but the routing manager client ID must be configured if security tag is specified and shall not be set to 0x6300.
-
-** 'check_credentials (optional)'
-+
-Specifies whether security checks are active or not. This includes credentials checks on connect as well as all policies checks configured in follow.
-(valid values: _true, false_), (default is _false_).
-
-** 'policies' (array)
-+
-Specifies the security policies. Each policy at least needs to specify _allow_ or _deny_.
-
-*** 'client' (optional)
-+
-Specifies a client for which a security policy will be applied (valid value: A valid client identifier in hex: e.g. _0x1234_).
-It is also possible to specify a client identifier range to easily apply a policy to a set of clients.
-A usecase is e.g. to allow a set of remote clients communicate with local services offered remote.
-+
-No client specification equals to any client (_0xFFFF_). Such policies are applied if a client has no specific policy.
-
-**** 'first'
-+
-Specifies the first client of a range (first is included).
-(valid value: A valid client identifier in hex: e.g. _0x1234_)
-
-**** 'last'
-+
-Specifies the last client id of a range (last is included).
-(valid value: A valid client identifier in hex: e.g. _0x1234_)
-
-*** 'credentials' (optional)
-+
-Specifies the credentials of the above client(s).
-If _check_credentials_ is set to _true_ the credentials for the above client(s) (if they running locally) needs to be specified correctly to ensure local socket authentification can succeed.
-This entry is optional due to the fact that remote clients needs to be configured as well to allow to communicate with local services as already mentioned above.
-For remote clients this entry should be skipped.
-
-**** 'uid'
-+
-Specifies the LINUX user id of the above client(s) as decimal number.
-As a wildcard "any" can be used.
-
-**** 'gid'
-+
-Specifies the LINUX group id of the above client(s) as decimal number.
-As a wildcard "any" can be used.
-
-**** 'allow/deny' (optional)
-+
-Specifies whether the LINUX user and group ids are allowed or denied for the policy.
-
-***** 'uid' (array)
-+
-Specifies a list of LINUX user ids. These may either be specified as decimal numbers or as ranges. Ranges
-are specified by the first and the last valid id (see example below).
-
-***** 'gid' (array)
-+
-Specifies a list of LINUX group ids. These may either be specified as decimal numbers or as ranges. Ranges
-are specified by the first and the last valid id (see example below).
-
-*** 'allow/deny'
-+
-This tag specifies either _allow_ or _deny_ depending on white- or blacklisting is needed. Specifing _allow_ and _deny_ entries in one policy is therefore not allowed.
-With _allow_ a whitelisting of what is allowed can be done which means an empty _allow_ tag implies everything is denied.
-With _deny_ a blacklisting of what is allowed can be done which means an empty _deny_ tag implies everything is allowed.
-
-**** 'requests' (array)
-+
-Specifies a set of serivce instance pairs which the above client(s) is allowed/denied to communicate with.
-
-***** 'service'
-+
-Specifies a service for the _requests_.
-
-***** 'instance'
-+
-Specifies a instance for the _requests_
-
-**** 'offers' (array)
-+
-Specifies a set of service instance pairs which are allowed/denied to be offered by the above client(s).
-
-***** 'service'
-+
-Specifies a service for the _offers_.
-
-***** 'instance'
-+
-Specifies a instance for the _offers_
-
-Security configuration example
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-[source, bash]
-----
-...
-"security" :
-{
- ...
- "policies" :
- [
- {
- ...
- "credentials" :
- {
- "uid" : "44",
- "gid" : "any"
- },
- "allow" :
- [
- "requests" :
- [
- {
- "service" : "0x6731",
- "instance" : "0x0001"
- }
- ]
- ]
- },
- {
- "credentials" :
- {
- "deny" :
- [
- {
- "uid" : [ "1000", { "first" : "1002", "last" : "max" }],
- "gid" : [ "0", { "first" : "100", "last" : "243" }, "300"]
- },
- {
- "uid" : "55",
- "gid" : "55"
- }
- ]
- },
- "allow" :
- [
- "requests" :
- [
- {
- "service" : "0x6732",
- "instance" : "0x0001"
- }
- ]
- ]
- }
- ]
-}
-----
-
-The config/ folder contains some addition vsomeip configuration files to run the vsomeip
-examples with activated security checks.
-Additionally there's a security test in the `test/` subfolder which can be used
-for further reference. +
-They give a basic overview how to use the security related configuration tags described
-in this chapter to run a simple request/response or subscribe/notify example locally or
-remotely.
-
-Audit Mode
-~~~~~~~~~~
-vsomeip's security implementation can be put in a so called 'Audit Mode' where
-all security violations will be logged but allowed. This mode can be used to
-build a security configuration.
-
-To activate the 'Audit Mode' the 'security' object has to be included in the
-json file but the 'check_credentials' switch has to be set to false. For
-example:
-
-[source, bash]
-----
- [...]
- "services" :
- [
- [...]
- ],
- "security" :
- {
- "check_credentials" : "false"
- },
- "routing" : "service-sample",
- [...]
-----
-
-Autoconfiguration
------------------
-vsomeip supports the automatic configuration of client identifiers and the routing.
-The first application that starts using vsomeip will automatically become the
-routing manager if it is _not_ explicitly configured. The client identifiers
-are generated from the diagnosis address that can be specified by defining
-DIAGNOSIS_ADDRESS when compiling vsomeip. vsomeip will use the diagnosis address
-as the high byte and enumerate the connecting applications within the low byte
-of the client identifier.
-
-Autoconfiguration of client identifiers isn't meant to be used together with vsomeip Security.
-Every client running locally needs to have at least its own credentials configured when security is activated to ensure the credential checks can pass.
-Practically that means if a client requests its identifier over the autoconfiguration for which no credentials are configured (at least it isn't known which client identifier is used beforehand) it is impossible for that client to establish a connection to a server endpoint.
-However if the credentials for all clients are same it's possible to configure them for the overall (or DIAGNOSIS_ADDRESS) client identifier range to mix autoconfiguration together with activated security.
-
-vsomeipd
---------
-The vsomeipd is a minimal vsomeip application intended to offer routing manager
-functionality on a node where one system wide configuration file is present.
-
-The vsomeipd uses the application name `vsomeipd` by default. This name can be
-overridden by specifying `-DROUTING=$DESIRED_NAME` during the cmake call.
-
-Example: Starting the daemon on a system where the system wide configuration is
-stored under `/etc/vsomeip.json`:
-[source, bash]
-----
-VSOMEIP_CONFIGURATION=/etc/vsomeip.json ./vsomeipd
-----
-
-When using the daemon it should be ensured that:
-
-* In the system wide configuration file the vsomeipd is defined as
- routing manager, meaning it contains the line `"routing" : "vsomeipd"`.
- If the default name is overridden the entry has to be adapted accordingly.
- The system wide configuration file should contain the information about all
- other offered services on the system as well.
-* There's no other vsomeip configuration file used on the system which contains
- a `"routing"` entry. As there can only be one routing manager per system.
-
-
-vsomeip Hello World
--------------------
-In this paragraph a Hello World program consisting out of a client and a service
-is developed. The client sends a message containing a string to the service.
-The service appends the received string to the string `Hello` and sends it back
-to the client.
-Upon receiving a response from the service the client prints the payload of the
-response ("Hello World").
-This example is intended to be run on the same host.
-
-All files listed here are contained in the `examples\hello_world` subdirectory.
-
-Build instructions
-~~~~~~~~~~~~~~~~~~
-The example can build with its own CMakeFile, please compile the vsomeip stack
-before hand as described in <<Compilation>>. Then compile the example starting
-from the repository root directory as followed:
-[source, bash]
-----
-cd examples/hello_world
-mkdir build
-cd build
-cmake ..
-make
-----
-
-Starting and expected output
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Starting and expected output of service
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-[source, bash]
-----
-$ VSOMEIP_CONFIGURATION=../helloworld-local.json \
- VSOMEIP_APPLICATION_NAME=hello_world_service \
- ./hello_world_service
-2015-04-01 11:31:13.248437 [info] Using configuration file: ../helloworld-local.json
-2015-04-01 11:31:13.248766 [debug] Routing endpoint at /tmp/vsomeip-0
-2015-04-01 11:31:13.248913 [info] Service Discovery disabled. Using static routing information.
-2015-04-01 11:31:13.248979 [debug] Application(hello_world_service, 4444) is initialized.
-2015-04-01 11:31:22.705010 [debug] Application/Client 5555 got registered!
-----
-
-Starting and expected output of client
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-[source, bash]
-----
-$ VSOMEIP_CONFIGURATION=../helloworld-local.json \
- VSOMEIP_APPLICATION_NAME=hello_world_client \
- ./hello_world_client
-2015-04-01 11:31:22.704166 [info] Using configuration file: ../helloworld-local.json
-2015-04-01 11:31:22.704417 [debug] Connecting to [0] at /tmp/vsomeip-0
-2015-04-01 11:31:22.704630 [debug] Listening at /tmp/vsomeip-5555
-2015-04-01 11:31:22.704680 [debug] Application(hello_world_client, 5555) is initialized.
-Sending: World
-Received: Hello World
-----
-
-CMakeFile
-~~~~~~~~~
-
-[source, bash]
-----
-include::../examples/hello_world/CMakeLists.txt[]
-----
-
-Configuration File For Client and Service
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-[source, bash]
-----
-include::../examples/hello_world/helloworld-local.json[]
-----
-
-Service
-~~~~~~~
-
-[source, bash]
-----
-include::../examples/hello_world/hello_world_service.cpp[]
-----
-
-The service example results in the following program execution:
-
-:numbered!:
-
-[float]
-
-Main
-^^^^^
-
-. __main()__
-+
-First the application is initialized. After the initialization is
-finished the application is started.
-
-[float]
-Initialization
-^^^^^^^^^^^^^^
-
-[start=2]
-. __init()__
-+
-The initialization contains the registration of a message
-handler and an event handler.
-+
-The message handler declares a callback (__on_message_cbk__) for messages that
-are sent to the specific service (specifying the service id, the service
-instance id and the service method id).
-+
-The event handler declares a callback (__on_event_cbk__) for events that occur.
-One event can be the successful registration of the application at the runtime.
-
-[float]
-Start
-^^^^^
-
-[start=3]
-. __start()__
-+
-The application will be started. This function only returns when the application
-will be stopped.
-
-[float]
-Callbacks
-^^^^^^^^^
-
-[start=4]
-. __on_state_cbk()__
-+
-This function is called by the application when an state change occurred. If
-the application was successfully registered at the runtime then the specific
-service is offered.
-
-. __on_message_cbk()__
-+
-This function is called when a message/request from a client for the specified
-service was received.
-+
-First a response based upon the request is created.
-Afterwards the string 'Hello' will be concatenated with the payload of the
-client's request.
-After that the payload of the response is created. The payload data is set with
-the previously concatenated string.
-Finally the response is sent back to the client and the application is stopped.
-
-[float]
-Stop
-^^^^
-
-[start=6]
-. __stop()__
-+
-This function stops offering the service, unregister the message and the event
-handler and shuts down the application.
-
-:numbered:
-
-Client
-~~~~~~
-[source, bash]
-----
-include::../examples/hello_world/hello_world_client.cpp[]
-----
-
-The client example results in the following program execution:
-
-:numbered!:
-
-[float]
-Main
-^^^^^
-
-. __main()__
-+
-First the application is initialized. After the initialization is finished the
-application is started.
-
-[float]
-Initialization
-^^^^^^^^^^^^^^
-
-[start=2]
-. __init()__
-+
-The initialization contains the registration of a message handler, an event
-handler and an availability handler.
-+
-The event handler declares again a callback (__on_state_cbk__) for state changes
-that occur.
-+
-The message handler declares a callback (__on_message_cbk__) for messages that
-are received from any service, any service instance and any method.
-+
-The availability handler declares a callback (__on_availability_cbk__) which is
-called when the specific service is available (specifying the service id and the
-service instance id).
-
-[float]
-Start
-^^^^^
-
-[start=3]
-. __start()__
-+
-The application will be started. This function only returns when the application
-will be stopped.
-
-[float]
-Callbacks
-^^^^^^^^^
-
-[start=4]
-. __on_state_cbk()__
-+
-
-This function is called by the application when an state change occurred. If the
-application was successfully registered at the runtime then the specific service
-is requested.
-
-. __on_availability_cbk()__
-+
-This function is called when the requested service is available or no longer
-available.
-+
-First there is a check if the change of the availability is related to the
-'hello world service' and the availability changed to true.
-If the check is successful a service request is created and the appropriate
-service information are set (service id, service instance id, service method
-id).
-After that the payload of the request is created. The data of the payload is
-'World' and will be set afterwards.
-Finally the request is sent to the service.
-
-. __on_message_cbk()__
-+
-This function is called when a message/response was received.
-If the response is from the requested service, of type 'RESPONSE' and the return
-code is 'OK' then the payload of the response is printed. Finally the
-application is stopped.
-
-[float]
-Stop
-^^^^
-
-[start=7]
-. __stop()__
-+
-This function unregister the event and the message handler and shuts down the
-application.
-
-:numbered:
-
-Trace Connector
----------------
-anchor:traceconnector[]
-
-Overview/Prerequisites
-~~~~~~~~~~~~~~~~~~~~~~
-
-The Trace Connector is used to forward the internal messages that are sent over
-the Unix Domain Sockets to DLT. +
-So a prerequisite is that DLT is installed and the module can be found in
-context of CMake.
-
-Configuration
-~~~~~~~~~~~~~
-
-Static Configuration
-^^^^^^^^^^^^^^^^^^^^
-
-The Trace Connector can be configured statically over the
-<<config-tracing,JSON configuration file>>. +
-
-[float]
-Example 1 (Minimal Configuration)
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-[source, bash]
-----
-{
- ...
-
- "tracing" :
- {
- "enable" : "true"
- },
-
- ...
-----
-
-This is the minimal configuration of the Trace Connector. This just enables the
-tracing and all of the sent internal messages will be traced/forwarded to DLT.
-
-[float]
-Example 2 (Using Filters)
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-[source, bash]
-----
-{
- ...
-
- "tracing" :
- {
- "enable" : "true",
- "channels" :
- [
- {
- "name" : "My channel",
- "id" : "MC"
- }
- ],
- "filters" : [
- {
- "channel" : "MC",
- "services" : [ "0x1234" ],
- "methods" : [ "0x80e8" ],
- "clients" : [ "0x1343" ],
- "type" : "positive"
- }
- ]
- },
-
- ...
-----
-
-You can apply filters to the messages. In this example only the messages that
-
-* are addressed to the service with the id _0x1234_
-+
-* relates to the method with the id _0x80e8_
-+
-* relates to the client with the id _0x1234_
-
-
-will be traced/forwarded to DLT. This is a kind of positive filtering. To
-exclude messages from tracing/forwarding to DLT, the filter type can be
-set to "negative". This would suppress the messages that relate to the
-specified service, method and client ids. The default filter type is
-psoitive. +
-The messages will be forwarded over the channel with the id _MC_. If
-just one filter is used, then the definition of a channel is optional.
-But if multiple filters are used, each filter needs an own channel! +
-In this example each criteria has only one expression/value but it's also possible
-to define multiple values to get a more fine-grained filter. +
-The ids of the filter criterias can be found in the appropriate _.fdepl_ files
-and in the rest of the configuration file. +
-
-Dynamic Configuration
-^^^^^^^^^^^^^^^^^^^^^
-
-The Trace Connector can also be configured dynamically over its interfaces.
-
-[float]
-Example:
-^^^^^^^^
-
-[source, bash]
-----
- // get trace connector
- std::shared_ptr<tc::trace_connector> its_trace_connector = tc::trace_connector::get();
-
- // add channel
- its_trace_connector->add_channel("MC", "My channel");
-
- //add filter rule
- tc::trace_connector::filter_rule_t its_filter_rule;
-
- its_filter_rule[tc::filter_criteria_e::SERVICES] = { 4660 };
-
- its_filter_rule[tc::filter_criteria_e::METHODS] = { 33000 };
- its_filter_rule[tc::filter_criteria_e::CLIENTS] = { 4931 };
-
- its_trace_connector->add_filter_rule("MC", its_filter_rule);
-
- // init trace connector
- its_trace_connector->init();
-
- // enable trace connector
- its_trace_connector->set_enabled(true);
-----
-
-Tools
------
-
-vsomeip_ctrl
-~~~~~~~~~~~~
-anchor:vsomeip_ctrl[]
-`vsomeip_ctrl` is a small utility which can be used to send SOME/IP messages
-from the commandline. If a response arrives within 5 seconds the response will
-be printed.
-
-* It can be build via `vsomeip_ctrl` make target (`make vsomeip_ctrl`).
-* The instance id of the target service has to be passed in hexadecimal
- notation.
-* The complete message has to be passed in hexadecimal notation.
-* See the `--help` parameter for available options.
-* If `vsomeip_ctrl` is used to send messages to a remote service and no
- `vsomeipd` is running on the local machine, make sure to pass a json
- configuration file where `vsomeip_ctrl` is set as routing manager via
- environment variable.
-* If `vsomeip_ctrl` is used to send messages to a local service and no
- `vsomeipd` is running on the local machine, make sure to use the same json
- configuration file as the local service.
-
-Example: Calling method with method id 0x80e8 on service with service id 0x1234,
-instance id 0x5678:
-[source, bash]
-----
-./vsomeip_ctrl --instance 5678 --message 123480e800000015134300030100000000000009efbbbf576f726c6400
-----
-
-Example: Sending a message to service with service id 0x1234, instance id
-0x5678 and method id 0x0bb8 via TCP
-[source, bash]
-----
-./vsomeip_ctrl --tcp --instance 5678 --message 12340bb8000000081344000101010000
-----
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
deleted file mode 100644
index 017c56d..0000000
--- a/examples/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2015-2017 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 2.8)
-
-set(EXAMPLE_CONFIG_FILES
- "../config/vsomeip.json"
- "../config/vsomeip-local.json"
- "../config/vsomeip-tcp-client.json"
- "../config/vsomeip-tcp-service.json"
- "../config/vsomeip-udp-client.json"
- "../config/vsomeip-udp-service.json"
-)
-
-# Examples
-add_executable(request-sample request-sample.cpp ${EXAMPLE_CONFIG_FILES})
-target_link_libraries(request-sample vsomeip ${Boost_LIBRARIES} ${DL_LIBRARY})
-
-add_executable(response-sample response-sample.cpp ${EXAMPLE_CONFIG_FILES})
-target_link_libraries(response-sample vsomeip ${Boost_LIBRARIES} ${DL_LIBRARY})
-
-add_executable(subscribe-sample subscribe-sample.cpp ${EXAMPLE_CONFIG_FILES})
-target_link_libraries(subscribe-sample vsomeip ${Boost_LIBRARIES} ${DL_LIBRARY})
-
-add_executable(notify-sample notify-sample.cpp ${EXAMPLE_CONFIG_FILES})
-target_link_libraries(notify-sample vsomeip ${Boost_LIBRARIES} ${DL_LIBRARY})
-
-add_dependencies(examples request-sample response-sample subscribe-sample notify-sample)
-
-install (
- TARGETS request-sample response-sample subscribe-sample notify-sample
- RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin
-)
-
-###################################################################################################
diff --git a/examples/hello_world/CMakeLists.txt b/examples/hello_world/CMakeLists.txt
deleted file mode 100644
index b7f7c78..0000000
--- a/examples/hello_world/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2015-2017 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 2.8.7)
-project (vSomeIPHelloWorld)
-
-# This will get us acces to
-# VSOMEIP_INCLUDE_DIRS - include directories for vSomeIP
-# VSOMEIP_LIBRARIES - libraries to link against
-find_package(vsomeip)
-if (NOT vsomeip_FOUND)
- message("vsomeip was not found. Please specify vsomeip_DIR")
-endif()
-
-find_package(Threads REQUIRED)
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-
-include_directories(${VSOMEIP_INCLUDE_DIRS})
-
-add_executable (hello_world_service hello_world_service.cpp)
-target_link_libraries(hello_world_service ${VSOMEIP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
-
-add_executable (hello_world_client hello_world_client.cpp)
-target_link_libraries(hello_world_client ${VSOMEIP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
diff --git a/examples/hello_world/hello_world_client.cpp b/examples/hello_world/hello_world_client.cpp
deleted file mode 100644
index cecdf67..0000000
--- a/examples/hello_world/hello_world_client.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright (C) 2015-2017 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_ENABLE_SIGNAL_HANDLING
-#include <csignal>
-#endif
-#include <vsomeip/vsomeip.hpp>
-#include <iostream>
-
-static vsomeip::service_t service_id = 0x1111;
-static vsomeip::instance_t service_instance_id = 0x2222;
-static vsomeip::method_t service_method_id = 0x3333;
-
-class hello_world_client {
-public:
- // Get the vSomeIP runtime and
- // create a application via the runtime, we could pass the application name
- // here otherwise the name supplied via the VSOMEIP_APPLICATION_NAME
- // environment variable is used
- hello_world_client() :
- rtm_(vsomeip::runtime::get()),
- app_(rtm_->create_application())
- {
- }
-
- bool init(){
- // init the application
- if (!app_->init()) {
- std::cerr << "Couldn't initialize application" << std::endl;
- return false;
- }
-
- // register a state handler to get called back after registration at the
- // runtime was successful
- app_->register_state_handler(
- std::bind(&hello_world_client::on_state_cbk, this,
- std::placeholders::_1));
-
- // register a callback for responses from the service
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- service_instance_id, vsomeip::ANY_METHOD,
- std::bind(&hello_world_client::on_message_cbk, this,
- std::placeholders::_1));
-
- // register a callback which is called as soon as the service is available
- app_->register_availability_handler(service_id, service_instance_id,
- std::bind(&hello_world_client::on_availability_cbk, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- return true;
- }
-
- void start()
- {
- // start the application and wait for the on_event callback to be called
- // this method only returns when app_->stop() is called
- app_->start();
- }
-
- void on_state_cbk(vsomeip::state_type_e _state)
- {
- if(_state == vsomeip::state_type_e::ST_REGISTERED)
- {
- // we are registered at the runtime now we can request the service
- // and wait for the on_availability callback to be called
- app_->request_service(service_id, service_instance_id);
- }
- }
-
- void on_availability_cbk(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available)
- {
- // Check if the available service is the the hello world service
- if(service_id == _service && service_instance_id == _instance
- && _is_available)
- {
- // The service is available then we send the request
- // Create a new request
- std::shared_ptr<vsomeip::message> rq = rtm_->create_request();
- // Set the hello world service as target of the request
- rq->set_service(service_id);
- rq->set_instance(service_instance_id);
- rq->set_method(service_method_id);
-
- // Create a payload which will be sent to the service
- std::shared_ptr<vsomeip::payload> pl = rtm_->create_payload();
- std::string str("World");
- std::vector<vsomeip::byte_t> pl_data(std::begin(str), std::end(str));
-
- pl->set_data(pl_data);
- rq->set_payload(pl);
- // Send the request to the service. Response will be delivered to the
- // registered message handler
- std::cout << "Sending: " << str << std::endl;
- app_->send(rq, true);
- }
- }
-
- void on_message_cbk(const std::shared_ptr<vsomeip::message> &_response)
- {
- if(service_id == _response->get_service()
- && service_instance_id == _response->get_instance()
- && vsomeip::message_type_e::MT_RESPONSE
- == _response->get_message_type()
- && vsomeip::return_code_e::E_OK == _response->get_return_code())
- {
- // Get the payload and print it
- std::shared_ptr<vsomeip::payload> pl = _response->get_payload();
- std::string resp = std::string(
- reinterpret_cast<const char*>(pl->get_data()), 0,
- pl->get_length());
- std::cout << "Received: " << resp << std::endl;
- stop();
- }
- }
-
- void stop()
- {
- // unregister the state handler
- app_->unregister_state_handler();
- // unregister the message handler
- app_->unregister_message_handler(vsomeip::ANY_SERVICE,
- service_instance_id, vsomeip::ANY_METHOD);
- // alternatively unregister all registered handlers at once
- app_->clear_all_handler();
- // release the service
- app_->release_service(service_id, service_instance_id);
- // shutdown the application
- app_->stop();
- }
-
-private:
- std::shared_ptr<vsomeip::runtime> rtm_;
- std::shared_ptr<vsomeip::application> app_;
-};
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
-hello_world_client *hw_cl_ptr(nullptr);
- void handle_signal(int _signal) {
- if (hw_cl_ptr != nullptr &&
- (_signal == SIGINT || _signal == SIGTERM))
- hw_cl_ptr->stop();
- }
-#endif
-
-int main(int argc, char **argv)
-{
- hello_world_client hw_cl;
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- hw_cl_ptr = &hw_cl;
- signal(SIGINT, handle_signal);
- signal(SIGTERM, handle_signal);
-#endif
- if (hw_cl.init()) {
- hw_cl.start();
- return 0;
- } else {
- return 1;
- }
-}
diff --git a/examples/hello_world/hello_world_service.cpp b/examples/hello_world/hello_world_service.cpp
deleted file mode 100644
index 7af031c..0000000
--- a/examples/hello_world/hello_world_service.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright (C) 2015-2017 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_ENABLE_SIGNAL_HANDLING
-#include <csignal>
-#endif
-#include <vsomeip/vsomeip.hpp>
-#include <chrono>
-#include <thread>
-#include <condition_variable>
-#include <mutex>
-#include <iostream>
-
-static vsomeip::service_t service_id = 0x1111;
-static vsomeip::instance_t service_instance_id = 0x2222;
-static vsomeip::method_t service_method_id = 0x3333;
-
-class hello_world_service {
-public:
- // Get the vSomeIP runtime and
- // create a application via the runtime, we could pass the application name
- // here otherwise the name supplied via the VSOMEIP_APPLICATION_NAME
- // environment variable is used
- hello_world_service() :
- rtm_(vsomeip::runtime::get()),
- app_(rtm_->create_application()),
- stop_(false),
- stop_thread_(std::bind(&hello_world_service::stop, this))
- {
- }
-
- ~hello_world_service()
- {
- stop_thread_.join();
- }
-
- bool init()
- {
- // init the application
- if (!app_->init()) {
- std::cerr << "Couldn't initialize application" << std::endl;
- return false;
- }
-
- // register a message handler callback for messages sent to our service
- app_->register_message_handler(service_id, service_instance_id,
- service_method_id,
- std::bind(&hello_world_service::on_message_cbk, this,
- std::placeholders::_1));
-
- // register a state handler to get called back after registration at the
- // runtime was successful
- app_->register_state_handler(
- std::bind(&hello_world_service::on_state_cbk, this,
- std::placeholders::_1));
- return true;
- }
-
- void start()
- {
- // start the application and wait for the on_event callback to be called
- // this method only returns when app_->stop() is called
- app_->start();
- }
-
- void stop()
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while(!stop_) {
- condition_.wait(its_lock);
- }
- std::this_thread::sleep_for(std::chrono::seconds(5));
- // Stop offering the service
- app_->stop_offer_service(service_id, service_instance_id);
- // unregister the state handler
- app_->unregister_state_handler();
- // unregister the message handler
- app_->unregister_message_handler(service_id, service_instance_id,
- service_method_id);
- // shutdown the application
- app_->stop();
- }
-
- void terminate() {
- std::lock_guard<std::mutex> its_lock(mutex_);
- stop_ = true;
- condition_.notify_one();
- }
-
- void on_state_cbk(vsomeip::state_type_e _state)
- {
- if(_state == vsomeip::state_type_e::ST_REGISTERED)
- {
- // we are registered at the runtime and can offer our service
- app_->offer_service(service_id, service_instance_id);
- }
- }
-
- void on_message_cbk(const std::shared_ptr<vsomeip::message> &_request)
- {
- // Create a response based upon the request
- std::shared_ptr<vsomeip::message> resp = rtm_->create_response(_request);
-
- // Construct string to send back
- std::string str("Hello ");
- str.append(
- reinterpret_cast<const char*>(_request->get_payload()->get_data()),
- 0, _request->get_payload()->get_length());
-
- // Create a payload which will be sent back to the client
- std::shared_ptr<vsomeip::payload> resp_pl = rtm_->create_payload();
- std::vector<vsomeip::byte_t> pl_data(str.begin(), str.end());
- resp_pl->set_data(pl_data);
- resp->set_payload(resp_pl);
-
- // Send the response back
- app_->send(resp, true);
- // we have finished
- terminate();
- }
-
-private:
- std::shared_ptr<vsomeip::runtime> rtm_;
- std::shared_ptr<vsomeip::application> app_;
- bool stop_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::thread stop_thread_;
-};
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
-hello_world_service *hw_srv_ptr(nullptr);
- void handle_signal(int _signal) {
- if (hw_srv_ptr != nullptr &&
- (_signal == SIGINT || _signal == SIGTERM))
- hw_srv_ptr->terminate();
- }
-#endif
-
-int main(int argc, char **argv)
-{
- hello_world_service hw_srv;
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- hw_srv_ptr = &hw_srv;
- signal(SIGINT, handle_signal);
- signal(SIGTERM, handle_signal);
-#endif
- if (hw_srv.init()) {
- hw_srv.start();
- return 0;
- } else {
- return 1;
- }
-}
diff --git a/examples/hello_world/helloworld-local.json b/examples/hello_world/helloworld-local.json
deleted file mode 100644
index 5aeebb7..0000000
--- a/examples/hello_world/helloworld-local.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "unicast":"134.86.56.94",
- "logging":
- {
- "level":"debug",
- "console":"true"
- },
-
- "applications":
- [
- {
- "name":"hello_world_service",
- "id":"0x4444"
- },
-
- {
- "name":"hello_world_client",
- "id":"0x5555"
- }
- ],
-
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x2222",
- "unreliable":"30509"
- }
- ],
-
- "routing":"hello_world_service",
- "service-discovery":
- {
- "enable":"false"
- }
-}
diff --git a/examples/hello_world/readme b/examples/hello_world/readme
deleted file mode 100644
index 3e1dc62..0000000
--- a/examples/hello_world/readme
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (C) 2015-2017 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/.
-
-Build instructions for Hello World example
-------------------------------------------
-
-mkdir build
-cd build
-cmake ..
-make
-
-Running Hello World Example
----------------------------
-
-The Hello World Example should be run on the same host.
-The network addresses within the configuration files need to be adapted to match
-the devices addresses.
-
-To start the hello world client and service from their build-directory do:
-
-HOST1:
-VSOMEIP_CONFIGURATION=../helloworld-local.json \
-VSOMEIP_APPLICATION_NAME=hello_world_service \
-./hello_world_service
-
-HOST1:
-VSOMEIP_CONFIGURATION=../helloworld-local.json \
-VSOMEIP_APPLICATION_NAME=hello_world_client \
-./hello_world_client
-
-Expected output service
------------------------
-2015-04-01 11:31:13.248437 [info] Using configuration file: ../helloworld-local.json
-2015-04-01 11:31:13.248766 [debug] Routing endpoint at /tmp/vsomeip-0
-2015-04-01 11:31:13.248913 [info] Service Discovery disabled. Using static routing information.
-2015-04-01 11:31:13.248979 [debug] Application(hello_world_service, 4444) is initialized.
-2015-04-01 11:31:22.705010 [debug] Application/Client 5555 got registered!
-
-Expected output client
-----------------------
-2015-04-01 11:31:22.704166 [info] Using configuration file: ../helloworld-local.json
-2015-04-01 11:31:22.704417 [debug] Connecting to [0] at /tmp/vsomeip-0
-2015-04-01 11:31:22.704630 [debug] Listening at /tmp/vsomeip-5555
-2015-04-01 11:31:22.704680 [debug] Application(hello_world_client, 5555) is initialized.
-Sending: World
-Received: Hello World
diff --git a/examples/notify-sample.cpp b/examples/notify-sample.cpp
deleted file mode 100644
index 1bcd219..0000000
--- a/examples/notify-sample.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (C) 2014-2017 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_ENABLE_SIGNAL_HANDLING
-#include <csignal>
-#endif
-#include <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "sample-ids.hpp"
-
-class service_sample {
-public:
- service_sample(bool _use_tcp, uint32_t _cycle) :
- app_(vsomeip::runtime::get()->create_application()),
- is_registered_(false),
- use_tcp_(_use_tcp),
- cycle_(_cycle),
- blocked_(false),
- running_(true),
- is_offered_(false),
- offer_thread_(std::bind(&service_sample::run, this)),
- notify_thread_(std::bind(&service_sample::notify, this)) {
- }
-
- bool init() {
- std::lock_guard<std::mutex> its_lock(mutex_);
-
- if (!app_->init()) {
- std::cerr << "Couldn't initialize application" << std::endl;
- return false;
- }
- app_->register_state_handler(
- std::bind(&service_sample::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(
- SAMPLE_SERVICE_ID,
- SAMPLE_INSTANCE_ID,
- SAMPLE_GET_METHOD_ID,
- std::bind(&service_sample::on_get, this,
- std::placeholders::_1));
-
- app_->register_message_handler(
- SAMPLE_SERVICE_ID,
- SAMPLE_INSTANCE_ID,
- SAMPLE_SET_METHOD_ID,
- std::bind(&service_sample::on_set, this,
- std::placeholders::_1));
-
- std::set<vsomeip::eventgroup_t> its_groups;
- its_groups.insert(SAMPLE_EVENTGROUP_ID);
- app_->offer_event(
- SAMPLE_SERVICE_ID,
- SAMPLE_INSTANCE_ID,
- SAMPLE_EVENT_ID,
- its_groups,
- true);
- payload_ = vsomeip::runtime::get()->create_payload();
-
- blocked_ = true;
- condition_.notify_one();
- return true;
- }
-
- void start() {
- app_->start();
- }
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- /*
- * Handle signal to shutdown
- */
- void stop() {
- running_ = false;
- blocked_ = true;
- condition_.notify_one();
- notify_condition_.notify_one();
- app_->clear_all_handler();
- stop_offer();
- offer_thread_.join();
- notify_thread_.join();
- app_->stop();
- }
-#endif
-
- void offer() {
- std::lock_guard<std::mutex> its_lock(notify_mutex_);
- app_->offer_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
- is_offered_ = true;
- notify_condition_.notify_one();
- }
-
- void stop_offer() {
- app_->stop_offer_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
- is_offered_ = false;
- }
-
- void on_state(vsomeip::state_type_e _state) {
- std::cout << "Application " << app_->get_name() << " is "
- << (_state == vsomeip::state_type_e::ST_REGISTERED ?
- "registered." : "deregistered.") << std::endl;
-
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- if (!is_registered_) {
- is_registered_ = true;
- }
- } else {
- is_registered_ = false;
- }
- }
-
- void on_get(const std::shared_ptr<vsomeip::message> &_message) {
- std::shared_ptr<vsomeip::message> its_response
- = vsomeip::runtime::get()->create_response(_message);
- its_response->set_payload(payload_);
- app_->send(its_response, true);
- }
-
- void on_set(const std::shared_ptr<vsomeip::message> &_message) {
- payload_ = _message->get_payload();
-
- std::shared_ptr<vsomeip::message> its_response
- = vsomeip::runtime::get()->create_response(_message);
- its_response->set_payload(payload_);
- app_->send(its_response, true);
- app_->notify(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID,
- SAMPLE_EVENT_ID, payload_);
- }
-
- void run() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- condition_.wait(its_lock);
-
- bool is_offer(true);
- while (running_) {
- if (is_offer)
- offer();
- else
- stop_offer();
-
- for (int i = 0; i < 10 && running_; i++)
- std::this_thread::sleep_for(std::chrono::milliseconds(1000));
-
- is_offer = !is_offer;
- }
- }
-
- void notify() {
- std::shared_ptr<vsomeip::message> its_message
- = vsomeip::runtime::get()->create_request(use_tcp_);
-
- its_message->set_service(SAMPLE_SERVICE_ID);
- its_message->set_instance(SAMPLE_INSTANCE_ID);
- its_message->set_method(SAMPLE_SET_METHOD_ID);
-
- vsomeip::byte_t its_data[10];
- uint32_t its_size = 1;
-
- while (running_) {
- std::unique_lock<std::mutex> its_lock(notify_mutex_);
- while (!is_offered_ && running_)
- notify_condition_.wait(its_lock);
- while (is_offered_ && running_) {
- if (its_size == sizeof(its_data))
- its_size = 1;
-
- for (uint32_t i = 0; i < its_size; ++i)
- its_data[i] = static_cast<uint8_t>(i);
-
- payload_->set_data(its_data, its_size);
-
- std::cout << "Setting event (Length=" << std::dec << its_size << ")." << std::endl;
- app_->notify(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, payload_);
-
- its_size++;
-
- std::this_thread::sleep_for(std::chrono::milliseconds(cycle_));
- }
- }
- }
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
- bool use_tcp_;
- uint32_t cycle_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- bool running_;
-
- std::mutex notify_mutex_;
- std::condition_variable notify_condition_;
- bool is_offered_;
-
- std::shared_ptr<vsomeip::payload> payload_;
-
- // blocked_ / is_offered_ must be initialized before starting the threads!
- std::thread offer_thread_;
- std::thread notify_thread_;
-};
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- service_sample *its_sample_ptr(nullptr);
- void handle_signal(int _signal) {
- if (its_sample_ptr != nullptr &&
- (_signal == SIGINT || _signal == SIGTERM))
- its_sample_ptr->stop();
- }
-#endif
-
-int main(int argc, char **argv) {
- bool use_tcp = false;
- uint32_t cycle = 1000; // default 1s
-
- std::string tcp_enable("--tcp");
- std::string udp_enable("--udp");
- std::string cycle_arg("--cycle");
-
- for (int i = 1; i < argc; i++) {
- if (tcp_enable == argv[i]) {
- use_tcp = true;
- break;
- }
- if (udp_enable == argv[i]) {
- use_tcp = false;
- break;
- }
-
- if (cycle_arg == argv[i] && i + 1 < argc) {
- i++;
- std::stringstream converter;
- converter << argv[i];
- converter >> cycle;
- }
- }
-
- service_sample its_sample(use_tcp, cycle);
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- its_sample_ptr = &its_sample;
- signal(SIGINT, handle_signal);
- signal(SIGTERM, handle_signal);
-#endif
- if (its_sample.init()) {
- its_sample.start();
- return 0;
- } else {
- return 1;
- }
-}
diff --git a/examples/readme.txt b/examples/readme.txt
deleted file mode 100644
index 219df9b..0000000
--- a/examples/readme.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (C) 2014-2017 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/.
-
-To use the example applications you need two devices on the same network. The network addresses within
-the configuration files need to be adapted to match the devices addresses.
-
-To start the request/response-example from the build-directory do:
-
-HOST1: env VSOMEIP_CONFIGURATION=../../config/vsomeip-local.json VSOMEIP_APPLICATION_NAME=client-sample ./request-sample
-HOST1: env VSOMEIP_CONFIGURATION=../../config/vsomeip-local.json VSOMEIP_APPLICATION_NAME=service-sample ./response-sample
-
-To start the subscribe/notify-example from the build-directory do:
-
-HOST1: env VSOMEIP_CONFIGURATION=../../config/vsomeip-local.json VSOMEIP_APPLICATION_NAME=client-sample ./subscribe-sample
-HOST1: env VSOMEIP_CONFIGURATION=../../config/vsomeip-local.json VSOMEIP_APPLICATION_NAME=service-sample ./notify-sample
diff --git a/examples/request-sample.cpp b/examples/request-sample.cpp
deleted file mode 100644
index 7732cb0..0000000
--- a/examples/request-sample.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-// Copyright (C) 2014-2017 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_ENABLE_SIGNAL_HANDLING
-#include <csignal>
-#endif
-#include <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "sample-ids.hpp"
-
-class client_sample {
-public:
- client_sample(bool _use_tcp, bool _be_quiet, uint32_t _cycle)
- : app_(vsomeip::runtime::get()->create_application()),
- request_(vsomeip::runtime::get()->create_request(_use_tcp)),
- use_tcp_(_use_tcp),
- be_quiet_(_be_quiet),
- cycle_(_cycle),
- running_(true),
- blocked_(false),
- is_available_(false),
- sender_(std::bind(&client_sample::run, this)) {
- }
-
- bool init() {
- if (!app_->init()) {
- std::cerr << "Couldn't initialize application" << std::endl;
- return false;
- }
-
- std::cout << "Client settings [protocol="
- << (use_tcp_ ? "TCP" : "UDP")
- << ":quiet="
- << (be_quiet_ ? "true" : "false")
- << ":cycle="
- << cycle_
- << "]"
- << std::endl;
-
- app_->register_state_handler(
- std::bind(
- &client_sample::on_state,
- this,
- std::placeholders::_1));
-
- app_->register_message_handler(
- vsomeip::ANY_SERVICE, SAMPLE_INSTANCE_ID, vsomeip::ANY_METHOD,
- std::bind(&client_sample::on_message,
- this,
- std::placeholders::_1));
-
- request_->set_service(SAMPLE_SERVICE_ID);
- request_->set_instance(SAMPLE_INSTANCE_ID);
- request_->set_method(SAMPLE_METHOD_ID);
-
- std::shared_ptr< vsomeip::payload > its_payload = vsomeip::runtime::get()->create_payload();
- std::vector< vsomeip::byte_t > its_payload_data;
- for (std::size_t i = 0; i < 10; ++i) its_payload_data.push_back(i % 256);
- its_payload->set_data(its_payload_data);
- request_->set_payload(its_payload);
-
- app_->register_availability_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID,
- std::bind(&client_sample::on_availability,
- this,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
-
- app_->register_availability_handler(SAMPLE_SERVICE_ID + 1, SAMPLE_INSTANCE_ID,
- std::bind(&client_sample::on_availability,
- this,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
- return true;
- }
-
- void start() {
- app_->start();
- }
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- /*
- * Handle signal to shutdown
- */
- void stop() {
- running_ = false;
- blocked_ = true;
- app_->clear_all_handler();
- app_->release_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
- condition_.notify_one();
- sender_.join();
- app_->stop();
- }
-#endif
-
- void on_state(vsomeip::state_type_e _state) {
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- app_->request_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
- }
- }
-
- void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
- std::cout << "Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is "
- << (_is_available ? "available." : "NOT available.")
- << std::endl;
-
- if (SAMPLE_SERVICE_ID == _service && SAMPLE_INSTANCE_ID == _instance) {
- if (is_available_ && !_is_available) {
- is_available_ = false;
- } else if (_is_available && !is_available_) {
- is_available_ = true;
- send();
- }
- }
- }
-
- void on_message(const std::shared_ptr< vsomeip::message > &_response) {
- std::cout << "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()
- << "]"
- << std::endl;
- if (is_available_)
- send();
- }
-
- void send() {
- if (!be_quiet_)
- {
- std::lock_guard< std::mutex > its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
- }
-
- void run() {
- while (running_) {
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_) condition_.wait(its_lock);
- if (is_available_) {
- app_->send(request_, true);
- std::cout << "Client/Session ["
- << std::setw(4) << std::setfill('0') << std::hex << request_->get_client()
- << "/"
- << std::setw(4) << std::setfill('0') << std::hex << request_->get_session()
- << "] sent a request to Service ["
- << std::setw(4) << std::setfill('0') << std::hex << request_->get_service()
- << "."
- << std::setw(4) << std::setfill('0') << std::hex << request_->get_instance()
- << "]"
- << std::endl;
- blocked_ = false;
- }
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(cycle_));
- }
- }
-
-private:
- std::shared_ptr< vsomeip::application > app_;
- std::shared_ptr< vsomeip::message > request_;
- bool use_tcp_;
- bool be_quiet_;
- uint32_t cycle_;
- vsomeip::session_t session_;
- std::mutex mutex_;
- std::condition_variable condition_;
- bool running_;
- bool blocked_;
- bool is_available_;
-
- std::thread sender_;
-};
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- client_sample *its_sample_ptr(nullptr);
- void handle_signal(int _signal) {
- if (its_sample_ptr != nullptr &&
- (_signal == SIGINT || _signal == SIGTERM))
- its_sample_ptr->stop();
- }
-#endif
-
-int main(int argc, char **argv) {
- bool use_tcp = false;
- bool be_quiet = false;
- uint32_t cycle = 1000; // Default: 1s
-
- std::string tcp_enable("--tcp");
- std::string udp_enable("--udp");
- std::string quiet_enable("--quiet");
- std::string cycle_arg("--cycle");
-
- int i = 1;
- while (i < argc) {
- if (tcp_enable == argv[i]) {
- use_tcp = true;
- } else if (udp_enable == argv[i]) {
- use_tcp = false;
- } else if (quiet_enable == argv[i]) {
- be_quiet = true;
- } else if (cycle_arg == argv[i] && i+1 < argc) {
- i++;
- std::stringstream converter;
- converter << argv[i];
- converter >> cycle;
- }
- i++;
- }
-
- client_sample its_sample(use_tcp, be_quiet, cycle);
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- its_sample_ptr = &its_sample;
- signal(SIGINT, handle_signal);
- signal(SIGTERM, handle_signal);
-#endif
- if (its_sample.init()) {
- its_sample.start();
- return 0;
- } else {
- return 1;
- }
-}
diff --git a/examples/response-sample.cpp b/examples/response-sample.cpp
deleted file mode 100644
index b4b6250..0000000
--- a/examples/response-sample.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (C) 2014-2017 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_ENABLE_SIGNAL_HANDLING
-#include <csignal>
-#endif
-#include <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "sample-ids.hpp"
-
-class service_sample {
-public:
- service_sample(bool _use_static_routing) :
- app_(vsomeip::runtime::get()->create_application()),
- is_registered_(false),
- use_static_routing_(_use_static_routing),
- blocked_(false),
- running_(true),
- offer_thread_(std::bind(&service_sample::run, this)) {
- }
-
- bool init() {
- std::lock_guard<std::mutex> its_lock(mutex_);
-
- if (!app_->init()) {
- std::cerr << "Couldn't initialize application" << std::endl;
- return false;
- }
- app_->register_state_handler(
- std::bind(&service_sample::on_state, this,
- std::placeholders::_1));
- app_->register_message_handler(
- SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_METHOD_ID,
- std::bind(&service_sample::on_message, this,
- std::placeholders::_1));
-
- std::cout << "Static routing " << (use_static_routing_ ? "ON" : "OFF")
- << std::endl;
- return true;
- }
-
- void start() {
- app_->start();
- }
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- /*
- * Handle signal to shutdown
- */
- void stop() {
- running_ = false;
- blocked_ = true;
- app_->clear_all_handler();
- stop_offer();
- condition_.notify_one();
- offer_thread_.join();
- app_->stop();
- }
-#endif
-
- void offer() {
- app_->offer_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
- app_->offer_service(SAMPLE_SERVICE_ID + 1, SAMPLE_INSTANCE_ID);
- }
-
- void stop_offer() {
- app_->stop_offer_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
- app_->stop_offer_service(SAMPLE_SERVICE_ID + 1, SAMPLE_INSTANCE_ID);
- }
-
- void on_state(vsomeip::state_type_e _state) {
- std::cout << "Application " << app_->get_name() << " is "
- << (_state == vsomeip::state_type_e::ST_REGISTERED ?
- "registered." : "deregistered.")
- << std::endl;
-
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- if (!is_registered_) {
- is_registered_ = true;
- blocked_ = true;
- condition_.notify_one();
- }
- } else {
- is_registered_ = false;
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_request) {
- std::cout << "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() << "]"
- << std::endl;
-
- std::shared_ptr<vsomeip::message> its_response
- = vsomeip::runtime::get()->create_response(_request);
-
- std::shared_ptr<vsomeip::payload> its_payload
- = vsomeip::runtime::get()->create_payload();
- std::vector<vsomeip::byte_t> its_payload_data;
- for (std::size_t i = 0; i < 120; ++i)
- its_payload_data.push_back(i % 256);
- its_payload->set_data(its_payload_data);
- its_response->set_payload(its_payload);
-
- app_->send(its_response, true);
- }
-
- void run() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- condition_.wait(its_lock);
-
- bool is_offer(true);
-
- if (use_static_routing_) {
- offer();
- while (running_);
- } else {
- while (running_) {
- if (is_offer)
- offer();
- else
- stop_offer();
-
- for (int i = 0; i < 10 && running_; i++)
- std::this_thread::sleep_for(std::chrono::milliseconds(1000));
- is_offer = !is_offer;
- }
- }
- }
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
- bool use_static_routing_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- bool running_;
-
- // blocked_ must be initialized before the thread is started.
- std::thread offer_thread_;
-};
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- service_sample *its_sample_ptr(nullptr);
- void handle_signal(int _signal) {
- if (its_sample_ptr != nullptr &&
- (_signal == SIGINT || _signal == SIGTERM))
- its_sample_ptr->stop();
- }
-#endif
-
-int main(int argc, char **argv) {
- bool use_static_routing(false);
-
- std::string static_routing_enable("--static-routing");
-
- for (int i = 1; i < argc; i++) {
- if (static_routing_enable == argv[i]) {
- use_static_routing = true;
- }
- }
-
- service_sample its_sample(use_static_routing);
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- its_sample_ptr = &its_sample;
- signal(SIGINT, handle_signal);
- signal(SIGTERM, handle_signal);
-#endif
- if (its_sample.init()) {
- its_sample.start();
- return 0;
- } else {
- return 1;
- }
-}
diff --git a/examples/sample-ids.hpp b/examples/sample-ids.hpp
deleted file mode 100644
index 6d31131..0000000
--- a/examples/sample-ids.hpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2014-2017 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_EXAMPLES_SAMPLE_IDS_HPP
-#define VSOMEIP_EXAMPLES_SAMPLE_IDS_HPP
-
-#define SAMPLE_SERVICE_ID 0x1234
-#define SAMPLE_INSTANCE_ID 0x5678
-#define SAMPLE_METHOD_ID 0x0421
-
-#define SAMPLE_EVENT_ID 0x8778
-#define SAMPLE_GET_METHOD_ID 0x0001
-#define SAMPLE_SET_METHOD_ID 0x0002
-
-#define SAMPLE_EVENTGROUP_ID 0x4465
-
-#define OTHER_SAMPLE_SERVICE_ID 0x0248
-#define OTHER_SAMPLE_INSTANCE_ID 0x5422
-#define OTHER_SAMPLE_METHOD_ID 0x1421
-
-#endif // VSOMEIP_EXAMPLES_SAMPLE_IDS_HPP
diff --git a/examples/subscribe-sample.cpp b/examples/subscribe-sample.cpp
deleted file mode 100644
index 5350263..0000000
--- a/examples/subscribe-sample.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-// Copyright (C) 2014-2017 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_ENABLE_SIGNAL_HANDLING
-#include <csignal>
-#endif
-#include <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "sample-ids.hpp"
-
-class client_sample {
-public:
- client_sample(bool _use_tcp) :
- app_(vsomeip::runtime::get()->create_application()), use_tcp_(
- _use_tcp) {
- }
-
- bool init() {
- if (!app_->init()) {
- std::cerr << "Couldn't initialize application" << std::endl;
- return false;
- }
- std::cout << "Client settings [protocol="
- << (use_tcp_ ? "TCP" : "UDP")
- << "]"
- << std::endl;
-
- app_->register_state_handler(
- std::bind(&client_sample::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(
- vsomeip::ANY_SERVICE, SAMPLE_INSTANCE_ID, vsomeip::ANY_METHOD,
- std::bind(&client_sample::on_message, this,
- std::placeholders::_1));
-
- app_->register_availability_handler(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID,
- std::bind(&client_sample::on_availability,
- this,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
-
- std::set<vsomeip::eventgroup_t> its_groups;
- its_groups.insert(SAMPLE_EVENTGROUP_ID);
- app_->request_event(
- SAMPLE_SERVICE_ID,
- SAMPLE_INSTANCE_ID,
- SAMPLE_EVENT_ID,
- its_groups,
- true);
- app_->subscribe(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENTGROUP_ID);
-
- return true;
- }
-
- void start() {
- app_->start();
- }
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- /*
- * Handle signal to shutdown
- */
- void stop() {
- app_->clear_all_handler();
- app_->unsubscribe(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENTGROUP_ID);
- app_->release_event(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID);
- app_->release_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
- app_->stop();
- }
-#endif
-
- void on_state(vsomeip::state_type_e _state) {
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- app_->request_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
- }
- }
-
- void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
- std::cout << "Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is "
- << (_is_available ? "available." : "NOT available.")
- << std::endl;
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_response) {
- std::stringstream its_message;
- its_message << "Received a notification for Event ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _response->get_service() << "."
- << std::setw(4) << std::setfill('0') << std::hex
- << _response->get_instance() << "."
- << std::setw(4) << std::setfill('0') << std::hex
- << _response->get_method() << "] 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()
- << "] = ";
- std::shared_ptr<vsomeip::payload> its_payload =
- _response->get_payload();
- its_message << "(" << std::dec << its_payload->get_length() << ") ";
- for (uint32_t i = 0; i < its_payload->get_length(); ++i)
- its_message << std::hex << std::setw(2) << std::setfill('0')
- << (int) its_payload->get_data()[i] << " ";
- std::cout << its_message.str() << std::endl;
-
- if (_response->get_client() == 0) {
- if ((its_payload->get_length() % 5) == 0) {
- std::shared_ptr<vsomeip::message> its_get
- = vsomeip::runtime::get()->create_request();
- its_get->set_service(SAMPLE_SERVICE_ID);
- its_get->set_instance(SAMPLE_INSTANCE_ID);
- its_get->set_method(SAMPLE_GET_METHOD_ID);
- its_get->set_reliable(use_tcp_);
- app_->send(its_get, true);
- }
-
- if ((its_payload->get_length() % 8) == 0) {
- std::shared_ptr<vsomeip::message> its_set
- = vsomeip::runtime::get()->create_request();
- its_set->set_service(SAMPLE_SERVICE_ID);
- its_set->set_instance(SAMPLE_INSTANCE_ID);
- its_set->set_method(SAMPLE_SET_METHOD_ID);
- its_set->set_reliable(use_tcp_);
-
- const vsomeip::byte_t its_data[]
- = { 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x50, 0x51, 0x52 };
- std::shared_ptr<vsomeip::payload> its_set_payload
- = vsomeip::runtime::get()->create_payload();
- its_set_payload->set_data(its_data, sizeof(its_data));
- its_set->set_payload(its_set_payload);
- app_->send(its_set, true);
- }
- }
- }
-
-private:
- std::shared_ptr< vsomeip::application > app_;
- bool use_tcp_;
-};
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- client_sample *its_sample_ptr(nullptr);
- void handle_signal(int _signal) {
- if (its_sample_ptr != nullptr &&
- (_signal == SIGINT || _signal == SIGTERM))
- its_sample_ptr->stop();
- }
-#endif
-
-int main(int argc, char **argv) {
- bool use_tcp = false;
-
- std::string tcp_enable("--tcp");
- std::string udp_enable("--udp");
-
- int i = 1;
- while (i < argc) {
- if (tcp_enable == argv[i]) {
- use_tcp = true;
- } else if (udp_enable == argv[i]) {
- use_tcp = false;
- }
- i++;
- }
-
- client_sample its_sample(use_tcp);
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- its_sample_ptr = &its_sample;
- signal(SIGINT, handle_signal);
- signal(SIGTERM, handle_signal);
-#endif
- if (its_sample.init()) {
- its_sample.start();
- return 0;
- } else {
- return 1;
- }
-}
diff --git a/exportmap.gcc b/exportmap.gcc
deleted file mode 100644
index 61da700..0000000
--- a/exportmap.gcc
+++ /dev/null
@@ -1,47 +0,0 @@
-{
-global:
- extern "C++" {
- *vsomeip::configuration;
- vsomeip::configuration::*;
- *vsomeip::cfg::configuration_impl;
- vsomeip::cfg::configuration_impl::*;
- *vsomeip::serializer;
- vsomeip::serializer::*;
- *vsomeip::deserializer;
- vsomeip::deserializer::*;
- *vsomeip::endpoint_definition;
- vsomeip::endpoint_definition*;
- *vsomeip::tcp*;
- vsomeip::tcp*;
- *vsomeip::udp*;
- vsomeip::udp*;
- *vsomeip::logger;
- vsomeip::logger::get*;
- *vsomeip::logger_impl;
- vsomeip::logger_impl::init*;
- *vsomeip::message_base_impl;
- *vsomeip::message_base_impl::*;
- *vsomeip::message_header_impl;
- *vsomeip::message_header_impl::*;
- *vsomeip::runtime;
- vsomeip::runtime::get*;
- vsomeip::runtime::set_property*;
- *vsomeip::application_impl;
- vsomeip::application_impl*;
- *vsomeip::eventgroupinfo;
- vsomeip::eventgroupinfo::*;
- *vsomeip::servicegroup;
- vsomeip::servicegroup::*;
- *vsomeip::serviceinfo;
- vsomeip::serviceinfo::*;
- *vsomeip::sd::runtime;
- vsomeip::sd::runtime::*;
- *vsomeip::utility;
- vsomeip::utility::is*;
- *vsomeip::plugin_manager;
- vsomeip::plugin_manager::*;
- };
- vsomeip_plugin_init;
-local:
- *;
-};
diff --git a/implementation/configuration/include/client.hpp b/implementation/configuration/include/client.hpp
deleted file mode 100644
index 81ed890..0000000
--- a/implementation/configuration/include/client.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2016-2017 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_CFG_CLIENT_HPP
-#define VSOMEIP_CFG_CLIENT_HPP
-
-#include <map>
-#include <memory>
-#include <set>
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-namespace cfg {
-
-struct client {
- client() : service_(ANY_SERVICE), instance_(ANY_INSTANCE) {}
-
- // ports for specific service / instance
- service_t service_;
- instance_t instance_;
- std::map<bool, std::set<uint16_t> > ports_;
-
- // client port ranges mapped to remote port ranges
- std::map<bool, std::pair<uint16_t, uint16_t> > remote_ports_;
- std::map<bool, std::pair<uint16_t, uint16_t> > client_ports_;
-};
-
-} // namespace cfg
-} // namespace vsomeip
-
-#endif // VSOMEIP_CFG_CLIENT_HPP
diff --git a/implementation/configuration/include/configuration.hpp b/implementation/configuration/include/configuration.hpp
deleted file mode 100644
index 1423392..0000000
--- a/implementation/configuration/include/configuration.hpp
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright (C) 2014-2017 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_CONFIGURATION_HPP
-#define VSOMEIP_CONFIGURATION_HPP
-
-#include <map>
-#include <memory>
-#include <set>
-#include <string>
-
-#include <boost/asio/ip/address.hpp>
-#include <boost/log/trivial.hpp>
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/defines.hpp>
-#include <vsomeip/plugin.hpp>
-#include <vsomeip/primitive_types.hpp>
-
-#include "internal.hpp"
-#include "trace.hpp"
-
-#include "../../e2e_protection/include/e2exf/config.hpp"
-#include "e2e.hpp"
-
-#include "debounce.hpp"
-
-#define VSOMEIP_CONFIG_PLUGIN_VERSION 1
-
-namespace vsomeip {
-
-class event;
-
-class configuration {
-public:
- virtual ~configuration() {}
-
- virtual bool load(const std::string &_name) = 0;
-
- virtual const std::string &get_network() const = 0;
-
- virtual const boost::asio::ip::address & get_unicast_address() const = 0;
- virtual unsigned short get_diagnosis_address() const = 0;
- virtual std::uint16_t get_diagnosis_mask() const = 0;
- virtual bool is_v4() const = 0;
- virtual bool is_v6() const = 0;
-
- virtual bool has_console_log() const = 0;
- virtual bool has_file_log() const = 0;
- virtual bool has_dlt_log() const = 0;
- virtual const std::string & get_logfile() const = 0;
- virtual boost::log::trivial::severity_level get_loglevel() const = 0;
-
- virtual const std::string & get_routing_host() const = 0;
-
- virtual std::string get_unicast_address(service_t _service,
- instance_t _instance) const = 0;
- virtual uint16_t get_reliable_port(service_t _service,
- instance_t _instance) const = 0;
- virtual bool has_enabled_magic_cookies(std::string _address,
- uint16_t _port) const = 0;
- virtual uint16_t get_unreliable_port(service_t _service,
- instance_t _instance) const = 0;
-
- virtual bool is_someip(service_t _service, instance_t _instance) const = 0;
-
- virtual bool get_client_port(service_t _service, instance_t _instance,
- uint16_t _remote_port, bool _reliable,
- std::map<bool, std::set<uint16_t> > &_used_client_ports, uint16_t &_client_port) const = 0;
-
- virtual std::set<std::pair<service_t, instance_t> > get_remote_services() const = 0;
-
- virtual bool get_multicast(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, std::string &_address, uint16_t &_port) const = 0;
-
- virtual uint8_t get_threshold(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup) const = 0;
-
- virtual client_t get_id(const std::string &_name) const = 0;
- virtual bool is_configured_client_id(client_t _id) const = 0;
-
- virtual std::size_t get_max_dispatchers(const std::string &_name) const = 0;
- virtual std::size_t get_max_dispatch_time(const std::string &_name) const = 0;
- virtual std::size_t get_io_thread_count(const std::string &_name) const = 0;
- virtual std::size_t get_request_debouncing(const std::string &_name) const = 0;
-
- virtual std::uint32_t get_max_message_size_local() const = 0;
- virtual std::uint32_t get_max_message_size_reliable(const std::string& _address,
- std::uint16_t _port) const = 0;
- virtual std::uint32_t get_buffer_shrink_threshold() const = 0;
-
- virtual bool supports_selective_broadcasts(boost::asio::ip::address _address) const = 0;
-
- virtual bool is_offered_remote(service_t _service, instance_t _instance) const = 0;
-
- virtual bool is_local_service(service_t _service, instance_t _instance) const = 0;
-
- virtual bool is_event_reliable(service_t _service, instance_t _instance, event_t _event) const = 0;
-
- // Service Discovery configuration
- virtual bool is_sd_enabled() const = 0;
-
- virtual const std::string & get_sd_multicast() const = 0;
- virtual uint16_t get_sd_port() const = 0;
- virtual const std::string & get_sd_protocol() const = 0;
-
- virtual int32_t get_sd_initial_delay_min() const = 0;
- virtual int32_t get_sd_initial_delay_max() const = 0;
- virtual int32_t get_sd_repetitions_base_delay() const = 0;
- virtual uint8_t get_sd_repetitions_max() const = 0;
- virtual ttl_t get_sd_ttl() const = 0;
- virtual int32_t get_sd_cyclic_offer_delay() const = 0;
- virtual int32_t get_sd_request_response_delay() const = 0;
- virtual std::uint32_t get_sd_offer_debounce_time() const = 0;
-
- // Trace configuration
- virtual std::shared_ptr<cfg::trace> get_trace() const = 0;
-
- // Watchdog
- virtual bool is_watchdog_enabled() const = 0;
- virtual uint32_t get_watchdog_timeout() const = 0;
- virtual uint32_t get_allowed_missing_pongs() const = 0;
-
- // File permissions
- virtual std::uint32_t get_umask() const = 0;
- virtual std::uint32_t get_permissions_shm() const = 0;
-
- virtual bool log_version() const = 0;
- virtual uint32_t get_log_version_interval() const = 0;
-
- // Security
- virtual bool is_security_enabled() const = 0;
- virtual bool is_client_allowed(client_t _client, service_t _service,
- instance_t _instance) const = 0;
- virtual bool is_offer_allowed(client_t _client, service_t _service,
- instance_t _instance) const = 0;
- virtual bool check_credentials(client_t _client, uint32_t _uid, uint32_t _gid) const = 0;
-
- // Plugins
- virtual std::map<plugin_type_e, std::set<std::string>> get_plugins(
- const std::string &_name) const = 0;
-
- virtual void set_configuration_path(const std::string &_path) = 0;
-
- //E2E
- virtual std::map<e2exf::data_identifier, std::shared_ptr<cfg::e2e>> get_e2e_configuration() const = 0;
- virtual bool is_e2e_enabled() const = 0;
-
- virtual bool log_memory() const = 0;
- virtual uint32_t get_log_memory_interval() const = 0;
-
- virtual bool log_status() const = 0;
- virtual uint32_t get_log_status_interval() const = 0;
-
- // TTL factor
- typedef std::uint32_t ttl_factor_t;
- typedef std::map<service_t, std::map<instance_t, ttl_factor_t>> ttl_map_t;
- virtual ttl_map_t get_ttl_factor_offers() const = 0;
- virtual ttl_map_t get_ttl_factor_subscribes() const = 0;
-
- // Debouncing
- virtual std::shared_ptr<cfg::debounce> get_debounce(
- service_t _service, instance_t _instance, event_t _event) const = 0;
-
- // Queue size limit endpoints
- typedef std::uint32_t endpoint_queue_limit_t;
- virtual endpoint_queue_limit_t get_endpoint_queue_limit(
- const std::string& _address, std::uint16_t _port) const = 0;
- virtual endpoint_queue_limit_t get_endpoint_queue_limit_local() const = 0;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_CONFIGURATION_HPP
diff --git a/implementation/configuration/include/configuration_impl.hpp b/implementation/configuration/include/configuration_impl.hpp
deleted file mode 100644
index d3b7572..0000000
--- a/implementation/configuration/include/configuration_impl.hpp
+++ /dev/null
@@ -1,406 +0,0 @@
-// Copyright (C) 2014-2017 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_CFG_CONFIGURATION_IMPL_HPP
-#define VSOMEIP_CFG_CONFIGURATION_IMPL_HPP
-
-#include <map>
-#include <memory>
-#include <mutex>
-#include <vector>
-#include <unordered_set>
-#include <list>
-
-#include <boost/property_tree/ptree.hpp>
-
-#include "trace.hpp"
-#include "configuration.hpp"
-#include "watchdog.hpp"
-#include "service_instance_range.hpp"
-#include "policy.hpp"
-#include "../../e2e_protection/include/e2exf/config.hpp"
-#include "e2e.hpp"
-#include "debounce.hpp"
-
-namespace vsomeip {
-namespace cfg {
-
-struct client;
-struct service;
-struct servicegroup;
-struct event;
-struct eventgroup;
-struct watchdog;
-
-struct element {
- std::string name_;
- boost::property_tree::ptree tree_;
-
- bool operator<(const element &_other) const {
- return (name_ < _other.name_);
- }
-};
-
-class configuration_impl:
- public configuration,
- public plugin_impl<configuration_impl>,
- public std::enable_shared_from_this<configuration_impl> {
-public:
- VSOMEIP_EXPORT configuration_impl();
- VSOMEIP_EXPORT configuration_impl(const configuration_impl &_cfg);
- VSOMEIP_EXPORT virtual ~configuration_impl();
-
- VSOMEIP_EXPORT bool load(const std::string &_name);
-
- VSOMEIP_EXPORT const std::string &get_network() const;
-
- VSOMEIP_EXPORT void set_configuration_path(const std::string &_path);
-
- VSOMEIP_EXPORT const boost::asio::ip::address & get_unicast_address() const;
- VSOMEIP_EXPORT unsigned short get_diagnosis_address() const;
- VSOMEIP_EXPORT std::uint16_t get_diagnosis_mask() const;
- VSOMEIP_EXPORT bool is_v4() const;
- VSOMEIP_EXPORT bool is_v6() const;
-
- VSOMEIP_EXPORT bool has_console_log() const;
- VSOMEIP_EXPORT bool has_file_log() const;
- VSOMEIP_EXPORT bool has_dlt_log() const;
- VSOMEIP_EXPORT const std::string & get_logfile() const;
- VSOMEIP_EXPORT boost::log::trivial::severity_level get_loglevel() const;
-
- VSOMEIP_EXPORT std::string get_unicast_address(service_t _service, instance_t _instance) const;
-
- VSOMEIP_EXPORT uint16_t get_reliable_port(service_t _service, instance_t _instance) const;
- VSOMEIP_EXPORT bool has_enabled_magic_cookies(std::string _address, uint16_t _port) const;
- VSOMEIP_EXPORT uint16_t get_unreliable_port(service_t _service,
- instance_t _instance) const;
-
- VSOMEIP_EXPORT bool is_someip(service_t _service, instance_t _instance) const;
-
- VSOMEIP_EXPORT bool get_client_port(service_t _service, instance_t _instance,
- uint16_t _remote_port, bool _reliable,
- std::map<bool, std::set<uint16_t> > &_used_client_ports, uint16_t &_client_port) const;
-
- VSOMEIP_EXPORT const std::string & get_routing_host() const;
-
- VSOMEIP_EXPORT client_t get_id(const std::string &_name) const;
- VSOMEIP_EXPORT bool is_configured_client_id(client_t _id) const;
-
- VSOMEIP_EXPORT std::size_t get_max_dispatchers(const std::string &_name) const;
- VSOMEIP_EXPORT std::size_t get_max_dispatch_time(const std::string &_name) const;
- VSOMEIP_EXPORT std::size_t get_io_thread_count(const std::string &_name) const;
- VSOMEIP_EXPORT std::size_t get_request_debouncing(const std::string &_name) const;
-
- VSOMEIP_EXPORT std::set<std::pair<service_t, instance_t> > get_remote_services() const;
-
- VSOMEIP_EXPORT bool get_multicast(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, std::string &_address, uint16_t &_port) const;
-
- VSOMEIP_EXPORT uint8_t get_threshold(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup) const;
-
- VSOMEIP_EXPORT std::uint32_t get_max_message_size_local() const;
- VSOMEIP_EXPORT std::uint32_t get_max_message_size_reliable(const std::string& _address,
- std::uint16_t _port) const;
- VSOMEIP_EXPORT std::uint32_t get_buffer_shrink_threshold() const;
-
- VSOMEIP_EXPORT bool supports_selective_broadcasts(boost::asio::ip::address _address) const;
-
- VSOMEIP_EXPORT bool is_offered_remote(service_t _service, instance_t _instance) const;
-
- VSOMEIP_EXPORT bool log_version() const;
- VSOMEIP_EXPORT uint32_t get_log_version_interval() const;
-
- VSOMEIP_EXPORT bool is_local_service(service_t _service, instance_t _instance) const;
-
- VSOMEIP_EXPORT bool is_event_reliable(service_t _service, instance_t _instance, event_t _event) const;
-
- // Service Discovery configuration
- VSOMEIP_EXPORT bool is_sd_enabled() const;
-
- VSOMEIP_EXPORT const std::string & get_sd_multicast() const;
- VSOMEIP_EXPORT uint16_t get_sd_port() const;
- VSOMEIP_EXPORT const std::string & get_sd_protocol() const;
-
- VSOMEIP_EXPORT int32_t get_sd_initial_delay_min() const;
- VSOMEIP_EXPORT int32_t get_sd_initial_delay_max() const;
- VSOMEIP_EXPORT int32_t get_sd_repetitions_base_delay() const;
- VSOMEIP_EXPORT uint8_t get_sd_repetitions_max() const;
- VSOMEIP_EXPORT ttl_t get_sd_ttl() const;
- VSOMEIP_EXPORT int32_t get_sd_cyclic_offer_delay() const;
- VSOMEIP_EXPORT int32_t get_sd_request_response_delay() const;
- VSOMEIP_EXPORT std::uint32_t get_sd_offer_debounce_time() const;
-
- // Trace configuration
- VSOMEIP_EXPORT std::shared_ptr<cfg::trace> get_trace() const;
-
- VSOMEIP_EXPORT bool is_watchdog_enabled() const;
- VSOMEIP_EXPORT uint32_t get_watchdog_timeout() const;
- VSOMEIP_EXPORT uint32_t get_allowed_missing_pongs() const;
-
- VSOMEIP_EXPORT std::uint32_t get_umask() const;
- VSOMEIP_EXPORT std::uint32_t get_permissions_shm() const;
-
- // Policy
- VSOMEIP_EXPORT bool is_security_enabled() const;
- VSOMEIP_EXPORT bool is_client_allowed(client_t _client, service_t _service,
- instance_t _instance) const;
- VSOMEIP_EXPORT bool is_offer_allowed(client_t _client, service_t _service,
- instance_t _instance) const;
- VSOMEIP_EXPORT bool check_credentials(client_t _client, uint32_t _uid, uint32_t _gid) const;
-
- VSOMEIP_EXPORT std::map<plugin_type_e, std::set<std::string>> get_plugins(
- const std::string &_name) const;
- // E2E
- VSOMEIP_EXPORT std::map<e2exf::data_identifier, std::shared_ptr<cfg::e2e>> get_e2e_configuration() const;
- VSOMEIP_EXPORT bool is_e2e_enabled() const;
-
- VSOMEIP_EXPORT bool log_memory() const;
- VSOMEIP_EXPORT uint32_t get_log_memory_interval() const;
-
- VSOMEIP_EXPORT bool log_status() const;
- VSOMEIP_EXPORT uint32_t get_log_status_interval() const;
-
- VSOMEIP_EXPORT ttl_map_t get_ttl_factor_offers() const;
- VSOMEIP_EXPORT ttl_map_t get_ttl_factor_subscribes() const;
-
- VSOMEIP_EXPORT std::shared_ptr<debounce> get_debounce(
- service_t _service, instance_t _instance, event_t _event) const;
-
- VSOMEIP_EXPORT endpoint_queue_limit_t get_endpoint_queue_limit(
- const std::string& _address, std::uint16_t _port) const;
- VSOMEIP_EXPORT endpoint_queue_limit_t get_endpoint_queue_limit_local() const;
-private:
- void read_data(const std::set<std::string> &_input,
- std::vector<element> &_elements,
- std::set<std::string> &_failed,
- bool _standard_only);
-
- bool load_data(const std::vector<element> &_elements,
- bool _load_mandatory, bool _load_optional);
-
- bool load_logging(const element &_element,
- std::set<std::string> &_warnings);
- bool load_routing(const element &_element);
-
- bool load_applications(const element &_element);
- void load_application_data(const boost::property_tree::ptree &_tree,
- const std::string &_name);
-
- void load_tracing(const element &_element);
- void load_trace_channels(const boost::property_tree::ptree &_tree);
- void load_trace_channel(const boost::property_tree::ptree &_tree);
- void load_trace_filters(const boost::property_tree::ptree &_tree);
- void load_trace_filter(const boost::property_tree::ptree &_tree);
- void load_trace_filter_expressions(
- const boost::property_tree::ptree &_tree,
- std::string &_criteria,
- std::shared_ptr<trace_filter_rule> &_filter_rule);
-
- void load_network(const element &_element);
-
- void load_unicast_address(const element &_element);
- void load_diagnosis_address(const element &_element);
-
- void load_service_discovery(const element &_element);
- void load_delays(const boost::property_tree::ptree &_tree);
-
- void load_services(const element &_element);
- void load_servicegroup(const boost::property_tree::ptree &_tree);
- void load_service(const boost::property_tree::ptree &_tree,
- const std::string &_unicast_address);
- void load_event(std::shared_ptr<service> &_service,
- const boost::property_tree::ptree &_tree);
- void load_eventgroup(std::shared_ptr<service> &_service,
- const boost::property_tree::ptree &_tree);
-
- void load_internal_services(const element &_element);
-
- void load_clients(const element &_element);
- void load_client(const boost::property_tree::ptree &_tree);
-
- std::set<uint16_t> load_client_ports(const boost::property_tree::ptree &_tree);
- std::pair<uint16_t, uint16_t> load_client_port_range(const boost::property_tree::ptree &_tree);
-
- void load_watchdog(const element &_element);
-
- void load_payload_sizes(const element &_element);
- void load_permissions(const element &_element);
- void load_selective_broadcasts_support(const element &_element);
- void load_policies(const element &_element);
- void load_policy(const boost::property_tree::ptree &_tree);
- void load_credential(const boost::property_tree::ptree &_tree, ids_t &_ids);
- void load_ranges(const boost::property_tree::ptree &_tree, ranges_t &_range);
-
- void load_debounce(const element &_element);
- void load_service_debounce(const boost::property_tree::ptree &_tree);
- void load_events_debounce(const boost::property_tree::ptree &_tree,
- std::map<event_t, std::shared_ptr<debounce>> &_debounces);
- void load_event_debounce(const boost::property_tree::ptree &_tree,
- std::map<event_t, std::shared_ptr<debounce>> &_debounces);
- void load_event_debounce_ignore(const boost::property_tree::ptree &_tree,
- std::map<std::size_t, byte_t> &_ignore);
-
- servicegroup *find_servicegroup(const std::string &_name) const;
- std::shared_ptr<client> find_client(service_t _service,
- instance_t _instance) const;
- std::shared_ptr<service> find_service(service_t _service, instance_t _instance) const;
- std::shared_ptr<eventgroup> find_eventgroup(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) const;
- bool find_port(uint16_t &_port, uint16_t _remote, bool _reliable,
- std::map<bool, std::set<uint16_t> > &_used_client_ports) const;
-
- void set_magic_cookies_unicast_address();
-
- bool is_mandatory(const std::string &_name) const;
- bool is_remote(std::shared_ptr<service> _service) const;
- bool is_internal_service(service_t _service, instance_t _instance) const;
- bool is_in_port_range(uint16_t _port, std::pair<uint16_t, uint16_t> _port_range) const;
-
- void set_mandatory(const std::string &_input);
- void trim(std::string &_s);
-
- void load_e2e(const element &_element);
- void load_e2e_protected(const boost::property_tree::ptree &_tree);
-
- void load_ttl_factors(const boost::property_tree::ptree &_tree,
- ttl_map_t* _target);
-
- void load_endpoint_queue_sizes(const element &_element);
-
-private:
- std::mutex mutex_;
-
- bool is_loaded_;
- bool is_logging_loaded_;
-
- std::set<std::string> mandatory_;
-
-protected:
- // Configuration data
- boost::asio::ip::address unicast_;
- unsigned short diagnosis_;
- std::uint16_t diagnosis_mask_;
-
- bool has_console_log_;
- bool has_file_log_;
- bool has_dlt_log_;
- std::string logfile_;
- boost::log::trivial::severity_level loglevel_;
-
- std::map<std::string, std::tuple<client_t, std::size_t, std::size_t,
- size_t, size_t, std::map<plugin_type_e, std::set<std::string>>>> applications_;
- std::set<client_t> client_identifiers_;
-
- std::map<service_t,
- std::map<instance_t,
- std::shared_ptr<service> > > services_;
-
- std::list< std::shared_ptr<client> > clients_;
-
- std::string routing_host_;
-
- bool is_sd_enabled_;
- std::string sd_protocol_;
- std::string sd_multicast_;
- uint16_t sd_port_;
-
- int32_t sd_initial_delay_min_;
- int32_t sd_initial_delay_max_;
- int32_t sd_repetitions_base_delay_;
- uint8_t sd_repetitions_max_;
- ttl_t sd_ttl_;
- int32_t sd_cyclic_offer_delay_;
- int32_t sd_request_response_delay_;
- std::uint32_t sd_offer_debounce_time_;
-
- std::map<std::string, std::set<uint16_t> > magic_cookies_;
-
- std::map<std::string, std::map<std::uint16_t, std::uint32_t>> message_sizes_;
- std::uint32_t max_configured_message_size_;
- std::uint32_t max_local_message_size_;
- std::uint32_t max_reliable_message_size_;
- std::uint32_t buffer_shrink_threshold_;
-
- std::shared_ptr<trace> trace_;
-
- std::unordered_set<std::string> supported_selective_addresses;
-
- std::shared_ptr<watchdog> watchdog_;
-
- std::vector<service_instance_range> internal_service_ranges_;
-
- bool log_version_;
- uint32_t log_version_interval_;
-
- enum element_type_e {
- ET_NETWORK,
- ET_UNICAST,
- ET_DIAGNOSIS,
- ET_DIAGNOSIS_MASK,
- ET_LOGGING_CONSOLE,
- ET_LOGGING_FILE,
- ET_LOGGING_DLT,
- ET_LOGGING_LEVEL,
- ET_ROUTING,
- ET_SERVICE_DISCOVERY_ENABLE,
- ET_SERVICE_DISCOVERY_PROTOCOL,
- ET_SERVICE_DISCOVERY_MULTICAST,
- ET_SERVICE_DISCOVERY_PORT,
- ET_SERVICE_DISCOVERY_INITIAL_DELAY_MIN,
- ET_SERVICE_DISCOVERY_INITIAL_DELAY_MAX,
- ET_SERVICE_DISCOVERY_REPETITION_BASE_DELAY,
- ET_SERVICE_DISCOVERY_REPETITION_MAX,
- ET_SERVICE_DISCOVERY_TTL,
- ET_SERVICE_DISCOVERY_CYCLIC_OFFER_DELAY,
- ET_SERVICE_DISCOVERY_REQUEST_RESPONSE_DELAY,
- ET_WATCHDOG_ENABLE,
- ET_WATCHDOG_TIMEOUT,
- ET_WATCHDOG_ALLOWED_MISSING_PONGS,
- ET_TRACING_ENABLE,
- ET_TRACING_SD_ENABLE,
- ET_SERVICE_DISCOVERY_OFFER_DEBOUNCE_TIME,
- ET_SERVICE_DISCOVERY_TTL_FACTOR_OFFERS,
- ET_SERVICE_DISCOVERY_TTL_FACTOR_SUBSCRIPTIONS,
- ET_ENDPOINT_QUEUE_LIMITS,
- ET_ENDPOINT_QUEUE_LIMIT_EXTERNAL,
- ET_ENDPOINT_QUEUE_LIMIT_LOCAL,
- ET_MAX = 31
- };
-
- bool is_configured_[ET_MAX];
- std::uint32_t permissions_shm_;
- std::uint32_t umask_;
-
- std::map<client_t, std::shared_ptr<policy>> policies_;
- bool policy_enabled_;
- bool check_credentials_;
-
- std::string network_;
- std::string configuration_path_;
-
- bool e2e_enabled_;
- std::map<e2exf::data_identifier, std::shared_ptr<cfg::e2e>> e2e_configuration_;
-
- bool log_memory_;
- uint32_t log_memory_interval_;
-
- bool log_status_;
- uint32_t log_status_interval_;
-
- ttl_map_t ttl_factors_offers_;
- ttl_map_t ttl_factors_subscriptions_;
-
- std::map<service_t, std::map<instance_t, std::map<event_t, std::shared_ptr<debounce>>>> debounces_;
-
- std::map<std::string, std::map<std::uint16_t, endpoint_queue_limit_t>> endpoint_queue_limits_;
- endpoint_queue_limit_t endpoint_queue_limit_external_;
- endpoint_queue_limit_t endpoint_queue_limit_local_;
-};
-
-} // namespace cfg
-} // namespace vsomeip
-
-#endif // VSOMEIP_CFG_CONFIGURATION_IMPL_HPP
diff --git a/implementation/configuration/include/debounce.hpp b/implementation/configuration/include/debounce.hpp
deleted file mode 100644
index b4ce6d3..0000000
--- a/implementation/configuration/include/debounce.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (C) 2017 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_CFG_DEBOUNCE_HPP
-#define VSOMEIP_CFG_DEBOUNCE_HPP
-
-#include <map>
-
-namespace vsomeip {
-namespace cfg {
-
-// Messages are forwarded either because their value differs from the
-// last received message (on_change=true) or because the specified time
-// (interval_) between two messages has elapsed. A message that is forwarded
-// because of a changed value may reset the time until the next unchanged
-// message is forwarded or not (on_change_resets_interval). By specifiying
-// indexes and bit masks, the comparison that is carried out to decide whether
-// or not two message values differ is configurable (ignore_).
-struct debounce {
- debounce() : on_change_(false),
- on_change_resets_interval_(false),
- interval_(0),
- last_forwarded_((std::chrono::steady_clock::time_point::max)()) {
- }
-
- bool on_change_;
- bool on_change_resets_interval_;
- std::map<std::size_t, byte_t> ignore_;
-
- long interval_;
- std::chrono::steady_clock::time_point last_forwarded_;
-};
-
-} // namespace cfg
-} // namespace vsomeip
-
-#endif // VSOMEIP_CFG_DEBOUNCE_HPP
diff --git a/implementation/configuration/include/e2e.hpp b/implementation/configuration/include/e2e.hpp
deleted file mode 100644
index 6f7bcda..0000000
--- a/implementation/configuration/include/e2e.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (C) 2014-2017 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_CFG_E2E_HPP_
-#define VSOMEIP_CFG_E2E_HPP_
-
-#include <string>
-#include <vector>
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-namespace cfg {
-
-struct e2e {
-
- e2e() :
- data_id(0),
- variant(""),
- profile(""),
- service_id(0),
- event_id(0),
- crc_offset(0),
- data_id_mode(0),
- data_length(0),
- data_id_nibble_offset(0),
- counter_offset(0) {
- }
-
-
- e2e(uint16_t _data_id, std::string _variant, std::string _profile, uint16_t _service_id,
- uint16_t _event_id,uint16_t _crc_offset,
- uint8_t _data_id_mode, uint16_t _data_length, uint16_t _data_id_nibble_offset, uint16_t _counter_offset) :
-
- data_id(_data_id),
- variant(_variant),
- profile(_profile),
- service_id(_service_id),
- event_id(_event_id),
- crc_offset(_crc_offset),
- data_id_mode(_data_id_mode),
- data_length(_data_length),
- data_id_nibble_offset(_data_id_nibble_offset),
- counter_offset(_counter_offset) {
-
- }
-
- // common config
- uint16_t data_id;
- std::string variant;
- std::string profile;
- uint16_t service_id;
- uint16_t event_id;
-
- //profile 1 specific config
- // [SWS_E2E_00018]
- uint16_t crc_offset;
- uint8_t data_id_mode;
- uint16_t data_length;
- uint16_t data_id_nibble_offset;
- uint16_t counter_offset;
-};
-
-} // namespace cfg
-} // namespace vsomeip
-
-#endif // VSOMEIP_CFG_E2E_HPP_
diff --git a/implementation/configuration/include/event.hpp b/implementation/configuration/include/event.hpp
deleted file mode 100644
index 499c49a..0000000
--- a/implementation/configuration/include/event.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2014-2017 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_CFG_EVENT_HPP
-#define VSOMEIP_CFG_EVENT_HPP
-
-#include <memory>
-#include <vector>
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-namespace cfg {
-
-struct eventgroup;
-
-struct event {
- event(event_t _id, bool _is_field, bool _is_reliable)
- : id_(_id), is_field_(_is_field), is_reliable_(_is_reliable) {
- }
-
- event_t id_;
- bool is_field_;
- bool is_reliable_;
- std::vector<std::weak_ptr<eventgroup> > groups_;
-};
-
-} // namespace cfg
-} // namespace vsomeip
-
-#endif // VSOMEIP_CFG_EVENT_HPP
diff --git a/implementation/configuration/include/eventgroup.hpp b/implementation/configuration/include/eventgroup.hpp
deleted file mode 100644
index c26edc0..0000000
--- a/implementation/configuration/include/eventgroup.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2014-2017 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_CFG_EVENTGROUP_HPP
-#define VSOMEIP_CFG_EVENTGROUP_HPP
-
-#include <memory>
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-namespace cfg {
-
-struct event;
-
-struct eventgroup {
- eventgroup_t id_;
- std::set<std::shared_ptr<event> > events_;
- std::string multicast_address_;
- uint16_t multicast_port_;
- uint8_t threshold_;
-};
-
-} // namespace cfg
-} // namespace vsomeip
-
-#endif // VSOMEIP_CFG_EVENTGROUP_HPP
diff --git a/implementation/configuration/include/internal.hpp.in b/implementation/configuration/include/internal.hpp.in
deleted file mode 100644
index e2f3da3..0000000
--- a/implementation/configuration/include/internal.hpp.in
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (C) 2014-2017 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_INTERNAL_HPP
-#define VSOMEIP_INTERNAL_HPP
-
-#include <cstdint>
-#include <limits>
-#include <vsomeip/primitive_types.hpp>
-
-#define VSOMEIP_ENV_APPLICATION_NAME "VSOMEIP_APPLICATION_NAME"
-#define VSOMEIP_ENV_CONFIGURATION "VSOMEIP_CONFIGURATION"
-#define VSOMEIP_ENV_CONFIGURATION_MODULE "VSOMEIP_CONFIGURATION_MODULE"
-#define VSOMEIP_ENV_MANDATORY_CONFIGURATION_FILES "VSOMEIP_MANDATORY_CONFIGURATION_FILES"
-#define VSOMEIP_ENV_LOAD_PLUGINS "VSOMEIP_LOAD_PLUGINS"
-#define VSOMEIP_ENV_CLIENTSIDELOGGING "VSOMEIP_CLIENTSIDELOGGING"
-#define VSOMEIP_ENV_DEBUG_CONFIGURATION "VSOMEIP_DEBUG_CONFIGURATION"
-
-#define VSOMEIP_DEFAULT_CONFIGURATION_FILE "/etc/vsomeip.json"
-#define VSOMEIP_LOCAL_CONFIGURATION_FILE "./vsomeip.json"
-#define VSOMEIP_MANDATORY_CONFIGURATION_FILES "vsomeip_std.json,vsomeip_app.json,vsomeip_plc.json,vsomeip_log.json"
-
-#define VSOMEIP_DEFAULT_CONFIGURATION_FOLDER "/etc/vsomeip"
-#define VSOMEIP_DEBUG_CONFIGURATION_FOLDER "/var/opt/public/sin/vsomeip/"
-#define VSOMEIP_LOCAL_CONFIGURATION_FOLDER "./vsomeip"
-
-#define VSOMEIP_BASE_PATH "/tmp/"
-
-#ifdef WIN32
-#define VSOMEIP_CFG_LIBRARY "vsomeip-cfg.dll"
-#else
-#define VSOMEIP_CFG_LIBRARY "libvsomeip-cfg.so.@VSOMEIP_MAJOR_VERSION@"
-#endif
-
-#ifdef WIN32
-#define VSOMEIP_SD_LIBRARY "vsomeip-sd.dll"
-#else
-#define VSOMEIP_SD_LIBRARY "libvsomeip-sd.so.@VSOMEIP_MAJOR_VERSION@"
-#endif
-
-#define VSOMEIP_ROUTING "@VSOMEIP_ROUTING@"
-#define VSOMEIP_ROUTING_CLIENT 0
-#define VSOMEIP_ROUTING_INFO_SIZE_INIT 256
-
-#ifdef _WIN32
-#define VSOMEIP_INTERNAL_BASE_PORT 51234
-#define __func__ __FUNCTION__
-#endif
-
-#define VSOMEIP_UNICAST_ADDRESS "@VSOMEIP_UNICAST_ADDRESS@"
-
-#define VSOMEIP_DEFAULT_CONNECT_TIMEOUT 100
-#define VSOMEIP_MAX_CONNECT_TIMEOUT 1600
-#define VSOMEIP_DEFAULT_FLUSH_TIMEOUT 1000
-
-#define VSOMEIP_DEFAULT_WATCHDOG_TIMEOUT 5000
-#define VSOMEIP_DEFAULT_MAX_MISSING_PONGS 3
-
-#define VSOMEIP_IO_THREAD_COUNT 2
-
-#define VSOMEIP_MAX_DISPATCHERS 10
-#define VSOMEIP_MAX_DISPATCH_TIME 100
-
-#define VSOMEIP_MAX_DESERIALIZER 5
-
-#define VSOMEIP_REQUEST_DEBOUNCE_TIME 10
-
-#define VSOMEIP_COMMAND_HEADER_SIZE 7
-
-#define VSOMEIP_COMMAND_TYPE_POS 0
-#define VSOMEIP_COMMAND_CLIENT_POS 1
-#define VSOMEIP_COMMAND_SIZE_POS_MIN 3
-#define VSOMEIP_COMMAND_SIZE_POS_MAX 5
-#define VSOMEIP_COMMAND_PAYLOAD_POS 7
-
-#define VSOMEIP_REGISTER_APPLICATION 0x00
-#define VSOMEIP_DEREGISTER_APPLICATION 0x01
-#define VSOMEIP_APPLICATION_LOST 0x02
-#define VSOMEIP_ROUTING_INFO 0x03
-#define VSOMEIP_REGISTERED_ACK 0x04
-
-#define VSOMEIP_PING 0x0E
-#define VSOMEIP_PONG 0x0F
-
-#define VSOMEIP_OFFER_SERVICE 0x10
-#define VSOMEIP_STOP_OFFER_SERVICE 0x11
-#define VSOMEIP_SUBSCRIBE 0x12
-#define VSOMEIP_UNSUBSCRIBE 0x13
-#define VSOMEIP_REQUEST_SERVICE 0x14
-#define VSOMEIP_RELEASE_SERVICE 0x15
-#define VSOMEIP_SUBSCRIBE_NACK 0x16
-#define VSOMEIP_SUBSCRIBE_ACK 0x17
-
-#define VSOMEIP_SEND 0x18
-#define VSOMEIP_NOTIFY 0x19
-#define VSOMEIP_NOTIFY_ONE 0x1A
-
-#define VSOMEIP_REGISTER_EVENT 0x1B
-#define VSOMEIP_UNREGISTER_EVENT 0x1C
-#define VSOMEIP_ID_RESPONSE 0x1D
-#define VSOMEIP_ID_REQUEST 0x1E
-#define VSOMEIP_OFFERED_SERVICES_REQUEST 0x1F
-#define VSOMEIP_OFFERED_SERVICES_RESPONSE 0x20
-#define VSOMEIP_UNSUBSCRIBE_ACK 0x21
-
-#define VSOMEIP_OFFER_SERVICE_COMMAND_SIZE 16
-#define VSOMEIP_REQUEST_SERVICE_COMMAND_SIZE 17
-#define VSOMEIP_RELEASE_SERVICE_COMMAND_SIZE 11
-#define VSOMEIP_STOP_OFFER_SERVICE_COMMAND_SIZE 16
-#define VSOMEIP_SUBSCRIBE_COMMAND_SIZE 19
-#define VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE 19
-#define VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE 19
-#define VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE 17
-#define VSOMEIP_UNSUBSCRIBE_ACK_COMMAND_SIZE 15
-#define VSOMEIP_REGISTER_EVENT_COMMAND_SIZE 15
-#define VSOMEIP_UNREGISTER_EVENT_COMMAND_SIZE 14
-#define VSOMEIP_ID_RESPONSE_COMMAND_SIZE 12
-#define VSOMEIP_ID_REQUEST_COMMAND_SIZE 13
-#define VSOMEIP_OFFERED_SERVICES_COMMAND_SIZE 8
-
-#ifndef _WIN32
-#include <pthread.h>
-#endif
-
-#define VSOMEIP_DATA_ID 0x677D
-#define VSOMEIP_DIAGNOSIS_ADDRESS @VSOMEIP_DIAGNOSIS_ADDRESS@
-
-#define VSOMEIP_DEFAULT_SHM_PERMISSION 0666
-#define VSOMEIP_DEFAULT_UMASK_LOCAL_ENDPOINTS 0000
-
-#define VSOMEIP_ROUTING_READY_MESSAGE "@VSOMEIP_ROUTING_READY_MESSAGE@"
-
-namespace vsomeip {
-
-typedef enum {
- RIE_ADD_CLIENT = 0x0,
- RIE_ADD_SERVICE_INSTANCE = 0x1,
- RIE_DEL_SERVICE_INSTANCE = 0x2,
- RIE_DEL_CLIENT = 0x3,
-} routing_info_entry_e;
-
-struct service_data_t {
- service_t service_;
- instance_t instance_;
- major_version_t major_;
- minor_version_t minor_;
- bool use_exclusive_proxy_; // only used for requests!
-
- bool operator<(const service_data_t &_other) const {
- return (service_ < _other.service_
- || (service_ == _other.service_
- && instance_ < _other.instance_));
- }
-};
-
-typedef enum {
- SUBSCRIPTION_ACKNOWLEDGED,
- SUBSCRIPTION_NOT_ACKNOWLEDGED,
- IS_SUBSCRIBING
-} subscription_state_e;
-
-struct configuration_data_t {
-#ifndef _WIN32
- volatile char initialized_;
- pthread_mutex_t mutex_;
- pid_t pid_;
-#endif
- unsigned short client_base_;
- unsigned short max_clients_;
- int max_used_client_ids_index_;
- unsigned short max_assigned_client_id_without_diagnosis_;
- unsigned short routing_manager_host_;
- // array of used client ids here, pointer to it is kept in utility class
-};
-
-const std::uint32_t MESSAGE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
-
-const std::uint32_t QUEUE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
-
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_INTERNAL_HPP
diff --git a/implementation/configuration/include/policy.hpp b/implementation/configuration/include/policy.hpp
deleted file mode 100644
index 9132a4d..0000000
--- a/implementation/configuration/include/policy.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2014-2017 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_CFG_POLICY_HPP
-#define VSOMEIP_CFG_POLICY_HPP
-
-#include <memory>
-#include <set>
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-namespace cfg {
-
-typedef std::set<std::pair<uint32_t, uint32_t>> ranges_t;
-typedef std::set<std::pair<ranges_t, ranges_t>> ids_t;
-
-struct policy {
- policy() : allow_who_(false), allow_what_(false) {};
-
- ids_t ids_;
- bool allow_who_;
-
- std::set<std::pair<service_t, instance_t>> services_;
- std::set<std::pair<service_t, instance_t>> offers_;
- bool allow_what_;
-};
-
-} // namespace cfg
-} // namespace vsomeip
-
-#endif // VSOMEIP_CFG_POLICY_HPP
diff --git a/implementation/configuration/include/service.hpp b/implementation/configuration/include/service.hpp
deleted file mode 100644
index b33cf72..0000000
--- a/implementation/configuration/include/service.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2014-2017 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_CFG_SERVICE_HPP
-#define VSOMEIP_CFG_SERVICE_HPP
-
-#include <memory>
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-namespace cfg {
-
-struct event;
-struct eventgroup;
-
-struct service {
- service_t service_;
- instance_t instance_;
-
- std::string unicast_address_;
-
- uint16_t reliable_;
- uint16_t unreliable_;
-
- std::string multicast_address_;
- uint16_t multicast_port_;
-
- std::string protocol_;
-
- std::shared_ptr<servicegroup> group_;
- std::map<event_t, std::shared_ptr<event> > events_;
- std::map<eventgroup_t, std::shared_ptr<eventgroup> > eventgroups_;
-};
-
-} // namespace cfg
-} // namespace vsomeip
-
-#endif // VSOMEIP_CFG_SERVICE_HPP
diff --git a/implementation/configuration/include/service_instance_range.hpp b/implementation/configuration/include/service_instance_range.hpp
deleted file mode 100644
index bf5f415..0000000
--- a/implementation/configuration/include/service_instance_range.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2014-2017 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_CFG_SERVICE_INSTANCE_RANGE_HPP
-#define VSOMEIP_CFG_SERVICE_INSTANCE_RANGE_HPP
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-namespace cfg {
-
-struct service_instance_range {
- service_t first_service_;
- service_t last_service_;
- instance_t first_instance_;
- instance_t last_instance_;
-};
-
-}
-}
-
-#endif // VSOMEIP_CFG_SERVICE_INSTANCE_RANGE_HPP
diff --git a/implementation/configuration/include/trace.hpp b/implementation/configuration/include/trace.hpp
deleted file mode 100644
index db92286..0000000
--- a/implementation/configuration/include/trace.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (C) 2014-2017 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 CONFIGURATION_INCLUDE_TRACE_HPP_
-#define CONFIGURATION_INCLUDE_TRACE_HPP_
-
-#include <string>
-#include <vector>
-
-#include <vsomeip/primitive_types.hpp>
-
-#include "../../tracing/include/defines.hpp"
-
-namespace vsomeip {
-namespace cfg {
-
-struct trace_channel {
-
- trace_channel() :
- id_(VSOMEIP_TC_DEFAULT_CHANNEL_ID),
- name_(VSOMEIP_TC_DEFAULT_CHANNEL_NAME) {
-
- }
-
- trace_channel_t id_;
- std::string name_;
-};
-
-struct trace_filter_rule {
-
- trace_filter_rule() :
- channel_(VSOMEIP_TC_DEFAULT_CHANNEL_ID),
- services_(),
- methods_(),
- clients_(),
- type_(VSOMEIP_TC_DEFAULT_FILTER_TYPE) {
-
- }
-
- trace_channel_t channel_;
- std::vector<service_t> services_;
- std::vector<method_t> methods_;
- std::vector<client_t> clients_;
- trace_filter_type_t type_;
-};
-
-struct trace {
-
- trace() :
- channels_(),
- filter_rules_(),
- is_enabled_(false),
- is_sd_enabled_(false) {
- channels_.push_back(std::make_shared<trace_channel>());
- }
-
- std::vector<std::shared_ptr<trace_channel>> channels_;
- std::vector<std::shared_ptr<trace_filter_rule>> filter_rules_;
-
- bool is_enabled_;
- bool is_sd_enabled_;
-};
-
-} // namespace cfg
-} // namespace vsomeip
-
-#endif /* CONFIGURATION_INCLUDE_TRACE_HPP_ */
diff --git a/implementation/configuration/include/watchdog.hpp b/implementation/configuration/include/watchdog.hpp
deleted file mode 100644
index 00fdb69..0000000
--- a/implementation/configuration/include/watchdog.hpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) 2014-2017 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_CFG_WATCHDOG_HPP_
-#define VSOMEIP_CFG_WATCHDOG_HPP_
-
-namespace vsomeip {
-namespace cfg {
-
-struct watchdog {
- watchdog()
- : is_enabeled_(false),
- timeout_in_ms_(VSOMEIP_DEFAULT_WATCHDOG_TIMEOUT),
- missing_pongs_allowed_(VSOMEIP_DEFAULT_MAX_MISSING_PONGS) {
- }
-
- bool is_enabeled_;
- uint32_t timeout_in_ms_;
- uint32_t missing_pongs_allowed_;
-};
-
-} // namespace cfg
-} // namespace vsomeip
-
-#endif /* VSOMEIP_CFG_WATCHDOG_HPP_ */
diff --git a/implementation/configuration/src/configuration_impl.cpp b/implementation/configuration/src/configuration_impl.cpp
deleted file mode 100644
index 0b33018..0000000
--- a/implementation/configuration/src/configuration_impl.cpp
+++ /dev/null
@@ -1,3158 +0,0 @@
-// Copyright (C) 2014-2017 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 <cctype>
-#include <fstream>
-#include <functional>
-#include <set>
-#include <sstream>
-#include <limits>
-
-#define WIN32_LEAN_AND_MEAN
-
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
-#include <boost/property_tree/json_parser.hpp>
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/plugins/application_plugin.hpp>
-#include <vsomeip/plugins/pre_configuration_plugin.hpp>
-
-#include "../include/client.hpp"
-#include "../include/configuration_impl.hpp"
-#include "../include/event.hpp"
-#include "../include/eventgroup.hpp"
-#include "../include/service.hpp"
-#include "../include/internal.hpp"
-#include "../../logging/include/logger_impl.hpp"
-#include "../../routing/include/event.hpp"
-#include "../../service_discovery/include/defines.hpp"
-#include "../../utility/include/utility.hpp"
-#include "../../plugin/include/plugin_manager.hpp"
-
-VSOMEIP_PLUGIN(vsomeip::cfg::configuration_impl)
-
-namespace vsomeip {
-namespace cfg {
-
-configuration_impl::configuration_impl()
- : plugin_impl("vsomeip cfg plugin", 1, plugin_type_e::CONFIGURATION_PLUGIN),
- is_loaded_(false),
- is_logging_loaded_(false),
- diagnosis_(VSOMEIP_DIAGNOSIS_ADDRESS),
- diagnosis_mask_(0xFF00),
- has_console_log_(true),
- has_file_log_(false),
- has_dlt_log_(false),
- logfile_("/tmp/vsomeip.log"),
- loglevel_(boost::log::trivial::severity_level::info),
- is_sd_enabled_(VSOMEIP_SD_DEFAULT_ENABLED),
- sd_protocol_(VSOMEIP_SD_DEFAULT_PROTOCOL),
- sd_multicast_(VSOMEIP_SD_DEFAULT_MULTICAST),
- sd_port_(VSOMEIP_SD_DEFAULT_PORT),
- sd_initial_delay_min_(VSOMEIP_SD_DEFAULT_INITIAL_DELAY_MIN),
- sd_initial_delay_max_(VSOMEIP_SD_DEFAULT_INITIAL_DELAY_MAX),
- sd_repetitions_base_delay_(VSOMEIP_SD_DEFAULT_REPETITIONS_BASE_DELAY),
- sd_repetitions_max_(VSOMEIP_SD_DEFAULT_REPETITIONS_MAX),
- sd_ttl_(VSOMEIP_SD_DEFAULT_TTL),
- sd_cyclic_offer_delay_(VSOMEIP_SD_DEFAULT_CYCLIC_OFFER_DELAY),
- sd_request_response_delay_(VSOMEIP_SD_DEFAULT_REQUEST_RESPONSE_DELAY),
- sd_offer_debounce_time_(VSOMEIP_SD_DEFAULT_OFFER_DEBOUNCE_TIME),
- max_configured_message_size_(0),
- max_local_message_size_(0),
- max_reliable_message_size_(0),
- buffer_shrink_threshold_(0),
- trace_(std::make_shared<trace>()),
- watchdog_(std::make_shared<watchdog>()),
- log_version_(true),
- log_version_interval_(10),
- permissions_shm_(VSOMEIP_DEFAULT_SHM_PERMISSION),
- umask_(VSOMEIP_DEFAULT_UMASK_LOCAL_ENDPOINTS),
- policy_enabled_(false),
- check_credentials_(false),
- network_("vsomeip"),
- e2e_enabled_(false),
- log_memory_(false),
- log_memory_interval_(0),
- log_status_(false),
- log_status_interval_(0),
- endpoint_queue_limit_external_(QUEUE_SIZE_UNLIMITED),
- endpoint_queue_limit_local_(QUEUE_SIZE_UNLIMITED) {
- unicast_ = unicast_.from_string(VSOMEIP_UNICAST_ADDRESS);
- for (auto i = 0; i < ET_MAX; i++)
- is_configured_[i] = false;
-}
-
-configuration_impl::configuration_impl(const configuration_impl &_other)
- : plugin_impl("vsomeip cfg plugin", 1, plugin_type_e::CONFIGURATION_PLUGIN),
- std::enable_shared_from_this<configuration_impl>(_other),
- is_loaded_(_other.is_loaded_),
- is_logging_loaded_(_other.is_logging_loaded_),
- mandatory_(_other.mandatory_),
- max_configured_message_size_(_other.max_configured_message_size_),
- max_local_message_size_(_other.max_local_message_size_),
- max_reliable_message_size_(_other.max_reliable_message_size_),
- buffer_shrink_threshold_(_other.buffer_shrink_threshold_),
- permissions_shm_(VSOMEIP_DEFAULT_SHM_PERMISSION),
- umask_(VSOMEIP_DEFAULT_UMASK_LOCAL_ENDPOINTS),
- endpoint_queue_limit_external_(_other.endpoint_queue_limit_external_),
- endpoint_queue_limit_local_(_other.endpoint_queue_limit_local_) {
-
- applications_.insert(_other.applications_.begin(), _other.applications_.end());
- services_.insert(_other.services_.begin(), _other.services_.end());
-
- unicast_ = _other.unicast_;
- diagnosis_ = _other.diagnosis_;
- diagnosis_mask_ = _other.diagnosis_mask_;
-
- has_console_log_ = _other.has_console_log_;
- has_file_log_ = _other.has_file_log_;
- has_dlt_log_ = _other.has_dlt_log_;
- logfile_ = _other.logfile_;
-
- loglevel_ = _other.loglevel_;
-
- routing_host_ = _other.routing_host_;
-
- is_sd_enabled_ = _other.is_sd_enabled_;
- sd_multicast_ = _other.sd_multicast_;
- sd_port_ = _other.sd_port_;
- sd_protocol_ = _other.sd_protocol_;
-
- sd_initial_delay_min_ = _other.sd_initial_delay_min_;
- sd_initial_delay_max_ = _other.sd_initial_delay_max_;
- sd_repetitions_base_delay_= _other.sd_repetitions_base_delay_;
- sd_repetitions_max_ = _other.sd_repetitions_max_;
- sd_ttl_ = _other.sd_ttl_;
- sd_cyclic_offer_delay_= _other.sd_cyclic_offer_delay_;
- sd_request_response_delay_= _other.sd_request_response_delay_;
- sd_offer_debounce_time_ = _other.sd_offer_debounce_time_;
-
- trace_ = std::make_shared<trace>(*_other.trace_.get());
- watchdog_ = std::make_shared<watchdog>(*_other.watchdog_.get());
- log_version_ = _other.log_version_;
- log_version_interval_ = _other.log_version_interval_;
-
- magic_cookies_.insert(_other.magic_cookies_.begin(), _other.magic_cookies_.end());
-
- for (auto i = 0; i < ET_MAX; i++)
- is_configured_[i] = _other.is_configured_[i];
-
- policy_enabled_ = _other.policy_enabled_;
- check_credentials_ = _other.check_credentials_;
- network_ = _other.network_;
- e2e_enabled_ = _other.e2e_enabled_;
-
- log_memory_ = _other.log_memory_;
- log_memory_interval_ = _other.log_memory_interval_;
- log_status_ = _other.log_status_;
- log_status_interval_ = _other.log_status_interval_;
-
- debounces_ = _other.debounces_;
-}
-
-configuration_impl::~configuration_impl() {
-}
-
-bool configuration_impl::load(const std::string &_name) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (is_loaded_)
- return true;
-
- // Predefine file / folder
- std::string its_file(VSOMEIP_DEFAULT_CONFIGURATION_FILE); // configuration file
- std::string its_folder(VSOMEIP_DEFAULT_CONFIGURATION_FOLDER); // configuration folder
-
- // Override with local file / folder (if existing)
- std::string its_local_file(VSOMEIP_LOCAL_CONFIGURATION_FILE);
- if (utility::is_file(its_local_file)) {
- its_file = its_local_file;
- }
-
- std::string its_local_folder(VSOMEIP_LOCAL_CONFIGURATION_FOLDER);
- if (utility::is_folder(its_local_folder)) {
- its_folder = its_local_folder;
- }
-
- // Override with path from environment (if existing)
- const char *its_env = getenv(VSOMEIP_ENV_CONFIGURATION);
- if (nullptr != its_env) {
- if (utility::is_file(its_env)) {
- its_file = its_env;
- its_folder = "";
- } else if (utility::is_folder(its_env)) {
- its_folder = its_env;
- its_file = "";
- }
- }
-
- std::set<std::string> its_input;
- if (its_file != "") {
- its_input.insert(its_file);
- }
- if (its_folder != "") {
- its_input.insert(its_folder);
- }
-
- // Add debug configuration folder/file on top of already set input
- const char* its_debug_env = getenv(VSOMEIP_ENV_DEBUG_CONFIGURATION);
- if (nullptr != its_debug_env) {
- its_input.insert(its_debug_env);
- } else {
- its_input.insert(VSOMEIP_DEBUG_CONFIGURATION_FOLDER);
- }
-
- // Determine standard configuration file
- its_env = getenv(VSOMEIP_ENV_MANDATORY_CONFIGURATION_FILES);
- if (nullptr != its_env) {
- std::string its_temp(its_env);
- set_mandatory(its_temp);
- } else {
- set_mandatory(VSOMEIP_MANDATORY_CONFIGURATION_FILES);
- }
-
- // Start reading
- std::set<std::string> its_failed;
-
- std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
- std::vector<element> its_mandatory_elements;
- std::vector<element> its_optional_elements;
-
- // Dummy initialization; maybe we'll find no logging configuration
- logger_impl::init(shared_from_this());
-
- // Look for the standard configuration file
- read_data(its_input, its_mandatory_elements, its_failed, true);
- load_data(its_mandatory_elements, true, false);
-
- // If the configuration is incomplete, this is the routing manager configuration or
- // the routing is yet unknown, read the full set of configuration files
- if (its_mandatory_elements.empty() ||
- _name == get_routing_host() ||
- "" == get_routing_host()) {
- read_data(its_input, its_optional_elements, its_failed, false);
- load_data(its_mandatory_elements, false, true);
- load_data(its_optional_elements, true, true);
- }
-
- // Tell, if reading of configuration file(s) failed.
- // (This may file if the logger configuration is incomplete/missing).
- for (auto f : its_failed)
- VSOMEIP_WARNING << "Reading of configuration file \""
- << f << "\" failed. Configuration may be incomplete.";
-
- // set global unicast address for all services with magic cookies enabled
- set_magic_cookies_unicast_address();
-
- std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
- VSOMEIP_INFO << "Parsed vsomeip configuration in "
- << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count()
- << "ms";
-
- for (auto i : its_input) {
- if (utility::is_file(i))
- VSOMEIP_INFO << "Using configuration file: \"" << i << "\".";
-
- if (utility::is_folder(i))
- VSOMEIP_INFO << "Using configuration folder: \"" << i << "\".";
- }
-
- if (policy_enabled_ && check_credentials_)
- VSOMEIP_INFO << "Security configuration is active.";
-
- if (policy_enabled_ && !check_credentials_)
- VSOMEIP_INFO << "Security configuration is active but in audit mode (allow all)";
-
- is_loaded_ = true;
-
- return is_loaded_;
-}
-
-void configuration_impl::read_data(const std::set<std::string> &_input,
- std::vector<element> &_elements, std::set<std::string> &_failed,
- bool _mandatory_only) {
- for (auto i : _input) {
- if (utility::is_file(i)) {
- if (is_mandatory(i) != _mandatory_only) {
- boost::property_tree::ptree its_tree;
- try {
- boost::property_tree::json_parser::read_json(i, its_tree);
- _elements.push_back({ i, its_tree });
- }
- catch (boost::property_tree::json_parser_error &e) {
- #ifdef _WIN32
- e; // silence MSVC warning C4101
- #endif
- _failed.insert(i);
- }
- }
- } else if (utility::is_folder(i)) {
- boost::filesystem::path its_path(i);
- for (auto j = boost::filesystem::directory_iterator(its_path);
- j != boost::filesystem::directory_iterator();
- j++) {
- auto its_file_path = j->path();
- if (!boost::filesystem::is_directory(its_file_path)) {
- std::string its_name = its_file_path.string();
- if (is_mandatory(its_name) == _mandatory_only) {
- boost::property_tree::ptree its_tree;
- try {
- boost::property_tree::json_parser::read_json(its_name, its_tree);
- _elements.push_back({its_name, its_tree});
- }
- catch (...) {
- _failed.insert(its_name);
- }
- }
- }
- }
- }
- }
-}
-
-
-bool configuration_impl::load_data(const std::vector<element> &_elements,
- bool _load_mandatory, bool _load_optional) {
- // Load logging configuration data
- std::set<std::string> its_warnings;
- if (!is_logging_loaded_) {
- for (auto e : _elements)
- is_logging_loaded_
- = load_logging(e, its_warnings) || is_logging_loaded_;
-
- if (is_logging_loaded_) {
- logger_impl::init(shared_from_this());
- for (auto w : its_warnings)
- VSOMEIP_WARNING << w;
- }
- }
-
- bool has_routing(false);
- bool has_applications(false);
- if (_load_mandatory) {
- // Load mandatory configuration data
- for (auto e : _elements) {
- has_routing = load_routing(e) || has_routing;
- has_applications = load_applications(e) || has_applications;
- load_network(e);
- load_diagnosis_address(e);
- load_payload_sizes(e);
- load_endpoint_queue_sizes(e);
- load_permissions(e);
- load_policies(e);
- load_tracing(e);
- }
- }
-
- if (_load_optional) {
- for (auto e : _elements) {
- load_unicast_address(e);
- load_service_discovery(e);
- load_services(e);
- load_internal_services(e);
- load_clients(e);
- load_watchdog(e);
- load_selective_broadcasts_support(e);
- load_e2e(e);
- load_debounce(e);
- }
- }
-
- return is_logging_loaded_ && has_routing && has_applications;
-}
-
-bool configuration_impl::load_logging(
- const element &_element, std::set<std::string> &_warnings) {
- try {
- auto its_logging = _element.tree_.get_child("logging");
- for (auto i = its_logging.begin(); i != its_logging.end(); ++i) {
- std::string its_key(i->first);
- if (its_key == "console") {
- if (is_configured_[ET_LOGGING_CONSOLE]) {
- _warnings.insert("Multiple definitions for logging.console."
- " Ignoring definition from " + _element.name_);
- } else {
- std::string its_value(i->second.data());
- has_console_log_ = (its_value == "true");
- is_configured_[ET_LOGGING_CONSOLE] = true;
- }
- } else if (its_key == "file") {
- if (is_configured_[ET_LOGGING_FILE]) {
- _warnings.insert("Multiple definitions for logging.file."
- " Ignoring definition from " + _element.name_);
- } else {
- for (auto j : i->second) {
- std::string its_sub_key(j.first);
- std::string its_sub_value(j.second.data());
- if (its_sub_key == "enable") {
- has_file_log_ = (its_sub_value == "true");
- } else if (its_sub_key == "path") {
- logfile_ = its_sub_value;
- }
- }
- is_configured_[ET_LOGGING_FILE] = true;
- }
- } else if (its_key == "dlt") {
- if (is_configured_[ET_LOGGING_DLT]) {
- _warnings.insert("Multiple definitions for logging.dlt."
- " Ignoring definition from " + _element.name_);
- } else {
- std::string its_value(i->second.data());
- has_dlt_log_ = (its_value == "true");
- is_configured_[ET_LOGGING_DLT] = true;
- }
- } else if (its_key == "level") {
- if (is_configured_[ET_LOGGING_LEVEL]) {
- _warnings.insert("Multiple definitions for logging.level."
- " Ignoring definition from " + _element.name_);
- } else {
- std::string its_value(i->second.data());
- loglevel_
- = (its_value == "trace" ?
- boost::log::trivial::severity_level::trace :
- (its_value == "debug" ?
- boost::log::trivial::severity_level::debug :
- (its_value == "info" ?
- boost::log::trivial::severity_level::info :
- (its_value == "warning" ?
- boost::log::trivial::severity_level::warning :
- (its_value == "error" ?
- boost::log::trivial::severity_level::error :
- (its_value == "fatal" ?
- boost::log::trivial::severity_level::fatal :
- boost::log::trivial::severity_level::info))))));
- is_configured_[ET_LOGGING_LEVEL] = true;
- }
- } else if (its_key == "version") {
- std::stringstream its_converter;
- for (auto j : i->second) {
- std::string its_sub_key(j.first);
- std::string its_sub_value(j.second.data());
- if (its_sub_key == "enable") {
- log_version_ = (its_sub_value == "true");
- } else if (its_sub_key == "interval") {
- its_converter << std::dec << its_sub_value;
- its_converter >> log_version_interval_;
- }
- }
- } else if (its_key == "memory_log_interval") {
- std::stringstream its_converter;
- its_converter << std::dec << i->second.data();
- its_converter >> log_memory_interval_;
- if (log_memory_interval_ > 0) {
- log_memory_ = true;
- }
- } else if (its_key == "status_log_interval") {
- std::stringstream its_converter;
- its_converter << std::dec << i->second.data();
- its_converter >> log_status_interval_;
- if (log_status_interval_ > 0) {
- log_status_ = true;
- }
- }
- }
- } catch (...) {
- return false;
- }
- return true;
-}
-
-bool configuration_impl::load_routing(const element &_element) {
- try {
- auto its_routing = _element.tree_.get_child("routing");
- if (is_configured_[ET_ROUTING]) {
- VSOMEIP_WARNING << "Multiple definitions of routing."
- << " Ignoring definition from " << _element.name_;
- } else {
- routing_host_ = its_routing.data();
- is_configured_[ET_ROUTING] = true;
- }
- } catch (...) {
- return false;
- }
- return true;
-}
-
-bool configuration_impl::load_applications(const element &_element) {
- try {
- std::stringstream its_converter;
- auto its_applications = _element.tree_.get_child("applications");
- for (auto i = its_applications.begin();
- i != its_applications.end();
- ++i) {
- load_application_data(i->second, _element.name_);
- }
- } catch (...) {
- return false;
- }
- return true;
-}
-
-void configuration_impl::load_application_data(
- const boost::property_tree::ptree &_tree, const std::string &_file_name) {
- std::string its_name("");
- client_t its_id(0);
- std::size_t its_max_dispatchers(VSOMEIP_MAX_DISPATCHERS);
- std::size_t its_max_dispatch_time(VSOMEIP_MAX_DISPATCH_TIME);
- std::size_t its_io_thread_count(VSOMEIP_IO_THREAD_COUNT);
- std::size_t its_request_debounce_time(VSOMEIP_REQUEST_DEBOUNCE_TIME);
- std::map<plugin_type_e, std::set<std::string>> plugins;
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key(i->first);
- std::string its_value(i->second.data());
- std::stringstream its_converter;
- if (its_key == "name") {
- its_name = its_value;
- } else if (its_key == "id") {
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_id;
- } else if (its_key == "max_dispatchers") {
- its_converter << std::dec << its_value;
- its_converter >> its_max_dispatchers;
- } else if (its_key == "max_dispatch_time") {
- its_converter << std::dec << its_value;
- its_converter >> its_max_dispatch_time;
- } else if (its_key == "threads") {
- its_converter << std::dec << its_value;
- its_converter >> its_io_thread_count;
- if (its_io_thread_count == 0) {
- VSOMEIP_WARNING << "Min. number of threads per application is 1";
- its_io_thread_count = 1;
- } else if (its_io_thread_count > 255) {
- VSOMEIP_WARNING << "Max. number of threads per application is 255";
- its_io_thread_count = 255;
- }
- } else if (its_key == "request_debounce_time") {
- its_converter << std::dec << its_value;
- its_converter >> its_request_debounce_time;
- if (its_request_debounce_time > 10000) {
- VSOMEIP_WARNING << "Max. request debounce time is 10.000ms";
- its_request_debounce_time = 10000;
- }
- } else if (its_key == "plugins") {
- for (auto l = i->second.begin(); l != i->second.end(); ++l) {
- for (auto n = l->second.begin(); n != l->second.end(); ++n) {
- std::string its_inner_key(n->first);
- std::string its_inner_value(n->second.data());
- #ifdef _WIN32
- std::string library(its_inner_value);
- library += ".dll";
- #else
- std::string library("lib");
- library += its_inner_value;
- library += ".so";
- #endif
- if (its_inner_key == "application_plugin") {
- #ifndef _WIN32
- library += ".";
- library += (VSOMEIP_APPLICATION_PLUGIN_VERSION + '0');
- #endif
- plugins[plugin_type_e::APPLICATION_PLUGIN].insert(library);
- } else if (its_inner_key == "configuration_plugin") {
- #ifndef _WIN32
- library += ".";
- library += (VSOMEIP_PRE_CONFIGURATION_PLUGIN_VERSION + '0');
- #endif
- plugins[plugin_type_e::PRE_CONFIGURATION_PLUGIN].insert(library);
- } else {
- VSOMEIP_WARNING << "Unknown plug-in type ("
- << its_inner_key << ") configured for client: "
- << its_name;
- }
- }
- }
- }
- }
- if (its_name != "") {
- if (applications_.find(its_name) == applications_.end()) {
- if (its_id > 0) {
- if (!is_configured_client_id(its_id)) {
- client_identifiers_.insert(its_id);
- } else {
- VSOMEIP_ERROR << "Multiple applications are configured to use"
- << " client identifier " << std::hex << its_id
- << ". Ignoring the configuration for application "
- << its_name;
- its_id = 0;
- }
- }
- applications_[its_name]
- = std::make_tuple(its_id, its_max_dispatchers,
- its_max_dispatch_time, its_io_thread_count,
- its_request_debounce_time, plugins);
- } else {
- VSOMEIP_WARNING << "Multiple configurations for application "
- << its_name << ". Ignoring a configuration from "
- << _file_name;
- }
- }
-}
-
-void configuration_impl::load_tracing(const element &_element) {
- try {
- std::stringstream its_converter;
- auto its_trace_configuration = _element.tree_.get_child("tracing");
- for(auto i = its_trace_configuration.begin();
- i != its_trace_configuration.end();
- ++i) {
- std::string its_key(i->first);
- std::string its_value(i->second.data());
- if(its_key == "enable") {
- if (is_configured_[ET_TRACING_ENABLE]) {
- VSOMEIP_WARNING << "Multiple definitions of tracing.enable."
- << " Ignoring definition from " << _element.name_;
- } else {
- trace_->is_enabled_ = (its_value == "true");
- is_configured_[ET_TRACING_ENABLE] = true;
- }
- } else if (its_key == "sd_enable") {
- if (is_configured_[ET_TRACING_SD_ENABLE]) {
- VSOMEIP_WARNING << "Multiple definitions of tracing.sd_enable."
- << " Ignoring definition from " << _element.name_;
- } else {
- trace_->is_sd_enabled_ = (its_value == "true");
- is_configured_[ET_TRACING_SD_ENABLE] = true;
- }
- } else if(its_key == "channels") {
- load_trace_channels(i->second);
- } else if(its_key == "filters") {
- load_trace_filters(i->second);
- }
- }
- } catch (...) {
- // intentionally left empty
- }
-}
-
-void configuration_impl::load_trace_channels(
- const boost::property_tree::ptree &_tree) {
- try {
- for(auto i = _tree.begin(); i != _tree.end(); ++i) {
- if(i == _tree.begin())
- trace_->channels_.clear();
- load_trace_channel(i->second);
- }
- } catch (...) {
- // intentionally left empty
- }
-}
-
-void configuration_impl::load_trace_channel(
- const boost::property_tree::ptree &_tree) {
- std::shared_ptr<trace_channel> its_channel = std::make_shared<trace_channel>();
- for(auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key = i->first;
- std::string its_value = i->second.data();
- if(its_key == "name") {
- its_channel->name_ = its_value;
- } else if(its_key == "id") {
- its_channel->id_ = its_value;
- }
- }
- trace_->channels_.push_back(its_channel);
-}
-
-void configuration_impl::load_trace_filters(
- const boost::property_tree::ptree &_tree) {
- try {
- for(auto i = _tree.begin(); i != _tree.end(); ++i) {
- load_trace_filter(i->second);
- }
- } catch (...) {
- // intentionally left empty
- }
-}
-
-void configuration_impl::load_trace_filter(
- const boost::property_tree::ptree &_tree) {
- std::shared_ptr<trace_filter_rule> its_filter_rule = std::make_shared<trace_filter_rule>();
- for(auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key = i->first;
- std::string its_value = i->second.data();
- if(its_key == "channel") {
- its_filter_rule->channel_ = its_value;
- } else if(its_key == "type") {
- its_filter_rule->type_ = its_value;
- } else {
- load_trace_filter_expressions(i->second, its_key, its_filter_rule);
- }
- }
- trace_->filter_rules_.push_back(its_filter_rule);
-}
-
-void configuration_impl::load_trace_filter_expressions(
- const boost::property_tree::ptree &_tree,
- std::string &_criteria,
- std::shared_ptr<trace_filter_rule> &_filter_rule) {
- for(auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_value = i->second.data();
- std::stringstream its_converter;
-
- if(_criteria == "services") {
- service_t its_id = NO_TRACE_FILTER_EXPRESSION;
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_id;
- _filter_rule->services_.push_back(its_id);
- } else if(_criteria == "methods") {
- method_t its_id = NO_TRACE_FILTER_EXPRESSION;
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_id;
- _filter_rule->methods_.push_back(its_id);
- } else if(_criteria == "clients") {
- client_t its_id = NO_TRACE_FILTER_EXPRESSION;
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_id;
- _filter_rule->clients_.push_back(its_id);
- }
- }
-}
-
-void configuration_impl::load_unicast_address(const element &_element) {
- try {
- std::string its_value = _element.tree_.get<std::string>("unicast");
- if (is_configured_[ET_UNICAST]) {
- VSOMEIP_WARNING << "Multiple definitions for unicast."
- "Ignoring definition from " << _element.name_;
- } else {
- unicast_ = unicast_.from_string(its_value);
- is_configured_[ET_UNICAST] = true;
- }
- } catch (...) {
- // intentionally left empty!
- }
-}
-
-void configuration_impl::load_network(const element &_element) {
- try {
- std::string its_value(_element.tree_.get<std::string>("network"));
- if (is_configured_[ET_NETWORK]) {
- VSOMEIP_WARNING << "Multiple definitions for network."
- "Ignoring definition from " << _element.name_;
- } else {
- network_ = its_value;
- is_configured_[ET_NETWORK] = true;
- }
- } catch (...) {
- // intentionally left empty
- }
-}
-
-void configuration_impl::load_diagnosis_address(const element &_element) {
- try {
- std::string its_value = _element.tree_.get<std::string>("diagnosis");
- if (is_configured_[ET_DIAGNOSIS]) {
- VSOMEIP_WARNING << "Multiple definitions for diagnosis."
- "Ignoring definition from " << _element.name_;
- } else {
- std::stringstream its_converter;
-
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> diagnosis_;
- is_configured_[ET_DIAGNOSIS] = true;
- }
- std::string its_mask = _element.tree_.get<std::string>("diagnosis_mask");
- if (is_configured_[ET_DIAGNOSIS_MASK]) {
- VSOMEIP_WARNING << "Multiple definitions for diagnosis_mask."
- "Ignoring definition from " << _element.name_;
- } else {
- std::stringstream its_converter;
-
- if (its_mask.size() > 1 && its_mask[0] == '0' && its_mask[1] == 'x') {
- its_converter << std::hex << its_mask;
- } else {
- its_converter << std::dec << its_mask;
- }
- its_converter >> diagnosis_mask_;
- is_configured_[ET_DIAGNOSIS_MASK] = true;
- }
- } catch (...) {
- // intentionally left empty
- }
-}
-
-void configuration_impl::load_service_discovery(
- const element &_element) {
- try {
- auto its_service_discovery = _element.tree_.get_child("service-discovery");
- for (auto i = its_service_discovery.begin();
- i != its_service_discovery.end(); ++i) {
- std::string its_key(i->first);
- std::string its_value(i->second.data());
- std::stringstream its_converter;
- if (its_key == "enable") {
- if (is_configured_[ET_SERVICE_DISCOVERY_ENABLE]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.enabled."
- " Ignoring definition from " << _element.name_;
- } else {
- is_sd_enabled_ = (its_value == "true");
- is_configured_[ET_SERVICE_DISCOVERY_ENABLE] = true;
- }
- } else if (its_key == "multicast") {
- if (is_configured_[ET_SERVICE_DISCOVERY_MULTICAST]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.multicast."
- " Ignoring definition from " << _element.name_;
- } else {
- sd_multicast_ = its_value;
- is_configured_[ET_SERVICE_DISCOVERY_MULTICAST] = true;
- }
- } else if (its_key == "port") {
- if (is_configured_[ET_SERVICE_DISCOVERY_PORT]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.port."
- " Ignoring definition from " << _element.name_;
- } else {
- its_converter << its_value;
- its_converter >> sd_port_;
- if (!sd_port_) {
- sd_port_ = VSOMEIP_SD_DEFAULT_PORT;
- } else {
- is_configured_[ET_SERVICE_DISCOVERY_PORT] = true;
- }
- }
- } else if (its_key == "protocol") {
- if (is_configured_[ET_SERVICE_DISCOVERY_PROTOCOL]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.protocol."
- " Ignoring definition from " << _element.name_;
- } else {
- sd_protocol_ = its_value;
- is_configured_[ET_SERVICE_DISCOVERY_PROTOCOL] = true;
- }
- } else if (its_key == "initial_delay_min") {
- if (is_configured_[ET_SERVICE_DISCOVERY_INITIAL_DELAY_MIN]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.initial_delay_min."
- " Ignoring definition from " << _element.name_;
- } else {
- its_converter << its_value;
- its_converter >> sd_initial_delay_min_;
- is_configured_[ET_SERVICE_DISCOVERY_INITIAL_DELAY_MIN] = true;
- }
- } else if (its_key == "initial_delay_max") {
- if (is_configured_[ET_SERVICE_DISCOVERY_INITIAL_DELAY_MAX]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.initial_delay_max."
- " Ignoring definition from " << _element.name_;
- } else {
- its_converter << its_value;
- its_converter >> sd_initial_delay_max_;
- is_configured_[ET_SERVICE_DISCOVERY_INITIAL_DELAY_MAX] = true;
- }
- } else if (its_key == "repetitions_base_delay") {
- if (is_configured_[ET_SERVICE_DISCOVERY_REPETITION_BASE_DELAY]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.repetition_base_delay."
- " Ignoring definition from " << _element.name_;
- } else {
- its_converter << its_value;
- its_converter >> sd_repetitions_base_delay_;
- is_configured_[ET_SERVICE_DISCOVERY_REPETITION_BASE_DELAY] = true;
- }
- } else if (its_key == "repetitions_max") {
- if (is_configured_[ET_SERVICE_DISCOVERY_REPETITION_MAX]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.repetition_max."
- " Ignoring definition from " << _element.name_;
- } else {
- int tmp;
- its_converter << its_value;
- its_converter >> tmp;
- sd_repetitions_max_ = (tmp > (std::numeric_limits<std::uint8_t>::max)()) ?
- (std::numeric_limits<std::uint8_t>::max)() :
- static_cast<std::uint8_t>(tmp);
- is_configured_[ET_SERVICE_DISCOVERY_REPETITION_MAX] = true;
- }
- } else if (its_key == "ttl") {
- if (is_configured_[ET_SERVICE_DISCOVERY_TTL]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.ttl."
- " Ignoring definition from " << _element.name_;
- } else {
- its_converter << its_value;
- its_converter >> sd_ttl_;
- // We do _not_ accept 0 as this would mean "STOP OFFER"
- if (sd_ttl_ == 0) sd_ttl_ = VSOMEIP_SD_DEFAULT_TTL;
- else is_configured_[ET_SERVICE_DISCOVERY_TTL] = true;
- }
- } else if (its_key == "cyclic_offer_delay") {
- if (is_configured_[ET_SERVICE_DISCOVERY_CYCLIC_OFFER_DELAY]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.cyclic_offer_delay."
- " Ignoring definition from " << _element.name_;
- } else {
- its_converter << its_value;
- its_converter >> sd_cyclic_offer_delay_;
- is_configured_[ET_SERVICE_DISCOVERY_CYCLIC_OFFER_DELAY] = true;
- }
- } else if (its_key == "request_response_delay") {
- if (is_configured_[ET_SERVICE_DISCOVERY_REQUEST_RESPONSE_DELAY]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.request_response_delay."
- " Ignoring definition from " << _element.name_;
- } else {
- its_converter << its_value;
- its_converter >> sd_request_response_delay_;
- is_configured_[ET_SERVICE_DISCOVERY_REQUEST_RESPONSE_DELAY] = true;
- }
- } else if (its_key == "offer_debounce_time") {
- if (is_configured_[ET_SERVICE_DISCOVERY_OFFER_DEBOUNCE_TIME]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.offer_debounce."
- " Ignoring definition from " << _element.name_;
- } else {
- its_converter << its_value;
- its_converter >> sd_offer_debounce_time_;
- is_configured_[ET_SERVICE_DISCOVERY_OFFER_DEBOUNCE_TIME] = true;
- }
- } else if (its_key == "ttl_factor_offers") {
- if (is_configured_[ET_SERVICE_DISCOVERY_TTL_FACTOR_OFFERS]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.ttl_factor_offers."
- " Ignoring definition from " << _element.name_;
- } else {
- load_ttl_factors(i->second, &ttl_factors_offers_);
- is_configured_[ET_SERVICE_DISCOVERY_TTL_FACTOR_OFFERS] = true;
- }
- } else if (its_key == "ttl_factor_subscriptions") {
- if (is_configured_[ET_SERVICE_DISCOVERY_TTL_FACTOR_SUBSCRIPTIONS]) {
- VSOMEIP_WARNING << "Multiple definitions for service_discovery.ttl_factor_subscriptions."
- " Ignoring definition from " << _element.name_;
- } else {
- load_ttl_factors(i->second, &ttl_factors_subscriptions_);
- is_configured_[ET_SERVICE_DISCOVERY_TTL_FACTOR_SUBSCRIPTIONS] = true;
- }
- }
- }
- } catch (...) {
- }
-}
-
-void configuration_impl::load_delays(
- const boost::property_tree::ptree &_tree) {
- try {
- std::stringstream its_converter;
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key(i->first);
- if (its_key == "initial") {
- sd_initial_delay_min_ = i->second.get<uint32_t>("minimum");
- sd_initial_delay_max_ = i->second.get<uint32_t>("maximum");
- } else if (its_key == "repetition-base") {
- its_converter << std::dec << i->second.data();
- its_converter >> sd_repetitions_base_delay_;
- } else if (its_key == "repetition-max") {
- int tmp_repetition_max;
- its_converter << std::dec << i->second.data();
- its_converter >> tmp_repetition_max;
- sd_repetitions_max_ =
- (tmp_repetition_max
- > (std::numeric_limits<std::uint8_t>::max)()) ?
- (std::numeric_limits<std::uint8_t>::max)() :
- static_cast<std::uint8_t>(tmp_repetition_max);
- } else if (its_key == "cyclic-offer") {
- its_converter << std::dec << i->second.data();
- its_converter >> sd_cyclic_offer_delay_;
- } else if (its_key == "cyclic-request") {
- its_converter << std::dec << i->second.data();
- its_converter >> sd_request_response_delay_;
- } else if (its_key == "ttl") {
- its_converter << std::dec << i->second.data();
- its_converter >> sd_ttl_;
- }
- its_converter.str("");
- its_converter.clear();
- }
- } catch (...) {
- }
-}
-
-void configuration_impl::load_services(const element &_element) {
- try {
- auto its_services = _element.tree_.get_child("services");
- for (auto i = its_services.begin(); i != its_services.end(); ++i)
- load_service(i->second, "local");
- } catch (...) {
- try {
- auto its_servicegroups = _element.tree_.get_child("servicegroups");
- for (auto i = its_servicegroups.begin(); i != its_servicegroups.end(); ++i)
- load_servicegroup(i->second);
- } catch (...) {
- // intentionally left empty
- }
- }
-}
-
-void configuration_impl::load_servicegroup(
- const boost::property_tree::ptree &_tree) {
- try {
- std::string its_unicast_address("local");
-
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key(i->first);
- if (its_key == "unicast") {
- its_unicast_address = i->second.data();
- break;
- }
- }
-
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key(i->first);
- if (its_key == "delays") {
- load_delays(i->second);
- } else if (its_key == "services") {
- for (auto j = i->second.begin(); j != i->second.end(); ++j)
- load_service(j->second, its_unicast_address);
- }
- }
- } catch (...) {
- // Intentionally left empty
- }
-}
-
-void configuration_impl::load_service(
- const boost::property_tree::ptree &_tree,
- const std::string &_unicast_address) {
- try {
- bool is_loaded(true);
- bool use_magic_cookies(false);
-
- std::shared_ptr<service> its_service(std::make_shared<service>());
- its_service->reliable_ = its_service->unreliable_ = ILLEGAL_PORT;
- its_service->unicast_address_ = _unicast_address;
- its_service->multicast_address_ = "";
- its_service->multicast_port_ = ILLEGAL_PORT;
- its_service->protocol_ = "someip";
-
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key(i->first);
- std::string its_value(i->second.data());
- std::stringstream its_converter;
-
- if (its_key == "unicast") {
- its_service->unicast_address_ = its_value;
- } else if (its_key == "reliable") {
- try {
- its_value = i->second.get_child("port").data();
- its_converter << its_value;
- its_converter >> its_service->reliable_;
- } catch (...) {
- its_converter << its_value;
- its_converter >> its_service->reliable_;
- }
- if(!its_service->reliable_) {
- its_service->reliable_ = ILLEGAL_PORT;
- }
- try {
- its_value
- = i->second.get_child("enable-magic-cookies").data();
- use_magic_cookies = ("true" == its_value);
- } catch (...) {
-
- }
- } else if (its_key == "unreliable") {
- its_converter << its_value;
- its_converter >> its_service->unreliable_;
- if(!its_service->unreliable_) {
- its_service->unreliable_ = ILLEGAL_PORT;
- }
- } else if (its_key == "multicast") {
- try {
- its_value = i->second.get_child("address").data();
- its_service->multicast_address_ = its_value;
- its_value = i->second.get_child("port").data();
- its_converter << its_value;
- its_converter >> its_service->multicast_port_;
- } catch (...) {
- }
- } else if (its_key == "protocol") {
- its_service->protocol_ = its_value;
- } else if (its_key == "events") {
- load_event(its_service, i->second);
- } else if (its_key == "eventgroups") {
- load_eventgroup(its_service, i->second);
- } else {
- // Trim "its_value"
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
-
- if (its_key == "service") {
- its_converter >> its_service->service_;
- } else if (its_key == "instance") {
- its_converter >> its_service->instance_;
- }
- }
- }
-
- auto found_service = services_.find(its_service->service_);
- if (found_service != services_.end()) {
- auto found_instance = found_service->second.find(
- its_service->instance_);
- if (found_instance != found_service->second.end()) {
- VSOMEIP_WARNING << "Multiple configurations for service ["
- << std::hex << its_service->service_ << "."
- << its_service->instance_ << "]";
- is_loaded = false;
- }
- }
-
- if (is_loaded) {
- services_[its_service->service_][its_service->instance_] =
- its_service;
- if (use_magic_cookies) {
- magic_cookies_[its_service->unicast_address_].insert(its_service->reliable_);
- }
- }
- } catch (...) {
- // Intentionally left empty
- }
-}
-
-void configuration_impl::load_event(
- std::shared_ptr<service> &_service,
- const boost::property_tree::ptree &_tree) {
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- event_t its_event_id(0);
- bool its_is_field(false);
- bool its_is_reliable(false);
-
- for (auto j = i->second.begin(); j != i->second.end(); ++j) {
- std::string its_key(j->first);
- std::string its_value(j->second.data());
- if (its_key == "event") {
- std::stringstream its_converter;
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_event_id;
- } else if (its_key == "is_field") {
- its_is_field = (its_value == "true");
- } else if (its_key == "is_reliable") {
- its_is_reliable = (its_value == "true");
- }
- }
-
- if (its_event_id > 0) {
- auto found_event = _service->events_.find(its_event_id);
- if (found_event != _service->events_.end()) {
- VSOMEIP_ERROR << "Multiple configurations for event ["
- << std::hex << _service->service_ << "."
- << _service->instance_ << "."
- << its_event_id << "]";
- } else {
- std::shared_ptr<event> its_event = std::make_shared<event>(
- its_event_id, its_is_field, its_is_reliable);
- _service->events_[its_event_id] = its_event;
- }
- }
- }
-}
-
-void configuration_impl::load_eventgroup(
- std::shared_ptr<service> &_service,
- const boost::property_tree::ptree &_tree) {
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::shared_ptr<eventgroup> its_eventgroup =
- std::make_shared<eventgroup>();
- for (auto j = i->second.begin(); j != i->second.end(); ++j) {
- std::stringstream its_converter;
- std::string its_key(j->first);
- std::string its_value(j->second.data());
- if (its_key == "eventgroup") {
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_eventgroup->id_;
- } else if (its_key == "is_multicast") {
- std::string its_value(j->second.data());
- if (its_value == "true") {
- its_eventgroup->multicast_address_ = _service->multicast_address_;
- its_eventgroup->multicast_port_ = _service->multicast_port_;
- }
- } else if (its_key == "multicast") {
- try {
- std::string its_value = j->second.get_child("address").data();
- its_eventgroup->multicast_address_ = its_value;
- its_value = j->second.get_child("port").data();
- its_converter << its_value;
- its_converter >> its_eventgroup->multicast_port_;
- } catch (...) {
- }
- } else if (its_key == "threshold") {
- int its_threshold(0);
- std::stringstream its_converter;
- its_converter << std::dec << its_value;
- its_converter >> std::dec >> its_threshold;
- its_eventgroup->threshold_ =
- (its_threshold > (std::numeric_limits<std::uint8_t>::max)()) ?
- (std::numeric_limits<std::uint8_t>::max)() :
- static_cast<uint8_t>(its_threshold);
- } else if (its_key == "events") {
- for (auto k = j->second.begin(); k != j->second.end(); ++k) {
- std::stringstream its_converter;
- std::string its_value(k->second.data());
- event_t its_event_id(0);
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_event_id;
- if (0 < its_event_id) {
- std::shared_ptr<event> its_event(nullptr);
- auto find_event = _service->events_.find(its_event_id);
- if (find_event != _service->events_.end()) {
- its_event = find_event->second;
- } else {
- its_event = std::make_shared<event>(its_event_id,
- false, false);
- }
- if (its_event) {
- its_event->groups_.push_back(its_eventgroup);
- its_eventgroup->events_.insert(its_event);
- _service->events_[its_event_id] = its_event;
- }
- }
- }
- }
- }
-
- if (its_eventgroup->id_ > 0) {
- _service->eventgroups_[its_eventgroup->id_] = its_eventgroup;
- }
- }
-}
-
-void configuration_impl::load_internal_services(const element &_element) {
- try {
- auto optional = _element.tree_.get_child_optional("internal_services");
- if (!optional) {
- return;
- }
- auto its_internal_services = _element.tree_.get_child("internal_services");
- for (auto found_range = its_internal_services.begin();
- found_range != its_internal_services.end(); ++found_range) {
- service_instance_range range;
- range.first_service_ = 0x0;
- range.last_service_ = 0x0;
- range.first_instance_ = 0x0;
- range.last_instance_ = 0xffff;
- for (auto i = found_range->second.begin();
- i != found_range->second.end(); ++i) {
- if (i->first == "first") {
- if (i->second.size() == 0) {
- std::stringstream its_converter;
- std::string value = i->second.data();
- its_converter << std::hex << value;
- its_converter >> range.first_service_;
- }
- for (auto n = i->second.begin();
- n != i->second.end(); ++n) {
- if (n->first == "service") {
- std::stringstream its_converter;
- std::string value = n->second.data();
- its_converter << std::hex << value;
- its_converter >> range.first_service_;
- } else if (n->first == "instance") {
- std::stringstream its_converter;
- std::string value = n->second.data();
- its_converter << std::hex << value;
- its_converter >> range.first_instance_;
- }
- }
- } else if (i->first == "last") {
- if (i->second.size() == 0) {
- std::stringstream its_converter;
- std::string value = i->second.data();
- its_converter << std::hex << value;
- its_converter >> range.last_service_;
- }
- for (auto n = i->second.begin();
- n != i->second.end(); ++n) {
- if (n->first == "service") {
- std::stringstream its_converter;
- std::string value = n->second.data();
- its_converter << std::hex << value;
- its_converter >> range.last_service_;
- } else if (n->first == "instance") {
- std::stringstream its_converter;
- std::string value = n->second.data();
- its_converter << std::hex << value;
- its_converter >> range.last_instance_;
- }
- }
- }
- }
- if (range.last_service_ >= range.first_service_) {
- if (range.last_instance_ >= range.first_instance_) {
- internal_service_ranges_.push_back(range);
- }
- }
- }
- } catch (...) {
- VSOMEIP_ERROR << "Error parsing internal service range configuration!";
- }
-}
-
-void configuration_impl::load_clients(const element &_element) {
- try {
- auto its_clients = _element.tree_.get_child("clients");
- for (auto i = its_clients.begin(); i != its_clients.end(); ++i)
- load_client(i->second);
- } catch (...) {
- // intentionally left empty!
- }
-}
-
-void configuration_impl::load_client(const boost::property_tree::ptree &_tree) {
- try {
- std::shared_ptr<client> its_client(std::make_shared<client>());
- its_client->remote_ports_[true] = std::make_pair(ILLEGAL_PORT, ILLEGAL_PORT);
- its_client->remote_ports_[false] = std::make_pair(ILLEGAL_PORT, ILLEGAL_PORT);
- its_client->client_ports_[true] = std::make_pair(ILLEGAL_PORT, ILLEGAL_PORT);
- its_client->client_ports_[false] = std::make_pair(ILLEGAL_PORT, ILLEGAL_PORT);
-
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key(i->first);
- std::string its_value(i->second.data());
- std::stringstream its_converter;
-
- if (its_key == "reliable_remote_ports") {
- its_client->remote_ports_[true] = load_client_port_range(i->second);
- } else if (its_key == "unreliable_remote_ports") {
- its_client->remote_ports_[false] = load_client_port_range(i->second);
- } else if (its_key == "reliable_client_ports") {
- its_client->client_ports_[true] = load_client_port_range(i->second);
- } else if (its_key == "unreliable_client_ports") {
- its_client->client_ports_[false] = load_client_port_range(i->second);
- } else if (its_key == "reliable") {
- its_client->ports_[true] = load_client_ports(i->second);
- } else if (its_key == "unreliable") {
- its_client->ports_[false] = load_client_ports(i->second);
- } else {
- // Trim "its_value"
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
-
- if (its_key == "service") {
- its_converter >> its_client->service_;
- } else if (its_key == "instance") {
- its_converter >> its_client->instance_;
- }
- }
- }
- clients_.push_back(its_client);
- } catch (...) {
- }
-}
-
-std::set<uint16_t> configuration_impl::load_client_ports(
- const boost::property_tree::ptree &_tree) {
- std::set<uint16_t> its_ports;
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_value(i->second.data());
- uint16_t its_port_value;
-
- std::stringstream its_converter;
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_port_value;
- its_ports.insert(its_port_value);
- }
- return its_ports;
-}
-
-std::pair<uint16_t,uint16_t> configuration_impl::load_client_port_range(
- const boost::property_tree::ptree &_tree) {
- std::pair<uint16_t,uint16_t> its_port_range;
- uint16_t its_first_port = ILLEGAL_PORT;
- uint16_t its_last_port = ILLEGAL_PORT;
-
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key(i->first);
- std::string its_value(i->second.data());
- std::stringstream its_converter;
-
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
-
- if (its_key == "first") {
- its_converter >> its_first_port;
- } else if (its_key == "last") {
- its_converter >> its_last_port;
- }
- }
-
- if (its_last_port < its_first_port) {
- VSOMEIP_WARNING << "Port range invalid: first: " << std::dec << its_first_port << " last: " << its_last_port;
- its_port_range = std::make_pair(ILLEGAL_PORT, ILLEGAL_PORT);
- } else {
- its_port_range = std::make_pair(its_first_port, its_last_port);
- }
-
- return its_port_range;
-}
-
-void configuration_impl::load_watchdog(const element &_element) {
- try {
- auto its_service_discovery = _element.tree_.get_child("watchdog");
- for (auto i = its_service_discovery.begin();
- i != its_service_discovery.end(); ++i) {
- std::string its_key(i->first);
- std::string its_value(i->second.data());
- std::stringstream its_converter;
- if (its_key == "enable") {
- if (is_configured_[ET_WATCHDOG_ENABLE]) {
- VSOMEIP_WARNING << "Multiple definitions of watchdog.enable."
- " Ignoring definition from " << _element.name_;
- } else {
- watchdog_->is_enabeled_ = (its_value == "true");
- is_configured_[ET_WATCHDOG_ENABLE] = true;
- }
- } else if (its_key == "timeout") {
- if (is_configured_[ET_WATCHDOG_TIMEOUT]) {
- VSOMEIP_WARNING << "Multiple definitions of watchdog.timeout."
- " Ignoring definition from " << _element.name_;
- } else {
- its_converter << std::dec << its_value;
- its_converter >> watchdog_->timeout_in_ms_;
- is_configured_[ET_WATCHDOG_TIMEOUT] = true;
- }
- } else if (its_key == "allowed_missing_pongs") {
- if (is_configured_[ET_WATCHDOG_ALLOWED_MISSING_PONGS]) {
- VSOMEIP_WARNING << "Multiple definitions of watchdog.allowed_missing_pongs."
- " Ignoring definition from " << _element.name_;
- } else {
- its_converter << std::dec << its_value;
- its_converter >> watchdog_->missing_pongs_allowed_;
- is_configured_[ET_WATCHDOG_ALLOWED_MISSING_PONGS] = true;
- }
- }
- }
- } catch (...) {
- }
-}
-
-void configuration_impl::load_payload_sizes(const element &_element) {
- const std::string payload_sizes("payload-sizes");
- const std::string max_local_payload_size("max-payload-size-local");
- const std::string buffer_shrink_threshold("buffer-shrink-threshold");
- const std::string max_reliable_payload_size("max-payload-size-reliable");
- try {
- if (_element.tree_.get_child_optional(max_local_payload_size)) {
- auto mpsl = _element.tree_.get_child(max_local_payload_size);
- std::string s(mpsl.data());
- try {
- // add 16 Byte for the SOME/IP header
- max_local_message_size_ = static_cast<std::uint32_t>(std::stoul(
- s.c_str(), NULL, 10) + 16);
- } catch (const std::exception &e) {
- VSOMEIP_ERROR<< __func__ << ": " << max_local_payload_size
- << " " << e.what();
- }
- }
- if (_element.tree_.get_child_optional(max_reliable_payload_size)) {
- auto mpsl = _element.tree_.get_child(max_reliable_payload_size);
- std::string s(mpsl.data());
- try {
- // add 16 Byte for the SOME/IP header
- max_reliable_message_size_ = static_cast<std::uint32_t>(std::stoul(
- s.c_str(), NULL, 10) + 16);
- } catch (const std::exception &e) {
- VSOMEIP_ERROR<< __func__ << ": " << max_reliable_payload_size
- << " " << e.what();
- }
- }
- if (_element.tree_.get_child_optional(buffer_shrink_threshold)) {
- auto bst = _element.tree_.get_child(buffer_shrink_threshold);
- std::string s(bst.data());
- try {
- buffer_shrink_threshold_ = static_cast<std::uint32_t>(
- std::stoul(s.c_str(), NULL, 10));
- } catch (const std::exception &e) {
- VSOMEIP_ERROR<< __func__ << ": " << buffer_shrink_threshold
- << " " << e.what();
- }
- }
- if (_element.tree_.get_child_optional(payload_sizes)) {
- const std::string unicast("unicast");
- const std::string ports("ports");
- const std::string port("port");
- const std::string max_payload_size("max-payload-size");
- auto its_ps = _element.tree_.get_child(payload_sizes);
- for (auto i = its_ps.begin(); i != its_ps.end(); ++i) {
- if (!i->second.get_child_optional(unicast)
- || !i->second.get_child_optional(ports)) {
- continue;
- }
- std::string its_unicast(i->second.get_child(unicast).data());
- for (auto j = i->second.get_child(ports).begin();
- j != i->second.get_child(ports).end(); ++j) {
-
- if (!j->second.get_child_optional(port)
- || !j->second.get_child_optional(max_payload_size)) {
- continue;
- }
-
- std::uint16_t its_port = ILLEGAL_PORT;
- std::uint32_t its_message_size = 0;
-
- try {
- std::string p(j->second.get_child(port).data());
- its_port = static_cast<std::uint16_t>(std::stoul(p.c_str(),
- NULL, 10));
- std::string s(j->second.get_child(max_payload_size).data());
- // add 16 Byte for the SOME/IP header
- its_message_size = static_cast<std::uint32_t>(std::stoul(
- s.c_str(),
- NULL, 10) + 16);
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << __func__ << ":" << e.what();
- }
-
- if (its_port == ILLEGAL_PORT || its_message_size == 0) {
- continue;
- }
- if (max_configured_message_size_ < its_message_size) {
- max_configured_message_size_ = its_message_size;
- }
-
- message_sizes_[its_unicast][its_port] = its_message_size;
- }
- }
- if (max_local_message_size_ != 0
- && max_configured_message_size_ != 0
- && max_configured_message_size_ > max_local_message_size_) {
- VSOMEIP_WARNING << max_local_payload_size
- << " is configured smaller than the biggest payloadsize"
- << " for external communication. "
- << max_local_payload_size << " will be increased to "
- << max_configured_message_size_ - 16 << " to ensure "
- << "local message distribution.";
- max_local_message_size_ = max_configured_message_size_;
- }
- if (max_local_message_size_ != 0
- && max_reliable_message_size_ != 0
- && max_reliable_message_size_ > max_local_message_size_) {
- VSOMEIP_WARNING << max_local_payload_size << " ("
- << max_local_message_size_ - 16 << ") is configured"
- << " smaller than " << max_reliable_payload_size << " ("
- << max_reliable_message_size_ - 16 << "). "
- << max_local_payload_size << " will be increased to "
- << max_reliable_message_size_ - 16 << " to ensure "
- << "local message distribution.";
- max_local_message_size_ = max_reliable_message_size_;
- }
- }
- } catch (...) {
- }
-}
-
-void configuration_impl::load_permissions(const element &_element) {
- const std::string file_permissions("file-permissions");
- try {
- if (_element.tree_.get_child_optional(file_permissions)) {
- auto its_permissions = _element.tree_.get_child(file_permissions);
- for (auto i = its_permissions.begin(); i != its_permissions.end();
- ++i) {
- std::string its_key(i->first);
- std::stringstream its_converter;
- if (its_key == "permissions-shm") {
- std::string its_value(i->second.data());
- its_converter << std::oct << its_value;
- its_converter >> permissions_shm_;
- } else if (its_key == "umask") {
- std::string its_value(i->second.data());
- its_converter << std::oct << its_value;
- its_converter >> umask_;
-
- }
- }
- }
- } catch (...) {
- }
-}
-
-void configuration_impl::load_selective_broadcasts_support(const element &_element) {
- try {
- auto its_service_discovery = _element.tree_.get_child("supports_selective_broadcasts");
- for (auto i = its_service_discovery.begin();
- i != its_service_discovery.end(); ++i) {
- std::string its_key(i->first);
- std::string its_value(i->second.data());
- std::stringstream its_converter;
- if (its_key == "address") {
- supported_selective_addresses.insert(its_value);
- }
- }
- } catch (...) {
- }
-}
-
-
-
-void configuration_impl::load_policies(const element &_element) {
-#ifdef _WIN32
- return;
-#endif
- try {
- auto optional = _element.tree_.get_child_optional("security");
- if (!optional) {
- return;
- }
- policy_enabled_ = true;
- auto found_policy = _element.tree_.get_child("security");
- for (auto its_security = found_policy.begin();
- its_security != found_policy.end(); ++its_security) {
- if (its_security->first == "check_credentials") {
- if (its_security->second.data() == "true") {
- check_credentials_ = true;
- } else {
- check_credentials_ = false;
- }
- }
- if (its_security->first == "policies") {
- for (auto its_policy = its_security->second.begin();
- its_policy != its_security->second.end(); ++its_policy) {
- load_policy(its_policy->second);
- }
- }
- }
- } catch (...) {
- }
-}
-
-void configuration_impl::load_policy(const boost::property_tree::ptree &_tree) {
- client_t client = 0x0;
- std::shared_ptr<policy> policy(std::make_shared<policy>());
- bool has_been_inserted(false);
- bool allow_deny_set(false);
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- if (i->first == "client") {
- std::string value = i->second.data();
- if (value == "") {
- client_t firstClient(ILLEGAL_CLIENT);
- client_t lastClient(ILLEGAL_CLIENT);
- for (auto n = i->second.begin();
- n != i->second.end(); ++n) {
- if (n->first == "first") {
- std::stringstream its_converter;
- std::string value = n->second.data();
- its_converter << std::hex << value;
- its_converter >> firstClient;
- } else if (n->first == "last") {
- std::stringstream its_converter;
- std::string value = n->second.data();
- its_converter << std::hex << value;
- its_converter >> lastClient;
- }
- }
- if (firstClient < lastClient && lastClient != ANY_CLIENT) {
- uint32_t overrides(0);
- for (client_t c = firstClient; c <= lastClient; ++c) {
- if (policies_.find(c) != policies_.end()) {
- overrides++;
- }
- policies_[c] = policy;
- }
- if (overrides) {
- VSOMEIP_INFO << std::hex << "Security configuration: "
- << "Client range 0x" << firstClient
- << " - 0x" << lastClient << " overrides policy of "
- << std::dec << overrides << " clients";
- }
- has_been_inserted = true;
- } else {
- VSOMEIP_WARNING << std::hex << "Security configuration: "
- << "Client range have to be ascending, \"first\"=0x"
- << firstClient << " : \"last\"=0x" << lastClient
- << " ~> Skip policy.";
- }
- } else {
- std::stringstream its_converter;
- its_converter << std::hex << value;
- its_converter >> client;
- if (client != 0x0) {
- if (policies_.find(client) != policies_.end()) {
- VSOMEIP_INFO << std::hex << "Security configuration: "
- << "Overriding policy for client 0x" << client << ".";
- }
- policies_[client] = policy;
- has_been_inserted= true;
- }
- }
- } else if (i->first == "credentials") {
- std::pair<uint32_t, uint32_t> its_uid_range, its_gid_range;
- bool has_uid(false), has_gid(false);
- for (auto n = i->second.begin();
- n != i->second.end(); ++n) {
- std::string its_key(n->first);
- std::string its_value(n->second.data());
- if (its_key == "uid") {
- if (its_value != "any") {
- uint32_t its_uid;
- std::stringstream its_converter;
- its_converter << std::dec << its_value;
- its_converter >> its_uid;
- std::get<0>(its_uid_range) = its_uid;
- std::get<1>(its_uid_range) = its_uid;
- } else {
- std::get<0>(its_uid_range) = 0;
- std::get<1>(its_uid_range) = 0xFFFFFFFF;
- }
- has_uid = true;
- } else if (its_key == "gid") {
- if (its_value != "any") {
- uint32_t its_gid;
- std::stringstream its_converter;
- its_converter << std::dec << its_value;
- its_converter >> its_gid;
- std::get<0>(its_gid_range) = its_gid;
- std::get<1>(its_gid_range) = its_gid;
- } else {
- std::get<0>(its_gid_range) = 0;
- std::get<1>(its_gid_range) = 0xFFFFFFFF;
- }
- has_gid = true;
- } else if (its_key == "allow" || its_key == "deny") {
- policy->allow_who_ = (its_key == "allow");
- load_credential(n->second, policy->ids_);
- }
- }
-
- if (has_uid && has_gid) {
- std::set<std::pair<uint32_t, uint32_t>> its_uids, its_gids;
-
- its_uids.insert(its_uid_range);
- its_gids.insert(its_gid_range);
-
- policy->allow_who_ = true;
- policy->ids_.insert(std::make_pair(its_uids, its_gids));
- }
-
- } else if (i->first == "allow") {
- if (allow_deny_set) {
- VSOMEIP_WARNING << "Security configuration: \"allow\" tag overrides "
- << "already set \"deny\" tag. "
- << "Either \"deny\" or \"allow\" is allowed.";
- }
- allow_deny_set = true;
- policy->allow_what_ = true;
- for (auto l = i->second.begin(); l != i->second.end(); ++l) {
- if (l->first == "requests") {
- for (auto n = l->second.begin(); n != l->second.end(); ++n) {
- service_t service = 0x0;
- instance_t instance = 0x0;
- for (auto k = n->second.begin(); k != n->second.end(); ++k) {
- std::stringstream its_converter;
- if (k->first == "service") {
- std::string value = k->second.data();
- its_converter << std::hex << value;
- its_converter >> service;
- } else if (k->first == "instance") {
- std::string value = k->second.data();
- its_converter << std::hex << value;
- its_converter >> instance;
- }
- }
- if (service != 0x0 && instance != 0x0) {
- policy->services_.insert(
- std::make_pair(service, instance));
- }
- }
- } else if (l->first == "offers") {
- for (auto n = l->second.begin(); n != l->second.end(); ++n) {
- service_t service = 0x0;
- instance_t instance = 0x0;
- for (auto k = n->second.begin(); k != n->second.end(); ++k) {
- std::stringstream its_converter;
- if (k->first == "service") {
- std::string value = k->second.data();
- its_converter << std::hex << value;
- its_converter >> service;
- } else if (k->first == "instance") {
- std::string value = k->second.data();
- its_converter << std::hex << value;
- its_converter >> instance;
- }
- }
- if (service != 0x0 && instance != 0x0) {
- policy->offers_.insert(
- std::make_pair(service, instance));
- }
- }
- }
- }
- } else if (i->first == "deny") {
- if (allow_deny_set) {
- VSOMEIP_WARNING << "Security configuration: \"deny\" tag overrides "
- << "already set \"allow\" tag. "
- << "Either \"deny\" or \"allow\" is allowed.";
- }
- allow_deny_set = true;
- policy->allow_what_ = false;
- for (auto l = i->second.begin(); l != i->second.end(); ++l) {
- if (l->first == "requests") {
- for (auto n = l->second.begin(); n != l->second.end(); ++n) {
- service_t service = 0x0;
- instance_t instance = 0x0;
- for (auto k = n->second.begin(); k != n->second.end(); ++k) {
- std::stringstream its_converter;
- if (k->first == "service") {
- std::string value = k->second.data();
- its_converter << std::hex << value;
- its_converter >> service;
- } else if (k->first == "instance") {
- std::string value = k->second.data();
- its_converter << std::hex << value;
- its_converter >> instance;
- }
- }
- if (service != 0x0 && instance != 0x0) {
- policy->services_.insert(
- std::make_pair(service, instance));
- }
- }
- }
- if (l->first == "offers") {
- for (auto n = l->second.begin(); n != l->second.end(); ++n) {
- service_t service = 0x0;
- instance_t instance = 0x0;
- for (auto k = n->second.begin(); k != n->second.end(); ++k) {
- std::stringstream its_converter;
- if (k->first == "service") {
- std::string value = k->second.data();
- its_converter << std::hex << value;
- its_converter >> service;
- } else if (k->first == "instance") {
- std::string value = k->second.data();
- its_converter << std::hex << value;
- its_converter >> instance;
- }
- }
- if (service != 0x0 && instance != 0x0) {
- policy->offers_.insert(
- std::make_pair(service, instance));
- }
- }
- }
- }
- }
- }
-
- if (!has_been_inserted) {
- policies_[ANY_CLIENT] = policy;
- }
-}
-
-void configuration_impl::load_credential(
- const boost::property_tree::ptree &_tree, ids_t &_ids) {
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- ranges_t its_uid_ranges, its_gid_ranges;
- for (auto j = i->second.begin(); j != i->second.end(); ++j) {
- std::string its_key(j->first);
- if (its_key == "uid") {
- load_ranges(j->second, its_uid_ranges);
- } else if (its_key == "gid") {
- load_ranges(j->second, its_gid_ranges);
- } else {
- VSOMEIP_WARNING << "Security configuration: "
- << "Malformed credential (contains illegal key \""
- << its_key << "\"";
- }
- }
-
- _ids.insert(std::make_pair(its_uid_ranges, its_gid_ranges));
- }
-}
-
-void configuration_impl::load_ranges(
- const boost::property_tree::ptree &_tree, ranges_t &_range) {
- ranges_t its_ranges;
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- auto its_data = i->second;
- if (!its_data.data().empty()) {
- uint32_t its_id;
- std::stringstream its_converter;
- its_converter << std::dec << its_data.data();
- its_converter >> its_id;
-
- its_ranges.insert(std::make_pair(its_id, its_id));
- } else {
- uint32_t its_first, its_last;
- bool has_first(false), has_last(false);
- for (auto j = its_data.begin(); j != its_data.end(); ++j) {
- std::string its_key(j->first);
- std::string its_value(j->second.data());
- if (its_key == "first") {
- if (its_value == "max") {
- its_first = 0xFFFFFFFF;
- } else {
- std::stringstream its_converter;
- its_converter << std::dec << j->second.data();
- its_converter >> its_first;
- }
- has_first = true;
- } else if (its_key == "last") {
- if (its_value == "max") {
- its_last = 0xFFFFFFFF;
- } else {
- std::stringstream its_converter;
- its_converter << std::dec << j->second.data();
- its_converter >> its_last;
- }
- has_last = true;
- } else {
- VSOMEIP_WARNING << "Security configuration: "
- << " Malformed range. Contains illegal key ("
- << its_key << ")";
- }
- }
-
- if (has_first && has_last) {
- its_ranges.insert(std::make_pair(its_first, its_last));
- }
- }
- }
-
- _range = its_ranges;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Internal helper
-///////////////////////////////////////////////////////////////////////////////
-void configuration_impl::set_magic_cookies_unicast_address() {
- // get services with static routing that have magic cookies enabled
- std::map<std::string, std::set<uint16_t> > its_magic_cookies_ = magic_cookies_;
- its_magic_cookies_.erase("local");
-
- //set unicast address of host for all services without static routing
- its_magic_cookies_[get_unicast_address().to_string()].insert(magic_cookies_["local"].begin(),
- magic_cookies_["local"].end());
- magic_cookies_.clear();
- magic_cookies_ = its_magic_cookies_;
-}
-
-bool configuration_impl::is_internal_service(service_t _service,
- instance_t _instance) const {
-
- for (auto its_range : internal_service_ranges_) {
- if (_service >= its_range.first_service_ &&
- _service <= its_range.last_service_ &&
- _instance >= its_range.first_instance_ &&
- _instance <= its_range.last_instance_) {
- return true;
- }
- }
- return false;
-}
-
-bool configuration_impl::is_in_port_range(uint16_t _port,
- std::pair<uint16_t, uint16_t> _port_range) const {
-
- if (_port >= _port_range.first &&
- _port <= _port_range.second ) {
- return true;
- }
- return false;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Public interface
-///////////////////////////////////////////////////////////////////////////////
-const std::string &configuration_impl::get_network() const {
- return network_;
-}
-
-const boost::asio::ip::address & configuration_impl::get_unicast_address() const {
- return unicast_;
-}
-
-unsigned short configuration_impl::get_diagnosis_address() const {
- return diagnosis_;
-}
-
-std::uint16_t configuration_impl::get_diagnosis_mask() const {
- return diagnosis_mask_;
-}
-
-bool configuration_impl::is_v4() const {
- return unicast_.is_v4();
-}
-
-bool configuration_impl::is_v6() const {
- return unicast_.is_v6();
-}
-
-bool configuration_impl::has_console_log() const {
- return has_console_log_;
-}
-
-bool configuration_impl::has_file_log() const {
- return has_file_log_;
-}
-
-bool configuration_impl::has_dlt_log() const {
- return has_dlt_log_;
-}
-
-const std::string & configuration_impl::get_logfile() const {
- return logfile_;
-}
-
-boost::log::trivial::severity_level configuration_impl::get_loglevel() const {
- return loglevel_;
-}
-
-std::string configuration_impl::get_unicast_address(service_t _service,
- instance_t _instance) const {
- std::string its_unicast_address("");
- auto its_service = find_service(_service, _instance);
- if (its_service) {
- its_unicast_address = its_service->unicast_address_;
- }
-
- if (its_unicast_address == "local" || its_unicast_address == "") {
- its_unicast_address = get_unicast_address().to_string();
- }
- return its_unicast_address;
-}
-
-uint16_t configuration_impl::get_reliable_port(service_t _service,
- instance_t _instance) const {
- uint16_t its_reliable(ILLEGAL_PORT);
- auto its_service = find_service(_service, _instance);
- if (its_service)
- its_reliable = its_service->reliable_;
-
- return its_reliable;
-}
-
-uint16_t configuration_impl::get_unreliable_port(service_t _service,
- instance_t _instance) const {
- uint16_t its_unreliable = ILLEGAL_PORT;
- auto its_service = find_service(_service, _instance);
- if (its_service)
- its_unreliable = its_service->unreliable_;
-
- return its_unreliable;
-}
-
-bool configuration_impl::is_someip(service_t _service,
- instance_t _instance) const {
- auto its_service = find_service(_service, _instance);
- if (its_service)
- return (its_service->protocol_ == "someip");
- return true; // we need to explicitely configure a service to
- // be something else than SOME/IP
-}
-
-bool configuration_impl::get_client_port(
- service_t _service, instance_t _instance,
- uint16_t _remote_port, bool _reliable,
- std::map<bool, std::set<uint16_t> > &_used_client_ports,
- uint16_t &_client_port) const {
- bool is_configured(false);
-
- _client_port = ILLEGAL_PORT;
- auto its_client = find_client(_service, _instance);
-
- // Check for service, instance specific port configuration
- if (its_client && !its_client->ports_[_reliable].empty()) {
- is_configured = true;
- for (auto its_port : its_client->ports_[_reliable]) {
- // Found free configured port
- if (_used_client_ports[_reliable].find(its_port) == _used_client_ports[_reliable].end()) {
- _client_port = its_port;
- return true;
- }
- }
- }
-
- // No specific port configuration found, use generic configuration
- uint16_t its_port(ILLEGAL_PORT);
- if (find_port(its_port, _remote_port, _reliable, _used_client_ports)) {
- is_configured = true;
- if (its_port != ILLEGAL_PORT) {
- _client_port = its_port;
- return true;
- }
- }
-
- if (!is_configured) {
- // Neither specific not generic configurarion available,
- // use dynamic port configuration!
- return true;
- }
-
- // Configured ports do exist, but they are all in use
- VSOMEIP_ERROR << "Cannot find free client port for communication to service: "
- << _service << " instance: "
- << _instance << " remote_port: "
- << _remote_port << " reliable: "
- << _reliable;
- return false;
-}
-
-bool configuration_impl::has_enabled_magic_cookies(std::string _address,
- uint16_t _port) const {
- bool has_enabled(false);
- auto find_address = magic_cookies_.find(_address);
- if (find_address != magic_cookies_.end()) {
- auto find_port = find_address->second.find(_port);
- if (find_port != find_address->second.end()) {
- has_enabled = true;
- }
- }
- return has_enabled;
-}
-
-
-const std::string & configuration_impl::get_routing_host() const {
- return routing_host_;
-}
-
-client_t configuration_impl::get_id(const std::string &_name) const {
- client_t its_client = 0;
-
- auto found_application = applications_.find(_name);
- if (found_application != applications_.end()) {
- its_client = std::get<0>(found_application->second);
- }
-
- return its_client;
-}
-
-bool configuration_impl::is_configured_client_id(client_t _id) const {
- return (client_identifiers_.find(_id) != client_identifiers_.end());
-}
-
-std::size_t configuration_impl::get_request_debouncing(const std::string &_name) const {
- size_t debounce_time = VSOMEIP_REQUEST_DEBOUNCE_TIME;
- auto found_application = applications_.find(_name);
- if (found_application != applications_.end()) {
- debounce_time = std::get<4>(found_application->second);
- }
-
- return debounce_time;
-}
-
-std::size_t configuration_impl::get_io_thread_count(const std::string &_name) const {
- std::size_t its_io_thread_count = VSOMEIP_IO_THREAD_COUNT;
-
- auto found_application = applications_.find(_name);
- if (found_application != applications_.end()) {
- its_io_thread_count = std::get<3>(found_application->second);
- }
-
- return its_io_thread_count;
-}
-
-std::size_t configuration_impl::get_max_dispatchers(
- const std::string &_name) const {
- std::size_t its_max_dispatchers = VSOMEIP_MAX_DISPATCHERS;
-
- auto found_application = applications_.find(_name);
- if (found_application != applications_.end()) {
- its_max_dispatchers = std::get<1>(found_application->second);
- }
-
- return its_max_dispatchers;
-}
-
-std::size_t configuration_impl::get_max_dispatch_time(
- const std::string &_name) const {
- std::size_t its_max_dispatch_time = VSOMEIP_MAX_DISPATCH_TIME;
-
- auto found_application = applications_.find(_name);
- if (found_application != applications_.end()) {
- its_max_dispatch_time = std::get<2>(found_application->second);
- }
-
- return its_max_dispatch_time;
-}
-
-std::set<std::pair<service_t, instance_t> >
-configuration_impl::get_remote_services() const {
- std::set<std::pair<service_t, instance_t> > its_remote_services;
- for (auto i : services_) {
- for (auto j : i.second) {
- if (is_remote(j.second)) {
- its_remote_services.insert(std::make_pair(i.first, j.first));
- }
- }
- }
- return its_remote_services;
-}
-
-bool configuration_impl::is_mandatory(const std::string &_name) const {
- std::set<std::string> its_candidates;
- for (auto m : mandatory_) {
- if (m.size() <= _name.size()) {
- its_candidates.insert(m);
- }
- }
-
- if (its_candidates.empty())
- return false;
-
- for (auto c : its_candidates) {
- if (std::equal(c.rbegin(), c.rend(), _name.rbegin())) {
- return true;
- }
- }
-
- return false;
-}
-
-void configuration_impl::set_mandatory(const std::string &_input) {
- if (_input.length() > 0) {
- auto found_separator = _input.find(',');
- std::string its_mandatory_file = _input.substr(0, found_separator);
- trim(its_mandatory_file);
- mandatory_.insert(its_mandatory_file);
- while (found_separator != std::string::npos) {
- auto last_separator = found_separator+1;
- found_separator = _input.find(',', last_separator);
- its_mandatory_file
- = _input.substr(last_separator, found_separator - last_separator);
- trim(its_mandatory_file);
- mandatory_.insert(its_mandatory_file);
- }
- }
-}
-
-void configuration_impl::trim(std::string &_s) {
- _s.erase(
- _s.begin(),
- std::find_if(
- _s.begin(),
- _s.end(),
- std::not1(std::ptr_fun(isspace))
- )
- );
-
- _s.erase(
- std::find_if(
- _s.rbegin(),
- _s.rend(),
- std::not1(std::ptr_fun(isspace))).base(),
- _s.end()
- );
-}
-
-bool configuration_impl::is_remote(std::shared_ptr<service> _service) const {
- return (_service->unicast_address_ != "local" &&
- _service->unicast_address_ != "" &&
- _service->unicast_address_ != unicast_.to_string() &&
- _service->unicast_address_ != VSOMEIP_UNICAST_ADDRESS);
-}
-
-bool configuration_impl::get_multicast(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- std::string &_address, uint16_t &_port) const
-{
- std::shared_ptr<eventgroup> its_eventgroup
- = find_eventgroup(_service, _instance, _eventgroup);
- if (!its_eventgroup)
- return false;
-
- if (its_eventgroup->multicast_address_.empty())
- return false;
-
- _address = its_eventgroup->multicast_address_;
- _port = its_eventgroup->multicast_port_;
- return true;
-}
-
-uint8_t configuration_impl::get_threshold(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) const {
- std::shared_ptr<eventgroup> its_eventgroup
- = find_eventgroup(_service, _instance, _eventgroup);
- return (its_eventgroup ? its_eventgroup->threshold_ : 0);
-}
-
-std::shared_ptr<client> configuration_impl::find_client(service_t _service,
- instance_t _instance) const {
- std::list<std::shared_ptr<client>>::const_iterator it;
-
- for (it = clients_.begin(); it != clients_.end(); ++it){
- // client was configured for specific service / instance
- if ((*it)->service_ == _service
- && (*it)->instance_ == _instance) {
- return *it;
- }
- }
- return nullptr;
-}
-
-bool configuration_impl::find_port(uint16_t &_port, uint16_t _remote, bool _reliable,
- std::map<bool, std::set<uint16_t> > &_used_client_ports) const {
- bool is_configured(false);
- std::list<std::shared_ptr<client>>::const_iterator it;
-
- for (it = clients_.begin(); it != clients_.end(); ++it) {
- if (is_in_port_range(_remote, (*it)->remote_ports_[_reliable])) {
- is_configured = true;
- for (uint16_t its_port = (*it)->client_ports_[_reliable].first;
- its_port <= (*it)->client_ports_[_reliable].second; its_port++ ) {
- if (_used_client_ports[_reliable].find(its_port) == _used_client_ports[_reliable].end()) {
- _port = its_port;
- return true;
- }
- }
- }
- }
-
- return is_configured;
-}
-
-bool configuration_impl::is_event_reliable(service_t _service,
- instance_t _instance, event_t _event) const {
- bool is_reliable(false);
- auto its_service = find_service(_service, _instance);
- if (its_service) {
- auto its_event = its_service->events_.find(_event);
- if (its_event != its_service->events_.end()) {
- return its_event->second->is_reliable_;
- } else {
- if (its_service->reliable_ != ILLEGAL_PORT &&
- its_service->unreliable_ == ILLEGAL_PORT) {
- is_reliable = true;
- }
- }
- }
- return is_reliable;
-}
-
-std::shared_ptr<service> configuration_impl::find_service(service_t _service,
- instance_t _instance) const {
- std::shared_ptr<service> its_service;
- auto find_service = services_.find(_service);
- if (find_service != services_.end()) {
- auto find_instance = find_service->second.find(_instance);
- if (find_instance != find_service->second.end()) {
- its_service = find_instance->second;
- }
- }
- return its_service;
-}
-
-std::shared_ptr<eventgroup> configuration_impl::find_eventgroup(
- service_t _service, instance_t _instance,
- eventgroup_t _eventgroup) const {
- std::shared_ptr<eventgroup> its_eventgroup;
- auto its_service = find_service(_service, _instance);
- if (its_service) {
- auto find_eventgroup = its_service->eventgroups_.find(_eventgroup);
- if (find_eventgroup != its_service->eventgroups_.end()) {
- its_eventgroup = find_eventgroup->second;
- }
- }
- return its_eventgroup;
-}
-
-std::uint32_t configuration_impl::get_max_message_size_local() const {
- if (max_local_message_size_ == 0
- && (VSOMEIP_MAX_LOCAL_MESSAGE_SIZE == 0
- || VSOMEIP_MAX_TCP_MESSAGE_SIZE == 0)) {
- // no limit specified in configuration file and
- // defines are set to unlimited
- return MESSAGE_SIZE_UNLIMITED;
- }
-
- uint32_t its_max_message_size = max_local_message_size_;
- if (VSOMEIP_MAX_TCP_MESSAGE_SIZE >= its_max_message_size) {
- its_max_message_size = VSOMEIP_MAX_TCP_MESSAGE_SIZE;
- }
- if (VSOMEIP_MAX_UDP_MESSAGE_SIZE > its_max_message_size) {
- its_max_message_size = VSOMEIP_MAX_UDP_MESSAGE_SIZE;
- }
- if (its_max_message_size < max_configured_message_size_) {
- its_max_message_size = max_configured_message_size_;
- }
-
- // add sizes of the the routing_manager_proxy's messages
- // to the routing_manager stub
- return std::uint32_t(its_max_message_size
- + VSOMEIP_COMMAND_HEADER_SIZE + sizeof(instance_t)
- + sizeof(bool) + sizeof(bool) + sizeof(client_t));
-}
-
-std::uint32_t configuration_impl::get_max_message_size_reliable(
- const std::string& _address, std::uint16_t _port) const {
- const auto its_address = message_sizes_.find(_address);
- if(its_address != message_sizes_.end()) {
- const auto its_port = its_address->second.find(_port);
- if(its_port != its_address->second.end()) {
- return its_port->second;
- }
- }
- return (max_reliable_message_size_ == 0) ?
- ((VSOMEIP_MAX_TCP_MESSAGE_SIZE == 0) ? MESSAGE_SIZE_UNLIMITED :
- VSOMEIP_MAX_TCP_MESSAGE_SIZE) : max_reliable_message_size_;
-}
-
-std::uint32_t configuration_impl::get_buffer_shrink_threshold() const {
- return buffer_shrink_threshold_;
-}
-
-bool configuration_impl::supports_selective_broadcasts(boost::asio::ip::address _address) const {
- return supported_selective_addresses.find(_address.to_string()) != supported_selective_addresses.end();
-}
-
-bool configuration_impl::log_version() const {
- return log_version_;
-}
-
-uint32_t configuration_impl::get_log_version_interval() const {
- return log_version_interval_;
-}
-
-bool configuration_impl::is_offered_remote(service_t _service, instance_t _instance) const {
- uint16_t reliable_port = get_reliable_port(_service, _instance);
- uint16_t unreliable_port = get_unreliable_port(_service, _instance);
- return (reliable_port != ILLEGAL_PORT || unreliable_port != ILLEGAL_PORT);
-}
-
-bool configuration_impl::is_local_service(service_t _service, instance_t _instance) const {
- std::shared_ptr<service> s = find_service(_service, _instance);
- if (s && !is_remote(s)) {
- return true;
- }
- if (is_internal_service(_service, _instance)) {
- return true;
- }
-
- return false;
-}
-
-// Service Discovery configuration
-bool configuration_impl::is_sd_enabled() const {
- return is_sd_enabled_;
-}
-
-const std::string & configuration_impl::get_sd_multicast() const {
- return sd_multicast_;
-}
-
-uint16_t configuration_impl::get_sd_port() const {
- return sd_port_;
-}
-
-const std::string & configuration_impl::get_sd_protocol() const {
- return sd_protocol_;
-}
-
-int32_t configuration_impl::get_sd_initial_delay_min() const {
- return sd_initial_delay_min_;
-}
-
-int32_t configuration_impl::get_sd_initial_delay_max() const {
- return sd_initial_delay_max_;
-}
-
-int32_t configuration_impl::get_sd_repetitions_base_delay() const {
- return sd_repetitions_base_delay_;
-}
-
-uint8_t configuration_impl::get_sd_repetitions_max() const {
- return sd_repetitions_max_;
-}
-
-ttl_t configuration_impl::get_sd_ttl() const {
- return sd_ttl_;
-}
-
-int32_t configuration_impl::get_sd_cyclic_offer_delay() const {
- return sd_cyclic_offer_delay_;
-}
-
-int32_t configuration_impl::get_sd_request_response_delay() const {
- return sd_request_response_delay_;
-}
-
-std::uint32_t configuration_impl::get_sd_offer_debounce_time() const {
- return sd_offer_debounce_time_;
-}
-
-// Trace configuration
-std::shared_ptr<cfg::trace> configuration_impl::get_trace() const {
- return trace_;
-}
-
-// Watchdog config
-bool configuration_impl::is_watchdog_enabled() const {
- return watchdog_->is_enabeled_;
-}
-
-uint32_t configuration_impl::get_watchdog_timeout() const {
- return watchdog_->timeout_in_ms_;
-}
-
-uint32_t configuration_impl::get_allowed_missing_pongs() const {
- return watchdog_->missing_pongs_allowed_;
-}
-std::uint32_t configuration_impl::get_umask() const {
- return umask_;
-}
-
-std::uint32_t configuration_impl::get_permissions_shm() const {
- return permissions_shm_;
-}
-
-bool configuration_impl::is_security_enabled() const {
- return policy_enabled_;
-}
-
-bool configuration_impl::check_credentials(client_t _client, uint32_t _uid,
- uint32_t _gid) const {
- if (!policy_enabled_) {
- return true;
- }
-
- bool has_id(false);
- auto its_client = policies_.find(_client);
-
- // Search for generic policy if no specific could be found
- if (its_client == policies_.end())
- its_client = policies_.find(ANY_CLIENT);
-
- if (its_client != policies_.end()) {
- for (auto its_credential : its_client->second->ids_) {
- bool has_uid(false), has_gid(false);
- for (auto its_range : std::get<0>(its_credential)) {
- if (std::get<0>(its_range) <= _uid && _uid <= std::get<1>(its_range)) {
- has_uid = true;
- break;
- }
- }
- for (auto its_range : std::get<1>(its_credential)) {
- if (std::get<0>(its_range) <= _gid && _gid <= std::get<1>(its_range)) {
- has_gid = true;
- break;
- }
- }
-
- if (has_uid && has_gid) {
- has_id = true;
- break;
- }
- }
-
- if ((has_id && its_client->second->allow_who_)
- || (!has_id && !its_client->second->allow_who_)) {
- return true;
- }
- }
-
- if (!check_credentials_) {
- VSOMEIP_INFO << "vSomeIP Security: Check credentials failed for client 0x"
- << std::hex << _client << " with UID/GID=" << std::dec << _uid
- << "/" << _gid << " but will be allowed due to audit mode is active!";
- }
-
- return !check_credentials_;
-}
-
-bool configuration_impl::is_client_allowed(client_t _client, service_t _service,
- instance_t _instance) const {
- if (!policy_enabled_) {
- return true;
- }
- auto its_client = policies_.find(_client);
-
- // Search for generic policy if no specific could be found
- if (its_client == policies_.end())
- its_client = policies_.find(ANY_CLIENT);
-
- if (its_client == policies_.end()) {
- if (!check_credentials_) {
- VSOMEIP_INFO << "vSomeIP Security: Client 0x" << std::hex << _client
- << " isn't allowed to communicate with service/instance "
- << _service << "/" << _instance
- << " but will be allowed due to audit mode is active!";
- }
- return !check_credentials_;
- }
-
- auto its_service = its_client->second->services_.find(std::make_pair(_service, _instance));
- if (its_client->second->allow_what_
- && its_service != its_client->second->services_.end()) {
- return true;
- } else if (!its_client->second->allow_what_
- && its_service == its_client->second->services_.end()) {
- return true;
- }
-
- if (!check_credentials_) {
- VSOMEIP_INFO << "vSomeIP Security: Client 0x" << std::hex << _client
- << " isn't allowed to communicate with service/instance "
- << _service << "/" << _instance
- << " but will be allowed due to audit mode is active!";
- }
-
- return !check_credentials_;
-}
-
-bool configuration_impl::is_offer_allowed(client_t _client, service_t _service,
- instance_t _instance) const {
- if (!policy_enabled_) {
- return true;
- }
-
- auto its_client = policies_.find(_client);
-
- // Search for generic policy if no specific could be found
- if (its_client == policies_.end())
- its_client = policies_.find(ANY_CLIENT);
-
- if (its_client == policies_.end()) {
- if (!check_credentials_) {
- VSOMEIP_INFO << "vSomeIP Security: Client 0x" << std::hex << _client
- << " isn't allowed to offer service/instance "
- << _service << "/" << _instance
- << " but will be allowed due to audit mode is active!";
- }
- return !check_credentials_;
- }
-
- auto its_offer = its_client->second->offers_.find(std::make_pair(_service, _instance));
- if (its_client->second->allow_what_
- && its_offer != its_client->second->offers_.end()) {
- return true;
- } else if (!its_client->second->allow_what_
- && its_offer == its_client->second->offers_.end()) {
- return true;
- }
-
- if (!check_credentials_) {
- VSOMEIP_INFO << "vSomeIP Security: Client 0x" << std::hex << _client
- << " isn't allowed to offer service/instance "
- << _service << "/" << _instance
- << " but will be allowed due to audit mode is active!";
- }
-
- return !check_credentials_;
-}
-
-std::map<plugin_type_e, std::set<std::string>> configuration_impl::get_plugins(
- const std::string &_name) const {
- std::map<plugin_type_e, std::set<std::string>> result;
-
- auto found_application = applications_.find(_name);
- if (found_application != applications_.end()) {
- result = std::get<5>(found_application->second);
- }
-
- return result;
-}
-
-void configuration_impl::set_configuration_path(const std::string &_path) {
- configuration_path_ = _path;
-}
-
-bool configuration_impl::is_e2e_enabled() const {
- return e2e_enabled_;
-}
-
-void configuration_impl::load_e2e(const element &_element) {
-#ifdef _WIN32
- return;
-#endif
- try {
- auto optional = _element.tree_.get_child_optional("e2e");
- if (!optional) {
- return;
- }
- auto found_e2e = _element.tree_.get_child("e2e");
- for (auto its_e2e = found_e2e.begin();
- its_e2e != found_e2e.end(); ++its_e2e) {
- if (its_e2e->first == "e2e_enabled") {
- if (its_e2e->second.data() == "true") {
- e2e_enabled_ = true;
- }
- }
- if (its_e2e->first == "protected") {
- for (auto its_protected = its_e2e->second.begin();
- its_protected != its_e2e->second.end(); ++its_protected) {
- load_e2e_protected(its_protected->second);
- }
- }
- }
- } catch (...) {
- }
-}
-
-void configuration_impl::load_e2e_protected(const boost::property_tree::ptree &_tree) {
-
- uint16_t data_id(0);
- std::string variant("");
- std::string profile("");
- uint16_t service_id(0);
- uint16_t event_id(0);
-
- uint16_t crc_offset(0);
- uint8_t data_id_mode(0);
- uint16_t data_length(0);
- uint16_t data_id_nibble_offset(12); // data id nibble behind 4 bit counter value
- uint16_t counter_offset(8); // counter field behind CRC8
-
- for (auto l = _tree.begin(); l != _tree.end(); ++l) {
- std::stringstream its_converter;
- uint16_t tmp;
- if (l->first == "data_id" && data_id == 0) {
- std::string value = l->second.data();
- if (value.size() > 1 && value[0] == '0' && value[1] == 'x') {
- its_converter << std::hex << value;
- } else {
- its_converter << std::dec << value;
- }
- its_converter >> data_id;
- } else if (l->first == "service_id") {
- std::string value = l->second.data();
- if (value.size() > 1 && value[0] == '0' && value[1] == 'x') {
- its_converter << std::hex << value;
- } else {
- its_converter << std::dec << value;
- }
- its_converter >> service_id;
- } else if (l->first == "event_id") {
- std::string value = l->second.data();
- if (value.size() > 1 && value[0] == '0' && value[1] == 'x') {
- its_converter << std::hex << value;
- } else {
- its_converter << std::dec << value;
- }
- its_converter >> event_id;
- } else if (l->first == "variant") {
- std::string value = l->second.data();
- its_converter << value;
- its_converter >> variant;
- } else if (l->first == "profile") {
- std::string value = l->second.data();
- its_converter << value;
- its_converter >> profile;
- } else if (l->first == "crc_offset") {
- std::string value = l->second.data();
- its_converter << value;
- its_converter >> crc_offset;
- } else if (l->first == "counter_offset") {
- std::string value = l->second.data();
- its_converter << value;
- its_converter >> counter_offset;
- } else if (l->first == "data_id_mode") {
- std::string value = l->second.data();
- its_converter << value;
- its_converter >> tmp;
- data_id_mode = static_cast<uint8_t>(tmp);
- } else if (l->first == "data_id_nibble_offset") {
- std::string value = l->second.data();
- its_converter << value;
- its_converter >> data_id_nibble_offset;
- }
- else if (l->first == "data_length") {
- std::string value = l->second.data();
- its_converter << value;
- its_converter >> data_length;
- }
- }
- e2exf::data_identifier its_data_identifier = {service_id, event_id};
- e2e_configuration_[its_data_identifier] = std::make_shared<cfg::e2e>(
- data_id,
- variant,
- profile,
- service_id,
- event_id,
- crc_offset,
- data_id_mode,
- data_length,
- data_id_nibble_offset,
- counter_offset
- );
-}
-
-std::map<e2exf::data_identifier, std::shared_ptr<cfg::e2e>> configuration_impl::get_e2e_configuration() const {
- return e2e_configuration_;
-}
-
-bool configuration_impl::log_memory() const {
- return log_memory_;
-}
-
-uint32_t configuration_impl::get_log_memory_interval() const {
- return log_memory_interval_;
-}
-
-bool configuration_impl::log_status() const {
- return log_status_;
-}
-
-uint32_t configuration_impl::get_log_status_interval() const {
- return log_status_interval_;
-}
-
-void configuration_impl::load_ttl_factors(
- const boost::property_tree::ptree &_tree, ttl_map_t* _target) {
- const service_t ILLEGAL_VALUE(0xffff);
- for (const auto& i : _tree) {
- service_t its_service(ILLEGAL_VALUE);
- instance_t its_instance(ILLEGAL_VALUE);
- configuration::ttl_factor_t its_ttl_factor(0);
-
- for (const auto& j : i.second) {
- std::string its_key(j.first);
- std::string its_value(j.second.data());
- std::stringstream its_converter;
-
- if (its_key == "ttl_factor") {
- its_converter << its_value;
- its_converter >> its_ttl_factor;
- } else {
- // Trim "its_value"
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
-
- if (its_key == "service") {
- its_converter >> its_service;
- } else if (its_key == "instance") {
- its_converter >> its_instance;
- }
- }
- }
- if (its_service != ILLEGAL_VALUE
- && its_instance != ILLEGAL_VALUE
- && its_ttl_factor > 0) {
- (*_target)[its_service][its_instance] = its_ttl_factor;
- } else {
- VSOMEIP_ERROR << "Invalid ttl factor configuration";
- }
- }
-}
-
-configuration::ttl_map_t configuration_impl::get_ttl_factor_offers() const {
- return ttl_factors_offers_;
-}
-
-configuration::ttl_map_t configuration_impl::get_ttl_factor_subscribes() const {
- return ttl_factors_subscriptions_;
-}
-
-configuration::endpoint_queue_limit_t
-configuration_impl::get_endpoint_queue_limit(
- const std::string& _address, std::uint16_t _port) const {
- auto found_address = endpoint_queue_limits_.find(_address);
- if (found_address != endpoint_queue_limits_.end()) {
- auto found_port = found_address->second.find(_port);
- if (found_port != found_address->second.end()) {
- return found_port->second;
- }
- }
- return endpoint_queue_limit_external_;
-}
-
-configuration::endpoint_queue_limit_t
-configuration_impl::get_endpoint_queue_limit_local() const {
- return endpoint_queue_limit_local_;
-}
-
-void configuration_impl::load_endpoint_queue_sizes(const element &_element) {
- const std::string endpoint_queue_limits("endpoint-queue-limits");
- const std::string endpoint_queue_limit_external("endpoint-queue-limit-external");
- const std::string endpoint_queue_limit_local("endpoint-queue-limit-local");
-
- try {
- if (_element.tree_.get_child_optional(endpoint_queue_limit_external)) {
- if (is_configured_[ET_ENDPOINT_QUEUE_LIMIT_EXTERNAL]) {
- VSOMEIP_WARNING << "Multiple definitions for "
- << endpoint_queue_limit_external
- << " Ignoring definition from " << _element.name_;
- } else {
- is_configured_[ET_ENDPOINT_QUEUE_LIMIT_EXTERNAL] = true;
- auto mpsl = _element.tree_.get_child(
- endpoint_queue_limit_external);
- std::string s(mpsl.data());
- try {
- endpoint_queue_limit_external_ =
- static_cast<configuration::endpoint_queue_limit_t>(std::stoul(
- s.c_str(), NULL, 10));
- } catch (const std::exception &e) {
- VSOMEIP_ERROR<<__func__ << ": " << endpoint_queue_limit_external
- << " " << e.what();
- }
- }
- }
- if (_element.tree_.get_child_optional(endpoint_queue_limit_local)) {
- if (is_configured_[ET_ENDPOINT_QUEUE_LIMIT_LOCAL]) {
- VSOMEIP_WARNING << "Multiple definitions for "
- << endpoint_queue_limit_local
- << " Ignoring definition from " << _element.name_;
- } else {
- is_configured_[ET_ENDPOINT_QUEUE_LIMIT_LOCAL] = true;
- auto mpsl = _element.tree_.get_child(endpoint_queue_limit_local);
- std::string s(mpsl.data());
- try {
- endpoint_queue_limit_local_=
- static_cast<configuration::endpoint_queue_limit_t>(
- std::stoul(s.c_str(), NULL, 10));
- } catch (const std::exception &e) {
- VSOMEIP_ERROR<< __func__ << ": "<< endpoint_queue_limit_local
- << " " << e.what();
- }
- }
- }
-
- if (_element.tree_.get_child_optional(endpoint_queue_limits)) {
- if (is_configured_[ET_ENDPOINT_QUEUE_LIMITS]) {
- VSOMEIP_WARNING << "Multiple definitions for "
- << endpoint_queue_limits
- << " Ignoring definition from " << _element.name_;
- } else {
- is_configured_[ET_ENDPOINT_QUEUE_LIMITS] = true;
- const std::string unicast("unicast");
- const std::string ports("ports");
- const std::string port("port");
- const std::string queue_size_limit("queue-size-limit");
-
- for (const auto i : _element.tree_.get_child(endpoint_queue_limits)) {
- if (!i.second.get_child_optional(unicast)
- || !i.second.get_child_optional(ports)) {
- continue;
- }
- std::string its_unicast(i.second.get_child(unicast).data());
- for (const auto j : i.second.get_child(ports)) {
-
- if (!j.second.get_child_optional(port)
- || !j.second.get_child_optional(queue_size_limit)) {
- continue;
- }
-
- std::uint16_t its_port = ILLEGAL_PORT;
- std::uint32_t its_queue_size_limit = 0;
-
- try {
- std::string p(j.second.get_child(port).data());
- its_port = static_cast<std::uint16_t>(std::stoul(p.c_str(),
- NULL, 10));
- std::string s(j.second.get_child(queue_size_limit).data());
- its_queue_size_limit = static_cast<std::uint32_t>(std::stoul(
- s.c_str(), NULL, 10));
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << __func__ << ":" << e.what();
- }
-
- if (its_port == ILLEGAL_PORT || its_queue_size_limit == 0) {
- continue;
- }
-
- endpoint_queue_limits_[its_unicast][its_port] = its_queue_size_limit;
- }
- }
- }
- }
- } catch (...) {
- }
-}
-
-void configuration_impl::load_debounce(const element &_element) {
- try {
- auto its_debounce = _element.tree_.get_child("debounce");
- for (auto i = its_debounce.begin(); i != its_debounce.end(); ++i) {
- load_service_debounce(i->second);
- }
- } catch (...) {
- }
-}
-
-void configuration_impl::load_service_debounce(
- const boost::property_tree::ptree &_tree) {
- service_t its_service(0);
- instance_t its_instance(0);
- std::map<event_t, std::shared_ptr<debounce>> its_debounces;
-
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key(i->first);
- std::string its_value(i->second.data());
- std::stringstream its_converter;
-
- if (its_key == "service") {
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_service;
- } else if (its_key == "instance") {
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_instance;
- } else if (its_key == "events") {
- load_events_debounce(i->second, its_debounces);
- }
- }
-
- // TODO: Improve error handling!
- if (its_service > 0 && its_instance > 0 && !its_debounces.empty()) {
- auto find_service = debounces_.find(its_service);
- if (find_service != debounces_.end()) {
- auto find_instance = find_service->second.find(its_instance);
- if (find_instance != find_service->second.end()) {
- VSOMEIP_ERROR << "Multiple debounce configurations for service "
- << std::hex << std::setw(4) << std::setfill('0') << its_service
- << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance;
- return;
- }
- }
- debounces_[its_service][its_instance] = its_debounces;
- }
-}
-
-void configuration_impl::load_events_debounce(
- const boost::property_tree::ptree &_tree,
- std::map<event_t, std::shared_ptr<debounce>> &_debounces) {
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- load_event_debounce(i->second, _debounces);
- }
-}
-
-void configuration_impl::load_event_debounce(
- const boost::property_tree::ptree &_tree,
- std::map<event_t, std::shared_ptr<debounce>> &_debounces) {
- event_t its_event(0);
- std::shared_ptr<debounce> its_debounce = std::make_shared<debounce>();
-
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_key(i->first);
- std::string its_value(i->second.data());
- std::stringstream its_converter;
-
- if (its_key == "event") {
- if (its_value.size() > 1 && its_value[0] == '0' && its_value[1] == 'x') {
- its_converter << std::hex << its_value;
- } else {
- its_converter << std::dec << its_value;
- }
- its_converter >> its_event;
- } else if (its_key == "on_change") {
- its_debounce->on_change_ = (its_value == "true");
- } else if (its_key == "on_change_resets_interval") {
- its_debounce->on_change_resets_interval_ = (its_value == "true");
- } else if (its_key == "ignore") {
- load_event_debounce_ignore(i->second, its_debounce->ignore_);
- } else if (its_key == "interval") {
- if (its_value == "never") {
- its_debounce->interval_ = -1;
- } else {
- its_converter << std::dec << its_value;
- its_converter >> its_debounce->interval_;
- }
- }
- }
-
- // TODO: Improve error handling
- if (its_event > 0) {
- auto find_event = _debounces.find(its_event);
- if (find_event == _debounces.end()) {
- _debounces[its_event] = its_debounce;
- }
- }
-}
-
-void configuration_impl::load_event_debounce_ignore(
- const boost::property_tree::ptree &_tree,
- std::map<std::size_t, byte_t> &_ignore) {
- std::size_t its_ignored;
- byte_t its_mask;
- std::stringstream its_converter;
-
- for (auto i = _tree.begin(); i != _tree.end(); ++i) {
- std::string its_value = i->second.data();
-
- its_mask = 0xff;
-
- if (!its_value.empty()
- && std::find_if(its_value.begin(), its_value.end(),
- [](char _c) { return !std::isdigit(_c); })
- == its_value.end()) {
- its_converter.str("");
- its_converter.clear();
- its_converter << std::dec << its_value;
- its_converter >> its_ignored;
-
- } else {
- for (auto j = i->second.begin(); j != i->second.end(); ++j) {
- std::string its_ignore_key(j->first);
- std::string its_ignore_value(j->second.data());
-
- if (its_ignore_key == "index") {
- its_converter.str("");
- its_converter.clear();
- its_converter << std::dec << its_ignore_value;
- its_converter >> its_ignored;
- } else if (its_ignore_key == "mask") {
- its_converter.str("");
- its_converter.clear();
-
- int its_tmp_mask;
- its_converter << std::hex << its_ignore_value;
- its_converter >> its_tmp_mask;
-
- its_mask = static_cast<byte_t>(its_tmp_mask);
- }
- }
- }
-
- _ignore[its_ignored] = its_mask;
- }
-}
-
-std::shared_ptr<debounce> configuration_impl::get_debounce(
- service_t _service, instance_t _instance, event_t _event) const {
- auto found_service = debounces_.find(_service);
- if (found_service != debounces_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_event = found_instance->second.find(_event);
- if (found_event != found_instance->second.end()) {
- return found_event->second;
- }
- }
- }
- return nullptr;
-}
-
-} // namespace config
-} // namespace vsomeip
diff --git a/implementation/e2e_protection/include/buffer/buffer.hpp b/implementation/e2e_protection/include/buffer/buffer.hpp
deleted file mode 100644
index 5ddcf2e..0000000
--- a/implementation/e2e_protection/include/buffer/buffer.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_BUFFER_HPP
-#define VSOMEIP_E2E_BUFFER_HPP
-
-#include <stdexcept>
-#include <cstdint>
-#include <ostream>
-#include <vector>
-
-namespace vsomeip {
-
-using e2e_buffer = std::vector<uint8_t>;
-
-class buffer_view {
- public:
- buffer_view(const uint8_t *_data_ptr, size_t _data_length)
- : data_ptr_(_data_ptr), data_length_(_data_length) {
- }
-
- buffer_view(const e2e_buffer &_buffer)
- : data_ptr_(_buffer.data()), data_length_(_buffer.size()) {}
-
- buffer_view(const e2e_buffer &_buffer, size_t _length)
- : data_ptr_(_buffer.data()), data_length_(_length) {
- }
-
- buffer_view(const e2e_buffer &_buffer, size_t _begin, size_t _end)
- : data_ptr_(_buffer.data() + _begin), data_length_(_end - _begin) {
- }
-
- const uint8_t *begin(void) const { return data_ptr_; }
-
- const uint8_t *end(void) const { return data_ptr_ + data_length_; }
-
-private:
- const uint8_t *data_ptr_;
- size_t data_length_;
-};
-
-std::ostream &operator<<(std::ostream &_os, const e2e_buffer &_buffer);
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_BUFFER_HPP
diff --git a/implementation/e2e_protection/include/crc/crc.hpp b/implementation/e2e_protection/include/crc/crc.hpp
deleted file mode 100644
index 1a54312..0000000
--- a/implementation/e2e_protection/include/crc/crc.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_CRC_HPP
-#define VSOMEIP_E2E_CRC_HPP
-
-#include <cstdint>
-#include "../buffer/buffer.hpp"
-
-namespace vsomeip {
-
-class e2e_crc {
- public:
- static uint8_t calculate_profile_01(buffer_view _buffer_view,
- const uint8_t _start_value = 0x00U);
- static uint32_t calculate_profile_04(buffer_view _buffer_view,
- const uint32_t _start_value = 0x00000000U);
-
- static uint32_t calculate_profile_custom(buffer_view _buffer_view);
-
- private:
- static const uint8_t lookup_table_profile_01_[256];
- static const uint32_t lookup_table_profile_04_[256];
- static const uint32_t lookup_table_profile_custom_[256];
-
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_CRC_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp b/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp
deleted file mode 100644
index 5fa243a..0000000
--- a/implementation/e2e_protection/include/e2e/profile/profile01/checker.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_PROFILE01_CHECKER_HPP
-#define VSOMEIP_E2E_PROFILE01_CHECKER_HPP
-
-#include "../profile01/profile_01.hpp"
-#include "../profile_interface/checker.hpp"
-
-namespace vsomeip {
-namespace e2e {
-namespace profile01 {
-
-class profile_01_checker final : public e2e::profile_interface::checker {
-
- public:
- profile_01_checker(void) = delete;
-
- // [SWS_E2E_00389] initialize state
- explicit profile_01_checker(const profile_config &_config) :
- config_(_config) {}
-
- virtual void check(const e2e_buffer &_buffer,
- e2e::profile_interface::generic_check_status &_generic_check_status) override final;
-
-private:
- profile_config config_;
- std::mutex check_mutex_;
-
-};
-
-} // namespace profile01
-} // namespace e2e
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_PROFILE01_CHECKER_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp b/implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp
deleted file mode 100644
index 810ec56..0000000
--- a/implementation/e2e_protection/include/e2e/profile/profile01/profile_01.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_PROFILE01_PROFILE01_HPP
-#define VSOMEIP_E2E_PROFILE01_PROFILE01_HPP
-
-#include <cstdint>
-#include "../../../buffer/buffer.hpp"
-
-namespace vsomeip {
-namespace e2e {
-namespace profile01 {
-
-struct profile_config;
-
-class profile_01 {
- public:
- static uint8_t compute_crc(const profile_config &_config, const e2e_buffer &_buffer);
-
- static bool is_buffer_length_valid(const profile_config &_config, const e2e_buffer &_buffer);
-};
-
-// [SWS_E2E_00200]
-enum class p01_data_id_mode : uint8_t {E2E_P01_DATAID_BOTH, E2E_P01_DATAID_ALT, E2E_P01_DATAID_LOW, E2E_P01_DATAID_NIBBLE};
-
-struct profile_config {
- // [SWS_E2E_00018]
- uint16_t crc_offset_;
- uint16_t data_id_;
- p01_data_id_mode data_id_mode_;
- uint16_t data_length_;
- uint16_t counter_offset_;
- uint16_t data_id_nibble_offset_;
-
- profile_config() = delete;
-
- profile_config(uint16_t _crc_offset, uint16_t _data_id,
- p01_data_id_mode _data_id_mode, uint16_t _data_length,
- uint16_t _counter_offset, uint16_t _data_id_nibble_offset)
-
- : crc_offset_(_crc_offset), data_id_(_data_id),
- data_id_mode_(_data_id_mode), data_length_(_data_length),
- counter_offset_(_counter_offset),
- data_id_nibble_offset_(_data_id_nibble_offset) {
- }
- profile_config(const profile_config &_config) = default;
- profile_config &operator=(const profile_config &_config) = default;
-};
-
-} // namespace profile01
-} // namespace e2e
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_PROFILE01_PROFILE01_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp b/implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp
deleted file mode 100644
index 204c7a1..0000000
--- a/implementation/e2e_protection/include/e2e/profile/profile01/protector.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_PROFILE01_PROTECTOR_HPP
-#define VSOMEIP_E2E_PROFILE01_PROTECTOR_HPP
-
-#include <mutex>
-#include "../profile01/profile_01.hpp"
-#include "../profile_interface/protector.hpp"
-
-namespace vsomeip {
-namespace e2e {
-namespace profile01 {
-
-class protector final : public e2e::profile_interface::protector {
- public:
- protector(void) = delete;
-
- explicit protector(const profile_config &_config) : config_(_config), counter_(0){};
-
- void protect(e2e_buffer &_buffer) override final;
-
- private:
-
- void write_counter(e2e_buffer &_buffer);
-
- void write_data_id(e2e_buffer &_buffer);
-
- void write_crc(e2e_buffer &_buffer, uint8_t _computed_crc);
-
- void increment_counter(void);
-
-
- private:
- profile_config config_;
- uint8_t counter_;
- std::mutex protect_mutex_;
-};
-
-} // namespace profile01
-} // namespace e2e
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_PROFILE01_PROTECTOR_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_custom/checker.hpp b/implementation/e2e_protection/include/e2e/profile/profile_custom/checker.hpp
deleted file mode 100644
index 7080329..0000000
--- a/implementation/e2e_protection/include/e2e/profile/profile_custom/checker.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_PROFILE_CUSTOM_CHECKER_HPP
-#define VSOMEIP_E2E_PROFILE_CUSTOM_CHECKER_HPP
-
-#include "../profile_custom/profile_custom.hpp"
-#include "../profile_interface/checker.hpp"
-#include <mutex>
-
-namespace vsomeip {
-namespace e2e {
-namespace profile_custom {
-
-class profile_custom_checker final : public vsomeip::e2e::profile_interface::checker {
-
- public:
- profile_custom_checker(void) = delete;
-
- explicit profile_custom_checker(const vsomeip::e2e::profile_custom::profile_config &_config) :
- config_(_config) {}
-
- virtual void check(const e2e_buffer &_buffer,
- vsomeip::e2e::profile_interface::generic_check_status &_generic_check_status);
-
- private:
- uint32_t read_crc(const e2e_buffer &_buffer) const;
-
-private:
- profile_config config_;
- std::mutex check_mutex_;
-
-};
-
-} // namespace profile_custom
-} // namespace e2e
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_PROFILE_CUSTOM_CHECKER_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp b/implementation/e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp
deleted file mode 100644
index f41942c..0000000
--- a/implementation/e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_PROFILE_CUSTOM_PROFILE_CUSTOM_HPP
-#define VSOMEIP_E2E_PROFILE_CUSTOM_PROFILE_CUSTOM_HPP
-
-#include <cstdint>
-#include "../../../buffer/buffer.hpp"
-
-namespace vsomeip {
-namespace e2e {
-namespace profile_custom {
-
-struct profile_config;
-
-class profile_custom {
- public:
- static uint32_t compute_crc(const profile_config &_config, const e2e_buffer &_buffer);
-
- static bool is_buffer_length_valid(const profile_config &_config, const e2e_buffer &_buffer);
-};
-
-struct profile_config {
- uint16_t crc_offset_;
-
- profile_config() = delete;
-
- profile_config(uint16_t _crc_offset)
- : crc_offset_(_crc_offset) {
- }
- profile_config(const profile_config &_config) = default;
- profile_config &operator=(const profile_config &_config) = default;
-};
-
-} // namespace profile_custom
-} // namespace e2e
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_PROFILE_CUSTOM_PROFILE_CUSTOM_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_custom/protector.hpp b/implementation/e2e_protection/include/e2e/profile/profile_custom/protector.hpp
deleted file mode 100644
index 4b6c3b4..0000000
--- a/implementation/e2e_protection/include/e2e/profile/profile_custom/protector.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
-#define VSOMEIP_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
-
-#include <mutex>
-#include "../profile_custom/profile_custom.hpp"
-#include "../profile_interface/protector.hpp"
-
-namespace vsomeip {
-namespace e2e {
-namespace profile_custom {
-
-class protector final : public vsomeip::e2e::profile_interface::protector {
- public:
- protector(void) = delete;
-
- explicit protector(const profile_config &_config) : config_(_config){};
-
- void protect(e2e_buffer &_buffer) override final;
-
- private:
-
- void write_crc(e2e_buffer &_buffer, uint32_t _computed_crc);
-
- private:
- profile_config config_;
- std::mutex protect_mutex_;
-};
-
-} // namespace profile_custom
-} // namespace e2e
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_PROFILE_CUSTOM_PROTECTOR_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_interface/checker.hpp b/implementation/e2e_protection/include/e2e/profile/profile_interface/checker.hpp
deleted file mode 100644
index c66d1b0..0000000
--- a/implementation/e2e_protection/include/e2e/profile/profile_interface/checker.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_PROFILE_INTERFACE_CHECKER_HPP
-#define VSOMEIP_E2E_PROFILE_INTERFACE_CHECKER_HPP
-
-#include "../profile_interface/profile_interface.hpp"
-#include "../../../buffer/buffer.hpp"
-#include <mutex>
-
-namespace vsomeip {
-namespace e2e {
-namespace profile_interface {
-
-class checker : public profile_interface {
- public:
- virtual void check(const e2e_buffer &_buffer,
- vsomeip::e2e::profile_interface::generic_check_status &_generic_check_status) = 0;
-};
-
-} // namespace profile_interface
-} // namespace e2e
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_PROFILE_INTERFACE_CHECKER_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_interface/profile_interface.hpp b/implementation/e2e_protection/include/e2e/profile/profile_interface/profile_interface.hpp
deleted file mode 100644
index 377bbee..0000000
--- a/implementation/e2e_protection/include/e2e/profile/profile_interface/profile_interface.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_PROFILE_INTERFACE_PROFILE_INTERFACE_HPP
-#define VSOMEIP_E2E_PROFILE_INTERFACE_PROFILE_INTERFACE_HPP
-
-#include <cstdint>
-
-namespace vsomeip {
-namespace e2e {
-namespace profile_interface {
-
-enum class generic_check_status : uint8_t { E2E_OK, E2E_WRONG_CRC, E2E_ERROR};
-
-class profile_interface {
-public:
- virtual ~profile_interface() {
- }
-};
-
-} // namespace profile_interface
-} // namespace e2e
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_PROFILE_INTERFACE_PROFILE_INTERFACE_HPP
diff --git a/implementation/e2e_protection/include/e2e/profile/profile_interface/protector.hpp b/implementation/e2e_protection/include/e2e/profile/profile_interface/protector.hpp
deleted file mode 100644
index a031a9e..0000000
--- a/implementation/e2e_protection/include/e2e/profile/profile_interface/protector.hpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2014-2017 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_E2E_PROFILE_INTERFACE_PROTECTOR_HPP
-#define VSOMEIP_E2E_PROFILE_INTERFACE_PROTECTOR_HPP
-
-#include "../../../buffer/buffer.hpp"
-#include "../profile_interface/profile_interface.hpp"
-
-namespace vsomeip {
-namespace e2e {
-namespace profile_interface {
-
-class protector : public profile_interface {
- public:
- virtual void protect(e2e_buffer &_buffer) = 0;
-};
-
-} // namespace profile_interface
-} // namespace e2e
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2E_PROFILE_INTERFACE_PROTECTOR_HPP
diff --git a/implementation/e2e_protection/include/e2exf/config.hpp b/implementation/e2e_protection/include/e2exf/config.hpp
deleted file mode 100644
index 3667211..0000000
--- a/implementation/e2e_protection/include/e2exf/config.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2014-2017 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_E2EXF_CONFIG_HPP
-#define VSOMEIP_E2EXF_CONFIG_HPP
-
-#include "../e2e/profile/profile_interface/checker.hpp"
-#include "../e2e/profile/profile_interface/protector.hpp"
-
-#include <memory>
-#include <map>
-
-namespace vsomeip {
-namespace e2exf {
-
-using session_id = uint16_t;
-using instance_id = uint16_t;
-
-using data_identifier = std::pair<session_id, instance_id>;
-
-std::ostream &operator<<(std::ostream &_os, const e2exf::data_identifier &_data_identifier);
-
-} // namespace e2exf
-} // namespace vsomeip
-
-#endif // VSOMEIP_E2EXF_CONFIG_HPP
diff --git a/implementation/e2e_protection/src/buffer/buffer.cpp b/implementation/e2e_protection/src/buffer/buffer.cpp
deleted file mode 100644
index e133d42..0000000
--- a/implementation/e2e_protection/src/buffer/buffer.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2014-2017 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 "../../../e2e_protection/include/buffer/buffer.hpp"
-#include <iomanip>
-
-namespace vsomeip {
-
-std::ostream &operator<<(std::ostream &_os, const e2e_buffer &_buffer) {
- for (auto b : _buffer) {
- if (isupper(b)) {
- _os << b;
- } else {
- _os << "[" << std::setfill('0') << std::setw(2) << std::hex << (uint32_t)b << std::dec << "]";
- }
- }
- return _os;
-}
-
-} // namespace vsomeip
diff --git a/implementation/e2e_protection/src/crc/crc.cpp b/implementation/e2e_protection/src/crc/crc.cpp
deleted file mode 100644
index d9f1f99..0000000
--- a/implementation/e2e_protection/src/crc/crc.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright (C) 2014-2017 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/crc/crc.hpp"
-#include <iostream>
-#include <string>
-#include <iomanip>
-
-namespace vsomeip {
-
-/**
- * Calculates the crc over the provided range.
- *
- * @param begin Constant iterator pointing to begin of the range.
- * @param end Constant iterator pointing to end of the range.
- * @param startValue The crc value from previous call.
- * @return The calculated crc value.
- *
- * Parameters of the CRC:
- * - Width = 8
- * - Poly = 0x1D
- * - XorIn = 0xFF
- * - ReflectIn = false
- * - XorOut = 0xFF
- * - ReflectOut = false
- * - Algorithm = table-driven
- */
-uint8_t e2e_crc::calculate_profile_01(buffer_view _buffer_view, const uint8_t _start_value) {
- uint8_t crc = _start_value ^ 0xFFU;
- for (uint8_t byte : _buffer_view) {
- crc = static_cast<uint8_t>(lookup_table_profile_01_[static_cast<uint8_t>((byte) ^ crc)] ^ (crc >> 8U));
- }
- crc = crc ^ 0xFFU;
- return crc;
-}
-
-const uint8_t e2e_crc::lookup_table_profile_01_[256] = {
- 0x00U, 0x1DU, 0x3AU, 0x27U, 0x74U, 0x69U, 0x4EU, 0x53U, 0xE8U, 0xF5U, 0xD2U, 0xCFU, 0x9CU, 0x81U, 0xA6U, 0xBBU,
- 0xCDU, 0xD0U, 0xF7U, 0xEAU, 0xB9U, 0xA4U, 0x83U, 0x9EU, 0x25U, 0x38U, 0x1FU, 0x02U, 0x51U, 0x4CU, 0x6BU, 0x76U,
- 0x87U, 0x9AU, 0xBDU, 0xA0U, 0xF3U, 0xEEU, 0xC9U, 0xD4U, 0x6FU, 0x72U, 0x55U, 0x48U, 0x1BU, 0x06U, 0x21U, 0x3CU,
- 0x4AU, 0x57U, 0x70U, 0x6DU, 0x3EU, 0x23U, 0x04U, 0x19U, 0xA2U, 0xBFU, 0x98U, 0x85U, 0xD6U, 0xCBU, 0xECU, 0xF1U,
- 0x13U, 0x0EU, 0x29U, 0x34U, 0x67U, 0x7AU, 0x5DU, 0x40U, 0xFBU, 0xE6U, 0xC1U, 0xDCU, 0x8FU, 0x92U, 0xB5U, 0xA8U,
- 0xDEU, 0xC3U, 0xE4U, 0xF9U, 0xAAU, 0xB7U, 0x90U, 0x8DU, 0x36U, 0x2BU, 0x0CU, 0x11U, 0x42U, 0x5FU, 0x78U, 0x65U,
- 0x94U, 0x89U, 0xAEU, 0xB3U, 0xE0U, 0xFDU, 0xDAU, 0xC7U, 0x7CU, 0x61U, 0x46U, 0x5BU, 0x08U, 0x15U, 0x32U, 0x2FU,
- 0x59U, 0x44U, 0x63U, 0x7EU, 0x2DU, 0x30U, 0x17U, 0x0AU, 0xB1U, 0xACU, 0x8BU, 0x96U, 0xC5U, 0xD8U, 0xFFU, 0xE2U,
- 0x26U, 0x3BU, 0x1CU, 0x01U, 0x52U, 0x4FU, 0x68U, 0x75U, 0xCEU, 0xD3U, 0xF4U, 0xE9U, 0xBAU, 0xA7U, 0x80U, 0x9DU,
- 0xEBU, 0xF6U, 0xD1U, 0xCCU, 0x9FU, 0x82U, 0xA5U, 0xB8U, 0x03U, 0x1EU, 0x39U, 0x24U, 0x77U, 0x6AU, 0x4DU, 0x50U,
- 0xA1U, 0xBCU, 0x9BU, 0x86U, 0xD5U, 0xC8U, 0xEFU, 0xF2U, 0x49U, 0x54U, 0x73U, 0x6EU, 0x3DU, 0x20U, 0x07U, 0x1AU,
- 0x6CU, 0x71U, 0x56U, 0x4BU, 0x18U, 0x05U, 0x22U, 0x3FU, 0x84U, 0x99U, 0xBEU, 0xA3U, 0xF0U, 0xEDU, 0xCAU, 0xD7U,
- 0x35U, 0x28U, 0x0FU, 0x12U, 0x41U, 0x5CU, 0x7BU, 0x66U, 0xDDU, 0xC0U, 0xE7U, 0xFAU, 0xA9U, 0xB4U, 0x93U, 0x8EU,
- 0xF8U, 0xE5U, 0xC2U, 0xDFU, 0x8CU, 0x91U, 0xB6U, 0xABU, 0x10U, 0x0DU, 0x2AU, 0x37U, 0x64U, 0x79U, 0x5EU, 0x43U,
- 0xB2U, 0xAFU, 0x88U, 0x95U, 0xC6U, 0xDBU, 0xFCU, 0xE1U, 0x5AU, 0x47U, 0x60U, 0x7DU, 0x2EU, 0x33U, 0x14U, 0x09U,
- 0x7FU, 0x62U, 0x45U, 0x58U, 0x0BU, 0x16U, 0x31U, 0x2CU, 0x97U, 0x8AU, 0xADU, 0xB0U, 0xE3U, 0xFEU, 0xD9U, 0xC4U
-};
-
-/**
-* Calculates the CRC over the provided range.
-*
-* @param begin Constant iterator pointing to begin of the range.
-* @param end Constant iterator pointing to end of the range.
-* @param startValue The CRC value from previous call.
-* @return The calculated CRC value.
-*
-* Parameters of the CRC:
-* - Width = 32
-* - Poly = 0xF4ACFB13
-* - XorIn = 0xFFFFFFFF
-* - ReflectIn = true
-* - XorOut = 0xFFFFFFFF
-* - ReflectOut = true
-*/
-uint32_t e2e_crc::calculate_profile_04(buffer_view _buffer_view, const uint32_t _start_value) {
- uint32_t crc = _start_value ^ 0xFFFFFFFFU;
- for (uint8_t byte : _buffer_view) {
- crc = lookup_table_profile_04_[static_cast<uint8_t>(byte ^ crc)] ^ (crc >> 8U);
- }
-
- crc = crc ^ 0xFFFFFFFFU;
-
- return crc;
-}
-
-const uint32_t e2e_crc::lookup_table_profile_04_[256] = {
- 0x00000000U, 0x30850FF5U, 0x610A1FEAU, 0x518F101FU, 0xC2143FD4U, 0xF2913021U, 0xA31E203EU, 0x939B2FCBU, 0x159615F7U,
- 0x25131A02U, 0x749C0A1DU, 0x441905E8U, 0xD7822A23U, 0xE70725D6U, 0xB68835C9U, 0x860D3A3CU, 0x2B2C2BEEU, 0x1BA9241BU,
- 0x4A263404U, 0x7AA33BF1U, 0xE938143AU, 0xD9BD1BCFU, 0x88320BD0U, 0xB8B70425U, 0x3EBA3E19U, 0x0E3F31ECU, 0x5FB021F3U,
- 0x6F352E06U, 0xFCAE01CDU, 0xCC2B0E38U, 0x9DA41E27U, 0xAD2111D2U, 0x565857DCU, 0x66DD5829U, 0x37524836U, 0x07D747C3U,
- 0x944C6808U, 0xA4C967FDU, 0xF54677E2U, 0xC5C37817U, 0x43CE422BU, 0x734B4DDEU, 0x22C45DC1U, 0x12415234U, 0x81DA7DFFU,
- 0xB15F720AU, 0xE0D06215U, 0xD0556DE0U, 0x7D747C32U, 0x4DF173C7U, 0x1C7E63D8U, 0x2CFB6C2DU, 0xBF6043E6U, 0x8FE54C13U,
- 0xDE6A5C0CU, 0xEEEF53F9U, 0x68E269C5U, 0x58676630U, 0x09E8762FU, 0x396D79DAU, 0xAAF65611U, 0x9A7359E4U, 0xCBFC49FBU,
- 0xFB79460EU, 0xACB0AFB8U, 0x9C35A04DU, 0xCDBAB052U, 0xFD3FBFA7U, 0x6EA4906CU, 0x5E219F99U, 0x0FAE8F86U, 0x3F2B8073U,
- 0xB926BA4FU, 0x89A3B5BAU, 0xD82CA5A5U, 0xE8A9AA50U, 0x7B32859BU, 0x4BB78A6EU, 0x1A389A71U, 0x2ABD9584U, 0x879C8456U,
- 0xB7198BA3U, 0xE6969BBCU, 0xD6139449U, 0x4588BB82U, 0x750DB477U, 0x2482A468U, 0x1407AB9DU, 0x920A91A1U, 0xA28F9E54U,
- 0xF3008E4BU, 0xC38581BEU, 0x501EAE75U, 0x609BA180U, 0x3114B19FU, 0x0191BE6AU, 0xFAE8F864U, 0xCA6DF791U, 0x9BE2E78EU,
- 0xAB67E87BU, 0x38FCC7B0U, 0x0879C845U, 0x59F6D85AU, 0x6973D7AFU, 0xEF7EED93U, 0xDFFBE266U, 0x8E74F279U, 0xBEF1FD8CU,
- 0x2D6AD247U, 0x1DEFDDB2U, 0x4C60CDADU, 0x7CE5C258U, 0xD1C4D38AU, 0xE141DC7FU, 0xB0CECC60U, 0x804BC395U, 0x13D0EC5EU,
- 0x2355E3ABU, 0x72DAF3B4U, 0x425FFC41U, 0xC452C67DU, 0xF4D7C988U, 0xA558D997U, 0x95DDD662U, 0x0646F9A9U, 0x36C3F65CU,
- 0x674CE643U, 0x57C9E9B6U, 0xC8DF352FU, 0xF85A3ADAU, 0xA9D52AC5U, 0x99502530U, 0x0ACB0AFBU, 0x3A4E050EU, 0x6BC11511U,
- 0x5B441AE4U, 0xDD4920D8U, 0xEDCC2F2DU, 0xBC433F32U, 0x8CC630C7U, 0x1F5D1F0CU, 0x2FD810F9U, 0x7E5700E6U, 0x4ED20F13U,
- 0xE3F31EC1U, 0xD3761134U, 0x82F9012BU, 0xB27C0EDEU, 0x21E72115U, 0x11622EE0U, 0x40ED3EFFU, 0x7068310AU, 0xF6650B36U,
- 0xC6E004C3U, 0x976F14DCU, 0xA7EA1B29U, 0x347134E2U, 0x04F43B17U, 0x557B2B08U, 0x65FE24FDU, 0x9E8762F3U, 0xAE026D06U,
- 0xFF8D7D19U, 0xCF0872ECU, 0x5C935D27U, 0x6C1652D2U, 0x3D9942CDU, 0x0D1C4D38U, 0x8B117704U, 0xBB9478F1U, 0xEA1B68EEU,
- 0xDA9E671BU, 0x490548D0U, 0x79804725U, 0x280F573AU, 0x188A58CFU, 0xB5AB491DU, 0x852E46E8U, 0xD4A156F7U, 0xE4245902U,
- 0x77BF76C9U, 0x473A793CU, 0x16B56923U, 0x263066D6U, 0xA03D5CEAU, 0x90B8531FU, 0xC1374300U, 0xF1B24CF5U, 0x6229633EU,
- 0x52AC6CCBU, 0x03237CD4U, 0x33A67321U, 0x646F9A97U, 0x54EA9562U, 0x0565857DU, 0x35E08A88U, 0xA67BA543U, 0x96FEAAB6U,
- 0xC771BAA9U, 0xF7F4B55CU, 0x71F98F60U, 0x417C8095U, 0x10F3908AU, 0x20769F7FU, 0xB3EDB0B4U, 0x8368BF41U, 0xD2E7AF5EU,
- 0xE262A0ABU, 0x4F43B179U, 0x7FC6BE8CU, 0x2E49AE93U, 0x1ECCA166U, 0x8D578EADU, 0xBDD28158U, 0xEC5D9147U, 0xDCD89EB2U,
- 0x5AD5A48EU, 0x6A50AB7BU, 0x3BDFBB64U, 0x0B5AB491U, 0x98C19B5AU, 0xA84494AFU, 0xF9CB84B0U, 0xC94E8B45U, 0x3237CD4BU,
- 0x02B2C2BEU, 0x533DD2A1U, 0x63B8DD54U, 0xF023F29FU, 0xC0A6FD6AU, 0x9129ED75U, 0xA1ACE280U, 0x27A1D8BCU, 0x1724D749U,
- 0x46ABC756U, 0x762EC8A3U, 0xE5B5E768U, 0xD530E89DU, 0x84BFF882U, 0xB43AF777U, 0x191BE6A5U, 0x299EE950U, 0x7811F94FU,
- 0x4894F6BAU, 0xDB0FD971U, 0xEB8AD684U, 0xBA05C69BU, 0x8A80C96EU, 0x0C8DF352U, 0x3C08FCA7U, 0x6D87ECB8U, 0x5D02E34DU,
- 0xCE99CC86U, 0xFE1CC373U, 0xAF93D36CU, 0x9F16DC99U
-};
-
-/**
-* Calculates the CRC over the provided range.
-*
-* @param begin Constant iterator pointing to begin of the range.
-* @param end Constant iterator pointing to end of the range.
-* @param startValue The CRC value from previous call.
-* @return The calculated CRC value.
-*
-* Parameters of the CRC:
-* - Width = 32
-* - Poly = 0x4C11DB7
-* - InitValue = 0xFFFFFFFF
-* - ReflectIn = true
-* - XorOut = 0xFFFFFFFF
-* - ReflectOut = true
-*/
-uint32_t e2e_crc::calculate_profile_custom(buffer_view _buffer_view) {
- // InitValue
- uint32_t crc = 0xFFFFFFFFU;
-
- for (uint8_t byte : _buffer_view) {
- crc = lookup_table_profile_custom_[static_cast<uint8_t>(byte ^ crc)] ^ (crc >> 8U);
- }
-
- // XorOut
- crc = crc ^ 0xFFFFFFFFU;
- return crc;
-}
-
-const uint32_t e2e_crc::lookup_table_profile_custom_[256] = {
- 0x00000000U, 0x77073096U, 0xEE0E612CU, 0x990951BAU, 0x076DC419U, 0x706AF48FU, 0xE963A535U, 0x9E6495A3U,
- 0x0EDB8832U, 0x79DCB8A4U, 0xE0D5E91EU, 0x97D2D988U, 0x09B64C2BU, 0x7EB17CBDU, 0xE7B82D07U, 0x90BF1D91U,
- 0x1DB71064U, 0x6AB020F2U, 0xF3B97148U, 0x84BE41DEU, 0x1ADAD47DU, 0x6DDDE4EBU, 0xF4D4B551U, 0x83D385C7U,
- 0x136C9856U, 0x646BA8C0U, 0xFD62F97AU, 0x8A65C9ECU, 0x14015C4FU, 0x63066CD9U, 0xFA0F3D63U, 0x8D080DF5U,
- 0x3B6E20C8U, 0x4C69105EU, 0xD56041E4U, 0xA2677172U, 0x3C03E4D1U, 0x4B04D447U, 0xD20D85FDU, 0xA50AB56BU,
- 0x35B5A8FAU, 0x42B2986CU, 0xDBBBC9D6U, 0xACBCF940U, 0x32D86CE3U, 0x45DF5C75U, 0xDCD60DCFU, 0xABD13D59U,
- 0x26D930ACU, 0x51DE003AU, 0xC8D75180U, 0xBFD06116U, 0x21B4F4B5U, 0x56B3C423U, 0xCFBA9599U, 0xB8BDA50FU,
- 0x2802B89EU, 0x5F058808U, 0xC60CD9B2U, 0xB10BE924U, 0x2F6F7C87U, 0x58684C11U, 0xC1611DABU, 0xB6662D3DU,
- 0x76DC4190U, 0x01DB7106U, 0x98D220BCU, 0xEFD5102AU, 0x71B18589U, 0x06B6B51FU, 0x9FBFE4A5U, 0xE8B8D433U,
- 0x7807C9A2U, 0x0F00F934U, 0x9609A88EU, 0xE10E9818U, 0x7F6A0DBBU, 0x086D3D2DU, 0x91646C97U, 0xE6635C01U,
- 0x6B6B51F4U, 0x1C6C6162U, 0x856530D8U, 0xF262004EU, 0x6C0695EDU, 0x1B01A57BU, 0x8208F4C1U, 0xF50FC457U,
- 0x65B0D9C6U, 0x12B7E950U, 0x8BBEB8EAU, 0xFCB9887CU, 0x62DD1DDFU, 0x15DA2D49U, 0x8CD37CF3U, 0xFBD44C65U,
- 0x4DB26158U, 0x3AB551CEU, 0xA3BC0074U, 0xD4BB30E2U, 0x4ADFA541U, 0x3DD895D7U, 0xA4D1C46DU, 0xD3D6F4FBU,
- 0x4369E96AU, 0x346ED9FCU, 0xAD678846U, 0xDA60B8D0U, 0x44042D73U, 0x33031DE5U, 0xAA0A4C5FU, 0xDD0D7CC9U,
- 0x5005713CU, 0x270241AAU, 0xBE0B1010U, 0xC90C2086U, 0x5768B525U, 0x206F85B3U, 0xB966D409U, 0xCE61E49FU,
- 0x5EDEF90EU, 0x29D9C998U, 0xB0D09822U, 0xC7D7A8B4U, 0x59B33D17U, 0x2EB40D81U, 0xB7BD5C3BU, 0xC0BA6CADU,
- 0xEDB88320U, 0x9ABFB3B6U, 0x03B6E20CU, 0x74B1D29AU, 0xEAD54739U, 0x9DD277AFU, 0x04DB2615U, 0x73DC1683U,
- 0xE3630B12U, 0x94643B84U, 0x0D6D6A3EU, 0x7A6A5AA8U, 0xE40ECF0BU, 0x9309FF9DU, 0x0A00AE27U, 0x7D079EB1U,
- 0xF00F9344U, 0x8708A3D2U, 0x1E01F268U, 0x6906C2FEU, 0xF762575DU, 0x806567CBU, 0x196C3671U, 0x6E6B06E7U,
- 0xFED41B76U, 0x89D32BE0U, 0x10DA7A5AU, 0x67DD4ACCU, 0xF9B9DF6FU, 0x8EBEEFF9U, 0x17B7BE43U, 0x60B08ED5U,
- 0xD6D6A3E8U, 0xA1D1937EU, 0x38D8C2C4U, 0x4FDFF252U, 0xD1BB67F1U, 0xA6BC5767U, 0x3FB506DDU, 0x48B2364BU,
- 0xD80D2BDAU, 0xAF0A1B4CU, 0x36034AF6U, 0x41047A60U, 0xDF60EFC3U, 0xA867DF55U, 0x316E8EEFU, 0x4669BE79U,
- 0xCB61B38CU, 0xBC66831AU, 0x256FD2A0U, 0x5268E236U, 0xCC0C7795U, 0xBB0B4703U, 0x220216B9U, 0x5505262FU,
- 0xC5BA3BBEU, 0xB2BD0B28U, 0x2BB45A92U, 0x5CB36A04U, 0xC2D7FFA7U, 0xB5D0CF31U, 0x2CD99E8BU, 0x5BDEAE1DU,
- 0x9B64C2B0U, 0xEC63F226U, 0x756AA39CU, 0x026D930AU, 0x9C0906A9U, 0xEB0E363FU, 0x72076785U, 0x05005713U,
- 0x95BF4A82U, 0xE2B87A14U, 0x7BB12BAEU, 0x0CB61B38U, 0x92D28E9BU, 0xE5D5BE0DU, 0x7CDCEFB7U, 0x0BDBDF21U,
- 0x86D3D2D4U, 0xF1D4E242U, 0x68DDB3F8U, 0x1FDA836EU, 0x81BE16CDU, 0xF6B9265BU, 0x6FB077E1U, 0x18B74777U,
- 0x88085AE6U, 0xFF0F6A70U, 0x66063BCAU, 0x11010B5CU, 0x8F659EFFU, 0xF862AE69U, 0x616BFFD3U, 0x166CCF45U,
- 0xA00AE278U, 0xD70DD2EEU, 0x4E048354U, 0x3903B3C2U, 0xA7672661U, 0xD06016F7U, 0x4969474DU, 0x3E6E77DBU,
- 0xAED16A4AU, 0xD9D65ADCU, 0x40DF0B66U, 0x37D83BF0U, 0xA9BCAE53U, 0xDEBB9EC5U, 0x47B2CF7FU, 0x30B5FFE9U,
- 0xBDBDF21CU, 0xCABAC28AU, 0x53B39330U, 0x24B4A3A6U, 0xBAD03605U, 0xCDD70693U, 0x54DE5729U, 0x23D967BFU,
- 0xB3667A2EU, 0xC4614AB8U, 0x5D681B02U, 0x2A6F2B94U, 0xB40BBE37U, 0xC30C8EA1U, 0x5A05DF1BU, 0x2D02EF8DU
-};
-
-} // namespace vsomeip
-
diff --git a/implementation/e2e_protection/src/e2e/profile/profile01/checker.cpp b/implementation/e2e_protection/src/e2e/profile/profile01/checker.cpp
deleted file mode 100644
index e4c0504..0000000
--- a/implementation/e2e_protection/src/e2e/profile/profile01/checker.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (C) 2014-2017 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 "../../../../../e2e_protection/include/e2e/profile/profile01/checker.hpp"
-#include "../../../../../logging/include/logger.hpp"
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <iomanip>
-#include <algorithm>
-
-namespace vsomeip {
-namespace e2e {
-namespace profile01 {
-
-// [SWS_E2E_00196]
-void profile_01_checker::check(const e2e_buffer &_buffer,
- e2e::profile_interface::generic_check_status &_generic_check_status) {
- std::lock_guard<std::mutex> lock(check_mutex_);
- _generic_check_status = e2e::profile_interface::generic_check_status::E2E_ERROR;
-
- if (profile_01::is_buffer_length_valid(config_, _buffer)) {
- uint8_t received_crc(0);
- uint8_t calculated_crc(0);
- received_crc = _buffer[config_.crc_offset_];
- calculated_crc = profile_01::compute_crc(config_, _buffer);
- if (received_crc == calculated_crc) {
- _generic_check_status = e2e::profile_interface::generic_check_status::E2E_OK;
- } else {
- _generic_check_status = e2e::profile_interface::generic_check_status::E2E_WRONG_CRC;
- VSOMEIP_INFO << std::hex << "E2E protection: CRC8 does not match: calculated CRC: "
- << (uint32_t) calculated_crc << " received CRC: " << (uint32_t) received_crc;
- }
- }
- return;
-}
-
-} // namespace profile01
-} // namespace e2e
-} // namespace vsomeip
diff --git a/implementation/e2e_protection/src/e2e/profile/profile01/profile_01.cpp b/implementation/e2e_protection/src/e2e/profile/profile01/profile_01.cpp
deleted file mode 100644
index 72bd14c..0000000
--- a/implementation/e2e_protection/src/e2e/profile/profile01/profile_01.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (C) 2014-2017 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 "../../../../../e2e_protection/include/e2e/profile/profile01/profile_01.hpp"
-#include "../../../../../e2e_protection/include/crc/crc.hpp"
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <iomanip>
-
-namespace vsomeip {
-namespace e2e {
-namespace profile01 {
-
-uint8_t profile_01::compute_crc(const profile_config &_config, const e2e_buffer &_buffer) {
- uint8_t computed_crc = 0xFF;
- e2e_buffer data_id_buffer; //(_data, _data+_size);
- data_id_buffer.push_back((uint8_t) (_config.data_id_ >> 8)); // insert MSB
- data_id_buffer.push_back((uint8_t) _config.data_id_); // insert LSB
-
- switch (_config.data_id_mode_) {
- case p01_data_id_mode::E2E_P01_DATAID_BOTH: // CRC over 2 bytes
- /*
- * Two bytes are included in the CRC (double ID configuration) This is used in E2E variant 1A.
- */
- // CRC = Crc_CalculateCRC8(Config->DataID, 1, 0xFF, FALSE)
- computed_crc = e2e_crc::calculate_profile_01(buffer_view(data_id_buffer, 1, 2), 0xFF); //CRC over low byte of Data ID (LSB)
-
- // CRC = Crc_CalculateCRC8(Config->DataID >> 8, 1, CRC, FALSE)
- computed_crc = e2e_crc::calculate_profile_01(buffer_view(data_id_buffer, 0, 1), computed_crc); //CRC over high byte of Data ID (MSB)
-
- break;
- case p01_data_id_mode::E2E_P01_DATAID_LOW: // CRC over low byte only
- /*
- * Only the low byte is included, the high byte is never used.
- * This is applicable if the IDs in a particular system are 8 bits
- */
- // CRC = Crc_CalculateCRC8(Config->DataID, 1, 0xFF, FALSE)
- computed_crc = e2e_crc::calculate_profile_01(buffer_view(data_id_buffer, 1, 2), 0xFF); //CRC over low byte of Data ID (LSB)
- break;
-
- case p01_data_id_mode::E2E_P01_DATAID_ALT:
- /* One of the two bytes byte is included, alternating high and low byte,
- * depending on parity of the counter (alternating ID configuration).
- * For an even counter, the low byte is included.
- * For an odd counter, the high byte is included.
- * This is used in E2E variant 1B.
- *
- if( counter % 2 == 0) {
- // CRC = Crc_CalculateCRC8(Config->DataID, 1, 0xFF, FALSE)
- computed_crc = crc::e2e_crc::calculate_profile_01(buffer::buffer_view(data_id_buffer, 1, 2), 0xFF); //CRC over low byte of Data ID (LSB)
- } else {
- // CRC = Crc_CalculateCRC8(Config->DataID >> 8, 1, 0xFF, FALSE)
- computed_crc = crc::e2e_crc::calculate_profile_01(buffer::buffer_view(data_id_buffer, 0, 1), 0xFF); //CRC over high byte of Data ID (MSB)
- }
- */
- break;
-
- case p01_data_id_mode::E2E_P01_DATAID_NIBBLE:
- /*
- * The low byte is included in the implicit CRC calculation,
- * the low nibble of the high byte is transmitted along with
- * the data (i.e. it is explicitly included), the high nibble of
- * the high byte is not used. This is applicable for the IDs
- * up to 12 bits. This is used in E2E variant 1C.
- */
- // CRC = Crc_CalculateCRC8(Config->DataID, 1, 0xFF, FALSE)
- computed_crc = e2e_crc::calculate_profile_01(buffer_view(data_id_buffer, 1, 2), 0xFF); //CRC over low byte of Data ID (LSB)
-
- // CRC = Crc_CalculateCRC8 (0, 1, CRC, FALSE)
- data_id_buffer.clear();
- data_id_buffer.push_back(0x00);
- computed_crc = e2e_crc::calculate_profile_01(buffer_view(data_id_buffer, 0, 1), computed_crc); // CRC with 0x00
- break;
-
- default:
- break;
- }
-
- // Compute CRC over the area before the CRC (if CRC is not the first byte)
- if (_config.crc_offset_ >= 1) {
- // CRC = Crc_CalculateCRC8 (Data, (Config->CRCOffset / 8), CRC, FALSE)
- computed_crc = e2e_crc::calculate_profile_01(buffer_view(_buffer, 0, _config.crc_offset_), computed_crc);
- }
-
- // Compute the area after CRC, if CRC is not the last byte. Start with the byte after CRC, finish with the last byte of Data.
- if ((_config.crc_offset_) < (_config.data_length_ / 8) - 1) {
- // CRC = Crc_CalculateCRC8 (& Data[Config->CRCOffset/8 + 1], (Config->DataLength / 8 - Config->CRCOffset / 8 - 1), CRC, FALSE)
- computed_crc = e2e_crc::calculate_profile_01(buffer_view(_buffer, _config.crc_offset_ + 1, _buffer.size()), computed_crc);
- }
-
- // CRC = CRC ^ 0xFF
- // To negate the last XOR 0xFF operation done on computed CRC by the last CalculateCRC8(), there is a XORing doneexternally by E2E Library
- computed_crc = computed_crc ^ 0xFFU;
- return computed_crc;
-}
-
-/** @req [SWS_E2E_00356] */
-bool profile_01::is_buffer_length_valid(const profile_config &_config, const e2e_buffer &_buffer) {
- return (((_config.data_length_ / 8) + 1U <= _buffer.size())
- && _config.crc_offset_ <= _buffer.size()
- && _config.counter_offset_ / 8 <= _buffer.size()
- && _config.data_id_nibble_offset_ / 8 <= _buffer.size());
-}
-
-} // namespace profile01
-} // namespace e2e
-} // namespace vsomeip
diff --git a/implementation/e2e_protection/src/e2e/profile/profile01/protector.cpp b/implementation/e2e_protection/src/e2e/profile/profile01/protector.cpp
deleted file mode 100644
index 0bf0199..0000000
--- a/implementation/e2e_protection/src/e2e/profile/profile01/protector.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (C) 2014-2017 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 "../../../../../e2e_protection/include/e2e/profile/profile01/protector.hpp"
-#include "../../../../../logging/include/logger.hpp"
-
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <iomanip>
-
-namespace vsomeip {
-namespace e2e {
-namespace profile01 {
-
-/** @req [SWS_E2E_00195] */
-void protector::protect(e2e_buffer &_buffer) {
- std::lock_guard<std::mutex> lock(protect_mutex_);
-
- if (profile_01::is_buffer_length_valid(config_, _buffer)) {
- // write the current Counter value in Data
- write_counter(_buffer);
-
- // write DataID nibble in Data (E2E_P01_DATAID_NIBBLE) in Data
- write_data_id(_buffer);
-
- // compute the CRC over DataID and Data
- uint8_t computed_crc = profile_01::compute_crc(config_, _buffer);
- // write CRC in Data
- write_crc(_buffer, computed_crc);
-
- // increment the Counter (new value will be used in the next invocation of E2E_P01Protect()),
- increment_counter();
- }
-}
-
-/** @req [SRS_E2E_08528] */
-void protector::write_counter(e2e_buffer &_buffer) {
- if (config_.counter_offset_ % 8 == 0) {
- // write write counter value into low nibble
- _buffer[config_.counter_offset_ / 8] =
- static_cast<uint8_t>((_buffer[config_.counter_offset_ / 8] & 0xF0) | (counter_ & 0x0F));
- } else {
- // write counter into high nibble
- _buffer[config_.counter_offset_ / 8] =
- static_cast<uint8_t>((_buffer[config_.counter_offset_ / 8] & 0x0F) | ((counter_ << 4) & 0xF0));
- }
-}
-
-/** @req [SRS_E2E_08528] */
-void protector::write_data_id(e2e_buffer &_buffer) {
- if (config_.data_id_mode_ == p01_data_id_mode::E2E_P01_DATAID_NIBBLE) {
- if (config_.data_id_nibble_offset_ % 8 == 0) {
- // write low nibble of high byte of Data ID
- _buffer[config_.data_id_nibble_offset_ / 8] =
- static_cast<uint8_t>((_buffer[config_.data_id_nibble_offset_ / 8] & 0xF0) | ((config_.data_id_ >> 8) & 0x0F));
- } else {
- // write low nibble of high byte of Data ID
- _buffer[config_.data_id_nibble_offset_ / 8] =
- static_cast<uint8_t>((_buffer[config_.data_id_nibble_offset_ / 8] & 0x0F) | ((config_.data_id_ >> 4) & 0xF0));
- }
- }
-}
-
-/** @req [SRS_E2E_08528] */
-void protector::write_crc(e2e_buffer &_buffer, uint8_t _computed_crc) {
- _buffer[config_.crc_offset_] = _computed_crc;
-}
-
-/** @req [SWS_E2E_00075] */
-void protector::increment_counter(void) {
- counter_ = static_cast<uint8_t>((counter_ + 1U) % 15);
-}
-
-} // namespace profile01
-} // namespace e2e
-} // namespace vsomeip
diff --git a/implementation/e2e_protection/src/e2e/profile/profile_custom/checker.cpp b/implementation/e2e_protection/src/e2e/profile/profile_custom/checker.cpp
deleted file mode 100644
index eb6f557..0000000
--- a/implementation/e2e_protection/src/e2e/profile/profile_custom/checker.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2014-2017 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 "../../../../../e2e_protection/include/e2e/profile/profile_custom/checker.hpp"
-#include "../../../../../logging/include/logger.hpp"
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <iomanip>
-#include <algorithm>
-
-namespace vsomeip {
-namespace e2e {
-namespace profile_custom {
-
-void profile_custom_checker::check(const e2e_buffer &_buffer,
- e2e::profile_interface::generic_check_status &_generic_check_status) {
- std::lock_guard<std::mutex> lock(check_mutex_);
- _generic_check_status = e2e::profile_interface::generic_check_status::E2E_ERROR;
-
- if (profile_custom::is_buffer_length_valid(config_, _buffer)) {
- uint32_t received_crc(0);
- uint32_t calculated_crc(0);
-
- received_crc = read_crc(_buffer);
- calculated_crc = profile_custom::compute_crc(config_, _buffer);
- if (received_crc == calculated_crc) {
- _generic_check_status = e2e::profile_interface::generic_check_status::E2E_OK;
- } else {
- _generic_check_status = e2e::profile_interface::generic_check_status::E2E_WRONG_CRC;
- VSOMEIP_INFO << std::hex << "E2E protection: CRC32 does not match: calculated CRC: "
- << (uint32_t) calculated_crc << " received CRC: " << (uint32_t) received_crc;
- }
- }
- return;
-}
-
-uint32_t profile_custom_checker::read_crc(const e2e_buffer &_buffer) const {
- return (static_cast<uint32_t>(_buffer[config_.crc_offset_ ]) << 24U) |
- (static_cast<uint32_t>(_buffer[config_.crc_offset_ + 1U]) << 16U) |
- (static_cast<uint32_t>(_buffer[config_.crc_offset_ + 2U]) << 8U) |
- static_cast<uint32_t>(_buffer[config_.crc_offset_ + 3U]);
-}
-
-} // namespace profile_custom
-} // namespace e2e
-} // namespace vsomeip
diff --git a/implementation/e2e_protection/src/e2e/profile/profile_custom/profile_custom.cpp b/implementation/e2e_protection/src/e2e/profile/profile_custom/profile_custom.cpp
deleted file mode 100644
index d7de34b..0000000
--- a/implementation/e2e_protection/src/e2e/profile/profile_custom/profile_custom.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2014-2017 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 "../../../../../e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp"
-#include "../../../../../e2e_protection/include/crc/crc.hpp"
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <iomanip>
-
-namespace vsomeip {
-namespace e2e {
-namespace profile_custom {
-
-uint32_t profile_custom::compute_crc(const profile_config &_config, const e2e_buffer &_buffer) {
- uint32_t computed_crc = e2e_crc::calculate_profile_custom(buffer_view(_buffer, _config.crc_offset_ + 4, _buffer.size()));
- return computed_crc;
-}
-
-bool profile_custom::is_buffer_length_valid(const profile_config &_config, const e2e_buffer &_buffer) {
- return ((_config.crc_offset_ + 4U) <=_buffer.size());
-}
-
-} // namespace profile_custom
-} // namespace e2e
-} // namespace vsomeip
diff --git a/implementation/e2e_protection/src/e2e/profile/profile_custom/protector.cpp b/implementation/e2e_protection/src/e2e/profile/profile_custom/protector.cpp
deleted file mode 100644
index f061e55..0000000
--- a/implementation/e2e_protection/src/e2e/profile/profile_custom/protector.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2014-2017 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 "../../../../../e2e_protection/include/e2e/profile/profile_custom/protector.hpp"
-#include "../../../../../logging/include/logger.hpp"
-
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-
-namespace vsomeip {
-namespace e2e {
-namespace profile_custom {
-
-void protector::protect(e2e_buffer &_buffer) {
- std::lock_guard<std::mutex> lock(protect_mutex_);
-
- if (profile_custom::is_buffer_length_valid(config_, _buffer)) {
- // compute the CRC over DataID and Data
- uint32_t computed_crc = profile_custom::compute_crc(config_, _buffer);
- // write CRC in Data
- write_crc(_buffer, computed_crc);
- }
-}
-
-void protector::write_crc(e2e_buffer &_buffer, uint32_t _computed_crc) {
- _buffer[config_.crc_offset_] = static_cast<uint8_t>(_computed_crc >> 24U);
- _buffer[config_.crc_offset_ + 1U] = static_cast<uint8_t>(_computed_crc >> 16U);
- _buffer[config_.crc_offset_ + 2U] = static_cast<uint8_t>(_computed_crc >> 8U);
- _buffer[config_.crc_offset_ + 3U] = static_cast<uint8_t>(_computed_crc);
-}
-
-} // namespace profile_custom
-} // namespace e2e
-} // namespace vsomeip
diff --git a/implementation/e2e_protection/src/e2exf/config.cpp b/implementation/e2e_protection/src/e2exf/config.cpp
deleted file mode 100644
index e210faf..0000000
--- a/implementation/e2e_protection/src/e2exf/config.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (C) 2014-2017 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 <ostream>
-#include "../../../e2e_protection/include/e2exf/config.hpp"
-
-namespace vsomeip {
-
-std::ostream &operator<<(std::ostream &_os, const e2exf::data_identifier &_data_identifier) {
- _os << _data_identifier.first << _data_identifier.second;
- return _os;
-}
-
-} // namespace vsomeip
diff --git a/implementation/endpoints/include/buffer.hpp b/implementation/endpoints/include/buffer.hpp
deleted file mode 100644
index c384f0d..0000000
--- a/implementation/endpoints/include/buffer.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2014-2017 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_BUFFER_HPP
-#define VSOMEIP_BUFFER_HPP
-
-#include <array>
-#include <memory>
-
-#include <vsomeip/defines.hpp>
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-typedef std::vector<byte_t> message_buffer_t;
-typedef std::shared_ptr<message_buffer_t> message_buffer_ptr_t;
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_BUFFER_HPP
diff --git a/implementation/endpoints/include/client_endpoint.hpp b/implementation/endpoints/include/client_endpoint.hpp
deleted file mode 100644
index 4dc828a..0000000
--- a/implementation/endpoints/include/client_endpoint.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2014-2017 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_CLIENT_ENDPOINT_HPP_
-#define VSOMEIP_CLIENT_ENDPOINT_HPP_
-
-#include "endpoint.hpp"
-
-namespace vsomeip {
-
-class client_endpoint : public virtual endpoint {
-public:
- virtual ~client_endpoint() {}
-
- virtual bool get_remote_address(boost::asio::ip::address &_address) const = 0;
- virtual std::uint16_t get_remote_port() const = 0;
-};
-
-} // namespace vsomeip
-
-
-#endif /* VSOMEIP_CLIENT_ENDPOINT_HPP_ */
diff --git a/implementation/endpoints/include/client_endpoint_impl.hpp b/implementation/endpoints/include/client_endpoint_impl.hpp
deleted file mode 100644
index b72ea7e..0000000
--- a/implementation/endpoints/include/client_endpoint_impl.hpp
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (C) 2014-2017 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_CLIENT_ENDPOINT_IMPL_HPP
-#define VSOMEIP_CLIENT_ENDPOINT_IMPL_HPP
-
-#include <condition_variable>
-#include <deque>
-#include <mutex>
-#include <vector>
-#include <atomic>
-
-#include <boost/array.hpp>
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ip/udp.hpp>
-#include <boost/utility.hpp>
-#include <vsomeip/constants.hpp>
-
-#include "buffer.hpp"
-#include "endpoint_impl.hpp"
-#include "client_endpoint.hpp"
-
-namespace vsomeip {
-
-class endpoint;
-class endpoint_host;
-
-template<typename Protocol>
-class client_endpoint_impl: public endpoint_impl<Protocol>, public client_endpoint,
- public std::enable_shared_from_this<client_endpoint_impl<Protocol> > {
-public:
- typedef typename Protocol::endpoint endpoint_type;
- typedef typename Protocol::socket socket_type;
-
- client_endpoint_impl(std::shared_ptr<endpoint_host> _host,
- endpoint_type _local, endpoint_type _remote,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- configuration::endpoint_queue_limit_t _queue_limit);
- virtual ~client_endpoint_impl();
-
- bool send(const uint8_t *_data, uint32_t _size, bool _flush);
- bool send_to(const std::shared_ptr<endpoint_definition> _target,
- const byte_t *_data, uint32_t _size, bool _flush = true);
- bool flush();
-
- virtual void stop();
- virtual void restart() = 0;
-
- bool is_client() const;
-
- bool is_connected() const;
- void set_connected(bool _connected);
- virtual bool get_remote_address(boost::asio::ip::address &_address) const;
- virtual std::uint16_t get_remote_port() const;
-
- std::uint16_t get_local_port() const;
-
-public:
- void connect_cbk(boost::system::error_code const &_error);
- void wait_connect_cbk(boost::system::error_code const &_error);
- void send_cbk(boost::system::error_code const &_error, std::size_t _bytes);
- void flush_cbk(boost::system::error_code const &_error);
-
-public:
- virtual void connect() = 0;
- virtual void receive() = 0;
- virtual void print_status() = 0;
-
-protected:
- enum class cei_state_e : std::uint8_t {
- CLOSED,
- CONNECTING,
- ESTABLISHED
- };
- virtual void send_queued() = 0;
- void shutdown_and_close_socket(bool _recreate_socket);
- void shutdown_and_close_socket_unlocked(bool _recreate_socket);
- void start_connect_timer();
-
- mutable std::mutex socket_mutex_;
- std::unique_ptr<socket_type> socket_;
- endpoint_type remote_;
-
- boost::asio::steady_timer flush_timer_;
-
- std::mutex connect_timer_mutex_;
- boost::asio::steady_timer connect_timer_;
- std::atomic<uint32_t> connect_timeout_;
- std::atomic<cei_state_e> state_;
-
- // send data
- message_buffer_ptr_t packetizer_;
- std::deque<message_buffer_ptr_t> queue_;
- std::size_t queue_size_;
-
- std::mutex mutex_;
-
- bool was_not_connected_;
-
- std::atomic<std::uint16_t> local_port_;
-
-private:
- virtual void set_local_port() = 0;
- virtual std::string get_remote_information() const = 0;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_CLIENT_ENDPOINT_IMPL_HPP
diff --git a/implementation/endpoints/include/credentials.hpp b/implementation/endpoints/include/credentials.hpp
deleted file mode 100644
index 63c3470..0000000
--- a/implementation/endpoints/include/credentials.hpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) 2014-2017 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 ENDPOINTS_INCLUDE_CREDENTIALS_HPP_
-#define ENDPOINTS_INCLUDE_CREDENTIALS_HPP_
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-class credentials {
-public:
- static void activate_credentials(const int _fd);
-
- static void deactivate_credentials(const int _fd);
-
- static client_t receive_credentials(const int _fd, uid_t& _uid, gid_t& _gid);
-
- static void send_credentials(const int _fd, client_t _client);
-};
-
-} // namespace vsomeip
-
-#endif /* ENDPOINTS_INCLUDE_CREDENTIALS_HPP_ */
diff --git a/implementation/endpoints/include/endpoint.hpp b/implementation/endpoints/include/endpoint.hpp
deleted file mode 100644
index dc97ffe..0000000
--- a/implementation/endpoints/include/endpoint.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2014-2017 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_ENDPOINT_HPP
-#define VSOMEIP_ENDPOINT_HPP
-
-#include <boost/asio/ip/address.hpp>
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-class endpoint_definition;
-
-class endpoint {
-public:
- typedef std::function<void()> error_handler_t;
-
- virtual ~endpoint() {}
-
- virtual void start() = 0;
- virtual void stop() = 0;
-
- virtual bool is_connected() const = 0;
-
- virtual bool send(const byte_t *_data, uint32_t _size,
- bool _flush = true) = 0;
- virtual bool send_to(const std::shared_ptr<endpoint_definition> _target,
- const byte_t *_data, uint32_t _size, bool _flush = true) = 0;
- virtual void enable_magic_cookies() = 0;
- virtual void receive() = 0;
-
- virtual void join(const std::string &_address) = 0;
- virtual void leave(const std::string &_address) = 0;
-
- virtual void add_default_target(service_t _service,
- const std::string &_address, uint16_t _port) = 0;
- virtual void remove_default_target(service_t _service) = 0;
-
- virtual std::uint16_t get_local_port() const = 0;
- virtual bool is_reliable() const = 0;
- virtual bool is_local() const = 0;
-
- virtual void increment_use_count() = 0;
- virtual void decrement_use_count() = 0;
- virtual uint32_t get_use_count() = 0;
-
- virtual void restart() = 0;
-
- virtual void register_error_handler(error_handler_t _error) = 0;
-
- virtual void print_status() = 0;
-
- virtual void set_connected(bool _connected) = 0;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ENDPOINT_HPP
diff --git a/implementation/endpoints/include/endpoint_definition.hpp b/implementation/endpoints/include/endpoint_definition.hpp
deleted file mode 100644
index 71309fd..0000000
--- a/implementation/endpoints/include/endpoint_definition.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (C) 2014-2017 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_ENDPOINT_DEFINITION_HPP
-#define VSOMEIP_ENDPOINT_DEFINITION_HPP
-
-#include <map>
-#include <memory>
-#include <atomic>
-#include <mutex>
-
-#include <boost/asio/ip/address.hpp>
-#include <vsomeip/primitive_types.hpp>
-
-#include <vsomeip/export.hpp>
-
-namespace vsomeip {
-
-class endpoint_definition {
-public:
- VSOMEIP_EXPORT static std::shared_ptr<endpoint_definition> get(
- const boost::asio::ip::address &_address,
- uint16_t _port, bool _is_reliable, service_t _service, instance_t _instance);
-
- VSOMEIP_EXPORT const boost::asio::ip::address &get_address() const;
-
- VSOMEIP_EXPORT uint16_t get_port() const;
-
- VSOMEIP_EXPORT uint16_t get_remote_port() const;
- VSOMEIP_EXPORT void set_remote_port(uint16_t _port);
-
- VSOMEIP_EXPORT bool is_reliable() const;
-
- VSOMEIP_EXPORT endpoint_definition(
- const boost::asio::ip::address &_address,
- uint16_t _port, bool _is_reliable);
-private:
- boost::asio::ip::address address_;
- uint16_t port_;
- std::atomic<uint16_t> remote_port_;
- bool is_reliable_;
-
- static std::mutex definitions_mutex_;
- static std::map<service_t,
- std::map<instance_t,
- std::map<boost::asio::ip::address,
- std::map<uint16_t,
- std::map<bool,
- std::shared_ptr<endpoint_definition> > > > > > definitions_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ENDPOINT_DEFINITION_HPP
diff --git a/implementation/endpoints/include/endpoint_host.hpp b/implementation/endpoints/include/endpoint_host.hpp
deleted file mode 100644
index ddbb7e8..0000000
--- a/implementation/endpoints/include/endpoint_host.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2014-2017 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_ENDPOINT_HOST_HPP
-#define VSOMEIP_ENDPOINT_HOST_HPP
-
-#include <memory>
-
-#include <boost/asio/ip/address.hpp>
-#include "../../configuration/include/internal.hpp"
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-class configuration;
-class endpoint;
-
-class endpoint_host {
-public:
- virtual ~endpoint_host() {}
-
- virtual const std::shared_ptr<configuration> get_configuration() const = 0;
- virtual void on_connect(std::shared_ptr<endpoint> _endpoint) = 0;
- virtual void on_disconnect(std::shared_ptr<endpoint> _endpoint) = 0;
- virtual void on_message(const byte_t *_data, length_t _length,
- endpoint *_receiver, const boost::asio::ip::address &_destination
- = boost::asio::ip::address(),
- client_t _bound_client = VSOMEIP_ROUTING_CLIENT,
- const boost::asio::ip::address &_remote_address = boost::asio::ip::address(),
- std::uint16_t _remote_port = 0) = 0;
- virtual void on_error(const byte_t *_data, length_t _length,
- endpoint *_receiver,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port) = 0;
- virtual void release_port(uint16_t _port, bool _reliable) = 0;
- virtual client_t get_client() const = 0;
-#ifndef _WIN32
- virtual bool check_credentials(client_t _client, uid_t _uid, gid_t _gid) = 0;
-#endif
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ENDPOINT_HOST_HPP
diff --git a/implementation/endpoints/include/endpoint_impl.hpp b/implementation/endpoints/include/endpoint_impl.hpp
deleted file mode 100644
index 49b9f7f..0000000
--- a/implementation/endpoints/include/endpoint_impl.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (C) 2014-2017 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_ENDPOINT_IMPL_HPP
-#define VSOMEIP_ENDPOINT_IMPL_HPP
-
-#include <map>
-#include <memory>
-#include <mutex>
-#include <atomic>
-
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/steady_timer.hpp>
-
-#include "buffer.hpp"
-#include "endpoint.hpp"
-#include "../../configuration/include/configuration.hpp"
-
-namespace vsomeip {
-
-class endpoint_host;
-
-template<typename Protocol>
-class endpoint_impl: public virtual endpoint {
-public:
- typedef typename Protocol::endpoint endpoint_type;
-
- endpoint_impl(std::shared_ptr<endpoint_host> _adapter,
- endpoint_type _local,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- configuration::endpoint_queue_limit_t _queue_limit);
- virtual ~endpoint_impl();
-
- void enable_magic_cookies();
-
- // Dummy implementations as we only need these for UDP (servers)
- // TODO: redesign
- void join(const std::string &);
- void leave(const std::string &);
-
- void add_default_target(service_t, const std::string &, uint16_t);
- void remove_default_target(service_t);
-
- // Dummy implementations as we only need these for server endpoints
- // TODO: redesign
- std::uint16_t get_local_port() const;
- bool is_reliable() const;
-
- void increment_use_count();
- void decrement_use_count();
- uint32_t get_use_count();
-
- void register_error_handler(error_handler_t _error_handler);
- virtual void print_status() = 0;
-
-public:
- // required
- virtual bool is_client() const = 0;
- virtual void receive() = 0;
- virtual void restart() = 0;
-
-protected:
- uint32_t find_magic_cookie(byte_t *_buffer, size_t _size);
-
-protected:
- // Reference to service context
- boost::asio::io_service &service_;
-
- // Reference to host
- std::weak_ptr<endpoint_host> host_;
-
- bool is_supporting_magic_cookies_;
- std::atomic<bool> has_enabled_magic_cookies_;
-
- // Filter configuration
- std::map<service_t, uint8_t> opened_;
-
- std::uint32_t max_message_size_;
-
- uint32_t use_count_;
-
- bool sending_blocked_;
-
- std::mutex local_mutex_;
- endpoint_type local_;
-
- error_handler_t error_handler_;
- std::mutex error_handler_mutex_;
-
- const configuration::endpoint_queue_limit_t queue_limit_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ENDPOINT_IMPL_HPP
diff --git a/implementation/endpoints/include/local_client_endpoint_impl.hpp b/implementation/endpoints/include/local_client_endpoint_impl.hpp
deleted file mode 100644
index 1f9620c..0000000
--- a/implementation/endpoints/include/local_client_endpoint_impl.hpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2014-2017 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_LOCAL_CLIENT_ENDPOINT_IMPL_HPP
-#define VSOMEIP_LOCAL_CLIENT_ENDPOINT_IMPL_HPP
-
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/local/stream_protocol.hpp>
-
-#ifdef _WIN32
-#include <boost/asio/ip/tcp.hpp>
-#endif
-
-#include <vsomeip/defines.hpp>
-
-#include "client_endpoint_impl.hpp"
-
-namespace vsomeip {
-
-#ifdef _WIN32
-typedef client_endpoint_impl<
- boost::asio::ip::tcp
- > local_client_endpoint_base_impl;
-#else
-typedef client_endpoint_impl<
- boost::asio::local::stream_protocol
- > local_client_endpoint_base_impl;
-#endif
-
-class local_client_endpoint_impl: public local_client_endpoint_base_impl {
-public:
- local_client_endpoint_impl(std::shared_ptr<endpoint_host> _host,
- endpoint_type _remote,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- configuration::endpoint_queue_limit_t _queue_limit);
-
- virtual ~local_client_endpoint_impl();
-
- void start();
- void stop();
-
- bool is_local() const;
-
- bool get_remote_address(boost::asio::ip::address &_address) const;
- std::uint16_t get_remote_port() const;
-
- void restart();
- void print_status();
-
-private:
- void send_queued();
-
- void send_magic_cookie();
-
- void connect();
- void receive();
- void receive_cbk(boost::system::error_code const &_error,
- std::size_t _bytes);
- void set_local_port();
- std::string get_remote_information() const;
-
- message_buffer_t recv_buffer_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_LOCAL_CLIENT_ENDPOINT_IMPL_HPP
diff --git a/implementation/endpoints/include/local_server_endpoint_impl.hpp b/implementation/endpoints/include/local_server_endpoint_impl.hpp
deleted file mode 100644
index aee73c4..0000000
--- a/implementation/endpoints/include/local_server_endpoint_impl.hpp
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright (C) 2014-2017 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_LOCAL_SERVER_ENDPOINT_IMPL_HPP
-#define VSOMEIP_LOCAL_SERVER_ENDPOINT_IMPL_HPP
-
-#include <map>
-#include <thread>
-#include <condition_variable>
-#include <memory>
-
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/local/stream_protocol.hpp>
-
-#ifdef _WIN32
-#include <boost/asio/ip/tcp.hpp>
-#endif
-
-#include <vsomeip/defines.hpp>
-
-#include "buffer.hpp"
-#include "server_endpoint_impl.hpp"
-
-namespace vsomeip {
-
-#ifdef _WIN32
-typedef server_endpoint_impl<
- boost::asio::ip::tcp
- > local_server_endpoint_base_impl;
-#else
-typedef server_endpoint_impl<
- boost::asio::local::stream_protocol
- > local_server_endpoint_base_impl;
-#endif
-
-class local_server_endpoint_impl: public local_server_endpoint_base_impl {
-
-public:
- local_server_endpoint_impl(std::shared_ptr<endpoint_host> _host,
- endpoint_type _local,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- std::uint32_t _buffer_shrink_threshold,
- configuration::endpoint_queue_limit_t _queue_limit);
-
- local_server_endpoint_impl(std::shared_ptr<endpoint_host> _host,
- endpoint_type _local,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- int native_socket,
- std::uint32_t _buffer_shrink_threshold,
- configuration::endpoint_queue_limit_t _queue_limit);
-
- virtual ~local_server_endpoint_impl();
-
- void start();
- void stop();
-
- void receive();
-
- bool send_to(const std::shared_ptr<endpoint_definition>,
- const byte_t *_data, uint32_t _size, bool _flush);
- void send_queued(const queue_iterator_type _queue_iterator);
-
- bool get_default_target(service_t, endpoint_type &) const;
-
- bool is_local() const;
-
- void accept_client_func();
- void print_status();
-
-private:
- class connection: public std::enable_shared_from_this<connection> {
-
- public:
- typedef std::shared_ptr<connection> ptr;
-
- static ptr create(std::weak_ptr<local_server_endpoint_impl> _server,
- std::uint32_t _max_message_size,
- std::uint32_t _buffer_shrink_threshold,
- boost::asio::io_service &_io_service);
- socket_type & get_socket();
- std::unique_lock<std::mutex> get_socket_lock();
-
- void start();
- void stop();
-
- void send_queued(const queue_iterator_type _queue_iterator);
-
- void set_bound_client(client_t _client);
- std::size_t get_recv_buffer_capacity() const;
-
- private:
- connection(std::weak_ptr<local_server_endpoint_impl> _server,
- std::uint32_t _recv_buffer_size_initial,
- std::uint32_t _max_message_size,
- std::uint32_t _buffer_shrink_threshold,
- boost::asio::io_service &_io_service);
-
- void receive_cbk(boost::system::error_code const &_error,
- std::size_t _bytes);
- void calculate_shrink_count();
- const std::string get_path_local() const;
- const std::string get_path_remote() const;
- void handle_recv_buffer_exception(const std::exception &_e);
-
- std::mutex socket_mutex_;
- local_server_endpoint_impl::socket_type socket_;
- std::weak_ptr<local_server_endpoint_impl> server_;
-
- const std::uint32_t recv_buffer_size_initial_;
- const std::uint32_t max_message_size_;
-
- message_buffer_t recv_buffer_;
- size_t recv_buffer_size_;
- std::uint32_t missing_capacity_;
- std::uint32_t shrink_count_;
- const std::uint32_t buffer_shrink_threshold_;
-
- client_t bound_client_;
-
- };
-
- std::mutex acceptor_mutex_;
-#ifdef _WIN32
- boost::asio::ip::tcp::acceptor acceptor_;
-#else
- boost::asio::local::stream_protocol::acceptor acceptor_;
-#endif
-
- typedef std::map<endpoint_type, connection::ptr> connections_t;
- std::mutex connections_mutex_;
- connections_t connections_;
- const std::uint32_t buffer_shrink_threshold_;
-
-private:
- void remove_connection(connection *_connection);
- void accept_cbk(connection::ptr _connection,
- boost::system::error_code const &_error);
- std::string get_remote_information(
- const queue_iterator_type _queue_iterator) const;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_LOCAL_SERVER_ENDPOINT_IMPL_HPP
diff --git a/implementation/endpoints/include/netlink_connector.hpp b/implementation/endpoints/include/netlink_connector.hpp
deleted file mode 100644
index f71ba88..0000000
--- a/implementation/endpoints/include/netlink_connector.hpp
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (C) 2014-2017 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_NETLINK_CONNECTOR_HPP
-#define VSOMEIP_NETLINK_CONNECTOR_HPP
-
-#ifndef _WIN32
-
-#include <sys/socket.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-
-#include <map>
-#include <mutex>
-
-#include <boost/asio/ip/address.hpp>
-#include <boost/asio/basic_raw_socket.hpp>
-
-#include "../../endpoints/include/buffer.hpp"
-
-namespace vsomeip {
-
-template <typename Protocol>
-class nl_endpoint {
-public:
- /// The protocol type associated with the endpoint.
- typedef Protocol protocol_type;
- typedef boost::asio::detail::socket_addr_type data_type;
-
- /// Default constructor.
- nl_endpoint()
- {
- sockaddr.nl_family = PF_NETLINK;
- sockaddr.nl_groups = 0;
- sockaddr.nl_pid = getpid();
- }
-
- /// Construct an endpoint using the specified path name.
- nl_endpoint(int group, int pid=getpid())
- {
- sockaddr.nl_family = PF_NETLINK;
- sockaddr.nl_groups = group;
- sockaddr.nl_pid = pid;
- }
-
- /// Copy constructor.
- nl_endpoint(const nl_endpoint& other)
- {
- sockaddr = other.sockaddr;
- }
-
- /// Assign from another endpoint.
- nl_endpoint& operator=(const nl_endpoint& other)
- {
- sockaddr = other.sockaddr;
- return *this;
- }
-
- /// The protocol associated with the endpoint.
- protocol_type protocol() const
- {
- return protocol_type();
- }
-
- /// Get the underlying endpoint in the native type.
- data_type* data()
- {
- return &sockaddr;
- }
-
- /// Get the underlying endpoint in the native type.
- const data_type* data() const
- {
- return reinterpret_cast<const struct sockaddr*>(&sockaddr);
- }
-
- /// Get the underlying size of the endpoint in the native type.
- std::size_t size() const
- {
- return sizeof(sockaddr);
- }
-
- /// Set the underlying size of the endpoint in the native type.
- void resize(std::size_t size)
- {
- /* nothing we can do here */
- }
-
- /// Get the capacity of the endpoint in the native type.
- std::size_t capacity() const
- {
- return sizeof(sockaddr);
- }
-
-private:
- sockaddr_nl sockaddr;
-};
-
-class nl_protocol {
-public:
- nl_protocol() {
- proto = 0;
- }
- nl_protocol(int proto) {
- this->proto = proto;
- }
- /// Obtain an identifier for the type of the protocol.
- int type() const
- {
- return SOCK_RAW;
- }
- /// Obtain an identifier for the protocol.
- int protocol() const
- {
- return proto;
- }
- /// Obtain an identifier for the protocol family.
- int family() const
- {
- return PF_NETLINK;
- }
-
- typedef nl_endpoint<nl_protocol> endpoint;
- typedef boost::asio::basic_raw_socket<nl_protocol> socket;
-
-private:
- int proto;
-};
-
-typedef std::function< void (bool, std::string, bool) > net_if_changed_handler_t;
-
-class netlink_connector : public std::enable_shared_from_this<netlink_connector> {
-public:
- netlink_connector(boost::asio::io_service& _io, boost::asio::ip::address _address,
- boost::asio::ip::address _multicast_address):
- net_if_index_for_address_(0),
- handler_(nullptr),
- socket_(_io),
- recv_buffer_(recv_buffer_size, 0),
- address_(_address),
- multicast_address_(_multicast_address) {
- }
- ~netlink_connector() {}
-
- void register_net_if_changes_handler(net_if_changed_handler_t _handler);
- void unregister_net_if_changes_handler();
-
- void start();
- void stop();
-
-private:
- bool has_address(struct ifaddrmsg * ifa_struct,
- size_t length,
- const unsigned int address);
- void send_ifa_request();
- void send_ifi_request();
- void send_rt_request();
-
- void receive_cbk(boost::system::error_code const &_error, std::size_t _bytes);
- void send_cbk(boost::system::error_code const &_error, std::size_t _bytes);
-
- bool check_sd_multicast_route_match(struct rtmsg* _routemsg,
- size_t _length,
- std::string* _routename) const;
-
- std::map<int, unsigned int> net_if_flags_;
- int net_if_index_for_address_;
-
- net_if_changed_handler_t handler_;
-
- std::mutex socket_mutex_;
- boost::asio::basic_raw_socket<nl_protocol> socket_;
-
- const size_t recv_buffer_size = 16384;
- message_buffer_t recv_buffer_;
-
- boost::asio::ip::address address_;
- boost::asio::ip::address multicast_address_;
-};
-
-}
-
-#endif // NOT _WIN32
-
-#endif // VSOMEIP_NETLINK_CONNECTOR_HPP
diff --git a/implementation/endpoints/include/server_endpoint_impl.hpp b/implementation/endpoints/include/server_endpoint_impl.hpp
deleted file mode 100644
index ffc768a..0000000
--- a/implementation/endpoints/include/server_endpoint_impl.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (C) 2014-2017 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_SERVER_IMPL_HPP
-#define VSOMEIP_SERVER_IMPL_HPP
-
-#include <deque>
-#include <map>
-#include <memory>
-#include <mutex>
-#include <set>
-#include <vector>
-
-#include <boost/array.hpp>
-#include <boost/asio/io_service.hpp>
-
-#include "buffer.hpp"
-#include "endpoint_impl.hpp"
-
-namespace vsomeip {
-
-template<typename Protocol>
-class server_endpoint_impl: public endpoint_impl<Protocol>,
- public std::enable_shared_from_this<server_endpoint_impl<Protocol> > {
-public:
- typedef typename Protocol::socket socket_type;
- typedef typename Protocol::endpoint endpoint_type;
- typedef typename std::map<endpoint_type, std::pair<size_t, std::deque<message_buffer_ptr_t>>> queue_type;
- typedef typename queue_type::iterator queue_iterator_type;
-
- server_endpoint_impl(std::shared_ptr<endpoint_host> _host,
- endpoint_type _local, boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- configuration::endpoint_queue_limit_t _queue_limit);
- virtual ~server_endpoint_impl();
-
- bool is_client() const;
- void restart();
- bool is_connected() const;
- void set_connected(bool _connected);
- bool send(const uint8_t *_data, uint32_t _size, bool _flush);
-
- virtual void stop();
- bool flush(endpoint_type _target);
-
-public:
- void connect_cbk(boost::system::error_code const &_error);
- void send_cbk(const queue_iterator_type _queue_iterator,
- boost::system::error_code const &_error, std::size_t _bytes);
- void flush_cbk(endpoint_type _target,
- const boost::system::error_code &_error);
-
-public:
- virtual bool send_intern(endpoint_type _target, const byte_t *_data,
- uint32_t _port, bool _flush);
- virtual void send_queued(const queue_iterator_type _queue_iterator) = 0;
-
- virtual bool get_default_target(service_t _service,
- endpoint_type &_target) const = 0;
-
- virtual void print_status() = 0;
-
-protected:
- std::map<endpoint_type, message_buffer_ptr_t> packetizer_;
- queue_type queues_;
-
- std::mutex clients_mutex_;
- std::map<client_t, std::map<session_t, endpoint_type> > clients_;
- std::map<client_t, endpoint_type> clients_to_endpoint_;
-
- boost::asio::steady_timer flush_timer_;
-
- std::mutex mutex_;
-
-private:
- virtual std::string get_remote_information(
- const queue_iterator_type _queue_iterator) const = 0;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_SERVICE_ENDPOINT_IMPL_HPP
diff --git a/implementation/endpoints/include/tcp_client_endpoint_impl.hpp b/implementation/endpoints/include/tcp_client_endpoint_impl.hpp
deleted file mode 100644
index be6cf24..0000000
--- a/implementation/endpoints/include/tcp_client_endpoint_impl.hpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (C) 2014-2017 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_TCP_CLIENT_ENDPOINT_IMPL_HPP
-#define VSOMEIP_TCP_CLIENT_ENDPOINT_IMPL_HPP
-
-#include <boost/asio/ip/tcp.hpp>
-#include <chrono>
-
-#include <vsomeip/defines.hpp>
-#include "client_endpoint_impl.hpp"
-
-namespace vsomeip {
-
-typedef client_endpoint_impl<
- boost::asio::ip::tcp
- > tcp_client_endpoint_base_impl;
-
-class tcp_client_endpoint_impl: public tcp_client_endpoint_base_impl {
-public:
- tcp_client_endpoint_impl(std::shared_ptr<endpoint_host> _host,
- endpoint_type _local,
- endpoint_type _remote,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- std::uint32_t buffer_shrink_threshold,
- std::chrono::milliseconds _send_timeout,
- configuration::endpoint_queue_limit_t _queue_limit);
- virtual ~tcp_client_endpoint_impl();
-
- void start();
- void restart();
-
- bool get_remote_address(boost::asio::ip::address &_address) const;
- std::uint16_t get_remote_port() const;
- bool is_reliable() const;
- bool is_local() const;
- void print_status();
-
-private:
- void send_queued();
- bool is_magic_cookie(const message_buffer_ptr_t& _recv_buffer,
- size_t _offset) const;
- void send_magic_cookie(message_buffer_ptr_t &_buffer);
-
- void receive_cbk(boost::system::error_code const &_error,
- std::size_t _bytes,
- message_buffer_ptr_t _recv_buffer,
- std::size_t _recv_buffer_size);
-
- void connect();
- void receive();
- void receive(message_buffer_ptr_t _recv_buffer,
- std::size_t _recv_buffer_size,
- std::size_t _missing_capacity);
- void calculate_shrink_count(const message_buffer_ptr_t& _recv_buffer,
- std::size_t _recv_buffer_size);
- const std::string get_address_port_remote() const;
- const std::string get_address_port_local() const;
- void handle_recv_buffer_exception(const std::exception &_e,
- const message_buffer_ptr_t& _recv_buffer,
- std::size_t _recv_buffer_size);
- void set_local_port();
- std::size_t write_completion_condition(
- const boost::system::error_code& _error,
- std::size_t _bytes_transferred, std::size_t _bytes_to_send,
- service_t _service, method_t _method, client_t _client, session_t _session,
- std::chrono::steady_clock::time_point _start);
- std::string get_remote_information() const;
-
- const std::uint32_t recv_buffer_size_initial_;
- message_buffer_ptr_t recv_buffer_;
- std::uint32_t shrink_count_;
- const std::uint32_t buffer_shrink_threshold_;
-
- const boost::asio::ip::address remote_address_;
- const std::uint16_t remote_port_;
- std::chrono::steady_clock::time_point last_cookie_sent_;
- const std::chrono::milliseconds send_timeout_;
- const std::chrono::milliseconds send_timeout_warning_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_TCP_CLIENT_ENDPOINT_IMPL_HPP
diff --git a/implementation/endpoints/include/tcp_server_endpoint_impl.hpp b/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
deleted file mode 100644
index 5e9b50b..0000000
--- a/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright (C) 2014-2017 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_TCP_SERVER_ENDPOINT_IMPL_HPP
-#define VSOMEIP_TCP_SERVER_ENDPOINT_IMPL_HPP
-
-#include <map>
-#include <memory>
-
-#include <boost/asio/ip/tcp.hpp>
-
-#include <vsomeip/defines.hpp>
-#include <vsomeip/export.hpp>
-#include "server_endpoint_impl.hpp"
-
-#include <chrono>
-
-namespace vsomeip {
-
-typedef server_endpoint_impl<
- boost::asio::ip::tcp
- > tcp_server_endpoint_base_impl;
-
-class tcp_server_endpoint_impl: public tcp_server_endpoint_base_impl {
-
-public:
- tcp_server_endpoint_impl(std::shared_ptr<endpoint_host> _host,
- endpoint_type _local,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- std::uint32_t _buffer_shrink_threshold,
- std::chrono::milliseconds _send_timeout,
- configuration::endpoint_queue_limit_t _queue_limit);
- virtual ~tcp_server_endpoint_impl();
-
- void start();
- void stop();
-
- bool send_to(const std::shared_ptr<endpoint_definition> _target,
- const byte_t *_data, uint32_t _size, bool _flush);
- void send_queued(const queue_iterator_type _queue_iterator);
-
- VSOMEIP_EXPORT bool is_established(std::shared_ptr<endpoint_definition> _endpoint);
-
- bool get_default_target(service_t, endpoint_type &) const;
-
- std::uint16_t get_local_port() const;
- bool is_reliable() const;
- bool is_local() const;
-
- client_t get_client(std::shared_ptr<endpoint_definition> _endpoint);
-
- // dummies to implement endpoint_impl interface
- // TODO: think about a better design!
- void receive();
- void print_status();
-private:
- class connection: public std::enable_shared_from_this<connection> {
-
- public:
- typedef std::shared_ptr<connection> ptr;
-
- static ptr create(std::weak_ptr<tcp_server_endpoint_impl> _server,
- std::uint32_t _max_message_size,
- std::uint32_t _buffer_shrink_threshold,
- bool _magic_cookies_enabled,
- boost::asio::io_service & _io_service,
- std::chrono::milliseconds _send_timeout);
- socket_type & get_socket();
- std::unique_lock<std::mutex> get_socket_lock();
-
- void start();
- void stop();
- void receive();
-
- void send_queued(const queue_iterator_type _queue_iterator);
-
- void set_remote_info(const endpoint_type &_remote);
- const std::string get_address_port_remote() const;
- std::size_t get_recv_buffer_capacity() const;
-
- private:
- connection(std::weak_ptr<tcp_server_endpoint_impl> _server,
- std::uint32_t _max_message_size,
- std::uint32_t _recv_buffer_size_initial,
- std::uint32_t _buffer_shrink_threshold,
- bool _magic_cookies_enabled,
- boost::asio::io_service & _io_service,
- std::chrono::milliseconds _send_timeout);
- bool send_magic_cookie(message_buffer_ptr_t &_buffer);
- bool is_magic_cookie(size_t _offset) const;
- void receive_cbk(boost::system::error_code const &_error,
- std::size_t _bytes);
- void calculate_shrink_count();
- const std::string get_address_port_local() const;
- void handle_recv_buffer_exception(const std::exception &_e);
- std::size_t write_completion_condition(
- const boost::system::error_code& _error,
- std::size_t _bytes_transferred, std::size_t _bytes_to_send,
- service_t _service, method_t _method, client_t _client, session_t _session,
- std::chrono::steady_clock::time_point _start);
- void stop_and_remove_connection();
-
- std::mutex socket_mutex_;
- tcp_server_endpoint_impl::socket_type socket_;
- std::weak_ptr<tcp_server_endpoint_impl> server_;
-
- const uint32_t max_message_size_;
- const uint32_t recv_buffer_size_initial_;
-
- message_buffer_t recv_buffer_;
- size_t recv_buffer_size_;
- std::uint32_t missing_capacity_;
- std::uint32_t shrink_count_;
- const std::uint32_t buffer_shrink_threshold_;
-
- endpoint_type remote_;
- boost::asio::ip::address remote_address_;
- std::uint16_t remote_port_;
- std::atomic<bool> magic_cookies_enabled_;
- std::chrono::steady_clock::time_point last_cookie_sent_;
- const std::chrono::milliseconds send_timeout_;
- const std::chrono::milliseconds send_timeout_warning_;
- };
-
- std::mutex acceptor_mutex_;
- boost::asio::ip::tcp::acceptor acceptor_;
- std::mutex connections_mutex_;
- typedef std::map<endpoint_type, connection::ptr> connections_t;
- connections_t connections_;
- const std::uint32_t buffer_shrink_threshold_;
- const std::uint16_t local_port_;
- const std::chrono::milliseconds send_timeout_;
-
-private:
- void remove_connection(connection *_connection);
- void accept_cbk(connection::ptr _connection,
- boost::system::error_code const &_error);
- std::string get_remote_information(
- const queue_iterator_type _queue_iterator) const;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_TCP_SERVER_ENDPOINT_IMPL_HPP
diff --git a/implementation/endpoints/include/udp_client_endpoint_impl.hpp b/implementation/endpoints/include/udp_client_endpoint_impl.hpp
deleted file mode 100644
index 1805813..0000000
--- a/implementation/endpoints/include/udp_client_endpoint_impl.hpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (C) 2014-2017 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_INTERNAL_UDP_CLIENT_IMPL_HPP
-#define VSOMEIP_INTERNAL_UDP_CLIENT_IMPL_HPP
-
-#include <memory>
-
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ip/udp.hpp>
-
-#include <vsomeip/defines.hpp>
-
-#include "client_endpoint_impl.hpp"
-
-namespace vsomeip {
-
-class endpoint_adapter;
-
-typedef client_endpoint_impl<
- boost::asio::ip::udp
- > udp_client_endpoint_base_impl;
-
-class udp_client_endpoint_impl: virtual public udp_client_endpoint_base_impl {
-
-public:
- udp_client_endpoint_impl(std::shared_ptr<endpoint_host> _host,
- endpoint_type _local,
- endpoint_type _remote,
- boost::asio::io_service &_io,
- configuration::endpoint_queue_limit_t _queue_limit);
- virtual ~udp_client_endpoint_impl();
-
- void start();
- void restart();
-
- void receive_cbk(boost::system::error_code const &_error,
- std::size_t _bytes);
-
- bool get_remote_address(boost::asio::ip::address &_address) const;
- std::uint16_t get_remote_port() const;
- bool is_local() const;
- void print_status();
-private:
- void send_queued();
- void connect();
- void receive();
- void set_local_port();
- const std::string get_address_port_remote() const;
- const std::string get_address_port_local() const;
- std::string get_remote_information() const;
-
- message_buffer_t recv_buffer_;
-
- const boost::asio::ip::address remote_address_;
- const std::uint16_t remote_port_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_INTERNAL_UDP_CLIENT_IMPL_HPP
diff --git a/implementation/endpoints/include/udp_server_endpoint_impl.hpp b/implementation/endpoints/include/udp_server_endpoint_impl.hpp
deleted file mode 100644
index 48e4935..0000000
--- a/implementation/endpoints/include/udp_server_endpoint_impl.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (C) 2014-2017 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_INTERNAL_UDP_SERVICE_IMPL_HPP
-#define VSOMEIP_INTERNAL_UDP_SERVICE_IMPL_HPP
-
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ip/udp_ext.hpp>
-
-#include <vsomeip/defines.hpp>
-
-#include "server_endpoint_impl.hpp"
-#include <atomic>
-
-namespace vsomeip {
-
-typedef server_endpoint_impl<
- boost::asio::ip::udp_ext
- > udp_server_endpoint_base_impl;
-
-class udp_server_endpoint_impl: public udp_server_endpoint_base_impl {
-
-public:
- udp_server_endpoint_impl(std::shared_ptr<endpoint_host> _host,
- endpoint_type _local,
- boost::asio::io_service &_io,
- configuration::endpoint_queue_limit_t _queue_limit);
- virtual ~udp_server_endpoint_impl();
-
- void start();
- void stop();
-
- void receive();
-
- bool send_to(const std::shared_ptr<endpoint_definition> _target,
- const byte_t *_data, uint32_t _size, bool _flush);
- void send_queued(const queue_iterator_type _queue_iterator);
-
- void join(const std::string &_address);
- void leave(const std::string &_address);
-
- void add_default_target(service_t _service,
- const std::string &_address, uint16_t _port);
- void remove_default_target(service_t _service);
- bool get_default_target(service_t _service, endpoint_type &_target) const;
-
- std::uint16_t get_local_port() const;
- bool is_local() const;
-
- client_t get_client(std::shared_ptr<endpoint_definition> _endpoint);
-
- void receive_cbk(boost::system::error_code const &_error,
- std::size_t _size,
- boost::asio::ip::address const &_destination);
-
- void print_status();
-
-private:
- void set_broadcast();
- bool is_joined(const std::string &_address) const;
- bool is_joined(const std::string &_address, bool* _received) const;
- std::string get_remote_information(
- const queue_iterator_type _queue_iterator) const;
-
-private:
- socket_type socket_;
- endpoint_type remote_;
-
- mutable std::mutex default_targets_mutex_;
- std::map<service_t, endpoint_type> default_targets_;
- mutable std::mutex joined_mutex_;
- std::map<std::string, bool> joined_;
- std::atomic<bool> joined_group_;
-
- message_buffer_t recv_buffer_;
- std::mutex socket_mutex_;
-
- const std::uint16_t local_port_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_INTERNAL_UDP_SERVICE_IMPL_HPP
diff --git a/implementation/endpoints/include/virtual_server_endpoint_impl.hpp b/implementation/endpoints/include/virtual_server_endpoint_impl.hpp
deleted file mode 100644
index 303f984..0000000
--- a/implementation/endpoints/include/virtual_server_endpoint_impl.hpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (C) 2014-2017 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_VIRTUAL_SERVER_ENDPOINT_IMPL_HPP
-#define VSOMEIP_VIRTUAL_SERVER_ENDPOINT_IMPL_HPP
-
-#include <vsomeip/primitive_types.hpp>
-
-#include "../include/endpoint.hpp"
-
-namespace vsomeip {
-
-class virtual_server_endpoint_impl : public endpoint {
-public:
- virtual_server_endpoint_impl(
- const std::string &_address,
- uint16_t _port,
- bool _reliable);
-
- virtual ~virtual_server_endpoint_impl();
-
- void start();
- void stop();
-
- bool is_connected() const;
- void set_connected(bool _connected);
-
- bool send(const byte_t *_data, uint32_t _size, bool _flush);
- bool send_to(const std::shared_ptr<endpoint_definition> _target,
- const byte_t *_data, uint32_t _size, bool _flush);
- void enable_magic_cookies();
- void receive();
-
- void join(const std::string &_address);
- void leave(const std::string &_address);
-
- void add_default_target(service_t _service,
- const std::string &_address, uint16_t _port);
- void remove_default_target(service_t _service);
-
- bool get_remote_address(boost::asio::ip::address &_address) const;
- std::uint16_t get_local_port() const;
- std::uint16_t get_remote_port() const;
- bool is_reliable() const;
- bool is_local() const;
-
- void increment_use_count();
- void decrement_use_count();
- uint32_t get_use_count();
-
- void restart();
-
- void register_error_handler(error_handler_t _handler);
- void print_status();
-
-private:
- std::string address_;
- uint16_t port_;
- bool reliable_;
-
- uint32_t use_count_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_VIRTUAL_SERVER_ENDPOINT_IMPL_HPP
diff --git a/implementation/endpoints/src/client_endpoint_impl.cpp b/implementation/endpoints/src/client_endpoint_impl.cpp
deleted file mode 100644
index 5599828..0000000
--- a/implementation/endpoints/src/client_endpoint_impl.cpp
+++ /dev/null
@@ -1,435 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <iomanip>
-#include <sstream>
-#include <thread>
-#include <limits>
-
-#include <boost/asio/buffer.hpp>
-#include <boost/asio/ip/tcp.hpp>
-#include <boost/asio/ip/udp.hpp>
-#include <boost/asio/local/stream_protocol.hpp>
-
-#include <vsomeip/defines.hpp>
-
-#include "../include/client_endpoint_impl.hpp"
-#include "../include/endpoint_host.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../utility/include/utility.hpp"
-#include "../../utility/include/byteorder.hpp"
-
-namespace vsomeip {
-
-template<typename Protocol>
-client_endpoint_impl<Protocol>::client_endpoint_impl(
- std::shared_ptr<endpoint_host> _host,
- endpoint_type _local,
- endpoint_type _remote,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- configuration::endpoint_queue_limit_t _queue_limit)
- : endpoint_impl<Protocol>(_host, _local, _io, _max_message_size, _queue_limit),
- socket_(new socket_type(_io)), remote_(_remote),
- flush_timer_(_io), connect_timer_(_io),
- connect_timeout_(VSOMEIP_DEFAULT_CONNECT_TIMEOUT), // TODO: use config variable
- state_(cei_state_e::CLOSED),
- packetizer_(std::make_shared<message_buffer_t>()),
- queue_size_(0),
- was_not_connected_(false),
- local_port_(0) {
-}
-
-template<typename Protocol>
-client_endpoint_impl<Protocol>::~client_endpoint_impl() {
-}
-
-template<typename Protocol>
-bool client_endpoint_impl<Protocol>::is_client() const {
- return true;
-}
-
-template<typename Protocol>
-bool client_endpoint_impl<Protocol>::is_connected() const {
- return state_ == cei_state_e::ESTABLISHED;
-}
-
-template<typename Protocol>
-void client_endpoint_impl<Protocol>::set_connected(bool _connected) {
- if (_connected) {
- state_ = cei_state_e::ESTABLISHED;
- } else {
- state_ = cei_state_e::CLOSED;
- } }
-template<typename Protocol> void client_endpoint_impl<Protocol>::stop() {
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- endpoint_impl<Protocol>::sending_blocked_ = true;
- // delete unsent messages
- queue_.clear();
- queue_size_ = 0;
- }
- {
- std::lock_guard<std::mutex> its_lock(connect_timer_mutex_);
- boost::system::error_code ec;
- connect_timer_.cancel(ec);
- }
- connect_timeout_ = VSOMEIP_DEFAULT_CONNECT_TIMEOUT;
- shutdown_and_close_socket(false);
-}
-
-template<typename Protocol>
-bool client_endpoint_impl<Protocol>::send_to(
- const std::shared_ptr<endpoint_definition> _target, const byte_t *_data,
- uint32_t _size, bool _flush) {
- (void)_target;
- (void)_data;
- (void)_size;
- (void)_flush;
-
- VSOMEIP_ERROR << "Clients endpoints must not be used to "
- << "send to explicitely specified targets";
- return false;
-}
-
-template<typename Protocol>
-bool client_endpoint_impl<Protocol>::send(const uint8_t *_data,
- uint32_t _size, bool _flush) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (endpoint_impl<Protocol>::sending_blocked_) {
- return false;
- }
-#if 0
- std::stringstream msg;
- msg << "cei::send: ";
- 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
-
- if (endpoint_impl<Protocol>::max_message_size_ != MESSAGE_SIZE_UNLIMITED
- && _size > endpoint_impl<Protocol>::max_message_size_) {
- VSOMEIP_ERROR << "cei::send: Dropping to big message (" << std::dec
- << _size << " Bytes). Maximum allowed message size is: "
- << endpoint_impl<Protocol>::max_message_size_ << " Bytes.";
- return false;
- }
-
- const bool queue_size_zero_on_entry(queue_.empty());
- if (packetizer_->size() + _size < packetizer_->size()) {
- VSOMEIP_ERROR << "Overflow in packetizer addition ~> abort sending!";
- return false;
- }
- if (packetizer_->size() + _size > endpoint_impl<Protocol>::max_message_size_
- && !packetizer_->empty()) {
- queue_.push_back(packetizer_);
- queue_size_ += packetizer_->size();
- packetizer_ = std::make_shared<message_buffer_t>();
- }
-
- if (endpoint_impl<Protocol>::queue_limit_ != QUEUE_SIZE_UNLIMITED
- && queue_size_ + _size > endpoint_impl<Protocol>::queue_limit_) {
- service_t its_service(0);
- method_t its_method(0);
- client_t its_client(0);
- session_t its_session(0);
- if (_size >= VSOMEIP_SESSION_POS_MAX) {
- // this will yield wrong IDs for local communication as the commands
- // are prepended to the actual payload
- // it will print:
- // (lowbyte service ID + highbyte methoid)
- // [(Command + lowerbyte sender's client ID).
- // highbyte sender's client ID + lowbyte command size.
- // lowbyte methodid + highbyte vsomeipd 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]);
- }
- VSOMEIP_ERROR << "cei::send: queue size limit (" << std::dec
- << endpoint_impl<Protocol>::queue_limit_
- << ") reached. Dropping message ("
- << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_session << "] "
- << "queue_size: " << std::dec << queue_size_
- << " data size: " << std::dec << _size;
- return false;
- }
- packetizer_->insert(packetizer_->end(), _data, _data + _size);
-
- if (_flush) {
- flush_timer_.cancel();
- queue_.push_back(packetizer_);
- queue_size_ += packetizer_->size();
- packetizer_ = std::make_shared<message_buffer_t>();
- } else {
- flush_timer_.expires_from_now(
- std::chrono::milliseconds(VSOMEIP_DEFAULT_FLUSH_TIMEOUT)); // TODO: use config variable
- flush_timer_.async_wait(
- std::bind(
- &client_endpoint_impl<Protocol>::flush_cbk,
- this->shared_from_this(),
- std::placeholders::_1
- )
- );
- }
-
- if (queue_size_zero_on_entry && !queue_.empty()) { // no writing in progress
- send_queued();
- }
-
- return (true);
-}
-
-template<typename Protocol>
-bool client_endpoint_impl<Protocol>::flush() {
- bool is_successful(true);
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (!packetizer_->empty()) {
- queue_.push_back(packetizer_);
- queue_size_ += packetizer_->size();
- packetizer_ = std::make_shared<message_buffer_t>();
- if (queue_.size() == 1) { // no writing in progress
- send_queued();
- }
- } else {
- is_successful = false;
- }
-
- return is_successful;
-}
-
-template<typename Protocol>
-void client_endpoint_impl<Protocol>::connect_cbk(
- boost::system::error_code const &_error) {
- if (_error == boost::asio::error::operation_aborted) {
- // endpoint was stopped
- shutdown_and_close_socket(false);
- return;
- }
- std::shared_ptr<endpoint_host> its_host = this->host_.lock();
- if (its_host) {
- if (_error && _error != boost::asio::error::already_connected) {
- shutdown_and_close_socket(true);
- start_connect_timer();
- // Double the timeout as long as the maximum allowed is larger
- if (connect_timeout_ < VSOMEIP_MAX_CONNECT_TIMEOUT)
- connect_timeout_ = (connect_timeout_ << 1);
-
- if (state_ != cei_state_e::ESTABLISHED) {
- state_ = cei_state_e::CLOSED;
- its_host->on_disconnect(this->shared_from_this());
- }
- } else {
- {
- std::lock_guard<std::mutex> its_lock(connect_timer_mutex_);
- connect_timer_.cancel();
- }
- connect_timeout_ = VSOMEIP_DEFAULT_CONNECT_TIMEOUT; // TODO: use config variable
- set_local_port();
- if (state_ != cei_state_e::ESTABLISHED) {
- its_host->on_connect(this->shared_from_this());
- }
-
- receive();
-
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (queue_.size() > 0 && was_not_connected_) {
- was_not_connected_ = false;
- send_queued();
- }
- }
- }
- }
-}
-
-template<typename Protocol>
-void client_endpoint_impl<Protocol>::wait_connect_cbk(
- boost::system::error_code const &_error) {
- if (!_error) {
- connect();
- }
-}
-
-template<typename Protocol>
-void client_endpoint_impl<Protocol>::send_cbk(
- boost::system::error_code const &_error, std::size_t _bytes) {
- (void)_bytes;
- if (!_error) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (queue_.size() > 0) {
- queue_size_ -= queue_.front()->size();
- queue_.pop_front();
- send_queued();
- }
- } else if (_error == boost::asio::error::broken_pipe) {
- state_ = cei_state_e::CLOSED;
- bool stopping(false);
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- stopping = endpoint_impl<Protocol>::sending_blocked_;
- if (stopping) {
- queue_.clear();
- queue_size_ = 0;
- } else {
- message_buffer_ptr_t its_buffer;
- if (queue_.size()) {
- its_buffer = queue_.front();
- }
- service_t its_service(0);
- method_t its_method(0);
- client_t its_client(0);
- session_t its_session(0);
- if (its_buffer && its_buffer->size() > VSOMEIP_SESSION_POS_MAX) {
- its_service = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_SERVICE_POS_MIN],
- (*its_buffer)[VSOMEIP_SERVICE_POS_MAX]);
- its_method = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_METHOD_POS_MIN],
- (*its_buffer)[VSOMEIP_METHOD_POS_MAX]);
- its_client = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_CLIENT_POS_MIN],
- (*its_buffer)[VSOMEIP_CLIENT_POS_MAX]);
- its_session = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_SESSION_POS_MIN],
- (*its_buffer)[VSOMEIP_SESSION_POS_MAX]);
- }
- VSOMEIP_WARNING << "cei::send_cbk received error: "
- << _error.message() << " (" << std::dec
- << _error.value() << ") " << get_remote_information()
- << " " << std::dec << queue_.size()
- << " " << std::dec << queue_size_ << " ("
- << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_session << "]";
- }
- }
- if (!stopping) {
- print_status();
- }
- was_not_connected_ = true;
- shutdown_and_close_socket(true);
- connect();
- } else if (_error == boost::asio::error::not_connected
- || _error == boost::asio::error::bad_descriptor) {
- state_ = cei_state_e::CLOSED;
- was_not_connected_ = true;
- shutdown_and_close_socket(true);
- connect();
- } else if (_error == boost::asio::error::operation_aborted) {
- // endpoint was stopped
- shutdown_and_close_socket(false);
- } else {
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- message_buffer_ptr_t its_buffer;
- if (queue_.size()) {
- its_buffer = queue_.front();
- }
- service_t its_service(0);
- method_t its_method(0);
- client_t its_client(0);
- session_t its_session(0);
- if (its_buffer && its_buffer->size() > VSOMEIP_SESSION_POS_MAX) {
- its_service = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_SERVICE_POS_MIN],
- (*its_buffer)[VSOMEIP_SERVICE_POS_MAX]);
- its_method = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_METHOD_POS_MIN],
- (*its_buffer)[VSOMEIP_METHOD_POS_MAX]);
- its_client = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_CLIENT_POS_MIN],
- (*its_buffer)[VSOMEIP_CLIENT_POS_MAX]);
- its_session = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_SESSION_POS_MIN],
- (*its_buffer)[VSOMEIP_SESSION_POS_MAX]);
- }
- VSOMEIP_WARNING << "cei::send_cbk received error: " << _error.message()
- << " (" << std::dec << _error.value() << ") "
- << get_remote_information() << " "
- << " " << std::dec << queue_.size()
- << " " << std::dec << queue_size_ << " ("
- << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_session << "]";
- }
- print_status();
- }
-}
-
-template<typename Protocol>
-void client_endpoint_impl<Protocol>::flush_cbk(
- boost::system::error_code const &_error) {
- if (!_error) {
- (void) flush();
- }
-}
-
-template<typename Protocol>
-void client_endpoint_impl<Protocol>::shutdown_and_close_socket(bool _recreate_socket) {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- shutdown_and_close_socket_unlocked(_recreate_socket);
-}
-
-template<typename Protocol>
-void client_endpoint_impl<Protocol>::shutdown_and_close_socket_unlocked(bool _recreate_socket) {
- local_port_ = 0;
- if (socket_->is_open()) {
- boost::system::error_code its_error;
- socket_->shutdown(Protocol::socket::shutdown_both, its_error);
- socket_->close(its_error);
- }
- if (_recreate_socket) {
- socket_.reset(new socket_type(endpoint_impl<Protocol>::service_));
- }
-}
-
-template<typename Protocol>
-bool client_endpoint_impl<Protocol>::get_remote_address(
- boost::asio::ip::address &_address) const {
- (void)_address;
- return false;
-}
-
-template<typename Protocol>
-std::uint16_t client_endpoint_impl<Protocol>::get_remote_port() const {
- return 0;
-}
-
-template<typename Protocol>
-std::uint16_t client_endpoint_impl<Protocol>::get_local_port() const {
- return local_port_;
-}
-
-template<typename Protocol>
-void client_endpoint_impl<Protocol>::start_connect_timer() {
- std::lock_guard<std::mutex> its_lock(connect_timer_mutex_);
- connect_timer_.expires_from_now(
- std::chrono::milliseconds(connect_timeout_));
- connect_timer_.async_wait(
- std::bind(&client_endpoint_impl<Protocol>::wait_connect_cbk,
- this->shared_from_this(), std::placeholders::_1));
-}
-
-// Instantiate template
-#ifndef _WIN32
-template class client_endpoint_impl<boost::asio::local::stream_protocol>;
-#endif
-template class client_endpoint_impl<boost::asio::ip::tcp>;
-template class client_endpoint_impl<boost::asio::ip::udp>;
-} // namespace vsomeip
-
diff --git a/implementation/endpoints/src/credentials.cpp b/implementation/endpoints/src/credentials.cpp
deleted file mode 100644
index 84f7f08..0000000
--- a/implementation/endpoints/src/credentials.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (C) 2014-2017 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 _WIN32
-
-#include <sys/socket.h>
-
-#include "../include/credentials.hpp"
-
-#include "../../configuration/include/internal.hpp"
-#include "../../logging/include/logger.hpp"
-
-namespace vsomeip {
-
-void credentials::activate_credentials(const int _fd) {
- int optval = 1;
- if (setsockopt(_fd, SOL_SOCKET, SO_PASSCRED, &optval, sizeof(optval)) == -1) {
- VSOMEIP_ERROR << "Activating socket option for receiving credentials failed.";
- }
-}
-
-void credentials::deactivate_credentials(const int _fd) {
- int optval = 0;
- if (setsockopt(_fd, SOL_SOCKET, SO_PASSCRED, &optval, sizeof(optval)) == -1) {
- VSOMEIP_ERROR << "Deactivating socket option for receiving credentials failed.";
- }
-}
-
-client_t credentials::receive_credentials(const int _fd, uid_t& _uid, gid_t& _gid) {
- struct ucred *ucredp;
- struct msghdr msgh;
- struct iovec iov;
- union {
- struct cmsghdr cmh;
- char control[CMSG_SPACE(sizeof(struct ucred))];
- } control_un;
- struct cmsghdr *cmhp;
- // Sender client_id will be received as data
- client_t client = VSOMEIP_ROUTING_CLIENT;
-
- // Set 'control_un' to describe ancillary data that we want to receive
- control_un.cmh.cmsg_len = CMSG_LEN(sizeof(struct ucred));
- control_un.cmh.cmsg_level = SOL_SOCKET;
- control_un.cmh.cmsg_type = SCM_CREDENTIALS;
-
- // Set 'msgh' fields to describe 'control_un'
- msgh.msg_control = control_un.control;
- msgh.msg_controllen = sizeof(control_un.control);
-
- // Set fields of 'msgh' to point to buffer used to receive (real) data read by recvmsg()
- msgh.msg_iov = &iov;
- msgh.msg_iovlen = 1;
- iov.iov_base = &client;
- iov.iov_len = sizeof(client_t);
-
- // We don't need address of peer as we using connect
- msgh.msg_name = NULL;
- msgh.msg_namelen = 0;
-
- // Receive client_id plus ancillary data
- ssize_t nr = recvmsg(_fd, &msgh, 0);
- if (nr == -1) {
- VSOMEIP_ERROR << "Receiving credentials failed. No data.";
- }
-
- cmhp = CMSG_FIRSTHDR(&msgh);
- if (cmhp == NULL || cmhp->cmsg_len != CMSG_LEN(sizeof(struct ucred))
- || cmhp->cmsg_level != SOL_SOCKET || cmhp->cmsg_type != SCM_CREDENTIALS) {
- VSOMEIP_ERROR << "Receiving credentials failed. Invalid data.";
- } else {
- ucredp = (struct ucred *) CMSG_DATA(cmhp);
- _uid = ucredp->uid;
- _gid = ucredp->gid;
- }
-
- return client;
-}
-
-void credentials::send_credentials(const int _fd, client_t _client) {
- struct msghdr msgh;
- struct iovec iov;
-
- // data to send
- msgh.msg_iov = &iov;
- msgh.msg_iovlen = 1;
- iov.iov_base = &_client;
- iov.iov_len = sizeof(client_t);
-
- // destination not needed as we use connect
- msgh.msg_name = NULL;
- msgh.msg_namelen = 0;
-
- // credentials not need to set explicitly
- msgh.msg_control = NULL;
- msgh.msg_controllen = 0;
-
- // send client id with credentials
- ssize_t ns = sendmsg(_fd, &msgh, 0);
- if (ns == -1) {
- VSOMEIP_ERROR << "Sending credentials failed.";
- }
-}
-
-} // namespace vsomeip
-
-#endif
-
diff --git a/implementation/endpoints/src/endpoint_definition.cpp b/implementation/endpoints/src/endpoint_definition.cpp
deleted file mode 100644
index 91808fc..0000000
--- a/implementation/endpoints/src/endpoint_definition.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/constants.hpp>
-
-#include "../include/endpoint_definition.hpp"
-
-namespace vsomeip {
-
-std::map<service_t,
- std::map<instance_t,
- std::map<boost::asio::ip::address,
- std::map<uint16_t,
- std::map<bool,
- std::shared_ptr<endpoint_definition> > > > > > endpoint_definition::definitions_;
-
-std::mutex endpoint_definition::definitions_mutex_;
-
-std::shared_ptr<endpoint_definition>
-endpoint_definition::get(const boost::asio::ip::address &_address,
- uint16_t _port, bool _is_reliable, service_t _service, instance_t _instance) {
- std::lock_guard<std::mutex> its_lock(definitions_mutex_);
- std::shared_ptr<endpoint_definition> its_result;
-
- auto find_service = definitions_.find(_service);
- if( find_service != definitions_.end()) {
- auto find_instance = find_service->second.find(_instance);
- if (find_instance != find_service->second.end()) {
- auto find_address = find_instance->second.find(_address);
- if (find_address != find_instance->second.end()) {
- auto find_port = find_address->second.find(_port);
- if (find_port != find_address->second.end()) {
- auto found_reliable = find_port->second.find(_is_reliable);
- if (found_reliable != find_port->second.end()) {
- its_result = found_reliable->second;
- }
- }
- }
- }
- }
-
- if (!its_result) {
- its_result = std::make_shared<endpoint_definition>(
- _address, _port, _is_reliable);
- definitions_[_service][_instance][_address][_port][_is_reliable] = its_result;
- }
- return its_result;
-}
-
-endpoint_definition::endpoint_definition(
- const boost::asio::ip::address &_address, uint16_t _port,
- bool _is_reliable)
- : address_(_address), port_(_port), remote_port_(_port),
- is_reliable_(_is_reliable) {
-}
-
-const boost::asio::ip::address & endpoint_definition::get_address() const {
- return address_;
-}
-
-uint16_t endpoint_definition::get_port() const {
- return port_;
-}
-
-bool endpoint_definition::is_reliable() const {
- return is_reliable_;
-}
-
-uint16_t endpoint_definition::get_remote_port() const {
- return remote_port_;
-}
-
-void endpoint_definition::set_remote_port(uint16_t _port) {
- remote_port_ = _port;
-}
-
-
-} // namespace vsomeip
diff --git a/implementation/endpoints/src/endpoint_impl.cpp b/implementation/endpoints/src/endpoint_impl.cpp
deleted file mode 100644
index 9cde3e9..0000000
--- a/implementation/endpoints/src/endpoint_impl.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright (C) 2014-2017 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 <boost/asio/ip/tcp.hpp>
-#include <boost/asio/ip/udp.hpp>
-#include <boost/asio/ip/udp_ext.hpp>
-#include <boost/asio/local/stream_protocol.hpp>
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/defines.hpp>
-
-#include "../include/endpoint_host.hpp"
-#include "../include/endpoint_impl.hpp"
-#include "../../logging/include/logger.hpp"
-
-namespace vsomeip {
-
-template<typename Protocol>
-endpoint_impl<Protocol>::endpoint_impl(
- std::shared_ptr<endpoint_host> _host,
- endpoint_type _local,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- configuration::endpoint_queue_limit_t _queue_limit)
- : service_(_io),
- host_(_host),
- is_supporting_magic_cookies_(false),
- has_enabled_magic_cookies_(false),
- max_message_size_(_max_message_size),
- use_count_(0),
- sending_blocked_(false),
- local_(_local),
- queue_limit_(_queue_limit) {
-}
-
-template<typename Protocol>
-endpoint_impl<Protocol>::~endpoint_impl() {
-}
-
-template<typename Protocol>
-void endpoint_impl<Protocol>::enable_magic_cookies() {
- has_enabled_magic_cookies_ = is_supporting_magic_cookies_;
-}
-
-template<typename Protocol>
-uint32_t endpoint_impl<Protocol>::find_magic_cookie(
- byte_t *_buffer, size_t _size) {
- bool is_found(false);
- uint32_t its_offset = 0xFFFFFFFF;
-
- uint8_t its_cookie_identifier, its_cookie_type;
-
- if (is_client()) {
- its_cookie_identifier =
- static_cast<uint8_t>(MAGIC_COOKIE_SERVICE_MESSAGE);
- its_cookie_type =
- static_cast<uint8_t>(MAGIC_COOKIE_SERVICE_MESSAGE_TYPE);
- } else {
- its_cookie_identifier =
- static_cast<uint8_t>(MAGIC_COOKIE_CLIENT_MESSAGE);
- its_cookie_type =
- static_cast<uint8_t>(MAGIC_COOKIE_CLIENT_MESSAGE_TYPE);
- }
-
- do {
- its_offset++; // --> first loop has "its_offset = 0"
- if (_size > its_offset + 16) {
- is_found = (_buffer[its_offset] == 0xFF
- && _buffer[its_offset + 1] == 0xFF
- && _buffer[its_offset + 2] == its_cookie_identifier
- && _buffer[its_offset + 3] == 0x00
- && _buffer[its_offset + 4] == 0x00
- && _buffer[its_offset + 5] == 0x00
- && _buffer[its_offset + 6] == 0x00
- && _buffer[its_offset + 7] == 0x08
- && _buffer[its_offset + 8] == 0xDE
- && _buffer[its_offset + 9] == 0xAD
- && _buffer[its_offset + 10] == 0xBE
- && _buffer[its_offset + 11] == 0xEF
- && _buffer[its_offset + 12] == 0x01
- && _buffer[its_offset + 13] == 0x01
- && _buffer[its_offset + 14] == its_cookie_type
- && _buffer[its_offset + 15] == 0x00);
- } else {
- break;
- }
-
- } while (!is_found);
-
- return (is_found ? its_offset : 0xFFFFFFFF);
-}
-
-template<typename Protocol>
-void endpoint_impl<Protocol>::join(const std::string &) {
-}
-
-template<typename Protocol>
-void endpoint_impl<Protocol>::leave(const std::string &) {
-}
-
-template<typename Protocol>
-void endpoint_impl<Protocol>::add_default_target(
- service_t, const std::string &, uint16_t) {
-}
-
-template<typename Protocol>
-void endpoint_impl<Protocol>::remove_default_target(service_t) {
-}
-
-template<typename Protocol>
-std::uint16_t endpoint_impl<Protocol>::get_local_port() const {
- return 0;
-}
-
-template<typename Protocol>
-bool endpoint_impl<Protocol>::is_reliable() const {
- return false;
-}
-
-template<typename Protocol>
-void endpoint_impl<Protocol>::increment_use_count() {
- use_count_++;
-}
-
-template<typename Protocol>
-void endpoint_impl<Protocol>::decrement_use_count() {
- if (use_count_ > 0)
- use_count_--;
-}
-
-template<typename Protocol>
-uint32_t endpoint_impl<Protocol>::get_use_count() {
- return use_count_;
-}
-
-template<typename Protocol>
-void endpoint_impl<Protocol>::register_error_handler(error_handler_t _error_handler) {
- std::lock_guard<std::mutex> its_lock(error_handler_mutex_);
- this->error_handler_ = _error_handler;
-}
-
-
-// Instantiate template
-#ifndef _WIN32
-template class endpoint_impl<boost::asio::local::stream_protocol>;
-#endif
-template class endpoint_impl<boost::asio::ip::tcp>;
-template class endpoint_impl<boost::asio::ip::udp>;
-template class endpoint_impl<boost::asio::ip::udp_ext>;
-
-} // namespace vsomeip
diff --git a/implementation/endpoints/src/local_client_endpoint_impl.cpp b/implementation/endpoints/src/local_client_endpoint_impl.cpp
deleted file mode 100644
index b84cb0a..0000000
--- a/implementation/endpoints/src/local_client_endpoint_impl.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-// Copyright (C) 2014-2017 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 <iomanip>
-#include <sstream>
-
-#include <boost/asio/write.hpp>
-
-#include <vsomeip/defines.hpp>
-
-#include "../include/endpoint_host.hpp"
-#include "../include/local_client_endpoint_impl.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../include/local_server_endpoint_impl.hpp"
-#include "../../configuration/include/configuration.hpp"
-
-// Credentials
-#ifndef _WIN32
-#include "../include/credentials.hpp"
-#endif
-
-namespace vsomeip {
-
-local_client_endpoint_impl::local_client_endpoint_impl(
- std::shared_ptr< endpoint_host > _host,
- endpoint_type _remote,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- configuration::endpoint_queue_limit_t _queue_limit)
- : local_client_endpoint_base_impl(_host, _remote, _remote, _io,
- _max_message_size, _queue_limit),
- // Using _remote for the local(!) endpoint is ok,
- // because we have no bind for local endpoints!
- recv_buffer_(1,0) {
- is_supporting_magic_cookies_ = false;
-}
-
-local_client_endpoint_impl::~local_client_endpoint_impl() {
-
-}
-
-bool local_client_endpoint_impl::is_local() const {
- return true;
-}
-
-void local_client_endpoint_impl::restart() {
- if (state_ == cei_state_e::CONNECTING) {
- return;
- }
- state_ = cei_state_e::CONNECTING;
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- sending_blocked_ = false;
- queue_.clear();
- queue_size_ = 0;
- }
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- shutdown_and_close_socket_unlocked(true);
- }
- start_connect_timer();
-}
-
-void local_client_endpoint_impl::start() {
- connect();
-}
-
-void local_client_endpoint_impl::stop() {
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- sending_blocked_ = true;
- }
- {
- std::lock_guard<std::mutex> its_lock(connect_timer_mutex_);
- boost::system::error_code ec;
- connect_timer_.cancel(ec);
- }
- connect_timeout_ = VSOMEIP_DEFAULT_CONNECT_TIMEOUT;
-
- bool is_open(false);
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- is_open = socket_->is_open();
- }
- if (is_open) {
- bool send_queue_empty(false);
- std::uint32_t times_slept(0);
-
- while (times_slept <= 50) {
- mutex_.lock();
- send_queue_empty = (queue_.size() == 0);
- mutex_.unlock();
- if (send_queue_empty) {
- break;
- } else {
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- times_slept++;
- }
- }
- }
- shutdown_and_close_socket(false);
-}
-
-void local_client_endpoint_impl::connect() {
- boost::system::error_code its_connect_error;
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- boost::system::error_code its_error;
- socket_->open(remote_.protocol(), its_error);
-
- if (!its_error || its_error == boost::asio::error::already_open) {
- socket_->set_option(boost::asio::socket_base::reuse_address(true), its_error);
- if (its_error) {
- VSOMEIP_WARNING << "local_client_endpoint_impl::connect: "
- << "couldn't enable SO_REUSEADDR: " << its_error.message();
- }
- state_ = cei_state_e::CONNECTING;
- socket_->connect(remote_, its_connect_error);
-
-// Credentials
-#ifndef _WIN32
- if (!its_connect_error) {
- auto its_host = host_.lock();
- if (its_host) {
- if (its_host->get_configuration()->is_security_enabled()) {
- credentials::send_credentials(socket_->native(),
- its_host->get_client());
- }
- }
- } else {
- VSOMEIP_WARNING << "local_client_endpoint::connect: Couldn't "
- << "connect to: " << remote_.path() << " ("
- << its_connect_error.message() << " / " << std::dec
- << its_connect_error.value() << ")";
- }
-#endif
-
- } else {
- VSOMEIP_WARNING << "local_client_endpoint::connect: Error opening socket: "
- << its_error.message();
- return;
- }
- }
- // call connect_cbk asynchronously
- try {
- service_.post(
- std::bind(&client_endpoint_impl::connect_cbk, shared_from_this(),
- its_connect_error));
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << "local_client_endpoint_impl::connect: " << e.what();
- }
-}
-
-void local_client_endpoint_impl::receive() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if (socket_->is_open()) {
- socket_->async_receive(
- boost::asio::buffer(recv_buffer_),
- std::bind(
- &local_client_endpoint_impl::receive_cbk,
- std::dynamic_pointer_cast<
- local_client_endpoint_impl
- >(shared_from_this()),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- }
-}
-
-void local_client_endpoint_impl::send_queued() {
- static byte_t its_start_tag[] = { 0x67, 0x37, 0x6D, 0x07 };
- static byte_t its_end_tag[] = { 0x07, 0x6D, 0x37, 0x67 };
- std::vector<boost::asio::const_buffer> bufs;
-
- message_buffer_ptr_t its_buffer;
- if(queue_.size()) {
- its_buffer = queue_.front();
- } else {
- return;
- }
-
-#if 0
-std::stringstream msg;
-msg << "lce<" << this << ">::sq: ";
-for (std::size_t i = 0; i < its_buffer->size(); i++)
- msg << std::setw(2) << std::setfill('0') << std::hex
- << (int)(*its_buffer)[i] << " ";
-VSOMEIP_INFO << msg.str();
-#endif
-
- bufs.push_back(boost::asio::buffer(its_start_tag));
- bufs.push_back(boost::asio::buffer(*its_buffer));
- bufs.push_back(boost::asio::buffer(its_end_tag));
-
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- boost::asio::async_write(
- *socket_,
- bufs,
- std::bind(
- &client_endpoint_impl::send_cbk,
- std::dynamic_pointer_cast<
- local_client_endpoint_impl
- >(shared_from_this()),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- }
-}
-
-void local_client_endpoint_impl::send_magic_cookie() {
-}
-
-void local_client_endpoint_impl::receive_cbk(
- boost::system::error_code const &_error, std::size_t _bytes) {
- (void)_bytes;
- if (_error) {
- if (_error == boost::asio::error::operation_aborted) {
- // endpoint was stopped
- return;
- } else if (_error == boost::asio::error::connection_reset
- || _error == boost::asio::error::eof
- || _error == boost::asio::error::bad_descriptor) {
- VSOMEIP_TRACE << "local_client_endpoint:"
- " connection_reseted/EOF/bad_descriptor";
- } else if (_error) {
- VSOMEIP_ERROR << "Local endpoint received message ("
- << _error.message() << ")";
- }
- // The error handler is set only if the endpoint is hosted by the
- // routing manager. For the routing manager proxies, the corresponding
- // client endpoint (that connect to the same client) are removed
- // after the proxy has received the routing info.
- error_handler_t handler;
- {
- std::lock_guard<std::mutex> its_lock(error_handler_mutex_);
- handler = error_handler_;
- }
- if (handler)
- handler();
- } else {
- receive();
- }
-}
-
-bool local_client_endpoint_impl::get_remote_address(
- boost::asio::ip::address &_address) const {
- (void)_address;
- return false;
-}
-
-std::uint16_t local_client_endpoint_impl::get_remote_port() const {
- return 0;
-}
-
-void local_client_endpoint_impl::set_local_port() {
- // local_port_ is set to zero in ctor of client_endpoint_impl -> do nothing
-}
-
-void local_client_endpoint_impl::print_status() {
-#ifndef _WIN32
- std::string its_path = remote_.path();
-#else
- std::string its_path("");
-#endif
- std::size_t its_data_size(0);
- std::size_t its_queue_size(0);
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- its_queue_size = queue_.size();
- its_data_size = queue_size_;
- }
-
- VSOMEIP_INFO << "status lce: " << its_path << " queue: "
- << its_queue_size << " data: " << its_data_size;
-}
-
-std::string local_client_endpoint_impl::get_remote_information() const {
-#ifdef _WIN32
- boost::system::error_code ec;
- return remote_.address().to_string(ec) + ":"
- + std::to_string(remote_.port());
-#else
- return remote_.path();
-#endif
-}
-
-} // namespace vsomeip
diff --git a/implementation/endpoints/src/local_server_endpoint_impl.cpp b/implementation/endpoints/src/local_server_endpoint_impl.cpp
deleted file mode 100644
index 6ae9c6c..0000000
--- a/implementation/endpoints/src/local_server_endpoint_impl.cpp
+++ /dev/null
@@ -1,692 +0,0 @@
-// Copyright (C) 2014-2017 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 <deque>
-#include <iomanip>
-#include <sstream>
-
-#include <sys/types.h>
-#include <boost/asio/write.hpp>
-
-#include "../include/endpoint_host.hpp"
-#include "../include/local_server_endpoint_impl.hpp"
-
-#include "../../logging/include/logger.hpp"
-#include "../../utility/include/byteorder.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../configuration/include/configuration.hpp"
-
-// Credentials
-#ifndef _WIN32
-#include "../include/credentials.hpp"
-#endif
-
-namespace vsomeip {
-
-local_server_endpoint_impl::local_server_endpoint_impl(
- std::shared_ptr< endpoint_host > _host,
- endpoint_type _local, boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- std::uint32_t _buffer_shrink_threshold,
- configuration::endpoint_queue_limit_t _queue_limit)
- : local_server_endpoint_base_impl(_host, _local, _io,
- _max_message_size, _queue_limit),
- acceptor_(_io),
- buffer_shrink_threshold_(_buffer_shrink_threshold) {
- is_supporting_magic_cookies_ = false;
-
- boost::system::error_code ec;
- acceptor_.open(_local.protocol(), ec);
- boost::asio::detail::throw_error(ec, "acceptor open");
- acceptor_.set_option(boost::asio::socket_base::reuse_address(true), ec);
- boost::asio::detail::throw_error(ec, "acceptor set_option");
- acceptor_.bind(_local, ec);
- boost::asio::detail::throw_error(ec, "acceptor bind");
- acceptor_.listen(boost::asio::socket_base::max_connections, ec);
- boost::asio::detail::throw_error(ec, "acceptor listen");
-
-#ifndef _WIN32
- if (_host->get_configuration()->is_security_enabled()) {
- credentials::activate_credentials(acceptor_.native());
- }
-#endif
-}
-
-local_server_endpoint_impl::local_server_endpoint_impl(
- std::shared_ptr< endpoint_host > _host,
- endpoint_type _local, boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- int native_socket,
- std::uint32_t _buffer_shrink_threshold,
- configuration::endpoint_queue_limit_t _queue_limit)
- : local_server_endpoint_base_impl(_host, _local, _io,
- _max_message_size, _queue_limit),
- acceptor_(_io),
- buffer_shrink_threshold_(_buffer_shrink_threshold) {
- is_supporting_magic_cookies_ = false;
-
- boost::system::error_code ec;
- acceptor_.assign(_local.protocol(), native_socket, ec);
- boost::asio::detail::throw_error(ec, "acceptor assign native socket");
-
-#ifndef _WIN32
- if (_host->get_configuration()->is_security_enabled()) {
- credentials::activate_credentials(acceptor_.native());
- }
-#endif
-}
-
-local_server_endpoint_impl::~local_server_endpoint_impl() {
-}
-
-bool local_server_endpoint_impl::is_local() const {
- return true;
-}
-
-void local_server_endpoint_impl::start() {
- std::lock_guard<std::mutex> its_lock(acceptor_mutex_);
- if (acceptor_.is_open()) {
- connection::ptr new_connection = connection::create(
- std::dynamic_pointer_cast<local_server_endpoint_impl>(
- shared_from_this()), max_message_size_,
- buffer_shrink_threshold_,
- service_);
-
- {
- std::unique_lock<std::mutex> its_lock(new_connection->get_socket_lock());
- acceptor_.async_accept(
- new_connection->get_socket(),
- std::bind(
- &local_server_endpoint_impl::accept_cbk,
- std::dynamic_pointer_cast<
- local_server_endpoint_impl
- >(shared_from_this()),
- new_connection,
- std::placeholders::_1
- )
- );
- }
- }
-}
-
-void local_server_endpoint_impl::stop() {
- server_endpoint_impl::stop();
- {
- std::lock_guard<std::mutex> its_lock(acceptor_mutex_);
- if (acceptor_.is_open()) {
- boost::system::error_code its_error;
- acceptor_.close(its_error);
- }
- }
- {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- for (const auto &c : connections_) {
- c.second->stop();
- }
- connections_.clear();
- }
-}
-
-bool local_server_endpoint_impl::send_to(
- const std::shared_ptr<endpoint_definition> _target,
- const byte_t *_data, uint32_t _size, bool _flush) {
- (void)_target;
- (void)_data;
- (void)_size;
- (void)_flush;
- return false;
-}
-
-void local_server_endpoint_impl::send_queued(
- const queue_iterator_type _queue_iterator) {
- connection::ptr its_connection;
- {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- auto connection_iterator = connections_.find(_queue_iterator->first);
- if (connection_iterator != connections_.end()) {
- connection_iterator->second->send_queued(_queue_iterator);
- its_connection = connection_iterator->second;
- } else {
- VSOMEIP_INFO << "Didn't find connection: "
-#ifdef _WIN32
- << _queue_iterator->first.address().to_string() << ":" << std::dec
- << static_cast<std::uint16_t>(_queue_iterator->first.port())
-#else
- << _queue_iterator->first.path()
-#endif
- << " dropping outstanding messages (" << std::dec
- << _queue_iterator->second.second.size() << ").";
- queues_.erase(_queue_iterator->first);
- }
- }
- if (its_connection) {
- its_connection->send_queued(_queue_iterator);
- }
-}
-
-void local_server_endpoint_impl::receive() {
- // intentionally left empty
-}
-
-bool local_server_endpoint_impl::get_default_target(
- service_t,
- local_server_endpoint_impl::endpoint_type &) const {
- return false;
-}
-
-void local_server_endpoint_impl::remove_connection(
- local_server_endpoint_impl::connection *_connection) {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- for (auto it = connections_.begin(); it != connections_.end();) {
- if (it->second.get() == _connection) {
- it = connections_.erase(it);
- break;
- } else {
- ++it;
- }
- }
-}
-
-void local_server_endpoint_impl::accept_cbk(
- connection::ptr _connection, boost::system::error_code const &_error) {
-
- if (_error != boost::asio::error::bad_descriptor
- && _error != boost::asio::error::operation_aborted
- && _error != boost::asio::error::no_descriptors) {
- start();
- }
-
- if (!_error) {
-#ifndef _WIN32
- auto its_host = host_.lock();
- if (its_host) {
- if (its_host->get_configuration()->is_security_enabled()) {
- std::unique_lock<std::mutex> its_socket_lock(_connection->get_socket_lock());
- socket_type &new_connection_socket = _connection->get_socket();
- uid_t uid(0);
- gid_t gid(0);
- client_t client = credentials::receive_credentials(
- new_connection_socket.native(), uid, gid);
- if (!its_host->check_credentials(client, uid, gid)) {
- VSOMEIP_WARNING << std::hex << "Client 0x" << its_host->get_client()
- << " received client credentials from client 0x" << client
- << " which violates the security policy : uid/gid="
- << std::dec << uid << "/" << gid;
- boost::system::error_code er;
- new_connection_socket.shutdown(new_connection_socket.shutdown_both, er);
- new_connection_socket.close(er);
- return;
- }
- _connection->set_bound_client(client);
- credentials::deactivate_credentials(new_connection_socket.native());
- }
- }
-#endif
-
- boost::system::error_code its_error;
- endpoint_type remote;
- {
- std::unique_lock<std::mutex> its_socket_lock(_connection->get_socket_lock());
- socket_type &new_connection_socket = _connection->get_socket();
- remote = new_connection_socket.remote_endpoint(its_error);
- }
- if (!its_error) {
- {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- connections_[remote] = _connection;
- }
- _connection->start();
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// class local_service_impl::connection
-///////////////////////////////////////////////////////////////////////////////
-
-local_server_endpoint_impl::connection::connection(
- std::weak_ptr<local_server_endpoint_impl> _server,
- std::uint32_t _max_message_size,
- std::uint32_t _initial_recv_buffer_size,
- std::uint32_t _buffer_shrink_threshold,
- boost::asio::io_service &_io_service)
- : socket_(_io_service),
- server_(_server),
- recv_buffer_size_initial_(_initial_recv_buffer_size + 8),
- max_message_size_(_max_message_size),
- recv_buffer_(recv_buffer_size_initial_, 0),
- recv_buffer_size_(0),
- missing_capacity_(0),
- shrink_count_(0),
- buffer_shrink_threshold_(_buffer_shrink_threshold),
- bound_client_(VSOMEIP_ROUTING_CLIENT) {
-}
-
-local_server_endpoint_impl::connection::ptr
-local_server_endpoint_impl::connection::create(
- std::weak_ptr<local_server_endpoint_impl> _server,
- std::uint32_t _max_message_size,
- std::uint32_t _buffer_shrink_threshold,
- boost::asio::io_service &_io_service) {
- const std::uint32_t its_initial_buffer_size = VSOMEIP_COMMAND_HEADER_SIZE
- + VSOMEIP_MAX_LOCAL_MESSAGE_SIZE
- + static_cast<std::uint32_t>(sizeof(instance_t) + sizeof(bool)
- + sizeof(bool));
- return ptr(new connection(_server, _max_message_size, its_initial_buffer_size,
- _buffer_shrink_threshold, _io_service));
-}
-
-local_server_endpoint_impl::socket_type &
-local_server_endpoint_impl::connection::get_socket() {
- return socket_;
-}
-
-std::unique_lock<std::mutex>
-local_server_endpoint_impl::connection::get_socket_lock() {
- return std::unique_lock<std::mutex>(socket_mutex_);
-}
-
-void local_server_endpoint_impl::connection::start() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if (socket_.is_open()) {
- const std::size_t its_capacity(recv_buffer_.capacity());
- size_t buffer_size = its_capacity - recv_buffer_size_;
- try {
- if (missing_capacity_) {
- if (missing_capacity_ > MESSAGE_SIZE_UNLIMITED) {
- VSOMEIP_ERROR << "Missing receive buffer capacity exceeds allowed maximum!";
- return;
- }
- const std::size_t its_required_capacity(recv_buffer_size_ + missing_capacity_);
- if (its_capacity < its_required_capacity) {
- recv_buffer_.reserve(its_required_capacity);
- recv_buffer_.resize(its_required_capacity, 0x0);
- }
- buffer_size = missing_capacity_;
- missing_capacity_ = 0;
- } else if (buffer_shrink_threshold_
- && shrink_count_ > buffer_shrink_threshold_
- && recv_buffer_size_ == 0) {
- recv_buffer_.resize(recv_buffer_size_initial_, 0x0);
- recv_buffer_.shrink_to_fit();
- buffer_size = recv_buffer_size_initial_;
- shrink_count_ = 0;
- }
- } catch (const std::exception &e) {
- handle_recv_buffer_exception(e);
- // don't start receiving again
- return;
- }
- socket_.async_receive(
- boost::asio::buffer(&recv_buffer_[recv_buffer_size_], buffer_size),
- std::bind(
- &local_server_endpoint_impl::connection::receive_cbk,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- }
-}
-
-void local_server_endpoint_impl::connection::stop() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if (socket_.is_open()) {
- boost::system::error_code its_error;
- socket_.shutdown(socket_.shutdown_both, its_error);
- socket_.close(its_error);
- }
-}
-
-void local_server_endpoint_impl::connection::send_queued(
- const queue_iterator_type _queue_iterator) {
-
- // TODO: We currently do _not_ use the send method of the local server
- // endpoints. If we ever need it, we need to add the "start tag", "data",
- // "end tag" sequence here.
- std::shared_ptr<local_server_endpoint_impl> its_server(server_.lock());
- if (!its_server) {
- VSOMEIP_TRACE << "local_server_endpoint_impl::connection::send_queued "
- " couldn't lock server_";
- return;
- }
-
- message_buffer_ptr_t its_buffer = _queue_iterator->second.second.front();
-#if 0
- std::stringstream msg;
- msg << "lse::sq: ";
- for (std::size_t i = 0; i < its_buffer->size(); i++)
- msg << std::setw(2) << std::setfill('0') << std::hex
- << (int)(*its_buffer)[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- boost::asio::async_write(
- socket_,
- boost::asio::buffer(*its_buffer),
- std::bind(
- &local_server_endpoint_base_impl::send_cbk,
- its_server,
- _queue_iterator,
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- }
-}
-
-void local_server_endpoint_impl::connection::receive_cbk(
- boost::system::error_code const &_error, std::size_t _bytes) {
-
- if (_error == boost::asio::error::operation_aborted) {
- // connection was stopped
- return;
- }
- std::shared_ptr<local_server_endpoint_impl> its_server(server_.lock());
- if (!its_server) {
- VSOMEIP_TRACE << "local_server_endpoint_impl::connection::receive_cbk "
- " couldn't lock server_";
- return;
- }
- std::shared_ptr<endpoint_host> its_host = its_server->host_.lock();
- if (its_host) {
- std::size_t its_start = 0;
- std::size_t its_end = 0;
- std::size_t its_iteration_gap = 0;
- std::uint32_t its_command_size = 0;
-
- if (!_error && 0 < _bytes) {
- #if 0
- std::stringstream msg;
- msg << "lse::c<" << this << ">rcb: ";
- for (std::size_t i = 0; i < _bytes + recv_buffer_size_; i++)
- msg << std::setw(2) << std::setfill('0') << std::hex
- << (int) (recv_buffer_[i]) << " ";
- VSOMEIP_INFO << msg.str();
- #endif
-
- if (recv_buffer_size_ + _bytes < recv_buffer_size_) {
- VSOMEIP_ERROR << "receive buffer overflow in local server endpoint ~> abort!";
- return;
- }
- recv_buffer_size_ += _bytes;
-
- bool message_is_empty(false);
- bool found_message(false);
-
- do {
- found_message = false;
- message_is_empty = false;
-
- its_start = 0 + its_iteration_gap;
- if (its_start + 3 < its_start) {
- VSOMEIP_ERROR << "buffer overflow in local server endpoint ~> abort!";
- return;
- }
- while (its_start + 3 < recv_buffer_size_ + its_iteration_gap &&
- (recv_buffer_[its_start] != 0x67 ||
- recv_buffer_[its_start+1] != 0x37 ||
- recv_buffer_[its_start+2] != 0x6d ||
- recv_buffer_[its_start+3] != 0x07)) {
- its_start++;
- }
-
- if (its_start + 3 == recv_buffer_size_ + its_iteration_gap) {
- message_is_empty = true;
- } else {
- its_start += 4;
- }
-
- if (!message_is_empty) {
- if (its_start + 6 < recv_buffer_size_ + its_iteration_gap) {
- its_command_size = VSOMEIP_BYTES_TO_LONG(
- recv_buffer_[its_start + 6],
- recv_buffer_[its_start + 5],
- recv_buffer_[its_start + 4],
- recv_buffer_[its_start + 3]);
-
- its_end = its_start + 6 + its_command_size;
- } else {
- its_end = its_start;
- }
- if (its_command_size && max_message_size_ != MESSAGE_SIZE_UNLIMITED
- && its_command_size > max_message_size_) {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- VSOMEIP_ERROR << "Received a local message which exceeds "
- << "maximum message size (" << std::dec << its_command_size
- << ") aborting! local: " << get_path_local() << " remote: "
- << get_path_remote();
- recv_buffer_.resize(recv_buffer_size_initial_, 0x0);
- recv_buffer_.shrink_to_fit();
- return;
- }
- if (its_end + 3 < its_end) {
- VSOMEIP_ERROR << "buffer overflow in local server endpoint ~> abort!";
- return;
- }
- while (its_end + 3 < recv_buffer_size_ + its_iteration_gap &&
- (recv_buffer_[its_end] != 0x07 ||
- recv_buffer_[its_end+1] != 0x6d ||
- recv_buffer_[its_end+2] != 0x37 ||
- recv_buffer_[its_end+3] != 0x67)) {
- its_end ++;
- }
- if (its_end + 4 < its_end) {
- VSOMEIP_ERROR << "buffer overflow in local server endpoint ~> abort!";
- return;
- }
- // check if we received a full message
- if (recv_buffer_size_ + its_iteration_gap < its_end + 4
- || recv_buffer_[its_end] != 0x07
- || recv_buffer_[its_end+1] != 0x6d
- || recv_buffer_[its_end+2] != 0x37
- || recv_buffer_[its_end+3] != 0x67) {
- // start tag (4 Byte) + command (1 Byte) + client id (2 Byte)
- // + command size (4 Byte) + data itself + stop tag (4 byte)
- // = 15 Bytes not covered in command size.
- if (its_command_size && its_command_size + 15 > recv_buffer_size_) {
- missing_capacity_ = its_command_size + 15 - std::uint32_t(recv_buffer_size_);
- } else if (recv_buffer_size_ < 11) {
- // to little data to read out the command size
- // minimal amount of data needed to read out command size = 11
- missing_capacity_ = 11 - static_cast<std::uint32_t>(recv_buffer_size_);
- } else {
- VSOMEIP_ERROR << "lse::c<" << this
- << ">rcb: recv_buffer_size is: " << std::dec
- << recv_buffer_size_ << " but couldn't read "
- "out command size. recv_buffer_capacity: "
- << recv_buffer_.capacity()
- << " its_iteration_gap: " << its_iteration_gap;
- }
- }
- }
-
- if (!message_is_empty &&
- its_end + 3 < recv_buffer_size_ + its_iteration_gap) {
- its_host->on_message(&recv_buffer_[its_start],
- uint32_t(its_end - its_start), its_server.get(),
- boost::asio::ip::address(), bound_client_);
-
- #if 0
- std::stringstream local_msg;
- local_msg << "lse::c<" << this << ">rcb::thunk: ";
- for (std::size_t i = its_start; i < its_end; i++)
- local_msg << std::setw(2) << std::setfill('0') << std::hex
- << (int) recv_buffer_[i] << " ";
- VSOMEIP_INFO << local_msg.str();
- #endif
- calculate_shrink_count();
- recv_buffer_size_ -= (its_end + 4 - its_iteration_gap);
- missing_capacity_ = 0;
- its_command_size = 0;
- found_message = true;
- its_iteration_gap = its_end + 4;
- } else {
- if (!message_is_empty && its_iteration_gap) {
- // Message not complete and not in front of the buffer!
- // Copy last part to front for consume in future receive_cbk call!
- for (size_t i = 0; i < recv_buffer_size_; ++i) {
- recv_buffer_[i] = recv_buffer_[i + its_iteration_gap];
- }
- // Still more capacity needed after shifting everything to front?
- if (missing_capacity_ &&
- missing_capacity_ <= recv_buffer_.capacity() - recv_buffer_size_) {
- missing_capacity_ = 0;
- }
- }
- }
- } while (recv_buffer_size_ > 0 && found_message);
- }
-
- if (_error == boost::asio::error::eof
- || _error == boost::asio::error::connection_reset) {
- stop();
- its_server->remove_connection(this);
- } else if (_error != boost::asio::error::bad_descriptor) {
- start();
- }
- }
-}
-
-void local_server_endpoint_impl::connection::set_bound_client(client_t _client) {
- bound_client_ = _client;
-}
-
-void local_server_endpoint_impl::connection::calculate_shrink_count() {
- if (buffer_shrink_threshold_) {
- if (recv_buffer_.capacity() != recv_buffer_size_initial_) {
- if (recv_buffer_size_ < (recv_buffer_.capacity() >> 1)) {
- shrink_count_++;
- } else {
- shrink_count_ = 0;
- }
- }
- }
-}
-
-const std::string local_server_endpoint_impl::connection::get_path_local() const {
- boost::system::error_code ec;
- std::string its_local_path;
- if (socket_.is_open()) {
- endpoint_type its_local_endpoint = socket_.local_endpoint(ec);
- if (!ec) {
-#ifdef _WIN32
- its_local_path += its_local_endpoint.address().to_string(ec);
- its_local_path += ":";
- its_local_path += std::to_string(its_local_endpoint.port());
-#else
- its_local_path += its_local_endpoint.path();
-#endif
-
- }
- }
- return its_local_path;
-}
-
-const std::string local_server_endpoint_impl::connection::get_path_remote() const {
- boost::system::error_code ec;
- std::string its_remote_path;
- if (socket_.is_open()) {
- endpoint_type its_remote_endpoint = socket_.remote_endpoint(ec);
- if (!ec) {
-#ifdef _WIN32
- its_remote_path += its_remote_endpoint.address().to_string(ec);
- its_remote_path += ":";
- its_remote_path += std::to_string(its_remote_endpoint.port());
-#else
- its_remote_path += its_remote_endpoint.path();
-#endif
- }
- }
- return its_remote_path;
-}
-
-void local_server_endpoint_impl::connection::handle_recv_buffer_exception(
- const std::exception &_e) {
- std::stringstream its_message;
- its_message <<"local_server_endpoint_impl::connection catched exception"
- << _e.what() << " local: " << get_path_local() << " remote: "
- << get_path_remote() << " shutting down connection. Start of buffer: ";
-
- for (std::size_t i = 0; i < recv_buffer_size_ && i < 16; i++) {
- its_message << std::setw(2) << std::setfill('0') << std::hex
- << (int) (recv_buffer_[i]) << " ";
- }
-
- its_message << " Last 16 Bytes captured: ";
- for (int i = 15; recv_buffer_size_ > 15 && i >= 0; i--) {
- its_message << std::setw(2) << std::setfill('0') << std::hex
- << (int) (recv_buffer_[i]) << " ";
- }
- VSOMEIP_ERROR << its_message.str();
- recv_buffer_.clear();
- if (socket_.is_open()) {
- boost::system::error_code its_error;
- socket_.shutdown(socket_.shutdown_both, its_error);
- socket_.close(its_error);
- }
- std::shared_ptr<local_server_endpoint_impl> its_server = server_.lock();
- if (its_server) {
- its_server->remove_connection(this);
- }
-}
-
-std::size_t
-local_server_endpoint_impl::connection::get_recv_buffer_capacity() const {
- return recv_buffer_.capacity();
-}
-
-void local_server_endpoint_impl::print_status() {
- std::lock_guard<std::mutex> its_lock(mutex_);
- connections_t its_connections;
- {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- its_connections = connections_;
- }
-#ifndef _WIN32
- std::string its_local_path(local_.path());
-#else
- std::string its_local_path("");
-#endif
- VSOMEIP_INFO << "status lse: " << its_local_path << " connections: "
- << std::dec << its_connections.size() << " queues: "
- << std::dec << queues_.size();
- for (const auto &c : its_connections) {
-#ifndef _WIN32
- std::string its_remote_path(c.first.path());
-#else
- std::string its_remote_path("");
-#endif
- std::size_t its_data_size(0);
- std::size_t its_queue_size(0);
- std::size_t its_recv_size(0);
- {
- std::unique_lock<std::mutex> c_s_lock(c.second->get_socket_lock());
- its_recv_size = c.second->get_recv_buffer_capacity();
- }
- auto found_queue = queues_.find(c.first);
- if (found_queue != queues_.end()) {
- its_queue_size = found_queue->second.second.size();
- its_data_size = found_queue->second.first;
- }
- VSOMEIP_INFO << "status lse: client: " << its_remote_path
- << " queue: " << std::dec << its_queue_size
- << " data: " << std::dec << its_data_size
- << " recv_buffer: " << std::dec << its_recv_size;
- }
-}
-std::string local_server_endpoint_impl::get_remote_information(
- const queue_iterator_type _queue_iterator) const {
-#ifdef _WIN32
- boost::system::error_code ec;
- return _queue_iterator->first.address().to_string(ec) + ":"
- + std::to_string(_queue_iterator->first.port());
-#else
- return _queue_iterator->first.path();
-#endif
-}
-
-} // namespace vsomeip
diff --git a/implementation/endpoints/src/netlink_connector.cpp b/implementation/endpoints/src/netlink_connector.cpp
deleted file mode 100644
index 94b75cf..0000000
--- a/implementation/endpoints/src/netlink_connector.cpp
+++ /dev/null
@@ -1,438 +0,0 @@
-// Copyright (C) 2014-2017 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 _WIN32
-
-#include <thread>
-
-#include <boost/asio/write.hpp>
-#include <boost/asio/read.hpp>
-#include<sstream>
-
-#include "../include/netlink_connector.hpp"
-#include "../../logging/include/logger.hpp"
-
-namespace vsomeip {
-
-void netlink_connector::register_net_if_changes_handler(net_if_changed_handler_t _handler) {
- handler_ = _handler;
-}
-
-void netlink_connector::unregister_net_if_changes_handler() {
- handler_ = nullptr;
-}
-
-void netlink_connector::stop() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- boost::system::error_code its_error;
- socket_.shutdown(socket_.shutdown_both, its_error);
- socket_.close(its_error);
- if (its_error) {
- VSOMEIP_WARNING << "Error closing NETLINK socket!";
- }
-}
-
-void netlink_connector::start() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- boost::system::error_code ec;
- if (socket_.is_open()) {
- socket_.close(ec);
- if (ec) {
- VSOMEIP_WARNING << "Error closing NETLINK socket: " << ec.message();
- }
- }
- socket_.open(nl_protocol(NETLINK_ROUTE), ec);
- if (ec) {
- VSOMEIP_WARNING << "Error opening NETLINK socket: " << ec.message();
- if (handler_) {
- handler_(true, "n/a", true);
- handler_(false, "n/a", true);
- }
- return;
- }
- if (socket_.is_open()) {
- socket_.bind(nl_endpoint<nl_protocol>(
- RTMGRP_LINK |
- RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR |
- RTMGRP_IPV4_ROUTE | RTMGRP_IPV6_ROUTE |
- RTMGRP_IPV4_MROUTE | RTMGRP_IPV6_MROUTE), ec);
-
- if (ec) {
- VSOMEIP_WARNING << "Error binding NETLINK socket: " << ec.message();
- if (handler_) {
- handler_(true, "n/a", true);
- handler_(false, "n/a", true);
- }
- return;
- }
-
- send_ifa_request();
-
- socket_.async_receive(
- boost::asio::buffer(&recv_buffer_[0], recv_buffer_size),
- std::bind(
- &netlink_connector::receive_cbk,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- } else {
- VSOMEIP_WARNING << "Error opening NETLINK socket!";
- if (handler_) {
- handler_(true, "n/a", true);
- handler_(false, "n/a", true);
- }
- }
-}
-
-void netlink_connector::receive_cbk(boost::system::error_code const &_error,
- std::size_t _bytes) {
- if (!_error) {
- size_t len = _bytes;
-
- unsigned int address(0);
- if (address_.is_v4()) {
- inet_pton(AF_INET, address_.to_string().c_str(), &address);
- } else {
- inet_pton(AF_INET6, address_.to_string().c_str(), &address);
- }
-
- struct nlmsghdr *nlh = (struct nlmsghdr *)&recv_buffer_[0];
-
- while ((NLMSG_OK(nlh, len)) && (nlh->nlmsg_type != NLMSG_DONE)) {
- char ifname[1024];
- switch (nlh->nlmsg_type) {
- case RTM_NEWADDR: {
- // New Address information
- struct ifaddrmsg *ifa = (ifaddrmsg *)NLMSG_DATA(nlh);
- if (has_address(ifa, IFA_PAYLOAD(nlh), address)) {
- net_if_index_for_address_ = ifa->ifa_index;
- auto its_if = net_if_flags_.find(ifa->ifa_index);
- if (its_if != net_if_flags_.end()) {
- if ((its_if->second & IFF_UP) &&
- (its_if->second & IFF_RUNNING)) {
- if (handler_) {
- if_indextoname(ifa->ifa_index,ifname);
- handler_(true, ifname, true);
- send_rt_request();
- }
- } else {
- if (handler_) {
- if_indextoname(ifa->ifa_index,ifname);
- handler_(true, ifname, false);
- }
- }
- } else {
- // Request interface information
- // as we don't know about up/running state!
- send_ifi_request();
- }
- }
- break;
- }
- case RTM_NEWLINK: {
- // New Interface information
- struct ifinfomsg *ifi = (ifinfomsg *)NLMSG_DATA(nlh);
- net_if_flags_[ifi->ifi_index] = ifi->ifi_flags;
- if (net_if_index_for_address_ == ifi->ifi_index) {
- if ((ifi->ifi_flags & IFF_UP) &&
- (ifi->ifi_flags & IFF_RUNNING)) {
- if (handler_) {
- if_indextoname(ifi->ifi_index,ifname);
- handler_(true, ifname, true);
- send_rt_request();
- }
- } else {
- if (handler_) {
- if_indextoname(ifi->ifi_index,ifname);
- handler_(true, ifname, false);
- }
- }
- }
- break;
- }
- case RTM_NEWROUTE: {
- struct rtmsg *routemsg = (rtmsg *)NLMSG_DATA(nlh);
- std::string its_route_name;
- if (check_sd_multicast_route_match(routemsg, RTM_PAYLOAD(nlh),
- &its_route_name)) {
- if (handler_) {
- handler_(false, its_route_name, true);
- }
- }
- break;
- }
- case RTM_DELROUTE: {
- struct rtmsg *routemsg = (rtmsg *)NLMSG_DATA(nlh);
- std::string its_route_name;
- if (check_sd_multicast_route_match(routemsg, RTM_PAYLOAD(nlh),
- &its_route_name)) {
- if (handler_) {
- handler_(false, its_route_name, false);
- }
- }
- break;
- }
- case NLMSG_ERROR: {
- struct nlmsgerr *errmsg = (nlmsgerr *)NLMSG_DATA(nlh);
- VSOMEIP_ERROR << "netlink_connector::receive_cbk received "
- "error message: " << std::dec << nlh->nlmsg_type
- << " seq " << errmsg->msg.nlmsg_seq;
- break;
- }
- case NLMSG_DONE:
- case NLMSG_NOOP:
- default:
- break;
- }
- nlh = NLMSG_NEXT(nlh, len);
- }
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if (socket_.is_open()) {
- socket_.async_receive(
- boost::asio::buffer(&recv_buffer_[0], recv_buffer_size),
- std::bind(
- &netlink_connector::receive_cbk,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- }
- }
- } else {
- if (_error != boost::asio::error::operation_aborted) {
- VSOMEIP_WARNING << "Error receive_cbk NETLINK socket!" << _error.message();
- boost::system::error_code its_error;
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if (socket_.is_open()) {
- socket_.shutdown(socket_.shutdown_both, its_error);
- socket_.close(its_error);
- if (its_error) {
- VSOMEIP_WARNING << "Error closing NETLINK socket!"
- << its_error.message();
- }
- }
- }
- if (handler_) {
- handler_(true, "n/a", true);
- handler_(false, "n/a", true);
- }
- }
- }
-}
-
-void netlink_connector::send_cbk(boost::system::error_code const &_error, std::size_t _bytes) {
- (void)_bytes;
- if (_error) {
- VSOMEIP_WARNING << "Netlink send error : " << _error.message();
- if (handler_) {
- handler_(true, "n/a", true);
- handler_(false, "n/a", true);
- }
- }
-}
-
-void netlink_connector::send_ifa_request() {
- typedef struct {
- struct nlmsghdr nlhdr;
- struct ifaddrmsg addrmsg;
- } netlink_address_msg;
- netlink_address_msg get_address_msg;
- memset(&get_address_msg, 0, sizeof(get_address_msg));
- get_address_msg.nlhdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg));
- get_address_msg.nlhdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT;
- get_address_msg.nlhdr.nlmsg_type = RTM_GETADDR;
- get_address_msg.nlhdr.nlmsg_seq = 1;
- if (address_.is_v4()) {
- get_address_msg.addrmsg.ifa_family = AF_INET;
- } else {
- get_address_msg.addrmsg.ifa_family = AF_INET6;
- }
-
- socket_.async_send(
- boost::asio::buffer(&get_address_msg, get_address_msg.nlhdr.nlmsg_len),
- std::bind(
- &netlink_connector::send_cbk,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
-}
-
-void netlink_connector::send_ifi_request() {
- typedef struct {
- struct nlmsghdr nlhdr;
- struct ifinfomsg infomsg;
- } netlink_link_msg;
- netlink_link_msg get_link_msg;
- memset(&get_link_msg, 0, sizeof(get_link_msg));
- get_link_msg.nlhdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
- get_link_msg.nlhdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT;
- get_link_msg.nlhdr.nlmsg_type = RTM_GETLINK;
- get_link_msg.infomsg.ifi_family = AF_UNSPEC;
- get_link_msg.nlhdr.nlmsg_seq = 2;
-
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- socket_.async_send(
- boost::asio::buffer(&get_link_msg, get_link_msg.nlhdr.nlmsg_len),
- std::bind(
- &netlink_connector::send_cbk,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- }
-}
-
-void netlink_connector::send_rt_request() {
- typedef struct {
- struct nlmsghdr nlhdr;
- struct rtgenmsg routemsg;
- } netlink_route_msg;
-
- netlink_route_msg get_route_msg;
- memset(&get_route_msg, 0, sizeof(get_route_msg));
- get_route_msg.nlhdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
- get_route_msg.nlhdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
- get_route_msg.nlhdr.nlmsg_type = RTM_GETROUTE;
- get_route_msg.nlhdr.nlmsg_seq = 3;
- if (multicast_address_.is_v6()) {
- get_route_msg.routemsg.rtgen_family = AF_INET6;
- } else {
- get_route_msg.routemsg.rtgen_family = AF_INET;
- }
-
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- socket_.async_send(
- boost::asio::buffer(&get_route_msg, get_route_msg.nlhdr.nlmsg_len),
- std::bind(
- &netlink_connector::send_cbk,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- }
-}
-
-bool netlink_connector::has_address(struct ifaddrmsg * ifa_struct,
- size_t length,
- const unsigned int address) {
-
- struct rtattr *retrta;
- retrta = static_cast<struct rtattr *>(IFA_RTA(ifa_struct));
- while RTA_OK(retrta, length) {
- if (retrta->rta_type == IFA_ADDRESS) {
- char pradd[128];
- unsigned int * tmp_address = (unsigned int *)RTA_DATA(retrta);
- if (address_.is_v4()) {
- inet_ntop(AF_INET, tmp_address, pradd, sizeof(pradd));
- } else {
- inet_ntop(AF_INET6, tmp_address, pradd, sizeof(pradd));
- }
- if (address == *tmp_address) {
- return true;
- }
- }
- retrta = RTA_NEXT(retrta, length);
- }
-
- return false;
-}
-
-bool netlink_connector::check_sd_multicast_route_match(struct rtmsg* _routemsg,
- size_t _length,
- std::string* _routename) const {
- struct rtattr *retrta;
- retrta = static_cast<struct rtattr *>(RTM_RTA(_routemsg));
- int if_index(0);
- char if_name[1024] = "n/a";
- char address[INET6_ADDRSTRLEN] = "n/a";
- char gateway[INET6_ADDRSTRLEN] = "n/a";
- bool matches_sd_multicast(false);
- while (RTA_OK(retrta, _length)) {
- if (retrta->rta_type == RTA_DST) {
- // check if added/removed route matches on configured SD multicast address
- size_t rtattr_length = RTA_PAYLOAD(retrta);
- if (rtattr_length == 4 && multicast_address_.is_v4()) { // IPv4 route
- inet_ntop(AF_INET, RTA_DATA(retrta), address, sizeof(address));
- std::uint32_t netmask(0);
- for (int i = 31; i > 31 - _routemsg->rtm_dst_len; i--) {
- netmask |= (1 << i);
- }
- const std::uint32_t dst_addr = ntohl(*((std::uint32_t *)RTA_DATA(retrta)));
- const std::uint32_t dst_net = (dst_addr & netmask);
- const std::uint32_t sd_addr = static_cast<std::uint32_t>(multicast_address_.to_v4().to_ulong());
- const std::uint32_t sd_net = (sd_addr & netmask);
- matches_sd_multicast = !(dst_net ^ sd_net);
- } else if (rtattr_length == 16 && multicast_address_.is_v6()) { // IPv6 route
- inet_ntop(AF_INET6, RTA_DATA(retrta), address, sizeof(address));
- std::uint32_t netmask2[4] = {0,0,0,0};
- for (int i = 127; i > 127 - _routemsg->rtm_dst_len; i--) {
- if (i > 95) {
- netmask2[0] |= (1 << (i-96));
- } else if (i > 63) {
- netmask2[1] |= (1 << (i-63));
- } else if (i > 31) {
- netmask2[2] |= (1 << (i-32));
- } else {
- netmask2[3] |= (1 << i);
- }
- }
-
- for (int i = 0; i < 4; i++) {
- const std::uint32_t dst = ntohl((*(struct in6_addr*)RTA_DATA(retrta)).__in6_u.__u6_addr32[i]);
- const std::uint32_t sd = ntohl(reinterpret_cast<std::uint32_t*>(multicast_address_.to_v6().to_bytes().data())[i]);
- const std::uint32_t dst_net = dst & netmask2[i];
- const std::uint32_t sd_net = sd & netmask2[i];
- matches_sd_multicast = !(dst_net ^ sd_net);
- if (!matches_sd_multicast) {
- break;
- }
- }
- }
- } else if (retrta->rta_type == RTA_OIF) {
- if_index = *(int *)(RTA_DATA(retrta));
- if_indextoname(if_index,if_name);
- } else if (retrta->rta_type == RTA_GATEWAY) {
- size_t rtattr_length = RTA_PAYLOAD(retrta);
- if (rtattr_length == 4) {
- inet_ntop(AF_INET, RTA_DATA(retrta), gateway, sizeof(gateway));
- } else if (rtattr_length == 16) {
- inet_ntop(AF_INET6, RTA_DATA(retrta), gateway, sizeof(gateway));
- }
- }
- retrta = RTA_NEXT(retrta, _length);
- }
- if (matches_sd_multicast && net_if_index_for_address_ == if_index) {
- std::stringstream stream;
- stream << address << "/" << (static_cast<uint32_t>(_routemsg->rtm_dst_len))
- << " if: " << if_name << " gw: " << gateway;
- *_routename = stream.str();
- return true;
- } else if (if_index > 0 && net_if_index_for_address_ == if_index &&
- _routemsg->rtm_dst_len == 0) {
- // the default route is set to the interface on which the SD will listen
- // therefore no explicit multicast route is required.
- std::stringstream stream;
- stream << "default route (0.0.0.0/0) if: " << if_name << " gw: " << gateway;
- *_routename = stream.str();
- return true;
- }
- return false;
-}
-
-} // namespace vsomeip
-
-#endif
-
diff --git a/implementation/endpoints/src/server_endpoint_impl.cpp b/implementation/endpoints/src/server_endpoint_impl.cpp
deleted file mode 100644
index 83e3e34..0000000
--- a/implementation/endpoints/src/server_endpoint_impl.cpp
+++ /dev/null
@@ -1,310 +0,0 @@
-// Copyright (C) 2014-2017 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 <iomanip>
-#include <sstream>
-#include <limits>
-
-#include <boost/asio/buffer.hpp>
-#include <boost/asio/ip/tcp.hpp>
-#include <boost/asio/ip/udp_ext.hpp>
-#include <boost/asio/local/stream_protocol.hpp>
-
-#include <vsomeip/defines.hpp>
-
-#include "../include/server_endpoint_impl.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../utility/include/byteorder.hpp"
-#include "../../utility/include/utility.hpp"
-
-namespace vsomeip {
-
-template<typename Protocol>
-server_endpoint_impl<Protocol>::server_endpoint_impl(
- std::shared_ptr<endpoint_host> _host, endpoint_type _local,
- boost::asio::io_service &_io, std::uint32_t _max_message_size,
- configuration::endpoint_queue_limit_t _queue_limit)
- : endpoint_impl<Protocol>(_host, _local, _io, _max_message_size,
- _queue_limit),
- flush_timer_(_io) {
-}
-
-template<typename Protocol>
-server_endpoint_impl<Protocol>::~server_endpoint_impl() {
-}
-
-template<typename Protocol>
-void server_endpoint_impl<Protocol>::stop() {
- std::lock_guard<std::mutex> its_lock(mutex_);
- endpoint_impl<Protocol>::sending_blocked_ = true;
-}
-
-template<typename Protocol>
-bool server_endpoint_impl<Protocol>::is_client() const {
- return false;
-}
-
-template<typename Protocol>
-void server_endpoint_impl<Protocol>::restart() {
- // intentionally left blank
-}
-
-template<typename Protocol>
-bool server_endpoint_impl<Protocol>::is_connected() const {
- return true;
-}
-
-template<typename Protocol>
-void server_endpoint_impl<Protocol>::set_connected(bool _connected) { (void) _connected; }
-template<typename Protocol> bool server_endpoint_impl<Protocol>::send(const uint8_t *_data,
- uint32_t _size, bool _flush) {
-#if 0
- std::stringstream msg;
- msg << "sei::send ";
- for (uint32_t i = 0; i < _size; i++)
- msg << std::setw(2) << std::setfill('0') << (int)_data[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- endpoint_type its_target;
- bool is_valid_target(false);
-
- if (VSOMEIP_SESSION_POS_MAX < _size) {
- std::lock_guard<std::mutex> its_lock(mutex_);
-
- if(endpoint_impl<Protocol>::sending_blocked_) {
- return false;
- }
-
- service_t its_service;
- std::memcpy(&its_service, &_data[VSOMEIP_SERVICE_POS_MIN],
- sizeof(service_t));
-
- client_t its_client;
- std::memcpy(&its_client, &_data[VSOMEIP_CLIENT_POS_MIN],
- sizeof(client_t));
- session_t its_session;
- std::memcpy(&its_session, &_data[VSOMEIP_SESSION_POS_MIN],
- sizeof(session_t));
-
- clients_mutex_.lock();
- auto found_client = clients_.find(its_client);
- if (found_client != clients_.end()) {
- auto found_session = found_client->second.find(its_session);
- if (found_session != found_client->second.end()) {
- its_target = found_session->second;
- is_valid_target = true;
- found_client->second.erase(its_session);
- } else {
- VSOMEIP_WARNING << "server_endpoint::send: session_id 0x"
- << std::hex << its_session
- << " not found for client 0x" << its_client;
- }
- } else {
- is_valid_target = get_default_target(its_service, its_target);
- }
- clients_mutex_.unlock();
-
- if (is_valid_target) {
- is_valid_target = send_intern(its_target, _data, _size, _flush);
- }
- }
- return is_valid_target;
-}
-
-template<typename Protocol>
-bool server_endpoint_impl<Protocol>::send_intern(
- endpoint_type _target, const byte_t *_data, uint32_t _size,
- bool _flush) {
-
- message_buffer_ptr_t target_packetizer;
- queue_iterator_type target_queue_iterator;
-
- if (endpoint_impl<Protocol>::max_message_size_ != MESSAGE_SIZE_UNLIMITED
- && _size > endpoint_impl<Protocol>::max_message_size_) {
- VSOMEIP_ERROR << "sei::send_intern: Dropping to big message (" << _size
- << " Bytes). Maximum allowed message size is: "
- << endpoint_impl<Protocol>::max_message_size_ << " Bytes.";
- return false;
- }
-
- auto found_packetizer = packetizer_.find(_target);
- if (found_packetizer != packetizer_.end()) {
- target_packetizer = found_packetizer->second;
- } else {
- target_packetizer = std::make_shared<message_buffer_t>();
- packetizer_.insert(std::make_pair(_target, target_packetizer));
- }
-
- target_queue_iterator = queues_.find(_target);
- if (target_queue_iterator == queues_.end()) {
- target_queue_iterator = queues_.insert(queues_.begin(),
- std::make_pair(
- _target,
- std::make_pair(std::size_t(0),
- std::deque<message_buffer_ptr_t>())
- ));
- }
-
- // TODO compare against value from configuration here
- const bool queue_size_zero_on_entry(target_queue_iterator->second.second.empty());
- if (target_packetizer->size() + _size
- > endpoint_impl<Protocol>::max_message_size_
- && !target_packetizer->empty()) {
- target_queue_iterator->second.second.push_back(target_packetizer);
- target_queue_iterator->second.first += target_packetizer->size();
- target_packetizer = std::make_shared<message_buffer_t>();
- packetizer_[_target] = target_packetizer;
- }
-
- if (endpoint_impl<Protocol>::queue_limit_ != QUEUE_SIZE_UNLIMITED
- && target_queue_iterator->second.first + _size >
- endpoint_impl<Protocol>::queue_limit_) {
- service_t its_service(0);
- method_t its_method(0);
- client_t its_client(0);
- session_t its_session(0);
- if (_size >= VSOMEIP_SESSION_POS_MAX) {
- // this will yield wrong IDs for local communication as the commands
- // are prepended to the actual payload
- // it will print:
- // (lowbyte service ID + highbyte methoid)
- // [(Command + lowerbyte sender's client ID).
- // highbyte sender's client ID + lowbyte command size.
- // lowbyte methodid + highbyte vsomeipd 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]);
- }
- VSOMEIP_ERROR << "sei::send_intern: queue size limit (" << std::dec
- << endpoint_impl<Protocol>::queue_limit_
- << ") reached. Dropping message ("
- << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_session << "]"
- << " queue_size: " << std::dec << target_queue_iterator->second.first
- << " data size: " << std::dec << _size;
- return false;
- }
-
-
- target_packetizer->insert(target_packetizer->end(), _data, _data + _size);
-
- if (_flush) {
- flush_timer_.cancel();
- target_queue_iterator->second.second.push_back(target_packetizer);
- target_queue_iterator->second.first += target_packetizer->size();
- packetizer_[_target] = std::make_shared<message_buffer_t>();
- } else {
- std::chrono::milliseconds flush_timeout(VSOMEIP_DEFAULT_FLUSH_TIMEOUT);
- flush_timer_.expires_from_now(flush_timeout); // TODO: use configured value
- flush_timer_.async_wait(
- std::bind(&server_endpoint_impl<Protocol>::flush_cbk,
- this->shared_from_this(),
- _target,
- std::placeholders::_1));
- }
-
- if (queue_size_zero_on_entry && !target_queue_iterator->second.second.empty()) { // no writing in progress
- send_queued(target_queue_iterator);
- }
-
- return true;
-}
-
-template<typename Protocol>
-bool server_endpoint_impl<Protocol>::flush(
- endpoint_type _target) {
- bool is_flushed = false;
- std::lock_guard<std::mutex> its_lock(mutex_);
- auto queue_iterator = queues_.find(_target);
- if (queue_iterator != queues_.end() && !queue_iterator->second.second.empty()) {
- send_queued(queue_iterator);
- is_flushed = true;
- }
-
- return is_flushed;
-}
-
-template<typename Protocol>
-void server_endpoint_impl<Protocol>::connect_cbk(
- boost::system::error_code const &_error) {
- (void)_error;
-}
-
-template<typename Protocol>
-void server_endpoint_impl<Protocol>::send_cbk(
- const queue_iterator_type _queue_iterator,
- boost::system::error_code const &_error, std::size_t _bytes) {
- (void)_bytes;
-
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (!_error) {
- _queue_iterator->second.first -=
- _queue_iterator->second.second.front()->size();
- _queue_iterator->second.second.pop_front();
- if (_queue_iterator->second.second.size() > 0) {
- send_queued(_queue_iterator);
- }
- } else {
- message_buffer_ptr_t its_buffer;
- if (_queue_iterator->second.second.size()) {
- its_buffer = _queue_iterator->second.second.front();
- }
- service_t its_service(0);
- method_t its_method(0);
- client_t its_client(0);
- session_t its_session(0);
- if (its_buffer && its_buffer->size() > VSOMEIP_SESSION_POS_MAX) {
- its_service = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_SERVICE_POS_MIN],
- (*its_buffer)[VSOMEIP_SERVICE_POS_MAX]);
- its_method = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_METHOD_POS_MIN],
- (*its_buffer)[VSOMEIP_METHOD_POS_MAX]);
- its_client = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_CLIENT_POS_MIN],
- (*its_buffer)[VSOMEIP_CLIENT_POS_MAX]);
- its_session = VSOMEIP_BYTES_TO_WORD(
- (*its_buffer)[VSOMEIP_SESSION_POS_MIN],
- (*its_buffer)[VSOMEIP_SESSION_POS_MAX]);
- }
- // error: sending of outstanding responses isn't started again
- // delete remaining outstanding responses
- VSOMEIP_WARNING << "sei::send_cbk received error: " << _error.message()
- << " (" << std::dec << _error.value() << ") "
- << get_remote_information(_queue_iterator) << " "
- << std::dec << _queue_iterator->second.second.size() << " "
- << std::dec << _queue_iterator->second.first << " ("
- << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_session << "]";
- queues_.erase(_queue_iterator);
- }
-}
-
-template<typename Protocol>
-void server_endpoint_impl<Protocol>::flush_cbk(
- endpoint_type _target, const boost::system::error_code &_error_code) {
- if (!_error_code) {
- (void) flush(_target);
- }
-}
-
-// Instantiate template
-#ifndef _WIN32
-template class server_endpoint_impl<boost::asio::local::stream_protocol>;
-#endif
-template class server_endpoint_impl<boost::asio::ip::tcp>;
-template class server_endpoint_impl<boost::asio::ip::udp_ext>;
-
-} // namespace vsomeip
diff --git a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
deleted file mode 100644
index ab7d9c3..0000000
--- a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
+++ /dev/null
@@ -1,651 +0,0 @@
-// Copyright (C) 2014-2017 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 <iomanip>
-
-#include <boost/asio/write.hpp>
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/defines.hpp>
-
-#include "../include/endpoint_host.hpp"
-#include "../include/tcp_client_endpoint_impl.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../utility/include/utility.hpp"
-#include "../../utility/include/byteorder.hpp"
-#include "../../configuration/include/internal.hpp"
-
-
-namespace ip = boost::asio::ip;
-
-namespace vsomeip {
-
-tcp_client_endpoint_impl::tcp_client_endpoint_impl(
- std::shared_ptr< endpoint_host > _host,
- endpoint_type _local,
- endpoint_type _remote,
- boost::asio::io_service &_io,
- std::uint32_t _max_message_size,
- std::uint32_t _buffer_shrink_threshold,
- std::chrono::milliseconds _send_timeout,
- configuration::endpoint_queue_limit_t _queue_limit)
- : tcp_client_endpoint_base_impl(_host, _local, _remote, _io,
- _max_message_size, _queue_limit),
- recv_buffer_size_initial_(VSOMEIP_SOMEIP_HEADER_SIZE),
- recv_buffer_(std::make_shared<message_buffer_t>(recv_buffer_size_initial_, 0)),
- shrink_count_(0),
- buffer_shrink_threshold_(_buffer_shrink_threshold),
- remote_address_(_remote.address()),
- remote_port_(_remote.port()),
- last_cookie_sent_(std::chrono::steady_clock::now() - std::chrono::seconds(11)),
- send_timeout_(_send_timeout),
- send_timeout_warning_(_send_timeout / 2) {
- is_supporting_magic_cookies_ = true;
-}
-
-tcp_client_endpoint_impl::~tcp_client_endpoint_impl() {
- std::shared_ptr<endpoint_host> its_host = host_.lock();
- if (its_host) {
- its_host->release_port(local_.port(), true);
- }
-}
-
-bool tcp_client_endpoint_impl::is_local() const {
- return false;
-}
-
-void tcp_client_endpoint_impl::start() {
- connect();
-}
-
-void tcp_client_endpoint_impl::restart() {
- if (state_ == cei_state_e::CONNECTING) {
- return;
- }
- state_ = cei_state_e::CONNECTING;
- std::string address_port_local;
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- address_port_local = get_address_port_local();
- shutdown_and_close_socket_unlocked(true);
- recv_buffer_ = std::make_shared<message_buffer_t>(recv_buffer_size_initial_, 0);
- }
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- for (const auto&m : queue_) {
- const service_t its_service = VSOMEIP_BYTES_TO_WORD(
- (*m)[VSOMEIP_SERVICE_POS_MIN],
- (*m)[VSOMEIP_SERVICE_POS_MAX]);
- const method_t its_method = VSOMEIP_BYTES_TO_WORD(
- (*m)[VSOMEIP_METHOD_POS_MIN],
- (*m)[VSOMEIP_METHOD_POS_MAX]);
- const client_t its_client = VSOMEIP_BYTES_TO_WORD(
- (*m)[VSOMEIP_CLIENT_POS_MIN],
- (*m)[VSOMEIP_CLIENT_POS_MAX]);
- const session_t its_session = VSOMEIP_BYTES_TO_WORD(
- (*m)[VSOMEIP_SESSION_POS_MIN],
- (*m)[VSOMEIP_SESSION_POS_MAX]);
- VSOMEIP_WARNING << "tce::restart: dropping message: "
- << "remote:" << get_address_port_remote() << " ("
- << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_session << "]"
- << " size: " << std::dec << m->size();
- }
- queue_.clear();
- queue_size_ = 0;
- }
- VSOMEIP_WARNING << "tce::restart: local: " << address_port_local
- << " remote: " << get_address_port_remote();
- start_connect_timer();
-}
-
-void tcp_client_endpoint_impl::connect() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- boost::system::error_code its_error;
- socket_->open(remote_.protocol(), its_error);
-
- if (!its_error || its_error == boost::asio::error::already_open) {
- // Nagle algorithm off
- socket_->set_option(ip::tcp::no_delay(true), its_error);
- if (its_error) {
- VSOMEIP_WARNING << "tcp_client_endpoint::connect: couldn't disable "
- << "Nagle algorithm: " << its_error.message();
- }
-
- socket_->set_option(boost::asio::socket_base::keep_alive(true), its_error);
- if (its_error) {
- VSOMEIP_WARNING << "tcp_client_endpoint::connect: couldn't enable "
- << "keep_alive: " << its_error.message();
- }
-
- // Enable SO_REUSEADDR to avoid bind problems with services going offline
- // and coming online again and the user has specified only a small number
- // of ports in the clients section for one service instance
- socket_->set_option(boost::asio::socket_base::reuse_address(true), its_error);
- if (its_error) {
- VSOMEIP_WARNING << "tcp_client_endpoint::connect: couldn't enable "
- << "SO_REUSEADDR: " << its_error.message();
- }
- // In case a client endpoint port was configured,
- // bind to it before connecting
- if (local_.port() != ILLEGAL_PORT) {
- boost::system::error_code its_bind_error;
- socket_->bind(local_, its_bind_error);
- if(its_bind_error) {
- VSOMEIP_WARNING << "tcp_client_endpoint::connect: "
- "Error binding socket: " << its_bind_error.message();
- }
- }
- state_ = cei_state_e::CONNECTING;
- socket_->async_connect(
- remote_,
- std::bind(
- &tcp_client_endpoint_base_impl::connect_cbk,
- shared_from_this(),
- std::placeholders::_1
- )
- );
- } else {
- VSOMEIP_WARNING << "tcp_client_endpoint::connect: Error opening socket: "
- << its_error.message();
- }
-}
-
-void tcp_client_endpoint_impl::receive() {
- message_buffer_ptr_t its_recv_buffer;
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- its_recv_buffer = recv_buffer_;
- }
- receive(its_recv_buffer, 0, 0);
-}
-
-void tcp_client_endpoint_impl::receive(message_buffer_ptr_t _recv_buffer,
- std::size_t _recv_buffer_size,
- std::size_t _missing_capacity) {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if(socket_->is_open()) {
- const std::size_t its_capacity(_recv_buffer->capacity());
- size_t buffer_size = its_capacity - _recv_buffer_size;
- try {
- if (_missing_capacity) {
- if (_missing_capacity > MESSAGE_SIZE_UNLIMITED) {
- VSOMEIP_ERROR << "Missing receive buffer capacity exceeds allowed maximum!";
- return;
- }
- const std::size_t its_required_capacity(_recv_buffer_size + _missing_capacity);
- if (its_capacity < its_required_capacity) {
- _recv_buffer->reserve(its_required_capacity);
- _recv_buffer->resize(its_required_capacity, 0x0);
- }
- buffer_size = _missing_capacity;
- } else if (buffer_shrink_threshold_
- && shrink_count_ > buffer_shrink_threshold_
- && _recv_buffer_size == 0) {
- _recv_buffer->resize(recv_buffer_size_initial_, 0x0);
- _recv_buffer->shrink_to_fit();
- buffer_size = recv_buffer_size_initial_;
- shrink_count_ = 0;
- }
- } catch (const std::exception &e) {
- handle_recv_buffer_exception(e, _recv_buffer, _recv_buffer_size);
- // don't start receiving again
- return;
- }
- socket_->async_receive(
- boost::asio::buffer(&(*_recv_buffer)[_recv_buffer_size], buffer_size),
- std::bind(
- &tcp_client_endpoint_impl::receive_cbk,
- std::dynamic_pointer_cast< tcp_client_endpoint_impl >(shared_from_this()),
- std::placeholders::_1,
- std::placeholders::_2,
- _recv_buffer,
- _recv_buffer_size
- )
- );
- }
-}
-
-void tcp_client_endpoint_impl::send_queued() {
- message_buffer_ptr_t its_buffer;
- if(queue_.size()) {
- its_buffer = queue_.front();
- } else {
- return;
- }
- 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]);
-
- if (has_enabled_magic_cookies_) {
- const std::chrono::steady_clock::time_point now =
- std::chrono::steady_clock::now();
- if (std::chrono::duration_cast<std::chrono::milliseconds>(
- now - last_cookie_sent_) > std::chrono::milliseconds(10000)) {
- send_magic_cookie(its_buffer);
- last_cookie_sent_ = now;
- }
- }
-
-
-#if 0
- std::stringstream msg;
- msg << "tcei<" << remote_.address() << ":"
- << std::dec << remote_.port() << ">::sq: ";
- for (std::size_t i = 0; i < its_buffer->size(); i++)
- msg << std::hex << std::setw(2) << std::setfill('0')
- << (int)(*its_buffer)[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- boost::asio::async_write(
- *socket_,
- boost::asio::buffer(*its_buffer),
- std::bind(&tcp_client_endpoint_impl::write_completion_condition,
- std::static_pointer_cast<tcp_client_endpoint_impl>(shared_from_this()),
- std::placeholders::_1,
- std::placeholders::_2,
- its_buffer->size(),
- its_service, its_method, its_client, its_session,
- std::chrono::steady_clock::now()),
- std::bind(
- &tcp_client_endpoint_base_impl::send_cbk,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- }
-}
-
-bool tcp_client_endpoint_impl::get_remote_address(
- boost::asio::ip::address &_address) const {
- if (remote_address_.is_unspecified()) {
- return false;
- }
- _address = remote_address_;
- return true;
-}
-
-void tcp_client_endpoint_impl::set_local_port() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- boost::system::error_code its_error;
- if (socket_->is_open()) {
- endpoint_type its_endpoint = socket_->local_endpoint(its_error);
- if (!its_error) {
- local_port_ = its_endpoint.port();
- } else {
- VSOMEIP_WARNING << "tcp_client_endpoint_impl::set_local_port() "
- << " couldn't get local_endpoint: " << its_error.message();
- }
- }
-}
-
-std::size_t tcp_client_endpoint_impl::write_completion_condition(
- const boost::system::error_code& _error, std::size_t _bytes_transferred,
- std::size_t _bytes_to_send, service_t _service, method_t _method,
- client_t _client, session_t _session,
- std::chrono::steady_clock::time_point _start) {
-
- if (_error) {
- VSOMEIP_ERROR << "tce::write_completion_condition: "
- << _error.message() << "(" << std::dec << _error.value()
- << ") bytes transferred: " << std::dec << _bytes_transferred
- << " bytes to sent: " << std::dec << _bytes_to_send << " "
- << "remote:" << get_address_port_remote() << " ("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _method << "."
- << std::hex << std::setw(4) << std::setfill('0') << _session << "]";
- return 0;
- }
-
- std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
- std::chrono::milliseconds passed = std::chrono::duration_cast<std::chrono::milliseconds>(now - _start);
- if (passed > send_timeout_warning_) {
- if (passed > send_timeout_) {
- VSOMEIP_ERROR << "tce::write_completion_condition: "
- << _error.message() << "(" << std::dec << _error.value()
- << ") took longer than " << std::dec << send_timeout_.count()
- << "ms bytes transferred: " << std::dec << _bytes_transferred
- << " bytes to sent: " << std::dec << _bytes_to_send << " "
- << "remote:" << get_address_port_remote() << " ("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _method << "."
- << std::hex << std::setw(4) << std::setfill('0') << _session << "]";
- } else {
- VSOMEIP_WARNING << "tce::write_completion_condition: "
- << _error.message() << "(" << std::dec << _error.value()
- << ") took longer than " << std::dec << send_timeout_warning_.count()
- << "ms bytes transferred: " << std::dec << _bytes_transferred
- << " bytes to sent: " << std::dec << _bytes_to_send << " "
- << "remote:" << get_address_port_remote() << " ("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _method << "."
- << std::hex << std::setw(4) << std::setfill('0') << _session << "]";
- }
- }
- return _bytes_to_send - _bytes_transferred;
-}
-
-std::uint16_t tcp_client_endpoint_impl::get_remote_port() const {
- return remote_port_;
-}
-
-bool tcp_client_endpoint_impl::is_reliable() const {
- return true;
-}
-
-bool tcp_client_endpoint_impl::is_magic_cookie(const message_buffer_ptr_t& _recv_buffer,
- size_t _offset) const {
- return (0 == std::memcmp(SERVICE_COOKIE, &(*_recv_buffer)[_offset], sizeof(SERVICE_COOKIE)));
-}
-
-void tcp_client_endpoint_impl::send_magic_cookie(message_buffer_ptr_t &_buffer) {
- if (max_message_size_ == MESSAGE_SIZE_UNLIMITED
- || max_message_size_ - _buffer->size() >=
- VSOMEIP_SOMEIP_HEADER_SIZE + VSOMEIP_SOMEIP_MAGIC_COOKIE_SIZE) {
- _buffer->insert(
- _buffer->begin(),
- CLIENT_COOKIE,
- CLIENT_COOKIE + sizeof(CLIENT_COOKIE)
- );
- queue_size_ += sizeof(CLIENT_COOKIE);
- } else {
- VSOMEIP_WARNING << "Packet full. Cannot insert magic cookie!";
- }
-}
-
-void tcp_client_endpoint_impl::receive_cbk(
- boost::system::error_code const &_error, std::size_t _bytes,
- message_buffer_ptr_t _recv_buffer, std::size_t _recv_buffer_size) {
- if (_error == boost::asio::error::operation_aborted) {
- // endpoint was stopped
- return;
- }
-#if 0
- std::stringstream msg;
- msg << "cei::rcb (" << _error.message() << "): ";
- for (std::size_t i = 0; i < _bytes + _recv_buffer_size; ++i)
- msg << std::hex << std::setw(2) << std::setfill('0')
- << (int) (_recv_buffer)[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- std::unique_lock<std::mutex> its_lock(socket_mutex_);
- std::shared_ptr<endpoint_host> its_host = host_.lock();
- if (its_host) {
- std::uint32_t its_missing_capacity(0);
- if (!_error && 0 < _bytes) {
- if (_recv_buffer_size + _bytes < _recv_buffer_size) {
- VSOMEIP_ERROR << "receive buffer overflow in tcp client endpoint ~> abort!";
- return;
- }
- _recv_buffer_size += _bytes;
-
- size_t its_iteration_gap = 0;
- bool has_full_message(false);
- do {
- uint64_t read_message_size
- = utility::get_message_size(&(*_recv_buffer)[its_iteration_gap],
- _recv_buffer_size);
- if (read_message_size > MESSAGE_SIZE_UNLIMITED) {
- VSOMEIP_ERROR << "Message size exceeds allowed maximum!";
- return;
- }
- uint32_t current_message_size = static_cast<uint32_t>(read_message_size);
- has_full_message = (current_message_size > VSOMEIP_SOMEIP_HEADER_SIZE
- && current_message_size <= _recv_buffer_size);
- if (has_full_message) {
- bool needs_forwarding(true);
- if (is_magic_cookie(_recv_buffer, its_iteration_gap)) {
- has_enabled_magic_cookies_ = true;
- } else {
- if (has_enabled_magic_cookies_) {
- uint32_t its_offset = find_magic_cookie(&(*_recv_buffer)[its_iteration_gap],
- (uint32_t) _recv_buffer_size);
- if (its_offset < current_message_size) {
- VSOMEIP_ERROR << "Message includes Magic Cookie. Ignoring it.";
- current_message_size = its_offset;
- needs_forwarding = false;
- }
- }
- }
- if (needs_forwarding) {
- if (!has_enabled_magic_cookies_) {
- its_host->on_message(&(*_recv_buffer)[its_iteration_gap],
- current_message_size, this,
- boost::asio::ip::address(),
- VSOMEIP_ROUTING_CLIENT,
- remote_address_,
- remote_port_);
- } else {
- // Only call on_message without a magic cookie in front of the buffer!
- if (!is_magic_cookie(_recv_buffer, its_iteration_gap)) {
- its_host->on_message(&(*_recv_buffer)[its_iteration_gap],
- current_message_size, this,
- boost::asio::ip::address(),
- VSOMEIP_ROUTING_CLIENT,
- remote_address_,
- remote_port_);
- }
- }
- }
- calculate_shrink_count(_recv_buffer, _recv_buffer_size);
- _recv_buffer_size -= current_message_size;
- its_iteration_gap += current_message_size;
- its_missing_capacity = 0;
- } else if (max_message_size_ != MESSAGE_SIZE_UNLIMITED &&
- current_message_size > max_message_size_) {
- _recv_buffer_size = 0;
- _recv_buffer->resize(recv_buffer_size_initial_, 0x0);
- _recv_buffer->shrink_to_fit();
- if (has_enabled_magic_cookies_) {
- VSOMEIP_ERROR << "Received a TCP message which exceeds "
- << "maximum message size ("
- << std::dec << current_message_size
- << "). Magic Cookies are enabled: "
- << "Resetting receiver. local: "
- << get_address_port_local() << " remote: "
- << get_address_port_remote();
- } else {
- VSOMEIP_ERROR << "Received a TCP message which exceeds "
- << "maximum message size ("
- << std::dec << current_message_size
- << ") Magic cookies are disabled: "
- << "Client will be disabled! local: "
- << get_address_port_local() << " remote: "
- << get_address_port_remote();
- return;
- }
- } else if (current_message_size > _recv_buffer_size) {
- its_missing_capacity = current_message_size
- - static_cast<std::uint32_t>(_recv_buffer_size);
- } else if (VSOMEIP_SOMEIP_HEADER_SIZE > _recv_buffer_size) {
- its_missing_capacity = VSOMEIP_SOMEIP_HEADER_SIZE
- - static_cast<std::uint32_t>(_recv_buffer_size);
- } else if (has_enabled_magic_cookies_ && _recv_buffer_size > 0) {
- uint32_t its_offset = find_magic_cookie(&(*_recv_buffer)[its_iteration_gap], _recv_buffer_size);
- if (its_offset < _recv_buffer_size) {
- _recv_buffer_size -= its_offset;
- its_iteration_gap += its_offset;
- has_full_message = true; // trigger next loop
- }
- } else {
- VSOMEIP_ERROR << "tce::c<" << this
- << ">rcb: recv_buffer_size is: " << std::dec
- << _recv_buffer_size << " but couldn't read "
- "out message_size. recv_buffer_capacity: "
- << _recv_buffer->capacity()
- << " its_iteration_gap: " << its_iteration_gap
- << " local: " << get_address_port_local()
- << " remote: " << get_address_port_remote()
- << ". Restarting connection due to missing/broken data TCP stream.";
- its_lock.unlock();
- restart();
- return;
- }
- } while (has_full_message && _recv_buffer_size);
- if (its_iteration_gap) {
- // Copy incomplete message to front for next receive_cbk iteration
- for (size_t i = 0; i < _recv_buffer_size; ++i) {
- (*_recv_buffer)[i] = (*_recv_buffer)[i + its_iteration_gap];
- }
- // Still more capacity needed after shifting everything to front?
- if (its_missing_capacity &&
- its_missing_capacity <= _recv_buffer->capacity() - _recv_buffer_size) {
- its_missing_capacity = 0;
- }
- }
- its_lock.unlock();
- receive(_recv_buffer, _recv_buffer_size, its_missing_capacity);
- } else {
- if (_error == boost::asio::error::connection_reset ||
- _error == boost::asio::error::eof ||
- _error == boost::asio::error::timed_out ||
- _error == boost::asio::error::bad_descriptor) {
- VSOMEIP_WARNING << "tcp_client_endpoint receive_cbk: "
- << _error.message() << "( " << std::dec << _error.value()
- << ") local: " << get_address_port_local()
- << " remote: " << get_address_port_remote();
- state_ = cei_state_e::CLOSED;
- shutdown_and_close_socket_unlocked(false);
- } else {
- VSOMEIP_WARNING << "tcp_client_endpoint receive_cbk: "
- << _error.message() << "( " << std::dec << _error.value()
- << ") local: " << get_address_port_local()
- << " remote: " << get_address_port_remote();
- its_lock.unlock();
- receive(_recv_buffer, _recv_buffer_size, its_missing_capacity);
- }
- }
- }
-}
-
-void tcp_client_endpoint_impl::calculate_shrink_count(const message_buffer_ptr_t& _recv_buffer,
- std::size_t _recv_buffer_size) {
- if (buffer_shrink_threshold_) {
- if (_recv_buffer->capacity() != recv_buffer_size_initial_) {
- if (_recv_buffer_size < (_recv_buffer->capacity() >> 1)) {
- shrink_count_++;
- } else {
- shrink_count_ = 0;
- }
- }
- }
-}
-
-
-const std::string tcp_client_endpoint_impl::get_address_port_remote() const {
- boost::system::error_code ec;
- std::string its_address_port;
- its_address_port.reserve(21);
- boost::asio::ip::address its_address;
- if (get_remote_address(its_address)) {
- its_address_port += its_address.to_string();
- }
- its_address_port += ":";
- its_address_port += std::to_string(remote_port_);
- return its_address_port;
-}
-
-const std::string tcp_client_endpoint_impl::get_address_port_local() const {
- std::string its_address_port;
- its_address_port.reserve(21);
- boost::system::error_code ec;
- if (socket_->is_open()) {
- endpoint_type its_local_endpoint = socket_->local_endpoint(ec);
- if (!ec) {
- its_address_port += its_local_endpoint.address().to_string(ec);
- its_address_port += ":";
- its_address_port.append(std::to_string(its_local_endpoint.port()));
- }
- }
- return its_address_port;
-}
-
-void tcp_client_endpoint_impl::handle_recv_buffer_exception(
- const std::exception &_e,
- const message_buffer_ptr_t& _recv_buffer,
- std::size_t _recv_buffer_size) {
- boost::system::error_code ec;
-
- std::stringstream its_message;
- its_message <<"tcp_client_endpoint_impl::connection catched exception"
- << _e.what() << " local: " << get_address_port_local()
- << " remote: " << get_address_port_remote()
- << " shutting down connection. Start of buffer: ";
-
- for (std::size_t i = 0; i < _recv_buffer_size && i < 16; i++) {
- its_message << std::setw(2) << std::setfill('0') << std::hex
- << (int) ((*_recv_buffer)[i]) << " ";
- }
-
- its_message << " Last 16 Bytes captured: ";
- for (int i = 15; _recv_buffer_size > 15 && i >= 0; i--) {
- its_message << std::setw(2) << std::setfill('0') << std::hex
- << (int) ((*_recv_buffer)[i]) << " ";
- }
- VSOMEIP_ERROR << its_message.str();
- _recv_buffer->clear();
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- sending_blocked_ = true;
- }
- {
- std::lock_guard<std::mutex> its_lock(connect_timer_mutex_);
- boost::system::error_code ec;
- connect_timer_.cancel(ec);
- }
- if (socket_->is_open()) {
- boost::system::error_code its_error;
- socket_->shutdown(socket_type::shutdown_both, its_error);
- socket_->close(its_error);
- }
-}
-
-void tcp_client_endpoint_impl::print_status() {
- std::size_t its_data_size(0);
- std::size_t its_queue_size(0);
- std::size_t its_receive_buffer_capacity(0);
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- its_queue_size = queue_.size();
- its_data_size = queue_size_;
- }
- std::string local;
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- local = get_address_port_local();
- its_receive_buffer_capacity = recv_buffer_->capacity();
- }
-
- VSOMEIP_INFO << "status tce: " << local << " -> "
- << get_address_port_remote()
- << " queue: " << std::dec << its_queue_size
- << " data: " << std::dec << its_data_size
- << " recv_buffer: " << std::dec << its_receive_buffer_capacity;
-}
-
-std::string tcp_client_endpoint_impl::get_remote_information() const {
- boost::system::error_code ec;
- return remote_.address().to_string(ec) + ":"
- + std::to_string(remote_.port());
-}
-
-} // namespace vsomeip
diff --git a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
deleted file mode 100644
index 4226c55..0000000
--- a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
+++ /dev/null
@@ -1,785 +0,0 @@
-// Copyright (C) 2014-2017 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 <iomanip>
-
-#include <boost/asio/write.hpp>
-
-#include <vsomeip/constants.hpp>
-
-#include "../include/endpoint_definition.hpp"
-#include "../include/endpoint_host.hpp"
-#include "../include/tcp_server_endpoint_impl.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../utility/include/utility.hpp"
-#include "../../utility/include/byteorder.hpp"
-#include "../../configuration/include/internal.hpp"
-
-namespace ip = boost::asio::ip;
-
-namespace vsomeip {
-
-tcp_server_endpoint_impl::tcp_server_endpoint_impl(
- std::shared_ptr<endpoint_host> _host, endpoint_type _local,
- boost::asio::io_service &_io, std::uint32_t _max_message_size,
- std::uint32_t _buffer_shrink_threshold,
- std::chrono::milliseconds _send_timeout,
- configuration::endpoint_queue_limit_t _queue_limit)
- : tcp_server_endpoint_base_impl(_host, _local, _io,
- _max_message_size, _queue_limit),
- acceptor_(_io),
- buffer_shrink_threshold_(_buffer_shrink_threshold),
- local_port_(_local.port()),
- send_timeout_(_send_timeout) {
- is_supporting_magic_cookies_ = true;
-
- boost::system::error_code ec;
- acceptor_.open(_local.protocol(), ec);
- boost::asio::detail::throw_error(ec, "acceptor open");
- acceptor_.set_option(boost::asio::socket_base::reuse_address(true), ec);
- boost::asio::detail::throw_error(ec, "acceptor set_option");
- acceptor_.bind(_local, ec);
- boost::asio::detail::throw_error(ec, "acceptor bind");
- acceptor_.listen(boost::asio::socket_base::max_connections, ec);
- boost::asio::detail::throw_error(ec, "acceptor listen");
-}
-
-tcp_server_endpoint_impl::~tcp_server_endpoint_impl() {
-}
-
-bool tcp_server_endpoint_impl::is_local() const {
- return false;
-}
-
-void tcp_server_endpoint_impl::start() {
- std::lock_guard<std::mutex> its_lock(acceptor_mutex_);
- if (acceptor_.is_open()) {
- connection::ptr new_connection = connection::create(
- std::dynamic_pointer_cast<tcp_server_endpoint_impl>(
- shared_from_this()), max_message_size_,
- buffer_shrink_threshold_, has_enabled_magic_cookies_,
- service_, send_timeout_);
-
- {
- std::unique_lock<std::mutex> its_socket_lock(new_connection->get_socket_lock());
- acceptor_.async_accept(new_connection->get_socket(),
- std::bind(&tcp_server_endpoint_impl::accept_cbk,
- std::dynamic_pointer_cast<tcp_server_endpoint_impl>(
- shared_from_this()), new_connection,
- std::placeholders::_1));
- }
- }
-}
-
-void tcp_server_endpoint_impl::stop() {
- server_endpoint_impl::stop();
- {
- std::lock_guard<std::mutex> its_lock(acceptor_mutex_);
- if(acceptor_.is_open()) {
- boost::system::error_code its_error;
- acceptor_.close(its_error);
- }
- }
- {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- for (const auto &c : connections_) {
- c.second->stop();
- }
- connections_.clear();
- }
-}
-
-bool tcp_server_endpoint_impl::send_to(
- const std::shared_ptr<endpoint_definition> _target,
- const byte_t *_data,
- uint32_t _size, bool _flush) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- endpoint_type its_target(_target->get_address(), _target->get_port());
- return send_intern(its_target, _data, _size, _flush);
-}
-
-void tcp_server_endpoint_impl::send_queued(const queue_iterator_type _queue_iterator) {
- connection::ptr its_connection;
- {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- auto connection_iterator = connections_.find(_queue_iterator->first);
- if (connection_iterator != connections_.end()) {
- its_connection = connection_iterator->second;
- } else {
- VSOMEIP_INFO << "Didn't find connection: "
- << _queue_iterator->first.address().to_string() << ":" << std::dec
- << static_cast<std::uint16_t>(_queue_iterator->first.port())
- << " dropping outstanding messages (" << std::dec
- << _queue_iterator->second.second.size() << ").";
- queues_.erase(_queue_iterator->first);
- }
- }
- if (its_connection) {
- its_connection->send_queued(_queue_iterator);
- }
-}
-
-bool tcp_server_endpoint_impl::is_established(std::shared_ptr<endpoint_definition> _endpoint) {
- bool is_connected = false;
- endpoint_type endpoint(_endpoint->get_address(), _endpoint->get_port());
- {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- auto connection_iterator = connections_.find(endpoint);
- if (connection_iterator != connections_.end()) {
- is_connected = true;
- } else {
- VSOMEIP_INFO << "Didn't find TCP connection: Subscription "
- << "rejected for: " << endpoint.address().to_string() << ":"
- << std::dec << static_cast<std::uint16_t>(endpoint.port());
- }
- }
- return is_connected;
-}
-
-bool tcp_server_endpoint_impl::get_default_target(service_t,
- tcp_server_endpoint_impl::endpoint_type &) const {
- return false;
-}
-
-void tcp_server_endpoint_impl::remove_connection(
- tcp_server_endpoint_impl::connection *_connection) {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- for (auto it = connections_.begin(); it != connections_.end();) {
- if (it->second.get() == _connection) {
- it = connections_.erase(it);
- break;
- } else {
- ++it;
- }
- }
-}
-
-void tcp_server_endpoint_impl::accept_cbk(connection::ptr _connection,
- boost::system::error_code const &_error) {
-
- if (!_error) {
- boost::system::error_code its_error;
- endpoint_type remote;
- {
- std::unique_lock<std::mutex> its_socket_lock(_connection->get_socket_lock());
- socket_type &new_connection_socket = _connection->get_socket();
- remote = new_connection_socket.remote_endpoint(its_error);
- _connection->set_remote_info(remote);
- // Nagle algorithm off
- new_connection_socket.set_option(ip::tcp::no_delay(true), its_error);
-
- new_connection_socket.set_option(boost::asio::socket_base::keep_alive(true), its_error);
- if (its_error) {
- VSOMEIP_WARNING << "tcp_server_endpoint::connect: couldn't enable "
- << "keep_alive: " << its_error.message();
- }
- }
- if (!its_error) {
- {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- connections_[remote] = _connection;
- }
- _connection->start();
- }
- }
- if (_error != boost::asio::error::bad_descriptor
- && _error != boost::asio::error::operation_aborted
- && _error != boost::asio::error::no_descriptors) {
- start();
- }
-}
-
-std::uint16_t tcp_server_endpoint_impl::get_local_port() const {
- return local_port_;
-}
-
-bool tcp_server_endpoint_impl::is_reliable() const {
- return true;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// class tcp_service_impl::connection
-///////////////////////////////////////////////////////////////////////////////
-tcp_server_endpoint_impl::connection::connection(
- std::weak_ptr<tcp_server_endpoint_impl> _server,
- std::uint32_t _max_message_size,
- std::uint32_t _initial_recv_buffer_size,
- std::uint32_t _buffer_shrink_threshold,
- bool _magic_cookies_enabled,
- boost::asio::io_service &_io_service,
- std::chrono::milliseconds _send_timeout) :
- socket_(_io_service),
- server_(_server),
- max_message_size_(_max_message_size),
- recv_buffer_size_initial_(_initial_recv_buffer_size),
- recv_buffer_(_initial_recv_buffer_size, 0),
- recv_buffer_size_(0),
- missing_capacity_(0),
- shrink_count_(0),
- buffer_shrink_threshold_(_buffer_shrink_threshold),
- remote_port_(0),
- magic_cookies_enabled_(_magic_cookies_enabled),
- last_cookie_sent_(std::chrono::steady_clock::now() - std::chrono::seconds(11)),
- send_timeout_(_send_timeout),
- send_timeout_warning_(_send_timeout / 2) {
-}
-
-tcp_server_endpoint_impl::connection::ptr
-tcp_server_endpoint_impl::connection::create(
- std::weak_ptr<tcp_server_endpoint_impl> _server,
- std::uint32_t _max_message_size,
- std::uint32_t _buffer_shrink_threshold,
- bool _magic_cookies_enabled,
- boost::asio::io_service & _io_service,
- std::chrono::milliseconds _send_timeout) {
- const std::uint32_t its_initial_receveive_buffer_size =
- VSOMEIP_SOMEIP_HEADER_SIZE + 8 + MAGIC_COOKIE_SIZE + 8
- + VSOMEIP_MAX_TCP_MESSAGE_SIZE;
- return ptr(new connection(_server, _max_message_size,
- its_initial_receveive_buffer_size,
- _buffer_shrink_threshold, _magic_cookies_enabled,
- _io_service, _send_timeout));
-}
-
-tcp_server_endpoint_impl::socket_type &
-tcp_server_endpoint_impl::connection::get_socket() {
- return socket_;
-}
-
-std::unique_lock<std::mutex>
-tcp_server_endpoint_impl::connection::get_socket_lock() {
- return std::unique_lock<std::mutex>(socket_mutex_);
-}
-
-void tcp_server_endpoint_impl::connection::start() {
- receive();
-}
-
-void tcp_server_endpoint_impl::connection::receive() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if(socket_.is_open()) {
- const std::size_t its_capacity(recv_buffer_.capacity());
- size_t buffer_size = its_capacity - recv_buffer_size_;
- try {
- if (missing_capacity_) {
- if (missing_capacity_ > MESSAGE_SIZE_UNLIMITED) {
- VSOMEIP_ERROR << "Missing receive buffer capacity exceeds allowed maximum!";
- return;
- }
- const std::size_t its_required_capacity(recv_buffer_size_ + missing_capacity_);
- if (its_capacity < its_required_capacity) {
- recv_buffer_.reserve(its_required_capacity);
- recv_buffer_.resize(its_required_capacity, 0x0);
- }
- buffer_size = missing_capacity_;
- missing_capacity_ = 0;
- } else if (buffer_shrink_threshold_
- && shrink_count_ > buffer_shrink_threshold_
- && recv_buffer_size_ == 0) {
- recv_buffer_.resize(recv_buffer_size_initial_, 0x0);
- recv_buffer_.shrink_to_fit();
- buffer_size = recv_buffer_size_initial_;
- shrink_count_ = 0;
- }
- } catch (const std::exception &e) {
- handle_recv_buffer_exception(e);
- // don't start receiving again
- return;
- }
- socket_.async_receive(boost::asio::buffer(&recv_buffer_[recv_buffer_size_], buffer_size),
- std::bind(&tcp_server_endpoint_impl::connection::receive_cbk,
- shared_from_this(), std::placeholders::_1,
- std::placeholders::_2));
- }
-}
-
-void tcp_server_endpoint_impl::connection::stop() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if (socket_.is_open()) {
- boost::system::error_code its_error;
- socket_.shutdown(socket_.shutdown_both, its_error);
- socket_.close(its_error);
- }
-}
-
-void tcp_server_endpoint_impl::connection::send_queued(
- const queue_iterator_type _queue_iterator) {
- std::shared_ptr<tcp_server_endpoint_impl> its_server(server_.lock());
- if (!its_server) {
- VSOMEIP_TRACE << "tcp_server_endpoint_impl::connection::send_queued "
- " couldn't lock server_";
- return;
- }
- message_buffer_ptr_t its_buffer = _queue_iterator->second.second.front();
- 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]);
- if (magic_cookies_enabled_) {
- const std::chrono::steady_clock::time_point now =
- std::chrono::steady_clock::now();
- if (std::chrono::duration_cast<std::chrono::milliseconds>(
- now - last_cookie_sent_) > std::chrono::milliseconds(10000)) {
- if (send_magic_cookie(its_buffer)) {
- last_cookie_sent_ = now;
- _queue_iterator->second.first += sizeof(SERVICE_COOKIE);
- }
- }
- }
-
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- boost::asio::async_write(socket_, boost::asio::buffer(*its_buffer),
- std::bind(&tcp_server_endpoint_impl::connection::write_completion_condition,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2,
- its_buffer->size(),
- its_service, its_method, its_client, its_session,
- std::chrono::steady_clock::now()),
- std::bind(&tcp_server_endpoint_base_impl::send_cbk,
- its_server,
- _queue_iterator,
- std::placeholders::_1,
- std::placeholders::_2));
- }
-}
-
-bool tcp_server_endpoint_impl::connection::send_magic_cookie(
- message_buffer_ptr_t &_buffer) {
- if (max_message_size_ == MESSAGE_SIZE_UNLIMITED
- || max_message_size_ - _buffer->size() >=
- VSOMEIP_SOMEIP_HEADER_SIZE + VSOMEIP_SOMEIP_MAGIC_COOKIE_SIZE) {
- _buffer->insert(_buffer->begin(), SERVICE_COOKIE,
- SERVICE_COOKIE + sizeof(SERVICE_COOKIE));
- return true;
- }
- return false;
-}
-
-bool tcp_server_endpoint_impl::connection::is_magic_cookie(size_t _offset) const {
- return (0 == std::memcmp(CLIENT_COOKIE, &recv_buffer_[_offset],
- sizeof(CLIENT_COOKIE)));
-}
-
-void tcp_server_endpoint_impl::connection::receive_cbk(
- boost::system::error_code const &_error,
- std::size_t _bytes) {
- if (_error == boost::asio::error::operation_aborted) {
- // endpoint was stopped
- return;
- }
- std::shared_ptr<tcp_server_endpoint_impl> its_server(server_.lock());
- if (!its_server) {
- VSOMEIP_ERROR << "tcp_server_endpoint_impl::connection::receive_cbk "
- " couldn't lock server_";
- return;
- }
-#if 0
- std::stringstream msg;
- for (std::size_t i = 0; i < _bytes + recv_buffer_size_; ++i)
- msg << std::hex << std::setw(2) << std::setfill('0')
- << (int) recv_buffer_[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- std::shared_ptr<endpoint_host> its_host = its_server->host_.lock();
- if (its_host) {
- if (!_error && 0 < _bytes) {
- if (recv_buffer_size_ + _bytes < recv_buffer_size_) {
- VSOMEIP_ERROR << "receive buffer overflow in tcp client endpoint ~> abort!";
- return;
- }
- recv_buffer_size_ += _bytes;
-
- size_t its_iteration_gap = 0;
- bool has_full_message;
- do {
- uint64_t read_message_size
- = utility::get_message_size(&recv_buffer_[its_iteration_gap],
- recv_buffer_size_);
- if (read_message_size > MESSAGE_SIZE_UNLIMITED) {
- VSOMEIP_ERROR << "Message size exceeds allowed maximum!";
- return;
- }
- uint32_t current_message_size = static_cast<uint32_t>(read_message_size);
- has_full_message = (current_message_size > VSOMEIP_SOMEIP_HEADER_SIZE
- && current_message_size <= recv_buffer_size_);
- if (has_full_message) {
- bool needs_forwarding(true);
- if (is_magic_cookie(its_iteration_gap)) {
- magic_cookies_enabled_ = true;
- } else {
- if (magic_cookies_enabled_) {
- uint32_t its_offset
- = its_server->find_magic_cookie(&recv_buffer_[its_iteration_gap],
- recv_buffer_size_);
- if (its_offset < current_message_size) {
- VSOMEIP_ERROR << "Detected Magic Cookie within message data. Resyncing.";
- if (!is_magic_cookie(its_iteration_gap)) {
- its_host->on_error(&recv_buffer_[its_iteration_gap],
- static_cast<length_t>(recv_buffer_size_),its_server.get(),
- remote_address_, remote_port_);
- }
- current_message_size = its_offset;
- needs_forwarding = false;
- }
- }
- }
- if (needs_forwarding) {
- if (utility::is_request(
- recv_buffer_[its_iteration_gap
- + VSOMEIP_MESSAGE_TYPE_POS])) {
- client_t its_client;
- std::memcpy(&its_client,
- &recv_buffer_[its_iteration_gap + VSOMEIP_CLIENT_POS_MIN],
- sizeof(client_t));
- session_t its_session;
- std::memcpy(&its_session,
- &recv_buffer_[its_iteration_gap + VSOMEIP_SESSION_POS_MIN],
- sizeof(session_t));
- its_server->clients_mutex_.lock();
- its_server->clients_[its_client][its_session] = remote_;
- its_server->clients_to_endpoint_[its_client] = remote_;
- its_server->clients_mutex_.unlock();
- }
- if (!magic_cookies_enabled_) {
- its_host->on_message(&recv_buffer_[its_iteration_gap],
- current_message_size, its_server.get(),
- boost::asio::ip::address(),
- VSOMEIP_ROUTING_CLIENT, remote_address_,
- remote_port_);
- } else {
- // Only call on_message without a magic cookie in front of the buffer!
- if (!is_magic_cookie(its_iteration_gap)) {
- its_host->on_message(&recv_buffer_[its_iteration_gap],
- current_message_size, its_server.get(),
- boost::asio::ip::address(),
- VSOMEIP_ROUTING_CLIENT,
- remote_address_, remote_port_);
- }
- }
- }
- calculate_shrink_count();
- missing_capacity_ = 0;
- recv_buffer_size_ -= current_message_size;
- its_iteration_gap += current_message_size;
- } else if (magic_cookies_enabled_ && recv_buffer_size_ > 0) {
- uint32_t its_offset =
- its_server->find_magic_cookie(&recv_buffer_[its_iteration_gap],
- recv_buffer_size_);
- if (its_offset < recv_buffer_size_) {
- VSOMEIP_ERROR << "Detected Magic Cookie within message data. Resyncing.";
- if (!is_magic_cookie(its_iteration_gap)) {
- its_host->on_error(&recv_buffer_[its_iteration_gap],
- static_cast<length_t>(recv_buffer_size_), its_server.get(),
- remote_address_, remote_port_);
- }
- recv_buffer_size_ -= its_offset;
- its_iteration_gap += its_offset;
- has_full_message = true; // trigger next loop
- if (!is_magic_cookie(its_iteration_gap)) {
- its_host->on_error(&recv_buffer_[its_iteration_gap],
- static_cast<length_t>(recv_buffer_size_), its_server.get(),
- remote_address_, remote_port_);
- }
- }
- }
-
- if (!has_full_message) {
- if (max_message_size_ != MESSAGE_SIZE_UNLIMITED
- && current_message_size > max_message_size_) {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- recv_buffer_size_ = 0;
- recv_buffer_.resize(recv_buffer_size_initial_, 0x0);
- recv_buffer_.shrink_to_fit();
- if (magic_cookies_enabled_) {
- VSOMEIP_ERROR << "Received a TCP message which exceeds "
- << "maximum message size ("
- << std::dec << current_message_size
- << " > " << std::dec << max_message_size_
- << "). Magic Cookies are enabled: "
- << "Resetting receiver. local: "
- << get_address_port_local() << " remote: "
- << get_address_port_remote();
- } else {
- VSOMEIP_ERROR << "Received a TCP message which exceeds "
- << "maximum message size ("
- << std::dec << current_message_size
- << " > " << std::dec << max_message_size_
- << ") Magic cookies are disabled: "
- << "Connection will be disabled! local: "
- << get_address_port_local() << " remote: "
- << get_address_port_remote();
- return;
- }
- } else if (current_message_size > recv_buffer_size_) {
- missing_capacity_ = current_message_size
- - static_cast<std::uint32_t>(recv_buffer_size_);
- } else if (VSOMEIP_SOMEIP_HEADER_SIZE > recv_buffer_size_) {
- missing_capacity_ = VSOMEIP_SOMEIP_HEADER_SIZE
- - static_cast<std::uint32_t>(recv_buffer_size_);
- } else {
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- VSOMEIP_ERROR << "tse::c<" << this
- << ">rcb: recv_buffer_size is: " << std::dec
- << recv_buffer_size_ << " but couldn't read "
- "out message_size. recv_buffer_capacity: "
- << recv_buffer_.capacity()
- << " its_iteration_gap: " << its_iteration_gap
- << "local: " << get_address_port_local()
- << " remote: " << get_address_port_remote()
- << ". Closing connection due to missing/broken data TCP stream.";
- }
- {
- std::lock_guard<std::mutex> its_lock(its_server->connections_mutex_);
- stop();
- }
- its_server->remove_connection(this);
- return;
- }
- }
- } while (has_full_message && recv_buffer_size_);
- if (its_iteration_gap) {
- // Copy incomplete message to front for next receive_cbk iteration
- for (size_t i = 0; i < recv_buffer_size_; ++i) {
- recv_buffer_[i] = recv_buffer_[i + its_iteration_gap];
- }
- // Still more capacity needed after shifting everything to front?
- if (missing_capacity_ &&
- missing_capacity_ <= recv_buffer_.capacity() - recv_buffer_size_) {
- missing_capacity_ = 0;
- }
- }
- receive();
- }
- }
- if (_error == boost::asio::error::eof
- || _error == boost::asio::error::connection_reset
- || _error == boost::asio::error::timed_out) {
- if(_error == boost::asio::error::timed_out) {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- VSOMEIP_WARNING << "tcp_server_endpoint receive_cbk: " << _error.message()
- << " local: " << get_address_port_local()
- << " remote: " << get_address_port_remote();
- }
- {
- std::lock_guard<std::mutex> its_lock(its_server->connections_mutex_);
- stop();
- }
- its_server->remove_connection(this);
- }
-}
-
-void tcp_server_endpoint_impl::connection::calculate_shrink_count() {
- if (buffer_shrink_threshold_) {
- if (recv_buffer_.capacity() != recv_buffer_size_initial_) {
- if (recv_buffer_size_ < (recv_buffer_.capacity() >> 1)) {
- shrink_count_++;
- } else {
- shrink_count_ = 0;
- }
- }
- }
-}
-
-client_t tcp_server_endpoint_impl::get_client(std::shared_ptr<endpoint_definition> _endpoint) {
- const endpoint_type endpoint(_endpoint->get_address(), _endpoint->get_port());
- std::lock_guard<std::mutex> its_lock(clients_mutex_);
- for (const auto its_client : clients_to_endpoint_) {
- if (its_client.second == endpoint) {
- // TODO: Check system byte order before convert!
- client_t client = client_t(its_client.first << 8 | its_client.first >> 8);
- return client;
- }
- }
- return 0;
-}
-
-void tcp_server_endpoint_impl::connection::set_remote_info(
- const endpoint_type &_remote) {
- remote_ = _remote;
- remote_address_ = _remote.address();
- remote_port_ = _remote.port();
-}
-
-const std::string tcp_server_endpoint_impl::connection::get_address_port_remote() const {
- std::string its_address_port;
- its_address_port.reserve(21);
- boost::system::error_code ec;
- its_address_port += remote_address_.to_string(ec);
- its_address_port += ":";
- its_address_port += std::to_string(remote_port_);
- return its_address_port;
-}
-
-const std::string tcp_server_endpoint_impl::connection::get_address_port_local() const {
- std::string its_address_port;
- its_address_port.reserve(21);
- boost::system::error_code ec;
- if (socket_.is_open()) {
- endpoint_type its_local_endpoint = socket_.local_endpoint(ec);
- if (!ec) {
- its_address_port += its_local_endpoint.address().to_string(ec);
- its_address_port += ":";
- its_address_port += std::to_string(its_local_endpoint.port());
- }
- }
- return its_address_port;
-}
-
-void tcp_server_endpoint_impl::connection::handle_recv_buffer_exception(
- const std::exception &_e) {
- std::stringstream its_message;
- its_message <<"tcp_server_endpoint_impl::connection catched exception"
- << _e.what() << " local: " << get_address_port_local()
- << " remote: " << get_address_port_remote()
- << " shutting down connection. Start of buffer: ";
-
- for (std::size_t i = 0; i < recv_buffer_size_ && i < 16; i++) {
- its_message << std::setw(2) << std::setfill('0') << std::hex
- << (int) (recv_buffer_[i]) << " ";
- }
-
- its_message << " Last 16 Bytes captured: ";
- for (int i = 15; recv_buffer_size_ > 15 && i >= 0; i--) {
- its_message << std::setw(2) << std::setfill('0') << std::hex
- << (int) (recv_buffer_[i]) << " ";
- }
- VSOMEIP_ERROR << its_message.str();
- recv_buffer_.clear();
- if (socket_.is_open()) {
- boost::system::error_code its_error;
- socket_.shutdown(socket_.shutdown_both, its_error);
- socket_.close(its_error);
- }
- std::shared_ptr<tcp_server_endpoint_impl> its_server = server_.lock();
- if (its_server) {
- its_server->remove_connection(this);
- }
-}
-
-std::size_t
-tcp_server_endpoint_impl::connection::get_recv_buffer_capacity() const {
- return recv_buffer_.capacity();
-}
-
-std::size_t
-tcp_server_endpoint_impl::connection::write_completion_condition(
- const boost::system::error_code& _error,
- std::size_t _bytes_transferred, std::size_t _bytes_to_send,
- service_t _service, method_t _method, client_t _client, session_t _session,
- std::chrono::steady_clock::time_point _start) {
- if (_error) {
- VSOMEIP_ERROR << "tse::write_completion_condition: "
- << _error.message() << "(" << std::dec << _error.value()
- << ") bytes transferred: " << std::dec << _bytes_transferred
- << " bytes to sent: " << std::dec << _bytes_to_send << " "
- << "remote:" << get_address_port_remote() << " ("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _method << "."
- << std::hex << std::setw(4) << std::setfill('0') << _session << "]";
- stop_and_remove_connection();
- return 0;
- }
-
- std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
- std::chrono::milliseconds passed = std::chrono::duration_cast<std::chrono::milliseconds>(now - _start);
- if (passed > send_timeout_warning_) {
- if (passed > send_timeout_) {
- VSOMEIP_ERROR << "tse::write_completion_condition: "
- << _error.message() << "(" << std::dec << _error.value()
- << ") took longer than " << std::dec << send_timeout_.count()
- << "ms bytes transferred: " << std::dec << _bytes_transferred
- << " bytes to sent: " << std::dec << _bytes_to_send
- << " remote:" << get_address_port_remote() << " ("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _method << "."
- << std::hex << std::setw(4) << std::setfill('0') << _session << "]";
- } else {
- VSOMEIP_WARNING << "tse::write_completion_condition: "
- << _error.message() << "(" << std::dec << _error.value()
- << ") took longer than " << std::dec << send_timeout_warning_.count()
- << "ms bytes transferred: " << std::dec << _bytes_transferred
- << " bytes to sent: " << std::dec << _bytes_to_send
- << " remote:" << get_address_port_remote() << " ("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _method << "."
- << std::hex << std::setw(4) << std::setfill('0') << _session << "]";
- }
- }
- return _bytes_to_send - _bytes_transferred;
-}
-
-void tcp_server_endpoint_impl::connection::stop_and_remove_connection() {
- std::shared_ptr<tcp_server_endpoint_impl> its_server(server_.lock());
- if (!its_server) {
- VSOMEIP_ERROR << "tse::connection::stop_and_remove_connection "
- " couldn't lock server_";
- return;
- }
- {
- std::lock_guard<std::mutex> its_lock(its_server->connections_mutex_);
- stop();
- }
- its_server->remove_connection(this);
-}
-
-// Dummies
-void tcp_server_endpoint_impl::receive() {
- // intentionally left empty
-}
-
-void tcp_server_endpoint_impl::print_status() {
- std::lock_guard<std::mutex> its_lock(mutex_);
- connections_t its_connections;
- {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- its_connections = connections_;
- }
-
- VSOMEIP_INFO << "status tse: " << std::dec << local_port_
- << " connections: " << std::dec << its_connections.size()
- << " queues: " << std::dec << queues_.size();
- for (const auto &c : its_connections) {
- std::size_t its_data_size(0);
- std::size_t its_queue_size(0);
- std::size_t its_recv_size(0);
- {
- std::unique_lock<std::mutex> c_s_lock(c.second->get_socket_lock());
- its_recv_size = c.second->get_recv_buffer_capacity();
- }
- auto found_queue = queues_.find(c.first);
- if (found_queue != queues_.end()) {
- its_queue_size = found_queue->second.second.size();
- its_data_size = found_queue->second.first;
- }
- VSOMEIP_INFO << "status tse: client: "
- << c.second->get_address_port_remote()
- << " queue: " << std::dec << its_queue_size
- << " data: " << std::dec << its_data_size
- << " recv_buffer: " << std::dec << its_recv_size;
- }
-}
-
-std::string tcp_server_endpoint_impl::get_remote_information(
- const queue_iterator_type _queue_iterator) const {
- boost::system::error_code ec;
- return _queue_iterator->first.address().to_string(ec) + ":"
- + std::to_string(_queue_iterator->first.port());
-}
-
-} // namespace vsomeip
diff --git a/implementation/endpoints/src/udp_client_endpoint_impl.cpp b/implementation/endpoints/src/udp_client_endpoint_impl.cpp
deleted file mode 100644
index 6252b40..0000000
--- a/implementation/endpoints/src/udp_client_endpoint_impl.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-// Copyright (C) 2014-2017 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 <iomanip>
-#include <sstream>
-
-#include <boost/asio/ip/multicast.hpp>
-
-#include "../include/endpoint_host.hpp"
-#include "../include/udp_client_endpoint_impl.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../utility/include/utility.hpp"
-
-namespace vsomeip {
-
-udp_client_endpoint_impl::udp_client_endpoint_impl(
- std::shared_ptr< endpoint_host > _host,
- endpoint_type _local,
- endpoint_type _remote,
- boost::asio::io_service &_io,
- configuration::endpoint_queue_limit_t _queue_limit)
- : udp_client_endpoint_base_impl(_host, _local, _remote, _io,
- VSOMEIP_MAX_UDP_MESSAGE_SIZE, _queue_limit),
- recv_buffer_(VSOMEIP_MAX_UDP_MESSAGE_SIZE, 0),
- remote_address_(_remote.address()),
- remote_port_(_remote.port()) {
-}
-
-udp_client_endpoint_impl::~udp_client_endpoint_impl() {
- std::shared_ptr<endpoint_host> its_host = host_.lock();
- if (its_host) {
- its_host->release_port(local_.port(), false);
- }
-}
-
-bool udp_client_endpoint_impl::is_local() const {
- return false;
-}
-
-void udp_client_endpoint_impl::connect() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- // In case a client endpoint port was configured,
- // bind to it before connecting
- if (local_.port() != ILLEGAL_PORT) {
- boost::system::error_code its_bind_error;
- socket_->bind(local_, its_bind_error);
- if(its_bind_error) {
- VSOMEIP_WARNING << "udp_client_endpoint::connect: "
- "Error binding socket: " << its_bind_error.message();
- }
- }
- state_ = cei_state_e::CONNECTING;
- socket_->async_connect(
- remote_,
- std::bind(
- &udp_client_endpoint_base_impl::connect_cbk,
- shared_from_this(),
- std::placeholders::_1
- )
- );
-}
-
-void udp_client_endpoint_impl::start() {
- boost::system::error_code its_error;
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- socket_->open(remote_.protocol(), its_error);
- }
- if (!its_error || its_error == boost::asio::error::already_open) {
- connect();
- } else {
- VSOMEIP_WARNING << "udp_client_endpoint::connect: Error opening socket: "
- << its_error.message();
- }
-}
-
-void udp_client_endpoint_impl::restart() {
- if (state_ == cei_state_e::CONNECTING) {
- return;
- }
- state_ = cei_state_e::CONNECTING;
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- queue_.clear();
- }
- std::string local;
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- local = get_address_port_local();
- }
- shutdown_and_close_socket(false);
- VSOMEIP_WARNING << "uce::restart: local: " << local
- << " remote: " << get_address_port_remote();
- start_connect_timer();
-}
-
-void udp_client_endpoint_impl::send_queued() {
- message_buffer_ptr_t its_buffer;
- if(queue_.size()) {
- its_buffer = queue_.front();
- } else {
- return;
- }
-#if 0
- std::stringstream msg;
- msg << "ucei<" << remote_.address() << ":"
- << std::dec << remote_.port() << ">::sq: ";
- for (std::size_t i = 0; i < its_buffer->size(); i++)
- msg << std::hex << std::setw(2) << std::setfill('0')
- << (int)(*its_buffer)[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- socket_->async_send(
- boost::asio::buffer(*its_buffer),
- std::bind(
- &udp_client_endpoint_base_impl::send_cbk,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- }
-}
-
-void udp_client_endpoint_impl::receive() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if (!socket_->is_open()) {
- return;
- }
- socket_->async_receive_from(
- boost::asio::buffer(&recv_buffer_[0], max_message_size_),
- remote_,
- std::bind(
- &udp_client_endpoint_impl::receive_cbk,
- std::dynamic_pointer_cast<
- udp_client_endpoint_impl
- >(shared_from_this()),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
-}
-
-bool udp_client_endpoint_impl::get_remote_address(
- boost::asio::ip::address &_address) const {
- if (remote_address_.is_unspecified()) {
- return false;
- }
- _address = remote_address_;
- return true;
-}
-
-void udp_client_endpoint_impl::set_local_port() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- boost::system::error_code its_error;
- if (socket_->is_open()) {
- endpoint_type its_endpoint = socket_->local_endpoint(its_error);
- if (!its_error) {
- local_port_ = its_endpoint.port();
- } else {
- VSOMEIP_WARNING << "udp_client_endpoint_impl::set_local_port() "
- << " couldn't get local_endpoint: " << its_error.message();
- }
- }
-}
-
-std::uint16_t udp_client_endpoint_impl::get_remote_port() const {
- return remote_port_;
-}
-
-void udp_client_endpoint_impl::receive_cbk(
- boost::system::error_code const &_error, std::size_t _bytes) {
- if (_error == boost::asio::error::operation_aborted) {
- // endpoint was stopped
- return;
- }
- std::shared_ptr<endpoint_host> its_host = host_.lock();
- if (!_error && 0 < _bytes && its_host) {
-#if 0
- std::stringstream msg;
- msg << "ucei::rcb(" << _error.message() << "): ";
- for (std::size_t i = 0; i < _bytes + recv_buffer_size_; ++i)
- msg << std::hex << std::setw(2) << std::setfill('0')
- << (int) recv_buffer_[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- std::size_t remaining_bytes = _bytes;
- std::size_t i = 0;
-
- do {
- uint64_t read_message_size
- = utility::get_message_size(&this->recv_buffer_[i],
- remaining_bytes);
- if (read_message_size > MESSAGE_SIZE_UNLIMITED) {
- VSOMEIP_ERROR << "Message size exceeds allowed maximum!";
- return;
- }
- uint32_t current_message_size = static_cast<uint32_t>(read_message_size);
- if (current_message_size > VSOMEIP_SOMEIP_HEADER_SIZE &&
- current_message_size <= remaining_bytes) {
- if (remaining_bytes - current_message_size > remaining_bytes) {
- VSOMEIP_ERROR << "buffer underflow in udp client endpoint ~> abort!";
- return;
- }
- remaining_bytes -= current_message_size;
-
- its_host->on_message(&recv_buffer_[i], current_message_size,
- this, boost::asio::ip::address(),
- VSOMEIP_ROUTING_CLIENT, remote_address_,
- remote_port_);
- } else {
- VSOMEIP_ERROR << "Received a unreliable vSomeIP message with bad "
- "length field. Message size: " << current_message_size
- << " Bytes. From: " << remote_.address() << ":"
- << remote_.port() << ". Dropping message.";
- remaining_bytes = 0;
- }
- i += current_message_size;
- } while (remaining_bytes > 0);
- }
- if (!_error) {
- receive();
- } else {
- if (_error == boost::asio::error::connection_refused) {
- shutdown_and_close_socket(false);
- } else {
- receive();
- }
- }
-}
-
-const std::string udp_client_endpoint_impl::get_address_port_remote() const {
- boost::system::error_code ec;
- std::string its_address_port;
- its_address_port.reserve(21);
- boost::asio::ip::address its_address;
- if (get_remote_address(its_address)) {
- its_address_port += its_address.to_string();
- }
- its_address_port += ":";
- its_address_port += std::to_string(remote_port_);
- return its_address_port;
-}
-
-const std::string udp_client_endpoint_impl::get_address_port_local() const {
- std::string its_address_port;
- its_address_port.reserve(21);
- boost::system::error_code ec;
- if (socket_->is_open()) {
- endpoint_type its_local_endpoint = socket_->local_endpoint(ec);
- if (!ec) {
- its_address_port += its_local_endpoint.address().to_string(ec);
- its_address_port += ":";
- its_address_port.append(std::to_string(its_local_endpoint.port()));
- }
- }
- return its_address_port;
-}
-
-void udp_client_endpoint_impl::print_status() {
- std::size_t its_data_size(0);
- std::size_t its_queue_size(0);
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- its_queue_size = queue_.size();
- its_data_size = queue_size_;
- }
- std::string local;
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- local = get_address_port_local();
- }
-
- VSOMEIP_INFO << "status uce: " << local << " -> "
- << get_address_port_remote()
- << " queue: " << std::dec << its_queue_size
- << " data: " << std::dec << its_data_size;
-}
-
-std::string udp_client_endpoint_impl::get_remote_information() const {
- boost::system::error_code ec;
- return remote_.address().to_string(ec) + ":"
- + std::to_string(remote_.port());
-}
-
-} // namespace vsomeip
diff --git a/implementation/endpoints/src/udp_server_endpoint_impl.cpp b/implementation/endpoints/src/udp_server_endpoint_impl.cpp
deleted file mode 100644
index 5666821..0000000
--- a/implementation/endpoints/src/udp_server_endpoint_impl.cpp
+++ /dev/null
@@ -1,428 +0,0 @@
-// Copyright (C) 2014-2017 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 <iomanip>
-#include <sstream>
-
-#include <boost/asio/ip/multicast.hpp>
-
-#include "../include/endpoint_definition.hpp"
-#include "../include/endpoint_host.hpp"
-#include "../include/udp_server_endpoint_impl.hpp"
-#include "../../configuration/include/configuration.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../utility/include/byteorder.hpp"
-#include "../../utility/include/utility.hpp"
-#include "../../service_discovery/include/defines.hpp"
-
-namespace ip = boost::asio::ip;
-
-namespace vsomeip {
-
-udp_server_endpoint_impl::udp_server_endpoint_impl(
- std::shared_ptr< endpoint_host > _host,
- endpoint_type _local,
- boost::asio::io_service &_io,
- configuration::endpoint_queue_limit_t _queue_limit)
- : server_endpoint_impl<ip::udp_ext>(
- _host, _local, _io, VSOMEIP_MAX_UDP_MESSAGE_SIZE, _queue_limit),
- socket_(_io, _local.protocol()),
- joined_group_(false),
- recv_buffer_(VSOMEIP_MAX_UDP_MESSAGE_SIZE, 0),
- local_port_(_local.port()) {
- boost::system::error_code ec;
-
- boost::asio::socket_base::reuse_address optionReuseAddress(true);
- socket_.set_option(optionReuseAddress, ec);
- boost::asio::detail::throw_error(ec, "reuse address");
-
- socket_.bind(_local, ec);
- boost::asio::detail::throw_error(ec, "bind");
-
- if (_local.address().is_v4()) {
- boost::asio::ip::address_v4 its_unicast_address
- = _host->get_configuration()->get_unicast_address().to_v4();
- boost::asio::ip::multicast::outbound_interface option(its_unicast_address);
- socket_.set_option(option, ec);
- boost::asio::detail::throw_error(ec, "outbound interface option IPv4");
- } else if (_local.address().is_v6()) {
- boost::asio::ip::address_v6 its_unicast_address
- = _host->get_configuration()->get_unicast_address().to_v6();
- boost::asio::ip::multicast::outbound_interface option(
- static_cast<unsigned int>(its_unicast_address.scope_id()));
- socket_.set_option(option, ec);
- boost::asio::detail::throw_error(ec, "outbound interface option IPv6");
- }
-
- boost::asio::socket_base::broadcast option(true);
- socket_.set_option(option, ec);
- boost::asio::detail::throw_error(ec, "broadcast option");
-
-#ifdef _WIN32
- const char* optval("0001");
- ::setsockopt(socket_.native(), IPPROTO_IP, IP_PKTINFO,
- optval, sizeof(optval));
-#else
- int optval(1);
- ::setsockopt(socket_.native(), IPPROTO_IP, IP_PKTINFO,
- &optval, sizeof(optval));
-#endif
-}
-
-udp_server_endpoint_impl::~udp_server_endpoint_impl() {
-}
-
-bool udp_server_endpoint_impl::is_local() const {
- return false;
-}
-
-void udp_server_endpoint_impl::start() {
- receive();
-}
-
-void udp_server_endpoint_impl::stop() {
- server_endpoint_impl::stop();
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if (socket_.is_open()) {
- boost::system::error_code its_error;
- socket_.shutdown(socket_type::shutdown_both, its_error);
- socket_.close(its_error);
- }
- }
-}
-
-void udp_server_endpoint_impl::receive() {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- if(socket_.is_open()) {
- socket_.async_receive_from(
- boost::asio::buffer(&recv_buffer_[0], max_message_size_),
- remote_,
- std::bind(
- &udp_server_endpoint_impl::receive_cbk,
- std::dynamic_pointer_cast<
- udp_server_endpoint_impl >(shared_from_this()),
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3
- )
- );
- }
-}
-
-bool udp_server_endpoint_impl::send_to(
- const std::shared_ptr<endpoint_definition> _target,
- const byte_t *_data, uint32_t _size, bool _flush) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- endpoint_type its_target(_target->get_address(), _target->get_port());
- return send_intern(its_target, _data, _size, _flush);
-}
-
-void udp_server_endpoint_impl::send_queued(
- const queue_iterator_type _queue_iterator) {
- message_buffer_ptr_t its_buffer = _queue_iterator->second.second.front();
-#if 0
- std::stringstream msg;
- msg << "usei::sq(" << _queue_iterator->first.address().to_string() << ":"
- << _queue_iterator->first.port() << "): ";
- for (std::size_t i = 0; i < its_buffer->size(); ++i)
- msg << std::hex << std::setw(2) << std::setfill('0')
- << (int)(*its_buffer)[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- socket_.async_send_to(
- boost::asio::buffer(*its_buffer),
- _queue_iterator->first,
- std::bind(
- &udp_server_endpoint_base_impl::send_cbk,
- shared_from_this(),
- _queue_iterator,
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
- }
-}
-
-bool udp_server_endpoint_impl::is_joined(const std::string &_address) const {
- std::lock_guard<std::mutex> its_lock(joined_mutex_);
- return (joined_.find(_address) != joined_.end());
-}
-
-bool udp_server_endpoint_impl::is_joined(
- const std::string &_address, bool* _received) const {
- *_received = false;
- std::lock_guard<std::mutex> its_lock(joined_mutex_);
- const auto found_address = joined_.find(_address);
- if (found_address != joined_.end()) {
- *_received = found_address->second;
- }
- return (found_address != joined_.end());
-}
-
-void udp_server_endpoint_impl::join(const std::string &_address) {
- bool has_received(false);
-
- std::function<void(const std::string &)> join_func =
- [this](const std::string &_address) {
- try {
- bool is_v4(false);
- bool is_v6(false);
- {
- std::lock_guard<std::mutex> its_lock(local_mutex_);
- is_v4 = local_.address().is_v4();
- is_v6 = local_.address().is_v6();
- }
- if (is_v4) {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- socket_.set_option(ip::udp_ext::socket::reuse_address(true));
- socket_.set_option(
- boost::asio::ip::multicast::enable_loopback(false));
-#ifdef _WIN32
- socket_.set_option(boost::asio::ip::multicast::join_group(
- boost::asio::ip::address::from_string(_address).to_v4(),
- local_.address().to_v4()));
-#else
- socket_.set_option(boost::asio::ip::multicast::join_group(
- boost::asio::ip::address::from_string(_address).to_v4()));
-#endif
- } else if (is_v6) {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- socket_.set_option(ip::udp_ext::socket::reuse_address(true));
- socket_.set_option(
- boost::asio::ip::multicast::enable_loopback(false));
-#ifdef _WIN32
- socket_.set_option(boost::asio::ip::multicast::join_group(
- boost::asio::ip::address::from_string(_address).to_v6(),
- local_.address().to_v6().scope_id()));
-#else
- socket_.set_option(boost::asio::ip::multicast::join_group(
- boost::asio::ip::address::from_string(_address).to_v6()));
-#endif
- }
- {
- std::lock_guard<std::mutex> its_lock(joined_mutex_);
- joined_[_address] = false;
- }
- joined_group_ = true;
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << "udp_server_endpoint_impl::join" << ":" << e.what();
- }
- };
-
- if (!is_joined(_address, &has_received)) {
- join_func(_address);
- } else if (!has_received) {
- // joined the multicast group but didn't receive a event yet -> rejoin
- leave(_address);
- join_func(_address);
- }
-}
-
-void udp_server_endpoint_impl::leave(const std::string &_address) {
- try {
- if (is_joined(_address)) {
- bool is_v4(false);
- bool is_v6(false);
- {
- std::lock_guard<std::mutex> its_lock(local_mutex_);
- is_v4 = local_.address().is_v4();
- is_v6 = local_.address().is_v6();
- }
- if (is_v4) {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- socket_.set_option(boost::asio::ip::multicast::leave_group(
- boost::asio::ip::address::from_string(_address)));
- } else if (is_v6) {
- std::lock_guard<std::mutex> its_lock(socket_mutex_);
- socket_.set_option(boost::asio::ip::multicast::leave_group(
- boost::asio::ip::address::from_string(_address)));
- }
- {
- std::lock_guard<std::mutex> its_lock(joined_mutex_);
- joined_.erase(_address);
- if (!joined_.size()) {
- joined_group_ = false;
- }
- }
- }
- }
- catch (const std::exception &e) {
- VSOMEIP_ERROR << __func__ << ":" << e.what();
- }
-}
-
-void udp_server_endpoint_impl::add_default_target(
- service_t _service, const std::string &_address, uint16_t _port) {
- std::lock_guard<std::mutex> its_lock(default_targets_mutex_);
- endpoint_type its_endpoint(
- boost::asio::ip::address::from_string(_address), _port);
- default_targets_[_service] = its_endpoint;
-}
-
-void udp_server_endpoint_impl::remove_default_target(service_t _service) {
- std::lock_guard<std::mutex> its_lock(default_targets_mutex_);
- default_targets_.erase(_service);
-}
-
-bool udp_server_endpoint_impl::get_default_target(service_t _service,
- udp_server_endpoint_impl::endpoint_type &_target) const {
- std::lock_guard<std::mutex> its_lock(default_targets_mutex_);
- bool is_valid(false);
- auto find_service = default_targets_.find(_service);
- if (find_service != default_targets_.end()) {
- _target = find_service->second;
- is_valid = true;
- }
- return is_valid;
-}
-
-std::uint16_t udp_server_endpoint_impl::get_local_port() const {
- return local_port_;
-}
-
-// TODO: find a better way to structure the receive functions
-void udp_server_endpoint_impl::receive_cbk(
- boost::system::error_code const &_error, std::size_t _bytes,
- boost::asio::ip::address const &_destination) {
-#if 0
- std::stringstream msg;
- msg << "usei::rcb(" << _error.message() << "): ";
- for (std::size_t i = 0; i < _bytes; ++i)
- msg << std::hex << std::setw(2) << std::setfill('0')
- << (int) recv_buffer_[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- std::shared_ptr<endpoint_host> its_host = this->host_.lock();
- if (its_host) {
- if (!_error && 0 < _bytes) {
- std::size_t remaining_bytes = _bytes;
- std::size_t i = 0;
- const boost::asio::ip::address its_remote_address(remote_.address());
- const std::uint16_t its_remote_port(remote_.port());
- do {
- uint64_t read_message_size
- = utility::get_message_size(&this->recv_buffer_[i],
- remaining_bytes);
- if (read_message_size > MESSAGE_SIZE_UNLIMITED) {
- VSOMEIP_ERROR << "Message size exceeds allowed maximum!";
- return;
- }
- uint32_t current_message_size = static_cast<uint32_t>(read_message_size);
- if (current_message_size > VSOMEIP_SOMEIP_HEADER_SIZE &&
- current_message_size <= remaining_bytes) {
- if (remaining_bytes - current_message_size > remaining_bytes) {
- VSOMEIP_ERROR << "buffer underflow in udp client endpoint ~> abort!";
- return;
- }
- remaining_bytes -= current_message_size;
- service_t its_service = VSOMEIP_BYTES_TO_WORD(recv_buffer_[i + VSOMEIP_SERVICE_POS_MIN],
- recv_buffer_[i + VSOMEIP_SERVICE_POS_MAX]);
- if (utility::is_request(
- recv_buffer_[i + VSOMEIP_MESSAGE_TYPE_POS])) {
- client_t its_client;
- std::memcpy(&its_client,
- &recv_buffer_[i + VSOMEIP_CLIENT_POS_MIN],
- sizeof(client_t));
- session_t its_session;
- std::memcpy(&its_session,
- &recv_buffer_[i + VSOMEIP_SESSION_POS_MIN],
- sizeof(session_t));
- clients_mutex_.lock();
- clients_[its_client][its_session] = remote_;
- clients_to_endpoint_[its_client] = remote_;
- clients_mutex_.unlock();
- } else if (its_service != VSOMEIP_SD_SERVICE
- && utility::is_notification(recv_buffer_[i + VSOMEIP_MESSAGE_TYPE_POS])
- && joined_group_) {
- std::lock_guard<std::mutex> its_lock(joined_mutex_);
- boost::system::error_code ec;
- const auto found_address = joined_.find(_destination.to_string(ec));
- if (found_address != joined_.end()) {
- found_address->second = true;
- }
- }
- if (its_service != VSOMEIP_SD_SERVICE ||
- (current_message_size > VSOMEIP_SOMEIP_HEADER_SIZE &&
- current_message_size >= remaining_bytes)) {
- its_host->on_message(&recv_buffer_[i],
- current_message_size, this, _destination,
- VSOMEIP_ROUTING_CLIENT, its_remote_address,
- its_remote_port);
- } else {
- //ignore messages for service discovery with shorter SomeIP length
- VSOMEIP_ERROR << "Received an unreliable vSomeIP SD message with too short length field";
- }
- i += current_message_size;
- } else {
- VSOMEIP_ERROR << "Received an unreliable vSomeIP message with bad length field";
- if (remaining_bytes > VSOMEIP_SERVICE_POS_MAX) {
- service_t its_service = VSOMEIP_BYTES_TO_WORD(recv_buffer_[VSOMEIP_SERVICE_POS_MIN],
- recv_buffer_[VSOMEIP_SERVICE_POS_MAX]);
- if (its_service != VSOMEIP_SD_SERVICE) {
- if (read_message_size == 0) {
- VSOMEIP_ERROR << "Ignoring unreliable vSomeIP message with SomeIP message length 0!";
- } else {
- its_host->on_error(&recv_buffer_[i],
- (uint32_t)remaining_bytes, this,
- its_remote_address, its_remote_port);
- }
- }
- }
- remaining_bytes = 0;
- }
- } while (remaining_bytes > 0);
- receive();
- } else {
- receive();
- }
- }
-}
-
-client_t udp_server_endpoint_impl::get_client(std::shared_ptr<endpoint_definition> _endpoint) {
- const endpoint_type endpoint(_endpoint->get_address(), _endpoint->get_port());
- std::lock_guard<std::mutex> its_lock(clients_mutex_);
- for (const auto its_client : clients_to_endpoint_) {
- if (its_client.second == endpoint) {
- // TODO: Check system byte order before convert!
- client_t client = client_t(its_client.first << 8 | its_client.first >> 8);
- return client;
- }
- }
- return 0;
-}
-
-void udp_server_endpoint_impl::print_status() {
- std::lock_guard<std::mutex> its_lock(mutex_);
-
- VSOMEIP_INFO << "status use: " << std::dec << local_port_
- << " number queues: " << std::dec << queues_.size()
- << " recv_buffer: " << std::dec << recv_buffer_.capacity();
-
- for (const auto &c : queues_) {
- std::size_t its_data_size(0);
- std::size_t its_queue_size(0);
- its_queue_size = c.second.second.size();
- its_data_size = c.second.first;
-
- boost::system::error_code ec;
- VSOMEIP_INFO << "status use: client: "
- << c.first.address().to_string(ec) << ":"
- << std::dec << c.first.port()
- << " queue: " << std::dec << its_queue_size
- << " data: " << std::dec << its_data_size;
- }
-}
-
-std::string udp_server_endpoint_impl::get_remote_information(
- const queue_iterator_type _queue_iterator) const {
- boost::system::error_code ec;
- return _queue_iterator->first.address().to_string(ec) + ":"
- + std::to_string(_queue_iterator->first.port());
-}
-
-} // namespace vsomeip
diff --git a/implementation/endpoints/src/virtual_server_endpoint_impl.cpp b/implementation/endpoints/src/virtual_server_endpoint_impl.cpp
deleted file mode 100644
index fe5aa13..0000000
--- a/implementation/endpoints/src/virtual_server_endpoint_impl.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/constants.hpp>
-
-#include "../include/virtual_server_endpoint_impl.hpp"
-#include "../../logging/include/logger.hpp"
-
-namespace vsomeip {
-
-virtual_server_endpoint_impl::virtual_server_endpoint_impl(
- const std::string &_address, uint16_t _port, bool _reliable)
- : address_(_address), port_(_port), reliable_(_reliable), use_count_(0) {
-}
-
-virtual_server_endpoint_impl::~virtual_server_endpoint_impl() {
-}
-
-void virtual_server_endpoint_impl::start() {
-}
-
-void virtual_server_endpoint_impl::stop() {
-}
-
-bool virtual_server_endpoint_impl::is_connected() const {
- return false;
-}
-
-void virtual_server_endpoint_impl::set_connected(bool _connected) {
- (void) _connected;
-}
-
-bool virtual_server_endpoint_impl::send(const byte_t *_data, uint32_t _size,
- bool _flush) {
- (void)_data;
- (void)_size;
- (void)_flush;
- return false;
-}
-
-bool virtual_server_endpoint_impl::send_to(
- const std::shared_ptr<endpoint_definition> _target,
- const byte_t *_data, uint32_t _size, bool _flush) {
- (void)_target;
- (void)_data;
- (void)_size;
- (void)_flush;
- return false;
-}
-
-void virtual_server_endpoint_impl::enable_magic_cookies() {
-}
-
-void virtual_server_endpoint_impl::receive() {
-}
-
-void virtual_server_endpoint_impl::join(const std::string &_address) {
- (void)_address;
-}
-
-void virtual_server_endpoint_impl::leave(const std::string &_address) {
- (void)_address;
-}
-
-void virtual_server_endpoint_impl::add_default_target(
- service_t _service,
- const std::string &_address, uint16_t _port) {
- (void)_service;
- (void)_address;
- (void)_port;
-}
-
-void virtual_server_endpoint_impl::remove_default_target(
- service_t _service) {
- (void)_service;
-}
-
-bool virtual_server_endpoint_impl::get_remote_address(
- boost::asio::ip::address &_address) const {
- (void)_address;
- return false;
-}
-
-std::uint16_t virtual_server_endpoint_impl::get_local_port() const {
- return port_;
-}
-
-std::uint16_t virtual_server_endpoint_impl::get_remote_port() const {
- return ILLEGAL_PORT;
-}
-
-bool virtual_server_endpoint_impl::is_reliable() const {
- return reliable_;
-}
-
-bool virtual_server_endpoint_impl::is_local() const {
- return true;
-}
-
-
-void virtual_server_endpoint_impl::increment_use_count() {
- use_count_++;
-}
-
-void virtual_server_endpoint_impl::decrement_use_count() {
- if (use_count_ > 0)
- use_count_--;
-}
-
-uint32_t virtual_server_endpoint_impl::get_use_count() {
- return use_count_;
-}
-
-void virtual_server_endpoint_impl::restart() {
-
-}
-
-void virtual_server_endpoint_impl::register_error_handler(
- error_handler_t _handler) {
- (void)_handler;
-}
-
-void virtual_server_endpoint_impl::print_status() {
-
-}
-
-} // namespace vsomeip
diff --git a/implementation/helper/boost/asio/basic_datagram_socket_ext.hpp b/implementation/helper/boost/asio/basic_datagram_socket_ext.hpp
deleted file mode 100644
index 98314b9..0000000
--- a/implementation/helper/boost/asio/basic_datagram_socket_ext.hpp
+++ /dev/null
@@ -1,954 +0,0 @@
-//
-// basic_datagram_socket_ext.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_BASIC_DATAGRAM_SOCKET_EXT_HPP
-#define BOOST_ASIO_BASIC_DATAGRAM_SOCKET_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <iostream>
-
-#include <boost/asio/detail/config.hpp>
-#include <cstddef>
-#include <boost/asio/basic_socket.hpp>
-#include <boost/asio/datagram_socket_service_ext.hpp>
-#include <boost/asio/detail/handler_type_requirements_ext.hpp>
-#include <boost/asio/detail/throw_error.hpp>
-#include <boost/asio/detail/type_traits.hpp>
-#include <boost/asio/error.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-
-/// Provides datagram-oriented socket functionality.
-/**
- * The basic_datagram_socket class template provides asynchronous and blocking
- * datagram-oriented socket functionality.
- *
- * @par Thread Safety
- * @e Distinct @e objects: Safe.@n
- * @e Shared @e objects: Unsafe.
- */
-template <typename Protocol,
- typename DatagramSocketService = datagram_socket_service_ext<Protocol> >
-class basic_datagram_socket_ext
- : public basic_socket<Protocol, DatagramSocketService>
-{
-public:
- /// (Deprecated: Use native_handle_type.) The native representation of a
- /// socket.
- typedef typename DatagramSocketService::native_handle_type native_type;
-
- /// The native representation of a socket.
- typedef typename DatagramSocketService::native_handle_type native_handle_type;
-
- /// The protocol type.
- typedef Protocol protocol_type;
-
- /// The endpoint type.
- typedef typename Protocol::endpoint endpoint_type;
-
- /// Construct a basic_datagram_socket without opening it.
- /**
- * This constructor creates a datagram socket without opening it. The open()
- * function must be called before data can be sent or received on the socket.
- *
- * @param io_service The io_service object that the datagram socket will use
- * to dispatch handlers for any asynchronous operations performed on the
- * socket.
- */
- explicit basic_datagram_socket_ext(boost::asio::io_service& io_service)
- : basic_socket<Protocol, DatagramSocketService>(io_service)
- {
- }
-
- /// Construct and open a basic_datagram_socket.
- /**
- * This constructor creates and opens a datagram socket.
- *
- * @param io_service The io_service object that the datagram socket will use
- * to dispatch handlers for any asynchronous operations performed on the
- * socket.
- *
- * @param protocol An object specifying protocol parameters to be used.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- basic_datagram_socket_ext(boost::asio::io_service& io_service,
- const protocol_type& protocol)
- : basic_socket<Protocol, DatagramSocketService>(io_service, protocol)
- {
- }
-
- /// Construct a basic_datagram_socket, opening it and binding it to the given
- /// local endpoint.
- /**
- * This constructor creates a datagram socket and automatically opens it bound
- * to the specified endpoint on the local machine. The protocol used is the
- * protocol associated with the given endpoint.
- *
- * @param io_service The io_service object that the datagram socket will use
- * to dispatch handlers for any asynchronous operations performed on the
- * socket.
- *
- * @param endpoint An endpoint on the local machine to which the datagram
- * socket will be bound.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- basic_datagram_socket_ext(boost::asio::io_service& io_service,
- const endpoint_type& endpoint)
- : basic_socket<Protocol, DatagramSocketService>(io_service, endpoint)
- {
- }
-
- /// Construct a basic_datagram_socket on an existing native socket.
- /**
- * This constructor creates a datagram socket object to hold an existing
- * native socket.
- *
- * @param io_service The io_service object that the datagram socket will use
- * to dispatch handlers for any asynchronous operations performed on the
- * socket.
- *
- * @param protocol An object specifying protocol parameters to be used.
- *
- * @param native_socket The new underlying socket implementation.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- basic_datagram_socket_ext(boost::asio::io_service& io_service,
- const protocol_type& protocol, const native_handle_type& native_socket)
- : basic_socket<Protocol, DatagramSocketService>(
- io_service, protocol, native_socket)
- {
- }
-
-#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
- /// Move-construct a basic_datagram_socket from another.
- /**
- * This constructor moves a datagram socket from one object to another.
- *
- * @param other The other basic_datagram_socket object from which the move
- * will occur.
- *
- * @note Following the move, the moved-from object is in the same state as if
- * constructed using the @c basic_datagram_socket(io_service&) constructor.
- */
- basic_datagram_socket_ext(basic_datagram_socket_ext&& other)
- : basic_socket<Protocol, DatagramSocketService>(
- BOOST_ASIO_MOVE_CAST(basic_datagram_socket_ext)(other))
- {
- }
-
- /// Move-assign a basic_datagram_socket from another.
- /**
- * This assignment operator moves a datagram socket from one object to
- * another.
- *
- * @param other The other basic_datagram_socket object from which the move
- * will occur.
- *
- * @note Following the move, the moved-from object is in the same state as if
- * constructed using the @c basic_datagram_socket(io_service&) constructor.
- */
- basic_datagram_socket_ext& operator=(basic_datagram_socket_ext&& other)
- {
- basic_socket<Protocol, DatagramSocketService>::operator=(
- BOOST_ASIO_MOVE_CAST(basic_datagram_socket_ext)(other));
- return *this;
- }
-
- /// Move-construct a basic_datagram_socket from a socket of another protocol
- /// type.
- /**
- * This constructor moves a datagram socket from one object to another.
- *
- * @param other The other basic_datagram_socket object from which the move
- * will occur.
- *
- * @note Following the move, the moved-from object is in the same state as if
- * constructed using the @c basic_datagram_socket(io_service&) constructor.
- */
- template <typename Protocol1, typename DatagramSocketService1>
- basic_datagram_socket_ext(
- basic_datagram_socket_ext<Protocol1, DatagramSocketService1>&& other,
- typename enable_if<is_convertible<Protocol1, Protocol>::value>::type* = 0)
- : basic_socket<Protocol, DatagramSocketService>(
- BOOST_ASIO_MOVE_CAST2(basic_datagram_socket_ext<
- Protocol1, DatagramSocketService1>)(other))
- {
- }
-
- /// Move-assign a basic_datagram_socket from a socket of another protocol
- /// type.
- /**
- * This assignment operator moves a datagram socket from one object to
- * another.
- *
- * @param other The other basic_datagram_socket object from which the move
- * will occur.
- *
- * @note Following the move, the moved-from object is in the same state as if
- * constructed using the @c basic_datagram_socket(io_service&) constructor.
- */
- template <typename Protocol1, typename DatagramSocketService1>
- typename enable_if<is_convertible<Protocol1, Protocol>::value,
- basic_datagram_socket_ext>::type& operator=(
- basic_datagram_socket_ext<Protocol1, DatagramSocketService1>&& other)
- {
- basic_socket<Protocol, DatagramSocketService>::operator=(
- BOOST_ASIO_MOVE_CAST2(basic_datagram_socket_ext<
- Protocol1, DatagramSocketService1>)(other));
- return *this;
- }
-#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
-
- /// Send some data on a connected socket.
- /**
- * This function is used to send data on the datagram socket. The function
- * call will block until the data has been sent successfully or an error
- * occurs.
- *
- * @param buffers One ore more data buffers to be sent on the socket.
- *
- * @returns The number of bytes sent.
- *
- * @throws boost::system::system_error Thrown on failure.
- *
- * @note The send operation can only be used with a connected socket. Use
- * the send_to function to send data on an unconnected datagram socket.
- *
- * @par Example
- * To send a single data buffer use the @ref buffer function as follows:
- * @code socket.send(boost::asio::buffer(data, size)); @endcode
- * See the @ref buffer documentation for information on sending multiple
- * buffers in one go, and how to use it with arrays, boost::array or
- * std::vector.
- */
- template <typename ConstBufferSequence>
- std::size_t send(const ConstBufferSequence& buffers)
- {
- boost::system::error_code ec;
- std::size_t s = this->get_service().send(
- this->get_implementation(), buffers, 0, ec);
- boost::asio::detail::throw_error(ec, "send");
- return s;
- }
-
- /// Send some data on a connected socket.
- /**
- * This function is used to send data on the datagram socket. The function
- * call will block until the data has been sent successfully or an error
- * occurs.
- *
- * @param buffers One ore more data buffers to be sent on the socket.
- *
- * @param flags Flags specifying how the send call is to be made.
- *
- * @returns The number of bytes sent.
- *
- * @throws boost::system::system_error Thrown on failure.
- *
- * @note The send operation can only be used with a connected socket. Use
- * the send_to function to send data on an unconnected datagram socket.
- */
- template <typename ConstBufferSequence>
- std::size_t send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags)
- {
- boost::system::error_code ec;
- std::size_t s = this->get_service().send(
- this->get_implementation(), buffers, flags, ec);
- boost::asio::detail::throw_error(ec, "send");
- return s;
- }
-
- /// Send some data on a connected socket.
- /**
- * This function is used to send data on the datagram socket. The function
- * call will block until the data has been sent successfully or an error
- * occurs.
- *
- * @param buffers One or more data buffers to be sent on the socket.
- *
- * @param flags Flags specifying how the send call is to be made.
- *
- * @param ec Set to indicate what error occurred, if any.
- *
- * @returns The number of bytes sent.
- *
- * @note The send operation can only be used with a connected socket. Use
- * the send_to function to send data on an unconnected datagram socket.
- */
- template <typename ConstBufferSequence>
- std::size_t send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags, boost::system::error_code& ec)
- {
- return this->get_service().send(
- this->get_implementation(), buffers, flags, ec);
- }
-
- /// Start an asynchronous send on a connected socket.
- /**
- * This function is used to asynchronously send data on the datagram socket.
- * The function call always returns immediately.
- *
- * @param buffers One or more data buffers to be sent on the socket. Although
- * the buffers object may be copied as necessary, ownership of the underlying
- * memory blocks is retained by the caller, which must guarantee that they
- * remain valid until the handler is called.
- *
- * @param handler The handler to be called when the send operation completes.
- * Copies will be made of the handler as required. The function signature of
- * the handler must be:
- * @code void handler(
- * const boost::system::error_code& error, // Result of operation.
- * std::size_t bytes_transferred // Number of bytes sent.
- * ); @endcode
- * Regardless of whether the asynchronous operation completes immediately or
- * not, the handler will not be invoked from within this function. Invocation
- * of the handler will be performed in a manner equivalent to using
- * boost::asio::io_service::post().
- *
- * @note The async_send operation can only be used with a connected socket.
- * Use the async_send_to function to send data on an unconnected datagram
- * socket.
- *
- * @par Example
- * To send a single data buffer use the @ref buffer function as follows:
- * @code
- * socket.async_send(boost::asio::buffer(data, size), handler);
- * @endcode
- * See the @ref buffer documentation for information on sending multiple
- * buffers in one go, and how to use it with arrays, boost::array or
- * std::vector.
- */
- template <typename ConstBufferSequence, typename WriteHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
- void (boost::system::error_code, std::size_t))
- async_send(const ConstBufferSequence& buffers,
- BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
- {
- // If you get an error on the following line it means that your handler does
- // not meet the documented type requirements for a WriteHandler.
- BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
-
- return this->get_service().async_send(this->get_implementation(),
- buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
- }
-
- /// Start an asynchronous send on a connected socket.
- /**
- * This function is used to asynchronously send data on the datagram socket.
- * The function call always returns immediately.
- *
- * @param buffers One or more data buffers to be sent on the socket. Although
- * the buffers object may be copied as necessary, ownership of the underlying
- * memory blocks is retained by the caller, which must guarantee that they
- * remain valid until the handler is called.
- *
- * @param flags Flags specifying how the send call is to be made.
- *
- * @param handler The handler to be called when the send operation completes.
- * Copies will be made of the handler as required. The function signature of
- * the handler must be:
- * @code void handler(
- * const boost::system::error_code& error, // Result of operation.
- * std::size_t bytes_transferred // Number of bytes sent.
- * ); @endcode
- * Regardless of whether the asynchronous operation completes immediately or
- * not, the handler will not be invoked from within this function. Invocation
- * of the handler will be performed in a manner equivalent to using
- * boost::asio::io_service::post().
- *
- * @note The async_send operation can only be used with a connected socket.
- * Use the async_send_to function to send data on an unconnected datagram
- * socket.
- */
- template <typename ConstBufferSequence, typename WriteHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
- void (boost::system::error_code, std::size_t))
- async_send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags,
- BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
- {
- // If you get an error on the following line it means that your handler does
- // not meet the documented type requirements for a WriteHandler.
- BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
-
- return this->get_service().async_send(this->get_implementation(),
- buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
- }
-
- /// Send a datagram to the specified endpoint.
- /**
- * This function is used to send a datagram to the specified remote endpoint.
- * The function call will block until the data has been sent successfully or
- * an error occurs.
- *
- * @param buffers One or more data buffers to be sent to the remote endpoint.
- *
- * @param destination The remote endpoint to which the data will be sent.
- *
- * @returns The number of bytes sent.
- *
- * @throws boost::system::system_error Thrown on failure.
- *
- * @par Example
- * To send a single data buffer use the @ref buffer function as follows:
- * @code
- * boost::asio::ip::udp::endpoint destination(
- * boost::asio::ip::address::from_string("1.2.3.4"), 12345);
- * socket.send_to(boost::asio::buffer(data, size), destination);
- * @endcode
- * See the @ref buffer documentation for information on sending multiple
- * buffers in one go, and how to use it with arrays, boost::array or
- * std::vector.
- */
- template <typename ConstBufferSequence>
- std::size_t send_to(const ConstBufferSequence& buffers,
- const endpoint_type& destination)
- {
- boost::system::error_code ec;
- std::size_t s = this->get_service().send_to(
- this->get_implementation(), buffers, destination, 0, ec);
- boost::asio::detail::throw_error(ec, "send_to");
- return s;
- }
-
- /// Send a datagram to the specified endpoint.
- /**
- * This function is used to send a datagram to the specified remote endpoint.
- * The function call will block until the data has been sent successfully or
- * an error occurs.
- *
- * @param buffers One or more data buffers to be sent to the remote endpoint.
- *
- * @param destination The remote endpoint to which the data will be sent.
- *
- * @param flags Flags specifying how the send call is to be made.
- *
- * @returns The number of bytes sent.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- template <typename ConstBufferSequence>
- std::size_t send_to(const ConstBufferSequence& buffers,
- const endpoint_type& destination, socket_base::message_flags flags)
- {
- boost::system::error_code ec;
- std::size_t s = this->get_service().send_to(
- this->get_implementation(), buffers, destination, flags, ec);
- boost::asio::detail::throw_error(ec, "send_to");
- return s;
- }
-
- /// Send a datagram to the specified endpoint.
- /**
- * This function is used to send a datagram to the specified remote endpoint.
- * The function call will block until the data has been sent successfully or
- * an error occurs.
- *
- * @param buffers One or more data buffers to be sent to the remote endpoint.
- *
- * @param destination The remote endpoint to which the data will be sent.
- *
- * @param flags Flags specifying how the send call is to be made.
- *
- * @param ec Set to indicate what error occurred, if any.
- *
- * @returns The number of bytes sent.
- */
- template <typename ConstBufferSequence>
- std::size_t send_to(const ConstBufferSequence& buffers,
- const endpoint_type& destination, socket_base::message_flags flags,
- boost::system::error_code& ec)
- {
- return this->get_service().send_to(this->get_implementation(),
- buffers, destination, flags, ec);
- }
-
- /// Start an asynchronous send.
- /**
- * This function is used to asynchronously send a datagram to the specified
- * remote endpoint. The function call always returns immediately.
- *
- * @param buffers One or more data buffers to be sent to the remote endpoint.
- * Although the buffers object may be copied as necessary, ownership of the
- * underlying memory blocks is retained by the caller, which must guarantee
- * that they remain valid until the handler is called.
- *
- * @param destination The remote endpoint to which the data will be sent.
- * Copies will be made of the endpoint as required.
- *
- * @param handler The handler to be called when the send operation completes.
- * Copies will be made of the handler as required. The function signature of
- * the handler must be:
- * @code void handler(
- * const boost::system::error_code& error, // Result of operation.
- * std::size_t bytes_transferred // Number of bytes sent.
- * ); @endcode
- * Regardless of whether the asynchronous operation completes immediately or
- * not, the handler will not be invoked from within this function. Invocation
- * of the handler will be performed in a manner equivalent to using
- * boost::asio::io_service::post().
- *
- * @par Example
- * To send a single data buffer use the @ref buffer function as follows:
- * @code
- * boost::asio::ip::udp::endpoint destination(
- * boost::asio::ip::address::from_string("1.2.3.4"), 12345);
- * socket.async_send_to(
- * boost::asio::buffer(data, size), destination, handler);
- * @endcode
- * See the @ref buffer documentation for information on sending multiple
- * buffers in one go, and how to use it with arrays, boost::array or
- * std::vector.
- */
- template <typename ConstBufferSequence, typename WriteHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
- void (boost::system::error_code, std::size_t))
- async_send_to(const ConstBufferSequence& buffers,
- const endpoint_type& destination,
- BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
- {
- // If you get an error on the following line it means that your handler does
- // not meet the documented type requirements for a WriteHandler.
- BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
-
- return this->get_service().async_send_to(
- this->get_implementation(), buffers, destination, 0,
- BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
- }
-
- /// Start an asynchronous send.
- /**
- * This function is used to asynchronously send a datagram to the specified
- * remote endpoint. The function call always returns immediately.
- *
- * @param buffers One or more data buffers to be sent to the remote endpoint.
- * Although the buffers object may be copied as necessary, ownership of the
- * underlying memory blocks is retained by the caller, which must guarantee
- * that they remain valid until the handler is called.
- *
- * @param flags Flags specifying how the send call is to be made.
- *
- * @param destination The remote endpoint to which the data will be sent.
- * Copies will be made of the endpoint as required.
- *
- * @param handler The handler to be called when the send operation completes.
- * Copies will be made of the handler as required. The function signature of
- * the handler must be:
- * @code void handler(
- * const boost::system::error_code& error, // Result of operation.
- * std::size_t bytes_transferred // Number of bytes sent.
- * ); @endcode
- * Regardless of whether the asynchronous operation completes immediately or
- * not, the handler will not be invoked from within this function. Invocation
- * of the handler will be performed in a manner equivalent to using
- * boost::asio::io_service::post().
- */
- template <typename ConstBufferSequence, typename WriteHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
- void (boost::system::error_code, std::size_t))
- async_send_to(const ConstBufferSequence& buffers,
- const endpoint_type& destination, socket_base::message_flags flags,
- BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
- {
- // If you get an error on the following line it means that your handler does
- // not meet the documented type requirements for a WriteHandler.
- BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
-
- return this->get_service().async_send_to(
- this->get_implementation(), buffers, destination, flags,
- BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
- }
-
- /// Receive some data on a connected socket.
- /**
- * This function is used to receive data on the datagram socket. The function
- * call will block until data has been received successfully or an error
- * occurs.
- *
- * @param buffers One or more buffers into which the data will be received.
- *
- * @returns The number of bytes received.
- *
- * @throws boost::system::system_error Thrown on failure.
- *
- * @note The receive operation can only be used with a connected socket. Use
- * the receive_from function to receive data on an unconnected datagram
- * socket.
- *
- * @par Example
- * To receive into a single data buffer use the @ref buffer function as
- * follows:
- * @code socket.receive(boost::asio::buffer(data, size)); @endcode
- * See the @ref buffer documentation for information on receiving into
- * multiple buffers in one go, and how to use it with arrays, boost::array or
- * std::vector.
- */
- template <typename MutableBufferSequence>
- std::size_t receive(const MutableBufferSequence& buffers)
- {
- boost::system::error_code ec;
- std::size_t s = this->get_service().receive(
- this->get_implementation(), buffers, 0, ec);
- boost::asio::detail::throw_error(ec, "receive");
- return s;
- }
-
- /// Receive some data on a connected socket.
- /**
- * This function is used to receive data on the datagram socket. The function
- * call will block until data has been received successfully or an error
- * occurs.
- *
- * @param buffers One or more buffers into which the data will be received.
- *
- * @param flags Flags specifying how the receive call is to be made.
- *
- * @returns The number of bytes received.
- *
- * @throws boost::system::system_error Thrown on failure.
- *
- * @note The receive operation can only be used with a connected socket. Use
- * the receive_from function to receive data on an unconnected datagram
- * socket.
- */
- template <typename MutableBufferSequence>
- std::size_t receive(const MutableBufferSequence& buffers,
- socket_base::message_flags flags)
- {
- boost::system::error_code ec;
- std::size_t s = this->get_service().receive(
- this->get_implementation(), buffers, flags, ec);
- boost::asio::detail::throw_error(ec, "receive");
- return s;
- }
-
- /// Receive some data on a connected socket.
- /**
- * This function is used to receive data on the datagram socket. The function
- * call will block until data has been received successfully or an error
- * occurs.
- *
- * @param buffers One or more buffers into which the data will be received.
- *
- * @param flags Flags specifying how the receive call is to be made.
- *
- * @param ec Set to indicate what error occurred, if any.
- *
- * @returns The number of bytes received.
- *
- * @note The receive operation can only be used with a connected socket. Use
- * the receive_from function to receive data on an unconnected datagram
- * socket.
- */
- template <typename MutableBufferSequence>
- std::size_t receive(const MutableBufferSequence& buffers,
- socket_base::message_flags flags, boost::system::error_code& ec)
- {
- return this->get_service().receive(
- this->get_implementation(), buffers, flags, ec);
- }
-
- /// Start an asynchronous receive on a connected socket.
- /**
- * This function is used to asynchronously receive data from the datagram
- * socket. The function call always returns immediately.
- *
- * @param buffers One or more buffers into which the data will be received.
- * Although the buffers object may be copied as necessary, ownership of the
- * underlying memory blocks is retained by the caller, which must guarantee
- * that they remain valid until the handler is called.
- *
- * @param handler The handler to be called when the receive operation
- * completes. Copies will be made of the handler as required. The function
- * signature of the handler must be:
- * @code void handler(
- * const boost::system::error_code& error, // Result of operation.
- * std::size_t bytes_transferred // Number of bytes received.
- * ); @endcode
- * Regardless of whether the asynchronous operation completes immediately or
- * not, the handler will not be invoked from within this function. Invocation
- * of the handler will be performed in a manner equivalent to using
- * boost::asio::io_service::post().
- *
- * @note The async_receive operation can only be used with a connected socket.
- * Use the async_receive_from function to receive data on an unconnected
- * datagram socket.
- *
- * @par Example
- * To receive into a single data buffer use the @ref buffer function as
- * follows:
- * @code
- * socket.async_receive(boost::asio::buffer(data, size), handler);
- * @endcode
- * See the @ref buffer documentation for information on receiving into
- * multiple buffers in one go, and how to use it with arrays, boost::array or
- * std::vector.
- */
- template <typename MutableBufferSequence, typename ReadHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
- void (boost::system::error_code, std::size_t))
- async_receive(const MutableBufferSequence& buffers,
- BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
- {
- // If you get an error on the following line it means that your handler does
- // not meet the documented type requirements for a ReadHandler.
- BOOST_ASIO_READ_HANDLER_CHECK_EXT(ReadHandler, handler) type_check;
-
- return this->get_service().async_receive(this->get_implementation(),
- buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
- }
-
- /// Start an asynchronous receive on a connected socket.
- /**
- * This function is used to asynchronously receive data from the datagram
- * socket. The function call always returns immediately.
- *
- * @param buffers One or more buffers into which the data will be received.
- * Although the buffers object may be copied as necessary, ownership of the
- * underlying memory blocks is retained by the caller, which must guarantee
- * that they remain valid until the handler is called.
- *
- * @param flags Flags specifying how the receive call is to be made.
- *
- * @param handler The handler to be called when the receive operation
- * completes. Copies will be made of the handler as required. The function
- * signature of the handler must be:
- * @code void handler(
- * const boost::system::error_code& error, // Result of operation.
- * std::size_t bytes_transferred // Number of bytes received.
- * ); @endcode
- * Regardless of whether the asynchronous operation completes immediately or
- * not, the handler will not be invoked from within this function. Invocation
- * of the handler will be performed in a manner equivalent to using
- * boost::asio::io_service::post().
- *
- * @note The async_receive operation can only be used with a connected socket.
- * Use the async_receive_from function to receive data on an unconnected
- * datagram socket.
- */
- template <typename MutableBufferSequence, typename ReadHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
- void (boost::system::error_code, std::size_t))
- async_receive(const MutableBufferSequence& buffers,
- socket_base::message_flags flags,
- BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
- {
- // If you get an error on the following line it means that your handler does
- // not meet the documented type requirements for a ReadHandler.
- BOOST_ASIO_READ_HANDLER_CHECK_EXT(ReadHandler, handler) type_check;
-
- return this->get_service().async_receive(this->get_implementation(),
- buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
- }
-
- /// Receive a datagram with the endpoint of the sender.
- /**
- * This function is used to receive a datagram. The function call will block
- * until data has been received successfully or an error occurs.
- *
- * @param buffers One or more buffers into which the data will be received.
- *
- * @param sender_endpoint An endpoint object that receives the endpoint of
- * the remote sender of the datagram.
- *
- * @returns The number of bytes received.
- *
- * @throws boost::system::system_error Thrown on failure.
- *
- * @par Example
- * To receive into a single data buffer use the @ref buffer function as
- * follows:
- * @code
- * boost::asio::ip::udp::endpoint sender_endpoint;
- * socket.receive_from(
- * boost::asio::buffer(data, size), sender_endpoint);
- * @endcode
- * See the @ref buffer documentation for information on receiving into
- * multiple buffers in one go, and how to use it with arrays, boost::array or
- * std::vector.
- */
- template <typename MutableBufferSequence>
- std::size_t receive_from(const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint)
- {
- boost::system::error_code ec;
- std::size_t s = this->get_service().receive_from(
- this->get_implementation(), buffers, sender_endpoint, 0, ec);
- boost::asio::detail::throw_error(ec, "receive_from");
- return s;
- }
-
- /// Receive a datagram with the endpoint of the sender.
- /**
- * This function is used to receive a datagram. The function call will block
- * until data has been received successfully or an error occurs.
- *
- * @param buffers One or more buffers into which the data will be received.
- *
- * @param sender_endpoint An endpoint object that receives the endpoint of
- * the remote sender of the datagram.
- *
- * @param flags Flags specifying how the receive call is to be made.
- *
- * @returns The number of bytes received.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- template <typename MutableBufferSequence>
- std::size_t receive_from(const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint, socket_base::message_flags flags)
- {
- boost::system::error_code ec;
- std::size_t s = this->get_service().receive_from(
- this->get_implementation(), buffers, sender_endpoint, flags, ec);
- boost::asio::detail::throw_error(ec, "receive_from");
- return s;
- }
-
- /// Receive a datagram with the endpoint of the sender.
- /**
- * This function is used to receive a datagram. The function call will block
- * until data has been received successfully or an error occurs.
- *
- * @param buffers One or more buffers into which the data will be received.
- *
- * @param sender_endpoint An endpoint object that receives the endpoint of
- * the remote sender of the datagram.
- *
- * @param flags Flags specifying how the receive call is to be made.
- *
- * @param ec Set to indicate what error occurred, if any.
- *
- * @returns The number of bytes received.
- */
- template <typename MutableBufferSequence>
- std::size_t receive_from(const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint, socket_base::message_flags flags,
- boost::system::error_code& ec)
- {
- return this->get_service().receive_from(this->get_implementation(),
- buffers, sender_endpoint, flags, ec);
- }
-
- /// Start an asynchronous receive.
- /**
- * This function is used to asynchronously receive a datagram. The function
- * call always returns immediately.
- *
- * @param buffers One or more buffers into which the data will be received.
- * Although the buffers object may be copied as necessary, ownership of the
- * underlying memory blocks is retained by the caller, which must guarantee
- * that they remain valid until the handler is called.
- *
- * @param sender_endpoint An endpoint object that receives the endpoint of
- * the remote sender of the datagram. Ownership of the sender_endpoint object
- * is retained by the caller, which must guarantee that it is valid until the
- * handler is called.
- *
- * @param handler The handler to be called when the receive operation
- * completes. Copies will be made of the handler as required. The function
- * signature of the handler must be:
- * @code void handler(
- * const boost::system::error_code& error, // Result of operation.
- * std::size_t bytes_transferred // Number of bytes received.
- * ); @endcode
- * Regardless of whether the asynchronous operation completes immediately or
- * not, the handler will not be invoked from within this function. Invocation
- * of the handler will be performed in a manner equivalent to using
- * boost::asio::io_service::post().
- *
- * @par Example
- * To receive into a single data buffer use the @ref buffer function as
- * follows:
- * @code socket.async_receive_from(
- * boost::asio::buffer(data, size), sender_endpoint, handler); @endcode
- * See the @ref buffer documentation for information on receiving into
- * multiple buffers in one go, and how to use it with arrays, boost::array or
- * std::vector.
- */
- template <typename MutableBufferSequence, typename ReadHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
- void (boost::system::error_code, std::size_t, boost::asio::ip::address))
- async_receive_from(const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint,
- BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
- {
- // If you get an error on the following line it means that your handler does
- // not meet the documented type requirements for a ReadHandler.
- BOOST_ASIO_READ_HANDLER_CHECK_EXT(ReadHandler, handler) type_check;
-
- return this->get_service().async_receive_from(
- this->get_implementation(), buffers, sender_endpoint, 0,
- BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
- }
-
- /// Start an asynchronous receive.
- /**
- * This function is used to asynchronously receive a datagram. The function
- * call always returns immediately.
- *
- * @param buffers One or more buffers into which the data will be received.
- * Although the buffers object may be copied as necessary, ownership of the
- * underlying memory blocks is retained by the caller, which must guarantee
- * that they remain valid until the handler is called.
- *
- * @param sender_endpoint An endpoint object that receives the endpoint of
- * the remote sender of the datagram. Ownership of the sender_endpoint object
- * is retained by the caller, which must guarantee that it is valid until the
- * handler is called.
- *
- * @param flags Flags specifying how the receive call is to be made.
- *
- * @param handler The handler to be called when the receive operation
- * completes. Copies will be made of the handler as required. The function
- * signature of the handler must be:
- * @code void handler(
- * const boost::system::error_code& error, // Result of operation.
- * std::size_t bytes_transferred // Number of bytes received.
- * ); @endcode
- * Regardless of whether the asynchronous operation completes immediately or
- * not, the handler will not be invoked from within this function. Invocation
- * of the handler will be performed in a manner equivalent to using
- * boost::asio::io_service::post().
- */
- template <typename MutableBufferSequence, typename ReadHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
- void (boost::system::error_code, std::size_t, boost::asio::ip::address))
- async_receive_from(const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint, socket_base::message_flags flags,
- BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
- {
- // If you get an error on the following line it means that your handler does
- // not meet the documented type requirements for a ReadHandler.
- BOOST_ASIO_READ_HANDLER_CHECK_EXT(ReadHandler, handler) type_check;
-
- return this->get_service().async_receive_from(
- this->get_implementation(), buffers, sender_endpoint, flags,
- BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
- }
-};
-
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // BOOST_ASIO_BASIC_DATAGRAM_SOCKET_HPP
diff --git a/implementation/helper/boost/asio/datagram_socket_service_ext.hpp b/implementation/helper/boost/asio/datagram_socket_service_ext.hpp
deleted file mode 100644
index 3934e50..0000000
--- a/implementation/helper/boost/asio/datagram_socket_service_ext.hpp
+++ /dev/null
@@ -1,437 +0,0 @@
-//
-// datagram_socket_service_ext.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_EXT_ASIO_DATAGRAM_SOCKET_SERVICE_EXT_HPP
-#define BOOST_EXT_ASIO_DATAGRAM_SOCKET_SERVICE_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <iostream>
-
-#include <boost/asio/detail/config.hpp>
-#include <cstddef>
-#include <boost/asio/async_result.hpp>
-#include <boost/asio/detail/type_traits.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/asio/io_service.hpp>
-
-#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
-# include <boost/asio/detail/null_socket_service.hpp>
-#elif defined(BOOST_ASIO_HAS_IOCP)
-# include "detail/win_iocp_socket_service_ext.hpp"
-#else
-# include "detail/reactive_socket_service_ext.hpp"
-#endif
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-
-/// Default service implementation for a datagram socket.
-template <typename Protocol>
-class datagram_socket_service_ext
-#if defined(GENERATING_DOCUMENTATION)
- : public boost::asio::io_service::service
-#else
- : public boost::asio::detail::service_base<datagram_socket_service_ext<Protocol> >
-#endif
-{
-public:
-#if defined(GENERATING_DOCUMENTATION)
- /// The unique service identifier.
- static boost::asio::io_service::id id;
-#endif
-
- /// The protocol type.
- typedef Protocol protocol_type;
-
- /// The endpoint type.
- typedef typename Protocol::endpoint endpoint_type;
-
-private:
- // The type of the platform-specific implementation.
-#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
- typedef detail::null_socket_service<Protocol> service_impl_type;
-#elif defined(BOOST_ASIO_HAS_IOCP)
- typedef detail::win_iocp_socket_service_ext<Protocol> service_impl_type;
-#else
- typedef detail::reactive_socket_service_ext<Protocol> service_impl_type;
-#endif
-
-public:
- /// The type of a datagram socket.
-#if defined(GENERATING_DOCUMENTATION)
- typedef implementation_defined implementation_type;
-#else
- typedef typename service_impl_type::implementation_type implementation_type;
-#endif
-
- /// (Deprecated: Use native_handle_type.) The native socket type.
-#if defined(GENERATING_DOCUMENTATION)
- typedef implementation_defined native_type;
-#else
- typedef typename service_impl_type::native_handle_type native_type;
-#endif
-
- /// The native socket type.
-#if defined(GENERATING_DOCUMENTATION)
- typedef implementation_defined native_handle_type;
-#else
- typedef typename service_impl_type::native_handle_type native_handle_type;
-#endif
-
- /// Construct a new datagram socket service for the specified io_service.
- explicit datagram_socket_service_ext(boost::asio::io_service& io_service)
- : boost::asio::detail::service_base<
- datagram_socket_service_ext<Protocol> >(io_service),
- service_impl_(io_service)
- {
- }
-
- /// Construct a new datagram socket implementation.
- void construct(implementation_type& impl)
- {
- service_impl_.construct(impl);
- }
-
-#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
- /// Move-construct a new datagram socket implementation.
- void move_construct(implementation_type& impl,
- implementation_type& other_impl)
- {
- service_impl_.move_construct(impl, other_impl);
- }
-
- /// Move-assign from another datagram socket implementation.
- void move_assign(implementation_type& impl,
- datagram_socket_service_ext& other_service,
- implementation_type& other_impl)
- {
- service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
- }
-
- /// Move-construct a new datagram socket implementation from another protocol
- /// type.
- template <typename Protocol1>
- void converting_move_construct(implementation_type& impl,
- typename datagram_socket_service_ext<
- Protocol1>::implementation_type& other_impl,
- typename enable_if<is_convertible<
- Protocol1, Protocol>::value>::type* = 0)
- {
- service_impl_.template converting_move_construct<Protocol1>(
- impl, other_impl);
- }
-#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
-
- /// Destroy a datagram socket implementation.
- void destroy(implementation_type& impl)
- {
- service_impl_.destroy(impl);
- }
-
- // Open a new datagram socket implementation.
- boost::system::error_code open(implementation_type& impl,
- const protocol_type& protocol, boost::system::error_code& ec)
- {
- if (protocol.type() == BOOST_ASIO_OS_DEF(SOCK_DGRAM))
- service_impl_.open(impl, protocol, ec);
- else
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
-
- /// Assign an existing native socket to a datagram socket.
- boost::system::error_code assign(implementation_type& impl,
- const protocol_type& protocol, const native_handle_type& native_socket,
- boost::system::error_code& ec)
- {
- return service_impl_.assign(impl, protocol, native_socket, ec);
- }
-
- /// Determine whether the socket is open.
- bool is_open(const implementation_type& impl) const
- {
- return service_impl_.is_open(impl);
- }
-
- /// Close a datagram socket implementation.
- boost::system::error_code close(implementation_type& impl,
- boost::system::error_code& ec)
- {
- return service_impl_.close(impl, ec);
- }
-
- /// (Deprecated: Use native_handle().) Get the native socket implementation.
- native_type native(implementation_type& impl)
- {
- return service_impl_.native_handle(impl);
- }
-
- /// Get the native socket implementation.
- native_handle_type native_handle(implementation_type& impl)
- {
- return service_impl_.native_handle(impl);
- }
-
- /// Cancel all asynchronous operations associated with the socket.
- boost::system::error_code cancel(implementation_type& impl,
- boost::system::error_code& ec)
- {
- return service_impl_.cancel(impl, ec);
- }
-
- /// Determine whether the socket is at the out-of-band data mark.
- bool at_mark(const implementation_type& impl,
- boost::system::error_code& ec) const
- {
- return service_impl_.at_mark(impl, ec);
- }
-
- /// Determine the number of bytes available for reading.
- std::size_t available(const implementation_type& impl,
- boost::system::error_code& ec) const
- {
- return service_impl_.available(impl, ec);
- }
-
- // Bind the datagram socket to the specified local endpoint.
- boost::system::error_code bind(implementation_type& impl,
- const endpoint_type& endpoint, boost::system::error_code& ec)
- {
- return service_impl_.bind(impl, endpoint, ec);
- }
-
- /// Connect the datagram socket to the specified endpoint.
- boost::system::error_code connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, boost::system::error_code& ec)
- {
- return service_impl_.connect(impl, peer_endpoint, ec);
- }
-
- /// Start an asynchronous connect.
- template <typename ConnectHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(ConnectHandler,
- void (boost::system::error_code))
- async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint,
- BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
- {
- detail::async_result_init<
- ConnectHandler, void (boost::system::error_code)> init(
- BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
-
- service_impl_.async_connect(impl, peer_endpoint, init.handler);
-
- return init.result.get();
- }
-
- /// Set a socket option.
- template <typename SettableSocketOption>
- boost::system::error_code set_option(implementation_type& impl,
- const SettableSocketOption& option, boost::system::error_code& ec)
- {
- return service_impl_.set_option(impl, option, ec);
- }
-
- /// Get a socket option.
- template <typename GettableSocketOption>
- boost::system::error_code get_option(const implementation_type& impl,
- GettableSocketOption& option, boost::system::error_code& ec) const
- {
- return service_impl_.get_option(impl, option, ec);
- }
-
- /// Perform an IO control command on the socket.
- template <typename IoControlCommand>
- boost::system::error_code io_control(implementation_type& impl,
- IoControlCommand& command, boost::system::error_code& ec)
- {
- return service_impl_.io_control(impl, command, ec);
- }
-
- /// Gets the non-blocking mode of the socket.
- bool non_blocking(const implementation_type& impl) const
- {
- return service_impl_.non_blocking(impl);
- }
-
- /// Sets the non-blocking mode of the socket.
- boost::system::error_code non_blocking(implementation_type& impl,
- bool mode, boost::system::error_code& ec)
- {
- return service_impl_.non_blocking(impl, mode, ec);
- }
-
- /// Gets the non-blocking mode of the native socket implementation.
- bool native_non_blocking(const implementation_type& impl) const
- {
- return service_impl_.native_non_blocking(impl);
- }
-
- /// Sets the non-blocking mode of the native socket implementation.
- boost::system::error_code native_non_blocking(implementation_type& impl,
- bool mode, boost::system::error_code& ec)
- {
- return service_impl_.native_non_blocking(impl, mode, ec);
- }
-
- /// Get the local endpoint.
- endpoint_type local_endpoint(const implementation_type& impl,
- boost::system::error_code& ec) const
- {
- return service_impl_.local_endpoint(impl, ec);
- }
-
- /// Get the remote endpoint.
- endpoint_type remote_endpoint(const implementation_type& impl,
- boost::system::error_code& ec) const
- {
- return service_impl_.remote_endpoint(impl, ec);
- }
-
- /// Disable sends or receives on the socket.
- boost::system::error_code shutdown(implementation_type& impl,
- socket_base::shutdown_type what, boost::system::error_code& ec)
- {
- return service_impl_.shutdown(impl, what, ec);
- }
-
- /// Send the given data to the peer.
- template <typename ConstBufferSequence>
- std::size_t send(implementation_type& impl,
- const ConstBufferSequence& buffers,
- socket_base::message_flags flags, boost::system::error_code& ec)
- {
- return service_impl_.send(impl, buffers, flags, ec);
- }
-
- /// Start an asynchronous send.
- template <typename ConstBufferSequence, typename WriteHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
- void (boost::system::error_code, std::size_t))
- async_send(implementation_type& impl, const ConstBufferSequence& buffers,
- socket_base::message_flags flags,
- BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
- {
- detail::async_result_init<
- WriteHandler, void (boost::system::error_code, std::size_t)> init(
- BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
-
- service_impl_.async_send(impl, buffers, flags, init.handler);
-
- return init.result.get();
- }
-
- /// Send a datagram to the specified endpoint.
- template <typename ConstBufferSequence>
- std::size_t send_to(implementation_type& impl,
- const ConstBufferSequence& buffers, const endpoint_type& destination,
- socket_base::message_flags flags, boost::system::error_code& ec)
- {
- return service_impl_.send_to(impl, buffers, destination, flags, ec);
- }
-
- /// Start an asynchronous send.
- template <typename ConstBufferSequence, typename WriteHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
- void (boost::system::error_code, std::size_t))
- async_send_to(implementation_type& impl,
- const ConstBufferSequence& buffers, const endpoint_type& destination,
- socket_base::message_flags flags,
- BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
- {
- detail::async_result_init<
- WriteHandler, void (boost::system::error_code, std::size_t)> init(
- BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
-
- service_impl_.async_send_to(impl, buffers,
- destination, flags, init.handler);
-
- return init.result.get();
- }
-
- /// Receive some data from the peer.
- template <typename MutableBufferSequence>
- std::size_t receive(implementation_type& impl,
- const MutableBufferSequence& buffers,
- socket_base::message_flags flags, boost::system::error_code& ec)
- {
- return service_impl_.receive(impl, buffers, flags, ec);
- }
-
- /// Start an asynchronous receive.
- template <typename MutableBufferSequence, typename ReadHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
- void (boost::system::error_code, std::size_t))
- async_receive(implementation_type& impl,
- const MutableBufferSequence& buffers,
- socket_base::message_flags flags,
- BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
- {
- detail::async_result_init<
- ReadHandler, void (boost::system::error_code, std::size_t)> init(
- BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
-
- service_impl_.async_receive(impl, buffers, flags, init.handler);
-
- return init.result.get();
- }
-
- /// Receive a datagram with the endpoint of the sender.
- template <typename MutableBufferSequence>
- std::size_t receive_from(implementation_type& impl,
- const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, boost::system::error_code& ec)
- {
- return service_impl_.receive_from(impl, buffers, sender_endpoint, flags,
- ec);
- }
-
- /// Start an asynchronous receive that will get the endpoint of the sender.
- template <typename MutableBufferSequence, typename ReadHandler>
- BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
- void (boost::system::error_code, std::size_t, boost::asio::ip::address))
- async_receive_from(implementation_type& impl,
- const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
- socket_base::message_flags flags,
- BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
- {
- detail::async_result_init<
- ReadHandler, void (boost::system::error_code, std::size_t)> init(
- BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
-
- service_impl_.async_receive_from(impl, buffers,
- sender_endpoint, flags, init.handler);
-
- return init.result.get();
- }
-
-private:
- // Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
- // The platform-specific implementation.
- service_impl_type service_impl_;
-};
-
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // BOOST_ASIO_DATAGRAM_SOCKET_SERVICE_HPP
diff --git a/implementation/helper/boost/asio/detail/handler_type_requirements_ext.hpp b/implementation/helper/boost/asio/detail/handler_type_requirements_ext.hpp
deleted file mode 100644
index 1e16823..0000000
--- a/implementation/helper/boost/asio/detail/handler_type_requirements_ext.hpp
+++ /dev/null
@@ -1,520 +0,0 @@
-//
-// detail/handler_type_requirements_ext.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_EXT_HPP
-#define BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/config.hpp>
-
-// Older versions of gcc have difficulty compiling the sizeof expressions where
-// we test the handler type requirements. We'll disable checking of handler type
-// requirements for those compilers, but otherwise enable it by default.
-#if !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
-# if !defined(__GNUC__) || (__GNUC__ >= 4)
-# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS 1
-# endif // !defined(__GNUC__) || (__GNUC__ >= 4)
-#endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
-
-// With C++0x we can use a combination of enhanced SFINAE and static_assert to
-// generate better template error messages. As this technique is not yet widely
-// portable, we'll only enable it for tested compilers.
-#if !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# if defined(BOOST_ASIO_MSVC)
-# if (_MSC_VER >= 1600)
-# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1
-# endif // (_MSC_VER >= 1600)
-# endif // defined(BOOST_ASIO_MSVC)
-# if defined(__clang__)
-# if __has_feature(__cxx_static_assert__)
-# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1
-# endif // __has_feature(cxx_static_assert)
-# endif // defined(__clang__)
-#endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
-
-#if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
-# include <boost/asio/handler_type.hpp>
-#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
-
-// Newer gcc, clang need special treatment to suppress unused typedef warnings.
-#if defined(__clang__)
-# if defined(__apple_build_version__)
-# if (__clang_major__ >= 7)
-# if !defined(BOOST_ASIO_UNUSED_TYPEDEF)
-# define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
-# endif
-# endif // (__clang_major__ >= 7)
-# elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \
- || (__clang_major__ > 3)
-# if !defined(BOOST_ASIO_UNUSED_TYPEDEF)
-# define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
-# endif
-# endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6))
- // || (__clang_major__ > 3)
-#elif defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
-# define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
-#endif // defined(__GNUC__)
-#if !defined(BOOST_ASIO_UNUSED_TYPEDEF)
-# define BOOST_ASIO_UNUSED_TYPEDEF
-#endif // !defined(BOOST_ASIO_UNUSED_TYPEDEF)
-
-namespace boost {
-namespace asio {
-namespace detail {
-
-#if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
-
-# if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
-
-template <typename Handler>
-auto zero_arg_handler_test(Handler h, void*)
- -> decltype(
- sizeof(Handler(static_cast<const Handler&>(h))),
- ((h)()),
- char(0));
-
-template <typename Handler>
-char (&zero_arg_handler_test(Handler, ...))[2];
-
-template <typename Handler, typename Arg1>
-auto one_arg_handler_test(Handler h, Arg1* a1)
- -> decltype(
- sizeof(Handler(static_cast<const Handler&>(h))),
- ((h)(*a1)),
- char(0));
-
-template <typename Handler>
-char (&one_arg_handler_test(Handler h, ...))[2];
-
-template <typename Handler, typename Arg1, typename Arg2>
-auto two_arg_handler_test(Handler h, Arg1* a1, Arg2* a2)
- -> decltype(
- sizeof(Handler(static_cast<const Handler&>(h))),
- ((h)(*a1, *a2)),
- char(0));
-
-template <typename Handler>
-char (&two_arg_handler_test(Handler, ...))[2];
-
-template <typename Handler, typename Arg1, typename Arg2, typename Arg3>
-auto three_arg_handler_test(Handler h, Arg1* a1, Arg2* a2, Arg3* a3)
- -> decltype(
- sizeof(Handler(static_cast<const Handler&>(h))),
- ((h)(*a1, *a2, *a3)),
- char(0));
-
-template <typename Handler>
-char (&three_arg_handler_test(Handler, ...))[2];
-
-# define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg) \
- static_assert(expr, msg);
-
-# else // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
-
-# define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg)
-
-# endif // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
-
-template <typename T> T& lvref();
-template <typename T> T& lvref(T);
-template <typename T> const T& clvref();
-template <typename T> const T& clvref(T);
-template <typename T> char argbyv(T);
-
-#if 0
-template <int>
-struct handler_type_requirements
-{
-};
-#endif
-
-#define BOOST_ASIO_COMPLETION_HANDLER_CHECK( \
- handler_type, handler) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void()) asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::zero_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), 0)) == 1, \
- "CompletionHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()(), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_READ_HANDLER_CHECK_EXT( \
- handler_type, handler) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code, std::size_t, \
- boost::asio::ip::address)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::three_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0), \
- static_cast<const std::size_t*>(0), \
- static_cast<const boost::asio::ip::address*>(0))) == 1, \
- "ReadHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>(), \
- boost::asio::detail::lvref<const std::size_t>(), \
- boost::asio::detail::lvref<const boost::asio::ip::address>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-
-#define BOOST_ASIO_WRITE_HANDLER_CHECK( \
- handler_type, handler) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code, std::size_t)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::two_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0), \
- static_cast<const std::size_t*>(0))) == 1, \
- "WriteHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>(), \
- boost::asio::detail::lvref<const std::size_t>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_ACCEPT_HANDLER_CHECK( \
- handler_type, handler) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::one_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0))) == 1, \
- "AcceptHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_CONNECT_HANDLER_CHECK( \
- handler_type, handler) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::one_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0))) == 1, \
- "ConnectHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( \
- handler_type, handler, iter_type) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code, iter_type)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::two_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0), \
- static_cast<const iter_type*>(0))) == 1, \
- "ComposedConnectHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>(), \
- boost::asio::detail::lvref<const iter_type>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_RESOLVE_HANDLER_CHECK( \
- handler_type, handler, iter_type) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code, iter_type)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::two_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0), \
- static_cast<const iter_type*>(0))) == 1, \
- "ResolveHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>(), \
- boost::asio::detail::lvref<const iter_type>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_WAIT_HANDLER_CHECK( \
- handler_type, handler) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::one_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0))) == 1, \
- "WaitHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_SIGNAL_HANDLER_CHECK( \
- handler_type, handler) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code, int)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::two_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0), \
- static_cast<const int*>(0))) == 1, \
- "SignalHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>(), \
- boost::asio::detail::lvref<const int>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_HANDSHAKE_HANDLER_CHECK( \
- handler_type, handler) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::one_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0))) == 1, \
- "HandshakeHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_BUFFERED_HANDSHAKE_HANDLER_CHECK( \
- handler_type, handler) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code, std::size_t)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::two_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0), \
- static_cast<const std::size_t*>(0))) == 1, \
- "BufferedHandshakeHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>(), \
- boost::asio::detail::lvref<const std::size_t>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_SHUTDOWN_HANDLER_CHECK( \
- handler_type, handler) \
- \
- typedef BOOST_ASIO_HANDLER_TYPE(handler_type, \
- void(boost::system::error_code)) \
- asio_true_handler_type; \
- \
- BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
- sizeof(boost::asio::detail::one_arg_handler_test( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>(), \
- static_cast<const boost::system::error_code*>(0))) == 1, \
- "ShutdownHandler type requirements not met") \
- \
- typedef boost::asio::detail::handler_type_requirements< \
- sizeof( \
- boost::asio::detail::argbyv( \
- boost::asio::detail::clvref< \
- asio_true_handler_type>())) + \
- sizeof( \
- boost::asio::detail::lvref< \
- asio_true_handler_type>()( \
- boost::asio::detail::lvref<const boost::system::error_code>()), \
- char(0))> BOOST_ASIO_UNUSED_TYPEDEF
-
-#else // !defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
-
-#define BOOST_ASIO_COMPLETION_HANDLER_CHECK( \
- handler_type, handler) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_READ_HANDLER_CHECK( \
- handler_type, handler) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_WRITE_HANDLER_CHECK( \
- handler_type, handler) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_ACCEPT_HANDLER_CHECK( \
- handler_type, handler) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_CONNECT_HANDLER_CHECK( \
- handler_type, handler) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( \
- handler_type, handler, iter_type) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_RESOLVE_HANDLER_CHECK( \
- handler_type, handler, iter_type) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_WAIT_HANDLER_CHECK( \
- handler_type, handler) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_SIGNAL_HANDLER_CHECK( \
- handler_type, handler) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_HANDSHAKE_HANDLER_CHECK( \
- handler_type, handler) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_BUFFERED_HANDSHAKE_HANDLER_CHECK( \
- handler_type, handler) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#define BOOST_ASIO_SHUTDOWN_HANDLER_CHECK( \
- handler_type, handler) \
- typedef int BOOST_ASIO_UNUSED_TYPEDEF
-
-#endif // !defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
-
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-#endif // BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_EXT_HPP
diff --git a/implementation/helper/boost/asio/detail/impl/reactive_socket_service_base_ext.ipp b/implementation/helper/boost/asio/detail/impl/reactive_socket_service_base_ext.ipp
deleted file mode 100644
index 57f983c..0000000
--- a/implementation/helper/boost/asio/detail/impl/reactive_socket_service_base_ext.ipp
+++ /dev/null
@@ -1,270 +0,0 @@
-//
-// detail/reactive_socket_service_base_ext.ipp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_DETAIL_IMPL_REACTIVE_SOCKET_SERVICE_BASE_EXT_IPP
-#define BOOST_ASIO_DETAIL_IMPL_REACTIVE_SOCKET_SERVICE_BASE_EXT_IPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/config.hpp>
-
-#if !defined(BOOST_ASIO_HAS_IOCP) \
- && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
-
-#include <boost/asio/detail/reactive_socket_service_base_ext.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace detail {
-
-reactive_socket_service_base_ext::reactive_socket_service_base_ext(
- boost::asio::io_service& io_service)
- : reactor_(use_service<reactor>(io_service))
-{
- reactor_.init_task();
-}
-
-void reactive_socket_service_base_ext::shutdown_service()
-{
-}
-
-void reactive_socket_service_base_ext::construct(
- reactive_socket_service_base_ext::base_implementation_type& impl)
-{
- impl.socket_ = invalid_socket;
- impl.state_ = 0;
-}
-
-void reactive_socket_service_base_ext::base_move_construct(
- reactive_socket_service_base_ext::base_implementation_type& impl,
- reactive_socket_service_base_ext::base_implementation_type& other_impl)
-{
- impl.socket_ = other_impl.socket_;
- other_impl.socket_ = invalid_socket;
-
- impl.state_ = other_impl.state_;
- other_impl.state_ = 0;
-
- reactor_.move_descriptor(impl.socket_,
- impl.reactor_data_, other_impl.reactor_data_);
-}
-
-void reactive_socket_service_base_ext::base_move_assign(
- reactive_socket_service_base_ext::base_implementation_type& impl,
- reactive_socket_service_base_ext& other_service,
- reactive_socket_service_base_ext::base_implementation_type& other_impl)
-{
- destroy(impl);
-
- impl.socket_ = other_impl.socket_;
- other_impl.socket_ = invalid_socket;
-
- impl.state_ = other_impl.state_;
- other_impl.state_ = 0;
-
- other_service.reactor_.move_descriptor(impl.socket_,
- impl.reactor_data_, other_impl.reactor_data_);
-}
-
-void reactive_socket_service_base_ext::destroy(
- reactive_socket_service_base_ext::base_implementation_type& impl)
-{
- if (impl.socket_ != invalid_socket)
- {
- BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close"));
-
- reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_,
- (impl.state_ & socket_ops::possible_dup) == 0);
-
- boost::system::error_code ignored_ec;
- socket_ops::close(impl.socket_, impl.state_, true, ignored_ec);
- }
-}
-
-boost::system::error_code reactive_socket_service_base_ext::close(
- reactive_socket_service_base_ext::base_implementation_type& impl,
- boost::system::error_code& ec)
-{
- if (is_open(impl))
- {
- BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close"));
-
- reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_,
- (impl.state_ & socket_ops::possible_dup) == 0);
- }
-
- socket_ops::close(impl.socket_, impl.state_, false, ec);
-
- // The descriptor is closed by the OS even if close() returns an error.
- //
- // (Actually, POSIX says the state of the descriptor is unspecified. On
- // Linux the descriptor is apparently closed anyway; e.g. see
- // http://lkml.org/lkml/2005/9/10/129
- // We'll just have to assume that other OSes follow the same behaviour. The
- // known exception is when Windows's closesocket() function fails with
- // WSAEWOULDBLOCK, but this case is handled inside socket_ops::close().
- construct(impl);
-
- return ec;
-}
-
-boost::system::error_code reactive_socket_service_base_ext::cancel(
- reactive_socket_service_base_ext::base_implementation_type& impl,
- boost::system::error_code& ec)
-{
- if (!is_open(impl))
- {
- ec = boost::asio::error::bad_descriptor;
- return ec;
- }
-
- BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "cancel"));
-
- reactor_.cancel_ops(impl.socket_, impl.reactor_data_);
- ec = boost::system::error_code();
- return ec;
-}
-
-boost::system::error_code reactive_socket_service_base_ext::do_open(
- reactive_socket_service_base_ext::base_implementation_type& impl,
- int af, int type, int protocol, boost::system::error_code& ec)
-{
- if (is_open(impl))
- {
- ec = boost::asio::error::already_open;
- return ec;
- }
-
- socket_holder sock(socket_ops::socket(af, type, protocol, ec));
- if (sock.get() == invalid_socket)
- return ec;
-
- if (int err = reactor_.register_descriptor(sock.get(), impl.reactor_data_))
- {
- ec = boost::system::error_code(err,
- boost::asio::error::get_system_category());
- return ec;
- }
-
- impl.socket_ = sock.release();
- switch (type)
- {
- case SOCK_STREAM: impl.state_ = socket_ops::stream_oriented; break;
- case SOCK_DGRAM: impl.state_ = socket_ops::datagram_oriented; break;
- default: impl.state_ = 0; break;
- }
- ec = boost::system::error_code();
- return ec;
-}
-
-boost::system::error_code reactive_socket_service_base_ext::do_assign(
- reactive_socket_service_base_ext::base_implementation_type& impl, int type,
- const reactive_socket_service_base_ext::native_handle_type& native_socket,
- boost::system::error_code& ec)
-{
- if (is_open(impl))
- {
- ec = boost::asio::error::already_open;
- return ec;
- }
-
- if (int err = reactor_.register_descriptor(
- native_socket, impl.reactor_data_))
- {
- ec = boost::system::error_code(err,
- boost::asio::error::get_system_category());
- return ec;
- }
-
- impl.socket_ = native_socket;
- switch (type)
- {
- case SOCK_STREAM: impl.state_ = socket_ops::stream_oriented; break;
- case SOCK_DGRAM: impl.state_ = socket_ops::datagram_oriented; break;
- default: impl.state_ = 0; break;
- }
- impl.state_ |= socket_ops::possible_dup;
- ec = boost::system::error_code();
- return ec;
-}
-
-void reactive_socket_service_base_ext::start_op(
- reactive_socket_service_base_ext::base_implementation_type& impl,
- int op_type, reactor_op* op, bool is_continuation,
- bool is_non_blocking, bool noop)
-{
- if (!noop)
- {
- if ((impl.state_ & socket_ops::non_blocking)
- || socket_ops::set_internal_non_blocking(
- impl.socket_, impl.state_, true, op->ec_))
- {
- reactor_.start_op(op_type, impl.socket_,
- impl.reactor_data_, op, is_continuation, is_non_blocking);
- return;
- }
- }
-
- reactor_.post_immediate_completion(op, is_continuation);
-}
-
-void reactive_socket_service_base_ext::start_accept_op(
- reactive_socket_service_base_ext::base_implementation_type& impl,
- reactor_op* op, bool is_continuation, bool peer_is_open)
-{
- if (!peer_is_open)
- start_op(impl, reactor::read_op, op, true, is_continuation, false);
- else
- {
- op->ec_ = boost::asio::error::already_open;
- reactor_.post_immediate_completion(op, is_continuation);
- }
-}
-
-void reactive_socket_service_base_ext::start_connect_op(
- reactive_socket_service_base_ext::base_implementation_type& impl,
- reactor_op* op, bool is_continuation,
- const socket_addr_type* addr, size_t addrlen)
-{
- if ((impl.state_ & socket_ops::non_blocking)
- || socket_ops::set_internal_non_blocking(
- impl.socket_, impl.state_, true, op->ec_))
- {
- if (socket_ops::connect(impl.socket_, addr, addrlen, op->ec_) != 0)
- {
- if (op->ec_ == boost::asio::error::in_progress
- || op->ec_ == boost::asio::error::would_block)
- {
- op->ec_ = boost::system::error_code();
- reactor_.start_op(reactor::connect_op, impl.socket_,
- impl.reactor_data_, op, is_continuation, false);
- return;
- }
- }
- }
-
- reactor_.post_immediate_completion(op, is_continuation);
-}
-
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // !defined(BOOST_ASIO_HAS_IOCP)
- // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
-
-#endif // BOOST_ASIO_DETAIL_IMPL_REACTIVE_SOCKET_SERVICE_BASE_EXT_IPP
diff --git a/implementation/helper/boost/asio/detail/impl/socket_ops_ext.ipp b/implementation/helper/boost/asio/detail/impl/socket_ops_ext.ipp
deleted file mode 100644
index 6772b77..0000000
--- a/implementation/helper/boost/asio/detail/impl/socket_ops_ext.ipp
+++ /dev/null
@@ -1,210 +0,0 @@
-//
-// detail/impl/socket_ops_ext.ipp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_DETAIL_SOCKET_OPS_EXT_IPP
-#define BOOST_ASIO_DETAIL_SOCKET_OPS_EXT_IPP
-
-#include <boost/asio/detail/impl/socket_ops.ipp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace detail {
-namespace socket_ops {
-
-signed_size_type recvfrom(socket_type s, buf* bufs, size_t count,
- int flags, socket_addr_type* addr, std::size_t* addrlen,
- boost::system::error_code& ec, boost::asio::ip::address& da)
-{
- clear_last_error();
-#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
- GUID WSARecvMsg_GUID = WSAID_WSARECVMSG;
- LPFN_WSARECVMSG WSARecvMsg;
- DWORD NumberOfBytes;
-
- error_wrapper(WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER,
- &WSARecvMsg_GUID, sizeof WSARecvMsg_GUID,
- &WSARecvMsg, sizeof WSARecvMsg,
- &NumberOfBytes, NULL, NULL), ec);
- if (ec.value() == SOCKET_ERROR) {
- WSARecvMsg = NULL;
- return 0;
- }
-
- WSABUF wsaBuf;
- WSAMSG msg;
- char controlBuffer[1024];
- msg.name = addr;
- msg.namelen = *addrlen;
- wsaBuf.buf = bufs->buf;
- wsaBuf.len = bufs->len;
- msg.lpBuffers = &wsaBuf;
- msg.dwBufferCount = count;
- msg.Control.len = sizeof controlBuffer;
- msg.Control.buf = controlBuffer;
- msg.dwFlags = flags;
-
- DWORD dwNumberOfBytesRecvd;
- signed_size_type result = error_wrapper(WSARecvMsg(s, &msg, &dwNumberOfBytesRecvd, NULL, NULL), ec);
-
- if (result >= 0) {
- ec = boost::system::error_code();
-
- // Find destination address
- for (LPWSACMSGHDR cmsg = WSA_CMSG_FIRSTHDR(&msg);
- cmsg != NULL;
- cmsg = WSA_CMSG_NXTHDR(&msg, cmsg))
- {
- if (cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_PKTINFO)
- continue;
-
- struct in_pktinfo *pi = (struct in_pktinfo *) WSA_CMSG_DATA(cmsg);
- if (pi)
- {
- da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr));
- }
- }
- } else {
- dwNumberOfBytesRecvd = -1;
- }
- return dwNumberOfBytesRecvd;
-#else // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
- char cmbuf[0x100];
- msghdr msg = msghdr();
- init_msghdr_msg_name(msg.msg_name, addr);
- msg.msg_namelen = static_cast<int>(*addrlen);
- msg.msg_iov = bufs;
- msg.msg_iovlen = static_cast<int>(count);
- msg.msg_control = cmbuf;
- msg.msg_controllen = sizeof(cmbuf);
- signed_size_type result = error_wrapper(::recvmsg(s, &msg, flags), ec);
- *addrlen = msg.msg_namelen;
- if (result >= 0) {
- ec = boost::system::error_code();
-
- // Find destination address
- for (struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg);
- cmsg != NULL;
- cmsg = CMSG_NXTHDR(&msg, cmsg))
- {
- if (cmsg->cmsg_level != IPPROTO_IP || cmsg->cmsg_type != IP_PKTINFO)
- continue;
-
- struct in_pktinfo *pi = (struct in_pktinfo *) CMSG_DATA(cmsg);
- if (pi)
- {
- da = boost::asio::ip::address_v4(ntohl(pi->ipi_addr.s_addr));
- }
- }
- }
- return result;
-#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
-}
-
-size_t sync_recvfrom(socket_type s, state_type state, buf* bufs,
- size_t count, int flags, socket_addr_type* addr,
- std::size_t* addrlen, boost::system::error_code& ec, boost::asio::ip::address& da)
-{
- if (s == invalid_socket)
- {
- ec = boost::asio::error::bad_descriptor;
- return 0;
- }
-
- // Read some data.
- for (;;)
- {
- // Try to complete the operation without blocking.
- signed_size_type bytes = socket_ops::recvfrom(
- s, bufs, count, flags, addr, addrlen, ec, da);
-
- // Check if operation succeeded.
- if (bytes >= 0)
- return bytes;
-
- // Operation failed.
- if ((state & user_set_non_blocking)
- || (ec != boost::asio::error::would_block
- && ec != boost::asio::error::try_again))
- return 0;
-
- // Wait for socket to become ready.
- if (socket_ops::poll_read(s, 0, ec) < 0)
- return 0;
- }
-}
-
-#if defined(BOOST_ASIO_HAS_IOCP)
-
-void complete_iocp_recvfrom(
- const weak_cancel_token_type& cancel_token,
- boost::system::error_code& ec, boost::asio::ip::address& da)
-{
- // Map non-portable errors to their portable counterparts.
- if (ec.value() == ERROR_NETNAME_DELETED)
- {
- if (cancel_token.expired())
- ec = boost::asio::error::operation_aborted;
- else
- ec = boost::asio::error::connection_reset;
- }
- else if (ec.value() == ERROR_PORT_UNREACHABLE)
- {
- ec = boost::asio::error::connection_refused;
- }
-}
-
-#else // defined(BOOST_ASIO_HAS_IOCP)
-
-bool non_blocking_recvfrom(socket_type s,
- buf* bufs, size_t count, int flags,
- socket_addr_type* addr, std::size_t* addrlen,
- boost::system::error_code& ec, size_t& bytes_transferred, boost::asio::ip::address& da)
-{
- for (;;)
- {
- // Read some data.
- signed_size_type bytes = socket_ops::recvfrom(
- s, bufs, count, flags, addr, addrlen, ec, da);
-
- // Retry operation if interrupted by signal.
- if (ec == boost::asio::error::interrupted)
- continue;
-
- // Check if we need to run the operation again.
- if (ec == boost::asio::error::would_block
- || ec == boost::asio::error::try_again)
- return false;
-
- // Operation is complete.
- if (bytes >= 0)
- {
- ec = boost::system::error_code();
- bytes_transferred = bytes;
- }
- else
- bytes_transferred = 0;
-
- return true;
- }
-}
-
-#endif // defined(BOOST_ASIO_HAS_IOCP)
-
-} // namespace socket_ops
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // BOOST_ASIO_DETAIL_SOCKET_OPS_EXT_IPP
diff --git a/implementation/helper/boost/asio/detail/reactive_socket_recv_op_ext.hpp b/implementation/helper/boost/asio/detail/reactive_socket_recv_op_ext.hpp
deleted file mode 100644
index b51ce24..0000000
--- a/implementation/helper/boost/asio/detail/reactive_socket_recv_op_ext.hpp
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// detail/reactive_socket_recv_op_ext.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECV_OP_EXT_HPP
-#define BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECV_OP_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/config.hpp>
-#include <boost/asio/detail/addressof.hpp>
-#include <boost/asio/detail/bind_handler.hpp>
-#include <boost/asio/detail/buffer_sequence_adapter.hpp>
-#include <boost/asio/detail/fenced_block.hpp>
-#include <boost/asio/detail/reactor_op_ext.hpp>
-#include <boost/asio/detail/socket_ops_ext.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace detail {
-
-template <typename MutableBufferSequence>
-class reactive_socket_recv_op_base_ext : public reactor_op_ext
-{
-public:
- reactive_socket_recv_op_base_ext(socket_type socket,
- socket_ops::state_type state, const MutableBufferSequence& buffers,
- socket_base::message_flags flags, func_type complete_func)
- : reactor_op_ext(&reactive_socket_recv_op_base_ext::do_perform, complete_func),
- socket_(socket),
- state_(state),
- buffers_(buffers),
- flags_(flags)
- {
- }
-
- static bool do_perform(reactor_op* base)
- {
- reactive_socket_recv_op_base_ext* o(
- static_cast<reactive_socket_recv_op_base_ext*>(base));
-
- buffer_sequence_adapter<boost::asio::mutable_buffer,
- MutableBufferSequence> bufs(o->buffers_);
-
- return socket_ops::non_blocking_recv(o->socket_,
- bufs.buffers(), bufs.count(), o->flags_,
- (o->state_ & socket_ops::stream_oriented) != 0,
- o->ec_, o->bytes_transferred_);
- }
-
-private:
- socket_type socket_;
- socket_ops::state_type state_;
- MutableBufferSequence buffers_;
- socket_base::message_flags flags_;
-};
-
-template <typename MutableBufferSequence, typename Handler>
-class reactive_socket_recv_op_ext :
- public reactive_socket_recv_op_base_ext<MutableBufferSequence>
-{
-public:
- BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_recv_op_ext);
-
- reactive_socket_recv_op_ext(socket_type socket,
- socket_ops::state_type state, const MutableBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
- : reactive_socket_recv_op_base_ext<MutableBufferSequence>(socket, state,
- buffers, flags, &reactive_socket_recv_op_ext::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const boost::system::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_socket_recv_op_ext* o(static_cast<reactive_socket_recv_op_ext*>(base));
- ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
-
- BOOST_ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder3<Handler, boost::system::error_code, std::size_t, boost::asio::ip::address>
- handler(o->handler_, o->ec_, o->bytes_transferred_, o->da_);
- p.h = boost::asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_, handler.arg3_));
- boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
- BOOST_ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECV_OP_EXT_HPP
diff --git a/implementation/helper/boost/asio/detail/reactive_socket_recvfrom_op_ext.hpp b/implementation/helper/boost/asio/detail/reactive_socket_recvfrom_op_ext.hpp
deleted file mode 100644
index d8c7030..0000000
--- a/implementation/helper/boost/asio/detail/reactive_socket_recvfrom_op_ext.hpp
+++ /dev/null
@@ -1,136 +0,0 @@
-//
-// detail/reactive_socket_recvfrom_op_ext.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVFROM_OP_EXT_HPP
-#define BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVFROM_OP_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/config.hpp>
-#include <boost/asio/detail/addressof.hpp>
-#include <boost/asio/detail/bind_handler.hpp>
-#include <boost/asio/detail/buffer_sequence_adapter.hpp>
-#include <boost/asio/detail/fenced_block.hpp>
-#include <boost/asio/detail/reactor_op_ext.hpp>
-#include <boost/asio/detail/socket_ops_ext.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace detail {
-
-template <typename MutableBufferSequence, typename Endpoint>
-class reactive_socket_recvfrom_op_base_ext : public reactor_op_ext
-{
-public:
- reactive_socket_recvfrom_op_base_ext(socket_type socket, int protocol_type,
- const MutableBufferSequence& buffers, Endpoint& endpoint,
- socket_base::message_flags flags, func_type complete_func)
- : reactor_op_ext(&reactive_socket_recvfrom_op_base_ext::do_perform, complete_func),
- socket_(socket),
- protocol_type_(protocol_type),
- buffers_(buffers),
- sender_endpoint_(endpoint),
- flags_(flags)
- {
- }
-
- static bool do_perform(reactor_op* base)
- {
- reactive_socket_recvfrom_op_base_ext* o(
- static_cast<reactive_socket_recvfrom_op_base_ext*>(base));
-
- buffer_sequence_adapter<boost::asio::mutable_buffer,
- MutableBufferSequence> bufs(o->buffers_);
-
- std::size_t addr_len = o->sender_endpoint_.capacity();
- bool result = socket_ops::non_blocking_recvfrom(o->socket_,
- bufs.buffers(), bufs.count(), o->flags_,
- o->sender_endpoint_.data(), &addr_len,
- o->ec_, o->bytes_transferred_, o->da_);
-
- if (result && !o->ec_)
- o->sender_endpoint_.resize(addr_len);
-
- return result;
- }
-
-private:
- socket_type socket_;
- int protocol_type_;
- MutableBufferSequence buffers_;
- Endpoint& sender_endpoint_;
- socket_base::message_flags flags_;
-};
-
-template <typename MutableBufferSequence, typename Endpoint, typename Handler>
-class reactive_socket_recvfrom_op_ext :
- public reactive_socket_recvfrom_op_base_ext<MutableBufferSequence, Endpoint>
-{
-public:
- BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_recvfrom_op_ext);
-
- reactive_socket_recvfrom_op_ext(socket_type socket, int protocol_type,
- const MutableBufferSequence& buffers, Endpoint& endpoint,
- socket_base::message_flags flags, Handler& handler)
- : reactive_socket_recvfrom_op_base_ext<MutableBufferSequence, Endpoint>(
- socket, protocol_type, buffers, endpoint, flags,
- &reactive_socket_recvfrom_op_ext::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const boost::system::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_socket_recvfrom_op_ext* o(
- static_cast<reactive_socket_recvfrom_op_ext*>(base));
- ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
-
- BOOST_ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder3<Handler, boost::system::error_code, std::size_t, boost::asio::ip::address>
- handler(o->handler_, o->ec_, o->bytes_transferred_, o->da_);
- p.h = boost::asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_, handler.arg3_));
- boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
- BOOST_ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVFROM_OP_EXT_HPP
diff --git a/implementation/helper/boost/asio/detail/reactive_socket_recvmsg_op_ext.hpp b/implementation/helper/boost/asio/detail/reactive_socket_recvmsg_op_ext.hpp
deleted file mode 100644
index 3186464..0000000
--- a/implementation/helper/boost/asio/detail/reactive_socket_recvmsg_op_ext.hpp
+++ /dev/null
@@ -1,128 +0,0 @@
-//
-// detail/reactive_socket_recvmsg_op_ext.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_EXT_HPP
-#define BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/config.hpp>
-#include <boost/asio/detail/addressof.hpp>
-#include <boost/asio/detail/bind_handler.hpp>
-#include <boost/asio/detail/buffer_sequence_adapter.hpp>
-#include <boost/asio/detail/fenced_block.hpp>
-#include <boost/asio/detail/reactor_op_ext.hpp>
-#include <boost/asio/detail/socket_ops_ext.hpp>
-#include <boost/asio/socket_base.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace detail {
-
-template <typename MutableBufferSequence>
-class reactive_socket_recvmsg_op_base_ext : public reactor_op_ext
-{
-public:
- reactive_socket_recvmsg_op_base_ext(socket_type socket,
- const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, func_type complete_func)
- : reactor_op_ext(&reactive_socket_recvmsg_op_base_ext::do_perform, complete_func),
- socket_(socket),
- buffers_(buffers),
- in_flags_(in_flags),
- out_flags_(out_flags)
- {
- }
-
- static bool do_perform(reactor_op* base)
- {
- reactive_socket_recvmsg_op_base_ext* o(
- static_cast<reactive_socket_recvmsg_op_base_ext*>(base));
-
- buffer_sequence_adapter<boost::asio::mutable_buffer,
- MutableBufferSequence> bufs(o->buffers_);
-
- return socket_ops::non_blocking_recvmsg(o->socket_,
- bufs.buffers(), bufs.count(),
- o->in_flags_, o->out_flags_,
- o->ec_, o->bytes_transferred_);
- }
-
-private:
- socket_type socket_;
- MutableBufferSequence buffers_;
- socket_base::message_flags in_flags_;
- socket_base::message_flags& out_flags_;
-};
-
-template <typename MutableBufferSequence, typename Handler>
-class reactive_socket_recvmsg_op_ext :
- public reactive_socket_recvmsg_op_base_ext<MutableBufferSequence>
-{
-public:
- BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_recvmsg_op_ext);
-
- reactive_socket_recvmsg_op_ext(socket_type socket,
- const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
- : reactive_socket_recvmsg_op_base_ext<MutableBufferSequence>(socket, buffers,
- in_flags, out_flags, &reactive_socket_recvmsg_op_ext::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const boost::system::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_socket_recvmsg_op_ext* o(
- static_cast<reactive_socket_recvmsg_op_ext*>(base));
- ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
-
- BOOST_ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder3<Handler, boost::system::error_code, std::size_t, boost::asio::ip::address>
- handler(o->handler_, o->ec_, o->bytes_transferred_, o->da_);
- p.h = boost::asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_, handler.arg3_));
- boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
- BOOST_ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_EXT_HPP
diff --git a/implementation/helper/boost/asio/detail/reactive_socket_service_base_ext.hpp b/implementation/helper/boost/asio/detail/reactive_socket_service_base_ext.hpp
deleted file mode 100644
index 6c13114..0000000
--- a/implementation/helper/boost/asio/detail/reactive_socket_service_base_ext.hpp
+++ /dev/null
@@ -1,455 +0,0 @@
-//
-// detail/reactive_socket_service_base_ext.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_BASE_EXT_HPP
-#define BOOST_ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_BASE_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <iostream>
-
-#include <boost/asio/detail/config.hpp>
-
-#if !defined(BOOST_ASIO_HAS_IOCP) \
- && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
-
-#include <boost/asio/buffer.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/socket_base.hpp>
-#include <boost/asio/detail/addressof.hpp>
-#include <boost/asio/detail/buffer_sequence_adapter.hpp>
-#include <boost/asio/detail/reactive_null_buffers_op.hpp>
-#include <boost/asio/detail/reactive_socket_recv_op_ext.hpp>
-#include <boost/asio/detail/reactive_socket_recvmsg_op_ext.hpp>
-#include <boost/asio/detail/reactive_socket_send_op.hpp>
-#include <boost/asio/detail/reactor.hpp>
-#include <boost/asio/detail/reactor_op.hpp>
-#include <boost/asio/detail/socket_holder.hpp>
-#include <boost/asio/detail/socket_ops_ext.hpp>
-#include <boost/asio/detail/socket_types.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace detail {
-
-class reactive_socket_service_base_ext
-{
-public:
- // The native type of a socket.
- typedef socket_type native_handle_type;
-
- // The implementation type of the socket.
- struct base_implementation_type
- {
- // The native socket representation.
- socket_type socket_;
-
- // The current state of the socket.
- socket_ops::state_type state_;
-
- // Per-descriptor data used by the reactor.
- reactor::per_descriptor_data reactor_data_;
- };
-
- // Constructor.
- BOOST_ASIO_DECL reactive_socket_service_base_ext(
- boost::asio::io_service& io_service);
-
- // Destroy all user-defined handler objects owned by the service.
- BOOST_ASIO_DECL void shutdown_service();
-
- // Construct a new socket implementation.
- BOOST_ASIO_DECL void construct(base_implementation_type& impl);
-
- // Move-construct a new socket implementation.
- BOOST_ASIO_DECL void base_move_construct(base_implementation_type& impl,
- base_implementation_type& other_impl);
-
- // Move-assign from another socket implementation.
- BOOST_ASIO_DECL void base_move_assign(base_implementation_type& impl,
- reactive_socket_service_base_ext& other_service,
- base_implementation_type& other_impl);
-
- // Destroy a socket implementation.
- BOOST_ASIO_DECL void destroy(base_implementation_type& impl);
-
- // Determine whether the socket is open.
- bool is_open(const base_implementation_type& impl) const
- {
- return impl.socket_ != invalid_socket;
- }
-
- // Destroy a socket implementation.
- BOOST_ASIO_DECL boost::system::error_code close(
- base_implementation_type& impl, boost::system::error_code& ec);
-
- // Get the native socket representation.
- native_handle_type native_handle(base_implementation_type& impl)
- {
- return impl.socket_;
- }
-
- // Cancel all operations associated with the socket.
- BOOST_ASIO_DECL boost::system::error_code cancel(
- base_implementation_type& impl, boost::system::error_code& ec);
-
- // Determine whether the socket is at the out-of-band data mark.
- bool at_mark(const base_implementation_type& impl,
- boost::system::error_code& ec) const
- {
- return socket_ops::sockatmark(impl.socket_, ec);
- }
-
- // Determine the number of bytes available for reading.
- std::size_t available(const base_implementation_type& impl,
- boost::system::error_code& ec) const
- {
- return socket_ops::available(impl.socket_, ec);
- }
-
- // Place the socket into the state where it will listen for new connections.
- boost::system::error_code listen(base_implementation_type& impl,
- int backlog, boost::system::error_code& ec)
- {
- socket_ops::listen(impl.socket_, backlog, ec);
- return ec;
- }
-
- // Perform an IO control command on the socket.
- template <typename IO_Control_Command>
- boost::system::error_code io_control(base_implementation_type& impl,
- IO_Control_Command& command, boost::system::error_code& ec)
- {
- socket_ops::ioctl(impl.socket_, impl.state_, command.name(),
- static_cast<ioctl_arg_type*>(command.data()), ec);
- return ec;
- }
-
- // Gets the non-blocking mode of the socket.
- bool non_blocking(const base_implementation_type& impl) const
- {
- return (impl.state_ & socket_ops::user_set_non_blocking) != 0;
- }
-
- // Sets the non-blocking mode of the socket.
- boost::system::error_code non_blocking(base_implementation_type& impl,
- bool mode, boost::system::error_code& ec)
- {
- socket_ops::set_user_non_blocking(impl.socket_, impl.state_, mode, ec);
- return ec;
- }
-
- // Gets the non-blocking mode of the native socket implementation.
- bool native_non_blocking(const base_implementation_type& impl) const
- {
- return (impl.state_ & socket_ops::internal_non_blocking) != 0;
- }
-
- // Sets the non-blocking mode of the native socket implementation.
- boost::system::error_code native_non_blocking(base_implementation_type& impl,
- bool mode, boost::system::error_code& ec)
- {
- socket_ops::set_internal_non_blocking(impl.socket_, impl.state_, mode, ec);
- return ec;
- }
-
- // Disable sends or receives on the socket.
- boost::system::error_code shutdown(base_implementation_type& impl,
- socket_base::shutdown_type what, boost::system::error_code& ec)
- {
- socket_ops::shutdown(impl.socket_, what, ec);
- return ec;
- }
-
- // Send the given data to the peer.
- template <typename ConstBufferSequence>
- size_t send(base_implementation_type& impl,
- const ConstBufferSequence& buffers,
- socket_base::message_flags flags, boost::system::error_code& ec)
- {
- buffer_sequence_adapter<boost::asio::const_buffer,
- ConstBufferSequence> bufs(buffers);
-
- return socket_ops::sync_send(impl.socket_, impl.state_,
- bufs.buffers(), bufs.count(), flags, bufs.all_empty(), ec);
- }
-
- // Wait until data can be sent without blocking.
- size_t send(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags, boost::system::error_code& ec)
- {
- // Wait for socket to become ready.
- socket_ops::poll_write(impl.socket_, impl.state_, ec);
-
- return 0;
- }
-
- // Start an asynchronous send. The data being sent must be valid for the
- // lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
- void async_send(base_implementation_type& impl,
- const ConstBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_send_op<ConstBufferSequence, Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.socket_, buffers, flags, handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send"));
-
- start_op(impl, reactor::write_op, p.p, is_continuation, true,
- ((impl.state_ & socket_ops::stream_oriented)
- && buffer_sequence_adapter<boost::asio::const_buffer,
- ConstBufferSequence>::all_empty(buffers)));
- p.v = p.p = 0;
- }
-
- // Start an asynchronous wait until data can be sent without blocking.
- template <typename Handler>
- void async_send(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
- &impl, "async_send(null_buffers)"));
-
- start_op(impl, reactor::write_op, p.p, is_continuation, false, false);
- p.v = p.p = 0;
- }
-
- // Receive some data from the peer. Returns the number of bytes received.
- template <typename MutableBufferSequence>
- size_t receive(base_implementation_type& impl,
- const MutableBufferSequence& buffers,
- socket_base::message_flags flags, boost::system::error_code& ec)
- {
- buffer_sequence_adapter<boost::asio::mutable_buffer,
- MutableBufferSequence> bufs(buffers);
-
- return socket_ops::sync_recv(impl.socket_, impl.state_,
- bufs.buffers(), bufs.count(), flags, bufs.all_empty(), ec);
- }
-
- // Wait until data can be received without blocking.
- size_t receive(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags, boost::system::error_code& ec)
- {
- // Wait for socket to become ready.
- socket_ops::poll_read(impl.socket_, impl.state_, ec);
-
- return 0;
- }
-
- // Start an asynchronous receive. The buffer for the data being received
- // must be valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
- void async_receive(base_implementation_type& impl,
- const MutableBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_recv_op_ext<MutableBufferSequence, Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.socket_, impl.state_, buffers, flags, handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive"));
-
- start_op(impl,
- (flags & socket_base::message_out_of_band)
- ? reactor::except_op : reactor::read_op,
- p.p, is_continuation,
- (flags & socket_base::message_out_of_band) == 0,
- ((impl.state_ & socket_ops::stream_oriented)
- && buffer_sequence_adapter<boost::asio::mutable_buffer,
- MutableBufferSequence>::all_empty(buffers)));
- p.v = p.p = 0;
- }
-
- // Wait until data can be received without blocking.
- template <typename Handler>
- void async_receive(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags flags, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
- &impl, "async_receive(null_buffers)"));
-
- start_op(impl,
- (flags & socket_base::message_out_of_band)
- ? reactor::except_op : reactor::read_op,
- p.p, is_continuation, false, false);
- p.v = p.p = 0;
- }
-
- // Receive some data with associated flags. Returns the number of bytes
- // received.
- template <typename MutableBufferSequence>
- size_t receive_with_flags(base_implementation_type& impl,
- const MutableBufferSequence& buffers,
- socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, boost::system::error_code& ec)
- {
- buffer_sequence_adapter<boost::asio::mutable_buffer,
- MutableBufferSequence> bufs(buffers);
-
- return socket_ops::sync_recvmsg(impl.socket_, impl.state_,
- bufs.buffers(), bufs.count(), in_flags, out_flags, ec);
- }
-
- // Wait until data can be received without blocking.
- size_t receive_with_flags(base_implementation_type& impl,
- const null_buffers&, socket_base::message_flags,
- socket_base::message_flags& out_flags, boost::system::error_code& ec)
- {
- // Wait for socket to become ready.
- socket_ops::poll_read(impl.socket_, impl.state_, ec);
-
- // Clear out_flags, since we cannot give it any other sensible value when
- // performing a null_buffers operation.
- out_flags = 0;
-
- return 0;
- }
-
- // Start an asynchronous receive. The buffer for the data being received
- // must be valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
- void async_receive_with_flags(base_implementation_type& impl,
- const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_recvmsg_op_ext<MutableBufferSequence, Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.socket_, buffers, in_flags, out_flags, handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
- &impl, "async_receive_with_flags"));
-
- start_op(impl,
- (in_flags & socket_base::message_out_of_band)
- ? reactor::except_op : reactor::read_op,
- p.p, is_continuation,
- (in_flags & socket_base::message_out_of_band) == 0, false);
- p.v = p.p = 0;
- }
-
- // Wait until data can be received without blocking.
- template <typename Handler>
- void async_receive_with_flags(base_implementation_type& impl,
- const null_buffers&, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl,
- "async_receive_with_flags(null_buffers)"));
-
- // Clear out_flags, since we cannot give it any other sensible value when
- // performing a null_buffers operation.
- out_flags = 0;
-
- start_op(impl,
- (in_flags & socket_base::message_out_of_band)
- ? reactor::except_op : reactor::read_op,
- p.p, is_continuation, false, false);
- p.v = p.p = 0;
- }
-
-protected:
- // Open a new socket implementation.
- BOOST_ASIO_DECL boost::system::error_code do_open(
- base_implementation_type& impl, int af,
- int type, int protocol, boost::system::error_code& ec);
-
- // Assign a native socket to a socket implementation.
- BOOST_ASIO_DECL boost::system::error_code do_assign(
- base_implementation_type& impl, int type,
- const native_handle_type& native_socket, boost::system::error_code& ec);
-
- // Start the asynchronous read or write operation.
- BOOST_ASIO_DECL void start_op(base_implementation_type& impl, int op_type,
- reactor_op* op, bool is_continuation, bool is_non_blocking, bool noop);
-
- // Start the asynchronous accept operation.
- BOOST_ASIO_DECL void start_accept_op(base_implementation_type& impl,
- reactor_op* op, bool is_continuation, bool peer_is_open);
-
- // Start the asynchronous connect operation.
- BOOST_ASIO_DECL void start_connect_op(base_implementation_type& impl,
- reactor_op* op, bool is_continuation,
- const socket_addr_type* addr, size_t addrlen);
-
- // The selector that performs event demultiplexing for the service.
- reactor& reactor_;
-};
-
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#if defined(BOOST_ASIO_HEADER_ONLY)
-# include <boost/asio/detail/impl/reactive_socket_service_base_ext.ipp>
-#endif // defined(BOOST_ASIO_HEADER_ONLY)
-
-#endif // !defined(BOOST_ASIO_HAS_IOCP)
- // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
-
-#endif // BOOST_ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_BASE_EXT_HPP
diff --git a/implementation/helper/boost/asio/detail/reactive_socket_service_ext.hpp b/implementation/helper/boost/asio/detail/reactive_socket_service_ext.hpp
deleted file mode 100644
index 39aa0cc..0000000
--- a/implementation/helper/boost/asio/detail/reactive_socket_service_ext.hpp
+++ /dev/null
@@ -1,462 +0,0 @@
-//
-// detail/reactive_socket_service_ext.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_EXT_HPP
-#define BOOST_ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <iostream>
-
-#include <boost/asio/detail/config.hpp>
-
-#if !defined(BOOST_ASIO_HAS_IOCP)
-
-#include <boost/asio/buffer.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/socket_base.hpp>
-#include <boost/asio/detail/addressof.hpp>
-#include <boost/asio/detail/buffer_sequence_adapter.hpp>
-#include <boost/asio/detail/noncopyable.hpp>
-#include <boost/asio/detail/reactive_null_buffers_op.hpp>
-#include <boost/asio/detail/reactive_socket_accept_op.hpp>
-#include <boost/asio/detail/reactive_socket_connect_op.hpp>
-#include <boost/asio/detail/reactive_socket_recvfrom_op_ext.hpp>
-#include <boost/asio/detail/reactive_socket_sendto_op.hpp>
-#include <boost/asio/detail/reactive_socket_service_base_ext.hpp>
-#include <boost/asio/detail/reactor.hpp>
-#include <boost/asio/detail/reactor_op.hpp>
-#include <boost/asio/detail/socket_holder.hpp>
-#include <boost/asio/detail/socket_ops.hpp>
-#include <boost/asio/detail/socket_types.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace detail {
-
-template <typename Protocol>
-class reactive_socket_service_ext :
- public reactive_socket_service_base_ext
-{
-public:
- // The protocol type.
- typedef Protocol protocol_type;
-
- // The endpoint type.
- typedef typename Protocol::endpoint endpoint_type;
-
- // The native type of a socket.
- typedef socket_type native_handle_type;
-
- // The implementation type of the socket.
- struct implementation_type :
- reactive_socket_service_base_ext::base_implementation_type
- {
- // Default constructor.
- implementation_type()
- : protocol_(endpoint_type().protocol())
- {
- }
-
- // The protocol associated with the socket.
- protocol_type protocol_;
- };
-
- // Constructor.
- reactive_socket_service_ext(boost::asio::io_service& io_service)
- : reactive_socket_service_base_ext(io_service)
- {
- }
-
- // Move-construct a new socket implementation.
- void move_construct(implementation_type& impl,
- implementation_type& other_impl)
- {
- this->base_move_construct(impl, other_impl);
-
- impl.protocol_ = other_impl.protocol_;
- other_impl.protocol_ = endpoint_type().protocol();
- }
-
- // Move-assign from another socket implementation.
- void move_assign(implementation_type& impl,
- reactive_socket_service_base_ext& other_service,
- implementation_type& other_impl)
- {
- this->base_move_assign(impl, other_service, other_impl);
-
- impl.protocol_ = other_impl.protocol_;
- other_impl.protocol_ = endpoint_type().protocol();
- }
-
- // Move-construct a new socket implementation from another protocol type.
- template <typename Protocol1>
- void converting_move_construct(implementation_type& impl,
- typename reactive_socket_service_ext<
- Protocol1>::implementation_type& other_impl)
- {
- this->base_move_construct(impl, other_impl);
-
- impl.protocol_ = protocol_type(other_impl.protocol_);
- other_impl.protocol_ = typename Protocol1::endpoint().protocol();
- }
-
- // Open a new socket implementation.
- boost::system::error_code open(implementation_type& impl,
- const protocol_type& protocol, boost::system::error_code& ec)
- {
- if (!do_open(impl, protocol.family(),
- protocol.type(), protocol.protocol(), ec))
- impl.protocol_ = protocol;
- return ec;
- }
-
- // Assign a native socket to a socket implementation.
- boost::system::error_code assign(implementation_type& impl,
- const protocol_type& protocol, const native_handle_type& native_socket,
- boost::system::error_code& ec)
- {
- if (!do_assign(impl, protocol.type(), native_socket, ec))
- impl.protocol_ = protocol;
- return ec;
- }
-
- // Get the native socket representation.
- native_handle_type native_handle(implementation_type& impl)
- {
- return impl.socket_;
- }
-
- // Bind the socket to the specified local endpoint.
- boost::system::error_code bind(implementation_type& impl,
- const endpoint_type& endpoint, boost::system::error_code& ec)
- {
- socket_ops::bind(impl.socket_, endpoint.data(), endpoint.size(), ec);
- return ec;
- }
-
- // Set a socket option.
- template <typename Option>
- boost::system::error_code set_option(implementation_type& impl,
- const Option& option, boost::system::error_code& ec)
- {
- socket_ops::setsockopt(impl.socket_, impl.state_,
- option.level(impl.protocol_), option.name(impl.protocol_),
- option.data(impl.protocol_), option.size(impl.protocol_), ec);
- return ec;
- }
-
- // Set a socket option.
- template <typename Option>
- boost::system::error_code get_option(const implementation_type& impl,
- Option& option, boost::system::error_code& ec) const
- {
- std::size_t size = option.size(impl.protocol_);
- socket_ops::getsockopt(impl.socket_, impl.state_,
- option.level(impl.protocol_), option.name(impl.protocol_),
- option.data(impl.protocol_), &size, ec);
- if (!ec)
- option.resize(impl.protocol_, size);
- return ec;
- }
-
- // Get the local endpoint.
- endpoint_type local_endpoint(const implementation_type& impl,
- boost::system::error_code& ec) const
- {
- endpoint_type endpoint;
- std::size_t addr_len = endpoint.capacity();
- if (socket_ops::getsockname(impl.socket_, endpoint.data(), &addr_len, ec))
- return endpoint_type();
- endpoint.resize(addr_len);
- return endpoint;
- }
-
- // Get the remote endpoint.
- endpoint_type remote_endpoint(const implementation_type& impl,
- boost::system::error_code& ec) const
- {
- endpoint_type endpoint;
- std::size_t addr_len = endpoint.capacity();
- if (socket_ops::getpeername(impl.socket_,
- endpoint.data(), &addr_len, false, ec))
- return endpoint_type();
- endpoint.resize(addr_len);
- return endpoint;
- }
-
- // Send a datagram to the specified endpoint. Returns the number of bytes
- // sent.
- template <typename ConstBufferSequence>
- size_t send_to(implementation_type& impl, const ConstBufferSequence& buffers,
- const endpoint_type& destination, socket_base::message_flags flags,
- boost::system::error_code& ec)
- {
- buffer_sequence_adapter<boost::asio::const_buffer,
- ConstBufferSequence> bufs(buffers);
-
- return socket_ops::sync_sendto(impl.socket_, impl.state_,
- bufs.buffers(), bufs.count(), flags,
- destination.data(), destination.size(), ec);
- }
-
- // Wait until data can be sent without blocking.
- size_t send_to(implementation_type& impl, const null_buffers&,
- const endpoint_type&, socket_base::message_flags,
- boost::system::error_code& ec)
- {
- // Wait for socket to become ready.
- socket_ops::poll_write(impl.socket_, impl.state_, ec);
-
- return 0;
- }
-
- // Start an asynchronous send. The data being sent must be valid for the
- // lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
- void async_send_to(implementation_type& impl,
- const ConstBufferSequence& buffers,
- const endpoint_type& destination, socket_base::message_flags flags,
- Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_sendto_op<ConstBufferSequence,
- endpoint_type, Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.socket_, buffers, destination, flags, handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send_to"));
-
- start_op(impl, reactor::write_op, p.p, is_continuation, true, false);
- p.v = p.p = 0;
- }
-
- // Start an asynchronous wait until data can be sent without blocking.
- template <typename Handler>
- void async_send_to(implementation_type& impl, const null_buffers&,
- const endpoint_type&, socket_base::message_flags, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
- &impl, "async_send_to(null_buffers)"));
-
- start_op(impl, reactor::write_op, p.p, is_continuation, false, false);
- p.v = p.p = 0;
- }
-
- // Receive a datagram with the endpoint of the sender. Returns the number of
- // bytes received.
- template <typename MutableBufferSequence>
- size_t receive_from(implementation_type& impl,
- const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint, socket_base::message_flags flags,
- boost::system::error_code& ec)
- {
- buffer_sequence_adapter<boost::asio::mutable_buffer,
- MutableBufferSequence> bufs(buffers);
-
- std::size_t addr_len = sender_endpoint.capacity();
- std::size_t bytes_recvd = socket_ops::sync_recvfrom(
- impl.socket_, impl.state_, bufs.buffers(), bufs.count(),
- flags, sender_endpoint.data(), &addr_len, ec);
-
- if (!ec)
- sender_endpoint.resize(addr_len);
-
- return bytes_recvd;
- }
-
- // Wait until data can be received without blocking.
- size_t receive_from(implementation_type& impl, const null_buffers&,
- endpoint_type& sender_endpoint, socket_base::message_flags,
- boost::system::error_code& ec)
- {
- // Wait for socket to become ready.
- socket_ops::poll_read(impl.socket_, impl.state_, ec);
-
- // Reset endpoint since it can be given no sensible value at this time.
- sender_endpoint = endpoint_type();
-
- return 0;
- }
-
- // Start an asynchronous receive. The buffer for the data being received and
- // the sender_endpoint object must both be valid for the lifetime of the
- // asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
- void async_receive_from(implementation_type& impl,
- const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_recvfrom_op_ext<MutableBufferSequence,
- endpoint_type, Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- int protocol = impl.protocol_.type();
- p.p = new (p.v) op(impl.socket_, protocol,
- buffers, sender_endpoint, flags, handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
- &impl, "async_receive_from"));
-
- start_op(impl,
- (flags & socket_base::message_out_of_band)
- ? reactor::except_op : reactor::read_op,
- p.p, is_continuation, true, false);
- p.v = p.p = 0;
- }
-
- // Wait until data can be received without blocking.
- template <typename Handler>
- void async_receive_from(implementation_type& impl,
- const null_buffers&, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
- &impl, "async_receive_from(null_buffers)"));
-
- // Reset endpoint since it can be given no sensible value at this time.
- sender_endpoint = endpoint_type();
-
- start_op(impl,
- (flags & socket_base::message_out_of_band)
- ? reactor::except_op : reactor::read_op,
- p.p, is_continuation, false, false);
- p.v = p.p = 0;
- }
-
- // Accept a new connection.
- template <typename Socket>
- boost::system::error_code accept(implementation_type& impl,
- Socket& peer, endpoint_type* peer_endpoint, boost::system::error_code& ec)
- {
- // We cannot accept a socket that is already open.
- if (peer.is_open())
- {
- ec = boost::asio::error::already_open;
- return ec;
- }
-
- std::size_t addr_len = peer_endpoint ? peer_endpoint->capacity() : 0;
- socket_holder new_socket(socket_ops::sync_accept(impl.socket_,
- impl.state_, peer_endpoint ? peer_endpoint->data() : 0,
- peer_endpoint ? &addr_len : 0, ec));
-
- // On success, assign new connection to peer socket object.
- if (new_socket.get() != invalid_socket)
- {
- if (peer_endpoint)
- peer_endpoint->resize(addr_len);
- if (!peer.assign(impl.protocol_, new_socket.get(), ec))
- new_socket.release();
- }
-
- return ec;
- }
-
- // Start an asynchronous accept. The peer and peer_endpoint objects
- // must be valid until the accept's handler is invoked.
- template <typename Socket, typename Handler>
- void async_accept(implementation_type& impl, Socket& peer,
- endpoint_type* peer_endpoint, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_accept_op<Socket, Protocol, Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.socket_, impl.state_, peer,
- impl.protocol_, peer_endpoint, handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_accept"));
-
- start_accept_op(impl, p.p, is_continuation, peer.is_open());
- p.v = p.p = 0;
- }
-
- // Connect the socket to the specified endpoint.
- boost::system::error_code connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, boost::system::error_code& ec)
- {
- socket_ops::sync_connect(impl.socket_,
- peer_endpoint.data(), peer_endpoint.size(), ec);
- return ec;
- }
-
- // Start an asynchronous connect.
- template <typename Handler>
- void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, Handler& handler)
- {
- bool is_continuation =
- boost_asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_connect_op<Handler> op;
- typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.socket_, handler);
-
- BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_connect"));
-
- start_connect_op(impl, p.p, is_continuation,
- peer_endpoint.data(), peer_endpoint.size());
- p.v = p.p = 0;
- }
-};
-
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // !defined(BOOST_ASIO_HAS_IOCP)
-
-#endif // BOOST_ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_EXT_HPP
diff --git a/implementation/helper/boost/asio/detail/reactor_op_ext.hpp b/implementation/helper/boost/asio/detail/reactor_op_ext.hpp
deleted file mode 100644
index c463679..0000000
--- a/implementation/helper/boost/asio/detail/reactor_op_ext.hpp
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// detail/reactor_op_ext.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_DETAIL_REACTOR_OP_EXT_HPP
-#define BOOST_ASIO_DETAIL_REACTOR_OP_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/reactor_op.hpp>
-
-namespace boost {
-namespace asio {
-namespace detail {
-
-class reactor_op_ext
- : public reactor_op
-{
-public:
- // The destination address
- boost::asio::ip::address da_;
-
- reactor_op_ext(perform_func_type perform_func, func_type complete_func)
- : reactor_op(perform_func, complete_func)
- {
- }
-};
-
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-#endif // BOOST_ASIO_DETAIL_REACTOR_OP_EXT_HPP
diff --git a/implementation/helper/boost/asio/detail/socket_ops_ext.hpp b/implementation/helper/boost/asio/detail/socket_ops_ext.hpp
deleted file mode 100644
index 30db4f9..0000000
--- a/implementation/helper/boost/asio/detail/socket_ops_ext.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// detail/socket_ops_ext.hpp
-// ~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_DETAIL_SOCKET_OPS_EXT_HPP
-#define BOOST_ASIO_DETAIL_SOCKET_OPS_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/socket_ops.hpp>
-
-namespace boost {
-namespace asio {
-namespace detail {
-namespace socket_ops {
-
-BOOST_ASIO_DECL signed_size_type recvfrom(socket_type s, buf* bufs,
- size_t count, int flags, socket_addr_type* addr,
- std::size_t* addrlen, boost::system::error_code& ec,
- boost::asio::ip::address& da);
-
-BOOST_ASIO_DECL size_t sync_recvfrom(socket_type s, state_type state,
- buf* bufs, size_t count, int flags, socket_addr_type* addr,
- std::size_t* addrlen, boost::system::error_code& ec, boost::asio::ip::address& da);
-
-#if defined(BOOST_ASIO_HAS_IOCP)
-
-BOOST_ASIO_DECL void complete_iocp_recvfrom(
- const weak_cancel_token_type& cancel_token,
- boost::system::error_code& ec,
- boost::asio::ip::address& da);
-
-#else // defined(BOOST_ASIO_HAS_IOCP)
-
-BOOST_ASIO_DECL bool non_blocking_recvfrom(socket_type s,
- buf* bufs, size_t count, int flags,
- socket_addr_type* addr, std::size_t* addrlen,
- boost::system::error_code& ec, size_t& bytes_transferred,
- boost::asio::ip::address& da);
-
-#endif // defined(BOOST_ASIO_HAS_IOCP)
-
-} // namespace socket_ops
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-
-#if defined(BOOST_ASIO_HEADER_ONLY)
-# include <boost/asio/detail/impl/socket_ops_ext.ipp>
-#endif // defined(BOOST_ASIO_HEADER_ONLY)
-
-#endif // BOOST_EXT_ASIO_DETAIL_SOCKET_OPS_HPP
diff --git a/implementation/helper/boost/asio/ip/udp_ext.hpp b/implementation/helper/boost/asio/ip/udp_ext.hpp
deleted file mode 100644
index 7ceadce..0000000
--- a/implementation/helper/boost/asio/ip/udp_ext.hpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// ip/udp_ext.hpp
-// ~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_boost or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef BOOST_ASIO_IP_UDP_EXT_HPP
-#define BOOST_ASIO_IP_UDP_EXT_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/config.hpp>
-#include <boost/asio/basic_datagram_socket_ext.hpp>
-#include <boost/asio/detail/socket_types.hpp>
-#include <boost/asio/ip/basic_endpoint.hpp>
-#include <boost/asio/ip/basic_resolver.hpp>
-#include <boost/asio/ip/basic_resolver_iterator.hpp>
-#include <boost/asio/ip/basic_resolver_query.hpp>
-#include <boost/asio/ip/udp.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace ip {
-
-/// Encapsulates the flags needed for UDP.
-/**
- * The boost::asio::ip::udp_ext class contains flags necessary for UDP sockets.
- *
- * @par Thread Safety
- * @e Distinct @e objects: Safe.@n
- * @e Shared @e objects: Safe.
- *
- * @par Concepts:
- * Protocol, InternetProtocol.
- */
-class udp_ext
-{
-public:
- /// The type of a UDP endpoint.
- typedef basic_endpoint<udp> endpoint;
-
- /// Construct to represent the IPv4 UDP protocol.
- static udp_ext v4()
- {
- return udp_ext(BOOST_ASIO_OS_DEF(AF_INET));
- }
-
- /// Construct to represent the IPv6 UDP protocol.
- static udp_ext v6()
- {
- return udp_ext(BOOST_ASIO_OS_DEF(AF_INET6));
- }
-
- /// Obtain an identifier for the type of the protocol.
- int type() const
- {
- return BOOST_ASIO_OS_DEF(SOCK_DGRAM);
- }
-
- /// Obtain an identifier for the protocol.
- int protocol() const
- {
- return BOOST_ASIO_OS_DEF(IPPROTO_UDP);
- }
-
- /// Obtain an identifier for the protocol family.
- int family() const
- {
- return family_;
- }
-
- /// The UDP socket type.
- typedef basic_datagram_socket_ext<udp> socket;
-
- /// The UDP resolver type.
- typedef basic_resolver<udp> resolver;
-
- /// Compare two protocols for equality.
- friend bool operator==(const udp_ext& p1, const udp_ext& p2)
- {
- return p1.family_ == p2.family_;
- }
-
- /// Compare two protocols for inequality.
- friend bool operator!=(const udp_ext& p1, const udp_ext& p2)
- {
- return p1.family_ != p2.family_;
- }
-
-private:
- // Construct with a specific family.
- explicit udp_ext(int protocol_family)
- : family_(protocol_family)
- {
- }
-
- int family_;
-};
-
-} // namespace ip
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // BOOST_ASIO_IP_UDP_EXT_HPP
diff --git a/implementation/logging/include/defines.hpp b/implementation/logging/include/defines.hpp
deleted file mode 100644
index 1fbaa3c..0000000
--- a/implementation/logging/include/defines.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (C) 2014-2017 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 LOGGING_DEFINES_HPP_
-#define LOGGING_DEFINES_HPP_
-
-#define VSOMEIP_LOG_DEFAULT_APPLICATION_ID "VSIP"
-#define VSOMEIP_LOG_DEFAULT_APPLICATION_NAME "vSomeIP application|SysInfra|IPC"
-
-#define VSOMEIP_LOG_DEFAULT_CONTEXT_ID "VSIP"
-#define VSOMEIP_LOG_DEFAULT_CONTEXT_NAME "vSomeIP context"
-
-#endif /* LOGGING_DEFINES_HPP_ */
diff --git a/implementation/logging/include/dlt_sink_backend.hpp b/implementation/logging/include/dlt_sink_backend.hpp
deleted file mode 100644
index 58983a6..0000000
--- a/implementation/logging/include/dlt_sink_backend.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2014-2017 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 LOGGING_INCLUDE_DLT_SINK_BACKEND_HPP_
-#define LOGGING_INCLUDE_DLT_SINK_BACKEND_HPP_
-
-#ifdef USE_DLT
-#include <dlt/dlt.h>
-#endif
-
-#include <boost/log/core.hpp>
-#include <boost/log/sinks/basic_sink_backend.hpp>
-#include <boost/log/trivial.hpp>
-
-namespace logging = boost::log;
-namespace sinks = boost::log::sinks;
-
-namespace vsomeip
-{
-
-class dlt_sink_backend :
- public sinks::basic_sink_backend<
- sinks::combine_requirements<
- sinks::synchronized_feeding
- >::type
- > {
-public:
- dlt_sink_backend(const std::string &_app_id,
- const std::string &_context_id);
- virtual ~dlt_sink_backend();
-
- void consume(const logging::record_view &rec);
-
-private:
-
-#ifdef USE_DLT
- DltLogLevelType level_as_dlt(logging::trivial::severity_level _level);
- DLT_DECLARE_CONTEXT(dlt_)
-#endif
-};
-
-} /* namespace vsomeip */
-
-#endif /* LOGGING_INCLUDE_DLT_SINK_BACKEND_HPP_ */
diff --git a/implementation/logging/include/logger.hpp b/implementation/logging/include/logger.hpp
deleted file mode 100644
index 9204692..0000000
--- a/implementation/logging/include/logger.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2014-2017 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_LOGGER_HPP
-#define VSOMEIP_LOGGER_HPP
-
-#include <string>
-
-#ifdef _WIN32
-#include <iostream>
-#endif
-
-#include <vsomeip/export.hpp>
-
-#include <boost/log/sources/severity_logger.hpp>
-#include <boost/log/trivial.hpp>
-
-namespace vsomeip {
-
-class VSOMEIP_IMPORT_EXPORT logger {
-public:
- static std::shared_ptr<logger> get();
-
- virtual ~logger() {
- }
-
- virtual boost::log::sources::severity_logger_mt<
- boost::log::trivial::severity_level> & get_internal() = 0;
-};
-
-#define VSOMEIP_FATAL BOOST_LOG_SEV(vsomeip::logger::get()->get_internal(), \
- boost::log::trivial::severity_level::fatal)
-#define VSOMEIP_ERROR BOOST_LOG_SEV(vsomeip::logger::get()->get_internal(), \
- boost::log::trivial::severity_level::error)
-#define VSOMEIP_WARNING BOOST_LOG_SEV(vsomeip::logger::get()->get_internal(), \
- boost::log::trivial::severity_level::warning)
-#define VSOMEIP_INFO BOOST_LOG_SEV(vsomeip::logger::get()->get_internal(), \
- boost::log::trivial::severity_level::info)
-#define VSOMEIP_DEBUG BOOST_LOG_SEV(vsomeip::logger::get()->get_internal(), \
- boost::log::trivial::severity_level::debug)
-#define VSOMEIP_TRACE BOOST_LOG_SEV(vsomeip::logger::get()->get_internal(), \
- boost::log::trivial::severity_level::trace)
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_LOGGER_HPP
diff --git a/implementation/logging/include/logger_impl.hpp b/implementation/logging/include/logger_impl.hpp
deleted file mode 100644
index 4e628af..0000000
--- a/implementation/logging/include/logger_impl.hpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2014-2017 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_LOGGER_IMPL_HPP
-#define VSOMEIP_LOGGER_IMPL_HPP
-
-#include <memory>
-#include <string>
-
-#include <boost/log/sinks/sync_frontend.hpp>
-#include <boost/log/sinks/text_ostream_backend.hpp>
-#include <boost/log/sources/severity_logger.hpp>
-#include <boost/log/trivial.hpp>
-
-#include "logger.hpp"
-#include "dlt_sink_backend.hpp"
-
-namespace vsomeip {
-
-class configuration;
-
-BOOST_LOG_ATTRIBUTE_KEYWORD(channel, "Channel", std::string)
-BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity",
- boost::log::trivial::severity_level)
-
-typedef boost::log::sinks::synchronous_sink<
- boost::log::sinks::text_ostream_backend> sink_t;
-typedef boost::log::sinks::synchronous_sink<
- dlt_sink_backend> dlt_sink_t;
-
-class logger_impl: public logger {
-public:
- static std::shared_ptr<logger_impl> & get();
- VSOMEIP_IMPORT_EXPORT static void init(const std::shared_ptr<configuration> &_configuration);
-
- logger_impl();
-
- boost::log::sources::severity_logger_mt<
- boost::log::trivial::severity_level> & get_internal();
-
-private:
- void enable_console();
- void disable_console();
-
- void enable_file(const std::string &_path);
- void disable_file();
-
- void enable_dlt(const std::string &_app_id,
- const std::string &_context_id);
- void disable_dlt();
-
-private:
- boost::log::sources::severity_logger_mt<
- boost::log::trivial::severity_level> logger_;
- boost::log::trivial::severity_level loglevel_;
-
- boost::shared_ptr<sink_t> console_sink_;
- boost::shared_ptr<sink_t> file_sink_;
- boost::shared_ptr<dlt_sink_t> dlt_sink_;
- boost::log::core_ptr log_core_;
-
-private:
- void use_null_logger();
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_INTERNAL_LOG_OWNER_HPP
diff --git a/implementation/logging/src/dlt_sink_backend.cpp b/implementation/logging/src/dlt_sink_backend.cpp
deleted file mode 100644
index 5b140fd..0000000
--- a/implementation/logging/src/dlt_sink_backend.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2014-2017 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/dlt_sink_backend.hpp"
-
-#ifdef USE_DLT
-#include <dlt/dlt.h>
-#endif
-
-#include <boost/log/expressions.hpp>
-#include "../include/defines.hpp"
-
-namespace expressions = boost::log::expressions;
-
-namespace vsomeip
-{
-
-dlt_sink_backend::dlt_sink_backend(const std::string &_app_id,
- const std::string &_context_id) {
- (void)_app_id;
-#ifdef USE_DLT
- DLT_REGISTER_CONTEXT(dlt_, _context_id.c_str(), VSOMEIP_LOG_DEFAULT_CONTEXT_NAME);
-#else
- (void)_context_id;
-#endif
-}
-
-dlt_sink_backend::~dlt_sink_backend() {
-#ifdef USE_DLT
- DLT_UNREGISTER_CONTEXT(dlt_);
-#endif
-}
-
-BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", logging::trivial::severity_level)
-
-void dlt_sink_backend::consume(const logging::record_view &rec) {
-#ifdef USE_DLT
- auto message = rec[expressions::smessage];
- auto severity_level = rec[severity];
- DLT_LOG_STRING(dlt_, (severity_level)?level_as_dlt(*severity_level):DLT_LOG_WARN,
- (message)?message.get<std::string>().c_str():"consume() w/o message");
-#else
- (void)rec;
-#endif
-}
-
-#ifdef USE_DLT
-DltLogLevelType dlt_sink_backend::level_as_dlt(logging::trivial::severity_level _level) {
- switch (_level) {
- case logging::trivial::fatal:
- return DLT_LOG_FATAL;
- case logging::trivial::error:
- return DLT_LOG_ERROR;
- case logging::trivial::warning:
- return DLT_LOG_WARN;
- case logging::trivial::info:
- return DLT_LOG_INFO;
- case logging::trivial::debug:
- return DLT_LOG_DEBUG;
- case logging::trivial::trace:
- return DLT_LOG_VERBOSE;
- default:
- return DLT_LOG_DEFAULT;
- }
-}
-#endif
-
-} /* namespace vsomeip */
diff --git a/implementation/logging/src/logger.cpp b/implementation/logging/src/logger.cpp
deleted file mode 100644
index 630362d..0000000
--- a/implementation/logging/src/logger.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) 2014-2017 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/logger_impl.hpp"
-
-namespace vsomeip {
-
-std::shared_ptr<logger> logger::get() {
- return logger_impl::get();
-}
-
-} // namespace vsomeip
diff --git a/implementation/logging/src/logger_impl.cpp b/implementation/logging/src/logger_impl.cpp
deleted file mode 100644
index d1db6b2..0000000
--- a/implementation/logging/src/logger_impl.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright (C) 2014-2017 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 <fstream>
-
-#include <boost/log/core.hpp>
-#include <boost/log/expressions.hpp>
-#include <boost/log/sources/logger.hpp>
-#include <boost/log/support/date_time.hpp>
-#include <boost/log/utility/setup/console.hpp>
-#include <boost/log/utility/setup/file.hpp>
-#include <boost/log/utility/setup/common_attributes.hpp>
-#include <boost/phoenix/bind/bind_member_function.hpp>
-#include <boost/shared_ptr.hpp>
-
-// The "empty_deleter"-struct was moved from the log-package
-// to the more generic "utility"-package in V1.55. If we'd
-// use the "old" include, we get a "deprecation" warning
-// when compiling with the newer boost version. Therefore a
-// version dependent include handling is done here, which
-// can/should be removed in case GPT is updating Boost to V1.55.
-#if BOOST_VERSION < 105500
-#include <boost/log/utility/empty_deleter.hpp>
-#elif BOOST_VERSION < 105600
-#include <boost/utility/empty_deleter.hpp>
-#else
-#include <boost/core/null_deleter.hpp>
-#endif
-
-#include <vsomeip/runtime.hpp>
-
-#include "../include/logger_impl.hpp"
-#include "../../configuration/include/configuration.hpp"
-#include "../include/defines.hpp"
-
-namespace logging = boost::log;
-namespace sources = boost::log::sources;
-namespace sinks = boost::log::sinks;
-namespace keywords = boost::log::keywords;
-namespace expressions = boost::log::expressions;
-namespace attributes = boost::log::attributes;
-
-using namespace boost::log::trivial;
-
-namespace vsomeip {
-
-std::shared_ptr<logger_impl> & logger_impl::get() {
- static std::shared_ptr<logger_impl> the_logger__ = std::make_shared<
- logger_impl>();
- return the_logger__;
-}
-
-logger_impl::logger_impl()
- : loglevel_(debug),
- log_core_(logging::core::get()) {
- logging::add_common_attributes();
-}
-
-boost::log::sources::severity_logger_mt<boost::log::trivial::severity_level> &
-logger_impl::get_internal() {
- return logger_;
-}
-
-void logger_impl::init(const std::shared_ptr<configuration> &_configuration) {
- get()->loglevel_ = _configuration->get_loglevel();
-
- logging::core::get()->set_filter(
- logging::trivial::severity >= get()->loglevel_);
-
- if (_configuration->has_console_log())
- get()->enable_console();
- else
- get()->disable_console();
-
- if (_configuration->has_file_log())
- get()->enable_file(_configuration->get_logfile());
- else
- get()->disable_file();
-
- if (_configuration->has_dlt_log()) {
- std::string app_id = runtime::get_property("LogApplication");
- if (app_id == "") app_id = VSOMEIP_LOG_DEFAULT_APPLICATION_ID;
- std::string context_id = runtime::get_property("LogContext");
- if (context_id == "") context_id = VSOMEIP_LOG_DEFAULT_CONTEXT_ID;
- get()->enable_dlt(app_id, context_id);
- } else
- get()->disable_dlt();
-
- if (!_configuration->has_console_log() &&
- !_configuration->has_file_log() &&
- !_configuration->has_dlt_log()) {
- get()->use_null_logger();
- }
-}
-
-void logger_impl::enable_console() {
- if (console_sink_)
- return;
-
- auto vsomeip_log_format = expressions::stream
- << expressions::format_date_time<boost::posix_time::ptime>(
- "TimeStamp", "%Y-%m-%d %H:%M:%S.%f") << " ["
- << expressions::attr<severity_level>("Severity") << "] "
- << expressions::smessage;
-
- boost::shared_ptr<sinks::text_ostream_backend> backend = boost::make_shared<
- sinks::text_ostream_backend>();
- backend->add_stream(boost::shared_ptr<std::ostream>(&std::clog,
-#if BOOST_VERSION < 105500
- boost::log::empty_deleter()
-#elif BOOST_VERSION < 105600
- boost::empty_deleter()
-#else
- boost::null_deleter()
-#endif
- ));
-
- console_sink_ = boost::make_shared<sink_t>(backend);
- console_sink_->set_formatter(vsomeip_log_format);
- logging::core::get()->add_sink(console_sink_);
-}
-
-void logger_impl::disable_console() {
- if (console_sink_)
- logging::core::get()->remove_sink(console_sink_);
-}
-
-void logger_impl::enable_file(const std::string &_path) {
- if (file_sink_)
- return;
-
- auto vsomeip_log_format = expressions::stream
- << expressions::format_date_time<boost::posix_time::ptime>(
- "TimeStamp", "%Y-%m-%d %H:%M:%S.%f") << " ["
- << expressions::attr<severity_level>("Severity") << "] "
- << expressions::smessage;
-
- boost::shared_ptr<sinks::text_ostream_backend> backend = boost::make_shared<
- sinks::text_ostream_backend>();
- backend->add_stream(
- boost::shared_ptr<std::ostream>(
- boost::make_shared<std::ofstream>(_path)));
-
- file_sink_ = boost::make_shared<sink_t>(backend);
- file_sink_->set_formatter(vsomeip_log_format);
- logging::core::get()->add_sink(file_sink_);
-}
-
-void logger_impl::disable_file() {
- if (file_sink_)
- logging::core::get()->remove_sink(file_sink_);
-}
-
-
-void logger_impl::enable_dlt(const std::string &_app_id,
- const std::string &_context_id) {
-#ifdef USE_DLT
- if (dlt_sink_)
- return;
-
- boost::shared_ptr<dlt_sink_backend> backend = boost::make_shared<dlt_sink_backend>(_app_id,
- _context_id);
- dlt_sink_ = boost::make_shared<dlt_sink_t>(backend);
- logging::core::get()->add_sink(dlt_sink_);
-#else
- (void)_app_id;
- (void)_context_id;
-#endif
-}
-
-void logger_impl::disable_dlt() {
- if (dlt_sink_)
- logging::core::get()->remove_sink(dlt_sink_);
-}
-
-void logger_impl::use_null_logger() {
- boost::shared_ptr<sinks::text_ostream_backend> backend = boost::make_shared<
- sinks::text_ostream_backend>();
- backend->add_stream(
- boost::shared_ptr<std::ostream>(new std::ofstream("/dev/null") // TODO: how to call this on windows
- ));
-
- file_sink_ = boost::make_shared<sink_t>(backend);
- logging::core::get()->add_sink(file_sink_);
-}
-
-} // namespace vsomeip
-
diff --git a/implementation/message/include/deserializer.hpp b/implementation/message/include/deserializer.hpp
deleted file mode 100644
index 7449f9b..0000000
--- a/implementation/message/include/deserializer.hpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2014-2017 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_DESERIALIZER_HPP
-#define VSOMEIP_DESERIALIZER_HPP
-
-#include <vector>
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-class message;
-
-class deserializer {
-public:
- VSOMEIP_EXPORT deserializer(std::uint32_t _buffer_shrink_threshold);
- VSOMEIP_EXPORT deserializer(byte_t *_data, std::size_t _length,
- std::uint32_t _buffer_shrink_threshold);
- VSOMEIP_EXPORT deserializer(const deserializer& _other);
- VSOMEIP_EXPORT virtual ~deserializer();
-
- VSOMEIP_EXPORT void set_data(const byte_t *_data, std::size_t _length);
- VSOMEIP_EXPORT void append_data(const byte_t *_data, std::size_t _length);
- VSOMEIP_EXPORT void drop_data(std::size_t _length);
-
- VSOMEIP_EXPORT std::size_t get_available() const;
- VSOMEIP_EXPORT std::size_t get_remaining() const;
- VSOMEIP_EXPORT void set_remaining(std::size_t _length);
-
- // to be used by applications to deserialize a message
- VSOMEIP_EXPORT message * deserialize_message();
-
- // to be used (internally) by objects to deserialize their members
- // Note: this needs to be encapsulated!
- VSOMEIP_EXPORT bool deserialize(uint8_t& _value);
- VSOMEIP_EXPORT bool deserialize(uint16_t& _value);
- VSOMEIP_EXPORT bool deserialize(uint32_t& _value,
- bool _omit_last_byte = false);
- VSOMEIP_EXPORT bool deserialize(uint8_t *_data, std::size_t _length);
- VSOMEIP_EXPORT bool deserialize(std::vector<uint8_t>& _value);
-
- VSOMEIP_EXPORT bool look_ahead(std::size_t _index, uint8_t &_value) const;
- VSOMEIP_EXPORT bool look_ahead(std::size_t _index, uint16_t &_value) const;
- VSOMEIP_EXPORT bool look_ahead(std::size_t _index, uint32_t &_value) const;
-
- VSOMEIP_EXPORT void reset();
-
-#ifdef VSOMEIP_DEBUGGING
- VSOMEIP_EXPORT void show() const;
-#endif
-protected:
- std::vector<byte_t> data_;
- std::vector<byte_t>::iterator position_;
- std::size_t remaining_;
-private:
- const std::uint32_t buffer_shrink_threshold_;
- std::uint32_t shrink_count_;
-
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_DESERIALIZER_HPP
diff --git a/implementation/message/include/message_base_impl.hpp b/implementation/message/include/message_base_impl.hpp
deleted file mode 100644
index ad42261..0000000
--- a/implementation/message/include/message_base_impl.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (C) 2014-2017 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_MESSAGE_BASE_IMPL_HPP
-#define VSOMEIP_MESSAGE_BASE_IMPL_HPP
-
-#include <boost/thread.hpp>
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/message.hpp>
-
-#include "message_header_impl.hpp"
-
-namespace vsomeip {
-
-class message_base_impl
- : virtual public message_base {
-public:
- VSOMEIP_EXPORT message_base_impl();
- VSOMEIP_EXPORT virtual ~message_base_impl();
-
- VSOMEIP_EXPORT message_t get_message() const;
- VSOMEIP_EXPORT void set_message(message_t _message);
-
- VSOMEIP_EXPORT service_t get_service() const;
- VSOMEIP_EXPORT void set_service(service_t _service);
-
- VSOMEIP_EXPORT instance_t get_instance() const;
- VSOMEIP_EXPORT void set_instance(instance_t _instance);
-
- VSOMEIP_EXPORT method_t get_method() const;
- VSOMEIP_EXPORT void set_method(method_t _method);
-
- VSOMEIP_EXPORT request_t get_request() const;
-
- VSOMEIP_EXPORT client_t get_client() const;
- VSOMEIP_EXPORT void set_client(client_t _client);
-
- VSOMEIP_EXPORT session_t get_session() const;
- VSOMEIP_EXPORT void set_session(session_t _session);
-
- VSOMEIP_EXPORT protocol_version_t get_protocol_version() const;
- VSOMEIP_EXPORT void set_protocol_version(protocol_version_t _version);
-
- VSOMEIP_EXPORT interface_version_t get_interface_version() const;
- VSOMEIP_EXPORT void set_interface_version(interface_version_t _version);
-
- VSOMEIP_EXPORT message_type_e get_message_type() const;
- VSOMEIP_EXPORT void set_message_type(message_type_e _type);
-
- VSOMEIP_EXPORT return_code_e get_return_code() const;
- VSOMEIP_EXPORT void set_return_code(return_code_e _code);
-
- VSOMEIP_EXPORT bool is_reliable() const;
- VSOMEIP_EXPORT void set_reliable(bool _is_reliable);
-
- VSOMEIP_EXPORT virtual bool is_initial() const;
- VSOMEIP_EXPORT virtual void set_initial(bool _is_initial);
-
- VSOMEIP_EXPORT message * get_owner() const;
- VSOMEIP_EXPORT void set_owner(message *_owner);
-
- VSOMEIP_EXPORT bool is_valid_crc() const;
- VSOMEIP_EXPORT void set_is_valid_crc(bool _is_valid_crc);
-
-protected: // members
- message_header_impl header_;
- bool is_reliable_;
- bool is_initial_;
- bool is_valid_crc_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_INTERNAL_MESSAGE_BASE_IMPL_HPP
diff --git a/implementation/message/include/message_header_impl.hpp b/implementation/message/include/message_header_impl.hpp
deleted file mode 100644
index 5768bbe..0000000
--- a/implementation/message/include/message_header_impl.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2014-2017 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_MESSAGE_HEADER_IMPL_HPP
-#define VSOMEIP_MESSAGE_HEADER_IMPL_HPP
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/enumeration_types.hpp>
-#include <vsomeip/internal/serializable.hpp>
-
-namespace vsomeip {
-
-class message_base;
-
-class message_header_impl: virtual public serializable {
-public:
- VSOMEIP_EXPORT message_header_impl();
- VSOMEIP_EXPORT message_header_impl(const message_header_impl& header);
-
- VSOMEIP_EXPORT bool serialize(serializer *_to) const;
- VSOMEIP_EXPORT bool deserialize(deserializer *_from);
-
- // internal
- VSOMEIP_EXPORT message_base * get_owner() const;
- VSOMEIP_EXPORT void set_owner(message_base *_owner);
-
-public:
- service_t service_;
- method_t method_;
- length_t length_;
- client_t client_;
- session_t session_;
- protocol_version_t protocol_version_;
- interface_version_t interface_version_;
- message_type_e type_;
- return_code_e code_;
-
- instance_t instance_;
- message_base *owner_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_MESSAGE_HEADER_IMPL_HPP
diff --git a/implementation/message/include/message_impl.hpp b/implementation/message/include/message_impl.hpp
deleted file mode 100644
index a10afe5..0000000
--- a/implementation/message/include/message_impl.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2014-2017 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_MESSAGE_IMPL_HPP
-#define VSOMEIP_MESSAGE_IMPL_HPP
-
-#include <memory>
-
-#include <vsomeip/export.hpp>
-#include "message_base_impl.hpp"
-
-# if _MSC_VER >= 1300
-/*
-* Diamond inheritance is used for the vsomeip::message_base base class.
-* The Microsoft compiler put warning (C4250) using a desired c++ feature: "Delegating to a sister class"
-* A powerful technique that arises from using virtual inheritance is to delegate a method from a class in another class
-* by using a common abstract base class. This is also called cross delegation.
-*/
-# pragma warning( disable : 4250 )
-# endif
-
-namespace vsomeip {
-
-class payload;
-
-class message_impl
- : virtual public message,
- virtual public message_base_impl {
-public:
- VSOMEIP_EXPORT message_impl();
- VSOMEIP_EXPORT virtual ~message_impl();
-
- VSOMEIP_EXPORT length_t get_length() const;
- VSOMEIP_EXPORT void set_length(length_t _length);
-
- VSOMEIP_EXPORT std::shared_ptr< payload > get_payload() const;
- VSOMEIP_EXPORT void set_payload(std::shared_ptr< payload > _payload);
-
- VSOMEIP_EXPORT bool serialize(serializer *_to) const;
- VSOMEIP_EXPORT bool deserialize(deserializer *_from);
-
-protected: // members
- std::shared_ptr< payload > payload_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_MESSAGE_IMPL_HPP
diff --git a/implementation/message/include/payload_impl.hpp b/implementation/message/include/payload_impl.hpp
deleted file mode 100644
index f9b05a2..0000000
--- a/implementation/message/include/payload_impl.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2014-2017 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_PAYLOAD_IMPL_HPP
-#define VSOMEIP_PAYLOAD_IMPL_HPP
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/payload.hpp>
-
-namespace vsomeip {
-
-class serializer;
-class deserializer;
-
-class payload_impl: public payload {
-public:
- VSOMEIP_EXPORT payload_impl();
- VSOMEIP_EXPORT payload_impl(const byte_t *_data, uint32_t _size);
- VSOMEIP_EXPORT payload_impl(const std::vector< byte_t > &_value);
- VSOMEIP_EXPORT payload_impl(const payload_impl& _payload);
- VSOMEIP_EXPORT virtual ~payload_impl();
-
- VSOMEIP_EXPORT bool operator == (const payload &_other);
-
- VSOMEIP_EXPORT byte_t * get_data();
- VSOMEIP_EXPORT const byte_t * get_data() const;
- VSOMEIP_EXPORT length_t get_length() const;
-
- VSOMEIP_EXPORT void set_capacity(length_t _capacity);
-
- VSOMEIP_EXPORT void set_data(const byte_t *_data, length_t _length);
- VSOMEIP_EXPORT void set_data(const std::vector< byte_t > &_data);
- VSOMEIP_EXPORT void set_data(std::vector< byte_t > &&_data);
-
- VSOMEIP_EXPORT bool serialize(serializer *_to) const;
- VSOMEIP_EXPORT bool deserialize(deserializer *_from);
-
-private:
- std::vector<byte_t> data_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_PAYLOAD_IMPL_HPP
diff --git a/implementation/message/include/serializer.hpp b/implementation/message/include/serializer.hpp
deleted file mode 100644
index c57797e..0000000
--- a/implementation/message/include/serializer.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2014-2017 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_SERIALIZER_HPP
-#define VSOMEIP_SERIALIZER_HPP
-
-#include <vector>
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-class serializable;
-
-class VSOMEIP_IMPORT_EXPORT serializer {
-public:
- serializer(std::uint32_t _buffer_shrink_threshold);
- virtual ~serializer();
-
- bool serialize(const serializable *_from);
-
- bool serialize(const uint8_t _value);
- bool serialize(const uint16_t _value);
- bool serialize(const uint32_t _value, bool _omit_last_byte = false);
- bool serialize(const uint8_t *_data, uint32_t _length);
- bool serialize(const std::vector<byte_t> &_data);
-
- virtual const uint8_t * get_data() const;
- virtual uint32_t get_capacity() const;
- virtual uint32_t get_size() const;
-
- virtual void set_data(uint8_t *_data, uint32_t _capacity);
-
- virtual void reset();
-
-#ifdef VSOMEIP_DEBUGGING
- virtual void show();
-#endif
-private:
- std::vector<byte_t> data_;
- std::uint32_t shrink_count_;
- std::uint32_t buffer_shrink_threshold_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_SERIALIZER_IMPL_HPP
diff --git a/implementation/message/src/deserializer.cpp b/implementation/message/src/deserializer.cpp
deleted file mode 100644
index 8a3c891..0000000
--- a/implementation/message/src/deserializer.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright (C) 2014-2017 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 <cstring>
-
-#ifdef VSOMEIP_DEBUGGING
-#include <iomanip>
-#include <sstream>
-#endif
-
-#include "../include/message_impl.hpp"
-#include "../include/deserializer.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../utility/include/byteorder.hpp"
-
-namespace vsomeip {
-
-deserializer::deserializer(std::uint32_t _buffer_shrink_threshold)
- : position_(data_.begin()),
- remaining_(0),
- buffer_shrink_threshold_(_buffer_shrink_threshold),
- shrink_count_(0) {
-}
-
-deserializer::deserializer(byte_t *_data, std::size_t _length,
- std::uint32_t _buffer_shrink_threshold)
- : data_(_data, _data + _length),
- position_(data_.begin()),
- remaining_(_length),
- buffer_shrink_threshold_(_buffer_shrink_threshold),
- shrink_count_(0) {
-}
-
-deserializer::deserializer(const deserializer &_other)
- : data_(_other.data_),
- position_(_other.position_),
- remaining_(_other.remaining_),
- buffer_shrink_threshold_(_other.buffer_shrink_threshold_),
- shrink_count_(_other.shrink_count_) {
-}
-
-deserializer::~deserializer() {
-}
-
-std::size_t deserializer::get_available() const {
- return data_.size();
-}
-
-std::size_t deserializer::get_remaining() const {
- return remaining_;
-}
-
-void deserializer::set_remaining(std::size_t _remaining) {
- remaining_ = _remaining;
-}
-
-bool deserializer::deserialize(uint8_t& _value) {
- if (0 == remaining_)
- return false;
-
- _value = *position_++;
-
- remaining_--;
- return true;
-}
-
-bool deserializer::deserialize(uint16_t& _value) {
- if (2 > remaining_)
- return false;
-
- uint8_t byte0, byte1;
- byte0 = *position_++;
- byte1 = *position_++;
- remaining_ -= 2;
-
- _value = VSOMEIP_BYTES_TO_WORD(byte0, byte1);
-
- return true;
-}
-
-bool deserializer::deserialize(uint32_t &_value, bool _omit_last_byte) {
- if (3 > remaining_ || (!_omit_last_byte && 4 > remaining_))
- return false;
-
- uint8_t byte0 = 0, byte1, byte2, byte3;
- if (!_omit_last_byte) {
- byte0 = *position_++;
- remaining_--;
- }
- byte1 = *position_++;
- byte2 = *position_++;
- byte3 = *position_++;
- remaining_ -= 3;
-
- _value = VSOMEIP_BYTES_TO_LONG(
- byte0, byte1, byte2, byte3);
-
- return true;
-}
-
-bool deserializer::deserialize(uint8_t *_data, std::size_t _length) {
- if (_length > remaining_)
- return false;
-
- std::memcpy(_data, &data_[position_ - data_.begin()], _length);
- position_ += _length;
- remaining_ -= _length;
-
- return true;
-}
-
-bool deserializer::deserialize(std::vector< uint8_t >& _value) {
- if (_value.capacity() > remaining_)
- return false;
-
- _value.assign(position_, position_ + _value.capacity());
- position_ += _value.capacity();
- remaining_ -= _value.capacity();
-
- return true;
-}
-
-bool deserializer::look_ahead(std::size_t _index, uint8_t &_value) const {
- if (_index >= data_.size())
- return false;
-
- _value = *(position_ + _index);
-
- return true;
-}
-
-bool deserializer::look_ahead(std::size_t _index, uint16_t &_value) const {
- if (_index+1 >= data_.size())
- return false;
-
- std::vector< uint8_t >::iterator i = position_ + _index;
- _value = VSOMEIP_BYTES_TO_WORD(*i, *(i+1));
-
- return true;
-}
-
-bool deserializer::look_ahead(std::size_t _index, uint32_t &_value) const {
- if (_index+3 >= data_.size())
- return false;
-
- std::vector< uint8_t >::const_iterator i = position_ + _index;
- _value = VSOMEIP_BYTES_TO_LONG(*i, *(i+1), *(i+2), *(i+3));
-
- return true;
-}
-
-message * deserializer::deserialize_message() {
- message_impl* deserialized_message = new message_impl;
- if (0 != deserialized_message) {
- if (false == deserialized_message->deserialize(this)) {
- VSOMEIP_ERROR << "SOME/IP message deserialization failed!";
- delete deserialized_message;
- deserialized_message = nullptr;
- }
- }
-
- return deserialized_message;
-}
-
-void deserializer::set_data(const byte_t *_data, std::size_t _length) {
- if (0 != _data) {
- data_.assign(_data, _data + _length);
- position_ = data_.begin();
- remaining_ = data_.end() - position_;
- } else {
- data_.clear();
- position_ = data_.end();
- remaining_ = 0;
- }
-}
-
-void deserializer::append_data(const byte_t *_data, std::size_t _length) {
- std::size_t offset = (position_ - data_.begin());
- data_.insert(data_.end(), _data, _data + _length);
- position_ = data_.begin() + offset;
- remaining_ += _length;
-}
-
-void deserializer::drop_data(std::size_t _length) {
- if (position_ + _length < data_.end())
- position_ += _length;
- else
- position_ = data_.end();
-}
-
-void deserializer::reset() {
- if (buffer_shrink_threshold_) {
- if (data_.size() < (data_.capacity() >> 1)) {
- shrink_count_++;
- } else {
- shrink_count_ = 0;
- }
- }
- data_.clear();
- position_ = data_.begin();
- remaining_ = data_.size();
- if (buffer_shrink_threshold_ && shrink_count_ > buffer_shrink_threshold_) {
- data_.shrink_to_fit();
- shrink_count_ = 0;
- }
-}
-
-#ifdef VSOMEIP_DEBUGGING
-void deserializer::show() const {
- std::stringstream its_message;
- its_message << "("
- << std::hex << std::setw(2) << std::setfill('0')
- << (int)*position_ << ", "
- << std:: dec << remaining_ << ") ";
- for (int i = 0; i < data_.size(); ++i)
- its_message << std::hex << std::setw(2) << std::setfill('0')
- << (int)data_[i] << " ";
- VSOMEIP_INFO << its_message;
-}
-#endif
-
-} // namespace vsomeip
diff --git a/implementation/message/src/message_base_impl.cpp b/implementation/message/src/message_base_impl.cpp
deleted file mode 100644
index e32a914..0000000
--- a/implementation/message/src/message_base_impl.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (C) 2014-2017 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/message_impl.hpp"
-#include "../../utility/include/byteorder.hpp"
-
-namespace vsomeip {
-
-message_base_impl::message_base_impl()
- : is_reliable_(false),
- is_initial_(false),
- is_valid_crc_(true) {
- header_.set_owner(this);
-}
-
-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_);
-}
-
-void message_base_impl::set_message(message_t _message) {
- header_.service_ = VSOMEIP_LONG_WORD0(_message);
- header_.method_ = VSOMEIP_LONG_WORD1(_message);
-}
-
-service_t message_base_impl::get_service() const {
- return header_.service_;
-}
-
-void message_base_impl::set_service(service_t _service) {
- header_.service_ = _service;
-}
-
-instance_t message_base_impl::get_instance() const {
- return header_.instance_;
-}
-
-void message_base_impl::set_instance(instance_t _instance) {
- header_.instance_ = _instance;
-}
-
-method_t message_base_impl::get_method() const {
- return header_.method_;
-}
-
-void message_base_impl::set_method(method_t _method) {
- header_.method_ = _method;
-}
-
-request_t message_base_impl::get_request() const {
- return VSOMEIP_WORDS_TO_LONG(header_.client_, header_.session_);
-}
-
-client_t message_base_impl::get_client() const {
- return header_.client_;
-}
-
-void message_base_impl::set_client(client_t _client) {
- header_.client_ = _client;
-}
-
-session_t message_base_impl::get_session() const {
- return header_.session_;
-}
-
-void message_base_impl::set_session(session_t _session) {
- header_.session_ = _session;
-}
-
-protocol_version_t message_base_impl::get_protocol_version() const {
- return header_.protocol_version_;
-}
-
-void message_base_impl::set_protocol_version(protocol_version_t _protocol_version) {
- header_.protocol_version_ = _protocol_version;
-}
-
-interface_version_t message_base_impl::get_interface_version() const {
- return header_.interface_version_;
-}
-
-void message_base_impl::set_interface_version(interface_version_t _interface_version) {
- header_.interface_version_ = _interface_version;
-}
-
-message_type_e message_base_impl::get_message_type() const {
- return header_.type_;
-}
-
-void message_base_impl::set_message_type(message_type_e _type) {
- header_.type_ = _type;
-}
-
-return_code_e message_base_impl::get_return_code() const {
- return header_.code_;
-}
-
-void message_base_impl::set_return_code(return_code_e _code) {
- header_.code_ = _code;
-}
-
-bool message_base_impl::is_reliable() const {
- return is_reliable_;
-}
-
-void message_base_impl::set_reliable(bool _is_reliable) {
- is_reliable_ = _is_reliable;
-}
-
-bool message_base_impl::is_initial() const {
- return is_initial_;
-}
-void message_base_impl::set_initial(bool _is_initial) {
- is_initial_ = _is_initial;
-}
-
-bool message_base_impl::is_valid_crc() const {
- return is_valid_crc_;
-}
-
-void message_base_impl::set_is_valid_crc(bool _is_valid_crc) {
- is_valid_crc_ = _is_valid_crc;
-}
-
-
-} // namespace vsomeip
diff --git a/implementation/message/src/message_header_impl.cpp b/implementation/message/src/message_header_impl.cpp
deleted file mode 100644
index 3965453..0000000
--- a/implementation/message/src/message_header_impl.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/defines.hpp>
-
-#include "../include/message_base_impl.hpp"
-#include "../include/message_header_impl.hpp"
-#include "../include/serializer.hpp"
-#include "../include/deserializer.hpp"
-
-namespace vsomeip {
-
-message_header_impl::message_header_impl()
- : service_(0x0), method_(0x0), length_(0x0),
- client_(0x0), session_(0x0),
- protocol_version_(0x1), interface_version_(0x0),
- type_(message_type_e::MT_UNKNOWN),
- code_(return_code_e::E_UNKNOWN),
- instance_(0x0), owner_(0x0) {
-}
-
-message_header_impl::message_header_impl(const message_header_impl &_header)
- : service_(_header.service_), method_(_header.method_),
- length_(_header.length_),
- client_(_header.client_), session_(_header.session_),
- protocol_version_(_header.protocol_version_),
- interface_version_(_header.interface_version_),
- type_(_header.type_),
- code_(_header.code_),
- instance_(_header.instance_), owner_(_header.owner_) {
-}
-
-bool message_header_impl::serialize(serializer *_to) const {
- return (0 != _to
- && _to->serialize(service_)
- && _to->serialize(method_)
- && _to->serialize(owner_->get_length())
- && _to->serialize(client_)
- && _to->serialize(session_)
- && _to->serialize(protocol_version_)
- && _to->serialize(interface_version_)
- && _to->serialize(static_cast<uint8_t>(type_))
- && _to->serialize(static_cast<uint8_t>(code_)));
-}
-
-bool message_header_impl::deserialize(deserializer *_from) {
- bool is_successful;
-
- uint8_t tmp_message_type, tmp_return_code;
-
- is_successful = (0 != _from
- && _from->deserialize(service_)
- && _from->deserialize(method_)
- && _from->deserialize(length_)
- && _from->deserialize(client_)
- && _from->deserialize(session_)
- && _from->deserialize(protocol_version_)
- && _from->deserialize(interface_version_)
- && _from->deserialize(tmp_message_type)
- && _from->deserialize(tmp_return_code));
-
- if (is_successful) {
- type_ = static_cast< message_type_e >(tmp_message_type);
- code_ = static_cast< return_code_e >(tmp_return_code);
- }
-
- return is_successful;
-}
-
-message_base * message_header_impl::get_owner() const {
- return owner_;
-}
-
-void message_header_impl::set_owner(message_base *_owner) {
- owner_ = _owner;
-}
-
-} // namespace vsomeip
diff --git a/implementation/message/src/message_impl.cpp b/implementation/message/src/message_impl.cpp
deleted file mode 100644
index 09a7ba8..0000000
--- a/implementation/message/src/message_impl.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/defines.hpp>
-#include <vsomeip/payload.hpp>
-#include <vsomeip/runtime.hpp>
-
-#include "../include/message_impl.hpp"
-#include "../../utility/include/byteorder.hpp"
-
-namespace vsomeip {
-
-message_impl::message_impl()
- : payload_(runtime::get()->create_payload()) {
-}
-
-message_impl::~message_impl() {
-}
-
-length_t message_impl::get_length() const {
- return (VSOMEIP_SOMEIP_HEADER_SIZE
- + (payload_ ? payload_->get_length() : 0));
-}
-
-std::shared_ptr< payload > message_impl::get_payload() const {
- return payload_;
-}
-
-void message_impl::set_payload(std::shared_ptr< payload > _payload) {
- payload_ = _payload;
-}
-
-bool message_impl::serialize(serializer *_to) const {
- return (header_.serialize(_to)
- && (payload_ ? payload_->serialize(_to) : true));
-}
-
-bool message_impl::deserialize(deserializer *_from) {
- payload_ = runtime::get()->create_payload();
- bool is_successful = header_.deserialize(_from);
- if (is_successful) {
- payload_->set_capacity(header_.length_ - VSOMEIP_SOMEIP_HEADER_SIZE);
- is_successful = payload_->deserialize(_from);
- }
- return is_successful;
-}
-
-} // namespace vsomeip
diff --git a/implementation/message/src/payload_impl.cpp b/implementation/message/src/payload_impl.cpp
deleted file mode 100644
index 9794976..0000000
--- a/implementation/message/src/payload_impl.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (C) 2014-2017 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/deserializer.hpp"
-#include "../include/payload_impl.hpp"
-#include "../include/serializer.hpp"
-
-namespace vsomeip {
-
-payload_impl::payload_impl()
- : data_() {
-}
-
-payload_impl::payload_impl(const byte_t *_data, uint32_t _size) {
- data_.assign(_data, _data + _size);
-}
-
-payload_impl::payload_impl(const std::vector<byte_t> &_data)
- : data_(_data) {
-}
-
-payload_impl::payload_impl(const payload_impl& _payload)
- : data_(_payload.data_) {
-}
-
-payload_impl::~payload_impl() {
-}
-
-bool payload_impl::operator==(const payload &_other) {
- bool is_equal(true);
- try {
- const payload_impl &other = dynamic_cast< const payload_impl & >(_other);
- is_equal = (data_ == other.data_);
- }
- catch (...) {
- is_equal = false;
- }
- return is_equal;
-}
-
-byte_t * payload_impl::get_data() {
- return data_.data();
-}
-
-const byte_t * payload_impl::get_data() const {
- return data_.data();
-}
-
-length_t payload_impl::get_length() const {
- return length_t(data_.size());
-}
-
-void payload_impl::set_capacity(length_t _capacity) {
- data_.reserve(_capacity);
-}
-
-void payload_impl::set_data(const byte_t *_data, const length_t _length) {
- data_.assign(_data, _data + _length);
-}
-
-void payload_impl::set_data(const std::vector< byte_t > &_data) {
- data_ = _data;
-}
-
-void payload_impl::set_data(std::vector< byte_t > &&_data) {
- data_ = std::move(_data);
-}
-
-bool payload_impl::serialize(serializer *_to) const {
- return (0 != _to && _to->serialize(data_));
-}
-
-bool payload_impl::deserialize(deserializer *_from) {
- return (0 != _from && _from->deserialize(data_));
-}
-
-} // namespace vsomeip
diff --git a/implementation/message/src/serializer.cpp b/implementation/message/src/serializer.cpp
deleted file mode 100644
index d9277d6..0000000
--- a/implementation/message/src/serializer.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (C) 2014-2017 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 <cstring>
-
-#ifdef VSOMEIP_DEBUGGING
-#include <iomanip>
-#include <sstream>
-#endif
-
-#include <vsomeip/internal/serializable.hpp>
-
-#include "../include/serializer.hpp"
-#include "../../utility/include/byteorder.hpp"
-#include "../../logging/include/logger.hpp"
-
-namespace vsomeip {
-
-serializer::serializer(std::uint32_t _buffer_shrink_threshold) :
- data_(0),
- shrink_count_(0),
- buffer_shrink_threshold_(_buffer_shrink_threshold) {
-}
-
-serializer::~serializer() {
-}
-
-bool serializer::serialize(const serializable *_from) {
- return (_from && _from->serialize(this));
-}
-
-bool serializer::serialize(const uint8_t _value) {
- data_.push_back(_value);
- return true;
-}
-
-bool serializer::serialize(const uint16_t _value) {
- data_.push_back(VSOMEIP_WORD_BYTE1(_value));
- data_.push_back(VSOMEIP_WORD_BYTE0(_value));
- return true;
-}
-
-bool serializer::serialize(const uint32_t _value, bool _omit_last_byte) {
- if (!_omit_last_byte) {
- 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));
- return true;
-}
-
-bool serializer::serialize(const uint8_t *_data, uint32_t _length) {
- try {
- data_.insert(data_.end(), _data, _data + _length);
- } catch(const std::bad_alloc &e) {
- VSOMEIP_ERROR << "Couldn't allocate memory in serializer::serialize(*_data, length)" << e.what();
- return false;
- }
- return true;
-}
-
-bool serializer::serialize(const std::vector<byte_t> &_data) {
- try {
- data_.insert(data_.end(),_data.begin(), _data.end());
- } catch(const std::bad_alloc &e) {
- VSOMEIP_ERROR << "Couldn't allocate memory in serializer::serialize(vector)" << e.what();
- return false;
- }
- return true;
-}
-
-const byte_t * serializer::get_data() const {
- return data_.data();
-}
-
-uint32_t serializer::get_capacity() const {
- return static_cast<std::uint32_t>(data_.max_size());
-}
-
-uint32_t serializer::get_size() const {
- return static_cast<std::uint32_t>(data_.size());
-}
-
-void serializer::set_data(byte_t *_data, uint32_t _capacity) {
- data_.clear();
- try {
- data_.insert(data_.end(), _data, _data + _capacity);
- } catch(const std::bad_alloc &e) {
- VSOMEIP_ERROR << "Couldn't allocate memory in serializer::set_data" << e.what();
- }
-}
-
-void serializer::reset() {
- if (buffer_shrink_threshold_) {
- if (data_.size() < (data_.capacity() >> 1)) {
- shrink_count_++;
- } else {
- shrink_count_ = 0;
- }
- }
- data_.clear();
- if (buffer_shrink_threshold_ && shrink_count_ > buffer_shrink_threshold_) {
- data_.shrink_to_fit();
- shrink_count_ = 0;
- }
-}
-
-#ifdef VSOMEIP_DEBUGGING
-void serializer::show() {
- std::stringstream its_data;
- its_data << "SERIALIZED: ";
- for (const byte_t& e : data_)
- its_data << std::setw(2) << std::setfill('0')
- << std::hex << (int)e;
- VSOMEIP_INFO << its_data.str();
-}
-#endif
-
-} // namespace vsomeip
diff --git a/implementation/plugin/include/plugin_manager.hpp b/implementation/plugin/include/plugin_manager.hpp
deleted file mode 100644
index 98afd72..0000000
--- a/implementation/plugin/include/plugin_manager.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (C) 2016-2017 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_PLUGIN_MANAGER_HPP
-#define VSOMEIP_PLUGIN_MANAGER_HPP
-
-#include <map>
-#include <chrono>
-#include <mutex>
-#include <set>
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/export.hpp>
-#include <vsomeip/plugin.hpp>
-
-namespace vsomeip {
-
-class plugin_manager {
-public:
- VSOMEIP_EXPORT static std::shared_ptr<plugin_manager> get();
-
- plugin_manager();
-
- ~plugin_manager();
-
- VSOMEIP_EXPORT void load_plugins();
-
- VSOMEIP_EXPORT std::shared_ptr<plugin> get_plugin(plugin_type_e _type, std::string _name);
-
- VSOMEIP_EXPORT std::shared_ptr<plugin> load_plugin(
- const std::string _library, plugin_type_e _type,
- const uint32_t _version);
-
- VSOMEIP_EXPORT bool unload_plugin(plugin_type_e _type);
-
-private:
- void add_plugin(const std::shared_ptr<plugin> &_plugin, const std::string _name);
-
- void * load_library(const std::string &_path);
- void * load_symbol(void * _handle, const std::string &_symbol);
-
- bool plugins_loaded_;
- std::mutex loader_mutex_;
-
- std::map<plugin_type_e, std::map<std::string, std::shared_ptr<plugin> > > plugins_;
- std::map<plugin_type_e, std::map<std::string, void*> > handles_;
- std::mutex plugins_mutex_;
-
- static std::shared_ptr<plugin_manager> the_plugin_manager__;
-};
-}
-
-#endif // VSOMEIP_PLUGIN_MANAGER_HPP
diff --git a/implementation/plugin/src/plugin_manager.cpp b/implementation/plugin/src/plugin_manager.cpp
deleted file mode 100644
index e922fd6..0000000
--- a/implementation/plugin/src/plugin_manager.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright (C) 2016-2017 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 <sstream>
-#include <vector>
-#include <stdlib.h>
-#include <iostream>
-
-#ifdef _WIN32
- #ifndef _WINSOCKAPI_
- #include <Windows.h>
- #endif
-#else
- #include <dlfcn.h>
-#endif
-
-#include <vsomeip/plugins/application_plugin.hpp>
-#include <vsomeip/plugins/pre_configuration_plugin.hpp>
-
-#include "../include/plugin_manager.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../utility/include/utility.hpp"
-
-namespace vsomeip {
-
-std::shared_ptr<plugin_manager> plugin_manager::the_plugin_manager__ =
- std::make_shared<plugin_manager>();
-
-std::shared_ptr<plugin_manager> plugin_manager::get() {
- return the_plugin_manager__;
-}
-
-plugin_manager::plugin_manager() :
- plugins_loaded_(false) {
-}
-
-plugin_manager::~plugin_manager() {
- handles_.clear();
- plugins_.clear();
-}
-
-void plugin_manager::load_plugins() {
- {
- std::lock_guard<std::mutex> its_lock_start_stop(loader_mutex_);
- if (plugins_loaded_) {
- return;
- }
- plugins_loaded_ = true;
- }
-
- // Get plug-ins libraries from environment
- std::vector<std::string> plugins;
- const char *its_plugins = getenv(VSOMEIP_ENV_LOAD_PLUGINS);
- if (nullptr != its_plugins) {
- std::string token;
- std::stringstream ss(its_plugins);
- while(std::getline(ss, token, ',')) {
- plugins.push_back(token);
- }
- }
-
- std::lock_guard<std::mutex> its_lock_start_stop(plugins_mutex_);
- // Load plug-in info from libraries parsed before
- for (auto plugin_name : plugins) {
- void* handle = load_library(plugin_name);
- plugin_init_func its_init_func = reinterpret_cast<plugin_init_func>(
- load_symbol(handle, VSOMEIP_PLUGIN_INIT_SYMBOL));
- if (its_init_func) {
- create_plugin_func its_create_func = (*its_init_func)();
- if (its_create_func) {
- auto its_plugin = (*its_create_func)();
- if (its_plugin) {
- handles_[its_plugin->get_plugin_type()][plugin_name] = handle;
- switch (its_plugin->get_plugin_type()) {
- case plugin_type_e::APPLICATION_PLUGIN:
- if (its_plugin->get_plugin_version()
- == VSOMEIP_APPLICATION_PLUGIN_VERSION) {
- add_plugin(its_plugin, plugin_name);
- } else {
- VSOMEIP_ERROR << "Plugin version mismatch. "
- << "Ignoring application plugin "
- << its_plugin->get_plugin_name();
- }
- break;
- case plugin_type_e::PRE_CONFIGURATION_PLUGIN:
- if (its_plugin->get_plugin_version()
- == VSOMEIP_PRE_CONFIGURATION_PLUGIN_VERSION) {
- add_plugin(its_plugin, plugin_name);
- } else {
- VSOMEIP_ERROR << "Plugin version mismatch. Ignoring "
- << "pre-configuration plugin "
- << its_plugin->get_plugin_name();
- }
- break;
- default:
- break;
- }
- }
- }
- }
- }
-}
-
-std::shared_ptr<plugin> plugin_manager::get_plugin(plugin_type_e _type, std::string _name) {
- std::lock_guard<std::mutex> its_lock_start_stop(plugins_mutex_);
- auto its_type = plugins_.find(_type);
- if (its_type != plugins_.end()) {
- auto its_name = its_type->second.find(_name);
- if (its_name != its_type->second.end()) {
- return its_name->second;
- }
- }
- return load_plugin(_name, _type, 1);
-}
-
-std::shared_ptr<plugin> plugin_manager::load_plugin(const std::string _library,
- plugin_type_e _type, uint32_t _version) {
- void* handle = load_library(_library);
- plugin_init_func its_init_func = reinterpret_cast<plugin_init_func>(
- load_symbol(handle, VSOMEIP_PLUGIN_INIT_SYMBOL));
- if (its_init_func) {
- create_plugin_func its_create_func = (*its_init_func)();
- if (its_create_func) {
- handles_[_type][_library] = handle;
- auto its_plugin = (*its_create_func)();
- if (its_plugin) {
- if (its_plugin->get_plugin_type() == _type
- && its_plugin->get_plugin_version() == _version) {
- add_plugin(its_plugin, _library);
- return its_plugin;
- } else {
- VSOMEIP_ERROR << "Plugin version mismatch. Ignoring plugin "
- << its_plugin->get_plugin_name();
- }
- }
- }
- }
- return nullptr;
-}
-
-bool plugin_manager::unload_plugin(plugin_type_e _type) {
- std::lock_guard<std::mutex> its_lock_start_stop(plugins_mutex_);
- const auto found_handle = handles_.find(_type);
- if (found_handle != handles_.end()) {
- for (auto its_name : found_handle->second) {
-#ifdef _WIN32
- FreeLibrary((HMODULE)its_name.second);
-#else
- if (dlclose(its_name.second)) {
- VSOMEIP_ERROR << "Unloading failed: (" << dlerror() << ")";
- }
-#endif
- }
- } else {
- VSOMEIP_ERROR << "plugin_manager::unload_plugin didn't find plugin"
- << " type:" << (int)_type;
- return false;
- }
- return plugins_.erase(_type);
-}
-
-void plugin_manager::add_plugin(const std::shared_ptr<plugin> &_plugin, const std::string _name) {
- plugins_[_plugin->get_plugin_type()][_name] = _plugin;
-}
-
-void * plugin_manager::load_library(const std::string &_path) {
-#ifdef _WIN32
- return LoadLibrary(_path.c_str());
-#else
- return dlopen(_path.c_str(), RTLD_LAZY | RTLD_GLOBAL);
-#endif
-}
-
-void * plugin_manager::load_symbol(void * _handle,
- const std::string &_symbol) {
- void * its_symbol = 0;
-#ifdef _WIN32
- HINSTANCE hDLL = (HINSTANCE)_handle;
- if (hDLL != NULL) {
-
- typedef UINT(CALLBACK* LPFNDLLFUNC1)(DWORD, UINT);
-
- LPFNDLLFUNC1 lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL, _symbol.c_str());
- if (!lpfnDllFunc1) {
- FreeLibrary(hDLL);
- std::cerr << "Loading symbol \"" << _symbol << "\" failed (" << GetLastError() << ")" << std::endl;
- }
- else {
- its_symbol = lpfnDllFunc1;
- }
- }
-#else
- if (0 != _handle) {
- its_symbol = dlsym(_handle, _symbol.c_str());
- const char *dlsym_error = dlerror();
- if (dlsym_error) {
- VSOMEIP_INFO << "Cannot load symbol : " << _symbol << " : " << dlsym_error;
- dlclose(_handle);
- }
- } else {
- VSOMEIP_ERROR << "Loading failed: (" << dlerror() << ")";
- }
-#endif
- return (its_symbol);
-}
-
-}
diff --git a/implementation/routing/include/event.hpp b/implementation/routing/include/event.hpp
deleted file mode 100644
index ac483ab..0000000
--- a/implementation/routing/include/event.hpp
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright (C) 2014-2017 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_EVENT_IMPL_HPP
-#define VSOMEIP_EVENT_IMPL_HPP
-
-#include <map>
-#include <memory>
-#include <mutex>
-#include <set>
-#include <atomic>
-
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ip/address.hpp>
-#include <boost/asio/steady_timer.hpp>
-
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/function_types.hpp>
-#include <vsomeip/payload.hpp>
-
-namespace vsomeip {
-
-class endpoint;
-class endpoint_definition;
-class message;
-class payload;
-class routing_manager;
-
-class event: public std::enable_shared_from_this<event> {
-public:
- event(routing_manager *_routing, bool _is_shadow = false);
-
- service_t get_service() const;
- void set_service(service_t _service);
-
- instance_t get_instance() const;
- void set_instance(instance_t _instance);
-
- major_version_t get_version() const;
- void set_version(major_version_t _major);
-
- event_t get_event() const;
- void set_event(event_t _event);
-
- const std::shared_ptr<payload> get_payload() const;
-
- void set_payload(const std::shared_ptr<payload> &_payload,
- const client_t _client, bool _force, bool _flush);
-
- void set_payload(const std::shared_ptr<payload> &_payload,
- const std::shared_ptr<endpoint_definition> _target,
- bool _force, bool _flush);
-
- bool set_payload_dont_notify(const std::shared_ptr<payload> &_payload);
-
- void set_payload(const std::shared_ptr<payload> &_payload,
- bool _force, bool _flush);
- void unset_payload(bool _force = false);
-
- bool is_field() const;
- void set_field(bool _is_field);
-
- bool is_provided() const;
- void set_provided(bool _is_provided);
-
- bool is_set() const;
-
- // SIP_RPC_357
- void set_update_cycle(std::chrono::milliseconds &_cycle);
- void set_change_resets_cycle(bool _change_resets_cycle);
-
- // SIP_RPC_358
- void set_update_on_change(bool _is_on);
-
- // SIP_RPC_359 (epsilon change)
- void set_epsilon_change_function(const epsilon_change_func_t &_epsilon_change_func);
-
- const std::set<eventgroup_t> get_eventgroups() const;
- std::set<eventgroup_t> get_eventgroups(client_t _client) const;
- void add_eventgroup(eventgroup_t _eventgroup);
- void set_eventgroups(const std::set<eventgroup_t> &_eventgroups);
-
- void notify_one(const std::shared_ptr<endpoint_definition> &_target, bool _flush);
- void notify_one(client_t _client, bool _flush);
-
- bool add_subscriber(eventgroup_t _eventgroup, client_t _client);
- void remove_subscriber(eventgroup_t _eventgroup, client_t _client);
- bool has_subscriber(eventgroup_t _eventgroup, client_t _client);
- std::set<client_t> get_subscribers();
- void clear_subscribers();
-
- void add_ref(client_t _client, bool _is_provided);
- void remove_ref(client_t _client, bool _is_provided);
- bool has_ref();
-
- bool is_shadow() const;
- void set_shadow(bool _shadow);
-
- bool is_cache_placeholder() const;
- void set_cache_placeholder(bool _is_cache_place_holder);
-
- bool has_ref(client_t _client, bool _is_provided);
-
- std::set<client_t> get_subscribers(eventgroup_t _eventgroup);
-
- bool is_subscribed(client_t _client);
-
- bool is_reliable() const;
- void set_reliable(bool _is_reliable);
-
- bool get_remote_notification_pending();
- void set_remote_notification_pending(bool _value);
-
-private:
- void update_cbk(boost::system::error_code const &_error);
- void notify(bool _flush);
- void notify(client_t _client, const std::shared_ptr<endpoint_definition> &_target);
-
- void start_cycle();
- void stop_cycle();
-
- bool compare(const std::shared_ptr<payload> &_lhs, const std::shared_ptr<payload> &_rhs) const;
-
- bool set_payload_helper(const std::shared_ptr<payload> &_payload, bool _force);
- void reset_payload(const std::shared_ptr<payload> &_payload);
-
-private:
- routing_manager *routing_;
- mutable std::mutex mutex_;
- std::shared_ptr<message> message_;
-
- std::atomic<bool> is_field_;
-
- boost::asio::steady_timer cycle_timer_;
- std::chrono::milliseconds cycle_;
-
- std::atomic<bool> change_resets_cycle_;
- std::atomic<bool> is_updating_on_change_;
-
- mutable std::mutex eventgroups_mutex_;
- std::map<eventgroup_t, std::set<client_t>> eventgroups_;
-
- std::atomic<bool> is_set_;
- std::atomic<bool> is_provided_;
-
- std::mutex refs_mutex_;
- std::map<client_t, std::map<bool, uint32_t>> refs_;
-
- std::atomic<bool> is_shadow_;
- std::atomic<bool> is_cache_placeholder_;
-
- epsilon_change_func_t epsilon_change_func_;
-
- std::atomic<bool> is_reliable_;
-
- std::atomic<bool> remote_notification_pending_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_EVENT_IMPL_HPP
diff --git a/implementation/routing/include/eventgroupinfo.hpp b/implementation/routing/include/eventgroupinfo.hpp
deleted file mode 100644
index 8420fd3..0000000
--- a/implementation/routing/include/eventgroupinfo.hpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (C) 2014-2017 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_EVENTGROUPINFO_HPP
-#define VSOMEIP_EVENTGROUPINFO_HPP
-
-#include <chrono>
-#include <list>
-#include <memory>
-#include <set>
-#include <mutex>
-#include <atomic>
-
-#include <boost/asio/ip/address.hpp>
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/primitive_types.hpp>
-
-#include "types.hpp"
-
-namespace vsomeip {
-
-class endpoint_definition;
-class event;
-
-class eventgroupinfo {
-public:
- struct target_t {
- std::shared_ptr<endpoint_definition> endpoint_;
- std::chrono::steady_clock::time_point expiration_;
-
- bool operator==(const target_t &_other) const {
- return (endpoint_ == _other.endpoint_);
- }
- };
-
- VSOMEIP_EXPORT eventgroupinfo();
- VSOMEIP_EXPORT eventgroupinfo(major_version_t _major, ttl_t _ttl);
- VSOMEIP_EXPORT ~eventgroupinfo();
-
- VSOMEIP_EXPORT major_version_t get_major() const;
- VSOMEIP_EXPORT void set_major(major_version_t _major);
-
- VSOMEIP_EXPORT ttl_t get_ttl() const;
- VSOMEIP_EXPORT void set_ttl(ttl_t _ttl);
-
- VSOMEIP_EXPORT bool is_multicast() const;
- VSOMEIP_EXPORT bool get_multicast(boost::asio::ip::address &_address,
- uint16_t &_port) const;
- VSOMEIP_EXPORT void set_multicast(const boost::asio::ip::address &_address,
- uint16_t _port);
- VSOMEIP_EXPORT bool is_sending_multicast() const;
-
- VSOMEIP_EXPORT const std::set<std::shared_ptr<event> > get_events() const;
- VSOMEIP_EXPORT void add_event(std::shared_ptr<event> _event);
- VSOMEIP_EXPORT void remove_event(std::shared_ptr<event> _event);
- VSOMEIP_EXPORT void get_reliability(bool& _has_reliable, bool& _has_unreliable) const;
-
- VSOMEIP_EXPORT const std::list<target_t> get_targets() const;
- VSOMEIP_EXPORT uint32_t get_unreliable_target_count() const;
-
- VSOMEIP_EXPORT bool add_target(const target_t &_target);
- VSOMEIP_EXPORT bool add_target(const target_t &_target, const target_t &_subscriber);
- VSOMEIP_EXPORT bool update_target(
- const std::shared_ptr<endpoint_definition> &_target,
- const std::chrono::steady_clock::time_point &_expiration);
- VSOMEIP_EXPORT bool remove_target(
- const std::shared_ptr<endpoint_definition> &_target);
- VSOMEIP_EXPORT void clear_targets();
-
- VSOMEIP_EXPORT void add_multicast_target(const target_t &_multicast_target);
- VSOMEIP_EXPORT void clear_multicast_targets();
- VSOMEIP_EXPORT const std::list<target_t> get_multicast_targets() const;
-
- VSOMEIP_EXPORT uint8_t get_threshold() const;
- VSOMEIP_EXPORT void set_threshold(uint8_t _threshold);
-
- VSOMEIP_EXPORT std::unique_lock<std::mutex> get_subscription_lock();
-
- VSOMEIP_EXPORT pending_subscription_id_t add_pending_subscription(
- pending_subscription_t _pending_subscription);
-
- VSOMEIP_EXPORT std::vector<pending_subscription_t> remove_pending_subscription(
- pending_subscription_id_t _subscription_id);
-
- VSOMEIP_EXPORT void clear_pending_subscriptions();
-private:
- std::atomic<major_version_t> major_;
- std::atomic<ttl_t> ttl_;
-
- mutable std::mutex address_mutex_;
- boost::asio::ip::address address_;
- uint16_t port_;
-
- mutable std::mutex events_mutex_;
- std::set<std::shared_ptr<event> > events_;
- mutable std::mutex targets_mutex_;
- std::list<target_t> targets_;
- mutable std::mutex multicast_targets_mutex_;
- std::list<target_t> multicast_targets_;
-
- std::atomic<uint8_t> threshold_;
- std::mutex subscription_mutex_;
-
- std::atomic<bool> has_reliable_;
- std::atomic<bool> has_unreliable_;
-
- std::mutex pending_subscriptions_mutex_;
- std::map<pending_subscription_id_t, pending_subscription_t> pending_subscriptions_;
- std::map<std::pair<boost::asio::ip::address, std::uint16_t>,
- std::vector<pending_subscription_id_t>> pending_subscriptions_by_remote_;
- pending_subscription_id_t subscription_id_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_EVENTGROUPINFO_HPP
diff --git a/implementation/routing/include/routing_manager.hpp b/implementation/routing/include/routing_manager.hpp
deleted file mode 100644
index f02c533..0000000
--- a/implementation/routing/include/routing_manager.hpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (C) 2014-2017 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_ROUTING_MANAGER
-#define VSOMEIP_ROUTING_MANAGER
-
-#include <memory>
-#include <set>
-#include <vector>
-
-#include <boost/asio/io_service.hpp>
-
-#include <vsomeip/function_types.hpp>
-#include <vsomeip/message.hpp>
-#include <vsomeip/handler.hpp>
-
-namespace vsomeip {
-
-class endpoint;
-class endpoint_definition;
-class event;
-class payload;
-
-class routing_manager {
-public:
- virtual ~routing_manager() {
- }
-
- virtual boost::asio::io_service & get_io() = 0;
- virtual client_t get_client() const = 0;
-
- virtual void init() = 0;
- virtual void start() = 0;
- virtual void stop() = 0;
-
- virtual bool offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor) = 0;
-
- virtual void stop_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor) = 0;
-
- virtual void request_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor, bool _use_exclusive_proxy) = 0;
-
- virtual void release_service(client_t _client, service_t _service,
- instance_t _instance) = 0;
-
- virtual void subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major, event_t _event,
- subscription_type_e _subscription_type) = 0;
-
- virtual void unsubscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event) = 0;
-
- virtual bool send(client_t _client, std::shared_ptr<message> _message,
- bool _flush) = 0;
-
- virtual bool send(client_t _client, const byte_t *_data, uint32_t _size,
- instance_t _instance, bool _flush, bool _reliable, bool _is_valid_crc = true) = 0;
-
- virtual bool send_to(const std::shared_ptr<endpoint_definition> &_target,
- std::shared_ptr<message>, bool _flush) = 0;
-
- virtual bool send_to(const std::shared_ptr<endpoint_definition> &_target,
- const byte_t *_data, uint32_t _size, instance_t _instance,
- bool _flush) = 0;
-
- virtual void register_event(client_t _client, service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroups, bool _is_field,
- std::chrono::milliseconds _cycle, bool _change_resets_cycle,
- epsilon_change_func_t _epsilon_change_func,
- bool _is_provided, bool _is_shadow = false,
- bool _is_cache_placeholder = false) = 0;
-
- virtual void unregister_event(client_t _client, service_t _service,
- instance_t _instance, event_t _event, bool _is_provided) = 0;
-
- virtual std::shared_ptr<event> find_event(service_t _service,
- instance_t _instance, event_t _event) const = 0;
-
- virtual std::set<std::shared_ptr<event>> find_events(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) const = 0;
-
- virtual void notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- bool _force, bool _flush) = 0;
-
- virtual void notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- client_t _client, bool _force, bool _flush) = 0;
-
- virtual void on_identify_response(client_t _client, service_t _service,
- instance_t _instance, bool _reliable) = 0;
-
- virtual void set_routing_state(routing_state_e _routing_state) = 0;
-
- virtual void send_get_offered_services_info(client_t _client, offer_type_e _offer_type) = 0;
-};
-
-} // namespace vsomeip
-
-#endif
diff --git a/implementation/routing/include/routing_manager_adapter.hpp b/implementation/routing/include/routing_manager_adapter.hpp
deleted file mode 100644
index 3d81120..0000000
--- a/implementation/routing/include/routing_manager_adapter.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2014-2017 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_ROUTING_MANAGER_ADAPTER
-#define VSOMEIP_ROUTING_MANAGER_ADAPTER
-
-namespace vsomeip {
-
-class routing_manager;
-
-class routing_manager_adapter {
-public:
- virtual ~routing_manager_adapter() {
- }
-
- virtual routing_manager * get_manager() = 0;
- virtual void process_command(const byte_t *_data, length_t _length) = 0;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ROUTING_MANAGER_ADAPTER_HPP
diff --git a/implementation/routing/include/routing_manager_base.hpp b/implementation/routing/include/routing_manager_base.hpp
deleted file mode 100644
index 7bf3a4d..0000000
--- a/implementation/routing/include/routing_manager_base.hpp
+++ /dev/null
@@ -1,284 +0,0 @@
-// Copyright (C) 2014-2017 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_ROUTING_MANAGER_BASE
-#define VSOMEIP_ROUTING_MANAGER_BASE
-
-#include <mutex>
-#include <unordered_set>
-#include <queue>
-#include <condition_variable>
-
-#include <vsomeip/constants.hpp>
-#include "routing_manager.hpp"
-#include "routing_manager_host.hpp"
-#include "types.hpp"
-#include "serviceinfo.hpp"
-#include "event.hpp"
-#include "eventgroupinfo.hpp"
-#include "../../message/include/serializer.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../configuration/include/configuration.hpp"
-#include "../../endpoints/include/endpoint_host.hpp"
-
-#ifdef USE_DLT
-#include "../../tracing/include/trace_connector.hpp"
-#endif
-
-#ifdef USE_DLT
-namespace tc {
-class trace_connector;
-} // namespace tc
-#endif
-
-namespace vsomeip {
-
-class serializer;
-
-class routing_manager_base : public routing_manager,
- public endpoint_host,
- public std::enable_shared_from_this<routing_manager_base>{
-
-public:
- routing_manager_base(routing_manager_host *_host);
- virtual ~routing_manager_base();
-
- virtual boost::asio::io_service & get_io();
- virtual client_t get_client() const;
-
- virtual void init();
-
- virtual bool offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor);
-
- virtual void stop_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor);
-
- virtual void request_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor, bool _use_exclusive_proxy);
-
- virtual void release_service(client_t _client, service_t _service,
- instance_t _instance);
-
- virtual void register_event(client_t _client, service_t _service, instance_t _instance,
- event_t _event, const std::set<eventgroup_t> &_eventgroups, bool _is_field,
- std::chrono::milliseconds _cycle, bool _change_resets_cycle,
- epsilon_change_func_t _epsilon_change_func,
- bool _is_provided, bool _is_shadow = false, bool _is_cache_placeholder = false);
-
- virtual void unregister_event(client_t _client, service_t _service, instance_t _instance,
- event_t _event, bool _is_provided);
-
- virtual std::set<std::shared_ptr<event>> find_events(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) const;
-
- virtual void subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major, event_t _event,
- subscription_type_e _subscription_type);
-
- virtual void unsubscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event);
-
- virtual void notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- bool _force, bool _flush);
-
- virtual void notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- client_t _client, bool _force, bool _flush);
-
- virtual bool send(client_t _client, std::shared_ptr<message> _message,
- bool _flush);
-
- virtual bool send(client_t _client, const byte_t *_data, uint32_t _size,
- instance_t _instance, bool _flush, bool _reliable, bool _is_valid_crc = true) = 0;
-
- // Endpoint host ~> will be implemented by routing_manager_impl/_proxy/
- virtual void on_connect(std::shared_ptr<endpoint> _endpoint) = 0;
- virtual void on_disconnect(std::shared_ptr<endpoint> _endpoint) = 0;
- virtual void on_message(const byte_t *_data, length_t _length,
- endpoint *_receiver, const boost::asio::ip::address &_destination
- = boost::asio::ip::address(), client_t _bound_client = VSOMEIP_ROUTING_CLIENT,
- const boost::asio::ip::address &_remote_address = boost::asio::ip::address(),
- std::uint16_t _remote_port = 0) = 0;
- virtual void on_error(const byte_t *_data, length_t _length,
- endpoint *_receiver,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port) = 0;
-
-#ifndef _WIN32
- virtual bool check_credentials(client_t _client, uid_t _uid, gid_t _gid);
-#endif
-
- virtual void set_routing_state(routing_state_e _routing_state) = 0;
-
- virtual std::shared_ptr<event> find_event(service_t _service, instance_t _instance,
- event_t _event) const;
-
- virtual void register_client_error_handler(client_t _client,
- const std::shared_ptr<endpoint> &_endpoint) = 0;
-
- virtual void send_get_offered_services_info(client_t _client, offer_type_e _offer_type) = 0;
-
-protected:
- std::shared_ptr<serviceinfo> find_service(service_t _service, instance_t _instance) const;
- std::shared_ptr<serviceinfo> create_service_info(service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor, ttl_t _ttl, bool _is_local_service);
-
- void clear_service_info(service_t _service, instance_t _instance, bool _reliable);
- services_t get_services() const;
- bool is_available(service_t _service, instance_t _instance, major_version_t _major);
- client_t find_local_client(service_t _service, instance_t _instance);
-
- std::shared_ptr<endpoint> create_local(client_t _client);
- std::shared_ptr<endpoint> find_or_create_local(client_t _client);
- void remove_local(client_t _client);
- void remove_local(client_t _client,
- const std::set<std::tuple<service_t, instance_t, eventgroup_t>>& _subscribed_eventgroups);
-
- std::shared_ptr<endpoint> find_local(client_t _client);
- std::shared_ptr<endpoint> find_local(service_t _service,
- instance_t _instance);
-
- std::unordered_set<client_t> get_connected_clients();
-
- std::shared_ptr<eventgroupinfo> find_eventgroup(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) const;
-
- void remove_eventgroup_info(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup);
-
- bool send_local_notification(client_t _client,
- const byte_t *_data, uint32_t _size, instance_t _instance,
- bool _flush = true, bool _reliable = false, bool _is_valid_crc = true);
-
- bool send_local(
- std::shared_ptr<endpoint> &_target, client_t _client,
- const byte_t *_data, uint32_t _size, instance_t _instance,
- bool _flush, bool _reliable, uint8_t _command, bool _is_valid_crc = true) const;
-
- bool insert_subscription(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event, client_t _client,
- std::set<event_t> *_already_subscribed_events);
-
- std::shared_ptr<deserializer> get_deserializer();
- void put_deserializer(std::shared_ptr<deserializer>);
-
- void send_pending_subscriptions(service_t _service,
- instance_t _instance, major_version_t _major);
-
- virtual void send_subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major, event_t _event,
- subscription_type_e _subscription_type) = 0;
-
- void remove_pending_subscription(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event);
-
- void send_pending_notify_ones(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, client_t _client);
-
- void unset_all_eventpayloads(service_t _service, instance_t _instance);
- void unset_all_eventpayloads(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup);
-
- void notify_one_current_value(client_t _client, service_t _service,
- instance_t _instance,
- eventgroup_t _eventgroup, event_t _event,
- const std::set<event_t> &_events_to_exclude);
-
- void send_identify_request(service_t _service, instance_t _instance,
- major_version_t _major, bool _reliable);
-
- std::map<client_t, std::shared_ptr<endpoint>> get_local_endpoints();
-
- std::set<std::tuple<service_t, instance_t, eventgroup_t>>
- get_subscriptions(const client_t _client);
-private:
- std::shared_ptr<endpoint> create_local_unlocked(client_t _client);
- std::shared_ptr<endpoint> find_local_unlocked(client_t _client);
-
-
- virtual bool create_placeholder_event_and_subscribe(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, client_t _client) = 0;
-
-protected:
- routing_manager_host *host_;
- boost::asio::io_service &io_;
- client_t client_;
-
- std::shared_ptr<configuration> configuration_;
- std::shared_ptr<serializer> serializer_;
- std::mutex serialize_mutex_;
-
- std::queue<std::shared_ptr<deserializer>> deserializers_;
- std::mutex deserializer_mutex_;
- std::condition_variable deserializer_condition_;
-
- std::mutex local_services_mutex_;
- std::map<service_t, std::map<instance_t, std::tuple< major_version_t, minor_version_t, client_t> > > local_services_;
-
- // Eventgroups
- mutable std::mutex eventgroups_mutex_;
- std::map<service_t,
- std::map<instance_t,
- std::map<eventgroup_t, std::shared_ptr<eventgroupinfo> > > > eventgroups_;
- // Events (part of one or more eventgroups)
- mutable std::mutex events_mutex_;
- std::map<service_t,
- std::map<instance_t, std::map<event_t, std::shared_ptr<event> > > > events_;
-
-#ifdef USE_DLT
- std::shared_ptr<tc::trace_connector> tc_;
-#endif
-
- struct subscription_data_t {
- service_t service_;
- instance_t instance_;
- eventgroup_t eventgroup_;
- major_version_t major_;
- event_t event_;
- subscription_type_e subscription_type_;
-
- bool operator<(const subscription_data_t &_other) const {
- return (service_ < _other.service_
- || (service_ == _other.service_
- && instance_ < _other.instance_)
- || (service_ == _other.service_
- && instance_ == _other.instance_
- && eventgroup_ < _other.eventgroup_)
- || (service_ == _other.service_
- && instance_ == _other.instance_
- && eventgroup_ == _other.eventgroup_
- && event_ < _other.event_));
- }
- };
- std::set<subscription_data_t> pending_subscriptions_;
-
- services_t services_remote_;
- std::mutex services_remote_mutex_;
-
-private:
- services_t services_;
- mutable std::mutex services_mutex_;
-
- std::map<client_t, std::shared_ptr<endpoint> > local_endpoints_;
- mutable std::mutex local_endpoint_mutex_;
-
- std::map<service_t,
- std::map<instance_t,
- std::map<eventgroup_t,
- std::shared_ptr<message> > > > pending_notify_ones_;
- std::mutex pending_notify_ones_mutex_;
-};
-
-} // namespace vsomeip
-
-#endif //VSOMEIP_ROUTING_MANAGER_BASE
diff --git a/implementation/routing/include/routing_manager_host.hpp b/implementation/routing/include/routing_manager_host.hpp
deleted file mode 100644
index c9f8841..0000000
--- a/implementation/routing/include/routing_manager_host.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2014-2017 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_ROUTING_MANAGER_HOST
-#define VSOMEIP_ROUTING_MANAGER_HOST
-
-#include <memory>
-
-#include <boost/asio/io_service.hpp>
-
-#include <vsomeip/error.hpp>
-
-namespace vsomeip {
-
-class configuration;
-class message;
-
-class routing_manager_host {
-public:
- virtual ~routing_manager_host() {
- }
-
- virtual client_t get_client() const = 0;
- virtual const std::string & get_name() const = 0;
- virtual std::shared_ptr<configuration> get_configuration() const = 0;
- virtual boost::asio::io_service & get_io() = 0;
-
- virtual void on_availability(service_t _service, instance_t _instance,
- bool _is_available, major_version_t _major = DEFAULT_MAJOR, minor_version_t _minor = DEFAULT_MINOR) = 0;
- virtual void on_state(state_type_e _state) = 0;
- virtual void on_message(const std::shared_ptr<message> &&_message) = 0;
- virtual void on_error(error_code_e _error) = 0;
- virtual void on_subscription(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, client_t _client, bool _subscribed, std::function<void(bool)> _accepted_cb) = 0;
- virtual void on_subscription_error(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, uint16_t _error) = 0;
- virtual void on_subscription_status(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event, uint16_t _error) = 0;
- virtual void send(std::shared_ptr<message> _message, bool _flush) = 0;
- virtual void on_offered_services_info(std::vector<std::pair<service_t, instance_t>> &_services) = 0;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ROUTING_MANAGER_HOST
diff --git a/implementation/routing/include/routing_manager_impl.hpp b/implementation/routing/include/routing_manager_impl.hpp
deleted file mode 100644
index 2e90077..0000000
--- a/implementation/routing/include/routing_manager_impl.hpp
+++ /dev/null
@@ -1,469 +0,0 @@
-// Copyright (C) 2014-2017 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_ROUTING_MANAGER_IMPL_HPP
-#define VSOMEIP_ROUTING_MANAGER_IMPL_HPP
-
-#include <map>
-#include <memory>
-#include <mutex>
-#include <vector>
-#include <list>
-#include <unordered_set>
-
-#include <boost/asio/ip/address.hpp>
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/steady_timer.hpp>
-
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/handler.hpp>
-
-#include "routing_manager_base.hpp"
-#include "routing_manager_stub_host.hpp"
-#include "types.hpp"
-
-#include "../../endpoints/include/netlink_connector.hpp"
-#include "../../service_discovery/include/service_discovery_host.hpp"
-
-namespace vsomeip {
-
-class configuration;
-class deserializer;
-class eventgroupinfo;
-class routing_manager_host;
-class routing_manager_stub;
-class servicegroup;
-class serializer;
-class service_endpoint;
-
-namespace sd {
-class service_discovery;
-} // namespace sd
-
-
-// TODO: encapsulate common parts of classes "routing_manager_impl"
-// and "routing_manager_proxy" into a base class.
-
-class routing_manager_impl: public routing_manager_base,
- public routing_manager_stub_host,
- public sd::service_discovery_host {
-public:
- routing_manager_impl(routing_manager_host *_host);
- ~routing_manager_impl();
-
- boost::asio::io_service & get_io();
- client_t get_client() const;
- const std::shared_ptr<configuration> get_configuration() const;
-
- void init();
- void start();
- void stop();
-
- bool offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor);
-
- void stop_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor);
-
- void request_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor, bool _use_exclusive_proxy);
-
- void release_service(client_t _client, service_t _service,
- instance_t _instance);
-
- void subscribe(client_t _client, service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, major_version_t _major, event_t _event,
- subscription_type_e _subscription_type);
-
- void unsubscribe(client_t _client, service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event);
-
- bool send(client_t _client, std::shared_ptr<message> _message, bool _flush);
-
- bool send(client_t _client, const byte_t *_data, uint32_t _size,
- instance_t _instance, bool _flush, bool _reliable, bool _is_valid_crc = true);
-
- bool send_to(const std::shared_ptr<endpoint_definition> &_target,
- std::shared_ptr<message> _message, bool _flush);
-
- bool send_to(const std::shared_ptr<endpoint_definition> &_target,
- const byte_t *_data, uint32_t _size,
- instance_t _instance, bool _flush);
-
- bool send_to(const std::shared_ptr<endpoint_definition> &_target,
- const byte_t *_data, uint32_t _size, uint16_t _sd_port);
-
- void register_event(client_t _client, service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroups, bool _is_field,
- std::chrono::milliseconds _cycle, bool _change_resets_cycle,
- epsilon_change_func_t _epsilon_change_func,
- bool _is_provided, bool _is_shadow, bool _is_cache_placeholder);
-
- void register_shadow_event(client_t _client, service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroups,
- bool _is_field, bool _is_provided);
-
- void unregister_shadow_event(client_t _client, service_t _service,
- instance_t _instance, event_t _event,
- bool _is_provided);
-
- void notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- client_t _client, bool _force, bool _flush);
-
- void on_subscribe_nack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- pending_subscription_id_t _subscription_id);
-
- void on_subscribe_ack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- pending_subscription_id_t _subscription_id);
-
- void on_identify_response(client_t _client, service_t _service, instance_t _instance,
- bool _reliable);
-
- // interface to stub
- inline std::shared_ptr<endpoint> find_local(client_t _client) {
- return routing_manager_base::find_local(_client);
- }
- inline std::shared_ptr<endpoint> find_or_create_local(
- client_t _client) {
- return routing_manager_base::find_or_create_local(_client);
- }
-
- void remove_local(client_t _client);
- void on_stop_offer_service(client_t _client, service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor);
-
- void on_availability(service_t _service, instance_t _instance,
- bool _is_available, major_version_t _major, minor_version_t _minor);
-
- void on_pong(client_t _client);
-
- void on_unsubscribe_ack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- pending_subscription_id_t _unsubscription_id);
-
- // interface "endpoint_host"
- std::shared_ptr<endpoint> find_or_create_remote_client(service_t _service,
- instance_t _instance,
- bool _reliable, client_t _client);
- void on_connect(std::shared_ptr<endpoint> _endpoint);
- void on_disconnect(std::shared_ptr<endpoint> _endpoint);
- void on_error(const byte_t *_data, length_t _length, endpoint *_receiver,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port);
- void on_message(const byte_t *_data, length_t _length, endpoint *_receiver,
- const boost::asio::ip::address &_destination,
- client_t _bound_client,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port);
- bool on_message(service_t _service, instance_t _instance,
- const byte_t *_data, length_t _size, bool _reliable, bool _is_valid_crc = true);
- void on_notification(client_t _client, service_t _service,
- instance_t _instance, const byte_t *_data, length_t _size,
- bool _notify_one);
- void release_port(uint16_t _port, bool _reliable);
-
- // interface "service_discovery_host"
- typedef std::map<std::string, std::shared_ptr<servicegroup> > servicegroups_t;
- const servicegroups_t & get_servicegroups() const;
- std::shared_ptr<eventgroupinfo> find_eventgroup(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) const;
- services_t get_offered_services() const;
- std::shared_ptr<serviceinfo> get_offered_service(
- service_t _service, instance_t _instance) const;
- std::map<instance_t, std::shared_ptr<serviceinfo>> get_offered_service_instances(
- service_t _service) const;
-
- std::shared_ptr<endpoint> create_service_discovery_endpoint(const std::string &_address,
- uint16_t _port, bool _reliable);
- void init_routing_info();
- void add_routing_info(service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor, ttl_t _ttl,
- const boost::asio::ip::address &_reliable_address,
- uint16_t _reliable_port,
- const boost::asio::ip::address &_unreliable_address,
- uint16_t _unreliable_port);
- void del_routing_info(service_t _service, instance_t _instance,
- bool _has_reliable, bool _has_unreliable);
- void update_routing_info(std::chrono::milliseconds _elapsed);
-
- void on_remote_subscription(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- const std::shared_ptr<endpoint_definition> &_subscriber,
- const std::shared_ptr<endpoint_definition> &_target, ttl_t _ttl,
- const std::shared_ptr<sd_message_identifier_t> &_sd_message_id,
- const std::function<void(remote_subscription_state_e, client_t)>& _callback);
- void on_unsubscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup,
- std::shared_ptr<endpoint_definition> _target);
- void on_subscribe_ack(service_t _service, instance_t _instance,
- const boost::asio::ip::address &_address, uint16_t _port);
-
- void expire_subscriptions(const boost::asio::ip::address &_address);
- void expire_services(const boost::asio::ip::address &_address);
-
- std::chrono::steady_clock::time_point expire_subscriptions();
-
- bool has_identified(client_t _client, service_t _service,
- instance_t _instance, bool _reliable);
-
- void register_client_error_handler(client_t _client,
- const std::shared_ptr<endpoint> &_endpoint);
- void handle_client_error(client_t _client);
-
- void set_routing_state(routing_state_e _routing_state);
-
- void send_get_offered_services_info(client_t _client, offer_type_e _offer_type) {
- (void) _client;
- (void) _offer_type;
- }
-
- void send_initial_events(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup,
- const std::shared_ptr<endpoint_definition> &_subscriber);
-
-private:
- bool deliver_message(const byte_t *_data, length_t _length,
- instance_t _instance, bool _reliable, bool _is_valid_crc = true);
- bool deliver_notification(service_t _service, instance_t _instance,
- const byte_t *_data, length_t _length, bool _reliable, bool _is_valid_crc = true);
-
- instance_t find_instance(service_t _service, endpoint *_endpoint);
-
- void init_service_info(service_t _service,
- instance_t _instance, bool _is_local_service);
-
- std::shared_ptr<endpoint> create_client_endpoint(
- const boost::asio::ip::address &_address,
- uint16_t _local_port, uint16_t _remote_port,
- bool _reliable, client_t _client);
-
- std::shared_ptr<endpoint> create_server_endpoint(uint16_t _port,
- bool _reliable, bool _start);
- std::shared_ptr<endpoint> find_server_endpoint(uint16_t _port,
- bool _reliable) const;
- std::shared_ptr<endpoint> find_or_create_server_endpoint(uint16_t _port,
- bool _reliable, bool _start);
-
- bool is_field(service_t _service, instance_t _instance,
- event_t _event) const;
-
- std::shared_ptr<endpoint> find_remote_client(service_t _service,
- instance_t _instance, bool _reliable, client_t _client);
-
- std::shared_ptr<endpoint> create_remote_client(service_t _service,
- instance_t _instance, bool _reliable, client_t _client);
-
- bool deliver_specific_endpoint_message(service_t _service, instance_t _instance,
- const byte_t *_data, length_t _size, endpoint *_receiver);
-
- void clear_client_endpoints(service_t _service, instance_t _instance, bool _reliable);
- void clear_multicast_endpoints(service_t _service, instance_t _instance);
-
- bool is_identifying(client_t _client, service_t _service,
- instance_t _instance, bool _reliable);
-
- std::set<eventgroup_t> get_subscribed_eventgroups(service_t _service,
- instance_t _instance);
-private:
- return_code_e check_error(const byte_t *_data, length_t _size,
- instance_t _instance);
-
- void send_error(return_code_e _return_code, const byte_t *_data,
- length_t _size, instance_t _instance, bool _reliable,
- endpoint *_receiver,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port);
-
- void identify_for_subscribe(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- subscription_type_e _subscription_type);
- bool send_identify_message(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- bool _reliable);
-
- bool supports_selective(service_t _service, instance_t _instance);
-
- client_t find_client(service_t _service, instance_t _instance,
- const std::shared_ptr<eventgroupinfo> &_eventgroup,
- const std::shared_ptr<endpoint_definition> &_target) const;
-
- void clear_remote_subscriber(service_t _service, instance_t _instance,
- client_t _client,
- const std::shared_ptr<endpoint_definition> &_target);
-
- void log_version_timer_cbk(boost::system::error_code const & _error);
-
- void clear_remote_service_info(service_t _service, instance_t _instance, bool _reliable);
-
- bool handle_local_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,minor_version_t _minor);
-
- void remove_specific_client_endpoint(client_t _client, service_t _service, instance_t _instance, bool _reliable);
-
- void clear_identified_clients( service_t _service, instance_t _instance);
-
- void clear_identifying_clients( service_t _service, instance_t _instance);
-
- void remove_identified_client(service_t _service, instance_t _instance, client_t _client);
-
- void remove_identifying_client(service_t _service, instance_t _instance, client_t _client);
-
- void unsubscribe_specific_client_at_sd(service_t _service, instance_t _instance, client_t _client);
-
- inline std::shared_ptr<endpoint> find_local(service_t _service, instance_t _instance) {
- return routing_manager_base::find_local(_service, _instance);
- }
-
- void send_subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major, event_t _event,
- subscription_type_e _subscription_type);
-
- void on_net_interface_or_route_state_changed(bool _is_interface,
- std::string _if,
- bool _available);
-
- void start_ip_routing();
-
- void requested_service_add(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor);
- void requested_service_remove(client_t _client, service_t _service,
- instance_t _instance);
-
- void call_sd_endpoint_connected(const boost::system::error_code& _error,
- service_t _service, instance_t _instance,
- std::shared_ptr<endpoint> _endpoint,
- std::shared_ptr<boost::asio::steady_timer> _timer);
-
- bool create_placeholder_event_and_subscribe(service_t _service,
- instance_t _instance,
- eventgroup_t _eventgroup,
- event_t _event,
- client_t _client);
-
- void handle_subscription_state(client_t _client, service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event);
-
- client_t is_specific_endpoint_client(client_t _client, service_t _service, instance_t _instance);
- std::unordered_set<client_t> get_specific_endpoint_clients(service_t _service, instance_t _instance);
-
- void memory_log_timer_cbk(boost::system::error_code const & _error);
- void status_log_timer_cbk(boost::system::error_code const & _error);
-
- void send_subscription(client_t _offering_client,
- client_t _subscribing_client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major,
- pending_subscription_id_t _pending_subscription_id);
-
- void send_unsubscription(
- client_t _offering_client, client_t _subscribing_client,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- pending_subscription_id_t _pending_unsubscription_id);
-
-
-
- std::shared_ptr<routing_manager_stub> stub_;
- std::shared_ptr<sd::service_discovery> discovery_;
-
- // Server endpoints for local services
- typedef std::map<uint16_t, std::map<bool, std::shared_ptr<endpoint>>> server_endpoints_t;
- server_endpoints_t server_endpoints_;
- std::map<service_t, std::map<endpoint *, instance_t> > service_instances_;
-
- // Multicast endpoint info (notifications)
- std::map<service_t, std::map<instance_t, std::shared_ptr<endpoint_definition> > > multicast_info;
-
- // Client endpoints for remote services
- std::map<service_t,
- std::map<instance_t, std::map<bool, std::shared_ptr<endpoint_definition> > > > remote_service_info_;
-
- typedef std::map<service_t, std::map<instance_t, std::map<client_t,
- std::map<bool, std::shared_ptr<endpoint>>>>> remote_services_t;
- remote_services_t remote_services_;
-
- typedef std::map<boost::asio::ip::address, std::map<uint16_t,
- std::map<bool, std::shared_ptr<endpoint>>>> client_endpoints_by_ip_t;
- client_endpoints_by_ip_t client_endpoints_by_ip_;
- std::map<client_t,
- std::map<service_t,
- std::map<instance_t,
- std::set<std::pair<major_version_t, minor_version_t>>>>> requested_services_;
-
- // Mutexes
- mutable std::recursive_mutex endpoint_mutex_;
- std::mutex identified_clients_mutex_;
- std::mutex requested_services_mutex_;
-
- std::mutex remote_subscribers_mutex_;
- std::map<service_t, std::map<instance_t, std::map<client_t,
- std::set<std::shared_ptr<endpoint_definition>>>>> remote_subscribers_;
-
- std::mutex specific_endpoint_clients_mutex_;
- std::map<service_t, std::map<instance_t, std::unordered_set<client_t>>>specific_endpoint_clients_;
- std::map<service_t, std::map<instance_t,
- std::map<bool, std::unordered_set<client_t> > > > identified_clients_;
- std::map<service_t, std::map<instance_t,
- std::map<bool, std::unordered_set<client_t> > > > identifying_clients_;
-
- std::shared_ptr<serviceinfo> sd_info_;
-
- std::map<bool, std::set<uint16_t>> used_client_ports_;
- std::mutex used_client_ports_mutex_;
-
- std::mutex version_log_timer_mutex_;
- boost::asio::steady_timer version_log_timer_;
-
- bool if_state_running_;
- bool sd_route_set_;
- bool routing_running_;
- std::mutex pending_sd_offers_mutex_;
- std::vector<std::pair<service_t, instance_t>> pending_sd_offers_;
-#ifndef _WIN32
- std::shared_ptr<netlink_connector> netlink_connector_;
-#endif
-
-#ifndef WITHOUT_SYSTEMD
- std::mutex watchdog_timer_mutex_;
- boost::asio::steady_timer watchdog_timer_;
- void watchdog_cbk(boost::system::error_code const &_error);
-#endif
-
- std::mutex pending_offers_mutex_;
- // map to store pending offers.
- // 1st client id in tuple: client id of new offering application
- // 2nd client id in tuple: client id of previously/stored offering application
- std::map<service_t,
- std::map<instance_t,
- std::tuple<major_version_t, minor_version_t,
- client_t, client_t>>> pending_offers_;
-
- std::mutex pending_subscription_mutex_;
-
- std::mutex remote_subscription_state_mutex_;
- std::map<std::tuple<service_t, instance_t, eventgroup_t, client_t>,
- subscription_state_e> remote_subscription_state_;
-
- std::map<e2exf::data_identifier, std::shared_ptr<e2e::profile_interface::protector>> custom_protectors;
- std::map<e2exf::data_identifier, std::shared_ptr<e2e::profile_interface::checker>> custom_checkers;
-
- std::mutex status_log_timer_mutex_;
- boost::asio::steady_timer status_log_timer_;
-
- std::mutex memory_log_timer_mutex_;
- boost::asio::steady_timer memory_log_timer_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ROUTING_MANAGER_IMPL_HPP
diff --git a/implementation/routing/include/routing_manager_proxy.hpp b/implementation/routing/include/routing_manager_proxy.hpp
deleted file mode 100644
index a9f0762..0000000
--- a/implementation/routing/include/routing_manager_proxy.hpp
+++ /dev/null
@@ -1,250 +0,0 @@
-// Copyright (C) 2014-2017 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_ROUTING_MANAGER_PROXY_HPP
-#define VSOMEIP_ROUTING_MANAGER_PROXY_HPP
-
-#include <map>
-#include <mutex>
-#include <atomic>
-#include <tuple>
-
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/steady_timer.hpp>
-
-#include "routing_manager_base.hpp"
-#include "types.hpp"
-#include <vsomeip/enumeration_types.hpp>
-#include <vsomeip/handler.hpp>
-
-namespace vsomeip {
-
-class configuration;
-class event;
-class routing_manager_host;
-
-class logger;
-
-class routing_manager_proxy: public routing_manager_base {
-public:
- routing_manager_proxy(routing_manager_host *_host, bool _client_side_logging,
- const std::set<std::tuple<service_t, instance_t> > & _client_side_logging_filter);
- virtual ~routing_manager_proxy();
-
- void init();
- void start();
- void stop();
-
- const std::shared_ptr<configuration> get_configuration() const;
-
- bool offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor);
-
- void stop_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor);
-
- void request_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor, bool _use_exclusive_proxy);
-
- void release_service(client_t _client, service_t _service,
- instance_t _instance);
-
- void subscribe(client_t _client, service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, major_version_t _major, event_t _event,
- subscription_type_e _subscription_type);
-
- void unsubscribe(client_t _client, service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event);
-
- bool send(client_t _client, const byte_t *_data, uint32_t _size,
- instance_t _instance, bool _flush = true, bool _reliable = false, bool _is_valid_crc= true);
-
- bool send_to(const std::shared_ptr<endpoint_definition> &_target,
- std::shared_ptr<message> _message, bool _flush);
-
- bool send_to(const std::shared_ptr<endpoint_definition> &_target,
- const byte_t *_data, uint32_t _size, instance_t _instance, bool _flush);
-
- void register_event(client_t _client, service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroups, bool _is_field,
- std::chrono::milliseconds _cycle, bool _change_resets_cycle,
- epsilon_change_func_t _epsilon_change_func,
- bool _is_provided, bool _is_shadow, bool _is_cache_placeholder);
-
- void unregister_event(client_t _client, service_t _service,
- instance_t _instance, event_t _event,
- bool _is_provided);
-
- void on_connect(std::shared_ptr<endpoint> _endpoint);
- void on_disconnect(std::shared_ptr<endpoint> _endpoint);
- void on_message(const byte_t *_data, length_t _length, endpoint *_receiver,
- const boost::asio::ip::address &_destination,
- client_t _bound_client,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port);
- void on_error(const byte_t *_data, length_t _length, endpoint *_receiver,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port);
- void release_port(uint16_t _port, bool _reliable);
-
- void on_routing_info(const byte_t *_data, uint32_t _size);
-
- void on_identify_response(client_t _client, service_t _service, instance_t _instance,
- bool _reliable);
-
- void register_client_error_handler(client_t _client,
- const std::shared_ptr<endpoint> &_endpoint);
- void handle_client_error(client_t _client);
-
- void on_offered_services_info(const byte_t *_data, uint32_t _size);
-
- void send_get_offered_services_info(client_t _client, offer_type_e _offer_type);
-
-private:
- void register_application();
- void deregister_application();
-
- void reconnect(const std::unordered_set<client_t> &_clients);
-
- void send_pong() const;
- void send_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor);
- void send_release_service(client_t _client, service_t _service,
- instance_t _instance);
- void send_register_event(client_t _client, service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroup,
- bool _is_field, bool _is_provided);
- void send_subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major, event_t _event,
- subscription_type_e _subscription_type);
-
- void send_subscribe_nack(client_t _subscriber, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- pending_subscription_id_t _subscription_id);
-
- void send_subscribe_ack(client_t _subscriber, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- pending_subscription_id_t _subscription_id);
-
- bool is_field(service_t _service, instance_t _instance,
- event_t _event) const;
-
- void on_subscribe_nack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event);
-
- void on_subscribe_ack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event);
-
- void cache_event_payload(const std::shared_ptr<message> &_message);
-
- void on_stop_offer_service(service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor);
-
- void send_pending_commands();
-
- void init_receiver();
-
- void notify_remote_initially(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, const std::set<event_t> &_events_to_exclude);
-
- uint32_t get_remote_subscriber_count(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, bool _increment);
-
- void register_application_timeout_cbk(boost::system::error_code const &_error);
-
- void send_registered_ack();
-
- void set_routing_state(routing_state_e _routing_state) {
- (void)_routing_state;
- };
-
- bool is_client_known(client_t _client);
-
- bool create_placeholder_event_and_subscribe(service_t _service,
- instance_t _instance,
- eventgroup_t _eventgroup,
- event_t _event,
- client_t _client);
-
- void request_debounce_timeout_cbk(boost::system::error_code const &_error);
-
- void send_request_services(std::set<service_data_t>& _requests);
-
- void send_unsubscribe_ack(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup,
- pending_subscription_id_t _subscription_id);
-
-private:
- enum class inner_state_type_e : std::uint8_t {
- ST_REGISTERED = 0x0,
- ST_DEREGISTERED = 0x1,
- ST_REGISTERING = 0x2
- };
-
- bool is_connected_;
- std::atomic<bool> is_started_;
- inner_state_type_e state_;
-
- std::shared_ptr<endpoint> sender_; // --> stub
- std::shared_ptr<endpoint> receiver_; // --> from everybody
-
- std::mutex known_clients_mutex_;
- std::unordered_set<client_t> known_clients_;
-
- std::set<service_data_t> pending_offers_;
- std::set<service_data_t> requests_;
- std::set<service_data_t> requests_to_debounce_;
-
- struct event_data_t {
- service_t service_;
- instance_t instance_;
- event_t event_;
- bool is_field_;
- bool is_provided_;
- std::set<eventgroup_t> eventgroups_;
-
- bool operator<(const event_data_t &_other) const {
- return std::tie(service_, instance_, event_, is_field_,
- is_provided_, eventgroups_)
- < std::tie(_other.service_, _other.instance_, _other.event_,
- _other.is_field_, _other.is_provided_,
- _other.eventgroups_);
- }
- };
- std::set<event_data_t> pending_event_registrations_;
-
- std::map<client_t, std::set<subscription_data_t>> pending_incoming_subscripitons_;
- std::recursive_mutex incoming_subscriptions_mutex_;
-
- std::mutex state_mutex_;
- std::condition_variable state_condition_;
-
- std::map<service_t,
- std::map<instance_t, std::map<eventgroup_t, uint32_t > > > remote_subscriber_count_;
- std::mutex remote_subscriber_count_mutex_;
-
- mutable std::mutex sender_mutex_;
-
- boost::asio::steady_timer register_application_timer_;
-
- std::shared_ptr<logger> logger_;
-
- std::mutex request_timer_mutex_;
- boost::asio::steady_timer request_debounce_timer_;
- bool request_debounce_timer_running_;
-
- const bool client_side_logging_;
- const std::set<std::tuple<service_t, instance_t> > client_side_logging_filter_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ROUTING_MANAGER_PROXY_HPP
diff --git a/implementation/routing/include/routing_manager_stub.hpp b/implementation/routing/include/routing_manager_stub.hpp
deleted file mode 100644
index 3e97a5f..0000000
--- a/implementation/routing/include/routing_manager_stub.hpp
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright (C) 2014-2017 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_ROUTING_MANAGER_STUB
-#define VSOMEIP_ROUTING_MANAGER_STUB
-
-#include <condition_variable>
-#include <list>
-#include <map>
-#include <memory>
-#include <mutex>
-#include <set>
-#include <thread>
-#include <atomic>
-
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/steady_timer.hpp>
-
-#include "../../endpoints/include/endpoint_host.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "types.hpp"
-
-namespace vsomeip {
-
-class configuration;
-class routing_manager_stub_host;
-
-class routing_manager_stub: public endpoint_host,
- public std::enable_shared_from_this<routing_manager_stub> {
-public:
- routing_manager_stub(
- routing_manager_stub_host *_host,
- std::shared_ptr<configuration> _configuration);
- virtual ~routing_manager_stub();
-
- void init();
- void start();
- void stop();
-
- const std::shared_ptr<configuration> get_configuration() const;
-
- void on_connect(std::shared_ptr<endpoint> _endpoint);
- void on_disconnect(std::shared_ptr<endpoint> _endpoint);
- void on_message(const byte_t *_data, length_t _length, endpoint *_receiver,
- const boost::asio::ip::address &_destination,
- client_t _bound_client,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port);
- void on_error(const byte_t *_data, length_t _length, endpoint *_receiver,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port);
- void release_port(uint16_t _port, bool _reliable);
-
- void on_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor);
- void on_stop_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor);
-
- void send_subscribe(std::shared_ptr<vsomeip::endpoint> _target,
- client_t _client, service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, major_version_t _major,
- event_t _event, pending_subscription_id_t _subscription_id);
-
- void send_unsubscribe(std::shared_ptr<vsomeip::endpoint> _target,
- client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, pending_subscription_id_t _unsubscription_id);
-
- void send_subscribe_nack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event);
-
- void send_subscribe_ack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event);
-
- bool contained_in_routing_info(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor) const;
-
- void create_local_receiver();
- bool send_ping(client_t _client);
- bool is_registered(client_t _client) const;
- client_t get_client() const;
- void handle_requests(const client_t _client, std::set<service_data_t>& _requests);
-
- void send_identify_request_command(std::shared_ptr<vsomeip::endpoint> _target,
- service_t _service, instance_t _instance, major_version_t _major,
- bool _reliable);
-
-#ifndef _WIN32
- virtual bool check_credentials(client_t _client, uid_t _uid, gid_t _gid);
-#endif
-
- void update_registration(client_t _client, registration_type_e _type);
-
- void print_endpoint_status() const;
-private:
- void broadcast(const std::vector<byte_t> &_command) const;
-
- void on_register_application(client_t _client);
- void on_deregister_application(client_t _client);
-
- void inform_requesters(client_t _hoster, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor, routing_info_entry_e _entry,
- bool _inform_service);
-
- void broadcast_ping() const;
- void on_pong(client_t _client);
- void start_watchdog();
- void check_watchdog();
- void send_application_lost(std::list<client_t> &_lost);
-
- void client_registration_func(void);
- void init_routing_endpoint();
- void on_ping_timer_expired(boost::system::error_code const &_error);
- void remove_from_pinged_clients(client_t _client);
- void set_routing_state(routing_state_e _routing_state) {
- (void)_routing_state;
- };
-
- bool is_already_connected(client_t _source, client_t _sink);
- void create_client_routing_info(const client_t _target);
- void insert_client_routing_info(client_t _target, routing_info_entry_e _entry,
- client_t _client, service_t _service = ANY_SERVICE,
- instance_t _instance = ANY_INSTANCE,
- major_version_t _major = ANY_MAJOR,
- minor_version_t _minor = ANY_MINOR);
- void send_client_routing_info(const client_t _target);
-
- void create_offered_services_info(const client_t _target);
- void insert_offered_services_info(client_t _target,
- routing_info_entry_e _entry,
- service_t _service,
- instance_t _instance,
- major_version_t _major,
- minor_version_t _minor);
- void send_offered_services_info(const client_t _target);
-
- void on_client_id_timer_expired(boost::system::error_code const &_error);
-
-private:
- routing_manager_stub_host *host_;
- boost::asio::io_service &io_;
- std::mutex watchdog_timer_mutex_;
- boost::asio::steady_timer watchdog_timer_;
-
- boost::asio::steady_timer client_id_timer_;
- std::set<client_t> used_client_ids_;
- std::mutex used_client_ids_mutex_;
-
- std::string endpoint_path_;
- std::string local_receiver_path_;
- std::shared_ptr<endpoint> endpoint_;
- std::shared_ptr<endpoint> local_receiver_;
- std::mutex local_receiver_mutex_;
-
- std::map<client_t,
- std::pair<uint8_t, std::map<service_t, std::map<instance_t, std::pair<major_version_t, minor_version_t>> > > > routing_info_;
- mutable std::mutex routing_info_mutex_;
- std::shared_ptr<configuration> configuration_;
-
- size_t routingCommandSize_;
-
- bool is_socket_activated_;
- std::atomic<bool> client_registration_running_;
- std::shared_ptr<std::thread> client_registration_thread_;
- std::mutex client_registration_mutex_;
- std::condition_variable client_registration_condition_;
-
- std::map<client_t, std::vector<registration_type_e>> pending_client_registrations_;
- const std::uint32_t max_local_message_size_;
- static const std::vector<byte_t> its_ping_;
- const std::chrono::milliseconds configured_watchdog_timeout_;
- boost::asio::steady_timer pinged_clients_timer_;
- std::mutex pinged_clients_mutex_;
- std::map<client_t, boost::asio::steady_timer::time_point> pinged_clients_;
-
- std::map<client_t, std::map<service_t, std::map<instance_t, std::pair<major_version_t, minor_version_t> > > > service_requests_;
- std::map<client_t, std::set<client_t>> connection_matrix_;
-
- std::map<client_t, std::vector<byte_t>> client_routing_info_;
- std::map<client_t, std::vector<byte_t>> offered_services_info_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ROUTING_MANAGER_STUB
-
diff --git a/implementation/routing/include/routing_manager_stub_host.hpp b/implementation/routing/include/routing_manager_stub_host.hpp
deleted file mode 100644
index a6d461e..0000000
--- a/implementation/routing/include/routing_manager_stub_host.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (C) 2014-2017 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_ROUTING_MANAGER_STUB_HOST
-#define VSOMEIP_ROUTING_MANAGER_STUB_HOST
-
-#include <boost/asio/io_service.hpp>
-#include <vsomeip/handler.hpp>
-
-#include "types.hpp"
-
-namespace vsomeip {
-
-class routing_manager_stub_host {
-public:
- virtual ~routing_manager_stub_host() {
- }
-
- virtual bool offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor) = 0;
-
- virtual void stop_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor) = 0;
-
- virtual void request_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor, bool _use_exclusive_proxy) = 0;
-
- virtual void release_service(client_t _client, service_t _service,
- instance_t _instance) = 0;
-
- virtual void register_shadow_event(client_t _client, service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroups,
- bool _is_field, bool _is_provided) = 0;
-
- virtual void unregister_shadow_event(client_t _client, service_t _service,
- instance_t _instance, event_t _event, bool _is_provided) = 0;
-
- virtual void subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major, event_t _event,
- subscription_type_e _subscription_type) = 0;
-
- virtual void on_subscribe_nack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- pending_subscription_id_t _subscription_id) = 0;
-
- virtual void on_subscribe_ack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- pending_subscription_id_t _subscription_id) = 0;
-
- virtual void unsubscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event) = 0;
-
- virtual void on_unsubscribe_ack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- pending_subscription_id_t _unsubscription_id) = 0;
-
- virtual bool on_message(service_t _service, instance_t _instance,
- const byte_t *_data, length_t _size, bool _reliable, bool _is_valid_crc = true) = 0;
-
- virtual void on_notification(client_t _client,
- service_t _service, instance_t _instance,
- const byte_t *_data, length_t _size, bool _notify_one = false) = 0;
-
- virtual void on_stop_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor) = 0;
-
- virtual void on_availability(service_t _service, instance_t _instance,
- bool _is_available, major_version_t _major, minor_version_t _minor) = 0;
-
- virtual std::shared_ptr<endpoint> find_local(client_t _client) = 0;
-
- virtual std::shared_ptr<endpoint> find_or_create_local(
- client_t _client) = 0;
- virtual void remove_local(client_t _client) = 0;
-
- virtual boost::asio::io_service & get_io() = 0;
- virtual client_t get_client() const = 0;
-
- virtual void on_identify_response(client_t _client, service_t _service, instance_t _instance,
- bool _reliable) = 0;
-
- virtual void on_pong(client_t _client) = 0;
-
- virtual void handle_client_error(client_t _client) = 0;
-
- virtual void set_routing_state(routing_state_e _routing_state) = 0;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ROUTING_MANAGER_STUB_HOST
diff --git a/implementation/routing/include/serviceinfo.hpp b/implementation/routing/include/serviceinfo.hpp
deleted file mode 100644
index 7eab1ec..0000000
--- a/implementation/routing/include/serviceinfo.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (C) 2014-2017 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_SERVICEINFO_HPP
-#define VSOMEIP_SERVICEINFO_HPP
-
-#include <memory>
-#include <set>
-#include <string>
-#include <chrono>
-#include <mutex>
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-class endpoint;
-class servicegroup;
-
-class serviceinfo {
-public:
- VSOMEIP_EXPORT serviceinfo(major_version_t _major, minor_version_t _minor,
- ttl_t _ttl, bool _is_local);
- VSOMEIP_EXPORT ~serviceinfo();
-
- VSOMEIP_EXPORT servicegroup * get_group() const;
- VSOMEIP_EXPORT void set_group(servicegroup *_group);
-
- VSOMEIP_EXPORT major_version_t get_major() const;
- VSOMEIP_EXPORT minor_version_t get_minor() const;
-
- VSOMEIP_EXPORT ttl_t get_ttl() const;
- VSOMEIP_EXPORT void set_ttl(ttl_t _ttl);
-
- VSOMEIP_EXPORT std::chrono::milliseconds get_precise_ttl() const;
- VSOMEIP_EXPORT void set_precise_ttl(std::chrono::milliseconds _ttl);
-
- VSOMEIP_EXPORT std::shared_ptr<endpoint> get_endpoint(bool _reliable) const;
- VSOMEIP_EXPORT void set_endpoint(std::shared_ptr<endpoint> _endpoint,
- bool _reliable);
-
- VSOMEIP_EXPORT void add_client(client_t _client);
- VSOMEIP_EXPORT void remove_client(client_t _client);
- VSOMEIP_EXPORT uint32_t get_requesters_size();
-
- VSOMEIP_EXPORT bool is_local() const;
-
- VSOMEIP_EXPORT bool is_in_mainphase() const;
- VSOMEIP_EXPORT void set_is_in_mainphase(bool _in_mainphase);
-
-private:
- servicegroup *group_;
-
- major_version_t major_;
- minor_version_t minor_;
-
- mutable std::mutex ttl_mutex_;
- std::chrono::milliseconds ttl_;
-
- std::shared_ptr<endpoint> reliable_;
- std::shared_ptr<endpoint> unreliable_;
-
- mutable std::mutex endpoint_mutex_;
- std::mutex requesters_mutex_;
- std::set<client_t> requesters_;
-
- bool is_local_;
- bool is_in_mainphase_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_SERVICEINFO_HPP
diff --git a/implementation/routing/include/types.hpp b/implementation/routing/include/types.hpp
deleted file mode 100644
index f33a944..0000000
--- a/implementation/routing/include/types.hpp
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (C) 2014-2017 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_ROUTING_TYPES_HPP
-#define VSOMEIP_ROUTING_TYPES_HPP
-
-#include <map>
-#include <memory>
-#include <boost/asio/ip/address.hpp>
-
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/constants.hpp>
-
-#include "../../service_discovery/include/message_impl.hpp"
-#include "../../configuration/include/internal.hpp"
-
-namespace vsomeip {
-
-class serviceinfo;
-class endpoint_definition;
-
-
-typedef std::map<service_t,
- std::map<instance_t,
- std::shared_ptr<serviceinfo> > > services_t;
-
-class eventgroupinfo;
-
-typedef std::map<service_t,
- std::map<instance_t,
- std::map<eventgroup_t,
- std::shared_ptr<
- eventgroupinfo> > > > eventgroups_t;
-
-enum class registration_type_e : std::uint8_t {
- REGISTER = 0x1,
- DEREGISTER = 0x2,
- DEREGISTER_ON_ERROR = 0x3
-};
-
-struct sd_message_identifier_t {
- sd_message_identifier_t(session_t _session,
- boost::asio::ip::address _sender,
- boost::asio::ip::address _destination,
- const std::shared_ptr<sd::message_impl> &_response) :
- session_(_session),
- sender_(_sender),
- destination_(_destination),
- response_(_response) {
- }
-
- sd_message_identifier_t() :
- session_(0),
- sender_(boost::asio::ip::address()),
- destination_(boost::asio::ip::address()),
- response_(std::shared_ptr<sd::message_impl>()) {
- }
-
- bool operator==(const sd_message_identifier_t &_other) const {
- return !(session_ != _other.session_ ||
- sender_ != _other.sender_ ||
- destination_ != _other.destination_ ||
- response_ != _other.response_);
- }
-
- bool operator<(const sd_message_identifier_t &_other) const {
- return (session_ < _other.session_
- || (session_ == _other.session_ && sender_ < _other.sender_)
- || (session_ == _other.session_ && sender_ == _other.sender_
- && destination_ < _other.destination_)
- || (session_ == _other.session_ && sender_ == _other.sender_
- && destination_ == _other.destination_
- && response_ < _other.response_));
- }
-
- session_t session_;
- boost::asio::ip::address sender_;
- boost::asio::ip::address destination_;
- std::shared_ptr<sd::message_impl> response_;
-};
-
-struct pending_subscription_t {
- pending_subscription_t(
- std::shared_ptr<sd_message_identifier_t> _sd_message_identifier,
- std::shared_ptr<endpoint_definition> _subscriber,
- std::shared_ptr<endpoint_definition> _target,
- ttl_t _ttl,
- client_t _subscribing_client) :
- sd_message_identifier_(_sd_message_identifier),
- subscriber_(_subscriber),
- target_(_target),
- ttl_(_ttl),
- subscribing_client_(_subscribing_client),
- pending_subscription_id_(DEFAULT_SUBSCRIPTION) {
- }
- pending_subscription_t () :
- sd_message_identifier_(std::shared_ptr<sd_message_identifier_t>()),
- subscriber_(std::shared_ptr<endpoint_definition>()),
- target_(std::shared_ptr<endpoint_definition>()),
- ttl_(0),
- subscribing_client_(VSOMEIP_ROUTING_CLIENT),
- pending_subscription_id_(DEFAULT_SUBSCRIPTION) {
- }
- std::shared_ptr<sd_message_identifier_t> sd_message_identifier_;
- std::shared_ptr<endpoint_definition> subscriber_;
- std::shared_ptr<endpoint_definition> target_;
- ttl_t ttl_;
- client_t subscribing_client_;
- pending_subscription_id_t pending_subscription_id_;
-};
-
-enum remote_subscription_state_e : std::uint8_t {
- SUBSCRIPTION_ACKED,
- SUBSCRIPTION_NACKED,
- SUBSCRIPTION_PENDING,
- SUBSCRIPTION_ERROR
-};
-
-}
-// namespace vsomeip
-
-#endif // VSOMEIP_ROUTING_TYPES_HPP
diff --git a/implementation/routing/src/event.cpp b/implementation/routing/src/event.cpp
deleted file mode 100644
index ad228de..0000000
--- a/implementation/routing/src/event.cpp
+++ /dev/null
@@ -1,475 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/constants.hpp>
-#include <vsomeip/defines.hpp>
-#include <vsomeip/message.hpp>
-#include <vsomeip/payload.hpp>
-#include <vsomeip/runtime.hpp>
-
-#include "../include/event.hpp"
-#include "../include/routing_manager.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../message/include/payload_impl.hpp"
-
-namespace vsomeip {
-
-event::event(routing_manager *_routing, bool _is_shadow) :
- routing_(_routing),
- message_(runtime::get()->create_notification()),
- is_field_(false),
- cycle_timer_(_routing->get_io()),
- cycle_(std::chrono::milliseconds::zero()),
- change_resets_cycle_(false),
- is_updating_on_change_(true),
- is_set_(false),
- is_provided_(false),
- is_shadow_(_is_shadow),
- is_cache_placeholder_(false),
- epsilon_change_func_(std::bind(&event::compare, this,
- std::placeholders::_1, std::placeholders::_2)),
- is_reliable_(false),
- remote_notification_pending_(false) {
-}
-
-service_t event::get_service() const {
- return (message_->get_service());
-}
-
-void event::set_service(service_t _service) {
- message_->set_service(_service);
-}
-
-instance_t event::get_instance() const {
- return (message_->get_instance());
-}
-
-void event::set_instance(instance_t _instance) {
- message_->set_instance(_instance);
-}
-
-major_version_t event::get_version() const {
- return message_->get_interface_version();
-}
-
-void event::set_version(major_version_t _major) {
- message_->set_interface_version(_major);
-}
-
-event_t event::get_event() const {
- return (message_->get_method());
-}
-
-void event::set_event(event_t _event) {
- message_->set_method(_event); // TODO: maybe we should check for the leading 0-bit
-}
-
-bool event::is_field() const {
- return (is_field_);
-}
-
-void event::set_field(bool _is_field) {
- is_field_ = _is_field;
-}
-
-bool event::is_provided() const {
- return (is_provided_);
-}
-
-void event::set_provided(bool _is_provided) {
- is_provided_ = _is_provided;
-}
-
-bool event::is_set() const {
- return is_set_;
-}
-
-const std::shared_ptr<payload> event::get_payload() const {
- std::lock_guard<std::mutex> its_lock(mutex_);
- return (message_->get_payload());
-}
-
-bool event::set_payload_dont_notify(const std::shared_ptr<payload> &_payload) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (is_cache_placeholder_) {
- reset_payload(_payload);
- is_set_ = true;
- } else {
- if (set_payload_helper(_payload, false)) {
- reset_payload(_payload);
- } else {
- return false;
- }
- }
- return true;
-}
-
-void event::set_payload(const std::shared_ptr<payload> &_payload,
- bool _force, bool _flush) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (is_provided_) {
- if (set_payload_helper(_payload, _force)) {
- reset_payload(_payload);
- if (is_updating_on_change_) {
- if (change_resets_cycle_)
- stop_cycle();
-
- notify(_flush);
-
- if (change_resets_cycle_)
- start_cycle();
- }
- }
- } else {
- VSOMEIP_INFO << "Can't set payload for event " << std::hex
- << message_->get_method() << " as it isn't provided";
- }
-}
-
-void event::set_payload(const std::shared_ptr<payload> &_payload, client_t _client,
- bool _force, bool _flush) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (is_provided_) {
- if (set_payload_helper(_payload, _force)) {
- reset_payload(_payload);
- if (is_updating_on_change_) {
- notify_one(_client, _flush);
- }
- }
- } else {
- VSOMEIP_INFO << "Can't set payload for event " << std::hex
- << message_->get_method() << " as it isn't provided";
- }
-}
-
-void event::set_payload(const std::shared_ptr<payload> &_payload,
- const std::shared_ptr<endpoint_definition> _target,
- bool _force, bool _flush) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (is_provided_) {
- if (set_payload_helper(_payload, _force)) {
- reset_payload(_payload);
- if (is_updating_on_change_) {
- notify_one(_target, _flush);
- }
- }
- } else {
- VSOMEIP_INFO << "Can't set payload for event " << std::hex
- << message_->get_method() << " as it isn't provided";
- }
-}
-
-void event::unset_payload(bool _force) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (_force) {
- is_set_ = false;
- stop_cycle();
- message_->set_payload(std::make_shared<payload_impl>());
- } else {
- if (is_provided_) {
- is_set_ = false;
- stop_cycle();
- message_->set_payload(std::make_shared<payload_impl>());
- }
- }
-}
-
-void event::set_update_cycle(std::chrono::milliseconds &_cycle) {
- if (is_provided_) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- stop_cycle();
- cycle_ = _cycle;
- start_cycle();
- }
-}
-
-void event::set_change_resets_cycle(bool _change_resets_cycle) {
- change_resets_cycle_ = _change_resets_cycle;
-}
-
-void event::set_update_on_change(bool _is_active) {
- if (is_provided_) {
- is_updating_on_change_ = _is_active;
- }
-}
-
-void event::set_epsilon_change_function(const epsilon_change_func_t &_epsilon_change_func) {
- if (_epsilon_change_func) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- epsilon_change_func_ = _epsilon_change_func;
- }
-}
-
-const std::set<eventgroup_t> event::get_eventgroups() const {
- std::set<eventgroup_t> its_eventgroups;
- {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- for (const auto e : eventgroups_) {
- its_eventgroups.insert(e.first);
- }
- }
- return its_eventgroups;
-}
-
-std::set<eventgroup_t> event::get_eventgroups(client_t _client) const {
- std::set<eventgroup_t> its_eventgroups;
-
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- for (auto e : eventgroups_) {
- if (e.second.find(_client) != e.second.end())
- its_eventgroups.insert(e.first);
- }
- return its_eventgroups;
-}
-
-void event::add_eventgroup(eventgroup_t _eventgroup) {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- if (eventgroups_.find(_eventgroup) == eventgroups_.end())
- eventgroups_[_eventgroup] = std::set<client_t>();
-}
-
-void event::set_eventgroups(const std::set<eventgroup_t> &_eventgroups) {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- for (auto e : _eventgroups)
- eventgroups_[e] = std::set<client_t>();
-}
-
-void event::update_cbk(boost::system::error_code const &_error) {
- if (!_error) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- cycle_timer_.expires_from_now(cycle_);
- notify(true);
- std::function<void(boost::system::error_code const &)> its_handler =
- std::bind(&event::update_cbk, shared_from_this(),
- std::placeholders::_1);
- cycle_timer_.async_wait(its_handler);
- }
-}
-
-void event::notify(bool _flush) {
- if (is_set_) {
- routing_->send(VSOMEIP_ROUTING_CLIENT, message_, _flush);
- } else {
- VSOMEIP_INFO << "Notify event " << std::hex << message_->get_method()
- << "failed. Event payload not set!";
- }
-}
-
-void event::notify_one(const std::shared_ptr<endpoint_definition> &_target, bool _flush) {
- if (is_set_) {
- routing_->send_to(_target, message_, _flush);
- } else {
- VSOMEIP_INFO << "Notify one event " << std::hex << message_->get_method()
- << "failed. Event payload not set!";
- }
-}
-
-void event::notify_one(client_t _client, bool _flush) {
- if (is_set_) {
- routing_->send(_client, message_, _flush);
- } else {
- VSOMEIP_INFO << "Notify one event " << std::hex << message_->get_method()
- << " to client " << _client << " failed. Event payload not set!";
- }
-}
-
-bool event::set_payload_helper(const std::shared_ptr<payload> &_payload, bool _force) {
- std::shared_ptr<payload> its_payload = message_->get_payload();
- bool is_change(!is_field_);
- if (is_field_) {
- is_change = _force || epsilon_change_func_(its_payload, _payload);
- }
- return is_change;
-}
-
-void event::reset_payload(const std::shared_ptr<payload> &_payload) {
- std::shared_ptr<payload> its_new_payload
- = runtime::get()->create_payload(
- _payload->get_data(), _payload->get_length());
- message_->set_payload(its_new_payload);
-
- if (!is_set_)
- start_cycle();
-
- is_set_ = true;
-}
-
-void event::add_ref(client_t _client, bool _is_provided) {
- std::lock_guard<std::mutex> its_lock(refs_mutex_);
- auto its_client = refs_.find(_client);
- if (its_client == refs_.end()) {
- refs_[_client][_is_provided] = 1;
- } else {
- auto its_provided = its_client->second.find(_is_provided);
- if (its_provided == its_client->second.end()) {
- refs_[_client][_is_provided] = 1;
- } else {
- its_provided->second++;
- }
- }
-}
-
-void event::remove_ref(client_t _client, bool _is_provided) {
- std::lock_guard<std::mutex> its_lock(refs_mutex_);
- auto its_client = refs_.find(_client);
- if (its_client != refs_.end()) {
- auto its_provided = its_client->second.find(_is_provided);
- if (its_provided != its_client->second.end()) {
- its_provided->second--;
- if (0 == its_provided->second) {
- its_client->second.erase(_is_provided);
- if (0 == its_client->second.size()) {
- refs_.erase(_client);
- }
- }
- }
- }
-}
-
-bool event::has_ref() {
- std::lock_guard<std::mutex> its_lock(refs_mutex_);
- return refs_.size() != 0;
-}
-
-bool event::add_subscriber(eventgroup_t _eventgroup, client_t _client) {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- return eventgroups_[_eventgroup].insert(_client).second;
-}
-
-void event::remove_subscriber(eventgroup_t _eventgroup, client_t _client) {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- auto find_eventgroup = eventgroups_.find(_eventgroup);
- if (find_eventgroup != eventgroups_.end())
- find_eventgroup->second.erase(_client);
-}
-
-bool event::has_subscriber(eventgroup_t _eventgroup, client_t _client) {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- auto find_eventgroup = eventgroups_.find(_eventgroup);
- if (find_eventgroup != eventgroups_.end()) {
- if (_client == ANY_CLIENT) {
- return (find_eventgroup->second.size() > 0);
- } else {
- return (find_eventgroup->second.find(_client)
- != find_eventgroup->second.end());
- }
- }
- return false;
-}
-
-std::set<client_t> event::get_subscribers() {
- std::set<client_t> its_subscribers;
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- for (const auto &e : eventgroups_)
- its_subscribers.insert(e.second.begin(), e.second.end());
- return its_subscribers;
-}
-
-void event::clear_subscribers() {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- for (auto &e : eventgroups_)
- e.second.clear();
-}
-
-bool event::has_ref(client_t _client, bool _is_provided) {
- std::lock_guard<std::mutex> its_lock(refs_mutex_);
- auto its_client = refs_.find(_client);
- if (its_client != refs_.end()) {
- auto its_provided = its_client->second.find(_is_provided);
- if (its_provided != its_client->second.end()) {
- if(its_provided->second > 0) {
- return true;
- }
- }
- }
- return false;
-}
-
-bool event::is_shadow() const {
- return is_shadow_;
-}
-
-void event::set_shadow(bool _shadow) {
- is_shadow_ = _shadow;
-}
-
-bool event::is_cache_placeholder() const {
- return is_cache_placeholder_;
-}
-
-void event::set_cache_placeholder(bool _is_cache_place_holder) {
- is_cache_placeholder_ = _is_cache_place_holder;
-}
-
-void event::start_cycle() {
- if (std::chrono::milliseconds::zero() != cycle_) {
- cycle_timer_.expires_from_now(cycle_);
- std::function<void(boost::system::error_code const &)> its_handler =
- std::bind(&event::update_cbk, shared_from_this(),
- std::placeholders::_1);
- cycle_timer_.async_wait(its_handler);
- }
-}
-
-void event::stop_cycle() {
- if (std::chrono::milliseconds::zero() != cycle_) {
- boost::system::error_code ec;
- cycle_timer_.cancel(ec);
- }
-}
-
-bool event::compare(const std::shared_ptr<payload> &_lhs,
- const std::shared_ptr<payload> &_rhs) const {
- bool is_change = (_lhs->get_length() != _rhs->get_length());
- if (!is_change) {
- std::size_t its_pos = 0;
- const byte_t *its_old_data = _lhs->get_data();
- const byte_t *its_new_data = _rhs->get_data();
- while (!is_change && its_pos < _lhs->get_length()) {
- is_change = (*its_old_data++ != *its_new_data++);
- its_pos++;
- }
- }
- return is_change;
-}
-
-std::set<client_t> event::get_subscribers(eventgroup_t _eventgroup) {
- std::set<client_t> its_subscribers;
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- auto found_eventgroup = eventgroups_.find(_eventgroup);
- if (found_eventgroup != eventgroups_.end()) {
- its_subscribers = found_eventgroup->second;
- }
- return its_subscribers;
-}
-
-bool event::is_subscribed(client_t _client) {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- for (const auto &egp : eventgroups_) {
- if (egp.second.find(_client) != egp.second.end()) {
- return true;
- }
- }
- return false;
-}
-
-bool event::is_reliable() const {
- return is_reliable_;
-}
-
-void event::set_reliable(bool _is_reliable) {
- is_reliable_ = _is_reliable;
-}
-
-bool event::get_remote_notification_pending() {
- return remote_notification_pending_;
-}
-
-void event::set_remote_notification_pending(bool _value) {
- remote_notification_pending_ = _value;
-}
-
-} // namespace vsomeip
diff --git a/implementation/routing/src/eventgroupinfo.cpp b/implementation/routing/src/eventgroupinfo.cpp
deleted file mode 100644
index 137a021..0000000
--- a/implementation/routing/src/eventgroupinfo.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-// Copyright (C) 2014-2017 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 <algorithm>
-
-#include <vsomeip/constants.hpp>
-
-
-#include "../include/eventgroupinfo.hpp"
-#include "../include/event.hpp"
-#include "../../endpoints/include/endpoint_definition.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../configuration/include/internal.hpp"
-
-namespace vsomeip {
-
-eventgroupinfo::eventgroupinfo() :
- major_(DEFAULT_MAJOR),
- ttl_(DEFAULT_TTL),
- port_(ILLEGAL_PORT),
- threshold_(0),
- has_reliable_(false),
- has_unreliable_(false),
- subscription_id_(DEFAULT_SUBSCRIPTION) {
-}
-
-eventgroupinfo::eventgroupinfo(major_version_t _major, ttl_t _ttl) :
- major_(_major),
- ttl_(_ttl),
- port_(ILLEGAL_PORT),
- threshold_(0),
- has_reliable_(false),
- has_unreliable_(false),
- subscription_id_(DEFAULT_SUBSCRIPTION) {
-}
-
-eventgroupinfo::~eventgroupinfo() {
-}
-
-major_version_t eventgroupinfo::get_major() const {
- return major_;
-}
-
-void eventgroupinfo::set_major(major_version_t _major) {
- major_ = _major;
-}
-
-ttl_t eventgroupinfo::get_ttl() const {
- return ttl_;
-}
-
-void eventgroupinfo::set_ttl(ttl_t _ttl) {
- ttl_ = _ttl;
-}
-
-bool eventgroupinfo::is_multicast() const {
- std::lock_guard<std::mutex> its_lock(address_mutex_);
- return address_.is_multicast();
-}
-
-bool eventgroupinfo::is_sending_multicast() const {
- return (is_multicast() &&
- threshold_ != 0 &&
- get_unreliable_target_count() >= threshold_);
-}
-
-bool eventgroupinfo::get_multicast(boost::asio::ip::address &_address,
- uint16_t &_port) const {
- std::lock_guard<std::mutex> its_lock(address_mutex_);
- if (address_.is_multicast()) {
- _address = address_;
- _port = port_;
- return true;
- }
- return false;
-}
-
-void eventgroupinfo::set_multicast(const boost::asio::ip::address &_address,
- uint16_t _port) {
- std::lock_guard<std::mutex> its_lock(address_mutex_);
- address_ = _address;
- port_ = _port;
-}
-
-const std::set<std::shared_ptr<event> > eventgroupinfo::get_events() const {
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- return events_;
-}
-
-void eventgroupinfo::add_event(std::shared_ptr<event> _event) {
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- events_.insert(_event);
- _event->is_reliable() ? has_reliable_ = true : has_unreliable_ = true;
-}
-
-void eventgroupinfo::remove_event(std::shared_ptr<event> _event) {
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- events_.erase(_event);
-}
-
-void eventgroupinfo::get_reliability(bool& _has_reliable, bool& _has_unreliable) const {
- _has_reliable = has_reliable_;
- _has_unreliable = has_unreliable_;
-}
-
-const std::list<eventgroupinfo::target_t> eventgroupinfo::get_targets() const {
- std::lock_guard<std::mutex> its_lock(targets_mutex_);
- return targets_;
-}
-
-uint32_t eventgroupinfo::get_unreliable_target_count() const {
- uint32_t _count(0);
- std::lock_guard<std::mutex> its_lock(targets_mutex_);
- for (auto i = targets_.begin(); i != targets_.end(); i++) {
- if (!i->endpoint_->is_reliable()) {
- _count++;
- }
- }
- return _count;
-}
-
-void eventgroupinfo::add_multicast_target(const eventgroupinfo::target_t &_multicast_target) {
- std::lock_guard<std::mutex> its_lock(multicast_targets_mutex_);
- if (std::find(multicast_targets_.begin(), multicast_targets_.end(), _multicast_target)
- == multicast_targets_.end()) {
- multicast_targets_.push_back(_multicast_target);
- }
-}
-
-void eventgroupinfo::clear_multicast_targets() {
- std::lock_guard<std::mutex> its_lock(multicast_targets_mutex_);
- multicast_targets_.clear();
-}
-
-const std::list<eventgroupinfo::target_t> eventgroupinfo::get_multicast_targets() const {
- std::lock_guard<std::mutex> its_lock(multicast_targets_mutex_);
- return multicast_targets_;
-}
-
-bool eventgroupinfo::add_target(const eventgroupinfo::target_t &_target) {
- std::lock_guard<std::mutex> its_lock(targets_mutex_);
- std::size_t its_size = targets_.size();
- if (std::find(targets_.begin(), targets_.end(), _target) == targets_.end()) {
- targets_.push_back(_target);
- }
- return (its_size != targets_.size());
-}
-
-bool eventgroupinfo::add_target(const eventgroupinfo::target_t &_target,
- const eventgroupinfo::target_t &_subscriber) {
- bool found(false);
- bool add(false);
- bool ret(false);
- {
- std::lock_guard<std::mutex> its_lock(targets_mutex_);
- std::size_t its_size = targets_.size();
-
- for (auto i = targets_.begin(); i != targets_.end(); i++) {
- if (i->endpoint_->get_address() == _subscriber.endpoint_->get_address() &&
- i->endpoint_->get_port() == _subscriber.endpoint_->get_port() &&
- i->endpoint_->is_reliable() == _subscriber.endpoint_->is_reliable()) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- targets_.push_back(_subscriber);
- add = true;
- }
- ret = (its_size != targets_.size());
- }
- if (add) {
- add_multicast_target(_target);
- }
- return ret;
-}
-
-bool eventgroupinfo::update_target(
- const std::shared_ptr<endpoint_definition> &_target,
- const std::chrono::steady_clock::time_point &_expiration) {
- std::lock_guard<std::mutex> its_lock(targets_mutex_);
- bool updated_target(false);
-
- for (auto i = targets_.begin(); i != targets_.end(); i++) {
- if (i->endpoint_->get_address() == _target->get_address() &&
- i->endpoint_->get_port() == _target->get_port() &&
- i->endpoint_->is_reliable() == _target->is_reliable() ) {
- i->expiration_ = _expiration;
- updated_target = true;
- break;
- }
- }
- return updated_target;
-}
-
-bool eventgroupinfo::remove_target(
- const std::shared_ptr<endpoint_definition> &_target) {
- std::lock_guard<std::mutex> its_lock(targets_mutex_);
- std::size_t its_size = targets_.size();
-
- for (auto i = targets_.begin(); i != targets_.end(); i++) {
- if (i->endpoint_->get_address() == _target->get_address() &&
- i->endpoint_->get_port() == _target->get_port() &&
- i->endpoint_->is_reliable() == _target->is_reliable()) {
- targets_.erase(i);
- break;
- }
- }
-
- return (its_size != targets_.size());
-}
-
-void eventgroupinfo::clear_targets() {
- std::lock_guard<std::mutex> its_lock(targets_mutex_);
- targets_.clear();
-}
-
-uint8_t eventgroupinfo::get_threshold() const {
- return threshold_;
-}
-
-void eventgroupinfo::set_threshold(uint8_t _threshold) {
- threshold_ = _threshold;
-}
-
-std::unique_lock<std::mutex> eventgroupinfo::get_subscription_lock() {
- return std::unique_lock<std::mutex>(subscription_mutex_);
-}
-
-pending_subscription_id_t eventgroupinfo::add_pending_subscription(
- pending_subscription_t _pending_subscription) {
- std::lock_guard<std::mutex> its_lock(pending_subscriptions_mutex_);
- if (++subscription_id_ == DEFAULT_SUBSCRIPTION) {
- subscription_id_++;
- }
- pending_subscriptions_[subscription_id_] = _pending_subscription;
-
- const auto remote_address_port = std::make_pair(
- _pending_subscription.subscriber_->get_address(),
- _pending_subscription.subscriber_->get_port());
-
- auto found_address = pending_subscriptions_by_remote_.find(remote_address_port);
- if (found_address != pending_subscriptions_by_remote_.end()) {
- found_address->second.push_back(subscription_id_);
- VSOMEIP_WARNING << __func__ << " num pending subscriptions: "
- << std::dec << found_address->second.size();
- return DEFAULT_SUBSCRIPTION;
- } else {
- pending_subscriptions_by_remote_[remote_address_port].push_back(subscription_id_);
- }
- return subscription_id_;
-}
-
-std::vector<pending_subscription_t> eventgroupinfo::remove_pending_subscription(
- pending_subscription_id_t _subscription_id) {
- std::vector<pending_subscription_t> its_pending_subscriptions;
- std::lock_guard<std::mutex> its_lock(pending_subscriptions_mutex_);
- const auto found_pending_subscription = pending_subscriptions_.find(
- _subscription_id);
- if (found_pending_subscription != pending_subscriptions_.end()) {
- pending_subscription_t its_pending_sub = found_pending_subscription->second;
- const auto remote_address_port = std::make_pair(
- its_pending_sub.subscriber_->get_address(),
- its_pending_sub.subscriber_->get_port());
- const bool removed_is_subscribe = (found_pending_subscription->second.ttl_ > 0);
-
- // check if more (un)subscriptions to this eventgroup arrived from the
- // same remote during the time the current pending subscription was processed
- auto found_remote = pending_subscriptions_by_remote_.find(remote_address_port);
- if (found_remote != pending_subscriptions_by_remote_.end()) {
- if (found_remote->second.size()
- && found_remote->second.front() == _subscription_id) {
- pending_subscriptions_.erase(found_pending_subscription);
- found_remote->second.erase(found_remote->second.begin());
-
- if (removed_is_subscribe) { // only subscriptions must be acked via SD
- its_pending_sub.pending_subscription_id_ = _subscription_id;
- its_pending_subscriptions.push_back(its_pending_sub);
- }
- // retrieve all pending (un)subscriptions which arrived during
- // the time the rm_proxy answered the currently processed subscription
- for (auto iter = found_remote->second.begin();
- iter != found_remote->second.end();) {
- const auto other_pen_sub = pending_subscriptions_.find(*iter);
- if (other_pen_sub != pending_subscriptions_.end()) {
- const bool queued_is_subscribe = (other_pen_sub->second.ttl_ > 0);
- if (removed_is_subscribe) {
- its_pending_subscriptions.push_back(other_pen_sub->second);
- its_pending_subscriptions.back().pending_subscription_id_ = *iter;
- if (!queued_is_subscribe) {
- // unsubscribe was queued and needs to be sent to
- // rm_proxy first before continuing processing
- // following queued (un)subscriptions
- break;
- } else {
- iter = found_remote->second.erase(iter);
- pending_subscriptions_.erase(other_pen_sub);
- }
- } else {
- if (queued_is_subscribe) {
- // subscribe was queued and needs to be sent to
- // rm_proxy first before continuing processing
- // following queued (un)subscriptions
- its_pending_subscriptions.push_back(other_pen_sub->second);
- its_pending_subscriptions.back().pending_subscription_id_ = *iter;
- break;
- } else {
- // further queued unsubscriptions can be ignored
- iter = found_remote->second.erase(iter);
- pending_subscriptions_.erase(other_pen_sub);
- }
- }
- } else {
- VSOMEIP_ERROR << __func__ << " didn't find queued subscription: "
- << *iter;
- ++iter;
- }
- }
-
- if (found_remote->second.empty()) {
- pending_subscriptions_by_remote_.erase(found_remote);
- }
- } else {
- boost::system::error_code ec;
- VSOMEIP_WARNING << __func__ << " Subscriptions were answered in "
- << " in wrong order by rm_proxy! ["
- << " subscriber: " << remote_address_port.first.to_string(ec)
- << ":" << std::dec << remote_address_port.second;
- // found_pending_subscription isn't deleted from
- // pending_subscriptions_ map in this case to ensure answer
- // sequence of SD messages.
- its_pending_subscriptions.clear();
- }
- }
- } else {
- VSOMEIP_ERROR << __func__ << " didn't find pending_subscription: "
- << _subscription_id;
- }
- return its_pending_subscriptions;
-}
-
-
-void eventgroupinfo::clear_pending_subscriptions() {
- std::lock_guard<std::mutex> its_lock(pending_subscriptions_mutex_);
- pending_subscriptions_.clear();
- pending_subscriptions_by_remote_.clear();
-}
-
-} // namespace vsomeip
diff --git a/implementation/routing/src/routing_manager_base.cpp b/implementation/routing/src/routing_manager_base.cpp
deleted file mode 100644
index 9296f99..0000000
--- a/implementation/routing/src/routing_manager_base.cpp
+++ /dev/null
@@ -1,1210 +0,0 @@
-// Copyright (C) 2014-2017 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 <iomanip>
-
-#include <vsomeip/runtime.hpp>
-
-#include "../../utility/include/utility.hpp"
-#include "../../utility/include/byteorder.hpp"
-#include "../include/routing_manager_base.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../endpoints/include/local_client_endpoint_impl.hpp"
-#include "../../endpoints/include/local_server_endpoint_impl.hpp"
-
-namespace vsomeip {
-
-routing_manager_base::routing_manager_base(routing_manager_host *_host) :
- host_(_host),
- io_(host_->get_io()),
- client_(host_->get_client()),
- configuration_(host_->get_configuration()),
- serializer_(
- std::make_shared<serializer>(
- configuration_->get_buffer_shrink_threshold()))
-#ifdef USE_DLT
- , tc_(tc::trace_connector::get())
-#endif
-{
- const uint32_t its_buffer_shrink_threshold =
- configuration_->get_buffer_shrink_threshold();
- for (int i = 0; i < VSOMEIP_MAX_DESERIALIZER; ++i) {
- deserializers_.push(
- std::make_shared<deserializer>(its_buffer_shrink_threshold));
- }
-}
-
-routing_manager_base::~routing_manager_base() {
-}
-
-boost::asio::io_service & routing_manager_base::get_io() {
- return (io_);
-}
-
-client_t routing_manager_base::get_client() const {
- return client_;
-}
-
-void routing_manager_base::init() {
-}
-
-bool routing_manager_base::offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor) {
- (void)_client;
-
- // Remote route (incoming only)
- auto its_info = find_service(_service, _instance);
- if (its_info) {
- if (!its_info->is_local()) {
- return false;
- } else if (its_info->get_major() == _major
- && its_info->get_minor() == _minor) {
- its_info->set_ttl(DEFAULT_TTL);
- } else {
- host_->on_error(error_code_e::SERVICE_PROPERTY_MISMATCH);
- VSOMEIP_ERROR << "rm_base::offer_service service property mismatch ("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << ":"
- << std::dec << static_cast<std::uint32_t>(its_info->get_major()) << ":"
- << std::dec << its_info->get_minor() << "] passed: "
- << std::dec << static_cast<std::uint32_t>(_major) << ":"
- << std::dec << _minor;
- return false;
- }
- } else {
- its_info = create_service_info(_service, _instance, _major, _minor,
- DEFAULT_TTL, true);
- }
- {
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- // Set major version for all registered events of this service and instance
- const auto found_service = events_.find(_service);
- if (found_service != events_.end()) {
- const auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- for (const auto &j : found_instance->second) {
- j.second->set_version(_major);
- }
- }
- }
- }
- return true;
-}
-
-void routing_manager_base::stop_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor) {
- (void)_client;
- (void)_major;
- (void)_minor;
- std::map<event_t, std::shared_ptr<event> > events;
- {
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- auto its_events_service = events_.find(_service);
- if (its_events_service != events_.end()) {
- auto its_events_instance = its_events_service->second.find(_instance);
- if (its_events_instance != its_events_service->second.end()) {
- for (auto &e : its_events_instance->second)
- events[e.first] = e.second;
-
- }
- }
- }
- for (auto &e : events) {
- e.second->unset_payload();
- e.second->clear_subscribers();
- }
-}
-
-void routing_manager_base::request_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor, bool _use_exclusive_proxy) {
- (void)_use_exclusive_proxy;
-
- auto its_info = find_service(_service, _instance);
- if (its_info) {
- if ((_major == its_info->get_major()
- || DEFAULT_MAJOR == its_info->get_major()
- || ANY_MAJOR == _major)
- && (_minor <= its_info->get_minor()
- || DEFAULT_MINOR == its_info->get_minor()
- || _minor == ANY_MINOR)) {
- its_info->add_client(_client);
- } else {
- host_->on_error(error_code_e::SERVICE_PROPERTY_MISMATCH);
- VSOMEIP_ERROR << "rm_base::request_service service property mismatch ("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << ":"
- << std::dec << static_cast<std::uint32_t>(its_info->get_major()) << ":"
- << std::dec << its_info->get_minor() << "] passed: "
- << std::dec << static_cast<std::uint32_t>(_major) << ":"
- << std::dec << _minor;
- }
- }
-}
-
-void routing_manager_base::release_service(client_t _client, service_t _service,
- instance_t _instance) {
- auto its_info = find_service(_service, _instance);
- if (its_info) {
- its_info->remove_client(_client);
- }
-}
-
-void routing_manager_base::register_event(client_t _client, service_t _service, instance_t _instance,
- event_t _event, const std::set<eventgroup_t> &_eventgroups, bool _is_field,
- std::chrono::milliseconds _cycle, bool _change_resets_cycle,
- epsilon_change_func_t _epsilon_change_func,
- bool _is_provided, bool _is_shadow, bool _is_cache_placeholder) {
- std::shared_ptr<event> its_event = find_event(_service, _instance, _event);
- bool transfer_subscriptions_from_any_event(false);
- if (its_event) {
- if(!its_event->is_cache_placeholder()) {
- if (its_event->is_field() == _is_field) {
- if (_is_provided) {
- its_event->set_provided(true);
- }
- if (_is_shadow && _is_provided) {
- its_event->set_shadow(_is_shadow);
- }
- if (_client == host_->get_client() && _is_provided) {
- its_event->set_shadow(false);
- }
- for (auto eg : _eventgroups) {
- its_event->add_eventgroup(eg);
- }
- transfer_subscriptions_from_any_event = true;
- } else {
- VSOMEIP_ERROR << "Event registration update failed. "
- "Specified arguments do not match existing registration.";
- }
- } else {
- // the found event was a placeholder for caching.
- // update it with the real values
- if(!_is_field) {
- // don't cache payload for non-fields
- its_event->unset_payload(true);
- }
- if (_is_shadow && _is_provided) {
- its_event->set_shadow(_is_shadow);
- }
- if (_client == host_->get_client() && _is_provided) {
- its_event->set_shadow(false);
- }
- its_event->set_field(_is_field);
- its_event->set_provided(_is_provided);
- its_event->set_cache_placeholder(false);
- std::shared_ptr<serviceinfo> its_service = find_service(_service, _instance);
- if (its_service) {
- its_event->set_version(its_service->get_major());
- }
- if (_eventgroups.size() == 0) { // No eventgroup specified
- std::set<eventgroup_t> its_eventgroups;
- its_eventgroups.insert(_event);
- its_event->set_eventgroups(its_eventgroups);
- } else {
- for (auto eg : _eventgroups) {
- its_event->add_eventgroup(eg);
- }
- }
-
- its_event->set_epsilon_change_function(_epsilon_change_func);
- its_event->set_change_resets_cycle(_change_resets_cycle);
- its_event->set_update_cycle(_cycle);
- }
- } else {
- its_event = std::make_shared<event>(this, _is_shadow);
- its_event->set_reliable(configuration_->is_event_reliable(_service, _instance, _event));
- its_event->set_service(_service);
- its_event->set_instance(_instance);
- its_event->set_event(_event);
- its_event->set_field(_is_field);
- its_event->set_provided(_is_provided);
- its_event->set_cache_placeholder(_is_cache_placeholder);
- std::shared_ptr<serviceinfo> its_service = find_service(_service, _instance);
- if (its_service) {
- its_event->set_version(its_service->get_major());
- }
-
- if (_eventgroups.size() == 0) { // No eventgroup specified
- std::set<eventgroup_t> its_eventgroups;
- its_eventgroups.insert(_event);
- its_event->set_eventgroups(its_eventgroups);
- } else {
- its_event->set_eventgroups(_eventgroups);
- }
-
- if (_is_shadow && !_epsilon_change_func) {
- std::shared_ptr<vsomeip::cfg::debounce> its_debounce
- = configuration_->get_debounce(_service, _instance, _event);
- if (its_debounce) {
- 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')
- << _event << ".";
- std::stringstream its_debounce_parameters;
- its_debounce_parameters << "(on_change="
- << (its_debounce->on_change_ ? "true" : "false")
- << ", ignore=[ ";
- for (auto i : its_debounce->ignore_)
- its_debounce_parameters << "(" << std::dec << i.first
- << ", " << std::hex << (int)i.second << ") ";
- its_debounce_parameters << "], interval="
- << std::dec << its_debounce->interval_ << ")";
- VSOMEIP_WARNING << "Debounce parameters: "
- << its_debounce_parameters.str();
- _epsilon_change_func = [its_debounce](
- const std::shared_ptr<payload> &_old,
- const std::shared_ptr<payload> &_new) {
- bool is_changed(false), is_elapsed(false);
-
- // Check whether we should forward because of changed data
- if (its_debounce->on_change_) {
- length_t its_min_length, its_max_length;
-
- if (_old->get_length() < _new->get_length()) {
- its_min_length = _old->get_length();
- its_max_length = _new->get_length();
- } else {
- its_min_length = _new->get_length();
- its_max_length = _old->get_length();
- }
-
- // Check whether all additional bytes (if any) are excluded
- for (length_t i = its_min_length; i < its_max_length; i++) {
- auto j = its_debounce->ignore_.find(i);
- if (j == its_debounce->ignore_.end() && j->second == 0xFF) {
- is_changed = true;
- break;
- }
- }
-
- if (!is_changed) {
- const byte_t *its_old = _old->get_data();
- const byte_t *its_new = _new->get_data();
- for (length_t i = 0; i < its_min_length; i++) {
- auto j = its_debounce->ignore_.find(i);
- if (j == its_debounce->ignore_.end()) {
- if (its_old[i] != its_new[i]) {
- is_changed = true;
- break;
- }
- } else if (j->second != 0xFF) {
- if ((its_old[i] & ~(j->second)) != (its_new[i] & ~(j->second))) {
- is_changed = true;
- break;
- }
- }
- }
- }
- }
-
- if (its_debounce->interval_ > -1) {
- // Check whether we should forward because of the elapsed time since
- // we did last time
- std::chrono::steady_clock::time_point its_current
- = std::chrono::steady_clock::now();
-
- long elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(
- its_current - its_debounce->last_forwarded_).count();
- is_elapsed = (its_debounce->last_forwarded_ == (std::chrono::steady_clock::time_point::max)()
- || elapsed >= its_debounce->interval_);
- if (is_elapsed || (is_changed && its_debounce->on_change_resets_interval_))
- its_debounce->last_forwarded_ = its_current;
- }
- return (is_changed || is_elapsed);
- };
- } else {
- _epsilon_change_func = [](const std::shared_ptr<payload> &_old,
- const std::shared_ptr<payload> &_new) {
- (void)_old;
- (void)_new;
- return true;
- };
- }
- }
-
- its_event->set_epsilon_change_function(_epsilon_change_func);
- its_event->set_change_resets_cycle(_change_resets_cycle);
- its_event->set_update_cycle(_cycle);
-
- if (_is_provided) {
- transfer_subscriptions_from_any_event = true;
- }
- }
-
- if (transfer_subscriptions_from_any_event) {
- // check if someone subscribed to ANY_EVENT and the subscription
- // was stored in the cache placeholder. Move the subscribers
- // into new event
- std::shared_ptr<event> its_any_event =
- find_event(_service, _instance, ANY_EVENT);
- if (its_any_event) {
- std::set<eventgroup_t> any_events_eventgroups =
- its_any_event->get_eventgroups();
- for (eventgroup_t eventgroup : _eventgroups) {
- auto found_eg = any_events_eventgroups.find(eventgroup);
- if (found_eg != any_events_eventgroups.end()) {
- std::set<client_t> its_any_event_subscribers =
- its_any_event->get_subscribers(eventgroup);
- for (const client_t subscriber : its_any_event_subscribers) {
- its_event->add_subscriber(eventgroup, subscriber);
- }
- }
- }
- }
- }
- if(!_is_cache_placeholder) {
- its_event->add_ref(_client, _is_provided);
- }
-
- for (auto eg : _eventgroups) {
- std::shared_ptr<eventgroupinfo> its_eventgroup_info
- = find_eventgroup(_service, _instance, eg);
- if (!its_eventgroup_info) {
- its_eventgroup_info = std::make_shared<eventgroupinfo>();
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- eventgroups_[_service][_instance][eg] = its_eventgroup_info;
- }
- its_eventgroup_info->add_event(its_event);
- }
-
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- events_[_service][_instance][_event] = its_event;
-}
-
-void routing_manager_base::unregister_event(client_t _client, service_t _service, instance_t _instance,
- event_t _event, bool _is_provided) {
- (void)_client;
- std::shared_ptr<event> its_unrefed_event;
- {
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- auto found_service = events_.find(_service);
- if (found_service != events_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_event = found_instance->second.find(_event);
- if (found_event != found_instance->second.end()) {
- auto its_event = found_event->second;
- its_event->remove_ref(_client, _is_provided);
- if (!its_event->has_ref()) {
- its_unrefed_event = its_event;
- found_instance->second.erase(found_event);
- } else if (_is_provided) {
- its_event->set_provided(false);
- }
- }
- }
- }
- }
- if (its_unrefed_event) {
- auto its_eventgroups = its_unrefed_event->get_eventgroups();
- for (auto eg : its_eventgroups) {
- std::shared_ptr<eventgroupinfo> its_eventgroup_info
- = find_eventgroup(_service, _instance, eg);
- if (its_eventgroup_info) {
- its_eventgroup_info->remove_event(its_unrefed_event);
- if (0 == its_eventgroup_info->get_events().size()) {
- remove_eventgroup_info(_service, _instance, eg);
- }
- }
- }
- }
-}
-
-std::set<std::shared_ptr<event>> routing_manager_base::find_events(
- service_t _service, instance_t _instance,
- eventgroup_t _eventgroup) const {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- std::set<std::shared_ptr<event> > its_events;
- 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()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- return (found_eventgroup->second->get_events());
- }
- }
- }
- return (its_events);
-}
-
-void routing_manager_base::subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major, event_t _event,
- subscription_type_e _subscription_type) {
-
- (void) _major;
- (void) _subscription_type;
- std::set<event_t> its_already_subscribed_events;
- bool inserted = insert_subscription(_service, _instance, _eventgroup,
- _event, _client, &its_already_subscribed_events);
- if (inserted) {
- notify_one_current_value(_client, _service, _instance, _eventgroup,
- _event, its_already_subscribed_events);
- }
-}
-
-void routing_manager_base::unsubscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event) {
- if (_event != ANY_EVENT) {
- auto its_event = find_event(_service, _instance, _event);
- if (its_event) {
- its_event->remove_subscriber(_eventgroup, _client);
- }
- } else {
- auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup);
- if (its_eventgroup) {
- for (auto e : its_eventgroup->get_events()) {
- e->remove_subscriber(_eventgroup, _client);
- }
- }
- }
-}
-
-void routing_manager_base::notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- bool _force, bool _flush) {
- std::shared_ptr<event> its_event = find_event(_service, _instance, _event);
- if (its_event) {
- its_event->set_payload(_payload, _force, _flush);
- } else {
- VSOMEIP_WARNING << "Attempt to update the undefined event/field ["
- << std::hex << _service << "." << _instance << "." << _event
- << "]";
- }
-}
-
-void routing_manager_base::notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- client_t _client, bool _force, bool _flush) {
- std::shared_ptr<event> its_event = find_event(_service, _instance, _event);
- if (its_event) {
- // Event is valid for service/instance
- bool found_eventgroup(false);
- bool already_subscribed(false);
- eventgroup_t valid_group = 0;
- // Iterate over all groups of the event to ensure at least
- // one valid eventgroup for service/instance exists.
- for (auto its_group : its_event->get_eventgroups()) {
- auto its_eventgroup = find_eventgroup(_service, _instance, its_group);
- if (its_eventgroup) {
- // Eventgroup is valid for service/instance
- found_eventgroup = true;
- valid_group = its_group;
- if (find_local(_client)) {
- already_subscribed = its_event->has_subscriber(its_group, _client);
- } else {
- // Remotes always needs to be marked as subscribed here
- already_subscribed = true;
- }
- break;
- }
- }
- if (found_eventgroup) {
- if (already_subscribed) {
- its_event->set_payload(_payload, _client, _force, _flush);
- } else {
- std::shared_ptr<message> its_notification
- = runtime::get()->create_notification();
- its_notification->set_service(_service);
- its_notification->set_instance(_instance);
- its_notification->set_method(_event);
- its_notification->set_payload(_payload);
- auto service_info = find_service(_service, _instance);
- if (service_info) {
- its_notification->set_interface_version(service_info->get_major());
- }
- {
- std::lock_guard<std::mutex> its_lock(pending_notify_ones_mutex_);
- pending_notify_ones_[_service][_instance][valid_group] = its_notification;
- }
- }
- }
- } else {
- VSOMEIP_WARNING << "Attempt to update the undefined event/field ["
- << std::hex << _service << "." << _instance << "." << _event
- << "]";
- }
-}
-
-void routing_manager_base::send_pending_notify_ones(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, client_t _client) {
- std::lock_guard<std::mutex> its_lock(pending_notify_ones_mutex_);
- auto its_service = pending_notify_ones_.find(_service);
- if (its_service != pending_notify_ones_.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- auto its_group = its_instance->second.find(_eventgroup);
- if (its_group != its_instance->second.end()) {
- notify_one(_service, _instance, its_group->second->get_method(),
- its_group->second->get_payload(), _client, false, true);
- its_instance->second.erase(_eventgroup);
- }
- }
- }
-}
-
-void routing_manager_base::unset_all_eventpayloads(service_t _service,
- instance_t _instance) {
- std::set<std::shared_ptr<event>> its_events;
- {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- const auto found_service = eventgroups_.find(_service);
- if (found_service != eventgroups_.end()) {
- const auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- for (const auto &eventgroupinfo : found_instance->second) {
- for (const auto &event : eventgroupinfo.second->get_events()) {
- its_events.insert(event);
- }
- }
- }
- }
- }
- for (const auto &e : its_events) {
- e->unset_payload(true);
- }
-}
-
-void routing_manager_base::unset_all_eventpayloads(service_t _service,
- instance_t _instance,
- eventgroup_t _eventgroup) {
- std::set<std::shared_ptr<event>> its_events;
- {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- const auto found_service = eventgroups_.find(_service);
- if (found_service != eventgroups_.end()) {
- const auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- const auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- for (const auto &event : found_eventgroup->second->get_events()) {
- its_events.insert(event);
- }
- }
- }
- }
- }
- for (const auto &e : its_events) {
- e->unset_payload(true);
- }
-}
-
-void routing_manager_base::notify_one_current_value(
- client_t _client, service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event,
- const std::set<event_t> &_events_to_exclude) {
- if (_event != ANY_EVENT) {
- std::shared_ptr<event> its_event = find_event(_service, _instance, _event);
- if (its_event && its_event->is_field())
- its_event->notify_one(_client, true);
- } else {
- auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup);
- if (its_eventgroup) {
- std::set<std::shared_ptr<event> > its_events = its_eventgroup->get_events();
- for (auto e : its_events) {
- if (e->is_field()
- && _events_to_exclude.find(e->get_event())
- == _events_to_exclude.end()) {
- e->notify_one(_client, true); // TODO: use _flush to send all events together!
- }
- }
- }
- }
-}
-
-bool routing_manager_base::send(client_t its_client,
- std::shared_ptr<message> _message,
- bool _flush) {
- bool is_sent(false);
- if (utility::is_request(_message->get_message_type())) {
- _message->set_client(its_client);
- }
- std::lock_guard<std::mutex> its_lock(serialize_mutex_);
- if (serializer_->serialize(_message.get())) {
- is_sent = send(its_client, serializer_->get_data(),
- serializer_->get_size(), _message->get_instance(),
- _flush, _message->is_reliable());
- serializer_->reset();
- } else {
- VSOMEIP_ERROR << "Failed to serialize message. Check message size!";
- }
- return (is_sent);
-}
-
-// ********************************* PROTECTED **************************************
-std::shared_ptr<serviceinfo> routing_manager_base::create_service_info(
- service_t _service, instance_t _instance, major_version_t _major,
- minor_version_t _minor, ttl_t _ttl, bool _is_local_service) {
- std::shared_ptr<serviceinfo> its_info =
- std::make_shared<serviceinfo>(_major, _minor, _ttl, _is_local_service);
- {
- std::lock_guard<std::mutex> its_lock(services_mutex_);
- services_[_service][_instance] = its_info;
- }
- if (!_is_local_service) {
- std::lock_guard<std::mutex> its_lock(services_remote_mutex_);
- services_remote_[_service][_instance] = its_info;
- }
- return its_info;
-}
-
-std::shared_ptr<serviceinfo> routing_manager_base::find_service(
- service_t _service, instance_t _instance) const {
- std::shared_ptr<serviceinfo> its_info;
- std::lock_guard<std::mutex> its_lock(services_mutex_);
- auto found_service = services_.find(_service);
- if (found_service != services_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- its_info = found_instance->second;
- }
- }
- return (its_info);
-}
-
-void routing_manager_base::clear_service_info(service_t _service, instance_t _instance,
- bool _reliable) {
- std::shared_ptr<serviceinfo> its_info(find_service(_service, _instance));
- if (!its_info) {
- return;
- }
-
- bool deleted_instance(false);
- bool deleted_service(false);
- {
- std::lock_guard<std::mutex> its_lock(services_mutex_);
-
- // Clear service_info and service_group
- std::shared_ptr<endpoint> its_empty_endpoint;
- if (!its_info->get_endpoint(!_reliable)) {
- if (1 >= services_[_service].size()) {
- services_.erase(_service);
- deleted_service = true;
- } else {
- services_[_service].erase(_instance);
- deleted_instance = true;
- }
- } else {
- its_info->set_endpoint(its_empty_endpoint, _reliable);
- }
- }
-
- if ((deleted_instance || deleted_service) && !its_info->is_local()) {
- std::lock_guard<std::mutex> its_lock(services_remote_mutex_);
- if (deleted_service) {
- services_remote_.erase(_service);
- } else if (deleted_instance) {
- services_remote_[_service].erase(_instance);
- }
- }
-}
-
-services_t routing_manager_base::get_services() const {
- std::lock_guard<std::mutex> its_lock(services_mutex_);
- return services_;
-}
-
-bool routing_manager_base::is_available(service_t _service, instance_t _instance,
- major_version_t _major) {
- bool available(false);
- std::lock_guard<std::mutex> its_lock(local_services_mutex_);
- auto its_service = local_services_.find(_service);
- if (its_service != local_services_.end()) {
- if (_instance == ANY_INSTANCE) {
- return true;
- }
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- if (_major == ANY_MAJOR) {
- return true;
- }
- if (std::get<0>(its_instance->second) == _major) {
- available = true;
- }
- }
- }
- return available;
-}
-
-client_t routing_manager_base::find_local_client(service_t _service, instance_t _instance) {
- std::lock_guard<std::mutex> its_lock(local_services_mutex_);
- client_t its_client(VSOMEIP_ROUTING_CLIENT);
- auto its_service = local_services_.find(_service);
- if (its_service != local_services_.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- its_client = std::get<2>(its_instance->second);
- }
- }
- return its_client;
-}
-
-std::shared_ptr<endpoint> routing_manager_base::create_local_unlocked(client_t _client) {
- std::stringstream its_path;
- its_path << utility::get_base_path(configuration_) << std::hex << _client;
-
-#ifdef _WIN32
- boost::asio::ip::address address = boost::asio::ip::address::from_string("127.0.0.1");
- int port = VSOMEIP_INTERNAL_BASE_PORT + _client;
- VSOMEIP_INFO << "Connecting to ["
- << std::hex << _client << "] at " << port;
-#else
- VSOMEIP_INFO << "Client [" << std::hex << get_client() << "] is connecting to ["
- << std::hex << _client << "] at " << its_path.str();
-#endif
- std::shared_ptr<local_client_endpoint_impl> its_endpoint = std::make_shared<
- local_client_endpoint_impl>(shared_from_this(),
-#ifdef _WIN32
- boost::asio::ip::tcp::endpoint(address, port)
-#else
- boost::asio::local::stream_protocol::endpoint(its_path.str())
-#endif
- , io_, configuration_->get_max_message_size_local(),
- configuration_->get_endpoint_queue_limit_local());
-
- // Messages sent to the VSOMEIP_ROUTING_CLIENT are meant to be routed to
- // external devices. Therefore, its local endpoint must not be found by
- // a call to find_local. Thus it must not be inserted to the list of local
- // clients.
- if (_client != VSOMEIP_ROUTING_CLIENT) {
- local_endpoints_[_client] = its_endpoint;
- }
- register_client_error_handler(_client, its_endpoint);
-
- return its_endpoint;
-}
-
-std::shared_ptr<endpoint> routing_manager_base::create_local(client_t _client) {
- std::lock_guard<std::mutex> its_lock(local_endpoint_mutex_);
- return create_local_unlocked(_client);
-}
-
-std::shared_ptr<endpoint> routing_manager_base::find_local_unlocked(client_t _client) {
- std::shared_ptr<endpoint> its_endpoint;
- auto found_endpoint = local_endpoints_.find(_client);
- if (found_endpoint != local_endpoints_.end()) {
- its_endpoint = found_endpoint->second;
- }
- return (its_endpoint);
-}
-
-std::shared_ptr<endpoint> routing_manager_base::find_local(client_t _client) {
- std::lock_guard<std::mutex> its_lock(local_endpoint_mutex_);
- return find_local_unlocked(_client);
-}
-
-std::shared_ptr<endpoint> routing_manager_base::find_or_create_local(client_t _client) {
- std::lock_guard<std::mutex> its_lock(local_endpoint_mutex_);
- std::shared_ptr<endpoint> its_endpoint(find_local_unlocked(_client));
- if (!its_endpoint) {
- its_endpoint = create_local_unlocked(_client);
- its_endpoint->start();
- }
- return (its_endpoint);
-}
-
-void routing_manager_base::remove_local(client_t _client) {
- remove_local(_client, get_subscriptions(_client));
-}
-
-void routing_manager_base::remove_local(client_t _client,
- const std::set<std::tuple<service_t, instance_t, eventgroup_t>>& _subscribed_eventgroups) {
- for (auto its_subscription : _subscribed_eventgroups) {
- host_->on_subscription(std::get<0>(its_subscription), std::get<1>(its_subscription),
- std::get<2>(its_subscription), _client, false, [](const bool _subscription_accepted){ (void)_subscription_accepted; });
- routing_manager_base::unsubscribe(_client, std::get<0>(its_subscription),
- std::get<1>(its_subscription), std::get<2>(its_subscription), ANY_EVENT);
- }
- std::shared_ptr<endpoint> its_endpoint(find_local(_client));
- if (its_endpoint) {
- its_endpoint->register_error_handler(nullptr);
- its_endpoint->stop();
- VSOMEIP_INFO << "Client [" << std::hex << get_client() << "] is closing connection to ["
- << std::hex << _client << "]";
- std::lock_guard<std::mutex> its_lock(local_endpoint_mutex_);
- local_endpoints_.erase(_client);
- }
- {
- std::lock_guard<std::mutex> its_lock(local_services_mutex_);
- // Finally remove all services that are implemented by the client.
- std::set<std::pair<service_t, instance_t>> its_services;
- for (auto& s : local_services_) {
- for (auto& i : s.second) {
- if (std::get<2>(i.second) == _client) {
- its_services.insert({ s.first, i.first });
- host_->on_availability(s.first, i.first, false,
- std::get<0>(i.second), std::get<1>(i.second));
- }
- }
- }
-
- for (auto& si : its_services) {
- local_services_[si.first].erase(si.second);
- if (local_services_[si.first].size() == 0)
- local_services_.erase(si.first);
- }
- }
-}
-
-std::shared_ptr<endpoint> routing_manager_base::find_local(service_t _service,
- instance_t _instance) {
- return find_local(find_local_client(_service, _instance));
-}
-
-std::unordered_set<client_t> routing_manager_base::get_connected_clients() {
- std::lock_guard<std::mutex> its_lock(local_endpoint_mutex_);
- std::unordered_set<client_t> clients;
- for (auto its_client : local_endpoints_) {
- clients.insert(its_client.first);
- }
- return clients;
-}
-
-std::shared_ptr<event> routing_manager_base::find_event(service_t _service,
- instance_t _instance, event_t _event) const {
- std::shared_ptr<event> its_event;
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- auto find_service = events_.find(_service);
- if (find_service != events_.end()) {
- auto find_instance = find_service->second.find(_instance);
- if (find_instance != find_service->second.end()) {
- auto find_event = find_instance->second.find(_event);
- if (find_event != find_instance->second.end()) {
- its_event = find_event->second;
- }
- }
- }
- return (its_event);
-}
-
-std::shared_ptr<eventgroupinfo> routing_manager_base::find_eventgroup(
- service_t _service, instance_t _instance,
- eventgroup_t _eventgroup) const {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
-
- std::shared_ptr<eventgroupinfo> its_info(nullptr);
- 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()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- its_info = found_eventgroup->second;
- std::shared_ptr<serviceinfo> its_service_info
- = find_service(_service, _instance);
- if (its_service_info) {
- std::string its_multicast_address;
- uint16_t its_multicast_port;
- if (configuration_->get_multicast(_service, _instance,
- _eventgroup,
- its_multicast_address, its_multicast_port)) {
- try {
- its_info->set_multicast(
- boost::asio::ip::address::from_string(
- its_multicast_address),
- its_multicast_port);
- }
- catch (...) {
- VSOMEIP_ERROR << "Eventgroup ["
- << std::hex << std::setw(4) << std::setfill('0')
- << _service << "." << _instance << "." << _eventgroup
- << "] is configured as multicast, but no valid "
- "multicast address is configured!";
- }
- }
- its_info->set_major(its_service_info->get_major());
- its_info->set_ttl(its_service_info->get_ttl());
- its_info->set_threshold(configuration_->get_threshold(
- _service, _instance, _eventgroup));
- }
- }
- }
- }
- return (its_info);
-}
-
-void routing_manager_base::remove_eventgroup_info(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) {
- std::lock_guard<std::mutex> 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()) {
- found_instance->second.erase(_eventgroup);
- }
- }
-}
-
-bool routing_manager_base::send_local_notification(client_t _client,
- const byte_t *_data, uint32_t _size, instance_t _instance,
- bool _flush, bool _reliable, bool _is_valid_crc) {
-#ifdef USE_DLT
- 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]);
- std::shared_ptr<event> its_event = find_event(its_service, _instance, its_method);
- if (its_event && !its_event->is_shadow()) {
- std::vector< byte_t > its_data;
-
- for (auto its_client : its_event->get_subscribers()) {
- // local
- if (its_client == VSOMEIP_ROUTING_CLIENT) {
- has_remote = true;
- continue;
- }
-#ifdef USE_DLT
- else {
- has_local = true;
- }
-#endif
- std::shared_ptr<endpoint> its_local_target = find_local(its_client);
- if (its_local_target) {
- send_local(its_local_target, _client, _data, _size,
- _instance, _flush, _reliable, VSOMEIP_SEND, _is_valid_crc);
- }
- }
- }
-#ifdef USE_DLT
- // Trace the message if a local client but will _not_ be forwarded to the routing manager
- if (has_local && !has_remote) {
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- if (its_header.prepare(nullptr, true, _instance))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- _data, its_data_size);
- }
-#endif
- return has_remote;
-}
-
-bool routing_manager_base::send_local(
- std::shared_ptr<endpoint>& _target, client_t _client,
- const byte_t *_data, uint32_t _size, instance_t _instance,
- bool _flush, bool _reliable, uint8_t _command, bool _is_valid_crc) const {
- std::size_t its_complete_size = _size + sizeof(instance_t)
- + sizeof(bool) + sizeof(bool) + sizeof(bool);
- client_t sender = get_client();
- if (_command == VSOMEIP_NOTIFY_ONE) {
- its_complete_size +=sizeof(client_t);
- }
- std::vector<byte_t> its_command(
- VSOMEIP_COMMAND_HEADER_SIZE + its_complete_size);
- its_command[VSOMEIP_COMMAND_TYPE_POS] = _command;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &sender,
- sizeof(client_t));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_complete_size,
- sizeof(_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], _data,
- _size);
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + _size],
- &_instance, sizeof(instance_t));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + _size
- + sizeof(instance_t)], &_flush, sizeof(bool));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + _size
- + sizeof(instance_t) + sizeof(bool)], &_reliable, sizeof(bool));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + _size
- + sizeof(instance_t) + sizeof(bool) + sizeof(bool)], &_is_valid_crc, sizeof(bool));
- if (_command == VSOMEIP_NOTIFY_ONE) {
- // Add target client
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + _size
- + sizeof(instance_t) + sizeof(bool) + sizeof(bool) + sizeof(bool)], &_client, sizeof(client_t));
- }
-
- return _target->send(&its_command[0], uint32_t(its_command.size()));
-}
-
-bool routing_manager_base::insert_subscription(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, client_t _client, std::set<event_t> *_already_subscribed_events) {
- bool is_inserted(false);
- if (_event != ANY_EVENT) { // subscribe to specific event
- std::shared_ptr<event> its_event = find_event(_service, _instance, _event);
- if (its_event) {
- is_inserted = its_event->add_subscriber(_eventgroup, _client);
- } else {
- VSOMEIP_WARNING << "routing_manager_base::insert_subscription("
- << std::hex << std::setw(4) << std::setfill('0') << _client << "): ["
- << 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 << "]"
- << " received subscription for unknown (unrequested / "
- << "unoffered) event. Creating placeholder event holding "
- << "subscription until event is requested/offered.";
- is_inserted = create_placeholder_event_and_subscribe(_service,
- _instance, _eventgroup, _event, _client);
- }
- } else { // subscribe to all events of the eventgroup
- std::shared_ptr<eventgroupinfo> its_eventgroup
- = find_eventgroup(_service, _instance, _eventgroup);
- bool create_place_holder(false);
- if (its_eventgroup) {
- std::set<std::shared_ptr<event>> its_events = its_eventgroup->get_events();
- if (!its_events.size()) {
- create_place_holder = true;
- } else {
- for (const auto &e : its_events) {
- if (e->is_subscribed(_client)) {
- // client is already subscribed to event from eventgroup
- // this can happen if events are members of multiple
- // eventgroups
- _already_subscribed_events->insert(e->get_event());
- }
- is_inserted = e->add_subscriber(_eventgroup, _client) || is_inserted;
- }
- }
- } else {
- create_place_holder = true;
- }
- if (create_place_holder) {
- VSOMEIP_WARNING << "routing_manager_base::insert_subscription("
- << std::hex << std::setw(4) << std::setfill('0') << _client << "): ["
- << 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 << "]"
- << " received subscription for unknown (unrequested / "
- << "unoffered) eventgroup. Creating placeholder event holding "
- << "subscription until event is requested/offered.";
- is_inserted = create_placeholder_event_and_subscribe(_service,
- _instance, _eventgroup, _event, _client);
- }
- }
- return is_inserted;
-}
-
-std::shared_ptr<deserializer> routing_manager_base::get_deserializer() {
- std::unique_lock<std::mutex> its_lock(deserializer_mutex_);
- while (deserializers_.empty()) {
- VSOMEIP_INFO << std::hex << "client " << get_client() <<
- "routing_manager_base::get_deserializer ~> all in use!";
- deserializer_condition_.wait(its_lock);
- VSOMEIP_INFO << std::hex << "client " << get_client() <<
- "routing_manager_base::get_deserializer ~> wait finished!";
- }
- auto deserializer = deserializers_.front();
- deserializers_.pop();
- return deserializer;
-}
-
-void routing_manager_base::put_deserializer(std::shared_ptr<deserializer> _deserializer) {
- std::lock_guard<std::mutex> its_lock(deserializer_mutex_);
- deserializers_.push(_deserializer);
- deserializer_condition_.notify_one();
-}
-
-#ifndef _WIN32
-bool routing_manager_base::check_credentials(client_t _client, uid_t _uid, gid_t _gid) {
- return configuration_->check_credentials(_client, _uid, _gid);
-}
-#endif
-
-void routing_manager_base::send_pending_subscriptions(service_t _service,
- instance_t _instance, major_version_t _major) {
- for (auto &ps : pending_subscriptions_) {
- if (ps.service_ == _service &&
- ps.instance_ == _instance && ps.major_ == _major) {
- send_subscribe(client_, ps.service_, ps.instance_,
- ps.eventgroup_, ps.major_, ps.event_, ps.subscription_type_);
- }
- }
-}
-
-void routing_manager_base::remove_pending_subscription(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event) {
- if (_eventgroup == 0xFFFF) {
- for (auto it = pending_subscriptions_.begin();
- it != pending_subscriptions_.end();) {
- if (it->service_ == _service
- && it->instance_ == _instance) {
- it = pending_subscriptions_.erase(it);
- } else {
- it++;
- }
- }
- } else if (_event == ANY_EVENT) {
- for (auto it = pending_subscriptions_.begin();
- it != pending_subscriptions_.end();) {
- if (it->service_ == _service
- && it->instance_ == _instance
- && it->eventgroup_ == _eventgroup) {
- it = pending_subscriptions_.erase(it);
- } else {
- it++;
- }
- }
- } else {
- for (auto it = pending_subscriptions_.begin();
- it != pending_subscriptions_.end();) {
- if (it->service_ == _service
- && it->instance_ == _instance
- && it->eventgroup_ == _eventgroup
- && it->event_ == _event) {
- it = pending_subscriptions_.erase(it);
- break;
- } else {
- it++;
- }
- }
- }
-}
-
-std::set<std::tuple<service_t, instance_t, eventgroup_t>>
-routing_manager_base::get_subscriptions(const client_t _client) {
- std::set<std::tuple<service_t, instance_t, eventgroup_t>> result;
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- for (auto its_service : events_) {
- for (auto its_instance : its_service.second) {
- for (auto its_event : its_instance.second) {
- auto its_eventgroups = its_event.second->get_eventgroups(_client);
- for (auto e : its_eventgroups) {
- result.insert(std::make_tuple(
- its_service.first,
- its_instance.first,
- e));
- }
- }
- }
- }
- return result;
-}
-
-void routing_manager_base::send_identify_request(service_t _service,
- instance_t _instance, major_version_t _major, bool _reliable) {
- auto message = runtime::get()->create_message(_reliable);
- message->set_service(_service);
- message->set_instance(_instance);
- message->set_client(get_client());
- message->set_method(ANY_METHOD - 1);
- message->set_interface_version(_major);
- message->set_message_type(message_type_e::MT_REQUEST);
-
- // Initiate a request/response to the remote service
- // Use host for sending to ensure correct session id is set
- host_->send(message, true);
-}
-
-std::map<client_t, std::shared_ptr<endpoint>>
-routing_manager_base::get_local_endpoints() {
- std::lock_guard<std::mutex> its_lock(local_endpoint_mutex_);
- return local_endpoints_;
-}
-
-} // namespace vsomeip
diff --git a/implementation/routing/src/routing_manager_impl.cpp b/implementation/routing/src/routing_manager_impl.cpp
deleted file mode 100644
index e317e6d..0000000
--- a/implementation/routing/src/routing_manager_impl.cpp
+++ /dev/null
@@ -1,4563 +0,0 @@
-// Copyright (C) 2014-2017 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 <climits>
-#include <iomanip>
-#include <memory>
-#include <sstream>
-#include <forward_list>
-
-#ifndef _WIN32
-#include <unistd.h>
-#include <cstdio>
-#include <time.h>
-#endif
-
-#ifndef WITHOUT_SYSTEMD
-#include <systemd/sd-daemon.h>
-#endif
-
-#include <boost/asio/steady_timer.hpp>
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/message.hpp>
-#include <vsomeip/payload.hpp>
-#include <vsomeip/runtime.hpp>
-
-#include "../include/event.hpp"
-#include "../include/eventgroupinfo.hpp"
-#include "../include/routing_manager_host.hpp"
-#include "../include/routing_manager_impl.hpp"
-#include "../include/routing_manager_stub.hpp"
-#include "../include/serviceinfo.hpp"
-#include "../../configuration/include/configuration.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../endpoints/include/endpoint_definition.hpp"
-#include "../../endpoints/include/local_client_endpoint_impl.hpp"
-#include "../../endpoints/include/tcp_client_endpoint_impl.hpp"
-#include "../../endpoints/include/tcp_server_endpoint_impl.hpp"
-#include "../../endpoints/include/udp_client_endpoint_impl.hpp"
-#include "../../endpoints/include/udp_server_endpoint_impl.hpp"
-#include "../../endpoints/include/virtual_server_endpoint_impl.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-#include "../../service_discovery/include/constants.hpp"
-#include "../../service_discovery/include/defines.hpp"
-#include "../../service_discovery/include/runtime.hpp"
-#include "../../service_discovery/include/service_discovery_impl.hpp"
-#include "../../utility/include/byteorder.hpp"
-#include "../../utility/include/utility.hpp"
-#include "../../plugin/include/plugin_manager.hpp"
-
-#include "../../e2e_protection/include/buffer/buffer.hpp"
-#include "../../e2e_protection/include/e2exf/config.hpp"
-
-#include "../../e2e_protection/include/e2e/profile/profile01/profile_01.hpp"
-#include "../../e2e_protection/include/e2e/profile/profile01/protector.hpp"
-#include "../../e2e_protection/include/e2e/profile/profile01/checker.hpp"
-
-#include "../../e2e_protection/include/e2e/profile/profile_custom/profile_custom.hpp"
-#include "../../e2e_protection/include/e2e/profile/profile_custom/protector.hpp"
-#include "../../e2e_protection/include/e2e/profile/profile_custom/checker.hpp"
-
-namespace vsomeip {
-
-routing_manager_impl::routing_manager_impl(routing_manager_host *_host) :
- routing_manager_base(_host),
- version_log_timer_(_host->get_io()),
- if_state_running_(false),
- sd_route_set_(false),
- routing_running_(false),
-#ifndef WITHOUT_SYSTEMD
- watchdog_timer_(_host->get_io()),
-#endif
- status_log_timer_(_host->get_io()),
- memory_log_timer_(_host->get_io())
-{
-}
-
-routing_manager_impl::~routing_manager_impl() {
-}
-
-boost::asio::io_service & routing_manager_impl::get_io() {
- return routing_manager_base::get_io();
-}
-
-client_t routing_manager_impl::get_client() const {
- return routing_manager_base::get_client();
-}
-
-void routing_manager_impl::init() {
- routing_manager_base::init();
-
- // TODO: Only instantiate the stub if needed
- stub_ = std::make_shared<routing_manager_stub>(this, configuration_);
- stub_->init();
-
- // We need to be able to send messages to ourself (for delivering events)
- (void)create_local(VSOMEIP_ROUTING_CLIENT);
-
- if (configuration_->is_sd_enabled()) {
- VSOMEIP_INFO<< "Service Discovery enabled. Trying to load module.";
- auto its_plugin = plugin_manager::get()->get_plugin(
- plugin_type_e::SD_RUNTIME_PLUGIN, VSOMEIP_SD_LIBRARY);
- if (its_plugin) {
- VSOMEIP_INFO << "Service Discovery module loaded.";
- discovery_ = std::dynamic_pointer_cast<sd::runtime>(its_plugin)->create_service_discovery(this);
- discovery_->init();
- }
- }
-
- if( configuration_->is_e2e_enabled()) {
- VSOMEIP_INFO << "E2E protection enabled.";
- std::map<e2exf::data_identifier, std::shared_ptr<cfg::e2e>> its_e2e_configuration = configuration_->get_e2e_configuration();
- for (auto &identifier : its_e2e_configuration) {
- auto its_cfg = identifier.second;
- if(its_cfg->profile == "CRC8") {
- e2exf::data_identifier its_data_identifier = {its_cfg->service_id, its_cfg->event_id};
- e2e::profile01::profile_config its_profile_config = e2e::profile01::profile_config(its_cfg->crc_offset, its_cfg->data_id,
- (e2e::profile01::p01_data_id_mode) its_cfg->data_id_mode, its_cfg->data_length, its_cfg->counter_offset, its_cfg->data_id_nibble_offset);
- if ((its_cfg->variant == "protector") || (its_cfg->variant == "both")) {
- custom_protectors[its_data_identifier] = std::make_shared<e2e::profile01::protector>(its_profile_config);
- }
- if ((its_cfg->variant == "checker") || (its_cfg->variant == "both")) {
- custom_checkers[its_data_identifier] = std::make_shared<e2e::profile01::profile_01_checker>(its_profile_config);
- }
- } else if(its_cfg->profile == "CRC32") {
- e2exf::data_identifier its_data_identifier = {its_cfg->service_id, its_cfg->event_id};
- e2e::profile_custom::profile_config its_profile_config = e2e::profile_custom::profile_config(its_cfg->crc_offset);
-
- if ((its_cfg->variant == "protector") || (its_cfg->variant == "both")) {
- custom_protectors[its_data_identifier] = std::make_shared<e2e::profile_custom::protector>(its_profile_config);
- }
- if ((its_cfg->variant == "checker") || (its_cfg->variant == "both")) {
- custom_checkers[its_data_identifier] = std::make_shared<e2e::profile_custom::profile_custom_checker>(its_profile_config);
- }
- }
- }
- }
-}
-
-void routing_manager_impl::start() {
-#ifndef _WIN32
- netlink_connector_ = std::make_shared<netlink_connector>(host_->get_io(),
- configuration_->get_unicast_address(),
- boost::asio::ip::address::from_string(configuration_->get_sd_multicast()));
- netlink_connector_->register_net_if_changes_handler(
- std::bind(&routing_manager_impl::on_net_interface_or_route_state_changed,
- this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
- netlink_connector_->start();
-#else
- {
- std::lock_guard<std::mutex> its_lock(pending_sd_offers_mutex_);
- start_ip_routing();
- }
-#endif
-
- stub_->start();
- host_->on_state(state_type_e::ST_REGISTERED);
-
- if (configuration_->log_version()) {
- std::lock_guard<std::mutex> its_lock(version_log_timer_mutex_);
- version_log_timer_.expires_from_now(
- std::chrono::seconds(0));
- version_log_timer_.async_wait(std::bind(&routing_manager_impl::log_version_timer_cbk,
- this, std::placeholders::_1));
- }
-
-#ifndef WITHOUT_SYSTEMD
- {
- std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
- watchdog_timer_.expires_from_now(std::chrono::seconds(0));
- watchdog_timer_.async_wait(std::bind(&routing_manager_impl::watchdog_cbk,
- this, std::placeholders::_1));
- }
-#endif
-#ifndef _WIN32
- if (configuration_->log_memory()) {
- std::lock_guard<std::mutex> its_lock(memory_log_timer_mutex_);
- boost::system::error_code ec;
- memory_log_timer_.expires_from_now(std::chrono::seconds(0), ec);
- memory_log_timer_.async_wait(
- std::bind(&routing_manager_impl::memory_log_timer_cbk, this,
- std::placeholders::_1));
- }
-#endif
- if (configuration_->log_status()) {
- std::lock_guard<std::mutex> its_lock(status_log_timer_mutex_);
- boost::system::error_code ec;
- status_log_timer_.expires_from_now(std::chrono::seconds(0), ec);
- status_log_timer_.async_wait(
- std::bind(&routing_manager_impl::status_log_timer_cbk, this,
- std::placeholders::_1));
- }
-}
-
-void routing_manager_impl::stop() {
- {
- std::lock_guard<std::mutex> its_lock(version_log_timer_mutex_);
- version_log_timer_.cancel();
- }
-#ifndef _WIN32
- {
- boost::system::error_code ec;
- std::lock_guard<std::mutex> its_lock(memory_log_timer_mutex_);
- memory_log_timer_.cancel(ec);
- }
- if (netlink_connector_) {
- netlink_connector_->stop();
- }
-#endif
-
- {
- std::lock_guard<std::mutex> its_lock(status_log_timer_mutex_);
- boost::system::error_code ec;
- status_log_timer_.cancel(ec);
- }
-#ifndef WITHOUT_SYSTEMD
- {
- std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
- watchdog_timer_.cancel();
- }
- sd_notify(0, "STOPPING=1");
- VSOMEIP_INFO << "Sent STOPPING to systemd watchdog";
-#endif
-
- host_->on_state(state_type_e::ST_DEREGISTERED);
-
- if (discovery_)
- discovery_->stop();
- stub_->stop();
-
- for (auto client: get_connected_clients()) {
- if (client != VSOMEIP_ROUTING_CLIENT) {
- remove_local(client);
- }
- }
-}
-
-bool routing_manager_impl::offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor) {
- VSOMEIP_INFO << "OFFER("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance
- << ":" << std::dec << int(_major) << "." << std::dec << _minor << "]";
-
- if(!handle_local_offer_service(_client, _service, _instance, _major, _minor)) {
- return false;
- }
-
- {
- std::lock_guard<std::mutex> its_lock(pending_sd_offers_mutex_);
- if (if_state_running_) {
- init_service_info(_service, _instance, true);
- } else {
- pending_sd_offers_.push_back(std::make_pair(_service, _instance));
- }
- }
-
- if (discovery_) {
- std::shared_ptr<serviceinfo> its_info = find_service(_service, _instance);
- if (its_info) {
- discovery_->offer_service(_service, _instance, its_info);
- }
- }
-
- {
- std::lock_guard<std::mutex> ist_lock(pending_subscription_mutex_);
- std::set<event_t> its_already_subscribed_events;
- for (auto &ps : pending_subscriptions_) {
- if (ps.service_ == _service &&
- ps.instance_ == _instance && ps.major_ == _major) {
- insert_subscription(ps.service_, ps.instance_,
- ps.eventgroup_, ps.event_, client_, &its_already_subscribed_events);
- }
- }
- send_pending_subscriptions(_service, _instance, _major);
- }
- stub_->on_offer_service(_client, _service, _instance, _major, _minor);
- on_availability(_service, _instance, true, _major, _minor);
- return true;
-}
-
-void routing_manager_impl::stop_offer_service(client_t _client,
- service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) {
-
- VSOMEIP_INFO << "STOP OFFER("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance
- << ":" << std::dec << int(_major) << "." << _minor << "]";
-
- {
- std::lock_guard<std::mutex> its_lock(pending_sd_offers_mutex_);
- for (auto it = pending_sd_offers_.begin(); it != pending_sd_offers_.end(); ) {
- if (it->first == _service && it->second == _instance) {
- it = pending_sd_offers_.erase(it);
- break;
- } else {
- ++it;
- }
- }
- }
-
- on_stop_offer_service(_client, _service, _instance, _major, _minor);
- stub_->on_stop_offer_service(_client, _service, _instance, _major, _minor);
- on_availability(_service, _instance, false, _major, _minor);
-}
-
-void routing_manager_impl::request_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor,
- bool _use_exclusive_proxy) {
-
- VSOMEIP_INFO << "REQUEST("
- << std::hex << std::setw(4) << std::setfill('0') << _client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << ":"
- << std::dec << int(_major) << "." << std::dec << _minor << "]";
-
- routing_manager_base::request_service(_client, _service, _instance, _major,
- _minor, _use_exclusive_proxy);
-
- auto its_info = find_service(_service, _instance);
- if (!its_info) {
- requested_service_add(_client, _service, _instance, _major, _minor);
- if (discovery_) {
- if (!configuration_->is_local_service(_service, _instance)) {
- // Non local service instance ~> tell SD to find it!
- discovery_->request_service(_service, _instance, _major, _minor,
- DEFAULT_TTL);
- } else {
- VSOMEIP_INFO << std::hex
- << "Avoid trigger SD find-service message"
- << " for local service/instance/major/minor: "
- << _service << "/" << _instance << std::dec
- << "/" << (uint32_t)_major << "/" << _minor;
- }
- }
- } else {
- if ((_major == its_info->get_major()
- || DEFAULT_MAJOR == its_info->get_major()
- || ANY_MAJOR == _major)
- && (_minor <= its_info->get_minor()
- || DEFAULT_MINOR == its_info->get_minor()
- || _minor == ANY_MINOR)) {
- if(!its_info->is_local()) {
- requested_service_add(_client, _service, _instance, _major, _minor);
- its_info->add_client(_client);
- find_or_create_remote_client(_service, _instance, true, VSOMEIP_ROUTING_CLIENT);
- if (_use_exclusive_proxy) {
- std::shared_ptr<endpoint> its_endpoint = its_info->get_endpoint(true);
- if(its_endpoint) {
- find_or_create_remote_client(_service, _instance, true, _client);
- }
- }
- }
- }
- }
-
- if (_use_exclusive_proxy) {
- std::lock_guard<std::mutex> its_lock(specific_endpoint_clients_mutex_);
- specific_endpoint_clients_[_service][_instance].insert(_client);
- }
-
- if (_client == get_client()) {
- stub_->create_local_receiver();
-
- service_data_t request = { _service, _instance, _major, _minor, _use_exclusive_proxy };
- std::set<service_data_t> requests;
- requests.insert(request);
- stub_->handle_requests(_client, requests);
- }
-}
-
-void routing_manager_impl::release_service(client_t _client, service_t _service,
- instance_t _instance) {
-
- VSOMEIP_INFO << "RELEASE("
- << std::hex << std::setw(4) << std::setfill('0') << _client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "]";
-
- if (host_->get_client() == _client) {
- std::lock_guard<std::mutex> its_lock(pending_subscription_mutex_);
- remove_pending_subscription(_service, _instance, 0xFFFF, ANY_EVENT);
- }
- routing_manager_base::release_service(_client, _service, _instance);
- requested_service_remove(_client, _service, _instance);
-
- std::shared_ptr<serviceinfo> its_info(find_service(_service, _instance));
- if(its_info && !its_info->is_local()) {
- unsubscribe_specific_client_at_sd(_service, _instance, _client);
- if(!its_info->get_requesters_size()) {
- if(discovery_) {
- discovery_->release_service(_service, _instance);
- discovery_->unsubscribe_client(_service, _instance, VSOMEIP_ROUTING_CLIENT);
- }
- clear_client_endpoints(_service, _instance, true);
- clear_client_endpoints(_service, _instance, false);
- its_info->set_endpoint(nullptr, true);
- its_info->set_endpoint(nullptr, false);
- clear_identified_clients(_service, _instance);
- clear_identifying_clients( _service, _instance);
- unset_all_eventpayloads(_service, _instance);
- } else {
- remove_identified_client(_service, _instance, _client);
- remove_identifying_client(_service, _instance, _client);
- remove_specific_client_endpoint(_service, _instance, _client, true);
- remove_specific_client_endpoint(_service, _instance, _client, false);
- }
- } else {
- if(discovery_) {
- discovery_->release_service(_service, _instance);
- }
- }
-}
-
-void routing_manager_impl::subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, major_version_t _major,
- event_t _event, subscription_type_e _subscription_type) {
-
- VSOMEIP_INFO << "SUBSCRIBE("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << 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 << ":"
- << std::dec << (uint16_t)_major << "]";
- const client_t its_local_client = find_local_client(_service, _instance);
- if (get_client() == its_local_client) {
- auto self = shared_from_this();
- host_->on_subscription(_service, _instance, _eventgroup, _client, true,
- [this, self, _client, _service, _instance, _eventgroup,
- _event, _major, _subscription_type]
- (const bool _subscription_accepted) {
- (void) find_or_create_local(_client);
- if (!_subscription_accepted) {
- stub_->send_subscribe_nack(_client, _service, _instance, _eventgroup, _event);
- VSOMEIP_INFO << "Subscription request from client: 0x" << std::hex
- << _client << std::dec << " for eventgroup: 0x" << _eventgroup
- << " rejected from application handler.";
- return;
- } else {
- stub_->send_subscribe_ack(_client, _service, _instance, _eventgroup, _event);
- }
- routing_manager_base::subscribe(_client, _service, _instance, _eventgroup, _major, _event, _subscription_type);
- send_pending_notify_ones(_service, _instance, _eventgroup, _client);
- });
- } else {
- if (discovery_) {
- client_t subscriber = VSOMEIP_ROUTING_CLIENT;
- if (0 == its_local_client) {
- subscriber = is_specific_endpoint_client(_client, _service, _instance);
- if (subscriber != VSOMEIP_ROUTING_CLIENT) {
- if (supports_selective(_service, _instance)) {
- identify_for_subscribe(_client, _service, _instance,
- _major, _subscription_type);
- } else {
- VSOMEIP_INFO << "Subcribe to legacy selective service: " << std::hex
- << _service << ":" << _instance << ".";
- }
- }
- }
- std::unique_lock<std::mutex> eventgroup_lock;
- auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup);
- if (its_eventgroup) {
- eventgroup_lock = its_eventgroup->get_subscription_lock();
- }
- std::set<event_t> its_already_subscribed_events;
- bool inserted = insert_subscription(_service, _instance, _eventgroup,
- _event, _client, &its_already_subscribed_events);
- if (inserted) {
- if (0 == its_local_client) {
- handle_subscription_state(_client, _service, _instance, _eventgroup, _event);
- if (its_eventgroup) {
- eventgroup_lock.unlock();
- }
- static const ttl_t configured_ttl(configuration_->get_sd_ttl());
- notify_one_current_value(_client, _service, _instance,
- _eventgroup, _event, its_already_subscribed_events);
- discovery_->subscribe(_service, _instance, _eventgroup,
- _major, configured_ttl, subscriber, _subscription_type);
- } else {
- if (is_available(_service, _instance, _major)) {
- stub_->send_subscribe(find_local(_service, _instance),
- _client, _service, _instance, _eventgroup, _major, _event, DEFAULT_SUBSCRIPTION);
- }
- }
- } else if (its_eventgroup) {
- eventgroup_lock.unlock();
- }
- if (get_client() == _client) {
- std::lock_guard<std::mutex> ist_lock(pending_subscription_mutex_);
- subscription_data_t subscription = { _service, _instance, _eventgroup, _major,
- _event, _subscription_type};
- pending_subscriptions_.insert(subscription);
- }
- } else {
- VSOMEIP_ERROR<< "SOME/IP eventgroups require SD to be enabled!";
- }
- }
-}
-
-void routing_manager_impl::unsubscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event) {
-
- VSOMEIP_INFO << "UNSUBSCRIBE("
- << std::hex << std::setw(4) << std::setfill('0') << _client << "): ["
- << 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 << "]";
-
- bool last_subscriber_removed(true);
- std::shared_ptr<eventgroupinfo> its_info
- = find_eventgroup(_service, _instance, _eventgroup);
- if (its_info) {
- for (auto e : its_info->get_events()) {
- if (e->get_event() == _event || ANY_EVENT == _event)
- e->remove_subscriber(_eventgroup, _client);
- }
- for (auto e : its_info->get_events()) {
- if (e->has_subscriber(_eventgroup, ANY_CLIENT)) {
- last_subscriber_removed = false;
- break;
- }
- }
- }
-
- if (discovery_) {
- host_->on_subscription(_service, _instance, _eventgroup, _client, false, [](const bool _subscription_accepted){ (void)_subscription_accepted; });
- if (0 == find_local_client(_service, _instance)) {
- client_t subscriber = is_specific_endpoint_client(_client, _service, _instance);
- if (last_subscriber_removed) {
- unset_all_eventpayloads(_service, _instance, _eventgroup);
- }
- if (subscriber == VSOMEIP_ROUTING_CLIENT && last_subscriber_removed) {
- {
- auto tuple = std::make_tuple(_service, _instance, _eventgroup, subscriber);
- std::lock_guard<std::mutex> its_lock(remote_subscription_state_mutex_);
- remote_subscription_state_.erase(tuple);
- }
- // for normal subscribers only unsubscribe via SD if last
- // subscriber was removed
- discovery_->unsubscribe(_service, _instance, _eventgroup, subscriber);
- } else if (subscriber != VSOMEIP_ROUTING_CLIENT) {
- {
- auto tuple = std::make_tuple(_service, _instance, _eventgroup, subscriber);
- std::lock_guard<std::mutex> its_lock(remote_subscription_state_mutex_);
- remote_subscription_state_.erase(tuple);
- }
- // for selective subscribers always unsubscribe at the SD
- discovery_->unsubscribe(_service, _instance, _eventgroup, subscriber);
- }
- } else {
- if (get_client() == _client) {
- std::lock_guard<std::mutex> ist_lock(pending_subscription_mutex_);
- remove_pending_subscription(_service, _instance, _eventgroup, _event);
- stub_->send_unsubscribe(find_local(_service, _instance),
- _client, _service, _instance, _eventgroup, _event,
- DEFAULT_SUBSCRIPTION);
- }
- }
- clear_multicast_endpoints(_service, _instance);
-
- } else {
- VSOMEIP_ERROR<< "SOME/IP eventgroups require SD to be enabled!";
- }
-}
-
-bool routing_manager_impl::send(client_t _client,
- std::shared_ptr<message> _message, bool _flush) {
- return routing_manager_base::send(_client, _message, _flush);
-}
-
-bool routing_manager_impl::send(client_t _client, const byte_t *_data,
- length_t _size, instance_t _instance,
- bool _flush, bool _reliable, bool _is_valid_crc) {
- bool is_sent(false);
- if (_size > VSOMEIP_MESSAGE_TYPE_POS) {
- std::shared_ptr<endpoint> its_target;
- bool is_request = utility::is_request(_data[VSOMEIP_MESSAGE_TYPE_POS]);
- bool is_notification = utility::is_notification(_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]);
-
- bool is_service_discovery = (its_service == vsomeip::sd::service
- && its_method == vsomeip::sd::method);
-
-#ifdef USE_DLT
- bool is_response(false);
-#endif
-
- if (is_request) {
- its_target = find_local(its_service, _instance);
- } else if (!is_notification) {
-#ifdef USE_DLT
- is_response = true;
-#endif
- its_target = find_local(its_client);
- } else if (is_notification && _client) { // Selective notifications!
- if (_client == get_client()) {
-#ifdef USE_DLT
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- if (its_header.prepare(its_target, true, _instance))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- _data, its_data_size);
-#endif
- deliver_message(_data, _size, _instance, _reliable, _is_valid_crc);
- return true;
- }
- its_target = find_local(_client);
- }
-
- if (its_target) {
-#ifdef USE_DLT
- if ((is_request && its_client == get_client()) ||
- (is_response && find_local_client(its_service, _instance) == get_client())) {
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- if (its_header.prepare(its_target, true, _instance))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- _data, its_data_size);
- }
-#endif
- is_sent = send_local(its_target, get_client(), _data, _size, _instance, _flush, _reliable, VSOMEIP_SEND, _is_valid_crc);
- } else {
- // Check whether hosting application should get the message
- // If not, check routes to external
- if ((its_client == host_->get_client() && !is_request)
- || (find_local_client(its_service, _instance)
- == host_->get_client() && is_request)) {
- // TODO: find out how to handle session id here
- is_sent = deliver_message(_data, _size, _instance, _reliable, _is_valid_crc);
- } else {
- e2e_buffer outputBuffer;
- if( configuration_->is_e2e_enabled()) {
- 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]);
- if( custom_protectors.count({its_service, its_method})) {
- outputBuffer.assign(_data, _data + VSOMEIP_PAYLOAD_POS);
- e2e_buffer inputBuffer(_data + VSOMEIP_PAYLOAD_POS, _data +_size);
- custom_protectors[{its_service, its_method}]->protect( inputBuffer);
- outputBuffer.resize(inputBuffer.size() + VSOMEIP_PAYLOAD_POS);
- std::copy(inputBuffer.begin(), inputBuffer.end(), outputBuffer.begin() + VSOMEIP_PAYLOAD_POS);
- _data = outputBuffer.data();
- }
- }
- }
- if (is_request) {
- client_t client = is_specific_endpoint_client(its_client, its_service, _instance);
- its_target = find_or_create_remote_client(its_service, _instance, _reliable, client);
- if (its_target) {
-#ifdef USE_DLT
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- if (its_header.prepare(its_target, true, _instance))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- _data, its_data_size);
-#endif
- is_sent = its_target->send(_data, _size, _flush);
- } else {
- const session_t its_session = VSOMEIP_BYTES_TO_WORD(
- _data[VSOMEIP_SESSION_POS_MIN],
- _data[VSOMEIP_SESSION_POS_MAX]);
- VSOMEIP_ERROR<< "Routing info for remote service could not be found! ("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "] "
- << std::hex << std::setw(4) << std::setfill('0') << its_session;
- }
- } else {
- std::shared_ptr<serviceinfo> its_info(find_service(its_service, _instance));
- if (its_info || is_service_discovery) {
- if (is_notification && !is_service_discovery) {
- send_local_notification(get_client(), _data, _size, _instance, _flush, _reliable, _is_valid_crc);
- method_t its_method = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN],
- _data[VSOMEIP_METHOD_POS_MAX]);
- std::shared_ptr<event> its_event = find_event(its_service, _instance, its_method);
- if (its_event) {
-#ifdef USE_DLT
- bool has_sent(false);
-#endif
- std::set<std::shared_ptr<endpoint_definition>> its_targets;
- // we need both endpoints as clients can subscribe to events via TCP and UDP
- std::shared_ptr<endpoint> its_udp_server_endpoint = its_info->get_endpoint(false);
- std::shared_ptr<endpoint> its_tcp_server_endpoint = its_info->get_endpoint(true);
- bool is_offered_both(false);
- if (its_udp_server_endpoint && its_tcp_server_endpoint) {
- is_offered_both = true;
- }
- if (its_udp_server_endpoint || its_tcp_server_endpoint) {
- for (auto its_group : its_event->get_eventgroups()) {
- auto its_eventgroup = find_eventgroup(its_service, _instance, its_group);
- if (its_eventgroup) {
- // Unicast targets
- for (const auto &its_remote : its_eventgroup->get_targets()) {
- if(its_remote.endpoint_->is_reliable() && its_tcp_server_endpoint) {
- if (!is_offered_both || (is_offered_both && its_event->is_reliable())) {
- its_targets.insert(its_remote.endpoint_);
- }
- } else if (its_udp_server_endpoint && !its_eventgroup->is_sending_multicast()) {
- if (!is_offered_both || (is_offered_both && !its_event->is_reliable())) {
- its_targets.insert(its_remote.endpoint_);
- }
- }
- }
- // Send to multicast targets if subscribers are still interested
- if (its_eventgroup->is_sending_multicast()) {
- for (auto its_multicast_target : its_eventgroup->get_multicast_targets()) {
- if (!is_offered_both || (is_offered_both && !its_event->is_reliable())) {
- its_targets.insert(its_multicast_target.endpoint_);
- }
- }
- }
- }
- }
- }
- for (auto const &target : its_targets) {
- if (target->is_reliable()) {
- its_tcp_server_endpoint->send_to(target, _data, _size, _flush);
- } else {
- its_udp_server_endpoint->send_to(target, _data, _size, _flush);
- }
-#ifdef USE_DLT
- has_sent = true;
-#endif
- }
-#ifdef USE_DLT
- if (has_sent) {
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- if (its_header.prepare(nullptr, true, _instance))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- _data, its_data_size);
- }
-#endif
- }
- } else {
- if ((utility::is_response(_data[VSOMEIP_MESSAGE_TYPE_POS])
- || utility::is_error(_data[VSOMEIP_MESSAGE_TYPE_POS]))
- && !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]);
- VSOMEIP_ERROR
- << "routing_manager_impl::send: Received response/error for unknown client ("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "] "
- << std::hex << std::setw(4) << std::setfill('0') << its_session;
- return false;
- }
- its_target = is_service_discovery ?
- (sd_info_ ? sd_info_->get_endpoint(false) : nullptr) : its_info->get_endpoint(_reliable);
- if (its_target) {
-#ifdef USE_DLT
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- if (its_header.prepare(its_target, true, _instance))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- _data, its_data_size);
-#endif
- is_sent = its_target->send(_data, _size, _flush);
- } else {
- const session_t its_session = VSOMEIP_BYTES_TO_WORD(
- _data[VSOMEIP_SESSION_POS_MIN],
- _data[VSOMEIP_SESSION_POS_MAX]);
- VSOMEIP_ERROR << "Routing error. Endpoint for service ("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "] "
- << std::hex << std::setw(4) << std::setfill('0') << its_session
- << " could not be found!";
- }
- }
- } else {
- if (!is_notification) {
- const session_t its_session = VSOMEIP_BYTES_TO_WORD(
- _data[VSOMEIP_SESSION_POS_MIN],
- _data[VSOMEIP_SESSION_POS_MAX]);
- VSOMEIP_ERROR << "Routing error. Not hosting service ("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "] "
- << std::hex << std::setw(4) << std::setfill('0') << its_session;
- }
- }
- }
- }
- }
- }
-
- return (is_sent);
-}
-
-bool routing_manager_impl::send_to(
- const std::shared_ptr<endpoint_definition> &_target,
- std::shared_ptr<message> _message, bool _flush) {
- bool is_sent(false);
- std::lock_guard<std::mutex> its_lock(serialize_mutex_);
- if (serializer_->serialize(_message.get())) {
- const byte_t *_data = serializer_->get_data();
- length_t _size = serializer_->get_size();
- e2e_buffer outputBuffer;
- if( configuration_->is_e2e_enabled()) {
- 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]);
- if( custom_protectors.count({its_service, its_method})) {
- outputBuffer.assign(_data, _data + VSOMEIP_PAYLOAD_POS);
- e2e_buffer inputBuffer(_data + VSOMEIP_PAYLOAD_POS, _data +_size);
- custom_protectors[{its_service, its_method}]->protect( inputBuffer);
- outputBuffer.resize(inputBuffer.size() + VSOMEIP_PAYLOAD_POS);
- std::copy(inputBuffer.begin(), inputBuffer.end(), outputBuffer.begin() + VSOMEIP_PAYLOAD_POS);
- _data = outputBuffer.data();
- }
- }
- is_sent = send_to(_target, _data, _size, _message->get_instance(), _flush);
- serializer_->reset();
- } else {
- VSOMEIP_ERROR<< "routing_manager_impl::send_to: serialization failed.";
- }
- return (is_sent);
-}
-
-bool routing_manager_impl::send_to(
- const std::shared_ptr<endpoint_definition> &_target,
- const byte_t *_data, uint32_t _size, instance_t _instance,
- bool _flush) {
- std::shared_ptr<endpoint> its_endpoint = find_server_endpoint(
- _target->get_remote_port(), _target->is_reliable());
-
- if (its_endpoint) {
-#ifdef USE_DLT
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- if (its_header.prepare(its_endpoint, true, _instance))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- _data, its_data_size);
-#else
- (void) _instance;
-#endif
- return its_endpoint->send_to(_target, _data, _size, _flush);
- }
- return false;
-}
-
-bool routing_manager_impl::send_to(
- const std::shared_ptr<endpoint_definition> &_target,
- const byte_t *_data, uint32_t _size, uint16_t _sd_port) {
- std::shared_ptr<endpoint> its_endpoint = find_server_endpoint(
- _sd_port, _target->is_reliable());
-
- if (its_endpoint) {
-#ifdef USE_DLT
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- if (its_header.prepare(its_endpoint, true, 0x0))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- _data, its_data_size);
-#endif
- return its_endpoint->send_to(_target, _data, _size);
- }
-
- return false;
-}
-
-void routing_manager_impl::register_event(
- client_t _client, service_t _service, instance_t _instance,
- event_t _event, const std::set<eventgroup_t> &_eventgroups,
- bool _is_field, std::chrono::milliseconds _cycle,
- bool _change_resets_cycle, epsilon_change_func_t _epsilon_change_func,
- bool _is_provided, bool _is_shadow, bool _is_cache_placeholder) {
- auto its_event = find_event(_service, _instance, _event);
- bool is_first(false);
- if (its_event && !its_event->has_ref(_client, _is_provided)) {
- is_first = true;
- } else {
- is_first = true;
- }
- if (is_first) {
- routing_manager_base::register_event(_client, _service, _instance,
- _event, _eventgroups, _is_field, _cycle, _change_resets_cycle,
- _epsilon_change_func, _is_provided, _is_shadow,
- _is_cache_placeholder);
- }
- VSOMEIP_INFO << "REGISTER EVENT("
- << std::hex << std::setw(4) << std::setfill('0') << _client << "): ["
- << 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') << _event
- << ":is_provider=" << _is_provided << "]";
-}
-
-void routing_manager_impl::register_shadow_event(client_t _client,
- service_t _service, instance_t _instance,
- event_t _event, const std::set<eventgroup_t> &_eventgroups,
- bool _is_field, bool _is_provided) {
- routing_manager_base::register_event(_client, _service, _instance,
- _event, _eventgroups, _is_field,
- std::chrono::milliseconds::zero(), false,
- nullptr,
- _is_provided, true);
-}
-
-void routing_manager_impl::unregister_shadow_event(client_t _client,
- service_t _service, instance_t _instance,
- event_t _event, bool _is_provided) {
- routing_manager_base::unregister_event(_client, _service, _instance,
- _event, _is_provided);
-}
-
-void routing_manager_impl::notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload, client_t _client,
- bool _force, bool _flush) {
- if (find_local(_client)) {
- routing_manager_base::notify_one(_service, _instance, _event, _payload,
- _client, _force, _flush);
- } else {
- std::shared_ptr<event> its_event = find_event(_service, _instance, _event);
- if (its_event) {
- // Event is valid for service/instance
- bool found_eventgroup(false);
- // Iterate over all groups of the event to ensure at least
- // one valid eventgroup for service/instance exists.
- for (auto its_group : its_event->get_eventgroups()) {
- auto its_eventgroup = find_eventgroup(_service, _instance, its_group);
- if (its_eventgroup) {
- // Eventgroup is valid for service/instance
- found_eventgroup = true;
- break;
- }
- }
- if (found_eventgroup) {
- std::set<std::shared_ptr<endpoint_definition>> its_targets;
- // Now set event's payload!
- // Either with endpoint_definition (remote) or with client (local).
- {
- std::lock_guard<std::mutex> its_lock(remote_subscribers_mutex_);
- auto its_service = remote_subscribers_.find(_service);
- if (its_service != remote_subscribers_.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- auto its_subscriber = its_instance->second.find(_client);
- if (its_subscriber != its_instance->second.end()) {
- its_targets = its_subscriber->second;
- }
- }
- }
- }
- for (const auto &its_target : its_targets) {
- its_event->set_payload(_payload, its_target, _force, _flush);
- }
- }
- } else {
- VSOMEIP_WARNING << "Attempt to update the undefined event/field ["
- << std::hex << _service << "." << _instance << "." << _event
- << "]";
- }
- }
-}
-
-void routing_manager_impl::on_availability(service_t _service, instance_t _instance,
- bool _is_available, major_version_t _major, minor_version_t _minor) {
- host_->on_availability(_service, _instance, _is_available, _major, _minor);
-}
-
-void routing_manager_impl::on_error(
- const byte_t *_data, length_t _length, endpoint *_receiver,
- const boost::asio::ip::address &_remote_address,
- 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]);
- its_instance = find_instance(its_service, _receiver);
- }
- send_error(return_code_e::E_MALFORMED_MESSAGE, _data, _length, its_instance,
- _receiver->is_reliable(), _receiver, _remote_address, _remote_port);
-}
-
-void routing_manager_impl::release_port(uint16_t _port, bool _reliable) {
- std::lock_guard<std::mutex> its_lock(used_client_ports_mutex_);
- used_client_ports_[_reliable].erase(_port);
-}
-
-void routing_manager_impl::on_message(const byte_t *_data, length_t _size,
- endpoint *_receiver, const boost::asio::ip::address &_destination,
- client_t _bound_client,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port) {
-#if 0
- std::stringstream msg;
- msg << "rmi::on_message: ";
- 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
- (void)_bound_client;
- service_t its_service;
- method_t its_method;
- bool its_is_crc_valid(true);
- instance_t its_instance(0x0);
-#ifdef USE_DLT
- bool is_forwarded(true);
-#endif
- if (_size >= VSOMEIP_SOMEIP_HEADER_SIZE) {
- its_service = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_SERVICE_POS_MIN],
- _data[VSOMEIP_SERVICE_POS_MAX]);
- if (its_service == VSOMEIP_SD_SERVICE) {
- its_method = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN],
- _data[VSOMEIP_METHOD_POS_MAX]);
- if (discovery_ && its_method == sd::method) {
- if (configuration_->get_sd_port() == _remote_port) {
- if (!_remote_address.is_unspecified()) {
- discovery_->on_message(_data, _size, _remote_address, _destination);
- } else {
- VSOMEIP_ERROR << "Ignored SD message from unknown address.";
- }
- } else {
- VSOMEIP_ERROR << "Ignored SD message from unknown port ("
- << _remote_port << ")";
- }
- }
- } else {
- its_instance = 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]);
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Received message on invalid port: ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_session << "] from: "
- << _remote_address.to_string(ec) << ":" << std::dec << _remote_port;
- }
- //Ignore messages with invalid message type
- if(_size >= VSOMEIP_MESSAGE_TYPE_POS) {
- if(!utility::is_valid_message_type(static_cast<message_type_e>(_data[VSOMEIP_MESSAGE_TYPE_POS]))) {
- VSOMEIP_ERROR << "Ignored SomeIP message with invalid message type.";
- return;
- }
- }
- return_code_e return_code = check_error(_data, _size, its_instance);
- if(!(_size >= VSOMEIP_MESSAGE_TYPE_POS && utility::is_request_no_return(_data[VSOMEIP_MESSAGE_TYPE_POS]))) {
- if (return_code != return_code_e::E_OK && return_code != return_code_e::E_NOT_OK) {
- send_error(return_code, _data, _size, its_instance,
- _receiver->is_reliable(), _receiver,
- _remote_address, _remote_port);
- return;
- }
- } else if(return_code != return_code_e::E_OK && return_code != return_code_e::E_NOT_OK) {
- //Ignore request no response message if an error occured
- return;
- }
-
- // 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]);
- 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
- << " which isn't offered remote ~> Skip message!";
- return;
- }
- if (find_local(requester)) {
- VSOMEIP_WARNING << std::hex << "Security: Received a remote request "
- << "from client identifier 0x" << requester
- << " which is already used locally ~> Skip message!";
- return;
- }
- if (!configuration_->is_client_allowed(requester, its_service, its_instance)) {
- VSOMEIP_WARNING << std::hex << "Security: Received a remote request "
- << "from client 0x" << requester << " for service/instance "
- << its_service << "/" << its_instance
- << " which violates the security policy ~> Skip message!";
- return;
- }
- }
- }
- if( configuration_->is_e2e_enabled()) {
- its_method = VSOMEIP_BYTES_TO_WORD(
- _data[VSOMEIP_METHOD_POS_MIN],
- _data[VSOMEIP_METHOD_POS_MAX]);
- if( custom_checkers.count({its_service, its_method})) {
- e2e_buffer inputBuffer(_data + VSOMEIP_PAYLOAD_POS, _data + _size);
- e2e::profile_interface::generic_check_status check_status;
- custom_checkers[{its_service, its_method}]->check( inputBuffer, check_status);
-
- if ( check_status != e2e::profile_interface::generic_check_status::E2E_OK ) {
- VSOMEIP_INFO << std::hex << "E2E protection: CRC check failed for service: " << its_service << " method: " << its_method;
- its_is_crc_valid = false;
- }
- }
- }
- if (!deliver_specific_endpoint_message(
- its_service, its_instance, _data, _size, _receiver)) {
- // set client ID to zero for all messages
- if( utility::is_notification(_data[VSOMEIP_MESSAGE_TYPE_POS])) {
- byte_t *its_data = const_cast<byte_t *>(_data);
- its_data[VSOMEIP_CLIENT_POS_MIN] = 0x0;
- its_data[VSOMEIP_CLIENT_POS_MAX] = 0x0;
- }
- // Common way of message handling
-#ifdef USE_DLT
- is_forwarded =
-#endif
- on_message(its_service, its_instance, _data, _size, _receiver->is_reliable(), its_is_crc_valid);
-
- }
- }
- }
-#ifdef USE_DLT
- if (is_forwarded) {
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- const boost::asio::ip::address_v4 its_remote_address =
- _remote_address.is_v4() ? _remote_address.to_v4() :
- boost::asio::ip::address_v4::from_string("6.6.6.6");
- tc::protocol_e its_protocol =
- _receiver->is_local() ? tc::protocol_e::local :
- _receiver->is_reliable() ? tc::protocol_e::tcp :
- tc::protocol_e::udp;
- its_header.prepare(its_remote_address, _remote_port, its_protocol, false,
- its_instance);
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE, _data,
- its_data_size);
- }
-#endif
-}
-
-bool routing_manager_impl::on_message(
- service_t _service, instance_t _instance,
- const byte_t *_data, length_t _size,
- bool _reliable, bool _is_valid_crc) {
-#if 0
- std::stringstream msg;
- msg << "rmi::on_message("
- << std::hex << std::setw(4) << std::setfill('0')
- << _service << ", " << _instance << "): ";
- 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
- client_t its_client;
- bool is_forwarded(true);
-
- 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]);
- }
-
- if (its_client == VSOMEIP_ROUTING_CLIENT
- && utility::is_notification(_data[VSOMEIP_MESSAGE_TYPE_POS])) {
- is_forwarded = deliver_notification(_service, _instance, _data, _size, _reliable, _is_valid_crc);
- } else if (its_client == host_->get_client()) {
- deliver_message(_data, _size, _instance, _reliable, _is_valid_crc);
- } else {
- send(its_client, _data, _size, _instance, true, _reliable, _is_valid_crc); //send to proxy
- }
- return is_forwarded;
-}
-
-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]);
-
- std::shared_ptr<event> its_event = find_event(_service, _instance, its_event_id);
- if (its_event) {
- uint32_t its_length = utility::get_payload_size(_data, _size);
- std::shared_ptr<payload> its_payload =
- runtime::get()->create_payload(
- &_data[VSOMEIP_PAYLOAD_POS],
- its_length);
-
- if (_notify_one) {
- notify_one(_service, _instance, its_event->get_event(), its_payload, _client, true, true);
- } else {
- if (its_event->is_field()) {
- if (its_event->is_set()) {
- its_event->set_payload(its_payload, false, true);
- } else {
- // new subscribers will be notified by SD via sent_initiale_events;
- if (its_event->get_remote_notification_pending()) {
- // Set payload first time ~> notify all remote subscriber per unicast (initial field)
- std::vector<std::unique_lock<std::mutex>> its_locks;
- std::vector<std::shared_ptr<eventgroupinfo>> its_eventgroupinfos;
- for (auto its_group : its_event->get_eventgroups()) {
- auto its_eventgroup = find_eventgroup(_service, _instance, its_group);
- if (its_eventgroup) {
- its_locks.push_back(its_eventgroup->get_subscription_lock());
- its_eventgroupinfos.push_back(its_eventgroup);
- }
- }
-
- bool is_offered_both(false);
- if (configuration_->get_reliable_port(_service, _instance) != ILLEGAL_PORT &&
- configuration_->get_unreliable_port(_service, _instance) != ILLEGAL_PORT) {
- is_offered_both = true;
- }
- for (const auto &its_eventgroup : its_eventgroupinfos) {
- //Unicast targets
- for (auto its_remote : its_eventgroup->get_targets()) {
- if (!is_offered_both) {
- its_event->set_payload(its_payload, its_remote.endpoint_, true, true);
- } else {
- bool was_set(false);
- if (its_event->is_reliable() && its_remote.endpoint_->is_reliable()) {
- its_event->set_payload(its_payload, its_remote.endpoint_, true, true);
- was_set = true;
- }
- if (!its_event->is_reliable() && !its_remote.endpoint_->is_reliable()) {
- its_event->set_payload(its_payload, its_remote.endpoint_, true, true);
- was_set = true;
- }
- if (!was_set) {
- its_event->set_payload_dont_notify(its_payload);
- }
- }
- }
- }
- its_event->set_remote_notification_pending(false);
- } else {
- its_event->set_payload_dont_notify(its_payload);
- }
- }
- } else {
- its_event->set_payload(its_payload, false, true);
- }
- }
- }
-}
-
-void routing_manager_impl::on_connect(std::shared_ptr<endpoint> _endpoint) {
- // Is called when endpoint->connect succeeded!
- struct service_info {
- service_t service_id_;
- instance_t instance_id_;
- major_version_t major_;
- minor_version_t minor_;
- bool reliable_;
- std::shared_ptr<endpoint> endpoint_;
- };
- std::forward_list<struct service_info> services_to_report_;
- {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- for (auto &its_service : remote_services_) {
- for (auto &its_instance : its_service.second) {
- for (auto &its_client : its_instance.second) {
- if (its_client.first == VSOMEIP_ROUTING_CLIENT ||
- its_client.first == get_client()) {
- auto found_endpoint = its_client.second.find(false);
- if (found_endpoint != its_client.second.end()) {
- if (found_endpoint->second.get() == _endpoint.get()) {
- std::shared_ptr<serviceinfo> its_info(find_service(its_service.first, its_instance.first));
- if (!its_info) {
- _endpoint->set_connected(true);
- return;
- }
- services_to_report_.push_front(
- { its_service.first,
- its_instance.first,
- its_info->get_major(),
- its_info->get_minor(),
- false, _endpoint });
- }
- }
- found_endpoint = its_client.second.find(true);
- if (found_endpoint != its_client.second.end()) {
- if (found_endpoint->second.get() == _endpoint.get()) {
- std::shared_ptr<serviceinfo> its_info(find_service(its_service.first, its_instance.first));
- if (!its_info) {
- _endpoint->set_connected(true);
- return;
- }
- services_to_report_.push_front(
- { its_service.first,
- its_instance.first,
- its_info->get_major(),
- its_info->get_minor(),
- true, _endpoint });
- }
- }
- }
- }
- }
- }
- }
- for (const auto &s : services_to_report_) {
- on_availability(s.service_id_, s.instance_id_, true, s.major_, s.minor_);
- if (s.reliable_) {
- stub_->on_offer_service(VSOMEIP_ROUTING_CLIENT, s.service_id_,
- s.instance_id_, s.major_, s.minor_);
- }
- std::shared_ptr<boost::asio::steady_timer> its_timer =
- std::make_shared<boost::asio::steady_timer>(io_);
- boost::system::error_code ec;
- its_timer->expires_from_now(std::chrono::milliseconds(3), ec);
- if (!ec) {
- its_timer->async_wait(
- std::bind(
- &routing_manager_impl::call_sd_endpoint_connected,
- std::static_pointer_cast<routing_manager_impl>(
- shared_from_this()),
- std::placeholders::_1, s.service_id_,
- s.instance_id_, s.endpoint_, its_timer));
- } else {
- VSOMEIP_ERROR<< "routing_manager_impl::on_connect: " << ec.message();
- }
- }
- if (services_to_report_.empty()) {
- _endpoint->set_connected(true);
- }
-}
-
-void routing_manager_impl::on_disconnect(std::shared_ptr<endpoint> _endpoint) {
- // Is called when endpoint->connect fails!
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- for (auto &its_service : remote_services_) {
- for (auto &its_instance : its_service.second) {
- for (auto &its_client : its_instance.second) {
- if (its_client.first == VSOMEIP_ROUTING_CLIENT ||
- its_client.first == get_client()) {
- auto found_endpoint = its_client.second.find(false);
- if (found_endpoint != its_client.second.end()) {
- if (found_endpoint->second.get() == _endpoint.get()) {
-
- std::shared_ptr<serviceinfo> its_info(find_service(its_service.first, its_instance.first));
- if(!its_info){
- return;
- }
- on_availability(its_service.first, its_instance.first,
- false, its_info->get_major(), its_info->get_minor());
- }
- }
- found_endpoint = its_client.second.find(true);
- if (found_endpoint != its_client.second.end()) {
- if (found_endpoint->second.get() == _endpoint.get()) {
-
- std::shared_ptr<serviceinfo> its_info(find_service(its_service.first, its_instance.first));
- if(!its_info){
- return;
- }
- on_availability(its_service.first, its_instance.first,
- false, its_info->get_major(), its_info->get_minor());
- }
- }
- }
- }
- }
- }
-}
-
-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) {
- {
- std::lock_guard<std::mutex> its_lock(local_services_mutex_);
- auto found_service = local_services_.find(_service);
- if (found_service != local_services_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- if ( std::get<0>(found_instance->second) != _major
- || std::get<1>(found_instance->second) != _minor
- || std::get<2>(found_instance->second) != _client) {
- VSOMEIP_WARNING
- << "routing_manager_impl::on_stop_offer_service: "
- << "trying to delete service not matching exactly "
- << "the one offered previously: " << "[" << std::hex
- << std::setw(4) << std::setfill('0') << _service
- << "." << _instance << "." << std::dec
- << static_cast<std::uint32_t>(_major)
- << "." << _minor << "] by application: "
- << std::hex << std::setw(4) << std::setfill('0')
- << _client << ". Stored: [" << std::hex
- << std::setw(4) << std::setfill('0') << _service
- << "." << _instance << "." << std::dec
- << static_cast<std::uint32_t>(std::get<0>(found_instance->second)) << "."
- << std::get<1>(found_instance->second)
- << "] by application: " << std::hex << std::setw(4)
- << std::setfill('0') << std::get<2>(found_instance->second);
- }
- if (std::get<2>(found_instance->second) == _client) {
- found_service->second.erase(_instance);
- if (found_service->second.size() == 0) {
- local_services_.erase(_service);
- }
- }
- }
- }
- }
-
- routing_manager_base::stop_offer_service(_client, _service, _instance,
- _major, _minor);
-
- /**
- * Hold reliable & unreliable server-endpoints from service info
- * because if "del_routing_info" is called those entries could be freed
- * and we can't be sure this happens synchronous when SD is active.
- * After triggering "del_routing_info" this endpoints gets cleanup up
- * within this method if they not longer used by any other local service.
- */
- std::shared_ptr<endpoint> its_reliable_endpoint;
- std::shared_ptr<endpoint> its_unreliable_endpoint;
- std::shared_ptr<serviceinfo> its_info(find_service(_service, _instance));
- if (its_info) {
- its_reliable_endpoint = its_info->get_endpoint(true);
- its_unreliable_endpoint = its_info->get_endpoint(false);
- }
-
- // Trigger "del_routing_info" either over SD or static
- if (discovery_) {
- if (its_info) {
- if (its_info->get_major() == _major && its_info->get_minor() == _minor) {
- its_info->set_ttl(0);
- discovery_->stop_offer_service(_service, _instance, its_info);
- }
- }
- } else {
- del_routing_info(_service, _instance,
- (its_reliable_endpoint != nullptr),
- (its_unreliable_endpoint != nullptr));
- }
-
- // Cleanup reliable & unreliable server endpoints hold before
- if (its_info) {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- std::shared_ptr<endpoint> its_empty_endpoint;
- bool reliable = true;
-
- // Loop over reliable/unreliable and cleanup if needed
- for (uint8_t i = 0; i < 2; ++i) {
- std::shared_ptr<endpoint> its_endpoint;
- if (reliable) {
- its_endpoint = its_reliable_endpoint;
- } else {
- its_endpoint = its_unreliable_endpoint;
- }
- if (!its_endpoint) {
- reliable = !reliable;
- continue;
- }
-
- // Check whether any service still uses this endpoint
- its_endpoint->decrement_use_count();
- bool isLastService = (its_endpoint->get_use_count() == 0);
-
- // Clear service_instances_
- if (1 >= service_instances_[_service].size()) {
- service_instances_.erase(_service);
- } else {
- service_instances_[_service].erase(its_endpoint.get());
- }
-
- // Clear server endpoint if no service remains using it
- if (isLastService) {
- uint16_t port = its_endpoint->get_local_port();
- if (server_endpoints_.find(port) != server_endpoints_.end()) {
- server_endpoints_[port].erase(reliable);
- if (server_endpoints_[port].find(!reliable) == server_endpoints_[port].end()) {
- server_endpoints_.erase(port);
- }
- }
-
- // Stop endpoint (close socket) to release its async_handlers!
- its_endpoint->stop();
- }
-
- // Clear service info and service group
- clear_service_info(_service, _instance, reliable);
-
- // Invert reliable flag and loop again
- reliable = !reliable;
- }
- }
-}
-
-bool routing_manager_impl::deliver_message(const byte_t *_data, length_t _size,
- instance_t _instance, bool _reliable, bool _is_valid_crc) {
- bool is_delivered(false);
-
- auto a_deserializer = get_deserializer();
- a_deserializer->set_data(_data, _size);
- std::shared_ptr<message> its_message(a_deserializer->deserialize_message());
- a_deserializer->reset();
- put_deserializer(a_deserializer);
-
- if (its_message) {
- its_message->set_instance(_instance);
- its_message->set_reliable(_reliable);
- its_message->set_is_valid_crc(_is_valid_crc);
- host_->on_message(std::move(its_message));
- is_delivered = true;
- } else {
- VSOMEIP_ERROR << "Routing manager: deliver_message: "
- << "SomeIP-Header deserialization failed!";
- }
- return is_delivered;
-}
-
-bool routing_manager_impl::deliver_notification(
- service_t _service, instance_t _instance,
- const byte_t *_data, length_t _length,
- bool _reliable, bool _is_valid_crc) {
- method_t its_method = VSOMEIP_BYTES_TO_WORD(_data[VSOMEIP_METHOD_POS_MIN],
- _data[VSOMEIP_METHOD_POS_MAX]);
-
- std::shared_ptr<event> its_event = find_event(_service, _instance, its_method);
- if (its_event) {
- if (!its_event->is_provided()) {
- const uint32_t its_length(utility::get_payload_size(_data, _length));
- std::shared_ptr<payload> its_payload
- = runtime::get()->create_payload(&_data[VSOMEIP_PAYLOAD_POS],
- its_length);
- if (!its_event->set_payload_dont_notify(its_payload)) {
- // do not forward the notification as it was filtered
- return false;
- }
- }
-
- for (const auto its_local_client : its_event->get_subscribers()) {
- if (its_local_client == host_->get_client()) {
- deliver_message(_data, _length, _instance, _reliable, _is_valid_crc);
- } else {
- std::shared_ptr<endpoint> its_local_target = find_local(its_local_client);
- if (its_local_target) {
- send_local(its_local_target, VSOMEIP_ROUTING_CLIENT,
- _data, _length, _instance, true, _reliable, VSOMEIP_SEND, _is_valid_crc);
- }
- }
- }
- }
-
- return true;
-}
-
-std::shared_ptr<eventgroupinfo> routing_manager_impl::find_eventgroup(
- service_t _service, instance_t _instance,
- eventgroup_t _eventgroup) const {
- return routing_manager_base::find_eventgroup(_service, _instance, _eventgroup);
-}
-
-const std::shared_ptr<configuration> routing_manager_impl::get_configuration() const {
- return (host_->get_configuration());
-}
-
-std::shared_ptr<endpoint> routing_manager_impl::create_service_discovery_endpoint(
- const std::string &_address, uint16_t _port, bool _reliable) {
- std::shared_ptr<endpoint> its_service_endpoint = find_server_endpoint(_port,
- _reliable);
- if (!its_service_endpoint) {
- try {
- its_service_endpoint = create_server_endpoint(_port, _reliable,
- true);
-
- if (its_service_endpoint) {
- sd_info_ = std::make_shared<serviceinfo>(ANY_MAJOR, ANY_MINOR,
- DEFAULT_TTL, false); // false, because we do _not_ want to announce it...
- sd_info_->set_endpoint(its_service_endpoint, _reliable);
- its_service_endpoint->add_default_target(VSOMEIP_SD_SERVICE,
- _address, _port);
- its_service_endpoint->join(_address);
- } else {
- VSOMEIP_ERROR<< "Service Discovery endpoint could not be created. "
- "Please check your network configuration.";
- }
- } catch (const std::exception &e) {
- host_->on_error(error_code_e::SERVER_ENDPOINT_CREATION_FAILED);
- VSOMEIP_ERROR << "Service Discovery endpoint could not be created: "
- << e.what();
- }
- }
- return its_service_endpoint;
-}
-
-services_t routing_manager_impl::get_offered_services() const {
- services_t its_services;
- for (auto s : get_services()) {
- for (auto i : s.second) {
- if (i.second->is_local()) {
- its_services[s.first][i.first] = i.second;
- }
- }
- }
- return its_services;
-}
-
-std::shared_ptr<serviceinfo> routing_manager_impl::get_offered_service(
- service_t _service, instance_t _instance) const {
- std::shared_ptr<serviceinfo> its_info;
- its_info = find_service(_service, _instance);
- if (its_info && !its_info->is_local()) {
- its_info.reset();
- }
- return its_info;
-}
-
-std::map<instance_t, std::shared_ptr<serviceinfo>>
-routing_manager_impl::get_offered_service_instances(service_t _service) const {
- std::map<instance_t, std::shared_ptr<serviceinfo>> its_instances;
- const services_t its_services(get_services());
- const auto found_service = its_services.find(_service);
- if (found_service != its_services.end()) {
- for (const auto i : found_service->second) {
- if (i.second->is_local()) {
- its_instances[i.first] = i.second;
- }
- }
- }
- return its_instances;
-}
-
-std::shared_ptr<endpoint> routing_manager_impl::find_or_create_remote_client(
- service_t _service, instance_t _instance, bool _reliable, client_t _client) {
- std::shared_ptr<endpoint> its_endpoint;
- bool start_endpoint(false);
- {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- its_endpoint = find_remote_client(_service, _instance, _reliable, _client);
- if (!its_endpoint) {
- its_endpoint = create_remote_client(_service, _instance, _reliable, _client);
- start_endpoint = true;
- }
- }
- if (start_endpoint && its_endpoint
- && configuration_->is_someip(_service, _instance)) {
- its_endpoint->start();
- }
- return its_endpoint;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// PRIVATE
-///////////////////////////////////////////////////////////////////////////////
-void routing_manager_impl::init_service_info(
- service_t _service, instance_t _instance, bool _is_local_service) {
- std::shared_ptr<serviceinfo> its_info = find_service(_service, _instance);
- if (!its_info) {
- VSOMEIP_ERROR << "routing_manager_impl::init_service_info: couldn't "
- "find serviceinfo for service: ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "]"
- << " is_local_service=" << _is_local_service;
- return;
- }
- if (configuration_) {
- std::shared_ptr<endpoint> its_reliable_endpoint;
- std::shared_ptr<endpoint> its_unreliable_endpoint;
-
- uint16_t its_reliable_port = configuration_->get_reliable_port(_service,
- _instance);
- uint16_t its_unreliable_port = configuration_->get_unreliable_port(
- _service, _instance);
-
- bool is_someip = configuration_->is_someip(_service, _instance);
-
- // Create server endpoints for local services only
- if (_is_local_service) {
- if (ILLEGAL_PORT != its_reliable_port) {
- its_reliable_endpoint = find_or_create_server_endpoint(
- its_reliable_port, true, is_someip);
- if (its_reliable_endpoint) {
- its_info->set_endpoint(its_reliable_endpoint, true);
- its_reliable_endpoint->increment_use_count();
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- service_instances_[_service][its_reliable_endpoint.get()] =
- _instance;
- }
- }
-
- if (ILLEGAL_PORT != its_unreliable_port) {
- its_unreliable_endpoint = find_or_create_server_endpoint(
- its_unreliable_port, false, is_someip);
- if (its_unreliable_endpoint) {
- its_info->set_endpoint(its_unreliable_endpoint, false);
- its_unreliable_endpoint->increment_use_count();
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- service_instances_[_service][its_unreliable_endpoint.get()] =
- _instance;
- }
- }
-
- if (ILLEGAL_PORT == its_reliable_port
- && ILLEGAL_PORT == its_unreliable_port) {
- VSOMEIP_INFO << "Port configuration missing for ["
- << std::hex << _service << "." << _instance
- << "]. Service is internal.";
- }
- }
- } else {
- host_->on_error(error_code_e::CONFIGURATION_MISSING);
- }
-}
-
-std::shared_ptr<endpoint> routing_manager_impl::create_client_endpoint(
- const boost::asio::ip::address &_address,
- uint16_t _local_port, uint16_t _remote_port,
- bool _reliable, client_t _client) {
- (void)_client;
-
- std::shared_ptr<endpoint> its_endpoint;
- try {
- if (_reliable) {
- its_endpoint = std::make_shared<tcp_client_endpoint_impl>(
- shared_from_this(),
- boost::asio::ip::tcp::endpoint(
- (_address.is_v4() ?
- boost::asio::ip::tcp::v4() :
- boost::asio::ip::tcp::v6()),
- _local_port),
- boost::asio::ip::tcp::endpoint(_address, _remote_port),
- io_,
- configuration_->get_max_message_size_reliable(
- _address.to_string(), _remote_port),
- configuration_->get_buffer_shrink_threshold(),
- std::chrono::milliseconds(configuration_->get_sd_ttl() * 666),
- configuration_->get_endpoint_queue_limit(
- _address.to_string(), _remote_port));
-
- if (configuration_->has_enabled_magic_cookies(_address.to_string(),
- _remote_port)) {
- its_endpoint->enable_magic_cookies();
- }
- } else {
- its_endpoint = std::make_shared<udp_client_endpoint_impl>(
- shared_from_this(),
- boost::asio::ip::udp::endpoint(
- (_address.is_v4() ?
- boost::asio::ip::udp::v4() :
- boost::asio::ip::udp::v6()),
- _local_port),
- boost::asio::ip::udp::endpoint(_address, _remote_port),
- io_, configuration_->get_endpoint_queue_limit(
- _address.to_string(), _remote_port));
- }
- } catch (...) {
- host_->on_error(error_code_e::CLIENT_ENDPOINT_CREATION_FAILED);
- }
-
- return (its_endpoint);
-}
-
-std::shared_ptr<endpoint> routing_manager_impl::create_server_endpoint(
- uint16_t _port, bool _reliable, bool _start) {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- std::shared_ptr<endpoint> its_endpoint;
- try {
- boost::asio::ip::address its_unicast = configuration_->get_unicast_address();
- if (_start) {
- if (_reliable) {
- its_endpoint = std::make_shared<tcp_server_endpoint_impl>(
- shared_from_this(),
- boost::asio::ip::tcp::endpoint(its_unicast, _port), io_,
- configuration_->get_max_message_size_reliable(
- its_unicast.to_string(), _port),
- configuration_->get_buffer_shrink_threshold(),
- std::chrono::milliseconds(configuration_->get_sd_ttl() * 666),
- configuration_->get_endpoint_queue_limit(
- its_unicast.to_string(), _port));
- if (configuration_->has_enabled_magic_cookies(
- its_unicast.to_string(), _port) ||
- configuration_->has_enabled_magic_cookies(
- "local", _port)) {
- its_endpoint->enable_magic_cookies();
- }
- } else {
- configuration::endpoint_queue_limit_t its_limit =
- configuration_->get_endpoint_queue_limit(
- its_unicast.to_string(), _port);
-#ifndef _WIN32
- if (its_unicast.is_v4()) {
- its_unicast = boost::asio::ip::address_v4::any();
- } else if (its_unicast.is_v6()) {
- its_unicast = boost::asio::ip::address_v6::any();
- }
-#endif
- boost::asio::ip::udp::endpoint ep(its_unicast, _port);
- its_endpoint = std::make_shared<udp_server_endpoint_impl>(
- shared_from_this(), ep, io_, its_limit);
- }
-
- } else {
- its_endpoint = std::make_shared<virtual_server_endpoint_impl>(
- its_unicast.to_string(), _port, _reliable);
- }
-
- if (its_endpoint) {
- server_endpoints_[_port][_reliable] = its_endpoint;
- its_endpoint->start();
- }
- } catch (const std::exception &e) {
- host_->on_error(error_code_e::SERVER_ENDPOINT_CREATION_FAILED);
- VSOMEIP_ERROR << e.what();
- }
-
- return (its_endpoint);
-}
-
-std::shared_ptr<endpoint> routing_manager_impl::find_server_endpoint(
- uint16_t _port, bool _reliable) const {
- std::shared_ptr<endpoint> its_endpoint;
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- auto found_port = server_endpoints_.find(_port);
- if (found_port != server_endpoints_.end()) {
- auto found_endpoint = found_port->second.find(_reliable);
- if (found_endpoint != found_port->second.end()) {
- its_endpoint = found_endpoint->second;
- }
- }
-
- return (its_endpoint);
-}
-
-std::shared_ptr<endpoint> routing_manager_impl::find_or_create_server_endpoint(
- uint16_t _port, bool _reliable, bool _start) {
- std::shared_ptr<endpoint> its_endpoint = find_server_endpoint(_port,
- _reliable);
- if (!its_endpoint) {
- its_endpoint = create_server_endpoint(_port, _reliable, _start);
- }
- return (its_endpoint);
-}
-
-void routing_manager_impl::remove_local(client_t _client) {
- auto clients_subscriptions = get_subscriptions(_client);
- {
- std::lock_guard<std::mutex> its_lock(remote_subscription_state_mutex_);
- for (const auto& s : clients_subscriptions) {
- remote_subscription_state_.erase(std::tuple_cat(s, std::make_tuple(_client)));
- }
- }
- routing_manager_base::remove_local(_client, clients_subscriptions);
-
- std::forward_list<std::pair<service_t, instance_t>> services_to_release_;
- {
- std::lock_guard<std::mutex> its_lock(requested_services_mutex_);
- auto its_client = requested_services_.find(_client);
- if (its_client != requested_services_.end()) {
- for (auto its_service : its_client->second) {
- for (auto its_instance : its_service.second) {
- services_to_release_.push_front(
- { its_service.first, its_instance.first });
- }
- }
- }
- }
- for (const auto &s : services_to_release_) {
- release_service(_client, s.first, s.second);
- }
-}
-
-instance_t routing_manager_impl::find_instance(service_t _service,
- endpoint * _endpoint) {
- instance_t its_instance(0xFFFF);
- {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- auto found_service = service_instances_.find(_service);
- if (found_service != service_instances_.end()) {
- auto found_endpoint = found_service->second.find(_endpoint);
- if (found_endpoint != found_service->second.end()) {
- its_instance = found_endpoint->second;
- }
- }
- }
- return (its_instance);
-}
-
-std::shared_ptr<endpoint> routing_manager_impl::create_remote_client(
- service_t _service, instance_t _instance, bool _reliable, client_t _client) {
- std::shared_ptr<endpoint> its_endpoint;
- std::shared_ptr<endpoint_definition> its_endpoint_def;
- uint16_t its_local_port;
- uint16_t its_remote_port = ILLEGAL_PORT;
-
- auto found_service = remote_service_info_.find(_service);
- if (found_service != remote_service_info_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_reliability = found_instance->second.find(_reliable);
- if (found_reliability != found_instance->second.end()) {
- its_endpoint_def = found_reliability->second;
- its_remote_port = its_endpoint_def->get_port();
- }
- }
- }
-
- if( its_remote_port != ILLEGAL_PORT) {
- // if client port range for remote service port range is configured
- // and remote port is in range, determine unused client port
- if (configuration_->get_client_port(_service, _instance, its_remote_port, _reliable,
- used_client_ports_, its_local_port)) {
- if(its_endpoint_def) {
- its_endpoint = create_client_endpoint(
- its_endpoint_def->get_address(),
- its_local_port,
- its_endpoint_def->get_port(),
- _reliable, _client
- );
- }
-
- if (its_endpoint) {
- {
- std::lock_guard<std::mutex> its_lock(used_client_ports_mutex_);
- used_client_ports_[_reliable].insert(its_local_port);
- }
- service_instances_[_service][its_endpoint.get()] = _instance;
- remote_services_[_service][_instance][_client][_reliable] = its_endpoint;
- if (_client == VSOMEIP_ROUTING_CLIENT) {
- client_endpoints_by_ip_[its_endpoint_def->get_address()]
- [its_endpoint_def->get_port()]
- [_reliable] = its_endpoint;
- // Set the basic route to the service in the service info
- auto found_service_info = find_service(_service, _instance);
- if (found_service_info) {
- found_service_info->set_endpoint(its_endpoint, _reliable);
- }
- }
- }
- }
- }
- return its_endpoint;
-}
-
-
-std::shared_ptr<endpoint> routing_manager_impl::find_remote_client(
- service_t _service, instance_t _instance, bool _reliable, client_t _client) {
- std::shared_ptr<endpoint> its_endpoint;
- auto found_service = remote_services_.find(_service);
- if (found_service != remote_services_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_client = found_instance->second.find(_client);
- if (found_client != found_instance->second.end()) {
- auto found_reliability = found_client->second.find(_reliable);
- if (found_reliability != found_client->second.end()) {
- its_endpoint = found_reliability->second;
- }
- }
- }
- }
- if (its_endpoint || _client != VSOMEIP_ROUTING_CLIENT) {
- return its_endpoint;
- }
-
- // If another service is hosted on the same server_endpoint
- // reuse the existing client_endpoint.
- auto found_service_info = remote_service_info_.find(_service);
- if(found_service_info != remote_service_info_.end()) {
- auto found_instance = found_service_info->second.find(_instance);
- if(found_instance != found_service_info->second.end()) {
- auto found_reliable = found_instance->second.find(_reliable);
- if(found_reliable != found_instance->second.end()) {
- std::shared_ptr<endpoint_definition> its_ep_def =
- found_reliable->second;
- auto found_address = client_endpoints_by_ip_.find(
- its_ep_def->get_address());
- if(found_address != client_endpoints_by_ip_.end()) {
- auto found_port = found_address->second.find(
- its_ep_def->get_remote_port());
- if(found_port != found_address->second.end()) {
- auto found_reliable2 = found_port->second.find(
- _reliable);
- if(found_reliable2 != found_port->second.end()) {
- its_endpoint = found_reliable2->second;
- // store the endpoint under this service/instance id
- // as well - needed for later cleanup
- remote_services_[_service][_instance][_client][_reliable] =
- its_endpoint;
- service_instances_[_service][its_endpoint.get()] = _instance;
- }
- }
- }
- }
- }
- }
- return its_endpoint;
-}
-
-client_t routing_manager_impl::find_client(
- service_t _service, instance_t _instance,
- const std::shared_ptr<eventgroupinfo> &_eventgroup,
- const std::shared_ptr<endpoint_definition> &_target) const {
- client_t its_client = VSOMEIP_ROUTING_CLIENT;
- if (!_eventgroup->is_multicast()) {
- if (!_target->is_reliable()) {
- uint16_t unreliable_port = configuration_->get_unreliable_port(_service, _instance);
- auto endpoint = find_server_endpoint(unreliable_port, false);
- if (endpoint) {
- its_client = std::dynamic_pointer_cast<udp_server_endpoint_impl>(endpoint)->
- get_client(_target);
- }
- } else {
- uint16_t reliable_port = configuration_->get_reliable_port(_service, _instance);
- auto endpoint = find_server_endpoint(reliable_port, true);
- if (endpoint) {
- its_client = std::dynamic_pointer_cast<tcp_server_endpoint_impl>(endpoint)->
- get_client(_target);
- }
- }
- }
- return its_client;
-}
-
-bool routing_manager_impl::is_field(service_t _service, instance_t _instance,
- event_t _event) const {
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- auto find_service = events_.find(_service);
- if (find_service != events_.end()) {
- auto find_instance = find_service->second.find(_instance);
- if (find_instance != find_service->second.end()) {
- auto find_event = find_instance->second.find(_event);
- if (find_event != find_instance->second.end())
- return find_event->second->is_field();
- }
- }
- return false;
-}
-
-void routing_manager_impl::add_routing_info(
- service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor, ttl_t _ttl,
- const boost::asio::ip::address &_reliable_address,
- uint16_t _reliable_port,
- const boost::asio::ip::address &_unreliable_address,
- uint16_t _unreliable_port) {
-
- // Create/Update service info
- std::shared_ptr<serviceinfo> its_info(find_service(_service, _instance));
- if (!its_info) {
- boost::asio::ip::address its_unicast_address
- = configuration_->get_unicast_address();
- bool is_local(false);
- if (_reliable_port != ILLEGAL_PORT
- && its_unicast_address == _reliable_address)
- is_local = true;
- else if (_unreliable_port != ILLEGAL_PORT
- && its_unicast_address == _unreliable_address)
- is_local = true;
-
- its_info = create_service_info(_service, _instance, _major, _minor, _ttl, is_local);
- init_service_info(_service, _instance, is_local);
- } else if (its_info->is_local()) {
- // We received a service info for a service which is already offered locally
- VSOMEIP_ERROR << "routing_manager_impl::add_routing_info: "
- << "rejecting routing info. Remote: "
- << ((_reliable_port != ILLEGAL_PORT) ? _reliable_address.to_string()
- : _unreliable_address.to_string()) << " is trying to offer ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(_major) << "."
- << std::dec << _minor
- << "] on port " << ((_reliable_port != ILLEGAL_PORT) ? _reliable_port
- : _unreliable_port) << " offered previously on this node: ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(its_info->get_major())
- << "." << its_info->get_minor() << "]";
- return;
- } else {
- its_info->set_ttl(_ttl);
- }
-
- // Check whether remote services are unchanged
- bool is_reliable_known(false);
- bool is_unreliable_known(false);
-
- {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- auto found_service = remote_service_info_.find(_service);
- if (found_service != remote_service_info_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- std::shared_ptr<endpoint_definition> its_definition;
- if (_reliable_port != ILLEGAL_PORT) {
- auto found_reliable = found_instance->second.find(true);
- if (found_reliable != found_instance->second.end()) {
- its_definition = found_reliable->second;
- if (its_definition->get_address() == _reliable_address
- && its_definition->get_port() == _reliable_port) {
- is_reliable_known = true;
- } else {
- VSOMEIP_WARNING << "Reliable service endpoint has changed: ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(_major) << "."
- << std::dec << _minor << "] old: "
- << its_definition->get_address().to_string() << ":"
- << its_definition->get_port() << " new: "
- << _reliable_address.to_string() << ":"
- << _reliable_port;
- }
- }
- }
- if (_unreliable_port != ILLEGAL_PORT) {
- auto found_unreliable = found_instance->second.find(false);
- if (found_unreliable != found_instance->second.end()) {
- its_definition = found_unreliable->second;
- if (its_definition->get_address() == _unreliable_address
- && its_definition->get_port() == _unreliable_port) {
- is_unreliable_known = true;
- } else {
- VSOMEIP_WARNING << "Unreliable service endpoint has changed: ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(_major) << "."
- << std::dec << _minor << "] old: "
- << its_definition->get_address().to_string() << ":"
- << its_definition->get_port() << " new: "
- << _unreliable_address.to_string() << ":"
- << _unreliable_port;
- }
- }
- }
- }
- }
- }
-
- bool udp_inserted(false);
-
- // Add endpoint(s) if necessary
- if (_reliable_port != ILLEGAL_PORT && !is_reliable_known) {
- std::shared_ptr<endpoint_definition> endpoint_def_tcp
- = endpoint_definition::get(_reliable_address, _reliable_port, true, _service, _instance);
- if (_unreliable_port != ILLEGAL_PORT && !is_unreliable_known) {
- std::shared_ptr<endpoint_definition> endpoint_def_udp
- = endpoint_definition::get(_unreliable_address, _unreliable_port, false, _service, _instance);
- {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- remote_service_info_[_service][_instance][false] = endpoint_def_udp;
- remote_service_info_[_service][_instance][true] = endpoint_def_tcp;
- }
- udp_inserted = true;
- } else {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- remote_service_info_[_service][_instance][true] = endpoint_def_tcp;
- }
-
- // check if service was requested and establish TCP connection if necessary
- {
- bool connected(false);
- std::lock_guard<std::mutex> its_lock(requested_services_mutex_);
- for(const auto &client_id : requested_services_) {
- auto found_service = client_id.second.find(_service);
- if (found_service != client_id.second.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- for (const auto &major_minor_pair : found_instance->second) {
- if ((major_minor_pair.first == _major
- || _major == DEFAULT_MAJOR
- || major_minor_pair.first == ANY_MAJOR)
- && (major_minor_pair.second <= _minor
- || _minor == DEFAULT_MINOR
- || major_minor_pair.second == ANY_MINOR)) {
- // SWS_SD_00376 establish TCP connection to service
- // service is marked as available later in on_connect()
- if(!connected) {
- find_or_create_remote_client(_service, _instance,
- true, VSOMEIP_ROUTING_CLIENT);
- connected = true;
- }
- its_info->add_client(client_id.first);
- break;
- }
- }
- }
- }
- }
- }
- auto specific_endpoint_clients = get_specific_endpoint_clients(_service, _instance);
- for (const client_t& c : specific_endpoint_clients) {
- find_or_create_remote_client(_service, _instance, true, c);
- }
- } else if (_reliable_port != ILLEGAL_PORT && is_reliable_known) {
- std::lock_guard<std::mutex> its_lock(requested_services_mutex_);
- for(const auto &client_id : requested_services_) {
- auto found_service = client_id.second.find(_service);
- if (found_service != client_id.second.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- for (const auto &major_minor_pair : found_instance->second) {
- if ((major_minor_pair.first == _major
- || _major == DEFAULT_MAJOR
- || major_minor_pair.first == ANY_MAJOR)
- && (major_minor_pair.second <= _minor
- || _minor == DEFAULT_MINOR
- || major_minor_pair.second == ANY_MINOR)) {
- on_availability(_service, _instance,
- true, its_info->get_major(), its_info->get_minor());
- if (!stub_->contained_in_routing_info(
- VSOMEIP_ROUTING_CLIENT, _service, _instance,
- its_info->get_major(),
- its_info->get_minor())) {
- stub_->on_offer_service(VSOMEIP_ROUTING_CLIENT,
- _service, _instance,
- its_info->get_major(),
- its_info->get_minor());
- if (discovery_) {
- discovery_->on_endpoint_connected(
- _service, _instance,
- its_info->get_endpoint(true));
- }
- }
- break;
- }
- }
- }
- }
- }
- }
-
- if (_unreliable_port != ILLEGAL_PORT && !is_unreliable_known) {
- if (!udp_inserted) {
- std::shared_ptr<endpoint_definition> endpoint_def
- = endpoint_definition::get(_unreliable_address, _unreliable_port, false, _service, _instance);
- {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- remote_service_info_[_service][_instance][false] = endpoint_def;
- }
- // check if service was requested and increase requester count if necessary
- {
- std::lock_guard<std::mutex> its_lock(requested_services_mutex_);
- for (const auto &client_id : requested_services_) {
- const auto found_service = client_id.second.find(_service);
- if (found_service != client_id.second.end()) {
- const auto found_instance = found_service->second.find(
- _instance);
- if (found_instance != found_service->second.end()) {
- for (const auto &major_minor_pair : found_instance->second) {
- if ((major_minor_pair.first == _major
- || _major == DEFAULT_MAJOR
- || major_minor_pair.first == ANY_MAJOR)
- && (major_minor_pair.second <= _minor
- || _minor == DEFAULT_MINOR
- || major_minor_pair.second
- == ANY_MINOR)) {
- its_info->add_client(client_id.first);
- break;
- }
- }
- }
- }
- }
- }
- }
- if (!is_reliable_known) {
- on_availability(_service, _instance, true, _major, _minor);
- stub_->on_offer_service(VSOMEIP_ROUTING_CLIENT, _service, _instance, _major, _minor);
- }
- if (discovery_) {
- discovery_->on_endpoint_connected(
- _service, _instance,
- its_info->get_endpoint(false));
- }
- }
-}
-
-void routing_manager_impl::del_routing_info(service_t _service, instance_t _instance,
- bool _has_reliable, bool _has_unreliable) {
-
- std::shared_ptr<serviceinfo> its_info(find_service(_service, _instance));
- if(!its_info)
- return;
-
- on_availability(_service, _instance, false, its_info->get_major(), its_info->get_minor());
- stub_->on_stop_offer_service(VSOMEIP_ROUTING_CLIENT, _service, _instance, its_info->get_major(), its_info->get_minor());
- // Implicit unsubscribe
- {
- std::lock_guard<std::mutex> 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 (auto &its_eventgroup : found_instance->second) {
- its_eventgroup.second->clear_targets();
- its_eventgroup.second->clear_pending_subscriptions();
- }
- }
- }
- }
-
- clear_identified_clients( _service, _instance);
- clear_identifying_clients( _service, _instance);
-
- {
- std::lock_guard<std::mutex> its_lock(remote_subscribers_mutex_);
- auto found_service = remote_subscribers_.find(_service);
- if (found_service != remote_subscribers_.end()) {
- if (found_service->second.erase(_instance) > 0 &&
- !found_service->second.size()) {
- remote_subscribers_.erase(found_service);
- }
- }
- }
-
- if (_has_reliable) {
- clear_client_endpoints(_service, _instance, true);
- clear_remote_service_info(_service, _instance, true);
- }
- if (_has_unreliable) {
- clear_client_endpoints(_service, _instance, false);
- clear_remote_service_info(_service, _instance, false);
- }
-
- clear_multicast_endpoints(_service, _instance);
-
- if (_has_reliable)
- clear_service_info(_service, _instance, true);
- if (_has_unreliable)
- clear_service_info(_service, _instance, false);
-
- // For expired services using only unreliable endpoints that have never been created before
- if (!_has_reliable && !_has_unreliable) {
- clear_remote_service_info(_service, _instance, true);
- clear_remote_service_info(_service, _instance, false);
- clear_service_info(_service, _instance, true);
- clear_service_info(_service, _instance, false);
- }
-}
-
-void routing_manager_impl::update_routing_info(std::chrono::milliseconds _elapsed) {
- std::map<service_t, std::vector<instance_t> > its_expired_offers;
-
- {
- std::lock_guard<std::mutex> its_lock(services_remote_mutex_);
- for (const auto &s : services_remote_) {
- for (const auto &i : s.second) {
- ttl_t its_ttl = i.second->get_ttl();
- if (its_ttl < DEFAULT_TTL) { // do not touch "forever"
- std::chrono::milliseconds precise_ttl = i.second->get_precise_ttl();
- if (precise_ttl.count() < _elapsed.count() || precise_ttl.count() == 0) {
- i.second->set_ttl(0);
- its_expired_offers[s.first].push_back(i.first);
- } else {
- std::chrono::milliseconds its_new_ttl(precise_ttl - _elapsed);
- i.second->set_precise_ttl(its_new_ttl);
- }
- }
- }
- }
- }
-
- for (const auto &s : its_expired_offers) {
- for (const auto &i : s.second) {
- if (discovery_) {
- discovery_->unsubscribe_all(s.first, i);
- }
- del_routing_info(s.first, i, true, true);
- VSOMEIP_INFO << "update_routing_info: elapsed=" << _elapsed.count()
- << " : delete service/instance "
- << std::hex << std::setw(4) << std::setfill('0') << s.first
- << "." << std::hex << std::setw(4) << std::setfill('0') << i;
- }
- }
-}
-
-void routing_manager_impl::expire_services(const boost::asio::ip::address &_address) {
- std::map<service_t, std::vector<instance_t> > its_expired_offers;
-
- for (auto &s : get_services()) {
- for (auto &i : s.second) {
- if (find_local_client(s.first, i.first) != VSOMEIP_ROUTING_CLIENT) {
- continue; //don't expire local services
- }
- bool is_gone(false);
- boost::asio::ip::address its_address;
- std::shared_ptr<client_endpoint> its_client_endpoint =
- std::dynamic_pointer_cast<client_endpoint>(
- i.second->get_endpoint(true));
- if (its_client_endpoint) {
- if (its_client_endpoint->get_remote_address(its_address)) {
- is_gone = (its_address == _address);
- }
- } else {
- its_client_endpoint =
- std::dynamic_pointer_cast<client_endpoint>(
- i.second->get_endpoint(false));
- if (its_client_endpoint) {
- if (its_client_endpoint->get_remote_address(its_address)) {
- is_gone = (its_address == _address);
- }
- }
- }
-
- if (is_gone) {
- if (discovery_)
- discovery_->unsubscribe_all(s.first, i.first);
- its_expired_offers[s.first].push_back(i.first);
- }
- }
- }
-
- for (auto &s : its_expired_offers) {
- for (auto &i : s.second) {
- VSOMEIP_INFO << "expire_services for address: " << _address.to_string()
- << " : delete service/instance "
- << std::hex << std::setw(4) << std::setfill('0') << s.first
- << "." << std::hex << std::setw(4) << std::setfill('0') << i;
- del_routing_info(s.first, i, true, true);
- }
- }
-}
-
-void routing_manager_impl::expire_subscriptions(const boost::asio::ip::address &_address) {
- struct subscriptions_info {
- service_t service_id_;
- instance_t instance_id_;
- eventgroup_t eventgroup_id_;
- std::shared_ptr<endpoint_definition> invalid_endpoint_;
- client_t client_;
- std::set<std::shared_ptr<event>> events_;
- std::shared_ptr<eventgroupinfo> eventgroupinfo_;
- };
- std::vector<struct subscriptions_info> subscriptions_to_expire_;
- {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
- for (auto &its_service : eventgroups_) {
- for (auto &its_instance : its_service.second) {
- for (auto &its_eventgroup : its_instance.second) {
- std::set<std::shared_ptr<endpoint_definition>> its_invalid_endpoints;
- for (auto &its_target : its_eventgroup.second->get_targets()) {
- if (its_target.endpoint_->get_address() == _address)
- its_invalid_endpoints.insert(its_target.endpoint_);
- }
-
- for (auto &its_endpoint : its_invalid_endpoints) {
- its_eventgroup.second->remove_target(its_endpoint);
- client_t its_client = find_client(its_service.first,
- its_instance.first, its_eventgroup.second,
- its_endpoint);
- clear_remote_subscriber(its_service.first,
- its_instance.first, its_client, its_endpoint);
-
- std::set<std::shared_ptr<event> > its_events;
- if (its_eventgroup.second->get_targets().size() == 0) {
- its_events = its_eventgroup.second->get_events();
- }
- subscriptions_to_expire_.push_back({its_service.first,
- its_instance.first,
- its_eventgroup.first,
- its_endpoint,
- its_client,
- its_events,
- its_eventgroup.second});
- }
- if(its_eventgroup.second->is_multicast() && its_invalid_endpoints.size() &&
- 0 == its_eventgroup.second->get_unreliable_target_count() ) {
- //clear multicast targets if no subscriber is left for multicast eventgroup
- its_eventgroup.second->clear_multicast_targets();
- }
- }
- }
- }
- }
-
- for (const auto &s : subscriptions_to_expire_) {
- if (s.invalid_endpoint_) {
- for (const auto e: s.events_) {
- if (e->is_shadow()) {
- e->unset_payload();
- }
- }
- const client_t its_hosting_client = find_local_client(
- s.service_id_, s.instance_id_);
- if (its_hosting_client != VSOMEIP_ROUTING_CLIENT) {
- const pending_subscription_t its_pending_unsubscription(
- std::shared_ptr<sd_message_identifier_t>(),
- s.invalid_endpoint_, s.invalid_endpoint_,
- 0, s.client_);
- pending_subscription_id_t its_pending_unsubscription_id =
- s.eventgroupinfo_->add_pending_subscription(
- its_pending_unsubscription);
- if (its_pending_unsubscription_id != DEFAULT_SUBSCRIPTION) {
- send_unsubscription(its_hosting_client, s.client_,
- s.service_id_, s.instance_id_, s.eventgroup_id_,
- its_pending_unsubscription_id);
- }
- }
- }
- }
-}
-
-void routing_manager_impl::init_routing_info() {
- VSOMEIP_INFO<< "Service Discovery disabled. Using static routing information.";
- for (auto i : configuration_->get_remote_services()) {
- boost::asio::ip::address its_address(
- boost::asio::ip::address::from_string(
- configuration_->get_unicast_address(i.first, i.second)));
- uint16_t its_reliable_port
- = configuration_->get_reliable_port(i.first, i.second);
- uint16_t its_unreliable_port
- = configuration_->get_unreliable_port(i.first, i.second);
-
- if (its_reliable_port != ILLEGAL_PORT
- || its_unreliable_port != ILLEGAL_PORT) {
-
- add_routing_info(i.first, i.second,
- DEFAULT_MAJOR, DEFAULT_MINOR, DEFAULT_TTL,
- its_address, its_reliable_port,
- its_address, its_unreliable_port);
-
- if(its_reliable_port != ILLEGAL_PORT) {
- find_or_create_remote_client(i.first, i.second, true, VSOMEIP_ROUTING_CLIENT);
- }
- if(its_unreliable_port != ILLEGAL_PORT) {
- find_or_create_remote_client(i.first, i.second, false, VSOMEIP_ROUTING_CLIENT);
- }
- }
- }
-}
-
-void routing_manager_impl::on_remote_subscription(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- const std::shared_ptr<endpoint_definition> &_subscriber,
- const std::shared_ptr<endpoint_definition> &_target, ttl_t _ttl,
- const std::shared_ptr<sd_message_identifier_t> &_sd_message_id,
- const std::function<void(remote_subscription_state_e, client_t)>& _callback) {
- std::shared_ptr<eventgroupinfo> its_eventgroup
- = find_eventgroup(_service, _instance, _eventgroup);
- client_t its_subscribing_client(ILLEGAL_CLIENT);
- if (!its_eventgroup) {
- VSOMEIP_ERROR << "REMOTE SUBSCRIBE: attempt to subscribe to unknown eventgroup ["
- << 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 << "]"
- << " from " << _subscriber->get_address().to_string()
- << ":" << std::dec << _subscriber->get_port()
- << (_subscriber->is_reliable() ? " reliable" : " unreliable");
- _callback(remote_subscription_state_e::SUBSCRIPTION_ERROR, its_subscribing_client);
- return;
- }
- // find out client id for selective subscriber
- if (!_subscriber->is_reliable()) {
- uint16_t unreliable_port = configuration_->get_unreliable_port(_service, _instance);
- _subscriber->set_remote_port(unreliable_port);
- if (!its_eventgroup->is_multicast()) {
- auto endpoint = find_server_endpoint(unreliable_port, false);
- if (endpoint) {
- its_subscribing_client = std::dynamic_pointer_cast<udp_server_endpoint_impl>(endpoint)->
- get_client(_subscriber);
- }
- }
- } else {
- uint16_t reliable_port = configuration_->get_reliable_port(_service, _instance);
- _subscriber->set_remote_port(reliable_port);
- auto endpoint = find_server_endpoint(reliable_port, true);
- if (endpoint) {
- its_subscribing_client = std::dynamic_pointer_cast<tcp_server_endpoint_impl>(endpoint)->
- get_client(_subscriber);
- }
- }
- std::unique_lock<std::mutex> eventgroup_lock(its_eventgroup->get_subscription_lock());
- const std::chrono::steady_clock::time_point its_expiration =
- std::chrono::steady_clock::now() + std::chrono::seconds(_ttl);
- if (its_eventgroup->update_target(_subscriber, its_expiration)) {
- _callback(remote_subscription_state_e::SUBSCRIPTION_ACKED,its_subscribing_client);
- return;
- } else {
- const pending_subscription_id_t its_subscription_id =
- its_eventgroup->add_pending_subscription(
- pending_subscription_t(_sd_message_id, _subscriber,
- _target, _ttl, its_subscribing_client));
- if (its_subscription_id != DEFAULT_SUBSCRIPTION) {
- // only sent subscription to rm_proxy / hosting application if there's
- // no subscription for this eventgroup from the same remote subscriber
- // already pending
- const client_t its_offering_client = find_local_client(_service, _instance);
- send_subscription(its_offering_client, its_subscribing_client,
- _service, _instance, _eventgroup,
- its_eventgroup->get_major(), its_subscription_id);
- } else {
- VSOMEIP_WARNING << __func__ << " a remote subscription is already pending ["
- << 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 << "]"
- << " from " << _subscriber->get_address().to_string()
- << ":" << std::dec << _subscriber->get_port()
- << (_subscriber->is_reliable() ? " reliable" : " unreliable");
- }
- _callback(remote_subscription_state_e::SUBSCRIPTION_PENDING, its_subscribing_client);
- return;
- }
- _callback(remote_subscription_state_e::SUBSCRIPTION_ERROR, its_subscribing_client);
-}
-
-void routing_manager_impl::on_unsubscribe(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- std::shared_ptr<endpoint_definition> _target) {
- std::shared_ptr<eventgroupinfo> its_eventgroup = find_eventgroup(_service,
- _instance, _eventgroup);
- if (its_eventgroup) {
- client_t its_client = find_client(_service, _instance, its_eventgroup, _target);
- const pending_subscription_t its_pending_unsubscription(
- std::shared_ptr<sd_message_identifier_t>(), _target, _target,
- 0, its_client);
- pending_subscription_id_t its_pending_unsubscription_id =
- its_eventgroup->add_pending_subscription(
- its_pending_unsubscription);
-
- its_eventgroup->remove_target(_target);
- clear_remote_subscriber(_service, _instance, its_client, _target);
-
- if (its_pending_unsubscription_id != DEFAULT_SUBSCRIPTION) {
- // there are no pending (un)subscriptions
- const client_t its_offering_client = find_local_client(_service, _instance);
- send_unsubscription(its_offering_client, its_client, _service,
- _instance, _eventgroup, its_pending_unsubscription_id);
- }
-
- if (its_eventgroup->get_targets().size() == 0) {
- std::set<std::shared_ptr<event> > its_events
- = its_eventgroup->get_events();
- for (auto e : its_events) {
- if (e->is_shadow()) {
- e->unset_payload();
- }
- }
- }
- VSOMEIP_INFO << "REMOTE UNSUBSCRIBE("
- << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
- << 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 << "]"
- << " from " << _target->get_address().to_string()
- << ":" << std::dec <<_target->get_port()
- << (_target->is_reliable() ? " reliable" : " unreliable");
-
- } else {
- VSOMEIP_ERROR << "REMOTE UNSUBSCRIBE: attempt to subscribe to unknown eventgroup ["
- << 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 << "]"
- << " from " << _target->get_address().to_string()
- << ":" << std::dec <<_target->get_port()
- << (_target->is_reliable() ? " reliable" : " unreliable");
- }
-}
-
-void routing_manager_impl::on_subscribe_ack(service_t _service,
- instance_t _instance, const boost::asio::ip::address &_address,
- uint16_t _port) {
-
- bool multicast_known(false);
- {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- const auto found_service = multicast_info.find(_service);
- if (found_service != multicast_info.end()) {
- const auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- const auto& endpoint_def = found_instance->second;
- if (endpoint_def->get_address() == _address &&
- endpoint_def->get_port() == _port) {
- // Multicast info and endpoint already created before
- // This can happen when more than one client subscribe on the same instance!
- multicast_known = true;
- }
- }
- }
- if (!multicast_known) {
- // Save multicast info to be able to delete the endpoint
- // as soon as the instance stops offering its service
- std::shared_ptr<endpoint_definition> endpoint_def =
- endpoint_definition::get(_address, _port, false, _service, _instance);
- multicast_info[_service][_instance] = endpoint_def;
- }
- }
- const bool is_someip = configuration_->is_someip(_service, _instance);
-
- // Create multicast endpoint & join multicase group
- std::shared_ptr<endpoint> its_endpoint
- = find_or_create_server_endpoint(_port, false, is_someip);
- if (its_endpoint) {
- if (!multicast_known) {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- service_instances_[_service][its_endpoint.get()] = _instance;
- }
- its_endpoint->join(_address.to_string());
- } else {
- VSOMEIP_ERROR<<"Could not find/create multicast endpoint!";
- }
-}
-
-void routing_manager_impl::on_subscribe_ack(client_t _client,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, pending_subscription_id_t _subscription_id) {
- client_t its_client = is_specific_endpoint_client(_client, _service, _instance);
- bool specific_endpoint_client = its_client != VSOMEIP_ROUTING_CLIENT;
- auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup);
- if (its_eventgroup) {
- std::unique_lock<std::mutex> eventgroup_lock(its_eventgroup->get_subscription_lock());
- if (_subscription_id == DEFAULT_SUBSCRIPTION) {
- // ACK coming in via SD from remote or as answer to a subscription
- // of the application hosting the rm_impl to a local service
- auto its_tuple = std::make_tuple(_service, _instance, _eventgroup, its_client);
- std::lock_guard<std::mutex> its_lock(remote_subscription_state_mutex_);
- auto its_state = remote_subscription_state_.find(its_tuple);
- if (its_state != remote_subscription_state_.end()) {
- if (its_state->second == subscription_state_e::SUBSCRIPTION_ACKNOWLEDGED) {
- // Already notified!
- return;
- }
- }
- remote_subscription_state_[its_tuple] = subscription_state_e::SUBSCRIPTION_ACKNOWLEDGED;
- } else { // ACK sent back from local client as answer to a remote subscription
- const client_t its_offering_client = find_local_client(_service, _instance);
- if (its_offering_client == VSOMEIP_ROUTING_CLIENT) {
- // service was stopped while subscription was pending
- // send subscribe_nack back instead
- eventgroup_lock.unlock();
- on_subscribe_nack(_client, _service, _instance, _eventgroup,
- _event, _subscription_id);
- return;
- }
- if (discovery_) {
- std::vector<pending_subscription_t> its_pending_subscriptions =
- its_eventgroup->remove_pending_subscription(_subscription_id);
- for (const pending_subscription_t& its_sd_message_id : its_pending_subscriptions) {
- if (its_sd_message_id.ttl_ > 0) {
- if (its_sd_message_id.sd_message_identifier_
- && its_sd_message_id.subscriber_
- && its_sd_message_id.target_) {
- {
- std::lock_guard<std::mutex> its_lock(remote_subscribers_mutex_);
- remote_subscribers_[_service][_instance][_client].insert(its_sd_message_id.subscriber_);
- }
- const std::chrono::steady_clock::time_point its_expiration =
- std::chrono::steady_clock::now()
- + std::chrono::seconds(
- its_sd_message_id.ttl_);
- // IP address of target is a multicast address if the event is in a multicast eventgroup
- if (its_eventgroup->is_multicast()
- && !its_sd_message_id.subscriber_->is_reliable()) {
- // Event is in multicast eventgroup and subscribe for UDP
- its_eventgroup->add_target(
- { its_sd_message_id.target_, its_expiration },
- { its_sd_message_id.subscriber_, its_expiration });
- } else {
- // subscribe for TCP or UDP
- its_eventgroup->add_target(
- { its_sd_message_id.subscriber_, its_expiration });
- }
- discovery_->remote_subscription_acknowledge(_service,
- _instance, _eventgroup, _client, true,
- its_sd_message_id.sd_message_identifier_);
-
- VSOMEIP_INFO << "REMOTE SUBSCRIBE("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << 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 << "]"
- << " from " << its_sd_message_id.subscriber_->get_address().to_string()
- << ":" << std::dec << its_sd_message_id.subscriber_->get_port()
- << (its_sd_message_id.subscriber_->is_reliable() ? " reliable" : " unreliable")
- << " was accepted";
- }
- } else { // unsubscription was queued while subscription was pending -> send it to client
- send_unsubscription(its_offering_client,
- its_sd_message_id.subscribing_client_,
- _service, _instance, _eventgroup,
- its_sd_message_id.pending_subscription_id_);
- }
- }
- }
- return;
- }
-
- if (specific_endpoint_client) {
- if (_client == get_client()) {
- host_->on_subscription_error(_service, _instance, _eventgroup, 0x0 /*OK*/);
- host_->on_subscription_status(_service, _instance, _eventgroup, _event, 0x0 /*OK*/);
- } else {
- stub_->send_subscribe_ack(_client, _service, _instance, _eventgroup,
- _event);
- }
- } else {
- std::set<client_t> subscribed_clients;
- for (auto its_event : its_eventgroup->get_events()) {
- for (auto its_client : its_event->get_subscribers()) {
- subscribed_clients.insert(its_client);
- }
- }
- for (auto its_subscriber : subscribed_clients) {
- if (its_subscriber == get_client()) {
- host_->on_subscription_error(_service, _instance,
- _eventgroup, 0x0 /*OK*/);
- for (auto its_event : its_eventgroup->get_events()) {
- host_->on_subscription_status(_service, _instance,
- _eventgroup, its_event->get_event(),
- 0x0 /*OK*/);
- }
- } else {
- stub_->send_subscribe_ack(its_subscriber, _service,
- _instance, _eventgroup, _event);
- }
- }
- }
- }
-}
-
-void routing_manager_impl::on_subscribe_nack(client_t _client,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, pending_subscription_id_t _subscription_id) {
- client_t its_client = is_specific_endpoint_client(_client, _service, _instance);
- bool specific_endpoint_client = its_client != VSOMEIP_ROUTING_CLIENT;
- auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup);
- if (its_eventgroup) {
- std::unique_lock<std::mutex> eventgroup_lock(its_eventgroup->get_subscription_lock());
- if (_subscription_id == DEFAULT_SUBSCRIPTION) {
- // NACK coming in via SD from remote or as answer to a subscription
- // of the application hosting the rm_impl to a local service
- auto its_tuple = std::make_tuple(_service, _instance, _eventgroup, its_client);
- std::lock_guard<std::mutex> its_lock(remote_subscription_state_mutex_);
- auto its_state = remote_subscription_state_.find(its_tuple);
- if (its_state != remote_subscription_state_.end()) {
- if (its_state->second == subscription_state_e::SUBSCRIPTION_NOT_ACKNOWLEDGED) {
- // Already notified!
- return;
- }
- }
- remote_subscription_state_[its_tuple] = subscription_state_e::SUBSCRIPTION_NOT_ACKNOWLEDGED;
- } else { // NACK sent back from local client as answer to a remote subscription
- if (discovery_) {
- std::vector<pending_subscription_t> its_pending_subscriptions =
- its_eventgroup->remove_pending_subscription(_subscription_id);
- for (const pending_subscription_t& its_sd_message_id : its_pending_subscriptions) {
- if (its_sd_message_id.ttl_ > 0) {
- if (its_sd_message_id.sd_message_identifier_ && its_sd_message_id.subscriber_) {
- discovery_->remote_subscription_acknowledge(_service, _instance,
- _eventgroup, _client, false, its_sd_message_id.sd_message_identifier_);
- VSOMEIP_INFO << "REMOTE SUBSCRIBE("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << 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 << "]"
- << " from " << its_sd_message_id.subscriber_->get_address().to_string()
- << ":" << std::dec <<its_sd_message_id.subscriber_->get_port()
- << (its_sd_message_id.subscriber_->is_reliable() ? " reliable" : " unreliable")
- << " was not accepted";
- }
- } else { // unsubscription was queued while subscription was pending -> send it to client
- const client_t its_offering_client = find_local_client(_service, _instance);
- send_unsubscription(its_offering_client,
- its_sd_message_id.subscribing_client_, _service,
- _instance, _eventgroup,
- its_sd_message_id.pending_subscription_id_);
- }
- }
- }
- return;
- }
- if (specific_endpoint_client) {
- if (_client == get_client()) {
- host_->on_subscription_error(_service, _instance, _eventgroup, 0x7 /*Rejected*/);
- host_->on_subscription_status(_service, _instance, _eventgroup, _event, 0x7 /*Rejected*/);
- } else {
- stub_->send_subscribe_nack(_client, _service, _instance, _eventgroup,
- _event);
- }
- } else {
- std::set<client_t> subscribed_clients;
- for (auto its_event : its_eventgroup->get_events()) {
- for (auto its_client : its_event->get_subscribers()) {
- subscribed_clients.insert(its_client);
- }
- }
- for (auto its_subscriber : subscribed_clients) {
- if (its_subscriber == get_client()) {
- host_->on_subscription_error(_service, _instance,
- _eventgroup, 0x7 /*Rejected*/);
- for (auto its_event : its_eventgroup->get_events()) {
- host_->on_subscription_status(_service, _instance,
- _eventgroup, its_event->get_event(),
- 0x7 /*Rejected*/);
- }
- } else {
- stub_->send_subscribe_nack(its_subscriber, _service,
- _instance, _eventgroup, _event);
- }
- }
- }
- }
-}
-
-bool routing_manager_impl::deliver_specific_endpoint_message(service_t _service,
- instance_t _instance, const byte_t *_data, length_t _size, endpoint *_receiver) {
- client_t its_client(0x0);
-
- // Try to deliver specific endpoint message (for selective subscribers)
- {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- auto found_servic = remote_services_.find(_service);
- if (found_servic != remote_services_.end()) {
- auto found_instance = found_servic->second.find(_instance);
- if (found_instance != found_servic->second.end()) {
- for (auto client_entry : found_instance->second) {
- if (!client_entry.first) {
- continue;
- }
- auto found_reliability = client_entry.second.find(_receiver->is_reliable());
- if (found_reliability != client_entry.second.end()) {
- auto found_enpoint = found_reliability->second;
- if (found_enpoint.get() == _receiver) {
- its_client = client_entry.first;
- break;
- }
- }
- }
- }
- }
- }
- if (its_client) {
- if (its_client != get_client()) {
- auto local_endpoint = find_local(its_client);
- if (local_endpoint) {
- send_local(local_endpoint, its_client, _data, _size, _instance, true,
- _receiver->is_reliable(), VSOMEIP_SEND);
- }
- } else {
- deliver_message(_data, _size, _instance, _receiver->is_reliable());
- }
- return true;
- }
-
- return false;
-}
-
-void routing_manager_impl::clear_client_endpoints(service_t _service, instance_t _instance,
- bool _reliable) {
- auto its_specific_endpoint_clients = get_specific_endpoint_clients(_service, _instance);
- std::shared_ptr<endpoint> endpoint_to_delete;
- bool other_services_reachable_through_endpoint(false);
- std::vector<std::shared_ptr<endpoint>> its_specific_endpoints;
- {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- // Clear client endpoints for remote services (generic and specific ones)
- if (remote_services_.find(_service) != remote_services_.end()) {
- if (remote_services_[_service].find(_instance) != remote_services_[_service].end()) {
- auto endpoint = remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT][_reliable];
- if (endpoint) {
- service_instances_[_service].erase(endpoint.get());
- endpoint_to_delete = endpoint;
- }
- remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT].erase(_reliable);
- auto found_endpoint = remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT].find(
- !_reliable);
- if (found_endpoint == remote_services_[_service][_instance][VSOMEIP_ROUTING_CLIENT].end()) {
- remote_services_[_service][_instance].erase(VSOMEIP_ROUTING_CLIENT);
- }
- // erase specific client endpoints
- for (const client_t &client : its_specific_endpoint_clients) {
- auto endpoint = remote_services_[_service][_instance][client][_reliable];
- if (endpoint) {
- service_instances_[_service].erase(endpoint.get());
- its_specific_endpoints.push_back(endpoint);
- }
- remote_services_[_service][_instance][client].erase(_reliable);
- auto found_endpoint = remote_services_[_service][_instance][client].find(!_reliable);
- if (found_endpoint == remote_services_[_service][_instance][client].end()) {
- remote_services_[_service][_instance].erase(client);
- }
- }
- }
- }
- if (remote_services_.find(_service) != remote_services_.end()) {
- if (remote_services_[_service].find(_instance) != remote_services_[_service].end()) {
- if (!remote_services_[_service][_instance].size()) {
- remote_services_[_service].erase(_instance);
- if (0 >= remote_services_[_service].size()) {
- remote_services_.erase(_service);
- }
- }
- }
- }
-
- if (!service_instances_[_service].size()) {
- service_instances_.erase(_service);
- }
-
- // Only stop and delete the endpoint if none of the services
- // reachable through it is online anymore.
- if (endpoint_to_delete) {
- for (const auto& service : remote_services_) {
- for (const auto& instance : service.second) {
- const auto& client = instance.second.find(VSOMEIP_ROUTING_CLIENT);
- if (client != instance.second.end()) {
- for (const auto& reliable : client->second) {
- if (reliable.second == endpoint_to_delete) {
- other_services_reachable_through_endpoint = true;
- break;
- }
- }
- }
- if (other_services_reachable_through_endpoint) { break; }
- }
- if (other_services_reachable_through_endpoint) { break; }
- }
-
- if (!other_services_reachable_through_endpoint) {
- std::uint16_t its_port(0);
- boost::asio::ip::address its_address;
- if (_reliable) {
- std::shared_ptr<tcp_client_endpoint_impl> ep =
- std::dynamic_pointer_cast<tcp_client_endpoint_impl>(endpoint_to_delete);
- if (ep) {
- its_port = ep->get_remote_port();
- ep->get_remote_address(its_address);
- }
- } else {
- std::shared_ptr<udp_client_endpoint_impl> ep =
- std::dynamic_pointer_cast<udp_client_endpoint_impl>(endpoint_to_delete);
- if (ep) {
- its_port = ep->get_remote_port();
- ep->get_remote_address(its_address);
- }
- }
- const auto found_ip = client_endpoints_by_ip_.find(its_address);
- if (found_ip != client_endpoints_by_ip_.end()) {
- const auto found_port = found_ip->second.find(its_port);
- if (found_port != found_ip->second.end()) {
- const auto found_reliable = found_port->second.find(_reliable);
- if (found_reliable != found_port->second.end()) {
- if (found_reliable->second == endpoint_to_delete) {
- found_port->second.erase(_reliable);
- // delete if necessary
- if (!found_port->second.size()) {
- found_ip->second.erase(found_port);
- if (!found_ip->second.size()) {
- client_endpoints_by_ip_.erase(found_ip);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if (!other_services_reachable_through_endpoint && endpoint_to_delete) {
- endpoint_to_delete->stop();
- }
- for (const auto &specific_endpoint : its_specific_endpoints) {
- specific_endpoint->stop();
- }
-}
-
-void routing_manager_impl::clear_multicast_endpoints(service_t _service, instance_t _instance) {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- // Clear multicast info and endpoint and multicast instance (remote service)
- if (multicast_info.find(_service) != multicast_info.end()) {
- if (multicast_info[_service].find(_instance) != multicast_info[_service].end()) {
- std::string address = multicast_info[_service][_instance]->get_address().to_string();
- uint16_t port = multicast_info[_service][_instance]->get_port();
- std::shared_ptr<endpoint> multicast_endpoint;
- auto found_port = server_endpoints_.find(port);
- if (found_port != server_endpoints_.end()) {
- auto found_unreliable = found_port->second.find(false);
- if (found_unreliable != found_port->second.end()) {
- multicast_endpoint = found_unreliable->second;
- multicast_endpoint->leave(address);
- multicast_endpoint->stop();
- server_endpoints_[port].erase(false);
- }
- if (found_port->second.find(true) == found_port->second.end()) {
- server_endpoints_.erase(port);
- }
- }
- multicast_info[_service].erase(_instance);
- if (0 >= multicast_info[_service].size()) {
- multicast_info.erase(_service);
- }
- // Clear service_instances_ for multicase endpoint
- if (1 >= service_instances_[_service].size()) {
- service_instances_.erase(_service);
- } else if (multicast_endpoint) {
- service_instances_[_service].erase(multicast_endpoint.get());
- }
- }
- }
-}
-
-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]);
-
- if (_size >= VSOMEIP_PAYLOAD_POS) {
- if (utility::is_request(_data[VSOMEIP_MESSAGE_TYPE_POS])
- || utility::is_request_no_return(_data[VSOMEIP_MESSAGE_TYPE_POS]) ) {
- if (_data[VSOMEIP_PROTOCOL_VERSION_POS] != VSOMEIP_PROTOCOL_VERSION) {
- VSOMEIP_WARNING << "Received a message with unsupported protocol version for service 0x"
- << std::hex << its_service;
- return return_code_e::E_WRONG_PROTOCOL_VERSION;
- }
- if (_instance == 0xFFFF) {
- VSOMEIP_WARNING << "Receiving endpoint is not configured for service 0x"
- << std::hex << its_service;
- return return_code_e::E_UNKNOWN_SERVICE;
- }
- // Check interface version of service/instance
- auto its_info = find_service(its_service, _instance);
- if (its_info) {
- major_version_t its_version = _data[VSOMEIP_INTERFACE_VERSION_POS];
- if (its_version != its_info->get_major()) {
- VSOMEIP_WARNING << "Received a message with unsupported interface version for service 0x"
- << std::hex << its_service;
- return return_code_e::E_WRONG_INTERFACE_VERSION;
- }
- }
- if (_data[VSOMEIP_RETURN_CODE_POS] != static_cast<byte_t> (return_code_e::E_OK)) {
- // Request calls must to have return code E_OK set!
- VSOMEIP_WARNING << "Received a message with unsupported return code set for service 0x"
- << std::hex << its_service;
- return return_code_e::E_NOT_OK;
- }
- }
- } else {
- // Message shorter than vSomeIP message header
- VSOMEIP_WARNING << "Received a message message which is shorter than vSomeIP message header!";
- return return_code_e::E_MALFORMED_MESSAGE;
- }
- return return_code_e::E_OK;
-}
-
-void routing_manager_impl::send_error(return_code_e _return_code,
- const byte_t *_data, length_t _size,
- instance_t _instance, bool _reliable,
- endpoint *_receiver,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port) {
-
- client_t its_client = 0;
- service_t its_service = 0;
- method_t its_method = 0;
- 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) {
- its_version = _data[VSOMEIP_INTERFACE_VERSION_POS];
- }
-
- auto error_message = runtime::get()->create_message(_reliable);
- error_message->set_client(its_client);
- error_message->set_instance(_instance);
- error_message->set_interface_version(its_version);
- error_message->set_message_type(message_type_e::MT_ERROR);
- error_message->set_method(its_method);
- error_message->set_return_code(_return_code);
- error_message->set_service(its_service);
- error_message->set_session(its_session);
- {
- std::lock_guard<std::mutex> its_lock(serialize_mutex_);
- if (serializer_->serialize(error_message.get())) {
- if (_receiver) {
- auto its_endpoint_def = std::make_shared<endpoint_definition>(
- _remote_address, _remote_port,
- _receiver->is_reliable());
- its_endpoint_def->set_remote_port(_receiver->get_local_port());
- send_to(its_endpoint_def, serializer_->get_data(),
- serializer_->get_size(), _instance, true);
- }
- serializer_->reset();
- } else {
- VSOMEIP_ERROR<< "Failed to serialize error message.";
- }
- }
-}
-
-void routing_manager_impl::on_identify_response(client_t _client, service_t _service,
- instance_t _instance, bool _reliable) {
- {
- std::lock_guard<std::mutex> its_lock(identified_clients_mutex_);
- auto its_service = identifying_clients_.find(_service);
- if (its_service != identifying_clients_.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- auto its_reliable = its_instance->second.find(_reliable);
- if (its_reliable != its_instance->second.end()) {
- its_reliable->second.erase(_client);
- }
- }
- }
- identified_clients_[_service][_instance][_reliable].insert(_client);
- }
- discovery_->send_subscriptions(_service, _instance, _client, _reliable);
-}
-
-void routing_manager_impl::identify_for_subscribe(client_t _client,
- service_t _service, instance_t _instance, major_version_t _major,
- subscription_type_e _subscription_type) {
- (void)_subscription_type;
- if (!has_identified(_client, _service, _instance, false)
- && !is_identifying(_client, _service, _instance, false)) {
- send_identify_message(_client, _service, _instance, _major, false);
- }
- if (!has_identified(_client, _service, _instance, true)
- && !is_identifying(_client, _service, _instance, true)) {
- send_identify_message(_client, _service, _instance, _major, true);
- }
-}
-
-bool routing_manager_impl::send_identify_message(client_t _client,
- service_t _service,
- instance_t _instance,
- major_version_t _major,
- bool _reliable) {
- auto its_endpoint = find_or_create_remote_client(_service, _instance,
- _reliable, _client);
- if (!its_endpoint) {
- VSOMEIP_WARNING << "routing_manager_impl::send_identify_message: "
- << "No " << (_reliable ? "reliable" : "unreliable")
- << " route for identify message to service/instance "
- << std::hex << _service << "/" << _instance << " for client "
- << _client;
- return false;
- }
- {
- std::lock_guard<std::mutex> its_lock(identified_clients_mutex_);
- identifying_clients_[_service][_instance][_reliable].insert(_client);
- }
-
- if (_client == get_client()) {
- send_identify_request(_service, _instance, _major, _reliable);
- } else {
- stub_->send_identify_request_command(find_local(_client),
- _service, _instance, _major, _reliable);
- }
-
- return true;
-}
-
-
-bool routing_manager_impl::supports_selective(service_t _service, instance_t _instance) {
- bool supports_selective(false);
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- auto its_service = remote_service_info_.find(_service);
- if (its_service != remote_service_info_.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- for (auto its_reliable : its_instance->second) {
- supports_selective |= configuration_->
- supports_selective_broadcasts(
- its_reliable.second->get_address());
- }
- }
- }
- return supports_selective;
-}
-
-bool routing_manager_impl::is_identifying(client_t _client, service_t _service,
- instance_t _instance, bool _reliable) {
- if (!supports_selective(_service, _instance)) {
- // For legacy selective services clients can't be identified!
- return false;
- }
- bool is_identifieing(false);
- std::lock_guard<std::mutex> its_lock(identified_clients_mutex_);
- auto its_service = identifying_clients_.find(_service);
- if (its_service != identifying_clients_.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- auto its_reliable = its_instance->second.find(_reliable);
- if (its_reliable != its_instance->second.end()) {
- auto its_client = its_reliable->second.find(_client);
- if (its_client != its_reliable->second.end()) {
- is_identifieing = true;
- }
- }
- }
- }
- return is_identifieing;
-}
-
-bool routing_manager_impl::has_identified(client_t _client, service_t _service,
- instance_t _instance, bool _reliable) {
- if (!supports_selective(_service, _instance)) {
- // For legacy selective services clients can't be identified!
- return true;
- }
- bool has_identified(false);
- std::lock_guard<std::mutex> its_lock(identified_clients_mutex_);
- auto its_service = identified_clients_.find(_service);
- if (its_service != identified_clients_.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- auto its_reliable = its_instance->second.find(_reliable);
- if (its_reliable != its_instance->second.end()) {
- auto its_client = its_reliable->second.find(_client);
- if (its_client != its_reliable->second.end()) {
- has_identified = true;
- }
- }
- }
- }
- return has_identified;
-}
-
-void routing_manager_impl::clear_remote_subscriber(
- service_t _service, instance_t _instance, client_t _client,
- const std::shared_ptr<endpoint_definition> &_target) {
- std::lock_guard<std::mutex> its_lock(remote_subscribers_mutex_);
- auto its_service = remote_subscribers_.find(_service);
- if (its_service != remote_subscribers_.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- auto its_client = its_instance->second.find(_client);
- if (its_client != its_instance->second.end()) {
- if (its_client->second.erase(_target)) {
- if (!its_client->second.size()) {
- its_instance->second.erase(_client);
- }
- }
- }
- }
- }
-}
-
-std::chrono::steady_clock::time_point
-routing_manager_impl::expire_subscriptions() {
- struct subscriptions_info {
- service_t service_id_;
- instance_t instance_id_;
- eventgroup_t eventgroup_id_;
- std::shared_ptr<endpoint_definition> invalid_endpoint_;
- client_t client_;
- std::set<std::shared_ptr<event>> events_;
- std::shared_ptr<eventgroupinfo> eventgroupinfo_;
- };
- std::vector<struct subscriptions_info> subscriptions_to_expire_;
- std::chrono::steady_clock::time_point now
- = std::chrono::steady_clock::now();
- std::chrono::steady_clock::time_point next_expiration
- = std::chrono::steady_clock::now() + std::chrono::hours(24);
- {
- std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
-
- for (auto &its_service : eventgroups_) {
- for (auto &its_instance : its_service.second) {
- for (auto &its_eventgroup : its_instance.second) {
- std::set<std::shared_ptr<endpoint_definition>> its_expired_endpoints;
- for (auto &its_target : its_eventgroup.second->get_targets()) {
- if (its_target.expiration_ < now) {
- its_expired_endpoints.insert(its_target.endpoint_);
- } else if (its_target.expiration_ < next_expiration) {
- next_expiration = its_target.expiration_;
- }
- }
-
- for (auto its_endpoint : its_expired_endpoints) {
- its_eventgroup.second->remove_target(its_endpoint);
-
- client_t its_client
- = find_client(its_service.first, its_instance.first,
- its_eventgroup.second, its_endpoint);
- clear_remote_subscriber(its_service.first, its_instance.first,
- its_client, its_endpoint);
-
- std::set<std::shared_ptr<event> > its_events;
- if (its_eventgroup.second->get_targets().size() == 0) {
- its_events = its_eventgroup.second->get_events();
- }
- subscriptions_to_expire_.push_back({its_service.first,
- its_instance.first,
- its_eventgroup.first,
- its_endpoint,
- its_client,
- its_events,
- its_eventgroup.second});
- }
- if(its_eventgroup.second->is_multicast() && its_expired_endpoints.size() &&
- 0 == its_eventgroup.second->get_unreliable_target_count() ) {
- //clear multicast targets if no unreliable subscriber is left for multicast eventgroup
- its_eventgroup.second->clear_multicast_targets();
- }
- }
- }
- }
- }
-
- for (const auto &s : subscriptions_to_expire_) {
- if (s.invalid_endpoint_) {
- for (const auto e: s.events_) {
- if (e->is_shadow()) {
- e->unset_payload();
- }
- }
- const client_t its_hosting_client = find_local_client(s.service_id_,
- s.instance_id_);
-
- if (its_hosting_client != VSOMEIP_ROUTING_CLIENT) {
- const pending_subscription_t its_pending_unsubscription(
- std::shared_ptr<sd_message_identifier_t>(),
- s.invalid_endpoint_, s.invalid_endpoint_,
- 0, s.client_);
- pending_subscription_id_t its_pending_unsubscription_id =
- s.eventgroupinfo_->add_pending_subscription(
- its_pending_unsubscription);
- if (its_pending_unsubscription_id != DEFAULT_SUBSCRIPTION) {
- send_unsubscription(its_hosting_client, s.client_, s.service_id_,
- s.instance_id_, s.eventgroup_id_,
- its_pending_unsubscription_id);
- }
- }
-
- VSOMEIP_INFO << "Expired subscription ["
- << std::hex << std::setfill('0') << std::setw(4) << s.service_id_ << "."
- << std::hex << std::setfill('0') << std::setw(4) << s.instance_id_ << "."
- << std::hex << std::setfill('0') << std::setw(4) << s.eventgroup_id_ << "] from "
- << s.invalid_endpoint_->get_address() << ":"
- << std::dec << s.invalid_endpoint_->get_port()
- << "(" << std::hex << std::setfill('0') << std::setw(4) << s.client_ << ")";
- }
- }
- return next_expiration;
-}
-
-void routing_manager_impl::log_version_timer_cbk(boost::system::error_code const & _error) {
- if (!_error) {
-
-#ifndef VSOMEIP_VERSION
-#define VSOMEIP_VERSION "unknown version"
-#endif
-
- VSOMEIP_INFO << "vSomeIP " << VSOMEIP_VERSION;
- {
- std::lock_guard<std::mutex> its_lock(version_log_timer_mutex_);
- version_log_timer_.expires_from_now(
- std::chrono::seconds(configuration_->get_log_version_interval()));
- version_log_timer_.async_wait(std::bind(&routing_manager_impl::log_version_timer_cbk,
- this, std::placeholders::_1));
- }
- }
-}
-
-#ifndef WITHOUT_SYSTEMD
-void routing_manager_impl::watchdog_cbk(boost::system::error_code const &_error) {
- if (!_error) {
- static bool is_ready(false);
- static bool has_interval(false);
- static uint64_t its_interval(0);
-
- if (is_ready) {
- sd_notify(0, "WATCHDOG=1");
- VSOMEIP_INFO << "Triggered systemd watchdog";
- } else {
- is_ready = true;
- sd_notify(0, "READY=1");
- VSOMEIP_INFO << "Sent READY to systemd watchdog";
- if (0 < sd_watchdog_enabled(0, &its_interval)) {
- has_interval = true;
- VSOMEIP_INFO << "systemd watchdog is enabled";
- }
- }
-
- if (has_interval) {
- std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
- watchdog_timer_.expires_from_now(std::chrono::microseconds(its_interval / 2));
- watchdog_timer_.async_wait(std::bind(&routing_manager_impl::watchdog_cbk,
- this, std::placeholders::_1));
- }
- }
-}
-#endif
-
-void routing_manager_impl::clear_remote_service_info(service_t _service, instance_t _instance, bool _reliable) {
- // Clear remote_service_info_
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- if (remote_service_info_.find(_service) != remote_service_info_.end()) {
- if (remote_service_info_[_service].find(_instance) != remote_service_info_[_service].end()) {
- remote_service_info_[_service][_instance].erase(_reliable);
- auto found_endpoint_def = remote_service_info_[_service][_instance].find(!_reliable);
- if (found_endpoint_def == remote_service_info_[_service][_instance].end()) {
- remote_service_info_[_service].erase(_instance);
- if (0 >= remote_service_info_[_service].size()) {
- remote_service_info_.erase(_service);
- }
- }
- }
- }
-}
-
-bool routing_manager_impl::handle_local_offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major,minor_version_t _minor) {
- {
- std::lock_guard<std::mutex> its_lock(local_services_mutex_);
- auto found_service = local_services_.find(_service);
- if (found_service != local_services_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- const major_version_t its_stored_major(std::get<0>(found_instance->second));
- const minor_version_t its_stored_minor(std::get<1>(found_instance->second));
- const client_t its_stored_client(std::get<2>(found_instance->second));
- if ( its_stored_major == _major
- && its_stored_minor == _minor
- && its_stored_client == _client) {
- VSOMEIP_WARNING << "routing_manager_impl::handle_local_offer_service: "
- << "Application: " << std::hex << std::setfill('0')
- << std::setw(4) << _client << " is offering: ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(_major) << "."
- << _minor << "] offered previously by itself.";
- return false;
- } else if ( its_stored_major == _major
- && its_stored_minor == _minor
- && its_stored_client != _client) {
- // check if previous offering application is still alive
- bool already_pinged(false);
- {
- std::lock_guard<std::mutex> its_lock(pending_offers_mutex_);
- auto found_service2 = pending_offers_.find(_service);
- if (found_service2 != pending_offers_.end()) {
- auto found_instance2 = found_service2->second.find(_instance);
- if (found_instance2 != found_service2->second.end()) {
- if(std::get<2>(found_instance2->second) == _client) {
- already_pinged = true;
- } else {
- VSOMEIP_ERROR << "routing_manager_impl::handle_local_offer_service: "
- << "rejecting service registration. Application: "
- << std::hex << std::setfill('0') << std::setw(4)
- << _client << " is trying to offer ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(_major) << "."
- << std::dec << _minor
- << "] current pending offer by application: " << std::hex
- << std::setfill('0') << std::setw(4)
- << its_stored_client << ": ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(its_stored_major)
- << "." << its_stored_minor << "]";
- return false;
- }
- }
- }
- }
- if (!already_pinged) {
- // find out endpoint of previously offering application
- std::shared_ptr<local_client_endpoint_base_impl>
- its_old_endpoint
- = std::dynamic_pointer_cast<local_client_endpoint_base_impl>(
- find_local(its_stored_client));
- if (its_old_endpoint) {
- std::lock_guard<std::mutex> its_lock(pending_offers_mutex_);
- if(stub_->send_ping(its_stored_client)) {
- pending_offers_[_service][_instance] =
- std::make_tuple(_major, _minor, _client,
- its_stored_client);
- VSOMEIP_WARNING << "OFFER("
- << std::hex << std::setw(4) << std::setfill('0') << _client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance
- << ":" << std::dec << int(_major) << "." << std::dec << _minor
- << "] is now pending. Waiting for pong from application: "
- << std::hex << std::setw(4) << std::setfill('0') << its_stored_client;
- return false;
- }
- } else if (its_stored_client == host_->get_client()) {
- VSOMEIP_ERROR << "routing_manager_impl::handle_local_offer_service: "
- << "rejecting service registration. Application: "
- << std::hex << std::setfill('0') << std::setw(4)
- << _client << " is trying to offer ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(_major) << "."
- << std::dec << _minor
- << "] offered previously by routing manager stub itself with application: "
- << std::hex << std::setfill('0') << std::setw(4)
- << its_stored_client << ": ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(its_stored_major)
- << "." << its_stored_minor << "] which is still alive";
- return false;
- }
- } else {
- return false;
- }
- } else {
- VSOMEIP_ERROR << "routing_manager_impl::handle_local_offer_service: "
- << "rejecting service registration. Application: "
- << std::hex << std::setfill('0') << std::setw(4)
- << _client << " is trying to offer ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(_major) << "."
- << std::dec << _minor
- << "] offered previously by application: " << std::hex
- << std::setfill('0') << std::setw(4)
- << its_stored_client << ": ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(its_stored_major)
- << "." << its_stored_minor << "]";
- return false;
- }
- }
- }
-
- // check if the same service instance is already offered remotely
- if (routing_manager_base::offer_service(_client, _service, _instance,
- _major, _minor)) {
- local_services_[_service][_instance] = std::make_tuple(_major,
- _minor, _client);
- } else {
- VSOMEIP_ERROR << "routing_manager_impl::handle_local_offer_service: "
- << "rejecting service registration. Application: "
- << std::hex << std::setfill('0') << std::setw(4)
- << _client << " is trying to offer ["
- << std::hex << std::setfill('0') << std::setw(4) << _service << "."
- << std::hex << std::setfill('0') << std::setw(4) << _instance << "."
- << std::dec << static_cast<std::uint32_t>(_major) << "."
- << std::dec << _minor << "]"
- << "] already offered remotely";
- return false;
- }
- }
- return true;
-}
-
-void routing_manager_impl::on_pong(client_t _client) {
- std::lock_guard<std::mutex> its_lock(pending_offers_mutex_);
- if (pending_offers_.size() == 0) {
- return;
- }
- for (auto service_iter = pending_offers_.begin();
- service_iter != pending_offers_.end(); ) {
- for (auto instance_iter = service_iter->second.begin();
- instance_iter != service_iter->second.end(); ) {
- if (std::get<3>(instance_iter->second) == _client) {
- // received pong from an application were another application wants
- // to offer its service, delete the other applications offer as
- // the current offering application is still alive
- VSOMEIP_WARNING << "OFFER("
- << std::hex << std::setw(4) << std::setfill('0')
- << std::get<2>(instance_iter->second) <<"): ["
- << std::hex << std::setw(4) << std::setfill('0')
- << service_iter->first << "."
- << std::hex << std::setw(4) << std::setfill('0')
- << instance_iter->first << ":" << std::dec
- << std::uint32_t(std::get<0>(instance_iter->second))
- << "." << std::dec << std::get<1>(instance_iter->second)
- << "] was rejected as application: "
- << std::hex << std::setw(4) << std::setfill('0') << _client
- << " is still alive";
- instance_iter = service_iter->second.erase(instance_iter);
- } else {
- ++instance_iter;
- }
- }
-
- if (service_iter->second.size() == 0) {
- service_iter = pending_offers_.erase(service_iter);
- } else {
- ++service_iter;
- }
- }
-}
-
-void routing_manager_impl::register_client_error_handler(client_t _client,
- const std::shared_ptr<endpoint> &_endpoint) {
- _endpoint->register_error_handler(
- std::bind(&routing_manager_impl::handle_client_error, this, _client));
-}
-
-void routing_manager_impl::handle_client_error(client_t _client) {
- if (stub_)
- stub_->update_registration(_client, registration_type_e::DEREGISTER_ON_ERROR);
-
- std::forward_list<std::tuple<client_t, service_t, instance_t, major_version_t,
- minor_version_t>> its_offers;
- {
- std::lock_guard<std::mutex> its_lock(pending_offers_mutex_);
- if (pending_offers_.size() == 0) {
- return;
- }
-
- for (auto service_iter = pending_offers_.begin();
- service_iter != pending_offers_.end(); ) {
- for (auto instance_iter = service_iter->second.begin();
- instance_iter != service_iter->second.end(); ) {
- if (std::get<3>(instance_iter->second) == _client) {
- VSOMEIP_WARNING << "OFFER("
- << std::hex << std::setw(4) << std::setfill('0')
- << std::get<2>(instance_iter->second) <<"): ["
- << std::hex << std::setw(4) << std::setfill('0')
- << service_iter->first << "."
- << std::hex << std::setw(4) << std::setfill('0')
- << instance_iter->first << ":" << std::dec
- << std::uint32_t(std::get<0>(instance_iter->second))
- << "." << std::dec << std::get<1>(instance_iter->second)
- << "] is not pending anymore as application: "
- << std::hex << std::setw(4) << std::setfill('0')
- << std::get<3>(instance_iter->second)
- << " is dead. Offering again!";
- its_offers.push_front(std::make_tuple(
- std::get<2>(instance_iter->second),
- service_iter->first,
- instance_iter->first,
- std::get<0>(instance_iter->second),
- std::get<1>(instance_iter->second)));
- instance_iter = service_iter->second.erase(instance_iter);
- } else {
- ++instance_iter;
- }
- }
-
- if (service_iter->second.size() == 0) {
- service_iter = pending_offers_.erase(service_iter);
- } else {
- ++service_iter;
- }
- }
- }
- for (const auto &offer : its_offers) {
- offer_service(std::get<0>(offer), std::get<1>(offer), std::get<2>(offer),
- std::get<3>(offer), std::get<4>(offer));
- }
-}
-
-void routing_manager_impl::remove_specific_client_endpoint(client_t _client, service_t _service,
- instance_t _instance, bool _reliable) {
- client_t its_client = is_specific_endpoint_client(_client, _service, _instance);
- if (its_client != VSOMEIP_ROUTING_CLIENT) {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- if (remote_services_.find(_service) != remote_services_.end()) {
- if (remote_services_[_service].find(_instance) != remote_services_[_service].end()) {
- auto endpoint = remote_services_[_service][_instance][_client][_reliable];
- if (endpoint) {
- service_instances_[_service].erase(endpoint.get());
- endpoint->stop();
- }
- remote_services_[_service][_instance][_client].erase(_reliable);
- auto found_endpoint = remote_services_[_service][_instance][_client].find(!_reliable);
- if (found_endpoint == remote_services_[_service][_instance][_client].end()) {
- remote_services_[_service][_instance].erase(_client);
- }
- }
- }
- }
-}
-
-void routing_manager_impl::clear_identified_clients( service_t _service, instance_t _instance) {
- std::lock_guard<std::mutex> its_lock(identified_clients_mutex_);
- auto its_service = identified_clients_.find(_service);
- if (its_service != identified_clients_.end()) {
- auto found_instance = its_service->second.find(_instance);
- if (found_instance != its_service->second.end()) {
- auto found_reliable = found_instance->second.find(true);
- if (found_reliable != found_instance->second.end()) {
- found_reliable->second.clear();
- }
- auto found_unreliable = found_instance->second.find(false);
- if (found_unreliable != found_instance->second.end()) {
- found_unreliable->second.clear();
- }
- }
- }
-}
-
-void routing_manager_impl::clear_identifying_clients( service_t _service, instance_t _instance) {
- std::lock_guard<std::mutex> its_lock(identified_clients_mutex_);
- auto its_service = identifying_clients_.find(_service);
- if (its_service != identifying_clients_.end()) {
- auto found_instance = its_service->second.find(_instance);
- if (found_instance != its_service->second.end()) {
- auto found_reliable = found_instance->second.find(true);
- if (found_reliable != found_instance->second.end()) {
- found_reliable->second.clear();
- }
- auto found_unreliable = found_instance->second.find(false);
- if (found_unreliable != found_instance->second.end()) {
- found_unreliable->second.clear();
- }
- }
- }
-}
-
-void routing_manager_impl::remove_identified_client(service_t _service, instance_t _instance, client_t _client) {
- std::lock_guard<std::mutex> its_lock(identified_clients_mutex_);
- auto its_service = identified_clients_.find(_service);
- if (its_service != identified_clients_.end()) {
- auto found_instance = its_service->second.find(_instance);
- if (found_instance != its_service->second.end()) {
- auto found_reliable = found_instance->second.find(true);
- if (found_reliable != found_instance->second.end()) {
- auto found_client = found_reliable->second.find(_client);
- if(found_client != found_reliable->second.end())
- found_reliable->second.erase(_client);
- }
- auto found_unreliable = found_instance->second.find(false);
- if (found_unreliable != found_instance->second.end()) {
- auto found_client = found_unreliable->second.find(_client);
- if(found_client != found_unreliable->second.end())
- found_unreliable->second.erase(_client);
- }
- }
- }
-}
-
-void routing_manager_impl::remove_identifying_client(service_t _service, instance_t _instance, client_t _client) {
- std::lock_guard<std::mutex> its_lock(identified_clients_mutex_);
- auto its_service = identifying_clients_.find(_service);
- if (its_service != identifying_clients_.end()) {
- auto found_instance = its_service->second.find(_instance);
- if (found_instance != its_service->second.end()) {
- auto found_reliable = found_instance->second.find(true);
- if (found_reliable != found_instance->second.end()) {
- auto found_client = found_reliable->second.find(_client);
- if(found_client != found_reliable->second.end())
- found_reliable->second.erase(_client);
- }
- auto found_unreliable = found_instance->second.find(false);
- if (found_unreliable != found_instance->second.end()) {
- auto found_client = found_unreliable->second.find(_client);
- if(found_client != found_unreliable->second.end())
- found_unreliable->second.erase(_client);
- }
- }
- }
-}
-
-void routing_manager_impl::unsubscribe_specific_client_at_sd(
- service_t _service, instance_t _instance, client_t _client) {
- client_t subscriber = is_specific_endpoint_client(_client, _service, _instance);
- if (subscriber != VSOMEIP_ROUTING_CLIENT && discovery_) {
- discovery_->unsubscribe_client(_service, _instance, _client);
- }
-}
-
-void routing_manager_impl::send_subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, major_version_t _major,
- event_t _event, subscription_type_e _subscription_type) {
- (void)_subscription_type;
- auto endpoint = find_local(_service, _instance);
- if (endpoint) {
- stub_->send_subscribe(endpoint, _client,
- _service, _instance, _eventgroup, _major, _event, DEFAULT_SUBSCRIPTION);
- }
-}
-
-void routing_manager_impl::set_routing_state(routing_state_e _routing_state) {
- if(discovery_) {
- switch (_routing_state) {
- case vsomeip::routing_state_e::RS_SUSPENDED:
- {
- VSOMEIP_INFO << "set routing to suspend mode";
- // stop processing of incoming SD messages
- discovery_->stop();
-
- // send StopOffer messages for remotely offered services on this node
- for (const auto &its_service : get_offered_services()) {
- for (const auto &its_instance : its_service.second) {
- its_instance.second->set_ttl(0);
- discovery_->stop_offer_service(its_service.first, its_instance.first, its_instance.second);
- }
- }
-
- // mark all external services as offline
- services_t its_remote_services;
- {
- std::lock_guard<std::mutex> its_lock(services_remote_mutex_);
- its_remote_services = services_remote_;
- }
- for (const auto &s : its_remote_services) {
- for (const auto &i : s.second) {
- // determine existing subscriptions to remote service and send StopSubscribe
- for (auto its_eventgroup : get_subscribed_eventgroups(s.first, i.first)) {
- discovery_->unsubscribe(s.first, i.first, its_eventgroup, VSOMEIP_ROUTING_CLIENT);
- auto specific_endpoint_clients = get_specific_endpoint_clients(s.first, i.first);
- for (auto its_client : specific_endpoint_clients) {
- discovery_->unsubscribe(s.first, i.first, its_eventgroup, its_client);
- }
- for (const auto &e : find_events(s.first, i.first, its_eventgroup)) {
- e->clear_subscribers();
- }
- }
-
- const bool has_reliable(i.second->get_endpoint(true));
- const bool has_unreliable(i.second->get_endpoint(false));
- del_routing_info(s.first, i.first, has_reliable, has_unreliable);
-
- // clear all cached payloads of remote services
- unset_all_eventpayloads(s.first, i.first);
- }
- }
- break;
- }
- case vsomeip::routing_state_e::RS_RESUMED:
- {
- VSOMEIP_INFO << "set routing to resume mode";
-
- // Reset relevant in service info
- for (const auto &its_service : get_offered_services()) {
- for (const auto &its_instance : its_service.second) {
- its_instance.second->set_ttl(DEFAULT_TTL);
- its_instance.second->set_is_in_mainphase(false);
- }
- }
- // start processing of SD messages (incoming remote offers should lead to new subscribe messages)
- discovery_->start();
-
- // Trigger initial offer phase for relevant services
- for (const auto &its_service : get_offered_services()) {
- for (const auto &its_instance : its_service.second) {
- discovery_->offer_service(its_service.first,
- its_instance.first, its_instance.second);
- }
- }
- break;
- }
- case routing_state_e::RS_DIAGNOSIS:
- {
- VSOMEIP_INFO << "set routing to diagnosis mode";
- discovery_->set_diagnosis_mode(true);
-
- // send StopOffer messages for all someip protocal services
- for (const auto &its_service : get_offered_services()) {
- for (const auto &its_instance : its_service.second) {
- if (host_->get_configuration()->is_someip(
- its_service.first, its_instance.first)) {
- its_instance.second->set_ttl(0);
- discovery_->stop_offer_service(
- its_service.first, its_instance.first, its_instance.second);
- }
- }
- }
- break;
- }
- case routing_state_e::RS_RUNNING:
- VSOMEIP_INFO << "set routing to running mode";
-
- // Reset relevant in service info
- for (const auto &its_service : get_offered_services()) {
- for (const auto &its_instance : its_service.second) {
- if (host_->get_configuration()->is_someip(
- its_service.first, its_instance.first)) {
- its_instance.second->set_ttl(DEFAULT_TTL);
- its_instance.second->set_is_in_mainphase(false);
- }
- }
- }
- // Switch SD back to normal operation
- discovery_->set_diagnosis_mode(false);
-
- // Trigger initial phase for relevant services
- for (const auto &its_service : get_offered_services()) {
- for (const auto &its_instance : its_service.second) {
- if (host_->get_configuration()->is_someip(
- its_service.first, its_instance.first)) {
- discovery_->offer_service(its_service.first,
- its_instance.first, its_instance.second);
- }
- }
- }
- break;
- default:
- break;
- }
- }
-}
-
-void routing_manager_impl::on_net_interface_or_route_state_changed(
- bool _is_interface, std::string _if, bool _available) {
- std::lock_guard<std::mutex> its_lock(pending_sd_offers_mutex_);
- auto log_change_message = [&_if, _available, _is_interface](bool _warning) {
- std::stringstream ss;
- ss << (_is_interface ? "Network interface" : "Route") << " \"" << _if
- << "\" state changed: " << (_available ? "up" : "down");
- if (_warning) {
- VSOMEIP_WARNING << ss.str();
- } else {
- VSOMEIP_INFO << ss.str();
- }
- };
- if (_is_interface) {
- if (if_state_running_
- || (_available && !if_state_running_ && routing_running_)) {
- log_change_message(true);
- } else if (!if_state_running_) {
- log_change_message(false);
- }
- if (_available && !if_state_running_) {
- if_state_running_ = true;
- if (!routing_running_) {
- if(configuration_->is_sd_enabled()) {
- if (sd_route_set_) {
- start_ip_routing();
- }
- } else {
- // Static routing, don't wait for route!
- start_ip_routing();
- }
- }
- }
- } else {
- if (sd_route_set_
- || (_available && !sd_route_set_ && routing_running_)) {
- log_change_message(true);
- } else if (!sd_route_set_) {
- log_change_message(false);
- }
- if (_available && !sd_route_set_) {
- sd_route_set_ = true;
- if (!routing_running_) {
- if (if_state_running_) {
- start_ip_routing();
- }
- }
- }
- }
-}
-
-void routing_manager_impl::start_ip_routing() {
- if (discovery_) {
- discovery_->start();
- } else {
- init_routing_info();
- }
-
- for (auto its_service : pending_sd_offers_) {
- init_service_info(its_service.first, its_service.second, true);
- }
- pending_sd_offers_.clear();
-
- routing_running_ = true;
- VSOMEIP_INFO << VSOMEIP_ROUTING_READY_MESSAGE;
-}
-
-void routing_manager_impl::requested_service_add(client_t _client,
- service_t _service,
- instance_t _instance,
- major_version_t _major,
- minor_version_t _minor) {
- std::lock_guard<std::mutex> ist_lock(requested_services_mutex_);
- requested_services_[_client][_service][_instance].insert({ _major, _minor });
-}
-
-void routing_manager_impl::requested_service_remove(client_t _client,
- service_t _service,
- instance_t _instance) {
- std::lock_guard<std::mutex> ist_lock(requested_services_mutex_);
- auto found_client = requested_services_.find(_client);
- if (found_client != requested_services_.end()) {
- auto found_service = found_client->second.find(_service);
- if (found_service != found_client->second.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- // delete all requested major/minor versions
- found_service->second.erase(_instance);
- if (!found_service->second.size()) {
- found_client->second.erase(_service);
- if (!found_client->second.size()) {
- requested_services_.erase(client_);
- }
- }
- }
- }
- }
-}
-
-std::set<eventgroup_t>
-routing_manager_impl::get_subscribed_eventgroups(
- service_t _service, instance_t _instance) {
- std::set<eventgroup_t> its_eventgroups;
-
- std::lock_guard<std::mutex> 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 (auto its_group : found_instance->second) {
- for (auto its_event : its_group.second->get_events()) {
- if (its_event->has_subscriber(its_group.first, ANY_CLIENT)) {
- its_eventgroups.insert(its_group.first);
- }
- }
- }
- }
- }
-
- return its_eventgroups;
-}
-
-void routing_manager_impl::call_sd_endpoint_connected(
- const boost::system::error_code& _error,
- service_t _service, instance_t _instance,
- std::shared_ptr<endpoint> _endpoint,
- std::shared_ptr<boost::asio::steady_timer> _timer) {
- (void)_timer;
- if (_error) {
- return;
- }
- _endpoint->set_connected(true);
- if (discovery_) {
- discovery_->on_endpoint_connected(_service, _instance,
- _endpoint);
- }
-}
-
-bool routing_manager_impl::create_placeholder_event_and_subscribe(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, client_t _client) {
- bool is_inserted(false);
- // we received a event which was not yet requested/offered
- // create a placeholder field until someone requests/offers this event with
- // full information like eventgroup, field or not etc.
- std::set<eventgroup_t> its_eventgroups({_eventgroup});
-
- const client_t its_local_client(find_local_client(_service, _instance));
- if (its_local_client == host_->get_client()) {
- // received subscription for event of a service instance hosted by
- // application acting as rm_impl register with own client id and shadow = false
- register_event(host_->get_client(), _service, _instance, _event,
- its_eventgroups, true, std::chrono::milliseconds::zero(), false,
- nullptr, false, false, true);
- } else if (its_local_client != VSOMEIP_ROUTING_CLIENT) {
- // received subscription for event of a service instance hosted on
- // this node register with client id of local_client and set shadow to true
- register_event(its_local_client, _service, _instance, _event,
- its_eventgroups, true, std::chrono::milliseconds::zero(), false,
- nullptr, false, true, true);
- } else {
- // received subscription for event of a unknown or remote service instance
- std::shared_ptr<serviceinfo> its_info = find_service(_service,
- _instance);
- if (its_info && !its_info->is_local()) {
- // remote service, register shadow event with client ID of subscriber
- // which should have called register_event
- register_event(_client, _service, _instance, _event,
- its_eventgroups, true, std::chrono::milliseconds::zero(),
- false, nullptr, false, true, true);
- } else {
- VSOMEIP_WARNING
- << "routing_manager_impl::create_placeholder_event_and_subscribe("
- << std::hex << std::setw(4) << std::setfill('0') << _client << "): ["
- << 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 << "]"
- << " received subscription for unknown service instance.";
- }
- }
-
- std::shared_ptr<event> its_event = find_event(_service, _instance, _event);
- if (its_event) {
- is_inserted = its_event->add_subscriber(_eventgroup, _client);
- }
- return is_inserted;
-}
-
-void routing_manager_impl::handle_subscription_state(client_t _client, service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event) {
-
- client_t subscriber = is_specific_endpoint_client(_client, _service, _instance);
- auto its_tuple = std::make_tuple(_service, _instance, _eventgroup, subscriber);
-
- std::lock_guard<std::mutex> its_lock(remote_subscription_state_mutex_);
- auto its_state = remote_subscription_state_.find(its_tuple);
- if (its_state != remote_subscription_state_.end()) {
- if (its_state->second == subscription_state_e::SUBSCRIPTION_ACKNOWLEDGED) {
- // Subscription already acknowledged!
- if (_client == get_client()) {
- host_->on_subscription_error(_service, _instance, _eventgroup, 0x0 /*OK*/);
- host_->on_subscription_status(_service, _instance, _eventgroup, _event, 0x0 /*OK*/);
- } else {
- stub_->send_subscribe_ack(_client, _service, _instance, _eventgroup, _event);
- }
- }
- } else {
- remote_subscription_state_[its_tuple] = subscription_state_e::IS_SUBSCRIBING;
- }
-}
-
-client_t routing_manager_impl::is_specific_endpoint_client(client_t _client,
- service_t _service, instance_t _instance) {
- client_t result = VSOMEIP_ROUTING_CLIENT;
- {
- std::lock_guard<std::mutex> its_lock(specific_endpoint_clients_mutex_);
- auto found_service = specific_endpoint_clients_.find(_service);
- if (found_service != specific_endpoint_clients_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_client = found_instance->second.find(_client);
- if(found_client != found_instance->second.end()) {
- result = _client;
- }
- }
- }
- }
- // A client_t != VSOMEIP_ROUTING_CLIENT implies true
- return result;
-}
-
-std::unordered_set<client_t> routing_manager_impl::get_specific_endpoint_clients(
- service_t _service, instance_t _instance) {
- std::unordered_set<client_t> result;
- {
- std::lock_guard<std::mutex> its_lock(specific_endpoint_clients_mutex_);
- auto found_service = specific_endpoint_clients_.find(_service);
- if (found_service != specific_endpoint_clients_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- result = found_instance->second;
- }
- }
- }
- return result;
-}
-
-void routing_manager_impl::send_initial_events(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- const std::shared_ptr<endpoint_definition> &_subscriber) {
- std::shared_ptr<eventgroupinfo> its_eventgroup = find_eventgroup(_service,
- _instance, _eventgroup);
- if (!its_eventgroup) {
- return;
- }
- bool is_offered_both(false);
- if (configuration_->get_reliable_port(_service, _instance) != ILLEGAL_PORT &&
- configuration_->get_unreliable_port(_service, _instance) != ILLEGAL_PORT) {
- is_offered_both = true;
- }
- // send initial events if we already have a cached field (is_set)
- for (const auto &its_event : its_eventgroup->get_events()) {
- if (its_event->is_field()) {
- if (its_event->is_set()) {
- if (!is_offered_both) {
- its_event->notify_one(_subscriber, true);
- } else {
- if (its_event->is_reliable() && _subscriber->is_reliable()) {
- its_event->notify_one(_subscriber, true);
- }
- if (!its_event->is_reliable() && !_subscriber->is_reliable()) {
- its_event->notify_one(_subscriber, true);
- }
- }
- } else {
- // received a subscription but can't notify due to missing payload
- its_event->set_remote_notification_pending(true);
- }
- }
- }
-}
-
-void routing_manager_impl::memory_log_timer_cbk(
- boost::system::error_code const & _error) {
- if (_error) {
- return;
- }
-#ifndef _WIN32
- static const std::uint32_t its_pagesize = getpagesize() / 1024;
-#else
- static const std::uint32_t its_pagesize = 4096 / 1024;
-#endif
- std::FILE *its_file = std::fopen("/proc/self/statm", "r");
- if (!its_file) {
- VSOMEIP_ERROR << "memory_log_timer_cbk: couldn't open:"
- << std::string(std::strerror(errno));
- return;
- }
- std::uint64_t its_size(0);
- std::uint64_t its_rsssize(0);
- std::uint64_t its_sharedpages(0);
- std::uint64_t its_text(0);
- std::uint64_t its_lib(0);
- std::uint64_t its_data(0);
- std::uint64_t its_dirtypages(0);
-
- if (EOF == std::fscanf(its_file, "%lu %lu %lu %lu %lu %lu %lu", &its_size,
- &its_rsssize, &its_sharedpages, &its_text, &its_lib,
- &its_data, &its_dirtypages)) {
- VSOMEIP_ERROR<< "memory_log_timer_cbk: error reading:"
- << std::string(std::strerror(errno));
- }
- std::fclose(its_file);
-#ifndef _WIN32
- struct timespec cputs, monots;
- clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &cputs);
- clock_gettime(CLOCK_MONOTONIC, &monots);
-#endif
-
- VSOMEIP_INFO << "memory usage: "
- << "VmSize " << std::dec << its_size * its_pagesize << " kB, "
- << "VmRSS " << std::dec << its_rsssize * its_pagesize << " kB, "
- << "shared pages " << std::dec << its_sharedpages * its_pagesize << " kB, "
- << "text " << std::dec << its_text * its_pagesize << " kB, "
- << "data " << std::dec << its_data * its_pagesize << " kB "
-#ifndef _WIN32
- << "| monotonic time: " << std::dec << monots.tv_sec << "."
- << std::dec << monots.tv_nsec << " cpu time: "
- << std::dec << cputs.tv_sec << "." << std::dec << cputs.tv_nsec
-#endif
- ;
-
- {
- std::lock_guard<std::mutex> its_lock(memory_log_timer_mutex_);
- boost::system::error_code ec;
- memory_log_timer_.expires_from_now(std::chrono::seconds(
- configuration_->get_log_memory_interval()), ec);
- memory_log_timer_.async_wait(
- std::bind(&routing_manager_impl::memory_log_timer_cbk, this,
- std::placeholders::_1));
- }
-}
-
-void routing_manager_impl::status_log_timer_cbk(
- boost::system::error_code const & _error) {
- if (_error) {
- return;
- }
-
- // local client endpoints
- {
- std::map<client_t, std::shared_ptr<endpoint>> lces = get_local_endpoints();
- VSOMEIP_INFO << "status local client endpoints: " << std::dec << lces.size();
- for (const auto lce : lces) {
- lce.second->print_status();
- }
- }
-
- // udp and tcp client endpoints
- {
- client_endpoints_by_ip_t client_endpoints_by_ip;
- remote_services_t remote_services;
- server_endpoints_t server_endpoints;
- {
- std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
- client_endpoints_by_ip = client_endpoints_by_ip_;
- remote_services = remote_services_;
- server_endpoints = server_endpoints_;
- }
- VSOMEIP_INFO << "status start remote client endpoints:";
- std::uint32_t num_remote_client_endpoints(0);
- // normal endpoints
- for (const auto &a : client_endpoints_by_ip) {
- for (const auto p : a.second) {
- for (const auto ru : p.second) {
- ru.second->print_status();
- num_remote_client_endpoints++;
- }
- }
- }
- VSOMEIP_INFO << "status end remote client endpoints: " << std::dec
- << num_remote_client_endpoints;
-
- // selective client endpoints
- VSOMEIP_INFO << "status start selective remote client endpoints:";
- std::uint32_t num_remote_selectiv_client_endpoints(0);
- for (const auto s : remote_services) {
- for (const auto i : s.second) {
- for (const auto c : i.second) {
- if (c.first != VSOMEIP_ROUTING_CLIENT) {
- for (const auto ur : c.second) {
- ur.second->print_status();
- num_remote_selectiv_client_endpoints++;
- }
- }
- }
- }
- }
- VSOMEIP_INFO << "status end selective remote client endpoints: "
- << std::dec << num_remote_selectiv_client_endpoints;
-
- VSOMEIP_INFO << "status start server endpoints:";
- std::uint32_t num_server_endpoints(1);
- // local server endpoints
- stub_->print_endpoint_status();
-
- // server endpoints
- for (const auto p : server_endpoints) {
- for (const auto ru : p.second ) {
- ru.second->print_status();
- num_server_endpoints++;
- }
- }
- VSOMEIP_INFO << "status end server endpoints:"
- << std::dec << num_server_endpoints;
- }
-
-
- {
- std::lock_guard<std::mutex> its_lock(status_log_timer_mutex_);
- boost::system::error_code ec;
- status_log_timer_.expires_from_now(std::chrono::seconds(
- configuration_->get_log_status_interval()), ec);
- status_log_timer_.async_wait(
- std::bind(&routing_manager_impl::status_log_timer_cbk, this,
- std::placeholders::_1));
- }
-}
-
-void routing_manager_impl::on_unsubscribe_ack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- pending_subscription_id_t _unsubscription_id) {
- std::shared_ptr<eventgroupinfo> its_eventgroup = find_eventgroup(_service,
- _instance, _eventgroup);
- if (!its_eventgroup) {
- VSOMEIP_ERROR << __func__ << ": Received UNSUBSCRIBE_ACK for unknown "
- << "eventgroup: ("
- << std::hex << std::setw(4) << std::setfill('0') << _client << "): ["
- << 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 << "]";
- return;
- }
- // there will only be one or zero subscriptions returned here
- std::vector<pending_subscription_t> its_pending_subscriptions =
- its_eventgroup->remove_pending_subscription(_unsubscription_id);
- for (const pending_subscription_t& its_sd_message_id : its_pending_subscriptions) {
- const pending_subscription_id_t its_subscription_id = its_sd_message_id.pending_subscription_id_;
- const client_t its_subscribing_client = its_sd_message_id.subscribing_client_;
- const client_t its_offering_client = find_local_client(_service, _instance);
- send_subscription(its_offering_client, its_subscribing_client, _service,
- _instance, _eventgroup, its_eventgroup->get_major(),
- its_subscription_id);
- }
-}
-
-void routing_manager_impl::send_unsubscription(
- client_t _offering_client, client_t _subscribing_client,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- pending_subscription_id_t _pending_unsubscription_id) {
- if (host_->get_client() == _offering_client) {
- auto self = shared_from_this();
- host_->on_subscription(_service, _instance, _eventgroup,
- _subscribing_client, false,
- [this, self, _service, _instance, _eventgroup,
- _subscribing_client, _pending_unsubscription_id, _offering_client]
- (const bool _subscription_accepted) {
- (void)_subscription_accepted;
- try {
- const auto its_callback = std::bind(
- &routing_manager_stub_host::on_unsubscribe_ack,
- std::dynamic_pointer_cast<routing_manager_stub_host>(shared_from_this()),
- _offering_client, _service, _instance,
- _eventgroup, _pending_unsubscription_id);
- io_.post(its_callback);
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << __func__ << e.what();
- }
- }
- );
- } else {
- stub_->send_unsubscribe(find_local(_offering_client),
- _subscribing_client,
- _service, _instance, _eventgroup, ANY_EVENT,
- _pending_unsubscription_id);
- }
-}
-
-void routing_manager_impl::send_subscription(
- client_t _offering_client, client_t _subscribing_client,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major,
- pending_subscription_id_t _pending_subscription_id) {
- if (host_->get_client() == _offering_client) {
- auto self = shared_from_this();
- host_->on_subscription(_service, _instance, _eventgroup,
- _subscribing_client, true,
- [this, self, _service, _instance,
- _eventgroup, _subscribing_client, _pending_subscription_id]
- (const bool _subscription_accepted) {
- try {
- if (!_subscription_accepted) {
- const auto its_callback = std::bind(
- &routing_manager_stub_host::on_subscribe_nack,
- std::dynamic_pointer_cast<routing_manager_stub_host>(shared_from_this()),
- _subscribing_client, _service, _instance,
- _eventgroup, ANY_EVENT, _pending_subscription_id);
- io_.post(its_callback);
- } else {
- const auto its_callback = std::bind(
- &routing_manager_stub_host::on_subscribe_ack,
- std::dynamic_pointer_cast<routing_manager_stub_host>(shared_from_this()),
- _subscribing_client, _service, _instance,
- _eventgroup, ANY_EVENT, _pending_subscription_id);
- io_.post(its_callback);
- }
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << __func__ << e.what();
- }
- });
- } else { // service hosted by local client
- stub_->send_subscribe(find_local(_offering_client),
- _subscribing_client,
- _service, _instance, _eventgroup,
- _major, ANY_EVENT,
- _pending_subscription_id);
- }
-}
-
-} // namespace vsomeip
diff --git a/implementation/routing/src/routing_manager_proxy.cpp b/implementation/routing/src/routing_manager_proxy.cpp
deleted file mode 100644
index ca046ed..0000000
--- a/implementation/routing/src/routing_manager_proxy.cpp
+++ /dev/null
@@ -1,2067 +0,0 @@
-// Copyright (C) 2014-2017 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 <climits>
-#include <iomanip>
-#include <mutex>
-#include <unordered_set>
-#include <future>
-#include <forward_list>
-
-#ifndef _WIN32
-// for umask
-#include <sys/types.h>
-#include <sys/stat.h>
-#endif
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/runtime.hpp>
-
-#include "../include/event.hpp"
-#include "../include/routing_manager_host.hpp"
-#include "../include/routing_manager_proxy.hpp"
-#include "../../configuration/include/configuration.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../endpoints/include/local_client_endpoint_impl.hpp"
-#include "../../endpoints/include/local_server_endpoint_impl.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-#include "../../service_discovery/include/runtime.hpp"
-#include "../../utility/include/byteorder.hpp"
-#include "../../utility/include/utility.hpp"
-
-namespace vsomeip {
-
-routing_manager_proxy::routing_manager_proxy(routing_manager_host *_host,
- bool _client_side_logging,
- const std::set<std::tuple<service_t, instance_t> > & _client_side_logging_filter) :
- routing_manager_base(_host),
- is_connected_(false),
- is_started_(false),
- state_(inner_state_type_e::ST_DEREGISTERED),
- sender_(0),
- receiver_(0),
- register_application_timer_(io_),
- logger_(logger::get()),
- request_debounce_timer_ (io_),
- request_debounce_timer_running_(false),
- client_side_logging_(_client_side_logging),
- client_side_logging_filter_(_client_side_logging_filter)
-{
-}
-
-routing_manager_proxy::~routing_manager_proxy() {
-}
-
-void routing_manager_proxy::init() {
- routing_manager_base::init();
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- sender_ = create_local(VSOMEIP_ROUTING_CLIENT);
- }
-
- init_receiver();
-}
-
-void routing_manager_proxy::start() {
- is_started_ = true;
-
- if (!receiver_) {
- // application has been stopped and started again
- init_receiver();
- }
- if (receiver_) {
- receiver_->start();
- }
-
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (!sender_) {
- // application has been stopped and started again
- sender_ = create_local(VSOMEIP_ROUTING_CLIENT);
- }
- if (sender_) {
- sender_->start();
- }
- }
-}
-
-void routing_manager_proxy::stop() {
- std::unique_lock<std::mutex> its_lock(state_mutex_);
- if (state_ == inner_state_type_e::ST_REGISTERING) {
- register_application_timer_.cancel();
- }
- while (state_ == inner_state_type_e::ST_REGISTERING) {
- std::cv_status status = state_condition_.wait_for(its_lock, std::chrono::milliseconds(1000));
- if (status == std::cv_status::timeout) {
- VSOMEIP_WARNING << std::hex << client_ << " registering timeout on stop";
- break;
- }
- }
-
- if (state_ == inner_state_type_e::ST_REGISTERED) {
- deregister_application();
- // Waiting de-register acknowledge to synchronize shutdown
- while (state_ == inner_state_type_e::ST_REGISTERED) {
- std::cv_status status = state_condition_.wait_for(its_lock, std::chrono::milliseconds(1000));
- if (status == std::cv_status::timeout) {
- VSOMEIP_WARNING << std::hex << client_ << " couldn't deregister application - timeout";
- break;
- }
- }
- }
- is_started_ = false;
- its_lock.unlock();
-
- {
- std::lock_guard<std::mutex> its_lock(request_timer_mutex_);
- request_debounce_timer_.cancel();
- }
-
- if (receiver_) {
- receiver_->stop();
- }
- receiver_ = nullptr;
-
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->stop();
- }
- // delete the sender
- sender_ = nullptr;
- }
-
- for (auto client: get_connected_clients()) {
- if (client != VSOMEIP_ROUTING_CLIENT) {
- remove_local(client);
- }
- }
-
- std::stringstream its_client;
- its_client << utility::get_base_path(configuration_) << std::hex << client_;
-#ifdef _WIN32
- ::_unlink(its_client.str().c_str());
-#else
- if (-1 == ::unlink(its_client.str().c_str())) {
- VSOMEIP_ERROR<< "routing_manager_proxy::stop unlink failed ("
- << its_client.str() << "): "<< std::strerror(errno);
- }
-#endif
-}
-
-const std::shared_ptr<configuration> routing_manager_proxy::get_configuration() const {
- return host_->get_configuration();
-}
-
-bool routing_manager_proxy::offer_service(client_t _client, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor) {
- if(!routing_manager_base::offer_service(_client, _service, _instance, _major, _minor)) {
- VSOMEIP_WARNING << "routing_manager_proxy::offer_service,"
- << "routing_manager_base::offer_service returned false";
- }
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- if (state_ == inner_state_type_e::ST_REGISTERED) {
- send_offer_service(_client, _service, _instance, _major, _minor);
- }
- service_data_t offer = { _service, _instance, _major, _minor, false };
- pending_offers_.insert(offer);
- }
- return true;
-}
-
-void routing_manager_proxy::send_offer_service(client_t _client,
- service_t _service, instance_t _instance, major_version_t _major,
- minor_version_t _minor) {
- (void)_client;
-
- byte_t its_command[VSOMEIP_OFFER_SERVICE_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_OFFER_SERVICE_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_OFFER_SERVICE;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &client_,
- sizeof(client_));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4] = _major;
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 5], &_minor,
- sizeof(_minor));
-
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
- }
-}
-
-void routing_manager_proxy::stop_offer_service(client_t _client,
- service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) {
- (void)_client;
-
- routing_manager_base::stop_offer_service(_client, _service, _instance, _major, _minor);
-
- // Reliable/Unreliable unimportant as routing_proxy does not
- // create server endpoints which needs to be freed
- clear_service_info(_service, _instance, false);
-
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- if (state_ == inner_state_type_e::ST_REGISTERED) {
- byte_t its_command[VSOMEIP_STOP_OFFER_SERVICE_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_STOP_OFFER_SERVICE_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_STOP_OFFER_SERVICE;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &client_,
- sizeof(client_));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4] = _major;
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 5], &_minor,
- sizeof(_minor));
-
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
- }
- }
- auto it = pending_offers_.begin();
- while (it != pending_offers_.end()) {
- if (it->service_ == _service
- && it->instance_ == _instance) {
- break;
- }
- it++;
- }
- if (it != pending_offers_.end()) pending_offers_.erase(it);
- }
-}
-
-void routing_manager_proxy::request_service(client_t _client,
- service_t _service, instance_t _instance, major_version_t _major,
- minor_version_t _minor, bool _use_exclusive_proxy) {
- routing_manager_base::request_service(_client, _service, _instance, _major,
- _minor, _use_exclusive_proxy);
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- size_t request_debouncing_time = configuration_->get_request_debouncing(host_->get_name());
- service_data_t request = { _service, _instance, _major, _minor, _use_exclusive_proxy };
- if (!request_debouncing_time) {
- if (state_ == inner_state_type_e::ST_REGISTERED) {
- std::set<service_data_t> requests;
- requests.insert(request);
- send_request_services(requests);
- }
- requests_.insert(request);
- } else {
- requests_to_debounce_.insert(request);
- std::lock_guard<std::mutex> its_lock(request_timer_mutex_);
- if (!request_debounce_timer_running_) {
- request_debounce_timer_running_ = true;
- request_debounce_timer_.expires_from_now(std::chrono::milliseconds(request_debouncing_time));
- request_debounce_timer_.async_wait(
- std::bind(
- &routing_manager_proxy::request_debounce_timeout_cbk,
- std::dynamic_pointer_cast<routing_manager_proxy>(shared_from_this()),
- std::placeholders::_1));
- }
- }
- }
-}
-
-void routing_manager_proxy::release_service(client_t _client,
- service_t _service, instance_t _instance) {
- routing_manager_base::release_service(_client, _service, _instance);
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- remove_pending_subscription(_service, _instance, 0xFFFF, ANY_EVENT);
-
- bool pending(false);
- auto it = requests_to_debounce_.begin();
- while (it != requests_to_debounce_.end()) {
- if (it->service_ == _service
- && it->instance_ == _instance) {
- pending = true;
- }
- it++;
- }
- if (it != requests_to_debounce_.end()) requests_to_debounce_.erase(it);
-
- if (!pending && state_ == inner_state_type_e::ST_REGISTERED) {
- send_release_service(_client, _service, _instance);
- }
-
- {
- auto it = requests_.begin();
- while (it != requests_.end()) {
- if (it->service_ == _service
- && it->instance_ == _instance) {
- break;
- }
- it++;
- }
- if (it != requests_.end()) requests_.erase(it);
- }
- }
-}
-
-void routing_manager_proxy::register_event(client_t _client,
- service_t _service, instance_t _instance,
- event_t _event, const std::set<eventgroup_t> &_eventgroups,
- bool _is_field,
- std::chrono::milliseconds _cycle, bool _change_resets_cycle,
- epsilon_change_func_t _epsilon_change_func,
- bool _is_provided, bool _is_shadow, bool _is_cache_placeholder) {
- (void)_is_shadow;
- (void)_is_cache_placeholder;
-
- const event_data_t registration = {
- _service,
- _instance,
- _event,
- _is_field,
- _is_provided,
- _eventgroups
- };
- bool is_first(false);
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- is_first = pending_event_registrations_.find(registration)
- == pending_event_registrations_.end();
- if (is_first) {
- pending_event_registrations_.insert(registration);
- }
- }
- if (is_first) {
- routing_manager_base::register_event(_client, _service, _instance,
- _event,_eventgroups, _is_field,
- _cycle, _change_resets_cycle,
- _epsilon_change_func,
- _is_provided);
- }
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- if (state_ == inner_state_type_e::ST_REGISTERED && is_first) {
- send_register_event(client_, _service, _instance,
- _event, _eventgroups, _is_field, _is_provided);
- }
- }
-
- if(_is_provided) {
- VSOMEIP_INFO << "REGISTER EVENT("
- << std::hex << std::setw(4) << std::setfill('0') << _client << "): ["
- << 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') << _event
- << ":is_provider=" << _is_provided << "]";
- }
-}
-
-void routing_manager_proxy::unregister_event(client_t _client,
- service_t _service, instance_t _instance, event_t _event,
- bool _is_provided) {
-
- routing_manager_base::unregister_event(_client, _service, _instance,
- _event, _is_provided);
-
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- if (state_ == inner_state_type_e::ST_REGISTERED) {
- byte_t its_command[VSOMEIP_UNREGISTER_EVENT_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_UNREGISTER_EVENT_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_UNREGISTER_EVENT;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &client_,
- sizeof(client_));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_event,
- sizeof(_event));
- its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6]
- = static_cast<byte_t>(_is_provided);
-
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
- }
- }
- auto it = pending_event_registrations_.begin();
- while (it != pending_event_registrations_.end()) {
- if (it->service_ == _service
- && it->instance_ == _instance
- && it->event_ == _event) {
- break;
- }
- it++;
- }
- if (it != pending_event_registrations_.end())
- pending_event_registrations_.erase(it);
- }
-}
-
-bool routing_manager_proxy::is_field(service_t _service, instance_t _instance,
- event_t _event) const {
- auto event = find_event(_service, _instance, _event);
- if (event && event->is_field()) {
- return true;
- }
- return false;
-}
-
-void routing_manager_proxy::subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, major_version_t _major,
- event_t _event, subscription_type_e _subscription_type) {
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- if (state_ == inner_state_type_e::ST_REGISTERED && is_available(_service, _instance, _major)) {
- send_subscribe(_client, _service, _instance, _eventgroup, _major,
- _event, _subscription_type);
- }
- subscription_data_t subscription = { _service, _instance, _eventgroup, _major,
- _event, _subscription_type};
- pending_subscriptions_.insert(subscription);
- }
-}
-
-void routing_manager_proxy::send_subscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, major_version_t _major,
- event_t _event, subscription_type_e _subscription_type) {
- (void)_client;
-
- byte_t its_command[VSOMEIP_SUBSCRIBE_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_SUBSCRIBE_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_SUBSCRIBE;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &_client,
- sizeof(_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_eventgroup,
- sizeof(_eventgroup));
- its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6] = _major;
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 7], &_event,
- sizeof(_event));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 9], &_subscription_type,
- sizeof(_subscription_type));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 10], &DEFAULT_SUBSCRIPTION,
- sizeof(DEFAULT_SUBSCRIPTION)); // local subscription
-
- client_t target_client = find_local_client(_service, _instance);
- if (target_client != VSOMEIP_ROUTING_CLIENT) {
- auto its_target = find_or_create_local(target_client);
- its_target->send(its_command, sizeof(its_command));
- } else {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
- }
-}
-
-void routing_manager_proxy::send_subscribe_nack(client_t _subscriber,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, pending_subscription_id_t _subscription_id) {
- byte_t its_command[VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- client_t its_client = get_client();
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_SUBSCRIBE_NACK;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &its_client,
- sizeof(its_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_eventgroup,
- sizeof(_eventgroup));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6], &_subscriber,
- sizeof(_subscriber));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 8], &_event,
- sizeof(_event));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 10],
- &_subscription_id, sizeof(_subscription_id));
-
- if (_subscriber != VSOMEIP_ROUTING_CLIENT
- && _subscription_id == DEFAULT_SUBSCRIPTION) {
- auto its_target = find_local(_subscriber);
- if (its_target) {
- its_target->send(its_command, sizeof(its_command));
- return;
- }
- }
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
- }
-}
-
-void routing_manager_proxy::send_subscribe_ack(client_t _subscriber,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, pending_subscription_id_t _subscription_id) {
- byte_t its_command[VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- client_t its_client = get_client();
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_SUBSCRIBE_ACK;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &its_client,
- sizeof(its_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_eventgroup,
- sizeof(_eventgroup));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6], &_subscriber,
- sizeof(_subscriber));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 8], &_event,
- sizeof(_event));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 10],
- &_subscription_id, sizeof(_subscription_id));
-
- if (_subscriber != VSOMEIP_ROUTING_CLIENT
- && _subscription_id == DEFAULT_SUBSCRIPTION) {
- auto its_target = find_local(_subscriber);
- if (its_target) {
- its_target->send(its_command, sizeof(its_command));
- return;
- }
- }
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
- }
-}
-
-void routing_manager_proxy::unsubscribe(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event) {
- (void)_client;
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- remove_pending_subscription(_service, _instance, _eventgroup, _event);
-
- if (state_ == inner_state_type_e::ST_REGISTERED) {
- byte_t its_command[VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_UNSUBSCRIBE;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &_client,
- sizeof(_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_eventgroup,
- sizeof(_eventgroup));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6], &_event,
- sizeof(_event));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 8], &DEFAULT_SUBSCRIPTION,
- sizeof(DEFAULT_SUBSCRIPTION)); // is_local
-
- auto its_target = find_local(_service, _instance);
- if (its_target) {
- its_target->send(its_command, sizeof(its_command));
- } else {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
- }
- }
- }
-}
-
-bool routing_manager_proxy::send(client_t _client, const byte_t *_data,
- length_t _size, instance_t _instance,
- bool _flush,
- bool _reliable,
- bool _is_valid_crc) {
- (void)_client;
- bool is_sent(false);
- bool has_remote_subscribers(false);
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- if (state_ != inner_state_type_e::ST_REGISTERED) {
- return false;
- }
- }
- 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]);
- 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]);
- VSOMEIP_INFO << "routing_manager_proxy::send: ("
- << std::hex << std::setw(4) << std::setfill('0') << client_ <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << ":"
- << std::hex << std::setw(4) << std::setfill('0') << its_session << ":"
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "] "
- << "type=" << std::hex << static_cast<std::uint32_t>(_data[VSOMEIP_MESSAGE_TYPE_POS])
- << " thread=" << std::hex << std::this_thread::get_id();
- }
- } else {
- VSOMEIP_ERROR << "routing_manager_proxy::send: ("
- << std::hex << std::setw(4) << std::setfill('0') << client_
- <<"): message too short to log: " << std::dec << _size;
- }
- }
- if (_size > VSOMEIP_MESSAGE_TYPE_POS) {
- std::shared_ptr<endpoint> 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]);
- client_t its_client = find_local_client(its_service, _instance);
- if (its_client != VSOMEIP_ROUTING_CLIENT) {
- if (is_client_known(its_client)) {
- its_target = find_or_create_local(its_client);
- }
- }
- } 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]);
- if (its_client != VSOMEIP_ROUTING_CLIENT) {
- if (is_client_known(its_client)) {
- its_target = find_or_create_local(its_client);
- }
- }
- } else if (utility::is_notification(_data[VSOMEIP_MESSAGE_TYPE_POS]) &&
- _client == VSOMEIP_ROUTING_CLIENT) {
- // notify
- has_remote_subscribers = send_local_notification(get_client(), _data, _size,
- _instance, _flush, _reliable, _is_valid_crc);
- } else if (utility::is_notification(_data[VSOMEIP_MESSAGE_TYPE_POS]) &&
- _client != VSOMEIP_ROUTING_CLIENT) {
- // notify_one
- its_target = find_local(_client);
- if (its_target) {
-#ifdef USE_DLT
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- if (its_header.prepare(nullptr, true, _instance))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- _data, its_data_size);
-#endif
- return send_local(its_target, get_client(), _data, _size,
- _instance, _flush, _reliable, VSOMEIP_SEND, _is_valid_crc);
- }
- }
- // If no direct endpoint could be found
- // or for notifications ~> route to routing_manager_stub
-#ifdef USE_DLT
- bool message_to_stub(false);
-#endif
- if (!its_target) {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- its_target = sender_;
-#ifdef USE_DLT
- message_to_stub = true;
-#endif
- } else {
- return false;
- }
- }
-
- bool send(true);
- uint8_t command = VSOMEIP_SEND;
-
- if (utility::is_notification(_data[VSOMEIP_MESSAGE_TYPE_POS])) {
- if (_client != VSOMEIP_ROUTING_CLIENT) {
- command = VSOMEIP_NOTIFY_ONE;
- } else {
- command = VSOMEIP_NOTIFY;
- // Do we need to deliver a notification to the routing manager?
- // Only for services which already have remote clients subscribed to
- send = has_remote_subscribers;
- }
- }
-#ifdef USE_DLT
- else if (!message_to_stub) {
- const uint16_t its_data_size
- = uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
-
- tc::trace_header its_header;
- if (its_header.prepare(nullptr, true, _instance))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- _data, its_data_size);
- }
-#endif
- if (send) {
- is_sent = send_local(its_target,
- (command == VSOMEIP_NOTIFY_ONE ? _client : get_client()),
- _data, _size, _instance, _flush, _reliable, command, _is_valid_crc);
- }
- }
- return (is_sent);
-}
-
-bool routing_manager_proxy::send_to(
- const std::shared_ptr<endpoint_definition> &_target,
- std::shared_ptr<message> _message,
- bool _flush) {
- (void)_target;
- (void)_message;
- (void)_flush;
- return (false);
-}
-
-bool routing_manager_proxy::send_to(
- const std::shared_ptr<endpoint_definition> &_target,
- const byte_t *_data, uint32_t _size, instance_t _instance,
- bool _flush) {
- (void)_target;
- (void)_data;
- (void)_size;
- (void)_instance;
- (void)_flush;
- return (false);
-}
-
-void routing_manager_proxy::on_connect(std::shared_ptr<endpoint> _endpoint) {
- _endpoint->set_connected(true);
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (_endpoint != sender_) {
- return;
- }
- }
- is_connected_ = true;
- if (is_connected_ && is_started_) {
- VSOMEIP_INFO << std::hex << "Client " << client_
- << " successfully connected to routing ~> registering..";
- register_application();
- }
-}
-
-void routing_manager_proxy::on_disconnect(std::shared_ptr<endpoint> _endpoint) {
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- is_connected_ = !(_endpoint == sender_);
- }
- if (!is_connected_) {
- VSOMEIP_INFO << "routing_manager_proxy::on_disconnect: Client 0x" << std::hex
- << get_client() << " calling host_->on_state "
- << "with DEREGISTERED";
- host_->on_state(state_type_e::ST_DEREGISTERED);
- }
-}
-
-void routing_manager_proxy::on_error(
- const byte_t *_data, length_t _length, endpoint *_receiver,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port) {
-
- // Implement me when needed
-
- (void)(_data);
- (void)(_length);
- (void)(_receiver);
- (void)(_remote_address);
- (void)(_remote_port);
-}
-
-void routing_manager_proxy::release_port(uint16_t _port, bool _reliable) {
- (void)_port;
- (void)_reliable;
- // intentionally empty
-}
-
-void routing_manager_proxy::on_message(const byte_t *_data, length_t _size,
- endpoint *_receiver, const boost::asio::ip::address &_destination,
- client_t _bound_client,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port) {
- (void)_receiver;
- (void)_destination;
- (void)_remote_address;
- (void)_remote_port;
-#if 0
- std::stringstream msg;
- msg << "rmp::on_message: ";
- for (length_t i = 0; i < _size; ++i)
- msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- byte_t its_command;
- client_t its_client;
- length_t its_length;
- service_t its_service;
- instance_t its_instance;
- eventgroup_t its_eventgroup;
- event_t its_event;
- major_version_t its_major;
- client_t routing_host_id = configuration_->get_id(configuration_->get_routing_host());
- client_t its_subscriber;
- bool its_reliable;
- pending_subscription_id_t its_subscription_id(DEFAULT_SUBSCRIPTION);
- std::uint32_t its_remote_subscriber_count(0);
-
- if (_size > VSOMEIP_COMMAND_SIZE_POS_MAX) {
- its_command = _data[VSOMEIP_COMMAND_TYPE_POS];
- std::memcpy(&its_client, &_data[VSOMEIP_COMMAND_CLIENT_POS],
- sizeof(its_client));
- std::memcpy(&its_length, &_data[VSOMEIP_COMMAND_SIZE_POS_MIN],
- sizeof(its_length));
-
- if (configuration_->is_security_enabled() && _bound_client != routing_host_id &&
- _bound_client != its_client) {
- VSOMEIP_WARNING << std::hex << "Client " << std::setw(4) << std::setfill('0') << get_client()
- << " received a message with command " << (uint32_t)its_command
- << " from " << std::setw(4) << std::setfill('0')
- << its_client << " which doesn't match the bound client "
- << std::setw(4) << std::setfill('0') << _bound_client
- << " ~> skip message!";
- return;
- }
-
- switch (its_command) {
- case VSOMEIP_SEND: {
- instance_t its_instance;
- std::memcpy(&its_instance,
- &_data[_size - sizeof(instance_t) - sizeof(bool)
- - sizeof(bool) - sizeof(bool)], sizeof(instance_t));
- bool its_reliable;
- std::memcpy(&its_reliable, &_data[_size - sizeof(bool) - sizeof(bool)],
- sizeof(its_reliable));
- bool its_is_vslid_crc;
- std::memcpy(&its_is_vslid_crc, &_data[_size - sizeof(bool)],
- sizeof(its_is_vslid_crc));
-
- // reduce by size of instance, flush, reliable and is_valid_crc flag
- const std::uint32_t its_message_size = its_length -
- static_cast<uint32_t>(sizeof(its_instance)
- + sizeof(bool) + sizeof(bool) + sizeof(bool));
-
- auto a_deserializer = get_deserializer();
- a_deserializer->set_data(&_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- its_message_size);
- std::shared_ptr<message> its_message(a_deserializer->deserialize_message());
- a_deserializer->reset();
- put_deserializer(a_deserializer);
-
- if (its_message) {
- its_message->set_instance(its_instance);
- its_message->set_reliable(its_reliable);
- its_message->set_is_valid_crc(its_is_vslid_crc);
- if (utility::is_notification(its_message->get_message_type())) {
- if (!configuration_->is_client_allowed(get_client(), its_message->get_service(),
- its_message->get_instance())) {
- VSOMEIP_WARNING << std::hex << "Security: Client 0x" << get_client()
- << " isn't allow receive a notification from to service/instance "
- << its_message->get_service() << "/" << its_message->get_instance()
- << " respectively from client 0x" << its_client
- << " : Skip message!";
- return;
- }
- cache_event_payload(its_message);
- } else if (utility::is_request(its_message->get_message_type())) {
- if (!configuration_->is_client_allowed(its_message->get_client(),
- its_message->get_service(), its_message->get_instance())) {
- VSOMEIP_WARNING << std::hex << "Security: Client 0x" << its_message->get_client()
- << " isn't allow to send a request to service/instance "
- << its_message->get_service() << "/" << its_message->get_instance()
- << " : Skip message!";
- return;
- }
- } else { // response
- if (!configuration_->is_client_allowed(get_client(), its_message->get_service(),
- its_message->get_instance())) {
- VSOMEIP_WARNING << std::hex << "Security: Client 0x" << get_client()
- << " isn't allow receive a response from to service/instance "
- << its_message->get_service() << "/" << its_message->get_instance()
- << " respectively from client 0x" << its_client
- << " : Skip message!";
- return;
- }
- }
-#ifdef USE_DLT
- if (client_side_logging_
- && (client_side_logging_filter_.empty()
- || (1 == client_side_logging_filter_.count(std::make_tuple(its_message->get_service(), ANY_INSTANCE)))
- || (1 == client_side_logging_filter_.count(std::make_tuple(its_message->get_service(), its_message->get_instance()))))) {
- tc::trace_header its_header;
- if (its_header.prepare(nullptr, false, its_instance))
- tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- static_cast<std::uint16_t>(its_message_size));
- }
-#endif
- host_->on_message(std::move(its_message));
- } else {
- VSOMEIP_ERROR << "Routing proxy: on_message: "
- << "SomeIP-Header deserialization failed!";
- }
- }
- break;
-
- case VSOMEIP_ROUTING_INFO:
- if (!configuration_->is_security_enabled() ||_bound_client == routing_host_id) {
- on_routing_info(&_data[VSOMEIP_COMMAND_PAYLOAD_POS], its_length);
- } else {
- VSOMEIP_WARNING << std::hex << "Security: Client 0x" << get_client()
- << " received an routing info from a client which isn't the routing manager"
- << " : Skip message!";
- }
- break;
-
- case VSOMEIP_PING:
- send_pong();
- VSOMEIP_TRACE << "PING("
- << std::hex << std::setw(4) << std::setfill('0') << client_ << ")";
- break;
-
- case VSOMEIP_SUBSCRIBE:
- if (_size != VSOMEIP_SUBSCRIBE_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a SUBSCRIBE command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_eventgroup, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_eventgroup));
- std::memcpy(&its_major, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(its_major));
- std::memcpy(&its_event, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 7],
- sizeof(its_event));
- std::memcpy(&its_subscription_id, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 10],
- sizeof(its_subscription_id));
- {
- std::unique_lock<std::recursive_mutex> its_lock(incoming_subscriptions_mutex_);
- if (its_subscription_id != DEFAULT_SUBSCRIPTION) {
- its_lock.unlock();
- // Remote subscriber: Notify routing manager initially + count subscribes
- auto self = shared_from_this();
- host_->on_subscription(its_service, its_instance, its_eventgroup,
- its_client, true,
- [this, self, its_client, its_service, its_instance,
- its_eventgroup, its_event, its_subscription_id, its_major]
- (const bool _subscription_accepted){
- if(_subscription_accepted) {
- send_subscribe_ack(its_client, its_service, its_instance,
- its_eventgroup, its_event, its_subscription_id);
- } else {
- send_subscribe_nack(its_client, its_service, its_instance,
- its_eventgroup, its_event, its_subscription_id);
- }
- std::set<event_t> its_already_subscribed_events;
- bool inserted = insert_subscription(its_service, its_instance, its_eventgroup,
- its_event, VSOMEIP_ROUTING_CLIENT, &its_already_subscribed_events);
- if (inserted) {
- notify_remote_initially(its_service, its_instance, its_eventgroup,
- its_already_subscribed_events);
- }
- std::uint32_t its_count = get_remote_subscriber_count(
- its_service, its_instance, its_eventgroup, true);
- VSOMEIP_INFO << "SUBSCRIBE("
- << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_eventgroup << ":"
- << std::hex << std::setw(4) << std::setfill('0') << its_event << ":"
- << std::dec << (uint16_t)its_major << "]"
- << (bool)(its_subscription_id != DEFAULT_SUBSCRIPTION) << " "
- << std::dec << its_count;
- });
- } else if (is_client_known(its_client)) {
- its_lock.unlock();
- if (!configuration_->is_client_allowed(its_client,
- its_service, its_instance)) {
- VSOMEIP_WARNING << "Security: Client " << std::hex
- << its_client << " subscribes to service/instance "
- << its_service << "/" << its_instance
- << " which violates the security policy ~> Skip subscribe!";
- return;
- }
-
- // Local & already known subscriber: create endpoint + send (N)ACK + insert subscription
- (void) find_or_create_local(its_client);
- auto self = shared_from_this();
- host_->on_subscription(its_service, its_instance,
- its_eventgroup, its_client, true,
- [this, self, its_client, its_service, its_instance, its_eventgroup,
- its_event, its_major]
- (const bool _subscription_accepted) {
- if (!_subscription_accepted) {
- send_subscribe_nack(its_client, its_service,
- its_instance, its_eventgroup, its_event, DEFAULT_SUBSCRIPTION);
- } else {
- send_subscribe_ack(its_client, its_service, its_instance,
- its_eventgroup, its_event, DEFAULT_SUBSCRIPTION);
- routing_manager_base::subscribe(its_client, its_service, its_instance,
- its_eventgroup, its_major, its_event,
- subscription_type_e::SU_RELIABLE_AND_UNRELIABLE);
- send_pending_notify_ones(its_service, its_instance, its_eventgroup, its_client);
- }
- });
- } else {
- // Local & not yet known subscriber ~> set pending until subscriber gets known!
- subscription_data_t subscription = { its_service, its_instance,
- its_eventgroup, its_major, its_event,
- subscription_type_e::SU_RELIABLE_AND_UNRELIABLE};
- pending_incoming_subscripitons_[its_client].insert(subscription);
- }
- }
- if (its_subscription_id == DEFAULT_SUBSCRIPTION) { // local subscription
- VSOMEIP_INFO << "SUBSCRIBE("
- << std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_eventgroup << ":"
- << std::hex << std::setw(4) << std::setfill('0') << its_event << ":"
- << std::dec << (uint16_t)its_major << "]";
- }
- break;
-
- case VSOMEIP_UNSUBSCRIBE:
- if (_size != VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received an UNSUBSCRIBE command with wrong ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_eventgroup, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_eventgroup));
- std::memcpy(&its_event, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(its_event));
- std::memcpy(&its_subscription_id, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 8],
- sizeof(its_subscription_id));
- host_->on_subscription(its_service, its_instance, its_eventgroup, its_client, false, [](const bool _subscription_accepted){ (void)_subscription_accepted; });
- if (its_subscription_id == DEFAULT_SUBSCRIPTION) {
- // Local subscriber: withdraw subscription
- routing_manager_base::unsubscribe(its_client, its_service, its_instance, its_eventgroup, its_event);
- } else {
- // Remote subscriber: withdraw subscription only if no more remote subscriber exists
- its_remote_subscriber_count = get_remote_subscriber_count(its_service,
- its_instance, its_eventgroup, false);
- if (!its_remote_subscriber_count) {
- routing_manager_base::unsubscribe(VSOMEIP_ROUTING_CLIENT, its_service,
- its_instance, its_eventgroup, its_event);
- }
- send_unsubscribe_ack(its_service, its_instance, its_eventgroup,
- its_subscription_id);
- }
- VSOMEIP_INFO << "UNSUBSCRIBE("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_eventgroup << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_event << "] "
- << (bool)(its_subscription_id != DEFAULT_SUBSCRIPTION) << " "
- << std::dec << its_remote_subscriber_count;
- break;
-
- case VSOMEIP_SUBSCRIBE_NACK:
- if (_size != VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a VSOMEIP_SUBSCRIBE_NACK command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_eventgroup, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_eventgroup));
- std::memcpy(&its_subscriber, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(its_subscriber));
- std::memcpy(&its_event, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 8],
- sizeof(its_event));
-
- on_subscribe_nack(its_subscriber, its_service, its_instance, its_eventgroup, its_event);
- VSOMEIP_INFO << "SUBSCRIBE NACK("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_eventgroup << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_event << "]";
- break;
-
- case VSOMEIP_SUBSCRIBE_ACK:
- if (_size != VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a VSOMEIP_SUBSCRIBE_ACK command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_eventgroup, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_eventgroup));
- std::memcpy(&its_subscriber, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(its_subscriber));
- std::memcpy(&its_event, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 8],
- sizeof(its_event));
-
- on_subscribe_ack(its_subscriber, its_service, its_instance, its_eventgroup, its_event);
- VSOMEIP_INFO << "SUBSCRIBE ACK("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_eventgroup << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_event << "]";
- break;
-
- case VSOMEIP_ID_REQUEST:
- if (_size < VSOMEIP_ID_REQUEST_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a VSOMEIP_ID_REQUEST command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_major, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_major));
- std::memcpy(&its_reliable, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 5],
- sizeof(its_reliable));
-
- send_identify_request(its_service, its_instance, its_major, its_reliable);
-
- break;
-
- case VSOMEIP_OFFERED_SERVICES_RESPONSE:
- if (!configuration_->is_security_enabled() ||_bound_client == routing_host_id) {
- on_offered_services_info(&_data[VSOMEIP_COMMAND_PAYLOAD_POS], its_length);
- } else {
- VSOMEIP_WARNING << std::hex << "Security: Client 0x" << get_client()
- << " received an offered services info from a client which isn't the routing manager"
- << " : Skip message!";
- }
- break;
-
- default:
- break;
- }
- }
-}
-
-void routing_manager_proxy::on_routing_info(const byte_t *_data,
- uint32_t _size) {
-#if 0
- std::stringstream msg;
- msg << "rmp::on_routing_info(" << std::hex << 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
-
- uint32_t i = 0;
- while (i + sizeof(uint32_t) + sizeof(routing_info_entry_e) <= _size) {
- routing_info_entry_e routing_info_entry;
- std::memcpy(&routing_info_entry, &_data[i], sizeof(routing_info_entry_e));
- i += uint32_t(sizeof(routing_info_entry_e));
-
- uint32_t its_client_size;
- std::memcpy(&its_client_size, &_data[i], sizeof(uint32_t));
- i += uint32_t(sizeof(uint32_t));
-
- if (its_client_size + i > _size) {
- VSOMEIP_WARNING << "Client 0x" << std::hex << get_client() << " : "
- << "Processing of routing info failed due to bad length fields!";
- return;
- }
-
- if (i + sizeof(client_t) <= _size) {
- client_t its_client;
- std::memcpy(&its_client, &_data[i], sizeof(client_t));
- i += uint32_t(sizeof(client_t));
-
- if (routing_info_entry == routing_info_entry_e::RIE_ADD_CLIENT) {
- {
- std::lock_guard<std::mutex> its_lock(known_clients_mutex_);
- known_clients_.insert(its_client);
- }
- if (its_client == get_client()) {
- VSOMEIP_INFO << std::hex << "Application/Client " << get_client()
- << " is registered.";
-
- // inform host about its own registration state changes
- host_->on_state(static_cast<state_type_e>(inner_state_type_e::ST_REGISTERED));
-
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- boost::system::error_code ec;
- register_application_timer_.cancel(ec);
- send_registered_ack();
- send_pending_commands();
- state_ = inner_state_type_e::ST_REGISTERED;
- // Notify stop() call about clean deregistration
- state_condition_.notify_one();
- }
- }
- } else if (routing_info_entry == routing_info_entry_e::RIE_DEL_CLIENT) {
- {
- std::lock_guard<std::mutex> its_lock(known_clients_mutex_);
- known_clients_.erase(its_client);
- }
- if (its_client == get_client()) {
- VSOMEIP_INFO << std::hex << "Application/Client " << get_client()
- << " is deregistered.";
-
- // inform host about its own registration state changes
- host_->on_state(static_cast<state_type_e>(inner_state_type_e::ST_DEREGISTERED));
-
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- state_ = inner_state_type_e::ST_DEREGISTERED;
- // Notify stop() call about clean deregistration
- state_condition_.notify_one();
- }
- } else if (its_client != VSOMEIP_ROUTING_CLIENT) {
- remove_local(its_client);
- }
- }
-
- uint32_t j = 0;
- while (j + sizeof(uint32_t) <= its_client_size) {
- uint32_t its_services_size;
- std::memcpy(&its_services_size, &_data[i + j], sizeof(uint32_t));
- j += uint32_t(sizeof(uint32_t));
-
- if (its_services_size >= sizeof(service_t) + sizeof(instance_t) + sizeof(major_version_t) + sizeof(minor_version_t)) {
- its_services_size -= uint32_t(sizeof(service_t));
-
- service_t its_service;
- std::memcpy(&its_service, &_data[i + j], sizeof(service_t));
- j += uint32_t(sizeof(service_t));
-
- while (its_services_size >= sizeof(instance_t) + sizeof(major_version_t) + sizeof(minor_version_t)) {
- instance_t its_instance;
- std::memcpy(&its_instance, &_data[i + j], sizeof(instance_t));
- j += uint32_t(sizeof(instance_t));
-
- major_version_t its_major;
- std::memcpy(&its_major, &_data[i + j], sizeof(major_version_t));
- j += uint32_t(sizeof(major_version_t));
-
- minor_version_t its_minor;
- std::memcpy(&its_minor, &_data[i + j], sizeof(minor_version_t));
- j += uint32_t(sizeof(minor_version_t));
-
- if (routing_info_entry == routing_info_entry_e::RIE_ADD_SERVICE_INSTANCE) {
- {
- std::lock_guard<std::mutex> its_lock(known_clients_mutex_);
- known_clients_.insert(its_client);
- }
- {
- std::lock_guard<std::mutex> its_lock(local_services_mutex_);
- local_services_[its_service][its_instance] = std::make_tuple(its_major, its_minor, its_client);
- }
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- send_pending_subscriptions(its_service, its_instance, its_major);
- }
- host_->on_availability(its_service, its_instance, true, its_major, its_minor);
- VSOMEIP_INFO << "ON_AVAILABLE("
- << std::hex << std::setw(4) << std::setfill('0') << get_client() <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance
- << ":" << std::dec << int(its_major) << "." << std::dec << its_minor << "]";
- } else if (routing_info_entry == routing_info_entry_e::RIE_DEL_SERVICE_INSTANCE) {
- {
- std::lock_guard<std::mutex> its_lock(local_services_mutex_);
- auto found_service = local_services_.find(its_service);
- if (found_service != local_services_.end()) {
- found_service->second.erase(its_instance);
- if (found_service->second.size() == 0) {
- local_services_.erase(its_service);
- }
- }
- }
- on_stop_offer_service(its_service, its_instance, its_major, its_minor);
- host_->on_availability(its_service, its_instance, false, its_major, its_minor);
- VSOMEIP_INFO << "ON_UNAVAILABLE("
- << std::hex << std::setw(4) << std::setfill('0') << get_client() <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance
- << ":" << std::dec << int(its_major) << "." << std::dec << its_minor << "]";
- }
-
- its_services_size -= uint32_t(sizeof(instance_t) + sizeof(major_version_t) + sizeof(minor_version_t) );
- }
- }
- }
-
- i += j;
- }
- }
- {
- struct subscription_info {
- service_t service_id_;
- instance_t instance_id_;
- eventgroup_t eventgroup_id_;
- client_t client_id_;
- major_version_t major_;
- event_t event_;
- };
- std::lock_guard<std::recursive_mutex> its_lock(incoming_subscriptions_mutex_);
- std::forward_list<struct subscription_info> subscription_actions;
- if (pending_incoming_subscripitons_.size()) {
- {
- std::lock_guard<std::mutex> its_lock(known_clients_mutex_);
- for (const client_t client : known_clients_) {
- auto its_client = pending_incoming_subscripitons_.find(client);
- if (its_client != pending_incoming_subscripitons_.end()) {
- for (const auto subscription : its_client->second) {
- subscription_actions.push_front(
- { subscription.service_, subscription.instance_,
- subscription.eventgroup_, client,
- subscription.major_, subscription.event_ });
- }
- }
- }
- }
- for (const subscription_info &si : subscription_actions) {
- (void) find_or_create_local(si.client_id_);
- auto self = shared_from_this();
- host_->on_subscription(
- si.service_id_, si.instance_id_, si.eventgroup_id_,
- si.client_id_, true,
- [this, self, si](const bool _subscription_accepted) {
- if (!_subscription_accepted) {
- send_subscribe_nack(si.client_id_, si.service_id_,
- si.instance_id_, si.eventgroup_id_, si.event_, DEFAULT_SUBSCRIPTION);
- } else {
- routing_manager_base::subscribe(si.client_id_,
- si.service_id_, si.instance_id_, si.eventgroup_id_,
- si.major_, si.event_,
- subscription_type_e::SU_RELIABLE_AND_UNRELIABLE);
- send_subscribe_ack(si.client_id_, si.service_id_,
- si.instance_id_, si.eventgroup_id_, si.event_, DEFAULT_SUBSCRIPTION);
- send_pending_notify_ones(si.service_id_,
- si.instance_id_, si.eventgroup_id_, si.client_id_);
- }
- {
- std::lock_guard<std::recursive_mutex> its_lock2(incoming_subscriptions_mutex_);
- pending_incoming_subscripitons_.erase(si.client_id_);
- }
- });
- }
- }
- }
-}
-
-void routing_manager_proxy::on_offered_services_info(const byte_t *_data,
- uint32_t _size) {
-#if 0
- std::stringstream msg;
- msg << "rmp::on_offered_services_info(" << std::hex << 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
-
- std::vector<std::pair<service_t, instance_t>> its_offered_services_info;
-
- uint32_t i = 0;
- while (i + sizeof(uint32_t) + sizeof(routing_info_entry_e) <= _size) {
- routing_info_entry_e routing_info_entry;
- std::memcpy(&routing_info_entry, &_data[i], sizeof(routing_info_entry_e));
- i += uint32_t(sizeof(routing_info_entry_e));
-
- uint32_t its_service_entry_size;
- std::memcpy(&its_service_entry_size, &_data[i], sizeof(uint32_t));
- i += uint32_t(sizeof(uint32_t));
-
- if (its_service_entry_size + i > _size) {
- VSOMEIP_WARNING << "Client 0x" << std::hex << get_client() << " : "
- << "Processing of offered services info failed due to bad length fields!";
- return;
- }
-
- if (its_service_entry_size >= sizeof(service_t) + sizeof(instance_t) + sizeof(major_version_t) + sizeof(minor_version_t)) {
- service_t its_service;
- std::memcpy(&its_service, &_data[i], sizeof(service_t));
- i += uint32_t(sizeof(service_t));
-
- instance_t its_instance;
- std::memcpy(&its_instance, &_data[i], sizeof(instance_t));
- i += uint32_t(sizeof(instance_t));
-
- major_version_t its_major;
- std::memcpy(&its_major, &_data[i], sizeof(major_version_t));
- i += uint32_t(sizeof(major_version_t));
-
- minor_version_t its_minor;
- std::memcpy(&its_minor, &_data[i], sizeof(minor_version_t));
- i += uint32_t(sizeof(minor_version_t));
-
- its_offered_services_info.push_back(std::make_pair(its_service, its_instance));
- }
- }
- host_->on_offered_services_info(its_offered_services_info);
-}
-
-void routing_manager_proxy::reconnect(const std::unordered_set<client_t> &_clients) {
- // inform host about its own registration state changes
- host_->on_state(static_cast<state_type_e>(inner_state_type_e::ST_DEREGISTERED));
-
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- state_ = inner_state_type_e::ST_DEREGISTERED;
- // Notify stop() call about clean deregistration
- state_condition_.notify_one();
- }
-
-
- // Remove all local connections/endpoints
- for (const auto its_client : _clients) {
- if (its_client != VSOMEIP_ROUTING_CLIENT) {
- remove_local(its_client);
- }
- }
-
- VSOMEIP_INFO << std::hex << "Application/Client " << get_client()
- <<": Reconnecting to routing manager.";
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->restart();
- }
-}
-
-void routing_manager_proxy::register_application() {
- byte_t its_command[] = {
- VSOMEIP_REGISTER_APPLICATION, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &client_,
- sizeof(client_));
-
- if (is_connected_) {
- std::lock_guard<std::mutex> its_state_lock(state_mutex_);
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- {
- state_ = inner_state_type_e::ST_REGISTERING;
- }
- sender_->send(its_command, sizeof(its_command));
-
- register_application_timer_.cancel();
- register_application_timer_.expires_from_now(std::chrono::milliseconds(1000));
- register_application_timer_.async_wait(
- std::bind(
- &routing_manager_proxy::register_application_timeout_cbk,
- std::dynamic_pointer_cast<routing_manager_proxy>(shared_from_this()),
- std::placeholders::_1));
- }
- }
-}
-
-void routing_manager_proxy::deregister_application() {
- uint32_t its_size = sizeof(client_);
-
- std::vector<byte_t> its_command(VSOMEIP_COMMAND_HEADER_SIZE + its_size);
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_DEREGISTER_APPLICATION;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &client_,
- sizeof(client_));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- if (is_connected_)
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(&its_command[0], uint32_t(its_command.size()));
- }
- }
-}
-
-void routing_manager_proxy::send_pong() const {
- byte_t its_pong[] = {
- VSOMEIP_PONG, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
-
- std::memcpy(&its_pong[VSOMEIP_COMMAND_CLIENT_POS], &client_,
- sizeof(client_t));
-
- if (is_connected_) {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_pong, sizeof(its_pong));
- }
- }
-}
-
-void routing_manager_proxy::send_request_services(std::set<service_data_t>& _requests) {
- if (!_requests.size()) {
- return;
- }
- size_t its_size = (VSOMEIP_REQUEST_SERVICE_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE) * _requests.size();
- if (its_size > (std::numeric_limits<std::uint32_t>::max)()) {
- VSOMEIP_ERROR<< "routing_manager_proxy::send_request_services too many"
- << " requests (" << std::dec << its_size << "), returning.";
- return;
- }
-
- std::vector<byte_t> its_command(its_size + VSOMEIP_COMMAND_HEADER_SIZE);
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_REQUEST_SERVICE;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &client_,
- sizeof(client_));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
-
- uint32_t entry_size = (sizeof(service_t) + sizeof(instance_t) + sizeof(major_version_t)
- + sizeof(minor_version_t) + sizeof(bool));
-
- int i = 0;
- for (auto its_service : _requests) {
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + (i * entry_size)], &its_service.service_,
- sizeof(its_service.service_));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2 + (i * entry_size)], &its_service.instance_,
- sizeof(its_service.instance_));
- its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4 + (i * entry_size)] = its_service.major_;
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 5 + (i * entry_size)], &its_service.minor_,
- sizeof(its_service.minor_));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 9 + (i * entry_size)], &its_service.use_exclusive_proxy_,
- sizeof(its_service.use_exclusive_proxy_));
- ++i;
- }
-
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(&its_command[0], static_cast<std::uint32_t>(its_size + VSOMEIP_COMMAND_HEADER_SIZE));
- }
- }
-}
-
-void routing_manager_proxy::send_release_service(client_t _client, service_t _service,
- instance_t _instance) {
- (void)_client;
- byte_t its_command[VSOMEIP_RELEASE_SERVICE_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_RELEASE_SERVICE_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_RELEASE_SERVICE;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &client_,
- sizeof(client_));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
-
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
- }
-}
-
-void routing_manager_proxy::send_register_event(client_t _client,
- service_t _service, instance_t _instance,
- event_t _event, const std::set<eventgroup_t> &_eventgroups,
- bool _is_field, bool _is_provided) {
-
- std::size_t its_eventgroups_size = (_eventgroups.size() * sizeof(eventgroup_t)) +
- VSOMEIP_REGISTER_EVENT_COMMAND_SIZE;
- if (its_eventgroups_size > (std::numeric_limits<std::uint32_t>::max)()) {
- VSOMEIP_ERROR<< "routing_manager_proxy::send_register_event too many"
- << " eventgroups (" << std::dec << its_eventgroups_size << "), returning.";
- return;
- }
- byte_t *its_command = new byte_t[its_eventgroups_size];
- uint32_t its_size = static_cast<std::uint32_t>(its_eventgroups_size)
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_REGISTER_EVENT;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &client_,
- sizeof(_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_event,
- sizeof(_event));
- its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6]
- = static_cast<byte_t>(_is_field);
- its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 7]
- = static_cast<byte_t>(_is_provided);
-
- std::size_t i = 8;
- for (auto eg : _eventgroups) {
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + i], &eg,
- sizeof(eventgroup_t));
- i += sizeof(eventgroup_t);
- }
-
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, static_cast<std::uint32_t>(its_eventgroups_size));
- }
- }
-
- delete[] its_command;
-}
-
-void routing_manager_proxy::on_subscribe_ack(client_t _client,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup, event_t _event) {
- (void)_client;
- if (_event == ANY_EVENT) {
- auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup);
- if (its_eventgroup) {
- for (auto its_event : its_eventgroup->get_events()) {
- host_->on_subscription_error(_service, _instance, _eventgroup, 0x0 /*OK*/);
- host_->on_subscription_status(_service, _instance, _eventgroup, its_event->get_event(), 0x0 /*OK*/);
- }
- }
- } else {
- host_->on_subscription_error(_service, _instance, _eventgroup, 0x0 /*OK*/);
- host_->on_subscription_status(_service, _instance, _eventgroup, _event, 0x0 /*OK*/);
- }
-}
-
-void routing_manager_proxy::on_subscribe_nack(client_t _client,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup, event_t _event) {
- (void)_client;
- if (_event == ANY_EVENT) {
- auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup);
- if (its_eventgroup) {
- for (auto its_event : its_eventgroup->get_events()) {
- host_->on_subscription_error(_service, _instance, _eventgroup, 0x7 /*Rejected*/);
- host_->on_subscription_status(_service, _instance, _eventgroup, its_event->get_event(), 0x7 /*Rejected*/);
- }
- }
- } else {
- host_->on_subscription_error(_service, _instance, _eventgroup, 0x7 /*Rejected*/);
- host_->on_subscription_status(_service, _instance, _eventgroup, _event, 0x7 /*Rejected*/);
- }
-}
-
-void routing_manager_proxy::on_identify_response(client_t _client, service_t _service,
- instance_t _instance, bool _reliable) {
- static const uint32_t size = VSOMEIP_ID_RESPONSE_COMMAND_SIZE;
- byte_t its_command[size];
- uint32_t its_size = size - VSOMEIP_COMMAND_HEADER_SIZE;
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_ID_RESPONSE;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &_client,
- sizeof(_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_reliable,
- sizeof(_reliable));
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, size);
- }
- }
-}
-
-void routing_manager_proxy::cache_event_payload(
- const std::shared_ptr<message> &_message) {
- const service_t its_service(_message->get_service());
- const instance_t its_instance(_message->get_instance());
- const method_t its_method(_message->get_method());
- std::shared_ptr<event> its_event = find_event(its_service, its_instance, its_method);
- if (its_event) {
- if (its_event->is_field()) {
- its_event->set_payload_dont_notify(_message->get_payload());
- }
- } else {
- // we received a event which was not yet requested
- std::set<eventgroup_t> its_eventgroups;
- // create a placeholder field until someone requests this event with
- // full information like eventgroup, field or not etc.
- routing_manager_base::register_event(host_->get_client(), its_service,
- its_instance, its_method, its_eventgroups, true,
- std::chrono::milliseconds::zero(), false,
- nullptr,
- false, false, true);
- std::shared_ptr<event> its_event = find_event(its_service, its_instance, its_method);
- if (its_event) {
- its_event->set_payload_dont_notify(_message->get_payload());
- }
- }
-
-}
-
-void routing_manager_proxy::on_stop_offer_service(service_t _service,
- instance_t _instance,
- major_version_t _major,
- minor_version_t _minor) {
- (void) _major;
- (void) _minor;
- std::map<event_t, std::shared_ptr<event> > events;
- {
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- auto its_events_service = events_.find(_service);
- if (its_events_service != events_.end()) {
- auto its_events_instance = its_events_service->second.find(_instance);
- if (its_events_instance != its_events_service->second.end()) {
- for (auto &e : its_events_instance->second)
- events[e.first] = e.second;
- }
- }
- }
- for (auto &e : events) {
- e.second->unset_payload();
- }
-}
-
-void routing_manager_proxy::send_pending_commands() {
- for (auto &po : pending_offers_)
- send_offer_service(client_, po.service_, po.instance_,
- po.major_, po.minor_);
-
- for (auto &per : pending_event_registrations_)
- send_register_event(client_, per.service_, per.instance_,
- per.event_, per.eventgroups_,
- per.is_field_, per.is_provided_);
-
- send_request_services(requests_);
-}
-
-void routing_manager_proxy::init_receiver() {
- std::stringstream its_client;
- its_client << utility::get_base_path(configuration_) << std::hex << client_;
-#ifdef _WIN32
- ::_unlink(its_client.str().c_str());
- int port = VSOMEIP_INTERNAL_BASE_PORT + client_;
-#else
- if (!check_credentials(get_client(), getuid(), getgid())) {
- VSOMEIP_ERROR << "routing_manager_proxy::init_receiver: "
- << std::hex << "Client " << get_client() << " isn't allow"
- << " to create a server endpoint due to credential check failed!";
- return;
- }
- if (-1 == ::unlink(its_client.str().c_str()) && errno != ENOENT) {
- VSOMEIP_ERROR << "routing_manager_proxy::init_receiver unlink failed ("
- << its_client.str() << "): "<< std::strerror(errno);
- }
- const mode_t previous_mask(::umask(static_cast<mode_t>(configuration_->get_umask())));
-#endif
- try {
- receiver_ = std::make_shared<local_server_endpoint_impl>(shared_from_this(),
-#ifdef _WIN32
- boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port),
-#else
- boost::asio::local::stream_protocol::endpoint(its_client.str()),
-#endif
- io_, configuration_->get_max_message_size_local(),
- configuration_->get_buffer_shrink_threshold(),
- configuration_->get_endpoint_queue_limit_local());
-#ifdef _WIN32
- VSOMEIP_INFO << "Listening at " << port;
-#else
- VSOMEIP_INFO << "Listening at " << its_client.str();
-#endif
- } catch (const std::exception &e) {
- host_->on_error(error_code_e::SERVER_ENDPOINT_CREATION_FAILED);
- VSOMEIP_ERROR << "Client ID: " << std::hex << client_ << ": " << e.what();
- }
-#ifndef _WIN32
- ::umask(previous_mask);
-#endif
-}
-
-void routing_manager_proxy::notify_remote_initially(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, const std::set<event_t> &_events_to_exclude) {
- auto its_eventgroup = find_eventgroup(_service, _instance, _eventgroup);
- if (its_eventgroup) {
- auto service_info = find_service(_service, _instance);
- for (const auto &e : its_eventgroup->get_events()) {
- if (e->is_field() && e->is_set()
- && _events_to_exclude.find(e->get_event())
- == _events_to_exclude.end()) {
- std::shared_ptr<message> its_notification
- = runtime::get()->create_notification();
- its_notification->set_service(_service);
- its_notification->set_instance(_instance);
- its_notification->set_method(e->get_event());
- its_notification->set_payload(e->get_payload());
- if (service_info) {
- its_notification->set_interface_version(service_info->get_major());
- }
- std::lock_guard<std::mutex> its_lock(serialize_mutex_);
- if (serializer_->serialize(its_notification.get())) {
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- send_local(sender_, VSOMEIP_ROUTING_CLIENT, serializer_->get_data(),
- serializer_->get_size(), _instance, true, false, VSOMEIP_NOTIFY);
- }
- }
- serializer_->reset();
- } else {
- VSOMEIP_ERROR << "Failed to serialize message. Check message size!";
- }
- }
- }
- }
-
-}
-
-uint32_t routing_manager_proxy::get_remote_subscriber_count(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, bool _increment) {
- std::lock_guard<std::mutex> its_lock(remote_subscriber_count_mutex_);
- uint32_t count (0);
- bool found(false);
- auto found_service = remote_subscriber_count_.find(_service);
- if (found_service != remote_subscriber_count_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_group = found_instance->second.find(_eventgroup);
- if (found_group != found_instance->second.end()) {
- found = true;
- if (_increment) {
- found_group->second = found_group->second + 1;
- } else {
- if (found_group->second > 0) {
- found_group->second = found_group->second - 1;
- }
- }
- count = found_group->second;
- }
- }
- }
- if (!found) {
- if (_increment) {
- remote_subscriber_count_[_service][_instance][_eventgroup] = 1;
- count = 1;
- }
- }
- return count;
-}
-
-void routing_manager_proxy::register_application_timeout_cbk(
- boost::system::error_code const &_error) {
- if (!_error) {
- bool register_again(false);
- {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- if (state_ != inner_state_type_e::ST_REGISTERED) {
- state_ = inner_state_type_e::ST_DEREGISTERED;
- register_again = true;
- }
- }
- if (register_again) {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- VSOMEIP_WARNING << std::hex << "Client 0x" << get_client() << " register timeout!"
- << " : Restart route to stub!";
- if (sender_) {
- sender_->restart();
- }
- }
- }
-}
-
-void routing_manager_proxy::send_registered_ack() {
- byte_t its_command[VSOMEIP_COMMAND_HEADER_SIZE] = {
- VSOMEIP_REGISTERED_ACK, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
- client_t client = get_client();
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &client,
- sizeof(client));
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, VSOMEIP_COMMAND_HEADER_SIZE);
- }
- }
-}
-
-bool routing_manager_proxy::is_client_known(client_t _client) {
- std::lock_guard<std::mutex> its_lock(known_clients_mutex_);
- return (known_clients_.find(_client) != known_clients_.end());
-}
-
-bool routing_manager_proxy::create_placeholder_event_and_subscribe(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, client_t _client) {
- bool is_inserted(false);
- // we received a event which was not yet requested/offered
- // create a placeholder field until someone requests/offers this event with
- // full information like eventgroup, field or not etc.
- std::set<eventgroup_t> its_eventgroups({ _eventgroup });
- // routing_manager_proxy: Always register with own client id and shadow = false
- register_event(host_->get_client(), _service, _instance, _event,
- its_eventgroups, true, std::chrono::milliseconds::zero(), false,
- nullptr, false, false, true);
- std::shared_ptr<event> its_event = find_event(_service, _instance, _event);
- if (its_event) {
- is_inserted = its_event->add_subscriber(_eventgroup, _client);
- }
- return is_inserted;
-}
-
-void routing_manager_proxy::request_debounce_timeout_cbk(
- boost::system::error_code const &_error) {
- std::lock_guard<std::mutex> its_lock(state_mutex_);
- if (!_error) {
- if (requests_to_debounce_.size()) {
- if (state_ == inner_state_type_e::ST_REGISTERED) {
- send_request_services(requests_to_debounce_);
- requests_.insert(requests_to_debounce_.begin(),
- requests_to_debounce_.end());
- requests_to_debounce_.clear();
- } else {
- {
- std::lock_guard<std::mutex> its_lock(request_timer_mutex_);
- request_debounce_timer_running_ = true;
- request_debounce_timer_.expires_from_now(std::chrono::milliseconds(configuration_->get_request_debouncing(host_->get_name())));
- request_debounce_timer_.async_wait(
- std::bind(
- &routing_manager_proxy::request_debounce_timeout_cbk,
- std::dynamic_pointer_cast<routing_manager_proxy>(shared_from_this()),
- std::placeholders::_1));
- return;
- }
- }
- }
- }
- {
- std::lock_guard<std::mutex> its_lock(request_timer_mutex_);
- request_debounce_timer_running_ = false;
- }
-}
-
-void routing_manager_proxy::register_client_error_handler(client_t _client,
- const std::shared_ptr<endpoint> &_endpoint) {
- _endpoint->register_error_handler(
- std::bind(&routing_manager_proxy::handle_client_error, this, _client));
-}
-
-void routing_manager_proxy::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 << ")";
- remove_local(_client);
- } else {
- bool should_reconnect(true);
- {
- std::unique_lock<std::mutex> its_lock(state_mutex_);
- should_reconnect = is_started_;
- }
- if (should_reconnect) {
- std::unordered_set<client_t> its_known_clients;
- {
- std::lock_guard<std::mutex> its_lock(known_clients_mutex_);
- its_known_clients = known_clients_;
- }
- reconnect(its_known_clients);
- }
- }
-}
-
-void routing_manager_proxy::send_get_offered_services_info(client_t _client, offer_type_e _offer_type) {
- (void)_client;
-
- byte_t its_command[VSOMEIP_OFFERED_SERVICES_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_OFFERED_SERVICES_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_OFFERED_SERVICES_REQUEST;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &_client,
- sizeof(_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_offer_type,
- sizeof(_offer_type));
-
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
-}
-
-void routing_manager_proxy::send_unsubscribe_ack(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- pending_subscription_id_t _subscription_id) {
- byte_t its_command[VSOMEIP_UNSUBSCRIBE_ACK_COMMAND_SIZE];
- const std::uint32_t its_size = VSOMEIP_UNSUBSCRIBE_ACK_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- const client_t its_client = get_client();
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_UNSUBSCRIBE_ACK;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &its_client,
- sizeof(its_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_eventgroup,
- sizeof(_eventgroup));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- &_subscription_id, sizeof(_subscription_id));
-
- {
- std::lock_guard<std::mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
- }
-}
-
-} // namespace vsomeip
diff --git a/implementation/routing/src/routing_manager_stub.cpp b/implementation/routing/src/routing_manager_stub.cpp
deleted file mode 100644
index a63642a..0000000
--- a/implementation/routing/src/routing_manager_stub.cpp
+++ /dev/null
@@ -1,1856 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <functional>
-#include <iomanip>
-#include <forward_list>
-
-#ifndef _WIN32
-// for umask
-#include <sys/types.h>
-#include <sys/stat.h>
-#endif
-
-#include <boost/system/error_code.hpp>
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/runtime.hpp>
-#include <vsomeip/error.hpp>
-
-#ifndef WITHOUT_SYSTEMD
-#include <systemd/sd-daemon.h>
-#endif
-#define SD_LISTEN_FDS_START 3
-
-#include "../include/routing_manager_stub.hpp"
-#include "../include/routing_manager_stub_host.hpp"
-#include "../../configuration/include/configuration.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../endpoints/include/local_server_endpoint_impl.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../utility/include/byteorder.hpp"
-#include "../../utility/include/utility.hpp"
-
-namespace vsomeip {
-
-const std::vector<byte_t> routing_manager_stub::its_ping_(
- { VSOMEIP_PING, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
-
-routing_manager_stub::routing_manager_stub(
- routing_manager_stub_host *_host,
- std::shared_ptr<configuration> _configuration) :
- host_(_host),
- io_(_host->get_io()),
- watchdog_timer_(_host->get_io()),
- client_id_timer_(_host->get_io()),
- endpoint_(nullptr),
- local_receiver_(nullptr),
- configuration_(_configuration),
- routingCommandSize_(VSOMEIP_ROUTING_INFO_SIZE_INIT),
- is_socket_activated_(false),
- client_registration_running_(false),
- max_local_message_size_(configuration_->get_max_message_size_local()),
- configured_watchdog_timeout_(configuration_->get_watchdog_timeout()),
- pinged_clients_timer_(io_) {
-}
-
-routing_manager_stub::~routing_manager_stub() {
-}
-
-void routing_manager_stub::init() {
- init_routing_endpoint();
-}
-
-void routing_manager_stub::start() {
- {
- std::lock_guard<std::mutex> its_lock(used_client_ids_mutex_);
- used_client_ids_ = utility::get_used_client_ids();
- // Wait VSOMEIP_MAX_CONNECT_TIMEOUT * 2 and expect after that time
- // that all client_ids are used have to be connected to the routing.
- // Otherwise they can be marked as "erroneous client".
- client_id_timer_.expires_from_now(std::chrono::milliseconds(VSOMEIP_MAX_CONNECT_TIMEOUT * 2));
- client_id_timer_.async_wait(
- std::bind(
- &routing_manager_stub::on_client_id_timer_expired,
- std::dynamic_pointer_cast<routing_manager_stub>(shared_from_this()),
- std::placeholders::_1));
- }
-
- if(!endpoint_) {
- // application has been stopped and started again
- init_routing_endpoint();
- }
- if(endpoint_) {
- endpoint_->start();
- }
-
- client_registration_running_ = true;
- client_registration_thread_ = std::make_shared<std::thread>(
- std::bind(&routing_manager_stub::client_registration_func, this));
-
- if (configuration_->is_watchdog_enabled()) {
- VSOMEIP_INFO << "Watchdog is enabled : Timeout in ms = "
- << configuration_->get_watchdog_timeout()
- << " : Allowed missing pongs = "
- << configuration_->get_allowed_missing_pongs()
- << ".";
- start_watchdog();
- } else {
- VSOMEIP_INFO << "Watchdog is disabled!";
- }
-
- {
- std::lock_guard<std::mutex> its_lock(routing_info_mutex_);
- routing_info_[host_->get_client()].first = 0;
- }
-}
-
-void routing_manager_stub::stop() {
- {
- std::lock_guard<std::mutex> its_lock(client_registration_mutex_);
- client_registration_running_ = false;
- client_registration_condition_.notify_one();
- }
- if (client_registration_thread_->joinable()) {
- client_registration_thread_->join();
- }
-
- {
- std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
- watchdog_timer_.cancel();
- }
-
- {
- std::lock_guard<std::mutex> its_lock(used_client_ids_mutex_);
- client_id_timer_.cancel();
- }
-
- if( !is_socket_activated_) {
- endpoint_->stop();
- endpoint_ = nullptr;
-#ifdef _WIN32
- ::_unlink(endpoint_path_.c_str());
-#else
- if (-1 == ::unlink(endpoint_path_.c_str())) {
- VSOMEIP_ERROR << "routing_manager_stub::stop() unlink failed ("
- << endpoint_path_ << "): "<< std::strerror(errno);
- }
-#endif
- }
-
- if(local_receiver_) {
- local_receiver_->stop();
- local_receiver_ = nullptr;
-#ifdef _WIN32
- ::_unlink(local_receiver_path_.c_str());
-#else
- if (-1 == ::unlink(local_receiver_path_.c_str())) {
- VSOMEIP_ERROR << "routing_manager_stub::stop() unlink (local receiver) failed ("
- << local_receiver_path_ << "): "<< std::strerror(errno);
- }
-#endif
- }
-}
-
-const std::shared_ptr<configuration> routing_manager_stub::get_configuration() const {
- return configuration_;
-}
-
-void routing_manager_stub::on_connect(std::shared_ptr<endpoint> _endpoint) {
- _endpoint->set_connected(true);
-}
-
-void routing_manager_stub::on_disconnect(std::shared_ptr<endpoint> _endpoint) {
- (void)_endpoint;
-}
-
-void routing_manager_stub::on_error(
- const byte_t *_data, length_t _length, endpoint *_receiver,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port) {
-
- // Implement me when needed
-
- (void)(_data);
- (void)(_length);
- (void)(_receiver);
- (void)(_remote_address);
- (void)(_remote_port);
-}
-
-void routing_manager_stub::release_port(uint16_t _port, bool _reliable) {
- (void)_port;
- (void)_reliable;
- // intentionally empty
-}
-
-void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
- endpoint *_receiver, const boost::asio::ip::address &_destination,
- client_t _bound_client,
- const boost::asio::ip::address &_remote_address,
- std::uint16_t _remote_port) {
- (void)_receiver;
- (void)_destination;
- (void)_remote_address;
- (void) _remote_port;
-#if 0
- std::stringstream msg;
- msg << "rms::on_message: ";
- for (length_t i = 0; i < _size; ++i)
- msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
-
- if (VSOMEIP_COMMAND_SIZE_POS_MAX < _size) {
- byte_t its_command;
- client_t its_client;
- std::string its_client_endpoint;
- service_t its_service;
- instance_t its_instance;
- eventgroup_t its_eventgroup;
- std::set<eventgroup_t> its_eventgroups;
- event_t its_event;
- bool is_field(false);
- bool is_provided(false);
- major_version_t its_major;
- minor_version_t its_minor;
- std::shared_ptr<payload> its_payload;
- const byte_t *its_data;
- uint32_t its_size;
- bool its_reliable(false);
- subscription_type_e its_subscription_type;
- client_t its_client_from_header;
- client_t its_target_client;
- client_t its_subscriber;
- bool its_is_valid_crc(true);
- std::uint16_t its_subscription_id(DEFAULT_SUBSCRIPTION);
- offer_type_e its_offer_type;
-
- its_command = _data[VSOMEIP_COMMAND_TYPE_POS];
- std::memcpy(&its_client, &_data[VSOMEIP_COMMAND_CLIENT_POS],
- sizeof(its_client));
-
- if (configuration_->is_security_enabled() && _bound_client != its_client) {
- VSOMEIP_WARNING << "Security: Routing Manager received a message from client "
- << std::hex << std::setw(4) << std::setfill('0')
- << its_client << " with command " << (uint32_t)its_command <<
- " which doesn't match the bound client "
- << std::setw(4) << std::setfill('0') << _bound_client
- << " ~> skip message!";
- return;
- }
-
- std::memcpy(&its_size, &_data[VSOMEIP_COMMAND_SIZE_POS_MIN],
- sizeof(its_size));
-
- if (its_size <= _size - VSOMEIP_COMMAND_HEADER_SIZE) {
- switch (its_command) {
- case VSOMEIP_REGISTER_APPLICATION:
- update_registration(its_client, registration_type_e::REGISTER);
- break;
-
- case VSOMEIP_DEREGISTER_APPLICATION:
- update_registration(its_client, registration_type_e::DEREGISTER);
- break;
-
- case VSOMEIP_PONG:
- on_pong(its_client);
- VSOMEIP_TRACE << "PONG("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << ")";
- break;
-
- case VSOMEIP_OFFER_SERVICE:
- if (_size != VSOMEIP_OFFER_SERVICE_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a OFFER_SERVICE command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_major, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_major));
- std::memcpy(&its_minor, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 5],
- sizeof(its_minor));
- host_->offer_service(its_client, its_service, its_instance,
- its_major, its_minor);
- break;
-
- case VSOMEIP_STOP_OFFER_SERVICE:
- if (_size != VSOMEIP_STOP_OFFER_SERVICE_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a STOP_OFFER_SERVICE command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
-
- std::memcpy(&its_major, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_major));
- std::memcpy(&its_minor, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 5],
- sizeof(its_minor));
-
- host_->stop_offer_service(its_client, its_service, its_instance, its_major, its_minor);
- break;
-
- case VSOMEIP_SUBSCRIBE:
- if (_size != VSOMEIP_SUBSCRIBE_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a SUBSCRIBE command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_eventgroup, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_eventgroup));
- std::memcpy(&its_major, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(its_major));
- std::memcpy(&its_event, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 7],
- sizeof(its_event));
- std::memcpy(&its_subscription_type, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 9],
- sizeof(its_subscription_type));
- if (configuration_->is_client_allowed(its_client,
- its_service, its_instance)) {
- host_->subscribe(its_client, its_service, its_instance,
- its_eventgroup, its_major, its_event, its_subscription_type);
- } else {
- VSOMEIP_WARNING << "Security: Client " << std::hex
- << its_client << " subscribes to service/instance "
- << its_service << "/" << its_instance
- << " which violates the security policy ~> Skip subscribe!";
- }
- break;
-
- case VSOMEIP_UNSUBSCRIBE:
- if (_size != VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a UNSUBSCRIBE command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_eventgroup, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_eventgroup));
- std::memcpy(&its_event, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(its_event));
-
- host_->unsubscribe(its_client, its_service,
- its_instance, its_eventgroup, its_event);
- break;
-
- case VSOMEIP_SUBSCRIBE_ACK:
- if (_size != VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a SUBSCRIBE_ACK command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_eventgroup, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_eventgroup));
- std::memcpy(&its_subscriber, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(its_subscriber));
- std::memcpy(&its_event, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 8],
- sizeof(its_event));
- std::memcpy(&its_subscription_id, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 10],
- sizeof(its_subscription_id));
- host_->on_subscribe_ack(its_subscriber, its_service,
- its_instance, its_eventgroup, its_event, its_subscription_id);
- VSOMEIP_INFO << "SUBSCRIBE ACK("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_eventgroup << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_event << "]";
- break;
-
- case VSOMEIP_SUBSCRIBE_NACK:
- if (_size != VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a SUBSCRIBE_NACK command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_eventgroup, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_eventgroup));
- std::memcpy(&its_subscriber, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(its_subscriber));
- std::memcpy(&its_event, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 8],
- sizeof(its_event));
- std::memcpy(&its_subscription_id, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 10],
- sizeof(its_subscription_id));
- host_->on_subscribe_nack(its_subscriber, its_service,
- its_instance, its_eventgroup, its_event, its_subscription_id);
- VSOMEIP_INFO << "SUBSCRIBE NACK("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_eventgroup << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_event << "]";
- break;
- case VSOMEIP_UNSUBSCRIBE_ACK:
- if (_size != VSOMEIP_UNSUBSCRIBE_ACK_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a VSOMEIP_UNSUBSCRIBE_ACK command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_eventgroup, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_eventgroup));
- std::memcpy(&its_subscription_id, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(its_subscription_id));
- host_->on_unsubscribe_ack(its_client, its_service,
- its_instance, its_eventgroup, its_subscription_id);
- VSOMEIP_INFO << "UNSUBSCRIBE ACK("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_eventgroup << "]";
- break;
- case VSOMEIP_SEND: {
- its_data = &_data[VSOMEIP_COMMAND_PAYLOAD_POS];
- its_service = VSOMEIP_BYTES_TO_WORD(
- its_data[VSOMEIP_SERVICE_POS_MIN],
- its_data[VSOMEIP_SERVICE_POS_MAX]);
- its_client_from_header = VSOMEIP_BYTES_TO_WORD(
- its_data[VSOMEIP_CLIENT_POS_MIN],
- its_data[VSOMEIP_CLIENT_POS_MAX]);
- std::memcpy(&its_instance, &_data[_size - sizeof(instance_t)
- - sizeof(bool) - sizeof(bool) - sizeof(bool)], sizeof(its_instance));
- std::memcpy(&its_reliable, &_data[_size - sizeof(bool) - sizeof(bool)], sizeof(its_reliable));
-
- std::memcpy(&its_is_valid_crc, &_data[_size - sizeof(bool)], sizeof(its_is_valid_crc));
-
- if (utility::is_request(its_data[VSOMEIP_MESSAGE_TYPE_POS])) {
- if (!configuration_->is_client_allowed(its_client_from_header,
- its_service, its_instance)) {
- VSOMEIP_WARNING << std::hex << "Security: Client 0x" << its_client_from_header
- << " isn't allow to send a request to service/instance "
- << its_service << "/" << its_instance
- << " : Skip message!";
- return;
- }
- } else {
- if (!configuration_->is_client_allowed(get_client(), its_service,
- its_instance)) {
- VSOMEIP_WARNING << std::hex << "Security: Client 0x"
- << get_client()
- << " isn't allow receive a response from to service/instance "
- << its_service << "/" << its_instance
- << " respectively from client 0x" << its_client
- << " : Skip message!";
- return;
- }
- }
- // reduce by size of instance, flush, reliable and is_valid_crc flag
- const std::uint32_t its_message_size = its_size -
- static_cast<std::uint32_t>(sizeof(its_instance)
- + sizeof(bool) + sizeof(bool) + sizeof(bool));
- host_->on_message(its_service, its_instance, its_data, its_message_size, its_reliable, its_is_valid_crc);
- break;
- }
- case VSOMEIP_NOTIFY: {
- its_data = &_data[VSOMEIP_COMMAND_PAYLOAD_POS];
- its_service = VSOMEIP_BYTES_TO_WORD(
- its_data[VSOMEIP_SERVICE_POS_MIN],
- its_data[VSOMEIP_SERVICE_POS_MAX]);
- std::memcpy(&its_instance, &_data[_size - sizeof(instance_t)
- - sizeof(bool) - sizeof(bool) - sizeof(bool)], sizeof(its_instance));
- // reduce by size of instance, flush, reliable and is_valid_crc flag
- const std::uint32_t its_message_size = its_size -
- static_cast<uint32_t>(sizeof(its_instance)
- + sizeof(bool) + sizeof(bool));
- host_->on_notification(VSOMEIP_ROUTING_CLIENT, its_service, its_instance, its_data, its_message_size);
- break;
- }
- case VSOMEIP_NOTIFY_ONE: {
- its_data = &_data[VSOMEIP_COMMAND_PAYLOAD_POS];
- its_service = VSOMEIP_BYTES_TO_WORD(
- its_data[VSOMEIP_SERVICE_POS_MIN],
- its_data[VSOMEIP_SERVICE_POS_MAX]);
- std::memcpy(&its_instance, &_data[_size - sizeof(instance_t) -
- sizeof(bool) - sizeof(bool) - sizeof(bool) - sizeof(client_t)],
- sizeof(its_instance));
- std::memcpy(&its_target_client, &_data[_size - sizeof(client_t)], sizeof(client_t));
- // reduce by size of instance, flush, reliable flag, is_valid_crc and target client
- const std::uint32_t its_message_size = its_size -
- static_cast<uint32_t>(sizeof(its_instance)
- + sizeof(bool) + sizeof(bool) + sizeof(client_t));
- host_->on_notification(its_target_client, its_service, its_instance,
- its_data, its_message_size, true);
- break;
- }
- case VSOMEIP_REQUEST_SERVICE:
- {
- uint32_t entry_size = (sizeof(service_t) + sizeof(instance_t) + sizeof(major_version_t)
- + sizeof(minor_version_t) + sizeof(bool));
- uint32_t request_count(its_size / entry_size);
- std::set<service_data_t> requests;
- for (uint32_t i = 0; i < request_count; ++i) {
- service_t its_service;
- instance_t its_instance;
- major_version_t its_major;
- minor_version_t its_minor;
- bool use_exclusive_proxy;
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + (i * entry_size)],
- sizeof(its_service));
- std::memcpy(&its_instance,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2 + (i * entry_size)],
- sizeof(its_instance));
- std::memcpy(&its_major, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4 + (i * entry_size)],
- sizeof(its_major));
- std::memcpy(&its_minor, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 5 + (i * entry_size)],
- sizeof(its_minor));
- std::memcpy(&use_exclusive_proxy, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 9 + (i * entry_size)],
- sizeof(use_exclusive_proxy));
- if (configuration_->is_client_allowed(its_client, its_service, its_instance)) {
- host_->request_service(its_client, its_service, its_instance,
- its_major, its_minor, use_exclusive_proxy);
- service_data_t request = { its_service, its_instance,
- its_major, its_minor, use_exclusive_proxy };
- requests.insert(request);
- } else {
- VSOMEIP_WARNING << "Security: Client " << std::hex
- << its_client << " requests service/instance "
- << its_service << "/" << its_instance
- << " which violates the security policy ~> Skip request!";
- }
- }
- handle_requests(its_client, requests);
- break;
- }
-
- case VSOMEIP_RELEASE_SERVICE:
- if (_size != VSOMEIP_RELEASE_SERVICE_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a RELEASE_SERVICE command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
-
- host_->release_service(its_client, its_service, its_instance);
- break;
-
- case VSOMEIP_REGISTER_EVENT:
- if (_size < VSOMEIP_REGISTER_EVENT_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a REGISTER_EVENT command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_event,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_event));
- std::memcpy(&is_field,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(is_field));
- std::memcpy(&is_provided,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 7],
- sizeof(is_provided));
- if (is_provided
- && !configuration_->is_offered_remote(its_service,
- its_instance)) {
- break;
- }
- for (std::size_t i = 8; i+1 < its_size; i++) {
- std::memcpy(&its_eventgroup,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + i],
- sizeof(its_eventgroup));
- its_eventgroups.insert(its_eventgroup);
- }
- host_->register_shadow_event(its_client, its_service,
- its_instance, its_event, its_eventgroups,
- is_field, is_provided);
- VSOMEIP_INFO << "REGISTER EVENT("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_event
- << ":is_provider=" << is_provided << "]";
- break;
-
- case VSOMEIP_UNREGISTER_EVENT:
- if (_size != VSOMEIP_UNREGISTER_EVENT_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a UNREGISTER_EVENT command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_event, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_event));
- std::memcpy(&is_provided,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
- sizeof(is_provided));
- if (is_provided
- && !configuration_->is_offered_remote(its_service,
- its_instance)) {
- break;
- }
- host_->unregister_shadow_event(its_client, its_service, its_instance,
- its_event, is_provided);
- VSOMEIP_INFO << "UNREGISTER EVENT("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_event
- << ":is_provider=" << is_provided << "]";
- break;
-
- case VSOMEIP_ID_RESPONSE:
- if (_size != VSOMEIP_ID_RESPONSE_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a ID_RESPONSE command with wrong size ~> skip!";
- break;
- }
- std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_service));
- std::memcpy(&its_instance,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 2],
- sizeof(its_instance));
- std::memcpy(&its_reliable,
- &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 4],
- sizeof(its_reliable));
- host_->on_identify_response(its_client, its_service, its_instance, its_reliable);
- VSOMEIP_INFO << "ID RESPONSE("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance
- << ":is_reliable=" << its_reliable << "]";
- break;
-
- case VSOMEIP_REGISTERED_ACK:
- VSOMEIP_INFO << "REGISTERED_ACK("
- << std::hex << std::setw(4) << std::setfill('0') << its_client << ")";
- break;
- case VSOMEIP_OFFERED_SERVICES_REQUEST:
- if (_size != VSOMEIP_OFFERED_SERVICES_COMMAND_SIZE) {
- VSOMEIP_WARNING << "Received a VSOMEIP_OFFERED_SERVICES_REQUEST command with wrong size ~> skip!";
- break;
- }
-
- std::memcpy(&its_offer_type, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
- sizeof(its_offer_type));
-
- std::lock_guard<std::mutex> its_guard(routing_info_mutex_);
- create_offered_services_info(its_client);
-
- for (auto found_client : routing_info_) {
- // skip services which are offered on remote hosts
- if (found_client.first != VSOMEIP_ROUTING_CLIENT) {
- for (const auto &its_service : found_client.second.second) {
- for (const auto &its_instance : its_service.second) {
- uint16_t its_reliable_port = configuration_->get_reliable_port(its_service.first,
- its_instance.first);
- uint16_t its_unreliable_port = configuration_->get_unreliable_port(
- its_service.first, its_instance.first);
-
- if (its_offer_type == offer_type_e::OT_LOCAL) {
- if (its_reliable_port == ILLEGAL_PORT
- && its_unreliable_port == ILLEGAL_PORT) {
- insert_offered_services_info(its_client,
- routing_info_entry_e::RIE_ADD_SERVICE_INSTANCE,
- its_service.first, its_instance.first,
- its_instance.second.first, its_instance.second.second);
- }
- }
- else if (its_offer_type == offer_type_e::OT_REMOTE) {
- if (its_reliable_port != ILLEGAL_PORT
- || its_unreliable_port != ILLEGAL_PORT) {
- insert_offered_services_info(its_client,
- routing_info_entry_e::RIE_ADD_SERVICE_INSTANCE,
- its_service.first, its_instance.first,
- its_instance.second.first, its_instance.second.second);
- }
- } else if (its_offer_type == offer_type_e::OT_ALL) {
- insert_offered_services_info(its_client,
- routing_info_entry_e::RIE_ADD_SERVICE_INSTANCE,
- its_service.first, its_instance.first,
- its_instance.second.first, its_instance.second.second);
- }
- }
- }
- }
- }
- send_offered_services_info(its_client);
- break;
- }
- }
- }
-}
-
-void routing_manager_stub::on_register_application(client_t _client) {
- auto endpoint = host_->find_local(_client);
- if (endpoint) {
- VSOMEIP_ERROR << "Registering application: " << std::hex << _client
- << " failed. It is already registered!";
- } else {
- (void)host_->find_or_create_local(_client);
- std::lock_guard<std::mutex> its_lock(routing_info_mutex_);
- routing_info_[_client].first = 0;
- }
-}
-
-void routing_manager_stub::on_deregister_application(client_t _client) {
- std::vector<
- std::tuple<service_t, instance_t,
- major_version_t, minor_version_t>> services_to_report;
- {
- std::lock_guard<std::mutex> its_lock(routing_info_mutex_);
- auto its_info = routing_info_.find(_client);
- if (its_info != routing_info_.end()) {
- for (const auto &its_service : its_info->second.second) {
- for (const auto &its_instance : its_service.second) {
- const auto its_version = its_instance.second;
- services_to_report.push_back(
- std::make_tuple(its_service.first,
- its_instance.first, its_version.first,
- its_version.second));
- }
- }
- }
- routing_info_.erase(_client);
- }
- for (const auto &s : services_to_report) {
- host_->on_availability(std::get<0>(s), std::get<1>(s), false,
- std::get<2>(s), std::get<3>(s));
- host_->on_stop_offer_service(_client, std::get<0>(s), std::get<1>(s),
- std::get<2>(s), std::get<3>(s));
- }
-}
-
-void routing_manager_stub::client_registration_func(void) {
- std::unique_lock<std::mutex> its_lock(client_registration_mutex_);
- while (client_registration_running_) {
- while (!pending_client_registrations_.size() && client_registration_running_) {
- client_registration_condition_.wait(its_lock);
- }
-
- std::map<client_t, std::vector<registration_type_e>> its_registrations(
- pending_client_registrations_);
- pending_client_registrations_.clear();
- its_lock.unlock();
-
- for (auto r : its_registrations) {
- for (auto b : r.second) {
- if (b == registration_type_e::REGISTER) {
- on_register_application(r.first);
- } else {
- on_deregister_application(r.first);
- }
- // Inform (de)registered client. All others will be informed after
- // the client acknowledged its registered state!
- // Don't inform client if we deregister because of an client
- // endpoint error to avoid writing in an already closed socket
- if (b != registration_type_e::DEREGISTER_ON_ERROR) {
- std::lock_guard<std::mutex> its_guard(routing_info_mutex_);
- create_client_routing_info(r.first);
- insert_client_routing_info(r.first,
- b == registration_type_e::REGISTER ?
- routing_info_entry_e::RIE_ADD_CLIENT :
- routing_info_entry_e::RIE_DEL_CLIENT,
- r.first);
- send_client_routing_info(r.first);
- }
- if (b != registration_type_e::REGISTER) {
- {
- std::lock_guard<std::mutex> its_guard(routing_info_mutex_);
- auto its_connection = connection_matrix_.find(r.first);
- if (its_connection != connection_matrix_.end()) {
- for (auto its_client : its_connection->second) {
- if (its_client != r.first &&
- its_client != VSOMEIP_ROUTING_CLIENT &&
- its_client != get_client()) {
- create_client_routing_info(its_client);
- insert_client_routing_info(its_client,
- routing_info_entry_e::RIE_DEL_CLIENT, r.first);
- send_client_routing_info(its_client);
- }
- }
- connection_matrix_.erase(r.first);
- }
- for (auto its_client : connection_matrix_) {
- connection_matrix_[its_client.first].erase(r.first);
- }
- service_requests_.erase(r.first);
- }
- host_->remove_local(r.first);
- if (b == registration_type_e::DEREGISTER_ON_ERROR) {
- utility::release_client_id(r.first);
- }
- }
- }
- }
- its_lock.lock();
- }
-}
-
-void routing_manager_stub::init_routing_endpoint() {
- std::stringstream its_endpoint_path;
- its_endpoint_path << utility::get_base_path(configuration_) << VSOMEIP_ROUTING_CLIENT;
- endpoint_path_ = its_endpoint_path.str();
- client_t routing_host_id = configuration_->get_id(configuration_->get_routing_host());
- if (configuration_->is_security_enabled() && get_client() != routing_host_id) {
- VSOMEIP_ERROR << "routing_manager_stub::init_routing_endpoint: "
- << std::hex << "Client " << get_client() << " isn't allow"
- << " to create the routing endpoint due to its not configured as the routing master!";
- return;
- }
- uint32_t native_socket_fd, num_fd = 0;
-#ifndef WITHOUT_SYSTEMD
- num_fd = sd_listen_fds(0);
-#endif
- if (num_fd > 1) {
- VSOMEIP_ERROR << "Too many file descriptors received by systemd socket activation! num_fd: " << num_fd;
- } else if (num_fd == 1) {
- native_socket_fd = SD_LISTEN_FDS_START + 0;
- VSOMEIP_INFO << "Using native socket created by systemd socket activation! fd: " << native_socket_fd;
- #ifndef _WIN32
- try {
- endpoint_ =
- std::make_shared < local_server_endpoint_impl
- > (shared_from_this(),
- boost::asio::local::stream_protocol::endpoint(endpoint_path_),
- io_, configuration_->get_max_message_size_local(), native_socket_fd,
- configuration_->get_buffer_shrink_threshold());
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << ERROR_INFO[static_cast<int>(error_code_e::SERVER_ENDPOINT_CREATION_FAILED)]
- << " (" << static_cast<int>(error_code_e::SERVER_ENDPOINT_CREATION_FAILED) << ")";
- VSOMEIP_ERROR << "routing_manager_stub::init_routing_endpoint Client ID: "
- << std::hex << VSOMEIP_ROUTING_CLIENT << ": " << e.what();
- }
- #endif
- is_socket_activated_ = true;
- } else {
- #if _WIN32
- ::_unlink(endpoint_path_.c_str());
- int port = VSOMEIP_INTERNAL_BASE_PORT;
- VSOMEIP_INFO << "Routing endpoint at " << port;
- #else
- if (-1 == ::unlink(endpoint_path_.c_str()) && errno != ENOENT) {
- VSOMEIP_ERROR << "routing_manager_stub::init_endpoint unlink failed ("
- << endpoint_path_ << "): "<< std::strerror(errno);
- }
- VSOMEIP_INFO << "init_routing_endpoint Routing endpoint at " << endpoint_path_;
-
- const mode_t previous_mask(::umask(static_cast<mode_t>(configuration_->get_umask())));
- #endif
-
- try {
- endpoint_ =
- std::make_shared < local_server_endpoint_impl
- > (shared_from_this(),
- #ifdef _WIN32
- boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port),
- #else
- boost::asio::local::stream_protocol::endpoint(endpoint_path_),
- #endif
- io_, configuration_->get_max_message_size_local(),
- configuration_->get_buffer_shrink_threshold(),
- configuration_->get_endpoint_queue_limit_local());
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << ERROR_INFO[static_cast<int>(error_code_e::SERVER_ENDPOINT_CREATION_FAILED)]
- << " (" << static_cast<int>(error_code_e::SERVER_ENDPOINT_CREATION_FAILED) << ")";
- VSOMEIP_ERROR << "routing_manager_stub::init_routing_endpoint Client ID: "
- << std::hex << VSOMEIP_ROUTING_CLIENT << ": " << e.what();
- }
- #ifndef _WIN32
- ::umask(previous_mask);
- #endif
- is_socket_activated_ = false;
- }
-}
-
-void routing_manager_stub::on_offer_service(client_t _client,
- service_t _service, instance_t _instance, major_version_t _major, minor_version_t _minor) {
- if (_client == host_->get_client()) {
- create_local_receiver();
- }
-
- if (_client == VSOMEIP_ROUTING_CLIENT ||
- configuration_->is_offer_allowed(_client, _service, _instance)) {
- std::lock_guard<std::mutex> its_guard(routing_info_mutex_);
- routing_info_[_client].second[_service][_instance] = std::make_pair(_major, _minor);
- inform_requesters(_client, _service, _instance, _major, _minor,
- routing_info_entry_e::RIE_ADD_SERVICE_INSTANCE, true);
- } else {
- VSOMEIP_WARNING << std::hex << "Security: Client 0x" << _client
- << " isn't allow to offer the following service/instance "
- << _service << "/" << _instance
- << " : Skip offer!";
- }
-}
-
-void routing_manager_stub::on_stop_offer_service(client_t _client,
- service_t _service, instance_t _instance, major_version_t _major, minor_version_t _minor) {
- std::lock_guard<std::mutex> its_guard(routing_info_mutex_);
- auto found_client = routing_info_.find(_client);
- if (found_client != routing_info_.end()) {
- auto found_service = found_client->second.second.find(_service);
- if (found_service != found_client->second.second.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_version = found_instance->second;
- if( _major == found_version.first && _minor == found_version.second) {
- found_service->second.erase(_instance);
- if (0 == found_service->second.size()) {
- found_client->second.second.erase(_service);
- }
- inform_requesters(_client, _service, _instance, _major, _minor,
- routing_info_entry_e::RIE_DEL_SERVICE_INSTANCE, false);
- } else if( _major == DEFAULT_MAJOR && _minor == DEFAULT_MINOR) {
- found_service->second.erase(_instance);
- if (0 == found_service->second.size()) {
- found_client->second.second.erase(_service);
- }
- inform_requesters(_client, _service, _instance, _major, _minor,
- routing_info_entry_e::RIE_DEL_SERVICE_INSTANCE, false);
- }
- }
- }
- }
-}
-
-void routing_manager_stub::create_client_routing_info(const client_t _target) {
- std::vector<byte_t> its_command;
- its_command.push_back(VSOMEIP_ROUTING_INFO);
-
- // Sender client
- client_t client = get_client();
- for (uint32_t i = 0; i < sizeof(client_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&client)[i]);
- }
-
- // Overall size placeholder
- byte_t size_placeholder = 0x0;
- for (uint32_t i = 0; i < sizeof(uint32_t); ++i) {
- its_command.push_back(size_placeholder);
- }
-
- client_routing_info_[_target] = its_command;
-}
-
-void routing_manager_stub::create_offered_services_info(const client_t _target) {
- std::vector<byte_t> its_command;
- its_command.push_back(VSOMEIP_OFFERED_SERVICES_RESPONSE);
-
- // Sender client
- client_t client = get_client();
- for (uint32_t i = 0; i < sizeof(client_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&client)[i]);
- }
-
- // Overall size placeholder
- byte_t size_placeholder = 0x0;
- for (uint32_t i = 0; i < sizeof(uint32_t); ++i) {
- its_command.push_back(size_placeholder);
- }
-
- offered_services_info_[_target] = its_command;
-}
-
-
-void routing_manager_stub::send_client_routing_info(const client_t _target) {
- if (client_routing_info_.find(_target) == client_routing_info_.end()) {
- return;
- }
- std::shared_ptr<endpoint> its_endpoint = host_->find_local(_target);
- if (its_endpoint) {
- auto its_command = client_routing_info_[_target];
-
- // File overall size
- std::size_t its_size = its_command.size() - VSOMEIP_COMMAND_PAYLOAD_POS;
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size, sizeof(uint32_t));
- its_size += VSOMEIP_COMMAND_PAYLOAD_POS;
-
-#if 0
- std::stringstream msg;
- msg << "rms::send_routing_info to (" << std::hex << _target << "): ";
- for (uint32_t i = 0; i < its_size; ++i)
- msg << std::hex << std::setw(2) << std::setfill('0') << (int)its_command[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
-
- // Send routing info or error!
- if(its_command.size() <= max_local_message_size_
- || VSOMEIP_MAX_LOCAL_MESSAGE_SIZE == 0) {
- its_endpoint->send(&its_command[0], uint32_t(its_size), true);
- } else {
- VSOMEIP_ERROR << "Routing info exceeds maximum message size: Can't send!";
- }
-
- client_routing_info_.erase(_target);
- } else {
- VSOMEIP_ERROR << "Send routing info to client 0x" << std::hex << _target
- << " failed: No valid endpoint!";
- }
-}
-
-
-void routing_manager_stub::send_offered_services_info(const client_t _target) {
- if (offered_services_info_.find(_target) == offered_services_info_.end()) {
- return;
- }
- std::shared_ptr<endpoint> its_endpoint = host_->find_local(_target);
- if (its_endpoint) {
- auto its_command = offered_services_info_[_target];
-
- // File overall size
- std::size_t its_size = its_command.size() - VSOMEIP_COMMAND_PAYLOAD_POS;
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size, sizeof(uint32_t));
- its_size += VSOMEIP_COMMAND_PAYLOAD_POS;
-
-#if 0
- std::stringstream msg;
- msg << "rms::send_offered_services_info to (" << std::hex << _target << "): ";
- for (uint32_t i = 0; i < its_size; ++i)
- msg << std::hex << std::setw(2) << std::setfill('0') << (int)its_command[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
-
- // Send routing info or error!
- if(its_command.size() <= max_local_message_size_
- || VSOMEIP_MAX_LOCAL_MESSAGE_SIZE == 0) {
- its_endpoint->send(&its_command[0], uint32_t(its_size), true);
- } else {
- VSOMEIP_ERROR << "Offered services info exceeds maximum message size: Can't send!";
- }
-
- offered_services_info_.erase(_target);
- } else {
- VSOMEIP_ERROR << "Send offered services info to client 0x" << std::hex << _target
- << " failed: No valid endpoint!";
- }
-}
-
-void routing_manager_stub::insert_client_routing_info(client_t _target,
- routing_info_entry_e _entry,
- client_t _client, service_t _service,
- instance_t _instance,
- major_version_t _major,
- minor_version_t _minor) {
-
- if (client_routing_info_.find(_target) == client_routing_info_.end()) {
- return;
- }
-
- connection_matrix_[_target].insert(_client);
-
- auto its_command = client_routing_info_[_target];
-
- // Routing Info State Change
- for (uint32_t i = 0; i < sizeof(routing_info_entry_e); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_entry)[i]);
- }
-
- std::size_t its_size_pos = its_command.size();
- std::size_t its_entry_size = its_command.size();
-
- // Client size placeholder
- byte_t placeholder = 0x0;
- for (uint32_t i = 0; i < sizeof(uint32_t); ++i) {
- its_command.push_back(placeholder);
- }
- // Client
- for (uint32_t i = 0; i < sizeof(client_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_client)[i]);
- }
-
- if (_entry == routing_info_entry_e::RIE_ADD_SERVICE_INSTANCE ||
- _entry == routing_info_entry_e::RIE_DEL_SERVICE_INSTANCE) {
- //Service
- uint32_t its_service_entry_size = uint32_t(sizeof(service_t)
- + sizeof(instance_t) + sizeof(major_version_t) + sizeof(minor_version_t));
- for (uint32_t i = 0; i < sizeof(its_service_entry_size); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&its_service_entry_size)[i]);
- }
- for (uint32_t i = 0; i < sizeof(service_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_service)[i]);
- }
- // Instance
- for (uint32_t i = 0; i < sizeof(instance_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_instance)[i]);
- }
- // Major version
- for (uint32_t i = 0; i < sizeof(major_version_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_major)[i]);
- }
- // Minor version
- for (uint32_t i = 0; i < sizeof(minor_version_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_minor)[i]);
- }
- }
-
- // File client size
- its_entry_size = its_command.size() - its_entry_size - uint32_t(sizeof(uint32_t));
- std::memcpy(&its_command[its_size_pos], &its_entry_size, sizeof(uint32_t));
-
- client_routing_info_[_target] = its_command;
-}
-
-void routing_manager_stub::insert_offered_services_info(client_t _target,
- routing_info_entry_e _entry,
- service_t _service,
- instance_t _instance,
- major_version_t _major,
- minor_version_t _minor) {
-
- if (offered_services_info_.find(_target) == offered_services_info_.end()) {
- return;
- }
-
- auto its_command = offered_services_info_[_target];
-
- // Routing Info State Change
- for (uint32_t i = 0; i < sizeof(routing_info_entry_e); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_entry)[i]);
- }
-
- // entry size
- uint32_t its_service_entry_size = uint32_t(sizeof(service_t)
- + sizeof(instance_t) + sizeof(major_version_t) + sizeof(minor_version_t));
- for (uint32_t i = 0; i < sizeof(its_service_entry_size); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&its_service_entry_size)[i]);
- }
- //Service
- for (uint32_t i = 0; i < sizeof(service_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_service)[i]);
- }
- // Instance
- for (uint32_t i = 0; i < sizeof(instance_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_instance)[i]);
- }
- // Major version
- for (uint32_t i = 0; i < sizeof(major_version_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_major)[i]);
- }
- // Minor version
- for (uint32_t i = 0; i < sizeof(minor_version_t); ++i) {
- its_command.push_back(
- reinterpret_cast<const byte_t*>(&_minor)[i]);
- }
-
- offered_services_info_[_target] = its_command;
-}
-
-void routing_manager_stub::inform_requesters(client_t _hoster, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor,
- routing_info_entry_e _entry, bool _inform_service) {
- for (auto its_client : service_requests_) {
- auto its_service = its_client.second.find(_service);
- if (its_service != its_client.second.end()) {
- bool send(false);
- for (auto its_instance : its_service->second) {
- if (its_instance.first == ANY_INSTANCE ||
- its_instance.first == _instance) {
- send = true;
- }
- }
- if (send) {
- if (_inform_service) {
- if (_hoster != VSOMEIP_ROUTING_CLIENT &&
- _hoster != host_->get_client()) {
- if (!is_already_connected(_hoster, its_client.first)) {
- create_client_routing_info(_hoster);
- insert_client_routing_info(_hoster,
- routing_info_entry_e::RIE_ADD_CLIENT,
- its_client.first);
- send_client_routing_info(_hoster);
- }
- }
- }
- if (its_client.first != VSOMEIP_ROUTING_CLIENT &&
- its_client.first != get_client()) {
- create_client_routing_info(its_client.first);
- insert_client_routing_info(its_client.first, _entry, _hoster,
- _service, _instance, _major, _minor);
- send_client_routing_info(its_client.first);
- }
- }
- }
- }
-}
-
-bool routing_manager_stub::is_already_connected(client_t _source, client_t _sink) {
- return connection_matrix_[_source].find(_sink) != connection_matrix_[_source].end();
-}
-
-void routing_manager_stub::broadcast(const std::vector<byte_t> &_command) const {
- std::lock_guard<std::mutex> its_guard(routing_info_mutex_);
- for (auto a : routing_info_) {
- if (a.first != VSOMEIP_ROUTING_CLIENT && a.first != host_->get_client()) {
- std::shared_ptr<endpoint> its_endpoint
- = host_->find_local(a.first);
- if (its_endpoint) {
- its_endpoint->send(&_command[0], uint32_t(_command.size()), true);
- }
- }
- }
-}
-
-void routing_manager_stub::send_subscribe(std::shared_ptr<vsomeip::endpoint> _target,
- client_t _client, service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, major_version_t _major,
- event_t _event, pending_subscription_id_t _subscription_id) {
- if (_target) {
- byte_t its_command[VSOMEIP_SUBSCRIBE_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_SUBSCRIBE_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_SUBSCRIBE;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &_client,
- sizeof(_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_eventgroup,
- sizeof(_eventgroup));
- its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6] = _major;
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 7], &_event,
- sizeof(_event));
- // set byte for subscription_type to zero. It's only used
- // in subscribe messages sent from rm_proxies to rm_stub.
- its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 9] = 0x0;
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 10],
- &_subscription_id, sizeof(_subscription_id));
-
- _target->send(its_command, sizeof(its_command));
- } else {
- VSOMEIP_WARNING << __func__ << " Couldn't send subscription to local client ["
- << 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 << "]"
- << " subscriber: "<< std::hex << std::setw(4) << std::setfill('0')
- << _client;
- }
-}
-
-void routing_manager_stub::send_unsubscribe(std::shared_ptr<vsomeip::endpoint> _target,
- client_t _client, service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event,
- pending_subscription_id_t _unsubscription_id) {
- if (_target) {
- byte_t its_command[VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_UNSUBSCRIBE;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &_client,
- sizeof(_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_eventgroup,
- sizeof(_eventgroup));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6], &_event,
- sizeof(_event));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 8], &_unsubscription_id,
- sizeof(_unsubscription_id));
-
- _target->send(its_command, sizeof(its_command));
- } else {
- VSOMEIP_WARNING << __func__ << " Couldn't send unsubscription to local client ["
- << 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 << "]"
- << " subscriber: "<< std::hex << std::setw(4) << std::setfill('0')
- << _client;
- }
-}
-
-void routing_manager_stub::send_subscribe_ack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event) {
-
- std::shared_ptr<endpoint> its_endpoint = host_->find_local(_client);
- if (its_endpoint) {
- byte_t its_command[VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- client_t this_client = get_client();
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_SUBSCRIBE_ACK;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &this_client,
- sizeof(this_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_eventgroup,
- sizeof(_eventgroup));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6], &_client,
- sizeof(_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 8], &_event,
- sizeof(_event));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 10],
- &DEFAULT_SUBSCRIPTION, sizeof(DEFAULT_SUBSCRIPTION));
-
- its_endpoint->send(&its_command[0], sizeof(its_command), true);
- }
-}
-
-void routing_manager_stub::send_subscribe_nack(client_t _client, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event) {
-
- std::shared_ptr<endpoint> its_endpoint = host_->find_local(_client);
- if (its_endpoint) {
- byte_t its_command[VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
-
- client_t this_client = get_client();
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_SUBSCRIBE_NACK;
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &this_client,
- sizeof(this_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_eventgroup,
- sizeof(_eventgroup));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6], &_client,
- sizeof(_client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 8], &_event,
- sizeof(_event));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 10],
- &DEFAULT_SUBSCRIPTION, sizeof(DEFAULT_SUBSCRIPTION));
-
- its_endpoint->send(&its_command[0], sizeof(its_command), true);
- }
-}
-
-bool routing_manager_stub::contained_in_routing_info(
- client_t _client, service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) const {
- std::lock_guard<std::mutex> its_guard(routing_info_mutex_);
- auto found_client = routing_info_.find(_client);
- if (found_client != routing_info_.end()) {
- auto found_service = found_client->second.second.find(_service);
- if (found_service != found_client->second.second.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- if (found_instance->second.first == _major
- && found_instance->second.second == _minor) {
- return true;
- }
- }
- }
- }
- return false;
-}
-
-// Watchdog
-void routing_manager_stub::broadcast_ping() const {
- broadcast(its_ping_);
-}
-
-void routing_manager_stub::on_pong(client_t _client) {
- {
- std::lock_guard<std::mutex> its_lock(routing_info_mutex_);
- auto found_info = routing_info_.find(_client);
- if (found_info != routing_info_.end()) {
- found_info->second.first = 0;
- } else {
- VSOMEIP_ERROR << "Received PONG from unregistered application: "
- << std::hex << std::setw(4) << std::setfill('0') << _client;
- }
- }
- remove_from_pinged_clients(_client);
- host_->on_pong(_client);
-}
-
-void routing_manager_stub::start_watchdog() {
-
- std::function<void(boost::system::error_code const &)> its_callback =
- [this](boost::system::error_code const &_error) {
- if (!_error)
- check_watchdog();
- };
- {
- std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
- // Divide / 2 as start and check sleep each
- watchdog_timer_.expires_from_now(
- std::chrono::milliseconds(
- configuration_->get_watchdog_timeout() / 2));
-
- watchdog_timer_.async_wait(its_callback);
- }
-}
-
-void routing_manager_stub::check_watchdog() {
- {
- std::lock_guard<std::mutex> its_guard(routing_info_mutex_);
- for (auto i = routing_info_.begin(); i != routing_info_.end(); ++i) {
- i->second.first++;
- }
- }
- broadcast_ping();
-
-
- std::function<void(boost::system::error_code const &)> its_callback =
- [this](boost::system::error_code const &_error) {
- (void)_error;
- std::list< client_t > lost;
- {
- std::lock_guard<std::mutex> its_lock(routing_info_mutex_);
- for (auto i : routing_info_) {
- if (i.first > 0 && i.first != host_->get_client()) {
- if (i.second.first > configuration_->get_allowed_missing_pongs()) {
- VSOMEIP_WARNING << "Lost contact to application " << std::hex << (int)i.first;
- lost.push_back(i.first);
- }
- }
- }
- }
- for (auto i : lost) {
- host_->handle_client_error(i);
- }
- start_watchdog();
- };
- {
- std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
- watchdog_timer_.expires_from_now(
- std::chrono::milliseconds(
- configuration_->get_watchdog_timeout() / 2));
- watchdog_timer_.async_wait(its_callback);
- }
-}
-
-void routing_manager_stub::create_local_receiver() {
- std::lock_guard<std::mutex> its_lock(local_receiver_mutex_);
-
- if (local_receiver_) {
- return;
- }
- std::stringstream its_local_receiver_path;
- its_local_receiver_path << utility::get_base_path(configuration_) << std::hex << host_->get_client();
- local_receiver_path_ = its_local_receiver_path.str();
-#if _WIN32
- ::_unlink(local_receiver_path_.c_str());
- int port = VSOMEIP_INTERNAL_BASE_PORT;
-#else
- if (!check_credentials(get_client(), getuid(), getgid())) {
- VSOMEIP_ERROR << "routing_manager_stub::create_local_receiver: "
- << std::hex << "Client " << get_client() << " isn't allow"
- << " to create a server endpoint due to credential check failed!";
- return;
- }
- if (-1 == ::unlink(local_receiver_path_.c_str()) && errno != ENOENT) {
- VSOMEIP_ERROR << "routing_manager_stub::create_local_receiver unlink (local receiver) failed ("
- << local_receiver_path_ << "): "<< std::strerror(errno);
- }
-
- const mode_t previous_mask(::umask(static_cast<mode_t>(configuration_->get_umask())));
-#endif
- try {
- local_receiver_ =
- std::make_shared < local_server_endpoint_impl
- > (shared_from_this(),
- #ifdef _WIN32
- boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port + host_->get_client()),
- #else
- boost::asio::local::stream_protocol::endpoint(local_receiver_path_),
- #endif
- io_, configuration_->get_max_message_size_local(),
- configuration_->get_buffer_shrink_threshold(),
- configuration_->get_endpoint_queue_limit_local());
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << ERROR_INFO[static_cast<int>(error_code_e::SERVER_ENDPOINT_CREATION_FAILED)]
- << " (" << static_cast<int>(error_code_e::SERVER_ENDPOINT_CREATION_FAILED) << ")";
- VSOMEIP_ERROR << "routing_manager_stub::_local_receiver Client ID: "
- << std::hex << VSOMEIP_ROUTING_CLIENT << ": " << e.what();
- }
-#ifndef _WIN32
- ::umask(previous_mask);
-#endif
- local_receiver_->start();
-}
-
-bool routing_manager_stub::send_ping(client_t _client) {
- std::shared_ptr<endpoint> its_endpoint = host_->find_local(_client);
- if (!its_endpoint) {
- return false;
- }
-
- {
- std::lock_guard<std::mutex> its_lock(pinged_clients_mutex_);
-
- if (pinged_clients_.find(_client) != pinged_clients_.end()) {
- // client was already pinged: don't ping again and wait for answer
- // or timeout of previous ping.
- return true;
- }
-
- boost::system::error_code ec;
- pinged_clients_timer_.cancel(ec);
- if (ec) {
- VSOMEIP_ERROR << "routing_manager_stub::send_ping cancellation of "
- "timer failed: " << ec.message();
- }
- const std::chrono::steady_clock::time_point now(
- std::chrono::steady_clock::now());
-
- std::chrono::milliseconds next_timeout(configured_watchdog_timeout_);
- for (const auto &tp : pinged_clients_) {
- const std::chrono::milliseconds its_clients_timeout =
- std::chrono::duration_cast<std::chrono::milliseconds>(
- now - tp.second);
- if (next_timeout > its_clients_timeout) {
- next_timeout = its_clients_timeout;
- }
- }
-
- pinged_clients_[_client] = now;
-
- ec.clear();
- pinged_clients_timer_.expires_from_now(next_timeout, ec);
- if (ec) {
- VSOMEIP_ERROR<< "routing_manager_stub::send_ping setting "
- "expiry time of timer failed: " << ec.message();
- }
- pinged_clients_timer_.async_wait(
- std::bind(&routing_manager_stub::on_ping_timer_expired, this,
- std::placeholders::_1));
- return its_endpoint->send(&its_ping_[0], uint32_t(its_ping_.size()),
- true);
- }
-}
-
-void routing_manager_stub::on_ping_timer_expired(
- boost::system::error_code const &_error) {
- if(_error) {
- return;
- }
- std::forward_list<client_t> timed_out_clients;
- std::chrono::milliseconds next_timeout(configured_watchdog_timeout_);
- bool pinged_clients_remaining(false);
-
- {
- // remove timed out clients
- std::lock_guard<std::mutex> its_lock(pinged_clients_mutex_);
- const std::chrono::steady_clock::time_point now(
- std::chrono::steady_clock::now());
-
- for (auto client_iter = pinged_clients_.begin();
- client_iter != pinged_clients_.end(); ) {
- if ((now - client_iter->second) >= configured_watchdog_timeout_) {
- timed_out_clients.push_front(client_iter->first);
- client_iter = pinged_clients_.erase(client_iter);
- } else {
- ++client_iter;
- }
- }
- pinged_clients_remaining = (pinged_clients_.size() > 0);
-
- if(pinged_clients_remaining) {
- // find out next timeout
- for (const auto &tp : pinged_clients_) {
- const std::chrono::milliseconds its_clients_timeout =
- std::chrono::duration_cast<std::chrono::milliseconds>(
- now - tp.second);
- if (next_timeout > its_clients_timeout) {
- next_timeout = its_clients_timeout;
- }
- }
- }
- }
-
- for (const client_t client : timed_out_clients) {
- // Client did not respond to ping. Report client_error in order to
- // accept pending offers trying to replace the offers of the client
- // that seems to be gone.
- host_->handle_client_error(client);
- }
- if (pinged_clients_remaining) {
- boost::system::error_code ec;
- pinged_clients_timer_.expires_from_now(next_timeout, ec);
- if (ec) {
- VSOMEIP_ERROR<< "routing_manager_stub::on_ping_timer_expired "
- "setting expiry time of timer failed: " << ec.message();
- }
- pinged_clients_timer_.async_wait(
- std::bind(&routing_manager_stub::on_ping_timer_expired, this,
- std::placeholders::_1));
- }
-}
-
-void routing_manager_stub::remove_from_pinged_clients(client_t _client) {
- std::lock_guard<std::mutex> its_lock(pinged_clients_mutex_);
- if (!pinged_clients_.size()) {
- return;
- }
- boost::system::error_code ec;
- pinged_clients_timer_.cancel(ec);
- if (ec) {
- VSOMEIP_ERROR << "routing_manager_stub::remove_from_pinged_clients "
- "cancellation of timer failed: " << ec.message();
- }
- pinged_clients_.erase(_client);
-
- if (!pinged_clients_.size()) {
- return;
- }
- const std::chrono::steady_clock::time_point now(
- std::chrono::steady_clock::now());
- std::chrono::milliseconds next_timeout(configured_watchdog_timeout_);
- // find out next timeout
- for (const auto &tp : pinged_clients_) {
- const std::chrono::milliseconds its_clients_timeout =
- std::chrono::duration_cast<std::chrono::milliseconds>(
- now - tp.second);
- if (next_timeout > its_clients_timeout) {
- next_timeout = its_clients_timeout;
- }
- }
- ec.clear();
- pinged_clients_timer_.expires_from_now(next_timeout, ec);
- if (ec) {
- VSOMEIP_ERROR<< "routing_manager_stub::remove_from_pinged_clients "
- "setting expiry time of timer failed: " << ec.message();
- }
- pinged_clients_timer_.async_wait(
- std::bind(&routing_manager_stub::on_ping_timer_expired, this,
- std::placeholders::_1));
-}
-
-bool routing_manager_stub::is_registered(client_t _client) const {
- std::lock_guard<std::mutex> its_lock(routing_info_mutex_);
- return (routing_info_.find(_client) != routing_info_.end());
-}
-
-void routing_manager_stub::update_registration(client_t _client,
- registration_type_e _type) {
-
- VSOMEIP_INFO << "Application/Client "
- << std::hex << std::setw(4) << std::setfill('0') << _client
- << " is "
- << (_type == registration_type_e::REGISTER ?
- "registering." : "deregistering.");
-
- if (_type == registration_type_e::DEREGISTER) {
- // If we receive a DEREGISTER client command
- // the endpoint error handler is not longer needed
- // as the client is going down anyways.
-
- // Normally the handler is removed in "remove_local"
- // anyways, but as some time takes place until
- // the client DEREGISTER command is consumed
- // and therefore "remove_local" is finally called
- // it was possible the same client registers itself
- // again in very short time and then could "overtake"
- // the occurring error in the endpoint and was then
- // erroneously unregistered even that error has
- // nothing to do with the newly registered client.
-
- auto its_endpoint = host_->find_local(_client);
- if (its_endpoint) {
- its_endpoint->register_error_handler(nullptr);
- }
- }
-
- std::lock_guard<std::mutex> its_lock(client_registration_mutex_);
- pending_client_registrations_[_client].push_back(_type);
- client_registration_condition_.notify_one();
-
- if (_type != registration_type_e::REGISTER) {
- std::lock_guard<std::mutex> its_lock(used_client_ids_mutex_);
- used_client_ids_.erase(_client);
- }
-}
-
-client_t routing_manager_stub::get_client() const {
- return host_->get_client();
-}
-
-void routing_manager_stub::handle_requests(const client_t _client, std::set<service_data_t>& _requests) {
- if (!_requests.size()) {
- return;
- }
- bool service_available(false);
- std::lock_guard<std::mutex> its_guard(routing_info_mutex_);
- create_client_routing_info(_client);
- for (auto request : _requests) {
- service_requests_[_client][request.service_][request.instance_]
- = std::make_pair(request.major_, request.minor_);
- for (auto found_client : routing_info_) {
- auto found_service = found_client.second.second.find(request.service_);
- if (found_service != found_client.second.second.end()) {
- if (request.instance_ == ANY_INSTANCE) {
- if (found_client.first != VSOMEIP_ROUTING_CLIENT &&
- found_client.first != host_->get_client()) {
- if (!is_already_connected(found_client.first, _client)) {
- if (_client == found_client.first) {
- service_available = true;
- insert_client_routing_info(found_client.first,
- routing_info_entry_e::RIE_ADD_CLIENT, _client);
- } else {
- create_client_routing_info(found_client.first);
- insert_client_routing_info(found_client.first,
- routing_info_entry_e::RIE_ADD_CLIENT, _client);
- send_client_routing_info(found_client.first);
- }
- }
- }
- if (_client != VSOMEIP_ROUTING_CLIENT &&
- _client != host_->get_client()) {
- for (auto instance : found_service->second) {
- service_available = true;
- insert_client_routing_info(_client,
- routing_info_entry_e::RIE_ADD_SERVICE_INSTANCE,
- found_client.first, request.service_, instance.first,
- instance.second.first, instance.second.second);
- }
- }
- break;
- } else {
- auto found_instance = found_service->second.find(request.instance_);
- if (found_instance != found_service->second.end()) {
- if (found_client.first != VSOMEIP_ROUTING_CLIENT &&
- found_client.first != host_->get_client()) {
- if (!is_already_connected(found_client.first, _client)) {
- if (_client == found_client.first) {
- service_available = true;
- insert_client_routing_info(found_client.first,
- routing_info_entry_e::RIE_ADD_CLIENT, _client);
- } else {
- create_client_routing_info(found_client.first);
- insert_client_routing_info(found_client.first,
- routing_info_entry_e::RIE_ADD_CLIENT, _client);
- send_client_routing_info(found_client.first);
- }
- }
- }
- if (_client != VSOMEIP_ROUTING_CLIENT &&
- _client != host_->get_client()) {
- service_available = true;
- insert_client_routing_info(_client,
- routing_info_entry_e::RIE_ADD_SERVICE_INSTANCE,
- found_client.first, request.service_, request.instance_,
- found_instance->second.first,
- found_instance->second.second);
- }
- break;
- }
- }
- }
- }
- }
- if (service_available) {
- send_client_routing_info(_client);
- }
-}
-
-#ifndef _WIN32
-bool routing_manager_stub::check_credentials(client_t _client, uid_t _uid, gid_t _gid) {
- return configuration_->check_credentials(_client, _uid, _gid);
-}
-#endif
-
-void routing_manager_stub::send_identify_request_command(std::shared_ptr<vsomeip::endpoint> _target,
- service_t _service, instance_t _instance, major_version_t _major, bool _reliable) {
- if (_target) {
- byte_t its_command[VSOMEIP_ID_REQUEST_COMMAND_SIZE];
- uint32_t its_size = VSOMEIP_ID_REQUEST_COMMAND_SIZE
- - VSOMEIP_COMMAND_HEADER_SIZE;
- its_command[VSOMEIP_COMMAND_TYPE_POS] = VSOMEIP_ID_REQUEST;
- client_t client = get_client();
- std::memcpy(&its_command[VSOMEIP_COMMAND_CLIENT_POS], &client,
- sizeof(client));
- std::memcpy(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], &its_size,
- sizeof(its_size));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS], &_service,
- sizeof(_service));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 2], &_instance,
- sizeof(_instance));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_major,
- sizeof(_major));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 5], &_reliable,
- sizeof(_reliable));
-
- _target->send(its_command, sizeof(its_command));
- }
-}
-
-void routing_manager_stub::on_client_id_timer_expired(boost::system::error_code const &_error) {
- std::set<client_t> used_client_ids;
- {
- std::lock_guard<std::mutex> its_lock(used_client_ids_mutex_);
- used_client_ids = used_client_ids_;
- used_client_ids_.clear();
- }
-
- std::set<client_t> erroneous_clients;
- if (!_error) {
- std::lock_guard<std::mutex> its_lock(routing_info_mutex_);
- for (auto client : used_client_ids) {
- if (client != VSOMEIP_ROUTING_CLIENT && client != get_client()) {
- if (routing_info_.find(client) == routing_info_.end()) {
- erroneous_clients.insert(client);
- }
- }
- }
- }
- for (auto client : erroneous_clients) {
- VSOMEIP_WARNING << "Releasing client identifier "
- << std::hex << std::setw(4) << std::setfill('0') << client << ". "
- << "Its corresponding application went offline while no "
- << "routing manager was running.";
- host_->handle_client_error(client);
- }
-}
-
-void routing_manager_stub::print_endpoint_status() const {
- if (local_receiver_) {
- local_receiver_->print_status();
- }
- if (endpoint_) {
- endpoint_->print_status();
- }
-}
-
-} // namespace vsomeip
diff --git a/implementation/routing/src/serviceinfo.cpp b/implementation/routing/src/serviceinfo.cpp
deleted file mode 100644
index 3afc937..0000000
--- a/implementation/routing/src/serviceinfo.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (C) 2014-2017 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/serviceinfo.hpp"
-
-namespace vsomeip {
-
-serviceinfo::serviceinfo(major_version_t _major, minor_version_t _minor,
- ttl_t _ttl, bool _is_local)
- : group_(0),
- major_(_major),
- minor_(_minor),
- ttl_(0),
- reliable_(nullptr),
- unreliable_(nullptr),
- is_local_(_is_local),
- is_in_mainphase_(false) {
-
- std::chrono::seconds ttl = static_cast<std::chrono::seconds> (_ttl);
- ttl_ = std::chrono::duration_cast<std::chrono::milliseconds>(ttl);
-}
-
-serviceinfo::~serviceinfo() {
-}
-
-servicegroup * serviceinfo::get_group() const {
- return group_;
-}
-
-void serviceinfo::set_group(servicegroup *_group) {
- group_ = _group;
-}
-
-major_version_t serviceinfo::get_major() const {
- return major_;
-}
-
-minor_version_t serviceinfo::get_minor() const {
- return minor_;
-}
-
-ttl_t serviceinfo::get_ttl() const {
- std::lock_guard<std::mutex> its_lock(ttl_mutex_);
- ttl_t ttl = static_cast<ttl_t>(std::chrono::duration_cast<std::chrono::seconds>(ttl_).count());
- return ttl;
-}
-
-void serviceinfo::set_ttl(ttl_t _ttl) {
- std::lock_guard<std::mutex> its_lock(ttl_mutex_);
- std::chrono::seconds ttl = static_cast<std::chrono::seconds>(_ttl);
- ttl_ = std::chrono::duration_cast<std::chrono::milliseconds> (ttl);
-}
-
-std::chrono::milliseconds serviceinfo::get_precise_ttl() const {
- std::lock_guard<std::mutex> its_lock(ttl_mutex_);
- return ttl_;
-}
-
-void serviceinfo::set_precise_ttl(std::chrono::milliseconds _precise_ttl) {
- std::lock_guard<std::mutex> its_lock(ttl_mutex_);
- ttl_ = _precise_ttl;
-}
-
-std::shared_ptr<endpoint> serviceinfo::get_endpoint(bool _reliable) const {
- std::lock_guard<std::mutex> its_lock(endpoint_mutex_);
- return (_reliable ? reliable_ : unreliable_);
-}
-
-void serviceinfo::set_endpoint(std::shared_ptr<endpoint> _endpoint,
- bool _reliable) {
- std::lock_guard<std::mutex> its_lock(endpoint_mutex_);
- if (_reliable) {
- reliable_ = _endpoint;
- } else {
- unreliable_ = _endpoint;
- }
-}
-
-void serviceinfo::add_client(client_t _client) {
- std::lock_guard<std::mutex> its_lock(requesters_mutex_);
- requesters_.insert(_client);
-}
-
-void serviceinfo::remove_client(client_t _client) {
- std::lock_guard<std::mutex> its_lock(requesters_mutex_);
- requesters_.erase(_client);
-}
-
-uint32_t serviceinfo::get_requesters_size() {
- std::lock_guard<std::mutex> its_lock(requesters_mutex_);
- return static_cast<std::uint32_t>(requesters_.size());
-}
-
-bool serviceinfo::is_local() const {
- return is_local_;
-}
-
-bool serviceinfo::is_in_mainphase() const {
- return is_in_mainphase_;
-}
-
-void serviceinfo::set_is_in_mainphase(bool _in_mainphase) {
- is_in_mainphase_ = _in_mainphase;
-}
-
-} // namespace vsomeip
-
diff --git a/implementation/runtime/include/application_impl.hpp b/implementation/runtime/include/application_impl.hpp
deleted file mode 100644
index efd7d7d..0000000
--- a/implementation/runtime/include/application_impl.hpp
+++ /dev/null
@@ -1,429 +0,0 @@
-// Copyright (C) 2014-2017 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_APPLICATION_IMPL_HPP
-#define VSOMEIP_APPLICATION_IMPL_HPP
-
-#include <atomic>
-#include <condition_variable>
-#include <deque>
-#include <map>
-#include <mutex>
-#include <set>
-#include <string>
-#include <thread>
-#include <vector>
-
-#include <boost/asio/signal_set.hpp>
-#include <boost/asio/steady_timer.hpp>
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/application.hpp>
-
-#include "../../routing/include/routing_manager_host.hpp"
-#include "../../configuration/include/internal.hpp"
-
-namespace vsomeip {
-
-class runtime;
-class configuration;
-class logger;
-class routing_manager;
-class routing_manager_stub;
-
-class application_impl: public application,
- public routing_manager_host,
- public std::enable_shared_from_this<application_impl> {
-public:
- VSOMEIP_EXPORT application_impl(const std::string &_name);
- VSOMEIP_EXPORT ~application_impl();
-
- VSOMEIP_EXPORT void set_configuration(const std::shared_ptr<configuration> _configuration);
-
- VSOMEIP_EXPORT bool init();
- VSOMEIP_EXPORT void start();
- VSOMEIP_EXPORT void stop();
-
- // Provide services / events
- VSOMEIP_EXPORT void offer_service(service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor);
-
- VSOMEIP_EXPORT void stop_offer_service(service_t _service, instance_t _instance,
- major_version_t _major = DEFAULT_MAJOR, minor_version_t _minor = DEFAULT_MINOR);
-
- VSOMEIP_EXPORT void offer_event(service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroups,
- bool _is_field);
- VSOMEIP_EXPORT void offer_event(service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroups,
- bool _is_field,
- std::chrono::milliseconds _cycle, bool _change_resets_cycle_,
- const epsilon_change_func_t &_epsilon_change_func);
- VSOMEIP_EXPORT void stop_offer_event(service_t _service,
- instance_t _instance, event_t _event);
-
- // Consume services / events
- VSOMEIP_EXPORT void request_service(service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor, bool _use_exclusive_proxy);
- VSOMEIP_EXPORT void release_service(service_t _service,
- instance_t _instance);
-
- VSOMEIP_EXPORT void request_event(service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroups,
- bool _is_field);
- VSOMEIP_EXPORT void release_event(service_t _service,
- instance_t _instance, event_t _event);
-
- VSOMEIP_EXPORT void subscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, major_version_t _major,
- subscription_type_e _subscription_type, event_t _event);
-
- VSOMEIP_EXPORT void unsubscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup);
- VSOMEIP_EXPORT void unsubscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event);
-
- VSOMEIP_EXPORT bool is_available(service_t _service, instance_t _instance,
- major_version_t _major = DEFAULT_MAJOR, minor_version_t _minor = DEFAULT_MINOR) const;
-
- VSOMEIP_EXPORT void send(std::shared_ptr<message> _message, bool _flush);
-
- VSOMEIP_EXPORT void notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload) const;
- VSOMEIP_EXPORT void notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- bool _force) const;
- VSOMEIP_EXPORT void notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- bool _force, bool _flush) const;
-
- VSOMEIP_EXPORT void notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload, client_t _client) const;
- VSOMEIP_EXPORT void notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload, client_t _client,
- bool _force) const;
- VSOMEIP_EXPORT void notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload, client_t _client,
- bool _force, bool _flush) const;
-
- VSOMEIP_EXPORT void register_state_handler(state_handler_t _handler);
- VSOMEIP_EXPORT void unregister_state_handler();
-
- VSOMEIP_EXPORT void register_message_handler(service_t _service,
- instance_t _instance, method_t _method, message_handler_t _handler);
- VSOMEIP_EXPORT void unregister_message_handler(service_t _service,
- instance_t _instance, method_t _method);
-
- VSOMEIP_EXPORT void register_availability_handler(service_t _service,
- instance_t _instance, availability_handler_t _handler,
- major_version_t _major = DEFAULT_MAJOR, minor_version_t _minor = DEFAULT_MINOR);
- VSOMEIP_EXPORT void unregister_availability_handler(service_t _service,
- instance_t _instance,
- major_version_t _major = DEFAULT_MAJOR, minor_version_t _minor = DEFAULT_MINOR);
-
- VSOMEIP_EXPORT void register_subscription_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, subscription_handler_t _handler);
- VSOMEIP_EXPORT void unregister_subscription_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup);
-
- VSOMEIP_EXPORT void register_subscription_error_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- error_handler_t _handler);
- VSOMEIP_EXPORT void unregister_subscription_error_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup);
-
- VSOMEIP_EXPORT bool is_routing() const;
-
- // routing_manager_host
- VSOMEIP_EXPORT const std::string & get_name() const;
- VSOMEIP_EXPORT client_t get_client() const;
- VSOMEIP_EXPORT std::shared_ptr<configuration> get_configuration() const;
- VSOMEIP_EXPORT boost::asio::io_service & get_io();
-
- VSOMEIP_EXPORT void on_state(state_type_e _state);
- VSOMEIP_EXPORT void on_availability(service_t _service, instance_t _instance,
- bool _is_available, major_version_t _major, minor_version_t _minor);
- VSOMEIP_EXPORT void on_message(const std::shared_ptr<message> &&_message);
- VSOMEIP_EXPORT void on_error(error_code_e _error);
- VSOMEIP_EXPORT void on_subscription(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, client_t _client, bool _subscribed, std::function<void(bool)> _accepted_cb);
- VSOMEIP_EXPORT void on_subscription_error(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, uint16_t _error);
- VSOMEIP_EXPORT void on_subscription_status(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event, uint16_t _error);
- VSOMEIP_EXPORT void register_subscription_status_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- subscription_status_handler_t _handler);
-
- // service_discovery_host
- VSOMEIP_EXPORT routing_manager * get_routing_manager() const;
-
- VSOMEIP_EXPORT bool are_available(available_t &_available,
- service_t _service = ANY_SERVICE, instance_t _instance = ANY_INSTANCE,
- major_version_t _major = ANY_MAJOR, minor_version_t _minor = ANY_MINOR) const;
- VSOMEIP_EXPORT void set_routing_state(routing_state_e _routing_state);
-
- VSOMEIP_EXPORT void clear_all_handler();
-
- VSOMEIP_EXPORT void register_subscription_status_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- subscription_status_handler_t _handler, bool _is_selective);
-
- VSOMEIP_EXPORT void get_offered_services_async(offer_type_e _offer_type, offered_services_handler_t _handler);
-
- VSOMEIP_EXPORT void on_offered_services_info(std::vector<std::pair<service_t, instance_t>> &_services);
-
- VSOMEIP_EXPORT void set_watchdog_handler(watchdog_handler_t _handler, std::chrono::seconds _interval);
-
- VSOMEIP_EXPORT void register_async_subscription_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, async_subscription_handler_t _handler);
-
-private:
- //
- // Types
- //
-
- enum class handler_type_e : uint8_t {
- MESSAGE,
- AVAILABILITY,
- STATE,
- SUBSCRIPTION,
- OFFERED_SERVICES_INFO,
- WATCHDOG,
- UNKNOWN
- };
-
- struct sync_handler {
-
- sync_handler(std::function<void()> _handler) :
- handler_(_handler),
- service_id_(ANY_SERVICE),
- instance_id_(ANY_INSTANCE),
- method_id_(ANY_METHOD),
- session_id_(0),
- eventgroup_id_(0),
- handler_type_(handler_type_e::UNKNOWN) { }
-
- sync_handler(service_t _service_id, instance_t _instance_id,
- method_t _method_id, session_t _session_id,
- eventgroup_t _eventgroup_id, handler_type_e _handler_type) :
- handler_(nullptr),
- service_id_(_service_id),
- instance_id_(_instance_id),
- method_id_(_method_id),
- session_id_(_session_id),
- eventgroup_id_(_eventgroup_id),
- handler_type_(_handler_type) { }
-
- std::function<void()> handler_;
- service_t service_id_;
- instance_t instance_id_;
- method_t method_id_;
- session_t session_id_;
- eventgroup_t eventgroup_id_;
- handler_type_e handler_type_;
- };
-
- struct message_handler {
- message_handler(message_handler_t _handler) :
- handler_(_handler) {}
-
- bool operator<(const message_handler& _other) const {
- return handler_.target<void (*)(const std::shared_ptr<message> &)>()
- < _other.handler_.target<void (*)(const std::shared_ptr<message> &)>();
- }
- message_handler_t handler_;
- };
-
- //
- // Methods
- //
- inline void update_session() {
- session_++;
- if (0 == session_) {
- session_++;
- }
- }
-
- bool is_available_unlocked(service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) const;
-
- bool are_available_unlocked(available_t &_available,
- service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) const;
- void do_register_availability_handler(service_t _service,
- instance_t _instance, availability_handler_t _handler,
- major_version_t _major, minor_version_t _minor);
-
-
- void main_dispatch();
- void dispatch();
- void invoke_handler(std::shared_ptr<sync_handler> &_handler);
- std::shared_ptr<sync_handler> get_next_handler();
- void reschedule_availability_handler(const std::shared_ptr<sync_handler> &_handler);
- bool has_active_dispatcher();
- bool is_active_dispatcher(const std::thread::id &_id);
- void remove_elapsed_dispatchers();
-
- void shutdown();
-
- void send_back_cached_event(service_t _service, instance_t _instance, event_t _event);
- void send_back_cached_eventgroup(service_t _service, instance_t _instance, eventgroup_t _eventgroup);
- void check_send_back_cached_event(service_t _service, instance_t _instance,
- event_t _event, eventgroup_t _eventgroup,
- bool *_send_back_cached_event,
- bool *_send_back_cached_eventgroup);
- void remove_subscription(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event);
- bool check_for_active_subscription(service_t _service, instance_t _instance,
- event_t _event);
-
- void deliver_subscription_state(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event, uint16_t _error);
-
- bool check_subscription_state(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event);
-
- void print_blocking_call(std::shared_ptr<sync_handler> _handler);
-
- void watchdog_cbk(boost::system::error_code const &_error);
-
- //
- // Attributes
- //
- std::shared_ptr<runtime> runtime_;
- client_t client_; // unique application identifier
- session_t session_;
- std::mutex session_mutex_;
-
- std::mutex initialize_mutex_;
- bool is_initialized_;
-
- std::string name_;
- std::shared_ptr<configuration> configuration_;
-
- boost::asio::io_service io_;
- std::set<std::shared_ptr<std::thread> > io_threads_;
- std::shared_ptr<boost::asio::io_service::work> work_;
-
- // Proxy to or the Routing Manager itself
- std::shared_ptr<routing_manager> routing_;
-
- // vsomeip state (registered / deregistered)
- state_type_e state_;
-
- // vsomeip state handler
- std::mutex state_handler_mutex_;
- state_handler_t handler_;
-
- // vsomeip offered services handler
- std::mutex offered_services_handler_mutex_;
- offered_services_handler_t offered_services_handler_;
-
- // Method/Event (=Member) handlers
- std::map<service_t,
- std::map<instance_t, std::map<method_t, message_handler_t> > > members_;
- mutable std::mutex members_mutex_;
-
- // Availability handlers
- typedef std::map<major_version_t, std::map<minor_version_t, std::pair<availability_handler_t,
- bool>>> availability_major_minor_t;
- std::map<service_t, std::map<instance_t, availability_major_minor_t>> availability_;
- mutable std::mutex availability_mutex_;
-
- // Availability
- mutable available_t available_;
-
- // Subscription handlers
- std::map<service_t,
- std::map<instance_t,
- std::map<eventgroup_t,
- std::pair<subscription_handler_t, async_subscription_handler_t>>>> subscription_;
- mutable std::mutex subscription_mutex_;
- std::map<service_t,
- std::map<instance_t, std::map<eventgroup_t,
- std::map<client_t, error_handler_t > > > > eventgroup_error_handlers_;
- mutable std::mutex subscription_error_mutex_;
-
-#ifdef VSOMEIP_ENABLE_SIGNAL_HANDLING
- // Signals
- boost::asio::signal_set signals_;
- bool catched_signal_;
-#endif
-
- // Handlers
- mutable std::deque<std::shared_ptr<sync_handler>> handlers_;
- mutable std::mutex handlers_mutex_;
-
- // Dispatching
- std::atomic<bool> is_dispatching_;
- // Dispatcher threads
- std::map<std::thread::id, std::shared_ptr<std::thread>> dispatchers_;
- // Dispatcher threads that elapsed and can be removed
- std::set<std::thread::id> elapsed_dispatchers_;
- // Dispatcher threads that are running
- std::set<std::thread::id> running_dispatchers_;
- // Mutex to protect access to dispatchers_ & elapsed_dispatchers_
- std::mutex dispatcher_mutex_;
-
- // Condition to wakeup the dispatcher thread
- mutable std::condition_variable dispatcher_condition_;
- std::size_t max_dispatchers_;
- std::size_t max_dispatch_time_;
-
- // Workaround for destruction problem
- std::shared_ptr<logger> logger_;
-
- std::condition_variable stop_cv_;
- std::mutex start_stop_mutex_;
- bool stopped_;
- std::thread stop_thread_;
-
- std::condition_variable block_stop_cv_;
- std::mutex block_stop_mutex_;
- bool block_stopping_;
-
- static uint32_t app_counter__;
- static std::mutex app_counter_mutex__;
-
- bool is_routing_manager_host_;
-
- // Event subscriptions
- std::mutex subscriptions_mutex_;
- std::map<service_t, std::map<instance_t,
- std::map<event_t, std::map<eventgroup_t, bool>>>> subscriptions_;
-
- std::thread::id stop_caller_id_;
- std::thread::id start_caller_id_;
-
- bool stopped_called_;
-
- std::map<service_t, std::map<instance_t, std::map<eventgroup_t,
- std::map<event_t, std::pair<subscription_status_handler_t, bool> > > > > subscription_status_handlers_;
- std::mutex subscription_status_handlers_mutex_;
-
- std::mutex subscriptions_state_mutex_;
- std::map<std::tuple<service_t, instance_t, eventgroup_t, event_t>,
- subscription_state_e> subscription_state_;
-
- std::mutex watchdog_timer_mutex_;
- boost::asio::steady_timer watchdog_timer_;
- watchdog_handler_t watchdog_handler_;
- std::chrono::seconds watchdog_interval_;
-
- bool client_side_logging_;
- std::set<std::tuple<service_t, instance_t> > client_side_logging_filter_;
-
- std::map<std::pair<service_t, instance_t>,
- std::deque<std::shared_ptr<sync_handler> > > availability_handlers_;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_APPLICATION_IMPL_HPP
diff --git a/implementation/runtime/include/runtime_impl.hpp b/implementation/runtime/include/runtime_impl.hpp
deleted file mode 100644
index c376e6d..0000000
--- a/implementation/runtime/include/runtime_impl.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (C) 2014-2017 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_RUNTIME_IMPL_HPP
-#define VSOMEIP_RUNTIME_IMPL_HPP
-
-#include <vsomeip/runtime.hpp>
-#include <map>
-#include <mutex>
-
-namespace vsomeip {
-
-class runtime_impl: public runtime {
-public:
-
- static std::string get_property(const std::string &_name);
- static void set_property(const std::string &_name, const std::string &_value);
-
- static std::shared_ptr<runtime> get();
-
- virtual ~runtime_impl();
-
- std::shared_ptr<application> create_application(
- const std::string &_name);
-
- std::shared_ptr<message> create_message(bool _reliable) const;
- std::shared_ptr<message> create_request(bool _reliable) const;
- std::shared_ptr<message> create_response(
- const std::shared_ptr<message> &_request) const;
- std::shared_ptr<message> create_notification(bool _reliable) const;
-
- std::shared_ptr<payload> create_payload() const;
- std::shared_ptr<payload> create_payload(const byte_t *_data,
- uint32_t _size) const;
- std::shared_ptr<payload> create_payload(
- const std::vector<byte_t> &_data) const;
-
- std::shared_ptr<application> get_application(
- const std::string &_name) const;
-
- void remove_application( const std::string &_name);
-
-private:
- static std::shared_ptr<runtime> the_runtime_;
- static std::map<std::string, std::string> properties_;
-
- std::map<std::string, std::weak_ptr<application>> applications_;
-
- mutable std::mutex applications_mutex_;
- static uint32_t postfix_id;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_RUNTIME_IMPL_HPP
diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp
deleted file mode 100644
index 720ddb1..0000000
--- a/implementation/runtime/src/application_impl.cpp
+++ /dev/null
@@ -1,2280 +0,0 @@
-// Copyright (C) 2014-2017 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 <future>
-#include <thread>
-#include <iomanip>
-
-#ifndef _WIN32
-#include <dlfcn.h>
-#endif
-
-#include <vsomeip/defines.hpp>
-#include <vsomeip/runtime.hpp>
-#include <vsomeip/plugins/application_plugin.hpp>
-#include <vsomeip/plugins/pre_configuration_plugin.hpp>
-
-#include "../include/application_impl.hpp"
-#include "../../configuration/include/configuration.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../message/include/serializer.hpp"
-#include "../../routing/include/routing_manager_impl.hpp"
-#include "../../routing/include/routing_manager_proxy.hpp"
-#include "../../utility/include/utility.hpp"
-#include "../../tracing/include/trace_connector.hpp"
-#include "../../tracing/include/enumeration_types.hpp"
-#include "../../plugin/include/plugin_manager.hpp"
-#include "../../endpoints/include/endpoint.hpp"
-
-namespace vsomeip {
-
-uint32_t application_impl::app_counter__ = 0;
-std::mutex application_impl::app_counter_mutex__;
-
-application_impl::application_impl(const std::string &_name)
- : runtime_(runtime::get()),
- client_(ILLEGAL_CLIENT),
- session_(1),
- is_initialized_(false), name_(_name),
- work_(std::make_shared<boost::asio::io_service::work>(io_)),
- routing_(0),
- state_(state_type_e::ST_DEREGISTERED),
-#ifdef VSOMEIP_ENABLE_SIGNAL_HANDLING
- signals_(io_, SIGINT, SIGTERM),
- catched_signal_(false),
-#endif
- is_dispatching_(false),
- max_dispatchers_(VSOMEIP_MAX_DISPATCHERS),
- max_dispatch_time_(VSOMEIP_MAX_DISPATCH_TIME),
- logger_(logger::get()),
- stopped_(false),
- block_stopping_(false),
- is_routing_manager_host_(false),
- stopped_called_(false),
- watchdog_timer_(io_),
- client_side_logging_(false) {
-}
-
-application_impl::~application_impl() {
- runtime_->remove_application(name_);
-}
-
-void application_impl::set_configuration(
- const std::shared_ptr<configuration> _configuration) {
- (void)_configuration;
- // Dummy.
-}
-
-bool application_impl::init() {
- if(is_initialized_) {
- VSOMEIP_WARNING << "Trying to initialize an already initialized application.";
- return true;
- }
- // Application name
- if (name_ == "") {
- const char *its_name = getenv(VSOMEIP_ENV_APPLICATION_NAME);
- if (nullptr != its_name) {
- name_ = its_name;
- }
- }
-
- std::string configuration_path;
-
- // load configuration from module
- std::string config_module = "";
- const char *its_config_module = getenv(VSOMEIP_ENV_CONFIGURATION_MODULE);
- if (nullptr != its_config_module) {
- // TODO: Add loading of custom configuration module
- } else { // load default module
- auto its_plugin = plugin_manager::get()->get_plugin(
- plugin_type_e::CONFIGURATION_PLUGIN, VSOMEIP_CFG_LIBRARY);
- if (its_plugin) {
- configuration_ = std::dynamic_pointer_cast<configuration>(its_plugin);
- if (configuration_path.length()) {
- configuration_->set_configuration_path(configuration_path);
- }
- configuration_->load(name_);
- VSOMEIP_INFO << "Default configuration module loaded.";
- } else {
- exit(-1);
- }
- }
-
- const char *client_side_logging = getenv(VSOMEIP_ENV_CLIENTSIDELOGGING);
- if (client_side_logging != nullptr) {
- client_side_logging_ = true;
- VSOMEIP_INFO << "Client side logging for application: " << name_
- << " is enabled";
-
- if ('\0' != *client_side_logging) {
- std::stringstream its_converter(client_side_logging);
- if ('"' == its_converter.peek()) {
- its_converter.get(); // skip quote
- }
- uint16_t val(0xffffu);
- bool stop_parsing(false);
- do {
- const uint16_t prev_val(val);
- its_converter >> std::hex >> std::setw(4) >> val;
- if (its_converter.good()) {
- const std::stringstream::int_type c = its_converter.eof()?'\0':its_converter.get();
- switch (c) {
- case '"':
- case '.':
- case ':':
- case ' ':
- case '\0': {
- if ('.' != c) {
- if (0xffffu == prev_val) {
- VSOMEIP_INFO << "+filter "
- << std::hex << std::setw(4) << std::setfill('0') << val;
- client_side_logging_filter_.insert(std::make_tuple(val, ANY_INSTANCE));
- } else {
- VSOMEIP_INFO << "+filter "
- << std::hex << std::setw(4) << std::setfill('0') << prev_val << "."
- << std::hex << std::setw(4) << std::setfill('0') << val;
- client_side_logging_filter_.insert(std::make_tuple(prev_val, val));
- }
- val = 0xffffu;
- }
- }
- break;
- default:
- stop_parsing = true;
- break;
- }
- }
- }
- while (!stop_parsing && its_converter.good());
- }
- }
-
- std::shared_ptr<configuration> its_configuration = get_configuration();
- if (its_configuration) {
- VSOMEIP_INFO << "Initializing vsomeip application \"" << name_ << "\".";
- client_ = its_configuration->get_id(name_);
-
- // Max dispatchers is the configured maximum number of dispatchers and
- // the main dispatcher
- max_dispatchers_ = its_configuration->get_max_dispatchers(name_) + 1;
- max_dispatch_time_ = its_configuration->get_max_dispatch_time(name_);
-
- std::string its_routing_host = its_configuration->get_routing_host();
- if (!utility::auto_configuration_init(its_configuration)) {
- VSOMEIP_WARNING << "Could _not_ initialize auto-configuration:"
- " Cannot guarantee unique application identifiers!";
- } else {
- // Client Identifier
- client_t its_old_client = client_;
- client_ = utility::request_client_id(its_configuration, name_, client_);
- if (client_ == ILLEGAL_CLIENT) {
- VSOMEIP_ERROR << "Couldn't acquire client identifier";
- return false;
- }
- VSOMEIP_INFO << "SOME/IP client identifier configured. "
- << "Using "
- << std::hex << std::setfill('0') << std::setw(4)
- << client_
- << " (was: "
- << std::hex << std::setfill('0') << std::setw(4)
- << its_old_client
- << ")";
-
- // Routing
- if (its_routing_host == "") {
- VSOMEIP_INFO << "No routing manager configured. Using auto-configuration.";
- is_routing_manager_host_ = utility::is_routing_manager_host(client_);
- }
- }
-
- if (its_routing_host != "") {
- is_routing_manager_host_ = (its_routing_host == name_);
- }
-
- if (is_routing_manager_host_) {
- VSOMEIP_INFO << "Instantiating routing manager [Host].";
- routing_ = std::make_shared<routing_manager_impl>(this);
- } else {
- VSOMEIP_INFO << "Instantiating routing manager [Proxy].";
- routing_ = std::make_shared<routing_manager_proxy>(this, client_side_logging_, client_side_logging_filter_);
- }
-
- routing_->init();
-
- // Smallest allowed session identifier
- session_ = 0x0001;
-
-#ifdef USE_DLT
- // Tracing
- std::shared_ptr<tc::trace_connector> its_trace_connector = tc::trace_connector::get();
- std::shared_ptr<cfg::trace> its_trace_cfg = its_configuration->get_trace();
-
- auto &its_channels_cfg = its_trace_cfg->channels_;
- for (auto it = its_channels_cfg.begin(); it != its_channels_cfg.end(); ++it) {
- its_trace_connector->add_channel(it->get()->id_, it->get()->name_);
- }
-
- auto &its_filter_rules_cfg = its_trace_cfg->filter_rules_;
- for (auto it = its_filter_rules_cfg.begin(); it != its_filter_rules_cfg.end(); ++it) {
- std::shared_ptr<cfg::trace_filter_rule> its_filter_rule_cfg = *it;
- tc::trace_connector::filter_rule_t its_filter_rule;
- tc::filter_type_e its_filter_type;
-
- if(its_filter_rule_cfg->type_ == "negative") {
- its_filter_type = tc::filter_type_e::NEGATIVE;
- } else {
- its_filter_type = tc::filter_type_e::POSITIVE;
- }
-
- tc::trace_connector::filter_rule_map_t its_filter_rule_map;
- its_filter_rule_map[tc::filter_criteria_e::SERVICES] = its_filter_rule_cfg->services_;
- its_filter_rule_map[tc::filter_criteria_e::METHODS] = its_filter_rule_cfg->methods_;
- its_filter_rule_map[tc::filter_criteria_e::CLIENTS] = its_filter_rule_cfg->clients_;
-
- its_filter_rule = std::make_pair(its_filter_type, its_filter_rule_map);
-
- its_trace_connector->add_filter_rule(it->get()->channel_, its_filter_rule);
- }
-
- bool enable_tracing = its_trace_cfg->is_enabled_;
- if (enable_tracing)
- its_trace_connector->init();
- its_trace_connector->set_enabled(enable_tracing);
-
- bool enable_sd_tracing = its_trace_cfg->is_sd_enabled_;
- its_trace_connector->set_sd_enabled(enable_sd_tracing);
-#endif
-
- VSOMEIP_INFO << "Application(" << (name_ != "" ? name_ : "unnamed")
- << ", " << std::hex << client_ << ") is initialized ("
- << std::dec << max_dispatchers_ << ", "
- << std::dec << max_dispatch_time_ << ").";
-
- is_initialized_ = true;
- }
-
-#ifdef VSOMEIP_ENABLE_SIGNAL_HANDLING
- if (is_initialized_) {
- signals_.add(SIGINT);
- signals_.add(SIGTERM);
-
- // Register signal handler
- std::function<void(boost::system::error_code const &, int)> its_signal_handler =
- [this] (boost::system::error_code const &_error, int _signal) {
- if (!_error) {
- switch (_signal) {
- case SIGTERM:
- case SIGINT:
- catched_signal_ = true;
- stop();
- break;
- default:
- break;
- }
- }
- };
- signals_.async_wait(its_signal_handler);
- }
-#endif
-
- auto its_plugins = configuration_->get_plugins(name_);
- auto its_app_plugin_info = its_plugins.find(plugin_type_e::APPLICATION_PLUGIN);
- if (its_app_plugin_info != its_plugins.end()) {
- for (auto its_library : its_app_plugin_info->second) {
- auto its_application_plugin = plugin_manager::get()->get_plugin(
- plugin_type_e::APPLICATION_PLUGIN, its_library);
- if (its_application_plugin) {
- VSOMEIP_INFO << "Client 0x" << std::hex << get_client()
- << " Loading plug-in library: " << its_library << " succeeded!";
- std::dynamic_pointer_cast<application_plugin>(its_application_plugin)->
- on_application_state_change(name_, application_plugin_state_e::STATE_INITIALIZED);
- }
- }
- }
-
- return is_initialized_;
-}
-
-void application_impl::start() {
- const size_t io_thread_count = configuration_->get_io_thread_count(name_);
- {
- std::lock_guard<std::mutex> its_lock(start_stop_mutex_);
- if (io_.stopped()) {
- io_.reset();
- } else if(stop_thread_.joinable()) {
- VSOMEIP_ERROR << "Trying to start an already started application.";
- return;
- }
- if (stopped_) {
- utility::release_client_id(client_);
- utility::auto_configuration_exit(client_, configuration_);
-
- {
- std::lock_guard<std::mutex> its_lock_start_stop(block_stop_mutex_);
- block_stopping_ = true;
- block_stop_cv_.notify_all();
- }
-
- stopped_ = false;
- return;
- }
- stopped_ = false;
- stopped_called_ = false;
- VSOMEIP_INFO << "Starting vsomeip application \"" << name_ << "\" using "
- << std::dec << io_thread_count << " threads";
-
- start_caller_id_ = std::this_thread::get_id();
- {
- std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
- is_dispatching_ = true;
- auto its_main_dispatcher = std::make_shared<std::thread>(
- std::bind(&application_impl::main_dispatch, shared_from_this()));
- dispatchers_[its_main_dispatcher->get_id()] = its_main_dispatcher;
- }
-
- if (stop_thread_.joinable()) {
- stop_thread_.join();
- }
- stop_thread_= std::thread(&application_impl::shutdown, this);
-
- if (routing_)
- routing_->start();
-
- for (size_t i = 0; i < io_thread_count - 1; i++) {
- std::shared_ptr<std::thread> its_thread
- = std::make_shared<std::thread>([this, i] {
- VSOMEIP_INFO << "io thread id from application: "
- << std::hex << std::setw(4) << std::setfill('0')
- << client_ << " (" << name_ << ") is: " << std::hex
- << std::this_thread::get_id();
- try {
- io_.run();
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << "application_impl::start() "
- "catched exception:" << e.what();
- throw;
- }
- });
- io_threads_.insert(its_thread);
- }
- }
-
- auto its_plugins = configuration_->get_plugins(name_);
- auto its_app_plugin_info = its_plugins.find(plugin_type_e::APPLICATION_PLUGIN);
- if (its_app_plugin_info != its_plugins.end()) {
- for (auto its_library : its_app_plugin_info->second) {
- auto its_application_plugin = plugin_manager::get()->get_plugin(
- plugin_type_e::APPLICATION_PLUGIN, its_library);
- if (its_application_plugin) {
- std::dynamic_pointer_cast<application_plugin>(its_application_plugin)->
- on_application_state_change(name_, application_plugin_state_e::STATE_STARTED);
- }
- }
-
- }
-
- app_counter_mutex__.lock();
- app_counter__++;
- app_counter_mutex__.unlock();
- VSOMEIP_INFO << "io thread id from application: "
- << std::hex << std::setw(4) << std::setfill('0') << client_ << " ("
- << name_ << ") is: " << std::hex << std::this_thread::get_id();
- try {
- io_.run();
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << "application_impl::start() catched exception:" << e.what();
- throw;
- }
-
- if (stop_thread_.joinable()) {
- stop_thread_.join();
- }
-
- utility::release_client_id(client_);
- utility::auto_configuration_exit(client_, configuration_);
-
- {
- std::lock_guard<std::mutex> its_lock_start_stop(block_stop_mutex_);
- block_stopping_ = true;
- block_stop_cv_.notify_all();
- }
-
- {
- std::lock_guard<std::mutex> its_lock(start_stop_mutex_);
- stopped_ = false;
- }
-
- app_counter_mutex__.lock();
- app_counter__--;
-
-#ifdef VSOMEIP_ENABLE_SIGNAL_HANDLING
- if (catched_signal_ && !app_counter__) {
- app_counter_mutex__.unlock();
- VSOMEIP_INFO << "Exiting vsomeip application...";
- exit(0);
- }
-#endif
- app_counter_mutex__.unlock();
-}
-
-void application_impl::stop() {
-#ifndef _WIN32 // Gives serious problems under Windows.
- VSOMEIP_INFO << "Stopping vsomeip application \"" << name_ << "\".";
-#endif
- bool block = true;
- {
- std::lock_guard<std::mutex> its_lock_start_stop(start_stop_mutex_);
- if (stopped_ || stopped_called_) {
- return;
- }
- stop_caller_id_ = std::this_thread::get_id();
- stopped_ = true;
- stopped_called_ = true;
- for (auto thread : io_threads_) {
- if (thread->get_id() == std::this_thread::get_id()) {
- block = false;
- }
- }
- if (start_caller_id_ == stop_caller_id_) {
- block = false;
- }
- }
- auto its_plugins = configuration_->get_plugins(name_);
- auto its_app_plugin_info = its_plugins.find(plugin_type_e::APPLICATION_PLUGIN);
- if (its_app_plugin_info != its_plugins.end()) {
- for (auto its_library : its_app_plugin_info->second) {
- auto its_application_plugin = plugin_manager::get()->get_plugin(
- plugin_type_e::APPLICATION_PLUGIN, its_library);
- if (its_application_plugin) {
- std::dynamic_pointer_cast<application_plugin>(its_application_plugin)->
- on_application_state_change(name_, application_plugin_state_e::STATE_STOPPED);
- }
- }
-
- }
-
- {
- std::lock_guard<std::mutex> its_lock_start_stop(start_stop_mutex_);
- stop_cv_.notify_one();
- }
-
- if (block) {
- std::unique_lock<std::mutex> block_stop_lock(block_stop_mutex_);
- while (!block_stopping_) {
- block_stop_cv_.wait(block_stop_lock);
- }
- block_stopping_ = false;
- }
-}
-
-void application_impl::offer_service(service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) {
- if (routing_)
- routing_->offer_service(client_, _service, _instance, _major, _minor);
-}
-
-void application_impl::stop_offer_service(service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) {
- if (routing_)
- routing_->stop_offer_service(client_, _service, _instance, _major, _minor);
-}
-
-void application_impl::request_service(service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor, bool _use_exclusive_proxy) {
- if (_use_exclusive_proxy) {
- message_handler_t handler([&](const std::shared_ptr<message>& response) {
- routing_->on_identify_response(get_client(), response->get_service(),
- response->get_instance(), response->is_reliable());
- });
- register_message_handler(_service, _instance, ANY_METHOD - 1, handler);
- }
-
- if (routing_)
- routing_->request_service(client_, _service, _instance, _major, _minor,
- _use_exclusive_proxy);
-}
-
-void application_impl::release_service(service_t _service,
- instance_t _instance) {
- if (routing_) {
- routing_->release_service(client_, _service, _instance);
- }
-}
-
-void application_impl::subscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup,
- major_version_t _major,
- subscription_type_e _subscription_type,
- event_t _event) {
- if (routing_) {
- bool send_back_cached(false);
- bool send_back_cached_group(false);
- check_send_back_cached_event(_service, _instance, _event, _eventgroup,
- &send_back_cached, &send_back_cached_group);
-
- if (send_back_cached) {
- send_back_cached_event(_service, _instance, _event);
- } else if(send_back_cached_group) {
- send_back_cached_eventgroup(_service, _instance, _eventgroup);
- }
-
- if (check_subscription_state(_service, _instance, _eventgroup, _event)) {
- routing_->subscribe(client_, _service, _instance, _eventgroup, _major,
- _event, _subscription_type);
- }
- }
-}
-
-void application_impl::unsubscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup) {
- remove_subscription(_service, _instance, _eventgroup, ANY_EVENT);
- if (routing_)
- routing_->unsubscribe(client_, _service, _instance, _eventgroup, ANY_EVENT);
-}
-
-void application_impl::unsubscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event) {
- remove_subscription(_service, _instance, _eventgroup, _event);
- if (routing_)
- routing_->unsubscribe(client_, _service, _instance, _eventgroup, _event);
-}
-
-bool application_impl::is_available(
- service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) const {
- std::lock_guard<std::mutex> its_lock(availability_mutex_);
- return is_available_unlocked(_service, _instance, _major, _minor);
-}
-
-bool application_impl::is_available_unlocked(
- service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) const {
-
- bool is_available(false);
-
- const std::function<void(const std::map<instance_t,
- std::map<major_version_t, minor_version_t>>::const_iterator&)>
- check_major_minor = [&](const std::map<instance_t,
- std::map<major_version_t,
- minor_version_t >>::const_iterator &_found_instance) {
- auto found_major = _found_instance->second.find(_major);
- if (found_major != _found_instance->second.end()) {
- if (_minor <= found_major->second || _minor == ANY_MINOR
- || _minor == DEFAULT_MINOR) {
- is_available = true;
- }
- } else if ((_major == DEFAULT_MAJOR || _major == ANY_MAJOR)) {
- for (const auto &found_major : _found_instance->second) {
- if (_minor == DEFAULT_MINOR || _minor == ANY_MINOR) {
- is_available = true;
- break;
- } else if (_minor <= found_major.second) {
- is_available = true;
- break;
- }
- }
- }
- };
- auto found_service = available_.find(_service);
- if (found_service != available_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- check_major_minor(found_instance);
- } else if (_instance == ANY_INSTANCE) {
- for (auto it = found_service->second.cbegin();
- it != found_service->second.cend(); it++) {
- check_major_minor(it);
- if (is_available) {
- break;
- }
- }
- }
- } else if (_service == ANY_SERVICE) {
- for (const auto &found_service : available_) {
- auto found_instance = found_service.second.find(_instance);
- if (found_instance != found_service.second.end()) {
- check_major_minor(found_instance);
- if (is_available) {
- break;
- }
- } else if (_instance == ANY_INSTANCE) {
- for (auto it = found_service.second.cbegin();
- it != found_service.second.cend(); it++) {
- check_major_minor(it);
- if (is_available) {
- break;
- }
- }
- }
- if (is_available) {
- break;
- }
- }
- }
- return is_available;
-}
-
-bool application_impl::are_available(
- available_t &_available,
- service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) const {
- std::lock_guard<std::mutex> its_lock(availability_mutex_);
- return are_available_unlocked(_available, _service, _instance, _major, _minor);
-}
-
-bool application_impl::are_available_unlocked(available_t &_available,
- service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor) const {
-
- //find available services
- if(_service == ANY_SERVICE) {
- //add all available services
- for(auto its_available_services_it = available_.begin();
- its_available_services_it != available_.end();
- ++its_available_services_it)
- _available[its_available_services_it->first];
- } else {
- // check if specific service is available
- if(available_.find(_service) != available_.end())
- _available[_service];
- }
-
- //find available instances
- //iterate through found available services
- for(auto its_available_services_it = _available.begin();
- its_available_services_it != _available.end();
- ++its_available_services_it) {
- //get available service
- auto found_available_service = available_.find(its_available_services_it->first);
- if (found_available_service != available_.end()) {
- if(_instance == ANY_INSTANCE) {
- //add all available instances
- for(auto its_available_instances_it = found_available_service->second.begin();
- its_available_instances_it != found_available_service->second.end();
- ++its_available_instances_it)
- _available[its_available_services_it->first][its_available_instances_it->first];
- } else {
- if(found_available_service->second.find(_instance) != found_available_service->second.end())
- _available[its_available_services_it->first][_instance];
- }
- }
- }
-
- //find major versions
- //iterate through found available services
- for(auto its_available_services_it = _available.begin();
- its_available_services_it != _available.end();
- ++its_available_services_it) {
- //get available service
- auto found_available_service = available_.find(its_available_services_it->first);
- if (found_available_service != available_.end()) {
- //iterate through found available instances
- for(auto its_available_instances_it = found_available_service->second.begin();
- its_available_instances_it != found_available_service->second.end();
- ++its_available_instances_it) {
- //get available instance
- auto found_available_instance = found_available_service->second.find(its_available_instances_it->first);
- if(found_available_instance != found_available_service->second.end()) {
- if(_major == ANY_MAJOR || _major == DEFAULT_MAJOR) {
- //add all major versions
- for(auto its_available_major_it = found_available_instance->second.begin();
- its_available_major_it != found_available_instance->second.end();
- ++its_available_major_it)
- _available[its_available_services_it->first][its_available_instances_it->first][its_available_major_it->first];
- } else {
- if(found_available_instance->second.find(_major) != found_available_instance->second.end())
- _available[its_available_services_it->first][its_available_instances_it->first][_major];
- }
- }
- }
- }
- }
-
- //find minor
- //iterate through found available services
- auto its_available_services_it = _available.begin();
- while(its_available_services_it != _available.end()) {
- bool found_minor(false);
- //get available service
- auto found_available_service = available_.find(its_available_services_it->first);
- if (found_available_service != available_.end()) {
- //iterate through found available instances
- for(auto its_available_instances_it = found_available_service->second.begin();
- its_available_instances_it != found_available_service->second.end();
- ++its_available_instances_it) {
- //get available instance
- auto found_available_instance = found_available_service->second.find(its_available_instances_it->first);
- if(found_available_instance != found_available_service->second.end()) {
- //iterate through found available major version
- for(auto its_available_major_it = found_available_instance->second.begin();
- its_available_major_it != found_available_instance->second.end();
- ++its_available_major_it) {
- //get available major version
- auto found_available_major = found_available_instance->second.find(its_available_major_it->first);
- if(found_available_major != found_available_instance->second.end()) {
- if(_minor == ANY_MINOR || _minor == DEFAULT_MINOR
- || _minor <= found_available_major->second) {
- //add minor version
- _available[its_available_services_it->first][its_available_instances_it->first][its_available_major_it->first] = found_available_major->second;
- found_minor = true;
- }
- }
- }
- }
- }
- }
- if(found_minor)
- ++its_available_services_it;
- else
- its_available_services_it = _available.erase(its_available_services_it);
- }
-
- if(_available.empty()) {
- _available[_service][_instance][_major] = _minor ;
- return false;
- }
- return true;
-}
-
-void application_impl::send(std::shared_ptr<message> _message, bool _flush) {
- std::lock_guard<std::mutex> its_lock(session_mutex_);
- bool is_request = utility::is_request(_message);
- if (client_side_logging_
- && (client_side_logging_filter_.empty()
- || (1 == client_side_logging_filter_.count(std::make_tuple(_message->get_service(), ANY_INSTANCE)))
- || (1 == client_side_logging_filter_.count(std::make_tuple(_message->get_service(), _message->get_instance()))))) {
- VSOMEIP_INFO << "application_impl::send: ("
- << std::hex << std::setw(4) << std::setfill('0') << client_ <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _message->get_service() << "."
- << std::hex << std::setw(4) << std::setfill('0') << _message->get_instance() << "."
- << std::hex << std::setw(4) << std::setfill('0') << _message->get_method() << ":"
- << std::hex << std::setw(4) << std::setfill('0')
- << ((is_request) ? session_ : _message->get_session()) << ":"
- << std::hex << std::setw(4) << std::setfill('0')
- << ((is_request) ? client_ : _message->get_client()) << "] "
- << "type=" << std::hex << static_cast<std::uint32_t>(_message->get_message_type())
- << " thread=" << std::hex << std::this_thread::get_id();
- }
- if (routing_) {
- // in case of requests set the request-id (client-id|session-id)
- if (is_request) {
- _message->set_client(client_);
- _message->set_session(session_);
- }
- // in case of successful sending, increment the session-id
- if (routing_->send(client_, _message, _flush)) {
- if (is_request) {
- update_session();
- }
- }
- }
-}
-
-void application_impl::notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload) const {
- return notify(_service, _instance, _event, _payload, false, true);
-}
-
-void application_impl::notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload, bool _force) const {
- if (routing_)
- routing_->notify(_service, _instance, _event, _payload, _force, true);
-}
-
-void application_impl::notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload, bool _force, bool _flush) const {
- if (routing_)
- routing_->notify(_service, _instance, _event, _payload, _force, _flush);
-}
-
-void application_impl::notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- client_t _client) const {
- return notify_one(_service, _instance, _event, _payload, _client, false, true);
-}
-
-void application_impl::notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- client_t _client, bool _force) const {
- if (routing_) {
- routing_->notify_one(_service, _instance, _event, _payload, _client,
- _force, true);
- }
-}
-
-void application_impl::notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- client_t _client, bool _force, bool _flush) const {
- if (routing_) {
- routing_->notify_one(_service, _instance, _event, _payload, _client,
- _force, _flush);
- }
-}
-
-void application_impl::register_state_handler(state_handler_t _handler) {
- std::lock_guard<std::mutex> its_lock(state_handler_mutex_);
- handler_ = _handler;
-}
-
-void application_impl::unregister_state_handler() {
- std::lock_guard<std::mutex> its_lock(state_handler_mutex_);
- handler_ = nullptr;
-}
-
-void application_impl::register_availability_handler(service_t _service,
- instance_t _instance, availability_handler_t _handler,
- major_version_t _major, minor_version_t _minor) {
- std::lock_guard<std::mutex> availability_lock(availability_mutex_);
- if (state_ == state_type_e::ST_REGISTERED) {
- do_register_availability_handler(_service, _instance,
- _handler, _major, _minor);
- } else {
- availability_[_service][_instance][_major][_minor] = std::make_pair(
- _handler, false);
- }
-}
-
-void application_impl::do_register_availability_handler(service_t _service,
- instance_t _instance, availability_handler_t _handler,
- major_version_t _major, minor_version_t _minor) {
- available_t available;
- bool are_available = are_available_unlocked(available, _service, _instance, _major, _minor);
- availability_[_service][_instance][_major][_minor] = std::make_pair(
- _handler, true);
-
- std::lock_guard<std::mutex> handlers_lock(handlers_mutex_);
-
- std::shared_ptr<sync_handler> its_sync_handler
- = std::make_shared<sync_handler>([_handler, are_available, available]() {
- for(auto available_services_it : available)
- for(auto available_instances_it : available_services_it.second)
- _handler(available_services_it.first, available_instances_it.first, are_available);
- });
- its_sync_handler->handler_type_ = handler_type_e::AVAILABILITY;
- its_sync_handler->service_id_ = _service;
- its_sync_handler->instance_id_ = _instance;
- handlers_.push_back(its_sync_handler);
-
- dispatcher_condition_.notify_one();
-}
-
-void application_impl::unregister_availability_handler(service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor) {
- std::lock_guard<std::mutex> its_lock(availability_mutex_);
- auto found_service = availability_.find(_service);
- if (found_service != availability_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_major = found_instance->second.find(_major);
- if (found_major != found_instance->second.end()) {
- auto found_minor = found_major->second.find(_minor);
- if (found_minor != found_major->second.end()) {
- found_major->second.erase(_minor);
-
- if (!found_major->second.size()) {
- found_instance->second.erase(_major);
- if (!found_instance->second.size()) {
- found_service->second.erase(_instance);
- if (!found_service->second.size()) {
- availability_.erase(_service);
- }
- }
- }
- }
- }
- }
- }
-}
-
-void application_impl::on_subscription(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, client_t _client, bool _subscribed, std::function<void(bool)> _accepted_cb) {
- bool handler_found = false;
- std::pair<subscription_handler_t, async_subscription_handler_t> its_handlers;
- {
- std::lock_guard<std::mutex> its_lock(subscription_mutex_);
- auto found_service = subscription_.find(_service);
- if (found_service != subscription_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- its_handlers = found_eventgroup->second;
- handler_found = true;
- }
- }
- }
- }
-
- if(handler_found) {
- if(auto its_handler = its_handlers.first) {
- // "normal" subscription handler exists
- _accepted_cb(its_handler(_client, _subscribed));
- } else if(auto its_handler = its_handlers.second) {
- // async subscription handler exists
- its_handler(_client, _subscribed, _accepted_cb);
- }
- } else {
- _accepted_cb(true);
- }
-}
-
-void application_impl::register_subscription_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- subscription_handler_t _handler) {
-
- std::lock_guard<std::mutex> its_lock(subscription_mutex_);
- subscription_[_service][_instance][_eventgroup] = std::make_pair(_handler, nullptr);
-
- message_handler_t handler([&](const std::shared_ptr<message>& request) {
- send(runtime_->create_response(request), true);
- });
- register_message_handler(_service, _instance, ANY_METHOD - 1, handler);
-}
-
-void application_impl::unregister_subscription_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) {
- std::lock_guard<std::mutex> its_lock(subscription_mutex_);
- auto found_service = subscription_.find(_service);
- if (found_service != subscription_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- found_instance->second.erase(_eventgroup);
- }
- }
- }
- unregister_message_handler(_service, _instance, ANY_METHOD - 1);
-}
-
-void application_impl::on_subscription_status(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- uint16_t _error) {
- bool entry_found(false);
- {
- auto its_tuple = std::make_tuple(_service, _instance, _eventgroup, _event);
- std::lock_guard<std::mutex> its_lock(subscriptions_state_mutex_);
- auto its_subscription_state = subscription_state_.find(its_tuple);
- if (its_subscription_state == subscription_state_.end()) {
- its_tuple = std::make_tuple(_service, _instance, _eventgroup, ANY_EVENT);
- auto its_any_subscription_state = subscription_state_.find(its_tuple);
- if (its_any_subscription_state == subscription_state_.end()) {
- VSOMEIP_TRACE << std::hex << get_client( )
- << " application_impl::on_subscription_status: "
- << "Received a subscription status without subscribe for "
- << std::hex << _service << "/" << _instance << "/"
- << _eventgroup << "/" << _event << "/error=" << _error;
- } else {
- entry_found = true;
- }
- } else {
- entry_found = true;
- }
- if (entry_found) {
- if (_error) {
- subscription_state_[its_tuple] =
- subscription_state_e::SUBSCRIPTION_NOT_ACKNOWLEDGED;
- } else {
- subscription_state_[its_tuple] =
- subscription_state_e::SUBSCRIPTION_ACKNOWLEDGED;
- }
- }
- }
-
- if (entry_found) {
- deliver_subscription_state(_service, _instance, _eventgroup, _event, _error);
- }
-}
-
-void application_impl::deliver_subscription_state(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event, uint16_t _error) {
- std::vector<subscription_status_handler_t> handlers;
- {
- std::lock_guard<std::mutex> its_lock(subscription_status_handlers_mutex_);
- auto found_service = subscription_status_handlers_.find(_service);
- if (found_service != subscription_status_handlers_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- auto found_event = found_eventgroup->second.find(_event);
- if (found_event != found_eventgroup->second.end()) {
- if (!_error || (_error && found_event->second.second)) {
- handlers.push_back(found_event->second.first);
- }
- } else {
- auto its_any_event = found_eventgroup->second.find(ANY_EVENT);
- if (its_any_event != found_eventgroup->second.end()) {
- if (!_error || (_error && its_any_event->second.second)) {
- handlers.push_back(its_any_event->second.first);
- }
- }
- }
- }
- }
- found_instance = found_service->second.find(ANY_INSTANCE);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- auto found_event = found_eventgroup->second.find(_event);
- if (found_event != found_eventgroup->second.end()) {
- if (!_error || (_error && found_event->second.second)) {
- handlers.push_back(found_event->second.first);
- }
- } else {
- auto its_any_event = found_eventgroup->second.find(ANY_EVENT);
- if (its_any_event != found_eventgroup->second.end()) {
- if (!_error || (_error && its_any_event->second.second)) {
- handlers.push_back(its_any_event->second.first);
- }
- }
- }
- }
- }
- }
- found_service = subscription_status_handlers_.find(ANY_SERVICE);
- if (found_service != subscription_status_handlers_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- auto found_event = found_eventgroup->second.find(_event);
- if (found_event != found_eventgroup->second.end()) {
- if (!_error || (_error && found_event->second.second)) {
- handlers.push_back(found_event->second.first);
- }
- } else {
- auto its_any_event = found_eventgroup->second.find(ANY_EVENT);
- if (its_any_event != found_eventgroup->second.end()) {
- if (!_error || (_error && its_any_event->second.second)) {
- handlers.push_back(its_any_event->second.first);
- }
- }
- }
- }
- }
- found_instance = found_service->second.find(ANY_INSTANCE);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- auto found_event = found_eventgroup->second.find(_event);
- if (found_event != found_eventgroup->second.end()) {
- if (!_error || (_error && found_event->second.second)) {
- handlers.push_back(found_event->second.first);
- }
- } else {
- auto its_any_event = found_eventgroup->second.find(ANY_EVENT);
- if (its_any_event != found_eventgroup->second.end()) {
- if (!_error || (_error && its_any_event->second.second)) {
- handlers.push_back(its_any_event->second.first);
- }
- }
- }
- }
- }
- }
- }
- {
- std::unique_lock<std::mutex> handlers_lock(handlers_mutex_);
- for (auto &handler : handlers) {
- std::shared_ptr<sync_handler> its_sync_handler
- = std::make_shared<sync_handler>([handler, _service,
- _instance, _eventgroup,
- _event, _error]() {
- handler(_service, _instance,
- _eventgroup, _event, _error);
- });
- its_sync_handler->handler_type_ = handler_type_e::SUBSCRIPTION;
- its_sync_handler->service_id_ = _service;
- its_sync_handler->instance_id_ = _instance;
- its_sync_handler->method_id_ = _event;
- its_sync_handler->eventgroup_id_ = _eventgroup;
- handlers_.push_back(its_sync_handler);
- }
- if (handlers.size()) {
- dispatcher_condition_.notify_one();
- }
- }
-}
-
-void application_impl::on_subscription_error(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, uint16_t _error) {
- error_handler_t handler = nullptr;
- std::lock_guard<std::mutex> its_lock(subscription_error_mutex_);
- auto found_service = eventgroup_error_handlers_.find(_service);
- if (found_service != eventgroup_error_handlers_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- auto found_client = found_eventgroup->second.find(get_client());
- if (found_client != found_eventgroup->second.end()) {
- handler = found_client->second;
-
- }
- }
- }
- }
- if (handler) {
- std::unique_lock<std::mutex> handlers_lock(handlers_mutex_);
- std::shared_ptr<sync_handler> its_sync_handler
- = std::make_shared<sync_handler>([handler, _error]() {
- handler(_error);
- });
- its_sync_handler->handler_type_ = handler_type_e::SUBSCRIPTION;
- its_sync_handler->service_id_ = _service;
- its_sync_handler->instance_id_ = _instance;
- its_sync_handler->eventgroup_id_ = _eventgroup;
- handlers_.push_back(its_sync_handler);
- dispatcher_condition_.notify_all();
- }
-}
-
-void application_impl::register_subscription_status_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- subscription_status_handler_t _handler) {
- register_subscription_status_handler(_service, _instance, _eventgroup,
- _event, _handler, false);
-}
-
-void application_impl::register_subscription_status_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- subscription_status_handler_t _handler, bool _is_selective) {
- std::lock_guard<std::mutex> its_lock(subscription_status_handlers_mutex_);
- if (_handler) {
- subscription_status_handlers_[_service][_instance][_eventgroup][_event] =
- std::make_pair(_handler, _is_selective);
- } else {
- auto its_service = subscription_status_handlers_.find(_service);
- if (its_service != subscription_status_handlers_.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- auto its_eventgroup = its_instance->second.find(_eventgroup);
- if (its_eventgroup != its_instance->second.end()) {
- its_eventgroup->second.erase(_event);
- if (its_eventgroup->second.size() == 0) {
- its_instance->second.erase(_eventgroup);
- if (its_instance->second.size() == 0) {
- its_service->second.erase(_instance);
- if (its_service->second.size() == 0) {
- subscription_status_handlers_.erase(_service);
- }
- }
- }
- }
- }
- }
- }
-}
-
-void application_impl::register_subscription_error_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- error_handler_t _handler) {
- std::lock_guard<std::mutex> its_lock(subscription_error_mutex_);
- eventgroup_error_handlers_[_service][_instance][_eventgroup][get_client()] = _handler;
-}
-
-void application_impl::unregister_subscription_error_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) {
- std::lock_guard<std::mutex> its_lock(subscription_error_mutex_);
- auto found_service = eventgroup_error_handlers_.find(_service);
- if (found_service != eventgroup_error_handlers_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- found_eventgroup->second.erase(get_client());
- }
- }
- }
-}
-
-void application_impl::register_message_handler(service_t _service,
- instance_t _instance, method_t _method, message_handler_t _handler) {
- std::lock_guard<std::mutex> its_lock(members_mutex_);
- members_[_service][_instance][_method] = _handler;
-}
-
-void application_impl::unregister_message_handler(service_t _service,
- instance_t _instance, method_t _method) {
- std::lock_guard<std::mutex> its_lock(members_mutex_);
- auto found_service = members_.find(_service);
- if (found_service != members_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_method = found_instance->second.find(_method);
- if (found_method != found_instance->second.end()) {
- found_instance->second.erase(_method);
- }
- }
- }
-}
-
-void application_impl::offer_event(service_t _service, instance_t _instance,
- event_t _event, const std::set<eventgroup_t> &_eventgroups,
- bool _is_field) {
- return offer_event(_service, _instance, _event, _eventgroups, _is_field,
- std::chrono::milliseconds::zero(), false, nullptr);
-}
-
-void application_impl::offer_event(service_t _service, instance_t _instance,
- event_t _event, const std::set<eventgroup_t> &_eventgroups,
- bool _is_field,
- std::chrono::milliseconds _cycle, bool _change_resets_cycle,
- const epsilon_change_func_t &_epsilon_change_func) {
- if (routing_)
- routing_->register_event(client_, _service, _instance, _event,
- _eventgroups, _is_field, _cycle, _change_resets_cycle,
- _epsilon_change_func, true);
-}
-
-void application_impl::stop_offer_event(service_t _service, instance_t _instance,
- event_t _event) {
- if (routing_)
- routing_->unregister_event(client_, _service, _instance, _event, true);
-}
-
-void application_impl::request_event(service_t _service, instance_t _instance,
- event_t _event, const std::set<eventgroup_t> &_eventgroups,
- bool _is_field) {
- if (routing_)
- routing_->register_event(client_, _service, _instance, _event,
- _eventgroups, _is_field,
- std::chrono::milliseconds::zero(), false,
- nullptr,
- false);
-}
-
-void application_impl::release_event(service_t _service, instance_t _instance,
- event_t _event) {
- if (routing_)
- routing_->unregister_event(client_, _service, _instance, _event, false);
-}
-
-// Interface "routing_manager_host"
-const std::string & application_impl::get_name() const {
- return name_;
-}
-
-client_t application_impl::get_client() const {
- return client_;
-}
-
-std::shared_ptr<configuration> application_impl::get_configuration() const {
- return configuration_;
-}
-
-boost::asio::io_service & application_impl::get_io() {
- return io_;
-}
-
-void application_impl::on_state(state_type_e _state) {
- {
- std::lock_guard<std::mutex> availability_lock(availability_mutex_);
- if (state_ != _state) {
- state_ = _state;
- if (state_ == state_type_e::ST_REGISTERED) {
- for (const auto &its_service : availability_) {
- for (const auto &its_instance : its_service.second) {
- for (const auto &its_major : its_instance.second) {
- for (const auto &its_minor : its_major.second) {
- if (!its_minor.second.second) {
- do_register_availability_handler(
- its_service.first,
- its_instance.first,
- its_minor.second.first,
- its_major.first, its_minor.first);
- }
- }
- }
- }
- }
- }
- }
- }
- bool has_state_handler(false);
- state_handler_t handler = nullptr;
- {
- std::lock_guard<std::mutex> its_lock(state_handler_mutex_);
- if (handler_) {
- has_state_handler = true;
- handler = handler_;
- }
- }
- if (has_state_handler) {
- std::lock_guard<std::mutex> its_lock(handlers_mutex_);
- std::shared_ptr<sync_handler> its_sync_handler
- = std::make_shared<sync_handler>([handler, _state]() {
- handler(_state);
- });
- its_sync_handler->handler_type_ = handler_type_e::STATE;
- handlers_.push_back(its_sync_handler);
- dispatcher_condition_.notify_one();
- }
-}
-
-void application_impl::on_availability(service_t _service, instance_t _instance,
- bool _is_available, major_version_t _major, minor_version_t _minor) {
- std::vector<availability_handler_t> its_handlers;
- {
- std::lock_guard<std::mutex> availability_lock(availability_mutex_);
- if (_is_available == is_available_unlocked(_service, _instance, _major, _minor)) {
- return;
- }
-
- if (_is_available) {
- available_[_service][_instance][_major] = _minor;
- } else {
- auto found_available_service = available_.find(_service);
- if (found_available_service != available_.end()) {
- auto found_instance = found_available_service->second.find(_instance);
- if( found_instance != found_available_service->second.end()) {
- auto found_major = found_instance->second.find(_major);
- if( found_major != found_instance->second.end() ){
- if( _minor == found_major->second)
- found_available_service->second.erase(_instance);
- }
- }
- }
- }
-
- const std::function<void(const availability_major_minor_t&)> find_matching_handler =
- [&](const availability_major_minor_t& _av_ma_mi_it) {
- auto found_major = _av_ma_mi_it.find(_major);
- if (found_major != _av_ma_mi_it.end()) {
- for (std::int32_t mi = _minor; mi >= 0; mi--) {
- const auto found_minor = found_major->second.find(mi);
- if (found_minor != found_major->second.end()) {
- its_handlers.push_back(found_minor->second.first);
- }
- }
- const auto found_any_minor = found_major->second.find(ANY_MINOR);
- if (found_any_minor != found_major->second.end()) {
- its_handlers.push_back(found_any_minor->second.first);
- }
- }
- found_major = _av_ma_mi_it.find(ANY_MAJOR);
- if (found_major != _av_ma_mi_it.end()) {
- for (std::int32_t mi = _minor; mi >= 0; mi--) {
- const auto found_minor = found_major->second.find(mi);
- if (found_minor != found_major->second.end()) {
- its_handlers.push_back(found_minor->second.first);
- }
- }
- const auto found_any_minor = found_major->second.find(ANY_MINOR);
- if (found_any_minor != found_major->second.end()) {
- its_handlers.push_back(found_any_minor->second.first);
- }
- }
- };
-
- auto found_service = availability_.find(_service);
- if (found_service != availability_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- find_matching_handler(found_instance->second);
- }
- found_instance = found_service->second.find(ANY_INSTANCE);
- if (found_instance != found_service->second.end()) {
- find_matching_handler(found_instance->second);
- }
- }
- found_service = availability_.find(ANY_SERVICE);
- if (found_service != availability_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if( found_instance != found_service->second.end()) {
- find_matching_handler(found_instance->second);
- }
- found_instance = found_service->second.find(ANY_INSTANCE);
- if( found_instance != found_service->second.end()) {
- find_matching_handler(found_instance->second);
- }
- }
- {
- std::lock_guard<std::mutex> handlers_lock(handlers_mutex_);
- for (const auto &handler : its_handlers) {
- std::shared_ptr<sync_handler> its_sync_handler =
- std::make_shared<sync_handler>(
- [handler, _service, _instance, _is_available]()
- {
- handler(_service, _instance, _is_available);
- });
- its_sync_handler->handler_type_ = handler_type_e::AVAILABILITY;
- its_sync_handler->service_id_ = _service;
- its_sync_handler->instance_id_ = _instance;
- handlers_.push_back(its_sync_handler);
- }
- }
- }
- if (!_is_available) {
- {
- std::lock_guard<std::mutex> its_lock(subscriptions_mutex_);
- auto found_service = subscriptions_.find(_service);
- if (found_service != subscriptions_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- for (auto &event : found_instance->second) {
- for (auto &eventgroup : event.second) {
- eventgroup.second = false;
- }
- }
- }
- }
- }
- {
- std::lock_guard<std::mutex> its_lock(subscriptions_state_mutex_);
- for (auto &its_subscription_state : subscription_state_) {
- if (std::get<0>(its_subscription_state.first) == _service &&
- std::get<1>(its_subscription_state.first) == _instance) {
- its_subscription_state.second =
- subscription_state_e::SUBSCRIPTION_NOT_ACKNOWLEDGED;
- }
- }
- }
- }
-
- if (its_handlers.size()) {
- std::lock_guard<std::mutex> handlers_lock(handlers_mutex_);
- dispatcher_condition_.notify_one();
- }
-}
-
-void application_impl::on_message(const std::shared_ptr<message> &&_message) {
- const service_t its_service = _message->get_service();
- const instance_t its_instance = _message->get_instance();
- const method_t its_method = _message->get_method();
-
- if (_message->get_message_type() == message_type_e::MT_NOTIFICATION) {
- if (!check_for_active_subscription(its_service, its_instance,
- static_cast<event_t>(its_method))) {
- VSOMEIP_ERROR << "application_impl::on_message ["
- << std::hex << std::setw(4) << std::setfill('0') << its_service << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_instance << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_method << "]";
- return;
- }
- }
-
- {
- std::lock_guard<std::mutex> its_lock(members_mutex_);
- std::set<message_handler> its_handlers;
- auto found_service = members_.find(its_service);
- if (found_service != members_.end()) {
- auto found_instance = found_service->second.find(its_instance);
- if (found_instance != found_service->second.end()) {
- auto found_method = found_instance->second.find(its_method);
- if (found_method != found_instance->second.end()) {
- its_handlers.insert(found_method->second);
- }
- auto found_any_method = found_instance->second.find(ANY_METHOD);
- if (found_any_method != found_instance->second.end()) {
- its_handlers.insert(found_any_method->second);
- }
- }
- auto found_any_instance = found_service->second.find(ANY_INSTANCE);
- if (found_any_instance != found_service->second.end()) {
- auto found_method = found_any_instance->second.find(its_method);
- if (found_method != found_any_instance->second.end()) {
- its_handlers.insert(found_method->second);
- }
- auto found_any_method = found_any_instance->second.find(ANY_METHOD);
- if (found_any_method != found_any_instance->second.end()) {
- its_handlers.insert(found_any_method->second);
- }
- }
- }
- auto found_any_service = members_.find(ANY_SERVICE);
- if (found_any_service != members_.end()) {
- auto found_instance = found_any_service->second.find(its_instance);
- if (found_instance != found_any_service->second.end()) {
- auto found_method = found_instance->second.find(its_method);
- if (found_method != found_instance->second.end()) {
- its_handlers.insert(found_method->second);
- }
- auto found_any_method = found_instance->second.find(ANY_METHOD);
- if (found_any_method != found_instance->second.end()) {
- its_handlers.insert(found_any_method->second);
- }
- }
- auto found_any_instance = found_any_service->second.find(ANY_INSTANCE);
- if (found_any_instance != found_any_service->second.end()) {
- auto found_method = found_any_instance->second.find(its_method);
- if (found_method != found_any_instance->second.end()) {
- its_handlers.insert(found_method->second);
- }
- auto found_any_method = found_any_instance->second.find(ANY_METHOD);
- if (found_any_method != found_any_instance->second.end()) {
- its_handlers.insert(found_any_method->second);
- }
- }
- }
-
- if (its_handlers.size()) {
- std::lock_guard<std::mutex> its_lock(handlers_mutex_);
- for (const auto &its_handler : its_handlers) {
- auto handler = its_handler.handler_;
- std::shared_ptr<sync_handler> its_sync_handler =
- std::make_shared<sync_handler>([handler, _message]() {
- handler(std::move(_message));
- });
- its_sync_handler->handler_type_ = handler_type_e::MESSAGE;
- its_sync_handler->service_id_ = _message->get_service();
- its_sync_handler->instance_id_ = _message->get_instance();
- its_sync_handler->method_id_ = _message->get_method();
- its_sync_handler->session_id_ = _message->get_session();
- handlers_.push_back(its_sync_handler);
- }
- dispatcher_condition_.notify_one();
- }
- }
-}
-
-void application_impl::on_error(error_code_e _error) {
- VSOMEIP_ERROR<< ERROR_INFO[static_cast<int>(_error)] << " ("
- << static_cast<int>(_error) << ")";
-}
-
-// Interface "service_discovery_host"
-routing_manager * application_impl::get_routing_manager() const {
- return routing_.get();
-}
-
-void application_impl::main_dispatch() {
- const std::thread::id its_id = std::this_thread::get_id();
- VSOMEIP_INFO << "main dispatch thread id from application: "
- << std::hex << std::setw(4) << std::setfill('0') << client_ << " ("
- << name_ << ") is: " << std::hex << its_id;
- std::unique_lock<std::mutex> its_lock(handlers_mutex_);
- while (is_dispatching_) {
- if (handlers_.empty() || !is_active_dispatcher(its_id)) {
- // Cancel other waiting dispatcher
- dispatcher_condition_.notify_all();
- // Wait for new handlers to execute
- while (is_dispatching_ && (handlers_.empty() || !is_active_dispatcher(its_id))) {
- dispatcher_condition_.wait(its_lock);
- }
- } else {
- std::shared_ptr<sync_handler> its_handler;
- while (is_dispatching_ && is_active_dispatcher(its_id)
- && (its_handler = get_next_handler())) {
- its_lock.unlock();
- invoke_handler(its_handler);
-
- if (!is_dispatching_)
- return;
-
- its_lock.lock();
-
- reschedule_availability_handler(its_handler);
- remove_elapsed_dispatchers();
-
-#ifdef _WIN32
- if(!is_dispatching_) {
- its_lock.unlock();
- return;
- }
-#endif
- }
- }
- }
- its_lock.unlock();
-}
-
-void application_impl::dispatch() {
- const std::thread::id its_id = std::this_thread::get_id();
- VSOMEIP_INFO << "dispatch thread id from application: "
- << std::hex << std::setw(4) << std::setfill('0') << client_ << " ("
- << name_ << ") is: " << std::hex << its_id;
- while (is_active_dispatcher(its_id)) {
- std::unique_lock<std::mutex> its_lock(handlers_mutex_);
- if (is_dispatching_ && handlers_.empty()) {
- dispatcher_condition_.wait(its_lock);
- if (handlers_.empty()) { // Maybe woken up from main dispatcher
- if (!is_dispatching_) {
- return;
- }
- std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
- elapsed_dispatchers_.insert(its_id);
- return;
- }
- } else {
- std::shared_ptr<sync_handler> its_handler;
- while (is_dispatching_ && is_active_dispatcher(its_id)
- && (its_handler = get_next_handler())) {
- its_lock.unlock();
- invoke_handler(its_handler);
-
- if (!is_dispatching_)
- return;
-
- its_lock.lock();
-
- reschedule_availability_handler(its_handler);
- remove_elapsed_dispatchers();
- }
- }
- }
- std::lock_guard<std::mutex> its_lock(handlers_mutex_);
- if (is_dispatching_) {
- std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
- elapsed_dispatchers_.insert(its_id);
- }
- dispatcher_condition_.notify_all();
-}
-
-std::shared_ptr<application_impl::sync_handler> application_impl::get_next_handler() {
- std::shared_ptr<sync_handler> its_next_handler;
- while (!handlers_.empty() && !its_next_handler) {
- its_next_handler = handlers_.front();
- handlers_.pop_front();
-
- // Check handler
- if (its_next_handler->handler_type_ == handler_type_e::AVAILABILITY) {
- const std::pair<service_t, instance_t> its_si_pair = std::make_pair(
- its_next_handler->service_id_,
- its_next_handler->instance_id_);
- auto found_si = availability_handlers_.find(its_si_pair);
- if (found_si != availability_handlers_.end()
- && !found_si->second.empty()
- && found_si->second.front() != its_next_handler) {
- found_si->second.push_back(its_next_handler);
- // There is a running availability handler for this service.
- // Therefore, this one must wait...
- its_next_handler = nullptr;
- } else {
- availability_handlers_[its_si_pair].push_back(its_next_handler);
- }
- } else if (its_next_handler->handler_type_ == handler_type_e::MESSAGE) {
- const std::pair<service_t, instance_t> its_si_pair = std::make_pair(
- its_next_handler->service_id_,
- its_next_handler->instance_id_);
- auto found_si = availability_handlers_.find(its_si_pair);
- if (found_si != availability_handlers_.end()
- && found_si->second.size() > 1) {
- // The message comes after the next availability handler
- // Therefore, queue it to the last one
- found_si->second.push_back(its_next_handler);
- its_next_handler = nullptr;
- }
- }
- }
-
- return its_next_handler;
-}
-
-void application_impl::reschedule_availability_handler(
- const std::shared_ptr<sync_handler> &_handler) {
- if (_handler->handler_type_ == handler_type_e::AVAILABILITY) {
- const std::pair<service_t, instance_t> its_si_pair = std::make_pair(
- _handler->service_id_, _handler->instance_id_);
- auto found_si = availability_handlers_.find(its_si_pair);
- if (found_si != availability_handlers_.end()) {
- if (!found_si->second.empty()
- && found_si->second.front() == _handler) {
- found_si->second.pop_front();
-
- // If there are other availability handlers pending, schedule
- // them and all handlers that were queued because of them
- for (auto it = found_si->second.rbegin();
- it != found_si->second.rend(); it++) {
- handlers_.push_front(*it);
- }
- availability_handlers_.erase(found_si);
- }
- return;
- }
- VSOMEIP_WARNING << __func__
- << ": An unknown availability handler returned!";
- }
-}
-
-void application_impl::invoke_handler(std::shared_ptr<sync_handler> &_handler) {
- const std::thread::id its_id = std::this_thread::get_id();
-
- std::shared_ptr<sync_handler> its_sync_handler
- = std::make_shared<sync_handler>(_handler->service_id_,
- _handler->instance_id_, _handler->method_id_,
- _handler->eventgroup_id_, _handler->session_id_,
- _handler->handler_type_);
-
- boost::asio::steady_timer its_dispatcher_timer(io_);
- its_dispatcher_timer.expires_from_now(std::chrono::milliseconds(max_dispatch_time_));
- its_dispatcher_timer.async_wait([this, its_id, its_sync_handler](const boost::system::error_code &_error) {
- if (!_error) {
- print_blocking_call(its_sync_handler);
- bool active_dispatcher_available(false);
- if (is_dispatching_) {
- std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
- active_dispatcher_available = has_active_dispatcher();
- }
- if (active_dispatcher_available) {
- std::lock_guard<std::mutex> its_lock(handlers_mutex_);
- dispatcher_condition_.notify_all();
- } else if (is_dispatching_) {
- // If possible, create a new dispatcher thread to unblock.
- // If this is _not_ possible, dispatching is blocked until
- // at least one of the active handler calls returns.
- std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
- if (dispatchers_.size() < max_dispatchers_ && is_dispatching_) {
- auto its_dispatcher = std::make_shared<std::thread>(
- std::bind(&application_impl::dispatch, shared_from_this()));
- dispatchers_[its_dispatcher->get_id()] = its_dispatcher;
- } else {
- VSOMEIP_ERROR << "Maximum number of dispatchers exceeded.";
- }
- } else {
- VSOMEIP_INFO << "Won't start new dispatcher thread as Client="
- << std::hex << get_client() << " is shutting down";
- }
- }
- });
- if (client_side_logging_
- && (client_side_logging_filter_.empty()
- || (1 == client_side_logging_filter_.count(std::make_tuple(its_sync_handler->service_id_, ANY_INSTANCE)))
- || (1 == client_side_logging_filter_.count(std::make_tuple(its_sync_handler->service_id_, its_sync_handler->instance_id_))))) {
- VSOMEIP_INFO << "Invoking handler: ("
- << std::hex << std::setw(4) << std::setfill('0') << client_ <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << its_sync_handler->service_id_ << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_sync_handler->instance_id_ << "."
- << std::hex << std::setw(4) << std::setfill('0') << its_sync_handler->method_id_ << ":"
- << std::hex << std::setw(4) << std::setfill('0') << its_sync_handler->session_id_ << "] "
- << "type=" << static_cast<std::uint32_t>(its_sync_handler->handler_type_)
- << " thread=" << std::hex << its_id;
- }
-
- while (is_dispatching_ ) {
- if (dispatcher_mutex_.try_lock()) {
- running_dispatchers_.insert(its_id);
- dispatcher_mutex_.unlock();
- break;
- }
- std::this_thread::yield();
- }
-
- if (is_dispatching_) {
- try {
- _handler->handler_();
- } catch (const std::exception &e) {
- VSOMEIP_ERROR << "application_impl::invoke_handler caught exception: "
- << e.what();
- print_blocking_call(its_sync_handler);
- }
- }
- boost::system::error_code ec;
- its_dispatcher_timer.cancel(ec);
-
- while (is_dispatching_ ) {
- if (dispatcher_mutex_.try_lock()) {
- running_dispatchers_.erase(its_id);
- dispatcher_mutex_.unlock();
- return;
- }
- std::this_thread::yield();
- }
-}
-
-bool application_impl::has_active_dispatcher() {
- for (const auto &d : dispatchers_) {
- if (running_dispatchers_.find(d.first) == running_dispatchers_.end() &&
- elapsed_dispatchers_.find(d.first) == elapsed_dispatchers_.end()) {
- return true;
- }
- }
- return false;
-}
-
-bool application_impl::is_active_dispatcher(const std::thread::id &_id) {
- if (!is_dispatching_) {
- return is_dispatching_;
- }
- std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
- for (const auto &d : dispatchers_) {
- if (d.first != _id &&
- running_dispatchers_.find(d.first) == running_dispatchers_.end() &&
- elapsed_dispatchers_.find(d.first) == elapsed_dispatchers_.end()) {
- return false;
- }
- }
- return true;
-}
-
-void application_impl::remove_elapsed_dispatchers() {
- if (is_dispatching_) {
- std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
- for (auto id : elapsed_dispatchers_) {
- auto its_dispatcher = dispatchers_.find(id);
- if (its_dispatcher->second->joinable())
- its_dispatcher->second->join();
- dispatchers_.erase(id);
- }
- elapsed_dispatchers_.clear();
- }
-}
-
-void application_impl::clear_all_handler() {
- unregister_state_handler();
- {
- std::lock_guard<std::mutex> its_lock(offered_services_handler_mutex_);
- offered_services_handler_ = nullptr;
- }
-
- {
- std::lock_guard<std::mutex> availability_lock(availability_mutex_);
- availability_.clear();
- }
-
- {
- std::lock_guard<std::mutex> its_lock(subscription_mutex_);
- subscription_.clear();
- }
-
- {
- std::lock_guard<std::mutex> its_lock(subscription_error_mutex_);
- eventgroup_error_handlers_.clear();
- }
-
- {
- std::lock_guard<std::mutex> its_lock(members_mutex_);
- members_.clear();
- }
- {
- std::lock_guard<std::mutex> its_lock(handlers_mutex_);
- handlers_.clear();
- }
-}
-
-void application_impl::shutdown() {
- VSOMEIP_INFO << "shutdown thread id from application: "
- << std::hex << std::setw(4) << std::setfill('0') << client_ << " ("
- << name_ << ") is: " << std::hex << std::this_thread::get_id();
-#ifndef _WIN32
- boost::asio::detail::posix_signal_blocker blocker;
-#endif
-
- {
- std::unique_lock<std::mutex> its_lock(start_stop_mutex_);
- while(!stopped_) {
- stop_cv_.wait(its_lock);
- }
- }
- {
- std::lock_guard<std::mutex> its_handler_lock(handlers_mutex_);
- is_dispatching_ = false;
- dispatcher_condition_.notify_all();
- }
- {
- std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
- for (auto its_dispatcher : dispatchers_) {
- if (its_dispatcher.second->get_id() != stop_caller_id_) {
- if (its_dispatcher.second->joinable()) {
- its_dispatcher.second->join();
- }
- } else {
- // If the caller of stop() is one of our dispatchers
- // it can happen the shutdown mechanism will block
- // as that thread probably can't be joined. The reason
- // is the caller of stop() probably wants to join the
- // thread once call start (which got to the IO-Thread)
- // and which is expected to return after stop() has been
- // called.
- // Therefore detach this thread instead of joining because
- // after it will return to "main_dispatch" it will be
- // properly shutdown anyways because "is_dispatching_"
- // was set to "false" here.
- its_dispatcher.second->detach();
- }
- }
- availability_handlers_.clear();
- running_dispatchers_.clear();
- elapsed_dispatchers_.clear();
- dispatchers_.clear();
- }
-
- if (routing_)
- routing_->stop();
-
- work_.reset();
- io_.stop();
-
- {
- std::lock_guard<std::mutex> its_lock_start_stop(start_stop_mutex_);
- for (auto t : io_threads_) {
- t->join();
- }
- io_threads_.clear();
- }
-}
-
-bool application_impl::is_routing() const {
- return is_routing_manager_host_;
-}
-
-void application_impl::send_back_cached_event(service_t _service,
- instance_t _instance,
- event_t _event) {
- std::shared_ptr<event> its_event = routing_->find_event(_service,
- _instance, _event);
- if (its_event && its_event->is_field() && its_event->is_set()) {
- std::shared_ptr<message> its_message = runtime_->create_notification();
- its_message->set_service(_service);
- its_message->set_method(_event);
- its_message->set_instance(_instance);
- its_message->set_payload(its_event->get_payload());
- its_message->set_initial(true);
- on_message(std::move(its_message));
- VSOMEIP_INFO << "Sending back cached event ("
- << std::hex << std::setw(4) << std::setfill('0') << client_ <<"): ["
- << 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') << _event << "]";
- }
-}
-
-void application_impl::send_back_cached_eventgroup(service_t _service,
- instance_t _instance,
- eventgroup_t _eventgroup) {
- std::set<std::shared_ptr<event>> its_events = routing_->find_events(_service, _instance,
- _eventgroup);
- for(const auto &its_event : its_events) {
- if (its_event && its_event->is_field() && its_event->is_set()) {
- std::shared_ptr<message> its_message = runtime_->create_notification();
- const event_t its_event_id(its_event->get_event());
- its_message->set_service(_service);
- its_message->set_method(its_event_id);
- its_message->set_instance(_instance);
- its_message->set_payload(its_event->get_payload());
- its_message->set_initial(true);
- on_message(std::move(its_message));
- VSOMEIP_INFO << "Sending back cached event ("
- << std::hex << std::setw(4) << std::setfill('0') << client_ <<"): ["
- << 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
- << "] from eventgroup "
- << std::hex << std::setw(4) << std::setfill('0') << _eventgroup;
- }
- }
-}
-
-void application_impl::set_routing_state(routing_state_e _routing_state) {
- if (routing_)
- routing_->set_routing_state(_routing_state);
-}
-
-void application_impl::check_send_back_cached_event(
- service_t _service, instance_t _instance, event_t _event,
- eventgroup_t _eventgroup, bool *_send_back_cached_event,
- bool *_send_back_cached_eventgroup) {
- std::lock_guard<std::mutex> its_lock(subscriptions_mutex_);
- *_send_back_cached_event = false;
- *_send_back_cached_eventgroup = false;
- bool already_subscribed(false);
- auto found_service = subscriptions_.find(_service);
- if(found_service != subscriptions_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_event = found_instance->second.find(_event);
- if (found_event != found_instance->second.end()) {
- auto found_eventgroup = found_event->second.find(_eventgroup);
- if (found_eventgroup != found_event->second.end()) {
- already_subscribed = true;
- if (found_eventgroup->second) {
- // initial values for this event have already been
- // received, send back cached value
- if(_event == ANY_EVENT) {
- *_send_back_cached_eventgroup = true;
- } else {
- *_send_back_cached_event = true;
- }
- }
- }
- }
- }
- }
-
- if (!already_subscribed) {
- subscriptions_[_service][_instance][_event][_eventgroup] = false;
- }
-}
-
-void application_impl::remove_subscription(service_t _service,
- instance_t _instance,
- eventgroup_t _eventgroup,
- event_t _event) {
-
- {
- auto its_tuple = std::make_tuple(_service, _instance, _eventgroup, _event);
- std::lock_guard<std::mutex> its_lock(subscriptions_state_mutex_);
- subscription_state_.erase(its_tuple);
- }
-
- std::lock_guard<std::mutex> its_lock(subscriptions_mutex_);
-
- auto found_service = subscriptions_.find(_service);
- if(found_service != subscriptions_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_event = found_instance->second.find(_event);
- if (found_event != found_instance->second.end()) {
- if (found_event->second.erase(_eventgroup)) {
- if (!found_event->second.size()) {
- found_instance->second.erase(_event);
- if (!found_instance->second.size()) {
- found_service->second.erase(_instance);
- if (!found_service->second.size()) {
- subscriptions_.erase(_service);
- }
- }
- }
- }
- }
- }
- }
-}
-
-bool application_impl::check_for_active_subscription(service_t _service,
- instance_t _instance,
- event_t _event) {
- std::lock_guard<std::mutex> its_lock(subscriptions_mutex_);
- auto found_service = subscriptions_.find(_service);
- if(found_service != subscriptions_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_event = found_instance->second.find(_event);
- if (found_event != found_instance->second.end()) {
- if (found_event->second.size()) {
- for (auto &eventgroup : found_event->second) {
- eventgroup.second = true;
- }
- return true;
- }
- } else {
- // Received a event which nobody yet explicitly subscribed to.
- // Check if someone subscribed to ANY_EVENT for one of
- // the received event's eventgroups
- auto found_any_event = found_instance->second.find(ANY_EVENT);
- if (found_any_event != found_instance->second.end()) {
- if (routing_) {
- std::shared_ptr<event> its_event = routing_->find_event(
- _service, _instance, _event);
- if (its_event) {
- for (const auto eg : its_event->get_eventgroups()) {
- auto found_eventgroup = found_any_event->second.find(eg);
- if (found_eventgroup != found_any_event->second.end()) {
- // set the flag for initial event received to true
- // even if we might not already received all of the
- // eventgroups events.
- found_eventgroup->second = true;
- return true;
- }
- }
- }
- }
- }
- }
- }
- }
- // Return false if an event was received from:
- // - a service which nobody yet subscribed to
- // - a service instance which nobody yet subscribed to
- // - a service instance and nobody yet subscribed to one of the event's
- // eventgroups
- return false;
-}
-
-bool application_impl::check_subscription_state(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event) {
- bool is_acknowledged(false);
- bool should_subscribe(true);
- {
- auto its_tuple = std::make_tuple(_service, _instance, _eventgroup, _event);
- std::lock_guard<std::mutex> its_lock(subscriptions_state_mutex_);
- auto its_subscription_state = subscription_state_.find(its_tuple);
- if (its_subscription_state != subscription_state_.end()) {
- if (its_subscription_state->second !=
- subscription_state_e::SUBSCRIPTION_NOT_ACKNOWLEDGED) {
- // only return true if subscription is NACK
- // as only then we need to subscribe!
- should_subscribe = false;
- if (its_subscription_state->second ==
- subscription_state_e::SUBSCRIPTION_ACKNOWLEDGED) {
- is_acknowledged = true;
- }
- }
- } else {
- subscription_state_[its_tuple] = subscription_state_e::IS_SUBSCRIBING;
- }
- }
-
- if (!should_subscribe && is_acknowledged) {
- // Deliver subscription state only if ACK has already received
- deliver_subscription_state(_service, _instance, _eventgroup, _event, 0 /* OK */);
- }
-
- return should_subscribe;
-}
-
-void application_impl::print_blocking_call(std::shared_ptr<sync_handler> _handler) {
- switch (_handler->handler_type_) {
- case handler_type_e::AVAILABILITY:
- VSOMEIP_WARNING << "BLOCKING CALL AVAILABILITY("
- << std::hex << std::setw(4) << std::setfill('0') << get_client() <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _handler->service_id_ << "."
- << std::hex << std::setw(4) << std::setfill('0') << _handler->instance_id_ << "]";
- break;
- case handler_type_e::MESSAGE:
- VSOMEIP_WARNING << "BLOCKING CALL MESSAGE("
- << std::hex << std::setw(4) << std::setfill('0') << get_client() <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _handler->service_id_ << "."
- << std::hex << std::setw(4) << std::setfill('0') << _handler->instance_id_ << "."
- << std::hex << std::setw(4) << std::setfill('0') << _handler->method_id_ << ":"
- << std::hex << std::setw(4) << std::setfill('0') << _handler->session_id_ << "]";
- break;
- case handler_type_e::STATE:
- VSOMEIP_WARNING << "BLOCKING CALL STATE("
- << std::hex << std::setw(4) << std::setfill('0') << get_client() << ")";
- break;
- case handler_type_e::SUBSCRIPTION:
- VSOMEIP_WARNING << "BLOCKING CALL SUBSCRIPTION("
- << std::hex << std::setw(4) << std::setfill('0') << get_client() <<"): ["
- << std::hex << std::setw(4) << std::setfill('0') << _handler->service_id_ << "."
- << std::hex << std::setw(4) << std::setfill('0') << _handler->instance_id_ << "."
- << std::hex << std::setw(4) << std::setfill('0') << _handler->eventgroup_id_ << ":"
- << std::hex << std::setw(4) << std::setfill('0') << _handler->method_id_ << "]";
- break;
- case handler_type_e::OFFERED_SERVICES_INFO:
- VSOMEIP_WARNING << "BLOCKING CALL OFFERED_SERVICES_INFO("
- << std::hex << std::setw(4) << std::setfill('0') << get_client() <<")";
- break;
- case handler_type_e::WATCHDOG:
- VSOMEIP_WARNING << "BLOCKING CALL WATCHDOG("
- << std::hex << std::setw(4) << std::setfill('0') << get_client() <<")";
- break;
- case handler_type_e::UNKNOWN:
- VSOMEIP_WARNING << "BLOCKING CALL UNKNOWN("
- << std::hex << std::setw(4) << std::setfill('0') << get_client() << ")";
- break;
- }
-}
-
-
-void application_impl::get_offered_services_async(offer_type_e _offer_type, offered_services_handler_t _handler) {
- {
- std::lock_guard<std::mutex> its_lock(offered_services_handler_mutex_);
- offered_services_handler_ = _handler;
- }
-
- if (!is_routing_manager_host_) {
- routing_->send_get_offered_services_info(get_client(), _offer_type);
- } else {
- std::vector<std::pair<service_t, instance_t>> its_services;
- auto its_routing_manager_host = std::dynamic_pointer_cast<routing_manager_impl>(routing_);
-
- for (auto s : its_routing_manager_host->get_offered_services()) {
- for (auto i : s.second) {
- auto its_unreliable_endpoint = i.second->get_endpoint(false);
- auto its_reliable_endpoint = i.second->get_endpoint(true);
-
- if (_offer_type == offer_type_e::OT_LOCAL) {
- if ( ((its_unreliable_endpoint && (its_unreliable_endpoint->get_local_port() == ILLEGAL_PORT))
- && (its_reliable_endpoint && (its_reliable_endpoint->get_local_port() == ILLEGAL_PORT)))
- || (!its_reliable_endpoint && !its_unreliable_endpoint)) {
- its_services.push_back(std::make_pair(s.first, i.first));
- }
- } else if (_offer_type == offer_type_e::OT_REMOTE) {
- if ((its_unreliable_endpoint && its_unreliable_endpoint->get_local_port() != ILLEGAL_PORT)
- || (its_reliable_endpoint && its_reliable_endpoint->get_local_port() != ILLEGAL_PORT)) {
- its_services.push_back(std::make_pair(s.first, i.first));
- }
- } else if (_offer_type == offer_type_e::OT_ALL) {
- its_services.push_back(std::make_pair(s.first, i.first));
- }
- }
- }
- on_offered_services_info(its_services);
- }
- return;
-}
-
-
-void application_impl::on_offered_services_info(std::vector<std::pair<service_t, instance_t>> &_services) {
- bool has_offered_services_handler(false);
- offered_services_handler_t handler = nullptr;
- {
- std::lock_guard<std::mutex> its_lock(offered_services_handler_mutex_);
- if (offered_services_handler_) {
- has_offered_services_handler = true;
- handler = offered_services_handler_;
- }
- }
- if (has_offered_services_handler) {
- std::lock_guard<std::mutex> its_lock(handlers_mutex_);
- std::shared_ptr<sync_handler> its_sync_handler
- = std::make_shared<sync_handler>([handler, _services]() {
- handler(_services);
- });
- its_sync_handler->handler_type_ = handler_type_e::OFFERED_SERVICES_INFO;
- handlers_.push_back(its_sync_handler);
- dispatcher_condition_.notify_one();
- }
-}
-
-void application_impl::watchdog_cbk(boost::system::error_code const &_error) {
- if (!_error) {
-
- watchdog_handler_t handler = nullptr;
- {
- std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
- handler = watchdog_handler_;
- if (handler && std::chrono::seconds::zero() != watchdog_interval_) {
- watchdog_timer_.expires_from_now(watchdog_interval_);
- watchdog_timer_.async_wait(std::bind(&application_impl::watchdog_cbk,
- this, std::placeholders::_1));
- }
- }
-
- if (handler) {
- std::lock_guard<std::mutex> its_lock(handlers_mutex_);
- std::shared_ptr<sync_handler> its_sync_handler
- = std::make_shared<sync_handler>([handler]() { handler(); });
- its_sync_handler->handler_type_ = handler_type_e::WATCHDOG;
- handlers_.push_back(its_sync_handler);
- dispatcher_condition_.notify_one();
- }
- }
-}
-
-void application_impl::set_watchdog_handler(watchdog_handler_t _handler,
- std::chrono::seconds _interval) {
- if (_handler && std::chrono::seconds::zero() != _interval) {
- std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
- watchdog_handler_ = _handler;
- watchdog_interval_ = _interval;
- watchdog_timer_.expires_from_now(_interval);
- watchdog_timer_.async_wait(std::bind(&application_impl::watchdog_cbk,
- this, std::placeholders::_1));
- } else {
- std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
- watchdog_timer_.cancel();
- watchdog_handler_ = nullptr;
- watchdog_interval_ = std::chrono::seconds::zero();
- }
-}
-
-void application_impl::register_async_subscription_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- async_subscription_handler_t _handler) {
-
- std::lock_guard<std::mutex> its_lock(subscription_mutex_);
- subscription_[_service][_instance][_eventgroup] = std::make_pair(nullptr, _handler);;
-
- message_handler_t handler([&](const std::shared_ptr<message>& request) {
- send(runtime_->create_response(request), true);
- });
- register_message_handler(_service, _instance, ANY_METHOD - 1, handler);
-}
-
-} // namespace vsomeip
diff --git a/implementation/runtime/src/error.cpp b/implementation/runtime/src/error.cpp
deleted file mode 100644
index 998d1e7..0000000
--- a/implementation/runtime/src/error.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) 2015-2017 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 <vsomeip/error.hpp>
-
-namespace vsomeip {
-
-const char *ERROR_INFO[] = { "Missing vsomeip configuration",
- "Missing port configuration", "Client endpoint creation failed",
- "Server endpoint creation failed", "Service property mismatch" };
-
-} // namespace vsomeip
diff --git a/implementation/runtime/src/runtime.cpp b/implementation/runtime/src/runtime.cpp
deleted file mode 100644
index 281cea1..0000000
--- a/implementation/runtime/src/runtime.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/runtime.hpp>
-
-#include "../include/runtime_impl.hpp"
-
-namespace vsomeip {
-
-std::string runtime::get_property(const std::string &_name) {
- return runtime_impl::get_property(_name);
-}
-
-void runtime::set_property(const std::string &_name, const std::string &_value) {
- runtime_impl::set_property(_name, _value);
-}
-
-std::shared_ptr<runtime> runtime::get() {
- return runtime_impl::get();
-}
-
-} // namespace vsomeip
diff --git a/implementation/runtime/src/runtime_impl.cpp b/implementation/runtime/src/runtime_impl.cpp
deleted file mode 100644
index 4ebb3ad..0000000
--- a/implementation/runtime/src/runtime_impl.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/defines.hpp>
-
-#include "../include/application_impl.hpp"
-#include "../include/runtime_impl.hpp"
-#include "../../message/include/message_impl.hpp"
-#include "../../message/include/payload_impl.hpp"
-
-namespace vsomeip {
-
-std::map<std::string, std::string> runtime_impl::properties_;
-std::shared_ptr<runtime> runtime_impl::the_runtime_ = std::make_shared<runtime_impl>();
-uint32_t runtime_impl::postfix_id = 0;
-
-std::string runtime_impl::get_property(const std::string &_name) {
- auto found_property = properties_.find(_name);
- if (found_property != properties_.end())
- return found_property->second;
- return "";
-}
-
-void runtime_impl::set_property(const std::string &_name, const std::string &_value) {
- properties_[_name] = _value;
-}
-
-std::shared_ptr<runtime> runtime_impl::get() {
- return the_runtime_;
-}
-
-runtime_impl::~runtime_impl() {
-}
-
-std::shared_ptr<application> runtime_impl::create_application(
- const std::string &_name) {
- std::lock_guard<std::mutex> its_lock(applications_mutex_);
- std::string its_name_ = _name;
- auto found_application = applications_.find(_name);
- if( found_application != applications_.end()) {
- its_name_ += "_" + std::to_string(postfix_id++);
- }
- std::shared_ptr<application> application = std::make_shared<application_impl>(its_name_);
- applications_[its_name_] = application;
- return application;
-}
-
-std::shared_ptr<message> runtime_impl::create_message(bool _reliable) const {
- std::shared_ptr<message_impl> its_message =
- std::make_shared<message_impl>();
- its_message->set_protocol_version(VSOMEIP_PROTOCOL_VERSION);
- its_message->set_return_code(return_code_e::E_OK);
- its_message->set_reliable(_reliable);
- its_message->set_interface_version(DEFAULT_MAJOR);
- return (its_message);
-}
-
-std::shared_ptr<message> runtime_impl::create_request(bool _reliable) const {
- std::shared_ptr<message_impl> its_request =
- std::make_shared<message_impl>();
- its_request->set_protocol_version(VSOMEIP_PROTOCOL_VERSION);
- its_request->set_message_type(message_type_e::MT_REQUEST);
- its_request->set_return_code(return_code_e::E_OK);
- its_request->set_reliable(_reliable);
- its_request->set_interface_version(DEFAULT_MAJOR);
- return (its_request);
-}
-
-std::shared_ptr<message> runtime_impl::create_response(
- const std::shared_ptr<message> &_request) const {
- std::shared_ptr<message_impl> its_response =
- std::make_shared<message_impl>();
- its_response->set_service(_request->get_service());
- its_response->set_instance(_request->get_instance());
- its_response->set_method(_request->get_method());
- its_response->set_client(_request->get_client());
- its_response->set_session(_request->get_session());
- its_response->set_interface_version(_request->get_interface_version());
- its_response->set_message_type(message_type_e::MT_RESPONSE);
- its_response->set_return_code(return_code_e::E_OK);
- its_response->set_reliable(_request->is_reliable());
- return (its_response);
-}
-
-std::shared_ptr<message> runtime_impl::create_notification(
- bool _reliable) const {
- std::shared_ptr<message_impl> its_notification = std::make_shared<
- message_impl>();
- its_notification->set_protocol_version(VSOMEIP_PROTOCOL_VERSION);
- its_notification->set_message_type(message_type_e::MT_NOTIFICATION);
- its_notification->set_return_code(return_code_e::E_OK);
- its_notification->set_reliable(_reliable);
- its_notification->set_interface_version(DEFAULT_MAJOR);
- return (its_notification);
-}
-
-std::shared_ptr<payload> runtime_impl::create_payload() const {
- return (std::make_shared<payload_impl>());
-}
-
-std::shared_ptr<payload> runtime_impl::create_payload(const byte_t *_data,
- uint32_t _size) const {
- return (std::make_shared<payload_impl>(_data, _size));
-}
-
-std::shared_ptr<payload> runtime_impl::create_payload(
- const std::vector<byte_t> &_data) const {
- return (std::make_shared<payload_impl>(_data));
-}
-
-std::shared_ptr<application> runtime_impl::get_application(
- const std::string &_name) const {
- std::lock_guard<std::mutex> its_lock(applications_mutex_);
- auto found_application = applications_.find(_name);
- if(found_application != applications_.end())
- return found_application->second.lock();
- return nullptr;
-}
-
-void runtime_impl::remove_application(
- const std::string &_name) {
- std::lock_guard<std::mutex> its_lock(applications_mutex_);
- auto found_application = applications_.find(_name);
- if(found_application != applications_.end()) {
- applications_.erase(_name);
- }
-}
-
-} // namespace vsomeip
diff --git a/implementation/service_discovery/include/configuration_option_impl.hpp b/implementation/service_discovery/include/configuration_option_impl.hpp
deleted file mode 100644
index 1d231e8..0000000
--- a/implementation/service_discovery/include/configuration_option_impl.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_CONFIGURATION_OPTION_IMPL_HPP
-#define VSOMEIP_SD_CONFIGURATION_OPTION_IMPL_HPP
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "option_impl.hpp"
-
-namespace vsomeip {
-
-class serializer;
-class deserializer;
-
-namespace sd {
-
-class configuration_option_impl: public option_impl {
-
-public:
- configuration_option_impl();
- virtual ~configuration_option_impl();
- bool operator==(const configuration_option_impl &_other) const;
-
- void add_item(const std::string &_key, const std::string &_value);
- void remove_item(const std::string &_key);
-
- std::vector<std::string> get_keys() const;
- std::vector<std::string> get_values() const;
- std::string get_value(const std::string &_key) const;
-
- bool serialize(vsomeip::serializer *_to) const;
- bool deserialize(vsomeip::deserializer *_from);
-
-private:
- std::map<std::string, std::string> configuration_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_CONFIGURATION_OPTION_IMPL_HPP
diff --git a/implementation/service_discovery/include/constants.hpp b/implementation/service_discovery/include/constants.hpp
deleted file mode 100644
index 31bff53..0000000
--- a/implementation/service_discovery/include/constants.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_CONSTANTS_HPP
-#define VSOMEIP_SD_CONSTANTS_HPP
-
-#include <vsomeip/enumeration_types.hpp>
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-namespace sd {
-
-const service_t service = 0xFFFF;
-const instance_t instance = 0x0000;
-const method_t method = 0x8100;
-const client_t client = 0x0000;
-const protocol_version_t protocol_version = 0x01;
-const interface_version_t interface_version = 0x01;
-const message_type_e message_type = message_type_e::MT_NOTIFICATION;
-const return_code_e return_code = return_code_e::E_OK;
-
-namespace protocol {
-
-const uint8_t reserved_byte = 0x0;
-const uint16_t reserved_word = 0x0;
-const uint32_t reserved_long = 0x0;
-
-const uint8_t tcp = 0x06;
-const uint8_t udp = 0x11;
-
-} // namespace protocol
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_CONSTANTS_HPP
diff --git a/implementation/service_discovery/include/defines.hpp b/implementation/service_discovery/include/defines.hpp
deleted file mode 100644
index 1f884d2..0000000
--- a/implementation/service_discovery/include/defines.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_DEFINES_HPP
-#define VSOMEIP_SD_DEFINES_HPP
-
-#include "../../configuration/include/internal.hpp"
-
-#define VSOMEIP_MAX_TCP_SD_PAYLOAD 4075 // Available for entries & options
-#define VSOMEIP_MAX_UDP_SD_PAYLOAD 1380
-
-#define VSOMEIP_SOMEIP_SD_DATA_SIZE 12
-#define VSOMEIP_SOMEIP_SD_ENTRY_LENGTH_SIZE 4
-#define VSOMEIP_SOMEIP_SD_ENTRY_SIZE 16
-#define VSOMEIP_SOMEIP_SD_IPV4_OPTION_SIZE 12
-#define VSOMEIP_SOMEIP_SD_IPV6_OPTION_SIZE 24
-#define VSOMEIP_SOMEIP_SD_OPTION_LENGTH_SIZE 4
-#define VSOMEIP_SOMEIP_SD_OPTION_HEADER_SIZE 3
-
-
-
-#define VSOMEIP_SD_IPV4_OPTION_LENGTH 0x0009
-#define VSOMEIP_SD_IPV6_OPTION_LENGTH 0x0015
-
-#define VSOMEIP_SD_SERVICE 0xFFFF
-#define VSOMEIP_SD_INSTANCE 0x0000
-#define VSOMEIP_SD_METHOD 0x8100
-#define VSOMEIP_SD_CLIENT (VSOMEIP_DIAGNOSIS_ADDRESS << 8) // SIP_SD_1139
-
-
-#define VSOMEIP_SD_DEFAULT_ENABLED true
-#define VSOMEIP_SD_DEFAULT_PROTOCOL "udp"
-#define VSOMEIP_SD_DEFAULT_MULTICAST "224.224.224.0"
-#define VSOMEIP_SD_DEFAULT_PORT 30490
-
-#define VSOMEIP_SD_DEFAULT_INITIAL_DELAY_MIN 0
-#define VSOMEIP_SD_DEFAULT_INITIAL_DELAY_MAX 3000
-#define VSOMEIP_SD_DEFAULT_REPETITIONS_BASE_DELAY 10
-#define VSOMEIP_SD_DEFAULT_REPETITIONS_MAX 3
-#define VSOMEIP_SD_DEFAULT_TTL DEFAULT_TTL
-#define VSOMEIP_SD_DEFAULT_CYCLIC_OFFER_DELAY 1000
-#define VSOMEIP_SD_DEFAULT_REQUEST_RESPONSE_DELAY 2000
-#define VSOMEIP_SD_DEFAULT_OFFER_DEBOUNCE_TIME 500
-#define VSOMEIP_SD_DEFAULT_FIND_DEBOUNCE_TIME 500
-
-
-#endif // VSOMEIP_SD_DEFINES_HPP
diff --git a/implementation/service_discovery/include/deserializer.hpp b/implementation/service_discovery/include/deserializer.hpp
deleted file mode 100755
index a1b45be..0000000
--- a/implementation/service_discovery/include/deserializer.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_DESERIALIZER_HPP
-#define VSOMEIP_SD_DESERIALIZER_HPP
-
-#include "../../message/include/deserializer.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-class message_impl;
-
-class deserializer: public vsomeip::deserializer {
-public:
- deserializer(std::uint32_t _shrink_buffer_threshold);
- deserializer(uint8_t *_data, std::size_t _length,
- std::uint32_t _shrink_buffer_threshold);
- deserializer(const deserializer &_other);
- virtual ~deserializer();
-
- message_impl * deserialize_sd_message();
-};
-
-} // namespace sd
-} // vsomeip
-
-#endif // VSOMEIP_SD_DESERIALIZER_HPP
diff --git a/implementation/service_discovery/include/entry_impl.hpp b/implementation/service_discovery/include/entry_impl.hpp
deleted file mode 100755
index db12a1e..0000000
--- a/implementation/service_discovery/include/entry_impl.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_ENTRY_IMPL_HPP
-#define VSOMEIP_SD_ENTRY_IMPL_HPP
-
-#include <memory>
-#include <vector>
-
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/internal/serializable.hpp>
-
-#include "enumeration_types.hpp"
-#include "message_element_impl.hpp"
-
-#define VSOMEIP_MAX_OPTION_RUN 2
-
-namespace vsomeip {
-
-class deserializer;
-
-namespace sd {
-
-class option_impl;
-class message_impl;
-
-class entry_impl: public message_element_impl {
-public:
- virtual ~entry_impl();
-
- // public interface
- entry_type_e get_type() const;
-
- service_t get_service() const;
- void set_service(service_t _service);
-
- instance_t get_instance() const;
- void set_instance(instance_t _instance);
-
- major_version_t get_major_version() const;
- void set_major_version(major_version_t _version);
-
- ttl_t get_ttl() const;
- void set_ttl(ttl_t _ttl);
-
- const std::vector<uint8_t> & get_options(uint8_t _run) const;
- void assign_option(const std::shared_ptr<option_impl> &_option);
-
- bool is_service_entry() const;
- bool is_eventgroup_entry() const;
-
- void set_type(entry_type_e _type);
-
- virtual bool serialize(vsomeip::serializer *_to) const;
- virtual bool deserialize(vsomeip::deserializer *_from);
-
- uint8_t get_num_options(uint8_t _run) const;
-
-protected:
- entry_type_e type_;
- service_t service_;
- instance_t instance_;
- major_version_t major_version_;
- ttl_t ttl_;
-
- std::vector<uint8_t> options_[VSOMEIP_MAX_OPTION_RUN];
-
- uint8_t num_options_[VSOMEIP_MAX_OPTION_RUN];
- std::uint8_t index1_;
- std::uint8_t index2_;
-
- entry_impl();
- entry_impl(const entry_impl &entry_);
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_ENTRY_IMPL_HPP
diff --git a/implementation/service_discovery/include/enumeration_types.hpp b/implementation/service_discovery/include/enumeration_types.hpp
deleted file mode 100644
index 59538e5..0000000
--- a/implementation/service_discovery/include/enumeration_types.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 2014-2017 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 <cstdint>
-
-#ifndef VSOMEIP_SD_ENUMERATION_TYPES_HPP
-#define VSOMEIP_SD_ENUMERATION_TYPES_HPP
-
-namespace vsomeip {
-namespace sd {
-
-enum class option_type_e
- : uint8_t {
- CONFIGURATION = 0x1,
- LOAD_BALANCING = 0x2,
- PROTECTION = 0x3,
- IP4_ENDPOINT = 0x4,
- IP6_ENDPOINT = 0x6,
- IP4_MULTICAST = 0x14,
- IP6_MULTICAST = 0x16,
- UNKNOWN = 0xFF
-};
-
-enum class entry_type_e
- : uint8_t {
- FIND_SERVICE = 0x00,
- OFFER_SERVICE = 0x01,
- STOP_OFFER_SERVICE = 0x01,
- REQUEST_SERVICE = 0x2,
- FIND_EVENT_GROUP = 0x4,
- PUBLISH_EVENTGROUP = 0x5,
- STOP_PUBLISH_EVENTGROUP = 0x5,
- SUBSCRIBE_EVENTGROUP = 0x06,
- STOP_SUBSCRIBE_EVENTGROUP = 0x06,
- SUBSCRIBE_EVENTGROUP_ACK = 0x07,
- STOP_SUBSCRIBE_EVENTGROUP_ACK = 0x07,
- UNKNOWN = 0xFF
-};
-
-enum class layer_four_protocol_e
- : uint8_t {
- TCP = 0x06,
- UDP = 0x11,
- UNKNOWN = 0xFF
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_ENUMERATION_TYPES_HPP
diff --git a/implementation/service_discovery/include/eventgroupentry_impl.hpp b/implementation/service_discovery/include/eventgroupentry_impl.hpp
deleted file mode 100755
index 3a5d897..0000000
--- a/implementation/service_discovery/include/eventgroupentry_impl.hpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_EVENTGROUPENTRY_IMPL_HPP
-#define VSOMEIP_SD_EVENTGROUPENTRY_IMPL_HPP
-
-#include "entry_impl.hpp"
-#include "../../endpoints/include/endpoint_definition.hpp"
-#include "message_impl.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-class eventgroupentry_impl: public entry_impl {
-public:
- eventgroupentry_impl();
- eventgroupentry_impl(const eventgroupentry_impl &_entry);
- virtual ~eventgroupentry_impl();
-
- eventgroup_t get_eventgroup() const;
- void set_eventgroup(eventgroup_t _eventgroup);
-
- uint16_t get_reserved() const;
- void set_reserved(uint16_t _reserved);
-
- uint8_t get_counter() const;
- void set_counter(uint8_t _counter);
-
- bool serialize(vsomeip::serializer *_to) const;
- bool deserialize(vsomeip::deserializer *_from);
-
- bool operator==(const eventgroupentry_impl& _other) const {
- return (ttl_ == _other.ttl_ &&
- service_ == _other.service_ &&
- instance_ == _other.instance_ &&
- eventgroup_ == _other.eventgroup_ &&
- index1_ == _other.index1_ &&
- index2_ == _other.index2_ &&
- num_options_[0] == _other.num_options_[0] &&
- num_options_[1] == _other.num_options_[1] &&
- major_version_ == _other.major_version_ &&
- counter_ == _other.counter_);
- }
-
- bool is_matching_subscribe(const eventgroupentry_impl& _other,
- const message_impl::options_t& _options) const;
-
- void add_target(const std::shared_ptr<endpoint_definition> &_target);
- std::shared_ptr<endpoint_definition> get_target(bool _reliable) const;
-
-private:
- eventgroup_t eventgroup_;
- uint16_t reserved_;
-
- // counter field to differentiate parallel subscriptions on same event group
- // 4Bit only (max 16. parralel subscriptions)
- uint8_t counter_;
-
- std::shared_ptr<endpoint_definition> target_reliable_;
- std::shared_ptr<endpoint_definition> target_unreliable_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_INTERNAL_SD_EVENTGROUPENTRY_IMPL_HPP
diff --git a/implementation/service_discovery/include/ip_option_impl.hpp b/implementation/service_discovery/include/ip_option_impl.hpp
deleted file mode 100644
index 1345835..0000000
--- a/implementation/service_discovery/include/ip_option_impl.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_IP_OPTION_IMPL_HPP
-#define VSOMEIP_SD_IP_OPTION_IMPL_HPP
-
-#include <vsomeip/primitive_types.hpp>
-
-#include "option_impl.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-class ip_option_impl: public option_impl {
-public:
- ip_option_impl();
- virtual ~ip_option_impl();
- virtual bool operator ==(const ip_option_impl &_option) const;
-
- uint16_t get_port() const;
- void set_port(uint16_t _port);
-
- layer_four_protocol_e get_layer_four_protocol() const;
- void set_layer_four_protocol(layer_four_protocol_e _protocol);
-
- virtual bool is_multicast() const = 0;
-
- virtual bool serialize(vsomeip::serializer *_to) const = 0;
- virtual bool deserialize(vsomeip::deserializer *_from) = 0;
-
-protected:
- layer_four_protocol_e protocol_;
- uint16_t port_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_IP_OPTION_IMPL_HPP
diff --git a/implementation/service_discovery/include/ipv4_option_impl.hpp b/implementation/service_discovery/include/ipv4_option_impl.hpp
deleted file mode 100644
index 8ede63d..0000000
--- a/implementation/service_discovery/include/ipv4_option_impl.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_IPV4_OPTION_IMPL_HPP
-#define VSOMEIP_SD_IPV4_OPTION_IMPL_HPP
-
-#include <vsomeip/primitive_types.hpp>
-
-#include "ip_option_impl.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-class ipv4_option_impl: public ip_option_impl {
-public:
- ipv4_option_impl(bool _is_multicast);
- virtual ~ipv4_option_impl();
- bool operator ==(const ipv4_option_impl &_other) const;
-
- const ipv4_address_t & get_address() const;
- void set_address(const ipv4_address_t &_address);
-
- bool is_multicast() const;
- bool serialize(vsomeip::serializer *_to) const;
- bool deserialize(vsomeip::deserializer *_from);
-
-private:
- ipv4_address_t address_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_IPV4_OPTION_IMPL_HPP
diff --git a/implementation/service_discovery/include/ipv6_option_impl.hpp b/implementation/service_discovery/include/ipv6_option_impl.hpp
deleted file mode 100644
index 92701c0..0000000
--- a/implementation/service_discovery/include/ipv6_option_impl.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_IPV6_OPTION_IMPL_HPP
-#define VSOMEIP_SD_IPV6_OPTION_IMPL_HPP
-
-#include <vsomeip/primitive_types.hpp>
-
-#include "ip_option_impl.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-class ipv6_option_impl: public ip_option_impl {
-public:
- ipv6_option_impl(bool _is_multicast);
- virtual ~ipv6_option_impl();
- bool operator ==(const ipv6_option_impl &_other) const;
-
- const ipv6_address_t & get_address() const;
- void set_address(const ipv6_address_t &_address);
-
- bool is_multicast() const;
- bool serialize(vsomeip::serializer *_to) const;
- bool deserialize(vsomeip::deserializer *_from);
-
-private:
- ipv6_address_t address_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_IPV6_OPTION_IMPL_HPP
diff --git a/implementation/service_discovery/include/load_balancing_option_impl.hpp b/implementation/service_discovery/include/load_balancing_option_impl.hpp
deleted file mode 100755
index 767c345..0000000
--- a/implementation/service_discovery/include/load_balancing_option_impl.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_LOAD_BALANCING_OPTION_IMPL_HPP
-#define VSOMEIP_SD_LOAD_BALANCING_OPTION_IMPL_HPP
-
-#include "primitive_types.hpp"
-#include "option_impl.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-class load_balancing_option_impl: public option_impl {
-public:
- load_balancing_option_impl();
- virtual ~load_balancing_option_impl();
- bool operator ==(const load_balancing_option_impl &_other) const;
-
- priority_t get_priority() const;
- void set_priority(priority_t _priority);
-
- weight_t get_weight() const;
- void set_weight(weight_t _weight);
-
- bool serialize(vsomeip::serializer *_to) const;
- bool deserialize(vsomeip::deserializer *_from);
-
-private:
- priority_t priority_;
- weight_t weight_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_LOAD_BALANCING_OPTION_IMPL_HPP
diff --git a/implementation/service_discovery/include/message_element_impl.hpp b/implementation/service_discovery/include/message_element_impl.hpp
deleted file mode 100755
index 835326a..0000000
--- a/implementation/service_discovery/include/message_element_impl.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_MESSAGE_ELEMENT_IMPL_HPP
-#define VSOMEIP_SD_MESSAGE_ELEMENT_IMPL_HPP
-
-namespace vsomeip {
-namespace sd {
-
-class message_impl;
-
-class message_element_impl {
-public:
- message_element_impl();
-
- message_impl * get_owning_message() const;
- void set_owning_message(message_impl *_owner);
-
-protected:
- message_impl *owner_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_MESSAGE_ELEMENT_IMPL_HPP
diff --git a/implementation/service_discovery/include/message_impl.hpp b/implementation/service_discovery/include/message_impl.hpp
deleted file mode 100755
index f679e9c..0000000
--- a/implementation/service_discovery/include/message_impl.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_MESSAGE_IMPL_HPP
-#define VSOMEIP_SD_MESSAGE_IMPL_HPP
-
-#include <memory>
-#include <vector>
-#include <atomic>
-#include <mutex>
-
-#include <vsomeip/message.hpp>
-
-#include "../include/primitive_types.hpp"
-#include "../../message/include/message_base_impl.hpp"
-#include "../../endpoints/include/endpoint_definition.hpp"
-
-# if _MSC_VER >= 1300
-/*
-* Diamond inheritance is used for the vsomeip::message_base base class.
-* The Microsoft compiler put warning (C4250) using a desired c++ feature: "Delegating to a sister class"
-* A powerful technique that arises from using virtual inheritance is to delegate a method from a class in another class
-* by using a common abstract base class. This is also called cross delegation.
-*/
-# pragma warning( disable : 4250 )
-# endif
-
-namespace vsomeip {
-namespace sd {
-
-class entry_impl;
-class eventgroupentry_impl;
-class serviceentry_impl;
-
-class option_impl;
-class configuration_option_impl;
-class ipv4_option_impl;
-class ipv6_option_impl;
-class load_balancing_option_impl;
-class protection_option_impl;
-
-class message_impl: public vsomeip::message, public vsomeip::message_base_impl {
-public:
- typedef std::vector<std::shared_ptr<entry_impl>> entries_t;
- typedef std::vector<std::shared_ptr<option_impl>> options_t;
- struct forced_initial_events_t {
- std::shared_ptr<vsomeip::endpoint_definition> target_;
- vsomeip::service_t service_;
- vsomeip::instance_t instance_;
- vsomeip::eventgroup_t eventgroup_;
- };
- message_impl();
- virtual ~message_impl();
-
- length_t get_length() const;
- void set_length(length_t _length);
-
- bool get_reboot_flag() const;
- void set_reboot_flag(bool _is_set);
-
- bool get_unicast_flag() const;
- void set_unicast_flag(bool _is_set);
-
- std::shared_ptr<eventgroupentry_impl> create_eventgroup_entry();
- std::shared_ptr<serviceentry_impl> create_service_entry();
-
- std::shared_ptr<configuration_option_impl> create_configuration_option();
- std::shared_ptr<ipv4_option_impl> create_ipv4_option(bool _is_multicast);
- std::shared_ptr<ipv6_option_impl> create_ipv6_option(bool _is_multicast);
- std::shared_ptr<load_balancing_option_impl> create_load_balancing_option();
- std::shared_ptr<protection_option_impl> create_protection_option();
-
- const entries_t & get_entries() const;
- const options_t & get_options() const;
-
- int16_t get_option_index(const std::shared_ptr<option_impl> &_option) const;
- uint32_t get_options_length();
-
- std::shared_ptr<payload> get_payload() const;
- void set_payload(std::shared_ptr<payload> _payload);
-
- bool serialize(vsomeip::serializer *_to) const;
- bool deserialize(vsomeip::deserializer *_from);
-
- length_t get_someip_length() const;
-
- std::uint8_t get_number_required_acks() const;
- std::uint8_t get_number_contained_acks() const;
- void set_number_required_acks(std::uint8_t _required_acks);
- void increase_number_required_acks(std::uint8_t _amount = 1);
- void decrease_number_required_acks(std::uint8_t _amount = 1);
- void increase_number_contained_acks();
- bool all_required_acks_contained() const;
- std::unique_lock<std::mutex> get_message_lock();
-
- void forced_initial_events_add(forced_initial_events_t _entry);
- const std::vector<forced_initial_events_t> forced_initial_events_get();
-
-private:
- entry_impl * deserialize_entry(vsomeip::deserializer *_from);
- option_impl * deserialize_option(vsomeip::deserializer *_from);
-
-private:
- flags_t flags_;
- uint32_t options_length_;
-
- entries_t entries_;
- options_t options_;
- std::atomic<std::uint8_t> number_required_acks_;
- std::atomic<std::uint8_t> number_contained_acks_;
- std::mutex message_mutex_;
-
- std::mutex forced_initial_events_mutex_;
- std::vector<forced_initial_events_t> forced_initial_events_info_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_INTERNAL_SD_MESSAGE_IMPL_HPP
diff --git a/implementation/service_discovery/include/option_impl.hpp b/implementation/service_discovery/include/option_impl.hpp
deleted file mode 100644
index c4426e9..0000000
--- a/implementation/service_discovery/include/option_impl.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_OPTION_IMPL_HPP
-#define VSOMEIP_SD_OPTION_IMPL_HPP
-
-#include <cstdint>
-
-#include "enumeration_types.hpp"
-#include "message_element_impl.hpp"
-
-namespace vsomeip {
-
-class serializer;
-class deserializer;
-
-namespace sd {
-
-class message_impl;
-
-class option_impl: public message_element_impl {
-public:
- option_impl();
- virtual ~option_impl();
-
- virtual bool operator ==(const option_impl &_other) const;
-
- uint16_t get_length() const;
- option_type_e get_type() const;
-
- virtual bool serialize(vsomeip::serializer *_to) const;
- virtual bool deserialize(vsomeip::deserializer *_from);
-
-protected:
- uint16_t length_;
- option_type_e type_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_INTERNAL_SD_OPTION_IMPL_HPP
diff --git a/implementation/service_discovery/include/primitive_types.hpp b/implementation/service_discovery/include/primitive_types.hpp
deleted file mode 100644
index f3a0c9f..0000000
--- a/implementation/service_discovery/include/primitive_types.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2014-2017 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 <cstdint>
-
-#ifndef VSOMEIP_SD_PRIMITIVE_TYPES_HPP
-#define VSOMEIP_SD_PRIMITIVE_TYPES_HPP
-
-namespace vsomeip {
-namespace sd {
-
-// Load balancing
-typedef uint16_t priority_t;
-typedef uint16_t weight_t;
-
-// Protection
-typedef uint32_t alive_counter_t;
-typedef uint32_t crc_t;
-
-//
-typedef uint8_t flags_t;
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_PRIMITIVE_TYPES_HPP
diff --git a/implementation/service_discovery/include/protection_option_impl.hpp b/implementation/service_discovery/include/protection_option_impl.hpp
deleted file mode 100755
index 33d5849..0000000
--- a/implementation/service_discovery/include/protection_option_impl.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_PROTECTION_OPTION_IMPL_HPP
-#define VSOMEIP_SD_PROTECTION_OPTION_IMPL_HPP
-
-#include "../include/primitive_types.hpp"
-#include "../include/option_impl.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-class protection_option_impl: public option_impl {
-public:
- protection_option_impl();
- virtual ~protection_option_impl();
- bool operator ==(const protection_option_impl &_other) const;
-
- alive_counter_t get_alive_counter() const;
- void set_alive_counter(alive_counter_t _counter);
-
- crc_t get_crc() const;
- void set_crc(crc_t _crc);
-
- bool serialize(vsomeip::serializer *_to) const;
- bool deserialize(vsomeip::deserializer *_from);
-
-private:
- alive_counter_t counter_;
- crc_t crc_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_PROTECTION_OPTION_IMPL_HPP
diff --git a/implementation/service_discovery/include/request.hpp b/implementation/service_discovery/include/request.hpp
deleted file mode 100644
index b835202..0000000
--- a/implementation/service_discovery/include/request.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_REQUEST_HPP
-#define VSOMEIP_SD_REQUEST_HPP
-
-#include <memory>
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-class endpoint;
-
-namespace sd {
-
-class request {
-public:
- request(major_version_t _major, minor_version_t _minor, ttl_t _ttl);
-
- major_version_t get_major() const;
- void set_major(major_version_t _major);
-
- minor_version_t get_minor() const;
- void set_minor(minor_version_t _minor);
-
- ttl_t get_ttl() const;
- void set_ttl(ttl_t _ttl);
-
- uint8_t get_sent_counter() const;
- void set_sent_counter(uint8_t _sent_counter);
-
-private:
- major_version_t major_;
- minor_version_t minor_;
- ttl_t ttl_;
-
- uint8_t sent_counter_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_SUBSCRIPTION_HPP
diff --git a/implementation/service_discovery/include/runtime.hpp b/implementation/service_discovery/include/runtime.hpp
deleted file mode 100644
index f99fec8..0000000
--- a/implementation/service_discovery/include/runtime.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_RUNTIME_HPP
-#define VSOMEIP_SD_RUNTIME_HPP
-
-#include <memory>
-
-namespace vsomeip {
-
-namespace sd {
-
-class message_impl;
-class service_discovery;
-class service_discovery_host;
-
-class runtime {
-public:
- virtual ~runtime() {
- }
-
- virtual std::shared_ptr<service_discovery> create_service_discovery(
- service_discovery_host *_host) const = 0;
- virtual std::shared_ptr<message_impl> create_message() const = 0;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_RUNTIME_HPP
-
diff --git a/implementation/service_discovery/include/runtime_impl.hpp b/implementation/service_discovery/include/runtime_impl.hpp
deleted file mode 100644
index dcdb7d7..0000000
--- a/implementation/service_discovery/include/runtime_impl.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_RUNTIME_IMPL_HPP
-#define VSOMEIP_SD_RUNTIME_IMPL_HPP
-
-#include <vsomeip/plugin.hpp>
-#include "runtime.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-class runtime_impl
- : public runtime,
- public plugin_impl<runtime_impl> {
-public:
- runtime_impl();
- virtual ~runtime_impl();
-
- std::shared_ptr<service_discovery> create_service_discovery(
- service_discovery_host *_host) const;
- std::shared_ptr<message_impl> create_message() const;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_RUNTIME_IMPL_HPP
diff --git a/implementation/service_discovery/include/service_discovery.hpp b/implementation/service_discovery/include/service_discovery.hpp
deleted file mode 100644
index caec99e..0000000
--- a/implementation/service_discovery/include/service_discovery.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (C) 2014-2017 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_SERVICE_DISCOVERY_HPP
-#define VSOMEIP_SERVICE_DISCOVERY_HPP
-
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ip/address.hpp>
-
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/enumeration_types.hpp>
-#include "../../routing/include/serviceinfo.hpp"
-#include "../../endpoints/include/endpoint.hpp"
-#include "../include/service_discovery_host.hpp"
-
-namespace vsomeip {
-
-class configuration;
-
-namespace sd {
-
-class service_discovery {
-public:
- virtual ~service_discovery() {
- }
-
- virtual std::shared_ptr<configuration> get_configuration() const = 0;
- virtual boost::asio::io_service & get_io() = 0;
-
- virtual void init() = 0;
- virtual void start() = 0;
- virtual void stop() = 0;
-
- virtual void request_service(service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor, ttl_t _ttl) = 0;
- virtual void release_service(service_t _service, instance_t _instance) = 0;
-
- virtual void subscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, major_version_t _major, ttl_t _ttl, client_t _client,
- subscription_type_e _subscription_type) = 0;
- virtual void unsubscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, client_t _client) = 0;
- virtual void unsubscribe_all(service_t _service, instance_t _instance) = 0;
- virtual void unsubscribe_client(service_t _service, instance_t _instance,
- client_t _client) = 0;
-
- virtual bool send(bool _is_announcing) = 0;
-
- virtual void on_message(const byte_t *_data, length_t _length,
- const boost::asio::ip::address &_sender,
- const boost::asio::ip::address &_destination) = 0;
-
- virtual void send_subscriptions(service_t _service, instance_t _instance,
- client_t _client, bool _reliable) = 0;
-
- virtual void on_endpoint_connected(
- service_t _service, instance_t _instance,
- const std::shared_ptr<const vsomeip::endpoint> &_endpoint) = 0;
-
- virtual void offer_service(service_t _service, instance_t _instance,
- std::shared_ptr<serviceinfo> _info) = 0;
- virtual void stop_offer_service(service_t _service, instance_t _instance,
- std::shared_ptr<serviceinfo> _info) = 0;
-
- virtual void set_diagnosis_mode(const bool _activate) = 0;
- virtual void remote_subscription_acknowledge(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- client_t _client, bool _accepted,
- const std::shared_ptr<sd_message_identifier_t> &_sd_message_id) = 0;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SERVICE_DISCOVERY_HPP
diff --git a/implementation/service_discovery/include/service_discovery_host.hpp b/implementation/service_discovery/include/service_discovery_host.hpp
deleted file mode 100644
index f9e8f29..0000000
--- a/implementation/service_discovery/include/service_discovery_host.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (C) 2014-2017 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_SERVICE_DISCOVERY_HOST_HPP
-#define VSOMEIP_SERVICE_DISCOVERY_HOST_HPP
-
-#include <map>
-#include <memory>
-#include <chrono>
-
-#include <boost/asio/ip/address.hpp>
-#include <boost/asio/io_service.hpp>
-
-#include "../../routing/include/types.hpp"
-
-#include <vsomeip/message.hpp>
-
-namespace vsomeip {
-
-class configuration;
-class endpoint;
-class endpoint_definition;
-
-namespace sd {
-
-class service_discovery_host {
-public:
- virtual ~service_discovery_host() {
- }
-
- virtual boost::asio::io_service & get_io() = 0;
- virtual const std::shared_ptr<configuration> get_configuration() const = 0;
-
- virtual std::shared_ptr<endpoint> create_service_discovery_endpoint(
- const std::string &_address, uint16_t _port, bool _reliable) = 0;
-
- virtual services_t get_offered_services() const = 0;
- virtual std::shared_ptr<eventgroupinfo> find_eventgroup(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) const = 0;
-
- virtual bool send(client_t _client, std::shared_ptr<message> _message,
- bool _flush) = 0;
-
- virtual bool send_to(const std::shared_ptr<endpoint_definition> &_target,
- const byte_t *_data, uint32_t _size, uint16_t _sd_port) = 0;
-
- virtual void add_routing_info(service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor, ttl_t _ttl,
- const boost::asio::ip::address &_reliable_address,
- uint16_t _reliable_port,
- const boost::asio::ip::address &_unreliable_address,
- uint16_t _unreliable_port) = 0;
-
- virtual void del_routing_info(service_t _service, instance_t _instance,
- bool _has_reliable, bool _has_unreliable) = 0;
-
- virtual void update_routing_info(std::chrono::milliseconds _elapsed) = 0;
-
- virtual void on_unsubscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup,
- std::shared_ptr<endpoint_definition> _target) = 0;
-
- virtual void on_subscribe_ack(service_t _service, instance_t _instance,
- const boost::asio::ip::address &_address, uint16_t _port) = 0;
-
- virtual void on_subscribe_ack(client_t _client,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, pending_subscription_id_t _subscription_id) = 0;
-
- virtual std::shared_ptr<endpoint> find_or_create_remote_client(
- service_t _service, instance_t _instance,
- bool _reliable, client_t _client) = 0;
-
- virtual void expire_subscriptions(const boost::asio::ip::address &_address) = 0;
- virtual void expire_services(const boost::asio::ip::address &_address) = 0;
-
- virtual void on_remote_subscription(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- const std::shared_ptr<endpoint_definition> &_subscriber,
- const std::shared_ptr<endpoint_definition> &_target, ttl_t _ttl,
- const std::shared_ptr<sd_message_identifier_t> &_sd_message_id,
- const std::function<void(remote_subscription_state_e, client_t)>& _callback) = 0;
-
- virtual void on_subscribe_nack(client_t _client,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- event_t _event, pending_subscription_id_t _subscription_id) = 0;
-
- virtual bool has_identified(client_t _client, service_t _service,
- instance_t _instance, bool _reliable) = 0;
-
- virtual std::chrono::steady_clock::time_point expire_subscriptions() = 0;
-
- virtual std::shared_ptr<serviceinfo> get_offered_service(
- service_t _service, instance_t _instance) const = 0;
- virtual std::map<instance_t, std::shared_ptr<serviceinfo>> get_offered_service_instances(
- service_t _service) const = 0;
-
- virtual void send_initial_events(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup,
- const std::shared_ptr<endpoint_definition>& _subscriber) = 0;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SERVICE_DISCOVERY_HOST_HPP
diff --git a/implementation/service_discovery/include/service_discovery_impl.hpp b/implementation/service_discovery/include/service_discovery_impl.hpp
deleted file mode 100644
index 3cf3396..0000000
--- a/implementation/service_discovery/include/service_discovery_impl.hpp
+++ /dev/null
@@ -1,442 +0,0 @@
-// Copyright (C) 2014-2017 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_SERVICE_DISCOVERY_IMPL
-#define VSOMEIP_SERVICE_DISCOVERY_IMPL
-
-#include <map>
-#include <memory>
-#include <mutex>
-#include <set>
-#include <forward_list>
-#include <atomic>
-#include <tuple>
-
-#include <boost/asio/steady_timer.hpp>
-
-#include "service_discovery.hpp"
-#include "../../endpoints/include/endpoint_definition.hpp"
-#include "../../routing/include/types.hpp"
-#include "ip_option_impl.hpp"
-#include "ipv4_option_impl.hpp"
-#include "ipv6_option_impl.hpp"
-#include "deserializer.hpp"
-#include "../../configuration/include/configuration.hpp"
-
-namespace vsomeip {
-
-class endpoint;
-class serializer;
-
-namespace sd {
-
-class entry_impl;
-class eventgroupentry_impl;
-class option_impl;
-class request;
-class serviceentry_impl;
-class service_discovery_host;
-class subscription;
-
-typedef std::map<service_t, std::map<instance_t, std::shared_ptr<request> > > requests_t;
-
-struct subscriber_t {
- std::shared_ptr<endpoint_definition> subscriber;
- std::shared_ptr<endpoint_definition> target;
- std::shared_ptr<sd_message_identifier_t> response_message_id_;
- std::shared_ptr<eventgroupinfo> eventgroupinfo_;
- vsomeip::ttl_t ttl_;
- vsomeip::major_version_t major_;
- std::uint16_t reserved_;
- std::uint8_t counter_;
-};
-
-class service_discovery_impl: public service_discovery,
- public std::enable_shared_from_this<service_discovery_impl> {
-public:
- service_discovery_impl(service_discovery_host *_host);
- virtual ~service_discovery_impl();
-
- std::shared_ptr<configuration> get_configuration() const;
- boost::asio::io_service & get_io();
-
- void init();
- void start();
- void stop();
-
- void request_service(service_t _service, instance_t _instance,
- major_version_t _major, minor_version_t _minor, ttl_t _ttl);
- void release_service(service_t _service, instance_t _instance);
-
- void subscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, major_version_t _major, ttl_t _ttl, client_t _client,
- subscription_type_e _subscription_type);
- void unsubscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, client_t _client);
- void unsubscribe_all(service_t _service, instance_t _instance);
- void unsubscribe_client(service_t _service, instance_t _instance,
- client_t _client);
-
- bool send(bool _is_announcing);
-
- void on_message(const byte_t *_data, length_t _length,
- const boost::asio::ip::address &_sender,
- const boost::asio::ip::address &_destination);
-
- void on_endpoint_connected(
- service_t _service, instance_t _instance,
- const std::shared_ptr<const vsomeip::endpoint> &_endpoint);
-
- void offer_service(service_t _service, instance_t _instance,
- std::shared_ptr<serviceinfo> _info);
- void stop_offer_service(service_t _service, instance_t _instance,
- std::shared_ptr<serviceinfo> _info);
-
- void set_diagnosis_mode(const bool _activate);
-
- void remote_subscription_acknowledge(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- client_t _client, bool _acknowledged,
- const std::shared_ptr<sd_message_identifier_t> &_sd_message_id);
-private:
- std::pair<session_t, bool> get_session(const boost::asio::ip::address &_address);
- void increment_session(const boost::asio::ip::address &_address);
-
- bool is_reboot(const boost::asio::ip::address &_sender,
- const boost::asio::ip::address &_destination,
- bool _reboot_flag, session_t _session);
-
- void insert_option(std::shared_ptr<message_impl> &_message,
- std::shared_ptr<entry_impl> _entry,
- const boost::asio::ip::address &_address, uint16_t _port,
- bool _is_reliable);
- void insert_find_entries(std::shared_ptr<message_impl> &_message,
- const requests_t &_requests, uint32_t _start,
- uint32_t &_size, bool &_done);
- void insert_offer_entries(std::shared_ptr<message_impl> &_message,
- const services_t &_services, uint32_t &_start,
- uint32_t _size, bool &_done, bool _ignore_phase);
- bool insert_offer_service(std::shared_ptr<message_impl> _message,
- service_t _service, instance_t _instance,
- const std::shared_ptr<const serviceinfo> &_info,
- uint32_t &_size);
- enum remote_offer_type_e : std::uint8_t {
- RELIABLE_UNRELIABLE,
- RELIABLE,
- UNRELIABLE,
- UNKNOWN = 0xff
- };
- bool insert_subscription(std::shared_ptr<message_impl> &_message,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- std::shared_ptr<subscription> &_subscription,
- remote_offer_type_e _offer_type);
- bool insert_nack_subscription_on_resubscribe(std::shared_ptr<message_impl> &_message,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- std::shared_ptr<subscription> &_subscription,
- remote_offer_type_e _offer_type);
- void insert_subscription_ack(std::shared_ptr<message_impl> &_message,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- const std::shared_ptr<eventgroupinfo> &_info, ttl_t _ttl,
- uint8_t _counter, major_version_t _major, uint16_t _reserved,
- const std::shared_ptr<endpoint_definition> &_target = nullptr);
- void insert_subscription_nack(std::shared_ptr<message_impl> &_message, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- uint8_t _counter, major_version_t _major, uint16_t _reserved);
-
- void process_serviceentry(std::shared_ptr<serviceentry_impl> &_entry,
- const std::vector<std::shared_ptr<option_impl> > &_options,
- bool _unicast_flag, std::vector<std::pair<std::uint16_t, std::shared_ptr<message_impl>>>* _resubscribes);
- void process_offerservice_serviceentry(
- service_t _service, instance_t _instance, major_version_t _major,
- minor_version_t _minor, ttl_t _ttl,
- const boost::asio::ip::address &_reliable_address,
- uint16_t _reliable_port,
- const boost::asio::ip::address &_unreliable_address,
- uint16_t _unreliable_port, std::vector<std::pair<std::uint16_t, std::shared_ptr<message_impl>>>* _resubscribes);
- void send_offer_service(
- const std::shared_ptr<const serviceinfo> &_info, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor,
- bool _unicast_flag);
-
- void process_findservice_serviceentry(service_t _service,
- instance_t _instance,
- major_version_t _major,
- minor_version_t _minor,
- bool _unicast_flag);
- void process_eventgroupentry(
- std::shared_ptr<eventgroupentry_impl> &_entry,
- const std::vector<std::shared_ptr<option_impl> > &_options,
- std::shared_ptr < message_impl > &its_message_response,
- const boost::asio::ip::address &_destination,
- const std::shared_ptr<sd_message_identifier_t> &_message_id,
- bool _is_stop_subscribe_subscribe,
- bool _force_initial_events);
- void handle_eventgroup_subscription(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major, ttl_t _ttl, uint8_t _counter, uint16_t _reserved,
- const boost::asio::ip::address &_first_address, uint16_t _first_port,
- bool _is_first_reliable,
- const boost::asio::ip::address &_second_address, uint16_t _second_port,
- bool _is_second_reliable,
- std::shared_ptr < message_impl > &its_message,
- const std::shared_ptr<sd_message_identifier_t> &_message_id,
- bool _is_stop_subscribe_subscribe,
- bool _force_initial_events);
- void handle_eventgroup_subscription_ack(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major, ttl_t _ttl, uint8_t _counter,
- const boost::asio::ip::address &_address, uint16_t _port);
- void handle_eventgroup_subscription_nack(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, uint8_t _counter);
- void serialize_and_send(std::shared_ptr<message_impl> _message,
- const boost::asio::ip::address &_address);
-
- bool is_tcp_connected(service_t _service,
- instance_t _instance,
- std::shared_ptr<vsomeip::endpoint_definition> its_endpoint);
-
- void start_ttl_timer();
- void stop_ttl_timer();
-
- void check_ttl(const boost::system::error_code &_error);
-
- void start_subscription_expiration_timer();
- void start_subscription_expiration_timer_unlocked();
- void stop_subscription_expiration_timer();
- void stop_subscription_expiration_timer_unlocked();
- void expire_subscriptions(const boost::system::error_code &_error);
-
- bool check_ipv4_address(boost::asio::ip::address its_address);
-
- bool check_static_header_fields(
- const std::shared_ptr<const message> &_message) const;
- bool check_layer_four_protocol(
- const std::shared_ptr<const ip_option_impl> _ip_option) const;
- void get_subscription_endpoints(std::shared_ptr<endpoint>& _unreliable,
- std::shared_ptr<endpoint>& _reliable,
- boost::asio::ip::address* _address,
- bool* _has_address,
- service_t _service, instance_t _instance,
- client_t _client) const;
-
- void send_subscriptions(service_t _service, instance_t _instance, client_t _client, bool _reliable);
-
- template<class Option, typename AddressType>
- std::shared_ptr<option_impl> find_existing_option(
- std::shared_ptr<message_impl> &_message,
- AddressType _address, uint16_t _port,
- layer_four_protocol_e _protocol,
- option_type_e _option_type);
- template<class Option, typename AddressType>
- bool check_message_for_ip_option_and_assign_existing(
- std::shared_ptr<message_impl> &_message,
- std::shared_ptr<entry_impl> _entry, AddressType _address,
- uint16_t _port, layer_four_protocol_e _protocol,
- option_type_e _option_type);
- template<class Option, typename AddressType>
- void assign_ip_option_to_entry(std::shared_ptr<Option> _option,
- AddressType _address, uint16_t _port,
- layer_four_protocol_e _protocol,
- std::shared_ptr<entry_impl> _entry);
-
- std::shared_ptr<request> find_request(service_t _service, instance_t _instance);
-
- void start_offer_debounce_timer(bool _first_start);
- void on_offer_debounce_timer_expired(const boost::system::error_code &_error);
-
-
- void start_find_debounce_timer(bool _first_start);
- void on_find_debounce_timer_expired(const boost::system::error_code &_error);
-
-
- void on_repetition_phase_timer_expired(
- const boost::system::error_code &_error,
- std::shared_ptr<boost::asio::steady_timer> _timer,
- std::uint8_t _repetition, std::uint32_t _last_delay);
- void on_find_repetition_phase_timer_expired(
- const boost::system::error_code &_error,
- std::shared_ptr<boost::asio::steady_timer> _timer,
- std::uint8_t _repetition, std::uint32_t _last_delay);
- void move_offers_into_main_phase(
- const std::shared_ptr<boost::asio::steady_timer> &_timer);
-
- void fill_message_with_offer_entries(
- std::shared_ptr<runtime> _runtime,
- std::shared_ptr<message_impl> _message,
- std::vector<std::shared_ptr<message_impl>> &_messages,
- const services_t &_offers, bool _ignore_phase);
-
- void fill_message_with_find_entries(
- std::shared_ptr<runtime> _runtime,
- std::shared_ptr<message_impl> _message,
- std::vector<std::shared_ptr<message_impl>> &_messages,
- const requests_t &_requests);
-
- bool serialize_and_send_messages(
- const std::vector<std::shared_ptr<message_impl>> &_messages);
-
- bool send_stop_offer(service_t _service, instance_t _instance,
- std::shared_ptr<serviceinfo> _info);
-
- void start_main_phase_timer();
- void on_main_phase_timer_expired(const boost::system::error_code &_error);
-
-
- void send_uni_or_multicast_offerservice(
- service_t _service, instance_t _instance, major_version_t _major,
- minor_version_t _minor,
- const std::shared_ptr<const serviceinfo> &_info,
- bool _unicast_flag);
- bool last_offer_shorter_half_offer_delay_ago();
- void send_unicast_offer_service(
- const std::shared_ptr<const serviceinfo> &_info, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor);
- void send_multicast_offer_service(
- const std::shared_ptr<const serviceinfo>& _info, service_t _service,
- instance_t _instance, major_version_t _major,
- minor_version_t _minor);
-
- bool check_source_address(const boost::asio::ip::address &its_source_address) const;
-
- void update_subscription_expiration_timer(const std::shared_ptr<message_impl> &_message);
-
- void remote_subscription_acknowledge_subscriber(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- const std::shared_ptr<subscriber_t> &_subscriber, bool _acknowledged);
-
- void remote_subscription_not_acknowledge_subscriber(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- const std::shared_ptr<subscriber_t> &_subscriber, bool _acknowledged);
-
- void remote_subscription_not_acknowledge_all(service_t _service, instance_t _instance);
-
- void remote_subscription_not_acknowledge_all();
-
- bool check_stop_subscribe_subscribe(message_impl::entries_t::const_iterator _iter,
- message_impl::entries_t::const_iterator _end,
- const message_impl::options_t& _options) const;
-
- configuration::ttl_factor_t get_ttl_factor(
- service_t _service, instance_t _instance,
- const configuration::ttl_map_t& _ttl_map) const;
- void on_last_msg_received_timer_expired(const boost::system::error_code &_error);
- void stop_last_msg_received_timer();
-
-
- remote_offer_type_e get_remote_offer_type(service_t _service, instance_t _instance);
- bool update_remote_offer_type(service_t _service, instance_t _instance,
- remote_offer_type_e _offer_type,
- const boost::asio::ip::address &_reliable_address,
- const boost::asio::ip::address &_unreliable_address);
- void remove_remote_offer_type(service_t _service, instance_t _instance,
- const boost::asio::ip::address &_address);
- void remove_remote_offer_type_by_ip(const boost::asio::ip::address &_address);
-
-private:
- boost::asio::io_service &io_;
- service_discovery_host *host_;
-
- boost::asio::ip::address unicast_;
- uint16_t port_;
- bool reliable_;
- std::shared_ptr<endpoint> endpoint_;
-
- std::shared_ptr<serializer> serializer_;
- std::shared_ptr<deserializer> deserializer_;
-
- requests_t requested_;
- std::mutex requested_mutex_;
- std::map<service_t,
- std::map<instance_t,
- std::map<eventgroup_t,
- std::map<client_t,
- std::shared_ptr<subscription> > > > > subscribed_;
- std::mutex subscribed_mutex_;
-
- std::mutex serialize_mutex_;
-
- // Sessions
- std::map<boost::asio::ip::address, std::pair<session_t, bool> > sessions_sent_;
- std::map<boost::asio::ip::address,
- std::tuple<session_t, session_t, bool, bool> > sessions_received_;
-
- // Runtime
- std::weak_ptr<runtime> runtime_;
-
- // TTL handling for services offered by other hosts
- std::mutex ttl_timer_mutex_;
- boost::asio::steady_timer ttl_timer_;
- std::chrono::milliseconds ttl_timer_runtime_;
- ttl_t ttl_;
-
- // TTL handling for subscriptions done by other hosts
- std::mutex subscription_expiration_timer_mutex_;
- boost::asio::steady_timer subscription_expiration_timer_;
- std::chrono::steady_clock::time_point next_subscription_expiration_;
-
- uint32_t max_message_size_;
-
- std::chrono::milliseconds initial_delay_;
- std::chrono::milliseconds offer_debounce_time_;
- std::chrono::milliseconds repetitions_base_delay_;
- std::uint8_t repetitions_max_;
- std::chrono::milliseconds cyclic_offer_delay_;
- std::mutex offer_debounce_timer_mutex_;
- boost::asio::steady_timer offer_debounce_timer_;
- // this map is used to collect offers while for offer debouncing
- std::mutex collected_offers_mutex_;
- services_t collected_offers_;
-
- std::chrono::milliseconds find_debounce_time_;
- std::mutex find_debounce_timer_mutex_;
- boost::asio::steady_timer find_debounce_timer_;
- requests_t collected_finds_;
-
- // this map contains the offers and their timers currently in repetition phase
- std::mutex repetition_phase_timers_mutex_;
- std::map<std::shared_ptr<boost::asio::steady_timer>,
- services_t> repetition_phase_timers_;
-
- // this map contains the finds and their timers currently in repetition phase
- std::mutex find_repetition_phase_timers_mutex_;
- std::map<std::shared_ptr<boost::asio::steady_timer>,
- requests_t> find_repetition_phase_timers_;
-
- std::mutex main_phase_timer_mutex_;
- boost::asio::steady_timer main_phase_timer_;
-
- std::atomic<bool> is_suspended_;
-
- std::string sd_multicast_;
- boost::asio::ip::address sd_multicast_address_;
-
- boost::asio::ip::address current_remote_address_;
-
- std::atomic<bool> is_diagnosis_;
-
- std::mutex pending_remote_subscriptions_mutex_;
- std::map<service_t,
- std::map<instance_t,
- std::map<eventgroup_t,
- std::map<client_t, std::vector<std::shared_ptr<subscriber_t>>>>>> pending_remote_subscriptions_;
- std::mutex response_mutex_;
-
- configuration::ttl_map_t ttl_factor_offers_;
- configuration::ttl_map_t ttl_factor_subscriptions_;
-
- std::mutex last_msg_received_timer_mutex_;
- boost::asio::steady_timer last_msg_received_timer_;
- std::chrono::milliseconds last_msg_received_timer_timeout_;
-
- std::mutex remote_offer_types_mutex_;
- std::map<std::pair<service_t, instance_t>, remote_offer_type_e> remote_offer_types_;
- std::map<boost::asio::ip::address, std::set<std::pair<service_t, instance_t>>> remote_offers_by_ip_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SERVICE_DISCOVERY_IMPL
diff --git a/implementation/service_discovery/include/serviceentry_impl.hpp b/implementation/service_discovery/include/serviceentry_impl.hpp
deleted file mode 100644
index c8ad7d0..0000000
--- a/implementation/service_discovery/include/serviceentry_impl.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_SERVICEENTRY_IMPL_HPP
-#define VSOMEIP_SD_SERVICEENTRY_IMPL_HPP
-
-#include "entry_impl.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-class serviceentry_impl: public entry_impl {
-public:
- serviceentry_impl();
- virtual ~serviceentry_impl();
-
- minor_version_t get_minor_version() const;
- void set_minor_version(minor_version_t _version);
-
- bool serialize(vsomeip::serializer *_to) const;
- bool deserialize(vsomeip::deserializer *_from);
-
-private:
- minor_version_t minor_version_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_SERVICEENTRY_IMPL_HPP
diff --git a/implementation/service_discovery/include/subscription.hpp b/implementation/service_discovery/include/subscription.hpp
deleted file mode 100644
index 3c3bfe8..0000000
--- a/implementation/service_discovery/include/subscription.hpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2014-2017 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_SD_SUBSCRIPTION_HPP
-#define VSOMEIP_SD_SUBSCRIPTION_HPP
-
-#include <memory>
-
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/enumeration_types.hpp>
-
-namespace vsomeip {
-
-class endpoint;
-
-namespace sd {
-
-class subscription {
-public:
- subscription(major_version_t _major, ttl_t _ttl,
- std::shared_ptr<endpoint> _reliable,
- std::shared_ptr<endpoint> _unreliable,
- subscription_type_e _subscription_type,
- uint8_t _counter);
- ~subscription();
-
- major_version_t get_major() const;
- ttl_t get_ttl() const;
- void set_ttl(ttl_t _ttl);
- std::shared_ptr<endpoint> get_endpoint(bool _reliable) const;
- void set_endpoint(std::shared_ptr<endpoint> _endpoint, bool _reliable);
-
- bool is_acknowledged() const;
- void set_acknowledged(bool _is_acknowledged);
-
- bool is_tcp_connection_established() const;
- void set_tcp_connection_established(bool _is_established);
-
- bool is_udp_connection_established() const;
- void set_udp_connection_established(bool _is_established);
-
- subscription_type_e get_subscription_type() const;
-
- uint8_t get_counter() const;
-
-private:
- major_version_t major_;
- ttl_t ttl_;
-
- std::shared_ptr<endpoint> reliable_;
- std::shared_ptr<endpoint> unreliable_;
-
- bool is_acknowledged_;
- bool tcp_connection_established_;
- bool udp_connection_established_;
-
- subscription_type_e subscription_type_;
-
- uint8_t counter_;
-};
-
-} // namespace sd
-} // namespace vsomeip
-
-#endif // VSOMEIP_SD_SUBSCRIPTION_HPP
diff --git a/implementation/service_discovery/src/configuration_option_impl.cpp b/implementation/service_discovery/src/configuration_option_impl.cpp
deleted file mode 100755
index e9cf058..0000000
--- a/implementation/service_discovery/src/configuration_option_impl.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (C) 2014-2017 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 <cstring>
-
-#include "../include/configuration_option_impl.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-configuration_option_impl::configuration_option_impl() {
- length_ = 2; // always contains "Reserved" and the trailing '\0'
- type_ = option_type_e::CONFIGURATION;
-}
-
-configuration_option_impl::~configuration_option_impl() {
-}
-
-bool configuration_option_impl::operator ==(
- const configuration_option_impl &_other) const {
- return (option_impl::operator ==(_other)
- && configuration_ == _other.configuration_);
-}
-
-void configuration_option_impl::add_item(const std::string &_key,
- const std::string &_value) {
- configuration_[_key] = _value;
- length_ = uint16_t(length_ + _key.length() + _value.length() + 2u); // +2 for the '=' and length
-}
-
-void configuration_option_impl::remove_item(const std::string &_key) {
- auto it = configuration_.find(_key);
- if (it != configuration_.end()) {
- length_ = uint16_t(length_ - (it->first.length() + it->second.length() + 2u));
- configuration_.erase(it);
- }
-}
-
-std::vector<std::string> configuration_option_impl::get_keys() const {
- std::vector < std::string > l_keys;
- for (auto elem : configuration_)
- l_keys.push_back(elem.first);
- return l_keys;
-}
-
-std::vector<std::string> configuration_option_impl::get_values() const {
- std::vector < std::string > l_values;
- for (auto elem : configuration_)
- l_values.push_back(elem.second);
- return l_values;
-}
-
-std::string configuration_option_impl::get_value(
- const std::string &_key) const {
- std::string l_value("");
- auto l_elem = configuration_.find(_key);
- if (l_elem != configuration_.end())
- l_value = l_elem->second;
- return l_value;
-}
-
-bool configuration_option_impl::serialize(vsomeip::serializer *_to) const {
- bool is_successful;
- std::string configuration_string;
-
- for (auto i = configuration_.begin(); i != configuration_.end(); ++i) {
- char l_length = char(1 + i->first.length() + i->second.length());
- configuration_string.push_back(l_length);
- configuration_string.append(i->first);
- configuration_string.push_back('=');
- configuration_string.append(i->second);
- }
- configuration_string.push_back('\0');
-
- is_successful = option_impl::serialize(_to);
- if (is_successful) {
- is_successful = _to->serialize(
- reinterpret_cast<const uint8_t*>(configuration_string.c_str()),
- uint32_t(configuration_string.length()));
- }
-
- return is_successful;
-}
-
-bool configuration_option_impl::deserialize(vsomeip::deserializer *_from) {
- bool is_successful = option_impl::deserialize(_from);
- uint8_t l_itemLength = 0;
- std::string l_item(256, 0), l_key, l_value;
-
- do {
- l_itemLength = 0;
- l_key.clear();
- l_value.clear();
- l_item.assign(256, '\0');
-
- is_successful = is_successful && _from->deserialize(l_itemLength);
- if (l_itemLength > 0) {
- is_successful = is_successful
- && _from->deserialize((uint8_t*) &l_item[0], l_itemLength);
-
- if (is_successful) {
- size_t l_eqPos = l_item.find('='); //SWS_SD_00292
- l_key = l_item.substr(0, l_eqPos);
-
- //if no "=" is found, no value is present for key (SWS_SD_00466)
- if( l_eqPos != std::string::npos )
- l_value = l_item.substr(l_eqPos + 1);
- if (configuration_.end() == configuration_.find(l_key)) {
- configuration_[l_key] = l_value;
- } else {
- // TODO: log reason for failing deserialization
- is_successful = false;
- }
- }
- }
- } while (is_successful && _from->get_remaining() > 0);
-
- return is_successful;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/deserializer.cpp b/implementation/service_discovery/src/deserializer.cpp
deleted file mode 100644
index a8c0a46..0000000
--- a/implementation/service_discovery/src/deserializer.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2014-2017 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/deserializer.hpp"
-#include "../include/message_impl.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-deserializer::deserializer(std::uint32_t _shrink_buffer_threshold)
- : vsomeip::deserializer(_shrink_buffer_threshold) {
-}
-
-deserializer::deserializer(uint8_t *_data, std::size_t _length,
- std::uint32_t _shrink_buffer_threshold)
- : vsomeip::deserializer(_data, _length, _shrink_buffer_threshold) {
-}
-
-deserializer::deserializer(const deserializer &_other)
- : vsomeip::deserializer(_other) {
-}
-
-deserializer::~deserializer() {
-}
-
-message_impl * deserializer::deserialize_sd_message() {
- message_impl* deserialized_message = new message_impl;
- if (0 != deserialized_message) {
- if (false == deserialized_message->deserialize(this)) {
- delete deserialized_message;
- deserialized_message = 0;
- }
- }
-
- return deserialized_message;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/entry_impl.cpp b/implementation/service_discovery/src/entry_impl.cpp
deleted file mode 100755
index ecab203..0000000
--- a/implementation/service_discovery/src/entry_impl.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-// Copyright (C) 2014-2017 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 <algorithm>
-
-#include "../include/entry_impl.hpp"
-#include "../include/message_impl.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-#include "../../logging/include/logger.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-// TODO: throw exception if this constructor is used
-entry_impl::entry_impl() {
- type_ = entry_type_e::UNKNOWN;
- major_version_ = 0;
- service_ = 0x0;
- instance_ = 0x0;
- ttl_ = 0x0;
- num_options_[0] = 0;
- num_options_[1] = 0;
- index1_ = 0;
- index2_ = 0;
-}
-
-entry_impl::entry_impl(const entry_impl &_entry) {
- type_ = _entry.type_;
- major_version_ = _entry.major_version_;
- service_ = _entry.service_;
- instance_ = _entry.instance_;
- ttl_ = _entry.ttl_;
- num_options_[0] = _entry.num_options_[0];
- num_options_[1] = _entry.num_options_[1];
- index1_ = _entry.index1_;
- index2_ = _entry.index2_;
-}
-
-entry_impl::~entry_impl() {
-}
-
-entry_type_e entry_impl::get_type() const {
- return type_;
-}
-
-void entry_impl::set_type(entry_type_e _type) {
- type_ = _type;
-}
-
-service_t entry_impl::get_service() const {
- return service_;
-}
-
-void entry_impl::set_service(service_t _service) {
- service_ = _service;
-}
-
-instance_t entry_impl::get_instance() const {
- return instance_;
-}
-
-void entry_impl::set_instance(instance_t _instance) {
- instance_ = _instance;
-}
-
-major_version_t entry_impl::get_major_version() const {
- return major_version_;
-}
-
-void entry_impl::set_major_version(major_version_t _major_version) {
- major_version_ = _major_version;
-}
-
-ttl_t entry_impl::get_ttl() const {
- return ttl_;
-}
-
-void entry_impl::set_ttl(ttl_t _ttl) {
- ttl_ = _ttl;
-}
-
-const std::vector<uint8_t> & entry_impl::get_options(uint8_t _run) const {
- static std::vector<uint8_t> invalid_options;
- if (_run > 0 && _run <= VSOMEIP_MAX_OPTION_RUN)
- return options_[_run - 1];
-
- return invalid_options;
-}
-
-void entry_impl::assign_option(const std::shared_ptr<option_impl> &_option) {
- uint8_t option_index = uint8_t(get_owning_message()->get_option_index(_option));
- if (options_[0].empty() ||
- options_[0][0] == option_index + 1 ||
- options_[0][options_[0].size() - 1] + 1 == option_index) {
- options_[0].push_back(option_index);
- std::sort(options_[0].begin(), options_[0].end());
- num_options_[0]++;
- } else if (options_[1].empty() ||
- options_[1][0] == option_index + 1 ||
- options_[1][options_[1].size() - 1] + 1 == option_index) {
- options_[1].push_back(option_index);
- std::sort(options_[1].begin(), options_[1].end());
- num_options_[1]++;
- } else {
- VSOMEIP_WARNING << "Option is not referenced by entries array, maximum number of endpoint options reached!";
- }
-}
-
-bool entry_impl::serialize(vsomeip::serializer *_to) const {
- bool is_successful = (0 != _to
- && _to->serialize(static_cast<uint8_t>(type_)));
-
- uint8_t index_first_option_run = 0;
- if (options_[0].size() > 0)
- index_first_option_run = options_[0][0];
- is_successful = is_successful && _to->serialize(index_first_option_run);
-
- uint8_t index_second_option_run = 0;
- if (options_[1].size() > 0)
- index_second_option_run = options_[1][0];
- is_successful = is_successful && _to->serialize(index_second_option_run);
-
- uint8_t number_of_options = uint8_t((((uint8_t) options_[0].size()) << 4)
- | (((uint8_t) options_[1].size()) & 0x0F));
- is_successful = is_successful && _to->serialize(number_of_options);
-
- is_successful = is_successful
- && _to->serialize(static_cast<uint16_t>(service_));
-
- is_successful = is_successful
- && _to->serialize(static_cast<uint16_t>(instance_));
-
- return is_successful;
-}
-
-bool entry_impl::deserialize(vsomeip::deserializer *_from) {
- bool is_successful = (0 != _from);
-
- uint8_t its_type(0);
- is_successful = is_successful && _from->deserialize(its_type);
- type_ = static_cast<entry_type_e>(its_type);
-
- is_successful = is_successful && _from->deserialize(index1_);
-
- is_successful = is_successful && _from->deserialize(index2_);
-
- uint8_t its_numbers(0);
- is_successful = is_successful && _from->deserialize(its_numbers);
-
- num_options_[0] = uint8_t(its_numbers >> 4);
- num_options_[1] = uint8_t(its_numbers & 0xF);
-
- for (uint16_t i = index1_; i < index1_ + num_options_[0]; ++i)
- options_[0].push_back((uint8_t)(i));
-
- for (uint16_t i = index2_; i < index2_ + num_options_[1]; ++i)
- options_[1].push_back((uint8_t)(i));
-
- uint16_t its_id(0);
- is_successful = is_successful && _from->deserialize(its_id);
- service_ = static_cast<service_t>(its_id);
-
- is_successful = is_successful && _from->deserialize(its_id);
- instance_ = static_cast<instance_t>(its_id);
-
- return is_successful;
-}
-
-bool entry_impl::is_service_entry() const {
- return (type_ <= entry_type_e::REQUEST_SERVICE);
-}
-
-bool entry_impl::is_eventgroup_entry() const {
- return (type_ >= entry_type_e::FIND_EVENT_GROUP
- && type_ <= entry_type_e::SUBSCRIBE_EVENTGROUP_ACK);
-}
-
-uint8_t entry_impl::get_num_options(uint8_t _run) const {
- if (_run < 1 || _run > VSOMEIP_MAX_OPTION_RUN) {
- return 0x0;
- }
- return num_options_[_run-1];
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/eventgroupentry_impl.cpp b/implementation/service_discovery/src/eventgroupentry_impl.cpp
deleted file mode 100755
index f5394be..0000000
--- a/implementation/service_discovery/src/eventgroupentry_impl.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright (C) 2014-2017 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/constants.hpp"
-#include "../include/eventgroupentry_impl.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-#include "../include/ipv4_option_impl.hpp"
-#include "../include/ipv6_option_impl.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-eventgroupentry_impl::eventgroupentry_impl() :
- reserved_(0) {
- eventgroup_ = 0xFFFF;
- counter_ = 0;
-}
-
-eventgroupentry_impl::eventgroupentry_impl(const eventgroupentry_impl &_entry)
- : entry_impl(_entry),
- reserved_(0) {
- eventgroup_ = _entry.eventgroup_;
- counter_ = _entry.counter_;
-}
-
-eventgroupentry_impl::~eventgroupentry_impl() {
-}
-
-eventgroup_t eventgroupentry_impl::get_eventgroup() const {
- return eventgroup_;
-}
-
-void eventgroupentry_impl::set_eventgroup(eventgroup_t _eventgroup) {
- eventgroup_ = _eventgroup;
-}
-
-uint16_t eventgroupentry_impl::get_reserved() const {
- return reserved_;
-}
-
-void eventgroupentry_impl::set_reserved(uint16_t _reserved) {
- reserved_ = _reserved;
-}
-
-uint8_t eventgroupentry_impl::get_counter() const {
- return counter_;
-}
-
-void eventgroupentry_impl::set_counter(uint8_t _counter) {
- counter_ = _counter;
-}
-
-bool eventgroupentry_impl::serialize(vsomeip::serializer *_to) const {
- bool is_successful = entry_impl::serialize(_to);
-
- is_successful = is_successful && _to->serialize(major_version_);
-
- is_successful = is_successful
- && _to->serialize(static_cast<uint32_t>(ttl_), true);
-
- // 4Bit only for counter field
- if (counter_ >= 16) {
- is_successful = false;
- }
- uint16_t counter_and_reserved = protocol::reserved_word;
- if (!reserved_ ) {
- //reserved was not set -> just store counter as uint16
- counter_and_reserved = static_cast<uint16_t>(counter_);
- }
- else {
- //reserved contains values -> put reserved and counter into 16 bit variable
- counter_and_reserved = (uint16_t) (((uint16_t) reserved_ << 4) | counter_);
- }
-
- is_successful = is_successful
- && _to->serialize((uint8_t)(counter_and_reserved >> 8)); // serialize reserved part 1
- is_successful = is_successful
- && _to->serialize((uint8_t)counter_and_reserved); // serialize reserved part 2 and counter
- is_successful = is_successful
- && _to->serialize(static_cast<uint16_t>(eventgroup_));
-
- return is_successful;
-}
-
-bool eventgroupentry_impl::deserialize(vsomeip::deserializer *_from) {
- bool is_successful = entry_impl::deserialize(_from);
-
- uint8_t tmp_major_version(0);
- is_successful = is_successful && _from->deserialize(tmp_major_version);
- major_version_ = static_cast<major_version_t>(tmp_major_version);
-
- uint32_t its_ttl(0);
- is_successful = is_successful && _from->deserialize(its_ttl, true);
- ttl_ = static_cast<ttl_t>(its_ttl);
-
- uint8_t reserved1(0), reserved2(0);
- is_successful = is_successful && _from->deserialize(reserved1); // deserialize reserved part 1
- is_successful = is_successful && _from->deserialize(reserved2); // deserialize reserved part 2 and counter
-
- reserved_ = (uint16_t) (((uint16_t)reserved1 << 8) | reserved2); // combine reserved parts and counter
- reserved_ = (uint16_t) (reserved_ >> 4); //remove counter from reserved field
-
- //set 4 bits of reserved part 2 field to zero
- counter_ = (uint8_t) (reserved2 & (~(0xF0)));
-
- // 4Bit only for counter field
- if (counter_ >= 16) {
- is_successful = false;
- }
- uint16_t its_eventgroup = 0;
- is_successful = is_successful && _from->deserialize(its_eventgroup);
- eventgroup_ = static_cast<eventgroup_t>(its_eventgroup);
-
- return is_successful;
-}
-
-bool eventgroupentry_impl::is_matching_subscribe(
- const eventgroupentry_impl& _other,
- const message_impl::options_t& _options) const {
- if (ttl_ == 0
- && _other.ttl_ > 0
- && service_ == _other.service_
- && instance_ == _other.instance_
- && eventgroup_ == _other.eventgroup_
- && index1_ == _other.index1_
- && index2_ == _other.index2_
- && num_options_[0] == _other.num_options_[0]
- && num_options_[1] == _other.num_options_[1]
- && major_version_ == _other.major_version_
- && counter_ == _other.counter_) {
- return true;
- } else if (ttl_ == 0
- && _other.ttl_ > 0
- && service_ == _other.service_
- && instance_ == _other.instance_
- && eventgroup_ == _other.eventgroup_
- && major_version_ == _other.major_version_
- && counter_ == _other.counter_) {
- // check if entries reference options at different indexes but the
- // options itself are identical
- // check if number of options referenced is the same
- if (num_options_[0] + num_options_[1]
- != _other.num_options_[0] + _other.num_options_[1] ||
- num_options_[0] + num_options_[1] == 0) {
- return false;
- }
- // read out ip options of current and _other
- std::vector<std::shared_ptr<ip_option_impl>> its_options_current;
- std::vector<std::shared_ptr<ip_option_impl>> its_options_other;
- for (const auto option_run : {0,1}) {
- for (const auto option_index : options_[option_run]) {
- switch (_options[option_index]->get_type()) {
- case option_type_e::IP4_ENDPOINT:
- its_options_current.push_back(
- std::static_pointer_cast<ipv4_option_impl>(
- _options[option_index]));
- break;
- case option_type_e::IP6_ENDPOINT:
- its_options_current.push_back(
- std::static_pointer_cast<ipv6_option_impl>(
- _options[option_index]));
- break;
- default:
- break;
- }
- }
- for (const auto option_index : _other.options_[option_run]) {
- switch (_options[option_index]->get_type()) {
- case option_type_e::IP4_ENDPOINT:
- its_options_other.push_back(
- std::static_pointer_cast<ipv4_option_impl>(
- _options[option_index]));
- break;
- case option_type_e::IP6_ENDPOINT:
- its_options_other.push_back(
- std::static_pointer_cast<ipv6_option_impl>(
- _options[option_index]));
- break;
- default:
- break;
- }
- }
- }
-
- if (!its_options_current.size() || !its_options_other.size()) {
- return false;
- }
-
- // search every option of current in other
- for (const auto& c : its_options_current) {
- bool found(false);
- for (const auto& o : its_options_other) {
- if (*c == *o) {
- switch (c->get_type()) {
- case option_type_e::IP4_ENDPOINT:
- if (static_cast<ipv4_option_impl*>(c.get())->get_address()
- == static_cast<ipv4_option_impl*>(o.get())->get_address()) {
- found = true;
- }
- break;
- case option_type_e::IP6_ENDPOINT:
- if (static_cast<ipv6_option_impl*>(c.get())->get_address()
- == static_cast<ipv6_option_impl*>(o.get())->get_address()) {
- found = true;
- }
- break;
- default:
- break;
- }
- }
- if (found) {
- break;
- }
- }
- if (!found) {
- return false;
- }
- }
- return true;
- }
- return false;
-}
-
-void eventgroupentry_impl::add_target(
- const std::shared_ptr<endpoint_definition> &_target) {
- if (_target->is_reliable()) {
- target_reliable_ = _target;
- } else {
- target_unreliable_ = _target;
- }
-}
-
-std::shared_ptr<endpoint_definition> eventgroupentry_impl::get_target(
- bool _reliable) const {
- return _reliable ? target_reliable_ : target_unreliable_;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/ip_option_impl.cpp b/implementation/service_discovery/src/ip_option_impl.cpp
deleted file mode 100644
index 0684dc8..0000000
--- a/implementation/service_discovery/src/ip_option_impl.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/constants.hpp>
-
-#include "../include/constants.hpp"
-#include "../include/ip_option_impl.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-ip_option_impl::ip_option_impl() :
- protocol_(layer_four_protocol_e::UNKNOWN),
- port_(0xFFFF) {
-}
-
-ip_option_impl::~ip_option_impl() {
-}
-
-bool ip_option_impl::operator ==(const ip_option_impl &_other) const {
- return (option_impl::operator ==(_other)
- && protocol_ == _other.protocol_
- && port_ == _other.port_);
-}
-
-unsigned short ip_option_impl::get_port() const {
- return port_;
-}
-
-void ip_option_impl::set_port(unsigned short _port) {
- port_ = _port;
-}
-
-layer_four_protocol_e ip_option_impl::get_layer_four_protocol() const {
- return protocol_;
-}
-
-void ip_option_impl::set_layer_four_protocol(
- layer_four_protocol_e _protocol) {
- protocol_ = _protocol;
-}
-
-} // namespace sd
-} // namespace vsomeip
-
diff --git a/implementation/service_discovery/src/ipv4_option_impl.cpp b/implementation/service_discovery/src/ipv4_option_impl.cpp
deleted file mode 100644
index 22ee7d8..0000000
--- a/implementation/service_discovery/src/ipv4_option_impl.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/constants.hpp>
-
-#include "../include/constants.hpp"
-#include "../include/defines.hpp"
-#include "../include/ipv4_option_impl.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-ipv4_option_impl::ipv4_option_impl(bool _is_multicast) :
- address_({0}) {
- length_ = (1 + 4 + 1 + 1 + 2);
- type_ = (
- _is_multicast ?
- option_type_e::IP4_MULTICAST : option_type_e::IP4_ENDPOINT);
-}
-
-ipv4_option_impl::~ipv4_option_impl() {
-}
-
-bool ipv4_option_impl::operator ==(const ipv4_option_impl &_other) const {
- return (ip_option_impl::operator ==(_other)
- && address_ == _other.address_);
-}
-
-const ipv4_address_t & ipv4_option_impl::get_address() const {
- return address_;
-}
-
-void ipv4_option_impl::set_address(const ipv4_address_t &_address) {
- address_ = _address;
-}
-
-bool ipv4_option_impl::is_multicast() const {
- return (type_ == option_type_e::IP4_MULTICAST);
-}
-
-bool ipv4_option_impl::serialize(vsomeip::serializer *_to) const {
- bool is_successful = option_impl::serialize(_to);
- _to->serialize(&address_[0], uint32_t(address_.size()));
- _to->serialize(protocol::reserved_byte);
- _to->serialize(static_cast<uint8_t>(protocol_));
- _to->serialize(port_);
- return is_successful;
-}
-
-bool ipv4_option_impl::deserialize(vsomeip::deserializer *_from) {
- bool is_successful = option_impl::deserialize(_from)
- && length_ == VSOMEIP_SD_IPV4_OPTION_LENGTH;
- uint8_t its_reserved(static_cast<std::uint8_t>(layer_four_protocol_e::UNKNOWN));
- _from->deserialize(address_.data(), 4);
- _from->deserialize(its_reserved);
- _from->deserialize(its_reserved);
- switch (static_cast<layer_four_protocol_e>(its_reserved)) {
- case layer_four_protocol_e::TCP:
- case layer_four_protocol_e::UDP:
- protocol_ = static_cast<layer_four_protocol_e>(its_reserved);
- break;
- default:
- protocol_ = layer_four_protocol_e::UNKNOWN;
- }
- _from->deserialize(port_);
- return is_successful;
-}
-
-} // namespace sd
-} // namespace vsomeip
-
diff --git a/implementation/service_discovery/src/ipv6_option_impl.cpp b/implementation/service_discovery/src/ipv6_option_impl.cpp
deleted file mode 100755
index e4de3d6..0000000
--- a/implementation/service_discovery/src/ipv6_option_impl.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (C) 2014-2017 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 <cstring>
-
-#include "../include/constants.hpp"
-#include "../include/defines.hpp"
-#include "../include/ipv6_option_impl.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-ipv6_option_impl::ipv6_option_impl(bool _is_multicast) :
- address_({0}) {
- length_ = (1 + 16 + 1 + 1 + 2);
- type_ = (
- _is_multicast ?
- option_type_e::IP6_MULTICAST : option_type_e::IP6_ENDPOINT);
-}
-
-ipv6_option_impl::~ipv6_option_impl() {
-}
-
-bool ipv6_option_impl::operator ==(const ipv6_option_impl &_other) const {
- return (ip_option_impl::operator ==(_other)
- && address_ == _other.address_);
-}
-
-const ipv6_address_t & ipv6_option_impl::get_address() const {
- return address_;
-}
-
-void ipv6_option_impl::set_address(const ipv6_address_t &_address) {
- address_ = _address;
-}
-
-bool ipv6_option_impl::is_multicast() const {
- return (type_ == option_type_e::IP6_MULTICAST);
-}
-
-bool ipv6_option_impl::serialize(vsomeip::serializer *_to) const {
- bool is_successful = option_impl::serialize(_to);
- _to->serialize(&address_[0], uint32_t(address_.size()));
- _to->serialize(protocol::reserved_byte);
- _to->serialize(static_cast<uint8_t>(protocol_));
- _to->serialize(port_);
- return is_successful;
-}
-
-bool ipv6_option_impl::deserialize(vsomeip::deserializer *_from) {
- bool is_successful = option_impl::deserialize(_from)
- && length_ == VSOMEIP_SD_IPV6_OPTION_LENGTH;;
- uint8_t its_reserved(static_cast<std::uint8_t>(layer_four_protocol_e::UNKNOWN));
- _from->deserialize(address_.data(), 16);
- _from->deserialize(its_reserved);
- _from->deserialize(its_reserved);
- switch (static_cast<layer_four_protocol_e>(its_reserved)) {
- case layer_four_protocol_e::TCP:
- case layer_four_protocol_e::UDP:
- protocol_ = static_cast<layer_four_protocol_e>(its_reserved);
- break;
- default:
- protocol_ = layer_four_protocol_e::UNKNOWN;
- }
- _from->deserialize(port_);
- return is_successful;
-}
-
-} // namespace sd
-} // namespace vsomeip
-
diff --git a/implementation/service_discovery/src/load_balancing_option_impl.cpp b/implementation/service_discovery/src/load_balancing_option_impl.cpp
deleted file mode 100755
index 937dd4d..0000000
--- a/implementation/service_discovery/src/load_balancing_option_impl.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2014-2017 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/load_balancing_option_impl.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-load_balancing_option_impl::load_balancing_option_impl() {
- length_ = 1 + 2 + 2;
- type_ = option_type_e::LOAD_BALANCING;
- priority_ = 0;
- weight_ = 0;
-}
-
-load_balancing_option_impl::~load_balancing_option_impl() {
-}
-
-bool load_balancing_option_impl::operator ==(
- const load_balancing_option_impl &_other) const {
- return (option_impl::operator ==(_other)
- && priority_ == _other.priority_
- && priority_ == _other.weight_);
-}
-
-priority_t load_balancing_option_impl::get_priority() const {
- return priority_;
-}
-
-void load_balancing_option_impl::set_priority(priority_t _priority) {
- priority_ = _priority;
-}
-
-weight_t load_balancing_option_impl::get_weight() const {
- return weight_;
-}
-
-void load_balancing_option_impl::set_weight(weight_t _weight) {
- weight_ = _weight;
-}
-
-bool load_balancing_option_impl::serialize(vsomeip::serializer *_to) const {
- bool is_successful = option_impl::serialize(_to);
- is_successful = is_successful
- && _to->serialize(static_cast<uint16_t>(priority_));
- is_successful = is_successful
- && _to->serialize(static_cast<uint16_t>(weight_));
- return is_successful;
-}
-
-bool load_balancing_option_impl::deserialize(vsomeip::deserializer *_from) {
- bool is_successful = option_impl::deserialize(_from);
-
- uint16_t tmp_priority = 0;
- is_successful = is_successful && _from->deserialize(tmp_priority);
- priority_ = static_cast<priority_t>(tmp_priority);
-
- uint16_t tmp_weight = 0;
- is_successful = is_successful && _from->deserialize(tmp_weight);
- weight_ = static_cast<weight_t>(tmp_weight);
-
- return is_successful;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/message_element_impl.cpp b/implementation/service_discovery/src/message_element_impl.cpp
deleted file mode 100755
index fb89d85..0000000
--- a/implementation/service_discovery/src/message_element_impl.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2014-2017 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/message_element_impl.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-message_element_impl::message_element_impl() {
- owner_ = 0;
-}
-
-message_impl * message_element_impl::get_owning_message() const {
- return owner_;
-}
-
-void message_element_impl::set_owning_message(message_impl *_owner) {
- owner_ = _owner;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/message_impl.cpp b/implementation/service_discovery/src/message_impl.cpp
deleted file mode 100755
index f4695a9..0000000
--- a/implementation/service_discovery/src/message_impl.cpp
+++ /dev/null
@@ -1,439 +0,0 @@
-// Copyright (C) 2014-2017 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 <typeinfo>
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/defines.hpp>
-
-#include "../include/constants.hpp"
-#include "../include/defines.hpp"
-#include "../include/eventgroupentry_impl.hpp"
-#include "../include/serviceentry_impl.hpp"
-#include "../include/configuration_option_impl.hpp"
-#include "../include/ipv4_option_impl.hpp"
-#include "../include/ipv6_option_impl.hpp"
-#include "../include/load_balancing_option_impl.hpp"
-#include "../include/protection_option_impl.hpp"
-#include "../include/message_impl.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/payload_impl.hpp"
-#include "../../message/include/serializer.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-message_impl::message_impl() :
- flags_(0x0),
- options_length_(0x0),
- number_required_acks_(0x0),
- number_contained_acks_(0x0) {
- header_.service_ = 0xFFFF;
- header_.method_ = 0x8100;
- header_.protocol_version_ = 0x01;
-}
-
-message_impl::~message_impl() {
-}
-
-length_t message_impl::get_length() const {
- length_t current_length = VSOMEIP_SOMEIP_SD_DATA_SIZE;
- if( entries_.size()) {
- current_length += VSOMEIP_SOMEIP_SD_ENTRY_LENGTH_SIZE;
- current_length += uint32_t(entries_.size() * VSOMEIP_SOMEIP_SD_ENTRY_SIZE);
- }
-
- current_length += VSOMEIP_SOMEIP_SD_OPTION_LENGTH_SIZE;
- if(options_.size()) {
- for (size_t i = 0; i < options_.size(); ++i) {
- current_length += (options_[i]->get_length()
- + VSOMEIP_SOMEIP_SD_OPTION_HEADER_SIZE);
- }
- }
- return current_length;
-}
-
-#define VSOMEIP_REBOOT_FLAG 0x80
-
-bool message_impl::get_reboot_flag() const {
- return ((flags_ & VSOMEIP_REBOOT_FLAG) != 0);
-}
-
-void message_impl::set_reboot_flag(bool _is_set) {
- if (_is_set)
- flags_ |= flags_t(VSOMEIP_REBOOT_FLAG);
- else
- flags_ &= flags_t(~VSOMEIP_REBOOT_FLAG);
-}
-
-#define VSOMEIP_UNICAST_FLAG 0x40
-
-bool message_impl::get_unicast_flag() const {
- return ((flags_ & VSOMEIP_UNICAST_FLAG) != 0);
-}
-
-void message_impl::set_unicast_flag(bool _is_set) {
- if (_is_set)
- flags_ |= flags_t(VSOMEIP_UNICAST_FLAG);
- else
- flags_ &= flags_t(~VSOMEIP_UNICAST_FLAG);
-}
-
-void message_impl::set_length(length_t _length) {
- (void)_length;
-}
-
-std::shared_ptr<eventgroupentry_impl> message_impl::create_eventgroup_entry() {
- std::shared_ptr < eventgroupentry_impl
- > its_entry(std::make_shared<eventgroupentry_impl>());
- //TODO: throw OutOfMemoryException if allocation fails
- its_entry->set_owning_message(this);
- entries_.push_back(its_entry);
- return its_entry;
-}
-
-std::shared_ptr<serviceentry_impl> message_impl::create_service_entry() {
- std::shared_ptr < serviceentry_impl
- > its_entry(std::make_shared<serviceentry_impl>());
- //TODO: throw OutOfMemoryException if allocation fails
- its_entry->set_owning_message(this);
- entries_.push_back(its_entry);
- return its_entry;
-}
-
-std::shared_ptr<configuration_option_impl> message_impl::create_configuration_option() {
- std::shared_ptr < configuration_option_impl
- > its_option(std::make_shared<configuration_option_impl>());
- //TODO: throw OutOfMemoryException if allocation fails
- its_option->set_owning_message(this);
- options_.push_back(its_option);
- return its_option;
-}
-
-std::shared_ptr<ipv4_option_impl> message_impl::create_ipv4_option(
- bool _is_multicast) {
- std::shared_ptr < ipv4_option_impl
- > its_option(std::make_shared < ipv4_option_impl > (_is_multicast));
- //TODO: throw OutOfMemoryException if allocation fails
- its_option->set_owning_message(this);
- options_.push_back(its_option);
- return its_option;
-}
-
-std::shared_ptr<ipv6_option_impl> message_impl::create_ipv6_option(
- bool _is_multicast) {
- std::shared_ptr < ipv6_option_impl
- > its_option(std::make_shared < ipv6_option_impl > (_is_multicast));
- //TODO: throw OutOfMemoryException if allocation fails
- its_option->set_owning_message(this);
- options_.push_back(its_option);
- return its_option;
-}
-
-std::shared_ptr<load_balancing_option_impl> message_impl::create_load_balancing_option() {
- std::shared_ptr < load_balancing_option_impl
- > its_option(std::make_shared<load_balancing_option_impl>());
- //TODO: throw OutOfMemoryException if allocation fails
- its_option->set_owning_message(this);
- options_.push_back(its_option);
- return its_option;
-}
-
-std::shared_ptr<protection_option_impl> message_impl::create_protection_option() {
- std::shared_ptr < protection_option_impl
- > its_option(std::make_shared<protection_option_impl>());
- //TODO: throw OutOfMemoryException if allocation fails
- its_option->set_owning_message(this);
- options_.push_back(its_option);
- return its_option;
-}
-
-const message_impl::entries_t & message_impl::get_entries() const {
- return entries_;
-}
-
-const message_impl::options_t & message_impl::get_options() const {
- return options_;
-}
-
-// TODO: throw exception to signal "OptionNotFound"
-int16_t message_impl::get_option_index(
- const std::shared_ptr<option_impl> &_option) const {
- int16_t i = 0;
-
- while (i < int16_t(options_.size())) {
- if (options_[i] == _option)
- return i;
- i++;
- }
-
- return -1;
-}
-
-uint32_t message_impl::get_options_length() {
- return options_length_;
-}
-
-std::shared_ptr<payload> message_impl::get_payload() const {
- return std::make_shared<payload_impl>();
-}
-
-void message_impl::set_payload(std::shared_ptr<payload> _payload) {
- (void)_payload;
-}
-
-bool message_impl::serialize(vsomeip::serializer *_to) const {
- bool is_successful = header_.serialize(_to);
-
- is_successful = is_successful && _to->serialize(flags_);
- is_successful = is_successful
- && _to->serialize(protocol::reserved_long, true);
-
- uint32_t entries_length = uint32_t(entries_.size() * VSOMEIP_SOMEIP_SD_ENTRY_SIZE);
- is_successful = is_successful && _to->serialize(entries_length);
-
- for (auto it = entries_.begin(); it != entries_.end(); ++it)
- is_successful = is_successful && (*it)->serialize(_to);
-
- uint32_t options_length = 0;
- for (auto its_option : options_)
- options_length += its_option->get_length()
- + VSOMEIP_SOMEIP_SD_OPTION_HEADER_SIZE;
- is_successful = is_successful && _to->serialize(options_length);
-
- for (auto its_option : options_)
- is_successful = is_successful && its_option->serialize(_to);
-
- return is_successful;
-}
-
-bool message_impl::deserialize(vsomeip::deserializer *_from) {
- bool is_successful;
- bool option_is_successful(true);
-
- // header
- is_successful = header_.deserialize(_from);
-
- // flags
- is_successful = is_successful && _from->deserialize(flags_);
-
- // reserved
- uint32_t reserved;
- is_successful = is_successful && _from->deserialize(reserved, true);
-
- // entries
- uint32_t entries_length = 0;
- is_successful = is_successful && _from->deserialize(entries_length);
-
- // backup the current remaining length
- uint32_t save_remaining = uint32_t(_from->get_remaining());
-
- // set remaining bytes to length of entries array
- _from->set_remaining(entries_length);
-
- // deserialize the entries
- while (is_successful && _from->get_remaining()) {
- std::shared_ptr < entry_impl > its_entry(deserialize_entry(_from));
- if (its_entry) {
- if (its_entry->get_type() == entry_type_e::SUBSCRIBE_EVENTGROUP) {
- bool is_unique(true);
- for (const auto& e : entries_) {
- if (e->get_type() == entry_type_e::SUBSCRIBE_EVENTGROUP &&
- *(static_cast<eventgroupentry_impl*>(e.get())) ==
- *(static_cast<eventgroupentry_impl*>(its_entry.get()))) {
- is_unique = false;
- break;
- }
- }
- if (is_unique) {
- entries_.push_back(its_entry);
- if (its_entry->get_ttl() > 0) {
- const std::uint8_t num_options =
- static_cast<std::uint8_t>(
- its_entry->get_num_options(1) +
- its_entry->get_num_options(2));
- number_required_acks_ =
- static_cast<std::uint8_t>(number_required_acks_
- + num_options);
- }
- }
- } else {
- entries_.push_back(its_entry);
- }
- } else {
- is_successful = false;
- }
- }
-
- // set length to remaining bytes after entries array
- _from->set_remaining(save_remaining - entries_length);
-
- // Don't try to deserialize options if there aren't any
- if(_from->get_remaining() == 0) {
- return is_successful;
- }
-
- // deserialize the options
- is_successful = is_successful && _from->deserialize(options_length_);
-
- // check if there is unreferenced data behind the last option and discard it
- if(_from->get_remaining() > options_length_) {
- _from->set_remaining(options_length_);
- }
-
- while (option_is_successful && _from->get_remaining()) {
- std::shared_ptr < option_impl > its_option(deserialize_option(_from));
- if (its_option) {
- options_.push_back(its_option);
- } else {
- option_is_successful = false;
- }
- }
-
- return is_successful;
-}
-
-entry_impl * message_impl::deserialize_entry(vsomeip::deserializer *_from) {
- entry_impl *deserialized_entry = 0;
- uint8_t tmp_entry_type;
-
- if (_from->look_ahead(0, tmp_entry_type)) {
- entry_type_e deserialized_entry_type =
- static_cast<entry_type_e>(tmp_entry_type);
-
- switch (deserialized_entry_type) {
- case entry_type_e::FIND_SERVICE:
- case entry_type_e::OFFER_SERVICE:
- //case entry_type_e::STOP_OFFER_SERVICE:
- case entry_type_e::REQUEST_SERVICE:
- deserialized_entry = new serviceentry_impl;
- break;
-
- case entry_type_e::FIND_EVENT_GROUP:
- case entry_type_e::PUBLISH_EVENTGROUP:
- //case entry_type_e::STOP_PUBLISH_EVENTGROUP:
- case entry_type_e::SUBSCRIBE_EVENTGROUP:
- //case entry_type_e::STOP_SUBSCRIBE_EVENTGROUP:
- case entry_type_e::SUBSCRIBE_EVENTGROUP_ACK:
- //case entry_type_e::STOP_SUBSCRIBE_EVENTGROUP_ACK:
- deserialized_entry = new eventgroupentry_impl;
- break;
-
- default:
- break;
- };
-
- // deserialize object
- if (0 != deserialized_entry) {
- deserialized_entry->set_owning_message(this);
- if (!deserialized_entry->deserialize(_from)) {
- delete deserialized_entry;
- deserialized_entry = 0;
- };
- }
- }
-
- return deserialized_entry;
-}
-
-option_impl * message_impl::deserialize_option(vsomeip::deserializer *_from) {
- option_impl *deserialized_option = 0;
- uint8_t tmp_option_type;
-
- if (_from->look_ahead(2, tmp_option_type)) {
-
- option_type_e deserialized_option_type =
- static_cast<option_type_e>(tmp_option_type);
-
- switch (deserialized_option_type) {
-
- case option_type_e::CONFIGURATION:
- deserialized_option = new configuration_option_impl;
- break;
- case option_type_e::LOAD_BALANCING:
- deserialized_option = new load_balancing_option_impl;
- break;
- case option_type_e::PROTECTION:
- deserialized_option = new protection_option_impl;
- break;
- case option_type_e::IP4_ENDPOINT:
- deserialized_option = new ipv4_option_impl(false);
- break;
- case option_type_e::IP4_MULTICAST:
- deserialized_option = new ipv4_option_impl(true);
- break;
- case option_type_e::IP6_ENDPOINT:
- deserialized_option = new ipv6_option_impl(false);
- break;
- case option_type_e::IP6_MULTICAST:
- deserialized_option = new ipv6_option_impl(true);
- break;
-
- default:
- deserialized_option = new option_impl();
- break;
- };
-
- // deserialize object
- if (0 != deserialized_option
- && !deserialized_option->deserialize(_from)) {
- delete deserialized_option;
- deserialized_option = 0;
- };
- }
-
- return deserialized_option;
-}
-
-length_t message_impl::get_someip_length() const {
- return header_.length_;
-}
-
-std::uint8_t message_impl::get_number_required_acks() const {
- return number_required_acks_;
-}
-
-std::uint8_t message_impl::get_number_contained_acks() const {
- return number_contained_acks_;
-}
-
-void message_impl::set_number_required_acks(std::uint8_t _required_acks) {
- number_required_acks_ = _required_acks;
-}
-
-void message_impl::increase_number_required_acks(std::uint8_t _amount) {
- number_required_acks_ += _amount;
-}
-
-void message_impl::decrease_number_required_acks(std::uint8_t _amount) {
- number_required_acks_ -= _amount;
-}
-
-void message_impl::increase_number_contained_acks() {
- number_contained_acks_++;
-}
-
-bool message_impl::all_required_acks_contained() const {
- return number_contained_acks_ >= number_required_acks_;
-}
-
-std::unique_lock<std::mutex> message_impl::get_message_lock() {
- return std::unique_lock<std::mutex>(message_mutex_);
-}
-
-void message_impl::forced_initial_events_add(forced_initial_events_t _entry) {
- std::lock_guard<std::mutex> its_lock(forced_initial_events_mutex_);
- forced_initial_events_info_.push_back(_entry);
-}
-
-const std::vector<message_impl::forced_initial_events_t>
-message_impl::forced_initial_events_get() {
- std::lock_guard<std::mutex> its_lock(forced_initial_events_mutex_);
- return forced_initial_events_info_;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/option_impl.cpp b/implementation/service_discovery/src/option_impl.cpp
deleted file mode 100755
index 8191912..0000000
--- a/implementation/service_discovery/src/option_impl.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (C) 2014-2017 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/constants.hpp"
-#include "../include/option_impl.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-option_impl::option_impl() :
- length_(0),
- type_(option_type_e::UNKNOWN) {
-}
-
-option_impl::~option_impl() {
-}
-
-bool option_impl::operator ==(const option_impl &_other) const {
- return (type_ == _other.type_ && length_ == _other.length_);
-}
-
-uint16_t option_impl::get_length() const {
- return length_;
-}
-
-option_type_e option_impl::get_type() const {
- return type_;
-}
-
-bool option_impl::serialize(vsomeip::serializer *_to) const {
- return (0 != _to && _to->serialize(length_)
- && _to->serialize(static_cast<uint8_t>(type_))
- && _to->serialize(protocol::reserved_byte));
-}
-
-bool option_impl::deserialize(vsomeip::deserializer *_from) {
- uint8_t its_type, reserved;
- bool l_result = (0 != _from && _from->deserialize(length_)
- && _from->deserialize(its_type) && _from->deserialize(reserved));
-
- if (l_result) {
- switch(static_cast<option_type_e>(its_type)) {
- case option_type_e::CONFIGURATION:
- case option_type_e::LOAD_BALANCING:
- case option_type_e::PROTECTION:
- case option_type_e::IP4_ENDPOINT:
- case option_type_e::IP6_ENDPOINT:
- case option_type_e::IP4_MULTICAST:
- case option_type_e::IP6_MULTICAST:
- type_ = static_cast<option_type_e>(its_type);
- break;
- default:
- type_ = option_type_e::UNKNOWN;
- // No valid option type --> ignore the remaining parts of the message!
- _from->set_remaining(0);
- }
- }
-
- return l_result;
-}
-
-} // namespace sd
-} // namespace vsomeip
-
diff --git a/implementation/service_discovery/src/protection_option_impl.cpp b/implementation/service_discovery/src/protection_option_impl.cpp
deleted file mode 100755
index f847650..0000000
--- a/implementation/service_discovery/src/protection_option_impl.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2014-2017 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/protection_option_impl.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-protection_option_impl::protection_option_impl() {
- length_ = 1 + 4 + 4;
- type_ = option_type_e::PROTECTION;
- counter_ = 0;
- crc_ = 0;
-}
-
-protection_option_impl::~protection_option_impl() {
-}
-
-bool protection_option_impl::operator ==(
- const protection_option_impl &_other) const {
- return (option_impl::operator ==(_other)
- && counter_ == _other.counter_
- && crc_ == _other.crc_);
-}
-
-alive_counter_t protection_option_impl::get_alive_counter() const {
- return counter_;
-}
-
-void protection_option_impl::set_alive_counter(alive_counter_t _counter) {
- counter_ = _counter;
-}
-
-crc_t protection_option_impl::get_crc() const {
- return crc_;
-}
-
-void protection_option_impl::set_crc(crc_t _crc) {
- crc_ = _crc;
-}
-
-bool protection_option_impl::serialize(vsomeip::serializer *_to) const {
- bool is_successful = option_impl::serialize(_to);
- is_successful = is_successful
- && _to->serialize(static_cast<uint32_t>(counter_));
- is_successful = is_successful
- && _to->serialize(static_cast<uint32_t>(crc_));
- return is_successful;
-}
-
-bool protection_option_impl::deserialize(vsomeip::deserializer *_from) {
- bool is_successful = option_impl::deserialize(_from);
-
- uint32_t its_alive_counter = 0;
- is_successful = is_successful && _from->deserialize(its_alive_counter);
- counter_ = static_cast<alive_counter_t>(its_alive_counter);
-
- uint32_t its_crc = 0;
- is_successful = is_successful && _from->deserialize(its_crc);
- crc_ = static_cast<crc_t>(its_crc);
-
- return is_successful;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/request.cpp b/implementation/service_discovery/src/request.cpp
deleted file mode 100644
index c726c3e..0000000
--- a/implementation/service_discovery/src/request.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2014-2017 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/request.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-request::request(major_version_t _major, minor_version_t _minor, ttl_t _ttl)
- : major_(_major), minor_(_minor), ttl_(_ttl), sent_counter_(0) {
-}
-
-major_version_t request::get_major() const {
- return major_;
-}
-
-void request::set_major(major_version_t _major) {
- major_ = _major;
-}
-
-minor_version_t request::get_minor() const {
- return minor_;
-}
-
-void request::set_minor(minor_version_t _minor) {
- minor_ = _minor;
-}
-
-ttl_t request::get_ttl() const {
- return ttl_;
-}
-
-void request::set_ttl(ttl_t _ttl) {
- ttl_ = _ttl;
-}
-
-uint8_t request::get_sent_counter() const {
- return sent_counter_;
-}
-
-void request::set_sent_counter(uint8_t _sent_counter) {
- sent_counter_ = _sent_counter;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/runtime_impl.cpp b/implementation/service_discovery/src/runtime_impl.cpp
deleted file mode 100644
index 90743b8..0000000
--- a/implementation/service_discovery/src/runtime_impl.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/defines.hpp>
-#include <vsomeip/message.hpp>
-
-#include "../include/constants.hpp"
-#include "../include/defines.hpp"
-#include "../include/message_impl.hpp"
-#include "../include/runtime_impl.hpp"
-#include "../include/service_discovery_impl.hpp"
-
-VSOMEIP_PLUGIN(vsomeip::sd::runtime_impl)
-
-namespace vsomeip {
-namespace sd {
-
-runtime_impl::runtime_impl()
- : plugin_impl("vsomeip SD plug-in", 1, plugin_type_e::SD_RUNTIME_PLUGIN) {
-}
-
-runtime_impl::~runtime_impl() {
-}
-
-std::shared_ptr<service_discovery> runtime_impl::create_service_discovery(
- service_discovery_host *_host) const {
- return std::make_shared < service_discovery_impl > (_host);
-}
-
-std::shared_ptr<message_impl> runtime_impl::create_message() const {
- std::shared_ptr < message_impl > its_message =
- std::make_shared<message_impl>();
- its_message->set_service(VSOMEIP_SD_SERVICE);
- its_message->set_instance(VSOMEIP_SD_INSTANCE);
- its_message->set_method(VSOMEIP_SD_METHOD);
- its_message->set_client(VSOMEIP_SD_CLIENT);
- // session must be set dynamically
- its_message->set_protocol_version(protocol_version);
- its_message->set_interface_version(interface_version);
- its_message->set_message_type(message_type);
- its_message->set_return_code(return_code);
- // reboot flag must be set dynamically
- its_message->set_unicast_flag(true);
- return its_message;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp
deleted file mode 100644
index 6042526..0000000
--- a/implementation/service_discovery/src/service_discovery_impl.cpp
+++ /dev/null
@@ -1,3650 +0,0 @@
-// Copyright (C) 2014-2017 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 <vsomeip/constants.hpp>
-
-#include <random>
-#include <forward_list>
-
-#include "../include/constants.hpp"
-#include "../include/defines.hpp"
-#include "../include/deserializer.hpp"
-#include "../include/enumeration_types.hpp"
-#include "../include/eventgroupentry_impl.hpp"
-#include "../include/ipv4_option_impl.hpp"
-#include "../include/ipv6_option_impl.hpp"
-#include "../include/message_impl.hpp"
-#include "../include/request.hpp"
-#include "../include/runtime.hpp"
-#include "../include/service_discovery_host.hpp"
-#include "../include/service_discovery_impl.hpp"
-#include "../include/serviceentry_impl.hpp"
-#include "../include/subscription.hpp"
-#include "../../configuration/include/configuration.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../endpoints/include/endpoint.hpp"
-#include "../../endpoints/include/client_endpoint.hpp"
-#include "../../endpoints/include/endpoint_definition.hpp"
-#include "../../endpoints/include/tcp_server_endpoint_impl.hpp"
-#include "../../endpoints/include/udp_server_endpoint_impl.hpp"
-#include "../../logging/include/logger.hpp"
-#include "../../message/include/serializer.hpp"
-#include "../../routing/include/eventgroupinfo.hpp"
-#include "../../routing/include/serviceinfo.hpp"
-#include "../../plugin/include/plugin_manager.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-service_discovery_impl::service_discovery_impl(service_discovery_host *_host)
- : io_(_host->get_io()),
- host_(_host),
- port_(VSOMEIP_SD_DEFAULT_PORT),
- reliable_(false),
- serializer_(
- std::make_shared<serializer>(
- host_->get_configuration()->get_buffer_shrink_threshold())),
- deserializer_(
- std::make_shared<deserializer>(
- host_->get_configuration()->get_buffer_shrink_threshold())),
- ttl_timer_(_host->get_io()),
- ttl_timer_runtime_(VSOMEIP_SD_DEFAULT_CYCLIC_OFFER_DELAY / 2),
- ttl_(VSOMEIP_SD_DEFAULT_TTL),
- subscription_expiration_timer_(_host->get_io()),
- max_message_size_(VSOMEIP_MAX_UDP_SD_PAYLOAD),
- initial_delay_(0),
- offer_debounce_time_(VSOMEIP_SD_DEFAULT_OFFER_DEBOUNCE_TIME),
- repetitions_base_delay_(VSOMEIP_SD_DEFAULT_REPETITIONS_BASE_DELAY),
- repetitions_max_(VSOMEIP_SD_DEFAULT_REPETITIONS_MAX),
- cyclic_offer_delay_(VSOMEIP_SD_DEFAULT_CYCLIC_OFFER_DELAY),
- offer_debounce_timer_(_host->get_io()),
- find_debounce_time_(VSOMEIP_SD_DEFAULT_FIND_DEBOUNCE_TIME),
- find_debounce_timer_(_host->get_io()),
- main_phase_timer_(_host->get_io()),
- is_suspended_(false),
- is_diagnosis_(false),
- last_msg_received_timer_(_host->get_io()),
- last_msg_received_timer_timeout_(VSOMEIP_SD_DEFAULT_CYCLIC_OFFER_DELAY +
- (VSOMEIP_SD_DEFAULT_CYCLIC_OFFER_DELAY / 10)) {
- // TODO: cleanup start condition!
- next_subscription_expiration_ = std::chrono::steady_clock::now() + std::chrono::hours(24);
-}
-
-service_discovery_impl::~service_discovery_impl() {
-}
-
-std::shared_ptr<configuration> service_discovery_impl::get_configuration() const {
- return host_->get_configuration();
-}
-
-boost::asio::io_service & service_discovery_impl::get_io() {
- return io_;
-}
-
-void service_discovery_impl::init() {
- runtime_ = std::dynamic_pointer_cast<sd::runtime>(plugin_manager::get()->get_plugin(plugin_type_e::SD_RUNTIME_PLUGIN, VSOMEIP_SD_LIBRARY));
-
- std::shared_ptr < configuration > its_configuration =
- host_->get_configuration();
- if (its_configuration) {
- unicast_ = its_configuration->get_unicast_address();
- sd_multicast_ = its_configuration->get_sd_multicast();
- boost::system::error_code ec;
- sd_multicast_address_ = boost::asio::ip::address::from_string(sd_multicast_, ec);
-
- port_ = its_configuration->get_sd_port();
- reliable_ = (its_configuration->get_sd_protocol()
- == "tcp");
- max_message_size_ = (reliable_ ? VSOMEIP_MAX_TCP_SD_PAYLOAD :
- VSOMEIP_MAX_UDP_SD_PAYLOAD);
-
- ttl_ = its_configuration->get_sd_ttl();
-
- // generate random initial delay based on initial delay min and max
- std::int32_t initial_delay_min =
- its_configuration->get_sd_initial_delay_min();
- if (initial_delay_min < 0) {
- initial_delay_min = VSOMEIP_SD_DEFAULT_INITIAL_DELAY_MIN;
- }
- std::int32_t initial_delay_max =
- its_configuration->get_sd_initial_delay_max();
- if (initial_delay_max < 0) {
- initial_delay_max = VSOMEIP_SD_DEFAULT_INITIAL_DELAY_MAX;
- }
- if (initial_delay_min > initial_delay_max) {
- const std::uint32_t tmp(initial_delay_min);
- initial_delay_min = initial_delay_max;
- initial_delay_max = tmp;
- }
-
- std::random_device r;
- std::mt19937 e(r());
- std::uniform_int_distribution<std::uint32_t> distribution(
- initial_delay_min, initial_delay_max);
- initial_delay_ = std::chrono::milliseconds(distribution(e));
-
-
- repetitions_base_delay_ = std::chrono::milliseconds(
- its_configuration->get_sd_repetitions_base_delay());
- repetitions_max_ = its_configuration->get_sd_repetitions_max();
- cyclic_offer_delay_ = std::chrono::milliseconds(
- its_configuration->get_sd_cyclic_offer_delay());
- offer_debounce_time_ = std::chrono::milliseconds(
- its_configuration->get_sd_offer_debounce_time());
- ttl_timer_runtime_ = cyclic_offer_delay_ / 2;
-
- ttl_factor_offers_ = its_configuration->get_ttl_factor_offers();
- ttl_factor_subscriptions_ = its_configuration->get_ttl_factor_subscribes();
- last_msg_received_timer_timeout_ = cyclic_offer_delay_
- + (cyclic_offer_delay_ / 10);
- } else {
- VSOMEIP_ERROR << "SD: no configuration found!";
- }
-}
-
-void service_discovery_impl::start() {
- if (!endpoint_) {
- endpoint_ = host_->create_service_discovery_endpoint(
- sd_multicast_, port_, reliable_);
- if (!endpoint_) {
- VSOMEIP_ERROR << "Couldn't start service discovery";
- return;
- }
- }
-
- if (is_suspended_) {
- // make sure to sent out FindService messages after resume
- std::lock_guard<std::mutex> its_lock(requested_mutex_);
- for (const auto &s : requested_) {
- for (const auto &i : s.second) {
- i.second->set_sent_counter(0);
- }
- }
- if (endpoint_) {
- // rejoin multicast group
- endpoint_->join(sd_multicast_);
- }
- }
- is_suspended_ = false;
- start_main_phase_timer();
- start_offer_debounce_timer(true);
- start_find_debounce_timer(true);
- start_ttl_timer();
-}
-
-void service_discovery_impl::stop() {
- is_suspended_ = true;
- stop_ttl_timer();
- stop_last_msg_received_timer();
-}
-
-void service_discovery_impl::request_service(service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor,
- ttl_t _ttl) {
- std::lock_guard<std::mutex> its_lock(requested_mutex_);
- auto find_service = requested_.find(_service);
- if (find_service != requested_.end()) {
- auto find_instance = find_service->second.find(_instance);
- if (find_instance == find_service->second.end()) {
- find_service->second[_instance] = std::make_shared < request
- > (_major, _minor, _ttl);
- }
- } else {
- requested_[_service][_instance] = std::make_shared < request
- > (_major, _minor, _ttl);
- }
-}
-
-void service_discovery_impl::release_service(service_t _service,
- instance_t _instance) {
- std::lock_guard<std::mutex> its_lock(requested_mutex_);
- auto find_service = requested_.find(_service);
- if (find_service != requested_.end()) {
- find_service->second.erase(_instance);
- }
-}
-
-std::shared_ptr<request>
-service_discovery_impl::find_request(service_t _service, instance_t _instance) {
- std::lock_guard<std::mutex> its_lock(requested_mutex_);
- auto find_service = requested_.find(_service);
- if (find_service != requested_.end()) {
- auto find_instance = find_service->second.find(_instance);
- if (find_instance != find_service->second.end()) {
- return find_instance->second;
- }
- }
- return nullptr;
-}
-
-void service_discovery_impl::subscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, major_version_t _major, ttl_t _ttl, client_t _client,
- subscription_type_e _subscription_type) {
- uint8_t subscribe_count(0);
- {
- std::lock_guard<std::mutex> its_lock(subscribed_mutex_);
- auto found_service = subscribed_.find(_service);
- if (found_service != subscribed_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- auto found_client = found_eventgroup->second.find(_client);
- if (found_client != found_eventgroup->second.end()) {
- if (found_client->second->get_major() != _major) {
- VSOMEIP_ERROR
- << "Subscriptions to different versions of the same "
- "service instance are not supported!";
- }
- return;
- }
- }
- }
- }
-
- const uint8_t max_parallel_subscriptions = 16; // 4Bit Counter field
- subscribe_count = static_cast<uint8_t>(subscribed_[_service][_instance][_eventgroup].size());
- if (subscribe_count >= max_parallel_subscriptions) {
- VSOMEIP_WARNING << "Too many parallel subscriptions (max.16) on same event group: "
- << std::hex << _eventgroup << std::dec;
- return;
- }
- }
-
- std::shared_ptr < endpoint > its_unreliable;
- std::shared_ptr < endpoint > its_reliable;
- bool has_address(false);
- boost::asio::ip::address its_address;
-
- get_subscription_endpoints(its_unreliable, its_reliable,
- &its_address, &has_address, _service, _instance, _client);
-
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (!its_runtime) {
- return;
- }
- std::shared_ptr<message_impl> its_message = its_runtime->create_message();
- {
- std::lock_guard<std::mutex> its_lock(subscribed_mutex_);
- // New subscription
- std::shared_ptr < subscription > its_subscription = std::make_shared
- < subscription > (_major, _ttl, its_reliable, its_unreliable,
- _subscription_type, subscribe_count);
- subscribed_[_service][_instance][_eventgroup][_client] = its_subscription;
- if (has_address) {
-
- if (_client != VSOMEIP_ROUTING_CLIENT) {
- if (its_subscription->get_endpoint(true) &&
- !host_->has_identified(_client, _service, _instance, true)) {
- return;
- }
- if (its_subscription->get_endpoint(false) &&
- !host_->has_identified(_client, _service, _instance, false)) {
- return;
- }
- }
-
- const remote_offer_type_e its_offer_type = get_remote_offer_type(
- _service, _instance);
-
- if (its_offer_type == remote_offer_type_e::UNRELIABLE &&
- !its_subscription->get_endpoint(true) &&
- its_subscription->get_endpoint(false)) {
- if (its_subscription->get_endpoint(false)->is_connected()) {
- insert_subscription(its_message,
- _service, _instance,
- _eventgroup,
- its_subscription, its_offer_type);
- } else {
- its_subscription->set_udp_connection_established(false);
- }
- } else if (its_offer_type == remote_offer_type_e::RELIABLE &&
- its_subscription->get_endpoint(true) &&
- !its_subscription->get_endpoint(false)) {
- if (its_subscription->get_endpoint(true)->is_connected()) {
- insert_subscription(its_message,
- _service, _instance,
- _eventgroup,
- its_subscription, its_offer_type);
- } else {
- its_subscription->set_tcp_connection_established(false);
- }
- } else if (its_offer_type == remote_offer_type_e::RELIABLE_UNRELIABLE &&
- its_subscription->get_endpoint(true) &&
- its_subscription->get_endpoint(false)) {
- if (its_subscription->get_endpoint(true)->is_connected() &&
- its_subscription->get_endpoint(false)->is_connected()) {
- insert_subscription(its_message,
- _service, _instance,
- _eventgroup,
- its_subscription, its_offer_type);
- } else {
- if (!its_subscription->get_endpoint(true)->is_connected()) {
- its_subscription->set_tcp_connection_established(false);
- }
- if (!its_subscription->get_endpoint(false)->is_connected()) {
- its_subscription->set_udp_connection_established(false);
- }
- }
- }
-
- if(0 < its_message->get_entries().size()) {
- its_subscription->set_acknowledged(false);
- }
- }
- }
- if (has_address && its_message->get_entries().size()
- && its_message->get_options().size()) {
- serialize_and_send(its_message, its_address);
- }
-}
-
-void service_discovery_impl::get_subscription_endpoints(
- std::shared_ptr<endpoint>& _unreliable,
- std::shared_ptr<endpoint>& _reliable, boost::asio::ip::address* _address,
- bool* _has_address,
- service_t _service, instance_t _instance, client_t _client) const {
- _reliable = host_->find_or_create_remote_client(_service, _instance,
- true, _client);
- _unreliable = host_->find_or_create_remote_client(_service,
- _instance, false, _client);
- if (_unreliable) {
- std::shared_ptr<client_endpoint> its_client_endpoint =
- std::dynamic_pointer_cast<client_endpoint>(_unreliable);
- if (its_client_endpoint) {
- *_has_address = its_client_endpoint->get_remote_address(
- *_address);
- }
- }
- if (_reliable) {
- std::shared_ptr<client_endpoint> its_client_endpoint =
- std::dynamic_pointer_cast<client_endpoint>(_reliable);
- if (its_client_endpoint) {
- *_has_address = *_has_address
- || its_client_endpoint->get_remote_address(
- *_address);
- }
- }
-}
-
-void service_discovery_impl::unsubscribe(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, client_t _client) {
- std::shared_ptr < runtime > its_runtime = runtime_.lock();
- if(!its_runtime) {
- return;
- }
- std::shared_ptr < message_impl > its_message = its_runtime->create_message();
- boost::asio::ip::address its_address;
- bool has_address(false);
- {
- std::lock_guard<std::mutex> its_lock(subscribed_mutex_);
- std::shared_ptr < subscription > its_subscription;
- auto found_service = subscribed_.find(_service);
- if (found_service != subscribed_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- const remote_offer_type_e its_offer_type = get_remote_offer_type(
- _service, _instance);
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- auto found_client = found_eventgroup->second.find(_client);
- if (found_client != found_eventgroup->second.end()) {
- its_subscription = found_client->second;
- its_subscription->set_ttl(0);
- found_eventgroup->second.erase(_client);
- auto endpoint = its_subscription->get_endpoint(false);
- if (endpoint) {
- std::shared_ptr<client_endpoint> its_client_endpoint =
- std::dynamic_pointer_cast<client_endpoint>(
- endpoint);
- if (its_client_endpoint) {
- has_address =
- its_client_endpoint->get_remote_address(
- its_address);
- }
- } else {
- endpoint = its_subscription->get_endpoint(true);
- if (endpoint) {
- std::shared_ptr<client_endpoint> its_client_endpoint =
- std::dynamic_pointer_cast<
- client_endpoint>(endpoint);
- if (its_client_endpoint) {
- has_address =
- its_client_endpoint->get_remote_address(
- its_address);
- }
- } else {
- return;
- }
- }
- insert_subscription(its_message, _service, _instance,
- _eventgroup, its_subscription, its_offer_type);
- }
- }
- }
- }
- }
- if (has_address && its_message->get_entries().size()
- && its_message->get_options().size()) {
- serialize_and_send(its_message, its_address);
- }
-}
-
-void service_discovery_impl::unsubscribe_all(service_t _service, instance_t _instance) {
- std::lock_guard<std::mutex> its_lock(subscribed_mutex_);
- auto found_service = subscribed_.find(_service);
- if (found_service != subscribed_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- for (auto &its_eventgroup : found_instance->second) {
- for (auto its_client : its_eventgroup.second) {
- its_client.second->set_acknowledged(true);
- its_client.second->set_endpoint(nullptr, true);
- its_client.second->set_endpoint(nullptr, false);
- }
- }
- }
- }
-}
-
-void service_discovery_impl::unsubscribe_client(service_t _service,
- instance_t _instance,
- client_t _client) {
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (!its_runtime) {
- return;
- }
- std::shared_ptr < message_impl > its_message = its_runtime->create_message();
- boost::asio::ip::address its_address;
- bool has_address(false);
- {
- std::lock_guard<std::mutex> its_lock(subscribed_mutex_);
- std::shared_ptr < subscription > its_subscription;
- auto found_service = subscribed_.find(_service);
- if (found_service != subscribed_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- const remote_offer_type_e its_offer_type = get_remote_offer_type(
- _service, _instance);
- for (auto &found_eventgroup : found_instance->second) {
- auto found_client = found_eventgroup.second.find(_client);
- if (found_client != found_eventgroup.second.end()) {
- its_subscription = found_client->second;
- its_subscription->set_ttl(0);
- found_eventgroup.second.erase(_client);
- if (!has_address) {
- auto endpoint = its_subscription->get_endpoint(
- false);
- if (endpoint) {
- std::shared_ptr<client_endpoint> its_client_endpoint =
- std::dynamic_pointer_cast<
- client_endpoint>(endpoint);
- if (its_client_endpoint) {
- has_address =
- its_client_endpoint->get_remote_address(
- its_address);
- }
- } else {
- endpoint = its_subscription->get_endpoint(true);
- if (endpoint) {
- std::shared_ptr<client_endpoint> its_client_endpoint =
- std::dynamic_pointer_cast<
- client_endpoint>(endpoint);
- if (its_client_endpoint) {
- has_address =
- its_client_endpoint->get_remote_address(
- its_address);
- }
- } else {
- return;
- }
- }
- }
- insert_subscription(its_message, _service, _instance,
- found_eventgroup.first, its_subscription, its_offer_type);
- }
- }
- }
- }
- }
- if (has_address && its_message->get_entries().size()
- && its_message->get_options().size()) {
- serialize_and_send(its_message, its_address);
- }
-}
-
-std::pair<session_t, bool> service_discovery_impl::get_session(
- const boost::asio::ip::address &_address) {
- std::pair<session_t, bool> its_session;
- auto found_session = sessions_sent_.find(_address);
- if (found_session == sessions_sent_.end()) {
- its_session = sessions_sent_[_address] = { 1, true };
- } else {
- its_session = found_session->second;
- }
- return its_session;
-}
-
-void service_discovery_impl::increment_session(
- const boost::asio::ip::address &_address) {
- auto found_session = sessions_sent_.find(_address);
- if (found_session != sessions_sent_.end()) {
- found_session->second.first++;
- if (found_session->second.first == 0) {
- found_session->second = { 1, false };
- }
- }
-}
-
-bool service_discovery_impl::is_reboot(
- const boost::asio::ip::address &_sender,
- const boost::asio::ip::address &_destination,
- bool _reboot_flag, session_t _session) {
- bool result(false);
-
- auto its_received = sessions_received_.find(_sender);
- bool is_multicast = _destination.is_multicast();
-
- // Initialize both sessions with 0. Thus, the session identifier
- // for the session not being received from the network is stored
- // as 0 and will never trigger the reboot detection.
- session_t its_multicast_session(0), its_unicast_session(0);
-
- // Initialize both flags with true. Thus, the flag not being
- // received from the network will never trigger the reboot detection.
- bool its_multicast_reboot_flag(true), its_unicast_reboot_flag(true);
-
- if (is_multicast) {
- its_multicast_session = _session;
- its_multicast_reboot_flag = _reboot_flag;
- } else {
- its_unicast_session = _session;
- its_unicast_reboot_flag = _reboot_flag;
- }
-
- if (its_received == sessions_received_.end()) {
- sessions_received_[_sender]
- = std::make_tuple(its_multicast_session, its_unicast_session,
- its_multicast_reboot_flag, its_unicast_reboot_flag);
- } else {
- // Reboot detection: Either the flag has changed from false to true,
- // or the session identifier overrun while the flag is true.
- if (_reboot_flag
- && ((is_multicast && !std::get<2>(its_received->second))
- || (!is_multicast && !std::get<3>(its_received->second)))) {
- result = true;
- } else {
- session_t its_old_session;
- bool its_old_reboot_flag;
-
- if (is_multicast) {
- its_old_session = std::get<0>(its_received->second);
- its_old_reboot_flag = std::get<2>(its_received->second);
- } else {
- its_old_session = std::get<1>(its_received->second);
- its_old_reboot_flag = std::get<3>(its_received->second);
- }
-
- if (its_old_reboot_flag && _reboot_flag
- && its_old_session >= _session) {
- result = true;
- }
- }
-
- if (result == false) {
- // no reboot -> update session/flag
- if (is_multicast) {
- std::get<0>(its_received->second) = its_multicast_session;
- std::get<2>(its_received->second) = its_multicast_reboot_flag;
- } else {
- std::get<1>(its_received->second) = its_unicast_session;
- std::get<3>(its_received->second) = its_unicast_reboot_flag;
- }
- } else {
- // reboot -> reset the sender data
- sessions_received_.erase(_sender);
- }
- }
-
- return result;
-}
-
-template<class Option, typename AddressType>
-std::shared_ptr<option_impl> service_discovery_impl::find_existing_option(
- std::shared_ptr<message_impl> &_message,
- AddressType _address,
- uint16_t _port, layer_four_protocol_e _protocol,
- option_type_e _option_type) {
- if (_message->get_options().size() > 0) {
- std::uint16_t option_length(0x0);
- if(_option_type == option_type_e::IP4_ENDPOINT ||
- _option_type == option_type_e::IP4_MULTICAST) {
- option_length = 0x9;
- } else if(_option_type == option_type_e::IP6_ENDPOINT ||
- _option_type == option_type_e::IP6_MULTICAST) {
- option_length = 0x15;
- } else { // unsupported option type
- return nullptr;
- }
-
- bool is_multicast(false);
- if(_option_type == option_type_e::IP4_MULTICAST ||
- _option_type == option_type_e::IP6_MULTICAST) {
- is_multicast = true;
- }
-
- std::vector<std::shared_ptr<option_impl>> its_options =
- _message->get_options();
- for (const std::shared_ptr<option_impl>& opt : its_options) {
- if (opt->get_length() == option_length &&
- opt->get_type() == _option_type &&
- std::static_pointer_cast<ip_option_impl>(opt)->get_layer_four_protocol() == _protocol &&
- std::static_pointer_cast<ip_option_impl>(opt)->get_port() == _port &&
- std::static_pointer_cast<Option>(opt)->is_multicast() == is_multicast &&
- std::static_pointer_cast<Option>(opt)->get_address() == _address) {
- return opt;
- }
- }
- }
- return nullptr;
-}
-template<class Option, typename AddressType>
-bool service_discovery_impl::check_message_for_ip_option_and_assign_existing(
- std::shared_ptr<message_impl> &_message,
- std::shared_ptr<entry_impl> _entry, AddressType _address,
- uint16_t _port, layer_four_protocol_e _protocol,
- option_type_e _option_type) {
-
- std::shared_ptr<option_impl> its_option
- = find_existing_option<Option, AddressType>(_message, _address, _port, _protocol, _option_type);
- if (its_option) {
- _entry->assign_option(its_option);
- return true;
- }
- return false;
-}
-
-template<class Option, typename AddressType>
-void service_discovery_impl::assign_ip_option_to_entry(
- std::shared_ptr<Option> _option, AddressType _address,
- uint16_t _port, layer_four_protocol_e _protocol,
- std::shared_ptr<entry_impl> _entry) {
- if (_option) {
- _option->set_address(_address);
- _option->set_port(_port);
- _option->set_layer_four_protocol(_protocol);
- _entry->assign_option(_option);
- }
-}
-
-void service_discovery_impl::insert_option(
- std::shared_ptr<message_impl> &_message,
- std::shared_ptr<entry_impl> _entry,
- const boost::asio::ip::address &_address, uint16_t _port,
- bool _is_reliable) {
- layer_four_protocol_e its_protocol =
- _is_reliable ? layer_four_protocol_e::TCP :
- layer_four_protocol_e::UDP;
- bool entry_assigned(false);
-
- if (unicast_ == _address) {
- if (unicast_.is_v4()) {
- ipv4_address_t its_address = unicast_.to_v4().to_bytes();
- entry_assigned = check_message_for_ip_option_and_assign_existing<
- ipv4_option_impl, ipv4_address_t>(_message, _entry,
- its_address, _port, its_protocol,
- option_type_e::IP4_ENDPOINT);
- if(!entry_assigned) {
- std::shared_ptr < ipv4_option_impl > its_option =
- _message->create_ipv4_option(false);
- assign_ip_option_to_entry<ipv4_option_impl, ipv4_address_t>(
- its_option, its_address, _port, its_protocol, _entry);
- }
- } else {
- ipv6_address_t its_address = unicast_.to_v6().to_bytes();
- entry_assigned = check_message_for_ip_option_and_assign_existing<
- ipv6_option_impl, ipv6_address_t>(_message, _entry,
- its_address, _port, its_protocol,
- option_type_e::IP6_ENDPOINT);
- if(!entry_assigned) {
- std::shared_ptr < ipv6_option_impl > its_option =
- _message->create_ipv6_option(false);
- assign_ip_option_to_entry<ipv6_option_impl, ipv6_address_t>(
- its_option, its_address, _port, its_protocol, _entry);
- }
- }
- } else {
- if (_address.is_v4()) {
- ipv4_address_t its_address = _address.to_v4().to_bytes();
- entry_assigned = check_message_for_ip_option_and_assign_existing<
- ipv4_option_impl, ipv4_address_t>(_message, _entry,
- its_address, _port, its_protocol,
- option_type_e::IP4_MULTICAST);
- if(!entry_assigned) {
- std::shared_ptr < ipv4_option_impl > its_option =
- _message->create_ipv4_option(true);
- assign_ip_option_to_entry<ipv4_option_impl, ipv4_address_t>(
- its_option, its_address, _port, its_protocol, _entry);
- }
- } else {
- ipv6_address_t its_address = _address.to_v6().to_bytes();
- entry_assigned = check_message_for_ip_option_and_assign_existing<
- ipv6_option_impl, ipv6_address_t>(_message, _entry,
- its_address, _port, its_protocol,
- option_type_e::IP6_MULTICAST);
- if(!entry_assigned) {
- std::shared_ptr < ipv6_option_impl > its_option =
- _message->create_ipv6_option(true);
- assign_ip_option_to_entry<ipv6_option_impl, ipv6_address_t>(
- its_option, its_address, _port, its_protocol, _entry);
- }
- }
- }
-}
-
-void service_discovery_impl::insert_find_entries(
- std::shared_ptr<message_impl> &_message, const requests_t &_requests,
- uint32_t _start, uint32_t &_size, bool &_done) {
- std::lock_guard<std::mutex> its_lock(requested_mutex_);
- uint32_t its_size(0);
- uint32_t i = 0;
-
- _done = true;
- for (auto its_service : _requests) {
- for (auto its_instance : its_service.second) {
- auto its_request = its_instance.second;
-
- // check if release_service was called
- auto the_service = requested_.find(its_service.first);
- if ( the_service != requested_.end() ) {
- auto the_instance = the_service->second.find(its_instance.first);
- if(the_instance != the_service->second.end() ) {
- uint8_t its_sent_counter = its_request->get_sent_counter();
- if (its_sent_counter != repetitions_max_ + 1) {
- if (i >= _start) {
- if (its_size + VSOMEIP_SOMEIP_SD_ENTRY_SIZE <= max_message_size_) {
- std::shared_ptr < serviceentry_impl > its_entry =
- _message->create_service_entry();
- if (its_entry) {
- its_entry->set_type(entry_type_e::FIND_SERVICE);
- its_entry->set_service(its_service.first);
- its_entry->set_instance(its_instance.first);
- its_entry->set_major_version(its_request->get_major());
- its_entry->set_minor_version(its_request->get_minor());
- its_entry->set_ttl(its_request->get_ttl());
- its_size += VSOMEIP_SOMEIP_SD_ENTRY_SIZE;
- its_sent_counter++;
-
- its_request->set_sent_counter(its_sent_counter);
- } else {
- VSOMEIP_ERROR << "Failed to create service entry!";
- }
- } else {
- _done = false;
- _size = its_size;
- return;
- }
- }
- }
- i++;
- }
- }
-
- }
- }
- _size = its_size;
-}
-
-void service_discovery_impl::insert_offer_entries(
- std::shared_ptr<message_impl> &_message, const services_t &_services,
- uint32_t &_start, uint32_t _size, bool &_done, bool _ignore_phase) {
- uint32_t i = 0;
- uint32_t its_size(_size);
- for (const auto its_service : _services) {
- for (const auto its_instance : its_service.second) {
- if ((!is_suspended_)
- && ((!is_diagnosis_) || (is_diagnosis_ && !host_->get_configuration()->is_someip(its_service.first, its_instance.first)))) {
- // Only insert services with configured endpoint(s)
- if ((_ignore_phase || its_instance.second->is_in_mainphase())
- && (its_instance.second->get_endpoint(false)
- || its_instance.second->get_endpoint(true))) {
- if (i >= _start) {
- if (!insert_offer_service(_message, its_service.first,
- its_instance.first, its_instance.second, its_size)) {
- _start = i;
- _done = false;
- return;
- }
- }
- }
- i++;
- }
- }
- }
- _start = i;
- _done = true;
-}
-
-bool service_discovery_impl::insert_subscription(
- std::shared_ptr<message_impl> &_message, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- std::shared_ptr<subscription> &_subscription,
- remote_offer_type_e _offer_type) {
- bool ret(false);
- std::shared_ptr<endpoint> its_reliable_endpoint(_subscription->get_endpoint(true));
- std::shared_ptr<endpoint> its_unreliable_endpoint(_subscription->get_endpoint(false));
-
- bool insert_reliable(false);
- bool insert_unreliable(false);
- switch (_offer_type) {
- case remote_offer_type_e::RELIABLE:
- if (its_reliable_endpoint) {
- insert_reliable = true;
- }
- break;
- case remote_offer_type_e::UNRELIABLE:
- if (its_unreliable_endpoint) {
- insert_unreliable = true;
- }
- break;
- case remote_offer_type_e::RELIABLE_UNRELIABLE:
- if (its_reliable_endpoint && its_unreliable_endpoint) {
- insert_reliable = true;
- insert_unreliable = true;
- }
- break;
- default:
- break;
- }
-
- if (!insert_reliable && !insert_unreliable) {
- VSOMEIP_WARNING << __func__ << ": Didn't insert subscription as "
- "subscription doesn't match offer type: ["
- << 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 << "] "
- << _offer_type;
- return false;
- }
- std::shared_ptr<eventgroupentry_impl> its_entry;
- if (insert_reliable && its_reliable_endpoint) {
- const std::uint16_t its_port = its_reliable_endpoint->get_local_port();
- if (its_port) {
- its_entry = _message->create_eventgroup_entry();
- its_entry->set_type(entry_type_e::SUBSCRIBE_EVENTGROUP);
- its_entry->set_service(_service);
- its_entry->set_instance(_instance);
- its_entry->set_eventgroup(_eventgroup);
- its_entry->set_counter(_subscription->get_counter());
- its_entry->set_major_version(_subscription->get_major());
- its_entry->set_ttl(_subscription->get_ttl());
- insert_option(_message, its_entry, unicast_, its_port, true);
- ret = true;
- } else {
- VSOMEIP_WARNING << __func__ << ": Didn't insert subscription as "
- "local reliable port is zero: ["
- << 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 << "]";
- ret = false;
- }
- }
- if (insert_unreliable && its_unreliable_endpoint) {
- const std::uint16_t its_port = its_unreliable_endpoint->get_local_port();
- if (its_port) {
- if (!its_entry) {
- its_entry = _message->create_eventgroup_entry();
- its_entry->set_type(entry_type_e::SUBSCRIBE_EVENTGROUP);
- its_entry->set_service(_service);
- its_entry->set_instance(_instance);
- its_entry->set_eventgroup(_eventgroup);
- its_entry->set_counter(_subscription->get_counter());
- its_entry->set_major_version(_subscription->get_major());
- its_entry->set_ttl(_subscription->get_ttl());
- }
- insert_option(_message, its_entry, unicast_, its_port, false);
- ret = true;
- } else {
- VSOMEIP_WARNING << __func__ << ": Didn't insert subscription as "
- " local unreliable port is zero: ["
- << 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 << "]";
- ret = false;
- }
- }
- return ret;
-}
-
-bool service_discovery_impl::insert_nack_subscription_on_resubscribe(std::shared_ptr<message_impl> &_message,
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- std::shared_ptr<subscription> &_subscription, remote_offer_type_e _offer_type) {
- bool ret(false);
- // SIP_SD_844:
- // This method is used for not acknowledged subscriptions on renew subscription
- // Two entries: Stop subscribe & subscribe within one SD-Message
- // One option: Both entries reference it
-
- const std::function<std::shared_ptr<eventgroupentry_impl>(ttl_t)> insert_entry
- = [&](ttl_t _ttl) {
- std::shared_ptr<eventgroupentry_impl> its_entry =
- _message->create_eventgroup_entry();
- // SUBSCRIBE_EVENTGROUP and STOP_SUBSCRIBE_EVENTGROUP are identical
- its_entry->set_type(entry_type_e::SUBSCRIBE_EVENTGROUP);
- its_entry->set_service(_service);
- its_entry->set_instance(_instance);
- its_entry->set_eventgroup(_eventgroup);
- its_entry->set_counter(_subscription->get_counter());
- its_entry->set_major_version(_subscription->get_major());
- its_entry->set_ttl(_ttl);
- return its_entry;
- };
-
- std::shared_ptr<endpoint> its_reliable_endpoint(_subscription->get_endpoint(true));
- std::shared_ptr<endpoint> its_unreliable_endpoint(_subscription->get_endpoint(false));
-
- if (_offer_type == remote_offer_type_e::UNRELIABLE &&
- !its_reliable_endpoint && its_unreliable_endpoint) {
- if (its_unreliable_endpoint->is_connected()) {
- const std::uint16_t its_port = its_unreliable_endpoint->get_local_port();
- if (its_port) {
- std::shared_ptr<eventgroupentry_impl> its_stop_entry = insert_entry(0);
- std::shared_ptr<eventgroupentry_impl> its_entry = insert_entry(_subscription->get_ttl());
- insert_option(_message, its_stop_entry, unicast_, its_port, false);
- insert_option(_message, its_entry, unicast_, its_port, false);
- ret = true;
- } else {
- VSOMEIP_WARNING << __func__ << ": Didn't insert subscription as "
- "local unreliable port is zero: ["
- << 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 << "]";
- }
- } else {
- _subscription->set_udp_connection_established(false);
- }
- } else if (_offer_type == remote_offer_type_e::RELIABLE &&
- its_reliable_endpoint && !its_unreliable_endpoint) {
- if (its_reliable_endpoint->is_connected()) {
- const std::uint16_t its_port = its_reliable_endpoint->get_local_port();
- if (its_port) {
- std::shared_ptr<eventgroupentry_impl> its_stop_entry = insert_entry(0);
- std::shared_ptr<eventgroupentry_impl> its_entry = insert_entry(_subscription->get_ttl());
- insert_option(_message, its_stop_entry, unicast_, its_port, true);
- insert_option(_message, its_entry, unicast_, its_port, true);
- ret = true;
- } else {
- VSOMEIP_WARNING << __func__ << ": Didn't insert subscription as "
- "local reliable port is zero: ["
- << 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 << "]";
- }
- } else {
- _subscription->set_tcp_connection_established(false);
- }
- } else if (_offer_type == remote_offer_type_e::RELIABLE_UNRELIABLE &&
- its_reliable_endpoint && its_unreliable_endpoint) {
- if (its_reliable_endpoint->is_connected() &&
- its_unreliable_endpoint->is_connected()) {
- const std::uint16_t its_reliable_port = its_reliable_endpoint->get_local_port();
- const std::uint16_t its_unreliable_port = its_unreliable_endpoint->get_local_port();
- if (its_reliable_port && its_unreliable_port) {
- std::shared_ptr<eventgroupentry_impl> its_stop_entry = insert_entry(0);
- std::shared_ptr<eventgroupentry_impl> its_entry = insert_entry(_subscription->get_ttl());
- insert_option(_message, its_stop_entry, unicast_, its_reliable_port, true);
- insert_option(_message, its_entry, unicast_, its_reliable_port, true);
- insert_option(_message, its_stop_entry, unicast_, its_unreliable_port, false);
- insert_option(_message, its_entry, unicast_, its_unreliable_port, false);
- ret = true;
- } else if (!its_reliable_port) {
- VSOMEIP_WARNING << __func__ << ": Didn't insert subscription as "
- "local reliable port is zero: ["
- << 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 << "]";
- } else if (!its_unreliable_port) {
- VSOMEIP_WARNING << __func__ << ": Didn't insert subscription as "
- "local unreliable port is zero: ["
- << 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 << "]";
- }
- } else {
- if (!its_reliable_endpoint->is_connected()) {
- _subscription->set_tcp_connection_established(false);
- }
- if (!its_unreliable_endpoint->is_connected()) {
- _subscription->set_udp_connection_established(false);
- }
- }
- } else {
- VSOMEIP_WARNING << __func__ << ": Couldn't insert StopSubscribe/Subscribe ["
- << 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 << "] "
- << _offer_type;
- }
- return ret;
-}
-
-void service_discovery_impl::insert_subscription_ack(
- std::shared_ptr<message_impl> &_message, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- const std::shared_ptr<eventgroupinfo> &_info, ttl_t _ttl,
- uint8_t _counter, major_version_t _major, uint16_t _reserved,
- const std::shared_ptr<endpoint_definition> &_target) {
- std::unique_lock<std::mutex> its_lock(_message->get_message_lock());
- _message->increase_number_contained_acks();
- for (auto its_entry : _message->get_entries()) {
- if (its_entry->is_eventgroup_entry()) {
- std::shared_ptr < eventgroupentry_impl > its_eventgroup_entry =
- std::dynamic_pointer_cast < eventgroupentry_impl
- > (its_entry);
- if(its_eventgroup_entry->get_type() == entry_type_e::SUBSCRIBE_EVENTGROUP_ACK
- && its_eventgroup_entry->get_service() == _service
- && its_eventgroup_entry->get_instance() == _instance
- && its_eventgroup_entry->get_eventgroup() == _eventgroup
- && its_eventgroup_entry->get_major_version() == _major
- && its_eventgroup_entry->get_reserved() == _reserved
- && its_eventgroup_entry->get_counter() == _counter
- && its_eventgroup_entry->get_ttl() == _ttl) {
- if (_target) {
- if (_target->is_reliable()) {
- if (!its_eventgroup_entry->get_target(true)) {
- its_eventgroup_entry->add_target(_target);
- }
- } else {
- if (!its_eventgroup_entry->get_target(false)) {
- its_eventgroup_entry->add_target(_target);
- }
- }
- }
- return;
- }
- }
- }
-
- std::shared_ptr < eventgroupentry_impl > its_entry =
- _message->create_eventgroup_entry();
- its_entry->set_type(entry_type_e::SUBSCRIBE_EVENTGROUP_ACK);
- its_entry->set_service(_service);
- its_entry->set_instance(_instance);
- its_entry->set_eventgroup(_eventgroup);
- its_entry->set_major_version(_major);
- its_entry->set_reserved(_reserved);
- its_entry->set_counter(_counter);
- // SWS_SD_00315
- its_entry->set_ttl(_ttl);
- if (_target) {
- its_entry->add_target(_target);
- }
-
- boost::asio::ip::address its_address;
- uint16_t its_port;
- if (_info->get_multicast(its_address, its_port)) {
- insert_option(_message, its_entry, its_address, its_port, false);
- }
-}
-
-void service_discovery_impl::insert_subscription_nack(
- std::shared_ptr<message_impl> &_message, service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- uint8_t _counter, major_version_t _major, uint16_t _reserved) {
- std::unique_lock<std::mutex> its_lock(_message->get_message_lock());
- std::shared_ptr < eventgroupentry_impl > its_entry =
- _message->create_eventgroup_entry();
- // SWS_SD_00316 and SWS_SD_00385
- its_entry->set_type(entry_type_e::STOP_SUBSCRIBE_EVENTGROUP_ACK);
- its_entry->set_service(_service);
- its_entry->set_instance(_instance);
- its_entry->set_eventgroup(_eventgroup);
- its_entry->set_major_version(_major);
- its_entry->set_reserved(_reserved);
- its_entry->set_counter(_counter);
- // SWS_SD_00432
- its_entry->set_ttl(0x0);
- _message->increase_number_contained_acks();
-}
-
-bool service_discovery_impl::send(bool _is_announcing) {
- std::shared_ptr < runtime > its_runtime = runtime_.lock();
- if (its_runtime) {
- std::vector< std::shared_ptr< message_impl > > its_messages;
- std::shared_ptr < message_impl > its_message;
-
- if(_is_announcing) {
- its_message = its_runtime->create_message();
- its_messages.push_back(its_message);
-
- services_t its_offers = host_->get_offered_services();
- fill_message_with_offer_entries(its_runtime, its_message,
- its_messages, its_offers, false);
-
- // Serialize and send
- return serialize_and_send_messages(its_messages);
- }
- }
- return false;
-}
-
-// Interface endpoint_host
-void service_discovery_impl::on_message(const byte_t *_data, length_t _length,
- const boost::asio::ip::address &_sender,
- const boost::asio::ip::address &_destination) {
-#if 0
- std::stringstream msg;
- msg << "sdi::on_message: ";
- for (length_t i = 0; i < _length; ++i)
- msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " ";
- VSOMEIP_INFO << msg.str();
-#endif
- if(is_suspended_) {
- return;
- }
- // ignore all SD messages with source address equal to node's unicast address
- if (!check_source_address(_sender)) {
- return;
- }
- if (_destination == sd_multicast_address_) {
- std::lock_guard<std::mutex> its_lock(last_msg_received_timer_mutex_);
- boost::system::error_code ec;
- last_msg_received_timer_.cancel(ec);
- last_msg_received_timer_.expires_from_now(last_msg_received_timer_timeout_, ec);
- last_msg_received_timer_.async_wait(
- std::bind(
- &service_discovery_impl::on_last_msg_received_timer_expired,
- shared_from_this(), std::placeholders::_1));
- }
-
- current_remote_address_ = _sender;
- deserializer_->set_data(_data, _length);
- std::shared_ptr < message_impl
- > its_message(deserializer_->deserialize_sd_message());
- deserializer_->reset();
- if (its_message) {
- // ignore all messages which are sent with invalid header fields
- if(!check_static_header_fields(its_message)) {
- return;
- }
- // Expire all subscriptions / services in case of reboot
- if (is_reboot(_sender, _destination,
- its_message->get_reboot_flag(), its_message->get_session())) {
- VSOMEIP_INFO << "Reboot detected: IP=" << _sender.to_string();
- remove_remote_offer_type_by_ip(_sender);
- host_->expire_subscriptions(_sender);
- host_->expire_services(_sender);
- }
-
- std::vector < std::shared_ptr<option_impl> > its_options =
- its_message->get_options();
-
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (!its_runtime) {
- return;
- }
-
- std::shared_ptr < message_impl > its_message_response
- = its_runtime->create_message();
-
- const std::uint8_t its_required_acks =
- its_message->get_number_required_acks();
- its_message_response->set_number_required_acks(its_required_acks);
- std::shared_ptr<sd_message_identifier_t> its_message_id =
- std::make_shared<sd_message_identifier_t>(
- its_message->get_session(), _sender, _destination,
- its_message_response);
-
- std::vector<std::pair<std::uint16_t, std::shared_ptr<message_impl>>> its_resubscribes;
- // 28 Bytes for SD-Header + Length Entries and Options Array
- its_resubscribes.push_back(std::make_pair(28, its_runtime->create_message()));
-
- const message_impl::entries_t& its_entries = its_message->get_entries();
- const message_impl::entries_t::const_iterator its_end = its_entries.end();
- bool is_stop_subscribe_subscribe(false);
-
- for (auto iter = its_entries.begin(); iter != its_end; iter++) {
- if ((*iter)->is_service_entry()) {
- std::shared_ptr < serviceentry_impl > its_service_entry =
- std::dynamic_pointer_cast < serviceentry_impl
- > (*iter);
- bool its_unicast_flag = its_message->get_unicast_flag();
- process_serviceentry(its_service_entry, its_options,
- its_unicast_flag, &its_resubscribes);
- } else {
- std::shared_ptr < eventgroupentry_impl > its_eventgroup_entry =
- std::dynamic_pointer_cast < eventgroupentry_impl
- > (*iter);
- bool force_initial_events(false);
- if (is_stop_subscribe_subscribe) {
- force_initial_events = true;
- }
- is_stop_subscribe_subscribe = check_stop_subscribe_subscribe(
- iter, its_end, its_message->get_options());
- process_eventgroupentry(its_eventgroup_entry, its_options,
- its_message_response, _destination,
- its_message_id, is_stop_subscribe_subscribe, force_initial_events);
- }
- }
-
- // send answer directly if SubscribeEventgroup entries were (n)acked
- if (its_required_acks || its_message_response->get_number_required_acks() > 0) {
- bool sent(false);
- {
- std::lock_guard<std::mutex> its_lock(response_mutex_);
- if (its_message_response->all_required_acks_contained()) {
- update_subscription_expiration_timer(its_message_response);
- serialize_and_send(its_message_response, _sender);
- // set required acks to 0xFF to mark message as sent
- its_message_response->set_number_required_acks((std::numeric_limits<uint8_t>::max)());
- sent = true;
- }
- }
- if (sent) {
- for (const auto &fie : its_message_response->forced_initial_events_get()) {
- host_->send_initial_events(fie.service_, fie.instance_,
- fie.eventgroup_, fie.target_);
- }
- }
- }
- for (const auto& response : its_resubscribes) {
- if (response.second->get_entries().size() && response.second->get_options().size()) {
- serialize_and_send(response.second, _sender);
- }
- }
- } else {
- VSOMEIP_ERROR << "service_discovery_impl::on_message: deserialization error.";
- return;
- }
-}
-
-// Entry processing
-void service_discovery_impl::process_serviceentry(
- std::shared_ptr<serviceentry_impl> &_entry,
- const std::vector<std::shared_ptr<option_impl> > &_options,
- bool _unicast_flag,
- std::vector<std::pair<std::uint16_t, std::shared_ptr<message_impl>>>* _resubscribes) {
-
- // Read service info from entry
- entry_type_e its_type = _entry->get_type();
- service_t its_service = _entry->get_service();
- instance_t its_instance = _entry->get_instance();
- major_version_t its_major = _entry->get_major_version();
- minor_version_t its_minor = _entry->get_minor_version();
- ttl_t its_ttl = _entry->get_ttl();
-
- // Read address info from options
- boost::asio::ip::address its_reliable_address;
- uint16_t its_reliable_port(ILLEGAL_PORT);
-
- boost::asio::ip::address its_unreliable_address;
- uint16_t its_unreliable_port(ILLEGAL_PORT);
-
- for (auto i : { 1, 2 }) {
- for (auto its_index : _entry->get_options(uint8_t(i))) {
- if( _options.size() > its_index ) {
- std::shared_ptr < option_impl > its_option = _options[its_index];
-
- switch (its_option->get_type()) {
- case option_type_e::IP4_ENDPOINT: {
- std::shared_ptr < ipv4_option_impl > its_ipv4_option =
- std::dynamic_pointer_cast < ipv4_option_impl
- > (its_option);
-
- boost::asio::ip::address_v4 its_ipv4_address(
- its_ipv4_option->get_address());
-
- if (its_ipv4_option->get_layer_four_protocol()
- == layer_four_protocol_e::UDP) {
-
-
- its_unreliable_address = its_ipv4_address;
- its_unreliable_port = its_ipv4_option->get_port();
- } else {
- its_reliable_address = its_ipv4_address;
- its_reliable_port = its_ipv4_option->get_port();
- }
- break;
- }
- case option_type_e::IP6_ENDPOINT: {
- std::shared_ptr < ipv6_option_impl > its_ipv6_option =
- std::dynamic_pointer_cast < ipv6_option_impl
- > (its_option);
-
- boost::asio::ip::address_v6 its_ipv6_address(
- its_ipv6_option->get_address());
-
- if (its_ipv6_option->get_layer_four_protocol()
- == layer_four_protocol_e::UDP) {
- its_unreliable_address = its_ipv6_address;
- its_unreliable_port = its_ipv6_option->get_port();
- } else {
- its_reliable_address = its_ipv6_address;
- its_reliable_port = its_ipv6_option->get_port();
- }
- break;
- }
- case option_type_e::IP4_MULTICAST:
- case option_type_e::IP6_MULTICAST:
- break;
- case option_type_e::CONFIGURATION:
- break;
- case option_type_e::UNKNOWN:
- default:
- VSOMEIP_ERROR << "Unsupported service option";
- break;
- }
- }
- }
- }
-
- if (0 < its_ttl) {
- switch(its_type) {
- case entry_type_e::FIND_SERVICE:
- process_findservice_serviceentry(its_service, its_instance,
- its_major, its_minor, _unicast_flag);
- break;
- case entry_type_e::OFFER_SERVICE:
- process_offerservice_serviceentry(its_service, its_instance,
- its_major, its_minor, its_ttl,
- its_reliable_address, its_reliable_port,
- its_unreliable_address, its_unreliable_port, _resubscribes);
- break;
- case entry_type_e::UNKNOWN:
- default:
- VSOMEIP_ERROR << "Unsupported serviceentry type";
- }
-
- } else {
- std::shared_ptr<request> its_request = find_request(its_service, its_instance);
- if (its_request) {
- std::lock_guard<std::mutex> its_lock(requested_mutex_);
- // ID: SIP_SD_830
- its_request->set_sent_counter(std::uint8_t(repetitions_max_ + 1));
- }
- remove_remote_offer_type(its_service, its_instance,
- (its_reliable_port != ILLEGAL_PORT ?
- its_reliable_address : its_unreliable_address));
- unsubscribe_all(its_service, its_instance);
- if (!is_diagnosis_ && !is_suspended_) {
- host_->del_routing_info(its_service, its_instance,
- (its_reliable_port != ILLEGAL_PORT),
- (its_unreliable_port != ILLEGAL_PORT));
- }
- }
-}
-
-void service_discovery_impl::process_offerservice_serviceentry(
- service_t _service, instance_t _instance, major_version_t _major,
- minor_version_t _minor, ttl_t _ttl,
- const boost::asio::ip::address &_reliable_address,
- uint16_t _reliable_port,
- const boost::asio::ip::address &_unreliable_address,
- uint16_t _unreliable_port,
- std::vector<std::pair<std::uint16_t, std::shared_ptr<message_impl>>>* _resubscribes) {
- std::shared_ptr < runtime > its_runtime = runtime_.lock();
- if (!its_runtime)
- return;
-
- std::shared_ptr<request> its_request = find_request(_service, _instance);
- if (its_request) {
- std::lock_guard<std::mutex> its_lock(requested_mutex_);
- its_request->set_sent_counter(std::uint8_t(repetitions_max_ + 1));
- }
- remote_offer_type_e offer_type(remote_offer_type_e::UNKNOWN);
- if (_reliable_port != ILLEGAL_PORT
- && _unreliable_port != ILLEGAL_PORT
- && !_reliable_address.is_unspecified()
- && !_unreliable_address.is_unspecified()) {
- offer_type = remote_offer_type_e::RELIABLE_UNRELIABLE;
- } else if (_unreliable_port != ILLEGAL_PORT
- && !_unreliable_address.is_unspecified()) {
- offer_type = remote_offer_type_e::UNRELIABLE;
- } else if (_reliable_port != ILLEGAL_PORT
- && !_reliable_address.is_unspecified()) {
- offer_type = remote_offer_type_e::RELIABLE;
- } else {
- VSOMEIP_WARNING << __func__ << ": unknown remote offer type ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "]";
- }
-
- if (update_remote_offer_type(_service,_instance, offer_type,
- _reliable_address, _unreliable_address)) {
- VSOMEIP_WARNING << __func__ << ": Remote offer type changed ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "]";
- }
-
-
- host_->add_routing_info(_service, _instance,
- _major, _minor,
- _ttl * get_ttl_factor(_service, _instance, ttl_factor_offers_),
- _reliable_address, _reliable_port,
- _unreliable_address, _unreliable_port);
-
- const std::function<void(std::uint16_t)> check_space =
- [&_resubscribes, &its_runtime](std::uint16_t _number) {
- if (_resubscribes->back().first + _number > VSOMEIP_MAX_UDP_MESSAGE_SIZE) {
- // 28 Bytes for SD-Header + Length Entries and Options Array
- _resubscribes->push_back(std::make_pair(28 + _number,
- its_runtime->create_message()));
- } else {
- _resubscribes->back().first =
- static_cast<std::uint16_t>(_resubscribes->back().first + _number);
- }
- };
-
- std::lock_guard<std::mutex> its_lock(subscribed_mutex_);
- auto found_service = subscribed_.find(_service);
- if (found_service != subscribed_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- if (0 < found_instance->second.size()) {
- const remote_offer_type_e its_offer_type =
- get_remote_offer_type(_service, _instance);
- for (auto its_eventgroup : found_instance->second) {
- for (auto its_client : its_eventgroup.second) {
- std::shared_ptr<subscription> its_subscription(its_client.second);
- std::shared_ptr<endpoint> its_unreliable;
- std::shared_ptr<endpoint> its_reliable;
- bool has_address(false);
- boost::asio::ip::address its_address;
- get_subscription_endpoints(
- its_unreliable, its_reliable, &its_address,
- &has_address, _service, _instance,
- its_client.first);
- its_subscription->set_endpoint(its_reliable, true);
- its_subscription->set_endpoint(its_unreliable, false);
- if (its_client.first != VSOMEIP_ROUTING_CLIENT) {
- if (its_client.second->get_endpoint(true) &&
- !host_->has_identified(its_client.first, _service,
- _instance, true)) {
- continue;
- }
- if (its_client.second->get_endpoint(false) &&
- !host_->has_identified(its_client.first, _service,
- _instance, false)) {
- continue;
- }
- }
-
- if (its_subscription->is_acknowledged()) {
- if (its_offer_type == remote_offer_type_e::UNRELIABLE) {
- if (its_unreliable && its_unreliable->is_connected()) {
- // 28 = 16 (subscription) + 12 (option)
- check_space(28);
- const std::size_t options_size_before =
- _resubscribes->back().second->get_options().size();
- if (insert_subscription(_resubscribes->back().second,
- _service, _instance,
- its_eventgroup.first,
- its_subscription, its_offer_type)) {
- its_subscription->set_acknowledged(false);
- const std::size_t options_size_after =
- _resubscribes->back().second->get_options().size();
- const std::size_t diff = options_size_after - options_size_before;
- _resubscribes->back().first =
- static_cast<std::uint16_t>(
- _resubscribes->back().first + (12u * diff - 12u));
- } else {
- _resubscribes->back().first =
- static_cast<std::uint16_t>(
- _resubscribes->back().first - 28);
- }
- }
- } else if (its_offer_type == remote_offer_type_e::RELIABLE) {
- if (its_reliable && its_reliable->is_connected()) {
- // 28 = 16 (subscription) + 12 (option)
- check_space(28);
- const std::size_t options_size_before =
- _resubscribes->back().second->get_options().size();
- if (insert_subscription(_resubscribes->back().second,
- _service, _instance,
- its_eventgroup.first,
- its_subscription, its_offer_type)) {
- its_subscription->set_acknowledged(false);
- const std::size_t options_size_after =
- _resubscribes->back().second->get_options().size();
- const std::size_t diff = options_size_after - options_size_before;
- _resubscribes->back().first =
- static_cast<std::uint16_t>(
- _resubscribes->back().first + (12u * diff - 12u));
- } else {
- _resubscribes->back().first =
- static_cast<std::uint16_t>(
- _resubscribes->back().first - 28);
- }
- } else {
- its_client.second->set_tcp_connection_established(false);
- // restart TCP endpoint if not connected
- if (its_reliable) {
- its_reliable->restart();
- }
- }
- } else if (its_offer_type == remote_offer_type_e::RELIABLE_UNRELIABLE) {
- if (its_reliable && its_unreliable &&
- its_reliable->is_connected() &&
- its_unreliable->is_connected()) {
- // 40 = 16 (subscription) + 2x12 (option)
- check_space(40);
- const std::size_t options_size_before =
- _resubscribes->back().second->get_options().size();
- if (insert_subscription(_resubscribes->back().second,
- _service, _instance,
- its_eventgroup.first,
- its_subscription, its_offer_type)) {
- its_subscription->set_acknowledged(false);
- const std::size_t options_size_after =
- _resubscribes->back().second->get_options().size();
- const std::size_t diff = options_size_after - options_size_before;
- _resubscribes->back().first =
- static_cast<std::uint16_t>(
- _resubscribes->back().first + (12u * diff - 24u));
- } else {
- _resubscribes->back().first =
- static_cast<std::uint16_t>(
- _resubscribes->back().first - 40);
- }
- } else if (its_reliable && !its_reliable->is_connected()) {
- its_client.second->set_tcp_connection_established(false);
- // restart TCP endpoint if not connected
- its_reliable->restart();
- }
- } else {
- VSOMEIP_WARNING << __func__ << ": unknown remote offer type ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "]";
- }
- } else {
- // 56 = 2x16 (subscription) + 2x12 (option)
- check_space(56);
- const std::size_t options_size_before =
- _resubscribes->back().second->get_options().size();
- if (insert_nack_subscription_on_resubscribe(_resubscribes->back().second,
- _service, _instance, its_eventgroup.first,
- its_subscription, its_offer_type) ) {
- const std::size_t options_size_after =
- _resubscribes->back().second->get_options().size();
- const std::size_t diff = options_size_after - options_size_before;
- _resubscribes->back().first =
- static_cast<std::uint16_t>(
- _resubscribes->back().first + (12u * diff - 24u));
- } else {
- _resubscribes->back().first =
- static_cast<std::uint16_t>(
- _resubscribes->back().first - 56u);
- }
-
- // restart TCP endpoint if not connected
- if (its_reliable && !its_reliable->is_connected()) {
- its_reliable->restart();
- }
- }
- }
- }
- }
- }
- }
-}
-
-void service_discovery_impl::process_findservice_serviceentry(
- service_t _service, instance_t _instance, major_version_t _major,
- minor_version_t _minor, bool _unicast_flag) {
-
- if (_instance != ANY_INSTANCE) {
- std::shared_ptr<serviceinfo> its_info = host_->get_offered_service(
- _service, _instance);
- if (its_info) {
- send_uni_or_multicast_offerservice(_service, _instance, _major,
- _minor, its_info, _unicast_flag);
- }
- } else {
- std::map<instance_t, std::shared_ptr<serviceinfo>> offered_instances =
- host_->get_offered_service_instances(_service);
- // send back all available instances
- for (const auto &found_instance : offered_instances) {
- send_uni_or_multicast_offerservice(_service, _instance, _major,
- _minor, found_instance.second, _unicast_flag);
- }
- }
-}
-
-void service_discovery_impl::send_unicast_offer_service(
- const std::shared_ptr<const serviceinfo> &_info, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor) {
- if (_major == ANY_MAJOR || _major == _info->get_major()) {
- if (_minor == 0xFFFFFFFF || _minor <= _info->get_minor()) {
- if (_info->get_endpoint(false) || _info->get_endpoint(true)) {
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (!its_runtime) {
- return;
- }
- std::shared_ptr<message_impl> its_message =
- its_runtime->create_message();
- uint32_t its_size(max_message_size_);
- insert_offer_service(its_message, _service, _instance, _info,
- its_size);
- if (current_remote_address_.is_unspecified()) {
- VSOMEIP_ERROR << "service_discovery_impl::"
- "send_unicast_offer_service current remote address "
- "is unspecified, won't send offer.";
- } else {
- serialize_and_send(its_message, current_remote_address_);
- }
- }
- }
- }
-}
-
-void service_discovery_impl::send_multicast_offer_service(
- const std::shared_ptr<const serviceinfo> &_info, service_t _service,
- instance_t _instance, major_version_t _major, minor_version_t _minor) {
- if (_major == ANY_MAJOR || _major == _info->get_major()) {
- if (_minor == 0xFFFFFFFF || _minor <= _info->get_minor()) {
- if (_info->get_endpoint(false) || _info->get_endpoint(true)) {
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (!its_runtime) {
- return;
- }
- std::shared_ptr<message_impl> its_message =
- its_runtime->create_message();
-
- uint32_t its_size(max_message_size_);
- insert_offer_service(its_message, _service, _instance, _info,
- its_size);
-
- if (its_message->get_entries().size() > 0) {
- std::lock_guard<std::mutex> its_lock(serialize_mutex_);
- std::pair<session_t, bool> its_session = get_session(
- unicast_);
- its_message->set_session(its_session.first);
- its_message->set_reboot_flag(its_session.second);
- if (host_->send(VSOMEIP_SD_CLIENT, its_message, true)) {
- increment_session(unicast_);
- }
- }
- }
- }
- }
-}
-
-void service_discovery_impl::on_endpoint_connected(
- service_t _service, instance_t _instance,
- const std::shared_ptr<const vsomeip::endpoint> &_endpoint) {
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (!its_runtime) {
- return;
- }
-
- // send out subscriptions for services where the tcp connection
- // wasn't established at time of subscription
-
- std::shared_ptr<message_impl> its_message(its_runtime->create_message());
- bool has_address(false);
- boost::asio::ip::address its_address;
-
- {
- std::lock_guard<std::mutex> its_lock(subscribed_mutex_);
- auto found_service = subscribed_.find(_service);
- if (found_service != subscribed_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- if(0 < found_instance->second.size()) {
- const remote_offer_type_e its_offer_type =
- get_remote_offer_type(_service, _instance);
- for(const auto &its_eventgroup : found_instance->second) {
- for(const auto &its_client : its_eventgroup.second) {
- if (its_client.first != VSOMEIP_ROUTING_CLIENT) {
- if (its_client.second->get_endpoint(true) &&
- !host_->has_identified(its_client.first, _service,
- _instance, true)) {
- continue;
- }
- if (its_client.second->get_endpoint(false) &&
- !host_->has_identified(its_client.first, _service,
- _instance, false)) {
- continue;
- }
- }
- std::shared_ptr<subscription> its_subscription(its_client.second);
- if (its_subscription) {
- if (!its_subscription->is_tcp_connection_established() ||
- !its_subscription->is_udp_connection_established()) {
- const std::shared_ptr<const endpoint> its_reliable_endpoint(
- its_subscription->get_endpoint(true));
- const std::shared_ptr<const endpoint> its_unreliable_endpoint(
- its_subscription->get_endpoint(false));
- if(its_reliable_endpoint && its_reliable_endpoint->is_connected()) {
- if(its_reliable_endpoint.get() == _endpoint.get()) {
- // mark tcp as established
- its_subscription->set_tcp_connection_established(true);
- }
- }
- if(its_unreliable_endpoint && its_unreliable_endpoint->is_connected()) {
- if(its_reliable_endpoint.get() == _endpoint.get()) {
- // mark udp as established
- its_subscription->set_udp_connection_established(true);
- }
- }
- if ((its_reliable_endpoint && its_unreliable_endpoint &&
- its_subscription->is_tcp_connection_established() &&
- its_subscription->is_udp_connection_established()) ||
- (its_reliable_endpoint && !its_unreliable_endpoint &&
- its_subscription->is_tcp_connection_established()) ||
- (its_unreliable_endpoint && !its_reliable_endpoint &&
- its_subscription->is_udp_connection_established())) {
- std::shared_ptr<endpoint> its_unreliable;
- std::shared_ptr<endpoint> its_reliable;
- get_subscription_endpoints(
- its_unreliable, its_reliable, &its_address,
- &has_address, _service, _instance,
- its_client.first);
- its_subscription->set_endpoint(its_reliable, true);
- its_subscription->set_endpoint(its_unreliable, false);
- insert_subscription(its_message, _service,
- _instance, its_eventgroup.first,
- its_subscription, its_offer_type);
- its_subscription->set_acknowledged(false);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if (has_address && its_message->get_entries().size()
- && its_message->get_options().size()) {
- serialize_and_send(its_message, its_address);
- }
-}
-
-bool service_discovery_impl::insert_offer_service(
- std::shared_ptr < message_impl > _message, service_t _service,
- instance_t _instance, const std::shared_ptr<const serviceinfo> &_info,
- uint32_t &_size) {
-
- std::shared_ptr < endpoint > its_reliable = _info->get_endpoint(true);
- std::shared_ptr < endpoint > its_unreliable = _info->get_endpoint(false);
-
- uint32_t its_size = VSOMEIP_SOMEIP_SD_ENTRY_SIZE;
- if (its_reliable) {
- uint32_t its_endpoint_size(0);
- if (unicast_.is_v4()) {
- if (!find_existing_option<ipv4_option_impl, ipv4_address_t>(_message,
- unicast_.to_v4().to_bytes(), its_reliable->get_local_port(),
- layer_four_protocol_e::TCP, option_type_e::IP4_ENDPOINT)) {
- its_endpoint_size = VSOMEIP_SOMEIP_SD_IPV4_OPTION_SIZE;
- }
- } else {
- if (!find_existing_option<ipv6_option_impl, ipv6_address_t>(_message,
- unicast_.to_v6().to_bytes(), its_reliable->get_local_port(),
- layer_four_protocol_e::TCP, option_type_e::IP6_ENDPOINT)) {
- its_endpoint_size = VSOMEIP_SOMEIP_SD_IPV6_OPTION_SIZE;
- }
- }
- its_size += its_endpoint_size;
- }
- if (its_unreliable) {
- uint32_t its_endpoint_size(0);
- if (unicast_.is_v4()) {
- if (!find_existing_option<ipv4_option_impl, ipv4_address_t>(_message,
- unicast_.to_v4().to_bytes(), its_unreliable->get_local_port(),
- layer_four_protocol_e::UDP, option_type_e::IP4_ENDPOINT)) {
- its_endpoint_size = VSOMEIP_SOMEIP_SD_IPV4_OPTION_SIZE;
- }
- } else {
- if (!find_existing_option<ipv6_option_impl, ipv6_address_t>(_message,
- unicast_.to_v6().to_bytes(), its_reliable->get_local_port(),
- layer_four_protocol_e::UDP, option_type_e::IP6_ENDPOINT)) {
- its_endpoint_size = VSOMEIP_SOMEIP_SD_IPV6_OPTION_SIZE;
- }
- }
- its_size += its_endpoint_size;
- }
-
- if (its_size <= _size) {
- _size -= its_size;
-
- std::shared_ptr < serviceentry_impl > its_entry =
- _message->create_service_entry();
- if (its_entry) {
- its_entry->set_type(entry_type_e::OFFER_SERVICE);
- its_entry->set_service(_service);
- its_entry->set_instance(_instance);
- its_entry->set_major_version(_info->get_major());
- its_entry->set_minor_version(_info->get_minor());
-
- ttl_t its_ttl = _info->get_ttl();
- if (its_ttl > 0)
- its_ttl = ttl_;
- its_entry->set_ttl(its_ttl);
-
- if (its_reliable) {
- insert_option(_message, its_entry, unicast_,
- its_reliable->get_local_port(), true);
- if ((0 == _info->get_ttl() && !is_diagnosis_)
- && (0 == _info->get_ttl() && !is_suspended_)) {
- host_->del_routing_info(_service,
- _instance, true, false);
- }
- }
-
- if (its_unreliable) {
- insert_option(_message, its_entry, unicast_,
- its_unreliable->get_local_port(), false);
- if ((0 == _info->get_ttl() && !is_diagnosis_)
- && (0 == _info->get_ttl() && !is_suspended_)) {
- host_->del_routing_info(_service,
- _instance, false, true);
- }
- }
- // This would be a clean solution but does _not_ work with the ANDi tool
- //unsubscribe_all(_service, _instance);
- } else {
- VSOMEIP_ERROR << "Failed to create service entry.";
- }
- return true;
- }
-
- return false;
-}
-
-void service_discovery_impl::process_eventgroupentry(
- std::shared_ptr<eventgroupentry_impl> &_entry,
- const std::vector<std::shared_ptr<option_impl> > &_options,
- std::shared_ptr < message_impl > &its_message_response,
- const boost::asio::ip::address &_destination,
- const std::shared_ptr<sd_message_identifier_t> &_message_id,
- bool _is_stop_subscribe_subscribe,
- bool _force_initial_events) {
- service_t its_service = _entry->get_service();
- instance_t its_instance = _entry->get_instance();
- eventgroup_t its_eventgroup = _entry->get_eventgroup();
- entry_type_e its_type = _entry->get_type();
- major_version_t its_major = _entry->get_major_version();
- ttl_t its_ttl = _entry->get_ttl();
- uint16_t its_reserved = _entry->get_reserved();
- uint8_t its_counter = _entry->get_counter();
-
- if (_entry->get_owning_message()->get_return_code() != return_code) {
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Invalid return code in SD header "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- if(its_ttl > 0) {
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- }
- return;
- }
-
- if(its_type == entry_type_e::SUBSCRIBE_EVENTGROUP) {
- if( _destination.is_multicast() ) {
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Received a SubscribeEventGroup entry on multicast address "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- if(its_ttl > 0) {
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- }
- return;
- }
- if (_entry->get_num_options(1) == 0
- && _entry->get_num_options(2) == 0) {
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Invalid number of options in SubscribeEventGroup entry "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- if(its_ttl > 0) {
- // increase number of required acks by one as number required acks
- // is calculated based on the number of referenced options
- its_message_response->increase_number_required_acks();
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- }
- return;
- }
- if(_entry->get_owning_message()->get_options_length() < 12) {
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Invalid options length in SD message "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- if(its_ttl > 0) {
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- }
- return;
- }
- if (_options.size()
- // cast is needed in order to get unsigned type since int will be promoted
- // by the + operator on 16 bit or higher machines.
- < static_cast<std::vector<std::shared_ptr<option_impl>>::size_type>(
- (_entry->get_num_options(1)) + (_entry->get_num_options(2)))) {
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Fewer options in SD message than "
- "referenced in EventGroup entry or malformed option received "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- if(its_ttl > 0) {
- // set to 0 to ensure an answer containing at least this subscribe_nack is sent out
- its_message_response->set_number_required_acks(0);
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- }
- return;
- }
- if(_entry->get_owning_message()->get_someip_length() < _entry->get_owning_message()->get_length()
- && its_ttl > 0) {
- boost::system::error_code ec;
- VSOMEIP_ERROR << std::dec << "SomeIP length field in SubscribeEventGroup message header: ["
- << _entry->get_owning_message()->get_someip_length()
- << "] bytes, is shorter than length of deserialized message: ["
- << (uint32_t) _entry->get_owning_message()->get_length() << "] bytes. "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- return;
- }
- }
-
- boost::asio::ip::address its_first_address;
- uint16_t its_first_port(ILLEGAL_PORT);
- bool is_first_reliable(false);
- boost::asio::ip::address its_second_address;
- uint16_t its_second_port(ILLEGAL_PORT);
- bool is_second_reliable(false);
-
- for (auto i : { 1, 2 }) {
- for (auto its_index : _entry->get_options(uint8_t(i))) {
- std::shared_ptr < option_impl > its_option;
- try {
- its_option = _options.at(its_index);
- } catch(const std::out_of_range& e) {
-#ifdef _WIN32
- e; // silence MSVC warining C4101
-#endif
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Fewer options in SD message than "
- "referenced in EventGroup entry for "
- "option run number: " << i << " "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0')
- << _message_id->session_;
- if (entry_type_e::SUBSCRIBE_EVENTGROUP == its_type && its_ttl > 0) {
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- }
- return;
- }
- switch (its_option->get_type()) {
- case option_type_e::IP4_ENDPOINT: {
- if (entry_type_e::SUBSCRIBE_EVENTGROUP == its_type) {
- std::shared_ptr < ipv4_option_impl > its_ipv4_option =
- std::dynamic_pointer_cast < ipv4_option_impl
- > (its_option);
-
- boost::asio::ip::address_v4 its_ipv4_address(
- its_ipv4_option->get_address());
- if (!check_layer_four_protocol(its_ipv4_option)) {
- if( its_ttl > 0) {
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- }
- return;
- }
-
- if (its_first_port == ILLEGAL_PORT) {
- its_first_address = its_ipv4_address;
- its_first_port = its_ipv4_option->get_port();
- is_first_reliable = (its_ipv4_option->get_layer_four_protocol()
- == layer_four_protocol_e::TCP);
-
- if(!check_ipv4_address(its_first_address)
- || 0 == its_first_port) {
- if(its_ttl > 0) {
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- }
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Invalid port or IP address in first IPv4 endpoint option specified! "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- return;
- }
- } else
- if (its_second_port == ILLEGAL_PORT) {
- its_second_address = its_ipv4_address;
- its_second_port = its_ipv4_option->get_port();
- is_second_reliable = (its_ipv4_option->get_layer_four_protocol()
- == layer_four_protocol_e::TCP);
-
- if(!check_ipv4_address(its_second_address)
- || 0 == its_second_port) {
- if(its_ttl > 0) {
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- }
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Invalid port or IP address in second IPv4 endpoint option specified! "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- return;
- }
- } else {
- // TODO: error message, too many endpoint options!
- }
- } else {
- boost::system::error_code ec;
- VSOMEIP_ERROR
- << "Invalid eventgroup option (IPv4 Endpoint)"
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- }
- break;
- }
- case option_type_e::IP6_ENDPOINT: {
- if (entry_type_e::SUBSCRIBE_EVENTGROUP == its_type) {
- std::shared_ptr < ipv6_option_impl > its_ipv6_option =
- std::dynamic_pointer_cast < ipv6_option_impl
- > (its_option);
-
- boost::asio::ip::address_v6 its_ipv6_address(
- its_ipv6_option->get_address());
- if (!check_layer_four_protocol(its_ipv6_option)) {
- if(its_ttl > 0) {
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- }
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Invalid layer 4 protocol type in IPv6 endpoint option specified! "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- return;
- }
-
- if (its_first_port == ILLEGAL_PORT) {
- its_first_address = its_ipv6_address;
- its_first_port = its_ipv6_option->get_port();
- is_first_reliable = (its_ipv6_option->get_layer_four_protocol()
- == layer_four_protocol_e::TCP);
- } else
- if (its_second_port == ILLEGAL_PORT) {
- its_second_address = its_ipv6_address;
- its_second_port = its_ipv6_option->get_port();
- is_second_reliable = (its_ipv6_option->get_layer_four_protocol()
- == layer_four_protocol_e::TCP);
- } else {
- // TODO: error message, too many endpoint options!
- }
- } else {
- boost::system::error_code ec;
- VSOMEIP_ERROR
- << "Invalid eventgroup option (IPv6 Endpoint) "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- }
- break;
- }
- case option_type_e::IP4_MULTICAST:
- if (entry_type_e::SUBSCRIBE_EVENTGROUP_ACK == its_type) {
- std::shared_ptr < ipv4_option_impl > its_ipv4_option =
- std::dynamic_pointer_cast < ipv4_option_impl
- > (its_option);
-
- boost::asio::ip::address_v4 its_ipv4_address(
- its_ipv4_option->get_address());
-
- if (its_first_port == ILLEGAL_PORT) {
- its_first_address = its_ipv4_address;
- its_first_port = its_ipv4_option->get_port();
- } else
- if (its_second_port == ILLEGAL_PORT) {
- its_second_address = its_ipv4_address;
- its_second_port = its_ipv4_option->get_port();
- } else {
- // TODO: error message, too many endpoint options!
- }
- } else {
- boost::system::error_code ec;
- VSOMEIP_ERROR
- << "Invalid eventgroup option (IPv4 Multicast) "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- }
- break;
- case option_type_e::IP6_MULTICAST:
- if (entry_type_e::SUBSCRIBE_EVENTGROUP_ACK == its_type) {
- std::shared_ptr < ipv6_option_impl > its_ipv6_option =
- std::dynamic_pointer_cast < ipv6_option_impl
- > (its_option);
-
- boost::asio::ip::address_v6 its_ipv6_address(
- its_ipv6_option->get_address());
-
- if (its_first_port == ILLEGAL_PORT) {
- its_first_address = its_ipv6_address;
- its_first_port = its_ipv6_option->get_port();
- } else
- if (its_second_port == ILLEGAL_PORT) {
- its_second_address = its_ipv6_address;
- its_second_port = its_ipv6_option->get_port();
- } else {
- // TODO: error message, too many endpoint options!
- }
- } else {
- boost::system::error_code ec;
- VSOMEIP_ERROR
- << "Invalid eventgroup option (IPv6 Multicast) "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- }
- break;
- case option_type_e::CONFIGURATION: {
- its_message_response->decrease_number_required_acks();
- break;
- }
- case option_type_e::UNKNOWN:
- default:
- boost::system::error_code ec;
- VSOMEIP_WARNING << "Unsupported eventgroup option "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- if(its_ttl > 0) {
- its_message_response->decrease_number_required_acks();
- insert_subscription_nack(its_message_response, its_service, its_instance,
- its_eventgroup, its_counter, its_major, its_reserved);
- return;
- }
- break;
- }
- }
- }
-
- if (entry_type_e::SUBSCRIBE_EVENTGROUP == its_type) {
- handle_eventgroup_subscription(its_service, its_instance,
- its_eventgroup, its_major, its_ttl, its_counter, its_reserved,
- its_first_address, its_first_port, is_first_reliable,
- its_second_address, its_second_port, is_second_reliable, its_message_response,
- _message_id, _is_stop_subscribe_subscribe, _force_initial_events);
- } else {
- if( entry_type_e::SUBSCRIBE_EVENTGROUP_ACK == its_type) { //this type is used for ACK and NACK messages
- if(its_ttl > 0) {
- handle_eventgroup_subscription_ack(its_service, its_instance,
- its_eventgroup, its_major, its_ttl, its_counter,
- its_first_address, its_first_port);
- } else {
- handle_eventgroup_subscription_nack(its_service, its_instance, its_eventgroup, its_counter);
- }
- }
- }
-}
-
-void service_discovery_impl::handle_eventgroup_subscription(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, major_version_t _major,
- ttl_t _ttl, uint8_t _counter, uint16_t _reserved,
- const boost::asio::ip::address &_first_address, uint16_t _first_port, bool _is_first_reliable,
- const boost::asio::ip::address &_second_address, uint16_t _second_port, bool _is_second_reliable,
- std::shared_ptr < message_impl > &its_message,
- const std::shared_ptr<sd_message_identifier_t> &_message_id,
- bool _is_stop_subscribe_subscribe, bool _force_initial_events) {
-
- if (its_message) {
- bool has_reliable_events(false);
- bool has_unreliable_events(false);
- auto its_eventgroup = host_->find_eventgroup(_service, _instance, _eventgroup);
- if (its_eventgroup) {
- its_eventgroup->get_reliability(has_reliable_events, has_unreliable_events);
- }
-
- bool reliablility_nack(false);
- if (has_reliable_events && !has_unreliable_events) {
- if (!(_first_port != ILLEGAL_PORT && _is_first_reliable) &&
- !(_second_port != ILLEGAL_PORT && _is_second_reliable)) {
- reliablility_nack = true;
- }
- } else if (!has_reliable_events && has_unreliable_events) {
- if (!(_first_port != ILLEGAL_PORT && !_is_first_reliable) &&
- !(_second_port != ILLEGAL_PORT && !_is_second_reliable)) {
- reliablility_nack = true;
- }
- } else if (has_reliable_events && has_unreliable_events) {
- if (_first_port == ILLEGAL_PORT || _second_port == ILLEGAL_PORT) {
- reliablility_nack = true;
- }
- if (_is_first_reliable == _is_second_reliable) {
- reliablility_nack = true;
- }
- }
- if (reliablility_nack && _ttl > 0) {
- insert_subscription_nack(its_message, _service, _instance,
- _eventgroup, _counter, _major, _reserved);
- boost::system::error_code ec;
- VSOMEIP_WARNING << "Subscription for ["
- << 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 << "]"
- << " not valid: Event configuration does not match the provided "
- << "endpoint options: "
- << _first_address.to_string(ec) << ":" << std::dec << _first_port << " "
- << _second_address.to_string(ec) << ":" << std::dec << _second_port
- << " " << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- return;
- }
-
- std::shared_ptr < eventgroupinfo > its_info = host_->find_eventgroup(
- _service, _instance, _eventgroup);
-
- struct subscriber_target_t {
- std::shared_ptr<endpoint_definition> subscriber_;
- std::shared_ptr<endpoint_definition> target_;
- };
- std::array<subscriber_target_t, 2> its_targets =
- { subscriber_target_t(), subscriber_target_t() };
-
- // Could not find eventgroup or wrong version
- if (!its_info || _major != its_info->get_major()) {
- // Create a temporary info object with TTL=0 --> send NACK
- if( its_info && (_major != its_info->get_major())) {
- boost::system::error_code ec;
- VSOMEIP_ERROR << "Requested major version:[" << (uint32_t) _major
- << "] in subscription to service: ["
- << 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 << "]"
- << " does not match with services major version:[" << (uint32_t) its_info->get_major()
- << "] " << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- } else {
- VSOMEIP_ERROR << "Requested eventgroup:[" << _eventgroup
- << "] not found for subscription to service:["
- << _service << "] instance:[" << _instance << "]";
- }
- its_info = std::make_shared < eventgroupinfo > (_major, 0);
- if(_ttl > 0) {
- insert_subscription_nack(its_message, _service, _instance,
- _eventgroup, _counter, _major, _reserved);
- }
- return;
- } else {
- boost::asio::ip::address its_first_address, its_second_address;
- uint16_t its_first_port, its_second_port;
- if (ILLEGAL_PORT != _first_port) {
- its_targets[0].subscriber_ = endpoint_definition::get(
- _first_address, _first_port, _is_first_reliable, _service, _instance);
- if (!_is_first_reliable &&
- its_info->get_multicast(its_first_address, its_first_port)) { // udp multicast
- its_targets[0].target_ = endpoint_definition::get(
- its_first_address, its_first_port, false, _service, _instance);
- } else if(_is_first_reliable) { // tcp unicast
- its_targets[0].target_ = its_targets[0].subscriber_;
- // check if TCP connection is established by client
- if(_ttl > 0 && !is_tcp_connected(_service, _instance, its_targets[0].target_)) {
- insert_subscription_nack(its_message, _service, _instance,
- _eventgroup, _counter, _major, _reserved);
- boost::system::error_code ec;
- VSOMEIP_ERROR << "TCP connection to target1: ["
- << its_targets[0].target_->get_address().to_string()
- << ":" << its_targets[0].target_->get_port()
- << "] not established for subscription to: ["
- << 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 << "] "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- if (ILLEGAL_PORT != _second_port) {
- its_message->decrease_number_required_acks();
- }
- return;
- }
- } else { // udp unicast
- its_targets[0].target_ = its_targets[0].subscriber_;
- }
- }
- if (ILLEGAL_PORT != _second_port) {
- its_targets[1].subscriber_ = endpoint_definition::get(
- _second_address, _second_port, _is_second_reliable, _service, _instance);
- if (!_is_second_reliable &&
- its_info->get_multicast(its_second_address, its_second_port)) { // udp multicast
- its_targets[1].target_ = endpoint_definition::get(
- its_second_address, its_second_port, false, _service, _instance);
- } else if (_is_second_reliable) { // tcp unicast
- its_targets[1].target_ = its_targets[1].subscriber_;
- // check if TCP connection is established by client
- if(_ttl > 0 && !is_tcp_connected(_service, _instance, its_targets[1].target_)) {
- insert_subscription_nack(its_message, _service, _instance,
- _eventgroup, _counter, _major, _reserved);
- boost::system::error_code ec;
- VSOMEIP_ERROR << "TCP connection to target2 : ["
- << its_targets[1].target_->get_address().to_string()
- << ":" << its_targets[1].target_->get_port()
- << "] not established for subscription to: ["
- << 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 << "] "
- << _message_id->sender_.to_string(ec) << " session: "
- << std::hex << std::setw(4) << std::setfill('0') << _message_id->session_;
- if (ILLEGAL_PORT != _first_port) {
- its_message->decrease_number_required_acks();
- }
- return;
- }
- } else { // udp unicast
- its_targets[1].target_ = its_targets[1].subscriber_;
- }
- }
- }
-
- if (_ttl == 0) { // --> unsubscribe
- for (const auto &target : its_targets) {
- if (target.subscriber_) {
- if (!_is_stop_subscribe_subscribe) {
- host_->on_unsubscribe(_service, _instance, _eventgroup, target.subscriber_);
- }
- }
- }
- return;
- }
-
- for (const auto &target : its_targets) {
- if (!target.target_) {
- continue;
- }
- host_->on_remote_subscription(_service, _instance,
- _eventgroup, target.subscriber_, target.target_,
- _ttl * get_ttl_factor(_service, _instance, ttl_factor_subscriptions_),
- _message_id,
- [&](remote_subscription_state_e _rss, client_t _subscribing_remote_client) {
- switch (_rss) {
- case remote_subscription_state_e::SUBSCRIPTION_ACKED:
- insert_subscription_ack(its_message, _service,
- _instance, _eventgroup, its_info, _ttl,
- _counter, _major, _reserved);
- if (_force_initial_events) {
- // processing subscription of StopSubscribe/Subscribe
- // sequence
- its_message->forced_initial_events_add(
- message_impl::forced_initial_events_t(
- { target.subscriber_, _service, _instance,
- _eventgroup }));
- }
- break;
- case remote_subscription_state_e::SUBSCRIPTION_NACKED:
- case remote_subscription_state_e::SUBSCRIPTION_ERROR:
- insert_subscription_nack(its_message, _service,
- _instance, _eventgroup, _counter, _major,
- _reserved);
- break;
- case remote_subscription_state_e::SUBSCRIPTION_PENDING:
- if (target.target_ && target.subscriber_) {
- std::shared_ptr<subscriber_t> subscriber_ =
- std::make_shared<subscriber_t>();
- subscriber_->subscriber = target.subscriber_;
- subscriber_->target = target.target_;
- subscriber_->response_message_id_ = _message_id;
- subscriber_->eventgroupinfo_ = its_info;
- subscriber_->ttl_ = _ttl;
- subscriber_->major_ = _major;
- subscriber_->reserved_ = _reserved;
- subscriber_->counter_ = _counter;
-
- std::lock_guard<std::mutex> its_lock(pending_remote_subscriptions_mutex_);
- pending_remote_subscriptions_[_service]
- [_instance]
- [_eventgroup]
- [_subscribing_remote_client].push_back(subscriber_);
- }
- default:
- break;
- }
- });
- }
- }
-}
-
-void service_discovery_impl::handle_eventgroup_subscription_nack(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, uint8_t _counter) {
- client_t nackedClient = 0;
- std::lock_guard<std::mutex> its_lock(subscribed_mutex_);
- auto found_service = subscribed_.find(_service);
- if (found_service != subscribed_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- for (auto client : found_eventgroup->second) {
- if (client.second->get_counter() == _counter) {
- // Deliver nack
- nackedClient = client.first;
- host_->on_subscribe_nack(client.first, _service,
- _instance, _eventgroup, ANY_EVENT, DEFAULT_SUBSCRIPTION);
- break;
- }
- }
-
- // Restart TCP connection only for non selective subscriptions
- for (auto client : found_eventgroup->second) {
- if( !client.second->is_acknowledged()
- && client.first == VSOMEIP_ROUTING_CLIENT ) {
- auto endpoint = client.second->get_endpoint(true);
- if(endpoint) {
- endpoint->restart();
- }
- }
- }
-
- // Remove nacked subscription only for selective events
- if(nackedClient != VSOMEIP_ROUTING_CLIENT) {
- found_eventgroup->second.erase(nackedClient);
- }
- }
- }
- }
-}
-
-void service_discovery_impl::handle_eventgroup_subscription_ack(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- major_version_t _major, ttl_t _ttl, uint8_t _counter,
- const boost::asio::ip::address &_address, uint16_t _port) {
- (void)_major;
- (void)_ttl;
- std::lock_guard<std::mutex> its_lock(subscribed_mutex_);
- auto found_service = subscribed_.find(_service);
- if (found_service != subscribed_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto found_eventgroup = found_instance->second.find(_eventgroup);
- if (found_eventgroup != found_instance->second.end()) {
- for (auto its_client : found_eventgroup->second) {
- if (its_client.second->get_counter() == _counter) {
- its_client.second->set_acknowledged(true);
- host_->on_subscribe_ack(its_client.first, _service,
- _instance, _eventgroup, ANY_EVENT, DEFAULT_SUBSCRIPTION);
- }
- if (_address.is_multicast()) {
- host_->on_subscribe_ack(_service, _instance, _address,
- _port);
- }
- }
- }
- }
- }
-}
-
-bool service_discovery_impl::is_tcp_connected(service_t _service,
- instance_t _instance,
- std::shared_ptr<vsomeip::endpoint_definition> its_endpoint) {
- bool is_connected = false;
- std::shared_ptr<serviceinfo> its_info = host_->get_offered_service(_service,
- _instance);
- if (its_info) {
- //get reliable server endpoint
- auto its_reliable_server_endpoint = std::dynamic_pointer_cast<
- tcp_server_endpoint_impl>(its_info->get_endpoint(true));
- if (its_reliable_server_endpoint
- && its_reliable_server_endpoint->is_established(its_endpoint)) {
- is_connected = true;
- }
- }
- return is_connected;
-}
-
-void service_discovery_impl::serialize_and_send(
- std::shared_ptr<message_impl> _message,
- const boost::asio::ip::address &_address) {
- std::lock_guard<std::mutex> its_lock(serialize_mutex_);
- std::pair<session_t, bool> its_session = get_session(_address);
- _message->set_session(its_session.first);
- _message->set_reboot_flag(its_session.second);
- if(!serializer_->serialize(_message.get())) {
- VSOMEIP_ERROR << "service_discovery_impl::serialize_and_send: serialization error.";
- return;
- }
- if (host_->send_to(endpoint_definition::get(_address, port_, reliable_, _message->get_service(), _message->get_instance()),
- serializer_->get_data(), serializer_->get_size(), port_)) {
- increment_session(_address);
- }
- serializer_->reset();
-}
-
-void service_discovery_impl::start_ttl_timer() {
- std::lock_guard<std::mutex> its_lock(ttl_timer_mutex_);
- boost::system::error_code ec;
- ttl_timer_.expires_from_now(std::chrono::milliseconds(ttl_timer_runtime_), ec);
- ttl_timer_.async_wait(
- std::bind(&service_discovery_impl::check_ttl, shared_from_this(),
- std::placeholders::_1));
-}
-
-void service_discovery_impl::stop_ttl_timer() {
- std::lock_guard<std::mutex> its_lock(ttl_timer_mutex_);
- boost::system::error_code ec;
- ttl_timer_.cancel(ec);
-}
-
-void service_discovery_impl::check_ttl(const boost::system::error_code &_error) {
- if (!_error) {
- host_->update_routing_info(ttl_timer_runtime_);
- start_ttl_timer();
- }
-}
-
-bool service_discovery_impl::check_static_header_fields(
- const std::shared_ptr<const message> &_message) const {
- if(_message->get_protocol_version() != protocol_version) {
- VSOMEIP_ERROR << "Invalid protocol version in SD header";
- return false;
- }
- if(_message->get_interface_version() != interface_version) {
- VSOMEIP_ERROR << "Invalid interface version in SD header";
- return false;
- }
- if(_message->get_message_type() != message_type) {
- VSOMEIP_ERROR << "Invalid message type in SD header";
- return false;
- }
- if(_message->get_return_code() > return_code_e::E_OK
- && _message->get_return_code()< return_code_e::E_UNKNOWN) {
- VSOMEIP_ERROR << "Invalid return code in SD header";
- return false;
- }
- return true;
-}
-
-bool service_discovery_impl::check_layer_four_protocol(
- const std::shared_ptr<const ip_option_impl> _ip_option) const {
- if (_ip_option->get_layer_four_protocol() == layer_four_protocol_e::UNKNOWN) {
- VSOMEIP_ERROR << "Invalid layer 4 protocol in IP endpoint option";
- return false;
- }
- return true;
-}
-
-void service_discovery_impl::send_subscriptions(service_t _service, instance_t _instance,
- client_t _client, bool _reliable) {
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (!its_runtime) {
- return;
- }
- std::forward_list<std::pair<std::shared_ptr<message_impl>,
- const boost::asio::ip::address>> subscription_messages;
- {
- std::lock_guard<std::mutex> its_lock(subscribed_mutex_);
- auto found_service = subscribed_.find(_service);
- if (found_service != subscribed_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- const remote_offer_type_e its_offer_type =
- get_remote_offer_type(_service, _instance);
- for (auto found_eventgroup : found_instance->second) {
- auto found_client = found_eventgroup.second.find(_client);
- if (found_client != found_eventgroup.second.end()) {
- std::shared_ptr<endpoint> its_unreliable;
- std::shared_ptr<endpoint> its_reliable;
- bool has_address(false);
- boost::asio::ip::address its_address;
- get_subscription_endpoints(
- its_unreliable, its_reliable, &its_address,
- &has_address, _service, _instance,
- found_client->first);
- std::shared_ptr<endpoint> endpoint;
- if (_reliable) {
- endpoint = its_reliable;
- found_client->second->set_endpoint(its_reliable, true);
- if (its_unreliable &&
- !host_->has_identified(found_client->first, _service, _instance, false)) {
- return;
- }
- } else {
- endpoint = its_unreliable;
- found_client->second->set_endpoint(its_unreliable, false);
- if (its_reliable &&
- !host_->has_identified(found_client->first, _service, _instance, true)) {
- return;
- }
- }
- if (endpoint) {
- if (!has_address) {
- VSOMEIP_WARNING << "service_discovery_impl::"
- "send_subscriptions couldn't determine "
- "address for service.instance: "
- << std::hex << std::setw(4) << std::setfill('0')
- << _service << "." << _instance;
- continue;
- }
- std::shared_ptr<message_impl> its_message
- = its_runtime->create_message();
-
- if (its_reliable && its_unreliable) {
- if (its_reliable->is_connected() && its_unreliable->is_connected()) {
- insert_subscription(its_message, _service,
- _instance, found_eventgroup.first,
- found_client->second, its_offer_type);
- found_client->second->set_tcp_connection_established(true);
- found_client->second->set_udp_connection_established(true);
- } else {
- found_client->second->set_tcp_connection_established(false);
- found_client->second->set_udp_connection_established(false);
- }
- } else {
- if(_reliable) {
- if(endpoint->is_connected()) {
- insert_subscription(its_message, _service,
- _instance, found_eventgroup.first,
- found_client->second, its_offer_type);
- found_client->second->set_tcp_connection_established(true);
- } else {
- // don't insert reliable endpoint option if the
- // TCP client endpoint is not yet connected
- found_client->second->set_tcp_connection_established(false);
- }
- } else {
- if (endpoint->is_connected()) {
- insert_subscription(its_message, _service,
- _instance, found_eventgroup.first,
- found_client->second, its_offer_type);
- found_client->second->set_udp_connection_established(true);
- } else {
- // don't insert unreliable endpoint option if the
- // UDP client endpoint is not yet connected
- found_client->second->set_udp_connection_established(false);
- }
- }
- }
- if (its_message->get_entries().size()
- && its_message->get_options().size()) {
- subscription_messages.push_front({its_message, its_address});
- found_client->second->set_acknowledged(false);
- }
- }
- }
- }
- }
- }
- }
- for (const auto s : subscription_messages) {
- serialize_and_send(s.first, s.second);
- }
-}
-
-void service_discovery_impl::start_subscription_expiration_timer() {
- std::lock_guard<std::mutex> its_lock(subscription_expiration_timer_mutex_);
- start_subscription_expiration_timer_unlocked();
-}
-
-void service_discovery_impl::start_subscription_expiration_timer_unlocked() {
- subscription_expiration_timer_.expires_at(next_subscription_expiration_);
- subscription_expiration_timer_.async_wait(
- std::bind(&service_discovery_impl::expire_subscriptions,
- shared_from_this(),
- std::placeholders::_1));
-}
-
-void service_discovery_impl::stop_subscription_expiration_timer() {
- std::lock_guard<std::mutex> its_lock(subscription_expiration_timer_mutex_);
- stop_subscription_expiration_timer_unlocked();
-}
-
-void service_discovery_impl::stop_subscription_expiration_timer_unlocked() {
- subscription_expiration_timer_.cancel();
-}
-
-void service_discovery_impl::expire_subscriptions(const boost::system::error_code &_error) {
- if (!_error) {
- next_subscription_expiration_ = host_->expire_subscriptions();
- start_subscription_expiration_timer();
- }
-}
-
-bool service_discovery_impl::check_ipv4_address(
- boost::asio::ip::address its_address) {
- //Check unallowed ipv4 address
- bool is_valid = true;
- std::shared_ptr<configuration> its_configuration =
- host_->get_configuration();
-
- if(its_configuration) {
- boost::asio::ip::address_v4::bytes_type its_unicast_address =
- its_configuration.get()->get_unicast_address().to_v4().to_bytes();
- boost::asio::ip::address_v4::bytes_type endpoint_address =
- its_address.to_v4().to_bytes();
-
- //same address as unicast address of DUT not allowed
- if(its_unicast_address
- == endpoint_address) {
- VSOMEIP_ERROR << "Subscribers endpoint IP address is same as DUT's address! : "
- << its_address.to_string();
- is_valid = false;
- }
-
- // first 3 triples must match
- its_unicast_address[3] = 0x00;
- endpoint_address[3] = 0x00;
-
- if(its_unicast_address
- != endpoint_address) {
-#if 1
- VSOMEIP_ERROR<< "First 3 triples of subscribers endpoint IP address are not valid!";
-#endif
- is_valid = false;
-
- } else {
-#if 0
- VSOMEIP_INFO << "First 3 triples of subscribers endpoint IP address are valid!";
-#endif
- }
- }
- return is_valid;
-}
-
-void service_discovery_impl::offer_service(service_t _service,
- instance_t _instance,
- std::shared_ptr<serviceinfo> _info) {
- std::lock_guard<std::mutex> its_lock(collected_offers_mutex_);
- // check if offer is in map
- bool found(false);
- const auto its_service = collected_offers_.find(_service);
- if (its_service != collected_offers_.end()) {
- const auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- found = true;
- }
- }
- if (!found) {
- collected_offers_[_service][_instance] = _info;
- }
-}
-
-void service_discovery_impl::start_offer_debounce_timer(bool _first_start) {
- std::lock_guard<std::mutex> its_lock(offer_debounce_timer_mutex_);
- boost::system::error_code ec;
- if (_first_start) {
- offer_debounce_timer_.expires_from_now(initial_delay_, ec);
- } else {
- offer_debounce_timer_.expires_from_now(offer_debounce_time_, ec);
- }
- if (ec) {
- VSOMEIP_ERROR<< "service_discovery_impl::start_offer_debounce_timer "
- "setting expiry time of timer failed: " << ec.message();
- }
- offer_debounce_timer_.async_wait(
- std::bind(
- &service_discovery_impl::on_offer_debounce_timer_expired,
- this, std::placeholders::_1));
-}
-
-
-
-void service_discovery_impl::start_find_debounce_timer(bool _first_start) {
- std::lock_guard<std::mutex> its_lock(find_debounce_timer_mutex_);
- boost::system::error_code ec;
- if (_first_start) {
- find_debounce_timer_.expires_from_now(initial_delay_, ec);
- } else {
- find_debounce_timer_.expires_from_now(find_debounce_time_, ec);
- }
- if (ec) {
- VSOMEIP_ERROR<< "service_discovery_impl::start_find_debounce_timer "
- "setting expiry time of timer failed: " << ec.message();
- }
- find_debounce_timer_.async_wait(
- std::bind(
- &service_discovery_impl::on_find_debounce_timer_expired,
- this, std::placeholders::_1));
-}
-
-//initial delay
-void service_discovery_impl::on_find_debounce_timer_expired(
- const boost::system::error_code &_error) {
- if(_error) { // timer was canceled
- return;
- }
- // only copy the accumulated requests of the initial wait phase
- // if the sent counter for the request is zero.
- requests_t repetition_phase_finds;
- bool new_finds(false);
- {
- std::lock_guard<std::mutex> its_lock(requested_mutex_);
- for (const auto its_service : requested_) {
- for (const auto its_instance : its_service.second) {
- if( its_instance.second->get_sent_counter() == 0) {
- repetition_phase_finds[its_service.first][its_instance.first] = its_instance.second;
- }
- }
- }
- if (repetition_phase_finds.size()) {
- new_finds = true;
- }
- }
-
- if (!new_finds) {
- start_find_debounce_timer(false);
- return;
- }
-
- // Sent out finds for the first time as initial wait phase ended
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (its_runtime) {
- std::vector<std::shared_ptr<message_impl>> its_messages;
- std::shared_ptr<message_impl> its_message =
- its_runtime->create_message();
- its_messages.push_back(its_message);
- // Serialize and send FindService (increments sent counter in requested_ map)
- fill_message_with_find_entries(its_runtime, its_message, its_messages,
- repetition_phase_finds);
- serialize_and_send_messages(its_messages);
- }
-
- std::chrono::milliseconds its_delay(repetitions_base_delay_);
- std::uint8_t its_repetitions(1);
-
- std::shared_ptr<boost::asio::steady_timer> its_timer = std::make_shared<
- boost::asio::steady_timer>(host_->get_io());
- {
- std::lock_guard<std::mutex> its_lock(find_repetition_phase_timers_mutex_);
- find_repetition_phase_timers_[its_timer] = repetition_phase_finds;
- }
-
- boost::system::error_code ec;
- its_timer->expires_from_now(its_delay, ec);
- if (ec) {
- VSOMEIP_ERROR<< "service_discovery_impl::on_find_debounce_timer_expired "
- "setting expiry time of timer failed: " << ec.message();
- }
- its_timer->async_wait(
- std::bind(
- &service_discovery_impl::on_find_repetition_phase_timer_expired,
- this, std::placeholders::_1, its_timer, its_repetitions,
- its_delay.count()));
- start_find_debounce_timer(false);
-}
-
-void service_discovery_impl::on_offer_debounce_timer_expired(
- const boost::system::error_code &_error) {
- if(_error) { // timer was canceled
- return;
- }
-
- // copy the accumulated offers of the initial wait phase
- services_t repetition_phase_offers;
- bool new_offers(false);
- {
- std::vector<services_t::iterator> non_someip_services;
- std::lock_guard<std::mutex> its_lock(collected_offers_mutex_);
- if (collected_offers_.size()) {
- if (is_diagnosis_) {
- for (services_t::iterator its_service = collected_offers_.begin();
- its_service != collected_offers_.end(); its_service++) {
- for (auto its_instance : its_service->second) {
- if (!host_->get_configuration()->is_someip(
- its_service->first, its_instance.first)) {
- non_someip_services.push_back(its_service);
- }
- }
- }
- for (auto its_service : non_someip_services) {
- repetition_phase_offers.insert(*its_service);
- collected_offers_.erase(its_service);
- }
- } else {
- repetition_phase_offers = collected_offers_;
- collected_offers_.clear();
- }
-
- new_offers = true;
- }
- }
-
- if (!new_offers) {
- start_offer_debounce_timer(false);
- return;
- }
-
- // Sent out offers for the first time as initial wait phase ended
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (its_runtime) {
- std::vector<std::shared_ptr<message_impl>> its_messages;
- std::shared_ptr<message_impl> its_message =
- its_runtime->create_message();
- its_messages.push_back(its_message);
- fill_message_with_offer_entries(its_runtime, its_message, its_messages,
- repetition_phase_offers, true);
-
- // Serialize and send
- serialize_and_send_messages(its_messages);
- }
-
- std::chrono::milliseconds its_delay(0);
- std::uint8_t its_repetitions(0);
- if (repetitions_max_) {
- // start timer for repetition phase the first time
- // with 2^0 * repetitions_base_delay
- its_delay = repetitions_base_delay_;
- its_repetitions = 1;
- } else {
- // if repetitions_max is set to zero repetition phase is skipped,
- // therefore wait one cyclic offer delay before entering main phase
- its_delay = cyclic_offer_delay_;
- its_repetitions = 0;
- }
-
- std::shared_ptr<boost::asio::steady_timer> its_timer = std::make_shared<
- boost::asio::steady_timer>(host_->get_io());
-
- {
- std::lock_guard<std::mutex> its_lock(repetition_phase_timers_mutex_);
- repetition_phase_timers_[its_timer] = repetition_phase_offers;
- }
-
- boost::system::error_code ec;
- its_timer->expires_from_now(its_delay, ec);
- if (ec) {
- VSOMEIP_ERROR<< "service_discovery_impl::on_offer_debounce_timer_expired "
- "setting expiry time of timer failed: " << ec.message();
- }
- its_timer->async_wait(
- std::bind(
- &service_discovery_impl::on_repetition_phase_timer_expired,
- this, std::placeholders::_1, its_timer, its_repetitions,
- its_delay.count()));
- start_offer_debounce_timer(false);
-}
-
-void service_discovery_impl::on_repetition_phase_timer_expired(
- const boost::system::error_code &_error,
- std::shared_ptr<boost::asio::steady_timer> _timer,
- std::uint8_t _repetition, std::uint32_t _last_delay) {
- if (_error) {
- return;
- }
- if (_repetition == 0) {
- std::lock_guard<std::mutex> its_lock(repetition_phase_timers_mutex_);
- // we waited one cyclic offer delay, the offers can now be sent in the
- // main phase and the timer can be deleted
- move_offers_into_main_phase(_timer);
- } else {
- std::lock_guard<std::mutex> its_lock(repetition_phase_timers_mutex_);
- auto its_timer_pair = repetition_phase_timers_.find(_timer);
- if (its_timer_pair != repetition_phase_timers_.end()) {
- std::chrono::milliseconds new_delay(0);
- std::uint8_t repetition(0);
- bool move_to_main(false);
- if (_repetition <= repetitions_max_) {
- // sent offers, double time to wait and start timer again.
-
- new_delay = std::chrono::milliseconds(_last_delay * 2);
- repetition = ++_repetition;
- } else {
- // repetition phase is now over we have to sleep one cyclic
- // offer delay before it's allowed to sent the offer again.
- // If the last offer was sent shorter than half the
- // configured cyclic_offer_delay_ago the offers are directly
- // moved into the mainphase to avoid potentially sleeping twice
- // the cyclic offer delay before moving the offers in to main
- // phase
- if (last_offer_shorter_half_offer_delay_ago()) {
- move_to_main = true;
- } else {
- new_delay = cyclic_offer_delay_;
- repetition = 0;
- }
- }
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (its_runtime) {
- std::vector<std::shared_ptr<message_impl>> its_messages;
- std::shared_ptr<message_impl> its_message =
- its_runtime->create_message();
- its_messages.push_back(its_message);
- fill_message_with_offer_entries(its_runtime, its_message,
- its_messages, its_timer_pair->second, true);
-
- // Serialize and send
- serialize_and_send_messages(its_messages);
- }
- if (move_to_main) {
- move_offers_into_main_phase(_timer);
- return;
- }
- boost::system::error_code ec;
- its_timer_pair->first->expires_from_now(new_delay, ec);
- if (ec) {
- VSOMEIP_ERROR <<
- "service_discovery_impl::on_repetition_phase_timer_expired "
- "setting expiry time of timer failed: " << ec.message();
- }
- its_timer_pair->first->async_wait(
- std::bind(
- &service_discovery_impl::on_repetition_phase_timer_expired,
- this, std::placeholders::_1, its_timer_pair->first,
- repetition, new_delay.count()));
- }
- }
-}
-
-
-void service_discovery_impl::on_find_repetition_phase_timer_expired(
- const boost::system::error_code &_error,
- std::shared_ptr<boost::asio::steady_timer> _timer,
- std::uint8_t _repetition, std::uint32_t _last_delay) {
- if (_error) {
- return;
- }
-
- std::lock_guard<std::mutex> its_lock(find_repetition_phase_timers_mutex_);
- auto its_timer_pair = find_repetition_phase_timers_.find(_timer);
- if (its_timer_pair != find_repetition_phase_timers_.end()) {
- std::chrono::milliseconds new_delay(0);
- std::uint8_t repetition(0);
- if (_repetition <= repetitions_max_) {
- // sent findService entries in one message, double time to wait and start timer again.
- std::shared_ptr<runtime> its_runtime = runtime_.lock();
- if (its_runtime) {
- std::vector<std::shared_ptr<message_impl>> its_messages;
- std::shared_ptr<message_impl> its_message =
- its_runtime->create_message();
- its_messages.push_back(its_message);
- fill_message_with_find_entries(its_runtime, its_message,
- its_messages, its_timer_pair->second);
- serialize_and_send_messages(its_messages);
- }
- new_delay = std::chrono::milliseconds(_last_delay * 2);
- repetition = ++_repetition;
- } else {
- // repetition phase is now over, erase the timer on next expiry time
- find_repetition_phase_timers_.erase(its_timer_pair);
- return;
- }
- boost::system::error_code ec;
- its_timer_pair->first->expires_from_now(new_delay, ec);
- if (ec) {
- VSOMEIP_ERROR <<
- "service_discovery_impl::on_find_repetition_phase_timer_expired "
- "setting expiry time of timer failed: " << ec.message();
- }
- its_timer_pair->first->async_wait(
- std::bind(
- &service_discovery_impl::on_find_repetition_phase_timer_expired,
- this, std::placeholders::_1, its_timer_pair->first,
- repetition, new_delay.count()));
- }
-}
-
-
-void service_discovery_impl::move_offers_into_main_phase(
- const std::shared_ptr<boost::asio::steady_timer> &_timer) {
- // HINT: make sure to lock the repetition_phase_timers_mutex_ before calling
- // this function
- // set flag on all serviceinfos bound to this timer
- // that they will be included in the cyclic offers from now on
- const auto its_timer = repetition_phase_timers_.find(_timer);
- if (its_timer != repetition_phase_timers_.end()) {
- for (const auto its_service : its_timer->second) {
- for (const auto instance : its_service.second) {
- instance.second->set_is_in_mainphase(true);
- }
- }
- repetition_phase_timers_.erase(_timer);
- }
-}
-
-void service_discovery_impl::fill_message_with_offer_entries(
- std::shared_ptr<runtime> _runtime,
- std::shared_ptr<message_impl> _message,
- std::vector<std::shared_ptr<message_impl>> &_messages,
- const services_t &_offers, bool _ignore_phase) {
- uint32_t its_remaining(max_message_size_);
- uint32_t its_start(0);
- bool is_done(false);
- while (!is_done) {
- insert_offer_entries(_message, _offers, its_start, its_remaining,
- is_done, _ignore_phase);
- if (!is_done) {
- its_remaining = max_message_size_;
- _message = _runtime->create_message();
- _messages.push_back(_message);
- }
- }
-}
-
-void service_discovery_impl::fill_message_with_find_entries(
- std::shared_ptr<runtime> _runtime,
- std::shared_ptr<message_impl> _message,
- std::vector<std::shared_ptr<message_impl>> &_messages,
- const requests_t &_requests) {
- uint32_t its_start(0);
- uint32_t its_size(0);
- bool is_done(false);
- while (!is_done) {
- insert_find_entries(_message, _requests, its_start, its_size,
- is_done);
- its_start += its_size / VSOMEIP_SOMEIP_SD_ENTRY_SIZE;
- if (!is_done) {
- its_start = 0;
- _message = _runtime->create_message();
- _messages.push_back(_message);
- }
- };
-}
-
-
-bool service_discovery_impl::serialize_and_send_messages(
- const std::vector<std::shared_ptr<message_impl>> &_messages) {
- bool has_sent(false);
- // lock serialize mutex here as well even if we don't use the
- // serializer as it's used to guard access to the sessions_sent_ map
- std::lock_guard<std::mutex> its_lock(serialize_mutex_);
- for (const auto m : _messages) {
- if (m->get_entries().size() > 0) {
- std::pair<session_t, bool> its_session = get_session(unicast_);
- m->set_session(its_session.first);
- m->set_reboot_flag(its_session.second);
- if (host_->send(VSOMEIP_SD_CLIENT, m, true)) {
- increment_session(unicast_);
- }
- has_sent = true;
- }
- }
- return has_sent;
-}
-
-void service_discovery_impl::stop_offer_service(
- service_t _service, instance_t _instance,
- std::shared_ptr<serviceinfo> _info) {
- bool stop_offer_required(false);
- // delete from initial phase offers
- {
- std::lock_guard<std::mutex> its_lock(collected_offers_mutex_);
- if (collected_offers_.size()) {
- auto its_service = collected_offers_.find(_service);
- if (its_service != collected_offers_.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- if (its_instance->second == _info) {
- its_service->second.erase(its_instance);
-
- if (!collected_offers_[its_service->first].size()) {
- collected_offers_.erase(its_service);
- }
- }
- }
- }
- }
- // no need to sent out a stop offer message here as all services
- // instances contained in the collected offers weren't broadcasted yet
- }
-
- // delete from repetition phase offers
- {
- std::lock_guard<std::mutex> its_lock(repetition_phase_timers_mutex_);
- for (auto rpt = repetition_phase_timers_.begin();
- rpt != repetition_phase_timers_.end();) {
- auto its_service = rpt->second.find(_service);
- if (its_service != rpt->second.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- if (its_instance->second == _info) {
- its_service->second.erase(its_instance);
- stop_offer_required = true;
- if (!rpt->second[its_service->first].size()) {
- rpt->second.erase(_service);
- }
- }
- }
- }
- if (!rpt->second.size()) {
- rpt = repetition_phase_timers_.erase(rpt);
- } else {
- ++rpt;
- }
- }
- }
- // sent stop offer
- if(_info->is_in_mainphase() || stop_offer_required) {
- send_stop_offer(_service, _instance, _info);
- }
- // sent out NACKs for all pending subscriptions
- remote_subscription_not_acknowledge_all(_service, _instance);
-}
-
-bool service_discovery_impl::send_stop_offer(
- service_t _service, instance_t _instance,
- std::shared_ptr<serviceinfo> _info) {
- std::shared_ptr < runtime > its_runtime = runtime_.lock();
- if (its_runtime) {
- if (_info->get_endpoint(false) || _info->get_endpoint(true)) {
- std::vector<std::shared_ptr<message_impl>> its_messages;
- std::shared_ptr<message_impl> its_message;
- its_message = its_runtime->create_message();
- its_messages.push_back(its_message);
-
- uint32_t its_size(max_message_size_);
- insert_offer_service(its_message, _service, _instance, _info, its_size);
-
- // Serialize and send
- return serialize_and_send_messages(its_messages);
- }
- }
- return false;
-}
-
-void service_discovery_impl::start_main_phase_timer() {
- std::lock_guard<std::mutex> its_lock(main_phase_timer_mutex_);
- boost::system::error_code ec;
- main_phase_timer_.expires_from_now(cyclic_offer_delay_);
- if (ec) {
- VSOMEIP_ERROR<< "service_discovery_impl::start_main_phase_timer "
- "setting expiry time of timer failed: " << ec.message();
- }
- main_phase_timer_.async_wait(
- std::bind(&service_discovery_impl::on_main_phase_timer_expired,
- this, std::placeholders::_1));
-}
-
-void service_discovery_impl::on_main_phase_timer_expired(
- const boost::system::error_code &_error) {
- if (_error) {
- return;
- }
- send(true);
- start_main_phase_timer();
-}
-
-void service_discovery_impl::send_uni_or_multicast_offerservice(
- service_t _service, instance_t _instance, major_version_t _major,
- minor_version_t _minor, const std::shared_ptr<const serviceinfo> &_info,
- bool _unicast_flag) {
- if (_unicast_flag) { // SID_SD_826
- if (last_offer_shorter_half_offer_delay_ago()) { // SIP_SD_89
- send_unicast_offer_service(_info, _service, _instance, _major, _minor);
- } else { // SIP_SD_90
- send_multicast_offer_service(_info, _service, _instance, _major, _minor);
- }
- } else { // SID_SD_826
- send_unicast_offer_service(_info, _service, _instance, _major, _minor);
- }
-}
-
-bool service_discovery_impl::last_offer_shorter_half_offer_delay_ago() {
- //get remaining time to next offer since last offer
- std::chrono::milliseconds remaining(0);
- {
- std::lock_guard<std::mutex> its_lock(main_phase_timer_mutex_);
- remaining = std::chrono::duration_cast<std::chrono::milliseconds>(
- main_phase_timer_.expires_from_now());
- }
- if (std::chrono::milliseconds(0) > remaining) {
- remaining = cyclic_offer_delay_;
- }
- const std::chrono::milliseconds half_cyclic_offer_delay =
- cyclic_offer_delay_ / 2;
-
- return remaining > half_cyclic_offer_delay;
-}
-
-bool service_discovery_impl::check_source_address(
- const boost::asio::ip::address &its_source_address) const {
- bool is_valid = true;
- std::shared_ptr<configuration> its_configuration =
- host_->get_configuration();
-
- if(its_configuration) {
- boost::asio::ip::address its_unicast_address =
- its_configuration.get()->get_unicast_address();
- // check if source address is same as nodes unicast address
- if(its_unicast_address
- == its_source_address) {
- VSOMEIP_ERROR << "Source address of message is same as DUT's unicast address! : "
- << its_source_address.to_string();
- is_valid = false;
- }
- }
- return is_valid;
-}
-
-void service_discovery_impl::set_diagnosis_mode(const bool _activate) {
- is_diagnosis_ = _activate;
-}
-
-void service_discovery_impl::remote_subscription_acknowledge(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- client_t _client, bool _acknowledged,
- const std::shared_ptr<sd_message_identifier_t> &_sd_message_id) {
- std::shared_ptr<subscriber_t> its_subscriber;
- {
- std::lock_guard<std::mutex> its_lock(pending_remote_subscriptions_mutex_);
- const auto its_service = pending_remote_subscriptions_.find(_service);
- if (its_service != pending_remote_subscriptions_.end()) {
- const auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- const auto its_eventgroup = its_instance->second.find(_eventgroup);
- if (its_eventgroup != its_instance->second.end()) {
- const auto its_client = its_eventgroup->second.find(_client);
- if (its_client != its_eventgroup->second.end()) {
- for (auto iter = its_client->second.begin();
- iter != its_client->second.end();) {
- if ((*iter)->response_message_id_ == _sd_message_id) {
- its_subscriber = *iter;
- iter = its_client->second.erase(iter);
- break;
- } else {
- iter++;
- }
- }
-
- // delete if necessary
- if (!its_client->second.size()) {
- its_eventgroup->second.erase(its_client);
- if (!its_eventgroup->second.size()) {
- its_instance->second.erase(its_eventgroup);
- if (!its_instance->second.size()) {
- its_service->second.erase(its_instance);
- if (!its_service->second.size()) {
- pending_remote_subscriptions_.erase(
- its_service);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if (its_subscriber) {
- remote_subscription_acknowledge_subscriber(_service, _instance,
- _eventgroup, its_subscriber, _acknowledged);
- }
-}
-
-void service_discovery_impl::update_subscription_expiration_timer(
- const std::shared_ptr<message_impl> &_message) {
- std::lock_guard<std::mutex> its_lock(subscription_expiration_timer_mutex_);
- const std::chrono::steady_clock::time_point now =
- std::chrono::steady_clock::now();
- stop_subscription_expiration_timer_unlocked();
- for (const auto &entry : _message->get_entries()) {
- if (entry->get_type() == entry_type_e::SUBSCRIBE_EVENTGROUP_ACK
- && entry->get_ttl()) {
- const std::chrono::steady_clock::time_point its_expiration = now
- + std::chrono::seconds(
- entry->get_ttl()
- * get_ttl_factor(
- entry->get_service(),
- entry->get_instance(),
- ttl_factor_subscriptions_));
- if (its_expiration < next_subscription_expiration_) {
- next_subscription_expiration_ = its_expiration;
- }
- }
- }
- start_subscription_expiration_timer_unlocked();
-}
-
-void service_discovery_impl::remote_subscription_acknowledge_subscriber(
- service_t _service, instance_t _instance, eventgroup_t _eventgroup,
- const std::shared_ptr<subscriber_t> &_subscriber, bool _acknowledged) {
- std::shared_ptr<message_impl> its_response = _subscriber->response_message_id_->response_;
- std::vector<std::tuple<service_t, instance_t, eventgroup_t,
- std::shared_ptr<endpoint_definition>>> its_acks;
- bool sent(false);
- {
- std::lock_guard<std::mutex> its_lock(response_mutex_);
- if (_acknowledged) {
- insert_subscription_ack(its_response, _service, _instance,
- _eventgroup, _subscriber->eventgroupinfo_,
- _subscriber->ttl_, _subscriber->counter_,
- _subscriber->major_, _subscriber->reserved_, _subscriber->subscriber);
- } else {
- insert_subscription_nack(its_response, _service, _instance,
- _eventgroup, _subscriber->counter_,
- _subscriber->major_, _subscriber->reserved_);
- }
-
- if (its_response->all_required_acks_contained()) {
- update_subscription_expiration_timer(its_response);
- serialize_and_send(its_response, _subscriber->response_message_id_->sender_);
- // set required acks to 0xFF to mark message as sent
- its_response->set_number_required_acks((std::numeric_limits<uint8_t>::max)());
- sent = true;
- }
- }
- if (sent) {
- for (const auto &e : its_response->get_entries()) {
- if (e->get_type() == entry_type_e::SUBSCRIBE_EVENTGROUP_ACK
- && e->get_ttl() > 0) {
- const std::shared_ptr<eventgroupentry_impl> casted_e =
- std::static_pointer_cast<eventgroupentry_impl>(e);
- const std::shared_ptr<endpoint_definition> its_reliable =
- casted_e->get_target(true);
- if (its_reliable) {
- its_acks.push_back(
- std::make_tuple(e->get_service(), e->get_instance(),
- casted_e->get_eventgroup(), its_reliable));
- }
- const std::shared_ptr<endpoint_definition> its_unreliable =
- casted_e->get_target(false);
- if (its_unreliable) {
- its_acks.push_back(
- std::make_tuple(e->get_service(), e->get_instance(),
- casted_e->get_eventgroup(),
- its_unreliable));
- }
- }
- }
- for (const auto& ack_tuple : its_acks) {
- host_->send_initial_events(std::get<0>(ack_tuple),
- std::get<1>(ack_tuple), std::get<2>(ack_tuple),
- std::get<3>(ack_tuple));
- }
- for (const auto &fie : its_response->forced_initial_events_get()) {
- host_->send_initial_events(fie.service_, fie.instance_,
- fie.eventgroup_, fie.target_);
- }
- }
-}
-
-void service_discovery_impl::remote_subscription_not_acknowledge_all(
- service_t _service, instance_t _instance) {
- std::map<eventgroup_t, std::vector<std::shared_ptr<subscriber_t>>>its_pending_subscriptions;
- {
- std::lock_guard<std::mutex> its_lock(pending_remote_subscriptions_mutex_);
- const auto its_service = pending_remote_subscriptions_.find(_service);
- if (its_service != pending_remote_subscriptions_.end()) {
- const auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- for (const auto &its_eventgroup : its_instance->second) {
- for (const auto &its_client : its_eventgroup.second) {
- its_pending_subscriptions[its_eventgroup.first].insert(
- its_pending_subscriptions[its_eventgroup.first].end(),
- its_client.second.begin(),
- its_client.second.end());
- }
- }
- // delete everything from this service instance
- its_service->second.erase(its_instance);
- if (!its_service->second.size()) {
- pending_remote_subscriptions_.erase(its_service);
- }
- }
- }
- }
- for (const auto &eg : its_pending_subscriptions) {
- for (const auto &its_subscriber : eg.second) {
- remote_subscription_acknowledge_subscriber(_service, _instance,
- eg.first, its_subscriber, false);
- }
- }
-}
-
-void service_discovery_impl::remote_subscription_not_acknowledge_all() {
- std::map<service_t,
- std::map<instance_t,
- std::map<eventgroup_t, std::vector<std::shared_ptr<subscriber_t>>>>> to_be_nacked;
- {
- std::lock_guard<std::mutex> its_lock(pending_remote_subscriptions_mutex_);
- for (const auto &its_service : pending_remote_subscriptions_) {
- for (const auto &its_instance : its_service.second) {
- for (const auto &its_eventgroup : its_instance.second) {
- for (const auto &its_client : its_eventgroup.second) {
- to_be_nacked[its_service.first]
- [its_instance.first]
- [its_eventgroup.first].insert(
- to_be_nacked[its_service.first][its_instance.first][its_eventgroup.first].end(),
- its_client.second.begin(),
- its_client.second.end());
- }
- }
- }
- }
- pending_remote_subscriptions_.clear();
- }
- for (const auto &s : to_be_nacked) {
- for (const auto &i : s.second) {
- for (const auto &eg : i.second) {
- for (const auto &sub : eg.second) {
- remote_subscription_acknowledge_subscriber(s.first, i.first,
- eg.first, sub, false);
- }
- }
- }
- }
-}
-
-bool service_discovery_impl::check_stop_subscribe_subscribe(
- message_impl::entries_t::const_iterator _iter,
- message_impl::entries_t::const_iterator _end,
- const message_impl::options_t& _options) const {
- const message_impl::entries_t::const_iterator its_next = std::next(_iter);
- if ((*_iter)->get_ttl() > 0
- || (*_iter)->get_type() != entry_type_e::STOP_SUBSCRIBE_EVENTGROUP
- || its_next == _end
- || (*its_next)->get_type() != entry_type_e::SUBSCRIBE_EVENTGROUP) {
- return false;
- }
-
- return (*static_cast<eventgroupentry_impl*>(_iter->get())).is_matching_subscribe(
- *(static_cast<eventgroupentry_impl*>(its_next->get())), _options);
-}
-
-configuration::ttl_factor_t service_discovery_impl::get_ttl_factor(
- service_t _service, instance_t _instance,
- const configuration::ttl_map_t& _ttl_map) const {
- configuration::ttl_factor_t its_ttl_factor(1);
- auto found_service = _ttl_map.find(_service);
- if (found_service != _ttl_map.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- its_ttl_factor = found_instance->second;
- }
- }
- return its_ttl_factor;
-}
-
-void service_discovery_impl::on_last_msg_received_timer_expired(
- const boost::system::error_code &_error) {
- if (!_error) {
- // we didn't receive a multicast message within 110% of the cyclic_offer_delay_
- VSOMEIP_WARNING << "Didn't receive a multicast SD message for " <<
- std::dec << last_msg_received_timer_timeout_.count() << "ms.";
- // rejoin multicast group
- if (endpoint_) {
- endpoint_->join(sd_multicast_);
- }
- {
- boost::system::error_code ec;
- std::lock_guard<std::mutex> its_lock(last_msg_received_timer_mutex_);
- last_msg_received_timer_.expires_from_now(last_msg_received_timer_timeout_, ec);
- last_msg_received_timer_.async_wait(
- std::bind(
- &service_discovery_impl::on_last_msg_received_timer_expired,
- shared_from_this(), std::placeholders::_1));
- }
- }
-}
-
-void service_discovery_impl::stop_last_msg_received_timer() {
- std::lock_guard<std::mutex> its_lock(last_msg_received_timer_mutex_);
- boost::system::error_code ec;
- last_msg_received_timer_.cancel(ec);
-}
-
-service_discovery_impl::remote_offer_type_e service_discovery_impl::get_remote_offer_type(
- service_t _service, instance_t _instance) {
- std::lock_guard<std::mutex> its_lock(remote_offer_types_mutex_);
- auto found_si = remote_offer_types_.find(std::make_pair(_service, _instance));
- if (found_si != remote_offer_types_.end()) {
- return found_si->second;
- }
- return remote_offer_type_e::UNKNOWN;
-}
-
-bool service_discovery_impl::update_remote_offer_type(
- service_t _service, instance_t _instance,
- remote_offer_type_e _offer_type,
- const boost::asio::ip::address &_reliable_address,
- const boost::asio::ip::address &_unreliable_address) {
- bool ret(false);
- std::lock_guard<std::mutex> its_lock(remote_offer_types_mutex_);
- const std::pair<service_t, instance_t> its_si_pair = std::make_pair(_service, _instance);
- auto found_si = remote_offer_types_.find(its_si_pair);
- if (found_si != remote_offer_types_.end()) {
- if (found_si->second != _offer_type ) {
- found_si->second = _offer_type;
- ret = true;
- }
- } else {
- remote_offer_types_[its_si_pair] = _offer_type;
- }
- switch (_offer_type) {
- case remote_offer_type_e::UNRELIABLE:
- remote_offers_by_ip_[_unreliable_address].insert(its_si_pair);
- break;
- case remote_offer_type_e::RELIABLE:
- remote_offers_by_ip_[_reliable_address].insert(its_si_pair);
- break;
- case remote_offer_type_e::RELIABLE_UNRELIABLE:
- remote_offers_by_ip_[_unreliable_address].insert(its_si_pair);
- break;
- case remote_offer_type_e::UNKNOWN:
- default:
- VSOMEIP_WARNING << __func__ << ": unkown offer type ["
- << std::hex << std::setw(4) << std::setfill('0') << _service << "."
- << std::hex << std::setw(4) << std::setfill('0') << _instance << "]"
- << _offer_type;
- break;
- }
- return ret;
-}
-
-void service_discovery_impl::remove_remote_offer_type(
- service_t _service, instance_t _instance,
- const boost::asio::ip::address &_address) {
- std::lock_guard<std::mutex> its_lock(remote_offer_types_mutex_);
- const std::pair<service_t, instance_t> its_si_pair =
- std::make_pair(_service, _instance);
- remote_offer_types_.erase(its_si_pair);
- auto found_services = remote_offers_by_ip_.find(_address);
- if (found_services != remote_offers_by_ip_.end()) {
- found_services->second.erase(its_si_pair);
- }
-}
-
-void service_discovery_impl::remove_remote_offer_type_by_ip(
- const boost::asio::ip::address &_address) {
- std::lock_guard<std::mutex> its_lock(remote_offer_types_mutex_);
- auto found_services = remote_offers_by_ip_.find(_address);
- if (found_services != remote_offers_by_ip_.end()) {
- for (const auto& si : found_services->second) {
- remote_offer_types_.erase(si);
- }
- }
- remote_offers_by_ip_.erase(_address);
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/serviceentry_impl.cpp b/implementation/service_discovery/src/serviceentry_impl.cpp
deleted file mode 100755
index 8ad66d2..0000000
--- a/implementation/service_discovery/src/serviceentry_impl.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (C) 2014-2017 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/serviceentry_impl.hpp"
-#include "../../message/include/deserializer.hpp"
-#include "../../message/include/serializer.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-serviceentry_impl::serviceentry_impl() {
- minor_version_ = 0;
-}
-
-serviceentry_impl::~serviceentry_impl() {
-}
-
-minor_version_t serviceentry_impl::get_minor_version() const {
- return minor_version_;
-}
-
-void serviceentry_impl::set_minor_version(minor_version_t _version) {
- minor_version_ = _version;
-}
-
-bool serviceentry_impl::serialize(vsomeip::serializer *_to) const {
- bool is_successful = entry_impl::serialize(_to);
-
- is_successful = is_successful
- && _to->serialize(static_cast<uint8_t>(major_version_));
- is_successful = is_successful
- && _to->serialize(static_cast<uint32_t>(ttl_), true);
- is_successful = is_successful
- && _to->serialize(static_cast<uint32_t>(minor_version_));
-
- return is_successful;
-}
-
-bool serviceentry_impl::deserialize(vsomeip::deserializer *_from) {
- bool is_successful = entry_impl::deserialize(_from);
-
- uint8_t tmp_major_version(0);
- is_successful = is_successful && _from->deserialize(tmp_major_version);
- major_version_ = static_cast<major_version_t>(tmp_major_version);
-
- uint32_t tmp_ttl(0);
- is_successful = is_successful && _from->deserialize(tmp_ttl, true);
- ttl_ = static_cast<ttl_t>(tmp_ttl);
-
- uint32_t tmp_minor_version(0);
- is_successful = is_successful && _from->deserialize(tmp_minor_version);
- minor_version_ = static_cast<minor_version_t>(tmp_minor_version);
-
- return is_successful;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/service_discovery/src/subscription.cpp b/implementation/service_discovery/src/subscription.cpp
deleted file mode 100644
index aca8967..0000000
--- a/implementation/service_discovery/src/subscription.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (C) 2014-2017 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/subscription.hpp"
-
-namespace vsomeip {
-namespace sd {
-
-subscription::subscription(major_version_t _major, ttl_t _ttl,
- std::shared_ptr<endpoint> _reliable,
- std::shared_ptr<endpoint> _unreliable,
- subscription_type_e _subscription_type,
- uint8_t _counter)
- : major_(_major), ttl_(_ttl),
- reliable_(_reliable), unreliable_(_unreliable),
- is_acknowledged_(true),
- tcp_connection_established_(false),
- udp_connection_established_(false),
- subscription_type_(_subscription_type),
- counter_(_counter) {
-}
-
-subscription::~subscription() {
-}
-
-major_version_t subscription::get_major() const {
- return major_;
-}
-
-ttl_t subscription::get_ttl() const {
- return ttl_;
-}
-
-void subscription::set_ttl(ttl_t _ttl) {
- ttl_ = _ttl;
-}
-
-std::shared_ptr<endpoint> subscription::get_endpoint(bool _reliable) const {
- return (_reliable ? reliable_ : unreliable_);
-}
-
-void subscription::set_endpoint(std::shared_ptr<endpoint> _endpoint,
- bool _reliable) {
- if (_reliable)
- reliable_ = _endpoint;
- else
- unreliable_ = _endpoint;
-}
-
-bool subscription::is_acknowledged() const {
- return is_acknowledged_;
-}
-
-void subscription::set_acknowledged(bool _is_acknowledged) {
- is_acknowledged_ = _is_acknowledged;
-}
-
-bool subscription::is_tcp_connection_established() const {
- return tcp_connection_established_;
-}
-void subscription::set_tcp_connection_established(bool _is_established) {
- tcp_connection_established_ = _is_established;
-}
-
-bool subscription::is_udp_connection_established() const {
- return udp_connection_established_;
-}
-void subscription::set_udp_connection_established(bool _is_established) {
- udp_connection_established_ = _is_established;
-}
-
-subscription_type_e subscription::get_subscription_type() const {
- return subscription_type_;
-}
-
-uint8_t subscription::get_counter() const {
- return counter_;
-}
-
-} // namespace sd
-} // namespace vsomeip
diff --git a/implementation/tracing/include/defines.hpp b/implementation/tracing/include/defines.hpp
deleted file mode 100644
index aadb44f..0000000
--- a/implementation/tracing/include/defines.hpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (C) 2014-2017 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 TRACING_INCLUDE_DEFINES_HPP_
-#define TRACING_INCLUDE_DEFINES_HPP_
-
-#define VSOMEIP_TC_DEFAULT_CHANNEL_NAME "Trace Connector Network Logging"
-#define VSOMEIP_TC_DEFAULT_CHANNEL_ID "TC"
-#define VSOMEIP_TC_DEFAULT_FILTER_TYPE "positive"
-
-#endif /* TRACING_INCLUDE_DEFINES_HPP_ */
diff --git a/implementation/tracing/include/enumeration_types.hpp b/implementation/tracing/include/enumeration_types.hpp
deleted file mode 100644
index 82ed3c4..0000000
--- a/implementation/tracing/include/enumeration_types.hpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) 2014-2017 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_TC_ENUMERATION_TYPES_HPP
-#define VSOMEIP_TC_ENUMERATION_TYPES_HPP
-
-namespace vsomeip {
-namespace tc {
-
-enum class filter_criteria_e : uint8_t {
- SERVICES = 0x00,
- METHODS = 0x01,
- CLIENTS = 0x02,
-};
-
-enum class filter_type_e : uint8_t {
- NEGATIVE = 0x00,
- POSITIVE = 0x01
-};
-
-} // namespace tc
-} // namespace vsomeip
-
-#endif // VSOMEIP_TC_ENUMERATION_TYPES_HPP
diff --git a/implementation/tracing/include/trace_connector.hpp b/implementation/tracing/include/trace_connector.hpp
deleted file mode 100644
index ef36e29..0000000
--- a/implementation/tracing/include/trace_connector.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2014-2017 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_TC_TRACE_CONNECTOR_HPP
-#define VSOMEIP_TC_TRACE_CONNECTOR_HPP
-
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/export.hpp>
-#include <boost/shared_ptr.hpp>
-#include <mutex>
-#include <vector>
-#include <map>
-
-#ifdef USE_DLT
-#include <dlt/dlt.h>
-#endif
-
-#include "enumeration_types.hpp"
-#include "trace_header.hpp"
-#include "../../endpoints/include/buffer.hpp"
-
-namespace vsomeip
-{
-namespace tc
-{
-
-class trace_connector {
-public:
- typedef uint16_t filter_expression_t;
- typedef std::vector<filter_expression_t> filter_expressions_t;
- typedef std::map<filter_criteria_e, filter_expressions_t> filter_rule_map_t;
- typedef std::pair<filter_type_e, filter_rule_map_t> filter_rule_t;
-
- typedef std::map<trace_channel_t, std::string> channels_t;
- typedef std::map<trace_channel_t, filter_rule_t> filter_rules_t;
-
-#ifdef USE_DLT
- typedef std::map<trace_channel_t, DltContext*> dlt_contexts_t;
-#endif
-
- VSOMEIP_EXPORT static std::shared_ptr<trace_connector> get();
-
- VSOMEIP_EXPORT trace_connector();
- VSOMEIP_EXPORT virtual ~trace_connector();
-
- VSOMEIP_EXPORT void init();
- VSOMEIP_EXPORT void reset();
-
- VSOMEIP_EXPORT void set_enabled(const bool _enabled);
- VSOMEIP_EXPORT bool is_enabled() const;
-
- VSOMEIP_EXPORT void set_sd_enabled(const bool _enabled);
- VSOMEIP_EXPORT bool is_sd_enabled() const;
-
- VSOMEIP_EXPORT bool is_sd_message(const byte_t *_data, uint16_t _data_size) const;
-
- VSOMEIP_EXPORT bool add_channel(const trace_channel_t &_id,const std::string &_name);
- VSOMEIP_EXPORT bool remove_channel(const trace_channel_t &_id);
-
- VSOMEIP_EXPORT bool add_filter_rule(const trace_channel_t &_channel_id,
- const filter_rule_t _filter_rule);
- VSOMEIP_EXPORT bool add_filter_expression(const trace_channel_t &_channel_id,
- const filter_criteria_e _criteria,
- const filter_expression_t _expression);
- VSOMEIP_EXPORT bool change_filter_expressions(const trace_channel_t &_channel_id,
- const filter_criteria_e _criteria,
- const filter_expressions_t _expressions);
- VSOMEIP_EXPORT bool remove_filter_rule(const trace_channel_t &_channel_id);
-
- VSOMEIP_EXPORT void trace(const byte_t *_header, uint16_t _header_size,
- const byte_t *_data, uint16_t _data_size);
-
- VSOMEIP_EXPORT channels_t get_channels();
- VSOMEIP_EXPORT filter_rules_t get_filter_rules();
- VSOMEIP_EXPORT filter_rule_t get_filter_rule(const trace_channel_t &_channel_id);
-
-private:
-
- bool apply_filter_rules(const byte_t *_data, const uint16_t _data_size,
- std::vector<trace_channel_t> &_send_msg_over_channels);
-
- bool filter_expressions_match(const filter_criteria_e _criteria,
- const filter_expressions_t _expressions,
- const byte_t *_data, const uint16_t _data_size);
-
- bool is_enabled_;
- bool is_sd_enabled_;
- bool is_initialized_;
-
- channels_t channels_;
- filter_rules_t filter_rules_;
-
-#ifdef USE_DLT
- dlt_contexts_t dlt_contexts_;
-#endif
-
- std::mutex channels_mutex_;
- std::mutex filter_rules_mutex_;
- std::mutex dlt_contexts_mutex;
-};
-
-} // namespace tc
-} // namespace vsomeip
-
-#endif // VSOMEIP_TC_TRACE_CONNECTOR_HPP
diff --git a/implementation/tracing/include/trace_header.hpp b/implementation/tracing/include/trace_header.hpp
deleted file mode 100644
index 11ccbdd..0000000
--- a/implementation/tracing/include/trace_header.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (C) 2016-2017 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_TC_TRACE_HEADER_HPP
-#define VSOMEIP_TC_TRACE_HEADER_HPP
-
-#include <memory>
-
-#include <vsomeip/primitive_types.hpp>
-
-#include <boost/asio/ip/address_v4.hpp>
-
-#define VSOMEIP_TRACE_HEADER_SIZE 10
-
-namespace vsomeip {
-
-class endpoint;
-
-namespace tc {
-
-enum class protocol_e : uint8_t {
- local = 0x0,
- udp = 0x1,
- tcp = 0x2,
- unknown = 0xFF
-};
-
-struct trace_header {
- bool prepare(const std::shared_ptr<endpoint> &_endpoint, bool _is_sending,
- instance_t _instance);
- bool prepare(const endpoint* _endpoint, bool _is_sending,
- instance_t _instance);
- void prepare(const boost::asio::ip::address_v4 &_address,
- std::uint16_t _port, protocol_e _protocol, bool _is_sending,
- instance_t _instance);
-
- byte_t data_[VSOMEIP_TRACE_HEADER_SIZE];
-};
-
-} // namespace tc
-} // namespace vsomeip
-
-#endif // VSOMEIP_TC_TRACE_HEADER_HPP
diff --git a/implementation/tracing/src/trace_connector.cpp b/implementation/tracing/src/trace_connector.cpp
deleted file mode 100644
index 93f7d6e..0000000
--- a/implementation/tracing/src/trace_connector.cpp
+++ /dev/null
@@ -1,381 +0,0 @@
-// Copyright (C) 2014-2017 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/trace_connector.hpp"
-
-#include <vsomeip/constants.hpp>
-
-#include "../include/defines.hpp"
-#include "../../configuration/include/internal.hpp"
-
-namespace vsomeip {
-namespace tc {
-
-std::shared_ptr<trace_connector> trace_connector::get() {
- static std::shared_ptr<trace_connector> instance = std::make_shared<trace_connector>();
- return instance;
-}
-
-trace_connector::trace_connector() :
- is_enabled_(false),
- is_sd_enabled_(false),
- is_initialized_(false),
- channels_(),
- filter_rules_()
- {
- channels_.insert(std::make_pair(VSOMEIP_TC_DEFAULT_CHANNEL_ID, VSOMEIP_TC_DEFAULT_CHANNEL_NAME));
-}
-
-trace_connector::~trace_connector() {
- reset();
-}
-
-void trace_connector::init() {
-#ifdef USE_DLT
- if(!is_initialized_) {
- // register channels/contexts
- std::lock_guard<std::mutex> lock(dlt_contexts_mutex);
- for(auto it = channels_.begin(); it != channels_.end(); ++it) {
- DltContext *dlt_context = new DltContext();
- dlt_contexts_.insert(std::make_pair(it->first, dlt_context));
- DLT_REGISTER_CONTEXT_LL_TS(*dlt_context, it->first.c_str(), it->second.c_str(), DLT_LOG_INFO, DLT_TRACE_STATUS_ON);
- }
- }
-#endif
- is_initialized_ = true;
-}
-
-void trace_connector::reset() {
- std::lock_guard<std::mutex> its_lock_channels(channels_mutex_);
- std::lock_guard<std::mutex> its_lock_filter_rules(filter_rules_mutex_);
- std::lock_guard<std::mutex> its_lock_dlt_contexts(dlt_contexts_mutex);
-
-#ifdef USE_DLT
- // unregister channels/contexts
- for(auto it = dlt_contexts_.begin(); it != dlt_contexts_.end(); ++it) {
- DLT_UNREGISTER_CONTEXT(*it->second);
- delete it->second;
- }
- dlt_contexts_.clear();
-#endif
-
- // reset to default
-
- channels_.clear();
- channels_.insert(std::make_pair(VSOMEIP_TC_DEFAULT_CHANNEL_ID, VSOMEIP_TC_DEFAULT_CHANNEL_NAME));
-
- filter_rules_.clear();
-
- is_initialized_ = false;
-}
-
-void trace_connector::set_enabled(const bool _enabled) {
- is_enabled_ = _enabled;
-}
-
-bool trace_connector::is_enabled() const {
- return is_enabled_;
-}
-
-void trace_connector::set_sd_enabled(const bool _sd_enabled) {
- is_sd_enabled_ = _sd_enabled;
-}
-
-bool trace_connector::is_sd_enabled() const {
- return is_sd_enabled_;
-}
-
-bool trace_connector::is_sd_message(const byte_t *_data, uint16_t _data_size) const {
- if (VSOMEIP_METHOD_POS_MAX < _data_size) {
- return (_data[VSOMEIP_SERVICE_POS_MIN] == 0xFF && _data[VSOMEIP_SERVICE_POS_MAX] == 0xFF &&
- _data[VSOMEIP_METHOD_POS_MIN] == 0x81 && _data[VSOMEIP_METHOD_POS_MAX] == 0x00);
- }
- return false;
-}
-
-bool trace_connector::add_channel(const trace_channel_t &_id, const std::string &_name) {
- std::lock_guard<std::mutex> its_lock_channels(channels_mutex_);
- std::lock_guard<std::mutex> its_lock_dlt_contexts(dlt_contexts_mutex);
-
- bool channel_inserted = false;
- bool dlt_context_registered = false;
-
- // add channel
- channel_inserted = channels_.insert(std::make_pair(_id, _name)).second;
-
- // register context
-#ifdef USE_DLT
- if(channel_inserted) {
- DltContext *dlt_context = new DltContext();
- dlt_context_registered = dlt_contexts_.insert(std::make_pair(_id, dlt_context)).second;
- DLT_REGISTER_CONTEXT_LL_TS(*dlt_context, _id.c_str(), _name.c_str(), DLT_LOG_INFO, DLT_TRACE_STATUS_ON);
- }
-#endif
-
- return (channel_inserted && dlt_context_registered);
-}
-
-bool trace_connector::remove_channel(const trace_channel_t &_id) {
-
- if(_id == VSOMEIP_TC_DEFAULT_CHANNEL_ID) {
- // the default channel can not be removed
- return false;
- }
-
- std::lock_guard<std::mutex> its_lock_channels(channels_mutex_);
- std::lock_guard<std::mutex> its_lock_filter_rules(filter_rules_mutex_);
- std::lock_guard<std::mutex> its_lock_dlt_contexts(dlt_contexts_mutex);
-
- bool channel_removed = false;
- bool dlt_context_unregistered = false;
-
- // remove channel
- channel_removed = (channels_.erase(_id) == 1);
- if(channel_removed) {
-
- // unregister context
-#ifdef USE_DLT
- auto it = dlt_contexts_.find(_id);
- if(it != dlt_contexts_.end()) {
- DltContext *dlt_context = it->second;
- DLT_UNREGISTER_CONTEXT(*dlt_context);
- dlt_context_unregistered = true;
- }
-#endif
-
- // remove filter
- filter_rules_.erase(_id);
- }
- return (channel_removed && dlt_context_unregistered);
-}
-
-bool trace_connector::add_filter_rule(const trace_channel_t &_channel_id,
- const filter_rule_t _filter_rule) {
- std::lock_guard<std::mutex> its_lock_filter_rules(filter_rules_mutex_);
- std::lock_guard<std::mutex> its_lock_channels(channels_mutex_);
-
- // find channel
- auto it = channels_.find(_channel_id);
- if(it != channels_.end()) {
- // add filter rule
- return filter_rules_.insert(std::make_pair(_channel_id, _filter_rule)).second;
- }
- return false;
-}
-
-bool trace_connector::add_filter_expression(const trace_channel_t &_channel_id,
- const filter_criteria_e _criteria,
- const filter_expression_t _expression) {
- std::lock_guard<std::mutex> its_lock_filter_rules(filter_rules_mutex_);
-
- // find filter rule
- auto it_filter_rules = filter_rules_.find(_channel_id);
- if(it_filter_rules != filter_rules_.end()) {
- filter_rule_t its_filter_rule = it_filter_rules->second;
-
- // find filter criteria
- auto it_filter_rule_map = its_filter_rule.second.find(_criteria);
- if(it_filter_rule_map != its_filter_rule.second.end()) {
- // add expression
- it_filter_rule_map->second.push_back(_expression);
- return true;
- }
- }
- return false;
-}
-
-bool trace_connector::change_filter_expressions(const trace_channel_t &_channel_id,
- const filter_criteria_e _criteria,
- const filter_expressions_t _expressions) {
- std::lock_guard<std::mutex> its_lock_filter_rules(filter_rules_mutex_);
-
- // find filter rule
- auto it_filter_rules = filter_rules_.find(_channel_id);
- if(it_filter_rules != filter_rules_.end()) {
- filter_rule_t its_filter_rule = it_filter_rules->second;
-
- // find filter criteria
- auto it_filter_rule_map = its_filter_rule.second.find(_criteria);
- if(it_filter_rule_map != its_filter_rule.second.end()) {
- // change expressions
- it_filter_rule_map->second = _expressions;
- return true;
- }
- }
- return false;
-}
-
-bool trace_connector::remove_filter_rule(const trace_channel_t &_channel_id) {
- std::lock_guard<std::mutex> its_lock_filter_rules(filter_rules_mutex_);
-
- auto it = filter_rules_.find(_channel_id);
- if(it != filter_rules_.end()) {
- return (filter_rules_.erase(_channel_id) == 1);
- }
- return false;
-}
-
-void trace_connector::trace(const byte_t *_header, uint16_t _header_size,
- const byte_t *_data, uint16_t _data_size) {
-#ifdef USE_DLT
- if(!is_enabled_)
- return;
-
- std::lock_guard<std::mutex> its_lock_filter_rules(filter_rules_mutex_);
- std::lock_guard<std::mutex> its_lock_channels(channels_mutex_);
- std::lock_guard<std::mutex> its_lock_dlt_contexts(dlt_contexts_mutex);
-
- if (_data_size == 0)
- return; // no data
-
- if (is_sd_message(_data, _data_size) && !is_sd_enabled_)
- return; // tracing of service discovery messages is disabled!
-
- // check if filter rules match
- std::vector<trace_channel_t> its_channels;
- if (apply_filter_rules(_data, _data_size, its_channels)) {
- // send message over 'its_channels'
- for(auto channel_id : its_channels) {
- //find dlt context
- auto it = dlt_contexts_.find(channel_id);
- if (it != dlt_contexts_.end()) {
- DltContext *dlt_context = it->second;
- DLT_TRACE_NETWORK_SEGMENTED(*dlt_context,
- DLT_NW_TRACE_IPC,
- _header_size, static_cast<void *>(const_cast<byte_t *>(_header)),
- _data_size, static_cast<void *>(const_cast<byte_t *>(_data)));
- }
- }
- }
-#else
- (void)_header;
- (void)_header_size;
- (void)_data;
- (void)_data_size;
-#endif
-}
-
-trace_connector::channels_t trace_connector::get_channels() {
- std::lock_guard<std::mutex>its_lock_channels(channels_mutex_);
- return channels_;
-}
-
-trace_connector::filter_rules_t trace_connector::get_filter_rules() {
- std::lock_guard<std::mutex> its_lock_filters(filter_rules_mutex_);
- return filter_rules_;
-}
-
-trace_connector::filter_rule_t trace_connector::get_filter_rule(const trace_channel_t &_channel_id) {
- std::lock_guard<std::mutex> its_lock_filters(filter_rules_mutex_);
-
- // find filter
- auto it = filter_rules_.find(_channel_id);
- if (it != filter_rules_.end()) {
- return filter_rules_[_channel_id];
- } else {
- return filter_rule_t();
- }
-}
-
-bool trace_connector::apply_filter_rules(const byte_t *_data, uint16_t _data_size,
- std::vector<trace_channel_t> &_send_msg_over_channels) {
- _send_msg_over_channels.clear();
- if (filter_rules_.size() == 0) {
- // no filter rules -> send message over all channels to DLT
- for(auto it=channels_.begin(); it !=channels_.end(); ++it)
- _send_msg_over_channels.push_back(it->first);
- return true;
- }
-
- // loop through filter rules
- for(auto it_filter_rules = filter_rules_.begin(); it_filter_rules != filter_rules_.end(); ++it_filter_rules) {
- trace_channel_t its_channel = it_filter_rules->first;
- filter_rule_t its_filter_rule = it_filter_rules->second;
-
- // apply filter rule
- bool trace_message = true;
- filter_type_e its_filter_type = its_filter_rule.first;
- for(auto it_filter_rule_map = its_filter_rule.second.begin();
- it_filter_rule_map != its_filter_rule.second.end() && trace_message;
- ++it_filter_rule_map) {
-
- filter_criteria_e its_criteria = it_filter_rule_map->first;
- auto &its_filter_expressions = it_filter_rule_map->second;
-
- if(its_filter_expressions.size() != 0) {
- // check if filter expressions of filter criteria match
- const bool filter_rule_matches = filter_expressions_match(its_criteria, its_filter_expressions, _data, _data_size);
- trace_message = !(filter_rule_matches && its_filter_type == filter_type_e::NEGATIVE);
- }
- }
-
- if(trace_message) {
- //filter rule matches -> send message over 'its_channel' to DLT
- _send_msg_over_channels.push_back(its_channel);
- }
- }
- return (_send_msg_over_channels.size() != 0);
-}
-
-bool trace_connector::filter_expressions_match(
- const filter_criteria_e _criteria, const filter_expressions_t _expressions,
- const byte_t *_data, uint16_t _data_size) {
-
- // ignore empty filter expressions
- if (_expressions.size() == 0) {
- return true;
- }
-
- // extract criteria from message
- bool is_successful(false);
- byte_t first = 0;
- byte_t second = 0;
- switch (_criteria) {
- case filter_criteria_e::SERVICES:
- if (VSOMEIP_SERVICE_POS_MAX < _data_size) {
- first = _data[VSOMEIP_SERVICE_POS_MIN];
- second = _data[VSOMEIP_SERVICE_POS_MAX];
- is_successful = true;
- }
- break;
- case filter_criteria_e::METHODS:
- if (VSOMEIP_SERVICE_POS_MAX < _data_size) {
- first = _data[VSOMEIP_METHOD_POS_MIN];
- second = _data[VSOMEIP_METHOD_POS_MAX];
- is_successful = true;
- }
- break;
- case filter_criteria_e::CLIENTS:
- if (VSOMEIP_CLIENT_POS_MAX < _data_size) {
- first = _data[VSOMEIP_CLIENT_POS_MIN];
- second = _data[VSOMEIP_CLIENT_POS_MAX];
- is_successful = true;
- }
- break;
- default:
- break;
- }
-
- // if extraction is successful, filter
- if (is_successful) {
- bool filter_expressions_matches = false;
- for (auto it_expressions = _expressions.begin();
- it_expressions != _expressions.end() && !filter_expressions_matches;
- ++it_expressions) {
- filter_expression_t its_filter_expression = *it_expressions;
- uint16_t its_message_value = 0;
-
- its_message_value = (uint16_t)((its_message_value << 8) + first);
- its_message_value = (uint16_t)((its_message_value << 8) + second);
-
- filter_expressions_matches = (its_filter_expression == its_message_value);
- }
- return filter_expressions_matches;
- }
- return false;
-}
-
-} // namespace tc
-} // namespace vsomeip
diff --git a/implementation/tracing/src/trace_header.cpp b/implementation/tracing/src/trace_header.cpp
deleted file mode 100644
index 3ae1b10..0000000
--- a/implementation/tracing/src/trace_header.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (C) 2016-2017 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 <cstring>
-
-#include "../include/trace_header.hpp"
-#include "../../endpoints/include/endpoint.hpp"
-#include "../../endpoints/include/client_endpoint.hpp"
-#include "../../utility/include/byteorder.hpp"
-
-namespace vsomeip {
-namespace tc {
-
-bool trace_header::prepare(const std::shared_ptr<endpoint> &_endpoint,
- bool _is_sending, instance_t _instance) {
- return prepare(_endpoint.get(), _is_sending, _instance);
-}
-
-bool trace_header::prepare(const endpoint *_endpoint, bool _is_sending,
- instance_t _instance) {
- boost::asio::ip::address its_address;
- unsigned short its_port(0);
- protocol_e its_protocol(protocol_e::unknown);
-
- if (_endpoint) {
- const client_endpoint* its_client_endpoint =
- dynamic_cast<const client_endpoint*>(_endpoint);
- if (its_client_endpoint) {
-
- its_client_endpoint->get_remote_address(its_address);
- if (its_address.is_v6()) {
- return false;
- }
-
- its_port = its_client_endpoint->get_remote_port();
-
- if (_endpoint->is_local()) {
- its_protocol = protocol_e::local;
- } else {
- if (_endpoint->is_reliable()) {
- its_protocol = protocol_e::tcp;
- } else {
- its_protocol = protocol_e::udp;
- }
- }
- }
- }
- prepare(its_address.to_v4(), its_port, its_protocol, _is_sending, _instance);
- return true;
-}
-
-void trace_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<byte_t>(_protocol);
- data_[7] = static_cast<byte_t>(_is_sending);
- data_[8] = VSOMEIP_WORD_BYTE1(_instance);
- data_[9] = VSOMEIP_WORD_BYTE0(_instance);
-}
-
-} // namespace tc
-} // namespace vsomeip
diff --git a/implementation/utility/include/byteorder.hpp b/implementation/utility/include/byteorder.hpp
deleted file mode 100644
index f6a0e1b..0000000
--- a/implementation/utility/include/byteorder.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (C) 2014-2017 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_BYTEORDER_HPP
-#define VSOMEIP_BYTEORDER_HPP
-
-#if defined(LINUX)
-#include <endian.h>
-#elif defined(FREEBSD)
-#include <sys/endian.h>
-#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_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_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_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_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_BYTEORDER_HPP
diff --git a/implementation/utility/include/criticalsection.hpp b/implementation/utility/include/criticalsection.hpp
deleted file mode 100644
index c980130..0000000
--- a/implementation/utility/include/criticalsection.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2016-2017 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_CRITICALSECTION_HPP
-#define VSOMEIP_CRITICALSECTION_HPP
-
-#include <memory>
-#include <mutex>
-
-namespace vsomeip {
-
-#ifdef _WIN32
-
- // Windows: CriticalSection uses win32 CRITICAL_SECTION.
- // Interface mimics std::mutex so we can use it in
- // conjunction with std::unique_lock.
- class CriticalSection final {
- public:
- CriticalSection();
- ~CriticalSection();
-
- // prevent copying
- CriticalSection(const CriticalSection&) = delete;
- CriticalSection& operator=(const CriticalSection&) = delete;
-
- void lock();
- void unlock();
- bool try_lock();
-
- private:
- struct Impl;
- std::unique_ptr<Impl> m_impl;
- };
-
-#else
-
- // Linux: CriticalSection is a type alias for std::mutex.
- using CriticalSection = std::mutex;
-
-#endif
-
-} // namespace vsomeip
-
-#endif //VSOMEIP_CRITICALSECTION_HPP
diff --git a/implementation/utility/include/utility.hpp b/implementation/utility/include/utility.hpp
deleted file mode 100644
index b0ff360..0000000
--- a/implementation/utility/include/utility.hpp
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright (C) 2014-2017 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_UTILITY_HPP
-#define VSOMEIP_UTILITY_HPP
-
-#include <memory>
-#include <vector>
-#include <set>
-
-#include <vsomeip/enumeration_types.hpp>
-#include <vsomeip/message.hpp>
-#include "criticalsection.hpp"
-
-namespace vsomeip {
-
-class configuration;
-
-class utility {
-public:
- static inline bool is_request(std::shared_ptr<message> _message) {
- return (_message ? is_request(_message->get_message_type()) : false);
- }
-
- static inline bool is_request(byte_t _type) {
- return (is_request(static_cast<message_type_e>(_type)));
- }
-
- static inline bool is_request(message_type_e _type) {
- return ((_type < message_type_e::MT_NOTIFICATION)
- || (_type >= message_type_e::MT_REQUEST_ACK
- && _type <= message_type_e::MT_REQUEST_NO_RETURN_ACK));
- }
-
- static inline bool is_request_no_return(std::shared_ptr<message> _message) {
- return (_message && is_request_no_return(_message->get_message_type()));
- }
-
- static inline bool is_request_no_return(byte_t _type) {
- return (is_request_no_return(static_cast<message_type_e>(_type)));
- }
-
- static inline bool is_request_no_return(message_type_e _type) {
- return (_type == message_type_e::MT_REQUEST_NO_RETURN
- || _type == message_type_e::MT_REQUEST_NO_RETURN_ACK);
- }
-
- static inline bool is_response(byte_t _type) {
- return is_response(static_cast<message_type_e>(_type));
- }
-
- static inline bool is_response(message_type_e _type) {
- return _type == message_type_e::MT_RESPONSE;
- }
-
- static inline bool is_error(byte_t _type) {
- return is_error(static_cast<message_type_e>(_type));
- }
-
- static inline bool is_error(message_type_e _type) {
- return _type == message_type_e::MT_ERROR;
- }
-
- static inline bool is_event(byte_t _data) {
- return (0x80 & _data) > 0;
- }
-
- static inline bool is_notification(byte_t _type) {
- return (is_notification(static_cast<message_type_e>(_type)));
- }
-
- static inline bool is_notification(message_type_e _type) {
- return (_type == message_type_e::MT_NOTIFICATION);
- }
-
- static uint64_t get_message_size(const byte_t *_data, size_t _size);
- static inline uint64_t get_message_size(std::vector<byte_t> &_data) {
- if (_data.size() > 0) {
- return (get_message_size(&_data[0], _data.size()));
- }
- return 0;
- }
-
- static uint32_t get_payload_size(const byte_t *_data, uint32_t _size);
-
- static bool exists(const std::string &_path);
- static bool VSOMEIP_IMPORT_EXPORT is_file(const std::string &_path);
- static bool VSOMEIP_IMPORT_EXPORT is_folder(const std::string &_path);
-
- static const std::string get_base_path(const std::shared_ptr<configuration> &_config);
- static const std::string get_shm_name(const std::shared_ptr<configuration> &_config);
-
- static CriticalSection its_local_configuration_mutex__;
-
- static struct configuration_data_t *the_configuration_data__;
- static bool auto_configuration_init(const std::shared_ptr<configuration> &_config);
- static void auto_configuration_exit(client_t _client,
- const std::shared_ptr<configuration> &_config);
-
- static bool is_routing_manager_host(client_t _client);
- static void set_routing_manager_host(client_t _client);
-
- static bool is_used_client_id(client_t _client,
- const std::shared_ptr<configuration> &_config);
- static client_t request_client_id(const std::shared_ptr<configuration> &_config,
- const std::string &_name, client_t _client);
- static void release_client_id(client_t _client);
- static std::set<client_t> get_used_client_ids();
-
- static inline bool is_valid_message_type(message_type_e _type) {
- return (_type == message_type_e::MT_REQUEST
- || _type == message_type_e::MT_REQUEST_NO_RETURN
- || _type == message_type_e::MT_NOTIFICATION
- || _type == message_type_e::MT_REQUEST_ACK
- || _type == message_type_e::MT_REQUEST_NO_RETURN_ACK
- || _type == message_type_e::MT_NOTIFICATION_ACK
- || _type == message_type_e::MT_RESPONSE
- || _type == message_type_e::MT_ERROR
- || _type == message_type_e::MT_RESPONSE_ACK
- || _type == message_type_e::MT_ERROR_ACK
- || _type == message_type_e::MT_UNKNOWN);
- }
-
-private:
- static bool is_bigger_last_assigned_client_id(client_t _client, std::uint16_t _diagnosis_mask);
- static void set_max_assigned_client_id_without_diagnosis(client_t _client);
- static void check_client_id_consistency();
-
- static uint16_t its_configuration_refs__;
- static std::uint16_t* used_client_ids__;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_UTILITY_HPP
diff --git a/implementation/utility/src/criticalsection.cpp b/implementation/utility/src/criticalsection.cpp
deleted file mode 100644
index 413ad19..0000000
--- a/implementation/utility/src/criticalsection.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2016-2017 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/criticalsection.hpp"
-
-#ifdef _WIN32
-
-#include <Windows.h>
-
-namespace vsomeip {
-
- struct CriticalSection::Impl final {
- CRITICAL_SECTION m_criticalSection;
- };
-
-
- CriticalSection::CriticalSection()
- : m_impl(new CriticalSection::Impl()) {
- InitializeCriticalSection(&m_impl->m_criticalSection);
- }
-
- CriticalSection::~CriticalSection() {
- DeleteCriticalSection(&m_impl->m_criticalSection);
- }
-
- void CriticalSection::lock() {
- EnterCriticalSection(&m_impl->m_criticalSection);
- }
-
- bool CriticalSection::try_lock() {
- return (TryEnterCriticalSection(&m_impl->m_criticalSection) != 0);
- }
-
- void CriticalSection::unlock(){
- LeaveCriticalSection(&m_impl->m_criticalSection);
- }
-
-} // namespace vsomeip
-
-#endif
diff --git a/implementation/utility/src/utility.cpp b/implementation/utility/src/utility.cpp
deleted file mode 100644
index a241618..0000000
--- a/implementation/utility/src/utility.cpp
+++ /dev/null
@@ -1,758 +0,0 @@
-// Copyright (C) 2014-2017 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/.
-
-#ifdef _WIN32
- #include <iostream>
-#else
- #include <dlfcn.h>
- #include <signal.h>
- #include <sys/mman.h>
- #include <thread>
- #include <sstream>
-#endif
-
-#include <sys/stat.h>
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/defines.hpp>
-
-#include "../include/byteorder.hpp"
-#include "../include/utility.hpp"
-#include "../../configuration/include/configuration.hpp"
-#include "../../configuration/include/internal.hpp"
-#include "../../logging/include/logger.hpp"
-
-#ifdef _WIN32
- #ifndef _WINSOCKAPI_
- #include <Windows.h>
- #endif
-#endif
-
-namespace vsomeip {
-
-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]);
- }
- return (its_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])
- - VSOMEIP_SOMEIP_HEADER_SIZE;
- }
- return (its_size);
-}
-
-bool utility::exists(const std::string &_path) {
- struct stat its_stat;
- return (stat(_path.c_str(), &its_stat) == 0);
-}
-
-bool utility::is_file(const std::string &_path) {
- struct stat its_stat;
- if (stat(_path.c_str(), &its_stat) == 0) {
- if (its_stat.st_mode & S_IFREG)
- return true;
- }
- return false;
-}
-
-bool utility::is_folder(const std::string &_path) {
- struct stat its_stat;
- if (stat(_path.c_str(), &its_stat) == 0) {
- if (its_stat.st_mode & S_IFDIR)
- return true;
- }
- return false;
-}
-
-const std::string utility::get_base_path(
- const std::shared_ptr<configuration> &_config) {
- return std::string(VSOMEIP_BASE_PATH + _config->get_network() + "-");
-}
-
-const std::string utility::get_shm_name(
- const std::shared_ptr<configuration> &_config) {
- return std::string("/" + _config->get_network());
-}
-
-// pointer to shared memory
-configuration_data_t *utility::the_configuration_data__(nullptr);
-// critical section to protect shared memory pointers, handles and ref count in this process
-CriticalSection utility::its_local_configuration_mutex__;
-// number of times auto_configuration_init() has been called in this process
-uint16_t utility::its_configuration_refs__(0);
-// pointer to used client IDs array in shared memory
-std::uint16_t* utility::used_client_ids__(0);
-
-#ifdef _WIN32
-// global (inter-process) mutex
-static HANDLE configuration_data_mutex(INVALID_HANDLE_VALUE);
-// memory mapping handle
-static HANDLE its_descriptor(INVALID_HANDLE_VALUE);
-#endif
-
-bool utility::auto_configuration_init(const std::shared_ptr<configuration> &_config) {
- std::unique_lock<CriticalSection> its_lock(its_local_configuration_mutex__);
-
- const size_t its_shm_size = sizeof(configuration_data_t) +
- static_cast<std::uint16_t>(~_config->get_diagnosis_mask()) * sizeof(client_t);
-#ifdef _WIN32
- if (its_configuration_refs__ > 0) {
- assert(configuration_data_mutex != INVALID_HANDLE_VALUE);
- assert(its_descriptor != INVALID_HANDLE_VALUE);
- assert(the_configuration_data__ != nullptr);
-
- ++its_configuration_refs__;
- } else {
- configuration_data_mutex = CreateMutex(
- NULL, // default security attributes
- true, // initially owned
- "vSomeIP_SharedMemoryLock"); // named mutex
- if (configuration_data_mutex) {
-
- if (GetLastError() == ERROR_ALREADY_EXISTS) {
- VSOMEIP_INFO << "utility::auto_configuration_init: use existing shared memory";
-
- // mapping already exists, wait for mutex release and map in
- DWORD waitResult = WaitForSingleObject(configuration_data_mutex, INFINITE);
- if (waitResult == WAIT_OBJECT_0) {
-
- its_descriptor = CreateFileMapping(
- INVALID_HANDLE_VALUE, // use paging file
- NULL, // default security
- PAGE_READWRITE, // read/write access
- 0, // maximum object size (high-order DWORD)
- its_shm_size, // maximum object size (low-order DWORD)
- utility::get_shm_name(_config).c_str());// name of mapping object
-
- if (its_descriptor && GetLastError() == ERROR_ALREADY_EXISTS) {
-
- void *its_segment = (LPTSTR)MapViewOfFile(its_descriptor, // handle to map object
- FILE_MAP_ALL_ACCESS, // read/write permission
- 0,
- 0,
- its_shm_size);
-
- if (its_segment) {
- the_configuration_data__
- = reinterpret_cast<configuration_data_t *>(its_segment);
-
- ++its_configuration_refs__;
- } else {
- VSOMEIP_ERROR << "utility::auto_configuration_init: MapViewOfFile failed (" << GetLastError() << ")";
- }
- } else {
- if (its_descriptor) {
- VSOMEIP_ERROR << "utility::auto_configuration_init: CreateFileMapping failed. expected existing mapping";
- } else {
- VSOMEIP_ERROR << "utility::auto_configuration_init: CreateFileMapping failed (" << GetLastError() << ")";
- }
- }
- } else {
- VSOMEIP_ERROR << "utility::auto_configuration_init: WaitForSingleObject(mutex) failed (" << GetLastError() << ")";
- }
-
- } else {
- VSOMEIP_INFO << "utility::auto_configuration_init: create new shared memory";
-
- // create and init new mapping
- its_descriptor = CreateFileMapping(
- INVALID_HANDLE_VALUE, // use paging file
- NULL, // default security
- PAGE_READWRITE, // read/write access
- 0, // maximum object size (high-order DWORD)
- its_shm_size, // maximum object size (low-order DWORD)
- utility::get_shm_name(_config).c_str());// name of mapping object
-
- if (its_descriptor) {
- void *its_segment = (LPTSTR)MapViewOfFile(its_descriptor, // handle to map object
- FILE_MAP_ALL_ACCESS, // read/write permission
- 0,
- 0,
- its_shm_size);
- if (its_segment) {
- the_configuration_data__
- = reinterpret_cast<configuration_data_t *>(its_segment);
-
- the_configuration_data__->client_base_
- = static_cast<unsigned short>((_config->get_diagnosis_address() << 8) & _config->get_diagnosis_mask());
- the_configuration_data__->max_clients_ = static_cast<std::uint16_t>(~_config->get_diagnosis_mask());
- the_configuration_data__->max_used_client_ids_index_ = 1;
- the_configuration_data__->max_assigned_client_id_without_diagnosis_ = 0x00;
- the_configuration_data__->routing_manager_host_ = 0x0000;
- // the clientid array starts right after the routing_manager_host_ struct member
- used_client_ids__ = reinterpret_cast<unsigned short*>(
- reinterpret_cast<size_t>(&the_configuration_data__->routing_manager_host_) + sizeof(unsigned short));
- used_client_ids__[0] = the_configuration_data__->client_base_;
- the_configuration_data__->client_base_++;
- std::string its_name = _config->get_routing_host();
- if (its_name == "")
- the_configuration_data__->routing_manager_host_ = the_configuration_data__->client_base_;
-
- its_configuration_refs__++;
- } else {
- VSOMEIP_ERROR << "utility::auto_configuration_init: MapViewOfFile failed (" << GetLastError() << ")";
- }
- } else {
- VSOMEIP_ERROR << "utility::auto_configuration_init: CreateFileMapping failed (" << GetLastError() << ")";
- }
- }
-
- // always release mutex
- ReleaseMutex(configuration_data_mutex);
- } else {
- VSOMEIP_ERROR << "utility::auto_configuration_init: CreateMutex failed (" << GetLastError() << ")";
- }
-
- // cleanup in case of error
- if (the_configuration_data__ == nullptr) {
- if (its_descriptor != INVALID_HANDLE_VALUE) {
- CloseHandle(its_descriptor);
- its_descriptor = INVALID_HANDLE_VALUE;
- }
- if (configuration_data_mutex != INVALID_HANDLE_VALUE) {
- CloseHandle(configuration_data_mutex);
- configuration_data_mutex = INVALID_HANDLE_VALUE;
- }
- }
- }
-#else
- const mode_t previous_mask(::umask(static_cast<mode_t>(_config->get_umask())));
- int its_descriptor = shm_open(utility::get_shm_name(_config).c_str(), O_RDWR | O_CREAT | O_EXCL,
- static_cast<mode_t>(_config->get_permissions_shm()));
- ::umask(previous_mask);
- if (its_descriptor > -1) {
- if (-1 == ftruncate(its_descriptor, its_shm_size)) {
- VSOMEIP_ERROR << "utility::auto_configuration_init: "
- "ftruncate failed: " << std::strerror(errno);
- } else {
- void *its_segment = mmap(0, its_shm_size,
- PROT_READ | PROT_WRITE, MAP_SHARED,
- its_descriptor, 0);
- if(MAP_FAILED == its_segment) {
- VSOMEIP_ERROR << "utility::auto_configuration_init: "
- "mmap failed: " << std::strerror(errno);
- } else {
- the_configuration_data__
- = reinterpret_cast<configuration_data_t *>(its_segment);
- if (the_configuration_data__ != nullptr) {
- int ret;
- pthread_mutexattr_t attr;
- ret = pthread_mutexattr_init(&attr);
- if (0 == ret) {
- ret = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
- if (0 != ret) {
- VSOMEIP_ERROR << "pthread_mutexattr_setpshared() failed " << ret;
- }
- ret = pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST);
- if (0 != ret) {
- VSOMEIP_ERROR << "pthread_mutexattr_setrobust() failed " << ret;
- }
-
- } else {
- VSOMEIP_ERROR << "pthread_mutexattr_init() failed " << ret;
- }
- ret = pthread_mutex_init(&the_configuration_data__->mutex_, (0==ret)?&attr:NULL);
- if (0 != ret) {
- VSOMEIP_ERROR << "pthread_mutex_init() failed " << ret;
- }
- ret = pthread_mutex_lock(&the_configuration_data__->mutex_);
- if (0 != ret) {
- VSOMEIP_ERROR << "pthread_mutex_lock() failed " << ret;
- }
-
- the_configuration_data__->client_base_
- = static_cast<unsigned short>((_config->get_diagnosis_address() << 8) & _config->get_diagnosis_mask());
- the_configuration_data__->max_clients_ = static_cast<std::uint16_t>(~_config->get_diagnosis_mask());
- the_configuration_data__->max_used_client_ids_index_ = 1;
- the_configuration_data__->max_assigned_client_id_without_diagnosis_ = 0x00;
- the_configuration_data__->routing_manager_host_ = 0x0000;
- // the clientid array starts right after the routing_manager_host_ struct member
- used_client_ids__ = reinterpret_cast<unsigned short*>(
- reinterpret_cast<size_t>(&the_configuration_data__->routing_manager_host_) + sizeof(unsigned short));
- used_client_ids__[0] = the_configuration_data__->client_base_;
- the_configuration_data__->client_base_++;
-
- std::string its_name = _config->get_routing_host();
-
- its_configuration_refs__++;
-
- the_configuration_data__->initialized_ = 1;
-
- ret = pthread_mutex_unlock(&the_configuration_data__->mutex_);
- if (0 != ret) {
- VSOMEIP_ERROR << "pthread_mutex_unlock() failed " << ret;
- }
- }
-
- if(-1 == ::close(its_descriptor)) {
- VSOMEIP_ERROR << "utility::auto_configuration_init: "
- "close failed: " << std::strerror(errno);
- }
- }
- }
- } else if (errno == EEXIST) {
- const mode_t previous_mask(::umask(static_cast<mode_t>(_config->get_umask())));
- its_descriptor = shm_open(utility::get_shm_name(_config).c_str(), O_RDWR,
- static_cast<mode_t>(_config->get_permissions_shm()));
- ::umask(previous_mask);
- if (-1 == its_descriptor) {
- VSOMEIP_ERROR << "utility::auto_configuration_init: "
- "shm_open failed: " << std::strerror(errno);
- } else {
- // truncate to make sure we work on valid shm;
- // in case creator already called truncate, this effectively becomes a noop
- if (-1 == ftruncate(its_descriptor, its_shm_size)) {
- VSOMEIP_ERROR << "utility::auto_configuration_init: "
- "ftruncate failed: " << std::strerror(errno);
- } else {
- void *its_segment = mmap(0, its_shm_size,
- PROT_READ | PROT_WRITE, MAP_SHARED,
- its_descriptor, 0);
- if(MAP_FAILED == its_segment) {
- VSOMEIP_ERROR << "utility::auto_configuration_init: "
- "mmap failed: " << std::strerror(errno);
- } else {
- configuration_data_t *configuration_data
- = reinterpret_cast<configuration_data_t *>(its_segment);
-
- // check if it is ready for use (for 3 seconds)
- int retry_count = 300;
- while (configuration_data->initialized_ == 0 && --retry_count > 0) {
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- }
-
- if (configuration_data->initialized_ == 0) {
- VSOMEIP_ERROR << "utility::auto_configuration_init: data in shm not initialized";
- } else {
- the_configuration_data__ = configuration_data;
-
- if (EOWNERDEAD == pthread_mutex_lock(&the_configuration_data__->mutex_)) {
- VSOMEIP_WARNING << "utility::auto_configuration_init EOWNERDEAD";
- check_client_id_consistency();
- if (0 != pthread_mutex_consistent(&the_configuration_data__->mutex_)) {
- VSOMEIP_ERROR << "pthread_mutex_consistent() failed ";
- }
- }
- its_configuration_refs__++;
- used_client_ids__ = reinterpret_cast<unsigned short*>(
- reinterpret_cast<size_t>(&the_configuration_data__->routing_manager_host_)
- + sizeof(unsigned short));
- pthread_mutex_unlock(&the_configuration_data__->mutex_);
- }
-
- if (-1 == ::close(its_descriptor)) {
- VSOMEIP_ERROR << "utility::auto_configuration_init: "
- "close failed: " << std::strerror(errno);
- }
- }
- }
- }
- }
-#endif
- return (the_configuration_data__ != nullptr);
-}
-
-void utility::auto_configuration_exit(client_t _client,
- const std::shared_ptr<configuration> &_config) {
- std::unique_lock<CriticalSection> its_lock(its_local_configuration_mutex__);
- const size_t its_shm_size = sizeof(configuration_data_t) +
- static_cast<std::uint16_t>(~_config->get_diagnosis_mask()) * sizeof(client_t);
- if (the_configuration_data__) {
-#ifdef _WIN32
- // not manipulating data in shared memory, no need to take global mutex
-
- assert(configuration_data_mutex != INVALID_HANDLE_VALUE);
- assert(its_descriptor != INVALID_HANDLE_VALUE);
-
- its_configuration_refs__--;
-
- if (is_routing_manager_host(_client)) {
- set_routing_manager_host(0x0000);
- }
-
- if (its_configuration_refs__ == 0) {
- UnmapViewOfFile(the_configuration_data__);
- the_configuration_data__ = nullptr;
- used_client_ids__ = nullptr;
-
- CloseHandle(its_descriptor);
- its_descriptor = NULL;
-
- CloseHandle(configuration_data_mutex);
- configuration_data_mutex = NULL;
- }
-#else
- its_configuration_refs__--;
-
- bool unlink_shm = false;
- if (is_routing_manager_host(_client)) {
- set_routing_manager_host(0x0000);
- unlink_shm = true;
- }
-
- if (its_configuration_refs__ == 0) {
- if (-1 == ::munmap(the_configuration_data__, its_shm_size)) {
- VSOMEIP_ERROR << "utility::auto_configuration_exit: "
- "munmap failed: " << std::strerror(errno);
- } else {
- VSOMEIP_INFO << "utility::auto_configuration_exit: "
- "munmap succeeded.";
- the_configuration_data__ = nullptr;
- used_client_ids__ = nullptr;
- if (unlink_shm) {
- shm_unlink(utility::get_shm_name(_config).c_str());
- }
- }
-
- }
-#endif
- }
-}
-
-bool utility::is_used_client_id(client_t _client,
- const std::shared_ptr<configuration> &_config) {
- for (int i = 0;
- i < the_configuration_data__->max_used_client_ids_index_;
- i++) {
- if (used_client_ids__[i] == _client) {
- return true;
- }
- }
-#ifndef _WIN32
- std::stringstream its_client;
- its_client << utility::get_base_path(_config) << std::hex << _client;
- if (exists(its_client.str())) {
- if (-1 == ::unlink(its_client.str().c_str())) {
- VSOMEIP_WARNING << "unlink failed for " << its_client.str() << ". Client identifier 0x"
- << std::hex << _client << " can't be reused!";
- return true;
- }
-
- }
-#endif
- return false;
-}
-
-std::set<client_t> utility::get_used_client_ids() {
- std::set<client_t> clients;
-
- std::unique_lock<CriticalSection> its_lock(its_local_configuration_mutex__);
-
- if (the_configuration_data__ != nullptr) {
-#ifdef _WIN32
- DWORD waitResult = WaitForSingleObject(configuration_data_mutex, INFINITE);
- assert(waitResult == WAIT_OBJECT_0);
- (void)waitResult;
-#else
- if (EOWNERDEAD == pthread_mutex_lock(&the_configuration_data__->mutex_)) {
- VSOMEIP_WARNING << "utility::request_client_id EOWNERDEAD";
- check_client_id_consistency();
- if (0 != pthread_mutex_consistent(&the_configuration_data__->mutex_)) {
- VSOMEIP_ERROR << "pthread_mutex_consistent() failed ";
- }
- }
-#endif
- for (int i = 1;
- i < the_configuration_data__->max_used_client_ids_index_;
- i++) {
- clients.insert(used_client_ids__[i]);
- }
-
-#ifdef _WIN32
- BOOL releaseResult = ReleaseMutex(configuration_data_mutex);
- assert(releaseResult);
- (void)releaseResult;
-#else
- pthread_mutex_unlock(&the_configuration_data__->mutex_);
-#endif
- }
-
- return clients;
-}
-
-client_t utility::request_client_id(const std::shared_ptr<configuration> &_config, const std::string &_name, client_t _client) {
- std::unique_lock<CriticalSection> its_lock(its_local_configuration_mutex__);
-
- if (the_configuration_data__ != nullptr) {
- const std::string its_name = _config->get_routing_host();
-#ifdef _WIN32
- DWORD waitResult = WaitForSingleObject(configuration_data_mutex, INFINITE);
- assert(waitResult == WAIT_OBJECT_0);
- (void)waitResult;
-#else
- if (EOWNERDEAD == pthread_mutex_lock(&the_configuration_data__->mutex_)) {
- VSOMEIP_WARNING << "utility::request_client_id EOWNERDEAD";
- check_client_id_consistency();
- if (0 != pthread_mutex_consistent(&the_configuration_data__->mutex_)) {
- VSOMEIP_ERROR << "pthread_mutex_consistent() failed ";
- }
- }
-
- pid_t pid = getpid();
- if (its_name == "" || _name == its_name) {
- if (the_configuration_data__->pid_ != 0) {
- if (pid != the_configuration_data__->pid_) {
- if (kill(the_configuration_data__->pid_, 0) == -1) {
- VSOMEIP_WARNING << "Routing Manager seems to be inactive. Taking over...";
- the_configuration_data__->routing_manager_host_ = 0x0000;
- }
- }
- }
- }
-#endif
-
- bool set_client_as_manager_host(false);
- if (its_name != "" && its_name == _name) {
- if (the_configuration_data__->routing_manager_host_ == 0x0000) {
- set_client_as_manager_host = true;
- } else {
- VSOMEIP_ERROR << "Routing manager with id " << the_configuration_data__->routing_manager_host_ << " already exists.";
-#ifdef _WIN32
- BOOL releaseResult = ReleaseMutex(configuration_data_mutex);
- assert(releaseResult);
- (void)releaseResult;
-#else
- pthread_mutex_unlock(&the_configuration_data__->mutex_);
-#endif
- return ILLEGAL_CLIENT;
- }
- } else if (its_name == "" && the_configuration_data__->routing_manager_host_ == 0x0000) {
- set_client_as_manager_host = true;
- }
-
- if (the_configuration_data__->max_used_client_ids_index_
- == the_configuration_data__->max_clients_) {
- VSOMEIP_ERROR << "Max amount of possible concurrent active"
- << " vsomeip applications reached (" << std::dec <<
- the_configuration_data__->max_clients_ << ").";
-#ifdef _WIN32
- BOOL releaseResult = ReleaseMutex(configuration_data_mutex);
- assert(releaseResult);
- (void)releaseResult;
-#else
- pthread_mutex_unlock(&the_configuration_data__->mutex_);
-#endif
- return ILLEGAL_CLIENT;
- }
-
- bool use_autoconfig = true;
- if (_name != "" && _client != ILLEGAL_CLIENT) { // preconfigured client id
- // check if application name has preconfigured client id in json
- const client_t its_preconfigured_client_id = _config->get_id(_name);
- if (its_preconfigured_client_id) {
- // preconfigured client id for application name present in json
- if (its_preconfigured_client_id == _client) {
- // preconfigured client id for application name present in json
- // and requested
- if (!is_used_client_id(_client, _config)) {
- use_autoconfig = false;
- }
- } else {
- // preconfigured client id for application name present in
- // json, but different client id requested
- if (!is_used_client_id(its_preconfigured_client_id, _config)) {
- // assign preconfigured client id if not already used
- _client = its_preconfigured_client_id;
- use_autoconfig = false;
- } else if (!is_used_client_id(_client, _config)) {
- // if preconfigured client id is already used and
- // requested is unused assign requested
- use_autoconfig = false;
- }
- }
- }
- }
-
- if (use_autoconfig) {
- if (_client == ILLEGAL_CLIENT || is_used_client_id(_client, _config)) {
- _client = the_configuration_data__->client_base_;
- }
- int increase_count = 0;
- while (is_used_client_id(_client, _config)
- || !is_bigger_last_assigned_client_id(_client, _config->get_diagnosis_mask())
- || _config->is_configured_client_id(_client)) {
- if ((_client & the_configuration_data__->max_clients_)
- + 1 > the_configuration_data__->max_clients_) {
- _client = the_configuration_data__->client_base_;
- the_configuration_data__->max_assigned_client_id_without_diagnosis_ = 0;
- } else {
- _client++;
- increase_count++;
- if (increase_count > the_configuration_data__->max_clients_) {
- VSOMEIP_ERROR << "Max amount of possible concurrent active"
- << " vsomeip applications reached (" << std::dec <<
- the_configuration_data__->max_clients_ << ").";
-#ifdef _WIN32
- BOOL releaseResult = ReleaseMutex(configuration_data_mutex);
- assert(releaseResult);
- (void)releaseResult;
-#else
- pthread_mutex_unlock(&the_configuration_data__->mutex_);
-#endif
- return ILLEGAL_CLIENT;
- }
- }
- }
- set_max_assigned_client_id_without_diagnosis(_client);
- }
-
- if (set_client_as_manager_host) {
- the_configuration_data__->routing_manager_host_ = _client;
-#ifndef _WIN32
- the_configuration_data__->pid_ = pid;
-#endif
- }
-
- used_client_ids__[the_configuration_data__->max_used_client_ids_index_] = _client;
- the_configuration_data__->max_used_client_ids_index_++;
-
-
-#ifdef _WIN32
- BOOL releaseResult = ReleaseMutex(configuration_data_mutex);
- assert(releaseResult);
- (void)releaseResult;
-#else
- pthread_mutex_unlock(&the_configuration_data__->mutex_);
-#endif
- return _client;
- }
- return ILLEGAL_CLIENT;
-}
-
-void utility::release_client_id(client_t _client) {
- std::unique_lock<CriticalSection> its_lock(its_local_configuration_mutex__);
- if (the_configuration_data__ != nullptr) {
-#ifdef _WIN32
- WaitForSingleObject(configuration_data_mutex, INFINITE);
-#else
- if (EOWNERDEAD == pthread_mutex_lock(&the_configuration_data__->mutex_)) {
- VSOMEIP_WARNING << "utility::release_client_id EOWNERDEAD";
- check_client_id_consistency();
- if (0 != pthread_mutex_consistent(&the_configuration_data__->mutex_)) {
- VSOMEIP_ERROR << "pthread_mutex_consistent() failed ";
- }
- }
-#endif
- int i = 0;
- for (; i < the_configuration_data__->max_used_client_ids_index_; i++) {
- if (used_client_ids__[i] == _client) {
- break;
- }
- }
-
- if (i < the_configuration_data__->max_used_client_ids_index_) {
- for (; i < (the_configuration_data__->max_used_client_ids_index_ - 1); i++) {
- used_client_ids__[i] = used_client_ids__[i+1];
- }
- the_configuration_data__->max_used_client_ids_index_--;
- }
-#ifdef _WIN32
- ReleaseMutex(configuration_data_mutex);
-#else
- pthread_mutex_unlock(&the_configuration_data__->mutex_);
-#endif
- }
-}
-
-bool utility::is_routing_manager_host(client_t _client) {
- if (the_configuration_data__ == nullptr) {
- VSOMEIP_ERROR << "utility::is_routing_manager_host: configuration data not available";
- return false;
- }
-
-#ifdef _WIN32
- WaitForSingleObject(configuration_data_mutex, INFINITE);
-#else
- if (EOWNERDEAD == pthread_mutex_lock(&the_configuration_data__->mutex_)) {
- VSOMEIP_WARNING << "utility::is_routing_manager_host EOWNERDEAD";
- check_client_id_consistency();
- if (0 != pthread_mutex_consistent(&the_configuration_data__->mutex_)) {
- VSOMEIP_ERROR << "pthread_mutex_consistent() failed ";
- }
- }
-#endif
-
- bool is_routing_manager = (the_configuration_data__->routing_manager_host_ == _client);
-
-#ifdef _WIN32
- ReleaseMutex(configuration_data_mutex);
-#else
- pthread_mutex_unlock(&the_configuration_data__->mutex_);
-#endif
-
- return is_routing_manager;
-}
-
-void utility::set_routing_manager_host(client_t _client) {
- if (the_configuration_data__ == nullptr) {
- VSOMEIP_ERROR << "utility::set_routing_manager_host: configuration data not available";
- return;
- }
-
-#ifdef _WIN32
- WaitForSingleObject(configuration_data_mutex, INFINITE);
-#else
- if (EOWNERDEAD == pthread_mutex_lock(&the_configuration_data__->mutex_)) {
- VSOMEIP_WARNING << "utility::set_routing_manager_host EOWNERDEAD";
- check_client_id_consistency();
- if (0 != pthread_mutex_consistent(&the_configuration_data__->mutex_)) {
- VSOMEIP_ERROR << "pthread_mutex_consistent() failed ";
- }
- }
-#endif
-
- the_configuration_data__->routing_manager_host_ = _client;
-
-#ifdef _WIN32
- ReleaseMutex(configuration_data_mutex);
-#else
- pthread_mutex_unlock(&the_configuration_data__->mutex_);
-#endif
-}
-
-bool utility::is_bigger_last_assigned_client_id(client_t _client, std::uint16_t _diagnosis_mask) {
- return _client
- > ((the_configuration_data__->client_base_ & _diagnosis_mask)
- + the_configuration_data__->max_assigned_client_id_without_diagnosis_);
-}
-
-void utility::set_max_assigned_client_id_without_diagnosis(client_t _client) {
- const std::uint16_t its_client_id_without_diagnosis =
- static_cast<std::uint16_t>(_client
- & the_configuration_data__->max_clients_);
- the_configuration_data__->max_assigned_client_id_without_diagnosis_ =
- static_cast<std::uint16_t>(its_client_id_without_diagnosis
- % the_configuration_data__->max_clients_);
-}
-
-void utility::check_client_id_consistency() {
- if (1 < the_configuration_data__->max_used_client_ids_index_) {
- client_t prevID = used_client_ids__[0];
- int i = 1;
- for (; i < the_configuration_data__->max_used_client_ids_index_; i++) {
- const client_t currID = used_client_ids__[i];
- if (prevID == currID) {
- break;
- }
- prevID = currID;
- }
-
- if (i < the_configuration_data__->max_used_client_ids_index_) {
- for (; i < (the_configuration_data__->max_used_client_ids_index_ - 1); i++) {
- used_client_ids__[i] = used_client_ids__[i+1];
- }
- the_configuration_data__->max_used_client_ids_index_--;
- }
- }
-}
-
-} // namespace vsomeip
diff --git a/interface/vsomeip/application.hpp b/interface/vsomeip/application.hpp
deleted file mode 100644
index 42bd534..0000000
--- a/interface/vsomeip/application.hpp
+++ /dev/null
@@ -1,954 +0,0 @@
-// Copyright (C) 2014-2017 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_APPLICATION_HPP
-#define VSOMEIP_APPLICATION_HPP
-
-#include <chrono>
-#include <memory>
-#include <set>
-#include <map>
-#include <vector>
-
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/enumeration_types.hpp>
-#include <vsomeip/function_types.hpp>
-#include <vsomeip/constants.hpp>
-#include <vsomeip/handler.hpp>
-
-namespace vsomeip {
-
-class configuration;
-class event;
-class payload;
-
-/**
- * \defgroup vsomeip
- *
- * @{
- */
-
-/**
- *
- * \brief This class contains the public API of the vsomeip implementation.
- *
- * Due to its heavy resource footprint, it should exist once per client and can
- * be instantiated using the API of @ref runtime. It manages the lifecycle of
- * the vsomeip client and allocates all resources needed to communicate.
- *
- */
-class application {
-public:
- virtual ~application() {}
-
- /**
- *
- * \brief Returns the name of the application as given during creation
- *
- * The application name is used to identify the application. It is either
- * set explicitely when the application object is created or configured by
- * the environment variable VSOMEIP_APPLICATION_NAME.
- *
- * Note: A user application can use several vsomeip application objects in
- * parallel. The application names must be set explicitly in this case
- * because VSOMEIP_APPLICATION_NAME only allows to specify a single name.
- *
- *
- * \return Application name
- *
- */
- virtual const std::string & get_name() const = 0;
-
- /**
- *
- * \brief Returns the client identifier that was assigned to the
- * application object.
- *
- * Each request sent by and each response sent to the application contain
- * the client identifier as part of the request identifier within the
- * SOME/IP message header. The client identifier can either be configured
- * by the configured as part of the application node within a vsomeip
- * configuration file or is automatically set to an unused client
- * identifier by vsomeip. If the client identifier is automatically set,
- * its high byte will always match the diagnosis address of the device.
- *
- * \return Client ID of application
- *
- */
- virtual client_t get_client() const = 0;
-
- /**
- *
- * \brief Does nothing.
- *
- * This method exists for compatibility reasons only. It is a null
- * operation and will be removed with the next major vsomeip version.
- *
- */
- virtual void set_configuration(const std::shared_ptr<configuration> _configuration) = 0;
-
- /**
- *
- * \brief Initializes the application.
- *
- * The init method must be called first after creating a vsomeip
- * application and executes the following steps to initialize it:
- * - Loading the configuration from a dynamic module
- * - Loading the configuration from a .json file or
- * - Loading the configuration from compiled data (not yet available)
- * - Determining routing configuration and initialization of the routing
- * itself
- * - Installing signal handlers
- *
- */
- virtual bool init() = 0;
-
- /**
- *
- * \brief Starts message processing.
- *
- * This method must be called after init to start message processing. It
- * will block until the message processing is terminated using the @ref
- * stop method or by receiving signals. It processes messages received
- * via the sockets and uses registered callbacks to pass them to the user
- * application.
- *
- */
- virtual void start() = 0;
-
- /**
- *
- * \brief Stops message processing.
- *
- * This method stops message processing. Thus, @ref start will return
- * after a call to stop.
- *
- */
- virtual void stop() = 0;
-
- /**
- *
- * \brief Offers a SOME/IP service instance.
- *
- * The user application must call this method for each service it offers
- * to register it at the vsomeip routing component, which makes the
- * service visible to interested clients. Dependent on the configuration
- * the service is available internally only or internally and externally.
- * To offer a service to the external network, the configuration must
- * contain a port for the offered service instance. If no such port
- * configuration is provided, the service is not visible outside the
- * device.
- *
- * \param _service Service identifier of the offered service interface.
- * \param _instance Instance identifier of the offered service instance.
- * \param _major Major service version (Default: 0).
- * \param _minor Minor service version (Default: 0).
- *
- */
- virtual void offer_service(service_t _service, instance_t _instance,
- major_version_t _major = DEFAULT_MAJOR, minor_version_t _minor =
- DEFAULT_MINOR) = 0;
-
- /**
- *
- * \brief Stops offering a SOME/IP service instance.
- *
- * The user application must call this method to withdraw a service offer.
- *
- * \param _service Service identifier of the offered service interface.
- * \param _instance Instance identifer of the offered service instance.
- * \param _major Major service version (Default: 0).
- * \param _minor Minor service version (Default: 0).
- *
- */
- virtual void stop_offer_service(service_t _service, instance_t _instance,
- major_version_t _major = DEFAULT_MAJOR, minor_version_t _minor =
- DEFAULT_MINOR) = 0;
-
- /**
- *
- * \brief Offers a SOME/IP event or field.
- *
- * A user application must call this method for each event/field it wants
- * to offer. The event is registered at the vsomeip routing component that
- * enables other applications to subscribe to the event/field as well as
- * to get and set the field value.
- *
- * \param _service Service identifier of the interface containing the
- * event.
- * \param _instance Instance identifier of the interface containing the
- * event.
- * \param _event Event identifier of the offered event.
- * \param _eventgroups List of eventgroup identifiers of the eventgroups
- * that contain the event.
- * \param _is_field Selector for event or field.
- *
- */
- virtual void offer_event(service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroups,
- bool _is_field) = 0;
-
- /**
- *
- * \brief Stops offering a SOME/IP event or field.
- *
- * A user application must call this method to withdraw the offer of an
- * event or field.
- *
- * \param _service Service identifier of the interface that contains the
- * event
- * \param _instance Instance identifier of the interface that contains the
- * event
- * \param _event Event identifier of the offered event.
- *
- */
- virtual void stop_offer_event(service_t _service,
- instance_t _instance, event_t _event) = 0;
-
- /**
- *
- * \brief Registers the application as client of a service instance.
- *
- * A user application must call this method for each service instance it
- * wants to use. The request is stored within the routing component and the
- * application is registered as client for the service as soon as the
- * service instance becomes available.
- *
- * \param _service Service identifier of the requested service interface.
- * \param _instance Instance identifier of the requested service instance.
- * \param _major Major service version (Default: 0xFF).
- * \param _minor Minor service version (Default: 0xFFFFFF).
- * \param _use_exclusive_proxy Create an IP endpoint that is exclusively
- * used for the communication of this application to the service instance.
- *
- */
- virtual void request_service(service_t _service, instance_t _instance,
- major_version_t _major = ANY_MAJOR,
- minor_version_t _minor = ANY_MINOR,
- bool _use_exclusive_proxy = false) = 0;
-
- /**
- *
- * \brief Unregister the application as client of a service instance.
- *
- * A user application should call this method if it does not request to
- * use the service instance any longer. The method unregisters the request
- * a the routing component, which removes the service instance from the
- * list of requested service instances if the call releases the last
- * existing request for the service instance. This is important for
- * external service instances, as the SOME/IP Service Discovery can avoid
- * to send unnecessary Find messages.
- *
- * \param _service Service identifier of the offered service interface.
- * \param _instance Instance identifier of the offered service instance.
- *
- */
- virtual void release_service(service_t _service, instance_t _instance) = 0;
-
- /**
- *
- * \brief Registers the application as user of an event or field.
- *
- * A user application must call this method before being able to receive
- * event or field data. The method registers the event or field at the
- * routing component.
- *
- * \param _service Service identifier of the interface that contains the
- * event.
- * \param _instance Instance identifier of the interface that contains the
- * event.
- * \param _event Event identifier of the event.
- * \param _eventgroups List of Eventgroup identifiers of the eventgroups
- * that contain the event.
- * \param _is_field Pure event (false) or field (true).
- *
- */
- virtual void request_event(service_t _service, instance_t _instance,
- event_t _event, const std::set<eventgroup_t> &_eventgroups,
- bool _is_field) = 0;
- /**
- *
- * \brief Unregister the application as user of an event or field.
- *
- * Unregister the application as user of an event or field and completely
- * removes the event/field if the application is the last existing user.
- *
- * \param _service Service identifier of the interface that contains the
- * event or field.
- * \param _instance Instance identifier of the instance that contains the
- * event or field.
- * \param _event Event identifier of the event or field.
- * .
- */
- virtual void release_event(service_t _service, instance_t _instance,
- event_t _event) = 0;
-
- /**
- *
- * \brief Subscribes to an eventgroup.
- *
- * A user application must call this function to subscribe to an eventgroup.
- * Before calling subscribe it must register all events it interested in by
- * calls to @ref request_event. The method additionally allows to specify
- * a specific event. If a specific event is specified, all other events of
- * the eventgroup are not received by the application.
- *
- * Note: For external services, providing a specific event does not change
- * anything regarding the message routing. The specific event is only used
- * to filter incoming events and to determine which initial events must be
- * sent.
- *
- * \param _service Service identifier of the service that contains the
- * eventgroup.
- * \param _instance Instance identifier of the service that contains the
- * eventgroup.
- * \param _eventgroup Eventgroup identifier of the eventgroup.
- * \param _major Major version number of the service.
- * \param _subscription_type Specifies how the events shall be received.
- * \param _event All (Default) or a specific event.
- *
- */
- virtual void subscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, major_version_t _major = DEFAULT_MAJOR,
- subscription_type_e _subscription_type = subscription_type_e::SU_RELIABLE_AND_UNRELIABLE,
- event_t _event = ANY_EVENT) = 0;
-
- /**
- *
- * \brief Unsubscribes from an eventgroup.
- *
- * \param _service Service identifier of the service that contains the
- * eventgroup.
- * \param _instance Instance identifier of the service that contains the
- * eventgroup.
- * \param _eventgroup Eventgroup identifier of the eventgroup.
- *
- */
- virtual void unsubscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup) = 0;
-
- /**
- *
- * \brief Retrieve for the availability of a service instance.
- *
- * If the version is also given, the result will only be true if the
- * service instance is available in that specific version.
- *
- * \param _service Service identifier of the service instance.
- * \param _instance Instance identifier of the service instance.
- * \param _major Major interface version. Use ANY_MAJOR to ignore the
- * major version.
- * \param _minor Minor interface version. Use ANY_MINOR to ignore the
- * minor version.
- *
- */
- virtual bool is_available(service_t _service, instance_t _instance,
- major_version_t _major = DEFAULT_MAJOR, minor_version_t _minor = DEFAULT_MINOR) const = 0;
-
- /**
- *
- * \brief Sends a message.
- *
- * Serializes the specified message object, determines the taget and sends
- * the message to the target. For requests, the request identifier is
- * automatically built from the client identifier and the session
- * identifier.
- *
- * \param _message Message object.
- * \param _flush If set to true, the message is immediately sent. Otherwise
- * the message might be deferred and sent together with other messages.
- *
- */
- virtual void send(std::shared_ptr<message> _message, bool _flush = true) = 0;
-
- /**
- *
- * \brief Fire an event or field notification.
- *
- * The specified event is updated with the specified payload data.
- * Dependent on the type of the event, the payload is distributed to all
- * notified clients (always for events, only if the payload has changed
- * for fields).
- *
- * Note: Prior to using this method, @ref offer_event has to be called by
- * the service provider.
- *
- * \param _service Service identifier of the service that contains the
- * event.
- * \param _instance Instance identifier of the service instance that
- * holds the event.
- * \param _event Event identifier of the event.
- * \param _payload Serialized payload of the event.
- *
- */
- virtual void notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload) const = 0;
-
- /**
- *
- * \brief Fire an event to a specific client.
- *
- * The specified event is updated with the specified payload data.
- * Dependent on the type of the event, the payload is distributed to all
- * notified clients (always for events, only if the payload has changed
- * for fields).
- *
- * Note: Prior to using this method, @ref offer_event has to be called by
- * the service provider.
- *
- * \param _service Service identifier of the service that contains the
- * event.
- * \param _instance Instance identifier of the service instance that
- * holds the event.
- * \param _event Event identifier of the event.
- * \param _payload Serialized payload of the event.
- * \param _client Target client.
- *
- */
- virtual void notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- client_t _client) const = 0;
-
- /**
- *
- * \brief Register a state handler with the vsomeip runtime.
- *
- * The state handler tells if this client is successfully [de]registered
- * at the central vsomeip routing component. This is called during the
- * @ref start and @ref stop methods of this class to inform the user
- * application about the registration state.
- *
- * \param _handler Handler function to be called on state change.
- *
- */
- virtual void register_state_handler(state_handler_t _handler) = 0;
-
- /**
- *
- * \brief Unregister the state handler.
- *
- */
- virtual void unregister_state_handler() = 0;
-
- /**
- *
- * \brief Registers a handler for the specified method or event.
- *
- * A user application must call this method to register callbacks for
- * for messages that match the specified service, instance, method/event
- * pattern. It is possible to specify wildcard values for all three
- * identifiers arguments.
- *
- * Notes:
- * - Only a single handler can be registered per service, instance,
- * method/event combination.
- * - A subsequent call will overwrite an existing registration.
- * - Handler registrations containing wildcards can be active in parallel
- * to handler registrations for specific service, instance, method/event
- * combinations.
- *
- * \param _service Service identifier of the service that contains the
- * method or event. Can be set to ANY_SERVICE to register a handler for
- * a message independent from a specific service.
- * \param _instance Instance identifier of the service instance that
- * contains the method or event. Can be set to ANY_INSTANCE to register
- * a handler for a message independent from a specific service.
- * \param _method Method/Event identifier of the method/event that is
- * to be handled. Can be set to ANY_METHOD to register a handler for
- * all methods and events.
- * \param _handler Callback that will be called if a message arrives
- * that matches the specified service, instance and method/event
- * parameters.
- *
- */
- virtual void register_message_handler(service_t _service,
- instance_t _instance, method_t _method,
- message_handler_t _handler) = 0;
- /**
- *
- * \brief Unregisters the message handler for the specified service
- * method/event notification.
- *
- * \param _service Service identifier of the service that contains the
- * method or event. Can be set to ANY_SERVICE to unregister a handler for
- * a message independent from a specific service.
- * \param _instance Instance identifier of the service instance that
- * contains the method or event. Can be set to ANY_INSTANCE to unregister
- * a handler for a message independent from a specific service.
- * \param _method Method/Event identifier of the method/event that is
- * to be handled. Can be set to ANY_METHOD to unregister a handler for
- * all methods and events.
- */
- virtual void unregister_message_handler(service_t _service,
- instance_t _instance, method_t _method) = 0;
-
- /**
- *
- * \brief Register a callback that is called when service instances
- * availability changes.
- *
- * This method allows for the registration of callbacks that are called
- * whenever a service appears or disappears. It is possible to specify
- * wildcards for service, instance and/or version. Additionally, the
- * version specification is optional and defaults to DEFAULT_MAJOR
- * /DEFAULT_MINOR.
- *
- * \param _service Service identifier of the service instance whose
- * availability shall be reported. Can be set to ANY_SERVICE.
- * \param _instance Instance identifier of the service instance whose
- * availability shall be reported. Can be set to ANY_INSTANCE.
- * \param _handler Callback to be called if availability changes.
- * \param _major Major service version. The parameter defaults to
- * DEFAULT_MAJOR and can be set to ANY_MAJOR.
- * \param _minor Minor service version. The parameter defaults to
- * DEFAULT_MINOR and can be set to ANY_MINOR.
- *
- */
- virtual void register_availability_handler(service_t _service,
- instance_t _instance, availability_handler_t _handler,
- major_version_t _major = DEFAULT_MAJOR, minor_version_t _minor = DEFAULT_MINOR) = 0;
-
- /**
- *
- * \brief Unregister an availability callback.
- *
- * \param _service Service identifier of the service instance whose
- * availability shall be reported. Can be set to ANY_SERVICE.
- * \param _instance Instance identifier of the service instance whose
- * availability shall be reported. Can be set to ANY_INSTANCE.
- * \param _handler Callback to be called if availability changes.
- * \param _major Major service version. The parameter defaults to
- * DEFAULT_MAJOR and can be set to ANY_MAJOR.
- * \param _minor Minor service version. The parameter defaults to
- * DEFAULT_MINOR and can be set to ANY_MINOR. *
- */
- virtual void unregister_availability_handler(service_t _service,
- instance_t _instance,
- major_version_t _major = DEFAULT_MAJOR, minor_version_t _minor = DEFAULT_MINOR) = 0;
-
- /**
- *
- * \brief Registers a subscription handler.
- *
- * A subscription handler is called whenever the subscription state of an
- * eventgroup changes. The callback is called with the client identifier
- * and a boolean that indicates whether the client subscribed or
- * unsubscribed.
- *
- * \param _service Service identifier of service instance whose
- * subscription state is to be monitored.
- * \param _instance Instance identifier of service instance whose
- * subscription state is to be monitored.
- * \param _eventgroup Eventgroup identifier of eventgroup whose
- * subscription state is to be monitored.
- * \param _handler Callback that shall be called.
- *
- */
- virtual void register_subscription_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- subscription_handler_t _handler) = 0;
-
- /**
- *
- * \brief Unregister a subscription handler.
- *
- * \param _service Service identifier of service instance whose
- * subscription state is to be monitored.
- * \param _instance Instance identifier of service instance whose
- * subscription state is to be monitored.
- * \param _eventgroup Eventgroup identifier of eventgroup whose
- * subscription state is to be monitored.
- *
- */
- virtual void unregister_subscription_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) = 0;
-
- // [Un]Register handler for subscription errors
- /**
- *
- * \brief Allows for the registration of a subscription error handler.
- *
- * This handler is called whenever a subscription request for an eventgroup
- * was either accepted or rejected. The respective callback is called with
- * ether OK (0x00) or REJECTED (0x07).
- *
- * \param _service Service identifier of service instance whose
- * subscription error state is to be monitored.
- * \param _instance Instance identifier of service instance whose
- * subscription error state is to be monitored.
- * \param _eventgroup Eventgroup identifier of eventgroup whose
- * subscription error state is to be monitored.
- * \param _handler Callback that shall be called.
- *
- */
- virtual void register_subscription_error_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup,
- error_handler_t _handler) = 0;
-
- /**
- *
- * \brief Removes a registered subscription error callback.
- *
- * \param _service Service identifier of service instance whose
- * error callback shall be removed.
- * \param _instance Instance identifier of service instance whose
- * error callback shall be removed.
- * \param _eventgroup Eventgroup identifier of eventgroup whose
- * error callback shall be removed.
- *
- */
- virtual void unregister_subscription_error_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup) = 0;
-
- /**
- *
- * \brief Unregister all registered handlers.
- *
- */
- virtual void clear_all_handler() = 0;
-
- /**
- *
- * \brief This method tells whether or not this application controls the
- * message routing.
- *
- * The application that controls the routing hosts the routing manager
- * and (optionally) loads the Service Discovery component.
- *
- * \return true, if this is the central routing instance, and false
- * otherwise
- *
- */
- virtual bool is_routing() const = 0;
-
- /**
- *
- * \brief Offers a SOME/IP event or field.
- *
- * A user application must call this method for each event/field it wants
- * to offer. The event is registered at the vsomeip routing component that
- * enables other applications to subscribe to the event/field as well as
- * to get and set the field value.
- *
- * This version of offer_event adds some additional functionalities:
- * - It is possible to configure a cycle time. The notification message of
- * this event is then resent cyclically.
- * - The parameter _change_resets_cycle is available to control how event
- * notification works in case the data is updated by the application. If
- * set to true, an update of the data immediately leads to a
- * notification. Otherwise, the updated data is sent only after the
- * expiration of the cycle time.
- * - It is possible to specify callback function that can be used to
- * implement a predicate that determines whether or not two event values
- * are considered different. Field notifications are only sent if the
- * predicate evaluates to true (or if a notify method is called with the
- * force flag being set).
- *
- * \param _service Service identifier of the interface containing the
- * event.
- * \param _instance Instance identifier of the interface containing the
- * event.
- * \param _event Event identifier of the offered event.
- * \param _eventgroups List of eventgroup identifiers of the eventgroups
- * that contain the event.
- * \param _is_field Selector for event or field.
- * \param _cycle Sets the cycle time of the event. If nonzero, data is
- * resent cyclically after the cycle time expired.
- * \param _change_resets_cycle Tells if a change immediately leads to
- * a notification.
- * \param _epsilon_change_func Predicate that determines if two given
- * payloads are considered different.
- *
- * Note: The different versions of offer_event exist for compatibility
- * reasons. They will be merged with the next major vsomeip version.
- */
- virtual void offer_event(service_t _service,
- instance_t _instance, event_t _event,
- const std::set<eventgroup_t> &_eventgroups,
- bool _is_field,
- std::chrono::milliseconds _cycle,
- bool _change_resets_cycle,
- const epsilon_change_func_t &_epsilon_change_func) = 0;
-
- /**
- *
- * \brief Fire an event or field notification.
- *
- * The specified event is updated with the specified payload data.
- * Dependent on the type of the event, the payload is distributed to all
- * notified clients (always for events, only if the payload has changed
- * for fields).
- *
- * Note: Prior to using this method, @ref offer_event has to be called by
- * the service provider.
- *
- * \param _service Service identifier of the service that contains the
- * event.
- * \param _instance Instance identifier of the service instance that
- * holds the event.
- * \param _event Event identifier of the event.
- * \param _payload Serialized payload of the event.
- * \param _force Forces the notification to be sent (even if the event
- * is a field and the value did not change).
- *
- * Note: The different versions of notify do exist for compatibility
- * reasons. They will be merged with the next major vsomeip release.
- */
- virtual void notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- bool _force) const = 0;
-
- /**
- *
- * \brief Fire an event or field notification.
- *
- * The specified event is updated with the specified payload data.
- * Dependent on the type of the event, the payload is distributed to all
- * notified clients (always for events, only if the payload has changed
- * for fields).
- *
- * Note: Prior to using this method, @ref offer_event has to be called by
- * the service provider.
- *
- * \param _service Service identifier of the service that contains the
- * event.
- * \param _instance Instance identifier of the service instance that
- * holds the event.
- * \param _event Event identifier of the event.
- * \param _payload Serialized payload of the event.
- * \param _client Target client.
- * \param _force Forces the notification to be sent (even if the event
- * is a field and the value did not change).
- *
- * Note: The different versions of notify_one do exist for compatibility
- * reasons. They will be merged with the next major vsomeip release.
- */
- virtual void notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- client_t _client, bool _force) const = 0;
-
- typedef std::map<service_t, std::map<instance_t, std::map<major_version_t, minor_version_t >>> available_t;
- /**
- * \brief Returns all available instances that match the given combination
- * of service, instance and version.
- *
- * This method checks the availability of the service instances that
- * match the specified combination of service, instance and version
- * parameters. If at least one matching service instance is available,
- * the method returns true, otherwise it returns false. All available
- * service instances are returned to the caller by filling the
- * _available parameter.
- *
- * \param _available Map that is filled with the available instances.
- * \param _service Service identifier that specifies which service(s)
- * are checked.
- * \param _instance Instance identifier that specifies which instance(s)
- * are checked.
- * \param _major_version Major version(s) of the service instances that
- * are checked
- * \param _minor_version Minor version(s) of the service instance that
- * are checked
- */
- virtual bool are_available(available_t &_available,
- service_t _service = ANY_SERVICE, instance_t _instance = ANY_INSTANCE,
- major_version_t _major = ANY_MAJOR, minor_version_t _minor = ANY_MINOR) const = 0;
-
- /**
- *
- * \brief Fire an event or field notification.
- *
- * The specified event is updated with the specified payload data.
- * Dependent on the type of the event, the payload is distributed to all
- * notified clients (always for events, only if the payload has changed
- * for fields).
- *
- * Note: Prior to using this method, @ref offer_event has to be called by
- * the service provider.
- *
- * \param _service Service identifier of the service that contains the
- * event.
- * \param _instance Instance identifier of the service instance that
- * holds the event.
- * \param _event Event identifier of the event.
- * \param _payload Serialized payload of the event.
- * \param _force Forces the notification to be sent (even if the event
- * is a field and the value did not change).
- * \param _flush Must be set to ensure the event is immediately fired.
- *
- * Note: The different versions of notify do exist for compatibility
- * reasons. They will be merged with the next major vsomeip release.
- */
- virtual void notify(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- bool _force, bool _flush) const = 0;
-
- /**
- *
- * \brief Fire an event or field notification.
- *
- * The specified event is updated with the specified payload data.
- * Dependent on the type of the event, the payload is distributed to all
- * notified clients (always for events, only if the payload has changed
- * for fields).
- *
- * Note: Prior to using this method, @ref offer_event has to be called by
- * the service provider.
- *
- * \param _service Service identifier of the service that contains the
- * event.
- * \param _instance Instance identifier of the service instance that
- * holds the event.
- * \param _event Event identifier of the event.
- * \param _payload Serialized payload of the event.
- * \param _client Target client.
- * \param _force Forces the notification to be sent (even if the event
- * is a field and the value did not change).
- * \param _flush Must be set to ensure the event is immediately fired.
- *
- * Note: The different versions of notify_one do exist for compatibility
- * reasons. They will be merged with the next major vsomeip release.
- */
- virtual void notify_one(service_t _service, instance_t _instance,
- event_t _event, std::shared_ptr<payload> _payload,
- client_t _client, bool _force, bool _flush) const = 0;
-
- /**
- * \brief Set the current routing state.
- *
- * The routing state impacts the behavior of the SOME/IP Service Discovery component. It
- * can be set to RUNNING, SUSPENDED, RESUMED, SHUTDOWN or UNKNOWN. Applications only need
- * to set the routing state if they are responsible for controlling the routing manager.
- * In most environments the vsomeip daemon is controlling the routing manager.
- *
- * \param _routing_state the current routing state
- */
- virtual void set_routing_state(routing_state_e _routing_state) = 0;
-
- /**
- *
- * \brief Unsubscribes from an eventgroup.
- *
- * \param _service Service identifier of the service that contains the
- * eventgroup.
- * \param _instance Instance identifier of the service that contains the
- * eventgroup.
- * \param _eventgroup Eventgroup identifier of the eventgroup.
- * \param _event Event to unsubscribe (pass ANY_EVENT for all events of the eventgroup)
- */
- virtual void unsubscribe(service_t _service, instance_t _instance,
- eventgroup_t _eventgroup, event_t _event) = 0;
-
-
- /**
- *
- * \brief Registers a subscription status listener.
- *
- * When registered such a handler it will be called for
- * every application::subscribe call.
- *
- * This method is intended to replace the application::
- * register_subscription_error_handler call in future releases.
- *
- * \param _service Service identifier of the service that is subscribed to.
- * \param _instance Instance identifier of the service that is subscribed to.
- * \param _eventgroup Eventgroup identifier of the eventgroup is subscribed to.
- * \param _event Event indentifier of the event is subscribed to.
- * \param _handler A subscription status handler which will be called by vSomeIP
- * as a follow of application::subscribe.
- */
- virtual void register_subscription_status_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- subscription_status_handler_t _handler) = 0;
-
- /**
- *
- * \brief Registers a subscription status listener.
- *
- * When registered such a handler it will be called for
- * every application::subscribe call.
- *
- * This method is intended to replace the application::
- * register_subscription_error_handler call in future releases.
- *
- * \param _service Service identifier of the service that is subscribed to.
- * \param _instance Instance identifier of the service that is subscribed to.
- * \param _eventgroup Eventgroup identifier of the eventgroup is subscribed to.
- * \param _event Event indentifier of the event is subscribed to.
- * \param _handler A subscription status handler which will be called by vSomeIP
- * as a follow of application::subscribe.
- * \param _is_selective Flag to enable calling the provided handler if the
- * subscription is answered with a SUBSCRIBE_NACK.
- */
- virtual void register_subscription_status_handler(service_t _service,
- instance_t _instance, eventgroup_t _eventgroup, event_t _event,
- subscription_status_handler_t _handler, bool _is_selective) = 0;
-
- /**
- *
- * \brief Returns all registered services / instances on this node in an async callback.
- *
- * When called with a handler of type offered_services_handler_t,
- * all at the routing manager registered services on this node get returned in a vector of
- * service / instance pairs depending on the given _offer_type.
- *
- * \param _offer_type type of offered services to be returned (OT_LOCAL = 0x00, OT_REMOTE = 0x01, OT_ALL = 0x02)
- * \param offered_services_handler_t handler which gets called with a vector of service instance pairs that are currently offered
- */
- virtual void get_offered_services_async(offer_type_e _offer_type, offered_services_handler_t _handler) = 0;
-
- /**
- *
- * \brief Sets a handler to be called cyclically for watchdog monitoring.
- *
- * The handler shall be called in the given interval, but not before start()
- * has been called, and not after call to stop() returned.
- *
- * In case the application is running, i.e. start() succeeded, but the
- * handler will not be invoke within the (approximate) interval it may
- * be assumed that I/O or internal dispatcher threads are non-functional.
- *
- * \remark Accuracy of call interval is limited by clock/timer granularity
- * or scheduling effects, thus it may underrun or overrun by small
- * amount.
- *
- * \note Only one handler can be active at the time, thus last handler set
- * by calling this function will be invoked.
- *
- * \note To disable calling an active handler, invoke this method again,
- * passing nullptr as _handler and/or std::chrono::seconds::zero()
- * as _interval.
- *
- * \param _handler A watchdog handler, pass nullptr to deactivate.
- * \param _interval Call interval in seconds, pass std::chrono::seconds::zero() to deactivate.
- */
- virtual void set_watchdog_handler(watchdog_handler_t _handler, std::chrono::seconds _interval) = 0;
-
- /**
- *
- * \brief Registers a subscription handler.
- *
- * A subscription handler is called whenever the subscription state of an
- * eventgroup changes. The callback is called with the client identifier
- * and a boolean that indicates whether the client subscribed or
- * unsubscribed.
- *
- * \param _service Service identifier of service instance whose
- * subscription state is to be monitored.
- * \param _instance Instance identifier of service instance whose
- * subscription state is to be monitored.
- * \param _eventgroup Eventgroup identifier of eventgroup whose
- * subscription state is to be monitored.
- * \param _handler Callback that shall be called.
- *
- */
- virtual void register_async_subscription_handler(service_t _service, instance_t _instance, eventgroup_t _eventgroup, async_subscription_handler_t _handler) = 0;
-};
-
-/** @} */
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_APPLICATION_HPP
diff --git a/interface/vsomeip/constants.hpp b/interface/vsomeip/constants.hpp
deleted file mode 100644
index d45f2c1..0000000
--- a/interface/vsomeip/constants.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2014-2017 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_CONSTANTS_HPP
-#define VSOMEIP_CONSTANTS_HPP
-
-#include <string>
-
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/enumeration_types.hpp>
-
-namespace vsomeip {
-
-const major_version_t DEFAULT_MAJOR = 0x00;
-const minor_version_t DEFAULT_MINOR = 0x00000000;
-const ttl_t DEFAULT_TTL = 0xFFFFFF; // "until next reboot"
-
-const std::string DEFAULT_MULTICAST = "224.0.0.0";
-const uint16_t DEFAULT_PORT = 30500;
-const uint16_t ILLEGAL_PORT = 0xFFFF;
-
-const uint16_t NO_TRACE_FILTER_EXPRESSION = 0x0000;
-
-const service_t ANY_SERVICE = 0xFFFF;
-const instance_t ANY_INSTANCE = 0xFFFF;
-const method_t ANY_METHOD = 0xFFFF;
-const major_version_t ANY_MAJOR = 0xFF;
-const minor_version_t ANY_MINOR = 0xFFFFFFFF;
-
-const eventgroup_t DEFAULT_EVENTGROUP = 0x0001;
-
-const client_t ILLEGAL_CLIENT = 0x0000;
-
-const byte_t MAGIC_COOKIE_CLIENT_MESSAGE = 0x00;
-const byte_t MAGIC_COOKIE_SERVICE_MESSAGE = 0x80;
-const length_t MAGIC_COOKIE_SIZE = 0x00000008;
-const request_t MAGIC_COOKIE_REQUEST = 0xDEADBEEF;
-const protocol_version_t MAGIC_COOKIE_PROTOCOL_VERSION = 0x01;
-const interface_version_t MAGIC_COOKIE_INTERFACE_VERSION = 0x01;
-const message_type_e MAGIC_COOKIE_CLIENT_MESSAGE_TYPE =
- message_type_e::MT_REQUEST_NO_RETURN;
-const message_type_e MAGIC_COOKIE_SERVICE_MESSAGE_TYPE =
- message_type_e::MT_NOTIFICATION;
-const return_code_e MAGIC_COOKIE_RETURN_CODE = return_code_e::E_OK;
-
-const byte_t CLIENT_COOKIE[] = { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
- 0xDE, 0xAD, 0xBE, 0xEF, 0x01, 0x01, 0x01, 0x00 };
-
-const byte_t SERVICE_COOKIE[] = { 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0xDE, 0xAD, 0xBE, 0xEF, 0x01, 0x01, 0x02, 0x00 };
-
-const event_t ANY_EVENT = 0xFFFF;
-const client_t ANY_CLIENT = 0xFFFF;
-
-const pending_subscription_id_t DEFAULT_SUBSCRIPTION = 0x0;
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_CONSTANTS_HPP
diff --git a/interface/vsomeip/defines.hpp b/interface/vsomeip/defines.hpp
deleted file mode 100644
index 2a6af8b..0000000
--- a/interface/vsomeip/defines.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2014-2017 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_DEFINES_HPP
-#define VSOMEIP_DEFINES_HPP
-
-#define VSOMEIP_PROTOCOL_VERSION 0x1
-
-// 0 = unlimited, if not specified otherwise via configuration file
-#define VSOMEIP_MAX_LOCAL_MESSAGE_SIZE 0
-// 0 = unlimited, if not specified otherwise via configuration file
-#define VSOMEIP_MAX_TCP_MESSAGE_SIZE 0
-#define VSOMEIP_MAX_UDP_MESSAGE_SIZE 1416
-
-#define VSOMEIP_PACKET_SIZE VSOMEIP_MAX_UDP_MESSAGE_SIZE
-
-#define VSOMEIP_SOMEIP_HEADER_SIZE 8
-#define VSOMEIP_SOMEIP_MAGIC_COOKIE_SIZE 8
-
-#define VSOMEIP_SERVICE_POS_MIN 0
-#define VSOMEIP_SERVICE_POS_MAX 1
-#define VSOMEIP_METHOD_POS_MIN 2
-#define VSOMEIP_METHOD_POS_MAX 3
-#define VSOMEIP_EVENT_POS_MIN 2
-#define VSOMEIP_EVENT_POS_MAX 3
-#define VSOMEIP_LENGTH_POS_MIN 4
-#define VSOMEIP_LENGTH_POS_MAX 7
-#define VSOMEIP_CLIENT_POS_MIN 8
-#define VSOMEIP_CLIENT_POS_MAX 9
-#define VSOMEIP_SESSION_POS_MIN 10
-#define VSOMEIP_SESSION_POS_MAX 11
-#define VSOMEIP_PROTOCOL_VERSION_POS 12
-#define VSOMEIP_INTERFACE_VERSION_POS 13
-#define VSOMEIP_MESSAGE_TYPE_POS 14
-#define VSOMEIP_RETURN_CODE_POS 15
-#define VSOMEIP_PAYLOAD_POS 16
-
-#endif // VSOMEIP_DEFINES_HPP
diff --git a/interface/vsomeip/enumeration_types.hpp b/interface/vsomeip/enumeration_types.hpp
deleted file mode 100644
index 1f83b81..0000000
--- a/interface/vsomeip/enumeration_types.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (C) 2014-2017 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_ENUMERATION_TYPES_HPP
-#define VSOMEIP_ENUMERATION_TYPES_HPP
-
-#include <cstdint>
-
-namespace vsomeip {
-
-enum class state_type_e : uint8_t {
- ST_REGISTERED = 0x0,
- ST_DEREGISTERED = 0x1
-};
-
-// SIP_RPC_684
-enum class message_type_e : uint8_t {
- MT_REQUEST = 0x00,
- MT_REQUEST_NO_RETURN = 0x01,
- MT_NOTIFICATION = 0x02,
- MT_REQUEST_ACK = 0x40,
- MT_REQUEST_NO_RETURN_ACK = 0x41,
- MT_NOTIFICATION_ACK = 0x42,
- MT_RESPONSE = 0x80,
- MT_ERROR = 0x81,
- MT_RESPONSE_ACK = 0xC0,
- MT_ERROR_ACK = 0xC1,
- MT_UNKNOWN = 0xFF
-};
-
-// SIP_RPC_371
-enum class return_code_e : uint8_t {
- E_OK = 0x00,
- E_NOT_OK = 0x01,
- E_UNKNOWN_SERVICE = 0x02,
- E_UNKNOWN_METHOD = 0x03,
- E_NOT_READY = 0x04,
- E_NOT_REACHABLE = 0x05,
- E_TIMEOUT = 0x06,
- E_WRONG_PROTOCOL_VERSION = 0x07,
- E_WRONG_INTERFACE_VERSION = 0x08,
- E_MALFORMED_MESSAGE = 0x09,
- E_WRONG_MESSAGE_TYPE = 0xA,
- E_UNKNOWN = 0xFF
-};
-
-enum class subscription_type_e : uint8_t {
- SU_RELIABLE_AND_UNRELIABLE = 0x00,
- SU_PREFER_UNRELIABLE = 0x01,
- SU_PREFER_RELIABLE = 0x02,
- SU_UNRELIABLE = 0x03,
- SU_RELIABLE = 0x04,
-};
-
-enum class routing_state_e : uint8_t {
- RS_RUNNING = 0x00,
- RS_SUSPENDED = 0x01,
- RS_RESUMED = 0x02,
- RS_SHUTDOWN = 0x03,
- RS_DIAGNOSIS = 0x04,
- RS_UNKNOWN = 0xFF
-};
-
-enum class offer_type_e : uint8_t {
- OT_LOCAL = 0x00,
- OT_REMOTE = 0x01,
- OT_ALL = 0x02,
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ENUMERATION_TYPES_HPP
diff --git a/interface/vsomeip/error.hpp b/interface/vsomeip/error.hpp
deleted file mode 100644
index 1136957..0000000
--- a/interface/vsomeip/error.hpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) 2014-2017 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_ERROR_HPP
-#define VSOMEIP_ERROR_HPP
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-enum class error_code_e : uint8_t {
- CONFIGURATION_MISSING,
- PORT_CONFIGURATION_MISSING,
- CLIENT_ENDPOINT_CREATION_FAILED,
- SERVER_ENDPOINT_CREATION_FAILED,
- SERVICE_PROPERTY_MISMATCH
-};
-
-extern const char *ERROR_INFO[];
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_ERROR_HPP
-
diff --git a/interface/vsomeip/export.hpp b/interface/vsomeip/export.hpp
deleted file mode 100644
index a8577ee..0000000
--- a/interface/vsomeip/export.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2014-2017 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 __EXPORT__HPP__
-#define __EXPORT__HPP__
-
-#if _WIN32
- #define VSOMEIP_EXPORT __declspec(dllexport)
- #define VSOMEIP_EXPORT_CLASS_EXPLICIT
-
- #if VSOMEIP_DLL_COMPILATION
- #define VSOMEIP_IMPORT_EXPORT __declspec(dllexport)
- #else
- #define VSOMEIP_IMPORT_EXPORT __declspec(dllimport)
- #endif
-
- #if VSOMEIP_DLL_COMPILATION_CONFIG
- #define VSOMEIP_IMPORT_EXPORT_CONFIG __declspec(dllexport)
- #else
- #define VSOMEIP_IMPORT_EXPORT_CONFIG __declspec(dllimport)
- #endif
-#else
- #define VSOMEIP_EXPORT
- #define VSOMEIP_IMPORT_EXPORT
- #define VSOMEIP_IMPORT_EXPORT_CONFIG
-#endif
-
-#endif
diff --git a/interface/vsomeip/function_types.hpp b/interface/vsomeip/function_types.hpp
deleted file mode 100644
index aa086dd..0000000
--- a/interface/vsomeip/function_types.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2016-2017 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_FUNCTION_TYPES_HPP
-#define VSOMEIP_FUNCTION_TYPES_HPP
-
-#include <functional>
-#include <memory>
-
-namespace vsomeip {
-
-class payload;
-
-typedef std::function<
- bool (const std::shared_ptr<payload> &,
- const std::shared_ptr<payload> &) > epsilon_change_func_t;
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_FUNCTION_TYPES_HPP
diff --git a/interface/vsomeip/handler.hpp b/interface/vsomeip/handler.hpp
deleted file mode 100644
index bcb2aa8..0000000
--- a/interface/vsomeip/handler.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2014-2017 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_HANDLER_HPP
-#define VSOMEIP_HANDLER_HPP
-
-#include <functional>
-#include <memory>
-
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-class message;
-
-typedef std::function< void (state_type_e) > state_handler_t;
-typedef std::function< void (const std::shared_ptr< message > &) > message_handler_t;
-typedef std::function< void (service_t, instance_t, bool) > availability_handler_t;
-typedef std::function< bool (client_t, bool) > subscription_handler_t;
-typedef std::function< void (const uint16_t) > error_handler_t;
-typedef std::function< void (const service_t, const instance_t, const eventgroup_t,
- const event_t, const uint16_t) > subscription_status_handler_t;
-typedef std::function< void (client_t, bool, std::function< void (const bool) > )> async_subscription_handler_t;
-
-typedef std::function< void (const std::vector<std::pair<service_t, instance_t>> &_services) > offered_services_handler_t;
-typedef std::function< void () > watchdog_handler_t;
-
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_HANDLER_HPP
diff --git a/interface/vsomeip/internal/deserializable.hpp b/interface/vsomeip/internal/deserializable.hpp
deleted file mode 100644
index 5d8ebcc..0000000
--- a/interface/vsomeip/internal/deserializable.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2014-2017 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_DESERIALIZABLE_HPP
-#define VSOMEIP_DESERIALIZABLE_HPP
-
-#include <vsomeip/export.hpp>
-
-namespace vsomeip {
-
-class deserializer;
-
-class deserializable {
-public:
- VSOMEIP_EXPORT virtual ~deserializable() {
- }
- VSOMEIP_EXPORT virtual bool deserialize(deserializer *_from) = 0;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_SERIALIZABLE_HPP
diff --git a/interface/vsomeip/internal/serializable.hpp b/interface/vsomeip/internal/serializable.hpp
deleted file mode 100644
index 0791419..0000000
--- a/interface/vsomeip/internal/serializable.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2014-2017 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_SERIALIZABLE_HPP
-#define VSOMEIP_SERIALIZABLE_HPP
-
-#include <vsomeip/export.hpp>
-
-namespace vsomeip {
-
-class serializer;
-
-/**
- * Abstract base class for element that can be serialized.
- */
-class serializable {
-public:
- VSOMEIP_EXPORT virtual ~serializable() {}
-
- /**
- * \brief serialize the content of the object
- */
- VSOMEIP_EXPORT virtual bool serialize(serializer *_to) const = 0;
-};
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_SERIALIZABLE_HPP
diff --git a/interface/vsomeip/message.hpp b/interface/vsomeip/message.hpp
deleted file mode 100644
index 4a68a54..0000000
--- a/interface/vsomeip/message.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 2014-2017 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_MESSAGE_HPP
-#define VSOMEIP_MESSAGE_HPP
-
-#include <memory>
-
-#include <vsomeip/message_base.hpp>
-
-namespace vsomeip {
-
-class payload;
-
-/**
- *
- * \defgroup vsomeip
- *
- * @{
- *
- */
-
-/**
- * \brief Implements regular SOME/IP messages.
- *
- * This class extends @ref message_base by an unstructured payload. Except
- * SOME/IP Service Discovery messages, all SOME/IP messages within vsomeip
- * are represented by message objects.
- */
-
-class message: virtual public message_base {
-public:
- virtual ~message() {}
-
- /**
- * \brief Returns a pointer to the message payload.
- */
- virtual std::shared_ptr<payload> get_payload() const = 0;
-
- /**
- * \brief Set the message payload.
- */
- virtual void set_payload(std::shared_ptr<payload> _payload) = 0;
-};
-
-/** @} */
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_MESSAGE_HPP
diff --git a/interface/vsomeip/message_base.hpp b/interface/vsomeip/message_base.hpp
deleted file mode 100644
index 60c80e6..0000000
--- a/interface/vsomeip/message_base.hpp
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright (C) 2014-2017 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_MESSAGE_BASE_HPP
-#define VSOMEIP_MESSAGE_BASE_HPP
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/primitive_types.hpp>
-#include <vsomeip/enumeration_types.hpp>
-
-#include <vsomeip/internal/deserializable.hpp>
-#include <vsomeip/internal/serializable.hpp>
-
-namespace vsomeip {
-
-/**
- *
- * \defgroup vsomeip
- *
- * @{
- *
- */
-
-/**
- * \brief Base class to implement SOME/IP messages.
- *
- * This class implements the SOME/IP message header and connects to the
- * serialzing/deserializing functionalities. The class is inherited by
- * the message classes within ::vsomeip and vsomeip::sd that add the
- * payload representations for regular and Service Discovery messages.
- */
-class message_base
- : public serializable,
- public deserializable {
-public:
- VSOMEIP_EXPORT virtual ~message_base() {};
-
- /**
- * \brief Returns the message identifier.
- *
- * The method returns the message identifier that consists of
- * service identifier and method identifier.
- */
- VSOMEIP_EXPORT virtual message_t get_message() const = 0;
- /**
- * \brief Set the message identifier.
- *
- * The methods sets service identifier and method identifier in
- * a single call.
- *
- * \param _message The new message identifier.
- */
- VSOMEIP_EXPORT virtual void set_message(message_t _message) = 0;
-
- /**
- * \brief Returns the service identifier from the message header.
- */
- VSOMEIP_EXPORT virtual service_t get_service() const = 0;
-
- /**
- * \brief Set the service identifier in the message header.
- */
- VSOMEIP_EXPORT virtual void set_service(service_t _service) = 0;
-
- /**
- * \brief Returns the instance identifier.
- *
- * The instance identifier is _not_ part of the SOME/IP header. It is
- * either derived from the incoming message (local) or from the port
- * that was used to send a message (external).
- */
- VSOMEIP_EXPORT virtual instance_t get_instance() const = 0;
-
- /**
- * \brief Set the instance identifier in the message header.
- *
- * To address the correct service instance, vsomeip uses the instance
- * identifier. For external services it is mapped to a IP address and port
- * combination before the message is sent. For internal messages is
- * transferred as additional data appended to the SOME/IP messages.
- * Therefore, before sending a message, a user application must set the
- * instance identifier.
- */
- VSOMEIP_EXPORT virtual void set_instance(instance_t _instance) = 0;
-
- /**
- * \brief Get the method/event identifier from the message header.
- */
- VSOMEIP_EXPORT virtual method_t get_method() const = 0;
-
- /**
- * \brief Set the method/event identifier in the message header.
- */
- VSOMEIP_EXPORT virtual void set_method(method_t _method) = 0;
-
- /**
- * \brief Get the payload length from the message header.
- */
- VSOMEIP_EXPORT virtual length_t get_length() const = 0;
-
- /**
- * \brief Get the request identifier from the message header.
- *
- * The request identifier consists of the client identifier and the
- * session identifier. As it does really make sense to set it as
- * a whole, setting is not supported.
- */
- VSOMEIP_EXPORT virtual request_t get_request() const = 0;
-
- /**
- * \brief Set the client identifier in the message header.
- */
- VSOMEIP_EXPORT virtual client_t get_client() const = 0;
-
- /**
- * \brief Set the client identifier in the message header.
- *
- * For requests this is automatically done by @ref application::send.
- * For notications this is not needed.
- */
- VSOMEIP_EXPORT virtual void set_client(client_t _client) = 0;
-
- /**
- * \brief Get the session identifier from the message header.
- */
- VSOMEIP_EXPORT virtual session_t get_session() const = 0;
-
- /**
- * \brief Set the session identifier in the message header.
- *
- * For requests this is automatically done by @ref application::send
- * For notifications it is not needed to set the session identifier.
- */
- VSOMEIP_EXPORT virtual void set_session(session_t _session) = 0;
-
- /**
- * \brief Get the protocol version from the message header.
- *
- * As the protocol version is a fixed value for a vsomeip implementation,
- * it cannot be set.
- */
- VSOMEIP_EXPORT virtual protocol_version_t get_protocol_version() const = 0;
-
- /**
- * \brief Get the interface version from the message header.
- */
- VSOMEIP_EXPORT virtual interface_version_t get_interface_version() const = 0;
-
- /**
- * \brief Set the interface version in the message header.
- */
- VSOMEIP_EXPORT virtual void set_interface_version(interface_version_t _version) = 0;
-
- /**
- * \brief Get the message type from the message header.
- */
- VSOMEIP_EXPORT virtual message_type_e get_message_type() const = 0;
-
- /**
- * \brief Set the message type in the message header.
- */
- VSOMEIP_EXPORT virtual void set_message_type(message_type_e _type) = 0;
-
- /**
- * \brief Get the return code from the message header.
- */
- VSOMEIP_EXPORT virtual return_code_e get_return_code() const = 0;
-
- /**
- * \brief Set the return code in the message header.
- */
- VSOMEIP_EXPORT virtual void set_return_code(return_code_e _code) = 0;
-
- /**
- * \brief Return the transport mode that was/will be used to send the message.
- */
- VSOMEIP_EXPORT virtual bool is_reliable() const = 0;
-
- /**
- * \brief Set the transport mode that will be used to send the message.
- */
- VSOMEIP_EXPORT virtual void set_reliable(bool _is_reliable) = 0;
-
- /**
- * \brief Return whether or not the message is an initial event.
- */
- VSOMEIP_EXPORT virtual bool is_initial() const = 0;
-
- /**
- * \brief Set whether or not the message is an initial event.
- */
- VSOMEIP_EXPORT virtual void set_initial(bool _is_initial) = 0;
-
- /**
- * \brief Return whether or not the CRC value received is valid.
- */
- VSOMEIP_EXPORT virtual bool is_valid_crc() const = 0;
-
- /**
- * \brief Set whether or not the CRC value received is valid.
- */
- VSOMEIP_EXPORT virtual void set_is_valid_crc(bool _is_valid_crc) = 0;
-
-};
-
-/** @} */
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_MESSAGE_BASE_HPP
diff --git a/interface/vsomeip/payload.hpp b/interface/vsomeip/payload.hpp
deleted file mode 100644
index b9b8f61..0000000
--- a/interface/vsomeip/payload.hpp
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (C) 2014-2017 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_PAYLOAD_HPP
-#define VSOMEIP_PAYLOAD_HPP
-
-#include <vector>
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/primitive_types.hpp>
-
-#include <vsomeip/internal/deserializable.hpp>
-#include <vsomeip/internal/serializable.hpp>
-
-namespace vsomeip {
-
-/**
- *
- * \defgroup vsomeip
- *
- * @{
- *
- */
-
-/**
- *
- * \brief This class implements an array of bytes to be used as
- * payload for SOME/IP messages.
- *
-*/
-class payload: public serializable, public deserializable {
-public:
- VSOMEIP_EXPORT virtual ~payload() {}
-
- /**
- * \brief Returns true if the given payload is equal to this one.
- *
- * \param _other Payload that shall be compared to this payload.
- */
- VSOMEIP_EXPORT virtual bool operator ==(const payload &_other) = 0;
-
- /**
- * \brief Returns pointer to the payload content
- */
- VSOMEIP_EXPORT virtual byte_t * get_data() = 0;
-
- /**
- * \brief Returns constant pointer to the payload content
- */
- VSOMEIP_EXPORT virtual const byte_t * get_data() const = 0;
-
- /**
- * \brief Copies the given data array to the payload object.
- *
- * The current payload content is replaced by the data provided.
- * The given buffer remains untouched.
- *
- * \param _data Pointer to a data buffer.
- * \param _length Length of the data buffer.
- */
- VSOMEIP_EXPORT virtual void set_data(const byte_t *_data,
- length_t _length) = 0;
-
- /**
- * \brief Copies the given data array to the payload object.
- *
- * The current payload content is replaced by the data provided.
- * The given buffer remains untouched.
- *
- * \param _data Vector containing the data
- */
- VSOMEIP_EXPORT virtual void set_data(
- const std::vector<byte_t> &_data) = 0;
-
- /**
- * \brief Returns the length of the payload content.
- */
- VSOMEIP_EXPORT virtual length_t get_length() const = 0;
-
- /**
- * \brief Set the maximum length of the payload content.
- *
- * This function must be called before directly copying data using the
- * pointer to the internal buffer.
- */
- VSOMEIP_EXPORT virtual void set_capacity(length_t _length) = 0;
-
- /**
- * \brief Moves the given data array to the payload object.
- *
- * The current payload content is replaced by the data provided.
- * The given buffer is owned by the payload object afterwards.
- *
- * \param _data Vector containing the data
- */
- VSOMEIP_EXPORT virtual void set_data(
- std::vector<byte_t> &&_data) = 0;
-};
-
-/** @} */
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_PAYLOAD_HPP
diff --git a/interface/vsomeip/plugin.hpp b/interface/vsomeip/plugin.hpp
deleted file mode 100644
index 4d608f1..0000000
--- a/interface/vsomeip/plugin.hpp
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (C) 2016-2017 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_PLUGIN_HPP
-#define VSOMEIP_PLUGIN_HPP
-
-#include <memory>
-
-#if WIN32
- #if VSOMEIP_DLL_COMPILATION_PLUGIN
- #define VSOMEIP_IMPORT_EXPORT_PLUGIN __declspec(dllexport)
- #else
- #define VSOMEIP_IMPORT_EXPORT_PLUGIN __declspec(dllimport)
- #endif
-#else
- #define VSOMEIP_IMPORT_EXPORT_PLUGIN
-#endif
-
-#define VSOMEIP_PLUGIN_INIT_SYMBOL "vsomeip_plugin_init"
-
-namespace vsomeip {
-
-enum class plugin_type_e : uint8_t {
- APPLICATION_PLUGIN,
- PRE_CONFIGURATION_PLUGIN,
- CONFIGURATION_PLUGIN,
- SD_RUNTIME_PLUGIN
-};
-
-class plugin;
-typedef std::shared_ptr<plugin> (*create_plugin_func)();
-typedef create_plugin_func (*plugin_init_func)();
-
-/**
- * Base class for all plug-ins
- */
-class VSOMEIP_IMPORT_EXPORT_PLUGIN plugin {
-public:
- virtual ~plugin() {}
-
- virtual uint32_t get_plugin_version() const = 0;
- virtual const std::string &get_plugin_name() const = 0;
- virtual plugin_type_e get_plugin_type() const = 0;
-};
-
-template<class Plugin_>
-class plugin_impl : public plugin {
-public:
- static std::shared_ptr<plugin> get_plugin() {
- return std::make_shared<Plugin_>();
- }
-
- plugin_impl(const std::string &_name, uint32_t _version,
- plugin_type_e _type) {
- name_ = _name;
- version_ = _version;
- type_ = _type;
- }
-
- const std::string &get_plugin_name() const {
- return name_;
- }
-
- uint32_t get_plugin_version() const {
- return version_;
- }
-
- plugin_type_e get_plugin_type() const {
- return type_;
- }
-
-private:
- uint32_t version_;
- std::string name_;
- plugin_type_e type_;
-};
-
-#define VSOMEIP_PLUGIN(class_name) \
- extern "C" { \
- VSOMEIP_EXPORT vsomeip::create_plugin_func vsomeip_plugin_init() { \
- return class_name::get_plugin; \
- } \
- }
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_PLUGIN_HPP
diff --git a/interface/vsomeip/plugins/application_plugin.hpp b/interface/vsomeip/plugins/application_plugin.hpp
deleted file mode 100644
index 3d5cce1..0000000
--- a/interface/vsomeip/plugins/application_plugin.hpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (C) 2016-2017 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_APPLICATION_PLUGIN_HPP
-#define VSOMEIP_APPLICATION_PLUGIN_HPP
-
-#include <string>
-#include <memory>
-
-#include <vsomeip/export.hpp>
-
-// Version should be incremented on breaking API change
-#define VSOMEIP_APPLICATION_PLUGIN_VERSION 1
-
-namespace vsomeip {
-
-enum class application_plugin_state_e : uint8_t {
- STATE_INITIALIZED,
- STATE_STARTED,
- STATE_STOPPED
-};
-
-/**
- * The application plug-in can be used to extend application behavior
- * via an module/plug-in.
- */
-class application_plugin {
-public:
- virtual ~application_plugin() {}
-
- // Called by vSomeIP to inform an application plug-in about its actual state
- // Call should not be blocked from plug-in as there is no threading.
- // The caller thread of "application::init/::start/::stop" will inform the plug-in.
- virtual void on_application_state_change(const std::string _application_name,
- const application_plugin_state_e _app_state) = 0;
-};
-
-}
-
-#endif // VSOMEIP_APPLICATION_PLUGIN_HPP
diff --git a/interface/vsomeip/plugins/pre_configuration_plugin.hpp b/interface/vsomeip/plugins/pre_configuration_plugin.hpp
deleted file mode 100644
index 6155796..0000000
--- a/interface/vsomeip/plugins/pre_configuration_plugin.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2016-2017 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_PRE_CONFIGURATION_PLUGIN_HPP
-#define VSOMEIP_PRE_CONFIGURATION_PLUGIN_HPP
-
-#include <vsomeip/export.hpp>
-
-// Version should be incremented on breaking API change
-#define VSOMEIP_PRE_CONFIGURATION_PLUGIN_VERSION 1
-
-namespace vsomeip {
-/**
- * The pre configuration plug-in can be used to extend configuration load behavior
- * via an module/plug-in.
- */
-class pre_configuration_plugin {
-public:
- virtual ~pre_configuration_plugin() {}
-
- // Plug-In should return a valid path to a vSomeIP configuration.
- // vSomeIP will use this path for config loading if such a plug-in is availablel.
- virtual std::string get_configuration_path() = 0;
-};
-}
-
-#endif // VSOMEIP_PRE_CONFIGURATION_PLUGIN_HPP
diff --git a/interface/vsomeip/primitive_types.hpp b/interface/vsomeip/primitive_types.hpp
deleted file mode 100644
index 9f6c84a..0000000
--- a/interface/vsomeip/primitive_types.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2014-2017 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_PRIMITIVE_TYPES_HPP
-#define VSOMEIP_PRIMITIVE_TYPES_HPP
-
-#include <array>
-#include <cstdint>
-
-namespace vsomeip {
-
-typedef uint32_t message_t;
-typedef uint16_t service_t;
-typedef uint16_t method_t;
-typedef uint16_t event_t;
-
-typedef uint16_t instance_t;
-typedef uint16_t eventgroup_t;
-
-typedef uint8_t major_version_t;
-typedef uint32_t minor_version_t;
-
-typedef uint32_t ttl_t;
-
-typedef uint32_t request_t;
-typedef uint16_t client_t;
-typedef uint16_t session_t;
-
-typedef uint32_t length_t;
-
-typedef uint8_t protocol_version_t;
-typedef uint8_t interface_version_t;
-
-typedef uint8_t byte_t;
-
-// Addresses
-typedef std::array<byte_t, 4> ipv4_address_t;
-typedef std::array<byte_t, 16> ipv6_address_t;
-
-typedef std::string trace_channel_t;
-
-typedef std::string trace_filter_type_t;
-
-typedef std::uint16_t pending_subscription_id_t;
-} // namespace vsomeip
-
-#endif // VSOMEIP_PRIMITIVE_TYPES_HPP
diff --git a/interface/vsomeip/runtime.hpp b/interface/vsomeip/runtime.hpp
deleted file mode 100644
index ae54e19..0000000
--- a/interface/vsomeip/runtime.hpp
+++ /dev/null
@@ -1,216 +0,0 @@
-// Copyright (C) 2014-2017 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_RUNTIME_HPP
-#define VSOMEIP_RUNTIME_HPP
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <vsomeip/export.hpp>
-#include <vsomeip/primitive_types.hpp>
-
-namespace vsomeip {
-
-class application;
-class message;
-class payload;
-
-/**
- *
- * \defgroup vsomeip
- *
- * The vsomeip module contains all elements a user applications needs to:
- *
- * - offer SOME/IP service instances
- * - request SOME/IP service instances
- * - offer SOME/IP eventgroups
- * - subscribe to SOME/IP eventgroups
- * - send and receive SOME/IP messages (request/response)
- * - implement SOME/IP events and fields
- *
- * @{
- *
- */
-
-/**
- *
- * \brief Singleton class containing all public resource management
- * facilities of vsomeip.
- *
- * The methods of this class shall be used to create instances of all the
- * classes needed to facilitate SOME/IP communication. In particular, it is
- * the entry point to create instances of the @ref application class that
- * contains the main public API of vsomeip.
- *
- */
-class VSOMEIP_IMPORT_EXPORT runtime {
-public:
-
- static std::string get_property(const std::string &_name);
- static void set_property(const std::string &_name, const std::string &_value);
-
- static std::shared_ptr<runtime> get();
-
- virtual ~runtime() {
- }
-
- /**
- *
- * \brief Creates a vsomeip application object.
- *
- * An application object manages service offers and requests as well as
- * event subscriptions. It allows to register user application functions
- * as callbacks that are called on specific events during runtime, e.g
- * to react on incoming SOME/IP messages.
- * An application object is identified by a unique name that is also used
- * in (and therefore has to match) the configuration files of vsomeip. If
- * the name is left empty, the application name is taken from the
- * environment variable "VSOMEIP_APPLICATION_NAME"
- *
- * \param _name Name of the application on the system.
- *
- */
- virtual std::shared_ptr<application> create_application(
- const std::string &_name = "") = 0;
-
- /**
- *
- * \brief Constructs an empty message object.
- *
- * The message can then be used to call @application::send to send a
- * SOME/IP message. The user application is responsible for setting
- * the message type, the service instance and the message payload
- * after this call and before calling @application::send.
- *
- * \param _reliable Determines whether this message shall be sent
- * over a reliable connection (TCP) or not (UDP).
- *
- */
- virtual std::shared_ptr<message> create_message(
- bool _reliable = false) const = 0;
- /**
- *
- * \brief Constructs an empty request message.
- *
- * The message can then be used to call @ref application::send to send a
- * SOME/IP message. The message type is set to REQUEST after the
- * call and the request identifier is automatically set during the
- * @ref application::send call.
- *
- * The user application is responsible for setting the service instance
- * and the payload.
- *
- * \param _reliable Determines whether this message shall be sent
- * over a reliable connection (TCP) or not (UDP).
- *
- */
- virtual std::shared_ptr<message> create_request(
- bool _reliable = false) const = 0;
-
- /*
- * \brief Constructs an empty response message from a given request
- * message.
- *
- * The message can then be used to call @ref application::send to send a
- * SOME/IP message. The message type is set to RESPONSE after the
- * call and the request identifier is automatically set from the
- * request message.
- *
- * The user application is responsible for setting the service instance
- * and the payload.
- *
- * \param _request The request message that shall be answered by
- * the response message.
- *
- */
- virtual std::shared_ptr<message> create_response(
- const std::shared_ptr<message> &_request) const = 0;
-
- /**
- *
- * \brief Creates an empty notification message.
- *
- * The message can then be used to call @ref application::send to send a
- * SOME/IP message. The message type is set to NOTIFICATION after the
- * call.
- *
- * The user application is responsible for setting the service instance
- * and the payload.
- *
- * \param _reliable Determines whether this message shall be sent
- * over a reliable connection (TCP) or not (UDP).
- *
- * Note: Creating notification messages and sending them using
- * @ref application::send is possible but not the standard way of sending
- * notification with vsomeip. The standard way is calling
- * @ref application::offer_event and setting the value using the
- * @ref application::notify / @ref application::notify_one methods.
- *
- */
- virtual std::shared_ptr<message> create_notification(
- bool _reliable = false) const = 0;
-
- /**
- *
- * \brief Creates an empty payload object.
- *
- */
- virtual std::shared_ptr<payload> create_payload() const = 0;
-
- /**
- *
- * \brief Creates a payload object filled with the given data.
- *
- * \param _data Bytes to be copied into the payload object.
- * \param _size Number of bytes to be copied into the payload object.
- *
- */
- virtual std::shared_ptr<payload> create_payload(
- const byte_t *_data, uint32_t _size) const = 0;
-
- /**
- *
- * \brief Creates a payload object filled with the given data.
- *
- * \param _data Bytes to be copied into the payload object.
- *
- */
- virtual std::shared_ptr<payload> create_payload(
- const std::vector<byte_t> &_data) const = 0;
-
- /**
- *
- * \brief Retrieves the application object for the application with the
- * given name.
- *
- * If no such application is found, an empty shared_ptr is returned
- * (nullptr).
- *
- * \param _name Name of the application to be found.
- *
- */
- virtual std::shared_ptr<application> get_application(
- const std::string &_name) const = 0;
-
- /**
- *
- * \brief Removes the application object for the application with the
- * given name.
- *
- * If no such application is found, this is a null operation.
- *
- * \param _name Name of the application to be removed.
- *
- */
- virtual void remove_application( const std::string &_name) = 0;
-};
-
-/** @} */
-
-} // namespace vsomeip
-
-#endif // VSOMEIP_RUNTIME_HPP
diff --git a/interface/vsomeip/vsomeip.hpp b/interface/vsomeip/vsomeip.hpp
deleted file mode 100644
index 90940b2..0000000
--- a/interface/vsomeip/vsomeip.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (C) 2014-2017 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_VSOMEIP_HPP
-#define VSOMEIP_VSOMEIP_HPP
-
-/**
- * \brief The central vsomeip header. Include this to use vsomeip.
- */
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/defines.hpp>
-#include <vsomeip/application.hpp>
-#include <vsomeip/message.hpp>
-#include <vsomeip/payload.hpp>
-#include <vsomeip/runtime.hpp>
-
-#endif // VSOMEIP_VSOMEIP_HPP
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
deleted file mode 100644
index fd70df6..0000000
--- a/test/CMakeLists.txt
+++ /dev/null
@@ -1,2832 +0,0 @@
-# Copyright (C) 2015-2017 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 2.8.1)
-
-# Add the gtest header files to the include files
-include_directories(
- .
- ${gtest_SOURCE_DIR}/include
-)
-
-set(TEST_LINK_LIBRARIES gtest)
-
-# Function to copy files into the build directory (or anywhere else)
-# On unixoid systems this function will create symlinks instead
-# SOURCE_PATH: Path to the file which should be copied
-# DESTINATION_PATH: destination file
-# TARGET_TO_DEPEND: The copying of the file will be added as
-# a dependency to this target
-function(copy_to_builddir SOURCE_PATH DESTINATION_PATH TARGET_TO_DEPEND)
- if(${CMAKE_SYSTEM_NAME} MATCHES "Windows" OR NOT ${TEST_SYMLINK_CONFIG_FILES})
- ADD_CUSTOM_COMMAND(
- OUTPUT "${DESTINATION_PATH}"
- COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_PATH}" "${DESTINATION_PATH}"
- DEPENDS "${SOURCE_PATH}"
- COMMENT "Copying \"${SOURCE_PATH}\" into build directory"
- )
- else()
- if(${TEST_SYMLINK_CONFIG_FILES_RELATIVE})
- ADD_CUSTOM_COMMAND(
- OUTPUT "${DESTINATION_PATH}"
- # Create a relative link
- COMMAND ln -s -r "${SOURCE_PATH}" "${DESTINATION_PATH}"
- DEPENDS "${SOURCE_PATH}"
- COMMENT "Symlinking \"${SOURCE_PATH}\" into build directory"
- )
- else()
- ADD_CUSTOM_COMMAND(
- OUTPUT "${DESTINATION_PATH}"
- # Create an absolute link
- COMMAND ${CMAKE_COMMAND} -E create_symlink "${SOURCE_PATH}" "${DESTINATION_PATH}"
- DEPENDS "${SOURCE_PATH}"
- COMMENT "Symlinking \"${SOURCE_PATH}\" into build directory"
- )
- endif()
- endif()
- # Add a random number to the end of the string to avoid problems with
- # duplicate filenames
- set(FILENAME "")
- get_filename_component(FILENAME ${SOURCE_PATH} NAME )
- string(RANDOM LENGTH 4 ALPHABET 0123456789 RANDOMNUMBER)
- if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
- ADD_CUSTOM_TARGET(copy_${FILENAME}_${RANDOMNUMBER}
- DEPENDS "${DESTINATION_PATH}"
- )
- ADD_DEPENDENCIES(${TARGET_TO_DEPEND} copy_${FILENAME}_${RANDOMNUMBER})
- else()
- ADD_CUSTOM_TARGET(symlink_${FILENAME}_${RANDOMNUMBER}
- DEPENDS "${DESTINATION_PATH}"
- )
- ADD_DEPENDENCIES(${TARGET_TO_DEPEND} symlink_${FILENAME}_${RANDOMNUMBER})
- endif()
-endfunction()
-
-##############################################################################
-# configuration-test
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_CONFIGURATION configuration-test)
-
- add_executable(${TEST_CONFIGURATION} configuration_tests/configuration-test.cpp)
- target_link_libraries(${TEST_CONFIGURATION}
- vsomeip
- vsomeip-cfg
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # The following will make sure that ${TEST_CONFIGURATION_CONFIG_FILE} is copied
- # from the config folder into the test folder in the builddirectory
- # This makes it possible to call the configuration test within the build directory
- set(TEST_CONFIGURATION_CONFIG_FILE configuration-test.json)
- set(TEST_CONFIGURATION_DEPRECATED_CONFIG_FILE configuration-test-deprecated.json)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/configuration_tests/${TEST_CONFIGURATION_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CONFIGURATION_CONFIG_FILE}
- ${TEST_CONFIGURATION}
- )
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/configuration_tests/${TEST_CONFIGURATION_DEPRECATED_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CONFIGURATION_DEPRECATED_CONFIG_FILE}
- ${TEST_CONFIGURATION}
- )
-endif()
-##############################################################################
-# application test
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_APPLICATION application_test)
-
- add_executable(${TEST_APPLICATION} application_tests/${TEST_APPLICATION}.cpp)
- target_link_libraries(${TEST_APPLICATION}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_APPLICATION_SINGLE_PROCESS_NAME ${TEST_APPLICATION}_single_process)
- add_executable(${TEST_APPLICATION_SINGLE_PROCESS_NAME} application_tests/${TEST_APPLICATION_SINGLE_PROCESS_NAME}.cpp)
- target_link_libraries(${TEST_APPLICATION_SINGLE_PROCESS_NAME}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_APPLICATION_AVAILABILITY_NAME ${TEST_APPLICATION}_availability)
- add_executable(${TEST_APPLICATION_AVAILABILITY_NAME} application_tests/${TEST_APPLICATION_AVAILABILITY_NAME}.cpp)
- target_link_libraries(${TEST_APPLICATION_AVAILABILITY_NAME}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_APPLICATION_SINGLE_PROCESS_CONFIGURATION_FILE ${TEST_APPLICATION}_single_process.json)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_SINGLE_PROCESS_CONFIGURATION_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_SINGLE_PROCESS_CONFIGURATION_FILE}
- ${TEST_APPLICATION}_single_process
- )
-
- set(TEST_APPLICATION_CONFIGURATION_FILE ${TEST_APPLICATION}.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_CONFIGURATION_FILE}
- ${TEST_APPLICATION}
- )
-
- set(TEST_APPLICATION_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_daemon.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}.in
- ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}
- ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_CONFIGURATION_FILE_DAEMON}
- ${TEST_APPLICATION}
- )
-
- set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE ${TEST_APPLICATION}_no_dispatch_threads.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE}
- ${TEST_APPLICATION}
- )
-
- set(TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON ${TEST_APPLICATION}_no_dispatch_threads_daemon.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/application_tests/conf/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}.in
- ${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}
- ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_NO_DISPATCH_CONFIGURATION_FILE_DAEMON}
- ${TEST_APPLICATION}
- )
-
- set(TEST_APPLICATION_STARTER ${TEST_APPLICATION}_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_STARTER}
- ${TEST_APPLICATION}
- )
-
- set(TEST_APPLICATION_SINGLE_PROCESS_STARTER ${TEST_APPLICATION}_single_process_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_SINGLE_PROCESS_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_SINGLE_PROCESS_STARTER}
- ${TEST_APPLICATION}_single_process
- )
-
- set(TEST_APPLICATION_AVAILABILITY_STARTER ${TEST_APPLICATION_AVAILABILITY_NAME}_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/application_tests/${TEST_APPLICATION_AVAILABILITY_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_AVAILABILITY_STARTER}
- ${TEST_APPLICATION_SINGLE_PROCESS_NAME}
- )
-endif()
-##############################################################################
-# magic-cookies-test-client
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_MAGIC_COOKIES_NAME magic_cookies_test)
-
- set(TEST_MAGIC_COOKIES_CLIENT ${TEST_MAGIC_COOKIES_NAME}_client)
- add_executable(${TEST_MAGIC_COOKIES_CLIENT} magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT}.cpp)
- target_link_libraries(${TEST_MAGIC_COOKIES_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${CMAKE_THREAD_LIBS_INIT}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_MAGIC_COOKIES_SERVICE ${TEST_MAGIC_COOKIES_NAME}_service)
- add_executable(${TEST_MAGIC_COOKIES_SERVICE} magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE}.cpp)
- target_link_libraries(${TEST_MAGIC_COOKIES_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${CMAKE_THREAD_LIBS_INIT}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for client into $BUILDDIR/test
- set(TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE ${TEST_MAGIC_COOKIES_CLIENT}.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/conf/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_CLIENT_CONFIG_FILE}
- ${TEST_MAGIC_COOKIES_CLIENT}
- )
-
- # Copy bashscript to start client into $BUILDDIR/test
- set(TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT ${TEST_MAGIC_COOKIES_CLIENT}_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_CLIENT_START_SCRIPT}
- ${TEST_MAGIC_COOKIES_CLIENT}
- )
-
- set(TEST_MAGIC_COOKIES_SERVICE magic_cookies_test_service)
- # Copy config file for service into $BUILDDIR/test
- set(TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE ${TEST_MAGIC_COOKIES_SERVICE}.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/conf/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_SERVICE_CONFIG_FILE}
- ${TEST_MAGIC_COOKIES_SERVICE}
- )
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT ${TEST_MAGIC_COOKIES_SERVICE}_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_SERVICE_START_SCRIPT}
- ${TEST_MAGIC_COOKIES_CLIENT}
- )
-
- # Copy bashscript to start client and server $BUILDDIR/test
- set(TEST_MAGIC_COOKIES_STARTER ${TEST_MAGIC_COOKIES_NAME}_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/magic_cookies_tests/${TEST_MAGIC_COOKIES_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_STARTER}
- ${TEST_MAGIC_COOKIES_CLIENT}
- )
-endif()
-##############################################################################
-# someip-header-factory-test
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_HEADER_FACTORY_NAME header_factory_test)
-
- set(TEST_HEADER_FACTORY header_factory_test)
- add_executable(${TEST_HEADER_FACTORY} header_factory_tests/header_factory_test.cpp)
- target_link_libraries(${TEST_HEADER_FACTORY}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${CMAKE_THREAD_LIBS_INIT}
- ${TEST_LINK_LIBRARIES}
- )
-
- ##############################################################################
- # Now comes the second part of the header factory test which consists of ouf
- # a client and a service both with settings file and bash scripts to start them
- set(TEST_HEADER_FACTORY_CLIENT header_factory_test_client)
- add_executable(${TEST_HEADER_FACTORY_CLIENT} header_factory_tests/${TEST_HEADER_FACTORY_CLIENT}.cpp)
- target_link_libraries(${TEST_HEADER_FACTORY_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${CMAKE_THREAD_LIBS_INIT}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for client into $BUILDDIR/test
- set(TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE ${TEST_HEADER_FACTORY_CLIENT}.json)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_CLIENT_CONFIG_FILE}
- ${TEST_HEADER_FACTORY_CLIENT}
- )
-
- # Copy bashscript to start client into $BUILDDIR/test
- set(TEST_HEADER_FACTORY_CLIENT_START_SCRIPT ${TEST_HEADER_FACTORY_CLIENT}_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_CLIENT_START_SCRIPT}
- ${TEST_HEADER_FACTORY_CLIENT}
- )
-
- set(TEST_HEADER_FACTORY_SERVICE header_factory_test_service)
- add_executable(${TEST_HEADER_FACTORY_SERVICE} header_factory_tests/${TEST_HEADER_FACTORY_SERVICE}.cpp)
- target_link_libraries(${TEST_HEADER_FACTORY_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${CMAKE_THREAD_LIBS_INIT}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for service into $BUILDDIR/test
- set(TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE ${TEST_HEADER_FACTORY_SERVICE}.json)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_SERVICE_CONFIG_FILE}
- ${TEST_HEADER_FACTORY_SERVICE}
- )
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_HEADER_FACTORY_SERVICE_START_SCRIPT ${TEST_HEADER_FACTORY_SERVICE}_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_SERVICE_START_SCRIPT}
- ${TEST_HEADER_FACTORY_SERVICE}
- )
-
- # Copy bashscript to start client and server $BUILDDIR/test
- set(TEST_HEADER_FACTORY_STARTER header_factory_test_send_receive_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/header_factory_tests/${TEST_HEADER_FACTORY_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_STARTER}
- ${TEST_HEADER_FACTORY_CLIENT}
- )
-endif()
-##############################################################################
-# routing-test
-##############################################################################
-
-if(NOT ${TESTS_BAT})
- set(TEST_LOCAL_ROUTING_NAME local_routing_test)
-
- set(TEST_LOCAL_ROUTING_SERVICE local_routing_test_service)
- add_executable(${TEST_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_LOCAL_ROUTING_SERVICE}.cpp)
- target_link_libraries(${TEST_LOCAL_ROUTING_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for service into $BUILDDIR/test
- set(TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_LOCAL_ROUTING_SERVICE}.json)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- ${TEST_LOCAL_ROUTING_SERVICE}
- )
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_LOCAL_ROUTING_SERVICE}_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT}
- ${TEST_LOCAL_ROUTING_SERVICE}
- )
-
- set(TEST_LOCAL_ROUTING_CLIENT local_routing_test_client)
- add_executable(${TEST_LOCAL_ROUTING_CLIENT} routing_tests/${TEST_LOCAL_ROUTING_CLIENT}.cpp)
- target_link_libraries(${TEST_LOCAL_ROUTING_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for client into $BUILDDIR/test
- set(TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_LOCAL_ROUTING_CLIENT}.json)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- ${TEST_LOCAL_ROUTING_CLIENT}
- )
-
- # Copy bashscript to start client into $BUILDDIR/test
- set(TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_LOCAL_ROUTING_CLIENT}_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT}
- ${TEST_LOCAL_ROUTING_CLIENT}
- )
-
- # Copy bashscript to start client and server $BUILDDIR/test
- set(TEST_LOCAL_ROUTING_STARTER local_routing_test_starter.sh)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_LOCAL_ROUTING_STARTER}.in
- ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER}
- ${TEST_LOCAL_ROUTING_CLIENT}
- )
-
- ##############################################################################
- set(TEST_EXTERNAL_LOCAL_ROUTING_NAME external_local_routing_test)
- set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE external_local_routing_test_service)
- add_executable(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}.cpp)
- target_link_libraries(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for service into $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
- )
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}_start.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE_START_SCRIPT}
- ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
- )
-
- # Copy bashscript to start external client into $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT external_local_routing_test_client_external)
- set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT}_start.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_START_SCRIPT}
- ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
- )
-
- # Copy config file for client into $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT}.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
- )
-
- # Copy bashscript to start client and server $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_ROUTING_STARTER external_local_routing_test_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER}
- ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE}
- )
-else()
- set(TEST_LOCAL_ROUTING_NAME local_routing_test)
-
- set(TEST_LOCAL_ROUTING_SERVICE local_routing_test_service)
- add_executable(${TEST_LOCAL_ROUTING_SERVICE} routing_tests/${TEST_LOCAL_ROUTING_SERVICE}.cpp)
- target_link_libraries(${TEST_LOCAL_ROUTING_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for service into $BUILDDIR/test
- set(TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE ${TEST_LOCAL_ROUTING_SERVICE}.json)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_CONFIG_FILE}
- ${TEST_LOCAL_ROUTING_SERVICE}
- )
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT ${TEST_LOCAL_ROUTING_SERVICE}_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_SERVICE_START_SCRIPT}
- ${TEST_LOCAL_ROUTING_SERVICE}
- )
-
- set(TEST_LOCAL_ROUTING_CLIENT local_routing_test_client)
- add_executable(${TEST_LOCAL_ROUTING_CLIENT} routing_tests/${TEST_LOCAL_ROUTING_CLIENT}.cpp)
- target_link_libraries(${TEST_LOCAL_ROUTING_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for client into $BUILDDIR/test
- set(TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE ${TEST_LOCAL_ROUTING_CLIENT}.json)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_CONFIG_FILE}
- ${TEST_LOCAL_ROUTING_CLIENT}
- )
-
- # Copy bashscript to start client into $BUILDDIR/test
- set(TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT ${TEST_LOCAL_ROUTING_CLIENT}_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_CLIENT_START_SCRIPT}
- ${TEST_LOCAL_ROUTING_CLIENT}
- )
-
- # Copy bashscript to start client and server $BUILDDIR/test
- set(TEST_LOCAL_ROUTING_STARTER local_routing_test_starter.sh)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/routing_tests/conf/${TEST_LOCAL_ROUTING_STARTER}.bat.in
- ${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/routing_tests/${TEST_LOCAL_ROUTING_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER}
- ${TEST_LOCAL_ROUTING_CLIENT}
- )
-endif()
-##############################################################################
-# restart_routing-test
-##############################################################################
-
-if(NOT ${TESTS_BAT})
- set(TEST_RESTART_ROUTING_NAME restart_routing_test)
-
- set(TEST_RESTART_ROUTING_SERVICE restart_routing_test_service)
- add_executable(${TEST_RESTART_ROUTING_SERVICE} restart_routing_tests/${TEST_RESTART_ROUTING_SERVICE}.cpp)
- target_link_libraries(${TEST_RESTART_ROUTING_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for service into $BUILDDIR/test
- set(TEST_RESTART_ROUTING_SERVICE_CONFIG_FILE ${TEST_RESTART_ROUTING_SERVICE}.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_SERVICE_CONFIG_FILE}
- ${TEST_RESTART_ROUTING_SERVICE}
- )
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_RESTART_ROUTING_SERVICE_START_SCRIPT ${TEST_RESTART_ROUTING_SERVICE}_start.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_SERVICE_START_SCRIPT}
- ${TEST_RESTART_ROUTING_SERVICE}
- )
-
- set(TEST_RESTART_ROUTING_CLIENT restart_routing_test_client)
- add_executable(${TEST_RESTART_ROUTING_CLIENT}
- restart_routing_tests/${TEST_RESTART_ROUTING_CLIENT}.cpp
- )
- target_link_libraries(${TEST_RESTART_ROUTING_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for client into $BUILDDIR/test
- set(TEST_RESTART_ROUTING_CLIENT_CONFIG_FILE ${TEST_RESTART_ROUTING_CLIENT}.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_CLIENT_CONFIG_FILE}
- ${TEST_RESTART_ROUTING_CLIENT}
- )
-
- # Copy bashscript to start client into $BUILDDIR/test
- set(TEST_RESTART_ROUTING_CLIENT_START_SCRIPT ${TEST_RESTART_ROUTING_CLIENT}_start.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_CLIENT_START_SCRIPT}
- ${TEST_RESTART_ROUTING_CLIENT}
- )
-
- # Copy bashscript to start client and server $BUILDDIR/test
- set(TEST_RESTART_ROUTING_STARTER restart_routing_test_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_STARTER}
- ${TEST_RESTART_ROUTING_CLIENT}
- )
-
- # Copy config file for autoconfig into $BUILDDIR/test
- set(TEST_RESTART_ROUTING_AUTO_CONFIG_FILE ${TEST_RESTART_ROUTING_NAME}_autoconfig.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/restart_routing_tests/${TEST_RESTART_ROUTING_AUTO_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_AUTO_CONFIG_FILE}
- ${TEST_RESTART_ROUTING_CLIENT}
- )
-endif()
-
-##############################################################################
-# security test
-##############################################################################
-
-if (${TEST_SECURITY})
- if(NOT ${TESTS_BAT})
- set(TEST_SECURITY_NAME security_test)
-
- set(TEST_SECURITY_SERVICE security_test_service)
- add_executable(${TEST_SECURITY_SERVICE} security_tests/${TEST_SECURITY_SERVICE}.cpp)
- target_link_libraries(${TEST_SECURITY_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for service into $BUILDDIR/test
- set(TEST_SECURITY_SERVICE_CONFIG_FILE ${TEST_SECURITY_NAME}_config.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/security_tests/conf/${TEST_SECURITY_SERVICE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/security_tests/${TEST_SECURITY_SERVICE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/security_tests/${TEST_SECURITY_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SECURITY_SERVICE_CONFIG_FILE}
- ${TEST_SECURITY_SERVICE}
- )
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_SECURITY_SERVICE_START_SCRIPT ${TEST_SECURITY_NAME}_start.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/security_tests/${TEST_SECURITY_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_SECURITY_SERVICE_START_SCRIPT}
- ${TEST_SECURITY_SERVICE}
- )
-
- set(TEST_SECURITY_CLIENT security_test_client)
- add_executable(${TEST_SECURITY_CLIENT}
- security_tests/${TEST_SECURITY_CLIENT}.cpp
- )
- target_link_libraries(${TEST_SECURITY_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
- endif()
-endif()
-
-##############################################################################
-# payload-test
-##############################################################################
-
-if(NOT ${TESTS_BAT})
- set(TEST_LOCAL_PAYLOAD_NAME local_payload_test)
-
- set(TEST_PAYLOAD_SERVICE payload_test_service)
- add_executable(${TEST_PAYLOAD_SERVICE} payload_tests/${TEST_PAYLOAD_SERVICE}.cpp)
- target_link_libraries(${TEST_PAYLOAD_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for service into $BUILDDIR/test
- set(TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE local_${TEST_PAYLOAD_SERVICE}.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
- ${TEST_PAYLOAD_SERVICE}
- )
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT local_${TEST_PAYLOAD_SERVICE}_start.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
- ${TEST_PAYLOAD_SERVICE}
- )
-
- set(TEST_PAYLOAD_CLIENT payload_test_client)
- add_executable(${TEST_PAYLOAD_CLIENT}
- payload_tests/${TEST_PAYLOAD_CLIENT}.cpp
- payload_tests/stopwatch.cpp
- )
- target_link_libraries(${TEST_PAYLOAD_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for client into $BUILDDIR/test
- set(TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE local_${TEST_PAYLOAD_CLIENT}.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
- ${TEST_PAYLOAD_CLIENT}
- )
-
- # Copy bashscript to start client into $BUILDDIR/test
- set(TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT local_${TEST_PAYLOAD_CLIENT}_start.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_CLIENT_START_SCRIPT}
- ${TEST_PAYLOAD_CLIENT}
- )
-
- # Copy bashscript to start client and server $BUILDDIR/test
- set(TEST_LOCAL_PAYLOAD_STARTER local_payload_test_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_STARTER}
- ${TEST_PAYLOAD_CLIENT}
- )
-
- ##############################################################################
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_NAME external_local_payload_test)
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE external_local_payload_test_service)
-
- # Copy config file for service into $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CONFIG_FILE}
- ${TEST_PAYLOAD_SERVICE}
- )
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE}_start.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_START_SCRIPT}
- ${TEST_PAYLOAD_SERVICE}
- )
-
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL external_local_payload_test_client_local)
-
- # Copy config file for client into $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL}.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_CONFIG_FILE}
- ${TEST_PAYLOAD_CLIENT}
- )
-
- # 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)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_START_SCRIPT}
- ${TEST_PAYLOAD_CLIENT}
- )
-
- # Copy bashscript to start client and server $BUILDDIR/test
- 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)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}
- ${TEST_PAYLOAD_CLIENT}
- )
- ##############################################################################
- 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)
-
- # Copy config file for client into $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL}.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/conf/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_CONFIG_FILE}
- ${TEST_PAYLOAD_CLIENT}
- )
-
- # 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)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_START_SCRIPT}
- ${TEST_PAYLOAD_CLIENT}
- )
-
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL external_local_payload_test_service_client_external)
-
- # Copy bashscript to start service into $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT ${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENT_EXTERNAL}_start.sh)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_SERVICE_CLIENTT_EXTERNAL_START_SCRIPT}
- ${TEST_PAYLOAD_SERVICE}
- )
-
- # Copy bashscript to start client and server $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME}_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER}
- ${TEST_PAYLOAD_CLIENT}
- )
-
- ##############################################################################
- # Copy bashscript to start client and server $BUILDDIR/test
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME external_local_payload_test_client_local_and_external)
- set(TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME}_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER}
- ${TEST_PAYLOAD_CLIENT}
- )
-
- ##############################################################################
- 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)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/payload_tests/${TEST_LOCAL_PAYLOAD_HUGE_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_HUGE_STARTER}
- ${TEST_PAYLOAD_CLIENT}
- )
-endif()
-
-##############################################################################
-# big_payload_test
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_BIG_PAYLOAD_NAME big_payload_test)
-
- set(TEST_BIG_PAYLOAD_SERVICE big_payload_test_service)
- add_executable(${TEST_BIG_PAYLOAD_SERVICE} big_payload_tests/${TEST_BIG_PAYLOAD_SERVICE}.cpp)
- target_link_libraries(${TEST_BIG_PAYLOAD_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_BIG_PAYLOAD_CLIENT big_payload_test_client)
- add_executable(${TEST_BIG_PAYLOAD_CLIENT} big_payload_tests/${TEST_BIG_PAYLOAD_CLIENT}.cpp)
- target_link_libraries(${TEST_BIG_PAYLOAD_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config file for client and service into $BUILDDIR/test
- set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # Copy config file for client and service into $BUILDDIR/test
- set(TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE ${TEST_BIG_PAYLOAD_NAME}_local_queue_limited.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_QUEUE_LIMITED_LOCAL_BIG_PAYLOAD_CONFIG_FILE}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # Copy config file for client and service into $BUILDDIR/test
- set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM ${TEST_BIG_PAYLOAD_NAME}_local_random.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_RANDOM}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # Copy config file for client and service into $BUILDDIR/test
- set(TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED ${TEST_BIG_PAYLOAD_NAME}_local_limited.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_CONFIG_FILE_LIMITED}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE}
- ${TEST_BIG_PAYLOAD_CLIENT}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}.in
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_LIMITED}
- ${TEST_BIG_PAYLOAD_CLIENT}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}.in
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_LIMITED}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}.in
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_RANDOM}
- ${TEST_BIG_PAYLOAD_CLIENT}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}.in
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_RANDOM}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL}.in
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_GENERAL}
- ${TEST_BIG_PAYLOAD_CLIENT}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL}.in
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_GENERAL}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}.in
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}
- ${TEST_BIG_PAYLOAD_CLIENT}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/conf/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}.in
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_CONFIG_FILE_QUEUE_LIMITED_SPECIFIC}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # 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)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_CLIENT_START_SCRIPT}
- ${TEST_BIG_PAYLOAD_CLIENT}
- )
-
- # Copy bashscript to start service local to $BUILDDIR/test
- set(TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_service_local_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_SERVICE_START_SCRIPT}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # Copy bashscript to start client and server $BUILDDIR/test
- set(TEST_LOCAL_BIG_PAYLOAD_NAME big_payload_test_local)
- set(TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM big_payload_test_local_random)
- 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)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_LOCAL_BIG_PAYLOAD_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # Copy bashscript to start client for external test into $BUILDDIR/test
- set(TEST_EXTERNAL_BIG_PAYLOAD_NAME big_payload_test_external)
- set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM big_payload_test_external_random)
- set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED big_payload_test_external_limited)
- set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED_GENERAL big_payload_test_external_limited_general)
- set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_GENERAL big_payload_test_external_queue_limited_general)
- set(TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC big_payload_test_external_queue_limited_specific)
- set(TEST_EXTERNAL_BIG_PAYLOAD_STARTER ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # Copy bashscript to start server for external into $BUILDDIR/test
- set(TEST_EXTERNAL_BIG_PAYLOAD_NAME big_payload_test_external)
- set(TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_service_external_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_SERVICE_START_SCRIPT}
- ${TEST_BIG_PAYLOAD_SERVICE}
- )
-
- # Copy bashscript to start client for external test into $BUILDDIR/test
- set(TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT ${TEST_BIG_PAYLOAD_NAME}_client_start.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/big_payload_tests/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT}
- ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_CLIENT_START_SCRIPT}
- ${TEST_BIG_PAYLOAD_CLIENT}
- )
-endif()
-
-##############################################################################
-# client id tests
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_CLIENT_ID_NAME client_id_test)
- set(TEST_CLIENT_ID_SERVICE ${TEST_CLIENT_ID_NAME}_service)
- add_executable(${TEST_CLIENT_ID_SERVICE} client_id_tests/${TEST_CLIENT_ID_NAME}_service.cpp)
- target_link_libraries(${TEST_CLIENT_ID_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_CLIENT_ID_UTILITY ${TEST_CLIENT_ID_NAME}_utility)
- add_executable(${TEST_CLIENT_ID_UTILITY}
- client_id_tests/${TEST_CLIENT_ID_UTILITY}.cpp
- ${PROJECT_SOURCE_DIR}/implementation/utility/src/utility.cpp)
- target_link_libraries(${TEST_CLIENT_ID_UTILITY}
- vsomeip
- vsomeip-cfg
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config files for test into $BUILDDIR/test
- set(TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE
- ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${TEST_CLIENT_ID_SERVICE}
- )
-
- set(TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE
- ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_CLIENT_ID_SERVICE}
- )
-
- set(TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE
- ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${TEST_CLIENT_ID_SERVICE}
- )
-
- set(TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE
- ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_CLIENT_ID_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}
- ${TEST_CLIENT_ID_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_CLIENT_ID_SERVICE}
- )
-
- set(TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE
- ${TEST_CLIENT_ID_NAME}_same_client_ids_same_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${TEST_CLIENT_ID_SERVICE}
- )
-
- set(TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE
- ${TEST_CLIENT_ID_NAME}_same_client_ids_same_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_CLIENT_ID_SERVICE}
- )
-
- set(TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE
- ${TEST_CLIENT_ID_NAME}_same_client_ids_diff_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${TEST_CLIENT_ID_SERVICE}
- )
-
- set(TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE
- ${TEST_CLIENT_ID_NAME}_same_client_ids_diff_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/conf/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_CLIENT_ID_SERVICE}
- )
-
- set(TEST_CLIENT_ID_UTILITY_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_utility.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_UTILITY_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY_CONFIG_FILE}
- ${TEST_CLIENT_ID_UTILITY}
- )
- set(TEST_CLIENT_ID_UTILITY_MASKED_511_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_utility_masked_511.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_UTILITY_MASKED_511_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY_MASKED_511_CONFIG_FILE}
- ${TEST_CLIENT_ID_UTILITY}
- )
-
- set(TEST_CLIENT_ID_UTILITY_MASKED_4095_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_utility_masked_4095.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_UTILITY_MASKED_4095_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY_MASKED_4095_CONFIG_FILE}
- ${TEST_CLIENT_ID_UTILITY}
- )
-
- set(TEST_CLIENT_ID_UTILITY_MASKED_127_CONFIG_FILE ${TEST_CLIENT_ID_NAME}_utility_masked_127.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_UTILITY_MASKED_127_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY_MASKED_127_CONFIG_FILE}
- ${TEST_CLIENT_ID_UTILITY}
- )
-
- # copy starter scripts into builddir
- set(TEST_CLIENT_ID_MASTER_STARTER ${TEST_CLIENT_ID_NAME}_master_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER}
- ${TEST_CLIENT_ID_SERVICE}
- )
- set(TEST_CLIENT_ID_SLAVE_STARTER ${TEST_CLIENT_ID_NAME}_slave_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/client_id_tests/${TEST_CLIENT_ID_SLAVE_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_SLAVE_STARTER}
- ${TEST_CLIENT_ID_SERVICE}
- )
-endif()
-
-##############################################################################
-# subscribe notify tests
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_SUBSCRIBE_NOTIFY_NAME subscribe_notify_test)
- set(TEST_SUBSCRIBE_NOTIFY_SERVICE ${TEST_SUBSCRIBE_NOTIFY_NAME}_service)
- add_executable(${TEST_SUBSCRIBE_NOTIFY_SERVICE} subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_NAME}_service.cpp)
- target_link_libraries(${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config files for test into $BUILDDIR/test
- set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_same_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_same_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_diff_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_same_client_ids_diff_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_SLAVE_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- # copy starter scripts into builddir
- set(TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER ${TEST_SUBSCRIBE_NOTIFY_NAME}_master_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
- set(TEST_SUBSCRIBE_NOTIFY_SLAVE_STARTER ${TEST_SUBSCRIBE_NOTIFY_NAME}_slave_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_SLAVE_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_SLAVE_STARTER}
- ${TEST_SUBSCRIBE_NOTIFY_SERVICE}
- )
-
- # subscribe_notify_test_one_event_two_eventgroups
- set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME subscribe_notify_test_one_event_two_eventgroups)
-
- # service
- set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_service)
- add_executable(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE}
- subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE}.cpp)
- target_link_libraries(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
- # client
- set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_client)
- add_executable(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT}
- subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT}.cpp)
- target_link_libraries(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_UDP_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT}
- )
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_TCP_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT}
- )
-
- set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER
- ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_master_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE}
- )
- set(TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_STARTER
- ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_slave_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SLAVE_STARTER}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE}
- )
-endif()
-
-##############################################################################
-# subscribe notify one tests
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_SUBSCRIBE_NOTIFY_ONE_NAME subscribe_notify_one_test)
- set(TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_service)
- add_executable(${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_service.cpp)
- target_link_libraries(${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config files for test into $BUILDDIR/test
- set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE
- ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE}
- )
-
- # copy starter scripts into builddir
- set(TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_master_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE}
- )
- set(TEST_SUBSCRIBE_NOTIFY_ONE_SLAVE_STARTER ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_slave_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_SLAVE_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_SLAVE_STARTER}
- ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE}
- )
-endif()
-
-##############################################################################
-# cpu-load-test
-##############################################################################
-
-if(NOT ${TESTS_BAT})
- set(TEST_CPU_LOAD_NAME cpu_load_test)
-
- set(TEST_CPU_LOAD_SERVICE cpu_load_test_service)
- add_executable(${TEST_CPU_LOAD_SERVICE}
- cpu_load_tests/${TEST_CPU_LOAD_SERVICE}.cpp
- cpu_load_tests/cpu_load_measurer.cpp
- )
- target_link_libraries(${TEST_CPU_LOAD_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config files for test into $BUILDDIR/test
- set(TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_service_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/conf/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_SERVICE_MASTER_CONFIG_FILE}
- ${TEST_CPU_LOAD_SERVICE}
- )
- set(TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_service_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/conf/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_SERVICE_SLAVE_CONFIG_FILE}
- ${TEST_CPU_LOAD_SERVICE}
- )
-
- ##############################################################################
- set(TEST_CPU_LOAD_CLIENT cpu_load_test_client)
- add_executable(${TEST_CPU_LOAD_CLIENT}
- cpu_load_tests/${TEST_CPU_LOAD_CLIENT}.cpp
- cpu_load_tests/cpu_load_measurer.cpp
- )
- target_link_libraries(${TEST_CPU_LOAD_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_client_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/conf/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_CLIENT_MASTER_CONFIG_FILE}
- ${TEST_CPU_LOAD_CLIENT}
- )
- set(TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE ${TEST_CPU_LOAD_NAME}_client_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/conf/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_CLIENT_SLAVE_CONFIG_FILE}
- ${TEST_CPU_LOAD_CLIENT}
- )
-
- ##############################################################################
- # copy starter scripts into builddir
- set(TEST_CPU_LOAD_MASTER_STARTER ${TEST_CPU_LOAD_NAME}_master_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_MASTER_STARTER}
- ${TEST_CPU_LOAD_SERVICE}
- )
- set(TEST_CPU_LOAD_SLAVE_STARTER ${TEST_CPU_LOAD_NAME}_slave_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/cpu_load_tests/${TEST_CPU_LOAD_SLAVE_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_SLAVE_STARTER}
- ${TEST_CPU_LOAD_SERVICE}
- )
-endif()
-
-##############################################################################
-# initial event tests
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_INITIAL_EVENT_NAME initial_event_test)
- set(TEST_INITIAL_EVENT_SERVICE ${TEST_INITIAL_EVENT_NAME}_service)
- add_executable(${TEST_INITIAL_EVENT_SERVICE} initial_event_tests/${TEST_INITIAL_EVENT_NAME}_service.cpp)
- target_link_libraries(${TEST_INITIAL_EVENT_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_INITIAL_EVENT_CLIENT ${TEST_INITIAL_EVENT_NAME}_client)
- add_executable(${TEST_INITIAL_EVENT_CLIENT} initial_event_tests/${TEST_INITIAL_EVENT_NAME}_client.cpp)
- target_link_libraries(${TEST_INITIAL_EVENT_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_INITIAL_EVENT_AVAILABILITY_CHECKER ${TEST_INITIAL_EVENT_NAME}_availability_checker)
- add_executable(${TEST_INITIAL_EVENT_AVAILABILITY_CHECKER} initial_event_tests/${TEST_INITIAL_EVENT_NAME}_availability_checker.cpp)
- target_link_libraries(${TEST_INITIAL_EVENT_AVAILABILITY_CHECKER}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_INITIAL_EVENT_STOP_SERVICE ${TEST_INITIAL_EVENT_NAME}_stop_service)
- add_executable(${TEST_INITIAL_EVENT_STOP_SERVICE} initial_event_tests/${TEST_INITIAL_EVENT_NAME}_stop_service.cpp)
- target_link_libraries(${TEST_INITIAL_EVENT_STOP_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # Copy config files for test into $BUILDDIR/test
- set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE
- ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- set(TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE
- ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SLAVE_TCP_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE
- ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- set(TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE
- ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_SLAVE_TCP_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- set(TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE
- ${TEST_INITIAL_EVENT_NAME}_same_client_ids_same_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_MASTER_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- set(TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE
- ${TEST_INITIAL_EVENT_NAME}_same_client_ids_same_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_SAME_IDS_SAME_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- set(TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE
- ${TEST_INITIAL_EVENT_NAME}_same_client_ids_diff_ports_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- set(TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE
- ${TEST_INITIAL_EVENT_NAME}_same_client_ids_diff_ports_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_SAME_IDS_DIFF_PORTS_SLAVE_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- 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(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/conf/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_SLAVE_CONFIG_FILE}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-
- # copy starter scripts into builddir
- set(TEST_INITIAL_EVENT_MASTER_STARTER ${TEST_INITIAL_EVENT_NAME}_master_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
- set(TEST_INITIAL_EVENT_SLAVE_STARTER ${TEST_INITIAL_EVENT_NAME}_slave_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/initial_event_tests/${TEST_INITIAL_EVENT_SLAVE_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_SLAVE_STARTER}
- ${TEST_INITIAL_EVENT_SERVICE}
- )
-endif()
-
-##############################################################################
-# offer tests
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_OFFER_NAME offer_test)
- set(TEST_OFFER_SERVICE ${TEST_OFFER_NAME}_service)
- add_executable(${TEST_OFFER_SERVICE} offer_tests/${TEST_OFFER_NAME}_service.cpp)
- target_link_libraries(${TEST_OFFER_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_OFFER_CLIENT ${TEST_OFFER_NAME}_client)
- add_executable(${TEST_OFFER_CLIENT} offer_tests/${TEST_OFFER_NAME}_client.cpp)
- target_link_libraries(${TEST_OFFER_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_OFFER_SERVICE_EXTERNAL ${TEST_OFFER_NAME}_service_external)
- add_executable(${TEST_OFFER_SERVICE_EXTERNAL} offer_tests/${TEST_OFFER_NAME}_service_external.cpp)
- target_link_libraries(${TEST_OFFER_SERVICE_EXTERNAL}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_OFFER_EXTERNAL_SD_MESSAGE_SENDER ${TEST_OFFER_NAME}_external_sd_msg_sender)
- add_executable(${TEST_OFFER_EXTERNAL_SD_MESSAGE_SENDER} offer_tests/${TEST_OFFER_NAME}_external_sd_msg_sender.cpp)
- target_link_libraries(${TEST_OFFER_EXTERNAL_SD_MESSAGE_SENDER}
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # client and service for offer test big sd msg
- set(TEST_OFFER_BIG_NAME offer_test_big_sd_msg)
- set(TEST_OFFER_BIG_SERVICE ${TEST_OFFER_BIG_NAME}_service)
- add_executable(${TEST_OFFER_BIG_SERVICE} offer_tests/${TEST_OFFER_BIG_NAME}_service.cpp)
- target_link_libraries(${TEST_OFFER_BIG_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_OFFER_BIG_CLIENT ${TEST_OFFER_BIG_NAME}_client)
- add_executable(${TEST_OFFER_BIG_CLIENT} offer_tests/${TEST_OFFER_BIG_NAME}_client.cpp)
- target_link_libraries(${TEST_OFFER_BIG_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # copy starter scripts into builddir
- set(TEST_OFFER_LOCAL_STARTER ${TEST_OFFER_NAME}_local_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_LOCAL_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_LOCAL_STARTER}
- ${TEST_OFFER_SERVICE}
- )
-
- # Copy config file for local test into $BUILDDIR/test
- set(TEST_OFFER_LOCAL_CONFIG_FILE ${TEST_OFFER_NAME}_local.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_LOCAL_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_LOCAL_CONFIG_FILE}
- ${TEST_OFFER_SERVICE}
- )
-
- # generate and copy json files into builddir for external test
- set(TEST_OFFER_SLAVE_CONFIG_FILE ${TEST_OFFER_NAME}_external_slave.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_SLAVE_CONFIG_FILE}
- ${TEST_OFFER_SERVICE}
- )
-
- set(TEST_OFFER_MASTER_CONFIG_FILE ${TEST_OFFER_NAME}_external_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_MASTER_CONFIG_FILE}
- ${TEST_OFFER_SERVICE}
- )
-
- # 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(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_BIG_SLAVE_CONFIG_FILE}
- ${TEST_OFFER_BIG_SERVICE}
- )
-
- set(TEST_OFFER_BIG_MASTER_CONFIG_FILE ${TEST_OFFER_BIG_NAME}_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_BIG_MASTER_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_MASTER_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_MASTER_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_BIG_MASTER_CONFIG_FILE}
- ${TEST_OFFER_BIG_SERVICE}
- )
-
- # Copy starter scripts for external test to $BUILDDIR/test
- set(TEST_OFFER_EXTERNAL_MASTER_STARTER ${TEST_OFFER_NAME}_external_master_starter.sh)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_EXTERNAL_MASTER_STARTER}.in
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_EXTERNAL_MASTER_STARTER}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_EXTERNAL_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_EXTERNAL_MASTER_STARTER}
- ${TEST_OFFER_SERVICE}
- )
- set(TEST_OFFER_EXTERNAL_SLAVE_STARTER ${TEST_OFFER_NAME}_external_slave_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_EXTERNAL_SLAVE_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_EXTERNAL_SLAVE_STARTER}
- ${TEST_OFFER_SERVICE}
- )
-
- # Copy starter scripts for external test to $BUILDDIR/test
- set(TEST_OFFER_BIG_MASTER_STARTER ${TEST_OFFER_BIG_NAME}_master_starter.sh)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/offer_tests/conf/${TEST_OFFER_BIG_MASTER_STARTER}.in
- ${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_MASTER_STARTER}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_BIG_MASTER_STARTER}
- ${TEST_OFFER_BIG_SERVICE}
- )
- # 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(${PROJECT_SOURCE_DIR}/test/offer_tests/${TEST_OFFER_BIG_EXTERNAL_SLAVE_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_BIG_EXTERNAL_SLAVE_STARTER}
- ${TEST_OFFER_BIG_SERVICE}
- )
-endif()
-
-##############################################################################
-# offered services info tests
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_OFFERED_SERVICES_INFO_NAME offered_services_info_test)
- set(TEST_OFFERED_SERVICES_INFO_SERVICE ${TEST_OFFERED_SERVICES_INFO_NAME}_service)
- add_executable(${TEST_OFFERED_SERVICES_INFO_SERVICE} offered_services_info_test/${TEST_OFFERED_SERVICES_INFO_NAME}_service.cpp)
- target_link_libraries(${TEST_OFFERED_SERVICES_INFO_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- set(TEST_OFFERED_SERVICES_INFO_CLIENT ${TEST_OFFERED_SERVICES_INFO_NAME}_client)
- add_executable(${TEST_OFFERED_SERVICES_INFO_CLIENT} offered_services_info_test/${TEST_OFFERED_SERVICES_INFO_NAME}_client.cpp)
- target_link_libraries(${TEST_OFFERED_SERVICES_INFO_CLIENT}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- # copy starter scripts into builddir
- set(TEST_OFFERED_SERVICES_INFO_LOCAL_STARTER ${TEST_OFFERED_SERVICES_INFO_NAME}_local_starter.sh)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/offered_services_info_test/${TEST_OFFERED_SERVICES_INFO_LOCAL_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFERED_SERVICES_INFO_LOCAL_STARTER}
- ${TEST_OFFERED_SERVICES_INFO_SERVICE}
- )
-
- # Copy config file for local test into $BUILDDIR/test
- set(TEST_OFFERED_SERVICES_INFO_LOCAL_CONFIG_FILE ${TEST_OFFERED_SERVICES_INFO_NAME}_local.json)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/offered_services_info_test/${TEST_OFFERED_SERVICES_INFO_LOCAL_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_OFFERED_SERVICES_INFO_LOCAL_CONFIG_FILE}
- ${TEST_OFFERED_SERVICES_INFO_SERVICE}
- )
-endif()
-
-##############################################################################
-# pending subscription tests tests
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_PENDING_SUBSCRIPTION_NAME pending_subscription_test)
- set(TEST_PENDING_SUBSCRIPTION_SERVICE ${TEST_PENDING_SUBSCRIPTION_NAME}_service)
- add_executable(${TEST_PENDING_SUBSCRIPTION_SERVICE} pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_NAME}_service.cpp)
- target_link_libraries(${TEST_PENDING_SUBSCRIPTION_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- file(GLOB sd_sources
- "../implementation/service_discovery/src/*entry*.cpp"
- "../implementation/service_discovery/src/*option*.cpp"
- "../implementation/service_discovery/src/*message*.cpp"
- )
- set(TEST_PENDING_SUBSCRIPTION_CLIENT ${TEST_PENDING_SUBSCRIPTION_NAME}_sd_msg_sender)
- add_executable(${TEST_PENDING_SUBSCRIPTION_CLIENT}
- pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_NAME}_sd_msg_sender.cpp
- ${PROJECT_SOURCE_DIR}/implementation/message/src/deserializer.cpp
- ${PROJECT_SOURCE_DIR}/implementation/message/src/message_impl.cpp
- ${PROJECT_SOURCE_DIR}/implementation/message/src/payload_impl.cpp
- ${sd_sources}
- )
-
- target_link_libraries(${TEST_PENDING_SUBSCRIPTION_CLIENT}
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- vsomeip
- vsomeip-sd
- )
-
- # copy starter scripts into builddir
- set(TEST_PENDING_SUBSCRIPTION_MASTER_STARTER ${TEST_PENDING_SUBSCRIPTION_NAME}_master_starter.sh)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/conf/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER}.in
- ${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER}
- ${TEST_PENDING_SUBSCRIPTION_SERVICE}
- )
-
- # Copy config file for local test into $BUILDDIR/test
- set(TEST_PENDING_SUBSCRIPTION_CONFIG_FILE ${TEST_PENDING_SUBSCRIPTION_NAME}_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/conf/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/pending_subscription_tests/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_CONFIG_FILE}
- ${TEST_PENDING_SUBSCRIPTION_SERVICE}
- )
-endif()
-
-##############################################################################
-# malicious data tests
-##############################################################################
-if(NOT ${TESTS_BAT})
- set(TEST_MALICIOUS_DATA_NAME malicious_data_test)
- set(TEST_MALICIOUS_DATA_SERVICE ${TEST_MALICIOUS_DATA_NAME}_service)
- add_executable(${TEST_MALICIOUS_DATA_SERVICE} malicious_data_tests/${TEST_MALICIOUS_DATA_NAME}_service.cpp)
- target_link_libraries(${TEST_MALICIOUS_DATA_SERVICE}
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- )
-
- file(GLOB sd_sources
- "../implementation/service_discovery/src/*entry*.cpp"
- "../implementation/service_discovery/src/*option*.cpp"
- "../implementation/service_discovery/src/*message*.cpp"
- )
- set(TEST_MALICIOUS_DATA_CLIENT ${TEST_MALICIOUS_DATA_NAME}_msg_sender)
- add_executable(${TEST_MALICIOUS_DATA_CLIENT}
- malicious_data_tests/${TEST_MALICIOUS_DATA_CLIENT}.cpp
- ${PROJECT_SOURCE_DIR}/implementation/message/src/deserializer.cpp
- ${PROJECT_SOURCE_DIR}/implementation/message/src/message_impl.cpp
- ${PROJECT_SOURCE_DIR}/implementation/message/src/payload_impl.cpp
- ${sd_sources}
- )
-
- target_link_libraries(${TEST_MALICIOUS_DATA_CLIENT}
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${TEST_LINK_LIBRARIES}
- vsomeip
- vsomeip-sd
- )
-
- # copy starter scripts into builddir
- set(TEST_MALICIOUS_DATA_MASTER_STARTER ${TEST_MALICIOUS_DATA_NAME}_master_starter.sh)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/malicious_data_tests/conf/${TEST_MALICIOUS_DATA_MASTER_STARTER}.in
- ${PROJECT_SOURCE_DIR}/test/malicious_data_tests/${TEST_MALICIOUS_DATA_MASTER_STARTER}
- @ONLY)
- copy_to_builddir(${PROJECT_SOURCE_DIR}/test/malicious_data_tests/${TEST_MALICIOUS_DATA_MASTER_STARTER}
- ${PROJECT_BINARY_DIR}/test/${TEST_MALICIOUS_DATA_MASTER_STARTER}
- ${TEST_MALICIOUS_DATA_SERVICE}
- )
-
- # Copy config file for local test into $BUILDDIR/test
- set(TEST_MALICIOUS_DATA_CONFIG_FILE ${TEST_MALICIOUS_DATA_NAME}_master.json)
- configure_file(
- ${PROJECT_SOURCE_DIR}/test/malicious_data_tests/conf/${TEST_MALICIOUS_DATA_CONFIG_FILE}.in
- ${PROJECT_SOURCE_DIR}/test/malicious_data_tests/${TEST_MALICIOUS_DATA_CONFIG_FILE}
- @ONLY)
- copy_to_builddir(
- ${PROJECT_SOURCE_DIR}/test/malicious_data_tests/${TEST_MALICIOUS_DATA_CONFIG_FILE}
- ${PROJECT_BINARY_DIR}/test/${TEST_MALICIOUS_DATA_CONFIG_FILE}
- ${TEST_MALICIOUS_DATA_SERVICE}
- )
-endif()
-
-##############################################################################
-# Add for every test a dependency to gtest
-##############################################################################
-
-if(NOT ${TESTS_BAT})
- add_dependencies(${TEST_CONFIGURATION} gtest)
- add_dependencies(${TEST_APPLICATION} gtest)
- add_dependencies(${TEST_APPLICATION_SINGLE_PROCESS_NAME} gtest)
- add_dependencies(${TEST_APPLICATION_AVAILABILITY_NAME} gtest)
- add_dependencies(${TEST_MAGIC_COOKIES_CLIENT} gtest)
- add_dependencies(${TEST_MAGIC_COOKIES_SERVICE} gtest)
- add_dependencies(${TEST_HEADER_FACTORY} gtest)
- add_dependencies(${TEST_HEADER_FACTORY_CLIENT} gtest)
- add_dependencies(${TEST_HEADER_FACTORY_SERVICE} gtest)
- add_dependencies(${TEST_LOCAL_ROUTING_SERVICE} gtest)
- add_dependencies(${TEST_LOCAL_ROUTING_CLIENT} gtest)
- add_dependencies(${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE} gtest)
- add_dependencies(${TEST_PAYLOAD_SERVICE} gtest)
- add_dependencies(${TEST_PAYLOAD_CLIENT} gtest)
- add_dependencies(${TEST_BIG_PAYLOAD_SERVICE} gtest)
- add_dependencies(${TEST_BIG_PAYLOAD_CLIENT} gtest)
- add_dependencies(${TEST_CLIENT_ID_SERVICE} gtest)
- add_dependencies(${TEST_CLIENT_ID_UTILITY} gtest)
- add_dependencies(${TEST_SUBSCRIBE_NOTIFY_SERVICE} gtest)
- add_dependencies(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE} gtest)
- add_dependencies(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT} gtest)
- add_dependencies(${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} gtest)
- add_dependencies(${TEST_CPU_LOAD_SERVICE} gtest)
- add_dependencies(${TEST_CPU_LOAD_CLIENT} gtest)
- add_dependencies(${TEST_INITIAL_EVENT_SERVICE} gtest)
- add_dependencies(${TEST_INITIAL_EVENT_CLIENT} gtest)
- add_dependencies(${TEST_INITIAL_EVENT_AVAILABILITY_CHECKER} gtest)
- add_dependencies(${TEST_INITIAL_EVENT_STOP_SERVICE} gtest)
- add_dependencies(${TEST_OFFER_SERVICE} gtest)
- add_dependencies(${TEST_OFFER_CLIENT} gtest)
- add_dependencies(${TEST_OFFER_SERVICE_EXTERNAL} gtest)
- add_dependencies(${TEST_OFFER_EXTERNAL_SD_MESSAGE_SENDER} gtest)
- add_dependencies(${TEST_OFFERED_SERVICES_INFO_CLIENT} gtest)
- add_dependencies(${TEST_OFFERED_SERVICES_INFO_SERVICE} gtest)
- add_dependencies(${TEST_PENDING_SUBSCRIPTION_SERVICE} gtest)
- add_dependencies(${TEST_PENDING_SUBSCRIPTION_CLIENT} gtest)
- add_dependencies(${TEST_MALICIOUS_DATA_SERVICE} gtest)
- add_dependencies(${TEST_MALICIOUS_DATA_CLIENT} gtest)
-else()
- add_dependencies(${TEST_LOCAL_ROUTING_SERVICE} gtest)
- add_dependencies(${TEST_LOCAL_ROUTING_CLIENT} gtest)
-endif()
-
-##############################################################################
-# Add tests to the target build_tests
-##############################################################################
-
-if(NOT ${TESTS_BAT})
- add_dependencies(build_tests ${TEST_CONFIGURATION})
- add_dependencies(build_tests ${TEST_APPLICATION})
- add_dependencies(build_tests ${TEST_APPLICATION_SINGLE_PROCESS_NAME})
- add_dependencies(build_tests ${TEST_APPLICATION_AVAILABILITY_NAME})
- add_dependencies(build_tests ${TEST_MAGIC_COOKIES_CLIENT})
- add_dependencies(build_tests ${TEST_MAGIC_COOKIES_SERVICE})
- add_dependencies(build_tests ${TEST_HEADER_FACTORY})
- add_dependencies(build_tests ${TEST_HEADER_FACTORY_CLIENT})
- add_dependencies(build_tests ${TEST_HEADER_FACTORY_SERVICE})
- add_dependencies(build_tests ${TEST_LOCAL_ROUTING_SERVICE})
- add_dependencies(build_tests ${TEST_LOCAL_ROUTING_CLIENT})
- add_dependencies(build_tests ${TEST_EXTERNAL_LOCAL_ROUTING_SERVICE})
- add_dependencies(build_tests ${TEST_PAYLOAD_SERVICE})
- add_dependencies(build_tests ${TEST_PAYLOAD_CLIENT})
- add_dependencies(build_tests ${TEST_BIG_PAYLOAD_SERVICE})
- add_dependencies(build_tests ${TEST_BIG_PAYLOAD_CLIENT})
- add_dependencies(build_tests ${TEST_CLIENT_ID_SERVICE})
- add_dependencies(build_tests ${TEST_CLIENT_ID_UTILITY})
- add_dependencies(build_tests ${TEST_SUBSCRIBE_NOTIFY_SERVICE})
- add_dependencies(build_tests ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_SERVICE})
- add_dependencies(build_tests ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_CLIENT})
- add_dependencies(build_tests ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE})
- add_dependencies(build_tests ${TEST_CPU_LOAD_SERVICE})
- add_dependencies(build_tests ${TEST_CPU_LOAD_CLIENT})
- add_dependencies(build_tests ${TEST_INITIAL_EVENT_SERVICE})
- add_dependencies(build_tests ${TEST_INITIAL_EVENT_CLIENT})
- add_dependencies(build_tests ${TEST_INITIAL_EVENT_AVAILABILITY_CHECKER})
- add_dependencies(build_tests ${TEST_INITIAL_EVENT_STOP_SERVICE})
- add_dependencies(build_tests ${TEST_OFFER_SERVICE})
- add_dependencies(build_tests ${TEST_OFFER_CLIENT})
- add_dependencies(build_tests ${TEST_OFFER_SERVICE_EXTERNAL})
- add_dependencies(build_tests ${TEST_OFFER_EXTERNAL_SD_MESSAGE_SENDER})
- add_dependencies(build_tests ${TEST_OFFER_BIG_SERVICE})
- add_dependencies(build_tests ${TEST_OFFER_BIG_CLIENT})
- add_dependencies(build_tests ${TEST_RESTART_ROUTING_SERVICE})
- add_dependencies(build_tests ${TEST_RESTART_ROUTING_CLIENT})
- if (${TEST_SECURITY})
- add_dependencies(build_tests ${TEST_SECURITY_SERVICE})
- add_dependencies(build_tests ${TEST_SECURITY_CLIENT})
- endif()
- add_dependencies(build_tests ${TEST_OFFERED_SERVICES_INFO_CLIENT})
- add_dependencies(build_tests ${TEST_OFFERED_SERVICES_INFO_SERVICE})
- add_dependencies(build_tests ${TEST_PENDING_SUBSCRIPTION_SERVICE})
- add_dependencies(build_tests ${TEST_PENDING_SUBSCRIPTION_CLIENT})
- add_dependencies(build_tests ${TEST_MALICIOUS_DATA_SERVICE})
- add_dependencies(build_tests ${TEST_MALICIOUS_DATA_CLIENT})
-else()
- add_dependencies(build_tests ${TEST_LOCAL_ROUTING_SERVICE})
- add_dependencies(build_tests ${TEST_LOCAL_ROUTING_CLIENT})
-endif()
-
-
-
-##############################################################################
-# Add tests
-##############################################################################
-
-if(NOT ${TESTS_BAT})
- add_test(NAME ${TEST_CONFIGURATION}
- COMMAND ${TEST_CONFIGURATION}
- )
-
- # application test
- add_test(NAME ${TEST_APPLICATION}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_STARTER}
- )
- set_tests_properties(${TEST_APPLICATION} PROPERTIES TIMEOUT 80)
- add_test(NAME ${TEST_APPLICATION_SINGLE_PROCESS_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_SINGLE_PROCESS_STARTER}
- )
- set_tests_properties(${TEST_APPLICATION_SINGLE_PROCESS_NAME} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_APPLICATION_AVAILABILITY_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_APPLICATION_AVAILABILITY_STARTER}
- )
- set_tests_properties(${TEST_APPLICATION_AVAILABILITY_NAME} PROPERTIES TIMEOUT 120)
-
- # magic cookies test
- add_test(NAME ${TEST_MAGIC_COOKIES_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_STARTER}
- )
- set_tests_properties(${TEST_MAGIC_COOKIES_NAME} PROPERTIES TIMEOUT 250)
-
- # Header/Factory tets
- add_test(NAME ${TEST_HEADER_FACTORY_NAME} COMMAND ${TEST_HEADER_FACTORY})
- add_test(NAME ${TEST_HEADER_FACTORY_NAME}_send_receive
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_HEADER_FACTORY_STARTER}
- )
-
- # Routing tests
- add_test(NAME ${TEST_LOCAL_ROUTING_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER}
- )
-
- add_test(NAME ${TEST_EXTERNAL_LOCAL_ROUTING_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_ROUTING_STARTER}
- )
- set_tests_properties(${TEST_EXTERNAL_LOCAL_ROUTING_NAME} PROPERTIES TIMEOUT 120)
-
- # Payload tests
- add_test(NAME ${TEST_LOCAL_PAYLOAD_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_STARTER}
- )
- add_test(NAME ${TEST_LOCAL_PAYLOAD_HUGE_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_PAYLOAD_HUGE_STARTER}
- )
- set_tests_properties(${TEST_LOCAL_PAYLOAD_HUGE_NAME} PROPERTIES TIMEOUT 480)
- add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_STARTER}
- )
- add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_STARTER}
- )
- set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 480)
- add_test(NAME ${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_LOCAL_AND_EXTERNAL_STARTER}
- )
- set_tests_properties(${TEST_EXTERNAL_LOCAL_PAYLOAD_CLIENT_EXTERNAL_NAME} PROPERTIES TIMEOUT 480)
-
- # big payload tests
- add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER}
- )
- set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} RANDOM
- )
- set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} LIMITED
- )
- set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER}
- )
- set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} RANDOM
- )
- set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_RANDOM} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} LIMITED
- )
- set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED_GENERAL}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} LIMITEDGENERAL
- )
- set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_LIMITED_GENERAL} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_LOCAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_BIG_PAYLOAD_STARTER} QUEUELIMITEDGENERAL
- )
- set_tests_properties(${TEST_LOCAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_GENERAL}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} QUEUELIMITEDGENERAL
- )
- set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_GENERAL} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_EXTERNAL_BIG_PAYLOAD_STARTER} QUEUELIMITEDSPECIFIC
- )
- set_tests_properties(${TEST_EXTERNAL_BIG_PAYLOAD_NAME_QUEUE_LIMITED_SPECIFIC} PROPERTIES TIMEOUT 120)
-
- # client id tests
- add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_diff_ports PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_same_ports PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_MASTER_STARTER} ${TEST_CLIENT_ID_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_CLIENT_ID_NAME}_diff_client_ids_partial_same_ports PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_CLIENT_ID_UTILITY}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY})
- set_property(TEST ${TEST_CLIENT_ID_UTILITY}
- APPEND PROPERTY ENVIRONMENT
- "VSOMEIP_CONFIGURATION=${TEST_CLIENT_ID_UTILITY_CONFIG_FILE}")
- set_tests_properties(${TEST_CLIENT_ID_UTILITY} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_CLIENT_ID_UTILITY}_masked_511
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY})
- set_property(TEST ${TEST_CLIENT_ID_UTILITY}_masked_511
- APPEND PROPERTY ENVIRONMENT
- "VSOMEIP_CONFIGURATION=${TEST_CLIENT_ID_UTILITY_MASKED_511_CONFIG_FILE}")
- set_tests_properties(${TEST_CLIENT_ID_UTILITY} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_CLIENT_ID_UTILITY}_masked_4095
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY})
- set_property(TEST ${TEST_CLIENT_ID_UTILITY}_masked_4095
- APPEND PROPERTY ENVIRONMENT
- "VSOMEIP_CONFIGURATION=${TEST_CLIENT_ID_UTILITY_MASKED_4095_CONFIG_FILE}")
- set_tests_properties(${TEST_CLIENT_ID_UTILITY} PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_CLIENT_ID_UTILITY}_masked_127
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CLIENT_ID_UTILITY})
- set_property(TEST ${TEST_CLIENT_ID_UTILITY}_masked_127
- APPEND PROPERTY ENVIRONMENT
- "VSOMEIP_CONFIGURATION=${TEST_CLIENT_ID_UTILITY_MASKED_127_CONFIG_FILE}")
- set_tests_properties(${TEST_CLIENT_ID_UTILITY} PROPERTIES TIMEOUT 120)
-
- # subscribe notify tests
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} PREFER_TCP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID)
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_autoconfig_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_DIFF_IDS_DIFF_PORTS_AUTOCONFIG_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_EVENT_TWO_EVENTGROUPS_NAME}_tcp PROPERTIES TIMEOUT 120)
-
- # subscribe notify one id tests
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} TCP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} PREFER_UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} PREFER_TCP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
- # cpu load tests
- add_test(NAME ${TEST_CPU_LOAD_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_CPU_LOAD_MASTER_STARTER}
- )
- set_tests_properties(${TEST_CPU_LOAD_NAME} PROPERTIES TIMEOUT 3000)
-
- # initial event tests
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE})
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_partial_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_same_service_id_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID MULTIPLE_EVENTS)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_prefer_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_prefer_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_prefer_tcp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} PREFER_TCP ${TEST_INITIAL_EVENT_DIFF_IDS_SAME_PORTS_MASTER_TCP_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_same_ports_prefer_tcp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_partial_same_ports_both_tcp_and_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} TCP_AND_UDP ${TEST_INITIAL_EVENT_DIFF_IDS_PARTIAL_SAME_PORTS_MASTER_CONFIG_FILE} MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_partial_same_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120)
-
- add_test(NAME ${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_same_service_id_udp
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_INITIAL_EVENT_MASTER_STARTER} UDP ${TEST_INITIAL_EVENT_DIFF_IDS_DIFF_PORTS_SAME_SERVICEID_MASTER_CONFIG_FILE} SAME_SERVICE_ID MULTIPLE_EVENTS SUBSCRIBE_ON_AVAILABILITY)
- set_tests_properties(${TEST_INITIAL_EVENT_NAME}_multiple_events_subscribe_on_availability_diff_client_ids_diff_ports_same_service_id_udp PROPERTIES TIMEOUT 120)
-
- # offer tests
- add_test(NAME ${TEST_OFFER_NAME}_local
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_LOCAL_STARTER})
- set_tests_properties(${TEST_OFFER_NAME}_local PROPERTIES TIMEOUT 180)
- add_test(NAME ${TEST_OFFER_NAME}_external
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_EXTERNAL_MASTER_STARTER})
- set_tests_properties(${TEST_OFFER_NAME}_local PROPERTIES TIMEOUT 360)
- add_test(NAME ${TEST_OFFER_BIG_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_OFFER_BIG_MASTER_STARTER})
- set_tests_properties(${TEST_OFFER_BIG_NAME} PROPERTIES TIMEOUT 360)
-
- # offered services info tets
- add_test(NAME ${TEST_OFFERED_SERVICES_INFO_NAME}_local
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_OFFERED_SERVICES_INFO_LOCAL_STARTER})
- set_tests_properties(${TEST_OFFERED_SERVICES_INFO_NAME}_local PROPERTIES TIMEOUT 180)
-
- # Restart-Routing tests
- add_test(NAME ${TEST_RESTART_ROUTING_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_RESTART_ROUTING_STARTER}
- )
- if (${TEST_SECURITY})
- # Security tests
- add_test(NAME ${TEST_SECURITY_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SECURITY_SERVICE_START_SCRIPT}
- )
- endif()
-
- # pending subscriptions test
- add_test(NAME ${TEST_PENDING_SUBSCRIPTION_NAME}_subscribe
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} SUBSCRIBE)
- set_tests_properties(${TEST_PENDING_SUBSCRIPTION_NAME}_subscribe PROPERTIES TIMEOUT 180)
-
- add_test(NAME ${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} SUBSCRIBE_UNSUBSCRIBE)
- set_tests_properties(${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe PROPERTIES TIMEOUT 180)
-
- add_test(NAME ${TEST_PENDING_SUBSCRIPTION_NAME}_unsubscribe
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} UNSUBSCRIBE)
- set_tests_properties(${TEST_PENDING_SUBSCRIPTION_NAME}_unsubscribe PROPERTIES TIMEOUT 180)
-
- add_test(NAME ${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe_nack
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} SUBSCRIBE_UNSUBSCRIBE_NACK)
- set_tests_properties(${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe_nack PROPERTIES TIMEOUT 180)
-
- # malicious data test
- add_test(NAME ${TEST_MALICIOUS_DATA_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_MALICIOUS_DATA_MASTER_STARTER})
- set_tests_properties(${TEST_MALICIOUS_DATA_NAME} PROPERTIES TIMEOUT 180)
-else()
- # Routing tests
- add_test(NAME ${TEST_LOCAL_ROUTING_NAME}
- COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_LOCAL_ROUTING_STARTER}
- )
-endif()
diff --git a/test/application_tests/application_test.cpp b/test/application_tests/application_test.cpp
deleted file mode 100644
index 7862528..0000000
--- a/test/application_tests/application_test.cpp
+++ /dev/null
@@ -1,454 +0,0 @@
-// Copyright (C) 2015-2017 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 <thread>
-#include <mutex>
-#include <condition_variable>
-#include <future>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "someip_test_globals.hpp"
-
-using namespace vsomeip;
-
-class someip_application_test: public ::testing::Test {
-public:
- someip_application_test() :
- registered_(false) {
-
- }
-protected:
- void SetUp() {
- app_ = runtime::get()->create_application("application_test");
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
-
- app_->register_state_handler(
- std::bind(&someip_application_test::on_state, this,
- std::placeholders::_1));
- }
-
- void on_state(vsomeip::state_type_e _state) {
- registered_ = (_state == vsomeip::state_type_e::ST_REGISTERED);
- }
-
- bool registered_;
- std::shared_ptr<application> app_;
-};
-
-/**
- * @test Start and stop application
- */
-TEST_F(someip_application_test, start_stop_application)
-{
- std::promise<bool> its_promise;
- std::thread t([&](){
- its_promise.set_value(true);
- app_->start();
- });
- EXPECT_TRUE(its_promise.get_future().get());
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- app_->stop();
- t.join();
-}
-
-/**
- * @test Start and stop application multiple times
- */
-TEST_F(someip_application_test, start_stop_application_multiple)
-{
- for (int i = 0; i < 10; ++i) {
- std::promise<bool> its_promise;
- std::thread t([&]() {
- its_promise.set_value(true);
- app_->start();
- });
- EXPECT_TRUE(its_promise.get_future().get());
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- app_->stop();
- t.join();
- }
-}
-
-/**
- * @test Start and stop application multiple times and offer a service
- */
-TEST_F(someip_application_test, start_stop_application_multiple_offer_service)
-{
- for (int i = 0; i < 10; ++i) {
- std::promise<bool> its_promise;
- std::thread t([&]() {
- its_promise.set_value(true);
- app_->start();
- });
- EXPECT_TRUE(its_promise.get_future().get());
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- app_->stop();
- t.join();
- }
-}
-
-/**
- * @test Try to start an already running application again
- */
-TEST_F(someip_application_test, restart_without_stopping)
-{
- std::promise<bool> its_promise;
- std::thread t([&]() {
- its_promise.set_value(true);
- app_->start();
-
- });
- EXPECT_TRUE(its_promise.get_future().get());
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- VSOMEIP_WARNING << "An error message should appear now";
- // should print error
- app_->start();
- app_->stop();
- t.join();
-}
-
-/**
- * @test Try to stop a running application twice
- */
-TEST_F(someip_application_test, stop_application_twice)
-{
- std::promise<bool> its_promise;
- std::thread t([&]() {
- its_promise.set_value(true);
- app_->start();
-
- });
- EXPECT_TRUE(its_promise.get_future().get());
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
-
- app_->stop();
- t.join();
- app_->stop();
-}
-
-/**
- * @test Checks whether watchdog handler is invoked (regularly) also after restarting.
- */
-TEST_F(someip_application_test, watchdog_handler)
-{
- std::atomic<int> cb_count(0);
- auto wd_handler = [&] () {
- ++cb_count;
- };
-
- app_->set_watchdog_handler(std::cref(wd_handler), std::chrono::seconds(1));
-
- std::promise<bool> its_promise;
- std::thread t([&]() {
- its_promise.set_value(true);
- app_->start();
- });
- EXPECT_TRUE(its_promise.get_future().get());
-
- // wait till watchdog handler has been invoked once
- while (0 == cb_count.load()) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- ASSERT_EQ(1, cb_count.load());
-
- // clear handler (must not be called again)
- app_->set_watchdog_handler(nullptr, std::chrono::seconds::zero());
-
- // wait doubled interval (used previously)..
- std::this_thread::sleep_for(std::chrono::seconds(2));
- // .. to ensure it was not called again
- ASSERT_EQ(1, cb_count.load());
-
- // enable handler again
- app_->set_watchdog_handler(std::cref(wd_handler), std::chrono::seconds(1));
-
- // wait till watchdog handler has been invoked again (2nd time)
- while (1 == cb_count.load()) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
-
- app_->stop();
- t.join();
-
- // wait doubled interval (used previously)..
- std::this_thread::sleep_for(std::chrono::seconds(2));
- // .. to ensure it was not called after stop()
- ASSERT_EQ(2, cb_count.load());
-
- // restart application (w/ watchdog handler still set)
- std::promise<bool> its_promise2;
- std::thread t2([&]() {
- its_promise2.set_value(true);
- app_->start();
- });
- EXPECT_TRUE(its_promise2.get_future().get());
-
- // wait till watchdog handler has been invoked again (3rd time)
- while (2 == cb_count.load()) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- ASSERT_EQ(3, cb_count.load());
-
- // clear handler again (must not be called again), this time via zero interval
- app_->set_watchdog_handler(std::cref(wd_handler), std::chrono::seconds::zero());
-
- // wait doubled interval (used previously)..
- std::this_thread::sleep_for(std::chrono::seconds(2));
- // .. to ensure it was not called again
- ASSERT_EQ(3, cb_count.load());
-
- app_->stop();
- t2.join();
-}
-
-class someip_application_shutdown_test: public ::testing::Test {
-
-protected:
- void SetUp() {
- is_registered_ = false;
- is_available_ = false;
-
- app_ = runtime::get()->create_application("application_test");
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
-
- app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN,
- std::bind(&someip_application_shutdown_test::on_message_shutdown, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&someip_application_shutdown_test::on_state, this,
- std::placeholders::_1));
- app_->register_availability_handler(
- vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- std::bind(&someip_application_shutdown_test::on_availability,
- this, std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
-
- shutdown_thread_ = std::thread(&someip_application_shutdown_test::send_shutdown_message, this);
-
- app_->start();
- }
-
- void TearDown() {
- shutdown_thread_.join();
- app_->stop();
- }
-
- void on_state(vsomeip::state_type_e _state) {
- if(_state == vsomeip::state_type_e::ST_REGISTERED)
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- is_registered_ = true;
- cv_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- (void)_service;
- (void)_instance;
- if(_is_available) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- is_available_ = _is_available;
- cv_.notify_one();
- }
- }
-
- void on_message_shutdown(const std::shared_ptr<message>& _request)
- {
- (void)_request;
- VSOMEIP_INFO << "Shutdown method was called, going down now.";
- app_->clear_all_handler();
- app_->stop();
- }
-
- void send_shutdown_message() {
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while(!is_registered_) {
- cv_.wait(its_lock);
- }
- app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- while(!is_available_) {
- cv_.wait(its_lock);
- }
- }
-
- std::shared_ptr<message> r = runtime::get()->create_request();
- r->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
- r->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- r->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN);
- app_->send(r);
- }
-
- bool is_registered_;
- bool is_available_;
- std::shared_ptr<application> app_;
- std::condition_variable cv_;
- std::mutex mutex_;
- std::thread shutdown_thread_;
-};
-
-class someip_application_exception_test: public ::testing::Test {
-
-protected:
- void SetUp() {
- is_registered_ = false;
- is_available_ = false;
-
- app_ = runtime::get()->create_application("application_test");
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
-
- app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN,
- std::bind(&someip_application_exception_test::on_message_shutdown, this,
- std::placeholders::_1));
- app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN+1,
- std::bind(&someip_application_exception_test::on_message_exception, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&someip_application_exception_test::on_state, this,
- std::placeholders::_1));
- app_->register_availability_handler(
- vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- std::bind(&someip_application_exception_test::on_availability,
- this, std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
-
- shutdown_thread_ = std::thread(&someip_application_exception_test::send_shutdown_message, this);
-
- app_->start();
- }
-
- void TearDown() {
- shutdown_thread_.join();
- app_->stop();
- }
-
- void on_state(vsomeip::state_type_e _state) {
- if(_state == vsomeip::state_type_e::ST_REGISTERED)
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- is_registered_ = true;
- cv_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- (void)_service;
- (void)_instance;
- if(_is_available) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- is_available_ = _is_available;
- cv_.notify_one();
- }
- }
-
- void on_message_shutdown(const std::shared_ptr<message>& _request)
- {
- (void)_request;
- VSOMEIP_INFO << "Shutdown method was called, going down now.";
- app_->clear_all_handler();
- app_->stop();
- }
-
- void on_message_exception(const std::shared_ptr<message>& _request)
- {
- (void)_request;
- throw std::invalid_argument("something went terribly wrong");
- }
-
- void send_shutdown_message() {
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while(!is_registered_) {
- cv_.wait(its_lock);
- }
- app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- while(!is_available_) {
- cv_.wait(its_lock);
- }
- }
-
- std::shared_ptr<message> r = runtime::get()->create_request();
- // call method which throws exception
- r->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
- r->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- r->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN+1);
- app_->send(r);
- std::this_thread::sleep_for(std::chrono::milliseconds(50));
-
-
- //shutdown test
- r->set_service(vsomeip_test::TEST_SERVICE_SERVICE_ID);
- r->set_instance(vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- r->set_method(vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN);
- app_->send(r);
- }
-
- bool is_registered_;
- bool is_available_;
- std::shared_ptr<application> app_;
- std::condition_variable cv_;
- std::mutex mutex_;
- std::thread shutdown_thread_;
-};
-
-/**
- * @test Stop the application through a method invoked from a dispatcher thread
- */
-TEST_F(someip_application_shutdown_test, stop_application_from_dispatcher_thread) {
-
-}
-
-/**
- * @test Catch unhandled exceptions from invoked handlers
- */
-TEST_F(someip_application_exception_test, catch_exception_in_invoked_handler) {
-
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
-
-
-
-
diff --git a/test/application_tests/application_test_availability.cpp b/test/application_tests/application_test_availability.cpp
deleted file mode 100644
index 06fd33e..0000000
--- a/test/application_tests/application_test_availability.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (C) 2014-2017 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 <gtest/gtest.h>
-
-#include "application_test_client_availability.cpp"
-#include "application_test_service.cpp"
-#include "application_test_daemon.cpp"
-
-TEST(someip_application_test_availability, register_availability_handlers)
-{
- // start application acting as daemon
- application_test_daemon its_daemon;
-
- // start receiver service
- application_test_service its_receiver(application_test::service);
-
- // start client
- application_test_client_availability its_client(application_test::service);
- int counter(0);
- while (!its_client.all_availability_handlers_called() && counter < 500) {
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- counter++;
- }
-
- //shutdown
- its_receiver.stop();
- its_client.stop();
- its_daemon.stop();
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/application_tests/application_test_availability_starter.sh b/test/application_tests/application_test_availability_starter.sh
deleted file mode 100755
index 645e347..0000000
--- a/test/application_tests/application_test_availability_starter.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_CONFIGURATION=application_test_single_process.json
-./application_test_availability
-
- exit $? \ No newline at end of file
diff --git a/test/application_tests/application_test_client.cpp b/test/application_tests/application_test_client.cpp
deleted file mode 100644
index 25f7c09..0000000
--- a/test/application_tests/application_test_client.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <future>
-#include <atomic>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "application_test_globals.hpp"
-
-class application_test_client {
-public:
- application_test_client(struct application_test::service_info _service_info) :
- service_info_(_service_info),
- app_(vsomeip::runtime::get()->create_application("client")),
- service_available_(false),
- wait_until_registered_(true),
- wait_until_service_available_(true),
- wait_for_stop_(true),
- received_responses_(0),
- sent_requests_(0),
- stop_called_(false),
- stop_thread_(std::bind(&application_test_client::wait_for_stop, this)),
- send_thread_(std::bind(&application_test_client::send, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&application_test_client::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(&application_test_client::on_message, this,
- std::placeholders::_1));
-
- // register availability for all other services and request their event.
- app_->register_availability_handler(service_info_.service_id,
- service_info_.instance_id,
- std::bind(&application_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->request_service(service_info_.service_id,
- service_info_.instance_id);
- std::promise<bool> its_promise;
- application_thread_ = std::thread([&](){
- its_promise.set_value(true);
- app_->start();
- });
- EXPECT_TRUE(its_promise.get_future().get());
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
-
- ~application_test_client() {
- send_thread_.join();
- stop_thread_.join();
- application_thread_.join();
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- VSOMEIP_INFO << "Service [" << std::setw(4)
- << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is " << (_is_available ? "available":"not available") << ".";
- std::lock_guard<std::mutex> its_lock(mutex_);
- if(_is_available) {
- wait_until_service_available_ = false;
- condition_.notify_one();
- } else {
- wait_until_service_available_ = true;
- condition_.notify_one();
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- ++received_responses_;
- EXPECT_EQ(service_info_.service_id, _message->get_service());
- EXPECT_EQ(service_info_.method_id, _message->get_method());
- EXPECT_EQ(service_info_.instance_id, _message->get_instance());
- VSOMEIP_INFO << "Received a response with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "]";
- }
-
- void send() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_ && !stop_called_) {
- condition_.wait_for(its_lock, std::chrono::milliseconds(100));
- }
-
- while (wait_until_service_available_ && !stop_called_) {
- condition_.wait_for(its_lock, std::chrono::milliseconds(100));
- }
- its_lock.unlock();
- its_lock.release();
-
- for (;;) {
- bool send(false);
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- send = !wait_until_service_available_;
- }
- if (send && !stop_called_) {
- std::shared_ptr<vsomeip::message> its_req = vsomeip::runtime::get()->create_request();
- its_req->set_service(service_info_.service_id);
- its_req->set_instance(service_info_.instance_id);
- its_req->set_method(service_info_.method_id);
- app_->send(its_req);
- ++sent_requests_;
- VSOMEIP_INFO << "Sent a request to the service!";
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- } else {
- std::this_thread::sleep_for(std::chrono::milliseconds(50));
- }
- if(stop_called_) {
- break;
- }
- }
- }
-
- void wait_for_stop() {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
- VSOMEIP_INFO << "going down";
- app_->clear_all_handler();
- app_->stop();
- }
-
- void stop(bool check) {
- stop_called_ = true;
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- VSOMEIP_INFO << "going down. Sent " << sent_requests_
- << " requests and received " << received_responses_
- << " responses. Delta: " << sent_requests_ - received_responses_;
- std::uint32_t counter(0);
- if (check) {
- while(sent_requests_ < received_responses_) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- if(++counter > 50) {
- break;
- }
- }
- EXPECT_EQ(sent_requests_, received_responses_);
- }
- stop_condition_.notify_one();
- }
-
-private:
- struct application_test::service_info service_info_;
- std::shared_ptr<vsomeip::application> app_;
- bool service_available_;
-
- bool wait_until_registered_;
- bool wait_until_service_available_;
- std::mutex mutex_;
- std::condition_variable condition_;
-
- bool wait_for_stop_;
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
-
- std::atomic<std::uint32_t> received_responses_;
- std::atomic<std::uint32_t> sent_requests_;
- std::atomic<bool> stop_called_;
-
- std::thread stop_thread_;
- std::thread send_thread_;
- std::thread application_thread_;
-};
diff --git a/test/application_tests/application_test_client_availability.cpp b/test/application_tests/application_test_client_availability.cpp
deleted file mode 100644
index 5148d58..0000000
--- a/test/application_tests/application_test_client_availability.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <future>
-#include <atomic>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "application_test_globals.hpp"
-
-class application_test_client_availability {
-public:
- application_test_client_availability(struct application_test::service_info _service_info) :
- service_info_(_service_info),
- app_(vsomeip::runtime::get()->create_application("client")),
- wait_until_registered_(true),
- all_availability_handlers_called_(false),
- run_thread_(std::bind(&application_test_client_availability::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&application_test_client_availability::on_state, this,
- std::placeholders::_1));
-
- // register availability handler for every possiblity of
- // ANY_SERVICE, ANY_INSTANCE, ANY_MAJOR, ANY_MINOR
- for (std::uint32_t i = 0; i < 16; i++) {
- vsomeip::service_t its_service = (i & 0x8) ? service_info_.service_id : vsomeip::ANY_SERVICE;
- vsomeip::instance_t its_instance = (i & 0x4) ? service_info_.instance_id : vsomeip::ANY_INSTANCE;
- vsomeip::major_version_t its_major = (i & 0x2) ? service_info_.major_version : vsomeip::ANY_MAJOR;
- vsomeip::minor_version_t its_minor = (i & 0x1) ? service_info_.minor_version : vsomeip::ANY_MINOR;
- app_->register_availability_handler(its_service,
- its_instance,
- std::bind(&application_test_client_availability::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3, i),
- its_major, its_minor);
- VSOMEIP_DEBUG << "Registering: "
- << std::setw(4) << std::setfill('0') << std::hex << its_service << "."
- << std::setw(4) << std::setfill('0') << std::hex << its_instance << "."
- << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)its_major << "."
- << std::setw(4) << std::setfill('0') << std::hex << its_minor << "."
- << i;
-
- }
- app_->register_availability_handler(service_info_.service_id,
- service_info_.instance_id,
- std::bind(&application_test_client_availability::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3, 16),
- service_info_.major_version, vsomeip::DEFAULT_MINOR);
- VSOMEIP_DEBUG << "Registering: "
- << std::setw(4) << std::setfill('0') << std::hex << service_info_.service_id << "."
- << std::setw(4) << std::setfill('0') << std::hex << service_info_.instance_id << "."
- << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)service_info_.service_id << "."
- << std::setw(4) << std::setfill('0') << std::hex << vsomeip::DEFAULT_MINOR << "."
- << 16;
- app_->request_service(service_info_.service_id,
- service_info_.instance_id);
- std::promise<bool> its_promise;
- application_thread_ = std::thread([&](){
- its_promise.set_value(true);
- app_->start();
- });
- EXPECT_TRUE(its_promise.get_future().get());
- }
-
- ~application_test_client_availability() {
- run_thread_.join();
- application_thread_.join();
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available,
- std::uint32_t _handler_index)
- {
- VSOMEIP_DEBUG<< "Service [" << std::setw(4) << std::setfill('0') << std::hex
- << _service << "." << std::setw(4) << std::setfill('0') << _instance << "] is "
- << (_is_available ? "available." : "NOT available.") << ". "
- << _handler_index;
- if(service_info_.service_id == _service
- && service_info_.instance_id == _instance) {
- std::lock_guard<std::mutex> its_lock(availability_handler_called_mutex_);
- availability_handler_called_[_handler_index] = _is_available;
- availability_condition_.notify_one();
- }
- }
-
- void run() {
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
- }
- while(!app_->is_available(service_info_.service_id,
- service_info_.instance_id, service_info_.major_version,
- service_info_.minor_version)) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- for (std::uint32_t i = 0; i < 16; i++) {
- vsomeip::service_t its_service = (i & 0x8) ? service_info_.service_id : vsomeip::ANY_SERVICE;
- vsomeip::instance_t its_instance = (i & 0x4) ? service_info_.instance_id : vsomeip::ANY_INSTANCE;
- vsomeip::major_version_t its_major = (i & 0x2) ? service_info_.major_version : vsomeip::ANY_MAJOR;
- vsomeip::minor_version_t its_minor = (i & 0x1) ? service_info_.minor_version : vsomeip::ANY_MINOR;
-
- VSOMEIP_DEBUG << "Calling is_available: "
- << std::setw(4) << std::setfill('0') << std::hex << its_service << "."
- << std::setw(4) << std::setfill('0') << std::hex << its_instance << "."
- << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)its_major << "."
- << std::setw(4) << std::setfill('0') << std::hex << its_minor;
- EXPECT_TRUE(app_->is_available(its_service, its_instance, its_major, its_minor));
-
- VSOMEIP_DEBUG << "Calling are_available: "
- << std::setw(4) << std::setfill('0') << std::hex << its_service << "."
- << std::setw(4) << std::setfill('0') << std::hex << its_instance << "."
- << std::setw(2) << std::setfill('0') << std::hex << (std::uint32_t)its_major << "."
- << std::setw(4) << std::setfill('0') << std::hex << its_minor;
- vsomeip::application::available_t are_available;
- EXPECT_TRUE(app_->are_available(are_available, its_service, its_instance, its_major, its_minor));
- bool found(false);
- auto found_service = are_available.find(service_info_.service_id);
- if(found_service != are_available.end()) {
- auto found_instance = found_service->second.find(service_info_.instance_id);
- if(found_instance != found_service->second.end()) {
- auto found_major = found_instance->second.find(service_info_.major_version);
- if (found_major != found_instance->second.end()) {
- if (found_major->second == service_info_.minor_version) {
- found = true;
- }
- }
- }
- }
- EXPECT_TRUE(found);
-
- }
- {
- std::unique_lock<std::mutex> its_lock(availability_handler_called_mutex_);
- while(!std::all_of(availability_handler_called_.cbegin(),
- availability_handler_called_.cend(),
- [&](const availability_handler_called_t::value_type &v) {
- return v;
- })) {
- availability_condition_.wait(its_lock);
- }
- }
- VSOMEIP_INFO <<" Everything is available";
- all_availability_handlers_called_ = true;
- }
-
- void stop() {
- VSOMEIP_INFO << "going down";
- app_->clear_all_handler();
- app_->stop();
- }
-
- bool all_availability_handlers_called() const {
- return all_availability_handlers_called_;
- }
-
-private:
- struct application_test::service_info service_info_;
- std::shared_ptr<vsomeip::application> app_;
- std::mutex availability_handler_called_mutex_;
- std::condition_variable availability_condition_;
- typedef std::array<bool, 17> availability_handler_called_t;
- availability_handler_called_t availability_handler_called_;
-
-
- bool wait_until_registered_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::atomic<bool> all_availability_handlers_called_;
- std::thread run_thread_;
- std::thread application_thread_;
-};
diff --git a/test/application_tests/application_test_daemon.cpp b/test/application_tests/application_test_daemon.cpp
deleted file mode 100644
index 43876ea..0000000
--- a/test/application_tests/application_test_daemon.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (C) 2014-2017 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 <gtest/gtest.h>
-#include <future>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-class application_test_daemon {
-public:
- application_test_daemon() :
- app_(vsomeip::runtime::get()->create_application("daemon")) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- std::promise<bool> its_promise;
- application_thread_ = std::thread([&](){
- its_promise.set_value(true);
- app_->start();
- });
- EXPECT_TRUE(its_promise.get_future().get());
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- VSOMEIP_INFO << "Daemon starting";
- }
-
- ~application_test_daemon() {
- application_thread_.join();
- }
-
- void stop() {
- VSOMEIP_INFO << "Daemon stopping";
- app_->stop();
- }
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- std::thread application_thread_;
-};
diff --git a/test/application_tests/application_test_globals.hpp b/test/application_tests/application_test_globals.hpp
deleted file mode 100644
index 7caa9db..0000000
--- a/test/application_tests/application_test_globals.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2014-2017 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 APPLICATION_TEST_GLOBALS_HPP_
-#define APPLICATION_TEST_GLOBALS_HPP_
-
-namespace application_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
- vsomeip::event_t event_id;
- vsomeip::eventgroup_t eventgroup_id;
- vsomeip::method_t shutdown_method_id;
- vsomeip::major_version_t major_version;
- vsomeip::minor_version_t minor_version;
-};
-
-
-struct service_info service = { 0x1111, 0x1, 0x1111, 0x1111, 0x1000, 0x1404, 0x2, 0x4711 };
-
-static constexpr int number_of_messages_to_send = 150;
-}
-
-#endif /* APPLICATION_TEST_GLOBALS_HPP_ */
diff --git a/test/application_tests/application_test_service.cpp b/test/application_tests/application_test_service.cpp
deleted file mode 100644
index 0064fd3..0000000
--- a/test/application_tests/application_test_service.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <future>
-#include <atomic>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "application_test_globals.hpp"
-
-class application_test_service {
-public:
- application_test_service(struct application_test::service_info _service_info) :
- service_info_(_service_info),
- // service with number 1 uses "vsomeipd" as application name
- // this way the same json file can be reused for all local tests
- // including the ones with vsomeipd
- app_(vsomeip::runtime::get()->create_application("service")),
- counter_(0),
- wait_until_registered_(true),
- stop_called_(false),
- offer_thread_(std::bind(&application_test_service::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&application_test_service::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.method_id,
- std::bind(&application_test_service::on_request, this,
- std::placeholders::_1));
-
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.shutdown_method_id,
- std::bind(&application_test_service::on_shutdown_method_called, this,
- std::placeholders::_1));
- std::promise<bool> its_promise;
- application_thread_ = std::thread([&](){
- its_promise.set_value(true);
- app_->start();
- });
- EXPECT_TRUE(its_promise.get_future().get());
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
-
- ~application_test_service() {
- offer_thread_.join();
- application_thread_.join();
- }
-
-
- void offer() {
- app_->offer_service(service_info_.service_id, service_info_.instance_id,
- service_info_.major_version, service_info_.minor_version);
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_request(const std::shared_ptr<vsomeip::message> &_message) {
- app_->send(vsomeip::runtime::get()->create_response(_message));
- VSOMEIP_INFO << "Received a request with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "]";
- }
-
- void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
- (void)_message;
- stop();
- }
-
- void stop() {
- stop_called_ = true;
- app_->stop_offer_service(service_info_.service_id, service_info_.instance_id,
- service_info_.major_version, service_info_.minor_version);
- app_->clear_all_handler();
- app_->stop();
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_ && !stop_called_) {
- condition_.wait_for(its_lock, std::chrono::milliseconds(100));
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
- }
-
-private:
- struct application_test::service_info service_info_;
- std::shared_ptr<vsomeip::application> app_;
- std::uint32_t counter_;
-
- bool wait_until_registered_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::atomic<bool> stop_called_;
- std::thread offer_thread_;
- std::thread application_thread_;
-};
diff --git a/test/application_tests/application_test_single_process.cpp b/test/application_tests/application_test_single_process.cpp
deleted file mode 100644
index 1d0d4a0..0000000
--- a/test/application_tests/application_test_single_process.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2014-2017 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 <gtest/gtest.h>
-#include "application_test_service.cpp"
-#include "application_test_client.cpp"
-#include "application_test_daemon.cpp"
-
-TEST(someip_application_test_single_process, notify_increasing_counter)
-{
- // start application acting as daemon (rm_stub)
- application_test_daemon its_daemon;
-
- // start receiver service (rm_proxy)
- application_test_service its_receiver(application_test::service);
-
- // stop the daemon (rm_stub goes away)
- its_daemon.stop();
-
- // restart client which tries to communicate with service multiple times
- // thus it will always be the new routing manager
- for (int var = 0; var < 10; ++var) {
- // every time the client is restarted it becomes the rm_stub again
- application_test_client its_client(application_test::service);
- if(var != 9) {
- its_client.stop(false);
- } else {
- // for the last iteration we sleep to make sure the communication
- // between the client and the service can be established
- std::this_thread::sleep_for(std::chrono::milliseconds(2000));
- its_client.stop(true);
- }
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- its_receiver.on_shutdown_method_called(vsomeip::runtime::get()->create_message());
-}
-
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/application_tests/application_test_single_process.json b/test/application_tests/application_test_single_process.json
deleted file mode 100644
index b604d9a..0000000
--- a/test/application_tests/application_test_single_process.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/someip.log"
- },
- "dlt":"false"
- }
-}
diff --git a/test/application_tests/application_test_single_process_starter.sh b/test/application_tests/application_test_single_process_starter.sh
deleted file mode 100755
index 3919358..0000000
--- a/test/application_tests/application_test_single_process_starter.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-FAIL=0
-
-export VSOMEIP_CONFIGURATION=application_test_single_process.json
-./application_test_single_process
-
-if [ $? -ne 0 ]
-then
- ((FAIL+=1))
-fi
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/application_tests/application_test_starter.sh b/test/application_tests/application_test_starter.sh
deleted file mode 100755
index 3efc1b4..0000000
--- a/test/application_tests/application_test_starter.sh
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-FAIL=0
-
-export VSOMEIP_CONFIGURATION=application_test_no_dispatch_threads.json
-./application_test
-
-if [ $? -ne 0 ]
-then
- ((FAIL+=1))
-fi
-
-export VSOMEIP_CONFIGURATION=application_test.json
-./application_test
-
-if [ $? -ne 0 ]
-then
- ((FAIL+=1))
-fi
-
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Now running same tests with vsomeipd
-*******************************************************************************
-*******************************************************************************
-End-of-message
-export VSOMEIP_CONFIGURATION=application_test_no_dispatch_threads_daemon.json
-../daemon/./vsomeipd &
-DAEMON_PID=$!
-./application_test
-if [ $? -ne 0 ]
-then
- ((FAIL+=1))
-fi
-
-kill $DAEMON_PID
-wait $DAEMON_PID
-
-export VSOMEIP_CONFIGURATION=application_test_daemon.json
-../daemon/./vsomeipd &
-DAEMON_PID=$!
-./application_test
-if [ $? -ne 0 ]
-then
- ((FAIL+=1))
-fi
-
-kill $DAEMON_PID
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/application_tests/conf/application_test.json.in b/test/application_tests/conf/application_test.json.in
deleted file mode 100644
index ed5a7fc..0000000
--- a/test/application_tests/conf/application_test.json.in
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/someip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"application_test",
- "id":"0x7788",
- "num_dispatchers":"5"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x5678",
- "reliable":"30503"
- }
- ],
- "routing":"application_test",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/application_tests/conf/application_test_daemon.json.in b/test/application_tests/conf/application_test_daemon.json.in
deleted file mode 100644
index c84adf5..0000000
--- a/test/application_tests/conf/application_test_daemon.json.in
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/someip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"application_test",
- "id":"0x7788",
- "num_dispatchers":"5"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x5678",
- "reliable":"30503"
- }
- ],
- "routing":"vsomeipd",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/application_tests/conf/application_test_no_dispatch_threads.json.in b/test/application_tests/conf/application_test_no_dispatch_threads.json.in
deleted file mode 100644
index 20d0ebd..0000000
--- a/test/application_tests/conf/application_test_no_dispatch_threads.json.in
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/someip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"application_test",
- "id":"0x7788"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x5678",
- "reliable":"30503"
- }
- ],
- "routing":"application_test",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in b/test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in
deleted file mode 100644
index 8dec80e..0000000
--- a/test/application_tests/conf/application_test_no_dispatch_threads_daemon.json.in
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/someip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"application_test",
- "id":"0x7788"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x5678",
- "reliable":"30503"
- }
- ],
- "routing":"vsomeipd",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/big_payload_tests/big_payload_test_client.cpp b/test/big_payload_tests/big_payload_test_client.cpp
deleted file mode 100644
index 9b50e79..0000000
--- a/test/big_payload_tests/big_payload_test_client.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-// Copyright (C) 2015-2017 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 "big_payload_test_client.hpp"
-#include "big_payload_test_globals.hpp"
-
-big_payload_test_client::big_payload_test_client(
- bool _use_tcp, big_payload_test::test_mode _test_mode) :
- app_(vsomeip::runtime::get()->create_application("big_payload_test_client")),
- request_(vsomeip::runtime::get()->create_request(_use_tcp)),
- running_(true),
- blocked_(false),
- is_available_(false),
- test_mode_(_test_mode),
- number_of_messages_to_send_(
- test_mode_ == big_payload_test::test_mode::RANDOM ?
- big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES_RANDOM :
- big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES),
- number_of_sent_messages_(0),
- number_of_acknowledged_messages_(0),
- sender_(std::bind(&big_payload_test_client::run, this)) {
- switch (test_mode_) {
- case big_payload_test::test_mode::RANDOM:
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_RANDOM;
- break;
- case big_payload_test::test_mode::LIMITED:
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_LIMITED;
- break;
- case big_payload_test::test_mode::LIMITED_GENERAL:
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_LIMITED_GENERAL;
- break;
- case big_payload_test::test_mode::QUEUE_LIMITED_GENERAL:
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_GENERAL;
- break;
- case big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC:
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_SPECIFIC;
- break;
- default:
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID;
- break;
- }
-}
-
-bool big_payload_test_client::init()
-{
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
-
- app_->register_state_handler(
- std::bind(&big_payload_test_client::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(&big_payload_test_client::on_message, this,
- std::placeholders::_1));
-
- app_->register_availability_handler(service_id_,
- big_payload_test::TEST_SERVICE_INSTANCE_ID,
- std::bind(&big_payload_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- return true;
-}
-
-void big_payload_test_client::start()
-{
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void big_payload_test_client::stop()
-{
- VSOMEIP_INFO << "Stopping...";
- if (test_mode_ == big_payload_test::test_mode::LIMITED
- || test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- std::this_thread::sleep_for(std::chrono::milliseconds(3000));
- ASSERT_EQ(number_of_acknowledged_messages_, number_of_messages_to_send_ / 4);
- }
- app_->clear_all_handler();
- app_->stop();
-}
-
-void big_payload_test_client::join_sender_thread(){
- sender_.join();
- if (test_mode_ == big_payload_test::test_mode::LIMITED
- || test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- ASSERT_EQ(number_of_acknowledged_messages_, number_of_messages_to_send_ / 4);
- } else {
- ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_);
- }
-}
-
-void big_payload_test_client::on_state(vsomeip::state_type_e _state)
-{
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- app_->request_service(service_id_,
- big_payload_test::TEST_SERVICE_INSTANCE_ID, false);
- }
-}
-
-void big_payload_test_client::on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available)
-{
- VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0') << std::hex
- << _service << "." << _instance << "] is "
- << (_is_available ? "available." : "NOT available.");
-
- if(service_id_ == _service
- && big_payload_test::TEST_SERVICE_INSTANCE_ID == _instance)
- {
- if(is_available_ && !_is_available)
- {
- is_available_ = false;
- }
- else if(_is_available && !is_available_)
- {
- is_available_ = true;
- send();
- }
- }
-}
-
-void big_payload_test_client::on_message(const std::shared_ptr<vsomeip::message>& _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()
- << "] size: " << std::dec << _response->get_payload()->get_length();
- static vsomeip::session_t last_session(0);
- ASSERT_GT(_response->get_session(), last_session);
- last_session = _response->get_session();
-
- if(test_mode_ == big_payload_test::test_mode::RANDOM) {
- ASSERT_LT(_response->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE_RANDOM);
- } else {
- ASSERT_EQ(_response->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE);
- }
-
- bool check(true);
- vsomeip::length_t len = _response->get_payload()->get_length();
- vsomeip::byte_t* datap = _response->get_payload()->get_data();
- for(unsigned int i = 0; i < len; ++i) {
- check = check && datap[i] == big_payload_test::DATA_SERVICE_TO_CLIENT;
- }
- if(!check) {
- GTEST_FATAL_FAILURE_("wrong data transmitted");
- }
- number_of_acknowledged_messages_++;
- if (test_mode_ == big_payload_test::test_mode::LIMITED
- || test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- if (number_of_acknowledged_messages_ == number_of_messages_to_send_ / 4) {
- send();
- }
- } else if ( number_of_acknowledged_messages_ == number_of_messages_to_send_) {
- send();
- }
-}
-
-void big_payload_test_client::send()
-{
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
-}
-
-void big_payload_test_client::run()
-{
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- {
- condition_.wait(its_lock);
- }
- blocked_ = false;
-
- request_->set_service(service_id_);
- request_->set_instance(big_payload_test::TEST_SERVICE_INSTANCE_ID);
- request_->set_method(big_payload_test::TEST_SERVICE_METHOD_ID);
-
- std::srand(static_cast<unsigned int>(std::time(0)));
-
- std::shared_ptr<vsomeip::payload> its_payload =
- vsomeip::runtime::get()->create_payload();
- std::vector<vsomeip::byte_t> its_payload_data;
-
- for (unsigned int i = 0; i < number_of_messages_to_send_; i++)
- {
- if (test_mode_ == big_payload_test::test_mode::RANDOM) {
- unsigned int datasize(std::rand() % big_payload_test::BIG_PAYLOAD_SIZE_RANDOM);
- its_payload_data.assign(datasize, big_payload_test::DATA_CLIENT_TO_SERVICE);
- } else if (test_mode_ == big_payload_test::test_mode::LIMITED
- || test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- if (i % 2) {
- // try to sent a too big payload for half of the messages
- its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE + 3,
- big_payload_test::DATA_CLIENT_TO_SERVICE);
- } else {
- its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE,
- big_payload_test::DATA_CLIENT_TO_SERVICE);
- }
- } else {
- its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE,
- big_payload_test::DATA_CLIENT_TO_SERVICE);
- }
- its_payload->set_data(its_payload_data);
- request_->set_payload(its_payload);
- app_->send(request_, true);
- if (test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- std::this_thread::sleep_for(std::chrono::milliseconds(1000));
- }
- VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0')
- << std::hex << request_->get_client() << "/" << std::setw(4)
- << std::setfill('0') << std::hex << request_->get_session()
- << "] sent a request to Service [" << std::setw(4)
- << std::setfill('0') << std::hex << request_->get_service()
- << "." << std::setw(4) << std::setfill('0') << std::hex
- << request_->get_instance() << "] size: " << std::dec <<
- request_->get_payload()->get_length();
- number_of_sent_messages_++;
- }
- while(!blocked_) {
- if (std::cv_status::timeout
- == condition_.wait_for(its_lock, std::chrono::seconds(120))) {
- GTEST_FATAL_FAILURE_("Didn't receive all replies within time");
- } else {
- if (test_mode_ == big_payload_test::LIMITED
- || test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- ASSERT_EQ(number_of_messages_to_send_ / 4,
- number_of_acknowledged_messages_);
- } else {
- ASSERT_EQ(number_of_sent_messages_,
- number_of_acknowledged_messages_);
- }
- }
- }
- stop();
-}
-
-static big_payload_test::test_mode test_mode(big_payload_test::test_mode::UNKNOWN);
-
-TEST(someip_big_payload_test, send_ten_messages_to_service)
-{
- bool use_tcp = true;
- big_payload_test_client test_client_(use_tcp, test_mode);
- if (test_client_.init()) {
- test_client_.start();
- test_client_.join_sender_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if (argc > 1) {
- if (std::string("RANDOM") == std::string(argv[1])) {
- test_mode = big_payload_test::test_mode::RANDOM;
- } else if (std::string("LIMITED") == std::string(argv[1])) {
- test_mode = big_payload_test::test_mode::LIMITED;
- } else if (std::string("LIMITEDGENERAL") == std::string(argv[1])) {
- test_mode = big_payload_test::test_mode::LIMITED_GENERAL;
- } else if (std::string("QUEUELIMITEDGENERAL") == std::string(argv[1])) {
- test_mode = big_payload_test::test_mode::QUEUE_LIMITED_GENERAL;
- } else if (std::string("QUEUELIMITEDSPECIFIC") == std::string(argv[1])) {
- test_mode = big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC;
- }
- }
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/big_payload_tests/big_payload_test_client.hpp b/test/big_payload_tests/big_payload_test_client.hpp
deleted file mode 100644
index fb03a8e..0000000
--- a/test/big_payload_tests/big_payload_test_client.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (C) 2015-2017 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 BIGPAYLOADTESTCLIENT_HPP_
-#define BIGPAYLOADTESTCLIENT_HPP_
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-#include <atomic>
-
-#include "big_payload_test_globals.hpp"
-#include "../../implementation/logging/include/logger.hpp"
-
-class big_payload_test_client
-{
-public:
- big_payload_test_client(bool _use_tcp, big_payload_test::test_mode _random_mode);
- bool init();
- void start();
- void stop();
- void join_sender_thread();
- 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<vsomeip::message> &_response);
- void send();
- void run();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- std::shared_ptr<vsomeip::message> request_;
- std::mutex mutex_;
- std::condition_variable condition_;
- bool running_;
- bool blocked_;
- bool is_available_;
- big_payload_test::test_mode test_mode_;
- std::uint32_t number_of_messages_to_send_;
- std::uint32_t number_of_sent_messages_;
- std::atomic<std::uint32_t> number_of_acknowledged_messages_;
- std::thread sender_;
- vsomeip::service_t service_id_;
-};
-
-#endif /* BIGPAYLOADTESTCLIENT_HPP_ */
diff --git a/test/big_payload_tests/big_payload_test_client_local_start.sh b/test/big_payload_tests/big_payload_test_client_local_start.sh
deleted file mode 100755
index adbf9f4..0000000
--- a/test/big_payload_tests/big_payload_test_client_local_start.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-# Start the client
-export VSOMEIP_APPLICATION_NAME=big_payload_test_client
-export VSOMEIP_CONFIGURATION=big_payload_test_local.json
-./big_payload_test_client
diff --git a/test/big_payload_tests/big_payload_test_client_start.sh b/test/big_payload_tests/big_payload_test_client_start.sh
deleted file mode 100755
index 5258ce8..0000000
--- a/test/big_payload_tests/big_payload_test_client_start.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-# Start the client
-export VSOMEIP_APPLICATION_NAME=big_payload_test_client
-export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client.json
-./big_payload_test_client
diff --git a/test/big_payload_tests/big_payload_test_external_starter.sh b/test/big_payload_tests/big_payload_test_external_starter.sh
deleted file mode 100755
index 6c04a3d..0000000
--- a/test/big_payload_tests/big_payload_test_external_starter.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit successfully.
-
-if [[ $# -gt 0 && $1 != "RANDOM" && $1 != "LIMITED" && $1 != "LIMITEDGENERAL" && $1 != "QUEUELIMITEDGENERAL" && $1 != "QUEUELIMITEDSPECIFIC" ]]
-then
- echo "The only allowed parameter to this script is RANDOM or LIMITED or LIMITEDGENERAL."
- echo "Like $0 RANDOM"
- exit 1
-fi
-
-FAIL=0
-
-# Start the client
-if [[ $# -gt 0 && $1 == "RANDOM" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client_random.json
-elif [[ $# -gt 0 && $1 == "LIMITEDGENERAL" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client_limited_general.json
-elif [[ $# -gt 0 && $1 == "QUEUELIMITEDGENERAL" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client_queue_limited_general.json
-elif [[ $# -gt 0 && $1 == "QUEUELIMITEDSPECIFIC" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client_queue_limited_specific.json
-else
- export VSOMEIP_CONFIGURATION=big_payload_test_tcp_client.json
-fi
-./big_payload_test_client $1 &
-BIG_PAYLOAD_TEST_PID=$!
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting big payload test on slave LXC"
- if [[ $# -gt 0 ]]; then
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./big_payload_test_service_external_start.sh $1\"" &
- else
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP 'bash -ci "set -m; cd \$SANDBOX_TARGET_DIR/vsomeip/test; ./big_payload_test_service_external_start.sh"' &
- fi
-elif [ ! -z "$USE_DOCKER" ]; then
- if [[ $# -gt 0 ]]; then
- docker run --name bpts --cap-add=NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./big_payload_test_service_external_start.sh $1" &
- else
- docker run --name bpts --cap-add=NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./big_payload_test_service_external_start.sh" &
- fi
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** big_payload_test_service_external_start.sh $1
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** big_payload_test_tcp_service.json and
-** big_payload_test_tcp_client.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# Wait until client and service are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker wait bpts
- docker rm bpts
-fi
-
-# Check if client and server both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/big_payload_tests/big_payload_test_globals.hpp b/test/big_payload_tests/big_payload_test_globals.hpp
deleted file mode 100644
index 5488259..0000000
--- a/test/big_payload_tests/big_payload_test_globals.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2015-2017 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 BIG_PAYLOAD_TEST_GLOBALS_HPP_
-#define BIG_PAYLOAD_TEST_GLOBALS_HPP_
-
-#include <cstdint>
-
-namespace big_payload_test {
- constexpr std::uint32_t BIG_PAYLOAD_SIZE = 1024*600;
- constexpr std::uint32_t BIG_PAYLOAD_SIZE_RANDOM = 1024*1024*10;
- constexpr vsomeip::byte_t DATA_SERVICE_TO_CLIENT = 0xAA;
- constexpr vsomeip::byte_t DATA_CLIENT_TO_SERVICE = 0xFF;
-
- constexpr std::uint32_t BIG_PAYLOAD_TEST_NUMBER_MESSAGES = 10;
- constexpr std::uint32_t BIG_PAYLOAD_TEST_NUMBER_MESSAGES_RANDOM = 50;
-
- constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID = 0x1234;
- constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_LIMITED = 0x1235;
- constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_RANDOM = 0x1236;
- constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_LIMITED_GENERAL = 0x1237;
- constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_GENERAL = 0x1238;
- constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_SPECIFIC = 0x1239;
-
- constexpr vsomeip::service_t TEST_SERVICE_INSTANCE_ID = 0x1;
- constexpr vsomeip::method_t TEST_SERVICE_METHOD_ID = 0x8421;
-
- enum test_mode {
- RANDOM,
- LIMITED,
- LIMITED_GENERAL,
- QUEUE_LIMITED_GENERAL,
- QUEUE_LIMITED_SPECIFIC,
- UNKNOWN
- };
-}
-
-#endif /* BIG_PAYLOAD_TEST_GLOBALS_HPP_ */
diff --git a/test/big_payload_tests/big_payload_test_local.json b/test/big_payload_tests/big_payload_test_local.json
deleted file mode 100644
index aa7b3ea..0000000
--- a/test/big_payload_tests/big_payload_test_local.json
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"debug",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"big_payload_test_service",
- "id":"0x1277"
- },
- {
- "name":"big_payload_test_client",
- "id":"0x1344"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x5678"
- }
- ],
- "payload-sizes":
- [
- {
- "unicast":"127.0.0.1",
- "ports":
- [
- {
- "port":"30509",
- "max-payload-size":"614400"
- }
- ]
- }
- ],
- "routing":"big_payload_test_service",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
-
diff --git a/test/big_payload_tests/big_payload_test_local_limited.json b/test/big_payload_tests/big_payload_test_local_limited.json
deleted file mode 100644
index a711df1..0000000
--- a/test/big_payload_tests/big_payload_test_local_limited.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"error",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"big_payload_test_service",
- "id":"0x1277"
- },
- {
- "name":"big_payload_test_client",
- "id":"0x1344"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x5678"
- }
- ],
- "max-payload-size-local" : "614400",
- "routing":"big_payload_test_service",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
-
diff --git a/test/big_payload_tests/big_payload_test_local_queue_limited.json b/test/big_payload_tests/big_payload_test_local_queue_limited.json
deleted file mode 100644
index 7252680..0000000
--- a/test/big_payload_tests/big_payload_test_local_queue_limited.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"error",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"big_payload_test_service",
- "id":"0x1277"
- },
- {
- "name":"big_payload_test_client",
- "id":"0x1344"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x5678"
- }
- ],
- "endpoint-queue-limit-local" : "614428",
- "routing":"big_payload_test_service",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
-
diff --git a/test/big_payload_tests/big_payload_test_local_random.json b/test/big_payload_tests/big_payload_test_local_random.json
deleted file mode 100644
index b49683e..0000000
--- a/test/big_payload_tests/big_payload_test_local_random.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"debug",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"big_payload_test_service",
- "id":"0x1277",
- "max_dispatch_time" : "5000"
- },
- {
- "name":"big_payload_test_client",
- "id":"0x1344",
- "max_dispatch_time" : "5000"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x5678"
- }
- ],
- "buffer-shrink-threshold" : "2",
- "routing":"big_payload_test_service",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
-
diff --git a/test/big_payload_tests/big_payload_test_local_starter.sh b/test/big_payload_tests/big_payload_test_local_starter.sh
deleted file mode 100755
index 6439cac..0000000
--- a/test/big_payload_tests/big_payload_test_local_starter.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit successfully.
-
-if [[ $# -gt 0 && $1 != "RANDOM" && $1 != "LIMITED" && $1 != "QUEUELIMITEDGENERAL" ]]
-then
- echo "The only allowed parameter to this script is RANDOM or LIMITED or QUEUELIMITEDGENERAL."
- echo "Like $0 RANDOM"
- exit 1
-fi
-
-
-FAIL=0
-
-# Start the service
-if [[ $# -gt 0 && $1 == "RANDOM" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_local_random.json
-elif [[ $# -gt 0 && $1 == "LIMITED" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_local_limited.json
-elif [[ $# -gt 0 && $1 == "QUEUELIMITEDGENERAL" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_local_queue_limited.json
-else
- export VSOMEIP_CONFIGURATION=big_payload_test_local.json
-fi
-./big_payload_test_service $1 &
-
-# Start the client
-./big_payload_test_client $1 &
-
-# Wait until client and service are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-# Check if client and server both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/big_payload_tests/big_payload_test_service.cpp b/test/big_payload_tests/big_payload_test_service.cpp
deleted file mode 100644
index 4031550..0000000
--- a/test/big_payload_tests/big_payload_test_service.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-// Copyright (C) 2015-2017 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 "big_payload_test_service.hpp"
-
-#include "big_payload_test_globals.hpp"
-
-big_payload_test_service::big_payload_test_service(big_payload_test::test_mode _test_mode) :
- app_(vsomeip::runtime::get()->create_application("big_payload_test_service")),
- is_registered_(false),
- blocked_(false),
- test_mode_(_test_mode),
- number_of_received_messages_(0),
- offer_thread_(std::bind(&big_payload_test_service::run, this))
-{
- switch (test_mode_) {
- case big_payload_test::test_mode::RANDOM:
- expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES_RANDOM;
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_RANDOM;
- break;
- case big_payload_test::test_mode::LIMITED:
- expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES / 2;
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_LIMITED;
- break;
- case big_payload_test::test_mode::LIMITED_GENERAL:
- expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES / 2;
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_LIMITED_GENERAL;
- break;
- case big_payload_test::test_mode::QUEUE_LIMITED_GENERAL:
- expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES / 2;
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_GENERAL;
- break;
- case big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC:
- expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES / 2;
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID_QUEUE_LIMITED_SPECIFIC;
- break;
- default:
- expected_messages_ = big_payload_test::BIG_PAYLOAD_TEST_NUMBER_MESSAGES;
- service_id_ = big_payload_test::TEST_SERVICE_SERVICE_ID;
- break;
- }
-}
-
-bool big_payload_test_service::init()
-{
- std::lock_guard<std::mutex> its_lock(mutex_);
- std::srand(static_cast<unsigned int>(std::time(0)));
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- big_payload_test::TEST_SERVICE_INSTANCE_ID,
- big_payload_test::TEST_SERVICE_METHOD_ID,
- std::bind(&big_payload_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&big_payload_test_service::on_state, this,
- std::placeholders::_1));
- return true;
-}
-
-void big_payload_test_service::start()
-{
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void big_payload_test_service::stop()
-{
- VSOMEIP_INFO << "Stopping...";
- stop_offer();
- app_->clear_all_handler();
- app_->stop();
-}
-
-void big_payload_test_service::join_offer_thread()
-{
- offer_thread_.join();
-}
-
-void big_payload_test_service::offer() {
- app_->offer_service(service_id_,
- big_payload_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void big_payload_test_service::stop_offer() {
- app_->stop_offer_service(service_id_,
- big_payload_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void big_payload_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<std::mutex> its_lock(mutex_);
- blocked_ = true;
- // "start" the run method thread
- condition_.notify_one();
- }
- }
- else
- {
- is_registered_ = false;
- }
-}
-
-void big_payload_test_service::on_message(const std::shared_ptr<vsomeip::message>& _request)
-{
- 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() << "] size: " << std::dec
- << _request->get_payload()->get_length();
-
- static vsomeip::session_t last_session(0);
- ASSERT_GT(_request->get_session(), last_session);
- last_session = _request->get_session();
- if (test_mode_ == big_payload_test::test_mode::RANDOM) {
- ASSERT_LT(_request->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE_RANDOM);
- } else {
- ASSERT_EQ(_request->get_payload()->get_length(), big_payload_test::BIG_PAYLOAD_SIZE);
- }
- bool check(true);
- vsomeip::length_t len = _request->get_payload()->get_length();
- vsomeip::byte_t* datap = _request->get_payload()->get_data();
- for(unsigned int i = 0; i < len; ++i) {
- check = check && datap[i] == big_payload_test::DATA_CLIENT_TO_SERVICE;
- }
- if(!check) {
- GTEST_FATAL_FAILURE_("wrong data transmitted");
- }
-
- number_of_received_messages_++;
-
- // send response
- std::shared_ptr<vsomeip::message> its_response =
- vsomeip::runtime::get()->create_response(_request);
-
- std::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()
- ->create_payload();
- std::vector<vsomeip::byte_t> its_payload_data;
- if (test_mode_ == big_payload_test::test_mode::RANDOM) {
- its_payload_data.assign(std::rand() % big_payload_test::BIG_PAYLOAD_SIZE_RANDOM,
- big_payload_test::DATA_SERVICE_TO_CLIENT);
- } else if (test_mode_ == big_payload_test::test_mode::LIMITED
- || test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- if (number_of_received_messages_ % 2) {
- // try to send to big response for half of the received messsages.
- // this way the client will only get replies for a fourth of his sent
- // requests as he tries to sent to big data for every second request
- // as well
- its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE + 3,
- big_payload_test::DATA_SERVICE_TO_CLIENT);
- } else {
- its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE,
- big_payload_test::DATA_SERVICE_TO_CLIENT);
- }
- } else {
- its_payload_data.assign(big_payload_test::BIG_PAYLOAD_SIZE,
- big_payload_test::DATA_SERVICE_TO_CLIENT);
- }
-
- its_payload->set_data(its_payload_data);
- its_response->set_payload(its_payload);
-
- app_->send(its_response, true);
-
- if(number_of_received_messages_ == expected_messages_) {
- ASSERT_EQ(expected_messages_, number_of_received_messages_);
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
-}
-
-void big_payload_test_service::run()
-{
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_) {
- condition_.wait(its_lock);
- }
-
- offer();
-
- // wait for shutdown
- blocked_ = false;
- while (!blocked_) {
- condition_.wait(its_lock);
- }
- }
- std::this_thread::sleep_for(std::chrono::seconds(3));
- if (test_mode_ == big_payload_test::test_mode::LIMITED
- || test_mode_ == big_payload_test::test_mode::LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_GENERAL
- || test_mode_ == big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC) {
- ASSERT_EQ(number_of_received_messages_, expected_messages_);
- }
- stop();
-}
-
-static big_payload_test::test_mode test_mode(big_payload_test::test_mode::UNKNOWN);
-
-
-TEST(someip_big_payload_test, receive_ten_messages_and_send_reply)
-{
- big_payload_test_service test_service(test_mode);
- if (test_service.init()) {
- test_service.start();
- test_service.join_offer_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if (argc > 1) {
- if (std::string("RANDOM") == std::string(argv[1])) {
- test_mode = big_payload_test::test_mode::RANDOM;
- } else if (std::string("LIMITED") == std::string(argv[1])) {
- test_mode = big_payload_test::test_mode::LIMITED;
- } else if (std::string("LIMITEDGENERAL") == std::string(argv[1])) {
- test_mode = big_payload_test::test_mode::LIMITED_GENERAL;
- } else if (std::string("QUEUELIMITEDGENERAL") == std::string(argv[1])) {
- test_mode = big_payload_test::test_mode::QUEUE_LIMITED_GENERAL;
- } else if (std::string("QUEUELIMITEDSPECIFIC") == std::string(argv[1])) {
- test_mode = big_payload_test::test_mode::QUEUE_LIMITED_SPECIFIC;
- }
- }
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/big_payload_tests/big_payload_test_service.hpp b/test/big_payload_tests/big_payload_test_service.hpp
deleted file mode 100644
index 8db42f7..0000000
--- a/test/big_payload_tests/big_payload_test_service.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2015-2017 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 BIGPAYLOADTESTSERVICE_HPP_
-#define BIGPAYLOADTESTSERVICE_HPP_
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-
-#include "big_payload_test_globals.hpp"
-#include "../../implementation/logging/include/logger.hpp"
-
-
-class big_payload_test_service
-{
-public:
- big_payload_test_service(big_payload_test::test_mode _test_mode);
- 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<vsomeip::message> &_request);
- void run();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- big_payload_test::test_mode test_mode_;
- std::uint32_t number_of_received_messages_;
- std::thread offer_thread_;
- std::uint32_t expected_messages_;
- vsomeip::service_t service_id_;
-};
-
-#endif /* BIGPAYLOADTESTSERVICE_HPP_ */
diff --git a/test/big_payload_tests/big_payload_test_service_external_start.sh b/test/big_payload_tests/big_payload_test_service_external_start.sh
deleted file mode 100755
index de3224c..0000000
--- a/test/big_payload_tests/big_payload_test_service_external_start.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-if [[ $# -gt 0 && $1 != "RANDOM" && $1 != "LIMITED" && $1 != "LIMITEDGENERAL" && $1 != "QUEUELIMITEDGENERAL" && $1 != "QUEUELIMITEDSPECIFIC" ]]
-then
- echo "The only allowed parameter to this script is RANDOM, LIMITED, LIMITEDGENERAL, QUEUELIMITEDGENERAL or QUEUELIMITEDSPECIFIC"
- echo "Like $0 RANDOM"
- exit 1
-fi
-
-# Start the service
-if [[ $# -gt 0 && $1 == "RANDOM" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service_random.json
-elif [[ $# -gt 0 && $1 == "LIMITEDGENERAL" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service_limited_general.json
-elif [[ $# -gt 0 && $1 == "QUEUELIMITEDGENERAL" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service_queue_limited_general.json
-elif [[ $# -gt 0 && $1 == "QUEUELIMITEDSPECIFIC" ]]; then
- export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service_queue_limited_specific.json
-else
- export VSOMEIP_CONFIGURATION=big_payload_test_tcp_service.json
-fi
-./big_payload_test_service $1
diff --git a/test/big_payload_tests/big_payload_test_service_local_start.sh b/test/big_payload_tests/big_payload_test_service_local_start.sh
deleted file mode 100755
index 299af82..0000000
--- a/test/big_payload_tests/big_payload_test_service_local_start.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=big_payload_test_service
-export VSOMEIP_CONFIGURATION=big_payload_test_local.json
-./big_payload_test_service
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_client.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client.json.in
deleted file mode 100644
index 0f23a10..0000000
--- a/test/big_payload_tests/conf/big_payload_test_tcp_client.json.in
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "netmask":"255.255.255.0",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"true",
- "path":"/var/log/vsomeip.log"
- },
- "dlt":"true"
- },
- "applications":
- [
- {
- "name":"big_payload_test_client",
- "id":"0x1343"
- }
- ],
- "payload-sizes":
- [
- {
- "unicast":"@TEST_IP_SLAVE@",
- "ports":
- [
- {
- "port":"30509",
- "max-payload-size":"614400"
- }
- ]
- }
- ],
- "routing":"big_payload_test_client",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_client_limited_general.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client_limited_general.json.in
deleted file mode 100644
index f28efc8..0000000
--- a/test/big_payload_tests/conf/big_payload_test_tcp_client_limited_general.json.in
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "netmask":"255.255.255.0",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"true",
- "path":"/var/log/vsomeip.log"
- },
- "dlt":"true"
- },
- "applications":
- [
- {
- "name":"big_payload_test_client",
- "id":"0x1343"
- }
- ],
- "max-payload-size-reliable":"614400",
- "routing":"big_payload_test_client",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_general.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_general.json.in
deleted file mode 100644
index a193ab8..0000000
--- a/test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_general.json.in
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "netmask":"255.255.255.0",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"true",
- "path":"/var/log/vsomeip.log"
- },
- "dlt":"true"
- },
- "applications":
- [
- {
- "name":"big_payload_test_client",
- "id":"0x1343"
- }
- ],
- "endpoint-queue-limit-external" : "614416",
- "routing":"big_payload_test_client",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_specific.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_specific.json.in
deleted file mode 100644
index 79f3486..0000000
--- a/test/big_payload_tests/conf/big_payload_test_tcp_client_queue_limited_specific.json.in
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "netmask":"255.255.255.0",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"true",
- "path":"/var/log/vsomeip.log"
- },
- "dlt":"true"
- },
- "applications":
- [
- {
- "name":"big_payload_test_client",
- "id":"0x1343"
- }
- ],
- "endpoint-queue-limits" :
- [
- {
- "unicast":"@TEST_IP_SLAVE@",
- "ports":
- [
- {
- "port":"30509",
- "queue-size-limit":"614416"
- }
- ]
- }
- ],
- "routing":"big_payload_test_client",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_client_random.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_client_random.json.in
deleted file mode 100644
index 85cf393..0000000
--- a/test/big_payload_tests/conf/big_payload_test_tcp_client_random.json.in
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "netmask":"255.255.255.0",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"true",
- "path":"/var/log/vsomeip.log"
- },
- "dlt":"true"
- },
- "applications":
- [
- {
- "name":"big_payload_test_client",
- "id":"0x1343",
- "max_dispatch_time" : "5000"
- }
- ],
- "buffer-shrink-threshold" : "2",
- "routing":"big_payload_test_client",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_service.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service.json.in
deleted file mode 100644
index 08149bb..0000000
--- a/test/big_payload_tests/conf/big_payload_test_tcp_service.json.in
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"debug",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"big_payload_test_service",
- "id":"0x1277"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1235",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1236",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1237",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "payload-sizes":
- [
- {
- "unicast":"@TEST_IP_SLAVE@",
- "ports":
- [
- {
- "port":"30509",
- "max-payload-size":"614400"
- }
- ]
- }
- ],
- "routing":"big_payload_test_service",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_service_limited_general.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service_limited_general.json.in
deleted file mode 100644
index f8414f3..0000000
--- a/test/big_payload_tests/conf/big_payload_test_tcp_service_limited_general.json.in
+++ /dev/null
@@ -1,69 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"debug",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"big_payload_test_service",
- "id":"0x1277"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1235",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1236",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1237",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "max-payload-size-reliable":"614400",
- "routing":"big_payload_test_service",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_general.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_general.json.in
deleted file mode 100644
index ad5b28c..0000000
--- a/test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_general.json.in
+++ /dev/null
@@ -1,87 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"debug",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"big_payload_test_service",
- "id":"0x1277"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1235",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1236",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1237",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1238",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1239",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "endpoint-queue-limit-external" : "614416",
- "routing":"big_payload_test_service",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_specific.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_specific.json.in
deleted file mode 100644
index 87bcdaa..0000000
--- a/test/big_payload_tests/conf/big_payload_test_tcp_service_queue_limited_specific.json.in
+++ /dev/null
@@ -1,99 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"debug",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"big_payload_test_service",
- "id":"0x1277"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1235",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1236",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1237",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1238",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1239",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "endpoint-queue-limits" :
- [
- {
- "unicast":"@TEST_IP_SLAVE@",
- "ports":
- [
- {
- "port":"30509",
- "queue-size-limit":"614416"
- }
- ]
- }
- ],
- "routing":"big_payload_test_service",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/big_payload_tests/conf/big_payload_test_tcp_service_random.json.in b/test/big_payload_tests/conf/big_payload_test_tcp_service_random.json.in
deleted file mode 100644
index d583fd1..0000000
--- a/test/big_payload_tests/conf/big_payload_test_tcp_service_random.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"debug",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"big_payload_test_service",
- "id":"0x1277",
- "max_dispatch_time" : "5000"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1235",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1236",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1237",
- "instance":"0x01",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "buffer-shrink-threshold" : "2",
- "routing":"big_payload_test_service",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.244.224.245",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/client_id_tests/client_id_test_globals.hpp b/test/client_id_tests/client_id_test_globals.hpp
deleted file mode 100644
index 52dd069..0000000
--- a/test/client_id_tests/client_id_test_globals.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2014-2017 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 CLIENT_ID_TEST_CLIENT_ID_TEST_GLOBALS_HPP_
-#define CLIENT_ID_TEST_CLIENT_ID_TEST_GLOBALS_HPP_
-
-namespace client_id_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
-};
-
-static constexpr std::array<service_info, 7> service_infos = {{
- // placeholder to be consistent w/ client ids, service ids, app names
- { 0xFFFF, 0xFFFF, 0xFFFF },
- // node 1
- { 0x1000, 0x1, 0x1111 },
- { 0x2000, 0x1, 0x2222 },
- { 0x3000, 0x1, 0x3333 },
- // node 2
- { 0x4000, 0x1, 0x4444 },
- { 0x5000, 0x1, 0x5555 },
- { 0x6000, 0x1, 0x6666 }
-}};
-
-static constexpr int messages_to_send = 10;
-}
-
-#endif /* CLIENT_ID_TEST_CLIENT_ID_TEST_GLOBALS_HPP_ */
diff --git a/test/client_id_tests/client_id_test_master_starter.sh b/test/client_id_tests/client_id_test_master_starter.sh
deleted file mode 100755
index c0b2a0b..0000000
--- a/test/client_id_tests/client_id_test_master_starter.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-if [ $# -lt 1 ]
-then
- echo "Please pass a json file to this script."
- echo "For example: $0 client_id_test_diff_client_ids_diff_ports_master.json"
- exit 1
-fi
-
-MASTER_JSON_FILE=$1
-CLIENT_JSON_FILE=${MASTER_JSON_FILE/master/slave}
-
-FAIL=0
-
-# Start the services
-export VSOMEIP_APPLICATION_NAME=client_id_test_service_one
-export VSOMEIP_CONFIGURATION=$1
-./client_id_test_service 1 &
-CLIENT_ID_PIDS[1]=$!
-
-export VSOMEIP_APPLICATION_NAME=client_id_test_service_two
-export VSOMEIP_CONFIGURATION=$1
-./client_id_test_service 2 &
-CLIENT_ID_PIDS[2]=$!
-
-export VSOMEIP_APPLICATION_NAME=client_id_test_service_three
-export VSOMEIP_CONFIGURATION=$1
-./client_id_test_service 3 &
-CLIENT_ID_PIDS[3]=$!
-
-sleep 1
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting client id test on slave LXC"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./client_id_test_slave_starter.sh $CLIENT_JSON_FILE\"" &
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name citms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./client_id_test_slave_starter.sh $CLIENT_JSON_FILE" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** client_id_test_slave_starter.sh $CLIENT_JSON_FILE
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** client_id_test_diff_client_ids_diff_ports_master.json and
-** client_id_test_diff_client_ids_diff_ports_slave.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# Wait until client and service are finished
-for client_pid in "${CLIENT_ID_PIDS[@]}"
-do
- if [ -n "$client_pid" ]; then
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait "$client_pid" || ((FAIL+=1))
- fi
-done
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop citms
- docker rm citms
-fi
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/client_id_tests/client_id_test_service.cpp b/test/client_id_tests/client_id_test_service.cpp
deleted file mode 100644
index 9306bad..0000000
--- a/test/client_id_tests/client_id_test_service.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "client_id_test_globals.hpp"
-
-
-class client_id_test_service {
-public:
- client_id_test_service(struct client_id_test::service_info _service_info) :
- service_info_(_service_info),
- app_(vsomeip::runtime::get()->create_application()),
- blocked_(false),
- offer_thread_(std::bind(&client_id_test_service::run, this)),
- stopped_(false),
- stop_thread_(std::bind(&client_id_test_service::wait_for_stop, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&client_id_test_service::on_state, this,
- std::placeholders::_1));
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.method_id,
- std::bind(&client_id_test_service::on_request, this,
- std::placeholders::_1));
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- service_info_.instance_id, vsomeip::ANY_METHOD,
- std::bind(&client_id_test_service::on_response, this,
- std::placeholders::_1));
-
- for(const auto& i : client_id_test::service_infos) {
- if ((i.service_id == service_info_.service_id
- && i.instance_id == service_info_.instance_id)
- || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
- continue;
- }
- app_->request_service(i.service_id, i.instance_id);
- app_->register_availability_handler(i.service_id, i.instance_id,
- std::bind(&client_id_test_service::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
-
- other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false;
- other_services_received_response_[std::make_pair(i.service_id, i.method_id)] = 0;
- }
-
- app_->start();
- }
-
- ~client_id_test_service() {
- offer_thread_.join();
- stop_thread_.join();
- }
-
- void offer() {
- app_->offer_service(service_info_.service_id, service_info_.instance_id);
- }
-
- void stop_offer() {
- app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- if(_is_available) {
- VSOMEIP_INFO
- << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is "
- << (_is_available ? "available." : "NOT available.");
-
- auto its_service = other_services_available_.find(std::make_pair(_service, _instance));
- if(its_service != other_services_available_.end()) {
- its_service->second = true;
- }
-
- if(std::all_of(other_services_available_.cbegin(),
- other_services_available_.cend(),
- [](const std::map<std::pair<vsomeip::service_t,
- vsomeip::instance_t>, bool>::value_type& v) {
- return v.second;})) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
- }
- }
-
- void on_request(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST) {
- VSOMEIP_DEBUG
- << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id
- << "] Received a request with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "]";
- std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get()
- ->create_response(_message);
- app_->send(its_response);
- }
- }
-
- void on_response(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- VSOMEIP_DEBUG
- << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id
- << "] Received a response with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] from Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method() <<"]";
- other_services_received_response_[std::make_pair(_message->get_service(),
- _message->get_method())]++;
-
- if(std::all_of(other_services_received_response_.cbegin(),
- other_services_received_response_.cend(),
- [](const std::map<std::pair<vsomeip::service_t,
- vsomeip::method_t>, std::uint32_t>::value_type& v)
- { return v.second == client_id_test::messages_to_send;})) {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- stopped_ = true;
- stop_condition_.notify_one();
- }
- }
- }
-
- void run() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_) {
- condition_.wait(its_lock);
- }
- blocked_ = false;
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
-
-
- while (!blocked_) {
- condition_.wait(its_lock);
- }
- blocked_ = false;
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Sending";
- // send a message to all other services
- for (int var = 0; var < client_id_test::messages_to_send; ++var) {
- for(const client_id_test::service_info& i: client_id_test::service_infos) {
- if ((i.service_id == service_info_.service_id
- && i.instance_id == service_info_.instance_id)
- || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
- continue;
- }
- std::shared_ptr<vsomeip::message> msg = vsomeip::runtime::get()->create_request();
- msg->set_service(i.service_id);
- msg->set_instance(i.instance_id);
- msg->set_method(i.method_id);
- app_->send(msg);
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0')
- << std::hex << service_info_.service_id
- << "] Sending a request to Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << i.service_id << "/" << std::setw(4) << std::setfill('0')
- << std::hex << i.instance_id <<"]";
- }
- }
-
- while (!blocked_) {
- condition_.wait(its_lock);
- }
- blocked_ = false;
- }
-
- void wait_for_stop() {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (!stopped_) {
- stop_condition_.wait(its_lock);
- }
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id
- << "] Received responses from all other services, going down";
-
- // let offer thread exit
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
-
- std::this_thread::sleep_for(std::chrono::seconds(3));
- app_->clear_all_handler();
- app_->stop();
- }
-
-private:
- client_id_test::service_info service_info_;
- std::shared_ptr<vsomeip::application> app_;
- std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
- std::map<std::pair<vsomeip::service_t, vsomeip::method_t>, std::uint32_t> other_services_received_response_;
-
- bool blocked_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::thread offer_thread_;
-
- bool stopped_;
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
- std::thread stop_thread_;
-};
-
-static int service_number;
-
-TEST(someip_client_id_test, send_ten_messages_to_service)
-{
- client_id_test_service its_sample(
- client_id_test::service_infos[service_number]);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a service number, like: " << argv[0] << " 2" << std::endl;
- std::cerr << "Valid service numbers are in the range of [1,6]" << std::endl;
- return 1;
- }
- service_number = std::stoi(std::string(argv[1]), nullptr);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/client_id_tests/client_id_test_slave_starter.sh b/test/client_id_tests/client_id_test_slave_starter.sh
deleted file mode 100755
index 4553521..0000000
--- a/test/client_id_tests/client_id_test_slave_starter.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-if [ $# -lt 1 ]
-then
- echo "Please pass a json file to this script."
- echo "For example: $0 client_id_test_diff_client_ids_diff_ports_slave.json"
- exit 1
-fi
-
-FAIL=0
-
-# Start the services
-export VSOMEIP_APPLICATION_NAME=client_id_test_service_four
-export VSOMEIP_CONFIGURATION=$1
-./client_id_test_service 4 &
-
-export VSOMEIP_APPLICATION_NAME=client_id_test_service_five
-export VSOMEIP_CONFIGURATION=$1
-./client_id_test_service 5 &
-
-export VSOMEIP_APPLICATION_NAME=client_id_test_service_six
-export VSOMEIP_CONFIGURATION=$1
-./client_id_test_service 6 &
-
-
-# Wait until all applications are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if one of the binaries exits
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/client_id_tests/client_id_test_utility.cpp b/test/client_id_tests/client_id_test_utility.cpp
deleted file mode 100644
index 1512146..0000000
--- a/test/client_id_tests/client_id_test_utility.cpp
+++ /dev/null
@@ -1,474 +0,0 @@
-// Copyright (C) 2014-2017 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 <gtest/gtest.h>
-
-#include <unistd.h> // for access()
-#include <sstream>
-
-#include <vsomeip/constants.hpp>
-
-#include "../../implementation/utility/include/utility.hpp"
-#include "../../implementation/configuration/include/configuration.hpp"
-#include "../../implementation/plugin/include/plugin_manager.hpp"
-
-using namespace vsomeip;
-
-static const std::string APPLICATION_NAME_ROUTING_MANAGER = "vsomeipd";
-
-static const std::string APPLICATION_NAME_NOT_PREDEFINED = "test-application-name";
-
-vsomeip::client_t CLIENT_ID_ROUTING_MANAGER = 0xFFFF;
-
-static const std::string APPLICATION_IN_NAME = "client_id_test_utility_service_in";
-static vsomeip::client_t APPLICATION_IN_CLIENT_ID = 0xFFFF;
-
-static const std::string APPLICATION_IN_NAME_TWO = "client_id_test_utility_service_in_two";
-static vsomeip::client_t APPLICATION_IN_CLIENT_ID_TWO = 0xFFFF;
-
-static const std::string APPLICATION_OUT_LOW_NAME = "client_id_test_utility_service_out_low";
-static const vsomeip::client_t APPLICATION_OUT_LOW_CLIENT_ID = 0x5911;
-
-static const std::string APPLICATION_OUT_HIGH_NAME = "client_id_test_utility_service_out_high";
-static const vsomeip::client_t APPLICATION_OUT_HIGH_CLIENT_ID = 0x7411;
-
-class client_id_utility_test: public ::testing::Test {
-public:
- client_id_utility_test() :
- client_id_routing_manager_(0x0),
- diagnosis_(0x0),
- diagnosis_mask_(0xFF00),
- client_id_base_(0x0) {
-
- std::shared_ptr<vsomeip::configuration> its_configuration;
- auto its_plugin = vsomeip::plugin_manager::get()->get_plugin(
- vsomeip::plugin_type_e::CONFIGURATION_PLUGIN, VSOMEIP_CFG_LIBRARY);
- if (its_plugin) {
- configuration_ = std::dynamic_pointer_cast<vsomeip::configuration>(its_plugin);
- }
- }
-protected:
- virtual void SetUp() {
- ASSERT_FALSE(file_exist(std::string("/dev/shm").append(utility::get_shm_name(configuration_))));
- ASSERT_TRUE(static_cast<bool>(configuration_));
- configuration_->load(APPLICATION_NAME_ROUTING_MANAGER);
- diagnosis_mask_ = configuration_->get_diagnosis_mask();
- diagnosis_ = configuration_->get_diagnosis_address();
-
- // calculate all client IDs based on mask
- client_id_base_ = static_cast<client_t>((diagnosis_ << 8) & diagnosis_mask_);
- CLIENT_ID_ROUTING_MANAGER = client_id_base_ | 0x1;
- APPLICATION_IN_CLIENT_ID = static_cast<client_t>(client_id_base_ | 0x11);
- APPLICATION_IN_CLIENT_ID_TWO = static_cast<client_t>(client_id_base_ | 0x12);
-
- utility::auto_configuration_init(configuration_);
- EXPECT_TRUE(file_exist(std::string("/dev/shm").append(utility::get_shm_name(configuration_))));
-
- client_id_routing_manager_ = utility::request_client_id(
- configuration_, APPLICATION_NAME_ROUTING_MANAGER, 0x0);
- EXPECT_EQ(client_id_base_ | 0x1, client_id_routing_manager_);
- EXPECT_TRUE(utility::is_routing_manager_host(client_id_routing_manager_));
- }
-
- virtual void TearDown() {
- utility::auto_configuration_exit(client_id_routing_manager_, configuration_);
- EXPECT_FALSE(file_exist(std::string("/dev/shm").append(utility::get_shm_name(configuration_))));
- }
-
- bool file_exist(const std::string &_path) {
- const int ret = ::access(_path.c_str(), F_OK);
- if (ret == -1 && errno == ENOENT) {
- return false;
- } else if (ret == -1) {
- std::stringstream its_stream;
- its_stream << "file_exists (" << _path << "): ";
- std::perror(its_stream.str().c_str());
- return false;
- } else {
- return true;
- }
- }
-
-protected:
- std::shared_ptr<configuration> configuration_;
- vsomeip::client_t client_id_routing_manager_;
- std::uint16_t diagnosis_;
- std::uint16_t diagnosis_mask_;
- client_t client_id_base_;
-};
-
-TEST_F(client_id_utility_test, request_release_client_id) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id);
-
- utility::release_client_id(its_client_id);
-}
-
-TEST_F(client_id_utility_test, request_client_id_twice) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id);
-
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x3, its_client_id_2);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
-}
-
-TEST_F(client_id_utility_test, release_unknown_client_id) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id);
-
- utility::release_client_id(0x4711);
- utility::release_client_id(its_client_id);
-
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x3, its_client_id_2);
- utility::release_client_id(its_client_id_2);
-}
-
-TEST_F(client_id_utility_test, release_client_id_twice)
-{
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id);
-
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x3, its_client_id_2);
- utility::release_client_id(its_client_id_2);
-}
-
-TEST_F(client_id_utility_test, ensure_preconfigured_client_ids_not_used_for_autoconfig)
-{
- // request client ids until 10 over the preconfigured one
- const std::uint16_t limit = static_cast<std::uint16_t>((APPLICATION_IN_CLIENT_ID & ~diagnosis_mask_) + 10u);
-
- std::vector<client_t> its_client_ids;
- for (int i = 0; i < limit; i++ ) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- its_client_ids.push_back(its_client_id);
- EXPECT_NE(APPLICATION_IN_CLIENT_ID, its_client_id);
- } else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
- << static_cast<std::uint32_t>(i);
- }
- }
-
- // release all
- for (const client_t c : its_client_ids) {
- utility::release_client_id(c);
- }
-}
-
-TEST_F(client_id_utility_test,
- ensure_preconfigured_client_ids_in_diagnosis_range_dont_influence_autoconfig_client_ids)
-{
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id);
-
- client_t its_client_id2 = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, APPLICATION_IN_CLIENT_ID);
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID, its_client_id2);
-
- client_t its_client_id3 = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME_TWO, APPLICATION_IN_CLIENT_ID_TWO);
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID_TWO, its_client_id3);
-
-
- client_t its_client_id4 = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x3, its_client_id4);
-
- client_t its_client_id5 = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(client_id_base_ | 0x4, its_client_id5);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id2);
- utility::release_client_id(its_client_id3);
- utility::release_client_id(its_client_id4);
- utility::release_client_id(its_client_id5);
-}
-
-TEST_F(client_id_utility_test,
- request_predefined_client_id_in_diagnosis_range) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, APPLICATION_IN_CLIENT_ID);
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID, its_client_id);
-
- utility::release_client_id(its_client_id);
-}
-
-TEST_F(client_id_utility_test,
- request_predefined_client_id_in_diagnosis_range_twice) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, APPLICATION_IN_CLIENT_ID);
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID, its_client_id);
-
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, APPLICATION_IN_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_2);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
-}
-
-TEST_F(client_id_utility_test,
- request_different_client_id_with_predefined_app_name_in_diagnosis_range) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, static_cast<client_t>(APPLICATION_IN_CLIENT_ID + 1u));
- // has to get predefined client id although other was requested
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID, its_client_id);
-
- // predefined in json is now already used and requested should be assigned
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, static_cast<client_t>(APPLICATION_IN_CLIENT_ID + 1u));
- EXPECT_EQ(APPLICATION_IN_CLIENT_ID + 1u, its_client_id_2);
-
- client_t its_client_id_3 = utility::request_client_id(configuration_,
- APPLICATION_IN_NAME, APPLICATION_IN_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_3);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
- utility::release_client_id(its_client_id_3);
-}
-
-TEST_F(client_id_utility_test,
- request_predefined_client_id_outside_diagnosis_range_low) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID);
- EXPECT_EQ(APPLICATION_OUT_LOW_CLIENT_ID, its_client_id);
-
- utility::release_client_id(its_client_id);
-}
-
-TEST_F(client_id_utility_test,
- request_predefined_client_id_outside_diagnosis_range_low_twice) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID);
- EXPECT_EQ(APPLICATION_OUT_LOW_CLIENT_ID, its_client_id);
-
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_2);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
-}
-
-TEST_F(client_id_utility_test,
- request_different_client_id_with_predefined_app_name_outside_diagnosis_range_low) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID + 1u);
- // has to get predefined client id although other was requested
- EXPECT_EQ(APPLICATION_OUT_LOW_CLIENT_ID, its_client_id);
-
- // predefined in json is now already used and requested should be assigned
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID + 1u);
- EXPECT_EQ(APPLICATION_OUT_LOW_CLIENT_ID + 1u, its_client_id_2);
-
- client_t its_client_id_3 = utility::request_client_id(configuration_,
- APPLICATION_OUT_LOW_NAME, APPLICATION_OUT_LOW_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_3);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
- utility::release_client_id(its_client_id_3);
-}
-
-TEST_F(client_id_utility_test,
- request_predefined_client_id_outside_diagnosis_range_high) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID);
- EXPECT_EQ(APPLICATION_OUT_HIGH_CLIENT_ID, its_client_id);
-
- utility::release_client_id(its_client_id);
-}
-
-TEST_F(client_id_utility_test,
- request_predefined_client_id_outside_diagnosis_range_high_twice) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID);
- EXPECT_EQ(APPLICATION_OUT_HIGH_CLIENT_ID, its_client_id);
-
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_2);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
-}
-
-TEST_F(client_id_utility_test,
- request_different_client_id_with_predefined_app_name_outside_diagnosis_range_high) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID + 1u);
- // has to get predefined client id although other was requested
- EXPECT_EQ(APPLICATION_OUT_HIGH_CLIENT_ID, its_client_id);
-
- // predefined in json is now already used and requested should be assigned
- client_t its_client_id_2 = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID + 1u);
- EXPECT_EQ(APPLICATION_OUT_HIGH_CLIENT_ID + 1u, its_client_id_2);
-
- client_t its_client_id_3 = utility::request_client_id(configuration_,
- APPLICATION_OUT_HIGH_NAME, APPLICATION_OUT_HIGH_CLIENT_ID);
- EXPECT_EQ(client_id_base_ | 0x2, its_client_id_3);
-
- utility::release_client_id(its_client_id);
- utility::release_client_id(its_client_id_2);
- utility::release_client_id(its_client_id_3);
-}
-
-
-TEST_F(client_id_utility_test, exhaust_client_id_range_sequential) {
- std::vector<client_t> its_client_ids;
-
- const std::uint16_t max_possible_clients = static_cast<std::uint16_t>(~diagnosis_mask_);
- // -1 for the routing manager, -2 as two predefined client IDs are present
- // in the json file which aren't assigned via autoconfiguration
- const std::uint16_t max_allowed_clients = static_cast<std::uint16_t>(max_possible_clients - 3u);
-
- // acquire maximum amount of client IDs
- for (std::uint16_t i = 0; i < max_allowed_clients; i++) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- its_client_ids.push_back(its_client_id);
- } else {
- ADD_FAILURE()<< "Received ILLEGAL_CLIENT "
- << static_cast<std::uint32_t>(i);
- }
- }
-
- // check limit is reached
- client_t its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
-
- // release all
- for (const client_t c : its_client_ids) {
- utility::release_client_id(c);
- }
- its_client_ids.clear();
- its_illegal_client_id = 0xFFFF;
-
- // One more time!
-
- // acquire maximum amount of client IDs
- for (std::uint16_t i = 0; i < max_allowed_clients; i++) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- its_client_ids.push_back(its_client_id);
- } else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
- << static_cast<std::uint32_t>(i);
- }
- }
-
- // check limit is reached
- its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
-
- // release all
- for (const client_t c : its_client_ids) {
- utility::release_client_id(c);
- }
- }
-
-TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented) {
- std::vector<client_t> its_client_ids;
-
- // -1 for the routing manager, -2 as two predefined client IDs are present
- // in the json file which aren't assigned via autoconfiguration
- const std::uint16_t max_possible_clients = static_cast<std::uint16_t>(~diagnosis_mask_);
- const std::uint16_t max_allowed_clients = static_cast<std::uint16_t>(max_possible_clients - 3u);
-
- // acquire maximum amount of client IDs
- for (std::uint16_t i = 0; i < max_allowed_clients; i++) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- its_client_ids.push_back(its_client_id);
- } else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
- << static_cast<std::uint32_t>(i);
- }
- }
-
- // check limit is reached
- client_t its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
-
- // release every second requested client ID
- std::vector<client_t> its_released_client_ids;
- for (size_t i = 0; i < its_client_ids.size(); i++ ) {
- if (i % 2) {
- its_released_client_ids.push_back(its_client_ids[i]);
- utility::release_client_id(its_client_ids[i]);
- }
- }
- for (const client_t c : its_released_client_ids) {
- for (auto it = its_client_ids.begin(); it != its_client_ids.end(); ) {
- if (*it == c) {
- it = its_client_ids.erase(it);
- } else {
- ++it;
- }
- }
- }
-
- // acquire client IDs up to the maximum allowed amount again
- for (std::uint16_t i = 0; i < its_released_client_ids.size(); i++) {
- client_t its_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_NE(ILLEGAL_CLIENT, its_client_id);
- if (its_client_id != ILLEGAL_CLIENT) {
- its_client_ids.push_back(its_client_id);
- } else {
- ADD_FAILURE() << "Received ILLEGAL_CLIENT "
- << static_cast<std::uint32_t>(i);
- }
- }
-
- // check limit is reached
- its_illegal_client_id = 0xFFFF;
- its_illegal_client_id = utility::request_client_id(configuration_,
- APPLICATION_NAME_NOT_PREDEFINED, 0x0);
- EXPECT_EQ(ILLEGAL_CLIENT, its_illegal_client_id);
-
- // release all
- for (const client_t c : its_client_ids) {
- utility::release_client_id(c);
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/client_id_tests/client_id_test_utility.json b/test/client_id_tests/client_id_test_utility.json
deleted file mode 100644
index e928b05..0000000
--- a/test/client_id_tests/client_id_test_utility.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "diagnosis":"0x63",
- "applications":
- [
- {
- "name":"client_id_test_utility_service_in",
- "id":"0x6311"
- },
- {
- "name":"client_id_test_utility_service_in_two",
- "id":"0x6312"
- },
- {
- "name":"client_id_test_utility_service_out_low",
- "id":"0x5911"
- },
- {
- "name":"client_id_test_utility_service_out_high",
- "id":"0x7411"
- }
- ],
- "routing":"vsomeipd"
-}
diff --git a/test/client_id_tests/client_id_test_utility_masked_127.json b/test/client_id_tests/client_id_test_utility_masked_127.json
deleted file mode 100644
index c7c255b..0000000
--- a/test/client_id_tests/client_id_test_utility_masked_127.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "diagnosis":"0x63",
- "diagnosis_mask":"0xFF80",
- "applications":
- [
- {
- "name":"client_id_test_utility_service_in",
- "id":"0x6311"
- },
- {
- "name":"client_id_test_utility_service_in_two",
- "id":"0x6312"
- },
- {
- "name":"client_id_test_utility_service_out_low",
- "id":"0x5911"
- },
- {
- "name":"client_id_test_utility_service_out_high",
- "id":"0x7411"
- }
- ],
- "routing":"vsomeipd"
-}
diff --git a/test/client_id_tests/client_id_test_utility_masked_4095.json b/test/client_id_tests/client_id_test_utility_masked_4095.json
deleted file mode 100644
index dfc42c0..0000000
--- a/test/client_id_tests/client_id_test_utility_masked_4095.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "diagnosis":"0x63",
- "diagnosis_mask":"0xF000",
- "applications":
- [
- {
- "name":"client_id_test_utility_service_in",
- "id":"0x6011"
- },
- {
- "name":"client_id_test_utility_service_in_two",
- "id":"0x6012"
- },
- {
- "name":"client_id_test_utility_service_out_low",
- "id":"0x5911"
- },
- {
- "name":"client_id_test_utility_service_out_high",
- "id":"0x7411"
- }
- ],
- "routing":"vsomeipd"
-}
diff --git a/test/client_id_tests/client_id_test_utility_masked_511.json b/test/client_id_tests/client_id_test_utility_masked_511.json
deleted file mode 100644
index 274a5e0..0000000
--- a/test/client_id_tests/client_id_test_utility_masked_511.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "diagnosis":"0x63",
- "diagnosis_mask":"0xFE00",
- "applications":
- [
- {
- "name":"client_id_test_utility_service_in",
- "id":"0x6211"
- },
- {
- "name":"client_id_test_utility_service_in_two",
- "id":"0x6212"
- },
- {
- "name":"client_id_test_utility_service_out_low",
- "id":"0x5911"
- },
- {
- "name":"client_id_test_utility_service_out_high",
- "id":"0x7411"
- }
- ],
- "routing":"vsomeipd"
-}
diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in
deleted file mode 100644
index a986dd9..0000000
--- a/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_master.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"client_id_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"client_id_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"client_id_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1000",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2000",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3000",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"client_id_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in
deleted file mode 100644
index 596f842..0000000
--- a/test/client_id_tests/conf/client_id_test_diff_client_ids_diff_ports_slave.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"client_id_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"client_id_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"client_id_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4000",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5000",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6000",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"client_id_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_master.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_master.json.in
deleted file mode 100644
index bb3507b..0000000
--- a/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_master.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"client_id_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"client_id_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"client_id_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1000",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2000",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3000",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"client_id_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_slave.json.in
deleted file mode 100644
index a7337e9..0000000
--- a/test/client_id_tests/conf/client_id_test_diff_client_ids_partial_same_ports_slave.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"client_id_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"client_id_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"client_id_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4000",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5000",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6000",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"client_id_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in
deleted file mode 100644
index 9f7062f..0000000
--- a/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_master.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"client_id_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"client_id_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"client_id_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"client_id_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in
deleted file mode 100644
index 1aaf2cb..0000000
--- a/test/client_id_tests/conf/client_id_test_diff_client_ids_same_ports_slave.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"client_id_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"client_id_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"client_id_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"client_id_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in
deleted file mode 100644
index a986dd9..0000000
--- a/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_master.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"client_id_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"client_id_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"client_id_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1000",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2000",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3000",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"client_id_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in
deleted file mode 100644
index 2acb37b..0000000
--- a/test/client_id_tests/conf/client_id_test_same_client_ids_diff_ports_slave.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"client_id_test_service_four",
- "id":"0x1111"
- },
- {
- "name":"client_id_test_service_five",
- "id":"0x2222"
- },
- {
- "name":"client_id_test_service_six",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x4000",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5000",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6000",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"client_id_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in
deleted file mode 100644
index 9f7062f..0000000
--- a/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_master.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"client_id_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"client_id_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"client_id_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"client_id_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in b/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in
deleted file mode 100644
index ae534b1..0000000
--- a/test/client_id_tests/conf/client_id_test_same_client_ids_same_ports_slave.json.in
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"client_id_test_service_four",
- "id":"0x1111"
- },
- {
- "name":"client_id_test_service_five",
- "id":"0x2222"
- },
- {
- "name":"client_id_test_service_six",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x4000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6000",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"client_id_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/configuration_tests/configuration-test-deprecated.json b/test/configuration_tests/configuration-test-deprecated.json
deleted file mode 100644
index 5ffacce..0000000
--- a/test/configuration_tests/configuration-test-deprecated.json
+++ /dev/null
@@ -1,366 +0,0 @@
-{
- "unicast" : "10.0.2.15",
- "diagnosis" : "85",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "true", "path" : "/home/someip/another-file.log" },
- "dlt" : "false",
- "version" : {
- "enable" : "false",
- "interval" : "15"
- }
- },
- "watchdog" :
- {
- "enable" : "true",
- "timeout" : "1234",
- "allowed_missing_pongs" : "7"
- },
- "file-permissions" :
- {
- "permissions-shm" : "444",
- "umask" : "222"
- },
- "supports_selective_broadcasts" :
- {
- "address" : "160.160.160.160"
- },
- "tracing" :
- {
- "enable" : "true",
- "sd_enable" : "true",
- "channels" :
- [
- {
- "name" : "testname",
- "id" : "testid"
- },
- {
- "name" : "testname2",
- "id" : "testid2"
- }
- ],
- "filters" :
- [
- {
- "channel" : "testname",
- "services" : ["0x1111",2222],
- "methods" : ["0x1111",2222],
- "clients" : ["0x1111",2222]
- },
- {
- "channel" : "testname2",
- "services" : ["0x3333",4444],
- "methods" : ["0x3333",4444],
- "clients" : ["0x3333",4444]
- }
- ]
- },
- "applications" :
- [
- {
- "name" : "my_application",
- "id" : "0x7788",
- "max_dispatchers" : "25",
- "max_dispatch_time" : "1234",
- "threads" : "12",
- "request_debounce_time" : "5000",
- "plugins" :
- [
- {
- "application_plugin" : "testlibraryname"
- },
- {
- "intentionally_wrong_plugin" : "wrong"
- }
- ]
- },
- {
- "name" : "other_application",
- "id" : "0x9933",
- "threads" : "0",
- "threads" : "256",
- "request_debounce_time" : "10001"
- }
- ],
- "servicegroups" :
- [
- {
- "name" : "default",
- "unicast" : "local",
- "delays" :
- {
- "initial" : { "minimum" : "10", "maximum" : "100" },
- "repetition-base" : "200",
- "repetition-max" : "7",
- "cyclic-offer" : "2132",
- "cyclic-request" : "2001",
- "ttl" : "5"
- },
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x0022",
- "reliable" : { "port" : "30506", "enable-magic-cookies" : "true" },
- "unreliable" : "31000",
- "events" :
- [
- {
- "event" : "0x0778",
- "is_field" : "false"
- },
- {
- "event" : "0x779",
- "is_field" : "true"
- },
- {
- "event" : "0x77A",
- "is_field" : "false"
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4567",
- "multicast" : "225.226.227.228",
- "events" : [ "0x778", "0x779" ]
- },
- {
- "eventgroup" : "0x4569",
- "multicast" : "225.227.227.228",
- "events" : [ "0x779", "0x77A" ]
- },
- {
- "eventgroup" : "0x4569",
- "multicast" : "225.222.227.228",
- "events" : [ "0x778", "0x77A" ]
- }
- ]
- },
- {
- "service" : "0x1234",
- "instance" : "0x0023",
- "reliable" : "30503"
- },
- {
- "service" : "0x7809",
- "instance" : "0x1",
- "multicast" :
- {
- "address" : "224.212.244.225",
- "port" : "1234"
- },
- "eventgroups" :
- [
- {
- "eventgroup" : "0x1111",
- "threshold" : "8",
- "is_multicast" : "true",
- "events" : [ "0x778", "0x77A" ]
- }
- ]
- }
- ]
- },
- {
- "name" : "extra",
- "unicast" : "local",
- "delays" :
- {
- "initial" : { "minimum" : "10", "maximum" : "100" },
- "repetition-base" : "200",
- "repetition-max" : "7",
- "cyclic-offer" : "2132",
- "cyclic-request" : "2001",
- "ttl" : "5"
- },
- "services" :
- [
- {
- "service" : "0x2277",
- "instance" : "0x0022",
- "reliable" : { "port" : "30505" },
- "unreliable" : "31001"
- },
- {
- "service" : "0x2266",
- "instance" : "0x0022",
- "reliable" : "30505",
- "unreliable" : "30507"
- },
- {
- "service" : "0x3333",
- "instance" : "0x1"
- },
- {
- "service" : "0x3555",
- "instance" : "0x1",
- "protocol" : "other"
- }
- ]
- },
- {
- "name" : "remote",
- "unicast" : "10.0.2.23",
- "services" :
- [
- {
- "service" : "0x4466",
- "instance" : "0x0321",
- "reliable" : "30506",
- "unreliable" : "30444"
- }
- ]
- }
- ],
- "internal_services" :
- [
- {
- "first" : "0xF100",
- "last" : "0xF109"
- },
- {
- "first" : {
- "service" : "0xF300",
- "instance" : "0x1"
- },
- "last" : {
- "service" : "0xF300",
- "instance" : "0x10"
- }
- }
- ],
- "clients" :
- [
- {
- "reliable_remote_ports" : { "first" : "30500", "last" : "30599" },
- "unreliable_remote_ports" : { "first" : "30500", "last" : "30599" },
- "reliable_client_ports" : { "first" : "30491", "last" : "30499" },
- "unreliable_client_ports" : { "first" : "30491", "last" : "30499" }
- },
- {
- "reliable_remote_ports" : { "first" : "31500", "last" : "31599" },
- "unreliable_remote_ports" : { "first" : "31500", "last" : "31599" },
- "reliable_client_ports" : { "first" : "31491", "last" : "31499" },
- "unreliable_client_ports" : { "first" : "31491", "last" : "31499" }
- },
- {
- "reliable_remote_ports" : { "first" : "32500", "last" : "32599" },
- "unreliable_remote_ports" : { "first" : "32500", "last" : "32599" },
- "reliable_client_ports" : { "first" : "32491", "last" : "32499" },
- "unreliable_client_ports" : { "first" : "32491", "last" : "32499" }
- },
- {
- "service" : "0x8888",
- "instance" : "0x1",
- "unreliable" : [ "0x11", "0x10" ],
- "reliable" : [ "0x11", "0x10" ]
- },
- {
- "service" : "8888",
- "instance" : "1",
- "unreliable" : [ 40000, 40001 ],
- "reliable" : [ 40000, 40001 ]
- }
- ],
- "max-payload-size-local" : "15000",
- "max-payload-size-reliable" : "17000",
- "buffer-shrink-threshold" : "11",
- "payload-sizes":
- [
- {
- "unicast":"10.10.10.10",
- "ports":
- [
- {
- "port":"7777",
- "max-payload-size":"14999"
- }
- ]
- },
- {
- "unicast":"10.10.10.11",
- "ports":
- [
- {
- "port":"7778",
- "max-payload-size":"15001"
- }
- ]
- }
- ],
- "security" :
- {
- "check_credentials" : "true",
- "policies" :
- [
- {
- "client" : "0x1277",
- "credentials" : { "uid" : "1000", "gid" : "1000" },
- "allow" :
- {
- "offers":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678"
- }
- ]
- }
- },
- {
- "client" : { "first" : "0x1343", "last" : "0x1346" },
- "allow" :
- {
- "requests":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
- }
- },
- {
- "client" : { "first" : "0x1443", "last" : "0x1446" },
- "deny" :
- {
- "requests":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ],
- "offers":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678"
- }
- ]
- }
- }
- ]
- },
- "routing" : "my_application",
- "service-discovery" :
- {
- "enable" : "true",
- "protocol" : "udp",
- "multicast" : "224.212.244.223",
- "port" : "30666",
- "offer_debounce_time" : "1000"
- }
-}
diff --git a/test/configuration_tests/configuration-test.cpp b/test/configuration_tests/configuration-test.cpp
deleted file mode 100644
index f9717c5..0000000
--- a/test/configuration_tests/configuration-test.cpp
+++ /dev/null
@@ -1,626 +0,0 @@
-// Copyright (C) 2015-2017 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 <cstdlib>
-#include <iostream>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/constants.hpp>
-#include <vsomeip/plugins/application_plugin.hpp>
-
-#include "../implementation/configuration/include/configuration.hpp"
-#include "../implementation/configuration/include/configuration_impl.hpp"
-#include "../implementation/logging/include/logger.hpp"
-
-#include "../implementation/plugin/include/plugin_manager.hpp"
-
-#define CONFIGURATION_FILE "configuration-test.json"
-#define DEPRECATED_CONFIGURATION_FILE "configuration-test-deprecated.json"
-
-#define EXPECTED_UNICAST_ADDRESS "10.0.2.15"
-
-#define EXPECTED_HAS_CONSOLE true
-#define EXPECTED_HAS_FILE true
-#define EXPECTED_HAS_DLT false
-#define EXPECTED_LOGLEVEL "debug"
-#define EXPECTED_LOGFILE "/home/someip/another-file.log"
-
-#define EXPECTED_ROUTING_MANAGER_HOST "my_application"
-
-// Logging
-#define EXPECTED_VERSION_LOGGING_ENABLED false
-#define EXPECTED_VERSION_LOGGING_INTERVAL 15
-
-// Application
-#define EXPECTED_APPLICATION_MAX_DISPATCHERS 25
-#define EXPECTED_APPLICATION_MAX_DISPATCH_TIME 1234
-#define EXPECTED_APPLICATION_THREADS 12
-#define EXPECTED_APPLICATION_REQUEST_DEBOUNCE_TIME 5000
-
-// Services
-#define EXPECTED_UNICAST_ADDRESS_1234_0022 EXPECTED_UNICAST_ADDRESS
-#define EXPECTED_RELIABLE_PORT_1234_0022 30506
-#define EXPECTED_UNRELIABLE_PORT_1234_0022 31000
-
-#define EXPECTED_UNICAST_ADDRESS_1234_0023 EXPECTED_UNICAST_ADDRESS
-#define EXPECTED_RELIABLE_PORT_1234_0023 30503
-#define EXPECTED_UNRELIABLE_PORT_1234_0023 vsomeip::ILLEGAL_PORT
-
-#define EXPECTED_UNICAST_ADDRESS_2277_0022 EXPECTED_UNICAST_ADDRESS
-#define EXPECTED_RELIABLE_PORT_2277_0022 30505
-#define EXPECTED_UNRELIABLE_PORT_2277_0022 31001
-
-#define EXPECTED_UNICAST_ADDRESS_2266_0022 EXPECTED_UNICAST_ADDRESS
-#define EXPECTED_RELIABLE_PORT_2266_0022 30505
-#define EXPECTED_UNRELIABLE_PORT_2266_0022 30507
-
-#define EXPECTED_UNICAST_ADDRESS_4466_0321 "10.0.2.23"
-#define EXPECTED_RELIABLE_PORT_4466_0321 30506
-#define EXPECTED_UNRELIABLE_PORT_4466_0321 30444
-
-// Service Discovery
-#define EXPECTED_SD_ENABLED true
-#define EXPECTED_SD_PROTOCOL "udp"
-#define EXPECTED_SD_MULTICAST "224.212.244.223"
-#define EXPECTED_SD_PORT 30666
-
-#define EXPECTED_INITIAL_DELAY_MIN 1234
-#define EXPECTED_INITIAL_DELAY_MAX 2345
-#define EXPECTED_REPETITIONS_BASE_DELAY 4242
-#define EXPECTED_REPETITIONS_MAX 4
-#define EXPECTED_TTL 13
-#define EXPECTED_CYCLIC_OFFER_DELAY 2132
-#define EXPECTED_REQUEST_RESPONSE_DELAY 1111
-
-#define EXPECTED_DEPRECATED_INITIAL_DELAY_MIN 10
-#define EXPECTED_DEPRECATED_INITIAL_DELAY_MAX 100
-#define EXPECTED_DEPRECATED_REPETITIONS_BASE_DELAY 200
-#define EXPECTED_DEPRECATED_REPETITIONS_MAX 7
-#define EXPECTED_DEPRECATED_TTL 5
-#define EXPECTED_DEPRECATED_REQUEST_RESPONSE_DELAY 2001
-
-template<class T>
-::testing::AssertionResult check(const T &_is, const T &_expected, const std::string &_test) {
- if (_is == _expected) {
- return ::testing::AssertionSuccess() << "Test \"" << _test << "\" succeeded.";
- } else {
- return ::testing::AssertionFailure() << "Test \"" << _test << "\" failed! ("
- << _is << " != " << _expected << ")";
- }
-}
-
-void check_file(const std::string &_config_file,
- const std::string &_expected_unicast_address,
- bool _expected_has_console,
- bool _expected_has_file,
- bool _expected_has_dlt,
- bool _expected_version_logging_enabled,
- uint32_t _expected_version_logging_interval,
- uint32_t _expected_application_max_dispatcher,
- uint32_t _expected_application_max_dispatch_time,
- uint32_t _expected_application_threads,
- uint32_t _expected_application_request_debounce_time,
- const std::string &_expected_logfile,
- const std::string &_expected_loglevel,
- const std::string &_expected_unicast_address_1234_0022,
- uint16_t _expected_reliable_port_1234_0022,
- uint16_t _expected_unreliable_port_1234_0022,
- const std::string &_expected_unicast_address_1234_0023,
- uint16_t _expected_reliable_port_1234_0023,
- uint16_t _expected_unreliable_port_1234_0023,
- const std::string &_expected_unicast_address_2277_0022,
- uint16_t _expected_reliable_port_2277_0022,
- uint16_t _expected_unreliable_port_2277_0022,
- const std::string &_expected_unicast_address_2266_0022,
- uint16_t _expected_reliable_port_2266_0022,
- uint16_t _expected_unreliable_port_2266_0022,
- const std::string &_expected_unicast_address_4466_0321,
- uint16_t _expected_reliable_port_4466_0321,
- uint16_t _expected_unreliable_port_4466_0321,
- bool _expected_enabled,
- const std::string &_expected_protocol,
- const std::string &_expected_multicast,
- uint16_t _expected_port,
- int32_t _expected_initial_delay_min,
- int32_t _expected_initial_delay_max,
- int32_t _expected_repetitions_base_delay,
- uint8_t _expected_repetitions_max,
- vsomeip::ttl_t _expected_ttl,
- vsomeip::ttl_t _expected_cyclic_offer_delay,
- vsomeip::ttl_t _expected_request_response_delay) {
-
- // 0. Create configuration object
- std::shared_ptr<vsomeip::configuration> its_configuration;
- auto its_plugin = vsomeip::plugin_manager::get()->get_plugin(
- vsomeip::plugin_type_e::CONFIGURATION_PLUGIN, VSOMEIP_CFG_LIBRARY);
- if (its_plugin) {
- its_configuration = std::dynamic_pointer_cast<vsomeip::configuration>(its_plugin);
- }
-
- // 1. Did we get a configuration object?
- if (0 == its_configuration) {
- ADD_FAILURE() << "No configuration object. "
- "Either memory overflow or loading error detected!";
- return;
- }
-
- vsomeip::cfg::configuration_impl its_copied_config(
- static_cast<vsomeip::cfg::configuration_impl&>(*its_configuration));
- vsomeip::cfg::configuration_impl* its_new_config =
- new vsomeip::cfg::configuration_impl(its_copied_config);
- delete its_new_config;
-
- // 2. Set environment variable to config file and load it
-#ifndef _WIN32
- setenv("VSOMEIP_CONFIGURATION", _config_file.c_str(), 1);
-#else
- _putenv_s("VSOMEIP_CONFIGURATION", _config_file.c_str()
-#endif
- its_configuration->load(EXPECTED_ROUTING_MANAGER_HOST);
-
- its_configuration->set_configuration_path("/my/test/path");
-
- // 3. Check host address
- boost::asio::ip::address its_host_unicast_address
- = its_configuration->get_unicast_address();
- EXPECT_TRUE(check<std::string>(its_host_unicast_address.to_string(),
- _expected_unicast_address, "UNICAST ADDRESS"));
- EXPECT_TRUE(its_configuration->is_v4());
- EXPECT_FALSE(its_configuration->is_v6());
-
- // check diagnosis prefix
- EXPECT_NE(0x54, its_configuration->get_diagnosis_address());
- EXPECT_EQ(0x55, its_configuration->get_diagnosis_address());
- EXPECT_NE(0x56, its_configuration->get_diagnosis_address());
-
- // 4. Check logging
- bool has_console = its_configuration->has_console_log();
- bool has_file = its_configuration->has_file_log();
- bool has_dlt = its_configuration->has_dlt_log();
- std::string logfile = its_configuration->get_logfile();
- boost::log::trivial::severity_level loglevel
- = its_configuration->get_loglevel();
- bool has_version_logging = its_configuration->log_version();
- std::uint32_t version_logging_interval = its_configuration->get_log_version_interval();
-
- EXPECT_TRUE(check<bool>(has_console, _expected_has_console, "HAS CONSOLE"));
- EXPECT_TRUE(check<bool>(has_file, _expected_has_file, "HAS FILE"));
- EXPECT_TRUE(check<bool>(has_dlt, _expected_has_dlt, "HAS DLT"));
- EXPECT_TRUE(check<std::string>(logfile, _expected_logfile, "LOGFILE"));
- EXPECT_TRUE(check<std::string>(boost::log::trivial::to_string(loglevel),
- _expected_loglevel, "LOGLEVEL"));
- EXPECT_TRUE(check<bool>(has_version_logging, _expected_version_logging_enabled,
- "VERSION LOGGING"));
- EXPECT_TRUE(check<uint32_t>(version_logging_interval,
- _expected_version_logging_interval,
- "VERSION LOGGING INTERVAL"));
-
- // watchdog
- EXPECT_TRUE(its_configuration->is_watchdog_enabled());
- EXPECT_EQ(1234u, its_configuration->get_watchdog_timeout());
- EXPECT_EQ(7u, its_configuration->get_allowed_missing_pongs());
-
- // file permissions
- EXPECT_EQ(0444u, its_configuration->get_permissions_shm());
- EXPECT_EQ(0222u, its_configuration->get_umask());
-
- // selective broadcasts
- EXPECT_TRUE(its_configuration->supports_selective_broadcasts(
- boost::asio::ip::address::from_string("160.160.160.160")));
-
- // tracing
- std::shared_ptr<vsomeip::cfg::trace> its_trace = its_configuration->get_trace();
- EXPECT_TRUE(its_trace->is_enabled_);
- EXPECT_TRUE(its_trace->is_sd_enabled_);
- EXPECT_EQ(2u, its_trace->channels_.size());
- EXPECT_EQ(2u, its_trace->filter_rules_.size());
- for (const auto &c : its_trace->channels_) {
- EXPECT_TRUE(c->name_ == std::string("testname") || c->name_ == std::string("testname2"));
- if (c->name_ == std::string("testname")) {
- EXPECT_EQ(std::string("testid"), c->id_);
- } else if (c->name_ == std::string("testname2")) {
- EXPECT_EQ(std::string("testid2"), c->id_);
- }
- }
- for (const auto &f : its_trace->filter_rules_) {
- EXPECT_TRUE(f->channel_ == std::string("testname") || f->channel_ == std::string("testname2"));
- if (f->channel_ == std::string("testname")) {
- EXPECT_EQ(2u, f->services_.size());
- EXPECT_EQ(2u, f->methods_.size());
- EXPECT_EQ(2u, f->clients_.size());
- for (const vsomeip::service_t s : f->services_) {
- EXPECT_TRUE(s == vsomeip::service_t(0x1111) || s == vsomeip::service_t(2222));
- }
- for (const vsomeip::method_t s : f->methods_) {
- EXPECT_TRUE(s == vsomeip::method_t(0x1111) || s == vsomeip::method_t(2222));
- }
- for (const vsomeip::client_t s : f->clients_) {
- EXPECT_TRUE(s == vsomeip::client_t(0x1111) || s == vsomeip::client_t(2222));
- }
- } else if (f->channel_ == std::string("testname2")) {
- EXPECT_EQ(2u, f->services_.size());
- EXPECT_EQ(2u, f->methods_.size());
- EXPECT_EQ(2u, f->clients_.size());
- for (const vsomeip::service_t s : f->services_) {
- EXPECT_TRUE(s == vsomeip::service_t(0x3333) || s == vsomeip::service_t(4444));
- }
- for (const vsomeip::method_t s : f->methods_) {
- EXPECT_TRUE(s == vsomeip::method_t(0x3333) || s == vsomeip::method_t(4444));
- }
- for (const vsomeip::client_t s : f->clients_) {
- EXPECT_TRUE(s == vsomeip::client_t(0x3333) || s == vsomeip::client_t(4444));
- }
- }
- }
-
- // Applications
- std::size_t max_dispatchers = its_configuration->get_max_dispatchers(
- EXPECTED_ROUTING_MANAGER_HOST);
- std::size_t max_dispatch_time = its_configuration->get_max_dispatch_time(
- EXPECTED_ROUTING_MANAGER_HOST);
- std::size_t io_threads = its_configuration->get_io_thread_count(
- EXPECTED_ROUTING_MANAGER_HOST);
- std::size_t request_time = its_configuration->get_request_debouncing(
- EXPECTED_ROUTING_MANAGER_HOST);
-
- EXPECT_TRUE(check<std::size_t>(max_dispatchers,
- _expected_application_max_dispatcher, "MAX DISPATCHERS"));
- EXPECT_TRUE(check<std::size_t>(max_dispatch_time,
- _expected_application_max_dispatch_time, "MAX DISPATCH TIME"));
- EXPECT_TRUE(check<std::size_t>(io_threads, _expected_application_threads,
- "IO THREADS"));
- EXPECT_TRUE(check<std::size_t>(request_time,
- _expected_application_request_debounce_time, "REQUEST DEBOUNCE TIME"));
-
- EXPECT_EQ(0x9933, its_configuration->get_id("other_application"));
-
- std::map<vsomeip::plugin_type_e, std::set<std::string>> its_plugins =
- its_configuration->get_plugins(EXPECTED_ROUTING_MANAGER_HOST);
- EXPECT_EQ(1u, its_plugins.size());
- for (const auto plugin : its_plugins) {
- EXPECT_EQ(vsomeip::plugin_type_e::APPLICATION_PLUGIN, plugin.first);
- for (auto its_library : plugin.second)
- EXPECT_EQ(std::string("libtestlibraryname.so." + std::to_string(VSOMEIP_APPLICATION_PLUGIN_VERSION)), its_library);
- }
- EXPECT_EQ(vsomeip::plugin_type_e::CONFIGURATION_PLUGIN, its_plugin->get_plugin_type());
- EXPECT_EQ("vsomeip cfg plugin", its_plugin->get_plugin_name());
- EXPECT_EQ(1u, its_plugin->get_plugin_version());
-
-
- // 5. Services
- std::string its_unicast_address
- = its_configuration->get_unicast_address(0x1234, 0x0022);
- uint16_t its_reliable_port
- = its_configuration->get_reliable_port(0x1234, 0x0022);
- uint16_t its_unreliable_port
- = its_configuration->get_unreliable_port(0x1234, 0x0022);
-
- EXPECT_TRUE(check<std::string>(its_unicast_address,
- _expected_unicast_address_1234_0022,
- "UNICAST_ADDRESS_1234_0022"));
- EXPECT_TRUE(check<uint16_t>(its_reliable_port,
- _expected_reliable_port_1234_0022,
- "RELIABLE_PORT_1234_0022"));
- EXPECT_TRUE(check<uint16_t>(its_unreliable_port,
- _expected_unreliable_port_1234_0022,
- "UNRELIABLE_PORT_1234_0022"));
-
- its_unicast_address
- = its_configuration->get_unicast_address(0x1234, 0x0023);
- its_reliable_port
- = its_configuration->get_reliable_port(0x1234, 0x0023);
- its_unreliable_port
- = its_configuration->get_unreliable_port(0x1234, 0x0023);
-
- EXPECT_TRUE(check<std::string>(its_unicast_address,
- _expected_unicast_address_1234_0023,
- "UNICAST_ADDRESS_1234_0023"));
- EXPECT_TRUE(check<uint16_t>(its_reliable_port,
- _expected_reliable_port_1234_0023,
- "RELIABLE_PORT_1234_0023"));
- EXPECT_TRUE(check<uint16_t>(its_unreliable_port,
- _expected_unreliable_port_1234_0023,
- "UNRELIABLE_PORT_1234_0023"));
-
- its_unicast_address
- = its_configuration->get_unicast_address(0x2277, 0x0022);
- its_reliable_port
- = its_configuration->get_reliable_port(0x2277, 0x0022);
- its_unreliable_port
- = its_configuration->get_unreliable_port(0x2277, 0x0022);
-
- EXPECT_TRUE(check<std::string>(its_unicast_address,
- _expected_unicast_address_2277_0022,
- "UNICAST_ADDRESS_2277_0022"));
- EXPECT_TRUE(check<uint16_t>(its_reliable_port,
- _expected_reliable_port_2277_0022,
- "RELIABLE_PORT_2277_0022"));
- EXPECT_TRUE(check<uint16_t>(its_unreliable_port,
- _expected_unreliable_port_2277_0022,
- "UNRELIABLE_PORT_2277_0022"));
-
- its_unicast_address
- = its_configuration->get_unicast_address(0x2266, 0x0022);
- its_reliable_port
- = its_configuration->get_reliable_port(0x2266, 0x0022);
- its_unreliable_port
- = its_configuration->get_unreliable_port(0x2266, 0x0022);
-
- EXPECT_TRUE(check<std::string>(its_unicast_address,
- _expected_unicast_address_2266_0022,
- "UNICAST_ADDRESS_2266_0022"));
- EXPECT_TRUE(check<uint16_t>(its_reliable_port,
- _expected_reliable_port_2266_0022,
- "RELIABLE_PORT_2266_0022"));
- EXPECT_TRUE(check<uint16_t>(its_unreliable_port,
- _expected_unreliable_port_2266_0022,
- "UNRELIABLE_PORT_2266_0022"));
-
- its_unicast_address
- = its_configuration->get_unicast_address(0x4466, 0x0321);
- its_reliable_port
- = its_configuration->get_reliable_port(0x4466, 0x0321);
- its_unreliable_port
- = its_configuration->get_unreliable_port(0x4466, 0x0321);
-
- EXPECT_TRUE(check<std::string>(its_unicast_address,
- _expected_unicast_address_4466_0321,
- "UNICAST_ADDRESS_4466_0321"));
- EXPECT_TRUE(check<uint16_t>(its_reliable_port,
- _expected_reliable_port_4466_0321,
- "RELIABLE_PORT_4466_0321"));
- EXPECT_TRUE(check<uint16_t>(its_unreliable_port,
- _expected_unreliable_port_4466_0321,
- "UNRELIABLE_PORT_4466_0321"));
-
- std::string its_multicast_address;
- std::uint16_t its_multicast_port;
- its_configuration->get_multicast(0x7809, 0x1, 0x1111,
- its_multicast_address, its_multicast_port);
- EXPECT_EQ(1234u, its_multicast_port);
- EXPECT_EQ(std::string("224.212.244.225"), its_multicast_address);
- EXPECT_EQ(8u, its_configuration->get_threshold(0x7809, 0x1, 0x1111));
-
- EXPECT_TRUE(its_configuration->is_offered_remote(0x1234,0x0022));
- EXPECT_FALSE(its_configuration->is_offered_remote(0x3333,0x1));
-
- EXPECT_TRUE(its_configuration->has_enabled_magic_cookies("10.0.2.15", 30506));
- EXPECT_FALSE(its_configuration->has_enabled_magic_cookies("10.0.2.15", 30503));
-
- std::set<std::pair<vsomeip::service_t, vsomeip::instance_t>> its_remote_services =
- its_configuration->get_remote_services();
- EXPECT_EQ(1u, its_remote_services.size());
- for (const auto &p : its_remote_services) {
- EXPECT_EQ(0x4466, p.first);
- EXPECT_EQ(0x321, p.second);
- }
-
- EXPECT_TRUE(its_configuration->is_someip(0x3333,0x1));
- EXPECT_FALSE(its_configuration->is_someip(0x3555,0x1));
-
- // Internal services
- EXPECT_TRUE(its_configuration->is_local_service(0x1234, 0x0022));
- EXPECT_TRUE(its_configuration->is_local_service(0x3333,0x1));
- // defined range, service level only
- EXPECT_FALSE(its_configuration->is_local_service(0xF0FF,0x1));
- EXPECT_TRUE(its_configuration->is_local_service(0xF100,0x1));
- EXPECT_TRUE(its_configuration->is_local_service(0xF101,0x23));
- EXPECT_TRUE(its_configuration->is_local_service(0xF109,0xFFFF));
- EXPECT_FALSE(its_configuration->is_local_service(0xF10a,0x1));
- // defined range, service and instance level
- EXPECT_FALSE(its_configuration->is_local_service(0xF2FF,0xFFFF));
- EXPECT_TRUE(its_configuration->is_local_service(0xF300,0x1));
- EXPECT_TRUE(its_configuration->is_local_service(0xF300,0x5));
- EXPECT_TRUE(its_configuration->is_local_service(0xF300,0x10));
- EXPECT_FALSE(its_configuration->is_local_service(0xF300,0x11));
- EXPECT_FALSE(its_configuration->is_local_service(0xF301,0x11));
-
- // clients
- std::map<bool, std::set<uint16_t>> used_ports;
- used_ports[true].insert(0x11);
- used_ports[false].insert(0x10);
- std::uint16_t port_to_use(0x0);
- EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x1, vsomeip::ILLEGAL_PORT, true, used_ports, port_to_use));
- EXPECT_EQ(0x10, port_to_use);
- EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x1, vsomeip::ILLEGAL_PORT, false, used_ports, port_to_use));
- EXPECT_EQ(0x11, port_to_use);
-
- used_ports[true].insert(0x10);
- used_ports[false].insert(0x11);
- EXPECT_FALSE(its_configuration->get_client_port(0x8888, 0x1, vsomeip::ILLEGAL_PORT, true, used_ports, port_to_use));
- EXPECT_EQ(vsomeip::ILLEGAL_PORT, port_to_use);
- EXPECT_FALSE(its_configuration->get_client_port(0x8888, 0x1, vsomeip::ILLEGAL_PORT, false, used_ports, port_to_use));
- EXPECT_EQ(vsomeip::ILLEGAL_PORT, port_to_use);
-
-
- //check for correct client port assignment if service / instance was not configured but a remote port range
- used_ports.clear();
- EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7725, true, used_ports, port_to_use));
- EXPECT_EQ(0x771B, port_to_use);
- used_ports[true].insert(0x771B);
- EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7725, true, used_ports, port_to_use));
- EXPECT_EQ(0x771C, port_to_use);
- used_ports[true].insert(0x771C);
- EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7B0D, true, used_ports, port_to_use));
- EXPECT_EQ(0x7B03, port_to_use);
- used_ports[true].insert(0x7B03);
- EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7B0D, true, used_ports, port_to_use));
- EXPECT_EQ(0x7B04, port_to_use);
- used_ports[true].insert(0x7B04);
- EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7EF4, true, used_ports, port_to_use));
- EXPECT_EQ(0x7EEB, port_to_use);
- used_ports[true].insert(0x7EEB);
- EXPECT_TRUE(its_configuration->get_client_port(0x8888, 0x12, 0x7EF4, true, used_ports, port_to_use));
- EXPECT_EQ(0x7EEC, port_to_use);
- used_ports[true].insert(0x7EEC);
- used_ports.clear();
-
-
- // payload sizes
- // use 17000 instead of 1500 as configured max-local-payload size will be
- // increased to bigger max-reliable-payload-size
- std::uint32_t max_local_message_size(
- 17000u + 16u + + VSOMEIP_COMMAND_HEADER_SIZE
- + sizeof(vsomeip::instance_t) + sizeof(bool) + sizeof(bool)
- + sizeof(vsomeip::client_t));
- EXPECT_EQ(max_local_message_size, its_configuration->get_max_message_size_local());
- EXPECT_EQ(11u, its_configuration->get_buffer_shrink_threshold());
- EXPECT_EQ(14999u + 16u, its_configuration->get_max_message_size_reliable("10.10.10.10", 7777));
- EXPECT_EQ(17000u + 16, its_configuration->get_max_message_size_reliable("11.11.11.11", 4711));
- EXPECT_EQ(15001u + 16, its_configuration->get_max_message_size_reliable("10.10.10.11", 7778));
-
- // security
- EXPECT_TRUE(its_configuration->is_security_enabled());
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1277, 0x1234, 0x5678));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1277, 0x1234, 0x5679));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1277, 0x1233, 0x5679));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1266, 0x1233, 0x5679));
- // explicitly denied offers
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1443, 0x1234, 0x5678));
- EXPECT_FALSE(its_configuration->is_offer_allowed(0x1443, 0x1235, 0x5678));
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1443, 0x1234, 0x5679));
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1443, 0x1300, 0x1));
- EXPECT_TRUE(its_configuration->is_offer_allowed(0x1443, 0x1300, 0x2));
-
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5678));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1346, 0x1234, 0x5678));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1347, 0x1234, 0x5678));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1342, 0x1234, 0x5678));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1234, 0x5679));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1343, 0x1230, 0x5678));
- // explicitly denied requests
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5678));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1446, 0x1234, 0x5678));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5679));
- EXPECT_TRUE(its_configuration->is_client_allowed(0x1443, 0x1234, 0x5679));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1442, 0x1234, 0x5678));
- EXPECT_FALSE(its_configuration->is_client_allowed(0x1447, 0x1234, 0x5678));
-
- EXPECT_TRUE(its_configuration->check_credentials(0x1277, 1000, 1000));
- EXPECT_FALSE(its_configuration->check_credentials(0x1277, 1001, 1001));
- EXPECT_FALSE(its_configuration->check_credentials(0x1278, 1000, 1000));
-
- // 6. Service discovery
- bool enabled = its_configuration->is_sd_enabled();
- std::string protocol = its_configuration->get_sd_protocol();
- uint16_t port = its_configuration->get_sd_port();
- std::string multicast = its_configuration->get_sd_multicast();
-
- int32_t initial_delay_min = its_configuration->get_sd_initial_delay_min();
- int32_t initial_delay_max = its_configuration->get_sd_initial_delay_max();
- int32_t repetitions_base_delay = its_configuration->get_sd_repetitions_base_delay();
- uint8_t repetitions_max = its_configuration->get_sd_repetitions_max();
- vsomeip::ttl_t ttl = its_configuration->get_sd_ttl();
- int32_t cyclic_offer_delay = its_configuration->get_sd_cyclic_offer_delay();
- int32_t request_response_delay = its_configuration->get_sd_request_response_delay();
-
- EXPECT_TRUE(check<bool>(enabled, _expected_enabled, "SD ENABLED"));
- EXPECT_TRUE(check<std::string>(protocol, _expected_protocol, "SD PROTOCOL"));
- EXPECT_TRUE(check<std::string>(multicast, _expected_multicast, "SD MULTICAST"));
- EXPECT_TRUE(check<uint16_t>(port, _expected_port, "SD PORT"));
-
- EXPECT_TRUE(check<int32_t>(initial_delay_min, _expected_initial_delay_min, "SD INITIAL DELAY MIN"));
- EXPECT_TRUE(check<int32_t>(initial_delay_max, _expected_initial_delay_max, "SD INITIAL DELAY MAX"));
- EXPECT_TRUE(check<int32_t>(repetitions_base_delay, _expected_repetitions_base_delay, "SD REPETITION BASE DELAY"));
- EXPECT_TRUE(check<uint8_t>(repetitions_max,_expected_repetitions_max, "SD REPETITION MAX"));
- EXPECT_TRUE(check<vsomeip::ttl_t>(ttl, _expected_ttl, "SD TTL"));
- EXPECT_TRUE(check<int32_t>(cyclic_offer_delay, _expected_cyclic_offer_delay, "SD CYCLIC OFFER DELAY"));
- EXPECT_TRUE(check<int32_t>(request_response_delay, _expected_request_response_delay, "SD RESPONSE REQUEST DELAY"));
- EXPECT_EQ(1000u, its_configuration->get_sd_offer_debounce_time());
-
- ASSERT_TRUE(vsomeip::plugin_manager::get()->unload_plugin(vsomeip::plugin_type_e::CONFIGURATION_PLUGIN));
-}
-
-TEST(configuration_test, check_config_file) {
- // Check current configuration file format
- check_file(CONFIGURATION_FILE,
- EXPECTED_UNICAST_ADDRESS,
- EXPECTED_HAS_CONSOLE,
- EXPECTED_HAS_FILE,
- EXPECTED_HAS_DLT,
- EXPECTED_VERSION_LOGGING_ENABLED,
- EXPECTED_VERSION_LOGGING_INTERVAL,
- EXPECTED_APPLICATION_MAX_DISPATCHERS,
- EXPECTED_APPLICATION_MAX_DISPATCH_TIME,
- EXPECTED_APPLICATION_THREADS,
- EXPECTED_APPLICATION_REQUEST_DEBOUNCE_TIME,
- EXPECTED_LOGFILE,
- EXPECTED_LOGLEVEL,
- EXPECTED_UNICAST_ADDRESS_1234_0022,
- EXPECTED_RELIABLE_PORT_1234_0022,
- EXPECTED_UNRELIABLE_PORT_1234_0022,
- EXPECTED_UNICAST_ADDRESS_1234_0023,
- EXPECTED_RELIABLE_PORT_1234_0023,
- EXPECTED_UNRELIABLE_PORT_1234_0023,
- EXPECTED_UNICAST_ADDRESS_2277_0022,
- EXPECTED_RELIABLE_PORT_2277_0022,
- EXPECTED_UNRELIABLE_PORT_2277_0022,
- EXPECTED_UNICAST_ADDRESS_2266_0022,
- EXPECTED_RELIABLE_PORT_2266_0022,
- EXPECTED_UNRELIABLE_PORT_2266_0022,
- EXPECTED_UNICAST_ADDRESS_4466_0321,
- EXPECTED_RELIABLE_PORT_4466_0321,
- EXPECTED_UNRELIABLE_PORT_4466_0321,
- EXPECTED_SD_ENABLED,
- EXPECTED_SD_PROTOCOL,
- EXPECTED_SD_MULTICAST,
- EXPECTED_SD_PORT,
- EXPECTED_INITIAL_DELAY_MIN,
- EXPECTED_INITIAL_DELAY_MAX,
- EXPECTED_REPETITIONS_BASE_DELAY,
- EXPECTED_REPETITIONS_MAX,
- EXPECTED_TTL,
- EXPECTED_CYCLIC_OFFER_DELAY,
- EXPECTED_REQUEST_RESPONSE_DELAY);
-}
-
-TEST(configuration_test, check_deprecated_config_file) {
- // Check deprecated configuration file format
- check_file(DEPRECATED_CONFIGURATION_FILE,
- EXPECTED_UNICAST_ADDRESS,
- EXPECTED_HAS_CONSOLE,
- EXPECTED_HAS_FILE,
- EXPECTED_HAS_DLT,
- EXPECTED_VERSION_LOGGING_ENABLED,
- EXPECTED_VERSION_LOGGING_INTERVAL,
- EXPECTED_APPLICATION_MAX_DISPATCHERS,
- EXPECTED_APPLICATION_MAX_DISPATCH_TIME,
- EXPECTED_APPLICATION_THREADS,
- EXPECTED_APPLICATION_REQUEST_DEBOUNCE_TIME,
- EXPECTED_LOGFILE,
- EXPECTED_LOGLEVEL,
- EXPECTED_UNICAST_ADDRESS_1234_0022,
- EXPECTED_RELIABLE_PORT_1234_0022,
- EXPECTED_UNRELIABLE_PORT_1234_0022,
- EXPECTED_UNICAST_ADDRESS_1234_0023,
- EXPECTED_RELIABLE_PORT_1234_0023,
- EXPECTED_UNRELIABLE_PORT_1234_0023,
- EXPECTED_UNICAST_ADDRESS_2277_0022,
- EXPECTED_RELIABLE_PORT_2277_0022,
- EXPECTED_UNRELIABLE_PORT_2277_0022,
- EXPECTED_UNICAST_ADDRESS_2266_0022,
- EXPECTED_RELIABLE_PORT_2266_0022,
- EXPECTED_UNRELIABLE_PORT_2266_0022,
- EXPECTED_UNICAST_ADDRESS_4466_0321,
- EXPECTED_RELIABLE_PORT_4466_0321,
- EXPECTED_UNRELIABLE_PORT_4466_0321,
- EXPECTED_SD_ENABLED,
- EXPECTED_SD_PROTOCOL,
- EXPECTED_SD_MULTICAST,
- EXPECTED_SD_PORT,
- EXPECTED_DEPRECATED_INITIAL_DELAY_MIN,
- EXPECTED_DEPRECATED_INITIAL_DELAY_MAX,
- EXPECTED_DEPRECATED_REPETITIONS_BASE_DELAY,
- EXPECTED_DEPRECATED_REPETITIONS_MAX,
- EXPECTED_DEPRECATED_TTL,
- EXPECTED_CYCLIC_OFFER_DELAY,
- EXPECTED_DEPRECATED_REQUEST_RESPONSE_DELAY);
-}
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
diff --git a/test/configuration_tests/configuration-test.json b/test/configuration_tests/configuration-test.json
deleted file mode 100644
index 32d11d7..0000000
--- a/test/configuration_tests/configuration-test.json
+++ /dev/null
@@ -1,336 +0,0 @@
-{
- "unicast" : "10.0.2.15",
- "diagnosis" : "0x55",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "true", "path" : "/home/someip/another-file.log" },
- "dlt" : "false",
- "version" : {
- "enable" : "false",
- "interval" : "15"
- }
- },
- "watchdog" :
- {
- "enable" : "true",
- "timeout" : "1234",
- "allowed_missing_pongs" : "7"
- },
- "file-permissions" :
- {
- "permissions-shm" : "0444",
- "umask" : "0222"
- },
- "supports_selective_broadcasts" :
- {
- "address" : "160.160.160.160"
- },
- "tracing" :
- {
- "enable" : "true",
- "sd_enable" : "true",
- "channels" :
- [
- {
- "name" : "testname",
- "id" : "testid"
- },
- {
- "name" : "testname2",
- "id" : "testid2"
- }
- ],
- "filters" :
- [
- {
- "channel" : "testname",
- "services" : ["0x1111",2222],
- "methods" : ["0x1111",2222],
- "clients" : ["0x1111",2222]
- },
- {
- "channel" : "testname2",
- "services" : ["0x3333",4444],
- "methods" : ["0x3333",4444],
- "clients" : ["0x3333",4444]
- }
- ]
- },
- "applications" :
- [
- {
- "name" : "my_application",
- "id" : "0x7788",
- "max_dispatchers" : "25",
- "max_dispatch_time" : "1234",
- "threads" : "12",
- "request_debounce_time" : "5000",
- "plugins" :
- [
- {
- "application_plugin" : "testlibraryname"
- },
- {
- "intentionally_wrong_plugin" : "wrong"
- }
- ]
- },
- {
- "name" : "other_application",
- "id" : "0x9933",
- "threads" : "0",
- "threads" : "256",
- "request_debounce_time" : "10001"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x0022",
- "unicast" : "local",
- "reliable" : { "port" : "30506", "enable-magic-cookies" : "true" },
- "unreliable" : "31000",
- "events" :
- [
- {
- "event" : "0x0778",
- "is_field" : "false"
- },
- {
- "event" : "0x779",
- "is_field" : "true"
- },
- {
- "event" : "0x77A",
- "is_field" : "false"
- }
- ],
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4567",
- "multicast" : "225.226.227.228",
- "events" : [ "0x778", "0x779" ]
- },
- {
- "eventgroup" : "0x4569",
- "multicast" : "225.227.227.228",
- "events" : [ "0x779", "0x77A" ]
- },
- {
- "eventgroup" : "0x4569",
- "multicast" : "225.222.227.228",
- "events" : [ "0x778", "0x77A" ]
- }
- ]
- },
- {
- "service" : "0x1234",
- "instance" : "0x0023",
- "reliable" : "30503"
- },
- {
- "service" : "0x2277",
- "instance" : "0x0022",
- "reliable" : { "port" : "30505" },
- "unreliable" : "31001"
- },
- {
- "service" : "0x2266",
- "instance" : "0x0022",
- "reliable" : "30505",
- "unreliable" : "30507"
- },
- {
- "service" : "0x4466",
- "instance" : "0x0321",
- "unicast" : "10.0.2.23",
- "reliable" : "30506",
- "unreliable" : "30444"
- },
- {
- "service" : "0x3333",
- "instance" : "0x1"
- },
- {
- "service" : "0x7809",
- "instance" : "0x1",
- "multicast" :
- {
- "address" : "224.212.244.225",
- "port" : "1234"
- },
- "eventgroups" :
- [
- {
- "eventgroup" : "0x1111",
- "threshold" : "8",
- "is_multicast" : "true",
- "events" : [ "0x778", "0x77A" ]
- }
- ]
- },
- {
- "service" : "0x3555",
- "instance" : "0x1",
- "protocol" : "other"
- }
- ],
- "internal_services" :
- [
- {
- "first" : "0xF100",
- "last" : "0xF109"
- },
- {
- "first" : {
- "service" : "0xF300",
- "instance" : "0x1"
- },
- "last" : {
- "service" : "0xF300",
- "instance" : "0x10"
- }
- }
- ],
- "clients" :
- [
- {
- "reliable_remote_ports" : { "first" : "30500", "last" : "30599" },
- "unreliable_remote_ports" : { "first" : "30500", "last" : "30599" },
- "reliable_client_ports" : { "first" : "30491", "last" : "30499" },
- "unreliable_client_ports" : { "first" : "30491", "last" : "30499" }
- },
- {
- "reliable_remote_ports" : { "first" : "31500", "last" : "31599" },
- "unreliable_remote_ports" : { "first" : "31500", "last" : "31599" },
- "reliable_client_ports" : { "first" : "31491", "last" : "31499" },
- "unreliable_client_ports" : { "first" : "31491", "last" : "31499" }
- },
- {
- "reliable_remote_ports" : { "first" : "32500", "last" : "32599" },
- "unreliable_remote_ports" : { "first" : "32500", "last" : "32599" },
- "reliable_client_ports" : { "first" : "32491", "last" : "32499" },
- "unreliable_client_ports" : { "first" : "32491", "last" : "32499" }
- },
- {
- "service" : "0x8888",
- "instance" : "0x1",
- "unreliable" : [ "0x11", "0x10" ],
- "reliable" : [ "0x11", "0x10" ]
- },
- {
- "service" : "8888",
- "instance" : "1",
- "unreliable" : [ 40000, 40001 ],
- "reliable" : [ 40000, 40001 ]
- }
- ],
- "max-payload-size-local" : "15000",
- "max-payload-size-reliable" : "17000",
- "buffer-shrink-threshold" : "11",
- "payload-sizes":
- [
- {
- "unicast":"10.10.10.10",
- "ports":
- [
- {
- "port":"7777",
- "max-payload-size":"14999"
- }
- ]
- },
- {
- "unicast":"10.10.10.11",
- "ports":
- [
- {
- "port":"7778",
- "max-payload-size":"15001"
- }
- ]
- }
- ],
- "security" :
- {
- "check_credentials" : "true",
- "policies" :
- [
- {
- "client" : "0x1277",
- "credentials" : { "uid" : "1000", "gid" : "1000" },
- "allow" :
- {
- "offers":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678"
- }
- ]
- }
- },
- {
- "client" : { "first" : "0x1343", "last" : "0x1346" },
- "allow" :
- {
- "requests":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
- }
- },
- {
- "client" : { "first" : "0x1443", "last" : "0x1446" },
- "deny" :
- {
- "requests":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ],
- "offers":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- },
- {
- "service" : "0x1235",
- "instance" : "0x5678"
- }
- ]
- }
- }
- ]
- },
- "routing" : "my_application",
- "service-discovery" :
- {
- "enable" : "true",
- "protocol" : "udp",
- "multicast" : "224.212.244.223",
- "port" : "30666",
- "initial_delay_min" : "1234",
- "initial_delay_max" : "2345",
- "repetitions_base_delay" : "4242",
- "repetitions_max" : "4",
- "ttl" : "13",
- "cyclic_offer_delay" : "2132",
- "request_response_delay" : "1111",
- "offer_debounce_time" : "1000"
- }
-} \ No newline at end of file
diff --git a/test/cpu_load_tests/conf/cpu_load_test_client_master.json.in b/test/cpu_load_tests/conf/cpu_load_test_client_master.json.in
deleted file mode 100644
index d623758..0000000
--- a/test/cpu_load_tests/conf/cpu_load_test_client_master.json.in
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "unicast" : "@TEST_IP_MASTER@",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/var/log/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "cpu_load_test_client",
- "id" : "0x2222"
- }
- ],
- "routing" : "cpu_load_test_client",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-}
diff --git a/test/cpu_load_tests/conf/cpu_load_test_client_slave.json.in b/test/cpu_load_tests/conf/cpu_load_test_client_slave.json.in
deleted file mode 100644
index 36de379..0000000
--- a/test/cpu_load_tests/conf/cpu_load_test_client_slave.json.in
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "unicast" : "@TEST_IP_SLAVE@",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/var/log/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "cpu_load_test_client",
- "id" : "0x2222"
- }
- ],
- "routing" : "cpu_load_test_client",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-}
diff --git a/test/cpu_load_tests/conf/cpu_load_test_service_master.json.in b/test/cpu_load_tests/conf/cpu_load_test_service_master.json.in
deleted file mode 100644
index d836650..0000000
--- a/test/cpu_load_tests/conf/cpu_load_test_service_master.json.in
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "unicast" : "@TEST_IP_MASTER@",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "cpu_load_test_service",
- "id" : "0x1111"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1111",
- "instance" : "0x1",
- "unreliable" : "30510",
- "reliable" :
- {
- "port" : "30510",
- "enable-magic-cookies" : "false"
- }
- }
- ],
-
- "routing" : "cpu_load_test_service",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-}
diff --git a/test/cpu_load_tests/conf/cpu_load_test_service_slave.json.in b/test/cpu_load_tests/conf/cpu_load_test_service_slave.json.in
deleted file mode 100644
index 78e1909..0000000
--- a/test/cpu_load_tests/conf/cpu_load_test_service_slave.json.in
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "unicast" : "@TEST_IP_SLAVE@",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "cpu_load_test_service",
- "id" : "0x1111"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1111",
- "instance" : "0x1",
- "unreliable" : "30510",
- "reliable" :
- {
- "port" : "30510",
- "enable-magic-cookies" : "false"
- }
- }
- ],
-
- "routing" : "cpu_load_test_service",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-}
diff --git a/test/cpu_load_tests/cpu_load_measurer.cpp b/test/cpu_load_tests/cpu_load_measurer.cpp
deleted file mode 100644
index 2261d22..0000000
--- a/test/cpu_load_tests/cpu_load_measurer.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright (C) 2015-2017 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 "cpu_load_measurer.hpp"
-
-#include <fstream>
-#include <string>
-#include <iostream>
-#include <sstream>
-#include <vector>
-#include <stdexcept>
-#include <cstdio>
-
-#include <sys/types.h>
-#include <unistd.h>
-
-cpu_load_measurer::~cpu_load_measurer() {
-}
-
-cpu_load_measurer::cpu_load_measurer(std::uint32_t _pid) :
- pid_(_pid),
- jiffies_complete_start_(0),
- jiffies_idle_start_(0),
- jiffies_complete_stop_(0),
- jiffies_idle_stop_(0),
- clock_ticks_(0),
- jiffies_passed_pid_start_(0),
- jiffies_passed_pid_stop_(0),
- cpu_load_pid_(0.0),
- cpu_load_overall_(0.0),
- cpu_load_pid_wo_idle_(0.0) {
-}
-
-void cpu_load_measurer::start() {
- // reset everything
- jiffies_complete_start_ = 0;
- jiffies_idle_start_ = 0;
- jiffies_complete_stop_ = 0;
- jiffies_idle_stop_ = 0;
- clock_ticks_ = 0;
- jiffies_passed_pid_start_ = 0;
- jiffies_passed_pid_stop_ = 0;
- cpu_load_pid_= 0.0;
- cpu_load_overall_ = 0.0;
- cpu_load_pid_wo_idle_ = 0.0;
- //start
- jiffies_complete_start_ = read_proc_stat(&jiffies_idle_start_);
- jiffies_passed_pid_start_ = read_proc_pid_stat();
-}
-
-void cpu_load_measurer::stop() {
- jiffies_complete_stop_ = read_proc_stat(&jiffies_idle_stop_);
- jiffies_passed_pid_stop_ = read_proc_pid_stat();
- if(jiffies_complete_stop_ < jiffies_complete_start_ || jiffies_passed_pid_stop_ < jiffies_passed_pid_start_) {
- std::cerr << "Overflow of values in procfs occured, can't calculate load" << std::endl;
- exit(0);
- }
- cpu_load_pid_ = 100.0
- * static_cast<double>(jiffies_passed_pid_stop_
- - jiffies_passed_pid_start_)
- / static_cast<double>(jiffies_complete_stop_
- - jiffies_complete_start_);
- cpu_load_overall_ = 100.0
- * static_cast<double>((jiffies_complete_stop_ - jiffies_idle_stop_)
- - (jiffies_complete_start_ - jiffies_idle_start_))
- / static_cast<double>(jiffies_complete_stop_
- - jiffies_complete_start_);
- cpu_load_pid_wo_idle_ = 100.0
- * static_cast<double>(jiffies_passed_pid_stop_
- - jiffies_passed_pid_start_)
- / static_cast<double>((jiffies_complete_stop_ - jiffies_idle_stop_)
- - (jiffies_complete_start_ - jiffies_idle_start_));
-
-}
-
-void cpu_load_measurer::print_cpu_load() const {
- std::cout << "Used Jiffies complete: "
- << jiffies_complete_stop_ - jiffies_complete_start_ << " (worked: "
- << (jiffies_complete_stop_ - jiffies_idle_stop_)
- - (jiffies_complete_start_ - jiffies_idle_start_)
- << " idled: " << jiffies_idle_stop_ - jiffies_idle_start_
- << ")" << std::endl;
- std::cout << "Used Jiffies of pid " << pid_ << ": " << jiffies_passed_pid_stop_ - jiffies_passed_pid_start_ << std::endl;
- std::cout << "Cpu load pid " << pid_ << " [%]: " << cpu_load_pid_ << std::endl;
- std::cout << "Overall cpu load[%]: " << cpu_load_overall_ << std::endl;
- std::cout << "Load caused by pid " << pid_ << " of overall cpu load [%]:" << cpu_load_pid_wo_idle_ << std::endl;
-}
-
-double cpu_load_measurer::get_cpu_load() const {
- return cpu_load_pid_;
-}
-
-std::uint64_t cpu_load_measurer::read_proc_pid_stat() {
- std::string path("/proc/" + std::to_string(pid_) + "/stat");
- FILE* f = std::fopen(path.c_str(), "r");
- if(!f) {
- std::perror(std::string("Failed to open " + path).c_str());
- exit(1);
- }
- // see Table 1-4 Contents of the stat files (as of 2.6.30-rc7)
- // at https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/filesystems/proc.txt?id=refs/tags/v3.10.98
- // and man proc (for conversion specifier)
- std::uint64_t utime(0);
- std::uint64_t stime(0);
- std::int64_t cutime(0);
- std::int64_t cstime(0);
- if (std::fscanf(f, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u "
- "%lu %lu %ld %ld", // utime, stime, cutime, cstime
- &utime, &stime, &cutime, &cstime) == EOF) {
- std::cerr << "Failed to read " + path << std::endl;
- exit(1);
- }
- std::fclose(f);
- return utime + stime + cutime + cstime;
-}
-
-std::uint64_t cpu_load_measurer::read_proc_stat(std::uint64_t* _idle) {
- FILE* f = std::fopen("/proc/stat", "r");
- if(!f) {
- std::perror("Failed to open /proc/stat");
- exit(1);
- }
-
- // see 1.8 Miscellaneous kernel statistics in /proc/stat
- // at https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/filesystems/proc.txt?id=refs/tags/v3.10.98
- std::uint64_t user(0);
- std::uint64_t nice(0);
- std::uint64_t system(0);
- std::uint64_t idle(0);
- std::uint64_t iowait(0);
- std::uint64_t irq(0);
- std::uint64_t softirq(0);
- std::uint64_t steal(0);
- std::uint64_t guest(0);
- std::uint64_t guest_nice(0);
- if (std::fscanf(f, "%*s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu", &user,
- &nice, &system, &idle, &iowait, &irq, &softirq, &steal, &guest,
- &guest_nice) == EOF) {
- std::cerr << "Failed to read /proc/stat" << std::endl;
- exit(1);
- }
- std::fclose(f);
- *_idle = idle;
- return user + nice + system + idle + iowait + irq + softirq + steal + guest
- + guest_nice;
-}
-
-bool cpu_load_measurer::read_clock_ticks() {
- long val(::sysconf(_SC_CLK_TCK));
- if(val < 0 && errno == EINVAL) {
- std::perror(__func__);
- return false;
- }
- clock_ticks_ = static_cast<std::uint64_t>(val);
- return true;
-}
diff --git a/test/cpu_load_tests/cpu_load_measurer.hpp b/test/cpu_load_tests/cpu_load_measurer.hpp
deleted file mode 100644
index dfdcf80..0000000
--- a/test/cpu_load_tests/cpu_load_measurer.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2015-2017 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/.
-
-#pragma once
-
-#include <cstdint>
-
-class cpu_load_measurer {
-public:
- cpu_load_measurer(std::uint32_t _pid);
- virtual ~cpu_load_measurer();
- void start();
- void stop();
- void print_cpu_load() const;
- double get_cpu_load() const;
-
-private:
- std::uint64_t read_proc_stat(std::uint64_t* _idle);
- std::uint64_t read_proc_pid_stat();
- bool read_clock_ticks();
-private:
- std::uint32_t pid_;
- std::uint64_t jiffies_complete_start_;
- std::uint64_t jiffies_idle_start_;
- std::uint64_t jiffies_complete_stop_;
- std::uint64_t jiffies_idle_stop_;
- std::uint64_t clock_ticks_;
- std::uint64_t jiffies_passed_pid_start_;
- std::uint64_t jiffies_passed_pid_stop_;
- double cpu_load_pid_;
- double cpu_load_overall_;
- double cpu_load_pid_wo_idle_;
-};
diff --git a/test/cpu_load_tests/cpu_load_test_client.cpp b/test/cpu_load_tests/cpu_load_test_client.cpp
deleted file mode 100644
index 94fd98b..0000000
--- a/test/cpu_load_tests/cpu_load_test_client.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-// Copyright (C) 2015-2017 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 <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-#include <iomanip>
-#include <numeric>
-#include <cmath> // for isfinite
-#include <atomic>
-
-#include "cpu_load_test_globals.hpp"
-#include "../../implementation/logging/include/logger.hpp"
-#include "cpu_load_measurer.hpp"
-
-// for getpid
-#include <sys/types.h>
-#include <unistd.h>
-
-
-enum protocol_e {
- PR_UNKNOWN,
- PR_TCP,
- PR_UDP
-};
-
-class cpu_load_test_client
-{
-public:
- cpu_load_test_client(protocol_e _protocol, std::uint32_t _number_of_calls,
- std::uint32_t _payload_size, bool _call_service_sync,
- bool _shutdown_service) :
- protocol_(_protocol),
- app_(vsomeip::runtime::get()->create_application("cpu_load_test_client")),
- request_(vsomeip::runtime::get()->create_request(protocol_ == protocol_e::PR_TCP)),
- call_service_sync_(_call_service_sync),
- shutdown_service_at_end_(_shutdown_service),
- sliding_window_size_(_number_of_calls),
- wait_for_availability_(true),
- is_available_(false),
- number_of_calls_(_number_of_calls),
- number_of_calls_current_(0),
- number_of_sent_messages_(0),
- number_of_sent_messages_total_(0),
- number_of_acknowledged_messages_(0),
- payload_size_(_payload_size),
- wait_for_all_msg_acknowledged_(true),
- initialized_(false),
- sender_(std::bind(&cpu_load_test_client::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- initialized_ = true;
- app_->register_state_handler(
- std::bind(&cpu_load_test_client::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(&cpu_load_test_client::on_message, this,
- std::placeholders::_1));
-
- app_->register_availability_handler(cpu_load_test::service_id,
- cpu_load_test::instance_id,
- std::bind(&cpu_load_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- VSOMEIP_INFO << "Starting...";
- app_->start();
- }
-
- ~cpu_load_test_client() {
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_for_availability_ = false;
- condition_.notify_one();
- }
- {
- std::lock_guard<std::mutex> its_lock(all_msg_acknowledged_mutex_);
- wait_for_all_msg_acknowledged_ = false;
- all_msg_acknowledged_cv_.notify_one();
- }
- sender_.join();
- }
-
-private:
- void stop() {
- VSOMEIP_INFO << "Stopping...";
- // shutdown the service
- if(shutdown_service_at_end_)
- {
- shutdown_service();
- }
- app_->clear_all_handler();
- }
-
- void on_state(vsomeip::state_type_e _state) {
- if(_state == vsomeip::state_type_e::ST_REGISTERED)
- {
- app_->request_service(cpu_load_test::service_id,
- cpu_load_test::instance_id);
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0')
- << std::hex << _service << "." << _instance << "] is "
- << (_is_available ? "available." : "NOT available.");
-
- if (cpu_load_test::service_id == _service
- && cpu_load_test::instance_id == _instance) {
- if (is_available_ && !_is_available) {
- is_available_ = false;
- } else if (_is_available && !is_available_) {
- is_available_ = true;
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_for_availability_ = false;
- condition_.notify_one();
- }
- }
- }
- void on_message(const std::shared_ptr<vsomeip::message> &_response) {
-
- number_of_acknowledged_messages_++;
- ASSERT_EQ(_response->get_service(), cpu_load_test::service_id);
- ASSERT_EQ(_response->get_method(), cpu_load_test::method_id);
- if(call_service_sync_)
- {
- // We notify the sender thread every time a message was acknowledged
- std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_);
- wait_for_all_msg_acknowledged_ = false;
- all_msg_acknowledged_cv_.notify_one();
- }
- else
- {
- // We notify the sender thread only if all sent messages have been acknowledged
- if(number_of_acknowledged_messages_ == number_of_calls_current_)
- {
- std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_);
- number_of_acknowledged_messages_ = 0;
- wait_for_all_msg_acknowledged_ = false;
- all_msg_acknowledged_cv_.notify_one();
- }
- else if(number_of_acknowledged_messages_ % sliding_window_size_ == 0)
- {
- std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_);
- wait_for_all_msg_acknowledged_ = false;
- all_msg_acknowledged_cv_.notify_one();
- }
- }
- }
-
- void run() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_for_availability_) {
- condition_.wait(its_lock);
- }
-
- request_->set_service(cpu_load_test::service_id);
- request_->set_instance(cpu_load_test::instance_id);
- request_->set_method(cpu_load_test::method_id);
- std::shared_ptr<vsomeip::payload> payload = vsomeip::runtime::get()->create_payload();
- std::vector<vsomeip::byte_t> payload_data;
- payload_data.assign(payload_size_, cpu_load_test::load_test_data);
- payload->set_data(payload_data);
- request_->set_payload(payload);
-
- // lock the mutex
- for(std::uint32_t i=0; i <= number_of_calls_; i++) {
- number_of_calls_current_ = i;
- sliding_window_size_ = i;
- std::unique_lock<std::mutex> lk(all_msg_acknowledged_mutex_);
- call_service_sync_ ? send_messages_sync(lk, i) : send_messages_async(lk, i);
- }
- const double average_load(std::accumulate(results_.begin(), results_.end(), 0.0) / static_cast<double>(results_.size()));
- VSOMEIP_INFO << "Sent: " << number_of_sent_messages_total_
- << " messages in total (excluding control messages). This caused: "
- << std::fixed << std::setprecision(2)
- << average_load << "% load in average (average of "
- << results_.size() << " measurements).";
-
- std::vector<double> results_no_zero;
- for(const auto &v : results_) {
- if(v > 0.0) {
- results_no_zero.push_back(v);
- }
- }
- const double average_load_no_zero(std::accumulate(results_no_zero.begin(), results_no_zero.end(), 0.0) / static_cast<double>(results_no_zero.size()));
- VSOMEIP_INFO << "Sent: " << number_of_sent_messages_total_
- << " messages in total (excluding control messages). This caused: "
- << std::fixed << std::setprecision(2)
- << average_load_no_zero << "% load in average, if measured "
- << "cpu load was greater zero (average of "
- << results_no_zero.size() << " measurements).";
-
- wait_for_availability_ = true;
-
- stop();
- if (initialized_) {
- app_->stop();
- }
- }
-
-
- void send_messages_sync(std::unique_lock<std::mutex>& lk, std::uint32_t _messages_to_send) {
- cpu_load_measurer c(::getpid());
- send_service_start_measuring(true);
- c.start();
- for (number_of_sent_messages_ = 0;
- number_of_sent_messages_ < _messages_to_send;
- number_of_sent_messages_++, number_of_sent_messages_total_++)
- {
- app_->send(request_, true);
- // wait until the send messages has been acknowledged
- while(wait_for_all_msg_acknowledged_) {
- all_msg_acknowledged_cv_.wait(lk);
- }
- wait_for_all_msg_acknowledged_ = true;
- }
- c.stop();
- send_service_start_measuring(false);
- VSOMEIP_DEBUG << "Synchronously sent " << std::setw(4) << std::setfill('0')
- << number_of_sent_messages_ << " messages. CPU load [%]: "
- << std::fixed << std::setprecision(2)
- << (std::isfinite(c.get_cpu_load()) ? c.get_cpu_load() : 0.0);
- results_.push_back(std::isfinite(c.get_cpu_load()) ? c.get_cpu_load() : 0.0);
-
- }
-
- void send_messages_async(std::unique_lock<std::mutex>& lk, std::uint32_t _messages_to_send) {
- cpu_load_measurer c(::getpid());
- send_service_start_measuring(true);
- c.start();
- for (number_of_sent_messages_ = 0;
- number_of_sent_messages_ < _messages_to_send;
- number_of_sent_messages_++, number_of_sent_messages_total_++)
- {
- app_->send(request_, true);
- if((number_of_sent_messages_+1) % sliding_window_size_ == 0)
- {
- // wait until all send messages have been acknowledged
- while(wait_for_all_msg_acknowledged_) {
- all_msg_acknowledged_cv_.wait(lk);
- }
- wait_for_all_msg_acknowledged_ = true;
- }
- }
- c.stop();
- send_service_start_measuring(false);
- VSOMEIP_DEBUG << "Asynchronously sent " << std::setw(4) << std::setfill('0')
- << number_of_sent_messages_ << " messages. CPU load [%]: "
- << std::fixed << std::setprecision(2)
- << (std::isfinite(c.get_cpu_load()) ? c.get_cpu_load() : 0.0);
- results_.push_back(std::isfinite(c.get_cpu_load()) ? c.get_cpu_load() : 0.0);
- }
-
- void send_service_start_measuring(bool _start_measuring) {
- std::shared_ptr<vsomeip::message> m = vsomeip::runtime::get()->create_request(protocol_ == protocol_e::PR_TCP);
- m->set_service(cpu_load_test::service_id);
- m->set_instance(cpu_load_test::instance_id);
- _start_measuring ? m->set_method(cpu_load_test::method_id_cpu_measure_start) : m->set_method(cpu_load_test::method_id_cpu_measure_stop);
- app_->send(m);
- }
-
- void shutdown_service() {
- request_->set_service(cpu_load_test::service_id);
- request_->set_instance(cpu_load_test::instance_id);
- request_->set_method(cpu_load_test::method_id_shutdown);
- app_->send(request_);
- }
-
-private:
- protocol_e protocol_;
- std::shared_ptr<vsomeip::application> app_;
- std::shared_ptr<vsomeip::message> request_;
- bool call_service_sync_;
- bool shutdown_service_at_end_;
- std::uint32_t sliding_window_size_;
- std::mutex mutex_;
- std::condition_variable condition_;
- bool wait_for_availability_;
- bool is_available_;
- const std::uint32_t number_of_calls_;
- std::uint32_t number_of_calls_current_;
- std::uint32_t number_of_sent_messages_;
- std::uint32_t number_of_sent_messages_total_;
- std::uint32_t number_of_acknowledged_messages_;
-
- std::uint32_t payload_size_;
-
- bool wait_for_all_msg_acknowledged_;
- std::mutex all_msg_acknowledged_mutex_;
- std::condition_variable all_msg_acknowledged_cv_;
- std::vector<double> results_;
- std::atomic<bool> initialized_;
- std::thread sender_;
-};
-
-
-// this variables are changed via cmdline parameters
-static protocol_e protocol(protocol_e::PR_UNKNOWN);
-static std::uint32_t number_of_calls(0);
-static std::uint32_t payload_size(40);
-static bool call_service_sync(true);
-static bool shutdown_service(true);
-
-
-TEST(someip_load_test, send_messages_and_measure_cpu_load)
-{
- cpu_load_test_client test_client_(protocol, number_of_calls, payload_size, call_service_sync, shutdown_service);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- int i = 0;
- while (i < argc) {
- if(std::string("--protocol") == std::string(argv[i])
- || std::string("-p") == std::string(argv[i])) {
- if(std::string("udp") == std::string(argv[i+1]) ||
- std::string("UDP") == std::string(argv[i+1])) {
- protocol = protocol_e::PR_UDP;
- i++;
- } else if(std::string("tcp") == std::string(argv[i+1]) ||
- std::string("TCP") == std::string(argv[i+1])) {
- protocol = protocol_e::PR_TCP;
- i++;
- }
- } else if(std::string("--calls") == std::string(argv[i])
- || std::string("-c") == std::string(argv[i])) {
- try {
- number_of_calls = static_cast<std::uint32_t>(std::stoul(std::string(argv[i+1]), nullptr, 10));
- } catch (const std::exception &e) {
- std::cerr << "Please specify a valid value for number of calls" << std::endl;
- return(EXIT_FAILURE);
- }
- i++;
- } else if(std::string("--mode") == std::string(argv[i])
- || std::string("-m") == std::string(argv[i])) {
- if(std::string("sync") == std::string(argv[i+1]) ||
- std::string("SYNC") == std::string(argv[i+1])) {
- call_service_sync = true;
- i++;
- } else if(std::string("async") == std::string(argv[i+1]) ||
- std::string("ASYNC") == std::string(argv[i+1])) {
- call_service_sync = false;
- i++;
- }
- } else if(std::string("--payload-size") == std::string(argv[i])
- || std::string("-pl") == std::string(argv[i])) {
- try {
- payload_size = static_cast<std::uint32_t>(std::stoul(std::string(argv[i+1]), nullptr, 10));
- } catch (const std::exception &e) {
- std::cerr << "Please specify a valid values for payload size" << std::endl;
- return(EXIT_FAILURE);
- }
- i++;
- } else if(std::string("--help") == std::string(argv[i])
- || std::string("-h") == std::string(argv[i])) {
- std::cout << "Available options:" << std::endl;
- std::cout << "--protocol|-p: valid values TCP or UDP" << std::endl;
- std::cout << "--calls|-c: number of message calls to do" << std::endl;
- std::cout << "--mode|-m: mode sync or async" << std::endl;
- std::cout << "--payload-size|-pl: payload size in Bytes default: 40" << std::endl;
- }
- i++;
- }
-
- if(protocol == protocol_e::PR_UNKNOWN) {
- std::cerr << "Please specify valid protocol mode, see --help" << std::endl;
- return(EXIT_FAILURE);
- }
- if(!number_of_calls) {
- std::cerr << "Please specify valid number of calls, see --help" << std::endl;
- return(EXIT_FAILURE);
- }
-
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/cpu_load_tests/cpu_load_test_globals.hpp b/test/cpu_load_tests/cpu_load_test_globals.hpp
deleted file mode 100644
index e6897e3..0000000
--- a/test/cpu_load_tests/cpu_load_test_globals.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (C) 2014-2017 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/.
-
-#pragma once
-
-namespace cpu_load_test {
-
-static constexpr vsomeip::service_t service_id(0x1111);
-static constexpr vsomeip::instance_t instance_id(0x1);
-static constexpr vsomeip::method_t method_id(0x1111);
-static constexpr vsomeip::byte_t load_test_data(0xDD);
-static constexpr vsomeip::length_t default_payload_length(40);
-static constexpr vsomeip::method_t method_id_shutdown(0x7777);
-static constexpr vsomeip::method_t method_id_cpu_measure_start(0x8888);
-static constexpr vsomeip::method_t method_id_cpu_measure_stop(0x9999);
-}
diff --git a/test/cpu_load_tests/cpu_load_test_master_starter.sh b/test/cpu_load_tests/cpu_load_test_master_starter.sh
deleted file mode 100755
index 50bf007..0000000
--- a/test/cpu_load_tests/cpu_load_test_master_starter.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-FAIL=0
-
-export VSOMEIP_CONFIGURATION=cpu_load_test_client_master.json
-./cpu_load_test_client --protocol UDP --calls 1000 &
-TEST_CLIENT_PID=$!
-sleep 1
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting cpu load test on slave LXC"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP 'bash -ci "set -m; cd \$SANDBOX_TARGET_DIR/vsomeip/test; ./cpu_load_test_slave_starter.sh"' &
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name cltms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./cpu_load_test_slave_starter.sh" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** cpu_load_test_slave_starter.sh
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** cpu_load_test_client_master.json,
-** cpu_load_test_service_master.json,
-** cpu_load_test_client_client.json and
-** cpu_load_test_service_client.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# Fail gets incremented if either client or service exit
-# with a non-zero exit code
-wait $TEST_CLIENT_PID || FAIL=$(($FAIL+1))
-
-
-sleep 4
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Now switching roles and running service on this host (master)
-*******************************************************************************
-*******************************************************************************
-End-of-message
-
-export VSOMEIP_CONFIGURATION=cpu_load_test_service_master.json
-./cpu_load_test_service &
-sleep 1
-
-# now we can wait to all jobs to finish
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop cltms
- docker rm cltms
-fi
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/cpu_load_tests/cpu_load_test_service.cpp b/test/cpu_load_tests/cpu_load_test_service.cpp
deleted file mode 100644
index b0b6ea6..0000000
--- a/test/cpu_load_tests/cpu_load_test_service.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright (C) 2015-2017 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 <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-#include <numeric>
-#include <cmath> // for isfinite
-
-#include "cpu_load_test_globals.hpp"
-#include "../../implementation/logging/include/logger.hpp"
-#include "cpu_load_measurer.hpp"
-
-// for getpid
-#include <sys/types.h>
-#include <unistd.h>
-
-class cpu_load_test_service
-{
-public:
- cpu_load_test_service() :
- app_(vsomeip::runtime::get()->create_application("cpu_load_test_service")),
- is_registered_(false),
- blocked_(false),
- number_of_received_messages_(0),
- number_of_received_messages_total_(0),
- load_measurer_(::getpid()),
- offer_thread_(std::bind(&cpu_load_test_service::run, this))
- {
- }
-
- ~cpu_load_test_service() {
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
- offer_thread_.join();
- }
-
- bool init()
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
-
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
- app_->register_message_handler(cpu_load_test::service_id,
- cpu_load_test::instance_id, cpu_load_test::method_id,
- std::bind(&cpu_load_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_message_handler(cpu_load_test::service_id,
- cpu_load_test::instance_id, cpu_load_test::method_id_shutdown,
- std::bind(&cpu_load_test_service::on_message_shutdown, this,
- std::placeholders::_1));
- app_->register_message_handler(cpu_load_test::service_id,
- cpu_load_test::instance_id, cpu_load_test::method_id_cpu_measure_start,
- std::bind(&cpu_load_test_service::on_message_start_measuring, this,
- std::placeholders::_1));
- app_->register_message_handler(cpu_load_test::service_id,
- cpu_load_test::instance_id, cpu_load_test::method_id_cpu_measure_stop,
- std::bind(&cpu_load_test_service::on_message_stop_measuring, this,
- std::placeholders::_1));
- app_->register_state_handler(
- std::bind(&cpu_load_test_service::on_state, this,
- std::placeholders::_1));
- return true;
- }
-
- void start()
- {
- VSOMEIP_INFO << "Starting...";
- app_->start();
- }
-
- void stop()
- {
- VSOMEIP_INFO << "Stopping...";
- app_->stop_offer_service(cpu_load_test::service_id, cpu_load_test::instance_id);
- app_->clear_all_handler();
- app_->stop();
- }
-
- void 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;
- blocked_ = true;
- // "start" the run method thread
- condition_.notify_one();
- }
- }
- else
- {
- is_registered_ = false;
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message>& _request)
- {
- number_of_received_messages_++;
- number_of_received_messages_total_++;
- // send response
- app_->send(vsomeip::runtime::get()->create_response(_request), true);
- }
-
- void on_message_start_measuring(const std::shared_ptr<vsomeip::message>& _request)
- {
- (void)_request;
- load_measurer_.start();
- }
-
- void on_message_stop_measuring(const std::shared_ptr<vsomeip::message>& _request)
- {
- (void)_request;
- load_measurer_.stop();
- VSOMEIP_DEBUG << "Received " << std::setw(4) << std::setfill('0')
- << number_of_received_messages_ << " messages. CPU load [%]: "
- << std::fixed << std::setprecision(2)
- << (std::isfinite(load_measurer_.get_cpu_load()) ? load_measurer_.get_cpu_load() : 0.0);
- results_.push_back(std::isfinite(load_measurer_.get_cpu_load()) ? load_measurer_.get_cpu_load() : 0.0);
- number_of_received_messages_ = 0;
- }
-
- void on_message_shutdown(
- const std::shared_ptr<vsomeip::message>& _request)
- {
- (void)_request;
- VSOMEIP_INFO << "Shutdown method was called, going down now.";
- const double average_load(std::accumulate(results_.begin(), results_.end(), 0.0) / static_cast<double>(results_.size()));
- VSOMEIP_INFO << "Received: " << number_of_received_messages_total_
- << " in total (excluding control messages). This caused: "
- << std::fixed << std::setprecision(2)
- << average_load << "% load in average (average of "
- << results_.size() << " measurements).";
-
- std::vector<double> results_no_zero;
- for(const auto &v : results_) {
- if(v > 0.0) {
- results_no_zero.push_back(v);
- }
- }
- const double average_load_no_zero(std::accumulate(results_no_zero.begin(), results_no_zero.end(), 0.0) / static_cast<double>(results_no_zero.size()));
- VSOMEIP_INFO << "Sent: " << number_of_received_messages_total_
- << " messages in total (excluding control messages). This caused: "
- << std::fixed << std::setprecision(2)
- << average_load_no_zero << "% load in average, if measured cpu load "
- << "was greater zero (average of "
- << results_no_zero.size() << " measurements).";
- stop();
- }
-
- void run()
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_) {
- condition_.wait(its_lock);
- }
-
- app_->offer_service(cpu_load_test::service_id, cpu_load_test::instance_id);
- }
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- std::uint32_t number_of_received_messages_;
- std::uint32_t number_of_received_messages_total_;
- cpu_load_measurer load_measurer_;
- std::vector<double> results_;
- std::thread offer_thread_;
-};
-
-
-TEST(someip_payload_test, send_response_for_every_request)
-{
- cpu_load_test_service test_service;
- if (test_service.init()) {
- test_service.start();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/cpu_load_tests/cpu_load_test_slave_starter.sh b/test/cpu_load_tests/cpu_load_test_slave_starter.sh
deleted file mode 100755
index 83ef19d..0000000
--- a/test/cpu_load_tests/cpu_load_test_slave_starter.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-FAIL=0
-
-export VSOMEIP_CONFIGURATION=cpu_load_test_service_slave.json
-./cpu_load_test_service &
-
-# Wait until all applications are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if one of the binaries exits
- # with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Now switching roles and running client on this host (slave)
-*******************************************************************************
-*******************************************************************************
-End-of-message
-
-sleep 4
-export VSOMEIP_CONFIGURATION=cpu_load_test_client_slave.json
-./cpu_load_test_client --protocol UDP --calls 1000 &
-
-for job in $(jobs -p)
-do
- # Fail gets incremented if one of the binaries exits
- # with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/header_factory_tests/header_factory_test.cpp b/test/header_factory_tests/header_factory_test.cpp
deleted file mode 100644
index bcd1ef3..0000000
--- a/test/header_factory_tests/header_factory_test.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (C) 2015-2017 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 <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../someip_test_globals.hpp"
-
-class someip_header_factory_test: public ::testing::Test
-{
-protected:
- std::shared_ptr<vsomeip::message> request_;
- std::shared_ptr<vsomeip::message> response_;
- std::shared_ptr<vsomeip::message> notification_;
- std::shared_ptr<vsomeip::application> app_;
- std::shared_ptr<vsomeip::message> message_;
-
- vsomeip::service_t service_id_ = vsomeip_test::TEST_SERVICE_SERVICE_ID;
- vsomeip::method_t method_id_ = vsomeip_test::TEST_SERVICE_METHOD_ID;
- vsomeip::instance_t instance_id_ = vsomeip_test::TEST_SERVICE_INSTANCE_ID;
- vsomeip::interface_version_t interface_version_ = 0x01;
- vsomeip::client_t client_id_ = vsomeip_test::TEST_CLIENT_CLIENT_ID;
- vsomeip::session_t session_id_ = vsomeip_test::TEST_INITIAL_SESSION_ID;
-};
-
-TEST_F(someip_header_factory_test, create_request_test)
-{
- ASSERT_TRUE(request_.get() == nullptr);
- request_ = vsomeip::runtime::get()->create_request();
-
- // check that returned shared_ptr is not null
- ASSERT_TRUE(request_.get() != nullptr);
-
- // Check the protocol version
- // this shall be set to 0x01 according to the spec. TR_SOMEIP_00052
- ASSERT_EQ(request_->get_protocol_version(), 0x01);
- // Check the message type
- // this shall be 0x00 (REQUEST) according to the spec. TR_SOMEIP_00055
- ASSERT_EQ(request_->get_message_type(), vsomeip::message_type_e::MT_REQUEST);
- // Check the return code
- // this shall be 0x00 (E_OK) according to the spec. TR_SOMEIP_00058
- ASSERT_EQ(request_->get_return_code(), vsomeip::return_code_e::E_OK);
-
-}
-
-TEST_F(someip_header_factory_test, create_request_and_response_test)
-{
- ASSERT_TRUE(request_.get() == nullptr);
- request_ = vsomeip::runtime::get()->create_request();
- // check that returned shared_ptr is not null
- ASSERT_TRUE(request_.get() != nullptr);
-
- request_->set_service(service_id_);
- request_->set_method(method_id_);
- request_->set_interface_version(interface_version_);
- // set the request_id (client_id + session_id). This normally is set by the
- // application_impl::send() if a request is send, we set it here to test the
- // correct initialization of the response
- request_->set_client(client_id_);
- request_->set_session(session_id_);
-
- ASSERT_TRUE(response_.get() == nullptr);
- response_ = vsomeip::runtime::get()->create_response(request_);
- // check that returned shared_ptr is not null
- ASSERT_TRUE(response_.get() != nullptr);
-
- ASSERT_EQ(response_->get_service(), request_->get_service());
- ASSERT_EQ(response_->get_method(), request_->get_method());
- ASSERT_EQ(response_->get_session(), request_->get_session());
-
- // length? --> gets only set if a payload is added
-
- ASSERT_EQ(response_->get_protocol_version(), request_->get_protocol_version());
- ASSERT_EQ(response_->get_interface_version(), request_->get_interface_version());
-
- // Check the message type
- // this shall be 0x00 (REQUEST) according to the spec. TR_SOMEIP_00055
- ASSERT_EQ(request_->get_message_type(), vsomeip::message_type_e::MT_REQUEST);
-
- // Check the message type
- // this shall be 0x80 (RESPONSE) according to the spec. TR_SOMEIP_00055
- ASSERT_EQ(response_->get_message_type(), vsomeip::message_type_e::MT_RESPONSE);
-
- // Check the return code
- // this shall be 0x00 (E_OK) according to the spec. TR_SOMEIP_00058
- // and TR_SOMEIP_00191
- ASSERT_EQ(response_->get_return_code(), vsomeip::return_code_e::E_OK);
-
-}
-
-TEST_F(someip_header_factory_test, create_notification_test)
-{
- ASSERT_TRUE(notification_.get() == nullptr);
- notification_ = vsomeip::runtime::get()->create_notification();
-
- // check that returned shared_ptr is not null
- ASSERT_TRUE(notification_.get() != nullptr);
-
- // Check the protocol version
- // this shall be set to 0x01 according to the spec. TR_SOMEIP_00052
- ASSERT_EQ(notification_->get_protocol_version(), 0x01);
- // Check the message type
- // this shall be 0x02 (NOTIFICATION) according to the spec. TR_SOMEIP_00055
- ASSERT_EQ(notification_->get_message_type(), vsomeip::message_type_e::MT_NOTIFICATION);
- // Check the return code
- // this shall be 0x00 (E_OK) according to the spec. TR_SOMEIP_00058
- ASSERT_EQ(notification_->get_return_code(), vsomeip::return_code_e::E_OK);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/header_factory_tests/header_factory_test_client.cpp b/test/header_factory_tests/header_factory_test_client.cpp
deleted file mode 100644
index 90cfef5..0000000
--- a/test/header_factory_tests/header_factory_test_client.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright (C) 2015-2017 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 "header_factory_test_client.hpp"
-
-header_factory_test_client::header_factory_test_client(bool _use_tcp) :
- app_(vsomeip::runtime::get()->create_application()),
- request_(vsomeip::runtime::get()->create_request(_use_tcp)),
- running_(true),
- blocked_(false),
- is_available_(false),
- number_of_messages_to_send_(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND),
- number_of_sent_messages_(0),
- number_of_acknowledged_messages_(0),
- sender_(std::bind(&header_factory_test_client::run, this))
-{
-}
-
-bool header_factory_test_client::init()
-{
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
-
- app_->register_state_handler(
- std::bind(&header_factory_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(&header_factory_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(&header_factory_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- return true;
-}
-
-void header_factory_test_client::start()
-{
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void header_factory_test_client::stop()
-{
- VSOMEIP_INFO << "Stopping...";
- app_->clear_all_handler();
- app_->stop();
-}
-
-void header_factory_test_client::join_sender_thread(){
- sender_.join();
-
- ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_);
-}
-
-void header_factory_test_client::on_state(vsomeip::state_type_e _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);
- }
-}
-
-void header_factory_test_client::on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available)
-{
- VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0') << std::hex
- << _service << "." << _instance << "] is "
- << (_is_available ? "available." : "NOT available.");
-
- if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service
- && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance)
- {
- if(is_available_ && !_is_available)
- {
- is_available_ = false;
- }
- else if(_is_available && !is_available_)
- {
- is_available_ = true;
- send();
- }
- }
-}
-
-void header_factory_test_client::on_message(const std::shared_ptr<vsomeip::message>& _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() << "]";
- number_of_acknowledged_messages_++;
- ASSERT_EQ(_response->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID);
- ASSERT_EQ(_response->get_instance(), vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- ASSERT_EQ(_response->get_session(),
- static_cast<vsomeip::session_t>(number_of_acknowledged_messages_));
- if(number_of_acknowledged_messages_ == number_of_messages_to_send_) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
-}
-
-void header_factory_test_client::send()
-{
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
-}
-
-void header_factory_test_client::run()
-{
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- {
- condition_.wait(its_lock);
- }
- blocked_ = 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);
-
- for (uint32_t i = 0; i < number_of_messages_to_send_; i++)
- {
- app_->send(request_, true);
- VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0')
- << std::hex << request_->get_client() << "/" << std::setw(4)
- << std::setfill('0') << std::hex << request_->get_session()
- << "] sent a request to Service [" << std::setw(4)
- << std::setfill('0') << std::hex << request_->get_service()
- << "." << std::setw(4) << std::setfill('0') << std::hex
- << request_->get_instance() << "]";
- number_of_sent_messages_++;
- }
- // wait until all messages have been acknowledged
- while (!blocked_)
- {
- condition_.wait(its_lock);
- }
- stop();
-}
-
-TEST(someip_header_factory_test, send_message_ten_times_test)
-{
- bool use_tcp = false;
- header_factory_test_client test_client_(use_tcp);
- if (test_client_.init()) {
- test_client_.start();
- test_client_.join_sender_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/header_factory_tests/header_factory_test_client.hpp b/test/header_factory_tests/header_factory_test_client.hpp
deleted file mode 100644
index eb62191..0000000
--- a/test/header_factory_tests/header_factory_test_client.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2015-2017 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 HEADERFACTORYTESTCLIENT_HPP_
-#define HEADERFACTORYTESTCLIENT_HPP_
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-
-#include "../someip_test_globals.hpp"
-
-class header_factory_test_client
-{
-public:
- header_factory_test_client(bool _use_tcp);
- bool init();
- void start();
- void stop();
- void join_sender_thread();
- 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<vsomeip::message> &_response);
- void send();
- void run();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- std::shared_ptr<vsomeip::message> request_;
- bool use_tcp_;
- std::mutex mutex_;
- std::condition_variable condition_;
- bool running_;
- bool blocked_;
- bool is_available_;
- std::uint32_t number_of_messages_to_send_;
- std::uint32_t number_of_sent_messages_;
- std::uint32_t number_of_acknowledged_messages_;
- std::thread sender_;
-};
-
-#endif /* HEADERFACTORYTESTCLIENT_HPP_ */
diff --git a/test/header_factory_tests/header_factory_test_client.json b/test/header_factory_tests/header_factory_test_client.json
deleted file mode 100644
index 71bc75b..0000000
--- a/test/header_factory_tests/header_factory_test_client.json
+++ /dev/null
@@ -1,97 +0,0 @@
-{
- "unicast" : "127.0.0.1",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "true",
- "path" : "/var/log/vsomeip.log"
- },
-
- "dlt" : "true"
- },
-
- "applications" :
- [
- {
- "name" : "header_factory_test_client",
- "id" : "0x1343"
- }
- ],
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "events" :
- [
- {
- "event" : "0x0777",
- "is_field" : "true"
- },
-
- {
- "event" : "0x0778",
- "is_field" : "false"
- },
-
- {
- "event" : "0x0779",
- "is_field" : "true"
- }
- ],
-
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4455",
- "events" :
- [
- "0x777",
- "0x778"
- ]
- },
-
- {
- "eventgroup" : "0x4465",
- "events" :
- [
- "0x778",
- "0x779"
- ],
-
- "is_multicast" : "true"
- },
-
- {
- "eventgroup" : "0x4555",
- "events" :
- [
- "0x777",
- "0x779"
- ]
- }
- ]
- }
- ],
-
- "routing" : "header_factory_test_service",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30491",
- "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"
- }
-} \ No newline at end of file
diff --git a/test/header_factory_tests/header_factory_test_client_start.sh b/test/header_factory_tests/header_factory_test_client_start.sh
deleted file mode 100755
index 4e9c1ed..0000000
--- a/test/header_factory_tests/header_factory_test_client_start.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-export VSOMEIP_APPLICATION_NAME=header_factory_test_client
-export VSOMEIP_CONFIGURATION=header_factory_test_client.json
-./header_factory_test_client
diff --git a/test/header_factory_tests/header_factory_test_send_receive_starter.sh b/test/header_factory_tests/header_factory_test_send_receive_starter.sh
deleted file mode 100755
index 5d1d780..0000000
--- a/test/header_factory_tests/header_factory_test_send_receive_starter.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit sucessfully.
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=header_factory_test_service
-export VSOMEIP_CONFIGURATION=header_factory_test_service.json
-./header_factory_test_service &
-sleep 1;
-
-# Start the client
-export VSOMEIP_APPLICATION_NAME=header_factory_test_client
-export VSOMEIP_CONFIGURATION=header_factory_test_client.json
-./header_factory_test_client &
-
-# Wait until client and service are finished
-FAIL=0
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-# Check if client and server both exited sucessfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/header_factory_tests/header_factory_test_service.cpp b/test/header_factory_tests/header_factory_test_service.cpp
deleted file mode 100644
index 12527ed..0000000
--- a/test/header_factory_tests/header_factory_test_service.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (C) 2015-2017 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 "header_factory_test_service.hpp"
-
-#include <cstdlib>
-
-header_factory_test_service::header_factory_test_service(bool _use_static_routing) :
- app_(vsomeip::runtime::get()->create_application()),
- is_registered_(false),
- use_static_routing_(_use_static_routing),
- blocked_(false),
- number_of_received_messages_(0),
- offer_thread_(std::bind(&header_factory_test_service::run, this))
-{
-}
-
-bool header_factory_test_service::init()
-{
- std::lock_guard<std::mutex> 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(&header_factory_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&header_factory_test_service::on_state, this,
- std::placeholders::_1));
-
- VSOMEIP_INFO << "Static routing " << (use_static_routing_ ? "ON" : "OFF");
- return true;
-}
-
-void header_factory_test_service::start()
-{
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void header_factory_test_service::stop()
-{
- VSOMEIP_INFO << "Stopping...";
- app_->clear_all_handler();
- app_->stop();
- std::thread t([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));});
- t.join();
-}
-
-void header_factory_test_service::join_offer_thread()
-{
- offer_thread_.join();
-}
-
-void header_factory_test_service::offer()
-{
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void header_factory_test_service::stop_offer()
-{
- app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void header_factory_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<std::mutex> its_lock(mutex_);
- blocked_ = true;
- // "start" the run method thread
- condition_.notify_one();
- }
- }
- else
- {
- is_registered_ = false;
- }
-}
-
-void header_factory_test_service::on_message(const std::shared_ptr<vsomeip::message>& _request)
-{
- 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() << "]";
-
- number_of_received_messages_++;
-
- ASSERT_EQ(_request->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID);
- ASSERT_EQ(_request->get_method(), vsomeip_test::TEST_SERVICE_METHOD_ID);
-
- // Check the protocol version this shall be set to 0x01 according to the spec.
- // TR_SOMEIP_00052
- ASSERT_EQ(_request->get_protocol_version(), 0x01);
- // Check the message type this shall be 0xx (REQUEST) according to the spec.
- // TR_SOMEIP_00055
- ASSERT_EQ(_request->get_message_type(), vsomeip::message_type_e::MT_REQUEST);
-
- // check the session id.
- ASSERT_EQ(_request->get_session(), static_cast<vsomeip::session_t>(number_of_received_messages_));
-
-
- // send response
- std::shared_ptr<vsomeip::message> its_response =
- vsomeip::runtime::get()->create_response(_request);
-
- app_->send(its_response, true);
-
- if(number_of_received_messages_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND)
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ =true;
- condition_.notify_one();
- }
- ASSERT_LT(number_of_received_messages_,
- vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND + 1);
-}
-
-void header_factory_test_service::run()
-{
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- condition_.wait(its_lock);
-
- blocked_ = false;
- if(use_static_routing_)
- {
- offer();
- }
- while (!blocked_)
- condition_.wait(its_lock);
-
- std::thread t([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));});
- t.join();
- app_->stop();
-}
-
-TEST(someip_header_factory_test, reveice_message_ten_times_test)
-{
- bool use_static_routing = true;
- header_factory_test_service test_service(use_static_routing);
- if (test_service.init()) {
- test_service.start();
- test_service.join_offer_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/header_factory_tests/header_factory_test_service.hpp b/test/header_factory_tests/header_factory_test_service.hpp
deleted file mode 100644
index 32e49e5..0000000
--- a/test/header_factory_tests/header_factory_test_service.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (C) 2015-2017 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 HEADERFACTORYTESTSERVICE_HPP_
-#define HEADERFACTORYTESTSERVICE_HPP_
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-
-#include "../someip_test_globals.hpp"
-
-class header_factory_test_service
-{
-public:
- header_factory_test_service(bool _use_static_routing);
- 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<vsomeip::message> &_request);
- void run();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
- bool use_static_routing_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- std::uint32_t number_of_received_messages_;
- std::thread offer_thread_;
-};
-
-#endif /* HEADERFACTORYTESTSERVICE_HPP_ */
diff --git a/test/header_factory_tests/header_factory_test_service.json b/test/header_factory_tests/header_factory_test_service.json
deleted file mode 100644
index a99d0a2..0000000
--- a/test/header_factory_tests/header_factory_test_service.json
+++ /dev/null
@@ -1,105 +0,0 @@
-{
- "unicast" : "127.0.0.1",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "header_factory_test_service",
- "id" : "0x1277"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "multicast" :
- {
- "address" : "224.225.226.233",
- "port" : "32344"
- },
-
- "events" :
- [
- {
- "event" : "0x0777",
- "is_field" : "true",
- "update-cycle" : 2000
- },
-
- {
- "event" : "0x0778",
- "is_field" : "true",
- "update-cycle" : 0
- },
-
- {
- "event" : "0x0779",
- "is_field" : "true"
- }
- ],
-
- "eventgroups" :
- [
- {
- "eventgroup" : "0x4455",
- "events" :
- [
- "0x777",
- "0x778"
- ]
- },
-
- {
- "eventgroup" : "0x4465",
- "events" :
- [
- "0x778",
- "0x779"
- ],
-
- "is_multicast" : "true"
- },
-
- {
- "eventgroup" : "0x4555",
- "events" :
- [
- "0x777",
- "0x779"
- ]
- }
- ]
- }
- ],
-
- "routing" : "header_factory_test_service",
-
- "service-discovery" :
- {
- "enable" : "false",
- "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"
- }
-} \ No newline at end of file
diff --git a/test/header_factory_tests/header_factory_test_service_start.sh b/test/header_factory_tests/header_factory_test_service_start.sh
deleted file mode 100755
index e123a46..0000000
--- a/test/header_factory_tests/header_factory_test_service_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=header_factory_test_service
-export VSOMEIP_CONFIGURATION=header_factory_test_service.json
-./header_factory_test_service
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in
deleted file mode 100644
index d7b5c7b..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master.json.in
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"initial_event_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"initial_event_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x8888",
- "instance":"0x0001",
- "unreliable":"8888"
- }
- ],
- "routing":"initial_event_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in
deleted file mode 100644
index 7cb35fb..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_master_tcp.json.in
+++ /dev/null
@@ -1,165 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"initial_event_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"initial_event_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x1111",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1112",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1113",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1114",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1115",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x2222",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2223",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2224",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2225",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2226",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x3333",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3334",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3335",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3336",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3337",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x8888",
- "instance":"0x0001",
- "unreliable":"8888"
- }
- ],
- "routing":"initial_event_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-}
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in
deleted file mode 100644
index 6445025..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_master.json.in
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"initial_event_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"initial_event_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1111",
- "instance":"0x0002",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1111",
- "instance":"0x0003",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x8888",
- "instance":"0x0001",
- "unreliable":"8888"
- }
- ],
- "routing":"initial_event_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
deleted file mode 100644
index c5dddc3..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
+++ /dev/null
@@ -1,82 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "diagnosis" : "0x63",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"initial_event_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"initial_event_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0002",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0003",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x9999",
- "instance":"0x0001",
- "unreliable":"9999"
- }
- ],
- "routing":"initial_event_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in
deleted file mode 100644
index 3e7e286..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave.json.in
+++ /dev/null
@@ -1,82 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "diagnosis" : "0x63",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"initial_event_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"initial_event_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x9999",
- "instance":"0x0001",
- "unreliable":"9999"
- }
- ],
- "routing":"initial_event_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json.in
deleted file mode 100644
index 320e2a3..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_diff_ports_slave_tcp.json.in
+++ /dev/null
@@ -1,166 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "diagnosis" : "0x63",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"initial_event_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"initial_event_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x4444",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4445",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4446",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4447",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4448",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x5555",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5556",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5557",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5558",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5559",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x6666",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6667",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6668",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6669",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x666a",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x9999",
- "instance":"0x0001",
- "unreliable":"9999"
- }
- ],
- "routing":"initial_event_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-}
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in
deleted file mode 100644
index f168fae..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_master.json.in
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"initial_event_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"initial_event_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x8888",
- "instance":"0x0001",
- "unreliable":"8888"
- }
- ],
- "routing":"initial_event_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in
deleted file mode 100644
index 30206a2..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_partial_same_ports_slave.json.in
+++ /dev/null
@@ -1,82 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "diagnosis" : "0x63",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"initial_event_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"initial_event_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x9999",
- "instance":"0x0001",
- "unreliable":"9999"
- }
- ],
- "routing":"initial_event_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in
deleted file mode 100644
index 785e651..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master.json.in
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"initial_event_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"initial_event_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x8888",
- "instance":"0x0001",
- "unreliable":"8888"
- }
- ],
- "routing":"initial_event_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in
deleted file mode 100644
index 7336aa2..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_master_tcp.json.in
+++ /dev/null
@@ -1,165 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"initial_event_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"initial_event_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x1111",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1112",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1113",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1114",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x1115",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x2222",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2223",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2224",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2225",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x2226",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x3333",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3334",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3335",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3336",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x3337",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x8888",
- "instance":"0x0001",
- "unreliable":"8888"
- }
- ],
- "routing":"initial_event_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in
deleted file mode 100644
index cfbdac4..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave.json.in
+++ /dev/null
@@ -1,82 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "diagnosis" : "0x63",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"initial_event_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"initial_event_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x9999",
- "instance":"0x0001",
- "unreliable":"9999"
- }
- ],
- "routing":"initial_event_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_tcp.json.in b/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_tcp.json.in
deleted file mode 100644
index f22ad4e..0000000
--- a/test/initial_event_tests/conf/initial_event_test_diff_client_ids_same_ports_slave_tcp.json.in
+++ /dev/null
@@ -1,166 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "diagnosis" : "0x63",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"initial_event_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"initial_event_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x4444",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4445",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4446",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4447",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x4448",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x5555",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5556",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5557",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5558",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x5559",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x6666",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6667",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6668",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x6669",
- "is_field" : "true",
- "is_reliable" : "true"
- },
- {
- "event" : "0x666a",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x9999",
- "instance":"0x0001",
- "unreliable":"9999"
- }
- ],
- "routing":"initial_event_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in
deleted file mode 100644
index d7b5c7b..0000000
--- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_master.json.in
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"initial_event_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"initial_event_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x8888",
- "instance":"0x0001",
- "unreliable":"8888"
- }
- ],
- "routing":"initial_event_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in
deleted file mode 100644
index facc51a..0000000
--- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_diff_ports_slave.json.in
+++ /dev/null
@@ -1,82 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "diagnosis" : "0x63",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_four",
- "id":"0x1111"
- },
- {
- "name":"initial_event_test_service_five",
- "id":"0x2222"
- },
- {
- "name":"initial_event_test_service_six",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x9999",
- "instance":"0x0001",
- "unreliable":"9999"
- }
- ],
- "routing":"initial_event_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in
deleted file mode 100644
index 785e651..0000000
--- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_master.json.in
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"initial_event_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"initial_event_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x8888",
- "instance":"0x0001",
- "unreliable":"8888"
- }
- ],
- "routing":"initial_event_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in b/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in
deleted file mode 100644
index 97b5d9f..0000000
--- a/test/initial_event_tests/conf/initial_event_test_same_client_ids_same_ports_slave.json.in
+++ /dev/null
@@ -1,82 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "diagnosis" : "0x63",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"initial_event_test_service_four",
- "id":"0x1111"
- },
- {
- "name":"initial_event_test_service_five",
- "id":"0x2222"
- },
- {
- "name":"initial_event_test_service_six",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x9999",
- "instance":"0x0001",
- "unreliable":"9999"
- }
- ],
- "routing":"initial_event_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/initial_event_tests/initial_event_test_availability_checker.cpp b/test/initial_event_tests/initial_event_test_availability_checker.cpp
deleted file mode 100644
index 719d6d3..0000000
--- a/test/initial_event_tests/initial_event_test_availability_checker.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "initial_event_test_globals.hpp"
-
-
-class initial_event_test_availability_checker {
-public:
- initial_event_test_availability_checker(int _client_number,
- std::array<initial_event_test::service_info, 7> _service_infos) :
- client_number_(_client_number),
- service_infos_(_service_infos),
- app_(vsomeip::runtime::get()->create_application()),
- wait_until_registered_(true),
- wait_until_other_services_available_(true),
- wait_for_stop_(true),
- stop_thread_(std::bind(&initial_event_test_availability_checker::wait_for_stop, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&initial_event_test_availability_checker::on_state, this,
- std::placeholders::_1));
-
- // register availability for all other services and request their event.
- for(const auto& i : service_infos_) {
- if (i.service_id == 0xFFFF && i.instance_id == 0xFFFF) {
- continue;
- }
- other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false;
- app_->register_availability_handler(i.service_id, i.instance_id,
- std::bind(&initial_event_test_availability_checker::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->request_service(i.service_id, i.instance_id);
- }
-
- app_->start();
- }
-
- ~initial_event_test_availability_checker() {
- stop_thread_.join();
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- if(_is_available) {
- auto its_service = other_services_available_.find(std::make_pair(_service, _instance));
- if(its_service != other_services_available_.end()) {
- if(its_service->second != _is_available) {
- its_service->second = true;
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is available.";
-
- }
- }
-
- if(std::all_of(other_services_available_.cbegin(),
- other_services_available_.cend(),
- [](const std::map<std::pair<vsomeip::service_t,
- vsomeip::instance_t>, bool>::value_type& v) {
- return v.second;})) {
-
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- stop_condition_.notify_one();
- }
- }
- }
-
- void wait_for_stop() {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] all services are available. Going down";
- app_->clear_all_handler();
- app_->stop();
- }
-
-private:
- int client_number_;
- std::array<initial_event_test::service_info, 7> service_infos_;
- std::shared_ptr<vsomeip::application> app_;
- std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
-
- bool wait_until_registered_;
- bool wait_until_other_services_available_;
- std::mutex mutex_;
- std::condition_variable condition_;
-
- bool wait_for_stop_;
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
- std::thread stop_thread_;
-};
-
-static int client_number;
-static bool use_same_service_id;
-
-TEST(someip_initial_event_test, wait_for_availability_and_exit)
-{
- if(use_same_service_id) {
- initial_event_test_availability_checker its_sample(client_number,
- initial_event_test::service_infos_same_service_id);
- } else {
- initial_event_test_availability_checker its_sample(client_number,
- initial_event_test::service_infos);
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a client number and subscription type, like: " << argv[0] << " 2 SAME_SERVICE_ID" << std::endl;
- std::cerr << "Valid client numbers are from 0 to 0xFFFF" << std::endl;
- std::cerr << "If SAME_SERVICE_ID is specified as third parameter the test is run w/ multiple instances of the same service" << std::endl;
- return 1;
- }
-
- client_number = std::stoi(std::string(argv[1]), nullptr);
-
- if (argc >= 3 && std::string("SAME_SERVICE_ID") == std::string(argv[2])) {
- use_same_service_id = true;
- } else {
- use_same_service_id = false;
- }
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/initial_event_tests/initial_event_test_client.cpp b/test/initial_event_tests/initial_event_test_client.cpp
deleted file mode 100644
index 22940eb..0000000
--- a/test/initial_event_tests/initial_event_test_client.cpp
+++ /dev/null
@@ -1,457 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-
-#include <gtest/gtest.h>
-
-#ifndef _WIN32
-#include <signal.h>
-#endif
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "initial_event_test_globals.hpp"
-class initial_event_test_client;
-static initial_event_test_client* the_client;
-extern "C" void signal_handler(int _signum);
-
-
-class initial_event_test_client {
-public:
- initial_event_test_client(int _client_number,
- vsomeip::subscription_type_e _subscription_type,
- std::array<initial_event_test::service_info, 7> _service_infos,
- bool _subscribe_on_available, std::uint32_t _events_to_subscribe,
- bool _initial_event_strict_checking,
- bool _dont_exit) :
- client_number_(_client_number),
- service_infos_(_service_infos),
- subscription_type_(_subscription_type),
- app_(vsomeip::runtime::get()->create_application()),
- wait_until_registered_(true),
- wait_until_other_services_available_(true),
- wait_for_stop_(true),
- subscribe_on_available_(_subscribe_on_available),
- events_to_subscribe_(_events_to_subscribe),
- initial_event_strict_checking_(_initial_event_strict_checking),
- dont_exit_(_dont_exit),
- stop_thread_(std::bind(&initial_event_test_client::wait_for_stop, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
-
- // register signal handler
- the_client = this;
- struct sigaction sa_new, sa_old;
- sa_new.sa_handler = signal_handler;
- sa_new.sa_flags = 0;
- sigemptyset(&sa_new.sa_mask);
- ::sigaction(SIGUSR1, &sa_new, &sa_old);
- ::sigaction(SIGINT, &sa_new, &sa_old);
- ::sigaction(SIGTERM, &sa_new, &sa_old);
- ::sigaction(SIGABRT, &sa_new, &sa_old);
-
- app_->register_state_handler(
- std::bind(&initial_event_test_client::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(&initial_event_test_client::on_message, this,
- std::placeholders::_1));
-
- // register availability for all other services and request their event.
- for(const auto& i : service_infos_) {
- if (i.service_id == 0xFFFF && i.instance_id == 0xFFFF) {
- continue;
- }
- app_->register_availability_handler(i.service_id, i.instance_id,
- std::bind(&initial_event_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->request_service(i.service_id, i.instance_id);
-
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(i.eventgroup_id);
- for (std::uint32_t j = 0; j < events_to_subscribe_; j++ ) {
- app_->request_event(i.service_id, i.instance_id,
- static_cast<vsomeip::event_t>(i.event_id + j),
- its_eventgroups, true);
- }
-
- other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false;
- for (std::uint32_t j = 0; j < events_to_subscribe_; j++ ) {
- other_services_received_notification_[std::make_pair(i.service_id, i.method_id + j)] = 0;
- }
- if (!subscribe_on_available_) {
- if (events_to_subscribe_ == 1 ) {
- app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_);
- } else if (events_to_subscribe_ > 1) {
- for (std::uint32_t j = 0; j < events_to_subscribe_; j++ ) {
- app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_,
- static_cast<vsomeip::event_t>(i.event_id + j));
- }
- }
- }
- }
-
- app_->start();
- }
-
- ~initial_event_test_client() {
- stop_thread_.join();
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- if(_is_available) {
- auto its_service = other_services_available_.find(std::make_pair(_service, _instance));
- if(its_service != other_services_available_.end()) {
- if(its_service->second != _is_available) {
- its_service->second = true;
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is available.";
-
- }
- }
-
- if(std::all_of(other_services_available_.cbegin(),
- other_services_available_.cend(),
- [](const std::map<std::pair<vsomeip::service_t,
- vsomeip::instance_t>, bool>::value_type& v) {
- return v.second;})) {
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] all services are available.";
- if (subscribe_on_available_) {
- for(const auto& i : service_infos_) {
- if (i.service_id == 0xFFFF && i.instance_id == 0xFFFF) {
- continue;
- }
- if (events_to_subscribe_ == 1 ) {
- app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_);
- } else if (events_to_subscribe_ > 1) {
- for (std::uint32_t j = 0; j < events_to_subscribe_; j++ ) {
- app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_,
- static_cast<vsomeip::event_t>(i.event_id + j));
- }
- }
- }
- }
- }
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
-
- other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())]++;
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] "
- << "Received a notification with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] from Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method() <<"] (now have: "
- << std::dec << other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())] << ")";
-
- std::shared_ptr<vsomeip::payload> its_payload(_message->get_payload());
- EXPECT_EQ(2u, its_payload->get_length());
- EXPECT_EQ((_message->get_service() & 0xFF00 ) >> 8, its_payload->get_data()[0]);
- EXPECT_EQ((_message->get_service() & 0xFF), its_payload->get_data()[1]);
- bool notify(false);
- switch(subscription_type_) {
- case vsomeip::subscription_type_e::SU_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_RELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_RELIABLE:
- if (all_notifications_received()) {
- notify = true;
- }
- break;
- case vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE:
- if (all_notifications_received_tcp_and_udp()) {
- notify = true;
- }
- break;
- }
-
- if(notify && !dont_exit_) {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- stop_condition_.notify_one();
- }
- }
- }
-
- bool all_notifications_received() {
- return std::all_of(
- other_services_received_notification_.cbegin(),
- other_services_received_notification_.cend(),
- [&](const std::map<std::pair<vsomeip::service_t,
- vsomeip::method_t>, std::uint32_t>::value_type& v)
- {
- if (v.second == initial_event_test::notifications_to_send) {
- return true;
- } else {
- if (v.second >= initial_event_test::notifications_to_send) {
- VSOMEIP_WARNING
- << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] "
- << " Received multiple initial events from service/instance: "
- << std::setw(4) << std::setfill('0') << std::hex << v.first.first
- << "."
- << std::setw(4) << std::setfill('0') << std::hex << v.first.second
- << " number of received events: " << v.second
- << ". This is caused by StopSubscribe/Subscribe messages and/or"
- << " service offered via UDP and TCP";
- if (initial_event_strict_checking_) {
- ADD_FAILURE() << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] "
- << " Received multiple initial events from service/instance: "
- << std::setw(4) << std::setfill('0') << std::hex << v.first.first
- << "."
- << std::setw(4) << std::setfill('0') << std::hex << v.first.second
- << " number of received events: " << v.second;
- }
- return initial_event_strict_checking_ ? false : true;
-
- } else {
- return false;
- }
- }
- }
- );
- }
-
- bool all_notifications_received_tcp_and_udp() {
- std::uint32_t received_twice(0);
- std::uint32_t received_normal(0);
- for(const auto &v : other_services_received_notification_) {
- if (!initial_event_strict_checking_ &&
- v.second > initial_event_test::notifications_to_send * 2) {
- VSOMEIP_WARNING
- << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] "
- << " Received multiple initial events from service/instance: "
- << std::setw(4) << std::setfill('0') << std::hex << v.first.first
- << "."
- << std::setw(4) << std::setfill('0') << std::hex << v.first.second
- << ". This is caused by StopSubscribe/Subscribe messages and/or"
- << " service offered via UDP and TCP";
- received_twice++;
- } else if (initial_event_strict_checking_ &&
- v.second > initial_event_test::notifications_to_send * 2) {
- ADD_FAILURE() << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] "
- << " Received multiple initial events from service/instance: "
- << std::setw(4) << std::setfill('0') << std::hex << v.first.first
- << "."
- << std::setw(4) << std::setfill('0') << std::hex << v.first.second
- << " number of received events: " << v.second;
- } else if (v.second == initial_event_test::notifications_to_send * 2) {
- received_twice++;
- } else if(v.second == initial_event_test::notifications_to_send) {
- received_normal++;
- }
- }
-
- if( received_twice == ((service_infos_.size() - 1) * events_to_subscribe_)/ 2
- && received_normal == ((service_infos_.size() - 1) * events_to_subscribe_)/ 2) {
- // routing manager stub receives the notification
- // - twice from external nodes
- // - and normal from all internal nodes
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] "
- << "Received notifications:"
- << " Normal: " << received_normal
- << " Twice: " << received_twice;
- return true;
- } else if (initial_event_strict_checking_ && (
- received_twice > ((service_infos_.size() - 1) * events_to_subscribe_)/ 2)) {
- ADD_FAILURE() << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] "
- << " Received too much initial events twice: " << received_twice;
- } else if (received_normal == (events_to_subscribe_ * (service_infos_.size() - 1))) {
- return true;
- }
- return false;
- }
-
- void handle_signal(int _signum) {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_ << "] Catched signal, going down ("
- << std::dec <<_signum << ")";
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- stop_condition_.notify_one();
- }
-
- void wait_for_stop() {
- {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << client_number_
- << "] Received notifications from all services, going down";
- }
- for (const auto& i : service_infos_) {
- if (i.service_id == 0xFFFF && i.instance_id == 0xFFFF) {
- continue;
- }
- app_->unsubscribe(i.service_id, i.instance_id, i.eventgroup_id);
- }
- app_->clear_all_handler();
- app_->stop();
- }
-
-private:
- int client_number_;
- std::array<initial_event_test::service_info, 7> service_infos_;
- vsomeip::subscription_type_e subscription_type_;
- std::shared_ptr<vsomeip::application> app_;
- std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
- std::map<std::pair<vsomeip::service_t, vsomeip::method_t>, std::uint32_t> other_services_received_notification_;
-
- bool wait_until_registered_;
- bool wait_until_other_services_available_;
- std::mutex mutex_;
- std::condition_variable condition_;
-
- bool wait_for_stop_;
-
- bool subscribe_on_available_;
- std::uint32_t events_to_subscribe_;
- bool initial_event_strict_checking_;
- bool dont_exit_;
-
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
- std::thread stop_thread_;
-};
-
-static int client_number;
-static vsomeip::subscription_type_e subscription_type;
-static bool use_same_service_id;
-static bool subscribe_on_available;
-static std::uint32_t subscribe_multiple_events;
-static bool initial_event_strict_checking;
-static bool dont_exit;
-
-extern "C" void signal_handler(int signum) {
- the_client->handle_signal(signum);
-}
-
-TEST(someip_initial_event_test, wait_for_initial_events_of_all_services)
-{
- if(use_same_service_id) {
- initial_event_test_client its_sample(client_number,
- subscription_type,
- initial_event_test::service_infos_same_service_id, subscribe_on_available,
- subscribe_multiple_events, initial_event_strict_checking, dont_exit);
- } else {
- initial_event_test_client its_sample(client_number, subscription_type,
- initial_event_test::service_infos, subscribe_on_available,
- subscribe_multiple_events, initial_event_strict_checking, dont_exit);
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 3) {
- std::cerr << "Please specify a client number and subscription type, like: " << argv[0] << " 2 UDP SUBSCRIBE_BEFORE_START SAME_SERVICE_ID" << std::endl;
- std::cerr << "Valid client numbers are from 0 to 0xFFFF" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
- std::cerr << "After client number and subscription types one/multiple of these flags can be specified:";
- std::cerr << " - Time of subscription, valid values: [SUBSCRIBE_ON_AVAILABILITY, SUBSCRIBE_BEFORE_START], default SUBSCRIBE_BEFORE_START" << std::endl;
- std::cerr << " - SAME_SERVICE_ID flag. If set the test is run w/ multiple instances of the same service, default false" << std::endl;
- std::cerr << " - MULTIPLE_EVENTS flag. If set the test will subscribe to multiple events in the eventgroup, default false" << std::endl;
- std::cerr << " - STRICT_CHECKING flag. If set the test will only successfully finish if exactly the number of initial events were received (and not more). Default false" << std::endl;
- std::cerr << " - DONT_EXIT flag. If set the test will not exit if all notifications have been received. Default false" << std::endl;
- return 1;
- }
-
- client_number = std::stoi(std::string(argv[1]), nullptr);
-
- if(std::string("TCP_AND_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE;
- } else if(std::string("PREFER_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE;
- } else if(std::string("PREFER_TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_RELIABLE;
- } else if(std::string("UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_UNRELIABLE;
- } else if(std::string("TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE;
- } else {
- std::cerr << "Wrong subscription type passed, exiting" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
- return 1;
- }
-
- subscribe_on_available = false;
- initial_event_strict_checking = false;
- use_same_service_id = false;
- subscribe_multiple_events = 1;
- dont_exit = false;
- if (argc > 3) {
- for (int i = 3; i < argc; i++) {
- if (std::string("SUBSCRIBE_ON_AVAILABILITY") == std::string(argv[i])) {
- subscribe_on_available = true;
- } else if (std::string("SUBSCRIBE_BEFORE_START") == std::string(argv[i])) {
- subscribe_on_available = false;
- } else if (std::string("SAME_SERVICE_ID") == std::string(argv[i])) {
- use_same_service_id = true;
- } else if (std::string("MULTIPLE_EVENTS") == std::string(argv[i])) {
- subscribe_multiple_events = 5;
- } else if (std::string("STRICT_CHECKING") == std::string(argv[i])) {
- initial_event_strict_checking = true;
- } else if (std::string("DONT_EXIT") == std::string(argv[i])) {
- dont_exit = true;
- }
- }
- }
-
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/initial_event_tests/initial_event_test_globals.hpp b/test/initial_event_tests/initial_event_test_globals.hpp
deleted file mode 100644
index ce69ea9..0000000
--- a/test/initial_event_tests/initial_event_test_globals.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2014-2017 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 SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_
-#define SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_
-
-namespace initial_event_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
- vsomeip::event_t event_id;
- vsomeip::eventgroup_t eventgroup_id;
-};
-
-static constexpr std::array<service_info, 7> service_infos = {{
- // placeholder to be consistent w/ client ids, service ids, app names
- { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF },
- // node 1
- { 0x1111, 0x1, 0x1111, 0x1111, 0x1000 },
- { 0x2222, 0x1, 0x2222, 0x2222, 0x2000 },
- { 0x3333, 0x1, 0x3333, 0x3333, 0x3000 },
- // node 2
- { 0x4444, 0x1, 0x4444, 0x4444, 0x4000 },
- { 0x5555, 0x1, 0x5555, 0x5555, 0x5000 },
- { 0x6666, 0x1, 0x6666, 0x6666, 0x6000 }
-}};
-
-static constexpr std::array<service_info, 7> service_infos_same_service_id = {{
- // placeholder to be consistent w/ client ids, service ids, app names
- { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF },
- // node 1
- { 0x1111, 0x1, 0x1111, 0x1111, 0x1000 },
- { 0x1111, 0x2, 0x2222, 0x2222, 0x2000 },
- { 0x1111, 0x3, 0x3333, 0x3333, 0x3000 },
- // node 2
- { 0x2222, 0x1, 0x4444, 0x4444, 0x4000 },
- { 0x2222, 0x2, 0x5555, 0x5555, 0x5000 },
- { 0x2222, 0x3, 0x6666, 0x6666, 0x6000 }
-}};
-
-static constexpr service_info stop_service_master = { 0x8888, 0x1, 0x8888, 0x0, 0x0 };
-static constexpr service_info stop_service_slave = { 0x9999, 0x1, 0x9999, 0x0, 0x0 };
-
-static constexpr int notifications_to_send = 1;
-}
-
-#endif /* SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ */
diff --git a/test/initial_event_tests/initial_event_test_master_starter.sh b/test/initial_event_tests/initial_event_test_master_starter.sh
deleted file mode 100755
index 9eee669..0000000
--- a/test/initial_event_tests/initial_event_test_master_starter.sh
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-if [ $# -lt 2 ]
-then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP initial_event_test_diff_client_ids_diff_ports_master.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Please pass a json file to this script."
- echo "For example: $0 UDP initial_event_test_diff_client_ids_diff_ports_master.json"
- echo "To use the same service id but different instances on the node pass SAME_SERVICE_ID as third parameter"
- exit 1
-fi
-
-PASSED_SUBSCRIPTION_TYPE=$1
-PASSED_JSON_FILE=$2
-# Remove processed options from $@
-shift 2
-REMAINING_OPTIONS="$@"
-
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $PASSED_SUBSCRIPTION_TYPE ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
-print_starter_message () {
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting initial event test on slave LXC with params $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $REMAINING_OPTIONS"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./initial_event_test_slave_starter.sh $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $REMAINING_OPTIONS\"" &
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name ietms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./initial_event_test_slave_starter.sh $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $REMAINING_OPTIONS" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** initial_event_test_slave_starter.sh $PASSED_SUBSCRIPTION_TYPE $CLIENT_JSON_FILE $REMAINING_OPTIONS
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** initial_event_test_diff_client_ids_diff_ports_master.json and
-** initial_event_test_diff_client_ids_diff_ports_slave.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-}
-
-# replace master with slave to be able display the correct json file to be used
-# with the slave script
-MASTER_JSON_FILE=$PASSED_JSON_FILE
-CLIENT_JSON_FILE=${MASTER_JSON_FILE/master/slave}
-
-FAIL=0
-
-# Start the services
-export VSOMEIP_CONFIGURATION=$PASSED_JSON_FILE
-
-export VSOMEIP_APPLICATION_NAME=initial_event_test_service_one
-./initial_event_test_service 1 $REMAINING_OPTIONS &
-PID_SERVICE_ONE=$!
-
-export VSOMEIP_APPLICATION_NAME=initial_event_test_service_two
-./initial_event_test_service 2 $REMAINING_OPTIONS &
-PID_SERVICE_TWO=$!
-
-export VSOMEIP_APPLICATION_NAME=initial_event_test_service_three
-./initial_event_test_service 3 $REMAINING_OPTIONS &
-PID_SERVICE_THREE=$!
-
-unset VSOMEIP_APPLICATION_NAME
-
-# Array for client pids
-CLIENT_PIDS=()
-
-# Start first client which subscribes remotely
-./initial_event_test_client 9000 $PASSED_SUBSCRIPTION_TYPE DONT_EXIT $REMAINING_OPTIONS &
-FIRST_PID=$!
-
-# Start availability checker in order to wait until the services on the remote
-# were started as well
-./initial_event_test_availability_checker 1234 $REMAINING_OPTIONS &
-PID_AVAILABILITY_CHECKER=$!
-
-sleep 1
-
-print_starter_message
-
-
-# wait until the services on the remote node were started as well
-wait $PID_AVAILABILITY_CHECKER
-
-sleep 2
-
-for client_number in $(seq 9001 9011)
-do
- ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE STRICT_CHECKING $REMAINING_OPTIONS &
- CLIENT_PIDS+=($!)
-done
-
-# Wait until all clients are finished
-for job in ${CLIENT_PIDS[*]}
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# wait until all clients exited on slave side
-./initial_event_test_stop_service MASTER &
-PID_STOP_SERVICE=$!
-wait $PID_STOP_SERVICE
-
-# shutdown the first client
-kill $FIRST_PID
-wait $FIRST_PID || FAIL=$(($FAIL+1))
-
-# shutdown the services
-kill $PID_SERVICE_THREE
-kill $PID_SERVICE_TWO
-kill $PID_SERVICE_ONE
-
-sleep 1
-echo ""
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop ietms
- docker rm ietms
-fi
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/initial_event_tests/initial_event_test_service.cpp b/test/initial_event_tests/initial_event_test_service.cpp
deleted file mode 100644
index 037149e..0000000
--- a/test/initial_event_tests/initial_event_test_service.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "initial_event_test_globals.hpp"
-
-
-class initial_event_test_service {
-public:
- initial_event_test_service(struct initial_event_test::service_info _service_info,
- std::uint32_t _events_to_offer) :
- service_info_(_service_info),
- app_(vsomeip::runtime::get()->create_application()),
- wait_until_registered_(true),
- events_to_offer_(_events_to_offer),
- offer_thread_(std::bind(&initial_event_test_service::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&initial_event_test_service::on_state, this,
- std::placeholders::_1));
-
- // offer field
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(service_info_.eventgroup_id);
- for (std::uint16_t i = 0; i < events_to_offer_; i++) {
- app_->offer_event(service_info_.service_id, service_info_.instance_id,
- static_cast<vsomeip::event_t>(service_info_.event_id + i), its_eventgroups, true);
- }
-
- // set value to field
- std::shared_ptr<vsomeip::payload> its_payload =
- vsomeip::runtime::get()->create_payload();
- vsomeip::byte_t its_data[2] = {static_cast<vsomeip::byte_t>((service_info_.service_id & 0xFF00) >> 8),
- static_cast<vsomeip::byte_t>((service_info_.service_id & 0xFF))};
- its_payload->set_data(its_data, 2);
- for (std::uint16_t i = 0; i < events_to_offer_; i++) {
- app_->notify(service_info_.service_id, service_info_.instance_id,
- static_cast<vsomeip::event_t>(service_info_.event_id + i), its_payload);
- }
-
- app_->start();
- }
-
- ~initial_event_test_service() {
- offer_thread_.join();
- }
-
- void offer() {
- app_->offer_service(service_info_.service_id, service_info_.instance_id);
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
- }
-
-private:
- initial_event_test::service_info service_info_;
- std::shared_ptr<vsomeip::application> app_;
-
- bool wait_until_registered_;
- std::uint32_t events_to_offer_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::thread offer_thread_;
-};
-
-static int service_number;
-static bool use_same_service_id;
-static std::uint32_t offer_multiple_events;
-
-TEST(someip_initial_event_test, set_field_once)
-{
- if(use_same_service_id) {
- initial_event_test_service its_sample(
- initial_event_test::service_infos_same_service_id[service_number], offer_multiple_events);
- } else {
- initial_event_test_service its_sample(
- initial_event_test::service_infos[service_number], offer_multiple_events);
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a service number and subscription type, like: " << argv[0] << " 2 SAME_SERVICE_ID" << std::endl;
- std::cerr << "Valid service numbers are in the range of [1,6]" << std::endl;
- std::cerr << "After the service number one/multiple of these flags can be specified:";
- std::cerr << " - SAME_SERVICE_ID flag. If set the test is run w/ multiple instances of the same service, default false" << std::endl;
- std::cerr << " - MULTIPLE_EVENTS flag. If set the test will offer to multiple events in the eventgroup, default false" << std::endl;
- return 1;
- }
-
- service_number = std::stoi(std::string(argv[1]), nullptr);
-
- offer_multiple_events = 1;
- use_same_service_id = false;
-
- if (argc > 2) {
- for (int i = 2; i < argc; i++) {
- if (std::string("SAME_SERVICE_ID") == std::string(argv[i])) {
- use_same_service_id = true;
- } else if (std::string("MULTIPLE_EVENTS") == std::string(argv[i])) {
- offer_multiple_events = 5;
- }
- }
- }
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/initial_event_tests/initial_event_test_slave_starter.sh b/test/initial_event_tests/initial_event_test_slave_starter.sh
deleted file mode 100755
index 69e96f7..0000000
--- a/test/initial_event_tests/initial_event_test_slave_starter.sh
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-if [ $# -lt 2 ]
-then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP initial_event_test_diff_client_ids_diff_ports_slave.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Please pass a json file to this script."
- echo "For example: $0 UDP initial_event_test_diff_client_ids_diff_ports_slave.json"
- echo "To use the same service id but different instances on the node pass SAME_SERVICE_ID as third parameter"
- exit 1
-fi
-
-PASSED_SUBSCRIPTION_TYPE=$1
-PASSED_JSON_FILE=$2
-# Remove processed options from $@
-shift 2
-REMAINING_OPTIONS=$@
-
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $PASSED_SUBSCRIPTION_TYPE ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
-
-FAIL=0
-
-export VSOMEIP_CONFIGURATION=$PASSED_JSON_FILE
-
-# Start the services
-export VSOMEIP_APPLICATION_NAME=initial_event_test_service_four
-./initial_event_test_service 4 $REMAINING_OPTIONS &
-PID_SERVICE_FOUR=$!
-
-export VSOMEIP_APPLICATION_NAME=initial_event_test_service_five
-./initial_event_test_service 5 $REMAINING_OPTIONS &
-PID_SERVICE_FIVE=$!
-
-export VSOMEIP_APPLICATION_NAME=initial_event_test_service_six
-./initial_event_test_service 6 $REMAINING_OPTIONS &
-PID_SERVICE_SIX=$!
-
-unset VSOMEIP_APPLICATION_NAME
-
-# Array for client pids
-CLIENT_PIDS=()
-
-# Start first client which subscribes remotely
-./initial_event_test_client 9000 $PASSED_SUBSCRIPTION_TYPE DONT_EXIT $REMAINING_OPTIONS &
-FIRST_PID=$!
-
-# Start availability checker in order to wait until the services on the remote
-# were started as well
-./initial_event_test_availability_checker 1234 $REMAINING_OPTIONS &
-PID_AVAILABILITY_CHECKER=$!
-
-# wait until the services on the remote node were started as well
-wait $PID_AVAILABILITY_CHECKER
-sleep 2;
-for client_number in $(seq 9001 9011)
-do
- ./initial_event_test_client $client_number $PASSED_SUBSCRIPTION_TYPE STRICT_CHECKING $REMAINING_OPTIONS &
- CLIENT_PIDS+=($!)
-done
-
-# Wait until all clients are finished
-for job in ${CLIENT_PIDS[*]}
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# wait until all clients exited on master side
-./initial_event_test_stop_service SLAVE &
-PID_STOP_SERVICE=$!
-wait $PID_STOP_SERVICE
-
-# shutdown the first client
-kill $FIRST_PID
-wait $FIRST_PID || FAIL=$(($FAIL+1))
-
-# shutdown the services
-kill $PID_SERVICE_SIX
-kill $PID_SERVICE_FIVE
-kill $PID_SERVICE_FOUR
-
-sleep 1
-echo ""
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/initial_event_tests/initial_event_test_stop_service.cpp b/test/initial_event_tests/initial_event_test_stop_service.cpp
deleted file mode 100644
index 8f32fbc..0000000
--- a/test/initial_event_tests/initial_event_test_stop_service.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <atomic>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "initial_event_test_globals.hpp"
-
-
-class initial_event_test_stop_service {
-public:
- initial_event_test_stop_service(struct initial_event_test::service_info _service_info, bool _is_master) :
- service_info_(_service_info),
- is_master_(_is_master),
- app_(vsomeip::runtime::get()->create_application()),
- wait_until_registered_(true),
- wait_until_stop_service_other_node_available_(true),
- wait_until_shutdown_method_called_(true),
- offer_thread_(std::bind(&initial_event_test_stop_service::run, this)),
- wait_for_stop_(true),
- stop_thread_(std::bind(&initial_event_test_stop_service::wait_for_stop, this)),
- called_other_node_(false) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&initial_event_test_stop_service::on_state, this,
- std::placeholders::_1));
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.method_id,
- std::bind(&initial_event_test_stop_service::on_shutdown_method_called, this,
- std::placeholders::_1));
-
- // register availability for all other services and request their event.
- if (is_master_) {
- app_->request_service(
- initial_event_test::stop_service_slave.service_id,
- initial_event_test::stop_service_slave.instance_id);
- app_->register_availability_handler(
- initial_event_test::stop_service_slave.service_id,
- initial_event_test::stop_service_slave.instance_id,
- std::bind(&initial_event_test_stop_service::on_availability,
- this, std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- } else {
- app_->request_service(
- initial_event_test::stop_service_master.service_id,
- initial_event_test::stop_service_master.instance_id);
- app_->register_availability_handler(
- initial_event_test::stop_service_master.service_id,
- initial_event_test::stop_service_master.instance_id,
- std::bind(&initial_event_test_stop_service::on_availability,
- this, std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- }
- app_->start();
- }
-
- ~initial_event_test_stop_service() {
- offer_thread_.join();
- stop_thread_.join();
- }
-
- void offer() {
- if (is_master_) {
- app_->offer_service(
- initial_event_test::stop_service_master.service_id,
- initial_event_test::stop_service_master.instance_id);
- } else {
- app_->offer_service(
- initial_event_test::stop_service_slave.service_id,
- initial_event_test::stop_service_slave.instance_id);
- }
- }
-
- void stop_offer() {
- if (is_master_) {
- app_->stop_offer_service(
- initial_event_test::stop_service_master.service_id,
- initial_event_test::stop_service_master.instance_id);
- } else {
- app_->stop_offer_service(
- initial_event_test::stop_service_slave.service_id,
- initial_event_test::stop_service_slave.instance_id);
- }
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- bool notify(false);
- if(_is_available) {
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service
- << "." << _instance << "] is available.";
- if(is_master_) {
- if(_service == initial_event_test::stop_service_slave.service_id
- && _instance == initial_event_test::stop_service_slave.instance_id) {
- notify = true;
- }
- } else {
- if(_service == initial_event_test::stop_service_master.service_id
- && _instance == initial_event_test::stop_service_master.instance_id) {
- notify = true;
- }
- }
- }
- if (notify) {
- std::lock_guard<std::mutex> its_lock(availability_mutex_);
- wait_until_stop_service_other_node_available_ = false;
- availability_condition_.notify_one();
- }
- }
-
- void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST_NO_RETURN) {
- VSOMEIP_DEBUG << "Received a request with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] shutdown method called";
-
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- stop_condition_.notify_one();
- }
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
-
- {
- std::unique_lock<std::mutex> its_availability_lock(availability_mutex_);
- while (wait_until_stop_service_other_node_available_) {
- availability_condition_.wait(its_availability_lock);
- }
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Calling shutdown method on remote side";
-
- std::shared_ptr<vsomeip::message> msg(vsomeip::runtime::get()->create_request());
- msg->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
- if(is_master_) {
- msg->set_service(initial_event_test::stop_service_slave.service_id);
- msg->set_instance(initial_event_test::stop_service_slave.instance_id);
- msg->set_method(initial_event_test::stop_service_slave.method_id);
- } else {
- msg->set_service(initial_event_test::stop_service_master.service_id);
- msg->set_instance(initial_event_test::stop_service_master.instance_id);
- msg->set_method(initial_event_test::stop_service_master.method_id);
- }
- app_->send(msg);
- called_other_node_ = true;
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_shutdown_method_called_) {
- condition_.wait(its_lock);
- }
- }
- }
-
- void wait_for_stop() {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id
- << "] shutdown method was called, going down";
- while(!called_other_node_) {
- std::this_thread::sleep_for(std::chrono::milliseconds(50));
- }
- // let offer thread exit
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_shutdown_method_called_ = false;
- condition_.notify_one();
- }
- app_->clear_all_handler();
- app_->stop();
- }
-
-private:
- initial_event_test::service_info service_info_;
- bool is_master_;
- std::shared_ptr<vsomeip::application> app_;
- std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
- std::map<std::pair<vsomeip::service_t, vsomeip::method_t>, std::uint32_t> other_services_received_notification_;
-
- bool wait_until_registered_;
- bool wait_until_stop_service_other_node_available_;
- bool wait_until_shutdown_method_called_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::thread offer_thread_;
-
- std::mutex availability_mutex_;
- std::condition_variable availability_condition_;
-
- std::atomic<bool> wait_for_stop_;
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
- std::thread stop_thread_;
-
- std::atomic<bool> called_other_node_;
-};
-
-static bool is_master = false;
-
-TEST(someip_initial_event_test, wait_for_stop_method_to_be_called)
-{
- if(is_master) {
- initial_event_test_stop_service its_sample(initial_event_test::stop_service_master, is_master);
- } else {
- initial_event_test_stop_service its_sample(initial_event_test::stop_service_slave, is_master);
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a valid type, like: " << argv[0] << " MASTER" << std::endl;
- std::cerr << "Valid types are in the range of [MASTER,SLAVE]" << std::endl;
- return 1;
- }
-
- if (argc >= 2 && std::string("MASTER") == std::string(argv[1])) {
- is_master = true;
- } else if (argc >= 2 && std::string("SLAVE") == std::string(argv[1])){
- is_master = false;
- }
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/magic_cookies_tests/conf/magic_cookies_test_client.json.in b/test/magic_cookies_tests/conf/magic_cookies_test_client.json.in
deleted file mode 100644
index bcb2e29..0000000
--- a/test/magic_cookies_tests/conf/magic_cookies_test_client.json.in
+++ /dev/null
@@ -1,85 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "netmask":"255.255.255.0",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"true",
- "path":"/var/log/vsomeip.log"
- },
- "dlt":"true"
- },
- "applications":
- [
- {
- "name":"magic_cookies_test_client",
- "id":"0x1343"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x5678",
- "unicast":"@TEST_IP_MASTER@",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"true"
- },
- "events":
- [
- {
- "event":"0x0777",
- "is_field":"true"
- },
- {
- "event":"0x0778",
- "is_field":"false"
- },
- {
- "event":"0x0779",
- "is_field":"true"
- }
- ],
- "eventgroups":
- [
- {
- "eventgroup":"0x4455",
- "events":
- [
- "0x777",
- "0x778"
- ]
- },
- {
- "eventgroup":"0x4465",
- "events":
- [
- "0x778",
- "0x779"
- ]
- },
- {
- "eventgroup":"0x4555",
- "events":
- [
- "0x777",
- "0x779"
- ]
- }
- ]
- }
- ],
- "routing":"magic_cookies_test_client",
- "service-discovery":
- {
- "enable":"false",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/magic_cookies_tests/conf/magic_cookies_test_service.json.in b/test/magic_cookies_tests/conf/magic_cookies_test_service.json.in
deleted file mode 100644
index 0e53c24..0000000
--- a/test/magic_cookies_tests/conf/magic_cookies_test_service.json.in
+++ /dev/null
@@ -1,88 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"debug",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"magic_cookies_test_service",
- "id":"0x1277"
- }
- ],
- "services":
- [
- {
- "service":"0x1234",
- "instance":"0x5678",
- "reliable":
- {
- "port":"30509",
- "enable-magic-cookies":"true"
- },
- "events":
- [
- {
- "event":"0x0777",
- "is_field":"false",
- "is_reliable":"true",
- "update-cycle":"2000"
- },
- {
- "event":"0x0778",
- "is_field":"true",
- "is_reliable":"true",
- "update-cycle":"0"
- },
- {
- "event":"0x0779",
- "is_field":"false",
- "is_reliable":"true"
- }
- ],
- "eventgroups":
- [
- {
- "eventgroup":"0x4455",
- "events":
- [
- "0x777",
- "0x778"
- ]
- },
- {
- "eventgroup":"0x4465",
- "events":
- [
- "0x778",
- "0x779"
- ]
- },
- {
- "eventgroup":"0x4555",
- "events":
- [
- "0x777",
- "0x779"
- ]
- }
- ]
- }
- ],
- "routing":"magic_cookies_test_service",
- "service-discovery":
- {
- "enable":"false",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp"
- }
-}
diff --git a/test/magic_cookies_tests/magic_cookies_test_client.cpp b/test/magic_cookies_tests/magic_cookies_test_client.cpp
deleted file mode 100644
index 4be0889..0000000
--- a/test/magic_cookies_tests/magic_cookies_test_client.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright (C) 2015-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <memory>
-#include <thread>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../someip_test_globals.hpp"
-#include "../implementation/runtime/include/application_impl.hpp"
-#include "../implementation/routing/include/routing_manager.hpp"
-
-class magic_cookies_test_client {
-public:
- magic_cookies_test_client()
- : app_(new vsomeip::application_impl("")),
- is_available_(false),
- is_blocked_(false),
- sent_messages_good_(8),
- sent_messages_bad_(7),
- received_responses_(0),
- received_errors_(0),
- wait_for_replies_(true),
- runner_(std::bind(&magic_cookies_test_client::run, this)) {
- }
-
- void init() {
- VSOMEIP_INFO << "Initializing...";
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- exit(EXIT_FAILURE);
- }
-
- app_->register_state_handler(
- std::bind(
- &magic_cookies_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(&magic_cookies_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(&magic_cookies_test_client::on_availability,
- this,
- std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
- }
-
- void start() {
- VSOMEIP_INFO << "Starting...";
- app_->start();
- }
-
- void stop() {
- VSOMEIP_INFO << "Stopping...";
- app_->clear_all_handler();
- app_->stop();
- }
-
- void on_state(vsomeip::state_type_e _state) {
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- VSOMEIP_INFO << "Client registration done.";
- app_->request_service(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR,
- false);
- }
- }
-
- void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
- VSOMEIP_INFO << "Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is "
- << (_is_available ? "available." : "NOT available.");
-
- if (vsomeip_test::TEST_SERVICE_SERVICE_ID == _service && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) {
- static bool is_available = false;
- if (is_available && !_is_available) is_available = false;
- else if (_is_available && !is_available) {
- is_available = true;
- std::lock_guard< std::mutex > its_lock(mutex_);
- is_blocked_ = true;
- condition_.notify_one();
- }
- }
- }
-
- void on_message(const std::shared_ptr< vsomeip::message > &_response) {
- if (_response->get_return_code() == vsomeip::return_code_e::E_OK) {
- 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()
- << "]";
- received_responses_++;
- } else if (_response->get_return_code() == vsomeip::return_code_e::E_MALFORMED_MESSAGE) {
- VSOMEIP_INFO << "Received an error message 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()
- << "]";
- received_errors_++;
- }
- if (received_errors_ == sent_messages_bad_
- && received_responses_ == sent_messages_good_) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_for_replies_ = false;
- condition_.notify_one();
- }
- }
-
- void join() {
- runner_.join();
- }
-
- void run() {
- std::unique_lock< std::mutex > its_lock(mutex_);
- while (!is_blocked_) {
- if (std::cv_status::timeout ==
- condition_.wait_for(its_lock, std::chrono::milliseconds(5000))) {
- GTEST_NONFATAL_FAILURE_("Service didn't become available within 5s.");
- break;
- }
- }
- VSOMEIP_INFO << "Running...";
-
- vsomeip::routing_manager *its_routing = app_->get_routing_manager();
-
- vsomeip::byte_t its_good_payload_data[] = {
- 0x12, 0x34, 0x84, 0x21,
- 0x00, 0x00, 0x00, 0x11,
- 0x13, 0x43, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01
- };
-
- vsomeip::byte_t its_bad_payload_data[] = {
- 0x12, 0x34, 0x84, 0x21,
- 0x00, 0x00, 0x01, 0x23,
- 0x13, 0x43, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01
- };
-
- // Test sequence
- its_good_payload_data[11] = 0x01;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_bad_payload_data[11] = 0x02;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_good_payload_data[11] = 0x03;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_bad_payload_data[11] = 0x04;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_bad_payload_data[11] = 0x05;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_good_payload_data[11] = 0x06;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_good_payload_data[11] = 0x07;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_bad_payload_data[11] = 0x08;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_bad_payload_data[11] = 0x09;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_bad_payload_data[11] = 0x0A;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_good_payload_data[11] = 0x0B;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_good_payload_data[11] = 0x0C;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_good_payload_data[11] = 0x0D;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_bad_payload_data[11] = 0x0E;
- its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
- std::this_thread::sleep_for(std::chrono::seconds(11));
- its_good_payload_data[11] = 0x0F;
- its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
-
- while (wait_for_replies_) {
- if(std::cv_status::timeout ==
- condition_.wait_for(its_lock, std::chrono::milliseconds(5000))) {
- GTEST_NONFATAL_FAILURE_("Didn't receive all replies/errors in time");
- break;
- }
- }
- EXPECT_EQ(sent_messages_good_, received_responses_);
- EXPECT_EQ(sent_messages_bad_, received_errors_);
- stop();
- }
-
-private:
- std::shared_ptr< vsomeip::application_impl > app_;
- std::mutex mutex_;
- std::condition_variable condition_;
- bool is_available_;
- bool is_blocked_;
- const std::uint32_t sent_messages_good_;
- const std::uint32_t sent_messages_bad_;
- std::atomic<std::uint32_t> received_responses_;
- std::atomic<std::uint32_t> received_errors_;
- bool wait_for_replies_;
- std::thread runner_;
-};
-
-TEST(someip_magic_cookies_test, send_good_and_bad_messages)
-{
- magic_cookies_test_client its_client;
- its_client.init();
- its_client.start();
- its_client.join();
-}
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
-
diff --git a/test/magic_cookies_tests/magic_cookies_test_client_start.sh b/test/magic_cookies_tests/magic_cookies_test_client_start.sh
deleted file mode 100755
index 45f4d3c..0000000
--- a/test/magic_cookies_tests/magic_cookies_test_client_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=magic_cookies_test_client
-export VSOMEIP_CONFIGURATION=magic_cookies_test_client.json
-./magic_cookies_test_client
diff --git a/test/magic_cookies_tests/magic_cookies_test_service.cpp b/test/magic_cookies_tests/magic_cookies_test_service.cpp
deleted file mode 100644
index 7cd4376..0000000
--- a/test/magic_cookies_tests/magic_cookies_test_service.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../someip_test_globals.hpp"
-
-class magic_cookies_test_service {
-public:
- magic_cookies_test_service(bool _use_static_routing) :
- app_(vsomeip::runtime::get()->create_application()),
- is_registered_(false),
- use_static_routing_(_use_static_routing),
- blocked_(false),
- offer_thread_(std::bind(&magic_cookies_test_service::run, this)) {
- }
-
- ~magic_cookies_test_service() {
- offer_thread_.join();
- }
- void init() {
- std::lock_guard<std::mutex> its_lock(mutex_);
-
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- exit(EXIT_FAILURE);
- }
- app_->register_message_handler(
- vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- vsomeip_test::TEST_SERVICE_METHOD_ID,
- std::bind(&magic_cookies_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&magic_cookies_test_service::on_state, this,
- std::placeholders::_1));
-
- VSOMEIP_INFO<< "Static routing " << (use_static_routing_ ? "ON" : "OFF");
- }
-
- void start() {
- app_->start();
- }
-
- void offer() {
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- }
-
- void stop_offer() {
- app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- }
-
- void 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<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
- } else {
- is_registered_ = false;
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_request) {
- 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() << "]";
-
- std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get()
- ->create_response(_request);
-
- std::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()
- ->create_payload();
- std::vector<vsomeip::byte_t> its_payload_data;
- for (std::size_t i = 0; i < 120; ++i)
- its_payload_data.push_back(i % 256);
- its_payload->set_data(its_payload_data);
- its_response->set_payload(its_payload);
-
- app_->send(its_response, true);
- if(_request->get_session() == 0x0F) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
- }
-
- void run() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- condition_.wait(its_lock);
-
- bool is_offer(true);
- blocked_ = false;
-
- if (use_static_routing_) {
- offer();
- while (!blocked_) {
- if(std::cv_status::timeout ==
- condition_.wait_for(its_lock, std::chrono::seconds(200))) {
- GTEST_NONFATAL_FAILURE_("Didn't receive all requests within time");
- break;
- }
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(5));
- app_->clear_all_handler();
- app_->stop();
- } else {
- while (true) {
- if (is_offer)
- offer();
- else
- stop_offer();
- std::this_thread::sleep_for(std::chrono::milliseconds(10000));
- is_offer = !is_offer;
- }
- }
- }
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
- bool use_static_routing_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- std::thread offer_thread_;
-};
-
-static bool use_static_routing = false;
-
-TEST(someip_magic_cookies_test, reply_to_good_messages)
-{
- magic_cookies_test_service its_sample(use_static_routing);
- its_sample.init();
- its_sample.start();
-}
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- std::string static_routing_enable("--static-routing");
- for (int i = 1; i < argc; i++) {
- if (static_routing_enable == argv[i]) {
- use_static_routing = true;
- }
- }
- return RUN_ALL_TESTS();
-}
diff --git a/test/magic_cookies_tests/magic_cookies_test_service_start.sh b/test/magic_cookies_tests/magic_cookies_test_service_start.sh
deleted file mode 100755
index 9288b7e..0000000
--- a/test/magic_cookies_tests/magic_cookies_test_service_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=magic_cookies_test_service
-export VSOMEIP_CONFIGURATION=magic_cookies_test_service.json
-./magic_cookies_test_service --tcp --static-routing
diff --git a/test/magic_cookies_tests/magic_cookies_test_starter.sh b/test/magic_cookies_tests/magic_cookies_test_starter.sh
deleted file mode 100755
index 631eef7..0000000
--- a/test/magic_cookies_tests/magic_cookies_test_starter.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit successfully.
-
-# Display a message to show the user that he must now call the external service
-# to finish the test successfully
-
-FAIL=0
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting magic cookies test on slave LXC"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./magic_cookies_test_client_start.sh\"" &
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./magic_cookies_test_client_start.sh" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** magic_cookies_test_client_start.sh
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** magic_cookies_client.json and
-** magic_cookies_service.json to your personal setup.
-**
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# Start the client for magic-cookies test
-export VSOMEIP_APPLICATION_NAME=magic_cookies_test_service
-export VSOMEIP_CONFIGURATION=magic_cookies_test_service.json
-./magic_cookies_test_service --tcp --static-routing &
-
-# Wait until client and service are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-# Check if client and server both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/malicious_data_tests/conf/malicious_data_test_master.json.in b/test/malicious_data_tests/conf/malicious_data_test_master.json.in
deleted file mode 100644
index 066989b..0000000
--- a/test/malicious_data_tests/conf/malicious_data_test_master.json.in
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications" :
- [
- {
- "name" : "malicious_data_test_service",
- "id" : "0x4289",
- "max_dispatch_time" : "1000"
- }
- ],
- "services":
- [
- {
- "service":"0x3345",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"vsomeipd",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.24.1",
- "port":"30490",
- "protocol":"udp",
- "cyclic_offer_delay" : "1000"
- }
-} \ No newline at end of file
diff --git a/test/malicious_data_tests/conf/malicious_data_test_master_starter.sh.in b/test/malicious_data_tests/conf/malicious_data_test_master_starter.sh.in
deleted file mode 100755
index 199f318..0000000
--- a/test/malicious_data_tests/conf/malicious_data_test_master_starter.sh.in
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-FAIL=0
-
-export VSOMEIP_CONFIGURATION=malicious_data_test_master.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-# Start the services
-./malicious_data_test_service &
-PID_SERIVCE=$!
-
-sleep 1
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "Waiting for 5s"
- sleep 5
- echo "starting offer test on slave LXC offer_test_external_slave_starter.sh"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./malicious_data_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@\"" &
- echo "remote ssh pid: $!"
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name otems --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./malicious_data_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** malicious_data_test_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** malicious_data_test_master.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# Wait until all clients and services are finished
-for job in $PID_SERIVCE
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- echo "waiting for $job"
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_VSOMEIPD
-sleep 1
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop otems
- docker rm otems
-fi
-
-# Check if everything went well
-exit $FAIL
diff --git a/test/malicious_data_tests/malicious_data_test_globals.hpp b/test/malicious_data_tests/malicious_data_test_globals.hpp
deleted file mode 100644
index f6336a4..0000000
--- a/test/malicious_data_tests/malicious_data_test_globals.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (C) 2014-2017 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 MALICIOUS_DATA_TEST_GLOBALS_HPP_
-#define MALICIOUS_DATA_TEST_GLOBALS_HPP_
-
-namespace malicious_data_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
- vsomeip::event_t event_id;
- vsomeip::eventgroup_t eventgroup_id;
- vsomeip::method_t shutdown_method_id;
- vsomeip::method_t notify_method_id;
-};
-
-struct service_info service = { 0x3344, 0x1, 0x1111, 0x8002, 0x1, 0x1404, 0x4242 };
-
-enum test_mode_e {
- SUBSCRIBE,
- SUBSCRIBE_UNSUBSCRIBE,
- UNSUBSCRIBE,
- SUBSCRIBE_UNSUBSCRIBE_NACK
-};
-
-}
-
-#endif /* MALICIOUS_DATA_TEST_GLOBALS_HPP_ */
diff --git a/test/malicious_data_tests/malicious_data_test_msg_sender.cpp b/test/malicious_data_tests/malicious_data_test_msg_sender.cpp
deleted file mode 100644
index ad856b8..0000000
--- a/test/malicious_data_tests/malicious_data_test_msg_sender.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright (C) 2015-2017 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 <iostream>
-#include <memory>
-#include <thread>
-#include <chrono>
-#include <cstring>
-#include <future>
-
-#include <gtest/gtest.h>
-
-#include <boost/asio.hpp>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../../implementation/utility/include/byteorder.hpp"
-#include "../../implementation/message/include/deserializer.hpp"
-#include "../../implementation/service_discovery/include/service_discovery.hpp"
-#include "../../implementation/service_discovery/include/message_impl.hpp"
-#include "../../implementation/service_discovery/include/constants.hpp"
-#include "../../implementation/service_discovery/include/enumeration_types.hpp"
-#include "../../implementation/service_discovery/include/eventgroupentry_impl.hpp"
-#include "../../implementation/message/include/message_impl.hpp"
-#include "malicious_data_test_globals.hpp"
-
-static char* remote_address;
-static char* local_address;
-
-class malicious_data : public ::testing::Test {
-public:
- malicious_data() :
- work_(std::make_shared<boost::asio::io_service::work>(io_)),
- io_thread_(std::bind(&malicious_data::io_run, this)) {}
-protected:
-
- void TearDown() {
- work_.reset();
- io_thread_.join();
- io_.stop();
- }
-
- void io_run() {
- io_.run();
- }
-
- boost::asio::io_service io_;
- std::shared_ptr<boost::asio::io_service::work> work_;
- std::thread io_thread_;
-};
-
-TEST_F(malicious_data, send_malicious_events)
-{
- std::promise<bool> client_subscribed;
-
- boost::asio::ip::tcp::socket tcp_socket(io_);
- boost::asio::ip::udp::socket udp_socket(io_,
- boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490));
-
- std::thread receive_thread([&](){
- std::atomic<bool> keep_receiving(true);
- std::function<void()> receive;
- std::vector<std::uint8_t> receive_buffer(4096);
- std::vector<vsomeip::event_t> its_received_events;
-
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
- if (error) {
- keep_receiving = false;
- ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #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]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(1u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP, e->get_type());
- EXPECT_EQ(1,e->get_num_options(1));
- EXPECT_EQ(std::uint32_t(0xFFFFFF), e->get_ttl());
- EXPECT_EQ(malicious_data_test::service.service_id, e->get_service());
- EXPECT_EQ(malicious_data_test::service.instance_id, e->get_instance());
- EXPECT_EQ(1u, sd_msg.get_options().size());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_EQ(1u, its_casted_entry->get_eventgroup());
- }
- client_subscribed.set_value(true);
- keep_receiving = false;
- }
- }
- }
-
-
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(keep_receiving) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- });
-
- std::thread send_thread([&]() {
- try {
- std::promise<bool> client_connected;
- boost::asio::ip::tcp::socket::endpoint_type local(
- boost::asio::ip::address::from_string(std::string(local_address)),
- 40001);
- boost::asio::ip::tcp::acceptor its_acceptor(io_);
- boost::system::error_code ec;
- its_acceptor.open(local.protocol(), ec);
- boost::asio::detail::throw_error(ec, "acceptor open");
- its_acceptor.set_option(boost::asio::socket_base::reuse_address(true), ec);
- boost::asio::detail::throw_error(ec, "acceptor set_option");
- its_acceptor.bind(local, ec);
- boost::asio::detail::throw_error(ec, "acceptor bind");
- its_acceptor.listen(boost::asio::socket_base::max_connections, ec);
- boost::asio::detail::throw_error(ec, "acceptor listen");
- its_acceptor.async_accept(tcp_socket, [&](boost::system::error_code _error) {
- if (!_error) {
- // Nagle algorithm off
- tcp_socket.set_option(boost::asio::ip::tcp::no_delay(true));
- client_connected.set_value(true);
- } else {
- ADD_FAILURE() << "accept_cbk: " << _error.message();
- }
- });
-
-
- // offer the service
- std::uint8_t its_offer_service_message[] = {
- 0xff, 0xff, 0x81, 0x00,
- 0x00, 0x00, 0x00, 0x30, // length
- 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x01, 0x02, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, // length entries array
- 0x01, 0x00, 0x00, 0x20,
- 0x33, 0x44, 0x00, 0x01, // service / instance
- 0x00, 0xff, 0xff, 0xff, // major / ttl
- 0x00, 0x00, 0x00, 0x00, // minor
- 0x00, 0x00, 0x00, 0x0c, // length options array
- 0x00, 0x09, 0x04, 0x00,
- 0xff, 0xff, 0xff, 0xff, // slave address
- 0x00, 0x06, 0x9c, 0x41,
- };
- boost::asio::ip::address its_local_address =
- boost::asio::ip::address::from_string(std::string(local_address));
- std::memcpy(&its_offer_service_message[48], &its_local_address.to_v4().to_bytes()[0], 4);
-
- boost::asio::ip::udp::socket::endpoint_type target_sd(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30490);
- udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd);
-
- // wait until client established TCP connection
- if (std::future_status::timeout == client_connected.get_future().wait_for(std::chrono::seconds(10))) {
- ADD_FAILURE() << "Client didn't connect within time";
- }
-
- // wait until client subscribed
- if (std::future_status::timeout == client_subscribed.get_future().wait_for(std::chrono::seconds(10))) {
- ADD_FAILURE() << "Client didn't subscribe within time";
- }
-
- // send malicious data as server
- std::uint8_t its_malicious_data[] = {
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x11, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x38, 0x4f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x5f, 0x5f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x86, 0x6f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xad, 0x7f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xd4, 0x8f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xfb, 0x9f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x22, 0xaf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, // payload missing
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x49, 0xbf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x70, 0xcf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x43, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x6d, 0x80, 0x00, 0x45, 0x22, 0x80, 0x00, 0x45, 0x3b, 0x80, 0x00, 0x43, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x97, 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x23, 0x99, 0x00, 0x4e, 0xb3, 0xe4, 0x4e, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x48, 0x00, 0x00, 0x45, 0x96, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x45, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x22, 0x91, 0x00, 0x4e, 0xb3, 0xe3, 0xd7, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x44, 0x48, 0x00, 0x00, 0x45, 0x9c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xe5, 0xff, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x21, 0x6c, 0x00, 0x4e, 0xb3, 0xe3, 0x55, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x20, 0x00, 0x44, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x0d, 0x0f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x20, 0xa9, 0x00, 0x4e, 0xb3, 0xe3, 0x56, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x45, 0x6d, 0x80, 0x00, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x34, 0x1f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1f, 0xc6, 0x00, 0x4e, 0xb3, 0xe3, 0x87, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x96, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x44, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x5b, 0x2f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1e, 0xf1, 0x00, 0x4e, 0xb3, 0xe3, 0x5e, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x45, 0x9c, 0x40, 0x00, 0x45, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x82, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xad, 0x00, 0x4e, 0xb3, 0xe3, 0xa8, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x48, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x44, 0xaf, 0x00, 0x00, 0x45, 0x3b, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xa9, 0x4f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xec, 0x00, 0x4e, 0xb3, 0xe3, 0xd8, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xa8, 0xc0, 0x00, 0x44, 0xaf, 0x00, 0x00, 0x45, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xd0, 0x5f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xfa, 0x00, 0x00, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xf7, 0x6f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x19, 0x20, 0x00, 0x43, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x44, 0x80, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1e, 0x7f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x09, 0x80, 0x00, 0x44, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- };
- tcp_socket.send(boost::asio::buffer(its_malicious_data));
-
- // establish second tcp connection as client and send malicious data as well
- boost::asio::ip::tcp::socket tcp_socket2(io_);
- boost::asio::ip::tcp::socket::endpoint_type remote(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 40001);
- tcp_socket2.open(remote.protocol());
- tcp_socket2.connect(remote);
- std::uint8_t its_malicious_client_data[] = {
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x11, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x38, 0x4f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x5f, 0x5f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x86, 0x6f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xad, 0x7f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xd4, 0x8f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0xfb, 0x9f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x22, 0xaf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, // payload missing
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x49, 0xbf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x24, 0x02, 0x00, 0x4e, 0xb3, 0xe4, 0x7a, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x70, 0xcf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x43, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x6d, 0x80, 0x00, 0x45, 0x22, 0x80, 0x00, 0x45, 0x3b, 0x80, 0x00, 0x43, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x97, 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x23, 0x99, 0x00, 0x4e, 0xb3, 0xe4, 0x4e, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x48, 0x00, 0x00, 0x45, 0x96, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x45, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x22, 0x91, 0x00, 0x4e, 0xb3, 0xe3, 0xd7, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x44, 0x48, 0x00, 0x00, 0x45, 0x9c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xe5, 0xff, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x21, 0x6c, 0x00, 0x4e, 0xb3, 0xe3, 0x55, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x20, 0x00, 0x44, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x0d, 0x0f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x20, 0xa9, 0x00, 0x4e, 0xb3, 0xe3, 0x56, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x45, 0x6d, 0x80, 0x00, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x34, 0x1f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1f, 0xc6, 0x00, 0x4e, 0xb3, 0xe3, 0x87, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x96, 0x00, 0x00, 0x45, 0x83, 0x40, 0x00, 0x44, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x5b, 0x2f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1e, 0xf1, 0x00, 0x4e, 0xb3, 0xe3, 0x5e, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x45, 0x9c, 0x40, 0x00, 0x45, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x82, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xad, 0x00, 0x4e, 0xb3, 0xe3, 0xa8, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x48, 0x00, 0x00, 0x45, 0x16, 0x00, 0x00, 0x44, 0xaf, 0x00, 0x00, 0x45, 0x3b, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xa9, 0x4f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xec, 0x00, 0x4e, 0xb3, 0xe3, 0xd8, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xa8, 0xc0, 0x00, 0x44, 0xaf, 0x00, 0x00, 0x45, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xd0, 0x5f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0xfa, 0x00, 0x00, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xf7, 0x6f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x19, 0x20, 0x00, 0x43, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x33, 0x45, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1e, 0x7f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x03, 0x05, 0x26, 0x5c, 0x00, 0x04, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x0e, 0x47, 0x36, 0x37, 0x38, 0x35, 0x37, 0x35, 0x00, 0x4d, 0xd5, 0x1d, 0xf9, 0x00, 0x4e, 0xb3, 0xe3, 0xdd, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x09, 0x80, 0x00, 0x44, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- };
- tcp_socket2.send(boost::asio::buffer(its_malicious_client_data));
-
- std::this_thread::sleep_for(std::chrono::milliseconds(1500));
- // call shutdown method
- std::uint8_t shutdown_call[] = {
- 0x33, 0x45, 0x14, 0x04,
- 0x00, 0x00, 0x00, 0x08,
- 0x22, 0x22, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x00 };
- boost::asio::ip::udp::socket::endpoint_type target_service(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30001);
- udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service);
- } catch (const std::exception& _e) {
- std::cout << "catched exception: " << _e.what();
- ASSERT_FALSE(true);
- }
-
- });
-
- send_thread.join();
- receive_thread.join();
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 3) {
- std::cerr << "Please pass an target and local IP address to this binary like: "
- << argv[0] << " 10.0.3.1 10.0.3.202" << std::endl;
- exit(1);
- }
- remote_address = argv[1];
- local_address = argv[2];
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/malicious_data_tests/malicious_data_test_service.cpp b/test/malicious_data_tests/malicious_data_test_service.cpp
deleted file mode 100644
index 17a4bb8..0000000
--- a/test/malicious_data_tests/malicious_data_test_service.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <atomic>
-#include <future>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "malicious_data_test_globals.hpp"
-
-class malicious_data_test_service {
-public:
- malicious_data_test_service(struct malicious_data_test::service_info _service_info, malicious_data_test::test_mode_e _testmode) :
- service_info_(_service_info),
- testmode_(_testmode),
- app_(vsomeip::runtime::get()->create_application("malicious_data_test_service")),
- wait_until_registered_(true),
- wait_until_shutdown_method_called_(true),
- received_events_(0),
- received_methodcalls_(0),
- offer_thread_(std::bind(&malicious_data_test_service::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&malicious_data_test_service::on_state, this,
- std::placeholders::_1));
-
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(_service_info.eventgroup_id);
- app_->request_event(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_eventgroups, false);
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, service_info_.shutdown_method_id,
- std::bind(&malicious_data_test_service::on_shutdown_method_called, this,
- std::placeholders::_1));
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.event_id,
- std::bind(&malicious_data_test_service::on_event, this,
- std::placeholders::_1));
-
- app_->register_message_handler(static_cast<vsomeip::service_t>(service_info_.service_id + 1u),
- service_info_.instance_id, 0x1,
- std::bind(&malicious_data_test_service::on_message, this,
- std::placeholders::_1));
-
- // request service of client
- app_->request_service(service_info_.service_id, service_info_.instance_id);
- app_->subscribe(service_info_.service_id, service_info_.instance_id,
- service_info_.eventgroup_id, 0, vsomeip::subscription_type_e::SU_RELIABLE,
- service_info_.event_id);
-
- app_->start();
- }
-
- ~malicious_data_test_service() {
- EXPECT_EQ(9u, received_events_);
- EXPECT_EQ(9u, received_methodcalls_);
- offer_thread_.join();
- }
-
- void offer() {
- app_->offer_service(static_cast<vsomeip::service_t>(service_info_.service_id + 1u), 0x1);
- }
-
- void stop() {
- app_->stop_offer_service(static_cast<vsomeip::service_t>(service_info_.service_id + 1u), 0x1);
- app_->clear_all_handler();
- app_->stop();
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
- app_->send(vsomeip::runtime::get()->create_response(_message));
- VSOMEIP_WARNING << "************************************************************";
- VSOMEIP_WARNING << "Shutdown method called -> going down!";
- VSOMEIP_WARNING << "************************************************************";
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_shutdown_method_called_ = false;
- condition_.notify_one();
- }
-
- void on_event(const std::shared_ptr<vsomeip::message> &_message) {
- EXPECT_EQ(service_info_.service_id, _message->get_service());
- EXPECT_EQ(service_info_.instance_id, _message->get_instance());
- EXPECT_EQ(service_info_.event_id, _message->get_method());
- EXPECT_EQ(std::uint32_t(0x7F), _message->get_length());
- received_events_++;
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- EXPECT_EQ(static_cast<vsomeip::service_t>(service_info_.service_id + 1u), _message->get_service());
- EXPECT_EQ(service_info_.instance_id, _message->get_instance());
- EXPECT_EQ(vsomeip::method_t(0x1), _message->get_method());
- EXPECT_EQ(std::uint32_t(0x7F), _message->get_length());
- received_methodcalls_++;
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
-
- while (wait_until_shutdown_method_called_) {
- condition_.wait(its_lock);
- }
- stop();
- }
-
-private:
- struct malicious_data_test::service_info service_info_;
- malicious_data_test::test_mode_e testmode_;
- std::shared_ptr<vsomeip::application> app_;
-
- bool wait_until_registered_;
- bool wait_until_shutdown_method_called_;
- std::uint32_t received_events_;
- std::uint32_t received_methodcalls_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::thread offer_thread_;
-};
-
-malicious_data_test::test_mode_e its_testmode(malicious_data_test::test_mode_e::SUBSCRIBE);
-
-TEST(someip_malicious_data_test, block_subscription_handler)
-{
- malicious_data_test_service its_sample(malicious_data_test::service, its_testmode);
-}
-
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/offer_tests/conf/offer_test_big_sd_msg_master.json.in b/test/offer_tests/conf/offer_test_big_sd_msg_master.json.in
deleted file mode 100644
index 17158c1..0000000
--- a/test/offer_tests/conf/offer_test_big_sd_msg_master.json.in
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications" :
- [
- {
- "name" : "offer_test_big_sd_msg_client",
- "id" : "0x6666"
- }
- ],
- "routing":"vsomeipd",
- "service-discovery":
- {
- "enable":"true",
- "ttl" : "3",
- "multicast":"224.0.11.1",
- "port":"30490",
- "protocol":"udp",
- "cyclic_offer_delay" : "1000"
- }
-} \ No newline at end of file
diff --git a/test/offer_tests/conf/offer_test_big_sd_msg_master_starter.sh.in b/test/offer_tests/conf/offer_test_big_sd_msg_master_starter.sh.in
deleted file mode 100755
index 2547673..0000000
--- a/test/offer_tests/conf/offer_test_big_sd_msg_master_starter.sh.in
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-FAIL=0
-
-export VSOMEIP_CONFIGURATION=offer_test_big_sd_msg_master.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-
-./offer_test_big_sd_msg_client &
-CLIENT_PID=$!
-
-
-sleep 1
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "Waiting for 5s"
- sleep 5
- echo "starting offer test on slave LXC offer_test_big_sd_msg_slave_starter.sh"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./offer_test_big_sd_msg_slave_starter.sh\"" &
- echo "remote ssh pid: $!"
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name otems --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./offer_test_big_sd_msg_slave_starter.sh" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** offer_test_big_sd_msg_slave_starter.sh
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** offer_test_big_sd_msg_master.json and
-** offer_test_big_sd_msg_slave.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# Wait until all clients and services are finished
-for job in $CLIENT_PID
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- echo "waiting for $job"
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_VSOMEIPD
-sleep 1
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop otems
- docker rm otems
-fi
-
-# wait for slave to finish
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- echo "[Master] waiting for job $job"
- wait $job || ((FAIL+=1))
-done
-
-# Check if everything went well
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/offer_tests/conf/offer_test_big_sd_msg_slave.json.in b/test/offer_tests/conf/offer_test_big_sd_msg_slave.json.in
deleted file mode 100644
index cd5056a..0000000
--- a/test/offer_tests/conf/offer_test_big_sd_msg_slave.json.in
+++ /dev/null
@@ -1,334 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications" :
- [
- {
- "name" : "offer_test_big_sd_msg_service",
- "id" : "0x7777"
- }
- ],
- "services":
- [
- {"service":"0x1","instance":"0x1","unreliable":"30001","reliable":{"port":"30001","enable-magic-cookies":"false"}},
- {"service":"0x2","instance":"0x1","unreliable":"30002","reliable":{"port":"30002","enable-magic-cookies":"false"}},
- {"service":"0x3","instance":"0x1","unreliable":"30003","reliable":{"port":"30003","enable-magic-cookies":"false"}},
- {"service":"0x4","instance":"0x1","unreliable":"30004","reliable":{"port":"30004","enable-magic-cookies":"false"}},
- {"service":"0x5","instance":"0x1","unreliable":"30005","reliable":{"port":"30005","enable-magic-cookies":"false"}},
- {"service":"0x6","instance":"0x1","unreliable":"30006","reliable":{"port":"30006","enable-magic-cookies":"false"}},
- {"service":"0x7","instance":"0x1","unreliable":"30007","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x8","instance":"0x1","unreliable":"30008","reliable":{"port":"30008","enable-magic-cookies":"false"}},
- {"service":"0x9","instance":"0x1","unreliable":"60000","reliable":{"port":"30009","enable-magic-cookies":"false"}},
- {"service":"0xA","instance":"0x1","unreliable":"30010","reliable":{"port":"30010","enable-magic-cookies":"false"}},
- {"service":"0xB","instance":"0x1","unreliable":"30011","reliable":{"port":"30011","enable-magic-cookies":"false"}},
- {"service":"0xC","instance":"0x1","unreliable":"30012","reliable":{"port":"30012","enable-magic-cookies":"false"}},
- {"service":"0xD","instance":"0x1","unreliable":"30013","reliable":{"port":"30013","enable-magic-cookies":"false"}},
- {"service":"0xE","instance":"0x1","unreliable":"30014","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xF","instance":"0x1","unreliable":"30015","reliable":{"port":"30015","enable-magic-cookies":"false"}},
- {"service":"0x10","instance":"0x1","unreliable":"30016","reliable":{"port":"30016","enable-magic-cookies":"false"}},
- {"service":"0x11","instance":"0x1","unreliable":"30017","reliable":{"port":"30017","enable-magic-cookies":"false"}},
- {"service":"0x12","instance":"0x1","unreliable":"60000","reliable":{"port":"30018","enable-magic-cookies":"false"}},
- {"service":"0x13","instance":"0x1","unreliable":"30019","reliable":{"port":"30019","enable-magic-cookies":"false"}},
- {"service":"0x14","instance":"0x1","unreliable":"30020","reliable":{"port":"30020","enable-magic-cookies":"false"}},
- {"service":"0x15","instance":"0x1","unreliable":"30021","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x16","instance":"0x1","unreliable":"30022","reliable":{"port":"30022","enable-magic-cookies":"false"}},
- {"service":"0x17","instance":"0x1","unreliable":"30023","reliable":{"port":"30023","enable-magic-cookies":"false"}},
- {"service":"0x18","instance":"0x1","unreliable":"30024","reliable":{"port":"30024","enable-magic-cookies":"false"}},
- {"service":"0x19","instance":"0x1","unreliable":"30025","reliable":{"port":"30025","enable-magic-cookies":"false"}},
- {"service":"0x1A","instance":"0x1","unreliable":"30026","reliable":{"port":"30026","enable-magic-cookies":"false"}},
- {"service":"0x1B","instance":"0x1","unreliable":"60000","reliable":{"port":"30027","enable-magic-cookies":"false"}},
- {"service":"0x1C","instance":"0x1","unreliable":"30028","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x1D","instance":"0x1","unreliable":"30029","reliable":{"port":"30029","enable-magic-cookies":"false"}},
- {"service":"0x1E","instance":"0x1","unreliable":"30030","reliable":{"port":"30030","enable-magic-cookies":"false"}},
- {"service":"0x1F","instance":"0x1","unreliable":"30031","reliable":{"port":"30031","enable-magic-cookies":"false"}},
- {"service":"0x20","instance":"0x1","unreliable":"30032","reliable":{"port":"30032","enable-magic-cookies":"false"}},
- {"service":"0x21","instance":"0x1","unreliable":"30033","reliable":{"port":"30033","enable-magic-cookies":"false"}},
- {"service":"0x22","instance":"0x1","unreliable":"30034","reliable":{"port":"30034","enable-magic-cookies":"false"}},
- {"service":"0x23","instance":"0x1","unreliable":"30035","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x24","instance":"0x1","unreliable":"60000","reliable":{"port":"30036","enable-magic-cookies":"false"}},
- {"service":"0x25","instance":"0x1","unreliable":"30037","reliable":{"port":"30037","enable-magic-cookies":"false"}},
- {"service":"0x26","instance":"0x1","unreliable":"30038","reliable":{"port":"30038","enable-magic-cookies":"false"}},
- {"service":"0x27","instance":"0x1","unreliable":"30039","reliable":{"port":"30039","enable-magic-cookies":"false"}},
- {"service":"0x28","instance":"0x1","unreliable":"30040","reliable":{"port":"30040","enable-magic-cookies":"false"}},
- {"service":"0x29","instance":"0x1","unreliable":"30041","reliable":{"port":"30041","enable-magic-cookies":"false"}},
- {"service":"0x2A","instance":"0x1","unreliable":"30042","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x2B","instance":"0x1","unreliable":"30043","reliable":{"port":"30043","enable-magic-cookies":"false"}},
- {"service":"0x2C","instance":"0x1","unreliable":"30044","reliable":{"port":"30044","enable-magic-cookies":"false"}},
- {"service":"0x2D","instance":"0x1","unreliable":"60000","reliable":{"port":"30045","enable-magic-cookies":"false"}},
- {"service":"0x2E","instance":"0x1","unreliable":"30046","reliable":{"port":"30046","enable-magic-cookies":"false"}},
- {"service":"0x2F","instance":"0x1","unreliable":"30047","reliable":{"port":"30047","enable-magic-cookies":"false"}},
- {"service":"0x30","instance":"0x1","unreliable":"30048","reliable":{"port":"30048","enable-magic-cookies":"false"}},
- {"service":"0x31","instance":"0x1","unreliable":"30049","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x32","instance":"0x1","unreliable":"30050","reliable":{"port":"30050","enable-magic-cookies":"false"}},
- {"service":"0x33","instance":"0x1","unreliable":"30051","reliable":{"port":"30051","enable-magic-cookies":"false"}},
- {"service":"0x34","instance":"0x1","unreliable":"30052","reliable":{"port":"30052","enable-magic-cookies":"false"}},
- {"service":"0x35","instance":"0x1","unreliable":"30053","reliable":{"port":"30053","enable-magic-cookies":"false"}},
- {"service":"0x36","instance":"0x1","unreliable":"60000","reliable":{"port":"30054","enable-magic-cookies":"false"}},
- {"service":"0x37","instance":"0x1","unreliable":"30055","reliable":{"port":"30055","enable-magic-cookies":"false"}},
- {"service":"0x38","instance":"0x1","unreliable":"30056","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x39","instance":"0x1","unreliable":"30057","reliable":{"port":"30057","enable-magic-cookies":"false"}},
- {"service":"0x3A","instance":"0x1","unreliable":"30058","reliable":{"port":"30058","enable-magic-cookies":"false"}},
- {"service":"0x3B","instance":"0x1","unreliable":"30059","reliable":{"port":"30059","enable-magic-cookies":"false"}},
- {"service":"0x3C","instance":"0x1","unreliable":"30060","reliable":{"port":"30060","enable-magic-cookies":"false"}},
- {"service":"0x3D","instance":"0x1","unreliable":"30061","reliable":{"port":"30061","enable-magic-cookies":"false"}},
- {"service":"0x3E","instance":"0x1","unreliable":"30062","reliable":{"port":"30062","enable-magic-cookies":"false"}},
- {"service":"0x3F","instance":"0x1","unreliable":"60000","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x40","instance":"0x1","unreliable":"30064","reliable":{"port":"30064","enable-magic-cookies":"false"}},
- {"service":"0x41","instance":"0x1","unreliable":"30065","reliable":{"port":"30065","enable-magic-cookies":"false"}},
- {"service":"0x42","instance":"0x1","unreliable":"30066","reliable":{"port":"30066","enable-magic-cookies":"false"}},
- {"service":"0x43","instance":"0x1","unreliable":"30067","reliable":{"port":"30067","enable-magic-cookies":"false"}},
- {"service":"0x44","instance":"0x1","unreliable":"30068","reliable":{"port":"30068","enable-magic-cookies":"false"}},
- {"service":"0x45","instance":"0x1","unreliable":"30069","reliable":{"port":"30069","enable-magic-cookies":"false"}},
- {"service":"0x46","instance":"0x1","unreliable":"30070","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x47","instance":"0x1","unreliable":"30071","reliable":{"port":"30071","enable-magic-cookies":"false"}},
- {"service":"0x48","instance":"0x1","unreliable":"60000","reliable":{"port":"30072","enable-magic-cookies":"false"}},
- {"service":"0x49","instance":"0x1","unreliable":"30073","reliable":{"port":"30073","enable-magic-cookies":"false"}},
- {"service":"0x4A","instance":"0x1","unreliable":"30074","reliable":{"port":"30074","enable-magic-cookies":"false"}},
- {"service":"0x4B","instance":"0x1","unreliable":"30075","reliable":{"port":"30075","enable-magic-cookies":"false"}},
- {"service":"0x4C","instance":"0x1","unreliable":"30076","reliable":{"port":"30076","enable-magic-cookies":"false"}},
- {"service":"0x4D","instance":"0x1","unreliable":"30077","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x4E","instance":"0x1","unreliable":"30078","reliable":{"port":"30078","enable-magic-cookies":"false"}},
- {"service":"0x4F","instance":"0x1","unreliable":"30079","reliable":{"port":"30079","enable-magic-cookies":"false"}},
- {"service":"0x50","instance":"0x1","unreliable":"30080","reliable":{"port":"30080","enable-magic-cookies":"false"}},
- {"service":"0x51","instance":"0x1","unreliable":"60000","reliable":{"port":"30081","enable-magic-cookies":"false"}},
- {"service":"0x52","instance":"0x1","unreliable":"30082","reliable":{"port":"30082","enable-magic-cookies":"false"}},
- {"service":"0x53","instance":"0x1","unreliable":"30083","reliable":{"port":"30083","enable-magic-cookies":"false"}},
- {"service":"0x54","instance":"0x1","unreliable":"30084","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x55","instance":"0x1","unreliable":"30085","reliable":{"port":"30085","enable-magic-cookies":"false"}},
- {"service":"0x56","instance":"0x1","unreliable":"30086","reliable":{"port":"30086","enable-magic-cookies":"false"}},
- {"service":"0x57","instance":"0x1","unreliable":"30087","reliable":{"port":"30087","enable-magic-cookies":"false"}},
- {"service":"0x58","instance":"0x1","unreliable":"30088","reliable":{"port":"30088","enable-magic-cookies":"false"}},
- {"service":"0x59","instance":"0x1","unreliable":"30089","reliable":{"port":"30089","enable-magic-cookies":"false"}},
- {"service":"0x5A","instance":"0x1","unreliable":"60000","reliable":{"port":"30090","enable-magic-cookies":"false"}},
- {"service":"0x5B","instance":"0x1","unreliable":"30091","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x5C","instance":"0x1","unreliable":"30092","reliable":{"port":"30092","enable-magic-cookies":"false"}},
- {"service":"0x5D","instance":"0x1","unreliable":"30093","reliable":{"port":"30093","enable-magic-cookies":"false"}},
- {"service":"0x5E","instance":"0x1","unreliable":"30094","reliable":{"port":"30094","enable-magic-cookies":"false"}},
- {"service":"0x5F","instance":"0x1","unreliable":"30095","reliable":{"port":"30095","enable-magic-cookies":"false"}},
- {"service":"0x60","instance":"0x1","unreliable":"30096","reliable":{"port":"30096","enable-magic-cookies":"false"}},
- {"service":"0x61","instance":"0x1","unreliable":"30097","reliable":{"port":"30097","enable-magic-cookies":"false"}},
- {"service":"0x62","instance":"0x1","unreliable":"30098","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x63","instance":"0x1","unreliable":"60000","reliable":{"port":"30099","enable-magic-cookies":"false"}},
- {"service":"0x64","instance":"0x1","unreliable":"30100","reliable":{"port":"30100","enable-magic-cookies":"false"}},
- {"service":"0x65","instance":"0x1","unreliable":"30101","reliable":{"port":"30101","enable-magic-cookies":"false"}},
- {"service":"0x66","instance":"0x1","unreliable":"30102","reliable":{"port":"30102","enable-magic-cookies":"false"}},
- {"service":"0x67","instance":"0x1","unreliable":"30103","reliable":{"port":"30103","enable-magic-cookies":"false"}},
- {"service":"0x68","instance":"0x1","unreliable":"30104","reliable":{"port":"30104","enable-magic-cookies":"false"}},
- {"service":"0x69","instance":"0x1","unreliable":"30105","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x6A","instance":"0x1","unreliable":"30106","reliable":{"port":"30106","enable-magic-cookies":"false"}},
- {"service":"0x6B","instance":"0x1","unreliable":"30107","reliable":{"port":"30107","enable-magic-cookies":"false"}},
- {"service":"0x6C","instance":"0x1","unreliable":"60000","reliable":{"port":"30108","enable-magic-cookies":"false"}},
- {"service":"0x6D","instance":"0x1","unreliable":"30109","reliable":{"port":"30109","enable-magic-cookies":"false"}},
- {"service":"0x6E","instance":"0x1","unreliable":"30110","reliable":{"port":"30110","enable-magic-cookies":"false"}},
- {"service":"0x6F","instance":"0x1","unreliable":"30111","reliable":{"port":"30111","enable-magic-cookies":"false"}},
- {"service":"0x70","instance":"0x1","unreliable":"30112","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x71","instance":"0x1","unreliable":"30113","reliable":{"port":"30113","enable-magic-cookies":"false"}},
- {"service":"0x72","instance":"0x1","unreliable":"30114","reliable":{"port":"30114","enable-magic-cookies":"false"}},
- {"service":"0x73","instance":"0x1","unreliable":"30115","reliable":{"port":"30115","enable-magic-cookies":"false"}},
- {"service":"0x74","instance":"0x1","unreliable":"30116","reliable":{"port":"30116","enable-magic-cookies":"false"}},
- {"service":"0x75","instance":"0x1","unreliable":"60000","reliable":{"port":"30117","enable-magic-cookies":"false"}},
- {"service":"0x76","instance":"0x1","unreliable":"30118","reliable":{"port":"30118","enable-magic-cookies":"false"}},
- {"service":"0x77","instance":"0x1","unreliable":"30119","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x78","instance":"0x1","unreliable":"30120","reliable":{"port":"30120","enable-magic-cookies":"false"}},
- {"service":"0x79","instance":"0x1","unreliable":"30121","reliable":{"port":"30121","enable-magic-cookies":"false"}},
- {"service":"0x7A","instance":"0x1","unreliable":"30122","reliable":{"port":"30122","enable-magic-cookies":"false"}},
- {"service":"0x7B","instance":"0x1","unreliable":"30123","reliable":{"port":"30123","enable-magic-cookies":"false"}},
- {"service":"0x7C","instance":"0x1","unreliable":"30124","reliable":{"port":"30124","enable-magic-cookies":"false"}},
- {"service":"0x7D","instance":"0x1","unreliable":"30125","reliable":{"port":"30125","enable-magic-cookies":"false"}},
- {"service":"0x7E","instance":"0x1","unreliable":"60000","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x7F","instance":"0x1","unreliable":"30127","reliable":{"port":"30127","enable-magic-cookies":"false"}},
- {"service":"0x80","instance":"0x1","unreliable":"30128","reliable":{"port":"30128","enable-magic-cookies":"false"}},
- {"service":"0x81","instance":"0x1","unreliable":"30129","reliable":{"port":"30129","enable-magic-cookies":"false"}},
- {"service":"0x82","instance":"0x1","unreliable":"30130","reliable":{"port":"30130","enable-magic-cookies":"false"}},
- {"service":"0x83","instance":"0x1","unreliable":"30131","reliable":{"port":"30131","enable-magic-cookies":"false"}},
- {"service":"0x84","instance":"0x1","unreliable":"30132","reliable":{"port":"30132","enable-magic-cookies":"false"}},
- {"service":"0x85","instance":"0x1","unreliable":"30133","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x86","instance":"0x1","unreliable":"30134","reliable":{"port":"30134","enable-magic-cookies":"false"}},
- {"service":"0x87","instance":"0x1","unreliable":"60000","reliable":{"port":"30135","enable-magic-cookies":"false"}},
- {"service":"0x88","instance":"0x1","unreliable":"30136","reliable":{"port":"30136","enable-magic-cookies":"false"}},
- {"service":"0x89","instance":"0x1","unreliable":"30137","reliable":{"port":"30137","enable-magic-cookies":"false"}},
- {"service":"0x8A","instance":"0x1","unreliable":"30138","reliable":{"port":"30138","enable-magic-cookies":"false"}},
- {"service":"0x8B","instance":"0x1","unreliable":"30139","reliable":{"port":"30139","enable-magic-cookies":"false"}},
- {"service":"0x8C","instance":"0x1","unreliable":"30140","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x8D","instance":"0x1","unreliable":"30141","reliable":{"port":"30141","enable-magic-cookies":"false"}},
- {"service":"0x8E","instance":"0x1","unreliable":"30142","reliable":{"port":"30142","enable-magic-cookies":"false"}},
- {"service":"0x8F","instance":"0x1","unreliable":"30143","reliable":{"port":"30143","enable-magic-cookies":"false"}},
- {"service":"0x90","instance":"0x1","unreliable":"60000","reliable":{"port":"30144","enable-magic-cookies":"false"}},
- {"service":"0x91","instance":"0x1","unreliable":"30145","reliable":{"port":"30145","enable-magic-cookies":"false"}},
- {"service":"0x92","instance":"0x1","unreliable":"30146","reliable":{"port":"30146","enable-magic-cookies":"false"}},
- {"service":"0x93","instance":"0x1","unreliable":"30147","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x94","instance":"0x1","unreliable":"30148","reliable":{"port":"30148","enable-magic-cookies":"false"}},
- {"service":"0x95","instance":"0x1","unreliable":"30149","reliable":{"port":"30149","enable-magic-cookies":"false"}},
- {"service":"0x96","instance":"0x1","unreliable":"30150","reliable":{"port":"30150","enable-magic-cookies":"false"}},
- {"service":"0x97","instance":"0x1","unreliable":"30151","reliable":{"port":"30151","enable-magic-cookies":"false"}},
- {"service":"0x98","instance":"0x1","unreliable":"30152","reliable":{"port":"30152","enable-magic-cookies":"false"}},
- {"service":"0x99","instance":"0x1","unreliable":"60000","reliable":{"port":"30153","enable-magic-cookies":"false"}},
- {"service":"0x9A","instance":"0x1","unreliable":"30154","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x9B","instance":"0x1","unreliable":"30155","reliable":{"port":"30155","enable-magic-cookies":"false"}},
- {"service":"0x9C","instance":"0x1","unreliable":"30156","reliable":{"port":"30156","enable-magic-cookies":"false"}},
- {"service":"0x9D","instance":"0x1","unreliable":"30157","reliable":{"port":"30157","enable-magic-cookies":"false"}},
- {"service":"0x9E","instance":"0x1","unreliable":"30158","reliable":{"port":"30158","enable-magic-cookies":"false"}},
- {"service":"0x9F","instance":"0x1","unreliable":"30159","reliable":{"port":"30159","enable-magic-cookies":"false"}},
- {"service":"0xA0","instance":"0x1","unreliable":"30160","reliable":{"port":"30160","enable-magic-cookies":"false"}},
- {"service":"0xA1","instance":"0x1","unreliable":"30161","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xA2","instance":"0x1","unreliable":"60000","reliable":{"port":"30162","enable-magic-cookies":"false"}},
- {"service":"0xA3","instance":"0x1","unreliable":"30163","reliable":{"port":"30163","enable-magic-cookies":"false"}},
- {"service":"0xA4","instance":"0x1","unreliable":"30164","reliable":{"port":"30164","enable-magic-cookies":"false"}},
- {"service":"0xA5","instance":"0x1","unreliable":"30165","reliable":{"port":"30165","enable-magic-cookies":"false"}},
- {"service":"0xA6","instance":"0x1","unreliable":"30166","reliable":{"port":"30166","enable-magic-cookies":"false"}},
- {"service":"0xA7","instance":"0x1","unreliable":"30167","reliable":{"port":"30167","enable-magic-cookies":"false"}},
- {"service":"0xA8","instance":"0x1","unreliable":"30168","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xA9","instance":"0x1","unreliable":"30169","reliable":{"port":"30169","enable-magic-cookies":"false"}},
- {"service":"0xAA","instance":"0x1","unreliable":"30170","reliable":{"port":"30170","enable-magic-cookies":"false"}},
- {"service":"0xAB","instance":"0x1","unreliable":"60000","reliable":{"port":"30171","enable-magic-cookies":"false"}},
- {"service":"0xAC","instance":"0x1","unreliable":"30172","reliable":{"port":"30172","enable-magic-cookies":"false"}},
- {"service":"0xAD","instance":"0x1","unreliable":"30173","reliable":{"port":"30173","enable-magic-cookies":"false"}},
- {"service":"0xAE","instance":"0x1","unreliable":"30174","reliable":{"port":"30174","enable-magic-cookies":"false"}},
- {"service":"0xAF","instance":"0x1","unreliable":"30175","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xB0","instance":"0x1","unreliable":"30176","reliable":{"port":"30176","enable-magic-cookies":"false"}},
- {"service":"0xB1","instance":"0x1","unreliable":"30177","reliable":{"port":"30177","enable-magic-cookies":"false"}},
- {"service":"0xB2","instance":"0x1","unreliable":"30178","reliable":{"port":"30178","enable-magic-cookies":"false"}},
- {"service":"0xB3","instance":"0x1","unreliable":"30179","reliable":{"port":"30179","enable-magic-cookies":"false"}},
- {"service":"0xB4","instance":"0x1","unreliable":"60000","reliable":{"port":"30180","enable-magic-cookies":"false"}},
- {"service":"0xB5","instance":"0x1","unreliable":"30181","reliable":{"port":"30181","enable-magic-cookies":"false"}},
- {"service":"0xB6","instance":"0x1","unreliable":"30182","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xB7","instance":"0x1","unreliable":"30183","reliable":{"port":"30183","enable-magic-cookies":"false"}},
- {"service":"0xB8","instance":"0x1","unreliable":"30184","reliable":{"port":"30184","enable-magic-cookies":"false"}},
- {"service":"0xB9","instance":"0x1","unreliable":"30185","reliable":{"port":"30185","enable-magic-cookies":"false"}},
- {"service":"0xBA","instance":"0x1","unreliable":"30186","reliable":{"port":"30186","enable-magic-cookies":"false"}},
- {"service":"0xBB","instance":"0x1","unreliable":"30187","reliable":{"port":"30187","enable-magic-cookies":"false"}},
- {"service":"0xBC","instance":"0x1","unreliable":"30188","reliable":{"port":"30188","enable-magic-cookies":"false"}},
- {"service":"0xBD","instance":"0x1","unreliable":"60000","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xBE","instance":"0x1","unreliable":"30190","reliable":{"port":"30190","enable-magic-cookies":"false"}},
- {"service":"0xBF","instance":"0x1","unreliable":"30191","reliable":{"port":"30191","enable-magic-cookies":"false"}},
- {"service":"0xC0","instance":"0x1","unreliable":"30192","reliable":{"port":"30192","enable-magic-cookies":"false"}},
- {"service":"0xC1","instance":"0x1","unreliable":"30193","reliable":{"port":"30193","enable-magic-cookies":"false"}},
- {"service":"0xC2","instance":"0x1","unreliable":"30194","reliable":{"port":"30194","enable-magic-cookies":"false"}},
- {"service":"0xC3","instance":"0x1","unreliable":"30195","reliable":{"port":"30195","enable-magic-cookies":"false"}},
- {"service":"0xC4","instance":"0x1","unreliable":"30196","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xC5","instance":"0x1","unreliable":"30197","reliable":{"port":"30197","enable-magic-cookies":"false"}},
- {"service":"0xC6","instance":"0x1","unreliable":"60000","reliable":{"port":"30198","enable-magic-cookies":"false"}},
- {"service":"0xC7","instance":"0x1","unreliable":"30199","reliable":{"port":"30199","enable-magic-cookies":"false"}},
- {"service":"0xC8","instance":"0x1","unreliable":"30200","reliable":{"port":"30200","enable-magic-cookies":"false"}},
- {"service":"0xC9","instance":"0x1","unreliable":"30201","reliable":{"port":"30201","enable-magic-cookies":"false"}},
- {"service":"0xCA","instance":"0x1","unreliable":"30202","reliable":{"port":"30202","enable-magic-cookies":"false"}},
- {"service":"0xCB","instance":"0x1","unreliable":"30203","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xCC","instance":"0x1","unreliable":"30204","reliable":{"port":"30204","enable-magic-cookies":"false"}},
- {"service":"0xCD","instance":"0x1","unreliable":"30205","reliable":{"port":"30205","enable-magic-cookies":"false"}},
- {"service":"0xCE","instance":"0x1","unreliable":"30206","reliable":{"port":"30206","enable-magic-cookies":"false"}},
- {"service":"0xCF","instance":"0x1","unreliable":"60000","reliable":{"port":"30207","enable-magic-cookies":"false"}},
- {"service":"0xD0","instance":"0x1","unreliable":"30208","reliable":{"port":"30208","enable-magic-cookies":"false"}},
- {"service":"0xD1","instance":"0x1","unreliable":"30209","reliable":{"port":"30209","enable-magic-cookies":"false"}},
- {"service":"0xD2","instance":"0x1","unreliable":"30210","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xD3","instance":"0x1","unreliable":"30211","reliable":{"port":"30211","enable-magic-cookies":"false"}},
- {"service":"0xD4","instance":"0x1","unreliable":"30212","reliable":{"port":"30212","enable-magic-cookies":"false"}},
- {"service":"0xD5","instance":"0x1","unreliable":"30213","reliable":{"port":"30213","enable-magic-cookies":"false"}},
- {"service":"0xD6","instance":"0x1","unreliable":"30214","reliable":{"port":"30214","enable-magic-cookies":"false"}},
- {"service":"0xD7","instance":"0x1","unreliable":"30215","reliable":{"port":"30215","enable-magic-cookies":"false"}},
- {"service":"0xD8","instance":"0x1","unreliable":"60000","reliable":{"port":"30216","enable-magic-cookies":"false"}},
- {"service":"0xD9","instance":"0x1","unreliable":"30217","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xDA","instance":"0x1","unreliable":"30218","reliable":{"port":"30218","enable-magic-cookies":"false"}},
- {"service":"0xDB","instance":"0x1","unreliable":"30219","reliable":{"port":"30219","enable-magic-cookies":"false"}},
- {"service":"0xDC","instance":"0x1","unreliable":"30220","reliable":{"port":"30220","enable-magic-cookies":"false"}},
- {"service":"0xDD","instance":"0x1","unreliable":"30221","reliable":{"port":"30221","enable-magic-cookies":"false"}},
- {"service":"0xDE","instance":"0x1","unreliable":"30222","reliable":{"port":"30222","enable-magic-cookies":"false"}},
- {"service":"0xDF","instance":"0x1","unreliable":"30223","reliable":{"port":"30223","enable-magic-cookies":"false"}},
- {"service":"0xE0","instance":"0x1","unreliable":"30224","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xE1","instance":"0x1","unreliable":"60000","reliable":{"port":"30225","enable-magic-cookies":"false"}},
- {"service":"0xE2","instance":"0x1","unreliable":"30226","reliable":{"port":"30226","enable-magic-cookies":"false"}},
- {"service":"0xE3","instance":"0x1","unreliable":"30227","reliable":{"port":"30227","enable-magic-cookies":"false"}},
- {"service":"0xE4","instance":"0x1","unreliable":"30228","reliable":{"port":"30228","enable-magic-cookies":"false"}},
- {"service":"0xE5","instance":"0x1","unreliable":"30229","reliable":{"port":"30229","enable-magic-cookies":"false"}},
- {"service":"0xE6","instance":"0x1","unreliable":"30230","reliable":{"port":"30230","enable-magic-cookies":"false"}},
- {"service":"0xE7","instance":"0x1","unreliable":"30231","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xE8","instance":"0x1","unreliable":"30232","reliable":{"port":"30232","enable-magic-cookies":"false"}},
- {"service":"0xE9","instance":"0x1","unreliable":"30233","reliable":{"port":"30233","enable-magic-cookies":"false"}},
- {"service":"0xEA","instance":"0x1","unreliable":"60000","reliable":{"port":"30234","enable-magic-cookies":"false"}},
- {"service":"0xEB","instance":"0x1","unreliable":"30235","reliable":{"port":"30235","enable-magic-cookies":"false"}},
- {"service":"0xEC","instance":"0x1","unreliable":"30236","reliable":{"port":"30236","enable-magic-cookies":"false"}},
- {"service":"0xED","instance":"0x1","unreliable":"30237","reliable":{"port":"30237","enable-magic-cookies":"false"}},
- {"service":"0xEE","instance":"0x1","unreliable":"30238","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xEF","instance":"0x1","unreliable":"30239","reliable":{"port":"30239","enable-magic-cookies":"false"}},
- {"service":"0xF0","instance":"0x1","unreliable":"30240","reliable":{"port":"30240","enable-magic-cookies":"false"}},
- {"service":"0xF1","instance":"0x1","unreliable":"30241","reliable":{"port":"30241","enable-magic-cookies":"false"}},
- {"service":"0xF2","instance":"0x1","unreliable":"30242","reliable":{"port":"30242","enable-magic-cookies":"false"}},
- {"service":"0xF3","instance":"0x1","unreliable":"60000","reliable":{"port":"30243","enable-magic-cookies":"false"}},
- {"service":"0xF4","instance":"0x1","unreliable":"30244","reliable":{"port":"30244","enable-magic-cookies":"false"}},
- {"service":"0xF5","instance":"0x1","unreliable":"30245","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xF6","instance":"0x1","unreliable":"30246","reliable":{"port":"30246","enable-magic-cookies":"false"}},
- {"service":"0xF7","instance":"0x1","unreliable":"30247","reliable":{"port":"30247","enable-magic-cookies":"false"}},
- {"service":"0xF8","instance":"0x1","unreliable":"30248","reliable":{"port":"30248","enable-magic-cookies":"false"}},
- {"service":"0xF9","instance":"0x1","unreliable":"30249","reliable":{"port":"30249","enable-magic-cookies":"false"}},
- {"service":"0xFA","instance":"0x1","unreliable":"30250","reliable":{"port":"30250","enable-magic-cookies":"false"}},
- {"service":"0xFB","instance":"0x1","unreliable":"30251","reliable":{"port":"30251","enable-magic-cookies":"false"}},
- {"service":"0xFC","instance":"0x1","unreliable":"60000","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0xFD","instance":"0x1","unreliable":"30253","reliable":{"port":"30253","enable-magic-cookies":"false"}},
- {"service":"0xFE","instance":"0x1","unreliable":"30254","reliable":{"port":"30254","enable-magic-cookies":"false"}},
- {"service":"0xFF","instance":"0x1","unreliable":"30255","reliable":{"port":"30255","enable-magic-cookies":"false"}},
- {"service":"0x100","instance":"0x1","unreliable":"30256","reliable":{"port":"30256","enable-magic-cookies":"false"}},
- {"service":"0x101","instance":"0x1","unreliable":"30257","reliable":{"port":"30257","enable-magic-cookies":"false"}},
- {"service":"0x102","instance":"0x1","unreliable":"30258","reliable":{"port":"30258","enable-magic-cookies":"false"}},
- {"service":"0x103","instance":"0x1","unreliable":"30259","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x104","instance":"0x1","unreliable":"30260","reliable":{"port":"30260","enable-magic-cookies":"false"}},
- {"service":"0x105","instance":"0x1","unreliable":"60000","reliable":{"port":"30261","enable-magic-cookies":"false"}},
- {"service":"0x106","instance":"0x1","unreliable":"30262","reliable":{"port":"30262","enable-magic-cookies":"false"}},
- {"service":"0x107","instance":"0x1","unreliable":"30263","reliable":{"port":"30263","enable-magic-cookies":"false"}},
- {"service":"0x108","instance":"0x1","unreliable":"30264","reliable":{"port":"30264","enable-magic-cookies":"false"}},
- {"service":"0x109","instance":"0x1","unreliable":"30265","reliable":{"port":"30265","enable-magic-cookies":"false"}},
- {"service":"0x10A","instance":"0x1","unreliable":"30266","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x10B","instance":"0x1","unreliable":"30267","reliable":{"port":"30267","enable-magic-cookies":"false"}},
- {"service":"0x10C","instance":"0x1","unreliable":"30268","reliable":{"port":"30268","enable-magic-cookies":"false"}},
- {"service":"0x10D","instance":"0x1","unreliable":"30269","reliable":{"port":"30269","enable-magic-cookies":"false"}},
- {"service":"0x10E","instance":"0x1","unreliable":"60000","reliable":{"port":"30270","enable-magic-cookies":"false"}},
- {"service":"0x10F","instance":"0x1","unreliable":"30271","reliable":{"port":"30271","enable-magic-cookies":"false"}},
- {"service":"0x110","instance":"0x1","unreliable":"30272","reliable":{"port":"30272","enable-magic-cookies":"false"}},
- {"service":"0x111","instance":"0x1","unreliable":"30273","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x112","instance":"0x1","unreliable":"30274","reliable":{"port":"30274","enable-magic-cookies":"false"}},
- {"service":"0x113","instance":"0x1","unreliable":"30275","reliable":{"port":"30275","enable-magic-cookies":"false"}},
- {"service":"0x114","instance":"0x1","unreliable":"30276","reliable":{"port":"30276","enable-magic-cookies":"false"}},
- {"service":"0x115","instance":"0x1","unreliable":"30277","reliable":{"port":"30277","enable-magic-cookies":"false"}},
- {"service":"0x116","instance":"0x1","unreliable":"30278","reliable":{"port":"30278","enable-magic-cookies":"false"}},
- {"service":"0x117","instance":"0x1","unreliable":"60000","reliable":{"port":"30279","enable-magic-cookies":"false"}},
- {"service":"0x118","instance":"0x1","unreliable":"30280","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x119","instance":"0x1","unreliable":"30281","reliable":{"port":"30281","enable-magic-cookies":"false"}},
- {"service":"0x11A","instance":"0x1","unreliable":"30282","reliable":{"port":"30282","enable-magic-cookies":"false"}},
- {"service":"0x11B","instance":"0x1","unreliable":"30283","reliable":{"port":"30283","enable-magic-cookies":"false"}},
- {"service":"0x11C","instance":"0x1","unreliable":"30284","reliable":{"port":"30284","enable-magic-cookies":"false"}},
- {"service":"0x11D","instance":"0x1","unreliable":"30285","reliable":{"port":"30285","enable-magic-cookies":"false"}},
- {"service":"0x11E","instance":"0x1","unreliable":"30286","reliable":{"port":"30286","enable-magic-cookies":"false"}},
- {"service":"0x11F","instance":"0x1","unreliable":"30287","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x120","instance":"0x1","unreliable":"60000","reliable":{"port":"30288","enable-magic-cookies":"false"}},
- {"service":"0x121","instance":"0x1","unreliable":"30289","reliable":{"port":"30289","enable-magic-cookies":"false"}},
- {"service":"0x122","instance":"0x1","unreliable":"30290","reliable":{"port":"30290","enable-magic-cookies":"false"}},
- {"service":"0x123","instance":"0x1","unreliable":"30291","reliable":{"port":"30291","enable-magic-cookies":"false"}},
- {"service":"0x124","instance":"0x1","unreliable":"30292","reliable":{"port":"30292","enable-magic-cookies":"false"}},
- {"service":"0x125","instance":"0x1","unreliable":"30293","reliable":{"port":"30293","enable-magic-cookies":"false"}},
- {"service":"0x126","instance":"0x1","unreliable":"30294","reliable":{"port":"60000","enable-magic-cookies":"false"}},
- {"service":"0x127","instance":"0x1","unreliable":"30295","reliable":{"port":"30295","enable-magic-cookies":"false"}},
- {"service":"0x128","instance":"0x1","unreliable":"30296","reliable":{"port":"30296","enable-magic-cookies":"false"}},
- {"service":"0x129","instance":"0x1","unreliable":"60000","reliable":{"port":"30297","enable-magic-cookies":"false"}},
- {"service":"0x12A","instance":"0x1","unreliable":"30298","reliable":{"port":"30298","enable-magic-cookies":"false"}},
- {"service":"0x12B","instance":"0x1","unreliable":"30299","reliable":{"port":"30299","enable-magic-cookies":"false"}},
- {"service":"0x12C","instance":"0x1","unreliable":"30300","reliable":{"port":"30300","enable-magic-cookies":"false"}}
- ],
- "routing":"vsomeipd",
- "service-discovery":
- {
- "enable":"true",
- "ttl" : "3",
- "multicast":"224.0.11.1",
- "cyclic_offer_delay" : "1000",
- "port":"30490",
- "protocol":"udp"
- }
-} \ No newline at end of file
diff --git a/test/offer_tests/conf/offer_test_external_master.json.in b/test/offer_tests/conf/offer_test_external_master.json.in
deleted file mode 100644
index b16a258..0000000
--- a/test/offer_tests/conf/offer_test_external_master.json.in
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"vsomeipd",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "cyclic_offer_delay" : "500"
- }
-} \ No newline at end of file
diff --git a/test/offer_tests/conf/offer_test_external_master_starter.sh.in b/test/offer_tests/conf/offer_test_external_master_starter.sh.in
deleted file mode 100755
index 0f8f104..0000000
--- a/test/offer_tests/conf/offer_test_external_master_starter.sh.in
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-FAIL=0
-# Rejecting offer for which there is already a remote offer:
-# * start daemon
-# * start application which offers service
-# * start daemon remotely
-# * start same application which offers the same service again remotely
-# -> should be rejected as there is already a service instance
-# running in the network
-
-# Array for client pids
-CLIENT_PIDS=()
-export VSOMEIP_CONFIGURATION=offer_test_external_master.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-# Start the services
-./offer_test_service 2 &
-PID_SERVICE_TWO=$!
-echo "SERVICE_TWO pid $PID_SERVICE_TWO"
-
-./offer_test_client SUBSCRIBE &
-CLIENT_PIDS+=($!)
-echo "client pid ${CLIENT_PIDS[0]}"
-
-sleep 1
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "Waiting for 5s"
- sleep 5
- echo "starting offer test on slave LXC offer_test_external_slave_starter.sh"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./offer_test_external_slave_starter.sh\"" &
- echo "remote ssh pid: $!"
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name otems --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./offer_test_external_slave_starter.sh" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** offer_test_external_slave_starter.sh
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** offer_test_external_master.json and
-** offer_test_external_slave.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# Wait until all clients and services are finished
-for job in ${CLIENT_PIDS[*]} $PID_SERVICE_TWO
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- echo "waiting for $job"
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_VSOMEIPD
-sleep 1
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop otems
- docker rm otems
-fi
-
-# wait for slave to finish
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- echo "[Master] waiting for job $job"
- wait $job || ((FAIL+=1))
-done
-
-# Rejecting remote offer for which there is already a local offer
-# * start application which offers service
-# * send sd message trying to offer the same service instance as already
-# offered locally from a remote host
-
-# Array for client pids
-CLIENT_PIDS=()
-export VSOMEIP_CONFIGURATION=offer_test_external_master.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-# Start the services
-./offer_test_service 2 &
-PID_SERVICE_TWO=$!
-
-./offer_test_client SUBSCRIBE &
-CLIENT_PIDS+=($!)
-echo "client pid ${CLIENT_PIDS[0]}"
-
-sleep 1
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "Waiting for 5s"
- sleep 5
- echo "starting offer test on slave LXC offer_test_external_sd_msg_sender"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./offer_test_external_sd_msg_sender $LXC_TEST_MASTER_IP\"" &
- echo "remote ssh job id: $!"
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name otesms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./offer_test_external_sd_msg_sender $DOCKER_IP" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** offer_test_external_sd_msg_sender @TEST_IP_MASTER@
-** (pass the correct ip address of your test master)
-** from an external host to successfully complete this test.
-**
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# Wait until all clients and services are finished
-for job in ${CLIENT_PIDS[*]} $PID_SERVICE_TWO
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- echo "waiting for $job"
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_VSOMEIPD
-sleep 1
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop otesms
- docker rm otesms
-fi
-
-# wait for slave to finish
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- echo "[Master] waiting for job $job"
- wait $job || ((FAIL+=1))
-done
-
-# Check if everything went well
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/offer_tests/conf/offer_test_external_slave.json.in b/test/offer_tests/conf/offer_test_external_slave.json.in
deleted file mode 100644
index 47a3e9d..0000000
--- a/test/offer_tests/conf/offer_test_external_slave.json.in
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"vsomeipd",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "cyclic_offer_delay" : "500"
- }
-} \ No newline at end of file
diff --git a/test/offer_tests/offer_test_big_sd_msg_client.cpp b/test/offer_tests/offer_test_big_sd_msg_client.cpp
deleted file mode 100644
index cf00de7..0000000
--- a/test/offer_tests/offer_test_big_sd_msg_client.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <atomic>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-#include "../../implementation/configuration/include/internal.hpp"
-
-#include "offer_test_globals.hpp"
-
-class offer_test_big_sd_msg_client {
-public:
- offer_test_big_sd_msg_client(struct offer_test::service_info _service_info) :
- service_info_(_service_info),
- app_(vsomeip::runtime::get()->create_application("offer_test_big_sd_msg_client")),
- service_available_(false),
- wait_until_registered_(true),
- wait_until_service_available_(true),
- wait_until_subscribed_(true),
- wait_for_stop_(true),
- stop_thread_(std::bind(&offer_test_big_sd_msg_client::wait_for_stop, this)),
- send_thread_(std::bind(&offer_test_big_sd_msg_client::send, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&offer_test_big_sd_msg_client::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(&offer_test_big_sd_msg_client::on_message, this,
- std::placeholders::_1));
-
- // register availability for all other services and request their event.
- app_->register_availability_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE,
- std::bind(&offer_test_big_sd_msg_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3), 0x1, 0x1);
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(offer_test::big_msg_eventgroup_id);
- for (std::uint16_t s = 1; s <= offer_test::big_msg_number_services; s++) {
- app_->request_service(s,0x1,0x1,0x1,false);
- app_->request_event(s,0x1, offer_test::big_msg_event_id,
- its_eventgroups, false);
- app_->subscribe(s, 0x1,offer_test::big_msg_eventgroup_id, 0x1,
- vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE,
- offer_test::big_msg_event_id);
- services_available_subribed_[s] = std::make_pair(false,false);
- app_->register_subscription_status_handler(s,0x1,
- offer_test::big_msg_eventgroup_id,
- offer_test::big_msg_event_id,
- std::bind(&offer_test_big_sd_msg_client::subscription_status_changed, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3, std::placeholders::_4, std::placeholders::_5));
- }
- app_->start();
- }
-
- ~offer_test_big_sd_msg_client() {
- send_thread_.join();
- stop_thread_.join();
- }
-
- void on_state(vsomeip::state_type_e _state) {
- VSOMEIP_WARNING << "Application " << app_->get_name() << " is "
- << (_state == vsomeip::state_type_e::ST_REGISTERED ?
- "registered." : "deregistered.");
-
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- VSOMEIP_DEBUG << "Service [" << std::setw(4)
- << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is " << (_is_available ? "available":"not available") << ".";
-
- std::lock_guard<std::mutex> its_lock(mutex_);
- if(_is_available) {
- auto found_service = services_available_subribed_.find(_service);
- if (found_service != services_available_subribed_.end()) {
- found_service->second.first = true;
- if (std::all_of(services_available_subribed_.cbegin(),
- services_available_subribed_.cend(),
- [](const services_available_subribed_t::value_type& v) {
- return v.second.first;
- }
- )) {
- VSOMEIP_WARNING << "************************************************************";
- VSOMEIP_WARNING << "All services available!";
- VSOMEIP_WARNING << "************************************************************";
- wait_until_service_available_ = false;
- condition_.notify_one();
- }
- }
- }
- }
-
- void subscription_status_changed(const vsomeip::service_t _service,
- const vsomeip::instance_t _instance,
- const vsomeip::eventgroup_t _eventgroup,
- const vsomeip::event_t _event,
- const uint16_t _error) {
- EXPECT_EQ(0x1, _instance);
- EXPECT_EQ(offer_test::big_msg_eventgroup_id, _eventgroup);
- EXPECT_EQ(offer_test::big_msg_event_id, _event);
- VSOMEIP_DEBUG << "Service [" << std::setw(4)
- << std::setfill('0') << std::hex << _service << "." << _instance
- << "] has " << (!_error ? "sent subscribe ack":" sent subscribe_nack") << ".";
- if (_error == 0x0 /*OK*/) {
-
- std::lock_guard<std::mutex> its_lock(mutex_);
- auto found_service = services_available_subribed_.find(_service);
- if (found_service != services_available_subribed_.end()) {
- found_service->second.second = true;
- if (std::all_of(services_available_subribed_.cbegin(),
- services_available_subribed_.cend(),
- [](const services_available_subribed_t::value_type& v) {
- return v.second.second;
- }
- )) {
- VSOMEIP_WARNING << "************************************************************";
- VSOMEIP_WARNING << "All subscription were acknowledged!";
- VSOMEIP_WARNING << "************************************************************";
- wait_until_subscribed_ = false;
- condition_.notify_one();
- }
- }
- }
- };
-
- void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- on_response(_message);
- }
- }
-
- void on_response(const std::shared_ptr<vsomeip::message> &_message) {
- EXPECT_EQ(0x1, _message->get_service());
- EXPECT_EQ(service_info_.shutdown_method_id, _message->get_method());
- EXPECT_EQ(0x1, _message->get_instance());
- if(service_info_.shutdown_method_id == _message->get_method()) {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- VSOMEIP_INFO << "going down";
- stop_condition_.notify_one();
- }
- }
-
- void send() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- while (wait_until_service_available_) {
- condition_.wait(its_lock);
- }
-
- while (wait_until_subscribed_) {
- condition_.wait(its_lock);
- }
-
- std::this_thread::sleep_for(std::chrono::seconds(5));
- std::shared_ptr<vsomeip::message> its_req = vsomeip::runtime::get()->create_request();
- its_req->set_service(1);
- its_req->set_instance(1);
- its_req->set_interface_version(0x1);
- its_req->set_method(service_info_.shutdown_method_id);
- app_->send(its_req);
- }
-
- void wait_for_stop() {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
- VSOMEIP_INFO << "going down";
- app_->clear_all_handler();
- app_->stop();
- }
-
-private:
- struct offer_test::service_info service_info_;
- std::shared_ptr<vsomeip::application> app_;
- bool service_available_;
-
- bool wait_until_registered_;
- bool wait_until_service_available_;
- bool wait_until_subscribed_;
- std::mutex mutex_;
- std::condition_variable condition_;
-
- bool wait_for_stop_;
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
-
- typedef std::map<vsomeip::service_t,std::pair<bool, bool>> services_available_subribed_t;
- services_available_subribed_t services_available_subribed_;
- std::thread stop_thread_;
- std::thread send_thread_;
-};
-
-TEST(someip_offer_test_big_sd_msg, subscribe_or_call_method_at_service)
-{
- offer_test_big_sd_msg_client its_sample(offer_test::service);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/offer_tests/offer_test_big_sd_msg_service.cpp b/test/offer_tests/offer_test_big_sd_msg_service.cpp
deleted file mode 100644
index d5666c8..0000000
--- a/test/offer_tests/offer_test_big_sd_msg_service.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <atomic>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "offer_test_globals.hpp"
-
-class offer_test_big_sd_msg_service {
-public:
- offer_test_big_sd_msg_service(struct offer_test::service_info _service_info) :
- service_info_(_service_info),
- // service with number 1 uses "vsomeipd" as application name
- // this way the same json file can be reused for all local tests
- // including the ones with vsomeipd
- app_(vsomeip::runtime::get()->create_application("offer_test_big_sd_msg_service")),
- counter_(0),
- wait_until_registered_(true),
- shutdown_method_called_(false),
- offer_thread_(std::bind(&offer_test_big_sd_msg_service::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&offer_test_big_sd_msg_service::on_state, this,
- std::placeholders::_1));
-
- // offer field
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(offer_test::big_msg_eventgroup_id);
- for (std::uint16_t s = 1; s <= offer_test::big_msg_number_services; s++) {
- app_->offer_event(s, 0x1,
- offer_test::big_msg_event_id, its_eventgroups, false);
- }
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, service_info_.shutdown_method_id,
- std::bind(&offer_test_big_sd_msg_service::on_shutdown_method_called, this,
- std::placeholders::_1));
- app_->start();
- }
-
- ~offer_test_big_sd_msg_service() {
- offer_thread_.join();
- }
-
- void offer() {
- for (std::uint16_t s = 1; s <= offer_test::big_msg_number_services; s++) {
- app_->offer_service(s,0x1,0x1,0x1);
- }
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
- app_->send(vsomeip::runtime::get()->create_response(_message));
- std::this_thread::sleep_for(std::chrono::seconds(1));
- VSOMEIP_WARNING << "************************************************************";
- VSOMEIP_WARNING << "Shutdown method called -> going down!";
- VSOMEIP_WARNING << "************************************************************";
- shutdown_method_called_ = true;
- for (std::uint16_t s = 1; s <= offer_test::big_msg_number_services; s++) {
- app_->stop_offer_service(s,0x1,0x1,0x1);
- }
- app_->clear_all_handler();
- app_->stop();
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
- }
-
-private:
- struct offer_test::service_info service_info_;
- std::shared_ptr<vsomeip::application> app_;
- std::uint32_t counter_;
-
- bool wait_until_registered_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::atomic<bool> shutdown_method_called_;
- std::thread offer_thread_;
-};
-
-TEST(someip_offer_test_big_sd_msg, notify_increasing_counter)
-{
- offer_test_big_sd_msg_service its_sample(offer_test::service);
-}
-
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/offer_tests/offer_test_big_sd_msg_slave_starter.sh b/test/offer_tests/offer_test_big_sd_msg_slave_starter.sh
deleted file mode 100755
index d83139f..0000000
--- a/test/offer_tests/offer_test_big_sd_msg_slave_starter.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-FAIL=0
-# Rejecting offer for which there is already a remote offer:
-# * start daemon
-# * start application which offers service
-# * start daemon remotely
-# * start same application which offers the same service again remotely
-# -> should be rejected as there is already a service instance
-# running in the network
-
-export VSOMEIP_CONFIGURATION=offer_test_big_sd_msg_slave.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-sleep 1
-# Start the services
-./offer_test_big_sd_msg_service &
-PID_SERVICE_TWO=$!
-sleep 1
-
-# Wait until all clients and services are finished
-for job in $PID_SERVICE_TWO
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_VSOMEIPD
-sleep 1
-
-
-
-# Check if everything went well
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/offer_tests/offer_test_client.cpp b/test/offer_tests/offer_test_client.cpp
deleted file mode 100644
index b337199..0000000
--- a/test/offer_tests/offer_test_client.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <atomic>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-#include "../../implementation/configuration/include/internal.hpp"
-
-#include "offer_test_globals.hpp"
-
-enum operation_mode_e {
- SUBSCRIBE,
- METHODCALL
-};
-
-class offer_test_client {
-public:
- offer_test_client(struct offer_test::service_info _service_info, operation_mode_e _mode) :
- service_info_(_service_info),
- operation_mode_(_mode),
- app_(vsomeip::runtime::get()->create_application("offer_test_client")),
- service_available_(false),
- wait_until_registered_(true),
- wait_until_service_available_(true),
- wait_for_stop_(true),
- last_received_counter_(0),
- last_received_response_(std::chrono::steady_clock::now()),
- number_received_responses_(0),
- stop_thread_(std::bind(&offer_test_client::wait_for_stop, this)),
- send_thread_(std::bind(&offer_test_client::send, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&offer_test_client::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(&offer_test_client::on_message, this,
- std::placeholders::_1));
-
- // register availability for all other services and request their event.
- app_->register_availability_handler(service_info_.service_id,
- service_info_.instance_id,
- std::bind(&offer_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->request_service(service_info_.service_id,
- service_info_.instance_id);
-
- if (operation_mode_ == operation_mode_e::SUBSCRIBE) {
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(service_info_.eventgroup_id);
- app_->request_event(service_info_.service_id,
- service_info_.instance_id, service_info_.event_id,
- its_eventgroups, false);
-
- app_->subscribe(service_info_.service_id, service_info_.instance_id,
- service_info_.eventgroup_id, vsomeip::DEFAULT_MAJOR,
- vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE);
- }
-
- app_->start();
- }
-
- ~offer_test_client() {
- send_thread_.join();
- stop_thread_.join();
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- VSOMEIP_INFO << "Service [" << std::setw(4)
- << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is " << (_is_available ? "available":"not available") << ".";
- std::lock_guard<std::mutex> its_lock(mutex_);
- if(_is_available) {
- wait_until_service_available_ = false;
- condition_.notify_one();
- } else {
- wait_until_service_available_ = true;
- condition_.notify_one();
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- on_notification(_message);
- } else if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- on_response(_message);
- }
- }
-
- void on_notification(const std::shared_ptr<vsomeip::message> &_message) {
- std::shared_ptr<vsomeip::payload> its_payload(_message->get_payload());
- EXPECT_EQ(4u, its_payload->get_length());
- vsomeip::byte_t *d = its_payload->get_data();
- static std::uint32_t number_received_notifications(0);
- std::uint32_t counter(0);
- counter |= d[0] << 24;
- counter |= d[1] << 16;
- counter |= d[2] << 8;
- counter |= d[3];
-
- VSOMEIP_DEBUG
- << "Received a notification with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] from Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method() <<"] got:" << std::dec << counter;
-
- ASSERT_GT(counter, last_received_counter_);
- last_received_counter_ = counter;
- ++number_received_notifications;
-
- if(number_received_notifications >= 250) {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- VSOMEIP_INFO << "going down";
- stop_condition_.notify_one();
- }
- }
-
- void on_response(const std::shared_ptr<vsomeip::message> &_message) {
- ++number_received_responses_;
- static bool first(true);
- if (first) {
- first = false;
- last_received_response_ = std::chrono::steady_clock::now();
- return;
- }
- EXPECT_EQ(service_info_.service_id, _message->get_service());
- EXPECT_EQ(service_info_.method_id, _message->get_method());
- EXPECT_EQ(service_info_.instance_id, _message->get_instance());
- ASSERT_LT(std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::steady_clock::now() - last_received_response_).count(),
- (std::chrono::milliseconds(VSOMEIP_DEFAULT_WATCHDOG_TIMEOUT)
- + std::chrono::milliseconds(1000)).count());
- last_received_response_ = std::chrono::steady_clock::now();
- std::cout << ".";
- std::cout.flush();
- }
-
- void send() {
- if (operation_mode_ != operation_mode_e::METHODCALL) {
- return;
- }
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- while (wait_until_service_available_) {
- condition_.wait(its_lock);
- }
- its_lock.unlock();
- its_lock.release();
-
- for (int var = 0; var < offer_test::number_of_messages_to_send; ++var) {
- bool send(false);
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- send = !wait_until_service_available_;
- }
- if (send) {
- std::shared_ptr<vsomeip::message> its_req = vsomeip::runtime::get()->create_request();
- its_req->set_service(service_info_.service_id);
- its_req->set_instance(service_info_.instance_id);
- its_req->set_method(service_info_.method_id);
- app_->send(its_req);
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- } else {
- std::this_thread::sleep_for(std::chrono::milliseconds(50));
- }
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- VSOMEIP_INFO << "going down. Sent " << offer_test::number_of_messages_to_send
- << " requests and received " << number_received_responses_
- << " responses";
- stop_condition_.notify_one();
- }
- }
-
- void wait_for_stop() {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
- VSOMEIP_INFO << "going down";
- app_->clear_all_handler();
- app_->stop();
- }
-
-private:
- struct offer_test::service_info service_info_;
- operation_mode_e operation_mode_;
- std::shared_ptr<vsomeip::application> app_;
- bool service_available_;
-
- bool wait_until_registered_;
- bool wait_until_service_available_;
- std::mutex mutex_;
- std::condition_variable condition_;
-
- bool wait_for_stop_;
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
-
- std::uint32_t last_received_counter_;
- std::chrono::steady_clock::time_point last_received_response_;
- std::atomic<std::uint32_t> number_received_responses_;
- std::thread stop_thread_;
- std::thread send_thread_;
-};
-
-static operation_mode_e passed_mode = operation_mode_e::SUBSCRIBE;
-
-TEST(someip_offer_test, subscribe_or_call_method_at_service)
-{
- offer_test_client its_sample(offer_test::service, passed_mode);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a operation mode, like: " << argv[0] << " SUBSCRIBE" << std::endl;
- std::cerr << "Valid operation modes are SUBSCRIBE and METHODCALL" << std::endl;
- return 1;
- }
-
- if (std::string("SUBSCRIBE") == std::string(argv[1])) {
- passed_mode = operation_mode_e::SUBSCRIBE;
- } else if (std::string("METHODCALL") == std::string(argv[1])) {
- passed_mode = operation_mode_e::METHODCALL;
- } else {
- std::cerr << "Wrong operation mode passed, exiting" << std::endl;
- std::cerr << "Please specify a operation mode, like: " << argv[0] << " SUBSCRIBE" << std::endl;
- std::cerr << "Valid operation modes are SUBSCRIBE and METHODCALL" << std::endl;
- return 1;
- }
-
-#if 0
- if (argc >= 4 && std::string("SAME_SERVICE_ID") == std::string(argv[3])) {
- use_same_service_id = true;
- } else {
- use_same_service_id = false;
- }
-#endif
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/offer_tests/offer_test_external_sd_msg_sender.cpp b/test/offer_tests/offer_test_external_sd_msg_sender.cpp
deleted file mode 100644
index 6849b95..0000000
--- a/test/offer_tests/offer_test_external_sd_msg_sender.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (C) 2015-2017 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 <iostream>
-
-#include <gtest/gtest.h>
-
-#include <boost/asio.hpp>
-
-static char* passed_address;
-
-TEST(someip_offer_test, send_offer_service_sd_message)
-{
- try {
- boost::asio::io_service io;
- boost::asio::ip::udp::socket::endpoint_type target_sd(
- boost::asio::ip::address::from_string(std::string(passed_address)),
- 30490);
- boost::asio::ip::udp::socket udp_socket(io,
- boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490));
- std::uint8_t its_offer_service_message[] = {
- 0xff, 0xff, 0x81, 0x00,
- 0x00, 0x00, 0x00, 0x3c,
- 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x01, 0x02, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10,
- 0x01, 0x00, 0x00, 0x20,
- 0x11, 0x11, 0x00, 0x01,
- 0x00, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18,
- 0x00, 0x09, 0x04, 0x00,
- 0x0a, 0x00, 0x03, 0x01,
- 0x00, 0x06, 0x9c, 0x41,
- 0x00, 0x09, 0x04, 0x00,
- 0x0a, 0x00, 0x03, 0x7D, // slave address
- 0x00, 0x11, 0x75, 0x31
- };
- for (int var = 0; var < 15; ++var) {
- udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd);
- ++its_offer_service_message[11];
- }
-
- // call shutdown method
- std::uint8_t shutdown_call[] = {
- 0x11, 0x11, 0x14, 0x04,
- 0x00, 0x00, 0x00, 0x08,
- 0x22, 0x22, 0x00, 0x01,
- 0x01, 0x00, 0x01, 0x00 };
- boost::asio::ip::udp::socket::endpoint_type target_service(
- boost::asio::ip::address::from_string(std::string(passed_address)),
- 30001);
- udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service);
- } catch (...) {
- ASSERT_FALSE(true);
- }
-}
-
-
-#ifndef _WIN32
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cout << "Please pass an target IP address to this binary like: "
- << argv[0] << " 10.0.3.1" << std::endl;
- exit(1);
- }
- passed_address = argv[1];
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/offer_tests/offer_test_external_slave_starter.sh b/test/offer_tests/offer_test_external_slave_starter.sh
deleted file mode 100755
index d7f08fb..0000000
--- a/test/offer_tests/offer_test_external_slave_starter.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-FAIL=0
-# Rejecting offer for which there is already a remote offer:
-# * start daemon
-# * start application which offers service
-# * start daemon remotely
-# * start same application which offers the same service again remotely
-# -> should be rejected as there is already a service instance
-# running in the network
-
-export VSOMEIP_CONFIGURATION=offer_test_external_slave.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-sleep 1
-# Start the services
-./offer_test_service_external 2 &
-PID_SERVICE_TWO=$!
-sleep 1
-
-# Wait until all clients and services are finished
-for job in $PID_SERVICE_TWO
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_VSOMEIPD
-sleep 1
-
-
-
-# Check if everything went well
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/offer_tests/offer_test_globals.hpp b/test/offer_tests/offer_test_globals.hpp
deleted file mode 100644
index ba69886..0000000
--- a/test/offer_tests/offer_test_globals.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2014-2017 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 OFFER_TEST_GLOBALS_HPP_
-#define OFFER_TEST_GLOBALS_HPP_
-
-namespace offer_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
- vsomeip::event_t event_id;
- vsomeip::eventgroup_t eventgroup_id;
- vsomeip::method_t shutdown_method_id;
-};
-
-struct service_info service = { 0x1111, 0x1, 0x1111, 0x1111, 0x1000, 0x1404 };
-
-static constexpr int number_of_messages_to_send = 150;
-
-static constexpr std::uint16_t big_msg_number_services = 300;
-static constexpr vsomeip::event_t big_msg_event_id = 0x8000;
-static constexpr vsomeip::eventgroup_t big_msg_eventgroup_id = 0x1;
-}
-
-#endif /* OFFER_TEST_GLOBALS_HPP_ */
diff --git a/test/offer_tests/offer_test_local.json b/test/offer_tests/offer_test_local.json
deleted file mode 100644
index a54049c..0000000
--- a/test/offer_tests/offer_test_local.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "unicast":"127.0.0.1",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "routing":"vsomeipd",
- "service-discovery":
- {
- "enable":"false"
- }
-}
-
diff --git a/test/offer_tests/offer_test_local_starter.sh b/test/offer_tests/offer_test_local_starter.sh
deleted file mode 100755
index 38efbb6..0000000
--- a/test/offer_tests/offer_test_local_starter.sh
+++ /dev/null
@@ -1,298 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-FAIL=0
-
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Running first test
-*******************************************************************************
-*******************************************************************************
-End-of-message
-
-# Rejecting offer of service instance whose hosting application is still
-# alive:
-# * start application which offers service
-# * start two clients which continuously exchanges messages with the service
-# * start application which offers the same service again -> should be
-# rejected and an error message should be printed.
-# * Message exchange with client application should not be interrupted.
-
-# Array for client pids
-CLIENT_PIDS=()
-export VSOMEIP_CONFIGURATION=offer_test_local.json
-# Start the services
-./offer_test_service 1 &
-PID_SERVICE_ONE=$!
-./offer_test_client SUBSCRIBE &
-CLIENT_PIDS+=($!)
-./offer_test_client SUBSCRIBE &
-CLIENT_PIDS+=($!)
-
-./offer_test_service 2 &
-PID_SERVICE_TWO=$!
-
-# Wait until all clients are finished
-for job in ${CLIENT_PIDS[*]}
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_SERVICE_TWO
-kill $PID_SERVICE_ONE
-sleep 1
-
-
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Running second test
-*******************************************************************************
-*******************************************************************************
-End-of-message
-
-# Rejecting offer of service instance whose hosting application is still
-# alive with daemon:
-# * start daemon (needed as he has to ping the offering client)
-# * start application which offers service
-# * start two clients which continuously exchanges messages with the service
-# * start application which offers the same service again -> should be
-# rejected and an error message should be printed.
-# * Message exchange with client application should not be interrupted.
-
-# Array for client pids
-CLIENT_PIDS=()
-export VSOMEIP_CONFIGURATION=offer_test_local.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-
-# Start the services
-./offer_test_service 2 &
-PID_SERVICE_TWO=$!
-./offer_test_client SUBSCRIBE &
-CLIENT_PIDS+=($!)
-./offer_test_client SUBSCRIBE &
-CLIENT_PIDS+=($!)
-
-./offer_test_service 3 &
-PID_SERVICE_THREE=$!
-
-# Wait until all clients are finished
-for job in ${CLIENT_PIDS[*]}
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_SERVICE_THREE
-kill $PID_SERVICE_TWO
-sleep 1
-kill $PID_VSOMEIPD
-sleep 1
-
-
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Running third test
-*******************************************************************************
-*******************************************************************************
-End-of-message
-
-# Accepting offer of service instance whose hosting application crashed
-# with (send SIGKILL)
-# * start daemon
-# * start application which offers service
-# * start client which exchanges messages with the service
-# * kill application with SIGKILL
-# * start application which offers the same service again -> should be
-# accepted.
-# * start another client which exchanges messages with the service
-# * Client should now communicate with new offerer.
-
-# Array for client pids
-CLIENT_PIDS=()
-export VSOMEIP_CONFIGURATION=offer_test_local.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-# Start the service
-./offer_test_service 2 &
-PID_SERVICE_TWO=$!
-
-# Start a client
-./offer_test_client METHODCALL &
-CLIENT_PIDS+=($!)
-
-# Kill the service
-sleep 1
-kill -KILL $PID_SERVICE_TWO
-
-# reoffer the service
-./offer_test_service 3 &
-PID_SERVICE_THREE=$!
-
-# Start another client
-./offer_test_client METHODCALL &
-CLIENT_PIDS+=($!)
-
-# Wait until all clients are finished
-for job in ${CLIENT_PIDS[*]}
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_SERVICE_THREE
-kill $PID_VSOMEIPD
-sleep 1
-
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Running fourth test
-*******************************************************************************
-*******************************************************************************
-End-of-message
-
-# Accepting offer of service instance whose hosting application became
-# unresponsive (SIGSTOP)
-# * start daemon
-# * start application which offers service
-# * Send a SIGSTOP to the service to make it unresponsive
-# * start application which offers the same service again -> should be
-# marked as PENDING_OFFER and a ping should be sent to the paused
-# application.
-# * After the timeout passed the new offer should be accepted.
-# * start client which exchanges messages with the service
-# * Client should now communicate with new offerer.
-
-# Array for client pids
-CLIENT_PIDS=()
-export VSOMEIP_CONFIGURATION=offer_test_local.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-# Start the service
-./offer_test_service 2 &
-PID_SERVICE_TWO=$!
-
-# Start a client
-./offer_test_client METHODCALL &
-CLIENT_PIDS+=($!)
-
-# Pause the service
-sleep 1
-kill -STOP $PID_SERVICE_TWO
-
-# reoffer the service
-./offer_test_service 3 &
-PID_SERVICE_THREE=$!
-
-# Start another client
-./offer_test_client METHODCALL &
-CLIENT_PIDS+=($!)
-
-# Wait until all clients are finished
-for job in ${CLIENT_PIDS[*]}
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill -CONT $PID_SERVICE_TWO
-kill $PID_SERVICE_TWO
-kill $PID_SERVICE_THREE
-kill $PID_VSOMEIPD
-sleep 1
-
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Running fifth test
-*******************************************************************************
-*******************************************************************************
-End-of-message
-
-# Rejecting offers for which there is already a pending offer
-# * start daemon
-# * start application which offers service
-# * Send a SIGSTOP to the service to make it unresponsive
-# * start application which offers the same service again -> should be
-# marked as PENDING_OFFER and a ping should be sent to the paused
-# application.
-# * start application which offers the same service again -> should be
-# rejected as there is already a PENDING_OFFER pending.
-# * After the timeout passed the new offer should be accepted.
-# * start client which exchanges messages with the service
-# * Client should now communicate with new offerer.
-
-# Array for client pids
-CLIENT_PIDS=()
-export VSOMEIP_CONFIGURATION=offer_test_local.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-# Start the service
-./offer_test_service 2 &
-PID_SERVICE_TWO=$!
-
-# Start a client
-./offer_test_client METHODCALL &
-CLIENT_PIDS+=($!)
-
-# Pause the service
-sleep 1
-kill -STOP $PID_SERVICE_TWO
-
-# reoffer the service
-./offer_test_service 3 &
-PID_SERVICE_THREE=$!
-
-# reoffer the service again to provoke rejecting as there is
-# already a pending offer
-./offer_test_service 4 &
-PID_SERVICE_FOUR=$!
-
-# Start another client
-./offer_test_client METHODCALL &
-CLIENT_PIDS+=($!)
-
-# Wait until all clients are finished
-for job in ${CLIENT_PIDS[*]}
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill -CONT $PID_SERVICE_TWO
-kill $PID_SERVICE_TWO
-kill $PID_SERVICE_THREE
-kill $PID_SERVICE_FOUR
-kill $PID_VSOMEIPD
-
-
-# Check if everything went well
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/offer_tests/offer_test_service.cpp b/test/offer_tests/offer_test_service.cpp
deleted file mode 100644
index 13c193f..0000000
--- a/test/offer_tests/offer_test_service.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <atomic>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "offer_test_globals.hpp"
-
-static std::string service_number;
-
-class offer_test_service {
-public:
- offer_test_service(struct offer_test::service_info _service_info) :
- service_info_(_service_info),
- // service with number 1 uses "vsomeipd" as application name
- // this way the same json file can be reused for all local tests
- // including the ones with vsomeipd
- app_(vsomeip::runtime::get()->create_application(
- (service_number == "1") ? "vsomeipd" :
- "offer_test_service" + service_number)),
- counter_(0),
- wait_until_registered_(true),
- shutdown_method_called_(false),
- offer_thread_(std::bind(&offer_test_service::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&offer_test_service::on_state, this,
- std::placeholders::_1));
-
- // offer field
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(service_info_.eventgroup_id);
- app_->offer_event(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_eventgroups, false);
-
- inc_counter_and_notify();
-
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.method_id,
- std::bind(&offer_test_service::on_request, this,
- std::placeholders::_1));
-
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.shutdown_method_id,
- std::bind(&offer_test_service::on_shutdown_method_called, this,
- std::placeholders::_1));
- app_->start();
- }
-
- ~offer_test_service() {
- offer_thread_.join();
- }
-
- void offer() {
- app_->offer_service(service_info_.service_id, service_info_.instance_id);
- // this is allowed
- app_->offer_service(service_info_.service_id, service_info_.instance_id);
- // this is not allowed and will be rejected
- app_->offer_service(service_info_.service_id, service_info_.instance_id, 33, 4711);
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_request(const std::shared_ptr<vsomeip::message> &_message) {
- app_->send(vsomeip::runtime::get()->create_response(_message));
- }
-
- void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
- (void)_message;
- shutdown_method_called_ = true;
- // this is will trigger a warning
- app_->stop_offer_service(service_info_.service_id, service_info_.instance_id, 44, 4711);
- app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
- app_->clear_all_handler();
- app_->stop();
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Notifying";
- while(!shutdown_method_called_) {
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- inc_counter_and_notify();
- }
- }
-
- void inc_counter_and_notify() {
- ++counter_;
- // set value to field
- const std::shared_ptr<vsomeip::payload> its_payload(vsomeip::runtime::get()->create_payload());
- std::vector<vsomeip::byte_t> its_data;
- its_data.push_back(static_cast<vsomeip::byte_t>((counter_ & 0xFF000000) >> 24));
- its_data.push_back(static_cast<vsomeip::byte_t>((counter_ & 0xFF0000) >> 16));
- its_data.push_back(static_cast<vsomeip::byte_t>((counter_ & 0xFF00) >> 8));
- its_data.push_back(static_cast<vsomeip::byte_t>((counter_ & 0xFF)));
- its_payload->set_data(its_data);
- app_->notify(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_payload);
- }
-
-private:
- struct offer_test::service_info service_info_;
- std::shared_ptr<vsomeip::application> app_;
- std::uint32_t counter_;
-
- bool wait_until_registered_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::atomic<bool> shutdown_method_called_;
- std::thread offer_thread_;
-};
-
-TEST(someip_offer_test, notify_increasing_counter)
-{
- offer_test_service its_sample(offer_test::service);
-}
-
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a service number, like: " << argv[0] << " 2" << std::endl;
- return 1;
- }
-
- service_number = std::string(argv[1]);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/offer_tests/offer_test_service_external.cpp b/test/offer_tests/offer_test_service_external.cpp
deleted file mode 100644
index 694a678..0000000
--- a/test/offer_tests/offer_test_service_external.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "offer_test_globals.hpp"
-
-static std::string service_number;
-
-class offer_test_service {
-public:
- offer_test_service(struct offer_test::service_info _service_info) :
- service_info_(_service_info),
- // service with number 1 uses "vsomeipd" as application name
- // this way the same json file can be reused for all local tests
- // including the ones with vsomeipd
- app_(vsomeip::runtime::get()->create_application(
- (service_number == "1") ? "vsomeipd" :
- "offer_test_service" + service_number)),
- wait_until_registered_(true),
- wait_until_service_available_(true),
- offer_thread_(std::bind(&offer_test_service::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&offer_test_service::on_state, this,
- std::placeholders::_1));
-
- app_->register_availability_handler(service_info_.service_id,
- service_info_.instance_id,
- std::bind(&offer_test_service::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->request_service(service_info_.service_id,
- service_info_.instance_id);
- app_->start();
- }
-
- ~offer_test_service() {
- offer_thread_.join();
- }
-
- void offer() {
- app_->offer_service(service_info_.service_id, service_info_.instance_id);
- // this is allowed
- app_->offer_service(service_info_.service_id, service_info_.instance_id);
- // this is not allowed and will be rejected
- app_->offer_service(service_info_.service_id, service_info_.instance_id, 33, 4711);
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- VSOMEIP_INFO << "Service [" << std::setw(4)
- << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is " << (_is_available ? "available":"not available") << ".";
- std::lock_guard<std::mutex> its_lock(mutex_);
- if(_is_available) {
- wait_until_service_available_ = false;
- condition_.notify_one();
- } else {
- wait_until_service_available_ = true;
- condition_.notify_one();
- }
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
-
- while(wait_until_service_available_) {
- condition_.wait(its_lock);
- }
- }
-
- std::this_thread::sleep_for(std::chrono::seconds(1));
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Calling stop method";
- std::shared_ptr<vsomeip::message> msg(vsomeip::runtime::get()->create_request());
- msg->set_service(service_info_.service_id);
- msg->set_instance(service_info_.instance_id);
- msg->set_method(service_info_.shutdown_method_id);
- msg->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
- app_->send(msg);
- std::this_thread::sleep_for(std::chrono::seconds(2));
- app_->clear_all_handler();
- app_->stop();
- }
-
-private:
- struct offer_test::service_info service_info_;
- std::shared_ptr<vsomeip::application> app_;
-
- bool wait_until_registered_;
- bool wait_until_service_available_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::thread offer_thread_;
-};
-
-TEST(someip_offer_test, notify_increasing_counter)
-{
- offer_test_service its_sample(offer_test::service);
-}
-
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a service number, like: " << argv[0] << " 2" << std::endl;
- return 1;
- }
-
- service_number = std::string(argv[1]);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/offered_services_info_test/offered_services_info_test_client.cpp b/test/offered_services_info_test/offered_services_info_test_client.cpp
deleted file mode 100644
index 1aa0802..0000000
--- a/test/offered_services_info_test/offered_services_info_test_client.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <atomic>
-#include <future>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-#include "../../implementation/configuration/include/internal.hpp"
-
-#include "offered_services_info_test_globals.hpp"
-
-enum operation_mode_e {
- SUBSCRIBE,
- METHODCALL
-};
-
-std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> all_offered_services;
-std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> local_offered_services;
-std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> remote_offered_services;
-
-class offered_services_info_test_client {
-public:
- offered_services_info_test_client(struct offer_test::service_info _service_info,offer_test::service_info _remote_service_info, operation_mode_e _mode) :
- service_info_(_service_info),
- remote_service_info_(_remote_service_info),
- operation_mode_(_mode),
- app_(vsomeip::runtime::get()->create_application("offered_services_info_test_client")),
- service_available_(false),
- wait_until_registered_(true),
- wait_until_service_available_(true),
- wait_for_stop_(true),
- last_received_counter_(0),
- last_received_response_(std::chrono::steady_clock::now()),
- number_received_responses_(0),
- stop_thread_(std::bind(&offered_services_info_test_client::wait_for_stop, this)),
- test_offered_services_thread_(std::bind(&offered_services_info_test_client::test_offered_services, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
-
- local_offered_services[service_info_.service_id].insert(service_info_.instance_id);
- all_offered_services[service_info_.service_id].insert(service_info_.instance_id);
-
- local_offered_services[service_info_.service_id].insert((vsomeip::instance_t)(service_info_.instance_id + 1));
- all_offered_services[service_info_.service_id].insert((vsomeip::instance_t)(service_info_.instance_id + 1));
-
- // offer remote service ID 0x2222 instance ID 0x2 (port configuration added to json file)
- remote_offered_services[remote_service_info_.service_id].insert(remote_service_info_.instance_id);
- all_offered_services[remote_service_info_.service_id].insert(remote_service_info_.instance_id);
-
- remote_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 1)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 1));
- all_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 1)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 1));
-
- remote_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 2)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 2));
- all_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 2)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 2));
-
- app_->register_state_handler(
- std::bind(&offered_services_info_test_client::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(&offered_services_info_test_client::on_message, this,
- std::placeholders::_1));
-
- app_->register_availability_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE,
- std::bind(&offered_services_info_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- // request all services
- app_->request_service(service_info_.service_id, service_info_.instance_id);
- app_->request_service(service_info_.service_id, vsomeip::instance_t(service_info_.instance_id + 1));
- app_->request_service(remote_service_info_.service_id, remote_service_info_.instance_id);
- app_->request_service(vsomeip::service_t(remote_service_info_.service_id + 1), vsomeip::instance_t(remote_service_info_.instance_id + 1));
- app_->request_service(vsomeip::service_t(remote_service_info_.service_id + 2), vsomeip::instance_t(remote_service_info_.instance_id + 2));
-
- app_->start();
- }
-
- ~offered_services_info_test_client() {
- test_offered_services_thread_.join();
- stop_thread_.join();
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- VSOMEIP_INFO << "Service [" << std::setw(4)
- << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is " << (_is_available ? "available":"not available") << ".";
- static int services_available =0;
- std::lock_guard<std::mutex> its_lock(mutex_);
- if(_is_available) {
- services_available++;
- if (services_available == 5) {
- wait_until_service_available_ = false;
- condition_.notify_one();
- }
- } else {
- wait_until_service_available_ = true;
- condition_.notify_one();
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- if (_message->get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- on_response(_message);
- }
- }
-
- void on_response(const std::shared_ptr<vsomeip::message> &_message) {
- ++number_received_responses_;
- static bool first(true);
- if (first) {
- first = false;
- last_received_response_ = std::chrono::steady_clock::now();
- return;
- }
- EXPECT_EQ(service_info_.service_id, _message->get_service());
- EXPECT_EQ(service_info_.method_id, _message->get_method());
- EXPECT_EQ(service_info_.instance_id, _message->get_instance());
- ASSERT_LT(std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::steady_clock::now() - last_received_response_).count(),
- (std::chrono::milliseconds(VSOMEIP_DEFAULT_WATCHDOG_TIMEOUT)
- + std::chrono::milliseconds(1000)).count());
- last_received_response_ = std::chrono::steady_clock::now();
- std::cout << ".";
- std::cout.flush();
- }
-
- void test_offered_services() {
- if (operation_mode_ != operation_mode_e::METHODCALL) {
- return;
- }
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- while (wait_until_service_available_) {
- condition_.wait(its_lock);
- }
- its_lock.unlock();
- its_lock.release();
-
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
-
- VSOMEIP_INFO << "TEST LOCAL SERVICES";
- app_->get_offered_services_async(vsomeip::offer_type_e::OT_LOCAL, std::bind(&offered_services_info_test_client::on_offered_services_local, this, std::placeholders::_1));
-
- // send shutdown command to service
- if (std::future_status::timeout == all_callbacks_received_.get_future().wait_for(std::chrono::seconds(15))) {
- ADD_FAILURE() << "Didn't receive all callbacks within time";
- } else {
- std::shared_ptr<vsomeip::message> its_req = vsomeip::runtime::get()->create_request();
- its_req->set_service(service_info_.service_id);
- its_req->set_instance(service_info_.instance_id);
- its_req->set_method(service_info_.shutdown_method_id);
- app_->send(its_req);
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
-
-
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- VSOMEIP_INFO << "going down. Sent shutdown command to service";
- stop_condition_.notify_one();
- }
- }
-
- void on_offered_services_local( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) {
- std::cout << "ON OFFERED SERVICES LOCAL CALLBACK START" << std::endl;
- EXPECT_EQ(2u, _services.size());
- bool local_service_test_failed(true);
- for (auto its_pair : _services) {
- local_service_test_failed = true;
- std::cout << "CALLBACK VALUE -> Service: "<< std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl;
- auto found_service = local_offered_services.find(its_pair.first);
- if (found_service != local_offered_services.end()) {
- auto found_instance = found_service->second.find(its_pair.second);
- if (found_instance != found_service->second.end()) {
- local_service_test_failed = false;
- }
- }
- EXPECT_FALSE(local_service_test_failed);
- }
- std::cout << "ON OFFERED SERVICES LOCAL CALLBACK END" << std::endl;
- VSOMEIP_INFO << "TEST REMOTE SERVICES";
- app_->get_offered_services_async(vsomeip::offer_type_e::OT_REMOTE, std::bind(&offered_services_info_test_client::on_offered_services_remote, this, std::placeholders::_1));
- }
-
- void on_offered_services_remote( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) {
- std::cout << "ON OFFERED SERVICES REMOTE CALLBACK START" << std::endl;
- EXPECT_EQ(3u, _services.size());
- bool remote_service_test_failed(true);
- for (auto its_pair : _services) {
- remote_service_test_failed = true;
- std::cout << "CALLBACK VALUE -> Service: " << std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl;
- auto found_service = remote_offered_services.find(its_pair.first);
- if (found_service != remote_offered_services.end()) {
- auto found_instance = found_service->second.find(its_pair.second);
- if (found_instance != found_service->second.end()) {
- remote_service_test_failed = false;
- }
- }
- EXPECT_FALSE(remote_service_test_failed);
- }
- std::cout << "ON OFFERED SERVICES REMOTE CALLBACK END" << std::endl;
- VSOMEIP_INFO << "TEST ALL SERVICES";
- app_->get_offered_services_async(vsomeip::offer_type_e::OT_ALL, std::bind(&offered_services_info_test_client::on_offered_services_all, this, std::placeholders::_1));
- }
-
- void on_offered_services_all( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) {
- std::cout << "ON OFFERED SERVICES ALL CALLBACK START" << std::endl;
- EXPECT_EQ(5u, _services.size());
- bool all_service_test_failed(true);
- for (auto its_pair : _services) {
- all_service_test_failed = true;
- std::cout << "CALLBACK VALUE -> Service: " << std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl;
- auto found_service = all_offered_services.find(its_pair.first);
- if (found_service != all_offered_services.end()) {
- auto found_instance = found_service->second.find(its_pair.second);
- if (found_instance != found_service->second.end()) {
- all_service_test_failed = false;
- }
- }
- EXPECT_FALSE(all_service_test_failed);
- }
- std::cout << "ON OFFERED SERVICES ALL CALLBACK END" << std::endl;
- all_callbacks_received_.set_value();
- }
-
- void wait_for_stop() {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
- VSOMEIP_INFO << "going down";
- app_->clear_all_handler();
- app_->stop();
- }
-
-private:
- struct offer_test::service_info service_info_;
- struct offer_test::service_info remote_service_info_;
- operation_mode_e operation_mode_;
- std::shared_ptr<vsomeip::application> app_;
- bool service_available_;
-
- bool wait_until_registered_;
- bool wait_until_service_available_;
- std::mutex mutex_;
- std::condition_variable condition_;
-
- bool wait_for_stop_;
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
-
- std::uint32_t last_received_counter_;
- std::chrono::steady_clock::time_point last_received_response_;
- std::atomic<std::uint32_t> number_received_responses_;
- std::promise<void> all_callbacks_received_;
- std::thread stop_thread_;
- std::thread test_offered_services_thread_;
-};
-
-static operation_mode_e passed_mode = operation_mode_e::METHODCALL;
-
-TEST(someip_offered_services_info_test, check_offered_services)
-{
- offered_services_info_test_client its_sample(offer_test::service, offer_test::remote_service, passed_mode);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a operation mode, like: " << argv[0] << " SUBSCRIBE" << std::endl;
- std::cerr << "Valid operation modes are SUBSCRIBE and METHODCALL" << std::endl;
- return 1;
- }
-
- if (std::string("SUBSCRIBE") == std::string(argv[1])) {
- passed_mode = operation_mode_e::SUBSCRIBE;
- } else if (std::string("METHODCALL") == std::string(argv[1])) {
- passed_mode = operation_mode_e::METHODCALL;
- } else {
- std::cerr << "Wrong operation mode passed, exiting" << std::endl;
- std::cerr << "Please specify a operation mode, like: " << argv[0] << " SUBSCRIBE" << std::endl;
- std::cerr << "Valid operation modes are SUBSCRIBE and METHODCALL" << std::endl;
- return 1;
- }
-
-#if 0
- if (argc >= 4 && std::string("SAME_SERVICE_ID") == std::string(argv[3])) {
- use_same_service_id = true;
- } else {
- use_same_service_id = false;
- }
-#endif
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/offered_services_info_test/offered_services_info_test_globals.hpp b/test/offered_services_info_test/offered_services_info_test_globals.hpp
deleted file mode 100644
index b74dfab..0000000
--- a/test/offered_services_info_test/offered_services_info_test_globals.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2014-2017 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 OFFER_TEST_GLOBALS_HPP_
-#define OFFER_TEST_GLOBALS_HPP_
-
-namespace offer_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
- vsomeip::event_t event_id;
- vsomeip::eventgroup_t eventgroup_id;
- vsomeip::method_t shutdown_method_id;
-};
-
-uint8_t num_all_offered_services = 5;
-uint8_t num_local_offered_services = 2;
-uint8_t num_remote_offered_services = 3;
-
-
-struct service_info service = { 0x1111, 0x1, 0x1111, 0x1111, 0x1000, 0x1404 };
-struct service_info remote_service = { 0x2222, 0x2, 0x2222, 0x2222, 0x2000, 0x2808 };
-}
-
-#endif /* OFFER_TEST_GLOBALS_HPP_ */
diff --git a/test/offered_services_info_test/offered_services_info_test_local.json b/test/offered_services_info_test/offered_services_info_test_local.json
deleted file mode 100644
index cb7db92..0000000
--- a/test/offered_services_info_test/offered_services_info_test_local.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "unicast" : "127.0.0.1",
- "diagnosis":"0x12",
- "logging" :
- {
- "level" : "warning",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "offered_services_info_test_service",
- "id" : "0x1277"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1111",
- "instance" : "0x1"
- },
- {
- "service" : "0x2222",
- "instance" : "0x2",
- "reliable" : { "port" : "30502" },
- "unreliable" : "31002"
- },
- {
- "service" : "0x2223",
- "instance" : "0x3",
- "reliable" : { "port" : "30503" }
- },
- {
- "service" : "0x2224",
- "instance" : "0x4",
- "unreliable" : "31004"
- }
- ],
-
- "routing" : "vsomeipd",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-}
diff --git a/test/offered_services_info_test/offered_services_info_test_local_starter.sh b/test/offered_services_info_test/offered_services_info_test_local_starter.sh
deleted file mode 100755
index 68482f9..0000000
--- a/test/offered_services_info_test/offered_services_info_test_local_starter.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-FAIL=0
-
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Running first test
-*******************************************************************************
-*******************************************************************************
-End-of-message
-
-# Rejecting offer of service instance whose hosting application is still
-# alive:
-# * start application which offers service
-# * start two clients which continuously exchanges messages with the service
-# * start application which offers the same service again -> should be
-# rejected and an error message should be printed.
-# * Message exchange with client application should not be interrupted.
-
-# Array for client pids
-CLIENT_PIDS=()
-export VSOMEIP_CONFIGURATION=offered_services_info_test_local.json
-# Start the services (vsomeipd as app name)
-./offered_services_info_test_service 1 & #vsomeipd as app name
-PID_SERVICE_ONE=$!
-./offered_services_info_test_client METHODCALL &
-CLIENT_PIDS+=($!)
-
-# Wait until all clients are finished
-for job in ${CLIENT_PIDS[*]}
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_SERVICE_ONE
-sleep 1
-
-
-# Check if everything went well
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/offered_services_info_test/offered_services_info_test_service.cpp b/test/offered_services_info_test/offered_services_info_test_service.cpp
deleted file mode 100644
index d9a7ae4..0000000
--- a/test/offered_services_info_test/offered_services_info_test_service.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <atomic>
-#include <future>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "offered_services_info_test_globals.hpp"
-
-static std::string service_number;
-std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> all_offered_services;
-std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> local_offered_services;
-std::map<vsomeip::service_t, std::set<vsomeip::instance_t>> remote_offered_services;
-
-
-class offer_test_service {
-public:
- offer_test_service(struct offer_test::service_info _service_info, struct offer_test::service_info _remote_service_info) :
- service_info_(_service_info),
- remote_service_info_(_remote_service_info),
- // service with number 1 uses "vsomeipd" as application name
- // this way the same json file can be reused for all local tests
- // including the ones with vsomeipd
- app_(vsomeip::runtime::get()->create_application(
- (service_number == "1") ? "vsomeipd" :
- "offered_services_info_test_service" + service_number)),
- counter_(0),
- wait_until_registered_(true),
- shutdown_method_called_(false),
- offer_thread_(std::bind(&offer_test_service::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&offer_test_service::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.method_id,
- std::bind(&offer_test_service::on_request, this,
- std::placeholders::_1));
-
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.shutdown_method_id,
- std::bind(&offer_test_service::on_shutdown_method_called, this,
- std::placeholders::_1));
- app_->start();
- }
-
- ~offer_test_service() {
- offer_thread_.join();
- }
-
- void offer() {
- //offer local services
- app_->offer_service(service_info_.service_id, service_info_.instance_id);
- local_offered_services[service_info_.service_id].insert(service_info_.instance_id);
- all_offered_services[service_info_.service_id].insert(service_info_.instance_id);
-
- app_->offer_service(service_info_.service_id, (vsomeip::instance_t)(service_info_.instance_id + 1));
- local_offered_services[service_info_.service_id].insert((vsomeip::instance_t)(service_info_.instance_id + 1));
- all_offered_services[service_info_.service_id].insert((vsomeip::instance_t)(service_info_.instance_id + 1));
-
- // offer remote service ID 0x2222 instance ID 0x2 (port configuration added to json file)
- app_->offer_service(remote_service_info_.service_id, remote_service_info_.instance_id); // reliable and unreliable port
- remote_offered_services[remote_service_info_.service_id].insert(remote_service_info_.instance_id);
- all_offered_services[remote_service_info_.service_id].insert(remote_service_info_.instance_id);
-
-
- app_->offer_service((vsomeip::service_t)(remote_service_info_.service_id + 1), (vsomeip::instance_t)(remote_service_info_.instance_id + 1)); // only reliable port
- remote_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 1)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 1));
- all_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 1)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 1));
-
-
- app_->offer_service((vsomeip::service_t)(remote_service_info_.service_id + 2), (vsomeip::instance_t)(remote_service_info_.instance_id + 2)); // only unreliable port
- remote_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 2)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 2));
- all_offered_services[(vsomeip::service_t)(remote_service_info_.service_id + 2)].insert((vsomeip::instance_t)(remote_service_info_.instance_id + 2));
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_request(const std::shared_ptr<vsomeip::message> &_message) {
- app_->send(vsomeip::runtime::get()->create_response(_message));
- }
-
- void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
- (void)_message;
- shutdown_method_called_ = true;
-
- app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
- app_->stop_offer_service(service_info_.service_id, (vsomeip::instance_t)(service_info_.instance_id + 1));
-
- app_->stop_offer_service(remote_service_info_.service_id, remote_service_info_.instance_id); // reliable and unreliable port
- app_->stop_offer_service((vsomeip::service_t)(remote_service_info_.service_id + 1), (vsomeip::instance_t)(remote_service_info_.instance_id + 1)); // only reliable port
- app_->stop_offer_service((vsomeip::service_t)(remote_service_info_.service_id + 2), (vsomeip::instance_t)(remote_service_info_.instance_id + 2)); // only unreliable port
-
- app_->clear_all_handler();
- app_->stop();
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
-
- VSOMEIP_INFO << "TEST LOCAL SERVICES";
- app_->get_offered_services_async(vsomeip::offer_type_e::OT_LOCAL, std::bind(&offer_test_service::on_offered_services_local, this, std::placeholders::_1));
-
- if (std::future_status::timeout == all_callbacks_received_.get_future().wait_for(std::chrono::seconds(15))) {
- ADD_FAILURE() << "Didn't receive all callbacks within time";
- }
-
- while(!shutdown_method_called_) {
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- }
- }
-
-
- void on_offered_services_local( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) {
- std::cout << "ON OFFERED SERVICES LOCAL CALLBACK START" << std::endl;
- EXPECT_EQ(2u, _services.size());
- bool local_service_test_failed(true);
- uint16_t i=0;
- for (auto its_pair : _services) {
- local_service_test_failed = true;
- std::cout << "CALLBACK VALUE -> Service: "<< std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl;
- auto found_service = local_offered_services.find(its_pair.first);
- if (found_service != local_offered_services.end()) {
- auto found_instance = found_service->second.find(its_pair.second);
- if (found_instance != found_service->second.end()) {
- i++;
- local_service_test_failed = false;
- }
- }
- EXPECT_FALSE(local_service_test_failed);
- }
- EXPECT_EQ(offer_test::num_local_offered_services, i);
-
- std::cout << "ON OFFERED SERVICES LOCAL CALLBACK END" << std::endl;
-
- VSOMEIP_INFO << "TEST REMOTE SERVICES";
- app_->get_offered_services_async(vsomeip::offer_type_e::OT_REMOTE, std::bind(&offer_test_service::on_offered_services_remote, this, std::placeholders::_1));
- }
-
-
- void on_offered_services_remote( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) {
- std::cout << "ON OFFERED SERVICES REMOTE CALLBACK START" << std::endl;
- EXPECT_EQ(3u, _services.size());
- bool remote_service_test_failed(true);
- uint16_t i=0;
- for (auto its_pair : _services) {
- remote_service_test_failed = true;
- std::cout << "CALLBACK VALUE -> Service: " << std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl;
- auto found_service = remote_offered_services.find(its_pair.first);
- if (found_service != remote_offered_services.end()) {
- auto found_instance = found_service->second.find(its_pair.second);
- if (found_instance != found_service->second.end()) {
- i++;
- remote_service_test_failed = false;
- }
- }
- EXPECT_FALSE(remote_service_test_failed);
- }
- EXPECT_EQ(offer_test::num_remote_offered_services, i);
-
- std::cout << "ON OFFERED SERVICES REMOTE CALLBACK END" << std::endl;
-
- VSOMEIP_INFO << "TEST ALL SERVICES";
- app_->get_offered_services_async(vsomeip::offer_type_e::OT_ALL, std::bind(&offer_test_service::on_offered_services_all, this, std::placeholders::_1));
- }
-
-
- void on_offered_services_all( const std::vector<std::pair<vsomeip::service_t, vsomeip::instance_t>> &_services) {
- std::cout << "ON OFFERED SERVICES ALL CALLBACK START" << std::endl;
- EXPECT_EQ(5u, _services.size());
- bool all_service_test_failed(true);
- uint16_t i=0;
- for (auto its_pair : _services) {
- all_service_test_failed = true;
- std::cout << "CALLBACK VALUE -> Service: " << std::hex << std::get<0>(its_pair) << " instance: " << std::get<1>(its_pair) << std::endl;
- auto found_service = all_offered_services.find(its_pair.first);
- if (found_service != all_offered_services.end()) {
- auto found_instance = found_service->second.find(its_pair.second);
- if (found_instance != found_service->second.end()) {
- i++;
- all_service_test_failed = false;
- }
- }
- EXPECT_FALSE(all_service_test_failed);
- }
- EXPECT_EQ(offer_test::num_all_offered_services, i);
- std::cout << "ON OFFERED SERVICES ALL CALLBACK END" << std::endl;
- all_callbacks_received_.set_value();
- }
-
-private:
- struct offer_test::service_info service_info_;
- struct offer_test::service_info remote_service_info_;
- std::shared_ptr<vsomeip::application> app_;
- std::uint32_t counter_;
-
- bool wait_until_registered_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::atomic<bool> shutdown_method_called_;
- std::promise<void> all_callbacks_received_;
- std::thread offer_thread_;
-};
-
-TEST(someip_offered_services_info_test, check_offered_services_as_rm_impl)
-{
- offer_test_service its_sample(offer_test::service, offer_test::remote_service);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a service number, like: " << argv[0] << " 2" << std::endl;
- return 1;
- }
-
- service_number = std::string(argv[1]);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/payload_tests/conf/external_local_payload_test_client_external.json.in b/test/payload_tests/conf/external_local_payload_test_client_external.json.in
deleted file mode 100644
index d027a6f..0000000
--- a/test/payload_tests/conf/external_local_payload_test_client_external.json.in
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "unicast" : "@TEST_IP_SLAVE@",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "true",
- "path" : "/var/log/vsomeip.log"
- },
-
- "dlt" : "true"
- },
-
- "applications" :
- [
- {
- "name" : "external_local_payload_test_client_external",
- "id" : "0x1343"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unicast" : "@TEST_IP_MASTER@",
- "unreliable" : "30509",
- "reliable" :
- {
- "port" : "30510",
- "enable-magic-cookies" : "false"
- }
- }
- ],
-
- "routing" : "external_local_payload_test_client_external",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30491",
- "protocol" : "udp"
- }
-}
diff --git a/test/payload_tests/conf/external_local_payload_test_client_local.json.in b/test/payload_tests/conf/external_local_payload_test_client_local.json.in
deleted file mode 100644
index 40f40ca..0000000
--- a/test/payload_tests/conf/external_local_payload_test_client_local.json.in
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "unicast" : "@TEST_IP_MASTER@",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "true",
- "path" : "/var/log/vsomeip.log"
- },
-
- "dlt" : "true"
- },
-
- "applications" :
- [
- {
- "name" : "external_local_payload_test_client_local",
- "id" : "0x1343"
- }
- ],
-
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unicast" : "@TEST_IP_MASTER@",
- "unreliable" : "30509",
- "reliable" :
- {
- "port" : "30510",
- "enable-magic-cookies" : "false"
- }
- }
- ],
-
- "routing" : "external_local_payload_test_service",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30491",
- "protocol" : "udp"
- }
-}
diff --git a/test/payload_tests/conf/external_local_payload_test_service.json.in b/test/payload_tests/conf/external_local_payload_test_service.json.in
deleted file mode 100644
index dc7680c..0000000
--- a/test/payload_tests/conf/external_local_payload_test_service.json.in
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "unicast" : "@TEST_IP_MASTER@",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "external_local_payload_test_service",
- "id" : "0x1277"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509",
- "reliable" :
- {
- "port" : "30510",
- "enable-magic-cookies" : "false"
- }
- }
- ],
-
- "routing" : "external_local_payload_test_service",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-}
diff --git a/test/payload_tests/external_local_payload_test_client_external_start.sh b/test/payload_tests/external_local_payload_test_client_external_start.sh
deleted file mode 100755
index 5f6b7ea..0000000
--- a/test/payload_tests/external_local_payload_test_client_external_start.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_external
-export VSOMEIP_CONFIGURATION=external_local_payload_test_client_external.json
-./payload_test_client --udp --max-payload-size UDP
-# We sleep to let the service restart with --tcp option so we can test
-# communication via TCP.
-sleep 5
-./payload_test_client --tcp --max-payload-size TCP
diff --git a/test/payload_tests/external_local_payload_test_client_external_starter.sh b/test/payload_tests/external_local_payload_test_client_external_starter.sh
deleted file mode 100755
index da6ca08..0000000
--- a/test/payload_tests/external_local_payload_test_client_external_starter.sh
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit sucessfully.
-
-FAIL=0
-
-# Parameter 1: the pid to check
-# Parameter 2: number of TCP/UDP sockets the process should have open
-check_tcp_udp_sockets_are_open ()
-{
- # Check that the passed pid/process does listen on at least one TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -lt $2 ]
- then
- ((FAIL+=1))
- fi
-}
-
-# Parameter 1: the pid to check
-check_tcp_udp_sockets_are_closed ()
-{
- # Check that the passed pid/process does not listen on any TCP/UDP socket
- # or has any active connection via a TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -ne 0 ]
- then
- ((FAIL+=1))
- fi
-
- SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ]
- then
- ((FAIL+=1))
- fi
-}
-
-# Start the service for payload test with UDP
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
-./payload_test_service --udp &
-SERIVCE_PID=$!
-
-# Display a message to show the user that he must now call the external client
-# to finish the test successfully
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting external local payload on slave LXC"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./external_local_payload_test_client_external_start.sh\"" &
- echo "remote ssh job id: $!"
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name elptces $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./external_local_payload_test_client_external_start.sh" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** external_local_payload_test_client_external_start.sh
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** external_local_payload_test_client_external.json and
-** external_local_payload_test_service.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# The service should listen on a TCP and UDP socket now
-sleep 1
-check_tcp_udp_sockets_are_open $SERIVCE_PID 2
-
-# Wait until service is finished
-# The client remotely shuts down the service if he has successfully transmitted
-# all the packets with different payloads. Therefore we can assume that everything
-# went well, even if we can only check the exit code of the service here.
-
-# Fail gets incremented if either client or service exit
-# with a non-zero exit code
-wait $SERIVCE_PID || ((FAIL+=1))
-
-
-# Start the service for payload test with tcp
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
-./payload_test_service --tcp &
-SERIVCE_PID=$!
-
-# The service should listen on a TCP and UDP socket now
-sleep 1
-check_tcp_udp_sockets_are_open $SERIVCE_PID 2
-
-
-# Wait until service is finished
-# The client remotely shuts down the service if he has successfully transmitted
-# all the packets with different payloads. Therefore we can assume that everything
-# went well, even if we can only check the exit code of the service here.
-
-# Fail gets incremented if either client or service exit
-# with a non-zero exit code
-wait $SERIVCE_PID || ((FAIL+=1))
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker wait elptces
- docker rm elptces
-fi
-
-# Check if server exited sucessfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh b/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh
deleted file mode 100755
index 041abc4..0000000
--- a/test/payload_tests/external_local_payload_test_client_local_and_external_starter.sh
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit sucessfully.
-
-FAIL=0
-
-# Parameter 1: the pid to check
-# Parameter 2: number of TCP/UDP sockets the process should have open
-check_tcp_udp_sockets_are_open ()
-{
- # Check that the passed pid/process does listen on at least one TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -lt $2 ]
- then
- ((FAIL+=1))
- fi
-}
-
-# Parameter 1: the pid to check
-check_tcp_udp_sockets_are_closed ()
-{
- # Check that the passed pid/process does not listen on any TCP/UDP socket
- # or has any active connection via a TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -ne 0 ]
- then
- ((FAIL+=1))
- fi
-
- SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ]
- then
- ((FAIL+=1))
- fi
-}
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
-./payload_test_service &
-SERIVCE_PID=$!
-sleep 1;
-
-# The service should listen on a TCP and UDP socket now
-check_tcp_udp_sockets_are_open $SERIVCE_PID 2
-
-# Start the client which sends messages over local UDS
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local
-export VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json
-./payload_test_client --dont-shutdown-service &
-CLIENT_PID=$!
-sleep 1
-
-check_tcp_udp_sockets_are_open $SERIVCE_PID 2
-check_tcp_udp_sockets_are_closed $CLIENT_PID
-
-# Wait until client is finished
-wait $CLIENT_PID || ((FAIL+=1))
-
-# Display a message to show the user that he must now call the external client
-# to finish the test successfully
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting external local payload on slave LXC"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./external_local_payload_test_client_external_start.sh\"" &
- echo "remote ssh job id: $!"
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name elptclaes $DOCKER_IMAGE sh -c "cd $DOCKER_TESTS && ./external_local_payload_test_client_external_start.sh" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** external_local_payload_test_client_external_start.sh
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** external_local_payload_test_client_external.json and
-** external_local_payload_test_service.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# The service should still listen on a TCP and UDP socket
-sleep 1
-check_tcp_udp_sockets_are_open $SERIVCE_PID 2
-
-# Wait until service is finished
-# The client remotely shuts down the service if he has successfully transmitted
-# all the packets with different payloads. Therefore we can assume that everything
-# went well, even if we can only check the exit code of the service here.
-
-# Fail gets incremented if either client or service exit
-# with a non-zero exit code
-wait $SERIVCE_PID || ((FAIL+=1))
-
-
-# Start the service for payload test with tcp
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
-./payload_test_service --tcp &
-SERIVCE_PID=$!
-
-# The service should listen on a TCP and UDP socket now
-sleep 1
-check_tcp_udp_sockets_are_open $SERIVCE_PID 2
-
-
-# Wait until service is finished
-# The client remotely shuts down the service if he has successfully transmitted
-# all the packets with different payloads. Therefore we can assume that everything
-# went well, even if we can only check the exit code of the service here.
-
-# Fail gets incremented if either client or service exit
-# with a non-zero exit code
-wait $SERIVCE_PID || ((FAIL+=1))
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker wait elptclaes
- docker rm elptclaes
-fi
-
-# Check if client and server both exited sucessfully and the service didnt't
-# have any open TCP/UDP sockets
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/payload_tests/external_local_payload_test_client_local_start.sh b/test/payload_tests/external_local_payload_test_client_local_start.sh
deleted file mode 100755
index b79e534..0000000
--- a/test/payload_tests/external_local_payload_test_client_local_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local
-export VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json
-./payload_test_client
diff --git a/test/payload_tests/external_local_payload_test_client_local_starter.sh b/test/payload_tests/external_local_payload_test_client_local_starter.sh
deleted file mode 100755
index c73dd81..0000000
--- a/test/payload_tests/external_local_payload_test_client_local_starter.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit sucessfully.
-
-FAIL=0
-
-# Parameter 1: the pid to check
-# Parameter 2: number of TCP/UDP sockets the process should have open
-check_tcp_udp_sockets_are_open ()
-{
- # Check that the passed pid/process does listen on at least one TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -lt $2 ]
- then
- ((FAIL+=1))
- fi
-}
-
-# Parameter 1: the pid to check
-check_tcp_udp_sockets_are_closed ()
-{
- # Check that the passed pid/process does not listen on any TCP/UDP socket
- # or has any active connection via a TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -ne 0 ]
- then
- ((FAIL+=1))
- fi
-
- SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ]
- then
- ((FAIL+=1))
- fi
-}
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
-./payload_test_service &
-SERIVCE_PID=$!
-sleep 1;
-
-# The service should listen on a TCP and UDP socket now
-check_tcp_udp_sockets_are_open $SERIVCE_PID 2
-
-# Start the client
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local
-export VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json
-./payload_test_client &
-CLIENT_PID=$!
-
-# The service should still listen on a TCP and UDP socket now
-check_tcp_udp_sockets_are_open $SERIVCE_PID 2
-# The client should use the shortcut over a local UDS instead of TCP/UDP,
-# therefore he shouldn't have any open TCP/UDP sockets
-check_tcp_udp_sockets_are_closed $CLIENT_PID
-
-if [ ! -z "$USE_DOCKER" ]; then
- FAIL=0
-fi
-
-# Wait until client and service are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-# Check if client and server both exited sucessfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/payload_tests/external_local_payload_test_service_client_external_start.sh b/test/payload_tests/external_local_payload_test_service_client_external_start.sh
deleted file mode 100755
index 046d50b..0000000
--- a/test/payload_tests/external_local_payload_test_service_client_external_start.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
-./payload_test_service --udp
-# After payload was measured with UDP the client will restart and measure
-# throughput with TCP
-./payload_test_service --tcp \ No newline at end of file
diff --git a/test/payload_tests/external_local_payload_test_service_start.sh b/test/payload_tests/external_local_payload_test_service_start.sh
deleted file mode 100755
index 90b1b38..0000000
--- a/test/payload_tests/external_local_payload_test_service_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=external_local_payload_test_service
-export VSOMEIP_CONFIGURATION=external_local_payload_test_service.json
-./payload_test_service
diff --git a/test/payload_tests/local_payload_test_client.json b/test/payload_tests/local_payload_test_client.json
deleted file mode 100644
index 24fa1fa..0000000
--- a/test/payload_tests/local_payload_test_client.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "unicast" : "127.0.0.1",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "true",
- "path" : "/var/log/vsomeip.log"
- },
-
- "dlt" : "true"
- },
-
- "applications" :
- [
- {
- "name" : "local_payload_test_client",
- "id" : "0x1343"
- }
- ],
- "services" :
- [
- ],
-
- "routing" : "local_payload_test_service",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30491",
- "protocol" : "udp"
- }
-}
diff --git a/test/payload_tests/local_payload_test_client_start.sh b/test/payload_tests/local_payload_test_client_start.sh
deleted file mode 100755
index 975be2a..0000000
--- a/test/payload_tests/local_payload_test_client_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=local_payload_test_client
-export VSOMEIP_CONFIGURATION=local_payload_test_client.json
-./payload_test_client
diff --git a/test/payload_tests/local_payload_test_huge_payload_starter.sh b/test/payload_tests/local_payload_test_huge_payload_starter.sh
deleted file mode 100755
index c230891..0000000
--- a/test/payload_tests/local_payload_test_huge_payload_starter.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit sucessfully.
-
-FAIL=0
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=local_payload_test_service
-export VSOMEIP_CONFIGURATION=local_payload_test_service.json
-./payload_test_service &
-SERIVCE_PID=$!
-sleep 1;
-
-# Start the client
-export VSOMEIP_APPLICATION_NAME=local_payload_test_client
-export VSOMEIP_CONFIGURATION=local_payload_test_client.json
-./payload_test_client --number-of-messages 100 --max-payload-size 10485760 &
-CLIENT_PID=$!
-
-# Wait until client and service are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-# Check if client and server both exited sucessfully and the service didnt't
-# have any open tcp/udp sockets
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/payload_tests/local_payload_test_service.json b/test/payload_tests/local_payload_test_service.json
deleted file mode 100644
index b5c83a6..0000000
--- a/test/payload_tests/local_payload_test_service.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "unicast" : "127.0.0.1",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "local_payload_test_service",
- "id" : "0x1277"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ],
-
- "routing" : "local_payload_test_service",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-}
diff --git a/test/payload_tests/local_payload_test_service_start.sh b/test/payload_tests/local_payload_test_service_start.sh
deleted file mode 100755
index cc67f54..0000000
--- a/test/payload_tests/local_payload_test_service_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=local_payload_test_service
-export VSOMEIP_CONFIGURATION=local_payload_test_service.json
-./payload_test_service
diff --git a/test/payload_tests/local_payload_test_starter.sh b/test/payload_tests/local_payload_test_starter.sh
deleted file mode 100755
index abc4577..0000000
--- a/test/payload_tests/local_payload_test_starter.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit sucessfully.
-
-FAIL=0
-
-# Parameter 1: the pid to check
-check_tcp_udp_sockets_are_closed ()
-{
- # Check that the service does not listen on any TCP/UDP socket
- # or has any active connection via a TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -ne 0 ]
- then
- ((FAIL+=1))
- fi
-
- SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ]
- then
- ((FAIL+=1))
- fi
-}
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=local_payload_test_service
-export VSOMEIP_CONFIGURATION=local_payload_test_service.json
-./payload_test_service &
-SERIVCE_PID=$!
-sleep 1;
-
-check_tcp_udp_sockets_are_closed $SERIVCE_PID
-
-# Start the client
-export VSOMEIP_APPLICATION_NAME=local_payload_test_client
-export VSOMEIP_CONFIGURATION=local_payload_test_client.json
-./payload_test_client &
-CLIENT_PID=$!
-
-check_tcp_udp_sockets_are_closed $SERIVCE_PID
-check_tcp_udp_sockets_are_closed $CLIENT_PID
-
-# Wait until client and service are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-# Check if client and server both exited sucessfully and the service didnt't
-# have any open tcp/udp sockets
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/payload_tests/payload_test_client.cpp b/test/payload_tests/payload_test_client.cpp
deleted file mode 100644
index 65dbec7..0000000
--- a/test/payload_tests/payload_test_client.cpp
+++ /dev/null
@@ -1,415 +0,0 @@
-// Copyright (C) 2015-2017 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 "payload_test_client.hpp"
-
-enum class payloadsize
- : std::uint8_t
- {
- UDS, TCP, UDP, USER_SPECIFIED
-};
-
-// this variables are changed via cmdline parameters
-static bool use_tcp = false;
-static bool call_service_sync = true;
-static std::uint32_t sliding_window_size = vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS;
-static payloadsize max_payload_size = payloadsize::UDS;
-static bool shutdown_service_at_end = true;
-static std::uint32_t user_defined_max_payload;
-static std::uint32_t number_of_messages_to_send = 0;
-
-payload_test_client::payload_test_client(
- bool _use_tcp,
- bool _call_service_sync,
- std::uint32_t _sliding_window_size) :
- app_(vsomeip::runtime::get()->create_application()),
- request_(vsomeip::runtime::get()->create_request(_use_tcp)),
- call_service_sync_(_call_service_sync),
- sliding_window_size_(_sliding_window_size),
- blocked_(false),
- is_available_(false),
- number_of_messages_to_send_(number_of_messages_to_send ? number_of_messages_to_send : vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS),
- number_of_sent_messages_(0),
- number_of_sent_messages_total_(0),
- number_of_acknowledged_messages_(0),
- current_payload_size_(1),
- all_msg_acknowledged_(false),
- sender_(std::bind(&payload_test_client::run, this))
-{
-}
-
-bool payload_test_client::init()
-{
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
-
- app_->register_state_handler(
- std::bind(&payload_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(&payload_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(&payload_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- return true;
-}
-
-void payload_test_client::start()
-{
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void payload_test_client::stop()
-{
- VSOMEIP_INFO << "Stopping...";
- // shutdown the service
- if(shutdown_service_at_end)
- {
- shutdown_service();
- }
- app_->clear_all_handler();
-}
-
-void payload_test_client::shutdown_service()
-{
- 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_SHUTDOWN);
- app_->send(request_,true);
-}
-
-void payload_test_client::join_sender_thread()
-{
- sender_.join();
-}
-
-void payload_test_client::on_state(vsomeip::state_type_e _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);
- }
-}
-
-void payload_test_client::on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available)
-{
- VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0') << std::hex
- << _service << "." << _instance << "] is "
- << (_is_available ? "available." : "NOT available.");
-
- if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service
- && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance)
- {
- if(is_available_ && !_is_available)
- {
- is_available_ = false;
- }
- else if(_is_available && !is_available_)
- {
- is_available_ = true;
- send();
- }
- }
-}
-
-void payload_test_client::on_message(const std::shared_ptr<vsomeip::message>& _response)
-{
- number_of_acknowledged_messages_++;
-
- ASSERT_EQ(_response->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID);
- ASSERT_EQ(_response->get_instance(), vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-
- if(call_service_sync_)
- {
- // We notify the sender thread every time a message was acknowledged
- {
- std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_);
- all_msg_acknowledged_ = true;
- }
- all_msg_acknowledged_cv_.notify_one();
- }
- else
- {
- // We notify the sender thread only if all sent messages have been acknowledged
- if(number_of_acknowledged_messages_ == number_of_messages_to_send_)
- {
- std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_);
- number_of_acknowledged_messages_ = 0;
- all_msg_acknowledged_ = true;
- all_msg_acknowledged_cv_.notify_one();
- }
- else if(number_of_acknowledged_messages_ % sliding_window_size == 0)
- {
- std::lock_guard<std::mutex> lk(all_msg_acknowledged_mutex_);
- all_msg_acknowledged_ = true;
- all_msg_acknowledged_cv_.notify_one();
- }
- }
-}
-
-void payload_test_client::send()
-{
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
-}
-
-void payload_test_client::run()
-{
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- {
- condition_.wait(its_lock);
- }
-
- 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);
-
- // lock the mutex
- std::unique_lock<std::mutex> lk(all_msg_acknowledged_mutex_);
-
- std::uint32_t max_allowed_payload = get_max_allowed_payload();
-
- std::shared_ptr<vsomeip::payload> payload = vsomeip::runtime::get()->create_payload();
- std::vector<vsomeip::byte_t> payload_data;
- bool reached_peak = false;
- for(;;)
- {
- payload_data.assign(current_payload_size_ , vsomeip_test::PAYLOAD_TEST_DATA);
- payload->set_data(payload_data);
- request_->set_payload(payload);
-
- watch_.reset();
- watch_.start();
-
- call_service_sync_ ? send_messages_sync(lk) : send_messages_async(lk);
-
- watch_.stop();
- print_throughput();
-
- // Increase array size for next iteration
- if(!reached_peak) {
- current_payload_size_ *= 2;
- } else {
- current_payload_size_ /= 2;
- }
-
- if(!reached_peak && current_payload_size_ > max_allowed_payload)
- {
- current_payload_size_ = max_allowed_payload;
- reached_peak = true;
- } else if(reached_peak && current_payload_size_ <= 1) {
- break;
- }
- }
- blocked_ = false;
-
- stop();
- std::thread t1([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));});
- t1.join();
- app_->stop();
- std::thread t([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));});
- t.join();
-}
-
-
-std::uint32_t payload_test_client::get_max_allowed_payload()
-{
- std::uint32_t payload;
- switch (max_payload_size)
- {
- case payloadsize::UDS:
- // TODO
- payload = 1024 * 32 - 16;
- break;
- case payloadsize::TCP:
- // TODO
- payload = 4095 - 16;
- break;
- case payloadsize::UDP:
- payload = VSOMEIP_MAX_UDP_MESSAGE_SIZE - 16;
- break;
- case payloadsize::USER_SPECIFIED:
- payload = user_defined_max_payload;
- break;
- default:
- payload = VSOMEIP_MAX_LOCAL_MESSAGE_SIZE;
- break;
- }
- return payload;
-}
-
-void payload_test_client::send_messages_sync(std::unique_lock<std::mutex>& lk)
-{
- for (number_of_sent_messages_ = 0;
- number_of_sent_messages_ < number_of_messages_to_send_;
- number_of_sent_messages_++, number_of_sent_messages_total_++)
- {
- app_->send(request_, true);
- // wait until the send messages has been acknowledged
- // as long we wait lk is released; after wait returns lk is reacquired
- all_msg_acknowledged_cv_.wait(lk, [&]
- { return all_msg_acknowledged_;});
- // Reset condition variable (lk is locked again here)
- all_msg_acknowledged_ = false;
- }
-}
-
-void payload_test_client::send_messages_async(std::unique_lock<std::mutex>& lk)
-{
- for (number_of_sent_messages_ = 0;
- number_of_sent_messages_ < number_of_messages_to_send_;
- number_of_sent_messages_++, number_of_sent_messages_total_++)
- {
- app_->send(request_, true);
-
- if((number_of_sent_messages_+1) % sliding_window_size == 0)
- {
- // wait until all send messages have been acknowledged
- // as long we wait lk is released; after wait returns lk is reacquired
- all_msg_acknowledged_cv_.wait(lk, [&]
- { return all_msg_acknowledged_;});
-
- // Reset condition variable
- all_msg_acknowledged_ = false;
- }
- }
-}
-
-void payload_test_client::print_throughput()
-{
- constexpr std::uint32_t usec_per_sec = 1000000;
- stop_watch::usec_t time_needed = watch_.get_total_elapsed_microseconds();
- stop_watch::usec_t time_per_message = time_needed / number_of_sent_messages_;
- std::double_t calls_per_sec = number_of_sent_messages_
- * (usec_per_sec / static_cast<double>(time_needed));
- std::double_t mbyte_per_sec = ((number_of_sent_messages_
- * current_payload_size_)
- / (static_cast<double>(time_needed) / usec_per_sec)) / (1024*1024);
-
- VSOMEIP_INFO<< "[ Payload Test ] : :"
- << "Payload size [byte]: " << std::dec << std::setw(8) << std::setfill('0') << current_payload_size_
- << " Messages sent: " << std::dec << std::setw(8) << std::setfill('0') << number_of_sent_messages_
- << " Meantime/message [usec]: " << std::dec << std::setw(8) << std::setfill('0') << time_per_message
- << " Calls/sec: " << std::dec << std::setw(8) << std::setfill('0') << calls_per_sec
- << " MiB/sec: " << std::dec << std::setw(8) << std::setfill('0') << mbyte_per_sec;
-}
-
-TEST(someip_payload_test, send_different_payloads)
-{
- payload_test_client test_client_(use_tcp, call_service_sync, sliding_window_size);
- if (test_client_.init()) {
- test_client_.start();
- test_client_.join_sender_thread();
- }
-}
-
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- std::string tcp_enable("--tcp");
- std::string udp_enable("--udp");
- std::string sync_enable("--sync");
- std::string async_enable("--async");
- std::string sliding_window_size_param("--sliding-window-size");
- std::string max_payload_size_param("--max-payload-size");
- std::string shutdown_service_disable_param("--dont-shutdown-service");
- std::string numbers_of_messages("--number-of-messages");
- std::string help("--help");
-
- int i = 1;
- while (i < argc)
- {
- if(tcp_enable == argv[i])
- {
- use_tcp = true;
- }
- else if(udp_enable == argv[i])
- {
- use_tcp = false;
- }
- else if(sync_enable == argv[i])
- {
- call_service_sync = true;
- }
- else if(async_enable == argv[i])
- {
- call_service_sync = false;
- }
- else if(sliding_window_size_param == argv[i] && i + 1 < argc)
- {
- i++;
- std::stringstream converter(argv[i]);
- converter >> sliding_window_size;
- }
- else if(max_payload_size_param == argv[i] && i + 1 < argc)
- {
- i++;
- if(std::string("UDS") == argv[i])
- {
- max_payload_size = payloadsize::UDS;
- }
- else if(std::string("TCP") == argv[i])
- {
- max_payload_size = payloadsize::TCP;
- }
- else if(std::string("UDP") == argv[i])
- {
- max_payload_size = payloadsize::UDP;
- }
- else {
- max_payload_size = payloadsize::USER_SPECIFIED;
- std::stringstream converter(argv[i]);
- converter >> user_defined_max_payload;
- }
- }
- else if (numbers_of_messages == argv[i]) {
- i++;
- std::stringstream converter(argv[i]);
- converter >> number_of_messages_to_send;
- }
- else if(shutdown_service_disable_param == argv[i])
- {
- shutdown_service_at_end = false;
- }
- else if(help == argv[i])
- {
- VSOMEIP_INFO << "Parameters:\n"
- << "--tcp: Send messages via TCP\n"
- << "--udp: Send messages via UDP (default)\n"
- << "--sync: Wait for acknowledge before sending next message (default)\n"
- << "--async: Send multiple messages w/o waiting for"
- " acknowledge of service\n"
- << "--sliding-window-size: Number of messages to send before waiting "
- "for acknowledge of service. Default: " << sliding_window_size << "\n"
- << "--max-payload-size: limit the maximum payloadsize of send requests. One of {"
- "UDS (=" << VSOMEIP_MAX_LOCAL_MESSAGE_SIZE << "byte), "
- "UDP (=" << VSOMEIP_MAX_UDP_MESSAGE_SIZE << "byte), "
- "TCP (=" << VSOMEIP_MAX_TCP_MESSAGE_SIZE << "byte)}, default: UDS\n"
- << "--dont-shutdown-service: Don't shutdown the service upon "
- "finishing of the payload test\n"
- << "--number-of-messages: Number of messages to send per payload size iteration\n"
- << "--help: print this help";
- }
- i++;
- }
-
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/payload_tests/payload_test_client.hpp b/test/payload_tests/payload_test_client.hpp
deleted file mode 100644
index 2757d00..0000000
--- a/test/payload_tests/payload_test_client.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (C) 2015-2017 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 PAYLOADTESTCLIENT_HPP_
-#define PAYLOADTESTCLIENT_HPP_
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <cmath>
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-
-#include "../someip_test_globals.hpp"
-
-#include "stopwatch.hpp"
-
-class payload_test_client
-{
-public:
- payload_test_client(bool _use_tcp, bool _call_service_sync, std::uint32_t _sliding_window_size);
- bool init();
- void start();
- void stop();
- void join_sender_thread();
- 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<vsomeip::message> &_response);
- void send();
- void run();
-
-private:
- void print_throughput();
- void send_messages_sync(std::unique_lock<std::mutex>& lk);
- void send_messages_async(std::unique_lock<std::mutex>& lk);
- void shutdown_service();
- std::uint32_t get_max_allowed_payload();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- std::shared_ptr<vsomeip::message> request_;
- bool call_service_sync_;
- std::uint32_t sliding_window_size_;
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- bool is_available_;
- const std::uint32_t number_of_messages_to_send_;
- std::uint32_t number_of_sent_messages_;
- std::uint32_t number_of_sent_messages_total_;
- std::uint32_t number_of_acknowledged_messages_;
-
- std::uint32_t current_payload_size_;
-
- stop_watch watch_;
-
- bool all_msg_acknowledged_;
- std::mutex all_msg_acknowledged_mutex_;
- std::condition_variable all_msg_acknowledged_cv_;
-
- std::thread sender_;
-
-};
-
-#endif /* PAYLOADTESTCLIENT_HPP_ */
diff --git a/test/payload_tests/payload_test_service.cpp b/test/payload_tests/payload_test_service.cpp
deleted file mode 100644
index bb174cd..0000000
--- a/test/payload_tests/payload_test_service.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright (C) 2015-2017 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 "payload_test_service.hpp"
-
-// this variables are changed via cmdline parameters
-static bool use_tcp = false;
-static bool check_payload = true;
-
-payload_test_service::payload_test_service(bool _use_tcp) :
- app_(vsomeip::runtime::get()->create_application()),
- is_registered_(false),
- use_tcp_(_use_tcp),
- blocked_(false),
- number_of_received_messages_(0),
- offer_thread_(std::bind(&payload_test_service::run, this))
-{
-}
-
-bool payload_test_service::init()
-{
- std::lock_guard<std::mutex> 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(&payload_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN,
- std::bind(&payload_test_service::on_message_shutdown, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&payload_test_service::on_state, this,
- std::placeholders::_1));
- return true;
-}
-
-void payload_test_service::start()
-{
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void payload_test_service::stop()
-{
- VSOMEIP_INFO << "Stopping...";
- app_->clear_all_handler();
- app_->stop();
-}
-
-void payload_test_service::join_offer_thread()
-{
- offer_thread_.join();
-}
-
-void payload_test_service::offer()
-{
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void payload_test_service::stop_offer()
-{
- app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void payload_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<std::mutex> its_lock(mutex_);
- blocked_ = true;
- // "start" the run method thread
- condition_.notify_one();
- }
- }
- else
- {
- is_registered_ = false;
- }
-}
-
-void payload_test_service::on_message(const std::shared_ptr<vsomeip::message>& _request)
-{
- number_of_received_messages_++;
- if(number_of_received_messages_ % vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS == 0)
- {
- 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() << "] payload size [byte]:"
- << std::dec << _request->get_payload()->get_length();
- }
-
- ASSERT_EQ(vsomeip_test::TEST_SERVICE_SERVICE_ID, _request->get_service());
- ASSERT_EQ(vsomeip_test::TEST_SERVICE_METHOD_ID, _request->get_method());
-
- // Check the protocol version this shall be set to 0x01 according to the spec.
- // TR_SOMEIP_00052
- ASSERT_EQ(0x01, _request->get_protocol_version());
- // Check the message type this shall be 0xx (REQUEST) according to the spec.
- // TR_SOMEIP_00055
- ASSERT_EQ(vsomeip::message_type_e::MT_REQUEST, _request->get_message_type());
-
- if (check_payload) {
- std::shared_ptr<vsomeip::payload> pl = _request->get_payload();
- vsomeip::byte_t* pl_ptr = pl->get_data();
- for (vsomeip::length_t i = 0; i < pl->get_length(); i++)
- {
- ASSERT_EQ(vsomeip_test::PAYLOAD_TEST_DATA, *(pl_ptr+i));
- }
- }
-
- // send response
- std::shared_ptr<vsomeip::message> its_response =
- vsomeip::runtime::get()->create_response(_request);
-
- app_->send(its_response, true);
-}
-
-void payload_test_service::on_message_shutdown(
- const std::shared_ptr<vsomeip::message>& _request)
-{
- (void)_request;
- VSOMEIP_INFO << "Shutdown method was called, going down now.";
- stop();
-}
-
-void payload_test_service::run()
-{
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- condition_.wait(its_lock);
-
- offer();
-}
-
-TEST(someip_payload_test, send_response_for_every_request)
-{
- payload_test_service test_service(use_tcp);
- if (test_service.init()) {
- test_service.start();
- test_service.join_offer_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- std::string help("--help");
- std::string check("--do-not-check-payload");
-
- int i = 1;
- while (i < argc)
- {
- if(help == argv[i])
- {
- VSOMEIP_INFO << "Parameters:\n"
- << "--help: print this help\n"
- << "--do-not-check-payload: Don't verify payload data "
- << "-> Use this flag for performance measurements!";
- } else if (check == argv[i]) {
- check_payload = false;
- }
- i++;
- }
-
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/payload_tests/payload_test_service.hpp b/test/payload_tests/payload_test_service.hpp
deleted file mode 100644
index 32ae1e7..0000000
--- a/test/payload_tests/payload_test_service.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2015-2017 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 PAYLOADTESTSERVICE_HPP_
-#define PAYLOADTESTSERVICE_HPP_
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-
-#include "../someip_test_globals.hpp"
-
-class payload_test_service
-{
-public:
- payload_test_service(bool _use_tcp);
- 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<vsomeip::message> &_request);
- void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request);
- void run();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
- bool use_tcp_;
- bool use_static_routing_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- std::uint32_t number_of_received_messages_;
- std::thread offer_thread_;
-};
-
-#endif /* PAYLOADTESTSERVICE_HPP_ */
diff --git a/test/payload_tests/stopwatch.cpp b/test/payload_tests/stopwatch.cpp
deleted file mode 100644
index 83506f4..0000000
--- a/test/payload_tests/stopwatch.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2015-2017 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 "stopwatch.hpp"
-
-#include <cassert>
-#include <ctime>
-
-
-#define USEC_PER_SEC 1000000ULL
-#define NSEC_PER_USEC 1000ULL
-
-
-stop_watch::usec_t stop_watch::get_total_elapsed_microseconds() const {
- usec_t elapsed = total_elapsed_;
-
- if (started_)
- elapsed += get_elapsed();
-
- return elapsed;
-}
-
-stop_watch::usec_t stop_watch::get_total_elapsed_seconds() const {
- return get_total_elapsed_microseconds() / USEC_PER_SEC;
-}
-
-stop_watch::usec_t stop_watch::now() {
- struct timespec ts;
-
- const int ret = clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
- assert(!ret);
- static_cast<void>(ret); // prevent warning in release build
-
- return (usec_t) ts.tv_sec * USEC_PER_SEC + (usec_t) ts.tv_nsec / NSEC_PER_USEC;
-}
-
diff --git a/test/payload_tests/stopwatch.hpp b/test/payload_tests/stopwatch.hpp
deleted file mode 100644
index 5917e12..0000000
--- a/test/payload_tests/stopwatch.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (C) 2015-2017 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 STOP_WATCH_H_
-#define STOP_WATCH_H_
-
-#include <cstdint>
-
-
-class stop_watch
-{
-public:
- typedef uint64_t usec_t;
-
- stop_watch() :
- started_(false),
- start_time_point_(0),
- total_elapsed_(0)
- {
- }
-
- inline void reset()
- {
- started_ = false;
- total_elapsed_ = 0;
- }
-
- inline void start()
- {
- start_time_point_ = now();
- started_ = true;
- }
-
- inline void stop()
- {
- total_elapsed_ += get_elapsed();
- started_ = false;
- }
-
- usec_t get_total_elapsed_microseconds() const;
- usec_t get_total_elapsed_seconds() const;
-
-private:
- inline usec_t get_elapsed() const
- {
- return now() - start_time_point_;
- }
-
- static usec_t now();
-
- bool started_;
- usec_t start_time_point_;
- usec_t total_elapsed_;
-};
-
-#endif // STOP_WATCH_H_
diff --git a/test/pending_subscription_tests/conf/pending_subscription_test_master.json.in b/test/pending_subscription_tests/conf/pending_subscription_test_master.json.in
deleted file mode 100644
index 5c363a7..0000000
--- a/test/pending_subscription_tests/conf/pending_subscription_test_master.json.in
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"info",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications" :
- [
- {
- "name" : "pending_subscription_test_service",
- "id" : "0xCAFE",
- "max_dispatch_time" : "1000"
- }
- ],
- "services":
- [
- {
- "service":"0x1122",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"vsomeipd",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.23.1",
- "port":"30490",
- "protocol":"udp",
- "cyclic_offer_delay" : "1000"
- }
-} \ No newline at end of file
diff --git a/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in b/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in
deleted file mode 100755
index 0a3dd17..0000000
--- a/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-FAIL=0
-
-if [ $# -lt 1 ]
-then
- echo "Please pass a test mode to this script."
- echo "For example: $0 SUSCRIBE"
- echo "Valid subscription types include:"
- echo " [SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE_NACK]"
- exit 1
-fi
-TESTMODE=$1
-export VSOMEIP_CONFIGURATION=pending_subscription_test_master.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-# Start the services
-./pending_subscription_test_service $1 &
-PID_SERIVCE=$!
-
-sleep 1
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "Waiting for 5s"
- sleep 5
- echo "starting offer test on slave LXC offer_test_external_slave_starter.sh"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./pending_subscription_test_sd_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE\"" &
- echo "remote ssh pid: $!"
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name otems --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && sleep 10; ./pending_subscription_test_sd_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE" &
-else
-cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** pending_subscription_test_sd_msg_sender @TEST_IP_MASTER@ @TEST_IP_SLAVE@ $TESTMODE
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** pending_subscription_test_master.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# Wait until all clients and services are finished
-for job in $PID_SERIVCE
-do
- # Fail gets incremented if a client exits with a non-zero exit code
- echo "waiting for $job"
- wait $job || FAIL=$(($FAIL+1))
-done
-
-# kill the services
-kill $PID_VSOMEIPD
-sleep 1
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop otems
- docker rm otems
-fi
-
-# Check if everything went well
-exit $FAIL
diff --git a/test/pending_subscription_tests/pending_subscription_test_globals.hpp b/test/pending_subscription_tests/pending_subscription_test_globals.hpp
deleted file mode 100644
index 8daf91a..0000000
--- a/test/pending_subscription_tests/pending_subscription_test_globals.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (C) 2014-2017 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 PENDING_SUBSCRIPTION_TEST_GLOBALS_HPP_
-#define PENDING_SUBSCRIPTION_TEST_GLOBALS_HPP_
-
-namespace pending_subscription_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
- vsomeip::event_t event_id;
- vsomeip::eventgroup_t eventgroup_id;
- vsomeip::method_t shutdown_method_id;
- vsomeip::method_t notify_method_id;
-};
-
-struct service_info service = { 0x1122, 0x1, 0x1111, 0x1111, 0x1000, 0x1404, 0x4242 };
-
-enum test_mode_e {
- SUBSCRIBE,
- SUBSCRIBE_UNSUBSCRIBE,
- UNSUBSCRIBE,
- SUBSCRIBE_UNSUBSCRIBE_NACK
-};
-
-}
-
-#endif /* PENDING_SUBSCRIPTION_TEST_GLOBALS_HPP_ */
diff --git a/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp b/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp
deleted file mode 100644
index b5325ab..0000000
--- a/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp
+++ /dev/null
@@ -1,826 +0,0 @@
-// Copyright (C) 2015-2017 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 <iostream>
-#include <memory>
-#include <thread>
-#include <chrono>
-#include <cstring>
-#include <future>
-
-#include <gtest/gtest.h>
-
-#include <boost/asio.hpp>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../../implementation/utility/include/byteorder.hpp"
-#include "../../implementation/message/include/deserializer.hpp"
-#include "../../implementation/service_discovery/include/service_discovery.hpp"
-#include "../../implementation/service_discovery/include/message_impl.hpp"
-#include "../../implementation/service_discovery/include/constants.hpp"
-#include "../../implementation/service_discovery/include/enumeration_types.hpp"
-#include "../../implementation/service_discovery/include/eventgroupentry_impl.hpp"
-#include "../../implementation/message/include/message_impl.hpp"
-#include "pending_subscription_test_globals.hpp"
-
-static char* remote_address;
-static char* local_address;
-
-class pending_subscription : public ::testing::Test {
-public:
- pending_subscription() :
- work_(std::make_shared<boost::asio::io_service::work>(io_)),
- io_thread_(std::bind(&pending_subscription::io_run, this)) {}
-protected:
-
- void TearDown() {
- work_.reset();
- io_thread_.join();
- io_.stop();
- }
-
- void io_run() {
- io_.run();
- }
-
- boost::asio::io_service io_;
- std::shared_ptr<boost::asio::io_service::work> work_;
- std::thread io_thread_;
-};
-
-TEST_F(pending_subscription, send_multiple_subscriptions)
-{
- std::promise<bool> trigger_notifications;
-
- boost::asio::ip::udp::socket udp_socket(io_,
- boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490));
- std::thread receive_thread([&](){
- std::atomic<bool> keep_receiving(true);
- std::function<void()> receive;
- std::vector<std::uint8_t> receive_buffer(4096);
- std::vector<vsomeip::event_t> its_received_events;
-
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
- if (error) {
- keep_receiving = false;
- ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #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]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(2u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- EXPECT_EQ(3u, e->get_ttl());
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
- its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
- }
- }
- EXPECT_EQ(0u, sd_msg.get_options().size());
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- if (its_received_events.size() == 2) {
- EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
- }
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
- }
- }
-
- static int called = 0;
- if (++called == 15) { // all subscribeAcks received
- trigger_notifications.set_value(true);
- }
- if (called == 18) { // events were received as well
- keep_receiving = false;
- }
- if (!error && keep_receiving) {
- receive();
- }
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(keep_receiving) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- });
-
- std::thread send_thread([&]() {
- try {
- std::uint8_t its_offer_service_message[] = {
- 0xff, 0xff, 0x81, 0x00,
- 0x00, 0x00, 0x00, 0x40, // length
- 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x01, 0x02, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, // length entries array
- 0x06, 0x00, 0x00, 0x10,
- 0x11, 0x22, 0x00, 0x01, // service / instance
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x10, 0x00, // eventgroup
- 0x06, 0x00, 0x00, 0x10,
- 0x11, 0x22, 0x00, 0x01, // service / instance
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x10, 0x01, // eventgroup 2
- 0x00, 0x00, 0x00, 0x0c, // length options array
- 0x00, 0x09, 0x04, 0x00,
- 0xff, 0xff, 0xff, 0xff, // ip address
- 0x00, 0x11, 0x77, 0x1a
- };
- boost::asio::ip::address its_local_address =
- boost::asio::ip::address::from_string(std::string(local_address));
- std::memcpy(&its_offer_service_message[64], &its_local_address.to_v4().to_bytes()[0], 4);
-
- boost::asio::ip::udp::socket::endpoint_type target_sd(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30490);
- for (int var = 0; var < 15; ++var) {
- udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd);
- ++its_offer_service_message[11];
- }
-
-
- if (std::future_status::timeout == trigger_notifications.get_future().wait_for(std::chrono::seconds(10))) {
- ADD_FAILURE() << "Didn't receive all SubscribeAcks within time";
- } else {
- // call notify method
- std::uint8_t trigger_notifications_call[] = {
- 0x11, 0x22, 0x42, 0x42,
- 0x00, 0x00, 0x00, 0x08,
- 0x22, 0x22, 0x00, 0x01,
- 0x01, 0x00, 0x01, 0x00 };
- boost::asio::ip::udp::socket::endpoint_type target_service(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30001);
- udp_socket.send_to(boost::asio::buffer(trigger_notifications_call), target_service);
- }
-
- // call shutdown method
- std::uint8_t shutdown_call[] = {
- 0x11, 0x22, 0x14, 0x04,
- 0x00, 0x00, 0x00, 0x08,
- 0x22, 0x22, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x00 };
- boost::asio::ip::udp::socket::endpoint_type target_service(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30001);
- udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service);
- } catch (...) {
- ASSERT_FALSE(true);
- }
-
- });
-
- send_thread.join();
- receive_thread.join();
-}
-
-TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe)
-{
- std::promise<bool> trigger_notifications;
-
- boost::asio::ip::udp::socket udp_socket(io_,
- boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490));
- std::thread receive_thread([&](){
- const std::uint32_t expected_acks(8);
- std::atomic<std::uint32_t> acks_received(0);
-
- const std::uint32_t expected_responses(1);
- std::atomic<std::uint32_t> responses_received(0);
-
- const std::uint32_t expected_notifications(2);
- std::atomic<std::uint32_t> notifications_received(0);
-
- bool triggered_notifications(false);
-
- std::function<void()> receive;
- std::vector<std::uint8_t> receive_buffer(4096);
- std::vector<vsomeip::event_t> its_received_events;
-
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
- if (error) {
- acks_received = expected_acks;
- responses_received = expected_responses;
- ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #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]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(2u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- EXPECT_EQ(16u, e->get_ttl());
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
- its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
- }
- }
- EXPECT_EQ(0u, sd_msg.get_options().size());
- acks_received++;
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- responses_received++;
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- if (its_received_events.size() == 2) {
- EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
- }
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
- notifications_received++;
- }
- }
-
-
- if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received
- trigger_notifications.set_value(true);
- triggered_notifications = true;
- }
-
- if (!error && (acks_received != expected_acks ||
- responses_received != expected_responses ||
- notifications_received != expected_notifications)) {
- receive();
- }
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(acks_received < expected_acks ||
- responses_received < expected_responses ||
- notifications_received < expected_notifications) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- EXPECT_EQ(expected_acks, acks_received);
- EXPECT_EQ(expected_responses, responses_received);
- EXPECT_EQ(expected_notifications, notifications_received);
- });
-
- std::thread send_thread([&]() {
- try {
- std::uint8_t its_offer_service_message[] = {
- 0xff, 0xff, 0x81, 0x00,
- 0x00, 0x00, 0x00, 0x40, // length
- 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x01, 0x02, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, // length entries array
- 0x06, 0x00, 0x00, 0x10,
- 0x11, 0x22, 0x00, 0x01, // service / instance
- 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL
- 0x00, 0x00, 0x10, 0x00, // eventgroup
- 0x06, 0x00, 0x00, 0x10,
- 0x11, 0x22, 0x00, 0x01, // service / instance
- 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL
- 0x00, 0x00, 0x10, 0x01, // eventgroup 2
- 0x00, 0x00, 0x00, 0x0c, // length options array
- 0x00, 0x09, 0x04, 0x00,
- 0xff, 0xff, 0xff, 0xff, // ip address
- 0x00, 0x11, 0x77, 0x1a
- };
-
- boost::asio::ip::address its_local_address =
- boost::asio::ip::address::from_string(std::string(local_address));
- std::memcpy(&its_offer_service_message[64], &its_local_address.to_v4().to_bytes()[0], 4);
-
- boost::asio::ip::udp::socket::endpoint_type target_sd(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30490);
- for (int var = 0; var < 15; ++var) {
- udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd);
- ++its_offer_service_message[11];
- if (its_offer_service_message[11] % 2) {
- its_offer_service_message[35] = 16;
- its_offer_service_message[51] = 16;
- } else {
- its_offer_service_message[35] = 0;
- its_offer_service_message[51] = 0;
- }
- }
-
- if (std::future_status::timeout == trigger_notifications.get_future().wait_for(std::chrono::seconds(10))) {
- ADD_FAILURE() << "Didn't receive all SubscribeAcks within time";
- } else {
- // call notify method
- std::uint8_t trigger_notifications_call[] = {
- 0x11, 0x22, 0x42, 0x42,
- 0x00, 0x00, 0x00, 0x08,
- 0x22, 0x22, 0x00, 0x01,
- 0x01, 0x00, 0x01, 0x00 };
- boost::asio::ip::udp::socket::endpoint_type target_service(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30001);
- udp_socket.send_to(boost::asio::buffer(trigger_notifications_call), target_service);
- }
-
- // call shutdown method
- std::uint8_t shutdown_call[] = {
- 0x11, 0x22, 0x14, 0x04,
- 0x00, 0x00, 0x00, 0x08,
- 0x22, 0x22, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x00 };
- boost::asio::ip::udp::socket::endpoint_type target_service(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30001);
- udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service);
- } catch (...) {
- ASSERT_FALSE(true);
- }
-
- });
-
- send_thread.join();
- receive_thread.join();
-}
-
-TEST_F(pending_subscription, send_multiple_unsubscriptions)
-{
- std::promise<bool> trigger_notifications;
-
- boost::asio::ip::udp::socket udp_socket(io_,
- boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490));
- std::thread receive_thread([&](){
- const std::uint32_t expected_acks(2);
- std::atomic<std::uint32_t> acks_received(0);
-
- const std::uint32_t expected_responses(1);
- std::atomic<std::uint32_t> responses_received(0);
-
- const std::uint32_t expected_notifications(2);
- std::atomic<std::uint32_t> notifications_received(0);
-
- bool triggered_notifications(false);
-
- std::function<void()> receive;
- std::vector<std::uint8_t> receive_buffer(4096);
- std::vector<vsomeip::event_t> its_received_events;
-
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
- if (error) {
- acks_received = expected_acks;
- responses_received = expected_responses;
- ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #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]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(2u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- EXPECT_EQ(16u, e->get_ttl());
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
- its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
- }
- }
- EXPECT_EQ(0u, sd_msg.get_options().size());
- acks_received++;
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- responses_received++;
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- if (its_received_events.size() == 2) {
- EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
- }
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
- notifications_received++;
- }
- }
-
-
- if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received
- trigger_notifications.set_value(true);
- triggered_notifications = true;
- }
-
- if (!error && (acks_received != expected_acks ||
- responses_received != expected_responses ||
- notifications_received != expected_notifications)) {
- receive();
- }
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(acks_received < expected_acks ||
- responses_received < expected_responses ||
- notifications_received < expected_notifications) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- EXPECT_EQ(expected_acks, acks_received);
- EXPECT_EQ(expected_responses, responses_received);
- EXPECT_EQ(expected_notifications, notifications_received);
- });
-
- std::thread send_thread([&]() {
- try {
- std::uint8_t its_offer_service_message[] = {
- 0xff, 0xff, 0x81, 0x00,
- 0x00, 0x00, 0x00, 0x40, // length
- 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x01, 0x02, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, // length entries array
- 0x06, 0x00, 0x00, 0x10,
- 0x11, 0x22, 0x00, 0x01, // service / instance
- 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL
- 0x00, 0x00, 0x10, 0x00, // eventgroup
- 0x06, 0x00, 0x00, 0x10,
- 0x11, 0x22, 0x00, 0x01, // service / instance
- 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL
- 0x00, 0x00, 0x10, 0x01, // eventgroup 2
- 0x00, 0x00, 0x00, 0x0c, // length options array
- 0x00, 0x09, 0x04, 0x00,
- 0xff, 0xff, 0xff, 0xff, // ip address
- 0x00, 0x11, 0x77, 0x1a
- };
-
- boost::asio::ip::address its_local_address =
- boost::asio::ip::address::from_string(std::string(local_address));
- std::memcpy(&its_offer_service_message[64], &its_local_address.to_v4().to_bytes()[0], 4);
-
- boost::asio::ip::udp::socket::endpoint_type target_sd(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30490);
- for (int var = 0; var < 15; ++var) {
- if (its_offer_service_message[11] == 15 || its_offer_service_message[11] == 0x1) {
- its_offer_service_message[35] = 16;
- its_offer_service_message[51] = 16;
- } else {
- its_offer_service_message[35] = 0;
- its_offer_service_message[51] = 0;
- }
- udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd);
- ++its_offer_service_message[11];
- }
-
- if (std::future_status::timeout == trigger_notifications.get_future().wait_for(std::chrono::seconds(10))) {
- ADD_FAILURE() << "Didn't receive all SubscribeAcks within time";
- } else {
- // call notify method
- std::uint8_t trigger_notifications_call[] = {
- 0x11, 0x22, 0x42, 0x42,
- 0x00, 0x00, 0x00, 0x08,
- 0x22, 0x22, 0x00, 0x01,
- 0x01, 0x00, 0x01, 0x00 };
- boost::asio::ip::udp::socket::endpoint_type target_service(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30001);
- udp_socket.send_to(boost::asio::buffer(trigger_notifications_call), target_service);
- }
-
- // call shutdown method
- std::uint8_t shutdown_call[] = {
- 0x11, 0x22, 0x14, 0x04,
- 0x00, 0x00, 0x00, 0x08,
- 0x22, 0x22, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x00 };
- boost::asio::ip::udp::socket::endpoint_type target_service(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30001);
- udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service);
- } catch (...) {
- ASSERT_FALSE(true);
- }
-
- });
-
- send_thread.join();
- receive_thread.join();
-}
-
-TEST_F(pending_subscription, send_alternating_subscribe_nack_unsubscribe)
-{
- std::promise<bool> trigger_notifications;
-
- boost::asio::ip::udp::socket udp_socket(io_,
- boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490));
- std::thread receive_thread([&](){
- const std::uint32_t expected_acks(8);
- std::atomic<std::uint32_t> acks_received(0);
-
- const std::uint32_t expected_nacks(8);
- std::atomic<std::uint32_t> nacks_received(0);
-
- const std::uint32_t expected_responses(1);
- std::atomic<std::uint32_t> responses_received(0);
-
- const std::uint32_t expected_notifications(2);
- std::atomic<std::uint32_t> notifications_received(0);
-
- bool triggered_notifications(false);
-
- std::function<void()> receive;
- std::vector<std::uint8_t> receive_buffer(4096);
- std::vector<vsomeip::event_t> its_received_events;
-
- const std::function<void(const boost::system::error_code&, std::size_t)> receive_cbk = [&](
- const boost::system::error_code& error, std::size_t bytes_transferred) {
- if (error) {
- acks_received = expected_acks;
- responses_received = expected_responses;
- nacks_received = expected_nacks;
- ADD_FAILURE() << __func__ << " error: " << error.message();
- return;
- }
- #if 0
- std::stringstream str;
- for (size_t i = 0; i < bytes_transferred; i++) {
- str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " ";
- }
- std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl;
- #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]);
- if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) {
- vsomeip::sd::message_impl sd_msg;
- EXPECT_TRUE(sd_msg.deserialize(&its_deserializer));
- EXPECT_EQ(2u, sd_msg.get_entries().size());
- for (auto e : sd_msg.get_entries()) {
- EXPECT_TRUE(e->is_eventgroup_entry());
- EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type());
- if (e->get_ttl()) {
- EXPECT_EQ(16u, e->get_ttl());
- acks_received++;
- } else {
- EXPECT_EQ(0u, e->get_ttl());
- nacks_received++;
- }
- EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service());
- EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance());
- if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) {
- std::shared_ptr<vsomeip::sd::eventgroupentry_impl> its_casted_entry =
- std::static_pointer_cast<vsomeip::sd::eventgroupentry_impl>(e);
- EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id ||
- its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1);
- }
- }
- EXPECT_EQ(0u, sd_msg.get_options().size());
- } else { // non-sd-message
- vsomeip::message_impl msg;
- EXPECT_TRUE(msg.deserialize(&its_deserializer));
- if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) {
- EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method());
- EXPECT_EQ(0x2222, msg.get_client());
- responses_received++;
- } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
- its_received_events.push_back(msg.get_method());
- if (its_received_events.size() == 2) {
- EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]);
- EXPECT_EQ(static_cast<vsomeip::event_t>(pending_subscription_test::service.event_id + 1u), its_received_events[1]);
- }
- EXPECT_EQ(1u, msg.get_payload()->get_length());
- EXPECT_EQ(0xDD, *msg.get_payload()->get_data());
- EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service());
- EXPECT_EQ(0x0, msg.get_client());
- notifications_received++;
- }
- }
-
-
- if (!triggered_notifications && acks_received == expected_acks &&
- nacks_received == expected_nacks) { // all subscribeAcks received
- trigger_notifications.set_value(true);
- triggered_notifications = true;
- }
-
- if (!error && (acks_received != expected_acks ||
- responses_received != expected_responses ||
- notifications_received != expected_notifications ||
- nacks_received != expected_nacks)) {
- receive();
- }
- };
-
- receive = [&]() {
- udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()),
- receive_cbk);
- };
-
- receive();
- while(acks_received < expected_acks ||
- responses_received < expected_responses ||
- notifications_received < expected_notifications) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- EXPECT_EQ(expected_acks, acks_received);
- EXPECT_EQ(expected_responses, responses_received);
- EXPECT_EQ(expected_notifications, notifications_received);
- });
-
- std::thread send_thread([&]() {
- try {
- std::uint8_t its_offer_service_message[] = {
- 0xff, 0xff, 0x81, 0x00,
- 0x00, 0x00, 0x00, 0x40, // length
- 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x01, 0x02, 0x00,
- 0xc0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, // length entries array
- 0x06, 0x00, 0x00, 0x10,
- 0x11, 0x22, 0x00, 0x01, // service / instance
- 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL
- 0x00, 0x00, 0x10, 0x00, // eventgroup
- 0x06, 0x00, 0x00, 0x10,
- 0x11, 0x22, 0x00, 0x01, // service / instance
- 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL
- 0x00, 0x00, 0x10, 0x01, // eventgroup 2
- 0x00, 0x00, 0x00, 0x0c, // length options array
- 0x00, 0x09, 0x04, 0x00,
- 0xff, 0xff, 0xff, 0xff, // ip address
- 0x00, 0x11, 0x77, 0x1a
- };
-
- boost::asio::ip::address its_local_address =
- boost::asio::ip::address::from_string(std::string(local_address));
- std::memcpy(&its_offer_service_message[64], &its_local_address.to_v4().to_bytes()[0], 4);
-
- boost::asio::ip::udp::socket::endpoint_type target_sd(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30490);
- for (int var = 0; var < 15; ++var) {
- udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd);
- ++its_offer_service_message[11];
- if (its_offer_service_message[11] % 2) {
- its_offer_service_message[35] = 16;
- its_offer_service_message[51] = 16;
- } else {
- its_offer_service_message[35] = 0;
- its_offer_service_message[51] = 0;
- }
- }
-
- if (std::future_status::timeout == trigger_notifications.get_future().wait_for(std::chrono::seconds(10))) {
- ADD_FAILURE() << "Didn't receive all SubscribeAcks within time";
- } else {
- // call notify method
- std::uint8_t trigger_notifications_call[] = {
- 0x11, 0x22, 0x42, 0x42,
- 0x00, 0x00, 0x00, 0x08,
- 0x22, 0x22, 0x00, 0x01,
- 0x01, 0x00, 0x01, 0x00 };
- boost::asio::ip::udp::socket::endpoint_type target_service(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30001);
- udp_socket.send_to(boost::asio::buffer(trigger_notifications_call), target_service);
- }
-
- // call shutdown method
- std::uint8_t shutdown_call[] = {
- 0x11, 0x22, 0x14, 0x04,
- 0x00, 0x00, 0x00, 0x08,
- 0x22, 0x22, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x00 };
- boost::asio::ip::udp::socket::endpoint_type target_service(
- boost::asio::ip::address::from_string(std::string(remote_address)),
- 30001);
- udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service);
- } catch (...) {
- ASSERT_FALSE(true);
- }
-
- });
-
- send_thread.join();
- receive_thread.join();
-}
-
-
-#ifndef _WIN32
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 4) {
- std::cerr << "Please pass an target and local IP address and test mode to this binary like: "
- << argv[0] << " 10.0.3.1 10.0.3.202 SUBSCRIBE" << std::endl;
- std::cerr << "Testmodes are [SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE]" << std::endl;
- exit(1);
- }
- remote_address = argv[1];
- local_address = argv[2];
- std::string its_testmode = argv[3];
- if (its_testmode == std::string("SUBSCRIBE")) {
- ::testing::GTEST_FLAG(filter) = "*send_multiple_subscriptions";
- } else if (its_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE")) {
- ::testing::GTEST_FLAG(filter) = "*send_alternating_subscribe_unsubscribe";
- } else if (its_testmode == std::string("UNSUBSCRIBE")) {
- ::testing::GTEST_FLAG(filter) = "*send_multiple_unsubscriptions";
- } else if (its_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE_NACK")) {
- ::testing::GTEST_FLAG(filter) = "*send_alternating_subscribe_nack_unsubscribe";
- }
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/pending_subscription_tests/pending_subscription_test_service.cpp b/test/pending_subscription_tests/pending_subscription_test_service.cpp
deleted file mode 100644
index 00434f3..0000000
--- a/test/pending_subscription_tests/pending_subscription_test_service.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <atomic>
-#include <future>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "pending_subscription_test_globals.hpp"
-
-class pending_subscription_test_service {
-public:
- pending_subscription_test_service(struct pending_subscription_test::service_info _service_info, pending_subscription_test::test_mode_e _testmode) :
- service_info_(_service_info),
- testmode_(_testmode),
- app_(vsomeip::runtime::get()->create_application("pending_subscription_test_service")),
- wait_until_registered_(true),
- wait_until_shutdown_method_called_(true),
- subscription_accepted_asynchronous_(false),
- subscription_accepted_synchronous_(false),
- offer_thread_(std::bind(&pending_subscription_test_service::run, this)) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&pending_subscription_test_service::on_state, this,
- std::placeholders::_1));
-
- // offer field
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(_service_info.eventgroup_id);
- app_->offer_event(service_info_.service_id, 0x1,
- service_info_.event_id, its_eventgroups, true);
-
- its_eventgroups.clear();
- its_eventgroups.insert(static_cast<vsomeip::eventgroup_t>(_service_info.eventgroup_id+1u));
-
- app_->offer_event(service_info_.service_id, 0x1,
- static_cast<vsomeip::event_t>(service_info_.event_id+1u),
- its_eventgroups, true);
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, service_info_.shutdown_method_id,
- std::bind(&pending_subscription_test_service::on_shutdown_method_called, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, service_info_.notify_method_id,
- std::bind(&pending_subscription_test_service::on_notify_method_called, this,
- std::placeholders::_1));
-
- app_->register_async_subscription_handler(service_info_.service_id,
- 0x1, service_info_.eventgroup_id,
- std::bind(&pending_subscription_test_service::subscription_handler_async,
- this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
- app_->register_subscription_handler(service_info_.service_id,
- 0x1, static_cast<vsomeip::eventgroup_t>(service_info_.eventgroup_id+1u),
- std::bind(&pending_subscription_test_service::subscription_handler,
- this, std::placeholders::_1, std::placeholders::_2));
- app_->start();
- }
-
- ~pending_subscription_test_service() {
- offer_thread_.join();
- }
-
- void offer() {
- app_->offer_service(service_info_.service_id, 0x1);
- }
-
- void stop() {
- app_->stop_offer_service(service_info_.service_id, 0x1);
- app_->clear_all_handler();
- app_->stop();
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_shutdown_method_called(const std::shared_ptr<vsomeip::message> &_message) {
- app_->send(vsomeip::runtime::get()->create_response(_message));
- VSOMEIP_WARNING << "************************************************************";
- VSOMEIP_WARNING << "Shutdown method called -> going down!";
- VSOMEIP_WARNING << "************************************************************";
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_shutdown_method_called_ = false;
- condition_.notify_one();
- }
-
- void on_notify_method_called(const std::shared_ptr<vsomeip::message> &_message) {
- (void)_message;
- std::shared_ptr<vsomeip::payload> its_payload = vsomeip::runtime::get()->create_payload();
- its_payload->set_data( {0xDD});
- app_->notify(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_payload);
- app_->notify(service_info_.service_id, service_info_.instance_id,
- static_cast<vsomeip::event_t>(service_info_.event_id + 1u) , its_payload);
- notify_method_called_.set_value(true);
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
-
- while (!subscription_accepted_asynchronous_ || !subscription_accepted_synchronous_) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE) {
- async_subscription_handler_(true);
- } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE) {
- ;
- } else if (testmode_ == pending_subscription_test::test_mode_e::UNSUBSCRIBE) {
- ;
- } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_NACK) {
- ;
- }
- std::future<bool> itsFuture = notify_method_called_.get_future();
- if (std::future_status::timeout == itsFuture.wait_for(std::chrono::seconds(10))) {
- ADD_FAILURE() << "notify method wasn't called within time!";
- } else {
- EXPECT_TRUE(itsFuture.get());
- }
- while (wait_until_shutdown_method_called_) {
- condition_.wait(its_lock);
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(2000));
- stop();
- }
-
- void subscription_handler_async(vsomeip::client_t _client, bool _subscribed,
- std::function<void(const bool)> _cbk) {
- VSOMEIP_WARNING << __func__ << " " << std::hex << _client << " subscribed." << _subscribed;
- if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE) {
- async_subscription_handler_ = _cbk;
- static int was_called = 0;
- was_called++;
- EXPECT_EQ(1, was_called);
- EXPECT_TRUE(_subscribed);
- subscription_accepted_asynchronous_ = true;
- } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE) {
- static int count_subscribe = 0;
- static int count_unsubscribe = 0;
- _subscribed ? count_subscribe++ : count_unsubscribe++;
- if (count_subscribe == 1) {
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
- _cbk(true);
- if (count_subscribe == 8 || count_unsubscribe == 7) {
- subscription_accepted_asynchronous_ = true;
- }
- } else if (testmode_ == pending_subscription_test::test_mode_e::UNSUBSCRIBE) {
- static int count_subscribe = 0;
- static int count_unsubscribe = 0;
- _subscribed ? count_subscribe++ : count_unsubscribe++;
- if (count_subscribe == 1) {
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
- _cbk(true);
- if (count_subscribe == 2 || count_unsubscribe == 1) {
- subscription_accepted_asynchronous_ = true;
- }
- } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_NACK) {
- static int count_subscribe = 0;
- static int count_unsubscribe = 0;
- _subscribed ? count_subscribe++ : count_unsubscribe++;
- if (count_subscribe == 1) {
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
- if (_subscribed) {
- _cbk((count_subscribe % 2)); // nack every second subscription
- } else {
- _cbk(true);
- }
- if (count_subscribe == 8 || count_unsubscribe == 7) {
- subscription_accepted_asynchronous_ = true;
- }
- }
- }
-
- bool subscription_handler(vsomeip::client_t _client, bool _subscribed) {
- (void)_subscribed;
- bool ret(false);
- VSOMEIP_WARNING << __func__ << " " << std::hex << _client << " subscribed. " << _subscribed;
- if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE) {
- static int was_called = 0;
- was_called++;
- EXPECT_EQ(1, was_called);
- EXPECT_TRUE(_subscribed);
- subscription_accepted_synchronous_ = true;
- ret = true;
- } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE) {
- static int count_subscribed = 0;
- static int count_unsubscribe = 0;
- _subscribed ? count_subscribed++ : count_unsubscribe++;
- if (count_subscribed == 1) {
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
- if (count_subscribed == 8 && count_unsubscribe == 7) {
- subscription_accepted_synchronous_ = true;
- }
- ret = true;
- } else if (testmode_ == pending_subscription_test::test_mode_e::UNSUBSCRIBE) {
- static int count_subscribed = 0;
- static int count_unsubscribe = 0;
- _subscribed ? count_subscribed++ : count_unsubscribe++;
- if (count_subscribed == 1) {
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
- if (count_subscribed == 2 && count_unsubscribe == 1) {
- subscription_accepted_synchronous_ = true;
- }
- ret = true;
- } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_NACK) {
- static int count_subscribed = 0;
- static int count_unsubscribe = 0;
- _subscribed ? count_subscribed++ : count_unsubscribe++;
- if (count_subscribed == 1) {
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
- if (count_subscribed == 8 && count_unsubscribe == 7) {
- subscription_accepted_synchronous_ = true;
- }
- if (_subscribed) {
- ret = (count_subscribed % 2); // nack every second subscription
- } else {
- ret = true;
- }
- }
- return ret;
- }
-
-private:
- struct pending_subscription_test::service_info service_info_;
- pending_subscription_test::test_mode_e testmode_;
- std::shared_ptr<vsomeip::application> app_;
-
- bool wait_until_registered_;
- bool wait_until_shutdown_method_called_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::atomic<bool> subscription_accepted_asynchronous_;
- std::atomic<bool> subscription_accepted_synchronous_;
- std::thread offer_thread_;
- std::function<void(const bool)> async_subscription_handler_;
- std::promise<bool> notify_method_called_;
-};
-
-pending_subscription_test::test_mode_e its_testmode(pending_subscription_test::test_mode_e::SUBSCRIBE);
-
-TEST(someip_pending_subscription_test, block_subscription_handler)
-{
- pending_subscription_test_service its_sample(pending_subscription_test::service, its_testmode);
-}
-
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if (argc < 2) {
- std::cerr << "Please pass a test mode to this binary like: "
- << argv[0] << " SUBSCRIBE" << std::endl;
- std::cerr << "Testmodes are [SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE]" << std::endl;
- exit(1);
- }
-
- std::string its_pased_testmode = argv[1];
- if (its_pased_testmode == std::string("SUBSCRIBE")) {
- its_testmode = pending_subscription_test::test_mode_e::SUBSCRIBE;
- } else if (its_pased_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE")) {
- its_testmode = pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE;
- } else if (its_pased_testmode == std::string("UNSUBSCRIBE")) {
- its_testmode = pending_subscription_test::test_mode_e::UNSUBSCRIBE;
- } else if (its_pased_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE_NACK")) {
- its_testmode = pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_NACK;
- }
-
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/readme.txt b/test/readme.txt
deleted file mode 100644
index 9f7985a..0000000
--- a/test/readme.txt
+++ /dev/null
@@ -1,522 +0,0 @@
-Configuration Test
-------------------
-To start the configuration test from the build directory do:
-
-./configuration-test -someip ../config/vsomeip-test.json
-
-The expected output is:
-
-2015-02-10 08:47:31.503874 [info] Test "HOST ADDRESS" succeeded.
-2015-02-10 08:47:31.507609 [info] Test "HAS CONSOLE" succeeded.
-2015-02-10 08:47:31.507865 [info] Test "HAS FILE" succeeded.
-2015-02-10 08:47:31.508001 [info] Test "HAS DLT" succeeded.
-2015-02-10 08:47:31.508143 [info] Test "LOGFILE" succeeded.
-2015-02-10 08:47:31.508315 [info] Test "LOGLEVEL" succeeded.
-2015-02-10 08:47:31.508456 [info] Test "RELIABLE_TEST_1234_0022" succeeded.
-2015-02-10 08:47:31.508593 [info] Test "UNRELIABLE_TEST_1234_0022" succeeded.
-2015-02-10 08:47:31.508759 [info] Test "RELIABLE_TEST_1234_0023" succeeded.
-2015-02-10 08:47:31.508896 [info] Test "UNRELIABLE_TEST_1234_0023" succeeded.
-2015-02-10 08:47:31.509032 [info] Test "RELIABLE_TEST_2277_0022" succeeded.
-2015-02-10 08:47:31.509185 [info] Test "UNRELIABLE_TEST_2277_0022" succeeded.
-2015-02-10 08:47:31.509330 [info] Test "RELIABLE_TEST_4466_0321" succeeded.
-2015-02-10 08:47:31.509467 [info] Test "UNRELIABLE_TEST_4466_0321" succeeded.
-2015-02-10 08:47:31.509602 [info] Test "RELIABLE_TEST_2277_0022" succeeded.
-2015-02-10 08:47:31.509771 [info] Test "UNRELIABLE_TEST_2277_0022" succeeded.
-2015-02-10 08:47:31.509915 [info] Test "ADDRESS_TEST_1234_0022" succeeded.
-2015-02-10 08:47:31.510049 [info] Test "MIN_INITIAL_DELAY_TEST_1234_0022" succeeded.
-2015-02-10 08:47:31.510354 [info] Test "MAX_INITIAL_DELAY_TEST_1234_0022" succeeded.
-2015-02-10 08:47:31.510610 [info] Test "REPETITION_BASE_DELAY_TEST_1234_0022" succeeded.
-2015-02-10 08:47:31.513978 [info] Test "REPETITION_MAX_TEST_1234_0022" succeeded.
-2015-02-10 08:47:31.514177 [info] Test "CYCLIC_OFFER_DELAY_TEST_1234_0022" succeeded.
-2015-02-10 08:47:31.514280 [info] Test "CYCLIC_REQUEST_DELAY_TEST_1234_0022" succeeded.
-2015-02-10 08:47:31.514397 [info] Test "MIN_INITIAL_DELAY_TEST_1234_0023" succeeded.
-2015-02-10 08:47:31.514618 [info] Test "MAX_INITIAL_DELAY_TEST_1234_0023" succeeded.
-2015-02-10 08:47:31.514754 [info] Test "REPETITION_BASE_DELAY_TEST_1234_0023" succeeded.
-2015-02-10 08:47:31.514901 [info] Test "REPETITION_MAX_TEST_1234_0023" succeeded.
-2015-02-10 08:47:31.515052 [info] Test "CYCLIC_OFFER_DELAY_TEST_1234_0023" succeeded.
-2015-02-10 08:47:31.515186 [info] Test "CYCLIC_REQUEST_DELAY_TEST_1234_0023" succeeded.
-2015-02-10 08:47:31.515325 [info] Test "MIN_INITIAL_DELAY_TEST_2277_0022" succeeded.
-2015-02-10 08:47:31.515395 [info] Test "MAX_INITIAL_DELAY_TEST_2277_0022" succeeded.
-2015-02-10 08:47:31.515536 [info] Test "REPETITION_BASE_DELAY_TEST_2277_0022" succeeded.
-2015-02-10 08:47:31.515691 [info] Test "REPETITION_MAX_TEST_2277_0022" succeeded.
-2015-02-10 08:47:31.515834 [info] Test "CYCLIC_OFFER_DELAY_TEST_2277_0022" succeeded.
-2015-02-10 08:47:31.515971 [info] Test "CYCLIC_REQUEST_DELAY_TEST_2277_0022" succeeded.
-2015-02-10 08:47:31.516109 [info] Test "MIN_INITIAL_DELAY_TEST_2266_0022" succeeded.
-2015-02-10 08:47:31.516279 [info] Test "MAX_INITIAL_DELAY_TEST_2266_0022" succeeded.
-2015-02-10 08:47:31.516380 [info] Test "REPETITION_BASE_DELAY_TEST_2266_0022" succeeded.
-2015-02-10 08:47:31.516512 [info] Test "REPETITION_MAX_TEST_2266_0022" succeeded.
-2015-02-10 08:47:31.516610 [info] Test "CYCLIC_OFFER_DELAY_TEST_2266_0022" succeeded.
-2015-02-10 08:47:31.516736 [info] Test "CYCLIC_REQUEST_DELAY_TEST_2266_0022" succeeded.
-2015-02-10 08:47:31.516874 [info] Test "ADDRESS_TEST_4466_0321" succeeded.
-2015-02-10 08:47:31.516974 [info] Test "SERVICE DISCOVERY PROTOCOL" succeeded.
-2015-02-10 08:47:31.517106 [info] Test "SERVICE DISCOVERY PORT" succeeded.
-
-
-Application test
-----------------
-
-This test tests starting and stopping a vsomeip application in various ways.
-
-Automatic start from build directory:
-
-ctest -V -R application_test
-
-Manual start from sub folder test of build directory:
-
-./application_test_starter.sh
-
-
-Magic Cookies Test
-------------------
-To run the magic cookies test you need two devices on the same network. The network addresses within
-the configuration files need to be adapted to match the devices addresses.
-
-To start the magic-cookies-test from the build-directory do:
-
-Automatic start from build directory:
-
-ctest -V -R magic_cookies_test
-
-Manual start from sub folder test of build directory:
-
-# On external host run
-./magic_cookies_test_service_start.sh
-
-# On local host run
-./magic_cookies_test_client_start.sh
-
-
-The expected result is an output like this on service side:
-
-2015-02-10 08:42:07.317695 [info] Received a message with Client/Session [1343/0001]
-2015-02-10 08:42:07.360105 [error] Detected Magic Cookie within message data. Resyncing.
-2015-02-10 08:42:07.360298 [info] Received a message with Client/Session [1343/0003]
-2015-02-10 08:42:07.360527 [error] Detected Magic Cookie within message data. Resyncing.
-2015-02-10 08:42:07.360621 [error] Detected Magic Cookie within message data. Resyncing.
-2015-02-10 08:42:07.360714 [info] Received a message with Client/Session [1343/0006]
-2015-02-10 08:42:07.360850 [info] Received a message with Client/Session [1343/0007]
-2015-02-10 08:42:07.361021 [error] Detected Magic Cookie within message data. Resyncing.
-2015-02-10 08:42:07.361107 [error] Detected Magic Cookie within message data. Resyncing.
-2015-02-10 08:42:07.361191 [error] Detected Magic Cookie within message data. Resyncing.
-2015-02-10 08:42:07.361276 [info] Received a message with Client/Session [1343/000b]
-2015-02-10 08:42:07.361434 [info] Received a message with Client/Session [1343/000c]
-2015-02-10 08:42:07.361558 [info] Received a message with Client/Session [1343/000d]
-2015-02-10 08:42:07.361672 [error] Detected Magic Cookie within message data. Resyncing.
-2015-02-10 08:42:07.361761 [info] Received a message with Client/Session [1343/000f]
-
-Header Factory Tests
---------------------
-
-The following things are tested:
-a) create request
- --> check "Protocol Version" / "Message Type" / "Return Type" fields
-b) create request, fill header, create response
- --> compare header fields of request & response
-c) create notification
- --> check "Protocol Version" / "Message Type" / "Return Type" fields
-d) create message, fill header (service/instance/method/interface version/message type)
- --> send message 10 times
- --> receive message and check client id / session id
-
-a) to c) are combined in one binary. d) is composed out of a client and service.
-
-To start the header factory tests from the build directory do:
-
-Automatic start from build directory:
-ctest -V -R header_factory_test
-
-Manual start from build directory:
-cd test
-./header_factory_test
-# Start client and service separately
-./header_factory_test_service_start.sh &
-./header_factory_test_client_start.sh
-# Alternatively start client and service with one script
-./header_factory_test_send_receive_starter.sh
-
-All tests should be marked as "passed".
-
-Routing Tests
--------------
-
-The following things are tested:
-a) create a service instance
- - check that it is accessible from a local client but invisible for an external client
-b) create a service instance, configure it to be externally visible
- - check that it is accessible from a local client and from a external client
-
-a) and b) are composed out of a service each and one common client binary which is used
-with different configuration files.
-
-Automatic start from build directory:
-
-ctest -V -R local_routing_test
-
-A message will be shown when the external client should be started.
-
-Manual start from build directory:
-cd test
-# First part with local client
-# Start client and service with one script
-./local_routing_test_starter.sh
-
-# Alternatively start client and service separately
-# Warning some checks are done within the *_starter.sh script.
-# This should only be used for debugging
-# Start the service
-./local_routing_test_service_start.sh &
-# Start the client
-./local_routing_test_client_start.sh
-
-# Second part with external client
-# Start client and service with one script
-./external_local_routing_test_starter.sh
-# Start the external client from an external host when the message is displayed to start it
-./external_local_routing_test_client_external_start.sh
-
-# Alternatively start client and service separately
-# Warning some checks are done within the *_starter.sh script.
-# This should only be used for debugging
-# Start the service
-./external_local_routing_test_service_start.sh &
-# Start the client
-./local_routing_test_client_start.sh
-# Start the external client from an external host after local client has finished
-./external_local_routing_test_client_external_start.sh
-
-
-All tests should be marked as "passed".
-
-Payload Tests
--------------
-
-The following things are tested:
-a) create a local service
- - send messages with payloads of different size from a local client to the service
- - check that the messages are received correctly
- - measure the throughput
-b) create a service instance, configure it to be externally visible
- - send messages with payloads of different size from a local client to the service
- - check that the messages are received correctly
- - measure the throughput
-c) create a service instance, configure it to be externally visible
- - send messages with payloads of different size from an external client to the service
- - check that the messages are received correctly
- - measure the throughput
-d) create a service instance, configure it to be externally visible
- - send messages with payloads of different size from a local client to the service
- - send messages with payloads of different size from an external client to the service
- - check that the messages are received correctly
- - measure the throughput
-
-The tests a) to d) are composed out of a service and a client binary which are called
-with different configuration files and parameters.
-
-Automatic start from build directory:
-
-ctest -V -R payload_test
-
-A message will be shown when the external clients should be started.
-
-Manual start from build directory:
-cd test
-
-# First part with local client
-# start client and service with one script
-./local_payload_test_starter.sh
-
-# Alternatively start client and service separately
-# Warning some checks are done within the *_starter.sh script.
-# This should only be used for debugging
-./local_payload_test_service_start.sh &
-./local_payload_test_client_start.sh
-
-# Second part with external visible service and local client
-# start client and service with one script
-./external_local_payload_test_client_local_starter.sh
-
-# Alternatively start client and service separately
-# Warning some checks are done within the *_starter.sh script.
-# This should only be used for debugging
-./external_local_payload_test_service_start.sh &
-./external_local_payload_test_client_local_start.sh
-
-# Third part with external visible service and external client
-# start client and service with one script
-./external_local_payload_test_client_external_starter.sh
-# Start the external client from an external host if asked to
-./external_local_payload_test_client_external_start.sh
-
-# Alternatively start client and service separately
-# Warning some checks are done within the *_starter.sh script.
-# This should only be used for debugging
-./external_local_payload_test_service_client_external_start.sh
-# Start the external client from an external host
-./external_local_payload_test_client_external_start.sh
-
-# Fourth part with external visible service and local and external client
-# start client and service with one script
-./external_local_payload_test_client_local_and_external_starter.sh
-# Start the external client from an external host if asked to
-./external_local_payload_test_client_external_start.sh
-
-# Alternatively start client and service separately
-# Warning some checks are done within the *_starter.sh script.
-# This should only be used for debugging
-./external_local_payload_test_service_client_external_start.sh &
-# Start the local client
-VSOMEIP_APPLICATION_NAME=external_local_payload_test_client_local \
-VSOMEIP_CONFIGURATION=external_local_payload_test_client_local.json \
-./payload_test_client --dont-shutdown-service
-# Start the external client after the local client is finished from an
-# external host
-./external_local_payload_test_client_external_start.sh
-
-All tests should be marked as "passed".
-
-
-Big payload tests
------------------
-
-This test tests the possibility to sent messages with bigger payloads
-for local and TCP communication.
-
-The test will send a messages with 600k payload from a client to a service.
-The service will reply with a response containing 600k payload as well.
-This is repeated 10 times.
-There is a version for local and for TCP communication available.
-Additionally there are test versions available which sent up to 10MiB big
-messages and a version which tests the limitiation of message sizes configurable
-via json file.
-
-Automatic start from the build directory:
-
-ctest -V -R big_payload_test_local
-
-Manual start from sub folder test of build directory:
-
-./big_payload_test_service_local_start.sh &
-./big_payload_test_client_local_start.sh
-
-
-Automatic start of the TCP version from the build directory:
-
-ctest -V -R big_payload_test_external
-
-Manual start from sub folder test of build directory:
-
-./big_payload_test_client_start.sh
-
-# On external host run
-./big_payload_test_service_external_start.sh
-
-
-Client ID tests
----------------
-
-This tests tests communication over two nodes with multiple services on both
-nodes.
-
-The test setup is as followed:
-* There are six services with one method each.
-* Three of the services run on node 1.
-* Three of the services run on node 2.
-* Each of the services sends ten requests to the other services and waits
- until it received a response for every request.
-* If all responses have been received, the service shutdown.
-
-Automatic start from the build directory:
-
-ctest -V -R client_id_test_diff_client_ids_diff_ports
-
-Manual start from sub folder test of build directory:
-
-./client_id_test_master_starter.sh client_id_test_diff_client_ids_diff_ports_master.json
-
-Second version where all services on one node use the same port:
-
-Automatic start from the build directory:
-
-ctest -V -R client_id_test_diff_client_ids_same_ports
-
-Manual start from sub folder test of build directory:
-
-./client_id_test_master_starter.sh client_id_test_diff_client_ids_same_ports_master.json
-
-
-Subscribe notify tests
-----------------------
-This tests tests subscribe notify mechanism over two nodes with multiple services
-on both nodes.
-
-The test setup is as followed:
-* There are six services offering one event each.
-* Three of the services run on node 1.
-* Three of the services run on node 2.
-* Each of the services waits until all other services are available.
-* Each of the services subscribes to the offered event of all the other services.
-* Each of the services then waits until the other services have subscribed to
- its event.
-* Each of the services then starts to sent out ten notifications for its event.
-* Each service waits until it received the correct amount of notifications from
- all other services.
-* If all notifications have been received, the service shuts down.
-
-Automatic start from the build directory (example):
-
-ctest -V -R subscribe_notify_test_diff_client_ids_diff_ports_udp
-
-Manual start from sub folder test of build directory:
-
-./subscribe_notify_test_master_starter.sh UDP subscribe_notify_test_diff_client_ids_diff_ports_master.json
-
-There are multiple versions of this test which differ in the used subscription
-method and port setup (use ctest -N to see all). For manual start the desired
-description method has to be passed to the starter script as first parameter.
-
-The subscribe_notify_test_one_event_two_eventgroups_* tests are testing the
-requirement that for events which are member of multiple eventgroups initial
-events shall be sent per eventgroup. However normal updates of the event should
-be sent only once even if a remote subscriber is subscribed to multiple of the
-event's eventgroups (TR_SOMEIP_00570).
-
-
-CPU load test
--------------
-This test does a increasing number of synchronous function calls to the same
-method of the service and measures CPU load for each batch of function calls.
-All method calls transport a payload of 40 Bytes. The responses don't transport
-any payload.
-
-The CPU load is measured thorugh the proc fs.
-If the test prints a message like:
-
- Synchronously sent 0890 messages. CPU load [%]: 12.68
-
-This means that the test process consumed 12% of the jiffies consumed by
-complete system while doing 890 methodcalls.
-
-Automatic start from the build directory (example):
-
-ctest -V -R cpu_load_test
-
-
-Initial event tests
-----------------------
-This tests tests initial event mechanism over two nodes with multiple services
-on both nodes.
-
-The test setup is as followed:
-* There are six services offering one event each.
-* Three of the services run on node 1.
-* Three of the services run on node 2.
-* All of the services initially set their event to their service id and notify
- once
-* On each node there are 20 client applications which subscribe to all of the
- services events which are started at different times
-* Each client waits until it received one notification (the initial one) from
- all services and then exits.
-* If all clients exited, the services are killed as well
-
-Automatic start from the build directory (example):
-
-ctest -V -R initial_event_test_diff_client_ids_diff_ports_udp
-
-Manual start from sub folder test of build directory:
-./initial_event_test_master_starter.sh UDP initial_event_test_diff_client_ids_diff_ports_master.json
-
-There are multiple versions of this test which differ in the used subscription
-method and port setup (use ctest -N to see all). For manual start the desired
-description method has to be passed to the starter script as first parameter.
-
-Offer tests
------------
-This tests test various cases of offering a service and error recovery
-after an application became unresponsive
-
-* Rejecting offer of service instance whose hosting application is
- still alive.
-* Rejecting offer of service instance whose hosting application is
- still alive with daemon
-* Accepting offer of service instance whose hosting application
- crashed with (send SIGKILL)
-* Accepting offer of service instance whose hosting application became
- unresponsive (SIGSTOP)
-* Rejecting offers for which there is already a pending offer
-* Rejecting remote offer for which there is already a local offer
-* Rejecting a local offer for which there is already a remote offer
-
-Automatic start from the build directory (example):
-
-ctest -V -R offer_tests
-
-Manual start from sub folder test of build directory:
-./offer_test_local_starter
-./offer_test_external_master_starter.sh
-
-Tests in detail:
-Rejecting offer of service instance whose hosting application is still
-alive:
-* start application which offers service
-* start client which continuously exchanges messages with the service
-* start application which offers the same service again -> should be
- rejected and an error message should be printed.
-* Message exchange with client application should not be interrupted.
-
-Rejecting offer of service instance whose hosting application is still
-alive with daemon
-* start daemon (needed as he has to ping the offering client)
-* start application which offers service
-* start client which continuously exchanges messages with the service
-* start application which offers the same service again -> should be
- rejected and an error message should be printed.
-* Message exchange with client application should not be interrupted.
-
-Accepting offer of service instance whose hosting application crashed
-with (send SIGKILL)
-* start daemon
-* start application which offers service
-* start client which exchanges messages with the service
-* kill application with SIGKILL
-* start application which offers the same service again -> should be
- accepted.
-* start another client which exchanges messages with the service
-* Client should now communicate with new offerer.
-
-Accepting offer of service instance whose hosting application became
-unresponsive (SIGSTOP)
-* start daemon
-* start application which offers service
-* Send a SIGSTOP to the service to make it unresponsive
-* start application which offers the same service again -> should be
- marked as PENDING_OFFER and a ping should be sent to the paused
- application.
-* After the timeout passed the new offer should be accepted.
-* start client which exchanges messages with the service
-* Client should now communicate with new offerer.
-
-Rejecting offers for which there is already a pending offer
-* start daemon
-* start application which offers service
-* Send a SIGSTOP to the service to make it unresponsive
-* start application which offers the same service again -> should be
- marked as PENDING_OFFER and a ping should be sent to the paused
- application.
-* start application which offers the same service again -> should be
- rejected as there is already a PENDING_OFFER pending.
-* After the timeout passed the new offer should be accepted.
-* start client which exchanges messages with the service
-* Client should now communicate with new offerer.
-
-Rejecting a local offer for which there is already a remote offer:
-* start daemon
-* start application which offers service
-* start daemon remotely
-* start same application which offers the same service again remotely
- -> should be rejected as there is already a service instance
- running in the network
-
-Rejecting remote offer for which there is already a local offer
-* start application which offers service
-* send SD message trying to offer the same service instance as already
- offered locally from a remote host -> should be rejected
diff --git a/test/restart_routing_tests/restart_routing_test_autoconfig.json b/test/restart_routing_tests/restart_routing_test_autoconfig.json
deleted file mode 100644
index f50dba7..0000000
--- a/test/restart_routing_tests/restart_routing_test_autoconfig.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "unicast" : "127.0.0.1",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "warning",
- "console" : "true",
- "file" :
- {
- "enable" : "true",
- "path" : "/var/log/vsomeip.log"
- },
-
- "dlt" : "true"
- },
-
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30491",
- "protocol" : "udp"
- }
-}
diff --git a/test/restart_routing_tests/restart_routing_test_client.cpp b/test/restart_routing_tests/restart_routing_test_client.cpp
deleted file mode 100644
index a8c0acc..0000000
--- a/test/restart_routing_tests/restart_routing_test_client.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright (C) 2015-2017 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 "restart_routing_test_client.hpp"
-
-routing_restart_test_client::routing_restart_test_client()
- : app_(vsomeip::runtime::get()->create_application()),
- is_available_(false),
- sender_(std::bind(&routing_restart_test_client::run, this)),
- received_responses_(0) {
-
-}
-
-bool routing_restart_test_client::init() {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
-
- app_->register_state_handler(
- std::bind(&routing_restart_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(&routing_restart_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(&routing_restart_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- return true;
-}
-
-void routing_restart_test_client::start() {
- VSOMEIP_INFO << "Starting...";
-
- app_->start();
-}
-
-void routing_restart_test_client::stop() {
- VSOMEIP_INFO << "Stopping...";
-
- shutdown_service();
-
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
-
- app_->clear_all_handler();
- app_->stop();
-}
-
-void routing_restart_test_client::on_state(vsomeip::state_type_e _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);
- }
-}
-
-void routing_restart_test_client::on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
-
- VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client()
- << " : Service [" << std::setw(4) << std::setfill('0') << std::hex
- << _service << "." << _instance << "] is "
- << (_is_available ? "available." : "NOT available.");
-
- if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service
- && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) {
- std::unique_lock<std::mutex> its_lock(mutex_);
- if(is_available_ && !_is_available) {
- is_available_ = false;
- }
- else if(_is_available && !is_available_) {
- is_available_ = true;
- condition_.notify_one();
- }
- }
-}
-
-void routing_restart_test_client::on_message(const std::shared_ptr<vsomeip::message> &_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_service() == vsomeip_test::TEST_SERVICE_SERVICE_ID &&
- _response->get_instance() == vsomeip_test::TEST_SERVICE_INSTANCE_ID) {
- received_responses_++;
- if (received_responses_ == vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS) {
- VSOMEIP_WARNING << std::hex << app_->get_client()
- << ": Received all messages ~> going down!";
- }
- }
-}
-
-void routing_restart_test_client::run() {
- for (uint32_t i = 0; i < vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS; ++i) {
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!is_available_)
- {
- 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);
- app_->send(request, true);
-
- std::this_thread::sleep_for(std::chrono::milliseconds(250));
- }
-
- std::this_thread::sleep_for(std::chrono::milliseconds(250));
- EXPECT_EQ(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS,
- received_responses_);
-
- stop();
-}
-
-void routing_restart_test_client::join_sender_thread()
-{
- if (sender_.joinable()) {
- sender_.join();
- }
-}
-
-void routing_restart_test_client::shutdown_service() {
- 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_SHUTDOWN);
- app_->send(request,true);
-}
-
-TEST(someip_restart_routing_test, request_response_over_restart)
-{
- routing_restart_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/restart_routing_tests/restart_routing_test_client.hpp b/test/restart_routing_tests/restart_routing_test_client.hpp
deleted file mode 100644
index fdc56d4..0000000
--- a/test/restart_routing_tests/restart_routing_test_client.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-// Copyright (C) 2015-2017 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 RESTART_ROUTING_TEST_CLIENT_HPP
-#define RESTART_ROUTING_TEST_CLIENT_HPP
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../someip_test_globals.hpp"
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <atomic>
-
-class routing_restart_test_client {
-public:
- routing_restart_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<vsomeip::message> &_response);
-
- void run();
- void join_sender_thread();
-
-private:
- void shutdown_service();
-
- std::shared_ptr<vsomeip::application> app_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool is_available_;
-
- std::thread sender_;
-
- std::atomic<std::uint32_t> received_responses_;
-};
-
-#endif // RESTART_ROUTING_TEST_CLIENT_HPP
diff --git a/test/restart_routing_tests/restart_routing_test_client.json b/test/restart_routing_tests/restart_routing_test_client.json
deleted file mode 100644
index 0d901d8..0000000
--- a/test/restart_routing_tests/restart_routing_test_client.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "unicast" : "127.0.0.1",
- "netmask" : "255.255.255.0",
- "logging" :
- {
- "level" : "warning",
- "console" : "true",
- "file" :
- {
- "enable" : "true",
- "path" : "/var/log/vsomeip.log"
- },
-
- "dlt" : "true"
- },
-
- "applications" :
- [
- {
- "name" : "restart_routing_test_client1",
- "id" : "0x1343"
- },
- {
- "name" : "restart_routing_test_client2",
- "id" : "0x1344"
- },
- {
- "name" : "restart_routing_test_client3",
- "id" : "0x1345"
- },
- {
- "name" : "restart_routing_test_client4",
- "id" : "0x1346"
- }
- ],
- "services" :
- [
- ],
-
- "routing" : "vsomeipd",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30491",
- "protocol" : "udp"
- }
-}
diff --git a/test/restart_routing_tests/restart_routing_test_client_start.sh b/test/restart_routing_tests/restart_routing_test_client_start.sh
deleted file mode 100755
index de944b9..0000000
--- a/test/restart_routing_tests/restart_routing_test_client_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client
-export VSOMEIP_CONFIGURATION=restart_routing_test_client.json
-./restart_routing_test_client
diff --git a/test/restart_routing_tests/restart_routing_test_service.cpp b/test/restart_routing_tests/restart_routing_test_service.cpp
deleted file mode 100644
index cf4bba1..0000000
--- a/test/restart_routing_tests/restart_routing_test_service.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (C) 2015-2017 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 "restart_routing_test_service.hpp"
-
-routing_restart_test_service::routing_restart_test_service() :
- app_(vsomeip::runtime::get()->create_application()),
- is_registered_(false),
- blocked_(false),
- number_of_received_messages_(0),
- offer_thread_(std::bind(&routing_restart_test_service::run, this)) {
-}
-
-bool routing_restart_test_service::init() {
- std::lock_guard<std::mutex> 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(&routing_restart_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN,
- std::bind(&routing_restart_test_service::on_message_shutdown, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&routing_restart_test_service::on_state, this,
- std::placeholders::_1));
- return true;
-}
-
-void routing_restart_test_service::start() {
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void routing_restart_test_service::stop() {
- VSOMEIP_INFO << "Stopping...";
- app_->clear_all_handler();
- app_->stop();
-}
-
-void routing_restart_test_service::join_offer_thread() {
- if (offer_thread_.joinable()) {
- offer_thread_.join();
- }
-}
-
-void routing_restart_test_service::offer() {
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void routing_restart_test_service::stop_offer() {
- app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void routing_restart_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<std::mutex> its_lock(mutex_);
- blocked_ = true;
- // "start" the run method thread
- condition_.notify_one();
- }
- }
- else {
- is_registered_ = false;
- }
-}
-
-void routing_restart_test_service::on_message(const std::shared_ptr<vsomeip::message>& _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() << "]";
-
- // send response
- std::shared_ptr<vsomeip::message> its_response =
- vsomeip::runtime::get()->create_response(_request);
-
- app_->send(its_response, true);
-
- number_of_received_messages_++;
- if(number_of_received_messages_ == vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS) {
- VSOMEIP_INFO << "Received all messages!";
- }
-}
-
-void routing_restart_test_service::on_message_shutdown(
- const std::shared_ptr<vsomeip::message>& _request) {
- (void)_request;
- VSOMEIP_INFO << "Shutdown method was called, going down now.";
- stop();
-}
-
-void routing_restart_test_service::run() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- condition_.wait(its_lock);
-
- offer();
-}
-
-TEST(someip_restart_routing_test, send_response_for_every_request) {
- routing_restart_test_service test_service;
- if (test_service.init()) {
- test_service.start();
- test_service.join_offer_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/restart_routing_tests/restart_routing_test_service.hpp b/test/restart_routing_tests/restart_routing_test_service.hpp
deleted file mode 100644
index 3abfe17..0000000
--- a/test/restart_routing_tests/restart_routing_test_service.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2015-2017 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 RESTART_ROUTING_TEST_SERVICE_HPP
-#define RESTART_ROUTING_TEST_SERVICE_HPP
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../someip_test_globals.hpp"
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-
-class routing_restart_test_service {
-public:
- routing_restart_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<vsomeip::message> &_request);
- void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request);
- void run();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- std::uint32_t number_of_received_messages_;
- std::thread offer_thread_;
-};
-
-#endif // RESTART_ROUTING_TEST_SERVICE_HPP
diff --git a/test/restart_routing_tests/restart_routing_test_service.json b/test/restart_routing_tests/restart_routing_test_service.json
deleted file mode 100644
index 8ff90cb..0000000
--- a/test/restart_routing_tests/restart_routing_test_service.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "unicast" : "127.0.0.1",
- "logging" :
- {
- "level" : "warning",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "vsomeipd",
- "id" : "0x0815"
- },
- {
- "name" : "restart_routing_test_service",
- "id" : "0x1277"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ],
-
- "routing" : "vsomeipd",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-}
diff --git a/test/restart_routing_tests/restart_routing_test_service_start.sh b/test/restart_routing_tests/restart_routing_test_service_start.sh
deleted file mode 100755
index b82be7c..0000000
--- a/test/restart_routing_tests/restart_routing_test_service_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_service
-export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-./restart_routing_test_service
diff --git a/test/restart_routing_tests/restart_routing_test_starter.sh b/test/restart_routing_tests/restart_routing_test_starter.sh
deleted file mode 100755
index 0778e98..0000000
--- a/test/restart_routing_tests/restart_routing_test_starter.sh
+++ /dev/null
@@ -1,312 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit sucessfully.
-
-FAIL=0
-
-# NOW WITHOUT JSON
-echo "----------------------------------------------"
-echo "----------------------------------------------"
-echo " Run test with auto configuration "
-echo "----------------------------------------------"
-echo "----------------------------------------------"
-
-export VSOMEIP_CONFIGURATION=restart_routing_test_autoconfig.json
-
-../daemon/./vsomeipd &
-DAEMON_PID=$!
-
-sleep 2
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_service
-./restart_routing_test_service &
-SERIVCE_PID=$!
-
-# Start the client1
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client1
-./restart_routing_test_client &
-CLIENT1_PID=$!
-
-# Start the client2
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client2
-./restart_routing_test_client &
-CLIENT2_PID=$!
-
-# Start the client3
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client3
-./restart_routing_test_client &
-CLIENT3_PID=$!
-
-# Start the client4
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client4
-./restart_routing_test_client &
-CLIENT4_PID=$!
-
-sleep 2
-echo "----------------------------------------------"
-echo " let vsomeipd crash (kill -9) "
-echo "----------------------------------------------"
-kill -9 $DAEMON_PID
-echo "----------------------------------------------"
-echo " restart vsomeipd "
-echo "----------------------------------------------"
-sleep 2
-
-../daemon/./vsomeipd &
-DAEMON_PID=$!
-
-wait $SERIVCE_PID || ((FAIL+=1))
-wait $CLIENT1_PID || ((FAIL+=1))
-wait $CLIENT2_PID || ((FAIL+=1))
-wait $CLIENT3_PID || ((FAIL+=1))
-wait $CLIENT4_PID || ((FAIL+=1))
-
-kill $DAEMON_PID
-wait $DAEMON_PID
-
-# Check if client and server both exited sucessfully and the service didnt't
-# have any open tcp/udp sockets
-if [ $FAIL -eq 0 ]
-then
- echo "Test Succeeded"
-else
- exit 1
-fi
-
-# NOW WITHOUT VSOMEIPD
-echo "----------------------------------------------"
-echo "----------------------------------------------"
-echo " Run test with auto configuration no deamon "
-echo "----------------------------------------------"
-echo "----------------------------------------------"
-
-sleep 2
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_service
-./restart_routing_test_service &
-SERIVCE_PID=$!
-
-# Start the client1
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client1
-./restart_routing_test_client &
-CLIENT1_PID=$!
-
-# Start the client2
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client2
-./restart_routing_test_client &
-CLIENT2_PID=$!
-
-# Start the client3
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client3
-./restart_routing_test_client &
-CLIENT3_PID=$!
-
-# Start the client4
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client4
-./restart_routing_test_client &
-CLIENT4_PID=$!
-
-sleep 2
-echo "----------------------------------------------"
-echo " let service (routing) crash (kill -9) "
-echo "----------------------------------------------"
-kill -9 $SERIVCE_PID
-echo "----------------------------------------------"
-echo " restart service (routing) "
-echo "----------------------------------------------"
-sleep 2
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_service
-./restart_routing_test_service &
-SERIVCE_PID=$!
-
-wait $SERIVCE_PID || ((FAIL+=1))
-wait $CLIENT1_PID || ((FAIL+=1))
-wait $CLIENT2_PID || ((FAIL+=1))
-wait $CLIENT3_PID || ((FAIL+=1))
-wait $CLIENT4_PID || ((FAIL+=1))
-
-# Check if client and server both exited sucessfully and the service didnt't
-# have any open tcp/udp sockets
-if [ $FAIL -eq 0 ]
-then
- echo "Test Succeeded"
-else
- exit 1
-fi
-
-
-echo "----------------------------------------------"
-echo "----------------------------------------------"
-echo " Run test with json configuration "
-echo "----------------------------------------------"
-echo "----------------------------------------------"
-
-sleep 2
-
-export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-../daemon/./vsomeipd &
-DAEMON_PID=$!
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_service
-export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-./restart_routing_test_service &
-SERIVCE_PID=$!
-
-# Start the client1
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client1
-export VSOMEIP_CONFIGURATION=restart_routing_test_client.json
-./restart_routing_test_client &
-CLIENT1_PID=$!
-
-# Start the client2
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client2
-export VSOMEIP_CONFIGURATION=restart_routing_test_client.json
-./restart_routing_test_client &
-CLIENT2_PID=$!
-
-# Start the client3
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client3
-export VSOMEIP_CONFIGURATION=restart_routing_test_client.json
-./restart_routing_test_client &
-CLIENT3_PID=$!
-
-# Start the client4
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client4
-export VSOMEIP_CONFIGURATION=restart_routing_test_client.json
-./restart_routing_test_client &
-CLIENT4_PID=$!
-
-sleep 2
-echo "----------------------------------------------"
-echo " let vsomeipd crash (kill -9) "
-echo "----------------------------------------------"
-kill -9 $DAEMON_PID
-echo "----------------------------------------------"
-echo " restart vsomeipd "
-echo "----------------------------------------------"
-sleep 2
-
-export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-../daemon/./vsomeipd &
-DAEMON_PID=$!
-
-wait $SERIVCE_PID || ((FAIL+=1))
-wait $CLIENT1_PID || ((FAIL+=1))
-wait $CLIENT2_PID || ((FAIL+=1))
-wait $CLIENT3_PID || ((FAIL+=1))
-wait $CLIENT4_PID || ((FAIL+=1))
-
-kill $DAEMON_PID
-wait $DAEMON_PID
-
-# Check if client and server both exited sucessfully and the service didnt't
-# have any open tcp/udp sockets
-if [ $FAIL -eq 0 ]
-then
- echo "Test Succeeded"
-else
- exit 1
-fi
-
-echo "----------------------------------------------"
-echo "----------------------------------------------"
-echo "Run test with json configuration + kill service"
-echo "----------------------------------------------"
-echo "----------------------------------------------"
-
-sleep 2
-
-export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-../daemon/./vsomeipd &
-DAEMON_PID=$!
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_service
-export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-./restart_routing_test_service &
-SERIVCE_PID=$!
-
-# Start the client1
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client1
-export VSOMEIP_CONFIGURATION=restart_routing_test_client.json
-./restart_routing_test_client &
-CLIENT1_PID=$!
-
-# Start the client2
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client2
-export VSOMEIP_CONFIGURATION=restart_routing_test_client.json
-./restart_routing_test_client &
-CLIENT2_PID=$!
-
-# Start the client3
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client3
-export VSOMEIP_CONFIGURATION=restart_routing_test_client.json
-./restart_routing_test_client &
-CLIENT3_PID=$!
-
-# Start the client4
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_client4
-export VSOMEIP_CONFIGURATION=restart_routing_test_client.json
-./restart_routing_test_client &
-CLIENT4_PID=$!
-
-sleep 2
-echo "----------------------------------------------"
-echo " let vsomeipd crash (kill -9) "
-echo "----------------------------------------------"
-kill -9 $DAEMON_PID
-sleep 1
-echo "----------------------------------------------"
-echo " let service crash (kill -9) "
-echo "----------------------------------------------"
-kill -9 $SERIVCE_PID
-echo "----------------------------------------------"
-echo " restart vsomeipd "
-echo "----------------------------------------------"
-sleep 2
-
-export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-../daemon/./vsomeipd &
-DAEMON_PID=$!
-
-echo "----------------------------------------------"
-echo " restart service "
-echo "----------------------------------------------"
-sleep 1
-
-# Start the service again
-export VSOMEIP_APPLICATION_NAME=restart_routing_test_service
-export VSOMEIP_CONFIGURATION=restart_routing_test_service.json
-./restart_routing_test_service &
-SERIVCE_PID=$!
-
-wait $SERIVCE_PID || ((FAIL+=1))
-wait $CLIENT1_PID || ((FAIL+=1))
-wait $CLIENT2_PID || ((FAIL+=1))
-wait $CLIENT3_PID || ((FAIL+=1))
-wait $CLIENT4_PID || ((FAIL+=1))
-
-kill $DAEMON_PID
-wait $DAEMON_PID
-
-# Check if client and server both exited sucessfully and the service didnt't
-# have any open tcp/udp sockets
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/routing_tests/conf/external_local_routing_test_client_external.json.in b/test/routing_tests/conf/external_local_routing_test_client_external.json.in
deleted file mode 100644
index 958f196..0000000
--- a/test/routing_tests/conf/external_local_routing_test_client_external.json.in
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "unicast" : "@TEST_IP_SLAVE@",
- "netmask" : "255.255.255.0",
- "diagnosis" : "0x16",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "true",
- "path" : "/var/log/vsomeip.log"
- },
-
- "dlt" : "true"
- },
-
- "applications" :
- [
- {
- "name" : "external_local_routing_test_client_external",
- "id" : "0x1644"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unicast" : "@TEST_IP_MASTER@",
- "unreliable" : "30509"
- }
- ],
-
- "routing" : "external_local_routing_test_client_external",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30491",
- "protocol" : "udp"
- }
-}
diff --git a/test/routing_tests/conf/external_local_routing_test_service.json.in b/test/routing_tests/conf/external_local_routing_test_service.json.in
deleted file mode 100644
index a4deb82..0000000
--- a/test/routing_tests/conf/external_local_routing_test_service.json.in
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "unicast" : "@TEST_IP_MASTER@",
- "diagnosis":"0x12",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "external_local_routing_test_service",
- "id" : "0x1277"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678",
- "unreliable" : "30509"
- }
- ],
-
- "routing" : "external_local_routing_test_service",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-}
diff --git a/test/routing_tests/conf/local_routing_test_starter.sh.bat.in b/test/routing_tests/conf/local_routing_test_starter.sh.bat.in
deleted file mode 100755
index ca8582f..0000000
--- a/test/routing_tests/conf/local_routing_test_starter.sh.bat.in
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit sucessfully.
-
-FAIL=0
-
-# Parameter 1: the pid to check
-check_tcp_udp_sockets_are_closed ()
-{
- # Check that the service does not listen on any TCP/UDP socket
- # or has any active connection via a TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -ne 0 ]
- then
- ((FAIL+=1))
- fi
-
- SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ]
- then
- ((FAIL+=1))
- fi
-}
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=local_routing_test_service
-export VSOMEIP_CONFIGURATION=local_routing_test_service.json
-./local_routing_test_service &
-SERIVCE_PID=$!
-sleep 1;
-
-check_tcp_udp_sockets_are_closed $SERIVCE_PID
-
-# Start the client
-export VSOMEIP_APPLICATION_NAME=local_routing_test_client
-export VSOMEIP_CONFIGURATION=local_routing_test_client.json
-./local_routing_test_client &
-CLIENT_PID=$!
-
-check_tcp_udp_sockets_are_closed $SERIVCE_PID
-check_tcp_udp_sockets_are_closed $CLIENT_PID
-
-# Wait until client and service are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-# Check if client and server both exited successfully and the service didnt't
-# have any open
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/routing_tests/conf/local_routing_test_starter.sh.in b/test/routing_tests/conf/local_routing_test_starter.sh.in
deleted file mode 100755
index 457c60c..0000000
--- a/test/routing_tests/conf/local_routing_test_starter.sh.in
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit sucessfully.
-
-FAIL=0
-
-# Parameter 1: the pid to check
-check_tcp_udp_sockets_are_closed ()
-{
- # Check that the service does not listen on any TCP/UDP socket
- # or has any active connection via a TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -ne 0 ]
- then
- ((FAIL+=1))
- fi
-
- SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ]
- then
- ((FAIL+=1))
- fi
-}
-
-export VSOMEIP_CONFIGURATION=local_routing_test_service.json
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-
-WAIT_PIDS=()
-# Start the service
-export VSOMEIP_APPLICATION_NAME=local_routing_test_service
-./local_routing_test_service &
-SERIVCE_PID=$!
-WAIT_PIDS+=($!)
-sleep 1;
-
-check_tcp_udp_sockets_are_closed $SERIVCE_PID
-
-# Start the client
-export VSOMEIP_APPLICATION_NAME=local_routing_test_client
-export VSOMEIP_CONFIGURATION=local_routing_test_client.json
-./local_routing_test_client &
-CLIENT_PID=$!
-WAIT_PIDS+=($!)
-
-check_tcp_udp_sockets_are_closed $SERIVCE_PID
-check_tcp_udp_sockets_are_closed $CLIENT_PID
-
-# Wait until client and service are finished
-for job in ${WAIT_PIDS[*]}
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-kill $PID_VSOMEIPD
-sleep 1
-
-# Check if client and server both exited successfully and the service didnt't
-# have any open
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/routing_tests/external_local_routing_test_client_external_start.sh b/test/routing_tests/external_local_routing_test_client_external_start.sh
deleted file mode 100755
index b267b47..0000000
--- a/test/routing_tests/external_local_routing_test_client_external_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=external_local_routing_test_client_external
-export VSOMEIP_CONFIGURATION=external_local_routing_test_client_external.json
-./local_routing_test_client
diff --git a/test/routing_tests/external_local_routing_test_service.cpp b/test/routing_tests/external_local_routing_test_service.cpp
deleted file mode 100644
index ce8b9ef..0000000
--- a/test/routing_tests/external_local_routing_test_service.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (C) 2015-2017 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 "external_local_routing_test_service.hpp"
-
-external_local_routing_test_service::external_local_routing_test_service(bool _use_static_routing) :
- app_(vsomeip::runtime::get()->create_application()),
- is_registered_(false),
- use_static_routing_(_use_static_routing),
- blocked_(false),
- number_received_messages_local_(0),
- number_received_messages_external_(0),
- offer_thread_(std::bind(&external_local_routing_test_service::run, this))
-{
-}
-
-bool external_local_routing_test_service::init()
-{
- std::lock_guard<std::mutex> 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(&external_local_routing_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID, vsomeip_test::TEST_SERVICE_METHOD_ID,
- std::bind(&external_local_routing_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&external_local_routing_test_service::on_state, this,
- std::placeholders::_1));
-
- VSOMEIP_INFO << "Static routing " << (use_static_routing_ ? "ON" : "OFF");
- return true;
-}
-
-void external_local_routing_test_service::start()
-{
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void external_local_routing_test_service::stop()
-{
- VSOMEIP_INFO << "Stopping...";
- app_->clear_all_handler();
- app_->stop();
-}
-
-void external_local_routing_test_service::join_offer_thread()
-{
- offer_thread_.join();
-}
-
-void external_local_routing_test_service::offer()
-{
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void external_local_routing_test_service::stop_offer()
-{
- app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void external_local_routing_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_)
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- is_registered_ = true;
- blocked_ = true;
- // "start" the run method thread
- condition_.notify_one();
- }
- }
- else
- {
- is_registered_ = false;
- }
-}
-
-void external_local_routing_test_service::on_message(
- const std::shared_ptr<vsomeip::message>& _request)
-{
- 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() << "]";
-
- ASSERT_EQ(_request->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID);
- ASSERT_EQ(_request->get_method(), vsomeip_test::TEST_SERVICE_METHOD_ID);
-
- // Check the protocol version this shall be set to 0x01 according to the spec.
- // TR_SOMEIP_00052
- ASSERT_EQ(_request->get_protocol_version(), 0x01);
- // Check the message type this shall be 0xx (REQUEST) according to the spec.
- // TR_SOMEIP_00055
- ASSERT_EQ(_request->get_message_type(), vsomeip::message_type_e::MT_REQUEST);
-
- if(_request->get_client() == vsomeip_test::TEST_CLIENT_CLIENT_ID)
- {
- number_received_messages_local_++;
- // check the session id.
- ASSERT_EQ(_request->get_session(),
- static_cast<vsomeip::session_t>(number_received_messages_local_));
- }
- else if (_request->get_client() == vsomeip_test::TEST_CLIENT_EXTERNAL_CLIENT_ID)
- {
- number_received_messages_external_++;
- // check the session id.
- ASSERT_EQ(_request->get_session(),
- static_cast<vsomeip::session_t>(number_received_messages_external_));
- }
-
- // send response
- std::shared_ptr<vsomeip::message> its_response =
- vsomeip::runtime::get()->create_response(_request);
-
- app_->send(its_response, true);
-
- if(number_received_messages_local_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND
- && number_received_messages_external_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND)
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
- ASSERT_LT(number_received_messages_local_,
- vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND + 1);
- ASSERT_LT(number_received_messages_external_,
- vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND + 1);
-}
-
-void external_local_routing_test_service::run()
-{
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- condition_.wait(its_lock);
-
- blocked_ = false;
- if(use_static_routing_)
- {
- offer();
- }
-
- while (!blocked_) {
- condition_.wait(its_lock);
- }
-
- std::thread t2([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 2));});
- t2.join();
- app_->stop();
-}
-
-TEST(someip_external_local_routing_test, receive_ten_messages_over_local_and_external_socket)
-{
- bool use_static_routing = true;
- external_local_routing_test_service test_service(use_static_routing);
- if (test_service.init()) {
- test_service.start();
- test_service.join_offer_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/routing_tests/external_local_routing_test_service.hpp b/test/routing_tests/external_local_routing_test_service.hpp
deleted file mode 100644
index a25025e..0000000
--- a/test/routing_tests/external_local_routing_test_service.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2015-2017 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 EXTERNALLOCALROUTINGTESTSERVICE_HPP_
-#define EXTERNALLOCALROUTINGTESTSERVICE_HPP_
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-
-#include "../someip_test_globals.hpp"
-
-class external_local_routing_test_service
-{
-public:
- external_local_routing_test_service(bool _use_static_routing);
- 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<vsomeip::message> &_request);
- void run();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
- bool use_static_routing_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- std::uint32_t number_received_messages_local_;
- std::uint32_t number_received_messages_external_;
- std::thread offer_thread_;
-};
-
-#endif /* EXTERNALLOCALROUTINGTESTSERVICE_HPP_ */
diff --git a/test/routing_tests/external_local_routing_test_service_start.sh b/test/routing_tests/external_local_routing_test_service_start.sh
deleted file mode 100755
index 81b2ef1..0000000
--- a/test/routing_tests/external_local_routing_test_service_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=external_local_routing_test_service
-export VSOMEIP_CONFIGURATION=external_local_routing_test_service.json
-./external_local_routing_test_service
diff --git a/test/routing_tests/external_local_routing_test_starter.sh b/test/routing_tests/external_local_routing_test_starter.sh
deleted file mode 100755
index af94ab6..0000000
--- a/test/routing_tests/external_local_routing_test_starter.sh
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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 client and service with
-# one command. This is necessary as ctest - which is used to run the
-# tests - isn't able to start two binaries for one testcase. Therefore
-# the testcase simply executes this script. This script then runs client
-# and service and checks that both exit sucessfully.
-
-FAIL=0
-
-# Parameter 1: the pid to check
-check_tcp_udp_sockets_are_open ()
-{
- # Check that the service does listen on at least one TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -lt 1 ]
- then
- ((FAIL+=1))
- fi
-}
-
-# Parameter 1: the pid to check
-check_tcp_udp_sockets_are_closed ()
-{
- # Check that the service does not listen on any TCP/UDP socket
- # or has any active connection via a TCP/UDP socket
- # awk is used to avoid the case when a inode number is the same as a PID. The awk
- # program filters the netstat output down to the protocol (1st field) and
- # the PID/Program name (last field) fields.
- SERVICE_SOCKETS_LISTENING=$(netstat -tulpen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_LISTENING -ne 0 ]
- then
- ((FAIL+=1))
- fi
-
- SERVICE_SOCKETS_CONNECTED=$(netstat -tupen 2> /dev/null | awk '{print $1 "\t" $NF}' | grep $1 | wc -l)
- if [ $SERVICE_SOCKETS_CONNECTED -ne 0 ]
- then
- ((FAIL+=1))
- fi
-}
-
-# Start the service
-export VSOMEIP_APPLICATION_NAME=external_local_routing_test_service
-export VSOMEIP_CONFIGURATION=external_local_routing_test_service.json
-./external_local_routing_test_service &
-SERIVCE_PID=$!
-sleep 1;
-
-check_tcp_udp_sockets_are_open $SERIVCE_PID
-
-# Start the client (we reuse the one from the local_routing_test to check
-# the local routing functionality).
-export VSOMEIP_APPLICATION_NAME=local_routing_test_client
-export VSOMEIP_CONFIGURATION=local_routing_test_client.json
-./local_routing_test_client &
-CLIENT_PID=$!
-
-check_tcp_udp_sockets_are_open $SERIVCE_PID
-sleep 1
-check_tcp_udp_sockets_are_closed $CLIENT_PID
-
-# wait that local client finishes
-sleep 2
-
-# Display a message to show the user that he must now call the external client
-# to finish the test successfully
-kill -0 $CLIENT_PID &> /dev/null
-CLIENT_STILL_THERE=$?
-if [ $CLIENT_STILL_THERE -ne 0 ]
-then
- if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting external_local_routing_test_starter.sh on slave LXC"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./external_local_routing_test_client_external_start.sh\"" &
- echo "remote ssh job id: $!"
- elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name elrts --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./external_local_routing_test_client_external_start.sh" &
- else
- cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** external_local_routing_test_client_external_start.sh
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** external_local_routing_test_client_external.json and
-** external_local_routing_test_service.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
- fi
-fi
-
-if [ ! -z "$USE_DOCKER" ]; then
- FAIL=0
-fi
-
-# Wait until client and service are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop elrts
- docker rm elrts
-fi
-
-# Check if client and server both exited sucessfully and the service didnt't
-# have any open
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/routing_tests/local_routing_test_client.cpp b/test/routing_tests/local_routing_test_client.cpp
deleted file mode 100644
index 5bd83fe..0000000
--- a/test/routing_tests/local_routing_test_client.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright (C) 2015-2017 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 "local_routing_test_client.hpp"
-
-local_routing_test_client::local_routing_test_client(bool _use_tcp) :
- app_(vsomeip::runtime::get()->create_application()),
- request_(vsomeip::runtime::get()->create_request(_use_tcp)),
- running_(true),
- blocked_(false),
- is_available_(false),
- number_of_messages_to_send_(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND),
- number_of_sent_messages_(0),
- number_of_acknowledged_messages_(0),
- sender_(std::bind(&local_routing_test_client::run, this))
-{
-}
-
-bool local_routing_test_client::init()
-{
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
-
- app_->register_state_handler(
- std::bind(&local_routing_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(&local_routing_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(&local_routing_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- return true;
-}
-
-void local_routing_test_client::start()
-{
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void local_routing_test_client::stop()
-{
- VSOMEIP_INFO << "Stopping...";
- app_->clear_all_handler();
- app_->stop();
-}
-
-void local_routing_test_client::join_sender_thread(){
- sender_.join();
-
- ASSERT_EQ(number_of_sent_messages_, number_of_acknowledged_messages_);
-}
-
-void local_routing_test_client::on_state(vsomeip::state_type_e _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);
- }
-}
-
-void local_routing_test_client::on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available)
-{
- VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0') << std::hex
- << _service << "." << _instance << "] is "
- << (_is_available ? "available." : "NOT available.");
-
- if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service
- && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance)
- {
- if(is_available_ && !_is_available)
- {
- is_available_ = false;
- }
- else if(_is_available && !is_available_)
- {
- is_available_ = true;
- send();
- }
- }
-}
-
-void local_routing_test_client::on_message(const std::shared_ptr<vsomeip::message>& _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() << "]";
- number_of_acknowledged_messages_++;
- if(number_of_acknowledged_messages_ == number_of_messages_to_send_) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
- }
-}
-
-void local_routing_test_client::send()
-{
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ = true;
- condition_.notify_one();
-}
-
-void local_routing_test_client::run()
-{
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- {
- condition_.wait(its_lock);
- }
- blocked_ = 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);
-
- for (uint32_t i = 0; i < number_of_messages_to_send_; i++)
- {
- app_->send(request_, true);
- VSOMEIP_INFO << "Client/Session [" << std::setw(4) << std::setfill('0')
- << std::hex << request_->get_client() << "/" << std::setw(4)
- << std::setfill('0') << std::hex << request_->get_session()
- << "] sent a request to Service [" << std::setw(4)
- << std::setfill('0') << std::hex << request_->get_service()
- << "." << std::setw(4) << std::setfill('0') << std::hex
- << request_->get_instance() << "]";
- number_of_sent_messages_++;
- }
- blocked_ = false;
- // wait until all messages have been acknowledged
- while (!blocked_)
- {
- condition_.wait(its_lock);
- }
- stop();
-}
-
-TEST(someip_local_routing_test, send_ten_messages_to_service_and_receive_reply)
-{
- bool use_tcp = false;
- local_routing_test_client test_client_(use_tcp);
- if (test_client_.init()) {
- test_client_.start();
- test_client_.join_sender_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/routing_tests/local_routing_test_client.hpp b/test/routing_tests/local_routing_test_client.hpp
deleted file mode 100644
index b135dea..0000000
--- a/test/routing_tests/local_routing_test_client.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2015-2017 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 LOCALROUTINGTESTCLIENT_HPP_
-#define LOCALROUTINGTESTCLIENT_HPP_
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-
-#include "../someip_test_globals.hpp"
-
-class local_routing_test_client
-{
-public:
- local_routing_test_client(bool _use_tcp);
- bool init();
- void start();
- void stop();
- void join_sender_thread();
- 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<vsomeip::message> &_response);
- void send();
- void run();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- std::shared_ptr<vsomeip::message> request_;
- std::mutex mutex_;
- std::condition_variable condition_;
- bool running_;
- bool blocked_;
- bool is_available_;
- std::uint32_t number_of_messages_to_send_;
- std::uint32_t number_of_sent_messages_;
- std::uint32_t number_of_acknowledged_messages_;
- std::thread sender_;
-};
-
-#endif /* LOCALROUTINGTESTCLIENT_HPP_ */
diff --git a/test/routing_tests/local_routing_test_client.json b/test/routing_tests/local_routing_test_client.json
deleted file mode 100644
index 2b4bdaa..0000000
--- a/test/routing_tests/local_routing_test_client.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "unicast" : "127.0.0.1",
- "netmask" : "255.255.255.0",
- "diagnosis":"0x12",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "true",
- "path" : "/var/log/vsomeip.log"
- },
-
- "dlt" : "true"
- },
-
- "applications" :
- [
- {
- "name" : "local_routing_test_client",
- "id" : "0x1255"
- }
- ],
-
- "services" :
- [
- ],
-
- "routing" : "vsomeipd",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30491",
- "protocol" : "udp"
- }
-} \ No newline at end of file
diff --git a/test/routing_tests/local_routing_test_client_start.sh b/test/routing_tests/local_routing_test_client_start.sh
deleted file mode 100755
index ed4023e..0000000
--- a/test/routing_tests/local_routing_test_client_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=local_routing_test_client
-export VSOMEIP_CONFIGURATION=local_routing_test_client.json
-./local_routing_test_client
diff --git a/test/routing_tests/local_routing_test_service.cpp b/test/routing_tests/local_routing_test_service.cpp
deleted file mode 100644
index 4f7962d..0000000
--- a/test/routing_tests/local_routing_test_service.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (C) 2015-2017 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 "local_routing_test_service.hpp"
-
-local_routing_test_service::local_routing_test_service(bool _use_static_routing) :
- app_(vsomeip::runtime::get()->create_application()),
- is_registered_(false),
- use_static_routing_(_use_static_routing),
- blocked_(false),
- number_of_received_messages_(0),
- offer_thread_(std::bind(&local_routing_test_service::run, this))
-{
-}
-
-bool local_routing_test_service::init()
-{
- std::lock_guard<std::mutex> 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(&local_routing_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&local_routing_test_service::on_state, this,
- std::placeholders::_1));
-
- VSOMEIP_INFO << "Static routing " << (use_static_routing_ ? "ON" : "OFF");
- return true;
-}
-
-void local_routing_test_service::start()
-{
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void local_routing_test_service::stop()
-{
- VSOMEIP_INFO << "Stopping...";
- app_->clear_all_handler();
- app_->stop();
-}
-
-void local_routing_test_service::join_offer_thread()
-{
- offer_thread_.join();
-}
-
-void local_routing_test_service::offer()
-{
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void local_routing_test_service::stop_offer()
-{
- app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void local_routing_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<std::mutex> its_lock(mutex_);
- blocked_ = true;
- // "start" the run method thread
- condition_.notify_one();
- }
- }
- else
- {
- is_registered_ = false;
- }
-}
-
-void local_routing_test_service::on_message(const std::shared_ptr<vsomeip::message>& _request)
-{
- 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() << "]";
-
- number_of_received_messages_++;
-
- ASSERT_EQ(_request->get_service(), vsomeip_test::TEST_SERVICE_SERVICE_ID);
- ASSERT_EQ(_request->get_method(), vsomeip_test::TEST_SERVICE_METHOD_ID);
-
- // Check the protocol version this shall be set to 0x01 according to the spec.
- // TR_SOMEIP_00052
- ASSERT_EQ(_request->get_protocol_version(), 0x01);
- // Check the message type this shall be 0xx (REQUEST) according to the spec.
- // TR_SOMEIP_00055
- ASSERT_EQ(_request->get_message_type(), vsomeip::message_type_e::MT_REQUEST);
-
- // check the session id.
- ASSERT_EQ(_request->get_session(), static_cast<vsomeip::session_t>(number_of_received_messages_));
-
-
- // send response
- std::shared_ptr<vsomeip::message> its_response =
- vsomeip::runtime::get()->create_response(_request);
-
- app_->send(its_response, true);
-
- if(number_of_received_messages_ >= vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND)
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- blocked_ =true;
- condition_.notify_one();
- }
- ASSERT_LT(number_of_received_messages_,
- vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND + 1);
-}
-
-void local_routing_test_service::run()
-{
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- condition_.wait(its_lock);
-
- blocked_ = false;
- if(use_static_routing_)
- {
- offer();
- }
- while (!blocked_)
- condition_.wait(its_lock);
-
- std::thread t2([](){ std::this_thread::sleep_for(std::chrono::microseconds(1000000 * 5));});
- t2.join();
- app_->stop();
-}
-
-TEST(someip_local_routing_test, receive_ten_messages_over_local_uds_socket)
-{
- bool use_static_routing = true;
- local_routing_test_service test_service(use_static_routing);
- if (test_service.init()) {
- test_service.start();
- test_service.join_offer_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/routing_tests/local_routing_test_service.hpp b/test/routing_tests/local_routing_test_service.hpp
deleted file mode 100644
index 531fdb7..0000000
--- a/test/routing_tests/local_routing_test_service.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (C) 2015-2017 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 LOCALROUTINGTESTSERVICE_HPP_
-#define LOCALROUTINGTESTSERVICE_HPP_
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <functional>
-
-#include "../someip_test_globals.hpp"
-
-class local_routing_test_service
-{
-public:
- local_routing_test_service(bool _use_static_routing);
- 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<vsomeip::message> &_request);
- void run();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
- bool use_static_routing_;
-
- bool blocked_;
- std::uint32_t number_of_received_messages_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::thread offer_thread_;
-};
-
-#endif /* LOCALROUTINGTESTSERVICE_HPP_ */
diff --git a/test/routing_tests/local_routing_test_service.json b/test/routing_tests/local_routing_test_service.json
deleted file mode 100644
index f5da8c6..0000000
--- a/test/routing_tests/local_routing_test_service.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "unicast" : "127.0.0.1",
- "diagnosis":"0x12",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" :
- {
- "enable" : "false",
- "path" : "/tmp/vsomeip.log"
- },
-
- "dlt" : "false"
- },
-
- "applications" :
- [
- {
- "name" : "local_routing_test_service",
- "id" : "0x1277"
- }
- ],
-
- "services" :
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ],
-
- "routing" : "vsomeipd",
- "service-discovery" :
- {
- "enable" : "false",
- "multicast" : "224.0.0.1",
- "port" : "30490",
- "protocol" : "udp"
- }
-}
diff --git a/test/routing_tests/local_routing_test_service_start.sh b/test/routing_tests/local_routing_test_service_start.sh
deleted file mode 100755
index c59364c..0000000
--- a/test/routing_tests/local_routing_test_service_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=local_routing_test_service
-export VSOMEIP_CONFIGURATION=local_routing_test_service.json
-./local_routing_test_service
diff --git a/test/security_tests/conf/security_test_config.json.in b/test/security_tests/conf/security_test_config.json.in
deleted file mode 100644
index 693bf58..0000000
--- a/test/security_tests/conf/security_test_config.json.in
+++ /dev/null
@@ -1,71 +0,0 @@
-{
- "unicast" : "localhost",
- "logging" :
- {
- "level" : "info",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "service-sample",
- "id" : "0x1277"
- },
- {
- "name" : "client-sample",
- "id" : "0x1255"
- }
- ],
- "security" :
- {
- "check_credentials" : "true",
- "policies" :
- [
- {
- "client" : "0x1277",
- "credentials" : { "uid" : "@TEST_UID@", "gid" : "@TEST_GID@" },
- "allow" :
- {
- "offers":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
- }
- },
- {
- "client" : "0x1255",
- "credentials" : { "uid" : "@TEST_UID@", "gid" : "@TEST_GID@" },
- "allow" :
- {
- "requests":
- [
- {
- "service" : "0x1234",
- "instance" : "0x5678"
- }
- ]
- }
- }
- ]
- },
- "routing" : "service-sample",
- "service-discovery" :
- {
- "enable" : "true",
- "multicast" : "224.244.224.245",
- "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/security_tests/security_test_client.cpp b/test/security_tests/security_test_client.cpp
deleted file mode 100644
index 924f13c..0000000
--- a/test/security_tests/security_test_client.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright (C) 2017 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 "security_test_client.hpp"
-
-security_test_client::security_test_client()
- : app_(vsomeip::runtime::get()->create_application()),
- is_available_(false),
- sender_(std::bind(&security_test_client::run, this)),
- received_responses_(0) {
-
-}
-
-bool security_test_client::init() {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
-
- app_->register_state_handler(
- std::bind(&security_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(&security_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(&security_test_client::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- return true;
-}
-
-void security_test_client::start() {
- VSOMEIP_INFO << "Starting...";
-
- app_->start();
-}
-
-void security_test_client::stop() {
- VSOMEIP_INFO << "Stopping...";
-
- shutdown_service();
-
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
-
- app_->clear_all_handler();
- app_->stop();
-}
-
-void security_test_client::on_state(vsomeip::state_type_e _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);
- }
-}
-
-void security_test_client::on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
-
- VSOMEIP_INFO << std::hex << "Client 0x" << app_->get_client()
- << " : Service [" << std::setw(4) << std::setfill('0') << std::hex
- << _service << "." << _instance << "] is "
- << (_is_available ? "available." : "NOT available.");
-
- if(vsomeip_test::TEST_SERVICE_SERVICE_ID == _service
- && vsomeip_test::TEST_SERVICE_INSTANCE_ID == _instance) {
- std::unique_lock<std::mutex> its_lock(mutex_);
- if(is_available_ && !_is_available) {
- is_available_ = false;
- }
- else if(_is_available && !is_available_) {
- is_available_ = true;
- condition_.notify_one();
- }
- }
-}
-
-void security_test_client::on_message(const std::shared_ptr<vsomeip::message> &_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_service() == vsomeip_test::TEST_SERVICE_SERVICE_ID &&
- _response->get_instance() == vsomeip_test::TEST_SERVICE_INSTANCE_ID) {
- received_responses_++;
- if (received_responses_ == vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_SECURITY_TESTS) {
- VSOMEIP_WARNING << std::hex << app_->get_client()
- << ": Received all messages ~> going down!";
- }
- }
-}
-
-void security_test_client::run() {
- for (uint32_t i = 0; i < vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_SECURITY_TESTS; ++i) {
- {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!is_available_)
- {
- 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);
- app_->send(request, true);
-
- std::this_thread::sleep_for(std::chrono::milliseconds(250));
- }
-
- std::this_thread::sleep_for(std::chrono::milliseconds(250));
- EXPECT_EQ(vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_SECURITY_TESTS,
- received_responses_);
-
- stop();
-}
-
-void security_test_client::join_sender_thread()
-{
- if (sender_.joinable()) {
- sender_.join();
- }
-}
-
-void security_test_client::shutdown_service() {
- 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_SHUTDOWN);
- app_->send(request,true);
-}
-
-TEST(someip_security_test, basic_request_response)
-{
- security_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();
-} \ No newline at end of file
diff --git a/test/security_tests/security_test_client.hpp b/test/security_tests/security_test_client.hpp
deleted file mode 100644
index ed010fa..0000000
--- a/test/security_tests/security_test_client.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-// Copyright (C) 2015-2017 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 SECURITY_TEST_CLIENT_HPP
-#define SECURITY_TEST_CLIENT_HPP
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../someip_test_globals.hpp"
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-#include <atomic>
-
-class security_test_client {
-public:
- security_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<vsomeip::message> &_response);
-
- void run();
- void join_sender_thread();
-
-private:
- void shutdown_service();
-
- std::shared_ptr<vsomeip::application> app_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool is_available_;
-
- std::thread sender_;
-
- std::atomic<std::uint32_t> received_responses_;
-};
-
-#endif // SECURITY_TEST_CLIENT_HPP
diff --git a/test/security_tests/security_test_client_start.sh b/test/security_tests/security_test_client_start.sh
deleted file mode 100755
index e87ca31..0000000
--- a/test/security_tests/security_test_client_start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_APPLICATION_NAME=client-sample
-export VSOMEIP_CONFIGURATION=vsomeip-security.json
-./security_test_client
diff --git a/test/security_tests/security_test_service.cpp b/test/security_tests/security_test_service.cpp
deleted file mode 100644
index 99fb14e..0000000
--- a/test/security_tests/security_test_service.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (C) 2017 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 "security_test_service.hpp"
-
-security_test_service::security_test_service() :
- app_(vsomeip::runtime::get()->create_application()),
- is_registered_(false),
- blocked_(false),
- number_of_received_messages_(0),
- offer_thread_(std::bind(&security_test_service::run, this)) {
-}
-
-bool security_test_service::init() {
- std::lock_guard<std::mutex> 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(&security_test_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_message_handler(vsomeip_test::TEST_SERVICE_SERVICE_ID,
- vsomeip_test::TEST_SERVICE_INSTANCE_ID,
- vsomeip_test::TEST_SERVICE_METHOD_ID_SHUTDOWN,
- std::bind(&security_test_service::on_message_shutdown, this,
- std::placeholders::_1));
-
- app_->register_state_handler(
- std::bind(&security_test_service::on_state, this,
- std::placeholders::_1));
- return true;
-}
-
-void security_test_service::start() {
- VSOMEIP_INFO << "Starting...";
- app_->start();
-}
-
-void security_test_service::stop() {
- VSOMEIP_INFO << "Stopping...";
- app_->clear_all_handler();
- app_->stop();
-}
-
-void security_test_service::join_offer_thread() {
- if (offer_thread_.joinable()) {
- offer_thread_.join();
- }
-}
-
-void security_test_service::offer() {
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void security_test_service::stop_offer() {
- app_->stop_offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
-}
-
-void security_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<std::mutex> its_lock(mutex_);
- blocked_ = true;
- // "start" the run method thread
- condition_.notify_one();
- }
- }
- else {
- is_registered_ = false;
- }
-}
-
-void security_test_service::on_message(const std::shared_ptr<vsomeip::message>& _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() << "]";
-
- // send response
- std::shared_ptr<vsomeip::message> its_response =
- vsomeip::runtime::get()->create_response(_request);
-
- app_->send(its_response, true);
-
- number_of_received_messages_++;
- if(number_of_received_messages_ == vsomeip_test::NUMBER_OF_MESSAGES_TO_SEND_SECURITY_TESTS) {
- VSOMEIP_INFO << "Received all messages!";
- }
-}
-
-void security_test_service::on_message_shutdown(
- const std::shared_ptr<vsomeip::message>& _request) {
- (void)_request;
- VSOMEIP_INFO << "Shutdown method was called, going down now.";
- stop();
-}
-
-void security_test_service::run() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (!blocked_)
- condition_.wait(its_lock);
-
- offer();
-}
-
-TEST(someip_security_test, basic_request_response) {
- security_test_service test_service;
- if (test_service.init()) {
- test_service.start();
- test_service.join_offer_thread();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/security_tests/security_test_service.hpp b/test/security_tests/security_test_service.hpp
deleted file mode 100644
index 21f1f7c..0000000
--- a/test/security_tests/security_test_service.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2015-2017 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 SECURITY_TEST_SERVICE_HPP
-#define SECURITY_TEST_SERVICE_HPP
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../someip_test_globals.hpp"
-
-#include <thread>
-#include <mutex>
-#include <condition_variable>
-
-class security_test_service {
-public:
- security_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<vsomeip::message> &_request);
- void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request);
- void run();
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- bool is_registered_;
-
- std::mutex mutex_;
- std::condition_variable condition_;
- bool blocked_;
- std::uint32_t number_of_received_messages_;
- std::thread offer_thread_;
-};
-
-#endif // SECURITY_TEST_SERVICE_HPP
diff --git a/test/security_tests/security_test_start.sh b/test/security_tests/security_test_start.sh
deleted file mode 100755
index ac4f51f..0000000
--- a/test/security_tests/security_test_start.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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/.
-
-export VSOMEIP_CONFIGURATION=security_test_config.json
-
-export VSOMEIP_APPLICATION_NAME=service-sample
-./security_test_service &
-
-sleep 1
-
-export VSOMEIP_APPLICATION_NAME=client-sample
-./security_test_client
diff --git a/test/someip_test_globals.hpp b/test/someip_test_globals.hpp
deleted file mode 100644
index 8e7af4b..0000000
--- a/test/someip_test_globals.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2015-2017 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 SOMEIP_TEST_GLOBALS_HPP_
-#define SOMEIP_TEST_GLOBALS_HPP_
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "../implementation/logging/include/logger.hpp"
-
-namespace vsomeip_test
-{
-
-// Service
-constexpr vsomeip::service_t TEST_SERVICE_SERVICE_ID = 0x1234;
-constexpr vsomeip::instance_t TEST_SERVICE_INSTANCE_ID = 0x5678;
-constexpr vsomeip::method_t TEST_SERVICE_METHOD_ID = 0x8421;
-constexpr vsomeip::method_t TEST_SERVICE_METHOD_ID_SHUTDOWN = 0x7777;
-constexpr vsomeip::client_t TEST_SERVICE_CLIENT_ID = 0x1277;
-
-// Client local
-constexpr vsomeip::client_t TEST_CLIENT_CLIENT_ID = 0x1255;
-
-// Client external
-constexpr vsomeip::client_t TEST_CLIENT_EXTERNAL_CLIENT_ID = 0x1644;
-
-
-constexpr std::uint32_t NUMBER_OF_MESSAGES_TO_SEND = 10;
-constexpr vsomeip::session_t TEST_INITIAL_SESSION_ID = 0x1;
-
-constexpr std::uint32_t NUMBER_OF_MESSAGES_TO_SEND_PAYLOAD_TESTS = 1000;
-constexpr vsomeip::byte_t PAYLOAD_TEST_DATA = 0xDD;
-constexpr std::uint32_t MAX_PAYLOADSIZE = 1024*128;
-// TR_SOMEIP_00061
-constexpr std::uint32_t MAX_PAYLOADSIZE_UDP = 1400;
-
-constexpr std::uint32_t NUMBER_OF_MESSAGES_TO_SEND_ROUTING_RESTART_TESTS = 32;
-
-constexpr std::uint32_t NUMBER_OF_MESSAGES_TO_SEND_SECURITY_TESTS = 32;
-}
-
-#endif /* SOMEIP_TEST_GLOBALS_HPP_ */
diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in
deleted file mode 100644
index f3aa9de..0000000
--- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_one_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_one_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_one_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_one_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- },
- "supports_selective_broadcasts" :
- {
- "address" : "@TEST_IP_SLAVE@"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in
deleted file mode 100644
index b684f56..0000000
--- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in
+++ /dev/null
@@ -1,104 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_one_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_one_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_one_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x1111",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x2222",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x3333",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- }
- ],
- "routing":"subscribe_notify_one_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- },
- "supports_selective_broadcasts" :
- {
- "address" : "@TEST_IP_SLAVE@"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in
deleted file mode 100644
index c588106..0000000
--- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_one_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"subscribe_notify_one_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"subscribe_notify_one_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_one_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- },
- "supports_selective_broadcasts" :
- {
- "address" : "@TEST_IP_MASTER@"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in
deleted file mode 100644
index dbe0635..0000000
--- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in
+++ /dev/null
@@ -1,104 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_one_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"subscribe_notify_one_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"subscribe_notify_one_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x4444",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x5555",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x6666",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- }
- ],
- "routing":"subscribe_notify_one_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- },
- "supports_selective_broadcasts" :
- {
- "address" : "@TEST_IP_MASTER@"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_globals.hpp b/test/subscribe_notify_one_tests/subscribe_notify_one_test_globals.hpp
deleted file mode 100644
index 047ded7..0000000
--- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_globals.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2014-2017 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 SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_
-#define SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_
-
-namespace subscribe_notify_one_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
- vsomeip::event_t event_id;
- vsomeip::eventgroup_t eventgroup_id;
-};
-
-static constexpr std::array<service_info, 7> service_infos = {{
- // placeholder to be consistent w/ client ids, service ids, app names
- { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF },
- // node 1
- { 0x1111, 0x1, 0x1111, 0x1111, 0x1000 },
- { 0x2222, 0x1, 0x2222, 0x2222, 0x2000 },
- { 0x3333, 0x1, 0x3333, 0x3333, 0x3000 },
- // node 2
- { 0x4444, 0x1, 0x4444, 0x4444, 0x4000 },
- { 0x5555, 0x1, 0x5555, 0x5555, 0x5000 },
- { 0x6666, 0x1, 0x6666, 0x6666, 0x6000 }
-}};
-
-static constexpr int notifications_to_send = 10;
-}
-
-#endif /* SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ */
diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh b/test/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh
deleted file mode 100755
index c551b55..0000000
--- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-if [ $# -lt 2 ]
-then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP subscribe_notify_one_test_diff_client_ids_diff_ports_master.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Please pass a json file to this script."
- echo "For example: $0 UDP subscribe_notify_one_test_diff_client_ids_diff_ports_master.json"
- exit 1
-fi
-
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $1 ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
-# replace master with slave to be able display the correct json file to be used
-# with the slave script
-MASTER_JSON_FILE=$2
-CLIENT_JSON_FILE=${MASTER_JSON_FILE/master/slave}
-
-FAIL=0
-
-# Start the services
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_one
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_one_test_service 1 $1 &
-
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_two
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_one_test_service 2 $1 &
-
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_three
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_one_test_service 3 $1 &
-
-sleep 1
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting subscribe_notify_one_test_slave_starter.sh on slave LXC with parameters $1 $CLIENT_JSON_FILE"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./subscribe_notify_one_test_slave_starter.sh $1 $CLIENT_JSON_FILE\"" &
- echo "remote ssh job id: $!"
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name snotms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./subscribe_notify_one_test_slave_starter.sh $1 $CLIENT_JSON_FILE" &
-else
- cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** subscribe_notify_one_test_slave_starter.sh $1 $CLIENT_JSON_FILE
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** subscribe_notify_one_test_diff_client_ids_diff_ports_master.json and
-** subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-# Wait until client and service are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop snotms
- docker rm snotms
-fi
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp b/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp
deleted file mode 100644
index 5266648..0000000
--- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp
+++ /dev/null
@@ -1,512 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <unordered_set>
-#include <atomic>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "subscribe_notify_one_test_globals.hpp"
-
-
-class subscribe_notify_one_test_service {
-public:
- subscribe_notify_one_test_service(struct subscribe_notify_one_test::service_info _service_info,
- vsomeip::subscription_type_e _subscription_type) :
- service_info_(_service_info),
- subscription_type_(_subscription_type),
- app_(vsomeip::runtime::get()->create_application()),
- wait_until_registered_(true),
- wait_until_other_services_available_(true),
- wait_until_notified_from_other_services_(true),
- offer_thread_(std::bind(&subscribe_notify_one_test_service::run, this)),
- wait_for_stop_(true),
- stop_thread_(std::bind(&subscribe_notify_one_test_service::wait_for_stop, this)),
- wait_for_notify_(true),
- notify_thread_(std::bind(&subscribe_notify_one_test_service::notify_one, this)),
- subscription_state_handler_called_(0),
- subscription_error_occured_(false) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&subscribe_notify_one_test_service::on_state, this,
- std::placeholders::_1));
-
- // offer event
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(service_info_.eventgroup_id);
- app_->offer_event(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_eventgroups, false);
-
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.method_id,
- std::bind(&subscribe_notify_one_test_service::on_request, this,
- std::placeholders::_1));
-
- // register subscription handler to detect whether or not all other
- // other services have subscribed
- app_->register_subscription_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.eventgroup_id,
- std::bind(&subscribe_notify_one_test_service::on_subscription, this,
- std::placeholders::_1, std::placeholders::_2));
-
- // register availability for all other services and request their event.
- for(const auto& i : subscribe_notify_one_test::service_infos) {
- if ((i.service_id == service_info_.service_id
- && i.instance_id == service_info_.instance_id)
- || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
- continue;
- }
- app_->register_message_handler(i.service_id,
- i.instance_id, vsomeip::ANY_METHOD,
- std::bind(&subscribe_notify_one_test_service::on_message, this,
- std::placeholders::_1));
- app_->register_availability_handler(i.service_id, i.instance_id,
- std::bind(&subscribe_notify_one_test_service::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
-
- app_->request_service(i.service_id, i.instance_id, vsomeip::DEFAULT_MAJOR, vsomeip::DEFAULT_MINOR, true);
-
- auto handler = std::bind(&subscribe_notify_one_test_service::on_subscription_state_change, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3, std::placeholders::_4, std::placeholders::_5);
- app_->register_subscription_status_handler(i.service_id, i.instance_id, i.eventgroup_id, vsomeip::ANY_EVENT, handler);
- app_->register_subscription_status_handler(vsomeip::ANY_SERVICE, i.instance_id, i.eventgroup_id, vsomeip::ANY_EVENT, handler);
- app_->register_subscription_status_handler(i.service_id, vsomeip::ANY_INSTANCE, i.eventgroup_id, vsomeip::ANY_EVENT, handler);
- app_->register_subscription_status_handler(vsomeip::ANY_SERVICE, vsomeip::ANY_INSTANCE, i.eventgroup_id, vsomeip::ANY_EVENT, handler);
-
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(i.eventgroup_id);
- app_->request_event(i.service_id, i.instance_id, i.event_id, its_eventgroups, false);
-
- other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false;
- other_services_received_notification_[std::make_pair(i.service_id, i.method_id)] = 0;
- }
-
- app_->start();
- }
-
- ~subscribe_notify_one_test_service() {
- offer_thread_.join();
- stop_thread_.join();
- }
-
- void offer() {
- app_->offer_service(service_info_.service_id, service_info_.instance_id);
- }
-
- void stop_offer() {
- app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- if(_is_available) {
- auto its_service = other_services_available_.find(std::make_pair(_service, _instance));
- if(its_service != other_services_available_.end()) {
- if(its_service->second != _is_available) {
- its_service->second = true;
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is available.";
-
- }
- }
-
- if(std::all_of(other_services_available_.cbegin(),
- other_services_available_.cend(),
- [](const std::map<std::pair<vsomeip::service_t,
- vsomeip::instance_t>, bool>::value_type& v) {
- return v.second;})) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_other_services_available_ = false;
- condition_.notify_one();
- }
- }
- }
-
- void on_subscription_state_change(const vsomeip::service_t _service, const vsomeip::instance_t _instance,
- const vsomeip::eventgroup_t _eventgroup, const vsomeip::event_t _event, const uint16_t _error) {
- (void)_service;
- (void)_instance;
- (void)_eventgroup;
- (void)_event;
- if (!_error) {
- subscription_state_handler_called_++;
- } else {
- subscription_error_occured_ = true;
- VSOMEIP_WARNING << std::hex << app_->get_client()
- << " : on_subscription_state_change: for service " << std::hex
- << _service << " received a subscription error!";
- }
- }
-
- bool on_subscription(vsomeip::client_t _client, bool _subscribed) {
- std::lock_guard<std::mutex> its_subscribers_lock(subscribers_mutex_);
- // check if all other services have subscribed:
- // -1 for placeholder in array and -1 for the service itself
- if (subscribers_.size() == subscribe_notify_one_test::service_infos.size() - 2) {
- return true;
- }
-
- if (_subscribed) {
- subscribers_.insert(_client);
- } else {
- subscribers_.erase(_client);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] " << "Client: " << _client
- << " subscribed, now have " << std::dec << subscribers_.size()
- << " subscribers" ;
-
- if(subscribers_.size() == subscribe_notify_one_test::service_infos.size() - 2)
- {
- // notify the notify thread to start sending out notifications
- std::lock_guard<std::mutex> its_lock(notify_mutex_);
- wait_for_notify_ = false;
- notify_condition_.notify_one();
- }
- return true;
- }
-
- void on_request(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST) {
- VSOMEIP_DEBUG << "Received a request with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "]";
- std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get()
- ->create_response(_message);
- app_->send(its_response);
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
-
- other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())]++;
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] "
- << "Received a notification with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] from Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method() <<"] (now have: "
- << std::dec << other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())] << ")";
-
-
- bool notify(false);
- switch(subscription_type_) {
- case vsomeip::subscription_type_e::SU_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_RELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_RELIABLE:
- case vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE:
- if (all_notifications_received_tcp_and_udp()) {
- notify = true;
- }
- break;
- }
-
- if(notify) {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- stop_condition_.notify_one();
- }
- }
- }
-
- bool all_notifications_received() {
- return std::all_of(
- other_services_received_notification_.cbegin(),
- other_services_received_notification_.cend(),
- [&](const std::map<std::pair<vsomeip::service_t,
- vsomeip::method_t>, std::uint32_t>::value_type& v)
- {
- return v.second == subscribe_notify_one_test::notifications_to_send;
- }
- );
- }
-
- bool all_notifications_received_tcp_and_udp() {
- std::uint32_t received_twice(0);
- std::uint32_t received_normal(0);
- for(const auto &v : other_services_received_notification_) {
- if (v.second == subscribe_notify_one_test::notifications_to_send * 2) {
- received_twice++;
- } else if(v.second == subscribe_notify_one_test::notifications_to_send) {
- received_normal++;
- }
- }
-
- if( received_twice == (subscribe_notify_one_test::service_infos.size() - 1) / 2
- && received_normal == (subscribe_notify_one_test::service_infos.size() - 1) / 2 - 1) {
- // routing manager stub receives the notification
- // - twice from external nodes
- // - and normal from all internal nodes
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] "
- << "Received notifications:"
- << " Normal: " << received_normal
- << " Twice: " << received_twice;
- return true;
- }
- return false;
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
-
-
- while (wait_until_other_services_available_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Subscribing";
- // subscribe to events of other services
- uint32_t subscribe_count = 0;
- for(const subscribe_notify_one_test::service_info& i: subscribe_notify_one_test::service_infos) {
- if ((i.service_id == service_info_.service_id
- && i.instance_id == service_info_.instance_id)
- || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
- continue;
- }
-
- ++subscribe_count;
- app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_);
-
- VSOMEIP_DEBUG << "[" << std::hex << service_info_.service_id
- << "] subscribing to Service/Instance/Eventgroup ["
- << std::setw(4) << std::setfill('0') << std::hex << i.service_id << "/"
- << std::setw(4) << std::setfill('0') << std::hex << i.instance_id
- << "/" << std::setw(4) << std::setfill('0') << std::hex << i.eventgroup_id <<"]";
-
- }
-
- while (wait_until_notified_from_other_services_) {
- condition_.wait(its_lock);
- }
-
- // It is possible that we run in the case a subscription is NACKED
- // due to TCP endpoint not completely connected when subscription
- // is processed in the server - due to resubscribing the error handler
- // count may differ from expected value, but its not a real but as
- // the subscription takes places anyways and all events will be received.
- if (!subscription_error_occured_) {
- // 4 * subscribe count cause we installed three additional wild-card handlers
- ASSERT_EQ(subscribe_count * 4, subscription_state_handler_called_);
- } else {
- VSOMEIP_WARNING << "Subscription state handler check skipped: CallCount="
- << std::dec << subscription_state_handler_called_;
- }
- }
-
- void notify_one() {
- std::unique_lock<std::mutex> its_lock(notify_mutex_);
- while(wait_for_notify_) {
- notify_condition_.wait(its_lock);
- }
-
- // sleep a while before starting to notify this is necessary as it's not
- // possible to detect if _all_ clients on the remote side have
- // successfully subscribed as we only receive once subscription per
- // remote node no matter how many clients subscribed to this eventgroup
- // on the remote node
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
-
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Starting to notify";
-
- for(uint32_t i = 0; i < subscribe_notify_one_test::notifications_to_send; i++) {
- std::shared_ptr<vsomeip::payload> its_payload =
- vsomeip::runtime::get()->create_payload();
-
- vsomeip::byte_t its_data[10] = {0};
- for (uint32_t j = 0; j < i+1; ++j) {
- its_data[j] = static_cast<uint8_t>(j);
- }
- its_payload->set_data(its_data, i+1);
-
- for (vsomeip::client_t client : subscribers_) {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Notifying client: "
- << client << " : " << i+1;
- app_->notify_one(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_payload, client);
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(50));
- }
- }
-
- void wait_for_stop() {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id
- << "] Received notifications from all other services, going down";
-
- // wait until all notifications have been sent out
- notify_thread_.join();
-
- // let offer thread exit
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_notified_from_other_services_ = false;
- condition_.notify_one();
- }
-
- stop_offer();
-
- // ensure that the service which hosts the routing doesn't exit to early
- if (app_->is_routing()) {
- for (const auto& i : subscribe_notify_one_test::service_infos) {
- if ((i.service_id == service_info_.service_id
- && i.instance_id == service_info_.instance_id)
- || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
- continue;
- }
- while (app_->is_available(i.service_id, i.instance_id,
- vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR)) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- }
- }
-
- for(const auto& i : subscribe_notify_one_test::service_infos) {
- if ((i.service_id == service_info_.service_id
- && i.instance_id == service_info_.instance_id)
- || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
- continue;
- }
- app_->register_subscription_status_handler(i.service_id, i.instance_id,
- i.eventgroup_id, vsomeip::ANY_EVENT, nullptr);
- app_->unsubscribe(i.service_id, i.instance_id, i.eventgroup_id);
- app_->release_event(i.service_id, i.instance_id, i.event_id);
- app_->release_service(i.service_id, i.instance_id);
- }
- std::this_thread::sleep_for(std::chrono::seconds(1));
- app_->clear_all_handler();
- app_->stop();
- }
-
-private:
- subscribe_notify_one_test::service_info service_info_;
- vsomeip::subscription_type_e subscription_type_;
- std::shared_ptr<vsomeip::application> app_;
- std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
- std::map<std::pair<vsomeip::service_t, vsomeip::method_t>, std::uint32_t> other_services_received_notification_;
-
- bool wait_until_registered_;
- bool wait_until_other_services_available_;
- bool wait_until_notified_from_other_services_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::thread offer_thread_;
-
- bool wait_for_stop_;
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
- std::thread stop_thread_;
-
- bool wait_for_notify_;
- std::mutex notify_mutex_;
- std::condition_variable notify_condition_;
- std::thread notify_thread_;
-
- std::unordered_set<vsomeip::client_t> subscribers_;
- std::atomic<uint32_t> subscription_state_handler_called_;
- std::atomic<bool> subscription_error_occured_;
-
- std::mutex subscribers_mutex_;
-};
-
-static int service_number;
-static vsomeip::subscription_type_e subscription_type;
-
-TEST(someip_subscribe_notify_one_test, send_ten_notifications_to_service)
-{
- subscribe_notify_one_test_service its_sample(
- subscribe_notify_one_test::service_infos[service_number], subscription_type);
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 3) {
- std::cerr << "Please specify a service number and subscription type, like: " << argv[0] << " 2 UDP" << std::endl;
- std::cerr << "Valid service numbers are in the range of [1,6]" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
- return 1;
- }
-
- service_number = std::stoi(std::string(argv[1]), nullptr);
-
- if(std::string("TCP_AND_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE;
- } else if(std::string("PREFER_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE;
- } else if(std::string("PREFER_TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_RELIABLE;
- } else if(std::string("UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_UNRELIABLE;
- } else if(std::string("TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE;
- } else {
- std::cerr << "Wrong subscription type passed, exiting" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
- return 1;
- }
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh b/test/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh
deleted file mode 100755
index 47d0b2d..0000000
--- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-if [ $# -lt 2 ]
-then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Please pass a json file to this script."
- echo "For example: $0 UDP subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json"
- exit 1
-fi
-
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $1 ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
-
-FAIL=0
-# Start the services
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_four
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_one_test_service 4 $1 &
-
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_five
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_one_test_service 5 $1 &
-
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_one_test_service_six
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_one_test_service 6 $1 &
-
-# Wait until all applications are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if one of the binaries exits
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in
deleted file mode 100644
index 370cf98..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_master.json.in
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in
deleted file mode 100644
index 46de8ff..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_autoconfig_slave.json.in
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in
deleted file mode 100644
index 87299aa..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in
deleted file mode 100644
index 785bec0..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_master_tcp.json.in
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x1111",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x2222",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x3333",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- }
- ],
- "routing":"subscribe_notify_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-}
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in
deleted file mode 100644
index fa4c5a3..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_master.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1111",
- "instance":"0x0002",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x1111",
- "instance":"0x0003",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
deleted file mode 100644
index 66f1a83..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_same_service_id_slave.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"subscribe_notify_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"subscribe_notify_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0002",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0003",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in
deleted file mode 100644
index 5b110aa..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"subscribe_notify_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"subscribe_notify_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json.in
deleted file mode 100644
index d431acf..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_diff_ports_slave_tcp.json.in
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"subscribe_notify_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"subscribe_notify_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x4444",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x5555",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x6666",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- }
- ],
- "routing":"subscribe_notify_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-}
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in
deleted file mode 100644
index 81bb18e..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_master.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in
deleted file mode 100644
index 98ce9a6..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_partial_same_ports_slave.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"subscribe_notify_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"subscribe_notify_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in
deleted file mode 100644
index 253b55e..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in
deleted file mode 100644
index 376642e..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_master_tcp.json.in
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x1111",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x2222",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x3333",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- }
- ],
- "routing":"subscribe_notify_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in
deleted file mode 100644
index 556b10f..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"subscribe_notify_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"subscribe_notify_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json.in
deleted file mode 100644
index a0a4b2c..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_diff_client_ids_same_ports_slave_tcp.json.in
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_four",
- "id":"0x4444"
- },
- {
- "name":"subscribe_notify_test_service_five",
- "id":"0x5555"
- },
- {
- "name":"subscribe_notify_test_service_six",
- "id":"0x6666"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x4444",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x5555",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- },
- "events" :
- [
- {
- "event" : "0x6666",
- "is_field" : "true",
- "is_reliable" : "true"
- }
- ]
- }
- ],
- "routing":"subscribe_notify_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_master.json.in
deleted file mode 100644
index 0b0051a..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_master.json.in
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "unicast" : "@TEST_IP_MASTER@",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/var/log/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "subscribe_notify_test_client",
- "id" : "0x9999"
- }
- ],
- "routing" : "vsomeipd",
- "service-discovery" :
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "0",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-}
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json.in
deleted file mode 100644
index 558a873..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_tcp_slave.json.in
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- "unicast" : "@TEST_IP_SLAVE@",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "subscribe_notify_test_service",
- "id" : "0x8888"
- }
- ],
- "services" :
- [
- {
- "service" : "0xcafe",
- "instance" : "0x1",
- "reliable" : { "port":"30509", "enable-magic-cookies":"false" }
- }
- ],
- "routing" : "vsomeipd",
- "service-discovery" :
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "0",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-}
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json.in
deleted file mode 100644
index 1828a7a..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_one_event_two_eventgroups_udp_slave.json.in
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- "unicast" : "@TEST_IP_SLAVE@",
- "logging" :
- {
- "level" : "debug",
- "console" : "true",
- "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
- "dlt" : "false"
- },
- "applications" :
- [
- {
- "name" : "subscribe_notify_test_service",
- "id" : "0x8888"
- }
- ],
- "services" :
- [
- {
- "service" : "0xcafe",
- "instance" : "0x1",
- "unreliable" : "30509"
- }
- ],
- "routing" : "vsomeipd",
- "service-discovery" :
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "0",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-}
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in
deleted file mode 100644
index 87299aa..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_master.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30001",
- "reliable":
- {
- "port":"40001",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30002",
- "reliable":
- {
- "port":"40002",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30003",
- "reliable":
- {
- "port":"40003",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in
deleted file mode 100644
index bc13f01..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_diff_ports_slave.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_four",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_test_service_five",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_test_service_six",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30004",
- "reliable":
- {
- "port":"40004",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30005",
- "reliable":
- {
- "port":"40005",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30006",
- "reliable":
- {
- "port":"40006",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in
deleted file mode 100644
index 253b55e..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_master.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_MASTER@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_one",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_test_service_two",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_test_service_three",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x1111",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x2222",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x3333",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_one",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in b/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in
deleted file mode 100644
index c203e80..0000000
--- a/test/subscribe_notify_tests/conf/subscribe_notify_test_same_client_ids_same_ports_slave.json.in
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "unicast":"@TEST_IP_SLAVE@",
- "logging":
- {
- "level":"warning",
- "console":"true",
- "file":
- {
- "enable":"false",
- "path":"/tmp/vsomeip.log"
- },
- "dlt":"false"
- },
- "applications":
- [
- {
- "name":"subscribe_notify_test_service_four",
- "id":"0x1111"
- },
- {
- "name":"subscribe_notify_test_service_five",
- "id":"0x2222"
- },
- {
- "name":"subscribe_notify_test_service_six",
- "id":"0x3333"
- }
- ],
- "services":
- [
- {
- "service":"0x4444",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x5555",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- },
- {
- "service":"0x6666",
- "instance":"0x0001",
- "unreliable":"30000",
- "reliable":
- {
- "port":"40000",
- "enable-magic-cookies":"false"
- }
- }
- ],
- "routing":"subscribe_notify_test_service_four",
- "service-discovery":
- {
- "enable":"true",
- "multicast":"224.0.0.1",
- "port":"30490",
- "protocol":"udp",
- "initial_delay_min" : "10",
- "initial_delay_max" : "10",
- "repetitions_base_delay" : "30",
- "repetitions_max" : "3",
- "cyclic_offer_delay" : "1000",
- "ttl" : "3"
- }
-} \ No newline at end of file
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_globals.hpp b/test/subscribe_notify_tests/subscribe_notify_test_globals.hpp
deleted file mode 100644
index 761c3c4..0000000
--- a/test/subscribe_notify_tests/subscribe_notify_test_globals.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (C) 2014-2017 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 SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_
-#define SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_
-
-namespace subscribe_notify_test {
-
-struct service_info {
- vsomeip::service_t service_id;
- vsomeip::instance_t instance_id;
- vsomeip::method_t method_id;
- vsomeip::event_t event_id;
- vsomeip::eventgroup_t eventgroup_id;
-};
-
-static constexpr std::array<service_info, 7> service_infos = {{
- // placeholder to be consistent w/ client ids, service ids, app names
- { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF },
- // node 1
- { 0x1111, 0x1, 0x1111, 0x1111, 0x1000 },
- { 0x2222, 0x1, 0x2222, 0x2222, 0x2000 },
- { 0x3333, 0x1, 0x3333, 0x3333, 0x3000 },
- // node 2
- { 0x4444, 0x1, 0x4444, 0x4444, 0x4000 },
- { 0x5555, 0x1, 0x5555, 0x5555, 0x5000 },
- { 0x6666, 0x1, 0x6666, 0x6666, 0x6000 }
-}};
-
-static constexpr std::array<service_info, 7> service_infos_same_service_id = {{
- // placeholder to be consistent w/ client ids, service ids, app names
- { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF },
- // node 1
- { 0x1111, 0x1, 0x1111, 0x1111, 0x1000 },
- { 0x1111, 0x2, 0x2222, 0x2222, 0x2000 },
- { 0x1111, 0x3, 0x3333, 0x3333, 0x3000 },
- // node 2
- { 0x2222, 0x1, 0x4444, 0x4444, 0x4000 },
- { 0x2222, 0x2, 0x5555, 0x5555, 0x5000 },
- { 0x2222, 0x3, 0x6666, 0x6666, 0x6000 }
-}};
-
-static constexpr int notifications_to_send = 10;
-
-// one_event_two_eventgroups globals
-static constexpr struct service_info service_info_subscriber_based_notification =
- { 0xCAFE, 0x1, 0x8888, 0x8111, 0x1};
-static constexpr vsomeip::method_t shutdown_method_id = 0x6666;
-static constexpr vsomeip::method_t set_method_id = 0x7777;
-
-}
-
-#endif /* SUBSCRIBE_NOTIFY_TEST_GLOBALS_HPP_ */
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh
deleted file mode 100755
index 1e41c8e..0000000
--- a/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-if [ $# -lt 2 ]
-then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP subscribe_notify_test_diff_client_ids_diff_ports_master.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Please pass a json file to this script."
- echo "For example: $0 UDP subscribe_notify_test_diff_client_ids_diff_ports_master.json"
- echo "To use the same service id but different instances on the node pass SAME_SERVICE_ID as third parameter"
- exit 1
-fi
-
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $1 ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
-# replace master with slave to be able display the correct json file to be used
-# with the slave script
-MASTER_JSON_FILE=$2
-CLIENT_JSON_FILE=${MASTER_JSON_FILE/master/slave}
-
-FAIL=0
-
-# Start the services
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_one
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 1 $1 $3 &
-
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_two
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 2 $1 $3 &
-
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_three
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 3 $1 $3 &
-
-sleep 1
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting subscribe_notify_test_slave_starter.sh on slave LXC with parameters $1 $CLIENT_JSON_FILE $3"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./subscribe_notify_test_slave_starter.sh $1 $CLIENT_JSON_FILE $3\"" &
- echo "remote ssh job id: $!"
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name sntms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./subscribe_notify_test_slave_starter.sh $1 $CLIENT_JSON_FILE $3" &
-else
- cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** subscribe_notify_test_slave_starter.sh $1 $CLIENT_JSON_FILE $3
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** subscribe_notify_test_diff_client_ids_diff_ports_master.json and
-** subscribe_notify_test_diff_client_ids_diff_ports_slave.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-if [ ! -z "$USE_DOCKER" ]; then
- FAIL=0
-fi
-
-# Wait until client and service are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if either client or service exit
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop sntms
- docker rm sntms
-fi
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp
deleted file mode 100644
index 0b88e25..0000000
--- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_client.cpp
+++ /dev/null
@@ -1,380 +0,0 @@
-// Copyright (C) 2014-2017 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_ENABLE_SIGNAL_HANDLING
-#include <csignal>
-#endif
-#include <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <utility>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include <gtest/gtest.h>
-
-#include "subscribe_notify_test_globals.hpp"
-
-class subscribe_notify_test_one_event_two_eventgroups_client {
-public:
- subscribe_notify_test_one_event_two_eventgroups_client(
- struct subscribe_notify_test::service_info _info, bool _use_tcp) :
- app_(
- vsomeip::runtime::get()->create_application(
- "subscribe_notify_test_client")),
- info_(_info),
- use_tcp_(_use_tcp),
- wait_availability_(true),
- wait_set_value_(true),
- wait_shutdown_response_(true),
- run_thread_(std::bind(&subscribe_notify_test_one_event_two_eventgroups_client::run, this)) {
- }
- ~subscribe_notify_test_one_event_two_eventgroups_client() {
- run_thread_.join();
- }
-
- bool init() {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
-
- app_->register_state_handler(
- std::bind(
- &subscribe_notify_test_one_event_two_eventgroups_client::on_state,
- this, std::placeholders::_1));
-
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(
- &subscribe_notify_test_one_event_two_eventgroups_client::on_message,
- this, std::placeholders::_1));
-
- app_->register_availability_handler(info_.service_id, info_.instance_id,
- std::bind(
- &subscribe_notify_test_one_event_two_eventgroups_client::on_availability,
- this, std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
-
- std::set<vsomeip::eventgroup_t> its_groups;
- // the service offers three events in two eventgroups
- // one of the events is in both eventgroups (info_.event_id + 2)
- its_groups.insert(info_.eventgroup_id);
- app_->request_event(info_.service_id, info_.instance_id, info_.event_id, its_groups, true);
- app_->request_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id + 2), its_groups, true);
- its_groups.erase(info_.eventgroup_id);
- its_groups.insert(static_cast<vsomeip::eventgroup_t>(info_.eventgroup_id +1));
- app_->request_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id+1), its_groups, true);
- app_->request_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id+2), its_groups, true);
-
-
-
- return true;
- }
-
- void start() {
- app_->start();
- }
-
- void stop() {
- app_->clear_all_handler();
- app_->unsubscribe(info_.service_id, info_.instance_id, info_.eventgroup_id);
- app_->unsubscribe(info_.service_id, info_.instance_id, static_cast<vsomeip::eventgroup_t>(info_.eventgroup_id+1));
- app_->release_event(info_.service_id, info_.instance_id, info_.event_id);
- app_->release_event(info_.service_id, info_.instance_id, static_cast<vsomeip::event_t>(info_.event_id+1));
- app_->release_event(info_.service_id, info_.instance_id, static_cast<vsomeip::event_t>(info_.event_id+2));
- app_->release_service(info_.service_id, info_.instance_id);
- app_->stop();
- }
-
- void on_state(vsomeip::state_type_e _state) {
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- app_->request_service(info_.service_id, info_.instance_id);
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance,
- bool _is_available) {
- VSOMEIP_DEBUG << "Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service
- << "." << _instance << "] is "
- << (_is_available ? "available." : "NOT available.");
- if (_service == info_.service_id && _instance == info_.instance_id && _is_available) {
- std::lock_guard<std::mutex> its_lock(availability_mutex_);
- wait_availability_ = false;
- availability_condition_.notify_one();
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_response) {
- std::stringstream its_message;
- its_message << "Received a message ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _response->get_service() << "."
- << std::setw(4) << std::setfill('0') << std::hex
- << _response->get_instance() << "."
- << std::setw(4) << std::setfill('0') << std::hex
- << _response->get_method() << "] from Client/Session ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _response->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _response->get_session()
- << "] = ";
- std::shared_ptr<vsomeip::payload> its_payload =
- _response->get_payload();
- its_message << "(" << std::dec << its_payload->get_length() << ") ";
- for (uint32_t i = 0; i < its_payload->get_length(); ++i)
- its_message << std::hex << std::setw(2) << std::setfill('0')
- << (int) its_payload->get_data()[i] << " ";
- VSOMEIP_DEBUG << its_message.str();
- ASSERT_EQ(info_.service_id, _response->get_service());
-
- if (_response->get_method() == info_.method_id
- || _response->get_method() == subscribe_notify_test::shutdown_method_id) {
- ASSERT_EQ(vsomeip::message_type_e::MT_RESPONSE, _response->get_message_type());
- ASSERT_EQ(vsomeip::return_code_e::E_OK, _response->get_return_code());
- std::lock_guard<std::mutex> its_lock(shutdown_response_mutex_);
- wait_shutdown_response_ = false;
- shutdown_response_condition_.notify_one();
- } else if (_response->get_method() == subscribe_notify_test::set_method_id) {
- std::lock_guard<std::mutex> its_lock(set_value_mutex_);
- wait_set_value_ = false;
- set_value_condition_.notify_one();
- } else if (_response->get_method() >= info_.event_id
- && _response->get_method() <= static_cast<vsomeip::event_t>(info_.event_id + 3)) {
- std::lock_guard<std::mutex> its_lock(events_mutex_);
- received_events_.push_back(_response->get_payload());
- if (received_events_.size() > 4) {
- ADD_FAILURE() << "Received too much events";
- }
- number_received_events_[_response->get_method()]++;
- events_condition_.notify_one();
- } else {
- ADD_FAILURE() << "Received unknown method id: " << std::setw(4)
- << std::setfill('0') << std::hex << _response->get_method();
- }
-
- }
-
- void set_field_at_service(vsomeip::byte_t _value) {
- std::shared_ptr<vsomeip::runtime> its_runtime = vsomeip::runtime::get();
- std::shared_ptr<vsomeip::message> its_request = its_runtime->create_request(false);
- its_request->set_service(info_.service_id);
- its_request->set_instance(info_.instance_id);
- its_request->set_method(subscribe_notify_test::set_method_id);
- its_request->set_reliable(use_tcp_);
- std::shared_ptr<vsomeip::payload> its_payload = its_runtime->create_payload(&_value, sizeof(_value));
- its_request->set_payload(its_payload);
- app_->send(its_request);
- }
-
- void call_method_at_service(vsomeip::method_t _method) {
- std::shared_ptr<vsomeip::runtime> its_runtime = vsomeip::runtime::get();
- std::shared_ptr<vsomeip::message> its_request = its_runtime->create_request(false);
- its_request->set_service(info_.service_id);
- its_request->set_instance(info_.instance_id);
- its_request->set_method(_method);
- its_request->set_reliable(use_tcp_);
- app_->send(its_request);
- }
-
- void wait_on_condition(std::unique_lock<std::mutex>&& _lock, bool *_predicate, std::condition_variable&& _condition, std::uint32_t _timeout) {
- while (*_predicate) {
- if (std::cv_status::timeout == _condition.wait_for(_lock, std::chrono::seconds(_timeout))) {
- ADD_FAILURE() << "Condition variable wasn't notified within time ("
- << _timeout << "sec)";
- }
- }
- *_predicate = true;
- }
-
- void subscribe_at_service() {
- // subscribe to both eventgroups
- app_->subscribe(info_.service_id, info_.instance_id, info_.eventgroup_id);
- app_->subscribe(info_.service_id, info_.instance_id, static_cast<vsomeip::eventgroup_t>(info_.eventgroup_id+1));
- }
-
- void unsubscribe_at_service() {
- app_->unsubscribe(info_.service_id, info_.instance_id, info_.eventgroup_id);
- app_->unsubscribe(info_.service_id, info_.instance_id, static_cast<vsomeip::eventgroup_t>(info_.eventgroup_id+1));
- }
-
- void wait_for_events(std::unique_lock<std::mutex>&& _lock,
- std::uint32_t _expected_number_received_events,
- std::condition_variable&& _condition) {
- std::cv_status its_status(std::cv_status::no_timeout);
- while (received_events_.size() != _expected_number_received_events
- && its_status != std::cv_status::timeout) {
- its_status = _condition.wait_for(_lock, std::chrono::seconds(15));
- if (std::cv_status::timeout == its_status) {
- ADD_FAILURE() << "Didn't receive expected number of events: "
- << _expected_number_received_events
- << " within time. Instead received: " << received_events_.size();
- }
- }
- ASSERT_EQ(size_t(_expected_number_received_events), received_events_.size());
- }
-
- void check_received_events_payload(vsomeip::byte_t _value) {
- for (const auto &p : received_events_) {
- ASSERT_EQ(vsomeip::length_t(1), p->get_length());
- ASSERT_EQ(vsomeip::byte_t(_value), *p->get_data());
- }
- received_events_.clear();
- }
-
- void check_received_events_number(std::set<std::pair<vsomeip::event_t, std::uint32_t>> _expected) {
- for (const auto &e : _expected) {
- auto event = number_received_events_.find(e.first);
- ASSERT_NE(number_received_events_.end(), event);
- ASSERT_EQ(e.second, event->second);
- }
- number_received_events_.clear();
- }
-
- void run() {
- std::unique_lock<std::mutex> its_availability_lock(availability_mutex_);
- wait_on_condition(std::move(its_availability_lock), &wait_availability_, std::move(availability_condition_), 300);
- // service is available now
-
- for (int i = 0; i < 3; i++) {
- // set value
- set_field_at_service(0x1);
- std::unique_lock<std::mutex> its_set_value_lock(set_value_mutex_);
- wait_on_condition(std::move(its_set_value_lock), &wait_set_value_, std::move(set_value_condition_), 30);
-
- // subscribe
- std::unique_lock<std::mutex> its_events_lock(events_mutex_);
- subscribe_at_service();
- wait_for_events(std::move(its_events_lock), 4, std::move(events_condition_));
- check_received_events_payload(0x1);
-
- std::set<std::pair<vsomeip::event_t, std::uint32_t>> its_expected;
- its_expected.insert({info_.event_id, 1});
- its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+1), 1});
- // Initial event for the event which is member of both eventgroups has to be sent twice
- its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+2), 2});
-
- check_received_events_number(its_expected);
- its_expected.clear();
-
- // set value again
- set_field_at_service(0x2);
- wait_on_condition(std::move(its_set_value_lock), &wait_set_value_, std::move(set_value_condition_), 30);
-
- wait_for_events(std::move(its_events_lock), 3, std::move(events_condition_));
- check_received_events_payload(0x2);
- its_expected.insert({info_.event_id, 1});
- its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+1), 1});
- its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+2), 1});
-
- check_received_events_number(its_expected);
- its_expected.clear();
-
-
- // set value again
- set_field_at_service(0x3);
- wait_on_condition(std::move(its_set_value_lock), &wait_set_value_, std::move(set_value_condition_), 30);
- wait_for_events(std::move(its_events_lock), 3, std::move(events_condition_));
- check_received_events_payload(0x3);
- its_expected.insert({info_.event_id, 1});
- its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+1), 1});
- its_expected.insert({static_cast<vsomeip::event_t>(info_.event_id+2), 1});
- check_received_events_number(its_expected);
-
- unsubscribe_at_service();
- // sleep some time to ensure the unsubscription was processed by the
- // remote routing_manager before setting the field again in the next
- // loop.
- std::this_thread::sleep_for(std::chrono::milliseconds(1000));
- }
- std::unique_lock<std::mutex> its_shutdown_lock(shutdown_response_mutex_);
- call_method_at_service(subscribe_notify_test::shutdown_method_id);
- wait_on_condition(std::move(its_shutdown_lock), &wait_shutdown_response_, std::move(shutdown_response_condition_), 30);
- stop();
- }
-
-private:
- std::shared_ptr<vsomeip::application> app_;
- struct subscribe_notify_test::service_info info_;
- bool use_tcp_;
-
- bool wait_availability_;
- std::mutex availability_mutex_;
- std::condition_variable availability_condition_;
-
- bool wait_set_value_;
- std::mutex set_value_mutex_;
- std::condition_variable set_value_condition_;
-
- bool wait_shutdown_response_;
- std::mutex shutdown_response_mutex_;
- std::condition_variable shutdown_response_condition_;
-
- std::mutex events_mutex_;
- std::condition_variable events_condition_;
-
- std::vector<std::shared_ptr<vsomeip::payload>> received_events_;
- std::map<vsomeip::event_t, std::uint32_t> number_received_events_;
- std::thread run_thread_;
-};
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- subscribe_notify_test_one_event_two_eventgroups_client *its_client_ptr(nullptr);
- void handle_signal(int _signal) {
- if (its_client_ptr != nullptr &&
- (_signal == SIGINT || _signal == SIGTERM))
- its_client_ptr->stop();
- }
-#endif
-
-static bool use_tcp;
-
-TEST(someip_subscribe_notify_test_one_event_two_eventgroups, subscribe_to_service)
-{
- subscribe_notify_test_one_event_two_eventgroups_client its_client(
- subscribe_notify_test::service_info_subscriber_based_notification, use_tcp);
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- its_client_ptr = &its_client;
- signal(SIGINT, handle_signal);
- signal(SIGTERM, handle_signal);
-#endif
- if (its_client.init()) {
- its_client.start();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 2) {
- std::cerr << "Please specify a subscription type, like: " << argv[0] << " UDP" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[UDP, TCP]" << std::endl;
- return 1;
- }
-
- if(std::string("TCP") == std::string(argv[1])) {
- use_tcp = true;
- } else if(std::string("UDP") == std::string(argv[1])) {
- use_tcp = false;
- } else {
- std::cerr << "Wrong subscription type passed, exiting" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[UDP, TCP]" << std::endl;
- return 1;
- }
-
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_starter.sh
deleted file mode 100755
index c983369..0000000
--- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_master_starter.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-if [ $# -lt 2 ]; then
- echo "Please pass a json file and a subscription type to this script."
- echo "Valid subscription types include:"
- echo " [UDP, TCP]"
- echo "For example: $0 UDP subscribe_notify_test_one_event_two_eventgroups_master.json"
- exit 1
-fi
-
-# replace master with slave to be able display the correct json file to be used
-# with the slave script
-MASTER_JSON_FILE=$2
-if [ $1 == "UDP" ]; then
- SLAVE_JSON_FILE=${MASTER_JSON_FILE/master/udp_slave}
-elif [ $1 == "TCP" ]; then
- SLAVE_JSON_FILE=${MASTER_JSON_FILE/master/tcp_slave}
-fi
-
-FAIL=0
-
-export VSOMEIP_CONFIGURATION=$2
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-
-# Start the client
-./subscribe_notify_test_one_event_two_eventgroups_client $1 &
-PID_CLIENT=$!
-sleep 1
-
-if [ ! -z "$USE_LXC_TEST" ]; then
- echo "starting subscribe_notify_test_slave_starter.sh on slave LXC with parameters $SLAVE_JSON_FILE"
- ssh -tt -i $SANDBOX_ROOT_DIR/commonapi_main/lxc-config/.ssh/mgc_lxc/rsa_key_file.pub -o StrictHostKeyChecking=no root@$LXC_TEST_SLAVE_IP "bash -ci \"set -m; cd \\\$SANDBOX_TARGET_DIR/vsomeip/test; ./subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh $SLAVE_JSON_FILE\"" &
- echo "remote ssh job id: $!"
-elif [ ! -z "$USE_DOCKER" ]; then
- docker run --name sntms --cap-add NET_ADMIN $DOCKER_IMAGE sh -c "route add -net 224.0.0.0/4 dev eth0 && cd $DOCKER_TESTS && ./subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh $SLAVE_JSON_FILE" &
-else
- cat <<End-of-message
-*******************************************************************************
-*******************************************************************************
-** Please now run:
-** subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh $SLAVE_JSON_FILE
-** from an external host to successfully complete this test.
-**
-** You probably will need to adapt the 'unicast' settings in
-** subscribe_notify_test_diff_client_ids_diff_ports_master.json and
-** subscribe_notify_test_diff_client_ids_diff_ports_slave.json to your personal setup.
-*******************************************************************************
-*******************************************************************************
-End-of-message
-fi
-
-if [ ! -z "$USE_DOCKER" ]; then
- FAIL=0
-fi
-
-# wait until client exits successfully
-wait $PID_CLIENT || FAIL=$(($FAIL+1))
-
-
-# kill daemon
-kill $PID_VSOMEIPD
-wait $PID_VSOMEIPD || FAIL=$(($FAIL+1))
-
-if [ ! -z "$USE_DOCKER" ]; then
- docker stop sntms
- docker rm sntms
-fi
-
-echo ""
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]; then
- exit 0
-else
- exit 1
-fi
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_service.cpp b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_service.cpp
deleted file mode 100644
index 1d7b0c3..0000000
--- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_service.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright (C) 2014-2017 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_ENABLE_SIGNAL_HANDLING
-#include <csignal>
-#endif
-#include <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <atomic>
-
-#include <gtest/gtest.h>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include <vsomeip/vsomeip.hpp>
-
-#include "subscribe_notify_test_globals.hpp"
-
-class subscribe_notify_test_one_event_two_eventgroups_service {
-public:
- subscribe_notify_test_one_event_two_eventgroups_service(subscribe_notify_test::service_info _info) :
- app_(vsomeip::runtime::get()->create_application()),
- wait_for_shutdown_(true),
- info_(_info),
- notify_thread_(std::bind(&subscribe_notify_test_one_event_two_eventgroups_service::wait_for_shutdown, this)) {
- }
-
- ~subscribe_notify_test_one_event_two_eventgroups_service() {
- notify_thread_.join();
- }
-
- bool init() {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return false;
- }
- app_->register_state_handler(
- std::bind(&subscribe_notify_test_one_event_two_eventgroups_service::on_state, this,
- std::placeholders::_1));
-
- app_->register_message_handler(
- info_.service_id,
- info_.instance_id,
- subscribe_notify_test::set_method_id,
- std::bind(&subscribe_notify_test_one_event_two_eventgroups_service::on_set, this,
- std::placeholders::_1));
-
- app_->register_message_handler(
- info_.service_id,
- info_.instance_id,
- info_.method_id,
- std::bind(&subscribe_notify_test_one_event_two_eventgroups_service::on_message, this,
- std::placeholders::_1));
-
- app_->register_message_handler(
- info_.service_id,
- info_.instance_id,
- subscribe_notify_test::shutdown_method_id,
- std::bind(&subscribe_notify_test_one_event_two_eventgroups_service::on_shutdown, this,
- std::placeholders::_1));
-
- std::set<vsomeip::eventgroup_t> its_groups;
- // the service offers three events in two eventgroups
- // one of the events is in both eventgroups
- its_groups.insert(info_.eventgroup_id);
- app_->offer_event(info_.service_id, info_.instance_id,
- info_.event_id, its_groups, true);
- app_->offer_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id + 2), its_groups, true);
- its_groups.erase(info_.eventgroup_id);
- its_groups.insert(static_cast<vsomeip::eventgroup_t>(info_.eventgroup_id + 1));
- app_->offer_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id + 1), its_groups, true);
- app_->offer_event(info_.service_id, info_.instance_id,
- static_cast<vsomeip::event_t>(info_.event_id + 2), its_groups, true);
- payload_ = vsomeip::runtime::get()->create_payload();
-
- return true;
- }
-
- void start() {
- app_->start();
- }
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- /*
- * Handle signal to shutdown
- */
- void stop() {
- {
- std::lock_guard<std::mutex> its_lock(shutdown_mutex_);
- wait_for_shutdown_ = false;
- shutdown_condition_.notify_one();
- }
- app_->clear_all_handler();
- stop_offer();
- notify_thread_.join();
- app_->stop();
- }
-#endif
-
- void offer() {
- app_->offer_service(info_.service_id, info_.instance_id);
- }
-
- void stop_offer() {
- app_->stop_offer_service(info_.service_id, info_.instance_id);
- }
-
- void on_state(vsomeip::state_type_e _state) {
- std::cout << "Application " << app_->get_name() << " is "
- << (_state == vsomeip::state_type_e::ST_REGISTERED ?
- "registered." : "deregistered.") << std::endl;
-
- if (_state == vsomeip::state_type_e::ST_REGISTERED) {
- offer();
- }
- }
-
- void on_shutdown(const std::shared_ptr<vsomeip::message> &_message) {
- std::shared_ptr<vsomeip::message> its_response
- = vsomeip::runtime::get()->create_response(_message);
- its_response->set_payload(payload_);
- app_->send(its_response, true);
- {
- std::lock_guard<std::mutex> its_lock(shutdown_mutex_);
- wait_for_shutdown_ = false;
- shutdown_condition_.notify_one();
- }
- }
-
- void on_set(const std::shared_ptr<vsomeip::message> &_message) {
- std::shared_ptr<vsomeip::message> its_response
- = vsomeip::runtime::get()->create_response(_message);
- payload_ = _message->get_payload();
- its_response->set_payload(payload_);
- app_->send(its_response, true);
- app_->notify(info_.service_id, info_.instance_id, info_.event_id, payload_);
- app_->notify(info_.service_id, info_.instance_id, static_cast<vsomeip::event_t>(info_.event_id + 1), payload_);
- app_->notify(info_.service_id, info_.instance_id, static_cast<vsomeip::event_t>(info_.event_id + 2), payload_);
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- app_->send(vsomeip::runtime::get()->create_response(_message),true);
- }
-
- void wait_for_shutdown() {
- {
- std::unique_lock<std::mutex> its_lock(shutdown_mutex_);
- while (wait_for_shutdown_) {
- shutdown_condition_.wait(its_lock);
- }
- wait_for_shutdown_= true;
- }
-
- app_->clear_all_handler();
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- stop_offer();
- app_->stop();
- }
-
-private:
- std::shared_ptr<vsomeip::application> app_;
-
- std::mutex shutdown_mutex_;
- bool wait_for_shutdown_;
- std::condition_variable shutdown_condition_;
-
- std::shared_ptr<vsomeip::payload> payload_;
-
- subscribe_notify_test::service_info info_;
-
- std::thread notify_thread_;
-};
-
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- subscribe_notify_test_one_event_two_eventgroups_service *its_service_ptr(nullptr);
- void handle_signal(int _signal) {
- if (its_service_ptr != nullptr &&
- (_signal == SIGINT || _signal == SIGTERM))
- its_service_ptr->stop();
- }
-#endif
-
-
-TEST(someip_subscribe_notify_test_one_event_two_eventgroups, wait_for_attribute_set)
-{
- subscribe_notify_test_one_event_two_eventgroups_service its_service(
- subscribe_notify_test::service_info_subscriber_based_notification);
-#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
- its_service_ptr = &its_service;
- signal(SIGINT, handle_signal);
- signal(SIGTERM, handle_signal);
-#endif
- if (its_service.init()) {
- its_service.start();
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
-
-
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh
deleted file mode 100755
index 8138612..0000000
--- a/test/subscribe_notify_tests/subscribe_notify_test_one_event_two_eventgroups_slave_starter.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-if [ $# -lt 1 ]; then
- echo "Please pass a json file to this script."
- echo "For example: $0 subscribe_notify_test_one_event_two_eventgroups_slave.json"
- exit 1
-fi
-
-FAIL=0
-
-export VSOMEIP_CONFIGURATION=$1
-# start daemon
-../daemon/./vsomeipd &
-PID_VSOMEIPD=$!
-
-# Start the services
-./subscribe_notify_test_one_event_two_eventgroups_service &
-PID_SERVICE=$!
-
-# wait until service exits successfully
-wait $PID_SERVICE || FAIL=$(($FAIL+1))
-
-
-# kill daemon
-kill $PID_VSOMEIPD
-wait $PID_VSOMEIPD || FAIL=$(($FAIL+1))
-
-echo ""
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]; then
- exit 0
-else
- exit 1
-fi
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_service.cpp b/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
deleted file mode 100644
index 968d9ed..0000000
--- a/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
+++ /dev/null
@@ -1,520 +0,0 @@
-// Copyright (C) 2014-2017 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 <chrono>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <thread>
-#include <map>
-#include <algorithm>
-#include <atomic>
-
-#include <gtest/gtest.h>
-
-#include <vsomeip/vsomeip.hpp>
-#include "../../implementation/logging/include/logger.hpp"
-
-#include "subscribe_notify_test_globals.hpp"
-
-
-class subscribe_notify_test_service {
-public:
- subscribe_notify_test_service(struct subscribe_notify_test::service_info _service_info,
- vsomeip::subscription_type_e _subscription_type,
- std::array<subscribe_notify_test::service_info, 7> _service_infos) :
- service_info_(_service_info),
- service_infos_(_service_infos),
- subscription_type_(_subscription_type),
- app_(vsomeip::runtime::get()->create_application()),
- wait_until_registered_(true),
- wait_until_other_services_available_(true),
- wait_until_notified_from_other_services_(true),
- offer_thread_(std::bind(&subscribe_notify_test_service::run, this)),
- wait_for_stop_(true),
- stop_thread_(std::bind(&subscribe_notify_test_service::wait_for_stop, this)),
- wait_for_notify_(true),
- notify_thread_(std::bind(&subscribe_notify_test_service::notify, this)),
- subscription_state_handler_called_(0),
- subscription_error_occured_(false) {
- if (!app_->init()) {
- ADD_FAILURE() << "Couldn't initialize application";
- return;
- }
- app_->register_state_handler(
- std::bind(&subscribe_notify_test_service::on_state, this,
- std::placeholders::_1));
- app_->register_message_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.method_id,
- std::bind(&subscribe_notify_test_service::on_request, this,
- std::placeholders::_1));
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(&subscribe_notify_test_service::on_message, this,
- std::placeholders::_1));
-
- // offer event
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(service_info_.eventgroup_id);
- app_->offer_event(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_eventgroups, true);
-
-
- // register availability for all other services and request their event.
- for(const auto& i : service_infos_) {
- if ((i.service_id == service_info_.service_id
- && i.instance_id == service_info_.instance_id)
- || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
- continue;
- }
- app_->request_service(i.service_id, i.instance_id);
- app_->register_availability_handler(i.service_id, i.instance_id,
- std::bind(&subscribe_notify_test_service::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
-
- auto handler = std::bind(&subscribe_notify_test_service::on_subscription_state_change, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3, std::placeholders::_4, std::placeholders::_5);
- app_->register_subscription_status_handler(i.service_id, i.instance_id, i.eventgroup_id, vsomeip::ANY_EVENT, handler);
-
-
- std::set<vsomeip::eventgroup_t> its_eventgroups;
- its_eventgroups.insert(i.eventgroup_id);
- app_->request_event(i.service_id, i.instance_id, i.event_id, its_eventgroups, true);
-
- other_services_available_[std::make_pair(i.service_id, i.instance_id)] = false;
- other_services_received_notification_[std::make_pair(i.service_id, i.method_id)] = 0;
- }
-
- // register subscription handler to detect whether or not all other
- // other services have subscribed
- app_->register_subscription_handler(service_info_.service_id,
- service_info_.instance_id, service_info_.eventgroup_id,
- std::bind(&subscribe_notify_test_service::on_subscription, this,
- std::placeholders::_1, std::placeholders::_2));
-
- app_->start();
- }
-
- ~subscribe_notify_test_service() {
- offer_thread_.join();
- stop_thread_.join();
- }
-
- void offer() {
- app_->offer_service(service_info_.service_id, service_info_.instance_id);
- }
-
- void stop_offer() {
- app_->stop_offer_service(service_info_.service_id, service_info_.instance_id);
- }
-
- void 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) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_registered_ = false;
- condition_.notify_one();
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- if(_is_available) {
- auto its_service = other_services_available_.find(std::make_pair(_service, _instance));
- if(its_service != other_services_available_.end()) {
- if(its_service->second != _is_available) {
- its_service->second = true;
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Service ["
- << std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
- << "] is available.";
-
- }
- }
-
- if(std::all_of(other_services_available_.cbegin(),
- other_services_available_.cend(),
- [](const std::map<std::pair<vsomeip::service_t,
- vsomeip::instance_t>, bool>::value_type& v) {
- return v.second;})) {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_other_services_available_ = false;
- condition_.notify_one();
- }
- }
- }
-
- void on_subscription_state_change(const vsomeip::service_t _service, const vsomeip::instance_t _instance,
- const vsomeip::eventgroup_t _eventgroup, const vsomeip::event_t _event, const uint16_t _error) {
- (void)_service;
- (void)_instance;
- (void)_eventgroup;
- (void)_event;
-
- if (!_error) {
- subscription_state_handler_called_++;
- } else {
- subscription_error_occured_ = true;
- VSOMEIP_WARNING << std::hex << app_->get_client()
- << " : on_subscription_state_change: for service " << std::hex
- << _service << " received a subscription error!";
- }
- }
-
- bool on_subscription(vsomeip::client_t _client, bool _subscribed) {
- std::lock_guard<std::mutex> its_lock(subscribers_mutex_);
- static bool notified(false);
- if (_subscribed) {
- subscribers_.insert(_client);
- } else {
- subscribers_.erase(_client);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] " << "Client: "
- << std::setw(4) << std::setfill('0') << std::hex << _client
- << (_subscribed ? " subscribed" : " unsubscribed")
- << ", now have " << std::dec << subscribers_.size()
- << " subscribers" ;
- // check if all other services have subscribed:
- // -1 for placeholder in array
- // divide by two because we only receive once subscription per remote node
- // no matter how many clients subscribed to this eventgroup on the remote node
- if(!notified && subscribers_.size() == (service_infos_.size() - 1) / 2 )
- {
- // notify the notify thread to start sending out notifications
- std::lock_guard<std::mutex> its_lock(notify_mutex_);
- wait_for_notify_ = false;
- notify_condition_.notify_one();
- notified = true;
- }
- return true;
- }
-
- void on_request(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_REQUEST) {
- VSOMEIP_DEBUG << "Received a request with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "]";
- std::shared_ptr<vsomeip::message> its_response = vsomeip::runtime::get()
- ->create_response(_message);
- app_->send(its_response);
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_message) {
- if(_message->get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) {
-
- other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())]++;
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] "
- << "Received a notification with Client/Session [" << std::setw(4)
- << std::setfill('0') << std::hex << _message->get_client() << "/"
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_session() << "] from Service/Method ["
- << std::setw(4) << std::setfill('0') << std::hex
- << _message->get_service() << "/" << std::setw(4) << std::setfill('0')
- << std::hex << _message->get_method() <<"] (now have: "
- << std::dec << other_services_received_notification_[std::make_pair(_message->get_service(),
- _message->get_method())] << ")";
-
- bool notify(false);
- switch(subscription_type_) {
- case vsomeip::subscription_type_e::SU_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_RELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE:
- case vsomeip::subscription_type_e::SU_PREFER_RELIABLE:
- case vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE:
- if (all_notifications_received()) {
- notify = true;
- }
- break;
- }
-
- if(notify) {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- wait_for_stop_ = false;
- stop_condition_.notify_one();
- }
- }
- }
-
- bool all_notifications_received() {
- return std::all_of(
- other_services_received_notification_.cbegin(),
- other_services_received_notification_.cend(),
- [&](const std::map<std::pair<vsomeip::service_t,
- vsomeip::method_t>, std::uint32_t>::value_type& v)
- {
- return v.second == subscribe_notify_test::notifications_to_send;
- }
- );
- }
-
- bool all_notifications_received_tcp_and_udp() {
- std::uint32_t received_twice(0);
- std::uint32_t received_normal(0);
- for(const auto &v : other_services_received_notification_) {
- if (v.second == subscribe_notify_test::notifications_to_send * 2) {
- received_twice++;
- } else if(v.second == subscribe_notify_test::notifications_to_send) {
- received_normal++;
- }
- }
-
- if( received_twice == (service_infos_.size() - 1) / 2
- && received_normal == (service_infos_.size() - 1) / 2 - 1) {
- // routing manager stub receives the notification
- // - twice from external nodes
- // - and normal from all internal nodes
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] "
- << "Received notifications:"
- << " Normal: " << received_normal
- << " Twice: " << received_twice;
- return true;
- }
- return false;
- }
-
- void run() {
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Running";
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_until_registered_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Offering";
- offer();
-
-
- while (wait_until_other_services_available_) {
- condition_.wait(its_lock);
- }
-
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Subscribing";
- // subscribe to events of other services
- uint32_t subscribe_count = 0;
- for(const subscribe_notify_test::service_info& i: service_infos_) {
- if ((i.service_id == service_info_.service_id
- && i.instance_id == service_info_.instance_id)
- || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
- continue;
- }
- ++subscribe_count;
- app_->subscribe(i.service_id, i.instance_id, i.eventgroup_id,
- vsomeip::DEFAULT_MAJOR, subscription_type_);
- VSOMEIP_DEBUG << "[" << std::hex << service_info_.service_id
- << "] subscribing to Service/Instance/Eventgroup ["
- << std::setw(4) << std::setfill('0') << std::hex << i.service_id << "/"
- << std::setw(4) << std::setfill('0') << std::hex << i.instance_id
- << "/" << std::setw(4) << std::setfill('0') << std::hex << i.eventgroup_id <<"]";
- }
-
- while (wait_until_notified_from_other_services_) {
- condition_.wait(its_lock);
- }
-
- // It is possible that we run in the case a subscription is NACKED
- // due to TCP endpoint not completely connected when subscription
- // is processed in the server - due to resubscribing the error handler
- // count may differ from expected value, but its not a real but as
- // the subscription takes places anyways and all events will be received.
- if (!subscription_error_occured_) {
- ASSERT_EQ(subscribe_count, subscription_state_handler_called_);
- } else {
- VSOMEIP_WARNING << "Subscription state handler check skipped: CallCount="
- << std::dec << subscription_state_handler_called_;
- }
- }
-
- void notify() {
- std::unique_lock<std::mutex> its_lock(notify_mutex_);
- while(wait_for_notify_) {
- notify_condition_.wait(its_lock);
- }
-
- // sleep a while before starting to notify this is necessary as it's not
- // possible to detect if _all_ clients on the remote side have
- // successfully subscribed as we only receive once subscription per
- // remote node no matter how many clients subscribed to this eventgroup
- // on the remote node
- std::this_thread::sleep_for(std::chrono::milliseconds(1000));
-
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Starting to notify";
-
- for(uint32_t i = 0; i < subscribe_notify_test::notifications_to_send; i++) {
- std::shared_ptr<vsomeip::payload> its_payload =
- vsomeip::runtime::get()->create_payload();
-
- vsomeip::byte_t its_data[10] = {0};
- for (uint32_t j = 0; j < i+1; ++j) {
- its_data[j] = static_cast<uint8_t>(j);
- }
- its_payload->set_data(its_data, i+1);
- VSOMEIP_DEBUG << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id << "] Notifying: " << i+1;
- app_->notify(service_info_.service_id, service_info_.instance_id,
- service_info_.event_id, its_payload);
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- }
-
- void wait_for_stop() {
- std::unique_lock<std::mutex> its_lock(stop_mutex_);
- while (wait_for_stop_) {
- stop_condition_.wait(its_lock);
- }
-
- // wait until all notifications have been sent out
- notify_thread_.join();
-
- VSOMEIP_INFO << "[" << std::setw(4) << std::setfill('0') << std::hex
- << service_info_.service_id
- << "] Received notifications from all other services, going down";
-
- // let offer thread exit
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_until_notified_from_other_services_ = false;
- condition_.notify_one();
- }
-
- stop_offer();
-
- // ensure that the service which hosts the routing doesn't exit to early
- if (app_->is_routing()) {
- for (const auto& i : service_infos_) {
- if ((i.service_id == service_info_.service_id
- && i.instance_id == service_info_.instance_id)
- || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
- continue;
- }
- while (app_->is_available(i.service_id, i.instance_id,
- vsomeip::ANY_MAJOR, vsomeip::ANY_MINOR)) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
- }
- }
-
- std::this_thread::sleep_for(std::chrono::seconds(1));
- for(const auto& i : service_infos_) {
- if ((i.service_id == service_info_.service_id
- && i.instance_id == service_info_.instance_id)
- || (i.service_id == 0xFFFF && i.instance_id == 0xFFFF)) {
- continue;
- }
- app_->register_subscription_status_handler(i.service_id, i.instance_id,
- i.eventgroup_id, vsomeip::ANY_EVENT, nullptr);
- app_->unsubscribe(i.service_id, i.instance_id, i.eventgroup_id);
- app_->release_event(i.service_id, i.instance_id, i.event_id);
- app_->release_service(i.service_id, i.instance_id);
- }
- app_->clear_all_handler();
- app_->stop();
- }
-
-private:
- subscribe_notify_test::service_info service_info_;
- std::array<subscribe_notify_test::service_info, 7> service_infos_;
- vsomeip::subscription_type_e subscription_type_;
- std::shared_ptr<vsomeip::application> app_;
- std::map<std::pair<vsomeip::service_t, vsomeip::instance_t>, bool> other_services_available_;
- std::map<std::pair<vsomeip::service_t, vsomeip::method_t>, std::uint32_t> other_services_received_notification_;
-
- bool wait_until_registered_;
- bool wait_until_other_services_available_;
- bool wait_until_notified_from_other_services_;
- std::mutex mutex_;
- std::condition_variable condition_;
- std::thread offer_thread_;
-
- bool wait_for_stop_;
- std::mutex stop_mutex_;
- std::condition_variable stop_condition_;
- std::thread stop_thread_;
-
- std::set<vsomeip::client_t> subscribers_;
- bool wait_for_notify_;
- std::mutex notify_mutex_;
- std::condition_variable notify_condition_;
- std::thread notify_thread_;
- std::atomic<uint32_t> subscription_state_handler_called_;
- std::atomic<bool> subscription_error_occured_;
-
- std::mutex subscribers_mutex_;
-};
-
-static int service_number;
-static vsomeip::subscription_type_e subscription_type;
-static bool use_same_service_id;
-
-TEST(someip_subscribe_notify_test, send_ten_notifications_to_service)
-{
- if(use_same_service_id) {
- subscribe_notify_test_service its_sample(
- subscribe_notify_test::service_infos_same_service_id[service_number],
- subscription_type,
- subscribe_notify_test::service_infos_same_service_id);
- } else {
- subscribe_notify_test_service its_sample(
- subscribe_notify_test::service_infos[service_number], subscription_type,
- subscribe_notify_test::service_infos);
- }
-}
-
-#ifndef _WIN32
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
- if(argc < 3) {
- std::cerr << "Please specify a service number and subscription type, like: " << argv[0] << " 2 UDP SAME_SERVICE_ID" << std::endl;
- std::cerr << "Valid service numbers are in the range of [1,6]" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
- std::cerr << "If SAME_SERVICE_ID is specified as third parameter the test is run w/ multiple instances of the same service" << std::endl;
- return 1;
- }
-
- service_number = std::stoi(std::string(argv[1]), nullptr);
-
- if(std::string("TCP_AND_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE;
- } else if(std::string("PREFER_UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE;
- } else if(std::string("PREFER_TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_PREFER_RELIABLE;
- } else if(std::string("UDP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_UNRELIABLE;
- } else if(std::string("TCP") == std::string(argv[2])) {
- subscription_type = vsomeip::subscription_type_e::SU_RELIABLE;
- } else {
- std::cerr << "Wrong subscription type passed, exiting" << std::endl;
- std::cerr << "Valid subscription types include:" << std::endl;
- std::cerr << "[TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]" << std::endl;
- return 1;
- }
-
- if (argc >= 4 && std::string("SAME_SERVICE_ID") == std::string(argv[3])) {
- use_same_service_id = true;
- } else {
- use_same_service_id = false;
- }
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh
deleted file mode 100755
index 9865536..0000000
--- a/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2015-2017 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.
-
-if [ $# -lt 2 ]
-then
- echo "Please pass a subscription method to this script."
- echo "For example: $0 UDP subscribe_notify_test_diff_client_ids_diff_ports_slave.json"
- echo "Valid subscription types include:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Please pass a json file to this script."
- echo "For example: $0 UDP subscribe_notify_test_diff_client_ids_diff_ports_slave.json"
- echo "To use the same service id but different instances on the node pass SAME_SERVICE_ID as third parameter"
- exit 1
-fi
-
-# Make sure only valid subscription types are passed to the script
-SUBSCRIPTION_TYPES="TCP_AND_UDP PREFER_UDP PREFER_TCP UDP TCP"
-VALID=0
-for valid_subscription_type in $SUBSCRIPTION_TYPES
-do
- if [ $valid_subscription_type == $1 ]
- then
- VALID=1
- fi
-done
-
-if [ $VALID -eq 0 ]
-then
- echo "Invalid subscription type passed, valid types are:"
- echo " [TCP_AND_UDP, PREFER_UDP, PREFER_TCP, UDP, TCP]"
- echo "Exiting"
- exit 1
-fi
-
-
-FAIL=0
-# Start the services
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_four
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 4 $1 $3 &
-
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_five
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 5 $1 $3 &
-
-export VSOMEIP_APPLICATION_NAME=subscribe_notify_test_service_six
-export VSOMEIP_CONFIGURATION=$2
-./subscribe_notify_test_service 6 $1 $3 &
-
-# Wait until all applications are finished
-for job in $(jobs -p)
-do
- # Fail gets incremented if one of the binaries exits
- # with a non-zero exit code
- wait $job || ((FAIL+=1))
-done
-
-# Check if both exited successfully
-if [ $FAIL -eq 0 ]
-then
- exit 0
-else
- exit 1
-fi
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
deleted file mode 100644
index 60ee7ea..0000000
--- a/tools/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2016-2017 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 2.8)
-
-# vsomeip_ctrl
-add_executable(vsomeip_ctrl EXCLUDE_FROM_ALL vsomeip_ctrl.cpp)
-target_link_libraries(vsomeip_ctrl
- vsomeip
- ${Boost_LIBRARIES}
- ${DL_LIBRARY}
- ${CMAKE_THREAD_LIBS_INIT}
-)
-
-###################################################################################################
-
diff --git a/tools/vsomeip_ctrl.cpp b/tools/vsomeip_ctrl.cpp
deleted file mode 100644
index 1f64c2f..0000000
--- a/tools/vsomeip_ctrl.cpp
+++ /dev/null
@@ -1,442 +0,0 @@
-// Copyright (C) 2016-2017 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 <vsomeip/vsomeip.hpp>
-#include "../implementation/configuration/include/internal.hpp"
-#include "../implementation/logging/include/logger.hpp"
-#include "../implementation/service_discovery/include/constants.hpp"
-#include "../implementation/utility/include/byteorder.hpp"
-
-#include <cstdint>
-#include <thread>
-#include <cstring>
-#include <condition_variable>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-
-namespace vsomeip_ctrl {
-
-class vsomeip_sender {
-public:
- vsomeip_sender(bool _use_tcp,
- std::vector<vsomeip::byte_t> _user_message,
- vsomeip::instance_t _instance) :
- use_tcp_(_use_tcp),
- user_message_(_user_message),
- instance_(_instance),
- app_(vsomeip::runtime::get()->create_application("vsomeip_ctrl")),
- wait_registered_(true),
- wait_service_available_(true),
- send_thread_(std::bind(&vsomeip_sender::send, this)),
- service_id_(0x0),
- method_id_(0x0),
- length_(0),
- client_id_(0x0),
- interface_version_(0x0),
- message_type_(vsomeip::message_type_e::MT_UNKNOWN),
- return_code_(vsomeip::return_code_e::E_UNKNOWN),
- wait_for_answer_(true)
- {
- if (user_message_.size() < VSOMEIP_PAYLOAD_POS) {
- VSOMEIP_ERROR << "Provided message is to short, min. length "
- "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]);
- interface_version_ = user_message_[VSOMEIP_INTERFACE_VERSION_POS];
- message_type_ = static_cast<vsomeip::message_type_e>(user_message_[VSOMEIP_MESSAGE_TYPE_POS]);
- return_code_ = static_cast<vsomeip::return_code_e>(user_message_[VSOMEIP_RETURN_CODE_POS]);
-
- validate_message();
-
- if (!app_->init()) {
- VSOMEIP_ERROR << "Couldn't initialize application";
- exit(EXIT_FAILURE);
- }
- app_->register_state_handler(
- std::bind(&vsomeip_sender::on_state, this,
- std::placeholders::_1));
- app_->register_message_handler(vsomeip::ANY_SERVICE,
- vsomeip::ANY_INSTANCE, vsomeip::ANY_METHOD,
- std::bind(&vsomeip_sender::on_message, this,
- std::placeholders::_1));
- app_->register_availability_handler(service_id_, instance_,
- std::bind(&vsomeip_sender::on_availability, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3));
- app_->start();
- };
-
- void stop(int _exit_code) {
- app_->clear_all_handler();
- app_->release_service(service_id_, instance_);
- app_->stop();
- exit(_exit_code);
- }
-
- ~vsomeip_sender() {
- send_thread_.join();
- }
-
- void 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) {
- app_->request_service(service_id_, instance_);
- }
- }
-
- void on_availability(vsomeip::service_t _service,
- vsomeip::instance_t _instance, bool _is_available) {
- if(_is_available) {
- VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0')
- << std::hex << _service << "." << _instance << "] is available.";
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_service_available_ = false;
- condition_.notify_one();
- }
- }
-
- void on_message(const std::shared_ptr<vsomeip::message> &_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() << "]:";
- VSOMEIP_INFO << "########## begin message";
- VSOMEIP_INFO << std::hex << std::setw(4) << std::setfill('0')
- << _response->get_service()
- << std::hex << std::setw(4) << std::setfill('0')
- << _response->get_method()
- << " # service id / instance id";
- VSOMEIP_INFO << std::hex << std::setw(8) << std::setfill('0')
- << _response->get_length() << " # length";
- VSOMEIP_INFO << std::hex << std::setw(4) << std::setfill('0')
- << _response->get_client()
- << std::hex << std::setw(4) << std::setfill('0')
- << _response->get_session()
- << " # client id / session id";
- VSOMEIP_INFO << std::hex << std::setw(2) << std::setfill('0')
- << static_cast<std::uint16_t>(_response->get_protocol_version())
- << std::hex << std::setw(2) << std::setfill('0')
- << static_cast<std::uint16_t>(_response->get_interface_version())
- << std::hex << std::setw(2) << std::setfill('0')
- << static_cast<std::uint16_t>(_response->get_message_type())
- << std::hex << std::setw(2) << std::setfill('0')
- << static_cast<std::uint16_t>(_response->get_return_code())
- << " # protocol version / interface version / "
- << "message type / return code";
-
-
- std::stringstream stream;
- std::string str;
- for(unsigned int i = 0; i < _response->get_payload()->get_length(); i++) {
- stream << std::hex << std::setw(2) << std::setfill('0')
- << static_cast<std::uint32_t>((_response->get_payload()->get_data())[i]);
- str.append(stream.str());
- stream.str("");
- stream.clear();
- }
- std::string str2;
- int k=1;
- for(unsigned int j = 0; j < str.length(); j+=2, k++) {
- str2.append(str.substr(j,2));
- if(k%4 == 0) {
- if(k == 4) {
- VSOMEIP_INFO << str2 << " # payload from here on";
- } else {
- VSOMEIP_INFO << str2;
- }
- str2.clear();
- }
- }
- VSOMEIP_INFO << "########## end message";
- VSOMEIP_INFO << "Payload as byte stream: " << str;
- str.clear();
- std::lock_guard<std::mutex> its_lock(mutex_);
- wait_for_answer_ = false;
- condition_.notify_one();
- }
-
- void send() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while (wait_service_available_) {
- if(std::cv_status::timeout == condition_.wait_for(its_lock, std::chrono::seconds(6))) {
- VSOMEIP_INFO << "Service [" << std::setw(4) << std::setfill('0')
- << std::hex << service_id_ << "." << instance_ << "] isn't available. Exiting";
- stop(EXIT_FAILURE);
- }
- }
-
- std::shared_ptr<vsomeip::message> its_message =
- vsomeip::runtime::get()->create_message(use_tcp_);
- its_message->set_method(method_id_);
- its_message->set_service(service_id_);
- its_message->set_interface_version(interface_version_);
- its_message->set_message_type(message_type_);
- its_message->set_return_code(return_code_);
- its_message->set_client(app_->get_client());
- its_message->set_instance(instance_);
-
- std::shared_ptr< vsomeip::payload > its_payload =
- vsomeip::runtime::get()->create_payload();
- its_payload->set_data(&user_message_[VSOMEIP_PAYLOAD_POS],
- static_cast<vsomeip::length_t>(user_message_.size() - VSOMEIP_PAYLOAD_POS));
- its_message->set_payload(its_payload);
- VSOMEIP_INFO << "Sending";
- app_->send(its_message);
-
- while(wait_for_answer_) {
- if(std::cv_status::timeout == condition_.wait_for(its_lock, std::chrono::seconds(5))) {
- VSOMEIP_INFO << "Didn't receive answer within 5sec. Shutting down.";
- stop(EXIT_SUCCESS);
- break;
- }
- }
-
- stop(EXIT_SUCCESS);
- }
-
-private:
- bool validate_message() {
- if (!check_message_type()) {
- VSOMEIP_ERROR << "Invalid message type 0x" << std::setw(2)
- << std::setfill('0') << std::hex
- << static_cast<std::uint8_t>(message_type_) << ", exiting.";
- stop(EXIT_FAILURE);
- }
-
- if(!check_return_code()) {
- VSOMEIP_ERROR << "Invalid return code 0x" << std::setw(2)
- << std::setfill('0') << std::hex
- << static_cast<std::uint8_t>(return_code_) << ", exiting.";
- stop(EXIT_FAILURE);
- }
-
- if (service_id_ == vsomeip::sd::service &&
- method_id_ == vsomeip::sd::method) {
- VSOMEIP_ERROR << "Usage of reserved service id and method id "
- "of service discovery, exiting.";
- stop(EXIT_FAILURE);
- }
-
- if (user_message_.size() != length_ + 8) {
- VSOMEIP_ERROR << "Provided length 0x" << std::setw(8)
- << std::setfill('0') << std::hex << length_
- << " doesn't match message size.";
- VSOMEIP_ERROR << "Assuming the same payload the length field should"
- " be set to 0x" << std::setw(8) << std::setfill('0')
- << std::hex << user_message_.size() - 8 << " , exiting.";
- stop(EXIT_FAILURE);
- }
-
- if (use_tcp_ && user_message_.size() > VSOMEIP_MAX_TCP_MESSAGE_SIZE) {
- VSOMEIP_WARNING << "Max allowed message size for TCP is "
- << std::dec << VSOMEIP_MAX_TCP_MESSAGE_SIZE
- << ". Provided message size is: " << user_message_.size();
- }
- if (!use_tcp_ && user_message_.size() > VSOMEIP_MAX_UDP_MESSAGE_SIZE) {
- VSOMEIP_WARNING << "Max allowed message size for UDP is "
- << std::dec << VSOMEIP_MAX_UDP_MESSAGE_SIZE
- << ". Provided message size is: " << user_message_.size();
- }
- return true;
- }
-
- bool check_message_type() {
- switch (message_type_) {
- case vsomeip::message_type_e::MT_REQUEST:
- case vsomeip::message_type_e::MT_REQUEST_NO_RETURN:
- case vsomeip::message_type_e::MT_NOTIFICATION:
- case vsomeip::message_type_e::MT_RESPONSE:
- case vsomeip::message_type_e::MT_ERROR:
- return true;
- break;
- case vsomeip::message_type_e::MT_UNKNOWN:
- case vsomeip::message_type_e::MT_ERROR_ACK:
- case vsomeip::message_type_e::MT_RESPONSE_ACK:
- case vsomeip::message_type_e::MT_NOTIFICATION_ACK:
- case vsomeip::message_type_e::MT_REQUEST_NO_RETURN_ACK:
- case vsomeip::message_type_e::MT_REQUEST_ACK:
- default:
- return false;
- break;
- }
- }
-
- bool check_return_code() {
- if (static_cast<std::uint8_t>(return_code_) > 0x3F) {
- VSOMEIP_ERROR << "Provided return code 0x" << std::setw(2)
- << std::setfill('0') << std::hex
- << static_cast<std::uint8_t>(return_code_) << " is out of range.";
- return false;
- }
- if (static_cast<std::uint8_t>(return_code_) >
- static_cast<std::uint8_t>(vsomeip::return_code_e::E_WRONG_MESSAGE_TYPE) &&
- static_cast<std::uint8_t>(return_code_) <= 0x3f) {
- VSOMEIP_ERROR << "Provided return code 0x" << std::setw(2)
- << std::setfill('0') << std::hex <<
- static_cast<std::uint8_t>(return_code_) << "is reserved.";
- return false;
- }
- switch (message_type_) {
- case vsomeip::message_type_e::MT_REQUEST:
- case vsomeip::message_type_e::MT_REQUEST_NO_RETURN:
- case vsomeip::message_type_e::MT_NOTIFICATION:
- if(return_code_ != vsomeip::return_code_e::E_OK) {
- VSOMEIP_ERROR << "Provided return code 0x" << std::setw(2)
- << std::setfill('0') << std::hex
- << static_cast<std::uint8_t>(return_code_)
- << "is invalid in combination with message type 0x"
- << std::setw(2) << std::setfill('0') << std::hex
- << static_cast<std::uint8_t>(message_type_)
- << " use 0x00 (E_OK).";
- return false;
- }
- return true;
- break;
- default:
- return true;
- break;
- }
- }
-
-private:
- bool use_tcp_;
- std::vector<vsomeip::byte_t> user_message_;
- vsomeip::instance_t instance_;
- std::shared_ptr<vsomeip::application> app_;
- std::mutex mutex_;
- std::condition_variable condition_;
- bool wait_registered_;
- bool wait_service_available_;
- std::thread send_thread_;
- vsomeip::service_t service_id_;
- vsomeip::method_t method_id_;
- std::uint32_t length_;
- vsomeip::client_t client_id_;
- vsomeip::interface_version_t interface_version_;
- vsomeip::message_type_e message_type_;
- vsomeip::return_code_e return_code_;
- bool wait_for_answer_;
-};
-} // namespace vsomeip_ctrl
-
-static void print_help(char* binary_name) {
- std::cout << "Usage example:" << std::endl;
- std::cout << binary_name << " --instance 5678 "
- << "--message 123480e800000015134300030100000000000009efbbbf576f726c6400\n"
- << "This will send a message to service with service id 1234 and instance 5678."
- << std::endl << std::endl;
- std::cout <<
- "Available options:\n"
- "--help | -h : print this help\n"
- "--instance | -i : instance id of target service in hex (required)\n"
- "--tcp | -t : flag to enable sending over TCP, default off (= UDP)\n"
- "--message | -m : vSomeIP message to send in hex (required)\n\n"
- "Please note: the fields client id and session id in the provided message\n"
- "will be overwritten by the stack with the required values\n"
- "Please further make sure to use the same configuration file\n"
- "as the target service, if the system is not using vsomeipd" << std::endl;
-}
-
-int main(int argc, char** argv) {
- if (argc < 2) {
- std::cerr << "To few arguments, please see the help with : "
- << argv[0] << " --help" << std::endl;
- exit(EXIT_FAILURE);
- }
-
- std::vector<vsomeip::byte_t> user_message;
- vsomeip::instance_t instance(vsomeip::ANY_INSTANCE);
- bool use_tcp(false);
-
- for (int i = 1; i < argc; i++) {
- std::string arg(argv[i]);
- if (arg == "--help" || arg == "-h") {
- print_help(argv[0]);
- exit(EXIT_SUCCESS);
- break;
- } else if (arg == "--message" || arg == "-m") {
- std::string message(argv[i + 1]);
- for (unsigned int i = 0; i < message.length(); i += 2) {
- vsomeip::byte_t its_byte;
- try {
- std::uint64_t tmp = std::stoul(message.substr(i, 2), 0, 16);
- tmp = (tmp > (std::numeric_limits<std::uint8_t>::max)()) ?
- (std::numeric_limits<std::uint8_t>::max)() : tmp;
- its_byte = static_cast<vsomeip::byte_t>(tmp);
- } catch (std::invalid_argument &e) {
- std::cerr << e.what() << ": Couldn't convert '"
- << message.substr(i, 2) << "' to hex, exiting: "
- << std::endl;
- exit(EXIT_FAILURE);
- }
- user_message.push_back(its_byte);
- }
- } if (arg == "--tcp" || arg == "-t") {
- use_tcp = true;
- } else if (arg == "--instance" || arg == "-i") {
- std::string instance_str(argv[i + 1]);
- if(instance_str.length() > 4) {
- std::cerr << "provided instance is to long, exiting." << std::endl;
- exit(EXIT_FAILURE);
- }
- if(instance_str.length() < 4) {
- while(instance_str.size() != 4) {
- instance_str = "0" + instance_str;
- }
- }
- vsomeip::byte_t high(0x0);
- vsomeip::byte_t low(0x0);
- std::cout << "Instance: " << instance_str << std::endl;
- for (unsigned int i = 0; i < instance_str.length(); i += 2) {
- vsomeip::byte_t its_byte;
- try {
- std::uint64_t tmp = std::stoul(instance_str.substr(i, 2), 0, 16);
- tmp = (tmp > (std::numeric_limits<std::uint8_t>::max)()) ?
- (std::numeric_limits<std::uint8_t>::max)() : tmp;
- its_byte = static_cast<vsomeip::byte_t>(tmp);
- its_byte = static_cast<vsomeip::byte_t>(tmp);
- } catch (std::invalid_argument &e) {
- std::cerr << e.what() << ": Couldn't convert '"
- << instance_str.substr(i, 2) << "' to hex, exiting: "
- << std::endl;
- exit(EXIT_FAILURE);
- }
- if(i == 0) {
- high = its_byte;
- } else {
- low = its_byte;
- }
- }
- instance = VSOMEIP_BYTES_TO_WORD(high, low);
- }
- }
-
- if(instance == vsomeip::ANY_INSTANCE) {
- std::cerr << "Please provide a target instance (see --help)" << std::endl;
- exit(EXIT_FAILURE);
- }
-
- if(user_message.empty()) {
- std::cerr << "Please provide a message to send (see --help)" << std::endl;
- exit(EXIT_FAILURE);
- }
-
- vsomeip_ctrl::vsomeip_sender sender(use_tcp, user_message, instance);
- return EXIT_SUCCESS;
-}
diff --git a/vsomeip.pc.in b/vsomeip.pc.in
deleted file mode 100644
index dc450b7..0000000
--- a/vsomeip.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=@CMAKE_INSTALL_PREFIX@
-libdir=@CMAKE_INSTALL_PREFIX@/@INSTALL_LIB_DIR@
-includedir=@CMAKE_INSTALL_PREFIX@/include
-
-Name: @PROJECT@
-Description: New SOME/IP stack, feature complete
-Version: @VSOMEIP_VERSION@
-Libs: -L${libdir} -lvsomeip -lvsomeip-sd -lboost_system -lboost_log -lboost_filesystem
-Cflags: -I${includedir}
-
diff --git a/vsomeip.xml b/vsomeip.xml
deleted file mode 100644
index 022d625..0000000
--- a/vsomeip.xml
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<profiles version="1">
-<profile kind="CodeFormatterProfile" name="CommonAPI" version="1">
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.lineSplit" value="80"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_member_access" value="0"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list" value="0"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment" value="1"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.tabulation.size" value="4"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_enumerator_list" value="48"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_declarator_list" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_empty_lines" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.join_wrapped_lines" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.continuation_indentation" value="2"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_expression_list" value="0"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression" value="34"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces" value="0"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_compact_if" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_assignment" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain" value="18"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration" value="80"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_body" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_binary_expression" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_block" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.tabulation.char" value="space"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.compact_else_if" value="true"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain" value="16"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.indentation.size" value="4"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters" value="insert"/>
-<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments" value="do not insert"/>
-</profile>
-</profiles>
diff --git a/vsomeipConfig.cmake.in b/vsomeipConfig.cmake.in
deleted file mode 100644
index e2c03cf..0000000
--- a/vsomeipConfig.cmake.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# Config file for the vSomeIP package, defines the following variables:
-# VSOMEIP_INCLUDE_DIRS - include directories for vSomeIP
-# VSOMEIP_LIBRARIES - libraries to link against
-
-# Compute paths
-get_filename_component (VSOMEIP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-set (VSOMEIP_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
-
-# Our library dependencies (contains definitions for IMPORTED targets)
-if (NOT TARGET vsomeip AND NOT vsomeip_BINARY_DIR)
- include ("${VSOMEIP_CMAKE_DIR}/vsomeipTargets.cmake")
-endif ()
-
-# These are IMPORTED targets created by vsomeipTargets.cmake
-set (VSOMEIP_LIBRARIES vsomeip)
diff --git a/vsomeipConfigVersion.cmake.in b/vsomeipConfigVersion.cmake.in
deleted file mode 100644
index 69988bd..0000000
--- a/vsomeipConfigVersion.cmake.in
+++ /dev/null
@@ -1,11 +0,0 @@
-set (PACKAGE_VERSION "@VSOMEIP_VERSION@")
-
-# Check whether the requested PACKAGE_FIND_VERSION is compatible
-if ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
- set (PACKAGE_VERSION_COMPATIBLE FALSE)
-else ()
- set (PACKAGE_VERSION_COMPATIBLE TRUE)
- if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
- set (PACKAGE_VERSION_EXACT TRUE)
- endif ()
-endif ()