mirror of
https://github.com/espressif/openthread.git
synced 2026-08-11 21:27:46 +00:00
[net] add support for DNS Stateful Operations (DSO) (#7081)
This commit adds support for DNS Stateful Operations (DSO) as specified in RFC 8490. It adds `platform/dso_transport.hpp` header file which defines the platform APIs/callbacks for DSO transport layer (e.g., DSN-over-TLS or DNS-over-TCP). The `Dso` module handles establishing connection with a peer, acting either as a DSO client or server, establishing a DSO session over a connection, and then sending and processing DSO request, response, and unidirectional messages (including support for DSO TLV formats). The `Dso` module also manages the session life cycle and timeouts, namely the "Inactivity" and "Keep Alive" timeouts (including sending and processing of Keep Alive messages when needed). It also handles adding encryption padding before sending a message. It implements the padding policy "Random-Block-Length Padding" from RFC 8467. This commit also adds a detailed unit test `test_dso` covering the behavior (including corner cases) of the `Dso` implementation. The unit test provides an implementation of the DSO platform APIs which emulate the DSO transport layer. It also includes a simplified alarm platform implementation (emulating timers and allowing time to advance in the unit test). These allow the unit test to cover more complicated situations and behaviors (timeouts, failures, etc).
This commit is contained in:
@@ -557,4 +557,33 @@ otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aTh
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_DNS_DSO_ENABLE
|
||||
|
||||
OT_TOOL_WEAK void otPlatDsoEnableListening(otInstance *aInstance, bool aEnable)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aEnable);
|
||||
}
|
||||
|
||||
OT_TOOL_WEAK void otPlatDsoConnect(otPlatDsoConnection *aConnection, const otSockAddr *aPeerSockAddr)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aConnection);
|
||||
OT_UNUSED_VARIABLE(aPeerSockAddr);
|
||||
}
|
||||
|
||||
OT_TOOL_WEAK void otPlatDsoSend(otPlatDsoConnection *aConnection, otMessage *aMessage)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aConnection);
|
||||
OT_UNUSED_VARIABLE(aMessage);
|
||||
}
|
||||
|
||||
OT_TOOL_WEAK void otPlatDsoDisconnect(otPlatDsoConnection *aConnection, otPlatDsoDisconnectMode aMode)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aConnection);
|
||||
OT_UNUSED_VARIABLE(aMode);
|
||||
}
|
||||
|
||||
#endif // #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user