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

Aggregate Class Reference
[Network Data Structures]

Base class for aggregates of packets; main subclass is Trace. More...

#include <Aggregate.h>

Inheritance diagram for Aggregate:

PacketListener Decomposition Trace List of all members.

Public Types

typedef std::map< std::string,
Aggregate * >::const_iterator 
const_iterator

Public Member Functions

 Aggregate (const Aggregate &toCopy)
 copy the structure of an aggregate
virtual Aggregateclone (void) const
virtual int getPacketCount (void) const
 Return the number of packets contained within the aggregate.
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 Aggregateoperator= (const Aggregate &rhs)
void callListeners (TraceIterator &newPkt)

Protected Attributes

std::map< std::string, Attribute * > attributes
std::vector< std::vector<
Attribute * > > 
tiers
std::map< std::string, Aggregate * > aggregates
std::vector< PacketListener * > listeners
StreamKeystreamKey
Aggregateparent

Static Protected Attributes

static const PacketCountAttribute countAttrib

Detailed Description

Base class for aggregates of packets; main subclass is Trace.

An Aggregate can contain other Aggregates, and should at some level contain packets (e.g. an Aggregate of Traces will not directly contain packets, but those Traces will).

An Aggregate will have a StreamKey; this indicates how this particular aggregate is distinguished from others at the same level. For example, when aggregating by 5-tuple (protocol, src/dst addr, src/dest port), an IPv4Key may be used, which stores the values of that 5-tuple. For a top-level Aggregate, the StreamKey will be null.

Listeners

Attributes

Built in Attributes automatically provided by an Aggregate:


Constructor & Destructor Documentation

Aggregate::Aggregate const Aggregate toCopy  ) 
 

copy the structure of an aggregate

Note:
currently the contents of an aggregate are NOT copied, nor are contextual elements like the parent or streamkey.


Member Function Documentation

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

Add an attribute to the aggregate.

Parameters:
[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:
profile_streams_thesis.cc, and test_harness.cc.

void Aggregate::addListener PacketListener listener  ) 
 

Add a PacketListener for the aggregate

Parameters:
listener PacketListener wishing to be notified of new packets
Note:
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:
profile_streams_thesis.cc, and test_harness.cc.

void Aggregate::callListeners TraceIterator newPkt  )  [protected]
 

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

Note:
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 )
 

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

Parameters:
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.

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

int Aggregate::getPacketCount void   )  const [virtual]
 

Return the number of packets contained within the aggregate.

The count of packets in an Aggregate can also be accessed via the 'count' attribute - for non-Trace Aggregates, that may be the only reliable way to get it, as this method probably will not be implemented properly.

Todo:
this is going to get tricky if we need a packet count of non-basic aggregates that contain other (not necessarily exclusive) aggregates (i.e. overlapping sub-aggregates).

Reimplemented in Trace.

void Aggregate::handlePacket TraceIterator newPkt  )  [virtual]
 

handler for a new packet

Implements PacketListener.

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

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


Member Data Documentation

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

sub-aggregates

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

attributes

const PacketCountAttribute Aggregate::countAttrib [static, protected]
 

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

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

ProtocolParsers listening for new packets

Aggregate* Aggregate::parent [protected]
 

Aggregate containing this one, if any

StreamKey* Aggregate::streamKey [protected]
 

Key indicating to which stream this Trace belongs, if applicable

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

tiers for prioritizing attributes

Todo:
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:36 2007 for ANTARES by  doxygen 1.4.2