Enable Windows WPP Logging Support (#678)

* Enable support for WPP logging.
This commit is contained in:
Nick Banks
2016-10-03 10:45:25 -07:00
committed by Jonathan Hui
parent a6d2f19c9b
commit fbc5245d79
23 changed files with 537 additions and 20 deletions
+24 -4
View File
@@ -199,34 +199,54 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;OPENTHREAD_MULTIPLE_INSTANCE</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;WINDOWS_LOGGING;OPENTHREAD_MULTIPLE_INSTANCE</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4100;4706;4748;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>true</TreatWarningAsError>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>..\..\include\platform\logging-windows.h</WppScanConfigurationData>
<WppAdditionalOptions>-km %(WppAdditionalOptions)</WppAdditionalOptions>
<WppModuleName>otCore</WppModuleName>
<WppSearchString>WPP_INIT_TRACING</WppSearchString>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PreprocessorDefinitions>_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;OPENTHREAD_MULTIPLE_INSTANCE</PreprocessorDefinitions>
<PreprocessorDefinitions>_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;WINDOWS_LOGGING;OPENTHREAD_MULTIPLE_INSTANCE</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4100;4706;4748;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>true</TreatWarningAsError>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>..\..\include\platform\logging-windows.h</WppScanConfigurationData>
<WppAdditionalOptions>-km %(WppAdditionalOptions)</WppAdditionalOptions>
<WppModuleName>otCore</WppModuleName>
<WppSearchString>WPP_INIT_TRACING</WppSearchString>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;OPENTHREAD_MULTIPLE_INSTANCE</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;WINDOWS_LOGGING;OPENTHREAD_MULTIPLE_INSTANCE</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4100;4603;4627;4706;4986;4987;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>true</TreatWarningAsError>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>..\..\include\platform\logging-windows.h</WppScanConfigurationData>
<WppAdditionalOptions>-km %(WppAdditionalOptions)</WppAdditionalOptions>
<WppModuleName>otCore</WppModuleName>
<WppSearchString>WPP_INIT_TRACING</WppSearchString>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;OPENTHREAD_MULTIPLE_INSTANCE</PreprocessorDefinitions>
<PreprocessorDefinitions>_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;WINDOWS_LOGGING;OPENTHREAD_MULTIPLE_INSTANCE</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4100;4603;4627;4706;4986;4987;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>true</TreatWarningAsError>
<WppEnabled>true</WppEnabled>
<WppScanConfigurationData>..\..\include\platform\logging-windows.h</WppScanConfigurationData>
<WppAdditionalOptions>-km %(WppAdditionalOptions)</WppAdditionalOptions>
<WppModuleName>otCore</WppModuleName>
<WppSearchString>WPP_INIT_TRACING</WppSearchString>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+411
View File
@@ -0,0 +1,411 @@
/*
* Copyright (c) 2016, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* @brief
* This file defines the WPP Tracing Definitions.
*/
#ifndef _LOGGING_WINDOWS_H
#define _LOGGING_WINDOWS_H
//
// Tracing Definitions: {1AA98926-2E40-43D1-9D83-34C6BE816365}
//
#define WPP_CONTROL_GUIDS \
WPP_DEFINE_CONTROL_GUID( \
OpenThreadGUID, (1AA98926,2E40,43D1,9D83,34C6BE816365), \
WPP_DEFINE_BIT(DRIVER_DEFAULT) /* 0x00000001 */ \
WPP_DEFINE_BIT(DRIVER_IOCTL) /* 0x00000002 */ \
WPP_DEFINE_BIT(DRIVER_OID) /* 0x00000004 */ \
WPP_DEFINE_BIT(DRIVER_DATA_PATH) /* 0x00000008 */ \
WPP_DEFINE_BIT(OT_API) /* 0x00000010 */ \
WPP_DEFINE_BIT(OT_MLE) /* 0x00000020 */ \
WPP_DEFINE_BIT(OT_ARP) /* 0x00000040 */ \
WPP_DEFINE_BIT(OT_NETD) /* 0x00000080 */ \
WPP_DEFINE_BIT(OT_ICMP) /* 0x00000100 */ \
WPP_DEFINE_BIT(OT_IPV6) /* 0x00000200 */ \
WPP_DEFINE_BIT(OT_MAC) /* 0x00000400 */ \
WPP_DEFINE_BIT(OT_MEM) /* 0x00000800 */ \
WPP_DEFINE_BIT(OT_NCP) /* 0x00001000 */ \
WPP_DEFINE_BIT(OT_COAP) /* 0x00002000 */ \
WPP_DEFINE_BIT(OT_DEFAULT) /* 0x00004000 */ \
)
#define WPP_LEVEL_FLAGS_LOGGER(lvl,flag) \
WPP_FLAG_LOGGER(flag)
#define WPP_LEVEL_FLAGS_ENABLED(lvl, flag) \
(WPP_FLAG_ENABLED(flag) && WPP_CONTROL(WPP_BIT_ ## flag).Level >= lvl)
// Suppress warnings about constants in logical expressions because the
// level is often a constant
#define WPP_LEVEL_FLAGS_PRE(LEVEL,FLAGS) __pragma(warning(suppress:25039 25040 25078 25080))
// Map no-argument macros (dummy) back to regular macros
#define WPP_LEVEL_FLAGS__PRE(lvl, flags, dummy) WPP_LEVEL_FLAGS_PRE(lvl, flags)
#define WPP_LEVEL_FLAGS__POST(lvl, flags, dummy) WPP_LEVEL_FLAGS_POST(lvl, flags)
#define WPP_LEVEL_FLAGS_EXP_ENABLED(LEVEL,FLAGS,EXP) \
WPP_LEVEL_FLAGS_ENABLED (LEVEL,FLAGS)
#define WPP_LEVEL_FLAGS_EXP_LOGGER(LEVEL,FLAGS,EXP) \
WPP_LEVEL_FLAGS_LOGGER (LEVEL,FLAGS)
#define WPP_LOGIPV6(x) WPP_LOGPAIR(16, (x))
// begin_wpp config
// DEFINE_CPLX_TYPE(IPV6ADDR, WPP_LOGIPV6, IN6_ADDR *, ItemIPV6Addr, "s", _IPV6_, 0);
// end_wpp
// begin_wpp config
// USEPREFIX (TraceEvents, "%!STDPREFIX!%!SPACE!");
// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX(LogFuncEntry, "%!STDPREFIX! ---> %!FUNC!");
// FUNC LogFuncEntry{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS);
// end_wpp
// begin_wpp config
// USEPREFIX(LogFuncEntryMsg, "%!STDPREFIX! ---> %!FUNC!%!SPACE!");
// FUNC LogFuncEntryMsg{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX(LogFuncExit, "%!STDPREFIX! <--- %!FUNC!");
// FUNC LogFuncExit{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS);
// end_wpp
// begin_wpp config
// USEPREFIX(LogFuncExitMsg, "%!STDPREFIX! <--- %!FUNC!%!SPACE!");
// FUNC LogFuncExitMsg{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX(LogFuncExitNT, "%!STDPREFIX! <--- %!FUNC!");
// FUNC LogFuncExitNT{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, EXP);
// USESUFFIX(LogFuncExitNT, " %!STATUS!", EXP);
// end_wpp
// begin_wpp config
// USEPREFIX(LogFuncExitNDIS, "%!STDPREFIX! <--- %!FUNC!");
// FUNC LogFuncExitNDIS{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, EXP);
// USESUFFIX(LogFuncExitNDIS, " %!NDIS_STATUS!", EXP);
// end_wpp
// begin_wpp config
// USEPREFIX(LogFuncExitWIN, "%!STDPREFIX! <--- %!FUNC!");
// FUNC LogFuncExitWIN{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, EXP);
// USESUFFIX(LogFuncExitWIN, " %!WINERROR!", EXP);
// end_wpp
// begin_wpp config
// USEPREFIX (LogError, "%!STDPREFIX!%!SPACE!");
// LogError{LEVEL=TRACE_LEVEL_ERROR}(FLAGS, MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (LogWarning, "%!STDPREFIX!%!SPACE!");
// LogWarning{LEVEL=TRACE_LEVEL_WARNING}(FLAGS, MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (LogInfo, "%!STDPREFIX!%!SPACE!");
// LogInfo{LEVEL=TRACE_LEVEL_INFORMATION}(FLAGS, MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (LogVerbose, "%!STDPREFIX!%!SPACE!");
// LogVerbose{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS, MSG, ...);
// end_wpp
//
// Custom types
//
// begin_wpp config
// CUSTOM_TYPE(otError, ItemEnum(ThreadError));
// CUSTOM_TYPE(otDeviceRole, ItemEnum(otDeviceRole));
// end_wpp
//
// otCore Definitions
//
// ==API==
// begin_wpp config
// USEPREFIX (otLogCritApi, "%!STDPREFIX!%!SPACE!API%!SPACE!");
// otLogCritApi{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_API}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogWarnApi, "%!STDPREFIX!%!SPACE!API%!SPACE!");
// otLogWarnApi{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_API}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogInfoApi, "%!STDPREFIX!%!SPACE!API%!SPACE!");
// otLogInfoApi{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_API}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogDebgApi, "%!STDPREFIX!%!SPACE!API%!SPACE!");
// otLogDebgApi{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_API}(MSG, ...);
// end_wpp
// ==NCP==
// begin_wpp config
// USEPREFIX (otLogCritNcp, "%!STDPREFIX!%!SPACE!NCP%!SPACE!");
// otLogCritNcp{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_NCP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogWarnNcp, "%!STDPREFIX!%!SPACE!NCP%!SPACE!");
// otLogWarnNcp{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_NCP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogInfoNcp, "%!STDPREFIX!%!SPACE!NCP%!SPACE!");
// otLogInfoNcp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NCP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogDebgNcp, "%!STDPREFIX!%!SPACE!NCP%!SPACE!");
// otLogDebgNcp{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_NCP}(MSG, ...);
// end_wpp
// ==COAP==
// begin_wpp config
// USEPREFIX (otLogCritMeshCoP, "%!STDPREFIX!%!SPACE!COAP%!SPACE!");
// otLogCritMeshCoP{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_COAP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogWarnMeshCoP, "%!STDPREFIX!%!SPACE!COAP%!SPACE!");
// otLogWarnMeshCoP{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_COAP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogInfoMeshCoP, "%!STDPREFIX!%!SPACE!COAP%!SPACE!");
// otLogInfoMeshCoP{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_COAP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogDebgMeshCoP, "%!STDPREFIX!%!SPACE!COAP%!SPACE!");
// otLogDebgMeshCoP{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_COAP}(MSG, ...);
// end_wpp
// ==MLE==
// begin_wpp config
// USEPREFIX (otLogCritMle, "%!STDPREFIX!%!SPACE!MLE%!SPACE!");
// otLogCritMle{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MLE}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogWarnMle, "%!STDPREFIX!%!SPACE!MLE%!SPACE!");
// otLogWarnMle{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MLE}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogInfoMle, "%!STDPREFIX!%!SPACE!MLE%!SPACE!");
// otLogInfoMle{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MLE}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogDebgMle, "%!STDPREFIX!%!SPACE!MLE%!SPACE!");
// otLogDebgMle{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MLE}(MSG, ...);
// end_wpp
// ==ARP==
// begin_wpp config
// USEPREFIX (otLogCritArp, "%!STDPREFIX!%!SPACE!ARP%!SPACE!");
// otLogCritArp{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_ARP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogWarnArp, "%!STDPREFIX!%!SPACE!ARP%!SPACE!");
// otLogWarnArp{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_ARP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogInfoArp, "%!STDPREFIX!%!SPACE!ARP%!SPACE!");
// otLogInfoArp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_ARP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogDebgArp, "%!STDPREFIX!%!SPACE!ARP%!SPACE!");
// otLogDebgArp{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_ARP}(MSG, ...);
// end_wpp
// ==NETD==
// begin_wpp config
// USEPREFIX (otLogCritNetData, "%!STDPREFIX!%!SPACE!NETD%!SPACE!");
// otLogCritNetData{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_NETD}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogWarnNetData, "%!STDPREFIX!%!SPACE!NETD%!SPACE!");
// otLogWarnNetData{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_NETD}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogInfoNetData, "%!STDPREFIX!%!SPACE!NETD%!SPACE!");
// otLogInfoNetData{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_NETD}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogDebgNetData, "%!STDPREFIX!%!SPACE!NETD%!SPACE!");
// otLogDebgNetData{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_NETD}(MSG, ...);
// end_wpp
// ==ICMP==
// begin_wpp config
// USEPREFIX (otLogCritIcmp, "%!STDPREFIX!%!SPACE!ICMP%!SPACE!");
// otLogCritIcmp{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_ICMP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogWarnIcmp, "%!STDPREFIX!%!SPACE!ICMP%!SPACE!");
// otLogWarnIcmp{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_ICMP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogInfoIcmp, "%!STDPREFIX!%!SPACE!ICMP%!SPACE!");
// otLogInfoIcmp{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_ICMP}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogDebgIcmp, "%!STDPREFIX!%!SPACE!ICMP%!SPACE!");
// otLogDebgIcmp{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_ICMP}(MSG, ...);
// end_wpp
// ==IPV6==
// begin_wpp config
// USEPREFIX (otLogCritIp6, "%!STDPREFIX!%!SPACE!IPV6%!SPACE!");
// otLogCritIp6{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_IPV6}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogWarnIp6, "%!STDPREFIX!%!SPACE!IPV6%!SPACE!");
// otLogWarnIp6{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_IPV6}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogInfoIp6, "%!STDPREFIX!%!SPACE!IPV6%!SPACE!");
// otLogInfoIp6{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_IPV6}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogDebgIp6, "%!STDPREFIX!%!SPACE!IPV6%!SPACE!");
// otLogDebgIp6{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_IPV6}(MSG, ...);
// end_wpp
// ==MAC==
// begin_wpp config
// USEPREFIX (otLogCritMac, "%!STDPREFIX!%!SPACE!MAC%!SPACE!");
// otLogCritMac{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MAC}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogWarnMac, "%!STDPREFIX!%!SPACE!MAC%!SPACE!");
// otLogWarnMac{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MAC}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogInfoMac, "%!STDPREFIX!%!SPACE!MAC%!SPACE!");
// otLogInfoMac{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MAC}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogDebgMac, "%!STDPREFIX!%!SPACE!MAC%!SPACE!");
// otLogDebgMac{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MAC}(MSG, ...);
// end_wpp
// ==MEM==
// begin_wpp config
// USEPREFIX (otLogCritMem, "%!STDPREFIX!%!SPACE!MEM%!SPACE!");
// otLogCritMem{LEVEL=TRACE_LEVEL_ERROR,FLAGS=OT_MEM}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogWarnMem, "%!STDPREFIX!%!SPACE!MEM%!SPACE!");
// otLogWarnMem{LEVEL=TRACE_LEVEL_WARNING,FLAGS=OT_MEM}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogInfoMem, "%!STDPREFIX!%!SPACE!MEM%!SPACE!");
// otLogInfoMem{LEVEL=TRACE_LEVEL_INFORMATION,FLAGS=OT_MEM}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX (otLogDebgMem, "%!STDPREFIX!%!SPACE!MEM%!SPACE!");
// otLogDebgMem{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_MEM}(MSG, ...);
// end_wpp
// ==FUNC==
// begin_wpp config
// USEPREFIX(otLogFuncEntry, "%!STDPREFIX! ---> %!FUNC!");
// FUNC otLogFuncEntry{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_DEFAULT}(...);
// end_wpp
// begin_wpp config
// USEPREFIX(otLogFuncEntryMsg, "%!STDPREFIX! ---> %!FUNC!%!SPACE!");
// FUNC otLogFuncEntryMsg{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_DEFAULT}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX(otLogFuncExit, "%!STDPREFIX! <--- %!FUNC!");
// FUNC otLogFuncExit{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_DEFAULT}(...);
// end_wpp
// begin_wpp config
// USEPREFIX(otLogFuncExitMsg, "%!STDPREFIX! <--- %!FUNC!%!SPACE!");
// FUNC otLogFuncExitMsg{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_DEFAULT}(MSG, ...);
// end_wpp
// begin_wpp config
// USEPREFIX(otLogFuncExitErr, "%!STDPREFIX! <--- %!FUNC!");
// FUNC otLogFuncExitErr{LEVEL=TRACE_LEVEL_VERBOSE,FLAGS=OT_DEFAULT}(EXP);
// USESUFFIX(otLogFuncExitErr, " %!otError!", EXP);
// end_wpp
#endif // _LOGGING_WINDOWS_H
+22
View File
@@ -41,10 +41,28 @@
#include <openthread-core-config.h>
#include <platform/logging.h>
#ifdef WINDOWS_LOGGING
#ifdef WINDOWS_KERNEL
#include <wdm.h>
#endif
#include <platform/logging-windows.h>
#ifdef WPP_NAME
#include WPP_NAME
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WINDOWS_LOGGING
#define otLogFuncEntry()
#define otLogFuncEntryMsg(aFormat, ...)
#define otLogFuncExit()
#define otLogFuncExitMsg(aFormat, ...)
#define otLogFuncExitErr(error)
#endif
/**
* @def otLogCrit
*
@@ -109,6 +127,8 @@ extern "C" {
#define otLogDebg(aRegion, aFormat, ...)
#endif
#ifndef WINDOWS_LOGGING
/**
* @def otLogCritApi
*
@@ -568,6 +588,8 @@ extern "C" {
#define otLogDebgMem(aFormat, ...)
#endif
#endif // WINDOWS_LOGGING
/**
* @def otDumpCrit
*
+7 -1
View File
@@ -31,6 +31,8 @@
* This file implements the message buffer pool and message buffers.
*/
#define WPP_NAME "message.tmh"
#include <common/code_utils.hpp>
#include <common/debug.hpp>
#include <common/message.hpp>
@@ -85,7 +87,11 @@ Buffer *MessagePool::NewBuffer(void)
{
Buffer *buffer = NULL;
VerifyOrExit(mFreeBuffers != NULL, otLogInfoMac("No available message buffer\n"));
if (mFreeBuffers == NULL)
{
otLogInfoMac("No available message buffer\n");
ExitNow();
}
buffer = mFreeBuffers;
mFreeBuffers = mFreeBuffers->GetNextBuffer();
+7 -2
View File
@@ -31,6 +31,8 @@
* This file implements the subset of IEEE 802.15.4 primitives required for Thread.
*/
#define WPP_NAME "mac.tmh"
#ifdef OPENTHREAD_CONFIG_FILE
#include OPENTHREAD_CONFIG_FILE
#else
@@ -1075,8 +1077,11 @@ void Mac::ReceiveDoneTask(Frame *aFrame, ThreadError aError)
}
// Duplicate Address Protection
VerifyOrExit(memcmp(&srcaddr.mExtAddress, &mExtAddress, sizeof(srcaddr.mExtAddress)) != 0,
error = kThreadError_InvalidSourceAddress; otLogDebgMac("duplicate address received\n"));
if (memcmp(&srcaddr.mExtAddress, &mExtAddress, sizeof(srcaddr.mExtAddress)) == 0)
{
otLogDebgMac("duplicate address received\n");
ExitNow(error = kThreadError_InvalidSourceAddress);
}
// Source Whitelist Processing
if (srcaddr.mLength != 0 && mWhitelist.IsEnabled())
+2
View File
@@ -31,6 +31,8 @@
* This file implements a Commissioner role.
*/
#define WPP_NAME "commissioner.tmh"
#ifdef OPENTHREAD_CONFIG_FILE
#include OPENTHREAD_CONFIG_FILE
#else
+2
View File
@@ -31,6 +31,8 @@
* This file implements the necessary hooks for mbedTLS.
*/
#define WPP_NAME "dtls.tmh"
#include <assert.h>
#include <stdio.h>
+2
View File
@@ -31,6 +31,8 @@
* This file implements the Energy Scan Client.
*/
#define WPP_NAME "energy_scan_client.tmh"
#include <coap/coap_header.hpp>
#include <common/code_utils.hpp>
#include <common/debug.hpp>
+2
View File
@@ -31,6 +31,8 @@
* This file implements the Joiner role.
*/
#define WPP_NAME "joiner.tmh"
#ifdef OPENTHREAD_CONFIG_FILE
#include OPENTHREAD_CONFIG_FILE
#else
+2
View File
@@ -31,6 +31,8 @@
* This file implements the Joiner Router role.
*/
#define WPP_NAME "joiner_router.tmh"
#ifdef OPENTHREAD_CONFIG_FILE
#include OPENTHREAD_CONFIG_FILE
#else
+2
View File
@@ -31,6 +31,8 @@
* This file implements a MeshCoP Leader.
*/
#define WPP_NAME "leader.tmh"
#include <stdio.h>
#include <coap/coap_header.hpp>
+2
View File
@@ -31,6 +31,8 @@
* This file implements the PAN ID Query Client.
*/
#define WPP_NAME "panid_query_client.tmh"
#include <coap/coap_header.hpp>
#include <common/code_utils.hpp>
#include <common/debug.hpp>
+8 -1
View File
@@ -31,6 +31,8 @@
* This file implements ICMPv6.
*/
#define WPP_NAME "icmp6.tmh"
#include <string.h>
#include <common/code_utils.hpp>
@@ -206,7 +208,12 @@ ThreadError Icmp::HandleEchoRequest(Message &aRequestMessage, const MessageInfo
icmp6Header.Init();
icmp6Header.SetType(IcmpHeader::kTypeEchoReply);
VerifyOrExit((replyMessage = mIp6.NewMessage(0)) != NULL, otLogDebgIcmp("icmp fail\n"));
if ((replyMessage = mIp6.NewMessage(0)) == NULL)
{
otLogDebgIcmp("icmp fail\n");
ExitNow();
}
payloadLength = aRequestMessage.GetLength() - aRequestMessage.GetOffset() - IcmpHeader::GetDataOffset();
SuccessOrExit(replyMessage->SetLength(IcmpHeader::GetDataOffset() + payloadLength));
+2
View File
@@ -31,6 +31,8 @@
* This file implements the top-level interface to the OpenThread stack.
*/
#define WPP_NAME "openthread.tmh"
#ifdef OPENTHREAD_CONFIG_FILE
#include OPENTHREAD_CONFIG_FILE
#else
+2
View File
@@ -31,6 +31,8 @@
* This file implements Thread's EID-to-RLOC mapping and caching.
*/
#define WPP_NAME "address_resolver.tmh"
#include <coap/coap_header.hpp>
#include <common/code_utils.hpp>
#include <common/debug.hpp>
+2
View File
@@ -31,6 +31,8 @@
* This file implements the Energy Scan Server.
*/
#define WPP_NAME "energy_scan_server.tmh"
#include <coap/coap_header.hpp>
#include <common/code_utils.hpp>
#include <common/debug.hpp>
+2
View File
@@ -31,6 +31,8 @@
* This file implements mesh forwarding of IPv6/6LoWPAN messages.
*/
#define WPP_NAME "mesh_forwarder.tmh"
#include <common/code_utils.hpp>
#include <common/debug.hpp>
#include <common/logging.hpp>
+3 -1
View File
@@ -32,11 +32,13 @@
*
*/
#include <assert.h>
#define WPP_NAME "meshcop_dataset_manager.tmh"
#include <stdio.h>
#include <openthread-types.h>
#include <coap/coap_header.hpp>
#include <common/debug.hpp>
#include <common/code_utils.hpp>
#include <common/logging.hpp>
#include <common/timer.hpp>
+25 -11
View File
@@ -31,6 +31,8 @@
* This file implements MLE functionality required for the Thread Child, Router and Leader roles.
*/
#define WPP_NAME "mle.tmh"
#include <thread/mle.hpp>
#include <common/code_utils.hpp>
#include <common/debug.hpp>
@@ -1518,11 +1520,20 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn
{
if (keySequence == neighbor->mKeySequence)
{
VerifyOrExit(frameCounter >= neighbor->mValid.mMleFrameCounter, otLogDebgMle("mle frame reject 1\n"));
if (frameCounter < neighbor->mValid.mMleFrameCounter)
{
otLogDebgMle("mle frame reject 1\n");
ExitNow();
}
}
else
{
VerifyOrExit(keySequence > neighbor->mKeySequence, otLogDebgMle("mle frame reject 2\n"));
if (keySequence <= neighbor->mKeySequence)
{
otLogDebgMle("mle frame reject 2\n");
ExitNow();
}
neighbor->mKeySequence = keySequence;
neighbor->mValid.mLinkFrameCounter = 0;
}
@@ -1531,15 +1542,18 @@ void Mle::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageIn
}
else
{
VerifyOrExit(command == Header::kCommandLinkRequest ||
command == Header::kCommandLinkAccept ||
command == Header::kCommandLinkAcceptAndRequest ||
command == Header::kCommandAdvertisement ||
command == Header::kCommandParentRequest ||
command == Header::kCommandParentResponse ||
command == Header::kCommandChildIdRequest ||
command == Header::kCommandChildUpdateRequest,
otLogDebgMle("mle sequence unknown! %d\n", command));
if (!(command == Header::kCommandLinkRequest ||
command == Header::kCommandLinkAccept ||
command == Header::kCommandLinkAcceptAndRequest ||
command == Header::kCommandAdvertisement ||
command == Header::kCommandParentRequest ||
command == Header::kCommandParentResponse ||
command == Header::kCommandChildIdRequest ||
command == Header::kCommandChildUpdateRequest))
{
otLogDebgMle("mle sequence unknown! %d\n", command);
ExitNow();
}
}
switch (command)
+2
View File
@@ -31,6 +31,8 @@
* This file implements MLE functionality required for the Thread Router and Leader roles.
*/
#define WPP_NAME "mle_router.tmh"
#include <common/code_utils.hpp>
#include <common/debug.hpp>
#include <common/logging.hpp>
+2
View File
@@ -31,6 +31,8 @@
* This file implements common methods for manipulating Thread Network Data.
*/
#define WPP_NAME "network_data.tmh"
#include <coap/coap_header.hpp>
#include <common/code_utils.hpp>
#include <common/debug.hpp>
+2
View File
@@ -31,6 +31,8 @@
* This file implements the Thread Network Data managed by the Thread Leader.
*/
#define WPP_NAME "network_data_leader.tmh"
#include <coap/coap_header.hpp>
#include <common/debug.hpp>
#include <common/logging.hpp>
+2
View File
@@ -31,6 +31,8 @@
* This file implements the PAN ID Query Server.
*/
#define WPP_NAME "panid_query_server.tmh"
#include <coap/coap_header.hpp>
#include <common/code_utils.hpp>
#include <common/debug.hpp>