Restructured PREQ and PREP
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
TODO: delete me when first useful file will be created here
|
||||
This is a placeholder file used only to keep the 802.11s directory present.
|
||||
@@ -129,7 +129,7 @@ MeshConfigurationElement::SerializeInformation (Buffer::Iterator i) const
|
||||
m_meshCap.Serialize (i);
|
||||
}
|
||||
|
||||
uint8_t
|
||||
uint16_t
|
||||
MeshConfigurationElement::DeserializeInformation (Buffer::Iterator i, uint8_t length)
|
||||
{
|
||||
Buffer::Iterator start = i;
|
||||
|
||||
@@ -106,7 +106,7 @@ protected:
|
||||
uint16_t GetInformationSize () const;
|
||||
uint8_t GetLengthField () const;
|
||||
void SerializeInformation (Buffer::Iterator i) const;
|
||||
uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
|
||||
uint16_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
|
||||
void PrintInformation(std::ostream& os) const;
|
||||
// TODO: Release and fill other fields in configuration
|
||||
// element
|
||||
|
||||
@@ -163,10 +163,8 @@ WifiPrepInformationElement::IncrementMetric(uint32_t metric)
|
||||
|
||||
|
||||
void
|
||||
WifiPrepInformationElement::Serialize(Buffer::Iterator i) const
|
||||
WifiPrepInformationElement::SerializeInformation(Buffer::Iterator i) const
|
||||
{
|
||||
i.WriteU8 (ElementId());
|
||||
i.WriteU8 (32);//length = 32
|
||||
i.WriteU8 (m_flags);
|
||||
i.WriteU8 (m_hopcount);
|
||||
i.WriteU8 (m_ttl);
|
||||
@@ -177,12 +175,10 @@ WifiPrepInformationElement::Serialize(Buffer::Iterator i) const
|
||||
WriteTo (i, m_originatorAddress);
|
||||
i.WriteHtonU32 (m_originatorSeqNumber);
|
||||
}
|
||||
uint32_t
|
||||
WifiPrepInformationElement::Deserialize(Buffer::Iterator start)
|
||||
uint16_t
|
||||
WifiPrepInformationElement::DeserializeInformation(Buffer::Iterator start, uint8_t length)
|
||||
{
|
||||
Buffer::Iterator i = start;
|
||||
NS_ASSERT (ElementId() == i.ReadU8());
|
||||
i.Next (1); // length is constatnt
|
||||
m_flags = i.ReadU8();
|
||||
m_hopcount = i.ReadU8();
|
||||
m_ttl = i.ReadU8();
|
||||
@@ -194,8 +190,8 @@ WifiPrepInformationElement::Deserialize(Buffer::Iterator start)
|
||||
m_originatorSeqNumber = i.ReadNtohU32();
|
||||
return i.GetDistanceFrom(start);
|
||||
}
|
||||
uint32_t
|
||||
WifiPrepInformationElement::GetSerializedSize() const
|
||||
uint16_t
|
||||
WifiPrepInformationElement::GetInformationSize() const
|
||||
{
|
||||
uint32_t retval =
|
||||
1 //Element ID
|
||||
@@ -213,4 +209,14 @@ WifiPrepInformationElement::GetSerializedSize() const
|
||||
return retval;
|
||||
|
||||
};
|
||||
uint8_t
|
||||
WifiPrepInformationElement::GetLengthField() const
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
void
|
||||
WifiPrepInformationElement::PrintInformation(std::ostream& os) const
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
} //namespace ns3
|
||||
|
||||
@@ -29,12 +29,13 @@
|
||||
#include "ns3/mac48-address.h"
|
||||
#include "ns3/header.h"
|
||||
#include "ns3/dot11s-codes.h"
|
||||
#include "ns3/wifi-information-element.h"
|
||||
|
||||
namespace ns3 {
|
||||
/**
|
||||
* \ingroup mesh
|
||||
*/
|
||||
class WifiPrepInformationElement : public Header
|
||||
class WifiPrepInformationElement : public WifiInformationElement
|
||||
{
|
||||
public:
|
||||
WifiPrepInformationElement();
|
||||
@@ -51,10 +52,7 @@ public:
|
||||
void SetMetric(uint32_t metric);
|
||||
void SetOriginatorAddress(Mac48Address originator_address);
|
||||
void SetOriginatorSeqNumber(uint32_t originator_seg_number);
|
||||
virtual void Serialize(Buffer::Iterator i) const;
|
||||
virtual uint32_t Deserialize(Buffer::Iterator start);
|
||||
virtual uint32_t GetSerializedSize() const;
|
||||
|
||||
|
||||
uint8_t GetFlags() const;
|
||||
uint8_t GetHopcount() const;
|
||||
uint32_t GetTTL() const;
|
||||
@@ -67,10 +65,16 @@ public:
|
||||
|
||||
void DecrementTtl();
|
||||
void IncrementMetric(uint32_t metric);
|
||||
private:
|
||||
static uint8_t ElementId() {
|
||||
return (uint8_t)IE11S_PREP;
|
||||
protected:
|
||||
WifiElementId ElementId() const{
|
||||
return IE11S_PREP;
|
||||
}
|
||||
void SerializeInformation(Buffer::Iterator i) const;
|
||||
uint16_t DeserializeInformation(Buffer::Iterator start, uint8_t length);
|
||||
uint16_t GetInformationSize() const;
|
||||
uint8_t GetLengthField() const;
|
||||
void PrintInformation(std::ostream& os) const;
|
||||
private:
|
||||
uint8_t m_flags;
|
||||
uint8_t m_hopcount;
|
||||
uint8_t m_ttl;
|
||||
|
||||
@@ -247,14 +247,8 @@ WifiPreqInformationElement::IncrementMetric(uint32_t metric)
|
||||
}
|
||||
|
||||
void
|
||||
WifiPreqInformationElement::Serialize(Buffer::Iterator i) const
|
||||
WifiPreqInformationElement::SerializeInformation(Buffer::Iterator i) const
|
||||
{
|
||||
i.WriteU8 (ElementId());
|
||||
//TODO:Check maxsize
|
||||
uint8_t length = m_destCount*11+28;
|
||||
if (m_destCount> m_maxSize)
|
||||
length -=(m_destCount-m_maxSize)*11;
|
||||
i.WriteU8 (length);
|
||||
i.WriteU8 (m_flags);
|
||||
i.WriteU8 (m_hopCount);
|
||||
i.WriteU8 (m_ttl);
|
||||
@@ -281,13 +275,10 @@ WifiPreqInformationElement::Serialize(Buffer::Iterator i) const
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WifiPreqInformationElement::Deserialize(Buffer::Iterator start)
|
||||
uint16_t
|
||||
WifiPreqInformationElement::DeserializeInformation(Buffer::Iterator start, uint8_t length)
|
||||
{
|
||||
Buffer::Iterator i = start;
|
||||
NS_ASSERT (ElementId() == i.ReadU8());
|
||||
uint8_t length;
|
||||
length = i.ReadU8 ();
|
||||
m_flags = i.ReadU8 ();
|
||||
m_hopCount = i.ReadU8 ();
|
||||
m_ttl = i.ReadU8 ();
|
||||
@@ -320,27 +311,40 @@ WifiPreqInformationElement::Deserialize(Buffer::Iterator start)
|
||||
}
|
||||
return i.GetDistanceFrom(start);
|
||||
}
|
||||
uint32_t
|
||||
WifiPreqInformationElement::GetSerializedSize() const
|
||||
{
|
||||
uint32_t retval =
|
||||
1 //Element ID
|
||||
+1 //Length
|
||||
+1 //Flags
|
||||
+1 //Hopcount
|
||||
+1 //TTL
|
||||
+4 //PREQ ID
|
||||
+6 //Source address (originator)
|
||||
+4 //Originator seqno
|
||||
+4 //Lifetime
|
||||
+4 //metric
|
||||
+1; //destination count
|
||||
if (m_destCount > m_maxSize)
|
||||
retval+=(m_maxSize*11);
|
||||
else
|
||||
retval +=(m_destCount*11);
|
||||
return retval;
|
||||
}
|
||||
uint16_t
|
||||
WifiPreqInformationElement::GetInformationSize() const
|
||||
{
|
||||
uint32_t retval =
|
||||
1 //Flags
|
||||
+1 //Hopcount
|
||||
+1 //TTL
|
||||
+4 //PREQ ID
|
||||
+6 //Source address (originator)
|
||||
+4 //Originator seqno
|
||||
+4 //Lifetime
|
||||
+4 //metric
|
||||
+1; //destination count
|
||||
if (m_destCount > m_maxSize)
|
||||
retval+=(m_maxSize*11);
|
||||
else
|
||||
retval +=(m_destCount*11);
|
||||
return retval;
|
||||
}
|
||||
uint8_t
|
||||
WifiPreqInformationElement::GetLengthField() const
|
||||
{
|
||||
uint8_t length = m_destCount*11+28;
|
||||
if (m_destCount> m_maxSize)
|
||||
length -=(m_destCount-m_maxSize)*11;
|
||||
return length;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
WifiPreqInformationElement::PrintInformation(std::ostream& os) const
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
std::vector<Ptr<DestinationAddressUnit> >
|
||||
WifiPreqInformationElement::GetDestinationList()
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "ns3/mac48-address.h"
|
||||
#include "ns3/header.h"
|
||||
#include "ns3/dot11s-codes.h"
|
||||
#include "ns3/wifi-information-element.h"
|
||||
|
||||
namespace ns3 {
|
||||
/**
|
||||
@@ -57,7 +58,7 @@ private:
|
||||
/**
|
||||
* \ingroup mesh
|
||||
*/
|
||||
class WifiPreqInformationElement : public Header
|
||||
class WifiPreqInformationElement : public WifiInformationElement
|
||||
{
|
||||
public:
|
||||
WifiPreqInformationElement();
|
||||
@@ -89,10 +90,6 @@ public:
|
||||
void SetMetric(uint32_t metric);
|
||||
void SetDestCount(uint8_t dest_count);
|
||||
|
||||
virtual void Serialize(Buffer::Iterator i) const;
|
||||
virtual uint32_t Deserialize(Buffer::Iterator i);
|
||||
virtual uint32_t GetSerializedSize() const;
|
||||
|
||||
//uint8_t GetFlags() const ;
|
||||
bool IsUnicastPreq() const;
|
||||
bool IsNeedNotPrep() const;
|
||||
@@ -106,11 +103,16 @@ public:
|
||||
uint8_t GetDestCount() const;
|
||||
void DecrementTtl();
|
||||
void IncrementMetric(uint32_t metric);
|
||||
|
||||
private:
|
||||
static uint8_t ElementId() {
|
||||
return (uint8_t)IE11S_PREQ;
|
||||
protected:
|
||||
WifiElementId ElementId () const{
|
||||
return IE11S_PREQ;
|
||||
}
|
||||
void SerializeInformation(Buffer::Iterator i) const;
|
||||
uint16_t DeserializeInformation(Buffer::Iterator i, uint8_t length);
|
||||
uint16_t GetInformationSize() const;
|
||||
uint8_t GetLengthField() const;
|
||||
void PrintInformation(std::ostream& os) const;
|
||||
private:
|
||||
//how many destinations we support
|
||||
uint8_t m_maxSize; //TODO: make as an attrubute
|
||||
//Fields:
|
||||
|
||||
@@ -43,7 +43,7 @@ uint32_t WifiInformationElement::GetSerializedSize () const
|
||||
void WifiInformationElement::Serialize (Buffer::Iterator i) const
|
||||
{
|
||||
i.WriteU8 (ElementId());
|
||||
i.WriteU8 (GetInformationSize());
|
||||
i.WriteU8 (GetLengthField());
|
||||
|
||||
SerializeInformation(i);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ protected:
|
||||
/// Serialize information
|
||||
virtual void SerializeInformation (Buffer::Iterator start) const = 0;
|
||||
/// Deserialize information
|
||||
virtual uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length) = 0;
|
||||
virtual uint16_t DeserializeInformation (Buffer::Iterator start, uint8_t length) = 0;
|
||||
/// Print information
|
||||
virtual void PrintInformation (std::ostream &os) const = 0;
|
||||
//\}
|
||||
|
||||
@@ -5,12 +5,12 @@ def build(bld):
|
||||
obj.source = [
|
||||
'wifi-information-element.cc',
|
||||
'mesh-configuration-element.cc',
|
||||
'mesh-wifi-preq-information-element.cc',
|
||||
'mesh-wifi-prep-information-element.cc',
|
||||
# Not refactored
|
||||
'mesh-wifi-beacon-timing-element.cc',
|
||||
'mesh-wifi-perr-information-element.cc',
|
||||
'mesh-wifi-prep-information-element.cc',
|
||||
'mesh-wifi-rann-information-element.cc',
|
||||
'mesh-wifi-preq-information-element.cc',
|
||||
]
|
||||
headers = bld.new_task_gen('ns3header')
|
||||
headers.module = '802.11s'
|
||||
@@ -18,12 +18,12 @@ def build(bld):
|
||||
# Refactored
|
||||
'wifi-information-element.h',
|
||||
'mesh-configuration-element.h',
|
||||
'mesh-wifi-preq-information-element.h',
|
||||
'mesh-wifi-prep-information-element.h',
|
||||
# Dirty
|
||||
'mesh-wifi-rann-information-element.h',
|
||||
'mesh-wifi-beacon-timing-element.h',
|
||||
'mesh-wifi-preq-information-element.h',
|
||||
'mesh-wifi-perr-information-element.h',
|
||||
'mesh-wifi-prep-information-element.h',
|
||||
]
|
||||
|
||||
# obj = bld.create_ns3_program('wifi-phy-test',
|
||||
|
||||
Reference in New Issue
Block a user