diff --git a/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.cc b/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.cc index e83018c81..c4702da45 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.cc +++ b/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.cc @@ -145,7 +145,7 @@ IeDot11sBeaconTiming::ClearTimingElement() } -uint16_t +uint8_t IeDot11sBeaconTiming::GetInformationSize () const { return (5*m_numOfUnits); @@ -167,7 +167,7 @@ IeDot11sBeaconTiming::SerializeInformation (Buffer::Iterator i) const i.WriteHtonU16 ((*j)->GetBeaconInterval()); } } -uint16_t +uint8_t IeDot11sBeaconTiming::DeserializeInformation (Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; diff --git a/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.h b/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.h index f6c00a53f..703847c59 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.h +++ b/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.h @@ -90,9 +90,9 @@ protected: return IE11S_BEACON_TIMING; } //Serialize-deserialize methods: - uint16_t GetInformationSize () const; + uint8_t GetInformationSize () const; void SerializeInformation (Buffer::Iterator i) const; - uint16_t DeserializeInformation (Buffer::Iterator i, uint8_t length); + uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length); void PrintInformation(std::ostream& os) const; private: static uint16_t TimestampToU16(Time x); diff --git a/src/devices/mesh/802.11s/ie-dot11s-configuration.cc b/src/devices/mesh/802.11s/ie-dot11s-configuration.cc index 756f7bd53..948424253 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-configuration.cc +++ b/src/devices/mesh/802.11s/ie-dot11s-configuration.cc @@ -21,9 +21,6 @@ #include "ns3/ie-dot11s-configuration.h" -#include "ns3/assert.h" - -//NS_LOG_COMPONENT_DEFINE ("IeDot11sConfiguration"); namespace ns3 { @@ -98,7 +95,7 @@ IeDot11sConfiguration::GetInstanceTypeId () const { return GetTypeId(); } -uint16_t +uint8_t IeDot11sConfiguration::GetInformationSize () const { return 1 // Version @@ -124,7 +121,7 @@ IeDot11sConfiguration::SerializeInformation (Buffer::Iterator i) const m_meshCap.Serialize (i); } -uint16_t +uint8_t IeDot11sConfiguration::DeserializeInformation (Buffer::Iterator i, uint8_t length) { Buffer::Iterator start = i; diff --git a/src/devices/mesh/802.11s/ie-dot11s-configuration.h b/src/devices/mesh/802.11s/ie-dot11s-configuration.h index a59b04cc6..c721dce62 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-configuration.h +++ b/src/devices/mesh/802.11s/ie-dot11s-configuration.h @@ -23,9 +23,6 @@ #ifndef MESH_CONFIGURATION_H #define MESH_CONFIGURATION_H -#include -#include "ns3/buffer.h" -#include "ns3/dot11s-codes.h" #include "ns3/wifi-information-element.h" namespace ns3 { @@ -102,10 +99,9 @@ protected: { return IE11S_MESH_CONFIGURATION; } - - uint16_t GetInformationSize () const; + uint8_t GetInformationSize () const; void SerializeInformation (Buffer::Iterator i) const; - uint16_t DeserializeInformation (Buffer::Iterator i, uint8_t length); + uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length); void PrintInformation(std::ostream& os) const; // TODO: Release and fill other fields in configuration // element diff --git a/src/devices/mesh/dot11s-peer-management-element.cc b/src/devices/mesh/802.11s/ie-dot11s-peer-management.cc similarity index 63% rename from src/devices/mesh/dot11s-peer-management-element.cc rename to src/devices/mesh/802.11s/ie-dot11s-peer-management.cc index d767b4549..2780dd098 100644 --- a/src/devices/mesh/dot11s-peer-management-element.cc +++ b/src/devices/mesh/802.11s/ie-dot11s-peer-management.cc @@ -20,7 +20,7 @@ */ -#include "ns3/dot11s-peer-management-element.h" +#include "ns3/ie-dot11s-peer-management.h" #include "ns3/assert.h" @@ -28,7 +28,7 @@ namespace ns3 { -PeerLinkManagementElement::PeerLinkManagementElement (): +IeDot11sPeerManagement::IeDot11sPeerManagement (): m_length(0), m_subtype(PEER_OPEN), m_localLinkId(0), @@ -38,14 +38,14 @@ PeerLinkManagementElement::PeerLinkManagementElement (): void -PeerLinkManagementElement::SetPeerOpen(uint16_t localLinkId) +IeDot11sPeerManagement::SetPeerOpen(uint16_t localLinkId) { m_length = 3; m_subtype = PEER_OPEN; m_localLinkId = localLinkId; } void -PeerLinkManagementElement::SetPeerClose(uint16_t localLinkId, uint16_t peerLinkId, dot11sReasonCode reasonCode) +IeDot11sPeerManagement::SetPeerClose(uint16_t localLinkId, uint16_t peerLinkId, dot11sReasonCode reasonCode) { m_length = 7; m_subtype = PEER_CLOSE; @@ -55,7 +55,7 @@ PeerLinkManagementElement::SetPeerClose(uint16_t localLinkId, uint16_t peerLinkI } void -PeerLinkManagementElement::SetPeerConfirm(uint16_t localLinkId, uint16_t peerLinkId) +IeDot11sPeerManagement::SetPeerConfirm(uint16_t localLinkId, uint16_t peerLinkId) { m_length = 5; m_subtype = PEER_CONFIRM; @@ -64,69 +64,77 @@ PeerLinkManagementElement::SetPeerConfirm(uint16_t localLinkId, uint16_t peerLin } dot11sReasonCode -PeerLinkManagementElement::GetReasonCode() const +IeDot11sPeerManagement::GetReasonCode() const { return m_reasonCode; } uint16_t -PeerLinkManagementElement::GetLocalLinkId() const +IeDot11sPeerManagement::GetLocalLinkId() const { return m_localLinkId; } uint16_t -PeerLinkManagementElement::GetPeerLinkId() const +IeDot11sPeerManagement::GetPeerLinkId() const { return m_peerLinkId; } -uint32_t -PeerLinkManagementElement::GetSerializedSize (void) const +uint8_t +IeDot11sPeerManagement::GetInformationSize (void) const { - return m_length+2; + return m_length; } bool -PeerLinkManagementElement::SubtypeIsOpen() const +IeDot11sPeerManagement::SubtypeIsOpen() const { return (m_subtype == PEER_OPEN); } bool -PeerLinkManagementElement::SubtypeIsClose() const +IeDot11sPeerManagement::SubtypeIsClose() const { return (m_subtype == PEER_CLOSE); } bool -PeerLinkManagementElement::SubtypeIsConfirm() const +IeDot11sPeerManagement::SubtypeIsConfirm() const { return (m_subtype == PEER_CONFIRM); } -Buffer::Iterator -PeerLinkManagementElement::Serialize (Buffer::Iterator i) const +void +IeDot11sPeerManagement::SerializeInformation (Buffer::Iterator i) const { - i.WriteU8(ElementId()); - i.WriteU8(m_length); i.WriteU8(m_subtype); i.WriteHtonU16(m_localLinkId); if (m_length > 3) i.WriteHtonU16(m_peerLinkId); if (m_length > 5) i.WriteHtonU16(m_reasonCode); - return i; } -Buffer::Iterator -PeerLinkManagementElement::Deserialize (Buffer::Iterator i) +uint8_t +IeDot11sPeerManagement::DeserializeInformation (Buffer::Iterator start, uint8_t length) { - NS_ASSERT(ElementId() == i.ReadU8()); - m_length = i.ReadU8(); + Buffer::Iterator i = start; m_subtype = i.ReadU8(); + m_length = length; + if (m_subtype == PEER_OPEN) + NS_ASSERT(length == 3); + if (m_subtype == PEER_CONFIRM) + NS_ASSERT(length == 5); + if (m_subtype == PEER_CLOSE) + NS_ASSERT(length == 7); m_localLinkId = i.ReadNtohU16(); if (m_length > 3) m_peerLinkId = i.ReadNtohU16(); if (m_length > 5) m_reasonCode = (dot11sReasonCode)i.ReadNtohU16(); - return i; + return i.GetDistanceFrom(start); +} +void +IeDot11sPeerManagement::PrintInformation(std::ostream& os) const +{ + //TODO } } //namespace NS3 diff --git a/src/devices/mesh/dot11s-peer-management-element.h b/src/devices/mesh/802.11s/ie-dot11s-peer-management.h similarity index 80% rename from src/devices/mesh/dot11s-peer-management-element.h rename to src/devices/mesh/802.11s/ie-dot11s-peer-management.h index 878540ae1..4aafb9195 100644 --- a/src/devices/mesh/dot11s-peer-management-element.h +++ b/src/devices/mesh/802.11s/ie-dot11s-peer-management.h @@ -23,15 +23,14 @@ #ifndef MESH_PEER_MAN_ELEMENT #define MESH_PEER_MAN_ELEMENT -#include -#include "ns3/buffer.h" #include "ns3/dot11s-codes.h" +#include "ns3/wifi-information-element.h" namespace ns3 { /** * \ingroup mesh */ -class PeerLinkManagementElement +class IeDot11sPeerManagement : public WifiInformationElement { public: enum Subtype { @@ -40,7 +39,7 @@ public: PEER_CONFIRM = 2, }; public: - PeerLinkManagementElement (); + IeDot11sPeerManagement (); void SetPeerOpen(uint16_t localLinkId); void SetPeerClose(uint16_t localLinkID, uint16_t peerLinkId, dot11sReasonCode reasonCode); @@ -52,14 +51,15 @@ public: bool SubtypeIsOpen() const; bool SubtypeIsClose() const; bool SubtypeIsConfirm() const ; - - uint32_t GetSerializedSize (void) const; - Buffer::Iterator Serialize (Buffer::Iterator i) const; - Buffer::Iterator Deserialize (Buffer::Iterator i); -private: - static uint8_t ElementId() { - return (uint8_t)IE11S_PEER_LINK_MANAGEMENT; +protected: + WifiElementId ElementId() const{ + return IE11S_PEER_LINK_MANAGEMENT; } + uint8_t GetInformationSize (void) const; + void SerializeInformation (Buffer::Iterator i) const; + uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length); + void PrintInformation(std::ostream& os) const; +private: uint8_t m_length; uint8_t m_subtype; uint16_t m_localLinkId; //always is present diff --git a/src/devices/mesh/802.11s/ie-dot11s-perr.cc b/src/devices/mesh/802.11s/ie-dot11s-perr.cc index f6c43517a..e18c9a3f0 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-perr.cc +++ b/src/devices/mesh/802.11s/ie-dot11s-perr.cc @@ -21,6 +21,7 @@ #include "ns3/ie-dot11s-perr.h" #include "ns3/address-utils.h" +#include "ns3/node.h" namespace ns3 { IeDot11sPerr::~IeDot11sPerr() @@ -65,7 +66,7 @@ IeDot11sPerr::SerializeInformation(Buffer::Iterator i)const i.WriteHtonU32 (m_addressUnits[j].seqnum); } } -uint16_t +uint8_t IeDot11sPerr::DeserializeInformation(Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; @@ -83,10 +84,10 @@ IeDot11sPerr::DeserializeInformation(Buffer::Iterator start, uint8_t length) return i.GetDistanceFrom(start); } -uint16_t +uint8_t IeDot11sPerr::GetInformationSize() const { - uint16_t retval = + uint8_t retval = 1 //ModeFlags +1 //NumOfDests +6*m_numOfDest diff --git a/src/devices/mesh/802.11s/ie-dot11s-perr.h b/src/devices/mesh/802.11s/ie-dot11s-perr.h index 85fa7ac2f..99e36414a 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-perr.h +++ b/src/devices/mesh/802.11s/ie-dot11s-perr.h @@ -22,12 +22,8 @@ #ifndef PERR_INFORMATION_ELEMENT_H #define PERR_INFORMATION_ELEMENT_H -#include -#include "ns3/node.h" -#include "ns3/buffer.h" #include "ns3/mac48-address.h" #include "ns3/hwmp-rtable.h" -#include "ns3/header.h" #include "ns3/dot11s-codes.h" #include "ns3/wifi-information-element.h" @@ -59,9 +55,9 @@ protected: return IE11S_PERR; }; void SerializeInformation(Buffer::Iterator i) const; - uint16_t DeserializeInformation(Buffer::Iterator start, uint8_t length); + uint8_t DeserializeInformation(Buffer::Iterator start, uint8_t length); void PrintInformation(std::ostream& os) const; - uint16_t GetInformationSize() const; + uint8_t GetInformationSize() const; private: uint8_t m_numOfDest; std::vector diff --git a/src/devices/mesh/802.11s/ie-dot11s-prep.cc b/src/devices/mesh/802.11s/ie-dot11s-prep.cc index dfff0a6a9..bbc18cb34 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-prep.cc +++ b/src/devices/mesh/802.11s/ie-dot11s-prep.cc @@ -21,6 +21,7 @@ #include "ns3/ie-dot11s-prep.h" #include "ns3/address-utils.h" +#include "ns3/node.h" #include "ns3/assert.h" namespace ns3 { /******************************** @@ -175,7 +176,7 @@ IeDot11sPrep::SerializeInformation(Buffer::Iterator i) const WriteTo (i, m_originatorAddress); i.WriteHtonU32 (m_originatorSeqNumber); } -uint16_t +uint8_t IeDot11sPrep::DeserializeInformation(Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; @@ -190,7 +191,7 @@ IeDot11sPrep::DeserializeInformation(Buffer::Iterator start, uint8_t length) m_originatorSeqNumber = i.ReadNtohU32(); return i.GetDistanceFrom(start); } -uint16_t +uint8_t IeDot11sPrep::GetInformationSize() const { uint32_t retval = diff --git a/src/devices/mesh/802.11s/ie-dot11s-prep.h b/src/devices/mesh/802.11s/ie-dot11s-prep.h index 2cfb29a7a..be6037040 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-prep.h +++ b/src/devices/mesh/802.11s/ie-dot11s-prep.h @@ -23,11 +23,7 @@ #define WIFI_PREP_INFORMATION_ELEMENT_H -#include -#include "ns3/node.h" -#include "ns3/buffer.h" #include "ns3/mac48-address.h" -#include "ns3/header.h" #include "ns3/dot11s-codes.h" #include "ns3/wifi-information-element.h" @@ -70,8 +66,8 @@ protected: return IE11S_PREP; } void SerializeInformation(Buffer::Iterator i) const; - uint16_t DeserializeInformation(Buffer::Iterator start, uint8_t length); - uint16_t GetInformationSize() const; + uint8_t DeserializeInformation(Buffer::Iterator start, uint8_t length); + uint8_t GetInformationSize() const; void PrintInformation(std::ostream& os) const; private: uint8_t m_flags; diff --git a/src/devices/mesh/802.11s/ie-dot11s-preq.cc b/src/devices/mesh/802.11s/ie-dot11s-preq.cc index ebffb87d0..da3c4288b 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-preq.cc +++ b/src/devices/mesh/802.11s/ie-dot11s-preq.cc @@ -21,6 +21,7 @@ #include "ns3/ie-dot11s-preq.h" #include "ns3/address-utils.h" +#include "ns3/node.h" #include "ns3/assert.h" namespace ns3 { @@ -275,7 +276,7 @@ IeDot11sPreq::SerializeInformation(Buffer::Iterator i) const } } -uint16_t +uint8_t IeDot11sPreq::DeserializeInformation(Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; @@ -311,10 +312,10 @@ IeDot11sPreq::DeserializeInformation(Buffer::Iterator start, uint8_t length) } return i.GetDistanceFrom(start); } -uint16_t +uint8_t IeDot11sPreq::GetInformationSize() const { - uint32_t retval = + uint8_t retval = 1 //Flags +1 //Hopcount +1 //TTL diff --git a/src/devices/mesh/802.11s/ie-dot11s-preq.h b/src/devices/mesh/802.11s/ie-dot11s-preq.h index 8518893f1..e60921635 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-preq.h +++ b/src/devices/mesh/802.11s/ie-dot11s-preq.h @@ -22,13 +22,9 @@ #ifndef WIFI_PREQ_INFORMATION_ELEMENT_H #define WIFI_PREQ_INFORMATION_ELEMENT_H -#include #include -#include "ns3/node.h" -#include "ns3/buffer.h" #include "ns3/mac48-address.h" -#include "ns3/header.h" #include "ns3/dot11s-codes.h" #include "ns3/wifi-information-element.h" @@ -108,8 +104,8 @@ protected: return IE11S_PREQ; } void SerializeInformation(Buffer::Iterator i) const; - uint16_t DeserializeInformation(Buffer::Iterator i, uint8_t length); - uint16_t GetInformationSize() const; + uint8_t DeserializeInformation(Buffer::Iterator i, uint8_t length); + uint8_t GetInformationSize() const; void PrintInformation(std::ostream& os) const; private: //how many destinations we support diff --git a/src/devices/mesh/802.11s/ie-dot11s-rann.cc b/src/devices/mesh/802.11s/ie-dot11s-rann.cc index 2d388b5c5..15d1eaa6f 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-rann.cc +++ b/src/devices/mesh/802.11s/ie-dot11s-rann.cc @@ -22,6 +22,7 @@ #include "ns3/ie-dot11s-rann.h" #include "ns3/assert.h" #include "ns3/address-utils.h" +#include "ns3/node.h" namespace ns3 { @@ -124,7 +125,7 @@ IeDot11sRann::SerializeInformation(Buffer::Iterator i) const i.WriteHtonU32 (m_destSeqNumber); i.WriteHtonU32 (m_metric); } -uint16_t +uint8_t IeDot11sRann::DeserializeInformation(Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; @@ -136,10 +137,10 @@ IeDot11sRann::DeserializeInformation(Buffer::Iterator start, uint8_t length) m_metric = i.ReadNtohU32(); return i.GetDistanceFrom(start); } -uint16_t +uint8_t IeDot11sRann::GetInformationSize() const { - uint16_t retval = + uint8_t retval = 1//Flags +1//Hopcount +1//TTL diff --git a/src/devices/mesh/802.11s/ie-dot11s-rann.h b/src/devices/mesh/802.11s/ie-dot11s-rann.h index ac6a45fbc..d570e84e7 100644 --- a/src/devices/mesh/802.11s/ie-dot11s-rann.h +++ b/src/devices/mesh/802.11s/ie-dot11s-rann.h @@ -22,12 +22,7 @@ #ifndef RANN_INFORMATION_ELEMENT_H #define RANN_INFORMATION_ELEMENT_H -#include - -#include "ns3/buffer.h" #include "ns3/mac48-address.h" -#include "ns3/node.h" -#include "ns3/header.h" #include "ns3/dot11s-codes.h" #include "ns3/wifi-information-element.h" @@ -62,8 +57,8 @@ protected: return IE11S_RANN; } void SerializeInformation(Buffer::Iterator i) const; - uint16_t DeserializeInformation(Buffer::Iterator start, uint8_t length); - uint16_t GetInformationSize() const; + uint8_t DeserializeInformation(Buffer::Iterator start, uint8_t length); + uint8_t GetInformationSize() const; private: uint8_t m_flags; uint8_t m_hopcount; diff --git a/src/devices/mesh/802.11s/wscript b/src/devices/mesh/802.11s/wscript index 8bf1cc636..da86d1b79 100644 --- a/src/devices/mesh/802.11s/wscript +++ b/src/devices/mesh/802.11s/wscript @@ -5,6 +5,7 @@ def build(bld): obj.source = [ 'ie-dot11s-beacon-timing.cc', 'ie-dot11s-configuration.cc', + 'ie-dot11s-peer-management.cc', 'ie-dot11s-preq.cc', 'ie-dot11s-prep.cc', 'ie-dot11s-perr.cc', @@ -15,6 +16,7 @@ def build(bld): headers.source = [ 'ie-dot11s-beacon-timing.h', 'ie-dot11s-configuration.h', + 'ie-dot11s-peer-management.h', 'ie-dot11s-preq.h', 'ie-dot11s-prep.h', 'ie-dot11s-perr.h', diff --git a/src/devices/mesh/hwmp-rtable.cc b/src/devices/mesh/hwmp-rtable.cc index a54c1d496..ff44e9a72 100644 --- a/src/devices/mesh/hwmp-rtable.cc +++ b/src/devices/mesh/hwmp-rtable.cc @@ -70,7 +70,7 @@ HwmpRtable::AddReactivePath( uint32_t seqnum ) { - std::map::iterator i = m_routes.find(destination); + std::map::iterator i = m_routes.find(destination); if (i == m_routes.end()) { ReactiveRoute newroute; @@ -135,7 +135,7 @@ void HwmpRtable::AddPrecursor(Mac48Address destination, uint32_t port, Mac48Address precursor) { bool should_add = true; - std::map::iterator i = m_routes.find(destination); + std::map::iterator i = m_routes.find(destination); if ((i != m_routes.end()) && (i->second.port == port)) { for (unsigned int j = 0 ; j < i->second.precursors.size(); j ++) @@ -178,7 +178,7 @@ HwmpRtable::DeleteProactivePath(Mac48Address root, uint32_t port) void HwmpRtable::DeleteReactivePath(Mac48Address destination, uint32_t port) { - std::map::iterator i = m_routes.find(destination); + std::map::iterator i = m_routes.find(destination); if (i != m_routes.end()) if (i->second.port == port) m_routes.erase(i); @@ -192,7 +192,7 @@ HwmpRtable::LookupReactive(Mac48Address destination) result.metric = MAX_METRIC; result.ifIndex = PORT_ANY; - std::map::iterator i = m_routes.find(destination); + std::map::iterator i = m_routes.find(destination); if (i == m_routes.end()) return result; result.ifIndex = i->second.port; @@ -213,7 +213,7 @@ HwmpRtable::LookupProactive(uint32_t port) result.retransmitter = Mac48Address::GetBroadcast(); result.metric = MAX_METRIC; result.ifIndex = PORT_ANY; - std::map::iterator i = m_roots.find(port); + std::map::iterator i = m_roots.find(port); if (i == m_roots.end()) return result; result.ifIndex = i->first; @@ -229,7 +229,7 @@ std::vector HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port) { std::vector retval; - for (std::map::iterator i = m_routes.begin(); i!= m_routes.end(); i++) + for (std::map::iterator i = m_routes.begin(); i!= m_routes.end(); i++) if ((i->second.retransmitter == peerAddress)&&(i->second.port == port)) { FailedDestination dst; @@ -241,7 +241,7 @@ HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port) /** * Lookup a path to root */ - std::map::iterator i = m_roots.find(port); + std::map::iterator i = m_roots.find(port); if ((i != m_roots.end())&&(i->second.retransmitter == peerAddress)) { FailedDestination dst; @@ -254,7 +254,7 @@ HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port) uint32_t HwmpRtable::RequestSeqnum(Mac48Address destination) { - std::map::iterator i = m_routes.find(destination); + std::map::iterator i = m_routes.find(destination); if (i == m_routes.end()) return 0; return i->second.seqnum; @@ -264,13 +264,13 @@ std::vector HwmpRtable::GetPrecursors(Mac48Address destination, uint32_t port) { std::vector retval; - std::map::iterator root = m_roots.find(port); + std::map::iterator root = m_roots.find(port); if ((root != m_roots.end()) &&(root->second.root == destination)) { for (unsigned int i = 0; i < root->second.precursors.size(); i ++) retval.push_back(root->second.precursors[i]); } - std::map::iterator route = m_routes.find(destination); + std::map::iterator route = m_routes.find(destination); if ( (route != m_routes.end()) && (route->second.port == port) ) { for (unsigned int i = 0; i < route->second.precursors.size(); i ++) diff --git a/src/devices/mesh/hwmp-rtable.h b/src/devices/mesh/hwmp-rtable.h index e23eb9d9d..65ad9cf9a 100644 --- a/src/devices/mesh/hwmp-rtable.h +++ b/src/devices/mesh/hwmp-rtable.h @@ -26,7 +26,6 @@ #include #include "ns3/nstime.h" #include "ns3/mac48-address.h" -#include "ns3/mac48-address-comparator.h" #include "ns3/net-device.h" #include "ns3/event-id.h" #include "ns3/packet.h" @@ -101,7 +100,7 @@ private: uint32_t seqnum; std::vector precursors; }; - std::map m_routes; + std::map m_routes; std::map m_roots; }; } //namespace ns3 diff --git a/src/devices/mesh/hwmp-state.cc b/src/devices/mesh/hwmp-state.cc index acb75202f..e6f80eb4b 100644 --- a/src/devices/mesh/hwmp-state.cc +++ b/src/devices/mesh/hwmp-state.cc @@ -184,7 +184,7 @@ HwmpState::ReceivePreq(IeDot11sPreq& preq, const Mac48Address& from, const uint if (preq.GetTtl() == 0) return; //acceptance cretirea: - std::map::iterator i = m_dsnDatabase.find(preq.GetOriginatorAddress()); + std::map::iterator i = m_dsnDatabase.find(preq.GetOriginatorAddress()); if (i == m_dsnDatabase.end()) { m_dsnDatabase[preq.GetOriginatorAddress()] = preq.GetOriginatorSeqNumber(); @@ -197,7 +197,7 @@ HwmpState::ReceivePreq(IeDot11sPreq& preq, const Mac48Address& from, const uint if (i->second == preq.GetOriginatorSeqNumber()) { //find metric - std::map::iterator j = + std::map::iterator j = m_preqMetricDatabase.find(preq.GetOriginatorAddress()); NS_ASSERT(j != m_dsnDatabase.end()); if (j->second <= preq.GetMetric()) @@ -319,7 +319,7 @@ HwmpState::ReceivePrep(IeDot11sPrep& prep, const Mac48Address& from, const uint3 prep.DecrementTtl(); prep.IncrementMetric(metric); //acceptance cretirea: - std::map::iterator i = m_dsnDatabase.find(prep.GetDestinationAddress()); + std::map::iterator i = m_dsnDatabase.find(prep.GetDestinationAddress()); if (i == m_dsnDatabase.end()) { m_dsnDatabase[prep.GetDestinationAddress()] = prep.GetDestinationSeqNumber(); diff --git a/src/devices/mesh/hwmp-state.h b/src/devices/mesh/hwmp-state.h index aa9f1fdba..1a2e99631 100644 --- a/src/devices/mesh/hwmp-state.h +++ b/src/devices/mesh/hwmp-state.h @@ -22,16 +22,14 @@ #ifndef HWMP_STATE_H #define HWMP_STATE_H #include -#include "ns3/event-id.h" -#include "ns3/ptr.h" #include "ns3/hwmp-rtable.h" #include "ns3/packet.h" -#include "ns3/wifi-net-device.h" #include "ns3/mesh-wifi-mac.h" #include "ns3/ie-dot11s-preq.h" #include "ns3/ie-dot11s-prep.h" #include "ns3/ie-dot11s-perr.h" #include "ns3/dot11s-parameters.h" +#include "ns3/wifi-net-device.h" namespace ns3 { /** * \ingroup mesh @@ -161,8 +159,8 @@ private: uint32_t m_preqId; uint32_t m_myDsn; //Seqno and metric database - std::map m_dsnDatabase; - std::map m_preqMetricDatabase; + std::map m_dsnDatabase; + std::map m_preqMetricDatabase; //Disable/enable functionality bool m_disabled; //Proactive PREQ mechanism: diff --git a/src/devices/mesh/hwmp.cc b/src/devices/mesh/hwmp.cc index 93dfa52c9..0f26e7a0d 100644 --- a/src/devices/mesh/hwmp.cc +++ b/src/devices/mesh/hwmp.cc @@ -172,7 +172,7 @@ Hwmp::~Hwmp() void Hwmp::DoDispose() { - for (std::map::iterator i = m_timeoutDatabase.begin(); i != m_timeoutDatabase.end(); i ++) + for (std::map::iterator i = m_timeoutDatabase.begin(); i != m_timeoutDatabase.end(); i ++) i->second.Cancel(); m_timeoutDatabase.clear(); m_seqnoDatabase.clear(); @@ -234,7 +234,7 @@ Hwmp::RequestRoute( //check seqno! if (destination == Mac48Address::GetBroadcast()) { - std::map::iterator i = m_seqnoDatabase.find(source); + std::map::iterator i = m_seqnoDatabase.find(source); if (i == m_seqnoDatabase.end()) m_seqnoDatabase[source] = tag.GetSeqno(); else @@ -608,7 +608,7 @@ Hwmp::DequeuePacket(Mac48Address dst) MeshL2RoutingProtocol::QueuedPacket retval; retval.pkt = NULL; //Ptr in this structure is NULL when queue is empty - std::map, mac48addrComparator>:: iterator i = m_rqueue.find(dst); + std::map >:: iterator i = m_rqueue.find(dst); if (i == m_rqueue.end()) return retval; if ((int)m_rqueue[dst].size() == 0) @@ -648,7 +648,7 @@ Hwmp::SendAllPossiblePackets(Mac48Address dst) bool Hwmp::ShouldSendPreq(Mac48Address dst) { - std::map::iterator i = m_timeoutDatabase.find(dst); + std::map::iterator i = m_timeoutDatabase.find(dst); if (i == m_timeoutDatabase.end()) { m_timeoutDatabase[dst] = Simulator::Schedule( @@ -664,7 +664,7 @@ Hwmp::RetryPathDiscovery(Mac48Address dst, uint8_t numOfRetry) HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst); if (result.retransmitter != Mac48Address::GetBroadcast()) { - std::map::iterator i = m_timeoutDatabase.find(dst); + std::map::iterator i = m_timeoutDatabase.find(dst); NS_ASSERT(i != m_timeoutDatabase.end()); m_timeoutDatabase.erase(i); return; @@ -681,7 +681,7 @@ Hwmp::RetryPathDiscovery(Mac48Address dst, uint8_t numOfRetry) break; packet.reply(false, packet.pkt, packet.src, packet.dst, packet.protocol, HwmpRtable::MAX_METRIC); } - std::map::iterator i = m_timeoutDatabase.find(dst); + std::map::iterator i = m_timeoutDatabase.find(dst); NS_ASSERT(i != m_timeoutDatabase.end()); m_timeoutDatabase.erase(i); return; diff --git a/src/devices/mesh/hwmp.h b/src/devices/mesh/hwmp.h index 8f34e5ade..09f842c6b 100644 --- a/src/devices/mesh/hwmp.h +++ b/src/devices/mesh/hwmp.h @@ -23,15 +23,14 @@ #ifndef HWMP_H #define HWMP_H + #include #include #include "ns3/tag.h" #include "ns3/object.h" #include "ns3/mac48-address.h" -#include "ns3/mac48-address-comparator.h" #include "ns3/mesh-l2-routing-protocol.h" #include "ns3/packet.h" -#include "ns3/ptr.h" #include "ns3/hwmp-state.h" namespace ns3 { class HwmpState; @@ -249,7 +248,7 @@ private: * \attention mesh seqno is processed at HWMP */ uint32_t m_seqno; - std::map + std::map m_seqnoDatabase; //Timers: /** @@ -269,7 +268,7 @@ private: * Keeps PREQ retry timers for every * destination */ - std::map + std::map m_timeoutDatabase; /** * Configurable parameters: diff --git a/src/devices/mesh/mac48-address-comparator.h b/src/devices/mesh/mac48-address-comparator.h deleted file mode 100644 index 5a40449ee..000000000 --- a/src/devices/mesh/mac48-address-comparator.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2008,2009 IITP RAS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Kirill Andreev - */ - - -#ifndef MAC48ADDRESS_COMPARATOR -#define MAC48ADDRESS_COMPARATOR -#include "ns3/mac48-address.h" -namespace ns3 { -struct mac48addrComparator -{ - bool operator()(const Mac48Address addr1, Mac48Address addr2) const - { - uint8_t s1[6], s2[6]; - addr1.CopyTo(s1); - addr2.CopyTo(s2); - for (int i = 0; i < 6; i ++) - if (s1[i] > s2[i]) - return true; - return false; - } -}; -}//namespace ns3 -#endif diff --git a/src/devices/mesh/mesh-l2-routing-protocol.h b/src/devices/mesh/mesh-l2-routing-protocol.h index a68fc5ba1..7a816308b 100644 --- a/src/devices/mesh/mesh-l2-routing-protocol.h +++ b/src/devices/mesh/mesh-l2-routing-protocol.h @@ -24,7 +24,6 @@ #include "ns3/object.h" #include "ns3/mac48-address.h" -#include "ns3/ptr.h" namespace ns3 { diff --git a/src/devices/mesh/mesh-mgt-headers.cc b/src/devices/mesh/mesh-mgt-headers.cc index 05389d91b..55704edbd 100644 --- a/src/devices/mesh/mesh-mgt-headers.cc +++ b/src/devices/mesh/mesh-mgt-headers.cc @@ -22,12 +22,7 @@ #include "ns3/mesh-mgt-headers.h" #include "ns3/address-utils.h" -#include "ns3/simulator.h" #include "ns3/assert.h" -#include "ns3/log.h" - -NS_LOG_COMPONENT_DEFINE("MeshMgtHeaders"); - namespace ns3 { /*********************************************************** @@ -72,7 +67,6 @@ void MgtMeshBeaconHeader::Serialize (Buffer::Iterator start) const { //First we pack Beacon: - NS_LOG_DEBUG("Serialization beacon"); Buffer::Iterator i = start; MgtBeaconHeader::Serialize(i); i.Next (MgtBeaconHeader::GetSerializedSize()); @@ -86,7 +80,6 @@ MgtMeshBeaconHeader::Serialize (Buffer::Iterator start) const uint32_t MgtMeshBeaconHeader::Deserialize (Buffer::Iterator start) { - NS_LOG_DEBUG("Deserialization beacon"); Buffer::Iterator i = start; MgtBeaconHeader::Deserialize(start); i.Next (MgtBeaconHeader::GetSerializedSize()); @@ -138,9 +131,9 @@ MeshMgtPeerLinkManFrame::SetIeDot11sConfiguration(IeDot11sConfiguration MeshConf } void -MeshMgtPeerLinkManFrame::SetPeerLinkManagementElement(PeerLinkManagementElement MeshPeerElement) +MeshMgtPeerLinkManFrame::SetIeDot11sPeerManagement(IeDot11sPeerManagement meshPeerElement) { - PeerLinkMan = MeshPeerElement; + PeerLinkMan = meshPeerElement; } uint16_t @@ -173,8 +166,8 @@ MeshMgtPeerLinkManFrame::GetIeDot11sConfiguration() return MeshConfig; } -PeerLinkManagementElement -MeshMgtPeerLinkManFrame::GetPeerLinkManagementElement() +IeDot11sPeerManagement +MeshMgtPeerLinkManFrame::GetIeDot11sPeerManagement() { return PeerLinkMan; } @@ -236,7 +229,8 @@ MeshMgtPeerLinkManFrame::Serialize(Buffer::Iterator start) const MeshConfig.Serialize (i); i.Next(MeshConfig.GetSerializedSize()); } - i = PeerLinkMan.Serialize (i); + PeerLinkMan.Serialize (i); + i.Next(PeerLinkMan.GetSerializedSize()); } uint32_t @@ -254,7 +248,8 @@ MeshMgtPeerLinkManFrame::Deserialize(Buffer::Iterator start) MeshConfig.Deserialize (i); i.Next(MeshConfig.GetSerializedSize()); } - i = PeerLinkMan.Deserialize (i); + PeerLinkMan.Deserialize (i); + i.Next(PeerLinkMan.GetSerializedSize()); return i.GetDistanceFrom (start); } void diff --git a/src/devices/mesh/mesh-mgt-headers.h b/src/devices/mesh/mesh-mgt-headers.h index 5eee82b9a..73d1b0502 100644 --- a/src/devices/mesh/mesh-mgt-headers.h +++ b/src/devices/mesh/mesh-mgt-headers.h @@ -23,16 +23,9 @@ #ifndef MESH_MGT_HEADERS_H #define MESH_MGT_HEADERS_H -#include - #include "ns3/header.h" -#include "ns3/status-code.h" -#include "ns3/dot11s-peer-management-element.h" #include "ns3/supported-rates.h" -#include "ns3/ie-dot11s-preq.h" -#include "ns3/ie-dot11s-prep.h" -#include "ns3/ie-dot11s-perr.h" -#include "ns3/ie-dot11s-rann.h" +#include "ns3/ie-dot11s-peer-management.h" #include "ns3/ie-dot11s-configuration.h" #include "ns3/ie-dot11s-beacon-timing.h" #include "ns3/mgt-headers.h" @@ -70,14 +63,14 @@ public: void SetQosField(uint16_t qos); void SetMeshId(Ssid Id); void SetIeDot11sConfiguration(IeDot11sConfiguration MeshConf); - void SetPeerLinkManagementElement(PeerLinkManagementElement MeshPeerElement); + void SetIeDot11sPeerManagement(IeDot11sPeerManagement meshPeerElement); uint16_t GetAid(); SupportedRates GetSupportedRates(); uint16_t GetQosField(); Ssid GetMeshId(); IeDot11sConfiguration GetIeDot11sConfiguration(); - PeerLinkManagementElement GetPeerLinkManagementElement(); + IeDot11sPeerManagement GetIeDot11sPeerManagement(); static TypeId GetTypeId(); virtual TypeId GetInstanceTypeId() const; @@ -101,14 +94,14 @@ private: static const uint8_t MESH_MGT_HEADER_PEER_CLOSE = 3; // Standart is also requires a ReasonCode to be within // PeerLinkClose frame format, but it is present within - // PeerLinkManagementElement, so we did not duplicate + // IeDot11sPeerManagement, so we did not duplicate // it. uint16_t Aid; //only in Confirm SupportedRates Rates; //only in Open and Confirm uint16_t QoS; //only in Open and Confirm Ssid MeshId; //only in Open and Confirm IeDot11sConfiguration MeshConfig; //only in Open and Confirm - PeerLinkManagementElement PeerLinkMan; //in all types of frames + IeDot11sPeerManagement PeerLinkMan; //in all types of frames }; }//namespace NS3 diff --git a/src/devices/mesh/mesh-point-device.cc b/src/devices/mesh/mesh-point-device.cc index d44a6cb9b..48c305b80 100644 --- a/src/devices/mesh/mesh-point-device.cc +++ b/src/devices/mesh/mesh-point-device.cc @@ -21,11 +21,8 @@ #include "ns3/node.h" -#include "ns3/channel.h" #include "ns3/packet.h" #include "ns3/log.h" -#include "ns3/boolean.h" -#include "ns3/simulator.h" #include "ns3/mesh-point-device.h" NS_LOG_COMPONENT_DEFINE ("MeshPointDevice"); diff --git a/src/devices/mesh/mesh-point-device.h b/src/devices/mesh/mesh-point-device.h index 2ae6d940a..75ac8229c 100644 --- a/src/devices/mesh/mesh-point-device.h +++ b/src/devices/mesh/mesh-point-device.h @@ -25,8 +25,6 @@ #include "ns3/net-device.h" #include "ns3/mac48-address.h" -#include "ns3/nstime.h" -#include "ns3/bridge-net-device.h" #include "ns3/bridge-channel.h" #include "ns3/mesh-l2-routing-protocol.h" diff --git a/src/devices/mesh/mesh-wifi-mac-header.h b/src/devices/mesh/mesh-wifi-mac-header.h index 823406474..e9c8730e8 100644 --- a/src/devices/mesh/mesh-wifi-mac-header.h +++ b/src/devices/mesh/mesh-wifi-mac-header.h @@ -24,8 +24,6 @@ #include "ns3/header.h" #include "ns3/mac48-address.h" -#include "ns3/nstime.h" -#include namespace ns3 { /** diff --git a/src/devices/mesh/mesh-wifi-mac.cc b/src/devices/mesh/mesh-wifi-mac.cc index d89e0d28d..72bee758d 100644 --- a/src/devices/mesh/mesh-wifi-mac.cc +++ b/src/devices/mesh/mesh-wifi-mac.cc @@ -35,6 +35,10 @@ #include "ns3/mac-low.h" #include "ns3/tx-statistics.h" #include "ns3/hwmp.h" +#include "ns3/ie-dot11s-beacon-timing.h" +#include "ns3/mgt-headers.h" +#include "ns3/wifi-remote-station-manager.h" +#include "ns3/mesh-wifi-peer-manager.h" NS_LOG_COMPONENT_DEFINE ("MeshWifiMac"); @@ -578,7 +582,7 @@ MeshWifiMac::Receive (Ptr packet, WifiMacHeader const *hdr) GetAddress(), peerAddress, peer_frame.GetAid(), - peer_frame.GetPeerLinkManagementElement(), + peer_frame.GetIeDot11sPeerManagement(), m_meshConfig ); return; @@ -586,7 +590,7 @@ MeshWifiMac::Receive (Ptr packet, WifiMacHeader const *hdr) m_peerManager->SetOpenReceived( GetAddress(), peerAddress, - peer_frame.GetPeerLinkManagementElement(), + peer_frame.GetIeDot11sPeerManagement(), m_meshConfig ); return; @@ -594,7 +598,7 @@ MeshWifiMac::Receive (Ptr packet, WifiMacHeader const *hdr) m_peerManager->SetCloseReceived( GetAddress(), peerAddress, - peer_frame.GetPeerLinkManagementElement() + peer_frame.GetIeDot11sPeerManagement() ); return; default: @@ -677,34 +681,34 @@ MeshWifiMac::CalcSwDelay() } void -MeshWifiMac::SendPeerLinkOpen(PeerLinkManagementElement peer_element, Mac48Address peerAddress) +MeshWifiMac::SendPeerLinkOpen(IeDot11sPeerManagement peer_element, Mac48Address peerAddress) { MeshMgtPeerLinkManFrame open; open.SetOpen(); open.SetIeDot11sConfiguration(m_meshConfig); - open.SetPeerLinkManagementElement(peer_element); + open.SetIeDot11sPeerManagement(peer_element); Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, open, peerAddress); } void -MeshWifiMac::SendPeerLinkConfirm(PeerLinkManagementElement peer_element, Mac48Address peerAddress, uint16_t aid) +MeshWifiMac::SendPeerLinkConfirm(IeDot11sPeerManagement peer_element, Mac48Address peerAddress, uint16_t aid) { MeshMgtPeerLinkManFrame confirm; confirm.SetConfirm(); confirm.SetIeDot11sConfiguration(m_meshConfig); - confirm.SetPeerLinkManagementElement(peer_element); + confirm.SetIeDot11sPeerManagement(peer_element); confirm.SetAid(aid); Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, confirm, peerAddress); } void -MeshWifiMac::SendPeerLinkClose(PeerLinkManagementElement peer_element, Mac48Address peerAddress) +MeshWifiMac::SendPeerLinkClose(IeDot11sPeerManagement peer_element, Mac48Address peerAddress) { MeshMgtPeerLinkManFrame close; close.SetClose(); close.SetIeDot11sConfiguration(m_meshConfig); - close.SetPeerLinkManagementElement(peer_element); + close.SetIeDot11sPeerManagement(peer_element); Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, close, peerAddress); } diff --git a/src/devices/mesh/mesh-wifi-mac.h b/src/devices/mesh/mesh-wifi-mac.h index 516471720..ee0b50700 100644 --- a/src/devices/mesh/mesh-wifi-mac.h +++ b/src/devices/mesh/mesh-wifi-mac.h @@ -22,19 +22,13 @@ #ifndef MAC_HIGH_MESH_H #define MAC_HIGH_MESH_H -#include #include #include "ns3/mac48-address.h" -#include "ns3/mac48-address-comparator.h" -#include "ns3/mgt-headers.h" #include "ns3/mesh-mgt-headers.h" -#include "ns3/callback.h" -#include "ns3/packet.h" -#include "ns3/nstime.h" -#include "ns3/ie-dot11s-beacon-timing.h" -#include "ns3/wifi-remote-station-manager.h" -#include "ns3/mesh-wifi-peer-manager.h" #include "ns3/wifi-mac.h" +#include "ns3/ie-dot11s-preq.h" +#include "ns3/ie-dot11s-prep.h" +#include "ns3/ie-dot11s-perr.h" namespace ns3 { @@ -63,31 +57,31 @@ public: MeshWifiMac (); ~MeshWifiMac (); // inherited from WifiMac. - virtual void SetSlot (Time slotTime); - virtual void SetSifs (Time sifs); - virtual void SetPifs (Time pifs); - virtual void SetCtsTimeout (Time ctsTimeout); - virtual void SetAckTimeout (Time ackTimeout); - virtual void SetEifsNoDifs (Time eifsNoDifs); - virtual Time GetSlot () const; - virtual Time GetSifs () const; - virtual Time GetPifs () const; - virtual Time GetCtsTimeout () const; - virtual Time GetAckTimeout () const; - virtual Time GetEifsNoDifs () const; - virtual void SetWifiPhy (Ptr phy); - virtual void SetWifiRemoteStationManager (Ptr stationManager); - virtual void Enqueue (Ptr packet, Mac48Address to, Mac48Address from); - virtual void Enqueue (Ptr packet, Mac48Address to); - virtual bool SupportsSendFrom () const; - virtual void SetForwardUpCallback (Callback, Mac48Address, Mac48Address> upCallback); - virtual void SetLinkUpCallback (Callback linkUp); - virtual void SetLinkDownCallback (Callback linkDown); - virtual Mac48Address GetAddress () const; - virtual Mac48Address GetBssid () const; - virtual Ssid GetSsid () const; - virtual void SetAddress (Mac48Address address); - virtual void SetSsid (Ssid ssid); + void SetSlot (Time slotTime); + void SetSifs (Time sifs); + void SetPifs (Time pifs); + void SetCtsTimeout (Time ctsTimeout); + void SetAckTimeout (Time ackTimeout); + void SetEifsNoDifs (Time eifsNoDifs); + Time GetSlot () const; + Time GetSifs () const; + Time GetPifs () const; + Time GetCtsTimeout () const; + Time GetAckTimeout () const; + Time GetEifsNoDifs () const; + void SetWifiPhy (Ptr phy); + void SetWifiRemoteStationManager (Ptr stationManager); + void Enqueue (Ptr packet, Mac48Address to, Mac48Address from); + void Enqueue (Ptr packet, Mac48Address to); + bool SupportsSendFrom () const; + void SetForwardUpCallback (Callback, Mac48Address, Mac48Address> upCallback); + void SetLinkUpCallback (Callback linkUp); + void SetLinkDownCallback (Callback linkDown); + Mac48Address GetAddress () const; + Mac48Address GetBssid () const; + Ssid GetSsid () const; + void SetAddress (Mac48Address address); + void SetSsid (Ssid ssid); /** * \param interval is an interval between two * successive beacons @@ -131,7 +125,7 @@ public: * a given peer manager */ void SetPeerLinkManager(Ptr manager); - virtual void SetPreqReceivedCallback( + void SetPreqReceivedCallback( Callback cb); /** * \brief this callback is set by Hwmp routing @@ -140,7 +134,7 @@ public: * \param cb is a callback to be executed when * receiving PREP. */ - virtual void SetPrepReceivedCallback( + void SetPrepReceivedCallback( Callback cb); /** * \brief this callback is set by Hwmp routing @@ -149,7 +143,7 @@ public: * \param cb is a callback to be executed when * receiving PERR. */ - virtual void SetPerrReceivedCallback( + void SetPerrReceivedCallback( Callback cb); /** @@ -159,7 +153,7 @@ public: * \param cb is a callback to be executed when * peer failure has ben detected */ - virtual void SetPeerStatusCallback( + void SetPeerStatusCallback( Callback cb); /** * \brief Sends a PREQ frame. @@ -169,7 +163,7 @@ public: * \attention This method is public, because * HWMP makes a callback using this method */ - virtual void SendPreq(const IeDot11sPreq& preq); + void SendPreq(const IeDot11sPreq& preq); /** * \brief Sends a PREP frame. * \param prep is prep information element @@ -181,7 +175,7 @@ public: * HWMP makes a callback using this method */ - virtual void SendPrep(const IeDot11sPrep& prep, const Mac48Address& to); + void SendPrep(const IeDot11sPrep& prep, const Mac48Address& to); /** * \brief Sends a PERR frame. * \param perr is perr information element @@ -192,7 +186,7 @@ public: * \attention This method is public, because * HWMP makes a callback using this method */ - virtual void SendPerr(const IeDot11sPerr& perr, std::vector receivers); + void SendPerr(const IeDot11sPerr& perr, std::vector receivers); /** * \brief Sends PeerLinkOpen frame to a given * address. Mac only forms a proper @@ -203,7 +197,7 @@ public: * destination of given frame */ void SendPeerLinkOpen( - PeerLinkManagementElement peer_element, + IeDot11sPeerManagement peer_element, Mac48Address peerAddress ); /** @@ -218,7 +212,7 @@ public: * peer manager */ void SendPeerLinkConfirm( - PeerLinkManagementElement peer_element, + IeDot11sPeerManagement peer_element, Mac48Address peerAddress, uint16_t aid ); @@ -232,7 +226,7 @@ public: * destination of given frame */ void SendPeerLinkClose( - PeerLinkManagementElement peer_element, + IeDot11sPeerManagement peer_element, Mac48Address peerAddress ); /** @@ -243,7 +237,7 @@ public: * \param peerAddress is the address of * destination of given frame */ - virtual void PeerLinkStatus(Mac48Address peerAddress, bool status); + void PeerLinkStatus(Mac48Address peerAddress, bool status); /** * \brief Peer Manager notifyes MAC about new @@ -262,7 +256,7 @@ public: ); private: void Receive (Ptr packet, WifiMacHeader const *hdr); - virtual void ForwardUp (Ptr packet, Mac48Address src, Mac48Address dst); + void ForwardUp (Ptr packet, Mac48Address src, Mac48Address dst); void ForwardDown( Ptr packet, Mac48Address from, @@ -306,7 +300,7 @@ private: void SetBeaconGeneration (bool enable); bool GetBeaconGeneration () const; SupportedRates GetSupportedRates () const; - virtual void DoDispose (); + void DoDispose (); Ptr m_BE; Ptr m_BK; @@ -370,7 +364,7 @@ private: * \brief metric calculation parameters */ uint32_t CalculateMetric(Mac48Address peerAddress); - std::map + std::map m_metricDatabase; }; diff --git a/src/devices/mesh/mesh-wifi-peer-manager.cc b/src/devices/mesh/mesh-wifi-peer-manager.cc index d22750f10..6dddbbe53 100644 --- a/src/devices/mesh/mesh-wifi-peer-manager.cc +++ b/src/devices/mesh/mesh-wifi-peer-manager.cc @@ -498,14 +498,14 @@ void WifiPeerLinkDescriptor::ClearHoldingTimer() void WifiPeerLinkDescriptor::SendPeerLinkClose(dot11sReasonCode reasoncode) { - PeerLinkManagementElement peerElement; + IeDot11sPeerManagement peerElement; peerElement.SetPeerClose(m_localLinkId, m_peerLinkId, reasoncode); m_mac->SendPeerLinkClose(peerElement,m_peerAddress); } void WifiPeerLinkDescriptor::SendPeerLinkOpen() { - PeerLinkManagementElement peerElement; + IeDot11sPeerManagement peerElement; peerElement.SetPeerOpen(m_localLinkId); NS_ASSERT(m_mac != NULL); m_mac->SendPeerLinkOpen(peerElement, m_peerAddress); @@ -513,7 +513,7 @@ void WifiPeerLinkDescriptor::SendPeerLinkOpen() void WifiPeerLinkDescriptor::SendPeerLinkConfirm() { - PeerLinkManagementElement peerElement; + IeDot11sPeerManagement peerElement; peerElement.SetPeerConfirm(m_localLinkId, m_peerLinkId); m_mac->SendPeerLinkConfirm(peerElement, m_peerAddress, m_assocId); } @@ -694,7 +694,7 @@ void WifiPeerManager::SetOpenReceived( Mac48Address portAddress, Mac48Address peerAddress, - PeerLinkManagementElement peerMan, + IeDot11sPeerManagement peerMan, IeDot11sConfiguration conf ) { @@ -724,7 +724,7 @@ WifiPeerManager::SetConfirmReceived( Mac48Address portAddress, Mac48Address peerAddress, uint16_t peerAid, - PeerLinkManagementElement peerMan, + IeDot11sPeerManagement peerMan, IeDot11sConfiguration meshConfig ) { @@ -739,7 +739,7 @@ void WifiPeerManager::SetCloseReceived( Mac48Address portAddress, Mac48Address peerAddress, - PeerLinkManagementElement peerMan + IeDot11sPeerManagement peerMan ) { PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress); diff --git a/src/devices/mesh/mesh-wifi-peer-manager.h b/src/devices/mesh/mesh-wifi-peer-manager.h index eaeb988ff..21c192f2d 100644 --- a/src/devices/mesh/mesh-wifi-peer-manager.h +++ b/src/devices/mesh/mesh-wifi-peer-manager.h @@ -23,13 +23,9 @@ #ifndef WIFI_PEER_MAN_H #define WIFI_PEER_MAN_H -#include "ns3/event-id.h" -#include "ns3/ptr.h" -#include "ns3/nstime.h" #include "ns3/mac48-address.h" -#include "ns3/uinteger.h" #include "ns3/wifi-net-device.h" -#include "ns3/dot11s-peer-management-element.h" +#include "ns3/ie-dot11s-peer-management.h" #include "ns3/ie-dot11s-beacon-timing.h" #include "ns3/mesh-wifi-mac.h" @@ -69,7 +65,7 @@ public: void SetPeerAid(uint16_t aid); void SetBeaconTimingElement(IeDot11sBeaconTiming beaconTiming); void SetPeerLinkDescriptorElement( - PeerLinkManagementElement peerLinkElement + IeDot11sPeerManagement peerLinkElement ); Mac48Address GetPeerAddress()const; /** @@ -81,7 +77,7 @@ public: Time GetBeaconInterval()const; IeDot11sBeaconTiming GetBeaconTimingElement()const; - PeerLinkManagementElement + IeDot11sPeerManagement GetPeerLinkDescriptorElement()const; void ClearTimingElement(); /* MLME */ @@ -232,7 +228,7 @@ public: void SetOpenReceived( Mac48Address portAddress, Mac48Address peerAddress, - PeerLinkManagementElement + IeDot11sPeerManagement peerMan, IeDot11sConfiguration conf ); @@ -240,14 +236,14 @@ public: Mac48Address portAddress, Mac48Address peerAddress, uint16_t peerAid, - PeerLinkManagementElement + IeDot11sPeerManagement peerMan, IeDot11sConfiguration meshConfig ); void SetCloseReceived( Mac48Address portAddress, Mac48Address peerAddress, - PeerLinkManagementElement peerMan + IeDot11sPeerManagement peerMan ); //Using this function MAC void ConfigurationMismatch( diff --git a/src/devices/mesh/wifi-information-element.h b/src/devices/mesh/wifi-information-element.h index 7e7ac4b15..a989e43a0 100644 --- a/src/devices/mesh/wifi-information-element.h +++ b/src/devices/mesh/wifi-information-element.h @@ -136,11 +136,11 @@ protected: /// Own unique Element ID virtual WifiElementId ElementId () const = 0; /// Length of serialized information - virtual uint16_t GetInformationSize () const = 0; + virtual uint8_t GetInformationSize () const = 0; /// Serialize information virtual void SerializeInformation (Buffer::Iterator start) const = 0; /// Deserialize information - virtual uint16_t DeserializeInformation (Buffer::Iterator start, uint8_t length) = 0; + virtual uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length) = 0; /// Print information virtual void PrintInformation (std::ostream &os) const = 0; //\} diff --git a/src/devices/mesh/wscript b/src/devices/mesh/wscript index 33184a085..89e8daf9a 100644 --- a/src/devices/mesh/wscript +++ b/src/devices/mesh/wscript @@ -19,7 +19,6 @@ def build(bld): 'hwmp.cc', 'mesh-wifi-mac.cc', 'hwmp-state.cc', - 'dot11s-peer-management-element.cc', 'mesh-mgt-headers.cc', ] headers = bld.new_task_gen('ns3header') @@ -39,8 +38,6 @@ def build(bld): 'mesh-mgt-headers.h', 'hwmp.h', 'tx-statistics.h', - 'dot11s-peer-management-element.h', - 'mac48-address-comparator.h', 'hwmp-rtable.h', 'mesh-wifi-peer-manager.h', 'mesh-wifi-mac-header.h',