2011-03-28 03:56:14 +00:00
|
|
|
|
|
|
|
/* ***** 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 ***** */
|
|
|
|
|
2011-12-30 08:10:28 +00:00
|
|
|
#ifndef _GUAC_RDP_CLIENT_H
|
|
|
|
#define _GUAC_RDP_CLIENT_H
|
2011-03-28 03:56:14 +00:00
|
|
|
|
2013-06-05 19:05:39 +00:00
|
|
|
#include <pthread.h>
|
|
|
|
|
2012-10-21 04:05:36 +00:00
|
|
|
#include <cairo/cairo.h>
|
|
|
|
|
2011-03-28 03:56:14 +00:00
|
|
|
#include <freerdp/freerdp.h>
|
2012-01-04 03:09:33 +00:00
|
|
|
#include <freerdp/codec/color.h>
|
2011-03-28 03:56:14 +00:00
|
|
|
|
|
|
|
#include <guacamole/client.h>
|
2013-09-24 19:01:02 +00:00
|
|
|
#include <guacamole/audio.h>
|
2011-03-28 03:56:14 +00:00
|
|
|
|
2013-11-04 08:50:10 +00:00
|
|
|
#include "rdp_fs.h"
|
2012-03-20 22:33:08 +00:00
|
|
|
#include "rdp_keymap.h"
|
2013-07-18 00:54:28 +00:00
|
|
|
#include "rdp_settings.h"
|
2012-03-20 22:33:08 +00:00
|
|
|
|
2013-08-20 18:32:47 +00:00
|
|
|
/**
|
|
|
|
* The maximum duration of a frame in milliseconds.
|
|
|
|
*/
|
2013-08-21 04:13:26 +00:00
|
|
|
#define GUAC_RDP_FRAME_DURATION 40
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The amount of time to allow per message read within a frame, in
|
|
|
|
* milliseconds. If the server is silent for at least this amount of time, the
|
|
|
|
* frame will be considered finished.
|
|
|
|
*/
|
2013-08-22 22:27:01 +00:00
|
|
|
#define GUAC_RDP_FRAME_TIMEOUT 0
|
2012-10-02 21:09:57 +00:00
|
|
|
|
2012-05-04 22:41:08 +00:00
|
|
|
/**
|
|
|
|
* Client data that will remain accessible through the guac_client.
|
|
|
|
* This should generally include data commonly used by Guacamole handlers.
|
|
|
|
*/
|
2011-03-28 03:56:14 +00:00
|
|
|
typedef struct rdp_guac_client_data {
|
|
|
|
|
2012-05-04 22:41:08 +00:00
|
|
|
/**
|
|
|
|
* Pointer to the FreeRDP client instance handling the current connection.
|
|
|
|
*/
|
2011-12-30 08:10:28 +00:00
|
|
|
freerdp* rdp_inst;
|
2012-05-04 22:41:08 +00:00
|
|
|
|
|
|
|
/**
|
2013-07-18 00:54:28 +00:00
|
|
|
* All settings associated with the current or pending RDP connection.
|
2012-05-04 22:41:08 +00:00
|
|
|
*/
|
2013-07-18 00:54:28 +00:00
|
|
|
guac_rdp_settings settings;
|
2011-03-28 03:56:14 +00:00
|
|
|
|
2012-05-04 22:41:08 +00:00
|
|
|
/**
|
|
|
|
* Button mask containing the OR'd value of all currently pressed buttons.
|
|
|
|
*/
|
2011-07-21 22:17:16 +00:00
|
|
|
int mouse_button_mask;
|
|
|
|
|
2012-04-05 23:45:04 +00:00
|
|
|
/**
|
2012-04-06 05:55:46 +00:00
|
|
|
* Cairo surface which will receive all TRANSPARENT glyphs.
|
|
|
|
*/
|
|
|
|
cairo_surface_t* trans_glyph_surface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cairo surface which will receive all OPAQUE glyphs.
|
|
|
|
*/
|
|
|
|
cairo_surface_t* opaque_glyph_surface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The current Cairo surface which will receive all drawn glyphs,
|
|
|
|
* depending on whether we are currently drawing transparent or
|
|
|
|
* opaque glyphs.
|
2012-04-05 23:45:04 +00:00
|
|
|
*/
|
|
|
|
cairo_surface_t* glyph_surface;
|
|
|
|
|
|
|
|
/**
|
2012-04-06 05:55:46 +00:00
|
|
|
* Cairo instance for drawing to the current glyph surface.
|
2012-04-05 23:45:04 +00:00
|
|
|
*/
|
|
|
|
cairo_t* glyph_cairo;
|
|
|
|
|
2012-05-04 22:41:08 +00:00
|
|
|
/**
|
|
|
|
* The Guacamole layer that GDI operations should draw to. RDP messages
|
|
|
|
* exist which change this surface to allow drawing to occur off-screen.
|
|
|
|
*/
|
2011-07-24 07:47:38 +00:00
|
|
|
const guac_layer* current_surface;
|
|
|
|
|
2013-05-13 21:27:15 +00:00
|
|
|
/**
|
|
|
|
* Whether graphical operations are restricted to a specific bounding
|
|
|
|
* rectangle.
|
|
|
|
*/
|
|
|
|
int bounded;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The X coordinate of the upper-left corner of the bounding rectangle,
|
|
|
|
* if any.
|
|
|
|
*/
|
|
|
|
int bounds_left;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Y coordinate of the upper-left corner of the bounding rectangle,
|
|
|
|
* if any.
|
|
|
|
*/
|
|
|
|
int bounds_top;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The X coordinate of the lower-right corner of the bounding rectangle,
|
|
|
|
* if any.
|
|
|
|
*/
|
|
|
|
int bounds_right;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Y coordinate of the lower-right corner of the bounding rectangle,
|
|
|
|
* if any.
|
|
|
|
*/
|
|
|
|
int bounds_bottom;
|
|
|
|
|
2012-05-04 22:41:08 +00:00
|
|
|
/**
|
|
|
|
* The keymap to use when translating keysyms into scancodes or sequences
|
|
|
|
* of scancodes for RDP.
|
|
|
|
*/
|
2012-03-21 17:45:40 +00:00
|
|
|
guac_rdp_static_keymap keymap;
|
2012-03-20 22:33:08 +00:00
|
|
|
|
2012-05-04 22:41:08 +00:00
|
|
|
/**
|
|
|
|
* The state of all keys, based on whether events for pressing/releasing
|
|
|
|
* particular keysyms have been received. This is necessary in order to
|
|
|
|
* determine which keys must be released/pressed when a particular
|
|
|
|
* keysym can only be typed through a sequence of scancodes (such as
|
|
|
|
* an Alt-code) because the server-side keymap does not support that
|
|
|
|
* keysym.
|
|
|
|
*/
|
2012-03-21 02:43:40 +00:00
|
|
|
guac_rdp_keysym_state_map keysym_state;
|
|
|
|
|
2012-05-04 22:41:08 +00:00
|
|
|
/**
|
|
|
|
* The current text (NOT Unicode) clipboard contents.
|
|
|
|
*/
|
2012-04-30 06:33:27 +00:00
|
|
|
char* clipboard;
|
2012-04-30 06:12:58 +00:00
|
|
|
|
2012-10-28 07:23:44 +00:00
|
|
|
/**
|
|
|
|
* Audio output, if any.
|
|
|
|
*/
|
2013-09-24 19:01:02 +00:00
|
|
|
guac_audio_stream* audio;
|
2012-10-28 07:23:44 +00:00
|
|
|
|
2013-11-04 08:50:10 +00:00
|
|
|
/**
|
|
|
|
* The filesystem being shared, if any.
|
|
|
|
*/
|
|
|
|
guac_rdp_fs* filesystem;
|
|
|
|
|
2012-11-01 04:52:16 +00:00
|
|
|
/**
|
|
|
|
* Lock which is locked and unlocked for each RDP message.
|
|
|
|
*/
|
|
|
|
pthread_mutex_t rdp_lock;
|
|
|
|
|
2012-10-31 08:05:43 +00:00
|
|
|
pthread_mutexattr_t attributes;
|
|
|
|
|
2011-03-28 03:56:14 +00:00
|
|
|
} rdp_guac_client_data;
|
|
|
|
|
2012-05-04 22:41:08 +00:00
|
|
|
/**
|
|
|
|
* Client data that will remain accessible through the RDP context.
|
|
|
|
* This should generally include data commonly used by FreeRDP handlers.
|
|
|
|
*/
|
2011-12-30 08:10:28 +00:00
|
|
|
typedef struct rdp_freerdp_context {
|
|
|
|
|
2012-05-04 22:41:08 +00:00
|
|
|
/**
|
|
|
|
* The parent context. THIS MUST BE THE FIRST ELEMENT.
|
|
|
|
*/
|
2011-12-30 08:10:28 +00:00
|
|
|
rdpContext _p;
|
|
|
|
|
2012-05-04 22:41:08 +00:00
|
|
|
/**
|
|
|
|
* Pointer to the guac_client instance handling the RDP connection with
|
|
|
|
* this context.
|
|
|
|
*/
|
2011-12-30 08:10:28 +00:00
|
|
|
guac_client* client;
|
2012-05-04 22:41:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Color conversion structure to be used to convert RDP images to PNGs.
|
|
|
|
*/
|
2012-02-08 20:32:27 +00:00
|
|
|
CLRCONV* clrconv;
|
2011-12-30 08:10:28 +00:00
|
|
|
|
|
|
|
} rdp_freerdp_context;
|
2011-03-28 03:56:14 +00:00
|
|
|
|
2013-06-15 05:16:25 +00:00
|
|
|
/**
|
|
|
|
* Given the coordinates and dimensions of a rectangle, clips the rectangle to be
|
|
|
|
* within the clipping bounds of the client data, if clipping is active.
|
2013-07-19 19:21:34 +00:00
|
|
|
*
|
|
|
|
* Returns 0 if the rectangle given is visible at all, and 1 if the entire
|
|
|
|
* rectangls is outside the clipping rectangle and this invisible.
|
2013-06-15 05:16:25 +00:00
|
|
|
*/
|
2013-07-19 19:21:34 +00:00
|
|
|
int guac_rdp_clip_rect(rdp_guac_client_data* data, int* x, int* y, int* w, int* h);
|
2013-06-15 05:16:25 +00:00
|
|
|
|
2011-03-28 03:56:14 +00:00
|
|
|
#endif
|
|
|
|
|