22#include "ns3/double.h"
23#include "ns3/boolean.h"
24#include "ns3/string.h"
25#include "ns3/qos-utils.h"
26#include "ns3/ctrl-headers.h"
27#include "ns3/packet.h"
28#include "ns3/wifi-net-device.h"
29#include "ns3/ap-wifi-mac.h"
30#include "ns3/wifi-mac-header.h"
31#include "ns3/mobility-helper.h"
32#include "ns3/yans-wifi-helper.h"
33#include "ns3/packet-socket-server.h"
34#include "ns3/packet-socket-client.h"
35#include "ns3/packet-socket-helper.h"
36#include "ns3/config.h"
37#include "ns3/pointer.h"
38#include "ns3/recipient-block-ack-agreement.h"
39#include "ns3/mac-rx-middle.h"
40#include "ns3/qos-txop.h"
41#include "ns3/originator-block-ack-agreement.h"
42#include "ns3/wifi-mac-queue-item.h"
90 void DoRun (
void)
override;
95 :
TestCase (
"Check correct order of buffering when startSequence < endSeq")
111 std::list<uint16_t> m_buffer;
112 std::list<uint16_t>::iterator i,j;
113 m_buffer.push_back (0);
114 m_buffer.push_back (16);
115 m_buffer.push_back (56000);
117 uint16_t endSeq = 4000;
119 uint16_t receivedSeq = 4001 * 16;
122 for (i = m_buffer.begin (); i != m_buffer.end (); i++)
130 m_buffer.insert (i, receivedSeq);
132 receivedSeq = 3999 * 16;
135 for (i = m_buffer.begin (); i != m_buffer.end (); i++)
143 m_buffer.insert (i, receivedSeq);
145 for (i = m_buffer.begin (), j =
m_expectedBuffer.begin (); i != m_buffer.end (); i++, j++)
187 void DoRun (
void)
override;
192 :
TestCase (
"Check correct order of buffering when startSequence > endSeq")
209 std::list<uint16_t> m_buffer;
210 std::list<uint16_t>::iterator i,j;
211 m_buffer.push_back (256);
212 m_buffer.push_back (64000);
213 m_buffer.push_back (16);
215 uint16_t endSeq = 10;
217 uint16_t receivedSeq = 15 * 16;
220 for (i = m_buffer.begin (); i != m_buffer.end (); i++)
228 m_buffer.insert (i, receivedSeq);
230 receivedSeq = 15 * 16 + 1;
233 for (i = m_buffer.begin (); i != m_buffer.end (); i++)
241 m_buffer.insert (i, receivedSeq);
243 receivedSeq = 4050 * 16;
246 for (i = m_buffer.begin (); i != m_buffer.end (); i++)
254 m_buffer.insert (i, receivedSeq);
256 for (i = m_buffer.begin (), j =
m_expectedBuffer.begin (); i != m_buffer.end (); i++, j++)
273 void DoRun (
void)
override;
277 :
TestCase (
"Check the correctness of the originator block ack window")
284 uint16_t winSize = 16;
285 uint16_t startingSeq = 4090;
295 for (uint16_t i = 0; i < winSize; i++)
304 uint16_t seqNumber = startingSeq;
305 mpdu->GetHeader ().SetSequenceNumber (seqNumber);
329 for (uint16_t i = 0; i < winSize; i++)
362 for (uint16_t i = 5; i < winSize; i++)
369 mpdu->GetHeader ().SetSequenceNumber (startingSeq);
381 for (uint16_t i = 0; i < winSize; i++)
388 mpdu->GetHeader ().SetSequenceNumber (seqNumber);
401 mpdu->GetHeader ().SetSequenceNumber (seqNumber);
430 for (uint16_t i = 12; i < winSize; i++)
438 mpdu->GetHeader ().SetSequenceNumber (seqNumber);
450 "Incorrect starting sequence after transmitting an MPDU beyond the current window");
461 for (uint16_t i = 10; i < winSize; i++)
469 mpdu->GetHeader ().SetSequenceNumber (seqNumber);
481 "Incorrect starting sequence after transmitting another MPDU beyond the current window");
487 for (uint16_t i = 5; i < winSize; i++)
495 mpdu->GetHeader ().SetSequenceNumber (seqNumber);
507 "Incorrect starting sequence after discarding an MPDU");
508 for (uint16_t i = 0; i < winSize; i++)
515 for (uint16_t i = 1; i < winSize; i++)
517 mpdu->GetHeader ().SetSequenceNumber ((startingSeq + i) %
SEQNO_SPACE_SIZE);
529 "Incorrect starting sequence after acknowledging all but the first MPDU");
531 for (uint16_t i = 1; i < winSize; i++)
549 "Incorrect starting sequence after acknowledging the first MPDU");
550 for (uint16_t i = 0; i < winSize; i++)
568 void DoRun (
void)
override;
573 :
TestCase (
"Check the correctness of block ack compressed bitmap")
585 for (uint16_t i = 179; i < 220; i++)
589 for (uint16_t i = 225; i <= 242; i++)
619 for (uint16_t i = 4090; i != 10; i = (i + 1) % 4096)
623 for (uint16_t i = 22; i < 25; i++)
668 void DoRun (
void)
override;
684 :
TestCase (
"Test case for Block Ack recipient reordering buffer operations"),
712 hdr.
SetAddr1 (Mac48Address::Allocate ());
722 "The MPDU forwarded up is not the expected one");
774 "The MPDU forwarded up is not the expected one");
779 "The MPDU forwarded up is not the expected one");
781 "The MPDU forwarded up is not the expected one");
786 "The MPDU forwarded up is not the expected one");
791 "The MPDU forwarded up is not the expected one");
796 "The MPDU forwarded up is not the expected one");
814 "The MPDU forwarded up is not the expected one");
856 "The MPDU forwarded up is not the expected one");
861 "The MPDU forwarded up is not the expected one");
866 "The MPDU forwarded up is not the expected one");
870 Simulator::Destroy ();
885 virtual void DoRun (
void);
889 :
TestCase (
"Check the correctness of Multi-STA block ack")
897 BlockAckType baType (BlockAckType::MULTI_STA, {0, 4, 8, 16, 32, 8});
904 bool ackType1 =
true;
907 blockAck.SetAid11 (aid1, 0);
908 blockAck.SetAckType (ackType1, 0);
909 blockAck.SetTidInfo (tid1, 0);
913 bool ackType2 =
false;
915 uint16_t startSeq2 = 1000;
917 blockAck.SetAid11 (aid2, 1);
918 blockAck.SetAckType (ackType2, 1);
919 blockAck.SetTidInfo (tid2, 1);
920 blockAck.SetStartingSequence (startSeq2, 1);
922 for (uint16_t i = startSeq2; i < startSeq2 + 8; i+=2)
924 blockAck.SetReceivedPacket (i, 1);
927 for (uint16_t i = startSeq2 + 9; i < startSeq2 + 16; i+=2)
929 blockAck.SetReceivedPacket (i, 1);
933 for (uint16_t i = startSeq2 + 24; i < startSeq2 + 32; i++)
935 blockAck.SetReceivedPacket (i, 1);
940 bool ackType3 =
false;
942 uint16_t startSeq3 = 2000;
944 blockAck.SetAid11 (aid3, 2);
945 blockAck.SetAckType (ackType3, 2);
946 blockAck.SetTidInfo (tid3, 2);
947 blockAck.SetStartingSequence (startSeq3, 2);
949 for (uint16_t i = startSeq3; i < startSeq3 + 8; i+=2)
951 blockAck.SetReceivedPacket (i, 2);
954 for (uint16_t i = startSeq3 + 9; i < startSeq3 + 16; i+=2)
956 blockAck.SetReceivedPacket (i, 2);
960 for (uint16_t i = startSeq3 + 24; i < startSeq3 + 32; i++)
962 blockAck.SetReceivedPacket (i, 2);
965 for (uint16_t i = startSeq3 + 32; i < startSeq3 + 36; i++)
967 blockAck.SetReceivedPacket (i, 2);
970 for (uint16_t i = startSeq3 + 44; i < startSeq3 + 48; i++)
972 blockAck.SetReceivedPacket (i, 2);
976 for (uint16_t i = startSeq3 + 56; i < startSeq3 + 64; i++)
978 blockAck.SetReceivedPacket (i, 2);
983 bool ackType4 =
false;
985 uint16_t startSeq4 = 3000;
987 blockAck.SetAid11 (aid4, 3);
988 blockAck.SetAckType (ackType4, 3);
989 blockAck.SetTidInfo (tid4, 3);
990 blockAck.SetStartingSequence (startSeq4, 3);
992 for (uint16_t i = startSeq4; i < startSeq4 + 8; i+=2)
994 blockAck.SetReceivedPacket (i, 3);
997 for (uint16_t i = startSeq4 + 9; i < startSeq4 + 16; i+=2)
999 blockAck.SetReceivedPacket (i, 3);
1003 for (uint16_t i = startSeq4 + 24; i < startSeq4 + 32; i++)
1005 blockAck.SetReceivedPacket (i, 3);
1008 for (uint16_t i = startSeq4 + 32; i < startSeq4 + 36; i++)
1010 blockAck.SetReceivedPacket (i, 3);
1013 for (uint16_t i = startSeq4 + 44; i < startSeq4 + 48; i++)
1015 blockAck.SetReceivedPacket (i, 3);
1019 for (uint16_t i = startSeq4 + 56; i < startSeq4 + 64; i++)
1021 blockAck.SetReceivedPacket (i, 3);
1025 for (uint16_t i = startSeq4 + 72; i < startSeq4 + 80; i++)
1027 blockAck.SetReceivedPacket (i, 3);
1031 for (uint16_t i = startSeq4 + 88; i < startSeq4 + 96; i++)
1033 blockAck.SetReceivedPacket (i, 3);
1037 for (uint16_t i = startSeq4 + 104; i < startSeq4 + 112; i++)
1039 blockAck.SetReceivedPacket (i, 3);
1043 for (uint16_t i = startSeq4 + 120; i < startSeq4 + 128; i++)
1045 blockAck.SetReceivedPacket (i, 3);
1049 uint16_t aid5 = 500;
1050 bool ackType5 =
false;
1052 uint16_t startSeq5 = 4000;
1054 blockAck.SetAid11 (aid5, 4);
1055 blockAck.SetAckType (ackType5, 4);
1056 blockAck.SetTidInfo (tid5, 4);
1057 blockAck.SetStartingSequence (startSeq5, 4);
1059 for (uint16_t i = startSeq5; i < startSeq5 + 8; i+=2)
1061 blockAck.SetReceivedPacket (i, 4);
1064 for (uint16_t i = startSeq5 + 9; i < startSeq5 + 16; i+=2)
1066 blockAck.SetReceivedPacket (i, 4);
1070 for (uint16_t i = startSeq5 + 24; i < startSeq5 + 32; i++)
1072 blockAck.SetReceivedPacket (i, 4);
1075 for (uint16_t i = startSeq5 + 32; i < startSeq5 + 36; i++)
1077 blockAck.SetReceivedPacket (i, 4);
1080 for (uint16_t i = startSeq5 + 44; i < startSeq5 + 48; i++)
1082 blockAck.SetReceivedPacket (i, 4);
1086 for (uint16_t i = startSeq5 + 56; i < startSeq5 + 64; i++)
1088 blockAck.SetReceivedPacket (i, 4);
1092 for (uint16_t i = startSeq5 + 72; i < startSeq5 + 80; i++)
1094 blockAck.SetReceivedPacket (i, 4);
1098 for (uint16_t i = startSeq5 + 88; i < startSeq5 + 96; i++)
1100 blockAck.SetReceivedPacket (i, 4);
1104 for (uint16_t i = (startSeq5 + 104) % 4096; i < (startSeq5 + 112) % 4096; i++)
1106 blockAck.SetReceivedPacket (i, 4);
1110 for (uint16_t i = (startSeq5 + 120) % 4096; i < (startSeq5 + 128) % 4096; i++)
1112 blockAck.SetReceivedPacket (i, 4);
1116 for (uint16_t i = (startSeq5 + 136) % 4096; i < (startSeq5 + 144) % 4096; i++)
1118 blockAck.SetReceivedPacket (i, 4);
1122 for (uint16_t i = (startSeq5 + 152) % 4096; i < (startSeq5 + 160) % 4096; i++)
1124 blockAck.SetReceivedPacket (i, 4);
1128 for (uint16_t i = (startSeq5 + 168) % 4096; i < (startSeq5 + 176) % 4096; i++)
1130 blockAck.SetReceivedPacket (i, 4);
1134 for (uint16_t i = (startSeq5 + 184) % 4096; i < (startSeq5 + 192) % 4096; i++)
1136 blockAck.SetReceivedPacket (i, 4);
1140 for (uint16_t i = (startSeq5 + 200) % 4096; i < (startSeq5 + 208) % 4096; i++)
1142 blockAck.SetReceivedPacket (i, 4);
1146 for (uint16_t i = (startSeq5 + 216) % 4096; i < (startSeq5 + 224) % 4096; i++)
1148 blockAck.SetReceivedPacket (i, 4);
1152 for (uint16_t i = (startSeq5 + 232) % 4096; i < (startSeq5 + 240) % 4096; i++)
1154 blockAck.SetReceivedPacket (i, 4);
1158 for (uint16_t i = (startSeq5 + 248) % 4096; i < (startSeq5 + 256) % 4096; i++)
1160 blockAck.SetReceivedPacket (i, 4);
1164 uint16_t aid6 = 2045;
1165 bool ackType6 =
true;
1169 blockAck.SetAid11 (aid6, 5);
1170 blockAck.SetAckType (ackType6, 5);
1171 blockAck.SetTidInfo (tid6, 5);
1172 blockAck.SetUnassociatedStaAddress (address6, 5);
1205 auto& bitmap2 = blockAckCopy.
GetBitmap (1);
1206 NS_TEST_EXPECT_MSG_EQ (bitmap2.size (), 4,
"Different bitmap length for the second Per AID TID Info subfield");
1207 NS_TEST_EXPECT_MSG_EQ (bitmap2[0], 0x55,
"Error in the 1st byte of the bitmap for the second Per AID TID Info subfield");
1208 NS_TEST_EXPECT_MSG_EQ (bitmap2[1], 0xaa,
"Error in the 2nd byte of the bitmap for the second Per AID TID Info subfield");
1209 NS_TEST_EXPECT_MSG_EQ (bitmap2[2], 0x00,
"Error in the 3rd byte of the bitmap for the second Per AID TID Info subfield");
1210 NS_TEST_EXPECT_MSG_EQ (bitmap2[3], 0xff,
"Error in the 4th byte of the bitmap for the second Per AID TID Info subfield");
1218 auto& bitmap3 = blockAckCopy.
GetBitmap (2);
1219 NS_TEST_EXPECT_MSG_EQ (bitmap3.size (), 8,
"Different bitmap length for the third Per AID TID Info subfield");
1220 NS_TEST_EXPECT_MSG_EQ (bitmap3[0], 0x55,
"Error in the 1st byte of the bitmap for the third Per AID TID Info subfield");
1221 NS_TEST_EXPECT_MSG_EQ (bitmap3[1], 0xaa,
"Error in the 2nd byte of the bitmap for the third Per AID TID Info subfield");
1222 NS_TEST_EXPECT_MSG_EQ (bitmap3[2], 0x00,
"Error in the 3rd byte of the bitmap for the third Per AID TID Info subfield");
1223 NS_TEST_EXPECT_MSG_EQ (bitmap3[3], 0xff,
"Error in the 4th byte of the bitmap for the third Per AID TID Info subfield");
1224 NS_TEST_EXPECT_MSG_EQ (bitmap3[4], 0x0f,
"Error in the 5th byte of the bitmap for the third Per AID TID Info subfield");
1225 NS_TEST_EXPECT_MSG_EQ (bitmap3[5], 0xf0,
"Error in the 6th byte of the bitmap for the third Per AID TID Info subfield");
1226 NS_TEST_EXPECT_MSG_EQ (bitmap3[6], 0x00,
"Error in the 7th byte of the bitmap for the third Per AID TID Info subfield");
1227 NS_TEST_EXPECT_MSG_EQ (bitmap3[7], 0xff,
"Error in the 8th byte of the bitmap for the third Per AID TID Info subfield");
1235 auto& bitmap4 = blockAckCopy.
GetBitmap (3);
1236 NS_TEST_EXPECT_MSG_EQ (bitmap4.size (), 16,
"Different bitmap length for the fourth Per AID TID Info subfield");
1237 NS_TEST_EXPECT_MSG_EQ (bitmap4[0], 0x55,
"Error in the 1st byte of the bitmap for the fourth Per AID TID Info subfield");
1238 NS_TEST_EXPECT_MSG_EQ (bitmap4[1], 0xaa,
"Error in the 2nd byte of the bitmap for the fourth Per AID TID Info subfield");
1239 NS_TEST_EXPECT_MSG_EQ (bitmap4[2], 0x00,
"Error in the 3rd byte of the bitmap for the fourth Per AID TID Info subfield");
1240 NS_TEST_EXPECT_MSG_EQ (bitmap4[3], 0xff,
"Error in the 4th byte of the bitmap for the fourth Per AID TID Info subfield");
1241 NS_TEST_EXPECT_MSG_EQ (bitmap4[4], 0x0f,
"Error in the 5th byte of the bitmap for the fourth Per AID TID Info subfield");
1242 NS_TEST_EXPECT_MSG_EQ (bitmap4[5], 0xf0,
"Error in the 6th byte of the bitmap for the fourth Per AID TID Info subfield");
1243 NS_TEST_EXPECT_MSG_EQ (bitmap4[6], 0x00,
"Error in the 7th byte of the bitmap for the fourth Per AID TID Info subfield");
1244 NS_TEST_EXPECT_MSG_EQ (bitmap4[7], 0xff,
"Error in the 8th byte of the bitmap for the fourth Per AID TID Info subfield");
1245 NS_TEST_EXPECT_MSG_EQ (bitmap4[8], 0x00,
"Error in the 9th byte of the bitmap for the fourth Per AID TID Info subfield");
1246 NS_TEST_EXPECT_MSG_EQ (bitmap4[9], 0xff,
"Error in the 10th byte of the bitmap for the fourth Per AID TID Info subfield");
1247 NS_TEST_EXPECT_MSG_EQ (bitmap4[10], 0x00,
"Error in the 11th byte of the bitmap for the fourth Per AID TID Info subfield");
1248 NS_TEST_EXPECT_MSG_EQ (bitmap4[11], 0xff,
"Error in the 12th byte of the bitmap for the fourth Per AID TID Info subfield");
1249 NS_TEST_EXPECT_MSG_EQ (bitmap4[12], 0x00,
"Error in the 13th byte of the bitmap for the fourth Per AID TID Info subfield");
1250 NS_TEST_EXPECT_MSG_EQ (bitmap4[13], 0xff,
"Error in the 14th byte of the bitmap for the fourth Per AID TID Info subfield");
1251 NS_TEST_EXPECT_MSG_EQ (bitmap4[14], 0x00,
"Error in the 15th byte of the bitmap for the fourth Per AID TID Info subfield");
1252 NS_TEST_EXPECT_MSG_EQ (bitmap4[15], 0xff,
"Error in the 16th byte of the bitmap for the fourth Per AID TID Info subfield");
1260 auto& bitmap5 = blockAckCopy.
GetBitmap (4);
1261 NS_TEST_EXPECT_MSG_EQ (bitmap5.size (), 32,
"Different bitmap length for the fifth Per AID TID Info subfield");
1262 NS_TEST_EXPECT_MSG_EQ (bitmap5[0], 0x55,
"Error in the 1st byte of the bitmap for the fifth Per AID TID Info subfield");
1263 NS_TEST_EXPECT_MSG_EQ (bitmap5[1], 0xaa,
"Error in the 2nd byte of the bitmap for the fifth Per AID TID Info subfield");
1264 NS_TEST_EXPECT_MSG_EQ (bitmap5[2], 0x00,
"Error in the 3rd byte of the bitmap for the fifth Per AID TID Info subfield");
1265 NS_TEST_EXPECT_MSG_EQ (bitmap5[3], 0xff,
"Error in the 4th byte of the bitmap for the fifth Per AID TID Info subfield");
1266 NS_TEST_EXPECT_MSG_EQ (bitmap5[4], 0x0f,
"Error in the 5th byte of the bitmap for the fifth Per AID TID Info subfield");
1267 NS_TEST_EXPECT_MSG_EQ (bitmap5[5], 0xf0,
"Error in the 6th byte of the bitmap for the fifth Per AID TID Info subfield");
1268 NS_TEST_EXPECT_MSG_EQ (bitmap5[6], 0x00,
"Error in the 7th byte of the bitmap for the fifth Per AID TID Info subfield");
1269 NS_TEST_EXPECT_MSG_EQ (bitmap5[7], 0xff,
"Error in the 8th byte of the bitmap for the fifth Per AID TID Info subfield");
1270 NS_TEST_EXPECT_MSG_EQ (bitmap5[8], 0x00,
"Error in the 9th byte of the bitmap for the fifth Per AID TID Info subfield");
1271 NS_TEST_EXPECT_MSG_EQ (bitmap5[9], 0xff,
"Error in the 10th byte of the bitmap for the fifth Per AID TID Info subfield");
1272 NS_TEST_EXPECT_MSG_EQ (bitmap5[10], 0x00,
"Error in the 11th byte of the bitmap for the fifth Per AID TID Info subfield");
1273 NS_TEST_EXPECT_MSG_EQ (bitmap5[11], 0xff,
"Error in the 12th byte of the bitmap for the fifth Per AID TID Info subfield");
1274 NS_TEST_EXPECT_MSG_EQ (bitmap5[12], 0x00,
"Error in the 13th byte of the bitmap for the fifth Per AID TID Info subfield");
1275 NS_TEST_EXPECT_MSG_EQ (bitmap5[13], 0xff,
"Error in the 14th byte of the bitmap for the fifth Per AID TID Info subfield");
1276 NS_TEST_EXPECT_MSG_EQ (bitmap5[14], 0x00,
"Error in the 15th byte of the bitmap for the fifth Per AID TID Info subfield");
1277 NS_TEST_EXPECT_MSG_EQ (bitmap5[15], 0xff,
"Error in the 16th byte of the bitmap for the fifth Per AID TID Info subfield");
1278 NS_TEST_EXPECT_MSG_EQ (bitmap5[16], 0x00,
"Error in the 17th byte of the bitmap for the fifth Per AID TID Info subfield");
1279 NS_TEST_EXPECT_MSG_EQ (bitmap5[17], 0xff,
"Error in the 18th byte of the bitmap for the fifth Per AID TID Info subfield");
1280 NS_TEST_EXPECT_MSG_EQ (bitmap5[18], 0x00,
"Error in the 19th byte of the bitmap for the fifth Per AID TID Info subfield");
1281 NS_TEST_EXPECT_MSG_EQ (bitmap5[19], 0xff,
"Error in the 20th byte of the bitmap for the fifth Per AID TID Info subfield");
1282 NS_TEST_EXPECT_MSG_EQ (bitmap5[20], 0x00,
"Error in the 21th byte of the bitmap for the fifth Per AID TID Info subfield");
1283 NS_TEST_EXPECT_MSG_EQ (bitmap5[21], 0xff,
"Error in the 22th byte of the bitmap for the fifth Per AID TID Info subfield");
1284 NS_TEST_EXPECT_MSG_EQ (bitmap5[22], 0x00,
"Error in the 23th byte of the bitmap for the fifth Per AID TID Info subfield");
1285 NS_TEST_EXPECT_MSG_EQ (bitmap5[23], 0xff,
"Error in the 24th byte of the bitmap for the fifth Per AID TID Info subfield");
1286 NS_TEST_EXPECT_MSG_EQ (bitmap5[24], 0x00,
"Error in the 25th byte of the bitmap for the fifth Per AID TID Info subfield");
1287 NS_TEST_EXPECT_MSG_EQ (bitmap5[25], 0xff,
"Error in the 26th byte of the bitmap for the fifth Per AID TID Info subfield");
1288 NS_TEST_EXPECT_MSG_EQ (bitmap5[26], 0x00,
"Error in the 27th byte of the bitmap for the fifth Per AID TID Info subfield");
1289 NS_TEST_EXPECT_MSG_EQ (bitmap5[27], 0xff,
"Error in the 28th byte of the bitmap for the fifth Per AID TID Info subfield");
1290 NS_TEST_EXPECT_MSG_EQ (bitmap5[28], 0x00,
"Error in the 29th byte of the bitmap for the fifth Per AID TID Info subfield");
1291 NS_TEST_EXPECT_MSG_EQ (bitmap5[29], 0xff,
"Error in the 30th byte of the bitmap for the fifth Per AID TID Info subfield");
1292 NS_TEST_EXPECT_MSG_EQ (bitmap5[30], 0x00,
"Error in the 31th byte of the bitmap for the fifth Per AID TID Info subfield");
1293 NS_TEST_EXPECT_MSG_EQ (bitmap5[31], 0xff,
"Error in the 32th byte of the bitmap for the fifth Per AID TID Info subfield");
1372 void DoRun (
void)
override;
1411 if (duration >
m_max)
1418 :
TestCase (
"Test case for Block Ack Policy with aggregation disabled"),
1508 wifi.SetRemoteStationManager (
"ns3::IdealWifiManager");
1512 mac.SetType (
"ns3::StaWifiMac",
1523 mac.SetType (
"ns3::ApWifiMac",
1535 positionAlloc->Add (Vector (0.0, 0.0, 0.0));
1536 positionAlloc->Add (Vector (1.0, 0.0, 0.0));
1537 mobility.SetPositionAllocator (positionAlloc);
1539 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
1553 sta_device->
GetMac ()->GetAttribute (
"BE_Txop", ptr);
1557 ap_device->
GetMac ()->GetAttribute (
"BE_Txop", ptr);
1568 packetSocket.
Install (wifiStaNode);
1577 client1->SetRemote (socket);
1579 client1->SetStartTime (
Seconds (1));
1580 client1->SetStopTime (
Seconds (3.0));
1590 client2->SetRemote (socket);
1592 client2->SetStartTime (
Seconds (1.5));
1593 client2->SetStopTime (
Seconds (3.0));
1596 server->SetLocal (socket);
1598 server->SetStartTime (
Seconds (0.0));
1599 server->SetStopTime (
Seconds (4.0));
1605 Simulator::Stop (
Seconds (5));
1608 Simulator::Destroy ();
void Run(ObjectFactory &factory, uint32_t pop, uint32_t total, uint32_t runs, Ptr< RandomVariableStream > eventStream, bool calRev)
Perform the runs for a single scheduler type.
static BlockAckTestSuite g_blockAckTestSuite
the test suite
Test for Block Ack Policy with aggregation disabled.
virtual ~BlockAckAggregationDisabledTest()
uint16_t m_nBa
received BlockAck frames
void DoRun(void) override
Implementation to actually run this TestCase.
uint16_t m_txTotal
transmitted data packets
void L7Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Function to trace packets received by the server application.
BlockAckAggregationDisabledTest(bool txop)
Constructor.
uint16_t m_nBar
transmitted BlockAckReq frames
void Receive(std::string context, Ptr< const Packet > p, RxPowerWattPerChannelBand rxPowersW)
Callback invoked when PHY receives a packet.
void Transmit(std::string context, Ptr< const Packet > p, double power)
Callback invoked when PHY transmits a packet.
uint16_t m_txSinceBar
packets transmitted since the agreement was established or the last block ack was received
uint32_t m_received
received packets
bool m_txop
true for non-null TXOP limit
Test for recipient reordering buffer operations.
void DoRun(void) override
Implementation to actually run this TestCase.
uint16_t m_ssn
the Starting Sequence Number used to initialize WinStartB
void ForwardUp(Ptr< WifiMacQueueItem > mpdu, uint8_t linkId)
Keep track of MPDUs received on the given link that are forwarded up.
BlockAckRecipientBufferTest(uint16_t ssn)
Constructor.
virtual ~BlockAckRecipientBufferTest()
std::list< Ptr< WifiMacQueueItem > > m_fwup
list of MPDUs that have been forwarded up
Test for the originator block ack window.
OriginatorBlockAckWindowTest()
void DoRun(void) override
Implementation to actually run this TestCase.
void DoRun(void) override
Implementation to actually run this TestCase.
virtual ~PacketBufferingCaseA()
std::list< uint16_t > m_expectedBuffer
expected test buffer
std::list< uint16_t > m_expectedBuffer
expected test buffer
void DoRun(void) override
Implementation to actually run this TestCase.
virtual ~PacketBufferingCaseB()
a polymophic address class
void SetStartingSequence(uint16_t seq)
Set starting sequence number.
void SetBufferSize(uint16_t bufferSize)
Set buffer size.
std::size_t GetWinSize(void) const
Get the window size.
uint16_t GetWinStart(void) const
Get the current winStart value.
std::vector< bool >::reference At(std::size_t distance)
Get a reference to the element in the window having the given distance from the current winStart.
uint16_t GetWinEnd(void) const
Get the current winEnd value.
AttributeValue implementation for Boolean.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Maintains the state and information about transmitted MPDUs with Ack Policy set to Block Ack for an o...
void InitTxWindow(void)
Initialize the originator's transmit window by setting its size and starting sequence number equal to...
void NotifyAckedMpdu(Ptr< const WifiMacQueueItem > mpdu)
Record that the given MPDU has been acknowledged and advance the transmit window if possible.
void NotifyTransmittedMpdu(Ptr< const WifiMacQueueItem > mpdu)
Advance the transmit window so as to include the transmitted MPDU, if the latter is not an old packet...
BlockAckWindow m_txWindow
originator's transmit window
uint16_t GetStartingSequence(void) const override
Return the starting sequence number of the transmit window, if a transmit window has been initialized...
void NotifyDiscardedMpdu(Ptr< const WifiMacQueueItem > mpdu)
Advance the transmit window beyond the MPDU that has been reported to be discarded.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Hold objects of type Ptr<T>.
Smart pointer class similar to boost::intrusive_ptr.
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Maintains the scoreboard and the receive reordering buffer used by a recipient of a Block Ack agreeme...
void NotifyReceivedBar(uint16_t startingSequenceNumber)
Update both the scoreboard and the receive reordering buffer upon reception of a Block Ack Request.
void NotifyReceivedMpdu(Ptr< WifiMacQueueItem > mpdu)
Update both the scoreboard and the receive reordering buffer upon reception of the given MPDU.
void SetMacRxMiddle(const Ptr< MacRxMiddle > rxMiddle)
Set the MAC RX Middle to use.
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
Hold an unsigned integer type.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
Ptr< WifiMac > GetMac(void) const
Address GetAddress(void) const override
uint32_t GetIfIndex(void) const override
manage and create wifi channel objects for the YANS model.
Make it easy to create and manage PHY objects for the YANS model.
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
uint32_t QosUtilsMapSeqControlToUniqueInteger(uint16_t seqControl, uint16_t endSequence)
Next function is useful to correctly sort buffered packets under block ack.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
static constexpr uint16_t SEQNO_SPACE_SIZE
Size of the space of sequence numbers.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Keeps the maximum duration among all TXOPs.
Time m_max
max TXOP duration
void Trace(Time startTime, Time duration, uint8_t linkId)
Callback for the TxopTrace trace.
The different BlockAck variants.
enum Variant m_variant
Block Ack variant.
std::vector< uint8_t > m_bitmapLen
Length (bytes) of included bitmaps.