Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 * Copyright (c) 2009 MIRKO BANCHI |
5 * | 5 * |
6 * 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 |
7 * 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· |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * 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, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 * and contains information about the correct reception· | 92 * and contains information about the correct reception· |
93 * of a set of packet for which a normal ack wasn't send. | 93 * of a set of packet for which a normal ack wasn't send. |
94 * Default implementation for this method is empty. Every | 94 * Default implementation for this method is empty. Every |
95 * queue that intends to be notified by MacLow of reception | 95 * queue that intends to be notified by MacLow of reception |
96 * of a block ack must redefine this function. | 96 * of a block ack must redefine this function. |
97 */ | 97 */ |
98 virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source); | 98 virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source); |
99 /** | 99 /** |
100 * ns3::MacLow did not receive an expected BLOCK_ACK within | 100 * ns3::MacLow did not receive an expected BLOCK_ACK within |
101 * BlockAckTimeout. This method is used only for immediate· | 101 * BlockAckTimeout. This method is used only for immediate· |
102 * block ack variant. With delayed block ack will be called | 102 * block ack variant. With delayed block ack, the MissedAck method will be |
Mathieu Lacage
2009/11/25 09:17:29
With delayed block ack, the MissedAck method will
| |
103 * MissedAck method instead, because upon receipt of a block ack | 103 * called instead: upon receipt of a block ack request, the rx station will |
104 * request rx station will reply with an ack frame. | 104 * reply with a normal ack frame. Later, when the rx station gets a txop, it |
105 * After that, rx station (in another txop) will send a block ack | 105 * will send the block ack back to the tx station which will reply with a |
106 * frame to tx station and tx station will reply with an ack frame. | 106 * normal ack to the rx station. |
107 */ | 107 */ |
108 virtual void MissedBlockAck (void); | 108 virtual void MissedBlockAck (void); |
109 /** | 109 /** |
110 * Invoked when ns3::MacLow wants to start a new transmission | 110 * Invoked when ns3::MacLow wants to start a new transmission |
111 * as configured by MacLowTransmissionParameters::EnableNextData. | 111 * as configured by MacLowTransmissionParameters::EnableNextData. |
112 * The listener is expected to call again MacLow::StartTransmission | 112 * The listener is expected to call again MacLow::StartTransmission |
113 * with the "next" data to send. | 113 * with the "next" data to send. |
114 */ | 114 */ |
115 virtual void StartNext (void) = 0; | 115 virtual void StartNext (void) = 0; |
116 | 116 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 }; | 352 }; |
353 | 353 |
354 std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters ¶ms); | 354 std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters ¶ms); |
355 | 355 |
356 | 356 |
357 /** | 357 /** |
358 * \brief handle RTS/CTS/DATA/ACK transactions. | 358 * \brief handle RTS/CTS/DATA/ACK transactions. |
359 */ | 359 */ |
360 class MacLow : public Object { | 360 class MacLow : public Object { |
361 public: | 361 public: |
362 typedef Callback<void, Ptr<Packet> , WifiMacHeader const*> MacLowRxCallback; | 362 typedef Callback<void, Ptr<Packet>, const WifiMacHeader*> MacLowRxCallback; |
363 | 363 |
364 MacLow (); | 364 MacLow (); |
365 virtual ~MacLow (); | 365 virtual ~MacLow (); |
366 | 366 |
367 void SetPhy (Ptr<WifiPhy> phy); | 367 void SetPhy (Ptr<WifiPhy> phy); |
368 void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> manager); | 368 void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> manager); |
369 | 369 |
370 void SetAddress (Mac48Address ad); | 370 void SetAddress (Mac48Address ad); |
371 void SetAckTimeout (Time ackTimeout); | 371 void SetAckTimeout (Time ackTimeout); |
372 void SetBasicBlockAckTimeout (Time blockAckTimeout); | 372 void SetBasicBlockAckTimeout (Time blockAckTimeout); |
(...skipping 28 matching lines...) Expand all Loading... | |
401 | 401 |
402 /** | 402 /** |
403 * \param packet to send (does not include the 802.11 MAC header and checksum) | 403 * \param packet to send (does not include the 802.11 MAC header and checksum) |
404 * \param hdr header associated to the packet to send. | 404 * \param hdr header associated to the packet to send. |
405 * \param parameters transmission parameters of packet. | 405 * \param parameters transmission parameters of packet. |
406 * | 406 * |
407 * This transmission time includes the time required for | 407 * This transmission time includes the time required for |
408 * the next packet transmission if one was selected. | 408 * the next packet transmission if one was selected. |
409 */ | 409 */ |
410 Time CalculateTransmissionTime (Ptr<const Packet> packet, | 410 Time CalculateTransmissionTime (Ptr<const Packet> packet, |
411 WifiMacHeader const*hdr,· | 411 const WifiMacHeader* hdr,· |
412 MacLowTransmissionParameters const¶meters) const; | 412 const MacLowTransmissionParameters& parameters ) const; |
413 | 413 |
414 /** | 414 /** |
415 * \param packet packet to send | 415 * \param packet packet to send |
416 * \param hdr 802.11 header for packet to send | 416 * \param hdr 802.11 header for packet to send |
417 * \param parameters the transmission parameters to use for this packet. | 417 * \param parameters the transmission parameters to use for this packet. |
418 * \param listener listen to transmission events. | 418 * \param listener listen to transmission events. |
419 * | 419 * |
420 * Start the transmission of the input packet and notify the listener | 420 * Start the transmission of the input packet and notify the listener |
421 * of transmission events. | 421 * of transmission events. |
422 */ | 422 */ |
423 void StartTransmission (Ptr<const Packet> packet,· | 423 void StartTransmission (Ptr<const Packet> packet,· |
424 WifiMacHeader const*hdr,· | 424 const WifiMacHeader* hdr,· |
425 MacLowTransmissionParameters parameters, | 425 MacLowTransmissionParameters parameters, |
426 MacLowTransmissionListener *listener); | 426 MacLowTransmissionListener *listener); |
427 | 427 |
428 /** | 428 /** |
429 * \param packet packet received | 429 * \param packet packet received |
430 * \param rxSnr snr of packet received | 430 * \param rxSnr snr of packet received |
431 * \param txMode transmission mode of packet received | 431 * \param txMode transmission mode of packet received |
432 * \param preamble type of preamble used for the packet received | 432 * \param preamble type of preamble used for the packet received |
433 * | 433 * |
434 * This method is typically invoked by the lower PHY layer to notify | 434 * This method is typically invoked by the lower PHY layer to notify |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 * \param tid TID for which Block Ack was created. | 468 * \param tid TID for which Block Ack was created. |
469 * | 469 * |
470 * Checks if exists an established block ack agreement with <i>originator</i> | 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 | 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>. | 472 * invoked when a DELBA frame is received from <i>originator</i>. |
473 */ | 473 */ |
474 void DestroyBlockAckAgreement (Mac48Address originator, uint8_t tid); | 474 void DestroyBlockAckAgreement (Mac48Address originator, uint8_t tid); |
475 /** | 475 /** |
476 * \param ac Access class managed by the queue. | 476 * \param ac Access class managed by the queue. |
477 * \param listener The listener for 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. | |
478 */ | 481 */ |
479 void RegisterBlockAckListenerForAc (enum AccessClass ac, MacLowBlockAckEventLi stener *listener); | 482 void RegisterBlockAckListenerForAc (enum AccessClass ac, MacLowBlockAckEventLi stener *listener); |
Mathieu Lacage
2009/11/25 09:17:29
The lifetime of the registered listener is typical
| |
480 private: | 483 private: |
481 void CancelAllEvents (void); | 484 void CancelAllEvents (void); |
482 uint32_t GetAckSize (void) const; | 485 uint32_t GetAckSize (void) const; |
483 uint32_t GetBlockAckSize (enum BlockAckType type) const; | 486 uint32_t GetBlockAckSize (enum BlockAckType type) const; |
484 uint32_t GetRtsSize (void) const; | 487 uint32_t GetRtsSize (void) const; |
485 uint32_t GetCtsSize (void) const; | 488 uint32_t GetCtsSize (void) const; |
486 uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const; | 489 uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr) const; |
487 Time NowUs (void) const; | 490 Time NowUs (void) const; |
488 WifiRemoteStation *GetStation (Mac48Address to) const; | 491 WifiRemoteStation *GetStation (Mac48Address to) const; |
489 void ForwardDown (Ptr<const Packet> packet, WifiMacHeader const *hdr,· | 492 void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr,· |
490 WifiMode txMode); | 493 WifiMode txMode); |
491 Time CalculateOverallTxTime (Ptr<const Packet> packet, | 494 Time CalculateOverallTxTime (Ptr<const Packet> packet, |
492 WifiMacHeader const*hdr,· | 495 const WifiMacHeader* hdr,· |
493 MacLowTransmissionParameters const ¶ms) const ; | 496 const MacLowTransmissionParameters ¶ms) const ; |
494 WifiMode GetRtsTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) con st; | 497 WifiMode GetRtsTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) con st; |
495 WifiMode GetDataTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) co nst; | 498 WifiMode GetDataTxMode (Ptr<const Packet> packet, const WifiMacHeader *hdr) co nst; |
496 WifiMode GetCtsTxModeForRts (Mac48Address to, WifiMode rtsTxMode) const; | 499 WifiMode GetCtsTxModeForRts (Mac48Address to, WifiMode rtsTxMode) const; |
497 WifiMode GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const; | 500 WifiMode GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const; |
498 | 501 |
499 Time GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const; | 502 Time GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const; |
500 Time GetAckDuration (Mac48Address to, WifiMode dataTxMode) const; | 503 Time GetAckDuration (Mac48Address to, WifiMode dataTxMode) const; |
501 Time GetBlockAckDuration (Mac48Address to, WifiMode blockAckReqTxMode, enum Bl ockAckType type) const; | 504 Time GetBlockAckDuration (Mac48Address to, WifiMode blockAckReqTxMode, enum Bl ockAckType type) const; |
502 void NotifyNav (const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamb le); | 505 void NotifyNav (const WifiMacHeader &hdr, WifiMode txMode, WifiPreamble preamb le); |
503 void DoNavResetNow (Time duration); | 506 void DoNavResetNow (Time duration); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 * If there is, store the packet without pass it up to WifiMac. The packet is buffered | 556 * If there is, store the packet without pass it up to WifiMac. The packet is buffered |
554 * in order of increasing sequence control field. All comparison are performed | 557 * in order of increasing sequence control field. All comparison are performed |
555 * circularly modulo 2^12. | 558 * circularly modulo 2^12. |
556 */ | 559 */ |
557 bool StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr); | 560 bool StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr); |
558 /* | 561 /* |
559 * Invoked after that a block ack request has been received. Looks for corresp onding | 562 * Invoked after that a block ack request has been received. Looks for corresp onding |
560 * block ack agreement and creates block ack bitmap on a received packets basi s. | 563 * block ack agreement and creates block ack bitmap on a received packets basi s. |
561 */ | 564 */ |
562 void SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Mac 48Address originator, | 565 void SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Mac 48Address originator, |
563 Time duration, WifiMode txMode); | 566 Time duration, WifiMode blockAckReqTxMo de); |
564 /* | 567 /* |
565 * This method creates block ack frame with header equals to <i>blockAck</i> a nd start its transmission. | 568 * This method creates block ack frame with header equals to <i>blockAck</i> a nd start its transmission. |
566 */ | 569 */ |
567 void SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Addres s originator, bool immediate, | 570 void SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Addres s originator, bool immediate, |
568 Time duration, WifiMode txMode); | 571 Time duration, WifiMode blockAckReqTxMode); |
569 /* | 572 /* |
570 * Every time that a block ack request or a packet with ack policy equals to < i>block ack</i> | 573 * Every time that a block ack request or a packet with ack policy equals to < i>block ack</i> |
571 * are received, if a relative block ack agreement exists and the value of ina ctivity timeout | 574 * are received, if a relative block ack agreement exists and the value of ina ctivity timeout |
572 * is not 0, the timer is reset. | 575 * is not 0, the timer is reset. |
573 * see section 11.5.3 in IEEE802.11e for more details. | 576 * see section 11.5.3 in IEEE802.11e for more details. |
574 */ | 577 */ |
575 void ResetBlockAckInactivityTimerIfNeeded (BlockAckAgreement &agreement); | 578 void ResetBlockAckInactivityTimerIfNeeded (BlockAckAgreement &agreement); |
576 | 579 |
577 void SetupPhyMacLowListener (Ptr<WifiPhy> phy);· | 580 void SetupPhyMacLowListener (Ptr<WifiPhy> phy);· |
578 | 581 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 | 632 |
630 Agreements m_bAckAgreements; | 633 Agreements m_bAckAgreements; |
631 ·· | 634 ·· |
632 typedef std::map<AccessClass, MacLowBlockAckEventListener*> QueueListeners; | 635 typedef std::map<AccessClass, MacLowBlockAckEventListener*> QueueListeners; |
633 QueueListeners m_edcaListeners; | 636 QueueListeners m_edcaListeners; |
634 }; | 637 }; |
635 | 638 |
636 } // namespace ns3 | 639 } // namespace ns3 |
637 | 640 |
638 #endif /* MAC_LOW_H */ | 641 #endif /* MAC_LOW_H */ |
LEFT | RIGHT |