pandemonium_engine/modules/web/http/web_server.h

58 lines
1.0 KiB
C++
Raw Normal View History

#ifndef WEB_SERVER_H
#define WEB_SERVER_H
2022-06-26 21:34:29 +02:00
#include "core/os/rw_lock.h"
#include "scene/main/node.h"
2022-06-26 21:34:29 +02:00
class WebServerRequest;
class WebNode;
2022-06-27 14:16:23 +02:00
class WebRoot;
class HTTPSessionManager;
2022-06-26 21:34:29 +02:00
class WebServer : public Node {
GDCLASS(WebServer, Node);
public:
2022-06-26 21:34:29 +02:00
NodePath get_web_root_path() const;
void set_web_root_path(const NodePath &path);
WebNode *get_web_root();
2022-06-26 21:34:29 +02:00
void set_web_root(WebNode *root);
2022-06-26 21:34:29 +02:00
Node *get_web_root_bind();
void set_web_root_bind(Node *root);
2022-06-27 14:16:23 +02:00
HTTPSessionManager *get_session_manager();
void set_session_manager(HTTPSessionManager *sess_man);
Node *get_session_manager_bind();
void set_session_manager_bind(Node *sess_man);
2022-06-27 01:03:01 +02:00
void server_handle_request(Ref<WebServerRequest> request);
2022-06-26 21:34:29 +02:00
void request_write_lock();
2022-06-27 14:16:23 +02:00
void start();
void stop();
virtual void _start();
virtual void _stop();
WebServer();
2022-06-26 21:34:29 +02:00
~WebServer();
protected:
2022-06-26 21:34:29 +02:00
static void _bind_methods();
NodePath _web_root_path;
WebNode *_web_root;
2022-06-26 21:34:29 +02:00
2022-06-27 14:16:23 +02:00
HTTPSessionManager *_session_manager;
//TODO this should be atomic
2022-06-26 21:34:29 +02:00
bool _write_lock_requested;
RWLock _rw_lock;
};
2022-06-26 21:34:29 +02:00
#endif