RealworldDevice Class Reference

#include <RealworldDevice.h>

Inheritance diagram for RealworldDevice:

RealworldConnector TunOutDevice UdpOutDevice

List of all members.


Detailed Description

RealworldDevice is a pseudo interface that allows communcation with the real world through the TunOutScheduler.

WARNING: This does ONLY work with the combination IPv4|UDP|OverlayMessage

Public Member Functions

 Module_Class_Members (RealworldDevice, RealworldConnector, 0)
virtual int numInitStages () const
virtual void initialize (int stage)
 Initialization of the module.

Protected Member Functions

InterfaceEntry * registerInterface ()
 Register the interface in the interface table of the parent.

Protected Attributes

InterfaceEntry * interfaceEntry


Member Function Documentation

InterfaceEntry * RealworldDevice::registerInterface (  )  [protected]

Register the interface in the interface table of the parent.

Returns:
A pointer to the Interface entry
00040 {
00041     InterfaceEntry *e = new InterfaceEntry();
00042 
00043     // interface name: our module name without special characters ([])
00044     char *interfaceName = new char[strlen(fullName())+1];
00045     char *d=interfaceName;
00046     for (const char *s=fullName(); *s; s++)
00047         if (isalnum(*s))
00048             *d++ = *s;
00049     *d = '\0';
00050 
00051     e->setName(interfaceName);
00052     delete [] interfaceName;
00053 
00054     // port: index of gate where our "netwIn" is connected (in IP)
00055     int outputPort = /*parentModule()->*/gate("netwIn")->fromGate()->index();
00056     e->setNodeOutputGateId(outputPort);
00057 
00058     // generate a link-layer address to be used as interface token for IPv6
00059     InterfaceToken token(0, simulation.getUniqueNumber(), 64);
00060     e->setInterfaceToken(token);
00061 
00062     // MTU: typical values are 576 (Internet de facto), 1500 (Ethernet-friendly),
00063     // 4000 (on some point-to-point links), 4470 (Cisco routers default, FDDI compatible)
00064     e->setMtu(mtu);
00065 
00066     // capabilities
00067     e->setMulticast(true);
00068     e->setPointToPoint(true);
00069 
00070     // add
00071     InterfaceTable *ift = InterfaceTableAccess().get();
00072 //    ift->addInterface(e, NULL);
00073     ift->addInterface(e, this);
00074 
00075     return e;
00076 }

RealworldDevice::Module_Class_Members ( RealworldDevice  ,
RealworldConnector  ,
 
)

virtual int RealworldDevice::numInitStages ( void   )  const [inline, virtual]

Reimplemented from RealworldConnector.

00054     {
00055         return 4;
00056     }

void RealworldDevice::initialize ( int  stage  )  [virtual]

Initialization of the module.

Registers the device at the scheduler and searches for the appropriate payload-parser Will be called automatically at startup

Reimplemented from RealworldConnector.

00028 {
00029 
00030     RealworldConnector::initialize(stage);
00031 
00032     // register our interface entry in RoutingTable
00033     if (stage == 0) {
00034         interfaceEntry = registerInterface();
00035     }
00036 
00037 }


Member Data Documentation

InterfaceEntry* RealworldDevice::interfaceEntry [protected]


The documentation for this class was generated from the following files:
Generated on Thu Apr 17 13:19:30 2008 for ITM OverSim by  doxygen 1.5.3