From 8ec9ede47a0d736c2388189bc29021dec905b5cc Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 15 Dec 2022 20:49:01 -0800 Subject: [PATCH] [router-table] add documentation for `{Get/Set}RouterIdRange()` (#8532) --- src/core/api/thread_ftd_api.cpp | 3 +++ src/core/thread/router_table.cpp | 1 - src/core/thread/router_table.hpp | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/core/api/thread_ftd_api.cpp b/src/core/api/thread_ftd_api.cpp index 97b449a93..c422169e9 100644 --- a/src/core/api/thread_ftd_api.cpp +++ b/src/core/api/thread_ftd_api.cpp @@ -369,6 +369,9 @@ void otThreadSetThreadVersionCheckEnabled(otInstance *aInstance, bool aEnabled) #if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE void otThreadGetRouterIdRange(otInstance *aInstance, uint8_t *aMinRouterId, uint8_t *aMaxRouterId) { + AssertPointerIsNotNull(aMinRouterId); + AssertPointerIsNotNull(aMaxRouterId); + AsCoreType(aInstance).Get().GetRouterIdRange(*aMinRouterId, *aMaxRouterId); } diff --git a/src/core/thread/router_table.cpp b/src/core/thread/router_table.cpp index 3bc92e028..e73c38ee6 100644 --- a/src/core/thread/router_table.cpp +++ b/src/core/thread/router_table.cpp @@ -122,7 +122,6 @@ Router *RouterTable::Allocate(void) VerifyOrExit(!mRouters.IsFull()); - // count available router ids #if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE for (uint8_t routerId = mMinRouterId; routerId <= mMaxRouterId; routerId++) #else diff --git a/src/core/thread/router_table.hpp b/src/core/thread/router_table.hpp index 44f30f802..f67678564 100644 --- a/src/core/thread/router_table.hpp +++ b/src/core/thread/router_table.hpp @@ -314,8 +314,29 @@ public: void HandleTimeTick(void); #if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE + /** + * This method gets the range of Router IDs. + * + * All the Router IDs in the range `[aMinRouterId, aMaxRouterId]` are allowed. This is intended for testing only. + * + * @param[out] aMinRouterId Reference to return the minimum Router ID. + * @param[out] aMaxRouterId Reference to return the maximum Router ID. + * + */ void GetRouterIdRange(uint8_t &aMinRouterId, uint8_t &aMaxRouterId) const; + /** + * This method sets the range of Router IDs. + * + * All the Router IDs in the range `[aMinRouterId, aMaxRouterId]` are allowed. This is intended for testing only. + * + * @param[in] aMinRouterId The minimum Router ID. + * @param[in] aMaxRouterId The maximum Router ID. + * + * @retval kErrorNone Successfully set the Router ID range. + * @retval kErrorInvalidArgs The given range is not valid. + * + */ Error SetRouterIdRange(uint8_t aMinRouterId, uint8_t aMaxRouterId); #endif