Modules#

otIp6InterfaceIdentifier

otIp6NetworkPrefix

otIp6AddressComponents

otIp6Address

otIp6Prefix

otNetifAddress

otNetifMulticastAddress

otSockAddr

otMessageInfo

otIp6AddressInfo

otPacketsAndBytes

otBorderRoutingCounters

IPv6#

This module includes functions that control IPv6 communication.

Enumerations#

enum
@3 {
OT_ADDRESS_ORIGIN_THREAD = 0
OT_ADDRESS_ORIGIN_SLAAC = 1
OT_ADDRESS_ORIGIN_DHCPV6 = 2
OT_ADDRESS_ORIGIN_MANUAL = 3
}

IPv6 Address origins.

enum
@4 {
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
@5 {
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.

Typedefs#

This structure represents the Interface Identifier of an IPv6 address.

typedef struct otIp6NetworkPrefix

This structure represents the Network Prefix of an IPv6 address (most significant 64 bits of the address).

typedef struct otIp6AddressComponents

This structure represents the components of an IPv6 address.

typedef struct otIp6Address

This structure represents an IPv6 address.

typedef struct otIp6Prefix

This structure represents an IPv6 prefix.

typedef struct otNetifAddress

This structure represents an IPv6 network interface unicast address.

This structure represents an IPv6 network interface multicast address.

typedef struct otSockAddr

This structure represents an IPv6 socket address.

typedef struct 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 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.

typedef struct otPacketsAndBytes

This structure represents the counters for packets and bytes.

This structure represents the counters of packets forwarded via Border Routing.

Functions#

otIp6SetEnabled(otInstance *aInstance, bool aEnabled)

Brings the IPv6 interface up or down.

bool
otIp6IsEnabled(otInstance *aInstance)

Indicates whether or not the IPv6 interface is up.

otIp6AddUnicastAddress(otInstance *aInstance, const otNetifAddress *aAddress)

Adds a Network Interface Address to the Thread interface.

otIp6RemoveUnicastAddress(otInstance *aInstance, const otIp6Address *aAddress)

Removes a Network Interface Address from the Thread interface.

otIp6GetUnicastAddresses(otInstance *aInstance)

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

otIp6SubscribeMulticastAddress(otInstance *aInstance, const otIp6Address *aAddress)

Subscribes the Thread interface to a Network Interface Multicast Address.

otIp6UnsubscribeMulticastAddress(otInstance *aInstance, const otIp6Address *aAddress)

Unsubscribes the Thread interface to a Network Interface Multicast Address.

otIp6GetMulticastAddresses(otInstance *aInstance)

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

bool
otIp6IsMulticastPromiscuousEnabled(otInstance *aInstance)

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

void
otIp6SetMulticastPromiscuousEnabled(otInstance *aInstance, bool aEnabled)

Enables or disables multicast promiscuous mode on the Thread interface.

otIp6NewMessage(otInstance *aInstance, const otMessageSettings *aSettings)

Allocate a new message buffer for sending an IPv6 message.

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().

otIp6Send(otInstance *aInstance, otMessage *aMessage)

This function sends an IPv6 datagram via the Thread interface.

otIp6AddUnsecurePort(otInstance *aInstance, uint16_t aPort)

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

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.

otIp6AddressFromString(const char *aString, otIp6Address *aAddress)

This function converts a human-readable IPv6 address string into a binary representation.

otIp6PrefixFromString(const char *aString, otIp6Prefix *aPrefix)

This function converts a human-readable IPv6 prefix 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.

void
otIp6GetPrefix(const otIp6Address *aAddress, uint8_t aLength, otIp6Prefix *aPrefix)

This method gets a prefix with aLength from aAddress.

bool
otIp6IsAddressUnspecified(const otIp6Address *aAddress)

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

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.

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.

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.

otIp6GetBorderRoutingCounters(otInstance *aInstance)

Gets the Border Routing counters.

void
otIp6ResetBorderRoutingCounters(otInstance *aInstance)

Resets the Border Routing counters.

Macros#

#define

Size of an IPv6 prefix (bytes)

#define
OT_IP6_PREFIX_BITSIZE (OT_IP6_PREFIX_SIZE * 8)

Size of an IPv6 prefix (bits)

#define

Size of an IPv6 Interface Identifier (bytes)

#define

Size of an IPv6 address (bytes)

#define

Recommended size for string representation of an IPv6 address.

#define

Recommended size for string representation of an IPv6 socket address.

#define

Recommended size for string representation of an IPv6 prefix.

#define

Max number of IPv6 addresses supported by Multicast Listener Registration.

Enumeration Documentation#

@3#

@3

IPv6 Address origins.

Enumerator
OT_ADDRESS_ORIGIN_THREAD

Thread assigned address (ALOC, RLOC, MLEID, etc)

OT_ADDRESS_ORIGIN_SLAAC

SLAAC assigned address.

OT_ADDRESS_ORIGIN_DHCPV6

DHCPv6 assigned address.

OT_ADDRESS_ORIGIN_MANUAL

Manually assigned address.


Definition at line 165 of file include/openthread/ip6.h

@4#

@4

ECN statuses, represented as in the IP header.

Enumerator
OT_ECN_NOT_CAPABLE

Non-ECT.

OT_ECN_CAPABLE_0

ECT(0)

OT_ECN_CAPABLE_1

ECT(1)

OT_ECN_MARKED

Congestion encountered (CE)


Definition at line 214 of file include/openthread/ip6.h

@5#

@5

Internet Protocol Numbers.

Enumerator
OT_IP6_PROTO_HOP_OPTS

IPv6 Hop-by-Hop Option.

OT_IP6_PROTO_TCP

Transmission Control Protocol.

OT_IP6_PROTO_UDP

User Datagram.

OT_IP6_PROTO_IP6

IPv6 encapsulation.

OT_IP6_PROTO_ROUTING

Routing Header for IPv6.

OT_IP6_PROTO_FRAGMENT

Fragment Header for IPv6.

OT_IP6_PROTO_ICMP6

ICMP for IPv6.

OT_IP6_PROTO_NONE

No Next Header for IPv6.

OT_IP6_PROTO_DST_OPTS

Destination Options for IPv6.


Definition at line 246 of file include/openthread/ip6.h

Typedef Documentation#

otIp6InterfaceIdentifier#

typedef struct otIp6InterfaceIdentifier otIp6InterfaceIdentifier

This structure represents the Interface Identifier of an IPv6 address.


Definition at line 81 of file include/openthread/ip6.h

otIp6NetworkPrefix#

typedef struct otIp6NetworkPrefix otIp6NetworkPrefix

This structure represents the Network Prefix of an IPv6 address (most significant 64 bits of the address).


Definition at line 99 of file include/openthread/ip6.h

otIp6AddressComponents#

typedef struct otIp6AddressComponents otIp6AddressComponents

This structure represents the components of an IPv6 address.


Definition at line 118 of file include/openthread/ip6.h

otIp6Address#

typedef struct otIp6Address otIp6Address

This structure represents an IPv6 address.


Definition at line 142 of file include/openthread/ip6.h

otIp6Prefix#

typedef struct otIp6Prefix otIp6Prefix

This structure represents an IPv6 prefix.


Definition at line 159 of file include/openthread/ip6.h

otNetifAddress#

typedef struct otNetifAddress otNetifAddress

This structure represents an IPv6 network interface unicast address.


Definition at line 188 of file include/openthread/ip6.h

otNetifMulticastAddress#

typedef struct otNetifMulticastAddress otNetifMulticastAddress

This structure represents an IPv6 network interface multicast address.


Definition at line 198 of file include/openthread/ip6.h

otSockAddr#

typedef struct otSockAddr otSockAddr

This structure represents an IPv6 socket address.


Definition at line 208 of file include/openthread/ip6.h

otMessageInfo#

typedef struct otMessageInfo otMessageInfo

This structure represents the local and peer IPv6 socket addresses.


Definition at line 240 of file include/openthread/ip6.h

otIp6ReceiveCallback#

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

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

Parameters
[in]aMessage

A pointer to the message buffer containing the received IPv6 datagram. This function transfers the ownership of the aMessage to the receiver of the callback. The message should be freed by the receiver of the callback after it is processed (see otMessageFree()).

[in]aContext

A pointer to application-specific context.


Definition at line 431 of file include/openthread/ip6.h

otIp6AddressInfo#

typedef struct otIp6AddressInfo otIp6AddressInfo

Definition at line 462 of file include/openthread/ip6.h

otIp6AddressCallback#

typedef void(* otIp6AddressCallback) (const otIp6AddressInfo *aAddressInfo, bool aIsAdded, void *aContext) )(const otIp6AddressInfo *aAddressInfo, bool aIsAdded, void *aContext)

This function pointer is called when an internal IPv6 address is added or removed.

Parameters
[in]aAddressInfo

A pointer to the IPv6 address information.

[in]aIsAdded

TRUE if the aAddress was added, FALSE if aAddress was removed.

[in]aContext

A pointer to application-specific context.


Definition at line 472 of file include/openthread/ip6.h

otIp6SlaacPrefixFilter#

typedef bool(* otIp6SlaacPrefixFilter) (otInstance *aInstance, const otIp6Prefix *aPrefix) )(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.

Parameters
[in]aInstance

A pointer to an OpenThread instance.

[in]aPrefix

A pointer to prefix for which SLAAC address is about 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.


Definition at line 770 of file include/openthread/ip6.h

otIp6RegisterMulticastListenersCallback#

typedef void(* otIp6RegisterMulticastListenersCallback) (void *aContext, otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, uint8_t aFailedAddressNum) )(void *aContext, otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, uint8_t aFailedAddressNum)

This function pointer is called with results of otIp6RegisterMulticastListeners.

Parameters
[in]aContext

A pointer to the user context.

[in]aError

OT_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]aMlrStatus

The Multicast Listener Registration status when aError is OT_ERROR_NONE.

[in]aFailedAddresses

A pointer to the failed IPv6 addresses when aError is OT_ERROR_NONE.

[in]aFailedAddressNum

The number of failed IPv6 addresses when aError is OT_ERROR_NONE.

See Also


Definition at line 804 of file include/openthread/ip6.h

otPacketsAndBytes#

typedef struct otPacketsAndBytes otPacketsAndBytes

This structure represents the counters for packets and bytes.


Definition at line 877 of file include/openthread/ip6.h

otBorderRoutingCounters#

typedef struct otBorderRoutingCounters otBorderRoutingCounters

This structure represents the counters of packets forwarded via Border Routing.


Definition at line 895 of file include/openthread/ip6.h

Variable Documentation#

OT_TOOL_PACKED_END#

OT_TOOL_PACKED_BEGIN struct otIp6Prefix OT_TOOL_PACKED_END

Definition at line 75 of file include/openthread/ip6.h

Function Documentation#

otIp6SetEnabled#

otError otIp6SetEnabled (otInstance *aInstance, bool aEnabled)

