#include <netelem.h>
Inheritance diagram for NetElement:
Public Member Functions | |
unsigned int | GetId (void) const |
NetElement * | GetTo (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 |
NetElement * | ConnectTo (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) |
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.
|
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.
|
|
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
Reimplemented in SrcSink. |
|
|
|
|
|
|
|
For trace use only.
|
|
Logs a trace line in the trace file.
|
|
Receives a packet from one of the upstream NetElement attached to this one. To be implemented in derived classes.
Implemented in PacketSink, SrcSink, and Server. |
|
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. |
|
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. |
|
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
Reimplemented in Server. |
|
For trace use only.
|
|
Activates the traces for all NetElements. Has to be called before creating any NetElement. The trace file has nam-compatible format. |
|
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.
|