From 91a655467b28f7459ddb24e4c2bd75ed57178126 Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Wed, 25 Mar 2009 12:23:12 +0300 Subject: [PATCH] Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s --- examples/mesh.cc | 2 +- src/devices/mesh/dot11s/dot11s-helper.cc | 2 +- .../mesh/dot11s/ie-dot11s-beacon-timing.cc | 48 ++++++------ .../mesh/dot11s/ie-dot11s-beacon-timing.h | 10 +-- .../mesh/dot11s/ie-dot11s-configuration.cc | 26 +++---- .../mesh/dot11s/ie-dot11s-configuration.h | 4 +- .../mesh/dot11s/ie-dot11s-peer-management.cc | 28 +++---- .../mesh/dot11s/ie-dot11s-peer-management.h | 4 +- src/devices/mesh/dot11s/ie-dot11s-perr.cc | 30 +++---- src/devices/mesh/dot11s/ie-dot11s-perr.h | 6 +- src/devices/mesh/dot11s/ie-dot11s-prep.cc | 62 +++++++-------- src/devices/mesh/dot11s/ie-dot11s-prep.h | 6 +- src/devices/mesh/dot11s/ie-dot11s-preq.cc | 78 +++++++++---------- src/devices/mesh/dot11s/ie-dot11s-preq.h | 6 +- src/devices/mesh/dot11s/ie-dot11s-rann.cc | 42 +++++----- src/devices/mesh/dot11s/ie-dot11s-rann.h | 6 +- src/devices/mesh/dot11s/peer-link-frame.cc | 16 ++-- src/devices/mesh/dot11s/peer-link.cc | 18 ++--- src/devices/mesh/dot11s/peer-link.h | 23 +++--- .../mesh/dot11s/peer-manager-plugin.cc | 26 +++---- src/devices/mesh/dot11s/peer-manager-plugin.h | 11 ++- .../mesh/dot11s/peer-manager-protocol.cc | 69 ++++++++-------- .../mesh/dot11s/peer-manager-protocol.h | 44 ++++++----- src/devices/mesh/mesh-wifi-interface-mac.cc | 2 - 24 files changed, 285 insertions(+), 284 deletions(-) diff --git a/examples/mesh.cc b/examples/mesh.cc index 889e84280..e8e7368a6 100644 --- a/examples/mesh.cc +++ b/examples/mesh.cc @@ -71,7 +71,7 @@ main (int argc, char *argv[]) "RandomStart", TimeValue (Seconds (randomStart)) ); //wifi.SetPeerManager("ns3::WifiPeerManager"); - wifi.SetPeerManager("ns3::Dot11sPeerManagerProtocol"); + wifi.SetPeerManager("ns3::PeerManagerProtocol"); wifi.SetL2RoutingNetDevice ("ns3::MeshPointDevice"); meshDevices = wifi.Install (wifiPhy,nodes); // Installing Mobility. diff --git a/src/devices/mesh/dot11s/dot11s-helper.cc b/src/devices/mesh/dot11s/dot11s-helper.cc index 6e69a8c53..614b2abdd 100644 --- a/src/devices/mesh/dot11s/dot11s-helper.cc +++ b/src/devices/mesh/dot11s/dot11s-helper.cc @@ -154,7 +154,7 @@ MeshWifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const device->SetMac (mac); device->SetPhy (phy); Ptr peerMan = m_peerMan.Create (); - NS_ASSERT(peerMan->AttachPorts(ports)); + NS_ASSERT(peerMan->AttachInterfaces(ports)); device->SetRemoteStationManager (manager); node->AddDevice (device); nodeDevices.push_back (device); diff --git a/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.cc b/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.cc index 39775b59b..1cf19c55a 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.cc +++ b/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.cc @@ -24,9 +24,9 @@ namespace ns3 { namespace dot11s { /******************************************* - * IeDot11sBeaconTimingUnit + * IeBeaconTimingUnit *******************************************/ -IeDot11sBeaconTimingUnit::IeDot11sBeaconTimingUnit (): +IeBeaconTimingUnit::IeBeaconTimingUnit (): m_aid (0), m_lastBeacon (0), m_beaconInterval (0) @@ -34,57 +34,57 @@ IeDot11sBeaconTimingUnit::IeDot11sBeaconTimingUnit (): } void -IeDot11sBeaconTimingUnit::SetAid (uint8_t aid) +IeBeaconTimingUnit::SetAid (uint8_t aid) { m_aid = aid; } void -IeDot11sBeaconTimingUnit::SetLastBeacon (uint16_t lastBeacon) +IeBeaconTimingUnit::SetLastBeacon (uint16_t lastBeacon) { m_lastBeacon = lastBeacon; } void -IeDot11sBeaconTimingUnit::SetBeaconInterval (uint16_t beaconInterval) +IeBeaconTimingUnit::SetBeaconInterval (uint16_t beaconInterval) { m_beaconInterval = beaconInterval; } uint8_t -IeDot11sBeaconTimingUnit::GetAid () +IeBeaconTimingUnit::GetAid () { return m_aid; } uint16_t -IeDot11sBeaconTimingUnit::GetLastBeacon () +IeBeaconTimingUnit::GetLastBeacon () { return m_lastBeacon; } uint16_t -IeDot11sBeaconTimingUnit::GetBeaconInterval () +IeBeaconTimingUnit::GetBeaconInterval () { return m_beaconInterval; } /******************************************* - * IeDot11sBeaconTiming + * IeBeaconTiming *******************************************/ -IeDot11sBeaconTiming::IeDot11sBeaconTiming (): +IeBeaconTiming::IeBeaconTiming (): m_numOfUnits (0) { } -IeDot11sBeaconTiming::NeighboursTimingUnitsList -IeDot11sBeaconTiming::GetNeighboursTimingElementsList () +IeBeaconTiming::NeighboursTimingUnitsList +IeBeaconTiming::GetNeighboursTimingElementsList () { return m_neighbours; } void -IeDot11sBeaconTiming::AddNeighboursTimingElementUnit ( +IeBeaconTiming::AddNeighboursTimingElementUnit ( uint16_t aid, Time last_beacon, //MicroSeconds! Time beacon_interval //MicroSeconds! @@ -100,7 +100,7 @@ IeDot11sBeaconTiming::AddNeighboursTimingElementUnit ( && ((*i)->GetBeaconInterval () == BeaconIntervalToU16(beacon_interval)) ) return; - Ptrnew_element = Create (); + Ptrnew_element = Create (); new_element->SetAid (AidToU8(aid)); new_element->SetLastBeacon (TimestampToU16(last_beacon)); new_element->SetBeaconInterval (BeaconIntervalToU16(beacon_interval)); @@ -109,7 +109,7 @@ IeDot11sBeaconTiming::AddNeighboursTimingElementUnit ( } void -IeDot11sBeaconTiming::DelNeighboursTimingElementUnit ( +IeBeaconTiming::DelNeighboursTimingElementUnit ( uint16_t aid, Time last_beacon, //MicroSeconds! Time beacon_interval //MicroSeconds! @@ -129,7 +129,7 @@ IeDot11sBeaconTiming::DelNeighboursTimingElementUnit ( } void -IeDot11sBeaconTiming::ClearTimingElement () +IeBeaconTiming::ClearTimingElement () { uint16_t to_delete = 0; uint16_t i; @@ -145,13 +145,13 @@ IeDot11sBeaconTiming::ClearTimingElement () } uint8_t -IeDot11sBeaconTiming::GetInformationSize () const +IeBeaconTiming::GetInformationSize () const { return (5*m_numOfUnits); } void -IeDot11sBeaconTiming::PrintInformation (std::ostream& os) const +IeBeaconTiming::PrintInformation (std::ostream& os) const { for (NeighboursTimingUnitsList::const_iterator j = m_neighbours.begin (); j != m_neighbours.end(); j++) os << "AID=" << (*j)->GetAid () << ", Last beacon was at " @@ -159,7 +159,7 @@ IeDot11sBeaconTiming::PrintInformation (std::ostream& os) const } void -IeDot11sBeaconTiming::SerializeInformation (Buffer::Iterator i) const +IeBeaconTiming::SerializeInformation (Buffer::Iterator i) const { for (NeighboursTimingUnitsList::const_iterator j = m_neighbours.begin (); j != m_neighbours.end(); j++) { @@ -169,13 +169,13 @@ IeDot11sBeaconTiming::SerializeInformation (Buffer::Iterator i) const } } uint8_t -IeDot11sBeaconTiming::DeserializeInformation (Buffer::Iterator start, uint8_t length) +IeBeaconTiming::DeserializeInformation (Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; m_numOfUnits = length/5; for (int j = 0; j < m_numOfUnits; j ++) { - Ptr new_element = Create (); + Ptr new_element = Create (); new_element->SetAid (i.ReadU8()); new_element->SetLastBeacon (i.ReadNtohU16()); new_element->SetBeaconInterval (i.ReadNtohU16()); @@ -185,19 +185,19 @@ IeDot11sBeaconTiming::DeserializeInformation (Buffer::Iterator start, uint8_t le }; uint16_t -IeDot11sBeaconTiming::TimestampToU16 (Time x) +IeBeaconTiming::TimestampToU16 (Time x) { return ((uint16_t) ((x.GetMicroSeconds() >> 8)&0xffff)); }; uint16_t -IeDot11sBeaconTiming::BeaconIntervalToU16 (Time x) +IeBeaconTiming::BeaconIntervalToU16 (Time x) { return ((uint16_t) (x.GetMicroSeconds() >>10)&0xffff); }; uint8_t -IeDot11sBeaconTiming::AidToU8 (uint16_t x) +IeBeaconTiming::AidToU8 (uint16_t x) { return (uint8_t) (x&0xff); }; diff --git a/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.h b/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.h index 4ac552817..bf5de40dd 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.h +++ b/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.h @@ -33,10 +33,10 @@ namespace dot11s { * \ingroup dot11s * \brief Describes one unit of beacon timing element */ -class IeDot11sBeaconTimingUnit : public RefCountBase +class IeBeaconTimingUnit : public RefCountBase { public: - IeDot11sBeaconTimingUnit (); + IeBeaconTimingUnit (); void SetAid (uint8_t aid); void SetLastBeacon (uint16_t last_beacon); void SetBeaconInterval (uint16_t beacon_interval); @@ -63,16 +63,16 @@ public: * \ingroup dot11s * \brief See 7.3.2.89 of 802.11s draft 2.07 */ -class IeDot11sBeaconTiming : public WifiInformationElement +class IeBeaconTiming : public WifiInformationElement { public: /** * \ingroup dot11s * This type is a list of timing elements obtained from neigbours with their beacons: */ - typedef std::list< Ptr > NeighboursTimingUnitsList; + typedef std::list< Ptr > NeighboursTimingUnitsList; - IeDot11sBeaconTiming (); + IeBeaconTiming (); /** * This methods are needed for beacon collision * avoidance module: diff --git a/src/devices/mesh/dot11s/ie-dot11s-configuration.cc b/src/devices/mesh/dot11s/ie-dot11s-configuration.cc index 8b149c812..f8a33e1ce 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-configuration.cc +++ b/src/devices/mesh/dot11s/ie-dot11s-configuration.cc @@ -76,7 +76,7 @@ bool dot11sMeshCapability::Is (uint16_t cap, uint8_t n) const return (cap & mask) == mask; } -IeDot11sConfiguration::IeDot11sConfiguration (): +IeConfiguration::IeConfiguration (): m_APSId (PROTOCOL_HWMP), m_APSMId (METRIC_AIRTIME), m_CCMId (CONGESTION_DEFAULT), @@ -84,20 +84,20 @@ IeDot11sConfiguration::IeDot11sConfiguration (): {} TypeId -IeDot11sConfiguration::GetTypeId () +IeConfiguration::GetTypeId () { - static TypeId tid = TypeId ("ns3::IeDot11sConfiguration") + static TypeId tid = TypeId ("ns3::IeConfiguration") .SetParent (); return tid; } TypeId -IeDot11sConfiguration::GetInstanceTypeId () const +IeConfiguration::GetInstanceTypeId () const { return GetTypeId (); } uint8_t -IeDot11sConfiguration::GetInformationSize () const +IeConfiguration::GetInformationSize () const { return 1 // Version + 4 // APSPId @@ -108,7 +108,7 @@ IeDot11sConfiguration::GetInformationSize () const } void -IeDot11sConfiguration::SerializeInformation (Buffer::Iterator i) const +IeConfiguration::SerializeInformation (Buffer::Iterator i) const { i.WriteU8 (1); //Version // Active Path Selection Protocol ID: @@ -123,7 +123,7 @@ IeDot11sConfiguration::SerializeInformation (Buffer::Iterator i) const } uint8_t -IeDot11sConfiguration::DeserializeInformation (Buffer::Iterator i, uint8_t length) +IeConfiguration::DeserializeInformation (Buffer::Iterator i, uint8_t length) { Buffer::Iterator start = i; uint8_t version; @@ -140,35 +140,35 @@ IeDot11sConfiguration::DeserializeInformation (Buffer::Iterator i, uint8_t lengt return i.GetDistanceFrom (start); } void -IeDot11sConfiguration::PrintInformation (std::ostream& os) const +IeConfiguration::PrintInformation (std::ostream& os) const { //TODO: print } void -IeDot11sConfiguration::SetRouting (dot11sPathSelectionProtocol routingId) +IeConfiguration::SetRouting (dot11sPathSelectionProtocol routingId) { m_APSId = routingId; } void -IeDot11sConfiguration::SetMetric (dot11sPathSelectionMetric metricId) +IeConfiguration::SetMetric (dot11sPathSelectionMetric metricId) { m_APSMId = metricId; } bool -IeDot11sConfiguration::IsHWMP () +IeConfiguration::IsHWMP () { return (m_APSId == PROTOCOL_HWMP); } bool -IeDot11sConfiguration::IsAirtime () +IeConfiguration::IsAirtime () { return (m_APSMId == METRIC_AIRTIME); } -dot11sMeshCapability const& IeDot11sConfiguration::MeshCapability () +dot11sMeshCapability const& IeConfiguration::MeshCapability () { return m_meshCap; } diff --git a/src/devices/mesh/dot11s/ie-dot11s-configuration.h b/src/devices/mesh/dot11s/ie-dot11s-configuration.h index 1bf37f408..fc6583423 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-configuration.h +++ b/src/devices/mesh/dot11s/ie-dot11s-configuration.h @@ -89,13 +89,13 @@ public: * \brief Describes Mesh Configuration Element * see 7.3.2.81 of 802.11s draft 2.07 */ -class IeDot11sConfiguration : public WifiInformationElement +class IeConfiguration : public WifiInformationElement { public: static TypeId GetTypeId (); TypeId GetInstanceTypeId () const; - IeDot11sConfiguration (); + IeConfiguration (); void SetRouting (dot11sPathSelectionProtocol routingId); void SetMetric (dot11sPathSelectionMetric metricId); bool IsHWMP (); diff --git a/src/devices/mesh/dot11s/ie-dot11s-peer-management.cc b/src/devices/mesh/dot11s/ie-dot11s-peer-management.cc index 9d97f4a95..681c291fa 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-peer-management.cc +++ b/src/devices/mesh/dot11s/ie-dot11s-peer-management.cc @@ -29,7 +29,7 @@ namespace ns3 { namespace dot11s { -IeDot11sPeerManagement::IeDot11sPeerManagement (): +IePeerManagement::IePeerManagement (): m_length (0), m_subtype (PEER_OPEN), m_localLinkId (0), @@ -39,14 +39,14 @@ IeDot11sPeerManagement::IeDot11sPeerManagement (): void -IeDot11sPeerManagement::SetPeerOpen (uint16_t localLinkId) +IePeerManagement::SetPeerOpen (uint16_t localLinkId) { m_length = 3; m_subtype = PEER_OPEN; m_localLinkId = localLinkId; } void -IeDot11sPeerManagement::SetPeerClose (uint16_t localLinkId, uint16_t peerLinkId, dot11sReasonCode reasonCode) +IePeerManagement::SetPeerClose (uint16_t localLinkId, uint16_t peerLinkId, dot11sReasonCode reasonCode) { m_length = 7; m_subtype = PEER_CLOSE; @@ -56,7 +56,7 @@ IeDot11sPeerManagement::SetPeerClose (uint16_t localLinkId, uint16_t peerLinkId, } void -IeDot11sPeerManagement::SetPeerConfirm (uint16_t localLinkId, uint16_t peerLinkId) +IePeerManagement::SetPeerConfirm (uint16_t localLinkId, uint16_t peerLinkId) { m_length = 5; m_subtype = PEER_CONFIRM; @@ -65,47 +65,47 @@ IeDot11sPeerManagement::SetPeerConfirm (uint16_t localLinkId, uint16_t peerLinkI } dot11sReasonCode -IeDot11sPeerManagement::GetReasonCode () const +IePeerManagement::GetReasonCode () const { return m_reasonCode; } uint16_t -IeDot11sPeerManagement::GetLocalLinkId () const +IePeerManagement::GetLocalLinkId () const { return m_localLinkId; } uint16_t -IeDot11sPeerManagement::GetPeerLinkId () const +IePeerManagement::GetPeerLinkId () const { return m_peerLinkId; } uint8_t -IeDot11sPeerManagement::GetInformationSize (void) const +IePeerManagement::GetInformationSize (void) const { return m_length; } bool -IeDot11sPeerManagement::SubtypeIsOpen () const +IePeerManagement::SubtypeIsOpen () const { return (m_subtype == PEER_OPEN); } bool -IeDot11sPeerManagement::SubtypeIsClose () const +IePeerManagement::SubtypeIsClose () const { return (m_subtype == PEER_CLOSE); } bool -IeDot11sPeerManagement::SubtypeIsConfirm () const +IePeerManagement::SubtypeIsConfirm () const { return (m_subtype == PEER_CONFIRM); } void -IeDot11sPeerManagement::SerializeInformation (Buffer::Iterator i) const +IePeerManagement::SerializeInformation (Buffer::Iterator i) const { i.WriteU8 (m_subtype); i.WriteHtonU16 (m_localLinkId); @@ -115,7 +115,7 @@ IeDot11sPeerManagement::SerializeInformation (Buffer::Iterator i) const i.WriteHtonU16 (m_reasonCode); } uint8_t -IeDot11sPeerManagement::DeserializeInformation (Buffer::Iterator start, uint8_t length) +IePeerManagement::DeserializeInformation (Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; m_subtype = i.ReadU8 (); @@ -134,7 +134,7 @@ IeDot11sPeerManagement::DeserializeInformation (Buffer::Iterator start, uint8_t return i.GetDistanceFrom (start); } void -IeDot11sPeerManagement::PrintInformation (std::ostream& os) const +IePeerManagement::PrintInformation (std::ostream& os) const { //TODO } diff --git a/src/devices/mesh/dot11s/ie-dot11s-peer-management.h b/src/devices/mesh/dot11s/ie-dot11s-peer-management.h index 4b8e2274c..a7c7c6495 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-peer-management.h +++ b/src/devices/mesh/dot11s/ie-dot11s-peer-management.h @@ -32,10 +32,10 @@ namespace dot11s { * \ingroup dot11s * \brief See 7.3.2.85 of draft 2.07 */ -class IeDot11sPeerManagement : public WifiInformationElement +class IePeerManagement : public WifiInformationElement { public: - IeDot11sPeerManagement (); + IePeerManagement (); enum Subtype { PEER_OPEN = 0, PEER_CLOSE = 1, diff --git a/src/devices/mesh/dot11s/ie-dot11s-perr.cc b/src/devices/mesh/dot11s/ie-dot11s-perr.cc index a8a581f58..9644a9c33 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-perr.cc +++ b/src/devices/mesh/dot11s/ie-dot11s-perr.cc @@ -25,38 +25,38 @@ namespace ns3 { namespace dot11s { -IeDot11sPerr::~IeDot11sPerr () +IePerr::~IePerr () { } TypeId -IeDot11sPerr::GetTypeId () +IePerr::GetTypeId () { - static TypeId tid = TypeId ("ns3::IeDot11sPerr") + static TypeId tid = TypeId ("ns3::IePerr") .SetParent (); return tid; } void -IeDot11sPerr::PrintInformation (std::ostream &os) const +IePerr::PrintInformation (std::ostream &os) const { // FILL } TypeId -IeDot11sPerr::GetInstanceTypeId () const +IePerr::GetInstanceTypeId () const { return GetTypeId (); } -IeDot11sPerr::IeDot11sPerr (): +IePerr::IePerr (): m_numOfDest (0) { } uint8_t -IeDot11sPerr::GetNumOfDest () +IePerr::GetNumOfDest () { return m_numOfDest; } void -IeDot11sPerr::SerializeInformation (Buffer::Iterator i) const +IePerr::SerializeInformation (Buffer::Iterator i) const { i.WriteU8 (0); i.WriteU8 (m_numOfDest); @@ -68,7 +68,7 @@ IeDot11sPerr::SerializeInformation (Buffer::Iterator i) const } } uint8_t -IeDot11sPerr::DeserializeInformation (Buffer::Iterator start, uint8_t length) +IePerr::DeserializeInformation (Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; i.Next (1); //Mode flags is not used now @@ -86,7 +86,7 @@ IeDot11sPerr::DeserializeInformation (Buffer::Iterator start, uint8_t length) } uint8_t -IeDot11sPerr::GetInformationSize () const +IePerr::GetInformationSize () const { uint8_t retval = 1 //ModeFlags @@ -97,7 +97,7 @@ IeDot11sPerr::GetInformationSize () const } void -IeDot11sPerr::AddAddressUnit (FailedDestination unit) +IePerr::AddAddressUnit (FailedDestination unit) { for (unsigned int i = 0; i < m_addressUnits.size (); i ++) if (m_addressUnits[i].destination == unit.destination) @@ -106,13 +106,13 @@ IeDot11sPerr::AddAddressUnit (FailedDestination unit) m_numOfDest++; } -std::vector -IeDot11sPerr::GetAddressUnitVector () +std::vector +IePerr::GetAddressUnitVector () { return m_addressUnits; } void -IeDot11sPerr::DeleteAddressUnit (Mac48Address address) +IePerr::DeleteAddressUnit (Mac48Address address) { for (std::vector::iterator i = m_addressUnits.begin (); i != m_addressUnits.end(); i ++) if ((*i).destination == address) @@ -124,7 +124,7 @@ IeDot11sPerr::DeleteAddressUnit (Mac48Address address) } void -IeDot11sPerr::ResetPerr () +IePerr::ResetPerr () { m_numOfDest = 0; m_addressUnits.clear (); diff --git a/src/devices/mesh/dot11s/ie-dot11s-perr.h b/src/devices/mesh/dot11s/ie-dot11s-perr.h index b7de7b795..d0a2e174a 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-perr.h +++ b/src/devices/mesh/dot11s/ie-dot11s-perr.h @@ -32,11 +32,11 @@ namespace dot11s { * \ingroup dot11s * \brief See 7.3.2.98 of 802.11s draft 2.07 */ -class IeDot11sPerr : public WifiInformationElement +class IePerr : public WifiInformationElement { public: - IeDot11sPerr (); - ~IeDot11sPerr (); + IePerr (); + ~IePerr (); static TypeId GetTypeId (); virtual TypeId GetInstanceTypeId () const; struct FailedDestination diff --git a/src/devices/mesh/dot11s/ie-dot11s-prep.cc b/src/devices/mesh/dot11s/ie-dot11s-prep.cc index 3e87c4d3b..73853e290 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-prep.cc +++ b/src/devices/mesh/dot11s/ie-dot11s-prep.cc @@ -26,30 +26,30 @@ namespace ns3 { namespace dot11s { /******************************** - * IeDot11sPrep + * IePrep *******************************/ -IeDot11sPrep::~IeDot11sPrep () +IePrep::~IePrep () { } TypeId -IeDot11sPrep::GetTypeId () +IePrep::GetTypeId () { - static TypeId tid = TypeId ("ns3::IeDot11sPrep") + static TypeId tid = TypeId ("ns3::IePrep") .SetParent (); return tid; } void -IeDot11sPrep::Print (std::ostream &os) const +IePrep::Print (std::ostream &os) const { //TODO:fill this method } TypeId -IeDot11sPrep::GetInstanceTypeId () const +IePrep::GetInstanceTypeId () const { return GetTypeId (); } -IeDot11sPrep::IeDot11sPrep (): +IePrep::IePrep (): m_flags (0), m_hopcount (0), m_ttl (0), @@ -62,110 +62,110 @@ IeDot11sPrep::IeDot11sPrep (): { } void -IeDot11sPrep::SetFlags (uint8_t flags) +IePrep::SetFlags (uint8_t flags) { m_flags = flags; } void -IeDot11sPrep::SetHopcount (uint8_t hopcount) +IePrep::SetHopcount (uint8_t hopcount) { m_hopcount = hopcount; } void -IeDot11sPrep::SetTTL (uint8_t ttl) +IePrep::SetTTL (uint8_t ttl) { m_ttl = ttl; } void -IeDot11sPrep::SetDestinationSeqNumber (uint32_t dest_seq_number) +IePrep::SetDestinationSeqNumber (uint32_t dest_seq_number) { m_destSeqNumber = dest_seq_number; } void -IeDot11sPrep::SetDestinationAddress (Mac48Address dest_address) +IePrep::SetDestinationAddress (Mac48Address dest_address) { m_destinationAddress = dest_address; } void -IeDot11sPrep::SetMetric (uint32_t metric) +IePrep::SetMetric (uint32_t metric) { m_metric = metric; } void -IeDot11sPrep::SetOriginatorAddress (Mac48Address originator_address) +IePrep::SetOriginatorAddress (Mac48Address originator_address) { m_originatorAddress = originator_address; } void -IeDot11sPrep::SetOriginatorSeqNumber (uint32_t originator_seq_number) +IePrep::SetOriginatorSeqNumber (uint32_t originator_seq_number) { m_originatorSeqNumber = originator_seq_number; } void -IeDot11sPrep::SetLifetime (uint32_t lifetime) +IePrep::SetLifetime (uint32_t lifetime) { m_lifetime = lifetime; } uint8_t -IeDot11sPrep::GetFlags () const +IePrep::GetFlags () const { return m_flags; } uint8_t -IeDot11sPrep::GetHopcount () const +IePrep::GetHopcount () const { return m_hopcount; } uint32_t -IeDot11sPrep::GetTTL () const +IePrep::GetTTL () const { return m_ttl; } uint32_t -IeDot11sPrep::GetDestinationSeqNumber () const +IePrep::GetDestinationSeqNumber () const { return m_destSeqNumber; } Mac48Address -IeDot11sPrep::GetDestinationAddress () const +IePrep::GetDestinationAddress () const { return m_destinationAddress; } uint32_t -IeDot11sPrep::GetMetric () const +IePrep::GetMetric () const { return m_metric; } Mac48Address -IeDot11sPrep::GetOriginatorAddress () const +IePrep::GetOriginatorAddress () const { return m_originatorAddress; } uint32_t -IeDot11sPrep::GetOriginatorSeqNumber () const +IePrep::GetOriginatorSeqNumber () const { return m_originatorSeqNumber; } uint32_t -IeDot11sPrep::GetLifetime () const +IePrep::GetLifetime () const { return m_lifetime; } void -IeDot11sPrep::DecrementTtl () +IePrep::DecrementTtl () { m_ttl --; } void -IeDot11sPrep::IncrementMetric (uint32_t metric) +IePrep::IncrementMetric (uint32_t metric) { m_metric +=metric; } void -IeDot11sPrep::SerializeInformation (Buffer::Iterator i) const +IePrep::SerializeInformation (Buffer::Iterator i) const { i.WriteU8 (m_flags); i.WriteU8 (m_hopcount); @@ -178,7 +178,7 @@ IeDot11sPrep::SerializeInformation (Buffer::Iterator i) const i.WriteHtonU32 (m_originatorSeqNumber); } uint8_t -IeDot11sPrep::DeserializeInformation (Buffer::Iterator start, uint8_t length) +IePrep::DeserializeInformation (Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; m_flags = i.ReadU8 (); @@ -193,7 +193,7 @@ IeDot11sPrep::DeserializeInformation (Buffer::Iterator start, uint8_t length) return i.GetDistanceFrom (start); } uint8_t -IeDot11sPrep::GetInformationSize () const +IePrep::GetInformationSize () const { uint32_t retval = 1 //Flags @@ -210,7 +210,7 @@ IeDot11sPrep::GetInformationSize () const }; void -IeDot11sPrep::PrintInformation (std::ostream& os) const +IePrep::PrintInformation (std::ostream& os) const { //TODO } diff --git a/src/devices/mesh/dot11s/ie-dot11s-prep.h b/src/devices/mesh/dot11s/ie-dot11s-prep.h index 531c0d901..7631809e2 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-prep.h +++ b/src/devices/mesh/dot11s/ie-dot11s-prep.h @@ -33,11 +33,11 @@ namespace dot11s { * \ingroup dot11s * \brief See 7.3.2.97 of 802.11s draft 2.07 */ -class IeDot11sPrep : public WifiInformationElement +class IePrep : public WifiInformationElement { public: - IeDot11sPrep (); - ~IeDot11sPrep (); + IePrep (); + ~IePrep (); static TypeId GetTypeId (); virtual TypeId GetInstanceTypeId () const; virtual void Print (std::ostream &os) const; diff --git a/src/devices/mesh/dot11s/ie-dot11s-preq.cc b/src/devices/mesh/dot11s/ie-dot11s-preq.cc index 82dc14ffe..a02718039 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-preq.cc +++ b/src/devices/mesh/dot11s/ie-dot11s-preq.cc @@ -81,32 +81,32 @@ DestinationAddressUnit::GetDestinationAddress () const return m_destinationAddress; } /******************************** - * IeDot11sPreq + * IePreq *******************************/ -IeDot11sPreq::~IeDot11sPreq () +IePreq::~IePreq () { } TypeId -IeDot11sPreq::GetTypeId () +IePreq::GetTypeId () { - static TypeId tid = TypeId ("ns3::IeDot11sPreq") + static TypeId tid = TypeId ("ns3::IePreq") .SetParent (); return tid; } void -IeDot11sPreq::Print (std::ostream &os) const +IePreq::Print (std::ostream &os) const { //TODO:fill this method } TypeId -IeDot11sPreq::GetInstanceTypeId () const +IePreq::GetInstanceTypeId () const { return GetTypeId (); } -IeDot11sPreq::IeDot11sPreq (): +IePreq::IePreq (): m_maxSize (32), m_flags (0), m_hopCount (0), @@ -120,136 +120,136 @@ IeDot11sPreq::IeDot11sPreq (): { } void -IeDot11sPreq::SetUnicastPreq () +IePreq::SetUnicastPreq () { m_flags |= 1<<1; } void -IeDot11sPreq::SetNeedNotPrep () +IePreq::SetNeedNotPrep () { m_flags |= 1<<2; } //void -//IeDot11sPreq::SetFlags (uint8_t flags) +//IePreq::SetFlags (uint8_t flags) //{ // m_flags = flags; //} void -IeDot11sPreq::SetHopcount (uint8_t hopcount) +IePreq::SetHopcount (uint8_t hopcount) { m_hopCount = hopcount; } void -IeDot11sPreq::SetTTL (uint8_t ttl) +IePreq::SetTTL (uint8_t ttl) { m_ttl = ttl; } void -IeDot11sPreq::SetPreqID (uint32_t preq_id) +IePreq::SetPreqID (uint32_t preq_id) { m_preqId = preq_id; } void -IeDot11sPreq::SetMetric (uint32_t metric) +IePreq::SetMetric (uint32_t metric) { m_metric = metric; } void -IeDot11sPreq::SetOriginatorAddress (Mac48Address originator_address) +IePreq::SetOriginatorAddress (Mac48Address originator_address) { m_originatorAddress = originator_address; } void -IeDot11sPreq::SetOriginatorSeqNumber (uint32_t originator_seq_number) +IePreq::SetOriginatorSeqNumber (uint32_t originator_seq_number) { m_originatorSeqNumber = originator_seq_number; } void -IeDot11sPreq::SetLifetime (uint32_t lifetime) +IePreq::SetLifetime (uint32_t lifetime) { m_lifetime = lifetime; } void -IeDot11sPreq::SetDestCount (uint8_t dest_count) +IePreq::SetDestCount (uint8_t dest_count) { m_destCount = dest_count; } //uint8_t -//IeDot11sPreq::GetFlags () const +//IePreq::GetFlags () const //{ // return m_flags; //} bool -IeDot11sPreq::IsUnicastPreq () const +IePreq::IsUnicastPreq () const { return (m_flags & (1<<1)); } bool -IeDot11sPreq::IsNeedNotPrep () const +IePreq::IsNeedNotPrep () const { return (m_flags & (1<<2)); } uint8_t -IeDot11sPreq::GetHopCount () const +IePreq::GetHopCount () const { return m_hopCount; } uint8_t -IeDot11sPreq::GetTtl () const +IePreq::GetTtl () const { return m_ttl; } uint32_t -IeDot11sPreq::GetPreqID () const +IePreq::GetPreqID () const { return m_preqId; } uint32_t -IeDot11sPreq::GetMetric () const +IePreq::GetMetric () const { return m_metric; } Mac48Address -IeDot11sPreq::GetOriginatorAddress () const +IePreq::GetOriginatorAddress () const { return m_originatorAddress; } uint32_t -IeDot11sPreq::GetOriginatorSeqNumber () const +IePreq::GetOriginatorSeqNumber () const { return m_originatorSeqNumber; } uint32_t -IeDot11sPreq::GetLifetime () const +IePreq::GetLifetime () const { return m_lifetime; } uint8_t -IeDot11sPreq::GetDestCount () const +IePreq::GetDestCount () const { return m_destCount; } void -IeDot11sPreq::DecrementTtl () +IePreq::DecrementTtl () { m_ttl --; m_hopCount ++; } void -IeDot11sPreq::IncrementMetric (uint32_t metric) +IePreq::IncrementMetric (uint32_t metric) { m_metric +=metric; } void -IeDot11sPreq::SerializeInformation (Buffer::Iterator i) const +IePreq::SerializeInformation (Buffer::Iterator i) const { i.WriteU8 (m_flags); i.WriteU8 (m_hopCount); @@ -278,7 +278,7 @@ IeDot11sPreq::SerializeInformation (Buffer::Iterator i) const } uint8_t -IeDot11sPreq::DeserializeInformation (Buffer::Iterator start, uint8_t length) +IePreq::DeserializeInformation (Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; m_flags = i.ReadU8 (); @@ -314,7 +314,7 @@ IeDot11sPreq::DeserializeInformation (Buffer::Iterator start, uint8_t length) return i.GetDistanceFrom (start); } uint8_t -IeDot11sPreq::GetInformationSize () const +IePreq::GetInformationSize () const { uint8_t retval = 1 //Flags @@ -334,17 +334,17 @@ IeDot11sPreq::GetInformationSize () const } void -IeDot11sPreq::PrintInformation (std::ostream& os) const +IePreq::PrintInformation (std::ostream& os) const { //TODO } std::vector > -IeDot11sPreq::GetDestinationList () +IePreq::GetDestinationList () { return m_destinations; } void -IeDot11sPreq::AddDestinationAddressElement ( +IePreq::AddDestinationAddressElement ( bool doFlag, bool rfFlag, Mac48Address dest_address, uint32_t dest_seq_number @@ -362,7 +362,7 @@ IeDot11sPreq::AddDestinationAddressElement ( } void -IeDot11sPreq::DelDestinationAddressElement (Mac48Address dest_address) +IePreq::DelDestinationAddressElement (Mac48Address dest_address) { for (std::vector >::iterator i = m_destinations.begin (); i != m_destinations.end(); i++) if ((*i)->GetDestinationAddress () == dest_address) @@ -374,7 +374,7 @@ IeDot11sPreq::DelDestinationAddressElement (Mac48Address dest_address) } void -IeDot11sPreq::ClearDestinationAddressElement () +IePreq::ClearDestinationAddressElement () { int i; for (std::vector >::iterator j = m_destinations.begin (); j != m_destinations.end(); j++) diff --git a/src/devices/mesh/dot11s/ie-dot11s-preq.h b/src/devices/mesh/dot11s/ie-dot11s-preq.h index 39f407264..de21038d2 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-preq.h +++ b/src/devices/mesh/dot11s/ie-dot11s-preq.h @@ -57,11 +57,11 @@ private: * \ingroup dot11s * \brief See 7.3.2.96 of 802.11s draft 2.07 */ -class IeDot11sPreq : public WifiInformationElement +class IePreq : public WifiInformationElement { public: - IeDot11sPreq (); - ~IeDot11sPreq (); + IePreq (); + ~IePreq (); static TypeId GetTypeId (); virtual TypeId GetInstanceTypeId () const; virtual void Print (std::ostream &os) const; diff --git a/src/devices/mesh/dot11s/ie-dot11s-rann.cc b/src/devices/mesh/dot11s/ie-dot11s-rann.cc index 714f83121..174f0c21b 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-rann.cc +++ b/src/devices/mesh/dot11s/ie-dot11s-rann.cc @@ -27,26 +27,26 @@ namespace ns3 { namespace dot11s { -IeDot11sRann::~IeDot11sRann () +IeRann::~IeRann () { } TypeId -IeDot11sRann::GetTypeId () +IeRann::GetTypeId () { - static TypeId tid = TypeId ("ns3::IeDot11sRann").SetParent (); + static TypeId tid = TypeId ("ns3::IeRann").SetParent (); return tid; } TypeId -IeDot11sRann::GetInstanceTypeId () const +IeRann::GetInstanceTypeId () const { return GetTypeId (); } void -IeDot11sRann::Print (std::ostream &os)const +IeRann::Print (std::ostream &os)const { // FILL } -IeDot11sRann::IeDot11sRann (): +IeRann::IeRann (): m_flags (0), m_hopcount (0), m_ttl (0), @@ -56,68 +56,68 @@ IeDot11sRann::IeDot11sRann (): { } void -IeDot11sRann::SetFlags (uint8_t flags) +IeRann::SetFlags (uint8_t flags) { m_flags = flags; } void -IeDot11sRann::SetHopcount (uint8_t hopcount) +IeRann::SetHopcount (uint8_t hopcount) { m_hopcount = hopcount; } void -IeDot11sRann::SetTTL (uint8_t ttl) +IeRann::SetTTL (uint8_t ttl) { m_ttl = ttl; } void -IeDot11sRann::SetDestSeqNumber (uint32_t dest_seq_number) +IeRann::SetDestSeqNumber (uint32_t dest_seq_number) { m_destSeqNumber = dest_seq_number; } void -IeDot11sRann::SetMetric (uint32_t metric) +IeRann::SetMetric (uint32_t metric) { m_metric = metric; } void -IeDot11sRann::SetOriginatorAddress (Mac48Address originator_address) +IeRann::SetOriginatorAddress (Mac48Address originator_address) { m_originatorAddress = originator_address; } uint8_t -IeDot11sRann::GetFlags () +IeRann::GetFlags () { return m_flags; } uint8_t -IeDot11sRann::GetHopcount () +IeRann::GetHopcount () { return m_hopcount; } uint8_t -IeDot11sRann::GetTTL () +IeRann::GetTTL () { return m_ttl; } uint32_t -IeDot11sRann::GetDestSeqNumber () +IeRann::GetDestSeqNumber () { return m_destSeqNumber; } uint32_t -IeDot11sRann::GetMetric () +IeRann::GetMetric () { return m_metric; } Mac48Address -IeDot11sRann::GetOriginatorAddress () +IeRann::GetOriginatorAddress () { return m_originatorAddress; } void -IeDot11sRann::SerializeInformation (Buffer::Iterator i) const +IeRann::SerializeInformation (Buffer::Iterator i) const { i.WriteU8 (m_flags); i.WriteU8 (m_hopcount); @@ -127,7 +127,7 @@ IeDot11sRann::SerializeInformation (Buffer::Iterator i) const i.WriteHtonU32 (m_metric); } uint8_t -IeDot11sRann::DeserializeInformation (Buffer::Iterator start, uint8_t length) +IeRann::DeserializeInformation (Buffer::Iterator start, uint8_t length) { Buffer::Iterator i = start; m_flags = i.ReadU8 (); @@ -139,7 +139,7 @@ IeDot11sRann::DeserializeInformation (Buffer::Iterator start, uint8_t length) return i.GetDistanceFrom (start); } uint8_t -IeDot11sRann::GetInformationSize () const +IeRann::GetInformationSize () const { uint8_t retval = 1 //Flags diff --git a/src/devices/mesh/dot11s/ie-dot11s-rann.h b/src/devices/mesh/dot11s/ie-dot11s-rann.h index b3817462a..cbdd06a08 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-rann.h +++ b/src/devices/mesh/dot11s/ie-dot11s-rann.h @@ -32,11 +32,11 @@ namespace dot11s { * \ingroup dot11s * \brief See 7.3.2.95 of 802.11s draft 2.07 */ -class IeDot11sRann +class IeRann { public: - IeDot11sRann (); - virtual ~IeDot11sRann (); + IeRann (); + virtual ~IeRann (); static TypeId GetTypeId (); virtual TypeId GetInstanceTypeId () const; virtual void Print (std::ostream &os) const; diff --git a/src/devices/mesh/dot11s/peer-link-frame.cc b/src/devices/mesh/dot11s/peer-link-frame.cc index 8818318fe..ac263ad49 100644 --- a/src/devices/mesh/dot11s/peer-link-frame.cc +++ b/src/devices/mesh/dot11s/peer-link-frame.cc @@ -26,7 +26,7 @@ NS_OBJECT_ENSURE_REGISTERED (PeerLinkFrameStart); PeerLinkFrameStart::PeerLinkFrameStart () { - m_fields.subtype = IeDot11sPeerManagement::PEER_OPEN; + m_fields.subtype = IePeerManagement::PEER_OPEN; m_fields.aid = 0; m_fields.rates = SupportedRates(); m_fields.meshId = Ssid(); @@ -80,9 +80,9 @@ uint32_t PeerLinkFrameStart::GetSerializedSize () const { uint32_t size = 1; //Subtype - if (IeDot11sPeerManagement::PEER_CONFIRM == m_fields.subtype) + if (IePeerManagement::PEER_CONFIRM == m_fields.subtype) size += 2; //AID of remote peer - if (IeDot11sPeerManagement::PEER_CLOSE != m_fields.subtype) + if (IePeerManagement::PEER_CLOSE != m_fields.subtype) { size += m_fields.rates.GetSerializedSize (); size += 2; @@ -96,9 +96,9 @@ PeerLinkFrameStart::Serialize (Buffer::Iterator start) const { Buffer::Iterator i = start; i.WriteU8 (m_fields.subtype); //Like a Category in Standart - if (IeDot11sPeerManagement::PEER_CONFIRM == m_fields.subtype) + if (IePeerManagement::PEER_CONFIRM == m_fields.subtype) i.WriteHtonU16 (m_fields.aid); - if (IeDot11sPeerManagement::PEER_CLOSE != m_fields.subtype) + if (IePeerManagement::PEER_CLOSE != m_fields.subtype) { i = m_fields.rates.Serialize (i); i.Next(2); //QoS @@ -110,10 +110,10 @@ uint32_t PeerLinkFrameStart::Deserialize (Buffer::Iterator start) { Buffer::Iterator i = start; - m_fields.subtype = (IeDot11sPeerManagement::Subtype)i.ReadU8 (); - if (IeDot11sPeerManagement::PEER_CONFIRM == m_fields.subtype) + m_fields.subtype = (IePeerManagement::Subtype)i.ReadU8 (); + if (IePeerManagement::PEER_CONFIRM == m_fields.subtype) m_fields.aid = i.ReadNtohU16 (); - if (IeDot11sPeerManagement::PEER_CLOSE != m_fields.subtype) + if (IePeerManagement::PEER_CLOSE != m_fields.subtype) { i = m_fields.rates.Deserialize (i); i.Next(2); //QoS diff --git a/src/devices/mesh/dot11s/peer-link.cc b/src/devices/mesh/dot11s/peer-link.cc index e15c1ae97..0d38699c8 100644 --- a/src/devices/mesh/dot11s/peer-link.cc +++ b/src/devices/mesh/dot11s/peer-link.cc @@ -123,7 +123,7 @@ PeerLink::BeaconLoss () } void -PeerLink::SetBeaconTimingElement (IeDot11sBeaconTiming beaconTiming) +PeerLink::SetBeaconTimingElement (IeBeaconTiming beaconTiming) { m_beaconTiming = beaconTiming; } @@ -152,7 +152,7 @@ PeerLink::GetBeaconInterval () const return m_beaconInterval; } -IeDot11sBeaconTiming +IeBeaconTiming PeerLink::GetBeaconTimingElement () const { return m_beaconTiming; @@ -195,7 +195,7 @@ void PeerLink::Close (uint16_t localLinkId, uint16_t peerLinkId, dot11sReasonCod StateMachine (CLS_ACPT, reason); } -void PeerLink::OpenAccept (uint16_t localLinkId, IeDot11sConfiguration conf) +void PeerLink::OpenAccept (uint16_t localLinkId, IeConfiguration conf) { if (m_peerLinkId == 0) m_peerLinkId = localLinkId; @@ -203,7 +203,7 @@ void PeerLink::OpenAccept (uint16_t localLinkId, IeDot11sConfiguration conf) StateMachine (OPN_ACPT); } -void PeerLink::OpenReject (uint16_t localLinkId, IeDot11sConfiguration conf,dot11sReasonCode reason) +void PeerLink::OpenReject (uint16_t localLinkId, IeConfiguration conf,dot11sReasonCode reason) { if ( m_peerLinkId == 0) m_peerLinkId = localLinkId; @@ -212,7 +212,7 @@ void PeerLink::OpenReject (uint16_t localLinkId, IeDot11sConfiguration conf,dot } void -PeerLink::ConfirmAccept (uint16_t localLinkId, uint16_t peerLinkId, uint16_t peerAid, IeDot11sConfiguration conf) +PeerLink::ConfirmAccept (uint16_t localLinkId, uint16_t peerLinkId, uint16_t peerAid, IeConfiguration conf) { if ( m_localLinkId != peerLinkId) return; @@ -227,7 +227,7 @@ PeerLink::ConfirmAccept (uint16_t localLinkId, uint16_t peerLinkId, uint16_t pee void PeerLink::ConfirmReject (uint16_t localLinkId, uint16_t peerLinkId, - IeDot11sConfiguration conf,dot11sReasonCode reason) + IeConfiguration conf,dot11sReasonCode reason) { if (m_localLinkId != peerLinkId) return; @@ -507,14 +507,14 @@ void PeerLink::ClearHoldingTimer () void PeerLink::SendPeerLinkClose (dot11sReasonCode reasoncode) { - IeDot11sPeerManagement peerElement; + IePeerManagement peerElement; peerElement.SetPeerClose (m_localLinkId, m_peerLinkId, reasoncode); m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_assocId, peerElement, m_configuration); } void PeerLink::SendPeerLinkOpen () { - IeDot11sPeerManagement peerElement; + IePeerManagement peerElement; peerElement.SetPeerOpen (m_localLinkId); NS_ASSERT (m_macPlugin != NULL); m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_assocId, peerElement, m_configuration); @@ -522,7 +522,7 @@ void PeerLink::SendPeerLinkOpen () void PeerLink::SendPeerLinkConfirm () { - IeDot11sPeerManagement peerElement; + IePeerManagement peerElement; peerElement.SetPeerConfirm (m_localLinkId, m_peerLinkId); m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_assocId, peerElement, m_configuration); } diff --git a/src/devices/mesh/dot11s/peer-link.h b/src/devices/mesh/dot11s/peer-link.h index 85ef44422..affdd8dab 100644 --- a/src/devices/mesh/dot11s/peer-link.h +++ b/src/devices/mesh/dot11s/peer-link.h @@ -39,6 +39,7 @@ namespace dot11s { class PeerLink : public Object { public: + friend class PeerManagerProtocol; /// Support object system static TypeId GetTypeId(); /// C-tor create empty link @@ -62,14 +63,14 @@ public: void SetPeerLinkId (uint16_t id); void SetLocalAid (uint16_t aid); void SetPeerAid (uint16_t aid); - void SetBeaconTimingElement (IeDot11sBeaconTiming beaconTiming); - void SetPeerLinkDescriptorElement (IeDot11sPeerManagement peerLinkElement); + void SetBeaconTimingElement (IeBeaconTiming beaconTiming); + void SetPeerLinkDescriptorElement (IePeerManagement peerLinkElement); Mac48Address GetPeerAddress () const; uint16_t GetLocalAid () const; Time GetLastBeacon () const; Time GetBeaconInterval () const; - IeDot11sBeaconTiming GetBeaconTimingElement ()const; - IeDot11sPeerManagement GetPeerLinkDescriptorElement ()const; + IeBeaconTiming GetBeaconTimingElement ()const; + IePeerManagement GetPeerLinkDescriptorElement ()const; void ClearTimingElement (); //\} @@ -90,7 +91,7 @@ public: /// Set callback void MLMESetSignalStatusCallback (SignalStatusCallback); //\} - +private: /** * \name Link response to received management frames * @@ -104,21 +105,21 @@ public: /// Close link void Close (uint16_t localLinkID, uint16_t peerLinkID, dot11sReasonCode reason); /// Accept open link - void OpenAccept (uint16_t localLinkId, IeDot11sConfiguration conf); + void OpenAccept (uint16_t localLinkId, IeConfiguration conf); /// Reject open link - void OpenReject (uint16_t localLinkId, IeDot11sConfiguration conf, dot11sReasonCode reason); + void OpenReject (uint16_t localLinkId, IeConfiguration conf, dot11sReasonCode reason); /// Confirm accept void ConfirmAccept ( uint16_t localLinkId, uint16_t peerLinkId, uint16_t peerAid, - IeDot11sConfiguration conf + IeConfiguration conf ); /// Confirm reject void ConfirmReject ( uint16_t localLinkId, uint16_t peerLinkId, - IeDot11sConfiguration conf, + IeConfiguration conf, dot11sReasonCode reason ); //\} @@ -219,11 +220,11 @@ private: /// Current state PeerState m_state; /// Mesh interface configuration - IeDot11sConfiguration m_configuration; + IeConfiguration m_configuration; // State is a bitfield as defined as follows: // This are states for a given - IeDot11sBeaconTiming m_beaconTiming; + IeBeaconTiming m_beaconTiming; /** * \name Timers & counters used for internal state transitions diff --git a/src/devices/mesh/dot11s/peer-manager-plugin.cc b/src/devices/mesh/dot11s/peer-manager-plugin.cc index b6a8c31ff..da2cee9ef 100644 --- a/src/devices/mesh/dot11s/peer-manager-plugin.cc +++ b/src/devices/mesh/dot11s/peer-manager-plugin.cc @@ -54,7 +54,7 @@ PeerManagerMacPlugin::Receive (Ptr const_packet, const WifiMacHeader & h Ptr packet = const_packet->Copy(); if(header.IsBeacon()) { - IeDot11sBeaconTiming beaconTiming; + IeBeaconTiming beaconTiming; Ptr myBeacon = packet->Copy(); MgtBeaconHeader beacon_hdr; myBeacon->RemoveHeader(beacon_hdr); @@ -64,7 +64,7 @@ PeerManagerMacPlugin::Receive (Ptr const_packet, const WifiMacHeader & h NS_LOG_DEBUG("Beacon timing:"<ReceiveBeacon( + m_protocol->UpdatePeerBeaconTiming( m_ifIndex, meshBeacon, beaconTiming, @@ -107,22 +107,22 @@ PeerManagerMacPlugin::Receive (Ptr const_packet, const WifiMacHeader & h } } //link management element: - IeDot11sConfiguration meshConfig; - if(fields.subtype != IeDot11sPeerManagement::PEER_CLOSE) + IeConfiguration meshConfig; + if(fields.subtype != IePeerManagement::PEER_CLOSE) packet->RemoveHeader(meshConfig); - IeDot11sPeerManagement peerElement; + IePeerManagement peerElement; packet->RemoveHeader(peerElement); switch (actionValue.peerLink) { case WifiMeshMultihopActionHeader::PEER_LINK_CONFIRM: - NS_ASSERT(fields.subtype == IeDot11sPeerManagement::PEER_CONFIRM); + NS_ASSERT(fields.subtype == IePeerManagement::PEER_CONFIRM); break; case WifiMeshMultihopActionHeader::PEER_LINK_OPEN: - NS_ASSERT(fields.subtype == IeDot11sPeerManagement::PEER_OPEN); + NS_ASSERT(fields.subtype == IePeerManagement::PEER_OPEN); break; case WifiMeshMultihopActionHeader::PEER_LINK_CLOSE: - NS_ASSERT(fields.subtype == IeDot11sPeerManagement::PEER_CLOSE); + NS_ASSERT(fields.subtype == IePeerManagement::PEER_CLOSE); break; default: return false; @@ -142,19 +142,15 @@ PeerManagerMacPlugin::UpdateOutcomingFrame (Ptr packet, WifiMacHeader & void PeerManagerMacPlugin::UpdateBeacon (MeshWifiBeacon & beacon) const { - Ptr beaconTiming = - m_protocol->SendBeacon( - m_ifIndex, - Simulator::Now(), - MicroSeconds(beacon.BeaconHeader().GetBeaconIntervalUs())); + Ptr beaconTiming = m_protocol->GetBeaconTimingElement(m_ifIndex); beacon.AddInformationElement(beaconTiming); } void PeerManagerMacPlugin::SendPeerLinkManagementFrame( Mac48Address peerAddress, uint16_t aid, - IeDot11sPeerManagement peerElement, - IeDot11sConfiguration meshConfig + IePeerManagement peerElement, + IeConfiguration meshConfig ) { //Create a packet: diff --git a/src/devices/mesh/dot11s/peer-manager-plugin.h b/src/devices/mesh/dot11s/peer-manager-plugin.h index 96bc74ea9..91ac68841 100644 --- a/src/devices/mesh/dot11s/peer-manager-plugin.h +++ b/src/devices/mesh/dot11s/peer-manager-plugin.h @@ -27,8 +27,8 @@ namespace ns3 { class MeshWifiInterfaceMac; namespace dot11s { -class IeDot11sConfiguration; -class IeDot11sPeerManagement; +class IeConfiguration; +class IePeerManagement; class PeerManagerProtocol; /** * \ingroup dot11s @@ -51,12 +51,15 @@ public: bool UpdateOutcomingFrame (Ptr packet, WifiMacHeader & header, Mac48Address from, Mac48Address to) const; void UpdateBeacon (MeshWifiBeacon & beacon) const; ///\} +private: + friend class PeerManagerProtocol; + friend class PeerLink; void SetPeerManagerProtcol(Ptr protocol); void SendPeerLinkManagementFrame( Mac48Address peerAddress, uint16_t aid, - IeDot11sPeerManagement peerElement, - IeDot11sConfiguration meshConfig + IePeerManagement peerElement, + IeConfiguration meshConfig ); ///\brief DUBUG only - to print established links Mac48Address GetAddress () const; diff --git a/src/devices/mesh/dot11s/peer-manager-protocol.cc b/src/devices/mesh/dot11s/peer-manager-protocol.cc index 62c011fa2..9ad59f885 100644 --- a/src/devices/mesh/dot11s/peer-manager-protocol.cc +++ b/src/devices/mesh/dot11s/peer-manager-protocol.cc @@ -45,32 +45,25 @@ TypeId PeerManagerProtocol::GetTypeId (void) { static TypeId tid = TypeId ("ns3::PeerManagerProtocol") - .SetParent () - .AddConstructor () - //peerLinkCleanupTimeout. This constant is not specified in Draft 2.0 - .AddAttribute ("PeerLinkCleanupPeriod", - "PeerLinkCleanupPeriod", - TimeValue (MilliSeconds (80)), - MakeTimeAccessor (&PeerManagerProtocol::m_peerLinkCleanupPeriod), - MakeTimeChecker () - ) - //MaxBeaconLost. This constant is not specified in Draft 2.0 -#if 0 - .AddAttribute ("MaxBeaconLost", "Max Beacon Lost", - UintegerValue (3), - MakeUintegerAccessor (&PeerManagerProtocol::m_maxBeaconLoss), - MakeUintegerChecker () - ) -#endif - //maximum number of peer links. - .AddAttribute ("MaxNumberOfPeerLinks", - "Maximum number of peer links ", - UintegerValue (32), - MakeUintegerAccessor (&PeerManagerProtocol::m_maxNumberOfPeerLinks), - MakeUintegerChecker () - ); + .SetParent () + .AddConstructor () + /// peerLinkCleanupTimeout. We go through the map of peer links and + /// remove all links which state is IDLE. + .AddAttribute ("PeerLinkCleanupPeriod", + "PeerLinkCleanupPeriod", + TimeValue (MilliSeconds (80)), + MakeTimeAccessor (&PeerManagerProtocol::m_peerLinkCleanupPeriod), + MakeTimeChecker () + ) + /// maximum number of peer links. Now we calculate the total + /// number of peer links on all interfaces + .AddAttribute ("MaxNumberOfPeerLinks", + "Maximum number of peer links ", + UintegerValue (32), + MakeUintegerAccessor (&PeerManagerProtocol::m_maxNumberOfPeerLinks), + MakeUintegerChecker () + ); return tid; - } PeerManagerProtocol::PeerManagerProtocol (): m_lastAssocId (0), @@ -103,7 +96,7 @@ PeerManagerProtocol::~PeerManagerProtocol () } bool -PeerManagerProtocol::AttachPorts(std::vector > interfaces) +PeerManagerProtocol::AttachInterfaces(std::vector > interfaces) { for(std::vector >::iterator i = interfaces.begin(); i != interfaces.end(); i ++) { @@ -119,10 +112,10 @@ PeerManagerProtocol::AttachPorts(std::vector > interfaces) return true; } -Ptr -PeerManagerProtocol::SendBeacon(uint32_t interface, Time currentTbtt, Time beaconInterval) +Ptr +PeerManagerProtocol::GetBeaconTimingElement(uint32_t interface) { - Ptr retval = Create (); + Ptr retval = Create (); BeaconInfoMap::iterator i = m_neighbourBeacons.find(interface); if(i == m_neighbourBeacons.end()) return retval; @@ -169,10 +162,10 @@ PeerManagerProtocol::FillBeaconInfo(uint32_t interface, Mac48Address peerAddress } void -PeerManagerProtocol::ReceiveBeacon( +PeerManagerProtocol::UpdatePeerBeaconTiming( uint32_t interface, bool meshBeacon, - IeDot11sBeaconTiming timingElement, + IeBeaconTiming timingElement, Mac48Address peerAddress, Time receivingTime, Time beaconInterval) @@ -206,8 +199,8 @@ PeerManagerProtocol::ReceivePeerLinkFrame ( uint32_t interface, Mac48Address peerAddress, uint16_t aid, - IeDot11sPeerManagement peerManagementElement, - IeDot11sConfiguration meshConfig + IePeerManagement peerManagementElement, + IeConfiguration meshConfig ) { if (peerManagementElement.SubtypeIsOpen ()) @@ -400,10 +393,10 @@ PeerManagerProtocol::GetNextBeaconShift ( NS_ASSERT (myBeacon != m_myBeaconInfo.end()); for (PeerLinksOnInterface::iterator i = interface->second.begin (); i != interface->second.end(); i++) { - IeDot11sBeaconTiming::NeighboursTimingUnitsList neighbours; + IeBeaconTiming::NeighboursTimingUnitsList neighbours; neighbours = (*i)->GetBeaconTimingElement ().GetNeighboursTimingElementsList(); //first let's form the list of all kown TBTTs - for (IeDot11sBeaconTiming::NeighboursTimingUnitsList::const_iterator j = neighbours.begin (); j != neighbours.end(); j++) + for (IeBeaconTiming::NeighboursTimingUnitsList::const_iterator j = neighbours.begin (); j != neighbours.end(); j++) { uint16_t beaconIntervalTimeUnits; beaconIntervalTimeUnits = (*j)->GetBeaconInterval (); @@ -471,9 +464,15 @@ PeerManagerProtocol::PeerLinkStatus (uint32_t interface, Mac48Address peerAddres NS_ASSERT(plugin != m_plugins.end()); NS_LOG_UNCOND("LINK between me:"<second->GetAddress() <<" and peer:"< >); + bool AttachInterfaces(std::vector >); /** \brief Methods that handle beacon sending/receiving procedure. * This methods interact with MAC_layer plug-in * \{ */ /** - * \brief When we are sending a beacon - we add a timing element to - * it and remember the time, when we sent a beacon (for BCA) - * \param IeDot11sBeaconTiming is a beacon timing element that + * \brief When we are sending a beacon - we fill beacon timing + * element + * \param IeBeaconTiming is a beacon timing element that * should be present in beacon * \param interface is a interface sending a beacon - * \param currentTbtt is a time of beacon sending - * \param beaconInterval is a beacon interval on this interface */ - Ptr SendBeacon(uint32_t interface, Time currentTbtt, Time beaconInterval); + Ptr GetBeaconTimingElement(uint32_t interface); /** * \brief When we receive a beacon from peer-station, we remember * its beacon timing element (needed for peer choosing mechanism), @@ -68,10 +66,10 @@ public: * \param interface is a interface on which beacon was received * \param timingElement is a timing element of remote beacon */ - void ReceiveBeacon( + void UpdatePeerBeaconTiming( uint32_t interface, bool meshBeacon, - IeDot11sBeaconTiming timingElement, + IeBeaconTiming timingElement, Mac48Address peerAddress, Time receivingTime, Time beaconInterval @@ -93,16 +91,16 @@ public: * \param Mac48Address is address of peer * \param uint16_t is association ID, which peer has assigned to * us - * \param IeDot11sConfiguration is mesh configuration element + * \param IeConfiguration is mesh configuration element * taken from the peer management frame - * \param IeDot11sPeerManagement is peer link management element + * \param IePeerManagement is peer link management element */ void ReceivePeerLinkFrame( uint32_t interface, Mac48Address peerAddress, uint16_t aid, - IeDot11sPeerManagement peerManagementElement, - IeDot11sConfiguration meshConfig + IePeerManagement peerManagementElement, + IeConfiguration meshConfig ); /** * Cancell peer link due to broken configuration (SSID or Supported @@ -117,23 +115,29 @@ public: * \} */ private: - /** - * All private structures: - * * peer link descriptors; - * * information about received beacons - * * pointers to proper plugins - * \{ - */ + ///\name Private structures + ///\{ + ///\brief keeps information about beacon of peer station: + /// beacon interval, association ID, last time we have received a + /// beacon struct BeaconInfo { uint16_t aid; //Assoc ID Time referenceTbtt; //When one of my station's beacons was put into a beacon queue; Time beaconInterval; //Beacon interval of my station; }; + /// We keep a vector of pointers to PeerLink class. This vector + /// keeps all peer links at a given interface. typedef std::vector > PeerLinksOnInterface; + /// This map keeps all peer links. + ///\param uint32_t is interface ID typedef std::map PeerLinksMap; + ///\brief This map keeps relationship between peer address and its + /// beacon information typedef std::map BeaconsOnInterface; + ///\brief This map keeps beacon information on all intefaces typedef std::map BeaconInfoMap; + ///\brief this vector keeps pointers to MAC-plugins typedef std::map > PeerManagerPluginMap; ///\} private: diff --git a/src/devices/mesh/mesh-wifi-interface-mac.cc b/src/devices/mesh/mesh-wifi-interface-mac.cc index 0902781e6..83acfa747 100644 --- a/src/devices/mesh/mesh-wifi-interface-mac.cc +++ b/src/devices/mesh/mesh-wifi-interface-mac.cc @@ -533,5 +533,3 @@ MeshWifiInterfaceMac::Receive (Ptr packet, WifiMacHeader const *hdr) } // namespace ns3 - -