diff --git a/src/network/utils/radiotap-header.cc b/src/network/utils/radiotap-header.cc index 4488c90a1..bc9f9e294 100644 --- a/src/network/utils/radiotap-header.cc +++ b/src/network/utils/radiotap-header.cc @@ -59,6 +59,10 @@ RadiotapHeader::Serialize(Buffer::Iterator start) const start.WriteU8(0); // pad field start.WriteU16(m_length); // entire length of radiotap data + header start.WriteU32(m_present); // bits describing which fields follow header + if (m_presentExt) + { + start.WriteU32(*m_presentExt); // extended bitmasks + } // // Time Synchronization Function Timer (when the first bit of the MPDU @@ -272,6 +276,13 @@ RadiotapHeader::Deserialize(Buffer::Iterator start) uint32_t bytesRead = 8; + if (m_present & RADIOTAP_EXT) + { + // If bit 31 of the it_present field is set, an extended it_present bitmask is present. + m_presentExt = start.ReadU32(); + bytesRead += 4; + } + // // Time Synchronization Function Timer (when the first bit of the MPDU arrived at the MAC) // Reference: https://www.radiotap.org/fields/TSFT.html diff --git a/src/network/utils/radiotap-header.h b/src/network/utils/radiotap-header.h index 42ec65a91..dd71db62a 100644 --- a/src/network/utils/radiotap-header.h +++ b/src/network/utils/radiotap-header.h @@ -13,6 +13,7 @@ #include #include +#include namespace ns3 { @@ -496,6 +497,15 @@ class RadiotapHeader : public Header */ void SetHeMuOtherUserFields(const HeMuOtherUserFields& heMuOtherUserFields); + /** + * structure that contains the subfields of the TLV fields. + */ + struct TlvFields + { + uint16_t type{0}; //!< type field. + uint16_t length{0}; //!< length field. + }; + private: /** * Serialize the Channel radiotap header. @@ -693,11 +703,23 @@ class RadiotapHeader : public Header RADIOTAP_HE_MU_OTHER_USER = 0x02000000, RADIOTAP_ZERO_LEN_PSDU = 0x04000000, RADIOTAP_LSIG = 0x08000000, + RADIOTAP_TLV = 0x10000000, RADIOTAP_EXT = 0x80000000 }; - uint16_t m_length{8}; //!< entire length of radiotap data + header - uint32_t m_present{0}; //!< bits describing which fields follow header + /** + * @brief Radiotap extended flags. + */ + enum RadiotapExtFlags : uint32_t + { + RADIOTAP_S1G = 0x00000001, + RADIOTAP_USIG = 0x00000002, + RADIOTAP_EHT_SIG = 0x00000004 + }; + + uint16_t m_length{8}; //!< entire length of radiotap data + header + uint32_t m_present{0}; //!< bits describing which fields follow header + std::optional m_presentExt{}; //!< optional extended present bitmask uint64_t m_tsft{0}; //!< Time Synchronization Function Timer (when the first bit of the MPDU //!< arrived at the MAC)