Restructured mesh configuration element

This commit is contained in:
Kirill Andreev
2009-05-22 13:58:39 +04:00
parent 1056863f4c
commit e9538480ae
5 changed files with 72 additions and 22 deletions

View File

@@ -81,7 +81,9 @@ IeConfiguration::IeConfiguration ():
m_APSId (PROTOCOL_HWMP),
m_APSMId (METRIC_AIRTIME),
m_CCMId (CONGESTION_DEFAULT),
m_CP (CHANNEL_PRECEDENCE_OFF)
m_SPId (SYNC_NEIGHBOUR_OFFSET),
m_APId (AUTH_NULL),
m_neighbors (0)
{}
TypeId
@@ -104,7 +106,9 @@ IeConfiguration::GetInformationSize () const
+ 4 // APSPId
+ 4 // APSMId
+ 4 // CCMId
+ 4 // CP
+ 4 // SPId
+ 4 // APId
+ 1 // Mesh formation info (see 7.3.2.86.6 of 802.11s draft 3.0)
+ m_meshCap.GetSerializedSize ();
}
@@ -117,9 +121,12 @@ IeConfiguration::SerializeInformation (Buffer::Iterator i) const
// Active Path Metric ID:
i.WriteHtonU32 (m_APSMId);
// Congestion Control Mode ID:
i.WriteU32 (m_CCMId);
// Channel Precedence:
i.WriteU32 (m_CP);
i.WriteHtonU32 (m_CCMId);
// Sync:
i.WriteHtonU32 (m_SPId);
// Auth:
i.WriteHtonU32 (m_APId);
i.WriteU8 (m_neighbors * 2);
m_meshCap.Serialize (i);
}
@@ -134,9 +141,10 @@ IeConfiguration::DeserializeInformation (Buffer::Iterator i, uint8_t length)
// Active Path Metric ID:
m_APSMId = (dot11sPathSelectionMetric)i.ReadNtohU32 ();
// Congestion Control Mode ID:
m_CCMId = (dot11sCongestionControlMode)i.ReadU32 ();
// Channel Precedence:
m_CP = (dot11sChannelPrecedence)i.ReadU32 ();
m_CCMId = (dot11sCongestionControlMode)i.ReadNtohU32 ();
m_SPId = (dot11sSynchronizationProtocolIdentifier)i.ReadNtohU32 ();
m_APId = (dot11sAuthenticationProtocol)i.ReadNtohU32 ();
m_neighbors = i.ReadU8 () / 2;
i = m_meshCap.Deserialize (i);
return i.GetDistanceFrom (start);
}
@@ -168,7 +176,16 @@ IeConfiguration::IsAirtime ()
{
return (m_APSMId == METRIC_AIRTIME);
}
void
IeConfiguration::SetNeighborCount (uint8_t neighbors)
{
m_neighbors = (neighbors > 31) ? 31 : neighbors;
}
uint8_t
IeConfiguration::GetNeighborCount ()
{
return m_neighbors;
}
dot11sMeshCapability const& IeConfiguration::MeshCapability ()
{
return m_meshCap;
@@ -190,7 +207,9 @@ bool operator== (const IeConfiguration & a, const IeConfiguration & b)
(a.m_APSId == b.m_APSId) &&
(a.m_APSMId == b.m_APSMId) &&
(a.m_CCMId == b.m_CCMId) &&
(a.m_CP == b.m_CP) &&
(a.m_SPId == b.m_SPId) &&
(a.m_APId == b.m_APId) &&
(a.m_neighbors == b.m_neighbors) &&
(a.m_meshCap == b.m_meshCap)
);
}

View File

