PlugIn Class Reference

#include <plugin.h>

Inheritance diagram for PlugIn:

Inheritance graph
[legend]
Collaboration diagram for PlugIn:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PlugIn ()
virtual ~PlugIn ()
virtual int command (int argc, const char *const *argv)
virtual int recvAsyncClMsg (ClMessage *m)
virtual int recvSyncClMsg (ClMessage *m)
void recv (Packet *p, Handler *callback=0)
int getId ()
void setId (int val)
int getTag (char *buf, int size)
const char * getTag ()
PositiongetPosition ()
void setLayer (int val)
int getLayer ()
virtual int crLayCommand (ClMessage *m)
virtual int crLaySynchronousCommand (ClMessage *m)

Protected Member Functions

void sendAsyncClMsg (ClMessage *m, double delay=0)
void sendSynchronousCl (ClMessage *m)
void sendSyncClMsg (ClMessage *m)
void drop (ClMessage *m, const char *reason="---")
void sendCl (ClMessage *m, double delay=0)

Protected Attributes

BinbinPtr_
char tag_ [MAX_TAG_LENGTH]
int uLayerId_

Private Attributes

int uid_
ClSAPclsap_

Detailed Description

The PLUGIN class is a NsObject which has to be an entity in the architecture that has to be modelled, to facilitate its managment it has an id (and a tag for tracing purposes) It may have a connection to NodeCore in order to be able to exchange messages through the cross-layer bus to others plugin

See also:
CLSAP, NodeCore, ClMessage

Definition at line 61 of file plugin.h.


Constructor & Destructor Documentation

PlugIn::PlugIn (  ) 

PlugIn constructor

Definition at line 48 of file plugin.cc.

References tag_.

PlugIn::~PlugIn (  )  [virtual]

PlugIn destructor

Definition at line 53 of file plugin.cc.


Member Function Documentation

int PlugIn::command ( int  argc,
const char *const *  argv 
) [virtual]

TCL command interpreter. It implements the following OTcl methods:

Moreover it inherits all the OTcl method of NsObject

Parameters:
argc number of arguments in argv
argv array of strings which are the comand parameters (Note that argv[0] is the name of the object)
Returns:
TCL_OK or TCL_ERROR whether the command has been dispatched succesfully or no
See also:
Nodecore, ClSAP, Bin

Reimplemented in ChannelModule, Module, PositionDB, IPInterfaceModule, IPRoutingModule, IPModule, PortMap, PortMux, CbrModule, TcpModule, LinkChannelModule, MPhy, MMacModule, MMac, MLLModule, UmtsMacModule, RlcModule, UmtsIPInterfaceModule, UmtsPhy, UmtsPhyME, UmtsWirelessChModule, DumbWirelessChModule, WirelessChModule, WirelessPhyModule, MacModule802_11, IPAddressCodec, MrclRoutingStatic, MrclRouting, and AodvModule.

Definition at line 58 of file plugin.cc.

References binPtr_, clsap_, getId(), MAX_TAG_LENGTH, setId(), and tag_.

Referenced by Module::command(), and PositionDB::command().

Here is the call graph for this function:

int PlugIn::recvAsyncClMsg ( ClMessage m  )  [virtual]

Cross-Layer messages asynchronous interpreter.

It has to be properly extended in order to interpret custom cross-layer messages used by this particular plug-in. This type of communication does not necessarily need a reply.

Note:
Each implementation of this method is responsible for deleting the ClMessage instance referred to by ClMessage* m when the message is received
Normally, classes inheriting from other classes should call the recvAsyncClMsg() method of the parent when an unknown ClMsg is detected, in order to allow the parent to handle unknown message types.

A very importan exception to this rule are classes inheriting directly from either Plugin or Module. These classes should NOT call neither Plugin::recvAsyncClMsg() nor Module::recvAsyncClMsg() for unknown messages; instead, they should just free the memory associated with ClMessage* m

Parameters:
m an instance of ClMessage that represent the message received
Returns:
0 if the method was re-implemented by somebody, RETVAL_NOT_IMPLEMENTED if it is the implementation provided by the parent Plugin class (note that Module does not re-implement it, so also Module::recvAsyncClMsg() returns RETVAL_NOT_IMPLEMENTED)
See also:
NodeCore, ClMessage, ClSAP, ClTracer

