diff options
Diffstat (limited to 'implementation')
11 files changed, 81 insertions, 26 deletions
diff --git a/implementation/configuration/include/configuration_plugin.hpp b/implementation/configuration/include/configuration_plugin.hpp index cbb4685..583c3d8 100644 --- a/implementation/configuration/include/configuration_plugin.hpp +++ b/implementation/configuration/include/configuration_plugin.hpp @@ -17,7 +17,12 @@ class configuration; class configuration_plugin { public: - virtual ~configuration_plugin() = default; + virtual ~configuration_plugin() +#ifndef ANDROID + {} +#else + ; +#endif virtual std::shared_ptr<configuration> get_configuration(const std::string &_name) = 0; }; diff --git a/implementation/configuration/include/internal_android.hpp b/implementation/configuration/include/internal_android.hpp index 28cbb5c..25ecb4e 100644 --- a/implementation/configuration/include/internal_android.hpp +++ b/implementation/configuration/include/internal_android.hpp @@ -19,11 +19,11 @@ #define VSOMEIP_ENV_CLIENTSIDELOGGING "VSOMEIP_CLIENTSIDELOGGING" #define VSOMEIP_ENV_BASE_PATH "VSOMEIP_BASE_PATH" -#define VSOMEIP_DEFAULT_CONFIGURATION_FILE "/etc/vsomeip.json" +#define VSOMEIP_DEFAULT_CONFIGURATION_FILE "/vendor/etc/vsomeip.json" #define VSOMEIP_LOCAL_CONFIGURATION_FILE "./vsomeip.json" #define VSOMEIP_MANDATORY_CONFIGURATION_FILES "vsomeip_std.json,vsomeip_app.json,vsomeip_plc.json,vsomeip_log.json,vsomeip_security.json,vsomeip_whitelist.json" -#define VSOMEIP_DEFAULT_CONFIGURATION_FOLDER "/etc/vsomeip" +#define VSOMEIP_DEFAULT_CONFIGURATION_FOLDER "/vendor/etc/vsomeip" #define VSOMEIP_DEBUG_CONFIGURATION_FOLDER "/var/opt/public/sin/vsomeip/" #define VSOMEIP_LOCAL_CONFIGURATION_FOLDER "./vsomeip" diff --git a/implementation/endpoints/include/client_endpoint.hpp b/implementation/endpoints/include/client_endpoint.hpp index ce872e8..3429a92 100644 --- a/implementation/endpoints/include/client_endpoint.hpp +++ b/implementation/endpoints/include/client_endpoint.hpp @@ -12,7 +12,12 @@ namespace vsomeip_v3 { class client_endpoint : public virtual endpoint { public: - virtual ~client_endpoint() {} + virtual ~client_endpoint() +#ifndef ANDROID + {} +#else + ; +#endif virtual bool get_remote_address(boost::asio::ip::address &_address) const = 0; virtual std::uint16_t get_remote_port() const = 0; diff --git a/implementation/endpoints/include/endpoint.hpp b/implementation/endpoints/include/endpoint.hpp index 452f92b..ccfe96b 100644 --- a/implementation/endpoints/include/endpoint.hpp +++ b/implementation/endpoints/include/endpoint.hpp @@ -22,7 +22,12 @@ public: typedef std::function<void()> error_handler_t; typedef std::function<void(const std::shared_ptr<endpoint>&, service_t)> prepare_stop_handler_t; - virtual ~endpoint() {} + virtual ~endpoint() +#ifndef ANDROID + {} +#else + ; +#endif virtual void start() = 0; virtual void prepare_stop(prepare_stop_handler_t _handler, diff --git a/implementation/endpoints/src/client_endpoint_impl.cpp b/implementation/endpoints/src/client_endpoint_impl.cpp index 434ed14..9b31cc1 100644 --- a/implementation/endpoints/src/client_endpoint_impl.cpp +++ b/implementation/endpoints/src/client_endpoint_impl.cpp @@ -612,7 +612,7 @@ typename endpoint_impl<Protocol>::cms_ret_e client_endpoint_impl<Protocol>::chec return endpoint_impl<Protocol>::cms_ret_e::MSG_WAS_SPLIT; } } - VSOMEIP_ERROR << "cei::check_message_size: Dropping to big message (" + VSOMEIP_ERROR << "cei::check_message_size: Dropping too big message (" << std::dec << _size << " Bytes). Maximum allowed message size is: " << endpoint_impl<Protocol>::max_message_size_ << " Bytes."; ret = endpoint_impl<Protocol>::cms_ret_e::MSG_TOO_BIG; diff --git a/implementation/endpoints/src/netlink_connector.cpp b/implementation/endpoints/src/netlink_connector.cpp index ce82e9f..ebd432d 100644 --- a/implementation/endpoints/src/netlink_connector.cpp +++ b/implementation/endpoints/src/netlink_connector.cpp @@ -17,6 +17,12 @@ namespace vsomeip_v3 { +namespace { + const std::uint32_t ifa_request_sequence = 1; + const std::uint32_t ifi_request_sequence = 2; + const std::uint32_t rt_request_sequence = 3; +} + void netlink_connector::register_net_if_changes_handler(const net_if_changed_handler_t& _handler) { handler_ = _handler; } @@ -181,9 +187,32 @@ void netlink_connector::receive_cbk(boost::system::error_code const &_error, } case NLMSG_ERROR: { struct nlmsgerr *errmsg = (nlmsgerr *)NLMSG_DATA(nlh); + if (errmsg->error == 0) { + // Ack from netlink + break; + } + VSOMEIP_ERROR << "netlink_connector::receive_cbk received " - "error message: " << std::dec << nlh->nlmsg_type + "error message: " << strerror(errmsg->error) + << " type " << std::dec << errmsg->msg.nlmsg_type << " seq " << errmsg->msg.nlmsg_seq; + + std::string request_type{}; + if (errmsg->msg.nlmsg_type == RTM_GETADDR && errmsg->msg.nlmsg_seq == ifa_request_sequence) { + request_type = "address request"; + send_ifa_request(); + } else if (errmsg->msg.nlmsg_type == RTM_GETLINK && errmsg->msg.nlmsg_seq == ifi_request_sequence) { + request_type = "link request"; + send_ifi_request(); + } else if (errmsg->msg.nlmsg_type == RTM_GETROUTE && errmsg->msg.nlmsg_seq == rt_request_sequence) { + request_type = "route request"; + send_rt_request(); + } + + if (!request_type.empty()) { + VSOMEIP_INFO << "Retrying netlink " << request_type; + } + break; } case NLMSG_DONE: @@ -251,7 +280,7 @@ void netlink_connector::send_ifa_request() { get_address_msg.nlhdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg)); get_address_msg.nlhdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT; get_address_msg.nlhdr.nlmsg_type = RTM_GETADDR; - get_address_msg.nlhdr.nlmsg_seq = 1; + get_address_msg.nlhdr.nlmsg_seq = ifa_request_sequence; if (address_.is_v4()) { get_address_msg.addrmsg.ifa_family = AF_INET; } else { @@ -280,7 +309,7 @@ void netlink_connector::send_ifi_request() { get_link_msg.nlhdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT; get_link_msg.nlhdr.nlmsg_type = RTM_GETLINK; get_link_msg.infomsg.ifi_family = AF_UNSPEC; - get_link_msg.nlhdr.nlmsg_seq = 2; + get_link_msg.nlhdr.nlmsg_seq = ifi_request_sequence; { std::lock_guard<std::mutex> its_lock(socket_mutex_); @@ -307,7 +336,7 @@ void netlink_connector::send_rt_request() { get_route_msg.nlhdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg)); get_route_msg.nlhdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP; get_route_msg.nlhdr.nlmsg_type = RTM_GETROUTE; - get_route_msg.nlhdr.nlmsg_seq = 3; + get_route_msg.nlhdr.nlmsg_seq = rt_request_sequence; if (multicast_address_.is_v6()) { get_route_msg.routemsg.rtgen_family = AF_INET6; } else { diff --git a/implementation/endpoints/src/server_endpoint_impl.cpp b/implementation/endpoints/src/server_endpoint_impl.cpp index 90aea96..46e2397 100644 --- a/implementation/endpoints/src/server_endpoint_impl.cpp +++ b/implementation/endpoints/src/server_endpoint_impl.cpp @@ -466,7 +466,7 @@ typename endpoint_impl<Protocol>::cms_ret_e server_endpoint_impl<Protocol>::chec return endpoint_impl<Protocol>::cms_ret_e::MSG_WAS_SPLIT; } } - VSOMEIP_ERROR << "sei::send_intern: Dropping to big message (" << _size + VSOMEIP_ERROR << "sei::send_intern: Dropping too big message (" << _size << " Bytes). Maximum allowed message size is: " << endpoint_impl<Protocol>::max_message_size_ << " Bytes."; ret = endpoint_impl<Protocol>::cms_ret_e::MSG_TOO_BIG; @@ -632,6 +632,7 @@ void server_endpoint_impl<Protocol>::send_cbk( } if (found_service_msg) { ++stp_hndlr_iter; + found_service_msg = false; } else { // all messages of the to be stopped service have been sent auto handler = stp_hndlr_iter->second; auto ptr = this->shared_from_this(); diff --git a/implementation/routing/src/routing_manager_proxy.cpp b/implementation/routing/src/routing_manager_proxy.cpp index 3eba2a5..2af0eb5 100644 --- a/implementation/routing/src/routing_manager_proxy.cpp +++ b/implementation/routing/src/routing_manager_proxy.cpp @@ -154,6 +154,7 @@ bool routing_manager_proxy::offer_service(client_t _client, if(!routing_manager_base::offer_service(_client, _service, _instance, _major, _minor)) { VSOMEIP_WARNING << "routing_manager_proxy::offer_service," << "routing_manager_base::offer_service returned false"; + return false; } { std::lock_guard<std::mutex> its_lock(state_mutex_); diff --git a/implementation/runtime/src/runtime.cpp b/implementation/runtime/src/runtime.cpp index 9e79b79..40bb455 100644 --- a/implementation/runtime/src/runtime.cpp +++ b/implementation/runtime/src/runtime.cpp @@ -4,8 +4,12 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include <vsomeip/runtime.hpp> +#include <vsomeip/plugin.hpp> #include "../include/runtime_impl.hpp" +#include "../../endpoints/include/endpoint.hpp" +#include "../../endpoints/include/client_endpoint.hpp" +#include "../../configuration/include/configuration_plugin.hpp" namespace vsomeip_v3 { @@ -21,4 +25,19 @@ std::shared_ptr<runtime> runtime::get() { return runtime_impl::get(); } +// non-inline destructors to make typeinfo of the type visible outside the shared library boundary +#ifdef ANDROID +plugin::~plugin() { +} + +endpoint::~endpoint() { +} + +client_endpoint::~client_endpoint() { +} + +configuration_plugin::~configuration_plugin() { +} +#endif + } // namespace vsomeip_v3 diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp index b252e62..1f5dc07 100644 --- a/implementation/service_discovery/src/service_discovery_impl.cpp +++ b/implementation/service_discovery/src/service_discovery_impl.cpp @@ -166,13 +166,8 @@ service_discovery_impl::start() { } if (endpoint_ && !reliable_) { // rejoin multicast group -#ifndef ANDROID - reinterpret_cast<udp_server_endpoint_impl*>( - endpoint_.get())->join(sd_multicast_); -#else dynamic_cast<udp_server_endpoint_impl*>( endpoint_.get())->join(sd_multicast_); -#endif } } is_suspended_ = false; @@ -2610,11 +2605,11 @@ service_discovery_impl::check_ipv4_address( //Check unallowed ipv4 address bool is_valid = true; - static const boost::asio::ip::address_v4::bytes_type its_unicast_address = + const boost::asio::ip::address_v4::bytes_type its_unicast_address = unicast_.to_v4().to_bytes(); const boost::asio::ip::address_v4::bytes_type endpoint_address = its_address.to_v4().to_bytes(); - static const boost::asio::ip::address_v4::bytes_type its_netmask = + const boost::asio::ip::address_v4::bytes_type its_netmask = configuration_->get_netmask().to_v4().to_bytes(); //same address as unicast address of DUT not allowed @@ -3351,13 +3346,8 @@ service_discovery_impl::on_last_msg_received_timer_expired( // Rejoin multicast group if (endpoint_ && !reliable_) { -#ifndef ANDROID - reinterpret_cast<udp_server_endpoint_impl*>( - endpoint_.get())->join(sd_multicast_); -#else dynamic_cast<udp_server_endpoint_impl*>( endpoint_.get())->join(sd_multicast_); -#endif } { boost::system::error_code ec; @@ -3742,8 +3732,10 @@ reliability_type_e service_discovery_impl::get_eventgroup_reliability( << std::hex << std::setw(4) << std::setfill('0') << _instance << "." << std::hex << std::setw(4) << std::setfill('0') << _eventgroup << "]"; } + return its_reliability; } + } // namespace sd } // namespace vsomeip_v3 diff --git a/implementation/utility/include/utility.hpp b/implementation/utility/include/utility.hpp index db54eb9..434ef11 100644 --- a/implementation/utility/include/utility.hpp +++ b/implementation/utility/include/utility.hpp @@ -36,9 +36,7 @@ public: } static inline bool is_request(message_type_e _type) { - return ((_type < message_type_e::MT_NOTIFICATION) - || (_type >= message_type_e::MT_REQUEST_ACK - && _type <= message_type_e::MT_REQUEST_NO_RETURN_ACK)); + return (_type < message_type_e::MT_NOTIFICATION); } static inline bool is_request_no_return(std::shared_ptr<message> _message) { |