Vanetza
 
Loading...
Searching...
No Matches
header.hpp
1#ifndef HEADER_HPP_FNKGEM7C
2#define HEADER_HPP_FNKGEM7C
3
4#include <vanetza/common/byte_order.hpp>
5#include <vanetza/common/serialization.hpp>
6#include <vanetza/net/packet_variant.hpp>
7#include <cstdint>
8
9namespace vanetza
10{
11namespace btp
12{
13
14typedef uint16be_t port_type;
15
16// interactive packet transport
17struct HeaderA
18{
19 static constexpr std::size_t length_bytes = 4;
20
21 port_type destination_port;
22 port_type source_port;
23};
24
25static_assert(sizeof(HeaderA) == HeaderA::length_bytes, "Wrong size");
26
27void serialize(OutputArchive&, const HeaderA&);
28void deserialize(InputArchive&, HeaderA&);
29HeaderA parse_btp_a(ChunkPacket&);
30HeaderA parse_btp_a(CohesivePacket&);
31HeaderA parse_btp_a(PacketVariant&);
32
33// non-interactive packet transport
34struct HeaderB
35{
36 static constexpr std::size_t length_bytes = 4;
37
38 port_type destination_port;
39 uint16be_t destination_port_info;
40};
41
42static_assert(sizeof(HeaderB) == HeaderB::length_bytes, "Wrong size");
43
44void serialize(OutputArchive&, const HeaderB&);
45void deserialize(InputArchive&, HeaderB&);
46HeaderB parse_btp_b(ChunkPacket&);
47HeaderB parse_btp_b(CohesivePacket&);
48HeaderB parse_btp_b(PacketVariant&);
49
50} // namepsace btp
51} // namespace vanetza
52
53#endif /* HEADER_HPP_FNKGEM7C */
ChunckPacket is a packet consisting of several memory chunks.