Reimplemented in MLLModule.

Definition at line 153 of file plugin.cc.

References RETVAL_NOT_IMPLEMENTED.

Referenced by ClSAP::handle(), SAP::sendDown(), ClSAP::sendModule(), and SAP::sendUp().

int PlugIn::recvSyncClMsg ( ClMessage m  )  [virtual]

Cross-Layer messages synchronous interpreter. It has to be properly extended in order to interpret custom cross-layer messages used by this particular plug-in. This type of communication need to be directly answered in the message exchanged in order to be synchronous with the source.

Parameters:
m an instance of ClMessage that represent the message received and used for the answer
Returns:
zero if successful
See also:
NodeCore, ClMessage, ClSAP, ClTracer

Reimplemented in PositionDB, IPModule, MPhy, MMacModule, MMac, and MrclRouting.

Definition at line 186 of file plugin.cc.

References getId(), getLayer(), getTag(), RETVAL_NOT_IMPLEMENTED, and ClMessage::type().

Referenced by MrclRouting::recvSyncClMsg(), MPhy::recvSyncClMsg(), MMac::recvSyncClMsg(), MMacModule::recvSyncClMsg(), IPModule::recvSyncClMsg(), SAP::sendSynchronousDown(), ClSAP::sendSynchronousModule(), and SAP::sendSynchronousUp().

Here is the call graph for this function:

void PlugIn::recv ( Packet *  p,
Handler *  callback = 0 
)

Method inherited from NsObject, it is not used in this level of inheritance since PlugIn Class use only cross-layer messages to communicate with the other entities in the architecture

Parameters:
p pointer to the packet will be received
callback pointer to a Handler class
See also:
NodeCore, ClMessage, ClSAP, ClTracer

Reimplemented in ChannelModule, Module, CbrModule, TcpModule, LinkChannelModule, MMacModule, RlcModule, WirelessPhyModule, and MacModule802_11.

Definition at line 248 of file plugin.cc.

int PlugIn::getId (  ) 

Return the PlugIn id

Returns:
the PlugIn id [integer]

Definition at line 121 of file plugin.cc.

References uid_.

Referenced by Module::addDownSAP(), PortMap::assignPort(), PortMux::command(), command(), MLLModule::fillNetAddrTable(), AodvModule::forward(), MrclRouting::getConfiguration(), SAP::getModuleDownId(), SAP::getModuleUpId(), ClSAP::getPluginId(), MrclRouting::getRoute(), MrclRouting::recv(), CbrModule::recv(), AodvModule::recvRequest(), recvSyncClMsg(), MrclRoutingStatic::resolve(), sendAsyncClMsg(), Module::sendAsyncClMsgDown(), Module::sendAsyncClMsgUp(), Module::sendDown(), CbrModule::sendPkt(), AodvModule::sendRequest(), sendSyncClMsg(), Module::sendSyncClMsgDown(), Module::sendSyncClMsgUp(), and Module::sendUp().

void PlugIn::setId ( int  val  ) 

Set the PlugIn id

Parameters:
val the integer value that will be the PlugIn id

Definition at line 126 of file plugin.cc.

References uid_.

Referenced by command().

int PlugIn::getTag ( char *  buf,
int  size 
)

Return the PlugIn tag

Returns:
the PlugIn tag string

Definition at line 134 of file plugin.cc.

References tag_.

const char* PlugIn::getTag (  )  [inline]

Return a const pointer to the PlugIn tag

Returns:
const char pointer to the char array

Definition at line 191 of file plugin.h.

References tag_.

Referenced by recvSyncClMsg(), and Module::sendUp().

Position * PlugIn::getPosition (  ) 

Return the pointer to the Position instance within the NodeCore

Returns:
the pointer to the Position instance within the NodeCore

Definition at line 254 of file plugin.cc.

References clsap_, and ClSAP::getPosition().

Referenced by PositionDB::command(), AodvModule::forward(), WirelessChModule::getInfluencedNodes(), WirelessPhyModule::recv(), MPhy::recv(), AodvModule::sendRequest(), and WirelessChModule::sortChSAPList().

Here is the call graph for this function:

void PlugIn::setLayer ( int  val  ) 

Set the PlugIn layer id

Parameters:
val the integer value that will be the PlugIn layer id

Definition at line 179 of file plugin.cc.

