diff --git a/examples/minimal-mdns/PacketReporter.cpp b/examples/minimal-mdns/PacketReporter.cpp
index 1fdc9f3a8f9a44..0c26177a9bce5b 100644
--- a/examples/minimal-mdns/PacketReporter.cpp
+++ b/examples/minimal-mdns/PacketReporter.cpp
@@ -129,7 +129,7 @@ void PrintQName(mdns::Minimal::SerializedQNameIterator it)
void PacketReporter::OnHeader(mdns::Minimal::ConstHeaderRef & header)
{
- printf("%s%s %d (%d, %d, %d, %d):\n", mPrefix, header.GetFlags().IsQuery() ? "QUERY" : "REPLY", header.GetMessageId(),
+ printf("%s%s %d (%d, %d, %d, %d):\n", mPrefix, header.GetFlags().IsQuery() ? "QUERY" : "REPLY", header.GetMessageCounter(),
header.GetQueryCount(), header.GetAnswerCount(), header.GetAuthorityCount(), header.GetAdditionalCount());
}
diff --git a/examples/minimal-mdns/client.cpp b/examples/minimal-mdns/client.cpp
index 3637f41b9c248b..f4ed9917fdd79d 100644
--- a/examples/minimal-mdns/client.cpp
+++ b/examples/minimal-mdns/client.cpp
@@ -48,8 +48,8 @@ struct Options
mdns::Minimal::QType type = mdns::Minimal::QType::ANY;
} gOptions;
-constexpr uint32_t kTestMessageId = 0x1234;
-constexpr size_t kMdnsMaxPacketSize = 1'024;
+constexpr uint32_t kTestMessageCounter = 0x1234;
+constexpr size_t kMdnsMaxPacketSize = 1'024;
using namespace chip::ArgParser;
@@ -263,7 +263,7 @@ void BroadcastPacket(mdns::Minimal::ServerBase * server)
mdns::Minimal::QueryBuilder builder(std::move(buffer));
- builder.Header().SetMessageId(kTestMessageId);
+ builder.Header().SetMessageCounter(kTestMessageCounter);
builder.AddQuery(query
.MdnsQuery() //
.SetClass(mdns::Minimal::QClass::IN) //
diff --git a/examples/minimal-mdns/server.cpp b/examples/minimal-mdns/server.cpp
index 24821422ba1e2f..4f7d9466b451d6 100644
--- a/examples/minimal-mdns/server.cpp
+++ b/examples/minimal-mdns/server.cpp
@@ -135,12 +135,12 @@ class ReplyDelegate : public mdns::Minimal::ServerDelegate, public mdns::Minimal
}
// ParserDelegate
- void OnHeader(mdns::Minimal::ConstHeaderRef & header) override { mMessageId = header.GetMessageId(); }
+ void OnHeader(mdns::Minimal::ConstHeaderRef & header) override { mMessageCounter = header.GetMessageCounter(); }
void OnResource(mdns::Minimal::ResourceType type, const mdns::Minimal::ResourceData & data) override {}
void OnQuery(const mdns::Minimal::QueryData & data) override
{
- if (mResponder->Respond(mMessageId, data, mCurrentSource) != CHIP_NO_ERROR)
+ if (mResponder->Respond(mMessageCounter, data, mCurrentSource) != CHIP_NO_ERROR)
{
printf("FAILED to respond!\n");
}
@@ -158,7 +158,7 @@ class ReplyDelegate : public mdns::Minimal::ServerDelegate, public mdns::Minimal
mdns::Minimal::ResponseSender * mResponder;
const Inet::IPPacketInfo * mCurrentSource = nullptr;
- uint32_t mMessageId = 0;
+ uint32_t mMessageCounter = 0;
};
} // namespace
diff --git a/src/app/clusters/messaging-client/messaging-client.cpp b/src/app/clusters/messaging-client/messaging-client.cpp
index 03035eadd6e06e..aee1769ee9d06e 100644
--- a/src/app/clusters/messaging-client/messaging-client.cpp
+++ b/src/app/clusters/messaging-client/messaging-client.cpp
@@ -79,7 +79,7 @@ void emAfPluginMessagingClientClearMessage(EndpointId endpoint)
{
messageTable[ep].valid = false;
messageTable[ep].active = false;
- messageTable[ep].messageId = 0x00000000UL;
+ messageTable[ep].messageCounter = 0x00000000UL;
messageTable[ep].messageControl = 0x00;
messageTable[ep].startTime = 0x00000000UL;
messageTable[ep].endTime = 0x00000000UL;
@@ -123,9 +123,9 @@ void emberAfMessagingClusterClientTickCallback(EndpointId endpoint)
}
}
-bool emberAfMessagingClusterDisplayMessageCallback(app::CommandHandler * commandObj, uint32_t messageId, uint8_t messageControl,
- uint32_t startTime, uint16_t durationInMinutes, uint8_t * msg,
- uint8_t optionalExtendedMessageControl)
+bool emberAfMessagingClusterDisplayMessageCallback(app::CommandHandler * commandObj, uint32_t messageCounter,
+ uint8_t messageControl, uint32_t startTime, uint16_t durationInMinutes,
+ uint8_t * msg, uint8_t optionalExtendedMessageControl)
{
EndpointId endpoint = emberAfCurrentEndpoint();
uint8_t ep = emberAfFindClusterClientEndpointIndex(endpoint, ZCL_MESSAGING_CLUSTER_ID);
@@ -134,11 +134,11 @@ bool emberAfMessagingClusterDisplayMessageCallback(app::CommandHandler * command
emberAfMessagingClusterPrint("RX: DisplayMessage"
" 0x%4x, 0x%x, 0x%4x, 0x%2x, \"",
- messageId, messageControl, startTime, durationInMinutes);
+ messageCounter, messageControl, startTime, durationInMinutes);
emberAfMessagingClusterPrintString(msg);
emberAfMessagingClusterPrintln("\"");
- if (emberAfPluginMessagingClientPreDisplayMessageCallback(messageId, messageControl, startTime, durationInMinutes, msg,
+ if (emberAfPluginMessagingClientPreDisplayMessageCallback(messageCounter, messageControl, startTime, durationInMinutes, msg,
optionalExtendedMessageControl))
{
goto kickout;
@@ -159,7 +159,7 @@ bool emberAfMessagingClusterDisplayMessageCallback(app::CommandHandler * command
if (messageTable[ep].active)
{
// First check whether it is a duplicate message
- if (messageId == messageTable[ep].messageId)
+ if (messageCounter == messageTable[ep].messageCounter)
{
// Duplicate message from a different ESI, add the ESI to the bitmask
if (esiIndex < EMBER_AF_PLUGIN_ESI_MANAGEMENT_ESI_TABLE_SIZE &&
@@ -187,7 +187,7 @@ bool emberAfMessagingClusterDisplayMessageCallback(app::CommandHandler * command
}
messageTable[ep].clientEndpoint = emberAfCurrentCommand()->apsFrame->destinationEndpoint;
- messageTable[ep].messageId = messageId;
+ messageTable[ep].messageCounter = messageCounter;
messageTable[ep].messageControl = messageControl;
messageTable[ep].startTime = (startTime == ZCL_MESSAGING_CLUSTER_START_TIME_NOW ? now : startTime);
messageTable[ep].endTime =
@@ -244,7 +244,7 @@ bool emberAfMessagingClusterDisplayMessageCallback(app::CommandHandler * command
return true;
}
-bool emberAfMessagingClusterCancelMessageCallback(app::CommandHandler * commandObj, uint32_t messageId, uint8_t messageControl)
+bool emberAfMessagingClusterCancelMessageCallback(app::CommandHandler * commandObj, uint32_t messageCounter, uint8_t messageControl)
{
EndpointId endpoint = emberAfCurrentEndpoint();
uint8_t ep = emberAfFindClusterClientEndpointIndex(endpoint, ZCL_MESSAGING_CLUSTER_ID);
@@ -255,9 +255,9 @@ bool emberAfMessagingClusterCancelMessageCallback(app::CommandHandler * commandO
return false;
}
- emberAfMessagingClusterPrintln("RX: CancelMessage 0x%4x, 0x%x", messageId, messageControl);
+ emberAfMessagingClusterPrintln("RX: CancelMessage 0x%4x, 0x%x", messageCounter, messageControl);
- if (messageTable[ep].active && messageTable[ep].messageId == messageId)
+ if (messageTable[ep].active && messageTable[ep].messageCounter == messageCounter)
{
messageTable[ep].active = false;
messageTable[ep].messageControl = messageControl;
@@ -288,7 +288,7 @@ void emAfPluginMessagingClientPrintInfo(EndpointId endpoint)
emberAfMessagingClusterPrintln(" vld: %p", (messageTable[ep].valid ? "YES" : "NO"));
emberAfMessagingClusterPrintln(" act: %p", (messageTable[ep].active ? "YES" : "NO"));
- emberAfMessagingClusterPrintln(" id: 0x%4x", messageTable[ep].messageId);
+ emberAfMessagingClusterPrintln(" id: 0x%4x", messageTable[ep].messageCounter);
emberAfMessagingClusterPrintln(" mc: 0x%x", messageTable[ep].messageControl);
emberAfMessagingClusterPrintln(" st: 0x%4x", messageTable[ep].startTime);
emberAfMessagingClusterPrintln(" et: 0x%4x", messageTable[ep].endTime);
@@ -326,7 +326,7 @@ EmberAfStatus emberAfPluginMessagingClientConfirmMessage(EndpointId endpoint)
nodeId = emberLookupNodeIdByEui64(esiEntry->eui64);
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_CLIENT_TO_SERVER), ZCL_MESSAGING_CLUSTER_ID,
- ZCL_MESSAGE_CONFIRMATION_COMMAND_ID, "wwus", messageTable[ep].messageId,
+ ZCL_MESSAGE_CONFIRMATION_COMMAND_ID, "wwus", messageTable[ep].messageCounter,
emberAfGetCurrentTime(), 0x00, "");
// The source and destination are reversed for the confirmation.
emberAfSetCommandEndpoints(messageTable[ep].clientEndpoint, esiEntry->endpoint);
diff --git a/src/app/clusters/messaging-server/messaging-server.cpp b/src/app/clusters/messaging-server/messaging-server.cpp
index 048d669d71e911..d8f061040700ae 100644
--- a/src/app/clusters/messaging-server/messaging-server.cpp
+++ b/src/app/clusters/messaging-server/messaging-server.cpp
@@ -94,7 +94,7 @@ bool emberAfMessagingClusterGetLastMessageCallback(app::CommandHandler * command
if (emberAfPluginMessagingServerGetMessage(endpoint, &message))
{
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_MESSAGING_CLUSTER_ID,
- ZCL_DISPLAY_MESSAGE_COMMAND_ID, "wuwvsu", message.messageId, message.messageControl,
+ ZCL_DISPLAY_MESSAGE_COMMAND_ID, "wuwvsu", message.messageCounter, message.messageControl,
message.startTime, message.durationInMinutes, message.message, message.extendedMessageControl);
emberAfGetCommandApsFrame()->options |= EMBER_APS_OPTION_SOURCE_EUI64;
emberAfSendResponse();
@@ -109,15 +109,15 @@ bool emberAfMessagingClusterGetLastMessageCallback(app::CommandHandler * command
#if defined(EMBER_AF_HAS_SPEC_VERSIONS_SE_1_0) || defined(EMBER_AF_HAS_SPEC_VERSIONS_SE_1_1B) || \
defined(EMBER_AF_HAS_SPEC_VERSIONS_SE_1_0) || defined(EMBER_AF_HAS_SPEC_VERSIONS_SE_1_1) || \
defined(EMBER_AF_HAS_SPEC_VERSIONS_SE_1_1A)
-bool emberAfMessagingClusterMessageConfirmationCallback(app::CommandHandler * commandObj, uint32_t messageId,
+bool emberAfMessagingClusterMessageConfirmationCallback(app::CommandHandler * commandObj, uint32_t messageCounter,
uint32_t confirmationTime)
#else
-bool emberAfMessagingClusterMessageConfirmationCallback(app::CommandHandler * commandObj, uint32_t messageId,
+bool emberAfMessagingClusterMessageConfirmationCallback(app::CommandHandler * commandObj, uint32_t messageCounter,
uint32_t confirmationTime, uint8_t messageConfirmationControl,
uint8_t * messageResponse)
#endif
{
- emberAfMessagingClusterPrintln("RX: MessageConfirmation 0x%4x, 0x%4x", messageId, confirmationTime);
+ emberAfMessagingClusterPrintln("RX: MessageConfirmation 0x%4x, 0x%4x", messageCounter, confirmationTime);
emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
return true;
}
@@ -198,7 +198,7 @@ void emAfPluginMessagingServerPrintInfo(EndpointId endpoint)
emberAfMessagingClusterPrintln(" vld: %s", (messageIsValid(ep) ? "YES" : "NO"));
emberAfMessagingClusterPrintln(" act: %s", (messageIsCurrentOrScheduled(endpoint) ? "YES" : "NO"));
- emberAfMessagingClusterPrintln(" id: 0x%4x", msgTable[ep].messageId);
+ emberAfMessagingClusterPrintln(" id: 0x%4x", msgTable[ep].messageCounter);
emberAfMessagingClusterPrintln(" mc: 0x%x", (msgTable[ep].messageControl & ~ZCL_MESSAGING_CLUSTER_RESERVED_MASK));
emberAfMessagingClusterPrintln(" st: 0x%4x", msgTable[ep].startTime);
emberAfMessagingClusterPrintln(" now: %s", (messageIsNow(ep) ? "YES" : "NO"));
@@ -222,7 +222,7 @@ void emberAfPluginMessagingServerDisplayMessage(EmberNodeId nodeId, uint8_t srcE
}
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_MESSAGING_CLUSTER_ID,
- ZCL_DISPLAY_MESSAGE_COMMAND_ID, "wuwvsu", message.messageId, message.messageControl,
+ ZCL_DISPLAY_MESSAGE_COMMAND_ID, "wuwvsu", message.messageCounter, message.messageControl,
message.startTime, message.durationInMinutes, message.message, message.extendedMessageControl);
emberAfSetCommandEndpoints(srcEndpoint, dstEndpoint);
emberAfGetCommandApsFrame()->options |= EMBER_APS_OPTION_SOURCE_EUI64;
@@ -245,7 +245,7 @@ void emberAfPluginMessagingServerCancelMessage(EmberNodeId nodeId, uint8_t srcEn
emberAfPluginMessagingServerGetMessage(srcEndpoint, &message);
emberAfFillExternalBuffer((ZCL_CLUSTER_SPECIFIC_COMMAND | ZCL_FRAME_CONTROL_SERVER_TO_CLIENT), ZCL_MESSAGING_CLUSTER_ID,
- ZCL_CANCEL_MESSAGE_COMMAND_ID, "wu", message.messageId, message.messageControl);
+ ZCL_CANCEL_MESSAGE_COMMAND_ID, "wu", message.messageCounter, message.messageControl);
emberAfSetCommandEndpoints(srcEndpoint, dstEndpoint);
emberAfGetCommandApsFrame()->options |= EMBER_APS_OPTION_SOURCE_EUI64;
status = emberAfSendCommandUnicast(MessageSendDestination::Direct(nodeId));
diff --git a/src/app/clusters/messaging-server/messaging-server.h b/src/app/clusters/messaging-server/messaging-server.h
index b58e621e0e6837..873208f85ccadd 100644
--- a/src/app/clusters/messaging-server/messaging-server.h
+++ b/src/app/clusters/messaging-server/messaging-server.h
@@ -63,7 +63,7 @@
typedef struct
{
/** The unique unsigned 32-bit number identifier for this message. */
- uint32_t messageId;
+ uint32_t messageCounter;
/** The control bitmask for this message. */
uint8_t messageControl;
/** The time at which the message becomes valid. */
diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h
index e7e074e66dcce1..2c18635db136ed 100644
--- a/src/app/util/af-types.h
+++ b/src/app/util/af-types.h
@@ -963,7 +963,7 @@ typedef struct
bool active;
EmberAfPluginEsiManagementBitmask esiBitmask;
chip::EndpointId clientEndpoint;
- uint32_t messageId;
+ uint32_t messageCounter;
uint8_t messageControl;
uint32_t startTime;
uint32_t endTime;
diff --git a/src/app/zap-templates/zcl/data-model/silabs/ami.xml b/src/app/zap-templates/zcl/data-model/silabs/ami.xml
index 9df7328e3572d6..c179dc27928601 100644
--- a/src/app/zap-templates/zcl/data-model/silabs/ami.xml
+++ b/src/app/zap-templates/zcl/data-model/silabs/ami.xml
@@ -75,7 +75,7 @@ limitations under the License.
Command description for DisplayMessage
-
+
@@ -86,14 +86,14 @@ limitations under the License.
The CancelMessage command provides the ability to cancel the sending or acceptance of previously sent messages.
-
+
The DisplayProtected Message command is for use with messages that are protected by a password or PIN.
-
+
@@ -116,7 +116,7 @@ limitations under the License.
The Message Confirmation command provides an indication that a Utility Customer has acknowledged and/or accepted the contents of a previously sent message. Enhanced Message Confirmation commands shall contain an answer of 'NO', 'YES' and/or a message confirmation string.
-
+
diff --git a/src/lib/mdns/Advertiser_ImplMinimalMdns.cpp b/src/lib/mdns/Advertiser_ImplMinimalMdns.cpp
index 8bc0a4387f090f..53b27906dc2ab4 100644
--- a/src/lib/mdns/Advertiser_ImplMinimalMdns.cpp
+++ b/src/lib/mdns/Advertiser_ImplMinimalMdns.cpp
@@ -125,7 +125,7 @@ class AdvertiserMinMdns : public ServiceAdvertiser,
void OnMdnsPacketData(const BytesRange & data, const chip::Inet::IPPacketInfo * info) override;
// ParserDelegate
- void OnHeader(ConstHeaderRef & header) override { mMessageId = header.GetMessageId(); }
+ void OnHeader(ConstHeaderRef & header) override { mMessageCounter = header.GetMessageCounter(); }
void OnResource(ResourceType type, const ResourceData & data) override {}
void OnQuery(const QueryData & data) override;
@@ -159,7 +159,7 @@ class AdvertiserMinMdns : public ServiceAdvertiser,
// current request handling
const chip::Inet::IPPacketInfo * mCurrentSource = nullptr;
- uint32_t mMessageId = 0;
+ uint32_t mMessageCounter = 0;
const char * mEmptyTextEntries[1] = {
"=",
@@ -190,7 +190,7 @@ void AdvertiserMinMdns::OnQuery(const QueryData & data)
LogQuery(data);
- CHIP_ERROR err = mResponseSender.Respond(mMessageId, data, mCurrentSource);
+ CHIP_ERROR err = mResponseSender.Respond(mMessageCounter, data, mCurrentSource);
if (err != CHIP_NO_ERROR)
{
ChipLogError(Discovery, "Failed to reply to query: %s", ErrorStr(err));
diff --git a/src/lib/mdns/Resolver_ImplMinimalMdns.cpp b/src/lib/mdns/Resolver_ImplMinimalMdns.cpp
index d73fb1cabb0fdf..33c5db1b1b8fa3 100644
--- a/src/lib/mdns/Resolver_ImplMinimalMdns.cpp
+++ b/src/lib/mdns/Resolver_ImplMinimalMdns.cpp
@@ -406,7 +406,7 @@ CHIP_ERROR MinMdnsResolver::SendQuery(mdns::Minimal::FullQName qname, mdns::Mini
ReturnErrorCodeIf(buffer.IsNull(), CHIP_ERROR_NO_MEMORY);
QueryBuilder builder(std::move(buffer));
- builder.Header().SetMessageId(0);
+ builder.Header().SetMessageCounter(0);
mdns::Minimal::Query query(qname);
query.SetType(type).SetClass(mdns::Minimal::QClass::IN);
@@ -490,7 +490,7 @@ CHIP_ERROR MinMdnsResolver::ResolveNodeId(const PeerId & peerId, Inet::IPAddress
ReturnErrorCodeIf(buffer.IsNull(), CHIP_ERROR_NO_MEMORY);
QueryBuilder builder(std::move(buffer));
- builder.Header().SetMessageId(0);
+ builder.Header().SetMessageCounter(0);
{
char nameBuffer[64] = "";
diff --git a/src/lib/mdns/minimal/ResponseSender.cpp b/src/lib/mdns/minimal/ResponseSender.cpp
index 34bf4f9c4c6c10..2513abb9c973d0 100644
--- a/src/lib/mdns/minimal/ResponseSender.cpp
+++ b/src/lib/mdns/minimal/ResponseSender.cpp
@@ -72,9 +72,9 @@ CHIP_ERROR ResponseSender::AddQueryResponder(QueryResponderBase * queryResponder
return CHIP_ERROR_NO_MEMORY;
}
-CHIP_ERROR ResponseSender::Respond(uint32_t messageId, const QueryData & query, const chip::Inet::IPPacketInfo * querySource)
+CHIP_ERROR ResponseSender::Respond(uint32_t messageCounter, const QueryData & query, const chip::Inet::IPPacketInfo * querySource)
{
- mSendState.Reset(messageId, query, querySource);
+ mSendState.Reset(messageCounter, query, querySource);
// Responder has a stateful 'additional replies required' that is used within the response
// loop. 'no additionals required' is set at the start and additionals are marked as the query
@@ -185,7 +185,7 @@ CHIP_ERROR ResponseSender::PrepareNewReplyPacket()
ReturnErrorCodeIf(buffer.IsNull(), CHIP_ERROR_NO_MEMORY);
mResponseBuilder.Reset(std::move(buffer));
- mResponseBuilder.Header().SetMessageId(mSendState.GetMessageId());
+ mResponseBuilder.Header().SetMessageCounter(mSendState.GetMessageCounter());
if (mSendState.IncludeQuery())
{
diff --git a/src/lib/mdns/minimal/ResponseSender.h b/src/lib/mdns/minimal/ResponseSender.h
index a0a5e7eb5cf461..708d043d6fadec 100644
--- a/src/lib/mdns/minimal/ResponseSender.h
+++ b/src/lib/mdns/minimal/ResponseSender.h
@@ -37,13 +37,13 @@ class ResponseSendingState
public:
ResponseSendingState() {}
- void Reset(uint32_t messageId, const QueryData & query, const chip::Inet::IPPacketInfo * packet)
+ void Reset(uint32_t messageCounter, const QueryData & query, const chip::Inet::IPPacketInfo * packet)
{
- mMessageId = messageId;
- mQuery = &query;
- mSource = packet;
- mSendError = CHIP_NO_ERROR;
- mResourceType = ResourceType::kAnswer;
+ mMessageCounter = messageCounter;
+ mQuery = &query;
+ mSource = packet;
+ mSendError = CHIP_NO_ERROR;
+ mResourceType = ResourceType::kAnswer;
}
void SetResourceType(ResourceType resourceType) { mResourceType = resourceType; }
@@ -56,7 +56,7 @@ class ResponseSendingState
}
CHIP_ERROR GetError() const { return mSendError; }
- uint32_t GetMessageId() const { return mMessageId; }
+ uint32_t GetMessageCounter() const { return mMessageCounter; }
const QueryData * GetQuery() const { return mQuery; }
@@ -75,7 +75,7 @@ class ResponseSendingState
private:
const QueryData * mQuery = nullptr; // query being replied to
const chip::Inet::IPPacketInfo * mSource = nullptr; // Where to send the reply (if unicast)
- uint32_t mMessageId = 0; // message id for the reply
+ uint32_t mMessageCounter = 0; // message id for the reply
ResourceType mResourceType = ResourceType::kAnswer; // what is being sent right now
CHIP_ERROR mSendError = CHIP_NO_ERROR;
};
@@ -96,7 +96,7 @@ class ResponseSender : public ResponderDelegate
CHIP_ERROR AddQueryResponder(QueryResponderBase * queryResponder);
/// Send back the response to a particular query
- CHIP_ERROR Respond(uint32_t messageId, const QueryData & query, const chip::Inet::IPPacketInfo * querySource);
+ CHIP_ERROR Respond(uint32_t messageCounter, const QueryData & query, const chip::Inet::IPPacketInfo * querySource);
// Implementation of ResponderDelegate
void AddResponse(const ResourceRecord & record) override;
diff --git a/src/lib/mdns/minimal/core/DnsHeader.h b/src/lib/mdns/minimal/core/DnsHeader.h
index 2bfe88a56eaa6d..fcd16ebf6b9413 100644
--- a/src/lib/mdns/minimal/core/DnsHeader.h
+++ b/src/lib/mdns/minimal/core/DnsHeader.h
@@ -104,7 +104,7 @@ class ConstHeaderRef
static constexpr size_t kSizeBytes = 12; /// size of a DNS header structure
ConstHeaderRef(const uint8_t * buffer) : mBuffer(buffer) {}
- uint16_t GetMessageId() const { return Get16At(kMessageIdOffset); }
+ uint16_t GetMessageCounter() const { return Get16At(kMessageCounterOffset); }
BitPackedFlags GetFlags() const { return BitPackedFlags(Get16At(kFlagsOffset)); }
@@ -119,7 +119,7 @@ class ConstHeaderRef
inline uint16_t Get16At(size_t offset) const { return chip::Encoding::BigEndian::Get16(mBuffer + offset); }
uint16_t GetRawFlags() const { return Get16At(kFlagsOffset); }
- static constexpr size_t kMessageIdOffset = 0;
+ static constexpr size_t kMessageCounterOffset = 0;
static constexpr size_t kFlagsOffset = 2;
static constexpr size_t kQueryCountOffset = 4;
static constexpr size_t kAnswerCountOffset = 6;
@@ -140,7 +140,7 @@ class HeaderRef : public ConstHeaderRef
return *this;
}
- HeaderRef & SetMessageId(uint16_t value) { return Set16At(kMessageIdOffset, value); }
+ HeaderRef & SetMessageCounter(uint16_t value) { return Set16At(kMessageCounterOffset, value); }
HeaderRef & SetFlags(BitPackedFlags flags) { return Set16At(kFlagsOffset, flags.RawValue()); }
HeaderRef & SetQueryCount(uint16_t value) { return Set16At(kQueryCountOffset, value); }
HeaderRef & SetAnswerCount(uint16_t value) { return Set16At(kAnswerCountOffset, value); }
diff --git a/src/lib/mdns/minimal/tests/TestAdvertiser.cpp b/src/lib/mdns/minimal/tests/TestAdvertiser.cpp
index 9099110871c5bf..30437d0874cfa1 100644
--- a/src/lib/mdns/minimal/tests/TestAdvertiser.cpp
+++ b/src/lib/mdns/minimal/tests/TestAdvertiser.cpp
@@ -167,7 +167,7 @@ CHIP_ERROR SendQuery(FullQName qname)
return CHIP_ERROR_NO_MEMORY;
}
QueryBuilder queryBuilder(std::move(queryBuffer));
- queryBuilder.Header().SetMessageId(0);
+ queryBuilder.Header().SetMessageCounter(0);
Query query = Query(qname).SetClass(QClass::IN).SetType(QType::ANY);
queryBuilder.AddQuery(query);
queryBuffer = queryBuilder.ReleasePacket();
diff --git a/src/lib/support/CHIPFaultInjection.cpp b/src/lib/support/CHIPFaultInjection.cpp
index e837a08817fafc..ec4a286cefc8e0 100644
--- a/src/lib/support/CHIPFaultInjection.cpp
+++ b/src/lib/support/CHIPFaultInjection.cpp
@@ -78,7 +78,7 @@ DLL_EXPORT void FuzzExchangeHeader(uint8_t * p, int32_t arg)
1, // MessageType
2, // ExchangeId
4, // ProfileId
- 8 // AckMsgId
+ 8 // AckMessageCounter
};
const uint8_t values[CHIP_FAULT_INJECTION_NUM_FUZZ_VALUES] = { 0x1, 0x2, 0xFF };
size_t offsetIndex = 0;
diff --git a/src/messaging/ExchangeMessageDispatch.cpp b/src/messaging/ExchangeMessageDispatch.cpp
index ab810af354810c..696ebe1f8b1c65 100644
--- a/src/messaging/ExchangeMessageDispatch.cpp
+++ b/src/messaging/ExchangeMessageDispatch.cpp
@@ -57,7 +57,8 @@ CHIP_ERROR ExchangeMessageDispatch::SendMessage(SessionHandle session, uint16_t
#if !defined(NDEBUG)
if (!payloadHeader.HasMessageType(Protocols::SecureChannel::MsgType::StandaloneAck))
{
- ChipLogDetail(ExchangeManager, "Piggybacking Ack for MsgId:%08" PRIX32 " with msg", payloadHeader.GetAckId().Value());
+ ChipLogDetail(ExchangeManager, "Piggybacking Ack for MessageCounter:%08" PRIX32 " with msg",
+ payloadHeader.GetAckId().Value());
}
#endif
}
diff --git a/src/messaging/ExchangeMgr.cpp b/src/messaging/ExchangeMgr.cpp
index 2e0a1733bb0419..73869298434d24 100644
--- a/src/messaging/ExchangeMgr.cpp
+++ b/src/messaging/ExchangeMgr.cpp
@@ -224,7 +224,7 @@ void ExchangeManager::OnMessageReceived(const PacketHeader & packetHeader, const
}
// Matched ExchangeContext; send to message handler.
- ec->HandleMessage(packetHeader.GetMessageId(), payloadHeader, source, msgFlags, std::move(msgBuf));
+ ec->HandleMessage(packetHeader.GetMessageCounter(), payloadHeader, source, msgFlags, std::move(msgBuf));
found = true;
return false;
}
@@ -297,7 +297,7 @@ void ExchangeManager::OnMessageReceived(const PacketHeader & packetHeader, const
return;
}
- CHIP_ERROR err = ec->HandleMessage(packetHeader.GetMessageId(), payloadHeader, source, msgFlags, std::move(msgBuf));
+ CHIP_ERROR err = ec->HandleMessage(packetHeader.GetMessageCounter(), payloadHeader, source, msgFlags, std::move(msgBuf));
if (err != CHIP_NO_ERROR)
{
// Using same error message for all errors to reduce code size.
diff --git a/src/messaging/Flags.h b/src/messaging/Flags.h
index be3849ce2b3132..11d86d3c4cce83 100644
--- a/src/messaging/Flags.h
+++ b/src/messaging/Flags.h
@@ -46,7 +46,7 @@ enum class MessageFlagValues : uint32_t
/**< Indicates that the message is a duplicate of a previously received message. */
kDuplicateMessage = 0x00004000,
/**< Indicates that the peer's group key message counter is not synchronized. */
- kPeerGroupMsgIdNotSynchronized = 0x00008000,
+ kPeerGroupMessageCounterNotSynchronized = 0x00008000,
/**< Indicates that the source of the message is the initiator of the CHIP exchange. */
kFromInitiator = 0x00010000,
/**< Indicates that message is being sent/received via the local ephemeral UDP port. */
diff --git a/src/messaging/ReliableMessageContext.cpp b/src/messaging/ReliableMessageContext.cpp
index b48c47b9ed5fe6..7ca8d1ad9705b0 100644
--- a/src/messaging/ReliableMessageContext.cpp
+++ b/src/messaging/ReliableMessageContext.cpp
@@ -125,7 +125,7 @@ CHIP_ERROR ReliableMessageContext::FlushAcks()
if (err == CHIP_NO_ERROR)
{
#if !defined(NDEBUG)
- ChipLogDetail(ExchangeManager, "Flushed pending ack for MsgId:%08" PRIX32, mPendingPeerAckId);
+ ChipLogDetail(ExchangeManager, "Flushed pending ack for MessageCounter:%08" PRIX32, mPendingPeerAckId);
#endif
}
}
@@ -150,21 +150,21 @@ uint64_t ReliableMessageContext::GetActiveRetransmitTimeoutTick()
* @note
* This message is part of the CHIP Reliable Messaging protocol.
*
- * @param[in] AckMsgId The msgId of incoming Ack message.
+ * @param[in] AckMessageCounter The messageCounter of incoming Ack message.
*
- * @retval #CHIP_ERROR_INVALID_ACK_ID if the msgId of received Ack is not in the RetransTable.
+ * @retval #CHIP_ERROR_INVALID_ACK_ID if the messageCounter of received Ack is not in the RetransTable.
* @retval #CHIP_NO_ERROR if the context was removed.
*
*/
-CHIP_ERROR ReliableMessageContext::HandleRcvdAck(uint32_t AckMsgId)
+CHIP_ERROR ReliableMessageContext::HandleRcvdAck(uint32_t AckMessageCounter)
{
CHIP_ERROR err = CHIP_NO_ERROR;
// Msg is an Ack; Check Retrans Table and remove message context
- if (!GetReliableMessageMgr()->CheckAndRemRetransTable(this, AckMsgId))
+ if (!GetReliableMessageMgr()->CheckAndRemRetransTable(this, AckMessageCounter))
{
#if !defined(NDEBUG)
- ChipLogError(ExchangeManager, "CHIP MsgId:%08" PRIX32 " not in RetransTable", AckMsgId);
+ ChipLogError(ExchangeManager, "CHIP MessageCounter:%08" PRIX32 " not in RetransTable", AckMessageCounter);
#endif
err = CHIP_ERROR_INVALID_ACK_ID;
// Optionally call an application callback with this error.
@@ -172,14 +172,14 @@ CHIP_ERROR ReliableMessageContext::HandleRcvdAck(uint32_t AckMsgId)
else
{
#if !defined(NDEBUG)
- ChipLogDetail(ExchangeManager, "Removed CHIP MsgId:%08" PRIX32 " from RetransTable", AckMsgId);
+ ChipLogDetail(ExchangeManager, "Removed CHIP MessageCounter:%08" PRIX32 " from RetransTable", AckMessageCounter);
#endif
}
return err;
}
-CHIP_ERROR ReliableMessageContext::HandleNeedsAck(uint32_t messageId, BitFlags messageFlags)
+CHIP_ERROR ReliableMessageContext::HandleNeedsAck(uint32_t messageCounter, BitFlags messageFlags)
{
// Skip processing ack if drop ack debug is enabled.
@@ -189,7 +189,7 @@ CHIP_ERROR ReliableMessageContext::HandleNeedsAck(uint32_t messageId, BitFlagsExpireTicks();
- CHIP_ERROR err = HandleNeedsAckInner(messageId, messageFlags);
+ CHIP_ERROR err = HandleNeedsAckInner(messageCounter, messageFlags);
// Schedule next physical wakeup on function exit
GetReliableMessageMgr()->StartTimer();
@@ -197,7 +197,7 @@ CHIP_ERROR ReliableMessageContext::HandleNeedsAck(uint32_t messageId, BitFlags messageFlags)
+CHIP_ERROR ReliableMessageContext::HandleNeedsAckInner(uint32_t messageCounter, BitFlags messageFlags)
{
// If the message IS a duplicate there will never be a response to it, so we
@@ -205,16 +205,16 @@ CHIP_ERROR ReliableMessageContext::HandleNeedsAckInner(uint32_t messageId, BitFl
if (messageFlags.Has(MessageFlagValues::kDuplicateMessage))
{
#if !defined(NDEBUG)
- ChipLogDetail(ExchangeManager, "Forcing tx of solitary ack for duplicate MsgId:%08" PRIX32, messageId);
+ ChipLogDetail(ExchangeManager, "Forcing tx of solitary ack for duplicate MessageCounter:%08" PRIX32, messageCounter);
#endif
// Is there pending ack for a different message id.
- bool wasAckPending = IsAckPending() && mPendingPeerAckId != messageId;
+ bool wasAckPending = IsAckPending() && mPendingPeerAckId != messageCounter;
// Temporary store currently pending ack id (even if there is none).
uint32_t tempAckId = mPendingPeerAckId;
// Set the pending ack id.
- SetPendingPeerAckId(messageId);
+ SetPendingPeerAckId(messageCounter);
// Send the Ack for the duplication message in a SecureChannel::StandaloneAck message.
CHIP_ERROR err = SendStandaloneAckMessage();
@@ -234,7 +234,7 @@ CHIP_ERROR ReliableMessageContext::HandleNeedsAckInner(uint32_t messageId, BitFl
if (IsAckPending())
{
#if !defined(NDEBUG)
- ChipLogDetail(ExchangeManager, "Pending ack queue full; forcing tx of solitary ack for MsgId:%08" PRIX32,
+ ChipLogDetail(ExchangeManager, "Pending ack queue full; forcing tx of solitary ack for MessageCounter:%08" PRIX32,
mPendingPeerAckId);
#endif
// Send the Ack for the currently pending Ack in a SecureChannel::StandaloneAck message.
@@ -242,7 +242,7 @@ CHIP_ERROR ReliableMessageContext::HandleNeedsAckInner(uint32_t messageId, BitFl
}
// Replace the Pending ack id.
- SetPendingPeerAckId(messageId);
+ SetPendingPeerAckId(messageCounter);
mNextAckTimeTick =
static_cast(CHIP_CONFIG_RMP_DEFAULT_ACK_TIMEOUT_TICK +
GetReliableMessageMgr()->GetTickCounterFromTimeDelta(System::Clock::GetMonotonicMilliseconds()));
@@ -261,7 +261,7 @@ CHIP_ERROR ReliableMessageContext::SendStandaloneAckMessage()
// Send the null message
#if !defined(NDEBUG)
- ChipLogDetail(ExchangeManager, "Sending Standalone Ack for MsgId:%08" PRIX32, mPendingPeerAckId);
+ ChipLogDetail(ExchangeManager, "Sending Standalone Ack for MessageCounter:%08" PRIX32, mPendingPeerAckId);
#endif
CHIP_ERROR err = GetExchangeContext()->SendMessage(Protocols::SecureChannel::MsgType::StandaloneAck, std::move(msgBuf),
@@ -273,8 +273,8 @@ CHIP_ERROR ReliableMessageContext::SendStandaloneAckMessage()
}
if (err != CHIP_NO_ERROR)
{
- ChipLogError(ExchangeManager, "Failed to send Solitary ack for MsgId:%08" PRIX32 ":%" CHIP_ERROR_FORMAT, mPendingPeerAckId,
- err.Format());
+ ChipLogError(ExchangeManager, "Failed to send Solitary ack for MessageCounter:%08" PRIX32 ":%" CHIP_ERROR_FORMAT,
+ mPendingPeerAckId, err.Format());
}
return err;
diff --git a/src/messaging/ReliableMessageContext.h b/src/messaging/ReliableMessageContext.h
index 099afb5b2bcd8a..27ebc317b9f65f 100644
--- a/src/messaging/ReliableMessageContext.h
+++ b/src/messaging/ReliableMessageContext.h
@@ -217,9 +217,9 @@ class ReliableMessageContext
private:
void RetainContext();
void ReleaseContext();
- CHIP_ERROR HandleRcvdAck(uint32_t AckMsgId);
- CHIP_ERROR HandleNeedsAck(uint32_t messageId, BitFlags messageFlags);
- CHIP_ERROR HandleNeedsAckInner(uint32_t messageId, BitFlags messageFlags);
+ CHIP_ERROR HandleRcvdAck(uint32_t AckMessageCounter);
+ CHIP_ERROR HandleNeedsAck(uint32_t messageCounter, BitFlags messageFlags);
+ CHIP_ERROR HandleNeedsAckInner(uint32_t messageCounter, BitFlags messageFlags);
ExchangeContext * GetExchangeContext();
/**
diff --git a/src/messaging/ReliableMessageMgr.cpp b/src/messaging/ReliableMessageMgr.cpp
index c180b9d5701224..1b848056475e88 100644
--- a/src/messaging/ReliableMessageMgr.cpp
+++ b/src/messaging/ReliableMessageMgr.cpp
@@ -88,8 +88,8 @@ void ReliableMessageMgr::TicklessDebugDumpRetransTable(const char * log)
{
if (entry.rc)
{
- ChipLogDetail(ExchangeManager, "EC:%04" PRIX16 " MsgId:%08" PRIX32 " NextRetransTimeCtr:%04" PRIX16, entry.rc,
- entry.msgId, entry.nextRetransTimeTick);
+ ChipLogDetail(ExchangeManager, "EC:%04" PRIX16 " MessageCounter:%08" PRIX32 " NextRetransTimeCtr:%04" PRIX16, entry.rc,
+ entry.messageCounter, entry.nextRetransTimeTick);
}
}
}
@@ -143,15 +143,15 @@ void ReliableMessageMgr::ExecuteActions()
continue;
}
- uint8_t sendCount = entry.sendCount;
- uint32_t msgId = entry.retainedBuf.GetMsgId();
+ uint8_t sendCount = entry.sendCount;
+ uint32_t messageCounter = entry.retainedBuf.GetMessageCounter();
if (sendCount == CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS)
{
err = CHIP_ERROR_MESSAGE_NOT_ACKNOWLEDGED;
- ChipLogError(ExchangeManager, "Failed to Send CHIP MsgId:%08" PRIX32 " sendCount: %" PRIu8 " max retries: %d", msgId,
- sendCount, CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS);
+ ChipLogError(ExchangeManager, "Failed to Send CHIP MessageCounter:%08" PRIX32 " sendCount: %" PRIu8 " max retries: %d",
+ messageCounter, sendCount, CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS);
// Remove from Table
ClearRetransTable(entry);
@@ -166,7 +166,7 @@ void ReliableMessageMgr::ExecuteActions()
// If the retransmission was successful, update the passive timer
entry.nextRetransTimeTick = static_cast(rc->GetActiveRetransmitTimeoutTick());
#if !defined(NDEBUG)
- ChipLogDetail(ExchangeManager, "Retransmit MsgId:%08" PRIX32 " Send Cnt %d", msgId, entry.sendCount);
+ ChipLogDetail(ExchangeManager, "Retransmit MessageCounter:%08" PRIX32 " Send Cnt %d", messageCounter, entry.sendCount);
#endif
}
}
@@ -329,17 +329,17 @@ void ReliableMessageMgr::ResumeRetransmision(ReliableMessageContext * rc)
}
}
-bool ReliableMessageMgr::CheckAndRemRetransTable(ReliableMessageContext * rc, uint32_t ackMsgId)
+bool ReliableMessageMgr::CheckAndRemRetransTable(ReliableMessageContext * rc, uint32_t ackMessageCounter)
{
for (RetransTableEntry & entry : mRetransTable)
{
- if ((entry.rc == rc) && entry.retainedBuf.GetMsgId() == ackMsgId)
+ if ((entry.rc == rc) && entry.retainedBuf.GetMessageCounter() == ackMessageCounter)
{
// Clear the entry from the retransmision table.
ClearRetransTable(entry);
#if !defined(NDEBUG)
- ChipLogDetail(ExchangeManager, "Rxd Ack; Removing MsgId:%08" PRIX32 " from Retrans Table", ackMsgId);
+ ChipLogDetail(ExchangeManager, "Rxd Ack; Removing MessageCounter:%08" PRIX32 " from Retrans Table", ackMessageCounter);
#endif
return true;
}
@@ -360,8 +360,9 @@ CHIP_ERROR ReliableMessageMgr::SendFromRetransTable(RetransTableEntry * entry)
if (dispatcher == nullptr || !rc->GetExchangeContext()->HasSecureSession())
{
// Using same error message for all errors to reduce code size.
- ChipLogError(ExchangeManager, "Crit-err %" CHIP_ERROR_FORMAT " when sending CHIP MsgId:%08" PRIX32 ", send tries: %d",
- CHIP_ERROR_INCORRECT_STATE.Format(), entry->retainedBuf.GetMsgId(), entry->sendCount);
+ ChipLogError(ExchangeManager,
+ "Crit-err %" CHIP_ERROR_FORMAT " when sending CHIP MessageCounter:%08" PRIX32 ", send tries: %d",
+ CHIP_ERROR_INCORRECT_STATE.Format(), entry->retainedBuf.GetMessageCounter(), entry->sendCount);
ClearRetransTable(*entry);
return CHIP_ERROR_INCORRECT_STATE;
}
@@ -377,8 +378,9 @@ CHIP_ERROR ReliableMessageMgr::SendFromRetransTable(RetransTableEntry * entry)
{
// Remove from table
// Using same error message for all errors to reduce code size.
- ChipLogError(ExchangeManager, "Crit-err %" CHIP_ERROR_FORMAT " when sending CHIP MsgId:%08" PRIX32 ", send tries: %d",
- err.Format(), entry->retainedBuf.GetMsgId(), entry->sendCount);
+ ChipLogError(ExchangeManager,
+ "Crit-err %" CHIP_ERROR_FORMAT " when sending CHIP MessageCounter:%08" PRIX32 ", send tries: %d", err.Format(),
+ entry->retainedBuf.GetMessageCounter(), entry->sendCount);
ClearRetransTable(*entry);
}
diff --git a/src/messaging/ReliableMessageMgr.h b/src/messaging/ReliableMessageMgr.h
index fd7adae2a708c3..933f651185d75e 100644
--- a/src/messaging/ReliableMessageMgr.h
+++ b/src/messaging/ReliableMessageMgr.h
@@ -151,11 +151,11 @@ class ReliableMessageMgr
*
* @param[in] rc A pointer to the ExchangeContext object.
*
- * @param[in] msgId message ID which has been acked.
+ * @param[in] messageCounter message ID which has been acked.
*
* @retval #CHIP_NO_ERROR On success.
*/
- bool CheckAndRemRetransTable(ReliableMessageContext * rc, uint32_t msgId);
+ bool CheckAndRemRetransTable(ReliableMessageContext * rc, uint32_t messageCounter);
/**
* Send the specified entry from the retransmission table.
diff --git a/src/transport/SecureMessageCodec.cpp b/src/transport/SecureMessageCodec.cpp
index d49dfef267cfee..05bf96085797bd 100644
--- a/src/transport/SecureMessageCodec.cpp
+++ b/src/transport/SecureMessageCodec.cpp
@@ -43,13 +43,13 @@ CHIP_ERROR Encode(Transport::PeerConnectionState * state, PayloadHeader & payloa
VerifyOrReturnError(!msgBuf->HasChainedBuffer(), CHIP_ERROR_INVALID_MESSAGE_LENGTH);
VerifyOrReturnError(msgBuf->TotalLength() <= kMaxAppMessageLen, CHIP_ERROR_MESSAGE_TOO_LONG);
- uint32_t msgId = counter.Value();
+ uint32_t messageCounter = counter.Value();
static_assert(std::is_sameTotalLength()), uint16_t>::value,
"Addition to generate payloadLength might overflow");
packetHeader
- .SetMessageId(msgId) //
+ .SetMessageCounter(messageCounter) //
.SetEncryptionKeyID(state->GetPeerKeyID());
packetHeader.GetFlags().Set(Header::FlagValues::kEncryptedMessage);
@@ -68,7 +68,7 @@ CHIP_ERROR Encode(Transport::PeerConnectionState * state, PayloadHeader & payloa
VerifyOrReturnError(CanCastTo(totalLen + taglen), CHIP_ERROR_INTERNAL);
msgBuf->SetDataLength(static_cast(totalLen + taglen));
- ChipLogDetail(Inet, "Secure message was encrypted: Msg ID %" PRIu32, msgId);
+ ChipLogDetail(Inet, "Secure message was encrypted: Msg ID %" PRIu32, messageCounter);
ReturnErrorOnFailure(counter.Advance());
return CHIP_NO_ERROR;
diff --git a/src/transport/SecureSession.cpp b/src/transport/SecureSession.cpp
index 0c78ca0ae61bb2..dea77b794cf517 100644
--- a/src/transport/SecureSession.cpp
+++ b/src/transport/SecureSession.cpp
@@ -102,7 +102,7 @@ CHIP_ERROR SecureSession::GetIV(const PacketHeader & header, uint8_t * iv, size_
Encoding::LittleEndian::BufferWriter bbuf(iv, len);
bbuf.Put64(header.GetSourceNodeId().ValueOr(0));
- bbuf.Put32(header.GetMessageId());
+ bbuf.Put32(header.GetMessageCounter());
return bbuf.Fit() ? CHIP_NO_ERROR : CHIP_ERROR_NO_MEMORY;
}
diff --git a/src/transport/SecureSessionMgr.cpp b/src/transport/SecureSessionMgr.cpp
index 093ce844e19ef4..79464e0c4dfb38 100644
--- a/src/transport/SecureSessionMgr.cpp
+++ b/src/transport/SecureSessionMgr.cpp
@@ -48,7 +48,7 @@ using System::PacketBufferHandle;
using Transport::PeerAddress;
using Transport::PeerConnectionState;
-uint32_t EncryptedPacketBufferHandle::GetMsgId() const
+uint32_t EncryptedPacketBufferHandle::GetMessageCounter() const
{
PacketHeader header;
uint16_t headerSize = 0;
@@ -56,7 +56,7 @@ uint32_t EncryptedPacketBufferHandle::GetMsgId() const
if (err == CHIP_NO_ERROR)
{
- return header.GetMessageId();
+ return header.GetMessageCounter();
}
ChipLogError(Inet, "Failed to decode EncryptedPacketBufferHandle header with error: %s", ErrorStr(err));
@@ -362,7 +362,7 @@ void SecureSessionMgr::SecureMessageDispatch(const PacketHeader & packetHeader,
return;
}
- err = state->GetSessionMessageCounter().GetPeerMessageCounter().Verify(packetHeader.GetMessageId());
+ err = state->GetSessionMessageCounter().GetPeerMessageCounter().Verify(packetHeader.GetMessageCounter());
if (err == CHIP_ERROR_DUPLICATE_MESSAGE_RECEIVED)
{
ChipLogDetail(Inet, "Received a duplicate message");
@@ -395,7 +395,7 @@ void SecureSessionMgr::SecureMessageDispatch(const PacketHeader & packetHeader,
}
else
{
- state->GetSessionMessageCounter().GetPeerMessageCounter().Commit(packetHeader.GetMessageId());
+ state->GetSessionMessageCounter().GetPeerMessageCounter().Commit(packetHeader.GetMessageCounter());
}
// TODO: once mDNS address resolution is available reconsider if this is required
diff --git a/src/transport/SecureSessionMgr.h b/src/transport/SecureSessionMgr.h
index 740bae8fe1995a..f513ede13871d2 100644
--- a/src/transport/SecureSessionMgr.h
+++ b/src/transport/SecureSessionMgr.h
@@ -66,7 +66,7 @@ class EncryptedPacketBufferHandle final : private System::PacketBufferHandle
// exposing operator->
bool HasChainedBuffer() const { return (*this)->HasChainedBuffer(); }
- uint32_t GetMsgId() const;
+ uint32_t GetMessageCounter() const;
/**
* Creates a copy of the data in this packet.
diff --git a/src/transport/raw/MessageHeader.cpp b/src/transport/raw/MessageHeader.cpp
index 0a526432208986..4cbf511af939b5 100644
--- a/src/transport/raw/MessageHeader.cpp
+++ b/src/transport/raw/MessageHeader.cpp
@@ -156,7 +156,7 @@ CHIP_ERROR PacketHeader::Decode(const uint8_t * const data, uint16_t size, uint1
mFlags.SetRaw(header);
mEncryptionType = static_cast((header & kEncryptionTypeMask) >> kEncryptionTypeShift);
- err = reader.Read32(&mMessageId).StatusCode();
+ err = reader.Read32(&mMessageCounter).StatusCode();
SuccessOrExit(err);
if (mFlags.Has(Header::FlagValues::kSourceNodeIdPresent))
@@ -276,7 +276,7 @@ CHIP_ERROR PacketHeader::Encode(uint8_t * data, uint16_t size, uint16_t * encode
uint8_t * p = data;
LittleEndian::Write16(p, header);
- LittleEndian::Write32(p, mMessageId);
+ LittleEndian::Write32(p, mMessageCounter);
if (mSourceNodeId.HasValue())
{
LittleEndian::Write64(p, mSourceNodeId.Value());
diff --git a/src/transport/raw/MessageHeader.h b/src/transport/raw/MessageHeader.h
index c4c223f5c761d1..fa6ce87b9d015f 100644
--- a/src/transport/raw/MessageHeader.h
+++ b/src/transport/raw/MessageHeader.h
@@ -118,7 +118,7 @@ class PacketHeader
* Message IDs are expecte to monotonically increase by one for each mesage
* that has been sent.
*/
- uint32_t GetMessageId() const { return mMessageId; }
+ uint32_t GetMessageCounter() const { return mMessageCounter; }
/**
* Gets the source node id in the current message.
@@ -198,9 +198,9 @@ class PacketHeader
return *this;
}
- PacketHeader & SetMessageId(uint32_t id)
+ PacketHeader & SetMessageCounter(uint32_t id)
{
- mMessageId = id;
+ mMessageCounter = id;
return *this;
}
@@ -295,7 +295,7 @@ class PacketHeader
static constexpr int kHeaderVersion = 2;
/// Value expected to be incremented for each message sent.
- uint32_t mMessageId = 0;
+ uint32_t mMessageCounter = 0;
/// What node the message originated from
Optional mSourceNodeId;
diff --git a/src/transport/raw/tests/TestMessageHeader.cpp b/src/transport/raw/tests/TestMessageHeader.cpp
index 7138a29f4bde6e..e946a546277049 100644
--- a/src/transport/raw/tests/TestMessageHeader.cpp
+++ b/src/transport/raw/tests/TestMessageHeader.cpp
@@ -39,7 +39,7 @@ void TestPacketHeaderInitialState(nlTestSuite * inSuite, void * inContext)
PacketHeader header;
NL_TEST_ASSERT(inSuite, !header.IsSecureSessionControlMsg());
- NL_TEST_ASSERT(inSuite, header.GetMessageId() == 0);
+ NL_TEST_ASSERT(inSuite, header.GetMessageCounter() == 0);
NL_TEST_ASSERT(inSuite, header.GetEncryptionKeyID() == 0);
NL_TEST_ASSERT(inSuite, !header.GetDestinationNodeId().HasValue());
NL_TEST_ASSERT(inSuite, !header.GetSourceNodeId().HasValue());
@@ -61,26 +61,26 @@ void TestPacketHeaderEncodeDecode(nlTestSuite * inSuite, void * inContext)
uint16_t encodeLen;
uint16_t decodeLen;
- header.SetMessageId(123);
+ header.SetMessageCounter(123);
NL_TEST_ASSERT(inSuite, header.Encode(buffer, &encodeLen) == CHIP_NO_ERROR);
// change it to verify decoding
- header.SetMessageId(222).SetSourceNodeId(1).SetDestinationNodeId(2);
+ header.SetMessageCounter(222).SetSourceNodeId(1).SetDestinationNodeId(2);
NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
NL_TEST_ASSERT(inSuite, encodeLen == decodeLen);
- NL_TEST_ASSERT(inSuite, header.GetMessageId() == 123);
+ NL_TEST_ASSERT(inSuite, header.GetMessageCounter() == 123);
NL_TEST_ASSERT(inSuite, !header.GetDestinationNodeId().HasValue());
header.SetSourceNodeId(55);
NL_TEST_ASSERT(inSuite, header.Encode(buffer, &encodeLen) == CHIP_NO_ERROR);
// change it to verify decoding
- header.SetMessageId(222).SetSourceNodeId(1).SetDestinationNodeId(2);
+ header.SetMessageCounter(222).SetSourceNodeId(1).SetDestinationNodeId(2);
NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
NL_TEST_ASSERT(inSuite, encodeLen == decodeLen);
- NL_TEST_ASSERT(inSuite, header.GetMessageId() == 123);
+ NL_TEST_ASSERT(inSuite, header.GetMessageCounter() == 123);
NL_TEST_ASSERT(inSuite, !header.GetDestinationNodeId().HasValue());
NL_TEST_ASSERT(inSuite, header.GetSourceNodeId() == Optional::Value(55ull));
@@ -88,53 +88,53 @@ void TestPacketHeaderEncodeDecode(nlTestSuite * inSuite, void * inContext)
NL_TEST_ASSERT(inSuite, header.Encode(buffer, &encodeLen) == CHIP_NO_ERROR);
// change it to verify decoding
- header.SetMessageId(222).SetSourceNodeId(1).SetDestinationNodeId(2);
+ header.SetMessageCounter(222).SetSourceNodeId(1).SetDestinationNodeId(2);
NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
NL_TEST_ASSERT(inSuite, encodeLen == decodeLen);
- NL_TEST_ASSERT(inSuite, header.GetMessageId() == 123);
+ NL_TEST_ASSERT(inSuite, header.GetMessageCounter() == 123);
NL_TEST_ASSERT(inSuite, header.GetDestinationNodeId() == Optional::Value(11ull));
NL_TEST_ASSERT(inSuite, !header.GetSourceNodeId().HasValue());
- header.SetMessageId(234).SetSourceNodeId(77).SetDestinationNodeId(88);
+ header.SetMessageCounter(234).SetSourceNodeId(77).SetDestinationNodeId(88);
NL_TEST_ASSERT(inSuite, header.Encode(buffer, &encodeLen) == CHIP_NO_ERROR);
// change it to verify decoding
- header.SetMessageId(222).SetSourceNodeId(1).SetDestinationNodeId(2);
+ header.SetMessageCounter(222).SetSourceNodeId(1).SetDestinationNodeId(2);
NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
NL_TEST_ASSERT(inSuite, encodeLen == decodeLen);
- NL_TEST_ASSERT(inSuite, header.GetMessageId() == 234);
+ NL_TEST_ASSERT(inSuite, header.GetMessageCounter() == 234);
NL_TEST_ASSERT(inSuite, header.GetDestinationNodeId() == Optional::Value(88ull));
NL_TEST_ASSERT(inSuite, header.GetSourceNodeId() == Optional::Value(77ull));
- header.SetMessageId(234).SetSourceNodeId(77).SetDestinationNodeId(88).SetSecureSessionControlMsg(true);
+ header.SetMessageCounter(234).SetSourceNodeId(77).SetDestinationNodeId(88).SetSecureSessionControlMsg(true);
NL_TEST_ASSERT(inSuite, header.Encode(buffer, &encodeLen) == CHIP_NO_ERROR);
// change it to verify decoding
- header.SetMessageId(222).SetSourceNodeId(1).SetDestinationNodeId(2);
+ header.SetMessageCounter(222).SetSourceNodeId(1).SetDestinationNodeId(2);
NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
- NL_TEST_ASSERT(inSuite, header.GetMessageId() == 234);
+ NL_TEST_ASSERT(inSuite, header.GetMessageCounter() == 234);
NL_TEST_ASSERT(inSuite, header.GetDestinationNodeId() == Optional::Value(88ull));
NL_TEST_ASSERT(inSuite, header.GetSourceNodeId() == Optional::Value(77ull));
NL_TEST_ASSERT(inSuite, header.IsSecureSessionControlMsg());
- header.SetMessageId(234).SetSourceNodeId(77).SetDestinationNodeId(88).SetEncryptionKeyID(2);
+ header.SetMessageCounter(234).SetSourceNodeId(77).SetDestinationNodeId(88).SetEncryptionKeyID(2);
NL_TEST_ASSERT(inSuite, header.Encode(buffer, &encodeLen) == CHIP_NO_ERROR);
// change it to verify decoding
- header.SetMessageId(222).SetSourceNodeId(1).SetDestinationNodeId(2);
+ header.SetMessageCounter(222).SetSourceNodeId(1).SetDestinationNodeId(2);
NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
- NL_TEST_ASSERT(inSuite, header.GetMessageId() == 234);
+ NL_TEST_ASSERT(inSuite, header.GetMessageCounter() == 234);
NL_TEST_ASSERT(inSuite, header.GetDestinationNodeId() == Optional::Value(88ull));
NL_TEST_ASSERT(inSuite, header.GetSourceNodeId() == Optional::Value(77ull));
NL_TEST_ASSERT(inSuite, header.GetEncryptionKeyID() == 2);
- header.SetMessageId(234).SetSourceNodeId(77).SetDestinationNodeId(88);
+ header.SetMessageCounter(234).SetSourceNodeId(77).SetDestinationNodeId(88);
NL_TEST_ASSERT(inSuite, header.Encode(buffer, &encodeLen) == CHIP_NO_ERROR);
// change it to verify decoding
- header.SetMessageId(222).SetSourceNodeId(1).SetDestinationNodeId(2);
+ header.SetMessageCounter(222).SetSourceNodeId(1).SetDestinationNodeId(2);
NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
- NL_TEST_ASSERT(inSuite, header.GetMessageId() == 234);
+ NL_TEST_ASSERT(inSuite, header.GetMessageCounter() == 234);
NL_TEST_ASSERT(inSuite, header.GetDestinationNodeId() == Optional::Value(88ull));
NL_TEST_ASSERT(inSuite, header.GetSourceNodeId() == Optional::Value(77ull));
}
diff --git a/src/transport/raw/tests/TestTCP.cpp b/src/transport/raw/tests/TestTCP.cpp
index 85e38a7d35bd25..31324bd457a71f 100644
--- a/src/transport/raw/tests/TestTCP.cpp
+++ b/src/transport/raw/tests/TestTCP.cpp
@@ -67,7 +67,7 @@ using TCPImpl = Transport::TCP(static_cast(PAYLOAD)));
@@ -243,7 +243,7 @@ bool TestData::Init(const uint16_t sizes[])
Free();
PacketHeader header;
- header.SetSourceNodeId(kSourceNodeId).SetDestinationNodeId(kDestinationNodeId).SetMessageId(kMessageId);
+ header.SetSourceNodeId(kSourceNodeId).SetDestinationNodeId(kDestinationNodeId).SetMessageCounter(kMessageCounter);
const size_t headerLength = header.EncodeSizeBytes();
// Determine the total length.
diff --git a/src/transport/raw/tests/TestUDP.cpp b/src/transport/raw/tests/TestUDP.cpp
index fc33af368b63c4..3a9aadf58012fc 100644
--- a/src/transport/raw/tests/TestUDP.cpp
+++ b/src/transport/raw/tests/TestUDP.cpp
@@ -44,7 +44,7 @@ namespace {
constexpr NodeId kSourceNodeId = 123654;
constexpr NodeId kDestinationNodeId = 111222333;
-constexpr uint32_t kMessageId = 18;
+constexpr uint32_t kMessageCounter = 18;
using TestContext = chip::Test::IOContext;
TestContext sContext;
@@ -67,7 +67,7 @@ class MockTransportMgrDelegate : public TransportMgrDelegate
NL_TEST_ASSERT(mSuite, packetHeader.GetSourceNodeId() == Optional::Value(kSourceNodeId));
NL_TEST_ASSERT(mSuite, packetHeader.GetDestinationNodeId() == Optional::Value(kDestinationNodeId));
- NL_TEST_ASSERT(mSuite, packetHeader.GetMessageId() == kMessageId);
+ NL_TEST_ASSERT(mSuite, packetHeader.GetMessageCounter() == kMessageCounter);
size_t data_len = msgBuf->DataLength();
int compare = memcmp(msgBuf->Start(), PAYLOAD, data_len);
@@ -133,7 +133,7 @@ void CheckMessageTest(nlTestSuite * inSuite, void * inContext, const IPAddress &
ReceiveHandlerCallCount = 0;
PacketHeader header;
- header.SetSourceNodeId(kSourceNodeId).SetDestinationNodeId(kDestinationNodeId).SetMessageId(kMessageId);
+ header.SetSourceNodeId(kSourceNodeId).SetDestinationNodeId(kDestinationNodeId).SetMessageCounter(kMessageCounter);
err = header.EncodeBeforeData(buffer);
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
diff --git a/src/transport/tests/TestSecureSessionMgr.cpp b/src/transport/tests/TestSecureSessionMgr.cpp
index 1f40642882e971..d6ed772bc756ba 100644
--- a/src/transport/tests/TestSecureSessionMgr.cpp
+++ b/src/transport/tests/TestSecureSessionMgr.cpp
@@ -364,14 +364,14 @@ void SendBadEncryptedPacketTest(nlTestSuite * inSuite, void * inContext)
state->GetSessionMessageCounter().GetPeerMessageCounter().SetCounter(1);
// Change Message ID
- EncryptedPacketBufferHandle badMessageIdMsg = preparedMessage.CloneData();
- NL_TEST_ASSERT(inSuite, badMessageIdMsg.ExtractPacketHeader(packetHeader) == CHIP_NO_ERROR);
+ EncryptedPacketBufferHandle badMessageCounterMsg = preparedMessage.CloneData();
+ NL_TEST_ASSERT(inSuite, badMessageCounterMsg.ExtractPacketHeader(packetHeader) == CHIP_NO_ERROR);
- uint32_t msgID = packetHeader.GetMessageId();
- packetHeader.SetMessageId(msgID + 1);
- NL_TEST_ASSERT(inSuite, badMessageIdMsg.InsertPacketHeader(packetHeader) == CHIP_NO_ERROR);
+ uint32_t messageCounter = packetHeader.GetMessageCounter();
+ packetHeader.SetMessageCounter(messageCounter + 1);
+ NL_TEST_ASSERT(inSuite, badMessageCounterMsg.InsertPacketHeader(packetHeader) == CHIP_NO_ERROR);
- err = secureSessionMgr.SendPreparedMessage(localToRemoteSession, badMessageIdMsg);
+ err = secureSessionMgr.SendPreparedMessage(localToRemoteSession, badMessageCounterMsg);
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1);
diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h
index e1081bf7605fa7..e95d469c93af25 100644
--- a/zzz_generated/app-common/app-common/zap-generated/callback.h
+++ b/zzz_generated/app-common/app-common/zap-generated/callback.h
@@ -16660,7 +16660,7 @@ bool emberAfTestClusterClusterTestAddArgumentsCallback(chip::EndpointId endpoint
* @brief Cluster DisplayMessage Command callback (from server)
*/
bool emberAfMessagingClusterDisplayMessageCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj,
- uint32_t messageId, uint8_t messageControl,
+ uint32_t messageCounter, uint8_t messageControl,
/* TYPE WARNING: utc defaults to */ uint8_t * startTime,
uint16_t durationInMinutes, uint8_t * message,
uint8_t optionalExtendedMessageControl);
@@ -16672,19 +16672,19 @@ bool emberAfMessagingClusterGetLastMessageCallback(chip::EndpointId endpoint, ch
* @brief Cluster CancelMessage Command callback (from server)
*/
bool emberAfMessagingClusterCancelMessageCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj,
- uint32_t messageId, uint8_t messageControl);
+ uint32_t messageCounter, uint8_t messageControl);
/**
* @brief Cluster MessageConfirmation Command callback (from client)
*/
bool emberAfMessagingClusterMessageConfirmationCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj,
- uint32_t messageId,
+ uint32_t messageCounter,
/* TYPE WARNING: utc defaults to */ uint8_t * confirmationTime,
uint8_t messageConfirmationControl, chip::ByteSpan messageResponse);
/**
* @brief Cluster DisplayProtectedMessage Command callback (from server)
*/
bool emberAfMessagingClusterDisplayProtectedMessageCallback(chip::EndpointId endpoint, chip::app::CommandSender * commandObj,
- uint32_t messageId, uint8_t messageControl,
+ uint32_t messageCounter, uint8_t messageControl,
/* TYPE WARNING: utc defaults to */ uint8_t * startTime,
uint16_t durationInMinutes, uint8_t * message,
uint8_t optionalExtendedMessageControl);
diff --git a/zzz_generated/app-common/app-common/zap-generated/client-command-macro.h b/zzz_generated/app-common/app-common/zap-generated/client-command-macro.h
index d7ee86f4a272b2..a6ad49bffdc30d 100644
--- a/zzz_generated/app-common/app-common/zap-generated/client-command-macro.h
+++ b/zzz_generated/app-common/app-common/zap-generated/client-command-macro.h
@@ -4702,39 +4702,39 @@
/** @brief Command description for DisplayMessage
*
* Command: DisplayMessage
- * @param messageId INT32U
+ * @param messageCounter INT32U
* @param messageControl MessagingControlMask
* @param startTime UTC
* @param durationInMinutes INT16U
* @param message CHAR_STRING
* @param optionalExtendedMessageControl MessagingExtendedControlMask
*/
-#define emberAfFillCommandMessagingClusterDisplayMessage(messageId, messageControl, startTime, durationInMinutes, message, \
+#define emberAfFillCommandMessagingClusterDisplayMessage(messageCounter, messageControl, startTime, durationInMinutes, message, \
optionalExtendedMessageControl) \
emberAfFillExternalBuffer(mask, \
\
- ZCL_DISPLAY_MESSAGE_COMMAND_ID, "uuuuuu", messageId, messageControl, startTime, durationInMinutes, \
- message, optionalExtendedMessageControl);
+ ZCL_DISPLAY_MESSAGE_COMMAND_ID, "uuuuuu", messageCounter, messageControl, startTime, \
+ durationInMinutes, message, optionalExtendedMessageControl);
/** @brief Command description for CancelMessage
*
* Command: CancelMessage
- * @param messageId INT32U
+ * @param messageCounter INT32U
*/
-#define emberAfFillCommandMessagingClusterCancelMessage(messageId) \
+#define emberAfFillCommandMessagingClusterCancelMessage(messageCounter) \
emberAfFillExternalBuffer(mask, \
\
- ZCL_CANCEL_MESSAGE_COMMAND_ID, "u", messageId);
+ ZCL_CANCEL_MESSAGE_COMMAND_ID, "u", messageCounter);
/** @brief Command description for MessageConfirmation
*
* Command: MessageConfirmation
- * @param messageId INT32U
+ * @param messageCounter INT32U
*/
-#define emberAfFillCommandMessagingClusterMessageConfirmation(messageId) \
+#define emberAfFillCommandMessagingClusterMessageConfirmation(messageCounter) \
emberAfFillExternalBuffer(mask, \
\
- ZCL_MESSAGE_CONFIRMATION_COMMAND_ID, "u", messageId);
+ ZCL_MESSAGE_CONFIRMATION_COMMAND_ID, "u", messageCounter);
/** @brief Command description for CancelMessage
*
@@ -4762,12 +4762,12 @@
/** @brief Command description for DisplayProtectedMessage
*
* Command: DisplayProtectedMessage
- * @param messageId INT32U
+ * @param messageCounter INT32U
*/
-#define emberAfFillCommandMessagingClusterDisplayProtectedMessage(messageId) \
+#define emberAfFillCommandMessagingClusterDisplayProtectedMessage(messageCounter) \
emberAfFillExternalBuffer(mask, \
\
- ZCL_DISPLAY_PROTECTED_MESSAGE_COMMAND_ID, "u", messageId);
+ ZCL_DISPLAY_PROTECTED_MESSAGE_COMMAND_ID, "u", messageCounter);
/** @brief Command description for GetMessageCancellation
*