Brings the IPv6 interface up or down.

Parameters
[in]aInstance

A pointer to an OpenThread instance.

[in]aEnabled

TRUE to enable IPv6, FALSE otherwise.

Call this to enable or disable IPv6 communication.


Definition at line 272 of file include/openthread/ip6.h

otIp6IsEnabled#

bool otIp6IsEnabled (otInstance *aInstance)

Indicates whether or not the IPv6 interface is up.

Parameters
[in]aInstance

A pointer to an OpenThread instance.


Definition at line 283 of file include/openthread/ip6.h

otIp6AddUnicastAddress#

otError otIp6AddUnicastAddress (otInstance *aInstance, const otNetifAddress *aAddress)

Adds a Network Interface Address to the Thread interface.

Parameters
[in]aInstance

A pointer to an OpenThread instance.

[in]aAddress

A pointer to a Network Interface Address.

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.


Definition at line 298 of file include/openthread/ip6.h

otIp6RemoveUnicastAddress#

otError otIp6RemoveUnicastAddress (otInstance *aInstance, const otIp6Address *aAddress)

Removes a Network Interface Address from the Thread interface.

Parameters
[in]aInstance

A pointer to an OpenThread instance.

[in]aAddress

A pointer to an IP Address.


Definition at line 310 of file include/openthread/ip6.h

otIp6GetUnicastAddresses#

const otNetifAddress * otIp6GetUnicastAddresses (otInstance *aInstance)

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

Parameters
[in]aInstance

A pointer to an OpenThread instance.

Returns

  • A pointer to the first Network Interface Address.


Definition at line 319 of file include/openthread/ip6.h

otIp6SubscribeMulticastAddress#

otError otIp6SubscribeMulticastAddress (otInstance *aInstance, const otIp6Address *aAddress)

Subscribes the Thread interface to a Network Interface Multicast Address.

Parameters
[in]