mirror of
https://github.com/espressif/openthread.git
synced 2026-08-18 08:29:52 +00:00
[tcp] add logging region for TCP (#6790)
This commit is contained in:
@@ -124,22 +124,23 @@ typedef enum otLogRegion
|
||||
OT_LOG_REGION_NET_DATA = 4, ///< Network Data
|
||||
OT_LOG_REGION_ICMP = 5, ///< ICMPv6
|
||||
OT_LOG_REGION_IP6 = 6, ///< IPv6
|
||||
OT_LOG_REGION_MAC = 7, ///< IEEE 802.15.4 MAC
|
||||
OT_LOG_REGION_MEM = 8, ///< Memory
|
||||
OT_LOG_REGION_NCP = 9, ///< NCP
|
||||
OT_LOG_REGION_MESH_COP = 10, ///< Mesh Commissioning Protocol
|
||||
OT_LOG_REGION_NET_DIAG = 11, ///< Network Diagnostic
|
||||
OT_LOG_REGION_PLATFORM = 12, ///< Platform
|
||||
OT_LOG_REGION_COAP = 13, ///< CoAP
|
||||
OT_LOG_REGION_CLI = 14, ///< CLI
|
||||
OT_LOG_REGION_CORE = 15, ///< OpenThread Core
|
||||
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)
|
||||
OT_LOG_REGION_BR = 20, ///< Border Router
|
||||
OT_LOG_REGION_SRP = 21, ///< Service Registration Protocol (SRP)
|
||||
OT_LOG_REGION_DNS = 22, ///< DNS
|
||||
OT_LOG_REGION_TCP = 7, ///< TCP
|
||||
OT_LOG_REGION_MAC = 8, ///< IEEE 802.15.4 MAC
|
||||
OT_LOG_REGION_MEM = 9, ///< Memory
|
||||
OT_LOG_REGION_NCP = 10, ///< NCP
|
||||
OT_LOG_REGION_MESH_COP = 11, ///< Mesh Commissioning Protocol
|
||||
OT_LOG_REGION_NET_DIAG = 12, ///< Network Diagnostic
|
||||
OT_LOG_REGION_PLATFORM = 13, ///< Platform
|
||||
OT_LOG_REGION_COAP = 14, ///< CoAP
|
||||
OT_LOG_REGION_CLI = 15, ///< CLI
|
||||
OT_LOG_REGION_CORE = 16, ///< OpenThread Core
|
||||
OT_LOG_REGION_UTIL = 17, ///< Utility module
|
||||
OT_LOG_REGION_BBR = 18, ///< Backbone Router (available since Thread 1.2)
|
||||
OT_LOG_REGION_MLR = 19, ///< Multicast Listener Registration (available since Thread 1.2)
|
||||
OT_LOG_REGION_DUA = 20, ///< Domain Unicast Address (available since Thread 1.2)
|
||||
OT_LOG_REGION_BR = 21, ///< Border Router
|
||||
OT_LOG_REGION_SRP = 22, ///< Service Registration Protocol (SRP)
|
||||
OT_LOG_REGION_DNS = 23, ///< DNS
|
||||
} otLogRegion;
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,12 +67,12 @@ static void Log(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aForma
|
||||
#if OPENTHREAD_CONFIG_LOG_PREPEND_REGION
|
||||
{
|
||||
static const char *const kRegionPrefixStrings[] = {
|
||||
_OT_REGION_SUFFIX, _OT_REGION_API_PREFIX, _OT_REGION_MLE_PREFIX, _OT_REGION_ARP_PREFIX,
|
||||
_OT_REGION_NET_DATA_PREFIX, _OT_REGION_ICMP_PREFIX, _OT_REGION_IP6_PREFIX, _OT_REGION_MAC_PREFIX,
|
||||
_OT_REGION_MEM_PREFIX, _OT_REGION_NCP_PREFIX, _OT_REGION_MESH_COP_PREFIX, _OT_REGION_NET_DIAG_PREFIX,
|
||||
_OT_REGION_PLATFORM_PREFIX, _OT_REGION_COAP_PREFIX, _OT_REGION_CLI_PREFIX, _OT_REGION_CORE_PREFIX,
|
||||
_OT_REGION_UTIL_PREFIX, _OT_REGION_BBR_PREFIX, _OT_REGION_MLR_PREFIX, _OT_REGION_DUA_PREFIX,
|
||||
_OT_REGION_BR_PREFIX, _OT_REGION_SRP_PREFIX, _OT_REGION_DNS_PREFIX,
|
||||
_OT_REGION_SUFFIX, _OT_REGION_API_PREFIX, _OT_REGION_MLE_PREFIX, _OT_REGION_ARP_PREFIX,
|
||||
_OT_REGION_NET_DATA_PREFIX, _OT_REGION_ICMP_PREFIX, _OT_REGION_IP6_PREFIX, _OT_REGION_TCP_PREFIX,
|
||||
_OT_REGION_MAC_PREFIX, _OT_REGION_MEM_PREFIX, _OT_REGION_NCP_PREFIX, _OT_REGION_MESH_COP_PREFIX,
|
||||
_OT_REGION_NET_DIAG_PREFIX, _OT_REGION_PLATFORM_PREFIX, _OT_REGION_COAP_PREFIX, _OT_REGION_CLI_PREFIX,
|
||||
_OT_REGION_CORE_PREFIX, _OT_REGION_UTIL_PREFIX, _OT_REGION_BBR_PREFIX, _OT_REGION_MLR_PREFIX,
|
||||
_OT_REGION_DUA_PREFIX, _OT_REGION_BR_PREFIX, _OT_REGION_SRP_PREFIX, _OT_REGION_DNS_PREFIX,
|
||||
};
|
||||
|
||||
if (aLogRegion < OT_ARRAY_LENGTH(kRegionPrefixStrings))
|
||||
|
||||
@@ -81,6 +81,7 @@ extern "C" {
|
||||
#define _OT_REGION_NET_DATA_PREFIX "-N-DATA--: "
|
||||
#define _OT_REGION_ICMP_PREFIX "-ICMP----: "
|
||||
#define _OT_REGION_IP6_PREFIX "-IP6-----: "
|
||||
#define _OT_REGION_TCP_PREFIX "-TCP-----: "
|
||||
#define _OT_REGION_MAC_PREFIX "-MAC-----: "
|
||||
#define _OT_REGION_MEM_PREFIX "-MEM-----: "
|
||||
#define _OT_REGION_NCP_PREFIX "-NCP-----: "
|
||||
@@ -108,6 +109,7 @@ extern "C" {
|
||||
#define _OT_REGION_NET_DATA_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_ICMP_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_IP6_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_TCP_PREFIX _OT_REGION_PREFIX
|
||||
#define _OT_REGION_MAC_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_MEM_PREFIX _OT_REGION_SUFFIX
|
||||
#define _OT_REGION_NCP_PREFIX _OT_REGION_SUFFIX
|
||||
@@ -809,6 +811,64 @@ void _otLogDebg(otLogRegion aRegion, const char *aFormat, ...);
|
||||
#define otLogDebgIp6(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otLogCritTcp
|
||||
*
|
||||
* This function generates a log with level critical for the TCP region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogWarnTcp
|
||||
*
|
||||
* This function generates a log with level warning for the TCP region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogNoteTcp
|
||||
*
|
||||
* This function generates a log with level note for the TCP region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogInfoTcp
|
||||
*
|
||||
* This function generates a log with level info for the TCP region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def otLogDebgTcp
|
||||
*
|
||||
* This function generates a log with level debug for the TCP region.
|
||||
*
|
||||
* @param[in] ... Arguments for the format specification.
|
||||
*
|
||||
*/
|
||||
#if OPENTHREAD_CONFIG_LOG_TCP
|
||||
#define otLogCritTcp(...) otLogCrit(OT_LOG_REGION_TCP, _OT_REGION_TCP_PREFIX, __VA_ARGS__)
|
||||
#define otLogWarnTcp(...) otLogWarn(OT_LOG_REGION_TCP, _OT_REGION_TCP_PREFIX, __VA_ARGS__)
|
||||
#define otLogNoteTcp(...) otLogNote(OT_LOG_REGION_TCP, _OT_REGION_TCP_PREFIX, __VA_ARGS__)
|
||||
#define otLogInfoTcp(...) otLogInfo(OT_LOG_REGION_TCP, _OT_REGION_TCP_PREFIX, __VA_ARGS__)
|
||||
#define otLogDebgTcp(...) otLogDebg(OT_LOG_REGION_TCP, _OT_REGION_TCP_PREFIX, __VA_ARGS__)
|
||||
#else
|
||||
#define otLogCritTcp(...)
|
||||
#define otLogWarnTcp(...)
|
||||
#define otLogNoteTcp(...)
|
||||
#define otLogInfoTcp(...)
|
||||
#define otLogDebgTcp(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otLogCritMac
|
||||
*
|
||||
@@ -2062,6 +2122,74 @@ void otLogOtns(const char *aFormat, ...);
|
||||
#define otDumpDebgIp6(aId, aBuf, aLength)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otDumpCritTcp
|
||||
*
|
||||
* This function generates a memory dump with log level debug and region TCP.
|
||||
*
|
||||
* @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 otDumpWartTcp
|
||||
*
|
||||
* This function generates a memory dump with log level warning and region TCP.
|
||||
*
|
||||
* @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 otDumpNottTcp
|
||||
*
|
||||
* This function generates a memory dump with log level note and region TCP.
|
||||
*
|
||||
* @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 otDumpInftTcp
|
||||
*
|
||||
* This function generates a memory dump with log level info and region TCP.
|
||||
*
|
||||
* @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 otDumpDebtTcp
|
||||
*
|
||||
* This function generates a memory dump with log level debug and region TCP.
|
||||
*
|
||||
* @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_TCP
|
||||
#define otDumpCritTcp(aId, aBuf, aLength) otDumpCrit(OT_LOG_REGION_TCP, aId, aBuf, aLength)
|
||||
#define otDumpWarnTcp(aId, aBuf, aLength) otDumpWarn(OT_LOG_REGION_TCP, aId, aBuf, aLength)
|
||||
#define otDumpNoteTcp(aId, aBuf, aLength) otDumpNote(OT_LOG_REGION_TCP, aId, aBuf, aLength)
|
||||
#define otDumpInfoTcp(aId, aBuf, aLength) otDumpInfo(OT_LOG_REGION_TCP, aId, aBuf, aLength)
|
||||
#define otDumpDebgTcp(aId, aBuf, aLength) otDumpDebg(OT_LOG_REGION_TCP, aId, aBuf, aLength)
|
||||
#else
|
||||
#define otDumpCritTcp(aId, aBuf, aLength)
|
||||
#define otDumpWarnTcp(aId, aBuf, aLength)
|
||||
#define otDumpNoteTcp(aId, aBuf, aLength)
|
||||
#define otDumpInfoTcp(aId, aBuf, aLength)
|
||||
#define otDumpDebgTcp(aId, aBuf, aLength)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def otDumpCritMac
|
||||
*
|
||||
|
||||
@@ -173,6 +173,16 @@
|
||||
#define OPENTHREAD_CONFIG_LOG_IP6 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LOG_TCP
|
||||
*
|
||||
* Define to enable IPv6 logging.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_LOG_TCP
|
||||
#define OPENTHREAD_CONFIG_LOG_TCP 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LOG_MAC
|
||||
*
|
||||
|
||||
+17
-16
@@ -693,22 +693,23 @@ enum
|
||||
SPINEL_NCP_LOG_REGION_OT_NET_DATA = 4,
|
||||
SPINEL_NCP_LOG_REGION_OT_ICMP = 5,
|
||||
SPINEL_NCP_LOG_REGION_OT_IP6 = 6,
|
||||
SPINEL_NCP_LOG_REGION_OT_MAC = 7,
|
||||
SPINEL_NCP_LOG_REGION_OT_MEM = 8,
|
||||
SPINEL_NCP_LOG_REGION_OT_NCP = 9,
|
||||
SPINEL_NCP_LOG_REGION_OT_MESH_COP = 10,
|
||||
SPINEL_NCP_LOG_REGION_OT_NET_DIAG = 11,
|
||||
SPINEL_NCP_LOG_REGION_OT_PLATFORM = 12,
|
||||
SPINEL_NCP_LOG_REGION_OT_COAP = 13,
|
||||
SPINEL_NCP_LOG_REGION_OT_CLI = 14,
|
||||
SPINEL_NCP_LOG_REGION_OT_CORE = 15,
|
||||
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,
|
||||
SPINEL_NCP_LOG_REGION_OT_BR = 20,
|
||||
SPINEL_NCP_LOG_REGION_OT_SRP = 21,
|
||||
SPINEL_NCP_LOG_REGION_OT_DNS = 22,
|
||||
SPINEL_NCP_LOG_REGION_OT_TCP = 7,
|
||||
SPINEL_NCP_LOG_REGION_OT_MAC = 8,
|
||||
SPINEL_NCP_LOG_REGION_OT_MEM = 9,
|
||||
SPINEL_NCP_LOG_REGION_OT_NCP = 10,
|
||||
SPINEL_NCP_LOG_REGION_OT_MESH_COP = 11,
|
||||
SPINEL_NCP_LOG_REGION_OT_NET_DIAG = 12,
|
||||
SPINEL_NCP_LOG_REGION_OT_PLATFORM = 13,
|
||||
SPINEL_NCP_LOG_REGION_OT_COAP = 14,
|
||||
SPINEL_NCP_LOG_REGION_OT_CLI = 15,
|
||||
SPINEL_NCP_LOG_REGION_OT_CORE = 16,
|
||||
SPINEL_NCP_LOG_REGION_OT_UTIL = 17,
|
||||
SPINEL_NCP_LOG_REGION_OT_BBR = 18,
|
||||
SPINEL_NCP_LOG_REGION_OT_MLR = 19,
|
||||
SPINEL_NCP_LOG_REGION_OT_DUA = 10,
|
||||
SPINEL_NCP_LOG_REGION_OT_BR = 21,
|
||||
SPINEL_NCP_LOG_REGION_OT_SRP = 22,
|
||||
SPINEL_NCP_LOG_REGION_OT_DNS = 23,
|
||||
};
|
||||
|
||||
enum
|
||||
|
||||
@@ -591,6 +591,10 @@ unsigned int NcpBase::ConvertLogRegion(otLogRegion aLogRegion)
|
||||
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_IP6;
|
||||
break;
|
||||
|
||||
case OT_LOG_REGION_TCP:
|
||||
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_TCP;
|
||||
break;
|
||||
|
||||
case OT_LOG_REGION_MAC:
|
||||
spinelLogRegion = SPINEL_NCP_LOG_REGION_OT_MAC;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user