9#include "ns3/ap-wifi-mac.h" 
   10#include "ns3/boolean.h" 
   11#include "ns3/config.h" 
   12#include "ns3/he-phy.h" 
   14#include "ns3/mobility-helper.h" 
   15#include "ns3/multi-model-spectrum-channel.h" 
   16#include "ns3/node-list.h" 
   17#include "ns3/packet-socket-client.h" 
   18#include "ns3/packet-socket-helper.h" 
   19#include "ns3/packet-socket-server.h" 
   20#include "ns3/packet.h" 
   21#include "ns3/pointer.h" 
   22#include "ns3/qos-txop.h" 
   23#include "ns3/qos-utils.h" 
   24#include "ns3/rng-seed-manager.h" 
   25#include "ns3/spectrum-wifi-helper.h" 
   26#include "ns3/string.h" 
   28#include "ns3/wifi-mac-header.h" 
   29#include "ns3/wifi-net-device.h" 
   30#include "ns3/wifi-ppdu.h" 
   31#include "ns3/wifi-psdu.h" 
  115    void DoRun() 
override;
 
 
  177    : 
TestCase(
"Check correct operation within TXOPs with parameters: nonHt=" +
 
  178               std::to_string(params.nonHt) +
 
  179               " pifsRecovery=" + 
std::to_string(params.pifsRecovery) +
 
  180               " singleRtsPerTxop=" + 
std::to_string(params.singleRtsPerTxop) +
 
  181               " lengthBasedRtsCtsThresh=" + 
std::to_string(params.lengthBasedRtsCtsThresh) +
 
  182               " protectedIfResponded=" + 
std::to_string(params.protectedIfResponded) +
 
  183               " protectSingleExchange=" + 
std::to_string(params.protectSingleExchange) +
 
  184               " singleExchangeProtectionBuffer=" +
 
  185               std::to_string(params.singleExchangeProtectionBuffer.GetMicroSeconds()) + 
"us"),
 
  193      m_nonHt(params.nonHt),
 
  194      m_payloadSizeRtsOn(m_nonHt ? 2000 : 540),
 
  195      m_payloadSizeRtsOff(500),
 
  197      m_mode(m_nonHt ? 
OfdmPhy::GetOfdmRate12Mbps() : 
HePhy::GetHeMcs0()),
 
  198      m_pifsRecovery(params.pifsRecovery),
 
  199      m_singleRtsPerTxop(params.singleRtsPerTxop),
 
  200      m_lengthBasedRtsCtsThresh(params.lengthBasedRtsCtsThresh),
 
  201      m_protectedIfResponded(params.protectedIfResponded),
 
  202      m_protectSingleExchange(params.protectSingleExchange),
 
  203      m_singleExchangeProtectionSurplus(params.singleExchangeProtectionBuffer),
 
  206      m_apCorrupted(false),
 
  207      m_staCorrupted(false)
 
 
  226    bool corrupted{
false};
 
  230    if (
const auto& hdr = psduMap.begin()->second->GetHeader(0);
 
  240    if (
const auto& hdr = psduMap.begin()->second->GetHeader(0);
 
  262    if (
const auto& hdr = psduMap.begin()->second->GetHeader(0);
 
  263        hdr.IsQosData() && hdr.GetAddr1() == 
m_staDevices.
Get(2)->GetAddress() &&
 
  264        hdr.GetSequenceNumber() == (
m_nonHt ? 0 : 1))
 
  282    NS_LOG_INFO(psduMap.begin()->second->GetHeader(0).GetTypeString()
 
  283                << 
" seq " << psduMap.begin()->second->GetHeader(0).GetSequenceNumber() << 
" to " 
  284                << psduMap.begin()->second->GetAddr1() << 
" TX duration " 
  286                << 
" duration/ID " << psduMap.begin()->second->GetHeader(0).GetDuration()
 
  287                << (corrupted ? 
" CORRUPTED" : 
"") << std::endl);
 
 
  298    int64_t streamNumber = 100;
 
  301    wifiApNode.Create(1);
 
  308    spectrumChannel->AddPropagationLossModel(lossModel);
 
  310    spectrumChannel->SetPropagationDelayModel(delayModel);
 
  313    phy.SetChannel(spectrumChannel);
 
  315    phy.Set(
"ChannelSettings", 
StringValue(
"{0, 20, BAND_5GHZ, 0}"));
 
  340    wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
 
  347    mac.SetType(
"ns3::StaWifiMac",
 
  353    m_staDevices = wifi.Install(phy, mac, wifiStaNodes);
 
  364        "EnableBeaconJitter",
 
  367        StringValue(std::string(
"BE ") + std::to_string(m_staAifsn)),
 
  372        StringValue(std::string(
"BE ") + std::to_string(m_staCwMax)),
 
  374        StringValue(std::string(
"BE ") + std::to_string(m_staTxopLimit.GetMicroSeconds()) + 
"us"));
 
  378    m_apDevices = 
wifi.Install(phy, mac, wifiApNode);
 
  385    dev->GetMac()->SetSsid(
Ssid(
"wifi-txop-ssid"));
 
  387    for (uint16_t i = 1; i < m_nStations; i++)
 
  393                            Ssid(
"wifi-txop-ssid"));
 
  399    positionAlloc->Add(Vector(0.0, 0.0, 0.0));
 
  400    positionAlloc->Add(Vector(1.0, 0.0, 0.0));
 
  401    positionAlloc->Add(Vector(0.0, 1.0, 0.0));
 
  402    positionAlloc->Add(Vector(-1.0, 0.0, 0.0));
 
  403    mobility.SetPositionAllocator(positionAlloc);
 
  405    mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
 
  410    packetSocket.
Install(wifiApNode);
 
  411    packetSocket.
Install(wifiStaNodes);
 
  423        server->SetLocal(srvAddr);
 
  424        (*nodeIt)->AddApplication(server);
 
  430    for (uint16_t i = 0; i < m_nStations; ++i)
 
  432        m_dlSockets.emplace_back();
 
  433        m_dlSockets.back().SetSingleDevice(m_apDevices.Get(0)->GetIfIndex());
 
  434        m_dlSockets.back().SetPhysicalAddress(m_staDevices.Get(i)->GetAddress());
 
  435        m_dlSockets.back().SetProtocol(1);
 
  437        m_ulSockets.emplace_back();
 
  438        m_ulSockets.back().SetSingleDevice(m_staDevices.Get(i)->GetIfIndex());
 
  439        m_ulSockets.back().SetPhysicalAddress(m_apDevices.Get(0)->GetAddress());
 
  440        m_ulSockets.back().SetProtocol(1);
 
  444    for (uint16_t i = 0; i < m_nStations; i++)
 
  453                                GetApplication(
DOWNLINK, i, 1, m_payloadSizeRtsOff - 1));
 
  460                            GetApplication(
DOWNLINK, i, 1, m_payloadSizeRtsOff));
 
  466                            GetApplication(
DOWNLINK, i, m_nonHt ? 1 : 2, m_payloadSizeRtsOn));
 
  471    dev->GetMac()->GetWifiPhy()->SetPostReceptionErrorModel(m_apErrorModel);
 
  475    dev->GetMac()->GetWifiPhy()->SetPostReceptionErrorModel(m_staErrorModel);
 
  486                                GetApplication(
UPLINK, 0, 1, m_payloadSizeRtsOff - 1));
 
  492                            GetApplication(
UPLINK, 0, 1, m_payloadSizeRtsOff));
 
  495    Config::Connect(
"/NodeList/*/ApplicationList/*/$ns3::PacketSocketServer/Rx",
 
  498    Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxPsduBegin",
 
 
  520    client->SetStartTime(
Time{0}); 
 
  521    client->SetStopTime(
Seconds(1));
 
 
  535                              "Unexpected AIFSN for STA " << i);
 
  538                              "Unexpected CWmin for STA " << i);
 
  541                              "Unexpected CWmax for STA " << i);
 
  544                              "Unexpected TXOP limit for STA " << i);
 
  551                          "Unexpected TXOP limit for AP");
 
  559    Time sifs = apDev->GetPhy()->GetSifs();
 
  560    Time slot = apDev->GetPhy()->GetSlot();
 
  569    auto RoundDurationId = [](
Time t) {
 
  570        return MicroSeconds(ceil(
static_cast<double>(t.GetNanoSeconds()) / 1000));
 
  609        "Unexpected number of transmitted frames");
 
  617                          "Expected a frame sent by the AP to the first station");
 
  622                              "PSDU size expected not to exceed length based RTS/CTS threshold");
 
  628            rtsCtsTxDurationThresh,
 
  629            "PSDU duration expected not to exceed duration based RTS/CTS threshold");
 
  637             ? 
