now senf could also be located in ../senf
[senf.git] / Packets / DefaultBundle / IPv4Packet.cc
index 3ddffb9..131649c 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
 // Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -55,9 +55,6 @@ prefix_ boost::uint16_t senf::IPv4PacketParser::calcChecksum()
     validate(bytes(*this));
     IpChecksum summer;
     summer.feed( i(),                   i()+checksum_offset );
-    // Not needed since the number of 0-bytes is even
-    // summer.feed( 0u );
-    // summer.feed( 0u );
     summer.feed( i()+checksum_offset+2, i()+bytes(*this)    );
     return summer.sum();
 }
@@ -68,27 +65,27 @@ 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"
-       << "  IHL           : " << p->ihl() << "\n"
-       << "  TOS           : " << unsigned(p->tos()) << "\n"
-       << "  length        : " << p->length() << "\n"
-       << "  identifier    : " << p->identifier() << "\n"
-       << "  DF            : " << p->df() << "\n"
-       << "  MF            : " << p->mf() << "\n"
-       << "  fragment      : " << p->frag() << "\n"
-       << "  TTL           : " << unsigned(p->ttl()) << "\n"
-       << "  protocol      : " << unsigned(p->protocol()) << "\n"
-       << "  checksum      : 0x" 
+    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";
+       <<     "  source                  : " << p->source() << "\n"
+       <<     "  destination             : " << p->destination() << "\n";
 }
 
 prefix_ void senf::IPv4PacketType::finalize(packet p)
 {
     p->length()   << p.size();
-    p->protocol() << key(p.next());
+    p->protocol() << key(p.next(nothrow));
     p->checksum() << p->calcChecksum();
 }