wscout::gui::HeaderBase< Exact, Proto > Struct Template Reference

Base class for all protocol header widgets. More...

#include <wscout_gui_header_base.hh>

Inheritance diagram for wscout::gui::HeaderBase< Exact, Proto >:

wscout::gui::AbstractHeader wscout::gui::HeaderFrame wscout::gui::IEEE80211Header wscout::gui::PrismHeader

List of all members.

Public Types

enum  { protocol = Proto }
typedef std::pair
< protocol::id,
const void * > 
next_header

Public Member Functions

 HeaderBase (QWidget *parent=0)
virtual next_header setup (const void *packet, size_t caplen)=0
QBoxLayout * layout ()

Static Public Member Functions

static AbstractHeaderallocator ()
static void registerProtocol ()


Detailed Description

template<class Exact, unsigned Proto>
struct wscout::gui::HeaderBase< Exact, Proto >

Base class for all protocol header widgets.

This class provides convenience functions for protocol header widgets. Subclass it so you can use registerProtocol() to register your protocol to Packet.

Proto should be your protocol identifier.

Exact should be the exact type of the subclass. e.g. IPHeader should inherit HeaderBase<IPHeader, protocol::ip>. This is an instance of the "Barton-Nackman trick".

See also:
protocol::id, AbstractHeader
Todo:
Should inherit both AbstractHeader and HeaderFrame.

Member Typedef Documentation

typedef std::pair<protocol::id, const void*> wscout::gui::AbstractHeader::next_header [inherited]

Identify this header's next header.

The first element specifies the next header's protocol. The second one points to the next header's beginning of data.

If there is no next protocol, use protocol::NONE. If the next protocol is unknown, use protocol::UNKNOWN.

See also:
protocol::id


Member Enumeration Documentation

template<class Exact, unsigned Proto>
anonymous enum

Enumerator:
protocol  Protocol identifier.


Constructor & Destructor Documentation

template<class Exact, unsigned Proto>
wscout::gui::HeaderBase< Exact, Proto >::HeaderBase ( QWidget *  parent = 0  )  [inline]

Default constructor.

Subclasses must provide a default constructor.


Member Function Documentation

template<class Exact, unsigned Proto>
AbstractHeader * wscout::gui::HeaderBase< Exact, Proto >::allocator (  )  [inline, static]

Allocate an instance of Exact using new.

template<class Exact, unsigned Proto>
void wscout::gui::HeaderBase< Exact, Proto >::registerProtocol (  )  [inline, static]

Register allocator() for protocol.

virtual next_header wscout::gui::AbstractHeader::setup ( const void *  packet,
size_t  caplen 
) [pure virtual, inherited]

Setup the widget for a specific packet.

This method is purely abstract. You must define it when subclassing.

Parameters:
[in] packet Pointer to the packet's begining.
[in] caplen Number of availabe bytes for this packet.
Returns:
The next header's type and address.
See also:
next_header

Implemented in wscout::gui::IEEE80211Header, and wscout::gui::PrismHeader.

QBoxLayout * wscout::gui::HeaderFrame::layout (  )  [inherited]

This protocol header widget's layout.


The documentation for this struct was generated from the following files:
Generated on Wed Sep 12 16:02:50 2007 for WScout by  doxygen 1.5.3