Parse an IPv4 packet. More...

#include <senf/Packets/DefaultBundle/IPv4Packet.hh>

Inheritance diagram for senf::IPv4PacketParser:

Public Types

typedef UInt16Parser length_t
 
typedef UInt16Parser identifier_t
 
typedef UInt8Parser ttl_t
 
typedef UInt8Parser protocol_t
 
typedef UInt16Parser checksum_t
 
typedef INet4AddressParser source_t
 
typedef INet4AddressParser destination_t
 
- Public Types inherited from senf::PacketParserBase
typedef detail::packet::iterator data_iterator
 Raw data iterator type. More...
 
typedef detail::packet::size_type size_type
 Unsigned integral type. More...
 
typedef detail::packet::difference_type difference_type
 Signed integral type. More...
 
typedef detail::packet::byte byte
 Unsigned 8bit value, the raw value type. More...
 
typedef PacketDatastate_type
 Type of the 'state' parameter. More...
 
typedef PacketParserBase parser_base_type
 Base type of the next parser. More...
 

Public Member Functions

senf::UIntFieldParser<?,?+4 > version () const
 
senf::UIntFieldParser<?,?+4 > ihl () const
 
senf::UIntFieldParser<?,?+6 > dscp () const
 
senf::UIntFieldParser<?,?+2 > ecn () const
 
UInt16Parser length () const
 
UInt16Parser identifier () const
 
senf::FlagParser<?> df () const
 
senf::FlagParser<?> mf () const
 
senf::UIntFieldParser<?,?+13 > frag () const
 
UInt8Parser ttl () const
 
UInt8Parser protocol () const
 
UInt16Parser checksum () const
 
INet4AddressParser source () const
 
INet4AddressParser destination () const
 
void init ()
 
boost::uint16_t calcChecksum () const
 calculate header checksum More...
 
bool validateChecksum () const
 validate header checksum More...
 
- Public Member Functions inherited from senf::PacketParserBase
data_iterator i () const
 Return beginning of data to parse. More...
 
data_iterator i (size_type offset) const
 Return iterator offset bytes from the start. More...
 
state_type state () const
 Return state of this parser. More...
 
PacketDatadata () const
 Access the packets raw data container. More...
 
void init () const
 Default implementation. More...
 

Protected Member Functions

senf::FlagParser<?> reserved () const
 
- Protected Member Functions inherited from senf::PacketParserBase
ParserProtector protect () const
 
 PacketParserBase (data_iterator i, state_type s)
 Standard constructor. More...
 
 PacketParserBase (data_iterator i, state_type s, size_type size)
 Size checking constructor. More...
 
bool check (size_type size) const
 Check size of data container. More...
 
void validate (size_type size) const
 Validate size of data container. More...
 
template<class Parser >
Parser parse (data_iterator i) const
 Create sub-parser. More...
 
template<class Parser , class Arg >
Parser parse (Arg const &arg, data_iterator i) const
 Create sub-parser. More...
 
template<class Parser >
Parser parse (size_type n) const
 Create sub-parser. More...
 
template<class Parser , class Arg >
Parser parse (Arg const &arg, size_type n) const
 Create sub-parser. More...
 
void defaultInit () const
 Default implementation. More...
 
Packet packet () const
 Get packet this parser is parsing from. More...
 
void resize (size_type oldSize, size_type newSize)
 Resize data container. More...
 

Detailed Description

Parse an IPv4 packet.

Parser implementing the IPv4 header.

IPv4Packet.png
See also
IPv4PacketType
RFC 791
Todo:
Implement options

Definition at line 52 of file IPv4Packet.hh.

Member Typedef Documentation

◆ checksum_t

Definition at line 73 of file IPv4Packet.hh.

◆ destination_t

◆ identifier_t

◆ length_t

Definition at line 63 of file IPv4Packet.hh.

◆ protocol_t

Definition at line 72 of file IPv4Packet.hh.

◆ source_t

◆ ttl_t

Definition at line 71 of file IPv4Packet.hh.

Member Function Documentation

◆ calcChecksum()

boost::uint16_t senf::IPv4PacketParser::calcChecksum ( ) const

calculate header checksum

calculate and return the checksum of the header

See also
senf::IpChecksum

Definition at line 37 of file IPv4Packet.cc.

◆ checksum()

UInt16Parser senf::IPv4PacketParser::checksum ( ) const

◆ destination()

INet4AddressParser senf::IPv4PacketParser::destination ( ) const

◆ df()

senf::FlagParser<?> senf::IPv4PacketParser::df ( ) const

◆ dscp()

senf::UIntFieldParser<?,?+ 6 > senf::IPv4PacketParser::dscp ( ) const

◆ ecn()

senf::UIntFieldParser<?,?+ 2 > senf::IPv4PacketParser::ecn ( ) const

◆ frag()

senf::UIntFieldParser<?,?+ 13 > senf::IPv4PacketParser::frag ( ) const

◆ identifier()

UInt16Parser senf::IPv4PacketParser::identifier ( ) const

◆ ihl()

senf::UIntFieldParser<?,?+ 4 > senf::IPv4PacketParser::ihl ( ) const

◆ init()

void senf::IPv4PacketParser::init ( )
inline

Definition at line 79 of file IPv4Packet.hh.

◆ length()

UInt16Parser senf::IPv4PacketParser::length ( ) const

◆ mf()

senf::FlagParser<?> senf::IPv4PacketParser::mf ( ) const

◆ protocol()

UInt8Parser senf::IPv4PacketParser::protocol ( ) const

◆ reserved()

senf::FlagParser<?> senf::IPv4PacketParser::reserved ( ) const
protected

◆ source()

INet4AddressParser senf::IPv4PacketParser::source ( ) const

◆ ttl()

UInt8Parser senf::IPv4PacketParser::ttl ( ) const

◆ validateChecksum()

bool senf::IPv4PacketParser::validateChecksum ( ) const
inline

validate header checksum

return true if the checksum field is equal to the calculated checksum

Definition at line 89 of file IPv4Packet.hh.

◆ version()

senf::UIntFieldParser<?,?+ 4 > senf::IPv4PacketParser::version ( ) const

The documentation for this struct was generated from the following files: