[logging] remove otLogFunc<Entry/Exit> macros (#2438)

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