Public Member Functions | Protected Member Functions | Protected Attributes

RealworldDevice Class Reference

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

#include <RealworldDevice.h>

Inheritance diagram for RealworldDevice:
RealworldConnector TunOutDevice UdpOutDevice

List of all members.

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

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

Definition at line 38 of file RealworldDevice.h.


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.

Definition at line 27 of file RealworldDevice.cc.

{

    RealworldConnector::initialize(stage);

    // register our interface entry in IRoutingTable
    if (stage == 0) {
        interfaceEntry = registerInterface();
    }

}

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

Reimplemented from RealworldConnector.

Definition at line 51 of file RealworldDevice.h.

    {
        return 4;
    }

InterfaceEntry * RealworldDevice::registerInterface (  )  [protected]

Register the interface in the interface table of the parent.

Returns:
A pointer to the Interface entry

Definition at line 39 of file RealworldDevice.cc.

Referenced by initialize().

{
    InterfaceEntry *e = new InterfaceEntry();

    // interface name: our module name without special characters ([])
    char *interfaceName = new char[strlen(getFullName())+1];
    char *d=interfaceName;
    for (const char *s=getFullName(); *s; s++)
        if (isalnum(*s))
            *d++ = *s;
    *d = '\0';

    e->setName(interfaceName);
    delete [] interfaceName;

    // port: index of gate where our "netwIn" is connected (in IP)
    int outputPort = /*getParentModule()->*/gate("netwIn")->getPreviousGate()->getIndex();
    e->setNodeOutputGateId(outputPort);

    // generate a link-layer address to be used as interface token for IPv6
    InterfaceToken token(0, simulation.getUniqueNumber(), 64);
    e->setInterfaceToken(token);

    // MTU: typical values are 576 (Internet de facto), 1500 (Ethernet-friendly),
    // 4000 (on some point-to-point links), 4470 (Cisco routers default, FDDI compatible)
    e->setMtu(mtu);

    // capabilities
    e->setMulticast(true);
    e->setPointToPoint(true);

    // add
    IInterfaceTable *ift = InterfaceTableAccess().get();
    ift->addInterface(e, this);

    return e;
}


Member Data Documentation

InterfaceEntry* RealworldDevice::interfaceEntry [protected]

Definition at line 42 of file RealworldDevice.h.

Referenced by initialize().


The documentation for this class was generated from the following files: