class Frame

Defined at line 64 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 uint8_t kKeySourceSizeMode0
static const uint8_t kKeySourceSizeMode1
static const uint8_t kKeySourceSizeMode2
static const uint8_t kKeySourceSizeMode3
static const uint16_t kInfoStringSize

Protected Members

static const uint8_t kFcfSize
static const uint8_t kDsnSize
static const uint8_t kSeqNumIndex
static const uint8_t kImmAckLength
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 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 kFcfSeqSuppression
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 kFcfVersionShift
static const uint16_t kFcfVersionMask
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 uint8_t kScfKeyIdModeShift
static const uint8_t kScfSecLevelMask
static const uint8_t kScfKeyIdModeMask
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 kInvalidIndex
static const uint8_t kInvalidSize
static const uint8_t kMaxPsduSize

Public Methods

Error DetermineLengths (Lengths & aLengths)

Determines the length breakdown of the frame.

Parameters

aLengths [out] A reference to a `Lengths` structure to return the frame lengths.
void SetFramePending (bool aFramePending)

Sets the Frame Pending bit.

Parameters

aFramePending [in] The Frame Pending bit.

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

void SetAckRequest (bool aAckRequest)

Sets the Ack Request bit.

Parameters

aAckRequest [in] The Ack Request bit.

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

void SetIePresent (bool aIePresent)

Sets the IE Present bit.

Parameters

aIePresent [in] The IE Present bit.

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

uint8_t GetImmAckLength ()

Returns the Immediate Acknowledgment (Imm-Ack) frame length in bytes.

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

uint8_t ConstructSecurityControlField (SecurityLevel aSecurityLevel, KeyIdMode aKeyIdMode)

Constructs a Security Control byte from a given Security Level and Key ID Mode.

Parameters

aSecurityLevel [in] The Security Level.
aKeyIdMode [in] The Key Identifier Mode.

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

void UpdateEnhAckProbingIe (const uint8_t * aData, uint8_t aLen)

Finds Enhanced ACK Probing (Vendor Specific) IE and updates its Link Metrics Data content.

Parameters

aData [in] A pointer to the data to write.
aLen [in] The length of

Protected Methods

bool IsDstPanIdPresent (uint16_t aFcf)
uint16_t GetFrameControlField ()

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

uint8_t ReadType (uint16_t aFcf)

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

AddrMode ReadDstAddrMode (uint16_t aFcf)

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

AddrMode ReadSrcAddrMode (uint16_t aFcf)

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

bool IsSeqSuppressed (uint16_t aFcf)

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

bool IsSeqPresent (uint16_t aFcf)

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

bool IsDstAddrPresent (uint16_t aFcf)

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

bool IsSrcAddrPresent (uint16_t aFcf)

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

bool IsSecurityEnabled (uint16_t aFcf)

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

bool IsFramePending (uint16_t aFcf)

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

bool IsIePresent (uint16_t aFcf)

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

bool IsAckRequest (uint16_t aFcf)

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

void UpdateFcfFlag (bool aSet, uint16_t aBitFlag)
bool IsSrcPanIdPresent (uint16_t aFcf)
AddrMode DetermineAddrMode (const Address & aAddress)
uint8_t CalculateKeySourceSize (KeyIdMode aKeyIdMode)
uint8_t CalculateMicSize (SecurityLevel aSecurityLevel)
uint16_t ConstructFrameControlField (Type aType, uint8_t aVersion)
SecurityLevel ReadSecurityLevel (uint8_t aSecCtl)

Security Control fields

KeyIdMode ReadKeyIdMode (uint8_t aSecCtl)
uint8_t ReadVersion (uint16_t aFcf)

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

bool IsVersion2015 (uint16_t aFcf)

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

Enumerations

enum Type : uint8_t
Name Value Comments
kTypeBeacon 0

Beacon Frame Type.

kTypeData 1

Data Frame Type.

kTypeAck 2

Ack Frame Type.

kTypeMacCmd 3

MAC Command Frame Type.

Represents the MAC frame type.

Values match the Frame Type field in Frame Control Field (FCF).

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

enum Version : uint8_t
Name Value Comments
kVersion2003 0

2003 Frame Version.

kVersion2006 1

2006 Frame Version.

kVersion2015 2

2015 Frame Version.

Represents the MAC frame version.

Values match the raw (unshifted) Version sub-field (2-bit wide) in Frame Control Field (FCF). The enum does

not cover all possible 2-bit values.

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

enum SecurityLevel : uint8_t
Name Value Comments
kSecurityNone 0

No security.

kSecurityMic32 1

No encryption, MIC-32 authentication.

kSecurityMic64 2

No encryption, MIC-64 authentication.

kSecurityMic128 3

No encryption, MIC-128 authentication.

kSecurityEnc 4

Encryption, no authentication

kSecurityEncMic32 5

Encryption with MIC-32 authentication.

kSecurityEncMic64 6

Encryption with MIC-64 authentication.

kSecurityEncMic128 7

Encryption with MIC-128 authentication.

Represents the MAC frame security level.

Values represent the raw (unshifted) Security Level sub-field (3-bit wide) from the Security Control field.

The enum covers all possible 3-bit values.

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

enum KeyIdMode : uint8_t
Name Value Comments
kKeyIdMode0 0

Key ID Mode 0 - Key is determined implicitly.

kKeyIdMode1 1

Key ID Mode 1 - Key is determined from Key Index field.

kKeyIdMode2 2

Key ID Mode 2 - Key is determined from 4-bytes Key Source and Index fields.

kKeyIdMode3 3

Key ID Mode 3 - Key is determined from 8-bytes Key Source and Index fields.

Represents the MAC frame security key identifier mode.

Values represent the raw (unshifted) Key ID Mode sub-field (2-bit wide) from the Security Control field.

The enum covers all possible 2-bit values.

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

enum CommandId : uint8_t
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 131 of file ../../third_party/openthread/src/core/mac/mac_frame.hpp

enum ParseMode : uint8_t
Name Value Comments
kParseAddrFields 0

Parse up through address fields (FCF, SecNum, PAN IDs, Addrs) and FCS.

kParseSecurityHeader 1

Parse up through Auxiliary Security Header (requires security enabled).

kParseFully 2

Parse all headers fully.

Specifies the parsing mode for `ParseInfo::ParseFrom()`.

In `kParseSecurityHeader` mode, the frame is explicitly required to have security enabled in FCF; otherwise

`kErrorNotFound` is returned.

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

enum AddrMode : uint8_t
Name Value
kAddrModeNone 0
kAddrModeReserved 1
kAddrModeShort 2
kAddrModeExt 3

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

Records