pub enum IpRepr {
Unspecified {
src_addr: Address,
dst_addr: Address,
protocol: Protocol,
payload_len: usize,
hop_limit: u8,
},
Ipv4(Ipv4Repr),
Ipv6(Ipv6Repr),
// some variants omitted
}
Expand description
An IP packet representation.
This enum abstracts the various versions of IP packets. It either contains a concrete
high-level representation for some IP protocol version, or an unspecified representation,
which permits the IpAddress::Unspecified
addresses.
Variants§
Implementations§
source§impl Repr
impl Repr
sourcepub fn payload_len(&self) -> usize
pub fn payload_len(&self) -> usize
Return the payload length.
sourcepub fn set_payload_len(&mut self, length: usize)
pub fn set_payload_len(&mut self, length: usize)
Set the payload length.
sourcepub fn lower(&self, fallback_src_addrs: &[Cidr]) -> Result<Repr>
pub fn lower(&self, fallback_src_addrs: &[Cidr]) -> Result<Repr>
Convert an unspecified representation into a concrete one, or return
Err(Error::Unaddressable)
if not possible.
Panics
This function panics if source and destination addresses belong to different families, or the destination address is unspecified, since this indicates a logic error.
sourcepub fn buffer_len(&self) -> usize
pub fn buffer_len(&self) -> usize
Return the length of a header that will be emitted from this high-level representation.
Panics
This function panics if invoked on an unspecified representation.