[core] reorder member variable declarations

This commit changes the order of member variable declarations in
certain classes to group them by size/alignment requirement and
also to avoid having the first member variable of class to inherit
from `InstanceLocator` for a class which its itself a sub-class of
`InstanceLocator` (this is to avoid extra memory padding added for
empty base class).

This commit also re-defines some of the public member variables in
`Ip6` and `Commissioner` classes as a private and provides getter
methods to access them.
This commit is contained in:
Abtin Keshavarzian
2017-10-25 09:00:14 -07:00
committed by Jonathan Hui
parent 4cb17495b2
commit 1436d9b067
27 changed files with 158 additions and 100 deletions
+6 -6
View File
@@ -117,8 +117,8 @@ otError otCommissionerAnnounceBegin(otInstance *aInstance, uint32_t aChannelMask
otError error = OT_ERROR_DISABLED_FEATURE;
#if OPENTHREAD_FTD && OPENTHREAD_ENABLE_COMMISSIONER
error = aInstance->mThreadNetif.GetCommissioner().mAnnounceBegin.SendRequest(aChannelMask, aCount, aPeriod,
*static_cast<const Ip6::Address *>(aAddress));
error = aInstance->mThreadNetif.GetCommissioner().GetAnnounceBeginClient().SendRequest(
aChannelMask, aCount, aPeriod, *static_cast<const Ip6::Address *>(aAddress));
#else // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aChannelMask);
@@ -137,9 +137,9 @@ otError otCommissionerEnergyScan(otInstance *aInstance, uint32_t aChannelMask, u
otError error = OT_ERROR_DISABLED_FEATURE;
#if OPENTHREAD_FTD && OPENTHREAD_ENABLE_COMMISSIONER
error = aInstance->mThreadNetif.GetCommissioner().mEnergyScan.SendQuery(aChannelMask, aCount, aPeriod, aScanDuration,
*static_cast<const Ip6::Address *>(aAddress),
aCallback, aContext);
error = aInstance->mThreadNetif.GetCommissioner().GetEnergyScanClient().SendQuery(
aChannelMask, aCount, aPeriod, aScanDuration, *static_cast<const Ip6::Address *>(aAddress),
aCallback, aContext);
#else // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aChannelMask);
@@ -161,7 +161,7 @@ otError otCommissionerPanIdQuery(otInstance *aInstance, uint16_t aPanId, uint32_
otError error = OT_ERROR_DISABLED_FEATURE;
#if OPENTHREAD_FTD && OPENTHREAD_ENABLE_COMMISSIONER
error = aInstance->mThreadNetif.GetCommissioner().mPanIdQuery.SendQuery(
error = aInstance->mThreadNetif.GetCommissioner().GetPanIdQueryClient().SendQuery(
aPanId, aChannelMask, *static_cast<const Ip6::Address *>(aAddress), aCallback, aContext);
#else // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
OT_UNUSED_VARIABLE(aInstance);
+6 -6
View File
@@ -41,23 +41,23 @@ using namespace ot;
bool otIcmp6IsEchoEnabled(otInstance *aInstance)
{
return aInstance->mIp6.mIcmp.IsEchoEnabled();
return aInstance->mIp6.GetIcmp().IsEchoEnabled();
}
void otIcmp6SetEchoEnabled(otInstance *aInstance, bool aEnabled)
{
aInstance->mIp6.mIcmp.SetEchoEnabled(aEnabled);
aInstance->mIp6.GetIcmp().SetEchoEnabled(aEnabled);
}
otError otIcmp6RegisterHandler(otInstance *aInstance, otIcmp6Handler *aHandler)
{
return aInstance->mIp6.mIcmp.RegisterHandler(*static_cast<Ip6::IcmpHandler *>(aHandler));
return aInstance->mIp6.GetIcmp().RegisterHandler(*static_cast<Ip6::IcmpHandler *>(aHandler));
}
otError otIcmp6SendEchoRequest(otInstance *aInstance, otMessage *aMessage,
const otMessageInfo *aMessageInfo, uint16_t aIdentifier)
{
return aInstance->mIp6.mIcmp.SendEchoRequest(*static_cast<Message *>(aMessage),
*static_cast<const Ip6::MessageInfo *>(aMessageInfo),
aIdentifier);
return aInstance->mIp6.GetIcmp().SendEchoRequest(*static_cast<Message *>(aMessage),
*static_cast<const Ip6::MessageInfo *>(aMessageInfo),
aIdentifier);
}
+2 -2
View File
@@ -178,8 +178,8 @@ void otMessageGetBufferInfo(otInstance *aInstance, otBufferInfo *aBufferInfo)
aInstance->mThreadNetif.GetIp6().GetSendQueue().GetInfo(aBufferInfo->mIp6Messages,
aBufferInfo->mIp6Buffers);
aInstance->mThreadNetif.GetIp6().mMpl.GetBufferedMessageSet().GetInfo(aBufferInfo->mMplMessages,
aBufferInfo->mMplBuffers);
aInstance->mThreadNetif.GetIp6().GetMpl().GetBufferedMessageSet().GetInfo(aBufferInfo->mMplMessages,
aBufferInfo->mMplBuffers);
aInstance->mThreadNetif.GetMle().GetMessageQueue().GetInfo(aBufferInfo->mMleMessages,
aBufferInfo->mMleBuffers);
+2 -2
View File
@@ -41,7 +41,7 @@ using namespace ot;
otMessage *otUdpNewMessage(otInstance *aInstance, bool aLinkSecurityEnabled)
{
Message *message = aInstance->mIp6.mUdp.NewMessage(0);
Message *message = aInstance->mIp6.GetUdp().NewMessage(0);
if (message)
{
@@ -58,7 +58,7 @@ otError otUdpOpen(otInstance *aInstance, otUdpSocket *aSocket, otUdpReceive aCal
if (socket->mTransport == NULL)
{
socket->mTransport = &aInstance->mIp6.mUdp;
socket->mTransport = &aInstance->mIp6.GetUdp();
error = socket->Open(aCallback, aCallbackContext);
}
+1 -1
View File
@@ -51,7 +51,7 @@ namespace Coap {
CoapBase::CoapBase(otInstance &aInstance, Timer::Handler aRetransmissionTimerHandler,
Timer::Handler aResponsesQueueTimerHandler):
InstanceLocator(aInstance),
mSocket(aInstance.mThreadNetif.GetIp6().mUdp),
mSocket(aInstance.mThreadNetif.GetIp6().GetUdp()),
mRetransmissionTimer(aInstance, aRetransmissionTimerHandler, this),
mResources(NULL),
mContext(NULL),
+11 -11
View File
@@ -138,17 +138,6 @@ void Mac::StartCsmaBackoff(void)
Mac::Mac(otInstance &aInstance):
InstanceLocator(aInstance),
mMacTimer(aInstance, &Mac::HandleMacTimer, this),
mBackoffTimer(aInstance, &Mac::HandleBeginTransmit, this),
mReceiveTimer(aInstance, &Mac::HandleReceiveTimer, this),
mShortAddress(kShortAddrInvalid),
mPanId(kPanIdBroadcast),
mChannel(OPENTHREAD_CONFIG_DEFAULT_CHANNEL),
mMaxTransmitPower(OPENTHREAD_CONFIG_DEFAULT_MAX_TRANSMIT_POWER),
mSendHead(NULL),
mSendTail(NULL),
mReceiveHead(NULL),
mReceiveTail(NULL),
mOperation(kOperationIdle),
mPendingActiveScan(false),
mPendingEnergyScan(false),
@@ -160,6 +149,17 @@ Mac::Mac(otInstance &aInstance):
#if OPENTHREAD_CONFIG_STAY_AWAKE_BETWEEN_FRAGMENTS
mDelaySleep(false),
#endif
mMacTimer(aInstance, &Mac::HandleMacTimer, this),
mBackoffTimer(aInstance, &Mac::HandleBeginTransmit, this),
mReceiveTimer(aInstance, &Mac::HandleReceiveTimer, this),
mShortAddress(kShortAddrInvalid),
mPanId(kPanIdBroadcast),
mChannel(OPENTHREAD_CONFIG_DEFAULT_CHANNEL),
mMaxTransmitPower(OPENTHREAD_CONFIG_DEFAULT_MAX_TRANSMIT_POWER),
mSendHead(NULL),
mSendTail(NULL),
mReceiveHead(NULL),
mReceiveTail(NULL),
mBeaconSequence(static_cast<uint8_t>(otPlatRandomGet())),
mDataSequence(static_cast<uint8_t>(otPlatRandomGet())),
mCsmaAttempts(0),
+13 -13
View File
@@ -682,6 +682,19 @@ private:
static const char *OperationToString(Operation aOperation);
Operation mOperation;
bool mPendingActiveScan : 1;
bool mPendingEnergyScan : 1;
bool mPendingTransmitBeacon : 1;
bool mPendingTransmitData : 1;
bool mPendingWaitingForData : 1;
bool mRxOnWhenIdle : 1;
bool mBeaconsEnabled : 1;
#if OPENTHREAD_CONFIG_STAY_AWAKE_BETWEEN_FRAGMENTS
bool mDelaySleep : 1;
#endif
TimerMilli mMacTimer;
#if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_TIMER
TimerMicro mBackoffTimer;
@@ -702,19 +715,6 @@ private:
Sender *mSendHead, *mSendTail;
Receiver *mReceiveHead, *mReceiveTail;
Operation mOperation;
bool mPendingActiveScan : 1;
bool mPendingEnergyScan : 1;
bool mPendingTransmitBeacon : 1;
bool mPendingTransmitData : 1;
bool mPendingWaitingForData : 1;
bool mRxOnWhenIdle : 1;
bool mBeaconsEnabled : 1;
#if OPENTHREAD_CONFIG_STAY_AWAKE_BETWEEN_FRAGMENTS
bool mDelaySleep : 1;
#endif
uint8_t mBeaconSequence;
uint8_t mDataSequence;
uint8_t mCsmaAttempts;
+4 -4
View File
@@ -62,9 +62,6 @@ namespace MeshCoP {
Commissioner::Commissioner(otInstance &aInstance):
InstanceLocator(aInstance),
mAnnounceBegin(aInstance),
mEnergyScan(aInstance),
mPanIdQuery(aInstance),
mState(OT_COMMISSIONER_STATE_DISABLED),
mJoinerPort(0),
mJoinerRloc(0),
@@ -74,7 +71,10 @@ Commissioner::Commissioner(otInstance &aInstance):
mTransmitAttempts(0),
mRelayReceive(OT_URI_PATH_RELAY_RX, &Commissioner::HandleRelayReceive, this),
mDatasetChanged(OT_URI_PATH_DATASET_CHANGED, &Commissioner::HandleDatasetChanged, this),
mJoinerFinalize(OT_URI_PATH_JOINER_FINALIZE, &Commissioner::HandleJoinerFinalize, this)
mJoinerFinalize(OT_URI_PATH_JOINER_FINALIZE, &Commissioner::HandleJoinerFinalize, this),
mAnnounceBegin(aInstance),
mEnergyScan(aInstance),
mPanIdQuery(aInstance)
{
memset(mJoiners, 0, sizeof(mJoiners));
}
+27 -3
View File
@@ -196,9 +196,29 @@ public:
static otError GeneratePSKc(const char *aPassPhrase, const char *aNetworkName, const uint8_t *aExtPanId,
uint8_t *aPSKc);
AnnounceBeginClient mAnnounceBegin;
EnergyScanClient mEnergyScan;
PanIdQueryClient mPanIdQuery;
/**
* This method returns a reference to the AnnounceBeginClient instance.
*
* @returns A reference to the AnnounceBeginClient instance.
*
*/
AnnounceBeginClient &GetAnnounceBeginClient(void) { return mAnnounceBegin; }
/**
* This method returns a reference to the EnergyScanClient instance.
*
* @returns A reference to the EnergyScanClient instance.
*
*/
EnergyScanClient &GetEnergyScanClient(void) { return mEnergyScan; }
/**
* This method returns a reference to the PanIdQueryClient instance.
*
* @returns A reference to the PanIdQueryClient instance.
*
*/
PanIdQueryClient &GetPanIdQueryClient(void) { return mPanIdQuery; }
private:
enum
@@ -289,6 +309,10 @@ private:
Coap::Resource mRelayReceive;
Coap::Resource mDatasetChanged;
Coap::Resource mJoinerFinalize;
AnnounceBeginClient mAnnounceBegin;
EnergyScanClient mEnergyScan;
PanIdQueryClient mPanIdQuery;
};
} // namespace MeshCoP
+1 -1
View File
@@ -62,8 +62,8 @@ namespace MeshCoP {
DatasetManager::DatasetManager(otInstance &aInstance, const Tlv::Type aType, const char *aUriSet,
const char *aUriGet, Timer::Handler aTimerHandler):
InstanceLocator(aInstance),
mLocal(aInstance, aType),
mNetwork(aType),
mLocal(aInstance, aType),
mTimer(aInstance, aTimerHandler, this),
mUriSet(aUriSet),
mUriGet(aUriGet)
+1 -1
View File
@@ -204,8 +204,8 @@ protected:
*/
void HandleTimer(void);
DatasetLocal mLocal;
Dataset mNetwork;
DatasetLocal mLocal;
private:
static void HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
+1 -1
View File
@@ -57,7 +57,7 @@ namespace MeshCoP {
JoinerRouter::JoinerRouter(otInstance &aInstance):
InstanceLocator(aInstance),
mSocket(aInstance.mThreadNetif.GetIp6().mUdp),
mSocket(aInstance.mThreadNetif.GetIp6().GetUdp()),
mRelayTransmit(OT_URI_PATH_RELAY_TX, &JoinerRouter::HandleRelayTransmit, this),
mTimer(aInstance, &JoinerRouter::HandleTimer, this),
mJoinerUdpPort(0),
+1 -1
View File
@@ -58,8 +58,8 @@ namespace Dhcp6 {
Dhcp6Client::Dhcp6Client(otInstance &aInstance) :
InstanceLocator(aInstance),
mSocket(aInstance.mThreadNetif.GetIp6().GetUdp()),
mTrickleTimer(aInstance, &Dhcp6Client::HandleTrickleTimer, NULL, this),
mSocket(aInstance.mThreadNetif.GetIp6().mUdp),
mStartTime(0),
mAddresses(NULL),
mNumAddresses(0)
+2 -2
View File
@@ -226,10 +226,10 @@ private:
static Dhcp6Client &GetOwner(const Context &aContext);
TrickleTimer mTrickleTimer;
Ip6::UdpSocket mSocket;
TrickleTimer mTrickleTimer;
uint8_t mTransactionId[kTransactionIdSize];
uint32_t mStartTime;
otDhcpAddress *mAddresses;
+1 -1
View File
@@ -53,7 +53,7 @@ namespace Dhcp6 {
Dhcp6Server::Dhcp6Server(otInstance &aInstance):
InstanceLocator(aInstance),
mSocket(GetNetif().GetIp6().mUdp)
mSocket(GetNetif().GetIp6().GetUdp())
{
for (uint8_t i = 0; i < OPENTHREAD_CONFIG_NUM_DHCP_PREFIXES; i++)
{
+1 -1
View File
@@ -159,7 +159,7 @@ public:
*
*/
Client(Ip6::Netif &aNetif):
mSocket(aNetif.GetIp6().mUdp),
mSocket(aNetif.GetIp6().GetUdp()),
mMessageId(0),
mRetransmissionTimer(aNetif.GetInstance(), &Client::HandleRetransmissionTimer, this) {
};
+8 -7
View File
@@ -52,16 +52,17 @@ namespace Ip6 {
Ip6::Ip6(otInstance &aInstance):
InstanceLocator(aInstance),
mForwardingEnabled(false),
mIsReceiveIp6FilterEnabled(false),
mReceiveIp6DatagramCallback(NULL),
mReceiveIp6DatagramCallbackContext(NULL),
mNetifListHead(NULL),
mSendQueue(),
mSendQueueTask(aInstance, HandleSendQueue, this),
mRoutes(aInstance),
mIcmp(aInstance),
mUdp(aInstance),
mMpl(aInstance),
mForwardingEnabled(false),
mSendQueueTask(aInstance, HandleSendQueue, this),
mReceiveIp6DatagramCallback(NULL),
mReceiveIp6DatagramCallbackContext(NULL),
mIsReceiveIp6FilterEnabled(false),
mNetifListHead(NULL)
mMpl(aInstance)
{
}
+40 -9
View File
@@ -334,6 +334,38 @@ public:
*/
const PriorityQueue &GetSendQueue(void) const { return mSendQueue; }
/**
* This method returns a reference to the IPv6 route management instance.
*
* @returns A reference to the route management instance.
*
*/
Routes &GetRoutes(void) { return mRoutes; }
/**
* This method returns a reference to the ICMP6 controller instance.
*
* @returns A reference to the ICMP6 instance.
*
*/
Icmp &GetIcmp(void) { return mIcmp; }
/**
* This method returns a reference to the UDP controller instance.
*
* @returns A reference to the UDP instance.
*
*/
Udp &GetUdp(void) { return mUdp; }
/**
* This method returns a reference to the UDMPL message processing controller instance.
*
* @returns A reference to the Mpl instance.
*
*/
Mpl &GetMpl(void) { return mMpl; }
/**
* This static method converts an `IpProto` enumeration to a string.
*
@@ -342,11 +374,6 @@ public:
*/
static const char *IpProtoToString(IpProto aIpProto);
Routes mRoutes;
Icmp mIcmp;
Udp mUdp;
Mpl mMpl;
private:
static void HandleSendQueue(Tasklet &aTasklet);
void HandleSendQueue(void);
@@ -367,15 +394,19 @@ private:
static Ip6 &GetOwner(const Context &aContext);
bool mForwardingEnabled;
bool mIsReceiveIp6FilterEnabled;
otIp6ReceiveCallback mReceiveIp6DatagramCallback;
void *mReceiveIp6DatagramCallbackContext;
Netif *mNetifListHead;
PriorityQueue mSendQueue;
Tasklet mSendQueueTask;
otIp6ReceiveCallback mReceiveIp6DatagramCallback;
void *mReceiveIp6DatagramCallbackContext;
bool mIsReceiveIp6FilterEnabled;
Routes mRoutes;
Icmp mIcmp;
Udp mUdp;
Mpl mMpl;
Netif *mNetifListHead;
};
/**
+3 -3
View File
@@ -55,11 +55,11 @@ void MplBufferedMessageMetadata::GenerateNextTransmissionTime(uint32_t aCurrentT
Mpl::Mpl(otInstance &aInstance):
InstanceLocator(aInstance),
mSeedSetTimer(aInstance, &Mpl::HandleSeedSetTimer, this),
mRetransmissionTimer(aInstance, &Mpl::HandleRetransmissionTimer, this),
mTimerExpirations(0),
mSequence(0),
mSeedId(0),
mSeedSetTimer(aInstance, &Mpl::HandleSeedSetTimer, this),
mRetransmissionTimer(aInstance, &Mpl::HandleRetransmissionTimer, this),
mMatchingAddress(NULL)
{
memset(mSeedSet, 0, sizeof(mSeedSet));
@@ -373,7 +373,7 @@ Mpl &Mpl::GetOwner(const Context &aContext)
#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
Mpl &mpl = *static_cast<Mpl *>(aContext.GetContext());
#else
Mpl &mpl = otGetIp6().mMpl;
Mpl &mpl = otGetIp6().GetMpl();
OT_UNUSED_VARIABLE(aContext);
#endif
return mpl;
+4 -3
View File
@@ -537,12 +537,13 @@ private:
static Mpl &GetOwner(const Context &aContext);
TimerMilli mSeedSetTimer;
TimerMilli mRetransmissionTimer;
uint8_t mTimerExpirations;
uint8_t mSequence;
uint16_t mSeedId;
TimerMilli mSeedSetTimer;
TimerMilli mRetransmissionTimer;
const Address *mMatchingAddress;
MplSeedEntry mSeedSet[kNumSeedEntries];
+1 -1
View File
@@ -70,7 +70,7 @@ AddressResolver::AddressResolver(otInstance &aInstance) :
GetNetif().GetCoap().AddResource(mAddressQuery);
GetNetif().GetCoap().AddResource(mAddressNotification);
GetNetif().GetIp6().mIcmp.RegisterHandler(mIcmpHandler);
GetNetif().GetIp6().GetIcmp().RegisterHandler(mIcmpHandler);
}
void AddressResolver::Clear()
+1 -1
View File
@@ -51,10 +51,10 @@ namespace ot {
DataPollManager::DataPollManager(otInstance &aInstance):
InstanceLocator(aInstance),
mTimer(aInstance, &DataPollManager::HandlePollTimer, this),
mTimerStartTime(0),
mExternalPollPeriod(0),
mPollPeriod(0),
mTimer(aInstance, &DataPollManager::HandlePollTimer, this),
mEnabled(false),
mAttachMode(false),
mRetxMode(false),
+2 -1
View File
@@ -222,11 +222,12 @@ private:
static DataPollManager &GetOwner(Context &aContext);
uint32_t GetDefaultPollPeriod(void) const;
TimerMilli mTimer;
uint32_t mTimerStartTime;
uint32_t mExternalPollPeriod;
uint32_t mPollPeriod;
TimerMilli mTimer;
bool mEnabled: 1; //< Indicates whether data polling is enabled/started.
bool mAttachMode: 1; //< Indicates whether in attach mode (to use attach poll period).
bool mRetxMode: 1; //< Indicates whether last poll tx failed at mac/radio layer (poll retx mode).
+8 -8
View File
@@ -81,7 +81,7 @@ Mle::Mle(otInstance &aInstance) :
mChildUpdateAttempts(0),
mParentLinkMargin(0),
mParentIsSingleton(false),
mSocket(aInstance.mThreadNetif.GetIp6().mUdp),
mSocket(aInstance.mThreadNetif.GetIp6().GetUdp()),
mTimeout(kMleEndDeviceTimeout),
mSendChildUpdateRequest(aInstance, &Mle::HandleSendChildUpdateRequest, this),
mDiscoverHandler(NULL),
@@ -154,7 +154,7 @@ Mle::Mle(otInstance &aInstance) :
mMeshLocal16.mRloc = true;
// Store RLOC address reference in MPL module.
GetNetif().GetIp6().mMpl.SetMatchingAddress(mMeshLocal16.GetAddress());
GetNetif().GetIp6().GetMpl().SetMatchingAddress(mMeshLocal16.GetAddress());
// link-local all thread nodes
mLinkLocalAllThreadNodes.GetAddress().mFields.m16[0] = HostSwap16(0xff32);
@@ -583,7 +583,7 @@ otError Mle::SetStateDetached(void)
netif.GetMac().SetBeaconEnabled(false);
netif.GetMle().HandleDetachStart();
netif.GetIp6().SetForwardingEnabled(false);
netif.GetIp6().mMpl.SetTimerExpirations(0);
netif.GetIp6().GetMpl().SetTimerExpirations(0);
otLogInfoMle(GetInstance(), "Role -> Detached");
return OT_ERROR_NONE;
@@ -624,7 +624,7 @@ otError Mle::SetStateChild(uint16_t aRloc16)
netif.GetNetworkDataLocal().ClearResubmitDelayTimer();
#endif
netif.GetIp6().SetForwardingEnabled(false);
netif.GetIp6().mMpl.SetTimerExpirations(kMplChildDataMessageTimerExpirations);
netif.GetIp6().GetMpl().SetTimerExpirations(kMplChildDataMessageTimerExpirations);
// Once the Thread device receives the new Active Commissioning Dataset, the device MUST
// transmit its own Announce messages on the channel it was on prior to the attachment.
@@ -801,7 +801,7 @@ otError Mle::SetRloc16(uint16_t aRloc16)
}
netif.GetMac().SetShortAddress(aRloc16);
netif.GetIp6().mMpl.SetSeedId(aRloc16);
netif.GetIp6().GetMpl().SetSeedId(aRloc16);
return OT_ERROR_NONE;
}
@@ -3291,9 +3291,9 @@ otError Mle::CheckReachability(uint16_t aMeshSource, uint16_t aMeshDest, Ip6::He
messageInfo.GetPeerAddr().mFields.m16[7] = HostSwap16(aMeshSource);
messageInfo.SetInterfaceId(netif.GetInterfaceId());
netif.GetIp6().mIcmp.SendError(Ip6::IcmpHeader::kTypeDstUnreach,
Ip6::IcmpHeader::kCodeDstUnreachNoRoute,
messageInfo, aIp6Header);
netif.GetIp6().GetIcmp().SendError(Ip6::IcmpHeader::kTypeDstUnreach,
Ip6::IcmpHeader::kCodeDstUnreachNoRoute,
messageInfo, aIp6Header);
exit:
return error;
+5 -5
View File
@@ -441,7 +441,7 @@ otError MleRouter::SetStateRouter(uint16_t aRloc16)
netif.GetNetworkDataLeader().Stop();
mStateUpdateTimer.Start(kStateUpdatePeriod);
netif.GetIp6().SetForwardingEnabled(true);
netif.GetIp6().mMpl.SetTimerExpirations(kMplRouterDataMessageTimerExpirations);
netif.GetIp6().GetMpl().SetTimerExpirations(kMplRouterDataMessageTimerExpirations);
netif.GetMac().SetBeaconEnabled(true);
for (int i = 0; i < mMaxChildrenAllowed; i++)
@@ -485,7 +485,7 @@ otError MleRouter::SetStateLeader(uint16_t aRloc16)
netif.GetCoap().AddResource(mAddressSolicit);
netif.GetCoap().AddResource(mAddressRelease);
netif.GetIp6().SetForwardingEnabled(true);
netif.GetIp6().mMpl.SetTimerExpirations(kMplRouterDataMessageTimerExpirations);
netif.GetIp6().GetMpl().SetTimerExpirations(kMplRouterDataMessageTimerExpirations);
netif.GetMac().SetBeaconEnabled(true);
for (int i = 0; i < mMaxChildrenAllowed; i++)
@@ -3920,9 +3920,9 @@ otError MleRouter::CheckReachability(uint16_t aMeshSource, uint16_t aMeshDest, I
messageInfo.GetPeerAddr().mFields.m16[7] = HostSwap16(aMeshSource);
messageInfo.SetInterfaceId(netif.GetInterfaceId());
netif.GetIp6().mIcmp.SendError(Ip6::IcmpHeader::kTypeDstUnreach,
Ip6::IcmpHeader::kCodeDstUnreachNoRoute,
messageInfo, aIp6Header);
netif.GetIp6().GetIcmp().SendError(Ip6::IcmpHeader::kTypeDstUnreach,
Ip6::IcmpHeader::kCodeDstUnreachNoRoute,
messageInfo, aIp6Header);
return OT_ERROR_DROP;
}
+4 -4
View File
@@ -50,8 +50,8 @@ namespace Utils {
ChildSupervisor::ChildSupervisor(otInstance &aInstance) :
InstanceLocator(aInstance),
mTimer(aInstance, &ChildSupervisor::HandleTimer, this),
mSupervisionInterval(kDefaultSupervisionInterval)
mSupervisionInterval(kDefaultSupervisionInterval),
mTimer(aInstance, &ChildSupervisor::HandleTimer, this)
{
}
@@ -180,8 +180,8 @@ ChildSupervisor &ChildSupervisor::GetOwner(const Context &aContext)
SupervisionListener::SupervisionListener(otInstance &aInstance) :
InstanceLocator(aInstance),
mTimer(aInstance, &SupervisionListener::HandleTimer, this),
mTimeout(0)
mTimeout(0),
mTimer(aInstance, &SupervisionListener::HandleTimer, this)
{
SetTimeout(kDefaultTimeout);
}
+2 -2
View File
@@ -159,8 +159,8 @@ private:
void HandleTimer(void);
static ChildSupervisor &GetOwner(const Context &aContext);
TimerMilli mTimer;
uint16_t mSupervisionInterval;
TimerMilli mTimer;
};
#else // #if OPENTHREAD_ENABLE_CHILD_SUPERVISION && OPENTHREAD_FTD
@@ -251,8 +251,8 @@ private:
void HandleTimer(void);
static SupervisionListener &GetOwner(const Context &aContext);
TimerMilli mTimer;
uint16_t mTimeout;
TimerMilli mTimer;
};
#else // #if OPENTHREAD_ENABLE_CHILD_SUPERVISION