From 9a2beff1e9363a2fb97fc339a8166ae3ea6bf0c1 Mon Sep 17 00:00:00 2001 From: Nick Banks Date: Mon, 19 Sep 2016 12:00:30 -0700 Subject: [PATCH] Windows Core Build Support (#582) * Support #define to overwrite what openthread-config file to use, since Windows does support autoconf. --- .appveyor.yml | 13 + .gitignore | 5 + etc/visual-studio/libopenthread.vcxproj | 267 ++++++++++++ .../libopenthread.vcxproj.filters | 387 ++++++++++++++++++ etc/visual-studio/libopenthread_k.vcxproj | 229 +++++++++++ .../libopenthread_k.vcxproj.filters | 387 ++++++++++++++++++ etc/visual-studio/mbedtls.vcxproj | 178 ++++++++ etc/visual-studio/mbedtls.vcxproj.filters | 89 ++++ etc/visual-studio/mbedtls_k.vcxproj | 145 +++++++ etc/visual-studio/mbedtls_k.vcxproj.filters | 89 ++++ etc/visual-studio/openthread.sln | 79 ++++ include/openthread-types.h | 7 +- include/openthread-windows-config.h | 78 ++++ src/core/coap/coap_server.cpp | 2 +- src/core/common/debug.hpp | 9 + src/core/common/logging.cpp | 6 + src/core/common/message.hpp | 6 + src/core/mac/mac.cpp | 14 +- src/core/meshcop/commissioner.cpp | 4 +- src/core/meshcop/dtls.cpp | 6 +- src/core/meshcop/energy_scan_client.cpp | 4 +- src/core/meshcop/joiner.cpp | 6 +- src/core/meshcop/joiner_router.cpp | 4 +- src/core/meshcop/panid_query_client.cpp | 4 +- src/core/net/ip6_address.cpp | 6 + src/core/net/ip6_mpl.cpp | 2 +- src/core/net/ip6_mpl.hpp | 2 +- src/core/net/netif.cpp | 2 +- src/core/openthread.cpp | 10 +- src/core/thread/address_resolver.cpp | 10 +- src/core/thread/energy_scan_server.cpp | 8 +- src/core/thread/link_quality.cpp | 6 + src/core/thread/mesh_forwarder.cpp | 10 +- src/core/thread/meshcop_dataset_manager.cpp | 12 +- src/core/thread/meshcop_tlvs.hpp | 7 +- src/core/thread/mle.cpp | 8 +- src/core/thread/mle_router.cpp | 12 +- src/core/thread/mle_tlvs.hpp | 2 +- src/core/thread/network_data.cpp | 2 +- src/core/thread/network_data_leader.cpp | 4 +- src/core/thread/panid_query_server.cpp | 6 +- src/core/thread/topology.hpp | 3 + tests/unit/test_toolchain.cpp | 11 + third_party/mbedtls/mbedtls-config.h | 9 +- 44 files changed, 2079 insertions(+), 71 deletions(-) create mode 100644 .appveyor.yml create mode 100644 etc/visual-studio/libopenthread.vcxproj create mode 100644 etc/visual-studio/libopenthread.vcxproj.filters create mode 100644 etc/visual-studio/libopenthread_k.vcxproj create mode 100644 etc/visual-studio/libopenthread_k.vcxproj.filters create mode 100644 etc/visual-studio/mbedtls.vcxproj create mode 100644 etc/visual-studio/mbedtls.vcxproj.filters create mode 100644 etc/visual-studio/mbedtls_k.vcxproj create mode 100644 etc/visual-studio/mbedtls_k.vcxproj.filters create mode 100644 etc/visual-studio/openthread.sln create mode 100644 include/openthread-windows-config.h diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..4aed91183 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,13 @@ +version: 0.1.{build} +image: Visual Studio 2015 +configuration: +- Release +- Debug +platform: +- x64 +- x86 +clone_depth: 10 +build: + project: etc/visual-studio/openthread.sln + verbosity: minimal +test: off \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4764e9f09..36ea568b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,15 @@ *.a +*.db *.gcda *.gcno *.log *.o +*.opendb *.orig *.pyc +*.suo *.trs +*.user *~ .deps .dirstamp @@ -22,6 +26,7 @@ doc/html include/openthread-config.h include/openthread-config.h.in include/stamp-h1 +ipch libtool Makefile Makefile.in diff --git a/etc/visual-studio/libopenthread.vcxproj b/etc/visual-studio/libopenthread.vcxproj new file mode 100644 index 000000000..891b3262a --- /dev/null +++ b/etc/visual-studio/libopenthread.vcxproj @@ -0,0 +1,267 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40} + Win32Proj + libopenthread + 8.1 + + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + + + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + + + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + + + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";%(PreprocessorDefinitions) + true + ..\..\include;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories) + ProgramDatabase + true + + + Windows + + + + + Level3 + Disabled + _DEBUG;_LIB;MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";%(PreprocessorDefinitions) + true + ..\..\include;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories) + ProgramDatabase + true + + + Windows + + + + + Level3 + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";%(PreprocessorDefinitions) + true + ..\..\include;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories) + true + + + Windows + true + true + + + + + Level3 + MaxSpeed + true + true + NDEBUG;_LIB;MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";%(PreprocessorDefinitions) + true + ..\..\include;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories) + true + + + Windows + true + true + + + + + + \ No newline at end of file diff --git a/etc/visual-studio/libopenthread.vcxproj.filters b/etc/visual-studio/libopenthread.vcxproj.filters new file mode 100644 index 000000000..d9fe8ef6d --- /dev/null +++ b/etc/visual-studio/libopenthread.vcxproj.filters @@ -0,0 +1,387 @@ + + + + + {c09c2d1c-85fb-4081-8235-925b45ed3c4b} + + + {9a61353a-8613-4496-9ee8-c3d2800c5ac6} + + + {a49a9cc3-6a37-48a6-8049-b10c9cecd193} + + + {444ab8c6-6b83-4a5b-9059-67f469da1331} + + + {a59636b8-d046-46b7-992b-76572ca72bd1} + + + {7c989f53-480b-42d4-a2dc-454adafda818} + + + {c14a7a3f-089f-47ee-80db-1caf1b47ab6b} + + + {b4905c15-9702-4ff0-8d57-e7926337d50f} + + + {c2f72132-0df1-4dba-b24f-0ab683874538} + + + {92f20ce7-8f87-4a1c-bc0b-d7fa3dfd3b60} + + + {c618ddc9-5c66-485f-a0ff-ebabb3508568} + + + {90294598-e94b-4c07-a531-93335a8955d9} + + + {0c76d116-0b4d-4fec-a0d8-5ca127913124} + + + {702145f9-0e66-4e45-b3d4-d43f2cf17e10} + + + {0e7f4f58-a115-4ce8-8e3b-1094fb79af52} + + + {635aaabf-80f0-40e2-9218-22ff75bc0e32} + + + + + Source Files\coap + + + Source Files\coap + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\crypto + + + Source Files\mac + + + Source Files\mac + + + Source Files\mac + + + Source Files\net + + + Source Files\net + + + Source Files\net + + + Source Files\net + + + Source Files\net + + + Source Files\net + + + Source Files\net + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\net + + + Source Files + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\mac + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\crypto + + + Source Files\crypto + + + Source Files\crypto + + + Source Files\crypto + + + + + Header Files + + + Header Files + + + Header Files\coap + + + Header Files\coap + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\crypto + + + Header Files\mac + + + Header Files\mac + + + Header Files\mac + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\mac + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\crypto + + + Header Files\crypto + + + Header Files\crypto + + + Header Files\crypto + + + \ No newline at end of file diff --git a/etc/visual-studio/libopenthread_k.vcxproj b/etc/visual-studio/libopenthread_k.vcxproj new file mode 100644 index 000000000..9a0d20a32 --- /dev/null +++ b/etc/visual-studio/libopenthread_k.vcxproj @@ -0,0 +1,229 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {9B33C190-5D07-40BF-9536-68843DC5D7AF} + {0a049372-4c4d-4ea0-a64e-dc6ad88ceca1} + v4.5 + 12.0 + Debug + Win32 + libopenthread_k + KMDF + $(LatestTargetPlatformVersion) + + + + Windows10 + true + WindowsKernelModeDriver10.0 + StaticLibrary + + + Windows10 + false + WindowsKernelModeDriver10.0 + StaticLibrary + + + Windows10 + true + WindowsKernelModeDriver10.0 + StaticLibrary + + + Windows10 + false + WindowsKernelModeDriver10.0 + StaticLibrary + + + + + + + + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + + WIN32;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;OPENTHREAD_MULTIPLE_INSTANCE + ..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories) + 4100;4706;4748;%(DisableSpecificWarnings) + true + + + + + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;OPENTHREAD_MULTIPLE_INSTANCE + ..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories) + 4100;4706;4748;%(DisableSpecificWarnings) + true + + + + + WIN32;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;OPENTHREAD_MULTIPLE_INSTANCE + ..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories) + 4100;4603;4627;4706;4986;4987;4996;%(DisableSpecificWarnings) + true + + + + + _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);MBEDTLS_CONFIG_FILE="mbedtls-config.h";OPENTHREAD_CONFIG_FILE="openthread-windows-config.h";WINDOWS_KERNEL;OPENTHREAD_MULTIPLE_INSTANCE + ..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;%(AdditionalIncludeDirectories) + 4100;4603;4627;4706;4986;4987;4996;%(DisableSpecificWarnings) + true + + + + + + \ No newline at end of file diff --git a/etc/visual-studio/libopenthread_k.vcxproj.filters b/etc/visual-studio/libopenthread_k.vcxproj.filters new file mode 100644 index 000000000..71231c5a0 --- /dev/null +++ b/etc/visual-studio/libopenthread_k.vcxproj.filters @@ -0,0 +1,387 @@ + + + + + {c09c2d1c-85fb-4081-8235-925b45ed3c4b} + + + {9a61353a-8613-4496-9ee8-c3d2800c5ac6} + + + {a49a9cc3-6a37-48a6-8049-b10c9cecd193} + + + {444ab8c6-6b83-4a5b-9059-67f469da1331} + + + {a59636b8-d046-46b7-992b-76572ca72bd1} + + + {7c989f53-480b-42d4-a2dc-454adafda818} + + + {c14a7a3f-089f-47ee-80db-1caf1b47ab6b} + + + {b4905c15-9702-4ff0-8d57-e7926337d50f} + + + {c2f72132-0df1-4dba-b24f-0ab683874538} + + + {92f20ce7-8f87-4a1c-bc0b-d7fa3dfd3b60} + + + {c618ddc9-5c66-485f-a0ff-ebabb3508568} + + + {90294598-e94b-4c07-a531-93335a8955d9} + + + {0c76d116-0b4d-4fec-a0d8-5ca127913124} + + + {702145f9-0e66-4e45-b3d4-d43f2cf17e10} + + + {50a39acc-fab6-4e2a-85b7-d764be5299f5} + + + {8f54e8b3-d8fb-4fed-88ce-42b39f171d0b} + + + + + Source Files\coap + + + Source Files\coap + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\crypto + + + Source Files\mac + + + Source Files\mac + + + Source Files\mac + + + Source Files\net + + + Source Files\net + + + Source Files\net + + + Source Files\net + + + Source Files\net + + + Source Files\net + + + Source Files\net + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\net + + + Source Files + + + Source Files\thread + + + Source Files\thread + + + Source Files\thread + + + Source Files\mac + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\meshcop + + + Source Files\crypto + + + Source Files\crypto + + + Source Files\crypto + + + Source Files\crypto + + + + + Header Files + + + Header Files + + + Header Files\coap + + + Header Files\coap + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\crypto + + + Header Files\mac + + + Header Files\mac + + + Header Files\mac + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\net + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\thread + + + Header Files\mac + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\meshcop + + + Header Files\crypto + + + Header Files\crypto + + + Header Files\crypto + + + Header Files\crypto + + + \ No newline at end of file diff --git a/etc/visual-studio/mbedtls.vcxproj b/etc/visual-studio/mbedtls.vcxproj new file mode 100644 index 000000000..288b58378 --- /dev/null +++ b/etc/visual-studio/mbedtls.vcxproj @@ -0,0 +1,178 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {4111C8BB-D354-4348-AD3C-EB6832E84831} + Win32Proj + mbedtls + 8.1 + mbedtls + + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;MBEDTLS_CONFIG_FILE="mbedtls-config.h";%(PreprocessorDefinitions) + true + ..\..\include;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;..\..\third_party\mbedtls\repo\include\mbedtls + true + + + Windows + + + + + Level3 + Disabled + _DEBUG;_LIB;MBEDTLS_CONFIG_FILE="mbedtls-config.h";%(PreprocessorDefinitions) + true + ..\..\include;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;..\..\third_party\mbedtls\repo\include\mbedtls + true + + + Windows + + + + + Level3 + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;MBEDTLS_CONFIG_FILE="mbedtls-config.h";%(PreprocessorDefinitions) + true + ..\..\include;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;..\..\third_party\mbedtls\repo\include\mbedtls + true + + + Windows + true + true + + + + + Level3 + MaxSpeed + true + true + NDEBUG;_LIB;MBEDTLS_CONFIG_FILE="mbedtls-config.h";%(PreprocessorDefinitions) + true + ..\..\include;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;..\..\third_party\mbedtls\repo\include\mbedtls + true + + + Windows + true + true + + + + + + \ No newline at end of file diff --git a/etc/visual-studio/mbedtls.vcxproj.filters b/etc/visual-studio/mbedtls.vcxproj.filters new file mode 100644 index 000000000..6c78ed5ad --- /dev/null +++ b/etc/visual-studio/mbedtls.vcxproj.filters @@ -0,0 +1,89 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {0a2ce77e-dccf-408c-aea0-7a781284a936} + + + {859819dc-e84e-4854-ad32-2819d60da38b} + + + + + Source Files + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + \ No newline at end of file diff --git a/etc/visual-studio/mbedtls_k.vcxproj b/etc/visual-studio/mbedtls_k.vcxproj new file mode 100644 index 000000000..1a9934901 --- /dev/null +++ b/etc/visual-studio/mbedtls_k.vcxproj @@ -0,0 +1,145 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {69BE8E8C-CF1E-46D6-932B-DB435F47059B} + {0a049372-4c4d-4ea0-a64e-dc6ad88ceca1} + v4.5 + 12.0 + Debug + Win32 + mbedtls_k + KMDF + $(LatestTargetPlatformVersion) + + + + Windows10 + true + WindowsKernelModeDriver10.0 + StaticLibrary + + + Windows10 + false + WindowsKernelModeDriver10.0 + StaticLibrary + + + Windows10 + true + WindowsKernelModeDriver10.0 + StaticLibrary + + + Windows10 + false + WindowsKernelModeDriver10.0 + StaticLibrary + + + + + + + + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + ..\..\build\bin\$(Platform)\$(Configuration)\lib\ + ..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + + ..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;..\..\third_party\mbedtls\repo\include\mbedtls + WIN32;MBEDTLS_CONFIG_FILE="mbedtls-config.h";WINDOWS_KERNEL;%(PreprocessorDefinitions) + 4132;4242;4245;4748;%(DisableSpecificWarnings) + Level4 + true + + + + + ..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;..\..\third_party\mbedtls\repo\include\mbedtls + _WIN64;_AMD64_;AMD64;MBEDTLS_CONFIG_FILE="mbedtls-config.h";WINDOWS_KERNEL;%(PreprocessorDefinitions) + 4132;4242;4245;4748;%(DisableSpecificWarnings) + Level4 + true + + + + + ..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;..\..\third_party\mbedtls\repo\include\mbedtls + WIN32;MBEDTLS_CONFIG_FILE="mbedtls-config.h";WINDOWS_KERNEL;%(PreprocessorDefinitions) + 4132;4242;4245;4603;4627;4986;4987;4996;%(DisableSpecificWarnings) + Level4 + true + + + + + ..\..\include;..\..\src\missing\stdint;..\..\src\missing\stdbool;..\..\src\core;..\..\third_party\mbedtls;..\..\third_party\mbedtls\repo\include;..\..\third_party\mbedtls\repo\include\mbedtls + _WIN64;_AMD64_;AMD64;MBEDTLS_CONFIG_FILE="mbedtls-config.h";WINDOWS_KERNEL;%(PreprocessorDefinitions) + 4132;4242;4245;4603;4627;4986;4987;4996;%(DisableSpecificWarnings) + Level4 + true + + + + + + \ No newline at end of file diff --git a/etc/visual-studio/mbedtls_k.vcxproj.filters b/etc/visual-studio/mbedtls_k.vcxproj.filters new file mode 100644 index 000000000..1b8c0d7a1 --- /dev/null +++ b/etc/visual-studio/mbedtls_k.vcxproj.filters @@ -0,0 +1,89 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {0a2ce77e-dccf-408c-aea0-7a781284a936} + + + {87ec68b3-5bec-4c60-b764-c2daf3ffcfb2} + + + + + Source Files + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + Source Files\repo\library + + + \ No newline at end of file diff --git a/etc/visual-studio/openthread.sln b/etc/visual-studio/openthread.sln new file mode 100644 index 000000000..e87e8e186 --- /dev/null +++ b/etc/visual-studio/openthread.sln @@ -0,0 +1,79 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenthread", "libopenthread.vcxproj", "{DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenthread_k", "libopenthread_k.vcxproj", "{9B33C190-5D07-40BF-9536-68843DC5D7AF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbedtls", "mbedtls.vcxproj", "{4111C8BB-D354-4348-AD3C-EB6832E84831}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mbedtls_k", "mbedtls_k.vcxproj", "{69BE8E8C-CF1E-46D6-932B-DB435F47059B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{95BD0669-04C8-4EEB-B3CC-0535B03F4468}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "third_party", "third_party", "{873E9D16-2A08-41FC-B301-79C95B3A8F98}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config files", "config files", "{53F4EEF6-B96D-4887-B9CF-CD21E8BECD15}" + ProjectSection(SolutionItems) = preProject + ..\..\.appveyor.yml = ..\..\.appveyor.yml + ..\..\.codecov.yml = ..\..\.codecov.yml + ..\..\.travis.yml = ..\..\.travis.yml + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40}.Debug|x64.ActiveCfg = Debug|x64 + {DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40}.Debug|x64.Build.0 = Debug|x64 + {DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40}.Debug|x86.ActiveCfg = Debug|Win32 + {DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40}.Debug|x86.Build.0 = Debug|Win32 + {DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40}.Release|x64.ActiveCfg = Release|x64 + {DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40}.Release|x64.Build.0 = Release|x64 + {DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40}.Release|x86.ActiveCfg = Release|Win32 + {DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40}.Release|x86.Build.0 = Release|Win32 + {9B33C190-5D07-40BF-9536-68843DC5D7AF}.Debug|x64.ActiveCfg = Debug|x64 + {9B33C190-5D07-40BF-9536-68843DC5D7AF}.Debug|x64.Build.0 = Debug|x64 + {9B33C190-5D07-40BF-9536-68843DC5D7AF}.Debug|x86.ActiveCfg = Debug|Win32 + {9B33C190-5D07-40BF-9536-68843DC5D7AF}.Debug|x86.Build.0 = Debug|Win32 + {9B33C190-5D07-40BF-9536-68843DC5D7AF}.Debug|x86.Deploy.0 = Debug|Win32 + {9B33C190-5D07-40BF-9536-68843DC5D7AF}.Release|x64.ActiveCfg = Release|x64 + {9B33C190-5D07-40BF-9536-68843DC5D7AF}.Release|x64.Build.0 = Release|x64 + {9B33C190-5D07-40BF-9536-68843DC5D7AF}.Release|x86.ActiveCfg = Release|Win32 + {9B33C190-5D07-40BF-9536-68843DC5D7AF}.Release|x86.Build.0 = Release|Win32 + {9B33C190-5D07-40BF-9536-68843DC5D7AF}.Release|x86.Deploy.0 = Release|Win32 + {4111C8BB-D354-4348-AD3C-EB6832E84831}.Debug|x64.ActiveCfg = Debug|x64 + {4111C8BB-D354-4348-AD3C-EB6832E84831}.Debug|x64.Build.0 = Debug|x64 + {4111C8BB-D354-4348-AD3C-EB6832E84831}.Debug|x86.ActiveCfg = Debug|Win32 + {4111C8BB-D354-4348-AD3C-EB6832E84831}.Debug|x86.Build.0 = Debug|Win32 + {4111C8BB-D354-4348-AD3C-EB6832E84831}.Release|x64.ActiveCfg = Release|x64 + {4111C8BB-D354-4348-AD3C-EB6832E84831}.Release|x64.Build.0 = Release|x64 + {4111C8BB-D354-4348-AD3C-EB6832E84831}.Release|x86.ActiveCfg = Release|Win32 + {4111C8BB-D354-4348-AD3C-EB6832E84831}.Release|x86.Build.0 = Release|Win32 + {69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Debug|x64.ActiveCfg = Debug|x64 + {69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Debug|x64.Build.0 = Debug|x64 + {69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Debug|x86.ActiveCfg = Debug|Win32 + {69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Debug|x86.Build.0 = Debug|Win32 + {69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Debug|x86.Deploy.0 = Debug|Win32 + {69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Release|x64.ActiveCfg = Release|x64 + {69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Release|x64.Build.0 = Release|x64 + {69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Release|x86.ActiveCfg = Release|Win32 + {69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Release|x86.Build.0 = Release|Win32 + {69BE8E8C-CF1E-46D6-932B-DB435F47059B}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {DD5018BE-54C6-4FD4-9F8D-08D52FC0CD40} = {95BD0669-04C8-4EEB-B3CC-0535B03F4468} + {9B33C190-5D07-40BF-9536-68843DC5D7AF} = {95BD0669-04C8-4EEB-B3CC-0535B03F4468} + {4111C8BB-D354-4348-AD3C-EB6832E84831} = {873E9D16-2A08-41FC-B301-79C95B3A8F98} + {69BE8E8C-CF1E-46D6-932B-DB435F47059B} = {873E9D16-2A08-41FC-B301-79C95B3A8F98} + EndGlobalSection +EndGlobal diff --git a/include/openthread-types.h b/include/openthread-types.h index 8e4746295..236617f20 100644 --- a/include/openthread-types.h +++ b/include/openthread-types.h @@ -249,7 +249,8 @@ typedef struct otExtAddress /** * This structure represents an IPv6 address. */ -typedef OT_TOOL_PACKED_BEGIN struct otIp6Address +OT_TOOL_PACKED_BEGIN +struct otIp6Address { union { @@ -257,7 +258,9 @@ typedef OT_TOOL_PACKED_BEGIN struct otIp6Address uint16_t m16[OT_IP6_ADDRESS_SIZE / sizeof(uint16_t)]; ///< 16-bit fields uint32_t m32[OT_IP6_ADDRESS_SIZE / sizeof(uint32_t)]; ///< 32-bit fields } mFields; ///< IPv6 accessor fields -} OT_TOOL_PACKED_END otIp6Address; +} OT_TOOL_PACKED_END; + +typedef struct otIp6Address otIp6Address; /** * @addtogroup commands Commands diff --git a/include/openthread-windows-config.h b/include/openthread-windows-config.h new file mode 100644 index 000000000..61d53bc1b --- /dev/null +++ b/include/openthread-windows-config.h @@ -0,0 +1,78 @@ +/* + * 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. + */ + +/* Define to 1 to enable the commissioner role. */ +#define OPENTHREAD_ENABLE_COMMISSIONER 1 + +/* Define to 1 if you want to use diagnostics module */ +#define OPENTHREAD_ENABLE_DIAG 0 + +/* Define to 1 to enable dtls support. */ +#define OPENTHREAD_ENABLE_DTLS 1 + +/* Define to 1 to enable the joiner role. */ +#define OPENTHREAD_ENABLE_JOINER 1 + +/* Name of package */ +#define PACKAGE "openthread" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "openthread-devel@googlegroups.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "OPENTHREAD" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "OPENTHREAD 0.01.00" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "openthread" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "http://github.com/openthread/openthread" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.01.00" + +/* Version number of package */ +#define VERSION "0.01.00" + +/* Platform version information */ +#define PLATFORM_INFO "Windows" + +// Windows Kernel only has sprintf_s +#ifdef WINDOWS_KERNEL +#define snprintf sprintf_s +#endif // WINDOWS_KERNEL + +// Temporary !!! TODO - Remove this once we figure out the strncpy issue +#define _CRT_SECURE_NO_WARNINGS + +// Disable a few warnings that we don't care about +#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union +#pragma warning(disable:4291) // no matching operator delete found diff --git a/src/core/coap/coap_server.cpp b/src/core/coap/coap_server.cpp index 2c9d2aff7..d2b4f6cf5 100644 --- a/src/core/coap/coap_server.cpp +++ b/src/core/coap/coap_server.cpp @@ -50,7 +50,7 @@ ThreadError Server::Start() Ip6::SockAddr sockaddr; sockaddr.mPort = mPort; - SuccessOrExit(error = mSocket.Open(&HandleUdpReceive, this)); + SuccessOrExit(error = mSocket.Open(&Server::HandleUdpReceive, this)); SuccessOrExit(error = mSocket.Bind(sockaddr)); exit: diff --git a/src/core/common/debug.hpp b/src/core/common/debug.hpp index f08e0fba7..d5381861e 100644 --- a/src/core/common/debug.hpp +++ b/src/core/common/debug.hpp @@ -42,6 +42,15 @@ #include +#elif defined(WINDOWS_KERNEL) + +#include + +#define assert(exp) \ + ((!(exp)) ? \ + (RtlAssert( #exp, __FILE__, __LINE__, NULL ),FALSE) : \ + TRUE) + #else #define assert(cond) \ diff --git a/src/core/common/logging.cpp b/src/core/common/logging.cpp index 1872925c6..a696040ff 100644 --- a/src/core/common/logging.cpp +++ b/src/core/common/logging.cpp @@ -31,6 +31,12 @@ * This file implements the tasklet scheduler. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include #include diff --git a/src/core/common/message.hpp b/src/core/common/message.hpp index 1cda53098..37cfa528f 100644 --- a/src/core/common/message.hpp +++ b/src/core/common/message.hpp @@ -34,6 +34,12 @@ #ifndef MESSAGE_HPP_ #define MESSAGE_HPP_ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index 4d54c4257..660398d00 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -74,14 +74,14 @@ void Mac::StartCsmaBackoff(void) } Mac::Mac(ThreadNetif &aThreadNetif): - mBeginTransmit(aThreadNetif.GetIp6().mTaskletScheduler, &HandleBeginTransmit, this), - mAckTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleAckTimer, this), - mBackoffTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleBeginTransmit, this), - mReceiveTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleReceiveTimer, this), + mBeginTransmit(aThreadNetif.GetIp6().mTaskletScheduler, &Mac::HandleBeginTransmit, this), + mAckTimer(aThreadNetif.GetIp6().mTimerScheduler, &Mac::HandleAckTimer, this), + mBackoffTimer(aThreadNetif.GetIp6().mTimerScheduler, &Mac::HandleBeginTransmit, this), + mReceiveTimer(aThreadNetif.GetIp6().mTimerScheduler, &Mac::HandleReceiveTimer, this), mKeyManager(aThreadNetif.GetKeyManager()), mMle(aThreadNetif.GetMle()), mNetif(aThreadNetif), - mEnergyScanSampleRssiTask(aThreadNetif.GetIp6().mTaskletScheduler, &HandleEnergyScanSampleRssi, this), + mEnergyScanSampleRssiTask(aThreadNetif.GetIp6().mTaskletScheduler, &Mac::HandleEnergyScanSampleRssi, this), mWhitelist(), mBlacklist() { @@ -542,13 +542,13 @@ void Mac::HandleBeginTransmit(void *aContext) void Mac::ProcessTransmitSecurity(Frame &aFrame) { - uint32_t frameCounter; + uint32_t frameCounter = 0; uint8_t securityLevel; uint8_t keyIdMode; uint8_t nonce[kNonceSize]; uint8_t tagLength; Crypto::AesCcm aesCcm; - const uint8_t *key; + const uint8_t *key = NULL; if (aFrame.GetSecurityEnabled() == false) { diff --git a/src/core/meshcop/commissioner.cpp b/src/core/meshcop/commissioner.cpp index 87dad3092..6a00dddaa 100644 --- a/src/core/meshcop/commissioner.cpp +++ b/src/core/meshcop/commissioner.cpp @@ -56,10 +56,10 @@ Commissioner::Commissioner(ThreadNetif &aThreadNetif): mEnergyScan(aThreadNetif), mPanIdQuery(aThreadNetif), mTimer(aThreadNetif.GetIp6().mTimerScheduler, HandleTimer, this), - mTransmitTask(aThreadNetif.GetIp6().mTaskletScheduler, &HandleUdpTransmit, this), + mTransmitTask(aThreadNetif.GetIp6().mTaskletScheduler, &Commissioner::HandleUdpTransmit, this), mSendKek(false), mSocket(aThreadNetif.GetIp6().mUdp), - mRelayReceive(OPENTHREAD_URI_RELAY_RX, &HandleRelayReceive, this), + mRelayReceive(OPENTHREAD_URI_RELAY_RX, &Commissioner::HandleRelayReceive, this), mNetif(aThreadNetif) { aThreadNetif.GetCoapServer().AddResource(mRelayReceive); diff --git a/src/core/meshcop/dtls.cpp b/src/core/meshcop/dtls.cpp index 1edefcf25..c43d7cb47 100644 --- a/src/core/meshcop/dtls.cpp +++ b/src/core/meshcop/dtls.cpp @@ -49,7 +49,7 @@ namespace MeshCoP { Dtls::Dtls(ThreadNetif &aNetif): mStarted(false), - mTimer(aNetif.GetIp6().mTimerScheduler, &HandleTimer, this), + mTimer(aNetif.GetIp6().mTimerScheduler, &Dtls::HandleTimer, this), mTimerIntermediate(0), mTimerSet(false), mNetif(aNetif) @@ -102,8 +102,8 @@ ThreadError Dtls::Start(bool aClient, ReceiveHandler aReceiveHandler, SendHandle rval = mbedtls_ssl_setup(&mSsl, &mConf); VerifyOrExit(rval == 0, ;); - mbedtls_ssl_set_bio(&mSsl, this, &HandleMbedtlsTransmit, HandleMbedtlsReceive, NULL); - mbedtls_ssl_set_timer_cb(&mSsl, this, &HandleMbedtlsSetTimer, HandleMbedtlsGetTimer); + mbedtls_ssl_set_bio(&mSsl, this, &Dtls::HandleMbedtlsTransmit, HandleMbedtlsReceive, NULL); + mbedtls_ssl_set_timer_cb(&mSsl, this, &Dtls::HandleMbedtlsSetTimer, HandleMbedtlsGetTimer); rval = mbedtls_ssl_set_hs_ecjpake_password(&mSsl, mPsk, mPskLength); VerifyOrExit(rval == 0, ;); diff --git a/src/core/meshcop/energy_scan_client.cpp b/src/core/meshcop/energy_scan_client.cpp index 8dad6442e..f7a7c6ee6 100644 --- a/src/core/meshcop/energy_scan_client.cpp +++ b/src/core/meshcop/energy_scan_client.cpp @@ -47,9 +47,9 @@ using Thread::Encoding::BigEndian::HostSwap32; namespace Thread { EnergyScanClient::EnergyScanClient(ThreadNetif &aThreadNetif) : - mEnergyScan(OPENTHREAD_URI_ENERGY_REPORT, &HandleReport, this), + mEnergyScan(OPENTHREAD_URI_ENERGY_REPORT, &EnergyScanClient::HandleReport, this), mSocket(aThreadNetif.GetIp6().mUdp), - mTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleTimer, this), + mTimer(aThreadNetif.GetIp6().mTimerScheduler, &EnergyScanClient::HandleTimer, this), mCoapServer(aThreadNetif.GetCoapServer()), mNetif(aThreadNetif) { diff --git a/src/core/meshcop/joiner.cpp b/src/core/meshcop/joiner.cpp index 1d1596f5e..e39001b79 100644 --- a/src/core/meshcop/joiner.cpp +++ b/src/core/meshcop/joiner.cpp @@ -57,8 +57,8 @@ namespace MeshCoP { Joiner::Joiner(ThreadNetif &aNetif): mTransmitMessage(NULL), mSocket(aNetif.GetIp6().mUdp), - mTransmitTask(aNetif.GetIp6().mTaskletScheduler, &HandleUdpTransmit, this), - mJoinerEntrust(OPENTHREAD_URI_JOINER_ENTRUST, &HandleJoinerEntrust, this), + mTransmitTask(aNetif.GetIp6().mTaskletScheduler, &Joiner::HandleUdpTransmit, this), + mJoinerEntrust(OPENTHREAD_URI_JOINER_ENTRUST, &Joiner::HandleJoinerEntrust, this), mNetif(aNetif) { mNetif.GetCoapServer().AddResource(mJoinerEntrust); @@ -108,7 +108,7 @@ void Joiner::HandleDiscoverResult(otActiveScanResult *aResult) // open UDP port Ip6::SockAddr sockaddr; sockaddr.mPort = 1000; - mSocket.Open(&HandleUdpReceive, this); + mSocket.Open(&Joiner::HandleUdpReceive, this); mSocket.Bind(sockaddr); mNetif.GetMac().SetPanId(mJoinerRouterPanId); diff --git a/src/core/meshcop/joiner_router.cpp b/src/core/meshcop/joiner_router.cpp index 255705a4f..42fce09d1 100644 --- a/src/core/meshcop/joiner_router.cpp +++ b/src/core/meshcop/joiner_router.cpp @@ -50,7 +50,7 @@ namespace MeshCoP { JoinerRouter::JoinerRouter(ThreadNetif &aNetif): mSocket(aNetif.GetIp6().mUdp), - mRelayTransmit(OPENTHREAD_URI_RELAY_TX, &HandleRelayTransmit, this), + mRelayTransmit(OPENTHREAD_URI_RELAY_TX, &JoinerRouter::HandleRelayTransmit, this), mNetif(aNetif) { mSocket.GetSockName().mPort = OPENTHREAD_CONFIG_JOINER_UDP_PORT; @@ -82,7 +82,7 @@ void JoinerRouter::HandleNetifStateChanged(uint32_t aFlags) sockaddr.mPort = OPENTHREAD_CONFIG_JOINER_UDP_PORT; } - mSocket.Open(&HandleUdpReceive, this); + mSocket.Open(&JoinerRouter::HandleUdpReceive, this); mSocket.Bind(sockaddr); mNetif.GetIp6Filter().AddUnsecurePort(sockaddr.mPort); otLogInfoMeshCoP("Joiner Router: start\r\n"); diff --git a/src/core/meshcop/panid_query_client.cpp b/src/core/meshcop/panid_query_client.cpp index fa93f7882..8db9e729a 100644 --- a/src/core/meshcop/panid_query_client.cpp +++ b/src/core/meshcop/panid_query_client.cpp @@ -43,9 +43,9 @@ namespace Thread { PanIdQueryClient::PanIdQueryClient(ThreadNetif &aThreadNetif) : - mPanIdQuery(OPENTHREAD_URI_PANID_CONFLICT, &HandleConflict, this), + mPanIdQuery(OPENTHREAD_URI_PANID_CONFLICT, &PanIdQueryClient::HandleConflict, this), mSocket(aThreadNetif.GetIp6().mUdp), - mTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleTimer, this), + mTimer(aThreadNetif.GetIp6().mTimerScheduler, &PanIdQueryClient::HandleTimer, this), mCoapServer(aThreadNetif.GetCoapServer()), mNetif(aThreadNetif) { diff --git a/src/core/net/ip6_address.cpp b/src/core/net/ip6_address.cpp index 01fb33d9d..27b561802 100644 --- a/src/core/net/ip6_address.cpp +++ b/src/core/net/ip6_address.cpp @@ -31,6 +31,12 @@ * This file implements IPv6 addresses. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include diff --git a/src/core/net/ip6_mpl.cpp b/src/core/net/ip6_mpl.cpp index 844a37013..3f542cfc1 100644 --- a/src/core/net/ip6_mpl.cpp +++ b/src/core/net/ip6_mpl.cpp @@ -40,7 +40,7 @@ namespace Thread { namespace Ip6 { Mpl::Mpl(Ip6 &aIp6): - mTimer(aIp6.mTimerScheduler, &HandleTimer, this) + mTimer(aIp6.mTimerScheduler, &Mpl::HandleTimer, this) { memset(mEntries, 0, sizeof(mEntries)); mSequence = 0; diff --git a/src/core/net/ip6_mpl.hpp b/src/core/net/ip6_mpl.hpp index 426152885..40755cb27 100644 --- a/src/core/net/ip6_mpl.hpp +++ b/src/core/net/ip6_mpl.hpp @@ -108,7 +108,7 @@ public: * @retval FALSE If the MPL M flag is not set. * */ - bool IsMaxFlagSet() { return mControl & kMaxFlag; } + bool IsMaxFlagSet() { return (mControl & kMaxFlag) != 0; } /** * This method clears the MPL M flag. diff --git a/src/core/net/netif.cpp b/src/core/net/netif.cpp index 513502fac..79cc92315 100644 --- a/src/core/net/netif.cpp +++ b/src/core/net/netif.cpp @@ -42,7 +42,7 @@ namespace Ip6 { Netif::Netif(Ip6 &aIp6): mIp6(aIp6), - mStateChangedTask(aIp6.mTaskletScheduler, &HandleStateChangedTask, this) + mStateChangedTask(aIp6.mTaskletScheduler, &Netif::HandleStateChangedTask, this) { mCallbacks = NULL; mUnicastAddresses = NULL; diff --git a/src/core/openthread.cpp b/src/core/openthread.cpp index 10b489c61..f5654882f 100644 --- a/src/core/openthread.cpp +++ b/src/core/openthread.cpp @@ -885,11 +885,15 @@ void otSetStateChangedCallback(otInstance *, otStateChangedCallback aCallback, v const char *otGetVersionString(void) { static const char sVersion[] = - PACKAGE_NAME "/" PACKAGE_VERSION "; " + PACKAGE_NAME "/" PACKAGE_VERSION #ifdef PLATFORM_INFO - PLATFORM_INFO "; " + "; " PLATFORM_INFO +#endif +#if defined(__DATE__) + "; " __DATE__ " " __TIME__; +#else + ; #endif - __DATE__ " " __TIME__; return sVersion; } diff --git a/src/core/thread/address_resolver.cpp b/src/core/thread/address_resolver.cpp index 7ccff91e5..e4f54a1fa 100644 --- a/src/core/thread/address_resolver.cpp +++ b/src/core/thread/address_resolver.cpp @@ -50,12 +50,12 @@ using Thread::Encoding::BigEndian::HostSwap16; namespace Thread { AddressResolver::AddressResolver(ThreadNetif &aThreadNetif) : - mAddressError(OPENTHREAD_URI_ADDRESS_ERROR, &HandleAddressError, this), - mAddressQuery(OPENTHREAD_URI_ADDRESS_QUERY, &HandleAddressQuery, this), - mAddressNotification(OPENTHREAD_URI_ADDRESS_NOTIFY, &HandleAddressNotification, this), - mIcmpHandler(&HandleDstUnreach, this), + mAddressError(OPENTHREAD_URI_ADDRESS_ERROR, &AddressResolver::HandleAddressError, this), + mAddressQuery(OPENTHREAD_URI_ADDRESS_QUERY, &AddressResolver::HandleAddressQuery, this), + mAddressNotification(OPENTHREAD_URI_ADDRESS_NOTIFY, &AddressResolver::HandleAddressNotification, this), + mIcmpHandler(&AddressResolver::HandleDstUnreach, this), mSocket(aThreadNetif.GetIp6().mUdp), - mTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleTimer, this), + mTimer(aThreadNetif.GetIp6().mTimerScheduler, &AddressResolver::HandleTimer, this), mMeshForwarder(aThreadNetif.GetMeshForwarder()), mCoapServer(aThreadNetif.GetCoapServer()), mMle(aThreadNetif.GetMle()), diff --git a/src/core/thread/energy_scan_server.cpp b/src/core/thread/energy_scan_server.cpp index 5c9ecd8af..e714671b9 100644 --- a/src/core/thread/energy_scan_server.cpp +++ b/src/core/thread/energy_scan_server.cpp @@ -44,13 +44,13 @@ namespace Thread { EnergyScanServer::EnergyScanServer(ThreadNetif &aThreadNetif) : mActive(false), - mEnergyScan(OPENTHREAD_URI_ENERGY_SCAN, &HandleRequest, this), + mEnergyScan(OPENTHREAD_URI_ENERGY_SCAN, &EnergyScanServer::HandleRequest, this), mSocket(aThreadNetif.GetIp6().mUdp), - mTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleTimer, this), + mTimer(aThreadNetif.GetIp6().mTimerScheduler, &EnergyScanServer::HandleTimer, this), mCoapServer(aThreadNetif.GetCoapServer()), mNetif(aThreadNetif) { - mNetifCallback.Set(&HandleNetifStateChanged, this); + mNetifCallback.Set(&EnergyScanServer::HandleNetifStateChanged, this); mNetif.RegisterCallback(mNetifCallback); mCoapServer.AddResource(mEnergyScan); @@ -116,7 +116,7 @@ exit: ThreadError EnergyScanServer::SendResponse(const Coap::Header &aRequestHeader, const Ip6::MessageInfo &aRequestInfo) { ThreadError error = kThreadError_None; - Message *message; + Message *message = NULL; Coap::Header responseHeader; Ip6::MessageInfo responseInfo; diff --git a/src/core/thread/link_quality.cpp b/src/core/thread/link_quality.cpp index 5329a1906..b85964bc4 100644 --- a/src/core/thread/link_quality.cpp +++ b/src/core/thread/link_quality.cpp @@ -31,6 +31,12 @@ * This file implements link quality information processing and storage. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include #include diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index 5c64c7c60..60b186dc2 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -51,11 +51,11 @@ using Thread::Encoding::BigEndian::HostSwap16; namespace Thread { MeshForwarder::MeshForwarder(ThreadNetif &aThreadNetif): - mMacReceiver(&HandleReceivedFrame, this), - mMacSender(&HandleFrameRequest, &HandleSentFrame, this), - mDiscoverTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleDiscoverTimer, this), - mPollTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandlePollTimer, this), - mReassemblyTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleReassemblyTimer, this), + mMacReceiver(&MeshForwarder::HandleReceivedFrame, this), + mMacSender(&MeshForwarder::HandleFrameRequest, &MeshForwarder::HandleSentFrame, this), + mDiscoverTimer(aThreadNetif.GetIp6().mTimerScheduler, &MeshForwarder::HandleDiscoverTimer, this), + mPollTimer(aThreadNetif.GetIp6().mTimerScheduler, &MeshForwarder::HandlePollTimer, this), + mReassemblyTimer(aThreadNetif.GetIp6().mTimerScheduler, &MeshForwarder::HandleReassemblyTimer, this), mScheduleTransmissionTask(aThreadNetif.GetIp6().mTaskletScheduler, ScheduleTransmissionTask, this), mNetif(aThreadNetif), mAddressResolver(aThreadNetif.GetAddressResolver()), diff --git a/src/core/thread/meshcop_dataset_manager.cpp b/src/core/thread/meshcop_dataset_manager.cpp index 56a56c14f..7b55f2afc 100644 --- a/src/core/thread/meshcop_dataset_manager.cpp +++ b/src/core/thread/meshcop_dataset_manager.cpp @@ -56,9 +56,9 @@ DatasetManager::DatasetManager(ThreadNetif &aThreadNetif, const Tlv::Type aType, mMle(aThreadNetif.GetMle()), mNetif(aThreadNetif), mNetworkDataLeader(aThreadNetif.GetNetworkDataLeader()), - mResourceSet(aUriSet, &HandleSet, this), - mResourceGet(aUriGet, &HandleGet, this), - mTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleTimer, this), + mResourceSet(aUriSet, &DatasetManager::HandleSet, this), + mResourceGet(aUriGet, &DatasetManager::HandleGet, this), + mTimer(aThreadNetif.GetIp6().mTimerScheduler, &DatasetManager::HandleTimer, this), mSocket(aThreadNetif.GetIp6().mUdp), mUriSet(aUriSet), mUriGet(aUriGet), @@ -171,7 +171,7 @@ ThreadError DatasetManager::Register(void) Ip6::Address leader; Ip6::MessageInfo messageInfo; - mSocket.Open(&HandleUdpReceive, this); + mSocket.Open(&DatasetManager::HandleUdpReceive, this); for (size_t i = 0; i < sizeof(mCoapToken); i++) { @@ -325,7 +325,7 @@ ThreadError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, Message *message; Ip6::MessageInfo messageInfo; - mSocket.Open(&HandleUdpReceive, this); + mSocket.Open(&DatasetManager::HandleUdpReceive, this); for (size_t i = 0; i < sizeof(mCoapToken); i++) { @@ -449,7 +449,7 @@ ThreadError DatasetManager::SendGetRequest(const uint8_t *aTlvTypes, const uint8 Ip6::MessageInfo messageInfo; Tlv tlv; - mSocket.Open(&HandleUdpReceive, this); + mSocket.Open(&DatasetManager::HandleUdpReceive, this); for (size_t i = 0; i < sizeof(mCoapToken); i++) { diff --git a/src/core/thread/meshcop_tlvs.hpp b/src/core/thread/meshcop_tlvs.hpp index bb72d52c0..4e1eb65fb 100644 --- a/src/core/thread/meshcop_tlvs.hpp +++ b/src/core/thread/meshcop_tlvs.hpp @@ -656,6 +656,7 @@ private: * This class implements the Commissioner ID TLV generation and parsing. * */ +OT_TOOL_PACKED_BEGIN class CommissionerIdTlv: public Tlv { public: @@ -1261,7 +1262,7 @@ public: */ bool IsChannelSet(uint8_t aChannel) const { const uint8_t *mask = reinterpret_cast(this) + sizeof(*this); - return (aChannel < (mMaskLength * 8)) ? mask[aChannel / 8] & (1 << (aChannel % 8)) : false; + return (aChannel < (mMaskLength * 8)) ? ((mask[aChannel / 8] & (1 << (aChannel % 8))) != 0) : false; } private: @@ -1494,7 +1495,7 @@ public: * @retval FALSE If the Joiner flag is not set. * */ - bool IsJoiner(void) { return mFlags & kJoinerMask; } + bool IsJoiner(void) { return (mFlags & kJoinerMask) != 0; } /** * This method sets the Joiner flag. @@ -1571,7 +1572,7 @@ public: * @retval FALSE If the Native Commissioner flag is not set. * */ - bool IsNativeCommissioner(void) { return mFlags & kNativeMask; } + bool IsNativeCommissioner(void) { return (mFlags & kNativeMask) != 0; } /** * This method sets the Native Commissioner flag. diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index b2cfb1776..575750d5f 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -61,9 +61,9 @@ Mle::Mle(ThreadNetif &aThreadNetif) : mMesh(aThreadNetif.GetMeshForwarder()), mMleRouter(aThreadNetif.GetMle()), mNetworkData(aThreadNetif.GetNetworkDataLeader()), - mParentRequestTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleParentRequestTimer, this), + mParentRequestTimer(aThreadNetif.GetIp6().mTimerScheduler, &Mle::HandleParentRequestTimer, this), mSocket(aThreadNetif.GetIp6().mUdp), - mSendChildUpdateRequest(aThreadNetif.GetIp6().mTaskletScheduler, &HandleSendChildUpdateRequest, this) + mSendChildUpdateRequest(aThreadNetif.GetIp6().mTaskletScheduler, &Mle::HandleSendChildUpdateRequest, this) { mDeviceState = kDeviceStateDisabled; mDeviceMode = ModeTlv::kModeRxOnWhenIdle | ModeTlv::kModeSecureDataRequest | ModeTlv::kModeFFD | @@ -143,7 +143,7 @@ Mle::Mle(ThreadNetif &aThreadNetif) : mRealmLocalAllThreadNodes.GetAddress().mFields.m16[7] = HostSwap16(0x0001); mNetif.SubscribeMulticast(mRealmLocalAllThreadNodes); - mNetifCallback.Set(&HandleNetifStateChanged, this); + mNetifCallback.Set(&Mle::HandleNetifStateChanged, this); mNetif.RegisterCallback(mNetifCallback); isAssignLinkQuality = false; @@ -161,7 +161,7 @@ ThreadError Mle::Enable(void) // memcpy(&sockaddr.mAddr, &mLinkLocal64.GetAddress(), sizeof(sockaddr.mAddr)); sockaddr.mPort = kUdpPort; - SuccessOrExit(error = mSocket.Open(&HandleUdpReceive, this)); + SuccessOrExit(error = mSocket.Open(&Mle::HandleUdpReceive, this)); SuccessOrExit(error = mSocket.Bind(sockaddr)); exit: diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index da84004a8..d32c75642 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -50,11 +50,11 @@ namespace Mle { MleRouter::MleRouter(ThreadNetif &aThreadNetif): Mle(aThreadNetif), - mAdvertiseTimer(aThreadNetif.GetIp6().mTimerScheduler, HandleAdvertiseTimer, NULL, this), - mStateUpdateTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleStateUpdateTimer, this), + mAdvertiseTimer(aThreadNetif.GetIp6().mTimerScheduler, &MleRouter::HandleAdvertiseTimer, NULL, this), + mStateUpdateTimer(aThreadNetif.GetIp6().mTimerScheduler, &MleRouter::HandleStateUpdateTimer, this), mSocket(aThreadNetif.GetIp6().mUdp), - mAddressSolicit(OPENTHREAD_URI_ADDRESS_SOLICIT, &HandleAddressSolicit, this), - mAddressRelease(OPENTHREAD_URI_ADDRESS_RELEASE, &HandleAddressRelease, this), + mAddressSolicit(OPENTHREAD_URI_ADDRESS_SOLICIT, &MleRouter::HandleAddressSolicit, this), + mAddressRelease(OPENTHREAD_URI_ADDRESS_RELEASE, &MleRouter::HandleAddressRelease, this), mCoapServer(aThreadNetif.GetCoapServer()) { mNextChildId = kMaxChildId; @@ -197,7 +197,7 @@ ThreadError MleRouter::BecomeRouter(ThreadStatusTlv::Status aStatus) mRouters[i].mNextHop = kMaxRouterId; } - mSocket.Open(&HandleUdpReceive, this); + mSocket.Open(&MleRouter::HandleUdpReceive, this); mAdvertiseTimer.Stop(); mAddressResolver.Clear(); @@ -238,7 +238,7 @@ ThreadError MleRouter::BecomeLeader(void) mRouters[i].mNextHop = kMaxRouterId; } - mSocket.Open(&HandleUdpReceive, this); + mSocket.Open(&MleRouter::HandleUdpReceive, this); mAdvertiseTimer.Stop(); mStateUpdateTimer.Start(kStateUpdatePeriod); mAddressResolver.Clear(); diff --git a/src/core/thread/mle_tlvs.hpp b/src/core/thread/mle_tlvs.hpp index b74317773..852a4a698 100644 --- a/src/core/thread/mle_tlvs.hpp +++ b/src/core/thread/mle_tlvs.hpp @@ -1325,7 +1325,7 @@ public: * @retval FALSE If the Compressed flag is not set. * */ - bool IsCompressed(void) const { return mControl & kCompressed; } + bool IsCompressed(void) const { return (mControl & kCompressed) != 0; } /** * This method sets the Uncompressed flag. diff --git a/src/core/thread/network_data.cpp b/src/core/thread/network_data.cpp index 31110ef99..c657fe2fa 100644 --- a/src/core/thread/network_data.cpp +++ b/src/core/thread/network_data.cpp @@ -598,7 +598,7 @@ ThreadError NetworkData::SendServerDataNotification(uint16_t aRloc16) VerifyOrExit(!mLastAttemptWait || static_cast(Timer::GetNow() - mLastAttempt) < kDataResubmitDelay, error = kThreadError_Already); - mSocket.Open(&HandleUdpReceive, this); + mSocket.Open(&NetworkData::HandleUdpReceive, this); for (size_t i = 0; i < sizeof(mCoapToken); i++) { diff --git a/src/core/thread/network_data_leader.cpp b/src/core/thread/network_data_leader.cpp index 677210b7b..f83e26ef3 100644 --- a/src/core/thread/network_data_leader.cpp +++ b/src/core/thread/network_data_leader.cpp @@ -53,8 +53,8 @@ namespace NetworkData { Leader::Leader(ThreadNetif &aThreadNetif): NetworkData(aThreadNetif, false), - mTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleTimer, this), - mServerData(OPENTHREAD_URI_SERVER_DATA, &HandleServerData, this), + mTimer(aThreadNetif.GetIp6().mTimerScheduler, &Leader::HandleTimer, this), + mServerData(OPENTHREAD_URI_SERVER_DATA, &Leader::HandleServerData, this), mCoapServer(aThreadNetif.GetCoapServer()), mNetif(aThreadNetif) { diff --git a/src/core/thread/panid_query_server.cpp b/src/core/thread/panid_query_server.cpp index c29a20efd..634fc9c71 100644 --- a/src/core/thread/panid_query_server.cpp +++ b/src/core/thread/panid_query_server.cpp @@ -43,9 +43,9 @@ namespace Thread { PanIdQueryServer::PanIdQueryServer(ThreadNetif &aThreadNetif) : - mPanIdQuery(OPENTHREAD_URI_PANID_QUERY, &HandleQuery, this), + mPanIdQuery(OPENTHREAD_URI_PANID_QUERY, &PanIdQueryServer::HandleQuery, this), mSocket(aThreadNetif.GetIp6().mUdp), - mTimer(aThreadNetif.GetIp6().mTimerScheduler, &HandleTimer, this), + mTimer(aThreadNetif.GetIp6().mTimerScheduler, &PanIdQueryServer::HandleTimer, this), mCoapServer(aThreadNetif.GetCoapServer()), mNetif(aThreadNetif) { @@ -100,7 +100,7 @@ ThreadError PanIdQueryServer::SendQueryResponse(const Coap::Header &aRequestHead const Ip6::MessageInfo &aRequestInfo) { ThreadError error = kThreadError_None; - Message *message; + Message *message = NULL; Coap::Header responseHeader; Ip6::MessageInfo responseInfo; diff --git a/src/core/thread/topology.hpp b/src/core/thread/topology.hpp index 958face35..3e9120fbf 100644 --- a/src/core/thread/topology.hpp +++ b/src/core/thread/topology.hpp @@ -73,6 +73,9 @@ public: * */ enum State +#if _WIN32 + : unsigned int +#endif { kStateInvalid, ///< Neighbor link is invalid kStateParentRequest, ///< Received an MLE Parent Request message diff --git a/tests/unit/test_toolchain.cpp b/tests/unit/test_toolchain.cpp index 81ca3f223..9a1b9f35f 100644 --- a/tests/unit/test_toolchain.cpp +++ b/tests/unit/test_toolchain.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include "test_util.h" void test_packed1() @@ -74,11 +75,21 @@ void test_packed_union() VerifyOrQuit(sizeof(packed_t) == 5, "Toolchain::OT_TOOL_PACKED failed 3\n"); } +void test_packed_enum() +{ + Thread::Neighbor neighbor; + neighbor.mState = Thread::Neighbor::kStateValid; + + // Make sure that when we read the 3 bit field it is read as unsigned, so it return '4' + VerifyOrQuit(neighbor.mState == Thread::Neighbor::kStateValid, "Toolchain::OT_TOOL_PACKED failed 4\n"); +} + void TestToolchain(void) { test_packed1(); test_packed2(); test_packed_union(); + test_packed_enum(); } int main(void) diff --git a/third_party/mbedtls/mbedtls-config.h b/third_party/mbedtls/mbedtls-config.h index bd2965617..64cced6b5 100644 --- a/third_party/mbedtls/mbedtls-config.h +++ b/third_party/mbedtls/mbedtls-config.h @@ -28,11 +28,18 @@ #ifndef MBEDTLS_CONFIG_H #define MBEDTLS_CONFIG_H -#include #include #include +#if defined(_WIN32) +#include +#include +// Temporary, until the warnings can get fixed in the mbed library +#pragma warning(disable:4242) // conversion from '*' to '*', possible loss of data +#pragma warning(disable:4244) // conversion from '*' to '*', possible loss of data +#endif + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) #define _CRT_SECURE_NO_DEPRECATE 1 #endif