From 8d29fe0b569be559cd3c40ba080c38ebc01f5577 Mon Sep 17 00:00:00 2001 From: Pavel Boyko Date: Fri, 20 Mar 2009 11:58:54 +0300 Subject: [PATCH] New peer management protocol moved to 802.11s/ --- examples/mesh.cc | 2 + .../dot11s-helper.cc} | 5 +- .../dot11s-helper.h} | 4 +- .../mesh/{ => 802.11s}/peer-manager-plugin.cc | 8 +- .../mesh/802.11s/peer-manager-plugin.h | 98 +++++++++++++++++++ .../{ => 802.11s}/peer-manager-protocol.cc | 4 +- .../{ => 802.11s}/peer-manager-protocol.h | 7 +- src/devices/mesh/802.11s/wscript | 6 ++ src/devices/mesh/dot11s-parameters.h | 4 +- src/devices/mesh/peer-manager-plugin.h | 97 ------------------ src/devices/mesh/wscript | 6 -- 11 files changed, 124 insertions(+), 117 deletions(-) rename src/devices/mesh/{mesh-wifi-helper.cc => 802.11s/dot11s-helper.cc} (98%) rename src/devices/mesh/{mesh-wifi-helper.h => 802.11s/dot11s-helper.h} (98%) rename src/devices/mesh/{ => 802.11s}/peer-manager-plugin.cc (95%) create mode 100644 src/devices/mesh/802.11s/peer-manager-plugin.h rename src/devices/mesh/{ => 802.11s}/peer-manager-protocol.cc (99%) rename src/devices/mesh/{ => 802.11s}/peer-manager-protocol.h (99%) delete mode 100644 src/devices/mesh/peer-manager-plugin.h diff --git a/examples/mesh.cc b/examples/mesh.cc index 256ec2537..5c593a5ec 100644 --- a/examples/mesh.cc +++ b/examples/mesh.cc @@ -28,6 +28,8 @@ #include "ns3/mesh-module.h" #include "ns3/mobility-module.h" +#include "ns3/dot11s-helper.h" + using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TestMeshScript"); diff --git a/src/devices/mesh/mesh-wifi-helper.cc b/src/devices/mesh/802.11s/dot11s-helper.cc similarity index 98% rename from src/devices/mesh/mesh-wifi-helper.cc rename to src/devices/mesh/802.11s/dot11s-helper.cc index 6f5e173df..7987e5076 100644 --- a/src/devices/mesh/mesh-wifi-helper.cc +++ b/src/devices/mesh/802.11s/dot11s-helper.cc @@ -20,7 +20,8 @@ */ -#include "ns3/mesh-wifi-helper.h" +#include "dot11s-helper.h" + #include "ns3/mesh-point-device.h" #include "ns3/wifi-net-device.h" #include "ns3/wifi-phy.h" @@ -151,7 +152,7 @@ MeshWifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const mac->SetAddress (Mac48Address::Allocate ()); device->SetMac (mac); device->SetPhy (phy); - Ptr peerMan = m_peerMan.Create (); + Ptr peerMan = m_peerMan.Create (); NS_ASSERT(peerMan->AttachPorts(ports)); device->SetRemoteStationManager (manager); node->AddDevice (device); diff --git a/src/devices/mesh/mesh-wifi-helper.h b/src/devices/mesh/802.11s/dot11s-helper.h similarity index 98% rename from src/devices/mesh/mesh-wifi-helper.h rename to src/devices/mesh/802.11s/dot11s-helper.h index 33190d531..efdfc9d3b 100644 --- a/src/devices/mesh/mesh-wifi-helper.h +++ b/src/devices/mesh/802.11s/dot11s-helper.h @@ -21,7 +21,7 @@ #ifndef _MESHWIFIHELPER_H #define _MESHWIFIHELPER_H -#include "wifi-helper.h" +#include "ns3/wifi-helper.h" #include "ns3/peer-manager-protocol.h" namespace ns3 { @@ -29,7 +29,7 @@ namespace ns3 { class WifiChannel; /** - * \ingroup mesh + * \ingroup dot11s * */ class MeshWifiHelper diff --git a/src/devices/mesh/peer-manager-plugin.cc b/src/devices/mesh/802.11s/peer-manager-plugin.cc similarity index 95% rename from src/devices/mesh/peer-manager-plugin.cc rename to src/devices/mesh/802.11s/peer-manager-plugin.cc index d8d291479..7ee43b4d3 100644 --- a/src/devices/mesh/peer-manager-plugin.cc +++ b/src/devices/mesh/802.11s/peer-manager-plugin.cc @@ -18,12 +18,12 @@ * Author: Kirill Andreev */ -#include "ns3/ie-dot11s-configuration.h" -#include "ns3/ie-dot11s-peer-management.h" #include "ns3/mesh-wifi-interface-mac.h" - -#include "ns3/peer-manager-plugin.h" +#include "ie-dot11s-configuration.h" +#include "ie-dot11s-peer-management.h" +#include "peer-manager-plugin.h" #include "ns3/log.h" + NS_LOG_COMPONENT_DEFINE("PeerManager"); namespace ns3 { Dot11sPeerManagerMacPlugin::Dot11sPeerManagerMacPlugin () diff --git a/src/devices/mesh/802.11s/peer-manager-plugin.h b/src/devices/mesh/802.11s/peer-manager-plugin.h new file mode 100644 index 000000000..246d18e23 --- /dev/null +++ b/src/devices/mesh/802.11s/peer-manager-plugin.h @@ -0,0 +1,98 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 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 PEER_MANAGER_MAC_PLUGIN_H_ +#define PEER_MANAGER_MAC_PLUGIN_H_ + +#include "ns3/mesh-wifi-interface-mac-plugin.h" +#include "peer-manager-protocol.h" + +namespace ns3 { +class MeshWifiInterfaceMac; +class IeDot11sConfiguration; +class IeDot11sPeerManagement; +class Dot11sPeerManagerProtocol; +/** + * \ingroup dot11s + * + * \brief This is plugin to Mesh WiFi MAC, which implements + * interface to dot11s peer management protocol: it takes proper + * frames from MAC-layer, extracts peer link management information + * element and mesh configuration element and passes it to main part + * of protocol + */ +class Dot11sPeerManagerMacPlugin : public MeshWifiInterfaceMacPlugin +{ +public: + Dot11sPeerManagerMacPlugin (); + ~Dot11sPeerManagerMacPlugin (); + /** + * \brief Inherited from plugin abstract class + * \{ + */ + void SetParent (Ptr parent); + bool Receive (Ptr packet, const WifiMacHeader & header); + bool UpdateOutcomingFrame (Ptr packet, WifiMacHeader & header, Mac48Address from, Mac48Address to) const; + void UpdateBeacon (MeshWifiBeacon & beacon) const; + /** + * \} + */ + bool BindWithProtocol(Ptr); + void SetPeerManagerProtcol(Ptr protocol); + /** + * Deliver Peer link management information to the protocol-part + * \param void is returning value - we pass a frame and forget + * about it + * \param uint32_t - is a port ID of a given MAC (portID rather + * than MAC address, beacause many ports may have the same MAC) + * \param Mac48Address is address of peer + * \param uint16_t is association ID, which peer has assigned to + * us + * \param IeDot11sConfiguration is mesh configuration element + * taken from the peer management frame + * \param IeDot11sPeerManagement is peer link management element + */ + void SetDeliverPeerLinkFrameCallbback ( + Callback + ); + /** + * \brief Forms and sends peer link management frame. + */ + void SendPeerLinkManagementFrame(Mac48Address peerAddress, uint16_t aid, IeDot11sPeerManagement peerElement, IeDot11sConfiguration meshConfig); + IeDot11sConfiguration AskPeerLinkManagementElement(); +private: + Callback m_deliverPeerManFrame; + Callback m_beaconCallback; + Ptr m_parent; + Ptr m_protocol; + /** + * Create peer link management frames: + * \{ + */ + Ptr CreatePeerLinkOpenFrame(); + Ptr CreatePeerLinkConfirmFrame(); + Ptr CreatePeerLinkCloseFrame(); + /** + * \} + */ +}; +} //namespace ns3 +#endif + diff --git a/src/devices/mesh/peer-manager-protocol.cc b/src/devices/mesh/802.11s/peer-manager-protocol.cc similarity index 99% rename from src/devices/mesh/peer-manager-protocol.cc rename to src/devices/mesh/802.11s/peer-manager-protocol.cc index 0d4c9b3b8..745539543 100644 --- a/src/devices/mesh/peer-manager-protocol.cc +++ b/src/devices/mesh/802.11s/peer-manager-protocol.cc @@ -20,13 +20,15 @@ */ -#include "ns3/peer-manager-protocol.h" +#include "peer-manager-protocol.h" + #include "ns3/dot11s-parameters.h" #include "ns3/simulator.h" #include "ns3/assert.h" #include "ns3/log.h" #include "ns3/random-variable.h" #include "ns3/mesh-wifi-interface-mac.h" + NS_LOG_COMPONENT_DEFINE ("Dot11sPeerManagerProtocol"); namespace ns3 { /*************************************************** diff --git a/src/devices/mesh/peer-manager-protocol.h b/src/devices/mesh/802.11s/peer-manager-protocol.h similarity index 99% rename from src/devices/mesh/peer-manager-protocol.h rename to src/devices/mesh/802.11s/peer-manager-protocol.h index 583faae2a..70100013b 100644 --- a/src/devices/mesh/peer-manager-protocol.h +++ b/src/devices/mesh/802.11s/peer-manager-protocol.h @@ -29,13 +29,14 @@ #include "ns3/ie-dot11s-beacon-timing.h" #include "ns3/ie-dot11s-configuration.h" #include "ns3/event-id.h" -#include "ns3/peer-manager-plugin.h" + +#include "peer-manager-plugin.h" #include namespace ns3 { class Dot11sPeerManagerMacPlugin; /** - * \ingroup mesh + * \ingroup dot11s */ class WifiPeerLinkDescriptor : public RefCountBase { @@ -181,7 +182,7 @@ private: Callback m_linkStatusCallback; }; /** - * \ingroup mesh + * \ingroup dot11s */ class Dot11sPeerManagerProtocol : public Object { diff --git a/src/devices/mesh/802.11s/wscript b/src/devices/mesh/802.11s/wscript index da86d1b79..fbd154429 100644 --- a/src/devices/mesh/802.11s/wscript +++ b/src/devices/mesh/802.11s/wscript @@ -10,6 +10,9 @@ def build(bld): 'ie-dot11s-prep.cc', 'ie-dot11s-perr.cc', 'ie-dot11s-rann.cc', + 'peer-manager-plugin.cc', + 'peer-manager-protocol.cc', + 'dot11s-helper.cc', ] headers = bld.new_task_gen('ns3header') headers.module = '802.11s' @@ -21,6 +24,9 @@ def build(bld): 'ie-dot11s-prep.h', 'ie-dot11s-perr.h', 'ie-dot11s-rann.h', + 'peer-manager-protocol.h', + 'peer-manager-plugin.h', + 'dot11s-helper.h', ] # obj = bld.create_ns3_program('wifi-phy-test', diff --git a/src/devices/mesh/dot11s-parameters.h b/src/devices/mesh/dot11s-parameters.h index 67b4dec74..a2a46c9e5 100644 --- a/src/devices/mesh/dot11s-parameters.h +++ b/src/devices/mesh/dot11s-parameters.h @@ -27,8 +27,8 @@ namespace ns3 { -#define TU_TO_TIME(x) MicroSeconds(x*1024) -#define TIME_TO_TU(x) x.GetMicroSeconds()/1024 +#define TU_TO_TIME(x) (MicroSeconds((x)*1024)) +#define TIME_TO_TU(x) ((x).GetMicroSeconds()/1024) /** * \ingroup mesh diff --git a/src/devices/mesh/peer-manager-plugin.h b/src/devices/mesh/peer-manager-plugin.h deleted file mode 100644 index 1c88a6609..000000000 --- a/src/devices/mesh/peer-manager-plugin.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 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 PEER_MANAGER_MAC_PLUGIN_H_ -#define PEER_MANAGER_MAC_PLUGIN_H_ - -#include "ns3/mesh-wifi-interface-mac-plugin.h" -#include "ns3/peer-manager-protocol.h" - -namespace ns3 { -class MeshWifiInterfaceMac; -class IeDot11sConfiguration; -class IeDot11sPeerManagement; -class Dot11sPeerManagerProtocol; - /** - * \ingroup dot11s - * \brief This is plugin to Mesh WiFi MAC, which implements - * interface to dot11s peer management protocol: it takes proper - * frames from MAC-layer, extracts peer link management information - * element and mesh configuration element and passes it to main part - * of protocol - */ -class Dot11sPeerManagerMacPlugin : public MeshWifiInterfaceMacPlugin -{ - public: - Dot11sPeerManagerMacPlugin (); - ~Dot11sPeerManagerMacPlugin (); - /** - * \brief Inherited from plugin abstract class - * \{ - */ - void SetParent (Ptr parent); - bool Receive (Ptr packet, const WifiMacHeader & header); - bool UpdateOutcomingFrame (Ptr packet, WifiMacHeader & header, Mac48Address from, Mac48Address to) const; - void UpdateBeacon (MeshWifiBeacon & beacon) const; - /** - * \} - */ - bool BindWithProtocol(Ptr); - void SetPeerManagerProtcol(Ptr protocol); - /** - * Deliver Peer link management information to the protocol-part - * \param void is returning value - we pass a frame and forget - * about it - * \param uint32_t - is a port ID of a given MAC (portID rather - * than MAC address, beacause many ports may have the same MAC) - * \param Mac48Address is address of peer - * \param uint16_t is association ID, which peer has assigned to - * us - * \param IeDot11sConfiguration is mesh configuration element - * taken from the peer management frame - * \param IeDot11sPeerManagement is peer link management element - */ - void SetDeliverPeerLinkFrameCallbback ( - Callback - ); - /** - * \brief Forms and sends peer link management frame. - */ - void SendPeerLinkManagementFrame(Mac48Address peerAddress, uint16_t aid, IeDot11sPeerManagement peerElement, IeDot11sConfiguration meshConfig); - IeDot11sConfiguration AskPeerLinkManagementElement(); - private: - Callback m_deliverPeerManFrame; - Callback m_beaconCallback; - Ptr m_parent; - Ptr m_protocol; - /** - * Create peer link management frames: - * \{ - */ - Ptr CreatePeerLinkOpenFrame(); - Ptr CreatePeerLinkConfirmFrame(); - Ptr CreatePeerLinkCloseFrame(); - /** - * \} - */ -}; -} //namespace ns3 -#endif - diff --git a/src/devices/mesh/wscript b/src/devices/mesh/wscript index 18c69350f..8b430759e 100644 --- a/src/devices/mesh/wscript +++ b/src/devices/mesh/wscript @@ -9,11 +9,8 @@ def build(bld): 'mesh-l2-routing-protocol.cc', 'mesh-wifi-beacon.cc', 'mesh-wifi-interface-mac.cc', - 'peer-manager-plugin.cc', # Not refactored - 'mesh-wifi-helper.cc', 'mesh-wifi-mac-header.cc', - 'peer-manager-protocol.cc', 'tx-statistics.cc', 'hwmp-rtable.cc', 'dot11s-parameters.cc', @@ -33,7 +30,6 @@ def build(bld): 'mesh-wifi-beacon.h', 'mesh-wifi-interface-mac.h', 'mesh-wifi-interface-mac-plugin.h', - 'peer-manager-plugin.h', # Dirty 'dot11s-codes.h', 'hwmp-state.h', @@ -42,11 +38,9 @@ def build(bld): 'hwmp.h', 'tx-statistics.h', 'hwmp-rtable.h', - 'peer-manager-protocol.h', 'mesh-wifi-mac-header.h', 'mesh-wifi-mac.h', 'mesh-wifi-peer-manager.h', - 'mesh-wifi-helper.h', ] # obj = bld.create_ns3_program('wifi-phy-test',