mirror of
https://github.com/espressif/openthread.git
synced 2026-08-18 00:19:52 +00:00
[network-data] iterate over all external routes or on-mesh prefix entries (#2073)
The same external route or on-mesh prefix can be registered by different devices with different flags (e.g., different preference level). This info is stored in network data as part of the BorderRouterEntry TLV. This commit changes the methods `GetNextOnMeshPrefix()` and `GetNextExternalRoute()` to ensure that different entries corresponding to the same prefix are provided separately when iterating over all entries (i.e., without giving a specific RLOC16). To implement this the `otNetworkDataIterator` is changed to track both the index into the `mTlvs` buffer and the entry index. This commit also appends an RLOC16 field to the struct packing format of `SPINEL_PROP_THREAD_ON_MESH_NETS and `OFF_MESH_ROUTES` spinel properties and updates the implementation and documentation accordingly.
This commit is contained in:
committed by
Jonathan Hui
parent
6e8aef9644
commit
1e61811e70
@@ -4833,12 +4833,12 @@ otLwfIoCtl_otNextOnMeshPrefix(
|
||||
{
|
||||
NTSTATUS status = STATUS_INVALID_PARAMETER;
|
||||
|
||||
if (InBufferLength >= sizeof(BOOLEAN) + sizeof(uint8_t) &&
|
||||
*OutBufferLength >= sizeof(uint8_t) + sizeof(otBorderRouterConfig))
|
||||
if (InBufferLength >= sizeof(BOOLEAN) + sizeof(uint16_t) &&
|
||||
*OutBufferLength >= sizeof(uint16_t) + sizeof(otBorderRouterConfig))
|
||||
{
|
||||
BOOLEAN aLocal = *(BOOLEAN*)InBuffer;
|
||||
uint8_t aIterator = *(uint8_t*)(InBuffer + sizeof(BOOLEAN));
|
||||
otBorderRouterConfig* aConfig = (otBorderRouterConfig*)((PUCHAR)OutBuffer + sizeof(uint8_t));
|
||||
uint16_t aIterator = *(uint16_t*)(InBuffer + sizeof(BOOLEAN));
|
||||
otBorderRouterConfig* aConfig = (otBorderRouterConfig*)((PUCHAR)OutBuffer + sizeof(uint16_t));
|
||||
if (aLocal)
|
||||
{
|
||||
status = ThreadErrorToNtstatus(
|
||||
@@ -4860,7 +4860,7 @@ otLwfIoCtl_otNextOnMeshPrefix(
|
||||
*OutBufferLength = sizeof(uint8_t) + sizeof(otBorderRouterConfig);
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
*(uint8_t*)OutBuffer = aIterator;
|
||||
*(uint16_t*)OutBuffer = aIterator;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user