Move SVC data into own structure. Add stubs for management.
This commit is contained in:
parent
b835299898
commit
cc5793a39b
@ -40,6 +40,7 @@ libguac_client_rdp_la_SOURCES = \
|
|||||||
rdp_pointer.c \
|
rdp_pointer.c \
|
||||||
rdp_rail.c \
|
rdp_rail.c \
|
||||||
rdp_settings.c \
|
rdp_settings.c \
|
||||||
|
rdp_svc.c \
|
||||||
unicode.c
|
unicode.c
|
||||||
|
|
||||||
guacsvc_sources = \
|
guacsvc_sources = \
|
||||||
@ -88,6 +89,7 @@ noinst_HEADERS = \
|
|||||||
rdp_rail.h \
|
rdp_rail.h \
|
||||||
rdp_settings.h \
|
rdp_settings.h \
|
||||||
rdp_status.h \
|
rdp_status.h \
|
||||||
|
rdp_svc.h \
|
||||||
unicode.h
|
unicode.h
|
||||||
|
|
||||||
# Add compatibility layer for WinPR if not available
|
# Add compatibility layer for WinPR if not available
|
||||||
|
@ -46,25 +46,35 @@
|
|||||||
*/
|
*/
|
||||||
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) {
|
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) {
|
||||||
|
|
||||||
|
/* Gain access to plugin data */
|
||||||
|
CHANNEL_ENTRY_POINTS_EX* entry_points_ex =
|
||||||
|
(CHANNEL_ENTRY_POINTS_EX*) pEntryPoints;
|
||||||
|
|
||||||
/* Allocate plugin */
|
/* Allocate plugin */
|
||||||
guac_svcPlugin* svc =
|
guac_svcPlugin* svc_plugin =
|
||||||
(guac_svcPlugin*) calloc(1, sizeof(guac_svcPlugin));
|
(guac_svcPlugin*) calloc(1, sizeof(guac_svcPlugin));
|
||||||
|
|
||||||
|
/* Get SVC descriptor from plugin parameters */
|
||||||
|
guac_rdp_svc* svc = (guac_rdp_svc*) entry_points_ex->pExtendedData;
|
||||||
|
|
||||||
/* Init channel def */
|
/* Init channel def */
|
||||||
strcpy(svc->plugin.channel_def.name, "FIXME");
|
strcpy(svc_plugin->plugin.channel_def.name, svc->name);
|
||||||
svc->plugin.channel_def.options =
|
svc_plugin->plugin.channel_def.options =
|
||||||
CHANNEL_OPTION_INITIALIZED
|
CHANNEL_OPTION_INITIALIZED
|
||||||
| CHANNEL_OPTION_ENCRYPT_RDP
|
| CHANNEL_OPTION_ENCRYPT_RDP
|
||||||
| CHANNEL_OPTION_COMPRESS_RDP;
|
| CHANNEL_OPTION_COMPRESS_RDP;
|
||||||
|
|
||||||
|
/* Init plugin */
|
||||||
|
svc_plugin->svc = svc;
|
||||||
|
|
||||||
/* Set callbacks */
|
/* Set callbacks */
|
||||||
svc->plugin.connect_callback = guac_svc_process_connect;
|
svc_plugin->plugin.connect_callback = guac_svc_process_connect;
|
||||||
svc->plugin.receive_callback = guac_svc_process_receive;
|
svc_plugin->plugin.receive_callback = guac_svc_process_receive;
|
||||||
svc->plugin.event_callback = guac_svc_process_event;
|
svc_plugin->plugin.event_callback = guac_svc_process_event;
|
||||||
svc->plugin.terminate_callback = guac_svc_process_terminate;
|
svc_plugin->plugin.terminate_callback = guac_svc_process_terminate;
|
||||||
|
|
||||||
/* Finish init */
|
/* Finish init */
|
||||||
svc_plugin_init((rdpSvcPlugin*) svc, pEntryPoints);
|
svc_plugin_init((rdpSvcPlugin*) svc_plugin, pEntryPoints);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -75,25 +85,17 @@ int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints) {
|
|||||||
|
|
||||||
void guac_svc_process_connect(rdpSvcPlugin* plugin) {
|
void guac_svc_process_connect(rdpSvcPlugin* plugin) {
|
||||||
|
|
||||||
/* Get SVC plugin */
|
/* Get corresponding guac_rdp_svc */
|
||||||
guac_svcPlugin* svc = (guac_svcPlugin*) plugin;
|
guac_svcPlugin* svc_plugin = (guac_svcPlugin*) plugin;
|
||||||
|
guac_rdp_svc* svc = svc_plugin->svc;
|
||||||
|
|
||||||
/* Get client from plugin parameters */
|
/* NULL out pExtendedData so we don't lose our guac_rdp_svc due to an
|
||||||
guac_client* client = (guac_client*)
|
|
||||||
plugin->channel_entry_points.pExtendedData;
|
|
||||||
|
|
||||||
/* NULL out pExtendedData so we don't lose our guac_client due to an
|
|
||||||
* automatic free() within libfreerdp */
|
* automatic free() within libfreerdp */
|
||||||
plugin->channel_entry_points.pExtendedData = NULL;
|
plugin->channel_entry_points.pExtendedData = NULL;
|
||||||
|
|
||||||
/* Get data from client */
|
/* Log connection to static channel */
|
||||||
/*rdp_guac_client_data* client_data = (rdp_guac_client_data*) client->data;*/
|
guac_client_log_info(svc->client,
|
||||||
|
"Static channel \"%s\" connected.", svc->name);
|
||||||
/* Init plugin */
|
|
||||||
svc->client = client;
|
|
||||||
|
|
||||||
/* Log that printing, etc. has been loaded */
|
|
||||||
guac_client_log_info(client, "guacsvc connected.");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#define __GUAC_SVC_SERVICE_H
|
#define __GUAC_SVC_SERVICE_H
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "rdp_svc.h"
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
@ -50,24 +51,10 @@ typedef struct guac_svcPlugin {
|
|||||||
rdpSvcPlugin plugin;
|
rdpSvcPlugin plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to the client owning this instance.
|
* The Guacamole-specific SVC structure describing the channel this
|
||||||
|
* instance represents.
|
||||||
*/
|
*/
|
||||||
guac_client* client;
|
guac_rdp_svc* svc;
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the RDP channel in use, and the name to use for each pipe.
|
|
||||||
*/
|
|
||||||
char* name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The pipe opened by the Guacamole client.
|
|
||||||
*/
|
|
||||||
guac_stream* input_pipe;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The output pipe, opened in response to the open input pipe.
|
|
||||||
*/
|
|
||||||
guac_stream* output_pipe;
|
|
||||||
|
|
||||||
} guac_svcPlugin;
|
} guac_svcPlugin;
|
||||||
|
|
||||||
|
57
src/protocols/rdp/rdp_svc.c
Normal file
57
src/protocols/rdp/rdp_svc.c
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Glyptodon LLC
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "rdp_svc.h"
|
||||||
|
|
||||||
|
#include <freerdp/freerdp.h>
|
||||||
|
#include <guacamole/client.h>
|
||||||
|
|
||||||
|
#ifdef ENABLE_WINPR
|
||||||
|
#include <winpr/stream.h>
|
||||||
|
#else
|
||||||
|
#include "compat/winpr-stream.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
guac_rdp_svc* guac_rdp_alloc_svc(guac_client* client, char* name) {
|
||||||
|
/* STUB */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void guac_rdp_free_svc(guac_rdp_svc* svc) {
|
||||||
|
/* STUB */
|
||||||
|
}
|
||||||
|
|
||||||
|
void guac_rdp_add_svc(guac_client* client, guac_rdp_svc* svc) {
|
||||||
|
/* STUB */
|
||||||
|
}
|
||||||
|
|
||||||
|
guac_rdp_svc* guac_rdp_get_svc(guac_client* client, char* name) {
|
||||||
|
/* STUB */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
guac_rdp_svc* guac_rdp_remove_svc(guac_client* client, char* name) {
|
||||||
|
/* STUB */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
94
src/protocols/rdp/rdp_svc.h
Normal file
94
src/protocols/rdp/rdp_svc.h
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Glyptodon LLC
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GUAC_RDP_RDP_SVC_H
|
||||||
|
#define __GUAC_RDP_RDP_SVC_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <freerdp/freerdp.h>
|
||||||
|
#include <guacamole/client.h>
|
||||||
|
|
||||||
|
#ifdef ENABLE_WINPR
|
||||||
|
#include <winpr/stream.h>
|
||||||
|
#else
|
||||||
|
#include "compat/winpr-stream.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure describing a static virtual channel, and the corresponding
|
||||||
|
* Guacamole pipes.
|
||||||
|
*/
|
||||||
|
typedef struct guac_rdp_svc {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to the client owning this static channel.
|
||||||
|
*/
|
||||||
|
guac_client* client;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the RDP channel in use, and the name to use for each pipe.
|
||||||
|
*/
|
||||||
|
char* name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pipe opened by the Guacamole client, if any. This should be
|
||||||
|
* opened in response to the output pipe.
|
||||||
|
*/
|
||||||
|
guac_stream* input_pipe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The output pipe, opened when the RDP server receives a connection to
|
||||||
|
* the static channel.
|
||||||
|
*/
|
||||||
|
guac_stream* output_pipe;
|
||||||
|
|
||||||
|
} guac_rdp_svc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate a new SVC with the given name. Not that this will NOT add the
|
||||||
|
* SVC to the list stored in the client.
|
||||||
|
*/
|
||||||
|
guac_rdp_svc* guac_rdp_alloc_svc(guac_client* client, char* name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free the given SVC.
|
||||||
|
*/
|
||||||
|
void guac_rdp_free_svc(guac_rdp_svc* svc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the given SVC to the list stored in the client.
|
||||||
|
*/
|
||||||
|
void guac_rdp_add_svc(guac_client* client, guac_rdp_svc* svc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the SVC with the given name from the list stored in the client.
|
||||||
|
*/
|
||||||
|
guac_rdp_svc* guac_rdp_get_svc(guac_client* client, char* name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the SVC with the given name from the list stored in the client.
|
||||||
|
*/
|
||||||
|
guac_rdp_svc* guac_rdp_remove_svc(guac_client* client, char* name);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user