Tracer Class Reference

#include <packettracer.h>

Inheritance diagram for Tracer:

Inheritance graph
[legend]
Collaboration diagram for Tracer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Tracer (int level)
void trace (Packet *p, SAP *sap)
virtual void format (Packet *p, SAP *sap)=0
int level ()
Tracernext ()
void next (Tracer *tr)

Protected Member Functions

void writeTrace (SAP *sap, char *s,...)

Private Attributes

int level_
Tracernext_

Detailed Description

A Tracer is an object which know how to trace a Packet header (or a Packet) and whether this header is contained in the given packet. There is only one instance of Tracer for each header (or Packet) during the simulation and the order with which a Packet pass through the Tracer objects is given by the Level (ascending). Tracer has an abstract method format which must be overloaded by the derived classes. This method can permorm the string that will be writen in the trace file with the writeTrace protected method.

See also:
PktTracer, SAP

Definition at line 57 of file packettracer.h.


Constructor & Destructor Documentation

Tracer::Tracer ( int  level  ) 

Tracer constructor. The Level param indicates the position which this tracer will be stored in the system packet tracer list

Parameters:
level position int the packet tracer list (0 will be the first tracer that will process the packet)
Remarks:
If two Tracer objects have the same level the insertion order will be taken into account
See also:
PktTracer

Definition at line 37 of file packettracer.cc.

References next_.


Member Function Documentation

void Tracer::trace ( Packet *  p,
SAP sap 
)

This method is called by the PktTracer in order to trace the packet. This method call the format method and then the trace method of the next_ Tracer (if it is not null)

Parameters:
p pointer to the Packet to be traced
sap pointer to the SAP instance which ask for the trace
Remarks:
This method is not virtual, thus it can not be overloadable. Whoever wants to write a Tracer must overload the format method
See also:
format, SAP

Definition at line 67 of file packettracer.cc.

References format(), next_, and trace().

Referenced by PktTracer::trace(), and trace().

Here is the call graph for this function:

virtual void Tracer::format ( Packet *  p,
SAP sap 
) [pure virtual]

This method has to write a formatted string with the packet's information using the method writeTrace of the given SAP.

Parameters:
p pointer to the Packet to be traced
sap pointer to the SAP instance which ask for the trace
Remarks:
This method is virtual, thus it must be overloaded. The Tracer class is a SAP friend class, but a derived class can not call the protected method of SAP. This mean that when we wants to write a string in the trace file, we have to call the Tracer writeTrace method passing the SAP instance.
See also:
writeTrace, ConnectorTrace, SAP

Implemented in CommonHeaderTracer, IpHeaderTracer, RoutingTracer, CbrTracer, TcpTracer, MPhyTracer, SinrTracer, MLLTracer, UmtsTracer, WirelessPhyTracer, Mac_802_11_Tracer, AltTracerMac80211, ARP_Tracer, MrclRoutingTracer, and MrclAodvTracer.

Referenced by trace().

int Tracer::level (  ) 

Returns the level_ of the tracer

Returns:
the level_ attribute of the Tracer
See also:
level_

Definition at line 42 of file packettracer.cc.

References level_.

Referenced by PktTracer::addTracer().

Tracer * Tracer::next (  ) 

Returns the pointer to the next Tracer in the Tracer chain

Returns:
tha pointer of the next tracer of the Tracer list
See also:
PktTracer

Definition at line 47 of file packettracer.cc.

References next_.

Referenced by PktTracer::addTracer().

void Tracer::next ( Tracer tr  ) 

Set the next_ Tracer in the Tracer objects list.

Parameters:
tr pointer to the next Tracer

Definition at line 52 of file packettracer.cc.

References next_.

void Tracer::writeTrace ( SAP sap,
char *  s,
  ... 
) [protected]

This method write a string in the trace file using the method vWriteTRace of the given SAP instance

Parameters:
sap the SAP instance where the string will write.
s string to be write in the trace file. The sintax is equal to the printf C function
See also:
vWriteTRace, ConnectorTrace, SAP

Definition at line 57 of file packettracer.cc.

References ConnectorTrace::vWriteTrace().

Referenced by UmtsTracer::format(), IpHeaderTracer::format(), CommonHeaderTracer::format(), TcpTracer::format(), WirelessPhyTracer::format(), SinrTracer::format(), MPhyTracer::format(), MLLTracer::format(), ARP_Tracer::format(), AltTracerMac80211::format(), Mac_802_11_Tracer::format(), MrclRoutingTracer::format(), RoutingTracer::format(), CbrTracer::format(), and MrclAodvTracer::format().

Here is the call graph for this function:


Member Data Documentation

int Tracer::level_ [private]

The Tracer storage level

Definition at line 143 of file packettracer.h.

Referenced by level().

Tracer* Tracer::next_ [private]

The next Tracer in the PktTracer chain. The last tracer has this attribute equal to 0

Definition at line 147 of file packettracer.h.

Referenced by next(), trace(), and Tracer().


The documentation for this class was generated from the following files:
Generated on Wed Nov 26 15:52:37 2008 for NS-MIRACLE library by  doxygen 1.5.2