summaryrefslogtreecommitdiff
path: root/implementation/tracing/include/header.hpp
blob: e3dc4c1a1cf35ca1c4f142e29c3bdda331681898 (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
// Copyright (C) 2016-2017 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_TRACE_HEADER_HPP_
#define VSOMEIP_V3_TRACE_HEADER_HPP_

#include <memory>

#include <vsomeip/primitive_types.hpp>

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

#define VSOMEIP_TRACE_HEADER_SIZE 10

namespace vsomeip_v3 {

class endpoint;

namespace trace {

enum class protocol_e : uint8_t {
    local = 0x0,
    udp = 0x1,
    tcp = 0x2,
    unknown = 0xFF
};

struct header {
    bool prepare(const std::shared_ptr<endpoint> &_endpoint, bool _is_sending,
            instance_t _instance);
    bool prepare(const endpoint* _endpoint, bool _is_sending,
            instance_t _instance);
    void prepare(const boost::asio::ip::address_v4 &_address,
                 std::uint16_t _port, protocol_e _protocol, bool _is_sending,
                 instance_t _instance);

    byte_t data_[VSOMEIP_TRACE_HEADER_SIZE];
};

} // namespace trace
} // namespace vsomeip_v3

#endif // VSOMEIP_V3_TRACE_HEADER_HPP_