mirror of
https://github.com/espressif/openthread.git
synced 2026-07-28 14:47:46 +00:00
[commissioner] add provisioning URL member variable (#3863)
This commit moves the definition of Provisioning URL TLV member variable to `Commissioner` class (from `Dtls` class).
This commit is contained in:
committed by
Jonathan Hui
parent
e458ef8f5f
commit
d7c0e9e716
@@ -79,6 +79,7 @@ Commissioner::Commissioner(Instance &aInstance)
|
||||
mCommissionerAloc.mValid = true;
|
||||
mCommissionerAloc.mScopeOverride = Ip6::Address::kRealmLocalScope;
|
||||
mCommissionerAloc.mScopeOverrideValid = true;
|
||||
mProvisioningUrl.Init();
|
||||
}
|
||||
|
||||
void Commissioner::AddCoapResources(void)
|
||||
@@ -312,11 +313,9 @@ exit:
|
||||
|
||||
const char *Commissioner::GetProvisioningUrl(uint16_t &aLength) const
|
||||
{
|
||||
ProvisioningUrlTlv &provisioningUrl = Get<Coap::CoapSecure>().GetDtls().mProvisioningUrl;
|
||||
aLength = mProvisioningUrl.GetLength();
|
||||
|
||||
aLength = provisioningUrl.GetLength();
|
||||
|
||||
return provisioningUrl.GetProvisioningUrl();
|
||||
return mProvisioningUrl.GetProvisioningUrl();
|
||||
}
|
||||
|
||||
otError Commissioner::SetProvisioningUrl(const char *aProvisioningUrl)
|
||||
@@ -329,7 +328,7 @@ otError Commissioner::SetProvisioningUrl(const char *aProvisioningUrl)
|
||||
VerifyOrExit(len <= MeshCoP::ProvisioningUrlTlv::kMaxLength, error = OT_ERROR_INVALID_ARGS);
|
||||
}
|
||||
|
||||
Get<Coap::CoapSecure>().GetDtls().mProvisioningUrl.SetProvisioningUrl(aProvisioningUrl);
|
||||
mProvisioningUrl.SetProvisioningUrl(aProvisioningUrl);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -903,9 +902,8 @@ void Commissioner::HandleJoinerFinalize(Coap::Message &aMessage, const Ip6::Mess
|
||||
|
||||
if (Tlv::GetTlv(aMessage, Tlv::kProvisioningUrl, sizeof(provisioningUrl), provisioningUrl) == OT_ERROR_NONE)
|
||||
{
|
||||
if (provisioningUrl.GetLength() != Get<Coap::CoapSecure>().GetDtls().mProvisioningUrl.GetLength() ||
|
||||
memcmp(provisioningUrl.GetProvisioningUrl(),
|
||||
Get<Coap::CoapSecure>().GetDtls().mProvisioningUrl.GetProvisioningUrl(),
|
||||
if (provisioningUrl.GetLength() != mProvisioningUrl.GetLength() ||
|
||||
memcmp(provisioningUrl.GetProvisioningUrl(), mProvisioningUrl.GetProvisioningUrl(),
|
||||
provisioningUrl.GetLength()) != 0)
|
||||
{
|
||||
state = StateTlv::kReject;
|
||||
|
||||
@@ -332,6 +332,8 @@ private:
|
||||
|
||||
Ip6::NetifUnicastAddress mCommissionerAloc;
|
||||
|
||||
ProvisioningUrlTlv mProvisioningUrl;
|
||||
|
||||
otCommissionerState mState;
|
||||
};
|
||||
|
||||
|
||||
@@ -109,8 +109,6 @@ Dtls::Dtls(Instance &aInstance, bool aLayerTwoSecurity)
|
||||
#ifdef MBEDTLS_SSL_COOKIE_C
|
||||
memset(&mCookieCtx, 0, sizeof(mCookieCtx));
|
||||
#endif
|
||||
|
||||
mProvisioningUrl.Init();
|
||||
}
|
||||
|
||||
void Dtls::FreeMbedtls(void)
|
||||
|
||||
@@ -387,12 +387,6 @@ public:
|
||||
*/
|
||||
const Ip6::MessageInfo &GetPeerAddress(void) const { return mPeerAddress; }
|
||||
|
||||
/**
|
||||
* The provisioning URL is placed here so that both the Commissioner and Joiner can share the same object.
|
||||
*
|
||||
*/
|
||||
ProvisioningUrlTlv mProvisioningUrl;
|
||||
|
||||
void HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user