RealworldDevice Class Reference

#include <RealworldDevice.h>

Inheritance diagram for RealworldDevice:

RealworldConnector TunOutDevice 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

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.

00005 {
00006 
00007     RealworldConnector::initialize(stage);
00008 
00009     // register our interface entry in RoutingTable
00010     if (stage == 0) {
00011         interfaceEntry = registerInterface();
00012     }
00013 
00014 }

RealworldDevice::Module_Class_Members ( RealworldDevice  ,
RealworldConnector  ,
 
)

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

Reimplemented from RealworldConnector.

00031     {
00032         return 4;
00033     }

InterfaceEntry * RealworldDevice::registerInterface (  )  [protected]

Register the interface in the interface table of the parent.

Returns:
A pointer to the Interface entry
00017 {
00018     InterfaceEntry *e = new InterfaceEntry();
00019 
00020     // interface name: our module name without special characters ([])
00021     char *interfaceName = new char[strlen(fullName())+1];
00022     char *d=interfaceName;
00023     for (const char *s=fullName(); *s; s++)
00024         if (isalnum(*s))
00025             *d++ = *s;
00026     *d = '\0';
00027 
00028     e->setName(interfaceName);
00029     delete [] interfaceName;
00030 
00031     // port: index of gate where our "netwIn" is connected (in IP)
00032     int outputPort = /*parentModule()->*/gate("netwIn")->fromGate()->index();
00033     e->setNodeOutputGateId(outputPort);
00034 
00035     // generate a link-layer address to be used as interface token for IPv6
00036     InterfaceToken token(0, simulation.getUniqueNumber(), 64);
00037     e->setInterfaceToken(token);
00038 
00039     // MTU: typical values are 576 (Internet de facto), 1500 (Ethernet-friendly),
00040     // 4000 (on some point-to-point links), 4470 (Cisco routers default, FDDI compatible)
00041     e->setMtu(mtu);
00042 
00043     // capabilities
00044     e->setMulticast(true);
00045     e->setPointToPoint(true);
00046 
00047     // add
00048     InterfaceTable *ift = InterfaceTableAccess().get();
00049 //    ift->addInterface(e, NULL);
00050     ift->addInterface(e, this);
00051 
00052     return e;
00053 }


Member Data Documentation

InterfaceEntry* RealworldDevice::interfaceEntry [protected]


The documentation for this class was generated from the following files:
Generated on Wed Apr 4 13:37:06 2007 for ITM OverSim by  doxygen 1.4.7