fawkes::PluginNetworkHandler Class Reference

Fawkes Plugin Network Handler. More...

#include <plugin/net/handler.h>

Inheritance diagram for fawkes::PluginNetworkHandler:

[legend]
List of all members.

Public Member Functions

 PluginNetworkHandler (PluginManager *manager, FawkesNetworkHub *hub, Mutex *mutex=NULL)
 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

Definition at line 55 of file handler.h.


Constructor & Destructor Documentation

fawkes::PluginNetworkHandler::PluginNetworkHandler ( PluginManager manager,
FawkesNetworkHub hub,
Mutex mutex = NULL 
)

Constructor.

Parameters:
manager plugin manager for the actual work
hub Fawkes network hub
mutex mutex that will be used to protect loading and unloading of plugins.

Definition at line 68 of file handler.cpp.

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

fawkes::PluginNetworkHandler::~PluginNetworkHandler (  ) 

Destructor.

Definition at line 84 of file handler.cpp.

References fawkes::FawkesNetworkHub::remove_handler(), and fawkes::PluginManager::remove_listener().


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:
clid client ID of new client

Implements fawkes::FawkesNetworkHandler.

Definition at line 374 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:
clid client ID of disconnected client

Implements fawkes::FawkesNetworkHandler.

Definition at line 380 of file handler.cpp.

References fawkes::LockList< Type >::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:
msg message 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 365 of file handler.cpp.

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

void fawkes::PluginNetworkHandler::loop (  )  [virtual]

Process all network messages that have been received.

Reimplemented from fawkes::Thread.

Definition at line 277 of file handler.cpp.

References fawkes::PluginManager::is_loaded(), fawkes::LockList< Type >::lock(), fawkes::LibLogger::log_debug(), fawkes::LibLogger::log_error(), fawkes::LibLogger::log_info(), fawkes::MSG_PLUGIN_AVAIL_LIST, fawkes::MSG_PLUGIN_AVAIL_LIST_FAILED, fawkes::MSG_PLUGIN_LIST_AVAIL, fawkes::MSG_PLUGIN_LIST_LOADED, fawkes::MSG_PLUGIN_LOAD, fawkes::MSG_PLUGIN_LOADED_LIST, fawkes::MSG_PLUGIN_LOADED_LIST_FAILED, fawkes::MSG_PLUGIN_SUBSCRIBE_WATCH, fawkes::MSG_PLUGIN_UNLOAD, fawkes::MSG_PLUGIN_UNSUBSCRIBE_WATCH, fawkes::plugin_unload_msg_t::name, fawkes::plugin_load_msg_t::name, fawkes::Thread::name(), fawkes::LockList< Type >::remove_locked(), fawkes::FawkesNetworkHub::send(), and fawkes::LockList< Type >::unlock().

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

Plugin loaded event.

Parameters:
plugin_name name of the plugin that has just been loaded

Implements fawkes::PluginManagerListener.

Definition at line 386 of file handler.cpp.

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

Plugin unloaded event.

Parameters:
plugin_name name of the plugin that has just been unloaded

Implements fawkes::PluginManagerListener.

Definition at line 392 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 88 of file handler.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:31:41 2011 for Fawkes API by  doxygen 1.4.7