Skip to content

Commit

Permalink
vSomeIP-Lib 3.4.10 (#582)
Browse files Browse the repository at this point in the history
Notes:
- Fix QNX build
- Fix missing Stop Offer
- Apply extra fixes to QNX environment
- Remove key <service, instance> from the offer_commands_
- #478: deleted unused param _use_exclusive_proxy
- Fix code smell related to condition variable
- #462: Fix IPv6 Service Discovery
- Added multicast_mutex to async function that makes use of multicast socket
- #479: Allow service_discovery to continue without random_device
- Fix availability handler sending false on offer
- Set host/port in vsomeip_sec_client_t whenever possible
- Use executor_work_guard instead of io_context::work for boost v1.66 and higher
- Update Windows build
- Added profile 07 as an option for E2E protection
- ASIO: use heap-allocation to avoid using garbage data
- Fix integer underflow in server_endpoint_impl.cpp
- Cleanup prepare_stop_handlers_
- Automatic unsubscribe
- Debounce now works without routingmanagerd running
- Debouncing: Send last received value after debounce time + X
- Fix resource deadlock avoided crash
- Use closure instead of callable struct
  • Loading branch information
DiogoPedrozza authored Nov 29, 2023
1 parent 70d59ed commit 02c199d
Show file tree
Hide file tree
Showing 91 changed files with 5,538 additions and 785 deletions.
3 changes: 2 additions & 1 deletion Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ cc_library_shared {

cflags: [
"-DWITHOUT_SYSTEMD",
"-DVSOMEIP_COMPAT_VERSION=\"3.4.9\"",
"-DVSOMEIP_VERSION=\"3.4.10\"",
"-DVSOMEIP_COMPAT_VERSION=\"3.4.10\"",
"-DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\"",
"-DUSE_DLT",
],
Expand Down
8 changes: 4 additions & 4 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ LOCAL_CFLAGS := \
-frtti \
-fexceptions \
-DWITHOUT_SYSTEMD \
-DVSOMEIP_VERSION=\"3.4.9\" \
-DVSOMEIP_VERSION=\"3.4.10\" \
-DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\" \
-Wno-unused-parameter \
-Wno-non-virtual-dtor \
Expand Down Expand Up @@ -147,7 +147,7 @@ LOCAL_CFLAGS := \
-frtti \
-fexceptions \
-DWITHOUT_SYSTEMD \
-DVSOMEIP_VERSION=\"3.4.9\" \
-DVSOMEIP_VERSION=\"3.4.10\" \
-DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\" \
-Wno-unused-parameter \
-Wno-non-virtual-dtor \
Expand Down Expand Up @@ -194,8 +194,8 @@ LOCAL_CFLAGS := \
-frtti \
-fexceptions \
-DWITHOUT_SYSTEMD \
-DVSOMEIP_VERSION=\"3.4.9\" \
-DVSOMEIP_COMPAT_VERSION=\"3.4.9\" \
-DVSOMEIP_VERSION=\"3.4.10\" \
-DVSOMEIP_COMPAT_VERSION=\"3.4.10\" \
-DVSOMEIP_BASE_PATH=\"/vendor/run/someip/\" \
-Wno-unused-parameter \
-Wno-non-virtual-dtor \
Expand Down
24 changes: 24 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
Changes
=======

v3.4.10
- Fix QNX build
- Fix missing Stop Offer
- Apply extra fixes to QNX environment
- Remove key <service, instance> from the offer_commands_
- COVESA#478: deleted unused param _use_exclusive_proxy
- Fix code smell related to condition variable
- COVESA#462: Fix IPv6 Service Discovery
- Added multicast_mutex to async function that makes use of multicast socket
- COVESA#479: Allow service_discovery to continue without random_device
- Fix availability handler sending false on offer
- Set host/port in vsomeip_sec_client_t whenever possible
- Use executor_work_guard instead of io_context::work for boost v1.66 and higher
- Update Windows build
- Added profile 07 as an option for E2E protection
- ASIO: use heap-allocation to avoid using garbage data
- Fix integer underflow in server_endpoint_impl.cpp
- Cleanup prepare_stop_handlers_
- Automatic unsubscribe
- Debounce now works without routingmanagerd running
- Debouncing: Send last received value after debounce time + X
- Fix resource deadlock avoided crash
- Use closure instead of callable struct

v3.4.9
- Merge COVESA PR447 with support for QNX 7.1
- Merge COVESA PR470 with changes to not instantiate
Expand Down
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ set (VSOMEIP_COMPAT_NAME vsomeip)

set (VSOMEIP_MAJOR_VERSION 3)
set (VSOMEIP_MINOR_VERSION 4)
set (VSOMEIP_PATCH_VERSION 9)
set (VSOMEIP_HOTFIX_VERSION 1)
set (VSOMEIP_PATCH_VERSION 10)
set (VSOMEIP_HOTFIX_VERSION 0)

set (VSOMEIP_VERSION ${VSOMEIP_MAJOR_VERSION}.${VSOMEIP_MINOR_VERSION}.${VSOMEIP_PATCH_VERSION})
set (PACKAGE_VERSION ${VSOMEIP_VERSION}) # Used in documentation/doxygen.in
Expand Down Expand Up @@ -251,7 +251,6 @@ if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=${BOOST_WINDOWS_VERSION} -DWIN32 -DBOOST_ASIO_DISABLE_IOCP /EHsc /std:c++14 /wd4250")
set(USE_RT "")
link_directories(${Boost_LIBRARY_DIR_DEBUG})
ADD_DEFINITIONS( -DBOOST_ALL_DYN_LINK )
elseif(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
set(USE_RT "")
else()
Expand Down
4 changes: 4 additions & 0 deletions documentation/vsomeipUserGuide
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,10 @@ Specifies if the event shall be debounced based on elapsed time interval.
Specifies if interval timer is reset when payload change was detected.
(valid values: _false_, _true_). Defaults to _false_.

*** `send_current_value_after` (optional)
Specifies if last message should be sent after interval timeout.
(valid values: _false_, _true_). Defaults to _false_.

* `routing` (optional)
+
Specifies the properties of the routing. Either a string that specifies the application that hosts the
Expand Down
10 changes: 8 additions & 2 deletions examples/hello_world/hello_world_service.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2015-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -39,7 +39,13 @@ class hello_world_service {

~hello_world_service()
{
stop_thread_.join();
if (std::this_thread::get_id() != stop_thread_.get_id()) {
if (stop_thread_.joinable()) {
stop_thread_.join();
}
} else {
stop_thread_.detach();
}
}

bool init()
Expand Down
18 changes: 15 additions & 3 deletions examples/notify-sample.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -89,8 +89,20 @@ class service_sample {
notify_condition_.notify_one();
app_->clear_all_handler();
stop_offer();
offer_thread_.join();
notify_thread_.join();
if (std::this_thread::get_id() != offer_thread_.get_id()) {
if (offer_thread_.joinable()) {
offer_thread_.join();
}
} else {
offer_thread_.detach();
}
if (std::this_thread::get_id() != notify_thread_.get_id()) {
if (notify_thread_.joinable()) {
notify_thread_.join();
}
} else {
notify_thread_.detach();
}
app_->stop();
}
#endif
Expand Down
10 changes: 8 additions & 2 deletions examples/request-sample.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -94,7 +94,13 @@ class client_sample {
app_->clear_all_handler();
app_->release_service(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID);
condition_.notify_one();
sender_.join();
if (std::this_thread::get_id() != sender_.get_id()) {
if (sender_.joinable()) {
sender_.join();
}
} else {
sender_.detach();
}
app_->stop();
}
#endif
Expand Down
10 changes: 8 additions & 2 deletions examples/response-sample.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -61,7 +61,13 @@ class service_sample {
app_->clear_all_handler();
stop_offer();
condition_.notify_one();
offer_thread_.join();
if (std::this_thread::get_id() != offer_thread_.get_id()) {
if (offer_thread_.joinable()) {
offer_thread_.join();
}
} else {
offer_thread_.detach();
}
app_->stop();
}
#endif
Expand Down
26 changes: 20 additions & 6 deletions examples/routingmanagerd/routingmanagerd.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2015-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand Down Expand Up @@ -120,17 +120,31 @@ int routingmanagerd_process(bool _is_quiet) {
if (its_application->is_routing()) {
its_application->start();
#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
sighandler_thread.join();
if (std::this_thread::get_id() != sighandler_thread.get_id()) {
if (sighandler_thread.joinable()) {
sighandler_thread.join();
}
} else {
sighandler_thread.detach();
}
#endif
return 0;
}
VSOMEIP_ERROR << "routingmanagerd has not been configured as routing - abort";
}
#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
std::unique_lock<std::recursive_mutex> its_lock(sighandler_mutex);
stop_sighandler = true;
sighandler_condition.notify_one();
sighandler_thread.join();
{
std::unique_lock<std::recursive_mutex> its_lock(sighandler_mutex);
stop_sighandler = true;
sighandler_condition.notify_one();
}
if (std::this_thread::get_id() != sighandler_thread.get_id()) {
if (sighandler_thread.joinable()) {
sighandler_thread.join();
}
} else {
sighandler_thread.detach();
}
#endif
return -1;
}
Expand Down
13 changes: 13 additions & 0 deletions implementation/configuration/src/configuration_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ configuration_impl::configuration_impl(const std::string &_path)
netmask_ = netmask_.from_string(VSOMEIP_NETMASK);
for (auto i = 0; i < ET_MAX; i++)
is_configured_[i] = false;

#ifdef _WIN32
#if VSOMEIP_BOOST_VERSION < 106600
routing_.host_.unicast_ = boost::asio::ip::address::from_string("127.0.0.1");
#else
routing_.host_.unicast_ = boost::asio::ip::make_address("127.0.0.1");
#endif
routing_.host_.port_ = 31490;
routing_.guests_.unicast_ = routing_.host_.unicast_;
routing_.guests_.ports_[{ ANY_UID, ANY_GID }].emplace(31492, 31999);
#endif
}

configuration_impl::configuration_impl(const configuration_impl &_other)
Expand Down Expand Up @@ -4083,6 +4094,8 @@ configuration_impl::load_event_debounce(
its_converter << std::dec << its_value;
its_converter >> its_debounce->interval_;
}
} else if (its_key == "send_current_value_after") {
its_debounce->send_current_value_after_ = (its_value == "true");
}
}

