22#ifndef _LIBS_WEBVIEW_SERVER_H_
23#define _LIBS_WEBVIEW_SERVER_H_
37class WebRequestDispatcher;
39class WebRequestManager;
41#define WEBVIEW_DEFAULT_CIPHERS "SECURE128:-VERS-SSL3.0:-VERS-TLS-ALL:+VERS-TLS1.2"
50 const char *cert_pem_filepath,
51 const char *cipher_suite = WEBVIEW_DEFAULT_CIPHERS);
55 WebServer &
setup_cors(
bool allow_all, std::vector<std::string> &&origins,
unsigned int max_age);
67 std::string read_file(
const char *filename);
70 struct MHD_Daemon * daemon_;
75 unsigned short int port_;
78 std::string tls_key_mem_;
79 std::string tls_cert_mem_;
80 std::string tls_cipher_suite_;
84 unsigned int num_threads_;
86 std::vector<std::string> cors_origins_;
87 unsigned int cors_max_age_;
A class for handling time.
Probides information about ongoing requests.
Encapsulation of the libmicrohttpd webserver.
WebServer & setup_access_log(const char *filename)
Setup access log.
void process()
Process requests.
WebServer(unsigned short int port, WebRequestDispatcher *dispatcher, fawkes::Logger *logger=0)
Constructor.
WebServer & setup_ipv(bool enable_ipv4, bool enable_ipv6)
Setup protocols, i.e., IPv4 and/or IPv6.
WebServer & setup_cors(bool allow_all, std::vector< std::string > &&origins, unsigned int max_age)
Setup cross-origin resource sharing.
Time last_request_completion_time() const
Get time when last request was completed.
WebServer & setup_tls(const char *key_pem_filepath, const char *cert_pem_filepath, const char *cipher_suite=WEBVIEW_DEFAULT_CIPHERS)
Setup Transport Layer Security (encryption),.
unsigned int active_requests() const
Get number of active requests.
WebServer & setup_thread_pool(unsigned int num_threads)
Setup thread pool.
WebServer & setup_basic_auth(const char *realm, WebUserVerifier *verifier)
Setup basic authentication.
void start()
Start daemon and enable processing requests.
WebServer & setup_request_manager(WebRequestManager *request_manager)
Setup this server as request manager.
Interface for user verification.
Fawkes library namespace.