nRF5 SDK for Thread and Zigbee v2.0.0
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables

This module includes functions that control IPv6 communication. More...

Data Structures

struct  otIp6Address
 
struct  otIp6Prefix
 
struct  otNetifAddress
 
struct  otNetifMulticastAddress
 
struct  otSemanticallyOpaqueIidGeneratorData
 
struct  otSockAddr
 
struct  otMessageInfo
 

Macros

#define OT_IP6_PREFIX_SIZE   8
 Size of an IPv6 prefix (bytes)
 
#define OT_IP6_IID_SIZE   8
 Size of an IPv6 Interface Identifier (bytes)
 
#define OT_IP6_ADDRESS_SIZE   16
 Size of an IPv6 address (bytes)
 

Typedefs

typedef struct otIp6Address otIp6Address
 
typedef struct otIp6Prefix otIp6Prefix
 
typedef struct otNetifAddress otNetifAddress
 
typedef struct
otNetifMulticastAddress 
otNetifMulticastAddress
 
typedef enum otNetifInterfaceId otNetifInterfaceId
 
typedef struct otSockAddr otSockAddr
 
typedef struct otMessageInfo otMessageInfo
 
typedef otError(* otIp6SlaacIidCreate )(otInstance *aInstance, otNetifAddress *aAddress, void *aContext)
 
typedef void(* otIp6ReceiveCallback )(otMessage *aMessage, void *aContext)
 

Enumerations

enum  otNetifInterfaceId { OT_NETIF_INTERFACE_ID_HOST = -1, OT_NETIF_INTERFACE_ID_THREAD = 1 }
 

Functions

OTAPI otError OTCALL otIp6SetEnabled (otInstance *aInstance, bool aEnabled)
 
OTAPI bool OTCALL otIp6IsEnabled (otInstance *aInstance)
 
OTAPI otError OTCALL otIp6AddUnicastAddress (otInstance *aInstance, const otNetifAddress *aAddress)
 
OTAPI otError OTCALL otIp6RemoveUnicastAddress (otInstance *aInstance, const otIp6Address *aAddress)
 
OTAPI const otNetifAddress *OTCALL otIp6GetUnicastAddresses (otInstance *aInstance)
 
otError otIp6SubscribeMulticastAddress (otInstance *aInstance, const otIp6Address *aAddress)
 
otError otIp6UnsubscribeMulticastAddress (otInstance *aInstance, const otIp6Address *aAddress)
 
const otNetifMulticastAddressotIp6GetMulticastAddresses (otInstance *aInstance)
 
bool otIp6IsMulticastPromiscuousEnabled (otInstance *aInstance)
 
void otIp6SetMulticastPromiscuousEnabled (otInstance *aInstance, bool aEnabled)
 
void otIp6SlaacUpdate (otInstance *aInstance, otNetifAddress *aAddresses, uint32_t aNumAddresses, otIp6SlaacIidCreate aIidCreate, void *aContext)
 
otError otIp6CreateRandomIid (otInstance *aInstance, otNetifAddress *aAddresses, void *aContext)
 
otError otIp6CreateMacIid (otInstance *aInstance, otNetifAddress *aAddresses, void *aContext)
 
otError otIp6CreateSemanticallyOpaqueIid (otInstance *aInstance, otNetifAddress *aAddresses, void *aContext)
 
otMessageotIp6NewMessage (otInstance *aInstance, bool aLinkSecurityEnabled)
 
void otIp6SetReceiveCallback (otInstance *aInstance, otIp6ReceiveCallback aCallback, void *aCallbackContext)
 
bool otIp6IsReceiveFilterEnabled (otInstance *aInstance)
 
void otIp6SetReceiveFilterEnabled (otInstance *aInstance, bool aEnabled)
 
otError otIp6Send (otInstance *aInstance, otMessage *aMessage)
 
otError otIp6AddUnsecurePort (otInstance *aInstance, uint16_t aPort)
 
otError otIp6RemoveUnsecurePort (otInstance *aInstance, uint16_t aPort)
 
void otIp6RemoveAllUnsecurePorts (otInstance *aInstance)
 
const uint16_t * otIp6GetUnsecurePorts (otInstance *aInstance, uint8_t *aNumEntries)
 
OTAPI bool OTCALL otIp6IsAddressEqual (const otIp6Address *aFirst, const otIp6Address *aSecond)
 