"Duration/ID of the first frame must cover the whole TXOP" 
  638             : 
"Duration/ID of the first frame must be set to remaining time to " 
  639               "complete DATA+ACK sequence"));
 
  647                          tEnd + sifs + tolerance,
 
  648                          "Ack in response to the first frame sent too late");
 
  651                          apDev->GetMac()->GetAddress(),
 
  652                          "Expected a Normal Ack sent to the AP");
 
  656        "Duration/ID of the Ack must be derived from that of the first frame");
 
  671        eifsNoDifs + sifs + aifsn * slot,
 
  672        "Less than AIFS elapsed between AckTimeout and the next TXOP start");
 
  675        eifsNoDifs + sifs + aifsn * slot + (2 * (cwMin + 1) - 1) * slot,
 
  676        "More than AIFS+BO elapsed between AckTimeout and the next TXOP start");
 
  679                          "Expected to retransmit a QoS data frame");
 
  682                          "Expected to retransmit a frame to the first station");
 
  687                              "PSDU size expected not to exceed length based RTS/CTS threshold");
 
  693            rtsCtsTxDurationThresh,
 
  694            "PSDU duration expected not to exceed duration based RTS/CTS threshold");
 
  702             ? 
"Duration/ID of the retransmitted frame must cover the whole TXOP" 
  703             : 
