diff options
author | sss <sss@dark-alexandr.net> | 2023-01-17 00:38:19 +0300 |
---|---|---|
committer | sss <sss@dark-alexandr.net> | 2023-01-17 00:38:19 +0300 |
commit | cc3f33db7a8d3c4ad373e646b199808e01bc5d9b (patch) | |
tree | ec09d690c7656ab5f2cc72607e05fb359c24d8b2 /src/core/include/webrdp_module_api.h |
added webrdp public code
Diffstat (limited to 'src/core/include/webrdp_module_api.h')
-rw-r--r-- | src/core/include/webrdp_module_api.h | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/src/core/include/webrdp_module_api.h b/src/core/include/webrdp_module_api.h new file mode 100644 index 0000000..7f2d635 --- /dev/null +++ b/src/core/include/webrdp_module_api.h @@ -0,0 +1,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; |