Mesh: action header moved from dot11s namespace and placed to

wifi/mgt-headers.h
This commit is contained in:
Kirill Andreev
2009-12-01 15:05:31 +03:00
parent e2bf7eb25f
commit 69d331b5dc
10 changed files with 284 additions and 284 deletions

View File

@@ -174,145 +174,5 @@ operator== (const MeshHeader & a, const MeshHeader & b)
&& (a.m_meshSeqno == b.m_meshSeqno) && (a.m_addr4 == b.m_addr4) && (a.m_addr5 == b.m_addr5)
&& (a.m_addr6 == b.m_addr6));
}
/**********************************************************
* ActionFrame
**********************************************************/
WifiMeshActionHeader::WifiMeshActionHeader ()
{
}
WifiMeshActionHeader::~WifiMeshActionHeader ()
{
}
void
WifiMeshActionHeader::SetAction (WifiMeshActionHeader::CategoryValue type,
WifiMeshActionHeader::ActionValue action)
{
m_category = type;
switch (type)
{
case MESH_PEERING_MGT:
{
m_actionValue = action.peerLink;
break;
}
case MESH_PATH_SELECTION:
{
m_actionValue = action.pathSelection;
break;
}
case MESH_LINK_METRIC:
case MESH_INTERWORKING:
case MESH_RESOURCE_COORDINATION:
case MESH_PROXY_FORWARDING:
break;
}
}
WifiMeshActionHeader::CategoryValue
WifiMeshActionHeader::GetCategory ()
{
switch (m_category)
{
case MESH_PEERING_MGT:
return MESH_PEERING_MGT;
case MESH_LINK_METRIC:
return MESH_LINK_METRIC;
case MESH_PATH_SELECTION:
return MESH_PATH_SELECTION;
case MESH_INTERWORKING:
return MESH_INTERWORKING;
case MESH_RESOURCE_COORDINATION:
return MESH_RESOURCE_COORDINATION;
case MESH_PROXY_FORWARDING:
return MESH_PROXY_FORWARDING;
default:
NS_FATAL_ERROR ("Unknown action value");
return MESH_PEERING_MGT;
}
}
WifiMeshActionHeader::ActionValue
WifiMeshActionHeader::GetAction ()
{
ActionValue retval;
retval.peerLink = PEER_LINK_OPEN; // Needs to be initialized to something to quiet valgrind in default cases
switch (m_category)
{
case MESH_PEERING_MGT:
switch (m_actionValue)
{
case PEER_LINK_OPEN:
retval.peerLink = PEER_LINK_OPEN;
return retval;
case PEER_LINK_CONFIRM:
retval.peerLink = PEER_LINK_CONFIRM;
return retval;
case PEER_LINK_CLOSE:
retval.peerLink = PEER_LINK_CLOSE;
return retval;
default:
NS_FATAL_ERROR ("Unknown mesh peering management action code");
retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
return retval;
}
case MESH_PATH_SELECTION:
switch (m_actionValue)
{
case PATH_SELECTION:
retval.pathSelection = PATH_SELECTION;
return retval;
default:
NS_FATAL_ERROR ("Unknown mesh path selection action code");
retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
return retval;
}
case MESH_LINK_METRIC:
// not yet supported
case MESH_INTERWORKING:
// not yet supported
case MESH_RESOURCE_COORDINATION:
// not yet supported
default:
NS_FATAL_ERROR ("Unsupported mesh action");
retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
return retval;
}
}
TypeId
WifiMeshActionHeader::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::WifiMeshActionHeader")
.SetParent<Header> ()
.AddConstructor<WifiMeshActionHeader> ();
return tid;
}
TypeId
WifiMeshActionHeader::GetInstanceTypeId () const
{
return GetTypeId ();
}
void
WifiMeshActionHeader::Print (std::ostream &os) const
{
}
uint32_t
WifiMeshActionHeader::GetSerializedSize () const
{
return 2;
}
void
WifiMeshActionHeader::Serialize (Buffer::Iterator start) const
{
start.WriteU8 (m_category);
start.WriteU8 (m_actionValue);
}
uint32_t
WifiMeshActionHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
m_category = i.ReadU8 ();
m_actionValue = i.ReadU8 ();
return i.GetDistanceFrom (start);
}
} //namespace dot11s
} // namespace ns3

