senf::PacketData Class Reference
[Packet Handling]

Packet data STL-sequence view. More...

#include <senf/Packets/PacketData.hh>

Inheritance diagram for senf::PacketData:
Inheritance graph
[legend]

List of all members.


Detailed Description

Packet data STL-sequence view.

The PacketData class provides an STL-sequence compatible view of the raw packet data. Each packet/header/interpreter in the chain references the same storage area, presenting a different (but nested/overlapping) section of the data.

Whenever the data is manipulated through PacketData, the change is assumed to be within the data range of that packet: All insertions take place inside this packet and outside any following packets in the packet chain.

Warning:
It is not permissible to change data belonging to a following packet/header/interpreter even though this data is part of this sequence. Doing so will corrupt the packet data.
Warning:
When accessing packet data via the PacketData interface you are on your own: The packet is not validated in any way, you bypass all parsers.
All public members are those of an STL random-access sequence.
Implementation note:
This class is very tightly integrated with PacketInterpreterBase / PacketInterpreter. It is separated out of those classes primarily to provide a clean sequence interface to the library user and not for implementation reasons (it would have been simpler to implement all these members in PacketInterpreterBase).

Definition at line 67 of file PacketData.hh.


Public Types

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 byte  value_type
typedef byte reference
typedef byte const &  const_reference
typedef byte pointer
typedef byte const *  const_pointer

Sequence interface to raw data

iterator  begin () const
  Return iterator to beginning.
iterator  end () const
  Return iterator to end.
size_type  size () const
  Returns the number of bytes in the packet data.
bool  empty () const
  Test whether the packet data is empty.
byte  operator[] (size_type n) const
  Access byte in the packet data.
byte operator[] (size_type n)
  Access byte in the packet data.
void  insert (iterator pos, byte v)
void  insert (iterator pos, size_type n, byte v)
template<class InputIterator >
void  insert (iterator pos, InputIterator f, InputIterator l)
void  erase (iterator pos)
void  erase (iterator first, iterator last)
void  clear ()
  All bytes of the packet data dropped, leaving the container with a size of 0. */.
void  resize (size_type n, byte v=0)
void  reserve (size_type n)
size_type  capacity () const

Protected Member Functions

  PacketData (size_type b, size_type e)
detail::PacketImpl impl () const
bool  valid ()

Protected Attributes

detail::PacketImpl impl_
  Need to make this protected so we can change it in the derived class.

Member Typedef Documentation

typedef senf::detail::packet::byte senf::PacketData::
byte

Reimplemented in senf::PacketInterpreterBase.

Definition at line 78 of file PacketData.hh.

typedef senf::detail::packet::const_iterator senf::PacketData::
const_iterator

Reimplemented in senf::PacketInterpreterBase.

Definition at line 75 of file PacketData.hh.

typedef byte const* senf::PacketData::
const_pointer

Definition at line 83 of file PacketData.hh.

typedef byte const& senf::PacketData::
const_reference

Definition at line 81 of file PacketData.hh.

typedef senf::detail::packet::difference_type senf::PacketData::
difference_type

Reimplemented in senf::PacketInterpreterBase.

Definition at line 77 of file PacketData.hh.

typedef senf::detail::packet::iterator senf::PacketData::
iterator

Reimplemented in senf::PacketInterpreterBase.

Definition at line 74 of file PacketData.hh.

typedef byte* senf::PacketData::
pointer

Definition at line 82 of file PacketData.hh.

typedef byte& senf::PacketData::
reference

Definition at line 80 of file PacketData.hh.

typedef senf::detail::packet::size_type senf::PacketData::
size_type

Reimplemented in senf::PacketInterpreterBase.

Definition at line 76 of file PacketData.hh.

typedef byte senf::PacketData::
value_type

Definition at line 79 of file PacketData.hh.


Constructor & Destructor Documentation

senf::PacketData::
PacketData ( size_type  b,
size_type  e )

Definition at line 133 of file PacketData.cci.


Member Function Documentation

senf::PacketData::iterator senf::PacketData::
begin ()

Return iterator to beginning.

Returns an random access iterator referring to the first byte of the packet data.

Definition at line 47 of file PacketData.cci.

senf::PacketData::size_type senf::PacketData::
capacity ()

Definition at line 120 of file PacketData.cci.

void senf::PacketData::
clear ()

All bytes of the packet data dropped, leaving the container with a size of 0. */.

Definition at line 110 of file PacketData.cci.

bool senf::PacketData::
empty ()

Test whether the packet data is empty.

Returns whether the packet data is empty, i.e. whether its size is 0. This function does not modify the content of the packet data in any way. To clear the content use clear()

Definition at line 69 of file PacketData.cci.

senf::PacketData::iterator senf::PacketData::
end ()

Return iterator to end.

Returns an random access iterator referring to the byte past the end of the packet data.

Definition at line 55 of file PacketData.cci.

void senf::PacketData::
erase ( iterator  first,
iterator  last )

Definition at line 105 of file PacketData.cci.

void senf::PacketData::
erase ( iterator  pos )

Definition at line 100 of file PacketData.cci.

senf::detail::PacketImpl & senf::PacketData::
impl ()

Definition at line 38 of file PacketData.cci.

template<class InputIterator >
void senf::PacketData::
insert ( iterator  pos,
InputIterator  f,
InputIterator  l )

Definition at line 49 of file PacketData.cti.

void senf::PacketData::
insert ( iterator  pos,
size_type  n,
byte  v )

Definition at line 95 of file PacketData.cci.

void senf::PacketData::
insert ( iterator  pos,
byte  v )

Definition at line 90 of file PacketData.cci.

senf::PacketData::byte & senf::PacketData::
operator[] ( size_type  n )

Access byte in the packet data.

Definition at line 82 of file PacketData.cci.

senf::PacketData::byte senf::PacketData::
operator[] ( size_type  n )

Access byte in the packet data.

Definition at line 75 of file PacketData.cci.

void senf::PacketData::
reserve ( size_type  n )

Definition at line 115 of file PacketData.cci.

void senf::PacketData::
resize ( size_type  n,
byte  v = 0 )

Definition at line 37 of file PacketData.cc.

senf::PacketData::size_type senf::PacketData::
size ()

Returns the number of bytes in the packet data.

Definition at line 63 of file PacketData.cci.

bool senf::PacketData::
valid ()

Definition at line 126 of file PacketData.cci.


Member Data Documentation

Need to make this protected so we can change it in the derived class.

Definition at line 143 of file PacketData.hh.


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