mirror of
https://github.com/espressif/openthread.git
synced 2026-08-16 07:37:47 +00:00
This commit refactors IEEE 802.15.4 MAC frame parsing and payload construction in `Mac::Frame`, `TxFrame`, and `RxFrame`: - Introduces `Frame::ParseInfo::ParseFrom()` to consolidate frame header validation, parsing, and field extraction into a single, unified pass. Supports flexible parsing modes (`kParseAddrFields`, `kParseSecurityHeader`, and `kParseFully`). - Eliminates legacy index-search helpers (`FindPayloadIndex()`, `FindHeaderIeIndex()`, `SkipSecurityHeaderIndex()`, etc.) and replaces direct pointer indexing with `ParseInfo` and `FrameData`. - Introduces `Frame::Lengths` struct and `DetermineLengths()` to provide a clear breakdown of header, payload, footer, and maximum payload lengths. - Introduces `TxFrame::PayloadBuilder` (derived from `FrameBuilder`) to safely build and append frame payloads with automatic bounds checking, eliminating direct raw buffer manipulation of `GetPayload()`. - Updates `PrepareHeaders()`, `PrepareHeadersWithEmptyPayload()`, and `FinishPayload()` in `TxFrame` to manage header preparation and payload length calculation cleanly. - Updates `MessageFramer`, `Mac`, `DataPollSender`, and test suites to use the new header preparation and `PayloadBuilder` workflow.