X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FDefaultBundle%2FIpV4Packet.cc;h=8daed86a7c8bedcceaf01ad5a12724349e4212bb;hb=f13c1275e48e97dceb7de7925793a4c69a5aeb61;hp=eaa3a51a2715504f00b6a6315d5f0af2bf872294;hpb=31d85cd6b8e03c5ecc924ca8892906be1bab702f;p=senf.git diff --git a/Packets/DefaultBundle/IpV4Packet.cc b/Packets/DefaultBundle/IpV4Packet.cc index eaa3a51..8daed86 100644 --- a/Packets/DefaultBundle/IpV4Packet.cc +++ b/Packets/DefaultBundle/IpV4Packet.cc @@ -24,54 +24,44 @@ #include "IpV4Packet.hh" //#include "IpV4Packet.ih" -#include "EthernetPacket.hh" // Custom includes #include #include #include +#include "EthernetPacket.hh" #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// namespace { - senf::PacketRegistry::RegistrationProxy + senf::PacketRegistry::RegistrationProxy registerIpV4Packet (0x0800); - senf::PacketRegistry::RegistrationProxy + senf::PacketRegistry::RegistrationProxy regsiterIpV4Packet2 (4); // IP-in-IP encapsulation } -prefix_ void senf::IpV4Packet::v_nextInterpreter() - const -{ - registerInterpreter(protocol(),begin()+bytes(),end()); -} - -prefix_ void senf::IpV4Packet::v_finalize() -{} - -prefix_ void senf::IpV4Packet::v_dump(std::ostream & os) - const +prefix_ void senf::IpV4PacketType::dump(packet p, std::ostream & os) { struct in_addr in; - in.s_addr = htonl(source()); + in.s_addr = htonl(p->source()); char buffer[128]; std::string src (inet_ntop(AF_INET,&in,buffer,128)); - in.s_addr = htonl(destination()); + in.s_addr = htonl(p->destination()); std::string dst (inet_ntop(AF_INET,&in,buffer,128)); os << "Internet protocol Version 4:\n" - << " version : " << version() << "\n" - << " IHL : " << ihl() << "\n" - << " TOS : " << unsigned(tos()) << "\n" - << " length : " << length() << "\n" - << " identifier : " << identifier() << "\n" - << " DF : " << df() << "\n" - << " MF : " << mf() << "\n" - << " fragment : " << frag() << "\n" - << " TTL : " << unsigned(ttl()) << "\n" - << " protocol : " << unsigned(protocol()) << "\n" - << " CRC : " << std::hex << crc() << std::dec << "\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" + << " CRC : " << std::hex << p->crc() << std::dec << "\n" << " source : " << src << "\n" << " destination : " << dst << "\n"; } @@ -87,4 +77,5 @@ prefix_ void senf::IpV4Packet::v_dump(std::ostream & os) // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" +// comment-column: 40 // End: