1 // Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 2 // This Source Code Form is subject to the terms of the Mozilla Public 3 // License, v. 2.0. If a copy of the MPL was not distributed with this 4 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 6 #ifndef VSOMEIP_V3_ROUTING_MANAGER_ 7 #define VSOMEIP_V3_ROUTING_MANAGER_ 8 9 #include <memory> 10 #include <set> 11 #include <vector> 12 13 #include <boost/asio/io_service.hpp> 14 15 #include <vsomeip/function_types.hpp> 16 #include <vsomeip/message.hpp> 17 #include <vsomeip/handler.hpp> 18 #include "types.hpp" 19 20 namespace vsomeip_v3 { 21 22 class endpoint; 23 class endpoint_definition; 24 class event; 25 class payload; 26 class security; 27 28 class routing_manager { 29 public: ~routing_manager()30 virtual ~routing_manager() { 31 } 32 33 virtual boost::asio::io_service & get_io() = 0; 34 virtual client_t get_client() const = 0; 35 virtual void set_client(const client_t &_client) = 0; 36 virtual session_t get_session() = 0; 37 38 virtual void init() = 0; 39 virtual void start() = 0; 40 virtual void stop() = 0; 41 42 virtual bool offer_service(client_t _client, service_t _service, 43 instance_t _instance, major_version_t _major, 44 minor_version_t _minor) = 0; 45 46 virtual void stop_offer_service(client_t _client, service_t _service, 47 instance_t _instance, major_version_t _major, 48 minor_version_t _minor) = 0; 49 50 virtual void request_service(client_t _client, service_t _service, 51 instance_t _instance, major_version_t _major, 52 minor_version_t _minor) = 0; 53 54 virtual void release_service(client_t _client, service_t _service, 55 instance_t _instance) = 0; 56 57 virtual void subscribe(client_t _client, uid_t _uid, gid_t _gid, service_t _service, 58 instance_t _instance, eventgroup_t _eventgroup, 59 major_version_t _major, event_t _event) = 0; 60 61 virtual void unsubscribe(client_t _client, uid_t _uid, gid_t _gid, service_t _service, 62 instance_t _instance, eventgroup_t _eventgroup, event_t _event) = 0; 63 64 virtual bool send(client_t _client, std::shared_ptr<message> _message) = 0; 65 66 virtual bool send(client_t _client, const byte_t *_data, uint32_t _size, 67 instance_t _instance, bool _reliable, 68 client_t _bound_client = VSOMEIP_ROUTING_CLIENT, 69 credentials_t _credentials = {ANY_UID, ANY_GID}, 70 uint8_t _status_check = 0, bool _sent_from_remote = false) = 0; 71 72 virtual bool send_to(const client_t _client, 73 const std::shared_ptr<endpoint_definition> &_target, 74 std::shared_ptr<message>) = 0; 75 76 virtual bool send_to(const std::shared_ptr<endpoint_definition> &_target, 77 const byte_t *_data, uint32_t _size, instance_t _instance) = 0; 78 79 virtual void register_event(client_t _client, 80 service_t _service, instance_t _instance, 81 event_t _notifier, 82 const std::set<eventgroup_t> &_eventgroups, 83 const event_type_e _type, 84 reliability_type_e _reliability, 85 std::chrono::milliseconds _cycle, bool _change_resets_cycle, 86 bool _update_on_change, 87 epsilon_change_func_t _epsilon_change_func, 88 bool _is_provided, bool _is_shadow = false, 89 bool _is_cache_placeholder = false) = 0; 90 91 virtual void unregister_event(client_t _client, service_t _service, 92 instance_t _instance, event_t _event, bool _is_provided) = 0; 93 94 virtual std::shared_ptr<event> find_event(service_t _service, 95 instance_t _instance, event_t _event) const = 0; 96 97 virtual std::set<std::shared_ptr<event>> find_events(service_t _service, 98 instance_t _instance, eventgroup_t _eventgroup) const = 0; 99 100 virtual void notify(service_t _service, instance_t _instance, 101 event_t _event, std::shared_ptr<payload> _payload, 102 bool _force) = 0; 103 104 virtual void notify_one(service_t _service, instance_t _instance, 105 event_t _event, std::shared_ptr<payload> _payload, 106 client_t _client, bool _force 107 #ifdef VSOMEIP_ENABLE_COMPAT 108 , bool _remote_subscriber 109 #endif 110 ) = 0; 111 112 virtual void set_routing_state(routing_state_e _routing_state) = 0; 113 114 virtual void send_get_offered_services_info(client_t _client, offer_type_e _offer_type) = 0; 115 }; 116 117 } // namespace vsomeip_v3 118 119 #endif // VSOMEIP_V3_ROUTING_MANAGER_ 120