37 #include "ns3/mac48-address.h"
38 #include "ns3/callback.h"
39 #include "ns3/event-id.h"
40 #include "ns3/packet.h"
41 #include "ns3/nstime.h"
132 virtual void Cancel (
void) = 0;
490 friend class ::TwoLevelAggregationTest;
761 uint16_t startingSeq);
1185 bool IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize);
1357 typedef std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>
QueueListeners;
bool MustSendRts(void) const
Time GetPifs(void) const
Return PCF Interframe Space (PIFS) of this MacLow.
uint32_t GetAckSize(void) const
Return the total ACK size (including FCS trailer).
virtual ~MacLowDcfListener()
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.
Smart pointer class similar to boost::intrusive_ptr.
Ptr< WifiPhy > GetPhy(void) const
void ResetBlockAckInactivityTimerIfNeeded(BlockAckAgreement &agreement)
Every time that a block ack request or a packet with ack policy equals to block ack are received...
enum ns3::MacLowTransmissionParameters::@89 m_waitAck
virtual void CtsTimeoutReset()=0
Notify that CTS timeout has resetted.
EventId m_blockAckTimeoutEvent
Block ACK timeout event.
Time GetBlockAckDuration(Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const
Return the time required to transmit the Block ACK to the specified address given the TXVECTOR of the...
virtual Ptr< WifiMacQueue > GetQueue(void)=0
Returns the EDCA queue to check if there are packets that can be aggregated with a Block Ack...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
virtual ~MacLowTransmissionListener()
Time GetAckDuration(WifiTxVector ackTxVector) const
Return the time required to transmit the ACK (including preamble and FCS).
virtual void GotAck(double snr, WifiMode txMode)=0
virtual Ptr< const Packet > PeekNextPacketInBaQueue(WifiMacHeader &header, Mac48Address recipient, uint8_t tid, Time *timestamp)
void SetPromisc(void)
Enable promiscuous mode.
EventId m_waitSifsEvent
Wait for SIFS event.
void DoNavResetNow(Time duration)
Reset NAV with the given duration.
virtual Mac48Address GetDestAddressForAggregation(const WifiMacHeader &hdr)
bool IsPromisc(void) const
Check if MacLow is operating in promiscuous mode.
bool m_receivedAtLeastOneMpdu
Flag whether an MPDU has already been successfully received while receiving an A-MPDU.
virtual bool GetBlockAckAgreementExists(Mac48Address address, uint8_t tid)=0
void EnableBasicBlockAck(void)
Wait BASICBLOCKACKTimeout for a Basic Block Ack Response frame.
EventId m_fastAckTimeoutEvent
Fast ACK timeout event.
Time m_pifs
PCF Interframe Space (PIFS) duration.
void FastAckFailedTimeout(void)
Event handler when fast ACK timeout occurs (busy).
bool DoNavStartNow(Time duration)
Start NAV with the given duration.
Mac48Address GetBssid(void) const
Return the Basic Service Set Identification.
void SetSifs(Time sifs)
Set Short Interframe Space (SIFS) of this MacLow.
virtual void MissedAck(void)=0
ns3::MacLow did not receive an expected ACK within AckTimeout.
std::pair< Mac48Address, uint8_t > AgreementKey
WifiTxVector GetCtsToSelfTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the CTS-to-self frame.
void RegisterBlockAckListenerForAc(enum AcIndex ac, MacLowAggregationCapableTransmissionListener *listener)
void SetupPhyMacLowListener(Ptr< WifiPhy > phy)
Set up WifiPhy listener for this MacLow.
friend std::ostream & operator<<(std::ostream &os, const MacLowTransmissionParameters ¶ms)
Serialize MacLowTransmissionParameters to ostream in a human-readable form.
void NotifySleepNow(void)
This method is typically invoked by the PhyMacLowListener to notify the MAC layer that the device has...
uint8_t GetTid(Ptr< const Packet > packet, const WifiMacHeader hdr) const
bool HasDurationId(void) const
virtual ~MacLowAggregationCapableTransmissionListener()
DcfListeners m_dcfListeners
List of MacLowDcfListener (pass events to Dcf)
uint8_t m_sentMpdus
Number of transmitted MPDUs in an A-MPDU that have not been acknowledged yet.
bool m_ampdu
Flag if the current transmission involves an A-MPDU.
virtual void CtsTimeoutStart(Time duration)=0
Notify that CTS timeout has started for a given duration.
void SetRxCallback(Callback< void, Ptr< Packet >, const WifiMacHeader * > callback)
void DeaggregateAmpduAndReceive(Ptr< Packet > aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble)
Time GetCompressedBlockAckTimeout() const
Return Compressed Block ACK timeout of this MacLow.
Mac48Address m_bssid
BSSID address (Mac48Address)
virtual void BlockAckInactivityTimeout(Mac48Address originator, uint8_t tid)=0
Typically is called in order to notify EdcaTxopN that a block ack inactivity timeout occurs for the b...
BlockAckType
Enumeration for different block ACK policies.
Ptr< Packet > AggregateToAmpdu(Ptr< const Packet > packet, const WifiMacHeader hdr)
EventId m_sendCtsEvent
Event to send CTS.
MacLowRxCallback m_rxCallback
Callback to pass packet up.
Time GetCtsTimeout(void) const
Return CTS timeout of this MacLow.
EventId m_superFastAckTimeoutEvent
Super fast ACK timeout event.
EventId m_sendAckEvent
Event to send ACK.
listen to events coming from ns3::MacLow.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Time GetCtsDuration(WifiTxVector ctsTxVector) const
Return the time required to transmit the CTS (including preamble and FCS).
bool MustWaitFastAck(void) const
Ptr< Packet > PerformMsduAggregation(Ptr< const Packet > packet, WifiMacHeader *hdr, Time *tstamp, Ptr< Packet > currentAmpduPacket, uint16_t blockAckSize)
Perform MSDU aggregation for a given MPDU in an A-MPDU.
control how a packet is transmitted.
MacLowTransmissionParameters()
void WaitSifsAfterEndTx(void)
Event handler that is usually scheduled to fired at the appropriate time after completing transmissio...
MacLowTransmissionListener()
std::vector< MacLowDcfListener * >::const_iterator DcfListenersCI
typedef for an iterator for a list of MacLowDcfListener.
virtual void CompleteTransfer(Mac48Address address, uint8_t tid)
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self capability.
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
void InsertInTxQueue(Ptr< const Packet > packet, const WifiMacHeader &hdr, Time tStamp)
Insert in a temporary queue.
virtual uint32_t GetNRetryNeededPackets(Mac48Address recipient, uint8_t tid) const
void RemovePhyMacLowListener(Ptr< WifiPhy > phy)
Remove current WifiPhy listener for this MacLow.
std::map< AcIndex, MacLowAggregationCapableTransmissionListener * > QueueListeners
virtual void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address source, WifiMode txMode)
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
virtual void RemoveFromBaQueue(uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
Remove a packet after you peek in the retransmit queue and get it.
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.
listen for block ack events.
std::pair< Ptr< Packet >, WifiMacHeader > BufferedPacket
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.
virtual Mac48Address GetSrcAddressForAggregation(const WifiMacHeader &hdr)
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
Ptr< WifiMacQueue > m_aggregateQueue
Queue used for MPDU aggregation.
void NotifyNav(Ptr< const Packet > packet, const WifiMacHeader &hdr, WifiPreamble preamble)
uint32_t GetBlockAckSize(enum BlockAckType type) const
Return the total Block ACK size (including FCS trailer).
void CtsTimeout(void)
Event handler when CTS timeout occurs.
void EnableSuperFastAck(void)
virtual void StartNext(void)=0
Invoked when ns3::MacLow wants to start a new transmission as configured by MacLowTransmissionParamet...
void EndTxNoAck(void)
A transmission that does not require an ACK has completed.
std::map< AgreementKey, BlockAckCache >::iterator BlockAckCachesI
std::vector< MacLowDcfListener * > DcfListeners
typedef for a list of MacLowDcfListener.
virtual void EndTxNoAck(void)=0
Invoked upon the end of the transmission of a frame that does not require an ACK (e.g., broadcast and multicast frames).
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 SetAckTimeout(Time ackTimeout)
Set ACK timeout of this MacLow.
virtual uint32_t GetNOutstandingPackets(Mac48Address recipient, uint8_t tid)
virtual void GotCts(double snr, WifiMode txMode)=0
void SendDataAfterCts(Mac48Address source, Time duration)
Send DATA after receiving CTS.
void SendBlockAckResponse(const CtrlBAckResponseHeader *blockAck, Mac48Address originator, bool immediate, Time duration, WifiMode blockAckReqTxMode)
This method creates block ack frame with header equals to blockAck and start its transmission.
Time GetRifs(void) const
Return Reduced Interframe Space (RIFS) of this MacLow.
void NavCounterResetCtsMissed(Time rtsEndRxTime)
Reset NAV after CTS was missed when the NAV was setted with RTS.
Ptr< WifiRemoteStationManager > m_stationManager
Pointer to WifiRemoteStationManager (rate control)
bool MustWaitMultiTidBlockAck(void) const
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
uint32_t GetNextPacketSize(void) const
Agreements m_bAckAgreements
bool HasNextPacket(void) const
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 ...
void SendBlockAckAfterAmpdu(uint8_t tid, Mac48Address originator, Time duration, WifiTxVector blockAckReqTxVector)
Invoked after an A-MPDU has been received.
virtual uint16_t GetNextSequenceNumberfor(WifiMacHeader *hdr)
Return the next sequence number for the given header.
void RegisterDcfListener(MacLowDcfListener *listener)
void NotifySwitchingStartNow(Time duration)
Time m_slotTime
Slot duration.
bool m_promisc
Flag if the device is operating in promiscuous mode.
void CancelAllEvents(void)
Cancel all scheduled events.
virtual void StartTransmission(Ptr< const Packet > packet, const WifiMacHeader *hdr, MacLowTransmissionParameters parameters, MacLowTransmissionListener *listener)
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
std::list< BufferedPacket >::iterator BufferedPacketI
void BlockAckTimeout(void)
Event handler when block ACK timeout occurs.
void NotifyCtsTimeoutStartNow(Time duration)
Notify DcfManager (via DcfListener) that CTS timer should be started for the given duration...
virtual void SetAmpdu(bool ampdu)
Time m_overrideDurationId
void SendBlockAckAfterBlockAckRequest(const CtrlBAckRequestHeader reqHdr, Mac48Address originator, Time duration, WifiMode blockAckReqTxMode)
Invoked after that a block ack request has been received.
std::map< AgreementKey, BlockAckCache > BlockAckCaches
virtual void NavStart(Time duration)=0
Norify that NAV has started for the given duration.
void EnableCompressedBlockAck(void)
Wait COMPRESSEDBLOCKACKTimeout for a Compressed Block Ack Response frame.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SuperFastAckTimeout(void)
Event handler when super fast ACK timeout occurs.
void SetBssid(Mac48Address ad)
Set the Basic Service Set Identification.
uint32_t GetRtsSize(void) const
Return the total RTS size (including FCS trailer).
void EnableAck(void)
Wait ACKTimeout for an ACK.
Time CalculateTransmissionTime(Ptr< const Packet > packet, const WifiMacHeader *hdr, const MacLowTransmissionParameters ¶meters) const
EventId m_normalAckTimeoutEvent
Normal ACK timeout event.
void StartDataTxTimers(WifiTxVector dataTxVector)
Start a DATA timer by scheduling appropriate ACK timeout.
void NotifyCtsTimeoutResetNow()
Notify DcfManager (via DcfListener) that CTS timer should be resetted.
bool MustWaitBasicBlockAck(void) const
bool MustWaitCompressedBlockAck(void) const
bool NeedCtsToSelf(void)
Check if CTS-to-self mechanism should be used for the current packet.
Ptr< const Packet > packet
virtual void Cancel(void)=0
Invoked if this transmission was canceled one way or another.
Callback< void, Ptr< Packet >, const WifiMacHeader * > MacLowRxCallback
typedef for a callback for MacLowRx
Time m_ackTimeout
ACK timeout duration.
bool IsInWindow(uint16_t seq, uint16_t winstart, uint16_t winsize)
virtual void AckTimeoutStart(Time duration)=0
Notify that ACK timeout has started for a given duration.
listen to NAV eventsThis class is typically connected to an instance of ns3::Dcf and calls to its met...
void FastAckTimeout(void)
Event handler when fast ACK timeout occurs (idle).
void DisableRts(void)
Do not send rts and wait for cts before sending data.
void EnableMultiTidBlockAck(void)
NOT IMPLEMENTED FOR NOW.
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.
void SetPhy(Ptr< WifiPhy > phy)
Set up WifiPhy associated with this MacLow.
Time m_basicBlockAckTimeout
Basic block ACK timeout duration.
Time GetDurationId(void) const
virtual void MissedBlockAck(void)
ns3::MacLow did not receive an expected BLOCK_ACK within BlockAckTimeout.
virtual void CompleteMpduTx(Ptr< const Packet > packet, WifiMacHeader hdr, Time tstamp)
This function stores an MPDU (part of an A-MPDU) in blockackagreement (i.e.
Time m_sifs
Short Interframe Space (SIFS) duration.
void ReceiveError(Ptr< const Packet > packet, double rxSnr)
Time GetSlotTime(void) const
Return slot duration of this MacLow.
Time m_lastNavStart
The time when the latest NAV started.
WifiTxVector GetRtsTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the RTS frame given the destination.
std::map< AgreementKey, AgreementValue > Agreements
virtual WifiTxVector GetDataTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the DATA frame given the destination.
handle RTS/CTS/DATA/ACK transactions.
virtual void MissedCts(void)=0
ns3::MacLow did not receive an expected CTS within CtsTimeout.
std::vector< Item > m_txPackets
Contain temporary items to be sent with the next A-MPDU transmission, once RTS/CTS exchange has succe...
EventId m_sendDataEvent
Event to send DATA.
bool ReceiveMpdu(Ptr< Packet > packet, WifiMacHeader hdr)
This method updates the reorder buffer and the scoreboard when an MPDU is received in an HT station a...
MacLowTransmissionParameters m_txParams
Transmission parameters of the current packet.
void SetRifs(Time rifs)
Set Reduced Interframe Space (RIFS) of this MacLow.
virtual void DoDispose(void)
Destructor implementation.
void NotifyAckTimeoutResetNow()
Notify DcfManager (via DcfListener) that ACK timer should be resetted.
bool MustWaitSuperFastAck(void) const
Time CalculateOverallTxTime(Ptr< const Packet > packet, const WifiMacHeader *hdr, const MacLowTransmissionParameters ¶ms) const
QueueListeners m_edcaListeners
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 ...
Mac48Address m_self
Address of this MacLow (Mac48Address)
Maintains information for a block ack agreement.
An identifier for simulation events.
EventId m_fastAckFailedTimeoutEvent
Fast ACK failed timeout event.
bool IsNavZero(void) const
Check if NAV is zero.
void EnableRts(void)
Send a RTS, and wait CTSTimeout for a CTS.
void NotifyAckTimeoutStartNow(Time duration)
Notify DcfManager (via DcfListener) that ACK timer should be started for the given duration...
virtual void NavReset(Time duration)=0
Notify that NAV has resetted.
void SetSlotTime(Time slotTime)
Set slot duration of this MacLow.
Ptr< Packet > m_currentPacket
Current packet transmitted/to be transmitted.
Time GetSifs(void) const
Return Short Interframe Space (SIFS) of this MacLow.
bool StopMpduAggregation(Ptr< const Packet > peekedPacket, WifiMacHeader peekedHdr, Ptr< Packet > aggregatedPacket, uint16_t size) const
std::map< AgreementKey, AgreementValue >::iterator AgreementsI
EventId m_endTxNoAckEvent
Event for finishing transmission that does not require ACK.
void SendPacket(Ptr< const Packet > packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
Forward the packet down to WifiPhy for transmission.
void EnableOverrideDurationId(Time durationId)
bool GetCtsToSelfSupported() const
Return whether CTS-to-self capability is supported.
void ReceiveOk(Ptr< Packet > packet, double rxSnr, WifiTxVector txVector, WifiPreamble preamble, bool ampduSubframe)
void SetCtsTimeout(Time ctsTimeout)
Set CTS timeout of this MacLow.
void EnableNextData(uint32_t size)
MacLowAggregationCapableTransmissionListener()
void DisableOverrideDurationId(void)
Do not force the duration/id field of the packet: its value is automatically calculated by the MacLow...
Time GetAckTimeout(void) const
Return ACK timeout of this MacLow.
virtual Ptr< MsduAggregator > GetMsduAggregator(void) const
virtual uint16_t PeekNextSequenceNumberfor(WifiMacHeader *hdr)
Return the next sequence number for the Traffic ID and destination, but do not pick it (i...
EventId m_waitRifsEvent
Wait for RIFS event.
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
void SendDataPacket(void)
Send DATA packet, which can be DATA-ACK or RTS-CTS-DATA-ACK transaction.
uint32_t GetCtsSize(void) const
Return the total CTS size (including FCS trailer).
WifiMacHeader m_currentHdr
Header of the current packet.
void SetAddress(Mac48Address ad)
Set MAC address of this MacLow.
A base class which provides memory management and object aggregation.
void ForwardDown(Ptr< const Packet > packet, const WifiMacHeader *hdr, WifiTxVector txVector, WifiPreamble preamble)
Forward the packet down to WifiPhy for transmission.
Time m_compressedBlockAckTimeout
Compressed block ACK timeout duration.
bool MustWaitAck(void) const
bool IsAmpdu(Ptr< const Packet > packet, const WifiMacHeader hdr)
Checks if the given packet will be aggregated to an A-MPDU or not.
void FlushAggregateQueue(void)
This function is called to flush the aggregate queue, which is used for A-MPDU.
virtual void AckTimeoutReset()=0
Notify that ACK timeout has resetted.
void ResetPhy(void)
Remove WifiPhy associated with this MacLow.
void DisableAck(void)
Do not wait for Ack after data transmission.
std::pair< BlockAckAgreement, std::list< BufferedPacket > > AgreementValue
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...
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 ...
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...
bool StoreMpduIfNeeded(Ptr< Packet > packet, WifiMacHeader hdr)
This method checks if exists a valid established block ack agreement.
bool MustWaitNormalAck(void) const
Ptr< MpduAggregator > m_mpduAggregator
A struct for packet, Wifi header, and timestamp.
Ptr< WifiPhy > m_phy
Pointer to WifiPhy (actually send/receives frames)
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
Set Compressed Block ACK timeout of this MacLow.
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this MacLow.
class PhyMacLowListener * m_phyMacLowListener
Listener needed to monitor when a channel switching occurs.
void SetMpduAggregator(Ptr< MpduAggregator > aggregator)
Set up MpduAggregator associated with this MacLow.
uint32_t GetSize(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return the total size of the packet after WifiMacHeader and FCS trailer have been added...
MacLowTransmissionListener * m_listener
Transmission listener for the current packet.
void SendRtsForPacket(void)
Send RTS to begin RTS-CTS-DATA-ACK transaction.
void RxCompleteBufferedPacketsUntilFirstLost(Mac48Address originator, uint8_t tid)