OTAPI otError OTCALL otIp6AddressFromString (const char *aString, otIp6Address *aAddress)
 
OTAPI uint8_t OTCALL otIp6PrefixMatch (const otIp6Address *aFirst, const otIp6Address *aSecond)
 
bool otIp6IsAddressUnspecified (const otIp6Address *aAddress)
 

Variables

OT_TOOL_PACKED_BEGIN struct
otIp6Address 
OT_TOOL_PACKED_END
 

Detailed Description

This module includes functions that control IPv6 communication.

Typedef Documentation

typedef struct otIp6Address otIp6Address

This structure represents an IPv6 address.

typedef struct otIp6Prefix otIp6Prefix

This structure represents an IPv6 prefix.

typedef void(* otIp6ReceiveCallback)(otMessage *aMessage, void *aContext)

This function pointer is called when an IPv6 datagram is received.

Parameters
[in]aMessageA pointer to the message buffer containing the received IPv6 datagram.
[in]aContextA pointer to application-specific context.
typedef otError(* otIp6SlaacIidCreate)(otInstance *aInstance, otNetifAddress *aAddress, void *aContext)

This function pointer is called to create IPv6 IID during SLAAC procedure.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in,out]aAddressA pointer to structure containing IPv6 address for which IID is being created.
[in,out]aContextA pointer to creator-specific context.
Return values
OT_ERROR_NONECreated valid IID for given IPv6 address.
OT_ERROR_IP6_ADDRESS_CREATION_FAILURECreation of valid IID for given IPv6 address failed.
typedef struct otMessageInfo otMessageInfo

This structure represents the local and peer IPv6 socket addresses.

This structure represents an IPv6 network interface unicast address.

This enumeration represents the list of allowable values for an InterfaceId.

This structure represents an IPv6 network interface multicast address.

typedef struct otSockAddr otSockAddr

This structure represents an IPv6 socket address.

Enumeration Type Documentation

This enumeration represents the list of allowable values for an InterfaceId.

Enumerator
OT_NETIF_INTERFACE_ID_HOST 

The interface ID telling packets received by host side interfaces.

OT_NETIF_INTERFACE_ID_THREAD 

The Thread Network interface ID.

Function Documentation

OTAPI otError OTCALL otIp6AddressFromString ( const char *  aString,
otIp6Address aAddress 
)

Convert a human-readable IPv6 address string into a binary representation.

Parameters
[in]aStringA pointer to a NULL-terminated string.
[out]aAddressA pointer to an IPv6 address.
Return values
OT_ERROR_NONESuccessfully parsed the string.
OT_ERROR_INVALID_ARGSFailed to parse the string.
OTAPI otError OTCALL otIp6AddUnicastAddress ( otInstance aInstance,
const otNetifAddress aAddress 
)

Add a Network Interface Address to the Thread interface.

The passed-in instance aAddress is copied by the Thread interface. The Thread interface only supports a fixed number of externally added unicast addresses. See OPENTHREAD_CONFIG_MAX_EXT_IP_ADDRS.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aAddressA pointer to a Network Interface Address.
Return values
OT_ERROR_NONESuccessfully added (or updated) the Network Interface Address.
OT_ERROR_INVALID_ARGSThe IP Address indicated by aAddress is an internal address.
OT_ERROR_NO_BUFSThe Network Interface is already storing the maximum allowed external addresses.
otError otIp6AddUnsecurePort ( otInstance aInstance,
uint16_t  aPort 
)

This function adds a port to the allowed unsecured port list.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aPortThe port value.
Return values
OT_ERROR_NONEThe port was successfully added to the allowed unsecure port list.
OT_ERROR_NO_BUFSThe unsecure port list is full.
otError otIp6CreateMacIid ( otInstance aInstance,
otNetifAddress aAddresses,
void *  aContext 
)

Create IID for given IPv6 address using extended MAC address.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in,out]aAddressesA pointer to structure containing IPv6 address for which IID is being created.
[in]aContextA pointer to unused data.
Return values
OT_ERROR_NONECreated valid IID for given IPv6 address.
otError otIp6CreateRandomIid ( otInstance aInstance,
otNetifAddress aAddresses,
void *  aContext 
)

Create random IID for given IPv6 address.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in,out]aAddressesA pointer to structure containing IPv6 address for which IID is being created.
[in]aContextA pointer to unused data.
Return values
OT_ERROR_NONECreated valid IID for given IPv6 address.
otError otIp6CreateSemanticallyOpaqueIid ( otInstance aInstance,
otNetifAddress aAddresses,
void *  aContext 
)

