summaryrefslogtreecommitdiff
path: root/implementation/endpoints/include/endpoint_definition.hpp
blob: e4a32907fe34292b1bd4fd6bb2bb9c6aa611771e (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
// Copyright (C) 2014-2016 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_DEFINITION_HPP
#define VSOMEIP_ENDPOINT_DEFINITION_HPP

#include <map>
#include <memory>

#include <boost/asio/ip/address.hpp>

#include <vsomeip/export.hpp>

namespace vsomeip {

class endpoint_definition {
public:
    VSOMEIP_EXPORT static std::shared_ptr<endpoint_definition> get(
            const boost::asio::ip::address &_address,
            uint16_t _port, bool _is_reliable);

    VSOMEIP_EXPORT const boost::asio::ip::address &get_address() const;
    VSOMEIP_EXPORT void set_address(const boost::asio::ip::address &_address);

    VSOMEIP_EXPORT uint16_t get_port() const;
    VSOMEIP_EXPORT void set_port(uint16_t _port);

    VSOMEIP_EXPORT uint16_t get_remote_port() const;
    VSOMEIP_EXPORT void set_remote_port(uint16_t _port);

    VSOMEIP_EXPORT bool is_reliable() const;
    VSOMEIP_EXPORT void set_reliable(bool _is_reliable);

    VSOMEIP_EXPORT endpoint_definition(
            const boost::asio::ip::address &_address,
            uint16_t _port, bool _is_reliable);
private:
    boost::asio::ip::address address_;
    uint16_t port_;
    uint16_t remote_port_;
    bool is_reliable_;

    static std::map<boost::asio::ip::address,
        std::map<uint16_t,
            std::map<bool,
                     std::shared_ptr<endpoint_definition> > > > definitions_;
};

} // namespace vsomeip

#endif // VSOMEIP_ENDPOINT_DEFINITION_HPP