n2nc::Filter Class Reference

Base class for plugin-based traffic filter. More...

#include <filter.h>

Inheritance diagram for n2nc::Filter:

Inheritance graph
[legend]
Collaboration diagram for n2nc::Filter:

Collaboration graph
[legend]

List of all members.

Public Types

enum  status_t { FILTER_CONTINUE = 0, FILTER_RETURN, FILTER_DROP }

Public Member Functions

virtual status_t egress (void *inbuf, void *outbuf, size_t inlen, size_t *outlen)=0
virtual status_t ingress (void *inbuf, void *outbuf, size_t inlen, size_t *outlen)=0
virtual int setSessionKey (security::BlowFish::key_t *key)
virtual int setPKM (n2nc::PacketManager *pkm)
virtual size_t getMaxOverHead ()
std::string toString ()

Static Public Member Functions

static Filterload_filter (const std::string filename)
static int free_filter (Filter *filter)

Protected Member Functions

 Filter (std::string name, std::string description)

Protected Attributes

std::string m_name
std::string m_description
bool m_isenabled
size_t m_maxoverhead
std::string m_filename
void * this_handle
security::BlowFish::key_t * m_skey
n2nc::PacketManagerm_pkm
n2nc::net::Socketm_com_sock


Detailed Description

Base class for plugin-based traffic filter.

Author:
fabsoft <fabsoft@gmail.com>
Note:
Plugin has to define these factory/cleaner with
extern "C"
static Filter* get_istance(void *argv,int argc);
extern "C"
static int free_istance();
Examples:

filter_ex.cpp.

Definition at line 28 of file filter.h.


Member Enumeration Documentation

Defines the packet behaviour in the chain

Enumerator:
FILTER_CONTINUE  The packet follows the filter chain
FILTER_RETURN  The packet exit the filter chain
FILTER_DROP  The packet is discarded

Definition at line 59 of file filter.h.


Constructor & Destructor Documentation

n2nc::Filter::Filter ( std::string  name,
std::string  description 
) [inline, protected]

Each filter has to set its name and description by constructor call.

Note:
Use Filter::load_filter to creates a new Filter

Definition at line 48 of file filter.h.


Member Function Documentation

virtual status_t n2nc::Filter::egress ( void *  inbuf,
void *  outbuf,
size_t  inlen,
size_t *  outlen 
) [pure virtual]

Outgoing traffic goes through egress hook.

Implemented in n2nc::Filter_dummy, n2nc::FilterBlowFish, n2nc::FilterBZ2, and n2nc::FilterLZO.

Examples:
filter_ex.cpp.

Referenced by n2nc::FilterAdapter::send().

Here is the caller graph for this function:

virtual status_t n2nc::Filter::ingress ( void *  inbuf,
void *  outbuf,
size_t  inlen,
size_t *  outlen 
) [pure virtual]

Ingoing traffic goes through ingress hook

Implemented in n2nc::Filter_dummy, n2nc::FilterBlowFish, n2nc::FilterBZ2, and n2nc::FilterLZO.

Referenced by n2nc::FilterAdapter::recv().

Here is the caller graph for this function:

virtual int n2nc::Filter::setSessionKey ( security::BlowFish::key_t *  key  )  [inline, virtual]

Sets the session key. usually 128 bit

Definition at line 80 of file filter.h.

virtual int n2nc::Filter::setPKM ( n2nc::PacketManager pkm  )  [inline, virtual]

Set the packet manager to the filter, used in certain circumstances

Definition at line 82 of file filter.h.

std::string n2nc::Filter::toString (  )  [inline]

Prints the filter name and description..

Examples:
filter_ex.cpp.

Definition at line 85 of file filter.h.

static Filter* n2nc::Filter::load_filter ( const std::string  filename  )  [inline, static]

Public factory method to istanciates a new Filter module by filename

Definition at line 94 of file filter.h.

References m_filename, and this_handle.

static int n2nc::Filter::free_filter ( Filter filter  )  [inline, static]

Public denstructor method.

Note:
The library will be unloaded only if there are no symbols linked against it.

Definition at line 112 of file filter.h.

References this_handle.


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

Generated on Mon Oct 6 19:32:22 2008 for n2nc by  doxygen 1.5.5