168 QstaWifiMac::SetAckTimeout (Time ackTimeout) |
168 QstaWifiMac::SetAckTimeout (Time ackTimeout) |
169 { |
169 { |
170 m_low->SetAckTimeout (ackTimeout); |
170 m_low->SetAckTimeout (ackTimeout); |
171 } |
171 } |
172 |
172 |
|
173 void |
|
174 QstaWifiMac::SetBasicBlockAckTimeout (Time blockAckTimeout) |
|
175 { |
|
176 m_low->SetBasicBlockAckTimeout (blockAckTimeout); |
|
177 } |
|
178 |
|
179 void |
|
180 QstaWifiMac::SetCompressedBlockAckTimeout (Time blockAckTimeout) |
|
181 { |
|
182 m_low->SetCompressedBlockAckTimeout (blockAckTimeout); |
|
183 } |
|
184 |
173 void |
185 void |
174 QstaWifiMac::SetCtsTimeout (Time ctsTimeout) |
186 QstaWifiMac::SetCtsTimeout (Time ctsTimeout) |
175 { |
187 { |
176 m_low->SetCtsTimeout (ctsTimeout); |
188 m_low->SetCtsTimeout (ctsTimeout); |
177 } |
189 } |
202 |
214 |
203 Time |
215 Time |
204 QstaWifiMac::GetAckTimeout (void) const |
216 QstaWifiMac::GetAckTimeout (void) const |
205 { |
217 { |
206 return m_low->GetAckTimeout (); |
218 return m_low->GetAckTimeout (); |
|
219 } |
|
220 |
|
221 Time |
|
222 QstaWifiMac::GetBasicBlockAckTimeout (void) const |
|
223 { |
|
224 return m_low->GetBasicBlockAckTimeout (); |
|
225 } |
|
226 |
|
227 Time |
|
228 QstaWifiMac::GetCompressedBlockAckTimeout (void) const |
|
229 { |
|
230 return m_low->GetCompressedBlockAckTimeout (); |
207 } |
231 } |
208 |
232 |
209 Time |
233 Time |
210 QstaWifiMac::GetCtsTimeout (void) const |
234 QstaWifiMac::GetCtsTimeout (void) const |
211 { |
235 { |
672 NS_LOG_DEBUG ("assoc refused"); |
696 NS_LOG_DEBUG ("assoc refused"); |
673 m_state = REFUSED; |
697 m_state = REFUSED; |
674 } |
698 } |
675 } |
699 } |
676 } |
700 } |
|
701 else if (hdr->IsAction ()) |
|
702 { |
|
703 WifiActionHeader actionHdr; |
|
704 packet->RemoveHeader (actionHdr); |
|
705 if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
|
706 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST) |
|
707 { |
|
708 MgtAddBaRequestHeader reqHdr; |
|
709 packet->RemoveHeader (reqHdr); |
|
710 SendAddBaResponse (&reqHdr, hdr->GetAddr2 ()); |
|
711 } |
|
712 else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
|
713 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE) |
|
714 { |
|
715 MgtAddBaResponseHeader respHdr; |
|
716 packet->RemoveHeader (respHdr); |
|
717 m_queues[QosUtilsMapTidToAc (respHdr.GetTid ())]->GotAddBaResponse (&respHdr, hdr->GetAddr2 ()); |
|
718 } |
|
719 else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
|
720 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_DELBA) |
|
721 { |
|
722 MgtDelBaHeader delBaHdr; |
|
723 packet->RemoveHeader (delBaHdr); |
|
724 if (delBaHdr.IsByOriginator ()) |
|
725 { |
|
726 /* Delba frame was sent by originator, this means that an ingoing established |
|
727 agreement exists in MacLow */ |
|
728 m_low->DestroyBlockAckAgreement (hdr->GetAddr2 (), delBaHdr.GetTid ()); |
|
729 } |
|
730 else |
|
731 { |
|
732 /* We must notify correct queue tear down of agreement */ |
|
733 AccessClass ac = QosUtilsMapTidToAc (delBaHdr.GetTid ()); |
|
734 m_queues[ac]->GotDelBaFrame (&delBaHdr, hdr->GetAddr2 ()); |
|
735 } |
|
736 } |
|
737 } |
677 } |
738 } |
678 |
739 |
679 SupportedRates |
740 SupportedRates |
680 QstaWifiMac::GetSupportedRates (void) const |
741 QstaWifiMac::GetSupportedRates (void) const |
681 { |
742 { |
729 Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> (); |
790 Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> (); |
730 edca->SetLow (m_low); |
791 edca->SetLow (m_low); |
731 edca->SetManager (m_dcfManager); |
792 edca->SetManager (m_dcfManager); |
732 edca->SetTypeOfStation (STA); |
793 edca->SetTypeOfStation (STA); |
733 edca->SetTxMiddle (m_txMiddle); |
794 edca->SetTxMiddle (m_txMiddle); |
|
795 edca->SetAccessClass (ac); |
|
796 edca->CompleteConfig (); |
734 m_queues.insert (std::make_pair(ac, edca)); |
797 m_queues.insert (std::make_pair(ac, edca)); |
735 } |
798 } |
736 |
799 |
737 void |
800 void |
738 QstaWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard) |
801 QstaWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard) |
773 NS_ASSERT (false); |
836 NS_ASSERT (false); |
774 break; |
837 break; |
775 } |
838 } |
776 } |
839 } |
777 |
840 |
|
841 void |
|
842 QstaWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Address originator) |
|
843 { |
|
844 NS_LOG_FUNCTION (this); |
|
845 WifiMacHeader hdr; |
|
846 hdr.SetAction (); |
|
847 hdr.SetAddr1 (originator); |
|
848 hdr.SetAddr2 (m_low->GetAddress ()); |
|
849 hdr.SetAddr3 (m_low->GetAddress ()); |
|
850 hdr.SetDsNotFrom (); |
|
851 hdr.SetDsNotTo (); |
|
852 |
|
853 MgtAddBaResponseHeader respHdr; |
|
854 StatusCode code; |
|
855 code.SetSuccess (); |
|
856 respHdr.SetStatusCode (code); |
|
857 //Here a control about queues type? |
|
858 respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ()); |
|
859 |
|
860 if (reqHdr->IsImmediateBlockAck ()) |
|
861 { |
|
862 respHdr.SetImmediateBlockAck (); |
|
863 } |
|
864 else |
|
865 { |
|
866 respHdr.SetDelayedBlockAck (); |
|
867 } |
|
868 respHdr.SetTid (reqHdr->GetTid ()); |
|
869 /* For now there's not no control about limit of reception. |
|
870 We assume that receiver has no limit on reception. |
|
871 However we assume that a receiver sets a bufferSize in order to satisfy |
|
872 next equation: |
|
873 (bufferSize + 1) % 16 = 0 |
|
874 So if a recipient is able to buffer a packet, it should be also able to buffer |
|
875 all possible packet's fragments. |
|
876 See section 7.3.1.14 in IEEE802.11e for more details. */ |
|
877 respHdr.SetBufferSize (1023); |
|
878 respHdr.SetTimeout (reqHdr->GetTimeout ()); |
|
879 |
|
880 WifiActionHeader actionHdr; |
|
881 WifiActionHeader::ActionValue action; |
|
882 action.blockAck = WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE; |
|
883 actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action); |
|
884 |
|
885 Ptr<Packet> packet = Create<Packet> (); |
|
886 packet->AddHeader (respHdr); |
|
887 packet->AddHeader (actionHdr); |
|
888 |
|
889 /* ns3::MacLow have to buffer all correctly received packet for this block ack session */ |
|
890 m_low->CreateBlockAckAgreement (&respHdr, originator, reqHdr->GetStartingSequence ()); |
|
891 |
|
892 //Better a management queue? |
|
893 m_queues[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr); |
|
894 } |
778 |
895 |
779 } //namespace ns3 |
896 } //namespace ns3 |