/// Creates a IPv6 packet builder with a Hop By Hop Options extension header.
Creates a IPv6 packet builder with a Hop By Hop Options extension header.
Creates a IPv6 packet builder with a Hop By Hop Options extension header .
pub fn new<T: IntoIterator<Item = I::Item, IntoIter = I>>(
        prefix_builder: Ipv6PacketBuilder,
        options: T,
    ) -> Option<Ipv6PacketBuilderWithHbhOptions<'a, I>> {
        let iter = options.into_iter();
        // https://tools.ietf.org/html/rfc2711#section-2.1 specifies that
        // an RouterAlert option can only appear once.
        if iter
            .clone()
            .filter(|r| matches!(r.borrow().data, HopByHopOptionData::RouterAlert { .. }))
            .count()
            > 1
        {
            return None;
        }
        let hbh_options = AlignedRecordSequenceBuilder::new(2, iter);
        // And we don't want our options to become too long.
        if next_multiple_of_eight(2 + hbh_options.serialized_len()) > IPV6_HBH_OPTIONS_MAX_LEN {
            return None;
        }
        Some(Ipv6PacketBuilderWithHbhOptions { prefix_builder, hbh_options })
    }
pub fn new < T : IntoIterator < Item = I :: Item , IntoIter = I > > ( prefix_builder : Ipv6PacketBuilder , options : T , ) -> Option < Ipv6PacketBuilderWithHbhOptions < ' a , I > > { let iter = options . into_iter ( ) ; // https://tools.ietf.org/html/rfc2711#section-2.1 specifies that // an RouterAlert option can only appear once. if iter . clone ( ) . filter ( | r | matches ! ( r borrow ( ) data HopByHopOptionData RouterAlert { } ) ) . count ( ) > 1 { return None ; } let hbh_options = AlignedRecordSequenceBuilder :: new ( 2 , iter ) ; // And we don't want our options to become too long. if next_multiple_of_eight ( 2 + hbh_options . serialized_len ( ) ) > IPV6_HBH_OPTIONS_MAX_LEN { return None ; } Some ( Ipv6PacketBuilderWithHbhOptions { prefix_builder , hbh_options } ) }
Creates a IPv6 packet builder with a Hop By Hop Options extension header.
Creates a IPv6 packet builder with a Hop By Hop Options extension header .
prefix_builder
Ipv6PacketBuilder
options
T