22#undef NS_LOG_APPEND_CONTEXT
23#define NS_LOG_APPEND_CONTEXT WIFI_FEM_NS_LOG_APPEND_CONTEXT
28#define PSDU_DURATION_SAFEGUARD 400
41 TypeId(
"ns3::FrameExchangeManager")
43 .AddConstructor<FrameExchangeManager>()
45 .AddAttribute(
"ProtectedIfResponded",
46 "Whether a station is assumed to be protected if replied to a frame "
47 "requiring acknowledgment. If a station is protected, subsequent "
48 "transmissions to the same station in the same TXOP are not "
49 "preceded by protection mechanisms.",
179 m_phy->TraceConnectWithoutContext(
"PhyRxPayloadBegin",
181 m_phy->TraceConnectWithoutContext(
"PhyRxMacHeaderEnd",
193 m_phy->TraceDisconnectWithoutContext(
196 m_phy->TraceDisconnectWithoutContext(
199 if (
m_phy->GetState())
205 const std::vector<bool>&>());
293 <<
" (txVector: " << txVector <<
")");
296 "The TX timer and the NAV reset event cannot be both running");
336 UpdateNav(macHdr, txVector, psduDuration);
339std::optional<std::reference_wrapper<const FrameExchangeManager::OngoingRxInfo>>
349std::optional<std::reference_wrapper<const WifiMacHeader>>
352 if (
auto info =
GetOngoingRxInfo(); info.has_value() && info->get().macHdr.has_value())
354 return info->get().macHdr.value();
377 queue->WipeAllExpiredMpdus();
390 const auto& hdr = mpdu->GetHeader();
392 NS_ASSERT(hdr.IsData() || hdr.IsMgt() || hdr.IsPsPoll());
403 if (!peekedItem->IsFragment() && !peekedItem->HasSeqNoAssigned())
407 m_txMiddle->GetNextSequenceNumberFor(&peekedItem->GetOriginal()->GetHeader());
408 peekedItem->AssignSeqNo(sequence);
433 sender <<
" is not in powersave mode");
454 if (mpdu->IsFragment())
469 item->GetHeader().SetMoreFragments();
470 m_mac->GetTxopQueue(mpdu->GetQueueAc())->Replace(mpdu, item);
493 if (!
m_txParams.m_acknowledgment->acknowledgmentTime.has_value())
547const std::set<Mac48Address>&
560 m_phy->GetPhyBand());
572 NS_LOG_DEBUG(
"Prepare groupcast MPDU for retry");
573 mpdu->ResetInFlight(m_linkId);
575 if (m_apMac->GetGcrManager()->UseConcealment(mpdu->GetHeader()))
577 mpdu->GetHeader().SetAddr1(mpdu->begin()->second.GetDestinationAddr());
579 mpdu->GetHeader().SetRetry();
584 if (
m_apMac->GetGcrManager()->GetRetransmissionPolicy() ==
592 else if (
m_mpdu->GetHeader().IsPsPoll())
597 txDuration +
m_phy->GetSifs() +
m_phy->GetSlot() +
602 {
m_mpdu->GetHeader().GetAddr1()},
610 if (!
m_mpdu->GetHeader().IsPsPoll())
614 (!
m_mpdu->GetHeader().IsQosData() ||
627 m_mpdu->GetHeader().SetDuration(
628 GetFrameDurationId(m_mpdu->GetHeader(),
629 GetPsduSize(m_mpdu, m_txParams.m_txVector),
631 m_fragmentedPacket));
636 auto normalAcknowledgment =
static_cast<WifiNormalAck*
>(m_txParams.m_acknowledgment.get());
639 txDuration + m_phy->GetSifs() + m_phy->GetSlot() +
644 {m_mpdu->GetHeader().GetAddr1()},
648 m_txParams.m_txVector);
649 m_channelAccessManager->NotifyAckTimeoutStartNow(
timeout);
653 NS_ABORT_MSG(
"Unable to handle the selected acknowledgment method ("
654 << m_txParams.m_acknowledgment.get() <<
")");
658 ForwardMpduDown(m_mpdu, m_txParams.m_txVector);
660 if (m_txTimer.IsRunning())
663 m_sentFrameTo = {m_mpdu->GetHeader().GetAddr1()};
678 const auto& hdr = psdu->GetHeader(0);
682 hdr.IsAck() && hdr.GetAddr1() ==
m_bssid)
688 m_phy->Send(psdu, txVector);
703 const auto& hdr = psdu->GetHeader(0);
704 const auto staInPsModeOrGroupDest =
706 const auto txGroupAddrFramesAfterDtimOrUnicastDest =
707 !hdr.GetAddr1().IsGroup() ||
m_apMac->GetMacQueueScheduler()->GetAllQueuesBlockedOnLink(
711 if ((hdr.IsData() || hdr.IsMgt() || hdr.IsBlockAckReq()) && staInPsModeOrGroupDest &&
712 txGroupAddrFramesAfterDtimOrUnicastDest)
717 mpdu->GetHeader().SetMoreData(
true);
720 auto mpdu = *std::prev(psdu->end());
721 mpdu->GetHeader().SetMoreData(
m_apMac->HasMoreDataAfter(mpdu,
m_linkId));
725 if (
m_mac->GetTypeOfStation() !=
STA)
738 mpdu->GetHeader().SetNoPowerManagement();
742 mpdu->GetHeader().SetPowerManagement();
755 if (mpdu->IsQueued())
757 m_mac->GetTxopQueue(mpdu->GetQueueAc())->DequeueIfQueued({mpdu});
764 return mpdu->GetSize();
782 rtsCtsProtection->rtsTxVector,
783 m_phy->GetPhyBand()) +
785 rtsCtsProtection->ctsTxVector,
786 m_phy->GetPhyBand()) +
787 2 *
m_phy->GetSifs();
794 ctsToSelfProtection->ctsTxVector,
795 m_phy->GetPhyBand()) +
812 auto normalAcknowledgment =
static_cast<WifiNormalAck*
>(acknowledgment);
815 normalAcknowledgment->ackTxVector,
816 m_phy->GetPhyBand());
840 NS_LOG_FUNCTION(
this << header << size << &txParams << fragmentedPacket);
853 std::min(fragmentedPacket->GetSize() - nextFragmentOffset, payloadSize);
857 durationId += 2 *
m_phy->GetSifs() +
861 m_phy->GetPhyBand());
876 return m_phy->GetSifs() +
878 +
m_phy->GetSifs() + txDuration + response;
888 const auto& hdr = txParams.
GetPsduInfoMap().begin()->second.header;
914 rtsCtsProtection->rtsTxVector,
915 m_phy->GetPhyBand()) +
925 rtsCtsProtection->rtsTxVector);
960 packet->AddPacketTag(tag);
985 return m_phy->GetSifs() + txDuration + response;
1014 ctsToSelfProtection->ctsTxVector,
1015 m_phy->GetPhyBand());
1044 if (duration.IsStrictlyNegative())
1054 packet->AddPacketTag(tag);
1071 if (size >
m_mpdu->GetPacketSize())
1074 size =
m_mpdu->GetPacketSize();
1095 NS_LOG_DEBUG(
"Schedule transmission of next fragment in a SIFS");
1114 if (!forceCurrentCw)
1130 txop->NotifyChannelReleased(
m_linkId);
1142 for (
const auto& mpdu : mpdusToDrop)
1167 if (mpdu->IsQueued())
1169 mpdu =
m_mac->GetTxopQueue(mpdu->GetQueueAc())->GetOriginal(mpdu);
1171 mpdu->GetHeader().SetRetry();
1214 for (
const auto& [staId, psdu] : psduMap)
1218 if (mpdu->IsQueued())
1224 if (
const auto& hdr = psdu->GetHeader(0);
1265 NS_ASSERT_MSG(psdu->GetNMpdus() == 1,
"A-MPDUs should be handled by the HT FEM override");
1266 auto mpdu = *psdu->begin();
1272 if (!mpdu->GetHeader().IsRetry() && !mpdu->IsInFlight())
1274 mpdu->UnassignSeqNo();
1275 m_txMiddle->SetSequenceNumberFor(&mpdu->GetOriginal()->GetHeader());
1291 (qosTxop ? qosTxop->PeekNextMpdu(
m_linkId) : txop->GetWifiMacQueue()->Peek(
m_linkId));
1292 mpdu && !mpdu->GetHeader().GetAddr1().IsGroup())
1294 if (mpdu->GetHeader().HasData())
1306 txop->Txop::NotifyChannelReleased(
m_linkId);
1312 NS_LOG_DEBUG(
"Switching channel. Cancelling MAC pending events");
1327 NS_LOG_DEBUG(
"Device in sleep mode. Cancelling MAC pending events");
1334 NS_LOG_DEBUG(
"Device is switched off. Cancelling MAC pending events");
1348 const std::vector<bool>& perMpduStatus)
1351 this << psdu << rxSignalInfo << txVector << perMpduStatus.size()
1352 << std::all_of(perMpduStatus.begin(), perMpduStatus.end(), [](
bool v) { return v; }));
1354 if (!perMpduStatus.empty())
1365 if (psdu->GetNMpdus() == 1)
1370 NS_ASSERT(perMpduStatus.empty() || (perMpduStatus.size() == 1 && perMpduStatus[0]));
1372 if (
const auto& hdr = psdu->GetHeader(0); !hdr.IsAck() && !hdr.IsCts())
1376 ReceiveMpdu(*(psdu->begin()), rxSignalInfo, txVector, perMpduStatus.empty());
1387 if (!mpdu->GetHeader().IsCtl())
1394 if (!perMpduStatus.empty())
1402 if (
m_staMac && (psdu->GetHeader(0).IsAck() || psdu->GetAddr2() ==
m_bssid) &&
1408 if (psdu->GetHeader(0).IsAck())
1446 UpdateNav(psdu->GetHeader(0), txVector);
1452 const Time& surplus)
1463 duration += surplus;
1494 Time navResetDelay =
1495 2 *
m_phy->GetSifs() +
1524 if (!mpdu->GetHeader().IsPsPoll())
1526 const auto txNav =
Simulator::Now() + txDuration + mpdu->GetHeader().GetDuration();
1551 NS_LOG_FUNCTION(
this << *mpdu << rxSignalInfo << txVector << inAmpdu);
1553 NS_ASSERT(mpdu->GetHeader().GetAddr1().IsGroup() || mpdu->GetHeader().GetAddr1() ==
m_self);
1555 double rxSnr = rxSignalInfo.
snr;
1593 mpdu->GetPacket()->PeekPacketTag(tag);
1609 mpdu->GetPacket()->PeekPacketTag(tag);
1620 NS_LOG_WARN(
"Ignoring PS-Poll addressed to us, as we are not an AP");
1628 NS_LOG_WARN(
"Ignoring PS-Poll as the sender is not in PowerSave mode");
1632 NS_LOG_DEBUG(
"Check in a SIFS if we have a buffered unit to send to the sender");
1634 if (!SendBufferedUnit(sender))
1637 "No frame to send to the sender of the PS-Poll; send a Normal Ack");
1638 SendNormalAck(hdr, txVector, rxSnr);
1643 else if (hdr.IsMgt())
1645 NS_ABORT_MSG_IF(inAmpdu,
"Received management frame as part of an A-MPDU");
1647 if (hdr.IsBeacon() || hdr.IsProbeResp())
1653 packet->AddPacketTag(tag);
1657 if (hdr.GetAddr1() == m_self)
1659 NS_LOG_DEBUG(
"Received " << hdr.GetTypeString() <<
" from=" << hdr.GetAddr2()
1660 <<
", schedule ACK");
1661 Simulator::Schedule(m_phy->GetSifs(),
1662 &FrameExchangeManager::SendNormalAck,
1669 m_rxMiddle->Receive(mpdu, m_linkId);
1671 else if (hdr.IsData() && !hdr.IsQosData())
1673 if (hdr.GetAddr1() == m_self)
1675 NS_LOG_DEBUG(
"Received " << hdr.GetTypeString() <<
" from=" << hdr.GetAddr2()
1676 <<
", schedule ACK");
1677 Simulator::Schedule(m_phy->GetSifs(),
1678 &FrameExchangeManager::SendNormalAck,
1685 m_rxMiddle->Receive(mpdu, m_linkId);
1703 if (!mpdu->GetHeader().IsMoreFragments())
1730 if (mpdu->GetHeader().IsMoreFragments())
1764 const std::vector<bool>& perMpduStatus)
1766 NS_ASSERT_MSG(
false,
"A non-QoS station should not receive an A-MPDU");
1772 NS_ASSERT_MSG(
false,
"A non-QoS station should not use GCR-UR");
AttributeValue implementation for Boolean.
std::set< Mac48Address > m_sentRtsTo
the STA(s) which we sent an RTS to (waiting for CTS)
Ptr< WifiMpdu > m_mpdu
the MPDU being transmitted
virtual void SetAckManager(Ptr< WifiAckManager > ackManager)
Set the Acknowledgment Manager to use.
void NotifyOffNow()
This method is typically invoked by the PhyListener to notify the MAC layer that the device has been ...
virtual void NotifyLastGcrUrTx(Ptr< const WifiMpdu > mpdu)
Notify the last (re)transmission of a groupcast MPDU using the GCR-UR service.
virtual void NotifyInternalCollision(Ptr< Txop > txop)
Notify that an internal collision has occurred for the given Txop.
static TypeId GetTypeId()
Get the type ID.
uint8_t m_linkId
the ID of the link this object is associated with
Ptr< WifiMac > m_mac
the MAC layer on this station
void SetTxNav(Ptr< const WifiMpdu > mpdu, const Time &txDuration)
Set the TXNAV upon sending an MPDU.
Callback< void, WifiMacDropReason, Ptr< const WifiMpdu > > DroppedMpdu
typedef for a callback to invoke when an MPDU is dropped.
DroppedMpdu m_droppedMpduCallback
the dropped MPDU callback
bool m_protectedIfResponded
whether a STA is assumed to be protected if replied to a frame requiring acknowledgment
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the MAC layer to use.
virtual void ResetPhy()
Remove WifiPhy associated with this FrameExchangeManager.
void SendMpduWithProtection(Ptr< WifiMpdu > mpdu, WifiTxParameters &txParams)
Send an MPDU with the given TX parameters (with the specified protection).
Ptr< WifiAckManager > m_ackManager
Acknowledgment manager.
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.
Ptr< Packet > m_fragmentedPacket
the MSDU being fragmented
virtual void SetDroppedMpduCallback(DroppedMpdu callback)
Set the callback to invoke when an MPDU is dropped.
virtual bool GetReportRtsFailed() const
virtual void Reset()
Reset this frame exchange manager.
Callback< void, Ptr< const WifiMpdu > > AckedMpdu
typedef for a callback to invoke when an MPDU is successfully acknowledged.
Mac48Address m_self
the MAC address of this device
virtual void StartProtection(const WifiTxParameters &txParams)
Start the protection mechanism indicated by the given TX parameters.
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...
std::optional< std::reference_wrapper< const WifiMacHeader > > GetReceivedMacHdr() const
WifiTxTimer m_txTimer
the timer set upon frame transmission
std::set< Mac48Address > m_protectedStas
STAs that have replied to an RTS in this TXOP.
virtual Time GetRtsDurationId(const WifiTxVector &rtsTxVector, Time txDuration, Time response) const
Compute how to set the Duration/ID field of an RTS frame to send to protect a frame transmitted with ...
virtual void RetransmitMpduAfterMissedAck(Ptr< WifiMpdu > mpdu) const
Retransmit an MPDU that was not acknowledged.
Mac48Address GetAddress() const
Get the MAC address.
Ptr< WifiProtectionManager > m_protectionManager
Protection manager.
OngoingRxInfo m_ongoingRxInfo
information about the MAC header of the MPDU being received
virtual void ProtectionCompleted()
Transmit prepared frame immediately, if no protection was used, or in a SIFS, if protection was compl...
virtual void ForwardMpduDown(Ptr< WifiMpdu > mpdu, WifiTxVector &txVector)
Forward an MPDU down to the PHY layer.
virtual void SetLinkId(uint8_t linkId)
Set the ID of the link this Frame Exchange Manager is associated with.
virtual bool VirtualCsMediumIdle() const
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.
virtual void NotifyChannelReleased(Ptr< Txop > txop)
Notify the given Txop that channel has been released.
virtual void NormalAckTimeout(Ptr< WifiMpdu > mpdu, const WifiTxVector &txVector)
Called when the Ack timeout expires.
virtual bool SendBufferedUnit(Mac48Address sender)
Send a buffered unit to the given sender, if any.
virtual void NotifySwitchingStartNow(Time duration)
virtual void SetBssid(Mac48Address bssid)
Set the Basic Service Set Identification.
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.
void DoCtsTimeout(const WifiPsduMap &psduMap)
Take required actions when the CTS timer fired after sending an (MU-)RTS to protect the given PSDU ma...
virtual void ReceivedMacHdr(const WifiMacHeader &macHdr, const WifiTxVector &txVector, Time psduDuration)
Store information about the MAC header of the MPDU being received.
Time m_txNav
the TXNAV timer
virtual void CalculateProtectionTime(WifiProtection *protection) const
Calculate the time required to protect a frame according to the given protection method.
std::optional< std::reference_wrapper< const OngoingRxInfo > > GetOngoingRxInfo() const
virtual void SetAddress(Mac48Address address)
Set the MAC address.
virtual void SendCtsAfterRts(const WifiMacHeader &rtsHdr, const WifiTxVector &rtsTxVector, double rtsSnr)
Send CTS after receiving RTS.
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.
virtual void NavResetTimeout()
Reset the NAV upon expiration of the NAV reset timer.
const std::set< Mac48Address > & GetProtectedStas() const
Ptr< WifiProtectionManager > GetProtectionManager() const
Get the Protection Manager used by this node.
void ReceiveFrameAfterPsPoll()
Take actions required when a frame is received from the associated AP after sending a PS-Poll frame.
bool IsPromisc() const
Check if the device is operating in promiscuous mode.
void SendMpdu()
Send the current MPDU, which can be acknowledged by a Normal Ack.
virtual void EndReceiveAmpdu(Ptr< const WifiPsdu > psdu, const RxSignalInfo &rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &perMpduStatus)
This method is called when the reception of an A-MPDU including multiple MPDUs is completed.
Ptr< MacRxMiddle > m_rxMiddle
the MAC RX Middle on this station
virtual void TransmissionSucceeded()
Take necessary actions upon a transmission success.
Ptr< Txop > m_dcf
the DCF/EDCAF that gained channel access
EventId m_sendCtsEvent
the event to send a CTS after an (MU-)RTS
Ptr< WifiPhy > m_phy
the PHY layer on this station
Ptr< WifiMpdu > GetFirstFragmentIfNeeded(Ptr< WifiMpdu > mpdu)
Fragment the given MPDU if needed.
Ptr< WifiMpdu > DropMpduIfRetryLimitReached(Ptr< WifiPsdu > psdu)
Wrapper for the GetMpdusToDropOnTxFailure function of the remote station manager that additionally dr...
Ptr< WifiMpdu > GetNextFragment()
Get the next fragment of the current MSDU.
virtual void ReleaseSequenceNumbers(Ptr< const WifiPsdu > psdu) const
Make the sequence numbers of MPDUs included in the given PSDU available again if the MPDUs have never...
std::set< Mac48Address > m_sentFrameTo
the STA(s) to which we sent a frame requesting a response
void SetAckedMpduCallback(AckedMpdu callback)
Set the callback to invoke when an MPDU is successfully acked.
~FrameExchangeManager() override
virtual void PreProcessFrame(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Perform actions that are possibly needed when receiving any frame, independently of whether the frame...
void ResetTxNav()
Reset the TXNAV.
virtual Time GetFrameDurationId(const WifiMacHeader &header, uint32_t size, const WifiTxParameters &txParams, Ptr< Packet > fragmentedPacket) const
Compute how to set the Duration/ID field of a frame being transmitted with the given TX parameters.
virtual Time GetCtsToSelfDurationId(const WifiTxVector &ctsTxVector, Time txDuration, Time response) const
Compute how to set the Duration/ID field of a CTS-to-self frame to send to protect a frame transmitte...
void DoSendCtsAfterRts(const WifiMacHeader &rtsHdr, WifiTxVector &ctsTxVector, double rtsSnr)
Send CTS after receiving RTS.
Ptr< ApWifiMac > m_apMac
AP MAC layer pointer (null if not an AP).
Mac48Address m_bssid
BSSID address (Mac48Address).
virtual void SetWifiPhy(const Ptr< WifiPhy > phy)
Set the PHY layer to use.
void Receive(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &perMpduStatus)
This method is intended to be called by the PHY layer every time an MPDU is received and also when th...
virtual void TransmissionFailed(bool forceCurrentCw=false)
Take necessary actions upon a transmission failure.
AckedMpdu m_ackedMpduCallback
the acknowledged MPDU callback
virtual void FinalizeMacHeader(Ptr< const WifiPsdu > psdu)
Finalize the MAC header of the MPDUs in the given PSDU before transmission.
virtual void PostProcessFrame(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Perform actions that are possibly needed after receiving any frame, independently of whether the fram...
virtual uint32_t GetPsduSize(Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector) const
Get the size in bytes of the given MPDU, which is to be transmitted with the given TXVECTOR.
Ptr< ChannelAccessManager > m_channelAccessManager
the channel access manager
virtual void ReceivedNormalAck(Ptr< WifiMpdu > mpdu, const WifiTxVector &txVector, const WifiTxVector &ackTxVector, const RxSignalInfo &rxInfo, double snr)
Perform the actions needed when a Normal Ack is received.
bool m_promisc
Flag if the device is operating in promiscuous mode.
void NotifySleepNow()
This method is typically invoked by the PhyListener to notify the MAC layer that the device has been ...
virtual void PrepareFrameToSend(Ptr< WifiMpdu > peekedItem)
Set the sequence number, determine the transmission parameters and transmit the given MPDU,...
virtual void ReceiveMpdu(Ptr< const WifiMpdu > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu)
This method handles the reception of an MPDU (possibly included in an A-MPDU).
virtual void SetChannelAccessManager(const Ptr< ChannelAccessManager > channelAccessManager)
Set the channel access manager to use.
virtual bool StartTransmission(Ptr< Txop > dcf, MHz_u allowedWidth)
Request the FrameExchangeManager to start a frame exchange sequence.
bool m_moreFragments
true if a fragment has to be sent after a SIFS
void SetPromisc()
Enable promiscuous mode.
MHz_u m_allowedWidth
the allowed width for the current transmission
MHz_u GetAllowedWidth() const
virtual void PsduRxError(Ptr< const WifiPsdu > psdu)
This method is called when the reception of a PSDU fails.
Time m_navEnd
NAV expiration time.
virtual void UpdateNav(const WifiMacHeader &hdr, const WifiTxVector &txVector, const Time &surplus=Time{0})
Update the NAV, if needed, based on the Duration/ID of the given MAC header and the given surplus.
virtual void SetMacTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set the MAC TX Middle to use.
virtual void SetMacRxMiddle(const Ptr< MacRxMiddle > rxMiddle)
Set the MAC RX Middle to use.
virtual void SetProtectionManager(Ptr< WifiProtectionManager > protectionManager)
Set the Protection Manager to use.
Mac48Address GetBssid() const
Get the Basic Service Set Identification.
Ptr< StaWifiMac > m_staMac
STA MAC layer pointer (null if not a STA).
void DoDispose() override
Destructor implementation.
WifiTxParameters m_txParams
the TX parameters for the current frame
virtual void RxStartIndication(WifiTxVector txVector, Time psduDuration)
EventId m_navResetEvent
the event to reset the NAV after an RTS
const WifiTxTimer & GetWifiTxTimer() const
Get a const reference to the WifiTxTimer object.
virtual bool GetUpdateCwOnCtsTimeout() const
virtual Time GetTxDuration(uint32_t ppduPayloadSize, Mac48Address receiver, const WifiTxParameters &txParams) const
Get the updated TX duration of the frame associated with the given TX parameters if the size of the P...
Object()
Caller graph was not generated because of its size.
virtual void DoDispose()
Destructor implementation.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
Return the current simulation virtual time.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
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.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
bool IsStrictlyNegative() const
Exactly equivalent to t < 0.
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.
virtual void NotifyChannelSwitching(uint8_t linkId)
Notify that channel on the given link has been switched.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
std::optional< Time > m_txDuration
TX duration of the frame.
const PsduInfoMap & GetPsduInfoMap() const
Get a const reference to the map containing information about PSDUs.
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
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
void AddMpdu(Ptr< const WifiMpdu > mpdu)
Record that an MPDU is being added to the current frame.
This class is used to handle the timer that a station starts when transmitting a frame that solicits ...
@ WAIT_DATA_AFTER_PS_POLL
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.
MHz_u GetChannelWidth() const
#define PSDU_DURATION_SAFEGUARD
#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...
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Callback< R, Args... > MakeNullCallback()
Build null Callbacks which take no arguments, for varying number of template arguments,...
#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_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_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
@ WIFI_MAC_DROP_REACHED_RETRY_LIMIT
@ WIFI_PM_SWITCHING_TO_ACTIVE
@ WIFI_PM_SWITCHING_TO_PS
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
uint32_t GetRtsSize()
Return the total RTS size (including FCS trailer).
static constexpr uint16_t WIFI_MAC_FCS_LENGTH
The length in octets of the IEEE 802.11 MAC FCS field.
double MHz_u
MHz weak type.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
std::unordered_map< uint16_t, Ptr< WifiPsdu > > WifiPsduMap
Map of PSDUs indexed by STA-ID.
Ptr< T1 > StaticCast(const Ptr< T2 > &p)
Cast a Ptr.
uint32_t GetAckSize()
Return the total Ack size (including FCS trailer).
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU).
uint32_t GetCtsSize()
Return the total CTS size (including FCS trailer).
Mac48Address GetIndividuallyAddressedRecipient(Ptr< WifiMac > mac, const WifiMacHeader &hdr)
Get the MAC address of the individually addressed recipient to use for a given packet.
RxSignalInfo structure containing info on the received signal.
double snr
SNR in linear scale.
WifiAcknowledgment is an abstract base struct.
const Method method
acknowledgment method
std::optional< Time > acknowledgmentTime
time required by the acknowledgment method
WifiCtsToSelfProtection specifies that CTS-to-self protection method is used.
WifiNormalAck specifies that acknowledgment via Normal Ack is required.
WifiProtection is an abstract base struct.
std::optional< Time > protectionTime
time required by the protection method
const Method method
protection method
WifiRtsCtsProtection specifies that RTS/CTS protection method is used.