Fawkes API
Fawkes Development Version
|
Fawkes Configuration Network Handler. More...
#include <>>
Public Member Functions | |
ConfigNetworkHandler (Configuration *config, FawkesNetworkHub *hub) | |
Constructor. | |
~ConfigNetworkHandler () | |
Destructor. | |
virtual void | handle_network_message (FawkesNetworkMessage *msg) |
Handle network message. | |
virtual void | client_connected (unsigned int clid) |
Client connected. | |
virtual void | client_disconnected (unsigned int clid) |
Client disconnected. | |
virtual void | loop () |
Process all network messages that have been received. | |
virtual void | config_tag_changed (const char *new_location) |
Tag changed. | |
virtual void | config_value_changed (const Configuration::ValueIterator *v) |
Called whenever a watched value has changed. | |
virtual void | config_comment_changed (const Configuration::ValueIterator *v) |
Called whenever a comment of a watched value has changed. | |
virtual void | config_value_erased (const char *path) |
Called whenever a value has been erased from the config. | |
Protected Member Functions | |
virtual void | run () |
Stub to see name in backtrace for easier debugging. |
Fawkes Configuration Network Handler.
It provides access to a given config via the network. This is mainly used to allow modification of config values over the network.
fawkes::ConfigNetworkHandler::ConfigNetworkHandler | ( | Configuration * | config, |
FawkesNetworkHub * | hub | ||
) |
Constructor.
config | configuration, loaded and ready to be used for getting and setting values |
hub | Fawkes network hub to use for receiving and sending network messages |
Definition at line 52 of file net_handler.cpp.
References fawkes::Thread::start(), fawkes::Configuration::add_change_handler(), and fawkes::FawkesNetworkHub::add_handler().
fawkes::ConfigNetworkHandler::~ConfigNetworkHandler | ( | ) |
Destructor.
Definition at line 69 of file net_handler.cpp.
References fawkes::Thread::cancel(), fawkes::Thread::join(), fawkes::Configuration::rem_change_handler(), and fawkes::LockQueue::clear().
void fawkes::ConfigNetworkHandler::client_connected | ( | unsigned int | clid | ) | [virtual] |
Client connected.
Ignored.
clid | client ID |
Implements fawkes::FawkesNetworkHandler.
Definition at line 508 of file net_handler.cpp.
void fawkes::ConfigNetworkHandler::client_disconnected | ( | unsigned int | clid | ) | [virtual] |
Client disconnected.
If the client was a subscriber it is removed.
clid | client ID |
Implements fawkes::FawkesNetworkHandler.
Definition at line 518 of file net_handler.cpp.
References fawkes::LockList::lock(), fawkes::LibLogger::log_warn(), and fawkes::LockList::unlock().
void fawkes::ConfigNetworkHandler::config_comment_changed | ( | const Configuration::ValueIterator * | v | ) | [virtual] |
Called whenever a comment of a watched value has changed.
v | value iterator for the specific value |
Implements fawkes::ConfigurationChangeHandler.
Definition at line 601 of file net_handler.cpp.
References fawkes::Configuration::ValueIterator::path(), fawkes::Configuration::ValueIterator::is_default(), fawkes::Configuration::ValueIterator::get_comment(), fawkes::LockList::lock(), fawkes::config_comment_msg_t::s, fawkes::FawkesNetworkHub::send(), fawkes::LibLogger::log_warn(), and fawkes::LockList::unlock().
void fawkes::ConfigNetworkHandler::config_tag_changed | ( | const char * | new_tag | ) | [virtual] |
Tag changed.
Ignored.
new_tag | new tag |
Implements fawkes::ConfigurationChangeHandler.
Definition at line 536 of file net_handler.cpp.
void fawkes::ConfigNetworkHandler::config_value_changed | ( | const Configuration::ValueIterator * | v | ) | [virtual] |
Called whenever a watched value has changed.
v | value iterator for the specific value |
Implements fawkes::ConfigurationChangeHandler.
Definition at line 542 of file net_handler.cpp.
References fawkes::Configuration::ValueIterator::path(), fawkes::Configuration::ValueIterator::is_default(), fawkes::LockList::lock(), fawkes::Configuration::ValueIterator::is_string(), fawkes::Configuration::ValueIterator::get_string(), fawkes::config_string_value_msg_t::s, fawkes::FawkesNetworkHub::send(), fawkes::Configuration::ValueIterator::is_bool(), fawkes::Configuration::ValueIterator::get_bool(), fawkes::config_bool_value_msg_t::b, fawkes::Configuration::ValueIterator::is_int(), fawkes::Configuration::ValueIterator::get_int(), fawkes::config_int_value_msg_t::i, fawkes::Configuration::ValueIterator::is_uint(), fawkes::Configuration::ValueIterator::get_uint(), fawkes::config_uint_value_msg_t::u, fawkes::Configuration::ValueIterator::is_float(), fawkes::Configuration::ValueIterator::get_float(), fawkes::config_float_value_msg_t::f, fawkes::LibLogger::log_warn(), and fawkes::LockList::unlock().
void fawkes::ConfigNetworkHandler::config_value_erased | ( | const char * | path | ) | [virtual] |
Called whenever a value has been erased from the config.
path | path of value |
Implements fawkes::ConfigurationChangeHandler.
Definition at line 628 of file net_handler.cpp.
References fawkes::LockList::lock(), fawkes::FawkesNetworkHub::send(), fawkes::LibLogger::log_warn(), and fawkes::LockList::unlock().
void fawkes::ConfigNetworkHandler::handle_network_message | ( | FawkesNetworkMessage * | msg | ) | [virtual] |
Handle network message.
The message is put into the inbound queue and processed in processAfterLoop().
msg | message |
Implements fawkes::FawkesNetworkHandler.
Definition at line 495 of file net_handler.cpp.
References fawkes::RefCount::ref(), fawkes::LockQueue::push_locked(), and fawkes::Thread::wakeup().
void fawkes::ConfigNetworkHandler::loop | ( | ) | [virtual] |
Process all network messages that have been received.
Reimplemented from fawkes::Thread.
Definition at line 162 of file net_handler.cpp.
References fawkes::FawkesNetworkMessage::msgid(), fawkes::LockList::push_back_locked(), fawkes::FawkesNetworkMessage::clid(), fawkes::Configuration::lock(), fawkes::Configuration::iterator_default(), fawkes::Configuration::ValueIterator::next(), fawkes::ConfigListContent::append(), fawkes::Configuration::iterator_hostspecific(), fawkes::FawkesNetworkHub::send(), fawkes::Configuration::unlock(), fawkes::FawkesNetworkMessage::msg(), fawkes::config_erase_value_msg_t::cp, fawkes::config_descriptor_t::path, fawkes::config_descriptor_t::is_default, fawkes::Configuration::erase_default(), fawkes::Configuration::erase(), fawkes::Exception::append(), fawkes::LibLogger::log_warn(), fawkes::FawkesNetworkMessage::payload_size(), fawkes::FawkesNetworkMessage::payload(), fawkes::config_getval_msg_t::cp, fawkes::Configuration::get_float(), fawkes::Configuration::is_default(), fawkes::config_float_value_msg_t::f, fawkes::Configuration::get_uint(), fawkes::config_uint_value_msg_t::u, fawkes::Configuration::get_int(), fawkes::config_int_value_msg_t::i, fawkes::Configuration::get_bool(), fawkes::config_bool_value_msg_t::b, fawkes::Configuration::get_string(), fawkes::config_string_value_msg_t::s, fawkes::Configuration::get_value(), fawkes::Configuration::set_float(), fawkes::Configuration::set_default_float(), fawkes::Configuration::set_uint(), fawkes::Configuration::set_default_uint(), fawkes::Configuration::set_int(), fawkes::Configuration::set_default_int(), fawkes::Configuration::set_bool(), fawkes::Configuration::set_default_bool(), fawkes::FawkesNetworkMessage::msgge(), fawkes::Configuration::set_string(), fawkes::Configuration::set_default_string(), fawkes::Configuration::set_comment(), fawkes::config_comment_msg_t::s, fawkes::Configuration::get_comment(), fawkes::Configuration::set_default_comment(), fawkes::Configuration::get_default_comment(), fawkes::RefCount::unref(), and fawkes::LockQueue::pop_locked().
virtual void fawkes::ConfigNetworkHandler::run | ( | ) | [inline, protected, virtual] |
Stub to see name in backtrace for easier debugging.
Reimplemented from fawkes::Thread.
Definition at line 69 of file net_handler.h.