Skip to content

Commit

Permalink
[secure-transport] Rename HandleUdpReceive to `HandleSecureTranspor…
Browse files Browse the repository at this point in the history
…tReceive`

This commit documents `HandleSecureTransportReceive` previously called `HandleUdpReceive`.
  • Loading branch information
canisLupus1313 committed Dec 6, 2023
1 parent 4ed44bc commit 18de5f9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/core/coap/coap_secure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class CoapSecure : public CoapBase
*/
void HandleUdpReceive(ot::Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
return mDtls.HandleUdpReceive(aMessage, aMessageInfo);
return mDtls.HandleReceive(aMessage, aMessageInfo);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/core/meshcop/secure_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Error SecureTransport::Open(ReceiveHandler aReceiveHandler, ConnectedHandler aCo

VerifyOrExit(mState == kStateClosed, error = kErrorAlready);

SuccessOrExit(error = mSocket.Open(&SecureTransport::HandleUdpReceive, this));
SuccessOrExit(error = mSocket.Open(&SecureTransport::HandleReceive, this));

mConnectedCallback.Set(aConnectedHandler, aContext);
mReceiveCallback.Set(aReceiveHandler, aContext);
Expand All @@ -169,12 +169,12 @@ Error SecureTransport::Connect(const Ip6::SockAddr &aSockAddr)
return error;
}

void SecureTransport::HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
void SecureTransport::HandleReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
{
static_cast<SecureTransport *>(aContext)->HandleUdpReceive(AsCoreType(aMessage), AsCoreType(aMessageInfo));
static_cast<SecureTransport *>(aContext)->HandleReceive(AsCoreType(aMessage), AsCoreType(aMessageInfo));
}

void SecureTransport::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
void SecureTransport::HandleReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
switch (mState)
{
Expand Down
14 changes: 11 additions & 3 deletions src/core/meshcop/secure_transport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,15 @@ class SecureTransport : public InstanceLocator
*/
const Ip6::MessageInfo &GetMessageInfo(void) const { return mMessageInfo; }

void HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
/**
* Checks and handles a received message provided to the SecureTransport object. If checks based on
* the message info and current connection state pass, the message is processed.
*
* @param[in] aMessage A reference to the message to receive.
* @param[in] aMessageInfo A reference to the message info associated with @p aMessage.
*
*/
void HandleReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo);

private:
enum State : uint8_t
Expand Down Expand Up @@ -530,9 +538,9 @@ class SecureTransport : public InstanceLocator
static void HandleTimer(Timer &aTimer);
void HandleTimer(void);

static void HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
static void HandleReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);

void HandleSecureTransportReceive(const uint8_t *aBuf, uint16_t aLength);
void HandleReceive(const uint8_t *aBuf, uint16_t aLength);
Error HandleSecureTransportSend(const uint8_t *aBuf, uint16_t aLength, Message::SubType aMessageSubType);

void Process(void);
Expand Down
2 changes: 1 addition & 1 deletion src/core/radio/ble_secure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Error BleSecure::HandleBleReceive(uint8_t *aBuf, uint16_t aLength)
SuccessOrExit(error = message->AppendBytes(aBuf, aLength));

// Cannot call Receive(..) directly because Setup(..) and mState are private
mTls.HandleUdpReceive(*message, messageInfo);
mTls.HandleReceive(*message, messageInfo);

exit:
FreeMessage(message);
Expand Down

0 comments on commit 18de5f9

Please sign in to comment.