|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #include "ns3/abort.h"
24 #include "ns3/wifi-mac-queue.h"
25 #include "ns3/mgt-headers.h"
26 #include "ns3/recipient-block-ack-agreement.h"
27 #include "ns3/wifi-utils.h"
28 #include "ns3/snr-tag.h"
29 #include "ns3/ctrl-headers.h"
33 #undef NS_LOG_APPEND_CONTEXT
34 #define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
45 static TypeId tid =
TypeId (
"ns3::HtFrameExchangeManager")
47 .AddConstructor<HtFrameExchangeManager> ()
48 .SetGroupName (
"Wifi")
100 return m_mac->GetQosTxop (tid)->GetBaManager ();
109 if (!
m_mac->GetWifiRemoteStationManager ()->GetHtSupported (recipient))
113 else if (qosTxop->
GetBaManager ()->ExistsAgreement (recipient, tid)
120 uint32_t packets = qosTxop->
GetWifiMacQueue ()->GetNPacketsByTidAndAddress (tid, recipient);
123 ||
m_mac->GetWifiRemoteStationManager ()->GetVhtSupported ());
132 uint16_t
timeout,
bool immediateBAck)
188 m_mac->GetQosTxop (tid)->GetWifiMacQueue ()->PushFront (mpdu);
239 m_mac->GetQosTxop (reqHdr->
GetTid ())->PushFront (packet, hdr);
282 m_mac->GetQosTxop (tid)->GetWifiMacQueue ()->PushFront (Create<WifiMacQueueItem> (packet, hdr));
287 uint16_t startingSeq)
290 uint8_t tid = respHdr->
GetTid ();
295 m_mac->GetWifiRemoteStationManager ()->GetHtSupported ()
296 &&
m_mac->GetWifiRemoteStationManager ()->GetHtSupported (originator));
312 this, originator, tid,
false);
324 auto agreementIt =
m_agreements.find ({originator, tid});
328 agreementIt->second.Flush ();
373 && !
m_mac->GetWifiRemoteStationManager ()->NeedFragmentation (peekedItem))
375 return SendDataFrame (peekedItem, availableTime, initialFrame);
396 NS_LOG_DEBUG (
"Block Ack Manager returned no frame to send");
400 NS_ASSERT (peekedItem->GetHeader ().IsBlockAckReq ());
407 txParams.
m_txVector =
m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peekedItem->GetHeader ());
425 if (availableTime !=
Time::Min () && !initialFrame
428 NS_LOG_DEBUG (
"Not enough time to send the BAR frame returned by the Block Ack Manager");
440 Time availableTime,
bool initialFrame)
442 NS_ASSERT (peekedItem != 0 && peekedItem->GetHeader ().IsQosData ()
443 && !peekedItem->GetHeader ().GetAddr1 ().IsBroadcast ()
444 && !peekedItem->IsFragment ());
445 NS_LOG_FUNCTION (
this << *peekedItem << availableTime << initialFrame);
449 txParams.
m_txVector =
m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peekedItem->GetHeader ());
460 std::vector<Ptr<WifiMacQueueItem>> mpduList =
m_mpduAggregator->GetNextAmpdu (mpdu, txParams,
461 availableTime, queueIt);
464 if (mpduList.size () > 1)
524 return Create<WifiPsdu> (mpdu,
false);
590 NS_LOG_DEBUG (
"Schedule a transmission from Block Ack Manager in a SIFS");
607 if (mpdu->GetHeader ().IsQosData ())
609 GetBaManager (mpdu->GetHeader ().GetQosTid ())->NotifyDiscardedMpdu (mpdu);
611 else if (mpdu->GetHeader ().IsAction ())
614 mpdu->GetPacket ()->PeekHeader (actionHdr);
617 uint8_t tid =
GetTid (mpdu->GetPacket (), mpdu->GetHeader ());
618 if (
GetBaManager (tid)->ExistsAgreementInState (mpdu->GetHeader ().GetAddr1 (), tid,
622 GetBaManager (tid)->NotifyAgreementNoReply (mpdu->GetHeader ().GetAddr1 (), tid);
625 mpdu->GetHeader ().GetAddr1 (), tid);
670 uint16_t currentNextSeq =
m_txMiddle->PeekNextSequenceNumberFor (&hdr);
713 #ifdef NS3_BUILD_PROFILE_DEBUG
720 NS_ASSERT (mpdu->GetHeader ().IsCtl () || mpdu->IsQueued ());
771 if (!
m_mac->GetWifiRemoteStationManager ()->NeedRetransmission (*
m_psdu->
begin ()))
810 NS_ASSERT_MSG (tids.size () <= 1,
"Multi-TID A-MPDUs are not supported");
842 NS_ABORT_MSG_IF (tids.size () > 1,
"Acknowledgment method incompatible with a Multi-TID A-MPDU");
843 uint8_t tid = *tids.begin ();
852 NS_ABORT_MSG (
"Unable to handle the selected acknowledgment method ("
879 std::array<std::optional<uint8_t>, 8> queueSizeForTid;
890 if (
m_mac->GetTypeOfStation () ==
STA
894 if (!queueSizeForTid[tid].has_value ())
927 NS_LOG_DEBUG (
"Transmitting a PSDU: " << *psdu <<
" TXVECTOR: " << txVector);
941 Time ppduDurationLimit)
const
949 if (txParams.
GetSize (receiver) > 0)
956 if (mpdu->GetHeader ().IsQosData ())
958 tid = mpdu->GetHeader ().GetQosTid ();
966 NS_ABORT_MSG (
"Cannot aggregate a non-QoS data frame to an A-MPDU that does"
967 " not contain any QoS data frame");
987 uint32_t maxAmpduSize =
m_mpduAggregator->GetMaxAmpduSize (receiver, tid, modulation);
989 if (maxAmpduSize == 0)
995 if (ampduSize > maxAmpduSize)
997 NS_LOG_DEBUG (
"the frame does not meet the constraint on max A-MPDU size ("
998 << maxAmpduSize <<
")");
1006 Time availableTime)
const
1008 NS_ASSERT (msdu != 0 && msdu->GetHeader ().IsQosData ());
1015 std::unique_ptr<WifiProtection> protection;
1017 bool protectionSwapped =
false;
1023 protectionTime = protection->protectionTime;
1027 protectionSwapped =
true;
1035 std::unique_ptr<WifiAcknowledgment> acknowledgment;
1036 acknowledgment =
GetAckManager ()->TryAggregateMsdu (msdu, txParams);
1037 bool acknowledgmentSwapped =
false;
1043 acknowledgmentTime = acknowledgment->acknowledgmentTime;
1047 acknowledgmentSwapped =
true;
1054 ppduDurationLimit = availableTime - protectionTime - acknowledgmentTime;
1061 if (protectionSwapped)
1065 if (acknowledgmentSwapped)
1082 Time ppduDurationLimit)
const
1084 NS_ASSERT (msdu != 0 && msdu->GetHeader ().IsQosData ());
1088 Mac48Address receiver = msdu->GetHeader ().GetAddr1 ();
1089 uint8_t tid = msdu->GetHeader ().GetQosTid ();
1093 uint16_t maxAmsduSize =
m_msduAggregator->GetMaxAmsduSize (receiver, tid, modulation);
1095 if (maxAmsduSize == 0)
1101 if (ret.first > maxAmsduSize)
1103 NS_LOG_DEBUG (
"No other MSDU can be aggregated: maximum A-MSDU size ("
1104 << maxAmsduSize <<
") reached ");
1129 m_mac->GetWifiRemoteStationManager ()->ReportDataFailed (*psdu->
begin ());
1168 m_mac->GetWifiRemoteStationManager ()->ReportAmpduTxStatus (recipient, 0, psdu->
GetNMpdus (),
1170 std::set<uint8_t> tids = psdu->
GetTids ();
1171 NS_ABORT_MSG_IF (tids.size () > 1,
"Multi-TID A-MPDUs not handled here");
1173 tid = *tids.begin ();
1181 if (
GetBaManager (tid)->NeedBarRetransmission (tid, recipient))
1183 NS_LOG_DEBUG (
"Missed Block Ack, transmit a BlockAckReq");
1198 NS_LOG_DEBUG (
"Missed Block Ack, do not transmit a BlockAckReq");
1201 m_mac->GetWifiRemoteStationManager ()->ReportFinalDataFailed (*psdu->
begin ());
1202 if (
GetBaManager (tid)->ExistsAgreementInState (recipient, tid,
1215 if (!
m_mac->GetWifiRemoteStationManager ()->NeedRetransmission (*psdu->
begin ()))
1217 NS_LOG_DEBUG (
"Missed Block Ack, do not retransmit the data frames");
1218 m_mac->GetWifiRemoteStationManager ()->ReportFinalDataFailed (*psdu->
begin ());
1228 NS_LOG_DEBUG (
"Missed Block Ack, retransmit data frames");
1229 GetBaManager (tid)->NotifyMissedBlockAck (recipient, tid);
1290 return it->second.GetBlockAckType ();
1301 double rxSnr = rxSignalInfo.
snr;
1317 m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxSignalInfo, txVector);
1339 std::pair<uint16_t,uint16_t> ret =
GetBaManager (tid)->NotifyGotBlockAck (blockAck, hdr.
GetAddr2 (), {tid});
1340 m_mac->GetWifiRemoteStationManager ()->ReportAmpduTxStatus (hdr.
GetAddr2 (), ret.first, ret.second,
1370 NS_LOG_DEBUG (
"There's not a valid agreement for this BlockAckReq");
1379 m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (sender, txVector),
1399 <<
" (" << *mpdu <<
")");
1401 agreementIt->second.NotifyReceivedMpdu (mpdu);
1407 this, hdr, txVector, rxSnr);
1420 const WifiTxVector& txVector,
const std::vector<bool>& perMpduStatus)
1422 std::set<uint8_t> tids = psdu->
GetTids ();
1425 if (tids.size () == 1)
1427 uint8_t tid = *tids.begin ();
1440 m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (psdu->
GetAddr2 (), txVector),
virtual void CalculateAcknowledgmentTime(WifiAcknowledgment *acknowledgment) const
Calculate the time required to acknowledge a frame according to the given acknowledgment method.
uint32_t GetBlockAckSize(BlockAckType type)
Return the total BlockAck size (including FCS trailer).
a unique identifier for an interface.
virtual void RetransmitMpduAfterMissedAck(Ptr< WifiMacQueueItem > mpdu) const
Retransmit an MPDU that was not acknowledged.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint8_t GetTid(void) const
Return the Traffic ID (TID).
uint32_t ampduSize
the size in bytes of the A-MPDU if multiple MPDUs have been added, and zero otherwise
void SetMacRxMiddle(const Ptr< MacRxMiddle > rxMiddle)
Set the MAC RX Middle to use.
bool m_setQosQueueSize
whether to set the Queue Size subfield of the QoS Control field of QoS data frames
Time acknowledgmentTime
time required by the acknowledgment method
WifiTxTimer m_txTimer
the timer set upon frame transmission
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void CtsTimeout(Ptr< WifiMacQueueItem > rts, const WifiTxVector &txVector) override
Called when the CTS timeout expires.
WifiNoProtection specifies that no protection method is used.
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Ptr< WifiPhy > m_phy
the PHY layer on this station
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
void RetransmitMpduAfterMissedCts(Ptr< WifiMacQueueItem > mpdu) const override
Retransmit an MPDU that was not sent because a CTS was not received.
Mac48Address GetAddr1(void) const
Get the Receiver Address (RA), which is common to all the MPDUs.
void SendNormalAck(const WifiMacHeader &hdr, const WifiTxVector &dataTxVector, double dataSnr)
Send Normal Ack.
const PsduInfo * GetPsduInfo(Mac48Address receiver) const
Get a pointer to the information about the PSDU addressed to the given receiver, if present,...
Time GetDuration(void) const
Get the duration from the Duration/ID field, which is common to all the MPDUs.
Ptr< const Packet > GetPayload(std::size_t i) const
Get the payload of the i-th MPDU.
Time GetSlot(void) const
Return the slot duration for this PHY.
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...
void AddHeader(const Header &header)
Add header to this packet.
BlockAckType GetBlockAckType(Mac48Address originator, uint8_t tid) const
Get the type of BlockAck frames sent to the given originator.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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...
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...
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
WifiBlockAck specifies that acknowledgment via Block Ack is required.
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
uint8_t GetBlockAckThreshold(void) const
Return the current threshold for block ack mechanism.
void TransmissionFailed(void) override
Take necessary actions upon a transmission failure.
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
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.
bool IsRunning(void) const
Return true if the timer is running.
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.
virtual void CalculateProtectionTime(WifiProtection *protection) const
Calculate the time required to protect a frame according to the given protection method.
void TransmissionSucceeded(void) override
Take necessary actions upon a transmission success.
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 SendCtsToSelf(const WifiTxParameters &txParams)
Send CTS for a CTS-to-self mechanism.
virtual bool IsWithinLimitsIfAggregateMsdu(Ptr< const WifiMacQueueItem > 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...
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
uint32_t GetSize(Mac48Address receiver) const
Get the size in bytes of the (A-)MPDU addressed to the given receiver.
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...
Ptr< BlockAckManager > GetBaManager(void)
Get the Block Ack Manager associated with this QosTxop.
void ReceiveMpdu(Ptr< WifiMacQueueItem > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu) override
This method handles the reception of an MPDU (possibly included in an A-MPDU)
void SendBlockAck(const RecipientBlockAckAgreement &agreement, Time durationId, WifiTxVector &blockAckTxVector, double rxSnr)
Create a BlockAck frame with header equal to blockAck and start its transmission.
void SendPsduWithProtection(Ptr< WifiPsdu > psdu, WifiTxParameters &txParams)
Send a PSDU (A-MPDU or BlockAckReq frame) requesting a BlockAck frame or a BlockAckReq frame followed...
Ptr< ChannelAccessManager > m_channelAccessManager
the channel access manager
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
void ResetCw(void)
Update the value of the CW variable to take into account a transmission success or a transmission abo...
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...
bool UseExplicitBarAfterMissedBlockAck(void) const
Return true if an explicit BlockAckRequest is sent after a missed BlockAck.
void SetWifiMac(const Ptr< RegularWifiMac > mac) override
Set the MAC layer to use.
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
virtual void ForwardPsduDown(Ptr< const WifiPsdu > psdu, WifiTxVector &txVector)
Forward a PSDU down to the PHY layer.
bool StartTransmission(Ptr< Txop > edca) override
Request the FrameExchangeManager to start a frame exchange sequence.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast())
Peek the next frame to transmit to the given receiver and of the given TID from the block ack manager...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
virtual bool SendDataFrame(Ptr< const WifiMacQueueItem > 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...
virtual void CtsTimeout(Ptr< WifiMacQueueItem > rts, const WifiTxVector &txVector)
Called when the CTS timeout expires.
Mac48Address m_self
the MAC address of this device
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
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...
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid)
Callback when ADDBA response is not received after timeout.
Time GetTxopLimit(void) const
Return the TXOP limit.
void RetransmitMpduAfterMissedAck(Ptr< WifiMacQueueItem > mpdu) const override
Retransmit an MPDU that was not acknowledged.
U * PeekPointer(const Ptr< U > &p)
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void UpdateFailedCw(void)
Update the value of the CW variable to take into account a transmission failure.
BlockAckReqType barType
BlockAckReq type.
uint16_t GetBlockAckInactivityTimeout(void) const
Get the BlockAck inactivity timeout.
std::unique_ptr< WifiProtection > m_protection
protection method
uint8_t GetTid(Ptr< const Packet > packet, const WifiMacHeader hdr)
This function is useful to get traffic id of different packet types.
void SetImmediateBlockAck(void)
Set block ack policy to immediate Ack.
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
virtual void NotifyPacketDiscarded(Ptr< const WifiMacQueueItem > mpdu)
Pass the given MPDU, discarded because of the max retry limit was reached, to the MPDU dropped callba...
void DoDispose() override
Destructor implementation.
void DestroyBlockAckAgreement(Mac48Address originator, uint8_t tid)
Destroy a Block Ack agreement.
uint16_t GetTimeout(void) const
Return the timeout.
Ptr< BlockAckManager > GetBaManager(uint8_t tid) const
Get the Block Ack Manager handling the given TID.
Ptr< WifiProtectionManager > GetProtectionManager(void) const
Get the Protection Manager used by this node.
HtFrameExchangeManager handles the frame exchange sequences for HT stations.
uint32_t GetBlockAckRequestSize(BlockAckReqType type)
Return the total BlockAckRequest size (including FCS trailer).
WifiBarBlockAck specifies that a BlockAckReq is sent to solicit a Block Ack response.
void SendRts(const WifiTxParameters &txParams)
Send RTS to begin RTS-CTS-Data-Ack transaction.
Smart pointer class similar to boost::intrusive_ptr.
std::list< Ptr< WifiMacQueueItem > >::const_iterator ConstIterator
Const iterator typedef.
Ptr< MsduAggregator > m_msduAggregator
A-MSDU aggregator.
QosFrameExchangeManager handles the frame exchange sequences for QoS stations.
WifiModulationClass GetModulationClass(void) const
Get the modulation class specified by this TXVECTOR.
Ptr< QosTxop > m_edca
the EDCAF that gained channel access
uint32_t GetSizeIfAddMpdu(Ptr< const WifiMacQueueItem > mpdu) const
Get the size in bytes of the frame in case the given MPDU is added.
void ResetBa(Mac48Address recipient, uint8_t tid)
Reset BA agreement after BA negotiation failed.
virtual bool TryAggregateMsdu(Ptr< const WifiMacQueueItem > 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 SetWifiMac(const Ptr< RegularWifiMac > mac)
Set the MAC layer to use.
bool IsZero(void) const
Exactly equivalent to t == 0.
Ptr< MpduAggregator > m_mpduAggregator
A-MPDU aggregator.
Ptr< MacRxMiddle > m_rxMiddle
the MAC RX Middle on this station
std::map< uint8_t, std::set< uint16_t > > seqNumbers
set of the sequence numbers of the MPDUs added for each TID
Mac48Address GetPeer(void) const
Return the peer address.
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
void SetSuccess(void)
Set success bit to 0 (success).
std::pair< uint32_t, uint32_t > GetSizeIfAggregateMsdu(Ptr< const WifiMacQueueItem > msdu) const
Get the size in bytes of the frame in case the given MSDU is aggregated.
void ReceiveMpdu(Ptr< WifiMacQueueItem > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu) override
This method handles the reception of an MPDU (possibly included in an A-MPDU)
The different BlockAck variants.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
void NotifyPacketDiscarded(Ptr< const WifiMacQueueItem > mpdu) override
Pass the given MPDU, discarded because of the max retry limit was reached, to the MPDU dropped callba...
WifiTxParameters m_txParams
the TX parameters for the current frame
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
bool IsWithinLimitsIfAddMpdu(Ptr< const WifiMacQueueItem > 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 Clear(void)
Reset the TX parameters.
Maintains the scoreboard and the receive reordering buffer used by a recipient of a Block Ack agreeme...
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
std::set< uint8_t > GetTids(void) const
Get the set of TIDs of the QoS Data frames included in the PSDU.
virtual ~HtFrameExchangeManager()
Simulation virtual time values and global simulation resolution.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
void SetDuration(Time duration)
Set the Duration/ID field on all the MPDUs.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void Set(double snr)
Set the SNR to the given value.
void CalculateAcknowledgmentTime(WifiAcknowledgment *acknowledgment) const override
Calculate the time required to acknowledge a frame according to the given acknowledgment method.
Ptr< WifiAckManager > GetAckManager(void) const
Get the Acknowledgment Manager used by this node.
Status code for association response.
Time GetAddBaResponseTimeout(void) const
Get the timeout for ADDBA response.
std::unique_ptr< WifiAcknowledgment > m_acknowledgment
acknowledgment method
Introspection did not find any typical Config paths.
virtual void DequeueMpdu(Ptr< const WifiMacQueueItem > mpdu)
Dequeue the given MPDU from the queue in which it is stored.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< const WifiMacQueueItem > PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const
virtual uint16_t GetSupportedBaBufferSize(void) const
Get the maximum supported buffer size for a Block Ack agreement.
WifiTxVector blockAckReqTxVector
BlockAckReq TXVECTOR.
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
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...
Ptr< MpduAggregator > GetMpduAggregator(void) const
Returns the aggregator used to construct A-MPDU subframes.
static void SetQosAckPolicy(Ptr< WifiMacQueueItem > item, const WifiAcknowledgment *acknowledgment)
Set the QoS Ack policy for the given MPDU, which must be a QoS data frame.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
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 ...
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
void TransmissionSucceeded(void) override
Take necessary actions upon a transmission success.
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
bool IsAggregate(void) const
Return true if the PSDU is an S-MPDU or A-MPDU.
bool IsStrictlyNegative(void) const
Exactly equivalent to t < 0.
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...
Mac48Address GetAddr2(void) const
Get the Transmitter Address (TA), which is common to all the MPDUs.
std::map< AgreementKey, RecipientBlockAckAgreement > m_agreements
agreements
Ptr< MacTxMiddle > m_txMiddle
the MAC TX Middle on this station
double snr
SNR in linear scale.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
WifiTxVector blockAckTxVector
BlockAck TXVECTOR.
Ptr< WifiMacQueueItem > GetNextMpdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame, WifiMacQueueItem::ConstIterator &queueIt)
Prepare the frame to transmit starting from the MPDU that has been previously peeked by calling PeekN...
RxSignalInfo structure containing info on the received signal.
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiAcknowledgment is an abstract base struct.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
void SetDelayedBlockAck(void)
Set block ack policy to delayed Ack.
virtual void NotifyReceivedNormalAck(Ptr< WifiMacQueueItem > mpdu)
Notify other components that an MPDU was acknowledged.
EventId m_inactivityEvent
inactivity event
void SendMpduWithProtection(Ptr< WifiMacQueueItem > mpdu, WifiTxParameters &txParams)
Send an MPDU with the given TX parameters (with the specified protection).
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.
Ptr< RegularWifiMac > m_mac
the MAC layer on this station
void ForwardMpduDown(Ptr< WifiMacQueueItem > mpdu, WifiTxVector &txVector) override
Forward an MPDU down to the PHY layer.
Mac48Address m_bssid
BSSID address (Mac48Address)
double Get(void) const
Return the SNR value.
Ptr< WifiPsdu > m_psdu
the A-MPDU being transmitted
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
void ScheduleBar(Ptr< const WifiMacQueueItem > bar, bool skipIfNoDataQueued=false)
information about the frame being prepared for a specific receiver
Reason GetReason(void) const
Get the reason why the timer was started.
void AggregateMsdu(Ptr< const WifiMacQueueItem > msdu)
Record that an MSDU is being aggregated to the last MPDU added to the frame that hase the same receiv...
BlockAckType GetBlockAckType(void) const
Get the type of the Block Acks sent by the recipient of this agreement.
virtual void RetransmitMpduAfterMissedCts(Ptr< WifiMacQueueItem > mpdu) const
Retransmit an MPDU that was not sent because a CTS was not received.
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.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Ptr< MsduAggregator > GetMsduAggregator(void) const
Returns the aggregator used to construct A-MSDU subframes.
void DequeuePsdu(Ptr< const WifiPsdu > psdu)
Dequeue the MPDUs of the given PSDU from the queue in which they are stored.
std::vector< Ptr< WifiMacQueueItem > >::const_iterator begin(void) const
Return a const iterator to the first MPDU.
virtual Ptr< WifiPsdu > GetWifiPsdu(Ptr< WifiMacQueueItem > mpdu, const WifiTxVector &txVector) const
Get a PSDU containing the given MPDU.
const Method method
acknowledgment method
void SendPsdu(void)
Send the current PSDU, which can be acknowledged by a BlockAck frame or followed by a BlockAckReq fra...
BlockAckType baType
BlockAck type.
BlockAckType baType
BlockAck type.
void CompleteMpduTx(Ptr< WifiMacQueueItem > mpdu)
Stores an MPDU (part of an A-MPDU) in block ack agreement (i.e.
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.
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
void SendAddBaResponse(const MgtAddBaRequestHeader *reqHdr, Mac48Address originator)
This method can be called to accept a received ADDBA Request.
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.
WifiTxVector blockAckTxVector
BlockAck TXVECTOR.
void Cancel(void)
Cancel the timer.
void NotifyReceivedNormalAck(Ptr< WifiMacQueueItem > mpdu) override
Notify other components that an MPDU was acknowledged.
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 Send(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
This function is a wrapper for the Send variant that accepts a WifiConstPsduMap as first argument.
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.
Time GetFailedAddBaTimeout(void) const
Get the timeout for failed BA agreement.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
virtual void BlockAckTimeout(Ptr< WifiPsdu > psdu, const WifiTxVector &txVector)
Called when the BlockAck timeout expires.
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.
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...
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
virtual Time GetRemainingTxop(void) const
Return the remaining duration in the current TXOP.