[tmf] introduce DeclareTmfResponseHandlerIn helper macros (#12187)

This commit introduces two new macros, `DeclareTmfResponseHandlerIn`
and `DeclareTmfResponseHandlerFullParamIn`, to simplify the
definition of TMF/CoAP response handlers.

These macros generate the boilerplate code for the `static` callback
method within a class and delegate the call to a non-static member
method with the same name. This removes the repetitive pattern of
manually defining the `static` wrapper in each class.

The existing response handlers across various core components are
updated to use the new helper macros.
This commit is contained in:
Abtin Keshavarzian
2025-12-01 10:21:01 -08:00
committed by GitHub
parent 578467b78c
commit c0f4cccc65
19 changed files with 77 additions and 212 deletions
+1 -11
View File
@@ -539,18 +539,8 @@ exit:
FreeMessageOnError(message, error);
}
void DuaManager::HandleDuaResponse(void *aContext,
otMessage *aMessage,
const otMessageInfo *aMessageInfo,
otError aResult)
void DuaManager::HandleDuaResponse(Coap::Message *aMessage, Error aResult)
{
static_cast<DuaManager *>(aContext)->HandleDuaResponse(AsCoapMessagePtr(aMessage), AsCoreTypePtr(aMessageInfo),
aResult);
}
void DuaManager::HandleDuaResponse(Coap::Message *aMessage, const Ip6::MessageInfo *aMessageInfo, Error aResult)
{
OT_UNUSED_VARIABLE(aMessageInfo);
Error error;
mIsDuaPending = false;