Vanetza
 
Loading...
Searching...
No Matches
traffic_class.hpp
1#ifndef TRAFFIC_CLASS_HPP_I2WYKREX
2#define TRAFFIC_CLASS_HPP_I2WYKREX
3
4#include <vanetza/common/bit_number.hpp>
5#include <vanetza/dcc/profile.hpp>
6#include <vanetza/geonet/serialization.hpp>
7#include <cstdint>
8
9namespace vanetza
10{
11
12namespace geonet
13{
14
16{
17public:
19 TrafficClass(bool scf, bool channel_offload, BitNumber<unsigned, 6> tc_id);
20 explicit TrafficClass(uint8_t raw);
21
22 bool store_carry_forward() const;
23 void store_carry_forward(bool flag);
24 bool channel_offload() const;
25 void channel_offload(bool flag);
26 BitNumber<unsigned, 6> tc_id() const;
27 void tc_id(BitNumber<unsigned, 6> id);
28 uint8_t raw() const { return m_tc; }
29
30private:
31 static constexpr uint8_t scf_mask = 0x80;
32 static constexpr uint8_t channel_offload_mask = 0x40;
33 static constexpr uint8_t tc_id_mask = 0x3f;
34 uint8_t m_tc;
35};
36
37dcc::Profile map_tc_onto_profile(const TrafficClass&);
38
39void serialize(const TrafficClass&, OutputArchive&);
40void deserialize(TrafficClass&, InputArchive&);
41
42} // namespace geonet
43} // namespace vanetza
44
45#endif /* TRAFFIC_CLASS_HPP_I2WYKREX */
46