"Duration/ID of the retransmitted frame must be set to remaining time to " 
  704               "complete DATA+ACK sequence"));
 
  712                          tEnd + sifs + tolerance,
 
  713                          "Ack in response to the first frame sent too late");
 
  716                          apDev->GetMac()->GetAddress(),
 
  717                          "Expected a Normal Ack sent to the AP");
 
  721        "Duration/ID of the Ack must be derived from that of the previous frame");
 
  732                          "Expected a frame sent by the AP to the second station");
 
  737                              "PSDU size expected not to exceed length based RTS/CTS threshold");
 
  743            rtsCtsTxDurationThresh,
 
  744            "PSDU duration expected not to exceed duration based RTS/CTS threshold");
 
  754                               ? 
"Duration/ID of the second frame does not cover the remaining TXOP" 
  755                               : 
"Duration/ID of the second frame must be set to remaining time to " 
  756                                 "complete DATA+ACK sequence"));
 
  763    auto ackTxVector = apStationManager->GetAckTxVector(staAddress, 
m_txPsdus[4].txVector);
 
  772                              "Second frame must have been sent after a PIFS");
 
  779            "Less than AIFS elapsed between AckTimeout and the next transmission");
 
  782            sifs + aifsn * slot + (2 * (cwMin + 1) - 1) * slot,
 
  783            "More than AIFS+BO elapsed between AckTimeout and the next TXOP start");
 
  788                          "Expected a frame sent by the AP to the second station");
 
  793                              "PSDU size expected not to exceed length based RTS/CTS threshold");
 
  799            rtsCtsTxDurationThresh,
 
  800            "PSDU duration expected not to exceed duration based RTS/CTS threshold");
 
  809             ? 
"Duration/ID of the second frame does not cover the remaining TXOP" 
  810             : 
"Duration/ID of the second frame must be set to remaining time to " 
  811               "complete DATA+ACK sequence"));
 
  819                          "Ack in response to the second frame sent too early");
 
  821                          tEnd + sifs + tolerance,
 
  822                          "Ack in response to the second frame sent too late");
 
  825                          apDev->GetMac()->GetAddress(),
 
  826                          "Expected a Normal Ack sent to the AP");
 
  830        "Duration/ID of the Ack must be derived from that of the previous frame");
 
  841                          "Expected a frame sent by the AP to the third station");
 
  846                              "PSDU size expected not to exceed length based RTS/CTS threshold");
 
  852            rtsCtsTxDurationThresh,
 
  853            "PSDU duration expected not to exceed duration based RTS/CTS threshold");
 
  862             ? 
"Duration/ID of the third frame does not cover the remaining TXOP" 
  863             : 
"Duration/ID of the third frame must be set to remaining time to " 
  864               "complete DATA+ACK sequence"));
 
  872                          tEnd + sifs + tolerance,
 
  873                          "Ack in response to the third frame sent too late");
 
  876                          apDev->GetMac()->GetAddress(),
 
  877                          "Expected a Normal Ack sent to the AP");
 
  881        "Duration/ID of the Ack must be derived from that of the previous frame");
 
  893                              tEnd + sifs + tolerance,
 
  894                              "RTS before fourth frame sent too late");
 
  899            "Expected an RTS frame sent by the AP to the second station");
 
  908                 ? 
"Duration/ID of the RTS before the fourth frame does not cover the remaining " 
  910                 : 
"Duration/ID of the RTS before the fourth frame must be set to remaining time " 
  911                   "to complete CTS+DATA+ACK sequence"));
 
  919                              "CTS in response to RTS before the fourth frame sent too early");
 
  921                              tEnd + sifs + tolerance,
 
  922                              "CTS in response to RTS before the fourth frame sent too late");
 
  925                              apDev->GetMac()->GetAddress(),
 
  926                              "Expected a CTS frame sent to the AP");
 
  930            "Duration/ID of the CTS frame must be derived from that of the RTS frame");
 
  951                          "Expected a frame sent by the AP to the second station");
 
  956                              "PSDU size expected to exceed length based RTS/CTS threshold");
 
  961                              rtsCtsTxDurationThresh,
 
  962                              "PSDU duration expected to exceed duration based RTS/CTS threshold");
 
  971             ? 
"Duration/ID of the fourth frame does not cover the remaining TXOP" 
  972             : 
"Duration/ID of the fourth frame must be set to remaining time to " 
  973               "complete DATA+(Block)ACK sequence"));
 
  975    std::string ack(
m_nonHt ? 
"Normal Ack" : 
"Block Ack");
 
  983                          ack << 
" in response to the fourth QoS data frame sent too early");
 
  985                          tEnd + sifs + tolerance,
 
  986                          ack << 
" in response to the fourth QoS data frame sent too late");
 
  990        "Expected a " << ack);
 
  992                          apDev->GetMac()->GetAddress(),
 
  993                          "Expected a " << ack << 
" sent to the AP");
 
  997        "Duration/ID of the " << ack << 
" must be derived from that of the previous frame");
 
 1010                              "Duration/ID must be set to 0 for CF-End frames");
 
 1022                                "Less than AIFS elapsed between two TXOPs");
 
 1025                                "More than AIFS+BO elapsed between two TXOPs");
 
 1028                          apDev->GetMac()->GetAddress(),
 
 1029                          "Expected a frame sent by the first station to the AP");
 
 1034                              "PSDU size expected not to exceed length based RTS/CTS threshold");
 
 1040            rtsCtsTxDurationThresh,
 
 1041            "PSDU duration expected not to exceed duration based RTS/CTS threshold");
 
 1049             ? 
"Duration/ID of the frame sent by the first station does not " 
 1050               "cover the remaining TXOP" 
 1051             : 
"Duration/ID of the frame sent by the first station must be set " 
 1052               "to remaining time to " 
 1053               "complete DATA+ACK sequence"));
 
 1064                          "Expected a Normal Ack sent to the first station");
 
 1067        RoundDurationId(
m_txPsdus[11].header.GetDuration() - sifs - 
m_txPsdus[12].txDuration),
 
 1068        "Duration/ID of the Ack must be derived from that of the previous frame");
 
 1081                              "Duration/ID must be set to 0 for CF-End frames");
 
 1117                          "Expected an RTS frame sent by the AP to the first station");
 
 1125                               ? 
"Duration/ID of the first RTS frame must cover the whole TXOP" 
 1126                               : 
