22 #include "ns3/simulator.h" 23 #include "ns3/channel-access-manager.h" 25 #include "ns3/mac-low.h" 53 void QueueTx (uint64_t txTime, uint64_t expectedGrantTime);
73 bool IsAccessRequested (
void)
const;
74 void NotifyAccessRequested (
void);
75 void NotifyAccessGranted (
void);
76 void NotifyInternalCollision (
void);
77 void NotifyCollision (
void);
78 void NotifyChannelSwitching (
void);
79 void NotifySleep (
void);
80 void NotifyWakeUp (
void);
81 void DoDispose (
void);
119 virtual void DoRun (
void);
125 void NotifyAccessGranted (uint32_t i);
130 void NotifyInternalCollision (uint32_t i);
135 void NotifyCollision (uint32_t i);
140 void NotifyChannelSwitching (uint32_t i);
151 void StartTest (uint64_t slotTime, uint64_t sifs, uint64_t eifsNoDifsNoSifs, uint32_t ackTimeoutValue = 20);
156 void AddDcfState (uint32_t aifsn);
165 void ExpectInternalCollision (uint64_t time, uint32_t nSlots, uint32_t from);
172 void ExpectCollision (uint64_t time, uint32_t nSlots, uint32_t from);
178 void AddRxOkEvt (uint64_t at, uint64_t duration);
184 void AddRxErrorEvt (uint64_t at, uint64_t duration);
190 void AddRxInsideSifsEvt (uint64_t at, uint64_t duration);
196 void AddTxEvt (uint64_t at, uint64_t duration);
202 void AddNavReset (uint64_t at, uint64_t duration);
208 void AddNavStart (uint64_t at, uint64_t duration);
213 void AddAckTimeoutReset (uint64_t at);
221 void AddAccessRequest (uint64_t at, uint64_t txTime,
222 uint64_t expectedGrantTime, uint32_t from);
230 void AddAccessRequestWithAckTimeout (uint64_t at, uint64_t txTime,
231 uint64_t expectedGrantTime, uint32_t from);
240 void AddAccessRequestWithSuccessfullAck (uint64_t at, uint64_t txTime,
241 uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from);
248 void DoAccessRequest (uint64_t txTime, uint64_t expectedGrantTime,
Ptr<TxopTest> state);
254 void AddCcaBusyEvt (uint64_t at, uint64_t duration);
260 void AddSwitchingEvt (uint64_t at, uint64_t duration);
266 void AddRxStartEvt (uint64_t at, uint64_t duration);
279 m_expectedGrants.push_back (std::make_pair (txTime, expectedGrantTime));
285 m_accessRequested (false)
436 m_low = CreateObject<MacLowStub> ();
457 Simulator::Destroy ();
459 for (TxopTests::const_iterator i =
m_txop.begin (); i !=
m_txop.end (); i++)
469 for (TxopTests::const_iterator i =
m_txop.begin (); i !=
m_txop.end (); i++)
534 uint64_t expectedGrantTime, uint32_t from)
541 uint64_t expectedGrantTime, uint32_t from)
545 txTime, expectedGrantTime,
m_txop[from]);
550 uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from)
555 txTime, expectedGrantTime,
m_txop[from]);
562 state->
QueueTx (txTime, expectedGrantTime);
void Dispose(void)
Dispose of this Object.
Ptr< MacLowStub > m_low
the MAC low stubbed
void AddRxOkEvt(uint64_t at, uint64_t duration)
Add expect collision function.
void NotifyAccessGranted(void)
Notify the DCF that access has been granted.
Smart pointer class similar to boost::intrusive_ptr.
ExpectedCollision structure.
ExpectedCollisions m_expectedCollision
expected collision
void NotifyCollision(void)
Notify the DCF that collision has occurred.
void NotifyChannelSwitching(uint32_t i)
Notify channel switching function.
uint32_t m_ackTimeoutValue
the ack timeout value
bool IsCfPeriod(void) const
This function indicates whether it is the CF period.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
ChannelAccessManagerTest * m_test
the test DCF manager
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
void NotifyCollision(uint32_t i)
Notify collision function.
void QueueTx(uint64_t txTime, uint64_t expectedGrantTime)
Queue transmit function.
bool IsAccessRequested(void) const
std::list< ExpectedGrant > ExpectedGrants
the collection of expected grants typedef
void NotifyChannelSwitching(void)
When a channel switching occurs, enqueued packets are removed.
void EndTest(void)
End test function.
TxopTest(ChannelAccessManagerTest *test, uint32_t i)
Constructor.
void AddDcfState(uint32_t aifsn)
Add DCF state function.
std::vector< Ptr< TxopTest > > TxopTests
the TXOP tests typedef
void SetEifsNoDifs(Time eifsNoDifs)
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
void NotifyWakeUp(void)
When wake up operation occurs, channel access will be restarted.
void AddRxInsideSifsEvt(uint64_t at, uint64_t duration)
Add receive inside SIFS event function.
void AddAccessRequest(uint64_t at, uint64_t txTime, uint64_t expectedGrantTime, uint32_t from)
Add access function.
void ExpectCollision(uint64_t time, uint32_t nSlots, uint32_t from)
Expect internal collision function.
Ptr< ChannelAccessManager > m_ChannelAccessManager
the DCF manager
void AddSwitchingEvt(uint64_t at, uint64_t duration)
Add switching event function.
void AddAccessRequestWithAckTimeout(uint64_t at, uint64_t txTime, uint64_t expectedGrantTime, uint32_t from)
Add access request with ack timeout.
void AddAccessRequestWithSuccessfullAck(uint64_t at, uint64_t txTime, uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from)
Add access request with successful ack.
void AddCcaBusyEvt(uint64_t at, uint64_t duration)
Add CCA busy event function.
void DoDispose(void)
Destructor implementation.
void NotifyInternalCollision(void)
Notify the DCF that internal collision has occurred.
void NotifyAckTimeoutStartNow(Time duration)
Notify that ACK timer has started for the given duration.
void DoAccessRequest(uint64_t txTime, uint64_t expectedGrantTime, Ptr< TxopTest > state)
Add access request with successful ack.
void NotifyInternalCollision(uint32_t i)
Notify internal collision function.
void AddNavStart(uint64_t at, uint64_t duration)
Add NAV start function.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_i
the DCF state
void AddRxErrorEvt(uint64_t at, uint64_t duration)
Add receive error event function.
void ExpectInternalCollision(uint64_t time, uint32_t nSlots, uint32_t from)
Expect internal collision function.
bool m_accessRequested
true if access requested
static DcfTestSuite g_dcfTestSuite
void StartTest(uint64_t slotTime, uint64_t sifs, uint64_t eifsNoDifsNoSifs, uint32_t ackTimeoutValue=20)
Start test function.
void AddAckTimeoutReset(uint64_t at)
Add ack timeout reset function.
std::list< struct ExpectedCollision > ExpectedCollisions
expected collisions typedef
void AddNavReset(uint64_t at, uint64_t duration)
Add NAV reset function.
handle RTS/CTS/DATA/ACK transactions.
void AddTxEvt(uint64_t at, uint64_t duration)
Add transmit event function.
ChannelAccessManagerTest()
virtual void DoRun(void)
Implementation to actually run this TestCase.
void AddRxStartEvt(uint64_t at, uint64_t duration)
Add receive start event function.
uint32_t nSlots
number of slots
void SetSlot(Time slotTime)
void Add(Ptr< Txop > dcf)
std::pair< uint64_t, uint64_t > ExpectedGrant
the expected grant typedef
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
void NotifyAccessGranted(uint32_t i)
Notify access granted function.
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
void NotifyTxStartNow(Time duration)
ExpectedGrants m_expectedGrants
expected grants
void SetupLow(Ptr< MacLow > low)
Set up listener for MacLow events.
void NotifyAccessRequested(void)
Notify that access request has been received.
void StartBackoffNow(uint32_t nSlots)
void RequestAccess(Ptr< Txop > state, bool isCfPeriod=false)
void NotifySleep(void)
When sleep operation occurs, if there is a pending packet transmission, it will be reinserted to the ...
ExpectedCollisions m_expectedInternalCollision
expected internal collisions
Handle packet fragmentation and retransmissions for data and management frames.