summaryrefslogtreecommitdiff
path: root/src/core/globals.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/globals.h')
-rw-r--r--src/core/globals.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/core/globals.h b/src/core/globals.h
new file mode 100644
index 0000000..5d12d64
--- /dev/null
+++ b/src/core/globals.h
@@ -0,0 +1,82 @@
+/* BSD-2-Clause license
+ *
+ * Copyright (c) 2018-2023 NST <www.newinfosec.ru>, sss <sss at dark-alexandr dot net>.
+ *
+ */
+
+#pragma once
+
+#include <limits.h>
+#include <stdbool.h>
+
+#include <sys/queue.h>
+
+#include "webrdp_core_api.h"
+#include "webrdp_module_api.h"
+#include "wrdp_thpool.h"
+
+#define PROG_NAME "webrdp"
+
+#include "ws_session.h"
+#include "task.h"
+
+typedef struct
+{
+ /* set worker thread count and max tasks per thread for thread pool */
+ int32_t thread_count, tasks_per_thread;
+
+ /* set core log level to one of "wrdp_log_level_e" */
+ uint8_t log_level;
+
+ /* set true to run in background (daemon mode) */
+ bool daemon;
+
+ /* global session settings defaults */
+ ws_session_settings ws_session_defaults;
+
+ /* websocket server settings:
+ */
+
+ /* port for http(s)/ws server */
+ int32_t ws_port, ctl_port;
+
+ /* unix socket path */
+ char *ws_socket_path, *ctl_socket_path;
+
+ /* url of external auth server */
+ char *auth_server_url;
+
+ /* 512bit key used for hmac
+ * used additional 2 bytes in buffer
+ * required for base64decode
+ */
+ char secret_key_verify[66], secret_key_sign[66];
+
+ /* paths to cafile and/or cafile dir */
+ char *ctl_ssl_cafile, *ctl_ssl_capath, *ctl_ssl_cert, *ctl_ssl_key;
+
+} global_settings;
+
+struct task_s
+{
+ task_info *task;
+ LIST_ENTRY(task_s) entries;
+};
+
+struct backend_s
+{
+ wrdp_backend_module *backend;
+ LIST_ENTRY(backend_s) entries;
+};
+
+typedef struct
+{
+ global_settings settings;
+ wrdp_thpool *thpool;
+ wrdp_core_exports *exports;
+ LIST_HEAD(backend_head_, backend_s) backends_head;
+} globals;
+
+extern globals g_globals;
+
+void shutdown_core();