#include <senf/PPI/MonitorModule.hh>
A monitor module is a module which needs information about traversing packets but does not really act on the packets. Because of this, it is optional to connect the output: If the output is not connected, the packets will be silently dropped.
This allows to add monitor modules either into an existing chain or add them using an ActiveDuplicator.
To write a monitor module, derive from senf::ppi::module::MonitorModule instead of senf::ppi::module and implement v_handlePacket():
class CountPackets : public senf::ppi::module::MonitorModule<> { SENF_PPI_MODULE(CountPackets); public: CountPackets() : counter_ (0u) {} private: virtual void v_handlePacket(Packet const & p) { ++ counter_; } unsigned counter_; };
You may of course add events (or even further connectors besides input
and output
provided by MonitorModule) to the module.
PacketType | type of packet expected on input and sent on output. This is also the type of the v_handlePacket() argument. |
Definition at line 76 of file MonitorModule.hh.
Public Attributes |
|
senf::ppi::connector::PassiveInput < PacketType > |
input |
senf::ppi::connector::ActiveOutput < PacketType > |
output |
Protected Member Functions |
|
MonitorModule () | |
virtual void | v_handlePacket (PacketType const &p)=0 |
Called for each packet. |
senf::ppi::module::MonitorModule< PacketType >:: | ||||
MonitorModule | () | |||
Definition at line 34 of file MonitorModule.cti.
virtual void senf::ppi::module::MonitorModule< PacketType >:: | ||||
v_handlePacket | ( | PacketType const & | p | ) |
Called for each packet.
senf::ppi::connector::PassiveInput<PacketType> senf::ppi::module::MonitorModule< PacketType >:: | ||||
input | ||||
Definition at line 79 of file MonitorModule.hh.
senf::ppi::connector::ActiveOutput<PacketType> senf::ppi::module::MonitorModule< PacketType >:: | ||||
output | ||||
Definition at line 80 of file MonitorModule.hh.