diff --git a/src/protocols/rdp/Makefile.am b/src/protocols/rdp/Makefile.am index fd06c71c..f885a372 100644 --- a/src/protocols/rdp/Makefile.am +++ b/src/protocols/rdp/Makefile.am @@ -40,7 +40,7 @@ ACLOCAL_AMFLAGS = -I m4 AM_CFLAGS = -Werror -Wall -Iinclude @LIBGUAC_INCLUDE@ lib_LTLIBRARIES = libguac-client-rdp.la -freerdp_LTLIBRARIES = guac_rdpsnd.la +freerdp_LTLIBRARIES = guac_rdpsnd.la guac_rdpdr.la libguac_client_rdp_la_SOURCES = \ audio.c \ @@ -60,25 +60,31 @@ libguac_client_rdp_la_SOURCES = \ rdp_pointer.c \ wav_encoder.c -guac_rdpsnd_la_SOURCES = \ - guac_rdpsnd/messages.c \ - guac_rdpsnd/service.c \ +guac_rdpsnd_la_SOURCES = \ + guac_rdpsnd/rdpsnd_messages.c \ + guac_rdpsnd/rdpsnd_service.c \ audio.c -noinst_HEADERS = \ - guac_rdpsnd/messages.h \ - guac_rdpsnd/service.h \ - audio.h \ - client.h \ - config.h \ - default_pointer.h \ - guac_handlers.h \ - rdp_bitmap.h \ - rdp_cliprdr.h \ - rdp_gdi.h \ - rdp_glyph.h \ - rdp_keymap.h \ - rdp_pointer.h \ +guac_rdpdr_la_SOURCES = \ + guac_rdpdr/rdpdr_messages.c \ + guac_rdpdr/rdpdr_service.c + +noinst_HEADERS = \ + guac_rdpdr/rdpdr_messages.h \ + guac_rdpdr/rdpdr_service.h \ + guac_rdpsnd/rdpsnd_messages.h \ + guac_rdpsnd/rdpsnd_service.h \ + audio.h \ + client.h \ + config.h \ + default_pointer.h \ + guac_handlers.h \ + rdp_bitmap.h \ + rdp_cliprdr.h \ + rdp_gdi.h \ + rdp_glyph.h \ + rdp_keymap.h \ + rdp_pointer.h \ wav_encoder.h # Compile OGG support if available @@ -89,9 +95,11 @@ endif libguac_client_rdp_la_LDFLAGS = -version-info 0:0:0 @RDP_LIBS@ @VORBIS_LIBS@ @PTHREAD_LIBS@ guac_rdpsnd_la_LDFLAGS = -module -avoid-version -shared @RDP_LIBS@ @VORBIS_LIBS@ @PTHREAD_LIBS@ +guac_rdpdr_la_LDFLAGS = -module -avoid-version -shared @RDP_LIBS@ @PTHREAD_LIBS@ libguac_client_rdp_la_LIBADD = @LIBGUAC_LTLIB@ guac_rdpsnd_la_LIBADD = @LIBGUAC_LTLIB@ +guac_rdpdr_la_LIBADD = @LIBGUAC_LTLIB@ freerdpdir = ${libdir}/freerdp diff --git a/src/protocols/rdp/client.c b/src/protocols/rdp/client.c index cf459183..6e7fba1f 100644 --- a/src/protocols/rdp/client.c +++ b/src/protocols/rdp/client.c @@ -92,6 +92,7 @@ const char* GUAC_CLIENT_ARGS[] = { "initial-program", "color-depth", "disable-audio", + "disable-printing", "console", "console-audio", "server-layout", @@ -110,6 +111,7 @@ enum RDP_ARGS_IDX { IDX_INITIAL_PROGRAM, IDX_COLOR_DEPTH, IDX_DISABLE_AUDIO, + IDX_DISABLE_PRINTING, IDX_CONSOLE, IDX_CONSOLE_AUDIO, IDX_SERVER_LAYOUT, @@ -184,6 +186,17 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) { } /* end if audio enabled */ + /* If printing enabled, load rdpdr */ + if (guac_client_data->printing_enabled) { + + /* Load RDPDR plugin */ + if (freerdp_channels_load_plugin(channels, instance->settings, + "guac_rdpdr", NULL)) + guac_client_log_error(client, + "Failed to load guac_rdpdr plugin."); + + } /* end if printing enabled */ + /* Init color conversion structure */ clrconv = xnew(CLRCONV); clrconv->alpha = 1; @@ -463,6 +476,10 @@ int guac_client_init(guac_client* client, int argc, char** argv) { guac_client_data->audio_enabled = (strcmp(argv[IDX_DISABLE_AUDIO], "true") != 0); + /* Printing enable/disable */ + guac_client_data->printing_enabled = + (strcmp(argv[IDX_DISABLE_PRINTING], "true") != 0); + /* Order support */ bitmap_cache = settings->bitmap_cache; settings->os_major_type = OSMAJORTYPE_UNSPECIFIED; diff --git a/src/protocols/rdp/client.h b/src/protocols/rdp/client.h index 5fc19e69..d820c948 100644 --- a/src/protocols/rdp/client.h +++ b/src/protocols/rdp/client.h @@ -176,6 +176,11 @@ typedef struct rdp_guac_client_data { */ int audio_enabled; + /** + * Whether printing is enabled. + */ + int printing_enabled; + /** * Audio output, if any. */ diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_messages.c b/src/protocols/rdp/guac_rdpdr/rdpdr_messages.c new file mode 100644 index 00000000..ee43672a --- /dev/null +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_messages.c @@ -0,0 +1,54 @@ + +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is libguac-client-rdp. + * + * The Initial Developer of the Original Code is + * Michael Jumper. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "rdpdr_service.h" +#include "rdpdr_messages.h" +#include "client.h" + +/* STUB - message handlers */ + diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_messages.h b/src/protocols/rdp/guac_rdpdr/rdpdr_messages.h new file mode 100644 index 00000000..e91cade8 --- /dev/null +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_messages.h @@ -0,0 +1,44 @@ + +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is libguac-client-rdp. + * + * The Initial Developer of the Original Code is + * Michael Jumper. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef __GUAC_RDPDR_MESSAGES_H +#define __GUAC_RDPDR_MESSAGES_H + +/* STUB */ + +#endif + diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_service.c b/src/protocols/rdp/guac_rdpdr/rdpdr_service.c new file mode 100644 index 00000000..a7dab24c --- /dev/null +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_service.c @@ -0,0 +1,85 @@ + +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is libguac-client-rdp. + * + * The Initial Developer of the Original Code is + * Michael Jumper. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "rdpdr_service.h" +#include "rdpdr_messages.h" + + +/* Define service, associate with "rdpdr" channel */ + +DEFINE_SVC_PLUGIN(guac_rdpdr, "rdpdr", + CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP) + + +/* + * Service Handlers + */ + +void guac_rdpdr_process_connect(rdpSvcPlugin* plugin) { + + /* STUB - init */ + +} + +void guac_rdpdr_process_terminate(rdpSvcPlugin* plugin) { + xfree(plugin); +} + +void guac_rdpdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event) { + freerdp_event_free(event); +} + +void guac_rdpdr_process_receive(rdpSvcPlugin* plugin, + STREAM* input_stream) { + + /*guac_rdpdrPlugin* rdpdr = (guac_rdpdrPlugin*) plugin;*/ + + /* STUB - read packet type, dispatch based on type */ + +} + diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_service.h b/src/protocols/rdp/guac_rdpdr/rdpdr_service.h new file mode 100644 index 00000000..15a9acba --- /dev/null +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_service.h @@ -0,0 +1,82 @@ + +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is libguac-client-rdp. + * + * The Initial Developer of the Original Code is + * Michael Jumper. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef __GUAC_RDPDR_SERVICE_H +#define __GUAC_RDPDR_SERVICE_H + +/** + * Structure representing the current state of the Guacamole RDPDR plugin for + * FreeRDP. + */ +typedef struct guac_rdpdrPlugin { + + /** + * The FreeRDP parts of this plugin. This absolutely MUST be first. + * FreeRDP depends on accessing this structure as if it were an instance + * of rdpSvcPlugin. + */ + rdpSvcPlugin plugin; + + /* STUB */ + +} guac_rdpdrPlugin; + + +/** + * Handler called when this plugin is loaded by FreeRDP. + */ +void guac_rdpdr_process_connect(rdpSvcPlugin* plugin); + +/** + * Handler called when this plugin receives data along its designated channel. + */ +void guac_rdpdr_process_receive(rdpSvcPlugin* plugin, + STREAM* input_stream); + +/** + * Handler called when this plugin is being unloaded. + */ +void guac_rdpdr_process_terminate(rdpSvcPlugin* plugin); + +/** + * Handler called when this plugin receives an event. For the sake of RDPDR, + * all events will be ignored and simply free'd. + */ +void guac_rdpdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event); + +#endif + diff --git a/src/protocols/rdp/guac_rdpsnd/messages.c b/src/protocols/rdp/guac_rdpsnd/rdpsnd_messages.c similarity index 99% rename from src/protocols/rdp/guac_rdpsnd/messages.c rename to src/protocols/rdp/guac_rdpsnd/rdpsnd_messages.c index 1df1747d..49a580da 100644 --- a/src/protocols/rdp/guac_rdpsnd/messages.c +++ b/src/protocols/rdp/guac_rdpsnd/rdpsnd_messages.c @@ -47,8 +47,8 @@ #include #include "audio.h" -#include "service.h" -#include "messages.h" +#include "rdpsnd_service.h" +#include "rdpsnd_messages.h" #include "client.h" /* MESSAGE HANDLERS */ diff --git a/src/protocols/rdp/guac_rdpsnd/messages.h b/src/protocols/rdp/guac_rdpsnd/rdpsnd_messages.h similarity index 100% rename from src/protocols/rdp/guac_rdpsnd/messages.h rename to src/protocols/rdp/guac_rdpsnd/rdpsnd_messages.h diff --git a/src/protocols/rdp/guac_rdpsnd/service.c b/src/protocols/rdp/guac_rdpsnd/rdpsnd_service.c similarity index 98% rename from src/protocols/rdp/guac_rdpsnd/service.c rename to src/protocols/rdp/guac_rdpsnd/rdpsnd_service.c index 89569ca5..666d9887 100644 --- a/src/protocols/rdp/guac_rdpsnd/service.c +++ b/src/protocols/rdp/guac_rdpsnd/rdpsnd_service.c @@ -47,8 +47,8 @@ #include #include "audio.h" -#include "service.h" -#include "messages.h" +#include "rdpsnd_service.h" +#include "rdpsnd_messages.h" /* Define service, associate with "rdpsnd" channel */ diff --git a/src/protocols/rdp/guac_rdpsnd/service.h b/src/protocols/rdp/guac_rdpsnd/rdpsnd_service.h similarity index 100% rename from src/protocols/rdp/guac_rdpsnd/service.h rename to src/protocols/rdp/guac_rdpsnd/rdpsnd_service.h