improve pretty-printing output.

This commit is contained in:
Mathieu Lacage
2008-03-19 11:10:37 -07:00
parent 1518a1dbd1
commit cabfd83031
7 changed files with 11 additions and 19 deletions

View File

@@ -786,11 +786,10 @@ WifiMacHeader::GetInstanceTypeId (void) const
void
WifiMacHeader::PrintFrameControl (std::ostream &os) const
{
os << "("
<< "ToDS=" << m_ctrlToDs << ", FromDS=" << m_ctrlFromDs
os << "ToDS=" << m_ctrlToDs << ", FromDS=" << m_ctrlFromDs
<< ", MoreFrag=" << m_ctrlMoreFrag << ", Retry=" << m_ctrlRetry
<< ", MoreData=" << m_ctrlMoreData
<< ")";
;
}
void

View File

@@ -102,24 +102,20 @@ ArpHeader::Print (std::ostream &os) const
{
if (IsRequest ())
{
os << "("
<< "request "
os << "request "
<< "source mac: " << m_macSource << " "
<< "source ipv4: " << m_ipv4Source << " "
<< "dest ipv4: " << m_ipv4Dest
<< ")"
;
}
else
{
NS_ASSERT (IsReply ());
os << "("
<< "reply "
os << "reply "
<< "source mac: " << m_macSource << " "
<< "source ipv4: " << m_ipv4Source << " "
<< "dest mac: " << m_macDest << " "
<< "dest ipv4: " <<m_ipv4Dest
<< ")"
;
}
}

View File

@@ -220,14 +220,13 @@ Ipv4Header::Print (std::ostream &os) const
{
flags = "XX";
}
os << "("
<< "tos 0x" << std::hex << m_tos << std::dec << " "
os << "tos 0x" << std::hex << m_tos << std::dec << " "
<< "ttl " << m_ttl << " "
<< "id " << m_identification << " "
<< "offset " << m_fragmentOffset << " "
<< "flags [" << flags << "] "
<< "length: " << (m_payloadSize + 5 * 4)
<< ") "
<< " "
<< m_source << " > " << m_destination
;
}

View File

@@ -110,9 +110,8 @@ UdpHeader::GetInstanceTypeId (void) const
void
UdpHeader::Print (std::ostream &os) const
{
os << "("
<< "length: " << m_payloadSize + GetSerializedSize ()
<< ") "
os << "length: " << m_payloadSize + GetSerializedSize ()
<< " "
<< m_sourcePort << " > " << m_destinationPort
;
}

View File

@@ -120,7 +120,7 @@ EthernetHeader::Print (std::ostream &os) const
// ethernet, right ?
if (m_enPreambleSfd)
{
os << " preamble/sfd=" << m_preambleSfd << ",";
os << "preamble/sfd=" << m_preambleSfd << ",";
}
os << " length/type=0x" << std::hex << m_lengthType << std::dec

View File

@@ -103,7 +103,7 @@ EthernetTrailer::GetInstanceTypeId (void) const
void
EthernetTrailer::Print (std::ostream &os) const
{
os << " fcs=" << m_fcs;
os << "fcs=" << m_fcs;
}
uint32_t
EthernetTrailer::GetSerializedSize (void) const

View File

@@ -64,11 +64,10 @@ LlcSnapHeader::GetInstanceTypeId (void) const
void
LlcSnapHeader::Print (std::ostream &os) const
{
os << "(type 0x";
os << "type 0x";
os.setf (std::ios::hex, std::ios::basefield);
os << m_etherType;
os.setf (std::ios::dec, std::ios::basefield);
os << ")";
}
void