mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[dataset] update dataset SendMgmtGet APIs and add support in spinel/NCP (#2866)
This commit updates the APIs `otDatasetSendMgmtActiveGet` and `otDatasetSendMgmtPendingGet` to be similar to MgmtSet APIs and use an `otOperationalDatasetComponents` as input to specify the Dataset components to be requested. The implementation of APIs in `DatasetManager` and their use in in CLI is also updated. It also defines new spinel properties `MGMT_GET_ACTIVE_DATASET` and `THREAD_MGMT_GET_PENDING_DATASET` (with their set handlers) to add support for sending `MGMT_GET` meshcop command for Active/Pending Operational Dataset. It also renames the existing properties used for sending `MGMT_SET` (include `MGMT_SET` in the property name). It also adds a new property to allow an optional destination IPv6 address to be specified (for sending `MGMT_GET` command) as part of spinel dictionary representation of Dataset instance.
This commit is contained in:
committed by
Jonathan Hui
parent
7ba8f348dc
commit
758e647d91
@@ -424,7 +424,7 @@ following properties can also be included in the Pending Dataset:
|
||||
* SPINEL_PROP_DATASET_PENDING_TIMESTAMP
|
||||
* SPINEL_PROP_DATASET_DELAY_TIMER
|
||||
|
||||
### PROP 5402: SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET (#prop-thread-mgmt-active-dataset)
|
||||
### PROP 5402: SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET (#prop-thread-mgmt-set-active-dataset)
|
||||
|
||||
* Type: Write only
|
||||
* Packing-Encoding: `A(t(iD))`
|
||||
@@ -443,7 +443,7 @@ TLVs):
|
||||
|
||||
* SPINEL_PROP_DATASET_RAW_TLVS
|
||||
|
||||
### PROP 5403: SPINEL_PROP_THREAD_MGMT_PENDING_DATASET (#prop-thread-mgmt-pending-dataset)
|
||||
### PROP 5403: SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET (#prop-thread-mgmt-set-pending-dataset)
|
||||
|
||||
* Type: Write only
|
||||
* Packing-Encoding: `A(t(iD))`
|
||||
@@ -469,8 +469,10 @@ This can only be included in one of the Dataset related properties below:
|
||||
|
||||
* SPINEL_PROP_THREAD_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
|
||||
### PROP 5405: SPINEL_PROP_DATASET_PENDING_TIMESTAMP (#prop-dataset-pending-timestamps)
|
||||
|
||||
@@ -483,8 +485,8 @@ Dataset.
|
||||
It can only be included in one of the Pending Dataset properties:
|
||||
|
||||
* SPINEL_PROP_THREAD_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
|
||||
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
|
||||
### PROP 5406: SPINEL_PROP_DATASET_DELAY_TIMER (#prop-dataset-delay-timer)
|
||||
|
||||
@@ -499,7 +501,8 @@ Pending Operational Dataset.
|
||||
It can only be included in one of the Pending Dataset properties:
|
||||
|
||||
* SPINEL_PROP_THREAD_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
|
||||
### PROP 5407: SPINEL_PROP_DATASET_SECURITY_POLICY (#prop-dataset-security-policy)
|
||||
|
||||
@@ -518,8 +521,10 @@ It can only be included in one of the Dataset related properties below:
|
||||
|
||||
* SPINEL_PROP_THREAD_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
|
||||
### PROP 5408: SPINEL_PROP_DATASET_RAW_TLVS (#prop-dataset-raw-tlvs)
|
||||
|
||||
@@ -531,8 +536,8 @@ DataSet.
|
||||
|
||||
It can only be included in one of the following Dataset properties:
|
||||
|
||||
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
|
||||
|
||||
### PROP 5409: SPINEL_PROP_THREAD_CHILD_TABLE_ADDRESSES (#prop-thread-child-table-addresses)
|
||||
|
||||
@@ -596,3 +601,61 @@ This property helps exchange UDP packets with host.
|
||||
`S`: Remote UDP port
|
||||
`6`: Remote IPv6 address
|
||||
`S`: Local UDP port
|
||||
|
||||
### PROP 5413: SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET (#prop-thread-mgmt-get-active-dataset)
|
||||
|
||||
* Type: Write-Only
|
||||
* Packing-format: `A(t(iD))`
|
||||
|
||||
The formatting of this property follows the same rules as in
|
||||
SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET. This property
|
||||
allows the sender to not include a value associated with
|
||||
properties in formating of `t(iD)`, i.e., it should accept
|
||||
either a `t(iD)` or a `t(i)` encoding which in both cases
|
||||
indicate the associated Dataset property should be requested
|
||||
as part of MGMT_GET command.
|
||||
|
||||
When written, it triggers a MGMT_ACTIVE_GET meshcop command to be
|
||||
sent to leader with the given Dataset. The spinel frame response
|
||||
should be a `LAST_STATUS` with the status of the transmission
|
||||
of MGMT_ACTIVE_GET command.
|
||||
|
||||
In addition to supported properties in
|
||||
SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET, the following property
|
||||
can be optionally included in the Dataset:
|
||||
|
||||
* SPINEL_PROP_DATASET_DEST_ADDRESS
|
||||
|
||||
### PROP 5414: SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET (#prop-thread-mgmt-get-pending-dataset)
|
||||
|
||||
* Type: Write-Only
|
||||
* Packing-format: `A(t(iD))`
|
||||
|
||||
The formatting of this property follows the same rules as in
|
||||
SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET.
|
||||
|
||||
This is write-only property. When written, it triggers a
|
||||
MGMT_PENDING_GET meshcop command to be sent to leader with the
|
||||
given Dataset. The spinel frame response should be a
|
||||
`LAST_STATUS` with the status of the transmission of
|
||||
MGMT_PENDING_GET command.
|
||||
|
||||
In addition to supported properties in
|
||||
SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET, the following property
|
||||
can be optionally included the Dataset:
|
||||
|
||||
* SPINEL_PROP_DATASET_DEST_ADDRESS
|
||||
|
||||
### PROP 5415: SPINEL_PROP_DATASET_DEST_ADDRESS (#prop-dataset-dest-address)
|
||||
|
||||
* Type: No direct read or write
|
||||
* Packing-Encoding: `6`
|
||||
|
||||
This property specifies the IPv6 destination when sending
|
||||
MGMT_GET command for either Active or Pending Dataset if not
|
||||
provided, Leader ALOC address is used as default.
|
||||
|
||||
This can only be included in one of the Dataset related properties below:
|
||||
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
|
||||
@@ -2287,13 +2287,14 @@ OTAPI
|
||||
otError
|
||||
OTCALL
|
||||
otDatasetSendMgmtActiveGet(
|
||||
_In_ otInstance *aInstance,
|
||||
_In_ otInstance *aInstance,
|
||||
const otOperationalDatasetComponents *aDatasetComponents,
|
||||
const uint8_t *aTlvTypes,
|
||||
uint8_t aLength,
|
||||
_In_opt_ const otIp6Address *aAddress
|
||||
)
|
||||
{
|
||||
if (aInstance == nullptr) return OT_ERROR_INVALID_ARGS;
|
||||
if (aInstance == nullptr || aDatasetComponents == nullptr) return OT_ERROR_INVALID_ARGS;
|
||||
if (aTlvTypes == nullptr && aLength != 0) return OT_ERROR_INVALID_ARGS;
|
||||
|
||||
DWORD BufferSize = sizeof(GUID) + sizeof(uint8_t) + aLength;
|
||||
@@ -2302,6 +2303,7 @@ otDatasetSendMgmtActiveGet(
|
||||
if (Buffer == nullptr) return OT_ERROR_NO_BUFS;
|
||||
|
||||
memcpy_s(Buffer, BufferSize, &aInstance->InterfaceGuid, sizeof(GUID));
|
||||
memcpy_s(Buffer + sizeof(GUID), BufferSize - sizeof(GUID), aDatasetComponents, sizeof(otOperationalDatasetComponents));
|
||||
memcpy_s(Buffer + sizeof(GUID), BufferSize - sizeof(GUID), &aLength, sizeof(aLength));
|
||||
if (aLength > 0)
|
||||
memcpy_s(Buffer + sizeof(GUID) + sizeof(uint8_t), BufferSize - sizeof(GUID) - sizeof(uint8_t), aTlvTypes, aLength);
|
||||
@@ -2320,7 +2322,7 @@ otError
|
||||
OTCALL
|
||||
otDatasetSendMgmtActiveSet(
|
||||
_In_ otInstance *aInstance,
|
||||
const otOperationalDataset *aDataset,
|
||||
const otOperationalDataset *aDataset,
|
||||
const uint8_t *aTlvs,
|
||||
uint8_t aLength
|
||||
)
|
||||
@@ -2349,13 +2351,14 @@ OTAPI
|
||||
otError
|
||||
OTCALL
|
||||
otDatasetSendMgmtPendingGet(
|
||||
_In_ otInstance *aInstance,
|
||||
_In_ otInstance *aInstance,
|
||||
const otOperationalDatasetComponents *aDatasetComponents,
|
||||
const uint8_t *aTlvTypes,
|
||||
uint8_t aLength,
|
||||
_In_opt_ const otIp6Address *aAddress
|
||||
)
|
||||
{
|
||||
if (aInstance == nullptr) return OT_ERROR_INVALID_ARGS;
|
||||
if (aInstance == nullptr || aDatasetComponents == nullptr) return OT_ERROR_INVALID_ARGS;
|
||||
if (aTlvTypes == nullptr && aLength != 0) return OT_ERROR_INVALID_ARGS;
|
||||
|
||||
DWORD BufferSize = sizeof(GUID) + sizeof(uint8_t) + aLength;
|
||||
@@ -2364,6 +2367,7 @@ otDatasetSendMgmtPendingGet(
|
||||
if (Buffer == nullptr) return OT_ERROR_NO_BUFS;
|
||||
|
||||
memcpy_s(Buffer, BufferSize, &aInstance->InterfaceGuid, sizeof(GUID));
|
||||
memcpy_s(Buffer + sizeof(GUID), BufferSize - sizeof(GUID), aDatasetComponents, sizeof(otOperationalDatasetComponents));
|
||||
memcpy_s(Buffer + sizeof(GUID), BufferSize - sizeof(GUID), &aLength, sizeof(aLength));
|
||||
if (aLength > 0)
|
||||
memcpy_s(Buffer + sizeof(GUID) + sizeof(uint8_t), BufferSize - sizeof(GUID) - sizeof(uint8_t), aTlvTypes, aLength);
|
||||
|
||||
@@ -5918,20 +5918,22 @@ otLwfIoCtl_otSendActiveGet(
|
||||
*OutBufferLength = 0;
|
||||
UNREFERENCED_PARAMETER(OutBuffer);
|
||||
|
||||
if (InBufferLength >= sizeof(uint8_t))
|
||||
if (InBufferLength >= sizeof(otOperationalDatasetComponents) + sizeof(uint8_t))
|
||||
{
|
||||
uint8_t aLength = *(uint8_t*)InBuffer;
|
||||
PUCHAR aTlvTypes = aLength == 0 ? NULL : InBuffer + sizeof(uint8_t);
|
||||
const otOperationalDatasetComponents *aDatasetComp = (otOperationalDatasetComponents*)InBuffer;
|
||||
uint8_t aLength = *(uint8_t*)(InBuffer + sizeof(otOperationalDatasetComponents));
|
||||
PUCHAR aTlvTypes = aLength == 0 ? NULL : InBuffer + sizeof(otOperationalDatasetComponents) + sizeof(uint8_t);
|
||||
|
||||
if (InBufferLength >= sizeof(uint8_t) + aLength)
|
||||
if (InBufferLength >= sizeof(otOperationalDatasetComponents) + sizeof(uint8_t) + aLength)
|
||||
{
|
||||
otIp6Address *aAddress = NULL;
|
||||
if (InBufferLength >= sizeof(uint8_t) + aLength + sizeof(otIp6Address))
|
||||
aAddress = (otIp6Address*)(InBuffer + sizeof(uint8_t) + aLength);
|
||||
if (InBufferLength >= sizeof(otOperationalDatasetComponents) + sizeof(uint8_t) + aLength + sizeof(otIp6Address))
|
||||
aAddress = (otIp6Address*)(InBuffer + sizeof(otOperationalDatasetComponents) + sizeof(uint8_t) + aLength);
|
||||
|
||||
status = ThreadErrorToNtstatus(
|
||||
otDatasetSendMgmtActiveGet(
|
||||
pFilter->otCtx,
|
||||
aDatasetComp,
|
||||
aTlvTypes,
|
||||
aLength,
|
||||
aAddress)
|
||||
@@ -5997,20 +5999,22 @@ otLwfIoCtl_otSendPendingGet(
|
||||
*OutBufferLength = 0;
|
||||
UNREFERENCED_PARAMETER(OutBuffer);
|
||||
|
||||
if (InBufferLength >= sizeof(uint8_t))
|
||||
if (InBufferLength >= sizeof(otOperationalDataset) + sizeof(uint8_t))
|
||||
{
|
||||
uint8_t aLength = *(uint8_t*)InBuffer;
|
||||
PUCHAR aTlvTypes = aLength == 0 ? NULL : InBuffer + sizeof(uint8_t);
|
||||
const otOperationalDatasetComponents *aDatasetComp = (otOperationalDatasetComponents*)InBuffer;
|
||||
uint8_t aLength = *(uint8_t*)(InBuffer + sizeof(otOperationalDataset));
|
||||
PUCHAR aTlvTypes = aLength == 0 ? NULL : InBuffer + sizeof(otOperationalDataset) + sizeof(uint8_t);
|
||||
|
||||
if (InBufferLength >= sizeof(uint8_t) + aLength)
|
||||
if (InBufferLength >= sizeof(otOperationalDatasetComponents) + sizeof(uint8_t) + aLength)
|
||||
{
|
||||
otIp6Address *aAddress = NULL;
|
||||
if (InBufferLength >= sizeof(uint8_t) + aLength + sizeof(otIp6Address))
|
||||
aAddress = (otIp6Address*)(InBuffer + sizeof(uint8_t) + aLength);
|
||||
if (InBufferLength >= sizeof(otOperationalDatasetComponents) + sizeof(uint8_t) + aLength + sizeof(otIp6Address))
|
||||
aAddress = (otIp6Address*)(InBuffer + sizeof(otOperationalDataset) + sizeof(uint8_t) + aLength);
|
||||
|
||||
status = ThreadErrorToNtstatus(
|
||||
otDatasetSendMgmtPendingGet(
|
||||
pFilter->otCtx,
|
||||
aDatasetComp,
|
||||
aTlvTypes,
|
||||
aLength,
|
||||
aAddress)
|
||||
|
||||
@@ -1976,24 +1976,24 @@ OTNODEAPI int32_t OTCALL otNodeSetActiveDataset(otNode* aNode, uint64_t aTimesta
|
||||
otOperationalDataset aDataset = {};
|
||||
|
||||
aDataset.mActiveTimestamp = aTimestamp;
|
||||
aDataset.mIsActiveTimestampSet = true;
|
||||
aDataset.mComponents.mIsActiveTimestampPresent = true;
|
||||
|
||||
if (aPanId != 0)
|
||||
{
|
||||
aDataset.mPanId = aPanId;
|
||||
aDataset.mIsPanIdSet = true;
|
||||
aDataset.mComponents.mIsPanIdPresent = true;
|
||||
}
|
||||
|
||||
if (aChannel != 0)
|
||||
{
|
||||
aDataset.mChannel = aChannel;
|
||||
aDataset.mIsChannelSet = true;
|
||||
aDataset.mComponents.mIsChannelPresent = true;
|
||||
}
|
||||
|
||||
if (aChannelMask != 0)
|
||||
{
|
||||
aDataset.mChannelMaskPage0 = aChannelMask;
|
||||
aDataset.mIsChannelMaskPage0Set = true;
|
||||
aDataset.mComponents.mIsChannelMaskPage0Present = true;
|
||||
}
|
||||
|
||||
if (aMasterKey != NULL && strlen(aMasterKey) != 0)
|
||||
@@ -2004,7 +2004,7 @@ OTNODEAPI int32_t OTCALL otNodeSetActiveDataset(otNode* aNode, uint64_t aTimesta
|
||||
printf("invalid length key %d\r\n", keyLength);
|
||||
return OT_ERROR_PARSE;
|
||||
}
|
||||
aDataset.mIsMasterKeySet = true;
|
||||
aDataset.mComponents.mIsMasterKeyPresent = true;
|
||||
}
|
||||
|
||||
auto result = otDatasetSetActive(aNode->mInstance, &aDataset);
|
||||
@@ -2022,25 +2022,25 @@ OTNODEAPI int32_t OTCALL otNodeSetPendingDataset(otNode* aNode, uint64_t aActive
|
||||
if (aActiveTimestamp != 0)
|
||||
{
|
||||
aDataset.mActiveTimestamp = aActiveTimestamp;
|
||||
aDataset.mIsActiveTimestampSet = true;
|
||||
aDataset.mComponents.mIsActiveTimestampPresent = true;
|
||||
}
|
||||
|
||||
if (aPendingTimestamp != 0)
|
||||
{
|
||||
aDataset.mPendingTimestamp = aPendingTimestamp;
|
||||
aDataset.mIsPendingTimestampSet = true;
|
||||
aDataset.mComponents.mIsPendingTimestampPresent = true;
|
||||
}
|
||||
|
||||
if (aPanId != 0)
|
||||
{
|
||||
aDataset.mPanId = aPanId;
|
||||
aDataset.mIsPanIdSet = true;
|
||||
aDataset.mComponents.mIsPanIdPresent = true;
|
||||
}
|
||||
|
||||
if (aChannel != 0)
|
||||
{
|
||||
aDataset.mChannel = aChannel;
|
||||
aDataset.mIsChannelSet = true;
|
||||
aDataset.mComponents.mIsChannelPresent = true;
|
||||
}
|
||||
|
||||
auto result = otDatasetSetPending(aNode->mInstance, &aDataset);
|
||||
@@ -2058,31 +2058,31 @@ OTNODEAPI int32_t OTCALL otNodeSendPendingSet(otNode* aNode, uint64_t aActiveTim
|
||||
if (aActiveTimestamp != 0)
|
||||
{
|
||||
aDataset.mActiveTimestamp = aActiveTimestamp;
|
||||
aDataset.mIsActiveTimestampSet = true;
|
||||
aDataset.mComponents.mIsActiveTimestampPresent = true;
|
||||
}
|
||||
|
||||
if (aPendingTimestamp != 0)
|
||||
{
|
||||
aDataset.mPendingTimestamp = aPendingTimestamp;
|
||||
aDataset.mIsPendingTimestampSet = true;
|
||||
aDataset.mComponents.mIsPendingTimestampPresent = true;
|
||||
}
|
||||
|
||||
if (aDelayTimer != 0)
|
||||
{
|
||||
aDataset.mDelay = aDelayTimer;
|
||||
aDataset.mIsDelaySet = true;
|
||||
aDataset.mComponents.mIsDelayPresent = true;
|
||||
}
|
||||
|
||||
if (aPanId != 0)
|
||||
{
|
||||
aDataset.mPanId = aPanId;
|
||||
aDataset.mIsPanIdSet = true;
|
||||
aDataset.mComponents.mIsPanIdPresent = true;
|
||||
}
|
||||
|
||||
if (aChannel != 0)
|
||||
{
|
||||
aDataset.mChannel = aChannel;
|
||||
aDataset.mIsChannelSet = true;
|
||||
aDataset.mComponents.mIsChannelPresent = true;
|
||||
}
|
||||
|
||||
if (aMasterKey != NULL && strlen(aMasterKey) != 0)
|
||||
@@ -2093,7 +2093,7 @@ OTNODEAPI int32_t OTCALL otNodeSendPendingSet(otNode* aNode, uint64_t aActiveTim
|
||||
printf("invalid length key %d\r\n", keyLength);
|
||||
return OT_ERROR_PARSE;
|
||||
}
|
||||
aDataset.mIsMasterKeySet = true;
|
||||
aDataset.mComponents.mIsMasterKeyPresent = true;
|
||||
}
|
||||
|
||||
if (aMeshLocal != NULL && strlen(aMeshLocal) != 0)
|
||||
@@ -2102,13 +2102,13 @@ OTNODEAPI int32_t OTCALL otNodeSendPendingSet(otNode* aNode, uint64_t aActiveTim
|
||||
auto error = otIp6AddressFromString(aMeshLocal, &prefix);
|
||||
if (error != OT_ERROR_NONE) return error;
|
||||
memcpy(aDataset.mMeshLocalPrefix.m8, prefix.mFields.m8, sizeof(aDataset.mMeshLocalPrefix.m8));
|
||||
aDataset.mIsMeshLocalPrefixSet = true;
|
||||
aDataset.mComponents.mIsMeshLocalPrefixPresent = true;
|
||||
}
|
||||
|
||||
if (aNetworkName != NULL && strlen(aNetworkName) != 0)
|
||||
{
|
||||
strcpy_s(aDataset.mNetworkName.m8, sizeof(aDataset.mNetworkName.m8), aNetworkName);
|
||||
aDataset.mIsNetworkNameSet = true;
|
||||
aDataset.mComponents.mIsNetworkNamePresent = true;
|
||||
}
|
||||
|
||||
auto result = otDatasetSendMgmtPendingSet(aNode->mInstance, &aDataset, nullptr, 0);
|
||||
@@ -2128,24 +2128,24 @@ OTNODEAPI int32_t OTCALL otNodeSendActiveSet(otNode* aNode, uint64_t aActiveTime
|
||||
if (aActiveTimestamp != 0)
|
||||
{
|
||||
aDataset.mActiveTimestamp = aActiveTimestamp;
|
||||
aDataset.mIsActiveTimestampSet = true;
|
||||
aDataset.mComponents.mIsActiveTimestampPresent = true;
|
||||
}
|
||||
if (aPanId != 0)
|
||||
{
|
||||
aDataset.mPanId = aPanId;
|
||||
aDataset.mIsPanIdSet = true;
|
||||
aDataset.mComponents.mIsPanIdPresent = true;
|
||||
}
|
||||
|
||||
if (aChannel != 0)
|
||||
{
|
||||
aDataset.mChannel = aChannel;
|
||||
aDataset.mIsChannelSet = true;
|
||||
aDataset.mComponents.mIsChannelPresent = true;
|
||||
}
|
||||
|
||||
if (aChannelMask != 0)
|
||||
{
|
||||
aDataset.mChannelMaskPage0 = aChannelMask;
|
||||
aDataset.mIsChannelMaskPage0Set = true;
|
||||
aDataset.mComponents.mIsChannelMaskPage0Present = true;
|
||||
}
|
||||
|
||||
if (aExtPanId != NULL && strlen(aExtPanId) != 0)
|
||||
@@ -2156,7 +2156,7 @@ OTNODEAPI int32_t OTCALL otNodeSendActiveSet(otNode* aNode, uint64_t aActiveTime
|
||||
printf("invalid length ext pan id %d\r\n", keyLength);
|
||||
return OT_ERROR_PARSE;
|
||||
}
|
||||
aDataset.mIsExtendedPanIdSet = true;
|
||||
aDataset.mComponents.mIsExtendedPanIdPresent = true;
|
||||
}
|
||||
|
||||
if (aMasterKey != NULL && strlen(aMasterKey) != 0)
|
||||
@@ -2167,7 +2167,7 @@ OTNODEAPI int32_t OTCALL otNodeSendActiveSet(otNode* aNode, uint64_t aActiveTime
|
||||
printf("invalid length key %d\r\n", keyLength);
|
||||
return OT_ERROR_PARSE;
|
||||
}
|
||||
aDataset.mIsMasterKeySet = true;
|
||||
aDataset.mComponents.mIsMasterKeyPresent = true;
|
||||
}
|
||||
|
||||
if (aMeshLocal != NULL && strlen(aMeshLocal) != 0)
|
||||
@@ -2176,13 +2176,13 @@ OTNODEAPI int32_t OTCALL otNodeSendActiveSet(otNode* aNode, uint64_t aActiveTime
|
||||
auto error = otIp6AddressFromString(aMeshLocal, &prefix);
|
||||
if (error != OT_ERROR_NONE) return error;
|
||||
memcpy(aDataset.mMeshLocalPrefix.m8, prefix.mFields.m8, sizeof(aDataset.mMeshLocalPrefix.m8));
|
||||
aDataset.mIsMeshLocalPrefixSet = true;
|
||||
aDataset.mComponents.mIsMeshLocalPrefixPresent = true;
|
||||
}
|
||||
|
||||
if (aNetworkName != NULL && strlen(aNetworkName) != 0)
|
||||
{
|
||||
strcpy_s(aDataset.mNetworkName.m8, sizeof(aDataset.mNetworkName.m8), aNetworkName);
|
||||
aDataset.mIsNetworkNameSet = true;
|
||||
aDataset.mComponents.mIsNetworkNamePresent = true;
|
||||
}
|
||||
|
||||
if (aBinary != NULL && strlen(aBinary) != 0)
|
||||
|
||||
@@ -77,19 +77,21 @@ OTAPI otError OTCALL otDatasetSetPending(otInstance *aInstance, const otOperatio
|
||||
/**
|
||||
* This function sends MGMT_ACTIVE_GET.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aTlvTypes A pointer to the TLV Types.
|
||||
* @param[in] aLength The length of TLV Types.
|
||||
* @param[in] aAddress A pointer to the IPv6 destination, if it is NULL, will use Leader ALOC as default.
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDatasetComponents A pointer to a Dataset Components structure specifying which components to request.
|
||||
* @param[in] aTlvTypes A pointer to array containing additional raw TLV types to be requested.
|
||||
* @param[in] aLength The length of @p aTlvTypes.
|
||||
* @param[in] aAddress A pointer to the IPv6 destination, if it is NULL, will use Leader ALOC as default.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully send the meshcop dataset command.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffer space to send.
|
||||
*
|
||||
*/
|
||||
OTAPI otError OTCALL otDatasetSendMgmtActiveGet(otInstance * aInstance,
|
||||
const uint8_t * aTlvTypes,
|
||||
uint8_t aLength,
|
||||
const otIp6Address *aAddress);
|
||||
OTAPI otError OTCALL otDatasetSendMgmtActiveGet(otInstance * aInstance,
|
||||
const otOperationalDatasetComponents *aDatasetComponents,
|
||||
const uint8_t * aTlvTypes,
|
||||
uint8_t aLength,
|
||||
const otIp6Address * aAddress);
|
||||
|
||||
/**
|
||||
* This function sends MGMT_ACTIVE_SET.
|
||||
@@ -111,19 +113,21 @@ OTAPI otError OTCALL otDatasetSendMgmtActiveSet(otInstance * aIns
|
||||
/**
|
||||
* This function sends MGMT_PENDING_GET.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aTlvTypes A pointer to the TLV Types.
|
||||
* @param[in] aLength The length of TLV Types.
|
||||
* @param[in] aAddress A pointer to the IPv6 destination, if it is NULL, will use Leader ALOC as default.
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aDatasetComponents A pointer to a Dataset Components structure specifying which components to request.
|
||||
* @param[in] aTlvTypes A pointer to array containing additional raw TLV types to be requested.
|
||||
* @param[in] aLength The length of @p aTlvTypes.
|
||||
* @param[in] aAddress A pointer to the IPv6 destination, if it is NULL, will use Leader ALOC as default.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully send the meshcop dataset command.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffer space to send.
|
||||
*
|
||||
*/
|
||||
OTAPI otError OTCALL otDatasetSendMgmtPendingGet(otInstance * aInstance,
|
||||
const uint8_t * aTlvTypes,
|
||||
uint8_t aLength,
|
||||
const otIp6Address *aAddress);
|
||||
OTAPI otError OTCALL otDatasetSendMgmtPendingGet(otInstance * aInstance,
|
||||
const otOperationalDatasetComponents *aDatasetComponents,
|
||||
const uint8_t * aTlvTypes,
|
||||
uint8_t aLength,
|
||||
const otIp6Address * aAddress);
|
||||
|
||||
/**
|
||||
* This function sends MGMT_PENDING_SET.
|
||||
|
||||
+35
-25
@@ -549,37 +549,47 @@ typedef struct otEnergyScanResult
|
||||
int8_t mMaxRssi; ///< The max RSSI (dBm)
|
||||
} otEnergyScanResult;
|
||||
|
||||
/**
|
||||
* This structure represents presence of different components in Active or Pending Operational Dataset.
|
||||
*
|
||||
*/
|
||||
typedef struct otOperationalDatasetComponents
|
||||
{
|
||||
bool mIsActiveTimestampPresent : 1; ///< TRUE if Active Timestamp is present, FALSE otherwise.
|
||||
bool mIsPendingTimestampPresent : 1; ///< TRUE if Pending Timestamp is present, FALSE otherwise.
|
||||
bool mIsMasterKeyPresent : 1; ///< TRUE if Network Master Key is present, FALSE otherwise.
|
||||
bool mIsNetworkNamePresent : 1; ///< TRUE if Network Name is present, FALSE otherwise.
|
||||
bool mIsExtendedPanIdPresent : 1; ///< TRUE if Extended PAN ID is present, FALSE otherwise.
|
||||
bool mIsMeshLocalPrefixPresent : 1; ///< TRUE if Mesh Local Prefix is present, FALSE otherwise.
|
||||
bool mIsDelayPresent : 1; ///< TRUE if Delay Timer is present, FALSE otherwise.
|
||||
bool mIsPanIdPresent : 1; ///< TRUE if PAN ID is present, FALSE otherwise.
|
||||
bool mIsChannelPresent : 1; ///< TRUE if Channel is present, FALSE otherwise.
|
||||
bool mIsPSKcPresent : 1; ///< TRUE if PSKc is present, FALSE otherwise.
|
||||
bool mIsSecurityPolicyPresent : 1; ///< TRUE if Security Policy is present, FALSE otherwise.
|
||||
bool mIsChannelMaskPage0Present : 1; ///< TRUE if Channel Mask Page 0 is present, FALSE otherwise.
|
||||
} otOperationalDatasetComponents;
|
||||
|
||||
/**
|
||||
* This structure represents an Active or Pending Operational Dataset.
|
||||
*
|
||||
* Components in Dataset are optional. `mComponets` structure specifies which components are present in the Dataset.
|
||||
*
|
||||
*/
|
||||
typedef struct otOperationalDataset
|
||||
{
|
||||
uint64_t mActiveTimestamp; ///< Active Timestamp
|
||||
uint64_t mPendingTimestamp; ///< Pending Timestamp
|
||||
otMasterKey mMasterKey; ///< Network Master Key
|
||||
otNetworkName mNetworkName; ///< Network Name
|
||||
otExtendedPanId mExtendedPanId; ///< Extended PAN ID
|
||||
otMeshLocalPrefix mMeshLocalPrefix; ///< Mesh Local Prefix
|
||||
uint32_t mDelay; ///< Delay Timer
|
||||
otPanId mPanId; ///< PAN ID
|
||||
uint16_t mChannel; ///< Channel
|
||||
otPSKc mPSKc; ///< PSKc
|
||||
otSecurityPolicy mSecurityPolicy; ///< Security Policy
|
||||
otChannelMaskPage0 mChannelMaskPage0; ///< Channel Mask Page 0
|
||||
|
||||
bool mIsActiveTimestampSet : 1; ///< TRUE if Active Timestamp is set, FALSE otherwise.
|
||||
bool mIsPendingTimestampSet : 1; ///< TRUE if Pending Timestamp is set, FALSE otherwise.
|
||||
bool mIsMasterKeySet : 1; ///< TRUE if Network Master Key is set, FALSE otherwise.
|
||||
bool mIsNetworkNameSet : 1; ///< TRUE if Network Name is set, FALSE otherwise.
|
||||
bool mIsExtendedPanIdSet : 1; ///< TRUE if Extended PAN ID is set, FALSE otherwise.
|
||||
bool mIsMeshLocalPrefixSet : 1; ///< TRUE if Mesh Local Prefix is set, FALSE otherwise.
|
||||
bool mIsDelaySet : 1; ///< TRUE if Delay Timer is set, FALSE otherwise.
|
||||
bool mIsPanIdSet : 1; ///< TRUE if PAN ID is set, FALSE otherwise.
|
||||
bool mIsChannelSet : 1; ///< TRUE if Channel is set, FALSE otherwise.
|
||||
bool mIsPSKcSet : 1; ///< TRUE if PSKc is set, FALSE otherwise.
|
||||
bool mIsSecurityPolicySet : 1; ///< TRUE if Security Policy is set, FALSE otherwise.
|
||||
bool mIsChannelMaskPage0Set : 1; ///< TRUE if Channel Mask Page 0 is set, FALSE otherwise.
|
||||
uint64_t mActiveTimestamp; ///< Active Timestamp
|
||||
uint64_t mPendingTimestamp; ///< Pending Timestamp
|
||||
otMasterKey mMasterKey; ///< Network Master Key
|
||||
otNetworkName mNetworkName; ///< Network Name
|
||||
otExtendedPanId mExtendedPanId; ///< Extended PAN ID
|
||||
otMeshLocalPrefix mMeshLocalPrefix; ///< Mesh Local Prefix
|
||||
uint32_t mDelay; ///< Delay Timer
|
||||
otPanId mPanId; ///< PAN ID
|
||||
uint16_t mChannel; ///< Channel
|
||||
otPSKc mPSKc; ///< PSKc
|
||||
otSecurityPolicy mSecurityPolicy; ///< Security Policy
|
||||
otChannelMaskPage0 mChannelMaskPage0; ///< Channel Mask Page 0
|
||||
otOperationalDatasetComponents mComponents; ///< Specifies which components are set in the Dataset.
|
||||
} otOperationalDataset;
|
||||
|
||||
/**
|
||||
|
||||
+63
-61
@@ -87,39 +87,39 @@ void Dataset::OutputBytes(const uint8_t *aBytes, uint8_t aLength)
|
||||
|
||||
otError Dataset::Print(otOperationalDataset &aDataset)
|
||||
{
|
||||
if (aDataset.mIsPendingTimestampSet)
|
||||
if (aDataset.mComponents.mIsPendingTimestampPresent)
|
||||
{
|
||||
sServer->OutputFormat("Pending Timestamp: %d\r\n", aDataset.mPendingTimestamp);
|
||||
}
|
||||
|
||||
if (aDataset.mIsActiveTimestampSet)
|
||||
if (aDataset.mComponents.mIsActiveTimestampPresent)
|
||||
{
|
||||
sServer->OutputFormat("Active Timestamp: %d\r\n", aDataset.mActiveTimestamp);
|
||||
}
|
||||
|
||||
if (aDataset.mIsChannelSet)
|
||||
if (aDataset.mComponents.mIsChannelPresent)
|
||||
{
|
||||
sServer->OutputFormat("Channel: %d\r\n", aDataset.mChannel);
|
||||
}
|
||||
|
||||
if (aDataset.mIsChannelMaskPage0Set)
|
||||
if (aDataset.mComponents.mIsChannelMaskPage0Present)
|
||||
{
|
||||
sServer->OutputFormat("Channel Mask Page 0: %08x\r\n", aDataset.mChannelMaskPage0);
|
||||
}
|
||||
|
||||
if (aDataset.mIsDelaySet)
|
||||
if (aDataset.mComponents.mIsDelayPresent)
|
||||
{
|
||||
sServer->OutputFormat("Delay: %d\r\n", aDataset.mDelay);
|
||||
}
|
||||
|
||||
if (aDataset.mIsExtendedPanIdSet)
|
||||
if (aDataset.mComponents.mIsExtendedPanIdPresent)
|
||||
{
|
||||
sServer->OutputFormat("Ext PAN ID: ");
|
||||
OutputBytes(aDataset.mExtendedPanId.m8, sizeof(aDataset.mExtendedPanId));
|
||||
sServer->OutputFormat("\r\n");
|
||||
}
|
||||
|
||||
if (aDataset.mIsMeshLocalPrefixSet)
|
||||
if (aDataset.mComponents.mIsMeshLocalPrefixPresent)
|
||||
{
|
||||
const uint8_t *prefix = aDataset.mMeshLocalPrefix.m8;
|
||||
sServer->OutputFormat(
|
||||
@@ -128,32 +128,32 @@ otError Dataset::Print(otOperationalDataset &aDataset)
|
||||
(static_cast<uint16_t>(prefix[6]) << 8) | prefix[7]);
|
||||
}
|
||||
|
||||
if (aDataset.mIsMasterKeySet)
|
||||
if (aDataset.mComponents.mIsMasterKeyPresent)
|
||||
{
|
||||
sServer->OutputFormat("Master Key: ");
|
||||
OutputBytes(aDataset.mMasterKey.m8, sizeof(aDataset.mMasterKey));
|
||||
sServer->OutputFormat("\r\n");
|
||||
}
|
||||
|
||||
if (aDataset.mIsNetworkNameSet)
|
||||
if (aDataset.mComponents.mIsNetworkNamePresent)
|
||||
{
|
||||
sServer->OutputFormat("Network Name: ");
|
||||
sServer->OutputFormat("%.*s\r\n", sizeof(aDataset.mNetworkName), aDataset.mNetworkName.m8);
|
||||
}
|
||||
|
||||
if (aDataset.mIsPanIdSet)
|
||||
if (aDataset.mComponents.mIsPanIdPresent)
|
||||
{
|
||||
sServer->OutputFormat("PAN ID: 0x%04x\r\n", aDataset.mPanId);
|
||||
}
|
||||
|
||||
if (aDataset.mIsPSKcSet)
|
||||
if (aDataset.mComponents.mIsPSKcPresent)
|
||||
{
|
||||
sServer->OutputFormat("PSKc: ");
|
||||
OutputBytes(aDataset.mPSKc.m8, sizeof(aDataset.mPSKc.m8));
|
||||
sServer->OutputFormat("\r\n");
|
||||
}
|
||||
|
||||
if (aDataset.mIsSecurityPolicySet)
|
||||
if (aDataset.mComponents.mIsSecurityPolicyPresent)
|
||||
{
|
||||
sServer->OutputFormat("Security Policy: %d, ", aDataset.mSecurityPolicy.mRotationTime);
|
||||
|
||||
@@ -261,8 +261,8 @@ otError Dataset::ProcessActiveTimestamp(otInstance *aInstance, int argc, char *a
|
||||
|
||||
VerifyOrExit(argc > 0, error = OT_ERROR_INVALID_ARGS);
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[0], value));
|
||||
sDataset.mActiveTimestamp = static_cast<uint64_t>(value);
|
||||
sDataset.mIsActiveTimestampSet = true;
|
||||
sDataset.mActiveTimestamp = static_cast<uint64_t>(value);
|
||||
sDataset.mComponents.mIsActiveTimestampPresent = true;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -277,8 +277,8 @@ otError Dataset::ProcessChannel(otInstance *aInstance, int argc, char *argv[])
|
||||
|
||||
VerifyOrExit(argc > 0, error = OT_ERROR_INVALID_ARGS);
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[0], value));
|
||||
sDataset.mChannel = static_cast<uint16_t>(value);
|
||||
sDataset.mIsChannelSet = true;
|
||||
sDataset.mChannel = static_cast<uint16_t>(value);
|
||||
sDataset.mComponents.mIsChannelPresent = true;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -293,8 +293,8 @@ otError Dataset::ProcessChannelMask(otInstance *aInstance, int argc, char *argv[
|
||||
|
||||
VerifyOrExit(argc > 0, error = OT_ERROR_INVALID_ARGS);
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[0], value));
|
||||
sDataset.mChannelMaskPage0 = static_cast<uint32_t>(value);
|
||||
sDataset.mIsChannelMaskPage0Set = true;
|
||||
sDataset.mChannelMaskPage0 = static_cast<uint32_t>(value);
|
||||
sDataset.mComponents.mIsChannelMaskPage0Present = true;
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
exit:
|
||||
@@ -342,8 +342,8 @@ otError Dataset::ProcessDelay(otInstance *aInstance, int argc, char *argv[])
|
||||
|
||||
VerifyOrExit(argc > 0, error = OT_ERROR_INVALID_ARGS);
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[0], value));
|
||||
sDataset.mDelay = static_cast<uint32_t>(value);
|
||||
sDataset.mIsDelaySet = true;
|
||||
sDataset.mDelay = static_cast<uint32_t>(value);
|
||||
sDataset.mComponents.mIsDelayPresent = true;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -360,7 +360,7 @@ otError Dataset::ProcessExtPanId(otInstance *aInstance, int argc, char *argv[])
|
||||
VerifyOrExit(Interpreter::Hex2Bin(argv[0], extPanId, sizeof(extPanId)) >= 0, error = OT_ERROR_PARSE);
|
||||
|
||||
memcpy(sDataset.mExtendedPanId.m8, extPanId, sizeof(sDataset.mExtendedPanId));
|
||||
sDataset.mIsExtendedPanIdSet = true;
|
||||
sDataset.mComponents.mIsExtendedPanIdPresent = true;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -377,7 +377,7 @@ otError Dataset::ProcessMasterKey(otInstance *aInstance, int argc, char *argv[])
|
||||
VerifyOrExit((Interpreter::Hex2Bin(argv[0], key, sizeof(key))) == OT_MASTER_KEY_SIZE, error = OT_ERROR_PARSE);
|
||||
|
||||
memcpy(sDataset.mMasterKey.m8, key, sizeof(sDataset.mMasterKey));
|
||||
sDataset.mIsMasterKeySet = true;
|
||||
sDataset.mComponents.mIsMasterKeyPresent = true;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -394,7 +394,7 @@ otError Dataset::ProcessMeshLocalPrefix(otInstance *aInstance, int argc, char *a
|
||||
SuccessOrExit(error = otIp6AddressFromString(argv[0], &prefix));
|
||||
|
||||
memcpy(sDataset.mMeshLocalPrefix.m8, prefix.mFields.m8, sizeof(sDataset.mMeshLocalPrefix.m8));
|
||||
sDataset.mIsMeshLocalPrefixSet = true;
|
||||
sDataset.mComponents.mIsMeshLocalPrefixPresent = true;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -412,7 +412,7 @@ otError Dataset::ProcessNetworkName(otInstance *aInstance, int argc, char *argv[
|
||||
|
||||
memset(&sDataset.mNetworkName, 0, sizeof(sDataset.mNetworkName));
|
||||
memcpy(sDataset.mNetworkName.m8, argv[0], length);
|
||||
sDataset.mIsNetworkNameSet = true;
|
||||
sDataset.mComponents.mIsNetworkNamePresent = true;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -427,8 +427,8 @@ otError Dataset::ProcessPanId(otInstance *aInstance, int argc, char *argv[])
|
||||
|
||||
VerifyOrExit(argc > 0, error = OT_ERROR_INVALID_ARGS);
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[0], value));
|
||||
sDataset.mPanId = static_cast<otPanId>(value);
|
||||
sDataset.mIsPanIdSet = true;
|
||||
sDataset.mPanId = static_cast<otPanId>(value);
|
||||
sDataset.mComponents.mIsPanIdPresent = true;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -443,8 +443,8 @@ otError Dataset::ProcessPendingTimestamp(otInstance *aInstance, int argc, char *
|
||||
|
||||
VerifyOrExit(argc > 0, error = OT_ERROR_INVALID_ARGS);
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[0], value));
|
||||
sDataset.mPendingTimestamp = static_cast<uint64_t>(value);
|
||||
sDataset.mIsPendingTimestampSet = true;
|
||||
sDataset.mPendingTimestamp = static_cast<uint64_t>(value);
|
||||
sDataset.mComponents.mIsPendingTimestampPresent = true;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -470,21 +470,21 @@ otError Dataset::ProcessMgmtSetCommand(otInstance *aInstance, int argc, char *ar
|
||||
if (strcmp(argv[index], "activetimestamp") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = OT_ERROR_INVALID_ARGS);
|
||||
dataset.mIsActiveTimestampSet = true;
|
||||
dataset.mComponents.mIsActiveTimestampPresent = true;
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[++index], value));
|
||||
dataset.mActiveTimestamp = static_cast<uint64_t>(value);
|
||||
}
|
||||
else if (strcmp(argv[index], "pendingtimestamp") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = OT_ERROR_INVALID_ARGS);
|
||||
dataset.mIsPendingTimestampSet = true;
|
||||
dataset.mComponents.mIsPendingTimestampPresent = true;
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[++index], value));
|
||||
dataset.mPendingTimestamp = static_cast<uint64_t>(value);
|
||||
}
|
||||
else if (strcmp(argv[index], "masterkey") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = OT_ERROR_INVALID_ARGS);
|
||||
dataset.mIsMasterKeySet = true;
|
||||
dataset.mComponents.mIsMasterKeyPresent = true;
|
||||
VerifyOrExit((length = Interpreter::Hex2Bin(argv[++index], dataset.mMasterKey.m8,
|
||||
sizeof(dataset.mMasterKey.m8))) == OT_MASTER_KEY_SIZE,
|
||||
error = OT_ERROR_PARSE);
|
||||
@@ -493,7 +493,7 @@ otError Dataset::ProcessMgmtSetCommand(otInstance *aInstance, int argc, char *ar
|
||||
else if (strcmp(argv[index], "networkname") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = OT_ERROR_INVALID_ARGS);
|
||||
dataset.mIsNetworkNameSet = true;
|
||||
dataset.mComponents.mIsNetworkNamePresent = true;
|
||||
VerifyOrExit((length = static_cast<int>(strlen(argv[++index]))) <= OT_NETWORK_NAME_MAX_SIZE,
|
||||
error = OT_ERROR_PARSE);
|
||||
memset(&dataset.mNetworkName, 0, sizeof(sDataset.mNetworkName));
|
||||
@@ -503,7 +503,7 @@ otError Dataset::ProcessMgmtSetCommand(otInstance *aInstance, int argc, char *ar
|
||||
else if (strcmp(argv[index], "extpanid") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = OT_ERROR_INVALID_ARGS);
|
||||
dataset.mIsExtendedPanIdSet = true;
|
||||
dataset.mComponents.mIsExtendedPanIdPresent = true;
|
||||
VerifyOrExit(
|
||||
Interpreter::Hex2Bin(argv[++index], dataset.mExtendedPanId.m8, sizeof(dataset.mExtendedPanId.m8)) >= 0,
|
||||
error = OT_ERROR_PARSE);
|
||||
@@ -511,35 +511,35 @@ otError Dataset::ProcessMgmtSetCommand(otInstance *aInstance, int argc, char *ar
|
||||
else if (strcmp(argv[index], "localprefix") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = OT_ERROR_INVALID_ARGS);
|
||||
dataset.mIsMeshLocalPrefixSet = true;
|
||||
dataset.mComponents.mIsMeshLocalPrefixPresent = true;
|
||||
SuccessOrExit(error = otIp6AddressFromString(argv[++index], &prefix));
|
||||
memcpy(dataset.mMeshLocalPrefix.m8, prefix.mFields.m8, sizeof(dataset.mMeshLocalPrefix.m8));
|
||||
}
|
||||
else if (strcmp(argv[index], "delaytimer") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = OT_ERROR_INVALID_ARGS);
|
||||
dataset.mIsDelaySet = true;
|
||||
dataset.mComponents.mIsDelayPresent = true;
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[++index], value));
|
||||
dataset.mDelay = static_cast<uint32_t>(value);
|
||||
}
|
||||
else if (strcmp(argv[index], "panid") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = OT_ERROR_INVALID_ARGS);
|
||||
dataset.mIsPanIdSet = true;
|
||||
dataset.mComponents.mIsPanIdPresent = true;
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[++index], value));
|
||||
dataset.mPanId = static_cast<otPanId>(value);
|
||||
}
|
||||
else if (strcmp(argv[index], "channel") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = OT_ERROR_INVALID_ARGS);
|
||||
dataset.mIsChannelSet = true;
|
||||
dataset.mComponents.mIsChannelPresent = true;
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[++index], value));
|
||||
dataset.mChannel = static_cast<uint16_t>(value);
|
||||
}
|
||||
else if (strcmp(argv[index], "channelmask") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = OT_ERROR_INVALID_ARGS);
|
||||
dataset.mIsChannelMaskPage0Set = true;
|
||||
dataset.mComponents.mIsChannelMaskPage0Present = true;
|
||||
SuccessOrExit(error = Interpreter::ParseLong(argv[++index], value));
|
||||
dataset.mChannelMaskPage0 = static_cast<uint32_t>(value);
|
||||
}
|
||||
@@ -578,17 +578,17 @@ exit:
|
||||
|
||||
otError Dataset::ProcessMgmtGetCommand(otInstance *aInstance, int argc, char *argv[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
otOperationalDataset dataset;
|
||||
uint8_t tlvs[32];
|
||||
long value;
|
||||
int length = 0;
|
||||
bool destAddrSpecified = false;
|
||||
otIp6Address address;
|
||||
otError error = OT_ERROR_NONE;
|
||||
otOperationalDatasetComponents datasetComponents;
|
||||
uint8_t tlvs[32];
|
||||
long value;
|
||||
int length = 0;
|
||||
bool destAddrSpecified = false;
|
||||
otIp6Address address;
|
||||
|
||||
VerifyOrExit(argc > 0, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
memset(&dataset, 0, sizeof(dataset));
|
||||
memset(&datasetComponents, 0, sizeof(datasetComponents));
|
||||
|
||||
for (uint8_t index = 1; index < argc; index++)
|
||||
{
|
||||
@@ -596,39 +596,39 @@ otError Dataset::ProcessMgmtGetCommand(otInstance *aInstance, int argc, char *ar
|
||||
|
||||
if (strcmp(argv[index], "activetimestamp") == 0)
|
||||
{
|
||||
tlvs[length++] = OT_MESHCOP_TLV_ACTIVETIMESTAMP;
|
||||
datasetComponents.mIsActiveTimestampPresent = true;
|
||||
}
|
||||
else if (strcmp(argv[index], "pendingtimestamp") == 0)
|
||||
{
|
||||
tlvs[length++] = OT_MESHCOP_TLV_PENDINGTIMESTAMP;
|
||||
datasetComponents.mIsPendingTimestampPresent = true;
|
||||
}
|
||||
else if (strcmp(argv[index], "masterkey") == 0)
|
||||
{
|
||||
tlvs[length++] = OT_MESHCOP_TLV_MASTERKEY;
|
||||
datasetComponents.mIsMasterKeyPresent = true;
|
||||
}
|
||||
else if (strcmp(argv[index], "networkname") == 0)
|
||||
{
|
||||
tlvs[length++] = OT_MESHCOP_TLV_NETWORKNAME;
|
||||
datasetComponents.mIsNetworkNamePresent = true;
|
||||
}
|
||||
else if (strcmp(argv[index], "extpanid") == 0)
|
||||
{
|
||||
tlvs[length++] = OT_MESHCOP_TLV_EXTPANID;
|
||||
datasetComponents.mIsExtendedPanIdPresent = true;
|
||||
}
|
||||
else if (strcmp(argv[index], "localprefix") == 0)
|
||||
{
|
||||
tlvs[length++] = OT_MESHCOP_TLV_MESHLOCALPREFIX;
|
||||
datasetComponents.mIsMeshLocalPrefixPresent = true;
|
||||
}
|
||||
else if (strcmp(argv[index], "delaytimer") == 0)
|
||||
{
|
||||
tlvs[length++] = OT_MESHCOP_TLV_DELAYTIMER;
|
||||
datasetComponents.mIsDelayPresent = true;
|
||||
}
|
||||
else if (strcmp(argv[index], "panid") == 0)
|
||||
{
|
||||
tlvs[length++] = OT_MESHCOP_TLV_PANID;
|
||||
datasetComponents.mIsPanIdPresent = true;
|
||||
}
|
||||
else if (strcmp(argv[index], "channel") == 0)
|
||||
{
|
||||
tlvs[length++] = OT_MESHCOP_TLV_CHANNEL;
|
||||
datasetComponents.mIsChannelPresent = true;
|
||||
}
|
||||
else if (strcmp(argv[index], "binary") == 0)
|
||||
{
|
||||
@@ -654,13 +654,15 @@ otError Dataset::ProcessMgmtGetCommand(otInstance *aInstance, int argc, char *ar
|
||||
|
||||
if (strcmp(argv[0], "active") == 0)
|
||||
{
|
||||
SuccessOrExit(error = otDatasetSendMgmtActiveGet(aInstance, tlvs, static_cast<uint8_t>(length),
|
||||
destAddrSpecified ? &address : NULL));
|
||||
SuccessOrExit(error =
|
||||
otDatasetSendMgmtActiveGet(aInstance, &datasetComponents, tlvs, static_cast<uint8_t>(length),
|
||||
destAddrSpecified ? &address : NULL));
|
||||
}
|
||||
else if (strcmp(argv[0], "pending") == 0)
|
||||
{
|
||||
SuccessOrExit(error = otDatasetSendMgmtPendingGet(aInstance, tlvs, static_cast<uint8_t>(length),
|
||||
destAddrSpecified ? &address : NULL));
|
||||
SuccessOrExit(error =
|
||||
otDatasetSendMgmtPendingGet(aInstance, &datasetComponents, tlvs, static_cast<uint8_t>(length),
|
||||
destAddrSpecified ? &address : NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -684,7 +686,7 @@ otError Dataset::ProcessPSKc(otInstance *aInstance, int argc, char *argv[])
|
||||
VerifyOrExit(Interpreter::Hex2Bin(argv[0], sDataset.mPSKc.m8 + OT_PSKC_MAX_SIZE - length, length) == length,
|
||||
error = OT_ERROR_PARSE);
|
||||
|
||||
sDataset.mIsPSKcSet = true;
|
||||
sDataset.mComponents.mIsPSKcPresent = true;
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
exit:
|
||||
@@ -734,7 +736,7 @@ otError Dataset::ProcessSecurityPolicy(otInstance *aInstance, int argc, char *ar
|
||||
}
|
||||
}
|
||||
|
||||
sDataset.mIsSecurityPolicySet = true;
|
||||
sDataset.mComponents.mIsSecurityPolicyPresent = true;
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
exit:
|
||||
|
||||
@@ -45,8 +45,9 @@ bool otDatasetIsCommissioned(otInstance *aInstance)
|
||||
|
||||
otDatasetGetActive(aInstance, &dataset);
|
||||
|
||||
if ((dataset.mIsMasterKeySet) && (dataset.mIsNetworkNameSet) && (dataset.mIsExtendedPanIdSet) &&
|
||||
(dataset.mIsPanIdSet) && (dataset.mIsChannelSet))
|
||||
if (dataset.mComponents.mIsMasterKeyPresent && dataset.mComponents.mIsNetworkNamePresent &&
|
||||
dataset.mComponents.mIsExtendedPanIdPresent && dataset.mComponents.mIsPanIdPresent &&
|
||||
dataset.mComponents.mIsChannelPresent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -67,14 +67,16 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otDatasetSendMgmtActiveGet(otInstance * aInstance,
|
||||
const uint8_t * aTlvTypes,
|
||||
uint8_t aLength,
|
||||
const otIp6Address *aAddress)
|
||||
otError otDatasetSendMgmtActiveGet(otInstance * aInstance,
|
||||
const otOperationalDatasetComponents *aDatasetComponents,
|
||||
const uint8_t * aTlvTypes,
|
||||
uint8_t aLength,
|
||||
const otIp6Address * aAddress)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.GetThreadNetif().GetActiveDataset().SendGetRequest(aTlvTypes, aLength, aAddress);
|
||||
return instance.GetThreadNetif().GetActiveDataset().SendGetRequest(*aDatasetComponents, aTlvTypes, aLength,
|
||||
aAddress);
|
||||
}
|
||||
|
||||
otError otDatasetSendMgmtActiveSet(otInstance * aInstance,
|
||||
@@ -87,14 +89,16 @@ otError otDatasetSendMgmtActiveSet(otInstance * aInstance,
|
||||
return instance.GetThreadNetif().GetActiveDataset().SendSetRequest(*aDataset, aTlvs, aLength);
|
||||
}
|
||||
|
||||
otError otDatasetSendMgmtPendingGet(otInstance * aInstance,
|
||||
const uint8_t * aTlvTypes,
|
||||
uint8_t aLength,
|
||||
const otIp6Address *aAddress)
|
||||
otError otDatasetSendMgmtPendingGet(otInstance * aInstance,
|
||||
const otOperationalDatasetComponents *aDatasetComponents,
|
||||
const uint8_t * aTlvTypes,
|
||||
uint8_t aLength,
|
||||
const otIp6Address * aAddress)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.GetThreadNetif().GetPendingDataset().SendGetRequest(aTlvTypes, aLength, aAddress);
|
||||
return instance.GetThreadNetif().GetPendingDataset().SendGetRequest(*aDatasetComponents, aTlvTypes, aLength,
|
||||
aAddress);
|
||||
}
|
||||
|
||||
otError otDatasetSendMgmtPendingSet(otInstance * aInstance,
|
||||
|
||||
@@ -128,17 +128,17 @@ void Dataset::Get(otOperationalDataset &aDataset) const
|
||||
{
|
||||
case Tlv::kActiveTimestamp:
|
||||
{
|
||||
const ActiveTimestampTlv *tlv = static_cast<const ActiveTimestampTlv *>(cur);
|
||||
aDataset.mActiveTimestamp = tlv->GetSeconds();
|
||||
aDataset.mIsActiveTimestampSet = true;
|
||||
const ActiveTimestampTlv *tlv = static_cast<const ActiveTimestampTlv *>(cur);
|
||||
aDataset.mActiveTimestamp = tlv->GetSeconds();
|
||||
aDataset.mComponents.mIsActiveTimestampPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case Tlv::kChannel:
|
||||
{
|
||||
const ChannelTlv *tlv = static_cast<const ChannelTlv *>(cur);
|
||||
aDataset.mChannel = tlv->GetChannel();
|
||||
aDataset.mIsChannelSet = true;
|
||||
const ChannelTlv *tlv = static_cast<const ChannelTlv *>(cur);
|
||||
aDataset.mChannel = tlv->GetChannel();
|
||||
aDataset.mComponents.mIsChannelPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -149,8 +149,8 @@ void Dataset::Get(otOperationalDataset &aDataset) const
|
||||
|
||||
if (entry != NULL)
|
||||
{
|
||||
aDataset.mChannelMaskPage0 = entry->GetMask();
|
||||
aDataset.mIsChannelMaskPage0Set = true;
|
||||
aDataset.mChannelMaskPage0 = entry->GetMask();
|
||||
aDataset.mComponents.mIsChannelMaskPage0Present = true;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -158,9 +158,9 @@ void Dataset::Get(otOperationalDataset &aDataset) const
|
||||
|
||||
case Tlv::kDelayTimer:
|
||||
{
|
||||
const DelayTimerTlv *tlv = static_cast<const DelayTimerTlv *>(cur);
|
||||
aDataset.mDelay = tlv->GetDelayTimer();
|
||||
aDataset.mIsDelaySet = true;
|
||||
const DelayTimerTlv *tlv = static_cast<const DelayTimerTlv *>(cur);
|
||||
aDataset.mDelay = tlv->GetDelayTimer();
|
||||
aDataset.mComponents.mIsDelayPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ void Dataset::Get(otOperationalDataset &aDataset) const
|
||||
{
|
||||
const ExtendedPanIdTlv *tlv = static_cast<const ExtendedPanIdTlv *>(cur);
|
||||
memcpy(aDataset.mExtendedPanId.m8, tlv->GetExtendedPanId(), sizeof(aDataset.mExtendedPanId));
|
||||
aDataset.mIsExtendedPanIdSet = true;
|
||||
aDataset.mComponents.mIsExtendedPanIdPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -176,15 +176,15 @@ void Dataset::Get(otOperationalDataset &aDataset) const
|
||||
{
|
||||
const MeshLocalPrefixTlv *tlv = static_cast<const MeshLocalPrefixTlv *>(cur);
|
||||
memcpy(aDataset.mMeshLocalPrefix.m8, tlv->GetMeshLocalPrefix(), sizeof(aDataset.mMeshLocalPrefix));
|
||||
aDataset.mIsMeshLocalPrefixSet = true;
|
||||
aDataset.mComponents.mIsMeshLocalPrefixPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case Tlv::kNetworkMasterKey:
|
||||
{
|
||||
const NetworkMasterKeyTlv *tlv = static_cast<const NetworkMasterKeyTlv *>(cur);
|
||||
aDataset.mMasterKey = tlv->GetNetworkMasterKey();
|
||||
aDataset.mIsMasterKeySet = true;
|
||||
const NetworkMasterKeyTlv *tlv = static_cast<const NetworkMasterKeyTlv *>(cur);
|
||||
aDataset.mMasterKey = tlv->GetNetworkMasterKey();
|
||||
aDataset.mComponents.mIsMasterKeyPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -193,23 +193,23 @@ void Dataset::Get(otOperationalDataset &aDataset) const
|
||||
const NetworkNameTlv *tlv = static_cast<const NetworkNameTlv *>(cur);
|
||||
memcpy(aDataset.mNetworkName.m8, tlv->GetNetworkName(), tlv->GetLength());
|
||||
aDataset.mNetworkName.m8[tlv->GetLength()] = '\0';
|
||||
aDataset.mIsNetworkNameSet = true;
|
||||
aDataset.mComponents.mIsNetworkNamePresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case Tlv::kPanId:
|
||||
{
|
||||
const PanIdTlv *panid = static_cast<const PanIdTlv *>(cur);
|
||||
aDataset.mPanId = panid->GetPanId();
|
||||
aDataset.mIsPanIdSet = true;
|
||||
const PanIdTlv *panid = static_cast<const PanIdTlv *>(cur);
|
||||
aDataset.mPanId = panid->GetPanId();
|
||||
aDataset.mComponents.mIsPanIdPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case Tlv::kPendingTimestamp:
|
||||
{
|
||||
const PendingTimestampTlv *tlv = static_cast<const PendingTimestampTlv *>(cur);
|
||||
aDataset.mPendingTimestamp = tlv->GetSeconds();
|
||||
aDataset.mIsPendingTimestampSet = true;
|
||||
const PendingTimestampTlv *tlv = static_cast<const PendingTimestampTlv *>(cur);
|
||||
aDataset.mPendingTimestamp = tlv->GetSeconds();
|
||||
aDataset.mComponents.mIsPendingTimestampPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -217,16 +217,16 @@ void Dataset::Get(otOperationalDataset &aDataset) const
|
||||
{
|
||||
const PSKcTlv *tlv = static_cast<const PSKcTlv *>(cur);
|
||||
memcpy(aDataset.mPSKc.m8, tlv->GetPSKc(), tlv->GetLength());
|
||||
aDataset.mIsPSKcSet = true;
|
||||
aDataset.mComponents.mIsPSKcPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case Tlv::kSecurityPolicy:
|
||||
{
|
||||
const SecurityPolicyTlv *tlv = static_cast<const SecurityPolicyTlv *>(cur);
|
||||
aDataset.mSecurityPolicy.mRotationTime = tlv->GetRotationTime();
|
||||
aDataset.mSecurityPolicy.mFlags = tlv->GetFlags();
|
||||
aDataset.mIsSecurityPolicySet = true;
|
||||
const SecurityPolicyTlv *tlv = static_cast<const SecurityPolicyTlv *>(cur);
|
||||
aDataset.mSecurityPolicy.mRotationTime = tlv->GetRotationTime();
|
||||
aDataset.mSecurityPolicy.mFlags = tlv->GetFlags();
|
||||
aDataset.mComponents.mIsSecurityPolicyPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
otError error = OT_ERROR_NONE;
|
||||
MeshCoP::ActiveTimestampTlv activeTimestampTlv;
|
||||
|
||||
VerifyOrExit(aDataset.mIsActiveTimestampSet, error = OT_ERROR_INVALID_ARGS);
|
||||
VerifyOrExit(aDataset.mComponents.mIsActiveTimestampPresent, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
activeTimestampTlv.Init();
|
||||
activeTimestampTlv.SetSeconds(aDataset.mActiveTimestamp);
|
||||
@@ -273,14 +273,14 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
{
|
||||
MeshCoP::PendingTimestampTlv pendingTimestampTlv;
|
||||
|
||||
VerifyOrExit(aDataset.mIsPendingTimestampSet, error = OT_ERROR_INVALID_ARGS);
|
||||
VerifyOrExit(aDataset.mComponents.mIsPendingTimestampPresent, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
pendingTimestampTlv.Init();
|
||||
pendingTimestampTlv.SetSeconds(aDataset.mPendingTimestamp);
|
||||
pendingTimestampTlv.SetTicks(0);
|
||||
Set(pendingTimestampTlv);
|
||||
|
||||
if (aDataset.mIsDelaySet)
|
||||
if (aDataset.mComponents.mIsDelayPresent)
|
||||
{
|
||||
MeshCoP::DelayTimerTlv tlv;
|
||||
tlv.Init();
|
||||
@@ -289,7 +289,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
}
|
||||
}
|
||||
|
||||
if (aDataset.mIsChannelSet)
|
||||
if (aDataset.mComponents.mIsChannelPresent)
|
||||
{
|
||||
MeshCoP::ChannelTlv tlv;
|
||||
tlv.Init();
|
||||
@@ -298,7 +298,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
Set(tlv);
|
||||
}
|
||||
|
||||
if (aDataset.mIsChannelMaskPage0Set)
|
||||
if (aDataset.mComponents.mIsChannelMaskPage0Present)
|
||||
{
|
||||
MeshCoP::ChannelMask0Tlv tlv;
|
||||
tlv.Init();
|
||||
@@ -306,7 +306,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
Set(tlv);
|
||||
}
|
||||
|
||||
if (aDataset.mIsExtendedPanIdSet)
|
||||
if (aDataset.mComponents.mIsExtendedPanIdPresent)
|
||||
{
|
||||
MeshCoP::ExtendedPanIdTlv tlv;
|
||||
tlv.Init();
|
||||
@@ -314,7 +314,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
Set(tlv);
|
||||
}
|
||||
|
||||
if (aDataset.mIsMeshLocalPrefixSet)
|
||||
if (aDataset.mComponents.mIsMeshLocalPrefixPresent)
|
||||
{
|
||||
MeshCoP::MeshLocalPrefixTlv tlv;
|
||||
tlv.Init();
|
||||
@@ -322,7 +322,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
Set(tlv);
|
||||
}
|
||||
|
||||
if (aDataset.mIsMasterKeySet)
|
||||
if (aDataset.mComponents.mIsMasterKeyPresent)
|
||||
{
|
||||
MeshCoP::NetworkMasterKeyTlv tlv;
|
||||
tlv.Init();
|
||||
@@ -330,7 +330,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
Set(tlv);
|
||||
}
|
||||
|
||||
if (aDataset.mIsNetworkNameSet)
|
||||
if (aDataset.mComponents.mIsNetworkNamePresent)
|
||||
{
|
||||
MeshCoP::NetworkNameTlv tlv;
|
||||
tlv.Init();
|
||||
@@ -338,7 +338,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
Set(tlv);
|
||||
}
|
||||
|
||||
if (aDataset.mIsPanIdSet)
|
||||
if (aDataset.mComponents.mIsPanIdPresent)
|
||||
{
|
||||
MeshCoP::PanIdTlv tlv;
|
||||
tlv.Init();
|
||||
@@ -346,7 +346,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
Set(tlv);
|
||||
}
|
||||
|
||||
if (aDataset.mIsPSKcSet)
|
||||
if (aDataset.mComponents.mIsPSKcPresent)
|
||||
{
|
||||
MeshCoP::PSKcTlv tlv;
|
||||
tlv.Init();
|
||||
@@ -354,7 +354,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
Set(tlv);
|
||||
}
|
||||
|
||||
if (aDataset.mIsSecurityPolicySet)
|
||||
if (aDataset.mComponents.mIsSecurityPolicyPresent)
|
||||
{
|
||||
MeshCoP::SecurityPolicyTlv tlv;
|
||||
tlv.Init();
|
||||
|
||||
@@ -230,7 +230,8 @@ public:
|
||||
* @param[in] aTlvs Any additional raw TLVs to include.
|
||||
* @param[in] aLength Number of bytes in @p aTlvs.
|
||||
*
|
||||
* @retval OT_ERROR_NONE on success.
|
||||
* @retval OT_ERROR_NONE Successfully send the meshcop dataset command.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffer space to send.
|
||||
*
|
||||
*/
|
||||
otError SendSetRequest(const otOperationalDataset &aDataset, const uint8_t *aTlvs, uint8_t aLength);
|
||||
@@ -238,14 +239,19 @@ public:
|
||||
/**
|
||||
* This method sends a MGMT_GET request.
|
||||
*
|
||||
* @param[in] aTlvTypes The list of TLV types to request.
|
||||
* @param[in] aLength Number of bytes in @p aTlvTypes.
|
||||
* @param[in] aAddress The IPv6 destination address for the MGMT_GET request.
|
||||
* @param[in] aDatasetComponents An Operational Dataset components structure specifying components to request.
|
||||
* @param[in] aTlvTypes A pointer to array containing additional raw TLV types to be requested.
|
||||
* @param[in] aLength Number of bytes in @p aTlvTypes.
|
||||
* @param[in] aAddress The IPv6 destination address for the MGMT_GET request.
|
||||
*
|
||||
* @retval OT_ERROR_NONE on success.
|
||||
* @retval OT_ERROR_NONE Successfully send the meshcop dataset command.
|
||||
* @retval OT_ERROR_NO_BUFS Insufficient buffer space to send.
|
||||
*
|
||||
*/
|
||||
otError SendGetRequest(const uint8_t *aTlvTypes, uint8_t aLength, const otIp6Address *aAddress) const;
|
||||
otError SendGetRequest(const otOperationalDatasetComponents &aDatasetComponents,
|
||||
const uint8_t * aTlvTypes,
|
||||
uint8_t aLength,
|
||||
const otIp6Address * aAddress) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -270,10 +276,15 @@ protected:
|
||||
otError Set(Coap::Header &aHeader, Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
kMaxDatasetTlvs = 16, // Maximum number of TLVs in an `otOperationalDataset`.
|
||||
};
|
||||
|
||||
void SendSetResponse(const Coap::Header & aRequestHeader,
|
||||
const Ip6::MessageInfo &aMessageInfo,
|
||||
StateTlv::State aState);
|
||||
#endif
|
||||
#endif // OPENTHREAD_FTD
|
||||
};
|
||||
|
||||
class ActiveDataset : public DatasetManager
|
||||
|
||||
@@ -383,7 +383,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
|
||||
if (aDataset.mIsActiveTimestampSet)
|
||||
if (aDataset.mComponents.mIsActiveTimestampPresent)
|
||||
{
|
||||
ActiveTimestampTlv timestamp;
|
||||
timestamp.Init();
|
||||
@@ -392,7 +392,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
SuccessOrExit(error = message->Append(×tamp, sizeof(timestamp)));
|
||||
}
|
||||
|
||||
if (aDataset.mIsPendingTimestampSet)
|
||||
if (aDataset.mComponents.mIsPendingTimestampPresent)
|
||||
{
|
||||
PendingTimestampTlv timestamp;
|
||||
timestamp.Init();
|
||||
@@ -401,7 +401,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
SuccessOrExit(error = message->Append(×tamp, sizeof(timestamp)));
|
||||
}
|
||||
|
||||
if (aDataset.mIsMasterKeySet)
|
||||
if (aDataset.mComponents.mIsMasterKeyPresent)
|
||||
{
|
||||
NetworkMasterKeyTlv masterkey;
|
||||
masterkey.Init();
|
||||
@@ -409,7 +409,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
SuccessOrExit(error = message->Append(&masterkey, sizeof(masterkey)));
|
||||
}
|
||||
|
||||
if (aDataset.mIsNetworkNameSet)
|
||||
if (aDataset.mComponents.mIsNetworkNamePresent)
|
||||
{
|
||||
NetworkNameTlv networkname;
|
||||
networkname.Init();
|
||||
@@ -417,7 +417,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
SuccessOrExit(error = message->Append(&networkname, sizeof(Tlv) + networkname.GetLength()));
|
||||
}
|
||||
|
||||
if (aDataset.mIsExtendedPanIdSet)
|
||||
if (aDataset.mComponents.mIsExtendedPanIdPresent)
|
||||
{
|
||||
ExtendedPanIdTlv extpanid;
|
||||
extpanid.Init();
|
||||
@@ -425,7 +425,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
SuccessOrExit(error = message->Append(&extpanid, sizeof(extpanid)));
|
||||
}
|
||||
|
||||
if (aDataset.mIsMeshLocalPrefixSet)
|
||||
if (aDataset.mComponents.mIsMeshLocalPrefixPresent)
|
||||
{
|
||||
MeshLocalPrefixTlv localprefix;
|
||||
localprefix.Init();
|
||||
@@ -433,7 +433,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
SuccessOrExit(error = message->Append(&localprefix, sizeof(localprefix)));
|
||||
}
|
||||
|
||||
if (aDataset.mIsDelaySet)
|
||||
if (aDataset.mComponents.mIsDelayPresent)
|
||||
{
|
||||
DelayTimerTlv delaytimer;
|
||||
delaytimer.Init();
|
||||
@@ -441,7 +441,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
SuccessOrExit(error = message->Append(&delaytimer, sizeof(delaytimer)));
|
||||
}
|
||||
|
||||
if (aDataset.mIsPanIdSet)
|
||||
if (aDataset.mComponents.mIsPanIdPresent)
|
||||
{
|
||||
PanIdTlv panid;
|
||||
panid.Init();
|
||||
@@ -449,7 +449,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
SuccessOrExit(error = message->Append(&panid, sizeof(panid)));
|
||||
}
|
||||
|
||||
if (aDataset.mIsChannelSet)
|
||||
if (aDataset.mComponents.mIsChannelPresent)
|
||||
{
|
||||
ChannelTlv channel;
|
||||
channel.Init();
|
||||
@@ -458,7 +458,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
SuccessOrExit(error = message->Append(&channel, sizeof(channel)));
|
||||
}
|
||||
|
||||
if (aDataset.mIsChannelMaskPage0Set)
|
||||
if (aDataset.mComponents.mIsChannelMaskPage0Present)
|
||||
{
|
||||
ChannelMask0Tlv channelMask;
|
||||
channelMask.Init();
|
||||
@@ -494,7 +494,10 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError DatasetManager::SendGetRequest(const uint8_t *aTlvTypes, uint8_t aLength, const otIp6Address *aAddress) const
|
||||
otError DatasetManager::SendGetRequest(const otOperationalDatasetComponents &aDatasetComponents,
|
||||
const uint8_t * aTlvTypes,
|
||||
uint8_t aLength,
|
||||
const otIp6Address * aAddress) const
|
||||
{
|
||||
ThreadNetif & netif = GetNetif();
|
||||
otError error = OT_ERROR_NONE;
|
||||
@@ -502,24 +505,97 @@ otError DatasetManager::SendGetRequest(const uint8_t *aTlvTypes, uint8_t aLength
|
||||
Message * message;
|
||||
Ip6::MessageInfo messageInfo;
|
||||
Tlv tlv;
|
||||
uint8_t datasetTlvs[kMaxDatasetTlvs];
|
||||
uint8_t length;
|
||||
|
||||
header.Init(OT_COAP_TYPE_CONFIRMABLE, OT_COAP_CODE_POST);
|
||||
header.SetToken(Coap::Header::kDefaultTokenLength);
|
||||
header.AppendUriPathOptions(mUriGet);
|
||||
|
||||
if (aLength > 0)
|
||||
length = 0;
|
||||
|
||||
if (aDatasetComponents.mIsActiveTimestampPresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kActiveTimestamp;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsPendingTimestampPresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kPendingTimestamp;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsMasterKeyPresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kNetworkMasterKey;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsNetworkNamePresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kNetworkName;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsExtendedPanIdPresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kExtendedPanId;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsMeshLocalPrefixPresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kMeshLocalPrefix;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsDelayPresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kDelayTimer;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsPanIdPresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kPanId;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsChannelPresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kChannel;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsPSKcPresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kPSKc;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsSecurityPolicyPresent)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kSecurityPolicy;
|
||||
}
|
||||
|
||||
if (aDatasetComponents.mIsChannelMaskPage0Present)
|
||||
{
|
||||
datasetTlvs[length++] = Tlv::kChannelMask;
|
||||
}
|
||||
|
||||
if (aLength + length > 0)
|
||||
{
|
||||
header.SetPayloadMarker();
|
||||
}
|
||||
|
||||
VerifyOrExit((message = NewMeshCoPMessage(netif.GetCoap(), header)) != NULL, error = OT_ERROR_NO_BUFS);
|
||||
|
||||
if (aLength > 0)
|
||||
if (aLength + length > 0)
|
||||
{
|
||||
tlv.SetType(Tlv::kGet);
|
||||
tlv.SetLength(aLength);
|
||||
tlv.SetLength(aLength + length);
|
||||
SuccessOrExit(error = message->Append(&tlv, sizeof(tlv)));
|
||||
SuccessOrExit(error = message->Append(aTlvTypes, aLength));
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
SuccessOrExit(error = message->Append(datasetTlvs, length));
|
||||
}
|
||||
|
||||
if (aLength > 0)
|
||||
{
|
||||
SuccessOrExit(error = message->Append(aTlvTypes, aLength));
|
||||
}
|
||||
}
|
||||
|
||||
if (aAddress != NULL)
|
||||
|
||||
@@ -111,7 +111,7 @@ void ChannelManager::PreparePendingDataset(void)
|
||||
|
||||
if (netif.GetPendingDataset().Get(dataset) == OT_ERROR_NONE)
|
||||
{
|
||||
if (dataset.mIsPendingTimestampSet)
|
||||
if (dataset.mComponents.mIsPendingTimestampPresent)
|
||||
{
|
||||
pendingTimestamp = dataset.mPendingTimestamp;
|
||||
}
|
||||
@@ -121,8 +121,9 @@ void ChannelManager::PreparePendingDataset(void)
|
||||
// should match and delay should be less than the requested
|
||||
// delay).
|
||||
|
||||
if (dataset.mIsChannelSet && (mChannel == dataset.mChannel) && dataset.mIsDelaySet &&
|
||||
(dataset.mDelay <= delayInMs) && dataset.mIsActiveTimestampSet)
|
||||
if (dataset.mComponents.mIsChannelPresent && (mChannel == dataset.mChannel) &&
|
||||
dataset.mComponents.mIsDelayPresent && (dataset.mDelay <= delayInMs) &&
|
||||
dataset.mComponents.mIsActiveTimestampPresent)
|
||||
{
|
||||
// We save the active timestamp to later check and ensure it
|
||||
// is ahead of current ActiveDataset timestamp.
|
||||
@@ -199,14 +200,14 @@ void ChannelManager::PreparePendingDataset(void)
|
||||
mActiveTimestamp = dataset.mActiveTimestamp + 1 + Random::GetUint32InRange(0, kMaxTimestampIncrease);
|
||||
}
|
||||
|
||||
dataset.mActiveTimestamp = mActiveTimestamp;
|
||||
dataset.mIsActiveTimestampSet = true;
|
||||
dataset.mChannel = mChannel;
|
||||
dataset.mIsChannelSet = true;
|
||||
dataset.mPendingTimestamp = pendingTimestamp;
|
||||
dataset.mIsPendingTimestampSet = true;
|
||||
dataset.mDelay = delayInMs;
|
||||
dataset.mIsDelaySet = true;
|
||||
dataset.mActiveTimestamp = mActiveTimestamp;
|
||||
dataset.mComponents.mIsActiveTimestampPresent = true;
|
||||
dataset.mChannel = mChannel;
|
||||
dataset.mComponents.mIsChannelPresent = true;
|
||||
dataset.mPendingTimestamp = pendingTimestamp;
|
||||
dataset.mComponents.mIsPendingTimestampPresent = true;
|
||||
dataset.mDelay = delayInMs;
|
||||
dataset.mComponents.mIsDelayPresent = true;
|
||||
|
||||
error = netif.GetPendingDataset().SendSetRequest(dataset, NULL, 0);
|
||||
|
||||
|
||||
@@ -290,7 +290,11 @@ protected:
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
otError EncodeChildInfo(const otChildInfo &aChildInfo);
|
||||
otError DecodeOperationalDataset(otOperationalDataset &aDataset, const uint8_t **aTlvs, uint8_t *aTlvsLength);
|
||||
otError DecodeOperationalDataset(otOperationalDataset &aDataset,
|
||||
const uint8_t ** aTlvs = NULL,
|
||||
uint8_t * aTlvsLength = NULL,
|
||||
const otIp6Address ** aDestIpAddress = NULL,
|
||||
bool aAllowEmptyValues = false);
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_ENABLE_UDP_PROXY
|
||||
|
||||
@@ -823,11 +823,17 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey)
|
||||
case SPINEL_PROP_THREAD_PENDING_DATASET:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_PENDING_DATASET>;
|
||||
break;
|
||||
case SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET>;
|
||||
case SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET>;
|
||||
break;
|
||||
case SPINEL_PROP_THREAD_MGMT_PENDING_DATASET:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_PENDING_DATASET>;
|
||||
case SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET>;
|
||||
break;
|
||||
case SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET>;
|
||||
break;
|
||||
case SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET>;
|
||||
break;
|
||||
#if OPENTHREAD_ENABLE_CHANNEL_MANAGER
|
||||
case SPINEL_PROP_CHANNEL_MANAGER_NEW_CHANNEL:
|
||||
|
||||
+189
-87
@@ -544,7 +544,11 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError NcpBase::DecodeOperationalDataset(otOperationalDataset &aDataset, const uint8_t **aTlvs, uint8_t *aTlvsLength)
|
||||
otError NcpBase::DecodeOperationalDataset(otOperationalDataset &aDataset,
|
||||
const uint8_t ** aTlvs,
|
||||
uint8_t * aTlvsLength,
|
||||
const otIp6Address ** aDestIpAddress,
|
||||
bool aAllowEmptyValue)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
@@ -560,6 +564,11 @@ otError NcpBase::DecodeOperationalDataset(otOperationalDataset &aDataset, const
|
||||
*aTlvsLength = 0;
|
||||
}
|
||||
|
||||
if (aDestIpAddress != NULL)
|
||||
{
|
||||
*aDestIpAddress = NULL;
|
||||
}
|
||||
|
||||
while (!mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
unsigned int propKey;
|
||||
@@ -570,140 +579,203 @@ otError NcpBase::DecodeOperationalDataset(otOperationalDataset &aDataset, const
|
||||
switch (static_cast<spinel_prop_key_t>(propKey))
|
||||
{
|
||||
case SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP:
|
||||
SuccessOrExit(error = mDecoder.ReadUint64(aDataset.mActiveTimestamp));
|
||||
aDataset.mIsActiveTimestampSet = true;
|
||||
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
SuccessOrExit(error = mDecoder.ReadUint64(aDataset.mActiveTimestamp));
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsActiveTimestampPresent = true;
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_DATASET_PENDING_TIMESTAMP:
|
||||
SuccessOrExit(error = mDecoder.ReadUint64(aDataset.mPendingTimestamp));
|
||||
aDataset.mIsPendingTimestampSet = true;
|
||||
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
SuccessOrExit(error = mDecoder.ReadUint64(aDataset.mPendingTimestamp));
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsPendingTimestampPresent = true;
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_NET_MASTER_KEY:
|
||||
{
|
||||
const uint8_t *key;
|
||||
uint16_t len;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadData(key, len));
|
||||
VerifyOrExit(len == OT_MASTER_KEY_SIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(aDataset.mMasterKey.m8, key, len);
|
||||
aDataset.mIsMasterKeySet = true;
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
const uint8_t *key;
|
||||
uint16_t len;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadData(key, len));
|
||||
VerifyOrExit(len == OT_MASTER_KEY_SIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(aDataset.mMasterKey.m8, key, len);
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsMasterKeyPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case SPINEL_PROP_NET_NETWORK_NAME:
|
||||
{
|
||||
const char *name;
|
||||
size_t len;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadUtf8(name));
|
||||
len = strlen(name);
|
||||
VerifyOrExit(len <= OT_NETWORK_NAME_MAX_SIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(aDataset.mNetworkName.m8, name, len + 1);
|
||||
aDataset.mIsNetworkNameSet = true;
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
const char *name;
|
||||
size_t len;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadUtf8(name));
|
||||
len = strlen(name);
|
||||
VerifyOrExit(len <= OT_NETWORK_NAME_MAX_SIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(aDataset.mNetworkName.m8, name, len + 1);
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsNetworkNamePresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case SPINEL_PROP_NET_XPANID:
|
||||
{
|
||||
const uint8_t *xpanid;
|
||||
uint16_t len;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadData(xpanid, len));
|
||||
VerifyOrExit(len == OT_EXT_PAN_ID_SIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(aDataset.mExtendedPanId.m8, xpanid, len);
|
||||
aDataset.mIsExtendedPanIdSet = true;
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
const uint8_t *xpanid;
|
||||
uint16_t len;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadData(xpanid, len));
|
||||
VerifyOrExit(len == OT_EXT_PAN_ID_SIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(aDataset.mExtendedPanId.m8, xpanid, len);
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsExtendedPanIdPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case SPINEL_PROP_IPV6_ML_PREFIX:
|
||||
{
|
||||
const otIp6Address *addr;
|
||||
uint8_t prefixLen;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadIp6Address(addr));
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(prefixLen));
|
||||
VerifyOrExit(prefixLen == 64, error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(aDataset.mMeshLocalPrefix.m8, addr, OT_MESH_LOCAL_PREFIX_SIZE);
|
||||
aDataset.mIsMeshLocalPrefixSet = true;
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
const otIp6Address *addr;
|
||||
uint8_t prefixLen;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadIp6Address(addr));
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(prefixLen));
|
||||
VerifyOrExit(prefixLen == 64, error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(aDataset.mMeshLocalPrefix.m8, addr, OT_MESH_LOCAL_PREFIX_SIZE);
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsMeshLocalPrefixPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case SPINEL_PROP_DATASET_DELAY_TIMER:
|
||||
SuccessOrExit(error = mDecoder.ReadUint32(aDataset.mDelay));
|
||||
aDataset.mIsDelaySet = true;
|
||||
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
SuccessOrExit(error = mDecoder.ReadUint32(aDataset.mDelay));
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsDelayPresent = true;
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_MAC_15_4_PANID:
|
||||
SuccessOrExit(error = mDecoder.ReadUint16(aDataset.mPanId));
|
||||
aDataset.mIsPanIdSet = true;
|
||||
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
SuccessOrExit(error = mDecoder.ReadUint16(aDataset.mPanId));
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsPanIdPresent = true;
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_PHY_CHAN:
|
||||
{
|
||||
uint8_t channel;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(channel));
|
||||
aDataset.mChannel = channel;
|
||||
aDataset.mIsChannelSet = true;
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
uint8_t channel;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(channel));
|
||||
aDataset.mChannel = channel;
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsChannelPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case SPINEL_PROP_NET_PSKC:
|
||||
{
|
||||
const uint8_t *psk;
|
||||
uint16_t len;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadData(psk, len));
|
||||
VerifyOrExit(len == OT_PSKC_MAX_SIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(aDataset.mPSKc.m8, psk, OT_PSKC_MAX_SIZE);
|
||||
aDataset.mIsPSKcSet = true;
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
const uint8_t *psk;
|
||||
uint16_t len;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadData(psk, len));
|
||||
VerifyOrExit(len == OT_PSKC_MAX_SIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(aDataset.mPSKc.m8, psk, OT_PSKC_MAX_SIZE);
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsPSKcPresent = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case SPINEL_PROP_DATASET_SECURITY_POLICY:
|
||||
SuccessOrExit(error = mDecoder.ReadUint16(aDataset.mSecurityPolicy.mRotationTime));
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(aDataset.mSecurityPolicy.mFlags));
|
||||
aDataset.mIsSecurityPolicySet = true;
|
||||
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
SuccessOrExit(error = mDecoder.ReadUint16(aDataset.mSecurityPolicy.mRotationTime));
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(aDataset.mSecurityPolicy.mFlags));
|
||||
}
|
||||
|
||||
aDataset.mComponents.mIsSecurityPolicyPresent = true;
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_PHY_CHAN_SUPPORTED:
|
||||
{
|
||||
uint8_t channel;
|
||||
|
||||
aDataset.mChannelMaskPage0 = 0;
|
||||
|
||||
while (!mDecoder.IsAllReadInStruct())
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(channel));
|
||||
VerifyOrExit(channel <= 31, error = OT_ERROR_INVALID_ARGS);
|
||||
aDataset.mChannelMaskPage0 |= (1U << channel);
|
||||
uint8_t channel;
|
||||
|
||||
aDataset.mChannelMaskPage0 = 0;
|
||||
|
||||
while (!mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(channel));
|
||||
VerifyOrExit(channel <= 31, error = OT_ERROR_INVALID_ARGS);
|
||||
aDataset.mChannelMaskPage0 |= (1U << channel);
|
||||
}
|
||||
}
|
||||
|
||||
aDataset.mIsChannelMaskPage0Set = true;
|
||||
aDataset.mComponents.mIsChannelMaskPage0Present = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case SPINEL_PROP_DATASET_RAW_TLVS:
|
||||
{
|
||||
const uint8_t *tlvs;
|
||||
uint16_t len;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadData(tlvs, len));
|
||||
VerifyOrExit(len <= 255, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
if (aTlvs != NULL)
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
*aTlvs = tlvs;
|
||||
}
|
||||
const uint8_t *tlvs;
|
||||
uint16_t len;
|
||||
|
||||
if (aTlvsLength != NULL)
|
||||
{
|
||||
*aTlvsLength = static_cast<uint8_t>(len);
|
||||
SuccessOrExit(error = mDecoder.ReadData(tlvs, len));
|
||||
VerifyOrExit(len <= 255, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
if (aTlvs != NULL)
|
||||
{
|
||||
*aTlvs = tlvs;
|
||||
}
|
||||
|
||||
if (aTlvsLength != NULL)
|
||||
{
|
||||
*aTlvsLength = static_cast<uint8_t>(len);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_DATASET_DEST_ADDRESS:
|
||||
|
||||
if (!aAllowEmptyValue || !mDecoder.IsAllReadInStruct())
|
||||
{
|
||||
const otIp6Address *addr;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadIp6Address(addr));
|
||||
|
||||
if (aDestIpAddress != NULL)
|
||||
{
|
||||
*aDestIpAddress = addr;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -721,7 +793,7 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_ACTIVE_DATASET
|
||||
otError error = OT_ERROR_NONE;
|
||||
otOperationalDataset dataset;
|
||||
|
||||
SuccessOrExit(error = DecodeOperationalDataset(dataset, NULL, NULL));
|
||||
SuccessOrExit(error = DecodeOperationalDataset(dataset));
|
||||
error = otDatasetSetActive(mInstance, &dataset);
|
||||
|
||||
exit:
|
||||
@@ -733,14 +805,14 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_PENDING_DATASE
|
||||
otError error = OT_ERROR_NONE;
|
||||
otOperationalDataset dataset;
|
||||
|
||||
SuccessOrExit(error = DecodeOperationalDataset(dataset, NULL, NULL));
|
||||
SuccessOrExit(error = DecodeOperationalDataset(dataset));
|
||||
error = otDatasetSetPending(mInstance, &dataset);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET>(void)
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET>(void)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
otOperationalDataset dataset;
|
||||
@@ -754,7 +826,7 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_PENDING_DATASET>(void)
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET>(void)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
otOperationalDataset dataset;
|
||||
@@ -768,6 +840,36 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET>(void)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
otOperationalDataset dataset;
|
||||
const uint8_t * extraTlvs;
|
||||
uint8_t extraTlvsLength;
|
||||
const otIp6Address * destIpAddress;
|
||||
|
||||
SuccessOrExit(error = DecodeOperationalDataset(dataset, &extraTlvs, &extraTlvsLength, &destIpAddress, true));
|
||||
error = otDatasetSendMgmtActiveGet(mInstance, &dataset.mComponents, extraTlvs, extraTlvsLength, destIpAddress);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET>(void)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
otOperationalDataset dataset;
|
||||
const uint8_t * extraTlvs;
|
||||
uint8_t extraTlvsLength;
|
||||
const otIp6Address * destIpAddress;
|
||||
|
||||
SuccessOrExit(error = DecodeOperationalDataset(dataset, &extraTlvs, &extraTlvsLength, &destIpAddress, true));
|
||||
error = otDatasetSendMgmtPendingGet(mInstance, &dataset.mComponents, extraTlvs, extraTlvsLength, destIpAddress);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_CHANNEL_MANAGER
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CHANNEL_MANAGER_NEW_CHANNEL>(void)
|
||||
|
||||
+12
-12
@@ -881,7 +881,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
if (aDataset.mIsActiveTimestampSet)
|
||||
if (aDataset.mComponents.mIsActiveTimestampPresent)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP));
|
||||
@@ -889,7 +889,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsPendingTimestampSet)
|
||||
if (aDataset.mComponents.mIsPendingTimestampPresent)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_DATASET_PENDING_TIMESTAMP));
|
||||
@@ -897,7 +897,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsMasterKeySet)
|
||||
if (aDataset.mComponents.mIsMasterKeyPresent)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_NET_MASTER_KEY));
|
||||
@@ -905,7 +905,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsNetworkNameSet)
|
||||
if (aDataset.mComponents.mIsNetworkNamePresent)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_NET_NETWORK_NAME));
|
||||
@@ -913,7 +913,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsExtendedPanIdSet)
|
||||
if (aDataset.mComponents.mIsExtendedPanIdPresent)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_NET_XPANID));
|
||||
@@ -921,7 +921,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsMeshLocalPrefixSet)
|
||||
if (aDataset.mComponents.mIsMeshLocalPrefixPresent)
|
||||
{
|
||||
otIp6Address addr;
|
||||
|
||||
@@ -935,7 +935,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsDelaySet)
|
||||
if (aDataset.mComponents.mIsDelayPresent)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_DATASET_DELAY_TIMER));
|
||||
@@ -943,7 +943,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsPanIdSet)
|
||||
if (aDataset.mComponents.mIsPanIdPresent)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_MAC_15_4_PANID));
|
||||
@@ -951,7 +951,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsChannelSet)
|
||||
if (aDataset.mComponents.mIsChannelPresent)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_PHY_CHAN));
|
||||
@@ -965,7 +965,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsPSKcSet)
|
||||
if (aDataset.mComponents.mIsPSKcPresent)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_NET_PSKC));
|
||||
@@ -973,7 +973,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsSecurityPolicySet)
|
||||
if (aDataset.mComponents.mIsSecurityPolicyPresent)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_DATASET_SECURITY_POLICY));
|
||||
@@ -982,7 +982,7 @@ otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset)
|
||||
SuccessOrExit(mEncoder.CloseStruct());
|
||||
}
|
||||
|
||||
if (aDataset.mIsChannelMaskPage0Set)
|
||||
if (aDataset.mComponents.mIsChannelMaskPage0Present)
|
||||
{
|
||||
SuccessOrExit(mEncoder.OpenStruct());
|
||||
SuccessOrExit(mEncoder.WriteUintPacked(SPINEL_PROP_PHY_CHAN_SUPPORTED));
|
||||
|
||||
+16
-4
@@ -1525,12 +1525,12 @@ const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
|
||||
ret = "PROP_THREAD_PENDING_DATASET";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET:
|
||||
ret = "PROP_THREAD_MGMT_ACTIVE_DATASET";
|
||||
case SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET:
|
||||
ret = "PROP_THREAD_MGMT_SET_ACTIVE_DATASET";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_MGMT_PENDING_DATASET:
|
||||
ret = "PROP_THREAD_MGMT_PENDING_DATASET";
|
||||
case SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET:
|
||||
ret = "PROP_THREAD_MGMT_SET_PENDING_DATASET";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP:
|
||||
@@ -1565,6 +1565,18 @@ const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
|
||||
ret = "PROP_THREAD_ADDRESS_CACHE_TABLE";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET:
|
||||
ret = "PROP_THREAD_MGMT_GET_ACTIVE_DATASET";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET:
|
||||
ret = "PROP_THREAD_MGMT_GET_PENDING_DATASET";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_DATASET_DEST_ADDRESS:
|
||||
ret = "PROP_DATASET_DEST_ADDRESS";
|
||||
break;
|
||||
|
||||
case SPINEL_PROP_IPV6_LL_ADDR:
|
||||
ret = "PROP_IPV6_LL_ADDR";
|
||||
break;
|
||||
|
||||
+66
-12
@@ -1250,7 +1250,7 @@ typedef enum {
|
||||
*/
|
||||
SPINEL_PROP_THREAD_PENDING_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 25,
|
||||
|
||||
/// Thread Active Operational Dataset (MGMT send)
|
||||
/// Send MGMT_SET Thread Active Operational Dataset
|
||||
/** Format: `A(t(iD))` - Write only
|
||||
*
|
||||
* The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_ACTIVE_DATASET.
|
||||
@@ -1265,9 +1265,9 @@ typedef enum {
|
||||
* SPINEL_PROP_DATASET_RAW_TLVS
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 26,
|
||||
SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 26,
|
||||
|
||||
/// Thread Pending Operational Dataset (MGMT send)
|
||||
/// Send MGMT_SET Thread Pending Operational Dataset
|
||||
/** Format: `A(t(iD))` - Write only
|
||||
*
|
||||
* This property is similar to SPINEL_PROP_THREAD_PENDING_DATASET and follows the same format and rules.
|
||||
@@ -1278,7 +1278,7 @@ typedef enum {
|
||||
* SPINEL_PROP_DATASET_RAW_TLVS
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_THREAD_MGMT_PENDING_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 27,
|
||||
SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 27,
|
||||
|
||||
/// Operational Dataset Active Timestamp
|
||||
/** Format: `X` - No direct read or write
|
||||
@@ -1287,8 +1287,10 @@ typedef enum {
|
||||
*
|
||||
* SPINEL_PROP_THREAD_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP = SPINEL_PROP_THREAD_EXT__BEGIN + 28,
|
||||
@@ -1299,7 +1301,8 @@ typedef enum {
|
||||
* It can only be included in one of the Pending Dataset properties:
|
||||
*
|
||||
* SPINEL_PROP_THREAD_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_DATASET_PENDING_TIMESTAMP = SPINEL_PROP_THREAD_EXT__BEGIN + 29,
|
||||
@@ -1313,7 +1316,8 @@ typedef enum {
|
||||
* It can only be included in one of the Pending Dataset properties:
|
||||
*
|
||||
* SPINEL_PROP_THREAD_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_DATASET_DELAY_TIMER = SPINEL_PROP_THREAD_EXT__BEGIN + 30,
|
||||
@@ -1325,8 +1329,10 @@ typedef enum {
|
||||
*
|
||||
* SPINEL_PROP_THREAD_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
*
|
||||
* Content is
|
||||
* `S` : Key Rotation Time (in units of hour)
|
||||
@@ -1342,8 +1348,10 @@ typedef enum {
|
||||
*
|
||||
* It can only be included in one of the following Dataset properties:
|
||||
*
|
||||
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_DATASET_RAW_TLVS = SPINEL_PROP_THREAD_EXT__BEGIN + 32,
|
||||
@@ -1415,6 +1423,52 @@ typedef enum {
|
||||
*/
|
||||
SPINEL_PROP_THREAD_UDP_PROXY_STREAM = SPINEL_PROP_THREAD_EXT__BEGIN + 36,
|
||||
|
||||
/// Send MGMT_GET Thread Active Operational Dataset
|
||||
/** Format: `A(t(iD))` - Write only
|
||||
*
|
||||
* The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET. This
|
||||
* property further allows the sender to not include a value associated with properties in formating of `t(iD)`,
|
||||
* i.e., it should accept either a `t(iD)` or a `t(i)` encoding (in both cases indicating that the associated
|
||||
* Dataset property should be requested as part of MGMT_GET command).
|
||||
*
|
||||
* This is write-only property. When written, it triggers a MGMT_ACTIVE_GET meshcop command to be sent to leader
|
||||
* requesting the Dataset related properties from the format. The spinel frame response should be a `LAST_STATUS`
|
||||
* with the status of the transmission of MGMT_ACTIVE_GET command.
|
||||
*
|
||||
* In addition to supported properties in SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET, the following property can be
|
||||
* optionally included in the Dataset:
|
||||
*
|
||||
* SPINEL_PROP_DATASET_DEST_ADDRESS
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 37,
|
||||
|
||||
/// Send MGMT_GET Thread Pending Operational Dataset
|
||||
/** Format: `A(t(iD))` - Write only
|
||||
*
|
||||
* The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET.
|
||||
*
|
||||
* This is write-only property. When written, it triggers a MGMT_PENDING_GET meshcop command to be sent to leader
|
||||
* with the given Dataset. The spinel frame response should be a `LAST_STATUS` with the status of the transmission
|
||||
* of MGMT_PENDING_GET command.
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 38,
|
||||
|
||||
/// Operational Dataset (MGMT_GET) Destination IPv6 Address
|
||||
/** Format: `6` - No direct read or write
|
||||
*
|
||||
* This property specifies the IPv6 destination when sending MGMT_GET command for either Active or Pending Dataset
|
||||
* if not provided, Leader ALOC address is used as default.
|
||||
*
|
||||
* It can only be included in one of the MGMT_GET Dataset properties:
|
||||
*
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
|
||||
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
|
||||
*
|
||||
*/
|
||||
SPINEL_PROP_DATASET_DEST_ADDRESS = SPINEL_PROP_THREAD_EXT__BEGIN + 39,
|
||||
|
||||
SPINEL_PROP_THREAD_EXT__END = 0x1600,
|
||||
|
||||
SPINEL_PROP_IPV6__BEGIN = 0x60,
|
||||
|
||||
Reference in New Issue
Block a user