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

#include <INetfilter.h>

Inheritance diagram for inet::NetfilterBase:
inet::INetfilter inet::Ipv4 inet::Ipv6 inet::NextHopForwarding

Classes

class  HookBase
 

Public Member Functions

virtual ~NetfilterBase ()
 
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 it processes datagrams. More...
 
virtual void unregisterHook (INetfilter::IHook *hook) override
 Removes the provided hook from the list of registered hooks. More...
 
- Public Member Functions inherited from inet::INetfilter
virtual ~INetfilter ()
 
virtual void dropQueuedDatagram (const Packet *daragram)=0
 Requests the network layer to drop the datagram, because it's no longer needed. More...
 
virtual void reinjectQueuedDatagram (const Packet *datagram)=0
 Requests the network layer to restart the processing of the datagram. More...
 

Protected Attributes

std::multimap< int, IHook * > hooks
 

Constructor & Destructor Documentation

◆ ~NetfilterBase()

virtual inet::NetfilterBase::~NetfilterBase ( )
inlinevirtual
132  {
133  for (auto hook : hooks)
134  check_and_cast<HookBase *>(hook.second)->unregisteredFrom(this);
135  }

Member Function Documentation

◆ registerHook()

virtual void inet::NetfilterBase::registerHook ( int  priority,
INetfilter::IHook hook 
)
inlineoverridevirtual

Adds the provided hook to the list of registered hooks that will be called by the network layer when it processes datagrams.

Implements inet::INetfilter.

Reimplemented in inet::Ipv4, inet::Ipv6, and inet::NextHopForwarding.

137  {
138  hooks.insert(std::pair<int, INetfilter::IHook *>(priority, hook));
139  check_and_cast<HookBase *>(hook)->registeredTo(this);
140  }

Referenced by inet::NextHopForwarding::registerHook(), inet::Ipv6::registerHook(), and inet::Ipv4::registerHook().

◆ unregisterHook()

virtual void inet::NetfilterBase::unregisterHook ( INetfilter::IHook hook)
inlineoverridevirtual

Removes the provided hook from the list of registered hooks.

Implements inet::INetfilter.

Reimplemented in inet::Ipv4, inet::Ipv6, and inet::NextHopForwarding.

142  {
143  for (auto iter = hooks.begin(); iter != hooks.end(); iter++) {
144  if (iter->second == hook) {
145  hooks.erase(iter);
146  check_and_cast<HookBase *>(hook)->unregisteredFrom(this);
147  return;
148  }
149  }
150  }

Referenced by inet::NextHopForwarding::unregisterHook(), inet::Ipv6::unregisterHook(), and inet::Ipv4::unregisterHook().

Member Data Documentation

◆ hooks


The documentation for this class was generated from the following file:
inet::NetfilterBase::hooks
std::multimap< int, IHook * > hooks
Definition: INetfilter.h:129