A Discrete-Event Network Simulator
API
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  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Mirko Banchi <mk.banchi@gmail.com>
21  */
22 
23 #ifndef MAC_LOW_H
24 #define MAC_LOW_H
25 
26 #include "wifi-phy.h"
27 #include "dcf-manager.h"
29 #include "block-ack-agreement.h"
30 #include "qos-utils.h"
31 #include "block-ack-cache.h"
32 #include "mpdu-aggregator.h"
33 #include "msdu-aggregator.h"
34 
37 
38 namespace ns3 {
39 
40 class DcaTxop;
41 class EdcaTxopN;
42 class DcfManager;
43 class WifiMacQueueItem;
44 class WifiMacQueue;
45 
55 {
56 public:
58 
64  void EnableAck (void);
78  void EnableFastAck (void);
85  void EnableSuperFastAck (void);
89  void EnableBasicBlockAck (void);
93  void EnableCompressedBlockAck (void);
97  void EnableMultiTidBlockAck (void);
104  void EnableRts (void);
114  void EnableNextData (uint32_t size);
122  void EnableOverrideDurationId (Time durationId);
127  void DisableAck (void);
131  void DisableRts (void);
135  void DisableNextData (void);
141  void DisableOverrideDurationId (void);
149  bool MustWaitAck (void) const;
156  bool MustWaitNormalAck (void) const;
163  bool MustWaitFastAck (void) const;
170  bool MustWaitSuperFastAck (void) const;
176  bool MustWaitBasicBlockAck (void) const;
182  bool MustWaitCompressedBlockAck (void) const;
188  bool MustWaitMultiTidBlockAck (void) const;
193  bool MustSendRts (void) const;
198  bool HasDurationId (void) const;
202  Time GetDurationId (void) const;
206  bool HasNextPacket (void) const;
210  uint32_t GetNextPacketSize (void) const;
211 
212 private:
213  friend std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters &params);
214  uint32_t m_nextSize;
215  enum
217  {
225  } m_waitAck;
226  bool m_sendRts;
228 };
229 
237 std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters &params);
238 
239 
244 class MacLow : public Object
245 {
246 public:
248  friend class ::TwoLevelAggregationTest;
250  friend class ::AmpduAggregationTest;
255 
256  MacLow ();
257  virtual ~MacLow ();
258 
263  static TypeId GetTypeId (void);
264 
270  void SetPhy (const Ptr<WifiPhy> phy);
274  Ptr<WifiPhy> GetPhy (void) const;
278  void ResetPhy (void);
290  void SetAddress (Mac48Address ad);
296  void SetAckTimeout (Time ackTimeout);
302  void SetBasicBlockAckTimeout (Time blockAckTimeout);
308  void SetCompressedBlockAckTimeout (Time blockAckTimeout);
314  void SetCtsToSelfSupported (bool enable);
320  void SetCtsTimeout (Time ctsTimeout);
326  void SetSifs (Time sifs);
332  void SetRifs (Time rifs);
338  void SetSlotTime (Time slotTime);
344  void SetPifs (Time pifs);
350  void SetBssid (Mac48Address ad);
354  void SetPromisc (void);
360  bool GetCtsToSelfSupported () const;
366  Mac48Address GetAddress (void) const;
372  Time GetAckTimeout (void) const;
378  Time GetBasicBlockAckTimeout () const;
390  Time GetCtsTimeout (void) const;
396  Time GetSifs (void) const;
402  Time GetSlotTime (void) const;
408  Time GetPifs (void) const;
414  Time GetRifs (void) const;
420  Mac48Address GetBssid (void) const;
427  bool IsPromisc (void) const;
428 
435  void SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *> callback);
439  void RegisterDcf (Ptr<DcfManager> dcf);
440 
451  const WifiMacHeader* hdr,
452  const MacLowTransmissionParameters& parameters) const;
453 
464  const WifiMacHeader* hdr,
465  const MacLowTransmissionParameters &params) const;
466 
478  const WifiMacHeader* hdr,
479  const MacLowTransmissionParameters& params,
480  uint32_t fragmentSize) const;
481 
491  virtual void StartTransmission (Ptr<const Packet> packet,
492  const WifiMacHeader* hdr,
493  MacLowTransmissionParameters parameters,
494  Ptr<DcaTxop> dca);
495 
505  void ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, bool ampduSubframe);
513  void ReceiveError (Ptr<Packet> packet, double rxSnr);
521  void NotifySwitchingStartNow (Time duration);
527  void NotifySleepNow (void);
543  void CreateBlockAckAgreement (const MgtAddBaResponseHeader *respHdr,
544  Mac48Address originator,
545  uint16_t startingSeq);
554  void DestroyBlockAckAgreement (Mac48Address originator, uint8_t tid);
562  void RegisterEdcaForAc (AcIndex ac, Ptr<EdcaTxopN> edca);
580  void DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector);
591  bool StopMpduAggregation (Ptr<const Packet> peekedPacket, WifiMacHeader peekedHdr, Ptr<Packet> aggregatedPacket, uint16_t size) const;
598  void FlushAggregateQueue (uint8_t tid);
599 
609  virtual WifiTxVector GetDataTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
610 
611 
612 private:
617  void CancelAllEvents (void);
623  static uint32_t GetAckSize (void);
630  static uint32_t GetBlockAckSize (BlockAckType type);
636  static uint32_t GetRtsSize (void);
642  static uint32_t GetCtsSize (void);
652  static uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr, bool isAmpdu);
658  static void AddWifiMacTrailer (Ptr<Packet> packet);
666  void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr, WifiTxVector txVector);
674  void SendMpdu (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype);
684  WifiTxVector GetRtsTxVector (Ptr<const Packet> packet, const WifiMacHeader *hdr) const;
695  WifiTxVector GetCtsTxVector (Mac48Address to, WifiMode rtsTxMode) const;
706  WifiTxVector GetAckTxVector (Mac48Address to, WifiMode dataTxMode) const;
717  WifiTxVector GetBlockAckTxVector (Mac48Address to, WifiMode dataTxMode) const;
756  Time GetCtsDuration (WifiTxVector ctsTxVector) const;
765  Time GetCtsDuration (Mac48Address to, WifiTxVector rtsTxVector) const;
772  Time GetAckDuration (WifiTxVector ackTxVector) const;
781  Time GetAckDuration (Mac48Address to, WifiTxVector dataTxVector) const;
791  Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, BlockAckType type) const;
798  bool NeedRts (void) const;
805  bool NeedCtsToSelf (void) const;
806 
814  void NotifyNav (Ptr<const Packet> packet,const WifiMacHeader &hdr, WifiPreamble preamble);
820  void DoNavResetNow (Time duration);
827  bool DoNavStartNow (Time duration);
834  bool IsNavZero (void) const;
840  void NotifyAckTimeoutStartNow (Time duration);
844  void NotifyAckTimeoutResetNow ();
850  void NotifyCtsTimeoutStartNow (Time duration);
854  void NotifyCtsTimeoutResetNow ();
861  void NavCounterResetCtsMissed (Time rtsEndRxTime);
862  /* Event handlers */
866  void NormalAckTimeout (void);
870  void FastAckTimeout (void);
874  void SuperFastAckTimeout (void);
878  void FastAckFailedTimeout (void);
882  void BlockAckTimeout (void);
886  void CtsTimeout (void);
890  void SendCtsToSelf (void);
899  void SendCtsAfterRts (Mac48Address source, Time duration, WifiTxVector rtsTxVector, double rtsSnr);
908  void SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMode, double dataSnr);
915  void SendDataAfterCts (Mac48Address source, Time duration);
916 
921  void WaitIfsAfterEndTxFragment (void);
926  void WaitIfsAfterEndTxPacket (void);
927 
931  void EndTxNoAck (void);
935  void SendRtsForPacket (void);
940  void SendDataPacket (void);
947  void StartDataTxTimers (WifiTxVector dataTxVector);
948 
949  void DoDispose (void);
950 
959  void RxCompleteBufferedPacketsWithSmallerSequence (uint16_t seq, Mac48Address originator, uint8_t tid);
972  void RxCompleteBufferedPacketsUntilFirstLost (Mac48Address originator, uint8_t tid);
981  static bool IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize);
991  bool ReceiveMpdu (Ptr<Packet> packet, WifiMacHeader hdr);
1002  bool StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr);
1014  Time duration, WifiMode blockAckReqTxMode, double rxSnr);
1025  void SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator,
1026  Time duration, WifiTxVector blockAckReqTxVector, double rxSnr);
1037  void SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Address originator, bool immediate,
1038  Time duration, WifiMode blockAckReqTxMode, double rxSnr);
1048 
1068  bool IsAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr);
1078  void InsertInTxQueue (Ptr<const Packet> packet, const WifiMacHeader &hdr, Time tStamp, uint8_t tid);
1090  Ptr<Packet> PerformMsduAggregation (Ptr<const Packet> packet, WifiMacHeader *hdr, Time *tstamp, Ptr<Packet> currentAmpduPacket, uint16_t blockAckSize);
1091 
1094  MacLowRxCallback m_rxCallback;
1095 
1099  struct Item
1100  {
1104  };
1105 
1106  typedef struct Item Item;
1107 
1111  typedef std::vector<Ptr<DcfManager> >::const_iterator DcfManagersCI;
1115  typedef std::vector<Ptr<DcfManager> > DcfManagers;
1116  DcfManagers m_dcfManagers;
1117 
1130 
1146 
1149 
1150  bool m_promisc;
1151  bool m_ampdu;
1152 
1154 
1155  /*
1156  * BlockAck data structures.
1157  */
1158  typedef std::pair<Ptr<Packet>, WifiMacHeader> BufferedPacket;
1159  typedef std::list<BufferedPacket>::iterator BufferedPacketI;
1160 
1161  typedef std::pair<Mac48Address, uint8_t> AgreementKey;
1162  typedef std::pair<BlockAckAgreement, std::list<BufferedPacket> > AgreementValue;
1163 
1164  typedef std::map<AgreementKey, AgreementValue> Agreements;
1165  typedef std::map<AgreementKey, AgreementValue>::iterator AgreementsI;
1166 
1167  typedef std::map<AgreementKey, BlockAckCache> BlockAckCaches;
1168  typedef std::map<AgreementKey, BlockAckCache>::iterator BlockAckCachesI;
1169 
1170  Agreements m_bAckAgreements;
1171  BlockAckCaches m_bAckCaches;
1172 
1173  typedef std::map<AcIndex, Ptr<EdcaTxopN> > QueueEdcas;
1174  QueueEdcas m_edca;
1175 
1178  std::vector<Item> m_txPackets[8];
1180 };
1181 
1182 } //namespace ns3
1183 
1184 #endif /* MAC_LOW_H */
void WaitIfsAfterEndTxPacket(void)
Event handler that is usually scheduled to fired at the appropriate time after sending a packet...
Definition: mac-low.cc:2109
bool MustSendRts(void) const
Definition: mac-low.cc:148
Time GetPifs(void) const
Return PCF Interframe Space (PIFS) of this MacLow.
Definition: mac-low.cc:579
void SetPifs(Time pifs)
Set PCF Interframe Space (PIFS) of this MacLow.
Definition: mac-low.cc:505
Time m_ctsTimeout
CTS timeout duration.
Definition: mac-low.h:1141
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
EventId m_navCounterResetCtsMissed
Event to reset NAV when CTS is not received.
Definition: mac-low.h:1129
static uint32_t GetRtsSize(void)
Return the total RTS size (including FCS trailer).
Definition: mac-low.cc:1186
Ptr< WifiPhy > GetPhy(void) const
Definition: mac-low.cc:430
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:2550
EventId m_blockAckTimeoutEvent
Block ACK timeout event.
Definition: mac-low.h:1122
Callback template class.
Definition: callback.h:1176
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.
Definition: mac-low.h:1178
Time GetAckDuration(WifiTxVector ackTxVector) const
Return the time required to transmit the ACK (including preamble and FCS).
Definition: mac-low.cc:1201
void SendBlockAckAfterBlockAckRequest(const CtrlBAckRequestHeader reqHdr, Mac48Address originator, Time duration, WifiMode blockAckReqTxMode, double rxSnr)
Invoked after that a block ack request has been received.
Definition: mac-low.cc:2487
virtual void StartTransmission(Ptr< const Packet > packet, const WifiMacHeader *hdr, MacLowTransmissionParameters parameters, Ptr< DcaTxop > dca)
Definition: mac-low.cc:628
void SetPromisc(void)
Enable promiscuous mode.
Definition: mac-low.cc:523
void DoNavResetNow(Time duration)
Reset NAV with the given duration.
Definition: mac-low.cc:1422
bool IsPromisc(void) const
Check if MacLow is operating in promiscuous mode.
Definition: mac-low.cc:591
void EnableBasicBlockAck(void)
Wait BASICBLOCKACKTimeout for a Basic Block Ack Response frame.
Definition: mac-low.cc:73
void SetupPhyMacLowListener(const Ptr< WifiPhy > phy)
Set up WifiPhy listener for this MacLow.
Definition: mac-low.cc:307
EventId m_fastAckTimeoutEvent
Fast ACK timeout event.
Definition: mac-low.h:1119
Time m_pifs
PCF Interframe Space (PIFS) duration.
Definition: mac-low.h:1144
void SetPhy(const Ptr< WifiPhy > phy)
Set up WifiPhy associated with this MacLow.
Definition: mac-low.cc:421
void FastAckFailedTimeout(void)
Event handler when fast ACK timeout occurs (busy).
Definition: mac-low.cc:2123
bool DoNavStartNow(Time duration)
Start NAV with the given duration.
Definition: mac-low.cc:1433
Mac48Address GetBssid(void) const
Return the Basic Service Set Identification.
Definition: mac-low.cc:585
void SetSifs(Time sifs)
Set Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:493
void ForwardDown(Ptr< const Packet > packet, const WifiMacHeader *hdr, WifiTxVector txVector)
Forward the packet down to WifiPhy for transmission.
Definition: mac-low.cc:1487
uint32_t m_nextSize
the next size
Definition: mac-low.h:214
Ptr< DcaTxop > m_currentDca
Current DCA.
Definition: mac-low.h:1133
std::pair< Mac48Address, uint8_t > AgreementKey
agreement key typedef
Definition: mac-low.h:1161
WifiTxVector GetCtsToSelfTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the CTS-to-self frame.
Definition: mac-low.cc:1256
friend std::ostream & operator<<(std::ostream &os, const MacLowTransmissionParameters &params)
Serialize MacLowTransmissionParameters to ostream in a human-readable form.
Definition: mac-low.cc:175
void NotifySleepNow(void)
This method is typically invoked by the PhyMacLowListener to notify the MAC layer that the device has...
Definition: mac-low.cc:795
bool HasDurationId(void) const
Definition: mac-low.cc:153
bool m_ampdu
Flag if the current transmission involves an A-MPDU.
Definition: mac-low.h:1151
void SetRxCallback(Callback< void, Ptr< Packet >, const WifiMacHeader * > callback)
Definition: mac-low.cc:597
std::map< AcIndex, Ptr< EdcaTxopN > > QueueEdcas
EDCA queues typedef.
Definition: mac-low.h:1173
Time GetCompressedBlockAckTimeout() const
Return Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:547
Mac48Address m_bssid
BSSID address (Mac48Address)
Definition: mac-low.h:1137
BlockAckType
Enumeration for different block ACK policies.
Definition: ctrl-headers.h:31
Ptr< Packet > AggregateToAmpdu(Ptr< const Packet > packet, const WifiMacHeader hdr)
Definition: mac-low.cc:2697
EventId m_sendCtsEvent
Event to send CTS.
Definition: mac-low.h:1124
MacLowRxCallback m_rxCallback
Callback to pass packet up.
Definition: mac-low.h:1094
Time GetCtsTimeout(void) const
Return CTS timeout of this MacLow.
Definition: mac-low.cc:553
EventId m_superFastAckTimeoutEvent
Super fast ACK timeout event.
Definition: mac-low.h:1120
void DeaggregateAmpduAndReceive(Ptr< Packet > aggregatedPacket, double rxSnr, WifiTxVector txVector)
Definition: mac-low.cc:2572
EventId m_sendAckEvent
Event to send ACK.
Definition: mac-low.h:1125
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
Time GetCtsDuration(WifiTxVector ctsTxVector) const
Return the time required to transmit the CTS (including preamble and FCS).
Definition: mac-low.cc:1225
bool MustWaitFastAck(void) const
Definition: mac-low.cc:123
static void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.
Definition: mac-low.cc:3095
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.
Definition: mac-low.cc:3031
control how a packet is transmitted.
Definition: mac-low.h:54
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self capability.
Definition: mac-low.cc:475
QueueEdcas m_edca
EDCA queues.
Definition: mac-low.h:1174
void NormalAckTimeout(void)
Event handler when normal ACK timeout occurs.
Definition: mac-low.cc:1615
void SetBasicBlockAckTimeout(Time blockAckTimeout)
Set Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:463
BlockAckCaches m_bAckCaches
block ack caches
Definition: mac-low.h:1171
Time timestamp
the timestamp
Definition: mac-low.h:1103
void RemovePhyMacLowListener(Ptr< WifiPhy > phy)
Remove current WifiPhy listener for this MacLow.
Definition: mac-low.cc:314
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:30
WifiTxVector m_currentTxVector
TXVECTOR used for the current packet transmission.
Definition: mac-low.h:1179
void DestroyBlockAckAgreement(Mac48Address originator, uint8_t tid)
Definition: mac-low.cc:2287
Time m_lastNavDuration
The duration of the latest NAV.
Definition: mac-low.h:1148
DcfManagers m_dcfManagers
List of DcfManager.
Definition: mac-low.h:1116
std::pair< Ptr< Packet >, WifiMacHeader > BufferedPacket
buffered packet typedef
Definition: mac-low.h:1158
bool m_ctsToSelfSupported
Flag whether CTS-to-self is supported.
Definition: mac-low.h:1176
void SendCtsToSelf(void)
Send CTS for a CTS-to-self mechanism.
Definition: mac-low.cc:1906
tuple phy
Definition: third.py:86
void SendAckAfterData(Mac48Address source, Time duration, WifiMode dataTxMode, double dataSnr)
Send ACK after receiving DATA.
Definition: mac-low.cc:2133
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
Definition: mac-low.cc:2245
void NotifyNav(Ptr< const Packet > packet, const WifiMacHeader &hdr, WifiPreamble preamble)
Notify NAV function.
Definition: mac-low.cc:1371
std::vector< Ptr< DcfManager > > DcfManagers
typedef for a list of DcfManager.
Definition: mac-low.h:1115
Listener for PHY events.
Definition: mac-low.cc:214
void CtsTimeout(void)
Event handler when CTS timeout occurs.
Definition: mac-low.cc:1600
void EndTxNoAck(void)
A transmission that does not require an ACK has completed.
Definition: mac-low.cc:2115
void SendBlockAckAfterAmpdu(uint8_t tid, Mac48Address originator, Time duration, WifiTxVector blockAckReqTxVector, double rxSnr)
Invoked after an A-MPDU has been received.
Definition: mac-low.cc:2457
std::map< AgreementKey, BlockAckCache >::iterator BlockAckCachesI
block ack caches iterator typedef
Definition: mac-low.h:1168
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:1282
void SetAckTimeout(Time ackTimeout)
Set ACK timeout of this MacLow.
Definition: mac-low.cc:457
static TypeId GetTypeId(void)
Register this type.
Definition: mac-low.cc:296
void SendDataAfterCts(Mac48Address source, Time duration)
Send DATA after receiving CTS.
Definition: mac-low.cc:2017
Time GetRifs(void) const
Return Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:566
void NavCounterResetCtsMissed(Time rtsEndRxTime)
Reset NAV after CTS was missed when the NAV was setted with RTS.
Definition: mac-low.cc:1413
Ptr< WifiRemoteStationManager > m_stationManager
Pointer to WifiRemoteStationManager (rate control)
Definition: mac-low.h:1093
bool MustWaitMultiTidBlockAck(void) const
Definition: mac-low.cc:143
Headers for Block ack response.
Definition: ctrl-headers.h:190
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
Definition: mac-low.cc:529
uint32_t GetNextPacketSize(void) const
Definition: mac-low.cc:169
Agreements m_bAckAgreements
block ack agreements
Definition: mac-low.h:1170
Ptr< WifiMacQueue > m_aggregateQueue[8]
Queues per TID used for MPDU aggregation.
Definition: mac-low.h:1177
bool HasNextPacket(void) const
Definition: mac-low.cc:164
void SendMpdu(Ptr< const Packet > packet, WifiTxVector txVector, MpduType mpdutype)
Forward the MPDU down to WifiPhy for transmission.
Definition: mac-low.cc:1593
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:1300
static uint32_t GetBlockAckSize(BlockAckType type)
Return the total Block ACK size (including FCS trailer).
Definition: mac-low.cc:1164
void NotifySwitchingStartNow(Time duration)
Definition: mac-low.cc:779
Time CalculateOverallTxFragmentTime(Ptr< const Packet > packet, const WifiMacHeader *hdr, const MacLowTransmissionParameters &params, uint32_t fragmentSize) const
Definition: mac-low.cc:1330
Time m_slotTime
Slot duration.
Definition: mac-low.h:1143
bool m_promisc
Flag if the device is operating in promiscuous mode.
Definition: mac-low.h:1150
WifiMacHeader hdr
the header
Definition: mac-low.h:1102
void CancelAllEvents(void)
Cancel all scheduled events.
Definition: mac-low.cc:354
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
std::list< BufferedPacket >::iterator BufferedPacketI
buffered packet iterator typedef
Definition: mac-low.h:1159
void BlockAckTimeout(void)
Event handler when block ACK timeout occurs.
Definition: mac-low.cc:1652
void NotifyCtsTimeoutStartNow(Time duration)
Notify DcfManagerthat CTS timer should be started for the given duration.
Definition: mac-low.cc:1469
Time m_overrideDurationId
override duration ID
Definition: mac-low.h:227
std::map< AgreementKey, BlockAckCache > BlockAckCaches
block ack caches typedef
Definition: mac-low.h:1167
void RegisterDcf(Ptr< DcfManager > dcf)
Definition: mac-low.cc:603
void EnableCompressedBlockAck(void)
Wait COMPRESSEDBLOCKACKTimeout for a Compressed Block Ack Response frame.
Definition: mac-low.cc:78
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SuperFastAckTimeout(void)
Event handler when super fast ACK timeout occurs.
Definition: mac-low.cc:1666
void SetBssid(Mac48Address ad)
Set the Basic Service Set Identification.
Definition: mac-low.cc:517
EventId m_waitIfsEvent
Wait for IFS event.
Definition: mac-low.h:1127
void ReceiveOk(Ptr< Packet > packet, double rxSnr, WifiTxVector txVector, bool ampduSubframe)
Definition: mac-low.cc:810
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:93
Time CalculateTransmissionTime(Ptr< const Packet > packet, const WifiMacHeader *hdr, const MacLowTransmissionParameters &parameters) const
Definition: mac-low.cc:1356
EventId m_normalAckTimeoutEvent
Normal ACK timeout event.
Definition: mac-low.h:1118
bool m_sendRts
send an RTS?
Definition: mac-low.h:226
void StartDataTxTimers(WifiTxVector dataTxVector)
Start a DATA timer by scheduling appropriate ACK timeout.
Definition: mac-low.cc:1754
void NotifyCtsTimeoutResetNow()
Notify DcfManager that CTS timer should be resetted.
Definition: mac-low.cc:1478
bool MustWaitBasicBlockAck(void) const
Definition: mac-low.cc:133
bool MustWaitCompressedBlockAck(void) const
Definition: mac-low.cc:138
an EUI-48 address
Definition: mac48-address.h:43
Ptr< const Packet > packet
the packet
Definition: mac-low.h:1101
Callback< void, Ptr< Packet >, const WifiMacHeader * > MacLowRxCallback
typedef for a callback for MacLowRx
Definition: mac-low.h:254
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.
Definition: mac-low.cc:2396
Time m_ackTimeout
ACK timeout duration.
Definition: mac-low.h:1138
static bool IsInWindow(uint16_t seq, uint16_t winstart, uint16_t winsize)
Definition: mac-low.cc:2165
static uint32_t GetCtsSize(void)
Return the total CTS size (including FCS trailer).
Definition: mac-low.cc:1232
bool NeedRts(void) const
Check if the current packet should be sent with a RTS protection.
Definition: mac-low.cc:750
void FastAckTimeout(void)
Event handler when fast ACK timeout occurs (idle).
Definition: mac-low.cc:1634
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:108
void EnableMultiTidBlockAck(void)
NOT IMPLEMENTED FOR NOW.
Definition: mac-low.cc:83
EventId m_ctsTimeoutEvent
CTS timeout event.
Definition: mac-low.h:1123
void RxCompleteBufferedPacketsWithSmallerSequence(uint16_t seq, Mac48Address originator, uint8_t tid)
Definition: mac-low.cc:2304
void SendCtsAfterRts(Mac48Address source, Time duration, WifiTxVector rtsTxVector, double rtsSnr)
Send CTS after receiving RTS.
Definition: mac-low.cc:1985
Time m_basicBlockAckTimeout
Basic block ACK timeout duration.
Definition: mac-low.h:1139
Time GetDurationId(void) const
Definition: mac-low.cc:158
void FlushAggregateQueue(uint8_t tid)
This function is called to flush the aggregate queue, which is used for A-MPDU.
Definition: mac-low.cc:3009
Two Level Aggregation Test.
Time m_sifs
Short Interframe Space (SIFS) duration.
Definition: mac-low.h:1142
static uint32_t GetAckSize(void)
Return the total ACK size (including FCS trailer).
Definition: mac-low.cc:1156
Time GetSlotTime(void) const
Return slot duration of this MacLow.
Definition: mac-low.cc:573
Ampdu Aggregation Test.
WifiMacHeader m_lastReceivedHdr
Header of the last received packet.
Definition: mac-low.h:1134
Time m_lastNavStart
The time when the latest NAV started.
Definition: mac-low.h:1147
void ReceiveError(Ptr< Packet > packet, double rxSnr)
Definition: mac-low.cc:765
static uint32_t GetSize(Ptr< const Packet > packet, const WifiMacHeader *hdr, bool isAmpdu)
Return the total size of the packet after WifiMacHeader and FCS trailer have been added...
Definition: mac-low.cc:1240
WifiTxVector GetRtsTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the RTS frame given the destination.
Definition: mac-low.cc:1262
enum ns3::MacLowTransmissionParameters::@73 m_waitAck
wait ack enumerated type
std::map< AgreementKey, AgreementValue > Agreements
agreements
Definition: mac-low.h:1164
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:1269
handle RTS/CTS/DATA/ACK transactions.
Definition: mac-low.h:244
std::vector< Ptr< DcfManager > >::const_iterator DcfManagersCI
typedef for an iterator for a list of DcfManager.
Definition: mac-low.h:1111
EventId m_sendDataEvent
Event to send DATA.
Definition: mac-low.h:1126
bool ReceiveMpdu(Ptr< Packet > packet, WifiMacHeader hdr)
Definition: mac-low.cc:2171
MacLowTransmissionParameters m_txParams
Transmission parameters of the current packet.
Definition: mac-low.h:1135
void SetRifs(Time rifs)
Set Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:511
void DoDispose(void)
Destructor implementation.
Definition: mac-low.cc:325
void NotifyAckTimeoutResetNow()
Notify DcfManager that ACK timer should be resetted.
Definition: mac-low.cc:1460
bool MustWaitSuperFastAck(void) const
Definition: mac-low.cc:128
Time CalculateOverallTxTime(Ptr< const Packet > packet, const WifiMacHeader *hdr, const MacLowTransmissionParameters &params) const
Definition: mac-low.cc:1306
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:1288
Mac48Address m_self
Address of this MacLow (Mac48Address)
Definition: mac-low.h:1136
Maintains information for a block ack agreement.
An identifier for simulation events.
Definition: event-id.h:53
EventId m_fastAckFailedTimeoutEvent
Fast ACK failed timeout event.
Definition: mac-low.h:1121
bool IsNavZero(void) const
Check if NAV is zero.
Definition: mac-low.cc:1893
void EnableRts(void)
Send a RTS, and wait CTSTimeout for a CTS.
Definition: mac-low.cc:103
void NotifyAckTimeoutStartNow(Time duration)
Notify DcfManager that ACK timer should be started for the given duration.
Definition: mac-low.cc:1451
void SetSlotTime(Time slotTime)
Set slot duration of this MacLow.
Definition: mac-low.cc:499
Ptr< Packet > m_currentPacket
Current packet transmitted/to be transmitted.
Definition: mac-low.h:1131
Time GetSifs(void) const
Return Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:559
bool NeedCtsToSelf(void) const
Check if CTS-to-self mechanism should be used for the current packet.
Definition: mac-low.cc:758
bool StopMpduAggregation(Ptr< const Packet > peekedPacket, WifiMacHeader peekedHdr, Ptr< Packet > aggregatedPacket, uint16_t size) const
Definition: mac-low.cc:2662
Implement the header for management frames of type add block ack response.
Definition: mgt-headers.h:890
std::map< AgreementKey, AgreementValue >::iterator AgreementsI
agreements iterator
Definition: mac-low.h:1165
EventId m_endTxNoAckEvent
Event for finishing transmission that does not require ACK.
Definition: mac-low.h:1128
void EnableOverrideDurationId(Time durationId)
Definition: mac-low.cc:58
bool GetCtsToSelfSupported() const
Return whether CTS-to-self capability is supported.
Definition: mac-low.cc:481
void SetCtsTimeout(Time ctsTimeout)
Set CTS timeout of this MacLow.
Definition: mac-low.cc:487
void EnableNextData(uint32_t size)
Definition: mac-low.cc:48
Time GetBlockAckDuration(Mac48Address to, WifiTxVector blockAckReqTxVector, BlockAckType type) const
Return the time required to transmit the Block ACK to the specified address given the TXVECTOR of the...
Definition: mac-low.cc:1208
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:63
Time GetAckTimeout(void) const
Return ACK timeout of this MacLow.
Definition: mac-low.cc:535
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition: mac-low.cc:53
void SendDataPacket(void)
Send DATA packet, which can be DATA-ACK or RTS-CTS-DATA-ACK transaction.
Definition: mac-low.cc:1828
WifiMacHeader m_currentHdr
Header of the current transmitted packet.
Definition: mac-low.h:1132
void SetAddress(Mac48Address ad)
Set MAC address of this MacLow.
Definition: mac-low.cc:451
A base class which provides memory management and object aggregation.
Definition: object.h:87
void WaitIfsAfterEndTxFragment(void)
Event handler that is usually scheduled to fired at the appropriate time after completing transmissio...
Definition: mac-low.cc:2103
Time m_compressedBlockAckTimeout
Compressed block ACK timeout duration.
Definition: mac-low.h:1140
bool MustWaitAck(void) const
Definition: mac-low.cc:113
Headers for Block ack request.
Definition: ctrl-headers.h:50
bool IsAmpdu(Ptr< const Packet > packet, const WifiMacHeader hdr)
Checks if the given packet will be aggregated to an A-MPDU or not.
Definition: mac-low.cc:609
void InsertInTxQueue(Ptr< const Packet > packet, const WifiMacHeader &hdr, Time tStamp, uint8_t tid)
Insert in a temporary queue.
Definition: mac-low.cc:3020
void ResetPhy(void)
Remove WifiPhy associated with this MacLow.
Definition: mac-low.cc:436
void DisableAck(void)
Do not wait for Ack after data transmission.
Definition: mac-low.cc:98
std::pair< BlockAckAgreement, std::list< BufferedPacket > > AgreementValue
agreement value typedef
Definition: mac-low.h:1162
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:1294
Time GetBasicBlockAckTimeout() const
Return Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:541
a unique identifier for an interface.
Definition: type-id.h:58
MpduType
This enumeration defines the type of an MPDU.
Definition: wifi-phy.h:56
Time m_rifs
Reduced Interframe Space (RIFS) duration.
Definition: mac-low.h:1145
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38
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:1276
bool StoreMpduIfNeeded(Ptr< Packet > packet, WifiMacHeader hdr)
Definition: mac-low.cc:2216
bool MustWaitNormalAck(void) const
Definition: mac-low.cc:118
virtual ~MacLow()
Definition: mac-low.cc:289
A struct for packet, Wifi header, and timestamp.item structure.
Definition: mac-low.h:1099
Ptr< WifiPhy > m_phy
Pointer to WifiPhy (actually send/receives frames)
Definition: mac-low.h:1092
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this MacLow.
Definition: mac-low.cc:445
Implements the IEEE 802.11 MAC header.
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
Set Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:469
class PhyMacLowListener * m_phyMacLowListener
Listener needed to monitor when a channel switching occurs.
Definition: mac-low.h:1153
void RegisterEdcaForAc(AcIndex ac, Ptr< EdcaTxopN > edca)
Definition: mac-low.cc:2566
void SendRtsForPacket(void)
Send RTS to begin RTS-CTS-DATA-ACK transaction.
Definition: mac-low.cc:1685
void RxCompleteBufferedPacketsUntilFirstLost(Mac48Address originator, uint8_t tid)
Definition: mac-low.cc:2367