Create semantically opaque IID for given IPv6 address.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in,out]aAddressesA pointer to structure containing IPv6 address for which IID is being created.
[in,out]aContextA pointer to a otSemanticallyOpaqueIidGeneratorData structure.
Return values
OT_ERROR_NONECreated valid IID for given IPv6 address.
OT_ERROR_IP6_ADDRESS_CREATION_FAILURECould not create valid IID for given IPv6 address.
const otNetifMulticastAddress* otIp6GetMulticastAddresses ( otInstance aInstance)

Get the list of IPv6 multicast addresses subscribed to the Thread interface.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
A pointer to the first Network Interface Multicast Address.
OTAPI const otNetifAddress* OTCALL otIp6GetUnicastAddresses ( otInstance aInstance)

Get the list of IPv6 addresses assigned to the Thread interface.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
A pointer to the first Network Interface Address.
const uint16_t* otIp6GetUnsecurePorts ( otInstance aInstance,
uint8_t *  aNumEntries 
)

This function returns a pointer to the unsecure port list.

Note
Port value 0 is used to indicate an invalid entry.
Parameters
[in]aInstanceA pointer to an OpenThread instance.
[out]aNumEntriesThe number of entries in the list.
Returns
A pointer to the unsecure port list.
OTAPI bool OTCALL otIp6IsAddressEqual ( const otIp6Address aFirst,
const otIp6Address aSecond 
)

Test if two IPv6 addresses are the same.

Parameters
[in]aFirstA pointer to the first IPv6 address to compare.
[in]aSecondA pointer to the second IPv6 address to compare.
Return values
TRUEThe two IPv6 addresses are the same.
FALSEThe two IPv6 addresses are not the same.
bool otIp6IsAddressUnspecified ( const otIp6Address aAddress)

This function indicates whether or not a given IPv6 address is the Unspecified Address.

Parameters
[in]aAddressA pointer to an IPv6 address.
Return values
TRUEIf the IPv6 address is the Unspecified Address.
FALSEIf the IPv6 address is not the Unspecified Address.
OTAPI bool OTCALL otIp6IsEnabled ( otInstance aInstance)

This function indicates whether or not the IPv6 interface is up.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
TRUEThe IPv6 interface is enabled.
FALSEThe IPv6 interface is disabled.
bool otIp6IsMulticastPromiscuousEnabled ( otInstance aInstance)

Check if multicast promiscuous mode is enabled on the Thread interface.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
See also
otIp6SetMulticastPromiscuousEnabled
bool otIp6IsReceiveFilterEnabled ( otInstance aInstance)

This function indicates whether or not Thread control traffic is filtered out when delivering IPv6 datagrams via the callback specified in otIp6SetReceiveCallback().

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
TRUE if Thread control traffic is filtered out, FALSE otherwise.
See also
otIp6SetReceiveCallback
otIp6SetReceiveFilterEnabled
otMessage* otIp6NewMessage ( otInstance aInstance,
bool  aLinkSecurityEnabled 
)

Allocate a new message buffer for sending an IPv6 message.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aLinkSecurityEnabledTRUE if the message should be secured at Layer 2
Returns
A pointer to the message buffer or NULL if no message buffers are available.
See also
otFreeMessage
OTAPI uint8_t OTCALL otIp6PrefixMatch ( const otIp6Address aFirst,
const otIp6Address aSecond 
)

This function returns the prefix match length (bits) for two IPv6 addresses.

Parameters
[in]aFirstA pointer to the first IPv6 address.
[in]aSecondA pointer to the second IPv6 address.
Returns
The prefix match length in bits.
void otIp6RemoveAllUnsecurePorts ( otInstance aInstance)

This function removes all ports from the allowed unsecure port list.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
OTAPI otError OTCALL otIp6RemoveUnicastAddress ( otInstance aInstance,
const otIp6Address aAddress 
)

Remove a Network Interface Address from the Thread interface.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aAddressA pointer to an IP Address.
Return values
OT_ERROR_NONESuccessfully removed the Network Interface Address.
OT_ERROR_INVALID_ARGSThe IP Address indicated by aAddress is an internal address.
OT_ERROR_NOT_FOUNDThe IP Address indicated by aAddress was not found.
otError otIp6RemoveUnsecurePort ( otInstance aInstance,
uint16_t  aPort 
)

