senf::ConcretePacket< PacketType > Class Template Reference
[Packet Handling]

Protocol specific packet handle. More...

#include <senf/Packets/Packet.hh>

Inheritance diagram for senf::ConcretePacket< PacketType >:
Inheritance graph
[legend]

List of all members.


Detailed Description

template<class PacketType>
class senf::ConcretePacket< PacketType >

Protocol specific packet handle.

The ConcretePacket template class extends Packet to provide protocol/packet type specific aspects. These are packet constructors and access to the parsed packet fields.

The PacketType template argument to ConcretePacket is a protocol specific and internal policy class which defines the protocol specific behavior. To access a specific type of packet, the library provides corresponding typedefs of ConcretePacket < SomePacketType > (e.g. EthernetPacket as typedef for ConcretePacket < EthernetPacketType >).

The new members provided by ConcretePacket over packet are mostly comprised of the packet constructors. These come in three major flavors:

  • The create() family of constructors will create completely new packets.
  • The createAfter() family of constructors will create new packets (with new data for the packet) after a given existing packet thereby destroying and overwriting any possibly existing packets and data after the given packet.
  • The createBefore() family of constructors will create new packets (again with new data) before a given existing packet thereby destroying and overwriting any possibly existing packets and data before the given packet.
  • The createInsertBefore() family of constructors will create new packets before a given packet inserting them into the packet chain after any existing packets before the given packet.
Whereas create() will create a completely new packet with it's own chain and data storage, createAfter(), createBefore() and createInsertBefore() extend a packet with additional headers/interpreters. createAfter() will set the payload of the given packet to the new packet whereas createBefore() and createInsertBefore() will create a new packet with the existing packet as it's payload.

createAfter() differs from Packet::parseNextAs() in that the former creates a new packet replacing any possibly existing data whereas the latter will interpret the already existing data as given by the type argument.

See also:
PacketTypeBase for a specification of the interface to be provided by the PacketType policy class.

Definition at line 565 of file Packet.hh.


Classes

struct   ParserProxy

Public Types

typedef PacketType  type
  Type of the packet.
typedef PacketType::parser  Parser

Public Member Functions

ParserProxy  operator-> () const
  Access packet fields.
Parser  parser () const
  Access packet field parser directly.

Structors and default members

  ConcretePacket ()
  Create uninitialized packet handle.
ConcretePacket  clone () const
  Create copy packet.
static factory_t  factory ()
  Return factory for packets of specific type.
static ConcretePacket  create ()
  Create default initialized packet.
static ConcretePacket  create (senf::NoInit_t)
  Create uninitialized empty packet.
static ConcretePacket  create (size_type size)
  Create default initialized packet.
static ConcretePacket  create (size_type size, senf::NoInit_t)
  Create uninitialized packet.
template<class ForwardReadableRange >
static ConcretePacket  create (ForwardReadableRange const &range)
  Create packet from given data.
static ConcretePacket  createAfter (Packet const &packet)
  Create default initialized packet after packet.
static ConcretePacket  createAfter (Packet const &packet, senf::NoInit_t)
  Create uninitialized empty packet afterpacket.
static ConcretePacket  createAfter (Packet const &packet, size_type size)
  Create default initialized packet after packet.
static ConcretePacket  createAfter (Packet const &packet, size_type size, senf::NoInit_t)
  Create uninitialized packet after packet.
template<class ForwardReadableRange >
static ConcretePacket  createAfter (Packet const &packet, ForwardReadableRange const &range)
  Create packet from given data after packet.
static ConcretePacket  createBefore (Packet const &packet)
  Create default initialized packet before packet.
static ConcretePacket  createBefore (Packet const &packet, senf::NoInit_t)
  Create uninitialized empty packet before packet.
static ConcretePacket  createInsertBefore (Packet const &packet)
  Insert default initialized packet before packet.
static ConcretePacket  createInsertBefore (Packet const &packet, senf::NoInit_t)
  Insert uninitialized empty packet before packet.

Member Typedef Documentation

template<class PacketType>
typedef PacketType::parser senf::ConcretePacket< PacketType >::
Parser

Definition at line 573 of file Packet.hh.

template<class PacketType>
typedef PacketType senf::ConcretePacket< PacketType >::
type

Type of the packet.

Reimplemented from senf::Packet.

Definition at line 572 of file Packet.hh.


Constructor & Destructor Documentation

template<class PacketType >
senf::ConcretePacket< PacketType >::
ConcretePacket ()

Create uninitialized packet handle.

An uninitialized handle is not valid(). It does not allow any operation except assignment and checking for validity.

Definition at line 170 of file Packet.cti.


Member Function Documentation

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
clone ()

Create copy packet.

clone() will create a complete copy of this packet. The returned packet will have the same data, annotations and packet chain. It does however not share any data with the original packet.

Reimplemented from senf::Packet.

Definition at line 301 of file Packet.cti.

template<class PacketType>
template<class ForwardReadableRange >
static ConcretePacket senf::ConcretePacket< PacketType >::
create ( ForwardReadableRange const &  range )

Create packet from given data.

The packet will be created from a copy of the given data. The data from the range will be copied directly into the packet representation. The data will not be validated in any way.

Parameters:
[in]  range  Boost.Range of data to construct packet from.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
create ( size_type  size,
senf::NoInit_t  )

Create uninitialized packet.

Creates an uninitialized (all-zero) packet of the exact given size.

