fn process_ipv6_fragment<D: EventDispatcher>(
        ctx: &mut Ctx<D>,
        device: DeviceId,
        fragment_id: u16,
        fragment_offset: u8,
        fragment_count: u8,
    ) {
        assert!(fragment_offset < fragment_count);

        let m_flag = fragment_offset < (fragment_count - 1);

        let mut bytes = vec![0; 48];
        bytes[..4].copy_from_slice(&[0x60, 0x20, 0x00, 0x77][..]);
        bytes[6] = Ipv6ExtHdrType::Fragment.into(); // Next Header
        bytes[7] = 64;
        bytes[8..24].copy_from_slice(DUMMY_CONFIG_V6.remote_ip.bytes());
        bytes[24..40].copy_from_slice(DUMMY_CONFIG_V6.local_ip.bytes());
        bytes[40] = IpProto::Udp.into();
        bytes[42] = fragment_offset >> 5;
        bytes[43] = ((fragment_offset & 0x1F) << 3) | if m_flag { 1 } else { 0 };
        bytes[44..48].copy_from_slice(&(u32::try_from(fragment_id).unwrap().to_be_bytes()));
        bytes.extend(fragment_offset * 8..fragment_offset * 8 + 8);
        let payload_len = u16::try_from(bytes.len() - 40).unwrap();
        bytes[4..6].copy_from_slice(&payload_len.to_be_bytes());
        let buffer = Buf::new(bytes, ..);
        receive_ipv6_packet(ctx, device, FrameDestination::Unicast, buffer);
    }
/// Generate and 'receive' an IPv6 fragment packet.
///
/// `fragment_offset` is the fragment offset. `fragment_count` is the number
/// of fragments for a packet. The generated packet will have a body of size
/// 8 bytes.
Generate and 'receive' an IPv6 fragment packet.
`fragment_offset` is the fragment offset. `fragment_count` is the number
of fragments for a packet. The generated packet will have a body of size
8 bytes.
Generate and ' receive ' an IPv6 fragment packet . ` fragment_offset ` is the fragment offset . ` fragment_count ` is the number of fragments for a packet . The generated packet will have a body of size 8 bytes .
fn process_ipv6_fragment<D: EventDispatcher>(
        ctx: &mut Ctx<D>,
        device: DeviceId,
        fragment_id: u16,
        fragment_offset: u8,
        fragment_count: u8,
    ) {
        assert!(fragment_offset < fragment_count);
        let m_flag = fragment_offset < (fragment_count - 1);
        let mut bytes = vec![0; 48];
        bytes[..4].copy_from_slice(&[0x60, 0x20, 0x00, 0x77][..]);
        bytes[6] = Ipv6ExtHdrType::Fragment.into(); // Next Header
        bytes[7] = 64;
        bytes[8..24].copy_from_slice(DUMMY_CONFIG_V6.remote_ip.bytes());
        bytes[24..40].copy_from_slice(DUMMY_CONFIG_V6.local_ip.bytes());
        bytes[40] = IpProto::Udp.into();
        bytes[42] = fragment_offset >> 5;
        bytes[43] = ((fragment_offset & 0x1F) << 3) | if m_flag { 1 } else { 0 };
        bytes[44..48].copy_from_slice(&(u32::try_from(fragment_id).unwrap().to_be_bytes()));
        bytes.extend(fragment_offset * 8..fragment_offset * 8 + 8);
        let payload_len = u16::try_from(bytes.len() - 40).unwrap();
        bytes[4..6].copy_from_slice(&payload_len.to_be_bytes());
        let buffer = Buf::new(bytes, ..);
        receive_ipv6_packet(ctx, device, FrameDestination::Unicast, buffer);
    }
fn process_ipv6_fragment < D : EventDispatcher > ( ctx : & mut Ctx < D > , device : DeviceId , fragment_id : u16 , fragment_offset : u8 , fragment_count : u8 , ) { assert ! ( fragment_offset fragment_count ) ; let m_flag = fragment_offset < ( fragment_count - 1 ) ; let mut bytes = vec ! [ 0 48 ] ; bytes [ .. 4 ] . copy_from_slice ( & [ 0x60 , 0x20 , 0x00 , 0x77 ] [ .. ] ) ; bytes [ 6 ] = Ipv6ExtHdrType :: Fragment . into ( ) ; // Next Header bytes [ 7 ] = 64 ; bytes [ 8 .. 24 ] . copy_from_slice ( DUMMY_CONFIG_V6 . remote_ip . bytes ( ) ) ; bytes [ 24 .. 40 ] . copy_from_slice ( DUMMY_CONFIG_V6 . local_ip . bytes ( ) ) ; bytes [ 40 ] = IpProto :: Udp . into ( ) ; bytes [ 42 ] = fragment_offset >> 5 ; bytes [ 43 ] = ( ( fragment_offset & 0x1F ) << 3 ) | if m_flag { 1 } else { 0 } ; bytes [ 44 .. 48 ] . copy_from_slice ( & ( u32 :: try_from ( fragment_id ) . unwrap ( ) . to_be_bytes ( ) ) ) ; bytes . extend ( fragment_offset * 8 .. fragment_offset * 8 + 8 ) ; let payload_len = u16 :: try_from ( bytes . len ( ) - 40 ) . unwrap ( ) ; bytes [ 4 .. 6 ] . copy_from_slice ( & payload_len . to_be_bytes ( ) ) ; let buffer = Buf :: new ( bytes , .. ) ; receive_ipv6_packet ( ctx , device , FrameDestination :: Unicast , buffer ) ; }
Generate and 'receive' an IPv6 fragment packet.
Generate and ' receive ' an IPv6 fragment packet .
ctx
&mut Ctx<D>
device
DeviceId
fragment_id
u16
fragment_offset
u8
fragment_count
u8
ctx
&mut Ctx<D>
device
DeviceId
fragment_id
u16
fragment_offset
u8
fragment_count
u8