mirror of
https://github.com/espressif/openthread.git
synced 2026-07-09 13:50:28 +00:00
6886ff1e4c
The `Message` data is stored in a sequence of linked-listed `Buffer` instances. When reading or writing data in the `Message`, the internal implementation iterates over the `Buffer` list and updates the data in chunks. This commit adds two helper methods `GetFirstChunk()` and `GetNextChunk()` to get first/next data chunk (contiguous buffer) corresponding to a given offset and length into the message. These helper methods are then used to simplify `Read()`, `Write()`, and `UpdateChecksum()` methods. The unit test `test_message` is also updated to verify reading and writing data at different offsets and lengths.