mirror of
https://github.com/espressif/openthread.git
synced 2025-08-06 14:52:18 +08:00
[ncp] remove legacy network support (#8723)
This commit removes legacy network support as it's not used anymore.
This commit is contained in:
@ -112,7 +112,6 @@ ot_option(OT_HISTORY_TRACKER OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE "history t
|
||||
ot_option(OT_IP6_FRAGM OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE "ipv6 fragmentation")
|
||||
ot_option(OT_JAM_DETECTION OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE "jam detection")
|
||||
ot_option(OT_JOINER OPENTHREAD_CONFIG_JOINER_ENABLE "joiner")
|
||||
ot_option(OT_LEGACY OPENTHREAD_CONFIG_LEGACY_ENABLE "legacy network")
|
||||
ot_option(OT_LINK_METRICS_INITIATOR OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE "link metrics initiator")
|
||||
ot_option(OT_LINK_METRICS_SUBJECT OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE "link metrics subject")
|
||||
ot_option(OT_LINK_RAW OPENTHREAD_CONFIG_LINK_RAW_ENABLE "link raw service")
|
||||
|
@ -58,7 +58,6 @@ HISTORY_TRACKER ?= 1
|
||||
IP6_FRAGM ?= 1
|
||||
JAM_DETECTION ?= 1
|
||||
JOINER ?= 1
|
||||
LEGACY ?= 1
|
||||
LINK_RAW ?= 1
|
||||
MAC_FILTER ?= 1
|
||||
MTD_NETDIAG ?= 1
|
||||
|
@ -46,7 +46,6 @@ This page lists the available common switches with description. Unless stated ot
|
||||
| IP6_FRAGM | OT_IP6_FRAGM | Enables support for IPv6 fragmentation. |
|
||||
| JAM_DETECTION | OT_JAM_DETECTION | Enables support for [Jam Detection](https://openthread.io/guides/build/features/jam-detection). Enable this switch if a device requires the ability to detect signal jamming on a specific channel. |
|
||||
| JOINER | OT_JOINER | Enables [support for Joiner](https://openthread.io/reference/group/api-joiner). Enable this switch on a device that has to be commissioned to join the network. |
|
||||
| LEGACY | OT_LEGACY | Enables support for legacy network. |
|
||||
| LINK_RAW | OT_LINK_RAW | Enables the Link Raw service. |
|
||||
| LOG_OUTPUT | not implemented | Defines if the LOG output is to be created and where it goes. There are several options available: `NONE`, `DEBUG_UART`, `APP`, `PLATFORM_DEFINED` (default). See [Logging guide](https://openthread.io/guides/build/logs) to learn more. |
|
||||
| MAC_FILTER | OT_MAC_FILTER | Enables support for the MAC filter. |
|
||||
|
@ -61,7 +61,6 @@ HISTORY_TRACKER ?= 0
|
||||
IP6_FRAGM ?= 0
|
||||
JAM_DETECTION ?= 0
|
||||
JOINER ?= 0
|
||||
LEGACY ?= 0
|
||||
ifeq ($(REFERENCE_DEVICE),1)
|
||||
LOG_OUTPUT ?= APP
|
||||
endif
|
||||
@ -248,10 +247,6 @@ ifeq ($(JOINER),1)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_JOINER_ENABLE=1
|
||||
endif
|
||||
|
||||
ifeq ($(LEGACY),1)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_LEGACY_ENABLE=1
|
||||
endif
|
||||
|
||||
ifeq ($(LINK_RAW),1)
|
||||
COMMONCFLAGS += -DOPENTHREAD_CONFIG_LINK_RAW_ENABLE=1
|
||||
endif
|
||||
|
@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (283)
|
||||
#define OPENTHREAD_API_VERSION (284)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
@ -161,91 +161,6 @@ typedef bool (*otNcpDelegateAllowPeekPoke)(uint32_t aAddress, uint16_t aCount);
|
||||
void otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate,
|
||||
otNcpDelegateAllowPeekPoke aAllowPokeDelegate);
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// Legacy network APIs
|
||||
|
||||
#define OT_NCP_LEGACY_ULA_PREFIX_LENGTH 8 ///< Legacy ULA size (in bytes)
|
||||
|
||||
/**
|
||||
* Defines handler (function pointer) type for starting legacy network
|
||||
*
|
||||
* Invoked to start the legacy network.
|
||||
*
|
||||
*/
|
||||
typedef void (*otNcpHandlerStartLegacy)(void);
|
||||
|
||||
/**
|
||||
* Defines handler (function pointer) type for stopping legacy network
|
||||
*
|
||||
* Invoked to stop the legacy network.
|
||||
*
|
||||
*/
|
||||
typedef void (*otNcpHandlerStopLegacy)(void);
|
||||
|
||||
/**
|
||||
* Defines handler (function pointer) type for initiating joining process.
|
||||
*
|
||||
* @param[in] aExtAddress A pointer to the extended address for the node to join
|
||||
* or NULL if desired to join any neighboring node.
|
||||
*
|
||||
* Invoked to initiate a legacy join procedure to any or a specific node.
|
||||
*
|
||||
*/
|
||||
typedef void (*otNcpHandlerJoinLegacyNode)(const otExtAddress *aExtAddress);
|
||||
|
||||
/**
|
||||
* Defines handler (function pointer) type for setting the legacy ULA prefix.
|
||||
*
|
||||
* @param[in] aUlaPrefix A pointer to buffer containing the legacy ULA prefix.
|
||||
*
|
||||
* Invoked to set the legacy ULA prefix.
|
||||
*
|
||||
*/
|
||||
typedef void (*otNcpHandlerSetLegacyUlaPrefix)(const uint8_t *aUlaPrefix);
|
||||
|
||||
/**
|
||||
* Defines a struct containing all the legacy handlers (function pointers).
|
||||
*
|
||||
*/
|
||||
typedef struct otNcpLegacyHandlers
|
||||
{
|
||||
otNcpHandlerStartLegacy mStartLegacy; ///< Start handler
|
||||
otNcpHandlerStopLegacy mStopLegacy; ///< Stop handler
|
||||
otNcpHandlerJoinLegacyNode mJoinLegacyNode; ///< Join handler
|
||||
otNcpHandlerSetLegacyUlaPrefix mSetLegacyUlaPrefix; ///< Set ULA handler
|
||||
} otNcpLegacyHandlers;
|
||||
|
||||
/**
|
||||
* This callback is invoked by the legacy stack to notify that a new
|
||||
* legacy node did join the network.
|
||||
*
|
||||
* @param[in] aExtAddr A pointer to the extended address of the joined node.
|
||||
*
|
||||
*/
|
||||
void otNcpHandleLegacyNodeDidJoin(const otExtAddress *aExtAddr);
|
||||
|
||||
/**
|
||||
* This callback is invoked by the legacy stack to notify that the
|
||||
* legacy ULA prefix has changed.
|
||||
*
|
||||
* @param[in] aUlaPrefix A pointer to the received ULA prefix.
|
||||
*
|
||||
*/
|
||||
void otNcpHandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix);
|
||||
|
||||
/**
|
||||
* This method registers a set of legacy handlers with NCP.
|
||||
*
|
||||
* The set of handlers provided by the struct @p aHandlers are used by
|
||||
* NCP code to start/stop legacy network.
|
||||
* The @p aHandlers can be NULL to disable legacy support on NCP.
|
||||
* Individual handlers in the given handlers struct can also be NULL.
|
||||
*
|
||||
* @param[in] aHandlers A pointer to a handler struct.
|
||||
*
|
||||
*/
|
||||
void otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
@ -59,7 +59,6 @@ OT_BUILD_OPTIONS=(
|
||||
"-DOT_IP6_FRAGM=ON"
|
||||
"-DOT_JAM_DETECTION=ON"
|
||||
"-DOT_JOINER=ON"
|
||||
"-DOT_LEGACY=ON"
|
||||
"-DOT_LOG_LEVEL_DYNAMIC=ON"
|
||||
"-DOT_MAC_FILTER=ON"
|
||||
"-DOT_MTD_NETDIAG=ON"
|
||||
|
@ -64,7 +64,6 @@ build_all_features()
|
||||
"-DOPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_JOINER_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_LEGACY_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_LINK_RAW_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_MAC_BEACON_RSP_WHEN_JOINABLE_ENABLE=1"
|
||||
@ -149,7 +148,6 @@ build_nest_common()
|
||||
"-DOPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_DIAG_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_LEGACY_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_PING_SENDER_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1"
|
||||
|
@ -92,7 +92,6 @@ OT_POSIX_SIM_COMMON_OPTIONS=(
|
||||
"-DOT_IP6_FRAGM=ON"
|
||||
"-DOT_JAM_DETECTION=ON"
|
||||
"-DOT_JOINER=ON"
|
||||
"-DOT_LEGACY=ON"
|
||||
"-DOT_MAC_FILTER=ON"
|
||||
"-DOT_MTD_NETDIAG=ON"
|
||||
"-DOT_NEIGHBOR_DISCOVERY_AGENT=ON"
|
||||
|
@ -116,7 +116,6 @@ OT_CLANG_TIDY_BUILD_OPTS=(
|
||||
'-DOT_IP6_FRAGM=ON'
|
||||
'-DOT_JAM_DETECTION=ON'
|
||||
'-DOT_JOINER=ON'
|
||||
'-DOT_LEGACY=ON'
|
||||
'-DOT_LINK_RAW=ON'
|
||||
'-DOT_LINK_METRICS_INITIATOR=ON'
|
||||
'-DOT_LINK_METRICS_SUBJECT=ON'
|
||||
|
@ -7831,11 +7831,3 @@ exit:
|
||||
|
||||
} // namespace Cli
|
||||
} // namespace ot
|
||||
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
OT_TOOL_WEAK void otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers) { OT_UNUSED_VARIABLE(aHandlers); }
|
||||
|
||||
OT_TOOL_WEAK void otNcpHandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix) { OT_UNUSED_VARIABLE(aUlaPrefix); }
|
||||
|
||||
OT_TOOL_WEAK void otNcpHandleLegacyNodeDidJoin(const otExtAddress *aExtAddr) { OT_UNUSED_VARIABLE(aExtAddr); }
|
||||
#endif
|
||||
|
@ -170,10 +170,6 @@ if (openthread_enable_core_config_args) {
|
||||
defines += [ "OPENTHREAD_CONFIG_JOINER_ENABLE=1" ]
|
||||
}
|
||||
|
||||
if (openthread_config_legacy_enable) {
|
||||
defines += [ "OPENTHREAD_CONFIG_LEGACY_ENABLE=1" ]
|
||||
}
|
||||
|
||||
if (openthread_config_link_metrics_initiator_enable) {
|
||||
defines += [ "DOPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE=1" ]
|
||||
}
|
||||
|
@ -581,16 +581,6 @@
|
||||
#endif // OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
|
||||
#endif // OPENTHREAD_CONFIG_DEFAULT_CHANNEL
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
*
|
||||
* Define to 1 to enable legacy network support.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
#define OPENTHREAD_CONFIG_LEGACY_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_OTNS_ENABLE
|
||||
*
|
||||
|
@ -145,6 +145,10 @@
|
||||
#error "OPENTHREAD_ENABLE_LEGACY was replaced by OPENTHREAD_CONFIG_LEGACY_ENABLE."
|
||||
#endif
|
||||
|
||||
#ifdef OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
#error "OPENTHREAD_CONFIG_LEGACY_ENABLE was removed."
|
||||
#endif
|
||||
|
||||
#ifdef OPENTHREAD_ENABLE_CHILD_SUPERVISION
|
||||
#error "OPENTHREAD_ENABLE_CHILD_SUPERVISION was replaced by OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE."
|
||||
#endif
|
||||
|
@ -1484,8 +1484,6 @@ const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
|
||||
{SPINEL_PROP_CNTR_ALL_IP_COUNTERS, "CNTR_ALL_IP_COUNTERS"},
|
||||
{SPINEL_PROP_CNTR_MAC_RETRY_HISTOGRAM, "CNTR_MAC_RETRY_HISTOGRAM"},
|
||||
{SPINEL_PROP_NEST_STREAM_MFG, "NEST_STREAM_MFG"},
|
||||
{SPINEL_PROP_NEST_LEGACY_ULA_PREFIX, "NEST_LEGACY_ULA_PREFIX"},
|
||||
{SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED, "NEST_LEGACY_LAST_NODE_JOINED"},
|
||||
{SPINEL_PROP_DEBUG_TEST_ASSERT, "DEBUG_TEST_ASSERT"},
|
||||
{SPINEL_PROP_DEBUG_NCP_LOG_LEVEL, "DEBUG_NCP_LOG_LEVEL"},
|
||||
{SPINEL_PROP_DEBUG_TEST_WATCHDOG, "DEBUG_TEST_WATCHDOG"},
|
||||
@ -1633,8 +1631,6 @@ const char *spinel_capability_to_cstr(spinel_capability_t capability)
|
||||
{SPINEL_CAP_THREAD_SERVICE, "THREAD_SERVICE"},
|
||||
{SPINEL_CAP_THREAD_CSL_RECEIVER, "THREAD_CSL_RECEIVER"},
|
||||
{SPINEL_CAP_THREAD_BACKBONE_ROUTER, "THREAD_BACKBONE_ROUTER"},
|
||||
{SPINEL_CAP_NEST_LEGACY_INTERFACE, "NEST_LEGACY_INTERFACE"},
|
||||
{SPINEL_CAP_NEST_LEGACY_NET_WAKE, "NEST_LEGACY_NET_WAKE"},
|
||||
{SPINEL_CAP_NEST_TRANSMIT_HOOK, "NEST_TRANSMIT_HOOK"},
|
||||
{0, NULL},
|
||||
};
|
||||
|
@ -1319,8 +1319,8 @@ enum
|
||||
SPINEL_CAP_THREAD__END = 1152,
|
||||
|
||||
SPINEL_CAP_NEST__BEGIN = 15296,
|
||||
SPINEL_CAP_NEST_LEGACY_INTERFACE = (SPINEL_CAP_NEST__BEGIN + 0),
|
||||
SPINEL_CAP_NEST_LEGACY_NET_WAKE = (SPINEL_CAP_NEST__BEGIN + 1),
|
||||
SPINEL_CAP_NEST_LEGACY_INTERFACE = (SPINEL_CAP_NEST__BEGIN + 0), ///< deprecated
|
||||
SPINEL_CAP_NEST_LEGACY_NET_WAKE = (SPINEL_CAP_NEST__BEGIN + 1), ///< deprecated
|
||||
SPINEL_CAP_NEST_TRANSMIT_HOOK = (SPINEL_CAP_NEST__BEGIN + 2),
|
||||
SPINEL_CAP_NEST__END = 15360,
|
||||
|
||||
@ -4839,12 +4839,20 @@ enum
|
||||
|
||||
SPINEL_PROP_NEST_STREAM_MFG = SPINEL_PROP_NEST__BEGIN + 0,
|
||||
|
||||
/// The legacy network ULA prefix (8 bytes)
|
||||
/** Format: 'D' */
|
||||
/// The legacy network ULA prefix (8 bytes).
|
||||
/** Format: 'D'
|
||||
*
|
||||
* This property is deprecated.
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_NEST_LEGACY_ULA_PREFIX = SPINEL_PROP_NEST__BEGIN + 1,
|
||||
|
||||
/// The EUI64 of last node joined using legacy protocol (if none, all zero EUI64 is returned).
|
||||
/** Format: 'E' */
|
||||
/** Format: 'E'
|
||||
*
|
||||
* This property is deprecated.
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED = SPINEL_PROP_NEST__BEGIN + 2,
|
||||
|
||||
SPINEL_PROP_NEST__END = 0x3C00,
|
||||
|
@ -67,10 +67,6 @@ const ChangedPropsSet::Entry ChangedPropsSet::mSupportedProps[] = {
|
||||
{SPINEL_PROP_LAST_STATUS, SPINEL_STATUS_DROPPED, true},
|
||||
#if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE
|
||||
{SPINEL_PROP_JAM_DETECTED, SPINEL_STATUS_OK, true},
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
{SPINEL_PROP_NEST_LEGACY_ULA_PREFIX, SPINEL_STATUS_OK, true},
|
||||
{SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED, SPINEL_STATUS_OK, true},
|
||||
#endif
|
||||
{SPINEL_PROP_LAST_STATUS, SPINEL_STATUS_JOIN_FAILURE, false},
|
||||
{SPINEL_PROP_MAC_SCAN_STATE, SPINEL_STATUS_OK, false},
|
||||
|
@ -290,12 +290,6 @@ NcpBase::NcpBase(Instance *aInstance)
|
||||
#if OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE
|
||||
otSrpClientSetCallback(mInstance, HandleSrpClientCallback, this);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
mLegacyNodeDidJoin = false;
|
||||
mLegacyHandlers = nullptr;
|
||||
memset(mLegacyUlaPrefix, 0, sizeof(mLegacyUlaPrefix));
|
||||
memset(&mLegacyLastJoinedNode, 0, sizeof(mLegacyLastJoinedNode));
|
||||
#endif
|
||||
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
mChangedPropsSet.AddLastStatus(SPINEL_STATUS_RESET_UNKNOWN);
|
||||
mUpdateChangedPropsTask.Post();
|
||||
@ -1917,10 +1911,6 @@ template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CAPS>(void)
|
||||
|
||||
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_ROLE_SLEEPY));
|
||||
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_NEST_LEGACY_INTERFACE));
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_THREAD_COMMISSIONER));
|
||||
#endif
|
||||
@ -2048,7 +2038,6 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MCU_POWER_STATE>(void
|
||||
if (otThreadGetDeviceRole(mInstance) != OT_DEVICE_ROLE_DISABLED)
|
||||
{
|
||||
IgnoreError(otThreadSetEnabled(mInstance, false));
|
||||
StopLegacy();
|
||||
}
|
||||
|
||||
if (otIp6IsEnabled(mInstance))
|
||||
|
@ -130,36 +130,6 @@ public:
|
||||
otNcpDelegateAllowPeekPoke aAllowPokeDelegate);
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
/**
|
||||
* This callback is invoked by the legacy stack to notify that a new
|
||||
* legacy node did join the network.
|
||||
*
|
||||
* @param[in] aExtAddr The extended address of the joined node.
|
||||
*
|
||||
*/
|
||||
void HandleLegacyNodeDidJoin(const otExtAddress *aExtAddr);
|
||||
|
||||
/**
|
||||
* This callback is invoked by the legacy stack to notify that the
|
||||
* legacy ULA prefix has changed.
|
||||
*
|
||||
* param[in] aUlaPrefix The changed ULA prefix.
|
||||
*
|
||||
*/
|
||||
void HandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix);
|
||||
|
||||
/**
|
||||
* This method registers a set of legacy handlers with NCP.
|
||||
*
|
||||
* @param[in] aHandlers A pointer to a handler struct.
|
||||
*
|
||||
*/
|
||||
void RegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers);
|
||||
#endif
|
||||
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
|
||||
/**
|
||||
* This method is called by the framer whenever a framing error is detected.
|
||||
*/
|
||||
@ -485,14 +455,6 @@ protected:
|
||||
|
||||
void ResetCounters(void);
|
||||
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
void StartLegacy(void);
|
||||
void StopLegacy(void);
|
||||
#else
|
||||
void StartLegacy(void) {}
|
||||
void StopLegacy(void) {}
|
||||
#endif
|
||||
|
||||
static uint8_t ConvertLogLevel(otLogLevel aLogLevel);
|
||||
static unsigned int ConvertLogRegion(otLogRegion aLogRegion);
|
||||
|
||||
@ -662,12 +624,6 @@ protected:
|
||||
bool mSrpClientCallbackEnabled;
|
||||
#endif // OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE
|
||||
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
const otNcpLegacyHandlers *mLegacyHandlers;
|
||||
uint8_t mLegacyUlaPrefix[OT_NCP_LEGACY_ULA_PREFIX_LENGTH];
|
||||
otExtAddress mLegacyLastJoinedNode;
|
||||
bool mLegacyNodeDidJoin;
|
||||
#endif
|
||||
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
|
||||
uint32_t mFramingErrorCounter; // Number of improperly formed received spinel frames.
|
||||
|
@ -371,10 +371,6 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_NEST_LEGACY_ULA_PREFIX),
|
||||
OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED),
|
||||
#endif
|
||||
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_DEBUG_TEST_ASSERT),
|
||||
OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_DEBUG_NCP_LOG_LEVEL),
|
||||
@ -630,9 +626,6 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey)
|
||||
OT_NCP_SET_HANDLER_ENTRY(SPINEL_PROP_SRP_CLIENT_SERVICE_KEY_ENABLED),
|
||||
#endif
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
OT_NCP_SET_HANDLER_ENTRY(SPINEL_PROP_NEST_LEGACY_ULA_PREFIX),
|
||||
#endif
|
||||
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
#if OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
|
||||
OT_NCP_SET_HANDLER_ENTRY(SPINEL_PROP_DEBUG_NCP_LOG_LEVEL),
|
||||
|
@ -520,12 +520,10 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_STACK_UP>(void)
|
||||
if (enabled)
|
||||
{
|
||||
error = otThreadSetEnabled(mInstance, true);
|
||||
StartLegacy();
|
||||
}
|
||||
else
|
||||
{
|
||||
error = otThreadSetEnabled(mInstance, false);
|
||||
StopLegacy();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4081,115 +4079,6 @@ exit:
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
|
||||
void NcpBase::RegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers)
|
||||
{
|
||||
mLegacyHandlers = aHandlers;
|
||||
bool isEnabled;
|
||||
|
||||
VerifyOrExit(mLegacyHandlers != nullptr);
|
||||
|
||||
isEnabled = (otThreadGetDeviceRole(mInstance) != OT_DEVICE_ROLE_DISABLED);
|
||||
|
||||
if (isEnabled)
|
||||
{
|
||||
if (mLegacyHandlers->mStartLegacy)
|
||||
{
|
||||
mLegacyHandlers->mStartLegacy();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mLegacyHandlers->mStopLegacy)
|
||||
{
|
||||
mLegacyHandlers->mStopLegacy();
|
||||
}
|
||||
}
|
||||
|
||||
if (mLegacyHandlers->mSetLegacyUlaPrefix)
|
||||
{
|
||||
mLegacyHandlers->mSetLegacyUlaPrefix(mLegacyUlaPrefix);
|
||||
}
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void NcpBase::HandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix)
|
||||
{
|
||||
memcpy(mLegacyUlaPrefix, aUlaPrefix, OT_NCP_LEGACY_ULA_PREFIX_LENGTH);
|
||||
mChangedPropsSet.AddProperty(SPINEL_PROP_NEST_LEGACY_ULA_PREFIX);
|
||||
mUpdateChangedPropsTask.Post();
|
||||
}
|
||||
|
||||
void NcpBase::HandleLegacyNodeDidJoin(const otExtAddress *aExtAddr)
|
||||
{
|
||||
mLegacyNodeDidJoin = true;
|
||||
mLegacyLastJoinedNode = *aExtAddr;
|
||||
mChangedPropsSet.AddProperty(SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED);
|
||||
mUpdateChangedPropsTask.Post();
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NEST_LEGACY_ULA_PREFIX>(void)
|
||||
{
|
||||
return mEncoder.WriteData(mLegacyUlaPrefix, sizeof(mLegacyUlaPrefix));
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NEST_LEGACY_ULA_PREFIX>(void)
|
||||
{
|
||||
const uint8_t *ptr = nullptr;
|
||||
uint16_t len;
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadData(ptr, len));
|
||||
|
||||
VerifyOrExit(len <= sizeof(mLegacyUlaPrefix), error = OT_ERROR_PARSE);
|
||||
|
||||
memset(mLegacyUlaPrefix, 0, sizeof(mLegacyUlaPrefix));
|
||||
memcpy(mLegacyUlaPrefix, ptr, len);
|
||||
|
||||
if ((mLegacyHandlers != nullptr) && (mLegacyHandlers->mSetLegacyUlaPrefix != nullptr))
|
||||
{
|
||||
mLegacyHandlers->mSetLegacyUlaPrefix(mLegacyUlaPrefix);
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED>(void)
|
||||
{
|
||||
if (!mLegacyNodeDidJoin)
|
||||
{
|
||||
memset(&mLegacyLastJoinedNode, 0, sizeof(mLegacyLastJoinedNode));
|
||||
}
|
||||
|
||||
return mEncoder.WriteEui64(mLegacyLastJoinedNode);
|
||||
}
|
||||
|
||||
void NcpBase::StartLegacy(void)
|
||||
{
|
||||
mLegacyNodeDidJoin = false;
|
||||
|
||||
if ((mLegacyHandlers != nullptr) && (mLegacyHandlers->mStartLegacy != nullptr))
|
||||
{
|
||||
mLegacyHandlers->mStartLegacy();
|
||||
}
|
||||
}
|
||||
|
||||
void NcpBase::StopLegacy(void)
|
||||
{
|
||||
mLegacyNodeDidJoin = false;
|
||||
|
||||
if ((mLegacyHandlers != nullptr) && (mLegacyHandlers->mStopLegacy != nullptr))
|
||||
{
|
||||
mLegacyHandlers->mStopLegacy();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_NETWORK_TIME>(void)
|
||||
{
|
||||
@ -4719,11 +4608,7 @@ void NcpBase::ProcessThreadChangedFlags(void)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((otThreadGetDeviceRole(mInstance) == OT_DEVICE_ROLE_LEADER) && otThreadIsSingleton(mInstance)
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
&& !mLegacyNodeDidJoin
|
||||
#endif
|
||||
)
|
||||
if ((otThreadGetDeviceRole(mInstance) == OT_DEVICE_ROLE_LEADER) && otThreadIsSingleton(mInstance))
|
||||
{
|
||||
mThreadChangedFlags &= ~static_cast<uint32_t>(OT_CHANGED_THREAD_PARTITION_ID);
|
||||
IgnoreError(otThreadSetEnabled(mInstance, false));
|
||||
@ -4786,53 +4671,4 @@ exit:
|
||||
} // namespace Ncp
|
||||
} // namespace ot
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MARK: Legacy network APIs
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers)
|
||||
{
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance();
|
||||
|
||||
if (ncp != nullptr)
|
||||
{
|
||||
ncp->RegisterLegacyHandlers(aHandlers);
|
||||
}
|
||||
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aHandlers);
|
||||
#endif
|
||||
}
|
||||
|
||||
void otNcpHandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix)
|
||||
{
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance();
|
||||
|
||||
if (ncp != nullptr)
|
||||
{
|
||||
ncp->HandleDidReceiveNewLegacyUlaPrefix(aUlaPrefix);
|
||||
}
|
||||
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aUlaPrefix);
|
||||
#endif
|
||||
}
|
||||
|
||||
void otNcpHandleLegacyNodeDidJoin(const otExtAddress *aExtAddr)
|
||||
{
|
||||
#if OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance();
|
||||
|
||||
if (ncp != nullptr)
|
||||
{
|
||||
ncp->HandleLegacyNodeDidJoin(aExtAddr);
|
||||
}
|
||||
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aExtAddr);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
|
@ -58,7 +58,6 @@ HISTORY_TRACKER ?= 1
|
||||
IP6_FRAGM ?= 1
|
||||
JAM_DETECTION ?= 1
|
||||
JOINER ?= 1
|
||||
LEGACY ?= 1
|
||||
LINK_RAW ?= 0
|
||||
LOG_OUTPUT ?= PLATFORM_DEFINED
|
||||
MAC_FILTER ?= 1
|
||||
|
@ -147,14 +147,6 @@
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LEGACY_ENABLE
|
||||
*
|
||||
* Define to 1 to enable legacy network support.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_LEGACY_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ECDSA_ENABLE
|
||||
*
|
||||
|
Reference in New Issue
Block a user