Parameters:
[in]  size  Size of the packet to create in bytes
[in]  senf::noinit  This parameter must always have the value senf::noinit.

Definition at line 205 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
create ( size_type  size )

Create default initialized packet.

This member will create a default initialized packet with the given size. If the size parameter is smaller than the minimum allowed packet size an exception will be thrown.

Parameters:
[in]  size  Size of the packet to create in bytes.
Exceptions:
TruncatedPacketException  if size is smaller than the smallest permissible size for this type of packet.

Definition at line 198 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
create ( senf::NoInit_t  )

Create uninitialized empty packet.

This will create a completely empty and uninitialized packet with size() == 0.

Parameters:
[in]  senf::noinit  This parameter must always have the value senf::noinit.

Definition at line 191 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
create ()

Create default initialized packet.

The packet will be initialized to it's default empty state.

Definition at line 184 of file Packet.cti.

template<class PacketType>
template<class ForwardReadableRange >
static ConcretePacket senf::ConcretePacket< PacketType >::
createAfter ( Packet const &  packet,
ForwardReadableRange const &  range )

Create packet from given data after packet.

The packet will be created from a copy of the given data. The data from the range will be copied directly into the packet representation. The data will not be validated in any way. It will be appended as next header/interpreter after packet in that packets interpreter chain.

Parameters:
[in]  packet  Packet to append new packet to.
[in]  range  Boost.Range of data to construct packet from.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
createAfter ( Packet const &  packet,
size_type  size,
senf::NoInit_t  )

Create uninitialized packet after packet.

Creates an uninitialized (all-zero) packet of the exact given size. It will be appended as next header/interpreter after packet in that packets interpreter chain.

Parameters:
[in]  packet  Packet to append new packet to.
[in]  size  Size of the packet to create in bytes
[in]  senf::noinit  This parameter must always have the value senf::noinit.

Definition at line 248 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
createAfter ( Packet const &  packet,
size_type  size )

Create default initialized packet after packet.

This member will create a default initialized packet with the given size. If the size parameter is smaller than the minimum allowed packet size an exception will be thrown. It will be appended as next header/interpreter after packet in that packets interpreter chain.

Parameters:
[in]  packet  Packet to append new packet to.
[in]  size  Size of the packet to create in bytes.
Exceptions:
TruncatedPacketException  if size is smaller than the smallest permissible size for this type of packet.

Definition at line 241 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
createAfter ( Packet const &  packet,
senf::NoInit_t  )

Create uninitialized empty packet afterpacket.

This will create a completely empty and uninitialized packet with size() == 0. It will be appended as next header/interpreter after packet in that packets interpreter chain.

Parameters:
[in]  packet  Packet to append new packet to.
[in]  senf::noinit  This parameter must always have the value senf::noinit.

Definition at line 234 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
createAfter ( Packet const &  packet )

Create default initialized packet after packet.

The packet will be initialized to it's default empty state. It will be appended as next header/interpreter after packet in that packets interpreter chain.

Parameters:
[in]  packet  Packet to append new packet to.

Definition at line 227 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
createBefore ( Packet const &  packet,
senf::NoInit_t  )

Create uninitialized empty packet before packet.

Creates a completely empty and uninitialized packet. It will be prepended as previous header/interpreter before packet in that packets interpreter chain.

Warning:
This constructor will destroy any existing headers before packet and replace them with the new header.
Parameters:
[in]  packet  Packet to prepend new packet to.

Definition at line 278 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
createBefore ( Packet const &  packet )

Create default initialized packet before packet.

The packet will be initialized to it's default empty state. It will be prepended as previous header/interpreter before packet in that packets interpreter chain.

Warning:
This constructor will destroy any existing headers before packet and replace them with the new header.
Parameters:
[in]  packet  Packet to prepend new packet to.

Definition at line 271 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
createInsertBefore ( Packet const &  packet,
senf::NoInit_t  )

Insert uninitialized empty packet before packet.

Inserts a completely empty and uninitialized packet before packet into the header/interpreter chain.

Parameters:
[in]  packet  Packet before which to insert the new packet

Definition at line 292 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType > senf::ConcretePacket< PacketType >::
createInsertBefore ( Packet const &  packet )

Insert default initialized packet before packet.

The new packet header will be initialized to it' s default empty state. It will be inserted into the packet chain before packet.

Parameters:
[in]  packet  Packet before which to insert the new packet

Definition at line 285 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType >::factory_t senf::ConcretePacket< PacketType >::
factory ()

Return factory for packets of specific type.

This static member is like Packet::factory() for a specific packet of type PacketType

Definition at line 175 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType >::ParserProxy senf::ConcretePacket< PacketType >::
operator-> ()

Access packet fields.

This operator allows to access the parsed fields of the packet using the notation packet->field(). The fields of the packet are specified by the PacketType's parser member.

The members are not strictly restricted to simple field access. The parser class may have any member which is needed for full packet access (e.g. checksum validation / recreation ...)

See also:
The PacketParser facility for the parser interface.

Definition at line 319 of file Packet.cti.

template<class PacketType >
senf::ConcretePacket< PacketType >::Parser senf::ConcretePacket< PacketType >::
parser ()

Access packet field parser directly.

Access the parser of the packet. This is the same object returned by the operator->() operator. The operator however does not allow to access this object itself, only it's members.

See also:
The PacketParser facility for the parser interface

Definition at line 311 of file Packet.cti.


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