#include <MultiNetworkLayerUpperMultiplexer.h>
inet::MultiNetworkLayerUpperMultiplexer::MultiNetworkLayerUpperMultiplexer |
( |
| ) |
|
|
inline |
virtual inet::MultiNetworkLayerUpperMultiplexer::~MultiNetworkLayerUpperMultiplexer |
( |
| ) |
|
|
inlinevirtual |
int inet::MultiNetworkLayerUpperMultiplexer::getProtocolCount |
( |
| ) |
|
|
protected |
int inet::MultiNetworkLayerUpperMultiplexer::getProtocolIndex |
( |
cMessage * |
message | ) |
|
|
protected |
Referenced by handleMessage().
88 cPacket *packet = check_and_cast<cPacket *>(message);
89 cObject *controlInfo = packet->getControlInfo();
91 if (dynamic_cast<IPv4ControlInfo *>(controlInfo))
93 else if (dynamic_cast<IPv6ControlInfo *>(controlInfo))
95 else if (dynamic_cast<GenericNetworkProtocolControlInfo *>(controlInfo))
98 throw cRuntimeError(
"Unknown control info");
void inet::MultiNetworkLayerUpperMultiplexer::handleMessage |
( |
cMessage * |
message | ) |
|
|
overrideprotectedvirtual |
54 cGate *arrivalGate = message->getArrivalGate();
55 const char *arrivalGateName = arrivalGate->getBaseName();
56 if (!strcmp(arrivalGateName,
"transportUpperIn")) {
57 if (dynamic_cast<cPacket *>(message))
62 cMessage *duplicate = message->dup();
63 cObject *controlInfo = message->getControlInfo();
65 duplicate->setControlInfo(controlInfo->dup());
66 send(duplicate,
"transportLowerOut",
getProtocolCount() * arrivalGate->getIndex() + i);
71 else if (!strcmp(arrivalGateName,
"transportLowerIn"))
72 send(message,
"transportUpperOut", arrivalGate->getIndex() /
getProtocolCount());
73 else if (!strcmp(arrivalGateName,
"pingUpperIn"))
75 else if (!strcmp(arrivalGateName,
"pingLowerIn"))
78 throw cRuntimeError(
"Unknown arrival gate");
int getProtocolIndex(cMessage *message)
Definition: MultiNetworkLayerUpperMultiplexer.cc:86
int getProtocolCount()
Definition: MultiNetworkLayerUpperMultiplexer.cc:81
void inet::MultiNetworkLayerUpperMultiplexer::initialize |
( |
| ) |
|
|
overrideprotectedvirtual |
30 int transportUpperInGateSize = gateSize(
"transportUpperIn");
31 int transportUpperOutGateSize = gateSize(
"transportUpperOut");
32 if (transportUpperInGateSize != transportUpperOutGateSize)
33 throw cRuntimeError(
"Connection error: transportUpperIn[] and transportUpperOut[] gate size differ");
34 int transportLowerInGateSize = gateSize(
"transportLowerIn");
35 int transportLowerOutGateSize = gateSize(
"transportLowerOut");
36 if (transportLowerInGateSize != transportLowerOutGateSize)
37 throw cRuntimeError(
"Connection error: transportLowerIn[] and transportLowerOut[] gate size differ");
38 if (transportUpperInGateSize *
getProtocolCount() != transportLowerOutGateSize)
39 throw cRuntimeError(
"Connection error: transportUpperIn[] / transportLowerOut[] gate size ratio not correct");
40 int pingUpperInGateSize = gateSize(
"pingUpperIn");
41 int pingUpperOutGateSize = gateSize(
"pingUpperOut");
42 if (pingUpperInGateSize != pingUpperOutGateSize)
43 throw cRuntimeError(
"Connection error: pingUpperIn[] and pingUpperOut[] gate size differ");
44 int pingLowerInGateSize = gateSize(
"pingLowerIn");
45 int pingLowerOutGateSize = gateSize(
"pingLowerOut");
46 if (pingLowerInGateSize != pingLowerOutGateSize)
47 throw cRuntimeError(
"Connection error: pingLowerIn[] and pingLowerOut[] gate size differ");
49 throw cRuntimeError(
"Connection error: pingUpperIn[] / pingLowerOut[] gate size ratio not correct");
int getProtocolCount()
Definition: MultiNetworkLayerUpperMultiplexer.cc:81
The documentation for this class was generated from the following files: