Main Page | Modules | Class Hierarchy | Class List | Directories | Class Members | Related Pages | Examples

Trace Class Reference
[Network Data Structures]

Aggregate containing a packet trace. More...

#include <Aggregate.h>

Inheritance diagram for Trace:

Aggregate PacketListener List of all members.

Public Types

typedef TraceIteratorconst_iterator

Public Member Functions

 Trace (uint32_t maxLen)
 Trace (const Trace &toCopy)
 Trace (const StreamKey &key)
virtual Traceclone (void) const
const TraceIteratorbegin (void) const
const TraceIteratorend (void) const
void setMaxLength (uint32_t maxLength)
virtual const TraceIteratoraddPacket (Packet *pkt)
virtual int getPacketCount (void) const
uint32_t getMaxLength (void)
PacketgetPacket (int index) throw ( IndexOutOfBoundsException )
Tracesubset (const PacketFilter &filter)
const AttributegetAttrib (const std::string &ident) const throw ( UnknownAttributeException )
 Return a reference to the requested attribute, or throw an exception if the attribute doesn't exist for this aggregate.
const StreamKeygetStreamKey (void) const
virtual void addAttrib (const std::string &ident, const Attribute &attrib, uint32_t tier=0)
 Add an attribute to the aggregate.
void addListener (PacketListener &listener)
void setParent (Aggregate &p)
void setStreamKey (const StreamKey &stream)
virtual void handlePacket (TraceIterator &newPkt)
void copyFrom (const Aggregate &toCopy)
void clear (void)

Protected Member Functions

virtual Traceoperator= (const Trace &rhs)
void callListeners (TraceIterator &newPkt)

Protected Attributes

std::vector< Packet * > trace
uint32_t maxLength
TraceIterator beginning
TraceIterator ending
std::map< std::string, Attribute * > attributes
std::vector< std::vector<
Attribute * > > 
std::map< std::string, Aggregate * > aggregates
std::vector< PacketListener * > listeners

Static Protected Attributes

static const PacketCountAttribute countAttrib

Detailed Description

Aggregate containing a packet trace.

Any references to packets obtained from a Trace should not be expected to persist. Eventually, Trace should be able to swap out its packets to disk transparently, so if you need to use data from the Trace, either grab a TraceIterator (which accesses the packet safely) or copy the data.
Examples:, and

Member Function Documentation

void Aggregate::addAttrib const std::string &  ident,
const Attribute attrib,
uint32_t  tier = 0
[virtual, inherited]

Add an attribute to the aggregate.

[in] attrib is a pointer to an attribute to be added; the attribute includes a specification of how the attribute is to be computed. The attribute will be cloned before being added to the aggregate.
Examples:, and

void Aggregate::addListener PacketListener listener  )  [inherited]

Add a PacketListener for the aggregate

listener PacketListener wishing to be notified of new packets
Will not take responsibility for the listener; its memory will still have to be cleaned up. Note that this is NOT an issue for Attributes, as the attributes of an aggregate are cleaned up independently of its listeners.
Examples:, and

const TraceIterator & Trace::addPacket Packet pkt  )  [virtual]

add a packet to the underlying trace

TraceIterator pointing to the packet
When addPacket is called, the Trace takes responsibility for the Packet given to it, including for deallocating the memory when the Trace is destroyed. Also, the Trace will register the context with the Packet.

void Aggregate::callListeners TraceIterator newPkt  )  [protected, inherited]

Notify any listeners that a packet has been added to the Aggregate.

Any Aggregate subclasses have to invoke this method when a new packet is added; for now, it's too difficult to do a template method trick.

const Attribute & Aggregate::getAttrib const std::string &  ident  )  const throw ( UnknownAttributeException ) [inherited]

Return a reference to the requested attribute, or throw an exception if the attribute doesn't exist for this aggregate.

ident string identifying the Attribute requested, will correspond, in the usual case, to the string used to add the attribute with addAttrib (q.v.).
ident could also be of a compound form comprised of zero or more subaggregates followed by an attribute followed by zero or more subattributes, all dot-seperated. e.g. "forward.count" to get the value of the PacketCount attribute 'count' of the subaggregate 'forward', or "count.forward" to get the forward subattribute of the PacketCount attribute 'count', or "port80.count.forward" to get the 'forward' subattribute of the 'count' attribute of the 'port80' subaggregate.

UnknownAttributeException thrown if no Attribute of the requested name has been added to the Aggregate.
Examples:, and

uint32_t Trace::getMaxLength void   )  [inline]

return the size of the sliding window, or UINT32_T_MAX if unlimited

virtual int Trace::getPacketCount void   )  const [inline, virtual]

get the number of packets in the underlying trace - including any that have been dropped off the end of the rolling window, if applicable

Reimplemented from Aggregate.

void Aggregate::handlePacket TraceIterator newPkt  )  [virtual, inherited]

handler for a new packet

Implements PacketListener.

Trace & Trace::operator= const Trace rhs  )  [protected, virtual]

not implemented; provided to avoid implicit definitions and for later implementation

void Trace::setMaxLength uint32_t  maxLength  ) 

Specify that the trace is only to hold a certain number of packets

maxLength Maximum length, or UINT32_T_MAX for no limit

Trace * Trace::subset const PacketFilter filter  ) 

get a subset of the Aggregate matching the given filter

a pointer to a new aggregate (allocated by new; caller is responsible for deleting it)

Member Data Documentation

std::map<std::string, Aggregate*> Aggregate::aggregates [protected, inherited]


std::map<std::string, Attribute*> Aggregate::attributes [protected, inherited]


const PacketCountAttribute Aggregate::countAttrib [static, protected, inherited]

prototype packet count attribute - a clone will be added by individual aggregates

std::vector<PacketListener*> Aggregate::listeners [protected, inherited]

ProtocolParsers listening for new packets

Aggregate* Aggregate::parent [protected, inherited]

Aggregate containing this one, if any

StreamKey* Aggregate::streamKey [protected, inherited]

Key indicating to which stream this Trace belongs, if applicable

std::vector< std::vector<Attribute*> > Aggregate::tiers [protected, inherited]

tiers for prioritizing attributes

reimplement this to use a vector of pairs and the STL sort algorithm

The documentation for this class was generated from the following files:
Generated on Thu Apr 5 01:02:39 2007 for ANTARES by  doxygen 1.4.2