pub enum IpHeadersSlice<'a> {
Ipv4(Ipv4HeaderSlice<'a>, Ipv4ExtensionsSlice<'a>),
Ipv6(Ipv6HeaderSlice<'a>, Ipv6ExtensionsSlice<'a>),
}Expand description
Slice containing an IPv4 or IPv6 base header plus extension headers.
Variants§
Ipv4(Ipv4HeaderSlice<'a>, Ipv4ExtensionsSlice<'a>)
IPv4 base header and extension headers.
Ipv6(Ipv6HeaderSlice<'a>, Ipv6ExtensionsSlice<'a>)
IPv6 base header and extension headers.
Implementations§
Source§impl<'a> IpHeadersSlice<'a>
impl<'a> IpHeadersSlice<'a>
Sourcepub fn ipv4(&self) -> Option<Ipv4HeaderSlice<'a>>
pub fn ipv4(&self) -> Option<Ipv4HeaderSlice<'a>>
Returns the IPv4 header slice if self contains one.
Sourcepub fn ipv4_exts(&self) -> Option<Ipv4ExtensionsSlice<'a>>
pub fn ipv4_exts(&self) -> Option<Ipv4ExtensionsSlice<'a>>
Returns the IPv4 extension header slices if self contains one.
Sourcepub fn ipv6(&self) -> Option<Ipv6HeaderSlice<'a>>
pub fn ipv6(&self) -> Option<Ipv6HeaderSlice<'a>>
Returns the IPv6 header slice if self contains one.
Sourcepub fn ipv6_exts(&self) -> Option<&Ipv6ExtensionsSlice<'a>>
pub fn ipv6_exts(&self) -> Option<&Ipv6ExtensionsSlice<'a>>
Returns the IPv6 extension header slices if self contains one.
Sourcepub fn source_addr(&self) -> IpAddr
pub fn source_addr(&self) -> IpAddr
Returns the source IP address.
Sourcepub fn destination_addr(&self) -> IpAddr
pub fn destination_addr(&self) -> IpAddr
Returns the destination IP address.
Sourcepub fn next_header(&self) -> IpNumber
pub fn next_header(&self) -> IpNumber
Returns the protocol number stored in the base header.
For IPv4 this is the protocol field and for IPv6 this is
the next_header field.
Sourcepub fn payload_ip_number(&self) -> IpNumber
pub fn payload_ip_number(&self) -> IpNumber
Returns the payload IP number after extension headers.
Sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Returns the serialized header length in bytes, including extensions.
Sourcepub fn try_to_header(&self) -> Result<IpHeaders, HeaderSliceError>
pub fn try_to_header(&self) -> Result<IpHeaders, HeaderSliceError>
Converts this sliced header representation into IpHeaders.
For IPv6 this conversion uses Ipv6Extensions::from_slice.
Note that Ipv6Extensions can only represent a subset of valid IPv6
extension chains. If more extension headers are present than can be
represented, only the representable subset is converted.
Trait Implementations§
Source§impl<'a> Clone for IpHeadersSlice<'a>
impl<'a> Clone for IpHeadersSlice<'a>
Source§fn clone(&self) -> IpHeadersSlice<'a>
fn clone(&self) -> IpHeadersSlice<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more