34 #include <tins/endianness.h> 35 #include <tins/macros.h> 36 #include <tins/small_uint.h> 70 MPLS(
const uint8_t* buffer, uint32_t total_sz);
76 return (Endian::be_to_host(header_.label_high) << 4) |
77 ((header_.label_low_exp_and_bottom >> 4) & 0xf);
84 return (header_.label_low_exp_and_bottom >> 1) & 0x7;
91 return header_.label_low_exp_and_bottom & 0x1;
132 void ttl(uint8_t value);
140 uint32_t header_size()
const;
154 return new MPLS(*
this);
160 uint8_t label_low_exp_and_bottom;
164 void write_serialization(uint8_t* buffer, uint32_t total_sz);
171 #endif // TINS_MPLS_H Represents an MPLS PDU.
Definition: mpls.h:46
PDUType
Enum which identifies each type of PDU.
Definition: pdu.h:127
MPLS * clone() const
Definition: mpls.h:153
Class that represents an ICMP extension object.
Definition: icmp_extension.h:46
small_uint< 20 > label() const
Getter for the label field.
Definition: mpls.h:75
small_uint< 3 > experimental() const
Getter for the experimental field.
Definition: mpls.h:83
Represents a field of n bits.
Definition: small_uint.h:52
The Tins namespace.
Definition: address_range.h:38
uint8_t ttl() const
Getter for the ttl field.
Definition: mpls.h:97
PDUType pdu_type() const
Getter for the PDU's type.
Definition: mpls.h:146
small_uint< 1 > bottom_of_stack() const
Getter for the bottom of the stack field.
Definition: mpls.h:90
Base class for protocol data units.
Definition: pdu.h:107