diff --git a/src/app/MessageDef/AttributeDataIB.cpp b/src/app/MessageDef/AttributeDataIB.cpp index e2699285ec02db..35d6003ef44a89 100644 --- a/src/app/MessageDef/AttributeDataIB.cpp +++ b/src/app/MessageDef/AttributeDataIB.cpp @@ -28,161 +28,6 @@ namespace chip { namespace app { -CHIP_ERROR -AttributeDataIB::Parser::ParseData(TLV::TLVReader & aReader, int aDepth) const -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - if (aDepth == 0) - { - PRETTY_PRINT("Data = "); - } - else - { - if (TLV::IsContextTag(aReader.GetTag())) - { - PRETTY_PRINT("\t0x%" PRIx32 " = ", TLV::TagNumFromTag(aReader.GetTag())); - } - else if (TLV::IsProfileTag(aReader.GetTag())) - { - PRETTY_PRINT("\t0x%" PRIx32 "::0x%" PRIx32 " = ", TLV::ProfileIdFromTag(aReader.GetTag()), - TLV::TagNumFromTag(aReader.GetTag())); - } - else - { - // Anonymous tag, don't print anything - } - } - - switch (aReader.GetType()) - { - case TLV::kTLVType_Structure: - PRETTY_PRINT("\t{"); - break; - - case TLV::kTLVType_Array: - PRETTY_PRINT_SAMELINE("["); - PRETTY_PRINT("\t\t"); - break; - - case TLV::kTLVType_SignedInteger: { - int64_t value_s64; - - ReturnErrorOnFailure(aReader.Get(value_s64)); - - PRETTY_PRINT_SAMELINE("%" PRId64 ", ", value_s64); - break; - } - - case TLV::kTLVType_UnsignedInteger: { - uint64_t value_u64; - - ReturnErrorOnFailure(aReader.Get(value_u64)); - - PRETTY_PRINT_SAMELINE("%" PRIu64 ", ", value_u64); - break; - } - - case TLV::kTLVType_Boolean: { - bool value_b; - - ReturnErrorOnFailure(aReader.Get(value_b)); - - PRETTY_PRINT_SAMELINE("%s, ", value_b ? "true" : "false"); - break; - } - - case TLV::kTLVType_UTF8String: { - char value_s[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; - - err = aReader.GetString(value_s, sizeof(value_s)); - VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, err); - - if (err == CHIP_ERROR_BUFFER_TOO_SMALL) - { - PRETTY_PRINT_SAMELINE("... (byte string too long) ..."); - err = CHIP_NO_ERROR; - } - else - { - PRETTY_PRINT_SAMELINE("\"%s\", ", value_s); - } - break; - } - - case TLV::kTLVType_ByteString: { - uint8_t value_b[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; - uint32_t len, readerLen; - - readerLen = aReader.GetLength(); - - err = aReader.GetBytes(value_b, sizeof(value_b)); - VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, err); - - PRETTY_PRINT_SAMELINE("["); - PRETTY_PRINT("\t\t"); - - if (readerLen < sizeof(value_b)) - { - len = readerLen; - } - else - { - len = sizeof(value_b); - } - - if (err == CHIP_ERROR_BUFFER_TOO_SMALL) - { - PRETTY_PRINT_SAMELINE("... (byte string too long) ..."); - } - else - { - for (size_t i = 0; i < len; i++) - { - PRETTY_PRINT_SAMELINE("0x%x, ", value_b[i]); - } - } - - err = CHIP_NO_ERROR; - PRETTY_PRINT("\t]"); - break; - } - - case TLV::kTLVType_Null: - PRETTY_PRINT_SAMELINE("NULL"); - break; - - default: - PRETTY_PRINT_SAMELINE("--"); - break; - } - - if (aReader.GetType() == TLV::kTLVType_Structure || aReader.GetType() == TLV::kTLVType_Array) - { - const char terminating_char = (aReader.GetType() == TLV::kTLVType_Structure) ? '}' : ']'; - TLV::TLVType type; - - IgnoreUnusedVariable(terminating_char); - - ReturnErrorOnFailure(aReader.EnterContainer(type)); - - while ((err = aReader.Next()) == CHIP_NO_ERROR) - { - PRETTY_PRINT_INCDEPTH(); - - ReturnErrorOnFailure(ParseData(aReader, aDepth + 1)); - - PRETTY_PRINT_DECDEPTH(); - } - - PRETTY_PRINT("\t%c,", terminating_char); - - ReturnErrorOnFailure(aReader.ExitContainer(type)); - } - - return CHIP_NO_ERROR; -} - #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK CHIP_ERROR AttributeDataIB::Parser::CheckSchemaValidity() const { @@ -238,7 +83,7 @@ CHIP_ERROR AttributeDataIB::Parser::CheckSchemaValidity() const tagPresenceMask |= (1 << to_underlying(Tag::kData)); PRETTY_PRINT_INCDEPTH(); - ReturnErrorOnFailure(ParseData(reader, 0)); + ReturnErrorOnFailure(CheckIMPayload(reader, 0, "Data")); PRETTY_PRINT_DECDEPTH(); break; default: diff --git a/src/app/MessageDef/AttributeDataIB.h b/src/app/MessageDef/AttributeDataIB.h index 7327f38692bba9..d2bec07b02b21b 100644 --- a/src/app/MessageDef/AttributeDataIB.h +++ b/src/app/MessageDef/AttributeDataIB.h @@ -90,10 +90,6 @@ class Parser : public StructParser * #CHIP_END_OF_TLV if there is no such element */ CHIP_ERROR GetData(TLV::TLVReader * const apReader) const; - -protected: - // A recursively callable function to parse a data element and pretty-print it. - CHIP_ERROR ParseData(TLV::TLVReader & aReader, int aDepth) const; }; class Builder : public StructBuilder diff --git a/src/app/MessageDef/CommandDataIB.cpp b/src/app/MessageDef/CommandDataIB.cpp index 84b7c7bec9ae6e..c6c995420fb0f0 100644 --- a/src/app/MessageDef/CommandDataIB.cpp +++ b/src/app/MessageDef/CommandDataIB.cpp @@ -28,176 +28,6 @@ namespace chip { namespace app { -CHIP_ERROR -CommandDataIB::Parser::ParseFields(TLV::TLVReader & aReader, int aDepth) const -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - if (aDepth == 0) - { - PRETTY_PRINT("\tCommandFields = "); - } - else - { - if (TLV::IsContextTag(aReader.GetTag())) - { - PRETTY_PRINT("\t0x%" PRIx32 " = ", TLV::TagNumFromTag(aReader.GetTag())); - } - else if (TLV::IsProfileTag(aReader.GetTag())) - { - PRETTY_PRINT("\t0x%" PRIx32 "::0x%" PRIx32 " = ", TLV::ProfileIdFromTag(aReader.GetTag()), - TLV::TagNumFromTag(aReader.GetTag())); - } - else - { - // Anonymous tag, don't print anything - } - } - - switch (aReader.GetType()) - { - case TLV::kTLVType_Structure: - PRETTY_PRINT("\t{"); - break; - - case TLV::kTLVType_Array: - PRETTY_PRINT_SAMELINE("["); - PRETTY_PRINT("\t\t"); - break; - - case TLV::kTLVType_SignedInteger: { - int64_t value_s64; - - err = aReader.Get(value_s64); - SuccessOrExit(err); - - PRETTY_PRINT_SAMELINE("%" PRId64 ", ", value_s64); - break; - } - - case TLV::kTLVType_UnsignedInteger: { - uint64_t value_u64; - - err = aReader.Get(value_u64); - SuccessOrExit(err); - - PRETTY_PRINT_SAMELINE("%" PRIu64 ", ", value_u64); - break; - } - - case TLV::kTLVType_FloatingPointNumber: { - double value_fp; - - err = aReader.Get(value_fp); - SuccessOrExit(err); - - PRETTY_PRINT_SAMELINE("%lf, ", value_fp); - break; - } - case TLV::kTLVType_Boolean: { - bool value_b; - - err = aReader.Get(value_b); - SuccessOrExit(err); - - PRETTY_PRINT_SAMELINE("%s, ", value_b ? "true" : "false"); - break; - } - - case TLV::kTLVType_UTF8String: { - char value_s[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; - - err = aReader.GetString(value_s, sizeof(value_s)); - VerifyOrExit(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, ); - - if (err == CHIP_ERROR_BUFFER_TOO_SMALL) - { - PRETTY_PRINT_SAMELINE("... (byte string too long) ..."); - err = CHIP_NO_ERROR; - } - else - { - PRETTY_PRINT_SAMELINE("\"%s\", ", value_s); - } - break; - } - - case TLV::kTLVType_ByteString: { - uint8_t value_b[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; - uint32_t len, readerLen; - - readerLen = aReader.GetLength(); - - err = aReader.GetBytes(value_b, sizeof(value_b)); - VerifyOrExit(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, ); - - PRETTY_PRINT_SAMELINE("["); - PRETTY_PRINT("\t\t"); - - if (readerLen < sizeof(value_b)) - { - len = readerLen; - } - else - { - len = sizeof(value_b); - } - - if (err == CHIP_ERROR_BUFFER_TOO_SMALL) - { - PRETTY_PRINT_SAMELINE("... (byte string too long) ..."); - } - else - { - for (size_t i = 0; i < len; i++) - { - PRETTY_PRINT_SAMELINE("0x%x, ", value_b[i]); - } - } - - err = CHIP_NO_ERROR; - PRETTY_PRINT("]"); - break; - } - - case TLV::kTLVType_Null: - PRETTY_PRINT_SAMELINE("NULL"); - break; - - default: - PRETTY_PRINT_SAMELINE("--"); - break; - } - - if (aReader.GetType() == TLV::kTLVType_Structure || aReader.GetType() == TLV::kTLVType_Array) - { - const char terminating_char = (aReader.GetType() == TLV::kTLVType_Structure) ? '}' : ']'; - TLV::TLVType type; - - IgnoreUnusedVariable(terminating_char); - - err = aReader.EnterContainer(type); - SuccessOrExit(err); - - while ((err = aReader.Next()) == CHIP_NO_ERROR) - { - PRETTY_PRINT_INCDEPTH(); - - err = ParseFields(aReader, aDepth + 1); - SuccessOrExit(err); - - PRETTY_PRINT_DECDEPTH(); - } - - PRETTY_PRINT("\t%c,", terminating_char); - - err = aReader.ExitContainer(type); - SuccessOrExit(err); - } - -exit: - return err; -} #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK CHIP_ERROR CommandDataIB::Parser::CheckSchemaValidity() const @@ -239,7 +69,9 @@ CHIP_ERROR CommandDataIB::Parser::CheckSchemaValidity() const // check if this tag has appeared before VerifyOrReturnError(!(tagPresenceMask & (1 << to_underlying(Tag::kFields))), CHIP_ERROR_INVALID_TLV_TAG); tagPresenceMask |= (1 << to_underlying(Tag::kFields)); - ReturnErrorOnFailure(ParseFields(reader, 0)); + PRETTY_PRINT_INCDEPTH(); + ReturnErrorOnFailure(CheckIMPayload(reader, 0, "CommandFields")); + PRETTY_PRINT_DECDEPTH(); break; default: PRETTY_PRINT("Unknown tag num %" PRIu32, tagNum); diff --git a/src/app/MessageDef/CommandDataIB.h b/src/app/MessageDef/CommandDataIB.h index 0ff0cc576fa9e0..1b8d361e0a8e0c 100644 --- a/src/app/MessageDef/CommandDataIB.h +++ b/src/app/MessageDef/CommandDataIB.h @@ -79,10 +79,6 @@ class Parser : public StructParser * #CHIP_END_OF_TLV if there is no such element */ CHIP_ERROR GetFields(TLV::TLVReader * const apReader) const; - -protected: - // A recursively callable function to parse a data element and pretty-print it. - CHIP_ERROR ParseFields(TLV::TLVReader & aReader, int aDepth) const; }; class Builder : public StructBuilder diff --git a/src/app/MessageDef/EventDataIB.cpp b/src/app/MessageDef/EventDataIB.cpp index 7b78cb8aadfebb..e5f228f52a7090 100644 --- a/src/app/MessageDef/EventDataIB.cpp +++ b/src/app/MessageDef/EventDataIB.cpp @@ -33,150 +33,6 @@ namespace chip { namespace app { -CHIP_ERROR -EventDataIB::Parser::ParseData(TLV::TLVReader & aReader, int aDepth) const -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - if (aDepth == 0) - { - PRETTY_PRINT("EventData = "); - } - else - { - if (TLV::IsContextTag(aReader.GetTag())) - { - PRETTY_PRINT("0x%" PRIx32 " = ", TLV::TagNumFromTag(aReader.GetTag())); - } - else if (TLV::IsProfileTag(aReader.GetTag())) - { - PRETTY_PRINT("0x%" PRIx32 "::0x%" PRIx32 " = ", TLV::ProfileIdFromTag(aReader.GetTag()), - TLV::TagNumFromTag(aReader.GetTag())); - } - else - { - // Anonymous tag, don't print anything - } - } - - switch (aReader.GetType()) - { - case TLV::kTLVType_Structure: - PRETTY_PRINT("{"); - break; - - case TLV::kTLVType_Array: - PRETTY_PRINT_SAMELINE("["); - PRETTY_PRINT("\t\t"); - break; - - case TLV::kTLVType_SignedInteger: { - int64_t value_s64; - ReturnErrorOnFailure(aReader.Get(value_s64)); - PRETTY_PRINT_SAMELINE("%" PRId64 ", ", value_s64); - break; - } - - case TLV::kTLVType_UnsignedInteger: { - uint64_t value_u64; - ReturnErrorOnFailure(aReader.Get(value_u64)); - PRETTY_PRINT_SAMELINE("%" PRIu64 ", ", value_u64); - break; - } - - case TLV::kTLVType_Boolean: { - bool value_b; - ReturnErrorOnFailure(aReader.Get(value_b)); - PRETTY_PRINT_SAMELINE("%s, ", value_b ? "true" : "false"); - break; - } - - case TLV::kTLVType_UTF8String: { - char value_s[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; - - err = aReader.GetString(value_s, sizeof(value_s)); - VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, err); - - if (err == CHIP_ERROR_BUFFER_TOO_SMALL) - { - PRETTY_PRINT_SAMELINE("... (byte string too long) ..."); - err = CHIP_NO_ERROR; - } - else - { - PRETTY_PRINT_SAMELINE("\"%s\", ", value_s); - } - break; - } - - case TLV::kTLVType_ByteString: { - uint8_t value_b[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; - uint32_t len, readerLen; - - readerLen = aReader.GetLength(); - - err = aReader.GetBytes(value_b, sizeof(value_b)); - VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, err); - - PRETTY_PRINT_SAMELINE("["); - PRETTY_PRINT("\t\t"); - - if (readerLen < sizeof(value_b)) - { - len = readerLen; - } - else - { - len = sizeof(value_b); - } - - if (err == CHIP_ERROR_BUFFER_TOO_SMALL) - { - PRETTY_PRINT_SAMELINE("... (byte string too long) ..."); - } - else - { - for (size_t i = 0; i < len; i++) - { - PRETTY_PRINT_SAMELINE("0x%x, ", value_b[i]); - } - } - - err = CHIP_NO_ERROR; - PRETTY_PRINT("\t\t]"); - break; - } - - case TLV::kTLVType_Null: - PRETTY_PRINT_SAMELINE("NULL"); - break; - - default: - PRETTY_PRINT_SAMELINE("--"); - break; - } - - if (aReader.GetType() == TLV::kTLVType_Structure || aReader.GetType() == TLV::kTLVType_Array) - { - const char terminating_char = (aReader.GetType() == TLV::kTLVType_Structure) ? '}' : ']'; - TLV::TLVType type; - - IgnoreUnusedVariable(terminating_char); - - ReturnErrorOnFailure(aReader.EnterContainer(type)); - - while ((err = aReader.Next()) == CHIP_NO_ERROR) - { - PRETTY_PRINT_INCDEPTH(); - ReturnErrorOnFailure(ParseData(aReader, aDepth + 1)); - PRETTY_PRINT_DECDEPTH(); - } - - PRETTY_PRINT("%c,", terminating_char); - ReturnErrorOnFailure(aReader.ExitContainer(type)); - } - return CHIP_NO_ERROR; -} #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK CHIP_ERROR EventDataIB::Parser::CheckSchemaValidity() const @@ -307,7 +163,7 @@ CHIP_ERROR EventDataIB::Parser::CheckSchemaValidity() const tagPresenceMask |= (1 << to_underlying(Tag::kData)); PRETTY_PRINT_INCDEPTH(); - ReturnErrorOnFailure(ParseData(reader, 0)); + ReturnErrorOnFailure(CheckIMPayload(reader, 0, "EventData")); PRETTY_PRINT_DECDEPTH(); break; default: diff --git a/src/app/MessageDef/EventDataIB.h b/src/app/MessageDef/EventDataIB.h index 4e52d7d2474cc8..ca5f277bc20e4a 100644 --- a/src/app/MessageDef/EventDataIB.h +++ b/src/app/MessageDef/EventDataIB.h @@ -160,9 +160,6 @@ class Parser : public StructParser CHIP_ERROR DecodeEventHeader(EventHeader & aEventHeader); protected: - // A recursively callable function to parse a data element and pretty-print it. - CHIP_ERROR ParseData(TLV::TLVReader & aReader, int aDepth) const; - CHIP_ERROR ProcessEventPath(EventPathIB::Parser & aEventPath, ConcreteEventPath & aConcreteEventPath); CHIP_ERROR ProcessEventTimestamp(EventHeader & aEventHeader); }; diff --git a/src/app/MessageDef/MessageDefHelper.cpp b/src/app/MessageDef/MessageDefHelper.cpp index 4c19ec7abb3454..dfaccaf6c01abe 100644 --- a/src/app/MessageDef/MessageDefHelper.cpp +++ b/src/app/MessageDef/MessageDefHelper.cpp @@ -98,5 +98,167 @@ void DecreaseDepth() } #endif +#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK +CHIP_ERROR CheckIMPayload(TLV::TLVReader & aReader, int aDepth, const char * aLabel) +{ + if (aDepth == 0) + { + PRETTY_PRINT("%s = ", aLabel); + } + else + { + if (TLV::IsContextTag(aReader.GetTag())) + { + PRETTY_PRINT("0x%" PRIx32 " = ", TLV::TagNumFromTag(aReader.GetTag())); + } + else if (TLV::IsProfileTag(aReader.GetTag())) + { + PRETTY_PRINT("0x%" PRIx32 "::0x%" PRIx32 " = ", TLV::ProfileIdFromTag(aReader.GetTag()), + TLV::TagNumFromTag(aReader.GetTag())); + } + else + { + // Anonymous tag, don't print anything + } + } + + switch (aReader.GetType()) + { + case TLV::kTLVType_Structure: + PRETTY_PRINT("{"); + break; + + case TLV::kTLVType_Array: + PRETTY_PRINT_SAMELINE("["); + PRETTY_PRINT("\t\t"); + break; + + case TLV::kTLVType_SignedInteger: { + int64_t value_s64; + + ReturnErrorOnFailure(aReader.Get(value_s64)); + + PRETTY_PRINT_SAMELINE("%" PRId64 ", ", value_s64); + break; + } + + case TLV::kTLVType_UnsignedInteger: { + uint64_t value_u64; + + ReturnErrorOnFailure(aReader.Get(value_u64)); + + PRETTY_PRINT_SAMELINE("%" PRIu64 ", ", value_u64); + break; + } + + case TLV::kTLVType_FloatingPointNumber: { + double value_fp; + + ReturnErrorOnFailure(aReader.Get(value_fp)); + + PRETTY_PRINT_SAMELINE("%f, ", value_fp); + break; + } + case TLV::kTLVType_Boolean: { + bool value_b; + + ReturnErrorOnFailure(aReader.Get(value_b)); + + PRETTY_PRINT_SAMELINE("%s, ", value_b ? "true" : "false"); + break; + } + + case TLV::kTLVType_UTF8String: { + char value_s[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; + + CHIP_ERROR err = aReader.GetString(value_s, sizeof(value_s)); + VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, err); + + if (err == CHIP_ERROR_BUFFER_TOO_SMALL) + { + PRETTY_PRINT_SAMELINE("... (byte string too long) ..."); + } + else + { + PRETTY_PRINT_SAMELINE("\"%s\", ", value_s); + } + break; + } + + case TLV::kTLVType_ByteString: { + uint8_t value_b[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; + uint32_t len, readerLen; + + readerLen = aReader.GetLength(); + + CHIP_ERROR err = aReader.GetBytes(value_b, sizeof(value_b)); + VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_ERROR_BUFFER_TOO_SMALL, err); + + PRETTY_PRINT_SAMELINE("["); + PRETTY_PRINT("\t\t"); + + if (readerLen < sizeof(value_b)) + { + len = readerLen; + } + else + { + len = sizeof(value_b); + } + + if (err == CHIP_ERROR_BUFFER_TOO_SMALL) + { + PRETTY_PRINT_SAMELINE("... (byte string too long) ..."); + } + else + { + for (size_t i = 0; i < len; i++) + { + PRETTY_PRINT_SAMELINE("0x%x, ", value_b[i]); + } + } + + PRETTY_PRINT("]"); + break; + } + + case TLV::kTLVType_Null: + PRETTY_PRINT_SAMELINE("NULL"); + break; + + default: + PRETTY_PRINT_SAMELINE("--"); + break; + } + + if (aReader.GetType() == TLV::kTLVType_Structure || aReader.GetType() == TLV::kTLVType_Array) + { + const char terminating_char = (aReader.GetType() == TLV::kTLVType_Structure) ? '}' : ']'; + TLV::TLVType type; + + IgnoreUnusedVariable(terminating_char); + + ReturnErrorOnFailure(aReader.EnterContainer(type)); + + CHIP_ERROR err; + while ((err = aReader.Next()) == CHIP_NO_ERROR) + { + PRETTY_PRINT_INCDEPTH(); + + ReturnErrorOnFailure(CheckIMPayload(aReader, aDepth + 1, aLabel)); + + PRETTY_PRINT_DECDEPTH(); + } + + PRETTY_PRINT("%c,", terminating_char); + + ReturnErrorOnFailure(aReader.ExitContainer(type)); + } + + return CHIP_NO_ERROR; +} + +#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK + }; // namespace app }; // namespace chip diff --git a/src/app/MessageDef/MessageDefHelper.h b/src/app/MessageDef/MessageDefHelper.h index 354085cacade0e..bc6f8ec44294a3 100644 --- a/src/app/MessageDef/MessageDefHelper.h +++ b/src/app/MessageDef/MessageDefHelper.h @@ -33,6 +33,9 @@ // We need CHIPLogging.h to get the right value for CHIP_DETAIL_LOGGING here. #include +#include +#include + namespace chip { namespace app { #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK && CHIP_DETAIL_LOGGING @@ -77,5 +80,12 @@ void DecreaseDepth(); #define PRETTY_PRINT_INCDEPTH() #define PRETTY_PRINT_DECDEPTH() #endif + +#if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK +// Parse an IM payload (attribute value, command fields, event fields, +// recursively parsing any complex types encountered. +CHIP_ERROR CheckIMPayload(TLV::TLVReader & aReader, int aDepth, const char * aLabel); +#endif // CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK + }; // namespace app }; // namespace chip