/// Parse Destination Options Extension Header.
Parse Destination Options Extension Header.
Parse Destination Options Extension Header .
fn parse_destination_options<'a, BV: BufferView<&'a [u8]>>(
            data: &mut BV,
            context: &mut Ipv6ExtensionHeaderParsingContext,
        ) -> Result<Option<Option<Ipv6ExtensionHeader<'a>>>, Ipv6ExtensionHeaderParsingError>
        {
            let (next_header, hdr_ext_len) = Self::get_next_hdr_and_len(data, context)?;
            // As per RFC 8200 section 4.6, Hdr Ext Len is the length of this extension
            // header in  8-octet units, not including the first 8 octets (where 2 of
            // them are the Next Header and the Hdr Ext Len fields).
            let expected_len = (hdr_ext_len as usize) * 8 + 6;
            let options = data
                .take_front(expected_len)
                .ok_or_else(|| Ipv6ExtensionHeaderParsingError::BufferExhausted)?;
            let options = Options::parse(options)
                .map_err(|e| Ipv6ExtensionHeaderParsingError::MalformedData)?;
            // Update context
            context.next_header = next_header;
            context.headers_parsed += 1;
            context.bytes_parsed += 2 + expected_len;
            return Ok(Some(Some(Ipv6ExtensionHeader {
                next_header,
                data: Ipv6ExtensionHeaderData::DestinationOptions { options },
            })));
        }
fn parse_destination_options < ' a , BV : BufferView < & ' a [ u8 ] > > ( data : & mut BV , context : & mut Ipv6ExtensionHeaderParsingContext , ) -> Result < Option < Option < Ipv6ExtensionHeader < ' a > > > , Ipv6ExtensionHeaderParsingError > { let ( next_header , hdr_ext_len ) = Self :: get_next_hdr_and_len ( data , context ) ? ; // As per RFC 8200 section 4.6, Hdr Ext Len is the length of this extension // header in  8-octet units, not including the first 8 octets (where 2 of // them are the Next Header and the Hdr Ext Len fields). let expected_len = ( hdr_ext_len as usize ) * 8 + 6 ; let options = data . take_front ( expected_len ) . ok_or_else ( | | Ipv6ExtensionHeaderParsingError :: BufferExhausted ) ? ; let options = Options :: parse ( options ) . map_err ( | e | Ipv6ExtensionHeaderParsingError :: MalformedData ) ? ; // Update context context . next_header = next_header ; context . headers_parsed += 1 ; context . bytes_parsed += 2 + expected_len ; return Ok ( Some ( Some ( Ipv6ExtensionHeader { next_header , data : Ipv6ExtensionHeaderData :: DestinationOptions { options } , } ) ) ) ; }
Parse Destination Options Extension Header.
Parse Destination Options Extension Header .
data
&mut BV
context
&mut Ipv6ExtensionHeaderParsingContext