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) 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 }· | 693 }· |
694 else· | 694 else· |
695 { | 695 { |
696 NS_LOG_DEBUG ("assoc refused"); | 696 NS_LOG_DEBUG ("assoc refused"); |
697 m_state = REFUSED; | 697 m_state = REFUSED; |
698 } | 698 } |
699 } | 699 } |
700 } | 700 } |
701 else if (hdr->IsAction ()) | 701 else if (hdr->IsAction ()) |
702 { | 702 { |
703 MgtActionFrameHeader actHdr; | 703 WifiActionHeader actionHdr; |
704 packet->PeekHeader (actHdr); | 704 packet->RemoveHeader (actionHdr); |
705 if (actHdr.IsAddBaRequest ()) | 705 if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
| 706 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_RE
QUEST) |
706 { | 707 { |
707 MgtAddBaRequestHeader reqHdr; | 708 MgtAddBaRequestHeader reqHdr; |
708 packet->RemoveHeader (reqHdr); | 709 packet->RemoveHeader (reqHdr); |
709 SendAddBaResponse (&reqHdr, hdr->GetAddr2 ()); | 710 SendAddBaResponse (&reqHdr, hdr->GetAddr2 ()); |
710 } | 711 } |
711 else if (actHdr.IsAddBaResponse ()) | 712 else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
| 713 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADD
BA_RESPONSE) |
712 { | 714 { |
713 MgtAddBaResponseHeader respHdr; | 715 MgtAddBaResponseHeader respHdr; |
714 packet->RemoveHeader (respHdr); | 716 packet->RemoveHeader (respHdr); |
715 m_queues[QosUtilsMapTidToAc (respHdr.GetTid ())]->GotAddBaResponse (&r
espHdr, hdr->GetAddr2 ()); | 717 m_queues[QosUtilsMapTidToAc (respHdr.GetTid ())]->GotAddBaResponse (&r
espHdr, hdr->GetAddr2 ()); |
716 } | 718 } |
717 else if (actHdr.IsDelBa ()) | 719 else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
| 720 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_DEL
BA) |
718 { | 721 { |
719 MgtDelBaHeader delBaHdr; | 722 MgtDelBaHeader delBaHdr; |
720 packet->RemoveHeader (delBaHdr); | 723 packet->RemoveHeader (delBaHdr); |
721 if (delBaHdr.IsByOriginator ()) | 724 if (delBaHdr.IsByOriginator ()) |
722 { | 725 { |
723 /* Delba frame was sent by originator, this means that an ingoing
established | 726 /* Delba frame was sent by originator, this means that an ingoing
established |
724 agreement exists in MacLow */ | 727 agreement exists in MacLow */ |
725 m_low->DestroyBlockAckAgreement (hdr->GetAddr2 (), delBaHdr.GetTid
()); | 728 m_low->DestroyBlockAckAgreement (hdr->GetAddr2 (), delBaHdr.GetTid
()); |
726 } | 729 } |
727 else | 730 else |
(...skipping 12 matching lines...) Expand all Loading... |
740 SupportedRates rates; | 743 SupportedRates rates; |
741 for (uint32_t i = 0; i < m_phy->GetNModes (); i++) | 744 for (uint32_t i = 0; i < m_phy->GetNModes (); i++) |
742 { | 745 { |
743 WifiMode mode = m_phy->GetMode (i); | 746 WifiMode mode = m_phy->GetMode (i); |
744 rates.AddSupportedRate (mode.GetDataRate ()); | 747 rates.AddSupportedRate (mode.GetDataRate ()); |
745 } | 748 } |
746 return rates; | 749 return rates; |
747 } | 750 } |
748 | 751 |
749 void | 752 void |
750 QstaWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, WifiMacHe
ader const *hdr) | 753 QstaWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const Wif
iMacHeader *hdr) |
751 { | 754 { |
752 DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket); | 755 DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket); |
753 for (DeaggregatedMsdusCI i = packets.begin (); i != packets.end (); ++i) | 756 for (DeaggregatedMsdusCI i = packets.begin (); i != packets.end (); ++i) |
754 { | 757 { |
755 ForwardUp ((*i).first, (*i).second.GetSourceAddr (), | 758 ForwardUp ((*i).first, (*i).second.GetSourceAddr (), |
756 (*i).second.GetDestinationAddr ()); | 759 (*i).second.GetDestinationAddr ()); |
757 } | 760 } |
758 } | 761 } |
759 | 762 |
760 Ptr<EdcaTxopN> | 763 Ptr<EdcaTxopN> |
(...skipping 21 matching lines...) Expand all Loading... |
782 } | 785 } |
783 | 786 |
784 void | 787 void |
785 QstaWifiMac::SetQueue (enum AccessClass ac) | 788 QstaWifiMac::SetQueue (enum AccessClass ac) |
786 { | 789 { |
787 Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> (); | 790 Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> (); |
788 edca->SetLow (m_low); | 791 edca->SetLow (m_low); |
789 edca->SetManager (m_dcfManager); | 792 edca->SetManager (m_dcfManager); |
790 edca->SetTypeOfStation (STA); | 793 edca->SetTypeOfStation (STA); |
791 edca->SetTxMiddle (m_txMiddle); | 794 edca->SetTxMiddle (m_txMiddle); |
| 795 edca->SetAccessClass (ac); |
792 edca->CompleteConfig (); | 796 edca->CompleteConfig (); |
793 m_low->SetQueueForAc (ac, edca); | |
794 m_queues.insert (std::make_pair(ac, edca)); | 797 m_queues.insert (std::make_pair(ac, edca)); |
795 } | 798 } |
796 | 799 |
797 void· | 800 void· |
798 QstaWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard) | 801 QstaWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard) |
799 { | 802 { |
800 switch (standard) | 803 switch (standard) |
801 { | 804 { |
| 805 case WIFI_PHY_STANDARD_80211p_CCH: |
| 806 ConfigureCCHDcf (m_queues[AC_BK], 15, 511, AC_BK); |
| 807 ConfigureCCHDcf (m_queues[AC_BE], 15, 511, AC_BE); |
| 808 ConfigureCCHDcf (m_queues[AC_VI], 15, 511, AC_VI); |
| 809 ConfigureCCHDcf (m_queues[AC_VO], 15, 511, AC_VO); |
| 810 break; |
| 811 case WIFI_PHY_STANDARD_80211p_SCH: |
| 812 ConfigureDcf (m_queues[AC_BK], 15, 511, AC_BK); |
| 813 ConfigureDcf (m_queues[AC_BE], 15, 511, AC_BE); |
| 814 ConfigureDcf (m_queues[AC_VI], 15, 511, AC_VI); |
| 815 ConfigureDcf (m_queues[AC_VO], 15, 511, AC_VO); |
| 816 break; |
802 case WIFI_PHY_STANDARD_holland: | 817 case WIFI_PHY_STANDARD_holland: |
803 // fall through | 818 // fall through |
804 case WIFI_PHY_STANDARD_80211a: | 819 case WIFI_PHY_STANDARD_80211a: |
805 // fall through | 820 // fall through |
806 case WIFI_PHY_STANDARD_80211_10Mhz: | 821 case WIFI_PHY_STANDARD_80211_10Mhz: |
807 // fall through | 822 // fall through |
808 case WIFI_PHY_STANDARD_80211_5Mhz: | 823 case WIFI_PHY_STANDARD_80211_5Mhz: |
809 ConfigureDcf (m_queues[AC_BK], 15, 1023, AC_BK); | 824 ConfigureDcf (m_queues[AC_BK], 15, 1023, AC_BK); |
810 ConfigureDcf (m_queues[AC_BE], 15, 1023, AC_BE); | 825 ConfigureDcf (m_queues[AC_BE], 15, 1023, AC_BE); |
811 ConfigureDcf (m_queues[AC_VI], 15, 1023, AC_VI); | 826 ConfigureDcf (m_queues[AC_VI], 15, 1023, AC_VI); |
812 ConfigureDcf (m_queues[AC_VO], 15, 1023, AC_VO); | 827 ConfigureDcf (m_queues[AC_VO], 15, 1023, AC_VO); |
813 break; | 828 break; |
814 case WIFI_PHY_STANDARD_80211b: | 829 case WIFI_PHY_STANDARD_80211b: |
815 ConfigureDcf (m_queues[AC_BK], 31, 1023, AC_BK); | 830 ConfigureDcf (m_queues[AC_BK], 31, 1023, AC_BK); |
816 ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE); | 831 ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE); |
817 ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI); | 832 ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI); |
818 ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO); | 833 ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO); |
819 break; | 834 break; |
820 default: | 835 default: |
821 NS_ASSERT (false); | 836 NS_ASSERT (false); |
822 break; | 837 break; |
823 } | 838 } |
824 } | 839 } |
825 | 840 |
826 | |
827 void | 841 void |
828 QstaWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Addres
s originator) | 842 QstaWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Addres
s originator) |
829 { | 843 { |
830 NS_LOG_FUNCTION (this); | 844 NS_LOG_FUNCTION (this); |
831 WifiMacHeader hdr; | 845 WifiMacHeader hdr; |
832 hdr.SetAction (); | 846 hdr.SetAction (); |
833 hdr.SetAddr1 (originator); | 847 hdr.SetAddr1 (originator); |
834 hdr.SetAddr2 (m_low->GetAddress ()); | 848 hdr.SetAddr2 (m_low->GetAddress ()); |
835 hdr.SetAddr3 (GetBssid ()); | 849 hdr.SetAddr3 (m_low->GetAddress ()); |
836 hdr.SetDsNotFrom (); | 850 hdr.SetDsNotFrom (); |
837 hdr.SetDsNotTo (); | 851 hdr.SetDsNotTo (); |
838 | 852 |
839 MgtAddBaResponseHeader respHdr; | 853 MgtAddBaResponseHeader respHdr; |
840 StatusCode code; | 854 StatusCode code; |
841 code.SetSuccess (); | 855 code.SetSuccess (); |
842 respHdr.SetStatusCode (code); | 856 respHdr.SetStatusCode (code); |
843 //Here a control about queues type? | 857 //Here a control about queues type? |
844 respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ()); | 858 respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ()); |
845 | 859 |
(...skipping 10 matching lines...) Expand all Loading... |
856 We assume that receiver has no limit on reception. | 870 We assume that receiver has no limit on reception. |
857 However we assume that a receiver sets a bufferSize in order to satisfy | 871 However we assume that a receiver sets a bufferSize in order to satisfy |
858 next equation: | 872 next equation: |
859 (bufferSize + 1) % 16 = 0 | 873 (bufferSize + 1) % 16 = 0 |
860 So if a recipient is able to buffer a packet, it should be also able to buf
fer | 874 So if a recipient is able to buffer a packet, it should be also able to buf
fer |
861 all possible packet's fragments. | 875 all possible packet's fragments. |
862 See section 7.3.1.14 in IEEE802.11e for more details. */ | 876 See section 7.3.1.14 in IEEE802.11e for more details. */ |
863 respHdr.SetBufferSize (1023); | 877 respHdr.SetBufferSize (1023); |
864 respHdr.SetTimeout (reqHdr->GetTimeout ()); | 878 respHdr.SetTimeout (reqHdr->GetTimeout ()); |
865 | 879 |
| 880 WifiActionHeader actionHdr; |
| 881 WifiActionHeader::ActionValue action; |
| 882 action.blockAck = WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE; |
| 883 actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action); |
| 884 |
866 Ptr<Packet> packet = Create<Packet> (); | 885 Ptr<Packet> packet = Create<Packet> (); |
867 packet->AddHeader (respHdr); | 886 packet->AddHeader (respHdr); |
| 887 packet->AddHeader (actionHdr); |
868 ·· | 888 ·· |
869 /* ns3::MacLow have to buffer all correctly received packet for this block ack
session */ | 889 /* ns3::MacLow have to buffer all correctly received packet for this block ack
session */ |
870 m_low->CreateBlockAckAgreement (&respHdr, originator, reqHdr->GetStartingSeque
nce ()); | 890 m_low->CreateBlockAckAgreement (&respHdr, originator, reqHdr->GetStartingSeque
nce ()); |
871 | 891 |
872 //Better a management queue?· | 892 //Better a management queue?· |
873 m_queues[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr); | 893 m_queues[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr); |
874 } | 894 } |
875 | 895 |
876 } //namespace ns3 | 896 } //namespace ns3 |
LEFT | RIGHT |