class TxFrame

Defined at line 548 of file ../../third_party/openthread/src/core/mac/mac_frame.hpp

Supports IEEE 802.15.4 MAC frame generation for transmission.

Public Methods

void CopyFrom (const TxFrame & aFromFrame)

Copies the PSDU and all attributes (except for frame link type) from another frame.

Parameters

aFromFrame [in] The frame to copy from.
void FinishPayload (const PayloadBuilder & aPayloadBuilder)

Finishes building the frame payload and updates the total frame length.

Parameters

aPayloadBuilder [in] The `PayloadBuilder` used to construct the payload.

Defined at line 746 of file ../../third_party/openthread/src/core/mac/mac_frame.hpp

void PrepareHeaders (const BuildInfo & aBuildInfo, PayloadBuilder & aPayloadBuilder)

Prepares MAC headers in the frame based on `BuildInfo` settings and initializes a `PayloadBuilder`.

This method uses the `BuildInfo` structure to construct the MAC address and security headers in the frame.

It determines the Frame Control Field (FCF), including setting the appropriate frame type, security level,

and addressing mode flags. It populates the source and destination addresses and PAN IDs within the MAC

header based on the information provided in the `BuildInfo` structure.

It sets the Ack Request bit in the FCF if the following criteria are met:

- A destination address is present

- The destination address is not the broadcast address

- The frame type is not an ACK frame

The header IE entries are prepared based on `mAppendTimeIe` and `mAppendCslIe` flags and the IE Present

flag in FCF is determined accordingly.

The Frame Pending flag in FCF is not set. It may need to be set separately depending on the specific

requirements of the frame being transmitted.

The provided

is initialized to allow building and appending payload bytes directly

into the frame buffer following the prepared headers. It is set up with the maximum available payload

capacity based on the frame header and footer lengths and its MTU. Callers can use

to

construct the frame payload. Once payload construction is complete, `FinishPayload()` can be called to update

and finalize the total frame length.

For MAC Command frames (`kTypeMacCmd`), whether the Command ID field is treated as part of the header or

payload depends on the frame version (see `GetPayload()`). The same rules apply to

here:

- For 2015 version, the Command ID is part of the payload, so

starts before the Command ID.

- For earlier versions (2003/2006), the Command ID is part of the MAC header, so

starts

after the Command ID.

Parameters

aBuildInfo [in] The `BuildInfo` containing settings for the MAC headers.
aPayloadBuilder [out] A reference to a `PayloadBuilder` to initialize for payload construction.
void GenerateImmAck (const RxFrame & aFrame, bool aIsFramePending)

Generate Imm-Ack in this frame object.

Parameters

aFrame [in] A reference to the frame received.
aIsFramePending [in] Value of the ACK's frame pending bit.
Error GenerateEnhAck (const RxFrame & aRxFrame, bool aIsFramePending, const uint8_t * aIeData, uint8_t aIeLength)

Generate Enh-Ack in this frame object.

Parameters

aRxFrame [in] A reference to the received frame.
aIsFramePending [in] Value of the ACK's frame pending bit.
aIeData [in] A pointer to the IE data portion of the ACK to be sent.
aIeLength [in] The length of IE data portion of the ACK to be sent.
void PrepareHeadersWithEmptyPayload (const BuildInfo & aBuildInfo)

Prepares MAC headers in the frame assuming an empty payload.

See `PrepareHeaders()` for more details on how the MAC headers are constructed.

Parameters

aBuildInfo [in] The `BuildInfo` structure containing settings for the MAC headers.

Defined at line 755 of file ../../third_party/openthread/src/core/mac/mac_frame.hpp

Records

Friends

class TxFrameProperties