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"
127 virtual void Cancel (
void) = 0;
662 uint16_t startingSeq);
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.
keep track of time values and allow control of global simulation resolution
EventId m_navCounterResetCtsMissed
Event to reset NAV when CTS is not received.
void ResetBlockAckInactivityTimerIfNeeded(BlockAckAgreement &agreement)
Every time that a block ack request or a packet with ack policy equals to block ack are received...
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
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).
enum ns3::MacLowTransmissionParameters::@87 m_waitAck
virtual void GotAck(double snr, WifiMode txMode)=0
void SetPromisc(void)
Enable promiscuous mode.
EventId m_waitSifsEvent
Wait for SIFS event.
void SendDataAfterCts(Mac48Address source, Time duration, WifiMode txMode)
Send DATA after receiving CTS.
void DoNavResetNow(Time duration)
Reset NAV with the given duration.
bool IsPromisc(void) const
Check if MacLow is operating in promiscuous mode.
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 SetupPhyMacLowListener(Ptr< WifiPhy > phy)
Set up WifiPhy listener for this MacLow.
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...
friend std::ostream & operator<<(std::ostream &os, const MacLowTransmissionParameters ¶ms)
Serialize MacLowTransmissionParameters to ostream in a human-readable form.
bool HasDurationId(void) const
DcfListeners m_dcfListeners
List of MacLowDcfListener (pass events to Dcf)
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)
Time GetCompressedBlockAckTimeout() const
Return Compressed Block ACK timeout of this MacLow.
Mac48Address m_bssid
BSSID address (Mac48Address)
BlockAckType
Enumeration for different block ACK policies.
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
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.
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
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
void DestroyBlockAckAgreement(Mac48Address originator, uint8_t tid)
Time m_lastNavDuration
The duration of the latest NAV.
std::pair< Ptr< Packet >, WifiMacHeader > BufferedPacket
bool m_ctsToSelfSupported
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.
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
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::map< AcIndex, MacLowBlockAckEventListener * > QueueListeners
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 void GotCts(double snr, WifiMode txMode)=0
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 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.
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...
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.
void SuperFastAckTimeout(void)
Event handler when super fast ACK timeout occurs.
void SetBssid(Mac48Address ad)
Set the Basic Service Set Identification.
listen for block ack events.
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.
virtual ~MacLowBlockAckEventListener()
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.
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 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.
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.
EventId m_sendDataEvent
Event to send DATA.
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)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
MacLowBlockAckEventListener()
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.
void SendCtsAfterRts(Mac48Address source, Time duration, WifiMode txMode, double rtsSnr)
Send CTS after receiving RTS.
std::map< AgreementKey, AgreementValue >::iterator AgreementsI
EventId m_endTxNoAckEvent
Event for finishing transmission that does not require ACK.
virtual void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address source)
void EnableOverrideDurationId(Time durationId)
bool GetCtsToSelfSupported() const
Return whether CTS-to-self capability is supported.
void SetCtsTimeout(Time ctsTimeout)
Set CTS timeout of this MacLow.
void EnableNextData(uint32_t size)
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.
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.
void ReceiveOk(Ptr< Packet > packet, double rxSnr, WifiMode txMode, WifiPreamble preamble)
Time m_compressedBlockAckTimeout
Compressed block ACK timeout duration.
bool MustWaitAck(void) const
virtual void AckTimeoutReset()=0
Notify that ACK timeout has resetted.
void RegisterBlockAckListenerForAc(enum AcIndex ac, MacLowBlockAckEventListener *listener)
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.
void NotifyNav(Ptr< const Packet > packet, const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble)
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)
bool MustWaitNormalAck(void) const
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
Listerner needed to monitor when a channel switching occurs.
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)