pub struct Ipv6Packet<'a> { /* private fields */ }Expand description
A structurally validated immutable IPv6 base-header view.
Parsing implements the fixed header from RFC 8200 section 3. It does not traverse extension headers. A nonzero Payload Length bounds the view exactly; a zero field retains every supplied trailing byte as an unresolved tail; zero with no trailing bytes is an ordinary empty payload.
Implementations§
Source§impl<'a> Ipv6Packet<'a>
impl<'a> Ipv6Packet<'a>
Sourcepub fn icmpv6(&self) -> Result<Option<Icmpv6Message<'a>>, Ipv6DispatchError>
pub fn icmpv6(&self) -> Result<Option<Icmpv6Message<'a>>, Ipv6DispatchError>
Parses ICMPv6 after traversing supported IPv6 extension headers.
Sourcepub fn udp(&self) -> Result<Option<UdpDatagram<'a>>, Ipv6DispatchError>
pub fn udp(&self) -> Result<Option<UdpDatagram<'a>>, Ipv6DispatchError>
Parses UDP after traversing supported IPv6 extension headers.
Sourcepub fn tcp(&self) -> Result<Option<TcpSegment<'a>>, Ipv6DispatchError>
pub fn tcp(&self) -> Result<Option<TcpSegment<'a>>, Ipv6DispatchError>
Parses TCP after traversing supported IPv6 extension headers.
Source§impl<'a> Ipv6Packet<'a>
impl<'a> Ipv6Packet<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Self, ParseError>
pub fn parse(bytes: &'a [u8]) -> Result<Self, ParseError>
Validates the fixed header, version, and any nonzero declared payload extent.
Sourcepub fn traffic_class(&self) -> u8
pub fn traffic_class(&self) -> u8
Returns the eight-bit traffic class.
Sourcepub fn flow_label(&self) -> u32
pub fn flow_label(&self) -> u32
Returns the 20-bit flow label.
Sourcepub fn payload_length(&self) -> Ipv6PayloadLength
pub fn payload_length(&self) -> Ipv6PayloadLength
Interprets the base header’s Payload Length field without resolving Jumbo Payload options.
Sourcepub fn raw_payload_length(&self) -> u16
pub fn raw_payload_length(&self) -> u16
Returns the raw 16-bit Payload Length field.
Sourcepub fn next_header(&self) -> Ipv6NextHeader
pub fn next_header(&self) -> Ipv6NextHeader
Returns the Next Header value, preserving unknown values.
Sourcepub fn source(&self) -> Ipv6Address
pub fn source(&self) -> Ipv6Address
Returns the source address.
Sourcepub fn destination(&self) -> Ipv6Address
pub fn destination(&self) -> Ipv6Address
Returns the destination address.
Sourcepub fn payload(&self) -> &'a [u8]
pub fn payload(&self) -> &'a [u8]
Returns bytes after the fixed header.
For a nonzero Payload Length these are exactly the declared payload. For a zero field they are an unresolved nonempty tail that may be lower-layer padding or Jumbo Payload content; an empty tail is an ordinary empty payload.