23 #include "xmlrpc_thread.h" 25 #include "methods/log.h" 26 #include "methods/plugin.h" 27 #include "xmlrpc_processor.h" 29 #include <core/version.h> 30 #include <webview/request_dispatcher.h> 31 #include <webview/server.h> 32 #include <webview/url_manager.h> 49 XmlRpcThread::~XmlRpcThread()
59 custom_server_ =
false;
65 cache_logger_.
clear();
69 std::shared_ptr<xmlrpc_c::registry> registry = processor_->
registry();
76 webserver_ =
new WebServer(cfg_port_, dispatcher_);
78 logger->
log_info(
"XmlRpcThread",
"Listening for HTTP connections on port %u", cfg_port_);
84 std::placeholders::_1));
88 xmlrpc_service_->
add_txt(
"fawkesver=%u.%u.%u",
91 FAWKES_VERSION_MICRO);
95 logger->
log_info(
"XmlRpcThread",
"Registering as /xmlrpc in webview");
100 std::placeholders::_1));
107 if (custom_server_) {
109 delete xmlrpc_service_;
112 delete plugin_methods_;
125 if (custom_server_) {
virtual void init()
Initialize the thread.
Thread aspect that allows to provide a logger to Fawkes.
PluginManager * plugin_manager
This is the member used to access the PluginManager.
Encapsulation of the libmicrohttpd webserver.
virtual void finalize()
Finalize the thread.
virtual void log_info(const char *component, const char *format,...)=0
Log informational message.
void clear()
Clear messages.
ServicePublisher * service_publisher
Service publisher to publish services on the network.
virtual void unpublish_service(NetworkService *service)=0
Revoke service publication.
virtual void publish_service(NetworkService *service)=0
Publish service.
Fawkes library namespace.
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
void process()
Process requests.
Wrapper class for plugin related XML-RPC methods.
Wrapper class for logging related XML-RPC methods.
virtual void loop()
Code to execute in the thread.
Thread class encapsulation of pthreads.
void set_prepfin_conc_loop(bool concurrent=true)
Set concurrent execution of prepare_finalize() and loop().
Logger * logger
This is the Logger member used to access the logger.
XmlRpcThread()
Constructor.
Base class for exceptions in Fawkes.
WebUrlManager * webview_url_manager
Webview request processor manager.
void remove_handler(WebRequest::Method method, const std::string &path)
Remove a request processor.
std::shared_ptr< xmlrpc_c::registry > registry()
Get XML-RPC registry.
void set_opmode(OpMode op_mode)
Set operation mode.
fawkes::WebReply * process_request(const fawkes::WebRequest *request)
Process request.
void add_txt(const char *format,...)
Add a TXT record.
NetworkNameResolver * nnresolver
Network name resolver to lookup IP addresses of hostnames and vice versa.
XML-RPC web request processor.
Representation of a service announced or found via service discovery (i.e.
virtual unsigned int get_uint(const char *path)=0
Get value from configuration which is of type unsigned int.
void add_handler(WebRequest::Method method, const std::string &path, Handler handler)
Add a request processor.
Configuration * config
This is the Configuration member used to access the configuration.