summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Gehring <juergen.gehring@bmw.de>2017-02-28 03:57:20 -0800
committerJuergen Gehring <juergen.gehring@bmw.de>2017-02-28 03:57:20 -0800
commit07d7573c007322be07689575ce5d73c45f030d6d (patch)
tree6a6acbf7536de451391d9d50b7f5cdde49d67fd8
parent1a230558936ec84b4fb44b2346dc5ae52d6f2805 (diff)
downloadvSomeIP-07d7573c007322be07689575ce5d73c45f030d6d.tar.gz
vSomeIP 2.5.32.5.3
-rw-r--r--CHANGES10
-rw-r--r--CMakeLists.txt8
-rw-r--r--README.md2
-rw-r--r--daemon/CMakeLists.txt2
-rw-r--r--daemon/vsomeipd.cpp2
-rw-r--r--documentation/doxygen.in4
-rw-r--r--documentation/vsomeipUserGuide2
-rw-r--r--examples/CMakeLists.txt2
-rw-r--r--examples/hello_world/CMakeLists.txt2
-rw-r--r--examples/hello_world/hello_world_client.cpp2
-rw-r--r--examples/hello_world/hello_world_service.cpp2
-rw-r--r--examples/hello_world/readme2
-rw-r--r--examples/notify-sample.cpp2
-rw-r--r--examples/readme.txt2
-rw-r--r--examples/request-sample.cpp2
-rw-r--r--examples/response-sample.cpp2
-rw-r--r--examples/sample-ids.hpp2
-rw-r--r--examples/subscribe-sample.cpp2
-rw-r--r--implementation/configuration/include/client.hpp2
-rw-r--r--implementation/configuration/include/configuration.hpp2
-rw-r--r--implementation/configuration/include/configuration_impl.hpp2
-rw-r--r--implementation/configuration/include/event.hpp2
-rw-r--r--implementation/configuration/include/eventgroup.hpp2
-rw-r--r--implementation/configuration/include/internal.hpp.in17
-rw-r--r--implementation/configuration/include/policy.hpp2
-rw-r--r--implementation/configuration/include/service.hpp2
-rw-r--r--implementation/configuration/include/service_instance_range.hpp2
-rw-r--r--implementation/configuration/include/trace.hpp2
-rw-r--r--implementation/configuration/include/watchdog.hpp2
-rw-r--r--implementation/configuration/src/configuration.cpp6
-rw-r--r--implementation/configuration/src/configuration_impl.cpp6
-rw-r--r--implementation/endpoints/include/buffer.hpp2
-rw-r--r--implementation/endpoints/include/client_endpoint.hpp2
-rw-r--r--implementation/endpoints/include/client_endpoint_impl.hpp11
-rw-r--r--implementation/endpoints/include/credentials.hpp2
-rw-r--r--implementation/endpoints/include/endpoint.hpp2
-rw-r--r--implementation/endpoints/include/endpoint_definition.hpp10
-rw-r--r--implementation/endpoints/include/endpoint_host.hpp4
-rw-r--r--implementation/endpoints/include/endpoint_impl.hpp7
-rw-r--r--implementation/endpoints/include/local_client_endpoint_impl.hpp6
-rw-r--r--implementation/endpoints/include/local_server_endpoint_impl.hpp18
-rw-r--r--implementation/endpoints/include/netlink_connector.hpp14
-rw-r--r--implementation/endpoints/include/server_endpoint_impl.hpp2
-rw-r--r--implementation/endpoints/include/tcp_client_endpoint_impl.hpp5
-rw-r--r--implementation/endpoints/include/tcp_server_endpoint_impl.hpp21
-rw-r--r--implementation/endpoints/include/udp_client_endpoint_impl.hpp5
-rw-r--r--implementation/endpoints/include/udp_server_endpoint_impl.hpp8
-rw-r--r--implementation/endpoints/include/virtual_server_endpoint_impl.hpp2
-rw-r--r--implementation/endpoints/src/client_endpoint_impl.cpp93
-rw-r--r--implementation/endpoints/src/credentials.cpp4
-rw-r--r--implementation/endpoints/src/endpoint_definition.cpp19
-rw-r--r--implementation/endpoints/src/endpoint_impl.cpp4
-rw-r--r--implementation/endpoints/src/local_client_endpoint_impl.cpp118
-rw-r--r--implementation/endpoints/src/local_server_endpoint_impl.cpp158
-rw-r--r--implementation/endpoints/src/netlink_connector.cpp64
-rw-r--r--implementation/endpoints/src/server_endpoint_impl.cpp18
-rw-r--r--implementation/endpoints/src/tcp_client_endpoint_impl.cpp78
-rw-r--r--implementation/endpoints/src/tcp_server_endpoint_impl.cpp157
-rw-r--r--implementation/endpoints/src/udp_client_endpoint_impl.cpp73
-rw-r--r--implementation/endpoints/src/udp_server_endpoint_impl.cpp111
-rw-r--r--implementation/endpoints/src/virtual_server_endpoint_impl.cpp2
-rw-r--r--implementation/helper/boost/asio/basic_datagram_socket_ext.hpp2
-rw-r--r--implementation/helper/boost/asio/datagram_socket_service_ext.hpp2
-rw-r--r--implementation/helper/boost/asio/detail/handler_type_requirements_ext.hpp2
-rw-r--r--implementation/helper/boost/asio/detail/impl/reactive_socket_service_base_ext.ipp2
-rw-r--r--implementation/helper/boost/asio/detail/impl/socket_ops_ext.ipp2
-rw-r--r--implementation/helper/boost/asio/detail/reactive_socket_recv_op_ext.hpp2
-rw-r--r--implementation/helper/boost/asio/detail/reactive_socket_recvfrom_op_ext.hpp2
-rw-r--r--implementation/helper/boost/asio/detail/reactive_socket_recvmsg_op_ext.hpp2
-rw-r--r--implementation/helper/boost/asio/detail/reactive_socket_service_base_ext.hpp2
-rw-r--r--implementation/helper/boost/asio/detail/reactive_socket_service_ext.hpp2
-rw-r--r--implementation/helper/boost/asio/detail/reactor_op_ext.hpp2
-rw-r--r--implementation/helper/boost/asio/detail/socket_ops_ext.hpp2
-rw-r--r--implementation/helper/boost/asio/ip/udp_ext.hpp2
-rw-r--r--implementation/logging/include/defines.hpp2
-rw-r--r--implementation/logging/include/dlt_sink_backend.hpp2
-rw-r--r--implementation/logging/include/logger.hpp4
-rw-r--r--implementation/logging/include/logger_impl.hpp2
-rw-r--r--implementation/logging/src/dlt_sink_backend.cpp2
-rw-r--r--implementation/logging/src/logger.cpp2
-rw-r--r--implementation/logging/src/logger_impl.cpp2
-rw-r--r--implementation/message/include/deserializer.hpp2
-rw-r--r--implementation/message/include/message_base_impl.hpp2
-rw-r--r--implementation/message/include/message_header_impl.hpp2
-rw-r--r--implementation/message/include/message_impl.hpp2
-rw-r--r--implementation/message/include/payload_impl.hpp2
-rw-r--r--implementation/message/include/serializer.hpp2
-rw-r--r--implementation/message/src/deserializer.cpp2
-rw-r--r--implementation/message/src/message_base_impl.cpp4
-rw-r--r--implementation/message/src/message_header_impl.cpp10
-rw-r--r--implementation/message/src/message_impl.cpp2
-rw-r--r--implementation/message/src/payload_impl.cpp2
-rw-r--r--implementation/message/src/serializer.cpp4
-rw-r--r--implementation/routing/include/event.hpp21
-rw-r--r--implementation/routing/include/eventgroupinfo.hpp14
-rw-r--r--implementation/routing/include/routing_manager.hpp2
-rw-r--r--implementation/routing/include/routing_manager_adapter.hpp2
-rw-r--r--implementation/routing/include/routing_manager_base.hpp11
-rw-r--r--implementation/routing/include/routing_manager_host.hpp2
-rw-r--r--implementation/routing/include/routing_manager_impl.hpp18
-rw-r--r--implementation/routing/include/routing_manager_proxy.hpp41
-rw-r--r--implementation/routing/include/routing_manager_stub.hpp5
-rw-r--r--implementation/routing/include/routing_manager_stub_host.hpp2
-rw-r--r--implementation/routing/include/serviceinfo.hpp3
-rw-r--r--implementation/routing/include/types.hpp2
-rw-r--r--implementation/routing/src/event.cpp24
-rw-r--r--implementation/routing/src/eventgroupinfo.cpp39
-rw-r--r--implementation/routing/src/routing_manager_base.cpp112
-rw-r--r--implementation/routing/src/routing_manager_impl.cpp187
-rw-r--r--implementation/routing/src/routing_manager_proxy.cpp241
-rw-r--r--implementation/routing/src/routing_manager_stub.cpp132
-rw-r--r--implementation/routing/src/serviceinfo.cpp4
-rw-r--r--implementation/runtime/include/application_impl.hpp17
-rw-r--r--implementation/runtime/include/runtime_impl.hpp2
-rw-r--r--implementation/runtime/src/application_impl.cpp408
-rw-r--r--implementation/runtime/src/error.cpp2
-rw-r--r--implementation/runtime/src/runtime.cpp2
-rw-r--r--implementation/runtime/src/runtime_impl.cpp2
-rw-r--r--implementation/service_discovery/include/configuration_option_impl.hpp2
-rw-r--r--implementation/service_discovery/include/constants.hpp2
-rw-r--r--implementation/service_discovery/include/defines.hpp2
-rwxr-xr-ximplementation/service_discovery/include/deserializer.hpp2
-rwxr-xr-ximplementation/service_discovery/include/entry_impl.hpp2
-rw-r--r--implementation/service_discovery/include/enumeration_types.hpp2
-rwxr-xr-ximplementation/service_discovery/include/eventgroupentry_impl.hpp2
-rw-r--r--implementation/service_discovery/include/ip_option_impl.hpp2
-rw-r--r--implementation/service_discovery/include/ipv4_option_impl.hpp2
-rw-r--r--implementation/service_discovery/include/ipv6_option_impl.hpp2
-rwxr-xr-ximplementation/service_discovery/include/load_balancing_option_impl.hpp2
-rwxr-xr-ximplementation/service_discovery/include/message_element_impl.hpp2
-rwxr-xr-ximplementation/service_discovery/include/message_impl.hpp2
-rw-r--r--implementation/service_discovery/include/option_impl.hpp2
-rw-r--r--implementation/service_discovery/include/primitive_types.hpp2
-rwxr-xr-ximplementation/service_discovery/include/protection_option_impl.hpp2
-rw-r--r--implementation/service_discovery/include/request.hpp2
-rw-r--r--implementation/service_discovery/include/runtime.hpp2
-rw-r--r--implementation/service_discovery/include/runtime_impl.hpp2
-rw-r--r--implementation/service_discovery/include/service_discovery.hpp2
-rw-r--r--implementation/service_discovery/include/service_discovery_host.hpp2
-rw-r--r--implementation/service_discovery/include/service_discovery_impl.hpp2
-rw-r--r--implementation/service_discovery/include/serviceentry_impl.hpp2
-rw-r--r--implementation/service_discovery/include/subscription.hpp2
-rwxr-xr-ximplementation/service_discovery/src/configuration_option_impl.cpp2
-rw-r--r--implementation/service_discovery/src/deserializer.cpp2
-rwxr-xr-ximplementation/service_discovery/src/entry_impl.cpp2
-rwxr-xr-ximplementation/service_discovery/src/eventgroupentry_impl.cpp2
-rw-r--r--implementation/service_discovery/src/ip_option_impl.cpp2
-rw-r--r--implementation/service_discovery/src/ipv4_option_impl.cpp2
-rwxr-xr-ximplementation/service_discovery/src/ipv6_option_impl.cpp2
-rwxr-xr-ximplementation/service_discovery/src/load_balancing_option_impl.cpp2
-rwxr-xr-ximplementation/service_discovery/src/message_element_impl.cpp2
-rwxr-xr-ximplementation/service_discovery/src/message_impl.cpp2
-rwxr-xr-ximplementation/service_discovery/src/option_impl.cpp2
-rwxr-xr-ximplementation/service_discovery/src/protection_option_impl.cpp2
-rw-r--r--implementation/service_discovery/src/request.cpp2
-rw-r--r--implementation/service_discovery/src/runtime.cpp6
-rw-r--r--implementation/service_discovery/src/runtime_impl.cpp2
-rw-r--r--implementation/service_discovery/src/service_discovery_impl.cpp10
-rwxr-xr-ximplementation/service_discovery/src/serviceentry_impl.cpp2
-rw-r--r--implementation/service_discovery/src/subscription.cpp2
-rw-r--r--implementation/tracing/include/defines.hpp2
-rw-r--r--implementation/tracing/include/enumeration_types.hpp2
-rw-r--r--implementation/tracing/include/trace_connector.hpp2
-rw-r--r--implementation/tracing/include/trace_header.hpp2
-rw-r--r--implementation/tracing/src/trace_connector.cpp6
-rw-r--r--implementation/tracing/src/trace_header.cpp2
-rw-r--r--implementation/utility/include/byteorder.hpp2
-rw-r--r--implementation/utility/include/criticalsection.hpp10
-rw-r--r--implementation/utility/include/utility.hpp8
-rw-r--r--implementation/utility/src/criticalsection.cpp7
-rw-r--r--implementation/utility/src/utility.cpp44
-rw-r--r--interface/vsomeip/application.hpp708
-rw-r--r--interface/vsomeip/constants.hpp2
-rw-r--r--interface/vsomeip/defines.hpp2
-rw-r--r--interface/vsomeip/enumeration_types.hpp2
-rw-r--r--interface/vsomeip/error.hpp2
-rw-r--r--interface/vsomeip/export.hpp4
-rw-r--r--interface/vsomeip/function_types.hpp2
-rw-r--r--interface/vsomeip/handler.hpp2
-rw-r--r--interface/vsomeip/internal/deserializable.hpp2
-rw-r--r--interface/vsomeip/internal/serializable.hpp2
-rw-r--r--interface/vsomeip/message.hpp30
-rw-r--r--interface/vsomeip/message_base.hpp139
-rw-r--r--interface/vsomeip/payload.hpp69
-rw-r--r--interface/vsomeip/primitive_types.hpp2
-rw-r--r--interface/vsomeip/runtime.hpp159
-rw-r--r--interface/vsomeip/vsomeip.hpp2
-rw-r--r--test/CMakeLists.txt26
-rw-r--r--test/application_tests/application_test.cpp21
-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.cpp19
-rw-r--r--test/application_tests/application_test_client_availability.cpp203
-rw-r--r--test/application_tests/application_test_daemon.cpp2
-rw-r--r--test/application_tests/application_test_globals.hpp7
-rw-r--r--test/application_tests/application_test_service.cpp19
-rw-r--r--test/application_tests/application_test_single_process.cpp4
-rwxr-xr-xtest/application_tests/application_test_single_process_starter.sh2
-rwxr-xr-xtest/application_tests/application_test_starter.sh2
-rw-r--r--test/big_payload_tests/big_payload_test_client.cpp4
-rw-r--r--test/big_payload_tests/big_payload_test_client.hpp2
-rwxr-xr-xtest/big_payload_tests/big_payload_test_client_local_start.sh2
-rwxr-xr-xtest/big_payload_tests/big_payload_test_client_start.sh2
-rwxr-xr-xtest/big_payload_tests/big_payload_test_external_starter.sh2
-rw-r--r--test/big_payload_tests/big_payload_test_globals.hpp2
-rwxr-xr-xtest/big_payload_tests/big_payload_test_local_starter.sh2
-rw-r--r--test/big_payload_tests/big_payload_test_service.cpp4
-rw-r--r--test/big_payload_tests/big_payload_test_service.hpp2
-rwxr-xr-xtest/big_payload_tests/big_payload_test_service_external_start.sh2
-rwxr-xr-xtest/big_payload_tests/big_payload_test_service_local_start.sh2
-rw-r--r--test/client_id_tests/client_id_test_globals.hpp2
-rwxr-xr-xtest/client_id_tests/client_id_test_master_starter.sh2
-rw-r--r--test/client_id_tests/client_id_test_service.cpp4
-rwxr-xr-xtest/client_id_tests/client_id_test_slave_starter.sh2
-rw-r--r--test/client_id_tests/client_id_test_utility.cpp4
-rw-r--r--test/configuration_tests/configuration-test.cpp4
-rw-r--r--test/cpu_load_tests/cpu_load_measurer.cpp2
-rw-r--r--test/cpu_load_tests/cpu_load_measurer.hpp2
-rw-r--r--test/cpu_load_tests/cpu_load_test_client.cpp4
-rw-r--r--test/cpu_load_tests/cpu_load_test_globals.hpp2
-rwxr-xr-xtest/cpu_load_tests/cpu_load_test_master_starter.sh2
-rw-r--r--test/cpu_load_tests/cpu_load_test_service.cpp4
-rwxr-xr-xtest/cpu_load_tests/cpu_load_test_slave_starter.sh2
-rw-r--r--test/header_factory_tests/header_factory_test.cpp4
-rw-r--r--test/header_factory_tests/header_factory_test_client.cpp8
-rw-r--r--test/header_factory_tests/header_factory_test_client.hpp4
-rwxr-xr-xtest/header_factory_tests/header_factory_test_client_start.sh2
-rwxr-xr-xtest/header_factory_tests/header_factory_test_send_receive_starter.sh2
-rw-r--r--test/header_factory_tests/header_factory_test_service.cpp9
-rw-r--r--test/header_factory_tests/header_factory_test_service.hpp4
-rwxr-xr-xtest/header_factory_tests/header_factory_test_service_start.sh2
-rw-r--r--test/initial_event_tests/initial_event_test_availability_checker.cpp4
-rw-r--r--test/initial_event_tests/initial_event_test_client.cpp4
-rw-r--r--test/initial_event_tests/initial_event_test_globals.hpp2
-rwxr-xr-xtest/initial_event_tests/initial_event_test_master_starter.sh2
-rw-r--r--test/initial_event_tests/initial_event_test_service.cpp4
-rwxr-xr-xtest/initial_event_tests/initial_event_test_slave_starter.sh2
-rw-r--r--test/initial_event_tests/initial_event_test_stop_service.cpp33
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_client.cpp2
-rwxr-xr-xtest/magic_cookies_tests/magic_cookies_test_client_start.sh2
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_service.cpp3
-rwxr-xr-xtest/magic_cookies_tests/magic_cookies_test_service_start.sh2
-rwxr-xr-xtest/magic_cookies_tests/magic_cookies_test_starter.sh2
-rwxr-xr-xtest/offer_tests/conf/offer_test_external_master_starter.sh.in2
-rw-r--r--test/offer_tests/offer_test_client.cpp17
-rw-r--r--test/offer_tests/offer_test_external_sd_msg_sender.cpp4
-rwxr-xr-xtest/offer_tests/offer_test_external_slave_starter.sh2
-rw-r--r--test/offer_tests/offer_test_globals.hpp2
-rwxr-xr-xtest/offer_tests/offer_test_local_starter.sh2
-rw-r--r--test/offer_tests/offer_test_service.cpp12
-rw-r--r--test/offer_tests/offer_test_service_external.cpp4
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_external_start.sh2
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_external_starter.sh2
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_local_and_external_starter.sh2
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_local_start.sh2
-rwxr-xr-xtest/payload_tests/external_local_payload_test_client_local_starter.sh2
-rwxr-xr-xtest/payload_tests/external_local_payload_test_service_client_external_start.sh2
-rwxr-xr-xtest/payload_tests/external_local_payload_test_service_start.sh2
-rwxr-xr-xtest/payload_tests/local_payload_test_client_start.sh2
-rwxr-xr-xtest/payload_tests/local_payload_test_huge_payload_starter.sh2
-rwxr-xr-xtest/payload_tests/local_payload_test_service_start.sh2
-rwxr-xr-xtest/payload_tests/local_payload_test_starter.sh2
-rw-r--r--test/payload_tests/payload_test_client.cpp8
-rw-r--r--test/payload_tests/payload_test_client.hpp5
-rw-r--r--test/payload_tests/payload_test_service.cpp9
-rw-r--r--test/payload_tests/payload_test_service.hpp4
-rw-r--r--test/payload_tests/stopwatch.cpp2
-rw-r--r--test/payload_tests/stopwatch.hpp2
-rwxr-xr-xtest/routing_tests/conf/local_routing_test_starter.sh.bat.in2
-rwxr-xr-xtest/routing_tests/conf/local_routing_test_starter.sh.in2
-rwxr-xr-xtest/routing_tests/external_local_routing_test_client_external_start.sh2
-rw-r--r--test/routing_tests/external_local_routing_test_service.cpp4
-rw-r--r--test/routing_tests/external_local_routing_test_service.hpp2
-rwxr-xr-xtest/routing_tests/external_local_routing_test_service_start.sh2
-rwxr-xr-xtest/routing_tests/external_local_routing_test_starter.sh2
-rw-r--r--test/routing_tests/local_routing_test_client.cpp4
-rw-r--r--test/routing_tests/local_routing_test_client.hpp2
-rwxr-xr-xtest/routing_tests/local_routing_test_client_start.sh2
-rw-r--r--test/routing_tests/local_routing_test_service.cpp4
-rw-r--r--test/routing_tests/local_routing_test_service.hpp2
-rwxr-xr-xtest/routing_tests/local_routing_test_service_start.sh2
-rw-r--r--test/someip_test_globals.hpp2
-rw-r--r--test/subscribe_notify_one_tests/subscribe_notify_one_test_globals.hpp2
-rwxr-xr-xtest/subscribe_notify_one_tests/subscribe_notify_one_test_master_starter.sh2
-rw-r--r--test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp4
-rwxr-xr-xtest/subscribe_notify_one_tests/subscribe_notify_one_test_slave_starter.sh2
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_globals.hpp2
-rwxr-xr-xtest/subscribe_notify_tests/subscribe_notify_test_master_starter.sh2
-rw-r--r--test/subscribe_notify_tests/subscribe_notify_test_service.cpp4
-rwxr-xr-xtest/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh2
-rw-r--r--tools/CMakeLists.txt2
-rw-r--r--tools/vsomeip_ctrl.cpp2
292 files changed, 3252 insertions, 1222 deletions
diff --git a/CHANGES b/CHANGES
index 8677cfd..724b151 100644
--- a/CHANGES
+++ b/CHANGES
@@ -266,3 +266,13 @@ v2.5.2
- Prevent race of initial attributes
- Allow incomplete application configurations
- Unit test timeouts increased to avoid failures on (slow) build servers
+
+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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b596e7..b981997 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
@@ -8,7 +8,7 @@ project (vsomeip)
set (VSOMEIP_MAJOR_VERSION 2)
set (VSOMEIP_MINOR_VERSION 5)
-set (VSOMEIP_PATCH_VERSION 2)
+set (VSOMEIP_PATCH_VERSION 3)
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)
@@ -149,7 +149,7 @@ set_target_properties (vsomeip PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION $
# 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} )
+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
@@ -168,7 +168,7 @@ 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})
+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_CONFIG")
diff --git a/README.md b/README.md
index bfdb89e..efcfe94 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
### vsomeip
##### Copyright
-Copyright (C) 2015-2016, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+Copyright (C) 2015-2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
##### License
diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt
index 43a8f0a..2c04ab3 100644
--- a/daemon/CMakeLists.txt
+++ b/daemon/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/daemon/vsomeipd.cpp b/daemon/vsomeipd.cpp
index d79b300..6688ec2 100644
--- a/daemon/vsomeipd.cpp
+++ b/daemon/vsomeipd.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/documentation/doxygen.in b/documentation/doxygen.in
index 6654575..9090b73 100644
--- a/documentation/doxygen.in
+++ b/documentation/doxygen.in
@@ -1710,7 +1710,7 @@ INCLUDED_BY_GRAPH = YES
# 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 = YES
+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
@@ -1718,7 +1718,7 @@ CALL_GRAPH = YES
# 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 = YES
+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.
diff --git a/documentation/vsomeipUserGuide b/documentation/vsomeipUserGuide
index 059992a..ee972bf 100644
--- a/documentation/vsomeipUserGuide
+++ b/documentation/vsomeipUserGuide
@@ -15,7 +15,7 @@ vsomeip
Copyright
+++++++++
-Copyright (C) 2015-2016, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+Copyright (C) 2015-2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
License
+++++++
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index aca749c..017c56d 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/examples/hello_world/CMakeLists.txt b/examples/hello_world/CMakeLists.txt
index d6bc994..b7f7c78 100644
--- a/examples/hello_world/CMakeLists.txt
+++ b/examples/hello_world/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/examples/hello_world/hello_world_client.cpp b/examples/hello_world/hello_world_client.cpp
index 0854cc7..cecdf67 100644
--- a/examples/hello_world/hello_world_client.cpp
+++ b/examples/hello_world/hello_world_client.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/examples/hello_world/hello_world_service.cpp b/examples/hello_world/hello_world_service.cpp
index 0692b86..3a07cc0 100644
--- a/examples/hello_world/hello_world_service.cpp
+++ b/examples/hello_world/hello_world_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/examples/hello_world/readme b/examples/hello_world/readme
index 01c2ec9..3e1dc62 100644
--- a/examples/hello_world/readme
+++ b/examples/hello_world/readme
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/examples/notify-sample.cpp b/examples/notify-sample.cpp
index bead4ba..1bcd219 100644
--- a/examples/notify-sample.cpp
+++ b/examples/notify-sample.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/examples/readme.txt b/examples/readme.txt
index 038544e..219df9b 100644
--- a/examples/readme.txt
+++ b/examples/readme.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/examples/request-sample.cpp b/examples/request-sample.cpp
index 910c69e..39dfaaa 100644
--- a/examples/request-sample.cpp
+++ b/examples/request-sample.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/examples/response-sample.cpp b/examples/response-sample.cpp
index 0d947c3..b4b6250 100644
--- a/examples/response-sample.cpp
+++ b/examples/response-sample.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/examples/sample-ids.hpp b/examples/sample-ids.hpp
index b1a503d..6d31131 100644
--- a/examples/sample-ids.hpp
+++ b/examples/sample-ids.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/examples/subscribe-sample.cpp b/examples/subscribe-sample.cpp
index ab82df9..2526112 100644
--- a/examples/subscribe-sample.cpp
+++ b/examples/subscribe-sample.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/include/client.hpp b/implementation/configuration/include/client.hpp
index fcb4395..2ad9e1f 100644
--- a/implementation/configuration/include/client.hpp
+++ b/implementation/configuration/include/client.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/include/configuration.hpp b/implementation/configuration/include/configuration.hpp
index 75e7e55..88a978b 100644
--- a/implementation/configuration/include/configuration.hpp
+++ b/implementation/configuration/include/configuration.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/include/configuration_impl.hpp b/implementation/configuration/include/configuration_impl.hpp
index 584a69a..9693d72 100644
--- a/implementation/configuration/include/configuration_impl.hpp
+++ b/implementation/configuration/include/configuration_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/include/event.hpp b/implementation/configuration/include/event.hpp
index bc12ff1..499c49a 100644
--- a/implementation/configuration/include/event.hpp
+++ b/implementation/configuration/include/event.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/include/eventgroup.hpp b/implementation/configuration/include/eventgroup.hpp
index 7974d98..c26edc0 100644
--- a/implementation/configuration/include/eventgroup.hpp
+++ b/implementation/configuration/include/eventgroup.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/include/internal.hpp.in b/implementation/configuration/include/internal.hpp.in
index ca5a76c..72f1bd2 100644
--- a/implementation/configuration/include/internal.hpp.in
+++ b/implementation/configuration/include/internal.hpp.in
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -35,7 +35,7 @@
#define VSOMEIP_ROUTING_CLIENT 0
#define VSOMEIP_ROUTING_INFO_SIZE_INIT 256
-#ifdef WIN32
+#ifdef _WIN32
#define VSOMEIP_INTERNAL_BASE_PORT 51234
#define __func__ __FUNCTION__
#endif
@@ -43,7 +43,7 @@
#define VSOMEIP_UNICAST_ADDRESS "@VSOMEIP_UNICAST_ADDRESS@"
#define VSOMEIP_DEFAULT_CONNECT_TIMEOUT 100
-#define VSOMEIP_MAX_CONNECT_TIMEOUT 1000
+#define VSOMEIP_MAX_CONNECT_TIMEOUT 1600
#define VSOMEIP_DEFAULT_FLUSH_TIMEOUT 1000
#define VSOMEIP_DEFAULT_WATCHDOG_TIMEOUT 5000
@@ -95,13 +95,14 @@
#define VSOMEIP_RELEASE_SERVICE_COMMAND_SIZE 11
#define VSOMEIP_STOP_OFFER_SERVICE_COMMAND_SIZE 16
#define VSOMEIP_SUBSCRIBE_COMMAND_SIZE 16
-#define VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE 13
-#define VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE 13
+#define VSOMEIP_SUBSCRIBE_ACK_COMMAND_SIZE 15
+#define VSOMEIP_SUBSCRIBE_NACK_COMMAND_SIZE 15
#define VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE 14
#define VSOMEIP_REGISTER_EVENT_COMMAND_SIZE 15
#define VSOMEIP_UNREGISTER_EVENT_COMMAND_SIZE 14
+#define VSOMEIP_ID_RESPONSE_COMMAND_SIZE 12
-#ifndef WIN32
+#ifndef _WIN32
#include <pthread.h>
#endif
@@ -117,7 +118,7 @@
namespace vsomeip {
struct configuration_data_t {
-#ifndef WIN32
+#ifndef _WIN32
volatile char initialized_;
pthread_mutex_t mutex_;
#endif
@@ -130,7 +131,7 @@ struct configuration_data_t {
unsigned short routing_manager_host_;
};
-#ifndef WIN32
+#ifndef _WIN32
constexpr std::uint32_t MESSAGE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
#elif _MSC_VER >= 1900
constexpr std::uint32_t MESSAGE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
diff --git a/implementation/configuration/include/policy.hpp b/implementation/configuration/include/policy.hpp
index c7a5e36..e94d7b5 100644
--- a/implementation/configuration/include/policy.hpp
+++ b/implementation/configuration/include/policy.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/include/service.hpp b/implementation/configuration/include/service.hpp
index 8e72a02..b33cf72 100644
--- a/implementation/configuration/include/service.hpp
+++ b/implementation/configuration/include/service.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/include/service_instance_range.hpp b/implementation/configuration/include/service_instance_range.hpp
index 57a8c21..bf5f415 100644
--- a/implementation/configuration/include/service_instance_range.hpp
+++ b/implementation/configuration/include/service_instance_range.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/include/trace.hpp b/implementation/configuration/include/trace.hpp
index ebfc5bb..687e57e 100644
--- a/implementation/configuration/include/trace.hpp
+++ b/implementation/configuration/include/trace.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/include/watchdog.hpp b/implementation/configuration/include/watchdog.hpp
index 1d5696d..5466fb3 100644
--- a/implementation/configuration/include/watchdog.hpp
+++ b/implementation/configuration/include/watchdog.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/configuration/src/configuration.cpp b/implementation/configuration/src/configuration.cpp
index ea5bcda..c4039f7 100644
--- a/implementation/configuration/src/configuration.cpp
+++ b/implementation/configuration/src/configuration.cpp
@@ -1,11 +1,11 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/configuration_impl.hpp"
-#ifdef WIN32
+#ifdef _WIN32
extern "C"
{
__declspec(dllexport) std::shared_ptr<vsomeip::configuration> VSOMEIP_CFG_RUNTIME_SYMBOL;
@@ -14,7 +14,7 @@ extern "C"
std::shared_ptr<vsomeip::configuration> VSOMEIP_CFG_RUNTIME_SYMBOL(vsomeip::configuration::get());
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define CCALL __cdecl
#pragma section(".CRT$XCU",read)
#define INITIALIZER(f) \
diff --git a/implementation/configuration/src/configuration_impl.cpp b/implementation/configuration/src/configuration_impl.cpp
index f14589c..d2c6283 100644
--- a/implementation/configuration/src/configuration_impl.cpp
+++ b/implementation/configuration/src/configuration_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -244,7 +244,7 @@ void configuration_impl::read_data(const std::set<std::string> &_input,
_elements.push_back({ i, its_tree });
}
catch (boost::property_tree::json_parser_error &e) {
- #ifdef WIN32
+ #ifdef _WIN32
e; // silence MSVC warning C4101
#endif
_failed.insert(i);
@@ -1410,7 +1410,7 @@ void configuration_impl::load_selective_broadcasts_support(const element &_eleme
void configuration_impl::load_policies(const element &_element) {
-#ifdef WIN32
+#ifdef _WIN32
return;
#endif
try {
diff --git a/implementation/endpoints/include/buffer.hpp b/implementation/endpoints/include/buffer.hpp
index e9bb811..c384f0d 100644
--- a/implementation/endpoints/include/buffer.hpp
+++ b/implementation/endpoints/include/buffer.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/endpoints/include/client_endpoint.hpp b/implementation/endpoints/include/client_endpoint.hpp
index cbf9063..f607e49 100644
--- a/implementation/endpoints/include/client_endpoint.hpp
+++ b/implementation/endpoints/include/client_endpoint.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/endpoints/include/client_endpoint_impl.hpp b/implementation/endpoints/include/client_endpoint_impl.hpp
index 32f0c20..ef52067 100644
--- a/implementation/endpoints/include/client_endpoint_impl.hpp
+++ b/implementation/endpoints/include/client_endpoint_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -10,6 +10,7 @@
#include <deque>
#include <mutex>
#include <vector>
+#include <atomic>
#include <boost/array.hpp>
#include <boost/asio/io_service.hpp>
@@ -68,13 +69,16 @@ protected:
virtual void send_queued() = 0;
void shutdown_and_close_socket();
+ mutable std::mutex socket_mutex_;
socket_type socket_;
endpoint_type remote_;
boost::asio::steady_timer flush_timer_;
+
+ std::mutex connect_timer_mutex_;
boost::asio::steady_timer connect_timer_;
- uint32_t connect_timeout_;
- bool is_connected_;
+ std::atomic<uint32_t> connect_timeout_;
+ std::atomic<bool> is_connected_;
// send data
message_buffer_ptr_t packetizer_;
@@ -84,7 +88,6 @@ protected:
bool was_not_connected_;
- std::mutex stop_mutex_;
};
} // namespace vsomeip
diff --git a/implementation/endpoints/include/credentials.hpp b/implementation/endpoints/include/credentials.hpp
index c5d6ba8..63c3470 100644
--- a/implementation/endpoints/include/credentials.hpp
+++ b/implementation/endpoints/include/credentials.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/endpoints/include/endpoint.hpp b/implementation/endpoints/include/endpoint.hpp
index c09ab92..1b08e77 100644
--- a/implementation/endpoints/include/endpoint.hpp
+++ b/implementation/endpoints/include/endpoint.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/endpoints/include/endpoint_definition.hpp b/implementation/endpoints/include/endpoint_definition.hpp
index e4a3290..47f0c9f 100644
--- a/implementation/endpoints/include/endpoint_definition.hpp
+++ b/implementation/endpoints/include/endpoint_definition.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -8,6 +8,8 @@
#include <map>
#include <memory>
+#include <atomic>
+#include <mutex>
#include <boost/asio/ip/address.hpp>
@@ -22,16 +24,13 @@ public:
uint16_t _port, bool _is_reliable);
VSOMEIP_EXPORT const boost::asio::ip::address &get_address() const;
- VSOMEIP_EXPORT void set_address(const boost::asio::ip::address &_address);
VSOMEIP_EXPORT uint16_t get_port() const;
- VSOMEIP_EXPORT void set_port(uint16_t _port);
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 void set_reliable(bool _is_reliable);
VSOMEIP_EXPORT endpoint_definition(
const boost::asio::ip::address &_address,
@@ -39,9 +38,10 @@ public:
private:
boost::asio::ip::address address_;
uint16_t port_;
- uint16_t remote_port_;
+ std::atomic<uint16_t> remote_port_;
bool is_reliable_;
+ static std::mutex definitions_mutex_;
static std::map<boost::asio::ip::address,
std::map<uint16_t,
std::map<bool,
diff --git a/implementation/endpoints/include/endpoint_host.hpp b/implementation/endpoints/include/endpoint_host.hpp
index 25218d4..ddbb7e8 100644
--- a/implementation/endpoints/include/endpoint_host.hpp
+++ b/implementation/endpoints/include/endpoint_host.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -37,7 +37,7 @@ public:
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
+#ifndef _WIN32
virtual bool check_credentials(client_t _client, uid_t _uid, gid_t _gid) = 0;
#endif
};
diff --git a/implementation/endpoints/include/endpoint_impl.hpp b/implementation/endpoints/include/endpoint_impl.hpp
index 341325b..3c9b3da 100644
--- a/implementation/endpoints/include/endpoint_impl.hpp
+++ b/implementation/endpoints/include/endpoint_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -8,6 +8,8 @@
#include <map>
#include <memory>
+#include <mutex>
+#include <atomic>
#include <boost/asio/io_service.hpp>
#include <boost/asio/steady_timer.hpp>
@@ -66,7 +68,7 @@ protected:
std::weak_ptr<endpoint_host> host_;
bool is_supporting_magic_cookies_;
- bool has_enabled_magic_cookies_;
+ std::atomic<bool> has_enabled_magic_cookies_;
// Filter configuration
std::map<service_t, uint8_t> opened_;
@@ -77,6 +79,7 @@ protected:
bool sending_blocked_;
+ std::mutex local_mutex_;
endpoint_type local_;
};
diff --git a/implementation/endpoints/include/local_client_endpoint_impl.hpp b/implementation/endpoints/include/local_client_endpoint_impl.hpp
index 8f9b224..bd82b2c 100644
--- a/implementation/endpoints/include/local_client_endpoint_impl.hpp
+++ b/implementation/endpoints/include/local_client_endpoint_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -9,7 +9,7 @@
#include <boost/asio/io_service.hpp>
#include <boost/asio/local/stream_protocol.hpp>
-#ifdef WIN32
+#ifdef _WIN32
#include <boost/asio/ip/tcp.hpp>
#endif
@@ -19,7 +19,7 @@
namespace vsomeip {
-#ifdef WIN32
+#ifdef _WIN32
typedef client_endpoint_impl<
boost::asio::ip::tcp
> local_client_endpoint_base_impl;
diff --git a/implementation/endpoints/include/local_server_endpoint_impl.hpp b/implementation/endpoints/include/local_server_endpoint_impl.hpp
index a66a410..b0e8d86 100644
--- a/implementation/endpoints/include/local_server_endpoint_impl.hpp
+++ b/implementation/endpoints/include/local_server_endpoint_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -14,7 +14,7 @@
#include <boost/asio/local/stream_protocol.hpp>
#include <boost/enable_shared_from_this.hpp>
-#ifdef WIN32
+#ifdef _WIN32
#include <boost/asio/ip/tcp.hpp>
#endif
@@ -25,7 +25,7 @@
namespace vsomeip {
-#ifdef WIN32
+#ifdef _WIN32
typedef server_endpoint_impl<
boost::asio::ip::tcp
> local_server_endpoint_base_impl;
@@ -78,6 +78,7 @@ private:
static ptr create(std::weak_ptr<local_server_endpoint_impl> _server,
std::uint32_t _buffer_shrink_threshold);
socket_type & get_socket();
+ std::unique_lock<std::mutex> get_socket_lock();
void start();
void stop();
@@ -92,7 +93,11 @@ private:
std::uint32_t _buffer_shrink_threshold);
void send_magic_cookie();
+ void receive_cbk(boost::system::error_code const &_error,
+ std::size_t _bytes);
+ void calculate_shrink_count();
+ std::mutex socket_mutex_;
local_server_endpoint_impl::socket_type socket_;
std::weak_ptr<local_server_endpoint_impl> server_;
@@ -106,13 +111,10 @@ private:
client_t bound_client_;
- private:
- void receive_cbk(boost::system::error_code const &_error,
- std::size_t _bytes);
- void calculate_shrink_count();
};
-#ifdef WIN32
+ std::mutex acceptor_mutex_;
+#ifdef _WIN32
boost::asio::ip::tcp::acceptor acceptor_;
#else
boost::asio::local::stream_protocol::acceptor acceptor_;
diff --git a/implementation/endpoints/include/netlink_connector.hpp b/implementation/endpoints/include/netlink_connector.hpp
index c47e0f4..3c77bb7 100644
--- a/implementation/endpoints/include/netlink_connector.hpp
+++ b/implementation/endpoints/include/netlink_connector.hpp
@@ -1,18 +1,19 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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 NETLINK_CONNECTOR_HPP_
-#define NETLINK_CONNECTOR_HPP_
+#ifndef VSOMEIP_NETLINK_CONNECTOR_HPP
+#define VSOMEIP_NETLINK_CONNECTOR_HPP
-#ifndef WIN32
+#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>
@@ -205,6 +206,7 @@ private:
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;
@@ -215,6 +217,6 @@ private:
}
-#endif // NOT WIN32
+#endif // NOT _WIN32
-#endif /* NETLINK_CONNECTOR_HPP_ */
+#endif // VSOMEIP_NETLINK_CONNECTOR_HPP
diff --git a/implementation/endpoints/include/server_endpoint_impl.hpp b/implementation/endpoints/include/server_endpoint_impl.hpp
index 894c76f..701d6db 100644
--- a/implementation/endpoints/include/server_endpoint_impl.hpp
+++ b/implementation/endpoints/include/server_endpoint_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/endpoints/include/tcp_client_endpoint_impl.hpp b/implementation/endpoints/include/tcp_client_endpoint_impl.hpp
index 9f5d19d..2a7263d 100644
--- a/implementation/endpoints/include/tcp_client_endpoint_impl.hpp
+++ b/implementation/endpoints/include/tcp_client_endpoint_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -53,6 +53,9 @@ private:
std::uint32_t missing_capacity_;
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_;
};
} // namespace vsomeip
diff --git a/implementation/endpoints/include/tcp_server_endpoint_impl.hpp b/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
index 8ded105..c7b69f4 100644
--- a/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
+++ b/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -63,6 +63,7 @@ private:
std::uint32_t _max_message_size,
std::uint32_t _buffer_shrink_threshold);
socket_type & get_socket();
+ std::unique_lock<std::mutex> get_socket_lock();
void start();
void stop();
@@ -72,13 +73,20 @@ private:
void send_queued(queue_iterator_type _queue_iterator);
+ void set_remote_info(const endpoint_type &_remote);
+
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);
void 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();
+ std::mutex socket_mutex_;
tcp_server_endpoint_impl::socket_type socket_;
std::weak_ptr<tcp_server_endpoint_impl> server_;
@@ -91,18 +99,17 @@ private:
std::uint32_t shrink_count_;
const std::uint32_t buffer_shrink_threshold_;
- private:
- 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();
- std::mutex stop_mutex_;
+ endpoint_type remote_;
+ boost::asio::ip::address remote_address_;
+ std::uint16_t remote_port_;
};
+ std::mutex acceptor_mutex_;
boost::asio::ip::tcp::acceptor acceptor_;
std::mutex connections_mutex_;
std::map<endpoint_type, connection::ptr> connections_;
const std::uint32_t buffer_shrink_threshold_;
+ const std::uint16_t local_port_;
private:
void remove_connection(connection *_connection);
diff --git a/implementation/endpoints/include/udp_client_endpoint_impl.hpp b/implementation/endpoints/include/udp_client_endpoint_impl.hpp
index cd3bb25..0357303 100644
--- a/implementation/endpoints/include/udp_client_endpoint_impl.hpp
+++ b/implementation/endpoints/include/udp_client_endpoint_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -48,6 +48,9 @@ private:
void receive();
message_buffer_t recv_buffer_;
+
+ const boost::asio::ip::address remote_address_;
+ const std::uint16_t remote_port_;
};
} // namespace vsomeip
diff --git a/implementation/endpoints/include/udp_server_endpoint_impl.hpp b/implementation/endpoints/include/udp_server_endpoint_impl.hpp
index cdadb0a..8d4add0 100644
--- a/implementation/endpoints/include/udp_server_endpoint_impl.hpp
+++ b/implementation/endpoints/include/udp_server_endpoint_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -63,11 +63,15 @@ 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::set<std::string> joined_;
message_buffer_t recv_buffer_;
- std::mutex stop_mutex_;
+ std::mutex socket_mutex_;
+
+ const std::uint16_t local_port_;
};
} // namespace vsomeip
diff --git a/implementation/endpoints/include/virtual_server_endpoint_impl.hpp b/implementation/endpoints/include/virtual_server_endpoint_impl.hpp
index 2fd7005..0c09df3 100644
--- a/implementation/endpoints/include/virtual_server_endpoint_impl.hpp
+++ b/implementation/endpoints/include/virtual_server_endpoint_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/endpoints/src/client_endpoint_impl.cpp b/implementation/endpoints/src/client_endpoint_impl.cpp
index 5027aa7..b5d6c7e 100644
--- a/implementation/endpoints/src/client_endpoint_impl.cpp
+++ b/implementation/endpoints/src/client_endpoint_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -56,10 +56,23 @@ bool client_endpoint_impl<Protocol>::is_connected() const {
template<typename Protocol>
void client_endpoint_impl<Protocol>::stop() {
- if (socket_.is_open()) {
- connect_timer_.cancel();
- connect_timeout_ = VSOMEIP_DEFAULT_CONNECT_TIMEOUT;
+ {
+ std::lock_guard<std::mutex> its_lock(mutex_);
endpoint_impl<Protocol>::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);
@@ -74,13 +87,8 @@ void client_endpoint_impl<Protocol>::stop() {
times_slept++;
}
}
- {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- if (socket_.is_open()) {
- socket_.cancel();
- }
- }
}
+ shutdown_and_close_socket();
}
template<typename Protocol>
@@ -91,11 +99,14 @@ void client_endpoint_impl<Protocol>::restart() {
}
shutdown_and_close_socket();
is_connected_ = false;
- 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));
+ {
+ 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));
+ }
}
template<typename Protocol>
@@ -137,6 +148,10 @@ bool client_endpoint_impl<Protocol>::send(const uint8_t *_data,
}
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_);
@@ -196,26 +211,28 @@ void client_endpoint_impl<Protocol>::connect_cbk(
std::shared_ptr<endpoint_host> its_host = this->host_.lock();
if (its_host) {
if (_error && _error != boost::asio::error::already_connected) {
- if(socket_.is_open()) {
- shutdown_and_close_socket();
+ shutdown_and_close_socket();
+ {
+ 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));
}
-
- 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));
-
// Double the timeout as long as the maximum allowed is larger
if (connect_timeout_ < VSOMEIP_MAX_CONNECT_TIMEOUT)
- connect_timeout_ <<= 1;
+ connect_timeout_ = (connect_timeout_ << 1);
if (is_connected_) {
is_connected_ = false;
its_host->on_disconnect(this->shared_from_this());
}
} else {
- connect_timer_.cancel();
+ {
+ std::lock_guard<std::mutex> its_lock(connect_timer_mutex_);
+ connect_timer_.cancel();
+ }
connect_timeout_ = VSOMEIP_DEFAULT_CONNECT_TIMEOUT; // TODO: use config variable
if (!is_connected_) {
@@ -225,10 +242,12 @@ void client_endpoint_impl<Protocol>::connect_cbk(
receive();
- std::lock_guard<std::mutex> its_lock(mutex_);
- if (queue_.size() > 0 && was_not_connected_) {
- was_not_connected_ = false;
- send_queued();
+ {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ if (queue_.size() > 0 && was_not_connected_) {
+ was_not_connected_ = false;
+ send_queued();
+ }
}
}
}
@@ -254,15 +273,13 @@ void client_endpoint_impl<Protocol>::send_cbk(
}
} else if (_error == boost::asio::error::broken_pipe) {
is_connected_ = false;
- if (endpoint_impl<Protocol>::sending_blocked_) {
- {
- std::lock_guard<std::mutex> its_lock(mutex_);
+ {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ if (endpoint_impl<Protocol>::sending_blocked_) {
queue_.clear();
}
}
- if (socket_.is_open()) {
- shutdown_and_close_socket();
- }
+ shutdown_and_close_socket();
connect();
} else if (_error == boost::asio::error::not_connected
|| _error == boost::asio::error::bad_descriptor) {
@@ -284,7 +301,7 @@ void client_endpoint_impl<Protocol>::flush_cbk(
template<typename Protocol>
void client_endpoint_impl<Protocol>::shutdown_and_close_socket() {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
+ std::lock_guard<std::mutex> its_lock(socket_mutex_);
if (socket_.is_open()) {
boost::system::error_code its_error;
socket_.shutdown(Protocol::socket::shutdown_both, its_error);
@@ -305,7 +322,7 @@ unsigned short client_endpoint_impl<Protocol>::get_remote_port() const {
}
// Instantiate template
-#ifndef WIN32
+#ifndef _WIN32
template class client_endpoint_impl<boost::asio::local::stream_protocol>;
#endif
template class client_endpoint_impl<boost::asio::ip::tcp>;
diff --git a/implementation/endpoints/src/credentials.cpp b/implementation/endpoints/src/credentials.cpp
index b718bd4..84f7f08 100644
--- a/implementation/endpoints/src/credentials.cpp
+++ b/implementation/endpoints/src/credentials.cpp
@@ -1,9 +1,9 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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
+#ifndef _WIN32
#include <sys/socket.h>
diff --git a/implementation/endpoints/src/endpoint_definition.cpp b/implementation/endpoints/src/endpoint_definition.cpp
index fe7e7d6..269f703 100644
--- a/implementation/endpoints/src/endpoint_definition.cpp
+++ b/implementation/endpoints/src/endpoint_definition.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -14,10 +14,12 @@ std::map<boost::asio::ip::address,
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) {
-
+ std::lock_guard<std::mutex> its_lock(definitions_mutex_);
std::shared_ptr<endpoint_definition> its_result;
auto find_address = definitions_.find(_address);
@@ -50,27 +52,14 @@ const boost::asio::ip::address & endpoint_definition::get_address() const {
return address_;
}
-void endpoint_definition::set_address(
- const boost::asio::ip::address &_address) {
- address_ = _address;
-}
-
uint16_t endpoint_definition::get_port() const {
return port_;
}
-void endpoint_definition::set_port(uint16_t _port) {
- port_ = _port;
-}
-
bool endpoint_definition::is_reliable() const {
return is_reliable_;
}
-void endpoint_definition::set_reliable(bool _is_reliable) {
- is_reliable_ = _is_reliable;
-}
-
uint16_t endpoint_definition::get_remote_port() const {
return remote_port_;
}
diff --git a/implementation/endpoints/src/endpoint_impl.cpp b/implementation/endpoints/src/endpoint_impl.cpp
index 7238d83..1707502 100644
--- a/implementation/endpoints/src/endpoint_impl.cpp
+++ b/implementation/endpoints/src/endpoint_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -135,7 +135,7 @@ uint32_t endpoint_impl<Protocol>::get_use_count() {
}
// Instantiate template
-#ifndef WIN32
+#ifndef _WIN32
template class endpoint_impl<boost::asio::local::stream_protocol>;
#endif
template class endpoint_impl<boost::asio::ip::tcp>;
diff --git a/implementation/endpoints/src/local_client_endpoint_impl.cpp b/implementation/endpoints/src/local_client_endpoint_impl.cpp
index 53dfc9d..5e847c5 100644
--- a/implementation/endpoints/src/local_client_endpoint_impl.cpp
+++ b/implementation/endpoints/src/local_client_endpoint_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -17,7 +17,7 @@
#include "../../configuration/include/configuration.hpp"
// Credentials
-#ifndef WIN32
+#ifndef _WIN32
#include "../include/credentials.hpp"
#endif
@@ -44,8 +44,16 @@ bool local_client_endpoint_impl::is_local() const {
}
void local_client_endpoint_impl::start() {
- if (socket_.is_open()) {
- sending_blocked_ = false;
+ bool is_open(false);
+ {
+ std::lock_guard<std::mutex> its_lock(socket_mutex_);
+ is_open = socket_.is_open();
+ }
+ if (is_open) {
+ {
+ std::lock_guard<std::mutex> its_lock(mutex_);
+ sending_blocked_ = false;
+ }
restart();
} else {
connect();
@@ -53,47 +61,61 @@ void local_client_endpoint_impl::start() {
}
void local_client_endpoint_impl::connect() {
- boost::system::error_code its_error;
- socket_.open(remote_.protocol(), its_error);
+ 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) {
- boost::system::error_code error;
- socket_.set_option(boost::asio::socket_base::reuse_address(true), error);
- error = socket_.connect(remote_, error);
+ if (!its_error || its_error == boost::asio::error::already_open) {
+ socket_.set_option(boost::asio::socket_base::reuse_address(true), its_error);
+ socket_.connect(remote_, its_connect_error);
// Credentials
-#ifndef WIN32
- if (!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());
+#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());
+ }
}
}
- }
#endif
- connect_cbk(error);
- } else {
- VSOMEIP_WARNING << "local_client_endpoint::connect: Error opening socket: "
- << its_error.message();
+ } 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() {
-#ifndef WIN32
- 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
- )
- );
+#ifndef _WIN32
+ 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
+ )
+ );
+ }
#endif
}
@@ -122,18 +144,21 @@ VSOMEIP_INFO << msg.str();
bufs.push_back(boost::asio::buffer(*its_buffer));
bufs.push_back(boost::asio::buffer(its_end_tag));
- 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
- )
- );
+ {
+ 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() {
@@ -145,7 +170,6 @@ void local_client_endpoint_impl::receive_cbk(
if (_error) {
if (_error == boost::asio::error::operation_aborted) {
// endpoint was stopped
- shutdown_and_close_socket();
return;
} else if (_error == boost::asio::error::connection_reset
|| _error == boost::asio::error::eof
diff --git a/implementation/endpoints/src/local_server_endpoint_impl.cpp b/implementation/endpoints/src/local_server_endpoint_impl.cpp
index 697fd3b..e2b6440 100644
--- a/implementation/endpoints/src/local_server_endpoint_impl.cpp
+++ b/implementation/endpoints/src/local_server_endpoint_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -19,7 +19,7 @@
#include "../../configuration/include/configuration.hpp"
// Credentials
-#ifndef WIN32
+#ifndef _WIN32
#include "../include/credentials.hpp"
#endif
@@ -46,7 +46,7 @@ local_server_endpoint_impl::local_server_endpoint_impl(
acceptor_.listen(boost::asio::socket_base::max_connections, ec);
boost::asio::detail::throw_error(ec, "acceptor listen");
-#ifndef WIN32
+#ifndef _WIN32
if (_host->get_configuration()->is_security_enabled()) {
credentials::activate_credentials(acceptor_.native());
}
@@ -69,7 +69,7 @@ local_server_endpoint_impl::local_server_endpoint_impl(
acceptor_.assign(_local.protocol(), native_socket, ec);
boost::asio::detail::throw_error(ec, "acceptor assign native socket");
-#ifndef WIN32
+#ifndef _WIN32
if (_host->get_configuration()->is_security_enabled()) {
credentials::activate_credentials(acceptor_.native());
}
@@ -84,41 +84,45 @@ bool local_server_endpoint_impl::is_local() const {
}
void local_server_endpoint_impl::start() {
+ std::lock_guard<std::mutex> its_lock(acceptor_mutex_);
if (acceptor_.is_open()) {
current_ = connection::create(
std::dynamic_pointer_cast<local_server_endpoint_impl>(
shared_from_this()), buffer_shrink_threshold_);
- acceptor_.async_accept(
- current_->get_socket(),
- std::bind(
- &local_server_endpoint_impl::accept_cbk,
- std::dynamic_pointer_cast<
- local_server_endpoint_impl
- >(shared_from_this()),
- current_,
- std::placeholders::_1
- )
- );
+ {
+ std::unique_lock<std::mutex> its_lock(current_->get_socket_lock());
+ acceptor_.async_accept(
+ current_->get_socket(),
+ std::bind(
+ &local_server_endpoint_impl::accept_cbk,
+ std::dynamic_pointer_cast<
+ local_server_endpoint_impl
+ >(shared_from_this()),
+ current_,
+ std::placeholders::_1
+ )
+ );
+ }
}
}
void local_server_endpoint_impl::stop() {
- if (acceptor_.is_open()) {
- boost::system::error_code its_error;
- acceptor_.close(its_error);
+ 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_) {
- if (c.second->get_socket().is_open()) {
- boost::system::error_code its_error;
- c.second->get_socket().cancel(its_error);
- }
+ c.second->stop();
}
connections_.clear();
}
- server_endpoint_impl::stop();
}
bool local_server_endpoint_impl::send_to(
@@ -176,11 +180,12 @@ void local_server_endpoint_impl::accept_cbk(
}
if (!_error) {
- socket_type &new_connection_socket = _connection->get_socket();
-#ifndef WIN32
+#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;
gid_t gid;
client_t client = credentials::receive_credentials(
@@ -191,6 +196,7 @@ void local_server_endpoint_impl::accept_cbk(
<< " 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;
}
@@ -199,11 +205,19 @@ void local_server_endpoint_impl::accept_cbk(
}
}
#endif
+
boost::system::error_code its_error;
- endpoint_type remote = new_connection_socket.remote_endpoint(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;
+ {
+ std::lock_guard<std::mutex> its_lock(connections_mutex_);
+ connections_[remote] = _connection;
+ }
_connection->start();
}
}
@@ -233,8 +247,9 @@ local_server_endpoint_impl::connection::create(
std::weak_ptr<local_server_endpoint_impl> _server,
std::uint32_t _buffer_shrink_threshold) {
const std::uint32_t its_initial_buffer_size = VSOMEIP_COMMAND_HEADER_SIZE
- + VSOMEIP_MAX_LOCAL_MESSAGE_SIZE + sizeof(instance_t) + sizeof(bool)
- + sizeof(bool);
+ + VSOMEIP_MAX_LOCAL_MESSAGE_SIZE
+ + static_cast<std::uint32_t>(sizeof(instance_t) + sizeof(bool)
+ + sizeof(bool));
return ptr(new connection(_server, its_initial_buffer_size,
_buffer_shrink_threshold));
}
@@ -244,11 +259,21 @@ 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_;
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);
@@ -277,6 +302,7 @@ void local_server_endpoint_impl::connection::start() {
}
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);
@@ -306,17 +332,20 @@ void local_server_endpoint_impl::connection::send_queued(
<< (int)(*its_buffer)[i] << " ";
VSOMEIP_INFO << msg.str();
#endif
- 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
- )
- );
+ {
+ 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::send_magic_cookie() {
@@ -326,7 +355,7 @@ 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) {
- stop();
+ // connection was stopped
return;
}
std::shared_ptr<local_server_endpoint_impl> its_server(server_.lock());
@@ -352,13 +381,24 @@ void local_server_endpoint_impl::connection::receive_cbk(
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;
- #define MESSAGE_IS_EMPTY std::size_t(-1)
- #define FOUND_MESSAGE std::size_t(-2)
+ 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 ||
@@ -367,10 +407,13 @@ void local_server_endpoint_impl::connection::receive_cbk(
its_start++;
}
- its_start = (its_start + 3 == recv_buffer_size_ + its_iteration_gap ?
- MESSAGE_IS_EMPTY : its_start+4);
+ if (its_start + 3 == recv_buffer_size_ + its_iteration_gap) {
+ message_is_empty = true;
+ } else {
+ its_start += 4;
+ }
- if (its_start != MESSAGE_IS_EMPTY) {
+ 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],
@@ -382,6 +425,10 @@ void local_server_endpoint_impl::connection::receive_cbk(
} else {
its_end = its_start;
}
+ 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 ||
@@ -389,6 +436,10 @@ void local_server_endpoint_impl::connection::receive_cbk(
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
@@ -415,7 +466,7 @@ void local_server_endpoint_impl::connection::receive_cbk(
}
}
- if (its_start != MESSAGE_IS_EMPTY &&
+ 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(),
@@ -433,10 +484,10 @@ void local_server_endpoint_impl::connection::receive_cbk(
recv_buffer_size_ -= (its_end + 4 - its_iteration_gap);
missing_capacity_ = 0;
its_command_size = 0;
- its_start = FOUND_MESSAGE;
+ found_message = true;
its_iteration_gap = its_end + 4;
} else {
- if (its_start != MESSAGE_IS_EMPTY && its_iteration_gap) {
+ 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) {
@@ -449,15 +500,12 @@ void local_server_endpoint_impl::connection::receive_cbk(
}
}
}
- } while (recv_buffer_size_ > 0 && its_start == FOUND_MESSAGE);
+ } while (recv_buffer_size_ > 0 && found_message);
}
if (_error == boost::asio::error::eof
|| _error == boost::asio::error::connection_reset) {
- {
- std::lock_guard<std::mutex> its_lock(its_server->connections_mutex_);
- stop();
- }
+ stop();
its_server->remove_connection(this);
} else if (_error != boost::asio::error::bad_descriptor) {
start();
diff --git a/implementation/endpoints/src/netlink_connector.cpp b/implementation/endpoints/src/netlink_connector.cpp
index aab5363..2d832c8 100644
--- a/implementation/endpoints/src/netlink_connector.cpp
+++ b/implementation/endpoints/src/netlink_connector.cpp
@@ -1,9 +1,9 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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
+#ifndef _WIN32
#include <thread>
@@ -24,7 +24,9 @@ void netlink_connector::unregister_net_if_changes_handler() {
}
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!";
@@ -32,6 +34,7 @@ void netlink_connector::stop() {
}
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);
@@ -145,23 +148,33 @@ void netlink_connector::receive_cbk(boost::system::error_code const &_error,
}
nlh = NLMSG_NEXT(nlh, len);
}
- 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
- )
- );
+ {
+ 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;
- if (socket_.is_open()) {
- socket_.close(its_error);
- if (its_error) {
- VSOMEIP_WARNING << "Error closing NETLINK socket!" << its_error.message();
+ {
+ 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_) {
@@ -220,15 +233,18 @@ void netlink_connector::send_ifi_request() {
get_link_msg.nlhdr.nlmsg_type = RTM_GETLINK;
get_link_msg.infomsg.ifi_family = AF_UNSPEC;
- 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
- )
- );
+ {
+ 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
+ )
+ );
+ }
}
bool netlink_connector::has_address(const struct ifaddrmsg * ifa_struct,
diff --git a/implementation/endpoints/src/server_endpoint_impl.cpp b/implementation/endpoints/src/server_endpoint_impl.cpp
index 4d4686b..1631c5d 100644
--- a/implementation/endpoints/src/server_endpoint_impl.cpp
+++ b/implementation/endpoints/src/server_endpoint_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -36,6 +36,8 @@ 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>
@@ -61,13 +63,13 @@ bool server_endpoint_impl<Protocol>::send(const uint8_t *_data,
endpoint_type its_target;
bool is_valid_target(false);
- if(endpoint_impl<Protocol>::sending_blocked_) {
- return 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));
@@ -107,10 +109,6 @@ bool server_endpoint_impl<Protocol>::send_intern(
message_buffer_ptr_t target_packetizer;
queue_iterator_type target_queue_iterator;
- if(endpoint_impl<Protocol>::sending_blocked_) {
- return false;
- }
-
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
@@ -213,7 +211,7 @@ void server_endpoint_impl<Protocol>::flush_cbk(
}
// Instantiate template
-#ifndef WIN32
+#ifndef _WIN32
template class server_endpoint_impl<boost::asio::local::stream_protocol>;
#endif
template class server_endpoint_impl<boost::asio::ip::tcp>;
diff --git a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
index 808efe5..e4c3b91 100644
--- a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
+++ b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -33,7 +33,9 @@ tcp_client_endpoint_impl::tcp_client_endpoint_impl(
recv_buffer_size_(0),
missing_capacity_(0),
shrink_count_(0),
- buffer_shrink_threshold_(_buffer_shrink_threshold) {
+ buffer_shrink_threshold_(_buffer_shrink_threshold),
+ remote_address_(_remote.address()),
+ remote_port_(_remote.port()) {
is_supporting_magic_cookies_ = true;
}
@@ -53,6 +55,7 @@ void tcp_client_endpoint_impl::start() {
}
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);
@@ -91,10 +94,15 @@ void tcp_client_endpoint_impl::connect() {
}
void tcp_client_endpoint_impl::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_;
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);
@@ -142,30 +150,32 @@ void tcp_client_endpoint_impl::send_queued() {
<< (int)(*its_buffer)[i] << " ";
VSOMEIP_INFO << msg.str();
#endif
-
- boost::asio::async_write(
- socket_,
- boost::asio::buffer(*its_buffer),
- std::bind(
- &tcp_client_endpoint_base_impl::send_cbk,
- shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2
- )
- );
+ {
+ std::lock_guard<std::mutex> its_lock(socket_mutex_);
+ boost::asio::async_write(
+ socket_,
+ boost::asio::buffer(*its_buffer),
+ 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 {
- const boost::asio::ip::address its_address = remote_.address();
- if (its_address.is_unspecified()) {
+ if (remote_address_.is_unspecified()) {
return false;
}
- _address = its_address;
+ _address = remote_address_;
return true;
}
unsigned short tcp_client_endpoint_impl::get_local_port() const {
+ std::lock_guard<std::mutex> its_lock(socket_mutex_);
boost::system::error_code its_error;
if (socket_.is_open()) {
return socket_.local_endpoint(its_error).port();
@@ -174,11 +184,7 @@ unsigned short tcp_client_endpoint_impl::get_local_port() const {
}
unsigned short tcp_client_endpoint_impl::get_remote_port() const {
- boost::system::error_code its_error;
- if (socket_.is_open()) {
- return socket_.remote_endpoint(its_error).port();
- }
- return 0;
+ return remote_port_;
}
bool tcp_client_endpoint_impl::is_reliable() const {
@@ -207,7 +213,6 @@ void tcp_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
- shutdown_and_close_socket();
return;
}
#if 0
@@ -221,19 +226,24 @@ void tcp_client_endpoint_impl::receive_cbk(
std::shared_ptr<endpoint_host> its_host = 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;
- boost::system::error_code its_error;
- endpoint_type its_endpoint(socket_.remote_endpoint(its_error));
- const boost::asio::ip::address its_remote_address(its_endpoint.address());
- const std::uint16_t its_remote_port(its_endpoint.port());
size_t its_iteration_gap = 0;
bool has_full_message;
do {
- uint32_t current_message_size
+ uint64_t read_message_size
= utility::get_message_size(&recv_buffer_[its_iteration_gap],
- (uint32_t) recv_buffer_size_);
- has_full_message = (current_message_size > 0
+ 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);
@@ -256,8 +266,8 @@ void tcp_client_endpoint_impl::receive_cbk(
current_message_size, this,
boost::asio::ip::address(),
VSOMEIP_ROUTING_CLIENT,
- its_remote_address,
- its_remote_port);
+ 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)) {
@@ -265,8 +275,8 @@ void tcp_client_endpoint_impl::receive_cbk(
current_message_size, this,
boost::asio::ip::address(),
VSOMEIP_ROUTING_CLIENT,
- its_remote_address,
- its_remote_port);
+ remote_address_,
+ remote_port_);
}
}
}
@@ -331,7 +341,7 @@ void tcp_client_endpoint_impl::receive_cbk(
_error == boost::asio::error::eof) {
VSOMEIP_TRACE << "tcp_client_endpoint: connection_reseted/EOF ~> close socket!";
shutdown_and_close_socket();
- } else if (socket_.is_open()) {
+ } else {
receive();
}
}
diff --git a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
index 4c5bdc7..684f735 100644
--- a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
+++ b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -26,7 +26,8 @@ tcp_server_endpoint_impl::tcp_server_endpoint_impl(
std::uint32_t _buffer_shrink_threshold)
: tcp_server_endpoint_base_impl(_host, _local, _io, _max_message_size),
acceptor_(_io),
- buffer_shrink_threshold_(_buffer_shrink_threshold) {
+ buffer_shrink_threshold_(_buffer_shrink_threshold),
+ local_port_(_local.port()) {
is_supporting_magic_cookies_ = true;
boost::system::error_code ec;
@@ -48,34 +49,40 @@ bool tcp_server_endpoint_impl::is_local() const {
}
void tcp_server_endpoint_impl::start() {
- connection::ptr new_connection = connection::create(
- std::dynamic_pointer_cast<tcp_server_endpoint_impl>(
- shared_from_this()), max_message_size_,
- buffer_shrink_threshold_);
-
- 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));
+ 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_);
+
+ {
+ 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() {
- if(acceptor_.is_open()) {
- boost::system::error_code its_error;
- acceptor_.close(its_error);
+ 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_) {
- if(c.second->get_socket().is_open()) {
- boost::system::error_code its_error;
- c.second->get_socket().cancel(its_error);
- }
+ for (const auto &c : connections_) {
+ c.second->stop();
}
connections_.clear();
}
- server_endpoint_impl::stop();
}
bool tcp_server_endpoint_impl::send_to(
@@ -134,7 +141,6 @@ void tcp_server_endpoint_impl::remove_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 {
@@ -147,12 +153,21 @@ void tcp_server_endpoint_impl::accept_cbk(connection::ptr _connection,
boost::system::error_code const &_error) {
if (!_error) {
- socket_type &new_connection_socket = _connection->get_socket();
boost::system::error_code its_error;
- endpoint_type remote = new_connection_socket.remote_endpoint(its_error);
- if(!its_error) {
- std::lock_guard<std::mutex> its_lock(connections_mutex_);
- connections_[remote] = _connection;
+ 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);
+ }
+ if (!its_error) {
+ {
+ std::lock_guard<std::mutex> its_lock(connections_mutex_);
+ connections_[remote] = _connection;
+ }
_connection->start();
}
}
@@ -160,14 +175,11 @@ void tcp_server_endpoint_impl::accept_cbk(connection::ptr _connection,
&& _error != boost::asio::error::operation_aborted
&& _error != boost::asio::error::no_descriptors) {
start();
- } else {
- VSOMEIP_INFO << "Endpoint was stopped, don't starting again";
}
}
unsigned short tcp_server_endpoint_impl::get_local_port() const {
- boost::system::error_code its_error;
- return acceptor_.local_endpoint(its_error).port();
+ return local_port_;
}
bool tcp_server_endpoint_impl::is_reliable() const {
@@ -190,7 +202,8 @@ tcp_server_endpoint_impl::connection::connection(
recv_buffer_size_(0),
missing_capacity_(0),
shrink_count_(0),
- buffer_shrink_threshold_(_buffer_shrink_threshold) {
+ buffer_shrink_threshold_(_buffer_shrink_threshold),
+ remote_port_(0) {
}
tcp_server_endpoint_impl::connection::ptr
@@ -210,19 +223,25 @@ 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();
- // Nagle algorithm off
- boost::system::error_code ec;
- socket_.set_option(ip::tcp::no_delay(true), ec);
}
void tcp_server_endpoint_impl::connection::receive() {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
+ 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_;
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);
@@ -246,7 +265,7 @@ void tcp_server_endpoint_impl::connection::receive() {
}
void tcp_server_endpoint_impl::connection::stop() {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
+ 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);
@@ -267,11 +286,14 @@ void tcp_server_endpoint_impl::connection::send_queued(
send_magic_cookie(its_buffer);
}
- boost::asio::async_write(socket_, boost::asio::buffer(*its_buffer),
- std::bind(&tcp_server_endpoint_base_impl::send_cbk,
- its_server,
- _queue_iterator, std::placeholders::_1,
- std::placeholders::_2));
+ {
+ std::lock_guard<std::mutex> its_lock(socket_mutex_);
+ boost::asio::async_write(socket_, boost::asio::buffer(*its_buffer),
+ std::bind(&tcp_server_endpoint_base_impl::send_cbk,
+ its_server,
+ _queue_iterator, std::placeholders::_1,
+ std::placeholders::_2));
+ }
}
void tcp_server_endpoint_impl::connection::send_magic_cookie(
@@ -293,7 +315,7 @@ 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) {
- stop();
+ // endpoint was stopped
return;
}
std::shared_ptr<tcp_server_endpoint_impl> its_server(server_.lock());
@@ -312,18 +334,23 @@ void tcp_server_endpoint_impl::connection::receive_cbk(
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;
- boost::system::error_code its_error;
- endpoint_type its_endpoint(socket_.remote_endpoint(its_error));
- const boost::asio::ip::address its_remote_address(its_endpoint.address());
- const std::uint16_t its_remote_port(its_endpoint.port());
size_t its_iteration_gap = 0;
bool has_full_message;
do {
- uint32_t current_message_size
+ uint64_t read_message_size
= utility::get_message_size(&recv_buffer_[its_iteration_gap],
- (uint32_t) recv_buffer_size_);
+ 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) {
@@ -340,7 +367,7 @@ void tcp_server_endpoint_impl::connection::receive_cbk(
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(),
- its_remote_address, its_remote_port);
+ remote_address_, remote_port_);
}
current_message_size = its_offset;
needs_forwarding = false;
@@ -359,23 +386,16 @@ void tcp_server_endpoint_impl::connection::receive_cbk(
std::memcpy(&its_session,
&recv_buffer_[its_iteration_gap + VSOMEIP_SESSION_POS_MIN],
sizeof(session_t));
- {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
- if (socket_.is_open()) {
- its_server->clients_mutex_.lock();
- if (!its_error) {
- its_server->clients_[its_client][its_session] = its_endpoint;
- }
- its_server->clients_mutex_.unlock();
- }
- }
+ its_server->clients_mutex_.lock();
+ its_server->clients_[its_client][its_session] = remote_;
+ its_server->clients_mutex_.unlock();
}
if (!its_server->has_enabled_magic_cookies_) {
its_host->on_message(&recv_buffer_[its_iteration_gap],
current_message_size, its_server.get(),
boost::asio::ip::address(),
- VSOMEIP_ROUTING_CLIENT, its_remote_address,
- its_remote_port);
+ 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)) {
@@ -383,7 +403,7 @@ void tcp_server_endpoint_impl::connection::receive_cbk(
current_message_size, its_server.get(),
boost::asio::ip::address(),
VSOMEIP_ROUTING_CLIENT,
- its_remote_address, its_remote_port);
+ remote_address_, remote_port_);
}
}
}
@@ -400,7 +420,7 @@ void tcp_server_endpoint_impl::connection::receive_cbk(
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(),
- its_remote_address, its_remote_port);
+ remote_address_, remote_port_);
}
recv_buffer_size_ -= its_offset;
its_iteration_gap += its_offset;
@@ -408,7 +428,7 @@ void tcp_server_endpoint_impl::connection::receive_cbk(
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(),
- its_remote_address, its_remote_port);
+ remote_address_, remote_port_);
}
}
} else if (max_message_size_ != MESSAGE_SIZE_UNLIMITED
@@ -519,6 +539,13 @@ client_t tcp_server_endpoint_impl::connection::get_client(endpoint_type _endpoin
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();
+}
+
// Dummies
void tcp_server_endpoint_impl::receive() {
// intentionally left empty
diff --git a/implementation/endpoints/src/udp_client_endpoint_impl.cpp b/implementation/endpoints/src/udp_client_endpoint_impl.cpp
index 6025252..579805e 100644
--- a/implementation/endpoints/src/udp_client_endpoint_impl.cpp
+++ b/implementation/endpoints/src/udp_client_endpoint_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -22,7 +22,9 @@ udp_client_endpoint_impl::udp_client_endpoint_impl(
boost::asio::io_service &_io)
: udp_client_endpoint_base_impl(_host, _local, _remote, _io,
VSOMEIP_MAX_UDP_MESSAGE_SIZE),
- recv_buffer_(VSOMEIP_MAX_UDP_MESSAGE_SIZE, 0) {
+ recv_buffer_(VSOMEIP_MAX_UDP_MESSAGE_SIZE, 0),
+ remote_address_(_remote.address()),
+ remote_port_(_remote.port()) {
}
udp_client_endpoint_impl::~udp_client_endpoint_impl() {
@@ -37,6 +39,7 @@ bool udp_client_endpoint_impl::is_local() const {
}
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) {
@@ -60,7 +63,10 @@ void udp_client_endpoint_impl::connect() {
void udp_client_endpoint_impl::start() {
boost::system::error_code its_error;
- socket_.open(remote_.protocol(), 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 {
@@ -85,18 +91,25 @@ void udp_client_endpoint_impl::send_queued() {
<< (int)(*its_buffer)[i] << " ";
VSOMEIP_INFO << msg.str();
#endif
- 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
- )
- );
+ {
+ 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_,
@@ -113,15 +126,15 @@ void udp_client_endpoint_impl::receive() {
bool udp_client_endpoint_impl::get_remote_address(
boost::asio::ip::address &_address) const {
- const boost::asio::ip::address its_address = remote_.address();
- if (its_address.is_unspecified()) {
+ if (remote_address_.is_unspecified()) {
return false;
}
- _address = its_address;
+ _address = remote_address_;
return true;
}
unsigned short udp_client_endpoint_impl::get_local_port() const {
+ std::lock_guard<std::mutex> its_lock(socket_mutex_);
boost::system::error_code its_error;
if (socket_.is_open()) {
return socket_.local_endpoint(its_error).port();
@@ -130,18 +143,13 @@ unsigned short udp_client_endpoint_impl::get_local_port() const {
}
unsigned short udp_client_endpoint_impl::get_remote_port() const {
- boost::system::error_code its_error;
- if (socket_.is_open()) {
- return socket_.remote_endpoint(its_error).port();
- }
- return 0;
+ 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
- shutdown_and_close_socket();
return;
}
std::shared_ptr<endpoint_host> its_host = host_.lock();
@@ -156,23 +164,28 @@ void udp_client_endpoint_impl::receive_cbk(
#endif
std::size_t remaining_bytes = _bytes;
std::size_t i = 0;
- boost::system::error_code its_error;
- endpoint_type its_endpoint(socket_.remote_endpoint(its_error));
- const boost::asio::ip::address its_remote_address(its_endpoint.address());
- const std::uint16_t its_remote_port(its_endpoint.port());
do {
- uint32_t current_message_size
+ uint64_t read_message_size
= utility::get_message_size(&this->recv_buffer_[i],
- (uint32_t) remaining_bytes);
+ 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, its_remote_address,
- its_remote_port);
+ VSOMEIP_ROUTING_CLIENT, remote_address_,
+ remote_port_);
} else {
VSOMEIP_ERROR << "Received a unreliable vSomeIP message with bad "
"length field. Message size: " << current_message_size
@@ -188,7 +201,7 @@ void udp_client_endpoint_impl::receive_cbk(
} else {
if (_error == boost::asio::error::connection_refused) {
shutdown_and_close_socket();
- } else if (socket_.is_open()) {
+ } else {
receive();
}
}
diff --git a/implementation/endpoints/src/udp_server_endpoint_impl.cpp b/implementation/endpoints/src/udp_server_endpoint_impl.cpp
index 28079d1..7a7a2e4 100644
--- a/implementation/endpoints/src/udp_server_endpoint_impl.cpp
+++ b/implementation/endpoints/src/udp_server_endpoint_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -28,7 +28,8 @@ udp_server_endpoint_impl::udp_server_endpoint_impl(
: server_endpoint_impl<ip::udp_ext>(
_host, _local, _io, VSOMEIP_MAX_UDP_MESSAGE_SIZE),
socket_(_io, _local.protocol()),
- recv_buffer_(VSOMEIP_MAX_UDP_MESSAGE_SIZE, 0) {
+ 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);
@@ -57,7 +58,7 @@ udp_server_endpoint_impl::udp_server_endpoint_impl(
socket_.set_option(option, ec);
boost::asio::detail::throw_error(ec, "broadcast option");
-#ifdef WIN32
+#ifdef _WIN32
const char* optval("0001");
::setsockopt(socket_.native(), IPPROTO_IP, IP_PKTINFO,
optval, sizeof(optval));
@@ -80,17 +81,19 @@ void udp_server_endpoint_impl::start() {
}
void udp_server_endpoint_impl::stop() {
- std::lock_guard<std::mutex> its_lock(stop_mutex_);
server_endpoint_impl::stop();
- if (socket_.is_open()) {
- boost::system::error_code its_error;
- socket_.shutdown(socket_type::shutdown_both, its_error);
- socket_.close(its_error);
+ {
+ 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(stop_mutex_);
+ 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_),
@@ -131,31 +134,44 @@ void udp_server_endpoint_impl::send_queued(
<< (int)(*its_buffer)[i] << " ";
VSOMEIP_INFO << msg.str();
#endif
- 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
- )
- );
+ {
+ 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());
}
void udp_server_endpoint_impl::join(const std::string &_address) {
+
try {
if (!is_joined(_address)) {
- if (local_.address().is_v4()) {
+ 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
+#ifdef _WIN32
socket_.set_option(boost::asio::ip::multicast::join_group(
boost::asio::ip::address::from_string(_address).to_v4(),
local_.address().to_v4()));
@@ -163,11 +179,12 @@ void udp_server_endpoint_impl::join(const std::string &_address) {
socket_.set_option(boost::asio::ip::multicast::join_group(
boost::asio::ip::address::from_string(_address).to_v4()));
#endif
- } else if (local_.address().is_v6()) {
+ } 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
+#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()));
@@ -176,48 +193,66 @@ void udp_server_endpoint_impl::join(const std::string &_address) {
boost::asio::ip::address::from_string(_address).to_v6()));
#endif
}
- joined_.insert(_address);
+ {
+ std::lock_guard<std::mutex> its_lock(joined_mutex_);
+ joined_.insert(_address);
+ }
} else {
VSOMEIP_INFO << "udp_server_endpoint_impl::join: "
"Trying to join already joined address: " << _address;
}
}
catch (const std::exception &e) {
- VSOMEIP_ERROR << e.what();
+ VSOMEIP_ERROR << __func__ << ":" << e.what();
}
}
void udp_server_endpoint_impl::leave(const std::string &_address) {
try {
if (is_joined(_address)) {
- if (local_.address().is_v4()) {
+ 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 (local_.address().is_v6()) {
+ } 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)));
}
- joined_.erase(_address);
+ {
+ std::lock_guard<std::mutex> its_lock(joined_mutex_);
+ joined_.erase(_address);
+ }
}
}
catch (const std::exception &e) {
- VSOMEIP_ERROR << e.what();
+ 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()) {
@@ -228,8 +263,7 @@ bool udp_server_endpoint_impl::get_default_target(service_t _service,
}
unsigned short udp_server_endpoint_impl::get_local_port() const {
- boost::system::error_code its_error;
- return socket_.local_endpoint(its_error).port();
+ return local_port_;
}
// TODO: find a better way to structure the receive functions
@@ -252,11 +286,20 @@ void udp_server_endpoint_impl::receive_cbk(
const boost::asio::ip::address its_remote_address(remote_.address());
const std::uint16_t its_remote_port(remote_.port());
do {
- uint32_t current_message_size
+ uint64_t read_message_size
= utility::get_message_size(&this->recv_buffer_[i],
- (uint32_t) remaining_bytes);
+ 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;
if (utility::is_request(
recv_buffer_[i + VSOMEIP_MESSAGE_TYPE_POS])) {
diff --git a/implementation/endpoints/src/virtual_server_endpoint_impl.cpp b/implementation/endpoints/src/virtual_server_endpoint_impl.cpp
index 516619f..4d83f62 100644
--- a/implementation/endpoints/src/virtual_server_endpoint_impl.cpp
+++ b/implementation/endpoints/src/virtual_server_endpoint_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/helper/boost/asio/basic_datagram_socket_ext.hpp b/implementation/helper/boost/asio/basic_datagram_socket_ext.hpp
index c9a9123..98314b9 100644
--- a/implementation/helper/boost/asio/basic_datagram_socket_ext.hpp
+++ b/implementation/helper/boost/asio/basic_datagram_socket_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
diff --git a/implementation/helper/boost/asio/datagram_socket_service_ext.hpp b/implementation/helper/boost/asio/datagram_socket_service_ext.hpp
index 3ce03d8..3934e50 100644
--- a/implementation/helper/boost/asio/datagram_socket_service_ext.hpp
+++ b/implementation/helper/boost/asio/datagram_socket_service_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
diff --git a/implementation/helper/boost/asio/detail/handler_type_requirements_ext.hpp b/implementation/helper/boost/asio/detail/handler_type_requirements_ext.hpp
index 3b66297..1e16823 100644
--- a/implementation/helper/boost/asio/detail/handler_type_requirements_ext.hpp
+++ b/implementation/helper/boost/asio/detail/handler_type_requirements_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
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
index fe50185..57f983c 100644
--- 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
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
diff --git a/implementation/helper/boost/asio/detail/impl/socket_ops_ext.ipp b/implementation/helper/boost/asio/detail/impl/socket_ops_ext.ipp
index cf80670..6772b77 100644
--- a/implementation/helper/boost/asio/detail/impl/socket_ops_ext.ipp
+++ b/implementation/helper/boost/asio/detail/impl/socket_ops_ext.ipp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
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
index c4f4547..b51ce24 100644
--- a/implementation/helper/boost/asio/detail/reactive_socket_recv_op_ext.hpp
+++ b/implementation/helper/boost/asio/detail/reactive_socket_recv_op_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
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
index afa6a66..d8c7030 100644
--- a/implementation/helper/boost/asio/detail/reactive_socket_recvfrom_op_ext.hpp
+++ b/implementation/helper/boost/asio/detail/reactive_socket_recvfrom_op_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
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
index ba0a714..3186464 100644
--- a/implementation/helper/boost/asio/detail/reactive_socket_recvmsg_op_ext.hpp
+++ b/implementation/helper/boost/asio/detail/reactive_socket_recvmsg_op_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
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
index cd0b19f..6c13114 100644
--- a/implementation/helper/boost/asio/detail/reactive_socket_service_base_ext.hpp
+++ b/implementation/helper/boost/asio/detail/reactive_socket_service_base_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
diff --git a/implementation/helper/boost/asio/detail/reactive_socket_service_ext.hpp b/implementation/helper/boost/asio/detail/reactive_socket_service_ext.hpp
index a13e5c8..39aa0cc 100644
--- a/implementation/helper/boost/asio/detail/reactive_socket_service_ext.hpp
+++ b/implementation/helper/boost/asio/detail/reactive_socket_service_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
diff --git a/implementation/helper/boost/asio/detail/reactor_op_ext.hpp b/implementation/helper/boost/asio/detail/reactor_op_ext.hpp
index 575fba2..c463679 100644
--- a/implementation/helper/boost/asio/detail/reactor_op_ext.hpp
+++ b/implementation/helper/boost/asio/detail/reactor_op_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
diff --git a/implementation/helper/boost/asio/detail/socket_ops_ext.hpp b/implementation/helper/boost/asio/detail/socket_ops_ext.hpp
index a272202..30db4f9 100644
--- a/implementation/helper/boost/asio/detail/socket_ops_ext.hpp
+++ b/implementation/helper/boost/asio/detail/socket_ops_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
diff --git a/implementation/helper/boost/asio/ip/udp_ext.hpp b/implementation/helper/boost/asio/ip/udp_ext.hpp
index d5f054e..7ceadce 100644
--- a/implementation/helper/boost/asio/ip/udp_ext.hpp
+++ b/implementation/helper/boost/asio/ip/udp_ext.hpp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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)
diff --git a/implementation/logging/include/defines.hpp b/implementation/logging/include/defines.hpp
index 6107979..1fbaa3c 100644
--- a/implementation/logging/include/defines.hpp
+++ b/implementation/logging/include/defines.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/logging/include/dlt_sink_backend.hpp b/implementation/logging/include/dlt_sink_backend.hpp
index 2031158..30ed027 100644
--- a/implementation/logging/include/dlt_sink_backend.hpp
+++ b/implementation/logging/include/dlt_sink_backend.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/logging/include/logger.hpp b/implementation/logging/include/logger.hpp
index 2d8cda4..9204692 100644
--- a/implementation/logging/include/logger.hpp
+++ b/implementation/logging/include/logger.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -8,7 +8,7 @@
#include <string>
-#ifdef WIN32
+#ifdef _WIN32
#include <iostream>
#endif
diff --git a/implementation/logging/include/logger_impl.hpp b/implementation/logging/include/logger_impl.hpp
index c4fa14a..4e628af 100644
--- a/implementation/logging/include/logger_impl.hpp
+++ b/implementation/logging/include/logger_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/logging/src/dlt_sink_backend.cpp b/implementation/logging/src/dlt_sink_backend.cpp
index 0af7722..9f37150 100644
--- a/implementation/logging/src/dlt_sink_backend.cpp
+++ b/implementation/logging/src/dlt_sink_backend.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/logging/src/logger.cpp b/implementation/logging/src/logger.cpp
index 54b5d75..630362d 100644
--- a/implementation/logging/src/logger.cpp
+++ b/implementation/logging/src/logger.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/logging/src/logger_impl.cpp b/implementation/logging/src/logger_impl.cpp
index 87a7af7..d1db6b2 100644
--- a/implementation/logging/src/logger_impl.cpp
+++ b/implementation/logging/src/logger_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/message/include/deserializer.hpp b/implementation/message/include/deserializer.hpp
index 7add37c..7449f9b 100644
--- a/implementation/message/include/deserializer.hpp
+++ b/implementation/message/include/deserializer.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/message/include/message_base_impl.hpp b/implementation/message/include/message_base_impl.hpp
index 40486a2..812c527 100644
--- a/implementation/message/include/message_base_impl.hpp
+++ b/implementation/message/include/message_base_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/message/include/message_header_impl.hpp b/implementation/message/include/message_header_impl.hpp
index 18f734d..5768bbe 100644
--- a/implementation/message/include/message_header_impl.hpp
+++ b/implementation/message/include/message_header_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/message/include/message_impl.hpp b/implementation/message/include/message_impl.hpp
index 102833a..a10afe5 100644
--- a/implementation/message/include/message_impl.hpp
+++ b/implementation/message/include/message_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/message/include/payload_impl.hpp b/implementation/message/include/payload_impl.hpp
index b034918..f9b05a2 100644
--- a/implementation/message/include/payload_impl.hpp
+++ b/implementation/message/include/payload_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/message/include/serializer.hpp b/implementation/message/include/serializer.hpp
index f19c853..c57797e 100644
--- a/implementation/message/include/serializer.hpp
+++ b/implementation/message/include/serializer.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/message/src/deserializer.cpp b/implementation/message/src/deserializer.cpp
index 63713e3..8a3c891 100644
--- a/implementation/message/src/deserializer.cpp
+++ b/implementation/message/src/deserializer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/message/src/message_base_impl.cpp b/implementation/message/src/message_base_impl.cpp
index c9597fc..2d690ff 100644
--- a/implementation/message/src/message_base_impl.cpp
+++ b/implementation/message/src/message_base_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -15,7 +15,7 @@ message_base_impl::message_base_impl()
}
message_base_impl::~message_base_impl() {
-};
+}
// header interface
message_t message_base_impl::get_message() const {
diff --git a/implementation/message/src/message_header_impl.cpp b/implementation/message/src/message_header_impl.cpp
index fb33bc1..3965453 100644
--- a/implementation/message/src/message_header_impl.cpp
+++ b/implementation/message/src/message_header_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -19,7 +19,7 @@ message_header_impl::message_header_impl()
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_),
@@ -30,7 +30,7 @@ message_header_impl::message_header_impl(const message_header_impl &_header)
type_(_header.type_),
code_(_header.code_),
instance_(_header.instance_), owner_(_header.owner_) {
-};
+}
bool message_header_impl::serialize(serializer *_to) const {
return (0 != _to
@@ -43,7 +43,7 @@ bool message_header_impl::serialize(serializer *_to) const {
&& _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;
@@ -67,7 +67,7 @@ bool message_header_impl::deserialize(deserializer *_from) {
}
return is_successful;
-};
+}
message_base * message_header_impl::get_owner() const {
return owner_;
diff --git a/implementation/message/src/message_impl.cpp b/implementation/message/src/message_impl.cpp
index 1d3d6bd..09a7ba8 100644
--- a/implementation/message/src/message_impl.cpp
+++ b/implementation/message/src/message_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/message/src/payload_impl.cpp b/implementation/message/src/payload_impl.cpp
index 8920e0c..9794976 100644
--- a/implementation/message/src/payload_impl.cpp
+++ b/implementation/message/src/payload_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/message/src/serializer.cpp b/implementation/message/src/serializer.cpp
index 97ba410..d9277d6 100644
--- a/implementation/message/src/serializer.cpp
+++ b/implementation/message/src/serializer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -25,7 +25,7 @@ serializer::serializer(std::uint32_t _buffer_shrink_threshold) :
}
serializer::~serializer() {
-};
+}
bool serializer::serialize(const serializable *_from) {
return (_from && _from->serialize(this));
diff --git a/implementation/routing/include/event.hpp b/implementation/routing/include/event.hpp
index 6e1de4a..e127807 100644
--- a/implementation/routing/include/event.hpp
+++ b/implementation/routing/include/event.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -10,6 +10,7 @@
#include <memory>
#include <mutex>
#include <set>
+#include <atomic>
#include <boost/asio/io_service.hpp>
#include <boost/asio/ip/address.hpp>
@@ -93,6 +94,8 @@ public:
bool is_cache_placeholder() const;
void set_cache_placeholder(bool _is_cache_place_holder);
+ bool has_ref(client_t _client, bool _is_provided);
+
private:
void update_cbk(boost::system::error_code const &_error);
void notify(bool _flush);
@@ -111,25 +114,27 @@ private:
mutable std::mutex mutex_;
std::shared_ptr<message> message_;
- bool is_field_;
+ std::atomic<bool> is_field_;
boost::asio::steady_timer cycle_timer_;
std::chrono::milliseconds cycle_;
- bool change_resets_cycle_;
- bool is_updating_on_change_;
+ std::atomic<bool> change_resets_cycle_;
+
+ std::atomic<bool> is_updating_on_change_;
+ std::mutex eventgroups_mutex_;
std::set<eventgroup_t> eventgroups_;
- bool is_set_;
- bool is_provided_;
+ std::atomic<bool> is_set_;
+ std::atomic<bool> is_provided_;
std::mutex refs_mutex_;
std::map<client_t, std::map<bool, uint32_t>> refs_;
- bool is_shadow_;
+ std::atomic<bool> is_shadow_;
- bool is_cache_placeholder_;
+ std::atomic<bool> is_cache_placeholder_;
epsilon_change_func_t epsilon_change_func_;
};
diff --git a/implementation/routing/include/eventgroupinfo.hpp b/implementation/routing/include/eventgroupinfo.hpp
index fc3d321..ae3ab87 100644
--- a/implementation/routing/include/eventgroupinfo.hpp
+++ b/implementation/routing/include/eventgroupinfo.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -10,6 +10,8 @@
#include <list>
#include <memory>
#include <set>
+#include <mutex>
+#include <atomic>
#include <boost/asio/ip/address.hpp>
@@ -73,17 +75,21 @@ public:
VSOMEIP_EXPORT void set_threshold(uint8_t _threshold);
private:
- major_version_t major_;
- ttl_t ttl_;
+ 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_;
- uint8_t threshold_;
+ std::atomic<uint8_t> threshold_;
};
} // namespace vsomeip
diff --git a/implementation/routing/include/routing_manager.hpp b/implementation/routing/include/routing_manager.hpp
index 1fc63d4..4911701 100644
--- a/implementation/routing/include/routing_manager.hpp
+++ b/implementation/routing/include/routing_manager.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/routing/include/routing_manager_adapter.hpp b/implementation/routing/include/routing_manager_adapter.hpp
index 0dfe703..3d81120 100644
--- a/implementation/routing/include/routing_manager_adapter.hpp
+++ b/implementation/routing/include/routing_manager_adapter.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/routing/include/routing_manager_base.hpp b/implementation/routing/include/routing_manager_base.hpp
index 75d42c4..d3c0e04 100644
--- a/implementation/routing/include/routing_manager_base.hpp
+++ b/implementation/routing/include/routing_manager_base.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -113,7 +113,7 @@ public:
endpoint *_receiver,
const boost::asio::ip::address &_remote_address,
std::uint16_t _remote_port) = 0;
-#ifndef WIN32
+#ifndef _WIN32
virtual bool check_credentials(client_t _client, uid_t _uid, gid_t _gid);
#endif
@@ -177,10 +177,17 @@ protected:
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);
+
private:
std::shared_ptr<endpoint> create_local_unlocked(client_t _client);
std::shared_ptr<endpoint> find_local_unlocked(client_t _client);
+ std::set<std::tuple<service_t, instance_t, eventgroup_t>>
+ get_subscriptions(const client_t _client);
+
protected:
routing_manager_host *host_;
boost::asio::io_service &io_;
diff --git a/implementation/routing/include/routing_manager_host.hpp b/implementation/routing/include/routing_manager_host.hpp
index 27a1b1e..bbea181 100644
--- a/implementation/routing/include/routing_manager_host.hpp
+++ b/implementation/routing/include/routing_manager_host.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/routing/include/routing_manager_impl.hpp b/implementation/routing/include/routing_manager_impl.hpp
index 6e6bd45..d29a3d7 100644
--- a/implementation/routing/include/routing_manager_impl.hpp
+++ b/implementation/routing/include/routing_manager_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -94,6 +94,13 @@ public:
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,
@@ -304,6 +311,12 @@ private:
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);
+
std::shared_ptr<routing_manager_stub> stub_;
std::shared_ptr<sd::service_discovery> discovery_;
@@ -354,11 +367,12 @@ private:
bool if_state_running_;
std::mutex pending_sd_offers_mutex_;
std::vector<std::pair<service_t, instance_t>> pending_sd_offers_;
-#ifndef WIN32
+#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
diff --git a/implementation/routing/include/routing_manager_proxy.hpp b/implementation/routing/include/routing_manager_proxy.hpp
index 37ec8b5..27c071d 100644
--- a/implementation/routing/include/routing_manager_proxy.hpp
+++ b/implementation/routing/include/routing_manager_proxy.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -197,12 +197,37 @@ private:
std::set<eventgroup_t> eventgroups_;
bool operator<(const event_data_t &_other) const {
- return (service_ < _other.service_
- || (service_ == _other.service_
- && instance_ < _other.instance_)
- || (service_ == _other.service_
- && instance_ == _other.instance_
- && event_ < _other.event_));
+ if (service_ < _other.service_) {
+ return true;
+ }
+ if (service_ == _other.service_ && instance_ < _other.instance_) {
+ return true;
+ }
+ if (service_ == _other.service_ && instance_ == _other.instance_
+ && event_ < _other.event_) {
+ return true;
+ }
+ if (service_ == _other.service_ && instance_ == _other.instance_
+ && event_ == _other.event_
+ && is_provided_ != _other.is_provided_) {
+ return true;
+ }
+ if (service_ == _other.service_
+ && instance_ == _other.instance_
+ && event_ == _other.event_
+ && is_provided_ == _other.is_provided_
+ && is_field_ != _other.is_field_) {
+ return true;
+ }
+ if (service_ == _other.service_
+ && instance_ == _other.instance_
+ && event_ == _other.event_
+ && is_provided_ == _other.is_provided_
+ && is_field_ == _other.is_field_
+ && eventgroups_ < _other.eventgroups_) {
+ return true;
+ }
+ return false;
}
};
std::set<event_data_t> pending_event_registrations_;
@@ -218,7 +243,7 @@ private:
std::map<service_t,
std::map<instance_t, std::map<eventgroup_t, uint32_t > > > remote_subscriber_count_;
- mutable std::recursive_mutex sender_mutex_;
+ mutable std::mutex sender_mutex_;
boost::asio::steady_timer register_application_timer_;
diff --git a/implementation/routing/include/routing_manager_stub.hpp b/implementation/routing/include/routing_manager_stub.hpp
index 9cc0255..3cf89a7 100644
--- a/implementation/routing/include/routing_manager_stub.hpp
+++ b/implementation/routing/include/routing_manager_stub.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -82,7 +82,7 @@ public:
bool is_registered(client_t _client) const;
void deregister_erroneous_client(client_t _client);
client_t get_client() const;
-#ifndef WIN32
+#ifndef _WIN32
virtual bool check_credentials(client_t _client, uid_t _uid, gid_t _gid);
#endif
private:
@@ -112,6 +112,7 @@ private:
private:
routing_manager_stub_host *host_;
boost::asio::io_service &io_;
+ std::mutex watchdog_timer_mutex_;
boost::asio::steady_timer watchdog_timer_;
std::string endpoint_path_;
diff --git a/implementation/routing/include/routing_manager_stub_host.hpp b/implementation/routing/include/routing_manager_stub_host.hpp
index 65bb28b..cb8e83c 100644
--- a/implementation/routing/include/routing_manager_stub_host.hpp
+++ b/implementation/routing/include/routing_manager_stub_host.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/routing/include/serviceinfo.hpp b/implementation/routing/include/serviceinfo.hpp
index c890435..7eab1ec 100644
--- a/implementation/routing/include/serviceinfo.hpp
+++ b/implementation/routing/include/serviceinfo.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -63,6 +63,7 @@ private:
std::shared_ptr<endpoint> reliable_;
std::shared_ptr<endpoint> unreliable_;
+ mutable std::mutex endpoint_mutex_;
std::mutex requesters_mutex_;
std::set<client_t> requesters_;
diff --git a/implementation/routing/include/types.hpp b/implementation/routing/include/types.hpp
index c483aee..9b803a5 100644
--- a/implementation/routing/include/types.hpp
+++ b/implementation/routing/include/types.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/routing/src/event.cpp b/implementation/routing/src/event.cpp
index b6947d0..5ede55e 100644
--- a/implementation/routing/src/event.cpp
+++ b/implementation/routing/src/event.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -173,6 +173,7 @@ void event::unset_payload(bool _force) {
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();
@@ -190,8 +191,10 @@ void event::set_update_on_change(bool _is_active) {
}
void event::set_epsilon_change_function(const epsilon_change_func_t &_epsilon_change_func) {
- if (_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 {
@@ -199,15 +202,18 @@ const std::set<eventgroup_t> & event::get_eventgroups() const {
}
void event::add_eventgroup(eventgroup_t _eventgroup) {
+ std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
eventgroups_.insert(_eventgroup);
}
void event::set_eventgroups(const std::set<eventgroup_t> &_eventgroups) {
+ std::lock_guard<std::mutex> its_lock(eventgroups_mutex_);
eventgroups_ = _eventgroups;
}
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 =
@@ -302,6 +308,20 @@ bool event::has_ref() {
return refs_.size() != 0;
}
+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_;
}
diff --git a/implementation/routing/src/eventgroupinfo.cpp b/implementation/routing/src/eventgroupinfo.cpp
index 3b3e657..0a32861 100644
--- a/implementation/routing/src/eventgroupinfo.cpp
+++ b/implementation/routing/src/eventgroupinfo.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -41,6 +41,7 @@ void eventgroupinfo::set_ttl(ttl_t _ttl) {
}
bool eventgroupinfo::is_multicast() const {
+ std::lock_guard<std::mutex> its_lock(address_mutex_);
return address_.is_multicast();
}
@@ -52,7 +53,7 @@ bool eventgroupinfo::is_sending_multicast() const {
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_;
@@ -63,28 +64,34 @@ bool eventgroupinfo::get_multicast(boost::asio::ip::address &_address,
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);
}
void eventgroupinfo::remove_event(std::shared_ptr<event> _event) {
+ std::lock_guard<std::mutex> its_lock(events_mutex_);
events_.erase(_event);
}
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++;
@@ -94,6 +101,7 @@ uint32_t eventgroupinfo::get_unreliable_target_count() const {
}
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);
@@ -101,14 +109,17 @@ void eventgroupinfo::add_multicast_target(const eventgroupinfo::target_t &_multi
}
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);
@@ -116,18 +127,30 @@ bool eventgroupinfo::add_target(const eventgroupinfo::target_t &_target) {
return (its_size != targets_.size());
}
-bool eventgroupinfo::add_target(const eventgroupinfo::target_t &_target, const eventgroupinfo::target_t &_subscriber) {
- std::size_t its_size = targets_.size();
- if (std::find(targets_.begin(), targets_.end(), _subscriber) == targets_.end()) {
- targets_.push_back(_subscriber);
+bool eventgroupinfo::add_target(const eventgroupinfo::target_t &_target,
+ const eventgroupinfo::target_t &_subscriber) {
+ bool add(false);
+ bool ret(false);
+ {
+ std::lock_guard<std::mutex> its_lock(targets_mutex_);
+ std::size_t its_size = targets_.size();
+ if (std::find(targets_.begin(), targets_.end(), _subscriber)
+ == targets_.end()) {
+ targets_.push_back(_subscriber);
+ add = true;
+ }
+ ret = (its_size != targets_.size());
+ }
+ if (add) {
add_multicast_target(_target);
}
- return (its_size != targets_.size());
+ 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_);
for (auto i = targets_.begin(); i != targets_.end(); i++) {
if (i->endpoint_->get_address() == _target->get_address() &&
i->endpoint_->get_port() == _target->get_port()) {
@@ -140,6 +163,7 @@ bool eventgroupinfo::update_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++) {
@@ -153,6 +177,7 @@ bool eventgroupinfo::remove_target(
}
void eventgroupinfo::clear_targets() {
+ std::lock_guard<std::mutex> its_lock(targets_mutex_);
targets_.clear();
}
diff --git a/implementation/routing/src/routing_manager_base.cpp b/implementation/routing/src/routing_manager_base.cpp
index 751a588..ac5da9c 100644
--- a/implementation/routing/src/routing_manager_base.cpp
+++ b/implementation/routing/src/routing_manager_base.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -116,7 +116,8 @@ void routing_manager_base::request_service(client_t _client, service_t _service,
auto its_info = find_service(_service, _instance);
if (its_info) {
if ((_major == its_info->get_major()
- || DEFAULT_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)) {
@@ -332,6 +333,15 @@ void routing_manager_base::unsubscribe(client_t _client, service_t _service,
auto its_group = its_instance->second.find(_eventgroup);
if (its_group != its_instance->second.end()) {
its_group->second.erase(_client);
+ if (!its_group->second.size()) {
+ its_instance->second.erase(_eventgroup);
+ if (!its_instance->second.size()) {
+ its_service->second.erase(_instance);
+ if (!its_service->second.size()) {
+ eventgroup_clients_.erase(_service);
+ }
+ }
+ }
}
}
}
@@ -433,6 +443,40 @@ void routing_manager_base::send_pending_notify_ones(service_t _service, instance
}
}
+void routing_manager_base::unset_all_eventpayloads(service_t _service,
+ instance_t _instance) {
+ 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()) {
+ event->unset_payload(true);
+ }
+ }
+ }
+ }
+}
+
+void routing_manager_base::unset_all_eventpayloads(service_t _service,
+ instance_t _instance,
+ eventgroup_t _eventgroup) {
+ 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()) {
+ event->unset_payload(true);
+ }
+ }
+ }
+ }
+}
+
bool routing_manager_base::send(client_t its_client,
std::shared_ptr<message> _message,
bool _flush) {
@@ -543,7 +587,7 @@ std::shared_ptr<endpoint> routing_manager_base::create_local_unlocked(client_t _
std::stringstream its_path;
its_path << VSOMEIP_BASE_PATH << std::hex << _client;
-#ifdef WIN32
+#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 ["
@@ -554,7 +598,7 @@ std::shared_ptr<endpoint> routing_manager_base::create_local_unlocked(client_t _
#endif
std::shared_ptr<local_client_endpoint_impl> its_endpoint = std::make_shared<
local_client_endpoint_impl>(shared_from_this(),
-#ifdef WIN32
+#ifdef _WIN32
boost::asio::ip::tcp::endpoint(address, port)
#else
boost::asio::local::stream_protocol::endpoint(its_path.str())
@@ -609,6 +653,14 @@ std::shared_ptr<endpoint> routing_manager_base::find_or_create_local(client_t _c
}
void routing_manager_base::remove_local(client_t _client) {
+ auto subscriptions = get_subscriptions(_client);
+ for (auto its_subscription : subscriptions) {
+ host_->on_subscription(std::get<0>(its_subscription), std::get<1>(its_subscription),
+ std::get<2>(its_subscription), _client, false);
+ routing_manager_base::unsubscribe(_client, std::get<0>(its_subscription),
+ std::get<1>(its_subscription), std::get<2>(its_subscription));
+ }
+
std::shared_ptr<endpoint> its_endpoint(find_local(_client));
if (its_endpoint) {
its_endpoint->stop();
@@ -634,40 +686,6 @@ void routing_manager_base::remove_local(client_t _client) {
local_services_.erase(si.first);
}
}
- // delete client's subscriptions if he didn't unsubscribe properly
- {
- std::lock_guard<std::mutex> its_lock(eventgroup_clients_mutex_);
- for (auto service_it = eventgroup_clients_.begin();
- service_it != eventgroup_clients_.end();) {
- for (auto instance_it = service_it->second.begin();
- instance_it != service_it->second.end();) {
- for (auto eventgroup_it = instance_it->second.begin();
- eventgroup_it != instance_it->second.end();) {
- if (eventgroup_it->second.erase(_client) > 0) {
- if (eventgroup_it->second.size() == 0) {
- eventgroup_it = instance_it->second.erase(eventgroup_it);
- } else {
- ++eventgroup_it;
- }
- } else {
- ++eventgroup_it;
- }
- }
-
- if (instance_it->second.size() == 0) {
- instance_it = service_it->second.erase(instance_it);
- } else {
- ++instance_it;
- }
- }
-
- if (service_it->second.size() == 0) {
- service_it = eventgroup_clients_.erase(service_it);
- } else {
- ++service_it;
- }
- }
- }
}
std::shared_ptr<endpoint> routing_manager_base::find_local(service_t _service,
@@ -904,7 +922,7 @@ void routing_manager_base::put_deserializer(std::shared_ptr<deserializer> _deser
deserializer_condition_.notify_one();
}
-#ifndef WIN32
+#ifndef _WIN32
bool routing_manager_base::check_credentials(client_t _client, uid_t _uid, gid_t _gid) {
return configuration_->check_credentials(_client, _uid, _gid);
}
@@ -934,5 +952,21 @@ void routing_manager_base::remove_pending_subscription(service_t _service,
if (it != pending_subscriptions_.end()) pending_subscriptions_.erase(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(eventgroup_clients_mutex_);
+ for (auto its_service : eventgroup_clients_) {
+ for (auto its_instance : its_service.second) {
+ for (auto its_eventgroup : its_instance.second) {
+ auto its_client = its_eventgroup.second.find(_client);
+ if (its_client != its_eventgroup.second.end()) {
+ result.insert(std::make_tuple(its_service.first, its_instance.first, its_eventgroup.first));
+ }
+ }
+ }
+ }
+ return result;
+}
+
} // namespace vsomeip
diff --git a/implementation/routing/src/routing_manager_impl.cpp b/implementation/routing/src/routing_manager_impl.cpp
index 00108a2..e78f400 100644
--- a/implementation/routing/src/routing_manager_impl.cpp
+++ b/implementation/routing/src/routing_manager_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -92,7 +92,7 @@ void routing_manager_impl::init() {
}
void routing_manager_impl::start() {
-#ifndef WIN32
+#ifndef _WIN32
netlink_connector_ = std::make_shared<netlink_connector>(host_->get_io(),
configuration_->get_unicast_address());
netlink_connector_->register_net_if_changes_handler(
@@ -115,9 +115,12 @@ void routing_manager_impl::start() {
}
#ifndef WITHOUT_SYSTEMD
- watchdog_timer_.expires_from_now(std::chrono::seconds(0));
- watchdog_timer_.async_wait(std::bind(&routing_manager_impl::watchdog_cbk,
- this, std::placeholders::_1));
+ {
+ 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
}
@@ -126,14 +129,17 @@ void routing_manager_impl::stop() {
std::lock_guard<std::mutex> its_lock(version_log_timer_mutex_);
version_log_timer_.cancel();
}
-#ifndef WIN32
+#ifndef _WIN32
if (netlink_connector_) {
netlink_connector_->stop();
}
#endif
#ifndef WITHOUT_SYSTEMD
- watchdog_timer_.cancel();
+ {
+ std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
+ watchdog_timer_.cancel();
+ }
sd_notify(0, "STOPPING=1");
#endif
@@ -251,10 +257,7 @@ void routing_manager_impl::request_service(client_t _client, service_t _service,
auto its_info = find_service(_service, _instance);
if (!its_info) {
- {
- std::lock_guard<std::mutex> ist_lock(requested_services_mutex_);
- requested_services_[_client][_service][_instance].insert({ _major, _minor });
- }
+ 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!
@@ -270,16 +273,14 @@ void routing_manager_impl::request_service(client_t _client, service_t _service,
}
} else {
if ((_major == its_info->get_major()
- || DEFAULT_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()) {
- {
- std::lock_guard<std::mutex> ist_lock(requested_services_mutex_);
- requested_services_[_client][_service][_instance].insert({ _major, _minor });
- its_info->add_client(_client);
- }
+ 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);
@@ -310,20 +311,7 @@ void routing_manager_impl::release_service(client_t _client, service_t _service,
<< std::hex << std::setw(4) << std::setfill('0') << _instance << "]";
routing_manager_base::release_service(_client, _service, _instance);
-
- {
- std::lock_guard<std::mutex> its_lock(requested_services_mutex_);
- auto its_client = requested_services_.find(_client);
- if (its_client != requested_services_.end()) {
- auto its_service = its_client->second.find(_service);
- if (its_service != its_client->second.end()) {
- auto its_instance = its_service->second.find(_instance);
- if (its_instance != its_service->second.end()) {
- its_service->second.erase(_instance);
- }
- }
- }
- }
+ requested_service_remove(_client, _service, _instance);
std::shared_ptr<serviceinfo> its_info(find_service(_service, _instance));
if(its_info && !its_info->is_local()) {
@@ -339,6 +327,7 @@ void routing_manager_impl::release_service(client_t _client, service_t _service,
clear_service_info(_service, _instance, 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);
@@ -462,9 +451,15 @@ void routing_manager_impl::unsubscribe(client_t _client, service_t _service,
_eventgroup);
if (found_eventgroup != found_instance->second.end()) {
found_eventgroup->second.erase(_client);
- if (0 == found_eventgroup->second.size()) {
+ if (!found_eventgroup->second.size()) {
last_subscriber_removed = true;
- eventgroup_clients_.erase(_eventgroup);
+ found_instance->second.erase(_eventgroup);
+ if (!found_service->second.size()) {
+ found_service->second.erase(_instance);
+ if (!found_service->second.size()) {
+ eventgroup_clients_.erase(_service);
+ }
+ }
}
}
}
@@ -487,6 +482,9 @@ void routing_manager_impl::unsubscribe(client_t _client, service_t _service,
}
}
}
+ if (last_subscriber_removed) {
+ unset_all_eventpayloads(_service, _instance, _eventgroup);
+ }
if (subscriber == VSOMEIP_ROUTING_CLIENT && last_subscriber_removed) {
// for normal subscribers only unsubscribe via SD if last
// subscriber was removed
@@ -751,6 +749,27 @@ bool routing_manager_impl::send_to(const std::shared_ptr<endpoint_definition> &_
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);
+ }
+}
+
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,
@@ -1549,7 +1568,7 @@ std::shared_ptr<endpoint> routing_manager_impl::create_server_endpoint(
its_endpoint->enable_magic_cookies();
}
} else {
-#ifndef WIN32
+#ifndef _WIN32
if (its_unicast.is_v4()) {
its_unicast = boost::asio::ip::address_v4::any();
} else if (its_unicast.is_v6()) {
@@ -1929,7 +1948,8 @@ std::chrono::milliseconds routing_manager_impl::add_routing_info(
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 == DEFAULT_MAJOR
+ || major_minor_pair.first == ANY_MAJOR)
&& (major_minor_pair.second <= _minor
|| _minor == DEFAULT_MINOR
|| major_minor_pair.second == ANY_MINOR)) {
@@ -1969,7 +1989,8 @@ std::chrono::milliseconds routing_manager_impl::add_routing_info(
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 == DEFAULT_MAJOR
+ || major_minor_pair.first == ANY_MAJOR)
&& (major_minor_pair.second <= _minor
|| _minor == DEFAULT_MINOR
|| major_minor_pair.second == ANY_MINOR)) {
@@ -2339,14 +2360,14 @@ void routing_manager_impl::on_subscribe(
get_client(_subscriber);
}
}
- stub_->send_subscribe(find_local(_service, _instance),
- client, _service, _instance, _eventgroup, its_eventgroup->get_major(), true);
// send initial events if we already have a cached field (is_set)
for (auto its_event : its_eventgroup->get_events()) {
if (its_event->is_field() && its_event->is_set()) {
its_event->notify_one(_subscriber, true); // TODO: use _flush parameter to send all event at once
}
}
+ stub_->send_subscribe(find_local(_service, _instance),
+ client, _service, _instance, _eventgroup, its_eventgroup->get_major(), true);
}
}
}
@@ -2397,25 +2418,27 @@ void routing_manager_impl::on_subscribe_ack(service_t _service,
instance_t _instance, const boost::asio::ip::address &_address,
uint16_t _port) {
- if (multicast_info.find(_service) != multicast_info.end()) {
- if (multicast_info[_service].find(_instance) != multicast_info[_service].end()) {
- auto endpoint_def = multicast_info[_service][_instance];
- 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!
- return;
+ {
+ std::lock_guard<std::recursive_mutex> its_lock(endpoint_mutex_);
+ if (multicast_info.find(_service) != multicast_info.end()) {
+ if (multicast_info[_service].find(_instance) != multicast_info[_service].end()) {
+ auto endpoint_def = multicast_info[_service][_instance];
+ 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!
+ return;
+ }
}
}
- }
-
- // 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);
- multicast_info[_service][_instance] = endpoint_def;
+ // 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);
+ multicast_info[_service][_instance] = endpoint_def;
+ }
bool is_someip = configuration_->is_someip(_service, _instance);
// Create multicast endpoint & join multicase group
@@ -2645,12 +2668,19 @@ void routing_manager_impl::clear_multicast_endpoints(service_t _service, instanc
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();
- auto multicast_endpoint = server_endpoints_[port][false];
- multicast_endpoint->leave(address);
- multicast_endpoint->stop();
- server_endpoints_[port].erase(false);
- if (server_endpoints_[port].find(true) == server_endpoints_[port].end()) {
- server_endpoints_.erase(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()) {
@@ -2659,7 +2689,7 @@ void routing_manager_impl::clear_multicast_endpoints(service_t _service, instanc
// Clear service_instances_ for multicase endpoint
if (1 >= service_instances_[_service].size()) {
service_instances_.erase(_service);
- } else {
+ } else if (multicast_endpoint) {
service_instances_[_service].erase(multicast_endpoint.get());
}
}
@@ -3032,6 +3062,7 @@ void routing_manager_impl::watchdog_cbk(boost::system::error_code const &_error)
}
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));
@@ -3501,7 +3532,7 @@ void routing_manager_impl::on_net_if_state_changed(std::string _if, bool _availa
if (_available) {
VSOMEIP_INFO << "Network interface \"" << _if << "\" is up and running.";
start_ip_routing();
-#ifndef WIN32
+#ifndef _WIN32
if (netlink_connector_) {
netlink_connector_->unregister_net_if_changes_handler();
}
@@ -3526,4 +3557,36 @@ void routing_manager_impl::start_ip_routing() {
pending_sd_offers_.clear();
}
+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_);
+ }
+ }
+ }
+ }
+ }
+}
+
} // namespace vsomeip
diff --git a/implementation/routing/src/routing_manager_proxy.cpp b/implementation/routing/src/routing_manager_proxy.cpp
index a000211..e12e962 100644
--- a/implementation/routing/src/routing_manager_proxy.cpp
+++ b/implementation/routing/src/routing_manager_proxy.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -10,7 +10,7 @@
#include <future>
#include <forward_list>
-#ifndef WIN32
+#ifndef _WIN32
// for umask
#include <sys/types.h>
#include <sys/stat.h>
@@ -54,7 +54,7 @@ void routing_manager_proxy::init() {
routing_manager_base::init();
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
sender_ = create_local(VSOMEIP_ROUTING_CLIENT);
}
@@ -64,24 +64,24 @@ void routing_manager_proxy::init() {
void routing_manager_proxy::start() {
is_started_ = true;
- {
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
- if (!sender_) {
- // application has been stopped and started again
- sender_ = create_local(VSOMEIP_ROUTING_CLIENT);
- }
- }
if (!receiver_) {
// application has been stopped and started again
init_receiver();
}
-
- if (sender_) {
- sender_->start();
+ if (receiver_) {
+ receiver_->start();
}
- 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() {
@@ -114,9 +114,15 @@ void routing_manager_proxy::stop() {
if (receiver_) {
receiver_->stop();
}
+ receiver_ = nullptr;
- if (sender_) {
- sender_->stop();
+ {
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
+ if (sender_) {
+ sender_->stop();
+ }
+ // delete the sender
+ sender_ = nullptr;
}
for (auto client: get_connected_clients()) {
@@ -125,15 +131,9 @@ void routing_manager_proxy::stop() {
}
}
- {
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
- // delete the sender
- sender_ = nullptr;
- }
- receiver_ = nullptr;
std::stringstream its_client;
its_client << VSOMEIP_BASE_PATH << std::hex << client_;
-#ifdef WIN32
+#ifdef _WIN32
::_unlink(its_client.str().c_str());
#else
if (-1 == ::unlink(its_client.str().c_str())) {
@@ -187,7 +187,7 @@ void routing_manager_proxy::send_offer_service(client_t _client,
sizeof(_minor));
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
sender_->send(its_command, sizeof(its_command));
}
@@ -226,7 +226,7 @@ void routing_manager_proxy::stop_offer_service(client_t _client,
sizeof(_minor));
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
sender_->send(its_command, sizeof(its_command));
}
@@ -287,31 +287,39 @@ void routing_manager_proxy::register_event(client_t _client,
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;
- routing_manager_base::register_event(_client, _service, _instance,
- _event,_eventgroups, _is_field,
- _cycle, _change_resets_cycle,
- _epsilon_change_func,
- _is_provided);
-
+ 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_);
- if (state_ == inner_state_type_e::ST_REGISTERED) {
+ 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);
}
- event_data_t registration = {
- _service,
- _instance,
- _event,
- _is_field,
- _is_provided,
- _eventgroups
- };
- pending_event_registrations_.insert(registration);
}
}
@@ -344,7 +352,7 @@ void routing_manager_proxy::unregister_event(client_t _client,
= static_cast<byte_t>(_is_provided);
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
sender_->send(its_command, sizeof(its_command));
}
@@ -418,11 +426,9 @@ void routing_manager_proxy::send_subscribe(client_t _client, service_t _service,
auto its_target = find_or_create_local(target_client);
its_target->send(its_command, sizeof(its_command));
} else {
- {
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
+ if (sender_) {
+ sender_->send(its_command, sizeof(its_command));
}
}
}
@@ -445,16 +451,16 @@ void routing_manager_proxy::send_subscribe_nack(client_t _subscriber,
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));
auto its_target = find_local(_subscriber);
if (its_target) {
its_target->send(its_command, sizeof(its_command));
} else {
- {
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
+ if (sender_) {
+ sender_->send(its_command, sizeof(its_command));
}
}
}
@@ -477,16 +483,16 @@ void routing_manager_proxy::send_subscribe_ack(client_t _subscriber,
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));
auto its_target = find_local(_subscriber);
if (its_target) {
its_target->send(its_command, sizeof(its_command));
} else {
- {
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
+ if (sender_) {
+ sender_->send(its_command, sizeof(its_command));
}
}
}
@@ -497,7 +503,6 @@ void routing_manager_proxy::unsubscribe(client_t _client, service_t _service,
{
std::lock_guard<std::mutex> its_lock(state_mutex_);
if (state_ == inner_state_type_e::ST_REGISTERED) {
- bool is_remote(false);
byte_t its_command[VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE];
uint32_t its_size = VSOMEIP_UNSUBSCRIBE_COMMAND_SIZE
- VSOMEIP_COMMAND_HEADER_SIZE;
@@ -513,19 +518,16 @@ void routing_manager_proxy::unsubscribe(client_t _client, service_t _service,
sizeof(_instance));
std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_eventgroup,
sizeof(_eventgroup));
- std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6], &is_remote,
- sizeof(is_remote));
+ its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 6] = 0; // 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::recursive_mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_command, sizeof(its_command));
- }
- };
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
+ if (sender_) {
+ sender_->send(its_command, sizeof(its_command));
+ }
}
}
remove_pending_subscription(_service, _instance);
@@ -591,11 +593,18 @@ bool routing_manager_proxy::send(client_t _client, const byte_t *_data,
_instance, _flush, _reliable, VSOMEIP_SEND);
}
}
- // If no direct endpoint could be found/is connected
+ // If no direct endpoint could be found
// or for notifications ~> route to routing_manager_stub
- if (!its_target || !its_target->is_connected()) {
+#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;
}
@@ -615,7 +624,7 @@ bool routing_manager_proxy::send(client_t _client, const byte_t *_data,
}
}
#ifdef USE_DLT
- else if (its_target != sender_) {
+ else if (!message_to_stub) {
const uint16_t its_data_size
= uint16_t(_size > USHRT_MAX ? USHRT_MAX : _size);
@@ -656,8 +665,11 @@ bool routing_manager_proxy::send_to(
}
void routing_manager_proxy::on_connect(std::shared_ptr<endpoint> _endpoint) {
- if (_endpoint != sender_) {
- return;
+ {
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
+ if (_endpoint != sender_) {
+ return;
+ }
}
is_connected_ = true;
if (is_connected_ && is_started_) {
@@ -668,7 +680,10 @@ void routing_manager_proxy::on_connect(std::shared_ptr<endpoint> _endpoint) {
}
void routing_manager_proxy::on_disconnect(std::shared_ptr<endpoint> _endpoint) {
- is_connected_ = !(_endpoint == sender_);
+ {
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
+ is_connected_ = !(_endpoint == sender_);
+ }
if (!is_connected_) {
host_->on_state(state_type_e::ST_DEREGISTERED);
}
@@ -717,8 +732,9 @@ void routing_manager_proxy::on_message(const byte_t *_data, length_t _size,
instance_t its_instance;
eventgroup_t its_eventgroup;
major_version_t its_major;
- bool is_remote_subscriber;
+ uint8_t is_remote_subscriber;
client_t routing_host_id = configuration_->get_id(configuration_->get_routing_host());
+ client_t its_subscriber;
if (_size > VSOMEIP_COMMAND_SIZE_POS_MAX) {
its_command = _data[VSOMEIP_COMMAND_TYPE_POS];
@@ -818,6 +834,10 @@ void routing_manager_proxy::on_message(const byte_t *_data, length_t _size,
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],
@@ -878,6 +898,10 @@ void routing_manager_proxy::on_message(const byte_t *_data, length_t _size,
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],
@@ -905,14 +929,20 @@ void routing_manager_proxy::on_message(const byte_t *_data, length_t _size,
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));
- on_subscribe_nack(its_client, its_service, its_instance, its_eventgroup);
+ on_subscribe_nack(its_subscriber, its_service, its_instance, its_eventgroup);
VSOMEIP_INFO << "SUBSCRIBE NACK("
<< std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
<< std::hex << std::setw(4) << std::setfill('0') << its_service << "."
@@ -921,14 +951,20 @@ void routing_manager_proxy::on_message(const byte_t *_data, length_t _size,
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));
- on_subscribe_ack(its_client, its_service, its_instance, its_eventgroup);
+ on_subscribe_ack(its_subscriber, its_service, its_instance, its_eventgroup);
VSOMEIP_INFO << "SUBSCRIBE ACK("
<< std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
<< std::hex << std::setw(4) << std::setfill('0') << its_service << "."
@@ -1160,20 +1196,16 @@ void routing_manager_proxy::on_routing_info(const byte_t *_data,
}
}
- if (clients_to_delete.size()) {
- std::async(std::launch::async, [this, clients_to_delete, restart_sender] () {
- for (const auto client : clients_to_delete) {
- if (client != VSOMEIP_ROUTING_CLIENT) {
- remove_local(client);
- }
- }
- });
+ for (const auto client : clients_to_delete) {
+ if (client != VSOMEIP_ROUTING_CLIENT) {
+ remove_local(client);
+ }
}
if (restart_sender && is_started_) {
VSOMEIP_INFO << std::hex << "Application/Client " << get_client()
<<": Reconnecting to routing manager.";
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
sender_->start();
}
@@ -1191,7 +1223,7 @@ void routing_manager_proxy::register_application() {
if (is_connected_) {
std::lock_guard<std::mutex> its_state_lock(state_mutex_);
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
{
state_ = inner_state_type_e::ST_REGISTERING;
@@ -1219,7 +1251,7 @@ void routing_manager_proxy::deregister_application() {
sizeof(its_size));
if (is_connected_)
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
sender_->send(&its_command[0], uint32_t(its_command.size()));
}
@@ -1234,11 +1266,9 @@ void routing_manager_proxy::send_pong() const {
sizeof(client_t));
if (is_connected_) {
- {
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
- if (sender_) {
- sender_->send(its_pong, sizeof(its_pong));
- }
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
+ if (sender_) {
+ sender_->send(its_pong, sizeof(its_pong));
}
}
}
@@ -1268,7 +1298,7 @@ void routing_manager_proxy::send_request_service(client_t _client, service_t _se
sizeof(_use_exclusive_proxy));
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
sender_->send(its_command, sizeof(its_command));
}
@@ -1294,7 +1324,7 @@ void routing_manager_proxy::send_release_service(client_t _client, service_t _se
sizeof(_instance));
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
sender_->send(its_command, sizeof(its_command));
}
@@ -1336,7 +1366,7 @@ void routing_manager_proxy::send_register_event(client_t _client,
}
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
sender_->send(its_command,
uint32_t(VSOMEIP_REGISTER_EVENT_COMMAND_SIZE
@@ -1361,8 +1391,7 @@ void routing_manager_proxy::on_subscribe_nack(client_t _client,
void routing_manager_proxy::on_identify_response(client_t _client, service_t _service,
instance_t _instance, bool _reliable) {
- static const uint32_t size = uint32_t(VSOMEIP_COMMAND_HEADER_SIZE + sizeof(service_t) + sizeof(instance_t)
- + sizeof(bool));
+ 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;
@@ -1377,7 +1406,7 @@ void routing_manager_proxy::on_identify_response(client_t _client, service_t _se
std::memcpy(&its_command[VSOMEIP_COMMAND_PAYLOAD_POS + 4], &_reliable,
sizeof(_reliable));
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
sender_->send(its_command, size);
}
@@ -1454,7 +1483,7 @@ void routing_manager_proxy::send_pending_commands() {
void routing_manager_proxy::init_receiver() {
std::stringstream its_client;
its_client << VSOMEIP_BASE_PATH << std::hex << client_;
-#ifdef WIN32
+#ifdef _WIN32
::_unlink(its_client.str().c_str());
int port = VSOMEIP_INTERNAL_BASE_PORT + client_;
#else
@@ -1472,14 +1501,14 @@ void routing_manager_proxy::init_receiver() {
#endif
try {
receiver_ = std::make_shared<local_server_endpoint_impl>(shared_from_this(),
-#ifdef WIN32
+#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());
-#ifdef WIN32
+#ifdef _WIN32
VSOMEIP_INFO << "Listening at " << port;
#else
VSOMEIP_INFO << "Listening at " << its_client.str();
@@ -1488,7 +1517,7 @@ void routing_manager_proxy::init_receiver() {
host_->on_error(error_code_e::SERVER_ENDPOINT_CREATION_FAILED);
VSOMEIP_ERROR << "Client ID: " << std::hex << client_ << ": " << e.what();
}
-#ifndef WIN32
+#ifndef _WIN32
::umask(previous_mask);
#endif
}
@@ -1514,7 +1543,7 @@ void routing_manager_proxy::notify_remote_initally(service_t _service, instance_
std::lock_guard<std::mutex> its_lock(serialize_mutex_);
if (serializer_->serialize(its_notification.get())) {
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ 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);
@@ -1573,7 +1602,7 @@ void routing_manager_proxy::register_application_timeout_cbk(
}
}
if (register_again) {
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ 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_) {
@@ -1592,7 +1621,7 @@ void routing_manager_proxy::send_registered_ack() {
std::memset(&its_command[VSOMEIP_COMMAND_SIZE_POS_MIN], 0,
sizeof(uint32_t));
{
- std::lock_guard<std::recursive_mutex> its_lock(sender_mutex_);
+ std::lock_guard<std::mutex> its_lock(sender_mutex_);
if (sender_) {
sender_->send(its_command, VSOMEIP_COMMAND_HEADER_SIZE);
}
diff --git a/implementation/routing/src/routing_manager_stub.cpp b/implementation/routing/src/routing_manager_stub.cpp
index ee75ec7..c048fe6 100644
--- a/implementation/routing/src/routing_manager_stub.cpp
+++ b/implementation/routing/src/routing_manager_stub.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -8,7 +8,7 @@
#include <iomanip>
#include <forward_list>
-#ifndef WIN32
+#ifndef _WIN32
// for umask
#include <sys/types.h>
#include <sys/stat.h>
@@ -101,12 +101,15 @@ void routing_manager_stub::stop() {
client_registration_thread_->join();
}
- watchdog_timer_.cancel();
+ {
+ std::lock_guard<std::mutex> its_lock(watchdog_timer_mutex_);
+ watchdog_timer_.cancel();
+ }
if( !is_socket_activated_) {
endpoint_->stop();
endpoint_ = nullptr;
-#ifdef WIN32
+#ifdef _WIN32
::_unlink(endpoint_path_.c_str());
#else
if (-1 == ::unlink(endpoint_path_.c_str())) {
@@ -119,7 +122,7 @@ void routing_manager_stub::stop() {
if(local_receiver_) {
local_receiver_->stop();
local_receiver_ = nullptr;
-#ifdef WIN32
+#ifdef _WIN32
::_unlink(local_receiver_path_.c_str());
#else
if (-1 == ::unlink(local_receiver_path_.c_str())) {
@@ -206,6 +209,7 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
bool is_remote_subscriber(false);
client_t its_client_from_header;
client_t its_target_client;
+ client_t its_subscriber;
its_command = _data[VSOMEIP_COMMAND_TYPE_POS];
std::memcpy(&its_client, &_data[VSOMEIP_COMMAND_CLIENT_POS],
@@ -255,6 +259,10 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
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,
@@ -269,6 +277,10 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
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,
@@ -284,6 +296,10 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
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],
@@ -309,6 +325,10 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
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],
@@ -320,13 +340,19 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
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));
- host_->on_subscribe_ack(its_client, its_service, its_instance, its_eventgroup);
+ std::memcpy(&its_subscriber, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
+ sizeof(its_subscriber));
+ host_->on_subscribe_ack(its_subscriber, its_service, its_instance, its_eventgroup);
VSOMEIP_INFO << "SUBSCRIBE ACK("
<< std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
<< std::hex << std::setw(4) << std::setfill('0') << its_service << "."
@@ -335,13 +361,19 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
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));
- host_->on_subscribe_nack(its_client, its_service, its_instance, its_eventgroup);
+ std::memcpy(&its_subscriber, &_data[VSOMEIP_COMMAND_PAYLOAD_POS + 6],
+ sizeof(its_subscriber));
+ host_->on_subscribe_nack(its_subscriber, its_service, its_instance, its_eventgroup);
VSOMEIP_INFO << "SUBSCRIBE NACK("
<< std::hex << std::setw(4) << std::setfill('0') << its_client << "): ["
<< std::hex << std::setw(4) << std::setfill('0') << its_service << "."
@@ -420,6 +452,10 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
break;
}
case VSOMEIP_REQUEST_SERVICE:
+ if (_size != VSOMEIP_REQUEST_SERVICE_COMMAND_SIZE) {
+ VSOMEIP_WARNING << "Received a REQUEST_SERVICE command with wrong size ~> skip!";
+ break;
+ }
std::memcpy(&its_service, &_data[VSOMEIP_COMMAND_PAYLOAD_POS],
sizeof(its_service));
std::memcpy(&its_instance,
@@ -443,6 +479,10 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
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,
@@ -452,6 +492,10 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
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));
@@ -490,6 +534,10 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
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,
@@ -516,6 +564,10 @@ void routing_manager_stub::on_message(const byte_t *_data, length_t _size,
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,
@@ -602,15 +654,13 @@ void routing_manager_stub::client_registration_func(void) {
} 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
+ // 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_ERROR_CASE) {
std::lock_guard<std::mutex> its_guard(routing_info_mutex_);
- if (b != registration_type_e::DEREGISTER_ERROR_CASE) {
- send_routing_info(r.first);
- }
+ send_routing_info(r.first);
}
if (b != registration_type_e::REGISTER) {
{
@@ -649,7 +699,7 @@ void routing_manager_stub::init_routing_endpoint() {
} 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
+ #ifndef _WIN32
try {
endpoint_ =
std::make_shared < local_server_endpoint_impl
@@ -666,7 +716,7 @@ void routing_manager_stub::init_routing_endpoint() {
#endif
is_socket_activated_ = true;
} else {
- #if WIN32
+ #if _WIN32
::_unlink(endpoint_path_.c_str());
int port = VSOMEIP_INTERNAL_BASE_PORT;
VSOMEIP_INFO << "Routing endpoint at " << port;
@@ -684,7 +734,7 @@ void routing_manager_stub::init_routing_endpoint() {
endpoint_ =
std::make_shared < local_server_endpoint_impl
> (shared_from_this(),
- #ifdef WIN32
+ #ifdef _WIN32
boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port),
#else
boost::asio::local::stream_protocol::endpoint(endpoint_path_),
@@ -697,7 +747,7 @@ void routing_manager_stub::init_routing_endpoint() {
VSOMEIP_ERROR << "routing_manager_stub::init_routing_endpoint Client ID: "
<< std::hex << VSOMEIP_ROUTING_CLIENT << ": " << e.what();
}
- #ifndef WIN32
+ #ifndef _WIN32
::umask(previous_mask);
#endif
is_socket_activated_ = false;
@@ -952,7 +1002,7 @@ void routing_manager_stub::send_subscribe_ack(client_t _client, service_t _servi
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(_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,
@@ -961,6 +1011,8 @@ void routing_manager_stub::send_subscribe_ack(client_t _client, service_t _servi
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));
its_endpoint->send(&its_command[0], sizeof(its_command), true);
}
@@ -978,7 +1030,7 @@ void routing_manager_stub::send_subscribe_nack(client_t _client, service_t _serv
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(_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,
@@ -987,6 +1039,8 @@ void routing_manager_stub::send_subscribe_nack(client_t _client, service_t _serv
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));
its_endpoint->send(&its_command[0], sizeof(its_command), true);
}
@@ -1024,7 +1078,8 @@ void routing_manager_stub::on_pong(client_t _client) {
if (found_info != routing_info_.end()) {
found_info->second.first = 0;
} else {
- VSOMEIP_ERROR << "Received PONG from unregistered application!";
+ VSOMEIP_ERROR << "Received PONG from unregistered application: "
+ << std::hex << std::setw(4) << std::setfill('0') << _client;
}
}
remove_from_pinged_clients(_client);
@@ -1032,17 +1087,21 @@ void routing_manager_stub::on_pong(client_t _client) {
}
void routing_manager_stub::start_watchdog() {
- // Divide / 2 as start and check sleep each
- watchdog_timer_.expires_from_now(
- std::chrono::milliseconds(configuration_->get_watchdog_timeout() / 2));
std::function<void(boost::system::error_code const &)> its_callback =
[this](boost::system::error_code const &_error) {
if (!_error)
- check_watchdog();
+ 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);
+ watchdog_timer_.async_wait(its_callback);
+ }
}
void routing_manager_stub::check_watchdog() {
@@ -1054,8 +1113,6 @@ void routing_manager_stub::check_watchdog() {
}
broadcast_ping();
- watchdog_timer_.expires_from_now(
- std::chrono::milliseconds(configuration_->get_watchdog_timeout() / 2));
std::function<void(boost::system::error_code const &)> its_callback =
[this](boost::system::error_code const &_error) {
@@ -1077,8 +1134,13 @@ void routing_manager_stub::check_watchdog() {
}
start_watchdog();
};
-
- watchdog_timer_.async_wait(its_callback);
+ {
+ 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() {
@@ -1088,7 +1150,7 @@ void routing_manager_stub::create_local_receiver() {
std::stringstream its_local_receiver_path;
its_local_receiver_path << VSOMEIP_BASE_PATH << std::hex << host_->get_client();
local_receiver_path_ = its_local_receiver_path.str();
-#if WIN32
+#if _WIN32
::_unlink(local_receiver_path_.c_str());
int port = VSOMEIP_INTERNAL_BASE_PORT;
#else
@@ -1109,7 +1171,7 @@ void routing_manager_stub::create_local_receiver() {
local_receiver_ =
std::make_shared < local_server_endpoint_impl
> (shared_from_this(),
- #ifdef WIN32
+ #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_),
@@ -1122,7 +1184,7 @@ void routing_manager_stub::create_local_receiver() {
VSOMEIP_ERROR << "routing_manager_stub::_local_receiver Client ID: "
<< std::hex << VSOMEIP_ROUTING_CLIENT << ": " << e.what();
}
-#ifndef WIN32
+#ifndef _WIN32
::umask(previous_mask);
#endif
local_receiver_->start();
@@ -1293,7 +1355,7 @@ client_t routing_manager_stub::get_client() const {
return host_->get_client();
}
-#ifndef WIN32
+#ifndef _WIN32
bool routing_manager_stub::check_credentials(client_t _client, uid_t _uid, gid_t _gid) {
return configuration_->check_credentials(_client, _uid, _gid);
}
diff --git a/implementation/routing/src/serviceinfo.cpp b/implementation/routing/src/serviceinfo.cpp
index d497fe1..3afc937 100644
--- a/implementation/routing/src/serviceinfo.cpp
+++ b/implementation/routing/src/serviceinfo.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -64,11 +64,13 @@ void serviceinfo::set_precise_ttl(std::chrono::milliseconds _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 {
diff --git a/implementation/runtime/include/application_impl.hpp b/implementation/runtime/include/application_impl.hpp
index b394512..a651a9e 100644
--- a/implementation/runtime/include/application_impl.hpp
+++ b/implementation/runtime/include/application_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -212,6 +212,7 @@ private:
void main_dispatch();
void dispatch();
void invoke_handler(std::shared_ptr<sync_handler> &_handler);
+ bool has_active_dispatcher();
bool is_active_dispatcher(std::thread::id &_id);
void remove_elapsed_dispatchers();
@@ -219,7 +220,12 @@ private:
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);
//
// Attributes
//
@@ -254,7 +260,9 @@ private:
mutable std::mutex members_mutex_;
// Availability handlers
- std::map<service_t, std::map<instance_t, std::tuple<major_version_t, minor_version_t, availability_handler_t, bool>>> availability_;
+ 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
@@ -314,11 +322,14 @@ private:
// Event subscriptions
std::mutex event_subscriptions_mutex_;
std::map<service_t, std::map<instance_t, std::map<event_t, bool>>> event_subscriptions_;
+ std::map<service_t, std::map<instance_t, std::set<eventgroup_t>>> eventgroup_subscriptions_;
std::thread::id stop_caller_id_;
std::thread::id start_caller_id_;
bool stopped_called_;
+
+
};
} // namespace vsomeip
diff --git a/implementation/runtime/include/runtime_impl.hpp b/implementation/runtime/include/runtime_impl.hpp
index 20c7c49..c376e6d 100644
--- a/implementation/runtime/include/runtime_impl.hpp
+++ b/implementation/runtime/include/runtime_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/runtime/src/application_impl.cpp b/implementation/runtime/src/application_impl.cpp
index 7ce2b1d..777c99a 100644
--- a/implementation/runtime/src/application_impl.cpp
+++ b/implementation/runtime/src/application_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -7,7 +7,7 @@
#include <thread>
#include <iomanip>
-#ifndef WIN32
+#ifndef _WIN32
#include <dlfcn.h>
#endif
@@ -242,8 +242,10 @@ void application_impl::start() {
stopped_called_ = false;
VSOMEIP_INFO << "Starting vsomeip application \"" << name_ << "\" using "
<< std::dec << io_thread_count << " threads";
-
- is_dispatching_ = true;
+ {
+ std::lock_guard<std::mutex> its_lock(handlers_mutex_);
+ is_dispatching_ = true;
+ }
start_caller_id_ = std::this_thread::get_id();
@@ -306,7 +308,7 @@ void application_impl::start() {
}
void application_impl::stop() {
-#ifndef WIN32 // Gives serious problems under Windows.
+#ifndef _WIN32 // Gives serious problems under Windows.
VSOMEIP_INFO << "Stopping vsomeip application \"" << name_ << "\".";
#endif
bool block = true;
@@ -380,41 +382,14 @@ void application_impl::subscribe(service_t _service, instance_t _instance,
if (routing_) {
bool send_back_cached(false);
bool send_back_cached_group(false);
- {
- std::lock_guard<std::mutex> its_lock(event_subscriptions_mutex_);
- auto found_service = event_subscriptions_.find(_service);
- if(found_service != event_subscriptions_.end()) {
- auto found_instance = found_service->second.find(_instance);
- if (found_instance != found_service->second.end()) {
- auto its_event = found_instance->second.find(_event);
- if (its_event == found_instance->second.end()) {
- // first subscription to this event
- event_subscriptions_[_service][_instance][_event] = false;
- } else {
- if(its_event->second) {
- // initial values for this event have already been sent,
- // send back cached value
- if(_event == ANY_EVENT) {
- send_back_cached_group = true;
- } else {
- send_back_cached = true;
- }
- }
- }
- } else {
- // first subscription to this service instance
- event_subscriptions_[_service][_instance][_event] = false;
- }
- } else {
- // first subscription to this service
- event_subscriptions_[_service][_instance][_event] = false;
- }
- }
- if(send_back_cached) {
+ 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, _event);
}
+
routing_->subscribe(client_, _service, _instance, _eventgroup, _major,
_subscription_type);
}
@@ -422,6 +397,7 @@ void application_impl::subscribe(service_t _service, instance_t _instance,
void application_impl::unsubscribe(service_t _service, instance_t _instance,
eventgroup_t _eventgroup) {
+ remove_subscription(_service, _instance, _eventgroup);
if (routing_)
routing_->unsubscribe(client_, _service, _instance, _eventgroup);
}
@@ -439,18 +415,62 @@ bool application_impl::is_available_unlocked(
bool is_available(false);
- 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) {
+ 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(_major == DEFAULT_MAJOR &&
- _minor == DEFAULT_MINOR){
- is_available = true;
+ }
+ }
+ } 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;
}
}
}
@@ -555,15 +575,11 @@ bool application_impl::are_available_unlocked(available_t &_available,
//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) {
+ 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] = _minor;
+ _available[its_available_services_it->first][its_available_instances_it->first][its_available_major_it->first] = found_available_major->second;
found_minor = true;
- } else {
- if(_minor == found_available_major->second) {
- _available[its_available_services_it->first][its_available_instances_it->first][_major] = _minor;
- found_minor = true;
- }
}
}
}
@@ -660,8 +676,8 @@ void application_impl::register_availability_handler(service_t _service,
do_register_availability_handler(_service, _instance,
_handler, _major, _minor);
} else {
- availability_[_service][_instance]
- = std::make_tuple(_major, _minor, _handler, false);
+ availability_[_service][_instance][_major][_minor] = std::make_pair(
+ _handler, false);
}
}
@@ -670,7 +686,8 @@ void application_impl::do_register_availability_handler(service_t _service,
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] = std::make_tuple(_major, _minor, _handler, true);
+ availability_[_service][_instance][_major][_minor] = std::make_pair(
+ _handler, true);
std::lock_guard<std::mutex> handlers_lock(handlers_mutex_);
@@ -692,12 +709,21 @@ void application_impl::unregister_availability_handler(service_t _service,
if (found_service != availability_.end()) {
auto found_instance = found_service->second.find(_instance);
if (found_instance != found_service->second.end()) {
- auto found_version = found_instance->second;
- auto found_major = std::get<0>(found_version);
- auto found_minor = std::get<1>(found_version);
- if(found_major == _major) {
- if(found_minor == _minor) {
- found_service->second.erase(_instance);
+ 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);
+ }
+ }
+ }
}
}
}
@@ -888,14 +914,18 @@ void application_impl::on_state(state_type_e _state) {
if (state_ != _state) {
state_ = _state;
if (state_ == state_type_e::ST_REGISTERED) {
- for (auto &its_service : availability_) {
- for (auto &its_instance : its_service.second) {
- if (!std::get<3>(its_instance.second)) {
- do_register_availability_handler(
- its_service.first, its_instance.first,
- std::get<2>(its_instance.second),
- std::get<0>(its_instance.second),
- std::get<1>(its_instance.second));
+ 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);
+ }
+ }
}
}
}
@@ -927,12 +957,7 @@ void application_impl::on_state(state_type_e _state) {
void application_impl::on_availability(service_t _service, instance_t _instance,
bool _is_available, major_version_t _major, minor_version_t _minor) {
- std::map<minor_version_t, availability_handler_t>::const_iterator found_minor;
- availability_handler_t its_handler;
- std::map<minor_version_t, availability_handler_t>::const_iterator found_wildcard_minor;
- availability_handler_t its_wildcard_handler;
- bool has_handler(false);
- bool has_wildcard_handler(false);
+ std::vector<availability_handler_t> its_handlers;
{
std::lock_guard<std::mutex> availability_lock(availability_mutex_);
@@ -956,53 +981,69 @@ void application_impl::on_availability(service_t _service, instance_t _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()) {
- //find specific instance
+ 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()) {
- auto found_version = found_instance->second;
- auto requested_major = std::get<0>(found_version);
- if(requested_major == _major) {
- has_handler = true;
- its_handler = std::get<2>(found_version);
- }
+ find_matching_handler(found_instance->second);
}
-
- //find wildcard instance major minor
found_instance = found_service->second.find(ANY_INSTANCE);
if( found_instance != found_service->second.end()) {
- auto found_version = found_instance->second;
- auto requested_major = std::get<0>(found_version);
- if(requested_major == ANY_MAJOR) {
- has_wildcard_handler = true;
- its_wildcard_handler = std::get<2>(found_version);
- }
+ find_matching_handler(found_instance->second);
}
}
-
- std::lock_guard<std::mutex> handlers_lock(handlers_mutex_);
- if (has_handler) {
-
- std::shared_ptr<sync_handler> its_sync_handler
- = std::make_shared<sync_handler>(
- [its_handler, _service, _instance, _is_available]() {
- its_handler(_service, _instance, _is_available);
- }
- );
-
- handlers_.push_back(its_sync_handler);
- }
- if (has_wildcard_handler) {
-
- std::shared_ptr<sync_handler> its_sync_handler
- = std::make_shared<sync_handler>(
- [its_wildcard_handler, _service, _instance, _is_available]() {
- its_wildcard_handler(_service, _instance, _is_available);
- }
- );
-
- handlers_.push_back(its_sync_handler);
+ {
+ 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);
+ });
+ handlers_.push_back(its_sync_handler);
+ }
}
}
if (!_is_available) {
@@ -1018,7 +1059,7 @@ void application_impl::on_availability(service_t _service, instance_t _instance,
}
}
- if (has_handler || has_wildcard_handler) {
+ if (its_handlers.size()) {
dispatcher_condition_.notify_one();
}
}
@@ -1048,11 +1089,11 @@ void application_impl::on_message(const std::shared_ptr<message> &&_message) {
}
} else {
// received a event from a service instance which nobody yet subscribed to
- event_subscriptions_[its_service][its_instance][its_method] = true;
+ return;
}
} else {
// received a event from a service which nobody yet subscribed to
- event_subscriptions_[its_service][its_instance][its_method] = true;
+ return;
}
}
@@ -1157,7 +1198,7 @@ void application_impl::main_dispatch() {
if(!is_dispatching_) {
its_lock.unlock();
-#ifdef WIN32
+#ifdef _WIN32
return;
#endif
}
@@ -1170,7 +1211,7 @@ void application_impl::dispatch() {
std::thread::id its_id = std::this_thread::get_id();
while (is_active_dispatcher(its_id)) {
std::unique_lock<std::mutex> its_lock(handlers_mutex_);
- if (handlers_.empty()) {
+ if (is_dispatching_ && handlers_.empty()) {
dispatcher_condition_.wait(its_lock);
if (handlers_.empty()) { // Maybe woken up from main dispatcher
std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
@@ -1178,7 +1219,8 @@ void application_impl::dispatch() {
return;
}
} else {
- while (!handlers_.empty() && is_active_dispatcher(its_id)) {
+ while (is_dispatching_ && !handlers_.empty()
+ && is_active_dispatcher(its_id)) {
std::shared_ptr<sync_handler> its_handler = handlers_.front();
handlers_.pop_front();
its_lock.unlock();
@@ -1205,15 +1247,19 @@ void application_impl::invoke_handler(std::shared_ptr<sync_handler> &_handler) {
std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
blocked_dispatchers_.insert(its_id);
- // 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.
- if (dispatchers_.size() < max_dispatchers_) {
- auto its_dispatcher = std::make_shared<std::thread>(
- std::bind(&application_impl::dispatch, this));
- dispatchers_[its_dispatcher->get_id()] = its_dispatcher;
+ if (has_active_dispatcher()) {
+ dispatcher_condition_.notify_all();
} else {
- VSOMEIP_ERROR << "Maximum number of dispatchers exceeded.";
+ // 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.
+ if (dispatchers_.size() < max_dispatchers_) {
+ auto its_dispatcher = std::make_shared<std::thread>(
+ std::bind(&application_impl::dispatch, this));
+ dispatchers_[its_dispatcher->get_id()] = its_dispatcher;
+ } else {
+ VSOMEIP_ERROR << "Maximum number of dispatchers exceeded.";
+ }
}
}
});
@@ -1226,11 +1272,22 @@ void application_impl::invoke_handler(std::shared_ptr<sync_handler> &_handler) {
}
}
+bool application_impl::has_active_dispatcher() {
+ for (auto d : dispatchers_) {
+ if (blocked_dispatchers_.find(d.first) == blocked_dispatchers_.end() &&
+ elapsed_dispatchers_.find(d.first) == elapsed_dispatchers_.end()) {
+ return true;
+ }
+ }
+ return false;
+}
+
bool application_impl::is_active_dispatcher(std::thread::id &_id) {
std::lock_guard<std::mutex> its_lock(dispatcher_mutex_);
for (auto d : dispatchers_) {
if (d.first != _id &&
- blocked_dispatchers_.find(d.first) == blocked_dispatchers_.end()) {
+ blocked_dispatchers_.find(d.first) == blocked_dispatchers_.end() &&
+ elapsed_dispatchers_.find(d.first) == elapsed_dispatchers_.end()) {
return false;
}
}
@@ -1277,7 +1334,7 @@ void application_impl::clear_all_handler() {
}
void application_impl::shutdown() {
-#ifndef WIN32
+#ifndef _WIN32
boost::asio::detail::posix_signal_blocker blocker;
#endif
@@ -1371,4 +1428,95 @@ void application_impl::set_routing_state(routing_state_e _routing_state) {
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(event_subscriptions_mutex_);
+
+ bool already_subscibed(false);
+ auto found_service = eventgroup_subscriptions_.find(_service);
+ if(found_service != eventgroup_subscriptions_.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()) {
+ already_subscibed = true;
+ }
+ }
+ }
+
+ if (already_subscibed) {
+ auto found_service = event_subscriptions_.find(_service);
+ if(found_service != event_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) {
+ // initial values for this event have already been sent,
+ // send back cached value
+ if(_event == ANY_EVENT) {
+ *_send_back_cached_eventgroup = true;
+ } else {
+ *_send_back_cached_event = true;
+ }
+ }
+ return;
+ }
+ }
+ }
+ }
+ event_subscriptions_[_service][_instance][_event] = false;
+ eventgroup_subscriptions_[_service][_instance].insert(_eventgroup);
+}
+
+void application_impl::remove_subscription(service_t _service,
+ instance_t _instance,
+ eventgroup_t _eventgroup) {
+ std::lock_guard<std::mutex> its_lock(event_subscriptions_mutex_);
+
+ auto found_service1 = eventgroup_subscriptions_.find(_service);
+ if(found_service1 != eventgroup_subscriptions_.end()) {
+ auto found_instance = found_service1->second.find(_instance);
+ if (found_instance != found_service1->second.end()) {
+ auto found_eventgroup = found_instance->second.find(_eventgroup);
+ if (found_eventgroup != found_instance->second.end()) {
+ found_instance->second.erase(_eventgroup);
+ if (!found_instance->second.size()) {
+ found_service1->second.erase(_instance);
+ if (!found_service1->second.size()) {
+ eventgroup_subscriptions_.erase(_service);
+ }
+ }
+ }
+ }
+ }
+
+ auto found_service = event_subscriptions_.find(_service);
+ if (found_service != event_subscriptions_.end()) {
+ auto found_instance = found_service->second.find(_instance);
+ if (found_instance != found_service->second.end()) {
+ if (routing_) {
+ std::set<std::shared_ptr<event>> its_events =
+ routing_->find_events(_service, _instance,
+ _eventgroup);
+ for (const auto &e : its_events) {
+ const event_t its_event(e->get_event());
+ auto found_event = found_instance->second.find(its_event);
+ if (found_event != found_instance->second.end()) {
+ found_instance->second.erase(its_event);
+ }
+ }
+ if (!found_instance->second.size()) {
+ found_service->second.erase(_instance);
+ if (!found_service->second.size()) {
+ event_subscriptions_.erase(_service);
+ }
+ }
+ }
+ }
+ }
+}
+
} // namespace vsomeip
diff --git a/implementation/runtime/src/error.cpp b/implementation/runtime/src/error.cpp
index 8bd1d36..998d1e7 100644
--- a/implementation/runtime/src/error.cpp
+++ b/implementation/runtime/src/error.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/runtime/src/runtime.cpp b/implementation/runtime/src/runtime.cpp
index 0259b2a..281cea1 100644
--- a/implementation/runtime/src/runtime.cpp
+++ b/implementation/runtime/src/runtime.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/runtime/src/runtime_impl.cpp b/implementation/runtime/src/runtime_impl.cpp
index 194368f..4ebb3ad 100644
--- a/implementation/runtime/src/runtime_impl.cpp
+++ b/implementation/runtime/src/runtime_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/configuration_option_impl.hpp b/implementation/service_discovery/include/configuration_option_impl.hpp
index d2351bc..e600523 100644
--- a/implementation/service_discovery/include/configuration_option_impl.hpp
+++ b/implementation/service_discovery/include/configuration_option_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/constants.hpp b/implementation/service_discovery/include/constants.hpp
index 01c55cb..31bff53 100644
--- a/implementation/service_discovery/include/constants.hpp
+++ b/implementation/service_discovery/include/constants.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/defines.hpp b/implementation/service_discovery/include/defines.hpp
index 83a67bf..425580a 100644
--- a/implementation/service_discovery/include/defines.hpp
+++ b/implementation/service_discovery/include/defines.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/deserializer.hpp b/implementation/service_discovery/include/deserializer.hpp
index ba9a82f..a1b45be 100755
--- a/implementation/service_discovery/include/deserializer.hpp
+++ b/implementation/service_discovery/include/deserializer.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/entry_impl.hpp b/implementation/service_discovery/include/entry_impl.hpp
index 25f08d2..fabca3b 100755
--- a/implementation/service_discovery/include/entry_impl.hpp
+++ b/implementation/service_discovery/include/entry_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/enumeration_types.hpp b/implementation/service_discovery/include/enumeration_types.hpp
index 6fb66f2..59538e5 100644
--- a/implementation/service_discovery/include/enumeration_types.hpp
+++ b/implementation/service_discovery/include/enumeration_types.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/eventgroupentry_impl.hpp b/implementation/service_discovery/include/eventgroupentry_impl.hpp
index 0eb8893..d9a6571 100755
--- a/implementation/service_discovery/include/eventgroupentry_impl.hpp
+++ b/implementation/service_discovery/include/eventgroupentry_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/ip_option_impl.hpp b/implementation/service_discovery/include/ip_option_impl.hpp
index e1344db..67f356b 100644
--- a/implementation/service_discovery/include/ip_option_impl.hpp
+++ b/implementation/service_discovery/include/ip_option_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/ipv4_option_impl.hpp b/implementation/service_discovery/include/ipv4_option_impl.hpp
index fd80be9..5f22534 100644
--- a/implementation/service_discovery/include/ipv4_option_impl.hpp
+++ b/implementation/service_discovery/include/ipv4_option_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/ipv6_option_impl.hpp b/implementation/service_discovery/include/ipv6_option_impl.hpp
index c6fd270..b082808 100644
--- a/implementation/service_discovery/include/ipv6_option_impl.hpp
+++ b/implementation/service_discovery/include/ipv6_option_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/load_balancing_option_impl.hpp b/implementation/service_discovery/include/load_balancing_option_impl.hpp
index 7504657..e65989e 100755
--- a/implementation/service_discovery/include/load_balancing_option_impl.hpp
+++ b/implementation/service_discovery/include/load_balancing_option_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/message_element_impl.hpp b/implementation/service_discovery/include/message_element_impl.hpp
index c05b76e..835326a 100755
--- a/implementation/service_discovery/include/message_element_impl.hpp
+++ b/implementation/service_discovery/include/message_element_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/message_impl.hpp b/implementation/service_discovery/include/message_impl.hpp
index add6fb4..1d658a5 100755
--- a/implementation/service_discovery/include/message_impl.hpp
+++ b/implementation/service_discovery/include/message_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/option_impl.hpp b/implementation/service_discovery/include/option_impl.hpp
index 21e8b9c..c4426e9 100644
--- a/implementation/service_discovery/include/option_impl.hpp
+++ b/implementation/service_discovery/include/option_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/primitive_types.hpp b/implementation/service_discovery/include/primitive_types.hpp
index 13f4478..f3a0c9f 100644
--- a/implementation/service_discovery/include/primitive_types.hpp
+++ b/implementation/service_discovery/include/primitive_types.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/protection_option_impl.hpp b/implementation/service_discovery/include/protection_option_impl.hpp
index e1f8d1e..589bb7a 100755
--- a/implementation/service_discovery/include/protection_option_impl.hpp
+++ b/implementation/service_discovery/include/protection_option_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/request.hpp b/implementation/service_discovery/include/request.hpp
index 99fe507..b835202 100644
--- a/implementation/service_discovery/include/request.hpp
+++ b/implementation/service_discovery/include/request.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/runtime.hpp b/implementation/service_discovery/include/runtime.hpp
index 656e2d5..468d5ba 100644
--- a/implementation/service_discovery/include/runtime.hpp
+++ b/implementation/service_discovery/include/runtime.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/runtime_impl.hpp b/implementation/service_discovery/include/runtime_impl.hpp
index 111d56e..4a8557f 100644
--- a/implementation/service_discovery/include/runtime_impl.hpp
+++ b/implementation/service_discovery/include/runtime_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/service_discovery.hpp b/implementation/service_discovery/include/service_discovery.hpp
index d3a62fc..43aa9cb 100644
--- a/implementation/service_discovery/include/service_discovery.hpp
+++ b/implementation/service_discovery/include/service_discovery.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/service_discovery_host.hpp b/implementation/service_discovery/include/service_discovery_host.hpp
index 66d81c8..f0ca34b 100644
--- a/implementation/service_discovery/include/service_discovery_host.hpp
+++ b/implementation/service_discovery/include/service_discovery_host.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/service_discovery_impl.hpp b/implementation/service_discovery/include/service_discovery_impl.hpp
index 083cdbd..13540d2 100644
--- a/implementation/service_discovery/include/service_discovery_impl.hpp
+++ b/implementation/service_discovery/include/service_discovery_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/serviceentry_impl.hpp b/implementation/service_discovery/include/serviceentry_impl.hpp
index 1385f84..c8ad7d0 100644
--- a/implementation/service_discovery/include/serviceentry_impl.hpp
+++ b/implementation/service_discovery/include/serviceentry_impl.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/include/subscription.hpp b/implementation/service_discovery/include/subscription.hpp
index 3cdcd34..2d23d4e 100644
--- a/implementation/service_discovery/include/subscription.hpp
+++ b/implementation/service_discovery/include/subscription.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/configuration_option_impl.cpp b/implementation/service_discovery/src/configuration_option_impl.cpp
index 933f7b1..cb1937e 100755
--- a/implementation/service_discovery/src/configuration_option_impl.cpp
+++ b/implementation/service_discovery/src/configuration_option_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/deserializer.cpp b/implementation/service_discovery/src/deserializer.cpp
index 351676f..a8c0a46 100644
--- a/implementation/service_discovery/src/deserializer.cpp
+++ b/implementation/service_discovery/src/deserializer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/entry_impl.cpp b/implementation/service_discovery/src/entry_impl.cpp
index 0637383..d647bf5 100755
--- a/implementation/service_discovery/src/entry_impl.cpp
+++ b/implementation/service_discovery/src/entry_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/eventgroupentry_impl.cpp b/implementation/service_discovery/src/eventgroupentry_impl.cpp
index 56ad9b0..29716d7 100755
--- a/implementation/service_discovery/src/eventgroupentry_impl.cpp
+++ b/implementation/service_discovery/src/eventgroupentry_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/ip_option_impl.cpp b/implementation/service_discovery/src/ip_option_impl.cpp
index 2dc5799..9be1c5f 100644
--- a/implementation/service_discovery/src/ip_option_impl.cpp
+++ b/implementation/service_discovery/src/ip_option_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/ipv4_option_impl.cpp b/implementation/service_discovery/src/ipv4_option_impl.cpp
index 2551bb0..b12d60e 100644
--- a/implementation/service_discovery/src/ipv4_option_impl.cpp
+++ b/implementation/service_discovery/src/ipv4_option_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/ipv6_option_impl.cpp b/implementation/service_discovery/src/ipv6_option_impl.cpp
index 28a2f02..ac9ebed 100755
--- a/implementation/service_discovery/src/ipv6_option_impl.cpp
+++ b/implementation/service_discovery/src/ipv6_option_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/load_balancing_option_impl.cpp b/implementation/service_discovery/src/load_balancing_option_impl.cpp
index 5c12c39..8fe8217 100755
--- a/implementation/service_discovery/src/load_balancing_option_impl.cpp
+++ b/implementation/service_discovery/src/load_balancing_option_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/message_element_impl.cpp b/implementation/service_discovery/src/message_element_impl.cpp
index 4c1a683..fb89d85 100755
--- a/implementation/service_discovery/src/message_element_impl.cpp
+++ b/implementation/service_discovery/src/message_element_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/message_impl.cpp b/implementation/service_discovery/src/message_impl.cpp
index dc9df91..d4d3931 100755
--- a/implementation/service_discovery/src/message_impl.cpp
+++ b/implementation/service_discovery/src/message_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/option_impl.cpp b/implementation/service_discovery/src/option_impl.cpp
index 8d2a11d..6854507 100755
--- a/implementation/service_discovery/src/option_impl.cpp
+++ b/implementation/service_discovery/src/option_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/protection_option_impl.cpp b/implementation/service_discovery/src/protection_option_impl.cpp
index 366f531..b7db090 100755
--- a/implementation/service_discovery/src/protection_option_impl.cpp
+++ b/implementation/service_discovery/src/protection_option_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/request.cpp b/implementation/service_discovery/src/request.cpp
index 6ed2d66..c726c3e 100644
--- a/implementation/service_discovery/src/request.cpp
+++ b/implementation/service_discovery/src/request.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/runtime.cpp b/implementation/service_discovery/src/runtime.cpp
index 3d12892..54276fd 100644
--- a/implementation/service_discovery/src/runtime.cpp
+++ b/implementation/service_discovery/src/runtime.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -6,7 +6,7 @@
#include "../include/runtime_impl.hpp"
#include "../../configuration/include/internal.hpp"
-#ifdef WIN32
+#ifdef _WIN32
extern "C"
{
__declspec(dllexport) std::shared_ptr<vsomeip::sd::runtime> VSOMEIP_SD_RUNTIME_SYMBOL;
@@ -15,7 +15,7 @@ extern "C"
std::shared_ptr<vsomeip::sd::runtime> VSOMEIP_SD_RUNTIME_SYMBOL(vsomeip::sd::runtime::get());
#endif
-#ifdef WIN32
+#ifdef _WIN32
#define CCALL __cdecl
#pragma section(".CRT$XCU",read)
#define INITIALIZER(f) \
diff --git a/implementation/service_discovery/src/runtime_impl.cpp b/implementation/service_discovery/src/runtime_impl.cpp
index 187b5bc..b2ed34d 100644
--- a/implementation/service_discovery/src/runtime_impl.cpp
+++ b/implementation/service_discovery/src/runtime_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp
index 5fec777..0cc2d6f 100644
--- a/implementation/service_discovery/src/service_discovery_impl.cpp
+++ b/implementation/service_discovery/src/service_discovery_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -1274,6 +1274,7 @@ void service_discovery_impl::process_offerservice_serviceentry(
if (0 < its_message->get_entries().size()) {
std::shared_ptr<endpoint_definition> its_target;
std::pair<session_t, bool> its_session;
+ std::lock_guard<std::mutex> its_lock(serialize_mutex_);
if (_reliable_port != ILLEGAL_PORT) {
its_target = endpoint_definition::get(
_reliable_address, port_, reliable_);
@@ -1285,7 +1286,6 @@ void service_discovery_impl::process_offerservice_serviceentry(
}
if (its_target) {
- std::lock_guard<std::mutex> its_lock(serialize_mutex_);
its_message->set_session(its_session.first);
its_message->set_reboot_flag(its_session.second);
serializer_->serialize(its_message.get());
@@ -1620,7 +1620,7 @@ void service_discovery_impl::process_eventgroupentry(
try {
its_option = _options.at(its_index);
} catch(const std::out_of_range& e) {
-#ifdef WIN32
+#ifdef _WIN32
e; // silence MSVC warining C4101
#endif
VSOMEIP_ERROR << "Fewer options in SD message than "
@@ -2009,13 +2009,13 @@ void service_discovery_impl::handle_eventgroup_subscription_ack(
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);
}
if (_address.is_multicast()) {
host_->on_subscribe_ack(_service, _instance, _address,
_port);
}
- host_->on_subscribe_ack(its_client.first, _service,
- _instance, _eventgroup);
}
}
}
diff --git a/implementation/service_discovery/src/serviceentry_impl.cpp b/implementation/service_discovery/src/serviceentry_impl.cpp
index 28da730..8ad66d2 100755
--- a/implementation/service_discovery/src/serviceentry_impl.cpp
+++ b/implementation/service_discovery/src/serviceentry_impl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/service_discovery/src/subscription.cpp b/implementation/service_discovery/src/subscription.cpp
index 06741cf..10e4a1c 100644
--- a/implementation/service_discovery/src/subscription.cpp
+++ b/implementation/service_discovery/src/subscription.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/tracing/include/defines.hpp b/implementation/tracing/include/defines.hpp
index 84ad5b6..1b98e16 100644
--- a/implementation/tracing/include/defines.hpp
+++ b/implementation/tracing/include/defines.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/tracing/include/enumeration_types.hpp b/implementation/tracing/include/enumeration_types.hpp
index 18ac861..62287bb 100644
--- a/implementation/tracing/include/enumeration_types.hpp
+++ b/implementation/tracing/include/enumeration_types.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/tracing/include/trace_connector.hpp b/implementation/tracing/include/trace_connector.hpp
index 81b2e38..9af4411 100644
--- a/implementation/tracing/include/trace_connector.hpp
+++ b/implementation/tracing/include/trace_connector.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/tracing/include/trace_header.hpp b/implementation/tracing/include/trace_header.hpp
index 47b2e22..95e0d83 100644
--- a/implementation/tracing/include/trace_header.hpp
+++ b/implementation/tracing/include/trace_header.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/tracing/src/trace_connector.cpp b/implementation/tracing/src/trace_connector.cpp
index 8abd0f1..08bbfd1 100644
--- a/implementation/tracing/src/trace_connector.cpp
+++ b/implementation/tracing/src/trace_connector.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -40,7 +40,7 @@ void trace_connector::init() {
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_DEBUG, DLT_TRACE_STATUS_ON);
+ DLT_REGISTER_CONTEXT_LL_TS(*dlt_context, it->first.c_str(), it->second.c_str(), DLT_LOG_INFO, DLT_TRACE_STATUS_ON);
}
}
#endif
@@ -110,7 +110,7 @@ bool trace_connector::add_channel(const trace_channel_t &_id, const std::string
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_DEBUG, DLT_TRACE_STATUS_ON);
+ DLT_REGISTER_CONTEXT_LL_TS(*dlt_context, _id.c_str(), _name.c_str(), DLT_LOG_INFO, DLT_TRACE_STATUS_ON);
}
#endif
diff --git a/implementation/tracing/src/trace_header.cpp b/implementation/tracing/src/trace_header.cpp
index 7e4c700..c92ce06 100644
--- a/implementation/tracing/src/trace_header.cpp
+++ b/implementation/tracing/src/trace_header.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/utility/include/byteorder.hpp b/implementation/utility/include/byteorder.hpp
index 2774618..f6a0e1b 100644
--- a/implementation/utility/include/byteorder.hpp
+++ b/implementation/utility/include/byteorder.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/implementation/utility/include/criticalsection.hpp b/implementation/utility/include/criticalsection.hpp
index 6e247a3..c980130 100644
--- a/implementation/utility/include/criticalsection.hpp
+++ b/implementation/utility/include/criticalsection.hpp
@@ -1,13 +1,17 @@
+// 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
+#ifdef _WIN32
// Windows: CriticalSection uses win32 CRITICAL_SECTION.
// Interface mimics std::mutex so we can use it in
@@ -39,6 +43,4 @@ namespace vsomeip {
} // namespace vsomeip
-
-
#endif //VSOMEIP_CRITICALSECTION_HPP
diff --git a/implementation/utility/include/utility.hpp b/implementation/utility/include/utility.hpp
index 2f8fc0f..f725517 100644
--- a/implementation/utility/include/utility.hpp
+++ b/implementation/utility/include/utility.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -61,10 +61,10 @@ public:
return (_type == message_type_e::MT_NOTIFICATION);
}
- static uint32_t get_message_size(const byte_t *_data, uint32_t _size);
- static inline uint32_t get_message_size(std::vector<byte_t> &_data) {
+ 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], uint32_t(_data.size())));
+ return (get_message_size(&_data[0], _data.size()));
}
return 0;
}
diff --git a/implementation/utility/src/criticalsection.cpp b/implementation/utility/src/criticalsection.cpp
index edf7deb..413ad19 100644
--- a/implementation/utility/src/criticalsection.cpp
+++ b/implementation/utility/src/criticalsection.cpp
@@ -1,7 +1,10 @@
+// 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
+#ifdef _WIN32
#include <Windows.h>
diff --git a/implementation/utility/src/utility.cpp b/implementation/utility/src/utility.cpp
index 51785ff..93b9eac 100644
--- a/implementation/utility/src/utility.cpp
+++ b/implementation/utility/src/utility.cpp
@@ -1,9 +1,9 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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
+#ifdef _WIN32
#include <iostream>
#else
#include <dlfcn.h>
@@ -14,7 +14,7 @@
#include <sys/stat.h>
-#ifndef WIN32
+#ifndef _WIN32
#include <fcntl.h>
#endif
@@ -27,7 +27,7 @@
#include "../../configuration/include/internal.hpp"
#include "../../logging/include/logger.hpp"
-#ifdef WIN32
+#ifdef _WIN32
#ifndef _WINSOCKAPI_
#include <Windows.h>
#endif
@@ -35,8 +35,8 @@
namespace vsomeip {
-uint32_t utility::get_message_size(const byte_t *_data, uint32_t _size) {
- uint32_t its_size(0);
+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]);
@@ -57,7 +57,7 @@ void * utility::load_library(const std::string &_path,
const std::string &_symbol) {
void * its_symbol = 0;
-#ifdef WIN32
+#ifdef _WIN32
std::string path = _path.substr(0, _path.length() - 5).substr(3) + ".dll";
HINSTANCE hDLL = LoadLibrary(path.c_str());
@@ -123,7 +123,7 @@ 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);
-#ifdef WIN32
+#ifdef _WIN32
// global (inter-process) mutex
static HANDLE configuration_data_mutex(INVALID_HANDLE_VALUE);
// memory mapping handle
@@ -133,7 +133,7 @@ static HANDLE its_descriptor(INVALID_HANDLE_VALUE);
bool utility::auto_configuration_init(const std::shared_ptr<configuration> &_config) {
std::unique_lock<CriticalSection> its_lock(its_local_configuration_mutex__);
-#ifdef WIN32
+#ifdef _WIN32
if (its_configuration_refs__ > 0) {
assert(configuration_data_mutex != INVALID_HANDLE_VALUE);
assert(its_descriptor != INVALID_HANDLE_VALUE);
@@ -377,7 +377,7 @@ bool utility::auto_configuration_init(const std::shared_ptr<configuration> &_con
void utility::auto_configuration_exit(client_t _client) {
std::unique_lock<CriticalSection> its_lock(its_local_configuration_mutex__);
if (the_configuration_data__) {
-#ifdef WIN32
+#ifdef _WIN32
// not manipulating data in shared memory, no need to take global mutex
assert(configuration_data_mutex != INVALID_HANDLE_VALUE);
@@ -434,7 +434,7 @@ bool utility::is_used_client_id(client_t _client) {
return true;
}
}
-#ifndef WIN32
+#ifndef _WIN32
std::stringstream its_client;
its_client << VSOMEIP_BASE_PATH << std::hex << _client;
if (exists(its_client.str())) {
@@ -453,7 +453,7 @@ client_t utility::request_client_id(const std::shared_ptr<configuration> &_confi
std::unique_lock<CriticalSection> its_lock(its_local_configuration_mutex__);
if (the_configuration_data__ != nullptr) {
-#ifdef WIN32
+#ifdef _WIN32
DWORD waitResult = WaitForSingleObject(configuration_data_mutex, INFINITE);
assert(waitResult == WAIT_OBJECT_0);
(void)waitResult;
@@ -467,7 +467,7 @@ client_t utility::request_client_id(const std::shared_ptr<configuration> &_confi
set_client_as_manager_host = true;
} else {
VSOMEIP_ERROR << "Routing manager with id " << the_configuration_data__->routing_manager_host_ << " already exists.";
-#ifdef WIN32
+#ifdef _WIN32
BOOL releaseResult = ReleaseMutex(configuration_data_mutex);
assert(releaseResult);
(void)releaseResult;
@@ -484,7 +484,7 @@ client_t utility::request_client_id(const std::shared_ptr<configuration> &_confi
== VSOMEIP_MAX_CLIENTS) {
VSOMEIP_ERROR << "Max amount of possible concurrent active"
<< " vsomeip applications reached.";
-#ifdef WIN32
+#ifdef _WIN32
BOOL releaseResult = ReleaseMutex(configuration_data_mutex);
assert(releaseResult);
(void)releaseResult;
@@ -539,7 +539,7 @@ client_t utility::request_client_id(const std::shared_ptr<configuration> &_confi
if (increase_count > VSOMEIP_MAX_CLIENTS) {
VSOMEIP_ERROR << "Max amount of possible concurrent active"
<< " vsomeip applications reached.";
-#ifdef WIN32
+#ifdef _WIN32
BOOL releaseResult = ReleaseMutex(configuration_data_mutex);
assert(releaseResult);
(void)releaseResult;
@@ -562,7 +562,7 @@ client_t utility::request_client_id(const std::shared_ptr<configuration> &_confi
the_configuration_data__->max_used_client_ids_index_++;
-#ifdef WIN32
+#ifdef _WIN32
BOOL releaseResult = ReleaseMutex(configuration_data_mutex);
assert(releaseResult);
(void)releaseResult;
@@ -577,7 +577,7 @@ client_t utility::request_client_id(const std::shared_ptr<configuration> &_confi
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
+#ifdef _WIN32
WaitForSingleObject(configuration_data_mutex, INFINITE);
#else
pthread_mutex_lock(&the_configuration_data__->mutex_);
@@ -596,7 +596,7 @@ void utility::release_client_id(client_t _client) {
= the_configuration_data__->used_client_ids_[i+1];
}
}
-#ifdef WIN32
+#ifdef _WIN32
ReleaseMutex(configuration_data_mutex);
#else
pthread_mutex_unlock(&the_configuration_data__->mutex_);
@@ -610,7 +610,7 @@ bool utility::is_routing_manager_host(client_t _client) {
return false;
}
-#ifdef WIN32
+#ifdef _WIN32
WaitForSingleObject(configuration_data_mutex, INFINITE);
#else
pthread_mutex_lock(&the_configuration_data__->mutex_);
@@ -618,7 +618,7 @@ bool utility::is_routing_manager_host(client_t _client) {
bool is_routing_manager = (the_configuration_data__->routing_manager_host_ == _client);
-#ifdef WIN32
+#ifdef _WIN32
ReleaseMutex(configuration_data_mutex);
#else
pthread_mutex_unlock(&the_configuration_data__->mutex_);
@@ -633,7 +633,7 @@ void utility::set_routing_manager_host(client_t _client) {
return;
}
-#ifdef WIN32
+#ifdef _WIN32
WaitForSingleObject(configuration_data_mutex, INFINITE);
#else
pthread_mutex_lock(&the_configuration_data__->mutex_);
@@ -641,7 +641,7 @@ void utility::set_routing_manager_host(client_t _client) {
the_configuration_data__->routing_manager_host_ = _client;
-#ifdef WIN32
+#ifdef _WIN32
ReleaseMutex(configuration_data_mutex);
#else
pthread_mutex_unlock(&the_configuration_data__->mutex_);
diff --git a/interface/vsomeip/application.hpp b/interface/vsomeip/application.hpp
index 2b53666..6023d79 100644
--- a/interface/vsomeip/application.hpp
+++ b/interface/vsomeip/application.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -23,110 +23,647 @@ 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() {}
- // get name
+ /**
+ *
+ * \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;
- // Lifecycle
+ /**
+ *
+ * \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;
- // Provide services
+ /**
+ *
+ * \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;
- // Consume services
+ /**
+ *
+ * \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 register_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;
- // Send a message
+ /**
+ *
+ * \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;
- // Set a field or fire an event (without/with the ability to force notification for field)
+ /**
+ *
+ * \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;
- // [Un]Register handler for state change events
+ /**
+ *
+ * \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;
- // [Un]Register message handler for a method/an event/field
+ /**
+ *
+ * \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;
- // [Un]Register handler for availability reporting
+ /**
+ *
+ * \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;
- // [Un]Register handler for subscriptions
+ /**
+ *
+ * \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;
- // Routing/SD hosted by this application!?
+ /**
+ *
+ * \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,
@@ -135,30 +672,163 @@ public:
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;
+ 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;
-
+ 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;
};
+/** @} */
+
} // namespace vsomeip
#endif // VSOMEIP_APPLICATION_HPP
diff --git a/interface/vsomeip/constants.hpp b/interface/vsomeip/constants.hpp
index da184b8..09e2f22 100644
--- a/interface/vsomeip/constants.hpp
+++ b/interface/vsomeip/constants.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/interface/vsomeip/defines.hpp b/interface/vsomeip/defines.hpp
index d75b028..2a6af8b 100644
--- a/interface/vsomeip/defines.hpp
+++ b/interface/vsomeip/defines.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/interface/vsomeip/enumeration_types.hpp b/interface/vsomeip/enumeration_types.hpp
index 1b5ef51..d906f1a 100644
--- a/interface/vsomeip/enumeration_types.hpp
+++ b/interface/vsomeip/enumeration_types.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/interface/vsomeip/error.hpp b/interface/vsomeip/error.hpp
index da74482..1136957 100644
--- a/interface/vsomeip/error.hpp
+++ b/interface/vsomeip/error.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/interface/vsomeip/export.hpp b/interface/vsomeip/export.hpp
index 8fc3895..a8577ee 100644
--- a/interface/vsomeip/export.hpp
+++ b/interface/vsomeip/export.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -6,7 +6,7 @@
#ifndef __EXPORT__HPP__
#define __EXPORT__HPP__
-#if WIN32
+#if _WIN32
#define VSOMEIP_EXPORT __declspec(dllexport)
#define VSOMEIP_EXPORT_CLASS_EXPLICIT
diff --git a/interface/vsomeip/function_types.hpp b/interface/vsomeip/function_types.hpp
index 7db3f1e..aa086dd 100644
--- a/interface/vsomeip/function_types.hpp
+++ b/interface/vsomeip/function_types.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/interface/vsomeip/handler.hpp b/interface/vsomeip/handler.hpp
index 1363914..f2c0628 100644
--- a/interface/vsomeip/handler.hpp
+++ b/interface/vsomeip/handler.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/interface/vsomeip/internal/deserializable.hpp b/interface/vsomeip/internal/deserializable.hpp
index 103c8cf..5d8ebcc 100644
--- a/interface/vsomeip/internal/deserializable.hpp
+++ b/interface/vsomeip/internal/deserializable.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/interface/vsomeip/internal/serializable.hpp b/interface/vsomeip/internal/serializable.hpp
index 7f08944..0791419 100644
--- a/interface/vsomeip/internal/serializable.hpp
+++ b/interface/vsomeip/internal/serializable.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/interface/vsomeip/message.hpp b/interface/vsomeip/message.hpp
index a1c8d2c..4a68a54 100644
--- a/interface/vsomeip/message.hpp
+++ b/interface/vsomeip/message.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -14,15 +14,39 @@ 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() {
- }
+ 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
index d077be0..1518b9e 100644
--- a/interface/vsomeip/message_base.hpp
+++ b/interface/vsomeip/message_base.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -15,52 +15,187 @@
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;
- // No part of the SOME/IP protocol header
+ /**
+ * \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;
};
+/** @} */
+
} // namespace vsomeip
#endif // VSOMEIP_MESSAGE_BASE_HPP
diff --git a/interface/vsomeip/payload.hpp b/interface/vsomeip/payload.hpp
index 10a3177..b9b8f61 100644
--- a/interface/vsomeip/payload.hpp
+++ b/interface/vsomeip/payload.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -16,28 +16,91 @@
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() {
- }
+ 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/primitive_types.hpp b/interface/vsomeip/primitive_types.hpp
index b75203e..043fd9b 100644
--- a/interface/vsomeip/primitive_types.hpp
+++ b/interface/vsomeip/primitive_types.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/interface/vsomeip/runtime.hpp b/interface/vsomeip/runtime.hpp
index 00dd069..ae54e19 100644
--- a/interface/vsomeip/runtime.hpp
+++ b/interface/vsomeip/runtime.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -19,6 +19,34 @@ 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:
@@ -30,30 +58,159 @@ public:
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
index e0aecd4..90940b2 100644
--- a/interface/vsomeip/vsomeip.hpp
+++ b/interface/vsomeip/vsomeip.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index fb8a89f..91605ad 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
@@ -115,12 +115,21 @@ if(NOT ${TESTS_BAT})
${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
@@ -172,6 +181,12 @@ if(NOT ${TESTS_BAT})
${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
@@ -1630,6 +1645,7 @@ 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)
@@ -1669,6 +1685,7 @@ 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})
@@ -1724,6 +1741,11 @@ if(NOT ${TESTS_BAT})
)
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}
diff --git a/test/application_tests/application_test.cpp b/test/application_tests/application_test.cpp
index c6c1b03..71ded2e 100644
--- a/test/application_tests/application_test.cpp
+++ b/test/application_tests/application_test.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -206,13 +206,16 @@ protected:
}
void send_shutdown_message() {
- std::unique_lock<std::mutex> its_lock(mutex_);
- while(!is_registered_) {
- cv_.wait(its_lock);
- }
- app_->offer_service(vsomeip_test::TEST_SERVICE_SERVICE_ID, vsomeip_test::TEST_SERVICE_INSTANCE_ID);
- while(!is_available_) {
- cv_.wait(its_lock);
+ {
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while(!is_registered_) {
+ cv_.wait(its_lock);
+ }
+ 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();
@@ -237,7 +240,7 @@ TEST_F(someip_application_shutdown_test, stop_application_from_dispatcher_thread
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/application_tests/application_test_availability.cpp b/test/application_tests/application_test_availability.cpp
new file mode 100644
index 0000000..06fd33e
--- /dev/null
+++ b/test/application_tests/application_test_availability.cpp
@@ -0,0 +1,39 @@
+// 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
new file mode 100755
index 0000000..645e347
--- /dev/null
+++ b/test/application_tests/application_test_availability_starter.sh
@@ -0,0 +1,10 @@
+#!/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
index ba39417..25f7c09 100644
--- a/test/application_tests/application_test_client.cpp
+++ b/test/application_tests/application_test_client.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -12,6 +12,7 @@
#include <map>
#include <algorithm>
#include <future>
+#include <atomic>
#include <gtest/gtest.h>
@@ -28,12 +29,12 @@ public:
service_available_(false),
wait_until_registered_(true),
wait_until_service_available_(true),
- send_thread_(std::bind(&application_test_client::send, this)),
wait_for_stop_(true),
- stop_thread_(std::bind(&application_test_client::wait_for_stop, this)),
received_responses_(0),
sent_requests_(0),
- stop_called_(false) {
+ 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;
@@ -183,16 +184,16 @@ private:
bool wait_until_service_available_;
std::mutex mutex_;
std::condition_variable condition_;
- std::thread send_thread_;
bool wait_for_stop_;
std::mutex stop_mutex_;
std::condition_variable stop_condition_;
- std::thread stop_thread_;
- std::uint32_t received_responses_;
- std::uint32_t sent_requests_;
+ 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_;
- bool stop_called_;
};
diff --git a/test/application_tests/application_test_client_availability.cpp b/test/application_tests/application_test_client_availability.cpp
new file mode 100644
index 0000000..5148d58
--- /dev/null
+++ b/test/application_tests/application_test_client_availability.cpp
@@ -0,0 +1,203 @@
+// 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
index c244e5a..43876ea 100644
--- a/test/application_tests/application_test_daemon.cpp
+++ b/test/application_tests/application_test_daemon.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/application_tests/application_test_globals.hpp b/test/application_tests/application_test_globals.hpp
index ea82255..7caa9db 100644
--- a/test/application_tests/application_test_globals.hpp
+++ b/test/application_tests/application_test_globals.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -15,9 +15,12 @@ struct service_info {
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 };
+
+struct service_info service = { 0x1111, 0x1, 0x1111, 0x1111, 0x1000, 0x1404, 0x2, 0x4711 };
static constexpr int number_of_messages_to_send = 150;
}
diff --git a/test/application_tests/application_test_service.cpp b/test/application_tests/application_test_service.cpp
index d21ca68..0064fd3 100644
--- a/test/application_tests/application_test_service.cpp
+++ b/test/application_tests/application_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -12,6 +12,7 @@
#include <map>
#include <algorithm>
#include <future>
+#include <atomic>
#include <gtest/gtest.h>
@@ -30,8 +31,8 @@ public:
app_(vsomeip::runtime::get()->create_application("service")),
counter_(0),
wait_until_registered_(true),
- offer_thread_(std::bind(&application_test_service::run, this)),
- stop_called_(false) {
+ stop_called_(false),
+ offer_thread_(std::bind(&application_test_service::run, this)) {
if (!app_->init()) {
ADD_FAILURE() << "Couldn't initialize application";
return;
@@ -65,7 +66,8 @@ public:
void offer() {
- app_->offer_service(service_info_.service_id, service_info_.instance_id);
+ 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) {
@@ -90,8 +92,13 @@ public:
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);
+ 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();
}
@@ -117,7 +124,7 @@ private:
bool wait_until_registered_;
std::mutex mutex_;
std::condition_variable condition_;
+ std::atomic<bool> stop_called_;
std::thread offer_thread_;
std::thread application_thread_;
- bool stop_called_;
};
diff --git a/test/application_tests/application_test_single_process.cpp b/test/application_tests/application_test_single_process.cpp
index eee636c..1d0d4a0 100644
--- a/test/application_tests/application_test_single_process.cpp
+++ b/test/application_tests/application_test_single_process.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -38,7 +38,7 @@ TEST(someip_application_test_single_process, notify_increasing_counter)
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/application_tests/application_test_single_process_starter.sh b/test/application_tests/application_test_single_process_starter.sh
index 0ac3330..3919358 100755
--- a/test/application_tests/application_test_single_process_starter.sh
+++ b/test/application_tests/application_test_single_process_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/application_tests/application_test_starter.sh b/test/application_tests/application_test_starter.sh
index 40ae927..3efc1b4 100755
--- a/test/application_tests/application_test_starter.sh
+++ b/test/application_tests/application_test_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/big_payload_tests/big_payload_test_client.cpp b/test/big_payload_tests/big_payload_test_client.cpp
index bc472df..f4b9128 100644
--- a/test/big_payload_tests/big_payload_test_client.cpp
+++ b/test/big_payload_tests/big_payload_test_client.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -239,7 +239,7 @@ TEST(someip_big_payload_test, send_ten_messages_to_service)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/big_payload_tests/big_payload_test_client.hpp b/test/big_payload_tests/big_payload_test_client.hpp
index 30bf8c7..fb03a8e 100644
--- a/test/big_payload_tests/big_payload_test_client.hpp
+++ b/test/big_payload_tests/big_payload_test_client.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
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
index f834d78..adbf9f4 100755
--- a/test/big_payload_tests/big_payload_test_client_local_start.sh
+++ b/test/big_payload_tests/big_payload_test_client_local_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/big_payload_tests/big_payload_test_client_start.sh b/test/big_payload_tests/big_payload_test_client_start.sh
index 025b5bc..5258ce8 100755
--- a/test/big_payload_tests/big_payload_test_client_start.sh
+++ b/test/big_payload_tests/big_payload_test_client_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/big_payload_tests/big_payload_test_external_starter.sh b/test/big_payload_tests/big_payload_test_external_starter.sh
index 7de3342..365eb68 100755
--- a/test/big_payload_tests/big_payload_test_external_starter.sh
+++ b/test/big_payload_tests/big_payload_test_external_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/big_payload_tests/big_payload_test_globals.hpp b/test/big_payload_tests/big_payload_test_globals.hpp
index 01fe949..7d11035 100644
--- a/test/big_payload_tests/big_payload_test_globals.hpp
+++ b/test/big_payload_tests/big_payload_test_globals.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/big_payload_tests/big_payload_test_local_starter.sh b/test/big_payload_tests/big_payload_test_local_starter.sh
index 792e840..3d42828 100755
--- a/test/big_payload_tests/big_payload_test_local_starter.sh
+++ b/test/big_payload_tests/big_payload_test_local_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/big_payload_tests/big_payload_test_service.cpp b/test/big_payload_tests/big_payload_test_service.cpp
index 6f0e056..00f7daf 100644
--- a/test/big_payload_tests/big_payload_test_service.cpp
+++ b/test/big_payload_tests/big_payload_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -206,7 +206,7 @@ TEST(someip_big_payload_test, receive_ten_messages_and_send_reply)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/big_payload_tests/big_payload_test_service.hpp b/test/big_payload_tests/big_payload_test_service.hpp
index 0862370..8db42f7 100644
--- a/test/big_payload_tests/big_payload_test_service.hpp
+++ b/test/big_payload_tests/big_payload_test_service.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
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
index 8fd7120..2b4d2d7 100755
--- a/test/big_payload_tests/big_payload_test_service_external_start.sh
+++ b/test/big_payload_tests/big_payload_test_service_external_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
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
index 3aadd55..299af82 100755
--- a/test/big_payload_tests/big_payload_test_service_local_start.sh
+++ b/test/big_payload_tests/big_payload_test_service_local_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/client_id_tests/client_id_test_globals.hpp b/test/client_id_tests/client_id_test_globals.hpp
index 49e07dd..52dd069 100644
--- a/test/client_id_tests/client_id_test_globals.hpp
+++ b/test/client_id_tests/client_id_test_globals.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/client_id_tests/client_id_test_master_starter.sh b/test/client_id_tests/client_id_test_master_starter.sh
index ef74c72..4f74fd0 100755
--- a/test/client_id_tests/client_id_test_master_starter.sh
+++ b/test/client_id_tests/client_id_test_master_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/client_id_tests/client_id_test_service.cpp b/test/client_id_tests/client_id_test_service.cpp
index 7e1d66d..a051f99 100644
--- a/test/client_id_tests/client_id_test_service.cpp
+++ b/test/client_id_tests/client_id_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -250,7 +250,7 @@ TEST(someip_client_id_test, send_ten_messages_to_service)
client_id_test::service_infos[service_number]);
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/client_id_tests/client_id_test_slave_starter.sh b/test/client_id_tests/client_id_test_slave_starter.sh
index 59291cb..4553521 100755
--- a/test/client_id_tests/client_id_test_slave_starter.sh
+++ b/test/client_id_tests/client_id_test_slave_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/client_id_tests/client_id_test_utility.cpp b/test/client_id_tests/client_id_test_utility.cpp
index 610a087..02b3b0e 100644
--- a/test/client_id_tests/client_id_test_utility.cpp
+++ b/test/client_id_tests/client_id_test_utility.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -439,7 +439,7 @@ TEST_F(client_id_utility_test, exhaust_client_id_range_fragmented) {
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/test/configuration_tests/configuration-test.cpp b/test/configuration_tests/configuration-test.cpp
index 37ebfeb..d306c52 100644
--- a/test/configuration_tests/configuration-test.cpp
+++ b/test/configuration_tests/configuration-test.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -122,7 +122,7 @@ void check_file(const std::string &_config_file,
}
// 2. Set environment variable to config file and load it
-#ifndef WIN32
+#ifndef _WIN32
setenv("VSOMEIP_CONFIGURATION", _config_file.c_str(), 1);
#else
_putenv_s("VSOMEIP_CONFIGURATION", _config_file.c_str()
diff --git a/test/cpu_load_tests/cpu_load_measurer.cpp b/test/cpu_load_tests/cpu_load_measurer.cpp
index 5d1fa0a..2261d22 100644
--- a/test/cpu_load_tests/cpu_load_measurer.cpp
+++ b/test/cpu_load_tests/cpu_load_measurer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/cpu_load_tests/cpu_load_measurer.hpp b/test/cpu_load_tests/cpu_load_measurer.hpp
index ce72d0c..dfdcf80 100644
--- a/test/cpu_load_tests/cpu_load_measurer.hpp
+++ b/test/cpu_load_tests/cpu_load_measurer.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/cpu_load_tests/cpu_load_test_client.cpp b/test/cpu_load_tests/cpu_load_test_client.cpp
index 5935774..37cc73e 100644
--- a/test/cpu_load_tests/cpu_load_test_client.cpp
+++ b/test/cpu_load_tests/cpu_load_test_client.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -304,7 +304,7 @@ 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
+#ifndef _WIN32
int main(int argc, char** argv)
{
int i = 0;
diff --git a/test/cpu_load_tests/cpu_load_test_globals.hpp b/test/cpu_load_tests/cpu_load_test_globals.hpp
index e5e8466..e6897e3 100644
--- a/test/cpu_load_tests/cpu_load_test_globals.hpp
+++ b/test/cpu_load_tests/cpu_load_test_globals.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/cpu_load_tests/cpu_load_test_master_starter.sh b/test/cpu_load_tests/cpu_load_test_master_starter.sh
index ddcfa3d..c297824 100755
--- a/test/cpu_load_tests/cpu_load_test_master_starter.sh
+++ b/test/cpu_load_tests/cpu_load_test_master_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/cpu_load_tests/cpu_load_test_service.cpp b/test/cpu_load_tests/cpu_load_test_service.cpp
index f8fbde3..7316c2a 100644
--- a/test/cpu_load_tests/cpu_load_test_service.cpp
+++ b/test/cpu_load_tests/cpu_load_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -196,7 +196,7 @@ TEST(someip_payload_test, send_response_for_every_request)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/cpu_load_tests/cpu_load_test_slave_starter.sh b/test/cpu_load_tests/cpu_load_test_slave_starter.sh
index 9c68c48..83ef19d 100755
--- a/test/cpu_load_tests/cpu_load_test_slave_starter.sh
+++ b/test/cpu_load_tests/cpu_load_test_slave_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/header_factory_tests/header_factory_test.cpp b/test/header_factory_tests/header_factory_test.cpp
index e034769..bcd1ef3 100644
--- a/test/header_factory_tests/header_factory_test.cpp
+++ b/test/header_factory_tests/header_factory_test.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -110,7 +110,7 @@ TEST_F(someip_header_factory_test, create_notification_test)
ASSERT_EQ(notification_->get_return_code(), vsomeip::return_code_e::E_OK);
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/header_factory_tests/header_factory_test_client.cpp b/test/header_factory_tests/header_factory_test_client.cpp
index 3870c17..90cfef5 100644
--- a/test/header_factory_tests/header_factory_test_client.cpp
+++ b/test/header_factory_tests/header_factory_test_client.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -8,13 +8,13 @@
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)),
- sender_(std::bind(&header_factory_test_client::run, this)),
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)
+ number_of_acknowledged_messages_(0),
+ sender_(std::bind(&header_factory_test_client::run, this))
{
}
@@ -162,7 +162,7 @@ TEST(someip_header_factory_test, send_message_ten_times_test)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/header_factory_tests/header_factory_test_client.hpp b/test/header_factory_tests/header_factory_test_client.hpp
index 911c754..eb62191 100644
--- a/test/header_factory_tests/header_factory_test_client.hpp
+++ b/test/header_factory_tests/header_factory_test_client.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -38,13 +38,13 @@ private:
bool use_tcp_;
std::mutex mutex_;
std::condition_variable condition_;
- std::thread sender_;
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_start.sh b/test/header_factory_tests/header_factory_test_client_start.sh
index b500060..4e9c1ed 100755
--- a/test/header_factory_tests/header_factory_test_client_start.sh
+++ b/test/header_factory_tests/header_factory_test_client_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
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
index 74f8504..5d1d780 100755
--- a/test/header_factory_tests/header_factory_test_send_receive_starter.sh
+++ b/test/header_factory_tests/header_factory_test_send_receive_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/header_factory_tests/header_factory_test_service.cpp b/test/header_factory_tests/header_factory_test_service.cpp
index 9a06762..12527ed 100644
--- a/test/header_factory_tests/header_factory_test_service.cpp
+++ b/test/header_factory_tests/header_factory_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -11,9 +11,9 @@ header_factory_test_service::header_factory_test_service(bool _use_static_routin
app_(vsomeip::runtime::get()->create_application()),
is_registered_(false),
use_static_routing_(_use_static_routing),
- offer_thread_(std::bind(&header_factory_test_service::run, this)),
blocked_(false),
- number_of_received_messages_(0)
+ number_of_received_messages_(0),
+ offer_thread_(std::bind(&header_factory_test_service::run, this))
{
}
@@ -81,6 +81,7 @@ void header_factory_test_service::on_state(vsomeip::state_type_e _state)
if(!is_registered_)
{
is_registered_ = true;
+ std::lock_guard<std::mutex> its_lock(mutex_);
blocked_ = true;
// "start" the run method thread
condition_.notify_one();
@@ -160,7 +161,7 @@ TEST(someip_header_factory_test, reveice_message_ten_times_test)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/header_factory_tests/header_factory_test_service.hpp b/test/header_factory_tests/header_factory_test_service.hpp
index a28d040..32e49e5 100644
--- a/test/header_factory_tests/header_factory_test_service.hpp
+++ b/test/header_factory_tests/header_factory_test_service.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -35,11 +35,11 @@ private:
bool is_registered_;
bool use_static_routing_;
- std::thread offer_thread_;
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_start.sh b/test/header_factory_tests/header_factory_test_service_start.sh
index 437ecdd..e123a46 100755
--- a/test/header_factory_tests/header_factory_test_service_start.sh
+++ b/test/header_factory_tests/header_factory_test_service_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/initial_event_tests/initial_event_test_availability_checker.cpp b/test/initial_event_tests/initial_event_test_availability_checker.cpp
index 69ae6ee..719d6d3 100644
--- a/test/initial_event_tests/initial_event_test_availability_checker.cpp
+++ b/test/initial_event_tests/initial_event_test_availability_checker.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -141,7 +141,7 @@ TEST(someip_initial_event_test, wait_for_availability_and_exit)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/initial_event_tests/initial_event_test_client.cpp b/test/initial_event_tests/initial_event_test_client.cpp
index caa79cb..2f49516 100644
--- a/test/initial_event_tests/initial_event_test_client.cpp
+++ b/test/initial_event_tests/initial_event_test_client.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -275,7 +275,7 @@ TEST(someip_initial_event_test, wait_for_initial_events_of_all_services)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/initial_event_tests/initial_event_test_globals.hpp b/test/initial_event_tests/initial_event_test_globals.hpp
index 36f8def..ce69ea9 100644
--- a/test/initial_event_tests/initial_event_test_globals.hpp
+++ b/test/initial_event_tests/initial_event_test_globals.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/initial_event_tests/initial_event_test_master_starter.sh b/test/initial_event_tests/initial_event_test_master_starter.sh
index 471b973..2ef37f7 100755
--- a/test/initial_event_tests/initial_event_test_master_starter.sh
+++ b/test/initial_event_tests/initial_event_test_master_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/initial_event_tests/initial_event_test_service.cpp b/test/initial_event_tests/initial_event_test_service.cpp
index 5823a09..5873ffe 100644
--- a/test/initial_event_tests/initial_event_test_service.cpp
+++ b/test/initial_event_tests/initial_event_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -110,7 +110,7 @@ TEST(someip_initial_event_test, set_field_once)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/initial_event_tests/initial_event_test_slave_starter.sh b/test/initial_event_tests/initial_event_test_slave_starter.sh
index 2b9eec8..74371d0 100755
--- a/test/initial_event_tests/initial_event_test_slave_starter.sh
+++ b/test/initial_event_tests/initial_event_test_slave_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/initial_event_tests/initial_event_test_stop_service.cpp b/test/initial_event_tests/initial_event_test_stop_service.cpp
index a17e0d8..8f32fbc 100644
--- a/test/initial_event_tests/initial_event_test_stop_service.cpp
+++ b/test/initial_event_tests/initial_event_test_stop_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -11,6 +11,7 @@
#include <thread>
#include <map>
#include <algorithm>
+#include <atomic>
#include <gtest/gtest.h>
@@ -154,18 +155,22 @@ public:
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);
+ {
+ 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);
+ {
+ 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
@@ -184,9 +189,11 @@ public:
}
app_->send(msg);
called_other_node_ = true;
-
- while (wait_until_shutdown_method_called_) {
- condition_.wait(its_lock);
+ {
+ std::unique_lock<std::mutex> its_lock(mutex_);
+ while (wait_until_shutdown_method_called_) {
+ condition_.wait(its_lock);
+ }
}
}
@@ -228,12 +235,12 @@ private:
std::mutex availability_mutex_;
std::condition_variable availability_condition_;
- bool wait_for_stop_;
+ std::atomic<bool> wait_for_stop_;
std::mutex stop_mutex_;
std::condition_variable stop_condition_;
std::thread stop_thread_;
- bool called_other_node_;
+ std::atomic<bool> called_other_node_;
};
static bool is_master = false;
@@ -247,7 +254,7 @@ TEST(someip_initial_event_test, wait_for_stop_method_to_be_called)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/magic_cookies_tests/magic_cookies_test_client.cpp b/test/magic_cookies_tests/magic_cookies_test_client.cpp
index 8be1eaf..a6afacd 100644
--- a/test/magic_cookies_tests/magic_cookies_test_client.cpp
+++ b/test/magic_cookies_tests/magic_cookies_test_client.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/magic_cookies_tests/magic_cookies_test_client_start.sh b/test/magic_cookies_tests/magic_cookies_test_client_start.sh
index 2ebe8c1..45f4d3c 100755
--- a/test/magic_cookies_tests/magic_cookies_test_client_start.sh
+++ b/test/magic_cookies_tests/magic_cookies_test_client_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/magic_cookies_tests/magic_cookies_test_service.cpp b/test/magic_cookies_tests/magic_cookies_test_service.cpp
index a69084d..21e936d 100644
--- a/test/magic_cookies_tests/magic_cookies_test_service.cpp
+++ b/test/magic_cookies_tests/magic_cookies_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -70,6 +70,7 @@ public:
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();
}
diff --git a/test/magic_cookies_tests/magic_cookies_test_service_start.sh b/test/magic_cookies_tests/magic_cookies_test_service_start.sh
index 00c6546..9288b7e 100755
--- a/test/magic_cookies_tests/magic_cookies_test_service_start.sh
+++ b/test/magic_cookies_tests/magic_cookies_test_service_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/magic_cookies_tests/magic_cookies_test_starter.sh b/test/magic_cookies_tests/magic_cookies_test_starter.sh
index aba3b0b..ef158a2 100755
--- a/test/magic_cookies_tests/magic_cookies_test_starter.sh
+++ b/test/magic_cookies_tests/magic_cookies_test_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
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
index 6c9f72b..a8af719 100755
--- a/test/offer_tests/conf/offer_test_external_master_starter.sh.in
+++ b/test/offer_tests/conf/offer_test_external_master_starter.sh.in
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/offer_tests/offer_test_client.cpp b/test/offer_tests/offer_test_client.cpp
index 493c3fa..b337199 100644
--- a/test/offer_tests/offer_test_client.cpp
+++ b/test/offer_tests/offer_test_client.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -11,6 +11,7 @@
#include <thread>
#include <map>
#include <algorithm>
+#include <atomic>
#include <gtest/gtest.h>
@@ -34,12 +35,12 @@ public:
service_available_(false),
wait_until_registered_(true),
wait_until_service_available_(true),
- send_thread_(std::bind(&offer_test_client::send, this)),
wait_for_stop_(true),
- stop_thread_(std::bind(&offer_test_client::wait_for_stop, this)),
last_received_counter_(0),
last_received_response_(std::chrono::steady_clock::now()),
- number_received_responses_(0) {
+ 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;
@@ -232,16 +233,16 @@ private:
bool wait_until_service_available_;
std::mutex mutex_;
std::condition_variable condition_;
- std::thread send_thread_;
bool wait_for_stop_;
std::mutex stop_mutex_;
std::condition_variable stop_condition_;
- std::thread stop_thread_;
std::uint32_t last_received_counter_;
std::chrono::steady_clock::time_point last_received_response_;
- std::uint32_t number_received_responses_;
+ 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;
@@ -251,7 +252,7 @@ TEST(someip_offer_test, subscribe_or_call_method_at_service)
offer_test_client its_sample(offer_test::service, passed_mode);
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/offer_tests/offer_test_external_sd_msg_sender.cpp b/test/offer_tests/offer_test_external_sd_msg_sender.cpp
index 16481aa..6849b95 100644
--- a/test/offer_tests/offer_test_external_sd_msg_sender.cpp
+++ b/test/offer_tests/offer_test_external_sd_msg_sender.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -60,7 +60,7 @@ TEST(someip_offer_test, send_offer_service_sd_message)
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
if(argc < 2) {
diff --git a/test/offer_tests/offer_test_external_slave_starter.sh b/test/offer_tests/offer_test_external_slave_starter.sh
index cdff0d8..d7f08fb 100755
--- a/test/offer_tests/offer_test_external_slave_starter.sh
+++ b/test/offer_tests/offer_test_external_slave_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/offer_tests/offer_test_globals.hpp b/test/offer_tests/offer_test_globals.hpp
index cc15c15..2fc3bde 100644
--- a/test/offer_tests/offer_test_globals.hpp
+++ b/test/offer_tests/offer_test_globals.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/offer_tests/offer_test_local_starter.sh b/test/offer_tests/offer_test_local_starter.sh
index 69b4821..38efbb6 100755
--- a/test/offer_tests/offer_test_local_starter.sh
+++ b/test/offer_tests/offer_test_local_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/offer_tests/offer_test_service.cpp b/test/offer_tests/offer_test_service.cpp
index f06de9e..13c193f 100644
--- a/test/offer_tests/offer_test_service.cpp
+++ b/test/offer_tests/offer_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -11,6 +11,7 @@
#include <thread>
#include <map>
#include <algorithm>
+#include <atomic>
#include <gtest/gtest.h>
@@ -33,8 +34,8 @@ public:
"offer_test_service" + service_number)),
counter_(0),
wait_until_registered_(true),
- offer_thread_(std::bind(&offer_test_service::run, this)),
- shutdown_method_called_(false) {
+ shutdown_method_called_(false),
+ offer_thread_(std::bind(&offer_test_service::run, this)) {
if (!app_->init()) {
ADD_FAILURE() << "Couldn't initialize application";
return;
@@ -143,9 +144,8 @@ private:
bool wait_until_registered_;
std::mutex mutex_;
std::condition_variable condition_;
+ std::atomic<bool> shutdown_method_called_;
std::thread offer_thread_;
-
- bool shutdown_method_called_;
};
TEST(someip_offer_test, notify_increasing_counter)
@@ -154,7 +154,7 @@ TEST(someip_offer_test, notify_increasing_counter)
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/offer_tests/offer_test_service_external.cpp b/test/offer_tests/offer_test_service_external.cpp
index 2f74271..694a678 100644
--- a/test/offer_tests/offer_test_service_external.cpp
+++ b/test/offer_tests/offer_test_service_external.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -140,7 +140,7 @@ TEST(someip_offer_test, notify_increasing_counter)
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
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
index 06babd4..5f6b7ea 100755
--- a/test/payload_tests/external_local_payload_test_client_external_start.sh
+++ b/test/payload_tests/external_local_payload_test_client_external_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
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
index b675b0a..89541b9 100755
--- a/test/payload_tests/external_local_payload_test_client_external_starter.sh
+++ b/test/payload_tests/external_local_payload_test_client_external_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
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
index bc4ce89..283f400 100755
--- 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
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
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
index d3a1f04..b79e534 100755
--- a/test/payload_tests/external_local_payload_test_client_local_start.sh
+++ b/test/payload_tests/external_local_payload_test_client_local_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
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
index fcc8a20..e2196d8 100755
--- a/test/payload_tests/external_local_payload_test_client_local_starter.sh
+++ b/test/payload_tests/external_local_payload_test_client_local_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
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
index e668cbc..046d50b 100755
--- 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
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/payload_tests/external_local_payload_test_service_start.sh b/test/payload_tests/external_local_payload_test_service_start.sh
index e5bfe2b..90b1b38 100755
--- a/test/payload_tests/external_local_payload_test_service_start.sh
+++ b/test/payload_tests/external_local_payload_test_service_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/payload_tests/local_payload_test_client_start.sh b/test/payload_tests/local_payload_test_client_start.sh
index 87ec43d..975be2a 100755
--- a/test/payload_tests/local_payload_test_client_start.sh
+++ b/test/payload_tests/local_payload_test_client_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/payload_tests/local_payload_test_huge_payload_starter.sh b/test/payload_tests/local_payload_test_huge_payload_starter.sh
index 07cc372..c230891 100755
--- a/test/payload_tests/local_payload_test_huge_payload_starter.sh
+++ b/test/payload_tests/local_payload_test_huge_payload_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/payload_tests/local_payload_test_service_start.sh b/test/payload_tests/local_payload_test_service_start.sh
index 34fbc80..cc67f54 100755
--- a/test/payload_tests/local_payload_test_service_start.sh
+++ b/test/payload_tests/local_payload_test_service_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/payload_tests/local_payload_test_starter.sh b/test/payload_tests/local_payload_test_starter.sh
index 489f42f..abc4577 100755
--- a/test/payload_tests/local_payload_test_starter.sh
+++ b/test/payload_tests/local_payload_test_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/payload_tests/payload_test_client.cpp b/test/payload_tests/payload_test_client.cpp
index 11d4511..65dbec7 100644
--- a/test/payload_tests/payload_test_client.cpp
+++ b/test/payload_tests/payload_test_client.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -28,7 +28,6 @@ payload_test_client::payload_test_client(
request_(vsomeip::runtime::get()->create_request(_use_tcp)),
call_service_sync_(_call_service_sync),
sliding_window_size_(_sliding_window_size),
- sender_(std::bind(&payload_test_client::run, this)),
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),
@@ -36,7 +35,8 @@ payload_test_client::payload_test_client(
number_of_sent_messages_total_(0),
number_of_acknowledged_messages_(0),
current_payload_size_(1),
- all_msg_acknowledged_(false)
+ all_msg_acknowledged_(false),
+ sender_(std::bind(&payload_test_client::run, this))
{
}
@@ -319,7 +319,7 @@ TEST(someip_payload_test, send_different_payloads)
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
std::string tcp_enable("--tcp");
diff --git a/test/payload_tests/payload_test_client.hpp b/test/payload_tests/payload_test_client.hpp
index b9da542..2757d00 100644
--- a/test/payload_tests/payload_test_client.hpp
+++ b/test/payload_tests/payload_test_client.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -49,7 +49,6 @@ private:
std::uint32_t sliding_window_size_;
std::mutex mutex_;
std::condition_variable condition_;
- std::thread sender_;
bool blocked_;
bool is_available_;
const std::uint32_t number_of_messages_to_send_;
@@ -65,6 +64,8 @@ private:
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
index 05a9cb4..bb174cd 100644
--- a/test/payload_tests/payload_test_service.cpp
+++ b/test/payload_tests/payload_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -13,9 +13,9 @@ payload_test_service::payload_test_service(bool _use_tcp) :
app_(vsomeip::runtime::get()->create_application()),
is_registered_(false),
use_tcp_(_use_tcp),
- offer_thread_(std::bind(&payload_test_service::run, this)),
blocked_(false),
- number_of_received_messages_(0)
+ number_of_received_messages_(0),
+ offer_thread_(std::bind(&payload_test_service::run, this))
{
}
@@ -83,6 +83,7 @@ void payload_test_service::on_state(vsomeip::state_type_e _state)
if(!is_registered_)
{
is_registered_ = true;
+ std::lock_guard<std::mutex> its_lock(mutex_);
blocked_ = true;
// "start" the run method thread
condition_.notify_one();
@@ -158,7 +159,7 @@ TEST(someip_payload_test, send_response_for_every_request)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
std::string help("--help");
diff --git a/test/payload_tests/payload_test_service.hpp b/test/payload_tests/payload_test_service.hpp
index d109146..32ae1e7 100644
--- a/test/payload_tests/payload_test_service.hpp
+++ b/test/payload_tests/payload_test_service.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -37,11 +37,11 @@ private:
bool use_tcp_;
bool use_static_routing_;
- std::thread offer_thread_;
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
index 2eb59f3..83506f4 100644
--- a/test/payload_tests/stopwatch.cpp
+++ b/test/payload_tests/stopwatch.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/payload_tests/stopwatch.hpp b/test/payload_tests/stopwatch.hpp
index 9723c22..5917e12 100644
--- a/test/payload_tests/stopwatch.hpp
+++ b/test/payload_tests/stopwatch.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
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
index ab96d8e..ca8582f 100755
--- a/test/routing_tests/conf/local_routing_test_starter.sh.bat.in
+++ b/test/routing_tests/conf/local_routing_test_starter.sh.bat.in
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/routing_tests/conf/local_routing_test_starter.sh.in b/test/routing_tests/conf/local_routing_test_starter.sh.in
index 6f81609..457c60c 100755
--- a/test/routing_tests/conf/local_routing_test_starter.sh.in
+++ b/test/routing_tests/conf/local_routing_test_starter.sh.in
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
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
index 05bb510..b267b47 100755
--- a/test/routing_tests/external_local_routing_test_client_external_start.sh
+++ b/test/routing_tests/external_local_routing_test_client_external_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/routing_tests/external_local_routing_test_service.cpp b/test/routing_tests/external_local_routing_test_service.cpp
index cd92508..ce8b9ef 100644
--- a/test/routing_tests/external_local_routing_test_service.cpp
+++ b/test/routing_tests/external_local_routing_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -176,7 +176,7 @@ TEST(someip_external_local_routing_test, receive_ten_messages_over_local_and_ext
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/routing_tests/external_local_routing_test_service.hpp b/test/routing_tests/external_local_routing_test_service.hpp
index e30a71c..a25025e 100644
--- a/test/routing_tests/external_local_routing_test_service.hpp
+++ b/test/routing_tests/external_local_routing_test_service.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/routing_tests/external_local_routing_test_service_start.sh b/test/routing_tests/external_local_routing_test_service_start.sh
index c79428d..81b2ef1 100755
--- a/test/routing_tests/external_local_routing_test_service_start.sh
+++ b/test/routing_tests/external_local_routing_test_service_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/routing_tests/external_local_routing_test_starter.sh b/test/routing_tests/external_local_routing_test_starter.sh
index f4ba129..836d03e 100755
--- a/test/routing_tests/external_local_routing_test_starter.sh
+++ b/test/routing_tests/external_local_routing_test_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/routing_tests/local_routing_test_client.cpp b/test/routing_tests/local_routing_test_client.cpp
index a9acb44..5bd83fe 100644
--- a/test/routing_tests/local_routing_test_client.cpp
+++ b/test/routing_tests/local_routing_test_client.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -159,7 +159,7 @@ TEST(someip_local_routing_test, send_ten_messages_to_service_and_receive_reply)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/routing_tests/local_routing_test_client.hpp b/test/routing_tests/local_routing_test_client.hpp
index 2229ae6..b135dea 100644
--- a/test/routing_tests/local_routing_test_client.hpp
+++ b/test/routing_tests/local_routing_test_client.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/routing_tests/local_routing_test_client_start.sh b/test/routing_tests/local_routing_test_client_start.sh
index cd36c77..ed4023e 100755
--- a/test/routing_tests/local_routing_test_client_start.sh
+++ b/test/routing_tests/local_routing_test_client_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/routing_tests/local_routing_test_service.cpp b/test/routing_tests/local_routing_test_service.cpp
index 137e8ea..4f7962d 100644
--- a/test/routing_tests/local_routing_test_service.cpp
+++ b/test/routing_tests/local_routing_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -155,7 +155,7 @@ TEST(someip_local_routing_test, receive_ten_messages_over_local_uds_socket)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/routing_tests/local_routing_test_service.hpp b/test/routing_tests/local_routing_test_service.hpp
index 3d575d7..531fdb7 100644
--- a/test/routing_tests/local_routing_test_service.hpp
+++ b/test/routing_tests/local_routing_test_service.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/routing_tests/local_routing_test_service_start.sh b/test/routing_tests/local_routing_test_service_start.sh
index 3536212..c59364c 100755
--- a/test/routing_tests/local_routing_test_service_start.sh
+++ b/test/routing_tests/local_routing_test_service_start.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/someip_test_globals.hpp b/test/someip_test_globals.hpp
index cb127e5..08397a7 100644
--- a/test/someip_test_globals.hpp
+++ b/test/someip_test_globals.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
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
index 8f4205f..047ded7 100644
--- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_globals.hpp
+++ b/test/subscribe_notify_one_tests/subscribe_notify_one_test_globals.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
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
index 995e66e..9fa3ec7 100755
--- 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
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
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
index dc735e2..9849613 100644
--- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp
+++ b/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -414,7 +414,7 @@ TEST(someip_subscribe_notify_one_test, send_ten_notifications_to_service)
subscribe_notify_one_test::service_infos[service_number], subscription_type);
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
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
index 2bcde81..47d0b2d 100755
--- 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
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_globals.hpp b/test/subscribe_notify_tests/subscribe_notify_test_globals.hpp
index 6e24a20..ed41314 100644
--- a/test/subscribe_notify_tests/subscribe_notify_test_globals.hpp
+++ b/test/subscribe_notify_tests/subscribe_notify_test_globals.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh
index 006d2bc..6df3053 100755
--- a/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh
+++ b/test/subscribe_notify_tests/subscribe_notify_test_master_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_service.cpp b/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
index bec20c6..bc2eedd 100644
--- a/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
+++ b/test/subscribe_notify_tests/subscribe_notify_test_service.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -418,7 +418,7 @@ TEST(someip_subscribe_notify_test, send_ten_notifications_to_service)
}
}
-#ifndef WIN32
+#ifndef _WIN32
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh b/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh
index b37a781..9865536 100755
--- a/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh
+++ b/test/subscribe_notify_tests/subscribe_notify_test_slave_starter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2015-2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 7a56439..60ee7ea 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+# 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/.
diff --git a/tools/vsomeip_ctrl.cpp b/tools/vsomeip_ctrl.cpp
index 362f1b4..9dde00a 100644
--- a/tools/vsomeip_ctrl.cpp
+++ b/tools/vsomeip_ctrl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.