diff --git a/etc/visual-studio/libopenthread.vcxproj b/etc/visual-studio/libopenthread.vcxproj
index 328dceb5a..00b6b74e1 100644
--- a/etc/visual-studio/libopenthread.vcxproj
+++ b/etc/visual-studio/libopenthread.vcxproj
@@ -62,6 +62,7 @@
+
diff --git a/etc/visual-studio/libopenthread.vcxproj.filters b/etc/visual-studio/libopenthread.vcxproj.filters
index cc562c4ef..6f866638f 100644
--- a/etc/visual-studio/libopenthread.vcxproj.filters
+++ b/etc/visual-studio/libopenthread.vcxproj.filters
@@ -81,6 +81,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 35764e286..22096b604 100644
--- a/etc/visual-studio/libopenthread_k.vcxproj
+++ b/etc/visual-studio/libopenthread_k.vcxproj
@@ -70,6 +70,7 @@
+
diff --git a/etc/visual-studio/libopenthread_k.vcxproj.filters b/etc/visual-studio/libopenthread_k.vcxproj.filters
index 4593d2533..b1bffd702 100644
--- a/etc/visual-studio/libopenthread_k.vcxproj.filters
+++ b/etc/visual-studio/libopenthread_k.vcxproj.filters
@@ -81,6 +81,9 @@
Source Files\api
+
+ Source Files\api
+
Source Files\api
diff --git a/examples/drivers/windows/otApi/otApi.cpp b/examples/drivers/windows/otApi/otApi.cpp
index c5dc5fb7b..ea61dfb9c 100644
--- a/examples/drivers/windows/otApi/otApi.cpp
+++ b/examples/drivers/windows/otApi/otApi.cpp
@@ -1796,7 +1796,7 @@ otSetNetworkName(
OTAPI
ThreadError
OTCALL
-otGetNextOnMeshPrefix(
+otNetDataGetNextPrefixInfo(
_In_ otInstance *aInstance,
bool _aLocal,
_Inout_ otNetworkDataIterator *aIterator,
@@ -2445,7 +2445,7 @@ otSetJoinerUdpPort(
OTAPI
ThreadError
OTCALL
-otAddBorderRouter(
+otNetDataAddPrefixInfo(
_In_ otInstance *aInstance,
const otBorderRouterConfig *aConfig
)
@@ -2457,7 +2457,7 @@ otAddBorderRouter(
OTAPI
ThreadError
OTCALL
-otRemoveBorderRouter(
+otNetDataRemovePrefixInfo(
_In_ otInstance *aInstance,
const otIp6Prefix *aPrefix
)
@@ -2469,7 +2469,7 @@ otRemoveBorderRouter(
OTAPI
ThreadError
OTCALL
-otAddExternalRoute(
+otNetDataAddRoute(
_In_ otInstance *aInstance,
const otExternalRouteConfig *aConfig
)
@@ -2481,7 +2481,7 @@ otAddExternalRoute(
OTAPI
ThreadError
OTCALL
-otRemoveExternalRoute(
+otNetDataRemoveRoute(
_In_ otInstance *aInstance,
const otIp6Prefix *aPrefix
)
@@ -2493,7 +2493,7 @@ otRemoveExternalRoute(
OTAPI
ThreadError
OTCALL
-otSendServerData(
+otNetDataRegister(
_In_ otInstance *aInstance
)
{
@@ -3029,7 +3029,7 @@ otGetLeaderWeight(
OTAPI
uint8_t
OTCALL
-otGetNetworkDataVersion(
+otNetDataGetVersion(
_In_ otInstance *aInstance
)
{
@@ -3103,7 +3103,7 @@ otGetParentInfo(
OTAPI
uint8_t
OTCALL
-otGetStableNetworkDataVersion(
+otNetDataGetStableVersion(
_In_ otInstance *aInstance
)
{
diff --git a/examples/drivers/windows/otLwf/iocontrol.c b/examples/drivers/windows/otLwf/iocontrol.c
index bd1aa5664..a4c75ec3c 100644
--- a/examples/drivers/windows/otLwf/iocontrol.c
+++ b/examples/drivers/windows/otLwf/iocontrol.c
@@ -2493,7 +2493,7 @@ otLwfIoCtl_otAddBorderRouter(
if (InBufferLength >= sizeof(otBorderRouterConfig))
{
- status = ThreadErrorToNtstatus(otAddBorderRouter(pFilter->otCtx, (otBorderRouterConfig*)InBuffer));
+ status = ThreadErrorToNtstatus(otNetDataAddPrefixInfo(pFilter->otCtx, (otBorderRouterConfig*)InBuffer));
}
return status;
@@ -2574,7 +2574,7 @@ otLwfIoCtl_otRemoveBorderRouter(
if (InBufferLength >= sizeof(otIp6Prefix))
{
- status = ThreadErrorToNtstatus(otRemoveBorderRouter(pFilter->otCtx, (otIp6Prefix*)InBuffer));
+ status = ThreadErrorToNtstatus(otNetDataRemovePrefixInfo(pFilter->otCtx, (otIp6Prefix*)InBuffer));
}
return status;
@@ -2637,7 +2637,7 @@ otLwfIoCtl_otAddExternalRoute(
if (InBufferLength >= sizeof(otExternalRouteConfig))
{
- status = ThreadErrorToNtstatus(otAddExternalRoute(pFilter->otCtx, (otExternalRouteConfig*)InBuffer));
+ status = ThreadErrorToNtstatus(otNetDataAddRoute(pFilter->otCtx, (otExternalRouteConfig*)InBuffer));
}
return status;
@@ -2709,7 +2709,7 @@ otLwfIoCtl_otRemoveExternalRoute(
if (InBufferLength >= sizeof(otIp6Prefix))
{
- status = ThreadErrorToNtstatus(otRemoveExternalRoute(pFilter->otCtx, (otIp6Prefix*)InBuffer));
+ status = ThreadErrorToNtstatus(otNetDataRemoveRoute(pFilter->otCtx, (otIp6Prefix*)InBuffer));
}
return status;
@@ -2772,7 +2772,7 @@ otLwfIoCtl_otSendServerData(
UNREFERENCED_PARAMETER(OutBuffer);
*OutBufferLength = 0;
- status = ThreadErrorToNtstatus(otSendServerData(pFilter->otCtx));
+ status = ThreadErrorToNtstatus(otNetDataRegister(pFilter->otCtx));
return status;
}
@@ -4128,7 +4128,7 @@ otLwfIoCtl_otNetworkDataVersion(
if (*OutBufferLength >= sizeof(uint8_t))
{
- *(uint8_t*)OutBuffer = otGetNetworkDataVersion(pFilter->otCtx);
+ *(uint8_t*)OutBuffer = otNetDataGetVersion(pFilter->otCtx);
*OutBufferLength = sizeof(uint8_t);
status = STATUS_SUCCESS;
}
@@ -4450,7 +4450,7 @@ otLwfIoCtl_otStableNetworkDataVersion(
if (*OutBufferLength >= sizeof(uint8_t))
{
- *(uint8_t*)OutBuffer = otGetStableNetworkDataVersion(pFilter->otCtx);
+ *(uint8_t*)OutBuffer = otNetDataGetStableVersion(pFilter->otCtx);
*OutBufferLength = sizeof(uint8_t);
status = STATUS_SUCCESS;
}
@@ -4715,7 +4715,7 @@ otLwfIoCtl_otNextOnMeshPrefix(
uint8_t aIterator = *(uint8_t*)(InBuffer + sizeof(BOOLEAN));
otBorderRouterConfig* aConfig = (otBorderRouterConfig*)((PUCHAR)OutBuffer + sizeof(uint8_t));
status = ThreadErrorToNtstatus(
- otGetNextOnMeshPrefix(
+ otNetDataGetNextPrefixInfo(
pFilter->otCtx,
aLocal,
&aIterator,
diff --git a/examples/drivers/windows/otNodeApi/otNodeApi.cpp b/examples/drivers/windows/otNodeApi/otNodeApi.cpp
index ae7906bdc..a8ac4aa97 100644
--- a/examples/drivers/windows/otNodeApi/otNodeApi.cpp
+++ b/examples/drivers/windows/otNodeApi/otNodeApi.cpp
@@ -1575,7 +1575,7 @@ OTNODEAPI int32_t OTCALL otNodeAddPrefix(otNode* aNode, const char *aPrefix, con
return kThreadError_InvalidArgs;
}
- auto result = otAddBorderRouter(aNode->mInstance, &config);
+ auto result = otNetDataAddPrefixInfo(aNode->mInstance, &config);
otLogFuncExit();
return result;
}
@@ -1588,7 +1588,7 @@ OTNODEAPI int32_t OTCALL otNodeRemovePrefix(otNode* aNode, const char *aPrefix)
auto error = otNodeParsePrefix(aPrefix, &prefix);
if (error != kThreadError_None) return error;
- auto result = otRemoveBorderRouter(aNode->mInstance, &prefix);
+ auto result = otNetDataRemovePrefixInfo(aNode->mInstance, &prefix);
otLogFuncExit();
return result;
}
@@ -1618,7 +1618,7 @@ OTNODEAPI int32_t OTCALL otNodeAddRoute(otNode* aNode, const char *aPrefix, cons
return kThreadError_InvalidArgs;
}
- auto result = otAddExternalRoute(aNode->mInstance, &config);
+ auto result = otNetDataAddRoute(aNode->mInstance, &config);
otLogFuncExit();
return result;
}
@@ -1631,7 +1631,7 @@ OTNODEAPI int32_t OTCALL otNodeRemoveRoute(otNode* aNode, const char *aPrefix)
auto error = otNodeParsePrefix(aPrefix, &prefix);
if (error != kThreadError_None) return error;
- auto result = otRemoveExternalRoute(aNode->mInstance, &prefix);
+ auto result = otNetDataRemoveRoute(aNode->mInstance, &prefix);
otLogFuncExit();
return result;
}
@@ -1640,7 +1640,7 @@ OTNODEAPI int32_t OTCALL otNodeRegisterNetdata(otNode* aNode)
{
otLogFuncEntryMsg("[%d]", aNode->mId);
printf("%d: registernetdata\r\n", aNode->mId);
- auto result = otSendServerData(aNode->mInstance);
+ auto result = otNetDataRegister(aNode->mInstance);
otLogFuncExit();
return result;
}
diff --git a/include/openthread.h b/include/openthread.h
index 6045ddf66..f7e3dd5c8 100644
--- a/include/openthread.h
+++ b/include/openthread.h
@@ -41,6 +41,7 @@
#include "openthread/ip6.h"
#include "openthread/link.h"
#include "openthread/message.h"
+#include "openthread/netdata.h"
#include "openthread/tasklet.h"
#ifdef __cplusplus
@@ -552,30 +553,6 @@ OTAPI const uint8_t *OTCALL otGetMeshLocalPrefix(otInstance *aInstance);
*/
OTAPI ThreadError OTCALL otSetMeshLocalPrefix(otInstance *aInstance, const uint8_t *aMeshLocalPrefix);
-/**
- * This method provides a full or stable copy of the Leader's Thread Network Data.
- *
- * @param[in] aInstance A pointer to an OpenThread instance.
- * @param[in] aStable TRUE when copying the stable version, FALSE when copying the full version.
- * @param[out] aData A pointer to the data buffer.
- * @param[inout] aDataLength On entry, size of the data buffer pointed to by @p aData.
- * On exit, number of copied bytes.
- */
-OTAPI ThreadError OTCALL otGetNetworkDataLeader(otInstance *aInstance, bool aStable, uint8_t *aData,
- uint8_t *aDataLength);
-
-/**
- * This method provides a full or stable copy of the local Thread Network Data.
- *
- * @param[in] aInstance A pointer to an OpenThread instance.
- * @param[in] aStable TRUE when copying the stable version, FALSE when copying the full version.
- * @param[out] aData A pointer to the data buffer.
- * @param[inout] aDataLength On entry, size of the data buffer pointed to by @p aData.
- * On exit, number of copied bytes.
- */
-OTAPI ThreadError OTCALL otGetNetworkDataLocal(otInstance *aInstance, bool aStable, uint8_t *aData,
- uint8_t *aDataLength);
-
/**
* Get the Thread Network Name.
*
@@ -599,22 +576,6 @@ OTAPI const char *OTCALL otGetNetworkName(otInstance *aInstance);
*/
OTAPI ThreadError OTCALL otSetNetworkName(otInstance *aInstance, const char *aNetworkName);
-/**
- * This function gets the next On Mesh Prefix in the Network Data.
- *
- * @param[in] aInstance A pointer to an OpenThread instance.
- * @param[in] aLocal TRUE to retrieve from the local Network Data, FALSE for partition's Network Data
- * @param[inout] aIterator A pointer to the Network Data iterator context. To get the first on-mesh entry
- it should be set to OT_NETWORK_DATA_ITERATOR_INIT.
- * @param[out] aConfig A pointer to where the On Mesh Prefix information will be placed.
- *
- * @retval kThreadError_None Successfully found the next On Mesh prefix.
- * @retval kThreadError_NotFound No subsequent On Mesh prefix exists in the Thread Network Data.
- *
- */
-OTAPI ThreadError OTCALL otGetNextOnMeshPrefix(otInstance *aInstance, bool aLocal, otNetworkDataIterator *aIterator,
- otBorderRouterConfig *aConfig);
-
/**
* This function indicates whether or not the Router Role is enabled.
*
@@ -878,91 +839,6 @@ OTAPI ThreadError OTCALL otSetJoinerUdpPort(otInstance *aInstance, uint16_t aJoi
* @}
*/
-/**
- * @defgroup config-br Border Router
- *
- * @brief
- * This module includes functions that manage configuration parameters that apply to the Thread Border Router role.
- *
- * @{
- *
- */
-
-/**
- * Add a border router configuration to the local network data.
- *
- * @param[in] aInstance A pointer to an OpenThread instance.
- * @param[in] aConfig A pointer to the border router configuration.
- *
- * @retval kThreadErrorNone Successfully added the configuration to the local network data.
- * @retval kThreadErrorInvalidArgs One or more configuration parameters were invalid.
- * @retval kThreadErrorSize Not enough room is available to add the configuration to the local network data.
- *
- * @sa otRemoveBorderRouter
- * @sa otSendServerData
- */
-OTAPI ThreadError OTCALL otAddBorderRouter(otInstance *aInstance, const otBorderRouterConfig *aConfig);
-
-/**
- * Remove a border router configuration from the local network data.
- *
- * @param[in] aInstance A pointer to an OpenThread instance.
- * @param[in] aPrefix A pointer to an IPv6 prefix.
- *
- * @retval kThreadErrorNone Successfully removed the configuration from the local network data.
- *
- * @sa otAddBorderRouter
- * @sa otSendServerData
- */
-OTAPI ThreadError OTCALL otRemoveBorderRouter(otInstance *aInstance, const otIp6Prefix *aPrefix);
-
-/**
- * Add an external route configuration to the local network data.
- *
- * @param[in] aInstance A pointer to an OpenThread instance.
- * @param[in] aConfig A pointer to the external route configuration.
- *
- * @retval kThreadErrorNone Successfully added the configuration to the local network data.
- * @retval kThreadErrorInvalidArgs One or more configuration parameters were invalid.
- * @retval kThreadErrorSize Not enough room is available to add the configuration to the local network data.
- *
- * @sa otRemoveExternalRoute
- * @sa otSendServerData
- */
-OTAPI ThreadError OTCALL otAddExternalRoute(otInstance *aInstance, const otExternalRouteConfig *aConfig);
-
-/**
- * Remove an external route configuration from the local network data.
- *
- * @param[in] aInstance A pointer to an OpenThread instance.
- * @param[in] aPrefix A pointer to an IPv6 prefix.
- *
- * @retval kThreadErrorNone Successfully removed the configuration from the local network data.
- *
- * @sa otAddExternalRoute
- * @sa otSendServerData
- */
-OTAPI ThreadError OTCALL otRemoveExternalRoute(otInstance *aInstance, const otIp6Prefix *aPrefix);
-
-/**
- * Immediately register the local network data with the Leader.
- *
- * @param[in] aInstance A pointer to an OpenThread instance.
- *
- * retval kThreadErrorNone Successfully queued a Server Data Request message for delivery.
- *
- * @sa otAddBorderRouter
- * @sa otRemoveBorderRouter
- * @sa otAddExternalRoute
- * @sa otRemoveExternalRoute
- */
-OTAPI ThreadError OTCALL otSendServerData(otInstance *aInstance);
-
-/**
- * @}
- *
- */
-
/**
* @defgroup config-test Test
*
@@ -1326,15 +1202,6 @@ OTAPI uint8_t OTCALL otGetLeaderRouterId(otInstance *aInstance);
*/
OTAPI uint8_t OTCALL otGetLeaderWeight(otInstance *aInstance);
-/**
- * Get the Network Data Version.
- *
- * @param[in] aInstance A pointer to an OpenThread instance.
- *
- * @returns The Network Data Version.
- */
-OTAPI uint8_t OTCALL otGetNetworkDataVersion(otInstance *aInstance);
-
/**
* Get the Partition ID.
*
@@ -1390,15 +1257,6 @@ OTAPI ThreadError OTCALL otGetParentInfo(otInstance *aInstance, otRouterInfo *aP
*/
OTAPI ThreadError OTCALL otGetParentAverageRssi(otInstance *aInstance, int8_t *aParentRssi);
-/**
- * Get the Stable Network Data Version.
- *
- * @param[in] aInstance A pointer to an OpenThread instance.
- *
- * @returns The Stable Network Data Version.
- */
-OTAPI uint8_t OTCALL otGetStableNetworkDataVersion(otInstance *aInstance);
-
/**
* This function registers a callback to provide received raw Network Diagnostic Get response payload.
*
diff --git a/include/openthread/Makefile.am b/include/openthread/Makefile.am
index 355bc1736..cbc310acd 100644
--- a/include/openthread/Makefile.am
+++ b/include/openthread/Makefile.am
@@ -39,6 +39,7 @@ openthread_headers = \
joiner.h \
link.h \
message.h \
+ netdata.h \
tasklet.h \
udp.h \
$(NULL)
diff --git a/include/openthread/netdata.h b/include/openthread/netdata.h
new file mode 100644
index 000000000..597b919af
--- /dev/null
+++ b/include/openthread/netdata.h
@@ -0,0 +1,191 @@
+/*
+ * 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 OpenThread Network Data API.
+ */
+
+#ifndef OPENTHREAD_NETDATA_H_
+#define OPENTHREAD_NETDATA_H_
+
+#include "openthread-types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup netdata Network Data
+ *
+ * @brief
+ * This module includes functions that control Network Data configuration.
+ *
+ * @{
+ *
+ */
+
+/**
+ * This method provides a full or stable copy of the Leader's Thread Network Data.
+ *
+ * @param[in] aInstance A pointer to an OpenThread instance.
+ * @param[in] aStable TRUE when copying the stable version, FALSE when copying the full version.
+ * @param[out] aData A pointer to the data buffer.
+ * @param[inout] aDataLength On entry, size of the data buffer pointed to by @p aData.
+ * On exit, number of copied bytes.
+ */
+OTAPI ThreadError OTCALL otNetDataGetLeader(otInstance *aInstance, bool aStable, uint8_t *aData,
+ uint8_t *aDataLength);
+
+/**
+ * This method provides a full or stable copy of the local Thread Network Data.
+ *
+ * @param[in] aInstance A pointer to an OpenThread instance.
+ * @param[in] aStable TRUE when copying the stable version, FALSE when copying the full version.
+ * @param[out] aData A pointer to the data buffer.
+ * @param[inout] aDataLength On entry, size of the data buffer pointed to by @p aData.
+ * On exit, number of copied bytes.
+ */
+OTAPI ThreadError OTCALL otNetDataGetLocal(otInstance *aInstance, bool aStable, uint8_t *aData,
+ uint8_t *aDataLength);
+
+/**
+ * This function gets the next On Mesh Prefix in the Network Data.
+ *
+ * @param[in] aInstance A pointer to an OpenThread instance.
+ * @param[in] aLocal TRUE to retrieve from the local Network Data, FALSE for partition's Network Data
+ * @param[inout] aIterator A pointer to the Network Data iterator context. To get the first on-mesh entry
+ it should be set to OT_NETWORK_DATA_ITERATOR_INIT.
+ * @param[out] aConfig A pointer to where the On Mesh Prefix information will be placed.
+ *
+ * @retval kThreadError_None Successfully found the next On Mesh prefix.
+ * @retval kThreadError_NotFound No subsequent On Mesh prefix exists in the Thread Network Data.
+ *
+ */
+OTAPI ThreadError OTCALL otNetDataGetNextPrefixInfo(otInstance *aInstance, bool aLocal,
+ otNetworkDataIterator *aIterator, otBorderRouterConfig *aConfig);
+
+/**
+ * Add a border router configuration to the local network data.
+ *
+ * @param[in] aInstance A pointer to an OpenThread instance.
+ * @param[in] aConfig A pointer to the border router configuration.
+ *
+ * @retval kThreadErrorNone Successfully added the configuration to the local network data.
+ * @retval kThreadErrorInvalidArgs One or more configuration parameters were invalid.
+ * @retval kThreadErrorSize Not enough room is available to add the configuration to the local network data.
+ *
+ * @sa otRemoveBorderRouter
+ * @sa otSendServerData
+ */
+OTAPI ThreadError OTCALL otNetDataAddPrefixInfo(otInstance *aInstance, const otBorderRouterConfig *aConfig);
+
+/**
+ * Remove a border router configuration from the local network data.
+ *
+ * @param[in] aInstance A pointer to an OpenThread instance.
+ * @param[in] aPrefix A pointer to an IPv6 prefix.
+ *
+ * @retval kThreadErrorNone Successfully removed the configuration from the local network data.
+ *
+ * @sa otAddBorderRouter
+ * @sa otSendServerData
+ */
+OTAPI ThreadError OTCALL otNetDataRemovePrefixInfo(otInstance *aInstance, const otIp6Prefix *aPrefix);
+
+/**
+ * Add an external route configuration to the local network data.
+ *
+ * @param[in] aInstance A pointer to an OpenThread instance.
+ * @param[in] aConfig A pointer to the external route configuration.
+ *
+ * @retval kThreadErrorNone Successfully added the configuration to the local network data.
+ * @retval kThreadErrorInvalidArgs One or more configuration parameters were invalid.
+ * @retval kThreadErrorSize Not enough room is available to add the configuration to the local network data.
+ *
+ * @sa otRemoveExternalRoute
+ * @sa otSendServerData
+ */
+OTAPI ThreadError OTCALL otNetDataAddRoute(otInstance *aInstance, const otExternalRouteConfig *aConfig);
+
+/**
+ * Remove an external route configuration from the local network data.
+ *
+ * @param[in] aInstance A pointer to an OpenThread instance.
+ * @param[in] aPrefix A pointer to an IPv6 prefix.
+ *
+ * @retval kThreadErrorNone Successfully removed the configuration from the local network data.
+ *
+ * @sa otAddExternalRoute
+ * @sa otSendServerData
+ */
+OTAPI ThreadError OTCALL otNetDataRemoveRoute(otInstance *aInstance, const otIp6Prefix *aPrefix);
+
+/**
+ * Immediately register the local network data with the Leader.
+ *
+ * @param[in] aInstance A pointer to an OpenThread instance.
+ *
+ * retval kThreadErrorNone Successfully queued a Server Data Request message for delivery.
+ *
+ * @sa otAddBorderRouter
+ * @sa otRemoveBorderRouter
+ * @sa otAddExternalRoute
+ * @sa otRemoveExternalRoute
+ */
+OTAPI ThreadError OTCALL otNetDataRegister(otInstance *aInstance);
+
+/**
+ * Get the Network Data Version.
+ *
+ * @param[in] aInstance A pointer to an OpenThread instance.
+ *
+ * @returns The Network Data Version.
+ */
+OTAPI uint8_t OTCALL otNetDataGetVersion(otInstance *aInstance);
+
+/**
+ * Get the Stable Network Data Version.
+ *
+ * @param[in] aInstance A pointer to an OpenThread instance.
+ *
+ * @returns The Stable Network Data Version.
+ */
+OTAPI uint8_t OTCALL otNetDataGetStableVersion(otInstance *aInstance);
+
+/**
+ * @}
+ *
+ */
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // OPENTHREAD_NETDATA_H_
diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp
index 9f7c8c055..eacdfaa81 100644
--- a/src/cli/cli.cpp
+++ b/src/cli/cli.cpp
@@ -1251,7 +1251,7 @@ exit:
void Interpreter::ProcessNetworkDataRegister(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
- SuccessOrExit(error = otSendServerData(mInstance));
+ SuccessOrExit(error = otNetDataRegister(mInstance));
exit:
(void)argc;
@@ -1672,7 +1672,7 @@ ThreadError Interpreter::ProcessPrefixAdd(int argc, char *argv[])
}
}
- error = otAddBorderRouter(mInstance, &config);
+ error = otNetDataAddPrefixInfo(mInstance, &config);
exit:
return error;
@@ -1705,7 +1705,7 @@ ThreadError Interpreter::ProcessPrefixRemove(int argc, char *argv[])
ExitNow(error = kThreadError_Parse);
}
- error = otRemoveBorderRouter(mInstance, &prefix);
+ error = otNetDataRemovePrefixInfo(mInstance, &prefix);
exit:
(void)argc;
@@ -1717,7 +1717,7 @@ ThreadError Interpreter::ProcessPrefixList(void)
otNetworkDataIterator iterator = OT_NETWORK_DATA_ITERATOR_INIT;
otBorderRouterConfig config;
- while (otGetNextOnMeshPrefix(mInstance, true, &iterator, &config) == kThreadError_None)
+ while (otNetDataGetNextPrefixInfo(mInstance, true, &iterator, &config) == kThreadError_None)
{
sServer->OutputFormat("%x:%x:%x:%x::/%d ",
HostSwap16(config.mPrefix.mPrefix.mFields.m16[0]),
@@ -1889,7 +1889,7 @@ ThreadError Interpreter::ProcessRouteAdd(int argc, char *argv[])
}
}
- error = otAddExternalRoute(mInstance, &config);
+ error = otNetDataAddRoute(mInstance, &config);
exit:
return error;
@@ -1923,7 +1923,7 @@ ThreadError Interpreter::ProcessRouteRemove(int argc, char *argv[])
ExitNow(error = kThreadError_Parse);
}
- error = otRemoveExternalRoute(mInstance, &prefix);
+ error = otNetDataRemoveRoute(mInstance, &prefix);
exit:
return error;
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index c67c1c24c..6177108cf 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -44,6 +44,7 @@ SOURCES_COMMON = \
api/ip6_api.cpp \
api/link_api.cpp \
api/message_api.cpp \
+ api/netdata_api.cpp \
api/tasklet_api.cpp \
api/udp_api.cpp \
coap/coap_base.cpp \
diff --git a/src/core/api/netdata_api.cpp b/src/core/api/netdata_api.cpp
new file mode 100644
index 000000000..257600760
--- /dev/null
+++ b/src/core/api/netdata_api.cpp
@@ -0,0 +1,162 @@
+/*
+ * 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 Network Data API.
+ */
+
+#include "openthread/netdata.h"
+
+#include "openthread-instance.h"
+
+using namespace Thread;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ThreadError otNetDataGetLeader(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
+{
+ ThreadError error = kThreadError_None;
+
+ VerifyOrExit(aData != NULL && aDataLength != NULL, error = kThreadError_InvalidArgs);
+
+ aInstance->mThreadNetif.GetNetworkDataLeader().GetNetworkData(aStable, aData, *aDataLength);
+
+exit:
+ return error;
+}
+
+ThreadError otNetDataGetLocal(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
+{
+ ThreadError error = kThreadError_None;
+
+ VerifyOrExit(aData != NULL && aDataLength != NULL, error = kThreadError_InvalidArgs);
+
+ aInstance->mThreadNetif.GetNetworkDataLocal().GetNetworkData(aStable, aData, *aDataLength);
+
+exit:
+ return error;
+}
+
+ThreadError otNetDataAddPrefixInfo(otInstance *aInstance, const otBorderRouterConfig *aConfig)
+{
+ uint8_t flags = 0;
+
+ if (aConfig->mPreferred)
+ {
+ flags |= NetworkData::BorderRouterEntry::kPreferredFlag;
+ }
+
+ if (aConfig->mSlaac)
+ {
+ flags |= NetworkData::BorderRouterEntry::kSlaacFlag;
+ }
+
+ if (aConfig->mDhcp)
+ {
+ flags |= NetworkData::BorderRouterEntry::kDhcpFlag;
+ }
+
+ if (aConfig->mConfigure)
+ {
+ flags |= NetworkData::BorderRouterEntry::kConfigureFlag;
+ }
+
+ if (aConfig->mDefaultRoute)
+ {
+ flags |= NetworkData::BorderRouterEntry::kDefaultRouteFlag;
+ }
+
+ if (aConfig->mOnMesh)
+ {
+ flags |= NetworkData::BorderRouterEntry::kOnMeshFlag;
+ }
+
+ return aInstance->mThreadNetif.GetNetworkDataLocal().AddOnMeshPrefix(aConfig->mPrefix.mPrefix.mFields.m8,
+ aConfig->mPrefix.mLength,
+ aConfig->mPreference, flags, aConfig->mStable);
+}
+
+ThreadError otNetDataRemovePrefixInfo(otInstance *aInstance, const otIp6Prefix *aPrefix)
+{
+ return aInstance->mThreadNetif.GetNetworkDataLocal().RemoveOnMeshPrefix(aPrefix->mPrefix.mFields.m8, aPrefix->mLength);
+}
+
+ThreadError otNetDataGetNextPrefixInfo(otInstance *aInstance, bool aLocal, otNetworkDataIterator *aIterator,
+ otBorderRouterConfig *aConfig)
+{
+ ThreadError error = kThreadError_None;
+
+ VerifyOrExit(aIterator && aConfig, error = kThreadError_InvalidArgs);
+
+ if (aLocal)
+ {
+ error = aInstance->mThreadNetif.GetNetworkDataLocal().GetNextOnMeshPrefix(aIterator, aConfig);
+ }
+ else
+ {
+ error = aInstance->mThreadNetif.GetNetworkDataLeader().GetNextOnMeshPrefix(aIterator, aConfig);
+ }
+
+exit:
+ return error;
+}
+
+ThreadError otNetDataAddRoute(otInstance *aInstance, const otExternalRouteConfig *aConfig)
+{
+ return aInstance->mThreadNetif.GetNetworkDataLocal().AddHasRoutePrefix(aConfig->mPrefix.mPrefix.mFields.m8,
+ aConfig->mPrefix.mLength,
+ aConfig->mPreference, aConfig->mStable);
+}
+
+ThreadError otNetDataRemoveRoute(otInstance *aInstance, const otIp6Prefix *aPrefix)
+{
+ return aInstance->mThreadNetif.GetNetworkDataLocal().RemoveHasRoutePrefix(aPrefix->mPrefix.mFields.m8,
+ aPrefix->mLength);
+}
+
+ThreadError otNetDataRegister(otInstance *aInstance)
+{
+ return aInstance->mThreadNetif.GetNetworkDataLocal().SendServerDataNotification();
+}
+
+uint8_t otNetDataGetVersion(otInstance *aInstance)
+{
+ return aInstance->mThreadNetif.GetMle().GetLeaderDataTlv().GetDataVersion();
+}
+
+uint8_t otNetDataGetStableVersion(otInstance *aInstance)
+{
+ return aInstance->mThreadNetif.GetMle().GetLeaderDataTlv().GetStableDataVersion();
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/src/core/net/dhcp6_client.cpp b/src/core/net/dhcp6_client.cpp
index ad797449a..898cb8710 100644
--- a/src/core/net/dhcp6_client.cpp
+++ b/src/core/net/dhcp6_client.cpp
@@ -95,7 +95,7 @@ void Dhcp6Client::UpdateAddresses(otInstance *aInstance, otDhcpAddress *aAddress
found = false;
iterator = OT_NETWORK_DATA_ITERATOR_INIT;
- while ((otGetNextOnMeshPrefix(aInstance, false, &iterator, &config)) == kThreadError_None)
+ while ((otNetDataGetNextPrefixInfo(aInstance, false, &iterator, &config)) == kThreadError_None)
{
if (!config.mDhcp)
{
@@ -122,7 +122,7 @@ void Dhcp6Client::UpdateAddresses(otInstance *aInstance, otDhcpAddress *aAddress
// add IdentityAssociation for new configured prefix
iterator = OT_NETWORK_DATA_ITERATOR_INIT;
- while (otGetNextOnMeshPrefix(aInstance, false, &iterator, &config) == kThreadError_None)
+ while (otNetDataGetNextPrefixInfo(aInstance, false, &iterator, &config) == kThreadError_None)
{
if (!config.mDhcp)
{
diff --git a/src/core/openthread.cpp b/src/core/openthread.cpp
index bf62a1550..5191d4b77 100644
--- a/src/core/openthread.cpp
+++ b/src/core/openthread.cpp
@@ -234,30 +234,6 @@ ThreadError otSetMeshLocalPrefix(otInstance *aInstance, const uint8_t *aMeshLoca
return aInstance->mThreadNetif.GetMle().SetMeshLocalPrefix(aMeshLocalPrefix);
}
-ThreadError otGetNetworkDataLeader(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
-{
- ThreadError error = kThreadError_None;
-
- VerifyOrExit(aData != NULL && aDataLength != NULL, error = kThreadError_InvalidArgs);
-
- aInstance->mThreadNetif.GetNetworkDataLeader().GetNetworkData(aStable, aData, *aDataLength);
-
-exit:
- return error;
-}
-
-ThreadError otGetNetworkDataLocal(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
-{
- ThreadError error = kThreadError_None;
-
- VerifyOrExit(aData != NULL && aDataLength != NULL, error = kThreadError_InvalidArgs);
-
- aInstance->mThreadNetif.GetNetworkDataLocal().GetNetworkData(aStable, aData, *aDataLength);
-
-exit:
- return error;
-}
-
const char *otGetNetworkName(otInstance *aInstance)
{
return aInstance->mThreadNetif.GetMac().GetNetworkName();
@@ -308,88 +284,6 @@ ThreadError otSetJoinerUdpPort(otInstance *aInstance, uint16_t aJoinerUdpPort)
return aInstance->mThreadNetif.GetJoinerRouter().SetJoinerUdpPort(aJoinerUdpPort);
}
-ThreadError otAddBorderRouter(otInstance *aInstance, const otBorderRouterConfig *aConfig)
-{
- uint8_t flags = 0;
-
- if (aConfig->mPreferred)
- {
- flags |= NetworkData::BorderRouterEntry::kPreferredFlag;
- }
-
- if (aConfig->mSlaac)
- {
- flags |= NetworkData::BorderRouterEntry::kSlaacFlag;
- }
-
- if (aConfig->mDhcp)
- {
- flags |= NetworkData::BorderRouterEntry::kDhcpFlag;
- }
-
- if (aConfig->mConfigure)
- {
- flags |= NetworkData::BorderRouterEntry::kConfigureFlag;
- }
-
- if (aConfig->mDefaultRoute)
- {
- flags |= NetworkData::BorderRouterEntry::kDefaultRouteFlag;
- }
-
- if (aConfig->mOnMesh)
- {
- flags |= NetworkData::BorderRouterEntry::kOnMeshFlag;
- }
-
- return aInstance->mThreadNetif.GetNetworkDataLocal().AddOnMeshPrefix(aConfig->mPrefix.mPrefix.mFields.m8,
- aConfig->mPrefix.mLength,
- aConfig->mPreference, flags, aConfig->mStable);
-}
-
-ThreadError otRemoveBorderRouter(otInstance *aInstance, const otIp6Prefix *aPrefix)
-{
- return aInstance->mThreadNetif.GetNetworkDataLocal().RemoveOnMeshPrefix(aPrefix->mPrefix.mFields.m8, aPrefix->mLength);
-}
-
-ThreadError otGetNextOnMeshPrefix(otInstance *aInstance, bool aLocal, otNetworkDataIterator *aIterator,
- otBorderRouterConfig *aConfig)
-{
- ThreadError error = kThreadError_None;
-
- VerifyOrExit(aIterator && aConfig, error = kThreadError_InvalidArgs);
-
- if (aLocal)
- {
- error = aInstance->mThreadNetif.GetNetworkDataLocal().GetNextOnMeshPrefix(aIterator, aConfig);
- }
- else
- {
- error = aInstance->mThreadNetif.GetNetworkDataLeader().GetNextOnMeshPrefix(aIterator, aConfig);
- }
-
-exit:
- return error;
-}
-
-ThreadError otAddExternalRoute(otInstance *aInstance, const otExternalRouteConfig *aConfig)
-{
- return aInstance->mThreadNetif.GetNetworkDataLocal().AddHasRoutePrefix(aConfig->mPrefix.mPrefix.mFields.m8,
- aConfig->mPrefix.mLength,
- aConfig->mPreference, aConfig->mStable);
-}
-
-ThreadError otRemoveExternalRoute(otInstance *aInstance, const otIp6Prefix *aPrefix)
-{
- return aInstance->mThreadNetif.GetNetworkDataLocal().RemoveHasRoutePrefix(aPrefix->mPrefix.mFields.m8,
- aPrefix->mLength);
-}
-
-ThreadError otSendServerData(otInstance *aInstance)
-{
- return aInstance->mThreadNetif.GetNetworkDataLocal().SendServerDataNotification();
-}
-
uint32_t otGetContextIdReuseDelay(otInstance *aInstance)
{
return aInstance->mThreadNetif.GetNetworkDataLeader().GetContextIdReuseDelay();
@@ -624,11 +518,6 @@ uint8_t otGetLeaderWeight(otInstance *aInstance)
return aInstance->mThreadNetif.GetMle().GetLeaderDataTlv().GetWeighting();
}
-uint8_t otGetNetworkDataVersion(otInstance *aInstance)
-{
- return aInstance->mThreadNetif.GetMle().GetLeaderDataTlv().GetDataVersion();
-}
-
uint32_t otGetPartitionId(otInstance *aInstance)
{
return aInstance->mThreadNetif.GetMle().GetLeaderDataTlv().GetPartitionId();
@@ -696,11 +585,6 @@ exit:
return error;
}
-uint8_t otGetStableNetworkDataVersion(otInstance *aInstance)
-{
- return aInstance->mThreadNetif.GetMle().GetLeaderDataTlv().GetStableDataVersion();
-}
-
ThreadError otSetStateChangedCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aCallbackContext)
{
ThreadError error = kThreadError_NoBufs;
diff --git a/src/core/utils/slaac_address.cpp b/src/core/utils/slaac_address.cpp
index 350247678..8b7fa970c 100644
--- a/src/core/utils/slaac_address.cpp
+++ b/src/core/utils/slaac_address.cpp
@@ -70,7 +70,7 @@ void Slaac::UpdateAddresses(otInstance *aInstance, otNetifAddress *aAddresses, u
iterator = OT_NETWORK_DATA_ITERATOR_INIT;
- while (otGetNextOnMeshPrefix(aInstance, false, &iterator, &config) == kThreadError_None)
+ while (otNetDataGetNextPrefixInfo(aInstance, false, &iterator, &config) == kThreadError_None)
{
if (config.mSlaac == false)
{
@@ -95,7 +95,7 @@ void Slaac::UpdateAddresses(otInstance *aInstance, otNetifAddress *aAddresses, u
// add addresses
iterator = OT_NETWORK_DATA_ITERATOR_INIT;
- while (otGetNextOnMeshPrefix(aInstance, false, &iterator, &config) == kThreadError_None)
+ while (otNetDataGetNextPrefixInfo(aInstance, false, &iterator, &config) == kThreadError_None)
{
bool found = false;
diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp
index 84bc9e4ca..378ab59c8 100644
--- a/src/ncp/ncp_base.cpp
+++ b/src/ncp/ncp_base.cpp
@@ -2195,7 +2195,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_NETWORK_DATA_VERSION(uint8_t head
SPINEL_CMD_PROP_VALUE_IS,
key,
SPINEL_DATATYPE_UINT8_S,
- otGetNetworkDataVersion(mInstance)
+ otNetDataGetVersion(mInstance)
);
}
@@ -2206,7 +2206,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_STABLE_NETWORK_DATA_VERSION(uint8
SPINEL_CMD_PROP_VALUE_IS,
key,
SPINEL_DATATYPE_UINT8_S,
- otGetStableNetworkDataVersion(mInstance)
+ otNetDataGetStableVersion(mInstance)
);
}
@@ -2216,7 +2216,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_NETWORK_DATA(uint8_t header, spin
uint8_t network_data[255];
uint8_t network_data_len = 255;
- otGetNetworkDataLocal(
+ otNetDataGetLocal(
mInstance,
false, // Stable?
network_data,
@@ -2238,7 +2238,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_STABLE_NETWORK_DATA(uint8_t heade
uint8_t network_data[255];
uint8_t network_data_len = 255;
- otGetNetworkDataLocal(
+ otNetDataGetLocal(
mInstance,
true, // Stable?
network_data,
@@ -2260,7 +2260,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_LEADER_NETWORK_DATA(uint8_t heade
uint8_t network_data[255];
uint8_t network_data_len = 255;
- otGetNetworkDataLeader(
+ otNetDataGetLeader(
mInstance,
false, // Stable?
network_data,
@@ -2282,7 +2282,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_STABLE_LEADER_NETWORK_DATA(uint8_
uint8_t network_data[255];
uint8_t network_data_len = 255;
- otGetNetworkDataLeader(
+ otNetDataGetLeader(
mInstance,
true, // Stable?
network_data,
@@ -2581,7 +2581,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spin
// Fill from non-local network data first
for (otNetworkDataIterator iter = OT_NETWORK_DATA_ITERATOR_INIT ;;)
{
- errorCode = otGetNextOnMeshPrefix(mInstance, false, &iter, &border_router_config);
+ errorCode = otNetDataGetNextPrefixInfo(mInstance, false, &iter, &border_router_config);
if (errorCode != kThreadError_None)
{
@@ -2609,7 +2609,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spin
// Fill from local network data last
for (otNetworkDataIterator iter = OT_NETWORK_DATA_ITERATOR_INIT ;;)
{
- errorCode = otGetNextOnMeshPrefix(mInstance, true, &iter, &border_router_config);
+ errorCode = otNetDataGetNextPrefixInfo(mInstance, true, &iter, &border_router_config);
if (errorCode != kThreadError_None)
{
@@ -4662,7 +4662,7 @@ ThreadError NcpBase::SetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8
if (should_register_with_leader)
{
- otSendServerData(mInstance);
+ otNetDataRegister(mInstance);
}
return errorCode;
@@ -5695,7 +5695,7 @@ ThreadError NcpBase::InsertPropertyHandler_THREAD_LOCAL_ROUTES(uint8_t header, s
ext_route_config.mPrefix.mPrefix = *addr_ptr;
ext_route_config.mStable = stable;
ext_route_config.mPreference = ((flags & kPreferenceMask) >> kPreferenceOffset);
- errorCode = otAddExternalRoute(mInstance, &ext_route_config);
+ errorCode = otNetDataAddRoute(mInstance, &ext_route_config);
if (errorCode == kThreadError_None)
{
@@ -5770,7 +5770,7 @@ ThreadError NcpBase::InsertPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, s
border_router_config.mDefaultRoute = ((flags & kDefaultRouteFlag) == kDefaultRouteFlag);
border_router_config.mOnMesh = ((flags & kOnMeshFlag) == kOnMeshFlag);
- errorCode = otAddBorderRouter(mInstance, &border_router_config);
+ errorCode = otNetDataAddPrefixInfo(mInstance, &border_router_config);
if (errorCode == kThreadError_None)
{
@@ -6057,7 +6057,7 @@ ThreadError NcpBase::RemovePropertyHandler_THREAD_LOCAL_ROUTES(uint8_t header, s
if (parsedLength > 0)
{
ip6_prefix.mPrefix = *addr_ptr;
- errorCode = otRemoveExternalRoute(mInstance, &ip6_prefix);
+ errorCode = otNetDataRemoveRoute(mInstance, &ip6_prefix);
if (errorCode == kThreadError_None)
{
@@ -6109,7 +6109,7 @@ ThreadError NcpBase::RemovePropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, s
if (parsedLength > 0)
{
ip6_prefix.mPrefix = *addr_ptr;
- errorCode = otRemoveBorderRouter(mInstance, &ip6_prefix);
+ errorCode = otNetDataRemovePrefixInfo(mInstance, &ip6_prefix);
if (errorCode == kThreadError_None)
{