Fawkes API
Fawkes Development Version
|
24 #ifndef _CONFIG_NET_HANDLER_H_
25 #define _CONFIG_NET_HANDLER_H_
27 #include <config/change_handler.h>
28 #include <config/config.h>
29 #include <config/net_messages.h>
30 #include <core/threading/thread.h>
31 #include <core/utils/lock_list.h>
32 #include <core/utils/lock_queue.h>
33 #include <netcomm/fawkes/handler.h>
43 class FawkesNetworkHub;
75 void send_inv_value(
unsigned int clid,
const char *path);
79 prepare_msg(
const char *path,
bool is_default)
81 T *m = (T *)calloc(1,
sizeof(T));
82 snprintf(m->cp.path, CONFIG_MSG_PATH_LENGTH,
"%s", path);
83 m->cp.is_default = is_default;
89 prepare_value_msg(
const char *path,
94 void *__attribute__((__may_alias__)) * data)
96 data_size =
sizeof(config_descriptor_t) +
sizeof(T) * (is_list ? num_values : 1);
97 void * m = calloc(1, data_size);
98 config_descriptor_t *cd = (config_descriptor_t *)m;
99 snprintf(cd->path, CONFIG_MSG_PATH_LENGTH,
"%s", path);
100 cd->is_default = is_default;
101 cd->num_values = is_list ? num_values : 0;
102 *data = (
void *)((
char *)m +
sizeof(config_descriptor_t));
106 Configuration * config_;
107 FawkesNetworkHub * hub_;
108 LockQueue<FawkesNetworkMessage *> inbound_queue_;
110 LockList<unsigned int> subscribers_;
111 LockList<unsigned int>::iterator sit_;
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.
virtual void run()
Stub to see name in backtrace for easier debugging.
Interface for configuration change handling.
Network handler abstract base class.
virtual void handle_network_message(FawkesNetworkMessage *msg)
Handle network message.
Iterator interface to iterate over config values.
Interface for configuration handling.
~ConfigNetworkHandler()
Destructor.
Fawkes library namespace.
ConfigNetworkHandler(Configuration *config, FawkesNetworkHub *hub)
Constructor.
Fawkes Configuration Network Handler.
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 run()
Code to execute in the thread.
Thread class encapsulation of pthreads.
Representation of a message that is sent over the network.
virtual void client_connected(unsigned int clid)
Client connected.