Restructured files, removed unneeded includes

This commit is contained in:
Kirill Andreev
2009-08-25 14:37:10 +04:00
parent b207444d5f
commit 42e5bb46f2
24 changed files with 109 additions and 217 deletions

View File

@@ -19,12 +19,7 @@
*/
#include "ie-dot11s-beacon-timing.h"
#include "ns3/log.h"
#include "ns3/test.h"
#include "ns3/packet.h"
NS_LOG_COMPONENT_DEFINE ("IeBeaconTiming");
namespace ns3 {
namespace dot11s {
/*******************************************
@@ -88,8 +83,6 @@ IeBeaconTiming::AddNeighboursTimingElementUnit (uint16_t aid, Time last_beacon,
{
if (m_numOfUnits == 50)
{
NS_LOG_WARN (
"Neighbor timing element is ignored, since more than 50 neighbors can not be supported in single information element.");
return;
}
//First we lookup if this element already exists
@@ -98,7 +91,6 @@ IeBeaconTiming::AddNeighboursTimingElementUnit (uint16_t aid, Time last_beacon,
if (((*i)->GetAid () == AidToU8 (aid)) && ((*i)->GetLastBeacon () == TimestampToU16 (last_beacon))
&& ((*i)->GetBeaconInterval () == BeaconIntervalToU16 (beacon_interval)))
{
NS_LOG_WARN ("Duplicated neighbor timing element is ignored.");
return;
}
}

View File

@@ -23,7 +23,7 @@
#include <vector>
#include "ns3/nstime.h"
#include "ns3/wifi-information-element.h"
#include "ns3/wifi-information-element-vector.h"
namespace ns3 {
namespace dot11s {

View File

@@ -20,7 +20,6 @@
*/
#include "ie-dot11s-configuration.h"
#include "ns3/test.h"
#include "ns3/packet.h"
namespace ns3 {
namespace dot11s {

View File

@@ -23,7 +23,7 @@
#ifndef MESH_CONFIGURATION_H
#define MESH_CONFIGURATION_H
#include "ns3/wifi-information-element.h"
#include "ns3/wifi-information-element-vector.h"
namespace ns3 {
namespace dot11s {

View File

@@ -23,7 +23,7 @@
#include <stdint.h>
#include "ns3/buffer.h"
#include "ns3/wifi-information-element.h"
#include "ns3/wifi-information-element-vector.h"
namespace ns3 {
namespace dot11s {

View File

@@ -23,7 +23,7 @@
#include <stdint.h>
#include "ns3/buffer.h"
#include "ns3/wifi-information-element.h"
#include "ns3/wifi-information-element-vector.h"
namespace ns3 {
namespace dot11s {

View File

@@ -21,7 +21,6 @@
#include "ie-dot11s-peer-management.h"
#include "ns3/assert.h"
#include "ns3/test.h"
#include "ns3/packet.h"
namespace ns3 {

View File

@@ -22,7 +22,7 @@
#ifndef MESH_PEER_MAN_ELEMENT
#define MESH_PEER_MAN_ELEMENT
#include "ns3/wifi-information-element.h"
#include "ns3/wifi-information-element-vector.h"
namespace ns3 {
namespace dot11s {

View File

@@ -21,7 +21,7 @@
#ifndef MESH_PERING_PROTOCOL_H
#define MESH_PEERING_PROTOCOL_H
#include "ns3/wifi-information-element.h"
#include "ns3/wifi-information-element-vector.h"
namespace ns3
{

View File

@@ -20,9 +20,7 @@
#include "ie-dot11s-perr.h"
#include "ns3/address-utils.h"
#include "ns3/node.h"
#include "ns3/packet.h"
#include "ns3/test.h"
namespace ns3 {
namespace dot11s {
IePerr::IePerr ()

View File

@@ -22,7 +22,7 @@
#define PERR_INFORMATION_ELEMENT_H
#include "ns3/mac48-address.h"
#include "ns3/wifi-information-element.h"
#include "ns3/wifi-information-element-vector.h"
namespace ns3 {
namespace dot11s {

View File

@@ -20,9 +20,7 @@
#include "ie-dot11s-prep.h"
#include "ns3/address-utils.h"
#include "ns3/node.h"
#include "ns3/assert.h"
#include "ns3/test.h"
#include "ns3/packet.h"
namespace ns3 {
namespace dot11s {

View File

@@ -22,7 +22,7 @@
#define WIFI_PREP_INFORMATION_ELEMENT_H
#include "ns3/mac48-address.h"
#include "ns3/wifi-information-element.h"
#include "ns3/wifi-information-element-vector.h"
namespace ns3 {
namespace dot11s {

View File

@@ -20,9 +20,7 @@
#include "ie-dot11s-preq.h"
#include "ns3/address-utils.h"
#include "ns3/node.h"
#include "ns3/assert.h"
#include "ns3/test.h"
#include "ns3/packet.h"
namespace ns3 {

View File

@@ -24,7 +24,7 @@
#include <vector>
#include "ns3/mac48-address.h"
#include "ns3/wifi-information-element.h"
#include "ns3/wifi-information-element-vector.h"
namespace ns3 {
namespace dot11s {

View File

@@ -21,9 +21,7 @@
#include "ie-dot11s-rann.h"
#include "ns3/assert.h"
#include "ns3/address-utils.h"
#include "ns3/node.h"
#include "ns3/packet.h"
#include "ns3/test.h"
namespace ns3 {
namespace dot11s {

View File

@@ -22,7 +22,7 @@
#define RANN_INFORMATION_ELEMENT_H
#include "ns3/mac48-address.h"
#include "ns3/wifi-information-element.h"
#include "ns3/wifi-information-element-vector.h"
namespace ns3 {
namespace dot11s {

View File

@@ -149,7 +149,7 @@ operator== (const FlameHeader & a, const FlameHeader & b)
struct FlameHeaderBist : public Test
{
FlameHeaderBist () :
Test ("mesh/Flame/FlameHeader")
Test ("Mesh/Flame/FlameHeader")
{
}
virtual bool

View File

@@ -23,7 +23,6 @@
#include "ns3/object.h"
#include "ns3/packet.h"
#include "ns3/wifi-information-element.h"
#include "ns3/mgt-headers.h" // from wifi module
#include "ns3/wifi-mac-header.h"
#include "ns3/wifi-information-element-vector.h"

View File

@@ -35,6 +35,20 @@
#include "dot11s/ie-dot11s-rann.h"
namespace ns3 {
void
WifiInformationElement::Print (std::ostream &os) const
{
os << std::endl << "<information_element id=" << ElementId () << ">" << std::endl;
PrintInformation (os);
os << "</information_element>" << std::endl;
}
bool
operator< (WifiInformationElement const & a, WifiInformationElement const & b)
{
return (a.ElementId () < b.ElementId ());
}
WifiInformationElementVector::WifiInformationElementVector () :
m_maxSize (1500)
{
@@ -360,10 +374,10 @@ operator== (const WifiInformationElementVector & a, const WifiInformationElement
#ifdef RUN_SELF_TESTS
/// Built-in self test for WifiInformationElementVector
struct WifiInformationElementVectorBist : public IeTest
struct WifiInformationElementVectorBist : public Test
{
WifiInformationElementVectorBist () :
IeTest ("Mesh/WifiInformationElementVector")
Test ("Mesh/WifiInformationElementVector")
{
};
virtual bool

View File

@@ -15,17 +15,95 @@
* 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>
* Authors: Kirill Andreev <andreev@iitp.ru>
* Pavel Boyko <boyko.iitp.ru>
*/
#ifndef IE_VECTOR_H
#define IE_VECTOR_H
#include "ns3/wifi-information-element.h"
#include "ns3/header.h"
namespace ns3 {
class Packet;
/**
* \ingroup mesh
*
* \brief Enum of all known information element id (aka tags).
*
* For now only 802.11s (mesh) related elements are supported here (so 11S prefix),
* but this can change in future.
*
* Note that 802.11s element ids are not yet officially assigned, we use ones
* compatible with open80211s (http://o11s.org/) implementation.
*/
enum WifiElementId {
/* begin of open80211s-compatible IDs */
IE11S_MESH_CONFIGURATION = 51,
IE11S_MESH_ID = 52,
/* end of open80211s-compatible IDs */
IE11S_LINK_METRIC_REPORT = 20,
IE11S_CONGESTION_NOTIFICATION,
/* begin of open80211s-compatible IDs */
IE11S_PEERING_MANAGEMENT = 55,
/* end of open80211s-compatible IDs */
IE11S_SUPP_MBSS_REG_CLASSES_CHANNELS = 23,
IE11S_MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
IE11S_MESH_TIM,
IE11S_AWAKE_WINDOW,
IE11S_BEACON_TIMING,
IE11S_MCCAOP_SETUP_REQUEST,
IE11S_MCCAOP_SETUP_REPLY,
IE11S_MCCAOP_ADVERTISEMENT,
IE11S_MCCAOP_RESERVATION_TEARDOWN,
IE11S_PORTAL_ANNOUNCEMENT,
IE11S_RANN = 67,
/* begin of open80211s-compatible IDs */
IE11S_PREQ = 68,
IE11S_PREP = 69,
IE11S_PERR = 70,
/* end of open80211s-compatible IDs */
IE11S_PROXY_UPDATE = 37,
IE11S_PROXY_UPDATE_CONFIRMATION,
IE11S_ABBREVIATED_HANDSHAKE,
IE11S_MESH_PEERING_PROTOCOL_VERSION = 74,
};
/**
* \ingroup mesh
*
* \brief Information element, as defined in 802.11-2007 standard
*
* Elements are defined to have a common general format consisting of a 1 octet Element ID field, a 1 octet
* length field, and a variable-length element-specific information field. Each element is assigned a unique
* Element ID as defined in this standard. The Length field specifies the number of octets in the Information
* field.
*/
class WifiInformationElement : public RefCountBase
{
public:
virtual void Print (std::ostream &os) const;
///\name Each subclass must implement
//\{
/// Own unique Element ID
virtual WifiElementId ElementId () const = 0;
/// Length of serialized information
virtual uint8_t GetInformationSize () const = 0;
/// Serialize information
virtual void SerializeInformation (Buffer::Iterator start) const = 0;
/// Deserialize information
virtual uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length) = 0;
/// Print information
virtual void PrintInformation (std::ostream &os) const = 0;
//\}
/// Compare information elements using Element ID
friend bool operator< (WifiInformationElement const & a, WifiInformationElement const & b);
};
/// Compare information elements using Element ID
bool operator< (WifiInformationElement const & a, WifiInformationElement const & b);
/**
* \ingroup mesh
*

View File

@@ -1,41 +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: Pavel Boyko <boyko@iitp.ru>
*/
#include "ns3/wifi-information-element.h"
#include "ns3/packet.h"
#include "ns3/log.h"
namespace ns3
{
void
WifiInformationElement::Print (std::ostream &os) const
{
os << std::endl << "<information_element id=" << ElementId () << ">" << std::endl;
PrintInformation (os);
os << "</information_element>" << std::endl;
}
bool
operator< (WifiInformationElement const & a, WifiInformationElement const & b)
{
return (a.ElementId () < b.ElementId ());
}
}

View File

@@ -1,140 +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: Pavel Boyko <boyko@iitp.ru>
*/
#ifndef WIFIINFORMATIONELEMENT_H_
#define WIFIINFORMATIONELEMENT_H_
#include "ns3/header.h"
#include "ns3/ref-count-base.h"
#include "ns3/test.h"
#include "ns3/packet.h"
namespace ns3 {
class Packet;
/**
* \ingroup mesh
*
* \brief Enum of all known information element id (aka tags).
*
* For now only 802.11s (mesh) related elements are supported here (so 11S prefix),
* but this can change in future.
*
* Note that 802.11s element ids are not yet officially assigned, we use ones
* compatible with open80211s (http://o11s.org/) implementation.
*/
enum WifiElementId {
/* begin of open80211s-compatible IDs */
IE11S_MESH_CONFIGURATION = 51,
IE11S_MESH_ID = 52,
/* end of open80211s-compatible IDs */
IE11S_LINK_METRIC_REPORT = 20,
IE11S_CONGESTION_NOTIFICATION,
/* begin of open80211s-compatible IDs */
IE11S_PEERING_MANAGEMENT = 55,
/* end of open80211s-compatible IDs */
IE11S_SUPP_MBSS_REG_CLASSES_CHANNELS = 23,
IE11S_MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
IE11S_MESH_TIM,
IE11S_AWAKE_WINDOW,
IE11S_BEACON_TIMING,
IE11S_MCCAOP_SETUP_REQUEST,
IE11S_MCCAOP_SETUP_REPLY,
IE11S_MCCAOP_ADVERTISEMENT,
IE11S_MCCAOP_RESERVATION_TEARDOWN,
IE11S_PORTAL_ANNOUNCEMENT,
IE11S_RANN = 67,
/* begin of open80211s-compatible IDs */
IE11S_PREQ = 68,
IE11S_PREP = 69,
IE11S_PERR = 70,
/* end of open80211s-compatible IDs */
IE11S_PROXY_UPDATE = 37,
IE11S_PROXY_UPDATE_CONFIRMATION,
IE11S_ABBREVIATED_HANDSHAKE,
IE11S_MESH_PEERING_PROTOCOL_VERSION = 74,
};
/**
* \ingroup mesh
*
* \brief Information element, as defined in 802.11-2007 standard
*
* Elements are defined to have a common general format consisting of a 1 octet Element ID field, a 1 octet
* length field, and a variable-length element-specific information field. Each element is assigned a unique
* Element ID as defined in this standard. The Length field specifies the number of octets in the Information
* field.
*/
class WifiInformationElement : public RefCountBase
{
public:
virtual void Print (std::ostream &os) const;
///\name Each subclass must implement
//\{
/// Own unique Element ID
virtual WifiElementId ElementId () const = 0;
/// Length of serialized information
virtual uint8_t GetInformationSize () const = 0;
/// Serialize information
virtual void SerializeInformation (Buffer::Iterator start) const = 0;
/// Deserialize information
virtual uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length) = 0;
/// Print information
virtual void PrintInformation (std::ostream &os) const = 0;
//\}
/// Compare information elements using Element ID
friend bool operator< (WifiInformationElement const & a, WifiInformationElement const & b);
};
/// Compare information elements using Element ID
bool operator< (WifiInformationElement const & a, WifiInformationElement const & b);
#ifdef RUN_SELF_TESTS
/// Generic test of information element
class IeTest : public Test
{
public:
IeTest (const char * name) : Test (name) {}
/// Test round-trip serialization
template <typename IE> bool TestRoundtripSerialization (IE a);
};
template <typename IE> bool
IeTest::TestRoundtripSerialization (IE a)
{
bool result (true);
#if 0
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (a);
IE b;
packet->RemoveHeader (b);
NS_TEST_ASSERT_EQUAL (a, b);
packet->AddHeader (a);
IE c;
bool ok = packet->RemoveHeader (c);
NS_TEST_ASSERT (ok);
NS_TEST_ASSERT_EQUAL (a, c);
#endif
return result;
}
#endif
} // namespace ns3
#endif /* WIFIINFORMATIONELEMENT_H_ */

View File

@@ -4,7 +4,7 @@ def build(bld):
obj = bld.create_ns3_module('mesh', ['wifi', 'dot11s'])
obj.source = [
'wifi-information-element.cc',
#'wifi-information-element.cc',
'wifi-information-element-vector.cc',
'mesh-point-device.cc',
'mesh-l2-routing-protocol.cc',
@@ -14,7 +14,7 @@ def build(bld):
headers = bld.new_task_gen('ns3header')
headers.module = 'mesh'
headers.source = [
'wifi-information-element.h',
#'wifi-information-element.h',
'wifi-information-element-vector.h',
'mesh-point-device.h',
'mesh-l2-routing-protocol.h',