23#include "ns3/ctrl-headers.h"
25#include "ns3/mgt-headers.h"
26#include "ns3/recipient-block-ack-agreement.h"
27#include "ns3/snr-tag.h"
28#include "ns3/wifi-mac-queue.h"
29#include "ns3/wifi-utils.h"
34#undef NS_LOG_APPEND_CONTEXT
35#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] "
47 static TypeId tid =
TypeId(
"ns3::HtFrameExchangeManager")
49 .AddConstructor<HtFrameExchangeManager>()
50 .SetGroupName(
"Wifi");
103 return m_mac->GetQosTxop(tid)->GetBaManager();
116 else if (qosTxop->
GetBaManager()->ExistsAgreement(recipient, tid) &&
117 !qosTxop->
GetBaManager()->ExistsAgreementInState(recipient,
141 uint16_t startingSeq,
190 uint16_t sequence =
m_txMiddle->GetNextSequenceNumberFor(&mpdu->GetHeader());
191 mpdu->GetHeader().SetSequenceNumber(sequence);
200 m_mac->GetQosTxop(tid)->GetWifiMacQueue()->Enqueue(mpdu);
248 auto mpdu = Create<WifiMpdu>(packet, hdr);
267 NS_ASSERT_MSG(it->second,
"The pointer to the pending ADDBA_RESPONSE cannot be null");
321 m_mac->GetQosTxop(tid)->GetWifiMacQueue()->Enqueue(Create<WifiMpdu>(packet, hdr));
327 uint16_t startingSeq)
330 uint8_t tid = respHdr->
GetTid();
371 auto agreementIt =
m_agreements.find({originator, tid});
375 agreementIt->second.Flush();
410 uint16_t startingSeq =
426 return SendDataFrame(peekedItem, availableTime, initialFrame);
449 NS_LOG_DEBUG(
"Block Ack Manager returned no frame to send");
453 NS_ASSERT(peekedItem->GetHeader().IsBlockAckReq());
479 if (availableTime !=
Time::Min() && !initialFrame &&
482 NS_LOG_DEBUG(
"Not enough time to send the BAR frame returned by the Block Ack Manager");
497 NS_ASSERT(peekedItem && peekedItem->GetHeader().IsQosData() &&
498 !peekedItem->GetHeader().GetAddr1().IsBroadcast() && !peekedItem->IsFragment());
515 std::vector<Ptr<WifiMpdu>> mpduList =
519 if (mpduList.size() > 1)
582 return Create<WifiPsdu>(mpdu,
false);
590 if (mpdu->GetHeader().IsQosData())
592 uint8_t tid = mpdu->GetHeader().GetQosTid();
601 else if (mpdu->GetHeader().IsAction())
615 ->DestroyAgreement(mpdu->GetHeader().GetAddr1(), delBa.
GetTid());
631 mpdu->GetHeader().GetAddr1(),
643 "Pending agreement {" << key.first <<
", " << +key.second
665 NS_LOG_DEBUG(
"Schedule a transmission from Block Ack Manager in a SIFS");
683 if (mpdu->GetHeader().IsQosData())
685 GetBaManager(mpdu->GetHeader().GetQosTid())->NotifyDiscardedMpdu(mpdu);
687 else if (mpdu->GetHeader().IsAction())
690 mpdu->GetPacket()->PeekHeader(actionHdr);
693 uint8_t tid =
GetTid(mpdu->GetPacket(), mpdu->GetHeader());
694 if (
GetBaManager(tid)->ExistsAgreementInState(mpdu->GetHeader().GetAddr1(),
699 GetBaManager(tid)->NotifyAgreementNoReply(mpdu->GetHeader().GetAddr1(), tid);
704 mpdu->GetHeader().GetAddr1(),
717 if (mpdu->GetHeader().IsQosData())
719 uint8_t tid = mpdu->GetHeader().GetQosTid();
749 uint16_t currentNextSeq =
m_txMiddle->PeekNextSequenceNumberFor(&hdr);
793#ifdef NS3_BUILD_PROFILE_DEBUG
800 NS_ASSERT(mpdu->GetHeader().IsCtl() || mpdu->IsQueued());
867 NS_ASSERT_MSG(tids.size() <= 1,
"Multi-TID A-MPDUs are not supported");
904 "Acknowledgment method incompatible with a Multi-TID A-MPDU");
905 uint8_t tid = *tids.begin();
914 NS_ABORT_MSG(
"Unable to handle the selected acknowledgment method ("
941 std::array<std::optional<uint8_t>, 8> queueSizeForTid;
955 if (!queueSizeForTid[tid].has_value())
988 NS_LOG_DEBUG(
"Transmitting a PSDU: " << *psdu <<
" TXVECTOR: " << txVector);
1002 Time ppduDurationLimit)
const
1010 if (txParams.
GetSize(receiver) > 0)
1017 if (mpdu->GetHeader().IsQosData())
1019 tid = mpdu->GetHeader().GetQosTid();
1027 NS_ABORT_MSG(
"Cannot aggregate a non-QoS data frame to an A-MPDU that does"
1028 " not contain any QoS data frame");
1052 if (maxAmpduSize == 0)
1058 if (ampduSize > maxAmpduSize)
1060 NS_LOG_DEBUG(
"the frame does not meet the constraint on max A-MPDU size (" << maxAmpduSize
1070 Time availableTime)
const
1072 NS_ASSERT(msdu && msdu->GetHeader().IsQosData());
1079 std::unique_ptr<WifiProtection> protection;
1081 bool protectionSwapped =
false;
1087 protectionTime = protection->protectionTime;
1091 protectionSwapped =
true;
1099 std::unique_ptr<WifiAcknowledgment> acknowledgment;
1100 acknowledgment =
GetAckManager()->TryAggregateMsdu(msdu, txParams);
1101 bool acknowledgmentSwapped =
false;
1107 acknowledgmentTime = acknowledgment->acknowledgmentTime;
1111 acknowledgmentSwapped =
true;
1118 ppduDurationLimit = availableTime - protectionTime - acknowledgmentTime;
1125 if (protectionSwapped)
1129 if (acknowledgmentSwapped)
1146 Time ppduDurationLimit)
const
1148 NS_ASSERT(msdu && msdu->GetHeader().IsQosData());
1153 uint8_t tid = msdu->GetHeader().GetQosTid();
1157 uint16_t maxAmsduSize =
m_msduAggregator->GetMaxAmsduSize(receiver, tid, modulation);
1159 if (maxAmsduSize == 0)
1165 if (ret.first > maxAmsduSize)
1167 NS_LOG_DEBUG(
"No other MSDU can be aggregated: maximum A-MSDU size (" << maxAmsduSize
1236 std::set<uint8_t> tids = psdu->
GetTids();
1237 NS_ABORT_MSG_IF(tids.size() > 1,
"Multi-TID A-MPDUs not handled here");
1239 tid = *tids.begin();
1247 if (
GetBaManager(tid)->NeedBarRetransmission(tid, recipient))
1249 NS_LOG_DEBUG(
"Missed Block Ack, transmit a BlockAckReq");
1264 NS_LOG_DEBUG(
"Missed Block Ack, do not transmit a BlockAckReq");
1268 if (
GetBaManager(tid)->ExistsAgreementInState(recipient,
1284 NS_LOG_DEBUG(
"Missed Block Ack, do not retransmit the data frames");
1295 NS_LOG_DEBUG(
"Missed Block Ack, retransmit data frames");
1296 GetBaManager(tid)->NotifyMissedBlockAck(recipient, tid);
1359 return it->second.GetBlockAckType();
1369 NS_ASSERT(mpdu->GetHeader().GetAddr1().IsGroup() || mpdu->GetHeader().GetAddr1() ==
m_self);
1371 double rxSnr = rxSignalInfo.
snr;
1386 mpdu->GetPacket()->PeekPacketTag(tag);
1404 mpdu->GetPacket()->PeekPacketTag(tag);
1408 mpdu->GetPacket()->PeekHeader(blockAck);
1410 std::pair<uint16_t, uint16_t> ret =
1438 mpdu->GetPacket()->PeekHeader(blockAckReq);
1446 NS_LOG_DEBUG(
"There's not a valid agreement for this BlockAckReq");
1457 agreementIt->second,
1480 agreementIt->second.NotifyReceivedMpdu(mpdu);
1505 const std::vector<bool>& perMpduStatus)
1507 std::set<uint8_t> tids = psdu->
GetTids();
1510 if (tids.size() == 1)
1512 uint8_t tid = *tids.begin();
1527 agreementIt->second,
uint16_t GetTimeout() const
Return the timeout.
void SetImmediateBlockAck()
Set block ack policy to immediate Ack.
BlockAckType GetBlockAckType() const
Get the type of the Block Acks sent by the recipient of this agreement.
EventId m_inactivityEvent
inactivity event
void SetDelayedBlockAck()
Set block ack policy to delayed Ack.
uint8_t GetTid() const
Return the Traffic ID (TID).
static std::size_t GetDistance(uint16_t seqNumber, uint16_t startingSeqNumber)
Get the distance between the given starting sequence number and the given sequence number.
Mac48Address GetPeer() const
Return the peer address.
void NotifyAckTimeoutResetNow()
Notify that ack timer has reset.
void NotifyAckTimeoutStartNow(Time duration)
Notify that ack timer has started for the given duration.
void NotifyCtsTimeoutResetNow()
Notify that CTS timer has reset.
void DoCtsTimeout(Ptr< WifiPsdu > psdu)
Take required actions when the CTS timer fired after sending an RTS to protect the given PSDU expires...
uint8_t m_linkId
the ID of the link this object is associated with
Ptr< WifiMac > m_mac
the MAC layer on this station
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the MAC layer to use.
void SendMpduWithProtection(Ptr< WifiMpdu > mpdu, WifiTxParameters &txParams)
Send an MPDU with the given TX parameters (with the specified protection).
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager() const
void UpdateTxDuration(Mac48Address receiver, WifiTxParameters &txParams) const
Update the TX duration field of the given TX parameters after that the PSDU addressed to the given re...
virtual void CalculateAcknowledgmentTime(WifiAcknowledgment *acknowledgment) const
Calculate the time required to acknowledge a frame according to the given acknowledgment method.
Ptr< MacTxMiddle > m_txMiddle
the MAC TX Middle on this station
void SendNormalAck(const WifiMacHeader &hdr, const WifiTxVector &dataTxVector, double dataSnr)
Send Normal Ack.
Mac48Address m_self
the MAC address of this device
uint16_t m_allowedWidth
the allowed width in MHz for the current transmission
virtual void NotifyPacketDiscarded(Ptr< const WifiMpdu > mpdu)
Pass the given MPDU, discarded because of the max retry limit was reached, to the MPDU dropped callba...
WifiTxTimer m_txTimer
the timer set upon frame transmission
virtual void RetransmitMpduAfterMissedAck(Ptr< WifiMpdu > mpdu) const
Retransmit an MPDU that was not acknowledged.
void SendRts(const WifiTxParameters &txParams)
Send RTS to begin RTS-CTS-Data-Ack transaction.
virtual void NotifyReceivedNormalAck(Ptr< WifiMpdu > mpdu)
Notify other components that an MPDU was acknowledged.
void SendCtsToSelf(const WifiTxParameters &txParams)
Send CTS for a CTS-to-self mechanism.
virtual void CtsTimeout(Ptr< WifiMpdu > rts, const WifiTxVector &txVector)
Called when the CTS timeout expires.
virtual void CalculateProtectionTime(WifiProtection *protection) const
Calculate the time required to protect a frame according to the given protection method.
Ptr< WifiAckManager > GetAckManager() const
Get the Acknowledgment Manager used by this node.
virtual void DequeueMpdu(Ptr< const WifiMpdu > mpdu)
Dequeue the given MPDU from the queue in which it is stored.
Ptr< WifiProtectionManager > GetProtectionManager() const
Get the Protection Manager used by this node.
Ptr< MacRxMiddle > m_rxMiddle
the MAC RX Middle on this station
Ptr< WifiPhy > m_phy
the PHY layer on this station
Mac48Address m_bssid
BSSID address (Mac48Address)
virtual void ReleaseSequenceNumber(Ptr< WifiMpdu > mpdu) const
Make the sequence number of the given MPDU available again if the MPDU has never been transmitted.
Ptr< ChannelAccessManager > m_channelAccessManager
the channel access manager
HtFrameExchangeManager handles the frame exchange sequences for HT stations.
Ptr< MpduAggregator > m_mpduAggregator
A-MPDU aggregator.
void ReceiveMpdu(Ptr< const WifiMpdu > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu) override
This method handles the reception of an MPDU (possibly included in an A-MPDU)
void SendAddBaRequest(Mac48Address recipient, uint8_t tid, uint16_t startingSeq, uint16_t timeout, bool immediateBAck)
Sends an ADDBA Request to establish a block ack agreement with STA addressed by recipient for TID tid...
void SendDelbaFrame(Mac48Address addr, uint8_t tid, bool byOriginator)
Sends DELBA frame to cancel a block ack agreement with STA addressed by addr for TID tid.
std::map< AgreementKey, Ptr< WifiMpdu > > m_pendingAddBaResp
pending ADDBA_RESPONSE frames indexed by agreement key
void SendAddBaResponse(const MgtAddBaRequestHeader *reqHdr, Mac48Address originator)
This method can be called to accept a received ADDBA Request.
virtual bool SendMpduFromBaManager(Ptr< QosTxop > edca, Time availableTime, bool initialFrame)
If the Block Ack Manager associated with the given EDCA has a BlockAckReq frame to transmit (the dura...
void CtsTimeout(Ptr< WifiMpdu > rts, const WifiTxVector &txVector) override
Called when the CTS timeout expires.
void DestroyBlockAckAgreement(Mac48Address originator, uint8_t tid)
Destroy a Block Ack agreement.
Ptr< WifiPsdu > m_psdu
the A-MPDU being transmitted
Ptr< BlockAckManager > GetBaManager(uint8_t tid) const
Get the Block Ack Manager handling the given TID.
virtual Ptr< WifiPsdu > GetWifiPsdu(Ptr< WifiMpdu > mpdu, const WifiTxVector &txVector) const
Get a PSDU containing the given MPDU.
virtual void BlockAckTimeout(Ptr< WifiPsdu > psdu, const WifiTxVector &txVector)
Called when the BlockAck timeout expires.
virtual Time GetPsduDurationId(Time txDuration, const WifiTxParameters &txParams) const
Compute how to set the Duration/ID field of PSDUs that do not include fragments.
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
virtual bool NeedSetupBlockAck(Mac48Address recipient, uint8_t tid)
A Block Ack agreement needs to be established with the given recipient for the given TID if it does n...
void TransmissionSucceeded() override
Take necessary actions upon a transmission success.
void ReleaseSequenceNumber(Ptr< WifiMpdu > mpdu) const override
Make the sequence number of the given MPDU available again if the MPDU has never been transmitted.
Ptr< MpduAggregator > GetMpduAggregator() const
Returns the aggregator used to construct A-MPDU subframes.
virtual bool IsWithinLimitsIfAggregateMsdu(Ptr< const WifiMpdu > msdu, const WifiTxParameters &txParams, Time ppduDurationLimit) const
Check if the PSDU obtained by aggregating the given MSDU to the PSDU specified by the given TX parame...
virtual bool IsWithinAmpduSizeLimit(uint32_t ampduSize, Mac48Address receiver, uint8_t tid, WifiModulationClass modulation) const
Check whether an A-MPDU of the given size meets the constraint on the maximum size for A-MPDUs sent t...
void SetWifiMac(const Ptr< WifiMac > mac) override
Set the MAC layer to use.
RecipientBlockAckAgreementMap m_pendingAgreements
pending Block Ack agreements (waiting for Ack in response to ADDBA_RESPONSE)
void ForwardMpduDown(Ptr< WifiMpdu > mpdu, WifiTxVector &txVector) override
Forward an MPDU down to the PHY layer.
Ptr< MsduAggregator > GetMsduAggregator() const
Returns the aggregator used to construct A-MSDU subframes.
void SendPsduWithProtection(Ptr< WifiPsdu > psdu, WifiTxParameters &txParams)
Send a PSDU (A-MPDU or BlockAckReq frame) requesting a BlockAck frame or a BlockAckReq frame followed...
bool GetBaAgreementEstablished(Mac48Address originator, uint8_t tid) const
Return true if a Block Ack agreement has been established with the given originator for the given TID...
void NotifyReceivedNormalAck(Ptr< WifiMpdu > mpdu) override
Notify other components that an MPDU was acknowledged.
void EndReceiveAmpdu(Ptr< const WifiPsdu > psdu, const RxSignalInfo &rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &perMpduStatus) override
This method is called when the reception of an A-MPDU including multiple MPDUs is completed.
void RetransmitMpduAfterMissedAck(Ptr< WifiMpdu > mpdu) const override
Retransmit an MPDU that was not acknowledged.
void DoDispose() override
Destructor implementation.
static TypeId GetTypeId()
Get the type ID.
bool StartFrameExchange(Ptr< QosTxop > edca, Time availableTime, bool initialFrame) override
Start a frame exchange (including protection frames and acknowledgment frames as needed) that fits wi...
WifiTxParameters m_txParams
the TX parameters for the current frame
bool IsWithinLimitsIfAddMpdu(Ptr< const WifiMpdu > mpdu, const WifiTxParameters &txParams, Time ppduDurationLimit) const override
Check if the PSDU obtained by aggregating the given MPDU to the PSDU specified by the given TX parame...
void SendPsdu()
Send the current PSDU, which can be acknowledged by a BlockAck frame or followed by a BlockAckReq fra...
virtual uint16_t GetSupportedBaBufferSize() const
Get the maximum supported buffer size for a Block Ack agreement.
virtual bool TryAggregateMsdu(Ptr< const WifiMpdu > msdu, WifiTxParameters &txParams, Time availableTime) const
Check if aggregating an MSDU to the current MPDU (as specified by the given TX parameters) does not v...
virtual void NotifyTxToEdca(Ptr< const WifiPsdu > psdu) const
Notify the transmission of the given PSDU to the EDCAF associated with the AC the PSDU belongs to.
virtual bool SendDataFrame(Ptr< WifiMpdu > peekedItem, Time availableTime, bool initialFrame)
Given a non-broadcast QoS data frame, prepare the PSDU to transmit by attempting A-MSDU and A-MPDU ag...
void NotifyPacketDiscarded(Ptr< const WifiMpdu > mpdu) override
Pass the given MPDU, discarded because of the max retry limit was reached, to the MPDU dropped callba...
RecipientBlockAckAgreementMap m_agreements
Block Ack agreements.
virtual void ForwardPsduDown(Ptr< const WifiPsdu > psdu, WifiTxVector &txVector)
Forward a PSDU down to the PHY layer.
void CalculateAcknowledgmentTime(WifiAcknowledgment *acknowledgment) const override
Calculate the time required to acknowledge a frame according to the given acknowledgment method.
BlockAckType GetBlockAckType(Mac48Address originator, uint8_t tid) const
Get the type of BlockAck frames sent to the given originator.
~HtFrameExchangeManager() override
void DequeuePsdu(Ptr< const WifiPsdu > psdu)
Dequeue the MPDUs of the given PSDU from the queue in which they are stored.
virtual void MissedBlockAck(Ptr< WifiPsdu > psdu, const WifiTxVector &txVector, bool &resetCw)
Take necessary actions when a BlockAck is missed, such as scheduling a BlockAckReq frame or the retra...
Ptr< MsduAggregator > m_msduAggregator
A-MSDU aggregator.
std::pair< Mac48Address, uint8_t > AgreementKey
agreement key typedef (MAC address and TID)
void SendBlockAck(const RecipientBlockAckAgreement &agreement, Time durationId, WifiTxVector &blockAckTxVector, double rxSnr)
Create a BlockAck frame with header equal to blockAck and start its transmission.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddHeader(const Header &header)
Add header to this packet.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Smart pointer class similar to boost::intrusive_ptr.
QosFrameExchangeManager handles the frame exchange sequences for QoS stations.
void ReceiveMpdu(Ptr< const WifiMpdu > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu) override
This method handles the reception of an MPDU (possibly included in an A-MPDU)
void TransmissionFailed() override
Take necessary actions upon a transmission failure.
virtual bool StartFrameExchange(Ptr< QosTxop > edca, Time availableTime, bool initialFrame)
Start a frame exchange (including protection frames and acknowledgment frames as needed) that fits wi...
Ptr< QosTxop > m_edca
the EDCAF that gained channel access
bool StartTransmission(Ptr< Txop > edca, uint16_t allowedWidth) override
Request the FrameExchangeManager to start a frame exchange sequence.
void TransmissionSucceeded() override
Take necessary actions upon a transmission success.
bool m_setQosQueueSize
whether to set the Queue Size subfield of the QoS Control field of QoS data frames
virtual bool IsWithinSizeAndTimeLimits(uint32_t ppduPayloadSize, Mac48Address receiver, const WifiTxParameters &txParams, Time ppduDurationLimit) const
Check whether the transmission time of the frame being built (as described by the given TX parameters...
void DoDispose() override
Destructor implementation.
Ptr< BlockAckManager > GetBaManager()
Get the Block Ack Manager associated with this QosTxop.
bool UseExplicitBarAfterMissedBlockAck() const
Return true if an explicit BlockAckRequest is sent after a missed BlockAck.
Time GetAddBaResponseTimeout() const
Get the timeout for ADDBA response.
void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid)
Callback when ADDBA response is not received after timeout.
Ptr< const WifiMpdu > PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const
void ScheduleBar(Ptr< const WifiMpdu > bar, bool skipIfNoDataQueued=false)
uint8_t GetBlockAckThreshold() const
Return the current threshold for block ack mechanism.
uint16_t GetBlockAckInactivityTimeout() const
Get the BlockAck inactivity timeout.
virtual Time GetRemainingTxop(uint8_t linkId) const
Return the remaining duration in the current TXOP on the given link.
uint8_t GetQosQueueSize(uint8_t tid, Mac48Address receiver) const
Get the value for the Queue Size subfield of the QoS Control field of a QoS data frame of the given T...
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
void ResetBa(Mac48Address recipient, uint8_t tid)
Reset BA agreement after BA negotiation failed.
Time GetFailedAddBaTimeout() const
Get the timeout for failed BA agreement.
Ptr< WifiMpdu > PeekNextMpdu(uint8_t linkId, uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast(), Ptr< WifiMpdu > item=nullptr)
Peek the next frame to transmit on the given link to the given receiver and of the given TID from the...
Ptr< WifiMpdu > GetNextMpdu(uint8_t linkId, Ptr< WifiMpdu > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame)
Prepare the frame to transmit on the given link starting from the MPDU that has been previously peeke...
void CompleteMpduTx(Ptr< WifiMpdu > mpdu)
Stores an MPDU (part of an A-MPDU) in block ack agreement (i.e.
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
Maintains the scoreboard and the receive reordering buffer used by a recipient of a Block Ack agreeme...
void FillBlockAckBitmap(CtrlBAckResponseHeader *blockAckHeader, std::size_t index=0) const
Set the Starting Sequence Number subfield of the Block Ack Starting Sequence Control subfield of the ...
void SetMacRxMiddle(const Ptr< MacRxMiddle > rxMiddle)
Set the MAC RX Middle to use.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Introspection did not find any typical Config paths.
void Set(double snr)
Set the SNR to the given value.
double Get() const
Return the SNR value.
Status code for association response.
void SetSuccess()
Set success bit to 0 (success).
Simulation virtual time values and global simulation resolution.
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
bool IsStrictlyNegative() const
Exactly equivalent to t < 0.
bool IsZero() const
Exactly equivalent to t == 0.
Time GetTxopLimit() const
Return the TXOP limit.
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.
void ResetCw(uint8_t linkId)
Update the value of the CW variable for the given link to take into account a transmission success or...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
static void SetQosAckPolicy(Ptr< WifiMpdu > item, const WifiAcknowledgment *acknowledgment)
Set the QoS Ack policy for the given MPDU, which must be a QoS data frame.
void Send(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
This function is a wrapper for the Send variant that accepts a WifiConstPsduMap as first argument.
Time GetSlot() const
Return the slot duration for this PHY.
Time GetSifs() const
Return the Short Interframe Space (SIFS) for this PHY.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
std::set< uint8_t > GetTids() const
Get the set of TIDs of the QoS Data frames included in the PSDU.
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
Time GetDuration() const
Get the duration from the Duration/ID field, which is common to all the MPDUs.
std::vector< Ptr< WifiMpdu > >::const_iterator begin() const
Return a const iterator to the first MPDU.
Mac48Address GetAddr2() const
Get the Transmitter Address (TA), which is common to all the MPDUs.
uint32_t GetSize() const
Return the size of the PSDU in bytes.
Ptr< const Packet > GetPayload(std::size_t i) const
Get the payload of the i-th MPDU.
Mac48Address GetAddr1() const
Get the Receiver Address (RA), which is common to all the MPDUs.
bool IsAggregate() const
Return true if the PSDU is an S-MPDU or A-MPDU.
void SetDuration(Time duration)
Set the Duration/ID field on all the MPDUs.
std::size_t GetNMpdus() const
Return the number of MPDUs constituting the PSDU.
WifiMacHeader::QosAckPolicy GetAckPolicyForTid(uint8_t tid) const
Get the QoS Ack Policy of the QoS Data frames included in the PSDU that have the given TID.
void ReportDataFailed(Ptr< const WifiMpdu > mpdu)
Should be invoked whenever the AckTimeout associated to a transmission attempt expires.
void ReportFinalDataFailed(Ptr< const WifiMpdu > mpdu)
Should be invoked after calling ReportDataFailed if NeedRetransmission returns false.
void ReportRtsOk(const WifiMacHeader &header, double ctsSnr, WifiMode ctsMode, double rtsSnr)
Should be invoked whenever we receive the CTS associated to an RTS we just sent.
void ReportRxOk(Mac48Address address, RxSignalInfo rxSignalInfo, WifiTxVector txVector)
void ReportAmpduTxStatus(Mac48Address address, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, WifiTxVector dataTxVector)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
bool GetVhtSupported() const
Return whether the device has VHT capability support enabled.
WifiTxVector GetDataTxVector(const WifiMacHeader &header, uint16_t allowedWidth)
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
uint32_t GetSizeIfAddMpdu(Ptr< const WifiMpdu > mpdu) const
Get the size in bytes of the frame in case the given MPDU is added.
std::pair< uint32_t, uint32_t > GetSizeIfAggregateMsdu(Ptr< const WifiMpdu > msdu) const
Get the size in bytes of the frame in case the given MSDU is aggregated.
std::unique_ptr< WifiProtection > m_protection
protection method
uint32_t GetSize(Mac48Address receiver) const
Get the size in bytes of the (A-)MPDU addressed to the given receiver.
std::unique_ptr< WifiAcknowledgment > m_acknowledgment
acknowledgment method
const PsduInfo * GetPsduInfo(Mac48Address receiver) const
Get a pointer to the information about the PSDU addressed to the given receiver, if present,...
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
void AggregateMsdu(Ptr< const WifiMpdu > msdu)
Record that an MSDU is being aggregated to the last MPDU added to the frame that hase the same receiv...
void Clear()
Reset the TX parameters.
bool IsRunning() const
Return true if the timer is running.
void Cancel()
Cancel the timer.
void Set(Reason reason, const Time &delay, MEM mem_ptr, OBJ obj, Args... args)
This method is called when a frame soliciting a response is transmitted.
Reason GetReason() const
Get the reason why the timer was started.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
WifiModulationClass GetModulationClass() const
Get the modulation class specified by this TXVECTOR.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
uint8_t GetTid(Ptr< const Packet > packet, const WifiMacHeader hdr)
This function is useful to get traffic id of different packet types.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
std::tuple< WifiContainerQueueType, Mac48Address, uint8_t > WifiContainerQueueId
Tuple (queue type, Address, TID) identifying a container queue.
uint32_t GetBlockAckRequestSize(BlockAckReqType type)
Return the total BlockAckRequest size (including FCS trailer).
@ WIFI_QOSDATA_UNICAST_QUEUE
Ptr< T > Copy(Ptr< T > object)
Return a deep copy of a Ptr.
uint32_t GetBlockAckSize(BlockAckType type)
Return the total BlockAck size (including FCS trailer).
The different BlockAck variants.
RxSignalInfo structure containing info on the received signal.
double snr
SNR in linear scale.
WifiAcknowledgment is an abstract base struct.
Time acknowledgmentTime
time required by the acknowledgment method
const Method method
acknowledgment method
WifiBarBlockAck specifies that a BlockAckReq is sent to solicit a Block Ack response.
BlockAckType baType
BlockAck type.
WifiTxVector blockAckTxVector
BlockAck TXVECTOR.
WifiTxVector blockAckReqTxVector
BlockAckReq TXVECTOR.
BlockAckReqType barType
BlockAckReq type.
WifiBlockAck specifies that acknowledgment via Block Ack is required.
WifiTxVector blockAckTxVector
BlockAck TXVECTOR.
BlockAckType baType
BlockAck type.
WifiNoProtection specifies that no protection method is used.
information about the frame being prepared for a specific receiver
std::map< uint8_t, std::set< uint16_t > > seqNumbers
set of the sequence numbers of the MPDUs added for each TID
uint32_t ampduSize
the size in bytes of the A-MPDU if multiple MPDUs have been added, and zero otherwise