summaryrefslogtreecommitdiff
path: root/src/core/globals.h
blob: 5d12d6419ababeaa5e0902b365208077d1fc3b19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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();