|
INET Framework for OMNeT++/OMNEST
|
#include <NetworkProtocolBase.h>
|
| virtual void | handleRegisterService (const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive) override |
| |
| virtual void | handleRegisterProtocol (const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive) override |
| |
| virtual | ~OperationalMixin () |
| | }@ More...
|
| |
| virtual | ~ILifecycle () |
| |
| virtual void | handleRegisterServiceGroup (const ProtocolGroup &protocolGroup, cGate *gate, ServicePrimitive servicePrimitive) override |
| |
| virtual void | handleRegisterProtocolGroup (const ProtocolGroup &protocolGroup, cGate *gate, ServicePrimitive servicePrimitive) override |
| |
| virtual void | handleRegisterAnyService (cGate *gate, ServicePrimitive servicePrimitive) override |
| |
| virtual void | handleRegisterAnyProtocol (cGate *gate, ServicePrimitive servicePrimitive) override |
| |
◆ NetworkProtocolBase()
| inet::NetworkProtocolBase::NetworkProtocolBase |
( |
| ) |
|
|
protected |
◆ ~NetworkProtocolBase()
| virtual inet::NetworkProtocolBase::~NetworkProtocolBase |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ getProtocol()
| virtual const Protocol& inet::NetworkProtocolBase::getProtocol |
( |
| ) |
const |
|
protectedpure virtual |
◆ handleRegisterProtocol()
| void inet::NetworkProtocolBase::handleRegisterProtocol |
( |
const Protocol & |
protocol, |
|
|
cGate * |
gate, |
|
|
ServicePrimitive |
servicePrimitive |
|
) |
| |
|
overridevirtual |
◆ handleRegisterService()
| void inet::NetworkProtocolBase::handleRegisterService |
( |
const Protocol & |
protocol, |
|
|
cGate * |
gate, |
|
|
ServicePrimitive |
servicePrimitive |
|
) |
| |
|
overridevirtual |
◆ handleUpperCommand()
| void inet::NetworkProtocolBase::handleUpperCommand |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::LayeredProtocolBase.
137 auto request =
dynamic_cast<Request *
>(msg);
138 if (
auto *command =
dynamic_cast<L3SocketBindCommand *
>(msg->getControlInfo())) {
139 int socketId = request->getTag<SocketReq>()->getSocketId();
140 SocketDescriptor *descriptor =
new SocketDescriptor(socketId, command->getProtocol()->getId(), command->getLocalAddress());
144 else if (
auto *command =
dynamic_cast<L3SocketConnectCommand *
>(msg->getControlInfo())) {
145 int socketId = request->getTag<SocketReq>()->getSocketId();
147 throw cRuntimeError(
"Ipv4Socket: should use bind() before connect()");
151 else if (
dynamic_cast<L3SocketCloseCommand *
>(msg->getControlInfo()) !=
nullptr) {
152 int socketId = request->getTag<SocketReq>()->getSocketId();
158 auto ctrl =
new L3SocketClosedIndication();
159 indication->setControlInfo(
ctrl);
160 indication->addTag<SocketInd>()->setSocketId(socketId);
161 send(indication,
"transportOut");
◆ initialize()
| void inet::NetworkProtocolBase::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
◆ isInitializeStage()
| virtual bool inet::NetworkProtocolBase::isInitializeStage |
( |
int |
stage | ) |
const |
|
inlineoverrideprotectedvirtual |
◆ isLowerMessage()
| bool inet::NetworkProtocolBase::isLowerMessage |
( |
cMessage * |
message | ) |
const |
|
overrideprotectedvirtual |
◆ isModuleStartStage()
| virtual bool inet::NetworkProtocolBase::isModuleStartStage |
( |
int |
stage | ) |
const |
|
inlineoverrideprotectedvirtual |
◆ isModuleStopStage()
| virtual bool inet::NetworkProtocolBase::isModuleStopStage |
( |
int |
stage | ) |
const |
|
inlineoverrideprotectedvirtual |
◆ isUpperMessage()
| bool inet::NetworkProtocolBase::isUpperMessage |
( |
cMessage * |
message | ) |
const |
|
overrideprotectedvirtual |
◆ sendDown()
| void inet::NetworkProtocolBase::sendDown |
( |
cMessage * |
message, |
|
|
int |
interfaceId = -1 |
|
) |
| |
|
protectedvirtual |
◆ sendUp()
| void inet::NetworkProtocolBase::sendUp |
( |
cMessage * |
message | ) |
|
|
protectedvirtual |
53 if (Packet *packet =
dynamic_cast<Packet *
>(message)) {
56 auto remoteAddress(addr->getSrcAddress());
57 auto localAddress(addr->getDestAddress());
58 bool hasSocket =
false;
60 if (elem.second->protocolId ==
protocol->getId() &&
61 (elem.second->localAddress.isUnspecified() || elem.second->localAddress == localAddress) &&
62 (elem.second->remoteAddress.isUnspecified() || elem.second->remoteAddress == remoteAddress))
64 auto *packetCopy = packet->dup();
66 packetCopy->addTagIfAbsent<SocketInd>()->setSocketId(elem.second->socketId);
67 EV_INFO <<
"Passing up to socket " << elem.second->socketId <<
"\n";
69 send(packetCopy,
"transportOut");
74 EV_INFO <<
"Passing up to protocol " <<
protocol->getName() <<
"\n";
76 send(packet,
"transportOut");
80 EV_ERROR <<
"Transport protocol '" <<
protocol->getName() <<
"' not connected, discarding packet\n";
88 send(message,
"transportOut");
Referenced by inet::ProbabilisticBroadcast::handleLowerPacket(), and inet::Flooding::handleLowerPacket().
◆ interfaceTable
◆ socketIdToSocketDescriptor
| std::map<int, SocketDescriptor *> inet::NetworkProtocolBase::socketIdToSocketDescriptor |
|
protected |
◆ upperProtocols
| std::set<const Protocol *> inet::NetworkProtocolBase::upperProtocols |
|
protected |
The documentation for this class was generated from the following files:
std::map< int, SocketDescriptor * > socketIdToSocketDescriptor
Definition: NetworkProtocolBase.h:38
@ L3_I_DATA
Definition: L3SocketCommand_m.h:84
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
@ STAGE_NETWORK_LAYER
Definition: ModuleOperations.h:53
virtual void initialize(int stage) override
Definition: OperationalMixinImpl.h:26
@ STAGE_NETWORK_LAYER
Definition: ModuleOperations.h:29
removed InterfaceReq
Definition: IUdp-gates.txt:11
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down DispatchProtocolReq
Definition: IUdp-gates.txt:25
INET_API InitStage INITSTAGE_NETWORK_LAYER
Initialization of network layer protocols.
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd L3AddressInd
Definition: IUdp-gates.txt:20
std::set< const Protocol * > upperProtocols
Definition: NetworkProtocolBase.h:37
void registerService(const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive)
Registers a service primitive (SDU processing) at the given gate.
Definition: IProtocolRegistrationListener.cc:14
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
virtual void handleUpperCommand(cMessage *message)
Definition: LayeredProtocolBase.cc:51
virtual const Protocol & getProtocol() const =0
removed ctrl
Definition: IUdp-gates.txt:7
bool contains(const std::vector< T > &v, const Tk &a)
Definition: stlutils.h:65
ModuleRefByPar< IInterfaceTable > interfaceTable
Definition: NetworkProtocolBase.h:35
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
#define Enter_Method(...)
Definition: SelfDoc.h:71
* tags
Definition: IUdp-gates.txt:3
T * dupPacketAndControlInfo(T *packet)
Duplicate a packet together with its control info.
Definition: INETUtils.h:87
simsignal_t packetSentToUpperSignal
Definition: Simsignals.cc:87
@ L3_I_SOCKET_CLOSED
Definition: L3SocketCommand_m.h:85
void registerProtocol(const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive)
Registers a protocol primitive (PDU processing) at the given gate.
Definition: IProtocolRegistrationListener.cc:83
bool containsKey(const std::map< K, V, _C > &m, const Tk &a)
Definition: stlutils.h:80
simsignal_t packetSentToLowerSignal
Definition: Simsignals.cc:90