Skip to main content

otIp6Init

Function otIp6Init 

Source
pub unsafe extern "C" fn otIp6Init(
    aInstance: *mut otInstance,
    aUnicastAddrPool: *mut otNetifAddress,
    aUnicastAddrPoolSize: u16,
    aMulticastAddrPool: *mut otNetifMulticastAddress,
    aMulticastAddrPoolSize: u16,
) -> otError
Expand description

Initializes the IPv6 interface and its external address pools.

Requires OPENTHREAD_CONFIG_IP6_INIT_EXT_ADDR_POOL_ENABLE.

It provides the memory buffers for the external unicast and multicast address pools and must be called before enabling the IPv6 interface.

The provided memory buffers MUST persist and remain valid as long as the OpenThread instance is initialized. OpenThread will use these provided buffers to manage the pools of externally added unicast and multicast addresses (i.e., those added via otIp6AddUnicastAddress() and otIp6SubscribeMulticastAddress()).

This function can only be called once. Subsequent calls will return OT_ERROR_ALREADY.

The OPENTHREAD_CONFIG_IP6_INIT_EXT_ADDR_POOL_ENABLE feature and this function allow the external unicast/multicast address pools to be configured at run-time after OpenThread instance initialization, rather than build-time. When this feature is disabled, the build-time configs OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS and OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS specify the pool sizes used by the OpenThread stack.

This feature allows the OpenThread stack to be compiled as a library without specifying the address pool sizes. It delegates the configuration of the pools to the next layer, allowing the OpenThread stack to be integrated into various projects without requiring a new OpenThread stack configuration to be built.

@param[in] aInstance A pointer to an OpenThread instance. @param[in] aUnicastAddrPool A pointer to an array of otNetifAddress. @param[in] aUnicastAddrPoolSize The number of entries in @p aUnicastAddrPool. @param[in] aMulticastAddrPool A pointer to an array of otNetifMulticastAddress. @param[in] aMulticastAddrPoolSize The number of entries in @p aMulticastAddrPool.

@retval OT_ERROR_NONE Successfully initialized the IPv6 interface. @retval OT_ERROR_ALREADY The IPv6 interface is already initialized.