mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 07:37:46 +00:00
[dataset] add ValidateTlvs(), helper methods, and unit test (#10111)
This commit enhances dataset handling: - Adds `ValidateTlvs()` which parses and validates all known TLVs within the `Dataset` and checks for any duplicates. - Introduces a set of `SetFrom()` methods for constructing a `Dataset` from various types of inputs, e.g., other `Dataset`, TLV sequences, `DatasetInfo` structures, bytes read from `Message`. Now they consistently clear the `Dataset` before setting it. - Adds `WriteTlvsFrom()` to update a `Dataset` replacing/appending a set of TLVs. - Adds `AppendTlvsFrom()` to append an already encoded sequence of TLVs without validating/checking the format. - Renames `Get/SetSize()` to `Get/SetLength()` for consistency. - Adds `test_dataset.cpp` unit test for basic `Dataset` validation.
This commit is contained in:
@@ -205,7 +205,7 @@ void InitTest(void)
|
||||
otOperationalDatasetTlvs datasetTlvs;
|
||||
|
||||
SuccessOrQuit(otDatasetCreateNewNetwork(sInstance, &dataset));
|
||||
SuccessOrQuit(otDatasetConvertToTlvs(&dataset, &datasetTlvs));
|
||||
otDatasetConvertToTlvs(&dataset, &datasetTlvs);
|
||||
SuccessOrQuit(otDatasetSetActiveTlvs(sInstance, &datasetTlvs));
|
||||
|
||||
SuccessOrQuit(otIp6SetEnabled(sInstance, true));
|
||||
|
||||
Reference in New Issue
Block a user