From 2a2797fe2b0a903a7fa19afae3ef340484374d5c Mon Sep 17 00:00:00 2001 From: Zang MingJie Date: Wed, 15 Sep 2021 09:23:04 +0800 Subject: [PATCH] Rename messageId into messageCounter --- src/lib/core/CHIPError.cpp | 2 +- src/lib/core/CHIPError.h | 8 ++++---- src/messaging/ReliableMessageContext.cpp | 6 +++--- src/messaging/ReliableMessageMgr.h | 7 +++---- src/transport/PeerMessageCounter.h | 4 ++-- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/lib/core/CHIPError.cpp b/src/lib/core/CHIPError.cpp index 3934a35bcb12be..89fc06801218f5 100644 --- a/src/lib/core/CHIPError.cpp +++ b/src/lib/core/CHIPError.cpp @@ -644,7 +644,7 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, CHIP_ERROR err) case CHIP_ERROR_DUPLICATE_MESSAGE_RECEIVED.AsInteger(): desc = "Duplicate message received"; break; - case CHIP_ERROR_MESSAGE_ID_OUT_OF_WINDOW.AsInteger(): + case CHIP_ERROR_MESSAGE_COUNTER_OUT_OF_WINDOW.AsInteger(): desc = "Message id out of window"; break; } diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index 29590431aacb79..6f652dc2d66e7b 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -1322,7 +1322,7 @@ using CHIP_ERROR = ::chip::ChipError; * An acknowledgment id is invalid. * */ -#define CHIP_ERROR_INVALID_ACK_MESSAGE_COUNTER CHIP_CORE_ERROR(0x65) +#define CHIP_ERROR_INVALID_ACK_MESSAGE_COUNTER CHIP_CORE_ERROR(0x65) /** * @def CHIP_ERROR_SEND_THROTTLED @@ -2171,15 +2171,15 @@ using CHIP_ERROR = ::chip::ChipError; * @brief * The fabric ID in ICA certificate doesn't match the one in NOC. */ -#define CHIP_ERROR_FABRIC_MISMATCH_ON_ICA CHIP_CORE_ERROR(0xc6) +#define CHIP_ERROR_FABRIC_MISMATCH_ON_ICA CHIP_CORE_ERROR(0xc6) /** - * @def CHIP_ERROR_MESSAGE_ID_OUT_OF_WINDOW + * @def CHIP_ERROR_MESSAGE_COUNTER_OUT_OF_WINDOW * * @brief * The message counter of the received message is out of receiving window */ -#define CHIP_ERROR_MESSAGE_ID_OUT_OF_WINDOW CHIP_CORE_ERROR(0xc7) +#define CHIP_ERROR_MESSAGE_COUNTER_OUT_OF_WINDOW CHIP_CORE_ERROR(0xc7) /** * @} diff --git a/src/messaging/ReliableMessageContext.cpp b/src/messaging/ReliableMessageContext.cpp index 79809a12e36d7d..050c66d040430d 100644 --- a/src/messaging/ReliableMessageContext.cpp +++ b/src/messaging/ReliableMessageContext.cpp @@ -150,10 +150,10 @@ uint64_t ReliableMessageContext::GetActiveRetransmitTimeoutTick() * @note * This message is part of the CHIP Reliable Messaging protocol. * - * @param[in] ackMessageCounter The messageCounter of incoming Ack message. + * @param[in] ackMessageCounter The acknowledged message counter of the incoming message. * - * @retval #CHIP_ERROR_INVALID_ACK_MESSAGE_COUNTER if the messageCounter of received Ack is not in the - * RetransTable. + * @retval #CHIP_ERROR_INVALID_ACK_MESSAGE_COUNTER if acknowledged message counter of received packet is not in the + * RetransTable. * @retval #CHIP_NO_ERROR if the context was removed. * */ diff --git a/src/messaging/ReliableMessageMgr.h b/src/messaging/ReliableMessageMgr.h index 933f651185d75e..4b1168cfe734fc 100644 --- a/src/messaging/ReliableMessageMgr.h +++ b/src/messaging/ReliableMessageMgr.h @@ -149,13 +149,12 @@ class ReliableMessageMgr * Iterate through active exchange contexts and retrans table entries. Clear the entry matching * the specified ExchangeContext and the message ID from the retransmision table. * - * @param[in] rc A pointer to the ExchangeContext object. - * - * @param[in] messageCounter message ID which has been acked. + * @param[in] rc A pointer to the ExchangeContext object. + * @param[in] ackMessageCounter The acknowledged message counter of the received packet. * * @retval #CHIP_NO_ERROR On success. */ - bool CheckAndRemRetransTable(ReliableMessageContext * rc, uint32_t messageCounter); + bool CheckAndRemRetransTable(ReliableMessageContext * rc, uint32_t ackMessageCounter); /** * Send the specified entry from the retransmission table. diff --git a/src/transport/PeerMessageCounter.h b/src/transport/PeerMessageCounter.h index 0d0e9e740374db..790b4498b96f3c 100644 --- a/src/transport/PeerMessageCounter.h +++ b/src/transport/PeerMessageCounter.h @@ -97,7 +97,7 @@ class PeerMessageCounter uint32_t offset = mSynced.mMaxCounter - counter; if (offset >= CHIP_CONFIG_MESSAGE_COUNTER_WINDOW_SIZE) { - return CHIP_ERROR_MESSAGE_ID_OUT_OF_WINDOW; // outside valid range + return CHIP_ERROR_MESSAGE_COUNTER_OUT_OF_WINDOW; // outside valid range } if (mSynced.mWindow.test(offset)) { @@ -118,7 +118,7 @@ class PeerMessageCounter return CHIP_NO_ERROR; case Status::Synced: { CHIP_ERROR err = Verify(counter); - if (err == CHIP_ERROR_MESSAGE_ID_OUT_OF_WINDOW) + if (err == CHIP_ERROR_MESSAGE_COUNTER_OUT_OF_WINDOW) { // According to chip spec, when global unencrypted message // counter is out of window, the peer may have reset and is