Apply senf::fieldName() to all packet dump methods
[senf.git] / senf / Packets / DefaultBundle / IPv4Packet.cc
index 1cdab2e..5ef86f3 100644 (file)
@@ -62,21 +62,21 @@ prefix_ boost::uint16_t senf::IPv4PacketParser::calcChecksum()
 prefix_ void senf::IPv4PacketType::dump(packet p, std::ostream & os)
 {
     boost::io::ios_all_saver ias(os);
-    os <<     "Internet protocol Version 4:\n"
-       <<     "  version                 : " << p->version() << "\n"
-       <<     "  ip header length        : " << p->ihl() << "\n"
-       <<     "  tos                     : " << unsigned(p->tos()) << "\n"
-       <<     "  length                  : " << p->length() << "\n"
-       <<     "  identifier              : " << p->identifier() << "\n"
-       <<     "  dont fragment           : " << p->df() << "\n"
-       <<     "  more fragments          : " << p->mf() << "\n"
-       <<     "  fragment                : " << p->frag() << "\n"
-       <<     "  ttl                     : " << unsigned(p->ttl()) << "\n"
-       <<     "  protocol                : " << unsigned(p->protocol()) << "\n"
-       <<     "  checksum                : 0x" 
-         << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << std::dec << "\n"
-       <<     "  source                  : " << p->source() << "\n"
-       <<     "  destination             : " << p->destination() << "\n";
+    os << "Internet protocol Version 4:\n"
+       << senf::fieldName("version")                   << p->version() << "\n"
+       << senf::fieldName("ip header length")          << p->ihl() << "\n"
+       << senf::fieldName("tos")                       << unsigned(p->tos()) << "\n"
+       << senf::fieldName("length")                    << p->length() << "\n"
+       << senf::fieldName("identifier")                << p->identifier() << "\n"
+       << senf::fieldName("dont fragment")             << p->df() << "\n"
+       << senf::fieldName("more fragments")            << p->mf() << "\n"
+       << senf::fieldName("fragment")                  << p->frag() << "\n"
+       << senf::fieldName("ttl")                       << unsigned(p->ttl()) << "\n"
+       << senf::fieldName("protocol")                  << unsigned(p->protocol()) << "\n"
+       << senf::fieldName("checksum")
+       << "0x" << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << std::dec << "\n"
+       << senf::fieldName("source")                    << p->source() << "\n"
+       << senf::fieldName("destination")               << p->destination() << "\n";
 }
 
 prefix_ void senf::IPv4PacketType::finalize(packet p)