/// Initialize a device.
///
/// `initialize_device` will start soliciting IPv6 routers on the link if
/// `device` is configured to be a host. If it is configured to be an
/// advertising interface, it will start sending periodic router advertisements.
///
/// `initialize_device` MUST be called after adding the device to the netstack.
/// A device MUST NOT be used until it has been initialized.
///
/// This initialize step is kept separated from the device creation/allocation
/// step so that implementations have a chance to do some work (such as updating
/// implementation specific IDs or state, configure the device or driver, etc.)
/// before the device is actually initialized and used by this netstack.
///
/// See [`StackState::add_ethernet_device`] for information about adding
/// ethernet devices.
///
/// # Panics
///
/// Panics if `device` is already initialized.
Initialize a device.
`initialize_device` will start soliciting IPv6 routers on the link if
`device` is configured to be a host. If it is configured to be an
advertising interface, it will start sending periodic router advertisements.

`initialize_device` MUST be called after adding the device to the netstack.
A device MUST NOT be used until it has been initialized.

This initialize step is kept separated from the device creation/allocation
step so that implementations have a chance to do some work (such as updating
implementation specific IDs or state, configure the device or driver, etc.)
before the device is actually initialized and used by this netstack.

See [`StackState::add_ethernet_device`] for information about adding
ethernet devices.
Initialize a device . ` initialize_device ` will start soliciting IPv6 routers on the link if ` device ` is configured to be a host . If it is configured to be an advertising interface it will start sending periodic router advertisements . ` initialize_device ` MUST be called after adding the device to the netstack . A device MUST NOT be used until it has been initialized . This initialize step is kept separated from the device creation / allocation step so that implementations have a chance to do some work ( such as updating implementation specific IDs or state configure the device or driver etc . ) before the device is actually initialized and used by this netstack . See [ ` StackState :: add_ethernet_device ` ] for information about adding ethernet devices .
pub fn initialize_device<D: EventDispatcher>(ctx: &mut Ctx<D>, device: DeviceId) {
    let state = get_common_device_state_mut(&mut ctx.state, device);
    // `device` must currently be uninitialized.
    assert!(state.is_uninitialized());
    state.set_initialization_status(InitializationStatus::Initializing);
    match device.inner() {
        DeviceIdInner::Ethernet(id) => {
            ethernet::initialize_device(ctx, id);
            // All nodes should join the all-nodes multicast group.
            join_ip_multicast(ctx, device, Ipv6::ALL_NODES_LINK_LOCAL_MULTICAST_ADDRESS);
            // RFC 4861 section 6.3.7, it implies only a host sends router
            // solicitation messages.
            if !crate::ip::device::is_ipv6_routing_enabled(ctx, device) {
                <Ctx<_> as NdpHandler<EthernetLinkDevice>>::start_soliciting_routers(ctx, id);
            }
        }
        DeviceIdInner::Loopback => {}
    }
    get_common_device_state_mut(&mut ctx.state, device)
        .set_initialization_status(InitializationStatus::Initialized);
}
pub fn initialize_device < D : EventDispatcher > ( ctx : & mut Ctx < D > , device : DeviceId ) { let state = get_common_device_state_mut ( & mut ctx . state , device ) ; // `device` must currently be uninitialized. assert ! ( state is_uninitialized ( ) ) ; state . set_initialization_status ( InitializationStatus :: Initializing ) ; match device . inner ( ) { DeviceIdInner :: Ethernet ( id ) => { ethernet :: initialize_device ( ctx , id ) ; // All nodes should join the all-nodes multicast group. join_ip_multicast ( ctx , device , Ipv6 :: ALL_NODES_LINK_LOCAL_MULTICAST_ADDRESS ) ; // RFC 4861 section 6.3.7, it implies only a host sends router // solicitation messages. if ! crate :: ip :: device :: is_ipv6_routing_enabled ( ctx , device ) { < Ctx < _ > as NdpHandler < EthernetLinkDevice > > :: start_soliciting_routers ( ctx , id ) ; } } DeviceIdInner :: Loopback => { } } get_common_device_state_mut ( & mut ctx . state , device ) . set_initialization_status ( InitializationStatus :: Initialized ) ; }
Initialize a device.
Initialize a device .
ctx
&mut Ctx<D>
device
DeviceId
panics
Panics if `device` is already initialized.
Panics if ` device ` is already initialized .