mirror of
https://github.com/espressif/openthread.git
synced 2026-09-14 13:10:08 +00:00
[logging] remove otLogFunc<Entry/Exit> macros (#2438)
This commit is contained in:
committed by
Jonathan Hui
parent
16f3213973
commit
f366e4f987
@@ -50,10 +50,8 @@ otInstance *otInstanceInit(void *aInstanceBuffer, size_t *aInstanceBufferSize)
|
|||||||
{
|
{
|
||||||
Instance *instance;
|
Instance *instance;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
instance = Instance::Init(aInstanceBuffer, aInstanceBufferSize);
|
instance = Instance::Init(aInstanceBuffer, aInstanceBufferSize);
|
||||||
otLogInfoApi(*instance, "otInstance Initialized");
|
otLogInfoApi(*instance, "otInstance Initialized");
|
||||||
otLogFuncExit();
|
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@@ -76,9 +74,7 @@ void otInstanceFinalize(otInstance *aInstance)
|
|||||||
{
|
{
|
||||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
instance.Finalize();
|
instance.Finalize();
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
otError otSetStateChangedCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aContext)
|
otError otSetStateChangedCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aContext)
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ otError otIp6SetEnabled(otInstance *aInstance, bool aEnabled)
|
|||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
if (aEnabled)
|
if (aEnabled)
|
||||||
{
|
{
|
||||||
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||||
@@ -68,7 +66,6 @@ otError otIp6SetEnabled(otInstance *aInstance, bool aEnabled)
|
|||||||
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||||
exit:
|
exit:
|
||||||
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
|
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,13 +186,9 @@ otError otIp6Send(otInstance *aInstance, otMessage *aMessage)
|
|||||||
otError error;
|
otError error;
|
||||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
error = instance.GetIp6().SendRaw(*static_cast<Message *>(aMessage),
|
error = instance.GetIp6().SendRaw(*static_cast<Message *>(aMessage),
|
||||||
instance.GetThreadNetif().GetInterfaceId());
|
instance.GetThreadNetif().GetInterfaceId());
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +197,6 @@ otMessage *otIp6NewMessage(otInstance *aInstance, bool aLinkSecurityEnabled)
|
|||||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||||
Message *message = instance.GetMessagePool().New(Message::kTypeIp6, 0);
|
Message *message = instance.GetMessagePool().New(Message::kTypeIp6, 0);
|
||||||
|
|
||||||
|
|
||||||
if (message)
|
if (message)
|
||||||
{
|
{
|
||||||
message->SetLinkSecurityEnabled(aLinkSecurityEnabled);
|
message->SetLinkSecurityEnabled(aLinkSecurityEnabled);
|
||||||
|
|||||||
@@ -47,12 +47,11 @@ void otTaskletsProcess(otInstance *aInstance)
|
|||||||
{
|
{
|
||||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
VerifyOrExit(otInstanceIsInitialized(aInstance));
|
VerifyOrExit(otInstanceIsInitialized(aInstance));
|
||||||
instance.GetTaskletScheduler().ProcessQueuedTasklets();
|
instance.GetTaskletScheduler().ProcessQueuedTasklets();
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool otTaskletsArePending(otInstance *aInstance)
|
bool otTaskletsArePending(otInstance *aInstance)
|
||||||
|
|||||||
@@ -480,8 +480,6 @@ otError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
|
|||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
if (aEnabled)
|
if (aEnabled)
|
||||||
{
|
{
|
||||||
VerifyOrExit(instance.GetThreadNetif().GetMac().GetPanId() != Mac::kPanIdBroadcast,
|
VerifyOrExit(instance.GetThreadNetif().GetMac().GetPanId() != Mac::kPanIdBroadcast,
|
||||||
@@ -494,7 +492,6 @@ otError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,14 +131,11 @@ otError CoapSecure::SendMessage(Message &aMessage, otCoapResponseHandler aHandle
|
|||||||
{
|
{
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(IsConnected(), error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(IsConnected(), error = OT_ERROR_INVALID_STATE);
|
||||||
|
|
||||||
error = CoapBase::SendMessage(aMessage, mPeerAddress, aHandler, aContext);
|
error = CoapBase::SendMessage(aMessage, mPeerAddress, aHandler, aContext);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,8 +155,6 @@ void CoapSecure::Receive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo
|
|||||||
{
|
{
|
||||||
ThreadNetif &netif = GetNetif();
|
ThreadNetif &netif = GetNetif();
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
if (!netif.GetDtls().IsStarted())
|
if (!netif.GetDtls().IsStarted())
|
||||||
{
|
{
|
||||||
Ip6::SockAddr sockAddr;
|
Ip6::SockAddr sockAddr;
|
||||||
@@ -193,7 +188,7 @@ void CoapSecure::Receive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo
|
|||||||
netif.GetDtls().Receive(aMessage, aMessage.GetOffset(), aMessage.GetLength() - aMessage.GetOffset());
|
netif.GetDtls().Receive(aMessage, aMessage.GetOffset(), aMessage.GetLength() - aMessage.GetOffset());
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoapSecure::HandleDtlsConnected(void *aContext, bool aConnected)
|
void CoapSecure::HandleDtlsConnected(void *aContext, bool aConnected)
|
||||||
@@ -218,8 +213,6 @@ void CoapSecure::HandleDtlsReceive(uint8_t *aBuf, uint16_t aLength)
|
|||||||
{
|
{
|
||||||
Message *message = NULL;
|
Message *message = NULL;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit((message = GetInstance().GetMessagePool().New(Message::kTypeIp6, 0)) != NULL);
|
VerifyOrExit((message = GetInstance().GetMessagePool().New(Message::kTypeIp6, 0)) != NULL);
|
||||||
SuccessOrExit(message->Append(aBuf, aLength));
|
SuccessOrExit(message->Append(aBuf, aLength));
|
||||||
|
|
||||||
@@ -231,8 +224,6 @@ exit:
|
|||||||
{
|
{
|
||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
otError CoapSecure::HandleDtlsSend(void *aContext, const uint8_t *aBuf, uint16_t aLength, uint8_t aMessageSubType)
|
otError CoapSecure::HandleDtlsSend(void *aContext, const uint8_t *aBuf, uint16_t aLength, uint8_t aMessageSubType)
|
||||||
@@ -244,8 +235,6 @@ otError CoapSecure::HandleDtlsSend(const uint8_t *aBuf, uint16_t aLength, uint8_
|
|||||||
{
|
{
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
if (mTransmitMessage == NULL)
|
if (mTransmitMessage == NULL)
|
||||||
{
|
{
|
||||||
VerifyOrExit((mTransmitMessage = mSocket.NewMessage(0)) != NULL, error = OT_ERROR_NO_BUFS);
|
VerifyOrExit((mTransmitMessage = mSocket.NewMessage(0)) != NULL, error = OT_ERROR_NO_BUFS);
|
||||||
@@ -271,8 +260,6 @@ exit:
|
|||||||
mTransmitMessage = NULL;
|
mTransmitMessage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,8 +272,6 @@ void CoapSecure::HandleUdpTransmit(void)
|
|||||||
{
|
{
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(mTransmitMessage != NULL, error = OT_ERROR_NO_BUFS);
|
VerifyOrExit(mTransmitMessage != NULL, error = OT_ERROR_NO_BUFS);
|
||||||
|
|
||||||
if (mTransportCallback)
|
if (mTransportCallback)
|
||||||
@@ -306,8 +291,6 @@ exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
mTransmitMessage = NULL;
|
mTransmitMessage = NULL;
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoapSecure::HandleRetransmissionTimer(Timer &aTimer)
|
void CoapSecure::HandleRetransmissionTimer(Timer &aTimer)
|
||||||
|
|||||||
@@ -58,14 +58,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WINDOWS_LOGGING
|
|
||||||
#define otLogFuncEntry()
|
|
||||||
#define otLogFuncEntryMsg(aFormat, ...)
|
|
||||||
#define otLogFuncExit()
|
|
||||||
#define otLogFuncExitMsg(aFormat, ...)
|
|
||||||
#define otLogFuncExitErr(error)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def otLogCrit
|
* @def otLogCrit
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -215,13 +215,11 @@ extern "C" void otPlatAlarmMilliFired(otInstance *aInstance)
|
|||||||
{
|
{
|
||||||
Instance *instance = static_cast<Instance *>(aInstance);
|
Instance *instance = static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(otInstanceIsInitialized(aInstance));
|
VerifyOrExit(otInstanceIsInitialized(aInstance));
|
||||||
instance->GetTimerMilliScheduler().ProcessTimers();
|
instance->GetTimerMilliScheduler().ProcessTimers();
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||||
@@ -253,13 +251,11 @@ extern "C" void otPlatAlarmMicroFired(otInstance *aInstance)
|
|||||||
{
|
{
|
||||||
Instance *instance = static_cast<Instance *>(aInstance);
|
Instance *instance = static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(otInstanceIsInitialized(aInstance));
|
VerifyOrExit(otInstanceIsInitialized(aInstance));
|
||||||
instance->GetTimerMicroScheduler().ProcessTimers();
|
instance->GetTimerMicroScheduler().ProcessTimers();
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
#endif // OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
#endif // OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
|
||||||
|
|
||||||
|
|||||||
+6
-20
@@ -419,8 +419,6 @@ void Mac::SetExtAddress(const ExtAddress &aExtAddress)
|
|||||||
{
|
{
|
||||||
otExtAddress address;
|
otExtAddress address;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
for (size_t i = 0; i < sizeof(address); i++)
|
for (size_t i = 0; i < sizeof(address); i++)
|
||||||
{
|
{
|
||||||
address.m8[i] = aExtAddress.m8[7 - i];
|
address.m8[i] = aExtAddress.m8[7 - i];
|
||||||
@@ -428,16 +426,13 @@ void Mac::SetExtAddress(const ExtAddress &aExtAddress)
|
|||||||
|
|
||||||
otPlatRadioSetExtendedAddress(&GetInstance(), &address);
|
otPlatRadioSetExtendedAddress(&GetInstance(), &address);
|
||||||
mExtAddress = aExtAddress;
|
mExtAddress = aExtAddress;
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
otError Mac::SetShortAddress(ShortAddress aShortAddress)
|
otError Mac::SetShortAddress(ShortAddress aShortAddress)
|
||||||
{
|
{
|
||||||
otLogFuncEntryMsg("%d", aShortAddress);
|
|
||||||
mShortAddress = aShortAddress;
|
mShortAddress = aShortAddress;
|
||||||
otPlatRadioSetShortAddress(&GetInstance(), aShortAddress);
|
otPlatRadioSetShortAddress(&GetInstance(), aShortAddress);
|
||||||
otLogFuncExit();
|
|
||||||
return OT_ERROR_NONE;
|
return OT_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,15 +440,12 @@ otError Mac::SetChannel(uint8_t aChannel)
|
|||||||
{
|
{
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
otLogFuncEntryMsg("%d", aChannel);
|
|
||||||
|
|
||||||
VerifyOrExit(OT_RADIO_CHANNEL_MIN <= aChannel && aChannel <= OT_RADIO_CHANNEL_MAX, error = OT_ERROR_INVALID_ARGS);
|
VerifyOrExit(OT_RADIO_CHANNEL_MIN <= aChannel && aChannel <= OT_RADIO_CHANNEL_MAX, error = OT_ERROR_INVALID_ARGS);
|
||||||
|
|
||||||
mChannel = aChannel;
|
mChannel = aChannel;
|
||||||
UpdateIdleMode();
|
UpdateIdleMode();
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,23 +453,19 @@ otError Mac::SetNetworkName(const char *aNetworkName)
|
|||||||
{
|
{
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
otLogFuncEntryMsg("%s", aNetworkName);
|
|
||||||
|
|
||||||
VerifyOrExit(strlen(aNetworkName) <= OT_NETWORK_NAME_MAX_SIZE, error = OT_ERROR_INVALID_ARGS);
|
VerifyOrExit(strlen(aNetworkName) <= OT_NETWORK_NAME_MAX_SIZE, error = OT_ERROR_INVALID_ARGS);
|
||||||
|
|
||||||
(void)strlcpy(mNetworkName.m8, aNetworkName, sizeof(mNetworkName));
|
(void)strlcpy(mNetworkName.m8, aNetworkName, sizeof(mNetworkName));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
otError Mac::SetPanId(PanId aPanId)
|
otError Mac::SetPanId(PanId aPanId)
|
||||||
{
|
{
|
||||||
otLogFuncEntryMsg("%d", aPanId);
|
|
||||||
mPanId = aPanId;
|
mPanId = aPanId;
|
||||||
otPlatRadioSetPanId(&GetInstance(), mPanId);
|
otPlatRadioSetPanId(&GetInstance(), mPanId);
|
||||||
otLogFuncExit();
|
|
||||||
return OT_ERROR_NONE;
|
return OT_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -977,11 +965,11 @@ extern "C" void otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame
|
|||||||
{
|
{
|
||||||
Instance *instance = static_cast<Instance *>(aInstance);
|
Instance *instance = static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
VerifyOrExit(instance->IsInitialized());
|
VerifyOrExit(instance->IsInitialized());
|
||||||
instance->GetThreadNetif().GetMac().HandleTransmitStarted(aFrame);
|
instance->GetThreadNetif().GetMac().HandleTransmitStarted(aFrame);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mac::HandleTransmitStarted(otRadioFrame *aFrame)
|
void Mac::HandleTransmitStarted(otRadioFrame *aFrame)
|
||||||
@@ -1000,7 +988,6 @@ extern "C" void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, o
|
|||||||
{
|
{
|
||||||
Instance *instance = static_cast<Instance *>(aInstance);
|
Instance *instance = static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
otLogFuncEntryMsg("%!otError!", aError);
|
|
||||||
VerifyOrExit(instance->IsInitialized());
|
VerifyOrExit(instance->IsInitialized());
|
||||||
|
|
||||||
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||||
@@ -1016,7 +1003,7 @@ extern "C" void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, o
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mac::HandleTransmitDone(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
|
void Mac::HandleTransmitDone(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
|
||||||
@@ -1496,7 +1483,6 @@ extern "C" void otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFra
|
|||||||
{
|
{
|
||||||
Instance *instance = static_cast<Instance *>(aInstance);
|
Instance *instance = static_cast<Instance *>(aInstance);
|
||||||
|
|
||||||
otLogFuncEntryMsg("%!otError!", aError);
|
|
||||||
VerifyOrExit(instance->IsInitialized());
|
VerifyOrExit(instance->IsInitialized());
|
||||||
|
|
||||||
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||||
@@ -1512,7 +1498,7 @@ extern "C" void otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFra
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mac::HandleReceivedFrame(Frame *aFrame, otError aError)
|
void Mac::HandleReceivedFrame(Frame *aFrame, otError aError)
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ otError Commissioner::Start(void)
|
|||||||
{
|
{
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
VerifyOrExit(mState == OT_COMMISSIONER_STATE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(mState == OT_COMMISSIONER_STATE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
||||||
|
|
||||||
SuccessOrExit(error = GetNetif().GetCoapSecure().Start(OPENTHREAD_CONFIG_JOINER_UDP_PORT, SendRelayTransmit, this));
|
SuccessOrExit(error = GetNetif().GetCoapSecure().Start(OPENTHREAD_CONFIG_JOINER_UDP_PORT, SendRelayTransmit, this));
|
||||||
@@ -113,7 +112,6 @@ otError Commissioner::Start(void)
|
|||||||
SendPetition();
|
SendPetition();
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +119,6 @@ otError Commissioner::Stop(void)
|
|||||||
{
|
{
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
VerifyOrExit(mState != OT_COMMISSIONER_STATE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(mState != OT_COMMISSIONER_STATE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
||||||
|
|
||||||
GetNetif().GetCoapSecure().Stop();
|
GetNetif().GetCoapSecure().Stop();
|
||||||
@@ -138,7 +135,6 @@ otError Commissioner::Stop(void)
|
|||||||
SendKeepAlive();
|
SendKeepAlive();
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +144,6 @@ otError Commissioner::SendCommissionerSet(void)
|
|||||||
otCommissioningDataset dataset;
|
otCommissioningDataset dataset;
|
||||||
SteeringDataTlv steeringData;
|
SteeringDataTlv steeringData;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE);
|
||||||
|
|
||||||
memset(&dataset, 0, sizeof(dataset));
|
memset(&dataset, 0, sizeof(dataset));
|
||||||
@@ -186,21 +181,17 @@ otError Commissioner::SendCommissionerSet(void)
|
|||||||
SuccessOrExit(error = SendMgmtCommissionerSetRequest(dataset, NULL, 0));
|
SuccessOrExit(error = SendMgmtCommissionerSetRequest(dataset, NULL, 0));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Commissioner::ClearJoiners(void)
|
void Commissioner::ClearJoiners(void)
|
||||||
{
|
{
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
for (size_t i = 0; i < sizeof(mJoiners) / sizeof(mJoiners[0]); i++)
|
for (size_t i = 0; i < sizeof(mJoiners) / sizeof(mJoiners[0]); i++)
|
||||||
{
|
{
|
||||||
mJoiners[i].mValid = false;
|
mJoiners[i].mValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendCommissionerSet();
|
SendCommissionerSet();
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
otError Commissioner::AddJoiner(const Mac::ExtAddress *aEui64, const char *aPSKd, uint32_t aTimeout)
|
otError Commissioner::AddJoiner(const Mac::ExtAddress *aEui64, const char *aPSKd, uint32_t aTimeout)
|
||||||
@@ -209,7 +200,9 @@ otError Commissioner::AddJoiner(const Mac::ExtAddress *aEui64, const char *aPSKd
|
|||||||
|
|
||||||
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE);
|
||||||
|
|
||||||
otLogFuncEntryMsg("%llX, %s", (aEui64 ? HostSwap64(*reinterpret_cast<const uint64_t *>(aEui64)) : 0), aPSKd);
|
otLogInfoMeshCoP(GetInstance(), "AddJoiner() %llX, %s",
|
||||||
|
(aEui64 ? HostSwap64(*reinterpret_cast<const uint64_t *>(aEui64)) : 0), aPSKd);
|
||||||
|
|
||||||
VerifyOrExit(strlen(aPSKd) <= Dtls::kPskMaxLength, error = OT_ERROR_INVALID_ARGS);
|
VerifyOrExit(strlen(aPSKd) <= Dtls::kPskMaxLength, error = OT_ERROR_INVALID_ARGS);
|
||||||
RemoveJoiner(aEui64, 0); // remove immediately
|
RemoveJoiner(aEui64, 0); // remove immediately
|
||||||
|
|
||||||
@@ -242,7 +235,6 @@ otError Commissioner::AddJoiner(const Mac::ExtAddress *aEui64, const char *aPSKd
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +245,8 @@ otError Commissioner::RemoveJoiner(const Mac::ExtAddress *aEui64, uint32_t aDela
|
|||||||
|
|
||||||
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE);
|
||||||
|
|
||||||
otLogFuncEntryMsg("%llX", (aEui64 ? HostSwap64(*reinterpret_cast<const uint64_t *>(aEui64)) : 0));
|
otLogInfoMeshCoP(GetInstance(), "RemoveJoiner() %llX",
|
||||||
|
(aEui64 ? HostSwap64(*reinterpret_cast<const uint64_t *>(aEui64)) : 0));
|
||||||
|
|
||||||
if (aEui64 != NULL)
|
if (aEui64 != NULL)
|
||||||
{
|
{
|
||||||
@@ -301,7 +294,6 @@ otError Commissioner::RemoveJoiner(const Mac::ExtAddress *aEui64, uint32_t aDela
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,8 +404,6 @@ otError Commissioner::SendMgmtCommissionerGetRequest(const uint8_t *aTlvs,
|
|||||||
Ip6::MessageInfo messageInfo;
|
Ip6::MessageInfo messageInfo;
|
||||||
MeshCoP::Tlv tlv;
|
MeshCoP::Tlv tlv;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
||||||
header.SetToken(Coap::Header::kDefaultTokenLength);
|
header.SetToken(Coap::Header::kDefaultTokenLength);
|
||||||
header.AppendUriPathOptions(OT_URI_PATH_COMMISSIONER_GET);
|
header.AppendUriPathOptions(OT_URI_PATH_COMMISSIONER_GET);
|
||||||
@@ -448,7 +438,6 @@ exit:
|
|||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,16 +452,14 @@ void Commissioner::HandleMgmtCommissionerGetResponse(void *aContext, otCoapHeade
|
|||||||
void Commissioner::HandleMgmtCommissisonerGetResponse(Coap::Header *aHeader, Message *aMessage,
|
void Commissioner::HandleMgmtCommissisonerGetResponse(Coap::Header *aHeader, Message *aMessage,
|
||||||
const Ip6::MessageInfo *aMessageInfo, otError aResult)
|
const Ip6::MessageInfo *aMessageInfo, otError aResult)
|
||||||
{
|
{
|
||||||
(void) aMessage;
|
OT_UNUSED_VARIABLE(aMessage);
|
||||||
(void) aMessageInfo;
|
OT_UNUSED_VARIABLE(aMessageInfo);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED);
|
VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED);
|
||||||
otLogInfoMeshCoP(GetInstance(), "received MGMT_COMMISSIONER_GET response");
|
otLogInfoMeshCoP(GetInstance(), "received MGMT_COMMISSIONER_GET response");
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
otError Commissioner::SendMgmtCommissionerSetRequest(const otCommissioningDataset &aDataset,
|
otError Commissioner::SendMgmtCommissionerSetRequest(const otCommissioningDataset &aDataset,
|
||||||
@@ -484,8 +471,6 @@ otError Commissioner::SendMgmtCommissionerSetRequest(const otCommissioningDatase
|
|||||||
Message *message;
|
Message *message;
|
||||||
Ip6::MessageInfo messageInfo;
|
Ip6::MessageInfo messageInfo;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
||||||
header.SetToken(Coap::Header::kDefaultTokenLength);
|
header.SetToken(Coap::Header::kDefaultTokenLength);
|
||||||
header.AppendUriPathOptions(OT_URI_PATH_COMMISSIONER_SET);
|
header.AppendUriPathOptions(OT_URI_PATH_COMMISSIONER_SET);
|
||||||
@@ -552,7 +537,6 @@ exit:
|
|||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,16 +551,14 @@ void Commissioner::HandleMgmtCommissionerSetResponse(void *aContext, otCoapHeade
|
|||||||
void Commissioner::HandleMgmtCommissisonerSetResponse(Coap::Header *aHeader, Message *aMessage,
|
void Commissioner::HandleMgmtCommissisonerSetResponse(Coap::Header *aHeader, Message *aMessage,
|
||||||
const Ip6::MessageInfo *aMessageInfo, otError aResult)
|
const Ip6::MessageInfo *aMessageInfo, otError aResult)
|
||||||
{
|
{
|
||||||
(void) aMessage;
|
OT_UNUSED_VARIABLE(aMessage);
|
||||||
(void) aMessageInfo;
|
OT_UNUSED_VARIABLE(aMessageInfo);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED);
|
VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED);
|
||||||
otLogInfoMeshCoP(GetInstance(), "received MGMT_COMMISSIONER_SET response");
|
otLogInfoMeshCoP(GetInstance(), "received MGMT_COMMISSIONER_SET response");
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
otError Commissioner::SendPetition(void)
|
otError Commissioner::SendPetition(void)
|
||||||
@@ -588,8 +570,6 @@ otError Commissioner::SendPetition(void)
|
|||||||
Ip6::MessageInfo messageInfo;
|
Ip6::MessageInfo messageInfo;
|
||||||
CommissionerIdTlv commissionerId;
|
CommissionerIdTlv commissionerId;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
mTransmitAttempts++;
|
mTransmitAttempts++;
|
||||||
|
|
||||||
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
||||||
@@ -619,7 +599,6 @@ exit:
|
|||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,8 +620,6 @@ void Commissioner::HandleLeaderPetitionResponse(Coap::Header *aHeader, Message *
|
|||||||
CommissionerSessionIdTlv sessionId;
|
CommissionerSessionIdTlv sessionId;
|
||||||
bool retransmit = false;
|
bool retransmit = false;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(mState == OT_COMMISSIONER_STATE_PETITION, mState = OT_COMMISSIONER_STATE_DISABLED);
|
VerifyOrExit(mState == OT_COMMISSIONER_STATE_PETITION, mState = OT_COMMISSIONER_STATE_DISABLED);
|
||||||
VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED, retransmit = true);
|
VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED, retransmit = true);
|
||||||
|
|
||||||
@@ -678,8 +655,6 @@ exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetNotifier().SetFlags(OT_CHANGED_COMMISSIONER_STATE);
|
GetNotifier().SetFlags(OT_CHANGED_COMMISSIONER_STATE);
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
otError Commissioner::SendKeepAlive(void)
|
otError Commissioner::SendKeepAlive(void)
|
||||||
@@ -692,8 +667,6 @@ otError Commissioner::SendKeepAlive(void)
|
|||||||
StateTlv state;
|
StateTlv state;
|
||||||
CommissionerSessionIdTlv sessionId;
|
CommissionerSessionIdTlv sessionId;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
||||||
header.SetToken(Coap::Header::kDefaultTokenLength);
|
header.SetToken(Coap::Header::kDefaultTokenLength);
|
||||||
header.AppendUriPathOptions(OT_URI_PATH_LEADER_KEEP_ALIVE);
|
header.AppendUriPathOptions(OT_URI_PATH_LEADER_KEEP_ALIVE);
|
||||||
@@ -724,7 +697,6 @@ exit:
|
|||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -743,8 +715,6 @@ void Commissioner::HandleLeaderKeepAliveResponse(Coap::Header *aHeader, Message
|
|||||||
|
|
||||||
StateTlv state;
|
StateTlv state;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, mState = OT_COMMISSIONER_STATE_DISABLED);
|
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, mState = OT_COMMISSIONER_STATE_DISABLED);
|
||||||
VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED,
|
VerifyOrExit(aResult == OT_ERROR_NONE && aHeader->GetCode() == OT_COAP_CODE_CHANGED,
|
||||||
mState = OT_COMMISSIONER_STATE_DISABLED);
|
mState = OT_COMMISSIONER_STATE_DISABLED);
|
||||||
@@ -764,8 +734,6 @@ exit:
|
|||||||
{
|
{
|
||||||
RemoveCoapResources();
|
RemoveCoapResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Commissioner::HandleRelayReceive(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
void Commissioner::HandleRelayReceive(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||||
@@ -788,8 +756,6 @@ void Commissioner::HandleRelayReceive(Coap::Header &aHeader, Message &aMessage,
|
|||||||
uint16_t length;
|
uint16_t length;
|
||||||
bool enableJoiner = false;
|
bool enableJoiner = false;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE);
|
||||||
|
|
||||||
VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_NON_CONFIRMABLE &&
|
VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_NON_CONFIRMABLE &&
|
||||||
@@ -856,7 +822,8 @@ void Commissioner::HandleRelayReceive(Coap::Header &aHeader, Message &aMessage,
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
OT_UNUSED_VARIABLE(aMessageInfo);
|
OT_UNUSED_VARIABLE(aMessageInfo);
|
||||||
otLogFuncExit();
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Commissioner::HandleDatasetChanged(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
void Commissioner::HandleDatasetChanged(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||||
@@ -869,7 +836,6 @@ void Commissioner::HandleDatasetChanged(void *aContext, otCoapHeader *aHeader, o
|
|||||||
|
|
||||||
void Commissioner::HandleDatasetChanged(Coap::Header &aHeader, Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
|
void Commissioner::HandleDatasetChanged(Coap::Header &aHeader, Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
|
||||||
{
|
{
|
||||||
otLogFuncEntry();
|
|
||||||
VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE &&
|
VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE &&
|
||||||
aHeader.GetCode() == OT_COAP_CODE_POST);
|
aHeader.GetCode() == OT_COAP_CODE_POST);
|
||||||
|
|
||||||
@@ -881,7 +847,7 @@ void Commissioner::HandleDatasetChanged(Coap::Header &aHeader, Message &aMessage
|
|||||||
otLogInfoMeshCoP(GetInstance(), "sent dataset changed acknowledgment");
|
otLogInfoMeshCoP(GetInstance(), "sent dataset changed acknowledgment");
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Commissioner::HandleJoinerFinalize(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
void Commissioner::HandleJoinerFinalize(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||||
@@ -898,7 +864,6 @@ void Commissioner::HandleJoinerFinalize(Coap::Header &aHeader, Message &aMessage
|
|||||||
StateTlv::State state = StateTlv::kAccept;
|
StateTlv::State state = StateTlv::kAccept;
|
||||||
ProvisioningUrlTlv provisioningUrl;
|
ProvisioningUrlTlv provisioningUrl;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
otLogInfoMeshCoP(GetInstance(), "received joiner finalize");
|
otLogInfoMeshCoP(GetInstance(), "received joiner finalize");
|
||||||
|
|
||||||
if (Tlv::GetTlv(aMessage, Tlv::kProvisioningUrl, sizeof(provisioningUrl), provisioningUrl) == OT_ERROR_NONE)
|
if (Tlv::GetTlv(aMessage, Tlv::kProvisioningUrl, sizeof(provisioningUrl), provisioningUrl) == OT_ERROR_NONE)
|
||||||
@@ -922,8 +887,6 @@ exit:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SendJoinFinalizeResponse(aHeader, state);
|
SendJoinFinalizeResponse(aHeader, state);
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -937,8 +900,6 @@ void Commissioner::SendJoinFinalizeResponse(const Coap::Header &aRequestHeader,
|
|||||||
Message *message;
|
Message *message;
|
||||||
Mac::ExtAddress extAddr;
|
Mac::ExtAddress extAddr;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
responseHeader.SetDefaultResponseHeader(aRequestHeader);
|
responseHeader.SetDefaultResponseHeader(aRequestHeader);
|
||||||
responseHeader.SetPayloadMarker();
|
responseHeader.SetPayloadMarker();
|
||||||
|
|
||||||
@@ -977,8 +938,6 @@ exit:
|
|||||||
{
|
{
|
||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
otError Commissioner::SendRelayTransmit(void *aContext, Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
|
otError Commissioner::SendRelayTransmit(void *aContext, Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
|
||||||
@@ -1001,8 +960,6 @@ otError Commissioner::SendRelayTransmit(Message &aMessage, const Ip6::MessageInf
|
|||||||
|
|
||||||
OT_UNUSED_VARIABLE(aMessageInfo);
|
OT_UNUSED_VARIABLE(aMessageInfo);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
header.Init(OT_COAP_TYPE_NON_CONFIRMABLE, OT_COAP_CODE_POST);
|
header.Init(OT_COAP_TYPE_NON_CONFIRMABLE, OT_COAP_CODE_POST);
|
||||||
header.AppendUriPathOptions(OT_URI_PATH_RELAY_TX);
|
header.AppendUriPathOptions(OT_URI_PATH_RELAY_TX);
|
||||||
header.SetPayloadMarker();
|
header.SetPayloadMarker();
|
||||||
@@ -1052,7 +1009,6 @@ exit:
|
|||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,8 +94,6 @@ otError Joiner::Start(const char *aPSKd, const char *aProvisioningUrl,
|
|||||||
Crc16 ccitt(Crc16::kCcitt);
|
Crc16 ccitt(Crc16::kCcitt);
|
||||||
Crc16 ansi(Crc16::kAnsi);
|
Crc16 ansi(Crc16::kAnsi);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(mState == OT_JOINER_STATE_IDLE, error = OT_ERROR_BUSY);
|
VerifyOrExit(mState == OT_JOINER_STATE_IDLE, error = OT_ERROR_BUSY);
|
||||||
|
|
||||||
GetNotifier().SetFlags(OT_CHANGED_JOINER_STATE);
|
GetNotifier().SetFlags(OT_CHANGED_JOINER_STATE);
|
||||||
@@ -138,17 +136,13 @@ otError Joiner::Start(const char *aPSKd, const char *aProvisioningUrl,
|
|||||||
mState = OT_JOINER_STATE_DISCOVER;
|
mState = OT_JOINER_STATE_DISCOVER;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
otError Joiner::Stop(void)
|
otError Joiner::Stop(void)
|
||||||
{
|
{
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
return OT_ERROR_NONE;
|
return OT_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,12 +154,9 @@ otJoinerState Joiner::GetState(void) const
|
|||||||
void Joiner::Close(void)
|
void Joiner::Close(void)
|
||||||
{
|
{
|
||||||
ThreadNetif &netif = GetNetif();
|
ThreadNetif &netif = GetNetif();
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
netif.GetCoapSecure().Disconnect();
|
netif.GetCoapSecure().Disconnect();
|
||||||
netif.GetIp6Filter().RemoveUnsecurePort(netif.GetCoapSecure().GetPort());
|
netif.GetIp6Filter().RemoveUnsecurePort(netif.GetCoapSecure().GetPort());
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Joiner::Complete(otError aError)
|
void Joiner::Complete(otError aError)
|
||||||
@@ -198,13 +189,12 @@ void Joiner::HandleDiscoverResult(otActiveScanResult *aResult, void *aContext)
|
|||||||
|
|
||||||
void Joiner::HandleDiscoverResult(otActiveScanResult *aResult)
|
void Joiner::HandleDiscoverResult(otActiveScanResult *aResult)
|
||||||
{
|
{
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
if (aResult != NULL)
|
if (aResult != NULL)
|
||||||
{
|
{
|
||||||
JoinerRouter joinerRouter;
|
JoinerRouter joinerRouter;
|
||||||
|
|
||||||
otLogFuncEntryMsg("aResult = %llX", HostSwap64(*reinterpret_cast<uint64_t *>(&aResult->mExtAddress)));
|
otLogDebgMeshCoP(GetInstance(), "HandleDiscoverResult() aResult = %llX",
|
||||||
|
HostSwap64(*reinterpret_cast<uint64_t *>(&aResult->mExtAddress)));
|
||||||
|
|
||||||
// Joining is disabled if the Steering Data is not included
|
// Joining is disabled if the Steering Data is not included
|
||||||
if (aResult->mSteeringData.mLength == 0)
|
if (aResult->mSteeringData.mLength == 0)
|
||||||
@@ -248,7 +238,7 @@ void Joiner::HandleDiscoverResult(otActiveScanResult *aResult)
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExit();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Joiner::AddJoinerRouter(JoinerRouter &aJoinerRouter)
|
void Joiner::AddJoinerRouter(JoinerRouter &aJoinerRouter)
|
||||||
@@ -356,8 +346,6 @@ void Joiner::SendJoinerFinalize(void)
|
|||||||
VendorSwVersionTlv vendorSwVersionTlv;
|
VendorSwVersionTlv vendorSwVersionTlv;
|
||||||
VendorStackVersionTlv vendorStackVersionTlv;
|
VendorStackVersionTlv vendorStackVersionTlv;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
||||||
header.AppendUriPathOptions(OT_URI_PATH_JOINER_FINALIZE);
|
header.AppendUriPathOptions(OT_URI_PATH_JOINER_FINALIZE);
|
||||||
header.SetPayloadMarker();
|
header.SetPayloadMarker();
|
||||||
@@ -419,8 +407,6 @@ exit:
|
|||||||
{
|
{
|
||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Joiner::HandleJoinerFinalizeResponse(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
void Joiner::HandleJoinerFinalizeResponse(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||||
@@ -437,8 +423,6 @@ void Joiner::HandleJoinerFinalizeResponse(Coap::Header *aHeader, Message *aMessa
|
|||||||
(void) aMessageInfo;
|
(void) aMessageInfo;
|
||||||
StateTlv state;
|
StateTlv state;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(mState == OT_JOINER_STATE_CONNECTED &&
|
VerifyOrExit(mState == OT_JOINER_STATE_CONNECTED &&
|
||||||
aResult == OT_ERROR_NONE &&
|
aResult == OT_ERROR_NONE &&
|
||||||
aHeader->GetType() == OT_COAP_TYPE_ACKNOWLEDGMENT &&
|
aHeader->GetType() == OT_COAP_TYPE_ACKNOWLEDGMENT &&
|
||||||
@@ -461,7 +445,6 @@ void Joiner::HandleJoinerFinalizeResponse(Coap::Header *aHeader, Message *aMessa
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
Close();
|
Close();
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Joiner::HandleJoinerEntrust(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
void Joiner::HandleJoinerEntrust(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||||
@@ -483,8 +466,6 @@ void Joiner::HandleJoinerEntrust(Coap::Header &aHeader, Message &aMessage, const
|
|||||||
ActiveTimestampTlv activeTimestamp;
|
ActiveTimestampTlv activeTimestamp;
|
||||||
NetworkKeySequenceTlv networkKeySeq;
|
NetworkKeySequenceTlv networkKeySeq;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(mState == OT_JOINER_STATE_ENTRUST &&
|
VerifyOrExit(mState == OT_JOINER_STATE_ENTRUST &&
|
||||||
aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE &&
|
aHeader.GetType() == OT_COAP_TYPE_CONFIRMABLE &&
|
||||||
aHeader.GetCode() == OT_COAP_CODE_POST, error = OT_ERROR_DROP);
|
aHeader.GetCode() == OT_COAP_CODE_POST, error = OT_ERROR_DROP);
|
||||||
@@ -537,8 +518,6 @@ exit:
|
|||||||
otLogWarnMeshCoP(GetInstance(), "Error while processing joiner entrust: %s",
|
otLogWarnMeshCoP(GetInstance(), "Error while processing joiner entrust: %s",
|
||||||
otThreadErrorToString(error));
|
otThreadErrorToString(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Joiner::SendJoinerEntrustResponse(const Coap::Header &aRequestHeader,
|
void Joiner::SendJoinerEntrustResponse(const Coap::Header &aRequestHeader,
|
||||||
@@ -550,8 +529,6 @@ void Joiner::SendJoinerEntrustResponse(const Coap::Header &aRequestHeader,
|
|||||||
Coap::Header responseHeader;
|
Coap::Header responseHeader;
|
||||||
Ip6::MessageInfo responseInfo(aRequestInfo);
|
Ip6::MessageInfo responseInfo(aRequestInfo);
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
responseHeader.SetDefaultResponseHeader(aRequestHeader);
|
responseHeader.SetDefaultResponseHeader(aRequestHeader);
|
||||||
|
|
||||||
VerifyOrExit((message = NewMeshCoPMessage(netif.GetCoap(), responseHeader)) != NULL, error = OT_ERROR_NO_BUFS);
|
VerifyOrExit((message = NewMeshCoPMessage(netif.GetCoap(), responseHeader)) != NULL, error = OT_ERROR_NO_BUFS);
|
||||||
@@ -573,8 +550,6 @@ exit:
|
|||||||
{
|
{
|
||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Joiner::HandleTimer(Timer &aTimer)
|
void Joiner::HandleTimer(Timer &aTimer)
|
||||||
|
|||||||
@@ -139,11 +139,10 @@ exit:
|
|||||||
|
|
||||||
otError JoinerRouter::SetJoinerUdpPort(uint16_t aJoinerUdpPort)
|
otError JoinerRouter::SetJoinerUdpPort(uint16_t aJoinerUdpPort)
|
||||||
{
|
{
|
||||||
otLogFuncEntry();
|
|
||||||
mJoinerUdpPort = aJoinerUdpPort;
|
mJoinerUdpPort = aJoinerUdpPort;
|
||||||
mIsJoinerPortConfigured = true;
|
mIsJoinerPortConfigured = true;
|
||||||
HandleStateChanged(OT_CHANGED_THREAD_NETDATA);
|
HandleStateChanged(OT_CHANGED_THREAD_NETDATA);
|
||||||
otLogFuncExit();
|
|
||||||
return OT_ERROR_NONE;
|
return OT_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,8 +165,6 @@ void JoinerRouter::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &a
|
|||||||
ExtendedTlv tlv;
|
ExtendedTlv tlv;
|
||||||
uint16_t borderAgentRloc;
|
uint16_t borderAgentRloc;
|
||||||
|
|
||||||
otLogFuncEntryMsg("from peer: %llX",
|
|
||||||
HostSwap64(*reinterpret_cast<const uint64_t *>(aMessageInfo.GetPeerAddr().mFields.m8 + 8)));
|
|
||||||
otLogInfoMeshCoP(GetInstance(), "JoinerRouter::HandleUdpReceive");
|
otLogInfoMeshCoP(GetInstance(), "JoinerRouter::HandleUdpReceive");
|
||||||
|
|
||||||
SuccessOrExit(error = GetBorderAgentRloc(borderAgentRloc));
|
SuccessOrExit(error = GetBorderAgentRloc(borderAgentRloc));
|
||||||
@@ -226,8 +223,6 @@ exit:
|
|||||||
{
|
{
|
||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JoinerRouter::HandleRelayTransmit(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
void JoinerRouter::HandleRelayTransmit(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||||
@@ -249,7 +244,6 @@ void JoinerRouter::HandleRelayTransmit(Coap::Header &aHeader, Message &aMessage,
|
|||||||
Message *message = NULL;
|
Message *message = NULL;
|
||||||
Ip6::MessageInfo messageInfo;
|
Ip6::MessageInfo messageInfo;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_NON_CONFIRMABLE &&
|
VerifyOrExit(aHeader.GetType() == OT_COAP_TYPE_NON_CONFIRMABLE &&
|
||||||
aHeader.GetCode() == OT_COAP_CODE_POST, error = OT_ERROR_DROP);
|
aHeader.GetCode() == OT_COAP_CODE_POST, error = OT_ERROR_DROP);
|
||||||
|
|
||||||
@@ -307,8 +301,6 @@ exit:
|
|||||||
{
|
{
|
||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -330,8 +322,6 @@ otError JoinerRouter::DelaySendingJoinerEntrust(const Ip6::MessageInfo &aMessage
|
|||||||
|
|
||||||
DelayedJoinEntHeader delayedMessage;
|
DelayedJoinEntHeader delayedMessage;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
||||||
header.AppendUriPathOptions(OT_URI_PATH_JOINER_ENTRUST);
|
header.AppendUriPathOptions(OT_URI_PATH_JOINER_ENTRUST);
|
||||||
header.SetPayloadMarker();
|
header.SetPayloadMarker();
|
||||||
@@ -422,7 +412,6 @@ exit:
|
|||||||
message->Free();
|
message->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -706,7 +706,6 @@ otError Ip6::HandleDatagram(Message &aMessage, Netif *aNetif, int8_t aInterfaceI
|
|||||||
uint8_t hopLimit;
|
uint8_t hopLimit;
|
||||||
int8_t forwardInterfaceId;
|
int8_t forwardInterfaceId;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
uint8_t buf[1024];
|
uint8_t buf[1024];
|
||||||
@@ -833,7 +832,6 @@ exit:
|
|||||||
aMessage.Free();
|
aMessage.Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -841,8 +839,6 @@ int8_t Ip6::FindForwardInterfaceId(const MessageInfo &aMessageInfo)
|
|||||||
{
|
{
|
||||||
int8_t interfaceId;
|
int8_t interfaceId;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
if (aMessageInfo.GetSockAddr().IsMulticast())
|
if (aMessageInfo.GetSockAddr().IsMulticast())
|
||||||
{
|
{
|
||||||
// multicast
|
// multicast
|
||||||
@@ -868,8 +864,6 @@ int8_t Ip6::FindForwardInterfaceId(const MessageInfo &aMessageInfo)
|
|||||||
interfaceId = 0;
|
interfaceId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
otLogFuncExit();
|
|
||||||
|
|
||||||
return interfaceId;
|
return interfaceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-11
@@ -238,8 +238,6 @@ otError Mle::Start(bool aEnableReattach, bool aAnnounceAttach)
|
|||||||
ThreadNetif &netif = GetNetif();
|
ThreadNetif &netif = GetNetif();
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
// cannot bring up the interface if IEEE 802.15.4 promiscuous mode is enabled
|
// cannot bring up the interface if IEEE 802.15.4 promiscuous mode is enabled
|
||||||
VerifyOrExit(otPlatRadioGetPromiscuous(&netif.GetInstance()) == false, error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(otPlatRadioGetPromiscuous(&netif.GetInstance()) == false, error = OT_ERROR_INVALID_STATE);
|
||||||
VerifyOrExit(netif.IsUp(), error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(netif.IsUp(), error = OT_ERROR_INVALID_STATE);
|
||||||
@@ -274,7 +272,6 @@ otError Mle::Start(bool aEnableReattach, bool aAnnounceAttach)
|
|||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +279,6 @@ otError Mle::Stop(bool aClearNetworkDatasets)
|
|||||||
{
|
{
|
||||||
ThreadNetif &netif = GetNetif();
|
ThreadNetif &netif = GetNetif();
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
netif.GetKeyManager().Stop();
|
netif.GetKeyManager().Stop();
|
||||||
SetStateDetached();
|
SetStateDetached();
|
||||||
netif.RemoveUnicastAddress(mMeshLocal16);
|
netif.RemoveUnicastAddress(mMeshLocal16);
|
||||||
@@ -298,7 +294,7 @@ otError Mle::Stop(bool aClearNetworkDatasets)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mRole = OT_DEVICE_ROLE_DISABLED;
|
mRole = OT_DEVICE_ROLE_DISABLED;
|
||||||
otLogFuncExit();
|
|
||||||
return OT_ERROR_NONE;
|
return OT_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,8 +499,6 @@ otError Mle::BecomeDetached(void)
|
|||||||
ThreadNetif &netif = GetNetif();
|
ThreadNetif &netif = GetNetif();
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(mRole != OT_DEVICE_ROLE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(mRole != OT_DEVICE_ROLE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
||||||
|
|
||||||
// not in reattach stage after reset
|
// not in reattach stage after reset
|
||||||
@@ -523,7 +517,6 @@ otError Mle::BecomeDetached(void)
|
|||||||
BecomeChild(kAttachAny);
|
BecomeChild(kAttachAny);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,8 +525,6 @@ otError Mle::BecomeChild(AttachMode aMode)
|
|||||||
ThreadNetif &netif = GetNetif();
|
ThreadNetif &netif = GetNetif();
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
otLogFuncEntry();
|
|
||||||
|
|
||||||
VerifyOrExit(mRole != OT_DEVICE_ROLE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
VerifyOrExit(mRole != OT_DEVICE_ROLE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
||||||
VerifyOrExit(mParentRequestState == kParentIdle, error = OT_ERROR_BUSY);
|
VerifyOrExit(mParentRequestState == kParentIdle, error = OT_ERROR_BUSY);
|
||||||
|
|
||||||
@@ -568,7 +559,6 @@ otError Mle::BecomeChild(AttachMode aMode)
|
|||||||
mParentRequestTimer.Start((otPlatRandomGet() % kParentRequestRouterTimeout) + 1);
|
mParentRequestTimer.Start((otPlatRandomGet() % kParentRequestRouterTimeout) + 1);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
otLogFuncExitErr(error);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user