mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 07:37:46 +00:00
Remove some Leader/Router related features from MTD build (#1680)
* Unify the location of "#if OPENTHREAD_FTD" which include/exclude the whole file Also correct some comments in xxx_api.cpp * Remove Address Resolver related features from MTD build * Remove some Leader/Router related features from MTD build * Remove Leader/Router related APIs from MTD build * Remove Leader/Router related functions from MTD build
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
#define OTDLL 1
|
||||
#include <openthread/openthread.h>
|
||||
#include <openthread/thread_ftd.h>
|
||||
#include <openthread/commissioner.h>
|
||||
#include <openthread/joiner.h>
|
||||
|
||||
|
||||
+1
-316
@@ -29,7 +29,7 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
* This file defines the OpenThread Thread API.
|
||||
* This file defines the OpenThread Thread API (for both FTD and MTD).
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_THREAD_H_
|
||||
@@ -144,34 +144,6 @@ OTAPI bool OTCALL otThreadIsDiscoverInProgress(otInstance *aInstance);
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the maximum number of children currently allowed.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The maximum number of children currently allowed.
|
||||
*
|
||||
* @sa otThreadSetMaxAllowedChildren
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetMaxAllowedChildren(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the maximum number of children currently allowed.
|
||||
*
|
||||
* This parameter can only be set when Thread protocol operation
|
||||
* has been stopped.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aMaxChildren The maximum allowed children.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully set the max.
|
||||
* @retval kThreadError_InvalidArgs If @p aMaxChildren is not in the range [1, OPENTHREAD_CONFIG_MAX_CHILDREN].
|
||||
* @retval kThreadError_InvalidState If Thread isn't stopped.
|
||||
*
|
||||
* @sa otThreadGetMaxAllowedChildren, otThreadStop
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadSetMaxAllowedChildren(otInstance *aInstance, uint8_t aMaxChildren);
|
||||
|
||||
/**
|
||||
* Get the Thread Child Timeout used when operating in the Child role.
|
||||
*
|
||||
@@ -380,97 +352,10 @@ OTAPI const char *OTCALL otThreadGetNetworkName(otInstance *aInstance);
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadSetNetworkName(otInstance *aInstance, const char *aNetworkName);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not the Router Role is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval TRUE If the Router Role is enabled.
|
||||
* @retval FALSE If the Router Role is not enabled.
|
||||
*
|
||||
*/
|
||||
OTAPI bool OTCALL otThreadIsRouterRoleEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets whether or not the Router Role is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled TRUE if the Router Role is enabled, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetRouterRoleEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* Set the preferred Router Id.
|
||||
*
|
||||
* Upon becoming a router/leader the node attempts to use this Router Id. If the
|
||||
* preferred Router Id is not set or if it can not be used, a randomly generated
|
||||
* router id is picked. This property can be set only when the device role is
|
||||
* either detached or disabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aRouterId The preferred Router Id.
|
||||
*
|
||||
* @retval kThreadError_None Successfully set the preferred Router Id.
|
||||
* @retval kThreadError_InvalidState Could not set (role is not detached or disabled)
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup config-router Router/Leader
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that manage configuration parameters for the Thread Router and Leader roles.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the Thread Leader Weight used when operating in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The Thread Leader Weight value.
|
||||
*
|
||||
* @sa otThreadSetLeaderWeight
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetLocalLeaderWeight(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the Thread Leader Weight used when operating in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aWeight The Thread Leader Weight value..
|
||||
*
|
||||
* @sa otThreadGetLeaderWeight
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetLocalLeaderWeight(otInstance *aInstance, uint8_t aWeight);
|
||||
|
||||
/**
|
||||
* Get the Thread Leader Partition Id used when operating in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The Thread Leader Partition Id value.
|
||||
*
|
||||
*/
|
||||
OTAPI uint32_t OTCALL otThreadGetLocalLeaderPartitionId(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the Thread Leader Partition Id used when operating in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPartitionId The Thread Leader Partition Id value.
|
||||
*
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetLocalLeaderPartitionId(otInstance *aInstance, uint32_t aPartitionId);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -485,27 +370,6 @@ OTAPI void OTCALL otThreadSetLocalLeaderPartitionId(otInstance *aInstance, uint3
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The CONTEXT_ID_REUSE_DELAY value.
|
||||
*
|
||||
* @sa otThreadSetContextIdReuseDelay
|
||||
*/
|
||||
OTAPI uint32_t OTCALL otThreadGetContextIdReuseDelay(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDelay The CONTEXT_ID_REUSE_DELAY value.
|
||||
*
|
||||
* @sa otThreadGetContextIdReuseDelay
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetContextIdReuseDelay(otInstance *aInstance, uint32_t aDelay);
|
||||
|
||||
/**
|
||||
* Get the thrKeySequenceCounter.
|
||||
*
|
||||
@@ -548,59 +412,6 @@ OTAPI uint32_t OTCALL otThreadGetKeySwitchGuardTime(otInstance *aInstance);
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetKeySwitchGuardTime(otInstance *aInstance, uint32_t aKeySwitchGuardTime);
|
||||
|
||||
|
||||
/**
|
||||
* Get the NETWORK_ID_TIMEOUT parameter used in the Router role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The NETWORK_ID_TIMEOUT value.
|
||||
*
|
||||
* @sa otThreadSetNetworkIdTimeout
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetNetworkIdTimeout(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the NETWORK_ID_TIMEOUT parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aTimeout The NETWORK_ID_TIMEOUT value.
|
||||
*
|
||||
* @sa otThreadGetNetworkIdTimeout
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetNetworkIdTimeout(otInstance *aInstance, uint8_t aTimeout);
|
||||
|
||||
/**
|
||||
* Get the ROUTER_UPGRADE_THRESHOLD parameter used in the REED role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The ROUTER_UPGRADE_THRESHOLD value.
|
||||
*
|
||||
* @sa otThreadSetRouterUpgradeThreshold
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetRouterUpgradeThreshold(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the ROUTER_UPGRADE_THRESHOLD parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aThreshold The ROUTER_UPGRADE_THRESHOLD value.
|
||||
*
|
||||
* @sa otThreadGetRouterUpgradeThreshold
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetRouterUpgradeThreshold(otInstance *aInstance, uint8_t aThreshold);
|
||||
|
||||
/**
|
||||
* Release a Router ID that has been allocated by the device in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aRouterId The Router ID to release. Valid range is [0, 62].
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully released the Router ID specified by aRouterId.
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadReleaseRouterId(otInstance *aInstance, uint8_t aRouterId);
|
||||
|
||||
/**
|
||||
* Detach from the Thread network.
|
||||
*
|
||||
@@ -622,68 +433,6 @@ OTAPI ThreadError OTCALL otThreadBecomeDetached(otInstance *aInstance);
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadBecomeChild(otInstance *aInstance, otMleAttachFilter aFilter);
|
||||
|
||||
/**
|
||||
* Attempt to become a router.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully begin attempt to become a router.
|
||||
* @retval kThreadErrorInvalidState Thread is disabled.
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadBecomeRouter(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Become a leader and start a new partition.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully became a leader and started a new partition.
|
||||
* @retval kThreadErrorInvalidState Thread is disabled.
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadBecomeLeader(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The ROUTER_DOWNGRADE_THRESHOLD value.
|
||||
*
|
||||
* @sa otThreadSetRouterDowngradeThreshold
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetRouterDowngradeThreshold(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aThreshold The ROUTER_DOWNGRADE_THRESHOLD value.
|
||||
*
|
||||
* @sa otThreadGetRouterDowngradeThreshold
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetRouterDowngradeThreshold(otInstance *aInstance, uint8_t aThreshold);
|
||||
|
||||
/**
|
||||
* Get the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
* @sa otThreadSetRouterSelectionJitter
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetRouterSelectionJitter(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aRouterJitter The ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
* @sa otThreadGetRouterSelectionJitter
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetRouterSelectionJitter(otInstance *aInstance, uint8_t aRouterJitter);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
@@ -704,38 +453,6 @@ OTAPI void OTCALL otThreadSetRouterSelectionJitter(otInstance *aInstance, uint8_
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* The function retains diagnostic information for an attached Child by its Child ID or RLOC16.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChildId The Child ID or RLOC16 for the attached child.
|
||||
* @param[out] aChildInfo A pointer to where the child information is placed.
|
||||
*
|
||||
* @retavl kThreadError_None @p aChildInfo was successfully updated with the info for the given ID.
|
||||
* @retval kThreadError_NotFound No valid child with this Child ID.
|
||||
* @retavl kThreadError_InvalidArgs If @p aChildInfo is NULL.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadGetChildInfoById(otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo);
|
||||
|
||||
/**
|
||||
* The function retains diagnostic information for an attached Child by the internal table index.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChildIndex The table index.
|
||||
* @param[out] aChildInfo A pointer to where the child information is placed.
|
||||
*
|
||||
* @retavl kThreadError_None @p aChildInfo was successfully updated with the info for the given index.
|
||||
* @retval kThreadError_NotFound No valid child at this index.
|
||||
* @retavl kThreadError_InvalidArgs Either @p aChildInfo is NULL, or @p aChildIndex is out of range (higher
|
||||
* than max table index).
|
||||
*
|
||||
* @sa otGetMaxAllowedChildren
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadGetChildInfoByIndex(otInstance *aInstance, uint8_t aChildIndex,
|
||||
otChildInfo *aChildInfo);
|
||||
|
||||
/**
|
||||
* This function gets the next neighbor information. It is used to go through the entries of
|
||||
* the neighbor table.
|
||||
@@ -766,19 +483,6 @@ OTAPI ThreadError OTCALL otThreadGetNextNeighborInfo(otInstance *aInstance, otNe
|
||||
*/
|
||||
OTAPI otDeviceRole OTCALL otThreadGetDeviceRole(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function gets an EID cache entry.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aIndex An index into the EID cache table.
|
||||
* @param[out] aEntry A pointer to where the EID information is placed.
|
||||
*
|
||||
* @retval kThreadError_None Successfully retrieved the EID cache entry.
|
||||
* @retval kThreadError_InvalidArgs @p aIndex was out of bounds or @p aEntry was NULL.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadGetEidCacheEntry(otInstance *aInstance, uint8_t aIndex, otEidCacheEntry *aEntry);
|
||||
|
||||
/**
|
||||
* This function get the Thread Leader Data.
|
||||
*
|
||||
@@ -828,25 +532,6 @@ OTAPI uint32_t OTCALL otThreadGetPartitionId(otInstance *aInstance);
|
||||
*/
|
||||
OTAPI uint16_t OTCALL otThreadGetRloc16(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the current Router ID Sequence.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The Router ID Sequence.
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetRouterIdSequence(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* The function retains diagnostic information for a given Thread Router.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aRouterId The router ID or RLOC16 for a given router.
|
||||
* @param[out] aRouterInfo A pointer to where the router information is placed.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadGetRouterInfo(otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo);
|
||||
|
||||
/**
|
||||
* The function retrieves diagnostic information for a Thread Router as parent.
|
||||
*
|
||||
|
||||
@@ -53,6 +53,132 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup config-general General
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that manage configuration parameters for the Thread Router, and Leader roles.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the maximum number of children currently allowed.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The maximum number of children currently allowed.
|
||||
*
|
||||
* @sa otThreadSetMaxAllowedChildren
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetMaxAllowedChildren(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the maximum number of children currently allowed.
|
||||
*
|
||||
* This parameter can only be set when Thread protocol operation
|
||||
* has been stopped.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aMaxChildren The maximum allowed children.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully set the max.
|
||||
* @retval kThreadError_InvalidArgs If @p aMaxChildren is not in the range [1, OPENTHREAD_CONFIG_MAX_CHILDREN].
|
||||
* @retval kThreadError_InvalidState If Thread isn't stopped.
|
||||
*
|
||||
* @sa otThreadGetMaxAllowedChildren, otThreadStop
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadSetMaxAllowedChildren(otInstance *aInstance, uint8_t aMaxChildren);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not the Router Role is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval TRUE If the Router Role is enabled.
|
||||
* @retval FALSE If the Router Role is not enabled.
|
||||
*
|
||||
*/
|
||||
OTAPI bool OTCALL otThreadIsRouterRoleEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets whether or not the Router Role is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled TRUE if the Router Role is enabled, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetRouterRoleEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* Set the preferred Router Id.
|
||||
*
|
||||
* Upon becoming a router/leader the node attempts to use this Router Id. If the
|
||||
* preferred Router Id is not set or if it can not be used, a randomly generated
|
||||
* router id is picked. This property can be set only when the device role is
|
||||
* either detached or disabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aRouterId The preferred Router Id.
|
||||
*
|
||||
* @retval kThreadError_None Successfully set the preferred Router Id.
|
||||
* @retval kThreadError_InvalidState Could not set (role is not detached or disabled)
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId);
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup config-router Router/Leader
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that manage configuration parameters for the Thread Router and Leader roles.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the Thread Leader Weight used when operating in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The Thread Leader Weight value.
|
||||
*
|
||||
* @sa otThreadSetLeaderWeight
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetLocalLeaderWeight(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the Thread Leader Weight used when operating in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aWeight The Thread Leader Weight value.
|
||||
*
|
||||
* @sa otThreadGetLeaderWeight
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetLocalLeaderWeight(otInstance *aInstance, uint8_t aWeight);
|
||||
|
||||
/**
|
||||
* Get the Thread Leader Partition Id used when operating in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The Thread Leader Partition Id value.
|
||||
*
|
||||
*/
|
||||
OTAPI uint32_t OTCALL otThreadGetLocalLeaderPartitionId(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the Thread Leader Partition Id used when operating in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPartitionId The Thread Leader Partition Id value.
|
||||
*
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetLocalLeaderPartitionId(otInstance *aInstance, uint32_t aPartitionId);
|
||||
|
||||
/**
|
||||
* Get the Joiner UDP Port.
|
||||
*
|
||||
@@ -76,6 +202,225 @@ OTAPI uint16_t OTCALL otThreadGetJoinerUdpPort(otInstance *aInstance);
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadSetJoinerUdpPort(otInstance *aInstance, uint16_t aJoinerUdpPort);
|
||||
|
||||
/**
|
||||
* @defgroup config-test Test
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that manage configuration parameters required for Thread Certification testing.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The CONTEXT_ID_REUSE_DELAY value.
|
||||
*
|
||||
* @sa otThreadSetContextIdReuseDelay
|
||||
*/
|
||||
OTAPI uint32_t OTCALL otThreadGetContextIdReuseDelay(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDelay The CONTEXT_ID_REUSE_DELAY value.
|
||||
*
|
||||
* @sa otThreadGetContextIdReuseDelay
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetContextIdReuseDelay(otInstance *aInstance, uint32_t aDelay);
|
||||
|
||||
/**
|
||||
* Get the NETWORK_ID_TIMEOUT parameter used in the Router role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The NETWORK_ID_TIMEOUT value.
|
||||
*
|
||||
* @sa otThreadSetNetworkIdTimeout
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetNetworkIdTimeout(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the NETWORK_ID_TIMEOUT parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aTimeout The NETWORK_ID_TIMEOUT value.
|
||||
*
|
||||
* @sa otThreadGetNetworkIdTimeout
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetNetworkIdTimeout(otInstance *aInstance, uint8_t aTimeout);
|
||||
|
||||
/**
|
||||
* Get the ROUTER_UPGRADE_THRESHOLD parameter used in the REED role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The ROUTER_UPGRADE_THRESHOLD value.
|
||||
*
|
||||
* @sa otThreadSetRouterUpgradeThreshold
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetRouterUpgradeThreshold(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the ROUTER_UPGRADE_THRESHOLD parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aThreshold The ROUTER_UPGRADE_THRESHOLD value.
|
||||
*
|
||||
* @sa otThreadGetRouterUpgradeThreshold
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetRouterUpgradeThreshold(otInstance *aInstance, uint8_t aThreshold);
|
||||
|
||||
/**
|
||||
* Release a Router ID that has been allocated by the device in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aRouterId The Router ID to release. Valid range is [0, 62].
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully released the Router ID specified by aRouterId.
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadReleaseRouterId(otInstance *aInstance, uint8_t aRouterId);
|
||||
|
||||
/**
|
||||
* Attempt to become a router.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully begin attempt to become a router.
|
||||
* @retval kThreadErrorInvalidState Thread is disabled.
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadBecomeRouter(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Become a leader and start a new partition.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully became a leader and started a new partition.
|
||||
* @retval kThreadErrorInvalidState Thread is disabled.
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadBecomeLeader(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The ROUTER_DOWNGRADE_THRESHOLD value.
|
||||
*
|
||||
* @sa otThreadSetRouterDowngradeThreshold
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetRouterDowngradeThreshold(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Leader role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aThreshold The ROUTER_DOWNGRADE_THRESHOLD value.
|
||||
*
|
||||
* @sa otThreadGetRouterDowngradeThreshold
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetRouterDowngradeThreshold(otInstance *aInstance, uint8_t aThreshold);
|
||||
|
||||
/**
|
||||
* Get the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
* @sa otThreadSetRouterSelectionJitter
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetRouterSelectionJitter(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aRouterJitter The ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
* @sa otThreadGetRouterSelectionJitter
|
||||
*/
|
||||
OTAPI void OTCALL otThreadSetRouterSelectionJitter(otInstance *aInstance, uint8_t aRouterJitter);
|
||||
|
||||
/**
|
||||
* @addtogroup diags Diagnostics
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that expose internal state.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* The function retains diagnostic information for an attached Child by its Child ID or RLOC16.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChildId The Child ID or RLOC16 for the attached child.
|
||||
* @param[out] aChildInfo A pointer to where the child information is placed.
|
||||
*
|
||||
* @retavl kThreadError_None @p aChildInfo was successfully updated with the info for the given ID.
|
||||
* @retval kThreadError_NotFound No valid child with this Child ID.
|
||||
* @retavl kThreadError_InvalidArgs If @p aChildInfo is NULL.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadGetChildInfoById(otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo);
|
||||
|
||||
/**
|
||||
* The function retains diagnostic information for an attached Child by the internal table index.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChildIndex The table index.
|
||||
* @param[out] aChildInfo A pointer to where the child information is placed.
|
||||
*
|
||||
* @retavl kThreadError_None @p aChildInfo was successfully updated with the info for the given index.
|
||||
* @retval kThreadError_NotFound No valid child at this index.
|
||||
* @retavl kThreadError_InvalidArgs Either @p aChildInfo is NULL, or @p aChildIndex is out of range (higher
|
||||
* than max table index).
|
||||
*
|
||||
* @sa otGetMaxAllowedChildren
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadGetChildInfoByIndex(otInstance *aInstance, uint8_t aChildIndex,
|
||||
otChildInfo *aChildInfo);
|
||||
|
||||
/**
|
||||
* Get the current Router ID Sequence.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The Router ID Sequence.
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otThreadGetRouterIdSequence(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* The function retains diagnostic information for a given Thread Router.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aRouterId The router ID or RLOC16 for a given router.
|
||||
* @param[out] aRouterInfo A pointer to where the router information is placed.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadGetRouterInfo(otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo);
|
||||
|
||||
/**
|
||||
* This function gets an EID cache entry.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aIndex An index into the EID cache table.
|
||||
* @param[out] aEntry A pointer to where the EID information is placed.
|
||||
*
|
||||
* @retval kThreadError_None Successfully retrieved the EID cache entry.
|
||||
* @retval kThreadError_InvalidArgs @p aIndex was out of bounds or @p aEntry was NULL.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otThreadGetEidCacheEntry(otInstance *aInstance, uint8_t aIndex, otEidCacheEntry *aEntry);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
+38
-1
@@ -89,8 +89,10 @@ const struct Command Interpreter::sCommands[] =
|
||||
{ "blacklist", &Interpreter::ProcessBlacklist },
|
||||
{ "bufferinfo", &Interpreter::ProcessBufferInfo },
|
||||
{ "channel", &Interpreter::ProcessChannel },
|
||||
#if OPENTHREAD_FTD
|
||||
{ "child", &Interpreter::ProcessChild },
|
||||
{ "childmax", &Interpreter::ProcessChildMax },
|
||||
#endif
|
||||
{ "childtimeout", &Interpreter::ProcessChildTimeout },
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
{ "coap", &Interpreter::ProcessCoap },
|
||||
@@ -98,7 +100,9 @@ const struct Command Interpreter::sCommands[] =
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
{ "commissioner", &Interpreter::ProcessCommissioner },
|
||||
#endif
|
||||
#if OPENTHREAD_FTD
|
||||
{ "contextreusedelay", &Interpreter::ProcessContextIdReuseDelay },
|
||||
#endif
|
||||
{ "counter", &Interpreter::ProcessCounters },
|
||||
{ "dataset", &Interpreter::ProcessDataset },
|
||||
#if OPENTHREAD_FTD
|
||||
@@ -111,7 +115,9 @@ const struct Command Interpreter::sCommands[] =
|
||||
#if OPENTHREAD_ENABLE_DNS_CLIENT
|
||||
{ "dns", &Interpreter::ProcessDns },
|
||||
#endif
|
||||
#if OPENTHREAD_FTD
|
||||
{ "eidcache", &Interpreter::ProcessEidCache },
|
||||
#endif
|
||||
{ "eui64", &Interpreter::ProcessEui64 },
|
||||
#ifdef OPENTHREAD_EXAMPLES_POSIX
|
||||
{ "exit", &Interpreter::ProcessExit },
|
||||
@@ -137,14 +143,18 @@ const struct Command Interpreter::sCommands[] =
|
||||
#endif
|
||||
{ "keysequence", &Interpreter::ProcessKeySequence },
|
||||
{ "leaderdata", &Interpreter::ProcessLeaderData },
|
||||
#if OPENTHREAD_FTD
|
||||
{ "leaderpartitionid", &Interpreter::ProcessLeaderPartitionId },
|
||||
{ "leaderweight", &Interpreter::ProcessLeaderWeight },
|
||||
#endif
|
||||
{ "linkquality", &Interpreter::ProcessLinkQuality },
|
||||
{ "masterkey", &Interpreter::ProcessMasterKey },
|
||||
{ "mode", &Interpreter::ProcessMode },
|
||||
{ "netdataregister", &Interpreter::ProcessNetworkDataRegister },
|
||||
{ "networkdiagnostic", &Interpreter::ProcessNetworkDiagnostic },
|
||||
#if OPENTHREAD_FTD
|
||||
{ "networkidtimeout", &Interpreter::ProcessNetworkIdTimeout },
|
||||
#endif
|
||||
{ "networkname", &Interpreter::ProcessNetworkName },
|
||||
{ "panid", &Interpreter::ProcessPanId },
|
||||
{ "parent", &Interpreter::ProcessParent },
|
||||
@@ -158,16 +168,18 @@ const struct Command Interpreter::sCommands[] =
|
||||
{ "prefix", &Interpreter::ProcessPrefix },
|
||||
#if OPENTHREAD_FTD
|
||||
{ "pskc", &Interpreter::ProcessPSKc },
|
||||
#endif
|
||||
{ "releaserouterid", &Interpreter::ProcessReleaseRouterId },
|
||||
#endif
|
||||
{ "reset", &Interpreter::ProcessReset },
|
||||
{ "rloc16", &Interpreter::ProcessRloc16 },
|
||||
{ "route", &Interpreter::ProcessRoute },
|
||||
#if OPENTHREAD_FTD
|
||||
{ "router", &Interpreter::ProcessRouter },
|
||||
{ "routerdowngradethreshold", &Interpreter::ProcessRouterDowngradeThreshold },
|
||||
{ "routerrole", &Interpreter::ProcessRouterRole },
|
||||
{ "routerselectionjitter", &Interpreter::ProcessRouterSelectionJitter },
|
||||
{ "routerupgradethreshold", &Interpreter::ProcessRouterUpgradeThreshold },
|
||||
#endif
|
||||
{ "scan", &Interpreter::ProcessScan },
|
||||
{ "singleton", &Interpreter::ProcessSingleton },
|
||||
{ "state", &Interpreter::ProcessState },
|
||||
@@ -476,6 +488,7 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
void Interpreter::ProcessChild(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
@@ -610,6 +623,7 @@ void Interpreter::ProcessChildMax(int argc, char *argv[])
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
void Interpreter::ProcessChildTimeout(int argc, char *argv[])
|
||||
{
|
||||
@@ -641,6 +655,7 @@ void Interpreter::ProcessCoap(int argc, char *argv[])
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
void Interpreter::ProcessContextIdReuseDelay(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
@@ -659,6 +674,7 @@ void Interpreter::ProcessContextIdReuseDelay(int argc, char *argv[])
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
void Interpreter::ProcessCounters(int argc, char *argv[])
|
||||
{
|
||||
@@ -851,6 +867,7 @@ void Interpreter::HandleDnsResponse(const char *aHostname, Ip6::Address &aAddres
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
void Interpreter::ProcessEidCache(int argc, char *argv[])
|
||||
{
|
||||
otEidCacheEntry entry;
|
||||
@@ -881,6 +898,7 @@ exit:
|
||||
(void)argv;
|
||||
AppendResult(kThreadError_None);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
void Interpreter::ProcessEui64(int argc, char *argv[])
|
||||
{
|
||||
@@ -1231,6 +1249,7 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
void Interpreter::ProcessLeaderPartitionId(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
@@ -1268,6 +1287,7 @@ void Interpreter::ProcessLeaderWeight(int argc, char *argv[])
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
void Interpreter::ProcessLinkQuality(int argc, char *argv[])
|
||||
{
|
||||
@@ -1431,6 +1451,7 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
void Interpreter::ProcessNetworkIdTimeout(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
@@ -1449,6 +1470,7 @@ void Interpreter::ProcessNetworkIdTimeout(int argc, char *argv[])
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
void Interpreter::ProcessNetworkName(int argc, char *argv[])
|
||||
{
|
||||
@@ -1977,6 +1999,7 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
void Interpreter::ProcessReleaseRouterId(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
@@ -1990,6 +2013,7 @@ void Interpreter::ProcessReleaseRouterId(int argc, char *argv[])
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
void Interpreter::ProcessReset(int argc, char *argv[])
|
||||
{
|
||||
@@ -2124,6 +2148,7 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
void Interpreter::ProcessRouter(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
@@ -2299,6 +2324,7 @@ void Interpreter::ProcessRouterUpgradeThreshold(int argc, char *argv[])
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
void Interpreter::ProcessScan(int argc, char *argv[])
|
||||
{
|
||||
@@ -2396,6 +2422,8 @@ void Interpreter::ProcessState(int argc, char *argv[])
|
||||
sServer->OutputFormat("child\r\n");
|
||||
break;
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
case kDeviceRoleRouter:
|
||||
sServer->OutputFormat("router\r\n");
|
||||
break;
|
||||
@@ -2403,6 +2431,11 @@ void Interpreter::ProcessState(int argc, char *argv[])
|
||||
case kDeviceRoleLeader:
|
||||
sServer->OutputFormat("leader\r\n");
|
||||
break;
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
default:
|
||||
sServer->OutputFormat("invalid state\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2415,6 +2448,8 @@ void Interpreter::ProcessState(int argc, char *argv[])
|
||||
{
|
||||
SuccessOrExit(error = otThreadBecomeChild(mInstance, kMleAttachSamePartition1));
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
else if (strcmp(argv[0], "router") == 0)
|
||||
{
|
||||
SuccessOrExit(error = otThreadBecomeRouter(mInstance));
|
||||
@@ -2423,6 +2458,8 @@ void Interpreter::ProcessState(int argc, char *argv[])
|
||||
{
|
||||
SuccessOrExit(error = otThreadBecomeLeader(mInstance));
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
else
|
||||
{
|
||||
ExitNow(error = kThreadError_Parse);
|
||||
|
||||
+20
-4
@@ -163,19 +163,25 @@ private:
|
||||
void ProcessBufferInfo(int argc, char *argv[]);
|
||||
void ProcessBlacklist(int argc, char *argv[]);
|
||||
void ProcessChannel(int argc, char *argv[]);
|
||||
#if OPENTHREAD_FTD
|
||||
void ProcessChild(int argc, char *argv[]);
|
||||
void ProcessChildTimeout(int argc, char *argv[]);
|
||||
void ProcessChildMax(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessChildTimeout(int argc, char *argv[]);
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
void ProcessCoap(int argc, char *argv[]);
|
||||
#endif //OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
void ProcessCommissioner(int argc, char *argv[]);
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
#if OPENTHREAD_FTD
|
||||
void ProcessContextIdReuseDelay(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessCounters(int argc, char *argv[]);
|
||||
void ProcessDataset(int argc, char *argv[]);
|
||||
#if OPENTHREAD_FTD
|
||||
void ProcessDelayTimerMin(int argc, char *argv[]);
|
||||
#endif
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
void ProcessDiag(int argc, char *argv[]);
|
||||
#endif // OPENTHREAD_ENABLE_DIAG
|
||||
@@ -183,7 +189,9 @@ private:
|
||||
#if OPENTHREAD_ENABLE_DNS_CLIENT
|
||||
void ProcessDns(int argc, char *argv[]);
|
||||
#endif
|
||||
#if OPENTHREAD_FTD
|
||||
void ProcessEidCache(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessEui64(int argc, char *argv[]);
|
||||
#ifdef OPENTHREAD_EXAMPLES_POSIX
|
||||
void ProcessExit(int argc, char *argv[]);
|
||||
@@ -205,17 +213,23 @@ private:
|
||||
#if OPENTHREAD_ENABLE_JOINER
|
||||
void ProcessJoiner(int argc, char *argv[]);
|
||||
#endif // OPENTHREAD_ENABLE_JOINER
|
||||
#if OPENTHREAD_FTD
|
||||
void ProcessJoinerPort(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessKeySequence(int argc, char *argv[]);
|
||||
void ProcessLeaderData(int argc, char *argv[]);
|
||||
#if OPENTHREAD_FTD
|
||||
void ProcessLeaderPartitionId(int argc, char *argv[]);
|
||||
void ProcessLeaderWeight(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessLinkQuality(int argc, char *argv[]);
|
||||
void ProcessMasterKey(int argc, char *argv[]);
|
||||
void ProcessMode(int argc, char *argv[]);
|
||||
void ProcessNetworkDataRegister(int argc, char *argv[]);
|
||||
void ProcessNetworkDiagnostic(int argc, char *argv[]);
|
||||
#if OPENTHREAD_FTD
|
||||
void ProcessNetworkIdTimeout(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessNetworkName(int argc, char *argv[]);
|
||||
void ProcessPanId(int argc, char *argv[]);
|
||||
void ProcessParent(int argc, char *argv[]);
|
||||
@@ -228,17 +242,19 @@ private:
|
||||
void ProcessPromiscuous(int argc, char *argv[]);
|
||||
#if OPENTHREAD_FTD
|
||||
void ProcessPSKc(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessReleaseRouterId(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessReset(int argc, char *argv[]);
|
||||
void ProcessRoute(int argc, char *argv[]);
|
||||
ThreadError ProcessRouteAdd(int argc, char *argv[]);
|
||||
ThreadError ProcessRouteRemove(int argc, char *argv[]);
|
||||
#if OPENTHREAD_FTD
|
||||
void ProcessRouter(int argc, char *argv[]);
|
||||
void ProcessRouterDowngradeThreshold(int argc, char *argv[]);
|
||||
void ProcessRouterRole(int argc, char *argv[]);
|
||||
void ProcessRouterSelectionJitter(int argc, char *argv[]);
|
||||
ThreadError ProcessRouteAdd(int argc, char *argv[]);
|
||||
ThreadError ProcessRouteRemove(int argc, char *argv[]);
|
||||
void ProcessRouterUpgradeThreshold(int argc, char *argv[]);
|
||||
#endif
|
||||
void ProcessRloc16(int argc, char *argv[]);
|
||||
void ProcessScan(int argc, char *argv[]);
|
||||
void ProcessSingleton(int argc, char *argv[]);
|
||||
|
||||
@@ -264,8 +264,6 @@ HEADERS_COMMON = \
|
||||
net/tcp.hpp \
|
||||
net/udp6.hpp \
|
||||
thread/address_resolver.hpp \
|
||||
thread/address_resolver_ftd.hpp \
|
||||
thread/address_resolver_mtd.hpp \
|
||||
thread/announce_begin_server.hpp \
|
||||
thread/data_poll_manager.hpp \
|
||||
thread/energy_scan_server.hpp \
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the OpenThread UDP API.
|
||||
* This file implements the OpenThread Commissioner API.
|
||||
*/
|
||||
|
||||
#include "openthread/commissioner.h"
|
||||
|
||||
@@ -31,14 +31,14 @@
|
||||
* This file implements the OpenThread Operational Dataset API (FTD only).
|
||||
*/
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#include "openthread/dataset_ftd.h"
|
||||
|
||||
#include "openthread-instance.h"
|
||||
|
||||
using namespace ot;
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
ThreadError otDatasetSetActive(otInstance *aInstance, const otOperationalDataset *aDataset)
|
||||
{
|
||||
ThreadError error;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the OpenThread UDP API.
|
||||
* This file implements the OpenThread DHCPv6 API.
|
||||
*/
|
||||
|
||||
#include "openthread/dhcp6_client.h"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the OpenThread UDP API.
|
||||
* This file implements the OpenThread ICMPv6 API.
|
||||
*/
|
||||
|
||||
#include "openthread/icmp6.h"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the OpenThread UDP API.
|
||||
* This file implements the OpenThread IPv6 API.
|
||||
*/
|
||||
|
||||
#define WPP_NAME "ip6_api.tmh"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the OpenThread UDP API.
|
||||
* This file implements the OpenThread Joiner API.
|
||||
*/
|
||||
|
||||
#include "openthread/joiner.h"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements blacklist IEEE 802.15.4 frame filtering based on MAC address.
|
||||
* This file implements the OpenThread Link Raw API.
|
||||
*/
|
||||
|
||||
#include <common/debug.hpp>
|
||||
|
||||
@@ -42,20 +42,6 @@
|
||||
|
||||
using namespace ot;
|
||||
|
||||
uint8_t otThreadGetMaxAllowedChildren(otInstance *aInstance)
|
||||
{
|
||||
uint8_t aNumChildren;
|
||||
|
||||
(void)aInstance->mThreadNetif.GetMle().GetChildren(&aNumChildren);
|
||||
|
||||
return aNumChildren;
|
||||
}
|
||||
|
||||
ThreadError otThreadSetMaxAllowedChildren(otInstance *aInstance, uint8_t aMaxChildren)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().SetMaxAllowedChildren(aMaxChildren);
|
||||
}
|
||||
|
||||
uint32_t otThreadGetChildTimeout(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetTimeout();
|
||||
@@ -249,46 +235,6 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
bool otThreadIsRouterRoleEnabled(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().IsRouterRoleEnabled();
|
||||
}
|
||||
|
||||
void otThreadSetRouterRoleEnabled(otInstance *aInstance, bool aEnabled)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetRouterRoleEnabled(aEnabled);
|
||||
}
|
||||
|
||||
uint8_t otThreadGetLocalLeaderWeight(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetLeaderWeight();
|
||||
}
|
||||
|
||||
void otThreadSetLocalLeaderWeight(otInstance *aInstance, uint8_t aWeight)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetLeaderWeight(aWeight);
|
||||
}
|
||||
|
||||
uint32_t otThreadGetLocalLeaderPartitionId(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetLeaderPartitionId();
|
||||
}
|
||||
|
||||
void otThreadSetLocalLeaderPartitionId(otInstance *aInstance, uint32_t aPartitionId)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().SetLeaderPartitionId(aPartitionId);
|
||||
}
|
||||
|
||||
uint32_t otThreadGetContextIdReuseDelay(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetNetworkDataLeader().GetContextIdReuseDelay();
|
||||
}
|
||||
|
||||
void otThreadSetContextIdReuseDelay(otInstance *aInstance, uint32_t aDelay)
|
||||
{
|
||||
aInstance->mThreadNetif.GetNetworkDataLeader().SetContextIdReuseDelay(aDelay);
|
||||
}
|
||||
|
||||
uint32_t otThreadGetKeySequenceCounter(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetKeyManager().GetCurrentKeySequence();
|
||||
@@ -309,31 +255,6 @@ void otThreadSetKeySwitchGuardTime(otInstance *aInstance, uint32_t aKeySwitchGua
|
||||
aInstance->mThreadNetif.GetKeyManager().SetKeySwitchGuardTime(aKeySwitchGuardTime);
|
||||
}
|
||||
|
||||
uint8_t otThreadGetNetworkIdTimeout(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetNetworkIdTimeout();
|
||||
}
|
||||
|
||||
void otThreadSetNetworkIdTimeout(otInstance *aInstance, uint8_t aTimeout)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetNetworkIdTimeout((uint8_t)aTimeout);
|
||||
}
|
||||
|
||||
uint8_t otThreadGetRouterUpgradeThreshold(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetRouterUpgradeThreshold();
|
||||
}
|
||||
|
||||
void otThreadSetRouterUpgradeThreshold(otInstance *aInstance, uint8_t aThreshold)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetRouterUpgradeThreshold(aThreshold);
|
||||
}
|
||||
|
||||
ThreadError otThreadReleaseRouterId(otInstance *aInstance, uint8_t aRouterId)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().ReleaseRouterId(aRouterId);
|
||||
}
|
||||
|
||||
ThreadError otThreadBecomeDetached(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().BecomeDetached();
|
||||
@@ -344,78 +265,6 @@ ThreadError otThreadBecomeChild(otInstance *aInstance, otMleAttachFilter aFilter
|
||||
return aInstance->mThreadNetif.GetMle().BecomeChild(aFilter);
|
||||
}
|
||||
|
||||
ThreadError otThreadBecomeRouter(otInstance *aInstance)
|
||||
{
|
||||
ThreadError error = kThreadError_InvalidState;
|
||||
|
||||
switch (aInstance->mThreadNetif.GetMle().GetDeviceState())
|
||||
{
|
||||
case Mle::kDeviceStateDisabled:
|
||||
case Mle::kDeviceStateDetached:
|
||||
break;
|
||||
|
||||
case Mle::kDeviceStateChild:
|
||||
error = aInstance->mThreadNetif.GetMle().BecomeRouter(ThreadStatusTlv::kHaveChildIdRequest);
|
||||
break;
|
||||
|
||||
case Mle::kDeviceStateRouter:
|
||||
case Mle::kDeviceStateLeader:
|
||||
error = kThreadError_None;
|
||||
break;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
ThreadError otThreadBecomeLeader(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().BecomeLeader();
|
||||
}
|
||||
|
||||
uint8_t otThreadGetRouterDowngradeThreshold(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetRouterDowngradeThreshold();
|
||||
}
|
||||
|
||||
void otThreadSetRouterDowngradeThreshold(otInstance *aInstance, uint8_t aThreshold)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetRouterDowngradeThreshold(aThreshold);
|
||||
}
|
||||
|
||||
uint8_t otThreadGetRouterSelectionJitter(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetRouterSelectionJitter();
|
||||
}
|
||||
|
||||
void otThreadSetRouterSelectionJitter(otInstance *aInstance, uint8_t aRouterJitter)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetRouterSelectionJitter(aRouterJitter);
|
||||
}
|
||||
|
||||
ThreadError otThreadGetChildInfoById(otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aChildInfo != NULL, error = kThreadError_InvalidArgs);
|
||||
|
||||
error = aInstance->mThreadNetif.GetMle().GetChildInfoById(aChildId, *aChildInfo);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
ThreadError otThreadGetChildInfoByIndex(otInstance *aInstance, uint8_t aChildIndex, otChildInfo *aChildInfo)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aChildInfo != NULL, error = kThreadError_InvalidArgs);
|
||||
|
||||
error = aInstance->mThreadNetif.GetMle().GetChildInfoByIndex(aChildIndex, *aChildInfo);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
ThreadError otThreadGetNextNeighborInfo(otInstance *aInstance, otNeighborInfoIterator *aIterator, otNeighborInfo *aInfo)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
@@ -458,17 +307,6 @@ otDeviceRole otThreadGetDeviceRole(otInstance *aInstance)
|
||||
return rval;
|
||||
}
|
||||
|
||||
ThreadError otThreadGetEidCacheEntry(otInstance *aInstance, uint8_t aIndex, otEidCacheEntry *aEntry)
|
||||
{
|
||||
ThreadError error;
|
||||
|
||||
VerifyOrExit(aEntry != NULL, error = kThreadError_InvalidArgs);
|
||||
error = aInstance->mThreadNetif.GetAddressResolver().GetEntry(aIndex, *aEntry);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
ThreadError otThreadGetLeaderData(otInstance *aInstance, otLeaderData *aLeaderData)
|
||||
{
|
||||
ThreadError error;
|
||||
@@ -501,23 +339,6 @@ uint16_t otThreadGetRloc16(otInstance *aInstance)
|
||||
return aInstance->mThreadNetif.GetMle().GetRloc16();
|
||||
}
|
||||
|
||||
uint8_t otThreadGetRouterIdSequence(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetRouterIdSequence();
|
||||
}
|
||||
|
||||
ThreadError otThreadGetRouterInfo(otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aRouterInfo != NULL, error = kThreadError_InvalidArgs);
|
||||
|
||||
error = aInstance->mThreadNetif.GetMle().GetRouterInfo(aRouterId, *aRouterInfo);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
ThreadError otThreadGetParentInfo(otInstance *aInstance, otRouterInfo *aParentInfo)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
@@ -613,11 +434,6 @@ const char *otGetVersionString(void)
|
||||
return sVersion;
|
||||
}
|
||||
|
||||
ThreadError otThreadSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().SetPreferredRouterId(aRouterId);
|
||||
}
|
||||
|
||||
void otThreadSetReceiveDiagnosticGetCallback(otInstance *aInstance, otReceiveDiagnosticGetCallback aCallback,
|
||||
void *aCallbackContext)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
* This file implements the OpenThread Thread API (FTD only).
|
||||
*/
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#define WPP_NAME "thread_ftd_api.tmh"
|
||||
|
||||
#include "openthread/thread_ftd.h"
|
||||
@@ -39,7 +41,55 @@
|
||||
|
||||
using namespace ot;
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
uint8_t otThreadGetMaxAllowedChildren(otInstance *aInstance)
|
||||
{
|
||||
uint8_t aNumChildren;
|
||||
|
||||
(void)aInstance->mThreadNetif.GetMle().GetChildren(&aNumChildren);
|
||||
|
||||
return aNumChildren;
|
||||
}
|
||||
|
||||
ThreadError otThreadSetMaxAllowedChildren(otInstance *aInstance, uint8_t aMaxChildren)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().SetMaxAllowedChildren(aMaxChildren);
|
||||
}
|
||||
|
||||
bool otThreadIsRouterRoleEnabled(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().IsRouterRoleEnabled();
|
||||
}
|
||||
|
||||
void otThreadSetRouterRoleEnabled(otInstance *aInstance, bool aEnabled)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetRouterRoleEnabled(aEnabled);
|
||||
}
|
||||
|
||||
ThreadError otThreadSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().SetPreferredRouterId(aRouterId);
|
||||
}
|
||||
|
||||
|
||||
uint8_t otThreadGetLocalLeaderWeight(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetLeaderWeight();
|
||||
}
|
||||
|
||||
void otThreadSetLocalLeaderWeight(otInstance *aInstance, uint8_t aWeight)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetLeaderWeight(aWeight);
|
||||
}
|
||||
|
||||
uint32_t otThreadGetLocalLeaderPartitionId(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetLeaderPartitionId();
|
||||
}
|
||||
|
||||
void otThreadSetLocalLeaderPartitionId(otInstance *aInstance, uint32_t aPartitionId)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().SetLeaderPartitionId(aPartitionId);
|
||||
}
|
||||
|
||||
uint16_t otThreadGetJoinerUdpPort(otInstance *aInstance)
|
||||
{
|
||||
@@ -51,4 +101,140 @@ ThreadError otThreadSetJoinerUdpPort(otInstance *aInstance, uint16_t aJoinerUdpP
|
||||
return aInstance->mThreadNetif.GetJoinerRouter().SetJoinerUdpPort(aJoinerUdpPort);
|
||||
}
|
||||
|
||||
uint32_t otThreadGetContextIdReuseDelay(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetNetworkDataLeader().GetContextIdReuseDelay();
|
||||
}
|
||||
|
||||
void otThreadSetContextIdReuseDelay(otInstance *aInstance, uint32_t aDelay)
|
||||
{
|
||||
aInstance->mThreadNetif.GetNetworkDataLeader().SetContextIdReuseDelay(aDelay);
|
||||
}
|
||||
|
||||
uint8_t otThreadGetNetworkIdTimeout(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetNetworkIdTimeout();
|
||||
}
|
||||
|
||||
void otThreadSetNetworkIdTimeout(otInstance *aInstance, uint8_t aTimeout)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetNetworkIdTimeout((uint8_t)aTimeout);
|
||||
}
|
||||
|
||||
uint8_t otThreadGetRouterUpgradeThreshold(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetRouterUpgradeThreshold();
|
||||
}
|
||||
|
||||
void otThreadSetRouterUpgradeThreshold(otInstance *aInstance, uint8_t aThreshold)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetRouterUpgradeThreshold(aThreshold);
|
||||
}
|
||||
|
||||
ThreadError otThreadReleaseRouterId(otInstance *aInstance, uint8_t aRouterId)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().ReleaseRouterId(aRouterId);
|
||||
}
|
||||
|
||||
ThreadError otThreadBecomeRouter(otInstance *aInstance)
|
||||
{
|
||||
ThreadError error = kThreadError_InvalidState;
|
||||
|
||||
switch (aInstance->mThreadNetif.GetMle().GetDeviceState())
|
||||
{
|
||||
case Mle::kDeviceStateDisabled:
|
||||
case Mle::kDeviceStateDetached:
|
||||
break;
|
||||
|
||||
case Mle::kDeviceStateChild:
|
||||
error = aInstance->mThreadNetif.GetMle().BecomeRouter(ThreadStatusTlv::kHaveChildIdRequest);
|
||||
break;
|
||||
|
||||
case Mle::kDeviceStateRouter:
|
||||
case Mle::kDeviceStateLeader:
|
||||
error = kThreadError_None;
|
||||
break;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
ThreadError otThreadBecomeLeader(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().BecomeLeader();
|
||||
}
|
||||
|
||||
uint8_t otThreadGetRouterDowngradeThreshold(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetRouterDowngradeThreshold();
|
||||
}
|
||||
|
||||
void otThreadSetRouterDowngradeThreshold(otInstance *aInstance, uint8_t aThreshold)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetRouterDowngradeThreshold(aThreshold);
|
||||
}
|
||||
|
||||
uint8_t otThreadGetRouterSelectionJitter(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetRouterSelectionJitter();
|
||||
}
|
||||
|
||||
void otThreadSetRouterSelectionJitter(otInstance *aInstance, uint8_t aRouterJitter)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMle().SetRouterSelectionJitter(aRouterJitter);
|
||||
}
|
||||
|
||||
ThreadError otThreadGetChildInfoById(otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aChildInfo != NULL, error = kThreadError_InvalidArgs);
|
||||
|
||||
error = aInstance->mThreadNetif.GetMle().GetChildInfoById(aChildId, *aChildInfo);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
ThreadError otThreadGetChildInfoByIndex(otInstance *aInstance, uint8_t aChildIndex, otChildInfo *aChildInfo)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aChildInfo != NULL, error = kThreadError_InvalidArgs);
|
||||
|
||||
error = aInstance->mThreadNetif.GetMle().GetChildInfoByIndex(aChildIndex, *aChildInfo);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
uint8_t otThreadGetRouterIdSequence(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetRouterIdSequence();
|
||||
}
|
||||
|
||||
ThreadError otThreadGetRouterInfo(otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aRouterInfo != NULL, error = kThreadError_InvalidArgs);
|
||||
|
||||
error = aInstance->mThreadNetif.GetMle().GetRouterInfo(aRouterId, *aRouterInfo);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
ThreadError otThreadGetEidCacheEntry(otInstance *aInstance, uint8_t aIndex, otEidCacheEntry *aEntry)
|
||||
{
|
||||
ThreadError error;
|
||||
|
||||
VerifyOrExit(aEntry != NULL, error = kThreadError_InvalidArgs);
|
||||
error = aInstance->mThreadNetif.GetAddressResolver().GetEntry(aIndex, *aEntry);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#define WPP_NAME "dataset_manager.tmh"
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
@@ -60,8 +62,6 @@
|
||||
#include <thread/thread_uris.hpp>
|
||||
#include <meshcop/leader.hpp>
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
namespace ot {
|
||||
namespace MeshCoP {
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
* This file implements the Joiner Router role.
|
||||
*/
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#define WPP_NAME "joiner_router.tmh"
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
@@ -39,8 +41,6 @@
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <common/code_utils.hpp>
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
* This file implements a MeshCoP Leader.
|
||||
*/
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#define WPP_NAME "leader.tmh"
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
@@ -39,8 +41,6 @@
|
||||
#include <openthread-config.h>
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "openthread/platform/random.h"
|
||||
|
||||
@@ -26,12 +26,185 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if OPENTHREAD_MTD
|
||||
#include "address_resolver_mtd.hpp"
|
||||
#elif OPENTHREAD_FTD
|
||||
#include "address_resolver_ftd.hpp"
|
||||
#else
|
||||
#error "Please define OPENTHREAD_MTD=1 or OPENTHREAD_FTD=1"
|
||||
#endif
|
||||
/**
|
||||
* @file
|
||||
* This file includes definitions for Thread EID-to-RLOC mapping and caching.
|
||||
*/
|
||||
|
||||
#ifndef ADDRESS_RESOLVER_HPP_
|
||||
#define ADDRESS_RESOLVER_HPP_
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
|
||||
#include "openthread/types.h"
|
||||
|
||||
#include <coap/coap_client.hpp>
|
||||
#include <coap/coap_server.hpp>
|
||||
#include <common/timer.hpp>
|
||||
#include <mac/mac.hpp>
|
||||
#include <net/icmp6.hpp>
|
||||
#include <net/udp6.hpp>
|
||||
|
||||
namespace ot {
|
||||
|
||||
class MeshForwarder;
|
||||
class ThreadLastTransactionTimeTlv;
|
||||
class ThreadMeshLocalEidTlv;
|
||||
class ThreadNetif;
|
||||
class ThreadTargetTlv;
|
||||
|
||||
/**
|
||||
* @addtogroup core-arp
|
||||
*
|
||||
* @brief
|
||||
* This module includes definitions for Thread EID-to-RLOC mapping and caching.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements the EID-to-RLOC mapping and caching.
|
||||
*
|
||||
*/
|
||||
class AddressResolver
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* This constructor initializes the object.
|
||||
*
|
||||
*/
|
||||
explicit AddressResolver(ThreadNetif &aThreadNetif);
|
||||
|
||||
/**
|
||||
* This method returns the pointer to the parent otInstance structure.
|
||||
*
|
||||
* @returns The pointer to the parent otInstance structure.
|
||||
*
|
||||
*/
|
||||
otInstance *GetInstance(void);
|
||||
|
||||
/**
|
||||
* This method clears the EID-to-RLOC cache.
|
||||
*
|
||||
*/
|
||||
void Clear(void);
|
||||
|
||||
/**
|
||||
* This method gets an EID cache entry.
|
||||
*
|
||||
* @param[in] aIndex An index into the EID cache table.
|
||||
* @param[out] aEntry A pointer to where the EID information is placed.
|
||||
*
|
||||
* @retval kThreadError_None Successfully retrieved the EID cache entry.
|
||||
* @retval kThreadError_InvalidArgs @p aIndex was out of bounds or @p aEntry was NULL.
|
||||
*
|
||||
*/
|
||||
ThreadError GetEntry(uint8_t aIndex, otEidCacheEntry &aEntry) const;
|
||||
|
||||
/**
|
||||
* This method removes a Router ID from the EID-to-RLOC cache.
|
||||
*
|
||||
* @param[in] aRouterId The Router ID.
|
||||
*
|
||||
*/
|
||||
void Remove(uint8_t aRouterId);
|
||||
|
||||
/**
|
||||
* This method returns the RLOC16 for a given EID, or initiates an Address Query if the mapping is not known.
|
||||
*
|
||||
* @param[in] aEid A reference to the EID.
|
||||
* @param[out] aRloc16 The RLOC16 corresponding to @p aEid.
|
||||
*
|
||||
* @retval kTheradError_None Successfully provided the RLOC16.
|
||||
* @retval kThreadError_AddressQuery Initiated an Address Query.
|
||||
*
|
||||
*/
|
||||
ThreadError Resolve(const Ip6::Address &aEid, Mac::ShortAddress &aRloc16);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
kCacheEntries = OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES,
|
||||
kStateUpdatePeriod = 1000u, ///< State update period in milliseconds.
|
||||
};
|
||||
|
||||
/**
|
||||
* Thread Protocol Parameters and Constants
|
||||
*
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kAddressQueryTimeout = 3, ///< ADDRESS_QUERY_TIMEOUT (seconds)
|
||||
kAddressQueryInitialRetryDelay = 15, ///< ADDRESS_QUERY_INITIAL_RETRY_DELAY (seconds)
|
||||
kAddressQueryMaxRetryDelay = 28800, ///< ADDRESS_QUERY_MAX_RETRY_DELAY (seconds)
|
||||
};
|
||||
|
||||
struct Cache
|
||||
{
|
||||
Ip6::Address mTarget;
|
||||
uint8_t mMeshLocalIid[Ip6::Address::kInterfaceIdentifierSize];
|
||||
uint32_t mLastTransactionTime;
|
||||
Mac::ShortAddress mRloc16;
|
||||
uint16_t mRetryTimeout;
|
||||
uint8_t mTimeout;
|
||||
uint8_t mFailures;
|
||||
uint8_t mAge;
|
||||
|
||||
enum State
|
||||
{
|
||||
kStateInvalid,
|
||||
kStateQuery,
|
||||
kStateCached,
|
||||
};
|
||||
State mState;
|
||||
};
|
||||
|
||||
Cache *NewCacheEntry(void);
|
||||
void MarkCacheEntryAsUsed(Cache &aEntry);
|
||||
void InvalidateCacheEntry(Cache &aEntry);
|
||||
|
||||
ThreadError SendAddressQuery(const Ip6::Address &aEid);
|
||||
ThreadError SendAddressError(const ThreadTargetTlv &aTarget, const ThreadMeshLocalEidTlv &aEid,
|
||||
const Ip6::Address *aDestination);
|
||||
void SendAddressQueryResponse(const ThreadTargetTlv &aTargetTlv, const ThreadMeshLocalEidTlv &aMlEidTlv,
|
||||
const ThreadLastTransactionTimeTlv *aLastTransactionTimeTlv,
|
||||
const Ip6::Address &aDestination);
|
||||
|
||||
static void HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
|
||||
|
||||
static void HandleAddressError(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||
const otMessageInfo *aMessageInfo);
|
||||
void HandleAddressError(Coap::Header &aHeader, Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
|
||||
static void HandleAddressQuery(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||
const otMessageInfo *aMessageInfo);
|
||||
void HandleAddressQuery(Coap::Header &aHeader, Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
|
||||
static void HandleAddressNotification(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||
const otMessageInfo *aMessageInfo);
|
||||
void HandleAddressNotification(Coap::Header &aHeader, Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
|
||||
static void HandleIcmpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo,
|
||||
const otIcmp6Header *aIcmpHeader);
|
||||
void HandleIcmpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo, const Ip6::IcmpHeader &aIcmpHeader);
|
||||
|
||||
static void HandleTimer(void *aContext);
|
||||
void HandleTimer(void);
|
||||
|
||||
Coap::Resource mAddressError;
|
||||
Coap::Resource mAddressQuery;
|
||||
Coap::Resource mAddressNotification;
|
||||
Cache mCache[kCacheEntries];
|
||||
Ip6::IcmpHandler mIcmpHandler;
|
||||
Timer mTimer;
|
||||
|
||||
ThreadNetif &mNetif;
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
} // namespace ot
|
||||
|
||||
#endif // ADDRESS_RESOLVER_HPP_
|
||||
|
||||
@@ -1,210 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes definitions for Thread EID-to-RLOC mapping and caching.
|
||||
*/
|
||||
|
||||
#ifndef ADDRESS_RESOLVER_HPP_
|
||||
#define ADDRESS_RESOLVER_HPP_
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
|
||||
#include "openthread/types.h"
|
||||
|
||||
#include <coap/coap_client.hpp>
|
||||
#include <coap/coap_server.hpp>
|
||||
#include <common/timer.hpp>
|
||||
#include <mac/mac.hpp>
|
||||
#include <net/icmp6.hpp>
|
||||
#include <net/udp6.hpp>
|
||||
|
||||
namespace ot {
|
||||
|
||||
class MeshForwarder;
|
||||
class ThreadLastTransactionTimeTlv;
|
||||
class ThreadMeshLocalEidTlv;
|
||||
class ThreadNetif;
|
||||
class ThreadTargetTlv;
|
||||
|
||||
/**
|
||||
* @addtogroup core-arp
|
||||
*
|
||||
* @brief
|
||||
* This module includes definitions for Thread EID-to-RLOC mapping and caching.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements the EID-to-RLOC mapping and caching.
|
||||
*
|
||||
*/
|
||||
class AddressResolver
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* This constructor initializes the object.
|
||||
*
|
||||
*/
|
||||
explicit AddressResolver(ThreadNetif &aThreadNetif);
|
||||
|
||||
/**
|
||||
* This method returns the pointer to the parent otInstance structure.
|
||||
*
|
||||
* @returns The pointer to the parent otInstance structure.
|
||||
*
|
||||
*/
|
||||
otInstance *GetInstance(void);
|
||||
|
||||
/**
|
||||
* This method clears the EID-to-RLOC cache.
|
||||
*
|
||||
*/
|
||||
void Clear(void);
|
||||
|
||||
/**
|
||||
* This method gets an EID cache entry.
|
||||
*
|
||||
* @param[in] aIndex An index into the EID cache table.
|
||||
* @param[out] aEntry A pointer to where the EID information is placed.
|
||||
*
|
||||
* @retval kThreadError_None Successfully retrieved the EID cache entry.
|
||||
* @retval kThreadError_InvalidArgs @p aIndex was out of bounds or @p aEntry was NULL.
|
||||
*
|
||||
*/
|
||||
ThreadError GetEntry(uint8_t aIndex, otEidCacheEntry &aEntry) const;
|
||||
|
||||
/**
|
||||
* This method removes a Router ID from the EID-to-RLOC cache.
|
||||
*
|
||||
* @param[in] aRouterId The Router ID.
|
||||
*
|
||||
*/
|
||||
void Remove(uint8_t aRouterId);
|
||||
|
||||
/**
|
||||
* This method returns the RLOC16 for a given EID, or initiates an Address Query if the mapping is not known.
|
||||
*
|
||||
* @param[in] aEid A reference to the EID.
|
||||
* @param[out] aRloc16 The RLOC16 corresponding to @p aEid.
|
||||
*
|
||||
* @retval kTheradError_None Successfully provided the RLOC16.
|
||||
* @retval kThreadError_AddressQuery Initiated an Address Query.
|
||||
*
|
||||
*/
|
||||
ThreadError Resolve(const Ip6::Address &aEid, Mac::ShortAddress &aRloc16);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
kCacheEntries = OPENTHREAD_CONFIG_ADDRESS_CACHE_ENTRIES,
|
||||
kStateUpdatePeriod = 1000u, ///< State update period in milliseconds.
|
||||
};
|
||||
|
||||
/**
|
||||
* Thread Protocol Parameters and Constants
|
||||
*
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kAddressQueryTimeout = 3, ///< ADDRESS_QUERY_TIMEOUT (seconds)
|
||||
kAddressQueryInitialRetryDelay = 15, ///< ADDRESS_QUERY_INITIAL_RETRY_DELAY (seconds)
|
||||
kAddressQueryMaxRetryDelay = 28800, ///< ADDRESS_QUERY_MAX_RETRY_DELAY (seconds)
|
||||
};
|
||||
|
||||
struct Cache
|
||||
{
|
||||
Ip6::Address mTarget;
|
||||
uint8_t mMeshLocalIid[Ip6::Address::kInterfaceIdentifierSize];
|
||||
uint32_t mLastTransactionTime;
|
||||
Mac::ShortAddress mRloc16;
|
||||
uint16_t mRetryTimeout;
|
||||
uint8_t mTimeout;
|
||||
uint8_t mFailures;
|
||||
uint8_t mAge;
|
||||
|
||||
enum State
|
||||
{
|
||||
kStateInvalid,
|
||||
kStateQuery,
|
||||
kStateCached,
|
||||
};
|
||||
State mState;
|
||||
};
|
||||
|
||||
Cache *NewCacheEntry(void);
|
||||
void MarkCacheEntryAsUsed(Cache &aEntry);
|
||||
void InvalidateCacheEntry(Cache &aEntry);
|
||||
|
||||
ThreadError SendAddressQuery(const Ip6::Address &aEid);
|
||||
ThreadError SendAddressError(const ThreadTargetTlv &aTarget, const ThreadMeshLocalEidTlv &aEid,
|
||||
const Ip6::Address *aDestination);
|
||||
void SendAddressQueryResponse(const ThreadTargetTlv &aTargetTlv, const ThreadMeshLocalEidTlv &aMlEidTlv,
|
||||
const ThreadLastTransactionTimeTlv *aLastTransactionTimeTlv,
|
||||
const Ip6::Address &aDestination);
|
||||
|
||||
static void HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
|
||||
|
||||
static void HandleAddressError(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||
const otMessageInfo *aMessageInfo);
|
||||
void HandleAddressError(Coap::Header &aHeader, Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
|
||||
static void HandleAddressQuery(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||
const otMessageInfo *aMessageInfo);
|
||||
void HandleAddressQuery(Coap::Header &aHeader, Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
|
||||
static void HandleAddressNotification(void *aContext, otCoapHeader *aHeader, otMessage *aMessage,
|
||||
const otMessageInfo *aMessageInfo);
|
||||
void HandleAddressNotification(Coap::Header &aHeader, Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
|
||||
static void HandleIcmpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo,
|
||||
const otIcmp6Header *aIcmpHeader);
|
||||
void HandleIcmpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo, const Ip6::IcmpHeader &aIcmpHeader);
|
||||
|
||||
static void HandleTimer(void *aContext);
|
||||
void HandleTimer(void);
|
||||
|
||||
Coap::Resource mAddressError;
|
||||
Coap::Resource mAddressQuery;
|
||||
Coap::Resource mAddressNotification;
|
||||
Cache mCache[kCacheEntries];
|
||||
Ip6::IcmpHandler mIcmpHandler;
|
||||
Timer mTimer;
|
||||
|
||||
ThreadNetif &mNetif;
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
} // namespace ot
|
||||
|
||||
#endif // ADDRESS_RESOLVER_HPP_
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes definitions for Thread EID-to-RLOC mapping and caching.
|
||||
*/
|
||||
|
||||
#ifndef ADDRESS_RESOLVER_HPP_
|
||||
#define ADDRESS_RESOLVER_HPP_
|
||||
|
||||
#include "openthread/types.h"
|
||||
|
||||
namespace ot {
|
||||
|
||||
class AddressResolver
|
||||
{
|
||||
public:
|
||||
explicit AddressResolver(ThreadNetif &) { }
|
||||
void Clear(void) { }
|
||||
ThreadError GetEntry(uint8_t, otEidCacheEntry &) const { return kThreadError_NotImplemented; }
|
||||
void Remove(uint8_t) { }
|
||||
ThreadError Resolve(const Ip6::Address &, Mac::ShortAddress &) { return kThreadError_NotImplemented; }
|
||||
};
|
||||
|
||||
} // namespace ot
|
||||
|
||||
#endif // ADDRESS_RESOLVER_HPP_
|
||||
@@ -620,9 +620,6 @@ ThreadError MeshForwarder::UpdateIp6Route(Message &aMessage)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
Ip6::Header ip6Header;
|
||||
uint16_t rloc16;
|
||||
uint16_t aloc16;
|
||||
Neighbor *neighbor;
|
||||
|
||||
mAddMeshHeader = false;
|
||||
|
||||
@@ -672,106 +669,116 @@ ThreadError MeshForwarder::UpdateIp6Route(Message &aMessage)
|
||||
|
||||
break;
|
||||
|
||||
case Mle::kDeviceStateRouter:
|
||||
case Mle::kDeviceStateLeader:
|
||||
if (ip6Header.GetDestination().IsLinkLocal() || ip6Header.GetDestination().IsMulticast())
|
||||
#if OPENTHREAD_FTD
|
||||
{
|
||||
GetMacDestinationAddress(ip6Header.GetDestination(), mMacDest);
|
||||
GetMacSourceAddress(ip6Header.GetSource(), mMacSource);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mNetif.GetMle().IsRoutingLocator(ip6Header.GetDestination()))
|
||||
case Mle::kDeviceStateRouter:
|
||||
case Mle::kDeviceStateLeader:
|
||||
uint16_t rloc16;
|
||||
uint16_t aloc16;
|
||||
Neighbor *neighbor;
|
||||
|
||||
if (ip6Header.GetDestination().IsLinkLocal() || ip6Header.GetDestination().IsMulticast())
|
||||
{
|
||||
rloc16 = HostSwap16(ip6Header.GetDestination().mFields.m16[7]);
|
||||
VerifyOrExit(mNetif.GetMle().IsRouterIdValid(mNetif.GetMle().GetRouterId(rloc16)),
|
||||
error = kThreadError_Drop);
|
||||
mMeshDest = rloc16;
|
||||
}
|
||||
else if (mNetif.GetMle().IsAnycastLocator(ip6Header.GetDestination()))
|
||||
{
|
||||
// only support Leader ALOC for now
|
||||
aloc16 = HostSwap16(ip6Header.GetDestination().mFields.m16[7]);
|
||||
|
||||
if (aloc16 == Mle::kAloc16Leader)
|
||||
{
|
||||
mMeshDest = mNetif.GetMle().GetRloc16(mNetif.GetMle().GetLeaderId());
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
else if ((aloc16 & Mle::kAloc16DhcpAgentMask) != 0)
|
||||
{
|
||||
uint16_t agentRloc16;
|
||||
uint8_t routerId;
|
||||
VerifyOrExit((mNetif.GetNetworkDataLeader().GetRlocByContextId(
|
||||
static_cast<uint8_t>(aloc16 & Mle::kAloc16DhcpAgentMask),
|
||||
agentRloc16) == kThreadError_None),
|
||||
error = kThreadError_Drop);
|
||||
|
||||
routerId = mNetif.GetMle().GetRouterId(agentRloc16);
|
||||
|
||||
// if agent is active router or the child of the device
|
||||
if ((mNetif.GetMle().IsActiveRouter(agentRloc16)) ||
|
||||
(mNetif.GetMle().GetRloc16(routerId) == mNetif.GetMle().GetRloc16()))
|
||||
{
|
||||
mMeshDest = agentRloc16;
|
||||
}
|
||||
else
|
||||
{
|
||||
// use the parent of the ED Agent as Dest
|
||||
mMeshDest = mNetif.GetMle().GetRloc16(routerId);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
else
|
||||
{
|
||||
// TODO: support ALOC for DHCPv6 Agent, Service, Commissioner, Neighbor Discovery Agent
|
||||
ExitNow(error = kThreadError_Drop);
|
||||
}
|
||||
}
|
||||
else if ((neighbor = mNetif.GetMle().GetNeighbor(ip6Header.GetDestination())) != NULL)
|
||||
{
|
||||
mMeshDest = neighbor->GetRloc16();
|
||||
}
|
||||
else if (mNetif.GetNetworkDataLeader().IsOnMesh(ip6Header.GetDestination()))
|
||||
{
|
||||
SuccessOrExit(error = mNetif.GetAddressResolver().Resolve(ip6Header.GetDestination(), mMeshDest));
|
||||
}
|
||||
else
|
||||
{
|
||||
mNetif.GetNetworkDataLeader().RouteLookup(
|
||||
ip6Header.GetSource(),
|
||||
ip6Header.GetDestination(),
|
||||
NULL,
|
||||
&mMeshDest
|
||||
);
|
||||
}
|
||||
|
||||
VerifyOrExit(mMeshDest != Mac::kShortAddrInvalid, error = kThreadError_Drop);
|
||||
|
||||
if (mNetif.GetMle().GetNeighbor(mMeshDest) != NULL)
|
||||
{
|
||||
// destination is neighbor
|
||||
mMacDest.mLength = sizeof(mMacDest.mShortAddress);
|
||||
mMacDest.mShortAddress = mMeshDest;
|
||||
GetMacDestinationAddress(ip6Header.GetDestination(), mMacDest);
|
||||
GetMacSourceAddress(ip6Header.GetSource(), mMacSource);
|
||||
}
|
||||
else
|
||||
{
|
||||
// destination is not neighbor
|
||||
mMeshSource = mNetif.GetMac().GetShortAddress();
|
||||
if (mNetif.GetMle().IsRoutingLocator(ip6Header.GetDestination()))
|
||||
{
|
||||
rloc16 = HostSwap16(ip6Header.GetDestination().mFields.m16[7]);
|
||||
VerifyOrExit(mNetif.GetMle().IsRouterIdValid(mNetif.GetMle().GetRouterId(rloc16)),
|
||||
error = kThreadError_Drop);
|
||||
mMeshDest = rloc16;
|
||||
}
|
||||
else if (mNetif.GetMle().IsAnycastLocator(ip6Header.GetDestination()))
|
||||
{
|
||||
aloc16 = HostSwap16(ip6Header.GetDestination().mFields.m16[7]);
|
||||
|
||||
SuccessOrExit(error = mNetif.GetMle().CheckReachability(mMeshSource, mMeshDest, ip6Header));
|
||||
if (aloc16 == Mle::kAloc16Leader)
|
||||
{
|
||||
mMeshDest = mNetif.GetMle().GetRloc16(mNetif.GetMle().GetLeaderId());
|
||||
}
|
||||
|
||||
mMacDest.mLength = sizeof(mMacDest.mShortAddress);
|
||||
mMacDest.mShortAddress = mNetif.GetMle().GetNextHop(mMeshDest);
|
||||
mMacSource.mLength = sizeof(mMacSource.mShortAddress);
|
||||
mMacSource.mShortAddress = mMeshSource;
|
||||
mAddMeshHeader = true;
|
||||
#if OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
else if ((aloc16 & Mle::kAloc16DhcpAgentMask) != 0)
|
||||
{
|
||||
uint16_t agentRloc16;
|
||||
uint8_t routerId;
|
||||
VerifyOrExit((mNetif.GetNetworkDataLeader().GetRlocByContextId(
|
||||
static_cast<uint8_t>(aloc16 & Mle::kAloc16DhcpAgentMask),
|
||||
agentRloc16) == kThreadError_None),
|
||||
error = kThreadError_Drop);
|
||||
|
||||
routerId = mNetif.GetMle().GetRouterId(agentRloc16);
|
||||
|
||||
// if agent is active router or the child of the device
|
||||
if ((mNetif.GetMle().IsActiveRouter(agentRloc16)) ||
|
||||
(mNetif.GetMle().GetRloc16(routerId) == mNetif.GetMle().GetRloc16()))
|
||||
{
|
||||
mMeshDest = agentRloc16;
|
||||
}
|
||||
else
|
||||
{
|
||||
// use the parent of the ED Agent as Dest
|
||||
mMeshDest = mNetif.GetMle().GetRloc16(routerId);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_SERVER || OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
else
|
||||
{
|
||||
// TODO: support ALOC for Service, Commissioner, Neighbor Discovery Agent
|
||||
ExitNow(error = kThreadError_Drop);
|
||||
}
|
||||
}
|
||||
else if ((neighbor = mNetif.GetMle().GetNeighbor(ip6Header.GetDestination())) != NULL)
|
||||
{
|
||||
mMeshDest = neighbor->GetRloc16();
|
||||
}
|
||||
else if (mNetif.GetNetworkDataLeader().IsOnMesh(ip6Header.GetDestination()))
|
||||
{
|
||||
SuccessOrExit(error = mNetif.GetAddressResolver().Resolve(ip6Header.GetDestination(), mMeshDest));
|
||||
}
|
||||
else
|
||||
{
|
||||
mNetif.GetNetworkDataLeader().RouteLookup(
|
||||
ip6Header.GetSource(),
|
||||
ip6Header.GetDestination(),
|
||||
NULL,
|
||||
&mMeshDest
|
||||
);
|
||||
}
|
||||
|
||||
VerifyOrExit(mMeshDest != Mac::kShortAddrInvalid, error = kThreadError_Drop);
|
||||
|
||||
if (mNetif.GetMle().GetNeighbor(mMeshDest) != NULL)
|
||||
{
|
||||
// destination is neighbor
|
||||
mMacDest.mLength = sizeof(mMacDest.mShortAddress);
|
||||
mMacDest.mShortAddress = mMeshDest;
|
||||
GetMacSourceAddress(ip6Header.GetSource(), mMacSource);
|
||||
}
|
||||
else
|
||||
{
|
||||
// destination is not neighbor
|
||||
mMeshSource = mNetif.GetMac().GetShortAddress();
|
||||
|
||||
SuccessOrExit(error = mNetif.GetMle().CheckReachability(mMeshSource, mMeshDest, ip6Header));
|
||||
|
||||
mMacDest.mLength = sizeof(mMacDest.mShortAddress);
|
||||
mMacDest.mShortAddress = mNetif.GetMle().GetNextHop(mMeshDest);
|
||||
mMacSource.mLength = sizeof(mMacSource.mShortAddress);
|
||||
mMacSource.mShortAddress = mMeshSource;
|
||||
mAddMeshHeader = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +77,6 @@ Mle::Mle(ThreadNetif &aThreadNetif) :
|
||||
mReattachState(kReattachStop),
|
||||
mParentRequestTimer(aThreadNetif.GetIp6().mTimerScheduler, &Mle::HandleParentRequestTimer, this),
|
||||
mDelayedResponseTimer(aThreadNetif.GetIp6().mTimerScheduler, &Mle::HandleDelayedResponseTimer, this),
|
||||
mRouterSelectionJitter(kRouterSelectionJitter),
|
||||
mRouterSelectionJitterTimeout(0),
|
||||
mLastPartitionRouterIdSequence(0),
|
||||
mLastPartitionId(0),
|
||||
mParentRequestMode(kMleAttachAnyPartition),
|
||||
@@ -552,7 +550,6 @@ ThreadError Mle::SetStateDetached(void)
|
||||
mNetif.RemoveUnicastAddress(mLeaderAloc);
|
||||
}
|
||||
|
||||
mNetif.GetAddressResolver().Clear();
|
||||
mDeviceState = kDeviceStateDetached;
|
||||
mParentRequestState = kParentIdle;
|
||||
mParentRequestTimer.Stop();
|
||||
@@ -899,18 +896,6 @@ void Mle::SetAssignLinkQuality(const Mac::ExtAddress aMacAddr, uint8_t aLinkQual
|
||||
}
|
||||
}
|
||||
|
||||
ThreadError Mle::SetRouterSelectionJitter(uint8_t aRouterJitter)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aRouterJitter > 0, error = kThreadError_InvalidArgs);
|
||||
|
||||
mRouterSelectionJitter = aRouterJitter;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void Mle::GenerateNonce(const Mac::ExtAddress &aMacAddr, uint32_t aFrameCounter, uint8_t aSecurityLevel,
|
||||
uint8_t *aNonce)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
namespace ot {
|
||||
|
||||
class ThreadNetif;
|
||||
class AddressResolver;
|
||||
class KeyManager;
|
||||
class MeshForwarder;
|
||||
|
||||
@@ -846,22 +845,6 @@ public:
|
||||
*/
|
||||
void SetAssignLinkQuality(const Mac::ExtAddress aMacAddr, uint8_t aLinkQuality);
|
||||
|
||||
/**
|
||||
* This method returns the ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
* @returns The ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
*/
|
||||
uint8_t GetRouterSelectionJitter(void) const { return mRouterSelectionJitter; }
|
||||
|
||||
/**
|
||||
* This method sets the ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
* @returns The ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
*/
|
||||
ThreadError SetRouterSelectionJitter(uint8_t aRouterJitter);
|
||||
|
||||
/**
|
||||
* This method returns the Child ID portion of an RLOC16.
|
||||
*
|
||||
@@ -1374,10 +1357,6 @@ protected:
|
||||
|
||||
Timer mParentRequestTimer; ///< The timer for driving the Parent Request process.
|
||||
Timer mDelayedResponseTimer; ///< The timer to delay MLE responses.
|
||||
|
||||
uint8_t mRouterSelectionJitter; ///< The variable to save the assigned jitter value.
|
||||
uint8_t mRouterSelectionJitterTimeout; ///< The Timeout prior to request/release Router ID.
|
||||
|
||||
uint8_t mLastPartitionRouterIdSequence;
|
||||
uint32_t mLastPartitionId;
|
||||
|
||||
|
||||
@@ -65,7 +65,9 @@ MleRouter::MleRouter(ThreadNetif &aThreadNetif):
|
||||
mAdvertiseTimer(aThreadNetif.GetIp6().mTimerScheduler, &MleRouter::HandleAdvertiseTimer, NULL, this),
|
||||
mStateUpdateTimer(aThreadNetif.GetIp6().mTimerScheduler, &MleRouter::HandleStateUpdateTimer, this),
|
||||
mAddressSolicit(OPENTHREAD_URI_ADDRESS_SOLICIT, &MleRouter::HandleAddressSolicit, this),
|
||||
mAddressRelease(OPENTHREAD_URI_ADDRESS_RELEASE, &MleRouter::HandleAddressRelease, this)
|
||||
mAddressRelease(OPENTHREAD_URI_ADDRESS_RELEASE, &MleRouter::HandleAddressRelease, this),
|
||||
mRouterSelectionJitter(kRouterSelectionJitter),
|
||||
mRouterSelectionJitterTimeout(0)
|
||||
{
|
||||
mDeviceMode |= ModeTlv::kModeFFD | ModeTlv::kModeFullNetworkData;
|
||||
|
||||
@@ -334,6 +336,8 @@ ThreadError MleRouter::HandleDetachStart(void)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
mNetif.GetAddressResolver().Clear();
|
||||
|
||||
for (int i = 0; i <= kMaxRouterId; i++)
|
||||
{
|
||||
mRouters[i].SetState(Neighbor::kStateInvalid);
|
||||
@@ -1131,6 +1135,18 @@ exit:
|
||||
return rval;
|
||||
}
|
||||
|
||||
ThreadError MleRouter::SetRouterSelectionJitter(uint8_t aRouterJitter)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aRouterJitter > 0, error = kThreadError_InvalidArgs);
|
||||
|
||||
mRouterSelectionJitter = aRouterJitter;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
ThreadError MleRouter::ProcessRouteTlv(const RouteTlv &aRoute)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
namespace ot {
|
||||
namespace Mle {
|
||||
|
||||
class AddressResolver;
|
||||
class MeshForwarder;
|
||||
class NetworkDataLeader;
|
||||
|
||||
@@ -274,6 +275,22 @@ public:
|
||||
*/
|
||||
uint8_t GetLinkCost(uint8_t aRouterId);
|
||||
|
||||
/**
|
||||
* This method returns the ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
* @returns The ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
*/
|
||||
uint8_t GetRouterSelectionJitter(void) const { return mRouterSelectionJitter; }
|
||||
|
||||
/**
|
||||
* This method sets the ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
* @returns The ROUTER_SELECTION_JITTER value.
|
||||
*
|
||||
*/
|
||||
ThreadError SetRouterSelectionJitter(uint8_t aRouterJitter);
|
||||
|
||||
/**
|
||||
* This method returns the current Router ID Sequence value.
|
||||
*
|
||||
@@ -745,6 +762,9 @@ private:
|
||||
uint8_t mRouterId;
|
||||
uint8_t mPreviousRouterId;
|
||||
uint32_t mPreviousPartitionId;
|
||||
|
||||
uint8_t mRouterSelectionJitter; ///< The variable to save the assigned jitter value.
|
||||
uint8_t mRouterSelectionJitterTimeout; ///< The Timeout prior to request/release Router ID.
|
||||
};
|
||||
|
||||
} // namespace Mle
|
||||
|
||||
@@ -50,9 +50,6 @@ class MleRouter: public Mle
|
||||
public:
|
||||
explicit MleRouter(ThreadNetif &aThreadNetif) : Mle(aThreadNetif) { }
|
||||
|
||||
bool IsRouterRoleEnabled(void) const { return false; }
|
||||
void SetRouterRoleEnabled(bool) { }
|
||||
|
||||
bool IsSingleton(void) { return false; }
|
||||
|
||||
ThreadError BecomeRouter(ThreadStatusTlv::Status) { return kThreadError_NotCapable; }
|
||||
@@ -62,13 +59,6 @@ public:
|
||||
|
||||
uint32_t GetLeaderAge(void) const { return 0; }
|
||||
|
||||
uint8_t GetLeaderWeight(void) const { return 0; }
|
||||
void SetLeaderWeight(uint8_t) { }
|
||||
|
||||
uint32_t GetLeaderPartitionId(void) const { return 0; }
|
||||
void SetLeaderPartitionId(uint32_t) { }
|
||||
|
||||
ThreadError SetPreferredRouterId(uint8_t) { return kThreadError_NotImplemented; }
|
||||
uint32_t GetPreviousPartitionId(void) const { return 0; }
|
||||
void SetPreviousPartitionId(uint32_t) { }
|
||||
void SetRouterId(uint8_t) { }
|
||||
@@ -76,21 +66,12 @@ public:
|
||||
uint16_t GetNextHop(uint16_t aDestination) const { return Mle::GetNextHop(aDestination); }
|
||||
|
||||
uint8_t GetNetworkIdTimeout(void) const { return 0; }
|
||||
void SetNetworkIdTimeout(uint8_t) { }
|
||||
|
||||
uint8_t GetRouteCost(uint16_t) const { return 0; }
|
||||
uint8_t GetLinkCost(uint16_t) { return 0; }
|
||||
|
||||
uint8_t GetRouterIdSequence(void) const { return 0; }
|
||||
|
||||
uint8_t GetRouterUpgradeThreshold(void) const { return 0; }
|
||||
void SetRouterUpgradeThreshold(uint8_t) { }
|
||||
|
||||
uint8_t GetRouterDowngradeThreshold(void) const { return 0; }
|
||||
void SetRouterDowngradeThreshold(uint8_t) { }
|
||||
|
||||
ThreadError ReleaseRouterId(uint8_t) { return kThreadError_NotImplemented; }
|
||||
|
||||
ThreadError RemoveNeighbor(const Mac::Address &) { return BecomeDetached(); }
|
||||
ThreadError RemoveNeighbor(Neighbor &) { return BecomeDetached(); }
|
||||
|
||||
@@ -108,8 +89,6 @@ public:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ThreadError SetMaxAllowedChildren(uint8_t) { return kThreadError_NotImplemented; }
|
||||
|
||||
ThreadError RestoreChildren(void) {return kThreadError_NotImplemented; }
|
||||
ThreadError RemoveStoredChild(uint16_t) {return kThreadError_NotImplemented; }
|
||||
ThreadError StoreChild(uint16_t) {return kThreadError_NotImplemented; }
|
||||
@@ -120,9 +99,6 @@ public:
|
||||
Neighbor *GetNeighbor(const Mac::Address &aAddress) { return Mle::GetNeighbor(aAddress); }
|
||||
Neighbor *GetNeighbor(const Ip6::Address &aAddress) { return Mle::GetNeighbor(aAddress); }
|
||||
|
||||
ThreadError GetChildInfoById(uint16_t, otChildInfo &) { return kThreadError_NotImplemented; }
|
||||
ThreadError GetChildInfoByIndex(uint8_t, otChildInfo &) { return kThreadError_NotImplemented; }
|
||||
|
||||
ThreadError GetNextNeighborInfo(otNeighborInfoIterator &, otNeighborInfo &) { return kThreadError_NotImplemented; }
|
||||
|
||||
Router *GetRouters(uint8_t *aNumRouters) {
|
||||
@@ -133,8 +109,6 @@ public:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ThreadError GetRouterInfo(uint16_t, otRouterInfo &) { return kThreadError_NotImplemented; }
|
||||
|
||||
static int ComparePartitions(bool, const LeaderDataTlv &, bool, const LeaderDataTlv &) { return 0; }
|
||||
|
||||
void ResolveRoutingLoops(uint16_t, uint16_t) { }
|
||||
|
||||
@@ -53,11 +53,6 @@ public:
|
||||
void IncrementVersion(void) { }
|
||||
void IncrementStableVersion(void) { }
|
||||
|
||||
uint32_t GetContextIdReuseDelay(void) const { return 0; }
|
||||
ThreadError SetContextIdReuseDelay(uint32_t) { return kThreadError_NotImplemented; }
|
||||
|
||||
void RemoveBorderRouter(uint16_t) { }
|
||||
|
||||
ThreadError SendServerDataNotification(uint16_t) { return kThreadError_NotImplemented; }
|
||||
};
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
* This file implements the local Thread Network Data.
|
||||
*/
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_FILE
|
||||
#include OPENTHREAD_CONFIG_FILE
|
||||
#else
|
||||
@@ -44,8 +46,6 @@
|
||||
#include <thread/network_data_local.hpp>
|
||||
#include <thread/thread_netif.hpp>
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
namespace ot {
|
||||
namespace NetworkData {
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ ThreadNetif::ThreadNetif(Ip6::Ip6 &aIp6):
|
||||
Netif(aIp6, OT_NETIF_INTERFACE_ID_THREAD),
|
||||
mCoapServer(*this, kCoapUdpPort),
|
||||
mCoapClient(*this),
|
||||
mAddressResolver(*this),
|
||||
#if OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
mDhcp6Client(*this),
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
@@ -104,6 +103,7 @@ ThreadNetif::ThreadNetif(Ip6::Ip6 &aIp6):
|
||||
#endif // OPENTHREAD_ENABLE_BORDER_AGENT_PROXY
|
||||
mJoinerRouter(*this),
|
||||
mLeader(*this),
|
||||
mAddressResolver(*this),
|
||||
#endif // OPENTHREAD_FTD
|
||||
mAnnounceBegin(*this),
|
||||
mPanIdQuery(*this),
|
||||
|
||||
@@ -161,14 +161,6 @@ public:
|
||||
*/
|
||||
virtual ThreadError RouteLookup(const Ip6::Address &aSource, const Ip6::Address &aDestination, uint8_t *aPrefixMatch);
|
||||
|
||||
/**
|
||||
* This method returns a reference to the address resolver object.
|
||||
*
|
||||
* @returns A reference to the address resolver object.
|
||||
*
|
||||
*/
|
||||
AddressResolver &GetAddressResolver(void) { return mAddressResolver; }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the network diagnostic object.
|
||||
*
|
||||
@@ -287,31 +279,99 @@ public:
|
||||
*/
|
||||
NetworkData::Leader &GetNetworkDataLeader(void) { return mNetworkDataLeader; }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the active dataset object.
|
||||
*
|
||||
* @returns A reference to the active dataset object.
|
||||
*
|
||||
*/
|
||||
MeshCoP::ActiveDataset &GetActiveDataset(void) { return mActiveDataset; }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the pending dataset object.
|
||||
*
|
||||
* @returns A reference to the pending dataset object.
|
||||
*
|
||||
*/
|
||||
MeshCoP::PendingDataset &GetPendingDataset(void) { return mPendingDataset; }
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
/**
|
||||
* This method returns a reference to the joiner router object.
|
||||
*
|
||||
* @returns A reference to the joiner router object.
|
||||
*
|
||||
*/
|
||||
MeshCoP::JoinerRouter &GetJoinerRouter(void) { return mJoinerRouter; }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the MeshCoP leader object.
|
||||
*
|
||||
* @returns A reference to the MeshCoP leader object.
|
||||
*
|
||||
*/
|
||||
MeshCoP::Leader &GetLeader(void) { return mLeader; }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the address resolver object.
|
||||
*
|
||||
* @returns A reference to the address resolver object.
|
||||
*
|
||||
*/
|
||||
AddressResolver &GetAddressResolver(void) { return mAddressResolver; }
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
/**
|
||||
* This method returns a reference to the announce begin server object.
|
||||
*
|
||||
* @returns A reference to the announce begin server object.
|
||||
*
|
||||
*/
|
||||
AnnounceBeginServer &GetAnnounceBeginServer(void) { return mAnnounceBegin; }
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
/**
|
||||
* This method returns a reference to the commissioner object.
|
||||
*
|
||||
* @returns A reference to the commissioenr object.
|
||||
*
|
||||
*/
|
||||
MeshCoP::Commissioner &GetCommissioner(void) { return mCommissioner; }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the secure CoAP server object.
|
||||
*
|
||||
* @returns A reference to the secure CoAP server object.
|
||||
*
|
||||
*/
|
||||
Coap::SecureServer &GetSecureCoapServer(void) { return mSecureCoapServer; }
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
|
||||
#if OPENTHREAD_ENABLE_DTLS
|
||||
/**
|
||||
* This method returns a reference to the Dtls object.
|
||||
*
|
||||
* @returns A reference to the Dtls object.
|
||||
*
|
||||
*/
|
||||
MeshCoP::Dtls &GetDtls(void) { return mDtls; }
|
||||
#endif // OPENTHREAD_ENABLE_DTLS
|
||||
|
||||
#if OPENTHREAD_ENABLE_JOINER
|
||||
/**
|
||||
* This method returns a reference to the joiner object.
|
||||
*
|
||||
* @returns A reference to the joiner object.
|
||||
*
|
||||
*/
|
||||
MeshCoP::Joiner &GetJoiner(void) { return mJoiner; }
|
||||
|
||||
/**
|
||||
* This method returns a reference to the secure CoAP client object.
|
||||
*
|
||||
* @returns A reference to the secure CoAP client object.
|
||||
*
|
||||
*/
|
||||
Coap::SecureClient &GetSecureCoapClient(void) { return mSecureCoapClient; }
|
||||
#endif // OPENTHREAD_ENABLE_JOINER
|
||||
|
||||
@@ -326,6 +386,12 @@ public:
|
||||
#endif // OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT_PROXY && OPENTHREAD_FTD
|
||||
/**
|
||||
* This method returns the border agent proxy object.
|
||||
*
|
||||
* @returns Reference to the border agent proxy object.
|
||||
*
|
||||
*/
|
||||
MeshCoP::BorderAgentProxy &GetBorderAgentProxy(void) { return mBorderAgentProxy; }
|
||||
#endif // OPENTHREAD_ENABLE_BORDER_AGENT_PROXY && OPENTHREAD_FTD
|
||||
|
||||
@@ -342,7 +408,6 @@ private:
|
||||
|
||||
Coap::Server mCoapServer;
|
||||
Coap::Client mCoapClient;
|
||||
AddressResolver mAddressResolver;
|
||||
#if OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
Dhcp6::Dhcp6Client mDhcp6Client;
|
||||
#endif // OPENTHREAD_ENABLE_DHCP6_CLIENT
|
||||
@@ -383,12 +448,14 @@ private:
|
||||
Utils::JamDetector mJamDetector;
|
||||
#endif // OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT_PROXY
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT_PROXY && OPENTHREAD_FTD
|
||||
MeshCoP::BorderAgentProxy mBorderAgentProxy;
|
||||
#endif // OPENTHREAD_ENABLE_BORDER_AGENT_PROXY
|
||||
#endif // OPENTHREAD_ENABLE_BORDER_AGENT_PROXY && OPENTHREAD_FTD
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
MeshCoP::JoinerRouter mJoinerRouter;
|
||||
MeshCoP::Leader mLeader;
|
||||
AddressResolver mAddressResolver;
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
AnnounceBeginServer mAnnounceBegin;
|
||||
|
||||
+52
-24
@@ -47,6 +47,10 @@
|
||||
#include "openthread/border_agent_proxy.h"
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
#include "openthread/thread_ftd.h"
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
#include "openthread/jam_detection.h"
|
||||
#endif
|
||||
@@ -141,17 +145,12 @@ const NcpBase::GetPropertyHandlerEntry NcpBase::mGetPropertyHandlerTable[] =
|
||||
{ SPINEL_PROP_NET_KEY_SEQUENCE_COUNTER, &NcpBase::GetPropertyHandler_NET_KEY_SEQUENCE_COUNTER },
|
||||
{ SPINEL_PROP_NET_PARTITION_ID, &NcpBase::GetPropertyHandler_NET_PARTITION_ID },
|
||||
{ SPINEL_PROP_NET_KEY_SWITCH_GUARDTIME, &NcpBase::GetPropertyHandler_NET_KEY_SWITCH_GUARDTIME},
|
||||
#if OPENTHREAD_FTD
|
||||
{ SPINEL_PROP_NET_PSKC, &NcpBase::GetPropertyHandler_NET_PSKC },
|
||||
#endif
|
||||
|
||||
{ SPINEL_PROP_THREAD_LEADER_ADDR, &NcpBase::GetPropertyHandler_THREAD_LEADER_ADDR },
|
||||
{ SPINEL_PROP_THREAD_PARENT, &NcpBase::GetPropertyHandler_THREAD_PARENT },
|
||||
{ SPINEL_PROP_THREAD_CHILD_TABLE, &NcpBase::GetPropertyHandler_THREAD_CHILD_TABLE },
|
||||
{ SPINEL_PROP_THREAD_NEIGHBOR_TABLE, &NcpBase::GetPropertyHandler_THREAD_NEIGHBOR_TABLE },
|
||||
{ SPINEL_PROP_THREAD_LEADER_RID, &NcpBase::GetPropertyHandler_THREAD_LEADER_RID },
|
||||
{ SPINEL_PROP_THREAD_LEADER_WEIGHT, &NcpBase::GetPropertyHandler_THREAD_LEADER_WEIGHT },
|
||||
{ SPINEL_PROP_THREAD_LOCAL_LEADER_WEIGHT, &NcpBase::GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT },
|
||||
{ SPINEL_PROP_THREAD_NETWORK_DATA, &NcpBase::GetPropertyHandler_THREAD_NETWORK_DATA },
|
||||
{ SPINEL_PROP_THREAD_NETWORK_DATA_VERSION, &NcpBase::GetPropertyHandler_THREAD_NETWORK_DATA_VERSION },
|
||||
{ SPINEL_PROP_THREAD_STABLE_NETWORK_DATA, &NcpBase::GetPropertyHandler_THREAD_STABLE_NETWORK_DATA },
|
||||
@@ -161,7 +160,6 @@ const NcpBase::GetPropertyHandlerEntry NcpBase::mGetPropertyHandlerTable[] =
|
||||
{ SPINEL_PROP_THREAD_LOCAL_ROUTES, &NcpBase::GetPropertyHandler_THREAD_LOCAL_ROUTES },
|
||||
{ SPINEL_PROP_THREAD_ASSISTING_PORTS, &NcpBase::GetPropertyHandler_THREAD_ASSISTING_PORTS },
|
||||
{ SPINEL_PROP_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE, &NcpBase::GetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_ROLE_ENABLED, &NcpBase::GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED },
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
{ SPINEL_PROP_THREAD_COMMISSIONER_ENABLED, &NcpBase::GetPropertyHandler_THREAD_COMMISSIONER_ENABLED },
|
||||
@@ -170,16 +168,10 @@ const NcpBase::GetPropertyHandlerEntry NcpBase::mGetPropertyHandlerTable[] =
|
||||
{ SPINEL_PROP_MAC_WHITELIST, &NcpBase::GetPropertyHandler_MAC_WHITELIST },
|
||||
{ SPINEL_PROP_MAC_WHITELIST_ENABLED, &NcpBase::GetPropertyHandler_MAC_WHITELIST_ENABLED },
|
||||
{ SPINEL_PROP_THREAD_MODE, &NcpBase::GetPropertyHandler_THREAD_MODE },
|
||||
{ SPINEL_PROP_THREAD_CHILD_COUNT_MAX, &NcpBase::GetPropertyHandler_THREAD_CHILD_COUNT_MAX },
|
||||
{ SPINEL_PROP_THREAD_CHILD_TIMEOUT, &NcpBase::GetPropertyHandler_THREAD_CHILD_TIMEOUT },
|
||||
{ SPINEL_PROP_THREAD_RLOC16, &NcpBase::GetPropertyHandler_THREAD_RLOC16 },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_UPGRADE_THRESHOLD, &NcpBase::GetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_DOWNGRADE_THRESHOLD, &NcpBase::GetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD },
|
||||
{ SPINEL_PROP_THREAD_CONTEXT_REUSE_DELAY, &NcpBase::GetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY },
|
||||
{ SPINEL_PROP_THREAD_NETWORK_ID_TIMEOUT, &NcpBase::GetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT },
|
||||
{ SPINEL_PROP_THREAD_ON_MESH_NETS, &NcpBase::GetPropertyHandler_THREAD_ON_MESH_NETS },
|
||||
{ SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING, &NcpBase::GetPropertyHandler_NET_REQUIRE_JOIN_EXISTING },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_SELECTION_JITTER, &NcpBase::GetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER },
|
||||
|
||||
{ SPINEL_PROP_IPV6_ML_PREFIX, &NcpBase::GetPropertyHandler_IPV6_ML_PREFIX },
|
||||
{ SPINEL_PROP_IPV6_ML_ADDR, &NcpBase::GetPropertyHandler_IPV6_ML_ADDR },
|
||||
@@ -191,6 +183,19 @@ const NcpBase::GetPropertyHandlerEntry NcpBase::mGetPropertyHandlerTable[] =
|
||||
|
||||
{ SPINEL_PROP_STREAM_NET, &NcpBase::GetPropertyHandler_STREAM_NET },
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
{ SPINEL_PROP_THREAD_CHILD_TABLE, &NcpBase::GetPropertyHandler_THREAD_CHILD_TABLE },
|
||||
{ SPINEL_PROP_THREAD_LOCAL_LEADER_WEIGHT, &NcpBase::GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_ROLE_ENABLED, &NcpBase::GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED },
|
||||
{ SPINEL_PROP_NET_PSKC, &NcpBase::GetPropertyHandler_NET_PSKC },
|
||||
{ SPINEL_PROP_THREAD_CHILD_COUNT_MAX, &NcpBase::GetPropertyHandler_THREAD_CHILD_COUNT_MAX },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_UPGRADE_THRESHOLD, &NcpBase::GetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_DOWNGRADE_THRESHOLD, &NcpBase::GetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD },
|
||||
{ SPINEL_PROP_THREAD_CONTEXT_REUSE_DELAY, &NcpBase::GetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY },
|
||||
{ SPINEL_PROP_THREAD_NETWORK_ID_TIMEOUT, &NcpBase::GetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_SELECTION_JITTER, &NcpBase::GetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER },
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
{ SPINEL_PROP_JAM_DETECT_ENABLE, &NcpBase::GetPropertyHandler_JAM_DETECT_ENABLE },
|
||||
{ SPINEL_PROP_JAM_DETECTED, &NcpBase::GetPropertyHandler_JAM_DETECTED },
|
||||
@@ -283,15 +288,8 @@ const NcpBase::SetPropertyHandlerEntry NcpBase::mSetPropertyHandlerTable[] =
|
||||
{ SPINEL_PROP_NET_MASTER_KEY, &NcpBase::SetPropertyHandler_NET_MASTER_KEY },
|
||||
{ SPINEL_PROP_NET_KEY_SEQUENCE_COUNTER, &NcpBase::SetPropertyHandler_NET_KEY_SEQUENCE_COUNTER },
|
||||
{ SPINEL_PROP_NET_KEY_SWITCH_GUARDTIME, &NcpBase::SetPropertyHandler_NET_KEY_SWITCH_GUARDTIME},
|
||||
#if OPENTHREAD_FTD
|
||||
{ SPINEL_PROP_NET_PSKC, &NcpBase::SetPropertyHandler_NET_PSKC },
|
||||
#endif
|
||||
|
||||
{ SPINEL_PROP_THREAD_LOCAL_LEADER_WEIGHT, &NcpBase::SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT },
|
||||
{ SPINEL_PROP_THREAD_ASSISTING_PORTS, &NcpBase::SetPropertyHandler_THREAD_ASSISTING_PORTS },
|
||||
{ SPINEL_PROP_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE, &NcpBase::SetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE },
|
||||
{ SPINEL_PROP_THREAD_NETWORK_ID_TIMEOUT, &NcpBase::SetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_ROLE_ENABLED, &NcpBase::SetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED },
|
||||
|
||||
{ SPINEL_PROP_STREAM_NET_INSECURE, &NcpBase::SetPropertyHandler_STREAM_NET_INSECURE },
|
||||
{ SPINEL_PROP_STREAM_NET, &NcpBase::SetPropertyHandler_STREAM_NET },
|
||||
@@ -308,15 +306,23 @@ const NcpBase::SetPropertyHandlerEntry NcpBase::mSetPropertyHandlerTable[] =
|
||||
{ SPINEL_PROP_MAC_SRC_MATCH_EXTENDED_ADDRESSES, &NcpBase::SetPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES },
|
||||
#endif
|
||||
{ SPINEL_PROP_THREAD_MODE, &NcpBase::SetPropertyHandler_THREAD_MODE },
|
||||
{ SPINEL_PROP_THREAD_CHILD_COUNT_MAX, &NcpBase::SetPropertyHandler_THREAD_CHILD_COUNT_MAX },
|
||||
{ SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING, &NcpBase::SetPropertyHandler_NET_REQUIRE_JOIN_EXISTING },
|
||||
{ SPINEL_PROP_DEBUG_NCP_LOG_LEVEL, &NcpBase::SetPropertyHandler_DEBUG_NCP_LOG_LEVEL },
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
{ SPINEL_PROP_NET_PSKC, &NcpBase::SetPropertyHandler_NET_PSKC },
|
||||
{ SPINEL_PROP_THREAD_CHILD_TIMEOUT, &NcpBase::SetPropertyHandler_THREAD_CHILD_TIMEOUT },
|
||||
{ SPINEL_PROP_THREAD_NETWORK_ID_TIMEOUT, &NcpBase::SetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT },
|
||||
{ SPINEL_PROP_THREAD_LOCAL_LEADER_WEIGHT, &NcpBase::SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT },
|
||||
{ SPINEL_PROP_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE, &NcpBase::SetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_ROLE_ENABLED, &NcpBase::SetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED },
|
||||
{ SPINEL_PROP_THREAD_CHILD_COUNT_MAX, &NcpBase::SetPropertyHandler_THREAD_CHILD_COUNT_MAX },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_UPGRADE_THRESHOLD, &NcpBase::SetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_DOWNGRADE_THRESHOLD, &NcpBase::SetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD },
|
||||
{ SPINEL_PROP_THREAD_CONTEXT_REUSE_DELAY, &NcpBase::SetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY },
|
||||
{ SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING, &NcpBase::SetPropertyHandler_NET_REQUIRE_JOIN_EXISTING },
|
||||
{ SPINEL_PROP_THREAD_ROUTER_SELECTION_JITTER, &NcpBase::SetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER },
|
||||
{ SPINEL_PROP_THREAD_PREFERRED_ROUTER_ID, &NcpBase::SetPropertyHandler_THREAD_PREFERRED_ROUTER_ID },
|
||||
{ SPINEL_PROP_DEBUG_NCP_LOG_LEVEL, &NcpBase::SetPropertyHandler_DEBUG_NCP_LOG_LEVEL },
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_JAM_DETECTION
|
||||
{ SPINEL_PROP_JAM_DETECT_ENABLE, &NcpBase::SetPropertyHandler_JAM_DETECT_ENABLE },
|
||||
@@ -374,7 +380,9 @@ const NcpBase::RemovePropertyHandlerEntry NcpBase::mRemovePropertyHandlerTable[]
|
||||
{ SPINEL_PROP_THREAD_ON_MESH_NETS, &NcpBase::RemovePropertyHandler_THREAD_ON_MESH_NETS },
|
||||
{ SPINEL_PROP_THREAD_ASSISTING_PORTS, &NcpBase::RemovePropertyHandler_THREAD_ASSISTING_PORTS },
|
||||
{ SPINEL_PROP_MAC_WHITELIST, &NcpBase::RemovePropertyHandler_MAC_WHITELIST },
|
||||
#if OPENTHREAD_FTD
|
||||
{ SPINEL_PROP_THREAD_ACTIVE_ROUTER_IDS, &NcpBase::RemovePropertyHandler_THREAD_ACTIVE_ROUTER_IDS },
|
||||
#endif
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -2418,6 +2426,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_LEADER_RID(uint8_t header, spinel
|
||||
);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
return SendPropertyUpdate(
|
||||
@@ -2428,6 +2437,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t heade
|
||||
otThreadGetLocalLeaderWeight(mInstance)
|
||||
);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
@@ -2491,6 +2501,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_PARENT(uint8_t header, spinel_pro
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_CHILD_TABLE(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
ThreadError errorCode = kThreadError_None;
|
||||
@@ -2567,6 +2578,7 @@ exit:
|
||||
mDisableStreamWrite = false;
|
||||
return errorCode;
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_NEIGHBOR_TABLE(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
@@ -2669,6 +2681,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8
|
||||
);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
return SendPropertyUpdate(
|
||||
@@ -2679,6 +2692,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t heade
|
||||
otThreadIsRouterRoleEnabled(mInstance)
|
||||
);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
@@ -3390,6 +3404,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_MODE(uint8_t header, spinel_prop_
|
||||
);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
return SendPropertyUpdate(
|
||||
@@ -3400,6 +3415,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, s
|
||||
otThreadGetMaxAllowedChildren(mInstance)
|
||||
);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
@@ -3423,6 +3439,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_RLOC16(uint8_t header, spinel_pro
|
||||
);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
return SendPropertyUpdate(
|
||||
@@ -3477,6 +3494,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t header
|
||||
otThreadGetNetworkIdTimeout(mInstance)
|
||||
);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD
|
||||
ThreadError NcpBase::GetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t header, spinel_prop_key_t key)
|
||||
@@ -4292,6 +4310,7 @@ ThreadError NcpBase::SetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key
|
||||
errorCode = otThreadBecomeDetached(mInstance);
|
||||
break;
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
case SPINEL_NET_ROLE_ROUTER:
|
||||
errorCode = otThreadBecomeRouter(mInstance);
|
||||
break;
|
||||
@@ -4299,6 +4318,7 @@ ThreadError NcpBase::SetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key
|
||||
case SPINEL_NET_ROLE_LEADER:
|
||||
errorCode = otThreadBecomeLeader(mInstance);
|
||||
break;
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
case SPINEL_NET_ROLE_CHILD:
|
||||
errorCode = otThreadBecomeChild(mInstance, kMleAttachAnyPartition);
|
||||
@@ -4480,6 +4500,7 @@ ThreadError NcpBase::SetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t header,
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError NcpBase::SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len)
|
||||
{
|
||||
@@ -4514,8 +4535,7 @@ ThreadError NcpBase::SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t heade
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
ThreadError NcpBase::SetPropertyHandler_STREAM_NET_INSECURE(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len)
|
||||
@@ -4891,6 +4911,7 @@ ThreadError NcpBase::SetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, s
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError NcpBase::SetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len)
|
||||
{
|
||||
@@ -4962,6 +4983,7 @@ ThreadError NcpBase::SetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t heade
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
ThreadError NcpBase::SetPropertyHandler_CNTR_RESET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
|
||||
uint16_t value_len)
|
||||
@@ -5376,6 +5398,7 @@ ThreadError NcpBase::SetPropertyHandler_THREAD_MODE(uint8_t header, spinel_prop_
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError NcpBase::SetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len)
|
||||
{
|
||||
@@ -5556,6 +5579,7 @@ ThreadError NcpBase::SetPropertyHandler_THREAD_PREFERRED_ROUTER_ID(uint8_t heade
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
ThreadError NcpBase::SetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len)
|
||||
@@ -5633,6 +5657,7 @@ ThreadError NcpBase::SetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spin
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError NcpBase::SetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len)
|
||||
{
|
||||
@@ -5688,6 +5713,7 @@ ThreadError NcpBase::SetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t header
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
#if OPENTHREAD_ENABLE_BORDER_AGENT_PROXY && OPENTHREAD_FTD
|
||||
ThreadError NcpBase::SetPropertyHandler_BA_PROXY_ENABLED(uint8_t header, spinel_prop_key_t key,
|
||||
@@ -6709,6 +6735,7 @@ ThreadError NcpBase::RemovePropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError NcpBase::RemovePropertyHandler_THREAD_ACTIVE_ROUTER_IDS(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len)
|
||||
{
|
||||
@@ -6749,6 +6776,7 @@ ThreadError NcpBase::RemovePropertyHandler_THREAD_ACTIVE_ROUTER_IDS(uint8_t head
|
||||
|
||||
return errorCode;
|
||||
}
|
||||
#endif // OPENTHREAD_FTD
|
||||
|
||||
ThreadError NcpBase::RemovePropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len)
|
||||
|
||||
+23
-16
@@ -372,11 +372,9 @@ private:
|
||||
ThreadError GetPropertyHandler_MAC_SCAN_PERIOD(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_LEADER_ADDR(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_PARENT(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_CHILD_TABLE(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_NEIGHBOR_TABLE(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_LEADER_RID(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_NETWORK_DATA(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_NETWORK_DATA_VERSION(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_STABLE_NETWORK_DATA(uint8_t header, spinel_prop_key_t key);
|
||||
@@ -386,28 +384,31 @@ private:
|
||||
ThreadError GetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_MAC_CNTR(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_NCP_CNTR(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_MSG_BUFFER_COUNTERS(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_MODE(uint8_t header, spinel_prop_key_t key);
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError GetPropertyHandler_NET_PSKC(uint8_t header, spinel_prop_key_t key);
|
||||
#endif
|
||||
ThreadError GetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_RLOC16(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_DEBUG_TEST_ASSERT(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_prop_key_t key);
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError GetPropertyHandler_THREAD_CHILD_TABLE(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_NET_PSKC(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_DEBUG_TEST_ASSERT(uint8_t header, spinel_prop_key_t key);
|
||||
ThreadError GetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_prop_key_t key);
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_COMMISSIONER
|
||||
ThreadError GetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t header, spinel_prop_key_t key);
|
||||
@@ -490,8 +491,6 @@ private:
|
||||
uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_MAC_SCAN_PERIOD(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
|
||||
uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
|
||||
uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t header, spinel_prop_key_t key,
|
||||
@@ -510,6 +509,10 @@ private:
|
||||
#endif
|
||||
ThreadError SetPropertyHandler_THREAD_MODE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
|
||||
uint16_t value_len);
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
|
||||
@@ -526,13 +529,14 @@ private:
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_THREAD_PREFERRED_ROUTER_ID(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
|
||||
ThreadError SetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
#endif
|
||||
|
||||
ThreadError SetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
ThreadError SetPropertyHandler_CNTR_RESET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
|
||||
@@ -604,8 +608,11 @@ private:
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
ThreadError RemovePropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
|
||||
uint16_t value_len);
|
||||
#if OPENTHREAD_FTD
|
||||
ThreadError RemovePropertyHandler_THREAD_ACTIVE_ROUTER_IDS(uint8_t header, spinel_prop_key_t key,
|
||||
const uint8_t *value_ptr, uint16_t value_len);
|
||||
#endif
|
||||
|
||||
public:
|
||||
ThreadError StreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user