"Duration/ID of the first RTS frame must be set to remaining time " 
 1127                                 "to complete CTS+DATA+(Block)ACK sequence"));
 
 1135                          "CTS in response to the first RTS frame sent too early");
 
 1137                          tEnd + sifs + tolerance,
 
 1138                          "CTS in response to the first RTS frame sent too late");
 
 1141                          apDev->GetMac()->GetAddress(),
 
 1142                          "Expected a CTS frame sent to the AP");
 
 1145        RoundDurationId(
m_txPsdus[13].header.GetDuration() - sifs - 
m_txPsdus[14].txDuration),
 
 1146        "Duration/ID of the CTS frame must be derived from that of the RTS frame");
 
 1157                          "Expected a frame sent by the AP to the first station");
 
 1162                              "PSDU size expected to exceed length based RTS/CTS threshold");
 
 1167                              rtsCtsTxDurationThresh,
 
 1168                              "PSDU duration expected to exceed duration based RTS/CTS threshold");
 
 1177             ? 
"Duration/ID of the first QoS data frame does not cover the remaining TXOP" 
 1178             : 
"Duration/ID of the first QoS data frame must be set to remaining time to " 
 1179               "complete DATA+(Block)ACK sequence"));
 
 1187                          ack << 
" in response to the first QoS data frame sent too early");
 
 1189                          tEnd + sifs + tolerance,
 
 1190                          ack << 
" in response to the first QoS data frame sent too late");
 
 1194        "Expected a " << ack);
 
 1196                          apDev->GetMac()->GetAddress(),
 
 1197                          "Expected a " << ack << 
" sent to the AP");
 
 1200        RoundDurationId(
m_txPsdus[15].header.GetDuration() - sifs - 
m_txPsdus[16].txDuration),
 
 1201        "Duration/ID of the " << ack << 
" must be derived from that of the previous frame");
 
 1203    std::size_t idx = 16;
 
 1218            "Expected an RTS frame sent by the AP to the second station");
 
 1227                 ? 
"Duration/ID of the second RTS frame must cover the whole TXOP" 
 1228                 : 
"Duration/ID of the second RTS frame must be set to remaining time to complete " 
 1229                   "CTS+DATA+(Block)ACK sequence"));
 
 1237                              "CTS in response to the second RTS frame sent too early");
 
 1239                              tEnd + sifs + tolerance,
 
 1240                              "CTS in response to the second RTS frame sent too late");
 
 1243                              apDev->GetMac()->GetAddress(),
 
 1244                              "Expected a CTS frame sent to the AP");
 
 1246            m_txPsdus[idx + 1].header.GetDuration(),
 
 1247            RoundDurationId(
m_txPsdus[idx].header.GetDuration() - sifs -
 
 1249            "Duration/ID of the CTS frame must be derived from that of the RTS frame");
 
 1264                          "Expected a frame sent by the AP to the second station");
 
 1269                              "PSDU size expected to exceed length based RTS/CTS threshold");
 
 1274                              rtsCtsTxDurationThresh,
 
 1275                              "PSDU duration expected to exceed duration based RTS/CTS threshold");
 
 1284             ? 
"Duration/ID of the second QoS data frame does not cover the remaining TXOP" 
 1285             : 
"Duration/ID of the second QoS data frame must be set to remaining time to " 
 1286               "complete DATA+(Block)ACK sequence"));
 
 1294                          ack << 
" in response to the second QoS data frame sent too early");
 
 1296                          tEnd + sifs + tolerance,
 
 1297                          ack << 
" in response to the second QoS data frame sent too late");
 
 1301        "Expected a " << ack);
 
 1303                          apDev->GetMac()->GetAddress(),
 
 1304                          "Expected a " << ack << 
" sent to the AP");
 
 1306        m_txPsdus[idx + 1].header.GetDuration(),
 
 1307        RoundDurationId(
m_txPsdus[idx].header.GetDuration() - sifs - 
m_txPsdus[idx + 1].txDuration),
 
 1308        "Duration/ID of the " << ack << 
" must be derived from that of the previous frame");
 
 1324            "Expected an RTS frame sent by the AP to the third station");
 
 1333                 ? 
"Duration/ID of the third RTS frame must cover the whole TXOP" 
 1334                 : 
