Commit 57fa745
authored
Create super-class OperationalDatasetView out of OperationalDataset (project-chip#40346)
* Create super-class OperationalDatasetView out of OperationalDataset
OperationalDatasetView does not copy or hold a buffer for the underlying
dataset, and provides all the read-only methods that were present on
OperationalDataset. OperationalDataset has its own buffer and copies the
dataset as before.
Also simplify some of the mechanics of updating values in the dataset, by
replacing MakeRoom with InsertOrReplace that directly takes the required size
of the value and handles updating both the tag and length of the TLV item as
well as of the overall dataset, so the caller only has to fill in the value.
* Avoid out of bounds access in IsValid
* use EXPECT_STREQ instead of strncmp in test
* Handle copy construction / assignment correctly
* Fix test warning and use the view in TND server
* Address review comments
- Replace ThreadTLV::kMaxLength with kMaxDatasetElementLength outside of it,
the TheadTLV helper does not need to know about kSizeOperationalDataset.
- assert(aValueSize <= kMaxDatasetElementLength) in InsertOrReplace and
document that callers (the various Set... methods) are responsible for
checking the value size.
- Check Channel Page == 0 in GetChannel and use BigEndian instead of math.
- Tidy up method descriptions in the header.
* Expand comment on self-assignments1 parent 5be9f99 commit 57fa745
File tree
4 files changed
+584
-418
lines changed- src
- app/clusters/thread-network-directory-server
- lib/support
- tests
4 files changed
+584
-418
lines changedLines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | 203 | | |
205 | 204 | | |
206 | 205 | | |
| |||
0 commit comments