A Discrete-Event Network Simulator
API
wifi-txop.cc
Go to the documentation of this file.
1  /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Stefano Avallone <stavallo@unina.it>
19  */
20 
21 #include "ns3/test.h"
22 #include "ns3/string.h"
23 #include "ns3/qos-utils.h"
24 #include "ns3/packet.h"
25 #include "ns3/wifi-net-device.h"
26 #include "ns3/wifi-mac-header.h"
27 #include "ns3/mobility-helper.h"
28 #include "ns3/spectrum-wifi-helper.h"
29 #include "ns3/single-model-spectrum-channel.h"
30 #include "ns3/packet-socket-server.h"
31 #include "ns3/packet-socket-client.h"
32 #include "ns3/packet-socket-helper.h"
33 #include "ns3/config.h"
34 #include "ns3/pointer.h"
35 #include "ns3/rng-seed-manager.h"
36 #include "ns3/wifi-psdu.h"
37 #include "ns3/wifi-ppdu.h"
38 #include "ns3/ap-wifi-mac.h"
39 
40 using namespace ns3;
41 
42 
51 class WifiTxopTest : public TestCase
52 {
53 public:
58  WifiTxopTest (bool pifsRecovery);
59  virtual ~WifiTxopTest ();
60 
67  void L7Receive (std::string context, Ptr<const Packet> p, const Address &addr);
75  void Transmit (std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
79  void CheckResults (void);
80 
81 private:
82  virtual void DoRun (void);
83 
85  struct FrameInfo
86  {
91  };
92 
93  uint16_t m_nStations;
96  std::vector<FrameInfo> m_txPsdus;
98  uint8_t m_aifsn;
99  uint32_t m_cwMin;
100  uint16_t m_received;
102 };
103 
104 WifiTxopTest::WifiTxopTest (bool pifsRecovery)
105  : TestCase ("Check correct operation within TXOPs"),
106  m_nStations (3),
107  m_txopLimit (MicroSeconds (4768)),
108  m_received (0),
109  m_pifsRecovery (pifsRecovery)
110 {
111 }
112 
114 {
115 }
116 
117 void
118 WifiTxopTest::L7Receive (std::string context, Ptr<const Packet> p, const Address &addr)
119 {
120  if (p->GetSize () >= 500)
121  {
122  m_received++;
123  }
124 }
125 
126 void
127 WifiTxopTest::Transmit (std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
128 {
129  // Log all transmitted frames that are not beacon frames and have been transmitted
130  // after 400ms (so as to skip association requests/responses)
131  if (!psduMap.begin ()->second->GetHeader (0).IsBeacon ()
132  && Simulator::Now () > MilliSeconds (400))
133  {
134  m_txPsdus.push_back ({Simulator::Now (),
135  WifiPhy::CalculateTxDuration (psduMap, txVector, WIFI_PHY_BAND_5GHZ),
136  psduMap[SU_STA_ID]->GetHeader (0), txVector});
137  }
138 
139  // Print all the transmitted frames if the test is executed through test-runner
140  std::cout << Simulator::Now () << " " << psduMap.begin ()->second->GetHeader (0).GetTypeString ()
141  << " seq " << psduMap.begin ()->second->GetHeader (0).GetSequenceNumber ()
142  << " to " << psduMap.begin ()->second->GetAddr1 ()
143  << " TX duration " << WifiPhy::CalculateTxDuration (psduMap, txVector, WIFI_PHY_BAND_5GHZ)
144  << " duration/ID " << psduMap.begin ()->second->GetHeader (0).GetDuration () << std::endl;
145 }
146 
147 void
149 {
150  RngSeedManager::SetSeed (1);
151  RngSeedManager::SetRun (40);
152  int64_t streamNumber = 100;
153 
155  wifiApNode.Create (1);
156 
158  wifiStaNodes.Create (m_nStations);
159 
160  Ptr<SingleModelSpectrumChannel> spectrumChannel = CreateObject<SingleModelSpectrumChannel> ();
161  Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel> ();
162  spectrumChannel->AddPropagationLossModel (lossModel);
163  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
164  spectrumChannel->SetPropagationDelayModel (delayModel);
165 
167  phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
168  phy.SetChannel (spectrumChannel);
169 
170  Config::SetDefault ("ns3::QosFrameExchangeManager::PifsRecovery", BooleanValue (m_pifsRecovery));
171  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", UintegerValue (1900));
172 
174  wifi.SetStandard (WIFI_STANDARD_80211a);
175  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
176  "DataMode", StringValue ("OfdmRate12Mbps"),
177  "ControlMode", StringValue ("OfdmRate6Mbps"));
178 
180  mac.SetType ("ns3::StaWifiMac",
181  "QosSupported", BooleanValue (true),
182  "Ssid", SsidValue (Ssid ("non-existent-ssid")));
183 
184  m_staDevices = wifi.Install (phy, mac, wifiStaNodes);
185 
186  mac.SetType ("ns3::ApWifiMac",
187  "QosSupported", BooleanValue (true),
188  "Ssid", SsidValue (Ssid ("wifi-txop-ssid")),
189  "BeaconInterval", TimeValue (MicroSeconds (102400)),
190  "EnableBeaconJitter", BooleanValue (false));
191 
192  m_apDevices = wifi.Install (phy, mac, wifiApNode);
193 
194  // schedule association requests at different times
195  Time init = MilliSeconds (100);
196  Ptr<WifiNetDevice> dev;
197 
198  for (uint16_t i = 0; i < m_nStations; i++)
199  {
200  dev = DynamicCast<WifiNetDevice> (m_staDevices.Get (i));
201  Simulator::Schedule (init + i * MicroSeconds (102400), &WifiMac::SetSsid,
202  dev->GetMac (), Ssid ("wifi-txop-ssid"));
203  }
204 
205  // Assign fixed streams to random variables in use
206  wifi.AssignStreams (m_apDevices, streamNumber);
207 
209  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
210 
211  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
212  positionAlloc->Add (Vector (1.0, 0.0, 0.0));
213  positionAlloc->Add (Vector (0.0, 1.0, 0.0));
214  positionAlloc->Add (Vector (-1.0, 0.0, 0.0));
215  mobility.SetPositionAllocator (positionAlloc);
216 
217  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
218  mobility.Install (wifiApNode);
219  mobility.Install (wifiStaNodes);
220 
221  // set the TXOP limit on BE AC
222  dev = DynamicCast<WifiNetDevice> (m_apDevices.Get (0));
223  PointerValue ptr;
224  dev->GetMac ()->GetAttribute ("BE_Txop", ptr);
225  ptr.Get<QosTxop> ()->SetTxopLimit (m_txopLimit);
226  m_aifsn = ptr.Get<QosTxop> ()->GetAifsn ();
227  m_cwMin = ptr.Get<QosTxop> ()->GetMinCw ();
228 
229  PacketSocketHelper packetSocket;
230  packetSocket.Install (wifiApNode);
231  packetSocket.Install (wifiStaNodes);
232 
233  // DL frames
234  for (uint16_t i = 0; i < m_nStations; i++)
235  {
236  PacketSocketAddress socket;
237  socket.SetSingleDevice (m_apDevices.Get (0)->GetIfIndex ());
238  socket.SetPhysicalAddress (m_staDevices.Get (i)->GetAddress ());
239  socket.SetProtocol (1);
240 
241  // Send one QoS data frame (not protected by RTS/CTS) to each station
242  Ptr<PacketSocketClient> client1 = CreateObject<PacketSocketClient> ();
243  client1->SetAttribute ("PacketSize", UintegerValue (500));
244  client1->SetAttribute ("MaxPackets", UintegerValue (1));
245  client1->SetAttribute ("Interval", TimeValue (MicroSeconds (1)));
246  client1->SetRemote (socket);
247  wifiApNode.Get (0)->AddApplication (client1);
248  client1->SetStartTime (MilliSeconds (410));
249  client1->SetStopTime (Seconds (1.0));
250 
251  // Send one QoS data frame (protected by RTS/CTS) to each station
252  Ptr<PacketSocketClient> client2 = CreateObject<PacketSocketClient> ();
253  client2->SetAttribute ("PacketSize", UintegerValue (2000));
254  client2->SetAttribute ("MaxPackets", UintegerValue (1));
255  client2->SetAttribute ("Interval", TimeValue (MicroSeconds (1)));
256  client2->SetRemote (socket);
257  wifiApNode.Get (0)->AddApplication (client2);
258  client2->SetStartTime (MilliSeconds (520));
259  client2->SetStopTime (Seconds (1.0));
260 
261  Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
262  server->SetLocal (socket);
263  wifiStaNodes.Get (i)->AddApplication (server);
264  server->SetStartTime (Seconds (0.0));
265  server->SetStopTime (Seconds (1.0));
266  }
267 
268  // The AP does not correctly receive the Ack sent in response to the QoS
269  // data frame sent to the first station
270  Ptr<ReceiveListErrorModel> apPem = CreateObject<ReceiveListErrorModel> ();
271  apPem->SetList ({6});
272  dev = DynamicCast<WifiNetDevice> (m_apDevices.Get (0));
273  dev->GetMac ()->GetWifiPhy ()->SetPostReceptionErrorModel (apPem);
274 
275  // The second station does not correctly receive the first QoS
276  // data frame sent by the AP
277  Ptr<ReceiveListErrorModel> sta2Pem = CreateObject<ReceiveListErrorModel> ();
278  sta2Pem->SetList ({19});
279  dev = DynamicCast<WifiNetDevice> (m_staDevices.Get (1));
280  dev->GetMac ()->GetWifiPhy ()->SetPostReceptionErrorModel (sta2Pem);
281 
282  // UL Traffic (the first station sends one frame to the AP)
283  {
284  PacketSocketAddress socket;
285  socket.SetSingleDevice (m_staDevices.Get (0)->GetIfIndex ());
286  socket.SetPhysicalAddress (m_apDevices.Get (0)->GetAddress ());
287  socket.SetProtocol (1);
288 
289  Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient> ();
290  client->SetAttribute ("PacketSize", UintegerValue (1500));
291  client->SetAttribute ("MaxPackets", UintegerValue (1));
292  client->SetAttribute ("Interval", TimeValue (MicroSeconds (0)));
293  client->SetRemote (socket);
294  wifiStaNodes.Get (0)->AddApplication (client);
295  client->SetStartTime (MilliSeconds (412));
296  client->SetStopTime (Seconds (1.0));
297 
298  Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
299  server->SetLocal (socket);
300  wifiApNode.Get (0)->AddApplication (server);
301  server->SetStartTime (Seconds (0.0));
302  server->SetStopTime (Seconds (1.0));
303  }
304 
305  Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::PacketSocketServer/Rx",
307  // Trace PSDUs passed to the PHY on all devices
308  Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxPsduBegin",
310 
311  Simulator::Stop (Seconds (1));
312  Simulator::Run ();
313 
314  CheckResults ();
315 
316  Simulator::Destroy ();
317 }
318 
319 void
321 {
322  Time tEnd, // TX end for a frame
323  tStart, // TX start fot the next frame
324  txopStart, // TXOP start time
325  tolerance = NanoSeconds (50), // due to propagation delay
326  sifs = DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetPhy ()->GetSifs (),
327  slot = DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetPhy ()->GetSlot (),
328  navEnd;
329 
330  // lambda to round Duration/ID (in microseconds) up to the next higher integer
331  auto RoundDurationId = [] (Time t)
332  {
333  return MicroSeconds (ceil (static_cast<double> (t.GetNanoSeconds ()) / 1000));
334  };
335 
336  /*
337  * Verify the different behavior followed when an initial/non-initial frame of a TXOP
338  * fails. Also, verify that a CF-end frame is sent if enough time remains in the TXOP.
339  * The destination of failed frames is put in square brackets below.
340  *
341  * |---NAV-----till end TXOP--------->|
342  * | |----NAV--till end TXOP---->|
343  * | | |---------------------------NAV---------------------------------->|
344  * | | | |--------------------------NAV---------------------------->|
345  * | | | | |------------------------NAV----------------------->|
346  * | | | | | |-------------NAV--------------->|
347  * Start| | Start| | | | |----------NAV----------->|
348  * TXOP | | TXOP | | | Ack | | |-------NAV------->|
349  * | | | | | | | Timeout | | | |---NAV---->|
350  * |---| |---|-backoff->|---| |---| |---| |-PIFS or->|---| |---| |---| |---| |-----|
351  * |QoS| |Ack| |QoS| |Ack| |QoS| |-backoff->|QoS| |Ack| |QoS| |Ack| |CFend|
352  * ----------------------------------------------------------------------------------------------------
353  * From: AP STA1 AP STA1 AP AP STA2 AP STA3 AP
354  * To: STA1 [AP] STA1 AP [STA2] STA2 AP STA3 AP all
355  */
356 
357  NS_TEST_EXPECT_MSG_EQ (m_txPsdus.size (), 25, "Expected 25 transmitted frames");
358 
359  // the first frame sent after 400ms is a QoS data frame sent by the AP to STA1
360  txopStart = m_txPsdus[0].txStart;
361 
362  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[0].header.IsQosData (), true,
363  "Expected a QoS data frame");
364  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[0].header.GetAddr1 (),
365  DynamicCast<WifiNetDevice> (m_staDevices.Get (0))->GetMac ()->GetAddress (),
366  "Expected a frame sent by the AP to the first station");
367  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[0].header.GetDuration (),
368  RoundDurationId (m_txopLimit - m_txPsdus[0].txDuration),
369  "Duration/ID of the first frame must cover the whole TXOP");
370 
371  // a Normal Ack is sent by STA1
372  tEnd = m_txPsdus[0].txStart + m_txPsdus[0].txDuration;
373  tStart = m_txPsdus[1].txStart;
374 
375  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Ack in response to the first frame sent too early");
376  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Ack in response to the first frame sent too late");
377  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[1].header.IsAck (), true, "Expected a Normal Ack");
378  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[1].header.GetAddr1 (),
379  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
380  "Expected a Normal Ack sent to the AP");
381  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[1].header.GetDuration (),
382  RoundDurationId (m_txPsdus[0].header.GetDuration () - sifs - m_txPsdus[1].txDuration),
383  "Duration/ID of the Ack must be derived from that of the first frame");
384 
385  // the AP receives a corrupted Ack in response to the frame it sent, which is the initial
386  // frame of a TXOP. Hence, the TXOP is terminated and the AP retransmits the frame after
387  // invoking the backoff
388  txopStart = m_txPsdus[2].txStart;
389 
390  tEnd = m_txPsdus[1].txStart + m_txPsdus[1].txDuration;
391  tStart = m_txPsdus[2].txStart;
392 
393  NS_TEST_EXPECT_MSG_GT_OR_EQ (tStart - tEnd, sifs + m_aifsn * slot,
394  "Less than AIFS elapsed between AckTimeout and the next TXOP start");
395  NS_TEST_EXPECT_MSG_LT_OR_EQ (tStart - tEnd, sifs + m_aifsn * slot + (2 * (m_cwMin + 1) - 1) * slot,
396  "More than AIFS+BO elapsed between AckTimeout and the next TXOP start");
397  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[2].header.IsQosData (), true,
398  "Expected to retransmit a QoS data frame");
399  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[2].header.GetAddr1 (),
400  DynamicCast<WifiNetDevice> (m_staDevices.Get (0))->GetMac ()->GetAddress (),
401  "Expected to retransmit a frame to the first station");
402  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[2].header.GetDuration (),
403  RoundDurationId (m_txopLimit - m_txPsdus[2].txDuration),
404  "Duration/ID of the retransmitted frame must cover the whole TXOP");
405 
406  // a Normal Ack is then sent by STA1
407  tEnd = m_txPsdus[2].txStart + m_txPsdus[2].txDuration;
408  tStart = m_txPsdus[3].txStart;
409 
410  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Ack in response to the first frame sent too early");
411  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Ack in response to the first frame sent too late");
412  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[3].header.IsAck (), true, "Expected a Normal Ack");
413  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[3].header.GetAddr1 (),
414  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
415  "Expected a Normal Ack sent to the AP");
416  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[3].header.GetDuration (),
417  RoundDurationId (m_txPsdus[2].header.GetDuration () - sifs - m_txPsdus[3].txDuration),
418  "Duration/ID of the Ack must be derived from that of the previous frame");
419 
420  // the AP sends a frame to STA2
421  tEnd = m_txPsdus[3].txStart + m_txPsdus[3].txDuration;
422  tStart = m_txPsdus[4].txStart;
423 
424  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Second frame sent too early");
425  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Second frame sent too late");
426  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[4].header.IsQosData (), true,
427  "Expected a QoS data frame");
428  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[4].header.GetAddr1 (),
429  DynamicCast<WifiNetDevice> (m_staDevices.Get (1))->GetMac ()->GetAddress (),
430  "Expected a frame sent by the AP to the second station");
431  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[4].header.GetDuration (),
432  RoundDurationId (m_txopLimit - (m_txPsdus[4].txStart - txopStart) - m_txPsdus[4].txDuration),
433  "Duration/ID of the second frame does not cover the remaining TXOP");
434 
435  // STA2 receives a corrupted frame and hence it does not send the Ack. When the AckTimeout
436  // expires, the AP performs PIFS recovery or invoke backoff, without terminating the TXOP,
437  // because a non-initial frame of the TXOP failed
438  tEnd = m_txPsdus[4].txStart + m_txPsdus[4].txDuration
439  + sifs + slot + WifiPhy::CalculatePhyPreambleAndHeaderDuration (m_txPsdus[4].txVector); // AckTimeout
440  tStart = m_txPsdus[5].txStart;
441 
442  if (m_pifsRecovery)
443  {
444  NS_TEST_EXPECT_MSG_EQ (tEnd + sifs + slot, tStart, "Second frame must have been sent after a PIFS");
445  }
446  else
447  {
448  NS_TEST_EXPECT_MSG_GT_OR_EQ (tStart - tEnd, sifs + m_aifsn * slot,
449  "Less than AIFS elapsed between AckTimeout and the next transmission");
450  NS_TEST_EXPECT_MSG_LT_OR_EQ (tStart - tEnd, sifs + m_aifsn * slot + (2 * (m_cwMin + 1) - 1) * slot,
451  "More than AIFS+BO elapsed between AckTimeout and the next TXOP start");
452  }
453  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[5].header.IsQosData (), true,
454  "Expected a QoS data frame");
455  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[5].header.GetAddr1 (),
456  DynamicCast<WifiNetDevice> (m_staDevices.Get (1))->GetMac ()->GetAddress (),
457  "Expected a frame sent by the AP to the second station");
458  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[5].header.GetDuration (),
459  RoundDurationId (m_txopLimit - (m_txPsdus[5].txStart - txopStart) - m_txPsdus[5].txDuration),
460  "Duration/ID of the second frame does not cover the remaining TXOP");
461 
462  // a Normal Ack is then sent by STA2
463  tEnd = m_txPsdus[5].txStart + m_txPsdus[5].txDuration;
464  tStart = m_txPsdus[6].txStart;
465 
466  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Ack in response to the second frame sent too early");
467  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Ack in response to the second frame sent too late");
468  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[6].header.IsAck (), true, "Expected a Normal Ack");
469  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[6].header.GetAddr1 (),
470  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
471  "Expected a Normal Ack sent to the AP");
472  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[6].header.GetDuration (),
473  RoundDurationId (m_txPsdus[5].header.GetDuration () - sifs - m_txPsdus[6].txDuration),
474  "Duration/ID of the Ack must be derived from that of the previous frame");
475 
476  // the AP sends a frame to STA3
477  tEnd = m_txPsdus[6].txStart + m_txPsdus[6].txDuration;
478  tStart = m_txPsdus[7].txStart;
479 
480  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Third frame sent too early");
481  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Third frame sent too late");
482  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[7].header.IsQosData (), true,
483  "Expected a QoS data frame");
484  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[7].header.GetAddr1 (),
485  DynamicCast<WifiNetDevice> (m_staDevices.Get (2))->GetMac ()->GetAddress (),
486  "Expected a frame sent by the AP to the third station");
487  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[7].header.GetDuration (),
488  RoundDurationId (m_txopLimit - (m_txPsdus[7].txStart - txopStart) - m_txPsdus[7].txDuration),
489  "Duration/ID of the third frame does not cover the remaining TXOP");
490 
491  // a Normal Ack is then sent by STA3
492  tEnd = m_txPsdus[7].txStart + m_txPsdus[7].txDuration;
493  tStart = m_txPsdus[8].txStart;
494 
495  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Ack in response to the third frame sent too early");
496  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Ack in response to the third frame sent too late");
497  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[8].header.IsAck (), true, "Expected a Normal Ack");
498  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[8].header.GetAddr1 (),
499  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
500  "Expected a Normal Ack sent to the AP");
501  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[8].header.GetDuration (),
502  RoundDurationId (m_txPsdus[7].header.GetDuration () - sifs - m_txPsdus[8].txDuration),
503  "Duration/ID of the Ack must be derived from that of the previous frame");
504 
505  // the TXOP limit is such that enough time for sending a CF-End frame remains
506  tEnd = m_txPsdus[8].txStart + m_txPsdus[8].txDuration;
507  tStart = m_txPsdus[9].txStart;
508 
509  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "CF-End sent too early");
510  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "CF-End sent too late");
511  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[9].header.IsCfEnd (), true, "Expected a CF-End frame");
512  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[9].header.GetDuration (), Seconds (0),
513  "Duration/ID must be set to 0 for CF-End frames");
514 
515  // the CF-End frame resets the NAV on STA1, which can now transmit
516  tEnd = m_txPsdus[9].txStart + m_txPsdus[9].txDuration;
517  tStart = m_txPsdus[10].txStart;
518 
519  NS_TEST_EXPECT_MSG_GT_OR_EQ (tStart - tEnd, sifs + m_aifsn * slot,
520  "Less than AIFS elapsed between two TXOPs");
521  NS_TEST_EXPECT_MSG_LT_OR_EQ (tStart - tEnd, sifs + m_aifsn * slot + m_cwMin * slot + tolerance,
522  "More than AIFS+BO elapsed between two TXOPs");
523  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[10].header.IsQosData (), true,
524  "Expected a QoS data frame");
525  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[10].header.GetAddr1 (),
526  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
527  "Expected a frame sent by the first station to the AP");
528  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[10].header.GetDuration (),
529  RoundDurationId (m_txopLimit - m_txPsdus[10].txDuration),
530  "Duration/ID of the frame sent by the first station does not cover the remaining TXOP");
531 
532  // a Normal Ack is then sent by the AP
533  tEnd = m_txPsdus[10].txStart + m_txPsdus[10].txDuration;
534  tStart = m_txPsdus[11].txStart;
535 
536  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Ack sent too early");
537  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Ack sent too late");
538  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[11].header.IsAck (), true, "Expected a Normal Ack");
539  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[11].header.GetAddr1 (),
540  DynamicCast<WifiNetDevice> (m_staDevices.Get (0))->GetMac ()->GetAddress (),
541  "Expected a Normal Ack sent to the first station");
542  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[11].header.GetDuration (),
543  RoundDurationId (m_txPsdus[10].header.GetDuration () - sifs - m_txPsdus[11].txDuration),
544  "Duration/ID of the Ack must be derived from that of the previous frame");
545 
546  // the TXOP limit is such that enough time for sending a CF-End frame remains
547  tEnd = m_txPsdus[11].txStart + m_txPsdus[11].txDuration;
548  tStart = m_txPsdus[12].txStart;
549 
550  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "CF-End sent too early");
551  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "CF-End sent too late");
552  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[12].header.IsCfEnd (), true, "Expected a CF-End frame");
553  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[12].header.GetDuration (), Seconds (0),
554  "Duration/ID must be set to 0 for CF-End frames");
555 
556 
557  /*
558  * Verify that the Duration/ID of RTS/CTS frames is set correctly, that the TXOP holder is
559  * kept and allows stations to ignore NAV properly and that the CF-End Frame is not sent if
560  * not enough time remains
561  *
562  * |---------------------------------------------NAV---------------------------------->|
563  * | |-----------------------------------------NAV------------------------------->|
564  * | | |-------------------------------------NAV---------------------------->|
565  * | | | |---------------------------------NAV------------------------->|
566  * | | | | |-----------------------------NAV---------------------->|
567  * | | | | | |-------------------------NAV------------------->|
568  * | | | | | | |---------------------NAV---------------->|
569  * | | | | | | | |-----------------NAV------------->|
570  * | | | | | | | | |-------------NAV---------->|
571  * | | | | | | | | | |---------NAV------->|
572  * | | | | | | | | | | |-----NAV---->|
573  * | | | | | | | | | | | |-NAV->|
574  * |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---| |---|
575  * |RTS| |CTS| |QoS| |Ack| |RTS| |CTS| |QoS| |Ack| |RTS| |CTS| |QoS| |Ack|
576  * ----------------------------------------------------------------------------------------------------
577  * From: AP STA1 AP STA1 AP STA2 AP STA2 AP STA3 AP STA3
578  * To: STA1 AP STA1 AP STA2 AP STA2 AP STA3 AP STA3 AP
579  */
580 
581  // the first frame is an RTS frame sent by the AP to STA1
582  txopStart = m_txPsdus[13].txStart;
583 
584  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[13].header.IsRts (), true,
585  "Expected an RTS frame");
586  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[13].header.GetAddr1 (),
587  DynamicCast<WifiNetDevice> (m_staDevices.Get (0))->GetMac ()->GetAddress (),
588  "Expected an RTS frame sent by the AP to the first station");
589  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[13].header.GetDuration (),
590  RoundDurationId (m_txopLimit - m_txPsdus[13].txDuration),
591  "Duration/ID of the first RTS frame must cover the whole TXOP");
592 
593  // a CTS is sent by STA1
594  tEnd = m_txPsdus[13].txStart + m_txPsdus[13].txDuration;
595  tStart = m_txPsdus[14].txStart;
596 
597  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "CTS in response to the first RTS frame sent too early");
598  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "CTS in response to the first RTS frame sent too late");
599  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[14].header.IsCts (), true, "Expected a CTS");
600  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[14].header.GetAddr1 (),
601  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
602  "Expected a CTS frame sent to the AP");
603  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[14].header.GetDuration (),
604  RoundDurationId (m_txPsdus[13].header.GetDuration () - sifs - m_txPsdus[14].txDuration),
605  "Duration/ID of the CTS frame must be derived from that of the RTS frame");
606 
607  // the AP sends a frame to STA1
608  tEnd = m_txPsdus[14].txStart + m_txPsdus[14].txDuration;
609  tStart = m_txPsdus[15].txStart;
610 
611  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "First QoS data frame sent too early");
612  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "First QoS data frame sent too late");
613  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[15].header.IsQosData (), true,
614  "Expected a QoS data frame");
615  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[15].header.GetAddr1 (),
616  DynamicCast<WifiNetDevice> (m_staDevices.Get (0))->GetMac ()->GetAddress (),
617  "Expected a frame sent by the AP to the first station");
618  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[15].header.GetDuration (),
619  RoundDurationId (m_txopLimit - (m_txPsdus[15].txStart - txopStart) - m_txPsdus[15].txDuration),
620  "Duration/ID of the first QoS data frame does not cover the remaining TXOP");
621 
622  // a Normal Ack is then sent by STA1
623  tEnd = m_txPsdus[15].txStart + m_txPsdus[15].txDuration;
624  tStart = m_txPsdus[16].txStart;
625 
626  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Ack in response to the first QoS data frame sent too early");
627  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Ack in response to the first QoS data frame sent too late");
628  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[16].header.IsAck (), true, "Expected a Normal Ack");
629  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[16].header.GetAddr1 (),
630  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
631  "Expected a Normal Ack sent to the AP");
632  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[16].header.GetDuration (),
633  RoundDurationId (m_txPsdus[15].header.GetDuration () - sifs - m_txPsdus[16].txDuration),
634  "Duration/ID of the Ack must be derived from that of the previous frame");
635 
636  // An RTS frame is sent by the AP to STA2
637  tEnd = m_txPsdus[16].txStart + m_txPsdus[16].txDuration;
638  tStart = m_txPsdus[17].txStart;
639 
640  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Second RTS frame sent too early");
641  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Second RTS frame sent too late");
642  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[17].header.IsRts (), true,
643  "Expected an RTS frame");
644  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[17].header.GetAddr1 (),
645  DynamicCast<WifiNetDevice> (m_staDevices.Get (1))->GetMac ()->GetAddress (),
646  "Expected an RTS frame sent by the AP to the second station");
647  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[17].header.GetDuration (),
648  RoundDurationId (m_txopLimit - (m_txPsdus[17].txStart - txopStart) - m_txPsdus[17].txDuration),
649  "Duration/ID of the second RTS frame must cover the whole TXOP");
650 
651  // a CTS is sent by STA2 (which ignores the NAV)
652  tEnd = m_txPsdus[17].txStart + m_txPsdus[17].txDuration;
653  tStart = m_txPsdus[18].txStart;
654 
655  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "CTS in response to the second RTS frame sent too early");
656  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "CTS in response to the second RTS frame sent too late");
657  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[18].header.IsCts (), true, "Expected a CTS");
658  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[18].header.GetAddr1 (),
659  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
660  "Expected a CTS frame sent to the AP");
661  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[18].header.GetDuration (),
662  RoundDurationId (m_txPsdus[17].header.GetDuration () - sifs - m_txPsdus[18].txDuration),
663  "Duration/ID of the CTS frame must be derived from that of the RTS frame");
664 
665  // the AP sends a frame to STA2
666  tEnd = m_txPsdus[18].txStart + m_txPsdus[18].txDuration;
667  tStart = m_txPsdus[19].txStart;
668 
669  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Second QoS data frame sent too early");
670  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Second QoS data frame sent too late");
671  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[19].header.IsQosData (), true,
672  "Expected a QoS data frame");
673  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[19].header.GetAddr1 (),
674  DynamicCast<WifiNetDevice> (m_staDevices.Get (1))->GetMac ()->GetAddress (),
675  "Expected a frame sent by the AP to the second station");
676  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[19].header.GetDuration (),
677  RoundDurationId (m_txopLimit - (m_txPsdus[19].txStart - txopStart) - m_txPsdus[19].txDuration),
678  "Duration/ID of the second QoS data frame does not cover the remaining TXOP");
679 
680  // a Normal Ack is then sent by STA2
681  tEnd = m_txPsdus[19].txStart + m_txPsdus[19].txDuration;
682  tStart = m_txPsdus[20].txStart;
683 
684  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Ack in response to the second QoS data frame sent too early");
685  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Ack in response to the second QoS data frame sent too late");
686  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[20].header.IsAck (), true, "Expected a Normal Ack");
687  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[20].header.GetAddr1 (),
688  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
689  "Expected a Normal Ack sent to the AP");
690  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[20].header.GetDuration (),
691  RoundDurationId (m_txPsdus[19].header.GetDuration () - sifs - m_txPsdus[20].txDuration),
692  "Duration/ID of the Ack must be derived from that of the previous frame");
693 
694  // An RTS frame is sent by the AP to STA3
695  tEnd = m_txPsdus[20].txStart + m_txPsdus[20].txDuration;
696  tStart = m_txPsdus[21].txStart;
697 
698  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Third RTS frame sent too early");
699  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Third RTS frame sent too late");
700  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[21].header.IsRts (), true,
701  "Expected an RTS frame");
702  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[21].header.GetAddr1 (),
703  DynamicCast<WifiNetDevice> (m_staDevices.Get (2))->GetMac ()->GetAddress (),
704  "Expected an RTS frame sent by the AP to the third station");
705  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[21].header.GetDuration (),
706  RoundDurationId (m_txopLimit - (m_txPsdus[21].txStart - txopStart) - m_txPsdus[21].txDuration),
707  "Duration/ID of the third RTS frame must cover the whole TXOP");
708 
709  // a CTS is sent by STA3 (which ignores the NAV)
710  tEnd = m_txPsdus[21].txStart + m_txPsdus[21].txDuration;
711  tStart = m_txPsdus[22].txStart;
712 
713  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "CTS in response to the third RTS frame sent too early");
714  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "CTS in response to the third RTS frame sent too late");
715  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[22].header.IsCts (), true, "Expected a CTS");
716  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[22].header.GetAddr1 (),
717  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
718  "Expected a CTS frame sent to the AP");
719  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[22].header.GetDuration (),
720  RoundDurationId (m_txPsdus[21].header.GetDuration () - sifs - m_txPsdus[22].txDuration),
721  "Duration/ID of the CTS frame must be derived from that of the RTS frame");
722 
723  // the AP sends a frame to STA3
724  tEnd = m_txPsdus[22].txStart + m_txPsdus[22].txDuration;
725  tStart = m_txPsdus[23].txStart;
726 
727  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Third QoS data frame sent too early");
728  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Third QoS data frame sent too late");
729  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[23].header.IsQosData (), true,
730  "Expected a QoS data frame");
731  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[23].header.GetAddr1 (),
732  DynamicCast<WifiNetDevice> (m_staDevices.Get (2))->GetMac ()->GetAddress (),
733  "Expected a frame sent by the AP to the third station");
734  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[23].header.GetDuration (),
735  RoundDurationId (m_txopLimit - (m_txPsdus[23].txStart - txopStart) - m_txPsdus[23].txDuration),
736  "Duration/ID of the third QoS data frame does not cover the remaining TXOP");
737 
738  // a Normal Ack is then sent by STA3
739  tEnd = m_txPsdus[23].txStart + m_txPsdus[23].txDuration;
740  tStart = m_txPsdus[24].txStart;
741 
742  NS_TEST_EXPECT_MSG_LT (tEnd + sifs, tStart, "Ack in response to the third QoS data frame sent too early");
743  NS_TEST_EXPECT_MSG_LT (tStart, tEnd + sifs + tolerance, "Ack in response to the third QoS data frame sent too late");
744  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[24].header.IsAck (), true, "Expected a Normal Ack");
745  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[24].header.GetAddr1 (),
746  DynamicCast<WifiNetDevice> (m_apDevices.Get (0))->GetMac ()->GetAddress (),
747  "Expected a Normal Ack sent to the AP");
748  NS_TEST_EXPECT_MSG_EQ (m_txPsdus[24].header.GetDuration (),
749  RoundDurationId (m_txPsdus[23].header.GetDuration () - sifs - m_txPsdus[24].txDuration),
750  "Duration/ID of the Ack must be derived from that of the previous frame");
751 
752  // there is no time remaining for sending a CF-End frame. This is verified by checking
753  // that 25 frames are transmitted (done at the beginning of this method)
754 
755  // 3 DL packets (without RTS/CTS), 1 UL packet and 3 DL packets (with RTS/CTS)
756  NS_TEST_EXPECT_MSG_EQ (m_received, 7, "Unexpected number of packets received");
757 }
758 
759 
767 {
768 public:
770 };
771 
773  : TestSuite ("wifi-txop", UNIT)
774 {
775  AddTestCase (new WifiTxopTest (true), TestCase::QUICK);
776  AddTestCase (new WifiTxopTest (false), TestCase::QUICK);
777 }
778 
static WifiTxopTestSuite g_wifiTxopTestSuite
the test suite
Definition: wifi-txop.cc:779
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
void SetStopTime(Time stop)
Specify application stop time.
Definition: application.cc:75
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
std::vector< FrameInfo > m_txPsdus
transmitted PSDUs
Definition: wifi-txop.cc:96
NetDeviceContainer m_apDevices
container for AP&#39;s NetDevice
Definition: wifi-txop.cc:95
AttributeValue implementation for Boolean.
Definition: boolean.h:36
WifiTxVector txVector
TX vector used to transmit the frame.
Definition: wifi-txop.cc:90
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
Hold variables of type string.
Definition: string.h:41
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition: wifi-ppdu.h:38
Time txDuration
Frame TX duration.
Definition: wifi-txop.cc:88
A suite of tests to run.
Definition: test.h:1343
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:74
an address for a packet socket
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
void CheckResults(void)
Check correctness of transmitted frames.
Definition: wifi-txop.cc:320
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition: test.h:283
bool m_pifsRecovery
whether to use PIFS recovery
Definition: wifi-txop.cc:101
The 5 GHz band.
Definition: wifi-phy-band.h:37
encapsulates test code
Definition: test.h:1153
void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
Add the single-frequency propagation loss model to be used.
helps to create WifiNetDevice objects
Definition: wifi-helper.h:326
void L7Receive(std::string context, Ptr< const Packet > p, const Address &addr)
Function to trace packets received by the server application.
Definition: wifi-txop.cc:118
Give ns3::PacketSocket powers to ns3::Node.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
#define NS_TEST_EXPECT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to limit and report if not.
Definition: test.h:1109
a polymophic address class
Definition: address.h:90
mobility
Definition: third.py:108
phy
Definition: third.py:93
WifiMacHeader header
Frame MAC header.
Definition: wifi-txop.cc:89
AttributeValue implementation for Time.
Definition: nstime.h:1353
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1313
Hold an unsigned integer type.
Definition: uinteger.h:44
holds a vector of ns3::NetDevice pointers
mac
Definition: third.py:99
wifiApNode
Definition: third.py:90
uint16_t m_received
number of packets received by the stations
Definition: wifi-txop.cc:100
wifi TXOP Test Suite
Definition: wifi-txop.cc:766
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:920
Test TXOP rules.
Definition: wifi-txop.cc:51
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetPhysicalAddress(const Address address)
Set the destination address.
keep track of a set of node pointers.
Hold objects of type Ptr<T>.
Definition: pointer.h:36
void SetList(const std::list< uint32_t > &packetlist)
Definition: error-model.cc:520
create MAC layers for a ns3::WifiNetDevice.
WifiTxopTest(bool pifsRecovery)
Constructor.
Definition: wifi-txop.cc:104
virtual ~WifiTxopTest()
Definition: wifi-txop.cc:113
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
NetDeviceContainer m_staDevices
container for stations&#39; NetDevices
Definition: wifi-txop.cc:94
wifi
Definition: third.py:96
Helper class used to assign positions and mobility models to nodes.
Ptr< WifiMac > GetMac(void) const
Information about transmitted frames.
Definition: wifi-txop.cc:85
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
Set the propagation delay model to be used.
Time txStart
Frame start TX time.
Definition: wifi-txop.cc:87
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
AttributeValue implementation for Ssid.
Definition: ssid.h:105
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
uint8_t m_aifsn
AIFSN for BE.
Definition: wifi-txop.cc:98
void SetProtocol(uint16_t protocol)
Set the protocol.
void Add(Vector v)
Add a position to the list of positions.
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
Definition: test.h:901
uint16_t m_nStations
number of stations
Definition: wifi-txop.cc:93
Time m_txopLimit
TXOP limit.
Definition: wifi-txop.cc:97
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
wifiStaNodes
Definition: third.py:88
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
void SetStartTime(Time start)
Specify application start time.
Definition: application.cc:69
#define NS_TEST_EXPECT_MSG_LT_OR_EQ(actual, limit, msg)
Test that an actual value is less than or equal to a limit and report if not.
Definition: test.h:922
#define SU_STA_ID
Definition: wifi-mode.h:32
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...
Definition: callback.h:1642
void Transmit(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when PHY receives a PSDU to transmit.
Definition: wifi-txop.cc:127
Implements the IEEE 802.11 MAC header.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: wifi-txop.cc:148
uint32_t m_cwMin
CWmin for BE.
Definition: wifi-txop.cc:99
Make it easy to create and manage PHY objects for the spectrum model.