From 78d6c249baedc2f6454585d5b181cdcb2d0b809f Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Mon, 15 Jun 2009 20:38:30 +0400 Subject: [PATCH] Fixed PrintInformation method in dot11s-ie-* --- .../mesh/dot11s/ie-dot11s-configuration.cc | 27 +++++++++++++------ .../mesh/dot11s/ie-dot11s-configuration.h | 3 ++- src/devices/mesh/dot11s/ie-dot11s-perr.cc | 10 ++++++- src/devices/mesh/dot11s/ie-dot11s-prep.cc | 10 ++++++- src/helper/dot11s-helper.cc | 2 +- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/devices/mesh/dot11s/ie-dot11s-configuration.cc b/src/devices/mesh/dot11s/ie-dot11s-configuration.cc index ee600b528..e3051a324 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-configuration.cc +++ b/src/devices/mesh/dot11s/ie-dot11s-configuration.cc @@ -39,7 +39,7 @@ uint8_t dot11sMeshCapability::GetSerializedSize () const { return 2; } -Buffer::Iterator dot11sMeshCapability::Serialize (Buffer::Iterator i) const +uint16_t dot11sMeshCapability::GetUint16 () const { uint16_t result = 0; if (acceptPeerLinks) @@ -56,7 +56,11 @@ Buffer::Iterator dot11sMeshCapability::Serialize (Buffer::Iterator i) const result |= 1 << 5; if (powerSaveLevel) result |= 1 << 6; - i.WriteHtolsbU16 (result); + return result; +} +Buffer::Iterator dot11sMeshCapability::Serialize (Buffer::Iterator i) const +{ + i.WriteHtolsbU16 (GetUint16 ()); return i; } Buffer::Iterator dot11sMeshCapability::Deserialize (Buffer::Iterator i) @@ -77,7 +81,7 @@ bool dot11sMeshCapability::Is (uint16_t cap, uint8_t n) const return (cap & mask) == mask; } IeConfiguration::IeConfiguration (): - m_APSId (PROTOCOL_HWMP), + m_APSPId (PROTOCOL_HWMP), m_APSMId (METRIC_AIRTIME), m_CCMId (CONGESTION_NULL), m_SPId (SYNC_NEIGHBOUR_OFFSET), @@ -101,7 +105,7 @@ IeConfiguration::SerializeInformation (Buffer::Iterator i) const { i.WriteU8 (1); //Version // Active Path Selection Protocol ID: - i.WriteHtolsbU32 (m_APSId); + i.WriteHtolsbU32 (m_APSPId); // Active Path Metric ID: i.WriteHtolsbU32 (m_APSMId); // Congestion Control Mode ID: @@ -120,7 +124,7 @@ IeConfiguration::DeserializeInformation (Buffer::Iterator i, uint8_t length) uint8_t version; version = i.ReadU8 (); // Active Path Selection Protocol ID: - m_APSId = (dot11sPathSelectionProtocol)i.ReadLsbtohU32 (); + m_APSPId = (dot11sPathSelectionProtocol)i.ReadLsbtohU32 (); // Active Path Metric ID: m_APSMId = (dot11sPathSelectionMetric)i.ReadLsbtohU32 (); // Congestion Control Mode ID: @@ -134,11 +138,18 @@ IeConfiguration::DeserializeInformation (Buffer::Iterator i, uint8_t length) void IeConfiguration::PrintInformation (std::ostream& os) const { + os<<"Number of neighbors: = " << (uint16_t)m_neighbors << + "\nActive Path Selection Protocol ID: = " << (uint32_t)m_APSPId << + "\nActive Path Selection Metric ID: = " << (uint32_t)m_APSMId << + "\nCongestion Control Mode ID: = " << (uint32_t)m_CCMId << + "\nSynchronize protocol ID: = " << (uint32_t)m_SPId << + "\nAuthentication protocol ID: = " << (uint32_t)m_APId << + "\nCapabilities: = " << m_meshCap.GetUint16 () << "\n"; } void IeConfiguration::SetRouting (dot11sPathSelectionProtocol routingId) { - m_APSId = routingId; + m_APSPId = routingId; } void IeConfiguration::SetMetric (dot11sPathSelectionMetric metricId) @@ -148,7 +159,7 @@ IeConfiguration::SetMetric (dot11sPathSelectionMetric metricId) bool IeConfiguration::IsHWMP () { - return (m_APSId == PROTOCOL_HWMP); + return (m_APSPId == PROTOCOL_HWMP); } bool IeConfiguration::IsAirtime () @@ -184,7 +195,7 @@ bool operator== (const dot11sMeshCapability & a, const dot11sMeshCapability & b) bool operator== (const IeConfiguration & a, const IeConfiguration & b) { return ( - (a.m_APSId == b.m_APSId) && + (a.m_APSPId == b.m_APSPId) && (a.m_APSMId == b.m_APSMId) && (a.m_CCMId == b.m_CCMId) && (a.m_SPId == b.m_SPId) && diff --git a/src/devices/mesh/dot11s/ie-dot11s-configuration.h b/src/devices/mesh/dot11s/ie-dot11s-configuration.h index 5a0345382..740ea64d3 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-configuration.h +++ b/src/devices/mesh/dot11s/ie-dot11s-configuration.h @@ -81,6 +81,7 @@ public: uint8_t GetSerializedSize () const; Buffer::Iterator Serialize (Buffer::Iterator i) const; Buffer::Iterator Deserialize (Buffer::Iterator i); + uint16_t GetUint16 () const; bool acceptPeerLinks; bool MCCASupported; bool MCCAEnabled; @@ -120,7 +121,7 @@ private: void PrintInformation (std::ostream& os) const; private: /** Active Path Selection Protocol ID */ - dot11sPathSelectionProtocol m_APSId; + dot11sPathSelectionProtocol m_APSPId; /** Active Path Metric ID */ dot11sPathSelectionMetric m_APSMId; /** Congestion Control Mode ID */ diff --git a/src/devices/mesh/dot11s/ie-dot11s-perr.cc b/src/devices/mesh/dot11s/ie-dot11s-perr.cc index d17d5846b..cea8ac281 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-perr.cc +++ b/src/devices/mesh/dot11s/ie-dot11s-perr.cc @@ -32,7 +32,15 @@ IePerr::~IePerr () void IePerr::PrintInformation (std::ostream &os) const { - // TODO + os << "Number of failed destinations: = " << m_numOfDest; + NS_ASSERT (m_numOfDest == m_addressUnits.size ()); + for (unsigned int j = 0; j < m_numOfDest; j++) + { + os << "Failed destination address: = "<< m_addressUnits[j].destination << + ", sequence number = " << m_addressUnits[j].seqnum; + } + os << "\n"; + } IePerr::IePerr (): m_numOfDest (0) diff --git a/src/devices/mesh/dot11s/ie-dot11s-prep.cc b/src/devices/mesh/dot11s/ie-dot11s-prep.cc index 34c1b9cf3..ea4357a10 100644 --- a/src/devices/mesh/dot11s/ie-dot11s-prep.cc +++ b/src/devices/mesh/dot11s/ie-dot11s-prep.cc @@ -195,7 +195,15 @@ IePrep::GetInformationSize () const void IePrep::PrintInformation (std::ostream& os) const { - //TODO + os<<"Flags: = " << m_flags << + "\nHopcount: = " << m_hopcount << + "\nTTL: = " << m_ttl << + "\nDestination: = " << m_destinationAddress << + "\nDest. seqnum: = " << m_destSeqNumber << + "\nLifetime: = " << m_lifetime << + "\nMetric: = " << m_metric << + "\nOriginator: = " << m_originatorAddress << + "\nOrig. seqnum: = " << m_originatorSeqNumber << "\n"; } bool operator== (const IePrep & a, const IePrep & b) { diff --git a/src/helper/dot11s-helper.cc b/src/helper/dot11s-helper.cc index 264f4c816..239d6bd5b 100644 --- a/src/helper/dot11s-helper.cc +++ b/src/helper/dot11s-helper.cc @@ -60,7 +60,7 @@ MeshWifiHelper::Install (const WifiPhyHelper &phyHelper, const MeshInterfaceHelp root = true; if(!Dot11sStackInstaller::InstallDot11sStack (mp, root)) { - NS_ASSERT(false); + NS_FATAL_ERROR ("802.11s stack is not installed!"); } devices.Add (mp); node_counter ++;