mirror of
https://github.com/espressif/openthread.git
synced 2026-08-05 02:17:47 +00:00
[api] force linker failures when using disabled features (#4127)
This commit is contained in:
@@ -127,8 +127,6 @@ otError otChannelManagerSetDelay(otInstance *aInstance, uint16_t aDelay);
|
||||
*
|
||||
* @retval OT_ERROR_NONE Channel selection finished successfully.
|
||||
* @retval OT_ERROR_NOT_FOUND Supported channel mask is empty, therefore could not select a channel.
|
||||
* @retval OT_ERROR_INVALID_STATE Thread is not enabled or not enough data to select a new channel.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE `ChannelMonitor` feature is disabled by build-time configuration options.
|
||||
*
|
||||
*/
|
||||
otError otChannelManagerRequestChannelSelect(otInstance *aInstance, bool aSkipQualityCheck);
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
* This file defines the top-level functions for the OpenThread CoAP Secure implementation.
|
||||
*
|
||||
* @note
|
||||
* The functions in this module require the build-time feature `OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1`.
|
||||
*
|
||||
* @note
|
||||
* To enable cipher suite DTLS_PSK_WITH_AES_128_CCM_8, MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
* must be enabled in mbedtls-config.h
|
||||
* To enable cipher suite DTLS_ECDHE_ECDSA_WITH_AES_128_CCM_8,
|
||||
@@ -96,34 +99,34 @@ void otCoapSecureStop(otInstance *aInstance);
|
||||
* This method sets the Pre-Shared Key (PSK) and cipher suite
|
||||
* DTLS_PSK_WITH_AES_128_CCM_8.
|
||||
*
|
||||
* @note This function requires the build-time feature `MBEDTLS_KEY_EXCHANGE_PSK_ENABLED` to be enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPsk A pointer to the PSK.
|
||||
* @param[in] aPskLength The PSK length.
|
||||
* @param[in] aPskIdentity The Identity Name for the PSK.
|
||||
* @param[in] aPskIdLength The PSK Identity Length.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the PSK.
|
||||
* @retval OT_ERROR_INVALID_ARGS The PSK is invalid.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE Mbedtls config not enabled
|
||||
* MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
*
|
||||
*/
|
||||
otError otCoapSecureSetPsk(otInstance * aInstance,
|
||||
const uint8_t *aPsk,
|
||||
uint16_t aPskLength,
|
||||
const uint8_t *aPskIdentity,
|
||||
uint16_t aPskIdLength);
|
||||
void otCoapSecureSetPsk(otInstance * aInstance,
|
||||
const uint8_t *aPsk,
|
||||
uint16_t aPskLength,
|
||||
const uint8_t *aPskIdentity,
|
||||
uint16_t aPskIdLength);
|
||||
|
||||
/**
|
||||
* This method returns the peer x509 certificate base64 encoded.
|
||||
*
|
||||
* @note This function requires the build-time feature `MBEDTLS_BASE64_C` to be enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[out] aPeerCert A pointer to the base64 encoded certificate buffer.
|
||||
* @param[out] aCertLength The length of the base64 encoded peer certificate.
|
||||
* @param[in] aCertBufferSize The buffer size of aPeerCert.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully get the peer certificate.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE Mbedtls config not enabled MBEDTLS_BASE64_C.
|
||||
* @retval OT_ERROR_INVALID_STATE Not connected yet.
|
||||
* @retval OT_ERROR_NONE Successfully get the peer certificate.
|
||||
* @retval OT_ERROR_NO_BUFS Can't allocate memory for certificate.
|
||||
*
|
||||
*/
|
||||
otError otCoapSecureGetPeerCertificateBase64(otInstance * aInstance,
|
||||
@@ -147,23 +150,20 @@ void otCoapSecureSetSslAuthMode(otInstance *aInstance, bool aVerifyPeerCertifica
|
||||
* This method sets the local device's X509 certificate with corresponding private key for
|
||||
* DTLS session with DTLS_ECDHE_ECDSA_WITH_AES_128_CCM_8.
|
||||
*
|
||||
* @note This function requires `MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=1`.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aX509Cert A pointer to the PEM formatted X509 certificate.
|
||||
* @param[in] aX509Length The length of certificate.
|
||||
* @param[in] aPrivateKey A pointer to the PEM formatted private key.
|
||||
* @param[in] aPrivateKeyLength The length of the private key.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the x509 certificate
|
||||
* with his private key.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE Mbedtls config not enabled
|
||||
* MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED.
|
||||
*
|
||||
*/
|
||||
otError otCoapSecureSetCertificate(otInstance * aInstance,
|
||||
const uint8_t *aX509Cert,
|
||||
uint32_t aX509Length,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength);
|
||||
void otCoapSecureSetCertificate(otInstance * aInstance,
|
||||
const uint8_t *aX509Cert,
|
||||
uint32_t aX509Length,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength);
|
||||
|
||||
/**
|
||||
* This method sets the trusted top level CAs. It is needed for validating the
|
||||
@@ -171,16 +171,16 @@ otError otCoapSecureSetCertificate(otInstance * aInstance,
|
||||
*
|
||||
* DTLS mode "ECDHE ECDSA with AES 128 CCM 8" for Application CoAPS.
|
||||
*
|
||||
* @note This function requires `MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=1`.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aX509CaCertificateChain A pointer to the PEM formatted X509 CA chain.
|
||||
* @param[in] aX509CaCertChainLength The length of chain.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the trusted top level CAs.
|
||||
*
|
||||
*/
|
||||
otError otCoapSecureSetCaCertificateChain(otInstance * aInstance,
|
||||
const uint8_t *aX509CaCertificateChain,
|
||||
uint32_t aX509CaCertChainLength);
|
||||
void otCoapSecureSetCaCertificateChain(otInstance * aInstance,
|
||||
const uint8_t *aX509CaCertificateChain,
|
||||
uint32_t aX509CaCertChainLength);
|
||||
|
||||
/**
|
||||
* This method initializes DTLS session with a peer.
|
||||
|
||||
@@ -339,11 +339,6 @@ typedef enum otError
|
||||
*/
|
||||
OT_ERROR_NOT_LOWPAN_DATA_FRAME = 32,
|
||||
|
||||
/**
|
||||
* A feature/functionality disabled by build-time configuration options.
|
||||
*/
|
||||
OT_ERROR_DISABLED_FEATURE = 33,
|
||||
|
||||
/**
|
||||
* The link margin was too low.
|
||||
*/
|
||||
|
||||
@@ -48,6 +48,9 @@ extern "C" {
|
||||
* @brief
|
||||
* This module includes functions for the Thread Joiner role.
|
||||
*
|
||||
* @note
|
||||
* The functions in this module require `OPENTHREAD_CONFIG_JOINER_ENABLE=1`.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
@@ -93,7 +96,6 @@ typedef void (*otJoinerCallback)(otError aError, void *aContext);
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully started the Commissioner role.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aPSKd or @p aProvisioningUrl is invalid.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE The Joiner feature is not enabled in this build.
|
||||
*
|
||||
*/
|
||||
otError otJoinerStart(otInstance * aInstance,
|
||||
@@ -111,11 +113,8 @@ otError otJoinerStart(otInstance * aInstance,
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully disabled the Joiner role.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE The Joiner feature is not enabled in this build.
|
||||
*
|
||||
*/
|
||||
otError otJoinerStop(otInstance *aInstance);
|
||||
void otJoinerStop(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function returns the Joiner State.
|
||||
@@ -141,11 +140,8 @@ otJoinerState otJoinerGetState(otInstance *aInstance);
|
||||
* @param[in] aInstance A pointer to the OpenThread instance.
|
||||
* @param[out] aJoinerId A pointer to where the Joiner ID is placed.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the Joiner ID.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE The Joiner feature is not enabled in this build.
|
||||
*
|
||||
*/
|
||||
otError otJoinerGetId(otInstance *aInstance, otExtAddress *aJoinerId);
|
||||
void otJoinerGetId(otInstance *aInstance, otExtAddress *aJoinerId);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -66,14 +66,12 @@ otLogLevel otLoggingGetLevel(void);
|
||||
/**
|
||||
* This function sets the log level.
|
||||
*
|
||||
* @note This function requires `OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL=1`.
|
||||
*
|
||||
* @param[in] aLogLevel The log level.
|
||||
*
|
||||
* @retval OT_ERROR_NONE The log level was changed successfully.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE The dynamic log level feature is not supported.
|
||||
* (see `OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL` configuration option).
|
||||
*
|
||||
*/
|
||||
otError otLoggingSetLevel(otLogLevel aLogLevel);
|
||||
void otLoggingSetLevel(otLogLevel aLogLevel);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -122,12 +122,9 @@ typedef bool (*otNcpDelegateAllowPeekPoke)(uint32_t aAddress, uint16_t aCount);
|
||||
* @param[in] aAllowPeekDelegate Delegate function pointer for peek operation.
|
||||
* @param[in] aAllowPokeDelegate Delegate function pointer for poke operation.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully registered delegate functions.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE Peek/Poke feature is disabled (by a build-time configuration option).
|
||||
*
|
||||
*/
|
||||
otError otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate,
|
||||
otNcpDelegateAllowPeekPoke aAllowPokeDelegate);
|
||||
void otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate,
|
||||
otNcpDelegateAllowPeekPoke aAllowPokeDelegate);
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// Legacy network APIs
|
||||
|
||||
@@ -46,6 +46,9 @@ extern "C" {
|
||||
/**
|
||||
* @addtogroup api-thread-general
|
||||
*
|
||||
* @note
|
||||
* The functions in this module require `OPENTHREAD_FTD=1` or `OPENTHREAD_MTD=1`.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
@@ -753,13 +756,10 @@ typedef void (*otThreadParentResponseCallback)(otThreadParentResponseInfo *aInfo
|
||||
* @param[in] aCallback A pointer to a function that is called upon receiving an MLE Parent Response message.
|
||||
* @param[in] aContext A pointer to callback client-specific context.
|
||||
*
|
||||
* @retval OT_ERROR_NONE On successful registration
|
||||
* @retval OT_ERROR_DISABLED_FEATURE If the feature is not supported
|
||||
*
|
||||
*/
|
||||
otError otThreadRegisterParentResponseCallback(otInstance * aInstance,
|
||||
otThreadParentResponseCallback aCallback,
|
||||
void * aContext);
|
||||
void otThreadRegisterParentResponseCallback(otInstance * aInstance,
|
||||
otThreadParentResponseCallback aCallback,
|
||||
void * aContext);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -232,8 +232,7 @@ otError otThreadSetJoinerUdpPort(otInstance *aInstance, uint16_t aJoinerUdpPort)
|
||||
* Set Steering data out of band.
|
||||
*
|
||||
* Configuration option `OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE` should be set to enable setting of steering
|
||||
* data out of band. Otherwise calling this function does nothing and it returns `OT_ERROR_DISABLED_FEATURE`
|
||||
* error.
|
||||
* data out of band.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddress Address used to update the steering data.
|
||||
@@ -241,11 +240,8 @@ otError otThreadSetJoinerUdpPort(otInstance *aInstance, uint16_t aJoinerUdpPort)
|
||||
* All 0xFFs to set steering data/bloom filter to accept/allow all.
|
||||
* A specific EUI64 which is then added to current steering data/bloom filter.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set/updated the steering data.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE Feature is disabled, not capable of setting steering data out of band.
|
||||
*
|
||||
*/
|
||||
otError otThreadSetSteeringData(otInstance *aInstance, const otExtAddress *aExtAddress);
|
||||
void otThreadSetSteeringData(otInstance *aInstance, const otExtAddress *aExtAddress);
|
||||
|
||||
/**
|
||||
* Get the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.
|
||||
|
||||
@@ -524,12 +524,14 @@ void Interpreter::ProcessChannel(int argc, char *argv[])
|
||||
SuccessOrExit(error = ParseLong(argv[2], value));
|
||||
otChannelManagerRequestChannelChange(mInstance, static_cast<uint8_t>(value));
|
||||
}
|
||||
#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE
|
||||
else if (strcmp(argv[1], "select") == 0)
|
||||
{
|
||||
VerifyOrExit(argc > 2, error = OT_ERROR_INVALID_ARGS);
|
||||
SuccessOrExit(error = ParseLong(argv[2], value));
|
||||
error = otChannelManagerRequestChannelSelect(mInstance, (value != 0) ? true : false);
|
||||
}
|
||||
#endif
|
||||
else if (strcmp(argv[1], "auto") == 0)
|
||||
{
|
||||
VerifyOrExit(argc > 2, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
+14
-17
@@ -52,7 +52,10 @@ const struct CoapSecure::Command CoapSecure::sCommands[] = {
|
||||
{"get", &CoapSecure::ProcessRequest}, {"post", &CoapSecure::ProcessRequest},
|
||||
{"psk", &CoapSecure::ProcessPsk}, {"put", &CoapSecure::ProcessRequest},
|
||||
{"resource", &CoapSecure::ProcessResource}, {"start", &CoapSecure::ProcessStart},
|
||||
{"stop", &CoapSecure::ProcessStop}, {"x509", &CoapSecure::ProcessX509},
|
||||
{"stop", &CoapSecure::ProcessStop},
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
{"x509", &CoapSecure::ProcessX509},
|
||||
#endif
|
||||
};
|
||||
|
||||
CoapSecure::CoapSecure(Interpreter &aInterpreter)
|
||||
@@ -340,7 +343,7 @@ otError CoapSecure::ProcessDisconnect(int argc, char *argv[])
|
||||
|
||||
otError CoapSecure::ProcessPsk(int argc, char *argv[])
|
||||
{
|
||||
otError error;
|
||||
otError error = OT_ERROR_NONE;
|
||||
size_t length;
|
||||
|
||||
VerifyOrExit(argc > 2, error = OT_ERROR_INVALID_ARGS);
|
||||
@@ -355,36 +358,30 @@ otError CoapSecure::ProcessPsk(int argc, char *argv[])
|
||||
mPskIdLength = static_cast<uint8_t>(length);
|
||||
memcpy(mPskId, argv[2], mPskIdLength);
|
||||
|
||||
SuccessOrExit(error = otCoapSecureSetPsk(mInterpreter.mInstance, mPsk, mPskLength, mPskId, mPskIdLength));
|
||||
otCoapSecureSetPsk(mInterpreter.mInstance, mPsk, mPskLength, mPskId, mPskIdLength);
|
||||
mUseCertificate = false;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
otError CoapSecure::ProcessX509(int argc, char *argv[])
|
||||
{
|
||||
OT_UNUSED_VARIABLE(argc);
|
||||
OT_UNUSED_VARIABLE(argv);
|
||||
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
otError error;
|
||||
otCoapSecureSetCertificate(mInterpreter.mInstance, (const uint8_t *)OT_CLI_COAPS_X509_CERT,
|
||||
sizeof(OT_CLI_COAPS_X509_CERT), (const uint8_t *)OT_CLI_COAPS_PRIV_KEY,
|
||||
sizeof(OT_CLI_COAPS_PRIV_KEY));
|
||||
|
||||
SuccessOrExit(error = otCoapSecureSetCertificate(
|
||||
mInterpreter.mInstance, (const uint8_t *)OT_CLI_COAPS_X509_CERT, sizeof(OT_CLI_COAPS_X509_CERT),
|
||||
(const uint8_t *)OT_CLI_COAPS_PRIV_KEY, sizeof(OT_CLI_COAPS_PRIV_KEY)));
|
||||
|
||||
SuccessOrExit(error = otCoapSecureSetCaCertificateChain(mInterpreter.mInstance,
|
||||
(const uint8_t *)OT_CLI_COAPS_TRUSTED_ROOT_CERTIFICATE,
|
||||
sizeof(OT_CLI_COAPS_TRUSTED_ROOT_CERTIFICATE)));
|
||||
otCoapSecureSetCaCertificateChain(mInterpreter.mInstance, (const uint8_t *)OT_CLI_COAPS_TRUSTED_ROOT_CERTIFICATE,
|
||||
sizeof(OT_CLI_COAPS_TRUSTED_ROOT_CERTIFICATE));
|
||||
mUseCertificate = true;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
#else
|
||||
return OT_ERROR_DISABLED_FEATURE;
|
||||
#endif
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
otError CoapSecure::Process(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@@ -63,19 +63,17 @@ otError Joiner::ProcessHelp(int argc, char *argv[])
|
||||
|
||||
otError Joiner::ProcessId(int argc, char *argv[])
|
||||
{
|
||||
otError error;
|
||||
otExtAddress joinerId;
|
||||
|
||||
OT_UNUSED_VARIABLE(argc);
|
||||
OT_UNUSED_VARIABLE(argv);
|
||||
|
||||
SuccessOrExit(error = otJoinerGetId(mInterpreter.mInstance, &joinerId));
|
||||
otExtAddress joinerId;
|
||||
|
||||
otJoinerGetId(mInterpreter.mInstance, &joinerId);
|
||||
|
||||
mInterpreter.OutputBytes(joinerId.m8, sizeof(joinerId));
|
||||
mInterpreter.mServer->OutputFormat("\r\n");
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Joiner::ProcessStart(int argc, char *argv[])
|
||||
@@ -102,7 +100,9 @@ otError Joiner::ProcessStop(int argc, char *argv[])
|
||||
OT_UNUSED_VARIABLE(argc);
|
||||
OT_UNUSED_VARIABLE(argv);
|
||||
|
||||
return otJoinerStop(mInterpreter.mInstance);
|
||||
otJoinerStop(mInterpreter.mInstance);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError Joiner::Process(int argc, char *argv[])
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
#include <openthread/border_router.h>
|
||||
|
||||
#include "common/debug.hpp"
|
||||
#include "common/instance.hpp"
|
||||
#include "common/locator-getters.hpp"
|
||||
|
||||
@@ -44,15 +45,11 @@ using namespace ot;
|
||||
|
||||
otError otBorderRouterGetNetData(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aData != NULL && aDataLength != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aData != NULL && aDataLength != NULL);
|
||||
|
||||
error = instance.Get<NetworkData::Local>().GetNetworkData(aStable, aData, *aDataLength);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<NetworkData::Local>().GetNetworkData(aStable, aData, *aDataLength);
|
||||
}
|
||||
|
||||
otError otBorderRouterAddOnMeshPrefix(otInstance *aInstance, const otBorderRouterConfig *aConfig)
|
||||
@@ -60,6 +57,8 @@ otError otBorderRouterAddOnMeshPrefix(otInstance *aInstance, const otBorderRoute
|
||||
uint8_t flags = 0;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
assert(aConfig != NULL);
|
||||
|
||||
if (aConfig->mPreferred)
|
||||
{
|
||||
flags |= NetworkData::BorderRouterEntry::kPreferredFlag;
|
||||
@@ -98,6 +97,8 @@ otError otBorderRouterRemoveOnMeshPrefix(otInstance *aInstance, const otIp6Prefi
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
assert(aPrefix != NULL);
|
||||
|
||||
return instance.Get<NetworkData::Local>().RemoveOnMeshPrefix(aPrefix->mPrefix.mFields.m8, aPrefix->mLength);
|
||||
}
|
||||
|
||||
@@ -105,21 +106,19 @@ otError otBorderRouterGetNextOnMeshPrefix(otInstance * aInstance,
|
||||
otNetworkDataIterator *aIterator,
|
||||
otBorderRouterConfig * aConfig)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aIterator && aConfig, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aIterator != NULL && aConfig != NULL);
|
||||
|
||||
error = instance.Get<NetworkData::Local>().GetNextOnMeshPrefix(aIterator, aConfig);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<NetworkData::Local>().GetNextOnMeshPrefix(aIterator, aConfig);
|
||||
}
|
||||
|
||||
otError otBorderRouterAddRoute(otInstance *aInstance, const otExternalRouteConfig *aConfig)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
assert(aConfig != NULL);
|
||||
|
||||
return instance.Get<NetworkData::Local>().AddHasRoutePrefix(
|
||||
aConfig->mPrefix.mPrefix.mFields.m8, aConfig->mPrefix.mLength, aConfig->mPreference, aConfig->mStable);
|
||||
}
|
||||
@@ -128,6 +127,8 @@ otError otBorderRouterRemoveRoute(otInstance *aInstance, const otIp6Prefix *aPre
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
assert(aPrefix != NULL);
|
||||
|
||||
return instance.Get<NetworkData::Local>().RemoveHasRoutePrefix(aPrefix->mPrefix.mFields.m8, aPrefix->mLength);
|
||||
}
|
||||
|
||||
@@ -135,15 +136,11 @@ otError otBorderRouterGetNextRoute(otInstance * aInstance,
|
||||
otNetworkDataIterator *aIterator,
|
||||
otExternalRouteConfig *aConfig)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aIterator && aConfig, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aIterator != NULL && aConfig != NULL);
|
||||
|
||||
error = instance.Get<NetworkData::Local>().GetNextExternalRoute(aIterator, aConfig);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<NetworkData::Local>().GetNextExternalRoute(aIterator, aConfig);
|
||||
}
|
||||
|
||||
otError otBorderRouterRegister(otInstance *aInstance)
|
||||
|
||||
@@ -70,12 +70,14 @@ otError otChannelManagerSetDelay(otInstance *aInstance, uint16_t aDelay)
|
||||
return instance.Get<Utils::ChannelManager>().SetDelay(aDelay);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE
|
||||
otError otChannelManagerRequestChannelSelect(otInstance *aInstance, bool aSkipQualityCheck)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.Get<Utils::ChannelManager>().RequestChannelSelect(aSkipQualityCheck);
|
||||
}
|
||||
#endif
|
||||
|
||||
void otChannelManagerSetAutoChannelSelectionEnabled(otInstance *aInstance, bool aEnabled)
|
||||
{
|
||||
|
||||
@@ -52,98 +52,58 @@ otError otCoapSecureStart(otInstance *aInstance, uint16_t aPort)
|
||||
return instance.GetApplicationCoapSecure().Start(aPort);
|
||||
}
|
||||
|
||||
otError otCoapSecureSetCertificate(otInstance * aInstance,
|
||||
const uint8_t *aX509Cert,
|
||||
uint32_t aX509Length,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength)
|
||||
{
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
void otCoapSecureSetCertificate(otInstance * aInstance,
|
||||
const uint8_t *aX509Cert,
|
||||
uint32_t aX509Length,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
if (aX509Cert == NULL || aX509Length == 0 || aPrivateKey == NULL || aPrivateKeyLength == 0)
|
||||
{
|
||||
return OT_ERROR_INVALID_ARGS;
|
||||
}
|
||||
assert(aX509Cert != NULL && aX509Length != 0 && aPrivateKey != NULL && aPrivateKeyLength != 0);
|
||||
|
||||
return instance.GetApplicationCoapSecure().SetCertificate(aX509Cert, aX509Length, aPrivateKey, aPrivateKeyLength);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aX509Cert);
|
||||
OT_UNUSED_VARIABLE(aX509Length);
|
||||
OT_UNUSED_VARIABLE(aPrivateKey);
|
||||
OT_UNUSED_VARIABLE(aPrivateKeyLength);
|
||||
|
||||
return OT_ERROR_DISABLED_FEATURE;
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
instance.GetApplicationCoapSecure().SetCertificate(aX509Cert, aX509Length, aPrivateKey, aPrivateKeyLength);
|
||||
}
|
||||
|
||||
otError otCoapSecureSetCaCertificateChain(otInstance * aInstance,
|
||||
const uint8_t *aX509CaCertificateChain,
|
||||
uint32_t aX509CaCertChainLength)
|
||||
void otCoapSecureSetCaCertificateChain(otInstance * aInstance,
|
||||
const uint8_t *aX509CaCertificateChain,
|
||||
uint32_t aX509CaCertChainLength)
|
||||
{
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
if (aX509CaCertificateChain == NULL || aX509CaCertChainLength == 0)
|
||||
{
|
||||
return OT_ERROR_INVALID_ARGS;
|
||||
}
|
||||
assert(aX509CaCertificateChain != NULL && aX509CaCertChainLength != 0);
|
||||
|
||||
return instance.GetApplicationCoapSecure().SetCaCertificateChain(aX509CaCertificateChain, aX509CaCertChainLength);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aX509CaCertificateChain);
|
||||
OT_UNUSED_VARIABLE(aX509CaCertChainLength);
|
||||
|
||||
return OT_ERROR_DISABLED_FEATURE;
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
instance.GetApplicationCoapSecure().SetCaCertificateChain(aX509CaCertificateChain, aX509CaCertChainLength);
|
||||
}
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
otError otCoapSecureSetPsk(otInstance * aInstance,
|
||||
const uint8_t *aPsk,
|
||||
uint16_t aPskLength,
|
||||
const uint8_t *aPskIdentity,
|
||||
uint16_t aPskIdLength)
|
||||
{
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
void otCoapSecureSetPsk(otInstance * aInstance,
|
||||
const uint8_t *aPsk,
|
||||
uint16_t aPskLength,
|
||||
const uint8_t *aPskIdentity,
|
||||
uint16_t aPskIdLength)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
if (aPsk == NULL || aPskLength == 0 || aPskIdentity == NULL || aPskIdLength == 0)
|
||||
{
|
||||
return OT_ERROR_INVALID_ARGS;
|
||||
}
|
||||
assert(aPsk != NULL && aPskLength != 0 && aPskIdentity != NULL && aPskIdLength != 0);
|
||||
|
||||
return instance.GetApplicationCoapSecure().SetPreSharedKey(aPsk, aPskLength, aPskIdentity, aPskIdLength);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aPsk);
|
||||
OT_UNUSED_VARIABLE(aPskLength);
|
||||
OT_UNUSED_VARIABLE(aPskIdentity);
|
||||
OT_UNUSED_VARIABLE(aPskIdLength);
|
||||
|
||||
return OT_ERROR_DISABLED_FEATURE;
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
instance.GetApplicationCoapSecure().SetPreSharedKey(aPsk, aPskLength, aPskIdentity, aPskIdLength);
|
||||
}
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
|
||||
#ifdef MBEDTLS_BASE64_C
|
||||
otError otCoapSecureGetPeerCertificateBase64(otInstance * aInstance,
|
||||
unsigned char *aPeerCert,
|
||||
size_t * aCertLength,
|
||||
size_t aCertBufferSize)
|
||||
{
|
||||
#ifdef MBEDTLS_BASE64_C
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.GetApplicationCoapSecure().GetPeerCertificateBase64(aPeerCert, aCertLength, aCertBufferSize);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aPeerCert);
|
||||
OT_UNUSED_VARIABLE(aCertLength);
|
||||
OT_UNUSED_VARIABLE(aCertBufferSize);
|
||||
|
||||
return OT_ERROR_DISABLED_FEATURE;
|
||||
#endif // MBEDTLS_BASE64_C
|
||||
}
|
||||
#endif // MBEDTLS_BASE64_C
|
||||
|
||||
void otCoapSecureSetSslAuthMode(otInstance *aInstance, bool aVerifyPeerCertificate)
|
||||
{
|
||||
@@ -193,8 +153,8 @@ void otCoapSecureStop(otInstance *aInstance)
|
||||
|
||||
otError otCoapSecureSendRequest(otInstance * aInstance,
|
||||
otMessage * aMessage,
|
||||
otCoapResponseHandler aHandler = NULL,
|
||||
void * aContext = NULL)
|
||||
otCoapResponseHandler aHandler,
|
||||
void * aContext)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
|
||||
@@ -40,14 +40,14 @@
|
||||
|
||||
using namespace ot;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
otError otCommissionerStart(otInstance * aInstance,
|
||||
otCommissionerStateCallback aStateCallback,
|
||||
otCommissionerJoinerCallback aJoinerCallback,
|
||||
void * aCallbackContext)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
otError error;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
|
||||
@@ -56,100 +56,55 @@ otError otCommissionerStart(otInstance * aInstance,
|
||||
SuccessOrExit(error =
|
||||
instance.Get<MeshCoP::Commissioner>().Start(aStateCallback, aJoinerCallback, aCallbackContext));
|
||||
exit:
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aStateCallback);
|
||||
OT_UNUSED_VARIABLE(aJoinerCallback);
|
||||
OT_UNUSED_VARIABLE(aCallbackContext);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otCommissionerStop(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
otError error;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
SuccessOrExit(error = instance.Get<MeshCoP::Commissioner>().Stop());
|
||||
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
|
||||
SuccessOrExit(error = instance.Get<MeshCoP::BorderAgent>().Start());
|
||||
#endif
|
||||
|
||||
exit:
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otCommissionerAddJoiner(otInstance *aInstance, const otExtAddress *aEui64, const char *aPSKd, uint32_t aTimeout)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error =
|
||||
instance.Get<MeshCoP::Commissioner>().AddJoiner(static_cast<const Mac::ExtAddress *>(aEui64), aPSKd, aTimeout);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aEui64);
|
||||
OT_UNUSED_VARIABLE(aPSKd);
|
||||
OT_UNUSED_VARIABLE(aTimeout);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
return instance.Get<MeshCoP::Commissioner>().AddJoiner(static_cast<const Mac::ExtAddress *>(aEui64), aPSKd,
|
||||
aTimeout);
|
||||
}
|
||||
|
||||
otError otCommissionerRemoveJoiner(otInstance *aInstance, const otExtAddress *aEui64)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.Get<MeshCoP::Commissioner>().RemoveJoiner(static_cast<const Mac::ExtAddress *>(aEui64), 0);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aEui64);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
return instance.Get<MeshCoP::Commissioner>().RemoveJoiner(static_cast<const Mac::ExtAddress *>(aEui64), 0);
|
||||
}
|
||||
|
||||
otError otCommissionerSetProvisioningUrl(otInstance *aInstance, const char *aProvisioningUrl)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.Get<MeshCoP::Commissioner>().SetProvisioningUrl(aProvisioningUrl);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aProvisioningUrl);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
return instance.Get<MeshCoP::Commissioner>().SetProvisioningUrl(aProvisioningUrl);
|
||||
}
|
||||
|
||||
const char *otCommissionerGetProvisioningUrl(otInstance *aInstance, uint16_t *aLength)
|
||||
{
|
||||
const char *url = NULL;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
if (aLength != NULL)
|
||||
{
|
||||
url = instance.Get<MeshCoP::Commissioner>().GetProvisioningUrl(*aLength);
|
||||
}
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aLength);
|
||||
#endif
|
||||
|
||||
return url;
|
||||
}
|
||||
@@ -160,22 +115,10 @@ otError otCommissionerAnnounceBegin(otInstance * aInstance,
|
||||
uint16_t aPeriod,
|
||||
const otIp6Address *aAddress)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.Get<MeshCoP::Commissioner>().GetAnnounceBeginClient().SendRequest(
|
||||
return instance.Get<MeshCoP::Commissioner>().GetAnnounceBeginClient().SendRequest(
|
||||
aChannelMask, aCount, aPeriod, *static_cast<const Ip6::Address *>(aAddress));
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aChannelMask);
|
||||
OT_UNUSED_VARIABLE(aCount);
|
||||
OT_UNUSED_VARIABLE(aPeriod);
|
||||
OT_UNUSED_VARIABLE(aAddress);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otCommissionerEnergyScan(otInstance * aInstance,
|
||||
@@ -187,26 +130,11 @@ otError otCommissionerEnergyScan(otInstance * aInstance,
|
||||
otCommissionerEnergyReportCallback aCallback,
|
||||
void * aContext)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.Get<MeshCoP::Commissioner>().GetEnergyScanClient().SendQuery(
|
||||
return instance.Get<MeshCoP::Commissioner>().GetEnergyScanClient().SendQuery(
|
||||
aChannelMask, aCount, aPeriod, aScanDuration, *static_cast<const Ip6::Address *>(aAddress), aCallback,
|
||||
aContext);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aChannelMask);
|
||||
OT_UNUSED_VARIABLE(aCount);
|
||||
OT_UNUSED_VARIABLE(aPeriod);
|
||||
OT_UNUSED_VARIABLE(aScanDuration);
|
||||
OT_UNUSED_VARIABLE(aAddress);
|
||||
OT_UNUSED_VARIABLE(aCallback);
|
||||
OT_UNUSED_VARIABLE(aContext);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otCommissionerPanIdQuery(otInstance * aInstance,
|
||||
@@ -216,40 +144,17 @@ otError otCommissionerPanIdQuery(otInstance * aInstance,
|
||||
otCommissionerPanIdConflictCallback aCallback,
|
||||
void * aContext)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.Get<MeshCoP::Commissioner>().GetPanIdQueryClient().SendQuery(
|
||||
return instance.Get<MeshCoP::Commissioner>().GetPanIdQueryClient().SendQuery(
|
||||
aPanId, aChannelMask, *static_cast<const Ip6::Address *>(aAddress), aCallback, aContext);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aPanId);
|
||||
OT_UNUSED_VARIABLE(aChannelMask);
|
||||
OT_UNUSED_VARIABLE(aAddress);
|
||||
OT_UNUSED_VARIABLE(aCallback);
|
||||
OT_UNUSED_VARIABLE(aContext);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otCommissionerSendMgmtGet(otInstance *aInstance, const uint8_t *aTlvs, uint8_t aLength)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.Get<MeshCoP::Commissioner>().SendMgmtCommissionerGetRequest(aTlvs, aLength);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aTlvs);
|
||||
OT_UNUSED_VARIABLE(aLength);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
return instance.Get<MeshCoP::Commissioner>().SendMgmtCommissionerGetRequest(aTlvs, aLength);
|
||||
}
|
||||
|
||||
otError otCommissionerSendMgmtSet(otInstance * aInstance,
|
||||
@@ -257,50 +162,23 @@ otError otCommissionerSendMgmtSet(otInstance * aInstance,
|
||||
const uint8_t * aTlvs,
|
||||
uint8_t aLength)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.Get<MeshCoP::Commissioner>().SendMgmtCommissionerSetRequest(*aDataset, aTlvs, aLength);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aDataset);
|
||||
OT_UNUSED_VARIABLE(aTlvs);
|
||||
OT_UNUSED_VARIABLE(aLength);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
return instance.Get<MeshCoP::Commissioner>().SendMgmtCommissionerSetRequest(*aDataset, aTlvs, aLength);
|
||||
}
|
||||
|
||||
uint16_t otCommissionerGetSessionId(otInstance *aInstance)
|
||||
{
|
||||
uint16_t sessionId = 0;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
sessionId = instance.Get<MeshCoP::Commissioner>().GetSessionId();
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
#endif
|
||||
|
||||
return sessionId;
|
||||
return instance.Get<MeshCoP::Commissioner>().GetSessionId();
|
||||
}
|
||||
|
||||
otCommissionerState otCommissionerGetState(otInstance *aInstance)
|
||||
{
|
||||
otCommissionerState state = OT_COMMISSIONER_STATE_DISABLED;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
state = instance.Get<MeshCoP::Commissioner>().GetState();
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
#endif
|
||||
|
||||
return state;
|
||||
return instance.Get<MeshCoP::Commissioner>().GetState();
|
||||
}
|
||||
|
||||
otError otCommissionerGeneratePSKc(otInstance * aInstance,
|
||||
@@ -311,18 +189,7 @@ otError otCommissionerGeneratePSKc(otInstance * aInstance,
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
error = MeshCoP::Commissioner::GeneratePSKc(aPassPhrase, aNetworkName,
|
||||
*static_cast<const Mac::ExtendedPanId *>(aExtPanId), aPSKc);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aPassPhrase);
|
||||
OT_UNUSED_VARIABLE(aNetworkName);
|
||||
OT_UNUSED_VARIABLE(aExtPanId);
|
||||
OT_UNUSED_VARIABLE(aPSKc);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
return MeshCoP::Commissioner::GeneratePSKc(aPassPhrase, aNetworkName,
|
||||
*static_cast<const Mac::ExtendedPanId *>(aExtPanId), aPSKc);
|
||||
}
|
||||
#endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
|
||||
@@ -53,54 +53,38 @@ bool otDatasetIsCommissioned(otInstance *aInstance)
|
||||
|
||||
otError otDatasetGetActive(otInstance *aInstance, otOperationalDataset *aDataset)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aDataset != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aDataset != NULL);
|
||||
|
||||
error = instance.Get<MeshCoP::ActiveDataset>().Read(*aDataset);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<MeshCoP::ActiveDataset>().Read(*aDataset);
|
||||
}
|
||||
|
||||
otError otDatasetSetActive(otInstance *aInstance, const otOperationalDataset *aDataset)
|
||||
{
|
||||
otError error;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aDataset != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aDataset != NULL);
|
||||
|
||||
error = instance.Get<MeshCoP::ActiveDataset>().Save(*aDataset);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<MeshCoP::ActiveDataset>().Save(*aDataset);
|
||||
}
|
||||
|
||||
otError otDatasetGetPending(otInstance *aInstance, otOperationalDataset *aDataset)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aDataset != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aDataset != NULL);
|
||||
|
||||
error = instance.Get<MeshCoP::PendingDataset>().Read(*aDataset);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<MeshCoP::PendingDataset>().Read(*aDataset);
|
||||
}
|
||||
|
||||
otError otDatasetSetPending(otInstance *aInstance, const otOperationalDataset *aDataset)
|
||||
{
|
||||
otError error;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aDataset != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aDataset != NULL);
|
||||
|
||||
error = instance.Get<MeshCoP::PendingDataset>().Save(*aDataset);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<MeshCoP::PendingDataset>().Save(*aDataset);
|
||||
}
|
||||
|
||||
otError otDatasetSendMgmtActiveGet(otInstance * aInstance,
|
||||
|
||||
@@ -237,14 +237,9 @@ otError otIp6AddressFromString(const char *aString, otIp6Address *aAddress)
|
||||
|
||||
uint8_t otIp6PrefixMatch(const otIp6Address *aFirst, const otIp6Address *aSecond)
|
||||
{
|
||||
uint8_t rval;
|
||||
assert(aFirst != NULL && aSecond != NULL);
|
||||
|
||||
VerifyOrExit(aFirst != NULL && aSecond != NULL, rval = 0);
|
||||
|
||||
rval = static_cast<const Ip6::Address *>(aFirst)->PrefixMatch(*static_cast<const Ip6::Address *>(aSecond));
|
||||
|
||||
exit:
|
||||
return rval;
|
||||
return static_cast<const Ip6::Address *>(aFirst)->PrefixMatch(*static_cast<const Ip6::Address *>(aSecond));
|
||||
}
|
||||
|
||||
bool otIp6IsAddressUnspecified(const otIp6Address *aAddress)
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
using namespace ot;
|
||||
|
||||
#if OPENTHREAD_CONFIG_JOINER_ENABLE
|
||||
otError otJoinerStart(otInstance * aInstance,
|
||||
const char * aPSKd,
|
||||
const char * aProvisioningUrl,
|
||||
@@ -50,72 +51,30 @@ otError otJoinerStart(otInstance * aInstance,
|
||||
otJoinerCallback aCallback,
|
||||
void * aContext)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
#if OPENTHREAD_CONFIG_JOINER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.Get<MeshCoP::Joiner>().Start(aPSKd, aProvisioningUrl, aVendorName, aVendorModel, aVendorSwVersion,
|
||||
aVendorData, aCallback, aContext);
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aPSKd);
|
||||
OT_UNUSED_VARIABLE(aProvisioningUrl);
|
||||
OT_UNUSED_VARIABLE(aVendorName);
|
||||
OT_UNUSED_VARIABLE(aVendorModel);
|
||||
OT_UNUSED_VARIABLE(aVendorSwVersion);
|
||||
OT_UNUSED_VARIABLE(aVendorData);
|
||||
OT_UNUSED_VARIABLE(aCallback);
|
||||
OT_UNUSED_VARIABLE(aContext);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
return instance.Get<MeshCoP::Joiner>().Start(aPSKd, aProvisioningUrl, aVendorName, aVendorModel, aVendorSwVersion,
|
||||
aVendorData, aCallback, aContext);
|
||||
}
|
||||
|
||||
otError otJoinerStop(otInstance *aInstance)
|
||||
void otJoinerStop(otInstance *aInstance)
|
||||
{
|
||||
otError error;
|
||||
|
||||
#if OPENTHREAD_CONFIG_JOINER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
instance.Get<MeshCoP::Joiner>().Stop();
|
||||
error = OT_ERROR_NONE;
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
error = OT_ERROR_DISABLED_FEATURE;
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
otJoinerState otJoinerGetState(otInstance *aInstance)
|
||||
{
|
||||
otJoinerState state = OT_JOINER_STATE_IDLE;
|
||||
|
||||
#if OPENTHREAD_CONFIG_JOINER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
state = instance.Get<MeshCoP::Joiner>().GetState();
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
#endif
|
||||
|
||||
return state;
|
||||
return instance.Get<MeshCoP::Joiner>().GetState();
|
||||
}
|
||||
|
||||
otError otJoinerGetId(otInstance *aInstance, otExtAddress *aJoinerId)
|
||||
void otJoinerGetId(otInstance *aInstance, otExtAddress *aJoinerId)
|
||||
{
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#if OPENTHREAD_CONFIG_JOINER_ENABLE
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
instance.Get<MeshCoP::Joiner>().GetJoinerId(*static_cast<Mac::ExtAddress *>(aJoinerId));
|
||||
error = OT_ERROR_NONE;
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aJoinerId);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_JOINER_ENABLE
|
||||
|
||||
@@ -119,7 +119,7 @@ otError otLinkSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExt
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aExtAddress != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aExtAddress != NULL);
|
||||
VerifyOrExit(instance.Get<Mle::MleRouter>().GetRole() == OT_DEVICE_ROLE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
instance.Get<Mac::Mac>().SetExtAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
|
||||
@@ -205,28 +205,20 @@ otError otLinkFilterSetAddressMode(otInstance *aInstance, otMacFilterAddressMode
|
||||
|
||||
otError otLinkFilterAddAddress(otInstance *aInstance, const otExtAddress *aExtAddress)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aExtAddress != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aExtAddress != NULL);
|
||||
|
||||
error = instance.Get<Mac::Filter>().AddAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<Mac::Filter>().AddAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
|
||||
}
|
||||
|
||||
otError otLinkFilterRemoveAddress(otInstance *aInstance, const otExtAddress *aExtAddress)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aExtAddress != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aExtAddress != NULL);
|
||||
|
||||
error = instance.Get<Mac::Filter>().RemoveAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<Mac::Filter>().RemoveAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
|
||||
}
|
||||
|
||||
void otLinkFilterClearAddresses(otInstance *aInstance)
|
||||
@@ -238,15 +230,11 @@ void otLinkFilterClearAddresses(otInstance *aInstance)
|
||||
|
||||
otError otLinkFilterGetNextAddress(otInstance *aInstance, otMacFilterIterator *aIterator, otMacFilterEntry *aEntry)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aIterator != NULL && aEntry != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aIterator != NULL && aEntry != NULL);
|
||||
|
||||
error = instance.Get<Mac::Filter>().GetNextAddress(*aIterator, *aEntry);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<Mac::Filter>().GetNextAddress(*aIterator, *aEntry);
|
||||
}
|
||||
|
||||
otError otLinkFilterAddRssIn(otInstance *aInstance, const otExtAddress *aExtAddress, int8_t aRss)
|
||||
@@ -272,15 +260,11 @@ void otLinkFilterClearRssIn(otInstance *aInstance)
|
||||
|
||||
otError otLinkFilterGetNextRssIn(otInstance *aInstance, otMacFilterIterator *aIterator, otMacFilterEntry *aEntry)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aIterator != NULL && aEntry != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aIterator != NULL && aEntry != NULL);
|
||||
|
||||
error = instance.Get<Mac::Filter>().GetNextRssIn(*aIterator, *aEntry);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<Mac::Filter>().GetNextRssIn(*aIterator, *aEntry);
|
||||
}
|
||||
|
||||
uint8_t otLinkConvertRssToLinkQuality(otInstance *aInstance, int8_t aRss)
|
||||
|
||||
@@ -40,30 +40,17 @@
|
||||
using namespace ot;
|
||||
|
||||
otLogLevel otLoggingGetLevel(void)
|
||||
{
|
||||
#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL && !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
|
||||
{
|
||||
return Instance::Get().GetLogLevel();
|
||||
}
|
||||
#else
|
||||
{
|
||||
return static_cast<otLogLevel>(OPENTHREAD_CONFIG_LOG_LEVEL);
|
||||
}
|
||||
#endif
|
||||
|
||||
otError otLoggingSetLevel(otLogLevel aLogLevel)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aLogLevel);
|
||||
|
||||
otError error = OT_ERROR_DISABLED_FEATURE;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL
|
||||
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
|
||||
#warning "Dynamic log level is not supported along with multiple OT instance feature"
|
||||
#else
|
||||
void otLoggingSetLevel(otLogLevel aLogLevel)
|
||||
{
|
||||
Instance::Get().SetLogLevel(aLogLevel);
|
||||
error = OT_ERROR_NONE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -42,15 +42,11 @@ using namespace ot;
|
||||
|
||||
otError otNetDataGet(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aData != NULL && aDataLength != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aData != NULL && aDataLength != NULL);
|
||||
|
||||
error = instance.Get<NetworkData::Leader>().GetNetworkData(aStable, aData, *aDataLength);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<NetworkData::Leader>().GetNetworkData(aStable, aData, *aDataLength);
|
||||
}
|
||||
|
||||
otError otNetDataGetNextOnMeshPrefix(otInstance * aInstance,
|
||||
|
||||
@@ -44,15 +44,11 @@ using namespace ot;
|
||||
|
||||
otError otServerGetNetDataLocal(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aData != NULL && aDataLength != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aData != NULL && aDataLength != NULL);
|
||||
|
||||
error = instance.Get<NetworkData::Local>().GetNetworkData(aStable, aData, *aDataLength);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<NetworkData::Local>().GetNetworkData(aStable, aData, *aDataLength);
|
||||
}
|
||||
|
||||
otError otServerAddService(otInstance *aInstance, const otServiceConfig *aConfig)
|
||||
|
||||
+27
-37
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <openthread/thread.h>
|
||||
|
||||
#include "common/debug.hpp"
|
||||
#include "common/instance.hpp"
|
||||
#include "common/locator-getters.hpp"
|
||||
#include "common/logging.hpp"
|
||||
@@ -42,6 +43,7 @@
|
||||
|
||||
using namespace ot;
|
||||
|
||||
#if OPENTHREAD_FTD || OPENTHREAD_MTD
|
||||
uint32_t otThreadGetChildTimeout(otInstance *aInstance)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
@@ -88,15 +90,11 @@ exit:
|
||||
|
||||
otError otThreadGetLeaderRloc(otInstance *aInstance, otIp6Address *aLeaderRloc)
|
||||
{
|
||||
otError error;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aLeaderRloc != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aLeaderRloc != NULL);
|
||||
|
||||
error = instance.Get<Mle::MleRouter>().GetLeaderAddress(*static_cast<Ip6::Address *>(aLeaderRloc));
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<Mle::MleRouter>().GetLeaderAddress(*static_cast<Ip6::Address *>(aLeaderRloc));
|
||||
}
|
||||
|
||||
otLinkModeConfig otThreadGetLinkMode(otInstance *aInstance)
|
||||
@@ -128,7 +126,8 @@ otError otThreadSetMasterKey(otInstance *aInstance, const otMasterKey *aKey)
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aKey != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aKey != NULL);
|
||||
|
||||
VerifyOrExit(instance.Get<Mle::MleRouter>().GetRole() == OT_DEVICE_ROLE_DISABLED, error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
error = instance.Get<KeyManager>().SetMasterKey(*static_cast<const MasterKey *>(aKey));
|
||||
@@ -248,15 +247,11 @@ otError otThreadBecomeChild(otInstance *aInstance)
|
||||
|
||||
otError otThreadGetNextNeighborInfo(otInstance *aInstance, otNeighborInfoIterator *aIterator, otNeighborInfo *aInfo)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit((aInfo != NULL) && (aIterator != NULL), error = OT_ERROR_INVALID_ARGS);
|
||||
assert((aInfo != NULL) && (aIterator != NULL));
|
||||
|
||||
error = instance.Get<Mle::MleRouter>().GetNextNeighborInfo(*aIterator, *aInfo);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<Mle::MleRouter>().GetNextNeighborInfo(*aIterator, *aInfo);
|
||||
}
|
||||
|
||||
otDeviceRole otThreadGetDeviceRole(otInstance *aInstance)
|
||||
@@ -268,15 +263,11 @@ otDeviceRole otThreadGetDeviceRole(otInstance *aInstance)
|
||||
|
||||
otError otThreadGetLeaderData(otInstance *aInstance, otLeaderData *aLeaderData)
|
||||
{
|
||||
otError error;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aLeaderData != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aLeaderData != NULL);
|
||||
|
||||
error = instance.Get<Mle::MleRouter>().GetLeaderData(*aLeaderData);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<Mle::MleRouter>().GetLeaderData(*aLeaderData);
|
||||
}
|
||||
|
||||
uint8_t otThreadGetLeaderRouterId(otInstance *aInstance)
|
||||
@@ -309,13 +300,19 @@ uint16_t otThreadGetRloc16(otInstance *aInstance)
|
||||
|
||||
otError otThreadGetParentInfo(otInstance *aInstance, otRouterInfo *aParentInfo)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
otError error = OT_ERROR_NONE;
|
||||
Router * parent;
|
||||
|
||||
VerifyOrExit(aParentInfo != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aParentInfo != NULL);
|
||||
|
||||
// Reference device needs get the original parent's info even after the node state changed.
|
||||
#if !OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
|
||||
VerifyOrExit(instance.Get<Mle::MleRouter>().GetRole() == OT_DEVICE_ROLE_CHILD, error = OT_ERROR_INVALID_STATE);
|
||||
#endif
|
||||
|
||||
parent = instance.Get<Mle::MleRouter>().GetParent();
|
||||
|
||||
parent = instance.Get<Mle::MleRouter>().GetParent();
|
||||
aParentInfo->mExtAddress = parent->GetExtAddress();
|
||||
aParentInfo->mRloc16 = parent->GetRloc16();
|
||||
aParentInfo->mRouterId = Mle::Mle::GetRouterId(parent->GetRloc16());
|
||||
@@ -327,7 +324,9 @@ otError otThreadGetParentInfo(otInstance *aInstance, otRouterInfo *aParentInfo)
|
||||
aParentInfo->mAllocated = true;
|
||||
aParentInfo->mLinkEstablished = parent->GetState() == Neighbor::kStateValid;
|
||||
|
||||
#if !OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
|
||||
exit:
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -337,7 +336,7 @@ otError otThreadGetParentAverageRssi(otInstance *aInstance, int8_t *aParentRssi)
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
Router * parent;
|
||||
|
||||
VerifyOrExit(aParentRssi != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aParentRssi != NULL);
|
||||
|
||||
parent = instance.Get<Mle::MleRouter>().GetParent();
|
||||
*aParentRssi = parent->GetLinkInfo().GetAverageRss();
|
||||
@@ -354,7 +353,7 @@ otError otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi)
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
Router * parent;
|
||||
|
||||
VerifyOrExit(aLastRssi != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aLastRssi != NULL);
|
||||
|
||||
parent = instance.Get<Mle::MleRouter>().GetParent();
|
||||
*aLastRssi = parent->GetLinkInfo().GetLastRss();
|
||||
@@ -464,21 +463,12 @@ void otThreadResetMleCounters(otInstance *aInstance)
|
||||
instance.Get<Mle::MleRouter>().ResetCounters();
|
||||
}
|
||||
|
||||
otError otThreadRegisterParentResponseCallback(otInstance * aInstance,
|
||||
otThreadParentResponseCallback aCallback,
|
||||
void * aContext)
|
||||
void otThreadRegisterParentResponseCallback(otInstance * aInstance,
|
||||
otThreadParentResponseCallback aCallback,
|
||||
void * aContext)
|
||||
{
|
||||
#if OPENTHREAD_FTD || OPENTHREAD_MTD
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
instance.Get<Mle::MleRouter>().RegisterParentResponseStatsCallback(aCallback, aContext);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aCallback);
|
||||
OT_UNUSED_VARIABLE(aContext);
|
||||
|
||||
return OT_ERROR_DISABLED_FEATURE;
|
||||
#endif
|
||||
}
|
||||
#endif // OPENTHREAD_FTD || OPENTHREAD_MTD
|
||||
|
||||
@@ -239,28 +239,20 @@ void otThreadSetRouterSelectionJitter(otInstance *aInstance, uint8_t aRouterJitt
|
||||
|
||||
otError otThreadGetChildInfoById(otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aChildInfo != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aChildInfo != NULL);
|
||||
|
||||
error = instance.Get<Mle::MleRouter>().GetChildInfoById(aChildId, *aChildInfo);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<Mle::MleRouter>().GetChildInfoById(aChildId, *aChildInfo);
|
||||
}
|
||||
|
||||
otError otThreadGetChildInfoByIndex(otInstance *aInstance, uint16_t aChildIndex, otChildInfo *aChildInfo)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aChildInfo != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aChildInfo != NULL);
|
||||
|
||||
error = instance.Get<Mle::MleRouter>().GetChildInfoByIndex(aChildIndex, *aChildInfo);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<Mle::MleRouter>().GetChildInfoByIndex(aChildIndex, *aChildInfo);
|
||||
}
|
||||
|
||||
otError otThreadGetChildNextIp6Address(otInstance * aInstance,
|
||||
@@ -273,7 +265,7 @@ otError otThreadGetChildNextIp6Address(otInstance * aInstance,
|
||||
Child::Ip6AddressIterator iterator;
|
||||
Ip6::Address * address;
|
||||
|
||||
VerifyOrExit(aIterator != NULL && aAddress != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aIterator != NULL && aAddress != NULL);
|
||||
|
||||
address = static_cast<Ip6::Address *>(aAddress);
|
||||
iterator.Set(*aIterator);
|
||||
@@ -301,46 +293,29 @@ uint8_t otThreadGetMaxRouterId(otInstance *aInstance)
|
||||
|
||||
otError otThreadGetRouterInfo(otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aRouterInfo != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
assert(aRouterInfo != NULL);
|
||||
|
||||
error = instance.Get<RouterTable>().GetRouterInfo(aRouterId, *aRouterInfo);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return instance.Get<RouterTable>().GetRouterInfo(aRouterId, *aRouterInfo);
|
||||
}
|
||||
|
||||
otError otThreadGetEidCacheEntry(otInstance *aInstance, uint8_t aIndex, otEidCacheEntry *aEntry)
|
||||
{
|
||||
otError error;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
VerifyOrExit(aEntry != NULL, error = OT_ERROR_INVALID_ARGS);
|
||||
error = instance.Get<AddressResolver>().GetEntry(aIndex, *aEntry);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
assert(aEntry != NULL);
|
||||
return instance.Get<AddressResolver>().GetEntry(aIndex, *aEntry);
|
||||
}
|
||||
|
||||
otError otThreadSetSteeringData(otInstance *aInstance, const otExtAddress *aExtAddress)
|
||||
{
|
||||
otError error;
|
||||
|
||||
#if OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE
|
||||
void otThreadSetSteeringData(otInstance *aInstance, const otExtAddress *aExtAddress)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
error = instance.Get<Mle::MleRouter>().SetSteeringData(static_cast<const Mac::ExtAddress *>(aExtAddress));
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aExtAddress);
|
||||
|
||||
error = OT_ERROR_DISABLED_FEATURE;
|
||||
#endif
|
||||
|
||||
return error;
|
||||
instance.Get<Mle::MleRouter>().SetSteeringData(static_cast<const Mac::ExtAddress *>(aExtAddress));
|
||||
}
|
||||
#endif
|
||||
|
||||
const otPSKc *otThreadGetPSKc(otInstance *aInstance)
|
||||
{
|
||||
|
||||
@@ -118,30 +118,20 @@ otError CoapSecure::SetPsk(const uint8_t *aPsk, uint8_t aPskLength)
|
||||
#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
|
||||
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
otError CoapSecure::SetCertificate(const uint8_t *aX509Cert,
|
||||
uint32_t aX509Length,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength)
|
||||
void CoapSecure::SetCertificate(const uint8_t *aX509Cert,
|
||||
uint32_t aX509Length,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength)
|
||||
{
|
||||
return mDtls.SetCertificate(aX509Cert, aX509Length, aPrivateKey, aPrivateKeyLength);
|
||||
mDtls.SetCertificate(aX509Cert, aX509Length, aPrivateKey, aPrivateKeyLength);
|
||||
}
|
||||
|
||||
otError CoapSecure::SetCaCertificateChain(const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength)
|
||||
void CoapSecure::SetCaCertificateChain(const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength)
|
||||
{
|
||||
return mDtls.SetCaCertificateChain(aX509CaCertificateChain, aX509CaCertChainLength);
|
||||
mDtls.SetCaCertificateChain(aX509CaCertificateChain, aX509CaCertChainLength);
|
||||
}
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
otError CoapSecure::SetPreSharedKey(const uint8_t *aPsk,
|
||||
uint16_t aPskLength,
|
||||
const uint8_t *aPskIdentity,
|
||||
uint16_t aPskIdLength)
|
||||
{
|
||||
return mDtls.SetPreSharedKey(aPsk, aPskLength, aPskIdentity, aPskIdLength);
|
||||
}
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
|
||||
#ifdef MBEDTLS_BASE64_C
|
||||
otError CoapSecure::GetPeerCertificateBase64(unsigned char *aPeerCert, size_t *aCertLength, size_t aCertBufferSize)
|
||||
{
|
||||
|
||||
@@ -173,13 +173,11 @@ public:
|
||||
* @param[in] aPskIdentity The Identity Name for the PSK.
|
||||
* @param[in] aPskIdLength The PSK Identity Length.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the PSK.
|
||||
*
|
||||
*/
|
||||
otError SetPreSharedKey(const uint8_t *aPsk,
|
||||
uint16_t aPskLength,
|
||||
const uint8_t *aPskIdentity,
|
||||
uint16_t aPskIdLength);
|
||||
void SetPreSharedKey(const uint8_t *aPsk, uint16_t aPskLength, const uint8_t *aPskIdentity, uint16_t aPskIdLength)
|
||||
{
|
||||
mDtls.SetPreSharedKey(aPsk, aPskLength, aPskIdentity, aPskIdLength);
|
||||
}
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
@@ -193,13 +191,11 @@ public:
|
||||
* @param[in] aPrivateKey A pointer to the PEM formatted private key.
|
||||
* @param[in] aPrivateKeyLength The length of the private key.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the x509 certificate with his private key.
|
||||
*
|
||||
*/
|
||||
otError SetCertificate(const uint8_t *aX509Cert,
|
||||
uint32_t aX509Length,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength);
|
||||
void SetCertificate(const uint8_t *aX509Cert,
|
||||
uint32_t aX509Length,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength);
|
||||
|
||||
/**
|
||||
* This method sets the trusted top level CAs. It is needed for validate the
|
||||
@@ -210,10 +206,8 @@ public:
|
||||
* @param[in] aX509CaCertificateChain A pointer to the PEM formatted X509 CA chain.
|
||||
* @param[in] aX509CaCertChainLength The length of chain.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the trusted top level CAs.
|
||||
*
|
||||
*/
|
||||
otError SetCaCertificateChain(const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength);
|
||||
void SetCaCertificateChain(const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength);
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
#ifdef MBEDTLS_BASE64_C
|
||||
|
||||
@@ -290,10 +290,6 @@ const char *otThreadErrorToString(otError aError)
|
||||
retval = "NonLowpanDataFrame";
|
||||
break;
|
||||
|
||||
case OT_ERROR_DISABLED_FEATURE:
|
||||
retval = "DisabledFeature";
|
||||
break;
|
||||
|
||||
case OT_ERROR_GENERIC:
|
||||
retval = "GenericError";
|
||||
break;
|
||||
|
||||
@@ -42,6 +42,12 @@
|
||||
#error "OPENTHREAD_ENABLE_DHCP6_MULTICAST_SOLICIT requires OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE to be also set."
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
|
||||
#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL
|
||||
#error "Dynamic log level is not supported along with multiple OT instance feature"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Removed or replaced OPENTHREAD_CONFIG options.
|
||||
*
|
||||
|
||||
@@ -451,13 +451,11 @@ exit:
|
||||
#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
otError Dtls::SetCertificate(const uint8_t *aX509Certificate,
|
||||
uint32_t aX509CertLength,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength)
|
||||
void Dtls::SetCertificate(const uint8_t *aX509Certificate,
|
||||
uint32_t aX509CertLength,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
assert(aX509CertLength > 0);
|
||||
assert(aX509Certificate != NULL);
|
||||
|
||||
@@ -471,34 +469,23 @@ otError Dtls::SetCertificate(const uint8_t *aX509Certificate,
|
||||
|
||||
mCipherSuites[0] = MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8;
|
||||
mCipherSuites[1] = 0;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
otError Dtls::SetCaCertificateChain(const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength)
|
||||
void Dtls::SetCaCertificateChain(const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
assert(aX509CaCertChainLength > 0);
|
||||
assert(aX509CaCertificateChain != NULL);
|
||||
|
||||
mCaChainSrc = aX509CaCertificateChain;
|
||||
mCaChainLength = aX509CaCertChainLength;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
|
||||
otError Dtls::SetPreSharedKey(const uint8_t *aPsk,
|
||||
uint16_t aPskLength,
|
||||
const uint8_t *aPskIdentity,
|
||||
uint16_t aPskIdLength)
|
||||
void Dtls::SetPreSharedKey(const uint8_t *aPsk, uint16_t aPskLength, const uint8_t *aPskIdentity, uint16_t aPskIdLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
assert(aPsk != NULL);
|
||||
assert(aPskIdentity != NULL);
|
||||
assert(aPskLength > 0);
|
||||
@@ -511,8 +498,6 @@ otError Dtls::SetPreSharedKey(const uint8_t *aPsk,
|
||||
|
||||
mCipherSuites[0] = MBEDTLS_TLS_PSK_WITH_AES_128_CCM_8;
|
||||
mCipherSuites[1] = 0;
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
|
||||
|
||||
@@ -263,15 +263,11 @@ public:
|
||||
* @retval OT_ERROR_NONE Successfully set the PSK.
|
||||
*
|
||||
*/
|
||||
otError SetPreSharedKey(const uint8_t *aPsk,
|
||||
uint16_t aPskLength,
|
||||
const uint8_t *aPskIdentity,
|
||||
uint16_t aPskIdLength);
|
||||
void SetPreSharedKey(const uint8_t *aPsk, uint16_t aPskLength, const uint8_t *aPskIdentity, uint16_t aPskIdLength);
|
||||
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
|
||||
|
||||
#ifdef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
/**
|
||||
* This method sets a reference to the own x509 certificate with corresponding private key.
|
||||
*
|
||||
@@ -282,13 +278,11 @@ public:
|
||||
* @param[in] aPrivateKey A pointer to the PEM formatted private key.
|
||||
* @param[in] aPrivateKeyLength The length of the private key.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the x509 certificate with his private key.
|
||||
*
|
||||
*/
|
||||
otError SetCertificate(const uint8_t *aX509Certificate,
|
||||
uint32_t aX509CertLength,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength);
|
||||
void SetCertificate(const uint8_t *aX509Certificate,
|
||||
uint32_t aX509CertLength,
|
||||
const uint8_t *aPrivateKey,
|
||||
uint32_t aPrivateKeyLength);
|
||||
|
||||
/**
|
||||
* This method sets the trusted top level CAs. It is needed for validate the
|
||||
@@ -299,11 +293,8 @@ public:
|
||||
* @param[in] aX509CaCertificateChain A pointer to the PEM formatted X509 CA chain.
|
||||
* @param[in] aX509CaCertChainLength The length of chain.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the trusted top level CAs.
|
||||
*
|
||||
*/
|
||||
otError SetCaCertificateChain(const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength);
|
||||
|
||||
void SetCaCertificateChain(const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength);
|
||||
#endif // MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
#ifdef MBEDTLS_BASE64_C
|
||||
@@ -316,8 +307,9 @@ public:
|
||||
* @param[out] aCertLength The length of the base64 encoded peer certificate.
|
||||
* @param[in] aCertBufferSize The buffer size of aPeerCert.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully get the peer certificate.
|
||||
* @retval OT_ERROR_NO_BUFS Can't allocate memory for certificate.
|
||||
* @retval OT_ERROR_INVALID_STATE Not connected yet.
|
||||
* @retval OT_ERROR_NONE Successfully get the peer certificate.
|
||||
* @retval OT_ERROR_NO_BUFS Can't allocate memory for certificate.
|
||||
*
|
||||
*/
|
||||
otError GetPeerCertificateBase64(unsigned char *aPeerCert, size_t *aCertLength, size_t aCertBufferSize);
|
||||
|
||||
@@ -114,7 +114,7 @@ exit:
|
||||
otError KeyManager::SetMasterKey(const MasterKey &aKey)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Router *routers;
|
||||
Router *parent;
|
||||
|
||||
VerifyOrExit(mMasterKey != aKey, Get<Notifier>().SignalIfFirst(OT_CHANGED_MASTER_KEY));
|
||||
|
||||
@@ -123,10 +123,10 @@ otError KeyManager::SetMasterKey(const MasterKey &aKey)
|
||||
ComputeKey(mKeySequence, mKey);
|
||||
|
||||
// reset parent frame counters
|
||||
routers = Get<Mle::MleRouter>().GetParent();
|
||||
routers->SetKeySequence(0);
|
||||
routers->SetLinkFrameCounter(0);
|
||||
routers->SetMleFrameCounter(0);
|
||||
parent = Get<Mle::MleRouter>().GetParent();
|
||||
parent->SetKeySequence(0);
|
||||
parent->SetLinkFrameCounter(0);
|
||||
parent->SetMleFrameCounter(0);
|
||||
|
||||
// reset router frame counters
|
||||
for (RouterTable::Iterator iter(GetInstance()); !iter.IsDone(); iter++)
|
||||
|
||||
@@ -2601,9 +2601,8 @@ exit:
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE
|
||||
otError MleRouter::SetSteeringData(const Mac::ExtAddress *aExtAddress)
|
||||
void MleRouter::SetSteeringData(const Mac::ExtAddress *aExtAddress)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Mac::ExtAddress nullExtAddr;
|
||||
Mac::ExtAddress allowAnyExtAddr;
|
||||
|
||||
@@ -2632,8 +2631,6 @@ otError MleRouter::SetSteeringData(const Mac::ExtAddress *aExtAddress)
|
||||
// compute Bloom Filter
|
||||
mSteeringData.ComputeBloomFilter(joinerId);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE
|
||||
|
||||
|
||||
@@ -548,10 +548,8 @@ public:
|
||||
* All 0xFFs sets steering data to 0xFF
|
||||
* Anything else is used to compute the bloom filter
|
||||
*
|
||||
* @retval OT_ERROR_NONE Steering data was set
|
||||
*
|
||||
*/
|
||||
otError SetSteeringData(const Mac::ExtAddress *aExtAddress);
|
||||
void SetSteeringData(const Mac::ExtAddress *aExtAddress);
|
||||
#endif // OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE
|
||||
|
||||
/**
|
||||
|
||||
@@ -385,15 +385,6 @@ exit:
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
#else // OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE
|
||||
|
||||
otError ChannelManager::RequestChannelSelect(bool)
|
||||
{
|
||||
otLogInfoUtil("ChannelManager: ChannelMonitor feature is disabled - cannot select channel");
|
||||
return OT_ERROR_DISABLED_FEATURE;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE
|
||||
|
||||
void ChannelManager::StartAutoSelectTimer(void)
|
||||
|
||||
@@ -155,7 +155,6 @@ public:
|
||||
* @retval OT_ERROR_NONE Channel selection finished successfully.
|
||||
* @retval OT_ERROR_NOT_FOUND Supported channels is empty, therefore could not select a channel.
|
||||
* @retval OT_ERROR_INVALID_STATE Thread is not enabled or not enough data to select new channel.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE `ChannelMonitor` feature is disabled by build-time configuration options.
|
||||
*
|
||||
*/
|
||||
otError RequestChannelSelect(bool aSkipQualityCheck);
|
||||
|
||||
+8
-25
@@ -132,10 +132,6 @@ spinel_status_t NcpBase::ThreadErrorToSpinelStatus(otError aError)
|
||||
ret = SPINEL_STATUS_ITEM_NOT_FOUND;
|
||||
break;
|
||||
|
||||
case OT_ERROR_DISABLED_FEATURE:
|
||||
ret = SPINEL_STATUS_INVALID_COMMAND_FOR_PROP;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Unknown error code. Wrap it as a Spinel status and return that.
|
||||
ret = static_cast<spinel_status_t>(SPINEL_STATUS_STACK_NATIVE__BEGIN + static_cast<uint32_t>(aError));
|
||||
@@ -1939,11 +1935,6 @@ template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MCU_POWER_STATE>(void
|
||||
return mEncoder.WriteUint8(SPINEL_MCU_POWER_STATE_ON);
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MCU_POWER_STATE>(void)
|
||||
{
|
||||
return OT_ERROR_DISABLED_FEATURE;
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_POWER_STATE>(void)
|
||||
@@ -2139,11 +2130,12 @@ template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_DEBUG_NCP_LOG_LEVEL>(
|
||||
return mEncoder.WriteUint8(ConvertLogLevel(otLoggingGetLevel()));
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_DEBUG_NCP_LOG_LEVEL>(void)
|
||||
{
|
||||
otError error;
|
||||
uint8_t spinelNcpLogLevel = 0;
|
||||
otLogLevel logLevel;
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(spinelNcpLogLevel));
|
||||
|
||||
@@ -2180,11 +2172,12 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_DEBUG_NCP_LOG_LEVEL>(
|
||||
break;
|
||||
}
|
||||
|
||||
error = otLoggingSetLevel(logLevel);
|
||||
otLoggingSetLevel(logLevel);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_PHY_CHAN_SUPPORTED>(void)
|
||||
{
|
||||
@@ -2253,28 +2246,18 @@ exit:
|
||||
// MARK: Peek/Poke delegate API
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
otError otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate,
|
||||
otNcpDelegateAllowPeekPoke aAllowPokeDelegate)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aAllowPeekDelegate);
|
||||
OT_UNUSED_VARIABLE(aAllowPokeDelegate);
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
#if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
|
||||
void otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate,
|
||||
otNcpDelegateAllowPeekPoke aAllowPokeDelegate)
|
||||
{
|
||||
ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance();
|
||||
|
||||
if (ncp != NULL)
|
||||
{
|
||||
ncp->RegisterPeekPokeDelagates(aAllowPeekDelegate, aAllowPokeDelegate);
|
||||
}
|
||||
#else
|
||||
error = OT_ERROR_DISABLED_FEATURE;
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
|
||||
|
||||
return error;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MARK: Virtual Datastream I/O (Public API)
|
||||
|
||||
@@ -121,9 +121,6 @@ public:
|
||||
* @param[in] aAllowPeekDelegate Delegate function pointer for peek operation.
|
||||
* @param[in] aAllowPokeDelegate Delegate function pointer for poke operation.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully registered delegate functions.
|
||||
* @retval OT_ERROR_DISABLED_FEATURE Peek/Poke feature is disabled (by a build-time configuration option).
|
||||
*
|
||||
*/
|
||||
void RegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate,
|
||||
otNcpDelegateAllowPeekPoke aAllowPokeDelegate);
|
||||
|
||||
@@ -682,9 +682,11 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey)
|
||||
case SPINEL_PROP_POWER_STATE:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_POWER_STATE>;
|
||||
break;
|
||||
#if OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL
|
||||
case SPINEL_PROP_MCU_POWER_STATE:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_MCU_POWER_STATE>;
|
||||
break;
|
||||
#endif
|
||||
case SPINEL_PROP_UNSOL_UPDATE_FILTER:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_UNSOL_UPDATE_FILTER>;
|
||||
break;
|
||||
@@ -805,9 +807,11 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey)
|
||||
case SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING>;
|
||||
break;
|
||||
#if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL
|
||||
case SPINEL_PROP_DEBUG_NCP_LOG_LEVEL:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_DEBUG_NCP_LOG_LEVEL>;
|
||||
break;
|
||||
#endif
|
||||
case SPINEL_PROP_THREAD_DISCOVERY_SCAN_JOINER_FLAG:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_DISCOVERY_SCAN_JOINER_FLAG>;
|
||||
break;
|
||||
@@ -969,9 +973,11 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey)
|
||||
case SPINEL_PROP_CHANNEL_MANAGER_FAVORED_CHANNELS:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_CHANNEL_MANAGER_FAVORED_CHANNELS>;
|
||||
break;
|
||||
#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE
|
||||
case SPINEL_PROP_CHANNEL_MANAGER_CHANNEL_SELECT:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_CHANNEL_MANAGER_CHANNEL_SELECT>;
|
||||
break;
|
||||
#endif
|
||||
case SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_ENABLED:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_ENABLED>;
|
||||
break;
|
||||
|
||||
@@ -833,7 +833,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_STEERING_DATA>
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadEui64(mSteeringDataAddress));
|
||||
|
||||
SuccessOrExit(error = otThreadSetSteeringData(mInstance, &mSteeringDataAddress));
|
||||
otThreadSetSteeringData(mInstance, &mSteeringDataAddress);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
|
||||
@@ -1493,7 +1493,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MESHCOP_JOINER_COMMIS
|
||||
|
||||
if (action == false)
|
||||
{
|
||||
error = otJoinerStop(mInstance);
|
||||
otJoinerStop(mInstance);
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user