senf::ppi::module::MonitorModule< PacketType > Class Template Reference

Base class providing simple monitor module support. More...

#include <senf/PPI/MonitorModule.hh>

Inheritance diagram for senf::ppi::module::MonitorModule< PacketType >:
Inheritance graph
[legend]

List of all members.


Detailed Description

template<class PacketType = Packet>
class senf::ppi::module::MonitorModule< PacketType >

Base class providing simple monitor module support.

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.

Template Parameters:
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.

Constructor & Destructor Documentation

template<class PacketType >
senf::ppi::module::MonitorModule< PacketType >::
MonitorModule ()

Definition at line 34 of file MonitorModule.cti.


Member Function Documentation

template<class PacketType = Packet>
virtual void senf::ppi::module::MonitorModule< PacketType >::
v_handlePacket ( PacketType const &  p )

Called for each packet.


Member Data Documentation

template<class PacketType = Packet>
senf::ppi::connector::PassiveInput<PacketType> senf::ppi::module::MonitorModule< PacketType >::
input

Definition at line 79 of file MonitorModule.hh.

template<class PacketType = Packet>
senf::ppi::connector::ActiveOutput<PacketType> senf::ppi::module::MonitorModule< PacketType >::
output

Definition at line 80 of file MonitorModule.hh.


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