blob: 5d8350adb9eb694d72b59e570fd0707dbc23f29c (
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
|
// Copyright (C) 2014-2015 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_ENDPOINT_IMPL_HPP
#define VSOMEIP_ENDPOINT_IMPL_HPP
#include <map>
#include <memory>
#include <boost/asio/io_service.hpp>
#include <boost/asio/system_timer.hpp>
#include "buffer.hpp"
#include "endpoint.hpp"
namespace vsomeip {
class endpoint_host;
template<int MaxBufferSize>
class endpoint_impl: public endpoint {
public:
endpoint_impl(std::shared_ptr<endpoint_host> _adapter,
boost::asio::io_service &_io,
std::uint32_t _max_message_size);
virtual ~endpoint_impl();
void enable_magic_cookies();
// Dummy implementations as we only need these for UDP (servers)
// TODO: redesign
void join(const std::string &);
void leave(const std::string &);
void add_multicast(service_t, event_t, const std::string &, uint16_t);
void remove_multicast(service_t, event_t);
// Dummy implementation as we only need this for IP client endpoints
// TODO: redesign
bool get_remote_address(boost::asio::ip::address &_address) const;
// Dummy implementations as we only need these for server endpoints
// TODO: redesign
unsigned short get_local_port() const;
unsigned short get_remote_port() const;
bool is_reliable() const;
void increment_use_count();
void decrement_use_count();
uint32_t get_use_count();
public:
// required
virtual bool is_client() const = 0;
virtual void receive() = 0;
virtual void restart() = 0;
protected:
virtual bool is_magic_cookie() const;
uint32_t find_magic_cookie(byte_t *_buffer, size_t _size);
protected:
// Reference to service context
boost::asio::io_service &service_;
// Reference to host
std::weak_ptr<endpoint_host> host_;
bool is_supporting_magic_cookies_;
bool has_enabled_magic_cookies_;
// Filter configuration
std::map<service_t, uint8_t> opened_;
std::uint32_t max_message_size_;
uint32_t use_count_;
};
} // namespace vsomeip
#endif // VSOMEIP_ENDPOINT_IMPL_HPP
|