27 #include "ns3/object.h" 28 #include "ns3/nstime.h" 46 class WifiMacQueueItem;
48 class BlockAckAgreement;
49 class MgtAddBaResponseHeader;
50 class WifiRemoteStationManager;
51 class CtrlBAckRequestHeader;
52 class CtrlBAckResponseHeader;
62 friend class ::TwoLevelAggregationTest;
64 friend class ::AmpduAggregationTest;
301 uint32_t fragmentSize = 0)
const;
372 uint16_t startingSeq);
784 Time duration,
WifiMode blockAckReqTxMode,
double rxSnr);
808 Time duration,
WifiMode blockAckReqTxMode,
double rxSnr);
946 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...
Time GetRifs(void) const
Return Reduced Interframe Space (RIFS) of this MacLow.
void SetPifs(Time pifs)
Set PCF Interframe Space (PIFS) of this MacLow.
Time m_ctsTimeout
CTS timeout duration.
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 block ack request or a packet with ack policy equals to block ack are received...
EventId m_blockAckTimeoutEvent
Block ACK 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...
std::vector< Item > m_txPackets[8]
Contain temporary items to be sent with the next A-MPDU transmission for a given TID, once RTS/CTS exchange has succeeded.
void SendBlockAckAfterBlockAckRequest(const CtrlBAckRequestHeader reqHdr, Mac48Address originator, Time duration, WifiMode blockAckReqTxMode, double rxSnr)
Invoked after that a block ack request has been received.
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.
Time m_pifs
PCF Interframe Space (PIFS) duration.
void SetPhy(const Ptr< WifiPhy > phy)
Set up WifiPhy associated with this MacLow.
bool StopMpduAggregation(Ptr< const Packet > peekedPacket, WifiMacHeader peekedHdr, Ptr< Packet > aggregatedPacket, uint8_t blockAckSize) const
bool DoNavStartNow(Time duration)
Start NAV with the given duration.
void SetSifs(Time sifs)
Set Short Interframe Space (SIFS) of this MacLow.
void ForwardDown(Ptr< const Packet > packet, const WifiMacHeader *hdr, WifiTxVector txVector)
Forward the packet down to WifiPhy for transmission.
std::pair< Mac48Address, uint8_t > AgreementKey
agreement key typedef
WifiTxVector GetRtsTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the RTS frame given the destination.
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.
virtual WifiTxVector GetDataTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the DATA frame given the destination.
bool m_ampdu
Flag if the current transmission involves an A-MPDU.
Mac48Address m_bssid
BSSID address (Mac48Address)
Ptr< Packet > AggregateToAmpdu(Ptr< const Packet > packet, const WifiMacHeader hdr)
EventId m_sendCtsEvent
Event to send CTS.
virtual void StartTransmission(Ptr< const Packet > packet, const WifiMacHeader *hdr, MacLowTransmissionParameters parameters, Ptr< Txop > txop)
MacLowRxCallback m_rxCallback
Callback to pass packet up.
bool NeedRts(void) const
Check if the current packet should be sent with a RTS protection.
void DeaggregateAmpduAndReceive(Ptr< Packet > aggregatedPacket, double rxSnr, WifiTxVector txVector)
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...
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.
MpduType
The type of an MPDU.
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.
void SetBasicBlockAckTimeout(Time blockAckTimeout)
Set Basic Block ACK timeout of this MacLow.
BlockAckCaches m_bAckCaches
block ack caches
Time timestamp
the timestamp
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).
std::pair< Ptr< Packet >, WifiMacHeader > BufferedPacket
buffered packet typedef
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.
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.
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 it is the CF period.
void SetAckTimeout(Time ackTimeout)
Set ACK timeout of this MacLow.
static TypeId GetTypeId(void)
Register this type.
Time GetCtsTimeout(void) const
Return CTS timeout of this MacLow.
void NavCounterResetCtsMissed(Time rtsEndRxTime)
Reset NAV after CTS was missed when the NAV was set with RTS.
Ptr< WifiRemoteStationManager > m_stationManager
Pointer to WifiRemoteStationManager (rate control)
void SendDataAfterCts(Time duration)
Send DATA after receiving CTS.
void RegisterEdcaForAc(AcIndex ac, Ptr< QosTxop > edca)
Agreements m_bAckAgreements
block ack agreements
Ptr< WifiMacQueue > m_aggregateQueue[8]
Queues per TID used for MPDU aggregation.
void SendMpdu(Ptr< const Packet > packet, WifiTxVector txVector, MpduType mpdutype)
Forward the MPDU down to WifiPhy for transmission.
A struct that holds information about ACK piggybacking (CF-ACK).
void NotifySwitchingStartNow(Time duration)
Time GetCfpMaxDuration(void) const
Time m_slotTime
Slot duration.
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...
bool m_promisc
Flag if the device is operating in promiscuous mode.
WifiMacHeader hdr
the header
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...
std::list< BufferedPacket >::iterator BufferedPacketI
buffered packet iterator typedef
void BlockAckTimeout(void)
Event handler when block ACK 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
Time GetAckTimeout(void) const
Return ACK timeout of this MacLow.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetRemainingCfpDuration(void) const
Time GetCompressedBlockAckTimeout() const
Return Compressed Block ACK timeout of this MacLow.
void RegisterDcf(Ptr< ChannelAccessManager > dcf)
void SetBssid(Mac48Address ad)
Set the Basic Service Set Identification.
EventId m_waitIfsEvent
Wait for IFS event.
void ReceiveOk(Ptr< Packet > packet, double rxSnr, WifiTxVector txVector, bool ampduSubframe)
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.
void NotifyCtsTimeoutResetNow()
Notify ChannelAccessManager that CTS timer should be reset.
Ptr< const Packet > packet
the packet
Time m_cfpForeshortening
The delay the current CF period should be foreshortened.
Callback< void, Ptr< Packet >, const WifiMacHeader * > MacLowRxCallback
typedef for a callback for MacLowRx
void SendBlockAckResponse(const CtrlBAckResponseHeader *blockAck, Mac48Address originator, bool immediate, Time duration, WifiMode blockAckReqTxMode, double rxSnr)
This method creates block ack 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).
Time m_ackTimeout
ACK timeout duration.
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.
Time m_basicBlockAckTimeout
Basic block ACK timeout duration.
bool GetCtsToSelfSupported() const
Return whether CTS-to-self capability is supported.
void FlushAggregateQueue(uint8_t tid)
This function is called to flush the aggregate queue, which is used for A-MPDU.
Two Level Aggregation Test.
Time m_sifs
Short Interframe Space (SIFS) duration.
void SetBeaconInterval(Time interval)
Time m_lastNavStart
The time when the latest NAV started.
void ReceiveError(Ptr< Packet > packet, double rxSnr)
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.
bool ReceiveMpdu(Ptr< Packet > packet, WifiMacHeader hdr)
MacLowTransmissionParameters m_txParams
Transmission parameters of the current packet.
void SetRifs(Time rifs)
Set Reduced Interframe Space (RIFS) of this MacLow.
void DoDispose(void)
Destructor implementation.
void NotifyAckTimeoutResetNow()
Notify ChannelAccessManager that ACK timer should be reset.
WifiTxVector GetAckTxVectorForData(Mac48Address to, WifiMode dataTxMode) const
Return a TXVECTOR for the Block ACK frame given the destination and the mode of the DATA used by the ...
std::map< AcIndex, Ptr< QosTxop > > QueueEdcas
EDCA queues typedef.
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 Block ACK frame given the destination and the mode of the DATA used by the ...
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.
void SetSlotTime(Time slotTime)
Set slot duration of this MacLow.
Ptr< Packet > m_currentPacket
Current packet transmitted/to be transmitted.
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 Block ACK to the specified address given the TXVECTOR of the...
CfAckInfo m_cfAckInfo
Info about piggyback ACKs used in PCF.
void SetCtsTimeout(Time ctsTimeout)
Set CTS timeout of this MacLow.
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.
WifiMacHeader m_currentHdr
Header of the current transmitted packet.
void SetAddress(Mac48Address ad)
Set MAC address of this MacLow.
uint32_t GetCfEndSize(void) const
Return the total CF-END size (including FCS trailer).
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...
Time GetBeaconInterval(void) const
Ptr< Packet > PerformMsduAggregation(Ptr< const Packet > packet, WifiMacHeader *hdr, Time *tstamp, Ptr< Packet > currentAmpduPacket, uint8_t blockAckSize)
Perform MSDU aggregation for a given MPDU in an A-MPDU.
Time m_compressedBlockAckTimeout
Compressed block ACK timeout duration.
void CfPollTimeout(void)
Event handler when CF-POLL timeout occurs.
bool IsAmpdu(Ptr< const Packet > packet, const WifiMacHeader hdr)
Checks if the given packet will be aggregated to an A-MPDU or not.
void InsertInTxQueue(Ptr< const Packet > packet, const WifiMacHeader &hdr, Time tStamp, uint8_t tid)
Insert in a temporary queue.
void ResetPhy(void)
Remove WifiPhy associated with this MacLow.
std::pair< BlockAckAgreement, std::list< BufferedPacket > > AgreementValue
agreement value typedef
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.
void SetRxCallback(Callback< void, Ptr< Packet >, const WifiMacHeader *> callback)
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.
Time GetBasicBlockAckTimeout() const
Return Basic Block ACK timeout of this MacLow.
Time m_rifs
Reduced Interframe Space (RIFS) duration.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
bool StoreMpduIfNeeded(Ptr< Packet > packet, WifiMacHeader hdr)
A struct for packet, Wifi header, and timestamp.item structure.
Ptr< WifiPhy > m_phy
Pointer to WifiPhy (actually send/receives frames)
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this MacLow.
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
Set Compressed Block ACK timeout of 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)