References uLayerId_.

Referenced by Module::command().

int PlugIn::getLayer (  ) 

Return the PlugIn layer id

Returns:
the PlugIn layer id

Definition at line 174 of file plugin.cc.

References uLayerId_.

Referenced by recvSyncClMsg().

void PlugIn::sendAsyncClMsg ( ClMessage m,
double  delay = 0 
) [protected]

Send an asyncronous cross-layer message, i.e., it does not require a direct answer from the target. It is possible to insert a delay before the communcation will start.

Parameters:
m an instance of ClMessage to be sent
delay (optional) delay [sec.] to introduce before the comunication starts
See also:
NodecCore, ClMessage, ClTracer

Definition at line 212 of file plugin.cc.

References clsap_, getId(), ClSAP::sendClLayer(), and ClMessage::setSource().

Referenced by sendCl().

Here is the call graph for this function:

void PlugIn::sendSynchronousCl ( ClMessage m  )  [protected]

Send a syncronous cross-layer message, i.e., the target entity has to directly answer through the message exchanged

Parameters:
m an instance of ClMessage to be sent (and in which will be the target answer)
See also:
NodecCore, ClMessage, ClTracer

Definition at line 224 of file plugin.cc.

References PRINT_WARNING_DEPRECATED_FUNCTION, and sendSyncClMsg().

Here is the call graph for this function:

void PlugIn::drop ( ClMessage m,
const char *  reason = "---" 
) [protected]

Drop a cross-layer message, i.e., send it to the instance of the Bin in order to manage its tracing and deallocation

Parameters:
m pointer of the cross-layer message which has to be dropped
reason stores the string in which is indicated the motivation of the drop
See also:
Bin, Tracer, PacketTracer

Definition at line 242 of file plugin.cc.

References binPtr_, and Bin::drop().

Here is the call graph for this function:

void PlugIn::sendCl ( ClMessage m,
double  delay = 0 
) [protected]

Deprecated:
use sendAsyncClMsg(ClMessage* m, double delay) instead
Parameters:
m 
delay 

Definition at line 206 of file plugin.cc.

References PRINT_WARNING_DEPRECATED_FUNCTION, and sendAsyncClMsg().

Here is the call graph for this function:

int PlugIn::crLayCommand ( ClMessage m  )  [virtual]

Deprecated:
use recvAsyncClMsg(ClMessage* m) instead
Parameters:
m 
Returns:

Reimplemented in CbrModule, and MLLModule.

Definition at line 168 of file plugin.cc.

References RETVAL_NOT_IMPLEMENTED.

Referenced by MLLModule::crLayCommand(), CbrModule::crLayCommand(), ClSAP::handle(), MLLModule::recvAsyncClMsg(), SAP::sendDown(), ClSAP::sendModule(), and SAP::sendUp().

int PlugIn::crLaySynchronousCommand ( ClMessage m  )  [virtual]

Deprecated:
use recvSyncClMsg(ClMessage* m) instead
Parameters:
m 
Returns:

Reimplemented in MMacModule.

Definition at line 199 of file plugin.cc.

References RETVAL_NOT_IMPLEMENTED.

Referenced by MMacModule::crLaySynchronousCommand(), SAP::sendSynchronousDown(), ClSAP::sendSynchronousModule(), and SAP::sendSynchronousUp().


Member Data Documentation

Bin* PlugIn::binPtr_ [protected]

Pointer to the instance of the global Bin

Definition at line 256 of file plugin.h.

Referenced by command(), drop(), and Module::drop().

char PlugIn::tag_[MAX_TAG_LENGTH] [protected]

String identifies the plug-in in the bin-tracing

Definition at line 259 of file plugin.h.

Referenced by command(), CbrModule::command(), Module::drop(), getTag(), and PlugIn().

int PlugIn::uid_ [private]

PlugIn id

Definition at line 264 of file plugin.h.

Referenced by getId(), and setId().

ClSAP* PlugIn::clsap_ [private]

Pointer to the manager of the cross layer bus and cross layer messages

Definition at line 266 of file plugin.h.

Referenced by command(), getPosition(), sendAsyncClMsg(), and sendSyncClMsg().

int PlugIn::uLayerId_ [protected]

PlugIn Layer

Definition at line 270 of file plugin.h.

Referenced by getLayer(), and setLayer().


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