Fawkes API  Fawkes Development Version
fawkes::PluginNetworkHandler Class Reference

Fawkes Plugin Network Handler. More...

#include <>>

Inheritance diagram for fawkes::PluginNetworkHandler:

List of all members.

Public Member Functions

 PluginNetworkHandler (PluginManager *manager, FawkesNetworkHub *hub)
 Constructor.
 ~PluginNetworkHandler ()
 Destructor.
virtual void handle_network_message (FawkesNetworkMessage *msg)
 Called for incoming messages that are addressed to the correct component ID.
virtual void client_connected (unsigned int clid)
 Called when a new client connected.
virtual void client_disconnected (unsigned int clid)
 Called when a client disconnected.
virtual void loop ()
 Process all network messages that have been received.
virtual void plugin_loaded (const char *plugin_name)
 Plugin loaded event.
virtual void plugin_unloaded (const char *plugin_name)
 Plugin unloaded event.

Protected Member Functions

virtual void run ()
 Stub to see name in backtrace for easier debugging.

Detailed Description

Fawkes Plugin Network Handler.

This network handler handles requests of plugin lists and for loading/unloading plugins received over the network.

Author:
Tim Niemueller

Constructor & Destructor Documentation

fawkes::PluginNetworkHandler::PluginNetworkHandler ( PluginManager manager,
FawkesNetworkHub hub 
)

Constructor.

Parameters:
managerplugin manager for the actual work
hubFawkes network hub

Definition at line 66 of file handler.cpp.

References fawkes::PluginManager::add_listener(), and fawkes::FawkesNetworkHub::add_handler().

fawkes::PluginNetworkHandler::~PluginNetworkHandler ( )

Member Function Documentation

void fawkes::PluginNetworkHandler::client_connected ( unsigned int  clid) [virtual]

Called when a new client connected.

If any actions need to be taken on your side this is the place to do it.

Parameters:
clidclient ID of new client

Implements fawkes::FawkesNetworkHandler.

Definition at line 370 of file handler.cpp.

void fawkes::PluginNetworkHandler::client_disconnected ( unsigned int  clid) [virtual]

Called when a client disconnected.

If any actions need to be taken on your side this is the place to do it. Note that you cannot send any further messages to this client!

Parameters:
clidclient ID of disconnected client

Implements fawkes::FawkesNetworkHandler.

Definition at line 376 of file handler.cpp.

References fawkes::LockList::remove_locked().

void fawkes::PluginNetworkHandler::handle_network_message ( FawkesNetworkMessage msg) [virtual]

Called for incoming messages that are addressed to the correct component ID.

Note that this message should be processed really really fast! A good idea is to enqueue the message in an inbound queue (remember to ref() it!) and then process it in the next run of loop() or wakeup a processing thread.

Parameters:
msgmessage to handle. If you want to keep this message you have to ref() it! It is guaranteed that the message will not be erased during the handleNetworkMessage() run, but afterwards no guarantee is made. So if you want to store the message internally for example for later processing you have to reference the message.

Implements fawkes::FawkesNetworkHandler.

Definition at line 361 of file handler.cpp.

References fawkes::RefCount::ref(), fawkes::LockQueue::push_locked(), and fawkes::Thread::wakeup().

void fawkes::PluginNetworkHandler::plugin_loaded ( const char *  plugin_name) [virtual]

Plugin loaded event.

Parameters:
plugin_namename of the plugin that has just been loaded

Implements fawkes::PluginManagerListener.

Definition at line 382 of file handler.cpp.

void fawkes::PluginNetworkHandler::plugin_unloaded ( const char *  plugin_name) [virtual]

Plugin unloaded event.

Parameters:
plugin_namename of the plugin that has just been unloaded

Implements fawkes::PluginManagerListener.

Definition at line 388 of file handler.cpp.

virtual void fawkes::PluginNetworkHandler::run ( ) [inline, protected, virtual]

Stub to see name in backtrace for easier debugging.

See also:
Thread::run()

Reimplemented from fawkes::Thread.

Definition at line 86 of file handler.h.


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