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;
683 :
TestCase (
"Test case for Block Ack recipient reordering buffer operations"),
711 hdr.
SetAddr1 (Mac48Address::Allocate ());
721 "The MPDU forwarded up is not the expected one");
773 "The MPDU forwarded up is not the expected one");
778 "The MPDU forwarded up is not the expected one");
780 "The MPDU forwarded up is not the expected one");
785 "The MPDU forwarded up is not the expected one");
790 "The MPDU forwarded up is not the expected one");
795 "The MPDU forwarded up is not the expected one");
813 "The MPDU forwarded up is not the expected one");
855 "The MPDU forwarded up is not the expected one");
860 "The MPDU forwarded up is not the expected one");
865 "The MPDU forwarded up is not the expected one");
869 Simulator::Destroy ();
884 virtual void DoRun (
void);
888 :
TestCase (
"Check the correctness of Multi-STA block ack")
896 BlockAckType baType (BlockAckType::MULTI_STA, {0, 4, 8, 16, 32, 8});
903 bool ackType1 =
true;
906 blockAck.SetAid11 (aid1, 0);
907 blockAck.SetAckType (ackType1, 0);
908 blockAck.SetTidInfo (tid1, 0);
912 bool ackType2 =
false;
914 uint16_t startSeq2 = 1000;
916 blockAck.SetAid11 (aid2, 1);
917 blockAck.SetAckType (ackType2, 1);
918 blockAck.SetTidInfo (tid2, 1);
919 blockAck.SetStartingSequence (startSeq2, 1);
921 for (uint16_t i = startSeq2; i < startSeq2 + 8; i+=2)
923 blockAck.SetReceivedPacket (i, 1);
926 for (uint16_t i = startSeq2 + 9; i < startSeq2 + 16; i+=2)
928 blockAck.SetReceivedPacket (i, 1);
932 for (uint16_t i = startSeq2 + 24; i < startSeq2 + 32; i++)
934 blockAck.SetReceivedPacket (i, 1);
939 bool ackType3 =
false;
941 uint16_t startSeq3 = 2000;
943 blockAck.SetAid11 (aid3, 2);
944 blockAck.SetAckType (ackType3, 2);
945 blockAck.SetTidInfo (tid3, 2);
946 blockAck.SetStartingSequence (startSeq3, 2);
948 for (uint16_t i = startSeq3; i < startSeq3 + 8; i+=2)
950 blockAck.SetReceivedPacket (i, 2);
953 for (uint16_t i = startSeq3 + 9; i < startSeq3 + 16; i+=2)
955 blockAck.SetReceivedPacket (i, 2);
959 for (uint16_t i = startSeq3 + 24; i < startSeq3 + 32; i++)
961 blockAck.SetReceivedPacket (i, 2);
964 for (uint16_t i = startSeq3 + 32; i < startSeq3 + 36; i++)
966 blockAck.SetReceivedPacket (i, 2);
969 for (uint16_t i = startSeq3 + 44; i < startSeq3 + 48; i++)
971 blockAck.SetReceivedPacket (i, 2);
975 for (uint16_t i = startSeq3 + 56; i < startSeq3 + 64; i++)
977 blockAck.SetReceivedPacket (i, 2);
982 bool ackType4 =
false;
984 uint16_t startSeq4 = 3000;
986 blockAck.SetAid11 (aid4, 3);
987 blockAck.SetAckType (ackType4, 3);
988 blockAck.SetTidInfo (tid4, 3);
989 blockAck.SetStartingSequence (startSeq4, 3);
991 for (uint16_t i = startSeq4; i < startSeq4 + 8; i+=2)
993 blockAck.SetReceivedPacket (i, 3);
996 for (uint16_t i = startSeq4 + 9; i < startSeq4 + 16; i+=2)
998 blockAck.SetReceivedPacket (i, 3);
1002 for (uint16_t i = startSeq4 + 24; i < startSeq4 + 32; i++)
1004 blockAck.SetReceivedPacket (i, 3);
1007 for (uint16_t i = startSeq4 + 32; i < startSeq4 + 36; i++)
1009 blockAck.SetReceivedPacket (i, 3);
1012 for (uint16_t i = startSeq4 + 44; i < startSeq4 + 48; i++)
1014 blockAck.SetReceivedPacket (i, 3);
1018 for (uint16_t i = startSeq4 + 56; i < startSeq4 + 64; i++)
1020 blockAck.SetReceivedPacket (i, 3);
1024 for (uint16_t i = startSeq4 + 72; i < startSeq4 + 80; i++)
1026 blockAck.SetReceivedPacket (i, 3);
1030 for (uint16_t i = startSeq4 + 88; i < startSeq4 + 96; i++)
1032 blockAck.SetReceivedPacket (i, 3);
1036 for (uint16_t i = startSeq4 + 104; i < startSeq4 + 112; i++)
1038 blockAck.SetReceivedPacket (i, 3);
1042 for (uint16_t i = startSeq4 + 120; i < startSeq4 + 128; i++)
1044 blockAck.SetReceivedPacket (i, 3);
1048 uint16_t aid5 = 500;
1049 bool ackType5 =
false;
1051 uint16_t startSeq5 = 4000;
1053 blockAck.SetAid11 (aid5, 4);
1054 blockAck.SetAckType (ackType5, 4);
1055 blockAck.SetTidInfo (tid5, 4);
1056 blockAck.SetStartingSequence (startSeq5, 4);
1058 for (uint16_t i = startSeq5; i < startSeq5 + 8; i+=2)
1060 blockAck.SetReceivedPacket (i, 4);
1063 for (uint16_t i = startSeq5 + 9; i < startSeq5 + 16; i+=2)
1065 blockAck.SetReceivedPacket (i, 4);
1069 for (uint16_t i = startSeq5 + 24; i < startSeq5 + 32; i++)
1071 blockAck.SetReceivedPacket (i, 4);
1074 for (uint16_t i = startSeq5 + 32; i < startSeq5 + 36; i++)
1076 blockAck.SetReceivedPacket (i, 4);
1079 for (uint16_t i = startSeq5 + 44; i < startSeq5 + 48; i++)
1081 blockAck.SetReceivedPacket (i, 4);
1085 for (uint16_t i = startSeq5 + 56; i < startSeq5 + 64; i++)
1087 blockAck.SetReceivedPacket (i, 4);
1091 for (uint16_t i = startSeq5 + 72; i < startSeq5 + 80; i++)
1093 blockAck.SetReceivedPacket (i, 4);
1097 for (uint16_t i = startSeq5 + 88; i < startSeq5 + 96; i++)
1099 blockAck.SetReceivedPacket (i, 4);
1103 for (uint16_t i = (startSeq5 + 104) % 4096; i < (startSeq5 + 112) % 4096; i++)
1105 blockAck.SetReceivedPacket (i, 4);
1109 for (uint16_t i = (startSeq5 + 120) % 4096; i < (startSeq5 + 128) % 4096; i++)
1111 blockAck.SetReceivedPacket (i, 4);
1115 for (uint16_t i = (startSeq5 + 136) % 4096; i < (startSeq5 + 144) % 4096; i++)
1117 blockAck.SetReceivedPacket (i, 4);
1121 for (uint16_t i = (startSeq5 + 152) % 4096; i < (startSeq5 + 160) % 4096; i++)
1123 blockAck.SetReceivedPacket (i, 4);
1127 for (uint16_t i = (startSeq5 + 168) % 4096; i < (startSeq5 + 176) % 4096; i++)
1129 blockAck.SetReceivedPacket (i, 4);
1133 for (uint16_t i = (startSeq5 + 184) % 4096; i < (startSeq5 + 192) % 4096; i++)
1135 blockAck.SetReceivedPacket (i, 4);
1139 for (uint16_t i = (startSeq5 + 200) % 4096; i < (startSeq5 + 208) % 4096; i++)
1141 blockAck.SetReceivedPacket (i, 4);
1145 for (uint16_t i = (startSeq5 + 216) % 4096; i < (startSeq5 + 224) % 4096; i++)
1147 blockAck.SetReceivedPacket (i, 4);
1151 for (uint16_t i = (startSeq5 + 232) % 4096; i < (startSeq5 + 240) % 4096; i++)
1153 blockAck.SetReceivedPacket (i, 4);
1157 for (uint16_t i = (startSeq5 + 248) % 4096; i < (startSeq5 + 256) % 4096; i++)
1159 blockAck.SetReceivedPacket (i, 4);
1163 uint16_t aid6 = 2045;
1164 bool ackType6 =
true;
1168 blockAck.SetAid11 (aid6, 5);
1169 blockAck.SetAckType (ackType6, 5);
1170 blockAck.SetTidInfo (tid6, 5);
1171 blockAck.SetUnassociatedStaAddress (address6, 5);
1204 auto& bitmap2 = blockAckCopy.
GetBitmap (1);
1205 NS_TEST_EXPECT_MSG_EQ (bitmap2.size (), 4,
"Different bitmap length for the second Per AID TID Info subfield");
1206 NS_TEST_EXPECT_MSG_EQ (bitmap2[0], 0x55,
"Error in the 1st byte of the bitmap for the second Per AID TID Info subfield");
1207 NS_TEST_EXPECT_MSG_EQ (bitmap2[1], 0xaa,
"Error in the 2nd byte of the bitmap for the second Per AID TID Info subfield");
1208 NS_TEST_EXPECT_MSG_EQ (bitmap2[2], 0x00,
"Error in the 3rd byte of the bitmap for the second Per AID TID Info subfield");
1209 NS_TEST_EXPECT_MSG_EQ (bitmap2[3], 0xff,
"Error in the 4th byte of the bitmap for the second Per AID TID Info subfield");
1217 auto& bitmap3 = blockAckCopy.
GetBitmap (2);
1218 NS_TEST_EXPECT_MSG_EQ (bitmap3.size (), 8,
"Different bitmap length for the third Per AID TID Info subfield");
1219 NS_TEST_EXPECT_MSG_EQ (bitmap3[0], 0x55,
"Error in the 1st byte of the bitmap for the third Per AID TID Info subfield");
1220 NS_TEST_EXPECT_MSG_EQ (bitmap3[1], 0xaa,
"Error in the 2nd byte of the bitmap for the third Per AID TID Info subfield");
1221 NS_TEST_EXPECT_MSG_EQ (bitmap3[2], 0x00,
"Error in the 3rd byte of the bitmap for the third Per AID TID Info subfield");
1222 NS_TEST_EXPECT_MSG_EQ (bitmap3[3], 0xff,
"Error in the 4th byte of the bitmap for the third Per AID TID Info subfield");
1223 NS_TEST_EXPECT_MSG_EQ (bitmap3[4], 0x0f,
"Error in the 5th byte of the bitmap for the third Per AID TID Info subfield");
1224 NS_TEST_EXPECT_MSG_EQ (bitmap3[5], 0xf0,
"Error in the 6th byte of the bitmap for the third Per AID TID Info subfield");
1225 NS_TEST_EXPECT_MSG_EQ (bitmap3[6], 0x00,
"Error in the 7th byte of the bitmap for the third Per AID TID Info subfield");
1226 NS_TEST_EXPECT_MSG_EQ (bitmap3[7], 0xff,
"Error in the 8th byte of the bitmap for the third Per AID TID Info subfield");
1234 auto& bitmap4 = blockAckCopy.
GetBitmap (3);
1235 NS_TEST_EXPECT_MSG_EQ (bitmap4.size (), 16,
"Different bitmap length for the fourth Per AID TID Info subfield");
1236 NS_TEST_EXPECT_MSG_EQ (bitmap4[0], 0x55,
"Error in the 1st byte of the bitmap for the fourth Per AID TID Info subfield");
1237 NS_TEST_EXPECT_MSG_EQ (bitmap4[1], 0xaa,
"Error in the 2nd byte of the bitmap for the fourth Per AID TID Info subfield");
1238 NS_TEST_EXPECT_MSG_EQ (bitmap4[2], 0x00,
"Error in the 3rd byte of the bitmap for the fourth Per AID TID Info subfield");
1239 NS_TEST_EXPECT_MSG_EQ (bitmap4[3], 0xff,
"Error in the 4th byte of the bitmap for the fourth Per AID TID Info subfield");
1240 NS_TEST_EXPECT_MSG_EQ (bitmap4[4], 0x0f,
"Error in the 5th byte of the bitmap for the fourth Per AID TID Info subfield");
1241 NS_TEST_EXPECT_MSG_EQ (bitmap4[5], 0xf0,
"Error in the 6th byte of the bitmap for the fourth Per AID TID Info subfield");
1242 NS_TEST_EXPECT_MSG_EQ (bitmap4[6], 0x00,
"Error in the 7th byte of the bitmap for the fourth Per AID TID Info subfield");
1243 NS_TEST_EXPECT_MSG_EQ (bitmap4[7], 0xff,
"Error in the 8th byte of the bitmap for the fourth Per AID TID Info subfield");
1244 NS_TEST_EXPECT_MSG_EQ (bitmap4[8], 0x00,
"Error in the 9th byte of the bitmap for the fourth Per AID TID Info subfield");
1245 NS_TEST_EXPECT_MSG_EQ (bitmap4[9], 0xff,
"Error in the 10th byte of the bitmap for the fourth Per AID TID Info subfield");
1246 NS_TEST_EXPECT_MSG_EQ (bitmap4[10], 0x00,
"Error in the 11th byte of the bitmap for the fourth Per AID TID Info subfield");
1247 NS_TEST_EXPECT_MSG_EQ (bitmap4[11], 0xff,
"Error in the 12th byte of the bitmap for the fourth Per AID TID Info subfield");
1248 NS_TEST_EXPECT_MSG_EQ (bitmap4[12], 0x00,
"Error in the 13th byte of the bitmap for the fourth Per AID TID Info subfield");
1249 NS_TEST_EXPECT_MSG_EQ (bitmap4[13], 0xff,
"Error in the 14th byte of the bitmap for the fourth Per AID TID Info subfield");
1250 NS_TEST_EXPECT_MSG_EQ (bitmap4[14], 0x00,
"Error in the 15th byte of the bitmap for the fourth Per AID TID Info subfield");
1251 NS_TEST_EXPECT_MSG_EQ (bitmap4[15], 0xff,
"Error in the 16th byte of the bitmap for the fourth Per AID TID Info subfield");
1259 auto& bitmap5 = blockAckCopy.
GetBitmap (4);
1260 NS_TEST_EXPECT_MSG_EQ (bitmap5.size (), 32,
"Different bitmap length for the fifth Per AID TID Info subfield");
1261 NS_TEST_EXPECT_MSG_EQ (bitmap5[0], 0x55,
"Error in the 1st byte of the bitmap for the fifth Per AID TID Info subfield");
1262 NS_TEST_EXPECT_MSG_EQ (bitmap5[1], 0xaa,
"Error in the 2nd byte of the bitmap for the fifth Per AID TID Info subfield");
1263 NS_TEST_EXPECT_MSG_EQ (bitmap5[2], 0x00,
"Error in the 3rd byte of the bitmap for the fifth Per AID TID Info subfield");
1264 NS_TEST_EXPECT_MSG_EQ (bitmap5[3], 0xff,
"Error in the 4th byte of the bitmap for the fifth Per AID TID Info subfield");
1265 NS_TEST_EXPECT_MSG_EQ (bitmap5[4], 0x0f,
"Error in the 5th byte of the bitmap for the fifth Per AID TID Info subfield");
1266 NS_TEST_EXPECT_MSG_EQ (bitmap5[5], 0xf0,
"Error in the 6th byte of the bitmap for the fifth Per AID TID Info subfield");
1267 NS_TEST_EXPECT_MSG_EQ (bitmap5[6], 0x00,
"Error in the 7th byte of the bitmap for the fifth Per AID TID Info subfield");
1268 NS_TEST_EXPECT_MSG_EQ (bitmap5[7], 0xff,
"Error in the 8th byte of the bitmap for the fifth Per AID TID Info subfield");
1269 NS_TEST_EXPECT_MSG_EQ (bitmap5[8], 0x00,
"Error in the 9th byte of the bitmap for the fifth Per AID TID Info subfield");
1270 NS_TEST_EXPECT_MSG_EQ (bitmap5[9], 0xff,
"Error in the 10th byte of the bitmap for the fifth Per AID TID Info subfield");
1271 NS_TEST_EXPECT_MSG_EQ (bitmap5[10], 0x00,
"Error in the 11th byte of the bitmap for the fifth Per AID TID Info subfield");
1272 NS_TEST_EXPECT_MSG_EQ (bitmap5[11], 0xff,
"Error in the 12th byte of the bitmap for the fifth Per AID TID Info subfield");
1273 NS_TEST_EXPECT_MSG_EQ (bitmap5[12], 0x00,
"Error in the 13th byte of the bitmap for the fifth Per AID TID Info subfield");
1274 NS_TEST_EXPECT_MSG_EQ (bitmap5[13], 0xff,
"Error in the 14th byte of the bitmap for the fifth Per AID TID Info subfield");
1275 NS_TEST_EXPECT_MSG_EQ (bitmap5[14], 0x00,
"Error in the 15th byte of the bitmap for the fifth Per AID TID Info subfield");
1276 NS_TEST_EXPECT_MSG_EQ (bitmap5[15], 0xff,
"Error in the 16th byte of the bitmap for the fifth Per AID TID Info subfield");
1277 NS_TEST_EXPECT_MSG_EQ (bitmap5[16], 0x00,
"Error in the 17th byte of the bitmap for the fifth Per AID TID Info subfield");
1278 NS_TEST_EXPECT_MSG_EQ (bitmap5[17], 0xff,
"Error in the 18th byte of the bitmap for the fifth Per AID TID Info subfield");
1279 NS_TEST_EXPECT_MSG_EQ (bitmap5[18], 0x00,
"Error in the 19th byte of the bitmap for the fifth Per AID TID Info subfield");
1280 NS_TEST_EXPECT_MSG_EQ (bitmap5[19], 0xff,
"Error in the 20th byte of the bitmap for the fifth Per AID TID Info subfield");
1281 NS_TEST_EXPECT_MSG_EQ (bitmap5[20], 0x00,
"Error in the 21th byte of the bitmap for the fifth Per AID TID Info subfield");
1282 NS_TEST_EXPECT_MSG_EQ (bitmap5[21], 0xff,
"Error in the 22th byte of the bitmap for the fifth Per AID TID Info subfield");
1283 NS_TEST_EXPECT_MSG_EQ (bitmap5[22], 0x00,
"Error in the 23th byte of the bitmap for the fifth Per AID TID Info subfield");
1284 NS_TEST_EXPECT_MSG_EQ (bitmap5[23], 0xff,
"Error in the 24th byte of the bitmap for the fifth Per AID TID Info subfield");
1285 NS_TEST_EXPECT_MSG_EQ (bitmap5[24], 0x00,
"Error in the 25th byte of the bitmap for the fifth Per AID TID Info subfield");
1286 NS_TEST_EXPECT_MSG_EQ (bitmap5[25], 0xff,
"Error in the 26th byte of the bitmap for the fifth Per AID TID Info subfield");
1287 NS_TEST_EXPECT_MSG_EQ (bitmap5[26], 0x00,
"Error in the 27th byte of the bitmap for the fifth Per AID TID Info subfield");
1288 NS_TEST_EXPECT_MSG_EQ (bitmap5[27], 0xff,
"Error in the 28th byte of the bitmap for the fifth Per AID TID Info subfield");
1289 NS_TEST_EXPECT_MSG_EQ (bitmap5[28], 0x00,
"Error in the 29th byte of the bitmap for the fifth Per AID TID Info subfield");
1290 NS_TEST_EXPECT_MSG_EQ (bitmap5[29], 0xff,
"Error in the 30th byte of the bitmap for the fifth Per AID TID Info subfield");
1291 NS_TEST_EXPECT_MSG_EQ (bitmap5[30], 0x00,
"Error in the 31th byte of the bitmap for the fifth Per AID TID Info subfield");
1292 NS_TEST_EXPECT_MSG_EQ (bitmap5[31], 0xff,
"Error in the 32th byte of the bitmap for the fifth Per AID TID Info subfield");
1370 void DoRun (
void)
override;
1408 if (duration >
m_max)
1415 :
TestCase (
"Test case for Block Ack Policy with aggregation disabled"),
1505 wifi.SetRemoteStationManager (
"ns3::IdealWifiManager");
1509 mac.SetType (
"ns3::StaWifiMac",
1520 mac.SetType (
"ns3::ApWifiMac",
1532 positionAlloc->Add (Vector (0.0, 0.0, 0.0));
1533 positionAlloc->Add (Vector (1.0, 0.0, 0.0));
1534 mobility.SetPositionAllocator (positionAlloc);
1536 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
1550 sta_device->
GetMac ()->GetAttribute (
"BE_Txop", ptr);
1554 ap_device->
GetMac ()->GetAttribute (
"BE_Txop", ptr);
1565 packetSocket.
Install (wifiStaNode);
1574 client1->SetRemote (socket);
1576 client1->SetStartTime (
Seconds (1));
1577 client1->SetStopTime (
Seconds (3.0));
1587 client2->SetRemote (socket);
1589 client2->SetStartTime (
Seconds (1.5));
1590 client2->SetStopTime (
Seconds (3.0));
1593 server->SetLocal (socket);
1595 server->SetStartTime (
Seconds (0.0));
1596 server->SetStopTime (
Seconds (4.0));
1602 Simulator::Stop (
Seconds (5));
1605 Simulator::Destroy ();
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)
Keep track of MPDUs 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.
const 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.
void Trace(Time startTime, Time duration)
Callback for the TxopTrace trace.
Time m_max
max TXOP duration
The different BlockAck variants.
enum Variant m_variant
Block Ack variant.
std::vector< uint8_t > m_bitmapLen
Length (bytes) of included bitmaps.