27 #include "ns3/object.h" 28 #include "ns3/nstime.h" 44 class WifiMacQueueItem;
47 class BlockAckAgreement;
48 class MgtAddBaResponseHeader;
49 class WifiRemoteStationManager;
50 class CtrlBAckRequestHeader;
51 class CtrlBAckResponseHeader;
222 uint32_t ampduSize,
Time ppduDurationLimit);
267 uint32_t fragmentSize = 0)
const;
359 uint16_t startingSeq);
387 std::vector<bool> statusPerMpdu);
779 Time duration,
WifiMode blockAckReqTxMode,
double rxSnr);
803 Time duration,
WifiMode blockAckReqTxMode,
double rxSnr);
891 typedef std::pair<BlockAckAgreement, std::list<Ptr<WifiMacQueueItem>> >
AgreementValue;
894 typedef std::map<AgreementKey, AgreementValue>::iterator
AgreementsI;
void WaitIfsAfterEndTxPacket(void)
Event handler that is usually scheduled to fired at the appropriate time after sending a packet...
Simulation virtual time values and global simulation resolution.
EventId m_navCounterResetCtsMissed
Event to reset NAV when CTS is not received.
std::vector< Ptr< ChannelAccessManager > >::const_iterator ChannelAccessManagersCI
typedef for an iterator for a list of ChannelAccessManager.
void ResetBlockAckInactivityTimerIfNeeded(BlockAckAgreement &agreement)
Every time that a BlockAckRequest or a packet with Ack Policy equals to Block Ack are received...
EventId m_blockAckTimeoutEvent
BlockAck timeout event.
Time CalculateOverallTxTime(Ptr< const Packet > packet, const WifiMacHeader *hdr, const MacLowTransmissionParameters ¶ms, uint32_t fragmentSize=0) const
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Ptr< MpduAggregator > GetMpduAggregator(void) const
Returns the aggregator used to construct A-MPDU subframes.
void SendBlockAckAfterBlockAckRequest(const CtrlBAckRequestHeader reqHdr, Mac48Address originator, Time duration, WifiMode blockAckReqTxMode, double rxSnr)
Invoked after that a BlockAckRequest has been received.
bool ReceiveMpdu(Ptr< WifiMacQueueItem > mpdu)
void SetPromisc(void)
Enable promiscuous mode.
void DoNavResetNow(Time duration)
Reset NAV with the given duration.
Ptr< Txop > m_currentTxop
Current TXOP.
void SetupPhyMacLowListener(const Ptr< WifiPhy > phy)
Set up WifiPhy listener for this MacLow.
Ptr< QosTxop > GetEdca(uint8_t tid) const
Ptr< MsduAggregator > m_msduAggregator
A-MSDU aggregator.
void SetPhy(const Ptr< WifiPhy > phy)
Set up WifiPhy associated with this MacLow.
bool DoNavStartNow(Time duration)
Start NAV with the given duration.
std::pair< Mac48Address, uint8_t > AgreementKey
agreement key typedef
Time CalculateOverheadTxTime(Ptr< const WifiMacQueueItem > item, const MacLowTransmissionParameters ¶ms) const
void ReceiveError(Ptr< WifiPsdu > psdu)
Time GetResponseDuration(const MacLowTransmissionParameters ¶ms, WifiTxVector dataTxVector, Mac48Address receiver) const
Return the time required to transmit the response frames (Ack or BAR+BA following the policy configur...
bool IsNavZero(void) const
Check if NAV is zero.
void NotifyOffNow(void)
This method is typically invoked by the PhyMacLowListener to notify the MAC layer that the device has...
void NotifySleepNow(void)
This method is typically invoked by the PhyMacLowListener to notify the MAC layer that the device has...
void NotifyNav(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Notify NAV function.
Mac48Address GetBssid(void) const
Return the Basic Service Set Identification.
Callback< void, Ptr< WifiMacQueueItem > > MacLowRxCallback
typedef for a callback for MacLowRx
WifiTxVector GetRtsTxVector(Ptr< const WifiMacQueueItem > item) const
Return a TXVECTOR for the RTS frame given the destination.
Mac48Address m_bssid
BSSID address (Mac48Address)
EventId m_sendCtsEvent
Event to send CTS.
MacLowRxCallback m_rxCallback
Callback to pass packet up.
bool appendCfAck
Flag used for PCF to indicate whether a CF-Ack should be appended.
EventId m_sendAckEvent
Event to send Ack.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
WifiMode GetControlAnswerMode(WifiMode reqMode) const
Get control answer mode function.
void NotifyAckTimeoutResetNow(void)
Notify ChannelAccessManager that Ack timer should be reset.
Time m_cfpMaxDuration
CFP max duration.
Time CalculateTransmissionTime(Ptr< const Packet > packet, const WifiMacHeader *hdr, const MacLowTransmissionParameters ¶meters) const
control how a packet is transmitted.
std::list< Ptr< WifiMacQueueItem > >::iterator BufferedPacketI
buffered packet iterator typedef
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self capability.
bool expectCfAck
Flag used for PCF to indicate whether a CF-Ack should be expected.
QueueEdcas m_edca
EDCA queues.
void NormalAckTimeout(void)
Event handler when normal Ack timeout occurs.
BlockAckCaches m_bAckCaches
block ack caches
Ptr< WifiMac > m_mac
Pointer to WifiMac (to fetch configuration)
void RemovePhyMacLowListener(Ptr< WifiPhy > phy)
Remove current WifiPhy listener for this MacLow.
bool IsPromisc(void) const
Check if MacLow is operating in promiscuous mode.
WifiTxVector m_currentTxVector
TXVECTOR used for the current packet transmission.
void DestroyBlockAckAgreement(Mac48Address originator, uint8_t tid)
Time m_lastNavDuration
The duration of the latest NAV.
void SetCfpMaxDuration(Time duration)
Time GetCtsDuration(WifiTxVector ctsTxVector) const
Return the time required to transmit the CTS (including preamble and FCS).
bool IsWithinSizeAndTimeLimits(Ptr< const WifiMacQueueItem > mpdu, WifiTxVector txVector, uint32_t ampduSize, Time ppduDurationLimit)
Check whether the given MPDU, if transmitted according to the given TX vector, meets the constraint o...
bool m_ctsToSelfSupported
Flag whether CTS-to-self is supported.
void SendCtsToSelf(void)
Send CTS for a CTS-to-self mechanism.
void SendAckAfterData(Mac48Address source, Time duration, WifiMode dataTxMode, double dataSnr)
Send Ack after receiving Data.
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
virtual void StartTransmission(Ptr< WifiMacQueueItem > mpdu, MacLowTransmissionParameters parameters, Ptr< Txop > txop)
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
Time m_lastBeacon
The time when the last beacon frame transmission started.
void CtsTimeout(void)
Event handler when CTS timeout occurs.
void DeaggregateAmpduAndReceive(Ptr< WifiPsdu > aggregatedPacket, double rxSnr, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Time GetSifs(void) const
Return Short Interframe Space (SIFS) of this MacLow.
void EndTxNoAck(void)
A transmission that does not require an Ack has completed.
void SendBlockAckAfterAmpdu(uint8_t tid, Mac48Address originator, Time duration, WifiTxVector blockAckReqTxVector, double rxSnr)
Invoked after an A-MPDU has been received.
std::map< AgreementKey, BlockAckCache >::iterator BlockAckCachesI
block ack caches iterator typedef
virtual bool IsCfPeriod(void) const
This function indicates whether Simulator::Now is in the CF period.
static TypeId GetTypeId(void)
Register this type.
bool StoreMpduIfNeeded(Ptr< WifiMacQueueItem > mpdu)
Ptr< WifiRemoteStationManager > m_stationManager
Pointer to WifiRemoteStationManager (rate control)
void SetMac(const Ptr< WifiMac > mac)
Set up WifiMac associated with this MacLow.
void SendDataAfterCts(Time duration)
Send Data after receiving CTS.
void RegisterEdcaForAc(AcIndex ac, Ptr< QosTxop > edca)
Agreements m_bAckAgreements
block ack agreements
void RegisterChannelAccessManager(Ptr< ChannelAccessManager > channelAccessManager)
virtual WifiTxVector GetDataTxVector(Ptr< const WifiMacQueueItem > item) const
Return a TXVECTOR for the Data frame given the destination.
A struct that holds information about Ack piggybacking (CF-Ack).
void NotifySwitchingStartNow(Time duration)
Time GetCfpMaxDuration(void) const
WifiTxVector GetAckTxVector(Mac48Address to, WifiMode dataTxMode) const
Return a TXVECTOR for the Ack frame given the destination and the mode of the Data used by the sender...
void RxStartIndication(WifiTxVector txVector, Time psduDuration)
bool m_promisc
Flag if the device is operating in promiscuous mode.
void CancelAllEvents(void)
Cancel all scheduled events.
WifiTxVector GetCtsTxVector(Mac48Address to, WifiMode rtsTxMode) const
Return a TXVECTOR for the CTS frame given the destination and the mode of the RTS used by the sender...
void BlockAckTimeout(void)
Event handler when BlockAck timeout occurs.
void NotifyCtsTimeoutStartNow(Time duration)
Notify ChannelAccessManager that CTS timer should be started for the given duration.
std::map< AgreementKey, BlockAckCache > BlockAckCaches
block ack caches typedef
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetRemainingCfpDuration(void) const
void SetBssid(Mac48Address ad)
Set the Basic Service Set Identification.
EventId m_waitIfsEvent
Wait for IFS event.
EventId m_normalAckTimeoutEvent
Normal Ack timeout event.
void StartDataTxTimers(WifiTxVector dataTxVector)
Start a Data timer by scheduling appropriate Ack timeout.
Time m_beaconInterval
Expected interval between two beacon transmissions.
Time m_cfpForeshortening
The delay the current CF period should be foreshortened.
std::pair< BlockAckAgreement, std::list< Ptr< WifiMacQueueItem > > > AgreementValue
agreement value typedef
void SendBlockAckResponse(const CtrlBAckResponseHeader *blockAck, Mac48Address originator, bool immediate, Time duration, WifiMode blockAckReqTxMode, double rxSnr)
This method creates BlockAck frame with header equals to blockAck and start its transmission.
Time GetAckDuration(WifiTxVector ackTxVector) const
Return the time required to transmit the Ack (including preamble and FCS).
EventId m_ctsTimeoutEvent
CTS timeout event.
void RxCompleteBufferedPacketsWithSmallerSequence(uint16_t seq, Mac48Address originator, uint8_t tid)
void SendCtsAfterRts(Mac48Address source, Time duration, WifiTxVector rtsTxVector, double rtsSnr)
Send CTS after receiving RTS.
Ptr< MsduAggregator > GetMsduAggregator(void) const
Returns the aggregator used to construct A-MSDU subframes.
Time GetBlockAckRequestDuration(WifiTxVector blockAckReqTxVector, BlockAckType type) const
Return the time required to transmit the BlockAckRequest to the specified address given the TXVECTOR ...
bool GetCtsToSelfSupported(void) const
Return whether CTS-to-self capability is supported.
void SetBeaconInterval(Time interval)
Time m_lastNavStart
The time when the latest NAV started.
std::map< AgreementKey, AgreementValue > Agreements
agreements
handle RTS/CTS/Data/Ack transactions.
Mac48Address address
Address of the station to be acknowledged.
EventId m_sendDataEvent
Event to send Data.
MacLowTransmissionParameters m_txParams
Transmission parameters of the current packet.
void DoDispose(void)
Destructor implementation.
void SetMsduAggregator(const Ptr< MsduAggregator > aggr)
Set the aggregator used to construct A-MSDU subframes.
WifiTxVector GetAckTxVectorForData(Mac48Address to, WifiMode dataTxMode) const
Return a TXVECTOR for the BlockAck frame given the destination and the mode of the Data used by the s...
std::map< AcIndex, Ptr< QosTxop > > QueueEdcas
EDCA queues typedef.
void ReceiveOk(Ptr< WifiMacQueueItem > mpdu, double rxSnr, WifiTxVector txVector, bool ampduSubframe)
Mac48Address m_self
Address of this MacLow (Mac48Address)
Maintains information for a block ack agreement.
WifiTxVector GetBlockAckTxVector(Mac48Address to, WifiMode dataTxMode) const
Return a TXVECTOR for the BlockAck frame given the destination and the mode of the Data used by the s...
An identifier for simulation events.
void NotifyAckTimeoutStartNow(Time duration)
Notify ChannelAccessManager that Ack timer should be started for the given duration.
bool CanTransmitNextCfFrame(void) const
This function decides if a CF frame can be transmitted in the current CFP.
Time m_cfpStart
The time when the latest CF period started.
std::map< AgreementKey, AgreementValue >::iterator AgreementsI
agreements iterator
EventId m_endTxNoAckEvent
Event for finishing transmission that does not require Ack.
Time GetBlockAckDuration(WifiTxVector blockAckReqTxVector, BlockAckType type) const
Return the time required to transmit the BlockAck to the specified address given the TXVECTOR of the ...
CfAckInfo m_cfAckInfo
Info about piggyback Acks used in PCF.
void SetMpduAggregator(const Ptr< MpduAggregator > aggr)
Set the aggregator used to construct A-MPDU subframes.
void SendDataPacket(void)
Send Data packet, which can be Data-Ack or RTS-CTS-Data-Ack transaction.
Time GetPifs(void) const
Return PCF Interframe Space (PIFS) of this MacLow.
void SetAddress(Mac48Address ad)
Set MAC address of this MacLow.
uint32_t GetCfEndSize(void) const
Return the total CF-END size (including FCS trailer).
void ForwardDown(Ptr< const WifiPsdu > psdu, WifiTxVector txVector)
Forward a PSDU down to WifiPhy for transmission.
A base class which provides memory management and object aggregation.
void WaitIfsAfterEndTxFragment(void)
Event handler that is usually scheduled to fired at the appropriate time after completing transmissio...
void SetRxCallback(Callback< void, Ptr< WifiMacQueueItem >> callback)
Time GetBeaconInterval(void) const
void CfPollTimeout(void)
Event handler when CF-Poll timeout occurs.
void NotifyCtsTimeoutResetNow(void)
Notify ChannelAccessManager that CTS timer should be reset.
Ptr< WifiPsdu > m_currentPacket
Current packet transmitted/to be transmitted.
void ResetPhy(void)
Remove WifiPhy associated with this MacLow.
Time GetSlotTime(void) const
Return slot duration of this MacLow.
WifiTxVector GetCtsTxVectorForRts(Mac48Address to, WifiMode rtsTxMode) const
Return a TXVECTOR for the CTS frame given the destination and the mode of the RTS used by the sender...
a unique identifier for an interface.
std::vector< Ptr< ChannelAccessManager > > ChannelAccessManagers
typedef for a list of ChannelAccessManager.
bool NeedCtsToSelf(void) const
Check if CTS-to-self mechanism should be used for the current packet.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Ptr< MpduAggregator > m_mpduAggregator
A-MPDU aggregator.
Ptr< WifiPhy > m_phy
Pointer to WifiPhy (actually send/receives frames)
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this MacLow.
Ptr< WifiPhy > GetPhy(void) const
class PhyMacLowListener * m_phyMacLowListener
Listener needed to monitor when a channel switching occurs.
ChannelAccessManagers m_channelAccessManagers
List of ChannelAccessManager.
void SendRtsForPacket(void)
Send RTS to begin RTS-CTS-Data-Ack transaction.
BlockAckType
The different block ack policies.
void RxCompleteBufferedPacketsUntilFirstLost(Mac48Address originator, uint8_t tid)