class Frame

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

Implements IEEE 802.15.4 MAC frame generation and parsing.

Public Members

static const uint16_t kInfoStringSize
static const uint8_t kPreambleSize
static const uint8_t kSfdSize
static const uint8_t kPhrSize
static const uint8_t kPhyHeaderSize
static const uint8_t kFcfSize
static const uint8_t kDsnSize
static const uint8_t k154FcsSize
static const uint8_t kImmAckLength

Protected Members

static const uint8_t kShortFcfSize
static const uint8_t kSecurityControlSize
static const uint8_t kFrameCounterSize
static const uint8_t kCommandIdSize
static const uint8_t kKeyIndexSize
static const uint16_t kFcfFrameTypeMask
static const uint16_t kFcfAddrNone
static const uint16_t kFcfAddrShort
static const uint16_t kFcfAddrExt
static const uint16_t kFcfAddrMask
static const uint16_t kFcfSecurityEnabled
static const uint16_t kFcfFramePending
static const uint16_t kFcfAckRequest
static const uint16_t kFcfPanidCompression
static const uint16_t kFcfSequenceSuppression
static const uint16_t kFcfIePresent
static const uint16_t kFcfDstAddrShift
static const uint16_t kFcfDstAddrNone
static const uint16_t kFcfDstAddrShort
static const uint16_t kFcfDstAddrExt
static const uint16_t kFcfDstAddrMask
static const uint16_t kFcfFrameVersionMask
static const uint16_t kFcfSrcAddrShift
static const uint16_t kFcfSrcAddrNone
static const uint16_t kFcfSrcAddrShort
static const uint16_t kFcfSrcAddrExt
static const uint16_t kFcfSrcAddrMask
static const uint16_t kMpFcfLongFrame
static const uint16_t kMpFcfDstAddrShift
static const uint16_t kMpFcfDstAddrNone
static const uint16_t kMpFcfDstAddrShort
static const uint16_t kMpFcfDstAddrExt
static const uint16_t kMpFcfDstAddrMask
static const uint16_t kMpFcfSrcAddrShift
static const uint16_t kMpFcfSrcAddrNone
static const uint16_t kMpFcfSrcAddrShort
static const uint16_t kMpFcfSrcAddrExt
static const uint16_t kMpFcfSrcAddrMask
static const uint16_t kMpFcfPanidPresent
static const uint16_t kMpFcfSecurityEnabled
static const uint16_t kMpFcfSequenceSuppression
static const uint16_t kMpFcfFramePending
static const uint16_t kMpFcfAckRequest
static const uint16_t kMpFcfIePresent
static const uint8_t kSecLevelMask
static const uint8_t kKeyIdModeMask
static const uint8_t kMic0Size
static const uint8_t kMic32Size
static const uint8_t kMic64Size
static const uint8_t kMic128Size
static const uint8_t kMaxMicSize
static const uint8_t kKeySourceSizeMode0
static const uint8_t kKeySourceSizeMode1
static const uint8_t kKeySourceSizeMode2
static const uint8_t kKeySourceSizeMode3
static const uint8_t kInvalidIndex
static const uint8_t kInvalidSize
static const uint8_t kMaxPsduSize

Public Methods

uint8_t GetSequence ()

Returns the Sequence Number value.

Error GetDstPanId (PanId & aPanId)

Gets the Destination PAN Identifier.

Parameters

aPanId [out] The Destination PAN Identifier.
Error GetDstAddr (Address & aAddress)

Gets the Destination Address.

Parameters

aAddress [out] The Destination Address.
Error GetSrcPanId (PanId & aPanId)

Gets the Source PAN Identifier.

Parameters

aPanId [out] The Source PAN Identifier.
Error GetSrcAddr (Address & aAddress)

Gets the Source Address.

Parameters

aAddress [out] The Source Address.
Error GetSecurityControlField (uint8_t & aSecurityControlField)

Gets the Security Control Field.

Parameters

aSecurityControlField [out] The Security Control Field.
Error GetSecurityLevel (uint8_t & aSecurityLevel)

Gets the Security Level Identifier.

Parameters

aSecurityLevel [out] The Security Level Identifier.
Error GetKeyIdMode (uint8_t & aKeyIdMode)

Gets the Key Identifier Mode.

Parameters

aKeyIdMode [out] The Key Identifier Mode.
Error GetFrameCounter (uint32_t & aFrameCounter)

Gets the Frame Counter.

Parameters

aFrameCounter [out] The Frame Counter.
const uint8_t * GetKeySource ()

Returns a pointer to the Key Source.

Error GetKeyId (uint8_t & aKeyId)

Gets the Key Identifier.

Parameters

aKeyId [out] The Key Identifier.
Error GetCommandId (uint8_t & aCommandId)

Gets the Command ID.

Parameters

aCommandId [out] The Command ID.
bool IsDataRequestCommand ()

Indicates whether the frame is a MAC Data Request command (data poll).

For 802.15.4-2015 and above frame, the frame should be already decrypted.

uint8_t GetHeaderLength ()

Returns the MAC header size.

uint8_t GetFooterLength ()

Returns the MAC footer size.

uint16_t GetPayloadLength ()

Returns the current MAC Payload length.

uint16_t GetMaxPayloadLength ()

Returns the maximum MAC Payload length for the given MAC header and footer.

const uint8_t * GetPayload ()

Returns a pointer to the MAC Payload.

const uint8_t * GetFooter ()

Returns a pointer to the MAC Footer.

const uint8_t * GetHeaderIe (uint8_t aIeId)

Returns a pointer to the Header IE.

Parameters

aIeId [in] The Element Id of the Header IE.
const uint8_t * GetThreadIe (uint8_t aSubType)

Returns a pointer to a specific Thread IE.

A Thread IE is a vendor specific IE with Vendor OUI as `kVendorOuiThreadCompanyId`.

Parameters

aSubType [in] The sub type of the Thread IE.
const CslIe * GetCslIe ()

Returns a pointer to a CSL IE.

uint16_t GetMtu ()

Returns the maximum transmission unit size (MTU).

uint8_t GetFcsSize ()

Returns the FCS size.

bool IsEmpty ()

Indicates whether the frame is empty (no payload).

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

uint8_t GetType ()

Returns the IEEE 802.15.4 Frame Type.

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

bool IsAck ()

Returns whether the frame is an Ack frame.

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

bool IsMacCommand ()

Returns whether the frame is a MAC Command frame.

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

uint16_t GetVersion ()

Returns the IEEE 802.15.4 Frame Version.

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

bool IsVersion2015 ()

Returns if this IEEE 802.15.4 frame's version is 2015.

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

bool GetSecurityEnabled ()

Indicates whether or not security is enabled.

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

bool GetFramePending ()

Indicates whether or not the Frame Pending bit is set.

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

bool GetAckRequest ()

Indicates whether or not the Ack Request bit is set.

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

bool IsPanIdCompressed ()

Indicates whether or not the PanId Compression bit is set.

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

bool IsIePresent ()

Indicates whether or not IEs present.

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

uint8_t IsSequencePresent ()

Indicates whether or not the Sequence Number is present.

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

bool IsDstPanIdPresent ()

Indicates whether or not the Destination PAN ID is present.

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

bool IsDstAddrPresent ()

Indicates whether or not the Destination Address is present for this object.

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

bool IsSrcPanIdPresent ()

Indicates whether or not the Source Address is present for this object.

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

bool IsSrcAddrPresent ()

Indicates whether or not the Source Address is present for this object.

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

uint16_t GetLength ()

Returns the MAC Frame Length, namely the IEEE 802.15.4 PSDU length.

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

void SetFramePending (bool aFramePending)

Sets the Frame Pending bit.

Parameters

aFramePending [in] The Frame Pending bit.
void SetAckRequest (bool aAckRequest)

Sets the Ack Request bit.

Parameters

aAckRequest [in] The Ack Request bit.
void SetIePresent (bool aIePresent)

Sets the IE Present bit.

Parameters

aIePresent [in] The IE Present bit.
void SetFrameCounter (uint32_t aFrameCounter)

Sets the Frame Counter.

Parameters

aFrameCounter [in] The Frame Counter.
void SetKeySource (const uint8_t * aKeySource)

Sets the Key Source.

Parameters

aKeySource [in] A pointer to the Key Source value.
void SetKeyId (uint8_t aKeyId)

Sets the Key Identifier.

Parameters

aKeyId [in] The Key Identifier.
void SetEnhAckProbingIe (const uint8_t * aValue, uint8_t aLen)

Finds Enhanced ACK Probing (Vendor Specific) IE and set its value.

Parameters

aValue [in] A pointer to the value to set.
aLen [in] The length of
void SetLength (uint16_t aLength)

Sets the MAC Frame Length.

Parameters

aLength [in] The MAC Frame Length.

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

uint8_t GetChannel ()

Returns the IEEE 802.15.4 channel used for transmission or reception.

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

uint8_t * GetPsdu ()

Returns a pointer to the PSDU.

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

const uint8_t * GetPsdu ()

Returns a pointer to the PSDU.

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

uint8_t * GetHeader ()

Returns a pointer to the MAC Header.

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

const uint8_t * GetHeader ()

Returns a pointer to the MAC Header.

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

uint8_t * GetPayload ()

Returns a pointer to the MAC Payload.

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

uint8_t * GetFooter ()

Returns a pointer to the MAC Footer.

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

uint8_t * GetHeaderIe (uint8_t aIeId)

Returns a pointer to the Header IE.

Parameters

aIeId [in] The Element Id of the Header IE.

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

uint8_t * GetThreadIe (uint8_t aSubType)

Returns a pointer to a specific Thread IE.

A Thread IE is a vendor specific IE with Vendor OUI as `kVendorOuiThreadCompanyId`.

Parameters

aSubType [in] The sub type of the Thread IE.

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

CslIe * GetCslIe ()

Returns a pointer to a CSL IE.

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

RadioType GetRadioType ()

Gets the radio link type of the frame.

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

void SetRadioType (RadioType aRadioType)

Sets the radio link type of the frame.

Parameters

aRadioType [in] A radio link type.

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

uint16_t GetFrameControlField ()

Returns the Frame Control field of the frame.

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

Error ValidatePsdu ()

Validates the frame.

void SetSequence (uint8_t aSequence)

Sets the Sequence Number value.

Parameters

aSequence [in] The Sequence Number value.
void SetPayloadLength (uint16_t aLength)

Sets the MAC Payload length.

InfoString ToInfoString ()

Returns information about the frame object as an `InfoString` object.

Protected Methods

uint8_t FindDstPanIdIndex ()
uint8_t FindDstAddrIndex ()
uint8_t FindSrcPanIdIndex ()
uint8_t FindSrcAddrIndex ()
uint8_t FindSecurityHeaderIndex ()
uint8_t FindPayloadIndex ()
uint8_t FindHeaderIeIndex ()
bool IsDstPanIdPresent (uint16_t aFcf)
uint16_t DetermineFcfAddrType (const Address & aAddress, uint16_t aBitShift)
uint8_t CalculateAddrFieldSize (uint16_t aFcf)
uint8_t CalculateSecurityHeaderSize (uint8_t aSecurityControl)
uint8_t CalculateKeySourceSize (uint8_t aSecurityControl)
uint8_t CalculateMicSize (uint8_t aSecurityControl)
void SetFrameControlField (uint16_t aFcf)
bool IsSrcPanIdPresent (uint16_t aFcf)
uint8_t GetFcfSize (uint16_t )

clang-format off

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

template <uint16_t kValue, uint16_t kMpValue>
uint16_t Select (uint16_t )

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

template <uint16_t kValue, uint16_t kMpValue>
uint16_t MaskFcf (uint16_t aFcf)

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

uint16_t GetFcfDstAddr (uint16_t aFcf)

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

uint16_t GetFcfSrcAddr (uint16_t aFcf)

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

bool IsMultipurpose (uint16_t aFcf)

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

bool IsShortFcf (uint16_t aFcf)

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

bool IsSequencePresent (uint16_t aFcf)

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

bool IsDstAddrPresent (uint16_t aFcf)

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

bool IsSrcAddrPresent (uint16_t aFcf)

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

bool IsSecurityEnabled (uint16_t aFcf)

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

bool IsFramePending (uint16_t aFcf)

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

bool IsIePresent (uint16_t aFcf)

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

bool IsAckRequest (uint16_t aFcf)

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

bool IsVersion2015 (uint16_t aFcf)

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

uint8_t SkipSequenceIndex ()
uint8_t SkipAddrFieldIndex ()
uint8_t SkipSecurityHeaderIndex ()

Enumerations

enum Type
Name Value
kTypeBeacon 0
kTypeData 1
kTypeAck 2
kTypeMacCmd 3
kTypeMultipurpose 5

Represents the MAC frame type.

Values match the Frame Type field in Frame Control Field (FCF) as an `uint16_t`.

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

enum Version
Name Value
kVersion2003 0 << 12
kVersion2006 1 << 12
kVersion2015 2 << 12

Represents the MAC frame version.

Values match the Version field in Frame Control Field (FCF) as an `uint16_t`.

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

enum SecurityLevel
Name Value
kSecurityNone 0
kSecurityMic32 1
kSecurityMic64 2
kSecurityMic128 3
kSecurityEnc 4
kSecurityEncMic32 5
kSecurityEncMic64 6
kSecurityEncMic128 7

Represents the MAC frame security level.

Values match the Security Level field in Security Control Field as an `uint8_t`.

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

enum KeyIdMode
Name Value
kKeyIdMode0 0 << 3
kKeyIdMode1 1 << 3
kKeyIdMode2 2 << 3
kKeyIdMode3 3 << 3

Represents the MAC frame security key identifier mode.

Values match the Key Identifier Mode field in Security Control Field as an `uint8_t`.

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

enum CommandId
Name Value
kMacCmdAssociationRequest 1
kMacCmdAssociationResponse 2
kMacCmdDisassociationNotification 3
kMacCmdDataRequest 4
kMacCmdPanidConflictNotification 5
kMacCmdOrphanNotification 6
kMacCmdBeaconRequest 7
kMacCmdCoordinatorRealignment 8
kMacCmdGtsRequest 9

Represents a subset of MAC Command Identifiers.

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