Skip to content

Commit

Permalink
[udp] remove aIpProto from Ip6::Udp::SendDatagram() (openthread#9547
Browse files Browse the repository at this point in the history
)

This commit removes the input `aIpProto` in `Upd::HandleDatagram()`
method and assumes `kProtoUdp`.
  • Loading branch information
abtink authored Oct 19, 2023
1 parent 95b0869 commit 1b59c97
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/core/api/udp_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ otError otUdpSendDatagram(otInstance *aInstance, otMessage *aMessage, otMessageI

VerifyOrExit(!AsCoreType(aMessage).IsOriginThreadNetif(), error = kErrorInvalidArgs);

return AsCoreType(aInstance).Get<Ip6::Udp>().SendDatagram(AsCoreType(aMessage), AsCoreType(aMessageInfo),
Ip6::kProtoUdp);
return AsCoreType(aInstance).Get<Ip6::Udp>().SendDatagram(AsCoreType(aMessage), AsCoreType(aMessageInfo));
exit:
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/meshcop/border_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ template <> void BorderAgent::HandleTmf<kUriProxyTx>(Coap::Message &aMessage, co

SuccessOrExit(error = Tlv::Find<Ip6AddressTlv>(aMessage, messageInfo.GetPeerAddr()));

SuccessOrExit(error = Get<Ip6::Udp>().SendDatagram(*message, messageInfo, Ip6::kProtoUdp));
SuccessOrExit(error = Get<Ip6::Udp>().SendDatagram(*message, messageInfo));
mUdpProxyPort = udpEncapHeader.GetSourcePort();

LogInfo("Proxy transmit sent to %s", messageInfo.GetPeerAddr().ToString().AsCString());
Expand Down
6 changes: 3 additions & 3 deletions src/core/net/udp6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ Error Udp::SendTo(SocketHandle &aSocket, Message &aMessage, const MessageInfo &a
else
#endif
{
SuccessOrExit(error = SendDatagram(aMessage, messageInfoLocal, kProtoUdp));
SuccessOrExit(error = SendDatagram(aMessage, messageInfoLocal));
}

exit:
Expand Down Expand Up @@ -427,7 +427,7 @@ Message *Udp::NewMessage(uint16_t aReserved, const Message::Settings &aSettings)
return Get<Ip6>().NewMessage(sizeof(Header) + aReserved, aSettings);
}

Error Udp::SendDatagram(Message &aMessage, MessageInfo &aMessageInfo, uint8_t aIpProto)
Error Udp::SendDatagram(Message &aMessage, MessageInfo &aMessageInfo)
{
Error error = kErrorNone;

Expand All @@ -451,7 +451,7 @@ Error Udp::SendDatagram(Message &aMessage, MessageInfo &aMessageInfo, uint8_t aI
SuccessOrExit(error = aMessage.Prepend(udpHeader));
aMessage.SetOffset(0);

error = Get<Ip6>().SendDatagram(aMessage, aMessageInfo, aIpProto);
error = Get<Ip6>().SendDatagram(aMessage, aMessageInfo, kProtoUdp);
}

exit:
Expand Down
3 changes: 1 addition & 2 deletions src/core/net/udp6.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,13 +585,12 @@ class Udp : public InstanceLocator, private NonCopyable
*
* @param[in] aMessage A reference to the message.
* @param[in] aMessageInfo A reference to the message info associated with @p aMessage.
* @param[in] aIpProto The Internet Protocol value.
*
* @retval kErrorNone Successfully enqueued the message into an output interface.
* @retval kErrorNoBufs Insufficient available buffer to add the IPv6 headers.
*
*/
Error SendDatagram(Message &aMessage, MessageInfo &aMessageInfo, uint8_t aIpProto);
Error SendDatagram(Message &aMessage, MessageInfo &aMessageInfo);

/**
* Handles a received UDP message.
Expand Down

0 comments on commit 1b59c97

Please sign in to comment.