Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members

NetElement Class Reference

#include <netelem.h>

Inheritance diagram for NetElement:

Enveloper Fragmenter PacketSink PacketSource Server VoIPEnveloper SrcSink BiStateSource VoiceTraceFileSource List of all members.

Public Member Functions

unsigned int GetId (void) const
NetElementGetTo (unsigned int k) const
unsigned int GetSizeTo (void) const
virtual void Send (timeunits now, Packet *p)
virtual void Recv (timeunits now, Packet *p)=0
virtual void Reset (bool dump=false)=0
NetElementConnectTo (NetElement *to)
virtual void FragmentDrop (Packet *p)
bool IsTraceing (void) const
FILE * traceFile (void) const
void packetTrace (timeunits t, char event, Packet *p)

Static Public Member Functions

static void traceOn (char *filename=0)
static void Transit (timeunits t)
static void Batch (timeunits tinitial, timeunits lapse, int batches)
static void resetAll (bool dump=false)

Protected Member Functions

virtual void namConnectTrace (void)

Detailed Description

Abstract class NetElement, to be derived onto Sources, Sinks and Servers.

Contains member functions to attach one NetElement to others Possible arrangements are 1 to 1, 1 to N and N to 1. The attachment enables this NetElement to pass packets to the attached ones.


Member Function Documentation

NetElement * NetElement::ConnectTo NetElement to  ) 
 

Connects the output of this NetElement to the argument's input. The pointed element address is stored in the last position of a STL vector.

Parameters:
to pointer to the downstream NetElement to attach to.
Returns:
a pointer to the next NetElement.

void NetElement::FragmentDrop Packet p  )  [virtual]
 

FragmentDrop will be chain-called by attached NetElements up to the last one, to immediately inform of a packet drop. This is useful to keep track of packet or fragment statistics.

Some NetElements (typically Sinks) may not implement FragmentDrop, so this base-class member function is provided as last resort. It will copy the packet and call the FragmentDrop member function of every downstream-attached NetElement

Parameters:
p pointer to the dropped packet. Route information can be retrieved from the packet, allowing calling only the neccesary NetElements

Reimplemented in SrcSink.

unsigned int NetElement::GetId void   )  const
 

Returns:
unique element identifier.

unsigned int NetElement::GetSizeTo void   )  const [inline]
 

Returns:
number of elements this one is connected to.

NetElement * NetElement::GetTo unsigned int  k  )  const
 

Parameters:
k donwstream NetElement to retrieve
Returns:
pointer to the k-th NetElement this one is attached to.

bool NetElement::IsTraceing void   )  const [inline]
 

For trace use only.

Returns:
true if tracing is activated.

false otherwise

void NetElement::packetTrace timeunits  t,
char  event,
Packet p
 

Logs a trace line in the trace file.

Parameters:
t time at which the event takes place
event nam-compatible event indicator. Can be either '+', 'd', '-' or 'h'.
p pointer to the packet to log. Other relevant data are taken from the packet.

virtual void NetElement::Recv timeunits  now,
Packet p
[pure virtual]
 

Receives a packet from one of the upstream NetElement attached to this one. To be implemented in derived classes.

Parameters:
now current time
p pointer to packet to be sent

Implemented in PacketSink, SrcSink, and Server.

virtual void NetElement::Reset bool  dump = false  )  [pure virtual]
 

To be implemented in every derived class, this function resets every statistical measure and counter of this NetElement. This eliminates the transient period effect. Must be kept public in the derived classes.

Implemented in PacketSource, PacketSink, SrcSink, Server, and Fragmenter.

void NetElement::resetAll bool  dump = false  )  [static]
 

Runs through an STL list that contains pointers to every constructed NetElement and invoke its Reset() member function. This static member function is automatically used by Transit.

void NetElement::Send timeunits  now,
Packet p
[virtual]
 

Sends a packet to the downstream-attached NetElements. Depending on the packet's data, sending may be either unicast (to one adjacent NetElement, as indicated by the packet) or broadcast (to every adjacent NetElement, if no information is provided by the packet). In the latter case, packets are replicated as needed. This member function can be overrided (but this is usually unnecessary). Defaults to calling the Recv member function of the downstream-attached NetElement

Parameters:
now current time
p pointer to packet to be sent

Reimplemented in Server.

FILE* NetElement::traceFile void   )  const [inline]
 

For trace use only.

Returns:
the trace file.

void NetElement::traceOn char *  filename = 0  )  [static]
 

Activates the traces for all NetElements. Has to be called before creating any NetElement. The trace file has nam-compatible format.

void NetElement::Transit timeunits  t  )  [static]
 

Enqueues a special event to reset the statistical measures of every NetElement at a given time. This includes not only statistical acumulators, but also any private counter the specific NetElements may have.

Parameters:
t time at which the statistics should be reseted.


The documentation for this class was generated from the following files:
Generated on Fri Jan 19 15:35:17 2007 by  doxygen 1.4.2