Function openthread_sys::otPlatTrelEnable

source ·
pub unsafe extern "C" fn otPlatTrelEnable(
    aInstance: *mut otInstance,
    aUdpPort: *mut u16,
)
Expand description

Initializes and enables TREL platform layer.

Upon this call, the platform layer MUST perform the following:

  1. TREL platform layer MUST open a UDP socket to listen for and receive TREL messages from peers. The socket is bound to an ephemeral port number chosen by the platform layer. The port number MUST be returned in @p aUdpPort. The socket is also bound to network interface(s) on which TREL is to be supported. The socket and the chosen port should stay valid while TREL is enabled.

  2. Platform layer MUST initiate an ongoing DNS-SD browse on the service name “_trel._udp” within the local browsing domain to discover other devices supporting TREL. The ongoing browse will produce two different types of events: “add” events and “remove” events. When the browse is started, it should produce an “add” event for every TREL peer currently present on the network. Whenever a TREL peer goes offline, a “remove” event should be produced. “remove” events are not guaranteed, however. When a TREL service instance is discovered, a new ongoing DNS-SD query for an AAAA record should be started on the hostname indicated in the SRV record of the discovered instance. If multiple host IPv6 addressees are discovered for a peer, one with highest scope among all addresses MUST be reported (if there are multiple address at same scope, one must be selected randomly).

TREL platform MUST signal back the discovered peer info using otPlatTrelHandleDiscoveredPeerInfo() callback. This callback MUST be invoked when a new peer is discovered, when there is a change in an existing entry (e.g., new TXT record or new port number or new IPv6 address), or when the peer is removed.

@param[in] aInstance The OpenThread instance. @param[out] aUdpPort A pointer to return the selected port number by platform layer.