mirror of
https://github.com/espressif/openthread.git
synced 2026-09-11 19:50:05 +00:00
This commit refactors MAC frame parsing and field inspection across the OpenThread stack by making `Frame::ParseInfo`, `RxFrame::ParseInfo`, and `TxFrame::ParseInfo` public and deprecating/removing individual getter methods directly on `Frame`. Previously, `Frame` provided dozens of separate getter methods (`GetDstAddr()`, `GetSrcAddr()`, `GetDstPanId()`, `GetSrcPanId()`, `GetSecurityLevel()`, `GetKeyIdMode()`, `GetFrameCounter()`, `GetCommandId()`, `GetPayload()`, `Find<IeType>()`, etc.). Calling these methods repeatedly on the same frame resulted in multiple parsing passes over the PSDU buffer. Furthermore, callback handlers across `SubMac`, `Mac`, `MeshForwarder`, and various schedulers had to re-query individual fields or maintain partial state independently. This commit unifies frame parsing into a single-pass model: - `ParseInfo` extracts and caches all relevant frame header fields, addresses, PAN IDs, security attributes, Header IEs, and payload/header boundaries during a single parse pass. - Frame parsing and validation can be done incrementally using `ParseMode` (`kParseAddrFields`, `kParseSecurityHeader`, or `kParseFully`). - Passing `ParseInfo` across layer boundaries eliminates redundant parsing operations and simplifies code across the codebase.