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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 * GNU General Public License for more details. | 13 * GNU General Public License for more details. |
14 * | 14 * |
15 * 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 |
16 * along with this program; if not, write to the Free Software | 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 | 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 * | 18 * |
19 * 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> | 20 * Author: Mirko Banchi <mk.banchi@gmail.com> |
21 * Author: Cecchi Niccolò <insa@igeek.it> | |
22 */ | 21 */ |
23 | 22 |
24 #include "ns3/assert.h" | 23 #include "ns3/assert.h" |
25 #include "ns3/packet.h" | 24 #include "ns3/packet.h" |
26 #include "ns3/simulator.h" | 25 #include "ns3/simulator.h" |
27 #include "ns3/tag.h" | 26 #include "ns3/tag.h" |
28 #include "ns3/log.h" | 27 #include "ns3/log.h" |
29 #include "ns3/node.h" | 28 #include "ns3/node.h" |
30 | 29 |
31 #include "mac-low.h" | 30 #include "mac-low.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 Mac48Address source) | 119 Mac48Address source) |
121 {} | 120 {} |
122 void | 121 void |
123 MacLowTransmissionListener::MissedBlockAck (void) | 122 MacLowTransmissionListener::MissedBlockAck (void) |
124 {} | 123 {} |
125 MacLowDcfListener::MacLowDcfListener () | 124 MacLowDcfListener::MacLowDcfListener () |
126 {} | 125 {} |
127 MacLowDcfListener::~MacLowDcfListener () | 126 MacLowDcfListener::~MacLowDcfListener () |
128 {} | 127 {} |
129 | 128 |
| 129 MacLowBlockAckEventListener::MacLowBlockAckEventListener () |
| 130 {} |
| 131 MacLowBlockAckEventListener::~MacLowBlockAckEventListener () |
| 132 {} |
| 133 |
130 MacLowTransmissionParameters::MacLowTransmissionParameters () | 134 MacLowTransmissionParameters::MacLowTransmissionParameters () |
131 : m_nextSize (0), | 135 : m_nextSize (0), |
132 m_waitAck (ACK_NONE), | 136 m_waitAck (ACK_NONE), |
133 m_sendRts (false), | 137 m_sendRts (false), |
134 m_overrideDurationId (Seconds (0)) | 138 m_overrideDurationId (Seconds (0)) |
135 {} | 139 {} |
136 void· | 140 void· |
137 MacLowTransmissionParameters::EnableNextData (uint32_t size) | 141 MacLowTransmissionParameters::EnableNextData (uint32_t size) |
138 { | 142 { |
139 m_nextSize = size; | 143 m_nextSize = size; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 m_sendRts = true; | 198 m_sendRts = true; |
195 } | 199 } |
196 void· | 200 void· |
197 MacLowTransmissionParameters::DisableRts (void) | 201 MacLowTransmissionParameters::DisableRts (void) |
198 { | 202 { |
199 m_sendRts = false; | 203 m_sendRts = false; |
200 } | 204 } |
201 bool· | 205 bool· |
202 MacLowTransmissionParameters::MustWaitAck (void) const | 206 MacLowTransmissionParameters::MustWaitAck (void) const |
203 { | 207 { |
204 return (m_waitAck != ACK_NONE)?true:false; | 208 return (m_waitAck != ACK_NONE); |
205 } | 209 } |
206 bool· | 210 bool· |
207 MacLowTransmissionParameters::MustWaitNormalAck (void) const | 211 MacLowTransmissionParameters::MustWaitNormalAck (void) const |
208 { | 212 { |
209 return (m_waitAck == ACK_NORMAL)?true:false; | 213 return (m_waitAck == ACK_NORMAL); |
210 } | 214 } |
211 bool· | 215 bool· |
212 MacLowTransmissionParameters::MustWaitFastAck (void) const | 216 MacLowTransmissionParameters::MustWaitFastAck (void) const |
213 { | 217 { |
214 return (m_waitAck == ACK_FAST)?true:false; | 218 return (m_waitAck == ACK_FAST); |
215 } | 219 } |
216 bool· | 220 bool· |
217 MacLowTransmissionParameters::MustWaitSuperFastAck (void) const | 221 MacLowTransmissionParameters::MustWaitSuperFastAck (void) const |
218 { | 222 { |
219 return (m_waitAck == ACK_SUPER_FAST)?true:false; | 223 return (m_waitAck == ACK_SUPER_FAST); |
220 } | 224 } |
221 bool | 225 bool |
222 MacLowTransmissionParameters::MustWaitBasicBlockAck (void) const | 226 MacLowTransmissionParameters::MustWaitBasicBlockAck (void) const |
223 { | 227 { |
224 return (m_waitAck == BLOCK_ACK_BASIC)?true:false; | 228 return (m_waitAck == BLOCK_ACK_BASIC)?true:false; |
225 } | 229 } |
226 bool | 230 bool |
227 MacLowTransmissionParameters::MustWaitCompressedBlockAck (void) const | 231 MacLowTransmissionParameters::MustWaitCompressedBlockAck (void) const |
228 { | 232 { |
229 return (m_waitAck == BLOCK_ACK_COMPRESSED)?true:false; | 233 return (m_waitAck == BLOCK_ACK_COMPRESSED)?true:false; |
230 } | 234 } |
231 bool | 235 bool |
232 MacLowTransmissionParameters::MustWaitMultiTidBlockAck (void) const | 236 MacLowTransmissionParameters::MustWaitMultiTidBlockAck (void) const |
233 { | 237 { |
234 return (m_waitAck == BLOCK_ACK_MULTI_TID)?true:false; | 238 return (m_waitAck == BLOCK_ACK_MULTI_TID)?true:false; |
235 } | 239 } |
236 bool· | 240 bool· |
237 MacLowTransmissionParameters::MustSendRts (void) const | 241 MacLowTransmissionParameters::MustSendRts (void) const |
238 { | 242 { |
239 return m_sendRts; | 243 return m_sendRts; |
240 } | 244 } |
241 bool· | 245 bool· |
242 MacLowTransmissionParameters::HasDurationId (void) const | 246 MacLowTransmissionParameters::HasDurationId (void) const |
243 { | 247 { |
244 return (m_overrideDurationId != Seconds (0))?true:false; | 248 return (m_overrideDurationId != Seconds (0)); |
245 } | 249 } |
246 Time | 250 Time |
247 MacLowTransmissionParameters::GetDurationId (void) const | 251 MacLowTransmissionParameters::GetDurationId (void) const |
248 { | 252 { |
249 NS_ASSERT (m_overrideDurationId != Seconds (0)); | 253 NS_ASSERT (m_overrideDurationId != Seconds (0)); |
250 return m_overrideDurationId; | 254 return m_overrideDurationId; |
251 } | 255 } |
252 bool· | 256 bool· |
253 MacLowTransmissionParameters::HasNextPacket (void) const | 257 MacLowTransmissionParameters::HasNextPacket (void) const |
254 { | 258 { |
255 return (m_nextSize != 0)?true:false; | 259 return (m_nextSize != 0); |
256 } | 260 } |
257 uint32_t· | 261 uint32_t· |
258 MacLowTransmissionParameters::GetNextPacketSize (void) const | 262 MacLowTransmissionParameters::GetNextPacketSize (void) const |
259 { | 263 { |
260 NS_ASSERT (HasNextPacket ()); | 264 NS_ASSERT (HasNextPacket ()); |
261 return m_nextSize; | 265 return m_nextSize; |
262 } | 266 } |
263 | 267 |
264 std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters
¶ms) | 268 std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters
¶ms) |
265 { | 269 { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 { | 352 { |
349 m_phyMacLowListener = new PhyMacLowListener (this);· | 353 m_phyMacLowListener = new PhyMacLowListener (this);· |
350 phy->RegisterListener (m_phyMacLowListener); | 354 phy->RegisterListener (m_phyMacLowListener); |
351 } | 355 } |
352 | 356 |
353 | 357 |
354 void· | 358 void· |
355 MacLow::DoDispose (void) | 359 MacLow::DoDispose (void) |
356 { | 360 { |
357 NS_LOG_FUNCTION (this); | 361 NS_LOG_FUNCTION (this); |
358 CancelAllEvents (); | 362 m_normalAckTimeoutEvent.Cancel (); |
| 363 m_fastAckTimeoutEvent.Cancel (); |
| 364 m_superFastAckTimeoutEvent.Cancel (); |
| 365 m_fastAckFailedTimeoutEvent.Cancel (); |
| 366 m_blockAckTimeoutEvent.Cancel (); |
| 367 m_ctsTimeoutEvent.Cancel (); |
| 368 m_sendCtsEvent.Cancel (); |
| 369 m_sendAckEvent.Cancel (); |
| 370 m_sendDataEvent.Cancel (); |
| 371 m_waitSifsEvent.Cancel (); |
359 m_phy = 0; | 372 m_phy = 0; |
360 m_stationManager = 0; | 373 m_stationManager = 0; |
361 delete m_phyMacLowListener; | 374 delete m_phyMacLowListener; |
362 m_phyMacLowListener = 0; | 375 m_phyMacLowListener = 0; |
363 for (std::map<AccessClass, Ptr<EdcaTxopN> >::iterator it = m_edcaQueues.begin
(); it != m_edcaQueues.end (); it++) | |
364 { | |
365 it->second = 0; | |
366 } | |
367 } | 376 } |
368 | 377 |
369 void | 378 void |
370 MacLow::CancelAllEvents (void) | 379 MacLow::CancelAllEvents (void) |
371 { | 380 { |
372 NS_LOG_FUNCTION (this); | 381 NS_LOG_FUNCTION (this); |
373 bool oneRunning = false; | 382 bool oneRunning = false; |
374 if (m_normalAckTimeoutEvent.IsRunning ())· | 383 if (m_normalAckTimeoutEvent.IsRunning ())· |
375 { | 384 { |
376 m_normalAckTimeoutEvent.Cancel (); | 385 m_normalAckTimeoutEvent.Cancel (); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 } | 549 } |
541 void· | 550 void· |
542 MacLow::RegisterDcfListener (MacLowDcfListener *listener) | 551 MacLow::RegisterDcfListener (MacLowDcfListener *listener) |
543 { | 552 { |
544 m_dcfListeners.push_back (listener); | 553 m_dcfListeners.push_back (listener); |
545 } | 554 } |
546 | 555 |
547 | 556 |
548 void· | 557 void· |
549 MacLow::StartTransmission (Ptr<const Packet> packet,· | 558 MacLow::StartTransmission (Ptr<const Packet> packet,· |
550 WifiMacHeader const*hdr,· | 559 const WifiMacHeader* hdr,· |
551 MacLowTransmissionParameters params, | 560 MacLowTransmissionParameters params, |
552 MacLowTransmissionListener *listener) | 561 MacLowTransmissionListener *listener) |
553 { | 562 { |
554 NS_LOG_FUNCTION (this << packet << hdr << params << listener); | 563 NS_LOG_FUNCTION (this << packet << hdr << params << listener); |
555 /* m_currentPacket is not NULL because someone started | 564 /* m_currentPacket is not NULL because someone started |
556 * a transmission and was interrupted before one of: | 565 * a transmission and was interrupted before one of: |
557 * - ctsTimeout | 566 * - ctsTimeout |
558 * - sendDataAfterCTS | 567 * - sendDataAfterCTS |
559 * expired. This means that one of these timers is still | 568 * expired. This means that one of these timers is still |
560 * running. They are all cancelled below anyway by the· | 569 * running. They are all cancelled below anyway by the· |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 NS_LOG_DEBUG ("rx blockAckRequest/sendImmediateBlockAck from="
<< hdr.GetAddr2 ()); | 758 NS_LOG_DEBUG ("rx blockAckRequest/sendImmediateBlockAck from="
<< hdr.GetAddr2 ()); |
750 m_sendAckEvent = Simulator::Schedule (GetSifs (), | 759 m_sendAckEvent = Simulator::Schedule (GetSifs (), |
751 &MacLow::SendBlockAckAft
erBlockAckRequest, this, | 760 &MacLow::SendBlockAckAft
erBlockAckRequest, this, |
752 blockAckReq, | 761 blockAckReq, |
753 hdr.GetAddr2 (),· | 762 hdr.GetAddr2 (),· |
754 hdr.GetDuration (), | 763 hdr.GetDuration (), |
755 txMode); | 764 txMode); |
756 } | 765 } |
757 else | 766 else |
758 { | 767 { |
759 //Delayed block ack... | 768 NS_FATAL_ERROR ("Delayed block ack not supported."); |
760 } | 769 } |
761 } | 770 } |
762 else | 771 else |
763 { | 772 { |
764 //There's not a valid agreement for this block ack request | 773 NS_LOG_DEBUG ("There's not a valid agreement for this block ack re
quest."); |
765 } | 774 } |
766 } | 775 } |
767 else | 776 else |
768 { | 777 { |
769 //Multi-tid block ack not supported | 778 NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
770 NS_ASSERT (false); | |
771 } | 779 } |
772 } | 780 } |
773 else if (hdr.IsCtl ())· | 781 else if (hdr.IsCtl ())· |
774 { | 782 { |
775 NS_LOG_DEBUG ("rx drop " << hdr.GetTypeString ()); | 783 NS_LOG_DEBUG ("rx drop " << hdr.GetTypeString ()); |
776 }· | 784 }· |
777 else if (hdr.GetAddr1 () == m_self)· | 785 else if (hdr.GetAddr1 () == m_self)· |
778 { | 786 { |
779 WifiRemoteStation *station = GetStation (hdr.GetAddr2 ()); | 787 WifiRemoteStation *station = GetStation (hdr.GetAddr2 ()); |
780 station->ReportRxOk (rxSnr, txMode); | 788 station->ReportRxOk (rxSnr, txMode); |
781 ······ | 789 ······ |
782 if (hdr.IsQosData () && StoreMpduIfNeeded (packet, hdr))· | 790 if (hdr.IsQosData () && StoreMpduIfNeeded (packet, hdr))· |
783 { | 791 { |
784 /* From section 9.10.4 in IEEE802.11 | 792 /* From section 9.10.4 in IEEE802.11: |
785 Upon the receipt of a QoS data frame from the originator for which | 793 Upon the receipt of a QoS data frame from the originator for which |
786 the Block Ack agreement exists, the recipient shall buffer the MSDU | 794 the Block Ack agreement exists, the recipient shall buffer the MSDU |
787 regardless of the value of the Ack Policy subfield within the· | 795 regardless of the value of the Ack Policy subfield within the· |
788 QoS Control field of the QoS data frame. */ | 796 QoS Control field of the QoS data frame. */ |
789 if (hdr.IsQosAck ()) | 797 if (hdr.IsQosAck ()) |
790 { | 798 { |
791 //RxCompletedBufferedPacketsWithSmallerSequence () | 799 AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAdd
r2 (), hdr.GetQosTid ())); |
| 800 RxCompleteBufferedPacketsWithSmallerSequence (it->second.first.Get
StartingSequence (), |
| 801 hdr.GetAddr2 (), hdr
.GetQosTid ()); |
792 RxCompleteBufferedPackets (hdr.GetAddr2 (), hdr.GetQosTid ()); | 802 RxCompleteBufferedPackets (hdr.GetAddr2 (), hdr.GetQosTid ()); |
793 NS_ASSERT (m_sendAckEvent.IsExpired ()); | 803 NS_ASSERT (m_sendAckEvent.IsExpired ()); |
794 m_sendAckEvent = Simulator::Schedule (GetSifs (), | 804 m_sendAckEvent = Simulator::Schedule (GetSifs (), |
795 &MacLow::SendAckAfterData, t
his, | 805 &MacLow::SendAckAfterData, t
his, |
796 hdr.GetAddr2 (),· | 806 hdr.GetAddr2 (),· |
797 hdr.GetDuration (), | 807 hdr.GetDuration (), |
798 txMode, | 808 txMode, |
799 rxSnr); | 809 rxSnr); |
800 } | 810 } |
801 else if (hdr.IsQosBlockAck ()) | 811 else if (hdr.IsQosBlockAck ()) |
802 { | 812 { |
803 AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAdd
r2 (), hdr.GetQosTid ())); | 813 AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAdd
r2 (), hdr.GetQosTid ())); |
804 /* See section 11.5.3 in IEEE802.11 for mean of this timer */ | 814 /* See section 11.5.3 in IEEE802.11 for mean of this timer */ |
805 ResetBlockAckInactivityTimerIfNeeded (it->second.first); | 815 ResetBlockAckInactivityTimerIfNeeded (it->second.first); |
806 } | 816 } |
807 return;·· | 817 return;·· |
808 } | 818 } |
809 else if (hdr.IsQosData () && hdr.IsQosBlockAck ()) | 819 else if (hdr.IsQosData () && hdr.IsQosBlockAck ()) |
810 { | 820 { |
811 /* This happens if a packet with ack policy Block Ack is received and
a block ack | 821 /* This happens if a packet with ack policy Block Ack is received and
a block ack |
812 agreement fot that packet doesn't exists. | 822 agreement for that packet doesn't exist. |
813 | 823 |
814 From section 11.5.3 in IEEE802.11e: | 824 From section 11.5.3 in IEEE802.11e: |
815 When a recipient does not have an active Block ack for a TID, but r
eceives | 825 When a recipient does not have an active Block ack for a TID, but r
eceives |
816 data MPDUs with the Ack Policy subfield set to Block Ack, it shall
discard | 826 data MPDUs with the Ack Policy subfield set to Block Ack, it shall
discard |
817 them and shall send a DELBA frame using the normal access· | 827 them and shall send a DELBA frame using the normal access· |
818 mechanisms. */ | 828 mechanisms. */ |
819 ScheduleDelBaFrame (hdr.GetAddr2 (), hdr.GetQosTid ()); | 829 AccessClass ac = QosUtilsMapTidToAc (hdr.GetQosTid ()); |
| 830 m_edcaListeners[ac]->BlockAckInactivityTimeout (hdr.GetAddr2 (), hdr.G
etQosTid ()); |
820 return; | 831 return; |
821 } | 832 } |
822 else if (hdr.IsQosData () && hdr.IsQosNoAck ())· | 833 else if (hdr.IsQosData () && hdr.IsQosNoAck ())· |
823 { | 834 { |
824 NS_LOG_DEBUG ("rx unicast/noAck from="<<hdr.GetAddr2 ()); | 835 NS_LOG_DEBUG ("rx unicast/noAck from="<<hdr.GetAddr2 ()); |
825 }· | 836 }· |
826 else if (hdr.IsData () || hdr.IsMgt ())· | 837 else if (hdr.IsData () || hdr.IsMgt ())· |
827 { | 838 { |
828 NS_LOG_DEBUG ("rx unicast/sendAck from=" << hdr.GetAddr2 ()); | 839 NS_LOG_DEBUG ("rx unicast/sendAck from=" << hdr.GetAddr2 ()); |
829 NS_ASSERT (m_sendAckEvent.IsExpired ()); | 840 NS_ASSERT (m_sendAckEvent.IsExpired ()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 return ack.GetSize () + 4; | 879 return ack.GetSize () + 4; |
869 } | 880 } |
870 uint32_t | 881 uint32_t |
871 MacLow::GetBlockAckSize (enum BlockAckType type) const | 882 MacLow::GetBlockAckSize (enum BlockAckType type) const |
872 { | 883 { |
873 WifiMacHeader hdr; | 884 WifiMacHeader hdr; |
874 hdr.SetType (WIFI_MAC_CTL_BACKRESP); | 885 hdr.SetType (WIFI_MAC_CTL_BACKRESP); |
875 CtrlBAckResponseHeader blockAck; | 886 CtrlBAckResponseHeader blockAck; |
876 if (type == BASIC_BLOCK_ACK) | 887 if (type == BASIC_BLOCK_ACK) |
877 { | 888 { |
878 blockAck.SetVariant (BASIC_BLOCK_ACK); | 889 blockAck.SetType (BASIC_BLOCK_ACK); |
879 } | 890 } |
880 else if (type == COMPRESSED_BLOCK_ACK) | 891 else if (type == COMPRESSED_BLOCK_ACK) |
881 { | 892 { |
882 blockAck.SetVariant (COMPRESSED_BLOCK_ACK); | 893 blockAck.SetType (COMPRESSED_BLOCK_ACK); |
883 } | 894 } |
884 else if (type == MULTI_TID_BLOCK_ACK) | 895 else if (type == MULTI_TID_BLOCK_ACK) |
885 { | 896 { |
886 //Not implemented | 897 //Not implemented |
887 NS_ASSERT (false);·· | 898 NS_ASSERT (false);·· |
888 } | 899 } |
889 return hdr.GetSize () + blockAck.GetSerializedSize () + 4;· | 900 return hdr.GetSize () + blockAck.GetSerializedSize () + 4;· |
890 } | 901 } |
891 uint32_t· | 902 uint32_t· |
892 MacLow::GetRtsSize (void) const | 903 MacLow::GetRtsSize (void) const |
893 { | 904 { |
894 WifiMacHeader rts; | 905 WifiMacHeader rts; |
895 rts.SetType (WIFI_MAC_CTL_RTS); | 906 rts.SetType (WIFI_MAC_CTL_RTS); |
896 return rts.GetSize () + 4; | 907 return rts.GetSize () + 4; |
897 } | 908 } |
898 Time | 909 Time |
899 MacLow::GetAckDuration (Mac48Address to, WifiMode dataTxMode) const | 910 MacLow::GetAckDuration (Mac48Address to, WifiMode dataTxMode) const |
900 { | 911 { |
901 WifiMode ackMode = GetAckTxModeForData (to, dataTxMode); | 912 WifiMode ackMode = GetAckTxModeForData (to, dataTxMode); |
902 return m_phy->CalculateTxDuration (GetAckSize (), ackMode, WIFI_PREAMBLE_LONG)
; | 913 return m_phy->CalculateTxDuration (GetAckSize (), ackMode, WIFI_PREAMBLE_LONG)
; |
903 } | 914 } |
904 Time | 915 Time |
905 MacLow::GetBlockAckDuration (Mac48Address to, WifiMode txMode, enum BlockAckType
type) const | 916 MacLow::GetBlockAckDuration (Mac48Address to, WifiMode blockAckReqTxMode, enum B
lockAckType type) const |
906 { | 917 { |
907 /*· | 918 /*· |
908 * For immediate BlockAck we should transmit the frame with the same WifiMode | 919 * For immediate BlockAck we should transmit the frame with the same WifiMode |
909 * as the BlockAckReq. | 920 * as the BlockAckReq. |
910 * | 921 * |
911 * from section 9.6 in IEEE802.11e: | 922 * from section 9.6 in IEEE802.11e: |
912 * The BlockAck control frame shall be sent at the same rate and modulation cl
ass as | 923 * The BlockAck control frame shall be sent at the same rate and modulation cl
ass as |
913 * the BlockAckReq frame if it is sent in response to a BlockAckReq frame. | 924 * the BlockAckReq frame if it is sent in response to a BlockAckReq frame. |
914 */ | 925 */ |
915 return m_phy->CalculateTxDuration (GetBlockAckSize (type), txMode, WIFI_PREAMB
LE_LONG); | 926 return m_phy->CalculateTxDuration (GetBlockAckSize (type), blockAckReqTxMode,
WIFI_PREAMBLE_LONG); |
916 } | 927 } |
917 Time | 928 Time |
918 MacLow::GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const | 929 MacLow::GetCtsDuration (Mac48Address to, WifiMode rtsTxMode) const |
919 { | 930 { |
920 WifiMode ctsMode = GetCtsTxModeForRts (to, rtsTxMode); | 931 WifiMode ctsMode = GetCtsTxModeForRts (to, rtsTxMode); |
921 return m_phy->CalculateTxDuration (GetCtsSize (), ctsMode, WIFI_PREAMBLE_LONG)
; | 932 return m_phy->CalculateTxDuration (GetCtsSize (), ctsMode, WIFI_PREAMBLE_LONG)
; |
922 } | 933 } |
923 uint32_t· | 934 uint32_t· |
924 MacLow::GetCtsSize (void) const | 935 MacLow::GetCtsSize (void) const |
925 { | 936 { |
(...skipping 30 matching lines...) Expand all Loading... |
956 } | 967 } |
957 WifiMode | 968 WifiMode |
958 MacLow::GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const | 969 MacLow::GetAckTxModeForData (Mac48Address to, WifiMode dataTxMode) const |
959 { | 970 { |
960 return GetStation (to)->GetAckMode (dataTxMode); | 971 return GetStation (to)->GetAckMode (dataTxMode); |
961 } | 972 } |
962 | 973 |
963 | 974 |
964 Time | 975 Time |
965 MacLow::CalculateOverallTxTime (Ptr<const Packet> packet, | 976 MacLow::CalculateOverallTxTime (Ptr<const Packet> packet, |
966 WifiMacHeader const*hdr,· | 977 const WifiMacHeader* hdr,· |
967 MacLowTransmissionParameters const& params) cons
t | 978 const MacLowTransmissionParameters& params) cons
t |
968 { | 979 { |
969 Time txTime = Seconds (0); | 980 Time txTime = Seconds (0); |
970 WifiMode rtsMode = GetRtsTxMode (packet, hdr); | 981 WifiMode rtsMode = GetRtsTxMode (packet, hdr); |
971 WifiMode dataMode = GetDataTxMode (packet, hdr); | 982 WifiMode dataMode = GetDataTxMode (packet, hdr); |
972 if (params.MustSendRts ())· | 983 if (params.MustSendRts ())· |
973 { | 984 { |
974 txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsMode, WIFI_PREAMBL
E_LONG); | 985 txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsMode, WIFI_PREAMBL
E_LONG); |
975 txTime += GetCtsDuration (hdr->GetAddr1 (), rtsMode); | 986 txTime += GetCtsDuration (hdr->GetAddr1 (), rtsMode); |
976 txTime += GetSifs () * Scalar (2); | 987 txTime += GetSifs () * Scalar (2); |
977 } | 988 } |
978 uint32_t dataSize = GetSize (packet, hdr); | 989 uint32_t dataSize = GetSize (packet, hdr); |
979 txTime += m_phy->CalculateTxDuration (dataSize, dataMode, WIFI_PREAMBLE_LONG); | 990 txTime += m_phy->CalculateTxDuration (dataSize, dataMode, WIFI_PREAMBLE_LONG); |
980 if (params.MustWaitAck ()) | 991 if (params.MustWaitAck ()) |
981 { | 992 { |
982 txTime += GetSifs (); | 993 txTime += GetSifs (); |
983 txTime += GetAckDuration (hdr->GetAddr1 (), dataMode); | 994 txTime += GetAckDuration (hdr->GetAddr1 (), dataMode); |
984 } | 995 } |
985 return txTime; | 996 return txTime; |
986 } | 997 } |
987 | 998 |
988 Time | 999 Time |
989 MacLow::CalculateTransmissionTime (Ptr<const Packet> packet, | 1000 MacLow::CalculateTransmissionTime (Ptr<const Packet> packet, |
990 WifiMacHeader const*hdr,· | 1001 const WifiMacHeader* hdr,· |
991 MacLowTransmissionParameters const& params) c
onst | 1002 const MacLowTransmissionParameters& params) c
onst |
992 { | 1003 { |
993 Time txTime = CalculateOverallTxTime (packet, hdr, params); | 1004 Time txTime = CalculateOverallTxTime (packet, hdr, params); |
994 if (params.HasNextPacket ())· | 1005 if (params.HasNextPacket ())· |
995 { | 1006 { |
996 WifiMode dataMode = GetDataTxMode (packet, hdr); | 1007 WifiMode dataMode = GetDataTxMode (packet, hdr); |
997 txTime += GetSifs (); | 1008 txTime += GetSifs (); |
998 txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataMod
e, WIFI_PREAMBLE_LONG); | 1009 txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataMod
e, WIFI_PREAMBLE_LONG); |
999 } | 1010 } |
1000 return txTime; | 1011 return txTime; |
1001 } | 1012 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 void | 1115 void |
1105 MacLow::NotifyCtsTimeoutResetNow () | 1116 MacLow::NotifyCtsTimeoutResetNow () |
1106 { | 1117 { |
1107 for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i
++)· | 1118 for (DcfListenersCI i = m_dcfListeners.begin (); i != m_dcfListeners.end (); i
++)· |
1108 { | 1119 { |
1109 (*i)->CtsTimeoutReset (); | 1120 (*i)->CtsTimeoutReset (); |
1110 } | 1121 } |
1111 } | 1122 } |
1112 | 1123 |
1113 void | 1124 void |
1114 MacLow::ForwardDown (Ptr<const Packet> packet, WifiMacHeader const* hdr,· | 1125 MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr,· |
1115 WifiMode txMode) | 1126 WifiMode txMode) |
1116 { | 1127 { |
1117 NS_LOG_FUNCTION (this << packet << hdr << txMode); | 1128 NS_LOG_FUNCTION (this << packet << hdr << txMode); |
1118 NS_LOG_DEBUG ("send " << hdr->GetTypeString () << | 1129 NS_LOG_DEBUG ("send " << hdr->GetTypeString () << |
1119 ", to=" << hdr->GetAddr1 () << | 1130 ", to=" << hdr->GetAddr1 () << |
1120 ", size=" << packet->GetSize () << | 1131 ", size=" << packet->GetSize () << |
1121 ", mode=" << txMode << | 1132 ", mode=" << txMode << |
1122 ", duration=" << hdr->GetDuration () << | 1133 ", duration=" << hdr->GetDuration () << |
1123 ", seq=0x"<< std::hex << m_currentHdr.GetSequenceControl () << std::
dec); | 1134 ", seq=0x"<< std::hex << m_currentHdr.GetSequenceControl () << std::
dec); |
1124 m_phy->SendPacket (packet, txMode, WIFI_PREAMBLE_LONG, 0); | 1135 m_phy->SendPacket (packet, txMode, WIFI_PREAMBLE_LONG, 0); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 ·· | 1538 ·· |
1528 std::list<BufferedPacket> buffer (0); | 1539 std::list<BufferedPacket> buffer (0); |
1529 AgreementKey key (originator, respHdr->GetTid ()); | 1540 AgreementKey key (originator, respHdr->GetTid ()); |
1530 AgreementValue value (agreement, buffer); | 1541 AgreementValue value (agreement, buffer); |
1531 m_bAckAgreements.insert (std::make_pair (key, value)); | 1542 m_bAckAgreements.insert (std::make_pair (key, value)); |
1532 ·· | 1543 ·· |
1533 if (respHdr->GetTimeout () != 0) | 1544 if (respHdr->GetTimeout () != 0) |
1534 { | 1545 { |
1535 AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, respHd
r->GetTid ())); | 1546 AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, respHd
r->GetTid ())); |
1536 Time timeout = MicroSeconds (1024 * agreement.GetTimeout ()); | 1547 Time timeout = MicroSeconds (1024 * agreement.GetTimeout ()); |
| 1548 · |
| 1549 AccessClass ac = QosUtilsMapTidToAc (agreement.GetTid ()); |
| 1550 ······ |
1537 it->second.first.m_inactivityEvent = Simulator::Schedule (timeout, | 1551 it->second.first.m_inactivityEvent = Simulator::Schedule (timeout, |
1538 &MacLow::Schedul
eDelBaFrame, | 1552 &MacLowBlockAckE
ventListener::BlockAckInactivityTimeout, |
1539 this, | 1553 m_edcaListeners[
ac], |
1540 originator, tid)
; | 1554 originator, tid)
; |
1541 } | 1555 } |
1542 } | 1556 } |
1543 | 1557 |
1544 void | 1558 void |
1545 MacLow::DestroyBlockAckAgreement (Mac48Address originator, uint8_t tid) | 1559 MacLow::DestroyBlockAckAgreement (Mac48Address originator, uint8_t tid) |
1546 { | 1560 { |
1547 AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid)); | 1561 AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid)); |
1548 if (it != m_bAckAgreements.end ()) | 1562 if (it != m_bAckAgreements.end ()) |
1549 { | 1563 { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 } | 1638 } |
1625 (*it).second.first.SetStartingSequence ((guard>>4)&0x0fff); | 1639 (*it).second.first.SetStartingSequence ((guard>>4)&0x0fff); |
1626 /* All packets already forwarded to WifiMac must be removed from buffer:· | 1640 /* All packets already forwarded to WifiMac must be removed from buffer:· |
1627 [begin (), lastComplete) */ | 1641 [begin (), lastComplete) */ |
1628 (*it).second.second.erase ((*it).second.second.begin (), lastComplete); | 1642 (*it).second.second.erase ((*it).second.second.begin (), lastComplete); |
1629 } | 1643 } |
1630 } | 1644 } |
1631 | 1645 |
1632 void | 1646 void |
1633 MacLow::SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Addre
ss originator, bool immediate, | 1647 MacLow::SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Addre
ss originator, bool immediate, |
1634 Time duration, WifiMode txMode) | 1648 Time duration, WifiMode blockAckReqTxMode) |
1635 { | 1649 { |
1636 Ptr<Packet> packet = Create<Packet> (); | 1650 Ptr<Packet> packet = Create<Packet> (); |
1637 packet->AddHeader (*blockAck); | 1651 packet->AddHeader (*blockAck); |
1638 | 1652 |
1639 WifiMacHeader hdr; | 1653 WifiMacHeader hdr; |
1640 hdr.SetType (WIFI_MAC_CTL_BACKRESP); | 1654 hdr.SetType (WIFI_MAC_CTL_BACKRESP); |
1641 hdr.SetAddr1 (originator); | 1655 hdr.SetAddr1 (originator); |
1642 hdr.SetAddr2 (GetAddress ()); | 1656 hdr.SetAddr2 (GetAddress ()); |
1643 hdr.SetDsNotFrom (); | 1657 hdr.SetDsNotFrom (); |
1644 hdr.SetDsNotTo (); | 1658 hdr.SetDsNotTo (); |
1645 hdr.SetNoRetry (); | 1659 hdr.SetNoRetry (); |
1646 hdr.SetNoMoreFragments (); | 1660 hdr.SetNoMoreFragments (); |
1647 | 1661 |
1648 m_currentPacket = packet; | 1662 m_currentPacket = packet; |
1649 m_currentHdr = hdr; | 1663 m_currentHdr = hdr; |
1650 if (immediate) | 1664 if (immediate) |
1651 { | 1665 { |
1652 m_txParams.DisableAck (); | 1666 m_txParams.DisableAck (); |
1653 duration -= GetSifs (); | 1667 duration -= GetSifs (); |
1654 if (blockAck->IsBasic ()) | 1668 if (blockAck->IsBasic ()) |
1655 { | 1669 { |
1656 duration -= GetBlockAckDuration (originator, txMode, BASIC_BLOCK_ACK); | 1670 duration -= GetBlockAckDuration (originator, blockAckReqTxMode, BASIC_
BLOCK_ACK); |
1657 } | 1671 } |
1658 else if (blockAck->IsCompressed ()) | 1672 else if (blockAck->IsCompressed ()) |
1659 { | 1673 { |
1660 duration -= GetBlockAckDuration (originator, txMode, COMPRESSED_BLOCK_
ACK); | 1674 duration -= GetBlockAckDuration (originator, blockAckReqTxMode, COMPRE
SSED_BLOCK_ACK); |
1661 } | 1675 } |
1662 else if (blockAck->IsMultiTid ()) | 1676 else if (blockAck->IsMultiTid ()) |
1663 { | 1677 { |
1664 //NOT IMPLEMENTED | 1678 NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
1665 NS_ASSERT (false); | |
1666 } | 1679 } |
1667 } | 1680 } |
1668 else | 1681 else |
1669 { | 1682 { |
1670 m_txParams.EnableAck (); | 1683 m_txParams.EnableAck (); |
1671 duration += GetSifs (); | 1684 duration += GetSifs (); |
1672 duration += GetAckDuration (originator, txMode); | 1685 duration += GetAckDuration (originator, blockAckReqTxMode); |
1673 } | 1686 } |
1674 m_txParams.DisableNextData (); | 1687 m_txParams.DisableNextData (); |
1675 | 1688 |
1676 StartDataTxTimers (); | 1689 StartDataTxTimers (); |
1677 | 1690 |
1678 NS_ASSERT (duration >= MicroSeconds (0)); | 1691 NS_ASSERT (duration >= MicroSeconds (0)); |
1679 hdr.SetDuration (duration); | 1692 hdr.SetDuration (duration); |
1680 //here should be present a control about immediate or delayed block ack | 1693 //here should be present a control about immediate or delayed block ack |
1681 //for now we assume immediate | 1694 //for now we assume immediate |
1682 packet->AddHeader (hdr); | 1695 packet->AddHeader (hdr); |
1683 WifiMacTrailer fcs; | 1696 WifiMacTrailer fcs; |
1684 packet->AddTrailer (fcs); | 1697 packet->AddTrailer (fcs); |
1685 ForwardDown (packet, &hdr, txMode); | 1698 ForwardDown (packet, &hdr, blockAckReqTxMode); |
1686 m_currentPacket = 0; | 1699 m_currentPacket = 0; |
1687 } | 1700 } |
1688 | 1701 |
1689 void | 1702 void |
1690 MacLow::SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Ma
c48Address originator, | 1703 MacLow::SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Ma
c48Address originator, |
1691 Time duration, WifiMode txMode) | 1704 Time duration, WifiMode blockAckReqTxM
ode) |
1692 { | 1705 { |
1693 NS_LOG_FUNCTION (this); | 1706 NS_LOG_FUNCTION (this); |
1694 CtrlBAckResponseHeader blockAck; | 1707 CtrlBAckResponseHeader blockAck; |
1695 uint8_t tid; | 1708 uint8_t tid; |
1696 bool immediate = false; | 1709 bool immediate = false; |
1697 if (!reqHdr.IsMultiTid ()) | 1710 if (!reqHdr.IsMultiTid ()) |
1698 { | 1711 { |
1699 blockAck.SetStartingSequence (reqHdr.GetStartingSequence ()); | 1712 blockAck.SetStartingSequence (reqHdr.GetStartingSequence ()); |
1700 blockAck.SetTidInfo (reqHdr.GetTidInfo ()); | 1713 blockAck.SetTidInfo (reqHdr.GetTidInfo ()); |
1701 blockAck.SetNoAck (); | |
1702 ······ | 1714 ······ |
1703 tid = reqHdr.GetTidInfo (); | 1715 tid = reqHdr.GetTidInfo (); |
1704 AgreementsI it; | 1716 AgreementsI it; |
1705 it = m_bAckAgreements.find (std::make_pair (originator, tid)); | 1717 it = m_bAckAgreements.find (std::make_pair (originator, tid)); |
1706 if (it != m_bAckAgreements.end ()) | 1718 if (it != m_bAckAgreements.end ()) |
1707 { | 1719 { |
1708 immediate = (*it).second.first.IsImmediateBlockAck (); | 1720 immediate = (*it).second.first.IsImmediateBlockAck (); |
1709 uint16_t startingSeqCtrl = reqHdr.GetStartingSequenceControl (); | 1721 uint16_t startingSeqCtrl = reqHdr.GetStartingSequenceControl (); |
1710 | 1722 |
1711 /* All packets with smaller sequence than starting sequence control mu
st be passed up to Wifimac· | 1723 /* All packets with smaller sequence than starting sequence control mu
st be passed up to Wifimac· |
1712 * See 9.10.3 in IEEE8022.11e standard. | 1724 * See 9.10.3 in IEEE8022.11e standard. |
1713 */ | 1725 */ |
1714 RxCompleteBufferedPacketsWithSmallerSequence ((startingSeqCtrl>>4)&0xf
ff0, originator, tid); | 1726 RxCompleteBufferedPacketsWithSmallerSequence ((startingSeqCtrl>>4)&0xf
ff0, originator, tid); |
1715 | 1727 |
1716 std::list<BufferedPacket>::iterator i = (*it).second.second.begin (); | 1728 std::list<BufferedPacket>::iterator i = (*it).second.second.begin (); |
1717 | 1729 |
1718 /* For more details about next operations see section 9.10.4 of IEEE80
2.11e standard */ | 1730 /* For more details about next operations see section 9.10.4 of IEEE80
2.11e standard */ |
1719 if (reqHdr.IsBasic ()) | 1731 if (reqHdr.IsBasic ()) |
1720 { | 1732 { |
1721 blockAck.SetVariant (BASIC_BLOCK_ACK); | 1733 blockAck.SetType (BASIC_BLOCK_ACK); |
1722 uint16_t guard = startingSeqCtrl; | 1734 uint16_t guard = startingSeqCtrl; |
1723 std::list<BufferedPacket>::iterator lastComplete = (*it).second.se
cond.begin (); | 1735 std::list<BufferedPacket>::iterator lastComplete = (*it).second.se
cond.begin (); |
1724 for (; i != (*it).second.second.end () && guard == (*i).second.Get
SequenceControl (); i++) | 1736 for (; i != (*it).second.second.end () && guard == (*i).second.Get
SequenceControl (); i++) |
1725 { | 1737 { |
1726 blockAck.SetReceivedFragment ((*i).second.GetSequenceNumber ()
, | 1738 blockAck.SetReceivedFragment ((*i).second.GetSequenceNumber ()
, |
1727 (*i).second.GetFragmentNumber ()
); | 1739 (*i).second.GetFragmentNumber ()
); |
1728 /* Section 9.10.4 in IEEE802.11n: the recipient shall pass up
to WifiMac the· | 1740 /* Section 9.10.4 in IEEE802.11n: the recipient shall pass up
to WifiMac the· |
1729 * MSDUs and A-MSDUs starting with the starting sequence numb
er· | 1741 * MSDUs and A-MSDUs starting with the starting sequence numb
er· |
1730 * sequentially until there is an incomplete MSDU or A-MSDU i
n the buffer */ | 1742 * sequentially until there is an incomplete MSDU or A-MSDU i
n the buffer */ |
1731 if (!(*i).second.IsMoreFragments ()) | 1743 if (!(*i).second.IsMoreFragments ()) |
(...skipping 13 matching lines...) Expand all Loading... |
1745 [begin (), lastComplete) */ | 1757 [begin (), lastComplete) */ |
1746 (*it).second.second.erase ((*it).second.second.begin (), lastCompl
ete); | 1758 (*it).second.second.erase ((*it).second.second.begin (), lastCompl
ete); |
1747 for (i = lastComplete; i != (*it).second.second.end (); i++) | 1759 for (i = lastComplete; i != (*it).second.second.end (); i++) |
1748 {· | 1760 {· |
1749 blockAck.SetReceivedFragment ((*i).second.GetSequenceNumber ()
, | 1761 blockAck.SetReceivedFragment ((*i).second.GetSequenceNumber ()
, |
1750 (*i).second.GetFragmentNumber ()
);·· | 1762 (*i).second.GetFragmentNumber ()
);·· |
1751 } | 1763 } |
1752 } | 1764 } |
1753 else if (reqHdr.IsCompressed ()) | 1765 else if (reqHdr.IsCompressed ()) |
1754 { | 1766 { |
1755 blockAck.SetVariant (COMPRESSED_BLOCK_ACK); | 1767 blockAck.SetType (COMPRESSED_BLOCK_ACK); |
1756 uint16_t guard = startingSeqCtrl; | 1768 uint16_t guard = startingSeqCtrl; |
1757 std::list<BufferedPacket>::iterator lastComplete = (*it).second.se
cond.begin (); | 1769 std::list<BufferedPacket>::iterator lastComplete = (*it).second.se
cond.begin (); |
1758 for (; i != (*it).second.second.end () && guard == (*i).second.Get
SequenceControl (); i++) | 1770 for (; i != (*it).second.second.end () && guard == (*i).second.Get
SequenceControl (); i++) |
1759 { | 1771 { |
1760 if (!(*i).second.IsMoreFragments ()) | 1772 if (!(*i).second.IsMoreFragments ()) |
1761 { | 1773 { |
1762 blockAck.SetReceivedPacket ((*i).second.GetSequenceNumber
()); | 1774 blockAck.SetReceivedPacket ((*i).second.GetSequenceNumber
()); |
1763 while (lastComplete != i) | 1775 while (lastComplete != i) |
1764 { | 1776 { |
1765 m_rxCallback ((*lastComplete).first, &(*lastComplete).
second); | 1777 m_rxCallback ((*lastComplete).first, &(*lastComplete).
second); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1804 } | 1816 } |
1805 } | 1817 } |
1806 } | 1818 } |
1807 else | 1819 else |
1808 { | 1820 { |
1809 NS_LOG_DEBUG ("there's not a valid block ack agreement with "<<origina
tor); | 1821 NS_LOG_DEBUG ("there's not a valid block ack agreement with "<<origina
tor); |
1810 } | 1822 } |
1811 } | 1823 } |
1812 else | 1824 else |
1813 { | 1825 { |
1814 //Multi tid block ack is not supported for now | 1826 NS_FATAL_ERROR ("Multi-tid block ack is not supported."); |
1815 NS_ASSERT (false); | 1827 } |
1816 } | 1828 |
1817 | 1829 SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqT
xMode); |
1818 SendBlockAckResponse (&blockAck, originator, immediate, duration, txMode); | |
1819 } | 1830 } |
1820 | 1831 |
1821 void | 1832 void |
1822 MacLow::ResetBlockAckInactivityTimerIfNeeded (BlockAckAgreement &agreement) | 1833 MacLow::ResetBlockAckInactivityTimerIfNeeded (BlockAckAgreement &agreement) |
1823 { | 1834 { |
1824 if (agreement.GetTimeout () != 0) | 1835 if (agreement.GetTimeout () != 0) |
1825 { | 1836 { |
1826 NS_ASSERT (agreement.m_inactivityEvent.IsRunning ()); | 1837 NS_ASSERT (agreement.m_inactivityEvent.IsRunning ()); |
1827 agreement.m_inactivityEvent.Cancel (); | 1838 agreement.m_inactivityEvent.Cancel (); |
1828 Time timeout = MicroSeconds (1024 * agreement.GetTimeout ()); | 1839 Time timeout = MicroSeconds (1024 * agreement.GetTimeout ()); |
| 1840 |
| 1841 AccessClass ac = QosUtilsMapTidToAc (agreement.GetTid ()); |
| 1842 //std::map<AccessClass, MacLowTransmissionListener*>::iterator it = m_edca
Listeners.find (ac); |
| 1843 //NS_ASSERT (it != m_edcaListeners.end ()); |
| 1844 |
1829 agreement.m_inactivityEvent = Simulator::Schedule (timeout,· | 1845 agreement.m_inactivityEvent = Simulator::Schedule (timeout,· |
1830 &MacLow::ScheduleDelBaF
rame,· | 1846 &MacLowBlockAckEventLis
tener::BlockAckInactivityTimeout,· |
1831 this, | 1847 m_edcaListeners[ac], |
1832 agreement.GetPeer (), | 1848 agreement.GetPeer (), |
1833 agreement.GetTid ()); | 1849 agreement.GetTid ()); |
1834 } | 1850 } |
1835 } | 1851 } |
1836 | 1852 |
1837 void | 1853 void |
1838 MacLow::SetQueueForAc (AccessClass ac, Ptr<EdcaTxopN> queue) | 1854 MacLow::RegisterBlockAckListenerForAc (enum AccessClass ac, MacLowBlockAckEventL
istener *listener) |
1839 { | 1855 { |
1840 m_edcaQueues.insert (std::make_pair (ac, queue)); | 1856 m_edcaListeners.insert (std::make_pair (ac, listener)); |
1841 } | |
1842 | |
1843 void | |
1844 MacLow::ScheduleDelBaFrame (Mac48Address originator, uint8_t tid) | |
1845 { | |
1846 WifiMacHeader hdr; | |
1847 hdr.SetAction (); | |
1848 hdr.SetAddr1 (originator); | |
1849 hdr.SetAddr2 (GetAddress ()); | |
1850 hdr.SetAddr3 (GetBssid ()); | |
1851 hdr.SetDsNotTo (); | |
1852 hdr.SetDsNotFrom (); | |
1853 | |
1854 MgtDelBaHeader delbaHdr; | |
1855 delbaHdr.SetTid (tid); | |
1856 delbaHdr.SetByRecipient (); | |
1857 Ptr<Packet> packet = Create<Packet> (); | |
1858 packet->AddHeader (delbaHdr); | |
1859 | |
1860 AccessClass ac = QosUtilsMapTidToAc (tid); | |
1861 std::map<AccessClass, Ptr<EdcaTxopN> >::iterator it = m_edcaQueues.find (ac); | |
1862 NS_ASSERT (it != m_edcaQueues.end ()); | |
1863 m_edcaQueues[ac]->PushFront (packet, hdr); | |
1864 } | 1857 } |
1865 | 1858 |
1866 } // namespace ns3 | 1859 } // namespace ns3 |
LEFT | RIGHT |