DHCPv6 Client and Server API cleanup.

This commit is contained in:
Jonathan Hui
2017-03-02 10:24:55 -08:00
parent e972443845
commit 669c792118
17 changed files with 79 additions and 65 deletions
-1
View File
@@ -1080,7 +1080,6 @@ AC_CONFIG_FILES([
Makefile
include/Makefile
include/cli/Makefile
include/dhcp6/Makefile
include/ncp/Makefile
include/openthread/Makefile
include/platform/Makefile
+1
View File
@@ -56,6 +56,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\core\api\commissioner_api.cpp" />
<ClCompile Include="..\..\src\core\api\dhcp6_api.cpp" />
<ClCompile Include="..\..\src\core\api\joiner_api.cpp" />
<ClCompile Include="..\..\src\core\api\link_raw_api.cpp" />
<ClCompile Include="..\..\src\core\api\message_api.cpp" />
@@ -63,6 +63,9 @@
<ClCompile Include="..\..\src\core\api\commissioner_api.cpp">
<Filter>Source Files\api</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\api\dhcp6_api.cpp">
<Filter>Source Files\api</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\api\joiner_api.cpp">
<Filter>Source Files\api</Filter>
</ClCompile>
@@ -65,6 +65,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\core\api\commissioner_api.cpp" />
<ClCompile Include="..\..\src\core\api\dhcp6_api.cpp" />
<ClCompile Include="..\..\src\core\api\joiner_api.cpp" />
<ClCompile Include="..\..\src\core\api\message_api.cpp" />
<ClCompile Include="..\..\src\core\api\tasklet_api.cpp" />
@@ -63,6 +63,9 @@
<ClCompile Include="..\..\src\core\api\commissioner_api.cpp">
<Filter>Source Files\api</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\api\dhcp6_api.cpp">
<Filter>Source Files\api</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\api\joiner_api.cpp">
<Filter>Source Files\api</Filter>
</ClCompile>
+2 -2
View File
@@ -67,8 +67,8 @@ RtlCopyBufferToMdl(
#include <openthread/tasklet.h>
#include <openthread/commissioner.h>
#include <openthread/joiner.h>
#include <dhcp6/dhcp6_server.h>
#include <dhcp6/dhcp6_client.h>
#include <openthread/dhcp6_server.h>
#include <openthread/dhcp6_client.h>
#include <common/code_utils.hpp>
#include <platform/logging.h>
#include <platform/logging-windows.h>
-3
View File
@@ -32,7 +32,6 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
DIST_SUBDIRS = \
cli \
dhcp6 \
ncp \
openthread \
platform \
@@ -42,7 +41,6 @@ DIST_SUBDIRS = \
SUBDIRS = \
cli \
dhcp6 \
ncp \
openthread \
platform \
@@ -52,7 +50,6 @@ SUBDIRS = \
PRETTY_SUBDIRS = \
cli \
dhcp6 \
ncp \
openthread \
platform \
-41
View File
@@ -1,41 +0,0 @@
#
# 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 $(abs_top_nlbuild_autotools_dir)/automake/pre.am
ot_dhcp6_headers = \
dhcp6_client.h \
dhcp6_server.h \
$(NULL)
ot_dhcp6dir = $(includedir)/dhcp6
dist_ot_dhcp6_HEADERS = $(ot_dhcp6_headers)
install-headers: install-includeHEADERS
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
+2
View File
@@ -32,6 +32,8 @@ openthread_headers = \
coap.h \
commissioner.h \
crypto.h \
dhcp6_client.h \
dhcp6_server.h \
jam_detection.h \
joiner.h \
message.h \
+2 -2
View File
@@ -56,8 +56,8 @@
#include <common/new.hpp>
#include <net/ip6.hpp>
#include <dhcp6/dhcp6_server.h>
#include <dhcp6/dhcp6_client.h>
#include "openthread/dhcp6_client.h"
#include "openthread/dhcp6_server.h"
#include <platform/uart.h>
#endif
+1 -1
View File
@@ -51,7 +51,7 @@
#ifndef OTDLL
#include <net/icmp6.hpp>
#include <common/timer.hpp>
#include <dhcp6/dhcp6_client.h>
#include "openthread/dhcp6_client.h"
#endif
#ifdef OTDLL
+2
View File
@@ -129,12 +129,14 @@ endif # OPENTHREAD_ENABLE_DTLS
if OPENTHREAD_ENABLE_DHCP6_CLIENT
SOURCES_COMMON += \
api/dhcp6_api.cpp \
net/dhcp6_client.cpp \
$(NULL)
endif # OPENTHREAD_ENABLE_DHCP6_CLIENT
if OPENTHREAD_ENABLE_DHCP6_SERVER
SOURCES_COMMON += \
api/dhcp6_api.cpp \
net/dhcp6_server.cpp \
$(NULL)
endif # OPENTHREAD_ENABLE_DHCP6_SERVER
+61
View File
@@ -0,0 +1,61 @@
/*
* 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
* This file implements the OpenThread UDP API.
*/
#include "openthread/dhcp6_client.h"
#include "openthread/dhcp6_server.h"
#include "openthread-instance.h"
using namespace Thread;
#ifdef __cplusplus
extern "C" {
#endif
#if OPENTHREAD_ENABLE_DHCP6_CLIENT
void otDhcp6ClientUpdate(otInstance *aInstance, otDhcpAddress *aAddresses, uint32_t aNumAddresses, void *aContext)
{
aInstance->mThreadNetif.GetDhcp6Client().UpdateAddresses(aInstance, aAddresses, aNumAddresses, aContext);
}
#endif // OPENTHREAD_ENABLE_DHCP6_CLIENT
#if OPENTHREAD_ENABLE_DHCP6_SERVER
void otDhcp6ServerUpdate(otInstance *aInstance)
{
aInstance->mThreadNetif.GetDhcp6Server().UpdateService();
}
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER
#ifdef __cplusplus
} // extern "C"
#endif
+1 -1
View File
@@ -34,7 +34,7 @@
#ifndef DHCP6_CLIENT_HPP_
#define DHCP6_CLIENT_HPP_
#include <dhcp6/dhcp6_client.h>
#include "openthread/dhcp6_client.h"
#include <common/message.hpp>
#include <common/timer.hpp>
-14
View File
@@ -976,20 +976,6 @@ ThreadError otRemoveUnicastAddress(otInstance *aInstance, const otIp6Address *ad
return aInstance->mThreadNetif.RemoveExternalUnicastAddress(*static_cast<const Ip6::Address *>(address));
}
#if OPENTHREAD_ENABLE_DHCP6_SERVER
void otDhcp6ServerUpdate(otInstance *aInstance)
{
aInstance->mThreadNetif.GetDhcp6Server().UpdateService();
}
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER
#if OPENTHREAD_ENABLE_DHCP6_CLIENT
void otDhcp6ClientUpdate(otInstance *aInstance, otDhcpAddress *aAddresses, uint32_t aNumAddresses, void *aContext)
{
aInstance->mThreadNetif.GetDhcp6Client().UpdateAddresses(aInstance, aAddresses, aNumAddresses, aContext);
}
#endif // OPENTHREAD_ENABLE_DHCP6_CLIENT
const otNetifMulticastAddress *otGetMulticastAddresses(otInstance *aInstance)
{
return aInstance->mThreadNetif.GetMulticastAddresses();