New peer management protocol moved to 802.11s/

This commit is contained in:
Pavel Boyko
2009-03-20 11:58:54 +03:00
parent dc43ed1c4a
commit 8d29fe0b56
11 changed files with 124 additions and 117 deletions

View File

@@ -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");

View File

@@ -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<Dot11sPeerManagerProtocol> peerMan = m_peerMan.Create<Dot11sPeerManagerProtocol> ();
Ptr<Dot11sPeerManagerProtocol> peerMan = m_peerMan.Create<Dot11sPeerManagerProtocol> ();
NS_ASSERT(peerMan->AttachPorts(ports));
device->SetRemoteStationManager (manager);
node->AddDevice (device);

View File

@@ -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

View File

@@ -18,12 +18,12 @@
* Author: Kirill Andreev <andreev@iitp.ru>
*/
#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 ()

View File

@@ -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 <andreev@iitp.ru>
*/
#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<MeshWifiInterfaceMac> parent);
bool Receive (Ptr<Packet> packet, const WifiMacHeader & header);
bool UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to) const;
void UpdateBeacon (MeshWifiBeacon & beacon) const;
/**
* \}
*/
bool BindWithProtocol(Ptr<Dot11sPeerManagerProtocol>);
void SetPeerManagerProtcol(Ptr<Dot11sPeerManagerProtocol> 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<void, uint32_t, Mac48Address, uint16_t, IeDot11sConfiguration, IeDot11sPeerManagement>
);
/**
* \brief Forms and sends peer link management frame.
*/
void SendPeerLinkManagementFrame(Mac48Address peerAddress, uint16_t aid, IeDot11sPeerManagement peerElement, IeDot11sConfiguration meshConfig);
IeDot11sConfiguration AskPeerLinkManagementElement();
private:
Callback<void, uint32_t, Mac48Address, uint16_t, IeDot11sConfiguration, IeDot11sPeerManagement> m_deliverPeerManFrame;
Callback<void> m_beaconCallback;
Ptr<MeshWifiInterfaceMac> m_parent;
Ptr<Dot11sPeerManagerProtocol> m_protocol;
/**
* Create peer link management frames:
* \{
*/
Ptr<Packet> CreatePeerLinkOpenFrame();
Ptr<Packet> CreatePeerLinkConfirmFrame();
Ptr<Packet> CreatePeerLinkCloseFrame();
/**
* \}
*/
};
} //namespace ns3
#endif

View File

@@ -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 {
/***************************************************

View File

@@ -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 <list>
namespace ns3 {
class Dot11sPeerManagerMacPlugin;
/**
* \ingroup mesh
* \ingroup dot11s
*/
class WifiPeerLinkDescriptor : public RefCountBase
{
@@ -181,7 +182,7 @@ private:
Callback<void, Mac48Address, Mac48Address, bool> m_linkStatusCallback;
};
/**
* \ingroup mesh
* \ingroup dot11s
*/
class Dot11sPeerManagerProtocol : public Object
{

View File

@@ -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',

View File

@@ -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

View File

@@ -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 <andreev@iitp.ru>
*/
#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<MeshWifiInterfaceMac> parent);
bool Receive (Ptr<Packet> packet, const WifiMacHeader & header);
bool UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to) const;
void UpdateBeacon (MeshWifiBeacon & beacon) const;
/**
* \}
*/
bool BindWithProtocol(Ptr<Dot11sPeerManagerProtocol>);
void SetPeerManagerProtcol(Ptr<Dot11sPeerManagerProtocol> 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<void, uint32_t, Mac48Address, uint16_t, IeDot11sConfiguration, IeDot11sPeerManagement>
);
/**
* \brief Forms and sends peer link management frame.
*/
void SendPeerLinkManagementFrame(Mac48Address peerAddress, uint16_t aid, IeDot11sPeerManagement peerElement, IeDot11sConfiguration meshConfig);
IeDot11sConfiguration AskPeerLinkManagementElement();
private:
Callback<void, uint32_t, Mac48Address, uint16_t, IeDot11sConfiguration, IeDot11sPeerManagement> m_deliverPeerManFrame;
Callback<void> m_beaconCallback;
Ptr<MeshWifiInterfaceMac> m_parent;
Ptr<Dot11sPeerManagerProtocol> m_protocol;
/**
* Create peer link management frames:
* \{
*/
Ptr<Packet> CreatePeerLinkOpenFrame();
Ptr<Packet> CreatePeerLinkConfirmFrame();
Ptr<Packet> CreatePeerLinkCloseFrame();
/**
* \}
*/
};
} //namespace ns3
#endif

View File

@@ -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',