[topology] move IsStateValidOrAttaching to Neighbor (#4419)

This commit is contained in:
Abtin Keshavarzian
2019-12-19 13:27:15 -08:00
committed by Jonathan Hui
parent 636352431f
commit 5fd1083d14
2 changed files with 23 additions and 23 deletions
+12 -12
View File
@@ -41,18 +41,7 @@
namespace ot {
void Neighbor::GenerateChallenge(void)
{
Random::Crypto::FillBuffer(mValidPending.mPending.mChallenge, sizeof(mValidPending.mPending.mChallenge));
}
void Child::Clear(void)
{
memset(reinterpret_cast<void *>(this), 0, sizeof(Child));
SetState(kStateInvalid);
}
bool Child::IsStateValidOrAttaching(void) const
bool Neighbor::IsStateValidOrAttaching(void) const
{
bool rval = false;
@@ -75,6 +64,17 @@ bool Child::IsStateValidOrAttaching(void) const
return rval;
}
void Neighbor::GenerateChallenge(void)
{
Random::Crypto::FillBuffer(mValidPending.mPending.mChallenge, sizeof(mValidPending.mPending.mChallenge));
}
void Child::Clear(void)
{
memset(reinterpret_cast<void *>(this), 0, sizeof(Child));
SetState(kStateInvalid);
}
void Child::ClearIp6Addresses(void)
{
memset(mMeshLocalIid, 0, sizeof(mMeshLocalIid));
+11 -11
View File
@@ -157,6 +157,17 @@ public:
*/
bool IsStateValidOrRestoring(void) const { return (mState == kStateValid) || IsStateRestoring(); }
/**
* This method indicates if the neighbor state is valid, attaching, or restored.
*
* The states `kStateRestored`, `kStateChildIdRequest`, `kStateChildUpdateRequest`, `kStateValid`, and
* `kStateLinkRequest` are considered as valid, attaching, or restored.
*
* @returns TRUE if the neighbor state is valid, attaching, or restored, FALSE otherwise.
*
*/
bool IsStateValidOrAttaching(void) const;
/**
* This method gets the device mode flags.
*
@@ -480,17 +491,6 @@ public:
*/
void Clear(void);
/**
* This method indicates if the child state is valid or being attached or being restored.
*
* The states `kStateRestored`, `kStateChildIdRequest`, `kStateChildUpdateRequest`, `kStateValid`, (and
* `kStateLinkRequest) are considered as attached or being restored.
*
* @returns TRUE if the child is attached or being restored.
*
*/
bool IsStateValidOrAttaching(void) const;
/**
* This method clears the IPv6 address list for the child.
*