diff --git a/configure.ac b/configure.ac index 39ab03bee..208aa6915 100644 --- a/configure.ac +++ b/configure.ac @@ -1080,7 +1080,6 @@ AC_CONFIG_FILES([ Makefile include/Makefile include/cli/Makefile -include/commissioning/Makefile include/dhcp6/Makefile include/ncp/Makefile include/openthread/Makefile diff --git a/etc/visual-studio/libopenthread.vcxproj b/etc/visual-studio/libopenthread.vcxproj index 576a94784..e862e6af5 100644 --- a/etc/visual-studio/libopenthread.vcxproj +++ b/etc/visual-studio/libopenthread.vcxproj @@ -55,6 +55,8 @@ + + diff --git a/etc/visual-studio/libopenthread.vcxproj.filters b/etc/visual-studio/libopenthread.vcxproj.filters index e33b0aa8f..f6957246c 100644 --- a/etc/visual-studio/libopenthread.vcxproj.filters +++ b/etc/visual-studio/libopenthread.vcxproj.filters @@ -60,6 +60,12 @@ + + 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 819ae8c2f..c72143d64 100644 --- a/etc/visual-studio/libopenthread_k.vcxproj +++ b/etc/visual-studio/libopenthread_k.vcxproj @@ -64,6 +64,8 @@ + + diff --git a/etc/visual-studio/libopenthread_k.vcxproj.filters b/etc/visual-studio/libopenthread_k.vcxproj.filters index d932b3f7f..a64446d87 100644 --- a/etc/visual-studio/libopenthread_k.vcxproj.filters +++ b/etc/visual-studio/libopenthread_k.vcxproj.filters @@ -60,6 +60,12 @@ + + Source Files\api + + + Source Files\api + Source Files\api diff --git a/examples/apps/windows/pch.h b/examples/apps/windows/pch.h index 66b2b5dee..b3cdddcc7 100644 --- a/examples/apps/windows/pch.h +++ b/examples/apps/windows/pch.h @@ -40,7 +40,7 @@ #include #define OTDLL 1 #include -#include -#include +#include +#include #include "App.xaml.h" diff --git a/examples/drivers/windows/otApi/precomp.h b/examples/drivers/windows/otApi/precomp.h index 0e2419b63..873c1def7 100644 --- a/examples/drivers/windows/otApi/precomp.h +++ b/examples/drivers/windows/otApi/precomp.h @@ -22,8 +22,8 @@ #define OTAPI EXTERN_C __declspec(dllexport) #include -#include -#include +#include +#include #include #include diff --git a/examples/drivers/windows/otLwf/precomp.h b/examples/drivers/windows/otLwf/precomp.h index 8b774f698..08fdfcc11 100644 --- a/examples/drivers/windows/otLwf/precomp.h +++ b/examples/drivers/windows/otLwf/precomp.h @@ -65,8 +65,8 @@ RtlCopyBufferToMdl( #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/examples/drivers/windows/otNodeApi/precomp.h b/examples/drivers/windows/otNodeApi/precomp.h index 160ce5aec..18bc012ef 100644 --- a/examples/drivers/windows/otNodeApi/precomp.h +++ b/examples/drivers/windows/otNodeApi/precomp.h @@ -50,8 +50,8 @@ using namespace std; #define OTNODEAPI EXTERN_C __declspec(dllexport) #include -#include -#include +#include +#include #include #include diff --git a/include/Makefile.am b/include/Makefile.am index 616d77494..3a89b3428 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -32,7 +32,6 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am DIST_SUBDIRS = \ cli \ - commissioning \ dhcp6 \ ncp \ openthread \ @@ -43,7 +42,6 @@ DIST_SUBDIRS = \ SUBDIRS = \ cli \ - commissioning \ dhcp6 \ ncp \ openthread \ @@ -54,7 +52,6 @@ SUBDIRS = \ PRETTY_SUBDIRS = \ cli \ - commissioning \ dhcp6 \ ncp \ openthread \ diff --git a/include/commissioning/Makefile.am b/include/commissioning/Makefile.am deleted file mode 100644 index a4d83d1b1..000000000 --- a/include/commissioning/Makefile.am +++ /dev/null @@ -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_commissioning_headers = \ - commissioner.h \ - joiner.h \ - $(NULL) - -ot_commissioningdir = $(includedir)/commissioning -dist_ot_commissioning_HEADERS = $(ot_commissioning_headers) - -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 ef1889cf6..26fb07680 100644 --- a/include/openthread/Makefile.am +++ b/include/openthread/Makefile.am @@ -30,8 +30,10 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am openthread_headers = \ coap.h \ + commissioner.h \ crypto.h \ jam_detection.h \ + joiner.h \ message.h \ tasklet.h \ udp.h \ diff --git a/include/commissioning/commissioner.h b/include/openthread/commissioner.h similarity index 98% rename from include/commissioning/commissioner.h rename to include/openthread/commissioner.h index efebeaff4..d203294dd 100644 --- a/include/commissioning/commissioner.h +++ b/include/openthread/commissioner.h @@ -35,6 +35,7 @@ #ifndef OPENTHREAD_COMMISSIONER_H_ #define OPENTHREAD_COMMISSIONER_H_ +#include "openthread-types.h" #include #ifdef __cplusplus @@ -195,7 +196,7 @@ OTAPI ThreadError OTCALL otCommissionerPanIdQuery(otInstance *aInstance, uint16_ * @retval kThreadError_NoBufs Insufficient buffer space to send. * */ -OTAPI ThreadError OTCALL otSendMgmtCommissionerGet(otInstance *, const uint8_t *aTlvs, uint8_t aLength); +OTAPI ThreadError OTCALL otCommissionerSendMgmtGet(otInstance *, const uint8_t *aTlvs, uint8_t aLength); /** * This function sends MGMT_COMMISSIONER_SET. @@ -209,7 +210,7 @@ OTAPI ThreadError OTCALL otSendMgmtCommissionerGet(otInstance *, const uint8_t * * @retval kThreadError_NoBufs Insufficient buffer space to send. * */ -OTAPI ThreadError OTCALL otSendMgmtCommissionerSet(otInstance *, const otCommissioningDataset *aDataset, +OTAPI ThreadError OTCALL otCommissionerSendMgmtSet(otInstance *, const otCommissioningDataset *aDataset, const uint8_t *aTlvs, uint8_t aLength); /** diff --git a/include/commissioning/joiner.h b/include/openthread/joiner.h similarity index 99% rename from include/commissioning/joiner.h rename to include/openthread/joiner.h index b7edcd72c..08aac30d1 100644 --- a/include/commissioning/joiner.h +++ b/include/openthread/joiner.h @@ -35,6 +35,7 @@ #ifndef OPENTHREAD_JOINER_H_ #define OPENTHREAD_JOINER_H_ +#include "openthread-types.h" #include #ifdef __cplusplus diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index c360a6230..75cb1aad8 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -46,8 +46,8 @@ #endif #include -#include -#include +#include "openthread/commissioner.h" +#include "openthread/joiner.h" #ifndef OTDLL #include @@ -2464,7 +2464,7 @@ void Interpreter::ProcessCommissioner(int argc, char *argv[]) } } - SuccessOrExit(error = otSendMgmtCommissionerGet(mInstance, tlvs, static_cast(length))); + SuccessOrExit(error = otCommissionerSendMgmtGet(mInstance, tlvs, static_cast(length))); } else if (strcmp(argv[0], "mgmtset") == 0) { @@ -2527,7 +2527,7 @@ void Interpreter::ProcessCommissioner(int argc, char *argv[]) } } - SuccessOrExit(error = otSendMgmtCommissionerSet(mInstance, &dataset, tlvs, static_cast(length))); + SuccessOrExit(error = otCommissionerSendMgmtSet(mInstance, &dataset, tlvs, static_cast(length))); } else if (strcmp(argv[0], "sessionid") == 0) { diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 7aa68cb36..a10167909 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -103,6 +103,7 @@ endif # OPENTHREAD_ENABLE_MAC_WHITELIST if OPENTHREAD_ENABLE_COMMISSIONER SOURCES_COMMON += \ + api/commissioner_api.cpp \ coap/secure_coap_server.cpp \ crypto/pbkdf2_cmac.cpp \ meshcop/announce_begin_client.cpp \ @@ -114,6 +115,7 @@ endif # OPENTHREAD_ENABLE_COMMISSIONER if OPENTHREAD_ENABLE_JOINER SOURCES_COMMON += \ + api/joiner_api.cpp \ coap/secure_coap_client.cpp \ meshcop/joiner.cpp \ $(NULL) diff --git a/src/core/api/commissioner_api.cpp b/src/core/api/commissioner_api.cpp new file mode 100644 index 000000000..23294a446 --- /dev/null +++ b/src/core/api/commissioner_api.cpp @@ -0,0 +1,121 @@ +/* + * 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/commissioner.h" + +#include "openthread-instance.h" + +using namespace Thread; + +#ifdef __cplusplus +extern "C" { +#endif + +#if OPENTHREAD_ENABLE_COMMISSIONER + +ThreadError otCommissionerStart(otInstance *aInstance) +{ + return aInstance->mThreadNetif.GetCommissioner().Start(); +} + +ThreadError otCommissionerStop(otInstance *aInstance) +{ + return aInstance->mThreadNetif.GetCommissioner().Stop(); +} + +ThreadError otCommissionerAddJoiner(otInstance *aInstance, const otExtAddress *aExtAddress, const char *aPSKd) +{ + return aInstance->mThreadNetif.GetCommissioner().AddJoiner(static_cast(aExtAddress), aPSKd); +} + +ThreadError otCommissionerRemoveJoiner(otInstance *aInstance, const otExtAddress *aExtAddress) +{ + return aInstance->mThreadNetif.GetCommissioner().RemoveJoiner(static_cast(aExtAddress)); +} + +ThreadError otCommissionerSetProvisioningUrl(otInstance *aInstance, const char *aProvisioningUrl) +{ + return aInstance->mThreadNetif.GetCommissioner().SetProvisioningUrl(aProvisioningUrl); +} + +ThreadError otCommissionerAnnounceBegin(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, + const otIp6Address *aAddress) +{ + return aInstance->mThreadNetif.GetCommissioner().mAnnounceBegin.SendRequest(aChannelMask, aCount, aPeriod, + *static_cast(aAddress)); +} + +ThreadError otCommissionerEnergyScan(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, + uint16_t aScanDuration, const otIp6Address *aAddress, + otCommissionerEnergyReportCallback aCallback, void *aContext) +{ + return aInstance->mThreadNetif.GetCommissioner().mEnergyScan.SendQuery(aChannelMask, aCount, aPeriod, aScanDuration, + *static_cast(aAddress), + aCallback, aContext); +} + +ThreadError otCommissionerPanIdQuery(otInstance *aInstance, uint16_t aPanId, uint32_t aChannelMask, + const otIp6Address *aAddress, + otCommissionerPanIdConflictCallback aCallback, void *aContext) +{ + return aInstance->mThreadNetif.GetCommissioner().mPanIdQuery.SendQuery( + aPanId, aChannelMask, *static_cast(aAddress), aCallback, aContext); +} + +ThreadError otCommissionerSendMgmtGet(otInstance *aInstance, const uint8_t *aTlvs, uint8_t aLength) +{ + return aInstance->mThreadNetif.GetCommissioner().SendMgmtCommissionerGetRequest(aTlvs, aLength); +} + +ThreadError otCommissionerSendMgmtSet(otInstance *aInstance, const otCommissioningDataset *aDataset, + const uint8_t *aTlvs, uint8_t aLength) +{ + return aInstance->mThreadNetif.GetCommissioner().SendMgmtCommissionerSetRequest(*aDataset, aTlvs, aLength); +} + +uint16_t otCommissionerGetSessionId(otInstance *aInstance) +{ + return aInstance->mThreadNetif.GetCommissioner().GetSessionId(); +} + +ThreadError otCommissionerGeneratePSKc(otInstance *aInstance, const char *aPassPhrase, const char *aNetworkName, + const uint8_t *aExtPanId, uint8_t *aPSKc) +{ + return aInstance->mThreadNetif.GetCommissioner().GeneratePSKc(aPassPhrase, aNetworkName, aExtPanId, aPSKc); +} + +#endif // OPENTHREAD_ENABLE_COMMISSIONER + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/src/core/api/joiner_api.cpp b/src/core/api/joiner_api.cpp new file mode 100644 index 000000000..f6e8021a3 --- /dev/null +++ b/src/core/api/joiner_api.cpp @@ -0,0 +1,65 @@ +/* + * 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/joiner.h" + +#include "openthread-instance.h" + +using namespace Thread; + +#ifdef __cplusplus +extern "C" { +#endif + +#if OPENTHREAD_ENABLE_JOINER + +ThreadError otJoinerStart(otInstance *aInstance, const char *aPSKd, const char *aProvisioningUrl, + const char *aVendorName, const char *aVendorModel, + const char *aVendorSwVersion, const char *aVendorData, + otJoinerCallback aCallback, void *aContext) +{ + return aInstance->mThreadNetif.GetJoiner().Start(aPSKd, aProvisioningUrl, + aVendorName, aVendorModel, aVendorSwVersion, aVendorData, + aCallback, aContext); +} + +ThreadError otJoinerStop(otInstance *aInstance) +{ + return aInstance->mThreadNetif.GetJoiner().Stop(); +} + +#endif // OPENTHREAD_ENABLE_JOINER + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/src/core/meshcop/announce_begin_client.hpp b/src/core/meshcop/announce_begin_client.hpp index 71c9e72c4..17d17d1c8 100644 --- a/src/core/meshcop/announce_begin_client.hpp +++ b/src/core/meshcop/announce_begin_client.hpp @@ -36,7 +36,8 @@ #include #include -#include +#include "openthread/commissioner.h" + #include #include #include diff --git a/src/core/meshcop/commissioner.hpp b/src/core/meshcop/commissioner.hpp index ca20da60d..72134fa65 100644 --- a/src/core/meshcop/commissioner.hpp +++ b/src/core/meshcop/commissioner.hpp @@ -35,6 +35,7 @@ #define COMMISSIONER_HPP_ #include +#include "openthread/commissioner.h" #include #include diff --git a/src/core/meshcop/energy_scan_client.hpp b/src/core/meshcop/energy_scan_client.hpp index ce5ccfe12..51b57b8d5 100644 --- a/src/core/meshcop/energy_scan_client.hpp +++ b/src/core/meshcop/energy_scan_client.hpp @@ -36,7 +36,8 @@ #include #include -#include +#include "openthread/commissioner.h" + #include #include #include diff --git a/src/core/meshcop/joiner.hpp b/src/core/meshcop/joiner.hpp index 3e23cb500..04b6cf6fc 100644 --- a/src/core/meshcop/joiner.hpp +++ b/src/core/meshcop/joiner.hpp @@ -35,7 +35,7 @@ #define JOINER_HPP_ #include -#include +#include "openthread/joiner.h" #include #include diff --git a/src/core/meshcop/panid_query_client.hpp b/src/core/meshcop/panid_query_client.hpp index a4441428d..14b7cbdcc 100644 --- a/src/core/meshcop/panid_query_client.hpp +++ b/src/core/meshcop/panid_query_client.hpp @@ -36,7 +36,8 @@ #include #include -#include +#include "openthread/commissioner.h" + #include #include #include diff --git a/src/core/openthread.cpp b/src/core/openthread.cpp index b0750d260..00ee8eeaa 100644 --- a/src/core/openthread.cpp +++ b/src/core/openthread.cpp @@ -1607,97 +1607,6 @@ ThreadError otSendPendingSet(otInstance *aInstance, const otOperationalDataset * return aInstance->mThreadNetif.GetPendingDataset().SendSetRequest(*aDataset, aTlvs, aLength); } -#if OPENTHREAD_ENABLE_COMMISSIONER -#include -ThreadError otCommissionerStart(otInstance *aInstance) -{ - return aInstance->mThreadNetif.GetCommissioner().Start(); -} - -ThreadError otCommissionerStop(otInstance *aInstance) -{ - return aInstance->mThreadNetif.GetCommissioner().Stop(); -} - -ThreadError otCommissionerAddJoiner(otInstance *aInstance, const otExtAddress *aExtAddress, const char *aPSKd) -{ - return aInstance->mThreadNetif.GetCommissioner().AddJoiner(static_cast(aExtAddress), aPSKd); -} - -ThreadError otCommissionerRemoveJoiner(otInstance *aInstance, const otExtAddress *aExtAddress) -{ - return aInstance->mThreadNetif.GetCommissioner().RemoveJoiner(static_cast(aExtAddress)); -} - -ThreadError otCommissionerSetProvisioningUrl(otInstance *aInstance, const char *aProvisioningUrl) -{ - return aInstance->mThreadNetif.GetCommissioner().SetProvisioningUrl(aProvisioningUrl); -} - -ThreadError otCommissionerAnnounceBegin(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, - const otIp6Address *aAddress) -{ - return aInstance->mThreadNetif.GetCommissioner().mAnnounceBegin.SendRequest(aChannelMask, aCount, aPeriod, - *static_cast(aAddress)); -} - -ThreadError otCommissionerEnergyScan(otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, - uint16_t aScanDuration, const otIp6Address *aAddress, - otCommissionerEnergyReportCallback aCallback, void *aContext) -{ - return aInstance->mThreadNetif.GetCommissioner().mEnergyScan.SendQuery(aChannelMask, aCount, aPeriod, aScanDuration, - *static_cast(aAddress), - aCallback, aContext); -} - -ThreadError otCommissionerPanIdQuery(otInstance *aInstance, uint16_t aPanId, uint32_t aChannelMask, - const otIp6Address *aAddress, - otCommissionerPanIdConflictCallback aCallback, void *aContext) -{ - return aInstance->mThreadNetif.GetCommissioner().mPanIdQuery.SendQuery( - aPanId, aChannelMask, *static_cast(aAddress), aCallback, aContext); -} - -ThreadError otSendMgmtCommissionerGet(otInstance *aInstance, const uint8_t *aTlvs, uint8_t aLength) -{ - return aInstance->mThreadNetif.GetCommissioner().SendMgmtCommissionerGetRequest(aTlvs, aLength); -} - -ThreadError otSendMgmtCommissionerSet(otInstance *aInstance, const otCommissioningDataset *aDataset, - const uint8_t *aTlvs, uint8_t aLength) -{ - return aInstance->mThreadNetif.GetCommissioner().SendMgmtCommissionerSetRequest(*aDataset, aTlvs, aLength); -} - -uint16_t otCommissionerGetSessionId(otInstance *aInstance) -{ - return aInstance->mThreadNetif.GetCommissioner().GetSessionId(); -} - -ThreadError otCommissionerGeneratePSKc(otInstance *aInstance, const char *aPassPhrase, const char *aNetworkName, - const uint8_t *aExtPanId, uint8_t *aPSKc) -{ - return aInstance->mThreadNetif.GetCommissioner().GeneratePSKc(aPassPhrase, aNetworkName, aExtPanId, aPSKc); -} -#endif // OPENTHREAD_ENABLE_COMMISSIONER - -#if OPENTHREAD_ENABLE_JOINER -ThreadError otJoinerStart(otInstance *aInstance, const char *aPSKd, const char *aProvisioningUrl, - const char *aVendorName, const char *aVendorModel, - const char *aVendorSwVersion, const char *aVendorData, - otJoinerCallback aCallback, void *aContext) -{ - return aInstance->mThreadNetif.GetJoiner().Start(aPSKd, aProvisioningUrl, - aVendorName, aVendorModel, aVendorSwVersion, aVendorData, - aCallback, aContext); -} - -ThreadError otJoinerStop(otInstance *aInstance) -{ - return aInstance->mThreadNetif.GetJoiner().Stop(); -} -#endif // OPENTHREAD_ENABLE_JOINER - #ifdef __cplusplus } // extern "C" #endif