wifi: Add delimiter signature check to AmpduSubframeHeader

This commit is contained in:
Rediet
2019-04-01 11:09:41 +02:00
committed by Stefano Avallone
parent 9039b59fd2
commit 647c36848c
2 changed files with 23 additions and 6 deletions

View File

@@ -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

View File

@@ -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