#[repr(C, packed(1))]pub struct GeneveHdr {
pub ver_opt_len: u8,
pub o_c_rsvd: u8,
pub protocol_type: [u8; 2],
pub vni: [u8; 3],
pub reserved2: u8,
}Expand description
Represents a Geneve (Generic Network Virtualization Encapsulation) header, according to RFC 8926. Geneve is an encapsulation protocol designed for network virtualization.
Fields§
§ver_opt_len: u8Combined field: Version (2 bits) and Option Length (6 bits).
o_c_rsvd: u8Combined field: OAM flag (1 bit), Critical flag (1 bit), Reserved (6 bits).
protocol_type: [u8; 2]Protocol Type of the encapsulated payload (16 bits).
vni: [u8; 3]Virtual Network Identifier (VNI) (24 bits).
reserved2: u8Reserved field (8 bits). MUST be zero on transmission.
Implementations§
Source§impl GeneveHdr
impl GeneveHdr
Sourcepub fn ver(&self) -> u8
pub fn ver(&self) -> u8
Returns the Geneve protocol version (2 bits).
According to RFC 8926, the current version is 0.
Sourcepub fn set_ver(&mut self, ver: u8)
pub fn set_ver(&mut self, ver: u8)
Sets the Geneve protocol version (2 bits).
ver should be a 2-bit value (0-3).
Sourcepub fn opt_len(&self) -> u8
pub fn opt_len(&self) -> u8
Returns the length of the option fields in 4-byte multiples (6 bits).
Sourcepub fn set_opt_len(&mut self, opt_len: u8)
pub fn set_opt_len(&mut self, opt_len: u8)
Sets the length of the option fields (6 bits).
opt_len should be a 6-bit value (0-63).
Sourcepub fn o_flag(&self) -> u8
pub fn o_flag(&self) -> u8
Returns the OAM (Operations, Administration, and Maintenance) packet flag (1 bit).
If set (1), this packet is an OAM packet. Referred to as ‘O’ bit in RFC 8926.
Sourcepub fn set_o_flag(&mut self, o_flag: u8)
pub fn set_o_flag(&mut self, o_flag: u8)
Sets the OAM packet flag (1 bit).
o_flag should be a 1-bit value (0 or 1).
Sourcepub fn c_flag(&self) -> u8
pub fn c_flag(&self) -> u8
Returns the Critical Options Present flag (1 bit).
If set (1), one or more options are marked as critical. Referred to as ‘C’ bit in RFC 8926.
Sourcepub fn set_c_flag(&mut self, c_flag: u8)
pub fn set_c_flag(&mut self, c_flag: u8)
Sets the Critical Options Present flag (1 bit).
c_flag should be a 1-bit value (0 or 1).
Sourcepub fn protocol_type(&self) -> u16
pub fn protocol_type(&self) -> u16
Returns the Protocol Type of the encapsulated payload (16 bits, network byte order).
This follows the Ethertype convention.
Sourcepub fn set_protocol_type(&mut self, protocol_type: u16)
pub fn set_protocol_type(&mut self, protocol_type: u16)
Sets the Protocol Type (16 bits).
The value is stored in network byte order.