mirror of
https://github.com/espressif/openthread.git
synced 2026-08-09 04:07:47 +00:00
Windows API DLL (#882)
* VS Solution files and minor fixes. * Move Tasklet into platform include file * Refactor data path APIs into openthread-ip6.h
This commit is contained in:
@@ -46,6 +46,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "drivers", "drivers", "{61E8
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otLwf", "otLwf.vcxproj", "{3F1F7F6C-2A33-4635-9880-08FC5BC4E435}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otApi", "otApi.vcxproj", "{ED0EA262-C222-42C7-98D3-E70C72978ED2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -166,6 +168,14 @@ Global
|
||||
{3F1F7F6C-2A33-4635-9880-08FC5BC4E435}.Release|x86.ActiveCfg = Release|Win32
|
||||
{3F1F7F6C-2A33-4635-9880-08FC5BC4E435}.Release|x86.Build.0 = Release|Win32
|
||||
{3F1F7F6C-2A33-4635-9880-08FC5BC4E435}.Release|x86.Deploy.0 = Release|Win32
|
||||
{ED0EA262-C222-42C7-98D3-E70C72978ED2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ED0EA262-C222-42C7-98D3-E70C72978ED2}.Debug|x64.Build.0 = Debug|x64
|
||||
{ED0EA262-C222-42C7-98D3-E70C72978ED2}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{ED0EA262-C222-42C7-98D3-E70C72978ED2}.Debug|x86.Build.0 = Debug|Win32
|
||||
{ED0EA262-C222-42C7-98D3-E70C72978ED2}.Release|x64.ActiveCfg = Release|x64
|
||||
{ED0EA262-C222-42C7-98D3-E70C72978ED2}.Release|x64.Build.0 = Release|x64
|
||||
{ED0EA262-C222-42C7-98D3-E70C72978ED2}.Release|x86.ActiveCfg = Release|Win32
|
||||
{ED0EA262-C222-42C7-98D3-E70C72978ED2}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -184,5 +194,6 @@ Global
|
||||
{B4C744EC-B662-46C6-A076-FB58FA8FDF1B} = {76EA541E-CAB1-4DB5-A39F-E3DB2A78CDDD}
|
||||
{9EEF9DCD-EA8F-4154-BD02-AB2B31CEC324} = {76EA541E-CAB1-4DB5-A39F-E3DB2A78CDDD}
|
||||
{3F1F7F6C-2A33-4635-9880-08FC5BC4E435} = {61E8A4A0-8138-49DB-97B4-3BEC87C8E133}
|
||||
{ED0EA262-C222-42C7-98D3-E70C72978ED2} = {61E8A4A0-8138-49DB-97B4-3BEC87C8E133}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{ED0EA262-C222-42C7-98D3-E70C72978ED2}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>otApi</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WindowsAppContainer>false</WindowsAppContainer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WindowsAppContainer>false</WindowsAppContainer>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>..\..\build\bin\$(Platform)\$(Configuration)\dll\</OutDir>
|
||||
<IntDir>..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>..\..\build\bin\$(Platform)\$(Configuration)\dll\</OutDir>
|
||||
<IntDir>..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>..\..\build\bin\$(Platform)\$(Configuration)\dll\</OutDir>
|
||||
<IntDir>..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>..\..\build\bin\$(Platform)\$(Configuration)\dll\</OutDir>
|
||||
<IntDir>..\..\build\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;OTAPI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\examples\drivers\windows\include;..\..\examples\drivers\windows\otApi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
|
||||
<WppEnabled>true</WppEnabled>
|
||||
<WppScanConfigurationData>..\..\include\platform\logging-windows.h</WppScanConfigurationData>
|
||||
<WppModuleName>otApi</WppModuleName>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ntdll.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;OTAPI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\examples\drivers\windows\include;..\..\examples\drivers\windows\otApi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
|
||||
<WppEnabled>true</WppEnabled>
|
||||
<WppScanConfigurationData>..\..\include\platform\logging-windows.h</WppScanConfigurationData>
|
||||
<WppModuleName>otApi</WppModuleName>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ntdll.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;OTAPI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\examples\drivers\windows\include;..\..\examples\drivers\windows\otApi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
|
||||
<WppEnabled>true</WppEnabled>
|
||||
<WppScanConfigurationData>..\..\include\platform\logging-windows.h</WppScanConfigurationData>
|
||||
<WppModuleName>otApi</WppModuleName>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ntdll.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;OTAPI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\examples\drivers\windows\include;..\..\examples\drivers\windows\otApi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
|
||||
<WppEnabled>true</WppEnabled>
|
||||
<WppScanConfigurationData>..\..\include\platform\logging-windows.h</WppScanConfigurationData>
|
||||
<WppModuleName>otApi</WppModuleName>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ntdll.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\examples\drivers\windows\otApi\precomp.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\drivers\windows\otApi\dllmain.cpp" />
|
||||
<ClCompile Include="..\..\examples\drivers\windows\otApi\otApi.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\examples\drivers\windows\otApi\otApi.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\examples\drivers\windows\otApi\dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\examples\drivers\windows\otApi\precomp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread.h>
|
||||
#include <openthread-diag.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include <cli/cli-uart.h>
|
||||
#include <platform/platform.h>
|
||||
#include <assert.h>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread.h>
|
||||
#include <openthread-diag.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include <common/debug.hpp>
|
||||
#include <ncp/ncp.h>
|
||||
#include <platform/platform.h>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "dllmain.tmh"
|
||||
|
||||
BOOL
|
||||
__stdcall
|
||||
DllMain(
|
||||
HINSTANCE hinstDll,
|
||||
DWORD dwReason,
|
||||
LPVOID /* lpvReserved */
|
||||
)
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(hinstDll);
|
||||
WPP_INIT_TRACING(L"otApi");
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
WPP_CLEANUP();
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma warning(disable:28301) // No annotations for first declaration of *
|
||||
|
||||
#include <windows.h>
|
||||
#include <winnt.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2ipdef.h>
|
||||
#include <IPHlpApi.h>
|
||||
#include <mstcpip.h>
|
||||
#include <new>
|
||||
#include <vector>
|
||||
#include <tuple>
|
||||
|
||||
// Define to export necessary functions
|
||||
#define OTDLL
|
||||
#define OTAPI EXTERN_C __declspec(dllexport)
|
||||
|
||||
#include <openthread.h>
|
||||
#include <commissioning/commissioner.h>
|
||||
#include <commissioning/joiner.h>
|
||||
#include <platform/logging-windows.h>
|
||||
|
||||
#include <winioctl.h>
|
||||
#include <otLwfIoctl.h>
|
||||
#include <rtlrefcount.h>
|
||||
@@ -175,6 +175,7 @@ otLwfDeviceClientCleanup(
|
||||
}
|
||||
|
||||
// Free all pending notifications
|
||||
NT_ASSERT(DeviceClient->NotificationSize <= OTLWF_MAX_PENDING_NOTIFICATIONS_PER_CLIENT);
|
||||
for (UCHAR i = 0; i < DeviceClient->NotificationSize; i++)
|
||||
{
|
||||
UCHAR index = (DeviceClient->NotificationOffset + i) % OTLWF_MAX_PENDING_NOTIFICATIONS_PER_CLIENT;
|
||||
@@ -515,6 +516,7 @@ otLwfIndicateNotification(
|
||||
|
||||
// If there are other pending notifications or we don't have a pending IRP saved
|
||||
// then just go ahead and add the notification to the list
|
||||
NT_ASSERT(DeviceClient->NotificationSize <= OTLWF_MAX_PENDING_NOTIFICATIONS_PER_CLIENT);
|
||||
if (DeviceClient->NotificationSize != 0 ||
|
||||
DeviceClient->PendingNotificationIRP == NULL
|
||||
)
|
||||
@@ -530,11 +532,15 @@ otLwfIndicateNotification(
|
||||
{
|
||||
LogWarning(DRIVER_IOCTL, "Dropping old notification!");
|
||||
otLwfReleaseNotification(DeviceClient->PendingNotifications[DeviceClient->NotificationOffset]);
|
||||
DeviceClient->NotificationOffset++;
|
||||
}
|
||||
else
|
||||
{
|
||||
DeviceClient->NotificationSize++;
|
||||
}
|
||||
|
||||
// Copy the notification to the next space
|
||||
DeviceClient->PendingNotifications[Index] = NotifEntry;
|
||||
DeviceClient->NotificationSize++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -523,8 +523,11 @@ Return Value:
|
||||
|
||||
--*/
|
||||
{
|
||||
NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS;
|
||||
PMS_FILTER pFilter = (PMS_FILTER)FilterModuleContext;
|
||||
NTSTATUS NtStatus = STATUS_SUCCESS;
|
||||
NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS;
|
||||
PMS_FILTER pFilter = (PMS_FILTER)FilterModuleContext;
|
||||
NL_INTERFACE_KEY key = {0};
|
||||
NL_INTERFACE_RW interfaceRw;
|
||||
|
||||
PNDIS_RESTART_GENERAL_ATTRIBUTES NdisGeneralAttributes;
|
||||
PNDIS_RESTART_ATTRIBUTES NdisRestartAttributes;
|
||||
@@ -554,6 +557,28 @@ Return Value:
|
||||
//
|
||||
NdisGeneralAttributes->LookaheadSize = 128;
|
||||
}
|
||||
|
||||
key.Luid = pFilter->InterfaceLuid;
|
||||
NlInitializeInterfaceRw(&interfaceRw);
|
||||
interfaceRw.DadTransmits = 0;
|
||||
interfaceRw.SendUnsolicitedNeighborAdvertisementOnDad = FALSE;
|
||||
|
||||
NtStatus =
|
||||
NsiSetAllParameters(
|
||||
NsiActive,
|
||||
NsiSetDefault,
|
||||
&NPI_MS_IPV6_MODULEID,
|
||||
NlInterfaceObject,
|
||||
&key,
|
||||
sizeof(key),
|
||||
&interfaceRw,
|
||||
sizeof(interfaceRw));
|
||||
if (!NT_SUCCESS(NtStatus))
|
||||
{
|
||||
LogError(DRIVER_DEFAULT, "NsiSetAllParameters (NlInterfaceObject) failed, %!STATUS!", NtStatus);
|
||||
NdisStatus = NDIS_STATUS_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
//
|
||||
// Enable the data path
|
||||
@@ -567,6 +592,8 @@ Return Value:
|
||||
otLwfNotifyDeviceAvailabilityChange(pFilter, TRUE);
|
||||
LogInfo(DRIVER_DEFAULT, "Interface %!GUID! arrival, Filter=%p", &pFilter->InterfaceGuid, pFilter);
|
||||
|
||||
exit:
|
||||
|
||||
//
|
||||
// Ensure the state is Paused if restart failed.
|
||||
//
|
||||
|
||||
@@ -47,6 +47,17 @@ typedef enum _NSI_STORE {
|
||||
NsiBootFirmwareTable
|
||||
} NSI_STORE;
|
||||
|
||||
typedef enum _NSI_SET_ACTION {
|
||||
NsiSetDefault,
|
||||
NsiSetCreateOnly,
|
||||
NsiSetCreateOrSet,
|
||||
NsiSetDelete,
|
||||
NsiSetReset,
|
||||
NsiSetClear,
|
||||
NsiSetCreateOrSetWithReference,
|
||||
NsiSetDeleteWithReference,
|
||||
} NSI_SET_ACTION;
|
||||
|
||||
typedef enum _NSI_STRUCT_TYPE {
|
||||
NsiStructRw,
|
||||
NsiStructRoDynamic,
|
||||
@@ -54,6 +65,160 @@ typedef enum _NSI_STRUCT_TYPE {
|
||||
NsiMaximumStructType
|
||||
} NSI_STRUCT_TYPE;
|
||||
|
||||
typedef struct _NL_INTERFACE_KEY {
|
||||
IF_LUID Luid;
|
||||
} NL_INTERFACE_KEY, *PNL_INTERFACE_KEY;
|
||||
|
||||
typedef enum _NL_TYPE_OF_INTERFACE {
|
||||
InterfaceAllowAll = 0,
|
||||
InterfaceDisallowUnicast,
|
||||
InterfaceDisallowMulticast,
|
||||
InterfaceDisallowAll,
|
||||
InterfaceUnchanged = -1
|
||||
} NL_TYPE_OF_INTERFACE;
|
||||
|
||||
typedef enum _NL_DOMAIN_NETWORK_LOCATION {
|
||||
DomainNetworkLocationRemote = 0, // connect to a domain network remotely via DA i.e. outside corp network.
|
||||
DomainNetworkCategoryLink = 1, // connect to a domain network directly i.e. inside corp network.
|
||||
DomainNetworkUnchanged = -1
|
||||
} NL_DOMAIN_NETWORK_LOCATION;
|
||||
|
||||
typedef enum _NL_DOMAIN_TYPE {
|
||||
DomainTypeNonDomainNetwork = 0, // connected to non-domain network.
|
||||
DomainTypeDomainNetwork = 1, // connected to a network that has active directory.
|
||||
DomainTypeDomainAuthenticated = 2, // connected to AD network and machine is authenticated against it.
|
||||
DomainTypeUnchanged = -1
|
||||
} NL_DOMAIN_TYPE;
|
||||
|
||||
typedef enum _NL_INTERFACE_ECN_CAPABILITY {
|
||||
NlInterfaceEcnUnchanged = -1,
|
||||
NlInterfaceEcnDisabled = 0,
|
||||
NlInterfaceEcnUseEct1 = 1,
|
||||
NlInterfaceEcnUseEct0 = 2,
|
||||
NlInterfaceEcnAppDecide = 3
|
||||
} NL_INTERFACE_ECN_CAPABILITY, *PNL_INTERFACE_ECN_CAPABILITY;
|
||||
|
||||
typedef enum _NL_INTERNET_CONNECTIVITY_STATUS {
|
||||
NlNoInternetConnectivity,
|
||||
NlNoInternetDnsResolutionSucceeded,
|
||||
NlInternetConnectivityDetected,
|
||||
NlInternetConnectivityUnknown = -1
|
||||
} NL_INTERNET_CONNECTIVITY_STATUS, *PNL_INTERNET_CONNECTIVITY_STATUS;
|
||||
|
||||
typedef union _IP_ADDRESS_STORAGE {
|
||||
IN_ADDR Ipv4;
|
||||
IN6_ADDR Ipv6;
|
||||
UCHAR Buffer[sizeof(IN6_ADDR)];
|
||||
} IP_ADDRESS_STORAGE, *PIP_ADDRESS_STORAGE;
|
||||
|
||||
typedef struct _NL_INTERFACE_RW {
|
||||
BOOLEAN AdvertisingEnabled;
|
||||
BOOLEAN ForwardingEnabled;
|
||||
BOOLEAN MulticastForwardingEnabled;
|
||||
BOOLEAN WeakHostSend;
|
||||
BOOLEAN WeakHostReceive;
|
||||
BOOLEAN UseNeighborUnreachabilityDetection;
|
||||
BOOLEAN UseAutomaticMetric;
|
||||
BOOLEAN UseZeroBroadcastAddress;
|
||||
BOOLEAN UseBroadcastForRouterDiscovery;
|
||||
BOOLEAN DhcpRouterDiscoveryEnabled;
|
||||
BOOLEAN ManagedAddressConfigurationSupported;
|
||||
BOOLEAN OtherStatefulConfigurationSupported;
|
||||
BOOLEAN AdvertiseDefaultRoute;
|
||||
NL_NETWORK_CATEGORY NetworkCategory;
|
||||
NL_ROUTER_DISCOVERY_BEHAVIOR RouterDiscoveryBehavior;
|
||||
NL_TYPE_OF_INTERFACE TypeOfInterface;
|
||||
ULONG Metric;
|
||||
ULONG BaseReachableTime; // Base for random ReachableTime (in ms).
|
||||
ULONG RetransmitTime; // Neighbor Solicitation timeout (in ms).
|
||||
ULONG PathMtuDiscoveryTimeout; // Path MTU discovery timeout (in ms).
|
||||
ULONG DadTransmits; // DupAddrDetectTransmits in RFC 2462.
|
||||
NL_LINK_LOCAL_ADDRESS_BEHAVIOR LinkLocalAddressBehavior;
|
||||
ULONG LinkLocalAddressTimeout; // In ms.
|
||||
ULONG ZoneIndices[ScopeLevelCount]; // Zone part of a SCOPE_ID.
|
||||
ULONG NlMtu;
|
||||
ULONG SitePrefixLength;
|
||||
ULONG MulticastForwardingHopLimit;
|
||||
ULONG CurrentHopLimit;
|
||||
IP_ADDRESS_STORAGE LinkLocalAddress;
|
||||
BOOLEAN DisableDefaultRoutes;
|
||||
ULONG AdvertisedRouterLifetime;
|
||||
BOOLEAN SendUnsolicitedNeighborAdvertisementOnDad;
|
||||
BOOLEAN LimitedLinkConnectivity;
|
||||
BOOLEAN ForceARPNDPattern;
|
||||
BOOLEAN EnableDirectMACPattern;
|
||||
BOOLEAN EnableWol;
|
||||
BOOLEAN ForceTunneling;
|
||||
NL_DOMAIN_NETWORK_LOCATION DomainNetworkLocation;
|
||||
ULONGLONG RandomizedEpoch;
|
||||
NL_INTERFACE_ECN_CAPABILITY EcnCapability;
|
||||
NL_DOMAIN_TYPE DomainType;
|
||||
GUID NetworkSignature;
|
||||
NL_INTERNET_CONNECTIVITY_STATUS InternetConnectivityDetected;
|
||||
BOOLEAN ProxyDetected;
|
||||
ULONG DadRetransmitTime;
|
||||
BOOLEAN PrefixSharing;
|
||||
BOOLEAN DisableUnconstrainedRouteLookup;
|
||||
ULONG NetworkContext;
|
||||
BOOLEAN ResetAutoconfigurationOnOperStatusDown;
|
||||
BOOLEAN ClampMssEnabled;
|
||||
|
||||
} NL_INTERFACE_RW, *PNL_INTERFACE_RW;
|
||||
|
||||
__inline
|
||||
VOID
|
||||
NlInitializeInterfaceRw(
|
||||
IN OUT PNL_INTERFACE_RW Rw
|
||||
)
|
||||
{
|
||||
//
|
||||
// Initialize all fields to values that indicate "no change".
|
||||
//
|
||||
memset(Rw, 0xff, sizeof(*Rw));
|
||||
Rw->BaseReachableTime = 0;
|
||||
Rw->RetransmitTime = 0;
|
||||
Rw->PathMtuDiscoveryTimeout = 0;
|
||||
Rw->NlMtu = 0;
|
||||
Rw->DadRetransmitTime = 0;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
NlBestRouteObject,
|
||||
NlCompartmentForwardingObject,
|
||||
NlCompartmentObject,
|
||||
NlControlProtocolObject,
|
||||
NlEchoRequestObject,
|
||||
NlEchoSequenceRequestObject,
|
||||
NlGlobalObject,
|
||||
NlInterfaceObject,
|
||||
NlLocalAnycastAddressObject,
|
||||
NlLocalMulticastAddressObject,
|
||||
NlLocalUnicastAddressObject,
|
||||
NlNeighborObject,
|
||||
NlPathObject,
|
||||
NlPotentialRouterObject,
|
||||
NlPrefixPolicyObject,
|
||||
NlProxyNeighborObject,
|
||||
NlRouteObject,
|
||||
NlSitePrefixObject,
|
||||
NlSubInterfaceObject,
|
||||
NlWakeUpPatternObject,
|
||||
NlResolveNeighborObject,
|
||||
NlSortAddressesObject,
|
||||
NlMfeObject,
|
||||
NlMfeNotifyObject,
|
||||
NlInterfaceHopObject,
|
||||
NlInterfaceUnprivilegedObject,
|
||||
NlTunnelPhysicalInterfaceObject,
|
||||
NlLocalityObject,
|
||||
NlLocalityDataObject,
|
||||
NlLocalityPrivateObject,
|
||||
NlLocalBottleneckObject,
|
||||
NlTimerObject,
|
||||
NlDisconnectInterface,
|
||||
NlMaximumObject
|
||||
} NL_OBJECT_TYPE, *PNL_OBJECT_TYPE;
|
||||
|
||||
NSISTATUS
|
||||
NsiGetParameter(
|
||||
__in NSI_STORE Store,
|
||||
@@ -67,6 +232,18 @@ NsiGetParameter(
|
||||
__in ULONG ParameterOffset
|
||||
);
|
||||
|
||||
NSISTATUS
|
||||
NsiSetAllParameters(
|
||||
__in NSI_STORE Store,
|
||||
__in NSI_SET_ACTION Action,
|
||||
__in PNPI_MODULEID ModuleId,
|
||||
__in ULONG ObjectIndex,
|
||||
__in_bcount_opt(KeyStructLength) PVOID KeyStruct,
|
||||
__in ULONG KeyStructLength,
|
||||
__in_bcount_opt(RwParameterStructLength) PVOID RwParameterStruct,
|
||||
__in ULONG RwParameterStructLength
|
||||
);
|
||||
|
||||
extern CONST NPI_MODULEID NPI_MS_NDIS_MODULEID;
|
||||
|
||||
typedef enum _NDIS_NSI_OBJECT_INDEX
|
||||
|
||||
@@ -61,6 +61,8 @@ RtlCopyBufferToMdl(
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread.h>
|
||||
#include <openthread-ip6.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include <commissioning/commissioner.h>
|
||||
#include <commissioning/joiner.h>
|
||||
#include <common/code_utils.hpp>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <openthread.h>
|
||||
#include <openthread-tasklet.h>
|
||||
#include <platform/alarm.h>
|
||||
#include <platform/uart.h>
|
||||
|
||||
|
||||
+7
-3
@@ -60,10 +60,14 @@ PRETTY_SUBDIRS = \
|
||||
|
||||
include_HEADERS = \
|
||||
openthread.h \
|
||||
openthread-diag.h \
|
||||
openthread-crypto.h \
|
||||
openthread-types.h \
|
||||
openthread-coap.h \
|
||||
openthread-crypto.h \
|
||||
openthread-diag.h \
|
||||
openthread-ip6.h \
|
||||
openthread-message.h \
|
||||
openthread-tasklet.h \
|
||||
openthread-types.h \
|
||||
openthread-udp.h \
|
||||
$(NULL)
|
||||
|
||||
install-headers: install-includeHEADERS
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#ifndef OPENTHREAD_COMMISSIONER_H_
|
||||
#define OPENTHREAD_COMMISSIONER_H_
|
||||
|
||||
#include <platform/toolchain.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -54,7 +56,7 @@ extern "C" {
|
||||
* @retval kThreadError_None Successfully started the Commissioner role.
|
||||
*
|
||||
*/
|
||||
ThreadError otCommissionerStart(otInstance *aInstance);
|
||||
OTAPI ThreadError OTCALL otCommissionerStart(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function disables the Thread Commissioner role.
|
||||
@@ -64,7 +66,7 @@ ThreadError otCommissionerStart(otInstance *aInstance);
|
||||
* @retval kThreadError_None Successfully started the Commissioner role.
|
||||
*
|
||||
*/
|
||||
ThreadError otCommissionerStop(otInstance *aInstance);
|
||||
OTAPI ThreadError OTCALL otCommissionerStop(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function adds a Joiner entry.
|
||||
@@ -78,7 +80,8 @@ ThreadError otCommissionerStop(otInstance *aInstance);
|
||||
* @retval kThreadError_InvalidArgs @p aExtAddress or @p aPSKd is invalid.
|
||||
*
|
||||
*/
|
||||
ThreadError otCommissionerAddJoiner(otInstance *aInstance, const otExtAddress *aExtAddress, const char *aPSKd);
|
||||
OTAPI ThreadError OTCALL otCommissionerAddJoiner(otInstance *aInstance, const otExtAddress *aExtAddress,
|
||||
const char *aPSKd);
|
||||
|
||||
/**
|
||||
* This function removes a Joiner entry.
|
||||
@@ -91,7 +94,7 @@ ThreadError otCommissionerAddJoiner(otInstance *aInstance, const otExtAddress *a
|
||||
* @retval kThreadError_InvalidArgs @p aExtAddress is invalid.
|
||||
*
|
||||
*/
|
||||
ThreadError otCommissionerRemoveJoiner(otInstance *aIntsance, const otExtAddress *aExtAddress);
|
||||
OTAPI ThreadError OTCALL otCommissionerRemoveJoiner(otInstance *aIntsance, const otExtAddress *aExtAddress);
|
||||
|
||||
/**
|
||||
* This function sets the Provisioning URL.
|
||||
@@ -102,7 +105,7 @@ ThreadError otCommissionerRemoveJoiner(otInstance *aIntsance, const otExtAddress
|
||||
* @retval kThreadError_InvalidArgs @p aProvisioningUrl is invalid.
|
||||
*
|
||||
*/
|
||||
ThreadError otCommissionerSetProvisioningUrl(otInstance *aInstance, const char *aProvisioningUrl);
|
||||
OTAPI ThreadError OTCALL otCommissionerSetProvisioningUrl(otInstance *aInstance, const char *aProvisioningUrl);
|
||||
|
||||
/**
|
||||
* This function sends an Announce Begin message.
|
||||
@@ -117,8 +120,9 @@ ThreadError otCommissionerSetProvisioningUrl(otInstance *aInstance, const char *
|
||||
* @retval kThreadError_NoBufs Insufficient buffers to generate an Announce Begin message.
|
||||
*
|
||||
*/
|
||||
ThreadError otCommissionerAnnounceBegin(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod,
|
||||
const otIp6Address *aAddress);
|
||||
OTAPI ThreadError OTCALL otCommissionerAnnounceBegin(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount,
|
||||
uint16_t aPeriod,
|
||||
const otIp6Address *aAddress);
|
||||
|
||||
/**
|
||||
* This function pointer is called when the Commissioner receives an Energy Report.
|
||||
@@ -129,8 +133,8 @@ ThreadError otCommissionerAnnounceBegin(otInstance *aInstance, uint32_t aChannel
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (*otCommissionerEnergyReportCallback)(uint32_t aChannelMask, const uint8_t *aEnergyList,
|
||||
uint8_t aEnergyListLength, void *aContext);
|
||||
typedef void (OTCALL *otCommissionerEnergyReportCallback)(uint32_t aChannelMask, const uint8_t *aEnergyList,
|
||||
uint8_t aEnergyListLength, void *aContext);
|
||||
|
||||
/**
|
||||
* This function sends an Energy Scan Query message.
|
||||
@@ -148,9 +152,9 @@ typedef void (*otCommissionerEnergyReportCallback)(uint32_t aChannelMask, const
|
||||
* @retval kThreadError_NoBufs Insufficient buffers to generate an Energy Scan Query message.
|
||||
*
|
||||
*/
|
||||
ThreadError otCommissionerEnergyScan(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod,
|
||||
uint16_t aScanDuration, const otIp6Address *aAddress,
|
||||
otCommissionerEnergyReportCallback aCallback, void *aContext);
|
||||
OTAPI ThreadError OTCALL otCommissionerEnergyScan(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount,
|
||||
uint16_t aPeriod, uint16_t aScanDuration, const otIp6Address *aAddress,
|
||||
otCommissionerEnergyReportCallback aCallback, void *aContext);
|
||||
|
||||
/**
|
||||
* This function pointer is called when the Commissioner receives a PAN ID Conflict message.
|
||||
@@ -160,7 +164,7 @@ ThreadError otCommissionerEnergyScan(otInstance *aInstance, uint32_t aChannelMas
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (*otCommissionerPanIdConflictCallback)(uint16_t aPanId, uint32_t aChannelMask, void *aContext);
|
||||
typedef void (OTCALL *otCommissionerPanIdConflictCallback)(uint16_t aPanId, uint32_t aChannelMask, void *aContext);
|
||||
|
||||
/**
|
||||
* This function sends a PAN ID Query message.
|
||||
@@ -176,9 +180,9 @@ typedef void (*otCommissionerPanIdConflictCallback)(uint16_t aPanId, uint32_t aC
|
||||
* @retval kThreadError_NoBufs Insufficient buffers to generate a PAN ID Query message.
|
||||
*
|
||||
*/
|
||||
ThreadError otCommissionerPanIdQuery(otInstance *aInstance, uint16_t aPanId, uint32_t aChannelMask,
|
||||
const otIp6Address *aAddress,
|
||||
otCommissionerPanIdConflictCallback aCallback, void *aContext);
|
||||
OTAPI ThreadError OTCALL otCommissionerPanIdQuery(otInstance *aInstance, uint16_t aPanId, uint32_t aChannelMask,
|
||||
const otIp6Address *aAddress,
|
||||
otCommissionerPanIdConflictCallback aCallback, void *aContext);
|
||||
|
||||
/**
|
||||
* This function sends MGMT_COMMISSIONER_GET.
|
||||
@@ -191,7 +195,7 @@ ThreadError otCommissionerPanIdQuery(otInstance *aInstance, uint16_t aPanId, uin
|
||||
* @retval kThreadError_NoBufs Insufficient buffer space to send.
|
||||
*
|
||||
*/
|
||||
ThreadError otSendMgmtCommissionerGet(otInstance *, const uint8_t *aTlvs, uint8_t aLength);
|
||||
OTAPI ThreadError OTCALL otSendMgmtCommissionerGet(otInstance *, const uint8_t *aTlvs, uint8_t aLength);
|
||||
|
||||
/**
|
||||
* This function sends MGMT_COMMISSIONER_SET.
|
||||
@@ -205,8 +209,8 @@ ThreadError otSendMgmtCommissionerGet(otInstance *, const uint8_t *aTlvs, uint8_
|
||||
* @retval kThreadError_NoBufs Insufficient buffer space to send.
|
||||
*
|
||||
*/
|
||||
ThreadError otSendMgmtCommissionerSet(otInstance *, const otCommissioningDataset *aDataset,
|
||||
const uint8_t *aTlvs, uint8_t aLength);
|
||||
OTAPI ThreadError OTCALL otSendMgmtCommissionerSet(otInstance *, const otCommissioningDataset *aDataset,
|
||||
const uint8_t *aTlvs, uint8_t aLength);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#ifndef OPENTHREAD_JOINER_H_
|
||||
#define OPENTHREAD_JOINER_H_
|
||||
|
||||
#include <platform/toolchain.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -57,7 +59,7 @@ extern "C" {
|
||||
* @retval kThreadError_InvalidArgs @p aPSKd or @p aProvisioningUrl is invalid.
|
||||
*
|
||||
*/
|
||||
ThreadError otJoinerStart(otInstance *aInstance, const char *aPSKd, const char *aProvisioningUrl);
|
||||
OTAPI ThreadError OTCALL otJoinerStart(otInstance *aInstance, const char *aPSKd, const char *aProvisioningUrl);
|
||||
|
||||
/**
|
||||
* This function disables the Thread Joiner role.
|
||||
@@ -65,7 +67,7 @@ ThreadError otJoinerStart(otInstance *aInstance, const char *aPSKd, const char *
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
*/
|
||||
ThreadError otJoinerStop(otInstance *aInstance);
|
||||
OTAPI ThreadError OTCALL otJoinerStop(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* 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 top-level ip6 functions for the OpenThread library.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_IP6_H_
|
||||
#define OPENTHREAD_IP6_H_
|
||||
|
||||
#include <openthread-message.h>
|
||||
#include <platform/radio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup api API
|
||||
* @brief
|
||||
* This module includes the application programming interface to the OpenThread stack.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup execution Execution
|
||||
* @defgroup commands Commands
|
||||
* @defgroup config Configuration
|
||||
* @defgroup diags Diagnostics
|
||||
* @defgroup messages Message Buffers
|
||||
* @defgroup ip6 IPv6
|
||||
* @defgroup udp UDP
|
||||
* @defgroup coap CoAP
|
||||
*
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup diags Diagnostics
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that expose internal state.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function pointer is called when an IEEE 802.15.4 frame is received.
|
||||
*
|
||||
* @note This callback is called after FCS processing and @p aFrame may not contain the actual FCS that was received.
|
||||
*
|
||||
* @note This callback is called before IEEE 802.15.4 security processing and mSecurityValid in @p aFrame will
|
||||
* always be false.
|
||||
*
|
||||
* @param[in] aFrame A pointer to the received IEEE 802.15.4 frame.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (*otLinkPcapCallback)(const RadioPacket *aFrame, void *aContext);
|
||||
|
||||
/**
|
||||
* This function registers a callback to provide received raw IEEE 802.15.4 frames.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPcapCallback A pointer to a function that is called when receiving an IEEE 802.15.4 link frame or
|
||||
* NULL to disable the callback.
|
||||
* @param[in] aCallbackContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
void otSetLinkPcapCallback(otInstance *aInstance, otLinkPcapCallback aPcapCallback, void *aCallbackContext);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not promiscuous mode is enabled at the link layer.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval true Promiscuous mode is enabled.
|
||||
* @retval false Promiscuous mode is not enabled.
|
||||
*
|
||||
*/
|
||||
bool otIsLinkPromiscuous(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function enables or disables the link layer promiscuous mode.
|
||||
*
|
||||
* @note Promiscuous mode may only be enabled when the Thread interface is disabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPromiscuous true to enable promiscuous mode, or false otherwise.
|
||||
*
|
||||
* @retval kThreadError_None Successfully enabled promiscuous mode.
|
||||
* @retval kThreadError_InvalidState Could not enable promiscuous mode because
|
||||
* the Thread interface is enabled.
|
||||
*
|
||||
*/
|
||||
ThreadError otSetLinkPromiscuous(otInstance *aInstance, bool aPromiscuous);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup ip6 IPv6
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that control IPv6 communication.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allocate a new message buffer for sending an IPv6 message.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aLinkSecurityEnabled TRUE if the message should be secured at Layer 2
|
||||
*
|
||||
* @returns A pointer to the message buffer or NULL if no message buffers are available.
|
||||
*
|
||||
* @sa otFreeMessage
|
||||
*/
|
||||
otMessage otNewIp6Message(otInstance *aInstance, bool aLinkSecurityEnabled);
|
||||
|
||||
/**
|
||||
* This function pointer is called when an IPv6 datagram is received.
|
||||
*
|
||||
* @param[in] aMessage A pointer to the message buffer containing the received IPv6 datagram.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (*otReceiveIp6DatagramCallback)(otMessage aMessage, void *aContext);
|
||||
|
||||
/**
|
||||
* This function registers a callback to provide received IPv6 datagrams.
|
||||
*
|
||||
* By default, this callback does not pass Thread control traffic. See otSetReceiveIp6DatagramFilterEnabled() to
|
||||
* change the Thread control traffic filter setting.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aCallback A pointer to a function that is called when an IPv6 datagram is received or
|
||||
* NULL to disable the callback.
|
||||
* @param[in] aCallbackContext A pointer to application-specific context.
|
||||
*
|
||||
* @sa otIsReceiveIp6DatagramFilterEnabled
|
||||
* @sa otSetReceiveIp6DatagramFilterEnabled
|
||||
*
|
||||
*/
|
||||
void otSetReceiveIp6DatagramCallback(otInstance *aInstance, otReceiveIp6DatagramCallback aCallback,
|
||||
void *aCallbackContext);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not Thread control traffic is filtered out when delivering IPv6 datagrams
|
||||
* via the callback specified in otSetReceiveIp6DatagramCallback().
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns TRUE if Thread control traffic is filtered out, FALSE otherwise.
|
||||
*
|
||||
* @sa otSetReceiveIp6DatagramCallback
|
||||
* @sa otSetReceiveIp6DatagramFilterEnabled
|
||||
*
|
||||
*/
|
||||
bool otIsReceiveIp6DatagramFilterEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets whether or not Thread control traffic is filtered out when delivering IPv6 datagrams
|
||||
* via the callback specified in otSetReceiveIp6DatagramCallback().
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled TRUE if Thread control traffic is filtered out, FALSE otherwise.
|
||||
*
|
||||
* @sa otSetReceiveIp6DatagramCallback
|
||||
* @sa otIsReceiveIp6DatagramFilterEnabled
|
||||
*
|
||||
*/
|
||||
void otSetReceiveIp6DatagramFilterEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* This function sends an IPv6 datagram via the Thread interface.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aMessage A pointer to the message buffer containing the IPv6 datagram.
|
||||
*
|
||||
*/
|
||||
ThreadError otSendIp6Datagram(otInstance *aInstance, otMessage aMessage);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not ICMPv6 Echo processing is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval TRUE ICMPv6 Echo processing is enabled.
|
||||
* @retval FALSE ICMPv6 Echo processing is disabled.
|
||||
*
|
||||
*/
|
||||
bool otIsIcmpEchoEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets whether or not ICMPv6 Echo processing is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled TRUE to enable ICMPv6 Echo processing, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
void otSetIcmpEchoEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_IP6_H_
|
||||
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* 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 top-level ip6 functions for the OpenThread library.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_MESSAGE_H_
|
||||
#define OPENTHREAD_MESSAGE_H_
|
||||
|
||||
#include <openthread-types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup api API
|
||||
* @brief
|
||||
* This module includes the application programming interface to the OpenThread stack.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup execution Execution
|
||||
* @defgroup commands Commands
|
||||
* @defgroup config Configuration
|
||||
* @defgroup diags Diagnostics
|
||||
* @defgroup messages Message Buffers
|
||||
* @defgroup ip6 IPv6
|
||||
* @defgroup udp UDP
|
||||
* @defgroup coap CoAP
|
||||
*
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup messages Message Buffers
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that manipulate OpenThread message buffers
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Free an allocated message buffer.
|
||||
*
|
||||
* @param[in] aMessage A pointer to a message buffer.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully freed the message buffer.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otAppendMessage
|
||||
* @sa otGetMessageLength
|
||||
* @sa otSetMessageLength
|
||||
* @sa otGetMessageOffset
|
||||
* @sa otSetMessageOffset
|
||||
* @sa otReadMessage
|
||||
* @sa otWriteMessage
|
||||
*/
|
||||
ThreadError otFreeMessage(otMessage aMessage);
|
||||
|
||||
/**
|
||||
* Get the message length in bytes.
|
||||
*
|
||||
* @param[in] aMessage A pointer to a message buffer.
|
||||
*
|
||||
* @returns The message length in bytes.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otFreeMessage
|
||||
* @sa otAppendMessage
|
||||
* @sa otSetMessageLength
|
||||
* @sa otGetMessageOffset
|
||||
* @sa otSetMessageOffset
|
||||
* @sa otReadMessage
|
||||
* @sa otWriteMessage
|
||||
* @sa otSetMessageLength
|
||||
*/
|
||||
uint16_t otGetMessageLength(otMessage aMessage);
|
||||
|
||||
/**
|
||||
* Set the message length in bytes.
|
||||
*
|
||||
* @param[in] aMessage A pointer to a message buffer.
|
||||
* @param[in] aLength A length in bytes.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully set the message length.
|
||||
* @retval kThreadErrorNoBufs No available buffers to grow the message.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otFreeMessage
|
||||
* @sa otAppendMessage
|
||||
* @sa otGetMessageLength
|
||||
* @sa otGetMessageOffset
|
||||
* @sa otSetMessageOffset
|
||||
* @sa otReadMessage
|
||||
* @sa otWriteMessage
|
||||
*/
|
||||
ThreadError otSetMessageLength(otMessage aMessage, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* Get the message offset in bytes.
|
||||
*
|
||||
* @param[in] aMessage A pointer to a message buffer.
|
||||
*
|
||||
* @returns The message offset value.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otFreeMessage
|
||||
* @sa otAppendMessage
|
||||
* @sa otGetMessageLength
|
||||
* @sa otSetMessageLength
|
||||
* @sa otSetMessageOffset
|
||||
* @sa otReadMessage
|
||||
* @sa otWriteMessage
|
||||
*/
|
||||
uint16_t otGetMessageOffset(otMessage aMessage);
|
||||
|
||||
/**
|
||||
* Set the message offset in bytes.
|
||||
*
|
||||
* @param[in] aMessage A pointer to a message buffer.
|
||||
* @param[in] aOffset An offset in bytes.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully set the message offset.
|
||||
* @retval kThreadErrorInvalidArg The offset is beyond the message length.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otFreeMessage
|
||||
* @sa otAppendMessage
|
||||
* @sa otGetMessageLength
|
||||
* @sa otSetMessageLength
|
||||
* @sa otGetMessageOffset
|
||||
* @sa otReadMessage
|
||||
* @sa otWriteMessage
|
||||
*/
|
||||
ThreadError otSetMessageOffset(otMessage aMessage, uint16_t aOffset);
|
||||
|
||||
/**
|
||||
* Append bytes to a message.
|
||||
*
|
||||
* @param[in] aMessage A pointer to a message buffer.
|
||||
* @param[in] aBuf A pointer to the data to append.
|
||||
* @param[in] aLength Number of bytes to append.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully appended to the message
|
||||
* @retval kThreadErrorNoBufs No available buffers to grow the message.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otFreeMessage
|
||||
* @sa otGetMessageLength
|
||||
* @sa otSetMessageLength
|
||||
* @sa otGetMessageOffset
|
||||
* @sa otSetMessageOffset
|
||||
* @sa otReadMessage
|
||||
* @sa otWriteMessage
|
||||
*/
|
||||
ThreadError otAppendMessage(otMessage aMessage, const void *aBuf, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* Read bytes from a message.
|
||||
*
|
||||
* @param[in] aMessage A pointer to a message buffer.
|
||||
* @param[in] aOffset An offset in bytes.
|
||||
* @param[in] aBuf A pointer to a buffer that message bytes are read to.
|
||||
* @param[in] aLength Number of bytes to read.
|
||||
*
|
||||
* @returns The number of bytes read.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otFreeMessage
|
||||
* @sa otAppendMessage
|
||||
* @sa otGetMessageLength
|
||||
* @sa otSetMessageLength
|
||||
* @sa otGetMessageOffset
|
||||
* @sa otSetMessageOffset
|
||||
* @sa otWriteMessage
|
||||
*/
|
||||
int otReadMessage(otMessage aMessage, uint16_t aOffset, void *aBuf, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* Write bytes to a message.
|
||||
*
|
||||
* @param[in] aMessage A pointer to a message buffer.
|
||||
* @param[in] aOffset An offset in bytes.
|
||||
* @param[in] aBuf A pointer to a buffer that message bytes are written from.
|
||||
* @param[in] aLength Number of bytes to write.
|
||||
*
|
||||
* @returns The number of bytes written.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otFreeMessage
|
||||
* @sa otAppendMessage
|
||||
* @sa otGetMessageLength
|
||||
* @sa otSetMessageLength
|
||||
* @sa otGetMessageOffset
|
||||
* @sa otSetMessageOffset
|
||||
* @sa otReadMessage
|
||||
*/
|
||||
int otWriteMessage(otMessage aMessage, uint16_t aOffset, const void *aBuf, uint16_t aLength);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_MESSAGE_H_
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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 includes the platform abstraction for the tasklet service.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_TASKLET_H_
|
||||
#define OPENTHREAD_TASKLET_H_
|
||||
|
||||
#include <openthread-types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup execution Execution
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that control the Thread stack's execution.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Run all queued OpenThread tasklets at the time this is called.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*/
|
||||
void otProcessQueuedTasklets(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Indicates whether or not OpenThread has tasklets pending.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval TRUE If there are tasklets pending.
|
||||
* @retval FALSE If there are no tasklets pending.
|
||||
*/
|
||||
bool otAreTaskletsPending(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* OpenThread calls this function when the tasklet queue transitions from empty to non-empty.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
*/
|
||||
extern void otSignalTaskletPending(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_TASKLET_H_
|
||||
@@ -37,6 +37,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#ifdef OTDLL
|
||||
#include <guiddef.h>
|
||||
#endif
|
||||
|
||||
#include <platform/toolchain.h>
|
||||
|
||||
@@ -61,14 +64,32 @@ extern "C" {
|
||||
#define myoffsetof(s,m) (((size_t)&(((s*)BASE)->m))-BASE)
|
||||
#define CONTAINING_RECORD(address, type, field) \
|
||||
((type *)((uint8_t*)(address) - myoffsetof(type, field)))
|
||||
#endif
|
||||
#endif
|
||||
#endif /* CONTAINING_RECORD */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/**
|
||||
* This type represents the OpenThread instance structure.
|
||||
*/
|
||||
typedef struct otInstance otInstance;
|
||||
|
||||
#ifdef OTDLL
|
||||
|
||||
/**
|
||||
* This type represents the handle to the OpenThread API.
|
||||
*/
|
||||
typedef struct otApiInstance otApiInstance;
|
||||
|
||||
/**
|
||||
* This type represents a list of device GUIDs.
|
||||
*/
|
||||
typedef struct otDeviceList
|
||||
{
|
||||
uint16_t aDevicesLength;
|
||||
GUID aDevices[1];
|
||||
} otDeviceList;
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This enumeration represents error codes used throughout OpenThread.
|
||||
*/
|
||||
@@ -489,6 +510,7 @@ typedef enum otMeshcopTlvType
|
||||
/**
|
||||
* This structure represents an MLE Link Mode configuration.
|
||||
*/
|
||||
OT_TOOL_ALIGN(4)
|
||||
typedef struct otLinkModeConfig
|
||||
{
|
||||
/**
|
||||
@@ -709,6 +731,7 @@ typedef struct otMacBlacklistEntry
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
kDeviceRoleOffline, ///< The Thread device is offline and unavailable.
|
||||
kDeviceRoleDisabled, ///< The Thread stack is disabled.
|
||||
kDeviceRoleDetached, ///< Not currently participating in a Thread network/partition.
|
||||
kDeviceRoleChild, ///< The Thread Child role.
|
||||
@@ -764,6 +787,7 @@ typedef struct
|
||||
* This structure holds diagnostic information for a Thread Router
|
||||
*
|
||||
*/
|
||||
OT_TOOL_ALIGN(4)
|
||||
typedef struct
|
||||
{
|
||||
otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* 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 top-level ip6 functions for the OpenThread library.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_UDP_H_
|
||||
#define OPENTHREAD_UDP_H_
|
||||
|
||||
#include <openthread-message.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup api API
|
||||
* @brief
|
||||
* This module includes the application programming interface to the OpenThread stack.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup execution Execution
|
||||
* @defgroup commands Commands
|
||||
* @defgroup config Configuration
|
||||
* @defgroup diags Diagnostics
|
||||
* @defgroup messages Message Buffers
|
||||
* @defgroup ip6 IPv6
|
||||
* @defgroup udp UDP
|
||||
* @defgroup coap CoAP
|
||||
*
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup udp UDP
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that control UDP communication.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allocate a new message buffer for sending a UDP message.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aLinkSecurityEnabled TRUE if the message should be secured at Layer 2.
|
||||
*
|
||||
* @returns A pointer to the message buffer or NULL if no message buffers are available.
|
||||
*
|
||||
* @sa otFreeMessage
|
||||
*/
|
||||
otMessage otNewUdpMessage(otInstance *aInstance, bool aLinkSecurityEnabled);
|
||||
|
||||
/**
|
||||
* Open a UDP/IPv6 socket.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aSocket A pointer to a UDP socket structure.
|
||||
* @param[in] aCallback A pointer to the application callback function.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully opened the socket.
|
||||
* @retval kThreadErrorInvalidArgs Given socket structure was already opened.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otCloseUdpSocket
|
||||
* @sa otBindUdpSocket
|
||||
* @sa otSendUdp
|
||||
*/
|
||||
ThreadError otOpenUdpSocket(otInstance *aInstance, otUdpSocket *aSocket, otUdpReceive aCallback, void *aContext);
|
||||
|
||||
/**
|
||||
* Close a UDP/IPv6 socket.
|
||||
*
|
||||
* @param[in] aSocket A pointer to a UDP socket structure.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully closed the socket.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otOpenUdpSocket
|
||||
* @sa otBindUdpSocket
|
||||
* @sa otSendUdp
|
||||
*/
|
||||
ThreadError otCloseUdpSocket(otUdpSocket *aSocket);
|
||||
|
||||
/**
|
||||
* Bind a UDP/IPv6 socket.
|
||||
*
|
||||
* @param[in] aSocket A pointer to a UDP socket structure.
|
||||
* @param[in] aSockName A pointer to an IPv6 socket address structure.
|
||||
*
|
||||
* @retval kThreadErrorNone Bind operation was successful.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otOpenUdpSocket
|
||||
* @sa otCloseUdpSocket
|
||||
* @sa otSendUdp
|
||||
*/
|
||||
ThreadError otBindUdpSocket(otUdpSocket *aSocket, otSockAddr *aSockName);
|
||||
|
||||
/**
|
||||
* Send a UDP/IPv6 message.
|
||||
*
|
||||
* @param[in] aSocket A pointer to a UDP socket structure.
|
||||
* @param[in] aMessage A pointer to a message buffer.
|
||||
* @param[in] aMessageInfo A pointer to a message info structure.
|
||||
*
|
||||
* @sa otNewUdpMessage
|
||||
* @sa otOpenUdpSocket
|
||||
* @sa otCloseUdpSocket
|
||||
* @sa otBindUdpSocket
|
||||
* @sa otSendUdp
|
||||
*/
|
||||
ThreadError otSendUdp(otUdpSocket *aSocket, otMessage aMessage, const otMessageInfo *aMessageInfo);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_UDP_H_
|
||||
+268
-618
File diff suppressed because it is too large
Load Diff
@@ -96,6 +96,8 @@ extern "C" {
|
||||
#define OT_TOOL_PACKED_FIELD __attribute__((packed))
|
||||
#define OT_TOOL_PACKED_END __attribute__((packed))
|
||||
|
||||
#define OT_TOOL_ALIGN(X)
|
||||
|
||||
#elif defined(__ICCARM__) || defined(__ICC8051__)
|
||||
|
||||
// http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf
|
||||
@@ -106,12 +108,16 @@ extern "C" {
|
||||
#define OT_TOOL_PACKED_FIELD
|
||||
#define OT_TOOL_PACKED_END
|
||||
|
||||
#define OT_TOOL_ALIGN(X)
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#define OT_TOOL_PACKED_BEGIN __pragma(pack(push,1))
|
||||
#define OT_TOOL_PACKED_FIELD
|
||||
#define OT_TOOL_PACKED_END __pragma(pack(pop))
|
||||
|
||||
#define OT_TOOL_ALIGN(X) __declspec(align(4))
|
||||
|
||||
#elif defined(__SDCC)
|
||||
|
||||
// Structures are packed by default in sdcc, as it primarily targets 8-bit MCUs.
|
||||
@@ -120,6 +126,8 @@ extern "C" {
|
||||
#define OT_TOOL_PACKED_FIELD
|
||||
#define OT_TOOL_PACKED_END
|
||||
|
||||
#define OT_TOOL_ALIGN(X)
|
||||
|
||||
#else
|
||||
|
||||
#error "Error: No valid Toolchain specified"
|
||||
@@ -130,6 +138,8 @@ extern "C" {
|
||||
#define OT_TOOL_PACKED_FIELD
|
||||
#define OT_TOOL_PACKED_END
|
||||
|
||||
#define OT_TOOL_ALIGN(X)
|
||||
|
||||
#endif
|
||||
|
||||
// =========== TOOLCHAIN SELECTION : END ===========
|
||||
@@ -137,10 +147,8 @@ extern "C" {
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#ifdef _WIN64
|
||||
#define OT_CALL
|
||||
#define OT_CDECL
|
||||
#else
|
||||
#define OT_CALL __stdcall
|
||||
#define OT_CDECL __cdecl
|
||||
#endif
|
||||
|
||||
@@ -151,6 +159,16 @@ extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef OTDLL
|
||||
#ifndef OTAPI
|
||||
#define OTAPI __declspec(dllimport)
|
||||
#endif
|
||||
#define OTCALL WINAPI
|
||||
#else
|
||||
#define OTAPI
|
||||
#define OTCALL
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
@@ -2033,6 +2033,10 @@ void Interpreter::ProcessState(int argc, char *argv[])
|
||||
{
|
||||
switch (otGetDeviceRole(mInstance))
|
||||
{
|
||||
case kDeviceRoleOffline:
|
||||
sServer->OutputFormat("offline\r\n");
|
||||
break;
|
||||
|
||||
case kDeviceRoleDisabled:
|
||||
sServer->OutputFormat("disabled\r\n");
|
||||
break;
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <openthread-ip6.h>
|
||||
#include <openthread-udp.h>
|
||||
#include <cli/cli_server.hpp>
|
||||
#include <net/icmp6.hpp>
|
||||
#include <common/timer.hpp>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#define TASKLET_HPP_
|
||||
|
||||
#include <openthread-types.h>
|
||||
#include <openthread-tasklet.h>
|
||||
|
||||
namespace Thread {
|
||||
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <openthread-types.h>
|
||||
#include <openthread-ip6.h>
|
||||
#include <openthread-udp.h>
|
||||
#include <common/encoding.hpp>
|
||||
#include <common/message.hpp>
|
||||
#include <net/icmp6.hpp>
|
||||
|
||||
@@ -1728,6 +1728,7 @@ ThreadError NcpBase::GetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key
|
||||
|
||||
switch (otGetDeviceRole(mInstance))
|
||||
{
|
||||
case kDeviceRoleOffline:
|
||||
case kDeviceRoleDisabled:
|
||||
case kDeviceRoleDetached:
|
||||
role = SPINEL_NET_ROLE_DETACHED;
|
||||
|
||||
Reference in New Issue
Block a user