"Duration/ID of the third RTS frame must be set to remaining time to complete " 
 1335                   "CTS+DATA+(Block)ACK sequence"));
 
 1343                              "CTS in response to the third RTS frame sent too early");
 
 1345                              tEnd + sifs + tolerance,
 
 1346                              "CTS in response to the third RTS frame sent too late");
 
 1349                              apDev->GetMac()->GetAddress(),
 
 1350                              "Expected a CTS frame sent to the AP");
 
 1352            m_txPsdus[idx + 1].header.GetDuration(),
 
 1353            RoundDurationId(
m_txPsdus[idx].header.GetDuration() - sifs -
 
 1355            "Duration/ID of the CTS frame must be derived from that of the RTS frame");
 
 1369                          "Expected a frame sent by the AP to the third station");
 
 1374                              "PSDU size expected to exceed length based RTS/CTS threshold");
 
 1379                              rtsCtsTxDurationThresh,
 
 1380                              "PSDU duration expected to exceed duration based RTS/CTS threshold");
 
 1389             ? 
"Duration/ID of the third QoS data frame does not cover the remaining TXOP" 
 1390             : 
"Duration/ID of the third QoS data frame must be set to remaining time to " 
 1391               "complete DATA+(Block)ACK sequence"));
 
 1399                          ack << 
" in response to the third QoS data frame sent too early");
 
 1401                          tEnd + sifs + tolerance,
 
 1402                          ack << 
" in response to the third QoS data frame sent too late");
 
 1406        "Expected a " << ack);
 
 1408                          apDev->GetMac()->GetAddress(),
 
 1409                          "Expected a " << ack << 
" sent to the AP");
 
 1411        m_txPsdus[idx + 1].header.GetDuration(),
 
 1412        RoundDurationId(
m_txPsdus[idx].header.GetDuration() - sifs - 
m_txPsdus[idx + 1].txDuration),
 
 1413        "Duration/ID of the " << ack << 
" must be derived from that of the previous frame");
 
 1429                              "Duration/ID must be set to 0 for CF-End frames");
 
 
 1454    for (
const auto nonHt : {
true, 
false})
 
 1456        for (
const auto pifsRecovery : {
true, 
false})
 
 1458            for (
const auto singleRtsPerTxop : {
true, 
false})
 
 1460                for (
const auto lengthBasedRtsCtsThresh : {
true, 
false})
 
 1462                    for (
const auto protectedIfResponded : {
true, 
false})
 
 1464                        for (
const auto protectSingleExchange : {
false, 
true})
 
 1466                            for (
const auto& singleExchangeProtectionBuffer :
 
 1469                                if (!protectSingleExchange &&
 
 1470                                    singleExchangeProtectionBuffer.IsStrictlyPositive())
 
 1476                                                .pifsRecovery = pifsRecovery,
 
 1477                                                .singleRtsPerTxop = singleRtsPerTxop,
 
 1478                                                .lengthBasedRtsCtsThresh = lengthBasedRtsCtsThresh,
 
 1479                                                .protectedIfResponded = protectedIfResponded,
 
 1480                                                .protectSingleExchange = protectSingleExchange,
 
 1481                                                .singleExchangeProtectionBuffer =
 
 1482                                                    singleExchangeProtectionBuffer,
 
 1484                                            TestCase::Duration::QUICK);
 
 
