diff --git a/etc/visual-studio/libopenthread.vcxproj b/etc/visual-studio/libopenthread.vcxproj index f63d45be7..4b36dc31d 100644 --- a/etc/visual-studio/libopenthread.vcxproj +++ b/etc/visual-studio/libopenthread.vcxproj @@ -58,6 +58,7 @@ + diff --git a/etc/visual-studio/libopenthread.vcxproj.filters b/etc/visual-studio/libopenthread.vcxproj.filters index 277b82efe..002f292b5 100644 --- a/etc/visual-studio/libopenthread.vcxproj.filters +++ b/etc/visual-studio/libopenthread.vcxproj.filters @@ -69,6 +69,9 @@ Source Files\api + + Source Files\api + Source Files\api diff --git a/etc/visual-studio/libopenthread_k.vcxproj b/etc/visual-studio/libopenthread_k.vcxproj index 3efb46e3d..46c70cb82 100644 --- a/etc/visual-studio/libopenthread_k.vcxproj +++ b/etc/visual-studio/libopenthread_k.vcxproj @@ -67,6 +67,7 @@ + diff --git a/etc/visual-studio/libopenthread_k.vcxproj.filters b/etc/visual-studio/libopenthread_k.vcxproj.filters index 262fa01e9..93fd33b83 100644 --- a/etc/visual-studio/libopenthread_k.vcxproj.filters +++ b/etc/visual-studio/libopenthread_k.vcxproj.filters @@ -69,6 +69,9 @@ Source Files\api + + Source Files\api + Source Files\api diff --git a/examples/drivers/windows/otLwf/precomp.h b/examples/drivers/windows/otLwf/precomp.h index a5831e2d3..40a16c5a6 100644 --- a/examples/drivers/windows/otLwf/precomp.h +++ b/examples/drivers/windows/otLwf/precomp.h @@ -62,7 +62,7 @@ RtlCopyBufferToMdl( #include #include #include -#include +#include #include #include #include diff --git a/include/Makefile.am b/include/Makefile.am index 4783557d6..de63bebb6 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -46,10 +46,6 @@ PRETTY_SUBDIRS = \ openthread \ $(NULL) -include_HEADERS = \ - openthread-icmp6.h \ - $(NULL) - install-headers: install-includeHEADERS include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/include/openthread/Makefile.am b/include/openthread/Makefile.am index 1af8acb5a..2bc0a06ba 100644 --- a/include/openthread/Makefile.am +++ b/include/openthread/Makefile.am @@ -55,6 +55,7 @@ openthread_headers = \ diag.h \ dhcp6_client.h \ dhcp6_server.h \ + icmp6.h \ instance.h \ ip6.h \ jam_detection.h \ diff --git a/include/openthread-icmp6.h b/include/openthread/icmp6.h similarity index 100% rename from include/openthread-icmp6.h rename to include/openthread/icmp6.h diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 993b9e0a8..8f478878c 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -52,7 +52,7 @@ #ifndef OTDLL #include #include "openthread/diag.h" -#include +#include "openthread/icmp6.h" #include #include diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 1b1f1b881..086029e34 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -42,6 +42,7 @@ SOURCES_COMMON = \ openthread.cpp \ api/crypto_api.cpp \ api/dataset_api.cpp \ + api/icmp6_api.cpp \ api/instance_api.cpp \ api/ip6_api.cpp \ api/link_api.cpp \ diff --git a/src/core/api/icmp6_api.cpp b/src/core/api/icmp6_api.cpp new file mode 100644 index 000000000..4dde16c73 --- /dev/null +++ b/src/core/api/icmp6_api.cpp @@ -0,0 +1,69 @@ +/* + * 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/icmp6.h" + +#include "openthread-instance.h" + +using namespace Thread; + +#ifdef __cplusplus +extern "C" { +#endif + +bool otIcmp6IsEchoEnabled(otInstance *aInstance) +{ + return aInstance->mIp6.mIcmp.IsEchoEnabled(); +} + +void otIcmp6SetEchoEnabled(otInstance *aInstance, bool aEnabled) +{ + aInstance->mIp6.mIcmp.SetEchoEnabled(aEnabled); +} + +ThreadError otIcmp6RegisterHandler(otInstance *aInstance, otIcmp6Handler *aHandler) +{ + return aInstance->mIp6.mIcmp.RegisterHandler(*static_cast(aHandler)); +} + +ThreadError otIcmp6SendEchoRequest(otInstance *aInstance, otMessage aMessage, + const otMessageInfo *aMessageInfo, uint16_t aIdentifier) +{ + return aInstance->mIp6.mIcmp.SendEchoRequest(*static_cast(aMessage), + *static_cast(aMessageInfo), + aIdentifier); +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/src/core/openthread.cpp b/src/core/openthread.cpp index d45423160..b08966748 100644 --- a/src/core/openthread.cpp +++ b/src/core/openthread.cpp @@ -66,29 +66,6 @@ using namespace Thread; extern "C" { #endif -bool otIcmp6IsEchoEnabled(otInstance *aInstance) -{ - return aInstance->mIp6.mIcmp.IsEchoEnabled(); -} - -void otIcmp6SetEchoEnabled(otInstance *aInstance, bool aEnabled) -{ - aInstance->mIp6.mIcmp.SetEchoEnabled(aEnabled); -} - -ThreadError otIcmp6RegisterHandler(otInstance *aInstance, otIcmp6Handler *aHandler) -{ - return aInstance->mIp6.mIcmp.RegisterHandler(*static_cast(aHandler)); -} - -ThreadError otIcmp6SendEchoRequest(otInstance *aInstance, otMessage aMessage, - const otMessageInfo *aMessageInfo, uint16_t aIdentifier) -{ - return aInstance->mIp6.mIcmp.SendEchoRequest(*static_cast(aMessage), - *static_cast(aMessageInfo), - aIdentifier); -} - #ifdef __cplusplus } // extern "C" #endif diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index df0909e0e..c6332bf7b 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -41,6 +41,7 @@ #include "openthread/openthread.h" #include "openthread/ncp.h" #include "openthread/diag.h" +#include "openthread/icmp6.h" #if OPENTHREAD_ENABLE_JAM_DETECTION #include "openthread/jam_detection.h" @@ -53,7 +54,6 @@ #include #include #include -#include #include #include