pub unsafe fn initialize_all(
    mux_mac: &'static capsules::ieee802154::virtual_mac::MuxMac<'static>,
    mux_alarm: &'static MuxAlarm<'static, sam4l::ast::Ast>,
) -> &'static LowpanTest<
    'static,
    capsules::virtual_alarm::VirtualMuxAlarm<'static, sam4l::ast::Ast<'static>>,
> {
    let radio_mac = static_init!(
        capsules::ieee802154::virtual_mac::MacUser<'static>,
        capsules::ieee802154::virtual_mac::MacUser::new(mux_mac)
    );
    mux_mac.add_user(radio_mac);
    let sixlowpan = static_init!(
        Sixlowpan<'static, sam4l::ast::Ast<'static>, sixlowpan_compression::Context>,
        Sixlowpan::new(
            sixlowpan_compression::Context {
                prefix: DEFAULT_CTX_PREFIX,
                prefix_len: DEFAULT_CTX_PREFIX_LEN,
                id: 0,
                compress: false,
            },
            &sam4l::ast::AST
        )
    );

    let sixlowpan_state = sixlowpan as &SixlowpanState;
    let sixlowpan_tx = TxState::new(sixlowpan_state);
    // Following code initializes an IP6Packet using the global UDP_DGRAM buffer as the payload
    let mut udp_hdr: UDPHeader = UDPHeader {
        src_port: 0,
        dst_port: 0,
        len: 0,
        cksum: 0,
    };
    udp_hdr.set_src_port(12345);
    udp_hdr.set_dst_port(54321);
    udp_hdr.set_len(PAYLOAD_LEN as u16 + 8);
    //checksum is calculated and set later

    let mut ip6_hdr: IP6Header = IP6Header::new();
    ip6_hdr.set_next_header(ip6_nh::UDP);
    ip6_hdr.set_payload_len(PAYLOAD_LEN as u16 + 8);
    ip6_hdr.src_addr = SRC_ADDR;
    ip6_hdr.dst_addr = DST_ADDR;

    let tr_hdr: TransportHeader = TransportHeader::UDP(udp_hdr);

    let ip_pyld: IPPayload = IPPayload {
        header: tr_hdr,
        payload: &mut UDP_PAYLOAD,
    };

    let ip6_dg = static_init!(IP6Packet<'static>, IP6Packet::new(ip_pyld));

    let ipsender_virtual_alarm = static_init!(
        VirtualMuxAlarm<'static, sam4l::ast::Ast>,
        VirtualMuxAlarm::new(mux_alarm)
    );

    let ip6_sender = static_init!(
        IP6SendStruct<'static, VirtualMuxAlarm<'static, sam4l::ast::Ast<'static>>>,
        IP6SendStruct::new(
            ip6_dg,
            ipsender_virtual_alarm,
            &mut RF233_BUF,
            sixlowpan_tx,
            radio_mac,
            DST_MAC_ADDR,
            SRC_MAC_ADDR
        )
    );
    radio_mac.set_transmit_client(ip6_sender);

    let udp_send_struct = static_init!(
        UDPSendStruct<
            'static,
            IP6SendStruct<'static, VirtualMuxAlarm<'static, sam4l::ast::Ast<'static>>>,
        >,
        UDPSendStruct::new(ip6_sender)
    );

    let udp_lowpan_test = static_init!(
        LowpanTest<'static, VirtualMuxAlarm<'static, sam4l::ast::Ast>>,
        LowpanTest::new(
            //sixlowpan_tx,
            //radio_mac,
            VirtualMuxAlarm::new(mux_alarm),
            udp_send_struct
        )
    );
    ip6_sender.set_client(udp_send_struct);
    udp_send_struct.set_client(udp_lowpan_test);
    udp_lowpan_test.alarm.set_client(udp_lowpan_test);
    ipsender_virtual_alarm.set_client(ip6_sender);

    udp_lowpan_test
}
//TODO: Initialize UDP sender/send_done client in initialize all
Initialize UDP sender/send_done client in initialize all
Initialize UDP sender / send_done client in initialize all
pub unsafe fn initialize_all(
    mux_mac: &'static capsules::ieee802154::virtual_mac::MuxMac<'static>,
    mux_alarm: &'static MuxAlarm<'static, sam4l::ast::Ast>,
) -> &'static LowpanTest<
    'static,
    capsules::virtual_alarm::VirtualMuxAlarm<'static, sam4l::ast::Ast<'static>>,
> {
    let radio_mac = static_init!(
        capsules::ieee802154::virtual_mac::MacUser<'static>,
        capsules::ieee802154::virtual_mac::MacUser::new(mux_mac)
    );
    mux_mac.add_user(radio_mac);
    let sixlowpan = static_init!(
        Sixlowpan<'static, sam4l::ast::Ast<'static>, sixlowpan_compression::Context>,
        Sixlowpan::new(
            sixlowpan_compression::Context {
                prefix: DEFAULT_CTX_PREFIX,
                prefix_len: DEFAULT_CTX_PREFIX_LEN,
                id: 0,
                compress: false,
            },
            &sam4l::ast::AST
        )
    );
    let sixlowpan_state = sixlowpan as &SixlowpanState;
    let sixlowpan_tx = TxState::new(sixlowpan_state);
    // Following code initializes an IP6Packet using the global UDP_DGRAM buffer as the payload
    let mut udp_hdr: UDPHeader = UDPHeader {
        src_port: 0,
        dst_port: 0,
        len: 0,
        cksum: 0,
    };
    udp_hdr.set_src_port(12345);
    udp_hdr.set_dst_port(54321);
    udp_hdr.set_len(PAYLOAD_LEN as u16 + 8);
    //checksum is calculated and set later
    let mut ip6_hdr: IP6Header = IP6Header::new();
    ip6_hdr.set_next_header(ip6_nh::UDP);
    ip6_hdr.set_payload_len(PAYLOAD_LEN as u16 + 8);
    ip6_hdr.src_addr = SRC_ADDR;
    ip6_hdr.dst_addr = DST_ADDR;
    let tr_hdr: TransportHeader = TransportHeader::UDP(udp_hdr);
    let ip_pyld: IPPayload = IPPayload {
        header: tr_hdr,
        payload: &mut UDP_PAYLOAD,
    };
    let ip6_dg = static_init!(IP6Packet<'static>, IP6Packet::new(ip_pyld));
    let ipsender_virtual_alarm = static_init!(
        VirtualMuxAlarm<'static, sam4l::ast::Ast>,
        VirtualMuxAlarm::new(mux_alarm)
    );
    let ip6_sender = static_init!(
        IP6SendStruct<'static, VirtualMuxAlarm<'static, sam4l::ast::Ast<'static>>>,
        IP6SendStruct::new(
            ip6_dg,
            ipsender_virtual_alarm,
            &mut RF233_BUF,
            sixlowpan_tx,
            radio_mac,
            DST_MAC_ADDR,
            SRC_MAC_ADDR
        )
    );
    radio_mac.set_transmit_client(ip6_sender);
    let udp_send_struct = static_init!(
        UDPSendStruct<
            'static,
            IP6SendStruct<'static, VirtualMuxAlarm<'static, sam4l::ast::Ast<'static>>>,
        >,
        UDPSendStruct::new(ip6_sender)
    );
    let udp_lowpan_test = static_init!(
        LowpanTest<'static, VirtualMuxAlarm<'static, sam4l::ast::Ast>>,
        LowpanTest::new(
            //sixlowpan_tx,
            //radio_mac,
            VirtualMuxAlarm::new(mux_alarm),
            udp_send_struct
        )
    );
    ip6_sender.set_client(udp_send_struct);
    udp_send_struct.set_client(udp_lowpan_test);
    udp_lowpan_test.alarm.set_client(udp_lowpan_test);
    ipsender_virtual_alarm.set_client(ip6_sender);
    udp_lowpan_test
}
pub unsafe fn initialize_all ( mux_mac : & ' static capsules :: ieee802154 :: virtual_mac :: MuxMac < ' static > , mux_alarm : & ' static MuxAlarm < ' static , sam4l :: ast :: Ast > , ) -> & ' static LowpanTest < ' static , capsules :: virtual_alarm :: VirtualMuxAlarm < ' static , sam4l :: ast :: Ast < ' static > > , > { let radio_mac = static_init ! ( capsules ieee802154 virtual_mac MacUser ' static capsules ieee802154 virtual_mac MacUser new ( mux_mac ) ) ; mux_mac . add_user ( radio_mac ) ; let sixlowpan = static_init ! ( Sixlowpan ' static sam4l ast Ast ' static sixlowpan_compression Context Sixlowpan new ( sixlowpan_compression Context { prefix DEFAULT_CTX_PREFIX prefix_len DEFAULT_CTX_PREFIX_LEN id 0 compress false } sam4l ast AST ) ) ; let sixlowpan_state = sixlowpan as & SixlowpanState ; let sixlowpan_tx = TxState :: new ( sixlowpan_state ) ; // Following code initializes an IP6Packet using the global UDP_DGRAM buffer as the payload let mut udp_hdr : UDPHeader = UDPHeader { src_port : 0 , dst_port : 0 , len : 0 , cksum : 0 , } ; udp_hdr . set_src_port ( 12345 ) ; udp_hdr . set_dst_port ( 54321 ) ; udp_hdr . set_len ( PAYLOAD_LEN as u16 + 8 ) ; //checksum is calculated and set later let mut ip6_hdr : IP6Header = IP6Header :: new ( ) ; ip6_hdr . set_next_header ( ip6_nh :: UDP ) ; ip6_hdr . set_payload_len ( PAYLOAD_LEN as u16 + 8 ) ; ip6_hdr . src_addr = SRC_ADDR ; ip6_hdr . dst_addr = DST_ADDR ; let tr_hdr : TransportHeader = TransportHeader :: UDP ( udp_hdr ) ; let ip_pyld : IPPayload = IPPayload { header : tr_hdr , payload : & mut UDP_PAYLOAD , } ; let ip6_dg = static_init ! ( IP6Packet ' static IP6Packet new ( ip_pyld ) ) ; let ipsender_virtual_alarm = static_init ! ( VirtualMuxAlarm ' static sam4l ast Ast VirtualMuxAlarm new ( mux_alarm ) ) ; let ip6_sender = static_init ! ( IP6SendStruct ' static VirtualMuxAlarm ' static sam4l ast Ast ' static IP6SendStruct new ( ip6_dg ipsender_virtual_alarm mut RF233_BUF sixlowpan_tx radio_mac DST_MAC_ADDR SRC_MAC_ADDR ) ) ; radio_mac . set_transmit_client ( ip6_sender ) ; let udp_send_struct = static_init ! ( UDPSendStruct ' static IP6SendStruct ' static VirtualMuxAlarm ' static sam4l ast Ast ' static UDPSendStruct new ( ip6_sender ) ) ; let udp_lowpan_test = static_init ! ( LowpanTest ' static VirtualMuxAlarm ' static sam4l ast Ast LowpanTest new ( //sixlowpan_tx, //radio_mac, VirtualMuxAlarm new ( mux_alarm ) udp_send_struct ) ) ; ip6_sender . set_client ( udp_send_struct ) ; udp_send_struct . set_client ( udp_lowpan_test ) ; udp_lowpan_test . alarm . set_client ( udp_lowpan_test ) ; ipsender_virtual_alarm . set_client ( ip6_sender ) ; udp_lowpan_test }
TODO: Initialize UDP sender/send_done client in initialize all
TODO : Initialize UDP sender / send_done client in initialize all
mux_mac
&'static capsules::ieee802154::virtual_mac::MuxMac<'static>
mux_alarm
&'static MuxAlarm<'static, sam4l::ast::Ast>
mux_mac
&'static capsules::ieee802154::virtual_mac::MuxMac<'static>
mux_alarm
&'static MuxAlarm<'static, sam4l::ast::Ast>