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) 2006, 2009 INRIA | 3 * Copyright (c) 2006, 2009 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 m_dcfManager->SetEifsNoDifs (eifsNoDifs); | 187 m_dcfManager->SetEifsNoDifs (eifsNoDifs); |
188 } | 188 } |
189 | 189 |
190 void· | 190 void· |
191 QapWifiMac::SetAckTimeout (Time ackTimeout) | 191 QapWifiMac::SetAckTimeout (Time ackTimeout) |
192 { | 192 { |
193 m_low->SetAckTimeout (ackTimeout); | 193 m_low->SetAckTimeout (ackTimeout); |
194 } | 194 } |
195 | 195 |
196 void· | 196 void· |
| 197 QapWifiMac::SetBasicBlockAckTimeout (Time blockAckTimeout) |
| 198 { |
| 199 m_low->SetBasicBlockAckTimeout (blockAckTimeout); |
| 200 } |
| 201 |
| 202 void |
| 203 QapWifiMac::SetCompressedBlockAckTimeout (Time blockAckTimeout) |
| 204 { |
| 205 m_low->SetCompressedBlockAckTimeout (blockAckTimeout); |
| 206 } |
| 207 |
| 208 void· |
197 QapWifiMac::SetCtsTimeout (Time ctsTimeout) | 209 QapWifiMac::SetCtsTimeout (Time ctsTimeout) |
198 { | 210 { |
199 m_low->SetCtsTimeout (ctsTimeout); | 211 m_low->SetCtsTimeout (ctsTimeout); |
200 } | 212 } |
201 | 213 |
202 void· | 214 void· |
203 QapWifiMac::SetPifs (Time pifs) | 215 QapWifiMac::SetPifs (Time pifs) |
204 { | 216 { |
205 m_low->SetPifs (pifs); | 217 m_low->SetPifs (pifs); |
206 } | 218 } |
(...skipping 16 matching lines...) Expand all Loading... |
223 return m_dcfManager->GetEifsNoDifs (); | 235 return m_dcfManager->GetEifsNoDifs (); |
224 } | 236 } |
225 | 237 |
226 Time· | 238 Time· |
227 QapWifiMac::GetAckTimeout (void) const | 239 QapWifiMac::GetAckTimeout (void) const |
228 { | 240 { |
229 return m_low->GetAckTimeout (); | 241 return m_low->GetAckTimeout (); |
230 } | 242 } |
231 | 243 |
232 Time· | 244 Time· |
| 245 QapWifiMac::GetBasicBlockAckTimeout () const |
| 246 { |
| 247 return m_low->GetBasicBlockAckTimeout (); |
| 248 } |
| 249 |
| 250 Time· |
| 251 QapWifiMac::GetCompressedBlockAckTimeout () const |
| 252 { |
| 253 return m_low->GetCompressedBlockAckTimeout (); |
| 254 } |
| 255 |
| 256 Time· |
233 QapWifiMac::GetCtsTimeout (void) const | 257 QapWifiMac::GetCtsTimeout (void) const |
234 { | 258 { |
235 return m_low->GetCtsTimeout (); | 259 return m_low->GetCtsTimeout (); |
236 } | 260 } |
237 | 261 |
238 Time· | 262 Time· |
239 QapWifiMac::GetPifs (void) const | 263 QapWifiMac::GetPifs (void) const |
240 { | 264 { |
241 return m_low->GetPifs (); | 265 return m_low->GetPifs (); |
242 } | 266 } |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 SendAssocResp (hdr->GetAddr2 (), true); | 686 SendAssocResp (hdr->GetAddr2 (), true); |
663 } | 687 } |
664 } | 688 } |
665 else if (hdr->IsDisassociation ())· | 689 else if (hdr->IsDisassociation ())· |
666 { | 690 { |
667 fromStation->RecordDisassociated (); | 691 fromStation->RecordDisassociated (); |
668 }· | 692 }· |
669 else if (hdr->IsReassocReq ())· | 693 else if (hdr->IsReassocReq ())· |
670 { | 694 { |
671 /* we don't support reassoc frames for now */ | 695 /* we don't support reassoc frames for now */ |
672 }· | 696 } |
| 697 else if (hdr->IsAction ()) |
| 698 { |
| 699 MgtActionFrameHeader actHdr; |
| 700 packet->PeekHeader (actHdr); |
| 701 if (actHdr.IsAddBaRequest ()) |
| 702 { |
| 703 MgtAddBaRequestHeader reqHdr; |
| 704 packet->RemoveHeader (reqHdr); |
| 705 SendAddBaResponse (&reqHdr, hdr->GetAddr2 ()); |
| 706 } |
| 707 else if (actHdr.IsAddBaResponse ()) |
| 708 { |
| 709 MgtAddBaResponseHeader respHdr; |
| 710 packet->RemoveHeader (respHdr); |
| 711 m_queues[QosUtilsMapTidToAc (respHdr.GetTid ())]->GotAddBaResp
onse (&respHdr, hdr->GetAddr2 ()); |
| 712 } |
| 713 else if (actHdr.IsDelBa ()) |
| 714 { |
| 715 MgtDelBaHeader delBaHdr; |
| 716 packet->RemoveHeader (delBaHdr); |
| 717 if (delBaHdr.IsByOriginator ()) |
| 718 { |
| 719 /* Delba frame was sent by originator, this means that an
ingoing established |
| 720 agreement exists in MacLow */ |
| 721 m_low->DestroyBlockAckAgreement (hdr->GetAddr2 (), delBaHd
r.GetTid ()); |
| 722 } |
| 723 else |
| 724 { |
| 725 /* We must notify correct queue tear down of agreement */ |
| 726 AccessClass ac = QosUtilsMapTidToAc (delBaHdr.GetTid ()); |
| 727 m_queues[ac]->GotDelBaFrame (&delBaHdr, hdr->GetAddr2 ()); |
| 728 } |
| 729 } |
| 730 } |
673 else if (hdr->IsAuthentication () || | 731 else if (hdr->IsAuthentication () || |
674 hdr->IsDeauthentication ())· | 732 hdr->IsDeauthentication ())· |
675 { | 733 { |
676 /* | 734 /* |
677 */ | 735 */ |
678 }· | 736 }· |
679 else· | 737 else· |
680 { | 738 { |
681 /* unknown mgt frame | 739 /* unknown mgt frame |
682 */ | 740 */ |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 void | 791 void |
734 QapWifiMac::SetQueue (enum AccessClass ac) | 792 QapWifiMac::SetQueue (enum AccessClass ac) |
735 { | 793 { |
736 Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> (); | 794 Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> (); |
737 edca->SetLow (m_low); | 795 edca->SetLow (m_low); |
738 edca->SetManager (m_dcfManager); | 796 edca->SetManager (m_dcfManager); |
739 edca->SetTypeOfStation (AP); | 797 edca->SetTypeOfStation (AP); |
740 edca->SetTxMiddle (m_txMiddle); | 798 edca->SetTxMiddle (m_txMiddle); |
741 edca->SetTxOkCallback (MakeCallback (&QapWifiMac::TxOk, this)); | 799 edca->SetTxOkCallback (MakeCallback (&QapWifiMac::TxOk, this)); |
742 edca->SetTxFailedCallback (MakeCallback (&QapWifiMac::TxFailed, this)); | 800 edca->SetTxFailedCallback (MakeCallback (&QapWifiMac::TxFailed, this)); |
| 801 edca->CompleteConfig (); |
| 802 m_low->SetQueueForAc (ac, edca); |
743 m_queues.insert (std::make_pair(ac, edca)); | 803 m_queues.insert (std::make_pair(ac, edca)); |
744 } | 804 } |
745 | 805 |
746 void· | 806 void· |
747 QapWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard) | 807 QapWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard) |
748 { | 808 { |
749 switch (standard) | 809 switch (standard) |
750 { | 810 { |
751 case WIFI_PHY_STANDARD_holland: | 811 case WIFI_PHY_STANDARD_holland: |
752 // fall through | 812 // fall through |
(...skipping 12 matching lines...) Expand all Loading... |
765 ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE); | 825 ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE); |
766 ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI); | 826 ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI); |
767 ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO); | 827 ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO); |
768 break; | 828 break; |
769 default: | 829 default: |
770 NS_ASSERT (false); | 830 NS_ASSERT (false); |
771 break; | 831 break; |
772 } | 832 } |
773 } | 833 } |
774 | 834 |
| 835 void |
| 836 QapWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Address
originator) |
| 837 { |
| 838 NS_LOG_FUNCTION (this); |
| 839 WifiMacHeader hdr; |
| 840 hdr.SetAction (); |
| 841 hdr.SetAddr1 (originator); |
| 842 hdr.SetAddr2 (m_low->GetAddress ()); |
| 843 hdr.SetAddr3 (GetBssid ()); |
| 844 hdr.SetDsNotFrom (); |
| 845 hdr.SetDsNotTo (); |
| 846 |
| 847 MgtAddBaResponseHeader respHdr; |
| 848 StatusCode code; |
| 849 code.SetSuccess (); |
| 850 respHdr.SetStatusCode (code); |
| 851 //Here a control about queues type? |
| 852 respHdr.SetAmsduSupported (); |
| 853 |
| 854 if (reqHdr->IsImmediateBlockAck ()) |
| 855 { |
| 856 respHdr.SetImmediateBlockAck (); |
| 857 } |
| 858 else |
| 859 { |
| 860 respHdr.SetDelayedBlockAck (); |
| 861 } |
| 862 respHdr.SetTid (reqHdr->GetTid ()); |
| 863 /* For now there's not no control about limit of reception. |
| 864 We assume that receiver has no limit on reception. |
| 865 However we assume that a receiver sets a bufferSize in order to satisfy |
| 866 next equation: |
| 867 (bufferSize + 1) % 16 = 0 |
| 868 So if a recipient is able to buffer a packet, it should be also able to buf
fer |
| 869 all possible packet's fragments. |
| 870 See section 7.3.1.14 in IEEE802.11e for more details. */ |
| 871 respHdr.SetBufferSize (1023); |
| 872 respHdr.SetTimeout (reqHdr->GetTimeout ()); |
| 873 |
| 874 Ptr<Packet> packet = Create<Packet> (); |
| 875 packet->AddHeader (respHdr); |
| 876 ·· |
| 877 /* ns3::MacLow have to buffer all correctly received packet for this block ack
session */ |
| 878 m_low->CreateBlockAckAgreement (&respHdr, originator, reqHdr->GetStartingSeque
nce ()); |
| 879 |
| 880 //Better a management queue?· |
| 881 m_queues[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr); |
| 882 } |
| 883 |
775 } //namespace ns3 | 884 } //namespace ns3 |
OLD | NEW |