# HG changeset patch # User Tom Henderson # Date 1438985738 25200 # Fri Aug 07 15:15:38 2015 -0700 # Node ID 296fc50c5411fe45aeade6ac69c427c0f9ef05e8 # Parent e01e8d47bcfeccbfa7fa518fbd3a43afede0ec92 bug 1482: avoid newlines in mesh header Print() methods; implement additional Print() methods; additional cleanup of header-related code diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/dot11s-mac-header.cc --- a/src/mesh/model/dot11s/dot11s-mac-header.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/dot11s-mac-header.cc Fri Aug 07 15:15:38 2015 -0700 @@ -164,9 +164,9 @@ void MeshHeader::Print (std::ostream &os) const { - os << "flags = " << (uint16_t) m_meshFlags << std::endl << "ttl = " << (uint16_t) m_meshTtl - << std::endl << "seqno = " << m_meshSeqno << std::endl<< "addr4 = " << m_addr4 << std::endl - << "addr5 = " << m_addr5 << std::endl << "addr6 = " << m_addr6 << std::endl; + os << "flags=" << (uint16_t) m_meshFlags << ", ttl=" << (uint16_t) m_meshTtl + << ", seqno=" << m_meshSeqno << ", addr4=" << m_addr4 + << ", addr5=" << m_addr5 << ", addr6=" << m_addr6; } bool operator== (const MeshHeader & a, const MeshHeader & b) diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/ie-dot11s-beacon-timing.cc --- a/src/mesh/model/dot11s/ie-dot11s-beacon-timing.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/ie-dot11s-beacon-timing.cc Fri Aug 07 15:15:38 2015 -0700 @@ -130,14 +130,13 @@ void IeBeaconTiming::Print (std::ostream& os) const { - os << std::endl << "" << std::endl; - os << "Number of units: " << (uint16_t) m_numOfUnits << std::endl; + os << "BeaconTiming=(Number of units=" << (uint16_t) m_numOfUnits; for (NeighboursTimingUnitsList::const_iterator j = m_neighbours.begin (); j != m_neighbours.end (); j++) { - os << "AID=" << (uint16_t)(*j)->GetAid () << ", Last beacon was at " << (*j)->GetLastBeacon () - << ", with beacon interval " << (*j)->GetBeaconInterval () << std::endl; + os << "(AID=" << (uint16_t)(*j)->GetAid () << ", Last beacon at=" << (*j)->GetLastBeacon () + << ", with beacon interval=" << (*j)->GetBeaconInterval () << ")"; } - os << "" << std::endl; + os << ")"; } void IeBeaconTiming::SerializeInformationField (Buffer::Iterator i) const diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/ie-dot11s-configuration.cc --- a/src/mesh/model/dot11s/ie-dot11s-configuration.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/ie-dot11s-configuration.cc Fri Aug 07 15:15:38 2015 -0700 @@ -151,15 +151,14 @@ void IeConfiguration::Print (std::ostream& os) const { - os << std::endl << "" << std::endl; - os << "Number of neighbors: = " << (uint16_t) m_neighbors - << std::endl << "Active Path Selection Protocol ID: = " << (uint32_t) m_APSPId - << std::endl << "Active Path Selection Metric ID: = " << (uint32_t) m_APSMId - << std::endl << "Congestion Control Mode ID: = " << (uint32_t) m_CCMId - << std::endl << "Synchronize protocol ID: = " << (uint32_t) m_SPId - << std::endl << "Authentication protocol ID: = " << (uint32_t) m_APId - << std::endl << "Capabilities: = " << m_meshCap.GetUint8 () << std::endl; - os << "" << std::endl; + os << "MeshConfiguration=(neighbors=" << (uint16_t) m_neighbors + << ", Active Path Selection Protocol ID=" << (uint32_t) m_APSPId + << ", Active Path Selection Metric ID=" << (uint32_t) m_APSMId + << ", Congestion Control Mode ID=" << (uint32_t) m_CCMId + << ", Synchronize protocol ID=" << (uint32_t) m_SPId + << ", Authentication protocol ID=" << (uint32_t) m_APId + << ", Capabilities=" << m_meshCap.GetUint8 (); + os << ")"; } void IeConfiguration::SetRouting (dot11sPathSelectionProtocol routingId) diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/ie-dot11s-id.cc --- a/src/mesh/model/dot11s/ie-dot11s-id.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/ie-dot11s-id.cc Fri Aug 07 15:15:38 2015 -0700 @@ -115,9 +115,7 @@ void IeMeshId::Print (std::ostream& os) const { - os << std::endl << "" << std::endl; - os << "meshId = " << PeekString (); - os << "" << std::endl; + os << "MeshId=(meshId=" << PeekString () << ")"; } bool operator== (const IeMeshId & a, const IeMeshId & b) diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/ie-dot11s-metric-report.cc --- a/src/mesh/model/dot11s/ie-dot11s-metric-report.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/ie-dot11s-metric-report.cc Fri Aug 07 15:15:38 2015 -0700 @@ -66,9 +66,7 @@ void IeLinkMetricReport::Print (std::ostream& os) const { - os << std::endl << "" << std::endl; - os << "Metric = " << m_metric; - os << "" << std::endl; + os << "Metric=" << m_metric; } bool operator== (const IeLinkMetricReport & a, const IeLinkMetricReport & b) diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/ie-dot11s-peer-management.cc --- a/src/mesh/model/dot11s/ie-dot11s-peer-management.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/ie-dot11s-peer-management.cc Fri Aug 07 15:15:38 2015 -0700 @@ -151,13 +151,12 @@ void IePeerManagement::Print (std::ostream& os) const { - os << std::endl << "" << std::endl; - os << " Subtype: = " << (uint16_t) m_subtype << std::endl; - os << " Length: = " << (uint16_t) m_length << std::endl; - os << " LocalLinkId: = " << m_localLinkId << std::endl; - os << " PeerLinkId: = " << m_peerLinkId << std::endl; - os << " ReasonCode: = " << m_reasonCode << std::endl; - os << "" << std::endl; + os << "PeerMgmt=(Subtype=" << (uint16_t) m_subtype + << ", Length=" << (uint16_t) m_length + << ", LocalLinkId=" << m_localLinkId + << ", PeerLinkId=" << m_peerLinkId + << ", ReasonCode=" << m_reasonCode + << ")"; } bool operator== (const IePeerManagement & a, const IePeerManagement & b) diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/ie-dot11s-peering-protocol.cc --- a/src/mesh/model/dot11s/ie-dot11s-peering-protocol.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/ie-dot11s-peering-protocol.cc Fri Aug 07 15:15:38 2015 -0700 @@ -50,9 +50,7 @@ void IePeeringProtocol::Print (std::ostream& os) const { - os << std::endl << "" << std::endl; - os << "peering protocol = " << m_protocol; - os << "" << std::endl; + os << "PeeringProtocol=(peering protocol=" << m_protocol << ")"; } std::ostream & operator << (std::ostream &os, const IePeeringProtocol &a) diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/ie-dot11s-perr.cc --- a/src/mesh/model/dot11s/ie-dot11s-perr.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/ie-dot11s-perr.cc Fri Aug 07 15:15:38 2015 -0700 @@ -37,14 +37,13 @@ void IePerr::Print (std::ostream &os) const { - os << std::endl << "" << std::endl; - os << "Number of failed destinations: = " << m_addressUnits.size (); + os << "PERR=(Number of failed destinations=" << m_addressUnits.size (); for (unsigned int j = 0; j < m_addressUnits.size (); j++) { - os << "Failed destination address: = " << m_addressUnits[j].destination << ", sequence number = " - << m_addressUnits[j].seqnum; + os << "(Failed destination address=" << m_addressUnits[j].destination << ", sequence number = " + << m_addressUnits[j].seqnum << ")"; } - os << std::endl << "" << std::endl; + os << ")"; } uint8_t IePerr::GetNumOfDest () const diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/ie-dot11s-prep.cc --- a/src/mesh/model/dot11s/ie-dot11s-prep.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/ie-dot11s-prep.cc Fri Aug 07 15:15:38 2015 -0700 @@ -189,12 +189,10 @@ void IePrep::Print (std::ostream& os) const { - os << std::endl << "" << std::endl; - os << "Flags: = " << m_flags << std::endl << "Hopcount: = " << m_hopcount << std::endl << "TTL: = " << m_ttl - << std::endl<< "Destination: = " << m_destinationAddress << std::endl << "Dest. seqnum: = " << m_destSeqNumber - << std::endl << "Lifetime: = " << m_lifetime << std::endl<< "Metric: = " << m_metric << std::endl << "Originator: = " - << m_originatorAddress << std::endl << "Orig. seqnum: = " << m_originatorSeqNumber << std::endl; - os << "" << std::endl; + os << "PREP=(Flags=" << m_flags << ", Hopcount=" << m_hopcount << ", TTL=" << m_ttl + << ",Destination=" << m_destinationAddress << ", Dest. seqnum=" << m_destSeqNumber + << ", Lifetime=" << m_lifetime << ", Metric=" << m_metric << ", Originator=" + << m_originatorAddress << ", Orig. seqnum=" << m_originatorSeqNumber << ")"; } bool operator== (const IePrep & a, const IePrep & b) diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/ie-dot11s-preq.cc --- a/src/mesh/model/dot11s/ie-dot11s-preq.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/ie-dot11s-preq.cc Fri Aug 07 15:15:38 2015 -0700 @@ -316,20 +316,19 @@ void IePreq::Print (std::ostream &os) const { - os << std::endl << "" << std::endl; - os << " originator address = " << m_originatorAddress << std::endl; - os << " TTL = " << (uint16_t) m_ttl << std::endl; - os << " hop count = " << (uint16_t) m_hopCount << std::endl; - os << " metric = " << m_metric << std::endl; - os << " seqno = " << m_originatorSeqNumber << std::endl; - os << " lifetime = " << m_lifetime << std::endl; - os << " preq ID = " << m_preqId << std::endl; - os << " Destinations are:" << std::endl; + os << "PREQ=(originator address = " << m_originatorAddress + << ", TTL = " << (uint16_t) m_ttl + << ", hop count = " << (uint16_t) m_hopCount + << ", metric = " << m_metric + << ", seqno = " << m_originatorSeqNumber + << ", lifetime = " << m_lifetime + << ", preq ID = " << m_preqId + << ", Destinations=("; for (int j = 0; j < m_destCount; j++) { - os << " " << m_destinations[j]->GetDestinationAddress () << std::endl; + os << m_destinations[j]->GetDestinationAddress (); } - os << "" << std::endl; + os << ")"; } std::vector > IePreq::GetDestinationList () diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/ie-dot11s-rann.cc --- a/src/mesh/model/dot11s/ie-dot11s-rann.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/ie-dot11s-rann.cc Fri Aug 07 15:15:38 2015 -0700 @@ -151,14 +151,13 @@ void IeRann::Print (std::ostream &os) const { - os << std::endl << "" << std::endl; - os << " flags = " << (int) m_flags << std::endl; - os << " hop count = " << (int) m_hopcount << std::endl; - os << " TTL = " << (int) m_ttl << std::endl; - os << " originator address = " << m_originatorAddress << std::endl; - os << " dst seq. number = " << m_destSeqNumber << std::endl; - os << " metric = " << m_metric << std::endl; - os << "" << std::endl; + os << "RANN=(flags=" << (int) m_flags + << ", hop count=" << (int) m_hopcount + << ", TTL=" << (int) m_ttl + << ", originator address=" << m_originatorAddress + << ", dst seq. number=" << m_destSeqNumber + << ", metric=" << m_metric + << ")"; } bool diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/peer-link-frame.cc --- a/src/mesh/model/dot11s/peer-link-frame.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/peer-link-frame.cc Fri Aug 07 15:15:38 2015 -0700 @@ -29,48 +29,24 @@ NS_OBJECT_ENSURE_REGISTERED (PeerLinkOpenStart); PeerLinkOpenStart::PeerLinkOpenStart () : - m_subtype ((uint8_t)(WifiActionHeader::PEER_LINK_OPEN)), m_capability (0), m_aid (0), m_rates (SupportedRates ()), m_meshId (), + m_capability (0), m_rates (SupportedRates ()), m_meshId (), m_config (IeConfiguration ()) { } void PeerLinkOpenStart::SetPlinkOpenStart (PeerLinkOpenStart::PlinkOpenStartFields fields) { - m_subtype = fields.subtype; - - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)) - { - m_capability = fields.capability; - } - if (m_subtype == (uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM)) - { - m_aid = fields.aid; - } - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)) - { - m_rates = fields.rates; - } - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM)) - { - m_meshId = fields.meshId; - } - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)) - { - m_config = fields.config; - } - else - { - //reasonCode not used here - } + m_capability = fields.capability; + m_rates = fields.rates; + m_meshId = fields.meshId; + m_config = fields.config; } PeerLinkOpenStart::PlinkOpenStartFields PeerLinkOpenStart::GetFields () const { PlinkOpenStartFields retval; /// \todo protocol version: - retval.subtype = m_subtype; retval.capability = m_capability; - retval.aid = m_aid; retval.rates = m_rates; retval.meshId = m_meshId; retval.config = m_config; @@ -95,179 +71,85 @@ void PeerLinkOpenStart::Print (std::ostream &os) const { - os << "subtype = " << (uint16_t) m_subtype << std::endl << "capability = " << m_capability << std::endl << "laid = " - << (uint16_t) m_aid << std::endl << "rates = " << m_rates << std::endl << "meshId = "; + os << "capability=" << m_capability << ", rates=" << m_rates; + os << ", "; m_meshId.Print (os); - os << std::endl << "configuration = "; + os << ", "; m_config.Print (os); - os << std::endl << "reason code = " << m_reasonCode; } uint32_t PeerLinkOpenStart::GetSerializedSize () const { uint32_t size =0; //Peering protocol - NS_ASSERT (m_subtype < 4); - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - size += 2; //capability - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype) - { - size += 2; //AID of remote peer - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - size += m_rates.GetSerializedSize (); - size += m_rates.extended.GetSerializedSize (); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype) - { - size += m_meshId.GetInformationFieldSize () + 2; - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - size += m_config.GetInformationFieldSize () + 2; - } - else - { - //reasonCode not used here - } + size += 2; //capability + size += m_rates.GetSerializedSize (); + size += m_rates.extended.GetSerializedSize (); + size += m_meshId.GetInformationFieldSize () + 2; + size += m_config.GetInformationFieldSize () + 2; return size; } void PeerLinkOpenStart::Serialize (Buffer::Iterator start) const { Buffer::Iterator i = start; - NS_ASSERT (m_subtype < 4); - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i.WriteHtolsbU16 (m_capability); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype) - { - i.WriteHtolsbU16 (m_aid); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i = m_rates.Serialize (i); - i = m_rates.extended.Serialize (i); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype) - { - i = m_meshId.Serialize (i); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i = m_config.Serialize (i); - } - else - { - //reasonCode not used here - } + i.WriteHtolsbU16 (m_capability); + i = m_rates.Serialize (i); + i = m_rates.extended.Serialize (i); + i = m_meshId.Serialize (i); + i = m_config.Serialize (i); } uint32_t PeerLinkOpenStart::Deserialize (Buffer::Iterator start) { Buffer::Iterator i = start; - NS_ASSERT (m_subtype < 4); - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) + m_capability = i.ReadLsbtohU16 (); + i = m_rates.Deserialize (i); + i = m_rates.extended.DeserializeIfPresent (i); + uint8_t id = i.ReadU8 (); + uint8_t length = i.ReadU8 (); + m_meshId.DeserializeInformationField (i, length); + if ((m_meshId.ElementId () != (WifiInformationElementId) id) || (m_meshId.GetInformationFieldSize () != length)) { - m_capability = i.ReadLsbtohU16 (); + NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype) + i.Next (m_meshId.GetInformationFieldSize ()); + id = i.ReadU8 (); + length = i.ReadU8 (); + m_config.DeserializeInformationField (i, length); + if ((m_config.ElementId () != (WifiInformationElementId) id) || (m_config.GetInformationFieldSize () != length)) { - m_aid = i.ReadLsbtohU16 (); + NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i = m_rates.Deserialize (i); - i = m_rates.extended.DeserializeIfPresent (i); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype) - { - uint8_t id = i.ReadU8 (); - uint8_t length = i.ReadU8 (); - m_meshId.DeserializeInformationField (i, length); - if ((m_meshId.ElementId () != (WifiInformationElementId) id) || (m_meshId.GetInformationFieldSize () != length)) - { - NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); - } - i.Next (m_meshId.GetInformationFieldSize ()); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - uint8_t id = i.ReadU8 (); - uint8_t length = i.ReadU8 (); - m_config.DeserializeInformationField (i, length); - if ((m_config.ElementId () != (WifiInformationElementId) id) || (m_config.GetInformationFieldSize () != length)) - { - NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); - } - i.Next (m_config.GetInformationFieldSize ()); - } - else - { - //reasonCode not used here - } + i.Next (m_config.GetInformationFieldSize ()); + return i.GetDistanceFrom (start); } bool operator== (const PeerLinkOpenStart & a, const PeerLinkOpenStart & b) { - return ((a.m_subtype == b.m_subtype) && (a.m_capability == b.m_capability) && (a.m_aid == b.m_aid) + return ((a.m_capability == b.m_capability) && (a.m_meshId.IsEqual (b.m_meshId)) && (a.m_config == b.m_config)); } NS_OBJECT_ENSURE_REGISTERED (PeerLinkCloseStart); PeerLinkCloseStart::PeerLinkCloseStart () : - m_subtype ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)), m_capability (0), m_aid (0), m_rates (SupportedRates ()), m_meshId (), - m_config (IeConfiguration ()) + m_meshId () { } void PeerLinkCloseStart::SetPlinkCloseStart (PeerLinkCloseStart::PlinkCloseStartFields fields) { - m_subtype = fields.subtype; - - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)) - { - m_capability = fields.capability; - } - if (m_subtype == (uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM)) - { - m_aid = fields.aid; - } - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)) - { - m_rates = fields.rates; - } - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM)) - { - m_meshId = fields.meshId; - } - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)) - { - m_config = fields.config; - } - else - { - //reasonCode not used here - } + m_meshId = fields.meshId; } PeerLinkCloseStart::PlinkCloseStartFields PeerLinkCloseStart::GetFields () const { PlinkCloseStartFields retval; /// \todo protocol version: - retval.subtype = m_subtype; - retval.capability = m_capability; - retval.aid = m_aid; - retval.rates = m_rates; retval.meshId = m_meshId; - retval.config = m_config; return retval; } @@ -289,178 +171,64 @@ void PeerLinkCloseStart::Print (std::ostream &os) const { - os << "subtype = " << (uint16_t) m_subtype << std::endl << "capability = " << m_capability << std::endl << "laid = " - << (uint16_t) m_aid << std::endl << "rates = " << m_rates << std::endl << "meshId = "; m_meshId.Print (os); - os << std::endl << "configuration = "; - m_config.Print (os); - os << std::endl << "reason code = " << m_reasonCode; } uint32_t PeerLinkCloseStart::GetSerializedSize () const { uint32_t size =0; //Peering protocol - NS_ASSERT (m_subtype < 4); - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - size += 2; //capability - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype) - { - size += 2; //AID of remote peer - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - size += m_rates.GetSerializedSize (); - size += m_rates.extended.GetSerializedSize (); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype) - { - size += m_meshId.GetInformationFieldSize () + 2; - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - size += m_config.GetInformationFieldSize () + 2; - } - else - { - //reasonCode not used here - } + size += m_meshId.GetInformationFieldSize () + 2; return size; } void PeerLinkCloseStart::Serialize (Buffer::Iterator start) const { Buffer::Iterator i = start; - NS_ASSERT (m_subtype < 4); - - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i.WriteHtolsbU16 (m_capability); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype) - { - i.WriteHtolsbU16 (m_aid); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i = m_rates.Serialize (i); - i = m_rates.extended.Serialize (i); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype) - { - i = m_meshId.Serialize (i); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i = m_config.Serialize (i); - } - else - { - //reasonCode not used here - } + i = m_meshId.Serialize (i); } uint32_t PeerLinkCloseStart::Deserialize (Buffer::Iterator start) { Buffer::Iterator i = start; - NS_ASSERT (m_subtype < 4); - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) + uint8_t id = i.ReadU8 (); + uint8_t length = i.ReadU8 (); + m_meshId.DeserializeInformationField (i, length); + if ((m_meshId.ElementId () != (WifiInformationElementId) id) || (m_meshId.GetInformationFieldSize () != length)) { - m_capability = i.ReadLsbtohU16 (); + NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype) - { - m_aid = i.ReadLsbtohU16 (); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i = m_rates.Deserialize (i); - i = m_rates.extended.DeserializeIfPresent (i); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype) - { - uint8_t id = i.ReadU8 (); - uint8_t length = i.ReadU8 (); - m_meshId.DeserializeInformationField (i, length); - if ((m_meshId.ElementId () != (WifiInformationElementId) id) || (m_meshId.GetInformationFieldSize () != length)) - { - NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); - } - i.Next (m_meshId.GetInformationFieldSize ()); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - uint8_t id = i.ReadU8 (); - uint8_t length = i.ReadU8 (); - m_config.DeserializeInformationField (i, length); - if ((m_config.ElementId () != (WifiInformationElementId) id) || (m_config.GetInformationFieldSize () != length)) - { - NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); - } - i.Next (m_config.GetInformationFieldSize ()); - } - else - { - //reasonCode not used here - } + i.Next (m_meshId.GetInformationFieldSize ()); return i.GetDistanceFrom (start); } bool operator== (const PeerLinkCloseStart & a, const PeerLinkCloseStart & b) { - return ((a.m_subtype == b.m_subtype) && (a.m_capability == b.m_capability) && (a.m_aid == b.m_aid) - && (a.m_meshId.IsEqual (b.m_meshId)) && (a.m_config == b.m_config)); - + return ((a.m_meshId.IsEqual (b.m_meshId))); } NS_OBJECT_ENSURE_REGISTERED (PeerLinkConfirmStart); PeerLinkConfirmStart::PeerLinkConfirmStart () : - m_subtype ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM)), m_capability (0), m_aid (0), m_rates (SupportedRates ()), m_meshId (), + m_capability (0), m_aid (0), m_rates (SupportedRates ()), m_config (IeConfiguration ()) { } void PeerLinkConfirmStart::SetPlinkConfirmStart (PeerLinkConfirmStart::PlinkConfirmStartFields fields) { - m_subtype = fields.subtype; - - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)) - { - m_capability = fields.capability; - } - if (m_subtype == (uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM)) - { - m_aid = fields.aid; - } - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)) - { - m_rates = fields.rates; - } - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM)) - { - m_meshId = fields.meshId; - } - if (m_subtype != (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE)) - { - m_config = fields.config; - } - else - { - //reasonCode not used here - } + m_capability = fields.capability; + m_aid = fields.aid; + m_rates = fields.rates; + m_config = fields.config; } PeerLinkConfirmStart::PlinkConfirmStartFields PeerLinkConfirmStart::GetFields () const { PlinkConfirmStartFields retval; /// \todo protocol version: - retval.subtype = m_subtype; retval.capability = m_capability; retval.aid = m_aid; retval.rates = m_rates; - retval.meshId = m_meshId; retval.config = m_config; return retval; @@ -483,130 +251,56 @@ void PeerLinkConfirmStart::Print (std::ostream &os) const { - os << "subtype = " << (uint16_t) m_subtype << std::endl << "capability = " << m_capability << std::endl << "laid = " - << (uint16_t) m_aid << std::endl << "rates = " << m_rates << std::endl << "meshId = "; - m_meshId.Print (os); - os << std::endl << "configuration = "; + os << "capability=" << m_capability << ", rates=" << m_rates; + os << ", "; m_config.Print (os); - os << std::endl << "reason code = " << m_reasonCode; } uint32_t PeerLinkConfirmStart::GetSerializedSize () const { uint32_t size =0; //Peering protocol - NS_ASSERT (m_subtype < 4); - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - size += 2; //capability - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype) - { - size += 2; //AID of remote peer - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - size += m_rates.GetSerializedSize (); - size += m_rates.extended.GetSerializedSize (); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype) - { - size += m_meshId.GetInformationFieldSize () + 2; - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - size += m_config.GetInformationFieldSize () + 2; - } - else - { - //reasonCode not used here - } + size += 2; //capability + size += 2; //AID of remote peer + size += m_rates.GetSerializedSize (); + size += m_rates.extended.GetSerializedSize (); + size += m_config.GetInformationFieldSize () + 2; return size; } void PeerLinkConfirmStart::Serialize (Buffer::Iterator start) const { Buffer::Iterator i = start; - NS_ASSERT (m_subtype < 4); - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i.WriteHtolsbU16 (m_capability); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype) - { - i.WriteHtolsbU16 (m_aid); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i = m_rates.Serialize (i); - i = m_rates.extended.Serialize (i); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype) - { - i = m_meshId.Serialize (i); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i = m_config.Serialize (i); - } - else - { - //reasonCode not used here - } + i.WriteHtolsbU16 (m_capability); + i.WriteHtolsbU16 (m_aid); + i = m_rates.Serialize (i); + i = m_rates.extended.Serialize (i); + i = m_config.Serialize (i); } uint32_t PeerLinkConfirmStart::Deserialize (Buffer::Iterator start) { Buffer::Iterator i = start; - NS_ASSERT (m_subtype < 4); - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) + m_capability = i.ReadLsbtohU16 (); + m_aid = i.ReadLsbtohU16 (); + i = m_rates.Deserialize (i); + i = m_rates.extended.DeserializeIfPresent (i); + uint8_t id = i.ReadU8 (); + uint8_t length = i.ReadU8 (); + m_config.DeserializeInformationField (i, length); + if ((m_config.ElementId () != (WifiInformationElementId) id) || (m_config.GetInformationFieldSize () != length)) { - m_capability = i.ReadLsbtohU16 (); + NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) == m_subtype) - { - m_aid = i.ReadLsbtohU16 (); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - i = m_rates.Deserialize (i); - i = m_rates.extended.DeserializeIfPresent (i); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM) != m_subtype) - { - uint8_t id = i.ReadU8 (); - uint8_t length = i.ReadU8 (); - m_meshId.DeserializeInformationField (i, length); - if ((m_meshId.ElementId () != (WifiInformationElementId) id) || (m_meshId.GetInformationFieldSize () != length)) - { - NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); - } - i.Next (m_meshId.GetInformationFieldSize ()); - } - if ((uint8_t)(WifiActionHeader::PEER_LINK_CLOSE) != m_subtype) - { - uint8_t id = i.ReadU8 (); - uint8_t length = i.ReadU8 (); - m_config.DeserializeInformationField (i, length); - if ((m_config.ElementId () != (WifiInformationElementId) id) || (m_config.GetInformationFieldSize () != length)) - { - NS_FATAL_ERROR ("Broken frame: Element ID does not match IE itself!"); - } - i.Next (m_config.GetInformationFieldSize ()); - } - else - { - //reasonCode not used here - } + i.Next (m_config.GetInformationFieldSize ()); return i.GetDistanceFrom (start); } bool operator== (const PeerLinkConfirmStart & a, const PeerLinkConfirmStart & b) { - return ((a.m_subtype == b.m_subtype) && (a.m_capability == b.m_capability) && (a.m_aid == b.m_aid) - && (a.m_meshId.IsEqual (b.m_meshId)) && (a.m_config == b.m_config)); - + return ((a.m_capability == b.m_capability) && (a.m_aid == b.m_aid) + && (a.m_config == b.m_config)); } } // namespace dot11s } // namespace ns3 diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/peer-link-frame.h --- a/src/mesh/model/dot11s/peer-link-frame.h Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/peer-link-frame.h Fri Aug 07 15:15:38 2015 -0700 @@ -35,11 +35,11 @@ * * \brief 802.11s Peer link open management frame * - * Peer link management frame included the following (see chapters 7.4.12.1-7.4.12.3 of 802.11s): - * - Subtype field - * - Association ID field + * Peer link opent frame includes the following: + * - Capability * - Supported rates * - Mesh ID of mesh + * - Configuration */ class PeerLinkOpenStart : public Header { @@ -48,14 +48,11 @@ ///\brief fields: struct PlinkOpenStartFields { - uint8_t subtype; - IePeeringProtocol protocol; //Peering protocol version - in all subtypes - 3 octets + IePeeringProtocol protocol; //Peering protocol version - 3 octets uint16_t capability; //open and confirm - uint16_t aid; //confirm only SupportedRates rates; //open and confirm IeMeshId meshId; //open and close IeConfiguration config; //open and confirm - uint16_t reasonCode; //close only }; void SetPlinkOpenStart (PlinkOpenStartFields); PlinkOpenStartFields GetFields () const; @@ -69,14 +66,10 @@ virtual uint32_t Deserialize (Buffer::Iterator start); private: - uint8_t m_subtype; - IePeeringProtocol m_protocol; uint16_t m_capability; - uint16_t m_aid; SupportedRates m_rates; IeMeshId m_meshId; IeConfiguration m_config; - uint16_t m_reasonCode; friend bool operator== (const PeerLinkOpenStart & a, const PeerLinkOpenStart & b); @@ -92,10 +85,7 @@ * * \brief 802.11s Peer link close management frame * - * Peer link management frame included the following (see chapters 7.4.12.1-7.4.12.3 of 802.11s): - * - Subtype field - * - Association ID field - * - Supported rates + * Peer link close frame includes the following: * - Mesh ID of mesh */ class PeerLinkCloseStart : public Header @@ -105,14 +95,8 @@ ///\brief fields: struct PlinkCloseStartFields { - uint8_t subtype; - IePeeringProtocol protocol; //Peering protocol version - in all subtypes - 3 octets - uint16_t capability; //open and confirm - uint16_t aid; //confirm only - SupportedRates rates; //open and confirm + IePeeringProtocol protocol; //Peering protocol version - 3 octets IeMeshId meshId; //open and close - IeConfiguration config; //open and confirm - uint16_t reasonCode; //close only }; void SetPlinkCloseStart (PlinkCloseStartFields); PlinkCloseStartFields GetFields () const; @@ -126,14 +110,7 @@ virtual uint32_t Deserialize (Buffer::Iterator start); private: - uint8_t m_subtype; - IePeeringProtocol m_protocol; - uint16_t m_capability; - uint16_t m_aid; - SupportedRates m_rates; IeMeshId m_meshId; - IeConfiguration m_config; - uint16_t m_reasonCode; friend bool operator== (const PeerLinkCloseStart & a, const PeerLinkCloseStart & b); @@ -148,11 +125,10 @@ * * \brief 802.11s Peer link confirm management frame * - * Peer link management frame included the following (see chapters 7.4.12.1-7.4.12.3 of 802.11s): - * - Subtype field + * Peer link confirm frame includes the following: * - Association ID field * - Supported rates - * - Mesh ID of mesh + * - Configuration */ class PeerLinkConfirmStart : public Header { @@ -161,14 +137,11 @@ ///\brief fields: struct PlinkConfirmStartFields { - uint8_t subtype; - IePeeringProtocol protocol; //Peering protocol version - in all subtypes - 3 octets + IePeeringProtocol protocol; //Peering protocol version - 3 octets uint16_t capability; //open and confirm uint16_t aid; //confirm only SupportedRates rates; //open and confirm - IeMeshId meshId; //open and close IeConfiguration config; //open and confirm - uint16_t reasonCode; //close only }; void SetPlinkConfirmStart (PlinkConfirmStartFields); PlinkConfirmStartFields GetFields () const; @@ -182,14 +155,10 @@ virtual uint32_t Deserialize (Buffer::Iterator start); private: - uint8_t m_subtype; - IePeeringProtocol m_protocol; uint16_t m_capability; uint16_t m_aid; SupportedRates m_rates; - IeMeshId m_meshId; IeConfiguration m_config; - uint16_t m_reasonCode; friend bool operator== (const PeerLinkConfirmStart & a, const PeerLinkConfirmStart & b); diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/dot11s/peer-management-protocol-mac.cc --- a/src/mesh/model/dot11s/peer-management-protocol-mac.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/dot11s/peer-management-protocol-mac.cc Fri Aug 07 15:15:38 2015 -0700 @@ -104,7 +104,6 @@ PeerLinkOpenStart peerFrame; packet->RemoveHeader (peerFrame); fields = peerFrame.GetFields (); - NS_ASSERT (fields.subtype == actionValue.selfProtectedAction); if (!fields.meshId.IsEqual ( *(m_protocol->GetMeshId ()))) { m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress); @@ -119,7 +118,6 @@ m_stats.brokenMgt++; return false; } - aid = fields.aid; config = fields.config; } else if (actionValue.selfProtectedAction == WifiActionHeader::PEER_LINK_CONFIRM) @@ -128,7 +126,6 @@ PeerLinkConfirmStart peerFrame; packet->RemoveHeader (peerFrame); fields = peerFrame.GetFields (); - NS_ASSERT (fields.subtype == actionValue.selfProtectedAction); if (!(m_parent->CheckSupportedRates (fields.rates))) { m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress); @@ -145,7 +142,6 @@ PeerLinkCloseStart peerFrame; packet->RemoveHeader (peerFrame); fields = peerFrame.GetFields (); - NS_ASSERT (fields.subtype == actionValue.selfProtectedAction); if (!fields.meshId.IsEqual ( *(m_protocol->GetMeshId ()))) { m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress); @@ -153,12 +149,10 @@ m_stats.brokenMgt++; return false; } - aid = fields.aid; - config = fields.config; } else { - NS_FATAL_ERROR ("Unknown subtype" << actionValue.selfProtectedAction); + NS_FATAL_ERROR ("Unknown Self-protected Action type: " << actionValue.selfProtectedAction); } Ptr peerElement; //Peer Management element is the last element in this frame - so, we can use MeshInformationElementVector @@ -167,21 +161,21 @@ peerElement = DynamicCast(elements.FindFirst (IE11S_PEERING_MANAGEMENT)); NS_ASSERT (peerElement != 0); - //Check taht frame subtype corresponds peer link subtype + //Check that frame subtype corresponds to peer link subtype if (peerElement->SubtypeIsOpen ()) { m_stats.rxOpen++; - NS_ASSERT (actionValue.selfProtectedAction == WifiActionHeader::PEER_LINK_OPEN); + NS_ASSERT (actionValue.selfProtectedAction == WifiActionHeader::PEER_LINK_OPEN); } if (peerElement->SubtypeIsConfirm ()) { m_stats.rxConfirm++; - NS_ASSERT (actionValue.selfProtectedAction == WifiActionHeader::PEER_LINK_CONFIRM); + NS_ASSERT (actionValue.selfProtectedAction == WifiActionHeader::PEER_LINK_CONFIRM); } if (peerElement->SubtypeIsClose ()) { m_stats.rxClose++; - NS_ASSERT (actionValue.selfProtectedAction == WifiActionHeader::PEER_LINK_CLOSE); + NS_ASSERT (actionValue.selfProtectedAction == WifiActionHeader::PEER_LINK_CLOSE); } //Deliver Peer link management frame to protocol: m_protocol->ReceivePeerLinkFrame (m_ifIndex, peerAddress, peerMpAddress, aid, *peerElement, config); @@ -256,7 +250,6 @@ m_stats.txOpen++; WifiActionHeader::ActionValue action; action.selfProtectedAction = WifiActionHeader::PEER_LINK_OPEN; - fields.subtype = WifiActionHeader::PEER_LINK_OPEN; actionHdr.SetAction (WifiActionHeader::SELF_PROTECTED, action); plinkOpen.SetPlinkOpenStart (fields); packet->AddHeader (plinkOpen); @@ -267,7 +260,6 @@ PeerLinkConfirmStart::PlinkConfirmStartFields fields; fields.rates = m_parent->GetSupportedRates (); fields.capability = 0; - fields.meshId = *(m_protocol->GetMeshId ()); fields.config = meshConfig; PeerLinkConfirmStart plinkConfirm; WifiActionHeader actionHdr; @@ -275,7 +267,6 @@ WifiActionHeader::ActionValue action; action.selfProtectedAction = WifiActionHeader::PEER_LINK_CONFIRM; fields.aid = aid; - fields.subtype = WifiActionHeader::PEER_LINK_CONFIRM; actionHdr.SetAction (WifiActionHeader::SELF_PROTECTED, action); plinkConfirm.SetPlinkConfirmStart (fields); packet->AddHeader (plinkConfirm); @@ -284,17 +275,12 @@ if (peerElement.SubtypeIsClose ()) { PeerLinkCloseStart::PlinkCloseStartFields fields; - fields.rates = m_parent->GetSupportedRates (); - fields.capability = 0; fields.meshId = *(m_protocol->GetMeshId ()); - fields.config = meshConfig; PeerLinkCloseStart plinkClose; WifiActionHeader actionHdr; m_stats.txClose++; WifiActionHeader::ActionValue action; action.selfProtectedAction = WifiActionHeader::PEER_LINK_CLOSE; - fields.subtype = WifiActionHeader::PEER_LINK_CLOSE; - fields.reasonCode = peerElement.GetReasonCode (); actionHdr.SetAction (WifiActionHeader::SELF_PROTECTED, action); plinkClose.SetPlinkCloseStart (fields); packet->AddHeader (plinkClose); diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/model/flame/flame-header.cc --- a/src/mesh/model/flame/flame-header.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/model/flame/flame-header.cc Fri Aug 07 15:15:38 2015 -0700 @@ -52,8 +52,8 @@ void FlameHeader::Print (std::ostream &os) const { - os << "Cost = " << (uint16_t) m_cost << std::endl << "Sequence number = " << m_seqno - << std::endl << "Orig Destination = " << m_origDst << std::endl << "Orig Source = " << m_origSrc << std::endl; + os << "Cost= " << (uint16_t) m_cost << ", Sequence number= " << m_seqno + << ", Orig Destination= " << m_origDst << ", Orig Source= " << m_origSrc; } uint32_t FlameHeader::GetSerializedSize (void) const diff -r e01e8d47bcfe -r 296fc50c5411 src/mesh/test/dot11s/dot11s-test-suite.cc --- a/src/mesh/test/dot11s/dot11s-test-suite.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/mesh/test/dot11s/dot11s-test-suite.cc Fri Aug 07 15:15:38 2015 -0700 @@ -218,10 +218,7 @@ { PeerLinkOpenStart a; PeerLinkOpenStart::PlinkOpenStartFields fields; - fields.subtype = (uint8_t)(WifiActionHeader::PEER_LINK_OPEN); fields.capability = 0; - fields.aid = 101; - fields.reasonCode = 12; fields.meshId = IeMeshId ("qwertyuiop"); a.SetPlinkOpenStart (fields); Ptr packet = Create (); @@ -233,11 +230,8 @@ { PeerLinkConfirmStart a; PeerLinkConfirmStart::PlinkConfirmStartFields fields; - fields.subtype = (uint8_t)(WifiActionHeader::PEER_LINK_CONFIRM); fields.capability = 0; fields.aid = 1234; - fields.reasonCode = 12; - fields.meshId = IeMeshId ("qwerty"); a.SetPlinkConfirmStart (fields); Ptr packet = Create (); packet->AddHeader (a); @@ -248,11 +242,7 @@ { PeerLinkCloseStart a; PeerLinkCloseStart::PlinkCloseStartFields fields; - fields.subtype = (uint8_t)(WifiActionHeader::PEER_LINK_CLOSE); - fields.capability = 0; - fields.aid = 10; fields.meshId = IeMeshId ("qqq"); - fields.reasonCode = 12; a.SetPlinkCloseStart (fields); Ptr packet = Create (); packet->AddHeader (a); diff -r e01e8d47bcfe -r 296fc50c5411 src/wifi/model/mgt-headers.cc --- a/src/wifi/model/mgt-headers.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/wifi/model/mgt-headers.cc Fri Aug 07 15:15:38 2015 -0700 @@ -20,6 +20,7 @@ * Author: Mirko Banchi */ +#include #include "mgt-headers.h" #include "ns3/simulator.h" #include "ns3/assert.h" @@ -729,9 +730,68 @@ return GetTypeId (); } +std::string +WifiActionHeader::CategoryValueToString (CategoryValue value) const +{ + if (value == BLOCK_ACK) + { + return "BlockAck"; + } + else if (value == MESH) + { + return "Mesh"; + } + else if (value == SELF_PROTECTED) + { + return "SelfProtected"; + } + else if (value == VENDOR_SPECIFIC_ACTION) + { + return "VendorSpecificAction"; + } + else + { + std::ostringstream convert; + convert << value; + return convert.str (); + } +} +std::string +WifiActionHeader::SelfProtectedActionValueToString (SelfProtectedActionValue value) const +{ + if (value == PEER_LINK_OPEN) + { + return "PeerLinkOpen"; + } + else if (value == PEER_LINK_CONFIRM) + { + return "PeerLinkConfirm"; + } + else if (value == PEER_LINK_CLOSE) + { + return "PeerLinkClose"; + } + else if (value == GROUP_KEY_INFORM) + { + return "GroupKeyInform"; + } + else if (value == GROUP_KEY_ACK) + { + return "GroupKeyAck"; + } + else + { + std::ostringstream convert; + convert << value; + return convert.str (); + } +} + void WifiActionHeader::Print (std::ostream &os) const { + os << "category=" << CategoryValueToString ((CategoryValue) m_category) + << ", value=" << SelfProtectedActionValueToString ((SelfProtectedActionValue) m_actionValue); } uint32_t diff -r e01e8d47bcfe -r 296fc50c5411 src/wifi/model/mgt-headers.h --- a/src/wifi/model/mgt-headers.h Thu Aug 06 21:47:47 2015 -0700 +++ b/src/wifi/model/mgt-headers.h Fri Aug 07 15:15:38 2015 -0700 @@ -473,6 +473,8 @@ private: + std::string CategoryValueToString (CategoryValue value) const; + std::string SelfProtectedActionValueToString (SelfProtectedActionValue value) const; uint8_t m_category; //!< Category of the action uint8_t m_actionValue; //!< Action value }; diff -r e01e8d47bcfe -r 296fc50c5411 src/wifi/model/wifi-information-element-vector.cc --- a/src/wifi/model/wifi-information-element-vector.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/wifi/model/wifi-information-element-vector.cc Fri Aug 07 15:15:38 2015 -0700 @@ -115,7 +115,12 @@ void WifiInformationElementVector::Print (std::ostream & os) const { - /// \todo + for (IE_VECTOR::const_iterator i = m_elements.begin (); i != m_elements.end (); i++) + { + os << "("; + (*i)->Print (os); + os << ")"; + } } void diff -r e01e8d47bcfe -r 296fc50c5411 src/wifi/model/wifi-mac-header.cc --- a/src/wifi/model/wifi-mac-header.cc Thu Aug 06 21:47:47 2015 -0700 +++ b/src/wifi/model/wifi-mac-header.cc Fri Aug 07 15:15:38 2015 -0700 @@ -1091,12 +1091,12 @@ case WIFI_MAC_MGT_ACTION_NO_ACK: PrintFrameControl (os); os << " Duration/ID=" << m_duration << "us" - << "DA=" << m_addr1 << ", SA=" << m_addr2 << ", BSSID=" << m_addr3 + << ", DA=" << m_addr1 << ", SA=" << m_addr2 << ", BSSID=" << m_addr3 << ", FragNumber=" << std::hex << (int) m_seqFrag << std::dec << ", SeqNumber=" << m_seqSeq; break; case WIFI_MAC_MGT_MULTIHOP_ACTION: os << " Duration/ID=" << m_duration << "us" - << "RA=" << m_addr1 << ", TA=" << m_addr2 << ", DA=" << m_addr3 + << ", RA=" << m_addr1 << ", TA=" << m_addr2 << ", DA=" << m_addr3 << ", FragNumber=" << std::hex << (int) m_seqFrag << std::dec << ", SeqNumber=" << m_seqSeq; break; case WIFI_MAC_DATA: @@ -1104,19 +1104,19 @@ os << " Duration/ID=" << m_duration << "us"; if (!m_ctrlToDs && !m_ctrlFromDs) { - os << "DA=" << m_addr1 << ", SA=" << m_addr2 << ", BSSID=" << m_addr3; + os << ", DA=" << m_addr1 << ", SA=" << m_addr2 << ", BSSID=" << m_addr3; } else if (!m_ctrlToDs && m_ctrlFromDs) { - os << "DA=" << m_addr1 << ", SA=" << m_addr3 << ", BSSID=" << m_addr2; + os << ", DA=" << m_addr1 << ", SA=" << m_addr3 << ", BSSID=" << m_addr2; } else if (m_ctrlToDs && !m_ctrlFromDs) { - os << "DA=" << m_addr3 << ", SA=" << m_addr2 << ", BSSID=" << m_addr1; + os << ", DA=" << m_addr3 << ", SA=" << m_addr2 << ", BSSID=" << m_addr1; } else if (m_ctrlToDs && m_ctrlFromDs) { - os << "DA=" << m_addr3 << ", SA=" << m_addr4 << ", RA=" << m_addr1 << ", TA=" << m_addr2; + os << ", DA=" << m_addr3 << ", SA=" << m_addr4 << ", RA=" << m_addr1 << ", TA=" << m_addr2; } else {