bmv2
Designing your own switch target with bmv2
|
Public Member Functions | |
int | get_nbytes_packet () const |
bool | is_valid () const |
Returns true if this header is marked valid. More... | |
bool | is_metadata () const |
Returns true if this header represents metadata. More... | |
void | mark_valid () |
Marks the header as valid. More... | |
void | mark_invalid () |
Marks the header as not-valid. More... | |
void | reset () |
Sets all the fields in the header to value 0 . More... | |
void | set_written_to (bool written_to_value) |
Field & | get_field (int field_offset) |
const Field & | get_field (int field_offset) const |
header_type_id_t | get_header_type_id () const |
bool | is_VL_header () const |
size_type | size () const noexcept |
Returns the number of fields in the header. More... | |
iterator | begin () |
NC. More... | |
const_iterator | begin () const |
NC. More... | |
iterator | end () |
NC. More... | |
const_iterator | end () const |
NC. More... | |
reference | operator[] (size_type n) |
const_reference | operator[] (size_type n) const |
const std::string & | get_field_name (int field_offset) const |
Returns a reference to the name of the field at the given offset. More... | |
const std::string | get_field_full_name (int field_offset) const |
![]() | |
const std::string & | get_name () const |
Get the name of the P4 instance. More... | |
p4object_id_t | get_id () const |
Get the compiler-provided id. More... | |
NamedP4Object (const NamedP4Object &other)=delete | |
Deleted copy constructor. More... | |
NamedP4Object & | operator= (const NamedP4Object &other)=delete |
Deleted copy assignment operator. More... | |
NamedP4Object (NamedP4Object &&other)=default | |
Default move constructor. More... | |
NamedP4Object & | operator= (NamedP4Object &&other)=default |
Default assignment operator. More... | |
Used to represent P4 header instances. It includes a vector of Field objects.
|
inline |
NC.
|
inline |
NC.
|
inline |
NC.
|
inline |
NC.
|
inline |
Returns a reference to the Field at the specified offset, with bounds checking. If pos not within the range of the container, an exception of type std::out_of_range is thrown.
|
inline |
Returns a reference to the Field at the specified offset, with bounds checking. If pos not within the range of the container, an exception of type std::out_of_range is thrown.
const std::string bm::Header::get_field_full_name | ( | int | field_offset | ) | const |
Returns the full name of the field at the given offset as a new string. The name is of the form <hdr_name>.<f_name>.
const std::string& bm::Header::get_field_name | ( | int | field_offset | ) | const |
Returns a reference to the name of the field at the given offset.
|
inline |
Returns an integral id which represents the header type of the header. This id can be used to compare whether 2 Header instances have the same header type.
|
inline |
Returns the number of byte occupied by this header when it is deserialized in the packet
|
inline |
Returns true if this header represents metadata.
|
inline |
Returns true if this header is marked valid.
|
inline |
Returns true if this header is an instance of a Variable-Length header type, i.e. contains a field whose length is determined when the header is extracted from the packet data.
void bm::Header::mark_invalid | ( | ) |
Marks the header as not-valid.
void bm::Header::mark_valid | ( | ) |
Marks the header as valid.
|
inline |
Access the character at position n
. Will assert if n
is greater or equal than the number of fields in the header.
|
inline |
Access the character at position n
. Will assert if n
is greater or equal than the number of fields in the header.
void bm::Header::reset | ( | ) |
Sets all the fields in the header to value 0
.
void bm::Header::set_written_to | ( | bool | written_to_value | ) |
Set the written_to flag maintained by each field. This flag can be queried at any time by the target, using the Field interface, and can be used to check whether the field has been modified since written_to was last set to false
.
|
inlinenoexcept |
Returns the number of fields in the header.