@@ -29,7 +29,7 @@ namespace ns3 {
namespace dot11s {
/**
* \ingroup dot11s
* \brief See 7.3.2.81.1 in 802.11s draft 2.07
* \brief See 7.3.2.84.1 in 802.11s draft 3.0
*/
enum dot11sPathSelectionProtocol
{
@@ -38,7 +38,7 @@ enum dot11sPathSelectionProtocol
};
/**
* \ingroup dot11s
* \brief See 7.3.2.81.2 in 802.11s draft 2.07
* \brief See 7.3.2.84.2 in 802.11s draft 3.0
*/
enum dot11sPathSelectionMetric
{
@@ -47,7 +47,7 @@ enum dot11sPathSelectionMetric
};
/**
* \ingroup dot11s
* \brief See 7.3.2.81.3 in 802.11s draft 2.07
* \brief See 7.3.2.84.3 in 802.11s draft 3.0
*/
enum dot11sCongestionControlMode
{
@@ -56,7 +56,25 @@ enum dot11sCongestionControlMode
};
/**
* \ingroup dot11s
* \brief See 7.3.2.81.4 in 802.11s draft 2.07
* \brief See 7.3.2.86.4 in 802.11s draft 3.0
*/
enum dot11sSynchronizationProtocolIdentifier
{
SYNC_NEIGHBOUR_OFFSET = 0x000fac00,
SYNC_NULL = 0x000facff,
};
/**
* \ingroup dot11s
* \brief See 7.3.2.86.5 in 802.11s draft 3.0
*/
enum dot11sAuthenticationProtocol
{
AUTH_NULL = 0x000fac00,
AUTH_SAE = 0x000fac01,
};
/**
* \ingroup dot11s
* \brief See 7.3.2.84.4 in 802.11s draft 3.0
*/
enum dot11sChannelPrecedence
{
@@ -65,7 +83,7 @@ enum dot11sChannelPrecedence
/**
* \ingroup dot11s
* \brief See 7.3.2.81.5 in 802.11s draft 2.07
* \brief See 7.3.2.84.5 in 802.11s draft 3.0
*/
class dot11sMeshCapability
{
@@ -87,7 +105,7 @@ public:
/**
* \ingroup dot11s
* \brief Describes Mesh Configuration Element
* see 7.3.2.81 of 802.11s draft 2.07
* see 7.3.2.84 of 802.11s draft 3.0
*/
class IeConfiguration : public WifiInformationElement
{
@@ -96,10 +114,12 @@ public:
TypeId GetInstanceTypeId () const;
IeConfiguration ();
void SetRouting (dot11sPathSelectionProtocol routingId);
void SetMetric (dot11sPathSelectionMetric metricId);
bool IsHWMP ();
bool IsAirtime ();
void SetRouting (dot11sPathSelectionProtocol routingId);
void SetMetric (dot11sPathSelectionMetric metricId);
bool IsHWMP ();
bool IsAirtime ();
void SetNeighborCount (uint8_t neighbors);
uint8_t GetNeighborCount ();
dot11sMeshCapability const& MeshCapability ();
private:
@@ -118,9 +138,12 @@ private:
dot11sPathSelectionMetric m_APSMId;
/** Congestion Control Mode ID */
dot11sCongestionControlMode m_CCMId;
/* Channel Precedence */
dot11sChannelPrecedence m_CP;
/** Sync protocol ID */
dot11sSynchronizationProtocolIdentifier m_SPId;
/** Auth protocol ID */
dot11sAuthenticationProtocol m_APId;
dot11sMeshCapability m_meshCap;
uint8_t m_neighbors;
friend bool operator== (const IeConfiguration & a, const IeConfiguration & b);
};
bool operator== (const IeConfiguration & a, const IeConfiguration & b);

View File

@@ -177,6 +177,7 @@ PeerManagerMacPlugin::SendPeerLinkManagementFrame(
)
{
//Create a packet:
meshConfig.SetNeighborCount (m_protocol->GetNumberOfLinks ());
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (peerElement);
PeerLinkFrameStart::PlinkFrameStartFields fields;

View File

@@ -467,6 +467,11 @@ PeerManagementProtocol::PeerLinkStatus (uint32_t interface, Mac48Address peerAdd
if(!m_peerStatusCallback.IsNull ())
m_peerStatusCallback (peerMeshPointAddress, peerAddress, interface, status);
}
uint8_t
PeerManagementProtocol::GetNumberOfLinks ()
{
return m_numberOfActivePeers;
}
Mac48Address
PeerManagementProtocol::GetAddress ()
{

View File

@@ -134,6 +134,8 @@ public:
std::vector<Mac48Address> GetActiveLinks(uint32_t interface);
///\brief needed by plugins to set global source address
Mac48Address GetAddress ();
///\Needed to fill mesh configuration
uint8_t GetNumberOfLinks ();
///\brief: Report statistics
void Report (std::ostream &) const;
void ResetStats ();