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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#pragma once
/* Short api usage brief...
* each backend module must export:
* 1. bool <backend_name>_create(wrdp_core_exports*, wrdp_backend_module*)
* which initialize passed wrdp_backend_module* instance
* with all required callbacks.
* wrdp_core_exports* ptr should be stored by backend,
* for example in "internals" structure.
* return "true" on success
*/
#include <stdint.h>
#include "webrdp_api_shared_structures.h"
//#include "webrdp_core_api.h"
/* API used by backend modules defined here */
typedef struct
{
/* Init function exported by backend, this function should fully
* initialize backend.
* retrun false on failure
* required. */
bool (*init)(void *backend_internals);
/* Destroy backend function should deinitialize backend
* and free used memory
* required. */
void (*destroy)(void *backend_internals);
/* Pass task_info internal structure ptr to the backend.
* must be stored and suplied to core on need
* required. */
void (*set_task_info)(void *task_info, void *internals);
/* Backend settings related functions
* return false on failure.
* required. */
bool (*set_setting_str)(backend_setting_str *setting, void *internals);
bool (*set_setting_int)(backend_setting_int *setting, void *internals);
} wrdp_backend_cb_module;
typedef struct
{
/* Backend ws-protocol handlers callbacks
* return false on failure
* at least one of the following is required*/
bool (*mouse)(ws_input_mouse input, void *internals);
bool (*kupdown)(ws_input_kupdown input, void *internals);
bool (*kpress)(ws_input_kpress input, void *internals);
bool (*kcomb)(ws_input_keycomb input, void *internals);
bool (*unicode)(ws_input_unicode input, void *internals);
} wrdp_backend_cb_input;
typedef struct
{
/* DRAFT! */
/* TODO: */
bool (*request_data)(
const wrdp_backend_clipbrd_data_request *, void *backend_internals);
bool (*data_changed)(
const wrdp_backend_clipbrd_fmts *, void *backend_internals);
bool (*send_data)(
const wrdp_backend_clipbrd_data *, void *backend_internals);
} wrdp_backend_cb_clipboard;
typedef struct
{
/* DRAFT! */
/* TODO: */
bool (*request)(
const wrdp_backend_ft_file_request *, void *backend_internals);
bool (*chunk)(const wrdp_backend_ft_chunk *, const uint8_t *data,
void *backend_internals);
bool (*finish)(const wrdp_backend_ft_status *, void *backend_internals);
} wrdp_backend_cb_filetransfer;
typedef struct
{
/* Backend internal data, does not touched by core. */
void *backend_internals;
/* pointer to wrdp_thpool_task* used by some internals */
void *wrdp_thpool_task;
/* Variable indicate what task destruction is in progress,
* task should not use any of core exports anymore */
bool stopped;
/* Information about task used by core,
* must be passed to functions which require it */
void *task_info;
/* ws_session list */
void *sessions_list_head;
wrdp_backend_cb_module *callbacks_module;
wrdp_backend_cb_input *callbacks_input;
wrdp_backend_cb_clipboard *callbacks_clipbrd;
wrdp_backend_cb_filetransfer *callbacks_ft;
} wrdp_backend_module;
|