#include <Packet.h>
Inheritance diagram for Packet:
Public Member Functions | |
Packet (const Packet &toCopy) throw ( UnseatedPacketUseException ) | |
Packet (const Timeval &time, uint32_t pktLen, uint32_t capLen, const u_char *data) | |
virtual Packet * | clone () const |
Packet * | ghost () |
const Timeval & | getTimestamp (void) const |
get the timestamp of the packet | |
Timeval | getTimeDelta (void) const throw ( UnknownAttributeException ) |
get the difference in timestamps between this packet and the previous one in the packet's context | |
uint32_t | getPacketLength (void) const |
get the length of the packet on the wire | |
uint32_t | getCapturedLength (void) const |
get the number of bytes of the packet captured | |
uint32_t | getDataLength (void) const |
get the number of contiguous bytes of packet data returned by getPacketData | |
const u_char * | getPacketData (void) const |
TraceIterator | getPrevPacket (void) const throw ( IndexOutOfBoundsException ) |
get the next packet in this packet's context | |
TraceIterator | getNextPacket (void) const throw ( IndexOutOfBoundsException ) |
get the previous packet in this packet's context | |
const std::vector< TraceIterator > & | getAncestors (void) const |
get a reference to the ancestors list | |
const std::vector< TraceIterator > & | getDescendants (void) const |
get a reference to the descendants list | |
const TraceIterator & | getContext (void) const |
const PacketAttributeValue & | getAttrib (const PacketAttribute &attrib) const throw ( UnknownAttributeException ) |
get the value of an attribute | |
const PacketAttributeValue & | getAttrib (const PacketAttribute &attrib, int direction) const throw ( UnknownAttributeException, InsufficientDataException ) |
get the value of an attribute | |
virtual std::string | toString (void) const |
u_char | operator[] (int index) const throw ( IndexOutOfBoundsException ) |
TraceIterator & | getRealPacket (void) |
const TraceIterator & | getRealPacket (void) const |
const u_char * | getData (uint32_t offset, uint32_t length) const throw ( IndexOutOfBoundsException ) |
virtual uint32_t | getPayloadOffset (void) const throw ( InsufficientDataException ) |
virtual uint32_t | getPayloadLength (void) const throw ( InsufficientDataException ) |
virtual uint32_t | getCapturedPayloadLength (void) const throw ( InsufficientDataException ) |
bool | addAncestor (const TraceIterator &it) throw ( UnseatedPacketUseException ) |
bool | addDescendant (const TraceIterator &it) throw ( UnseatedPacketUseException ) |
void | removeAncestor (const TraceIterator &it) |
void | removeDescendant (const TraceIterator &it) |
void | setContext (const TraceIterator &it) |
bool | setData (const TraceIterator &it, uint32_t offset, uint32_t length) |
bool | setData (const u_char *pktData, uint32_t length) |
Static Public Attributes | |
static const int | ATTRIB_SEARCH_FORWARD = 1 |
static const int | ATTRIB_SEARCH_BACKWARD = 2 |
static const int | ATTRIB_SEARCH_BOTH = 3 |
Protected Member Functions | |
virtual const PacketAttributeValue & | getAttribLocal (const PacketAttribute &attrib) const throw ( UnknownAttributeException, InsufficientDataException ) |
At the moment, Packet is being used as both a superclass for other packet types, and as a basic "raw packet" datatype. It may be useful to seperate out the latter functionality, though it doesn't appear necessary at this time.
Packets are tightly coupled with Aggregates; a Packet should not generally be constructed without an Aggregate to contain it.
|
For Packet, the copy c-tor is a little funky. If the packet is being ghosted, the 'ghosting' flag will be set in toCopy, and the ctor should behave appropriately. Otherwise, the copy ctor assumes that a new packet is being spawned, and will link it in to the parent packet as a descendant. The reason it is done in such an awkward way is to make it transparent to subclasses; the subclass' clone() method should just call the copy ctor, and not worry about ghosting. Note that this ctor will not set the new packet as a descendant of the original packet; that will have to be done manually or by setData().
|
|
Create a new Packet with the specified fields. It will be assumed that this is a brand new packet, not derived from another one; if that is not the case, use one of the constructors that takes a TraceIterator of the original packet from which the new one will be a derivative.
|
|
add a reference to an ancestor packet from which this packet was derived
|
|
add a reference to a descendant packet derived from this one
|
|
clone() creates a copy of this packet NOTE: packet relationships are not copied Reimplemented in CHDLCPacket, EthernetPacket, IPv4Packet, LLCPacket, NullPacket, TCPPacket, and UDPPacket. |
|
get the value of an attribute If the attribute is not found locally, attempt to obtain it from the packet's ancestors. |
|
get the value of an attribute If the attribute is not found locally, attempt to obtain it from the packet's ancestors.
|
|
get attributes specific to this particular type of Packet. For Packet, this does nothing, it's a placeholder for subclasses to override. For fans of the gang of four, this corresponds to the "template method" design pattern, IIRC.
Reimplemented in CHDLCPacket, EthernetPacket, IPv4Packet, LLCPacket, NullPacket, TCPPacket, and UDPPacket. |
|
return the length of the actual payload part of the packet, i.e. captured packet length less the current layer's header
|
|
get a pointer to the raw data of the packet.
Notes:
|
|
get the previous packet in this packet's context
|
|
return the length of the payload part of the packet, i.e. packet length on the wire less the current layer's header
|
|
return the offset of the payload part of the packet, i.e. less the current layer's header
Reimplemented in CHDLCPacket, EthernetPacket, IPv4Packet, LLCPacket, NullPacket, TCPPacket, and UDPPacket. |
|
get the next packet in this packet's context
|
|
Obtain a reference to a TraceIterator over the real Packet represented by this Packet. That may be this packet itself, or it may be another packet if this one is a ghost. |
|
get the difference in timestamps between this packet and the previous one in the packet's context
|
|
ghost() creates a ghost copy of this packet NOTE: Should be const, but cannot be, with the current implementation of ghosting. |
|
the public operator[] does not allow modifications
|
|
remove a specified ancestor from this packet's family tree. Notes:
|
|
remove a specified descendant from this packet's family. Notes:
|
|
set the 'context' of the packet - i.e. where it lives Notes:
|
|
set the data of the packet (i.e. including the header) to the given data; forces a copy. This is the preferred form for reassembled packets. |
|
set the data of the packet (i.e. including the header) to the given substring of another packet. Notes:
|
|
Attribute search is to be performed backwards in the hierarchy - called by a descendant |
|
Attribute search is to be performed both forward and backwards in the hierarchy |
|
Attribute search is to be performed forward in the hierarchy - called by an ancestor |