INET Framework for OMNeT++/OMNEST
inet::MultiNetworkLayerLowerMultiplexer Class Reference

#include <MultiNetworkLayerLowerMultiplexer.h>

Inheritance diagram for inet::MultiNetworkLayerLowerMultiplexer:

Public Member Functions

 MultiNetworkLayerLowerMultiplexer ()
 
virtual ~MultiNetworkLayerLowerMultiplexer ()
 

Protected Member Functions

virtual void handleMessage (cMessage *message) override
 
int getProtocolCount ()
 
int getProtocolIndex (cMessage *message)
 

Constructor & Destructor Documentation

inet::MultiNetworkLayerLowerMultiplexer::MultiNetworkLayerLowerMultiplexer ( )
inline
29 {}
virtual inet::MultiNetworkLayerLowerMultiplexer::~MultiNetworkLayerLowerMultiplexer ( )
inlinevirtual
30 {}

Member Function Documentation

int inet::MultiNetworkLayerLowerMultiplexer::getProtocolCount ( )
protected

Referenced by handleMessage().

51 {
52  return 3;
53 }
int inet::MultiNetworkLayerLowerMultiplexer::getProtocolIndex ( cMessage *  message)
protected

Referenced by handleMessage().

56 {
57  // TODO: handle the case when some network protocols are disabled
58  if (false)
59  ;
60 #ifdef WITH_IPv4
61  else if (dynamic_cast<IPv4Datagram *>(message) || dynamic_cast<ARPPacket *>(message))
62  return 0;
63 #endif // ifdef WITH_IPv4
64 #ifdef WITH_IPv6
65  else if (dynamic_cast<IPv6Datagram *>(message))
66  return 1;
67 #endif // ifdef WITH_IPv6
68 #ifdef WITH_GENERIC
69  else if (dynamic_cast<GenericDatagram *>(message))
70  return 2;
71 #endif // ifdef WITH_GENERIC
72  else
73  throw cRuntimeError("Unknown message");
74 }
void inet::MultiNetworkLayerLowerMultiplexer::handleMessage ( cMessage *  message)
overrideprotectedvirtual
39 {
40  cGate *arrivalGate = message->getArrivalGate();
41  const char *arrivalGateName = arrivalGate->getBaseName();
42  if (!strcmp(arrivalGateName, "ifUpperIn"))
43  send(message, "ifLowerOut", arrivalGate->getIndex() / getProtocolCount());
44  else if (!strcmp(arrivalGateName, "ifLowerIn"))
45  send(message, "ifUpperOut", getProtocolCount() * arrivalGate->getIndex() + getProtocolIndex(message));
46  else
47  throw cRuntimeError("Unknown arrival gate");
48 }
int getProtocolIndex(cMessage *message)
Definition: MultiNetworkLayerLowerMultiplexer.cc:55
int getProtocolCount()
Definition: MultiNetworkLayerLowerMultiplexer.cc:50

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