|
INET Framework for OMNeT++/OMNEST
|
Implements a next hop forwarding protocol that routes datagrams through the network.
More...
#include <NextHopForwarding.h>
|
| | NextHopForwarding () |
| |
| | ~NextHopForwarding () |
| |
| virtual void | handleRegisterService (const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive) override |
| |
| virtual void | handleRegisterProtocol (const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive) override |
| |
| virtual void | registerHook (int priority, IHook *hook) override |
| | Adds the provided hook to the list of registered hooks that will be called by the network layer when it processes datagrams. More...
|
| |
| virtual void | unregisterHook (IHook *hook) override |
| | Removes the provided hook from the list of registered hooks. More...
|
| |
| virtual void | dropQueuedDatagram (const Packet *datagram) override |
| | Requests the network layer to drop the datagram, because it's no longer needed. More...
|
| |
| virtual void | reinjectQueuedDatagram (const Packet *datagram) override |
| | Requests the network layer to restart the processing of the datagram. More...
|
| |
| virtual | ~OperationalMixin () |
| | }@ More...
|
| |
| virtual | ~ILifecycle () |
| |
| virtual | ~NetfilterBase () |
| |
| virtual | ~INetfilter () |
| |
| virtual | ~INetworkProtocol () |
| |
| 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 |
| |
|
| virtual const NetworkInterface * | getSourceInterfaceFrom (Packet *packet) |
| |
| virtual void | refreshDisplay () const override |
| |
| virtual void | handlePacketFromNetwork (Packet *datagram) |
| | Handle NextHopDatagram messages arriving from lower layer. More...
|
| |
| virtual void | handlePacketFromHL (Packet *packet) |
| | Handle packets from transport or ICMP. More...
|
| |
| virtual void | routePacket (Packet *datagram, const NetworkInterface *destIE, const L3Address &nextHop, bool fromHL) |
| | Performs routing. More...
|
| |
| virtual void | routeMulticastPacket (Packet *datagram, const NetworkInterface *destIE, const NetworkInterface *fromIE) |
| | Forwards packets to all multicast destinations, using sendDatagramToOutput(). More...
|
| |
| virtual void | encapsulate (Packet *transportPacket, const NetworkInterface *&destIE) |
| | Encapsulate packet coming from higher layers into NextHopDatagram, using the control info attached to the packet. More...
|
| |
| virtual void | decapsulate (Packet *datagram) |
| | Decapsulate and return encapsulated packet. More...
|
| |
| virtual void | sendDatagramToHL (Packet *datagram) |
| | Send datagrams up to the higher layers. More...
|
| |
| virtual void | sendDatagramToOutput (Packet *datagram, const NetworkInterface *ie, L3Address nextHop) |
| | Last TTL check, then send datagram on the given interface. More...
|
| |
| virtual void | datagramPreRouting (Packet *datagram, const NetworkInterface *inIE, const NetworkInterface *destIE, const L3Address &nextHop) |
| |
| virtual void | datagramLocalIn (Packet *datagram, const NetworkInterface *inIE) |
| |
| virtual void | datagramLocalOut (Packet *datagram, const NetworkInterface *destIE, const L3Address &nextHop) |
| |
| virtual IHook::Result | datagramPreRoutingHook (Packet *datagram) |
| |
| virtual IHook::Result | datagramForwardHook (Packet *datagram) |
| |
| virtual IHook::Result | datagramPostRoutingHook (Packet *datagram) |
| |
| virtual IHook::Result | datagramLocalInHook (Packet *datagram) |
| |
| virtual IHook::Result | datagramLocalOutHook (Packet *datagram) |
| |
| virtual void | initialize (int stage) override |
| | Initialization. More...
|
| |
| virtual void | handleMessageWhenUp (cMessage *msg) override |
| |
| void | handleCommand (Request *msg) |
| |
| virtual bool | isInitializeStage (int stage) const override |
| | ILifecycle method. More...
|
| |
| virtual bool | isModuleStartStage (int stage) const override |
| |
| virtual bool | isModuleStopStage (int stage) const override |
| |
| virtual void | handleStartOperation (LifecycleOperation *operation) override |
| |
| virtual void | handleStopOperation (LifecycleOperation *operation) override |
| |
| virtual void | handleCrashOperation (LifecycleOperation *operation) override |
| |
| virtual void | stop () |
| |
| virtual void | start () |
| |
| virtual void | flush () |
| |
| virtual int | numInitStages () const override |
| |
| virtual void | refreshDisplay () const override |
| |
| virtual void | handleMessage (cMessage *msg) override |
| |
| virtual void | handleMessageWhenDown (cMessage *msg) |
| |
| virtual bool | handleOperationStage (LifecycleOperation *operation, IDoneCallback *doneCallback) override |
| | Perform one stage of a lifecycle operation. More...
|
| |
| virtual State | getInitialOperationalState () const |
| | Returns initial operational state: OPERATING or NOT_OPERATING. More...
|
| |
| virtual void | handleActiveOperationTimeout (cMessage *message) |
| |
| virtual bool | isUp () const |
| | utility functions More...
|
| |
| virtual bool | isDown () const |
| |
| virtual void | setOperationalState (State newState) |
| |
| virtual void | scheduleOperationTimeout (simtime_t timeout) |
| |
| virtual void | setupActiveOperation (LifecycleOperation *operation, IDoneCallback *doneCallback, State) |
| |
| virtual void | delayActiveOperationFinish (simtime_t timeout) |
| |
| virtual void | startActiveOperationExtraTime (simtime_t delay=SIMTIME_ZERO) |
| |
| virtual void | startActiveOperationExtraTimeOrFinish (simtime_t extraTime) |
| |
| virtual void | finishActiveOperation () |
| |
Implements a next hop forwarding protocol that routes datagrams through the network.
Routing decisions are based on a next hop routing table, but it also supports the netfilter interface to allow routing protocols to kick in. It doesn't provide datagram fragmentation and reassembling.
◆ DatagramQueueForHooks
◆ NextHopForwarding()
| inet::NextHopForwarding::NextHopForwarding |
( |
| ) |
|
◆ ~NextHopForwarding()
| inet::NextHopForwarding::~NextHopForwarding |
( |
| ) |
|
◆ datagramForwardHook()
753 for (
auto& elem :
hooks) {
754 IHook::Result r = elem.second->datagramForwardHook(datagram);
771 throw cRuntimeError(
"Unknown Hook::Result value: %d", (
int)r);
◆ datagramLocalIn()
◆ datagramLocalInHook()
806 for (
auto& elem :
hooks) {
807 IHook::Result r = elem.second->datagramLocalInHook(datagram);
824 throw cRuntimeError(
"Unknown Hook::Result value: %d", (
int)r);
Referenced by routePacket().
◆ datagramLocalOut()
◆ datagramLocalOutHook()
832 for (
auto& elem :
hooks) {
833 IHook::Result r = elem.second->datagramLocalOutHook(datagram);
850 throw cRuntimeError(
"Unknown Hook::Result value: %d", (
int)r);
Referenced by handlePacketFromHL().
◆ datagramPostRoutingHook()
779 for (
auto& elem :
hooks) {
780 IHook::Result r = elem.second->datagramPostRoutingHook(datagram);
797 throw cRuntimeError(
"Unknown Hook::Result value: %d", (
int)r);
◆ datagramPreRouting()
◆ datagramPreRoutingHook()
725 for (
auto& elem :
hooks) {
726 IHook::Result r = elem.second->datagramPreRoutingHook(datagram);
736 if (datagram->getOwner() !=
this)
737 throw cRuntimeError(
"Model error: netfilter hook changed the owner of queued datagram '%s'", datagram->getFullName());
745 throw cRuntimeError(
"Unknown Hook::Result value: %d", (
int)r);
Referenced by handlePacketFromNetwork().
◆ decapsulate()
| void inet::NextHopForwarding::decapsulate |
( |
Packet * |
datagram | ) |
|
|
protectedvirtual |
Decapsulate and return encapsulated packet.
469 const auto& header = packet->popAtFront<NextHopForwardingHeader>();
473 auto ifTag = packet->addTagIfAbsent<InterfaceInd>();
474 ifTag->setInterfaceId(fromIE->getInterfaceId());
477 ASSERT(header->getPayloadLengthField() <= packet->getDataLength());
479 packet->setBackOffset(packet->getFrontOffset() + header->getPayloadLengthField());
482 auto payloadProtocol = header->getProtocol();
485 auto networkProtocolInd = packet->addTagIfAbsent<NetworkProtocolInd>();
487 networkProtocolInd->setNetworkProtocolHeader(header);
488 auto l3AddressInd = packet->addTagIfAbsent<
L3AddressInd>();
489 l3AddressInd->setSrcAddress(header->getSourceAddress());
490 l3AddressInd->setDestAddress(header->getDestinationAddress());
491 packet->addTagIfAbsent<HopLimitInd>()->setHopLimit(header->getHopLimit());
Referenced by sendDatagramToHL().
◆ dropQueuedDatagram()
| void inet::NextHopForwarding::dropQueuedDatagram |
( |
const Packet * |
daragram | ) |
|
|
overridevirtual |
Requests the network layer to drop the datagram, because it's no longer needed.
This function may be used by a reactive routing protocol when it cancels the route discovery process.
Implements inet::INetfilter.
682 if (iter->datagram == datagram) {
◆ encapsulate()
Encapsulate packet coming from higher layers into NextHopDatagram, using the control info attached to the packet.
496 auto header = makeShared<NextHopForwardingHeader>();
497 header->setChunkLength(
B(par(
"headerLength")));
498 auto& l3AddressReq = transportPacket->removeTag<L3AddressReq>();
499 L3Address src = l3AddressReq->getSrcAddress();
500 L3Address dest = l3AddressReq->getDestAddress();
502 header->setProtocol(transportPacket->getTag<
PacketProtocolTag>()->getProtocol());
504 auto& hopLimitReq = transportPacket->removeTagIfPresent<
HopLimitReq>();
505 short ttl = (hopLimitReq !=
nullptr) ? hopLimitReq->getHopLimit() : -1;
508 header->setDestinationAddress(dest);
511 const auto& ifTag = transportPacket->findTag<
InterfaceReq>();
512 destIE = ifTag ?
interfaceTable->getInterfaceById(ifTag->getInterfaceId()) :
nullptr;
516 if (!src.isUnspecified()) {
518 if (
routingTable->getInterfaceByAddress(src) ==
nullptr)
519 throw cRuntimeError(
"Wrong source address %s in (%s)%s: no interface with such address",
520 src.str().c_str(), transportPacket->getClassName(), transportPacket->getFullName());
521 header->setSourceAddress(src);
533 header->setHopLimit(ttl);
537 delete transportPacket->removeControlInfo();
538 header->setPayloadLengthField(transportPacket->getDataLength());
Referenced by handlePacketFromHL().
◆ flush()
| void inet::NextHopForwarding::flush |
( |
| ) |
|
|
protectedvirtual |
887 delete elem.datagram;
Referenced by stop().
◆ getSourceInterfaceFrom()
161 const auto& interfaceInd = packet->findTag<InterfaceInd>();
162 return interfaceInd !=
nullptr ?
interfaceTable->getInterfaceById(interfaceInd->getInterfaceId()) :
nullptr;
Referenced by decapsulate().
◆ handleCommand()
| void inet::NextHopForwarding::handleCommand |
( |
Request * |
msg | ) |
|
|
protected |
119 if (
auto *command =
dynamic_cast<L3SocketBindCommand *
>(request->getControlInfo())) {
120 int socketId = request->getTag<SocketReq>()->getSocketId();
121 SocketDescriptor *descriptor =
new SocketDescriptor(socketId, command->getProtocol()->getId(), command->getLocalAddress());
125 else if (
auto *command =
dynamic_cast<L3SocketConnectCommand *
>(request->getControlInfo())) {
126 int socketId = request->getTag<SocketReq>()->getSocketId();
128 throw cRuntimeError(
"L3Socket: should use bind() before connect()");
132 else if (
dynamic_cast<L3SocketCloseCommand *
>(request->getControlInfo()) !=
nullptr) {
133 int socketId = request->getTag<SocketReq>()->getSocketId();
139 auto ctrl =
new L3SocketClosedIndication();
140 indication->setControlInfo(
ctrl);
141 indication->addTag<SocketInd>()->setSocketId(socketId);
142 send(indication,
"transportOut");
146 else if (
dynamic_cast<L3SocketDestroyCommand *
>(request->getControlInfo()) !=
nullptr) {
147 int socketId = request->getTag<SocketReq>()->getSocketId();
156 throw cRuntimeError(
"Invalid command: (%s)%s", request->getClassName(), request->getName());
Referenced by handleMessageWhenUp().
◆ handleCrashOperation()
◆ handleMessageWhenUp()
| void inet::NextHopForwarding::handleMessageWhenUp |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
Implements inet::OperationalMixin< cSimpleModule >.
103 if (msg->arrivedOn(
"transportIn")) {
104 if (
auto request =
dynamic_cast<Request *
>(msg))
109 else if (msg->arrivedOn(
"queueIn")) {
110 EV_INFO <<
"Received " << msg <<
" from network.\n";
114 throw cRuntimeError(
"message arrived on unknown gate '%s'", msg->getArrivalGate()->getName());
◆ handlePacketFromHL()
| void inet::NextHopForwarding::handlePacketFromHL |
( |
Packet * |
packet | ) |
|
|
protectedvirtual |
Handle packets from transport or ICMP.
Invokes encapsulate(), then routePacket().
215 EV_INFO <<
"No interfaces exist, dropping packet\n";
216 PacketDropDetails details;
224 const NetworkInterface *destIE;
231 const auto& destIeTag = packet->findTag<
InterfaceReq>();
232 destIE = destIeTag ?
interfaceTable->getInterfaceById(destIeTag->getInterfaceId()) :
nullptr;
233 const auto& nextHopTag = packet->findTag<NextHopAddressReq>();
234 nextHop = (nextHopTag) ? nextHopTag->getNextHopAddress() : L3Address();
Referenced by handleMessageWhenUp().
◆ handlePacketFromNetwork()
| void inet::NextHopForwarding::handlePacketFromNetwork |
( |
Packet * |
datagram | ) |
|
|
protectedvirtual |
Handle NextHopDatagram messages arriving from lower layer.
Decrements TTL, then invokes routePacket().
167 if (packet->hasBitError()) {
169 EV_WARN <<
"CRC error found, drop packet\n";
170 PacketDropDetails details;
177 const auto& header = packet->peekAtFront<NextHopForwardingHeader>();
179 packet->addTagIfAbsent<NetworkProtocolInd>()->setNetworkProtocolHeader(header);
180 B totalLength = header->getChunkLength() + header->getPayloadLengthField();
181 if (totalLength > packet->getDataLength()) {
182 EV_WARN <<
"length error found, drop packet\n";
183 PacketDropDetails details;
191 if (totalLength < packet->getDataLength()) {
192 packet->setBackOffset(packet->getFrontOffset() + totalLength);
195 const NetworkInterface *inIE =
interfaceTable->getInterfaceById(packet->getTag<InterfaceInd>()->getInterfaceId());
196 const NetworkInterface *destIE =
nullptr;
198 EV_DETAIL <<
"Received datagram `" << packet->getName() <<
"' with dest=" << header->getDestAddr() <<
" from " << header->getSrcAddr() <<
" in interface" << inIE->getInterfaceName() <<
"\n";
203 inIE =
interfaceTable->getInterfaceById(packet->getTag<InterfaceInd>()->getInterfaceId());
204 const auto& destIeTag = packet->findTag<
InterfaceReq>();
205 destIE = destIeTag ?
interfaceTable->getInterfaceById(destIeTag->getInterfaceId()) :
nullptr;
206 const auto& nextHopTag = packet->findTag<NextHopAddressReq>();
207 L3Address nextHop = (nextHopTag) ? nextHopTag->getNextHopAddress() : L3Address();
Referenced by handleMessageWhenUp().
◆ handleRegisterProtocol()
| void inet::NextHopForwarding::handleRegisterProtocol |
( |
const Protocol & |
protocol, |
|
|
cGate * |
gate, |
|
|
ServicePrimitive |
servicePrimitive |
|
) |
| |
|
overridevirtual |
◆ handleRegisterService()
| void inet::NextHopForwarding::handleRegisterService |
( |
const Protocol & |
protocol, |
|
|
cGate * |
gate, |
|
|
ServicePrimitive |
servicePrimitive |
|
) |
| |
|
overridevirtual |
◆ handleStartOperation()
◆ handleStopOperation()
◆ initialize()
| void inet::NextHopForwarding::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
◆ isInitializeStage()
| virtual bool inet::NextHopForwarding::isInitializeStage |
( |
int |
stage | ) |
const |
|
inlineoverrideprotectedvirtual |
◆ isModuleStartStage()
| virtual bool inet::NextHopForwarding::isModuleStartStage |
( |
int |
stage | ) |
const |
|
inlineoverrideprotectedvirtual |
◆ isModuleStopStage()
| virtual bool inet::NextHopForwarding::isModuleStopStage |
( |
int |
stage | ) |
const |
|
inlineoverrideprotectedvirtual |
◆ refreshDisplay()
| void inet::NextHopForwarding::refreshDisplay |
( |
| ) |
const |
|
overrideprotectedvirtual |
95 sprintf(buf + strlen(buf),
"DROP:%d ",
numDropped);
98 getDisplayString().setTagArg(
"t", 0, buf);
◆ registerHook()
| void inet::NextHopForwarding::registerHook |
( |
int |
priority, |
|
|
IHook * |
hook |
|
) |
| |
|
overridevirtual |
Adds the provided hook to the list of registered hooks that will be called by the network layer when it processes datagrams.
Reimplemented from inet::NetfilterBase.
◆ reinjectQueuedDatagram()
| void inet::NextHopForwarding::reinjectQueuedDatagram |
( |
const Packet * |
datagram | ) |
|
|
overridevirtual |
Requests the network layer to restart the processing of the datagram.
This function may be used by a reactive routing protocol when it completes the route discovery process.
Implements inet::INetfilter.
694 if (iter->datagram == datagram) {
695 Packet *datagram = iter->datagram;
696 const NetworkInterface *inIE = iter->inIE;
697 const NetworkInterface *outIE = iter->outIE;
698 const L3Address& nextHop = iter->nextHop;
714 throw cRuntimeError(
"Re-injection of datagram queued for this hook not implemented");
◆ routeMulticastPacket()
Forwards packets to all multicast destinations, using sendDatagramToOutput().
333 const auto& header = datagram->peekAtFront<NextHopForwardingHeader>();
334 L3Address destAddr = header->getDestinationAddress();
336 if (fromIE !=
nullptr) {
361 if (!destIE->isLoopback())
Referenced by datagramLocalOut(), and datagramPreRouting().
◆ routePacket()
Performs routing.
Based on the routing decision, it dispatches to sendDatagramToHL() for local packets, to sendDatagramToOutput() for forwarded packets, to handleMulticastPacket() for multicast packets, or drops the packet if it's unroutable or forwarding is off.
243 auto header = datagram->peekAtFront<NextHopForwardingHeader>();
244 L3Address destAddr = header->getDestinationAddress();
246 EV_INFO <<
"Routing datagram `" << datagram->getName() <<
"' with dest=" << destAddr <<
": ";
250 EV_INFO <<
"local delivery\n";
251 if (fromHL && header->getSourceAddress().isUnspecified()) {
252 datagram->trimFront();
253 const auto& newHeader = removeNetworkProtocolHeader<NextHopForwardingHeader>(datagram);
254 newHeader->setSourceAddress(destAddr);
269 EV_INFO <<
"forwarding off, dropping packet\n";
282 if (destIE && !requestedNextHop.isUnspecified()) {
283 EV_DETAIL <<
"using manually specified output interface " << destIE->getInterfaceName() <<
"\n";
284 nextHop = requestedNextHop;
288 const NextHopRoute *re =
routingTable->findBestMatchingRoute(destAddr);
293 EV_INFO <<
"unroutable, discarding packet\n";
295 PacketDropDetails details;
303 destIE = re->getInterface();
304 nextHop = re->getNextHopAsGeneric();
308 datagram->trimFront();
309 const auto& newHeader = removeNetworkProtocolHeader<NextHopForwardingHeader>(datagram);
310 newHeader->setHopLimit(header->getHopLimit() - 1);
316 if (header->getSourceAddress().isUnspecified()) {
317 datagram->trimFront();
318 const auto& newHeader = removeNetworkProtocolHeader<NextHopForwardingHeader>(datagram);
319 newHeader->setSourceAddress(destIE->getProtocolData<NextHopInterfaceData>()->getAddress());
325 EV_INFO <<
"output interface is " << destIE->getInterfaceName() <<
", next-hop address: " << nextHop <<
"\n";
Referenced by datagramLocalOut(), and datagramPreRouting().
◆ sendDatagramToHL()
| void inet::NextHopForwarding::sendDatagramToHL |
( |
Packet * |
datagram | ) |
|
|
protectedvirtual |
Send datagrams up to the higher layers.
545 const auto& header = packet->peekAtFront<NextHopForwardingHeader>();
546 const Protocol *
protocol = header->getProtocol();
549 auto localAddress(header->getDestAddr());
550 auto remoteAddress(header->getSrcAddr());
551 bool hasSocket =
false;
553 if (elem.second->protocolId ==
protocol->getId()
554 && (elem.second->localAddress.isUnspecified() || elem.second->localAddress == localAddress)
555 && (elem.second->remoteAddress.isUnspecified() || elem.second->remoteAddress == remoteAddress))
557 auto *packetCopy = packet->dup();
559 packetCopy->addTagIfAbsent<SocketInd>()->setSocketId(elem.second->socketId);
560 EV_INFO <<
"Passing up to socket " << elem.second->socketId <<
"\n";
562 send(packetCopy,
"transportOut");
568 EV_INFO <<
"Passing up to protocol " << *
protocol <<
"\n";
570 send(packet,
"transportOut");
575 EV_ERROR <<
"Transport protocol '" <<
protocol->getName() <<
"' not connected, discarding packet\n";
Referenced by datagramLocalIn(), routeMulticastPacket(), and routePacket().
◆ sendDatagramToOutput()
Last TTL check, then send datagram on the given interface.
585 delete datagram->removeControlInfo();
587 if (datagram->getByteLength() > ie->getMtu())
588 throw cRuntimeError(
"datagram too large");
590 const auto& header = datagram->peekAtFront<NextHopForwardingHeader>();
592 if (header->getHopLimit() <= 0) {
593 EV_INFO <<
"datagram hopLimit reached zero, discarding\n";
598 if (!ie->isBroadcast()) {
599 EV_DETAIL <<
"output interface " << ie->getInterfaceName() <<
" is not broadcast, skipping ARP\n";
601 datagram->addTagIfAbsent<
InterfaceReq>()->setInterfaceId(ie->getInterfaceId());
609 send(datagram,
"queueOut");
614 if (nextHop.isUnspecified()) {
615 nextHop = header->getDestinationAddress();
616 EV_WARN <<
"no next-hop address, using destination address " << nextHop <<
" (proxy ARP)\n";
620 MacAddress nextHopMAC =
arp->resolveL3Address(nextHop, ie);
622 throw cRuntimeError(
"ARP couldn't resolve the '%s' address", nextHop.str().c_str());
626 datagram->addTagIfAbsent<MacAddressReq>()->setDestAddress(nextHopMAC);
627 datagram->addTagIfAbsent<
InterfaceReq>()->setInterfaceId(ie->getInterfaceId());
637 send(datagram,
"queueOut");
Referenced by routeMulticastPacket(), and routePacket().
◆ start()
| void inet::NextHopForwarding::start |
( |
| ) |
|
|
protectedvirtual |
◆ stop()
| void inet::NextHopForwarding::stop |
( |
| ) |
|
|
protectedvirtual |
◆ unregisterHook()
| void inet::NextHopForwarding::unregisterHook |
( |
IHook * |
hook | ) |
|
|
overridevirtual |
Removes the provided hook from the list of registered hooks.
Reimplemented from inet::NetfilterBase.
◆ arp
◆ defaultHopLimit
| int inet::NextHopForwarding::defaultHopLimit |
|
protected |
◆ interfaceTable
◆ numDropped
| int inet::NextHopForwarding::numDropped |
|
protected |
◆ numForwarded
| int inet::NextHopForwarding::numForwarded |
|
protected |
◆ numLocalDeliver
| int inet::NextHopForwarding::numLocalDeliver |
|
protected |
◆ numUnroutable
| int inet::NextHopForwarding::numUnroutable |
|
protected |
◆ queuedDatagramsForHooks
◆ routingTable
◆ socketIdToSocketDescriptor
| std::map<int, SocketDescriptor *> inet::NextHopForwarding::socketIdToSocketDescriptor |
|
protected |
◆ upperProtocols
| std::set<const Protocol *> inet::NextHopForwarding::upperProtocols |
|
protected |
The documentation for this class was generated from the following files:
void handleCommand(Request *msg)
Definition: NextHopForwarding.cc:117
int defaultHopLimit
Definition: NextHopForwarding.h:71
Type
Definition: INetfilter.h:31
virtual IHook::Result datagramLocalInHook(Packet *datagram)
Definition: NextHopForwarding.cc:803
virtual void routePacket(Packet *datagram, const NetworkInterface *destIE, const L3Address &nextHop, bool fromHL)
Performs routing.
Definition: NextHopForwarding.cc:239
@ L3_I_DATA
Definition: L3SocketCommand_m.h:84
std::map< int, SocketDescriptor * > socketIdToSocketDescriptor
Definition: NextHopForwarding.h:75
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
std::set< const Protocol * > upperProtocols
Definition: NextHopForwarding.h:74
@ NO_INTERFACE_FOUND
Definition: Simsignals_m.h:74
virtual void flush()
Definition: NextHopForwarding.cc:883
@ STAGE_NETWORK_LAYER
Definition: ModuleOperations.h:53
@ INCORRECTLY_RECEIVED
Definition: Simsignals_m.h:71
@ STOLEN
doesn't allow datagram to pass to next hook, but won't be deleted
Definition: INetfilter.h:43
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
@ FORWARD
Definition: INetfilter.h:34
virtual IHook::Result datagramLocalOutHook(Packet *datagram)
Definition: NextHopForwarding.cc:830
ModuleRefByPar< NextHopRoutingTable > routingTable
Definition: NextHopForwarding.h:67
virtual void registerHook(int priority, INetfilter::IHook *hook) override
Adds the provided hook to the list of registered hooks that will be called by the network layer when ...
Definition: INetfilter.h:137
virtual const NetworkInterface * getSourceInterfaceFrom(Packet *packet)
Definition: NextHopForwarding.cc:159
virtual void start()
Definition: NextHopForwarding.cc:871
@ NO_ROUTE_FOUND
Definition: Simsignals_m.h:75
static const Protocol nextHopForwarding
Definition: Protocol.h:128
void registerService(const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive)
Registers a service primitive (SDU processing) at the given gate.
Definition: IProtocolRegistrationListener.cc:14
int numUnroutable
Definition: NextHopForwarding.h:84
void insertNetworkProtocolHeader(Packet *packet, const Protocol &protocol, const Ptr< NetworkHeaderBase > &header)
Definition: L3Tools.cc:70
simsignal_t packetDroppedSignal
Definition: Simsignals.cc:85
virtual void handlePacketFromNetwork(Packet *datagram)
Handle NextHopDatagram messages arriving from lower layer.
Definition: NextHopForwarding.cc:165
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
virtual void sendDatagramToHL(Packet *datagram)
Send datagrams up to the higher layers.
Definition: NextHopForwarding.cc:543
int numLocalDeliver
Definition: NextHopForwarding.h:82
removed ctrl
Definition: IUdp-gates.txt:7
intscale< b, 1, 8 > B
Definition: Units.h:1168
virtual void handlePacketFromHL(Packet *packet)
Handle packets from transport or ICMP.
Definition: NextHopForwarding.cc:211
@ QUEUE
queues the datagram for later re-injection (e.g. when route discovery completes)
Definition: INetfilter.h:42
Result
Definition: INetfilter.h:39
bool contains(const std::vector< T > &v, const Tk &a)
Definition: stlutils.h:65
virtual void unregisterHook(INetfilter::IHook *hook) override
Removes the provided hook from the list of registered hooks.
Definition: INetfilter.h:142
int numDropped
Definition: NextHopForwarding.h:83
removed HopLimitReq
Definition: IUdp-gates.txt:11
virtual void datagramPreRouting(Packet *datagram, const NetworkInterface *inIE, const NetworkInterface *destIE, const L3Address &nextHop)
Definition: NextHopForwarding.cc:641
ModuleRefByPar< IArp > arp
Definition: NextHopForwarding.h:68
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
virtual void datagramLocalIn(Packet *datagram, const NetworkInterface *inIE)
Definition: NextHopForwarding.cc:651
virtual void stop()
Definition: NextHopForwarding.cc:875
virtual void routeMulticastPacket(Packet *datagram, const NetworkInterface *destIE, const NetworkInterface *fromIE)
Forwards packets to all multicast destinations, using sendDatagramToOutput().
Definition: NextHopForwarding.cc:331
virtual void decapsulate(Packet *datagram)
Decapsulate and return encapsulated packet.
Definition: NextHopForwarding.cc:465
@ PREROUTING
Definition: INetfilter.h:32
virtual void encapsulate(Packet *transportPacket, const NetworkInterface *&destIE)
Encapsulate packet coming from higher layers into NextHopDatagram, using the control info attached to...
Definition: NextHopForwarding.cc:494
int numForwarded
Definition: NextHopForwarding.h:85
virtual void datagramLocalOut(Packet *datagram, const NetworkInterface *destIE, const L3Address &nextHop)
Definition: NextHopForwarding.cc:656
std::multimap< int, IHook * > hooks
Definition: INetfilter.h:129
@ DROP
doesn't allow the datagram to pass to the next hook, will be deleted
Definition: INetfilter.h:41
#define Enter_Method(...)
Definition: SelfDoc.h:71
DatagramQueueForHooks queuedDatagramsForHooks
Definition: NextHopForwarding.h:79
@ ACCEPT
allows the datagram to pass to the next hook
Definition: INetfilter.h:40
simsignal_t packetSentToUpperSignal
Definition: Simsignals.cc:87
static const MacAddress UNSPECIFIED_ADDRESS
The unspecified MAC address, 00:00:00:00:00:00.
Definition: MacAddress.h:31
@ L3_I_SOCKET_CLOSED
Definition: L3SocketCommand_m.h:85
ModuleRefByPar< IInterfaceTable > interfaceTable
Definition: NextHopForwarding.h:66
virtual void refreshDisplay() const override
Definition: OperationalMixinImpl.h:200
void registerProtocol(const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive)
Registers a protocol primitive (PDU processing) at the given gate.
Definition: IProtocolRegistrationListener.cc:83
virtual IHook::Result datagramPreRoutingHook(Packet *datagram)
Definition: NextHopForwarding.cc:723
virtual void sendDatagramToOutput(Packet *datagram, const NetworkInterface *ie, L3Address nextHop)
Last TTL check, then send datagram on the given interface.
Definition: NextHopForwarding.cc:583
@ LOCALIN
Definition: INetfilter.h:33
@ POSTROUTING
Definition: INetfilter.h:35
@ LOCALOUT
Definition: INetfilter.h:36
bool containsKey(const std::map< K, V, _C > &m, const Tk &a)
Definition: stlutils.h:80