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]aInstanceThe OpenThread instance structure.
[in]aBufferA buffer containing the received packet.
[in]aLengthPacket 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]aInstanceThe OpenThread instance structure.
[in]aUnicastAddressThe unicast address to add to interface and use as tx source and rx destination.
[in]aUdpPortA 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]aInstanceThe OpenThread instance structure.
[in]aBufferA pointer to buffer containing the packet to send.
[in]aLengthPacket length (number of bytes).
[in]aDestAddressThe destination IPv6 address (can be a unicast or a multicast IPv6 address).
Return values
OT_ERROR_NONEThe tx request was handled successfully.
OT_ERROR_ABORTThe 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]aInstanceThe OpenThread instance structure.
[in]aEnableIndicates whether to enable/disable the TREL interface.
Return values
OT_ERROR_NONESuccessfully changed the TREL interface test status (enabled/disabled).
OT_ERROR_FAILEDFailed to enable the TREL interface.
OT_ERROR_NOT_IMPLEMENTEDThis 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]aInstanceThe OpenThread instance structure.
[in]aMulticastAddressA 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]aInstanceThe OpenThread instance structure.
[in]aUnicastAddressThe unicast address to add to interface and use for as tx source and rx destination.