summaryrefslogtreecommitdiff
path: root/implementation/routing/include/routing_manager.hpp
blob: 6fa76937518eefacf7d9b72cc11007efcf8ad627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// 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_ROUTING_MANAGER_
#define VSOMEIP_V3_ROUTING_MANAGER_

#include <memory>
#include <set>
#include <vector>

#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 <vsomeip/function_types.hpp>
#include <vsomeip/structured_types.hpp>
#include <vsomeip/message.hpp>
#include <vsomeip/handler.hpp>
#include <vsomeip/vsomeip_sec.h>

#include "types.hpp"

namespace vsomeip_v3 {

class endpoint;
class endpoint_definition;
class event;
class payload;
class security;

class routing_manager {
public:
    virtual ~routing_manager() {
    }

    virtual boost::asio::io_context &get_io() = 0;
    virtual client_t get_client() const = 0;
//    virtual void set_client(const client_t &_client) = 0;
    virtual session_t get_session(bool _is_request) = 0;

    virtual const vsomeip_sec_client_t *get_sec_client() const = 0;

    virtual void init() = 0;
    virtual void start() = 0;
    virtual void stop() = 0;

    virtual bool offer_service(client_t _client, service_t _service,
            instance_t _instance, major_version_t _major,
            minor_version_t _minor) = 0;

    virtual void stop_offer_service(client_t _client, service_t _service,
            instance_t _instance, major_version_t _major,
            minor_version_t _minor) = 0;

    virtual void request_service(client_t _client, service_t _service,
            instance_t _instance, major_version_t _major,
            minor_version_t _minor) = 0;

    virtual void release_service(client_t _client, service_t _service,
            instance_t _instance) = 0;

    virtual void subscribe(client_t _client, const vsomeip_sec_client_t *_sec_client,
            service_t _service, instance_t _instance,
            eventgroup_t _eventgroup, major_version_t _major,
            event_t _event, const std::shared_ptr<debounce_filter_t> &_filter) = 0;

    virtual void unsubscribe(client_t _client, const vsomeip_sec_client_t *_sec_client,
            service_t _service, instance_t _instance,
            eventgroup_t _eventgroup, event_t _event) = 0;

    virtual bool send(client_t _client, std::shared_ptr<message> _message,
            bool _force) = 0;

    virtual bool send(client_t _client, const byte_t *_data, uint32_t _size,
            instance_t _instance, bool _reliable,
            client_t _bound_client = VSOMEIP_ROUTING_CLIENT,
            const vsomeip_sec_client_t *_sec_client = nullptr,
            uint8_t _status_check = 0,
            bool _sent_from_remote = false,
            bool _force = true) = 0;

    virtual bool send_to(const client_t _client,
            const std::shared_ptr<endpoint_definition> &_target,
            std::shared_ptr<message> _message) = 0;

    virtual bool send_to(const std::shared_ptr<endpoint_definition> &_target,
            const byte_t *_data, uint32_t _size, instance_t _instance) = 0;

    virtual void register_event(client_t _client,
            service_t _service, instance_t _instance,
            event_t _notifier,
            const std::set<eventgroup_t> &_eventgroups,
            const event_type_e _type,
            reliability_type_e _reliability,
            std::chrono::milliseconds _cycle, bool _change_resets_cycle,
            bool _update_on_change,
            epsilon_change_func_t _epsilon_change_func,
            bool _is_provided, bool _is_shadow = false,
            bool _is_cache_placeholder = false) = 0;

    virtual void unregister_event(client_t _client, service_t _service,
            instance_t _instance, event_t _event, bool _is_provided) = 0;

    virtual std::shared_ptr<event> find_event(service_t _service,
            instance_t _instance, event_t _event) const = 0;

    virtual std::set<std::shared_ptr<event>> find_events(service_t _service,
            instance_t _instance, eventgroup_t _eventgroup) const = 0;

    virtual void notify(service_t _service, instance_t _instance,
            event_t _event, std::shared_ptr<payload> _payload,
            bool _force) = 0;

    virtual void notify_one(service_t _service, instance_t _instance,
            event_t _event, std::shared_ptr<payload> _payload,
            client_t _client, bool _force
#ifdef VSOMEIP_ENABLE_COMPAT
            , bool _remote_subscriber
#endif
            ) = 0;

    virtual void set_routing_state(routing_state_e _routing_state) = 0;

    virtual void send_get_offered_services_info(client_t _client, offer_type_e _offer_type) = 0;
};

}  // namespace vsomeip_v3

#endif // VSOMEIP_V3_ROUTING_MANAGER_