From e31acccefcaee8fff7082cbee084db2986752527 Mon Sep 17 00:00:00 2001 From: Christopher Hepner Date: Tue, 5 May 2015 15:10:55 -0700 Subject: [PATCH] make 802.11s model more compliant to the IEEE802.11s-2012 standard --- src/mesh/model/dot11s/hwmp-protocol-mac.cc | 6 +- .../model/dot11s/ie-dot11s-configuration.cc | 59 ++++--- .../model/dot11s/ie-dot11s-configuration.h | 53 +++---- .../model/dot11s/ie-dot11s-peer-management.h | 33 ++-- src/mesh/model/dot11s/ie-dot11s-perr.cc | 23 ++- src/mesh/model/dot11s/peer-link-frame.cc | 39 ++--- .../dot11s/peer-management-protocol-mac.cc | 32 ++-- src/mesh/model/mesh-information-element.h | 32 ++-- src/wifi/model/mgt-headers.cc | 147 +++++++++++------- src/wifi/model/mgt-headers.h | 86 +++++----- 10 files changed, 261 insertions(+), 249 deletions(-) diff --git a/src/mesh/model/dot11s/hwmp-protocol-mac.cc b/src/mesh/model/dot11s/hwmp-protocol-mac.cc index c63941dc1..b805dbfc9 100644 --- a/src/mesh/model/dot11s/hwmp-protocol-mac.cc +++ b/src/mesh/model/dot11s/hwmp-protocol-mac.cc @@ -99,7 +99,7 @@ HwmpProtocolMac::ReceiveAction (Ptr packet, const WifiMacHeader & header m_stats.rxMgtBytes += packet->GetSize (); WifiActionHeader actionHdr; packet->RemoveHeader (actionHdr); - if (actionHdr.GetCategory () != WifiActionHeader::MESH_PATH_SELECTION) + if (actionHdr.GetCategory () != WifiActionHeader::MESH) { return true; } @@ -210,8 +210,8 @@ HwmpProtocolMac::GetWifiActionHeader () { WifiActionHeader actionHdr; WifiActionHeader::ActionValue action; - action.pathSelection = WifiActionHeader::PATH_SELECTION; - actionHdr.SetAction (WifiActionHeader::MESH_PATH_SELECTION, action); + action.meshAction = WifiActionHeader::PATH_SELECTION; + actionHdr.SetAction (WifiActionHeader::MESH, action); return actionHdr; } void diff --git a/src/mesh/model/dot11s/ie-dot11s-configuration.cc b/src/mesh/model/dot11s/ie-dot11s-configuration.cc index fddfd5ecf..1e974d98a 100644 --- a/src/mesh/model/dot11s/ie-dot11s-configuration.cc +++ b/src/mesh/model/dot11s/ie-dot11s-configuration.cc @@ -32,17 +32,17 @@ Dot11sMeshCapability::Dot11sMeshCapability () : uint8_t Dot11sMeshCapability::GetSerializedSize () const { - return 2; + return 1; } -uint16_t -Dot11sMeshCapability::GetUint16 () const +uint8_t +Dot11sMeshCapability::GetUint8 () const //IEEE 802.11-2012 8.4.2.100.8 Mesh Capability { - uint16_t result = 0; + uint8_t result = 0; if (acceptPeerLinks) { - result |= 1 << 0; + result |= 1 << 0; //The Accepting Additional Mesh Peerings subfield is set to 1 if the mesh STA is willing to establish additional mesh peerings with other mesh STAs and set to 0 otherwise } - if (MCCASupported) + if (MCCASupported) // The MCCA Supported subfield is set to 1 if the mesh STA implements MCCA and set to 0 otherwise { result |= 1 << 1; } @@ -71,13 +71,13 @@ Dot11sMeshCapability::GetUint16 () const Buffer::Iterator Dot11sMeshCapability::Serialize (Buffer::Iterator i) const { - i.WriteHtolsbU16 (GetUint16 ()); + i.WriteU8 (GetUint8 ()); return i; } Buffer::Iterator Dot11sMeshCapability::Deserialize (Buffer::Iterator i) { - uint16_t cap = i.ReadLsbtohU16 (); + uint8_t cap = i.ReadU8 (); acceptPeerLinks = Is (cap, 0); MCCASupported = Is (cap, 1); MCCAEnabled = Is (cap, 2); @@ -88,7 +88,7 @@ Dot11sMeshCapability::Deserialize (Buffer::Iterator i) return i; } bool -Dot11sMeshCapability::Is (uint16_t cap, uint8_t n) const +Dot11sMeshCapability::Is (uint8_t cap, uint8_t n) const { uint16_t mask = 1 << n; return (cap & mask); @@ -107,29 +107,28 @@ IeConfiguration::IeConfiguration () : uint8_t IeConfiguration::GetInformationFieldSize () const { - return 1 // Version - + 4 // APSPId - + 4 // APSMId - + 4 // CCMId - + 4 // SPId - + 4 // APId + return 0 // Version + + 1 // APSPId + + 1 // APSMId + + 1 // CCMId + + 1 // SPId + + 1 // APId + 1 // Mesh formation info (see 7.3.2.86.6 of 802.11s draft 3.0) + m_meshCap.GetSerializedSize (); } void IeConfiguration::SerializeInformationField (Buffer::Iterator i) const { - i.WriteU8 (1); //Version // Active Path Selection Protocol ID: - i.WriteHtolsbU32 (m_APSPId); + i.WriteU8 (m_APSPId); // Active Path Metric ID: - i.WriteHtolsbU32 (m_APSMId); + i.WriteU8 (m_APSMId); // Congestion Control Mode ID: - i.WriteHtolsbU32 (m_CCMId); + i.WriteU8 (m_CCMId); // Sync: - i.WriteHtolsbU32 (m_SPId); + i.WriteU8 (m_SPId); // Auth: - i.WriteHtolsbU32 (m_APId); + i.WriteU8 (m_APId); i.WriteU8 (m_neighbors << 1); m_meshCap.Serialize (i); } @@ -137,20 +136,14 @@ uint8_t IeConfiguration::DeserializeInformationField (Buffer::Iterator i, uint8_t length) { Buffer::Iterator start = i; - uint8_t version; - version = i.ReadU8 (); - if (version != 1) - { - NS_FATAL_ERROR ("Other versions not supported yet"); - } // Active Path Selection Protocol ID: - m_APSPId = (dot11sPathSelectionProtocol) i.ReadLsbtohU32 (); + m_APSPId = (dot11sPathSelectionProtocol) i.ReadU8 (); // Active Path Metric ID: - m_APSMId = (dot11sPathSelectionMetric) i.ReadLsbtohU32 (); + m_APSMId = (dot11sPathSelectionMetric) i.ReadU8 (); // Congestion Control Mode ID: - m_CCMId = (dot11sCongestionControlMode) i.ReadLsbtohU32 (); - m_SPId = (dot11sSynchronizationProtocolIdentifier) i.ReadLsbtohU32 (); - m_APId = (dot11sAuthenticationProtocol) i.ReadLsbtohU32 (); + m_CCMId = (dot11sCongestionControlMode) i.ReadU8 (); + m_SPId = (dot11sSynchronizationProtocolIdentifier) i.ReadU8 (); + m_APId = (dot11sAuthenticationProtocol) i.ReadU8 (); m_neighbors = (i.ReadU8 () >> 1) & 0xF; i = m_meshCap.Deserialize (i); return i.GetDistanceFrom (start); @@ -165,7 +158,7 @@ IeConfiguration::Print (std::ostream& os) const << std::endl << "Congestion Control Mode ID: = " << (uint32_t) m_CCMId << std::endl << "Synchronize protocol ID: = " << (uint32_t) m_SPId << std::endl << "Authentication protocol ID: = " << (uint32_t) m_APId - << std::endl << "Capabilities: = " << m_meshCap.GetUint16 () << std::endl; + << std::endl << "Capabilities: = " << m_meshCap.GetUint8 () << std::endl; os << "" << std::endl; } void diff --git a/src/mesh/model/dot11s/ie-dot11s-configuration.h b/src/mesh/model/dot11s/ie-dot11s-configuration.h index 372c26f9e..1e7c0fd6c 100644 --- a/src/mesh/model/dot11s/ie-dot11s-configuration.h +++ b/src/mesh/model/dot11s/ie-dot11s-configuration.h @@ -27,48 +27,41 @@ namespace ns3 { namespace dot11s { -/** - * \ingroup dot11s - * \brief See 7.3.2.86.1 in 802.11s draft 3.0 - */ + +//according to IEEE 802.11 - 2012 + +//in 7.3.2.98.2 Active Path Selection Protocol Identifier - 802.11s-2011 enum dot11sPathSelectionProtocol { - PROTOCOL_HWMP = 0x000fac00, + PROTOCOL_HWMP = 0x01, }; -/** - * \ingroup dot11s - * \brief See 7.3.2.86.2 in 802.11s draft 3.0 - */ + +//in 7.3.2.98.3 Active Path Selection Metric Identifier - 802.11s-2011 enum dot11sPathSelectionMetric { - METRIC_AIRTIME = 0x000fac00, + METRIC_AIRTIME = 0x01, }; -/** - * \ingroup dot11s - * \brief See 7.3.2.86.3 in 802.11s draft 3.0 - */ + +// in 7.3.2.98.4 Congestion Control Mode Identifier - 802.11s-2011 enum dot11sCongestionControlMode { - CONGESTION_SIGNALING = 0x000fac00, - CONGESTION_NULL = 0x000facff, + CONGESTION_SIGNALING = 0x01, + CONGESTION_NULL = 0x00, }; -/** - * \ingroup dot11s - * \brief See 7.3.2.86.4 in 802.11s draft 3.0 - */ + +// in 7.3.2.98.5 Synchronization Method Identifier - 802.11s-2011 enum dot11sSynchronizationProtocolIdentifier { - SYNC_NEIGHBOUR_OFFSET = 0x000fac00, - SYNC_NULL = 0x000facff, + SYNC_NEIGHBOUR_OFFSET = 0x01, //Neighbor offset synchronization method + SYNC_NULL = 0x00, //Reserved }; -/** - * \ingroup dot11s - * \brief See 7.3.2.86.5 in 802.11s draft 3.0 - */ + +// in 7.3.2.98.6 Authentication Protocol Identifier - 802.11s-2011 enum dot11sAuthenticationProtocol { - AUTH_NULL = 0x000fac00, - AUTH_SAE = 0x000fac01, + AUTH_NULL = 0x00, //No authentication method is required to establish mesh peerings within the MBSS + AUTH_SAE = 0x01, //SAE defined in 8.2a + AUTH_IEEE = 0x02, //IEEE 802.1X authentication }; /** * \ingroup dot11s @@ -81,7 +74,7 @@ public: uint8_t GetSerializedSize () const; Buffer::Iterator Serialize (Buffer::Iterator i) const; Buffer::Iterator Deserialize (Buffer::Iterator i); - uint16_t GetUint16 () const; + uint8_t GetUint8 () const; bool acceptPeerLinks; bool MCCASupported; bool MCCAEnabled; @@ -89,7 +82,7 @@ public: bool beaconTimingReport; bool TBTTAdjustment; bool powerSaveLevel; - bool Is (uint16_t cap,uint8_t n) const; + bool Is (uint8_t cap,uint8_t n) const; friend bool operator== (const Dot11sMeshCapability & a, const Dot11sMeshCapability & b); }; diff --git a/src/mesh/model/dot11s/ie-dot11s-peer-management.h b/src/mesh/model/dot11s/ie-dot11s-peer-management.h index a8ab13737..cbbb95322 100644 --- a/src/mesh/model/dot11s/ie-dot11s-peer-management.h +++ b/src/mesh/model/dot11s/ie-dot11s-peer-management.h @@ -33,31 +33,30 @@ namespace dot11s { */ enum PmpReasonCode { - REASON11S_PEERING_CANCELLED = 2, // according to open80211s - REASON11S_MESH_MAX_PEERS, - REASON11S_MESH_CAPABILITY_POLICY_VIOLATION, - REASON11S_MESH_CLOSE_RCVD, - REASON11S_MESH_MAX_RETRIES, - REASON11S_MESH_CONFIRM_TIMEOUT, - REASON11S_MESH_INVALID_GTK, - REASON11S_MESH_INCONSISTENT_PARAMETERS, - REASON11S_MESH_INVALID_SECURITY_CAPABILITY, - REASON11S_RESERVED, + REASON11S_PEERING_CANCELLED = 52, // according to IEEE 802.11 - 2012 + REASON11S_MESH_MAX_PEERS = 53, + REASON11S_MESH_CAPABILITY_POLICY_VIOLATION = 54, + REASON11S_MESH_CLOSE_RCVD = 55, + REASON11S_MESH_MAX_RETRIES = 56, + REASON11S_MESH_CONFIRM_TIMEOUT = 57, + REASON11S_MESH_INVALID_GTK = 58, + REASON11S_MESH_INCONSISTENT_PARAMETERS = 59, + REASON11S_MESH_INVALID_SECURITY_CAPABILITY =60, + REASON11S_RESERVED = 67, }; -/** - * \ingroup dot11s - * \brief See 7.3.2.85 of draft 2.07 - */ + +// according to IEEE 802.11 - 2012 + class IePeerManagement : public WifiInformationElement { public: IePeerManagement (); enum Subtype { - PEER_OPEN = 0, - PEER_CONFIRM, - PEER_CLOSE, + PEER_OPEN = 1, + PEER_CONFIRM = 2, + PEER_CLOSE = 3, }; void SetPeerOpen (uint16_t localLinkId); void SetPeerClose (uint16_t localLinkID, uint16_t peerLinkId, PmpReasonCode reasonCode); diff --git a/src/mesh/model/dot11s/ie-dot11s-perr.cc b/src/mesh/model/dot11s/ie-dot11s-perr.cc index f5870953b..9cf01b68d 100644 --- a/src/mesh/model/dot11s/ie-dot11s-perr.cc +++ b/src/mesh/model/dot11s/ie-dot11s-perr.cc @@ -54,28 +54,33 @@ IePerr::GetNumOfDest () const void IePerr::SerializeInformationField (Buffer::Iterator i) const { - i.WriteU8 (0); - i.WriteU8 (m_addressUnits.size ()); + i.WriteU8 (0);// TTL + i.WriteU8 (m_addressUnits.size ()); // number of Destinations for (unsigned int j = 0; j < m_addressUnits.size (); j++) { + i.WriteU8 (0); // not used // Bit 6: AE (Address Extension) subfield (1 = destination external address is present, 0 = otherwise). WriteTo (i, m_addressUnits[j].destination); i.WriteHtolsbU32 (m_addressUnits[j].seqnum); + i.WriteU8 (0); + i.WriteU8 (0); } } uint8_t IePerr::DeserializeInformationField (Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; - i.Next (1); //Mode flags is not used now + i.Next (1); //TTL //Mode flags is not used now uint8_t numOfDest = i.ReadU8 (); - NS_ASSERT ((2 + 10 * numOfDest ) == length); + NS_ASSERT ((2 + 13 * numOfDest ) == length); length = 0; //to avoid compiler warning in optimized builds for (unsigned int j = 0; j < numOfDest; j++) { + i.Next (1); // flags is not used now HwmpProtocol::FailedDestination unit; ReadFrom (i, unit.destination); unit.seqnum = i.ReadLsbtohU32 (); m_addressUnits.push_back (unit); + i.Next (2); // Reason } return i.GetDistanceFrom (start); } @@ -83,9 +88,11 @@ IePerr::DeserializeInformationField (Buffer::Iterator start, uint8_t length) uint8_t IePerr::GetInformationFieldSize () const { - uint8_t retval = 1 //ModeFlags + uint8_t retval = 1 //TTL //ModeFlags + 1 //NumOfDests - + (6 + 4) * m_addressUnits.size (); + + 1 * m_addressUnits.size () //ModeFlags + + (6 + 4) * m_addressUnits.size () + + 2* m_addressUnits.size (); // Reason Code return retval; } @@ -99,7 +106,7 @@ IePerr::AddAddressUnit (HwmpProtocol::FailedDestination unit) return; } } - if ((m_addressUnits.size () + 1) * 10 + 2 > 255) + if ((m_addressUnits.size () + 1) * 13 + 2 > 255) { return; } @@ -112,7 +119,7 @@ IePerr::IsFull () const return (GetInformationFieldSize () > 255 - 2 /* ID + LENGTH*/ - - 10 /* Size of Mac48Address + uint32_t (one unit)*/ + - 13// 10 /* Size of Mac48Address + uint32_t (one unit)*/ ); } std::vector diff --git a/src/mesh/model/dot11s/peer-link-frame.cc b/src/mesh/model/dot11s/peer-link-frame.cc index 3ae8e4102..eeba6deda 100644 --- a/src/mesh/model/dot11s/peer-link-frame.cc +++ b/src/mesh/model/dot11s/peer-link-frame.cc @@ -30,7 +30,7 @@ NS_OBJECT_ENSURE_REGISTERED (PeerLinkFrameStart); PeerLinkFrameStart::PeerLinkFrameStart () : m_subtype (255), m_capability (0), m_aid (0), m_rates (SupportedRates ()), m_meshId (), - m_config (IeConfiguration ()), m_reasonCode ((uint16_t)REASON11S_RESERVED) + m_config (IeConfiguration ()) { } void @@ -42,7 +42,7 @@ void PeerLinkFrameStart::SetPlinkFrameStart (PeerLinkFrameStart::PlinkFrameStartFields fields) { m_subtype = fields.subtype; - m_protocol = fields.protocol; + if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)) { m_capability = fields.capability; @@ -65,7 +65,7 @@ PeerLinkFrameStart::SetPlinkFrameStart (PeerLinkFrameStart::PlinkFrameStartField } else { - m_reasonCode = fields.reasonCode; + //reasonCode not used here } } PeerLinkFrameStart::PlinkFrameStartFields @@ -79,7 +79,7 @@ PeerLinkFrameStart::GetFields () const retval.rates = m_rates; retval.meshId = m_meshId; retval.config = m_config; - retval.reasonCode = m_reasonCode; + return retval; } TypeId @@ -107,8 +107,8 @@ PeerLinkFrameStart::Print (std::ostream &os) const uint32_t PeerLinkFrameStart::GetSerializedSize () const { - uint32_t size = 3; //Peering protocol - NS_ASSERT (m_subtype < 3); + uint32_t size =0; //Peering protocol + NS_ASSERT (m_subtype < 4); if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) { size += 2; //capability @@ -132,7 +132,7 @@ PeerLinkFrameStart::GetSerializedSize () const } else { - size += 2; //reasonCode + //reasonCode not used here } return size; } @@ -140,8 +140,8 @@ void PeerLinkFrameStart::Serialize (Buffer::Iterator start) const { Buffer::Iterator i = start; - NS_ASSERT (m_subtype < 3); - i = m_protocol.Serialize (i); + NS_ASSERT (m_subtype < 4); + if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) { i.WriteHtolsbU16 (m_capability); @@ -165,24 +165,15 @@ PeerLinkFrameStart::Serialize (Buffer::Iterator start) const } else { - i.WriteHtolsbU16 (m_reasonCode); + //reasonCode not used here } } uint32_t PeerLinkFrameStart::Deserialize (Buffer::Iterator start) { Buffer::Iterator i = start; - NS_ASSERT (m_subtype < 3); - { - uint8_t id = i.ReadU8 (); - uint8_t length = i.ReadU8 (); - m_protocol.DeserializeInformationField (i, length); - if ((m_protocol.ElementId () != (WifiInformationElementId) id) || (m_protocol.GetInformationFieldSize () != length)) - { - NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); - } - i.Next (m_protocol.GetInformationFieldSize ()); - } + NS_ASSERT (m_subtype < 4); + if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) { m_capability = i.ReadLsbtohU16 (); @@ -220,7 +211,7 @@ PeerLinkFrameStart::Deserialize (Buffer::Iterator start) } else { - m_reasonCode = i.ReadLsbtohU16 (); + //reasonCode not used here } return i.GetDistanceFrom (start); } @@ -228,8 +219,8 @@ bool operator== (const PeerLinkFrameStart & a, const PeerLinkFrameStart & b) { return ((a.m_subtype == b.m_subtype) && (a.m_capability == b.m_capability) && (a.m_aid == b.m_aid) - && (a.m_meshId.IsEqual (b.m_meshId)) && (a.m_config == b.m_config) - && (a.m_reasonCode == b.m_reasonCode)); + && (a.m_meshId.IsEqual (b.m_meshId)) && (a.m_config == b.m_config)); + } } // namespace dot11s } // namespace ns3 diff --git a/src/mesh/model/dot11s/peer-management-protocol-mac.cc b/src/mesh/model/dot11s/peer-management-protocol-mac.cc index a5248d37e..6bbd3ebeb 100644 --- a/src/mesh/model/dot11s/peer-management-protocol-mac.cc +++ b/src/mesh/model/dot11s/peer-management-protocol-mac.cc @@ -88,7 +88,7 @@ PeerManagementProtocolMac::Receive (Ptr const_packet, const WifiMacHeade packet->RemoveHeader (actionHdr); WifiActionHeader::ActionValue actionValue = actionHdr.GetAction (); // If can not handle - just return; - if (actionHdr.GetCategory () != WifiActionHeader::MESH_PEERING_MGT) + if (actionHdr.GetCategory () != WifiActionHeader::SELF_PROTECTED) { return m_protocol->IsActiveLink (m_ifIndex, header.GetAddr2 ()); } @@ -99,20 +99,19 @@ PeerManagementProtocolMac::Receive (Ptr const_packet, const WifiMacHeade PeerLinkFrameStart::PlinkFrameStartFields fields; { PeerLinkFrameStart peerFrame; - peerFrame.SetPlinkFrameSubtype ((uint8_t) actionValue.peerLink); + peerFrame.SetPlinkFrameSubtype ((uint8_t) actionValue.selfProtectedAction); packet->RemoveHeader (peerFrame); fields = peerFrame.GetFields (); - NS_ASSERT (fields.subtype == actionValue.peerLink); + NS_ASSERT (fields.subtype == actionValue.selfProtectedAction); } - if ((actionValue.peerLink != WifiActionHeader::PEER_LINK_CLOSE) && !(m_parent->CheckSupportedRates ( - fields.rates))) + if ((actionValue.selfProtectedAction != WifiActionHeader::PEER_LINK_CLOSE) && !(m_parent->CheckSupportedRates (fields.rates))) { m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress); // Broken peer link frame - drop it m_stats.brokenMgt++; return false; } - if ((actionValue.peerLink != WifiActionHeader::PEER_LINK_CONFIRM) && !fields.meshId.IsEqual ( + if ((actionValue.selfProtectedAction != WifiActionHeader::PEER_LINK_CONFIRM) && !fields.meshId.IsEqual ( *(m_protocol->GetMeshId ()))) { m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress); @@ -125,22 +124,23 @@ PeerManagementProtocolMac::Receive (Ptr const_packet, const WifiMacHeade MeshInformationElementVector elements; packet->RemoveHeader (elements); peerElement = DynamicCast(elements.FindFirst (IE11S_PEERING_MANAGEMENT)); + NS_ASSERT (peerElement != 0); //Check taht frame subtype corresponds peer link subtype if (peerElement->SubtypeIsOpen ()) { m_stats.rxOpen++; - NS_ASSERT (actionValue.peerLink == WifiActionHeader::PEER_LINK_OPEN); + NS_ASSERT (actionValue.selfProtectedAction == WifiActionHeader::PEER_LINK_OPEN); } if (peerElement->SubtypeIsConfirm ()) { m_stats.rxConfirm++; - NS_ASSERT (actionValue.peerLink == WifiActionHeader::PEER_LINK_CONFIRM); + NS_ASSERT (actionValue.selfProtectedAction == WifiActionHeader::PEER_LINK_CONFIRM); } if (peerElement->SubtypeIsClose ()) { m_stats.rxClose++; - NS_ASSERT (actionValue.peerLink == WifiActionHeader::PEER_LINK_CLOSE); + NS_ASSERT (actionValue.selfProtectedAction == WifiActionHeader::PEER_LINK_CLOSE); } //Deliver Peer link management frame to protocol: m_protocol->ReceivePeerLinkFrame (m_ifIndex, peerAddress, peerMpAddress, fields.aid, *peerElement, @@ -158,7 +158,7 @@ PeerManagementProtocolMac::UpdateOutcomingFrame (Ptr packet, WifiMacHead { WifiActionHeader actionHdr; packet->PeekHeader (actionHdr); - if (actionHdr.GetCategory () == WifiActionHeader::MESH_PEERING_MGT) + if (actionHdr.GetCategory () == WifiActionHeader::SELF_PROTECTED) { return true; } @@ -215,27 +215,27 @@ PeerManagementProtocolMac::SendPeerLinkManagementFrame (Mac48Address peerAddress { m_stats.txOpen++; WifiActionHeader::ActionValue action; - action.peerLink = WifiActionHeader::PEER_LINK_OPEN; + action.selfProtectedAction = WifiActionHeader::PEER_LINK_OPEN; fields.subtype = WifiActionHeader::PEER_LINK_OPEN; - actionHdr.SetAction (WifiActionHeader::MESH_PEERING_MGT, action); + actionHdr.SetAction (WifiActionHeader::SELF_PROTECTED, action); } if (peerElement.SubtypeIsConfirm ()) { m_stats.txConfirm++; WifiActionHeader::ActionValue action; - action.peerLink = WifiActionHeader::PEER_LINK_CONFIRM; + action.selfProtectedAction = WifiActionHeader::PEER_LINK_CONFIRM; fields.aid = aid; fields.subtype = WifiActionHeader::PEER_LINK_CONFIRM; - actionHdr.SetAction (WifiActionHeader::MESH_PEERING_MGT, action); + actionHdr.SetAction (WifiActionHeader::SELF_PROTECTED, action); } if (peerElement.SubtypeIsClose ()) { m_stats.txClose++; WifiActionHeader::ActionValue action; - action.peerLink = WifiActionHeader::PEER_LINK_CLOSE; + action.selfProtectedAction = WifiActionHeader::PEER_LINK_CLOSE; fields.subtype = WifiActionHeader::PEER_LINK_CLOSE; fields.reasonCode = peerElement.GetReasonCode (); - actionHdr.SetAction (WifiActionHeader::MESH_PEERING_MGT, action); + actionHdr.SetAction (WifiActionHeader::SELF_PROTECTED, action); } plinkFrame.SetPlinkFrameStart (fields); packet->AddHeader (plinkFrame); diff --git a/src/mesh/model/mesh-information-element.h b/src/mesh/model/mesh-information-element.h index 0031c2695..3aa47648e 100644 --- a/src/mesh/model/mesh-information-element.h +++ b/src/mesh/model/mesh-information-element.h @@ -25,31 +25,31 @@ namespace ns3 { -#define IE11S_LINK_METRIC_REPORT ((WifiInformationElementId)20) -#define IE11S_CONGESTION_NOTIFICATION ((WifiInformationElementId)21) +#define IE11S_LINK_METRIC_REPORT ((WifiInformationElementId)115) +#define IE11S_CONGESTION_NOTIFICATION ((WifiInformationElementId)116) #define IE11S_SUPP_MBSS_REG_CLASSES_CHANNELS ((WifiInformationElementId)23) #define IE11S_MESH_CHANNEL_SWITCH_ANNOUNCEMENT ((WifiInformationElementId)24) #define IE11S_MESH_TIM ((WifiInformationElementId)25) -#define IE11S_AWAKE_WINDOW ((WifiInformationElementId)26) -#define IE11S_BEACON_TIMING ((WifiInformationElementId)27) -#define IE11S_MCCAOP_SETUP_REQUEST ((WifiInformationElementId)28) -#define IE11S_MCCAOP_SETUP_REPLY ((WifiInformationElementId)29) -#define IE11S_MCCAOP_ADVERTISEMENT ((WifiInformationElementId)30) +#define IE11S_AWAKE_WINDOW ((WifiInformationElementId)119) +#define IE11S_BEACON_TIMING ((WifiInformationElementId)120) +#define IE11S_MCCAOP_SETUP_REQUEST ((WifiInformationElementId)121) +#define IE11S_MCCAOP_SETUP_REPLY ((WifiInformationElementId)122) +#define IE11S_MCCAOP_ADVERTISEMENT ((WifiInformationElementId)123) #define IE11S_MCCAOP_RESERVATION_TEARDOWN ((WifiInformationElementId)31) #define IE11S_PORTAL_ANNOUNCEMENT ((WifiInformationElementId)32) -#define IE11S_PROXY_UPDATE ((WifiInformationElementId)37) -#define IE11S_PROXY_UPDATE_CONFIRMATION ((WifiInformationElementId)38) +#define IE11S_PROXY_UPDATE ((WifiInformationElementId)137) +#define IE11S_PROXY_UPDATE_CONFIRMATION ((WifiInformationElementId)138) #define IE11S_ABBREVIATED_HANDSHAKE ((WifiInformationElementId)39) /* begin of open80211s-compatible IDs */ -#define IE11S_MESH_CONFIGURATION ((WifiInformationElementId)51) -#define IE11S_MESH_ID ((WifiInformationElementId)52) -#define IE11S_PEERING_MANAGEMENT ((WifiInformationElementId)55) +#define IE11S_MESH_CONFIGURATION ((WifiInformationElementId)113) +#define IE11S_MESH_ID ((WifiInformationElementId)114) +#define IE11S_PEERING_MANAGEMENT ((WifiInformationElementId)117) /* end of open80211s-compatible IDs */ -#define IE11S_RANN ((WifiInformationElementId)67) +#define IE11S_RANN ((WifiInformationElementId)126) /* begin of open80211s-compatible IDs */ -#define IE11S_PREQ ((WifiInformationElementId)68) -#define IE11S_PREP ((WifiInformationElementId)69) -#define IE11S_PERR ((WifiInformationElementId)70) +#define IE11S_PREQ ((WifiInformationElementId)130) +#define IE11S_PREP ((WifiInformationElementId)131) +#define IE11S_PERR ((WifiInformationElementId)132) /* end of open80211s-compatible IDs */ #define IE11S_MESH_PEERING_PROTOCOL_VERSION ((WifiInformationElementId)74) diff --git a/src/wifi/model/mgt-headers.cc b/src/wifi/model/mgt-headers.cc index 42d5e6473..9797edb82 100644 --- a/src/wifi/model/mgt-headers.cc +++ b/src/wifi/model/mgt-headers.cc @@ -435,7 +435,7 @@ MgtAssocResponseHeader::GetSerializedSize (void) const size += 2; // aid size += m_rates.GetSerializedSize (); size += m_rates.extended.GetSerializedSize (); -size += m_htCapability.GetSerializedSize(); + size += m_htCapability.GetSerializedSize(); return size; } @@ -466,7 +466,7 @@ MgtAssocResponseHeader::Deserialize (Buffer::Iterator start) m_aid = i.ReadLsbtohU16 (); i = m_rates.Deserialize (i); i = m_rates.extended.DeserializeIfPresent (i); - i = m_htCapability.DeserializeIfPresent (i); + i = m_htCapability.DeserializeIfPresent (i); return i.GetDistanceFrom (start); } /********************************************************** @@ -483,7 +483,6 @@ WifiActionHeader::SetAction (WifiActionHeader::CategoryValue type, WifiActionHeader::ActionValue action) { m_category = type; - switch (type) { case BLOCK_ACK: @@ -491,22 +490,25 @@ WifiActionHeader::SetAction (WifiActionHeader::CategoryValue type, m_actionValue = action.blockAck; break; } - case MESH_PEERING_MGT: + case MESH: { - m_actionValue = action.peerLink; + m_actionValue = action.meshAction; break; } - case MESH_PATH_SELECTION: + case MULTIHOP: { - m_actionValue = action.pathSelection; + m_actionValue = action.multihopAction; break; } - case MESH_LINK_METRIC: - case MESH_INTERWORKING: - case MESH_RESOURCE_COORDINATION: - case MESH_PROXY_FORWARDING: + case SELF_PROTECTED: + { + m_actionValue = action.selfProtectedAction; + break; + } case VENDOR_SPECIFIC_ACTION: - break; + { + break; + } } } WifiActionHeader::CategoryValue @@ -516,30 +518,25 @@ WifiActionHeader::GetCategory () { case BLOCK_ACK: return BLOCK_ACK; - case MESH_PEERING_MGT: - return MESH_PEERING_MGT; - case MESH_LINK_METRIC: - return MESH_LINK_METRIC; - case MESH_PATH_SELECTION: - return MESH_PATH_SELECTION; - case MESH_INTERWORKING: - return MESH_INTERWORKING; - case MESH_RESOURCE_COORDINATION: - return MESH_RESOURCE_COORDINATION; - case MESH_PROXY_FORWARDING: - return MESH_PROXY_FORWARDING; + case MESH: + return MESH; + case MULTIHOP: + return MULTIHOP; + case SELF_PROTECTED: + return SELF_PROTECTED; case VENDOR_SPECIFIC_ACTION: return VENDOR_SPECIFIC_ACTION; default: NS_FATAL_ERROR ("Unknown action value"); - return MESH_PEERING_MGT; + return SELF_PROTECTED; } } WifiActionHeader::ActionValue WifiActionHeader::GetAction () { ActionValue retval; - retval.peerLink = PEER_LINK_OPEN; // Needs to be initialized to something to quiet valgrind in default cases + retval.selfProtectedAction = PEER_LINK_OPEN; // Needs to be initialized to something to quiet valgrind in default cases + switch (m_category) { case BLOCK_ACK: @@ -554,50 +551,92 @@ WifiActionHeader::GetAction () case BLOCK_ACK_DELBA: retval.blockAck = BLOCK_ACK_DELBA; break ; - } + } break ; - - case MESH_PEERING_MGT: + case SELF_PROTECTED: switch (m_actionValue) { case PEER_LINK_OPEN: - retval.peerLink = PEER_LINK_OPEN; - break ; + retval.selfProtectedAction = PEER_LINK_OPEN; + break; case PEER_LINK_CONFIRM: - retval.peerLink = PEER_LINK_CONFIRM; - break ; + retval.selfProtectedAction = PEER_LINK_CONFIRM; + break; case PEER_LINK_CLOSE: - retval.peerLink = PEER_LINK_CLOSE; - break ; + retval.selfProtectedAction = PEER_LINK_CLOSE; + break; + case GROUP_KEY_INFORM: + retval.selfProtectedAction = GROUP_KEY_INFORM; + break; + case GROUP_KEY_ACK: + retval.selfProtectedAction = GROUP_KEY_ACK; + break; default: NS_FATAL_ERROR ("Unknown mesh peering management action code"); - retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */ + retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */ } - break ; + break ; - case MESH_PATH_SELECTION: + case MESH: switch (m_actionValue) { + case LINK_METRIC_REPORT: + retval.meshAction = LINK_METRIC_REPORT; + break; case PATH_SELECTION: - retval.pathSelection = PATH_SELECTION; - break ; + retval.meshAction = PATH_SELECTION; + break; + case PORTAL_ANNOUNCEMENT: + retval.meshAction = PORTAL_ANNOUNCEMENT; + break; + case CONGESTION_CONTROL_NOTIFICATION: + retval.meshAction = CONGESTION_CONTROL_NOTIFICATION; + break; + case MDA_SETUP_REQUEST: + retval.meshAction = MDA_SETUP_REQUEST; + break; + case MDA_SETUP_REPLY: + retval.meshAction = MDA_SETUP_REPLY; + break; + case MDAOP_ADVERTISMENT_REQUEST: + retval.meshAction = MDAOP_ADVERTISMENT_REQUEST; + break; + case MDAOP_ADVERTISMENTS: + retval.meshAction = MDAOP_ADVERTISMENTS; + break; + case MDAOP_SET_TEARDOWN: + retval.meshAction = MDAOP_SET_TEARDOWN; + break; + case TBTT_ADJUSTMENT_REQUEST: + retval.meshAction = TBTT_ADJUSTMENT_REQUEST; + break; + case TBTT_ADJUSTMENT_RESPONSE: + retval.meshAction = TBTT_ADJUSTMENT_RESPONSE; + break; default: - NS_FATAL_ERROR ("Unknown mesh path selection action code"); - retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */ + NS_FATAL_ERROR ("Unknown mesh peering management action code"); + retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */ } - break ; - case VENDOR_SPECIFIC_ACTION: - break ; - case MESH_LINK_METRIC: - // not yet supported - case MESH_INTERWORKING: - // not yet supported - case MESH_RESOURCE_COORDINATION: - // not yet supported - default: + break; + + case MULTIHOP: //not yet supported + switch (m_actionValue) + { + case PROXY_UPDATE: //(not used so far) + retval.multihopAction = PROXY_UPDATE; + break; + case PROXY_UPDATE_CONFIRMATION: //(not used so far) + retval.multihopAction = PROXY_UPDATE; + break; + default: + NS_FATAL_ERROR ("Unknown mesh peering management action code"); + retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */ + } + break; + default: NS_FATAL_ERROR ("Unsupported mesh action"); - retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */ - } + retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */ + } return retval; } TypeId diff --git a/src/wifi/model/mgt-headers.h b/src/wifi/model/mgt-headers.h index 4b7fd6648..43fd81f57 100644 --- a/src/wifi/model/mgt-headers.h +++ b/src/wifi/model/mgt-headers.h @@ -339,61 +339,51 @@ public: WifiActionHeader (); ~WifiActionHeader (); - /** - * Compatible with open80211s implementation - * Category values - see 802.11-2012 Table 8-38 - */ - enum CategoryValue + /* + * Compatible with table 8-38 IEEE 802.11, Part11, (Year 2012) + * Category values - see 802.11-2012 Table 8-38 */ + + enum CategoryValue //table 8-38 staring from IEEE 802.11, Part11, (Year 2012) { BLOCK_ACK = 3, - MESH_PEERING_MGT = 30, - MESH_LINK_METRIC = 31, - MESH_PATH_SELECTION = 32, - MESH_INTERWORKING = 33, - MESH_RESOURCE_COORDINATION = 34, - MESH_PROXY_FORWARDING = 35, + MESH = 13, //Category: Mesh + MULTIHOP = 14, //(not used so far) + SELF_PROTECTED = 15, //Category: Self Protected // since vendor specific action has no stationary Action value,the parse process is not here. // refer to vendor-specific-action in wave module. VENDOR_SPECIFIC_ACTION = 127, }; - /** - * Compatible with open80211s implementation - */ - enum PeerLinkMgtActionValue + + enum SelfProtectedActionValue //Category: 15 (Self Protected) { - PEER_LINK_OPEN = 0, - PEER_LINK_CONFIRM = 1, - PEER_LINK_CLOSE = 2, + PEER_LINK_OPEN = 1, //Mesh Peering Open + PEER_LINK_CONFIRM = 2, //Mesh Peering Confirm + PEER_LINK_CLOSE = 3, //Mesh Peering Close + GROUP_KEY_INFORM = 4, //Mesh Group Key Inform + GROUP_KEY_ACK = 5, //Mesh Group Key Acknowledge }; - enum LinkMetricActionValue + + enum MultihopActionValue { - LINK_METRIC_REQUEST = 0, - LINK_METRIC_REPORT, + PROXY_UPDATE = 0, //(not used so far) + PROXY_UPDATE_CONFIRMATION = 1, //(not used so far) }; - /** - * Compatible with open80211s implementation - */ - enum PathSelectionActionValue + + enum MeshActionValue { - PATH_SELECTION = 0, - }; - enum InterworkActionValue - { - PORTAL_ANNOUNCEMENT = 0, - }; - enum ResourceCoordinationActionValue - { - CONGESTION_CONTROL_NOTIFICATION = 0, - MDA_SETUP_REQUEST, - MDA_SETUP_REPLY, - MDAOP_ADVERTISMENT_REQUEST, - MDAOP_ADVERTISMENTS, - MDAOP_SET_TEARDOWN, - BEACON_TIMING_REQUEST, - BEACON_TIMING_RESPONSE, - TBTT_ADJUSTMENT_REQUEST, - MESH_CHANNEL_SWITCH_ANNOUNCEMENT, + LINK_METRIC_REPORT=0, //Action Value:0 in Category 13: Mesh + PATH_SELECTION = 1, //Action Value:1 in Category 13: Mesh + PORTAL_ANNOUNCEMENT = 2, //Action Value:2 in Category 13: Mesh + CONGESTION_CONTROL_NOTIFICATION = 3,//Action Value:3 in Category 13: Mesh + MDA_SETUP_REQUEST=4, //Action Value:4 in Category 13: Mesh MCCA-Setup-Request (not used so far) + MDA_SETUP_REPLY=5, //Action Value:5 in Category 13: Mesh MCCA-Setup-Reply (not used so far) + MDAOP_ADVERTISMENT_REQUEST=6, //Action Value:6 in Category 13: Mesh MCCA-Advertisement-Request (not used so far) + MDAOP_ADVERTISMENTS=7, //Action Value:7 in Category 13: Mesh (not used so far) + MDAOP_SET_TEARDOWN=8, //Action Value:8 in Category 13: Mesh (not used so far) + TBTT_ADJUSTMENT_REQUEST=9, //Action Value:9 in Category 13: Mesh (not used so far) + TBTT_ADJUSTMENT_RESPONSE=10, //Action Value:10 in Category 13: Mesh (not used so far) }; + /** * Block ACK action field values * See 802.11 Table 8-202 @@ -404,16 +394,16 @@ public: BLOCK_ACK_ADDBA_RESPONSE = 1, BLOCK_ACK_DELBA = 2 }; + + /** * typedef for union of different ActionValues */ typedef union { - enum PeerLinkMgtActionValue peerLink; - enum LinkMetricActionValue linkMetrtic; - enum PathSelectionActionValue pathSelection; - enum InterworkActionValue interwork; - enum ResourceCoordinationActionValue resourceCoordination; + enum MeshActionValue meshAction; + enum MultihopActionValue multihopAction; + enum SelfProtectedActionValue selfProtectedAction; enum BlockAckActionValue blockAck; } ActionValue; /**