View File

@@ -73,85 +73,6 @@ private:
};
bool operator== (const MeshHeader & a, const MeshHeader & b);
/**
* \ingroup dot11s
*
* \brief See IEEE 802.11s draft 3.0 section 7.2.3.14
*
* Header format: | category: 1 | action value: 1 |
*/
class WifiMeshActionHeader : public Header
{
public:
WifiMeshActionHeader ();
~WifiMeshActionHeader ();
/* Compatible with open80211s implementation */
enum CategoryValue //table 7-24 staring from 4
{
MESH_PEERING_MGT = 30,
MESH_LINK_METRIC = 31,
MESH_PATH_SELECTION = 32,
MESH_INTERWORKING = 33,
MESH_RESOURCE_COORDINATION = 34,
MESH_PROXY_FORWARDING = 35,
};
/* Compatible with open80211s implementation */
enum PeerLinkMgtActionValue
{
PEER_LINK_OPEN = 0,
PEER_LINK_CONFIRM = 1,
PEER_LINK_CLOSE = 2,
};
enum LinkMetricActionValue
{
LINK_METRIC_REQUEST = 0,
LINK_METRIC_REPORT,
};
/* Compatible with open80211s implementation */
enum PathSelectionActionValue
{
PATH_SELECTION = 0,
};
enum InterworkActionValue
{
PORTAL_ANNOUNCEMENT = 0,
};
enum ResourceCoordinationActionValue
{
CONGESTION_CONTROL_NOTIFICATION = 0,
MDA_SETUP_REQUEST,
MDA_SETUP_REPLY,
MDAOP_ADVERTISMENT_REQUEST,
MDAOP_ADVERTISMENTS,
MDAOP_SET_TEARDOWN,
BEACON_TIMING_REQUEST,
BEACON_TIMING_RESPONSE,
TBTT_ADJUSTMENT_REQUEST,
MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
};
typedef union
{
enum PeerLinkMgtActionValue peerLink;
enum LinkMetricActionValue linkMetrtic;
enum PathSelectionActionValue pathSelection;
enum InterworkActionValue interwork;
enum ResourceCoordinationActionValue resourceCoordination;
} ActionValue;
void SetAction (enum CategoryValue type,ActionValue action);
CategoryValue GetCategory ();
ActionValue GetAction ();
static TypeId GetTypeId ();
virtual TypeId GetInstanceTypeId () const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize () const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
uint8_t m_category;
uint8_t m_actionValue;
};
} //namespace dot11s
} // namespace ns3
#endif /* MESH_WIFI_MAC_HEADER_H */

View File

@@ -23,6 +23,7 @@
#include "ns3/simulator.h"
#include "ns3/nstime.h"
#include "ns3/log.h"
#include "ns3/mgt-headers.h"
#include "dot11s-mac-header.h"
#include "hwmp-protocol-mac.h"
#include "hwmp-tag.h"
@@ -94,10 +95,10 @@ HwmpProtocolMac::ReceiveAction (Ptr<Packet> packet, const WifiMacHeader & header
{
m_stats.rxMgt++;
m_stats.rxMgtBytes += packet->GetSize ();
WifiMeshActionHeader actionHdr;
WifiActionHeader actionHdr;
packet->RemoveHeader (actionHdr);
WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction ();
if (actionHdr.GetCategory () != WifiMeshActionHeader::MESH_PATH_SELECTION)
WifiActionHeader::ActionValue actionValue = actionHdr.GetAction ();
if (actionHdr.GetCategory () != WifiActionHeader::MESH_PATH_SELECTION)
{
return true;
}
@@ -203,13 +204,13 @@ HwmpProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & heade
header.SetAddr1 (tag.GetAddress ());
return true;
}
WifiMeshActionHeader
HwmpProtocolMac::GetWifiMeshActionHeader ()
WifiActionHeader
HwmpProtocolMac::GetWifiActionHeader ()
{
WifiMeshActionHeader actionHdr;
WifiMeshActionHeader::ActionValue action;
action.pathSelection = WifiMeshActionHeader::PATH_SELECTION;
actionHdr.SetAction (WifiMeshActionHeader::MESH_PATH_SELECTION, action);
WifiActionHeader actionHdr;
WifiActionHeader::ActionValue action;
action.pathSelection = WifiActionHeader::PATH_SELECTION;
actionHdr.SetAction (WifiActionHeader::MESH_PATH_SELECTION, action);
return actionHdr;
}
void
@@ -230,7 +231,7 @@ HwmpProtocolMac::SendPreq (std::vector<IePreq> preq)
elements.AddInformationElement(Ptr<IePreq> (&(*i)));
}
packet->AddHeader(elements);
packet->AddHeader (GetWifiMeshActionHeader ());
packet->AddHeader (GetWifiActionHeader ());
//create 802.11 header:
WifiMacHeader hdr;
hdr.SetAction ();
@@ -300,7 +301,7 @@ HwmpProtocolMac::SendPrep (IePrep prep, Mac48Address receiver)
WifiInformationElementVector elements;
elements.AddInformationElement(Ptr<IePrep> (&prep));
packet->AddHeader (elements);
packet->AddHeader (GetWifiMeshActionHeader ());
packet->AddHeader (GetWifiActionHeader ());
//create 802.11 header:
WifiMacHeader hdr;
hdr.SetAction ();
@@ -341,7 +342,7 @@ HwmpProtocolMac::ForwardPerr (std::vector<HwmpProtocol::FailedDestination> faile
elements.AddInformationElement(perr);
}
packet->AddHeader (elements);
packet->AddHeader (GetWifiMeshActionHeader ());
packet->AddHeader (GetWifiActionHeader ());
//create 802.11 header:
WifiMacHeader hdr;
hdr.SetAction ();

