GUACAMOLE-249: Migrate loading of RDPDR support (guacdr plugin) to abstract function.

This commit is contained in:
Michael Jumper 2019-12-21 19:36:20 -08:00
parent 6f2b124472
commit 68710a6702
4 changed files with 87 additions and 10 deletions

View File

@ -59,6 +59,7 @@ libguac_client_rdp_la_SOURCES = \
rdp_pointer.c \ rdp_pointer.c \
rdp_settings.c \ rdp_settings.c \
rdp_stream.c \ rdp_stream.c \
rdpdr.c \
rdpsnd.c \ rdpsnd.c \
resolution.c \ resolution.c \
svc.c \ svc.c \
@ -101,6 +102,7 @@ noinst_HEADERS = \
rdp_settings.h \ rdp_settings.h \
rdp_status.h \ rdp_status.h \
rdp_stream.h \ rdp_stream.h \
rdpdr.h \
rdpsnd.h \ rdpsnd.h \
resolution.h \ resolution.h \
svc.h \ svc.h \

View File

@ -38,6 +38,7 @@
#include "rdp_glyph.h" #include "rdp_glyph.h"
#include "rdp_pointer.h" #include "rdp_pointer.h"
#include "rdp_stream.h" #include "rdp_stream.h"
#include "rdpdr.h"
#include "rdpsnd.h" #include "rdpsnd.h"
#include "svc.h" #include "svc.h"
@ -108,17 +109,8 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
if (settings->printing_enabled if (settings->printing_enabled
|| settings->drive_enabled || settings->drive_enabled
|| settings->audio_enabled) { || settings->audio_enabled) {
guac_rdpdr_load_plugin(context);
/* Load RDPDR plugin */
if (guac_freerdp_channels_load_plugin(channels, instance->settings,
"guacdr", client))
guac_client_log(client, GUAC_LOG_WARNING,
"Failed to load guacdr plugin. Drive redirection and "
"printing will not work. Sound MAY not work.");
/* Load RDPSND plugin */
guac_rdpsnd_load_plugin(context); guac_rdpsnd_load_plugin(context);
} }
/* Load RAIL plugin if RemoteApp in use */ /* Load RAIL plugin if RemoteApp in use */

43
src/protocols/rdp/rdpdr.c Normal file
View File

@ -0,0 +1,43 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "config.h"
#include "channels.h"
#include "rdp.h"
#include <freerdp/freerdp.h>
#include <guacamole/client.h>
void guac_rdpdr_load_plugin(rdpContext* context) {
guac_client* client = ((rdp_freerdp_context*) context)->client;
/* Load RDPDR plugin */
if (guac_freerdp_channels_load_plugin(context->channels, context->settings, "guacdr", client)) {
guac_client_log(client, GUAC_LOG_WARNING, "Support for the RDPDR "
"channel (device redirection) could not be loaded. Drive "
"redirection and printing will not work. Sound MAY not work.");
return;
}
guac_client_log(client, GUAC_LOG_DEBUG, "Support for RDPDR (device "
"redirection) registered. Awaiting channel connection.");
}

40
src/protocols/rdp/rdpdr.h Normal file
View File

@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef GUAC_RDP_RDPDR_H
#define GUAC_RDP_RDPDR_H
#include "config.h"
/**
* Initializes device redirection support (file transfer, printing, etc.) for
* RDP and handling of the RDPDR channel. If failures occur, messages noting
* the specifics of those failures will be logged, and the RDP side of
* device redirection support will not be functional.
*
* This MUST be called within the PreConnect callback of the freerdp instance
* for RDPDR support to be loaded.
*
* @param rdpContext
* The rdpContext associated with the FreeRDP side of the RDP connection.
*/
void guac_rdpdr_load_plugin(rdpContext* context);
#endif