9#include "ns3/adhoc-wifi-mac.h" 
   10#include "ns3/ap-wifi-mac.h" 
   11#include "ns3/channel-access-manager.h" 
   12#include "ns3/config.h" 
   13#include "ns3/frame-exchange-manager.h" 
   14#include "ns3/interference-helper.h" 
   15#include "ns3/mgt-action-headers.h" 
   16#include "ns3/mobility-helper.h" 
   17#include "ns3/multi-model-spectrum-channel.h" 
   18#include "ns3/packet-socket-client.h" 
   19#include "ns3/packet-socket-helper.h" 
   20#include "ns3/packet-socket-server.h" 
   21#include "ns3/pointer.h" 
   22#include "ns3/qos-txop.h" 
   23#include "ns3/rng-seed-manager.h" 
   24#include "ns3/simulator.h" 
   25#include "ns3/spectrum-wifi-helper.h" 
   26#include "ns3/spectrum-wifi-phy.h" 
   27#include "ns3/sta-wifi-mac.h" 
   28#include "ns3/string.h" 
   30#include "ns3/wifi-net-device.h" 
   31#include "ns3/wifi-spectrum-phy-interface.h" 
   41template <
typename TxopType>
 
   50template <
typename TxopType>
 
   67    void QueueTx(uint64_t txTime, uint64_t expectedGrantTime);
 
 
  122        static TypeId tid = 
TypeId(
"ns3::ChannelAccessManagerStub")
 
  124                                .SetGroupName(
"Wifi")
 
  126                                .HideFromDocumentation();
 
 
 
  187template <
typename TxopType>
 
  211        dcf->NotifyChannelAccessed(0);
 
 
  224        m_test->NotifyChannelSwitching();
 
 
 
  237template <
typename TxopType>
 
  318    void AddRxOkEvt(uint64_t at, uint64_t duration);
 
  331    void AddRxErrorEvt(uint64_t at, uint64_t duration, uint64_t timeUntilError);
 
  343    void AddTxEvt(uint64_t at, uint64_t duration);
 
  378                                        uint64_t expectedGrantTime,
 
  390                                           uint64_t expectedGrantTime,
 
  400                         uint64_t expectedGrantTime,
 
 
  467template <
typename TxopType>
 
  474template <
typename TxopType>
 
  481template <
typename TxopType>
 
  486    TxopType::DoDispose();
 
 
  489template <
typename TxopType>
 
  497template <
typename TxopType>
 
  504template <
typename TxopType>
 
  511template <
typename TxopType>
 
  517template <
typename TxopType>
 
  523    if (!state->m_expectedGrants.empty())
 
  525        std::pair<uint64_t, uint64_t> expected = state->m_expectedGrants.front();
 
  526        state->m_expectedGrants.pop_front();
 
  529                              "Expected access grant is now");
 
 
  536template <
typename TxopType>
 
  546template <
typename TxopType>
 
  552                          "Have expected internal collisions");
 
  553    if (!state->m_expectedInternalCollision.empty())
 
  559                              MicroSeconds(expected.at),
 
  560                              "Expected internal collision time is now");
 
  561        state->StartBackoffNow(expected.nSlots, 0);
 
 
  565template <typename TxopType>
 
  571    if (!state->m_expectedBackoff.empty())
 
  576                              MicroSeconds(expected.at),
 
  577                              "Expected backoff is now");
 
  578        state->StartBackoffNow(expected.nSlots, 0);
 
 
  582template <typename TxopType>
 
  586    for (
auto& state : 
m_txop)
 
  588        if (!state->m_expectedGrants.empty())
 
  590            std::pair<uint64_t, uint64_t> expected = state->m_expectedGrants.front();
 
  591            state->m_expectedGrants.pop_front();
 
  594                                  "Expected grant is now");
 
 
  600template <
typename TxopType>
 
  613template <typename TxopType>
 
  620    backoff.nSlots = nSlots;
 
 
  624template <typename TxopType>
 
  634template <
typename TxopType>
 
  641template <
typename TxopType>
 
  646        "ResetBackoffThreshold",
 
 
  666template <
typename TxopType>
 
  677    mac->SetWifiPhys({
m_phy});
 
  679    txop->SetWifiMac(mac);
 
  680    txop->SetAifsn(aifsn);
 
 
  683template <
typename TxopType>
 
  701                              "Have no internal collisions");
 
 
  711template <
typename TxopType>
 
  724template <
typename TxopType>
 
  734template <
typename TxopType>
 
  761template <
typename TxopType>
 
  765                                                  uint64_t timeUntilError)
 
  793                        std::vector<Time>{});
 
 
  796template <
typename TxopType>
 
  806template <
typename TxopType>
 
  816template <
typename TxopType>
 
  825template <
typename TxopType>
 
  829                                                     uint64_t expectedGrantTime,
 
 
  835template <
typename TxopType>
 
  839                                                                   uint64_t expectedGrantTime,
 
 
  850template <
typename TxopType>
 
  854                                                                      uint64_t expectedGrantTime,
 
 
  868template <
typename TxopType>
 
  871                                                    uint64_t expectedGrantTime,
 
  875    state->QueueTx(txTime, expectedGrantTime);
 
  878        state->GenerateBackoff(0);
 
 
  883template <
typename TxopType>
 
  889    const auto chWidth = 
m_phy->GetChannelWidth();
 
  890    std::vector<Time> per20MhzDurations(chWidth == 20 ? 0 : chWidth / 20, 
Seconds(0));
 
 
  899template <
typename TxopType>
 
  910template <
typename TxopType>
 
  920template <
typename TxopType>
 
  943                txop->GenerateBackoff(0);
 
 
  950template <
typename TxopType>
 
  958        newPhy->SetOperatingChannel(
m_phy->GetOperatingChannel());
 
 
  973template <
typename TxopType>
 
  981template <
typename TxopType>
 
 1094    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10});
 
 1108    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10});
 
 1120    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10});
 
 1134    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10});
 
 
 1389    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10, .chWidth = 
MHz_u{160}});
 
 1404    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10, .chWidth = 
MHz_u{160}});
 
 1419    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10, .chWidth = 
MHz_u{160}});
 
 1434    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10, .chWidth = 
MHz_u{320}});
 
 1449    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10, .chWidth = 
MHz_u{320}});
 
 1464    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10, .chWidth = 
MHz_u{320}});
 
 1479    StartTest({.slotTime = 4, .sifs = 6, .eifsNoDifsNoSifs = 10, .chWidth = 
MHz_u{320}});
 
 1520    StartTest({.slotTime = 4, .sifs = 6, .resetBackoffThr = 5});
 
 1534    StartTest({.slotTime = 4, .sifs = 6, .resetBackoffThr = 20});
 
 1564    StartTest({.slotTime = 4, .sifs = 6, .resetBackoffThr = 5});
 
 1579    StartTest({.slotTime = 4, .sifs = 6, .resetBackoffThr = 20});
 
 1594    StartTest({.slotTime = 4, .sifs = 6, .resetBackoffThr = 5});
 
 1609    StartTest({.slotTime = 4, .sifs = 6, .resetBackoffThr = 20});
 
 
 1637    void DoRun() 
override;
 
 
 1652    : 
TestCase(
"Check calculation of the largest idle primary channel")
 
 
 1695                               : ((1 << (busyChannel - 1)) * 
MHz_u{20});
 
 1697    Time checkTime1 = start + ccaBusyStartDelay + ccaBusyDuration / 2;
 
 1699        Time interval1 = (ccaBusyStartDelay + ccaBusyDuration) / 2;
 
 1702                              "Incorrect width of the idle channel in an interval " 
 1703                                  << 
"ending within CCA_BUSY (channel width: " << chWidth
 
 1704                                  << 
" MHz, busy channel: " << busyChannel << 
")");
 
 1710    Time checkTime2 = start + ccaBusyStartDelay + ccaBusyDuration + ccaBusyRxInterval / 2;
 
 1712        Time interval2 = (ccaBusyDuration + ccaBusyRxInterval) / 2;
 
 1715                              "Incorrect width of the idle channel in an interval " 
 1716                                  << 
"starting within CCA_BUSY (channel width: " << chWidth
 
 1717                                  << 
" MHz, busy channel: " << busyChannel << 
")");
 
 1729    Time checkTime3 = start + ccaBusyStartDelay + ccaBusyDuration + ccaBusyRxInterval + rxDuration;
 
 1731        Time interval3 = ccaBusyDuration / 2 + ccaBusyRxInterval;
 
 1732        Time end3 = checkTime3 - rxDuration;
 
 1735                              "Incorrect width of the idle channel in an interval " 
 1736                                  << 
"preceding RX start and overlapping CCA_BUSY " 
 1737                                  << 
"(channel width: " << chWidth
 
 1738                                  << 
" MHz, busy channel: " << busyChannel << 
")");
 
 1743    const Time& checkTime4 = checkTime3;
 
 1745        const Time& interval4 = ccaBusyRxInterval;
 
 1746        Time end4 = checkTime4 - rxDuration;
 
 1749                              "Incorrect width of the idle channel in the interval " 
 1750                                  << 
"following CCA_BUSY and preceding RX start (channel " 
 1751                                  << 
"width: " << chWidth << 
" MHz, busy channel: " << busyChannel
 
 1758    Time checkTime5 = checkTime4 + interval5;
 
 1762                              "Incorrect width of the idle channel in an interval " 
 1763                                  << 
"following RX end (channel width: " << chWidth
 
 1764                                  << 
" MHz, busy channel: " << busyChannel << 
")");
 
 1768    const Time& checkTime6 = checkTime5;
 
 1770        Time interval6 = interval5 + rxDuration / 2;
 
 1773                              "Incorrect width of the idle channel in an interval " 
 1774                                  << 
"overlapping RX (channel width: " << chWidth
 
 1775                                  << 
