guacamole-spice-protocol/src/protocols/rdp/client.h

200 lines
5.4 KiB
C
Raw Normal View History

/*
* Copyright (C) 2013 Glyptodon LLC
2011-03-28 03:56:14 +00:00
*
* 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:
2011-03-28 03:56:14 +00:00
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
2011-03-28 03:56:14 +00:00
*
* 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.
*/
2011-03-28 03:56:14 +00:00
#ifndef _GUAC_RDP_CLIENT_H
#define _GUAC_RDP_CLIENT_H
2011-03-28 03:56:14 +00:00
2014-01-01 22:44:28 +00:00
#include "config.h"
#include "guac_clipboard.h"
2014-03-02 18:38:31 +00:00
#include "guac_list.h"
#include "guac_surface.h"
2014-01-01 22:44:28 +00:00
#include "rdp_fs.h"
#include "rdp_keymap.h"
#include "rdp_settings.h"
#include <pthread.h>
#include <stdint.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>
#include <guacamole/audio.h>
2014-01-01 22:44:28 +00:00
#include <guacamole/client.h>
/**
* The maximum duration of a frame in milliseconds.
*/
#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
/**
* The native resolution of most RDP connections. As Windows and other systems
* rely heavily on forced 96 DPI, we must assume 96 DPI.
*/
#define GUAC_RDP_NATIVE_RESOLUTION 96
/**
* The resolution of an RDP connection that would be considered high, but is
* tolerable in the case that the client display would be unreasonably small
* otherwise.
*/
#define GUAC_RDP_HIGH_RESOLUTION 120
/**
* The smallest area, in pixels^2, that would be considered reasonable large
* screen DPI needs to be adjusted.
*/
#define GUAC_RDP_REASONABLE_AREA (800*600)
/**
* The maximum number of bytes to allow within the clipboard.
*/
#define GUAC_RDP_CLIPBOARD_MAX_LENGTH 262144
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.
*/
freerdp* rdp_inst;
2012-05-04 22:41:08 +00:00
/**
* All settings associated with the current or pending RDP connection.
2012-05-04 22:41:08 +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.
*/
int mouse_button_mask;
2012-04-05 23:45:04 +00:00
/**
* Foreground color for any future glyphs.
2012-04-06 05:55:46 +00:00
*/
uint32_t glyph_color;
2012-04-05 23:45:04 +00:00
2012-05-04 22:41:08 +00:00
/**
* The display.
2012-05-04 22:41:08 +00:00
*/
guac_common_surface* default_surface;
/**
* The surface that GDI operations should draw to. RDP messages exist which
* change this surface to allow drawing to occur off-screen.
*/
guac_common_surface* current_surface;
2011-07-24 07:47:38 +00:00
2012-05-04 22:41:08 +00:00
/**
* The keymap to use when translating keysyms into scancodes or sequences
* of scancodes for RDP.
*/
guac_rdp_static_keymap keymap;
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 clipboard contents.
2012-05-04 22:41:08 +00:00
*/
guac_common_clipboard* clipboard;
2012-04-30 06:12:58 +00:00
/**
* The format of the clipboard which was requested. Data received from
* the RDP server should conform to this format. This will be one of
* several legal clipboard format values defined within FreeRDP, such as
* CB_FORMAT_TEXT.
*/
int requested_clipboard_format;
2012-10-28 07:23:44 +00:00
/**
* Audio output, if any.
*/
guac_audio_stream* audio;
2012-10-28 07:23:44 +00:00
/**
* The filesystem being shared, if any.
*/
guac_rdp_fs* filesystem;
2014-03-02 18:38:31 +00:00
/**
* List of all available static virtual channels.
*/
guac_common_list* available_svc;
2012-11-01 04:52:16 +00:00
/**
* Lock which is locked and unlocked for each RDP message.
*/
pthread_mutex_t rdp_lock;
2014-03-02 18:38:31 +00:00
/**
* Common attributes for locks.
*/
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.
*/
typedef struct rdp_freerdp_context {
2012-05-04 22:41:08 +00:00
/**
* The parent context. THIS MUST BE THE FIRST ELEMENT.
*/
rdpContext _p;
2012-05-04 22:41:08 +00:00
/**
* Pointer to the guac_client instance handling the RDP connection with
* this context.
*/
guac_client* client;
2012-05-04 22:41:08 +00:00
/**
* Color conversion structure to be used to convert RDP images to PNGs.
*/
CLRCONV* clrconv;
} rdp_freerdp_context;
2011-03-28 03:56:14 +00:00
#endif