From 50049865635c6ec035d31ffa0b01ac608bb31680 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 15 Oct 2013 14:13:56 -0700 Subject: [PATCH] Add file upload stubs. --- src/protocols/rdp/client.c | 5 +++++ src/protocols/rdp/guac_handlers.c | 29 +++++++++++++++++++++++++++++ src/protocols/rdp/guac_handlers.h | 9 +++++++++ 3 files changed, 43 insertions(+) diff --git a/src/protocols/rdp/client.c b/src/protocols/rdp/client.c index 43d713b7..f61d21a2 100644 --- a/src/protocols/rdp/client.c +++ b/src/protocols/rdp/client.c @@ -298,6 +298,11 @@ BOOL rdp_freerdp_post_connect(freerdp* instance) { client->key_handler = rdp_guac_client_key_handler; client->clipboard_handler = rdp_guac_client_clipboard_handler; + /* File transfer handlers */ + client->file_handler = rdp_guac_client_file_handler; + client->blob_handler = rdp_guac_client_blob_handler; + client->end_handler = rdp_guac_client_end_handler; + return TRUE; } diff --git a/src/protocols/rdp/guac_handlers.c b/src/protocols/rdp/guac_handlers.c index 50420d04..c137e5cb 100644 --- a/src/protocols/rdp/guac_handlers.c +++ b/src/protocols/rdp/guac_handlers.c @@ -491,3 +491,32 @@ int rdp_guac_client_clipboard_handler(guac_client* client, char* data) { } +int rdp_guac_client_file_handler(guac_client* client, guac_stream* stream, + char* mimetype, char* filename) { + guac_client_log_info(client, "STUB: stream %i allocated for file %s (%s)", + stream->index, filename, mimetype); + guac_protocol_send_ack(client->socket, stream, "OK (STREAM BEGIN)", + GUAC_PROTOCOL_STATUS_SUCCESS); + guac_socket_flush(client->socket); + return 0; +} + +int rdp_guac_client_blob_handler(guac_client* client, guac_stream* stream, + void* data, int length) { + guac_client_log_info(client, "STUB: stream %i received %i bytes", + stream->index, length); + guac_protocol_send_ack(client->socket, stream, "OK (DATA WRITTEN)", + GUAC_PROTOCOL_STATUS_SUCCESS); + guac_socket_flush(client->socket); + return 0; +} + +int rdp_guac_client_end_handler(guac_client* client, guac_stream* stream) { + guac_client_log_info(client, "STUB: stream %i closed", + stream->index); + guac_protocol_send_ack(client->socket, stream, "OK (STREAM END)", + GUAC_PROTOCOL_STATUS_SUCCESS); + guac_socket_flush(client->socket); + return 0; +} + diff --git a/src/protocols/rdp/guac_handlers.h b/src/protocols/rdp/guac_handlers.h index 5e9ccee3..58c3dbe0 100644 --- a/src/protocols/rdp/guac_handlers.h +++ b/src/protocols/rdp/guac_handlers.h @@ -39,6 +39,7 @@ #define _GUAC_RDP_GUAC_HANDLERS_H #include +#include int rdp_guac_client_free_handler(guac_client* client); int rdp_guac_client_handle_messages(guac_client* client); @@ -46,5 +47,13 @@ int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask); int rdp_guac_client_key_handler(guac_client* client, int keysym, int pressed); int rdp_guac_client_clipboard_handler(guac_client* client, char* data); +int rdp_guac_client_file_handler(guac_client* client, guac_stream* stream, + char* mimetype, char* filename); + +int rdp_guac_client_blob_handler(guac_client* client, guac_stream* stream, + void* data, int length); + +int rdp_guac_client_end_handler(guac_client* client, guac_stream* stream); + #endif