#include <netinet/in.h>
#include <arpa/inet.h>
#include <boost/io/ios_state.hpp>
-#include "../../Utils/IpChecksum.hh"
+#include <senf/Utils/IpChecksum.hh>
#include "EthernetPacket.hh"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- senf::PacketRegistry<senf::EtherTypes>::RegistrationProxy<senf::IPv4Packet>
- registerIPv4Packet (0x0800);
-
- senf::PacketRegistry<senf::IpTypes>::RegistrationProxy<senf::IPv4Packet>
- regsiterIPv4Packet2 (4); // IP-in-IP encapsulation
+ SENF_PACKET_REGISTRY_REGISTER( senf::EtherTypes, 0x0800, senf::IPv4Packet);
+ SENF_PACKET_REGISTRY_REGISTER( senf::IpTypes, 4, senf::IPv4Packet); // IP-in-IP encapsulation
}
///////////////////////////////////////////////////////////////////////////
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)