libtins
4.5
Toggle main menu visibility
Loading...
Searching...
No Matches
include
tins
vxlan.h
1
#ifndef TINS_VXLAN_H
2
#define TINS_VXLAN_H
3
4
#include <tins/pdu.h>
5
#include <tins/small_uint.h>
6
7
namespace
Tins
{
8
17
class
TINS_API
VXLAN
:
public
PDU
{
18
public
:
22
static
const
PDU::PDUType
pdu_flag
= PDU::VXLAN;
23
29
VXLAN
(
const
small_uint<24>
vni = 0);
30
38
VXLAN
(
const
uint8_t* buffer, uint32_t total_sz);
39
43
uint8_t
get_flags
()
const
{
return
Endian::be_to_host(header_.flags) >> 24; }
44
48
small_uint<24>
get_vni
()
const
{
return
Endian::be_to_host(header_.vni) >> 8; }
49
54
void
set_flags
(uint8_t new_flags) { header_.flags = Endian::host_to_be(new_flags << 24); }
55
60
void
set_vni
(
small_uint<24>
new_vni) { header_.vni = Endian::host_to_be(new_vni << 8); }
61
71
uint32_t
header_size
()
const
{
return
sizeof
(header_); }
72
77
PDUType
pdu_type
()
const
{
return
pdu_flag
; }
78
82
VXLAN
*
clone
()
const
{
return
new
VXLAN
(*
this
); }
83
84
private
:
85
TINS_BEGIN_PACK
86
struct
vxlan_header {
87
uint32_t flags;
88
uint32_t vni;
89
} TINS_END_PACK;
90
91
void
write_serialization(uint8_t* buffer, uint32_t total_sz);
92
93
vxlan_header header_;
94
};
95
96
}
// Tins
97
98
#endif
// TINS_VXLAN_H
Tins::PDU::PDU
PDU()
Default constructor.
Definition
pdu.cpp:50
Tins::PDU::PDUType
PDUType
Enum which identifies each type of PDU.
Definition
pdu.h:127
Tins::VXLAN::get_vni
small_uint< 24 > get_vni() const
Getter for the VNI.
Definition
vxlan.h:48
Tins::VXLAN::set_flags
void set_flags(uint8_t new_flags)
Setter for the flags.
Definition
vxlan.h:54
Tins::VXLAN::clone
VXLAN * clone() const
Definition
vxlan.h:82
Tins::VXLAN::pdu_flag
static const PDU::PDUType pdu_flag
This PDU's flag.
Definition
vxlan.h:22
Tins::VXLAN::header_size
uint32_t header_size() const
Returns the VXLAN frame's header length.
Definition
vxlan.h:71
Tins::VXLAN::pdu_type
PDUType pdu_type() const
Getter for the PDU's type.
Definition
vxlan.h:77
Tins::VXLAN::set_vni
void set_vni(small_uint< 24 > new_vni)
Setter for the VNI.
Definition
vxlan.h:60
Tins::VXLAN::get_flags
uint8_t get_flags() const
Getter for the flags.
Definition
vxlan.h:43
Tins::VXLAN::VXLAN
VXLAN(const small_uint< 24 > vni=0)
Constructs a VXLAN PDU.
Definition
vxlan.cpp:11
Tins::small_uint
Represents a field of n bits.
Definition
small_uint.h:52
Tins
The Tins namespace.
Definition
address_range.h:38
Generated on
for libtins by
1.17.0