--- a/src/devices/wifi/ctrl-headers.cc Fri Aug 20 08:17:10 2010 -0700
+++ b/src/devices/wifi/ctrl-headers.cc Fri Aug 20 19:06:19 2010 +0200
@@ -547,6 +547,8 @@
void
CtrlBAckResponseHeader::SetReceivedPacket (uint16_t seq)
{
+ if (!IsInBitmap (seq))
+ return;
if (!m_multiTid)
{
if (!m_compressed)
@@ -557,7 +559,7 @@
}
else
{
- bitmap.m_compressedBitmap |= (0x0000000000000001 << IndexInBitmap (seq));
+ bitmap.m_compressedBitmap |= (uint64_t(0x0000000000000001) << IndexInBitmap (seq));
}
}
else
@@ -577,6 +579,8 @@
CtrlBAckResponseHeader::SetReceivedFragment (uint16_t seq, uint8_t frag)
{
NS_ASSERT (frag < 16);
+ if (!IsInBitmap (seq))
+ return;
if (!m_multiTid)
{
if (!m_compressed)
@@ -605,6 +609,8 @@
bool
CtrlBAckResponseHeader::IsPacketReceived (uint16_t seq) const
{
+ if (!IsInBitmap (seq))
+ return false;
if (!m_multiTid)
{
if (!m_compressed)
@@ -614,7 +620,7 @@
}
else
{
- uint64_t mask = 0x0000000000000001;
+ uint64_t mask = uint64_t(0x0000000000000001);
return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1)?true:false;
}
}
@@ -636,6 +642,8 @@
CtrlBAckResponseHeader::IsFragmentReceived (uint16_t seq, uint8_t frag) const
{
NS_ASSERT (frag < 16);
+ if (!IsInBitmap (seq))
+ return false;
if (!m_multiTid)
{
if (!m_compressed)
@@ -647,7 +655,7 @@
/* Although this could make no sense, if packet with sequence number
equal to <i>seq</i> was correctly received, also all of its fragments
were correctly received. */
- uint64_t mask = 0x0000000000000001;
+ uint64_t mask = uint64_t(0x0000000000000001);
return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1)?true:false;
}
}
@@ -668,14 +676,35 @@
uint8_t
CtrlBAckResponseHeader::IndexInBitmap (uint16_t seq) const
{
+ uint8_t index;
if (seq >= m_startingSeq)
{
- return (seq - m_startingSeq);
+ index = seq - m_startingSeq;
}
else
{
- return (4096 - m_startingSeq + seq);
+ index = 4096 - m_startingSeq + seq;
}
+ NS_ASSERT (index <= 63);
+ return index;
+}
+
+bool
+CtrlBAckResponseHeader::IsInBitmap (uint16_t seq) const
+{
+ return (seq - m_startingSeq + 4096) % 4096 < 64;
+}
+
+const uint16_t*
+CtrlBAckResponseHeader::GetBitmap (void) const
+{
+ return bitmap.m_bitmap;
+}
+
+uint64_t
+CtrlBAckResponseHeader::GetCompressedBitmap (void) const
+{
+ return bitmap.m_compressedBitmap;
}
} //namespace ns3
--- a/src/devices/wifi/ctrl-headers.h Fri Aug 20 08:17:10 2010 -0700
+++ b/src/devices/wifi/ctrl-headers.h Fri Aug 20 19:06:19 2010 +0200
@@ -114,6 +114,8 @@
uint16_t GetStartingSequenceControl (void) const;
void SetStartingSequenceControl (uint16_t seqControl);
+ const uint16_t* GetBitmap (void) const;
+ uint64_t GetCompressedBitmap (void) const;
private:
@@ -135,6 +137,10 @@
* for more details see 7.2.1.8 in IEEE 802.11n/D4.00
*/
uint8_t IndexInBitmap (uint16_t seq) const;
+ /**
+ * Checks if sequence number <i>seq</i> can be acknowledged in the bitmap.
+ */
+ bool IsInBitmap (uint16_t seq) const;
/**
* The lsb bit of the BA control field is used only for the