mirror of
https://github.com/espressif/openthread.git
synced 2026-08-14 14:47:46 +00:00
[logging] add log support for new region SRP (#6048)
This commit adds a new log region and the related definitions for Service Registration Protocol (SRP).
This commit is contained in:
committed by
Jonathan Hui
parent
a774d43fe9
commit
b179cf21be
@@ -312,6 +312,7 @@ if(OT_FULL_LOGS)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PLATFORM=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_REGION=1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_SRP=1")
|
||||
endif()
|
||||
|
||||
option(OT_OTNS "enable OTNS support")
|
||||
|
||||
@@ -341,6 +341,7 @@ LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_PKT_DUMP=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_PLATFORM=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_PREPEND_REGION=1
|
||||
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_SRP=1
|
||||
endif
|
||||
|
||||
CFLAGS += ${LOG_FLAGS}
|
||||
|
||||
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (59)
|
||||
#define OPENTHREAD_API_VERSION (60)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -138,6 +138,7 @@ typedef enum otLogRegion
|
||||
OT_LOG_REGION_MLR = 18, ///< Multicast Listener Registration (available since Thread 1.2)
|
||||
OT_LOG_REGION_DUA = 19, ///< Domain Unicast Address (available since Thread 1.2)
|
||||
OT_LOG_REGION_BR = 20, ///< Border Router
|
||||
OT_LOG_REGION_SRP = 21, ///< Service Registration Protocol (SRP)
|
||||
} otLogRegion;
|
||||
|
||||
/**
|
||||
|
||||
@@ -255,6 +255,7 @@ if (openthread_enable_core_config_args) {
|
||||
"OPENTHREAD_CONFIG_LOG_PLATFORM=1",
|
||||
"OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1",
|
||||
"OPENTHREAD_CONFIG_LOG_PREPEND_REGION=1",
|
||||
"OPENTHREAD_CONFIG_LOG_SRP=1",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ extern "C" {
|
||||
#define _OT_REGION_MLR_PREFIX "-MLR-----: "
|
||||
#define _OT_REGION_DUA_PREFIX "-DUA-----: "
|
||||
#define _OT_REGION_BR_PREFIX "-BR------: "
|
||||
#define _OT_REGION_SRP_PREFIX "-SRP-----: "
|
||||
#else
|
||||
#define _OT_REGION_API_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_MLE_PREFIX _OT_REGION_SUFFIX
|
||||
@@ -116,6 +117,7 @@ extern "C" {
|
||||
#define _OT_REGION_MLR_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_DUA_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_BR_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_SRP_PREFIX _OT_REGION_SUFFIX
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1302,6 +1304,64 @@ void otLogCertMeshCoP(const char *aFormat, ...);
|
||||
#define otLogDebgDua(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otLogCritSrp
|
||||
*
|
||||
* This function generates a log with level critical for the Service Registration Protocol (SRP) region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogWarnSrp
|
||||
*
|
||||
* This function generates a log with level warning for the Service Registration Protocol (SRP) region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogNoteSrp
|
||||
*
|
||||
* This function generates a log with level note for the Service Registration Protocol (SRP) region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogInfoSrp
|
||||
*
|
||||
* This function generates a log with level info for the Service Registration Protocol (SRP) region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogDebgSrp
|
||||
*
|
||||
* This function generates a log with level debug for the Service Registration Protocol (SRP) region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
#if OPENTHREAD_CONFIG_LOG_SRP
|
||||
#define otLogCritSrp(...) otLogCrit(OT_LOG_REGION_SRP, _OT_REGION_SRP_PREFIX, __VA_ARGS__)
|
||||
#define otLogWarnSrp(...) otLogWarn(OT_LOG_REGION_SRP, _OT_REGION_SRP_PREFIX, __VA_ARGS__)
|
||||
#define otLogNoteSrp(...) otLogNote(OT_LOG_REGION_SRP, _OT_REGION_SRP_PREFIX, __VA_ARGS__)
|
||||
#define otLogInfoSrp(...) otLogInfo(OT_LOG_REGION_SRP, _OT_REGION_SRP_PREFIX, __VA_ARGS__)
|
||||
#define otLogDebgSrp(...) otLogDebg(OT_LOG_REGION_SRP, _OT_REGION_SRP_PREFIX, __VA_ARGS__)
|
||||
#else
|
||||
#define otLogCritSrp(...)
|
||||
#define otLogWarnSrp(...)
|
||||
#define otLogNoteSrp(...)
|
||||
#define otLogInfoSrp(...)
|
||||
#define otLogDebgSrp(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otLogCritPlat
|
||||
*
|
||||
@@ -2137,6 +2197,74 @@ void otLogOtns(const char *aFormat, ...);
|
||||
#define otDumpDebgDua(aId, aBuf, aLength)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otDumpCritSrp
|
||||
*
|
||||
* This function generates a memory dump with log level critical and region Service Registration Protocol (SRP).
|
||||
*
|
||||
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
|
||||
* @param[in] aBuf A pointer to the buffer.
|
||||
* @param[in] aLength Number of bytes to print.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otDumpWarnSrp
|
||||
*
|
||||
* This function generates a memory dump with log level warning and region Service Registration Protocol (SRP).
|
||||
*
|
||||
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
|
||||
* @param[in] aBuf A pointer to the buffer.
|
||||
* @param[in] aLength Number of bytes to print.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otDumpNoteSrp
|
||||
*
|
||||
* This function generates a memory dump with log level note and region Service Registration Protocol (SRP).
|
||||
*
|
||||
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
|
||||
* @param[in] aBuf A pointer to the buffer.
|
||||
* @param[in] aLength Number of bytes to print.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otDumpInfoSrp
|
||||
*
|
||||
* This function generates a memory dump with log level info and region Service Registration Protocol (SRP).
|
||||
*
|
||||
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
|
||||
* @param[in] aBuf A pointer to the buffer.
|
||||
* @param[in] aLength Number of bytes to print.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otDumpDebgSrp
|
||||
*
|
||||
* This function generates a memory dump with log level debug and region Service Registration Protocol (SRP).
|
||||
*
|
||||
* @param[in] aId A pointer to a NULL-terminated string that is printed before the bytes.
|
||||
* @param[in] aBuf A pointer to the buffer.
|
||||
* @param[in] aLength Number of bytes to print.
|
||||
*
|
||||
*/
|
||||
#if OPENTHREAD_CONFIG_LOG_SRP
|
||||
#define otDumpCritSrp(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_SRP, aId, aBuf, aLength)
|
||||
#define otDumpWarnSrp(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_SRP, aId, aBuf, aLength)
|
||||
#define otDumpNoteSrp(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_SRP, aId, aBuf, aLength)
|
||||
#define otDumpInfoSrp(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_SRP, aId, aBuf, aLength)
|
||||
#define otDumpDebgSrp(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_SRP, aId, aBuf, aLength)
|
||||
#else
|
||||
#define otDumpCritSrp(aId, aBuf, aLength)
|
||||
#define otDumpWarnSrp(aId, aBuf, aLength)
|
||||
#define otDumpNoteSrp(aId, aBuf, aLength)
|
||||
#define otDumpInfoSrp(aId, aBuf, aLength)
|
||||
#define otDumpDebgSrp(aId, aBuf, aLength)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otDumpCritMem
|
||||
*
|
||||
|
||||
@@ -309,6 +309,16 @@
|
||||
#define OPENTHREAD_CONFIG_LOG_BR 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LOG_SRP
|
||||
*
|
||||
* Define to enable Service Registration Protocol (SRP) region logging.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_LOG_SRP
|
||||
#define OPENTHREAD_CONFIG_LOG_SRP 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
|
||||
*
|
||||
|
||||
@@ -693,6 +693,7 @@ enum
|
||||
SPINEL_NCP_LOG_REGION_OT_MLR = 18,
|
||||
SPINEL_NCP_LOG_REGION_OT_DUA = 19,
|
||||
SPINEL_NCP_LOG_REGION_OT_BR = 20,
|
||||
SPINEL_NCP_LOG_REGION_OT_SRP = 21,
|
||||
};
|
||||
|
||||
enum
|
||||
|
||||
@@ -624,9 +624,14 @@ unsigned int NcpBase::ConvertLogRegion(otLogRegion aLogRegion)
|
||||
case OT_LOG_REGION_DUA:
|
||||
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_DUA;
|
||||
break;
|
||||
|
||||
case OT_LOG_REGION_BR:
|
||||
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_BR;
|
||||
break;
|
||||
|
||||
case OT_LOG_REGION_SRP:
|
||||
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_SRP;
|
||||
break;
|
||||
}
|
||||
|
||||
return spinelLogRegion;
|
||||
|
||||
Reference in New Issue
Block a user