22 #include <boost/io/ios_state.hpp> 44 summer.
feed( ipv4->source().i(),
45 ipv4->source().i() + IPv4Packet::Parser::source_t::fixed_bytes );
47 summer.
feed( ipv4->destination().i(),
53 summer.
feed(
i() + length_offset,
i() + length_offset + 2 );
59 summer.
feed( ipv6->source().i(),
60 ipv6->source().i() + IPv6Packet::Parser::source_t::fixed_bytes );
63 summer.
feed( ipv6->destination().i(),
67 summer.
feed(
i() + length_offset,
i() + length_offset + 2 );
77 summer.
feed(
i(),
i()+checksum_offset );
78 summer.
feed(
i()+checksum_offset+2,
data().end() );
80 boost::uint16_t rv (summer.
sum());
81 return rv ? rv : 0xffffu;
89 boost::io::ios_all_saver ias(os);
95 <<
"0x" << std::hex << std::setw(4) << std::setfill(
'0') << std::right << p->checksum() <<
"\n";
100 p->length() << p.
size();
101 p->checksum() << p->calcChecksum();
IPv6Packet public header.
Packet packet() const
Get packet this parser is parsing from.
static void dump(packet p, std::ostream &os)
Dump given UDPPacket in readable form to given output stream.
std::string fieldName(std::string const &s)
SENF_PACKET_REGISTRY_REGISTER(senf::IPTypes, senf::UDPPacketType::ipType, senf::UDPPacket)
Protocol specific packet handle.
data_iterator i() const
Return beginning of data to parse.
static void finalize(packet p)
Finalize packet.
size_type size() const
Return size of packet in bytes.
PacketData & data() const
Access the packets raw data container.
IPv4Packet public header.
IP protocol number registry.
boost::uint16_t sum() const
boost::uint16_t calcChecksum() const
calculate (pseudo-)header checksum
SENF_PACKET_INSTANTIATE_TEMPLATE(senf::UDPPacket)
static const IPTypes::key_t ipType
static size_type const fixed_bytes
void feed(boost::uint8_t byte)