OLD | NEW |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2005, 2006 INRIA | 3 * Copyright (c) 2005, 2006 INRIA |
| 4 * Copyright (c) 2009 MIRKO BANCHI |
4 * | 5 * |
5 * This program is free software; you can redistribute it and/or modify | 6 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as· | 7 * it under the terms of the GNU General Public License version 2 as· |
7 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
8 * | 9 * |
9 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 13 * GNU General Public License for more details. |
13 * | 14 * |
14 * You should have received a copy of the GNU General Public License | 15 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 16 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 18 * |
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> | 19 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
| 20 * Author: Mirko Banchi <mk.banchi@gmail.com> |
19 */ | 21 */ |
20 #ifndef MAC_LOW_H | 22 #ifndef MAC_LOW_H |
21 #define MAC_LOW_H | 23 #define MAC_LOW_H |
22 | 24 |
23 #include <vector> | 25 #include <vector> |
24 #include <stdint.h> | 26 #include <stdint.h> |
25 #include <ostream> | 27 #include <ostream> |
| 28 #include <map> |
26 | 29 |
27 #include "wifi-mac-header.h" | 30 #include "wifi-mac-header.h" |
28 #include "wifi-mode.h" | 31 #include "wifi-mode.h" |
29 #include "wifi-preamble.h" | 32 #include "wifi-preamble.h" |
30 #include "wifi-remote-station-manager.h" | 33 #include "wifi-remote-station-manager.h" |
| 34 #include "ctrl-headers.h" |
| 35 #include "mgt-headers.h" |
| 36 #include "block-ack-agreement.h" |
31 #include "ns3/mac48-address.h" | 37 #include "ns3/mac48-address.h" |
32 #include "ns3/callback.h" | 38 #include "ns3/callback.h" |
33 #include "ns3/event-id.h" | 39 #include "ns3/event-id.h" |
34 #include "ns3/packet.h" | 40 #include "ns3/packet.h" |
35 #include "ns3/nstime.h" | 41 #include "ns3/nstime.h" |
| 42 #include "qos-utils.h" |
36 | 43 |
37 namespace ns3 { | 44 namespace ns3 { |
38 | 45 |
39 class WifiPhy; | 46 class WifiPhy; |
40 class WifiMac; | 47 class WifiMac; |
| 48 class EdcaTxopN; |
41 | 49 |
42 /** | 50 /** |
43 * \brief listen to events coming from ns3::MacLow. | 51 * \brief listen to events coming from ns3::MacLow. |
44 */ | 52 */ |
45 class MacLowTransmissionListener { | 53 class MacLowTransmissionListener { |
46 public: | 54 public: |
47 MacLowTransmissionListener (); | 55 MacLowTransmissionListener (); |
48 virtual ~MacLowTransmissionListener (); | 56 virtual ~MacLowTransmissionListener (); |
49 | 57 |
50 /** | 58 /** |
(...skipping 18 matching lines...) Expand all Loading... |
69 * arguments are not valid when SUPER_FAST_ACK is· | 77 * arguments are not valid when SUPER_FAST_ACK is· |
70 * used. | 78 * used. |
71 */ | 79 */ |
72 virtual void GotAck (double snr, WifiMode txMode) = 0; | 80 virtual void GotAck (double snr, WifiMode txMode) = 0; |
73 /** | 81 /** |
74 * ns3::MacLow did not receive an expected ACK within | 82 * ns3::MacLow did not receive an expected ACK within |
75 * AckTimeout. | 83 * AckTimeout. |
76 */ | 84 */ |
77 virtual void MissedAck (void) = 0; | 85 virtual void MissedAck (void) = 0; |
78 /** | 86 /** |
| 87 * \param blockAck Block ack response header |
| 88 * \param source Address of block ack sender |
| 89 * |
| 90 * Invoked when ns3::MacLow receives a block ack frame. |
| 91 * Block ack frame is received after a block ack request |
| 92 * and contains information about the correct reception· |
| 93 * of a set of packet for which a normal ack wasn't send. |
| 94 * Default implementation for this method is empty. Every |
| 95 * queue that intends to be notified by MacLow of reception |
| 96 * of a block ack must redefine this function. |
| 97 */ |
| 98 virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address
source); |
| 99 /** |
| 100 * ns3::MacLow did not receive an expected BLOCK_ACK within |
| 101 * BlockAckTimeout. This method is used only for immediate· |
| 102 * block ack variant. With delayed block ack, the MissedAck method will be |
| 103 * called instead: upon receipt of a block ack request, the rx station will |
| 104 * reply with a normal ack frame. Later, when the rx station gets a txop, it |
| 105 * will send the block ack back to the tx station which will reply with a |
| 106 * normal ack to the rx station. |
| 107 */ |
| 108 virtual void MissedBlockAck (void); |
| 109 /** |
79 * Invoked when ns3::MacLow wants to start a new transmission | 110 * Invoked when ns3::MacLow wants to start a new transmission |
80 * as configured by MacLowTransmissionParameters::EnableNextData. | 111 * as configured by MacLowTransmissionParameters::EnableNextData. |
81 * The listener is expected to call again MacLow::StartTransmission | 112 * The listener is expected to call again MacLow::StartTransmission |
82 * with the "next" data to send. | 113 * with the "next" data to send. |
83 */ | 114 */ |
84 virtual void StartNext (void) = 0; | 115 virtual void StartNext (void) = 0; |
85 | 116 |
86 /** | 117 /** |
87 * Invoked if this transmission was canceled· | 118 * Invoked if this transmission was canceled· |
88 * one way or another. When this method is invoked, | 119 * one way or another. When this method is invoked, |
(...skipping 23 matching lines...) Expand all Loading... |
112 * \param duration duration of NAV timer | 143 * \param duration duration of NAV timer |
113 */ | 144 */ |
114 virtual void NavReset (Time duration) = 0; | 145 virtual void NavReset (Time duration) = 0; |
115 virtual void AckTimeoutStart (Time duration) = 0; | 146 virtual void AckTimeoutStart (Time duration) = 0; |
116 virtual void AckTimeoutReset () = 0; | 147 virtual void AckTimeoutReset () = 0; |
117 virtual void CtsTimeoutStart (Time duration) = 0; | 148 virtual void CtsTimeoutStart (Time duration) = 0; |
118 virtual void CtsTimeoutReset () = 0; | 149 virtual void CtsTimeoutReset () = 0; |
119 }; | 150 }; |
120 | 151 |
121 /** | 152 /** |
| 153 * \brief listen for block ack events. |
| 154 */ |
| 155 class MacLowBlockAckEventListener { |
| 156 public: |
| 157 MacLowBlockAckEventListener (); |
| 158 virtual ~MacLowBlockAckEventListener (); |
| 159 /** |
| 160 * Typically is called in order to notify EdcaTxopN that a block ack inactivit
y |
| 161 * timeout occurs for the block ack agreement identified by the pair <i>origin
ator</i>, <i>tid</i>. |
| 162 *· |
| 163 * Rx station maintains an inactivity timer for each block ack |
| 164 * agreement. Timer is reset when a frame with ack policy block ack |
| 165 * or a block ack request are received. When this timer reaches zero |
| 166 * this method is called and a delba frame is scheduled for transmission. |
| 167 */ |
| 168 virtual void BlockAckInactivityTimeout (Mac48Address originator, uint8_t tid)
= 0; |
| 169 }; |
| 170 |
| 171 /** |
122 * \brief control how a packet is transmitted. | 172 * \brief control how a packet is transmitted. |
123 * | 173 * |
124 * The ns3::MacLow::StartTransmission method expects | 174 * The ns3::MacLow::StartTransmission method expects |
125 * an instance of this class to describe how the packet | 175 * an instance of this class to describe how the packet |
126 * should be transmitted. | 176 * should be transmitted. |
127 */ | 177 */ |
128 class MacLowTransmissionParameters { | 178 class MacLowTransmissionParameters { |
129 public: | 179 public: |
130 MacLowTransmissionParameters (); | 180 MacLowTransmissionParameters (); |
131 ···· | 181 ···· |
(...skipping 18 matching lines...) Expand all Loading... |
150 */ | 200 */ |
151 void EnableFastAck (void); | 201 void EnableFastAck (void); |
152 /**· | 202 /**· |
153 * - if busy at end-of-tx+PIFS, call· | 203 * - if busy at end-of-tx+PIFS, call· |
154 * MacLowTransmissionListener::GotAck | 204 * MacLowTransmissionListener::GotAck |
155 * - if idle at end-of-tx+PIFS, call | 205 * - if idle at end-of-tx+PIFS, call |
156 * MacLowTransmissionListener::MissedAck | 206 * MacLowTransmissionListener::MissedAck |
157 */ | 207 */ |
158 void EnableSuperFastAck (void); | 208 void EnableSuperFastAck (void); |
159 /** | 209 /** |
| 210 * Wait BASICBLOCKACKTimeout for a Basic Block Ack Response frame. |
| 211 */ |
| 212 void EnableBasicBlockAck (void); |
| 213 /** |
| 214 * Wait COMPRESSEDBLOCKACKTimeout for a Compressed Block Ack Response frame. |
| 215 */ |
| 216 void EnableCompressedBlockAck (void); |
| 217 /** |
| 218 * NOT IMPLEMENTED FOR NOW |
| 219 */ |
| 220 void EnableMultiTidBlockAck (void); |
| 221 /** |
160 * Send a RTS, and wait CTSTimeout for a CTS. If we get a· | 222 * Send a RTS, and wait CTSTimeout for a CTS. If we get a· |
161 * CTS on time, call MacLowTransmissionListener::GotCts | 223 * CTS on time, call MacLowTransmissionListener::GotCts |
162 * and send data. Otherwise, call MacLowTransmissionListener::MissedCts | 224 * and send data. Otherwise, call MacLowTransmissionListener::MissedCts |
163 * and do not send data. | 225 * and do not send data. |
164 */ | 226 */ |
165 void EnableRts (void); | 227 void EnableRts (void); |
166 /** | 228 /** |
167 * \param size size of next data to send after current packet is | 229 * \param size size of next data to send after current packet is |
168 * sent. | 230 * sent. |
169 * | 231 * |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 */ | 288 */ |
227 bool MustWaitFastAck (void) const; | 289 bool MustWaitFastAck (void) const; |
228 /** | 290 /** |
229 * \returns true if super fast ack protocol should be used, false· | 291 * \returns true if super fast ack protocol should be used, false· |
230 * otherwise. | 292 * otherwise. |
231 * | 293 * |
232 * \sa EnableSuperFastAck | 294 * \sa EnableSuperFastAck |
233 */ | 295 */ |
234 bool MustWaitSuperFastAck (void) const; | 296 bool MustWaitSuperFastAck (void) const; |
235 /** | 297 /** |
| 298 * \returns true if block ack mechanism is used, false otherwise. |
| 299 * |
| 300 * \sa EnableBlockAck |
| 301 */ |
| 302 bool MustWaitBasicBlockAck (void) const; |
| 303 /** |
| 304 * \returns true if compressed block ack mechanism is used, false otherwise. |
| 305 * |
| 306 * \sa EnableCompressedBlockAck |
| 307 */ |
| 308 bool MustWaitCompressedBlockAck (void) const; |
| 309 /** |
| 310 * \returns true if multi-tid block ack mechanism is used, false otherwise. |
| 311 * |
| 312 * \sa EnableMultiTidBlockAck |
| 313 */ |
| 314 bool MustWaitMultiTidBlockAck (void) const; |
| 315 /** |
236 * \returns true if RTS should be sent and CTS waited for before· | 316 * \returns true if RTS should be sent and CTS waited for before· |
237 * sending data, false otherwise. | 317 * sending data, false otherwise. |
238 */ | 318 */ |
239 bool MustSendRts (void) const; | 319 bool MustSendRts (void) const; |
240 /** | 320 /** |
241 * \returns true if a duration/id was forced with· | 321 * \returns true if a duration/id was forced with· |
242 * EnableOverrideDurationId, false otherwise. | 322 * EnableOverrideDurationId, false otherwise. |
243 */ | 323 */ |
244 bool HasDurationId (void) const; | 324 bool HasDurationId (void) const; |
245 /** | 325 /** |
246 * \returns the duration/id forced by EnableOverrideDurationId | 326 * \returns the duration/id forced by EnableOverrideDurationId |
247 */ | 327 */ |
248 Time GetDurationId (void) const; | 328 Time GetDurationId (void) const; |
249 /** | 329 /** |
250 * \returns true if EnableNextData was called, false otherwise. | 330 * \returns true if EnableNextData was called, false otherwise. |
251 */ | 331 */ |
252 bool HasNextPacket (void) const; | 332 bool HasNextPacket (void) const; |
253 /** | 333 /** |
254 * \returns the size specified by EnableNextData. | 334 * \returns the size specified by EnableNextData. |
255 */ | 335 */ |
256 uint32_t GetNextPacketSize (void) const; | 336 uint32_t GetNextPacketSize (void) const; |
257 | 337 |
258 private: | 338 private: |
259 friend std::ostream &operator << (std::ostream &os, const MacLowTransmissionPa
rameters ¶ms); | 339 friend std::ostream &operator << (std::ostream &os, const MacLowTransmissionPa
rameters ¶ms); |
260 uint32_t m_nextSize; | 340 uint32_t m_nextSize; |
261 enum { | 341 enum { |
262 ACK_NONE, | 342 ACK_NONE, |
263 ACK_NORMAL, | 343 ACK_NORMAL, |
264 ACK_FAST, | 344 ACK_FAST, |
265 ACK_SUPER_FAST | 345 ACK_SUPER_FAST, |
| 346 BLOCK_ACK_BASIC, |
| 347 BLOCK_ACK_COMPRESSED, |
| 348 BLOCK_ACK_MULTI_TID |
266 } m_waitAck; | 349 } m_waitAck; |
267 bool m_sendRts; | 350 bool m_sendRts; |
268 Time m_overrideDurationId; | 351 Time m_overrideDurationId; |
269 }; | 352 }; |
270 | 353 |
271 std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters
¶ms); | 354 std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters
¶ms); |
272 | 355 |
273 | 356 |
274 /** | 357 /** |
275 * \brief handle RTS/CTS/DATA/ACK transactions. | 358 * \brief handle RTS/CTS/DATA/ACK transactions. |
276 */ | 359 */ |
277 class MacLow : public Object { | 360 class MacLow : public Object { |
278 public: | 361 public: |
279 typedef Callback<void, Ptr<Packet>, const WifiMacHeader*> MacLowRxCallback; | 362 typedef Callback<void, Ptr<Packet>, const WifiMacHeader*> MacLowRxCallback; |
280 | 363 |
281 MacLow (); | 364 MacLow (); |
282 virtual ~MacLow (); | 365 virtual ~MacLow (); |
283 | 366 |
284 void SetPhy (Ptr<WifiPhy> phy); | 367 void SetPhy (Ptr<WifiPhy> phy); |
285 void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> manager); | 368 void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> manager); |
286 | 369 |
287 void SetAddress (Mac48Address ad); | 370 void SetAddress (Mac48Address ad); |
288 void SetAckTimeout (Time ackTimeout); | 371 void SetAckTimeout (Time ackTimeout); |
| 372 void SetBasicBlockAckTimeout (Time blockAckTimeout); |
| 373 void SetCompressedBlockAckTimeout (Time blockAckTimeout); |
289 void SetCtsTimeout (Time ctsTimeout); | 374 void SetCtsTimeout (Time ctsTimeout); |
290 void SetSifs (Time sifs); | 375 void SetSifs (Time sifs); |
291 void SetSlotTime (Time slotTime); | 376 void SetSlotTime (Time slotTime); |
292 void SetPifs (Time pifs); | 377 void SetPifs (Time pifs); |
293 void SetBssid (Mac48Address ad); | 378 void SetBssid (Mac48Address ad); |
294 Mac48Address GetAddress (void) const; | 379 Mac48Address GetAddress (void) const; |
295 Time GetAckTimeout (void) const; | 380 Time GetAckTimeout (void) const; |
| 381 Time GetBasicBlockAckTimeout () const; |
| 382 Time GetCompressedBlockAckTimeout () const; |
296 Time GetCtsTimeout (void) const; | 383 Time GetCtsTimeout (void) const; |
297 Time GetSifs (void) const; | 384 Time GetSifs (void) const; |
298 Time GetSlotTime (void) const; | 385 Time GetSlotTime (void) const; |
299 Time GetPifs (void) const; | 386 Time GetPifs (void) const; |
300 Mac48Address GetBssid (void) const; | 387 Mac48Address GetBssid (void) const; |
301 | 388 |
302 /** | 389 /** |
303 * \param callback the callback which receives every incoming packet. | 390 * \param callback the callback which receives every incoming packet. |
304 * | 391 * |
305 * This callback typically forwards incoming packets to | 392 * This callback typically forwards incoming packets to |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 */ | 444 */ |
358 void ReceiveError (Ptr<const Packet> packet, double rxSnr); | 445 void ReceiveError (Ptr<const Packet> packet, double rxSnr); |
359 /** | 446 /** |
360 * \param duration switching delay duration. | 447 * \param duration switching delay duration. |
361 * | 448 * |
362 * This method is typically invoked by the PhyMacLowListener to notify | 449 * This method is typically invoked by the PhyMacLowListener to notify |
363 * the MAC layer that a channel switching occured. When a channel switching | 450 * the MAC layer that a channel switching occured. When a channel switching |
364 * occurs, pending MAC transmissions (RTS, CTS, DATA and ACK) are cancelled. | 451 * occurs, pending MAC transmissions (RTS, CTS, DATA and ACK) are cancelled. |
365 */ | 452 */ |
366 void NotifySwitchingStartNow (Time duration);· | 453 void NotifySwitchingStartNow (Time duration);· |
| 454 /** |
| 455 * \param respHdr Add block ack response from originator (action frame). |
| 456 * \param originator Address of peer station involved in block ack mechanism. |
| 457 * \param startingSeq Sequence number of the first MPDU of all packets for whi
ch block ack was negotiated. |
| 458 *· |
| 459 * This function is typically invoked only by ns3::QapWifiMac and ns3::QstaWif
iMac. |
| 460 * If we are transmitting an Add block ack response, MacLow must allocate buff
ers to collect |
| 461 * all correctly received packets belonging to category for which block ack wa
s negotiated. |
| 462 * It's needed in order to send a Block ack after corresponding originator's B
lock ack request. |
| 463 */ |
| 464 void CreateBlockAckAgreement (const MgtAddBaResponseHeader *respHdr, Mac48Addr
ess originator, |
| 465 uint16_t startingSeq); |
| 466 /** |
| 467 * \param originator Address of peer partecipating in Block Ack mechanism. |
| 468 * \param tid TID for which Block Ack was created. |
| 469 * |
| 470 * Checks if exists an established block ack agreement with <i>originator</i> |
| 471 * for tid <i>tid</i>. If the agreement exists, tears down it. This function i
s typically |
| 472 * invoked when a DELBA frame is received from <i>originator</i>. |
| 473 */ |
| 474 void DestroyBlockAckAgreement (Mac48Address originator, uint8_t tid); |
| 475 /** |
| 476 * \param ac Access class managed by the queue. |
| 477 * \param listener The listener for the queue. |
| 478 * |
| 479 * The lifetime of the registered listener is typically equal to the lifetime
of the queue |
| 480 * associated to this AC. |
| 481 */ |
| 482 void RegisterBlockAckListenerForAc (enum AccessClass ac, MacLowBlockAckEventLi
stener *listener); |
367 private: | 483 private: |
368 void CancelAllEvents (void); | 484 void CancelAllEvents (void); |
369 uint32_t GetAckSize (void) const; | 485 uint32_t GetAckSize (void) const; |
| 486 uint32_t GetBlockAckSize (enum BlockAckType type) const; |
370 uint32_t GetRtsSize (void) const; | 487 uint32_t GetRtsSize (void) const; |
371 uint32_t GetCtsSize (void) const; | 488 uint32_t GetCtsSize (void) const; |
372 uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const; | 489 uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const; |
373 Time NowUs (void) const; | 490 Time NowUs (void) const; |
374 WifiRemoteStation *GetStation (Mac48Address to) const; | 491 WifiRemoteStation *GetStation (Mac48Address to) const; |
375 void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr,· | 492 void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr,· |
376 WifiMode txMode); | 493 WifiMode txMode); |
377 Time CalculateOverallTxTime (Ptr<const Packet> packet, | 494 Time CalculateOverallTxTime (Ptr<const Packet> packet, |
378 const WifiMacHeader* hdr,· | 495 const WifiMacHeader* hdr,· |
379 const MacLowTransmissionParameters ¶ms) const
; | 496 const MacLowTransmissionParameters ¶ms) const
; |
380 WifiMode GetRtsTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) con
st; | 497 WifiMode GetRtsTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) con
st; |
381 WifiMode GetDataTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) co
nst; | 498 WifiMode GetDataTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) co
nst; |
382 WifiMode GetCtsTxModeForRts (Mac48Address to, WifiMode rtsTxMode) const; | 499 WifiMode GetCtsTxModeForRts (Mac48Address to, WifiMode rtsTxMode) const; |
383 WifiMode GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const; | 500 WifiMode GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const; |
| 501 |
384 Time GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const; | 502 Time GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const; |
385 Time GetAckDuration (Mac48Address to, WifiMode dataTxMode) const; | 503 Time GetAckDuration (Mac48Address to, WifiMode dataTxMode) const; |
| 504 Time GetBlockAckDuration (Mac48Address to, WifiMode blockAckReqTxMode, enum Bl
ockAckType type) const; |
386 void NotifyNav (const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamb
le); | 505 void NotifyNav (const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamb
le); |
387 void DoNavResetNow (Time duration); | 506 void DoNavResetNow (Time duration); |
388 bool DoNavStartNow (Time duration); | 507 bool DoNavStartNow (Time duration); |
389 bool IsNavZero (void) const; | 508 bool IsNavZero (void) const; |
390 void NotifyAckTimeoutStartNow (Time duration); | 509 void NotifyAckTimeoutStartNow (Time duration); |
391 void NotifyAckTimeoutResetNow (); | 510 void NotifyAckTimeoutResetNow (); |
392 void NotifyCtsTimeoutStartNow (Time duration); | 511 void NotifyCtsTimeoutStartNow (Time duration); |
393 void NotifyCtsTimeoutResetNow (); | 512 void NotifyCtsTimeoutResetNow (); |
394 void MaybeCancelPrevious (void); | 513 void MaybeCancelPrevious (void); |
395 ·· | 514 ·· |
396 void NavCounterResetCtsMissed (Time rtsEndRxTime); | 515 void NavCounterResetCtsMissed (Time rtsEndRxTime); |
397 void NormalAckTimeout (void); | 516 void NormalAckTimeout (void); |
398 void FastAckTimeout (void); | 517 void FastAckTimeout (void); |
399 void SuperFastAckTimeout (void); | 518 void SuperFastAckTimeout (void); |
400 void FastAckFailedTimeout (void); | 519 void FastAckFailedTimeout (void); |
| 520 void BlockAckTimeout (void); |
401 void CtsTimeout (void); | 521 void CtsTimeout (void); |
402 void SendCtsAfterRts (Mac48Address source, Time duration, WifiMode txMode, dou
ble rtsSnr); | 522 void SendCtsAfterRts (Mac48Address source, Time duration, WifiMode txMode, dou
ble rtsSnr); |
403 void SendAckAfterData (Mac48Address source, Time duration, WifiMode txMode, do
uble rtsSnr); | 523 void SendAckAfterData (Mac48Address source, Time duration, WifiMode txMode, do
uble rtsSnr); |
404 void SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode); | 524 void SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode); |
405 void WaitSifsAfterEndTx (void); | 525 void WaitSifsAfterEndTx (void); |
406 | 526 |
407 void SendRtsForPacket (void); | 527 void SendRtsForPacket (void); |
408 void SendDataPacket (void); | 528 void SendDataPacket (void); |
409 void SendCurrentTxPacket (void); | 529 void SendCurrentTxPacket (void); |
410 void StartDataTxTimers (void); | 530 void StartDataTxTimers (void); |
411 virtual void DoDispose (void); | 531 virtual void DoDispose (void); |
| 532 /** |
| 533 * \param originator Address of peer partecipating in Block Ack mechanism. |
| 534 * \param tid TID for which Block Ack was created. |
| 535 * \param seq Starting sequence |
| 536 * |
| 537 * This function forward up all completed "old" packets with sequence number |
| 538 * smaller than <i>seq</i>. All comparison are performed circularly mod 4096. |
| 539 */ |
| 540 void RxCompleteBufferedPacketsWithSmallerSequence (uint16_t seq, Mac48Address
originator, uint8_t tid); |
| 541 /** |
| 542 * \param originator Address of peer partecipating in Block Ack mechanism. |
| 543 * \param tid TID for which Block Ack was created. |
| 544 * |
| 545 * This method is typically invoked when a MPDU with ack policy |
| 546 * subfield set to Normal Ack is received and a block ack agreement |
| 547 * for that packet exists. |
| 548 * This happens when the originator of block ack has only few MPDUs to send. |
| 549 * All completed MSDUs starting with starting sequence number of block ack |
| 550 * agreement are forward up to WifiMac until there is an incomplete MSDU. |
| 551 * See section 9.10.4 in IEEE802.11 standard for more details. |
| 552 */ |
| 553 void RxCompleteBufferedPackets (Mac48Address originator, uint8_t tid); |
| 554 /*· |
| 555 * This method checks if exists a valid established block ack agreement.· |
| 556 * If there is, store the packet without pass it up to WifiMac. The packet is
buffered |
| 557 * in order of increasing sequence control field. All comparison are performed |
| 558 * circularly modulo 2^12. |
| 559 */ |
| 560 bool StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr); |
| 561 /* |
| 562 * Invoked after that a block ack request has been received. Looks for corresp
onding |
| 563 * block ack agreement and creates block ack bitmap on a received packets basi
s. |
| 564 */ |
| 565 void SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Mac
48Address originator, |
| 566 Time duration, WifiMode blockAckReqTxMo
de); |
| 567 /* |
| 568 * This method creates block ack frame with header equals to <i>blockAck</i> a
nd start its transmission. |
| 569 */ |
| 570 void SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Addres
s originator, bool immediate, |
| 571 Time duration, WifiMode blockAckReqTxMode); |
| 572 /* |
| 573 * Every time that a block ack request or a packet with ack policy equals to <
i>block ack</i> |
| 574 * are received, if a relative block ack agreement exists and the value of ina
ctivity timeout |
| 575 * is not 0, the timer is reset. |
| 576 * see section 11.5.3 in IEEE802.11e for more details. |
| 577 */ |
| 578 void ResetBlockAckInactivityTimerIfNeeded (BlockAckAgreement &agreement); |
412 | 579 |
413 void SetupPhyMacLowListener (Ptr<WifiPhy> phy);· | 580 void SetupPhyMacLowListener (Ptr<WifiPhy> phy);· |
414 | 581 |
415 Ptr<WifiPhy> m_phy; | 582 Ptr<WifiPhy> m_phy; |
416 Ptr<WifiRemoteStationManager> m_stationManager; | 583 Ptr<WifiRemoteStationManager> m_stationManager; |
417 MacLowRxCallback m_rxCallback; | 584 MacLowRxCallback m_rxCallback; |
418 typedef std::vector<MacLowDcfListener *>::const_iterator DcfListenersCI; | 585 typedef std::vector<MacLowDcfListener *>::const_iterator DcfListenersCI; |
419 typedef std::vector<MacLowDcfListener *> DcfListeners; | 586 typedef std::vector<MacLowDcfListener *> DcfListeners; |
420 DcfListeners m_dcfListeners; | 587 DcfListeners m_dcfListeners; |
421 | 588 |
422 EventId m_normalAckTimeoutEvent; | 589 EventId m_normalAckTimeoutEvent; |
423 EventId m_fastAckTimeoutEvent; | 590 EventId m_fastAckTimeoutEvent; |
424 EventId m_superFastAckTimeoutEvent; | 591 EventId m_superFastAckTimeoutEvent; |
425 EventId m_fastAckFailedTimeoutEvent; | 592 EventId m_fastAckFailedTimeoutEvent; |
| 593 EventId m_blockAckTimeoutEvent; |
426 EventId m_ctsTimeoutEvent; | 594 EventId m_ctsTimeoutEvent; |
427 EventId m_sendCtsEvent; | 595 EventId m_sendCtsEvent; |
428 EventId m_sendAckEvent; | 596 EventId m_sendAckEvent; |
429 EventId m_sendDataEvent; | 597 EventId m_sendDataEvent; |
430 EventId m_waitSifsEvent; | 598 EventId m_waitSifsEvent; |
431 EventId m_navCounterResetCtsMissed; | 599 EventId m_navCounterResetCtsMissed; |
432 | 600 |
433 Ptr<Packet> m_currentPacket; | 601 Ptr<Packet> m_currentPacket; |
434 WifiMacHeader m_currentHdr; | 602 WifiMacHeader m_currentHdr; |
435 MacLowTransmissionParameters m_txParams; | 603 MacLowTransmissionParameters m_txParams; |
436 MacLowTransmissionListener *m_listener; | 604 MacLowTransmissionListener *m_listener; |
437 Mac48Address m_self; | 605 Mac48Address m_self; |
438 Mac48Address m_bssid; | 606 Mac48Address m_bssid; |
439 Time m_ackTimeout; | 607 Time m_ackTimeout; |
| 608 Time m_basicBlockAckTimeout; |
| 609 Time m_compressedBlockAckTimeout; |
440 Time m_ctsTimeout; | 610 Time m_ctsTimeout; |
441 Time m_sifs; | 611 Time m_sifs; |
442 Time m_slotTime; | 612 Time m_slotTime; |
443 Time m_pifs; | 613 Time m_pifs; |
444 | 614 |
445 Time m_lastNavStart; | 615 Time m_lastNavStart; |
446 Time m_lastNavDuration; | 616 Time m_lastNavDuration; |
447 | 617 |
448 // Listerner needed to monitor when a channel switching occurs.· | 618 // Listerner needed to monitor when a channel switching occurs.· |
449 class PhyMacLowListener *m_phyMacLowListener;· | 619 class PhyMacLowListener *m_phyMacLowListener;· |
| 620 |
| 621 /* |
| 622 * BlockAck data structures. |
| 623 */ |
| 624 typedef std::pair<Ptr<Packet>, WifiMacHeader> BufferedPacket; |
| 625 typedef std::list<BufferedPacket>::iterator BufferedPacketI; |
| 626 |
| 627 typedef std::pair<Mac48Address, uint8_t> AgreementKey; |
| 628 typedef std::pair<BlockAckAgreement, std::list<BufferedPacket> > AgreementValu
e; |
| 629 |
| 630 typedef std::map<AgreementKey, AgreementValue> Agreements; |
| 631 typedef std::map<AgreementKey, AgreementValue>::iterator AgreementsI; |
| 632 |
| 633 Agreements m_bAckAgreements; |
| 634 ·· |
| 635 typedef std::map<AccessClass, MacLowBlockAckEventListener*> QueueListeners; |
| 636 QueueListeners m_edcaListeners; |
450 }; | 637 }; |
451 | 638 |
452 } // namespace ns3 | 639 } // namespace ns3 |
453 | 640 |
454 #endif /* MAC_LOW_H */ | 641 #endif /* MAC_LOW_H */ |
OLD | NEW |