Expand Down
5 changes: 4 additions & 1 deletion implementation/e2e_protection/include/crc/crc.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2014-2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
Expand All @@ -17,12 +17,15 @@ class e2e_crc {
const uint8_t _start_value = 0x00U);
static uint32_t calculate_profile_04(buffer_view _buffer_view,
const uint32_t _start_value = 0x00000000U);
static uint64_t calculate_profile_07(buffer_view _buffer_view,
const uint64_t _start_value = 0x0000000000000000U);

static uint32_t calculate_profile_custom(buffer_view _buffer_view);

private:
static const uint8_t lookup_table_profile_01_[256];
static const uint32_t lookup_table_profile_04_[256];
static const uint64_t lookup_table_profile_07_[256];
static const uint32_t lookup_table_profile_custom_[256];

};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef VSOMEIP_V3_E2E_PROFILE07_CHECKER_HPP
#define VSOMEIP_V3_E2E_PROFILE07_CHECKER_HPP

#include <map>

#include "../profile07/profile_07.hpp"
#include "../profile_interface/checker.hpp"

namespace vsomeip_v3 {
namespace e2e {
namespace profile07 {

class profile_07_checker final : public e2e::profile_interface::checker {

public:
profile_07_checker(void) = delete;

// [SWS_E2E_00389] initialize state
explicit profile_07_checker(const profile_config &_config) :
config_(_config) {}

void check(const e2e_buffer &_buffer, instance_t _instance,
e2e::profile_interface::check_status_t &_generic_check_status) override final;

private:
bool verify_input(const e2e_buffer &_buffer) const;
bool verify_counter(instance_t _instance, uint32_t _received_counter);

bool read_32(const e2e_buffer &_buffer, uint32_t &_data, size_t _index) const;
bool read_64(const e2e_buffer &_buffer, uint64_t &_data, size_t _index) const;

std::mutex check_mutex_;

profile_config config_;
std::map<instance_t, uint32_t> counter_;
};

} // namespace profile_07
} // namespace e2e
} // namespace vsomeip_v3

#endif // VSOMEIP_V3_E2E_PROFILE07_CHECKER_HPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright (C) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef VSOMEIP_V3_E2E_PROFILE07_PROFILE07_HPP
#define VSOMEIP_V3_E2E_PROFILE07_PROFILE07_HPP

#include <cstdint>

#include <vsomeip/defines.hpp>

#include "../../../buffer/buffer.hpp"

namespace vsomeip_v3 {
namespace e2e {
namespace profile07 {

const uint8_t PROFILE_07_SIZE_OFFSET = 8;
const uint8_t PROFILE_07_COUNTER_OFFSET = 12;
const uint8_t PROFILE_07_DATAID_OFFSET = 16;
const uint8_t PROFILE_07_CRC_OFFSET = 0;

struct profile_config;

class profile_07 {
public:
static uint64_t compute_crc(const profile_config &_config, const e2e_buffer &_buffer);
};

// [SWS_E2E_00200]
struct profile_config {
profile_config() = delete;

profile_config(uint32_t _data_id, size_t _offset,
size_t _min_data_length, size_t _max_data_length,
uint32_t _max_delta_counter)
: data_id_(_data_id), offset_(_offset),
min_data_length_(_min_data_length), max_data_length_(_max_data_length),
max_delta_counter_(_max_delta_counter),
base_(VSOMEIP_SOMEIP_HEADER_SIZE) {
}
profile_config(const profile_config &_config) = default;
profile_config &operator=(const profile_config &_config) = default;

uint32_t data_id_;
size_t offset_; // This must be configured in bit but as a multiple of 8.
// As we must use it as an index, we do the math once at
// configuration time and use the correct data type here.
// Thus, this value is always the byte where the CRC starts.
size_t min_data_length_;
size_t max_data_length_;
uint32_t max_delta_counter_;

// SOME/IP base
size_t base_;
};

} // namespace profile_07
} // namespace e2e
} // namespace vsomeip_v3

#endif // VSOMEIP_V3_E2E_PROFILE07_PROFILE07_HPP
Loading

0 comments on commit 02c199d

Please sign in to comment.