Helper base-class implementing the PacketType interface. More...
#include <senf/Packets/PacketType.hh>
Inherited by senf::PPPoEPacketTypeBase< PPPoEDPacketType >, senf::PPPoEPacketTypeBase< PPPoESPacketType >, senf::DataPacketType, senf::DTCPHelloPacketType, senf::EthernetPacketType, senf::EthOUIExtensionPacketType, senf::EthVLanCPacketType, senf::EthVLanSPacketType, senf::GREPacketType, senf::ICMPv6EchoReplyType, senf::ICMPv6EchoRequestType, senf::ICMPv6ErrDestUnreachableType, senf::ICMPv6ErrParamProblemType, senf::ICMPv6ErrTimeExceededType, senf::ICMPv6ErrTooBigType, senf::ICMPv6PacketType, senf::InformationElementsPacketType, senf::IPv4PacketType, senf::IPv6DestinationOptionsPacketType, senf::IPv6FragmentPacketType, senf::IPv6HopByHopOptionsPacketType, senf::IPv6PacketType, senf::IPv6RoutingPacketType, senf::LlcSnapPacketType, senf::MIHGenericPayloadPacketType, senf::MIHPacketType, senf::MLDv2ListenerQueryType, senf::MLDv2ListenerReportType, senf::MPESectionType, senf::NDPNeighborAdvertisementMessageType, senf::NDPNeighborSolicitationMessageType, senf::NDPRedirectMessageType, senf::NDPRouterAdvertisementMessageType, senf::NDPRouterSolicitationMessageType, senf::PPPoEPacketTypeBase< PacketType >, senf::RadiotapPacketType, senf::RTPPacketType, senf::SNDUPacketType, senf::TCPPacketType, senf::TransportPacketType, senf::UDPPacketType, senf::WLANBeaconPacketType, senf::WLANPacket_CtrlFrameType, senf::WLANPacket_DataFrameType, and senf::WLANPacket_MgtFrameType.
Public Types | |
typedef Packet | packet |
typedef senf::detail::packet::iterator | iterator |
typedef senf::detail::packet::const_iterator | const_iterator |
typedef senf::detail::packet::size_type | size_type |
typedef senf::detail::packet::difference_type | difference_type |
typedef senf::detail::packet::byte | byte |
typedef PacketInterpreterBase::range | range |
typedef PacketInterpreterBase::optional_range | optional_range |
typedef PacketInterpreterBase::factory_t | factory_t |
typedef VoidPacketParser | parser |
Parser to parser packet fields. More... | |
Static Public Member Functions | |
static optional_range | no_range () |
static factory_t | no_factory () |
template<class PacketType > | |
static factory_t | factory () |
static size_type | initSize () |
Get size of new (empty) packet. More... | |
static size_type | initHeadSize () |
Get size of new (empty) packet header. More... | |
static void | init (packet p) |
Initialize new packet. More... | |
static optional_range | nextPacketRange (packet p) |
Get next packet placement. More... | |
static factory_t | nextPacketType (packet p) |
Get type of next packet. More... | |
static void | finalize (packet p) |
Finalize packet. More... | |
static void | dump (packet p, std::ostream &os) |
Dump packet data in readable form. More... | |
Helper base-class implementing the PacketType interface.
This helper class maybe used when building a new PacketType. It provides a complete default implementations of this interface. To define a new PacketType, derive from this class and implement the members you want to change.
You may leave out any one of the members (you should however always define the \c packet typedef member)
Definition at line 100 of file PacketType.hh.
Definition at line 108 of file PacketType.hh.
Definition at line 105 of file PacketType.hh.
Definition at line 107 of file PacketType.hh.
Definition at line 112 of file PacketType.hh.
Definition at line 104 of file PacketType.hh.
Definition at line 111 of file PacketType.hh.
typedef Packet senf::PacketTypeBase::packet |
Definition at line 102 of file PacketType.hh.
Parser to parser packet fields.
This typedef has to be set to the parser of the packet
The default is a VoidPacketParser which does not parse any field.
Definition at line 118 of file PacketType.hh.
Definition at line 110 of file PacketType.hh.
Definition at line 106 of file PacketType.hh.
|
static |
Dump packet data in readable form.
The dump() function writes out a complete representation of the packet. This is used for most for debugging purposes.
The default implementation does nothing.
|
static |
|
static |
Finalize packet.
finalize() will be called to complete a packet after it has been modified. This function must calculate any checksums, set size fields from the interpreter chain etc.
The default implementation does nothing.
|
static |
Initialize new packet.
This member is called to initialize a just created new packet. The new packet will have a size of at least initSize() but the size may well be larger. It is also possible for the packet to already have further sub-packets.
The default implementation does nothing.
|
static |
Get size of new (empty) packet header.
This function gives the index within a newly created, empty packet where a sub-packet is to be placed.
The default implementation returns initSize().
|
static |
Get size of new (empty) packet.
The default implementation returns 0.
|
static |
Get next packet placement.
nextPacketRange returns the iterator range where the next packet (header) is placed within the current packet.
The default implementation always returns no_range()
.
interpreter::range(b,e)
(where b and e are the iterators delimiting the next packet range) if the packet allows a next header. The returned range is allowed to be empty. interpreter::no_range()
(a default constructed no_range
instance) if no next header is allowed Get type of next packet.
nextPacketType retrieves the type of the next packet returning a factory to create that packet.
The default implementation always returns no_factory()
.
interpreter::factory<OtherPacketType>()
if the type of the packet can be determined interpreter::no_factory()
if the type of the packet cannot be determined or no next packet is supported
|
static |
|
static |