25 #include "ns3/nstime.h"
26 #include "ns3/object.h"
27 #include "ns3/traced-value.h"
39 class ChannelAccessManager;
44 class UniformRandomVariable;
45 class CtrlBAckResponseHeader;
154 void SetMinCws(std::vector<uint32_t> minCws);
161 void SetMinCw(uint32_t minCw, uint8_t linkId);
176 void SetMaxCws(std::vector<uint32_t> maxCws);
183 void SetMaxCw(uint32_t maxCw, uint8_t linkId);
198 void SetAifsns(std::vector<uint8_t> aifsns);
205 void SetAifsn(uint8_t aifsn, uint8_t linkId);
248 virtual uint32_t
GetMinCw(uint8_t linkId)
const;
268 virtual uint32_t
GetMaxCw(uint8_t linkId)
const;
288 virtual uint8_t
GetAifsn(uint8_t linkId)
const;
448 void SwapLinks(std::map<uint8_t, uint8_t> links);
453 friend class ::EmlsrUlTxopTest;
486 uint32_t
GetCw(uint8_t linkId)
const;
545 LinkEntity&
GetLink(uint8_t linkId)
const;
550 const std::map<uint8_t, std::unique_ptr<LinkEntity>>&
GetLinks()
const;
574 std::map<uint8_t, std::unique_ptr<LinkEntity>>
Test the transmission of UL frames from EMLSR clients.
Manage a set of ns3::Txop.
An identifier for simulation events.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
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.
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
void StartAccessAfterEvent(uint8_t linkId, bool hadFramesToTransmit, bool checkMediumBusy)
Request channel access on the given link after the occurrence of an event that possibly requires to g...
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.
static constexpr bool DIDNT_HAVE_FRAMES_TO_TRANSMIT
no packet available for transmission was in the queue
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 SwapLinks(std::map< uint8_t, uint8_t > links)
Swap the links based on the information included in the given map.
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
std::vector< Time > GetTxopLimits() const
Return the TXOP limit for each link.
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & GetLinks() const
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
static constexpr bool CHECK_MEDIUM_BUSY
generation of backoff (also) depends on the busy/idle state of the medium
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...
std::map< uint8_t, std::unique_ptr< LinkEntity > > m_links
ID-indexed map of LinkEntity objects.
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 Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
virtual void NotifySleep(uint8_t linkId)
Notify that the given link switched to sleep mode.
static constexpr bool DONT_CHECK_MEDIUM_BUSY
generation of backoff is independent of the busy/idle state of the medium
uint32_t GetMaxCw() const
Return the maximum contention window size.
static constexpr bool HAD_FRAMES_TO_TRANSMIT
packets available for transmission were in the queue
Callback< void, WifiMacDropReason, Ptr< const WifiMpdu > > DroppedMpdu
typedef for a callback to invoke when an MPDU is dropped.
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
class ns3::Txop::LinkEntity::@74 accessRequest
access request event, to be used by Txop::Queue() only
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