diff --git a/rfb-proto.h b/rfb-proto.h index e1cbc96..d632883 100644 --- a/rfb-proto.h +++ b/rfb-proto.h @@ -106,6 +106,13 @@ struct rfb_client_pointer_event_msg { uint16_t y; } RFB_PACKED; +struct rfb_client_cut_text_msg { + uint8_t type; + uint8_t padding[3]; + uint32_t length; + char test[0]; +} RFB_PACKED; + static inline int rfb_send_security_types(void *client) { struct rfb_security_types_msg payload = { diff --git a/server.c b/server.c index e835266..c999e6e 100644 --- a/server.c +++ b/server.c @@ -517,6 +517,19 @@ static int on_client_pointer_event(struct vnc_client *client) return sizeof(*msg); } +static int on_client_cut_text(struct vnc_client *client) +{ + struct rfb_client_cut_text_msg *msg = + (struct rfb_client_cut_text_msg*)(client->msg_buffer + + client->buffer_index); + + uint32_t length = ntohl(msg->length); + + // TODO + + return sizeof(*msg) + length; +} + static int on_client_message(struct vnc_client *client) { if (client->buffer_len - client->buffer_index < 1) @@ -537,7 +550,7 @@ static int on_client_message(struct vnc_client *client) case RFB_CLIENT_TO_SERVER_POINTER_EVENT: return on_client_pointer_event(client); case RFB_CLIENT_TO_SERVER_CLIENT_CUT_TEXT: - break; + return on_client_cut_text(client); } uv_close((uv_handle_t*)&client->stream_handle, cleanup_client);