Add --enable-border-router configure option (#1834)

* Use `OPENTHREAD_ENABLE_BORDER_ROUTER` feature flag to wrap Border Router related features

* MTD devices could also act as a Border Router
This commit is contained in:
Shu Chen
2017-06-02 21:49:07 -07:00
committed by Jonathan Hui
parent 86d740dcf1
commit 473b83b02f
36 changed files with 692 additions and 475 deletions
@@ -1610,7 +1610,7 @@ OTNODEAPI int32_t OTCALL otNodeAddPrefix(otNode* aNode, const char *aPrefix, con
return OT_ERROR_INVALID_ARGS;
}
auto result = otNetDataAddPrefixInfo(aNode->mInstance, &config);
auto result = otBorderRouterAddOnMeshPrefix(aNode->mInstance, &config);
otLogFuncExit();
return result;
}
@@ -1623,7 +1623,7 @@ OTNODEAPI int32_t OTCALL otNodeRemovePrefix(otNode* aNode, const char *aPrefix)
auto error = otNodeParsePrefix(aPrefix, &prefix);
if (error != OT_ERROR_NONE) return error;
auto result = otNetDataRemovePrefixInfo(aNode->mInstance, &prefix);
auto result = otBorderRouterRemoveOnMeshPrefix(aNode->mInstance, &prefix);
otLogFuncExit();
return result;
}
@@ -1653,7 +1653,7 @@ OTNODEAPI int32_t OTCALL otNodeAddRoute(otNode* aNode, const char *aPrefix, cons
return OT_ERROR_INVALID_ARGS;
}
auto result = otNetDataAddRoute(aNode->mInstance, &config);
auto result = otBorderRouterAddRoute(aNode->mInstance, &config);
otLogFuncExit();
return result;
}
@@ -1666,7 +1666,7 @@ OTNODEAPI int32_t OTCALL otNodeRemoveRoute(otNode* aNode, const char *aPrefix)
auto error = otNodeParsePrefix(aPrefix, &prefix);
if (error != OT_ERROR_NONE) return error;
auto result = otNetDataRemoveRoute(aNode->mInstance, &prefix);
auto result = otBorderRouterRemoveRoute(aNode->mInstance, &prefix);
otLogFuncExit();
return result;
}
@@ -1675,7 +1675,7 @@ OTNODEAPI int32_t OTCALL otNodeRegisterNetdata(otNode* aNode)
{
otLogFuncEntryMsg("[%d]", aNode->mId);
printf("%d: registernetdata\r\n", aNode->mId);
auto result = otNetDataRegister(aNode->mInstance);
auto result = otBorderRouterRegister(aNode->mInstance);
otLogFuncExit();
return result;
}