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

#include <Pim.h>

Inheritance diagram for inet::PimCrcInsertionHook:
inet::NetfilterBase::HookBase inet::INetfilter::IHook

Public Member Functions

virtual Result datagramPreRoutingHook (Packet *packet) override
 This is the first hook called by the network protocol before it routes a datagram that was received from the lower layer. More...
 
virtual Result datagramForwardHook (Packet *packet) override
 This is the second hook called by the network protocol before it sends a datagram to the lower layer. More...
 
virtual Result datagramPostRoutingHook (Packet *packet) override
 This is the last hook called by the network protocol before it sends a datagram to the lower layer. More...
 
virtual Result datagramLocalInHook (Packet *packet) override
 This is the last hook called by the network protocol before it sends a datagram to the upper layer. More...
 
virtual Result datagramLocalOutHook (Packet *packet) override
 This is the first hook called by the network protocol before it routes a datagram that was received from the upper layer. More...
 
- Public Member Functions inherited from inet::NetfilterBase::HookBase
virtual ~HookBase ()
 
void registeredTo (INetfilter *nf)
 
void unregisteredFrom (INetfilter *nf)
 
bool isRegisteredHook (INetfilter *nf)
 
- Public Member Functions inherited from inet::INetfilter::IHook
virtual ~IHook ()
 

Additional Inherited Members

- Public Types inherited from inet::INetfilter::IHook
enum  Type {
  PREROUTING, LOCALIN, FORWARD, POSTROUTING,
  LOCALOUT
}
 
enum  Result { ACCEPT, DROP, QUEUE, STOLEN }
 
- Protected Attributes inherited from inet::NetfilterBase::HookBase
std::vector< INetfilter * > netfilters
 

Member Function Documentation

◆ datagramForwardHook()

virtual Result inet::PimCrcInsertionHook::datagramForwardHook ( Packet datagram)
inlineoverridevirtual

This is the second hook called by the network protocol before it sends a datagram to the lower layer.

This is done after the datagramPreRoutingHook or the datagramLocalInHook is called and the datagram is routed.

Implements inet::INetfilter::IHook.

23 { return ACCEPT; }

◆ datagramLocalInHook()

virtual Result inet::PimCrcInsertionHook::datagramLocalInHook ( Packet datagram)
inlineoverridevirtual

This is the last hook called by the network protocol before it sends a datagram to the upper layer.

This is done after the datagramPreRoutingHook is called and the datagram is routed.

Implements inet::INetfilter::IHook.

25 { return ACCEPT; }

◆ datagramLocalOutHook()

virtual Result inet::PimCrcInsertionHook::datagramLocalOutHook ( Packet datagram)
inlineoverridevirtual

This is the first hook called by the network protocol before it routes a datagram that was received from the upper layer.

The nextHopAddress is ignored when the outputNetworkInterface is a nullptr. After this is done

Implements inet::INetfilter::IHook.

26 { return ACCEPT; }

◆ datagramPostRoutingHook()

INetfilter::IHook::Result inet::PimCrcInsertionHook::datagramPostRoutingHook ( Packet datagram)
overridevirtual

This is the last hook called by the network protocol before it sends a datagram to the lower layer.

Implements inet::INetfilter::IHook.

80 {
81  Enter_Method("datagramPostRoutingHook");
82 
83  if (packet->findTag<InterfaceInd>())
84  return ACCEPT; // FORWARD
85  auto networkProtocol = packet->getTag<PacketProtocolTag>()->getProtocol();
86  if (*networkProtocol == Protocol::ipv6) {
87  const auto& networkHeader = getNetworkProtocolHeader(packet);
88  if (*networkHeader->getProtocol() == Protocol::pim) {
89  ASSERT(!networkHeader->isFragment());
90  packet->eraseAtFront(networkHeader->getChunkLength());
91  auto pimPacket = packet->removeAtFront<PimPacket>();
92  ASSERT(pimPacket->getCrcMode() == CRC_COMPUTED);
93  const L3Address& srcAddress = networkHeader->getSourceAddress();
94  const L3Address& destAddress = networkHeader->getDestinationAddress();
95  Pim::insertCrc(networkProtocol, srcAddress, destAddress, pimPacket);
96  packet->insertAtFront(pimPacket);
97  packet->insertAtFront(networkHeader);
98  }
99  }
100  return ACCEPT;
101 }

◆ datagramPreRoutingHook()

virtual Result inet::PimCrcInsertionHook::datagramPreRoutingHook ( Packet datagram)
inlineoverridevirtual

This is the first hook called by the network protocol before it routes a datagram that was received from the lower layer.

The nextHopAddress is ignored when the outputNetworkInterface is nullptr.

Implements inet::INetfilter::IHook.

22 { return ACCEPT; }

The documentation for this class was generated from the following files:
inet::Protocol::ipv6
static const Protocol ipv6
Definition: Protocol.h:94
inet::CRC_COMPUTED
@ CRC_COMPUTED
Definition: CrcMode_m.h:59
inet::Pim::insertCrc
static void insertCrc(const Ptr< PimPacket > &pimPacket)
Definition: Pim.cc:103
PacketProtocolTag
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
inet::Protocol::pim
static const Protocol pim
Definition: Protocol.h:103
inet::getNetworkProtocolHeader
const Ptr< const NetworkHeaderBase > getNetworkProtocolHeader(Packet *packet)
Definition: L3Tools.cc:43
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::INetfilter::IHook::ACCEPT
@ ACCEPT
allows the datagram to pass to the next hook
Definition: INetfilter.h:40