Lines Matching full:index

92     uint8_t index = FindPayloadIndex();  in ValidatePsdu()  local
94 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in ValidatePsdu()
95 VerifyOrExit((index + GetFooterLength()) <= mLength, error = kErrorParse); in ValidatePsdu()
127 uint8_t index; in FindDstPanIdIndex() local
129 VerifyOrExit(IsDstPanIdPresent(), index = kInvalidIndex); in FindDstPanIdIndex()
131 index = kFcfSize + kDsnSize; in FindDstPanIdIndex()
134 return index; in FindDstPanIdIndex()
172 uint8_t index = FindDstPanIdIndex(); in GetDstPanId() local
174 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in GetDstPanId()
175 aPanId = ReadUint16(&mPsdu[index]); in GetDstPanId()
183 uint8_t index = FindDstPanIdIndex(); in SetDstPanId() local
185 OT_ASSERT(index != kInvalidIndex); in SetDstPanId()
186 WriteUint16(aPanId, &mPsdu[index]); in SetDstPanId()
197 uint8_t index = FindDstAddrIndex(); in GetDstAddr() local
199 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in GetDstAddr()
204 aAddress.SetShort(ReadUint16(&mPsdu[index])); in GetDstAddr()
208 aAddress.SetExtended(&mPsdu[index], ExtAddress::kReverseByteOrder); in GetDstAddr()
228 uint8_t index = FindDstAddrIndex(); in SetDstAddr() local
231 OT_ASSERT(index != kInvalidIndex); in SetDstAddr()
233 aExtAddress.CopyTo(&mPsdu[index], ExtAddress::kReverseByteOrder); in SetDstAddr()
256 uint8_t index = 0; in FindSrcPanIdIndex() local
259 VerifyOrExit(IsSrcPanIdPresent(), index = kInvalidIndex); in FindSrcPanIdIndex()
261 index += kFcfSize + kDsnSize; in FindSrcPanIdIndex()
265 index += sizeof(PanId); in FindSrcPanIdIndex()
271 index += sizeof(ShortAddress); in FindSrcPanIdIndex()
275 index += sizeof(ExtAddress); in FindSrcPanIdIndex()
280 return index; in FindSrcPanIdIndex()
310 uint8_t index = FindSrcPanIdIndex(); in GetSrcPanId() local
312 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in GetSrcPanId()
313 aPanId = ReadUint16(&mPsdu[index]); in GetSrcPanId()
322 uint8_t index = FindSrcPanIdIndex(); in SetSrcPanId() local
324 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in SetSrcPanId()
325 WriteUint16(aPanId, &mPsdu[index]); in SetSrcPanId()
333 uint8_t index = 0; in FindSrcAddrIndex() local
336 index += kFcfSize + kDsnSize; in FindSrcAddrIndex()
340 index += sizeof(PanId); in FindSrcAddrIndex()
346 index += sizeof(ShortAddress); in FindSrcAddrIndex()
350 index += sizeof(ExtAddress); in FindSrcAddrIndex()
356 index += sizeof(PanId); in FindSrcAddrIndex()
359 return index; in FindSrcAddrIndex()
365 uint8_t index = FindSrcAddrIndex(); in GetSrcAddr() local
368 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in GetSrcAddr()
373 aAddress.SetShort(ReadUint16(&mPsdu[index])); in GetSrcAddr()
377 aAddress.SetExtended(&mPsdu[index], ExtAddress::kReverseByteOrder); in GetSrcAddr()
391 uint8_t index = FindSrcAddrIndex(); in SetSrcAddr() local
394 OT_ASSERT(index != kInvalidIndex); in SetSrcAddr()
396 WriteUint16(aShortAddress, &mPsdu[index]); in SetSrcAddr()
401 uint8_t index = FindSrcAddrIndex(); in SetSrcAddr() local
404 OT_ASSERT(index != kInvalidIndex); in SetSrcAddr()
406 aExtAddress.CopyTo(&mPsdu[index], ExtAddress::kReverseByteOrder); in SetSrcAddr()
429 uint8_t index = FindSecurityHeaderIndex(); in GetSecurityControlField() local
431 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in GetSecurityControlField()
433 aSecurityControlField = mPsdu[index]; in GetSecurityControlField()
441 uint8_t index = FindSecurityHeaderIndex(); in SetSecurityControlField() local
443 OT_ASSERT(index != kInvalidIndex); in SetSecurityControlField()
445 mPsdu[index] = aSecurityControlField; in SetSecurityControlField()
450 uint8_t index; in FindSecurityHeaderIndex() local
452 VerifyOrExit(kFcfSize < mLength, index = kInvalidIndex); in FindSecurityHeaderIndex()
453 VerifyOrExit(GetSecurityEnabled(), index = kInvalidIndex); in FindSecurityHeaderIndex()
454 index = SkipAddrFieldIndex(); in FindSecurityHeaderIndex()
457 return index; in FindSecurityHeaderIndex()
463 uint8_t index = FindSecurityHeaderIndex(); in GetSecurityLevel() local
465 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in GetSecurityLevel()
467 aSecurityLevel = mPsdu[index] & kSecLevelMask; in GetSecurityLevel()
476 uint8_t index = FindSecurityHeaderIndex(); in GetKeyIdMode() local
478 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in GetKeyIdMode()
480 aKeyIdMode = mPsdu[index] & kKeyIdModeMask; in GetKeyIdMode()
489 uint8_t index = FindSecurityHeaderIndex(); in GetFrameCounter() local
491 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in GetFrameCounter()
494 index += kSecurityControlSize; in GetFrameCounter()
496 aFrameCounter = ReadUint32(&mPsdu[index]); in GetFrameCounter()
504 uint8_t index = FindSecurityHeaderIndex(); in SetFrameCounter() local
506 OT_ASSERT(index != kInvalidIndex); in SetFrameCounter()
509 index += kSecurityControlSize; in SetFrameCounter()
511 WriteUint32(aFrameCounter, &mPsdu[index]); in SetFrameCounter()
518 uint8_t index = FindSecurityHeaderIndex(); in GetKeySource() local
520 OT_ASSERT(index != kInvalidIndex); in GetKeySource()
522 return &mPsdu[index + kSecurityControlSize + kFrameCounterSize]; in GetKeySource()
554 uint8_t index = FindSecurityHeaderIndex(); in SetKeySource() local
556 OT_ASSERT(index != kInvalidIndex); in SetKeySource()
558 keySourceLength = GetKeySourceLength(mPsdu[index] & kKeyIdModeMask); in SetKeySource()
560 memcpy(&mPsdu[index + kSecurityControlSize + kFrameCounterSize], aKeySource, keySourceLength); in SetKeySource()
567 uint8_t index = FindSecurityHeaderIndex(); in GetKeyId() local
569 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in GetKeyId()
571 keySourceLength = GetKeySourceLength(mPsdu[index] & kKeyIdModeMask); in GetKeyId()
573 aKeyId = mPsdu[index + kSecurityControlSize + kFrameCounterSize + keySourceLength]; in GetKeyId()
582 uint8_t index = FindSecurityHeaderIndex(); in SetKeyId() local
584 OT_ASSERT(index != kInvalidIndex); in SetKeyId()
586 keySourceLength = GetKeySourceLength(mPsdu[index] & kKeyIdModeMask); in SetKeyId()
588 mPsdu[index + kSecurityControlSize + kFrameCounterSize + keySourceLength] = aKeyId; in SetKeyId()
594 uint8_t index = FindPayloadIndex(); in GetCommandId() local
596 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in GetCommandId()
598 aCommandId = mPsdu[IsVersion2015() ? index : (index - 1)]; in GetCommandId()
607 uint8_t index = FindPayloadIndex(); in SetCommandId() local
609 VerifyOrExit(index != kInvalidIndex, error = kErrorParse); in SetCommandId()
611 mPsdu[IsVersion2015() ? index : (index - 1)] = aCommandId; in SetCommandId()
638 uint8_t index = FindSecurityHeaderIndex(); in GetFooterLength() local
640 VerifyOrExit(index != kInvalidIndex); in GetFooterLength()
641 footerLength += CalculateMicSize(mPsdu[index]); in GetFooterLength()
694 uint8_t index = SkipAddrFieldIndex(); in SkipSecurityHeaderIndex() local
696 VerifyOrExit(index != kInvalidIndex); in SkipSecurityHeaderIndex()
703 VerifyOrExit(index < mLength, index = kInvalidIndex); in SkipSecurityHeaderIndex()
704 securityControl = mPsdu[index]; in SkipSecurityHeaderIndex()
707 VerifyOrExit(headerSize != kInvalidSize, index = kInvalidIndex); in SkipSecurityHeaderIndex()
709 index += headerSize; in SkipSecurityHeaderIndex()
711 VerifyOrExit(index <= mLength, index = kInvalidIndex); in SkipSecurityHeaderIndex()
715 return index; in SkipSecurityHeaderIndex()
749 uint8_t index; in SkipAddrFieldIndex() local
751 VerifyOrExit(kFcfSize + kDsnSize + GetFcsSize() <= mLength, index = kInvalidIndex); in SkipAddrFieldIndex()
753 index = CalculateAddrFieldSize(GetFrameControlField()); in SkipAddrFieldIndex()
756 return index; in SkipAddrFieldIndex()
820 // We use `uint16_t` for `index` to handle its potential roll-over in FindPayloadIndex()
823 uint16_t index = SkipSecurityHeaderIndex(); in FindPayloadIndex() local
825 VerifyOrExit(index != kInvalidIndex); in FindPayloadIndex()
834 const HeaderIe *ie = reinterpret_cast<const HeaderIe *>(&mPsdu[index]); in FindPayloadIndex()
836 index += sizeof(HeaderIe); in FindPayloadIndex()
837 VerifyOrExit(index + footerLength <= mLength, index = kInvalidIndex); in FindPayloadIndex()
839 index += ie->GetLength(); in FindPayloadIndex()
840 VerifyOrExit(index + footerLength <= mLength, index = kInvalidIndex); in FindPayloadIndex()
847 // If the `index + footerLength == mLength`, we exit the `while()` in FindPayloadIndex()
854 } while (index + footerLength < mLength); in FindPayloadIndex()
862 index += kCommandIdSize; in FindPayloadIndex()
866 return static_cast<uint8_t>(index); in FindPayloadIndex()
871 uint8_t index = FindPayloadIndex(); in GetPayload() local
874 VerifyOrExit(index != kInvalidIndex, payload = nullptr); in GetPayload()
875 payload = &mPsdu[index]; in GetPayload()
889 uint8_t index; in FindHeaderIeIndex() local
891 VerifyOrExit(IsIePresent(), index = kInvalidIndex); in FindHeaderIeIndex()
893 index = SkipSecurityHeaderIndex(); in FindHeaderIeIndex()
896 return index; in FindHeaderIeIndex()
954 uint8_t index = FindHeaderIeIndex(); in GetHeaderIe() local
961 VerifyOrExit((index != kInvalidIndex) && (payloadIndex != kInvalidIndex)); in GetHeaderIe()
963 while (index <= payloadIndex) in GetHeaderIe()
965 const HeaderIe *ie = reinterpret_cast<const HeaderIe *>(&mPsdu[index]); in GetHeaderIe()
969 header = &mPsdu[index]; in GetHeaderIe()
973 index += sizeof(HeaderIe) + ie->GetLength(); in GetHeaderIe()
983 uint8_t index = FindHeaderIeIndex(); in GetThreadIe() local
989 VerifyOrExit((index != kInvalidIndex) && (payloadIndex != kInvalidIndex)); in GetThreadIe()
991 while (index <= payloadIndex) in GetThreadIe()
993 const HeaderIe *ie = reinterpret_cast<const HeaderIe *>(&mPsdu[index]); in GetThreadIe()
1001 header = &mPsdu[index]; in GetThreadIe()
1006 index += sizeof(HeaderIe) + ie->GetLength(); in GetThreadIe()