fawkes::PluginNetworkHandler Class Reference
Fawkes Plugin Network Handler. More...
#include <plugin/net/handler.h>

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.
Definition at line 55 of file handler.h.
Constructor & Destructor Documentation
| fawkes::PluginNetworkHandler::PluginNetworkHandler | ( | PluginManager * | manager, | |
| FawkesNetworkHub * | hub | |||
| ) |
Constructor.
- Parameters:
-
manager plugin manager for the actual work hub Fawkes network hub
Definition at line 66 of file handler.cpp.
References fawkes::FawkesNetworkHub::add_handler(), and fawkes::PluginManager::add_listener().
| fawkes::PluginNetworkHandler::~PluginNetworkHandler | ( | ) |
Destructor.
Definition at line 79 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 365 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 371 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 356 of file handler.cpp.
References fawkes::LockQueue< Type >::push_locked(), 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 268 of file handler.cpp.
References fawkes::FawkesNetworkMessage::clid(), 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::FawkesNetworkMessage::msgid(), fawkes::plugin_unload_msg_t::name, fawkes::plugin_load_msg_t::name, fawkes::Thread::name(), fawkes::FawkesNetworkMessage::payload(), fawkes::FawkesNetworkMessage::payload_size(), fawkes::LockQueue< Type >::pop_locked(), fawkes::LockList< Type >::remove_locked(), fawkes::FawkesNetworkHub::send(), fawkes::LockList< Type >::unlock(), and fawkes::RefCount::unref().
| 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 377 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 383 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.
The documentation for this class was generated from the following files:
- src/libs/plugin/net/handler.h
- src/libs/plugin/net/handler.cpp

