X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FDefaultBundle%2FIpV4Packet.cc;h=b88987bc828189ac2b08a4033a5bbd48cdb11ed0;hb=f1fc7057fa65a9509651d08c6c134d136fbb0424;hp=6b163a6d55262164213cadd12c7b17ffc57761ba;hpb=8421c3a8da7485cb8781045494ecaab3ed84f403;p=senf.git diff --git a/Packets/DefaultBundle/IpV4Packet.cc b/Packets/DefaultBundle/IpV4Packet.cc index 6b163a6..b88987b 100644 --- a/Packets/DefaultBundle/IpV4Packet.cc +++ b/Packets/DefaultBundle/IpV4Packet.cc @@ -20,16 +20,17 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// Definition of non-inline non-template functions +/** \file + \brief IpV4Packet non-inline non-template implementation */ #include "IpV4Packet.hh" //#include "IpV4Packet.ih" -#include "EthernetPacket.hh" // Custom includes #include #include #include +#include "EthernetPacket.hh" #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// @@ -42,38 +43,22 @@ namespace { 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()); - char buffer[128]; - std::string src (inet_ntop(AF_INET,&in,buffer,128)); - in.s_addr = htonl(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" - << " source : " << src << "\n" - << " destination : " << dst << "\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 : " << p->source() << "\n" + << " destination : " << p->destination() << "\n"; } ///////////////////////////////cc.e//////////////////////////////////////// @@ -86,4 +71,6 @@ prefix_ void senf::IpV4Packet::v_dump(std::ostream & os) // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: