Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/upload-apex-release-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
tag_name: ${{ github.ref_name }}
files: /tmp/${{ github.ref_name }}.tar.gz
draft: true
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 changes: 29 additions & 41 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
cc_shared_library(
name = "vsomeip3_shared",
shared_lib_name = "libvsomeip3.so",
tags = ["same-ros-pkg-as: vsomeip3"],
# Disabled due to linking problem when used as an external repository with sanitizers enabled.
#user_link_flags = [
# "-Wl,--no-undefined",
#],
deps = ["//implementation"],
)
load("@apex//common/bazel/rules_cc:defs.bzl", "apex_cc_library")

# apex_cc_library(
# name = "vsomeip3_shared",
# shared_lib_name = "libvsomeip3.so",
# tags = ["same-ros-pkg-as: vsomeip3"],
# # Disabled due to linking problem when used as an external repository with sanitizers enabled.
# #user_link_flags = [
# # "-Wl,--no-undefined",
# #],
# deps = [
# "//implementation:configuration",
# "//implementation:service_discovery",
# ],
# )

cc_shared_library(
apex_cc_library(
name = "vsomeip3_config_plugin",
dynamic_deps = [":vsomeip3_shared"],
shared_lib_name = "libvsomeip3-cfg.so.3",
tags = ["same-ros-pkg-as: vsomeip3"],
# Disabled due to linking problem when used as an external repository with sanitizers enabled.
#user_link_flags = [
Expand All @@ -21,10 +24,8 @@ cc_shared_library(
deps = ["//implementation:configuration"],
)

cc_shared_library(
apex_cc_library(
name = "vsomeip3_sd_plugin",
dynamic_deps = [":vsomeip3_shared"],
shared_lib_name = "libvsomeip3-sd.so.3",
tags = ["same-ros-pkg-as: vsomeip3"],
# Disabled due to linking problem when used as an external repository with sanitizers enabled.
#user_link_flags = [
Expand All @@ -33,42 +34,29 @@ cc_shared_library(
deps = ["//implementation:service_discovery"],
)

cc_import(
name = "vsomeip3_import",
shared_library = ":vsomeip3_shared",
tags = ["same-ros-pkg-as: vsomeip3"],
deps = ["//interface"],
)
# apex_cc_library(
# name = "vsomeip3_import",
# shared_library = ":vsomeip3_shared",
# tags = ["same-ros-pkg-as: vsomeip3"],
# deps = ["//interface"],
# )

cc_import(
name = "vsomeip3_configuration_plugin_import",
shared_library = ":vsomeip3_config_plugin",
tags = ["same-ros-pkg-as: vsomeip3"],
)

cc_import(
name = "vsomeip3_sd_plugin_import",
shared_library = ":vsomeip3_sd_plugin",
tags = ["same-ros-pkg-as: vsomeip3"],
)

# interface library, use this target to depend on vsomeip
cc_library(
apex_cc_library(
name = "vsomeip3",
data = [
":vsomeip3_config_plugin",
":vsomeip3_sd_plugin",
],
srcs = ["src/plugin_init.cpp"],
alwayslink = True,
linkopts = select({
"@platforms//os:linux": ["-lpthread"],
"//conditions:default": [],
}),
linkstatic = True, # no object files
visibility = ["//visibility:public"],
deps = [
":vsomeip3_configuration_plugin_import",
":vsomeip3_import",
":vsomeip3_sd_plugin_import",
":vsomeip3_config_plugin",
# ":vsomeip3_import",
":vsomeip3_sd_plugin",
"//interface",
],
)
13 changes: 7 additions & 6 deletions implementation/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
load("//bazel:expand_template.bzl", "expand_template")
load("@apex//common/bazel/rules_cc:defs.bzl", "apex_cc_library")
load("@vsomeip//bazel:version.bzl", "version_dict_from_string")

APEX_VSOMEIP_VERSION_TAG = "3.6.1-apex8" # Must match the git tag version.
APEX_VSOMEIP_VERSION_TAG = "3.6.1-apex8-fix-qnx-gateway-com-02" # Must match the git tag version.

expand_template(
name = "config",
Expand All @@ -24,13 +25,13 @@ expand_template(
template = "configuration/include/internal.hpp.in",
)

cc_library(
apex_cc_library(
name = "generated_config",
hdrs = [":config"],
strip_include_prefix = "configuration/include",
)

cc_library(
apex_cc_library(
name = "helper",
hdrs = glob(
[
Expand All @@ -49,7 +50,7 @@ cc_library(
],
)

cc_library(
apex_cc_library(
name = "configuration",
srcs = glob(
[
Expand All @@ -63,7 +64,7 @@ cc_library(
],
)

cc_library(
apex_cc_library(
name = "service_discovery",
srcs = glob(
[
Expand All @@ -76,7 +77,7 @@ cc_library(
],
)

cc_library(
apex_cc_library(
name = "implementation",
srcs = glob(
[
Expand Down
17 changes: 14 additions & 3 deletions implementation/configuration/src/configuration_plugin_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include <iostream>

#include <vsomeip/internal/logger.hpp>
#include <vsomeip/internal/plugin_manager.hpp>

Expand All @@ -22,11 +24,17 @@ std::shared_ptr<configuration> configuration_plugin_impl::get_configuration(cons
std::scoped_lock its_lock(mutex_);
auto its_iterator = configurations_.find(_name);
if (its_iterator != configurations_.end()) {
std::cerr << "[vsomeip][configuration-debug] Reusing cached configuration for application \"" << _name << "\"."
<< std::endl;
its_configuration = its_iterator->second;
} else {
std::cerr << "[vsomeip][configuration-debug] Creating new configuration_impl for application \"" << _name
<< "\" with path \"" << _path << "\"." << std::endl;
its_configuration = std::make_shared<cfg::configuration_impl>(_path);
its_configuration->load(_name);
configurations_[_name] = its_configuration;
std::cerr << "[vsomeip][configuration-debug] Configuration loaded and cached for application \"" << _name << "\"."
<< std::endl;
}

return its_configuration;
Expand All @@ -39,14 +47,17 @@ bool configuration_plugin_impl::remove_configuration(const std::string& _name) {

namespace {

struct configuration_plugin_static_registrar {
configuration_plugin_static_registrar() {
struct configuration_plugin_static_registration {
configuration_plugin_static_registration() {
std::cerr << "[vsomeip][configuration-debug] Static configuration plugin registration is running. Registering "
"CONFIGURATION_PLUGIN factory with plugin_manager."
<< std::endl;
plugin_manager::register_static_plugin(plugin_type_e::CONFIGURATION_PLUGIN,
configuration_plugin_impl::get_plugin);
}
};

const configuration_plugin_static_registrar configuration_plugin_static_registrar_{};
const configuration_plugin_static_registration configuration_plugin_static_registration_{};

} // namespace
} // namespace vsomeip_v3
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@

#if defined(__linux__) || defined(__QNX__)

#include <cerrno>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/uio.h>

#include <boost/asio/local/stream_protocol.hpp>
#include <functional>
#include <memory>

namespace vsomeip_v3 {
Expand Down Expand Up @@ -36,7 +42,7 @@ inline std::function<void(boost::system::error_code _error)> receive_cb(std::sha
if (!_error) {
if (!_data->socket_.native_non_blocking())
_data->socket_.native_non_blocking(true, _error);
#if defined(__linux__)
#if defined(__linux__) || defined(__QNX__)
for (;;) {
ssize_t its_result;
int its_flags(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef VSOMEIP_V3_LOCAL_TCP_CLIENT_ENDPOINT_IMPL_HPP_
#define VSOMEIP_V3_LOCAL_TCP_CLIENT_ENDPOINT_IMPL_HPP_

#include <cstddef>

#include <boost/asio/ip/tcp.hpp>

#include <vsomeip/defines.hpp>
Expand Down Expand Up @@ -56,6 +58,7 @@ class local_tcp_client_endpoint_impl : public local_tcp_client_endpoint_base_imp
void max_allowed_reconnects_reached();

message_buffer_t recv_buffer_;
std::size_t recv_buffer_size_;

// send data
message_buffer_ptr_t send_data_buffer_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef VSOMEIP_V3_LOCAL_UDS_CLIENT_ENDPOINT_IMPL_HPP_
#define VSOMEIP_V3_LOCAL_UDS_CLIENT_ENDPOINT_IMPL_HPP_

#include <cstddef>

#include <boost/asio/local/stream_protocol.hpp>

#include <vsomeip/defines.hpp>
Expand Down Expand Up @@ -55,6 +57,7 @@ class local_uds_client_endpoint_impl : public local_uds_client_endpoint_base_imp
void max_allowed_reconnects_reached();

message_buffer_t recv_buffer_;
std::size_t recv_buffer_size_;

// send data
message_buffer_ptr_t send_data_buffer_;
Expand Down
18 changes: 15 additions & 3 deletions implementation/endpoints/src/local_tcp_client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ local_tcp_client_endpoint_impl::local_tcp_client_endpoint_impl(const std::shared
boost::asio::io_context& _io,
const std::shared_ptr<configuration>& _configuration) :
local_tcp_client_endpoint_base_impl(_endpoint_host, _routing_host, _local, _remote, _io, _configuration),
recv_buffer_(VSOMEIP_LOCAL_CLIENT_ENDPOINT_RECV_BUFFER_SIZE, 0) {
recv_buffer_(VSOMEIP_LOCAL_CLIENT_ENDPOINT_RECV_BUFFER_SIZE, 0), recv_buffer_size_(0) {

this->max_message_size_ = _configuration->get_max_message_size_local();
this->queue_limit_ = _configuration->get_endpoint_queue_limit_local();
Expand All @@ -60,6 +60,7 @@ void local_tcp_client_endpoint_impl::restart(bool _force) {
queue_.clear();
queue_size_ = 0;
is_sending_ = false;
recv_buffer_size_ = 0;
}
{
std::lock_guard<std::mutex> its_lock(socket_mutex_);
Expand Down Expand Up @@ -230,7 +231,11 @@ void local_tcp_client_endpoint_impl::connect() {
void local_tcp_client_endpoint_impl::receive() {
std::lock_guard<std::mutex> its_lock(socket_mutex_);
if (socket_->is_open()) {
socket_->async_receive(boost::asio::buffer(recv_buffer_),
if (recv_buffer_size_ == recv_buffer_.size()) {
VSOMEIP_WARNING << "ltcei::" << __func__ << ": receive buffer full before receive endpoint > " << this;
recv_buffer_size_ = 0;
}
socket_->async_receive(boost::asio::buffer(&recv_buffer_[recv_buffer_size_], recv_buffer_.size() - recv_buffer_size_),
strand_.wrap(std::bind(&local_tcp_client_endpoint_impl::receive_cbk,
std::dynamic_pointer_cast<local_tcp_client_endpoint_impl>(shared_from_this()),
std::placeholders::_1, std::placeholders::_2)));
Expand Down Expand Up @@ -317,6 +322,7 @@ void local_tcp_client_endpoint_impl::receive_cbk(boost::system::error_code const
sending_blocked_ = false;
queue_.clear();
queue_size_ = 0;
recv_buffer_size_ = 0;

if (is_stopping_) {
queue_cv_.notify_all();
Expand All @@ -334,16 +340,22 @@ void local_tcp_client_endpoint_impl::receive_cbk(boost::system::error_code const
VSOMEIP_INFO << msg.str();
#endif

recv_buffer_size_ += _bytes;

// We only handle a single message here. Check whether the message
// format matches what we do expect.
// TODO: Replace the magic numbers.
if (_bytes == VSOMEIP_LOCAL_CLIENT_ENDPOINT_RECV_BUFFER_SIZE && recv_buffer_[0] == 0x67 && recv_buffer_[1] == 0x37
if (recv_buffer_size_ == VSOMEIP_LOCAL_CLIENT_ENDPOINT_RECV_BUFFER_SIZE && recv_buffer_[0] == 0x67 && recv_buffer_[1] == 0x37
&& recv_buffer_[2] == 0x6d && recv_buffer_[3] == 0x07 && recv_buffer_[4] == byte_t(protocol::id_e::ASSIGN_CLIENT_ACK_ID)
&& recv_buffer_[15] == 0x07 && recv_buffer_[16] == 0x6d && recv_buffer_[17] == 0x37 && recv_buffer_[18] == 0x67) {

auto its_routing_host = routing_host_.lock();
if (its_routing_host)
its_routing_host->on_message(&recv_buffer_[4], static_cast<length_t>(recv_buffer_.size() - 8), this);
recv_buffer_size_ = 0;
} else if (recv_buffer_size_ == VSOMEIP_LOCAL_CLIENT_ENDPOINT_RECV_BUFFER_SIZE) {
VSOMEIP_WARNING << "ltcei::" << __func__ << ": received malformed assign client ack endpoint > " << this;
recv_buffer_size_ = 0;
}

receive();
Expand Down
18 changes: 15 additions & 3 deletions implementation/endpoints/src/local_uds_client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ local_uds_client_endpoint_impl::local_uds_client_endpoint_impl(const std::shared
local_uds_client_endpoint_base_impl(_endpoint_host, _routing_host, _remote, _remote, _io, _configuration),
// Using _remote for the local(!) endpoint is ok,
// because we have no bind for local endpoints!
recv_buffer_(VSOMEIP_LOCAL_CLIENT_ENDPOINT_RECV_BUFFER_SIZE, 0) {
recv_buffer_(VSOMEIP_LOCAL_CLIENT_ENDPOINT_RECV_BUFFER_SIZE, 0), recv_buffer_size_(0) {

this->max_message_size_ = _configuration->get_max_message_size_local();
this->queue_limit_ = _configuration->get_endpoint_queue_limit_local();
Expand All @@ -50,6 +50,7 @@ void local_uds_client_endpoint_impl::restart(bool _force) {
queue_.clear();
queue_size_ = 0;
is_sending_ = false;
recv_buffer_size_ = 0;
}
{
std::lock_guard<std::mutex> its_lock(socket_mutex_);
Expand Down Expand Up @@ -175,7 +176,11 @@ void local_uds_client_endpoint_impl::connect() {
void local_uds_client_endpoint_impl::receive() {
std::lock_guard<std::mutex> its_lock(socket_mutex_);
if (socket_->is_open()) {
socket_->async_receive(boost::asio::buffer(recv_buffer_),
if (recv_buffer_size_ == recv_buffer_.size()) {
VSOMEIP_WARNING << "lucei::" << __func__ << ": receive buffer full before receive | endpoint > " << this;
recv_buffer_size_ = 0;
}
socket_->async_receive(boost::asio::buffer(&recv_buffer_[recv_buffer_size_], recv_buffer_.size() - recv_buffer_size_),
strand_.wrap(std::bind(&local_uds_client_endpoint_impl::receive_cbk,
std::dynamic_pointer_cast<local_uds_client_endpoint_impl>(shared_from_this()),
std::placeholders::_1, std::placeholders::_2)));
Expand Down Expand Up @@ -263,6 +268,7 @@ void local_uds_client_endpoint_impl::receive_cbk(boost::system::error_code const
sending_blocked_ = false;
queue_.clear();
queue_size_ = 0;
recv_buffer_size_ = 0;
} else if (_error == boost::asio::error::bad_descriptor) {
restart(true);
return;
Expand All @@ -279,16 +285,22 @@ void local_uds_client_endpoint_impl::receive_cbk(boost::system::error_code const
VSOMEIP_INFO << msg.str();
#endif

recv_buffer_size_ += _bytes;

// We only handle a single message here. Check whether the message
// format matches what we do expect.
// TODO: Replace the magic numbers.
if (_bytes == VSOMEIP_LOCAL_CLIENT_ENDPOINT_RECV_BUFFER_SIZE && recv_buffer_[0] == 0x67 && recv_buffer_[1] == 0x37
if (recv_buffer_size_ == VSOMEIP_LOCAL_CLIENT_ENDPOINT_RECV_BUFFER_SIZE && recv_buffer_[0] == 0x67 && recv_buffer_[1] == 0x37
&& recv_buffer_[2] == 0x6d && recv_buffer_[3] == 0x07 && recv_buffer_[4] == byte_t(protocol::id_e::ASSIGN_CLIENT_ACK_ID)
&& recv_buffer_[15] == 0x07 && recv_buffer_[16] == 0x6d && recv_buffer_[17] == 0x37 && recv_buffer_[18] == 0x67) {

auto its_routing_host = routing_host_.lock();
if (its_routing_host)
its_routing_host->on_message(&recv_buffer_[4], static_cast<length_t>(recv_buffer_.size() - 8), this);
recv_buffer_size_ = 0;
} else if (recv_buffer_size_ == VSOMEIP_LOCAL_CLIENT_ENDPOINT_RECV_BUFFER_SIZE) {
VSOMEIP_WARNING << "lucei::" << __func__ << ": received malformed assign client ack | endpoint > " << this;
recv_buffer_size_ = 0;
}

receive();
Expand Down
Loading
Loading