diff --git a/src/mesh/model/dot11s/airtime-metric.cc b/src/mesh/model/dot11s/airtime-metric.cc index fc68e61d7..ce9ca17e8 100644 --- a/src/mesh/model/dot11s/airtime-metric.cc +++ b/src/mesh/model/dot11s/airtime-metric.cc @@ -55,9 +55,9 @@ AirtimeLinkMetricCalculator::AirtimeLinkMetricCalculator () void AirtimeLinkMetricCalculator::SetHeaderTid (uint8_t tid) { + m_testHeader.SetType (WIFI_MAC_DATA); m_testHeader.SetDsFrom (); m_testHeader.SetDsTo (); - m_testHeader.SetTypeData (); m_testHeader.SetQosTid (tid); } void diff --git a/src/mesh/model/dot11s/hwmp-protocol-mac.cc b/src/mesh/model/dot11s/hwmp-protocol-mac.cc index df0b27837..461df59fa 100644 --- a/src/mesh/model/dot11s/hwmp-protocol-mac.cc +++ b/src/mesh/model/dot11s/hwmp-protocol-mac.cc @@ -245,7 +245,7 @@ HwmpProtocolMac::SendPreq (std::vector preq) packet->AddHeader (GetWifiActionHeader ()); //create 802.11 header: WifiMacHeader hdr; - hdr.SetAction (); + hdr.SetType (WIFI_MAC_MGT_ACTION); hdr.SetDsNotFrom (); hdr.SetDsNotTo (); hdr.SetAddr2 (m_parent->GetAddress ()); @@ -315,7 +315,7 @@ HwmpProtocolMac::SendPrep (IePrep prep, Mac48Address receiver) packet->AddHeader (GetWifiActionHeader ()); //create 802.11 header: WifiMacHeader hdr; - hdr.SetAction (); + hdr.SetType (WIFI_MAC_MGT_ACTION); hdr.SetDsNotFrom (); hdr.SetDsNotTo (); hdr.SetAddr1 (receiver); @@ -356,7 +356,7 @@ HwmpProtocolMac::ForwardPerr (std::vector faile packet->AddHeader (GetWifiActionHeader ()); //create 802.11 header: WifiMacHeader hdr; - hdr.SetAction (); + hdr.SetType (WIFI_MAC_MGT_ACTION); hdr.SetDsNotFrom (); hdr.SetDsNotTo (); hdr.SetAddr2 (m_parent->GetAddress ()); diff --git a/src/mesh/model/dot11s/peer-management-protocol-mac.cc b/src/mesh/model/dot11s/peer-management-protocol-mac.cc index 8174892a7..aedce6486 100644 --- a/src/mesh/model/dot11s/peer-management-protocol-mac.cc +++ b/src/mesh/model/dot11s/peer-management-protocol-mac.cc @@ -314,7 +314,7 @@ PeerManagementProtocolMac::SendPeerLinkManagementFrame (Mac48Address peerAddress m_stats.txMgtBytes += packet->GetSize (); // Wifi Mac header: WifiMacHeader hdr; - hdr.SetAction (); + hdr.SetType (WIFI_MAC_MGT_ACTION); hdr.SetAddr1 (peerAddress); hdr.SetAddr2 (m_parent->GetAddress ()); //Addr is not used here, we use it as our MP address diff --git a/src/mesh/model/mesh-wifi-beacon.cc b/src/mesh/model/mesh-wifi-beacon.cc index 420282141..45c62fceb 100644 --- a/src/mesh/model/mesh-wifi-beacon.cc +++ b/src/mesh/model/mesh-wifi-beacon.cc @@ -20,7 +20,6 @@ #include "ns3/mesh-wifi-beacon.h" - namespace ns3 { MeshWifiBeacon::MeshWifiBeacon (Ssid ssid, SupportedRates rates, uint64_t us) @@ -29,6 +28,7 @@ MeshWifiBeacon::MeshWifiBeacon (Ssid ssid, SupportedRates rates, uint64_t us) m_header.SetSupportedRates (rates); m_header.SetBeaconIntervalUs (us); } + void MeshWifiBeacon::AddInformationElement (Ptr ie) { @@ -49,19 +49,19 @@ MeshWifiBeacon::CreatePacket () packet->AddHeader (BeaconHeader ()); return packet; } + WifiMacHeader MeshWifiBeacon::CreateHeader (Mac48Address address, Mac48Address mpAddress) { WifiMacHeader hdr; - - hdr.SetBeacon (); + hdr.SetType (WIFI_MAC_MGT_BEACON); hdr.SetAddr1 (Mac48Address::GetBroadcast ()); hdr.SetAddr2 (address); hdr.SetAddr3 (mpAddress); hdr.SetDsNotFrom (); hdr.SetDsNotTo (); - return hdr; } + } // namespace ns3 diff --git a/src/wave/model/ocb-wifi-mac.cc b/src/wave/model/ocb-wifi-mac.cc index 9c0b549d1..1ca86f634 100644 --- a/src/wave/model/ocb-wifi-mac.cc +++ b/src/wave/model/ocb-wifi-mac.cc @@ -70,7 +70,7 @@ OcbWifiMac::SendVsc (Ptr vsc, Mac48Address peer, OrganizationIdentifier { NS_LOG_FUNCTION (this << vsc << peer << oi); WifiMacHeader hdr; - hdr.SetAction (); + hdr.SetType (WIFI_MAC_MGT_ACTION); hdr.SetAddr1 (peer); hdr.SetAddr2 (GetAddress ()); hdr.SetAddr3 (WILDCARD_BSSID); @@ -207,7 +207,7 @@ OcbWifiMac::Enqueue (Ptr packet, Mac48Address to) } else { - hdr.SetTypeData (); + hdr.SetType (WIFI_MAC_DATA); } if (m_htSupported || m_vhtSupported) diff --git a/src/wifi/model/adhoc-wifi-mac.cc b/src/wifi/model/adhoc-wifi-mac.cc index 625d75079..634a7b45d 100644 --- a/src/wifi/model/adhoc-wifi-mac.cc +++ b/src/wifi/model/adhoc-wifi-mac.cc @@ -81,15 +81,15 @@ AdhocWifiMac::Enqueue (Ptr packet, Mac48Address to) } if (m_htSupported) { - m_stationManager->AddStationHtCapabilities (to, GetHtCapabilities()); + m_stationManager->AddStationHtCapabilities (to, GetHtCapabilities ()); } if (m_vhtSupported) { - m_stationManager->AddStationVhtCapabilities (to, GetVhtCapabilities()); + m_stationManager->AddStationVhtCapabilities (to, GetVhtCapabilities ()); } if (m_heSupported) { - m_stationManager->AddStationHeCapabilities (to, GetHeCapabilities()); + m_stationManager->AddStationHeCapabilities (to, GetHeCapabilities ()); } m_stationManager->AddAllSupportedModes (to); m_stationManager->RecordDisassociated (to); @@ -130,7 +130,7 @@ AdhocWifiMac::Enqueue (Ptr packet, Mac48Address to) } else { - hdr.SetTypeData (); + hdr.SetType (WIFI_MAC_DATA); } if (m_htSupported || m_vhtSupported || m_heSupported) @@ -181,19 +181,19 @@ AdhocWifiMac::Receive (Ptr packet, const WifiMacHeader *hdr) if (m_htSupported || m_vhtSupported || m_heSupported) { m_stationManager->AddAllSupportedMcs (from); - m_stationManager->AddStationHtCapabilities (from, GetHtCapabilities()); + m_stationManager->AddStationHtCapabilities (from, GetHtCapabilities ()); } if (m_htSupported) { - m_stationManager->AddStationHtCapabilities (from, GetHtCapabilities()); + m_stationManager->AddStationHtCapabilities (from, GetHtCapabilities ()); } if (m_vhtSupported) { - m_stationManager->AddStationVhtCapabilities (from, GetVhtCapabilities()); + m_stationManager->AddStationVhtCapabilities (from, GetVhtCapabilities ()); } if (m_heSupported) { - m_stationManager->AddStationHeCapabilities (from, GetHeCapabilities()); + m_stationManager->AddStationHeCapabilities (from, GetHeCapabilities ()); } m_stationManager->AddAllSupportedModes (from); m_stationManager->RecordDisassociated (from); diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index c6817899a..5373cebeb 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -313,7 +313,7 @@ ApWifiMac::ForwardDown (Ptr packet, Mac48Address from, } else { - hdr.SetTypeData (); + hdr.SetType (WIFI_MAC_DATA); } if (m_htSupported || m_vhtSupported || m_heSupported) @@ -572,7 +572,7 @@ ApWifiMac::SendProbeResp (Mac48Address to) { NS_LOG_FUNCTION (this << to); WifiMacHeader hdr; - hdr.SetProbeResp (); + hdr.SetType (WIFI_MAC_MGT_PROBE_RESPONSE); hdr.SetAddr1 (to); hdr.SetAddr2 (GetAddress ()); hdr.SetAddr3 (GetAddress ()); @@ -627,7 +627,7 @@ ApWifiMac::SendAssocResp (Mac48Address to, bool success) { NS_LOG_FUNCTION (this << to << success); WifiMacHeader hdr; - hdr.SetAssocResp (); + hdr.SetType (WIFI_MAC_MGT_ASSOCIATION_RESPONSE); hdr.SetAddr1 (to); hdr.SetAddr2 (GetAddress ()); hdr.SetAddr3 (GetAddress ()); @@ -685,7 +685,7 @@ ApWifiMac::SendOneBeacon (void) { NS_LOG_FUNCTION (this); WifiMacHeader hdr; - hdr.SetBeacon (); + hdr.SetType (WIFI_MAC_MGT_BEACON); hdr.SetAddr1 (Mac48Address::GetBroadcast ()); hdr.SetAddr2 (GetAddress ()); hdr.SetAddr3 (GetAddress ()); diff --git a/src/wifi/model/edca-txop-n.cc b/src/wifi/model/edca-txop-n.cc index 17fbd194c..597e43db7 100644 --- a/src/wifi/model/edca-txop-n.cc +++ b/src/wifi/model/edca-txop-n.cc @@ -1447,7 +1447,7 @@ EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq, NS_LOG_FUNCTION (this << dest << (uint16_t)tid << startSeq << timeout << immediateBAck); NS_LOG_DEBUG ("sent ADDBA request to " << dest); WifiMacHeader hdr; - hdr.SetAction (); + hdr.SetType (WIFI_MAC_MGT_ACTION); hdr.SetAddr1 (dest); hdr.SetAddr2 (m_low->GetAddress ()); hdr.SetAddr3 (m_low->GetAddress ()); @@ -1507,7 +1507,7 @@ EdcaTxopN::SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator) { NS_LOG_FUNCTION (this << addr << (uint16_t)tid << byOriginator); WifiMacHeader hdr; - hdr.SetAction (); + hdr.SetType (WIFI_MAC_MGT_ACTION); hdr.SetAddr1 (addr); hdr.SetAddr2 (m_low->GetAddress ()); hdr.SetAddr3 (m_low->GetAddress ()); diff --git a/src/wifi/model/regular-wifi-mac.cc b/src/wifi/model/regular-wifi-mac.cc index ddb001b56..405f94726 100644 --- a/src/wifi/model/regular-wifi-mac.cc +++ b/src/wifi/model/regular-wifi-mac.cc @@ -1002,7 +1002,7 @@ RegularWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, { NS_LOG_FUNCTION (this); WifiMacHeader hdr; - hdr.SetAction (); + hdr.SetType (WIFI_MAC_MGT_ACTION); hdr.SetAddr1 (originator); hdr.SetAddr2 (GetAddress ()); hdr.SetAddr3 (GetAddress ()); diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index 87eb351ca..b4a09f6c9 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -130,7 +130,7 @@ StaWifiMac::SendProbeRequest (void) { NS_LOG_FUNCTION (this); WifiMacHeader hdr; - hdr.SetProbeReq (); + hdr.SetType (WIFI_MAC_MGT_PROBE_REQUEST); hdr.SetAddr1 (Mac48Address::GetBroadcast ()); hdr.SetAddr2 (GetAddress ()); hdr.SetAddr3 (Mac48Address::GetBroadcast ()); @@ -174,7 +174,7 @@ StaWifiMac::SendAssociationRequest (void) { NS_LOG_FUNCTION (this << GetBssid ()); WifiMacHeader hdr; - hdr.SetAssocReq (); + hdr.SetType (WIFI_MAC_MGT_ASSOCIATION_REQUEST); hdr.SetAddr1 (GetBssid ()); hdr.SetAddr2 (GetAddress ()); hdr.SetAddr3 (GetBssid ()); @@ -363,7 +363,7 @@ StaWifiMac::Enqueue (Ptr packet, Mac48Address to) } else { - hdr.SetTypeData (); + hdr.SetType (WIFI_MAC_DATA); } if (m_htSupported || m_vhtSupported || m_heSupported) { diff --git a/src/wifi/model/wifi-mac-header.cc b/src/wifi/model/wifi-mac-header.cc index a3565e7b2..7fae7da60 100644 --- a/src/wifi/model/wifi-mac-header.cc +++ b/src/wifi/model/wifi-mac-header.cc @@ -107,76 +107,6 @@ WifiMacHeader::SetAddr4 (Mac48Address address) m_addr4 = address; } -void -WifiMacHeader::SetAssocReq (void) -{ - m_ctrlType = TYPE_MGT; - m_ctrlSubtype = 0; -} - -void -WifiMacHeader::SetAssocResp (void) -{ - m_ctrlType = TYPE_MGT; - m_ctrlSubtype = 1; -} - -void -WifiMacHeader::SetProbeReq (void) -{ - m_ctrlType = TYPE_MGT; - m_ctrlSubtype = 4; -} - -void -WifiMacHeader::SetProbeResp (void) -{ - m_ctrlType = TYPE_MGT; - m_ctrlSubtype = 5; -} - -void -WifiMacHeader::SetBeacon (void) -{ - m_ctrlType = TYPE_MGT; - m_ctrlSubtype = 8; -} - -void -WifiMacHeader::SetBlockAckReq (void) -{ - m_ctrlType = TYPE_CTL; - m_ctrlSubtype = 8; -} - -void -WifiMacHeader::SetBlockAck (void) -{ - m_ctrlType = TYPE_CTL; - m_ctrlSubtype = 9; -} - -void -WifiMacHeader::SetTypeData (void) -{ - m_ctrlType = TYPE_DATA; - m_ctrlSubtype = 0; -} - -void -WifiMacHeader::SetAction (void) -{ - m_ctrlType = TYPE_MGT; - m_ctrlSubtype = 0x0D; -} - -void -WifiMacHeader::SetMultihopAction (void) -{ - m_ctrlType = TYPE_MGT; - m_ctrlSubtype = 0x0F; -} - void WifiMacHeader::SetType (WifiMacType type) { diff --git a/src/wifi/model/wifi-mac-header.h b/src/wifi/model/wifi-mac-header.h index b55f6a71b..8d6c604e8 100644 --- a/src/wifi/model/wifi-mac-header.h +++ b/src/wifi/model/wifi-mac-header.h @@ -116,47 +116,6 @@ public: void Serialize (Buffer::Iterator start) const; uint32_t Deserialize (Buffer::Iterator start); - /** - * Set Type/Subtype values for an association request header. - */ - void SetAssocReq (void); - /** - * Set Type/Subtype values for an association response header. - */ - void SetAssocResp (void); - /** - * Set Type/Subtype values for a probe request header. - */ - void SetProbeReq (void); - /** - * Set Type/Subtype values for a probe response header. - */ - void SetProbeResp (void); - /** - * Set Type/Subtype values for a beacon header. - */ - void SetBeacon (void); - /** - * Set Type/Subtype values for a data packet with - * no subtype equal to 0. - */ - void SetTypeData (void); - /** - * Set Type/Subtype values for an action header. - */ - void SetAction (); - /** - * Set Type/Subtype values for a Block Ack Request header. - */ - void SetBlockAckReq (void); - /** - * Set Type/Subtype values for a Block Ack header. - */ - void SetBlockAck (void); - /** - * Set Type/Subtype values for a multihop action header. - */ - void SetMultihopAction (); /** * Set the From DS bit in the Frame Control field. */ diff --git a/src/wifi/test/power-rate-adaptation-test.cc b/src/wifi/test/power-rate-adaptation-test.cc index a84322256..5e7a6ce2f 100644 --- a/src/wifi/test/power-rate-adaptation-test.cc +++ b/src/wifi/test/power-rate-adaptation-test.cc @@ -134,7 +134,7 @@ PowerRateAdaptationTest::TestParf () */ Mac48Address remoteAddress = Mac48Address::Allocate (); WifiMacHeader packetHeader; - packetHeader.SetTypeData (); + packetHeader.SetType (WIFI_MAC_DATA); packetHeader.SetQosTid (0); Ptr packet = Create (10); WifiMode ackMode; @@ -354,7 +354,7 @@ PowerRateAdaptationTest::TestAparf () */ Mac48Address remoteAddress = Mac48Address::Allocate (); WifiMacHeader packetHeader; - packetHeader.SetTypeData (); + packetHeader.SetType (WIFI_MAC_DATA); packetHeader.SetQosTid (0); Ptr packet = Create (10); WifiMode ackMode; @@ -596,7 +596,7 @@ PowerRateAdaptationTest::TestRrpaa () */ Mac48Address remoteAddress = Mac48Address::Allocate (); WifiMacHeader packetHeader; - packetHeader.SetTypeData (); + packetHeader.SetType (WIFI_MAC_DATA); packetHeader.SetQosTid (0); Ptr packet = Create (10); WifiMode ackMode;