#pragma once /* Short api usage brief... * each backend module must export: * 1. bool _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 #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;