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::PHYHeader< Exact, Proto >

List of all members.

Public Types

enum  { protocol = Proto }
typedef std::pair
< protocol::id, const void * > 
next_header
typedef
wpl::pcap::indexed_file::packet 
packet
enum  { header_margin = 2 }

Public Member Functions

 HeaderBase (QWidget *parent=0)
virtual next_header setup (const void *bytes, size_t caplen, const Trace &trace, const packet &desc)=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, 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
typedef wpl::pcap::indexed_file ::packet wscout::gui::AbstractHeader::packet [inherited]

Frame descriptor type used by setup().


Member Enumeration Documentation

template<class Exact, unsigned Proto>
anonymous enum
Enumerator:
protocol 

Protocol identifier.

anonymous enum [inherited]
Enumerator:
header_margin 

Margins around headers.


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.

Referenced by wscout::gui::HeaderBase< Exact, Proto >::registerProtocol().

QBoxLayout * wscout::gui::HeaderFrame::layout (  )  [inline, inherited]
template<class Exact , unsigned Proto>
void wscout::gui::HeaderBase< Exact, Proto >::registerProtocol (  )  [inline, static]
virtual next_header wscout::gui::AbstractHeader::setup ( const void *  bytes,
size_t  caplen,
const Trace trace,
const packet desc 
) [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.
[in] trace Packet's corresponding gui::Trace.
[in] desc Packet's corresponding frame descriptor.
Returns:
The next header's type and address.
See also:
next_header

Implemented in wscout::gui::AVSHeader, wscout::gui::IEEE80211BeaconHeader, wscout::gui::IEEE80211Header, wscout::gui::IPv4Header, wscout::gui::IPv6Header, wscout::gui::LLCHeader, wscout::gui::PcapHeader, and wscout::gui::PrismHeader.

Referenced by wscout::gui::Packet::setup().


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

Generated by  doxygen 1.6.2