RealworldDevice is a pseudo interface that allows communcation with the real world through the TunOutScheduler. More...
#include <RealworldDevice.h>
Public Member Functions | |
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 |
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
Definition at line 38 of file RealworldDevice.h.
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.
Definition at line 27 of file RealworldDevice.cc.
00028 { 00029 00030 RealworldConnector::initialize(stage); 00031 00032 // register our interface entry in IRoutingTable 00033 if (stage == 0) { 00034 interfaceEntry = registerInterface(); 00035 } 00036 00037 }
virtual int RealworldDevice::numInitStages | ( | void | ) | const [inline, virtual] |
Reimplemented from RealworldConnector.
Definition at line 51 of file RealworldDevice.h.
InterfaceEntry * RealworldDevice::registerInterface | ( | ) | [protected] |
Register the interface in the interface table of the parent.
Definition at line 39 of file RealworldDevice.cc.
Referenced by initialize().
00040 { 00041 InterfaceEntry *e = new InterfaceEntry(); 00042 00043 // interface name: our module name without special characters ([]) 00044 char *interfaceName = new char[strlen(getFullName())+1]; 00045 char *d=interfaceName; 00046 for (const char *s=getFullName(); *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 = /*getParentModule()->*/gate("netwIn")->getPreviousGate()->getIndex(); 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 IInterfaceTable *ift = InterfaceTableAccess().get(); 00072 ift->addInterface(e, this); 00073 00074 return e; 00075 }
InterfaceEntry* RealworldDevice::interfaceEntry [protected] |
Definition at line 42 of file RealworldDevice.h.
Referenced by initialize().