[logging] Add DUA region (#5262)

This commit is contained in:
Rongli Sun
2020-07-20 23:26:12 -07:00
committed by Jonathan Hui
parent 6c1abeab90
commit 8d1060fb60
8 changed files with 150 additions and 1 deletions
+1
View File
@@ -238,6 +238,7 @@ if(OT_FULL_LOGS)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_BBR=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_CLI=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_COAP=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_DUA=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_ICMP=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_IP6=1")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_MAC=1")
+1
View File
@@ -286,6 +286,7 @@ LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_ARP=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_BBR=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_CLI=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_COAP=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_DUA=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_ICMP=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_IP6=1
LOG_FLAGS += -DOPENTHREAD_CONFIG_LOG_MAC=1
+1 -1
View File
@@ -53,7 +53,7 @@ extern "C" {
* @note This number versions both OpenThread platform and user APIs.
*
*/
#define OPENTHREAD_API_VERSION (17)
#define OPENTHREAD_API_VERSION (18)
/**
* @addtogroup api-instance
+1
View File
@@ -136,6 +136,7 @@ typedef enum otLogRegion
OT_LOG_REGION_UTIL = 16, ///< Utility module
OT_LOG_REGION_BBR = 17, ///< Backbone Router (available since Thread 1.2)
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)
} otLogRegion;
/**
+128
View File
@@ -91,6 +91,7 @@ extern "C" {
#define _OT_REGION_UTIL_PREFIX "-UTIL----: "
#define _OT_REGION_BBR_PREFIX "-BBR-----: "
#define _OT_REGION_MLR_PREFIX "-MLR-----: "
#define _OT_REGION_DUA_PREFIX "-DUA-----: "
#else
#define _OT_REGION_API_PREFIX _OT_REGION_SUFFIX
#define _OT_REGION_MLE_PREFIX _OT_REGION_SUFFIX
@@ -110,6 +111,7 @@ extern "C" {
#define _OT_REGION_UTIL_PREFIX _OT_REGION_SUFFIX
#define _OT_REGION_BBR_PREFIX _OT_REGION_SUFFIX
#define _OT_REGION_MLR_PREFIX _OT_REGION_SUFFIX
#define _OT_REGION_DUA_PREFIX _OT_REGION_SUFFIX
#endif
/**
@@ -1160,6 +1162,64 @@ extern "C" {
#define otLogDebgCoap(...)
#endif
/**
* @def otLogCritDua
*
* This method generates a log with level critical for the Domain Unicast Address region.
*
* @param[in] ... Arguments for the format specification.
*
*/
/**
* @def otLogWarnDua
*
* This method generates a log with level warning for the Domain Unicast Address region.
*
* @param[in] ... Arguments for the format specification.
*
*/
/**
* @def otLogNoteDua
*
* This method generates a log with level note for the Domain Unicast Address region.
*
* @param[in] ... Arguments for the format specification.
*
*/
/**
* @def otLogInfoDua
*
* This method generates a log with level info for the Domain Unicast Address region.
*
* @param[in] ... Arguments for the format specification.
*
*/
/**
* @def otLogDebgDua
*
* This method generates a log with level debug for the Domain Unicast Address region.
*
* @param[in] ... Arguments for the format specification.
*
*/
#if OPENTHREAD_CONFIG_LOG_DUA == 1
#define otLogCritDua(...) otLogCrit(OT_LOG_REGION_DUA, _OT_REGION_DUA_PREFIX __VA_ARGS__)
#define otLogWarnDua(...) otLogWarn(OT_LOG_REGION_DUA, _OT_REGION_DUA_PREFIX __VA_ARGS__)
#define otLogNoteDua(...) otLogNote(OT_LOG_REGION_DUA, _OT_REGION_DUA_PREFIX __VA_ARGS__)
#define otLogInfoDua(...) otLogInfo(OT_LOG_REGION_DUA, _OT_REGION_DUA_PREFIX __VA_ARGS__)
#define otLogDebgDua(...) otLogDebg(OT_LOG_REGION_DUA, _OT_REGION_DUA_PREFIX __VA_ARGS__)
#else
#define otLogCritDua(...)
#define otLogWarnDua(...)
#define otLogNoteDua(...)
#define otLogInfoDua(...)
#define otLogDebgDua(...)
#endif
/**
* @def otLogCritPlat
*
@@ -1923,6 +1983,74 @@ extern "C" {
#define otDumpDebgCore(aId, aBuf, aLength)
#endif
/**
* @def otDumpCritDua
*
* This method generates a memory dump with log level critical and region Domain Unicast Address.
*
* @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 otDumpWarnDua
*
* This method generates a memory dump with log level warning and region Domain Unicast Address.
*
* @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 otDumpNoteDua
*
* This method generates a memory dump with log level note and region Domain Unicast Address.
*
* @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 otDumpInfoDua
*
* This method generates a memory dump with log level info and region Domain Unicast Address.
*
* @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 otDumpDebgDua
*
* This method generates a memory dump with log level debug and region Domain Unicast Address.
*
* @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_DUA == 1
#define otDumpCritDua(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_DUA, aId, aBuf, aLength)
#define otDumpWarnDua(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_DUA, aId, aBuf, aLength)
#define otDumpNoteDua(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_DUA, aId, aBuf, aLength)
#define otDumpInfoDua(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_DUA, aId, aBuf, aLength)
#define otDumpDebgDua(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_DUA, aId, aBuf, aLength)
#else
#define otDumpCritDua(aId, aBuf, aLength)
#define otDumpWarnDua(aId, aBuf, aLength)
#define otDumpNoteDua(aId, aBuf, aLength)
#define otDumpInfoDua(aId, aBuf, aLength)
#define otDumpDebgDua(aId, aBuf, aLength)
#endif
/**
* @def otDumpCritMem
*
+12
View File
@@ -287,6 +287,18 @@
#define OPENTHREAD_CONFIG_LOG_MLR 1
#endif
/**
* @def OPENTHREAD_CONFIG_LOG_DUA
*
* Note: available since Thread 1.2.
*
* Define to enable Domain Unicast Address (DUA) region logging.
*
*/
#ifndef OPENTHREAD_CONFIG_LOG_DUA
#define OPENTHREAD_CONFIG_LOG_DUA 1
#endif
/**
* @def OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
*
+1
View File
@@ -645,6 +645,7 @@ enum
SPINEL_NCP_LOG_REGION_OT_UTIL = 16,
SPINEL_NCP_LOG_REGION_OT_BBR = 17,
SPINEL_NCP_LOG_REGION_OT_MLR = 18,
SPINEL_NCP_LOG_REGION_OT_DUA = 19,
};
enum
+5
View File
@@ -612,9 +612,14 @@ unsigned int NcpBase::ConvertLogRegion(otLogRegion aLogRegion)
case OT_LOG_REGION_BBR:
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_BBR;
break;
case OT_LOG_REGION_MLR:
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_MLR;
break;
case OT_LOG_REGION_DUA:
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_DUA;
break;
}
return spinelLogRegion;