" MHz, busy channel: " << busyChannel << 
")");
 
 
 1784    uint8_t channel = 0;
 
 1785    std::list<WifiChannelListType> busyChannels;
 
 1791        for (
const auto busyChannel : busyChannels)
 
 1804                m_phy->SetOperatingChannel(
 
 1811                RunOne(chWidth, busyChannel);
 
 
 1884    void DoRun() 
override;
 
 
 1932    : 
TestCase(
"Check attributes impacting the generation of backoff values"),
 
 
 1947    int64_t streamNumber = 10;
 
 1959    wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
 
 1968    phyHelper.
Set(
"ChannelSettings", 
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
 
 1972    mac.SetType(
"ns3::ApWifiMac",
 
 1980    mac.SetType(
"ns3::StaWifiMac",
 
 1993        ->TraceConnectWithoutContext(
"PhyTxPsduBegin",
 
 1996        ->TraceConnectWithoutContext(
"PhyTxPsduBegin",
 
 2000    m_apMac->GetQosTxop(
AC_VO)->TraceConnectWithoutContext(
 
 2009    positionAlloc->Add(Vector(0.0, 0.0, 0.0));
 
 2010    positionAlloc->Add(Vector(1.0, 0.0, 0.0));
 
 2013    mobility.SetPositionAllocator(positionAlloc);
 
 2014    mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
 
 2015    mobility.Install(apNode);
 
 2016    mobility.Install(staNode);
 
 2021    packetSocket.
Install(staNode);
 
 2029    server->SetLocal(srvAddr);
 
 2030    server->SetStartTime(
Seconds(0));
 
 2031    server->SetStopTime(
Seconds(1));
 
 2032    staNode->AddApplication(server);
 
 2057                                                 {SINGLE_LINK_OP_ID});
 
 
 2068                          "Unexpected total number of generated backoff values");
 
 
 2081    for (
const auto& [aid, psdu] : psduMap)
 
 2083        std::stringstream ss;
 
 2084        ss << std::setprecision(10) << psdu->GetHeader(0).GetTypeString();
 
 2085        if (psdu->GetHeader(0).IsAction())
 
 2089            psdu->GetPayload(0)->PeekHeader(actionHdr);
 
 2090            actionHdr.
Print(ss);
 
 2092        ss << 
" #MPDUs " << psdu->GetNMpdus() << 
" duration/ID " << psdu->GetHeader(0).GetDuration()
 
 2093           << 
" RA = " << psdu->GetAddr1() << 
" TA = " << psdu->GetAddr2()
 
 2094           << 
" ADDR3 = " << psdu->GetHeader(0).GetAddr3()
 
 2095           << 
" ToDS = " << psdu->GetHeader(0).IsToDs()
 
 2096           << 
" FromDS = " << psdu->GetHeader(0).IsFromDs();
 
 2097        if (psdu->GetHeader(0).IsAssocReq())
 
 2102        else if (psdu->GetHeader(0).IsAck())
 
 2111                                    m_apMac->GetDevice()->GetNode(),
 
 2115        else if (psdu->GetHeader(0).IsQosData())
 
 2120                ss << mpdu->GetHeader().GetSequenceNumber() << 
",";
 
 2122            ss << 
"} TID = " << +psdu->GetHeader(0).GetQosTid();
 
 2130    NS_LOG_INFO(
"TX duration = " << txDuration.As(
Time::MS) << 
"  TXVECTOR = " << txVector << 
"\n");
 
 
 2136    NS_LOG_INFO(
"Backoff value " << backoff << 
" generated by AP on link " << +linkId << 
" for " 
 2141    const std::size_t nValues = 5;
 
 2148                              "First backoff value should be generated at initialization time");
 
 2156                                  "Second backoff value should be generated after association");
 
 2163                "Second backoff value should be generated after AssocReq TX start time");
 
 2166                                  "Second backoff value should be generated right after AssocReq " 
 2167                                  "PPDU payload starts");
 
 2175                                  "Third backoff value should be generated after association");
 
 2179                GenerateInterference();
 
 2185                    NS_TEST_EXPECT_MSG_EQ(m_nGenBackoff,
 
 2187                                          "Unexpected number of generated backoff values");
 
 2194                    Simulator::Schedule(m_interferenceDuration, [=, this]() {
 
 2195                        auto voEdcaf = m_apMac->GetQosTxop(AC_VO);
 
 2197                        m_apMac->GetChannelAccessManager(linkId)->NeedBackoffUponAccess(voEdcaf,
 
 2201                            m_apMac->GetChannelAccessManager(linkId)->GetBackoffEndFor(voEdcaf) -
 
 2202                            Simulator::Now() + NanoSeconds(1);
 
 2205                        Simulator::Schedule(delay, [=, this]() {
 
 2207                            NS_TEST_EXPECT_MSG_EQ(m_nGenBackoff,
 
 2209                                                  "Unexpected number of generated backoff values");
 
 2210                            GenerateInterference();
 
 2212                            NS_TEST_EXPECT_MSG_EQ(m_nGenBackoff,
 
 2214                                                  "Unexpected number of generated backoff values");
 
 2226                                                       m_staMac->GetAddress(),
 
 2227                                                       m_apMac->GetAddress(),
 
 2233    if (m_generateBackoffIfTxopWithoutTx)
 
 2239        if (m_nGenBackoff == 1)
 
 2242            delay = m_apMac->GetWifiPhy(linkId)->GetSifs() +
 
 2243                    m_apMac->GetQosTxop(
AC_VO)->GetAifsn(linkId) *
 
 2244                        m_apMac->GetWifiPhy(linkId)->GetSlot();
 
 2246        else if (m_nGenBackoff <= nValues)
 
 2250                                  "Expected a timer to be running");
 
 2253                                  "Backoff value generated too early");
 
 2254            m_nextBackoffGen.Cancel();
 
 2257        if (m_nGenBackoff < nValues)
 
 2260            delay += backoff * m_apMac->GetWifiPhy(linkId)->GetSlot();
 
 
 2275                          "Expected a new backoff value to be generated at time " 
 
 2289    spectrumSignalParams->txPhy = phy->GetCurrentInterface();
 
 2290    spectrumSignalParams->txAntenna = phy->GetAntenna();
 
 2291    spectrumSignalParams->psd = psd;
 
 2293    phy->StartRx(spectrumSignalParams, phy->GetCurrentInterface());
 
 
static ChannelAccessManagerTestSuite g_camTestSuite
static TxopTestSuite g_dcfTestSuite
static QosTxopTestSuite g_edcaTestSuite
Test the GenerateBackoffIfTxopWithoutTx and ProactiveBackoff attributes of the ChannelAccessManager.
void Transmit(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when a FEM passes PSDUs to the PHY.
Ptr< StaWifiMac > m_staMac
MAC of the non-AP STA.
Ptr< ApWifiMac > m_apMac
AP wifi MAC.
std::size_t m_nGenBackoff
number of generated backoff values
void GenerateInterference()
Generate interference to make CCA busy.
Time m_assocReqStartTxTime
Association Request start TX time.
const Time m_interferenceDuration
interference duration
static constexpr uint8_t m_tid
TID of generated packet.
Ptr< PacketSocketClient > m_client
client to be installed on the AP after association
void MissedBackoff()
Indicate that a new backoff value has not been generated as expected.
EventId m_nextBackoffGen
timer elapsing when next backoff value is expected to be generated
void DoRun() override
Implementation to actually run this TestCase.
std::size_t m_nAcks
number of transmitted Ack frames
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void BackoffGenerated(AcIndex ac, uint32_t backoff, uint8_t linkId)
Callback invoked when a new backoff value is generated by the given AC on the station.
Time m_assocReqPpduHdrDuration
Association Request PPDU header TX duration.
bool m_generateBackoffIfTxopWithoutTx
whether the GenerateBackoffIfTxopWithoutTx attribute is set to true
std::size_t m_nExpectedGenBackoff
expected total number of generated backoff values
bool m_proactiveBackoff
whether the ProactiveBackoff attribute is set to true
BackoffGenerationTest(TestType type)
Constructor.
TestType
Tested attributes.
@ GEN_BACKOFF_IF_TXOP_NO_TX
ChannelAccessManager Stub.
Time GetEifsNoDifs() const override
Return the EIFS duration minus a DIFS.
void SetEifsNoDifs(Time eifsNoDifs)
Set the duration of EIFS - DIFS.
void SetSlot(Time slot)
Set the slot duration.
Time GetSlot() const override
Return the slot duration for this PHY.
Time m_sifs
SIFS duration.
Time GetSifs() const override
Return the Short Interframe Space (SIFS) for this PHY.
void SetSifs(Time sifs)
Set the Short Interframe Space (SIFS).
static TypeId GetTypeId()
Get the type ID.
Time m_eifsNoDifs
EIFS duration minus a DIFS.
Channel Access Manager Test.
void AddAccessRequestWithSuccessfulAck(uint64_t at, uint64_t txTime, uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from)
Add access request with successful ack.
void AddAckTimeoutReset(uint64_t at)
Add Ack timeout reset function.
void NotifyInternalCollision(Ptr< TxopTest< TxopType > > state)
Notify internal collision function.
void AddRxOkEvt(uint64_t at, uint64_t duration)
Add receive OK event function.
void AddRxStartEvt(uint64_t at, uint64_t duration)
Add receive start event function.
void StartTest(const Params ¶ms)
Start test function.
uint32_t m_ackTimeoutValue
the Ack timeout value
void AddAccessRequestWithAckTimeout(uint64_t at, uint64_t txTime, uint64_t expectedGrantTime, uint32_t from)
Add access request with Ack timeout.
ChannelAccessManagerTest()
void AddPhyReconnectEvt(uint64_t at, uint64_t duration)
Add a PHY reconnect event consisting in another PHY operating on the link for the given time.
void GenerateBackoff(uint32_t i)
Generate backoff function.
void NotifyAccessGranted(uint32_t i)
Notify access granted function.
std::vector< Ptr< TxopTest< TxopType > > > TxopTests
the TXOP tests typedef
void AddPhyOffEvt(uint64_t at, uint64_t duration)
Add PHY off/on events.
void ExpectBackoff(uint64_t time, uint32_t nSlots, uint32_t from)
Expect generate backoff function.
void DoRun() override
Implementation to actually run this TestCase.
void AddTxop(uint32_t aifsn)
Add Txop function.
void AddPhyDisconnectEvt(uint64_t at, uint64_t duration, uint32_t from)
Add a PHY disconnect event consisting in the PHY leaving the link and returning after a given time.
Ptr< SpectrumWifiPhy > m_phy
the PHY object
void DoAccessRequest(uint64_t txTime, uint64_t expectedGrantTime, Ptr< TxopTest< TxopType > > state)
Add access request with successful Ack.
void AddAccessRequest(uint64_t at, uint64_t txTime, uint64_t expectedGrantTime, uint32_t from)
Add access function.
void AddSwitchingEvt(uint64_t at, uint64_t duration)
Add switching event function.
Ptr< ChannelAccessManagerStub > m_ChannelAccessManager
the channel access manager
void AddRxErrorEvt(uint64_t at, uint64_t duration)
Add receive error event function for error at end of frame.
void ExpectBusy(uint64_t time, bool busy)
Schedule a check that the channel access manager is busy or idle.
void EndTest()
End test function.
void AddPhySleepEvt(uint64_t at, uint64_t duration)
Add PHY sleep/resume events.
TxopTests m_txop
the vector of Txop test instances
void ExpectInternalCollision(uint64_t time, uint32_t nSlots, uint32_t from)
Expect internal collision function.
void AddNavStart(uint64_t at, uint64_t duration)
Add NAV start function.
void AddRxInsideSifsEvt(uint64_t at, uint64_t duration)
Add receive inside SIFS event function.
void AddCcaBusyEvt(uint64_t at, uint64_t duration, WifiChannelListType channelType=WIFI_CHANLIST_PRIMARY)
Add CCA busy event function.
Ptr< FrameExchangeManagerStub< TxopType > > m_feManager
the Frame Exchange Manager stubbed
void DoCheckBusy(bool busy)
Perform check that channel access manager is busy or idle.
void AddNavReset(uint64_t at, uint64_t duration)
Add NAV reset function.
void AddTxEvt(uint64_t at, uint64_t duration)
Add transmit event function.
void NotifyChannelSwitching()
Notify channel switching function.
ChannelAccessManager Test Suite.
ChannelAccessManagerTestSuite()
void NotifySwitchingStartNow(Time duration) override
void NotifyInternalCollision(Ptr< Txop > txop) override
Notify that an internal collision has occurred for the given Txop.
bool StartTransmission(Ptr< Txop > dcf, MHz_u allowedWidth) override
Request the FrameExchangeManager to start a frame exchange sequence.
ChannelAccessManagerTest< TxopType > * m_test
the test DCF/EDCA manager
FrameExchangeManagerStub(ChannelAccessManagerTest< TxopType > *test)
Constructor.
Test the calculation of the largest idle primary channel performed by ChannelAccessManager::GetLarges...
Ptr< SpectrumWifiPhy > m_phy
PHY object.
LargestIdlePrimaryChannelTest()
void RunOne(MHz_u chWidth, WifiChannelListType busyChannel)
Test a specific combination of operating channel width and busy channel type.
~LargestIdlePrimaryChannelTest() override=default
void DoRun() override
Implementation to actually run this TestCase.
Ptr< ChannelAccessManager > m_cam
channel access manager
ExpectedBackoffs m_expectedInternalCollision
expected backoff due to an internal collision
void DoDispose() override
Destructor implementation.
void GenerateBackoff(uint8_t linkId) override
Generate a new backoff for the given link now.
uint32_t m_i
the index of the Txop
void NotifyChannelAccessed(uint8_t linkId, Time txopDuration=Seconds(0)) override
Called by the FrameExchangeManager to notify that channel access has been granted on the given link f...
void QueueTx(uint64_t txTime, uint64_t expectedGrantTime)
Queue transmit function.
ExpectedBackoffs m_expectedBackoff
expected backoff (not due to an internal collision)
std::list< ExpectedGrant > ExpectedGrants
the collection of expected grants typedef
ChannelAccessManagerTest< TxopType > * m_test
Check if the Txop has frames to transmit.
ExpectedGrants m_expectedGrants
expected grants
std::list< ExpectedBackoff > ExpectedBackoffs
expected backoffs typedef
bool HasFramesToTransmit(uint8_t linkId) override
Check if the Txop has frames to transmit over the given link.
TxopTest(ChannelAccessManagerTest< TxopType > *test, uint32_t i)
Constructor.
std::pair< uint64_t, uint64_t > ExpectedGrant
the expected grant typedef
AttributeValue implementation for Boolean.
Manage a set of ns3::Txop.
void NotifyRxStartNow(Time duration)
void NotifySwitchingStartNow(PhyListener *phyListener, Time duration)
void NotifyAckTimeoutResetNow()
Notify that ack timer has reset.
void NotifyTxStartNow(Time duration)
void NotifyRxEndOkNow()
Notify the Txop that a packet reception was just completed successfully.
void NotifyCcaBusyStartNow(Time duration, WifiChannelListType channelType, const std::vector< Time > &per20MhzDurations)
void RemovePhyListener(Ptr< WifiPhy > phy)
Remove current registered listener for PHY events on the given PHY.
void NotifyRxEndErrorNow(const WifiTxVector &txVector)
Notify the Txop that a packet reception was just completed unsuccessfully.
void NotifyNavResetNow(Time duration)
void NotifyNavStartNow(Time duration)
An identifier for simulation events.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6 Mbps.
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.
AttributeValue implementation for Pointer.
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.
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Make it easy to create and manage PHY objects for the spectrum model.
void AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
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.
TestCase(const TestCase &)=delete
@ UNIT
This test suite implements a Unit Test.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
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.
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
void Set(std::string name, const AttributeValue &v)
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
void SetSleepMode(bool forceSleepWhileInRx=false)
Put in sleep mode.
void ResumeFromSleep()
Resume from sleep mode.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
WifiChannelConfig::SegmentWithoutUnits ChannelTuple
kept for backward compatibility, can be deprecated when using strong types
void SetOffMode()
Put in off mode.
void ResumeFromOff()
Resume from off mode.
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void SetDefault(std::string name, const AttributeValue &value)
#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.
Ptr< T > CreateObjectWithAttributes(Args... args)
Allocate an Object on the heap and initialize with a set of attributes.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Now()
create an ns3::Time instance which contains the current simulation time.
#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_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit 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.
WifiChannelListType
Enumeration of the possible channel-list parameter elements defined in Table 8-5 of IEEE 802....
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_CHANLIST_SECONDARY40
@ WIFI_CHANLIST_SECONDARY
@ WIFI_CHANLIST_SECONDARY160
@ WIFI_CHANLIST_SECONDARY80
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
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...
double MHz_u
MHz weak type.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
std::size_t Count20MHzSubchannels(MHz_u channelWidth)
Return the number of 20 MHz subchannels covering the channel width.
double dBm_u
dBm weak type
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...
Watt_u DbmToW(dBm_u val)
Convert from dBm to Watts.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
-ns3 Test suite for the ns3 wrapper script
Input parameters for the StartTest function.
uint64_t sifs
the SIFS in microseconds
uint64_t resetBackoffThr
reset backoff threshold
uint64_t slotTime
the slot time in microseconds
MHz_u chWidth
the channel width
uint64_t eifsNoDifsNoSifs
the EIFS no DIFS no SIFS in microseconds
uint32_t ackTimeoutValue
the Ack timeout value in microseconds
ExpectedBackoff structure.
uint32_t nSlots
number of slots
ChannelAccessStatus access
channel access status