minor fixes for clang++
[senf.git] / senf / Packets / DefaultBundle / EthernetPacket.cc
index b3ba75b..b1e0081 100644 (file)
@@ -2,23 +2,28 @@
 //
 // Copyright (C) 2006
 // 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
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
+// The contents of this file are subject to the Fraunhofer FOKUS Public License
+// Version 1.0 (the "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at 
+// http://senf.berlios.de/license.html
 //
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
+// The Fraunhofer FOKUS Public License Version 1.0 is based on, 
+// but modifies the Mozilla Public License Version 1.1.
+// See the full license text for the amendments.
 //
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the
-// Free Software Foundation, Inc.,
-// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+// Software distributed under the License is distributed on an "AS IS" basis, 
+// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
+// for the specific language governing rights and limitations under the License.
+//
+// The Original Code is Fraunhofer FOKUS code.
+//
+// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. 
+// (registered association), Hansastraße 27 c, 80686 Munich, Germany.
+// All Rights Reserved.
+//
+// Contributor(s):
+//   Stefan Bund <g0dil@berlios.de>
 
 /** \file
     \brief EthernetPacket non-inline non-template implementation */
 #include "LlcSnapPacket.hh"
 #include <iomanip>
 #include <boost/io/ios_state.hpp>
+#include <senf/Utils/Format.hh>
 
 #define prefix_
-///////////////////////////////cc.p////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
 
 namespace {
-    senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::EthVLanPacket>
-        registerEthVLanPacket(0x8100);
+    SENF_PACKET_REGISTRY_REGISTER( senf::EtherTypes, 0x8100, senf::EthVLanPacket);
 }
 
-///////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
 // senf::EthernetPacketType
 
 prefix_ void senf::EthernetPacketType::dump(packet p, std::ostream & os)
@@ -52,10 +57,9 @@ prefix_ void senf::EthernetPacketType::dump(packet p, std::ostream & os)
     else
         os << "Ethernet 802.3 (bad ethertype >1500 and <1536)";
     os <<     ": \n"
-       <<     "  destination             : " << p->destination() << "\n"
-       <<     "  source                  : " << p->source() << "\n"
-       <<     "  type/length             : 0x" 
-       <<     std::hex << std::setw(4) << std::setfill('0') << p->type_length() << "\n";
+       << senf::fieldName("destination")               << p->destination() << "\n"
+       << senf::fieldName("source")                    << p->source() << "\n"
+       << senf::fieldName("type/length")               << senf::format::dumpint(p->type_length().value()) << "\n";
 }
 
 prefix_ senf::PacketInterpreterBase::factory_t senf::EthernetPacketType::nextPacketType(packet p)
@@ -81,12 +85,12 @@ prefix_ void senf::EthernetPacketType::finalize(packet p)
 prefix_ void senf::EthVLanPacketType::dump(packet p, std::ostream & os)
 {
     boost::io::ios_all_saver ias(os);
-    os <<     "Ethernet 802.1q (VLAN):\n"
-       <<     "  priority                : " << p->priority() << "\n"
-       <<     "  cfi                     : " << p->cfi() << "\n"
-       <<     "  vlan-ID                 : " << p->vlanId() << "\n"
-       <<     "  ethertype               : 0x" 
-       <<     std::hex << std::setw(4) << std::setfill('0') << p->type() << "\n";
+    os << "Ethernet 802.1q (VLAN):\n"
+       << senf::fieldName("priority")                  << p->priority() << "\n"
+       << senf::fieldName("cfi")                       << p->cfi() << "\n"
+       << senf::fieldName("vlan-ID")                   << p->vlanId() << "\n"
+       << senf::fieldName("ethertype")
+       << " 0x" << std::hex << std::setw(4) << std::setfill('0') << std::right << p->type() << "\n";
 }
 
 prefix_ void senf::EthVLanPacketType::finalize(packet p)
@@ -95,7 +99,7 @@ prefix_ void senf::EthVLanPacketType::finalize(packet p)
 }
 
 
-///////////////////////////////cc.e////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
 #undef prefix_
 
 \f