672 NS_LOG_DEBUG ("assoc refused"); |
672 NS_LOG_DEBUG ("assoc refused"); |
673 m_state = REFUSED; |
673 m_state = REFUSED; |
674 } |
674 } |
675 } |
675 } |
676 } |
676 } |
|
677 else if (hdr->IsAction ()) |
|
678 { |
|
679 WifiActionHeader actionHdr; |
|
680 packet->RemoveHeader (actionHdr); |
|
681 if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
|
682 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST) |
|
683 { |
|
684 MgtAddBaRequestHeader reqHdr; |
|
685 packet->RemoveHeader (reqHdr); |
|
686 SendAddBaResponse (&reqHdr, hdr->GetAddr2 ()); |
|
687 } |
|
688 else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
|
689 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE) |
|
690 { |
|
691 MgtAddBaResponseHeader respHdr; |
|
692 packet->RemoveHeader (respHdr); |
|
693 m_queues[QosUtilsMapTidToAc (respHdr.GetTid ())]->GotAddBaResponse (&respHdr, hdr->GetAddr2 ()); |
|
694 } |
|
695 else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
|
696 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_DELBA) |
|
697 { |
|
698 MgtDelBaHeader delBaHdr; |
|
699 packet->RemoveHeader (delBaHdr); |
|
700 if (delBaHdr.IsByOriginator ()) |
|
701 { |
|
702 /* Block ack agreement tear down */ |
|
703 } |
|
704 else |
|
705 { |
|
706 /* We must notify correct queue tear down of agreement */ |
|
707 } |
|
708 } |
|
709 } |
677 } |
710 } |
678 |
711 |
679 SupportedRates |
712 SupportedRates |
680 QstaWifiMac::GetSupportedRates (void) const |
713 QstaWifiMac::GetSupportedRates (void) const |
681 { |
714 { |
773 NS_ASSERT (false); |
806 NS_ASSERT (false); |
774 break; |
807 break; |
775 } |
808 } |
776 } |
809 } |
777 |
810 |
|
811 void |
|
812 QstaWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Address originator) |
|
813 { |
|
814 NS_LOG_FUNCTION (this); |
|
815 WifiMacHeader hdr; |
|
816 hdr.SetAction (); |
|
817 hdr.SetAddr1 (originator); |
|
818 hdr.SetAddr2 (m_low->GetAddress ()); |
|
819 hdr.SetAddr3 (m_low->GetAddress ()); |
|
820 hdr.SetDsNotFrom (); |
|
821 hdr.SetDsNotTo (); |
|
822 |
|
823 MgtAddBaResponseHeader respHdr; |
|
824 StatusCode code; |
|
825 code.SetSuccess (); |
|
826 respHdr.SetStatusCode (code); |
|
827 //Here a control about queues type? |
|
828 respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ()); |
|
829 |
|
830 if (reqHdr->IsImmediateBlockAck ()) |
|
831 { |
|
832 respHdr.SetImmediateBlockAck (); |
|
833 } |
|
834 else |
|
835 { |
|
836 respHdr.SetDelayedBlockAck (); |
|
837 } |
|
838 respHdr.SetTid (reqHdr->GetTid ()); |
|
839 /* For now there's not no control about limit of reception. |
|
840 We assume that receiver has no limit on reception. |
|
841 However we assume that a receiver sets a bufferSize in order to satisfy |
|
842 next equation: |
|
843 (bufferSize + 1) % 16 = 0 |
|
844 So if a recipient is able to buffer a packet, it should be also able to buffer |
|
845 all possible packet's fragments. |
|
846 See section 7.3.1.14 in IEEE802.11e for more details. */ |
|
847 respHdr.SetBufferSize (1023); |
|
848 respHdr.SetTimeout (reqHdr->GetTimeout ()); |
|
849 |
|
850 WifiActionHeader actionHdr; |
|
851 WifiActionHeader::ActionValue action; |
|
852 action.blockAck = WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE; |
|
853 actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action); |
|
854 |
|
855 Ptr<Packet> packet = Create<Packet> (); |
|
856 packet->AddHeader (respHdr); |
|
857 packet->AddHeader (actionHdr); |
|
858 |
|
859 /* ns3::MacLow have to buffer all correctly received packet for this block ack session */ |
|
860 //m_low->CreateIngoingAgreement (&respHdr, originator, reqHdr->GetStartingSequence ()); |
|
861 |
|
862 //Better a management queue? |
|
863 m_queues[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr); |
|
864 } |
778 |
865 |
779 } //namespace ns3 |
866 } //namespace ns3 |