/* BSD-2-Clause license * * Copyright (c) 2018-2023 NST , sss . * */ #pragma once #include /** * OP-Codes, sent from the (JavaScript) * client to the server. */ typedef enum { ws_in_mouse = 0, /* input is ws_input_mouse */ ws_in_kupdown, /* input is ws_input_kupdown */ ws_in_kpress, /* input is uint32_t code */ ws_in_specialcomb, ws_in_credential_json, ws_in_unicode, /* input is wchar_t* string stored into uint32_t array */ /* DRAFT */ ws_in_clipbrd_changed, /* message with new clipboard information */ ws_in_clipbrd_data, /* message with clipboard data in requested fromat */ ws_in_clipbrd_data_request, /* message containing clipboarddata request * of specified format */ ws_in_ft_request, /* request filetransfer */ ws_in_ft_chunk, /* filetransfer chunk from client */ ws_in_ft_finished, /* filetransfer from client finished */ /* last */ ws_in_unused } ws_input_codes; typedef enum { ws_out_beginpaint = 0, ws_out_endpaint, ws_out_bitmap, ws_out_opaquerect, ws_out_setbounds, ws_out_patblt, ws_out_multi_opaquerect, ws_out_scr_btl, ws_out_ptr_new, ws_out_ptr_free, ws_out_ptr_set, ws_out_ptr_set_null, ws_out_ptr_set_default, /* DRAFT! */ ws_out_clpbrd_changed, ws_out_clpbrd_data, ws_out_clpbrd_request_data, ws_out_ft_request, ws_out_ft_chunk, ws_out_ft_finish, /* last */ ws_out_last } ws_output_codes; bool ws_handle_message( const struct wslay_event_on_msg_recv_arg *msg, ws_session *session); /* send text websocket message */ void ws_send_text(const uint8_t *buf, size_t buf_size, void *_task_info); /* send binary websocket message */ void ws_send_binary(const uint8_t *buf, size_t buf_size, void *_task_info); /* allocate new buffer of size msg_len + 4 bytes, * prepend msg_code to msg_data */ uint8_t *ws_pack_msg(const uint8_t *buf, size_t buf_size, uint32_t msg_code); /* handle json response from external auth server */ bool ws_handle_token_reply_json( uint8_t *json_buf, ws_session *session, void *userdata);