A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
mac-low.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005, 2006 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Author: Mirko Banchi <mk.banchi@gmail.com>
21  */
22 #ifndef MAC_LOW_H
23 #define MAC_LOW_H
24 
25 #include <vector>
26 #include <stdint.h>
27 #include <ostream>
28 #include <map>
29 
30 #include "wifi-mac-header.h"
31 #include "wifi-mode.h"
32 #include "wifi-preamble.h"
34 #include "ctrl-headers.h"
35 #include "mgt-headers.h"
36 #include "block-ack-agreement.h"
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"
42 #include "qos-utils.h"
43 #include "block-ack-cache.h"
44 #include "wifi-tx-vector.h"
45 
46 namespace ns3 {
47 
48 class WifiPhy;
49 class WifiMac;
50 class EdcaTxopN;
51 
57 {
58 public:
60  virtual ~MacLowTransmissionListener ();
61 
69  virtual void GotCts (double snr, WifiMode txMode) = 0;
74  virtual void MissedCts (void) = 0;
84  virtual void GotAck (double snr, WifiMode txMode) = 0;
89  virtual void MissedAck (void) = 0;
102  virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source);
112  virtual void MissedBlockAck (void);
119  virtual void StartNext (void) = 0;
120 
127  virtual void Cancel (void) = 0;
128 
134  virtual void EndTxNoAck (void) = 0;
135 
136 };
137 
138 
148 {
149 public:
151  virtual ~MacLowDcfListener ();
157  virtual void NavStart (Time duration) = 0;
163  virtual void NavReset (Time duration) = 0;
169  virtual void AckTimeoutStart (Time duration) = 0;
173  virtual void AckTimeoutReset () = 0;
179  virtual void CtsTimeoutStart (Time duration) = 0;
183  virtual void CtsTimeoutReset () = 0;
184 };
185 
191 {
192 public:
194  virtual ~MacLowBlockAckEventListener ();
207  virtual void BlockAckInactivityTimeout (Mac48Address originator, uint8_t tid) = 0;
208 };
209 
219 {
220 public:
222 
228  void EnableAck (void);
242  void EnableFastAck (void);
249  void EnableSuperFastAck (void);
253  void EnableBasicBlockAck (void);
257  void EnableCompressedBlockAck (void);
261  void EnableMultiTidBlockAck (void);
268  void EnableRts (void);
278  void EnableNextData (uint32_t size);
279 
287  void EnableOverrideDurationId (Time durationId);
288 
293  void DisableAck (void);
297  void DisableRts (void);
301  void DisableNextData (void);
307  void DisableOverrideDurationId (void);
308 
316  bool MustWaitAck (void) const;
323  bool MustWaitNormalAck (void) const;
330  bool MustWaitFastAck (void) const;
337  bool MustWaitSuperFastAck (void) const;
343  bool MustWaitBasicBlockAck (void) const;
349  bool MustWaitCompressedBlockAck (void) const;
355  bool MustWaitMultiTidBlockAck (void) const;
360  bool MustSendRts (void) const;
365  bool HasDurationId (void) const;
369  Time GetDurationId (void) const;
373  bool HasNextPacket (void) const;
377  uint32_t GetNextPacketSize (void) const;
378 
379 private:
380 
381  friend std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters &params);
382  uint32_t m_nextSize;
383  enum
384  {
392  } m_waitAck;
393  bool m_sendRts;
395 };
396 
404 std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters &params);
405 
406 
411 class MacLow : public Object
412 {
413 public:
418 
419  MacLow ();
420  virtual ~MacLow ();
421 
427  void SetPhy (Ptr<WifiPhy> phy);
434 
440  void SetAddress (Mac48Address ad);
446  void SetAckTimeout (Time ackTimeout);
452  void SetBasicBlockAckTimeout (Time blockAckTimeout);
458  void SetCompressedBlockAckTimeout (Time blockAckTimeout);
464  void SetCtsToSelfSupported (bool enable);
470  void SetCtsTimeout (Time ctsTimeout);
476  void SetSifs (Time sifs);
482  void SetRifs (Time rifs);
488  void SetSlotTime (Time slotTime);
494  void SetPifs (Time pifs);
500  void SetBssid (Mac48Address ad);
504  void SetPromisc (void);
510  bool GetCtsToSelfSupported () const;
516  Mac48Address GetAddress (void) const;
522  Time GetAckTimeout (void) const;
528  Time GetBasicBlockAckTimeout () const;
540  Time GetCtsTimeout (void) const;
546  Time GetSifs (void) const;
552  Time GetSlotTime (void) const;
558  Time GetPifs (void) const;
564  Time GetRifs (void) const;
570  Mac48Address GetBssid (void) const;
577  bool IsPromisc (void) const;
578 
585  void SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *> callback);
590  void RegisterDcfListener (MacLowDcfListener *listener);
591 
602  const WifiMacHeader* hdr,
603  const MacLowTransmissionParameters& parameters) const;
604 
615  const WifiMacHeader* hdr,
616  MacLowTransmissionParameters parameters,
617  MacLowTransmissionListener *listener);
618 
628  void ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamble preamble);
636  void ReceiveError (Ptr<const Packet> packet, double rxSnr);
644  void NotifySwitchingStartNow (Time duration);
660  void CreateBlockAckAgreement (const MgtAddBaResponseHeader *respHdr,
661  Mac48Address originator,
662  uint16_t startingSeq);
671  void DestroyBlockAckAgreement (Mac48Address originator, uint8_t tid);
680 protected:
690  virtual WifiTxVector GetDataTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
691 private:
696  void CancelAllEvents (void);
702  uint32_t GetAckSize (void) const;
709  uint32_t GetBlockAckSize (enum BlockAckType type) const;
715  uint32_t GetRtsSize (void) const;
721  uint32_t GetCtsSize (void) const;
730  uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
739  void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr,
740  WifiTxVector txVector, WifiPreamble preamble);
750  WifiTxVector GetRtsTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
761  WifiTxVector GetCtsTxVector (Mac48Address to, WifiMode rtsTxMode) const;
772  WifiTxVector GetAckTxVector (Mac48Address to, WifiMode dataTxMode) const;
783  WifiTxVector GetBlockAckTxVector (Mac48Address to, WifiMode dataTxMode) const;
784 
795 
818 
825  Time GetCtsDuration (WifiTxVector ctsTxVector) const;
834  Time GetCtsDuration (Mac48Address to, WifiTxVector rtsTxVector) const;
841  Time GetAckDuration (WifiTxVector ackTxVector) const;
850  Time GetAckDuration (Mac48Address to, WifiTxVector dataTxVector) const;
851  Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const;
852 
859  bool NeedCtsToSelf (void);
860 
862  const WifiMacHeader* hdr,
863  const MacLowTransmissionParameters &params) const;
864  void NotifyNav (Ptr<const Packet> packet,const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble);
870  void DoNavResetNow (Time duration);
877  bool DoNavStartNow (Time duration);
884  bool IsNavZero (void) const;
892  void NotifyAckTimeoutStartNow (Time duration);
897  void NotifyAckTimeoutResetNow ();
905  void NotifyCtsTimeoutStartNow (Time duration);
910  void NotifyCtsTimeoutResetNow ();
911 
918  void NavCounterResetCtsMissed (Time rtsEndRxTime);
919 
920  /* Event handlers */
924  void NormalAckTimeout (void);
928  void FastAckTimeout (void);
932  void SuperFastAckTimeout (void);
936  void FastAckFailedTimeout (void);
940  void BlockAckTimeout (void);
944  void CtsTimeout (void);
948  void SendCtsToSelf (void);
957  void SendCtsAfterRts (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr);
966  void SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMode, double dataSnr);
974  void SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode);
979  void WaitSifsAfterEndTx (void);
983  void EndTxNoAck (void);
984 
988  void SendRtsForPacket (void);
993  void SendDataPacket (void);
1000  void StartDataTxTimers (WifiTxVector dataTxVector);
1001  virtual void DoDispose (void);
1010  void RxCompleteBufferedPacketsWithSmallerSequence (uint16_t seq, Mac48Address originator, uint8_t tid);
1023  void RxCompleteBufferedPacketsUntilFirstLost (Mac48Address originator, uint8_t tid);
1024  /*
1025  * This method checks if exists a valid established block ack agreement.
1026  * If there is, store the packet without pass it up to WifiMac. The packet is buffered
1027  * in order of increasing sequence control field. All comparison are performed
1028  * circularly modulo 2^12.
1029  */
1030  bool StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr);
1041  Time duration, WifiMode blockAckReqTxMode);
1051  void SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Address originator, bool immediate,
1052  Time duration, WifiMode blockAckReqTxMode);
1062 
1069 
1073 
1076  typedef std::vector<MacLowDcfListener *>::const_iterator DcfListenersCI;
1080  typedef std::vector<MacLowDcfListener *> DcfListeners;
1082 
1096 
1111 
1114 
1115  bool m_promisc;
1116 
1118 
1119  /*
1120  * BlockAck data structures.
1121  */
1122  typedef std::pair<Ptr<Packet>, WifiMacHeader> BufferedPacket;
1123  typedef std::list<BufferedPacket>::iterator BufferedPacketI;
1124 
1125  typedef std::pair<Mac48Address, uint8_t> AgreementKey;
1126  typedef std::pair<BlockAckAgreement, std::list<BufferedPacket> > AgreementValue;
1127 
1128  typedef std::map<AgreementKey, AgreementValue> Agreements;
1129  typedef std::map<AgreementKey, AgreementValue>::iterator AgreementsI;
1130 
1131  typedef std::map<AgreementKey, BlockAckCache> BlockAckCaches;
1132  typedef std::map<AgreementKey, BlockAckCache>::iterator BlockAckCachesI;
1133 
1136 
1137  typedef std::map<AcIndex, MacLowBlockAckEventListener*> QueueListeners;
1140 };
1141 
1142 } // namespace ns3
1143 
1144 #endif /* MAC_LOW_H */
bool MustSendRts(void) const
Definition: mac-low.cc:183
Time GetPifs(void) const
Return PCF Interframe Space (PIFS) of this MacLow.
Definition: mac-low.cc:541
uint32_t GetAckSize(void) const
Return the total ACK size (including FCS trailer).
Definition: mac-low.cc:914
virtual ~MacLowDcfListener()
Definition: mac-low.cc:64
void SetPifs(Time pifs)
Set PCF Interframe Space (PIFS) of this MacLow.
Definition: mac-low.cc:481
Time m_ctsTimeout
CTS timeout duration.
Definition: mac-low.h:1106
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
EventId m_navCounterResetCtsMissed
Event to reset NAV when CTS is not received.
Definition: mac-low.h:1094
void ResetBlockAckInactivityTimerIfNeeded(BlockAckAgreement &agreement)
Every time that a block ack request or a packet with ack policy equals to block ack are received...
Definition: mac-low.cc:2053
virtual void CtsTimeoutReset()=0
Notify that CTS timeout has resetted.
EventId m_blockAckTimeoutEvent
Block ACK timeout event.
Definition: mac-low.h:1087
Time GetBlockAckDuration(Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const
Definition: mac-low.cc:965
Callback template class.
Definition: callback.h:920
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
virtual ~MacLowTransmissionListener()
Definition: mac-low.cc:49
Time GetAckDuration(WifiTxVector ackTxVector) const
Return the time required to transmit the ACK (including preamble and FCS).
Definition: mac-low.cc:955
enum ns3::MacLowTransmissionParameters::@87 m_waitAck
virtual void GotAck(double snr, WifiMode txMode)=0
void SetPromisc(void)
Enable promiscuous mode.
Definition: mac-low.cc:496
EventId m_waitSifsEvent
Wait for SIFS event.
Definition: mac-low.h:1092
void SendDataAfterCts(Mac48Address source, Time duration, WifiMode txMode)
Send DATA after receiving CTS.
Definition: mac-low.cc:1652
void DoNavResetNow(Time duration)
Reset NAV with the given duration.
Definition: mac-low.cc:1182
bool IsPromisc(void) const
Check if MacLow is operating in promiscuous mode.
Definition: mac-low.cc:551
void EnableBasicBlockAck(void)
Wait BASICBLOCKACKTimeout for a Basic Block Ack Response frame.
Definition: mac-low.cc:108
EventId m_fastAckTimeoutEvent
Fast ACK timeout event.
Definition: mac-low.h:1084
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: mac-low.h:1109
void FastAckFailedTimeout(void)
Event handler when fast ACK timeout occurs (busy).
Definition: mac-low.cc:1706
bool DoNavStartNow(Time duration)
Start NAV with the given duration.
Definition: mac-low.cc:1192
Mac48Address GetBssid(void) const
Return the Basic Service Set Identification.
Definition: mac-low.cc:546
void SetSifs(Time sifs)
Set Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:471
virtual void MissedAck(void)=0
ns3::MacLow did not receive an expected ACK within AckTimeout.
std::pair< Mac48Address, uint8_t > AgreementKey
Definition: mac-low.h:1125
WifiTxVector GetCtsToSelfTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the CTS-to-self frame.
Definition: mac-low.cc:1014
void SetupPhyMacLowListener(Ptr< WifiPhy > phy)
Set up WifiPhy listener for this MacLow.
Definition: mac-low.cc:317
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 &params)
Serialize MacLowTransmissionParameters to ostream in a human-readable form.
Definition: mac-low.cc:210
bool HasDurationId(void) const
Definition: mac-low.cc:188
DcfListeners m_dcfListeners
List of MacLowDcfListener (pass events to Dcf)
Definition: mac-low.h:1081
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)
Definition: mac-low.cc:557
Time GetCompressedBlockAckTimeout() const
Return Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:516
Mac48Address m_bssid
BSSID address (Mac48Address)
Definition: mac-low.h:1102
BlockAckType
Enumeration for different block ACK policies.
Definition: ctrl-headers.h:30
EventId m_sendCtsEvent
Event to send CTS.
Definition: mac-low.h:1089
MacLowRxCallback m_rxCallback
Callback to pass packet up.
Definition: mac-low.h:1072
Time GetCtsTimeout(void) const
Return CTS timeout of this MacLow.
Definition: mac-low.cc:521
EventId m_superFastAckTimeoutEvent
Super fast ACK timeout event.
Definition: mac-low.h:1085
EventId m_sendAckEvent
Event to send ACK.
Definition: mac-low.h:1090
listen to events coming from ns3::MacLow.
Definition: mac-low.h:56
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:91
Time GetCtsDuration(WifiTxVector ctsTxVector) const
Return the time required to transmit the CTS (including preamble and FCS).
Definition: mac-low.cc:990
bool MustWaitFastAck(void) const
Definition: mac-low.cc:158
control how a packet is transmitted.
Definition: mac-low.h:218
void WaitSifsAfterEndTx(void)
Event handler that is usually scheduled to fired at the appropriate time after completing transmissio...
Definition: mac-low.cc:1692
std::vector< MacLowDcfListener * >::const_iterator DcfListenersCI
typedef for an iterator for a list of MacLowDcfListener.
Definition: mac-low.h:1076
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self capability.
Definition: mac-low.cc:456
void NormalAckTimeout(void)
Event handler when normal ACK timeout occurs.
Definition: mac-low.cc:1270
void SetBasicBlockAckTimeout(Time blockAckTimeout)
Set Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:446
BlockAckCaches m_bAckCaches
Definition: mac-low.h:1135
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:29
void DestroyBlockAckAgreement(Mac48Address originator, uint8_t tid)
Definition: mac-low.cc:1827
Time m_lastNavDuration
The duration of the latest NAV.
Definition: mac-low.h:1113
std::pair< Ptr< Packet >, WifiMacHeader > BufferedPacket
Definition: mac-low.h:1122
bool m_ctsToSelfSupported
Definition: mac-low.h:1139
void SendCtsToSelf(void)
Send CTS for a CTS-to-self mechanism.
Definition: mac-low.cc:1531
void SendAckAfterData(Mac48Address source, Time duration, WifiMode dataTxMode, double dataSnr)
Send ACK after receiving DATA.
Definition: mac-low.cc:1716
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
Definition: mac-low.cc:1785
uint32_t GetBlockAckSize(enum BlockAckType type) const
Return the total Block ACK size (including FCS trailer).
Definition: mac-low.cc:921
Listener for PHY events.
Definition: mac-low.cc:249
void CtsTimeout(void)
Event handler when CTS timeout occurs.
Definition: mac-low.cc:1256
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.
Definition: mac-low.cc:1698
std::map< AgreementKey, BlockAckCache >::iterator BlockAckCachesI
Definition: mac-low.h:1132
std::map< AcIndex, MacLowBlockAckEventListener * > QueueListeners
Definition: mac-low.h:1137
std::vector< MacLowDcfListener * > DcfListeners
typedef for a list of MacLowDcfListener.
Definition: mac-low.h:1080
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...
Definition: mac-low.cc:1040
void SetAckTimeout(Time ackTimeout)
Set ACK timeout of this MacLow.
Definition: mac-low.cc:441
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.
Definition: mac-low.cc:1935
Time GetRifs(void) const
Return Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:531
void NavCounterResetCtsMissed(Time rtsEndRxTime)
Reset NAV after CTS was missed when the NAV was setted with RTS.
Definition: mac-low.cc:1173
Ptr< WifiRemoteStationManager > m_stationManager
Pointer to WifiRemoteStationManager (rate control)
Definition: mac-low.h:1071
bool MustWaitMultiTidBlockAck(void) const
Definition: mac-low.cc:178
Headers for Block ack response.
Definition: ctrl-headers.h:183
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
Definition: mac-low.cc:501
uint32_t GetNextPacketSize(void) const
Definition: mac-low.cc:204
Agreements m_bAckAgreements
Definition: mac-low.h:1134
bool HasNextPacket(void) const
Definition: mac-low.cc:199
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 ...
Definition: mac-low.cc:1056
void RegisterDcfListener(MacLowDcfListener *listener)
Definition: mac-low.cc:562
void NotifySwitchingStartNow(Time duration)
Definition: mac-low.cc:640
Time m_slotTime
Slot duration.
Definition: mac-low.h:1108
bool m_promisc
Flag if the device is operating in promiscuous mode.
Definition: mac-low.h:1115
void CancelAllEvents(void)
Cancel all scheduled events.
Definition: mac-low.cc:350
void StartTransmission(Ptr< const Packet > packet, const WifiMacHeader *hdr, MacLowTransmissionParameters parameters, MacLowTransmissionListener *listener)
Definition: mac-low.cc:569
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:43
std::list< BufferedPacket >::iterator BufferedPacketI
Definition: mac-low.h:1123
void BlockAckTimeout(void)
Event handler when block ACK timeout occurs.
Definition: mac-low.cc:1300
void NotifyCtsTimeoutStartNow(Time duration)
Notify DcfManager (via DcfListener) that CTS timer should be started for the given duration...
Definition: mac-low.cc:1225
void SendBlockAckAfterBlockAckRequest(const CtrlBAckRequestHeader reqHdr, Mac48Address originator, Time duration, WifiMode blockAckReqTxMode)
Invoked after that a block ack request has been received.
Definition: mac-low.cc:2005
std::map< AgreementKey, BlockAckCache > BlockAckCaches
Definition: mac-low.h:1131
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.
Definition: mac-low.cc:113
void SuperFastAckTimeout(void)
Event handler when super fast ACK timeout occurs.
Definition: mac-low.cc:1311
void SetBssid(Mac48Address ad)
Set the Basic Service Set Identification.
Definition: mac-low.cc:491
listen for block ack events.
Definition: mac-low.h:190
uint32_t GetRtsSize(void) const
Return the total RTS size (including FCS trailer).
Definition: mac-low.cc:942
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:128
Time CalculateTransmissionTime(Ptr< const Packet > packet, const WifiMacHeader *hdr, const MacLowTransmissionParameters &parameters) const
Definition: mac-low.cc:1108
EventId m_normalAckTimeoutEvent
Normal ACK timeout event.
Definition: mac-low.h:1083
void StartDataTxTimers(WifiTxVector dataTxVector)
Start a DATA timer by scheduling appropriate ACK timeout.
Definition: mac-low.cc:1387
void NotifyCtsTimeoutResetNow()
Notify DcfManager (via DcfListener) that CTS timer should be resetted.
Definition: mac-low.cc:1233
bool MustWaitBasicBlockAck(void) const
Definition: mac-low.cc:168
bool MustWaitCompressedBlockAck(void) const
Definition: mac-low.cc:173
bool NeedCtsToSelf(void)
Check if CTS-to-self mechanism should be used for the current packet.
Definition: mac-low.cc:620
an EUI-48 address
Definition: mac48-address.h:41
virtual ~MacLowBlockAckEventListener()
Definition: mac-low.cc:71
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
Definition: mac-low.h:417
Time m_ackTimeout
ACK timeout duration.
Definition: mac-low.h:1103
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...
Definition: mac-low.h:147
void FastAckTimeout(void)
Event handler when fast ACK timeout occurs (idle).
Definition: mac-low.cc:1283
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:143
void EnableMultiTidBlockAck(void)
NOT IMPLEMENTED FOR NOW.
Definition: mac-low.cc:118
EventId m_ctsTimeoutEvent
CTS timeout event.
Definition: mac-low.h:1088
void RxCompleteBufferedPacketsWithSmallerSequence(uint16_t seq, Mac48Address originator, uint8_t tid)
Definition: mac-low.cc:1843
void SetPhy(Ptr< WifiPhy > phy)
Set up WifiPhy associated with this MacLow.
Definition: mac-low.cc:422
Time m_basicBlockAckTimeout
Basic block ACK timeout duration.
Definition: mac-low.h:1104
Time GetDurationId(void) const
Definition: mac-low.cc:193
virtual void MissedBlockAck(void)
ns3::MacLow did not receive an expected BLOCK_ACK within BlockAckTimeout.
Definition: mac-low.cc:58
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: mac-low.h:1107
void ReceiveError(Ptr< const Packet > packet, double rxSnr)
Definition: mac-low.cc:626
Time GetSlotTime(void) const
Return slot duration of this MacLow.
Definition: mac-low.cc:536
Time m_lastNavStart
The time when the latest NAV started.
Definition: mac-low.h:1112
WifiTxVector GetRtsTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the RTS frame given the destination.
Definition: mac-low.cc:1020
std::map< AgreementKey, AgreementValue > Agreements
Definition: mac-low.h:1128
virtual WifiTxVector GetDataTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the DATA frame given the destination.
Definition: mac-low.cc:1026
handle RTS/CTS/DATA/ACK transactions.
Definition: mac-low.h:411
virtual void MissedCts(void)=0
ns3::MacLow did not receive an expected CTS within CtsTimeout.
EventId m_sendDataEvent
Event to send DATA.
Definition: mac-low.h:1091
MacLowTransmissionParameters m_txParams
Transmission parameters of the current packet.
Definition: mac-low.h:1099
void SetRifs(Time rifs)
Set Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:486
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: mac-low.cc:325
void NotifyAckTimeoutResetNow()
Notify DcfManager (via DcfListener) that ACK timer should be resetted.
Definition: mac-low.cc:1217
bool MustWaitSuperFastAck(void) const
Definition: mac-low.cc:163
Time CalculateOverallTxTime(Ptr< const Packet > packet, const WifiMacHeader *hdr, const MacLowTransmissionParameters &params) const
Definition: mac-low.cc:1063
QueueListeners m_edcaListeners
Definition: mac-low.h:1138
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 ...
Definition: mac-low.cc:1045
Mac48Address m_self
Address of this MacLow (Mac48Address)
Definition: mac-low.h:1101
Maintains information for a block ack agreement.
an identifier for simulation events.
Definition: event-id.h:46
EventId m_fastAckFailedTimeoutEvent
Fast ACK failed timeout event.
Definition: mac-low.h:1086
bool IsNavZero(void) const
Check if NAV is zero.
Definition: mac-low.cc:1519
void EnableRts(void)
Send a RTS, and wait CTSTimeout for a CTS.
Definition: mac-low.cc:138
void NotifyAckTimeoutStartNow(Time duration)
Notify DcfManager (via DcfListener) that ACK timer should be started for the given duration...
Definition: mac-low.cc:1209
virtual void NavReset(Time duration)=0
Notify that NAV has resetted.
void SetSlotTime(Time slotTime)
Set slot duration of this MacLow.
Definition: mac-low.cc:476
Ptr< Packet > m_currentPacket
Current packet transmitted/to be transmitted.
Definition: mac-low.h:1097
Time GetSifs(void) const
Return Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:526
Implement the header for management frames of type add block ack response.
Definition: mgt-headers.h:582
void SendCtsAfterRts(Mac48Address source, Time duration, WifiMode txMode, double rtsSnr)
Send CTS after receiving RTS.
Definition: mac-low.cc:1615
std::map< AgreementKey, AgreementValue >::iterator AgreementsI
Definition: mac-low.h:1129
EventId m_endTxNoAckEvent
Event for finishing transmission that does not require ACK.
Definition: mac-low.h:1093
virtual void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address source)
Definition: mac-low.cc:53
void EnableOverrideDurationId(Time durationId)
Definition: mac-low.cc:93
bool GetCtsToSelfSupported() const
Return whether CTS-to-self capability is supported.
Definition: mac-low.cc:461
void SetCtsTimeout(Time ctsTimeout)
Set CTS timeout of this MacLow.
Definition: mac-low.cc:466
void EnableNextData(uint32_t size)
Definition: mac-low.cc:83
void DisableOverrideDurationId(void)
Do not force the duration/id field of the packet: its value is automatically calculated by the MacLow...
Definition: mac-low.cc:98
Time GetAckTimeout(void) const
Return ACK timeout of this MacLow.
Definition: mac-low.cc:506
EventId m_waitRifsEvent
Wait for RIFS event.
Definition: mac-low.h:1095
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition: mac-low.cc:88
void SendDataPacket(void)
Send DATA packet, which can be DATA-ACK or RTS-CTS-DATA-ACK transaction.
Definition: mac-low.cc:1457
uint32_t GetCtsSize(void) const
Return the total CTS size (including FCS trailer).
Definition: mac-low.cc:1000
WifiMacHeader m_currentHdr
Header of the current packet.
Definition: mac-low.h:1098
void SetAddress(Mac48Address ad)
Set MAC address of this MacLow.
Definition: mac-low.cc:436
a base class which provides memory management and object aggregation
Definition: object.h:63
void ForwardDown(Ptr< const Packet > packet, const WifiMacHeader *hdr, WifiTxVector txVector, WifiPreamble preamble)
Forward the packet down to WifiPhy for transmission.
Definition: mac-low.cc:1242
void ReceiveOk(Ptr< Packet > packet, double rxSnr, WifiMode txMode, WifiPreamble preamble)
Definition: mac-low.cc:656
Time m_compressedBlockAckTimeout
Compressed block ACK timeout duration.
Definition: mac-low.h:1105
bool MustWaitAck(void) const
Definition: mac-low.cc:148
Headers for Block ack request.
Definition: ctrl-headers.h:49
virtual void AckTimeoutReset()=0
Notify that ACK timeout has resetted.
void RegisterBlockAckListenerForAc(enum AcIndex ac, MacLowBlockAckEventListener *listener)
Definition: mac-low.cc:2074
void DisableAck(void)
Do not wait for Ack after data transmission.
Definition: mac-low.cc:133
std::pair< BlockAckAgreement, std::list< BufferedPacket > > AgreementValue
Definition: mac-low.h:1126
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...
Definition: mac-low.cc:1051
Time GetBasicBlockAckTimeout() const
Return Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:511
void NotifyNav(Ptr< const Packet > packet, const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamble)
Definition: mac-low.cc:1131
Time m_rifs
Reduced Interframe Space (RIFS) duration.
Definition: mac-low.h:1110
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:35
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...
Definition: mac-low.cc:1035
bool StoreMpduIfNeeded(Ptr< Packet > packet, WifiMacHeader hdr)
Definition: mac-low.cc:1754
bool MustWaitNormalAck(void) const
Definition: mac-low.cc:153
virtual ~MacLow()
Definition: mac-low.cc:311
Ptr< WifiPhy > m_phy
Pointer to WifiPhy (actually send/receives frames)
Definition: mac-low.h:1070
Implements the IEEE 802.11 MAC header.
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
Set Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:451
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this MacLow.
Definition: mac-low.cc:430
class PhyMacLowListener * m_phyMacLowListener
Listerner needed to monitor when a channel switching occurs.
Definition: mac-low.h:1117
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...
Definition: mac-low.cc:1007
MacLowTransmissionListener * m_listener
Transmission listener for the current packet.
Definition: mac-low.h:1100
void SendRtsForPacket(void)
Send RTS to begin RTS-CTS-DATA-ACK transaction.
Definition: mac-low.cc:1330
void RxCompleteBufferedPacketsUntilFirstLost(Mac48Address originator, uint8_t tid)
Definition: mac-low.cc:1903