mirror of
https://github.com/espressif/openthread.git
synced 2026-08-07 03:07:47 +00:00
[core] move border agent into thread_netif (#2893)
This commit is contained in:
@@ -47,7 +47,7 @@ otError otCommissionerStart(otInstance *aInstance)
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT
|
||||
SuccessOrExit(error = instance.GetBorderAgent().Stop());
|
||||
SuccessOrExit(error = instance.Get<MeshCoP::BorderAgent>().Stop());
|
||||
#endif
|
||||
SuccessOrExit(error = instance.GetThreadNetif().GetCommissioner().Start());
|
||||
exit:
|
||||
@@ -65,7 +65,7 @@ otError otCommissionerStop(otInstance *aInstance)
|
||||
|
||||
SuccessOrExit(error = instance.GetThreadNetif().GetCommissioner().Stop());
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT
|
||||
SuccessOrExit(error = instance.GetBorderAgent().Start());
|
||||
SuccessOrExit(error = instance.Get<MeshCoP::BorderAgent>().Start());
|
||||
#endif
|
||||
exit:
|
||||
#endif
|
||||
|
||||
@@ -64,9 +64,6 @@ Instance::Instance(void)
|
||||
, mSettings(*this)
|
||||
, mIp6(*this)
|
||||
, mThreadNetif(*this)
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT
|
||||
, mBorderAgent(*this)
|
||||
#endif
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
, mApplicationCoap(*this)
|
||||
#endif
|
||||
|
||||
@@ -366,9 +366,6 @@ public:
|
||||
*/
|
||||
MessagePool &GetMessagePool(void) { return mMessagePool; }
|
||||
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT
|
||||
MeshCoP::BorderAgent &GetBorderAgent(void) { return mBorderAgent; }
|
||||
#endif
|
||||
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
|
||||
/**
|
||||
@@ -424,9 +421,6 @@ private:
|
||||
|
||||
Ip6::Ip6 mIp6;
|
||||
ThreadNetif mThreadNetif;
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT
|
||||
MeshCoP::BorderAgent mBorderAgent;
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
Coap::ApplicationCoap mApplicationCoap;
|
||||
@@ -651,7 +645,7 @@ template <> inline Utils::ChannelManager &Instance::Get(void)
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT
|
||||
template <> inline MeshCoP::BorderAgent &Instance::Get(void)
|
||||
{
|
||||
return mBorderAgent;
|
||||
return GetThreadNetif().GetBorderAgent();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -308,11 +308,11 @@ void Mle::SetRole(otDeviceRole aRole)
|
||||
// Start border agent
|
||||
if (aRole == OT_DEVICE_ROLE_ROUTER || aRole == OT_DEVICE_ROLE_LEADER || aRole == OT_DEVICE_ROLE_CHILD)
|
||||
{
|
||||
SuccessOrExit(GetInstance().GetBorderAgent().Start());
|
||||
SuccessOrExit(GetInstance().Get<MeshCoP::BorderAgent>().Start());
|
||||
}
|
||||
else
|
||||
{
|
||||
SuccessOrExit(GetInstance().GetBorderAgent().Stop());
|
||||
SuccessOrExit(GetInstance().Get<MeshCoP::BorderAgent>().Stop());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -76,6 +76,9 @@ ThreadNetif::ThreadNetif(Instance &aInstance)
|
||||
, mNetworkDiagnostic(aInstance)
|
||||
#endif
|
||||
, mIsUp(false)
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT
|
||||
, mBorderAgent(aInstance)
|
||||
#endif
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
, mCommissioner(aInstance)
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
#include "coap/coap_secure.hpp"
|
||||
#include "mac/mac.hpp"
|
||||
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT
|
||||
#include "meshcop/border_agent.hpp"
|
||||
#endif
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
#include "meshcop/commissioner.hpp"
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
@@ -319,6 +322,15 @@ public:
|
||||
*/
|
||||
AnnounceBeginServer &GetAnnounceBeginServer(void) { return mAnnounceBegin; }
|
||||
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT
|
||||
/**
|
||||
* This method returns a reference to the border agent object.
|
||||
*
|
||||
* @returns A reference to the border agent object.
|
||||
*
|
||||
*/
|
||||
MeshCoP::BorderAgent &GetBorderAgent(void) { return mBorderAgent; }
|
||||
#endif
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
/**
|
||||
* This method returns a reference to the commissioner object.
|
||||
@@ -448,6 +460,9 @@ private:
|
||||
#endif // OPENTHREAD_FTD || OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC
|
||||
bool mIsUp;
|
||||
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT
|
||||
MeshCoP::BorderAgent mBorderAgent;
|
||||
#endif
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
MeshCoP::Commissioner mCommissioner;
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
|
||||
Reference in New Issue
Block a user