View File

@@ -27,11 +27,11 @@
namespace ns3 {
class MeshWifiInterfaceMac;
class WifiActionHeader;
namespace dot11s {
class HwmpProtocol;
class WifiMeshActionHeader;
class IePreq;
class IePrep;
class IePerr;
@@ -58,7 +58,7 @@ public:
private:
friend class HwmpProtocol;
///\returns a path selection action header
static WifiMeshActionHeader GetWifiMeshActionHeader ();
static WifiActionHeader GetWifiActionHeader ();
///\name Intercation with HWMP:
//\{
void SendPreq (IePreq preq);

View File

@@ -43,23 +43,23 @@ PeerLinkFrameStart::SetPlinkFrameStart (PeerLinkFrameStart::PlinkFrameStartField
{
m_subtype = fields.subtype;
m_protocol = fields.protocol;
if (m_subtype != (uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE))
if (m_subtype != (uint8_t) (WifiActionHeader::PEER_LINK_CLOSE))
{
m_capability = fields.capability;
}
if (m_subtype == (uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM))
if (m_subtype == (uint8_t) (WifiActionHeader::PEER_LINK_CONFIRM))
{
m_aid = fields.aid;
}
if (m_subtype != (uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE))
if (m_subtype != (uint8_t) (WifiActionHeader::PEER_LINK_CLOSE))
{
m_rates = fields.rates;
}
if (m_subtype != (uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM))
if (m_subtype != (uint8_t) (WifiActionHeader::PEER_LINK_CONFIRM))
{
m_meshId = fields.meshId;
}
if (m_subtype != (uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE))
if (m_subtype != (uint8_t) (WifiActionHeader::PEER_LINK_CLOSE))
{
m_config = fields.config;
}
@@ -109,23 +109,23 @@ PeerLinkFrameStart::GetSerializedSize () const
{
uint32_t size = 3; //Peering protocol
NS_ASSERT (m_subtype < 3);
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
size += 2; //capability
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) == m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype)
{
size += 2; //AID of remote peer
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
size += m_rates.GetSerializedSize ();
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype)
{
size += m_meshId.GetInformationSize () + 2;
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
size += m_config.GetInformationSize () + 2;
}
@@ -144,26 +144,26 @@ PeerLinkFrameStart::Serialize (Buffer::Iterator start) const
i.WriteU8 (m_protocol.GetInformationSize ());
m_protocol.SerializeInformation (i);
i.Next (m_protocol.GetInformationSize ());
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
i.WriteHtolsbU16 (m_capability);
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) == m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype)
{
i.WriteHtolsbU16 (m_aid);
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
i = m_rates.Serialize (i);
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype)
{
i.WriteU8 (IE11S_MESH_ID);
i.WriteU8 (m_meshId.GetInformationSize ());
m_meshId.SerializeInformation (i);
i.Next (m_meshId.GetInformationSize ());
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
i.WriteU8 (IE11S_MESH_CONFIGURATION);
i.WriteU8 (m_config.GetInformationSize ());
@@ -190,19 +190,19 @@ PeerLinkFrameStart::Deserialize (Buffer::Iterator start)
}
i.Next (m_protocol.GetInformationSize ());
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
m_capability = i.ReadLsbtohU16 ();
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) == m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype)
{
m_aid = i.ReadLsbtohU16 ();
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
i = m_rates.Deserialize (i);
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype)
{
uint8_t id = i.ReadU8 ();
uint8_t length = i.ReadU8 ();
@@ -213,7 +213,7 @@ PeerLinkFrameStart::Deserialize (Buffer::Iterator start)
}
i.Next (m_meshId.GetInformationSize ());
}
if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
if ((uint8_t) (WifiActionHeader::PEER_LINK_CLOSE) != m_subtype)
{
uint8_t id = i.ReadU8 ();
uint8_t length = i.ReadU8 ();

View File

@@ -84,11 +84,11 @@ PeerManagementProtocolMac::Receive (Ptr<Packet> const_packet, const WifiMacHeade
}
if (header.IsAction ())
{
WifiMeshActionHeader actionHdr;
WifiActionHeader actionHdr;
packet->RemoveHeader (actionHdr);
WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction ();
WifiActionHeader::ActionValue actionValue = actionHdr.GetAction ();
// If can not handle - just return;
if (actionHdr.GetCategory () != WifiMeshActionHeader::MESH_PEERING_MGT)
if (actionHdr.GetCategory () != WifiActionHeader::MESH_PEERING_MGT)
{
return m_protocol->IsActiveLink (m_ifIndex, header.GetAddr2 ());
}
@@ -104,7 +104,7 @@ PeerManagementProtocolMac::Receive (Ptr<Packet> const_packet, const WifiMacHeade
fields = peerFrame.GetFields ();
NS_ASSERT (fields.subtype == actionValue.peerLink);
}
if ((actionValue.peerLink != WifiMeshActionHeader::PEER_LINK_CLOSE) && !(m_parent->CheckSupportedRates (
if ((actionValue.peerLink != WifiActionHeader::PEER_LINK_CLOSE) && !(m_parent->CheckSupportedRates (
fields.rates)))
{
m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress);
@@ -112,7 +112,7 @@ PeerManagementProtocolMac::Receive (Ptr<Packet> const_packet, const WifiMacHeade
m_stats.brokenMgt++;
return false;
}
if ((actionValue.peerLink != WifiMeshActionHeader::PEER_LINK_CONFIRM) && !fields.meshId.IsEqual (
if ((actionValue.peerLink != WifiActionHeader::PEER_LINK_CONFIRM) && !fields.meshId.IsEqual (
*(m_protocol->GetMeshId ())))
{
m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress);
@@ -130,17 +130,17 @@ PeerManagementProtocolMac::Receive (Ptr<Packet> const_packet, const WifiMacHeade
if (peerElement->SubtypeIsOpen ())
{
m_stats.rxOpen++;
NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_OPEN);
NS_ASSERT (actionValue.peerLink == WifiActionHeader::PEER_LINK_OPEN);
}
if (peerElement->SubtypeIsConfirm ())
{
m_stats.rxConfirm++;
NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_CONFIRM);
NS_ASSERT (actionValue.peerLink == WifiActionHeader::PEER_LINK_CONFIRM);
}
if (peerElement->SubtypeIsClose ())
{
m_stats.rxClose++;
NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_CLOSE);
NS_ASSERT (actionValue.peerLink == WifiActionHeader::PEER_LINK_CLOSE);
}
//Deliver Peer link management frame to protocol:
m_protocol->ReceivePeerLinkFrame (m_ifIndex, peerAddress, peerMpAddress, fields.aid, *peerElement,
@@ -156,10 +156,10 @@ PeerManagementProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHead
{
if (header.IsAction ())
{
WifiMeshActionHeader actionHdr;
WifiActionHeader actionHdr;
packet->PeekHeader (actionHdr);
WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction ();
if (actionHdr.GetCategory () == WifiMeshActionHeader::MESH_PEERING_MGT)
WifiActionHeader::ActionValue actionValue = actionHdr.GetAction ();
if (actionHdr.GetCategory () == WifiActionHeader::MESH_PEERING_MGT)
{
return true;
}
@@ -211,32 +211,32 @@ PeerManagementProtocolMac::SendPeerLinkManagementFrame (Mac48Address peerAddress
PeerLinkFrameStart plinkFrame;
//Create an 802.11 frame header:
//Send management frame to MAC:
WifiMeshActionHeader actionHdr;
WifiActionHeader actionHdr;
if (peerElement.SubtypeIsOpen ())
{
m_stats.txOpen++;
WifiMeshActionHeader::ActionValue action;
action.peerLink = WifiMeshActionHeader::PEER_LINK_OPEN;
fields.subtype = WifiMeshActionHeader::PEER_LINK_OPEN;
actionHdr.SetAction (WifiMeshActionHeader::MESH_PEERING_MGT, action);
WifiActionHeader::ActionValue action;
action.peerLink = WifiActionHeader::PEER_LINK_OPEN;
fields.subtype = WifiActionHeader::PEER_LINK_OPEN;
actionHdr.SetAction (WifiActionHeader::MESH_PEERING_MGT, action);
}
if (peerElement.SubtypeIsConfirm ())
{
m_stats.txConfirm++;
WifiMeshActionHeader::ActionValue action;
action.peerLink = WifiMeshActionHeader::PEER_LINK_CONFIRM;
WifiActionHeader::ActionValue action;
action.peerLink = WifiActionHeader::PEER_LINK_CONFIRM;
fields.aid = aid;
fields.subtype = WifiMeshActionHeader::PEER_LINK_CONFIRM;
actionHdr.SetAction (WifiMeshActionHeader::MESH_PEERING_MGT, action);
fields.subtype = WifiActionHeader::PEER_LINK_CONFIRM;
actionHdr.SetAction (WifiActionHeader::MESH_PEERING_MGT, action);
}
if (peerElement.SubtypeIsClose ())
{
m_stats.txClose++;
WifiMeshActionHeader::ActionValue action;
action.peerLink = WifiMeshActionHeader::PEER_LINK_CLOSE;
fields.subtype = WifiMeshActionHeader::PEER_LINK_CLOSE;
WifiActionHeader::ActionValue action;
action.peerLink = WifiActionHeader::PEER_LINK_CLOSE;
fields.subtype = WifiActionHeader::PEER_LINK_CLOSE;
fields.reasonCode = peerElement.GetReasonCode ();
actionHdr.SetAction (WifiMeshActionHeader::MESH_PEERING_MGT, action);
actionHdr.SetAction (WifiActionHeader::MESH_PEERING_MGT, action);
}
plinkFrame.SetPlinkFrameStart (fields);
packet->AddHeader (plinkFrame);

View File

@@ -20,6 +20,7 @@
#include "ns3/test.h"
#include "ns3/packet.h"
#include "ns3/simulator.h"
#include "ns3/mgt-headers.h"
#include "../dot11s-mac-header.h"
#include "../hwmp-rtable.h"
#include "../peer-link-frame.h"
@@ -225,7 +226,7 @@ PeerLinkFrameStartTest::DoRun ()
{
PeerLinkFrameStart a;
PeerLinkFrameStart::PlinkFrameStartFields fields;
fields.subtype = (uint8_t) (WifiMeshActionHeader::PEER_LINK_OPEN);
fields.subtype = (uint8_t) (WifiActionHeader::PEER_LINK_OPEN);
fields.capability = 0;
fields.aid = 101;
fields.reasonCode = 12;
@@ -234,14 +235,14 @@ PeerLinkFrameStartTest::DoRun ()
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (a);
PeerLinkFrameStart b;
b.SetPlinkFrameSubtype ((uint8_t) (WifiMeshActionHeader::PEER_LINK_OPEN));
b.SetPlinkFrameSubtype ((uint8_t) (WifiActionHeader::PEER_LINK_OPEN));
packet->RemoveHeader (b);
NS_TEST_EXPECT_MSG_EQ (a, b, "PEER_LINK_OPEN works");
}
{
PeerLinkFrameStart a;
PeerLinkFrameStart::PlinkFrameStartFields fields;
fields.subtype = (uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM);
fields.subtype = (uint8_t) (WifiActionHeader::PEER_LINK_CONFIRM);
fields.capability = 0;
fields.aid = 1234;
fields.reasonCode = 12;
@@ -250,14 +251,14 @@ PeerLinkFrameStartTest::DoRun ()
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (a);
PeerLinkFrameStart b;
b.SetPlinkFrameSubtype ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM));
b.SetPlinkFrameSubtype ((uint8_t) (WifiActionHeader::PEER_LINK_CONFIRM));
packet->RemoveHeader (b);
NS_TEST_EXPECT_MSG_EQ (a, b, "PEER_LINK_CONFIRM works");
}
{
PeerLinkFrameStart a;
PeerLinkFrameStart::PlinkFrameStartFields fields;
fields.subtype = (uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE);
fields.subtype = (uint8_t) (WifiActionHeader::PEER_LINK_CLOSE);
fields.capability = 0;
fields.aid = 10;
fields.meshId = IeMeshId ("qqq");
@@ -266,7 +267,7 @@ PeerLinkFrameStartTest::DoRun ()
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (a);
PeerLinkFrameStart b;
b.SetPlinkFrameSubtype ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE));
b.SetPlinkFrameSubtype ((uint8_t) (WifiActionHeader::PEER_LINK_CLOSE));
packet->RemoveHeader (b);
NS_TEST_EXPECT_MSG_EQ (a, b, "PEER_LINK_CLOSE works");
}

View File

@@ -42,7 +42,7 @@ const bool WRITE_VECTORS = false;
const char * const PREFIX = "hwmp-target-flags-regression-test";
HwmpDoRfRegressionTest::HwmpDoRfRegressionTest () : TestCase ("HWMP proactive regression test"),
HwmpDoRfRegressionTest::HwmpDoRfRegressionTest () : TestCase ("HWMP target flags regression test"),
m_nodes (0),
m_time (Seconds (5))
{

View File

@@ -388,5 +388,144 @@ MgtAssocResponseHeader::Deserialize (Buffer::Iterator start)
i = m_rates.Deserialize (i);
return i.GetDistanceFrom (start);
}
/**********************************************************
* ActionFrame
**********************************************************/
WifiActionHeader::WifiActionHeader ()
{
}
WifiActionHeader::~WifiActionHeader ()
{
}
void
WifiActionHeader::SetAction (WifiActionHeader::CategoryValue type,
WifiActionHeader::ActionValue action)
{
m_category = type;
switch (type)
{
case MESH_PEERING_MGT:
{
m_actionValue = action.peerLink;
break;
}
case MESH_PATH_SELECTION:
{
m_actionValue = action.pathSelection;
break;
}
case MESH_LINK_METRIC:
case MESH_INTERWORKING:
case MESH_RESOURCE_COORDINATION:
case MESH_PROXY_FORWARDING:
break;
}
}
WifiActionHeader::CategoryValue
WifiActionHeader::GetCategory ()
{
switch (m_category)
{
case MESH_PEERING_MGT:
return MESH_PEERING_MGT;
case MESH_LINK_METRIC:
return MESH_LINK_METRIC;
case MESH_PATH_SELECTION:
return MESH_PATH_SELECTION;
case MESH_INTERWORKING:
return MESH_INTERWORKING;
case MESH_RESOURCE_COORDINATION:
return MESH_RESOURCE_COORDINATION;
case MESH_PROXY_FORWARDING:
return MESH_PROXY_FORWARDING;
default:
NS_FATAL_ERROR ("Unknown action value");
return MESH_PEERING_MGT;
}
}
WifiActionHeader::ActionValue
WifiActionHeader::GetAction ()
{
ActionValue retval;
retval.peerLink = PEER_LINK_OPEN; // Needs to be initialized to something to quiet valgrind in default cases
switch (m_category)
{
case MESH_PEERING_MGT:
switch (m_actionValue)
{
case PEER_LINK_OPEN:
retval.peerLink = PEER_LINK_OPEN;
return retval;
case PEER_LINK_CONFIRM:
retval.peerLink = PEER_LINK_CONFIRM;
return retval;
case PEER_LINK_CLOSE:
retval.peerLink = PEER_LINK_CLOSE;
return retval;
default:
NS_FATAL_ERROR ("Unknown mesh peering management action code");
retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
return retval;
}
case MESH_PATH_SELECTION:
switch (m_actionValue)
{
case PATH_SELECTION:
retval.pathSelection = PATH_SELECTION;
return retval;
default:
NS_FATAL_ERROR ("Unknown mesh path selection action code");
retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
return retval;
}
case MESH_LINK_METRIC:
// not yet supported
case MESH_INTERWORKING:
// not yet supported
case MESH_RESOURCE_COORDINATION:
// not yet supported
default:
NS_FATAL_ERROR ("Unsupported mesh action");
retval.peerLink = PEER_LINK_OPEN; /* quiet compiler */
return retval;
}
}
TypeId
WifiActionHeader::GetTypeId ()
{
static TypeId tid = TypeId ("ns3::WifiActionHeader")
.SetParent<Header> ()
.AddConstructor<WifiActionHeader> ();
return tid;
}
TypeId
WifiActionHeader::GetInstanceTypeId () const
{
return GetTypeId ();
}
void
WifiActionHeader::Print (std::ostream &os) const
{
}
uint32_t
WifiActionHeader::GetSerializedSize () const
{
return 2;
}
void
WifiActionHeader::Serialize (Buffer::Iterator start) const
{
start.WriteU8 (m_category);
start.WriteU8 (m_actionValue);
}
uint32_t
WifiActionHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
m_category = i.ReadU8 ();
m_actionValue = i.ReadU8 ();
return i.GetDistanceFrom (start);
}
} // namespace ns3

View File

@@ -134,6 +134,84 @@ private:
class MgtBeaconHeader : public MgtProbeResponseHeader {};
/**
* \brief See IEEE 802.11 chapter 7.3.1.11
*
* Header format: | category: 1 | action value: 1 |
*/
class WifiActionHeader : public Header
{
public:
WifiActionHeader ();
~WifiActionHeader ();
/* Compatible with open80211s implementation */
enum CategoryValue //table 7-24 staring from 4
{
MESH_PEERING_MGT = 30,
MESH_LINK_METRIC = 31,
MESH_PATH_SELECTION = 32,
MESH_INTERWORKING = 33,
MESH_RESOURCE_COORDINATION = 34,
MESH_PROXY_FORWARDING = 35,
};
/* Compatible with open80211s implementation */
enum PeerLinkMgtActionValue
{
PEER_LINK_OPEN = 0,
PEER_LINK_CONFIRM = 1,
PEER_LINK_CLOSE = 2,
};
enum LinkMetricActionValue
{
LINK_METRIC_REQUEST = 0,
LINK_METRIC_REPORT,
};
/* Compatible with open80211s implementation */
enum PathSelectionActionValue
{
PATH_SELECTION = 0,
};
enum InterworkActionValue
{
PORTAL_ANNOUNCEMENT = 0,
};
enum ResourceCoordinationActionValue
{
CONGESTION_CONTROL_NOTIFICATION = 0,
MDA_SETUP_REQUEST,
MDA_SETUP_REPLY,
MDAOP_ADVERTISMENT_REQUEST,
MDAOP_ADVERTISMENTS,
MDAOP_SET_TEARDOWN,
BEACON_TIMING_REQUEST,
BEACON_TIMING_RESPONSE,
TBTT_ADJUSTMENT_REQUEST,
MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
};
typedef union
{
enum PeerLinkMgtActionValue peerLink;
enum LinkMetricActionValue linkMetrtic;
enum PathSelectionActionValue pathSelection;
enum InterworkActionValue interwork;
enum ResourceCoordinationActionValue resourceCoordination;
} ActionValue;
void SetAction (enum CategoryValue type,ActionValue action);
CategoryValue GetCategory ();
ActionValue GetAction ();
static TypeId GetTypeId ();
virtual TypeId GetInstanceTypeId () const;
virtual void Print (std::ostream &os) const;
virtual uint32_t GetSerializedSize () const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
uint8_t m_category;
uint8_t m_actionValue;
};
} // namespace ns3