diff --git a/src/wifi/model/ampdu-subframe-header.cc b/src/wifi/model/ampdu-subframe-header.cc index 1e3d9bac6..16a8b2318 100644 --- a/src/wifi/model/ampdu-subframe-header.cc +++ b/src/wifi/model/ampdu-subframe-header.cc @@ -44,7 +44,8 @@ AmpduSubframeHeader::GetInstanceTypeId (void) const AmpduSubframeHeader::AmpduSubframeHeader () : m_length (0), - m_eof (0) + m_eof (0), + m_signature (0x4E) // Per 802.11 standard, the unique pattern is set to the value 0x4E. { } @@ -63,7 +64,7 @@ AmpduSubframeHeader::Serialize (Buffer::Iterator i) const { i.WriteHtolsbU16 ((m_eof << 15) | m_length); i.WriteU8 (1); //not used, CRC always set to 1 - i.WriteU8 (0x4E); // Per 802.11 standard, the unique pattern is set to the value 0x4E. + i.WriteU8 (m_signature); } uint32_t @@ -74,14 +75,15 @@ AmpduSubframeHeader::Deserialize (Buffer::Iterator start) m_eof = (field & 0x8000) >> 15; m_length = (field & 0x3fff); i.ReadU8 (); //CRC - i.ReadU8 (); //SIG + m_signature = i.ReadU8 (); //SIG return i.GetDistanceFrom (start); } void AmpduSubframeHeader::Print (std::ostream &os) const { - os << "EOF = " << m_eof << ", length = " << m_length; + os << "EOF = " << m_eof << ", length = " << m_length + << ", signature = 0x" << std::hex << m_signature; } void @@ -108,4 +110,10 @@ AmpduSubframeHeader::GetEof (void) const return m_eof; } +bool +AmpduSubframeHeader::IsSignatureValid (void) const +{ + return m_signature == 0x4E; +} + } //namespace ns3 diff --git a/src/wifi/model/ampdu-subframe-header.h b/src/wifi/model/ampdu-subframe-header.h index 54f0febde..3246d068d 100644 --- a/src/wifi/model/ampdu-subframe-header.h +++ b/src/wifi/model/ampdu-subframe-header.h @@ -70,10 +70,19 @@ public: * \return the EOF field */ bool GetEof (void) const; + /** + * Return whether the pattern stored in the delimiter + * signature field is correct, i.e. corresponds to the + * unique pattern 0x4E. + * + * \return true if the signature is valid, false otherwise + */ + bool IsSignatureValid (void) const; private: - uint16_t m_length; //!< length field - bool m_eof; //!< EOF field + uint16_t m_length; //!< length field + bool m_eof; //!< EOF field + uint8_t m_signature; //!< delimiter signature (should correspond to pattern 0x4E in order to be assumed valid) }; } //namespace ns3