Restructured files - unfinished
This commit is contained in:
341
src/devices/wifi/mesh-wifi-mac-header.cc
Normal file
341
src/devices/wifi/mesh-wifi-mac-header.cc
Normal file
@@ -0,0 +1,341 @@
|
||||
#include "ns3/assert.h"
|
||||
#include "ns3/address-utils.h"
|
||||
#include "mesh-wifi-mac-header.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/***********************************************************
|
||||
* Here Mesh Mac Header functionality is defined.
|
||||
***********************************************************/
|
||||
TypeId
|
||||
WifiMeshHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::WifiMeshHeader")
|
||||
.SetParent<Header> ()
|
||||
.AddConstructor<WifiMeshHeader> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
WifiMeshHeader::WifiMeshHeader()
|
||||
{
|
||||
m_meshFlags = 0;
|
||||
}
|
||||
|
||||
WifiMeshHeader::~WifiMeshHeader()
|
||||
{
|
||||
}
|
||||
|
||||
TypeId
|
||||
WifiMeshHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetAddr5 (Mac48Address address)
|
||||
{
|
||||
m_addr5 = address;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetAddr6 (Mac48Address address)
|
||||
{
|
||||
m_addr6 = address;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetAddr7 (Mac48Address address)
|
||||
{
|
||||
m_addr7 = address;
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
WifiMeshHeader::GetAddr5 ()
|
||||
{
|
||||
return m_addr5;
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
WifiMeshHeader::GetAddr6 ()
|
||||
{
|
||||
return m_addr6;
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
WifiMeshHeader::GetAddr7 ()
|
||||
{
|
||||
return m_addr7;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetMeshSeqno (uint32_t seqno)
|
||||
{
|
||||
m_meshSeqno = seqno;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WifiMeshHeader::GetMeshSeqno ()
|
||||
{
|
||||
return m_meshSeqno;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetMeshTtl (uint8_t TTL)
|
||||
{
|
||||
m_meshTtl = TTL;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
WifiMeshHeader::GetMeshTtl ()
|
||||
{
|
||||
return m_meshTtl;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetAddressExt (uint8_t num_of_addresses)
|
||||
{
|
||||
if (num_of_addresses > 3)
|
||||
return;
|
||||
m_meshFlags = 0xc0 | (num_of_addresses << 6);
|
||||
}
|
||||
|
||||
uint8_t
|
||||
WifiMeshHeader::GetAddressExt ()
|
||||
{
|
||||
return ((0xc0 & m_meshFlags) >> 6);
|
||||
}
|
||||
|
||||
|
||||
uint32_t
|
||||
WifiMeshHeader::GetSerializedSize (void) const
|
||||
{
|
||||
return 6 + ((0xc0 & m_meshFlags) >> 6)*6;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::Serialize (Buffer::Iterator start) const
|
||||
{
|
||||
Buffer::Iterator i = start;
|
||||
i.WriteU8(m_meshFlags);
|
||||
i.WriteU8(m_meshTtl);
|
||||
i.WriteU32(m_meshSeqno);
|
||||
uint8_t addresses_to_add = (m_meshFlags & 0xc0) >> 6;
|
||||
//Writing Address extensions:
|
||||
if(addresses_to_add > 0)
|
||||
WriteTo (i, m_addr5);
|
||||
if(addresses_to_add > 1)
|
||||
WriteTo (i, m_addr6);
|
||||
if(addresses_to_add > 2)
|
||||
WriteTo (i, m_addr7);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WifiMeshHeader::Deserialize (Buffer::Iterator start)
|
||||
{
|
||||
Buffer::Iterator i = start;
|
||||
uint8_t addresses_to_read = 0;
|
||||
m_meshFlags = i.ReadU8();
|
||||
m_meshTtl = i.ReadU8();
|
||||
m_meshSeqno = i.ReadU32();
|
||||
addresses_to_read = (m_meshFlags & 0xc0) >> 6;
|
||||
if(addresses_to_read > 0)
|
||||
ReadFrom (i, m_addr5);
|
||||
if(addresses_to_read > 1)
|
||||
ReadFrom (i, m_addr6);
|
||||
if(addresses_to_read > 2)
|
||||
ReadFrom (i, m_addr7);
|
||||
return i.GetDistanceFrom(start);
|
||||
}
|
||||
void
|
||||
WifiMeshHeader::Print (std::ostream &os) const
|
||||
{
|
||||
os << "flags" << m_meshFlags
|
||||
<< "ttl" << m_meshTtl
|
||||
<< "seqno" << m_meshSeqno;
|
||||
}
|
||||
/**********************************************************
|
||||
* MultihopActionFrame
|
||||
**********************************************************/
|
||||
WifiMeshMultihopActionHeader::WifiMeshMultihopActionHeader ()
|
||||
{
|
||||
}
|
||||
|
||||
WifiMeshMultihopActionHeader::~WifiMeshMultihopActionHeader ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshMultihopActionHeader::SetAction(
|
||||
enum WifiMeshMultihopActionHeader::CategoryValue type,
|
||||
WifiMeshMultihopActionHeader::ACTION_VALUE action)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case MESH_PEER_LINK_MGT:
|
||||
m_category = 4;
|
||||
switch (action.peerLink)
|
||||
{
|
||||
case PEER_LINK_OPEN:
|
||||
m_actionValue = 0;
|
||||
break;
|
||||
case PEER_LINK_CONFIRM:
|
||||
m_actionValue = 1;
|
||||
break;
|
||||
case PEER_LINK_CLOSE:
|
||||
m_actionValue = 2;
|
||||
break;
|
||||
};
|
||||
break;
|
||||
case MESH_LINK_METRIC:
|
||||
m_category = 5;
|
||||
break;
|
||||
case MESH_PATH_SELECTION:
|
||||
m_category = 6;
|
||||
switch(action.pathSelection)
|
||||
{
|
||||
case PATH_REQUEST:
|
||||
m_actionValue = 0;
|
||||
break;
|
||||
case PATH_REPLY:
|
||||
m_actionValue = 1;
|
||||
break;
|
||||
case PATH_ERROR:
|
||||
m_actionValue = 2;
|
||||
break;
|
||||
case ROOT_ANNOUNCEMENT:
|
||||
m_actionValue = 3;
|
||||
break;
|
||||
};
|
||||
break;
|
||||
case MESH_INTERWORK_ACTION:
|
||||
m_category = 7;
|
||||
break;
|
||||
case MESH_RESOURCE_COORDINATION:
|
||||
m_category = 8;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
enum WifiMeshMultihopActionHeader::CategoryValue
|
||||
WifiMeshMultihopActionHeader::GetCategory()
|
||||
{
|
||||
switch(m_category)
|
||||
{
|
||||
case 4:
|
||||
return MESH_PEER_LINK_MGT;
|
||||
case 5:
|
||||
return MESH_LINK_METRIC;
|
||||
case 6:
|
||||
return MESH_PATH_SELECTION;
|
||||
case 7:
|
||||
return MESH_INTERWORK_ACTION;
|
||||
case 8:
|
||||
return MESH_RESOURCE_COORDINATION;
|
||||
default:
|
||||
NS_ASSERT(false);
|
||||
return MESH_PEER_LINK_MGT;
|
||||
}
|
||||
}
|
||||
|
||||
WifiMeshMultihopActionHeader::ACTION_VALUE
|
||||
WifiMeshMultihopActionHeader::GetAction()
|
||||
{
|
||||
ACTION_VALUE retval;
|
||||
switch(m_category)
|
||||
{
|
||||
case 4:
|
||||
//MESH_PEER_LINK_MGT;
|
||||
switch(m_actionValue)
|
||||
{
|
||||
case 0:
|
||||
retval.peerLink = PEER_LINK_OPEN;
|
||||
return retval;
|
||||
case 1:
|
||||
retval.peerLink = PEER_LINK_CONFIRM;
|
||||
return retval;
|
||||
case 2:
|
||||
retval.peerLink = PEER_LINK_CLOSE;
|
||||
return retval;
|
||||
default:
|
||||
NS_ASSERT(false);
|
||||
return retval;
|
||||
|
||||
}
|
||||
case 5:
|
||||
//MESH_LINK_METRIC;
|
||||
case 6:
|
||||
//MESH_PATH_SELECTION;
|
||||
switch(m_actionValue)
|
||||
{
|
||||
case 0:
|
||||
retval.pathSelection = PATH_REQUEST;
|
||||
return retval;
|
||||
case 1:
|
||||
retval.pathSelection = PATH_REPLY;
|
||||
return retval;
|
||||
case 2:
|
||||
retval.pathSelection = PATH_ERROR;
|
||||
return retval;
|
||||
case 3:
|
||||
retval.pathSelection = ROOT_ANNOUNCEMENT;
|
||||
return retval;
|
||||
default:
|
||||
NS_ASSERT(false);
|
||||
return retval;
|
||||
}
|
||||
|
||||
case 7:
|
||||
//MESH_INTERWORK_ACTION;
|
||||
case 8:
|
||||
//MESH_RESOURCE_COORDINATION;
|
||||
default:
|
||||
NS_ASSERT(false);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
TypeId
|
||||
WifiMeshMultihopActionHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::WifiMeshMultihopActionHeader")
|
||||
.SetParent<Header> ()
|
||||
.AddConstructor<WifiMeshMultihopActionHeader> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
TypeId
|
||||
WifiMeshMultihopActionHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId();
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshMultihopActionHeader::Print (std::ostream &os) const
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WifiMeshMultihopActionHeader::GetSerializedSize (void) const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshMultihopActionHeader::Serialize (Buffer::Iterator start) const
|
||||
{
|
||||
start.WriteU8(m_category);
|
||||
start.WriteU8(m_actionValue);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WifiMeshMultihopActionHeader::Deserialize (Buffer::Iterator start)
|
||||
{
|
||||
Buffer::Iterator i = start;
|
||||
m_category = i.ReadU8();
|
||||
m_actionValue = i.ReadU8();
|
||||
return i.GetDistanceFrom(start);
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
124
src/devices/wifi/mesh-wifi-mac-header.h
Normal file
124
src/devices/wifi/mesh-wifi-mac-header.h
Normal file
@@ -0,0 +1,124 @@
|
||||
#ifndef WIFI_MAC_HEADER_H
|
||||
#define WIFI_MAC_HEADER_H
|
||||
|
||||
#include "ns3/header.h"
|
||||
#include "ns3/mac48-address.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include <stdint.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class WifiMeshHeader : public Header //7.1.3.5b
|
||||
{
|
||||
public:
|
||||
WifiMeshHeader ();
|
||||
~WifiMeshHeader ();
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
virtual void Print (std::ostream &os) const;
|
||||
|
||||
void SetAddr5 (Mac48Address address);
|
||||
void SetAddr6 (Mac48Address address);
|
||||
void SetAddr7 (Mac48Address address);
|
||||
Mac48Address GetAddr5 ();
|
||||
Mac48Address GetAddr6 ();
|
||||
Mac48Address GetAddr7 ();
|
||||
|
||||
void SetMeshSeqno (uint32_t seqno);
|
||||
uint32_t GetMeshSeqno ();
|
||||
|
||||
void SetMeshTtl (uint8_t TTL);
|
||||
uint8_t GetMeshTtl ();
|
||||
|
||||
void SetAddressExt (uint8_t num_of_addresses);
|
||||
uint8_t GetAddressExt ();
|
||||
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
private:
|
||||
uint8_t m_meshFlags;
|
||||
uint8_t m_meshTtl;
|
||||
uint32_t m_meshSeqno;
|
||||
Mac48Address m_addr5;
|
||||
Mac48Address m_addr6;
|
||||
Mac48Address m_addr7;
|
||||
};
|
||||
class WifiMeshMultihopActionHeader : public Header //7.2.3.14
|
||||
{
|
||||
//Multichop action frame consists of Mesh header, Action, and
|
||||
//the last information. Mesh header is present within all data
|
||||
//frames and multihop action frames, so Mesh header is a
|
||||
//separate structure. Each MultihopAction frames (frames like
|
||||
//PREQ, PREP and other) start form Category field and Action
|
||||
//value field, so the Multihop Action Frame should containt
|
||||
//three fields: Category, Action Value;
|
||||
public:
|
||||
WifiMeshMultihopActionHeader ();
|
||||
~WifiMeshMultihopActionHeader ();
|
||||
enum CategoryValue //table 7-24 staring from 4
|
||||
{
|
||||
MESH_PEER_LINK_MGT =4,
|
||||
MESH_LINK_METRIC,
|
||||
MESH_PATH_SELECTION,
|
||||
MESH_INTERWORK_ACTION,
|
||||
MESH_RESOURCE_COORDINATION,
|
||||
};
|
||||
enum PeerLinkMgtActionValue
|
||||
{
|
||||
PEER_LINK_OPEN = 0,
|
||||
PEER_LINK_CONFIRM,
|
||||
PEER_LINK_CLOSE,
|
||||
};
|
||||
enum LinkMetricActionValue
|
||||
{
|
||||
LINK_METRIC_REQUEST = 0,
|
||||
LINK_METRIC_REPORT,
|
||||
};
|
||||
enum PathSelectionActionValue
|
||||
{
|
||||
PATH_REQUEST = 0,
|
||||
PATH_REPLY,
|
||||
PATH_ERROR,
|
||||
ROOT_ANNOUNCEMENT,
|
||||
};
|
||||
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_ADJASTMENT_REQUEST,
|
||||
MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
|
||||
};
|
||||
typedef union
|
||||
{
|
||||
enum PeerLinkMgtActionValue peerLink;
|
||||
enum LinkMetricActionValue linkMetrtic;
|
||||
enum PathSelectionActionValue pathSelection;
|
||||
enum InterworkActionValue interwork;
|
||||
enum ResourceCoordinationActionValue resourceCoordination;
|
||||
} ACTION_VALUE;
|
||||
void SetAction(enum CategoryValue type,ACTION_VALUE action);
|
||||
enum CategoryValue GetCategory();
|
||||
ACTION_VALUE GetAction();
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
virtual void Print (std::ostream &os) const;
|
||||
virtual uint32_t GetSerializedSize (void) 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
|
||||
#endif /* WIFI_MAC_HEADER_H */
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "mesh-wifi-mac.h"
|
||||
#include "dca-txop.h"
|
||||
#include "wifi-mac-header.h"
|
||||
#include "mesh-wifi-mac-header.h"
|
||||
#include "mgt-headers.h"
|
||||
#include "wifi-phy.h"
|
||||
#include "dcf-manager.h"
|
||||
|
||||
@@ -980,338 +980,4 @@ WifiMacHeader::Deserialize (Buffer::Iterator start)
|
||||
return i.GetDistanceFrom (start);
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* Here Mesh Mac Header functionality is defined.
|
||||
***********************************************************/
|
||||
TypeId
|
||||
WifiMeshHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::WifiMeshHeader")
|
||||
.SetParent<Header> ()
|
||||
.AddConstructor<WifiMeshHeader> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
WifiMeshHeader::WifiMeshHeader()
|
||||
{
|
||||
m_meshFlags = 0;
|
||||
}
|
||||
|
||||
WifiMeshHeader::~WifiMeshHeader()
|
||||
{
|
||||
}
|
||||
|
||||
TypeId
|
||||
WifiMeshHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId ();
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetAddr5 (Mac48Address address)
|
||||
{
|
||||
m_addr5 = address;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetAddr6 (Mac48Address address)
|
||||
{
|
||||
m_addr6 = address;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetAddr7 (Mac48Address address)
|
||||
{
|
||||
m_addr7 = address;
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
WifiMeshHeader::GetAddr5 ()
|
||||
{
|
||||
return m_addr5;
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
WifiMeshHeader::GetAddr6 ()
|
||||
{
|
||||
return m_addr6;
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
WifiMeshHeader::GetAddr7 ()
|
||||
{
|
||||
return m_addr7;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetMeshSeqno (uint32_t seqno)
|
||||
{
|
||||
m_meshSeqno = seqno;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WifiMeshHeader::GetMeshSeqno ()
|
||||
{
|
||||
return m_meshSeqno;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetMeshTtl (uint8_t TTL)
|
||||
{
|
||||
m_meshTtl = TTL;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
WifiMeshHeader::GetMeshTtl ()
|
||||
{
|
||||
return m_meshTtl;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::SetAddressExt (uint8_t num_of_addresses)
|
||||
{
|
||||
if (num_of_addresses > 3)
|
||||
return;
|
||||
m_meshFlags = 0xc0 | (num_of_addresses << 6);
|
||||
}
|
||||
|
||||
uint8_t
|
||||
WifiMeshHeader::GetAddressExt ()
|
||||
{
|
||||
return ((0xc0 & m_meshFlags) >> 6);
|
||||
}
|
||||
|
||||
|
||||
uint32_t
|
||||
WifiMeshHeader::GetSerializedSize (void) const
|
||||
{
|
||||
return 6 + ((0xc0 & m_meshFlags) >> 6)*6;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshHeader::Serialize (Buffer::Iterator start) const
|
||||
{
|
||||
Buffer::Iterator i = start;
|
||||
i.WriteU8(m_meshFlags);
|
||||
i.WriteU8(m_meshTtl);
|
||||
i.WriteU32(m_meshSeqno);
|
||||
uint8_t addresses_to_add = (m_meshFlags & 0xc0) >> 6;
|
||||
//Writing Address extensions:
|
||||
if(addresses_to_add > 0)
|
||||
WriteTo (i, m_addr5);
|
||||
if(addresses_to_add > 1)
|
||||
WriteTo (i, m_addr6);
|
||||
if(addresses_to_add > 2)
|
||||
WriteTo (i, m_addr7);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WifiMeshHeader::Deserialize (Buffer::Iterator start)
|
||||
{
|
||||
Buffer::Iterator i = start;
|
||||
uint8_t addresses_to_read = 0;
|
||||
m_meshFlags = i.ReadU8();
|
||||
m_meshTtl = i.ReadU8();
|
||||
m_meshSeqno = i.ReadU32();
|
||||
addresses_to_read = (m_meshFlags & 0xc0) >> 6;
|
||||
if(addresses_to_read > 0)
|
||||
ReadFrom (i, m_addr5);
|
||||
if(addresses_to_read > 1)
|
||||
ReadFrom (i, m_addr6);
|
||||
if(addresses_to_read > 2)
|
||||
ReadFrom (i, m_addr7);
|
||||
return i.GetDistanceFrom(start);
|
||||
}
|
||||
void
|
||||
WifiMeshHeader::Print (std::ostream &os) const
|
||||
{
|
||||
os << "flags" << m_meshFlags
|
||||
<< "ttl" << m_meshTtl
|
||||
<< "seqno" << m_meshSeqno;
|
||||
}
|
||||
/**********************************************************
|
||||
* MultihopActionFrame
|
||||
**********************************************************/
|
||||
WifiMeshMultihopActionHeader::WifiMeshMultihopActionHeader ()
|
||||
{
|
||||
}
|
||||
|
||||
WifiMeshMultihopActionHeader::~WifiMeshMultihopActionHeader ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshMultihopActionHeader::SetAction(
|
||||
enum WifiMeshMultihopActionHeader::CategoryValue type,
|
||||
WifiMeshMultihopActionHeader::ACTION_VALUE action)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case MESH_PEER_LINK_MGT:
|
||||
m_category = 4;
|
||||
switch (action.peerLink)
|
||||
{
|
||||
case PEER_LINK_OPEN:
|
||||
m_actionValue = 0;
|
||||
break;
|
||||
case PEER_LINK_CONFIRM:
|
||||
m_actionValue = 1;
|
||||
break;
|
||||
case PEER_LINK_CLOSE:
|
||||
m_actionValue = 2;
|
||||
break;
|
||||
};
|
||||
break;
|
||||
case MESH_LINK_METRIC:
|
||||
m_category = 5;
|
||||
break;
|
||||
case MESH_PATH_SELECTION:
|
||||
m_category = 6;
|
||||
switch(action.pathSelection)
|
||||
{
|
||||
case PATH_REQUEST:
|
||||
m_actionValue = 0;
|
||||
break;
|
||||
case PATH_REPLY:
|
||||
m_actionValue = 1;
|
||||
break;
|
||||
case PATH_ERROR:
|
||||
m_actionValue = 2;
|
||||
break;
|
||||
case ROOT_ANNOUNCEMENT:
|
||||
m_actionValue = 3;
|
||||
break;
|
||||
};
|
||||
break;
|
||||
case MESH_INTERWORK_ACTION:
|
||||
m_category = 7;
|
||||
break;
|
||||
case MESH_RESOURCE_COORDINATION:
|
||||
m_category = 8;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
enum WifiMeshMultihopActionHeader::CategoryValue
|
||||
WifiMeshMultihopActionHeader::GetCategory()
|
||||
{
|
||||
switch(m_category)
|
||||
{
|
||||
case 4:
|
||||
return MESH_PEER_LINK_MGT;
|
||||
case 5:
|
||||
return MESH_LINK_METRIC;
|
||||
case 6:
|
||||
return MESH_PATH_SELECTION;
|
||||
case 7:
|
||||
return MESH_INTERWORK_ACTION;
|
||||
case 8:
|
||||
return MESH_RESOURCE_COORDINATION;
|
||||
default:
|
||||
NS_ASSERT(false);
|
||||
return MESH_PEER_LINK_MGT;
|
||||
}
|
||||
}
|
||||
|
||||
WifiMeshMultihopActionHeader::ACTION_VALUE
|
||||
WifiMeshMultihopActionHeader::GetAction()
|
||||
{
|
||||
ACTION_VALUE retval;
|
||||
switch(m_category)
|
||||
{
|
||||
case 4:
|
||||
//MESH_PEER_LINK_MGT;
|
||||
switch(m_actionValue)
|
||||
{
|
||||
case 0:
|
||||
retval.peerLink = PEER_LINK_OPEN;
|
||||
return retval;
|
||||
case 1:
|
||||
retval.peerLink = PEER_LINK_CONFIRM;
|
||||
return retval;
|
||||
case 2:
|
||||
retval.peerLink = PEER_LINK_CLOSE;
|
||||
return retval;
|
||||
default:
|
||||
NS_ASSERT(false);
|
||||
return retval;
|
||||
|
||||
}
|
||||
case 5:
|
||||
//MESH_LINK_METRIC;
|
||||
case 6:
|
||||
//MESH_PATH_SELECTION;
|
||||
switch(m_actionValue)
|
||||
{
|
||||
case 0:
|
||||
retval.pathSelection = PATH_REQUEST;
|
||||
return retval;
|
||||
case 1:
|
||||
retval.pathSelection = PATH_REPLY;
|
||||
return retval;
|
||||
case 2:
|
||||
retval.pathSelection = PATH_ERROR;
|
||||
return retval;
|
||||
case 3:
|
||||
retval.pathSelection = ROOT_ANNOUNCEMENT;
|
||||
return retval;
|
||||
default:
|
||||
NS_ASSERT(false);
|
||||
return retval;
|
||||
}
|
||||
|
||||
case 7:
|
||||
//MESH_INTERWORK_ACTION;
|
||||
case 8:
|
||||
//MESH_RESOURCE_COORDINATION;
|
||||
default:
|
||||
NS_ASSERT(false);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
TypeId
|
||||
WifiMeshMultihopActionHeader::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::WifiMeshMultihopActionHeader")
|
||||
.SetParent<Header> ()
|
||||
.AddConstructor<WifiMeshMultihopActionHeader> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
TypeId
|
||||
WifiMeshMultihopActionHeader::GetInstanceTypeId (void) const
|
||||
{
|
||||
return GetTypeId();
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshMultihopActionHeader::Print (std::ostream &os) const
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WifiMeshMultihopActionHeader::GetSerializedSize (void) const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
void
|
||||
WifiMeshMultihopActionHeader::Serialize (Buffer::Iterator start) const
|
||||
{
|
||||
start.WriteU8(m_category);
|
||||
start.WriteU8(m_actionValue);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WifiMeshMultihopActionHeader::Deserialize (Buffer::Iterator start)
|
||||
{
|
||||
Buffer::Iterator i = start;
|
||||
m_category = i.ReadU8();
|
||||
m_actionValue = i.ReadU8();
|
||||
return i.GetDistanceFrom(start);
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -180,120 +180,5 @@ private:
|
||||
uint8_t m_qosAckPolicy;
|
||||
uint16_t m_qosStuff;
|
||||
};
|
||||
class WifiMeshHeader : public Header //7.1.3.5b
|
||||
{
|
||||
public:
|
||||
WifiMeshHeader ();
|
||||
~WifiMeshHeader ();
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
virtual void Print (std::ostream &os) const;
|
||||
|
||||
void SetAddr5 (Mac48Address address);
|
||||
void SetAddr6 (Mac48Address address);
|
||||
void SetAddr7 (Mac48Address address);
|
||||
Mac48Address GetAddr5 ();
|
||||
Mac48Address GetAddr6 ();
|
||||
Mac48Address GetAddr7 ();
|
||||
|
||||
void SetMeshSeqno (uint32_t seqno);
|
||||
uint32_t GetMeshSeqno ();
|
||||
|
||||
void SetMeshTtl (uint8_t TTL);
|
||||
uint8_t GetMeshTtl ();
|
||||
|
||||
void SetAddressExt (uint8_t num_of_addresses);
|
||||
uint8_t GetAddressExt ();
|
||||
|
||||
virtual uint32_t GetSerializedSize (void) const;
|
||||
virtual void Serialize (Buffer::Iterator start) const;
|
||||
virtual uint32_t Deserialize (Buffer::Iterator start);
|
||||
private:
|
||||
uint8_t m_meshFlags;
|
||||
uint8_t m_meshTtl;
|
||||
uint32_t m_meshSeqno;
|
||||
Mac48Address m_addr5;
|
||||
Mac48Address m_addr6;
|
||||
Mac48Address m_addr7;
|
||||
};
|
||||
class WifiMeshMultihopActionHeader : public Header //7.2.3.14
|
||||
{
|
||||
//Multichop action frame consists of Mesh header, Action, and
|
||||
//the last information. Mesh header is present within all data
|
||||
//frames and multihop action frames, so Mesh header is a
|
||||
//separate structure. Each MultihopAction frames (frames like
|
||||
//PREQ, PREP and other) start form Category field and Action
|
||||
//value field, so the Multihop Action Frame should containt
|
||||
//three fields: Category, Action Value;
|
||||
public:
|
||||
WifiMeshMultihopActionHeader ();
|
||||
~WifiMeshMultihopActionHeader ();
|
||||
enum CategoryValue //table 7-24 staring from 4
|
||||
{
|
||||
MESH_PEER_LINK_MGT =4,
|
||||
MESH_LINK_METRIC,
|
||||
MESH_PATH_SELECTION,
|
||||
MESH_INTERWORK_ACTION,
|
||||
MESH_RESOURCE_COORDINATION,
|
||||
};
|
||||
enum PeerLinkMgtActionValue
|
||||
{
|
||||
PEER_LINK_OPEN = 0,
|
||||
PEER_LINK_CONFIRM,
|
||||
PEER_LINK_CLOSE,
|
||||
};
|
||||
enum LinkMetricActionValue
|
||||
{
|
||||
LINK_METRIC_REQUEST = 0,
|
||||
LINK_METRIC_REPORT,
|
||||
};
|
||||
enum PathSelectionActionValue
|
||||
{
|
||||
PATH_REQUEST = 0,
|
||||
PATH_REPLY,
|
||||
PATH_ERROR,
|
||||
ROOT_ANNOUNCEMENT,
|
||||
};
|
||||
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_ADJASTMENT_REQUEST,
|
||||
MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
|
||||
};
|
||||
typedef union
|
||||
{
|
||||
enum PeerLinkMgtActionValue peerLink;
|
||||
enum LinkMetricActionValue linkMetrtic;
|
||||
enum PathSelectionActionValue pathSelection;
|
||||
enum InterworkActionValue interwork;
|
||||
enum ResourceCoordinationActionValue resourceCoordination;
|
||||
} ACTION_VALUE;
|
||||
void SetAction(enum CategoryValue type,ACTION_VALUE action);
|
||||
enum CategoryValue GetCategory();
|
||||
ACTION_VALUE GetAction();
|
||||
static TypeId GetTypeId (void);
|
||||
virtual TypeId GetInstanceTypeId (void) const;
|
||||
virtual void Print (std::ostream &os) const;
|
||||
virtual uint32_t GetSerializedSize (void) 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
|
||||
|
||||
|
||||
|
||||
#endif /* WIFI_MAC_HEADER_H */
|
||||
|
||||
@@ -18,6 +18,7 @@ def build(bld):
|
||||
'yans-wifi-phy.cc',
|
||||
'yans-wifi-channel.cc',
|
||||
'wifi-mac-header.cc',
|
||||
'mesh-wifi-mac-header.cc',
|
||||
'wifi-mac-trailer.cc',
|
||||
'mac-low.cc',
|
||||
'wifi-mac-queue.cc',
|
||||
|
||||
Reference in New Issue
Block a user