25#include "ns3/nstime.h"
26#include "ns3/object.h"
27#include "ns3/traced-value.h"
36class ChannelAccessManager;
41class UniformRandomVariable;
42class CtrlBAckResponseHeader;
151 void SetMinCws(std::vector<uint32_t> minCws);
173 void SetMaxCws(std::vector<uint32_t> maxCws);
195 void SetAifsns(std::vector<uint8_t> aifsns);
202 void SetAifsn(uint8_t aifsn, uint8_t linkId);
285 virtual uint8_t
GetAifsn(uint8_t linkId)
const;
506 LinkEntity&
GetLink(uint8_t linkId)
const;
536 std::vector<std::unique_ptr<LinkEntity>>
m_links;
Manage a set of ns3::Txop.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
Template class for packet Queues.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
Handle packet fragmentation and retransmissions for data and management frames.
virtual void StartAccessIfNeeded(uint8_t linkId)
Request access from Txop on the given link if needed.
Ptr< WifiMac > m_mac
the wifi MAC
Time GetTxopLimit() const
Return the TXOP limit.
virtual std::unique_ptr< LinkEntity > CreateLinkEntity() const
Create a LinkEntity object.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
virtual ChannelAccessStatus GetAccessStatus(uint8_t linkId) const
Ptr< WifiMacQueue > m_queue
the wifi MAC queue
virtual bool HasFramesToTransmit(uint8_t linkId)
Check if the Txop has frames to transmit over the given link.
virtual void NotifyOff()
When off operation occurs, the queue gets cleaned up.
Ptr< UniformRandomVariable > m_rng
the random stream
CwValueTracedCallback m_cwTrace
CW trace value.
void DoDispose() override
Destructor implementation.
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
uint32_t GetMinCw() const
Return the minimum contention window size.
ChannelAccessStatus
Enumeration for channel access status.
virtual void NotifyOn()
When on operation occurs, channel access will be started.
void UpdateFailedCw(uint8_t linkId)
Update the value of the CW variable for the given link to take into account a transmission failure.
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
virtual void NotifyWakeUp(uint8_t linkId)
When wake up operation occurs on a link, channel access on that link will be restarted.
virtual void NotifyChannelReleased(uint8_t linkId)
Called by the FrameExchangeManager to notify the completion of the transmissions.
std::vector< uint32_t > GetMaxCws() const
Return the maximum contention window size for each link.
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
TracedCallback< uint32_t, uint8_t > BackoffValueTracedCallback
TracedCallback for backoff trace value typedef.
void ResetCw(uint8_t linkId)
Update the value of the CW variable for the given link to take into account a transmission success or...
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
virtual bool IsQosTxop() const
Check for QoS TXOP.
std::vector< uint32_t > GetMinCws() const
Return the minimum contention window size for each link.
std::vector< uint8_t > GetAifsns() const
Return the number of slots that make up an AIFS for each link.
void UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound, uint8_t linkId)
Update backoff slots for the given link that nSlots has passed.
TracedCallback< uint32_t, uint8_t > CwValueTracedCallback
TracedCallback for CW trace value typedef.
Time GetBackoffStart(uint8_t linkId) const
Return the time when the backoff procedure started on the given link.
void SetMaxCws(std::vector< uint32_t > maxCws)
Set the maximum contention window size for each link.
void SetTxopLimits(const std::vector< Time > &txopLimits)
Set the TXOP limit for each link.
DroppedMpdu m_droppedMpduCallback
the dropped MPDU callback
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
std::vector< std::unique_ptr< LinkEntity > > m_links
vector of LinkEntity objects
std::vector< Time > GetTxopLimits() const
Return the TXOP limit for each link.
static TypeId GetTypeId()
Get the type ID.
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
uint32_t GetCw(uint8_t linkId) const
Get the current value of the CW variable for the given link.
void SetMinCws(std::vector< uint32_t > minCws)
Set the minimum contention window size for each link.
virtual void SetDroppedMpduCallback(DroppedMpdu callback)
virtual void GenerateBackoff(uint8_t linkId)
Generate a new backoff for the given link now.
BackoffValueTracedCallback m_backoffTrace
backoff trace value
virtual void NotifyAccessRequested(uint8_t linkId)
Notify that access request has been received for the given link.
void SetAifsns(std::vector< uint8_t > aifsns)
Set the number of slots that make up an AIFS for each link.
Ptr< MacTxMiddle > m_txMiddle
the MacTxMiddle
void StartBackoffNow(uint32_t nSlots, uint8_t linkId)
virtual void NotifyChannelAccessed(uint8_t linkId, Time txopDuration=Seconds(0))
Called by the FrameExchangeManager to notify that channel access has been granted on the given link f...
void RequestAccess(uint8_t linkId)
Request access to the ChannelAccessManager associated with the given link.
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
uint8_t GetAifsn() const
Return the number of slots that make up an AIFS.
uint32_t GetBackoffSlots(uint8_t linkId) const
Return the current number of backoff slots on the given link.
virtual void NotifySleep(uint8_t linkId)
Notify that the given link switched to sleep mode.
uint32_t GetMaxCw() const
Return the maximum contention window size.
Callback< void, WifiMacDropReason, Ptr< const WifiMpdu > > DroppedMpdu
typedef for a callback to invoke when an MPDU is dropped.
uint8_t GetNLinks() const
Get the number of links.
void DoInitialize() override
Initialize() implementation.
a unique identifier for an interface.
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiMacDropReason
The reason why an MPDU was dropped.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Structure holding information specific to a single link.
ChannelAccessStatus access
channel access status
uint32_t cw
the current contention window
virtual ~LinkEntity()=default
Destructor (a virtual method is needed to make this struct polymorphic)
uint32_t cwMax
the maximum contention window
Time txopLimit
the TXOP limit time
Time backoffStart
the backoffStart variable is used to keep track of the time at which a backoff was started or the tim...
uint32_t cwMin
the minimum contention window
uint32_t backoffSlots
the number of backoff slots