diff options
author | Juergen Gehring <juergen.gehring@bmw.de> | 2017-02-28 03:57:20 -0800 |
---|---|---|
committer | Juergen Gehring <juergen.gehring@bmw.de> | 2017-02-28 03:57:20 -0800 |
commit | 07d7573c007322be07689575ce5d73c45f030d6d (patch) | |
tree | 6a6acbf7536de451391d9d50b7f5cdde49d67fd8 /implementation/routing/include | |
parent | 1a230558936ec84b4fb44b2346dc5ae52d6f2805 (diff) | |
download | vSomeIP-07d7573c007322be07689575ce5d73c45f030d6d.tar.gz |
vSomeIP 2.5.32.5.3
Diffstat (limited to 'implementation/routing/include')
12 files changed, 91 insertions, 32 deletions
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/. |