This function removes a port from the allowed unsecure port list.

Note
This function removes aPort by overwriting aPort with the element after aPort in the internal port list. Be careful when calling otIp6GetUnsecurePorts() followed by otIp6RemoveUnsecurePort() to remove unsecure ports.
Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aPortThe port value.
Return values
OT_ERROR_NONEThe port was successfully removed from the allowed unsecure port list.
OT_ERROR_NOT_FOUNDThe port was not found in the unsecure port list.
otError otIp6Send ( otInstance aInstance,
otMessage aMessage 
)

This function sends an IPv6 datagram via the Thread interface.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aMessageA pointer to the message buffer containing the IPv6 datagram.
OTAPI otError OTCALL otIp6SetEnabled ( otInstance aInstance,
bool  aEnabled 
)

This function brings up the IPv6 interface.

Call this function to enable/disable IPv6 communication.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aEnabledTRUE to enable IPv6, FALSE otherwise.
Return values
OT_ERROR_NONESuccessfully enabled the IPv6 interface, or the interface was already enabled.
void otIp6SetMulticastPromiscuousEnabled ( otInstance aInstance,
bool  aEnabled 
)

Enable multicast promiscuous mode on the Thread interface.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aEnabledTRUE to enable Multicast Promiscuous mode, FALSE otherwise.
See also
otIp6IsMulticastPromiscuousEnabled
void otIp6SetReceiveCallback ( otInstance aInstance,
otIp6ReceiveCallback  aCallback,
void *  aCallbackContext 
)

This function registers a callback to provide received IPv6 datagrams.

By default, this callback does not pass Thread control traffic. See otIp6SetReceiveFilterEnabled() to change the Thread control traffic filter setting.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aCallbackA pointer to a function that is called when an IPv6 datagram is received or NULL to disable the callback.
[in]aCallbackContextA pointer to application-specific context.
See also
otIp6IsReceiveFilterEnabled
otIp6SetReceiveFilterEnabled
void otIp6SetReceiveFilterEnabled ( otInstance aInstance,
bool  aEnabled 
)

This function sets whether or not Thread control traffic is filtered out when delivering IPv6 datagrams via the callback specified in otIp6SetReceiveCallback().

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aEnabledTRUE if Thread control traffic is filtered out, FALSE otherwise.
See also
otIp6SetReceiveCallback
otIsReceiveIp6FilterEnabled
void otIp6SlaacUpdate ( otInstance aInstance,
otNetifAddress aAddresses,
uint32_t  aNumAddresses,
otIp6SlaacIidCreate  aIidCreate,
void *  aContext 
)

Update all automatically created IPv6 addresses for prefixes from current Network Data with SLAAC procedure.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in,out]aAddressesA pointer to an array of automatically created IPv6 addresses.
[in]aNumAddressesThe number of slots in aAddresses array.
[in]aIidCreateA pointer to a function that is called to create IPv6 IIDs.
[in]aContextA pointer to data passed to aIidCreate function.
otError otIp6SubscribeMulticastAddress ( otInstance aInstance,
const otIp6Address aAddress 
)

Subscribe the Thread interface to a Network Interface Multicast Address.

The passed in instance aAddress will be copied by the Thread interface. The Thread interface only supports a fixed number of externally added multicast addresses. See OPENTHREAD_CONFIG_MAX_EXT_MULTICAST_IP_ADDRS.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aAddressA pointer to an IP Address.
Return values
OT_ERROR_NONESuccessfully subscribed to the Network Interface Multicast Address.
OT_ERROR_ALREADYThe multicast address is already subscribed.
OT_ERROR_INVALID_ARGSThe IP Address indicated by aAddress is invalid address.
OT_ERROR_NO_BUFSThe Network Interface is already storing the maximum allowed external multicast addresses.
otError otIp6UnsubscribeMulticastAddress ( otInstance aInstance,
const otIp6Address aAddress 
)

Unsubscribe the Thread interface to a Network Interface Multicast Address.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aAddressA pointer to an IP Address.
Return values
OT_ERROR_NONESuccessfully unsubscribed to the Network Interface Multicast Address.
OT_ERROR_INVALID_ARGSThe IP Address indicated by aAddress is an internal address.
OT_ERROR_NOT_FOUNDThe IP Address indicated by aAddress was not found.

Documentation feedback | Developer Zone | Subscribe | Updated