[coap] rename and clarify response sending methods (#12647)

This commit updates several method names in `CoapBase` to better align
with RFC 7252 terminology and clarify their behavior.

Previously, the term "empty" was used ambiguously to mean either a
message with Code 0.00 (`kCodeEmpty`) or a message that lacked a
payload but contained a response code. For example, `SendEmptyAck()`
sent an ACK (`kTypeAck`) message that actually contained a non-zero
response code (e.g., `kCodeChanged`), which is a "response" message
per the RFC, not an "empty" message.

To address this:

- `SendReset()` and `SendAck()` are removed in favor of using
  `SendEmptyMessage()` directly with `kTypeReset` or `kTypeAck`.
  This restricts the use of "Empty" strictly to Code 0.00 messages.
- `SendHeaderResponse()` is renamed to `SendResponse()` to clarify
  that it dynamically sends a response without a payload.
- `SendEmptyAck()` is renamed to `SendAckResponse()` to indicate it
  sends a piggybacked ACK `kTypeAck` response without a payload.
- `SendNotFound()` is replaced with a direct call to `SendResponse()`
  using `kCodeNotFound`.
- Documentation comments for these methods are updated to explain
  their purpose and requirements clearly.
- Callers across the core modules are updated to use the new method
  names.
This commit is contained in:
Abtin Keshavarzian
2026-03-09 19:49:05 -05:00
committed by GitHub
parent 86bc9435ba
commit b79a6cfc8b
15 changed files with 107 additions and 100 deletions
+1 -1
View File
@@ -3648,7 +3648,7 @@ template <> void Mle::HandleTmf<kUriAddressRelease>(Coap::Msg &aMsg)
IgnoreError(mRouterTable.Release(routerId));
SuccessOrExit(Get<Tmf::Agent>().SendEmptyAck(aMsg));
SuccessOrExit(Get<Tmf::Agent>().SendAckResponse(aMsg));
Log(kMessageSend, kTypeAddressReleaseReply, aMsg.mMessageInfo.GetPeerAddr());