IPv6
This module includes functions that control IPv6 communication.
Classes |
|
| struct | otIp6InterfaceIdentifier |
|
This structure represents the Interface Identifier of an IPv6 address.
|
|
| struct | otIp6NetworkPrefix |
|
This structure represents the Network Prefix of an IPv6 address (most significant 64 bits of the address).
|
|
| struct | otIp6AddressComponents |
|
This structure represents the components of an IPv6 address.
|
|
| struct | otIp6Address |
|
This structure represents an IPv6 address.
|
|
| struct | otIp6Prefix |
|
This structure represents an IPv6 prefix.
|
|
| struct | otNetifAddress |
|
This structure represents an IPv6 network interface unicast address.
|
|
| struct | otNetifMulticastAddress |
|
This structure represents an IPv6 network interface multicast address.
|
|
| struct | otSockAddr |
|
This structure represents an IPv6 socket address.
|
|
| struct | otMessageInfo |
|
This structure represents the local and peer IPv6 socket addresses.
|
|
| struct | otIp6AddressInfo |
|
This structure represents IPv6 address information.
|
|
Macros |
|
| #define | OT_IP6_PREFIX_SIZE 8 |
|
Size of an IPv6 prefix (bytes)
|
|
| #define | OT_IP6_PREFIX_BITSIZE ( OT_IP6_PREFIX_SIZE * 8) |
|
Size of an IPv6 prefix (bits)
|
|
| #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)
|
|
| #define | OT_IP6_ADDRESS_STRING_SIZE 40 |
|
Recommended size for string representation of an IPv6 address.
|
|
| #define | OT_IP6_SOCK_ADDR_STRING_SIZE 48 |
|
Recommended size for string representation of an IPv6 socket address.
|
|
| #define | OT_IP6_PREFIX_STRING_SIZE 45 |
|
Recommended size for string representation of an IPv6 prefix.
|
|
| #define | OT_IP6_MAX_MLR_ADDRESSES 15 |
|
Max number of IPv6 addresses supported by Multicast Listener Registration.
|
|
Typedefs |
|
| typedef struct otIp6InterfaceIdentifier | otIp6InterfaceIdentifier |
|
This structure represents the Interface Identifier of an IPv6 address.
|
|
| typedef struct otIp6NetworkPrefix | otIp6NetworkPrefix |
|
This structure represents the Network Prefix of an IPv6 address (most significant 64 bits of the address).
|
|
| typedef struct otIp6AddressComponents | otIp6AddressComponents |
|
This structure represents the components of an IPv6 address.
|
|
| typedef struct otIp6Address | otIp6Address |
|
This structure represents an IPv6 address.
|
|
| typedef struct otIp6Prefix | otIp6Prefix |
|
This structure represents an IPv6 prefix.
|
|
| typedef struct otNetifAddress | otNetifAddress |
|
This structure represents an IPv6 network interface unicast address.
|
|
| typedef struct otNetifMulticastAddress | otNetifMulticastAddress |
|
This structure represents an IPv6 network interface multicast address.
|
|
| typedef struct otSockAddr | otSockAddr |
|
This structure represents an IPv6 socket address.
|
|
| typedef struct otMessageInfo | otMessageInfo |
|
This structure represents the local and peer IPv6 socket addresses.
|
|
| typedef void(* | otIp6ReceiveCallback ) ( otMessage *aMessage, void *aContext) |
|
This function pointer is called when an IPv6 datagram is received.
|
|
| typedef struct otIp6AddressInfo | otIp6AddressInfo |
| typedef void(* | otIp6AddressCallback ) (const otIp6AddressInfo *aAddressInfo, bool aIsAdded, void *aContext) |
|
This function pointer is called when an internal IPv6 address is added or removed.
|
|
| typedef bool(* | otIp6SlaacPrefixFilter ) ( otInstance *aInstance, const otIp6Prefix *aPrefix) |
|
This function pointer allows user to filter prefixes and not allow an SLAAC address based on a prefix to be added.
|
|
| typedef void(* | otIp6RegisterMulticastListenersCallback ) (void *aContext, otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, uint8_t aFailedAddressNum) |
This function pointer is called with results of
otIp6RegisterMulticastListeners
.
|
|
Enumerations |
|
| enum |
{
OT_ADDRESS_ORIGIN_THREAD = 0, OT_ADDRESS_ORIGIN_SLAAC = 1, OT_ADDRESS_ORIGIN_DHCPV6 = 2, OT_ADDRESS_ORIGIN_MANUAL = 3 } |
|
IPv6 Address origins.
|
|
| enum |
{
OT_ECN_NOT_CAPABLE = 0x0, OT_ECN_CAPABLE_0 = 0x2, OT_ECN_CAPABLE_1 = 0x1, OT_ECN_MARKED = 0x3 } |
|
ECN statuses, represented as in the IP header.
|
|
| enum |
{
OT_IP6_PROTO_HOP_OPTS = 0, OT_IP6_PROTO_TCP = 6, OT_IP6_PROTO_UDP = 17, OT_IP6_PROTO_IP6 = 41, OT_IP6_PROTO_ROUTING = 43, OT_IP6_PROTO_FRAGMENT = 44, OT_IP6_PROTO_ICMP6 = 58, OT_IP6_PROTO_NONE = 59, OT_IP6_PROTO_DST_OPTS = 60 } |
|
Internet Protocol Numbers.
|
|
Functions |
|
| otError | otIp6SetEnabled ( otInstance *aInstance, bool aEnabled) |
|
This function brings up/down the IPv6 interface.
|
|
| bool | otIp6IsEnabled ( otInstance *aInstance) |
|
This function indicates whether or not the IPv6 interface is up.
|
|
| otError | otIp6AddUnicastAddress ( otInstance *aInstance, const otNetifAddress *aAddress) |
|
Add a Network Interface Address to the Thread interface.
|
|
| otError | otIp6RemoveUnicastAddress ( otInstance *aInstance, const otIp6Address *aAddress) |
|
Remove a Network Interface Address from the Thread interface.
|
|
| const otNetifAddress * | otIp6GetUnicastAddresses ( otInstance *aInstance) |
|
Get the list of IPv6 addresses assigned to the Thread interface.
|
|
| otError | otIp6SubscribeMulticastAddress ( otInstance *aInstance, const otIp6Address *aAddress) |
|
Subscribe the Thread interface to a Network Interface Multicast Address.
|
|
| otError | otIp6UnsubscribeMulticastAddress ( otInstance *aInstance, const otIp6Address *aAddress) |
|
Unsubscribe the Thread interface to a Network Interface Multicast Address.
|
|
| const otNetifMulticastAddress * | otIp6GetMulticastAddresses ( otInstance *aInstance) |
|
Get the list of IPv6 multicast addresses subscribed to the Thread interface.
|
|
| bool | otIp6IsMulticastPromiscuousEnabled ( otInstance *aInstance) |
|
Check if multicast promiscuous mode is enabled on the Thread interface.
|
|
| void | otIp6SetMulticastPromiscuousEnabled ( otInstance *aInstance, bool aEnabled) |
|
Enable multicast promiscuous mode on the Thread interface.
|
|
| otMessage * | otIp6NewMessage ( otInstance *aInstance, const otMessageSettings *aSettings) |
|
Allocate a new message buffer for sending an IPv6 message.
|
|
| otMessage * | otIp6NewMessageFromBuffer ( otInstance *aInstance, const uint8_t *aData, uint16_t aDataLength, const otMessageSettings *aSettings) |
|
Allocate a new message buffer and write the IPv6 datagram to the message buffer for sending an IPv6 message.
|
|
| void | otIp6SetReceiveCallback ( otInstance *aInstance, otIp6ReceiveCallback aCallback, void *aCallbackContext) |
|
This function registers a callback to provide received IPv6 datagrams.
|
|
| void | otIp6SetAddressCallback ( otInstance *aInstance, otIp6AddressCallback aCallback, void *aCallbackContext) |
|
This function registers a callback to notify internal IPv6 address changes.
|
|
| 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()
.
|
|
| 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()
.
|
|
| otError | otIp6Send ( otInstance *aInstance, otMessage *aMessage) |
|
This function sends an IPv6 datagram via the Thread interface.
|
|
| otError | otIp6AddUnsecurePort ( otInstance *aInstance, uint16_t aPort) |
|
This function adds a port to the allowed unsecured port list.
|
|
| otError | otIp6RemoveUnsecurePort ( otInstance *aInstance, uint16_t aPort) |
|
This function removes a port from the allowed unsecure port list.
|
|
| void | otIp6RemoveAllUnsecurePorts ( otInstance *aInstance) |
|
This function removes all ports from the allowed unsecure port list.
|
|
| const uint16_t * | otIp6GetUnsecurePorts ( otInstance *aInstance, uint8_t *aNumEntries) |
|
This function returns a pointer to the unsecure port list.
|
|
| bool | otIp6IsAddressEqual (const otIp6Address *aFirst, const otIp6Address *aSecond) |
|
Test if two IPv6 addresses are the same.
|
|
| bool | otIp6ArePrefixesEqual (const otIp6Prefix *aFirst, const otIp6Prefix *aSecond) |
|
Test if two IPv6 prefixes are the same.
|
|
| otError | otIp6AddressFromString (const char *aString, otIp6Address *aAddress) |
|
This function converts a human-readable IPv6 address string into a binary representation.
|
|
| void | otIp6AddressToString (const otIp6Address *aAddress, char *aBuffer, uint16_t aSize) |
|
This function converts a given IPv6 address to a human-readable string.
|
|
| void | otIp6SockAddrToString (const otSockAddr *aSockAddr, char *aBuffer, uint16_t aSize) |
|
This function converts a given IPv6 socket address to a human-readable string.
|
|
| void | otIp6PrefixToString (const otIp6Prefix *aPrefix, char *aBuffer, uint16_t aSize) |
|
This function converts a given IPv6 prefix to a human-readable string.
|
|
| uint8_t | otIp6PrefixMatch (const otIp6Address *aFirst, const otIp6Address *aSecond) |
|
This function returns the prefix match length (bits) for two IPv6 addresses.
|
|
| bool | otIp6IsAddressUnspecified (const otIp6Address *aAddress) |
|
This function indicates whether or not a given IPv6 address is the Unspecified Address.
|
|
| otError | otIp6SelectSourceAddress ( otInstance *aInstance, otMessageInfo *aMessageInfo) |
|
This function perform OpenThread source address selection.
|
|
| bool | otIp6IsSlaacEnabled ( otInstance *aInstance) |
|
This function indicates whether the SLAAC module is enabled or not.
|
|
| void | otIp6SetSlaacEnabled ( otInstance *aInstance, bool aEnabled) |
|
This function enables/disables the SLAAC module.
|
|
| void | otIp6SetSlaacPrefixFilter ( otInstance *aInstance, otIp6SlaacPrefixFilter aFilter) |
|
This function sets the SLAAC module filter handler.
|
|
| otError | otIp6RegisterMulticastListeners ( otInstance *aInstance, const otIp6Address *aAddresses, uint8_t aAddressNum, const uint32_t *aTimeout, otIp6RegisterMulticastListenersCallback aCallback, void *aContext) |
|
This function registers Multicast Listeners to Primary Backbone Router.
|
|
| otError | otIp6SetMeshLocalIid ( otInstance *aInstance, const otIp6InterfaceIdentifier *aIid) |
|
This function sets the Mesh Local IID (for test purpose).
|
|
| const char * | otIp6ProtoToString (uint8_t aIpProto) |
|
This function converts a given IP protocol number to a human-readable string.
|
|
Variables |
|
| OT_TOOL_PACKED_BEGIN struct otIp6InterfaceIdentifier | OT_TOOL_PACKED_END |
Detailed Description
This module includes functions that control IPv6 communication.
Typedef Documentation
◆ otIp6AddressCallback
| typedef void(* otIp6AddressCallback) (const otIp6AddressInfo *aAddressInfo, bool aIsAdded, void *aContext) |
This function pointer is called when an internal IPv6 address is added or removed.
- Parameters
-
[in] aAddressInfoA pointer to the IPv6 address information. [in] aIsAddedTRUE if the aAddresswas added, FALSE ifaAddresswas removed.[in] aContextA pointer to application-specific context.
◆ otIp6ReceiveCallback
| 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. This function transfers the ownership of the aMessageto the receiver of the callback. The message should be freed by the receiver of the callback after it is processed (see otMessageFree() ).[in] aContextA pointer to application-specific context.
◆ otIp6RegisterMulticastListenersCallback
| typedef void(* otIp6RegisterMulticastListenersCallback) (void *aContext, otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, uint8_t aFailedAddressNum) |
This function pointer is called with results of
otIp6RegisterMulticastListeners
.
- Parameters
-
[in] aContextA pointer to the user context. [in] aErrorOT_ERROR_NONE when successfully sent MLR.req and received MLR.rsp, OT_ERROR_RESPONSE_TIMEOUT when failed to receive MLR.rsp, OT_ERROR_PARSE when failed to parse MLR.rsp. [in] aMlrStatusThe Multicast Listener Registration status when aErroris OT_ERROR_NONE.[in] aFailedAddressesA pointer to the failed IPv6 addresses when aErroris OT_ERROR_NONE.[in] aFailedAddressNumThe number of failed IPv6 addresses when aErroris OT_ERROR_NONE.
- See also
- otIp6RegisterMulticastListeners
◆ otIp6SlaacPrefixFilter
| typedef bool(* otIp6SlaacPrefixFilter) ( otInstance *aInstance, const otIp6Prefix *aPrefix) |
This function pointer allows user to filter prefixes and not allow an SLAAC address based on a prefix to be added.
otIp6SetSlaacPrefixFilter()
can be used to set the filter handler. The filter handler is invoked by SLAAC module when it is about to add a SLAAC address based on a prefix. Its boolean return value determines whether the address is filtered (not added) or not.
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance. [in] aPrefixA pointer to prefix for which SLAAC address is about to be added.
- Return values
-
TRUEIndicates that the SLAAC address based on the prefix should be filtered and NOT added. FALSEIndicates that the SLAAC address based on the prefix should be added.
Enumeration Type Documentation
◆ anonymous enum
| anonymous enum |
◆ anonymous enum
| anonymous enum |
◆ anonymous enum
| anonymous enum |
Internet Protocol Numbers.
Function Documentation
◆ otIp6AddressFromString()
| otError otIp6AddressFromString | ( | const char * |
aString,
|
| otIp6Address * |
aAddress
|
||
| ) |
This function converts 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.
◆ otIp6AddressToString()
| void otIp6AddressToString | ( | const otIp6Address * |
aAddress,
|
| char * |
aBuffer,
|
||
| uint16_t |
aSize
|
||
| ) |
This function converts a given IPv6 address to a human-readable string.
The IPv6 address string is formatted as 16 hex values separated by ':' (i.e., "%x:%x:%x:...:%x").
If the resulting string does not fit in
aBuffer
(within its
aSize
characters), the string will be truncated but the outputted string is always null-terminated.
- Parameters
-
[in] aAddressA pointer to an IPv6 address (MUST NOT be NULL). [out] aBufferA pointer to a char array to output the string (MUST NOT be NULL). [in] aSizeThe size of aBuffer(in bytes). Recommended to useOT_IP6_ADDRESS_STRING_SIZE.
◆ otIp6AddUnicastAddress()
| otError 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_IP6_MAX_EXT_UCAST_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 aAddressis an internal address.OT_ERROR_NO_BUFSThe Network Interface is already storing the maximum allowed external addresses.
◆ otIp6AddUnsecurePort()
| 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_INVALID_ARGSThe port is invalid (value 0 is reserved for internal use). OT_ERROR_NO_BUFSThe unsecure port list is full.
◆ otIp6ArePrefixesEqual()
| bool otIp6ArePrefixesEqual | ( | const otIp6Prefix * |
aFirst,
|
| const otIp6Prefix * |
aSecond
|
||
| ) |
Test if two IPv6 prefixes are the same.
- Parameters
-
[in] aFirstA pointer to the first IPv6 prefix to compare. [in] aSecondA pointer to the second IPv6 prefix to compare.
- Return values
-
TRUEThe two IPv6 prefixes are the same. FALSEThe two IPv6 prefixes are not the same.
◆ otIp6GetMulticastAddresses()
| 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.
◆ otIp6GetUnicastAddresses()
| const otNetifAddress * 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.
◆ otIp6GetUnsecurePorts()
| 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.
◆ otIp6IsAddressEqual()
| bool 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.
◆ otIp6IsAddressUnspecified()
| 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.
◆ otIp6IsEnabled()
| bool 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.
◆ otIp6IsMulticastPromiscuousEnabled()
| 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
◆ otIp6IsReceiveFilterEnabled()
| 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.
◆ otIp6IsSlaacEnabled()
| bool otIp6IsSlaacEnabled | ( | otInstance * |
aInstance
|
) |
This function indicates whether the SLAAC module is enabled or not.
This function requires the build-time feature
OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE
to be enabled.
- Return values
-
TRUESLAAC module is enabled. FALSESLAAC module is disabled.
◆ otIp6NewMessage()
| otMessage * otIp6NewMessage | ( | otInstance * |
aInstance,
|
| const otMessageSettings * |
aSettings
|
||
| ) |
Allocate a new message buffer for sending an IPv6 message.
- Note
-
If
aSettingsis 'NULL', the link layer security is enabled and the message priority is set to OT_MESSAGE_PRIORITY_NORMAL by default.
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance. [in] aSettingsA pointer to the message settings or NULL to set default settings.
- Returns
- A pointer to the message buffer or NULL if no message buffers are available or parameters are invalid.
- See also
- otMessageFree
◆ otIp6NewMessageFromBuffer()
| otMessage * otIp6NewMessageFromBuffer | ( | otInstance * |
aInstance,
|
| const uint8_t * |
aData,
|
||
| uint16_t |
aDataLength,
|
||
| const otMessageSettings * |
aSettings
|
||
| ) |
Allocate a new message buffer and write the IPv6 datagram to the message buffer for sending an IPv6 message.
- Note
-
If
aSettingsis NULL, the link layer security is enabled and the message priority is obtained from IPv6 message itself. IfaSettingsis not NULL, theaSetting->mPriorityis ignored and obtained from IPv6 message itself.
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance. [in] aDataA pointer to the IPv6 datagram buffer. [in] aDataLengthThe size of the IPv6 datagram buffer pointed by aData.[in] aSettingsA pointer to the message settings or NULL to set default settings.
- Returns
- A pointer to the message or NULL if malformed IPv6 header or insufficient message buffers are available.
- See also
- otMessageFree
◆ otIp6PrefixMatch()
| uint8_t 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.
◆ otIp6PrefixToString()
| void otIp6PrefixToString | ( | const otIp6Prefix * |
aPrefix,
|
| char * |
aBuffer,
|
||
| uint16_t |
aSize
|
||
| ) |
This function converts a given IPv6 prefix to a human-readable string.
The IPv6 address string is formatted as "%x:%x:%x:...[::]/plen".
If the resulting string does not fit in
aBuffer
(within its
aSize
characters), the string will be truncated but the outputted string is always null-terminated.
- Parameters
-
[in] aPrefixA pointer to an IPv6 prefix (MUST NOT be NULL). [out] aBufferA pointer to a char array to output the string (MUST NOT be NULL). [in] aSizeThe size of aBuffer(in bytes). Recommended to useOT_IP6_PREFIX_STRING_SIZE.
◆ otIp6ProtoToString()
| const char* otIp6ProtoToString | ( | uint8_t |
aIpProto
|
) |
This function converts a given IP protocol number to a human-readable string.
- Parameters
-
[in] aIpProtoAn IP protocol number ( OT_IP6_PROTO_*enumeration).
- Returns
-
A string representing
aIpProto.
◆ otIp6RegisterMulticastListeners()
| otError otIp6RegisterMulticastListeners | ( | otInstance * |
aInstance,
|
| const otIp6Address * |
aAddresses,
|
||
| uint8_t |
aAddressNum,
|
||
| const uint32_t * |
aTimeout,
|
||
| otIp6RegisterMulticastListenersCallback |
aCallback,
|
||
| void * |
aContext
|
||
| ) |
This function registers Multicast Listeners to Primary Backbone Router.
Note: only available when both
OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE
and
OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
are enabled)
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance. [in] aAddressesA Multicast Address Array to register. [in] aAddressNumThe number of Multicast Address to register (0 if aAddressesis NULL).[in] aTimeoutA pointer to the timeout value (in seconds) to be included in MLR.req. A timeout value of 0 removes the corresponding Multicast Listener. If NULL, MLR.req would have no Timeout Tlv by default. [in] aCallbackA pointer to the callback function. [in] aContextA pointer to the user context.
- Return values
-
OT_ERROR_NONESuccessfully sent MLR.req. The aCallbackwill be called iff this method returns OT_ERROR_NONE.OT_ERROR_BUSYIf a previous registration was ongoing. OT_ERROR_INVALID_ARGSIf one or more arguments are invalid. OT_ERROR_INVALID_STATEIf the device was not in a valid state to send MLR.req (e.g. Commissioner not started, Primary Backbone Router not found). OT_ERROR_NO_BUFSIf insufficient message buffers available.
◆ otIp6RemoveAllUnsecurePorts()
| void otIp6RemoveAllUnsecurePorts | ( | otInstance * |
aInstance
|
) |
This function removes all ports from the allowed unsecure port list.
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance.
◆ otIp6RemoveUnicastAddress()
| otError 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 aAddressis an internal address.OT_ERROR_NOT_FOUNDThe IP Address indicated by aAddresswas not found.
◆ otIp6RemoveUnsecurePort()
| otError otIp6RemoveUnsecurePort | ( | otInstance * |
aInstance,
|
| uint16_t |
aPort
|
||
| ) |
This function removes a port from the allowed unsecure port list.
- Note
-
This function removes
aPortby overwritingaPortwith the element afteraPortin 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_INVALID_ARGSThe port is invalid (value 0 is reserved for internal use). OT_ERROR_NOT_FOUNDThe port was not found in the unsecure port list.
◆ otIp6SelectSourceAddress()
| otError otIp6SelectSourceAddress | ( | otInstance * |
aInstance,
|
| otMessageInfo * |
aMessageInfo
|
||
| ) |
This function perform OpenThread source address selection.
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance. [in,out] aMessageInfoA pointer to the message information.
- Return values
-
OT_ERROR_NONEFound a source address and is filled into mSockAddr of aMessageInfo.OT_ERROR_NOT_FOUNDNo source address was found and aMessageInfois unchanged.
◆ otIp6Send()
| otError otIp6Send | ( | otInstance * |
aInstance,
|
| otMessage * |
aMessage
|
||
| ) |
This function sends an IPv6 datagram via the Thread interface.
The caller transfers ownership of
aMessage
when making this call. OpenThread will free
aMessage
when processing is complete, including when a value other than
OT_ERROR_NONE
is returned.
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance. [in] aMessageA pointer to the message buffer containing the IPv6 datagram.
- Return values
-
OT_ERROR_NONESuccessfully processed the message. OT_ERROR_DROPMessage was well-formed but not fully processed due to packet processing rules. OT_ERROR_NO_BUFSCould not allocate necessary message buffers when processing the datagram. OT_ERROR_NO_ROUTENo route to host. OT_ERROR_INVALID_SOURCE_ADDRESSSource address is invalid, e.g. an anycast address or a multicast address. OT_ERROR_PARSEEncountered a malformed header when processing the message.
◆ otIp6SetAddressCallback()
| void otIp6SetAddressCallback | ( | otInstance * |
aInstance,
|
| otIp6AddressCallback |
aCallback,
|
||
| void * |
aCallbackContext
|
||
| ) |
This function registers a callback to notify internal IPv6 address changes.
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance. [in] aCallbackA pointer to a function that is called when an internal IPv6 address is added or removed. NULL to disable the callback. [in] aCallbackContextA pointer to application-specific context.
◆ otIp6SetEnabled()
| otError otIp6SetEnabled | ( | otInstance * |
aInstance,
|
| bool |
aEnabled
|
||
| ) |
This function brings up/down 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 brought the IPv6 interface up/down. OT_ERROR_INVALID_STATEIPv6 interface is not available since device is operating in raw-link mode (applicable only when OPENTHREAD_CONFIG_LINK_RAW_ENABLEfeature is enabled).
◆ otIp6SetMeshLocalIid()
| otError otIp6SetMeshLocalIid | ( | otInstance * |
aInstance,
|
| const otIp6InterfaceIdentifier * |
aIid
|
||
| ) |
This function sets the Mesh Local IID (for test purpose).
Only available when
OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
is enabled.
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance. [in] aIidA pointer to the Mesh Local IID to set.
- Return values
-
OT_ERROR_NONESuccessfully set the Mesh Local IID. OT_ERROR_INVALID_STATEThread protocols are enabled.
◆ otIp6SetMulticastPromiscuousEnabled()
| 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
◆ otIp6SetReceiveCallback()
| 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.
◆ 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
◆ otIp6SetSlaacEnabled()
| void otIp6SetSlaacEnabled | ( | otInstance * |
aInstance,
|
| bool |
aEnabled
|
||
| ) |
This function enables/disables the SLAAC module.
This function requires the build-time feature
OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE
to be enabled.
When SLAAC module is enabled, SLAAC addresses (based on on-mesh prefixes in Network Data) are added to the interface. When SLAAC module is disabled any previously added SLAAC address is removed.
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance. [in] aEnabledTRUE to enable, FALSE to disable.
◆ otIp6SetSlaacPrefixFilter()
| void otIp6SetSlaacPrefixFilter | ( | otInstance * |
aInstance,
|
| otIp6SlaacPrefixFilter |
aFilter
|
||
| ) |
This function sets the SLAAC module filter handler.
This function requires the build-time feature
OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE
to be enabled.
The filter handler is called by SLAAC module when it is about to add a SLAAC address based on a prefix to decide whether the address should be added or not.
A NULL filter handler disables filtering and allows all SLAAC addresses to be added.
If this function is not called, the default filter used by SLAAC module will be NULL (filtering is disabled).
- Parameters
-
[in] aInstanceA pointer to an OpenThread instance. [in] aFilterA pointer to SLAAC prefix filter handler, or NULL to disable filtering.
◆ otIp6SockAddrToString()
| void otIp6SockAddrToString | ( | const otSockAddr * |
aSockAddr,
|
| char * |
aBuffer,
|
||
| uint16_t |
aSize
|
||
| ) |
This function converts a given IPv6 socket address to a human-readable string.
The IPv6 socket address string is formatted as "[<address>]:<port>" where `<address> is shown as 16 hex values separated by ':' and
<port>
is the port number in decimal format (i.e., "[%x:%x:...:%x]:%u")
If the resulting string does not fit in
aBuffer
(within its
aSize
characters), the string will be truncated but the outputted string is always null-terminated.
- Parameters
-
[in] aSockAddrA pointer to an IPv6 socket address (MUST NOT be NULL). [out] aBufferA pointer to a char array to output the string (MUST NOT be NULL). [in] aSizeThe size of aBuffer(in bytes). Recommended to useOT_IP6_SOCK_ADDR_STRING_SIZE.
◆ otIp6SubscribeMulticastAddress()
| 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_IP6_MAX_EXT_MCAST_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 aAddressis an invalid multicast address.OT_ERROR_REJECTEDThe IP Address indicated by aAddressis an internal multicast address.OT_ERROR_NO_BUFSThe Network Interface is already storing the maximum allowed external multicast addresses.
◆ otIp6UnsubscribeMulticastAddress()
| 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_REJECTEDThe IP Address indicated by aAddressis an internal address.OT_ERROR_NOT_FOUNDThe IP Address indicated by aAddresswas not found.