#include <wscout_gui_header_base.hh>
Public Types | |
enum | { protocol = Proto } |
typedef std::pair < protocol::id, const void * > | next_header |
enum | { header_margin = 2 } |
Public Member Functions | |
HeaderBase (QWidget *parent=0) | |
virtual next_header | setup (const void *packet, size_t caplen, const Trace &trace, const pcapxx::frame_descriptor &desc)=0 |
QBoxLayout * | layout () |
Static Public Member Functions | |
static AbstractHeader * | allocator () |
static void | registerProtocol () |
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".
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.
wscout::gui::HeaderBase< Exact, Proto >::HeaderBase | ( | QWidget * | parent = 0 |
) | [inline] |
Default constructor.
Subclasses must provide a default constructor.
AbstractHeader * wscout::gui::HeaderBase< Exact, Proto >::allocator | ( | ) | [inline, static] |
Allocate an instance of Exact
using new
.
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, | |||
const Trace & | trace, | |||
const pcapxx::frame_descriptor & | desc | |||
) | [pure virtual, inherited] |
Setup the widget for a specific packet.
This method is purely abstract. You must define it when subclassing.
[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. |
Implemented in wscout::gui::IEEE80211BeaconHeader, wscout::gui::IEEE80211Header, wscout::gui::PcapHeader, and wscout::gui::PrismHeader.
QBoxLayout * wscout::gui::HeaderFrame::layout | ( | ) | [inline, inherited] |
This protocol header widget's layout.