#pragma once /* API functions exported by core which can be used in backend modules will * be defined here. */ #include "webrdp_api_shared_structures.h" #include "webrdp_api_utils.h" typedef struct { /* Send text message */ void (*send_text_msg)(const char *msg, void *task_info); /* Send text info message */ void (*send_text_info_msg)(const char *msg, void *task_info); /* Send text warning message */ void (*send_text_warning_msg)(const char *msg, void *task_info); /* Send text debug message */ void (*send_text_debug_msg)(const char *msg, void *task_info); /* Send error message, this also causing disconnect * TODO: do not send termination message on errors, use this instead * OR disable automatic disconnect on errors */ void (*send_error_msg)(const char *msg, void *task_info); /* Send control message to js client * TODO: do we need to provide it for backend modules ? */ void (*send_ctl_msg)(const char *msg, void *task_info); /* Send session termination message on quit */ void (*send_termination_msg)(void *task_info); } wrdp_core_cb_msgs; typedef struct { void (*send_begin_paint)(void *task_info); void (*send_end_paint)(void *task_info); /* Single bitmap */ void (*send_bitmap)(const wrdp_core_display_bmp *bmp, uint8_t *bmp_data, void *task_info); /* Primary: OPAQUE_RECT_ORDER */ void (*send_opaque_rect_order)( const wrdp_core_display_opaque_rect_order *oro, void *task_info); /* SetBounds */ void (*send_set_bounds)( const wrdp_core_display_bounds *bounds, void *task_info); /* PatBlt */ void (*send_pat_blt)( const wrdp_core_display_patblt_order *patblt, void *task_info); /* Multi Opaque rect */ void (*send_multi_opaque_rect)( const wrdp_core_display_m_opaque_rect *mrect, void *task_info); /* ScrBlt */ void (*send_scr_blt)( const wrdp_core_display_scr_blt *scr_blt, void *task_info); /* PTR_NEW * uint32_t id, xhot, yhot */ void (*send_ptr_new)( const wrdp_core_display_cursor_info *ptr, void *task_info); /* PTR_FREE * uint32_t id */ void (*send_ptr_free)(uint32_t ptr_id, void *task_info); /* PTR_SET * uint32_t id */ void (*send_ptr_set)(uint32_t ptr_id, void *task_info); /* PTR_SETNULL */ void (*send_ptr_set_null)(void *task_info); /* PTR_SETDEFAULT */ void (*send_ptr_set_default)(void *task_info); } wrdp_core_cb_paint; typedef struct { /* DRAFT! */ /* TODO: */ /* * uint8_t* wrdp_enum_clip_format array */ void (*clipboard_changed)( uint8_t *fmts, size_t fmts_count, void *task_info); /* * clipboard data array */ void (*send_data)(uint8_t *buf, size_t buf_size, void *task_info); /* * request clipboard data from client */ void (*request_data)(uint8_t data_fmt, void *task_info); } wrdp_core_cb_clipboard; typedef struct { /* DRAFT! */ /* * TODO: */ void (*ft_request)( const wrdp_backend_ft_file_request *req, void *task_info); /* * TODO: */ void (*ft_send_chunk)( const wrdp_backend_ft_chunk *chunk, uint8_t *data, void *task_info); /* * TODO: */ void (*ft_finish)( const wrdp_backend_ft_status *status, void *task_info); } wrdp_core_cb_filetransfer; typedef struct { /* access to variables allocated by core: */ /* get libev ev_loop* for calling thread */ void *(*get_libev_loop)(void *task_info); /* task runtime state functions: */ /* inform core about task is finished */ void (*task_finished)(bool success, void *task_info); /* reset task idle time to 0 */ void (*reset_idle)(); } wrdp_core_cb_core; typedef struct { /* print raw data buffer to stdout */ void (*hex_print)(const uint8_t *buf, size_t buf_len); /* print log message, currently only stdout is supported */ void (*log_msg)(const uint8_t *buf, size_t buf_len, wrdp_log_level_e type, uint16_t flags); /* print log message extended, currently only stdout is supported */ void (*log_msg_ex)(log_msg_info *i); } wrdp_core_cb_utils; typedef struct { /* client<>server protocol functions: */ wrdp_core_cb_msgs *api_msgs; /* Painting functions: */ wrdp_core_cb_paint *api_paint; wrdp_core_cb_core *api_core; wrdp_core_cb_clipboard *api_clipboard; wrdp_core_cb_filetransfer *api_filetransfers; wrdp_core_cb_utils *api_utils; } wrdp_core_exports;