void L7Receive(std::string context, Ptr< const Packet > p, const Address &addr)
Function to trace packets received by the server application.
bool m_pifsRecovery
whether PIFS recovery is used after failure of a non-initial frame
std::vector< PacketSocketAddress > m_dlSockets
packet socket address for DL traffic
NetDeviceContainer m_apDevices
container for AP's NetDevice
WifiTxopTest(const Params ¶ms)
Constructor.
uint8_t m_staAifsn
AIFSN for STAs (AC BE)
void DoRun() override
Implementation to actually run this TestCase.
uint16_t m_received
number of packets received by the stations
TrafficDirection
Enumeration for traffic directions.
uint16_t m_nStations
number of stations
Ptr< ListErrorModel > m_apErrorModel
error model to install on the AP
uint32_t m_staCwMin
CWmin for STAs (AC BE)
Time m_singleExchangeProtectionSurplus
whether the NAV duration should be extended by a PIFS after the frame exchange when protection only c...
bool m_nonHt
use 802.11a standard if true, 802.11ax standard otherwise
std::size_t m_payloadSizeRtsOff
size in bytes of packets not protected by RTS
WifiMode m_mode
wifi mode used to transmit data frames
Time m_apTxopLimit
TXOP limit for AP (AC BE)
std::vector< FrameInfo > m_txPsdus
transmitted PSDUs
Time m_startTime
time when data frame exchanges start
std::vector< PacketSocketAddress > m_ulSockets
packet socket address for UL traffic
bool m_staCorrupted
whether the frame to be corrupted by the STA has been corrupted
Ptr< PacketSocketClient > GetApplication(TrafficDirection dir, std::size_t staId, std::size_t count, std::size_t pktSize) const
void Transmit(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when PHY receives a PSDU to transmit.
bool m_singleRtsPerTxop
whether protection mechanism is used no more than once per TXOP
bool m_protectedIfResponded
whether a station is assumed to be protected if replied to a frame requiring acknowledgment
NetDeviceContainer m_staDevices
container for stations' NetDevices
bool m_apCorrupted
whether the frame to be corrupted by the AP has been corrupted
std::size_t m_payloadSizeRtsOn
size in bytes of packets protected by RTS
uint32_t m_staCwMax
CWmax for STAs (AC BE)
bool m_lengthBasedRtsCtsThresh
if true, use length based RTS/CTS threshold; if false, use TX duration based RTS/CTS threshold
Time m_staTxopLimit
TXOP limit for STAs (AC BE)
bool m_protectSingleExchange
whether the Duration/ID field in frames establishing protection only covers the immediate frame excha...
Ptr< ListErrorModel > m_staErrorModel
error model to install on a STA
void CheckResults()
Check correctness of transmitted frames.
a polymophic address class
std::map< AcIndex, std::vector< uint64_t > > UintAccessParamsMap
ACI-indexed map of access parameters of type unsigned integer (CWmin, CWmax and AIFSN)
A container for one type of attribute.
AttributeValue implementation for Boolean.
Provide a list of Packet uids to corrupt.
void SetList(const std::list< uint64_t > &packetlist)
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
PHY entity for OFDM (11a)
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
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.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Make it easy to create and manage PHY objects for the spectrum model.
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
bool LookupAttributeByName(std::string name, AttributeInformation *info, bool permissive=false) const
Find an Attribute by name, retrieving the associated AttributeInformation.
Hold an unsigned integer type.
helps to create WifiNetDevice objects
static int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the PHY and MAC aspects ...
create MAC layers for a ns3::WifiNetDevice.
represent a single transmission mode
uint64_t GetDataRate(MHz_u channelWidth, Time guardInterval, uint8_t nss) const
AttributeValue implementation for WifiMode.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
static TypeId GetTypeId()
Get the type ID.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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.
#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_OR_EQ(actual, limit, msg)
Test that an actual value is less than or equal to a limit and report 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.
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Time GetEstimatedAckTxTime(const WifiTxVector &txVector)
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Information about transmitted frames.
WifiMacHeader header
Frame MAC header.
WifiTxVector txVector
TX vector used to transmit the frame.
Time txStart
Frame start TX time.
Time txDuration
Frame TX duration.
uint32_t size
PSDU size in bytes.
Parameters for this test.
bool lengthBasedRtsCtsThresh
if true, use length based RTS/CTS threshold; if false, use TX duration based RTS/CTS threshold
bool protectSingleExchange
whether the Duration/ID field in frames establishing protection only covers the immediate frame excha...
bool protectedIfResponded
whether a station is assumed to be protected if replied to a frame requiring acknowledgment
bool singleRtsPerTxop
whether protection mechanism is used no more than once per TXOP
bool nonHt
use 802.11a standard if true, 802.11ax standard otherwise
Time singleExchangeProtectionBuffer
whether the NAV duration should be extended by a PIFS after the frame exchange when protection only c...
bool pifsRecovery
whether PIFS recovery is used after failure of a non-initial frame
uint32_t pktSize
packet size used for the simulation (in bytes)
static WifiTxopTestSuite g_wifiTxopTestSuite
the test suite