Interface API base class More...

#include <senf/Ext/NetEmu/InterfaceAPI.hh>

Inheritance diagram for senf::emu::Interface:

Public Types

typedef InterfaceDecorator Decorator
 Interface base class specific decorator type More...
 

Public Member Functions

virtual ~Interface ()
 
bool canTransmit () const
 true, if interface is transmit capable More...
 
bool canReceive () const
 true, if interface is receive capable More...
 
void enable ()
 Enable interface (aka ifconfig up) More...
 
void disable ()
 Disable interface (aka ifconfig down) More...
 
bool enabled () const
 true, if interface enabled More...
 
unsigned index () const
 Get interface index. More...
 
void id (MACAddress const &eui)
 Change interface MAC. More...
 
MACAddress const & id () const
 Get interface MAC Address. More...
 
void deviceId (InterfaceDeviceId id)
 
InterfaceDeviceId deviceId () const
 
std::string const & device () const
 
boost::uint8_t linkTypeId () const
 
std::string interfaceTypeName () const
 
console::DirectoryNodeconsoleDir () const
 Access interface console directory. More...
 

Static Public Member Functions

static unsigned nodeId ()
 Get unique node id. More...
 
static void nodeId (unsigned id)
 Set unique node id. More...
 

Protected Member Functions

 Interface ()
 
void init ()
 Initialize interface. More...
 
virtual void v_enable ()=0
 Called to enable interface. More...
 
virtual void v_disable ()=0
 Called to disable interface. More...
 
virtual bool v_enabled () const =0
 Return true if interface is enabled. More...
 
virtual void v_id (MACAddress const &id)=0
 Called to set interface mac address. More...
 
virtual MACAddress v_id () const =0
 Return the interface mac address. More...
 
virtual boost::uint8_t v_linkTypeId () const =0
 
virtual std::string const & v_device () const =0
 

Statistic Related Member Functions

console::DirectoryNodestatisticsDir () const
 Access the interface statistics directory. More...
 
template<class Stat >
senf::StatisticsregisterStatistics (std::string name, Stat &stat)
 Register statistics source. More...
 
boost::optional< senf::Statistics & > statistic (std::string const &name)
 Get registered statistic. More...
 
void startStatistics (ClockService::clock_type inverval)
 Start statistics generation. More...
 

Signals

boost::signals2::signal< void(Interface &, MACAddress)> idChangedSignal
 

Detailed Description

Interface API base class

All NetEmu Interfaces derive from this class. This class provides the basic generic interface API.

See also
NetEmu interface API

Definition at line 193 of file InterfaceAPI.hh.

Member Typedef Documentation

◆ Decorator

Interface base class specific decorator type

Definition at line 198 of file InterfaceAPI.hh.

Constructor & Destructor Documentation

◆ ~Interface()

virtual senf::emu::Interface::~Interface ( )
virtual

◆ Interface()

senf::emu::Interface::Interface ( )
protected

Member Function Documentation

◆ canReceive()

bool senf::emu::Interface::canReceive ( ) const

true, if interface is receive capable

◆ canTransmit()

bool senf::emu::Interface::canTransmit ( ) const

true, if interface is transmit capable

◆ consoleDir()

console::DirectoryNode& senf::emu::Interface::consoleDir ( ) const

Access interface console directory.

◆ device()

std::string const& senf::emu::Interface::device ( ) const

◆ deviceId() [1/2]

void senf::emu::Interface::deviceId ( InterfaceDeviceId  id)

◆ deviceId() [2/2]

InterfaceDeviceId senf::emu::Interface::deviceId ( ) const

◆ disable()

void senf::emu::Interface::disable ( )

Disable interface (aka ifconfig down)

◆ enable()

void senf::emu::Interface::enable ( )

Enable interface (aka ifconfig up)

◆ enabled()

bool senf::emu::Interface::enabled ( ) const

true, if interface enabled

◆ id() [1/2]

void senf::emu::Interface::id ( MACAddress const &  eui)

Change interface MAC.

Definition at line 82 of file InterfaceAPI.cc.

◆ id() [2/2]

MACAddress const& senf::emu::Interface::id ( ) const

Get interface MAC Address.

◆ index()

unsigned senf::emu::Interface::index ( ) const

Get interface index.

◆ init()

void senf::emu::Interface::init ( )
protected

Initialize interface.

This member will be called by every derived class

Definition at line 38 of file InterfaceAPI.cc.

◆ interfaceTypeName()

std::string senf::emu::Interface::interfaceTypeName ( ) const

◆ linkTypeId()

boost::uint8_t senf::emu::Interface::linkTypeId ( ) const

◆ nodeId() [1/2]

static unsigned senf::emu::Interface::nodeId ( )
static

Get unique node id.

The nodeId defaults to the process id

◆ nodeId() [2/2]

static void senf::emu::Interface::nodeId ( unsigned  id)
static

Set unique node id.

◆ registerStatistics()

template<class Stat >
senf::Statistics& senf::emu::Interface::registerStatistics ( std::string  name,
Stat &  stat 
)

Register statistics source.

Associates stat with a statistics collector and adds it to the statistics console directory of the interface. stat can be an arbitrary statistics signal.

Returns
reference to the new created Statistics object
Warning
Be careful when saving the returned reference, since it is coupled to the lifetime of the interface.

◆ startStatistics()

void senf::emu::Interface::startStatistics ( ClockService::clock_type  inverval)

Start statistics generation.

Starts the statistics generation timer in all statistics sources registered with this interface (via registerStatistics()).

Implementation note:
This is not really a member function, it's a boost signal which can be called like a function.
See also
senf_emu_interface_statistics

◆ statistic()

boost::optional< senf::Statistics & > senf::emu::Interface::statistic ( std::string const &  name)

Get registered statistic.

Returns
reference to registered statistic
See also
registerStatistics()

Definition at line 94 of file InterfaceAPI.cc.

◆ statisticsDir()

console::DirectoryNode& senf::emu::Interface::statisticsDir ( ) const

Access the interface statistics directory.

◆ v_device()

virtual std::string const& senf::emu::Interface::v_device ( ) const
protectedpure virtual

◆ v_disable()

virtual void senf::emu::Interface::v_disable ( )
protectedpure virtual

◆ v_enable()

virtual void senf::emu::Interface::v_enable ( )
protectedpure virtual

◆ v_enabled()

virtual bool senf::emu::Interface::v_enabled ( ) const
protectedpure virtual

Return true if interface is enabled.

Implemented in senf::emu::EmulatedDVBInterface.

◆ v_id() [1/2]

virtual void senf::emu::Interface::v_id ( MACAddress const &  id)
protectedpure virtual

Called to set interface mac address.

Implemented in senf::emu::EmulatedDVBInterface.

◆ v_id() [2/2]

virtual MACAddress senf::emu::Interface::v_id ( ) const
protectedpure virtual

Return the interface mac address.

Implemented in senf::emu::EmulatedDVBInterface.

◆ v_linkTypeId()

virtual boost::uint8_t senf::emu::Interface::v_linkTypeId ( ) const
protectedpure virtual

Member Data Documentation

◆ idChangedSignal

boost::signals2::signal<void (Interface &, MACAddress)> senf::emu::Interface::idChangedSignal

Definition at line 270 of file InterfaceAPI.hh.


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