Code refactoring: fixed names, added references to draft
This commit is contained in:
@@ -25,47 +25,47 @@ namespace ns3 {
|
||||
/*******************************************
|
||||
* IeDot11sBeaconTimingUnit
|
||||
*******************************************/
|
||||
IeDot11sBeaconTimingUnit::IeDot11sBeaconTimingUnit()
|
||||
IeDot11sBeaconTimingUnit::IeDot11sBeaconTimingUnit():
|
||||
m_aid (0),
|
||||
m_lastBeacon (0),
|
||||
m_beaconInterval (0)
|
||||
{
|
||||
AID = 0;
|
||||
LastBeacon = 0;
|
||||
BeaconInterval = 0;
|
||||
}
|
||||
|
||||
void
|
||||
IeDot11sBeaconTimingUnit::SetAID(uint8_t aid)
|
||||
IeDot11sBeaconTimingUnit::SetAid(uint8_t aid)
|
||||
{
|
||||
AID = aid;
|
||||
m_aid = aid;
|
||||
}
|
||||
|
||||
void
|
||||
IeDot11sBeaconTimingUnit::SetLastBeacon(uint16_t last_beacon)
|
||||
IeDot11sBeaconTimingUnit::SetLastBeacon(uint16_t lastBeacon)
|
||||
{
|
||||
LastBeacon = last_beacon;
|
||||
m_lastBeacon = lastBeacon;
|
||||
}
|
||||
|
||||
void
|
||||
IeDot11sBeaconTimingUnit::SetBeaconInterval(uint16_t beacon_interval)
|
||||
IeDot11sBeaconTimingUnit::SetBeaconInterval(uint16_t beaconInterval)
|
||||
{
|
||||
BeaconInterval = beacon_interval;
|
||||
m_beaconInterval = beaconInterval;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
IeDot11sBeaconTimingUnit::GetAID()
|
||||
IeDot11sBeaconTimingUnit::GetAid()
|
||||
{
|
||||
return AID;
|
||||
return m_aid;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
IeDot11sBeaconTimingUnit::GetLastBeacon()
|
||||
{
|
||||
return LastBeacon;
|
||||
return m_lastBeacon;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
IeDot11sBeaconTimingUnit::GetBeaconInterval()
|
||||
{
|
||||
return BeaconInterval;
|
||||
return m_beaconInterval;
|
||||
}
|
||||
|
||||
/*******************************************
|
||||
@@ -94,13 +94,13 @@ IeDot11sBeaconTiming::AddNeighboursTimingElementUnit(
|
||||
//Firs we lookup if this element already exists
|
||||
for (NeighboursTimingUnitsList::iterator i = m_neighbours.begin(); i!= m_neighbours.end(); i++)
|
||||
if (
|
||||
((*i)->GetAID() == AidToU8(aid))
|
||||
((*i)->GetAid() == AidToU8(aid))
|
||||
&& ((*i)->GetLastBeacon() == TimestampToU16(last_beacon))
|
||||
&& ((*i)->GetBeaconInterval() == BeaconIntervalToU16(beacon_interval))
|
||||
)
|
||||
return;
|
||||
Ptr<IeDot11sBeaconTimingUnit>new_element = Create<IeDot11sBeaconTimingUnit>();
|
||||
new_element->SetAID(AidToU8(aid));
|
||||
new_element->SetAid(AidToU8(aid));
|
||||
new_element->SetLastBeacon(TimestampToU16(last_beacon));
|
||||
new_element->SetBeaconInterval(BeaconIntervalToU16(beacon_interval));
|
||||
m_neighbours.push_back(new_element);
|
||||
@@ -116,7 +116,7 @@ IeDot11sBeaconTiming::DelNeighboursTimingElementUnit(
|
||||
{
|
||||
for (NeighboursTimingUnitsList::iterator i = m_neighbours.begin(); i!= m_neighbours.end(); i++)
|
||||
if (
|
||||
((*i)->GetAID() == AidToU8(aid))
|
||||
((*i)->GetAid() == AidToU8(aid))
|
||||
&& ((*i)->GetLastBeacon() == TimestampToU16(last_beacon))
|
||||
&& ((*i)->GetBeaconInterval() == BeaconIntervalToU16(beacon_interval))
|
||||
)
|
||||
@@ -161,7 +161,7 @@ IeDot11sBeaconTiming::SerializeInformation (Buffer::Iterator i) const
|
||||
{
|
||||
for (NeighboursTimingUnitsList::const_iterator j = m_neighbours.begin(); j!= m_neighbours.end(); j++)
|
||||
{
|
||||
i.WriteU8 ((*j)->GetAID());
|
||||
i.WriteU8 ((*j)->GetAid());
|
||||
i.WriteHtonU16 ((*j)->GetLastBeacon());
|
||||
i.WriteHtonU16 ((*j)->GetBeaconInterval());
|
||||
}
|
||||
@@ -174,7 +174,7 @@ IeDot11sBeaconTiming::DeserializeInformation (Buffer::Iterator start, uint8_t le
|
||||
for (int j = 0; j < m_numOfUnits; j ++)
|
||||
{
|
||||
Ptr<IeDot11sBeaconTimingUnit> new_element = Create<IeDot11sBeaconTimingUnit>();
|
||||
new_element->SetAID(i.ReadU8());
|
||||
new_element->SetAid(i.ReadU8());
|
||||
new_element->SetLastBeacon(i.ReadNtohU16());
|
||||
new_element->SetBeaconInterval(i.ReadNtohU16());
|
||||
m_neighbours.push_back(new_element);
|
||||
|
||||
@@ -31,36 +31,37 @@
|
||||
namespace ns3 {
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief Describes one unit of beacon timing element
|
||||
*/
|
||||
class IeDot11sBeaconTimingUnit : public RefCountBase
|
||||
{
|
||||
public:
|
||||
IeDot11sBeaconTimingUnit();
|
||||
void SetAID(uint8_t aid);
|
||||
void SetAid(uint8_t aid);
|
||||
void SetLastBeacon(uint16_t last_beacon);
|
||||
void SetBeaconInterval(uint16_t beacon_interval);
|
||||
|
||||
uint8_t GetAID();
|
||||
uint8_t GetAid();
|
||||
uint16_t GetLastBeacon();
|
||||
uint16_t GetBeaconInterval();
|
||||
private:
|
||||
/**
|
||||
* Least significant octet of AID:
|
||||
* \brief Least significant octet of AID:
|
||||
*/
|
||||
uint8_t AID;
|
||||
uint8_t m_aid;
|
||||
/**
|
||||
* Last time we received a beacon in accordance with a
|
||||
* \brief Last time we received a beacon in accordance with a
|
||||
* local TSF measured in 256 microseconds unit:
|
||||
*/
|
||||
uint16_t LastBeacon;
|
||||
uint16_t m_lastBeacon;
|
||||
/**
|
||||
* Beacon interval of remote mesh point:
|
||||
* \brief Beacon interval of remote mesh point:
|
||||
*/
|
||||
uint16_t BeaconInterval;
|
||||
uint16_t m_beaconInterval;
|
||||
};
|
||||
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.89 of 802.11s draft 2.07
|
||||
*/
|
||||
class IeDot11sBeaconTiming : public WifiInformationElement
|
||||
{
|
||||
@@ -88,7 +89,7 @@ public:
|
||||
Time beacon_interval
|
||||
);
|
||||
void ClearTimingElement();
|
||||
protected:
|
||||
private:
|
||||
WifiElementId ElementId() const {
|
||||
return IE11S_BEACON_TIMING;
|
||||
}
|
||||
@@ -96,12 +97,17 @@ protected:
|
||||
void SerializeInformation (Buffer::Iterator i) const;
|
||||
uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
|
||||
void PrintInformation(std::ostream& os) const;
|
||||
private:
|
||||
/**
|
||||
* Converters:
|
||||
*/
|
||||
static uint16_t TimestampToU16(Time x);
|
||||
static uint16_t BeaconIntervalToU16(Time x);
|
||||
static uint8_t AidToU8(uint16_t x);
|
||||
|
||||
NeighboursTimingUnitsList m_neighbours;
|
||||
uint16_t m_maxSize;
|
||||
/**
|
||||
* Timing element parameters:
|
||||
*/
|
||||
uint16_t m_numOfUnits;
|
||||
};
|
||||
}//namespace ns3
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
namespace ns3 {
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.81.1 in 802.11s draft 2.07
|
||||
*/
|
||||
enum dot11sPathSelectionProtocol
|
||||
{
|
||||
@@ -36,6 +37,7 @@ enum dot11sPathSelectionProtocol
|
||||
};
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.81.2 in 802.11s draft 2.07
|
||||
*/
|
||||
enum dot11sPathSelectionMetric
|
||||
{
|
||||
@@ -44,6 +46,7 @@ enum dot11sPathSelectionMetric
|
||||
};
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.81.3 in 802.11s draft 2.07
|
||||
*/
|
||||
enum dot11sCongestionControlMode
|
||||
{
|
||||
@@ -52,6 +55,7 @@ enum dot11sCongestionControlMode
|
||||
};
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.81.4 in 802.11s draft 2.07
|
||||
*/
|
||||
enum dot11sChannelPrecedence
|
||||
{
|
||||
@@ -60,6 +64,7 @@ enum dot11sChannelPrecedence
|
||||
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.81.5 in 802.11s draft 2.07
|
||||
*/
|
||||
class dot11sMeshCapability
|
||||
{
|
||||
@@ -74,12 +79,14 @@ public:
|
||||
bool beaconTimingReport;
|
||||
bool TBTTAdjustment;
|
||||
bool powerSaveLevel;
|
||||
private:
|
||||
|
||||
bool Is(uint16_t cap,uint8_t n) const;
|
||||
};
|
||||
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief Describes Mesh Configuration Element
|
||||
* see 7.3.2.81 of 802.11s draft 2.07
|
||||
*/
|
||||
class IeDot11sConfiguration : public WifiInformationElement
|
||||
{
|
||||
@@ -94,7 +101,7 @@ public:
|
||||
bool IsAirtime();
|
||||
|
||||
dot11sMeshCapability const& MeshCapability();
|
||||
protected:
|
||||
private:
|
||||
WifiElementId ElementId () const
|
||||
{
|
||||
return IE11S_MESH_CONFIGURATION;
|
||||
@@ -103,9 +110,6 @@ protected:
|
||||
void SerializeInformation (Buffer::Iterator i) const;
|
||||
uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
|
||||
void PrintInformation(std::ostream& os) const;
|
||||
// TODO: Release and fill other fields in configuration
|
||||
// element
|
||||
private:
|
||||
/** Active Path Selection Protocol ID */
|
||||
dot11sPathSelectionProtocol m_APSId;
|
||||
/** Active Path Metric ID */
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
namespace ns3 {
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.85 of draft 2.07
|
||||
*/
|
||||
class IeDot11sPeerManagement : public WifiInformationElement
|
||||
{
|
||||
@@ -38,7 +39,6 @@ public:
|
||||
PEER_CLOSE = 1,
|
||||
PEER_CONFIRM = 2,
|
||||
};
|
||||
public:
|
||||
IeDot11sPeerManagement ();
|
||||
|
||||
void SetPeerOpen(uint16_t localLinkId);
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
bool SubtypeIsOpen() const;
|
||||
bool SubtypeIsClose() const;
|
||||
bool SubtypeIsConfirm() const ;
|
||||
protected:
|
||||
private:
|
||||
WifiElementId ElementId() const{
|
||||
return IE11S_PEER_LINK_MANAGEMENT;
|
||||
}
|
||||
@@ -59,7 +59,6 @@ protected:
|
||||
void SerializeInformation (Buffer::Iterator i) const;
|
||||
uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
|
||||
void PrintInformation(std::ostream& os) const;
|
||||
private:
|
||||
uint8_t m_length;
|
||||
uint8_t m_subtype;
|
||||
uint16_t m_localLinkId;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
namespace ns3 {
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.98 of 802.11s draft 2.07
|
||||
*/
|
||||
class IeDot11sPerr : public WifiInformationElement
|
||||
{
|
||||
@@ -50,7 +51,7 @@ public:
|
||||
GetAddressUnitVector();
|
||||
void DeleteAddressUnit(Mac48Address address);
|
||||
void ResetPerr();
|
||||
protected:
|
||||
private:
|
||||
WifiElementId ElementId() const{
|
||||
return IE11S_PERR;
|
||||
};
|
||||
@@ -58,10 +59,8 @@ protected:
|
||||
uint8_t DeserializeInformation(Buffer::Iterator start, uint8_t length);
|
||||
void PrintInformation(std::ostream& os) const;
|
||||
uint8_t GetInformationSize() const;
|
||||
private:
|
||||
uint8_t m_numOfDest;
|
||||
std::vector<HwmpRtable::FailedDestination>
|
||||
m_addressUnits;
|
||||
std::vector<HwmpRtable::FailedDestination> m_addressUnits;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
namespace ns3 {
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.97 of 802.11s draft 2.07
|
||||
*/
|
||||
class IeDot11sPrep : public WifiInformationElement
|
||||
{
|
||||
@@ -61,7 +62,7 @@ public:
|
||||
|
||||
void DecrementTtl();
|
||||
void IncrementMetric(uint32_t metric);
|
||||
protected:
|
||||
private:
|
||||
WifiElementId ElementId() const{
|
||||
return IE11S_PREP;
|
||||
}
|
||||
@@ -69,7 +70,6 @@ protected:
|
||||
uint8_t DeserializeInformation(Buffer::Iterator start, uint8_t length);
|
||||
uint8_t GetInformationSize() const;
|
||||
void PrintInformation(std::ostream& os) const;
|
||||
private:
|
||||
uint8_t m_flags;
|
||||
uint8_t m_hopcount;
|
||||
uint8_t m_ttl;
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
namespace ns3 {
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief Describes an address unit in PREQ information element
|
||||
* See 7.3.2.96 for more details
|
||||
*/
|
||||
class DestinationAddressUnit : public RefCountBase
|
||||
{
|
||||
@@ -52,6 +54,7 @@ private:
|
||||
};
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.96 of 802.11s draft 2.07
|
||||
*/
|
||||
class IeDot11sPreq : public WifiInformationElement
|
||||
{
|
||||
@@ -96,7 +99,7 @@ public:
|
||||
uint8_t GetDestCount() const;
|
||||
void DecrementTtl();
|
||||
void IncrementMetric(uint32_t metric);
|
||||
protected:
|
||||
private:
|
||||
WifiElementId ElementId () const{
|
||||
return IE11S_PREQ;
|
||||
}
|
||||
@@ -104,7 +107,6 @@ protected:
|
||||
uint8_t DeserializeInformation(Buffer::Iterator i, uint8_t length);
|
||||
uint8_t GetInformationSize() const;
|
||||
void PrintInformation(std::ostream& os) const;
|
||||
private:
|
||||
/**
|
||||
* how many destinations we support
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
namespace ns3 {
|
||||
/**
|
||||
* \ingroup mesh
|
||||
* \brief See 7.3.2.95 of 802.11s draft 2.07
|
||||
*/
|
||||
class IeDot11sRann
|
||||
{
|
||||
@@ -52,14 +53,13 @@ public:
|
||||
uint32_t GetMetric();
|
||||
void DecrementTtl();
|
||||
void IncrementMetric(uint32_t metric);
|
||||
protected:
|
||||
private:
|
||||
WifiElementId ElementId() const{
|
||||
return IE11S_RANN;
|
||||
}
|
||||
void SerializeInformation(Buffer::Iterator i) const;
|
||||
uint8_t DeserializeInformation(Buffer::Iterator start, uint8_t length);
|
||||
uint8_t GetInformationSize() const;
|
||||
private:
|
||||
uint8_t m_flags;
|
||||
uint8_t m_hopcount;
|
||||
uint8_t m_ttl;
|
||||
|
||||
Reference in New Issue
Block a user