INET Framework for OMNeT++/OMNEST
inet::NetfilterInfoHook Class Reference
Inheritance diagram for inet::NetfilterInfoHook:
inet::INetfilter::IHook

Public Member Functions

virtual Result datagramPreRoutingHook (INetworkDatagram *datagram, const InterfaceEntry *inIE, const InterfaceEntry *&outIE, L3Address &nextHopAddr) override
 called before a packet arriving from the network is routed More...
 
virtual Result datagramForwardHook (INetworkDatagram *datagram, const InterfaceEntry *inIE, const InterfaceEntry *&outIE, L3Address &nextHopAddr) override
 called before a packet arriving from the network is delivered via the network More...
 
virtual Result datagramPostRoutingHook (INetworkDatagram *datagram, const InterfaceEntry *inIE, const InterfaceEntry *&outIE, L3Address &nextHopAddr) override
 called before a packet is delivered via the network More...
 
virtual Result datagramLocalInHook (INetworkDatagram *datagram, const InterfaceEntry *inIE) override
 called before a packet arriving from the network is delivered locally More...
 
virtual Result datagramLocalOutHook (INetworkDatagram *datagram, const InterfaceEntry *&outIE, L3Address &nextHopAddr) override
 called before a packet arriving locally is delivered More...
 
- Public Member Functions inherited from inet::INetfilter::IHook
virtual ~IHook ()
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual int numInitStages () const override
 
virtual void handleMessage (cMessage *msg) override
 
virtual void finish () override
 

Protected Attributes

INetfilternetfilter
 

Additional Inherited Members

- Public Types inherited from inet::INetfilter::IHook
enum  Type {
  PREROUTING, LOCALIN, FORWARD, POSTROUTING,
  LOCALOUT
}
 
enum  Result { ACCEPT, DROP, QUEUE, STOLEN }
 

Member Function Documentation

INetfilter::IHook::Result inet::NetfilterInfoHook::datagramForwardHook ( INetworkDatagram datagram,
const InterfaceEntry inIE,
const InterfaceEntry *&  outIE,
L3Address nextHopAddr 
)
overridevirtual

called before a packet arriving from the network is delivered via the network

Implements inet::INetfilter::IHook.

91 {
92  EV_INFO << "HOOK " << getFullPath() << ": FORWARD: packet=" << check_and_cast<cObject *>(datagram)->getName()
93  << " inIE=" << (inIE ? inIE->getName() : "nullptr")
94  << " outIE=" << (outIE ? outIE->getName() : "nullptr")
95  << " nextHop=" << nextHopAddr
96  << endl;
98 }
allows the datagram to pass to the next hook
Definition: INetfilter.h:50
INetfilter::IHook::Result inet::NetfilterInfoHook::datagramLocalInHook ( INetworkDatagram datagram,
const InterfaceEntry inIE 
)
overridevirtual

called before a packet arriving from the network is delivered locally

Implements inet::INetfilter::IHook.

111 {
112  EV_INFO << "HOOK " << getFullPath() << ": LOCAL IN: packet=" << check_and_cast<cObject *>(datagram)->getName()
113  << " inIE=" << (inIE ? inIE->getName() : "nullptr")
114  << endl;
116 }
allows the datagram to pass to the next hook
Definition: INetfilter.h:50
INetfilter::IHook::Result inet::NetfilterInfoHook::datagramLocalOutHook ( INetworkDatagram datagram,
const InterfaceEntry *&  outIE,
L3Address nextHopAddr 
)
overridevirtual

called before a packet arriving locally is delivered

Implements inet::INetfilter::IHook.

119 {
120  EV_INFO << "HOOK " << getFullPath() << ": LOCAL OUT: packet=" << check_and_cast<cObject *>(datagram)->getName()
121  << " outIE=" << (outIE ? outIE->getName() : "nullptr")
122  << endl;
124 }
allows the datagram to pass to the next hook
Definition: INetfilter.h:50
INetfilter::IHook::Result inet::NetfilterInfoHook::datagramPostRoutingHook ( INetworkDatagram datagram,
const InterfaceEntry inIE,
const InterfaceEntry *&  outIE,
L3Address nextHopAddr 
)
overridevirtual

called before a packet is delivered via the network

Implements inet::INetfilter::IHook.

101 {
102  EV_INFO << "HOOK " << getFullPath() << ": POSTROUTING packet=" << check_and_cast<cObject *>(datagram)->getName()
103  << " inIE=" << (inIE ? inIE->getName() : "nullptr")
104  << " outIE=" << (outIE ? outIE->getName() : "nullptr")
105  << " nextHop=" << nextHopAddr
106  << endl;
108 }
allows the datagram to pass to the next hook
Definition: INetfilter.h:50
INetfilter::IHook::Result inet::NetfilterInfoHook::datagramPreRoutingHook ( INetworkDatagram datagram,
const InterfaceEntry inIE,
const InterfaceEntry *&  outIE,
L3Address nextHopAddr 
)
overridevirtual

called before a packet arriving from the network is routed

Implements inet::INetfilter::IHook.

83 {
84  EV_INFO << "HOOK " << getFullPath() << ": PREROUTING packet=" << check_and_cast<cObject *>(datagram)->getName()
85  << " inIE=" << (inIE ? inIE->getName() : "nullptr")
86  << endl;
88 }
allows the datagram to pass to the next hook
Definition: INetfilter.h:50
void inet::NetfilterInfoHook::finish ( )
overrideprotectedvirtual
127 {
128  netfilter->unregisterHook(0, this);
129 }
virtual void unregisterHook(int priority, IHook *hook)=0
Removes the provided hook from the list of registered hooks.
INetfilter * netfilter
Definition: NetfilterInfoHook.cc:30
void inet::NetfilterInfoHook::handleMessage ( cMessage *  msg)
overrideprotectedvirtual
78 {
79  throw cRuntimeError("This module can not receive messages");
80 }
void inet::NetfilterInfoHook::initialize ( int  stage)
overrideprotectedvirtual
68 {
69  cSimpleModule::initialize(stage);
70 
71  if (stage == INITSTAGE_NETWORK_LAYER) {
72  netfilter = check_and_cast<INetfilter *>(getContainingNode(this)->getModuleByPath(".networkLayer.ip"));
73  netfilter->registerHook(0, this);
74  }
75 }
Initialization of network-layer protocols, stage 1.
Definition: InitStages.h:72
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:65
INetfilter * netfilter
Definition: NetfilterInfoHook.cc:30
virtual void registerHook(int priority, IHook *hook)=0
Adds the provided hook to the list of registered hooks that will be called by the network layer when ...
virtual int inet::NetfilterInfoHook::numInitStages ( ) const
inlineoverrideprotectedvirtual
34 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116

Member Data Documentation

INetfilter* inet::NetfilterInfoHook::netfilter
protected

The documentation for this class was generated from the following file: