diff options
Diffstat (limited to 'implementation/service_discovery/include')
26 files changed, 84 insertions, 84 deletions
diff --git a/implementation/service_discovery/include/configuration_option_impl.hpp b/implementation/service_discovery/include/configuration_option_impl.hpp index 567762d..e1dde72 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-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 @@ public: configuration_option_impl(); virtual ~configuration_option_impl(); - bool operator==(const option_impl &_other) const; + bool equals(const option_impl &_other) const; void add_item(const std::string &_key, const std::string &_value); void remove_item(const std::string &_key); diff --git a/implementation/service_discovery/include/constants.hpp b/implementation/service_discovery/include/constants.hpp index c50fac1..3ebb259 100644 --- a/implementation/service_discovery/include/constants.hpp +++ b/implementation/service_discovery/include/constants.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 b7e840b..b7642f1 100644 --- a/implementation/service_discovery/include/defines.hpp +++ b/implementation/service_discovery/include/defines.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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,7 +12,7 @@ #define VSOMEIP_SOMEIP_SD_DATA_SIZE 12 #define VSOMEIP_SOMEIP_SD_ENTRY_LENGTH_SIZE 4 #define VSOMEIP_SOMEIP_SD_ENTRY_SIZE 16 -#define VSOMEIP_SOMEIP_SD_IPV4_OPTION_SIZE 12 +#define VSOMEIP_SOMEIP_SD_IPV3_OPTION_SIZE 12 #define VSOMEIP_SOMEIP_SD_IPV6_OPTION_SIZE 24 #define VSOMEIP_SOMEIP_SD_LOAD_BALANCING_OPTION_SIZE 8 #define VSOMEIP_SOMEIP_SD_PROTECTION_OPTION_SIZE 12 diff --git a/implementation/service_discovery/include/deserializer.hpp b/implementation/service_discovery/include/deserializer.hpp index 97ebcd4..866ebda 100755..100644 --- a/implementation/service_discovery/include/deserializer.hpp +++ b/implementation/service_discovery/include/deserializer.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 39d5416..ed22c8f 100755..100644 --- a/implementation/service_discovery/include/entry_impl.hpp +++ b/implementation/service_discovery/include/entry_impl.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 63d0378..0b6c71b 100644 --- a/implementation/service_discovery/include/enumeration_types.hpp +++ b/implementation/service_discovery/include/enumeration_types.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 08b25a6..efb9b07 100755..100644 --- a/implementation/service_discovery/include/eventgroupentry_impl.hpp +++ b/implementation/service_discovery/include/eventgroupentry_impl.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 c83d745..842be84 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-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 @@ public: ip_option_impl(); ip_option_impl(const uint16_t _port, const bool _is_reliable); virtual ~ip_option_impl(); - virtual bool operator ==(const option_impl &_other) const; + bool equals(const option_impl &_other) const; uint16_t get_port() const; void set_port(uint16_t _port); diff --git a/implementation/service_discovery/include/ipv4_option_impl.hpp b/implementation/service_discovery/include/ipv4_option_impl.hpp index 15c04b2..7e97078 100644 --- a/implementation/service_discovery/include/ipv4_option_impl.hpp +++ b/implementation/service_discovery/include/ipv4_option_impl.hpp @@ -1,10 +1,10 @@ -// Copyright (C) 2014-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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_SD_IPV4_OPTION_IMPL_HPP_ -#define VSOMEIP_V3_SD_IPV4_OPTION_IMPL_HPP_ +#ifndef VSOMEIP_V3_SD_IPV3_OPTION_IMPL_HPP_ +#define VSOMEIP_V3_SD_IPV3_OPTION_IMPL_HPP_ #include <boost/asio/ip/address.hpp> @@ -22,7 +22,7 @@ public: const uint16_t _port, const bool _is_reliable); virtual ~ipv4_option_impl(); - bool operator ==(const option_impl &_other) const; + bool equals(const option_impl &_other) const; const ipv4_address_t & get_address() const; void set_address(const ipv4_address_t &_address); @@ -38,5 +38,5 @@ private: } // namespace sd } // namespace vsomeip_v3 -#endif // VSOMEIP_V3_SD_IPV4_OPTION_IMPL_HPP_ +#endif // VSOMEIP_V3_SD_IPV3_OPTION_IMPL_HPP_ diff --git a/implementation/service_discovery/include/ipv6_option_impl.hpp b/implementation/service_discovery/include/ipv6_option_impl.hpp index d896300..17a613b 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-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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,7 +23,7 @@ public: const uint16_t _port, const bool _is_reliable); virtual ~ipv6_option_impl(); - bool operator ==(const option_impl &_other) const; + bool equals(const option_impl &_other) const; const ipv6_address_t & get_address() const; void set_address(const ipv6_address_t &_address); diff --git a/implementation/service_discovery/include/load_balancing_option_impl.hpp b/implementation/service_discovery/include/load_balancing_option_impl.hpp index dafcfc7..15fa917 100755..100644 --- 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-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 @@ public: load_balancing_option_impl(); virtual ~load_balancing_option_impl(); - bool operator ==(const option_impl &_other) const; + bool equals(const option_impl &_other) const; priority_t get_priority() const; void set_priority(priority_t _priority); diff --git a/implementation/service_discovery/include/message_element_impl.hpp b/implementation/service_discovery/include/message_element_impl.hpp index 29b5d86..2ce979b 100755..100644 --- 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-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 b9e858d..faeb9d6 100755..100644 --- a/implementation/service_discovery/include/message_impl.hpp +++ b/implementation/service_discovery/include/message_impl.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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,7 +36,7 @@ class serviceentry_impl; class option_impl; class configuration_option_impl; -class ipv4_option_impl; +class ipv3_option_impl; class ipv6_option_impl; class load_balancing_option_impl; class protection_option_impl; @@ -45,8 +45,8 @@ class selective_option_impl; class message_impl : public vsomeip_v3::message, public vsomeip_v3::message_base_impl { public: - typedef std::vector<std::shared_ptr<entry_impl>> entries_t; - typedef std::vector<std::shared_ptr<option_impl>> options_t; + using entries_t = std::vector<std::shared_ptr<entry_impl>>; + using options_t = std::vector<std::shared_ptr<option_impl>>; struct forced_initial_events_t { std::shared_ptr<vsomeip_v3::endpoint_definition> target_; vsomeip_v3::service_t service_; @@ -104,6 +104,8 @@ public: uid_t get_uid() const; gid_t get_gid() const; + vsomeip_sec_client_t get_sec_client() const; + std::string get_env() const; private: entry_impl * deserialize_entry(vsomeip_v3::deserializer *_from); diff --git a/implementation/service_discovery/include/option_impl.hpp b/implementation/service_discovery/include/option_impl.hpp index e171c74..3c898b6 100644 --- a/implementation/service_discovery/include/option_impl.hpp +++ b/implementation/service_discovery/include/option_impl.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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,8 +26,7 @@ public: option_impl(); virtual ~option_impl(); - virtual bool operator ==(const option_impl &_other) const; - bool equals(const std::shared_ptr<option_impl> &_other) const; + virtual bool equals(const option_impl &_other) const; uint16_t get_length() const; option_type_e get_type() const; diff --git a/implementation/service_discovery/include/primitive_types.hpp b/implementation/service_discovery/include/primitive_types.hpp index fd093e9..cf152c8 100644 --- a/implementation/service_discovery/include/primitive_types.hpp +++ b/implementation/service_discovery/include/primitive_types.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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,15 +12,15 @@ namespace vsomeip_v3 { namespace sd { // Load balancing -typedef uint16_t priority_t; -typedef uint16_t weight_t; +using priority_t = std::uint16_t; +using weight_t = std::uint16_t; // Protection -typedef uint32_t alive_counter_t; -typedef uint32_t crc_t; +using alive_counter_t = std::uint32_t; +using crc_t = std::uint32_t; // -typedef uint8_t flags_t; +using flags_t = std::uint8_t; } // namespace sd } // namespace vsomeip_v3 diff --git a/implementation/service_discovery/include/protection_option_impl.hpp b/implementation/service_discovery/include/protection_option_impl.hpp index 792d7cc..7e34eb5 100755..100644 --- 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-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 @@ public: protection_option_impl(); virtual ~protection_option_impl(); - bool operator ==(const option_impl &_other) const; + bool equals(const option_impl &_other) const; alive_counter_t get_alive_counter() const; void set_alive_counter(alive_counter_t _counter); diff --git a/implementation/service_discovery/include/remote_subscription_ack.hpp b/implementation/service_discovery/include/remote_subscription_ack.hpp index 1bc8792..7b2b635 100644 --- a/implementation/service_discovery/include/remote_subscription_ack.hpp +++ b/implementation/service_discovery/include/remote_subscription_ack.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 0e6e2ec..4d4dba0 100644 --- a/implementation/service_discovery/include/request.hpp +++ b/implementation/service_discovery/include/request.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 0772de4..fe9f27b 100644 --- a/implementation/service_discovery/include/runtime.hpp +++ b/implementation/service_discovery/include/runtime.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 0010de6..1b5bfa4 100644 --- a/implementation/service_discovery/include/runtime_impl.hpp +++ b/implementation/service_discovery/include/runtime_impl.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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/selective_option_impl.hpp b/implementation/service_discovery/include/selective_option_impl.hpp index 863408f..b4d7bcb 100644 --- a/implementation/service_discovery/include/selective_option_impl.hpp +++ b/implementation/service_discovery/include/selective_option_impl.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2018-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 @@ public: selective_option_impl(); virtual ~selective_option_impl(); - bool operator==(const option_impl &_other) const; + bool equals(const option_impl &_other) const; std::set<client_t> get_clients() const; void set_clients(const std::set<client_t> &_clients); diff --git a/implementation/service_discovery/include/service_discovery.hpp b/implementation/service_discovery/include/service_discovery.hpp index 77b4258..cab33a8 100644 --- a/implementation/service_discovery/include/service_discovery.hpp +++ b/implementation/service_discovery/include/service_discovery.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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,6 @@ #ifndef VSOMEIP_V3_SD_SERVICE_DISCOVERY_HPP_ #define VSOMEIP_V3_SD_SERVICE_DISCOVERY_HPP_ -#include <boost/asio/io_service.hpp> #include <boost/asio/ip/address.hpp> #include <vsomeip/primitive_types.hpp> @@ -28,7 +27,7 @@ public: virtual ~service_discovery() { } - virtual boost::asio::io_service & get_io() = 0; + virtual boost::asio::io_context &get_io() = 0; virtual void init() = 0; virtual void start() = 0; @@ -51,14 +50,15 @@ public: virtual void on_message(const byte_t *_data, length_t _length, const boost::asio::ip::address &_sender, - const boost::asio::ip::address &_destination) = 0; + bool _is_multicast) = 0; virtual void on_endpoint_connected( service_t _service, instance_t _instance, const std::shared_ptr<endpoint> &_endpoint) = 0; virtual void offer_service(const std::shared_ptr<serviceinfo> &_info) = 0; - virtual void stop_offer_service(const std::shared_ptr<serviceinfo> &_info) = 0; + virtual bool stop_offer_service(const std::shared_ptr<serviceinfo> &_info, bool _send) = 0; + virtual bool send_collected_stop_offers(const std::vector<std::shared_ptr<serviceinfo>> &_infos) = 0; virtual void set_diagnosis_mode(const bool _activate) = 0; @@ -68,9 +68,9 @@ public: const std::shared_ptr<remote_subscription> &_subscription) = 0; virtual void register_sd_acceptance_handler( - sd_acceptance_handler_t _handler) = 0; + const sd_acceptance_handler_t &_handler) = 0; virtual void register_reboot_notification_handler( - reboot_notification_handler_t _handler) = 0; + const reboot_notification_handler_t &_handler) = 0; }; } // namespace sd diff --git a/implementation/service_discovery/include/service_discovery_host.hpp b/implementation/service_discovery/include/service_discovery_host.hpp index 0f992d7..09b5301 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-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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,7 +11,12 @@ #include <chrono> #include <boost/asio/ip/address.hpp> -#include <boost/asio/io_service.hpp> +#if VSOMEIP_BOOST_VERSION < 106600 +# include <boost/asio/io_service.hpp> +# define io_context io_service +#else +# include <boost/asio/io_context.hpp> +#endif #include "../../routing/include/function_types.hpp" #include "../../routing/include/types.hpp" @@ -31,7 +36,7 @@ public: virtual ~service_discovery_host() { } - virtual boost::asio::io_service & get_io() = 0; + virtual boost::asio::io_context &get_io() = 0; virtual std::shared_ptr<endpoint> create_service_discovery_endpoint( const std::string &_address, uint16_t _port, bool _reliable) = 0; @@ -40,7 +45,8 @@ public: virtual std::shared_ptr<eventgroupinfo> find_eventgroup(service_t _service, instance_t _instance, eventgroup_t _eventgroup) const = 0; - virtual bool send(client_t _client, std::shared_ptr<message> _message) = 0; + virtual bool send(client_t _client, std::shared_ptr<message> _message, + bool _force) = 0; virtual bool send_via_sd(const std::shared_ptr<endpoint_definition> &_target, const byte_t *_data, uint32_t _size, uint16_t _sd_port) = 0; @@ -86,7 +92,7 @@ public: virtual void on_subscribe_nack(client_t _client, service_t _service, instance_t _instance, eventgroup_t _eventgroup, - event_t _event, remote_subscription_id_t _subscription_id, bool _simulated) = 0; + event_t _event, remote_subscription_id_t _subscription_id) = 0; virtual std::chrono::steady_clock::time_point expire_subscriptions(bool _force) = 0; diff --git a/implementation/service_discovery/include/service_discovery_impl.hpp b/implementation/service_discovery/include/service_discovery_impl.hpp index c4e3835..b2270e1 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-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -44,11 +44,7 @@ class serviceentry_impl; class service_discovery_host; class subscription; -typedef std::map<service_t, - std::map<instance_t, - std::shared_ptr<request> - > - > requests_t; +using requests_t = std::map<service_t, std::map<instance_t, std::shared_ptr<request>>>; struct entry_data_t { std::shared_ptr<entry_impl> entry_; @@ -63,7 +59,7 @@ public: const std::shared_ptr<configuration>& _configuration); virtual ~service_discovery_impl(); - boost::asio::io_service & get_io(); + boost::asio::io_context &get_io(); void init(); void start(); @@ -86,14 +82,15 @@ public: void on_message(const byte_t *_data, length_t _length, const boost::asio::ip::address &_sender, - const boost::asio::ip::address &_destination); + bool _is_multicast); void on_endpoint_connected( service_t _service, instance_t _instance, const std::shared_ptr<endpoint> &_endpoint); void offer_service(const std::shared_ptr<serviceinfo> &_info); - void stop_offer_service(const std::shared_ptr<serviceinfo> &_info); + bool stop_offer_service(const std::shared_ptr<serviceinfo> &_info, bool _send); + bool send_collected_stop_offers(const std::vector<std::shared_ptr<serviceinfo>> &_infos); void set_diagnosis_mode(const bool _activate); @@ -103,16 +100,19 @@ public: void update_remote_subscription( const std::shared_ptr<remote_subscription> &_subscription); - void register_sd_acceptance_handler(sd_acceptance_handler_t _handler); + void register_sd_acceptance_handler(const sd_acceptance_handler_t &_handler); void register_reboot_notification_handler( - reboot_notification_handler_t _handler); + const reboot_notification_handler_t &_handler); private: std::pair<session_t, bool> get_session(const boost::asio::ip::address &_address); void increment_session(const boost::asio::ip::address &_address); bool is_reboot(const boost::asio::ip::address &_sender, - const boost::asio::ip::address &_destination, - bool _reboot_flag, session_t _session); + bool _is_multicast, bool _reboot_flag, session_t _session); + + bool check_session_id_sequence(const boost::asio::ip::address &_sender, + const bool _is_multicast, const session_t &_session, + session_t &_missing_session); void insert_find_entries(std::vector<std::shared_ptr<message_impl> > &_messages, const requests_t &_requests); @@ -120,12 +120,6 @@ private: const services_t &_services, bool _ignore_phase); void insert_offer_service(std::vector<std::shared_ptr<message_impl> > &_messages, const std::shared_ptr<const serviceinfo> &_info); - enum remote_offer_type_e : std::uint8_t { - RELIABLE_UNRELIABLE, - RELIABLE, - UNRELIABLE, - UNKNOWN = 0xff - }; entry_data_t create_eventgroup_entry( service_t _service, instance_t _instance, eventgroup_t _eventgroup, @@ -138,7 +132,7 @@ private: const std::shared_ptr<endpoint_definition> &_target, const std::set<client_t> &_clients); - typedef std::set<std::pair<bool, std::uint16_t>> expired_ports_t; + using expired_ports_t = std::set<std::pair<bool, std::uint16_t>>; struct sd_acceptance_state_t { explicit sd_acceptance_state_t(expired_ports_t& _expired_ports) : expired_ports_(_expired_ports), @@ -178,7 +172,7 @@ private: const std::vector<std::shared_ptr<option_impl> > &_options, std::shared_ptr<remote_subscription_ack> &_acknowledgement, const boost::asio::ip::address &_sender, - const boost::asio::ip::address &_destination, + bool _is_multicast, bool _is_stop_subscribe_subscribe, bool _force_initial_events, const sd_acceptance_state_t& _sd_ac_state); void handle_eventgroup_subscription(service_t _service, @@ -215,7 +209,7 @@ private: instance_t _instance, const std::shared_ptr<endpoint_definition>& its_endpoint); - void start_ttl_timer(); + void start_ttl_timer(int _shift = 0); void stop_ttl_timer(); void check_ttl(const boost::system::error_code &_error); @@ -310,13 +304,13 @@ private: void on_last_msg_received_timer_expired(const boost::system::error_code &_error); void stop_last_msg_received_timer(); - remote_offer_type_e get_remote_offer_type( + reliability_type_e get_remote_offer_type( service_t _service, instance_t _instance) const; - remote_offer_type_e get_remote_offer_type( + reliability_type_e get_remote_offer_type( const std::shared_ptr<subscription> &_subscription) const; bool update_remote_offer_type(service_t _service, instance_t _instance, - remote_offer_type_e _offer_type, + reliability_type_e _offer_type, const boost::asio::ip::address &_reliable_address, std::uint16_t _reliable_port, const boost::asio::ip::address &_unreliable_address, @@ -362,7 +356,7 @@ private: const std::shared_ptr<subscription>& _subscription); private: - boost::asio::io_service &io_; + boost::asio::io_context &io_; service_discovery_host *host_; std::shared_ptr<configuration> configuration_; @@ -463,7 +457,7 @@ private: std::chrono::milliseconds last_msg_received_timer_timeout_; mutable std::mutex remote_offer_types_mutex_; - std::map<std::pair<service_t, instance_t>, remote_offer_type_e> remote_offer_types_; + std::map<std::pair<service_t, instance_t>, reliability_type_e> remote_offer_types_; std::map<boost::asio::ip::address, std::map<std::pair<bool, std::uint16_t>, std::set<std::pair<service_t, instance_t>>>> remote_offers_by_ip_; @@ -479,4 +473,3 @@ private: } // namespace vsomeip_v3 #endif // VSOMEIP_V3_SD_SERVICE_DISCOVERY_IMPL_ - diff --git a/implementation/service_discovery/include/serviceentry_impl.hpp b/implementation/service_discovery/include/serviceentry_impl.hpp index f7b2b92..8e1cf70 100644 --- a/implementation/service_discovery/include/serviceentry_impl.hpp +++ b/implementation/service_discovery/include/serviceentry_impl.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.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 adbd66c..8c1e074 100644 --- a/implementation/service_discovery/include/subscription.hpp +++ b/implementation/service_discovery/include/subscription.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2018 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +// Copyright (C) 2014-2021 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. |