This module includes the platform abstraction for Thread Radio Encapsulation Link (TREL) using an IPv6/UDP interface.

Functions

void otPlatTrelUdp6Init ( otInstance *aInstance, const otIp6Address *aUnicastAddress, uint16_t aUdpPort)
This function initializes the TREL IPv6/UDP interface.
void otPlatTrelUdp6UpdateAddress ( otInstance *aInstance, const otIp6Address *aUnicastAddress)
This function updates the unicast IPv6 address for TREL IPv6/UDP interface.
void otPlatTrelUdp6SubscribeMulticastAddress ( otInstance *aInstance, const otIp6Address *aMulticastAddress)
This function subscribes the TREL IPv6/UDP interface to a new multicast address.
otError otPlatTrelUdp6SendTo ( otInstance *aInstance, const uint8_t *aBuffer, uint16_t aLength, const otIp6Address *aDestAddress)
This function requests a packet to be sent to a given destination.
void otPlatTrelUdp6HandleReceived ( otInstance *aInstance, uint8_t *aBuffer, uint16_t aLength)
This function is a callback from platform to notify of a received packet.
otError otPlatTrelUdp6SetTestMode ( otInstance *aInstance, bool aEnable)
This optional function is intended for testing only.

Detailed Description

This module includes the platform abstraction for Thread Radio Encapsulation Link (TREL) using an IPv6/UDP interface.

Function Documentation

otPlatTrelUdp6HandleReceived()

void otPlatTrelUdp6HandleReceived ( otInstance * aInstance,
uint8_t * aBuffer,
uint16_t aLength
)

This function is a callback from platform to notify of a received packet.

Note
The buffer content (up to its specified length) may get changed during processing by OpenThread core (e.g., decrypted in place), so the platform implementation should expect that after returning from this function the packet aBuffer content may have been altered.
Parameters
[in] aInstance The OpenThread instance structure.
[in] aBuffer A buffer containing the received packet.
[in] aLength Packet length (number of bytes).

otPlatTrelUdp6Init()

void otPlatTrelUdp6Init ( otInstance * aInstance,
const otIp6Address * aUnicastAddress,
uint16_t aUdpPort
)

This function initializes the TREL IPv6/UDP interface.

This function is called before any other TREL platform functions.

Parameters
[in] aInstance The OpenThread instance structure.
[in] aUnicastAddress The unicast address to add to interface and use as tx source and rx destination.
[in] aUdpPort A UDP port number to use.

otPlatTrelUdp6SendTo()

otError otPlatTrelUdp6SendTo ( otInstance * aInstance,
const uint8_t * aBuffer,
uint16_t aLength,
const otIp6Address * aDestAddress
)

This function requests a packet to be sent to a given destination.

Parameters
[in] aInstance The OpenThread instance structure.
[in] aBuffer A pointer to buffer containing the packet to send.
[in] aLength Packet length (number of bytes).
[in] aDestAddress The destination IPv6 address (can be a unicast or a multicast IPv6 address).
Return values
OT_ERROR_NONE The tx request was handled successfully.
OT_ERROR_ABORT The interface is not ready and tx was aborted

otPlatTrelUdp6SetTestMode()

otError otPlatTrelUdp6SetTestMode ( otInstance * aInstance,
bool aEnable
)

This optional function is intended for testing only.

It changes the test mode status for TREL interface.

This function requests TREL interface to be temporarily disabled or enabled. When disabled all traffic flow through the TREL interface should be silently dropped.

A default weak implementation of this method is provided by OpenThread (returning NOT_IMPLEMENTED).

Parameters
[in] aInstance The OpenThread instance structure.
[in] aEnable Indicates whether to enable/disable the TREL interface.
Return values
OT_ERROR_NONE Successfully changed the TREL interface test status (enabled/disabled).
OT_ERROR_FAILED Failed to enable the TREL interface.
OT_ERROR_NOT_IMPLEMENTED This function is not provided by the platform.

otPlatTrelUdp6SubscribeMulticastAddress()

void otPlatTrelUdp6SubscribeMulticastAddress ( otInstance * aInstance,
const otIp6Address * aMulticastAddress
)

This function subscribes the TREL IPv6/UDP interface to a new multicast address.

This function may be called multiple times to subscribe to different addresses. The interface should accept/receive packets destined to any previously subscribed multicast address in addition to the unicast address added from the otPlatTrelUdp6Init() function when interface was initialized.

Parameters
[in] aInstance The OpenThread instance structure.
[in] aMulticastAddress A multicast IPv6 address.

otPlatTrelUdp6UpdateAddress()

void otPlatTrelUdp6UpdateAddress ( otInstance * aInstance,
const otIp6Address * aUnicastAddress
)

This function updates the unicast IPv6 address for TREL IPv6/UDP interface.

The interface should only have one unicast IPv6 address. Calling this function replaces any previously set unicast IPv6 address (during initialization from otPlatTrelUdp6Init or earlier calls to otPlatTrelUdp6UpdateAddress() ).

Parameters
[in] aInstance The OpenThread instance structure.
[in] aUnicastAddress The unicast address to add to interface and use for as tx source and rx destination.