TREL - Thread Stack#

This module defines Thread Radio Encapsulation Link (TREL) APIs for Thread Over Infrastructure.

The functions in this module require OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE to be enabled.

Modules#

otTrelPeer

Typedefs#

typedef struct otTrelPeer

Represents a TREL peer.

typedef uint16_t

Represents an iterator for iterating over TREL peer table entries.

Represents a group of TREL related counters.

Functions#

void
otTrelSetEnabled(otInstance *aInstance, bool aEnable)

Enables or disables TREL operation.

bool
otTrelIsEnabled(otInstance *aInstance)

Indicates whether the TREL operation is enabled.

void
otTrelInitPeerIterator(otInstance *aInstance, otTrelPeerIterator *aIterator)

Initializes a peer table iterator.

const otTrelPeer *
otTrelGetNextPeer(otInstance *aInstance, otTrelPeerIterator *aIterator)

Iterates over the peer table entries and get the next entry from the table.

uint16_t
otTrelGetNumberOfPeers(otInstance *aInstance)

Returns the number of TREL peers.

void
otTrelSetFilterEnabled(otInstance *aInstance, bool aEnable)

Sets the filter mode (enables/disables filtering).

bool
otTrelIsFilterEnabled(otInstance *aInstance)

Indicates whether or not the filter mode is enabled.

otTrelGetCounters(otInstance *aInstance)

Gets the TREL counters.

void
otTrelResetCounters(otInstance *aInstance)

Resets the TREL counters.

Typedef Documentation#

otTrelPeer#

typedef struct otTrelPeer otTrelPeer

Represents a TREL peer.


otTrelPeerIterator#

typedef uint16_t otTrelPeerIterator

Represents an iterator for iterating over TREL peer table entries.


otTrelCounters#

typedef otPlatTrelCounters otTrelCounters

Represents a group of TREL related counters.


Function Documentation#

otTrelSetEnabled#

void otTrelSetEnabled (otInstance * aInstance, bool aEnable)

Enables or disables TREL operation.

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

A pointer to an OpenThread instance.

bool[in]aEnable

A boolean to enable/disable the TREL operation.

When aEnable is true, this function initiates an ongoing DNS-SD browse on the service name "_trel._udp" within the local browsing domain to discover other devices supporting TREL. Device also registers a new service to be advertised using DNS-SD, with the service name is "_trel._udp" indicating its support for TREL. Device is then ready to receive TREL messages from peers.

When aEnable is false, this function stops the DNS-SD browse on the service name "_trel._udp", stops advertising TREL DNS-SD service, and clears the TREL peer table.

Note

  • By default the OpenThread stack enables the TREL operation on start.


otTrelIsEnabled#

bool otTrelIsEnabled (otInstance * aInstance)

Indicates whether the TREL operation is enabled.

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

The OpenThread instance.


otTrelInitPeerIterator#

void otTrelInitPeerIterator (otInstance * aInstance, otTrelPeerIterator * aIterator)

Initializes a peer table iterator.

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

The OpenThread instance.

otTrelPeerIterator *[in]aIterator

The iterator to initialize.


otTrelGetNextPeer#

const otTrelPeer * otTrelGetNextPeer (otInstance * aInstance, otTrelPeerIterator * aIterator)

Iterates over the peer table entries and get the next entry from the table.

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

The OpenThread instance.

otTrelPeerIterator *[in]aIterator

The iterator. MUST be initialized.

Returns

  • A pointer to the next otTrelPeer entry or NULL if no more entries in the table.


otTrelGetNumberOfPeers#

uint16_t otTrelGetNumberOfPeers (otInstance * aInstance)

Returns the number of TREL peers.

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

A pointer to an OpenThread instance.

Returns

  • The number of TREL peers.


otTrelSetFilterEnabled#

void otTrelSetFilterEnabled (otInstance * aInstance, bool aEnable)

Sets the filter mode (enables/disables filtering).

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

The OpenThread instance.

bool[in]aEnable

TRUE to enable filter mode, FALSE to disable filter mode.

When filter mode is enabled, any rx and tx traffic through TREL interface is silently dropped. This is mainly intended for use during testing.

Unlike otTrel{Enable/Disable}() which fully starts/stops the TREL operation, when filter mode is enabled the TREL interface continues to be enabled.


otTrelIsFilterEnabled#

bool otTrelIsFilterEnabled (otInstance * aInstance)

Indicates whether or not the filter mode is enabled.

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

The OpenThread instance.


otTrelGetCounters#

const otTrelCounters * otTrelGetCounters (otInstance * aInstance)

Gets the TREL counters.

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

A pointer to an OpenThread instance.

Returns

  • A pointer to the TREL counters.


otTrelResetCounters#

void otTrelResetCounters (otInstance * aInstance)

Resets the TREL counters.

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

A pointer to an OpenThread instance.