From 38e5fe4ec9d51f2f8f5524ee60ef5fbbfbb82463 Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Thu, 27 Aug 2009 13:38:13 +0400 Subject: [PATCH] Installers moved to src/helper --- src/devices/mesh/dot11s/peer-link.cc | 32 +++++++++++++------ src/devices/mesh/dot11s/peer-link.h | 16 ++++++---- .../mesh/dot11s/peer-management-protocol.cc | 3 +- src/devices/mesh/dot11s/wscript | 5 +-- src/devices/mesh/flame/flame-protocol.cc | 2 ++ src/devices/mesh/flame/flame-protocol.h | 7 ++-- src/devices/mesh/flame/wscript | 1 - src/devices/mesh/wscript | 1 - .../dot11s => helper}/dot11s-installer.cc | 6 ++-- .../mesh/dot11s => helper}/dot11s-installer.h | 0 .../mesh/flame => helper}/flame-installer.cc | 4 +-- .../mesh/flame => helper}/flame-installer.h | 0 .../mesh => helper}/mesh-stack-installer.h | 8 +++-- src/helper/wscript | 5 +++ 14 files changed, 59 insertions(+), 31 deletions(-) rename src/{devices/mesh/dot11s => helper}/dot11s-installer.cc (97%) rename src/{devices/mesh/dot11s => helper}/dot11s-installer.h (100%) rename src/{devices/mesh/flame => helper}/flame-installer.cc (96%) rename src/{devices/mesh/flame => helper}/flame-installer.h (100%) rename src/{devices/mesh => helper}/mesh-stack-installer.h (80%) diff --git a/src/devices/mesh/dot11s/peer-link.cc b/src/devices/mesh/dot11s/peer-link.cc index ba73762e9..eee491ee7 100644 --- a/src/devices/mesh/dot11s/peer-link.cc +++ b/src/devices/mesh/dot11s/peer-link.cc @@ -20,7 +20,9 @@ * Pavel Boyko */ -#include "peer-link.h" +#include "ns3/peer-link.h" +#include "ie-dot11s-configuration.h" +#include "peer-management-protocol-mac.h" #include "ns3/log.h" #include "ns3/simulator.h" #include "ns3/traced-value.h" @@ -89,8 +91,15 @@ PeerLink::GetTypeId () // PeerLink public interface //----------------------------------------------------------------------------- PeerLink::PeerLink () : - m_peerAddress (Mac48Address::GetBroadcast ()), m_peerMeshPointAddress (Mac48Address::GetBroadcast ()), - m_localLinkId (0), m_peerLinkId (0), m_packetFail (0), m_state (IDLE), m_retryCounter (0), m_maxPacketFail (3) + m_peerAddress (Mac48Address::GetBroadcast ()), + m_peerMeshPointAddress (Mac48Address::GetBroadcast ()), + m_localLinkId (0), + m_peerLinkId (0), + m_packetFail (0), + m_state (IDLE), + m_configuration (Create ()), + m_retryCounter (0), + m_maxPacketFail (3) { } PeerLink::~PeerLink () @@ -238,7 +247,7 @@ PeerLink::OpenAccept (uint16_t localLinkId, IeConfiguration conf, Mac48Address p { m_peerLinkId = localLinkId; } - m_configuration = conf; + m_configuration = Ptr (&conf); if (m_peerMeshPointAddress != Mac48Address::GetBroadcast ()) { NS_ASSERT (m_peerMeshPointAddress == peerMp); @@ -256,7 +265,7 @@ PeerLink::OpenReject (uint16_t localLinkId, IeConfiguration conf, Mac48Address p { m_peerLinkId = localLinkId; } - m_configuration = conf; + m_configuration = Ptr (&conf); if (m_peerMeshPointAddress != Mac48Address::GetBroadcast ()) { NS_ASSERT (m_peerMeshPointAddress == peerMp); @@ -286,7 +295,7 @@ PeerLink::ConfirmAccept (uint16_t localLinkId, uint16_t peerLinkId, uint16_t pee return; } } - m_configuration = conf; + m_configuration = Ptr (&conf); m_peerAssocId = peerAid; if (m_peerMeshPointAddress != Mac48Address::GetBroadcast ()) { @@ -317,7 +326,7 @@ PeerLink::ConfirmReject (uint16_t localLinkId, uint16_t peerLinkId, IeConfigurat return; } } - m_configuration = conf; + m_configuration = Ptr (&conf); if (m_peerMeshPointAddress != Mac48Address::GetBroadcast ()) { NS_ASSERT (m_peerMeshPointAddress == peerMp); @@ -607,27 +616,30 @@ PeerLink::ClearHoldingTimer () void PeerLink::SendPeerLinkClose (PmpReasonCode reasoncode) { + NS_ASSERT (m_configuration != 0); IePeerManagement peerElement; peerElement.SetPeerClose (m_localLinkId, m_peerLinkId, reasoncode); m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_peerMeshPointAddress, m_assocId, peerElement, - m_configuration); + *m_configuration); } void PeerLink::SendPeerLinkOpen () { + NS_ASSERT (m_configuration != 0); IePeerManagement peerElement; peerElement.SetPeerOpen (m_localLinkId); NS_ASSERT (m_macPlugin != 0); m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_peerMeshPointAddress, m_assocId, peerElement, - m_configuration); + *m_configuration); } void PeerLink::SendPeerLinkConfirm () { + NS_ASSERT (m_configuration != 0); IePeerManagement peerElement; peerElement.SetPeerConfirm (m_localLinkId, m_peerLinkId); m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_peerMeshPointAddress, m_assocId, peerElement, - m_configuration); + *m_configuration); } void PeerLink::SetHoldingTimer () diff --git a/src/devices/mesh/dot11s/peer-link.h b/src/devices/mesh/dot11s/peer-link.h index 8cc35b83d..d17fcd68e 100644 --- a/src/devices/mesh/dot11s/peer-link.h +++ b/src/devices/mesh/dot11s/peer-link.h @@ -23,15 +23,16 @@ #define PEERLLINK_H_ #include "ns3/nstime.h" +#include "ns3/object.h" #include "ns3/callback.h" #include "ns3/mac48-address.h" #include "ns3/event-id.h" -#include "ie-dot11s-beacon-timing.h" -#include "ie-dot11s-peer-management.h" -#include "ie-dot11s-configuration.h" -#include "peer-management-protocol-mac.h" +#include "ns3/ie-dot11s-beacon-timing.h" +#include "ns3/ie-dot11s-peer-management.h" namespace ns3 { namespace dot11s { +class IeConfiguration; +class PeerManagementProtocolMac; /** * \ingroup dot11s * @@ -229,8 +230,11 @@ private: /// Current state PeerState m_state; - /// Mesh interface configuration - IeConfiguration m_configuration; + /** + * \brief Mesh interface configuration + * \attention Is not used now, nothing to configure :) + */ + Ptr m_configuration; /// Beacon timing element received from the peer. Needed by BCA IeBeaconTiming m_beaconTiming; diff --git a/src/devices/mesh/dot11s/peer-management-protocol.cc b/src/devices/mesh/dot11s/peer-management-protocol.cc index a771ea0cd..92e01a1fd 100644 --- a/src/devices/mesh/dot11s/peer-management-protocol.cc +++ b/src/devices/mesh/dot11s/peer-management-protocol.cc @@ -19,7 +19,8 @@ * Aleksey Kovalenko */ -#include "peer-management-protocol.h" +#include "ns3/peer-management-protocol.h" +#include "peer-management-protocol-mac.h" #include "ie-dot11s-configuration.h" #include "ie-dot11s-id.h" #include "ns3/mesh-point-device.h" diff --git a/src/devices/mesh/dot11s/wscript b/src/devices/mesh/dot11s/wscript index a7b910381..e87c3e58a 100644 --- a/src/devices/mesh/dot11s/wscript +++ b/src/devices/mesh/dot11s/wscript @@ -23,12 +23,13 @@ def build(bld): 'hwmp-protocol-mac.cc', 'hwmp-protocol.cc', 'airtime-metric.cc', - 'dot11s-installer.cc', ] headers = bld.new_task_gen('ns3header') headers.module = 'dot11s' headers.source = [ 'hwmp-protocol.h', 'peer-management-protocol.h', - 'dot11s-installer.h', + 'ie-dot11s-beacon-timing.h', + 'ie-dot11s-peer-management.h', + 'peer-link.h', ] diff --git a/src/devices/mesh/flame/flame-protocol.cc b/src/devices/mesh/flame/flame-protocol.cc index a9b800d4d..d0bd251f0 100644 --- a/src/devices/mesh/flame/flame-protocol.cc +++ b/src/devices/mesh/flame/flame-protocol.cc @@ -19,7 +19,9 @@ */ #include "flame-protocol.h" +#include "flame-protocol-mac.h" #include "flame-header.h" +#include "flame-rtable.h" #include "ns3/llc-snap-header.h" #include "ns3/log.h" #include "ns3/simulator.h" diff --git a/src/devices/mesh/flame/flame-protocol.h b/src/devices/mesh/flame/flame-protocol.h index 12f66bfa7..5344521ff 100644 --- a/src/devices/mesh/flame/flame-protocol.h +++ b/src/devices/mesh/flame/flame-protocol.h @@ -21,11 +21,9 @@ #ifndef FLAME_PROTOCOL_H #define FLAME_PROTOCOL_H -#include "flame-protocol-mac.h" -#include "flame-header.h" -#include "flame-rtable.h" #include "ns3/mesh-l2-routing-protocol.h" +#include "ns3/nstime.h" #include "ns3/tag.h" #include @@ -46,6 +44,9 @@ */ namespace ns3 { namespace flame { +class FlameProtocolMac; +class FlameHeader; +class FlameRtable; /** * \ingroup flame * \brief Transmitter and receiver addresses diff --git a/src/devices/mesh/flame/wscript b/src/devices/mesh/flame/wscript index 25e714857..6b39918ee 100644 --- a/src/devices/mesh/flame/wscript +++ b/src/devices/mesh/flame/wscript @@ -7,7 +7,6 @@ def build(bld): 'flame-rtable.cc', 'flame-protocol-mac.cc', 'flame-protocol.cc', - 'flame-installer.cc', ] headers = bld.new_task_gen('ns3header') headers.module = 'flame' diff --git a/src/devices/mesh/wscript b/src/devices/mesh/wscript index c14d42c2f..0a3911bec 100644 --- a/src/devices/mesh/wscript +++ b/src/devices/mesh/wscript @@ -19,5 +19,4 @@ def build(bld): 'mesh-wifi-beacon.h', 'mesh-wifi-interface-mac.h', 'mesh-wifi-interface-mac-plugin.h', - 'mesh-stack-installer.h', ] diff --git a/src/devices/mesh/dot11s/dot11s-installer.cc b/src/helper/dot11s-installer.cc similarity index 97% rename from src/devices/mesh/dot11s/dot11s-installer.cc rename to src/helper/dot11s-installer.cc index 1be177dee..9ed804b0d 100644 --- a/src/devices/mesh/dot11s/dot11s-installer.cc +++ b/src/helper/dot11s-installer.cc @@ -17,9 +17,9 @@ * * Authors: Kirill Andreev */ -#include "dot11s-installer.h" -#include "peer-management-protocol.h" -#include "hwmp-protocol.h" +#include "ns3/dot11s-installer.h" +#include "ns3/peer-management-protocol.h" +#include "ns3/hwmp-protocol.h" #include "ns3/wifi-net-device.h" #include "ns3/mesh-wifi-interface-mac.h" diff --git a/src/devices/mesh/dot11s/dot11s-installer.h b/src/helper/dot11s-installer.h similarity index 100% rename from src/devices/mesh/dot11s/dot11s-installer.h rename to src/helper/dot11s-installer.h diff --git a/src/devices/mesh/flame/flame-installer.cc b/src/helper/flame-installer.cc similarity index 96% rename from src/devices/mesh/flame/flame-installer.cc rename to src/helper/flame-installer.cc index 5a5caed80..c7f09f97d 100644 --- a/src/devices/mesh/flame/flame-installer.cc +++ b/src/helper/flame-installer.cc @@ -18,8 +18,8 @@ * Authors: Kirill Andreev */ -#include "flame-installer.h" -#include "flame-protocol.h" +#include "ns3/flame-installer.h" +#include "ns3/flame-protocol.h" #include "ns3/wifi-net-device.h" #include "ns3/mesh-wifi-interface-mac.h" diff --git a/src/devices/mesh/flame/flame-installer.h b/src/helper/flame-installer.h similarity index 100% rename from src/devices/mesh/flame/flame-installer.h rename to src/helper/flame-installer.h diff --git a/src/devices/mesh/mesh-stack-installer.h b/src/helper/mesh-stack-installer.h similarity index 80% rename from src/devices/mesh/mesh-stack-installer.h rename to src/helper/mesh-stack-installer.h index 7a571d27f..fdd3ea7fc 100644 --- a/src/devices/mesh/mesh-stack-installer.h +++ b/src/helper/mesh-stack-installer.h @@ -26,15 +26,19 @@ namespace ns3 { /** * \ingroup mesh * - * \brief Prototype for class, which helps to install mesh stack of - * protocols + * \brief Prototype for class, which helps to install MAC-layer + * routing stack to ns3::MeshPointDevice + * \details You need to create a MeshPointDevice and attach all + * interfaces to it, than call Install method */ class MeshStack : public Object { public: ///\brief Installs mesh stack. needed by helper only virtual bool InstallStack (Ptr mp) = 0; + /// Report statistics of a given mesh point virtual void Report (const Ptr mp, std::ostream&) = 0; + /// Reset statistics of a given mesh point virtual void ResetStats (const Ptr mp) = 0; }; } diff --git a/src/helper/wscript b/src/helper/wscript index 3d762255d..c0c768898 100644 --- a/src/helper/wscript +++ b/src/helper/wscript @@ -29,6 +29,8 @@ def build(bld): 'ipv4-list-routing-helper.cc', 'ipv4-routing-helper.cc', 'mesh-helper.cc', + 'dot11s-installer.cc', + 'flame-installer.cc', 'athstats-helper.cc', 'ipv6-address-helper.cc', 'ipv6-interface-container.cc', @@ -67,6 +69,9 @@ def build(bld): 'ipv4-list-routing-helper.h', 'ipv4-routing-helper.h', 'mesh-helper.h', + 'mesh-stack-installer.h', + 'dot11s-installer.h', + 'flame-installer.h', 'athstats-helper.h', 'ipv6-address-helper.h', 'ipv6-interface-container.h',