Refactored, removed functionality. Fixed most errors on compile. Will likely not actually work in current state.

This commit is contained in:
Michael Jumper 2011-12-30 00:10:28 -08:00
parent e3c4c858d1
commit 6a1994484c
9 changed files with 366 additions and 383 deletions

View File

@ -41,7 +41,7 @@ AM_CFLAGS = -Werror -Wall -pedantic -Iinclude
lib_LTLIBRARIES = libguac-client-rdp.la lib_LTLIBRARIES = libguac-client-rdp.la
libguac_client_rdp_la_SOURCES = src/rdp_client.c src/rdp_handlers.c src/rdp_keymap.c libguac_client_rdp_la_SOURCES = src/client.c src/rdp_handlers.c src/rdp_keymap.c
libguac_client_rdp_la_LDFLAGS = -version-info 0:0:0 libguac_client_rdp_la_LDFLAGS = -version-info 0:0:0

View File

@ -34,7 +34,7 @@
# #
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
AC_INIT(src/rdp_client.c) AC_INIT(src/client.c)
AM_INIT_AUTOMAKE([libguac-client-rdp], 0.5.0) AM_INIT_AUTOMAKE([libguac-client-rdp], 0.5.0)
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
@ -47,7 +47,7 @@ AC_PROG_LIBTOOL
AC_CHECK_LIB([guac], [guac_client_plugin_open],, AC_MSG_ERROR("libguac must be installed first")) AC_CHECK_LIB([guac], [guac_client_plugin_open],, AC_MSG_ERROR("libguac must be installed first"))
AC_CHECK_LIB([cairo], [cairo_create],, AC_MSG_ERROR("cairo is required for drawing instructions")) AC_CHECK_LIB([cairo], [cairo_create],, AC_MSG_ERROR("cairo is required for drawing instructions"))
AC_CHECK_LIB([freerdp-core], [freerdp_new],, AC_MSG_ERROR("libfreerdp is required")) AC_CHECK_LIB([freerdp-core], [freerdp_new],, AC_MSG_ERROR("libfreerdp is required"))
AC_CHECK_LIB([freerdp-chanman], [freerdp_chanman_new],, AC_MSG_ERROR("libfreerdp is required")) AC_CHECK_LIB([freerdp-channels], [freerdp_channels_new],, AC_MSG_ERROR("libfreerdp is required"))
# Checks for header files. # Checks for header files.
AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h]) AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h])

View File

@ -35,15 +35,14 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifndef _GUAC_CLIENT_RDP_CLIENT #ifndef _GUAC_RDP_CLIENT_H
#define _GUAC_CLIENT_RDP_CLIENT #define _GUAC_RDP_CLIENT_H
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
#include <freerdp/chanman.h> #include <freerdp/channels/channels.h>
#include <guacamole/client.h> #include <guacamole/client.h>
#define RDP_DEFAULT_PORT 3389 #define RDP_DEFAULT_PORT 3389
typedef struct guac_rdp_color { typedef struct guac_rdp_color {
@ -54,9 +53,9 @@ typedef struct guac_rdp_color {
typedef struct rdp_guac_client_data { typedef struct rdp_guac_client_data {
rdpInst* rdp_inst; freerdp* rdp_inst;
rdpChanMan* chanman; rdpChannels* channels;
rdpSet* settings; rdpSettings* settings;
int mouse_button_mask; int mouse_button_mask;
@ -67,10 +66,13 @@ typedef struct rdp_guac_client_data {
} rdp_guac_client_data; } rdp_guac_client_data;
int rdp_guac_client_free_handler(guac_client* client); typedef struct rdp_freerdp_context {
int rdp_guac_client_handle_messages(guac_client* client);
int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask); rdpContext _p;
int rdp_guac_client_key_handler(guac_client* client, int keysym, int pressed);
guac_client* client;
} rdp_freerdp_context;
#endif #endif

View File

@ -0,0 +1,49 @@
/* ***** 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_RDP_GUAC_HANDLERS_H
#define _GUAC_RDP_GUAC_HANDLERS_H
#include <guacamole/client.h>
int rdp_guac_client_free_handler(guac_client* client);
int rdp_guac_client_handle_messages(guac_client* client);
int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask);
int rdp_guac_client_key_handler(guac_client* client, int keysym, int pressed);
#endif

View File

@ -35,56 +35,48 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifndef _GUAC_CLIENT_RDP_HANDLERS #ifndef _GUAC_RDP_RDP_HANDLERS_H
#define _GUAC_CLIENT_RDP_HANDLERS #define _GUAC_RDP_RDP_HANDLERS_H
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
#include <freerdp/codec/bitmap.h>
void guac_rdp_ui_error(rdpInst* inst, const char* text); int guac_rdp_ui_select(freerdp* inst, int rdp_socket);
void guac_rdp_ui_warning(rdpInst* inst, const char* text);
void guac_rdp_ui_unimpl(rdpInst* inst, const char* text);
void guac_rdp_ui_begin_update(rdpInst* inst);
void guac_rdp_ui_end_update(rdpInst* inst);
void guac_rdp_ui_desktop_save(rdpInst* inst, int offset, int x, int y, int cx, int cy);
void guac_rdp_ui_desktop_restore(rdpInst* inst, int offset, int x, int y, int cx, int cy);
RD_HBITMAP guac_rdp_ui_create_bitmap(rdpInst* inst, int width, int height, uint8* data);
void guac_rdp_ui_paint_bitmap(rdpInst* inst, int x, int y, int cx, int cy, int width, int height, uint8* data);
void guac_rdp_ui_destroy_bitmap(rdpInst* inst, RD_HBITMAP bmp);
void guac_rdp_ui_line(rdpInst* inst, uint8 opcode, int startx, int starty, int endx, int endy, RD_PEN* pen);
void guac_rdp_ui_rect(rdpInst* inst, int x, int y, int cx, int cy, uint32 colour);
void guac_rdp_ui_polygon(rdpInst* inst, uint8 opcode, uint8 fillmode, RD_POINT* point, int npoints, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor);
void guac_rdp_ui_polyline(rdpInst* inst, uint8 opcode, RD_POINT* points, int npoints, RD_PEN* pen);
void guac_rdp_ui_ellipse(rdpInst* inst, uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor);
void guac_rdp_ui_start_draw_glyphs(rdpInst* inst, uint32 bgcolor, uint32 fgcolor);
void guac_rdp_ui_draw_glyph(rdpInst* inst, int x, int y, int cx, int cy, RD_HGLYPH glyph);
void guac_rdp_ui_end_draw_glyphs(rdpInst* inst, int x, int y, int cx, int cy);
uint32 guac_rdp_ui_get_toggle_keys_state(rdpInst* inst);
void guac_rdp_ui_bell(rdpInst* inst);
void guac_rdp_ui_destblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy);
void guac_rdp_ui_patblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor);
void guac_rdp_ui_screenblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy);
void guac_rdp_ui_memblt(rdpInst* inst, uint8 opcode, int x, int y, int width, int height, RD_HBITMAP src, int srcx, int srcy);
void guac_rdp_ui_triblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor);
RD_HGLYPH guac_rdp_ui_create_glyph(rdpInst* inst, int width, int height, uint8* data);
void guac_rdp_ui_destroy_glyph(rdpInst* inst, RD_HGLYPH glyph);
int guac_rdp_ui_select(rdpInst* inst, int rdp_socket);
void guac_rdp_ui_set_clip(rdpInst* inst, int x, int y, int cx, int cy);
void guac_rdp_ui_reset_clip(rdpInst* inst);
void guac_rdp_ui_resize_window(rdpInst* inst);
void guac_rdp_ui_set_cursor(rdpInst* inst, RD_HCURSOR cursor);
void guac_rdp_ui_destroy_cursor(rdpInst* inst, RD_HCURSOR cursor);
RD_HCURSOR guac_rdp_ui_create_cursor(rdpInst* inst, unsigned int x, unsigned int y, int width, int height, uint8* andmask, uint8* xormask, int bpp);
void guac_rdp_ui_set_null_cursor(rdpInst* inst);
void guac_rdp_ui_set_default_cursor(rdpInst* inst);
void guac_rdp_ui_move_pointer(rdpInst* inst, int x, int y);
RD_HBITMAP guac_rdp_ui_create_surface(rdpInst* inst, int width, int height, RD_HBITMAP old);
void guac_rdp_ui_set_surface(rdpInst* inst, RD_HBITMAP surface);
void guac_rdp_ui_destroy_surface(rdpInst* inst, RD_HBITMAP surface);
void guac_rdp_ui_channel_data(rdpInst* inst, int chan_id, char* data, int data_size, int flags, int total_size);
RD_HPALETTE guac_rdp_ui_create_palette(rdpInst* inst, RD_PALETTE* colours);
void guac_rdp_ui_set_palette(rdpInst* inst, RD_HPALETTE map);
extern const int guac_rdp_letter_scancodes[]; void guac_rdp_ui_resize_window(freerdp* inst);
void guac_rdp_ui_move_pointer(freerdp* inst, int x, int y);
void guac_rdp_ui_set_clip(freerdp* inst, int x, int y, int cx, int cy);
void guac_rdp_ui_reset_clip(freerdp* inst);
void guac_rdp_ui_rect(freerdp* inst, int x, int y, int cx, int cy, uint32 colour);
rdpBitmap* guac_rdp_ui_create_bitmap(freerdp* inst, int width, int height, uint8* data);
void guac_rdp_ui_paint_bitmap(freerdp* inst, int x, int y, int cx, int cy, int width, int height, uint8* data);
void guac_rdp_ui_destroy_bitmap(freerdp* inst, rdpBitmap* bmp);
void guac_rdp_ui_destblt(freerdp* inst, uint8 opcode, int x, int y, int cx, int cy);
void guac_rdp_ui_patblt(freerdp* inst, uint8 opcode, int x, int y, int cx, int cy, rdpBrush* brush, uint32 bgcolor, uint32 fgcolor);
void guac_rdp_ui_screenblt(freerdp* inst, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy);
void guac_rdp_ui_memblt(freerdp* inst, uint8 opcode, int x, int y, int width, int height, rdpBitmap* src, int srcx, int srcy);
void guac_rdp_ui_triblt(freerdp* inst, uint8 opcode, int x, int y, int cx, int cy, rdpBitmap* src, int srcx, int srcy, rdpBrush* brush, uint32 bgcolor, uint32 fgcolor);
void guac_rdp_ui_start_draw_glyphs(freerdp* inst, uint32 bgcolor, uint32 fgcolor);
void guac_rdp_ui_draw_glyph(freerdp* inst, int x, int y, int cx, int cy, rdpGlyph* glyph);
void guac_rdp_ui_end_draw_glyphs(freerdp* inst, int x, int y, int cx, int cy);
rdpGlyph* guac_rdp_ui_create_glyph(freerdp* inst, int width, int height, uint8* data);
void guac_rdp_ui_destroy_glyph(freerdp* inst, rdpGlyph* glyph);
void guac_rdp_ui_set_pointer(freerdp* inst, rdpPointer pointer);
void guac_rdp_ui_destroy_pointer(freerdp* inst, rdpPointer pointer);
rdpPointer guac_rdp_ui_create_pointer(freerdp* inst, unsigned int x, unsigned int y, int width, int height, uint8* andmask, uint8* xormask, int bpp);
void guac_rdp_ui_set_null_pointer(freerdp* inst);
void guac_rdp_ui_set_default_pointer(freerdp* inst);
rdpBitmap* guac_rdp_ui_create_surface(freerdp* inst, int width, int height, rdpBitmap* old);
void guac_rdp_ui_set_surface(freerdp* inst, rdpBitmap* surface);
void guac_rdp_ui_destroy_surface(freerdp* inst, rdpBitmap* surface);
#endif #endif

View File

@ -35,8 +35,8 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifndef _GUAC_CLIENT_RDP_KEYMAP #ifndef _GUAC_RDP_RDP_KEYMAP_H
#define _GUAC_CLIENT_RDP_KEYMAP #define _GUAC_RDP_RDP_KEYMAP_H
typedef struct guac_rdp_keymap { typedef struct guac_rdp_keymap {
int scancode; int scancode;

173
protocols/rdp/src/client.c Normal file
View File

@ -0,0 +1,173 @@
/* ***** 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 <stdlib.h>
#include <string.h>
#include <sys/select.h>
#include <errno.h>
#include <freerdp/freerdp.h>
#include <freerdp/channels/channels.h>
#include <freerdp/input.h>
#include <guacamole/socket.h>
#include <guacamole/protocol.h>
#include <guacamole/client.h>
#include "client.h"
#include "guac_handlers.h"
#include "rdp_handlers.h"
#include "rdp_keymap.h"
/* Client plugin arguments */
const char* GUAC_CLIENT_ARGS[] = {
"hostname",
"port",
NULL
};
void rdp_freerdp_context_new(freerdp* instance, rdpContext* context) {
/* EMPTY */
}
void rdp_freerdp_context_free(freerdp* instance, rdpContext* context) {
/* EMPTY */
}
int guac_client_init(guac_client* client, int argc, char** argv) {
rdp_guac_client_data* guac_client_data;
freerdp* rdp_inst;
rdpChannels* channels;
rdpSettings* settings;
char* hostname;
int port = RDP_DEFAULT_PORT;
if (argc < 2) {
guac_protocol_send_error(client->socket, "Wrong argument count received.");
guac_socket_flush(client->socket);
return 1;
}
/* If port specified, use it */
if (argv[1][0] != '\0')
port = atoi(argv[1]);
hostname = argv[0];
/* Allocate client data */
guac_client_data = malloc(sizeof(rdp_guac_client_data));
/* Get channel manager */
channels = freerdp_channels_new();
guac_client_data->channels = channels;
/* INIT SETTINGS */
settings = malloc(sizeof(rdpSettings));
memset(settings, 0, sizeof(rdpSettings));
guac_client_data->settings = settings;
/* Set hostname */
strncpy(settings->hostname, hostname, sizeof(settings->hostname) - 1);
/* Default size */
settings->width = 1024;
settings->height = 768;
strncpy(settings->window_title, hostname, sizeof(settings->window_title));
strcpy(settings->username, "guest");
/* FIXME: Set RDP settings->* */
/* Init client */
rdp_inst = freerdp_new(settings);
if (rdp_inst == NULL) {
guac_protocol_send_error(client->socket, "Error initializing RDP client");
guac_socket_flush(client->socket);
return 1;
}
guac_client_data->rdp_inst = rdp_inst;
guac_client_data->mouse_button_mask = 0;
guac_client_data->current_surface = GUAC_DEFAULT_LAYER;
/* Allocate FreeRDP context */
rdp_inst->context_size = sizeof(rdp_freerdp_context);
rdp_inst->ContextNew = (pContextNew) rdp_freerdp_context_new;
rdp_inst->ContextFree = (pContextFree) rdp_freerdp_context_free;
freerdp_context_new(rdp_inst);
/* Store client data */
((rdp_freerdp_context*) rdp_inst->context)->client = client;
client->data = guac_client_data;
/* FIXME: Set RDP handlers */
/* Init channels (pre-connect) */
if (freerdp_channels_pre_connect(channels, rdp_inst)) {
guac_protocol_send_error(client->socket, "Error initializing RDP client channel manager");
guac_socket_flush(client->socket);
return 1;
}
/* Connect to RDP server */
if (!freerdp_connect(rdp_inst)) {
guac_protocol_send_error(client->socket, "Error connecting to RDP server");
guac_socket_flush(client->socket);
return 1;
}
/* Init channels (post-connect) */
if (freerdp_channels_post_connect(channels, rdp_inst)) {
guac_protocol_send_error(client->socket, "Error initializing RDP client channel manager");
guac_socket_flush(client->socket);
return 1;
}
/* Client handlers */
client->free_handler = rdp_guac_client_free_handler;
client->handle_messages = rdp_guac_client_handle_messages;
client->mouse_handler = rdp_guac_client_mouse_handler;
client->key_handler = rdp_guac_client_key_handler;
/* Success */
return 0;
}

View File

@ -42,24 +42,17 @@
#include <errno.h> #include <errno.h>
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
#include <freerdp/chanman.h> #include <freerdp/channels/channels.h>
#include <freerdp/constants/core.h> #include <freerdp/input.h>
#include <guacamole/socket.h> #include <guacamole/socket.h>
#include <guacamole/protocol.h> #include <guacamole/protocol.h>
#include <guacamole/client.h> #include <guacamole/client.h>
#include "client.h"
#include "rdp_handlers.h" #include "rdp_handlers.h"
#include "rdp_client.h"
#include "rdp_keymap.h" #include "rdp_keymap.h"
/* Client plugin arguments */
const char* GUAC_CLIENT_ARGS[] = {
"hostname",
"port",
NULL
};
int rdp_guac_client_free_handler(guac_client* client) { int rdp_guac_client_free_handler(guac_client* client) {
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
@ -69,7 +62,7 @@ int rdp_guac_client_free_handler(guac_client* client) {
/* Free RDP client */ /* Free RDP client */
freerdp_free(guac_client_data->rdp_inst); freerdp_free(guac_client_data->rdp_inst);
freerdp_chanman_free(guac_client_data->chanman); freerdp_channels_free(guac_client_data->channels);
free(guac_client_data->settings); free(guac_client_data->settings);
/* Free guac client data */ /* Free guac client data */
@ -83,7 +76,7 @@ int rdp_guac_client_handle_messages(guac_client* client) {
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
rdpInst* rdp_inst = guac_client_data->rdp_inst; rdpInst* rdp_inst = guac_client_data->rdp_inst;
rdpChanMan* chanman = guac_client_data->chanman; rdpChannels* channels = guac_client_data->channels;
int index; int index;
int max_fd, fd; int max_fd, fd;
@ -101,7 +94,7 @@ int rdp_guac_client_handle_messages(guac_client* client) {
} }
/* get channel fds */ /* get channel fds */
if (freerdp_chanman_get_fds(chanman, rdp_inst, read_fds, &read_count, write_fds, &write_count) != 0) { if (freerdp_channels_get_fds(channels, rdp_inst, read_fds, &read_count, write_fds, &write_count) != 0) {
guac_client_log_error(client, "Unable to read RDP channel file descriptors."); guac_client_log_error(client, "Unable to read RDP channel file descriptors.");
return 1; return 1;
} }
@ -151,7 +144,7 @@ int rdp_guac_client_handle_messages(guac_client* client) {
} }
/* check channel fds */ /* check channel fds */
if (freerdp_chanman_check_fds(chanman, rdp_inst) != 0) { if (freerdp_channels_check_fds(channels, rdp_inst) != 0) {
guac_client_log_error(client, "Error handling RDP channel file descriptors."); guac_client_log_error(client, "Error handling RDP channel file descriptors.");
return 1; return 1;
} }
@ -161,163 +154,6 @@ int rdp_guac_client_handle_messages(guac_client* client) {
} }
int guac_client_init(guac_client* client, int argc, char** argv) {
rdp_guac_client_data* guac_client_data;
rdpInst* rdp_inst;
rdpChanMan* chanman;
rdpSet* settings;
char* hostname;
int port = RDP_DEFAULT_PORT;
if (argc < 2) {
guac_protocol_send_error(client->socket, "Wrong argument count received.");
guac_socket_flush(client->socket);
return 1;
}
/* If port specified, use it */
if (argv[1][0] != '\0')
port = atoi(argv[1]);
hostname = argv[0];
/* Allocate client data */
guac_client_data = malloc(sizeof(rdp_guac_client_data));
/* Get channel manager */
chanman = freerdp_chanman_new();
guac_client_data->chanman = chanman;
/* INIT SETTINGS */
settings = malloc(sizeof(rdpSet));
memset(settings, 0, sizeof(rdpSet));
guac_client_data->settings = settings;
/* Set hostname */
strncpy(settings->hostname, hostname, sizeof(settings->hostname) - 1);
/* Default size */
settings->width = 1024;
settings->height = 768;
strncpy(settings->server, hostname, sizeof(settings->server));
strcpy(settings->username, "guest");
settings->tcp_port_rdp = port;
settings->encryption = 1;
settings->server_depth = 16;
settings->bitmap_cache = 1;
settings->bitmap_compression = 1;
settings->desktop_save = 0;
settings->performanceflags =
PERF_DISABLE_WALLPAPER
| PERF_DISABLE_FULLWINDOWDRAG
| PERF_DISABLE_MENUANIMATIONS;
settings->mouse_motion = 1;
settings->off_screen_bitmaps = 1;
settings->triblt = 0;
settings->software_gdi = 0;
settings->new_cursors = 1;
settings->rdp_version = 5;
settings->rdp_security = 1;
/* Init client */
rdp_inst = freerdp_new(settings);
if (rdp_inst == NULL) {
guac_protocol_send_error(client->socket, "Error initializing RDP client");
guac_socket_flush(client->socket);
return 1;
}
guac_client_data->rdp_inst = rdp_inst;
guac_client_data->mouse_button_mask = 0;
guac_client_data->current_surface = GUAC_DEFAULT_LAYER;
/* Store client data */
rdp_inst->param1 = client;
client->data = guac_client_data;
/* RDP handlers */
rdp_inst->ui_error = guac_rdp_ui_error;
rdp_inst->ui_warning = guac_rdp_ui_warning;
rdp_inst->ui_unimpl = guac_rdp_ui_unimpl;
rdp_inst->ui_begin_update = guac_rdp_ui_begin_update;
rdp_inst->ui_end_update = guac_rdp_ui_end_update;
rdp_inst->ui_desktop_save = guac_rdp_ui_desktop_save;
rdp_inst->ui_desktop_restore = guac_rdp_ui_desktop_restore;
rdp_inst->ui_create_bitmap = guac_rdp_ui_create_bitmap;
rdp_inst->ui_paint_bitmap = guac_rdp_ui_paint_bitmap;
rdp_inst->ui_destroy_bitmap = guac_rdp_ui_destroy_bitmap;
rdp_inst->ui_line = guac_rdp_ui_line;
rdp_inst->ui_rect = guac_rdp_ui_rect;
rdp_inst->ui_polygon = guac_rdp_ui_polygon;
rdp_inst->ui_polyline = guac_rdp_ui_polyline;
rdp_inst->ui_ellipse = guac_rdp_ui_ellipse;
rdp_inst->ui_start_draw_glyphs = guac_rdp_ui_start_draw_glyphs;
rdp_inst->ui_draw_glyph = guac_rdp_ui_draw_glyph;
rdp_inst->ui_end_draw_glyphs = guac_rdp_ui_end_draw_glyphs;
rdp_inst->ui_get_toggle_keys_state = guac_rdp_ui_get_toggle_keys_state;
rdp_inst->ui_bell = guac_rdp_ui_bell;
rdp_inst->ui_destblt = guac_rdp_ui_destblt;
rdp_inst->ui_patblt = guac_rdp_ui_patblt;
rdp_inst->ui_screenblt = guac_rdp_ui_screenblt;
rdp_inst->ui_memblt = guac_rdp_ui_memblt;
rdp_inst->ui_triblt = guac_rdp_ui_triblt;
rdp_inst->ui_create_glyph = guac_rdp_ui_create_glyph;
rdp_inst->ui_destroy_glyph = guac_rdp_ui_destroy_glyph;
rdp_inst->ui_select = guac_rdp_ui_select;
rdp_inst->ui_set_clip = guac_rdp_ui_set_clip;
rdp_inst->ui_reset_clip = guac_rdp_ui_reset_clip;
rdp_inst->ui_resize_window = guac_rdp_ui_resize_window;
rdp_inst->ui_set_cursor = guac_rdp_ui_set_cursor;
rdp_inst->ui_destroy_cursor = guac_rdp_ui_destroy_cursor;
rdp_inst->ui_create_cursor = guac_rdp_ui_create_cursor;
rdp_inst->ui_set_null_cursor = guac_rdp_ui_set_null_cursor;
rdp_inst->ui_set_default_cursor = guac_rdp_ui_set_default_cursor;
rdp_inst->ui_create_palette = guac_rdp_ui_create_palette;
rdp_inst->ui_move_pointer = guac_rdp_ui_move_pointer;
rdp_inst->ui_set_palette = guac_rdp_ui_set_palette;
rdp_inst->ui_create_surface = guac_rdp_ui_create_surface;
rdp_inst->ui_set_surface = guac_rdp_ui_set_surface;
rdp_inst->ui_destroy_surface = guac_rdp_ui_destroy_surface;
rdp_inst->ui_channel_data = guac_rdp_ui_channel_data;
/* Init chanman (pre-connect) */
if (freerdp_chanman_pre_connect(chanman, rdp_inst)) {
guac_protocol_send_error(client->socket, "Error initializing RDP client channel manager");
guac_socket_flush(client->socket);
return 1;
}
/* Connect to RDP server */
if (rdp_inst->rdp_connect(rdp_inst)) {
guac_protocol_send_error(client->socket, "Error connecting to RDP server");
guac_socket_flush(client->socket);
return 1;
}
/* Init chanman (post-connect) */
if (freerdp_chanman_post_connect(chanman, rdp_inst)) {
guac_protocol_send_error(client->socket, "Error initializing RDP client channel manager");
guac_socket_flush(client->socket);
return 1;
}
/* Client handlers */
client->free_handler = rdp_guac_client_free_handler;
client->handle_messages = rdp_guac_client_handle_messages;
client->mouse_handler = rdp_guac_client_mouse_handler;
client->key_handler = rdp_guac_client_key_handler;
/* Success */
return 0;
}
int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) { int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
@ -325,7 +161,7 @@ int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
/* If button mask unchanged, just send move event */ /* If button mask unchanged, just send move event */
if (mask == guac_client_data->mouse_button_mask) if (mask == guac_client_data->mouse_button_mask)
rdp_inst->rdp_send_input_mouse(rdp_inst, PTRFLAGS_MOVE, x, y); rdp_inst->rdp_send_input_mouse(rdp_inst, PTR_FLAGS_MOVE, x, y);
/* Otherwise, send events describing button change */ /* Otherwise, send events describing button change */
else { else {
@ -341,9 +177,9 @@ int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
/* Calculate flags */ /* Calculate flags */
int flags = 0; int flags = 0;
if (released_mask & 0x01) flags |= PTRFLAGS_BUTTON1; if (released_mask & 0x01) flags |= PTR_FLAGS_BUTTON1;
if (released_mask & 0x02) flags |= PTRFLAGS_BUTTON3; if (released_mask & 0x02) flags |= PTR_FLAGS_BUTTON3;
if (released_mask & 0x04) flags |= PTRFLAGS_BUTTON2; if (released_mask & 0x04) flags |= PTR_FLAGS_BUTTON2;
rdp_inst->rdp_send_input_mouse(rdp_inst, flags, x, y); rdp_inst->rdp_send_input_mouse(rdp_inst, flags, x, y);
@ -353,12 +189,12 @@ int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
if (pressed_mask & 0x07) { if (pressed_mask & 0x07) {
/* Calculate flags */ /* Calculate flags */
int flags = PTRFLAGS_DOWN; int flags = PTR_FLAGS_DOWN;
if (pressed_mask & 0x01) flags |= PTRFLAGS_BUTTON1; if (pressed_mask & 0x01) flags |= PTR_FLAGS_BUTTON1;
if (pressed_mask & 0x02) flags |= PTRFLAGS_BUTTON3; if (pressed_mask & 0x02) flags |= PTR_FLAGS_BUTTON3;
if (pressed_mask & 0x04) flags |= PTRFLAGS_BUTTON2; if (pressed_mask & 0x04) flags |= PTR_FLAGS_BUTTON2;
if (pressed_mask & 0x08) flags |= PTRFLAGS_WHEEL | 0x78; if (pressed_mask & 0x08) flags |= PTR_FLAGS_WHEEL | 0x78;
if (pressed_mask & 0x10) flags |= PTRFLAGS_WHEEL | PTRFLAGS_WHEEL_NEGATIVE | 0x88; if (pressed_mask & 0x10) flags |= PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x88;
/* Send event */ /* Send event */
rdp_inst->rdp_send_input_mouse(rdp_inst, flags, x, y); rdp_inst->rdp_send_input_mouse(rdp_inst, flags, x, y);
@ -372,14 +208,14 @@ int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
if (pressed_mask & 0x08) if (pressed_mask & 0x08)
rdp_inst->rdp_send_input_mouse( rdp_inst->rdp_send_input_mouse(
rdp_inst, rdp_inst,
PTRFLAGS_WHEEL | 0x78, PTR_FLAGS_WHEEL | 0x78,
x, y); x, y);
/* Up */ /* Up */
if (pressed_mask & 0x10) if (pressed_mask & 0x10)
rdp_inst->rdp_send_input_mouse( rdp_inst->rdp_send_input_mouse(
rdp_inst, rdp_inst,
PTRFLAGS_WHEEL | PTRFLAGS_WHEEL_NEGATIVE | 0x88, PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x88,
x, y); x, y);
} }
@ -408,7 +244,7 @@ int rdp_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
rdp_inst->rdp_send_input_scancode( rdp_inst->rdp_send_input_scancode(
rdp_inst, rdp_inst,
!pressed, !pressed,
keymap->flags & KBDFLAGS_EXTENDED, keymap->flags & KBD_FLAGS_EXTENDED,
keymap->scancode); keymap->scancode);
else else
guac_client_log_info(client, "unmapped keysym: 0x%x", keysym); guac_client_log_info(client, "unmapped keysym: 0x%x", keysym);

View File

@ -46,8 +46,8 @@
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
#include "client.h"
#include "rdp_handlers.h" #include "rdp_handlers.h"
#include "rdp_client.h"
void guac_rdp_convert_color(int depth, int color, guac_rdp_color* comp) { void guac_rdp_convert_color(int depth, int color, guac_rdp_color* comp) {
@ -73,9 +73,9 @@ void guac_rdp_convert_color(int depth, int color, guac_rdp_color* comp) {
} }
void guac_rdp_ui_error(rdpInst* inst, const char* text) { void guac_rdp_ui_error(freerdp* inst, const char* text) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
guac_protocol_send_error(socket, text); guac_protocol_send_error(socket, text);
@ -83,41 +83,30 @@ void guac_rdp_ui_error(rdpInst* inst, const char* text) {
} }
void guac_rdp_ui_warning(rdpInst* inst, const char* text) { void guac_rdp_ui_warning(freerdp* inst, const char* text) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_warning: %s\n", text); guac_client_log_info(client, "guac_rdp_ui_warning: %s\n", text);
} }
void guac_rdp_ui_unimpl(rdpInst* inst, const char* text) { void guac_rdp_ui_unimpl(freerdp* inst, const char* text) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_unimpl: %s\n", text); guac_client_log_info(client, "guac_rdp_ui_unimpl: %s\n", text);
} }
void guac_rdp_ui_begin_update(rdpInst* inst) { void guac_rdp_ui_begin_update(freerdp* inst) {
/* UNUSED */ /* UNUSED */
} }
void guac_rdp_ui_end_update(rdpInst* inst) { void guac_rdp_ui_end_update(freerdp* inst) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
guac_socket_flush(socket); guac_socket_flush(socket);
} }
void guac_rdp_ui_desktop_save(rdpInst* inst, int offset, int x, int y, int cx, int cy) { rdpBitmap* guac_rdp_ui_create_bitmap(freerdp* inst, int width, int height, uint8* data) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_desktop_save: STUB\n");
}
void guac_rdp_ui_desktop_restore(rdpInst* inst, int offset, int x, int y, int cx, int cy) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_desktop_restore: STUB\n");
}
RD_HBITMAP guac_rdp_ui_create_bitmap(rdpInst* inst, int width, int height, uint8* data) {
/* Allocate buffer */ /* Allocate buffer */
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
guac_layer* buffer = guac_client_alloc_buffer(client); guac_layer* buffer = guac_client_alloc_buffer(client);
@ -184,13 +173,13 @@ RD_HBITMAP guac_rdp_ui_create_bitmap(rdpInst* inst, int width, int height, uint8
cairo_surface_destroy(surface); cairo_surface_destroy(surface);
free(image_buffer); free(image_buffer);
return (RD_HBITMAP) buffer; return (rdpBitmap*) buffer;
} }
void guac_rdp_ui_paint_bitmap(rdpInst* inst, int x, int y, int cx, int cy, int width, int height, uint8* data) { void guac_rdp_ui_paint_bitmap(freerdp* inst, int x, int y, int cx, int cy, int width, int height, uint8* data) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
@ -268,22 +257,17 @@ void guac_rdp_ui_paint_bitmap(rdpInst* inst, int x, int y, int cx, int cy, int w
} }
void guac_rdp_ui_destroy_bitmap(rdpInst* inst, RD_HBITMAP bmp) { void guac_rdp_ui_destroy_bitmap(freerdp* inst, rdpBitmap* bmp) {
/* Free buffer */ /* Free buffer */
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_free_buffer(client, (guac_layer*) bmp); guac_client_free_buffer(client, (guac_layer*) bmp);
} }
void guac_rdp_ui_line(rdpInst* inst, uint8 opcode, int startx, int starty, int endx, int endy, RD_PEN* pen) { void guac_rdp_ui_rect(freerdp* inst, int x, int y, int cx, int cy, uint32 color) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_line: STUB\n");
}
void guac_rdp_ui_rect(rdpInst* inst, int x, int y, int cx, int cy, uint32 color) { guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
@ -316,24 +300,9 @@ void guac_rdp_ui_rect(rdpInst* inst, int x, int y, int cx, int cy, uint32 color)
} }
void guac_rdp_ui_polygon(rdpInst* inst, uint8 opcode, uint8 fillmode, RD_POINT* point, int npoints, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) { void guac_rdp_ui_start_draw_glyphs(freerdp* inst, uint32 bgcolor, uint32 fgcolor) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_polygon: STUB\n");
}
void guac_rdp_ui_polyline(rdpInst* inst, uint8 opcode, RD_POINT* points, int npoints, RD_PEN* pen) { guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_polyline: STUB\n");
}
void guac_rdp_ui_ellipse(rdpInst* inst, uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_ellipse: STUB\n");
}
void guac_rdp_ui_start_draw_glyphs(rdpInst* inst, uint32 bgcolor, uint32 fgcolor) {
guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
guac_rdp_convert_color( guac_rdp_convert_color(
@ -348,9 +317,9 @@ void guac_rdp_ui_start_draw_glyphs(rdpInst* inst, uint32 bgcolor, uint32 fgcolor
} }
void guac_rdp_ui_draw_glyph(rdpInst* inst, int x, int y, int width, int height, RD_HGLYPH glyph) { void guac_rdp_ui_draw_glyph(freerdp* inst, int x, int y, int width, int height, rdpGlyph* glyph) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
@ -359,7 +328,7 @@ void guac_rdp_ui_draw_glyph(rdpInst* inst, int x, int y, int width, int height,
/* Temporarily removed BG drawing... */ /* Temporarily removed BG drawing... */
/* Foreground */ /* Foreground */
guac_protocol_send_rect(socket, GUAC_COMP_ATOP, glyph, guac_protocol_send_rect(socket, GUAC_COMP_ATOP, (guac_layer*) glyph,
0, 0, width, height, 0, 0, width, height,
guac_client_data->foreground.red, guac_client_data->foreground.red,
guac_client_data->foreground.green, guac_client_data->foreground.green,
@ -381,34 +350,23 @@ void guac_rdp_ui_draw_glyph(rdpInst* inst, int x, int y, int width, int height,
} }
void guac_rdp_ui_end_draw_glyphs(rdpInst* inst, int x, int y, int cx, int cy) { void guac_rdp_ui_end_draw_glyphs(freerdp* inst, int x, int y, int cx, int cy) {
/* UNUSED */ /* UNUSED */
} }
uint32 guac_rdp_ui_get_toggle_keys_state(rdpInst* inst) { void guac_rdp_ui_destblt(freerdp* inst, uint8 opcode, int x, int y, int cx, int cy) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_get_toggle_keys_state: STUB\n");
return 0;
}
void guac_rdp_ui_bell(rdpInst* inst) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_bell: STUB\n");
}
void guac_rdp_ui_destblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_destblt: STUB\n"); guac_client_log_info(client, "guac_rdp_ui_destblt: STUB\n");
} }
void guac_rdp_ui_patblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) { void guac_rdp_ui_patblt(freerdp* inst, uint8 opcode, int x, int y, int cx, int cy, rdpBrush* brush, uint32 bgcolor, uint32 fgcolor) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_patblt: STUB\n"); guac_client_log_info(client, "guac_rdp_ui_patblt: STUB\n");
} }
void guac_rdp_ui_screenblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy) { void guac_rdp_ui_screenblt(freerdp* inst, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
@ -419,9 +377,9 @@ void guac_rdp_ui_screenblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, in
} }
void guac_rdp_ui_memblt(rdpInst* inst, uint8 opcode, int x, int y, int width, int height, RD_HBITMAP src, int srcx, int srcy) { void guac_rdp_ui_memblt(freerdp* inst, uint8 opcode, int x, int y, int width, int height, rdpBitmap* src, int srcx, int srcy) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
@ -437,15 +395,15 @@ void guac_rdp_ui_memblt(rdpInst* inst, uint8 opcode, int x, int y, int width, in
} }
void guac_rdp_ui_triblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) { void guac_rdp_ui_triblt(freerdp* inst, uint8 opcode, int x, int y, int cx, int cy, rdpBitmap* src, int srcx, int srcy, rdpBrush* brush, uint32 bgcolor, uint32 fgcolor) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_triblt: STUB\n"); guac_client_log_info(client, "guac_rdp_ui_triblt: STUB\n");
} }
RD_HGLYPH guac_rdp_ui_create_glyph(rdpInst* inst, int width, int height, uint8* data) { rdpGlyph* guac_rdp_ui_create_glyph(freerdp* inst, int width, int height, uint8* data) {
/* Allocate buffer */ /* Allocate buffer */
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
guac_layer* glyph = guac_client_alloc_buffer(client); guac_layer* glyph = guac_client_alloc_buffer(client);
@ -501,25 +459,25 @@ RD_HGLYPH guac_rdp_ui_create_glyph(rdpInst* inst, int width, int height, uint8*
free(image_buffer); free(image_buffer);
return (RD_HGLYPH) glyph; return (rdpGlyph*) glyph;
} }
void guac_rdp_ui_destroy_glyph(rdpInst* inst, RD_HGLYPH glyph) { void guac_rdp_ui_destroy_glyph(freerdp* inst, rdpGlyph* glyph) {
/* Free buffer */ /* Free buffer */
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_free_buffer(client, (guac_layer*) glyph); guac_client_free_buffer(client, (guac_layer*) glyph);
} }
int guac_rdp_ui_select(rdpInst* inst, int rdp_socket) { int guac_rdp_ui_select(freerdp* inst, int rdp_socket) {
return 1; return 1;
} }
void guac_rdp_ui_set_clip(rdpInst* inst, int x, int y, int cx, int cy) { void guac_rdp_ui_set_clip(freerdp* inst, int x, int y, int cx, int cy) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
@ -528,9 +486,9 @@ void guac_rdp_ui_set_clip(rdpInst* inst, int x, int y, int cx, int cy) {
} }
void guac_rdp_ui_reset_clip(rdpInst* inst) { void guac_rdp_ui_reset_clip(freerdp* inst) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
@ -539,56 +497,45 @@ void guac_rdp_ui_reset_clip(rdpInst* inst) {
} }
void guac_rdp_ui_resize_window(rdpInst* inst) { void guac_rdp_ui_resize_window(freerdp* inst) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_resize_window: %ix%i\n", inst->settings->width, inst->settings->height); guac_client_log_info(client, "guac_rdp_ui_resize_window: %ix%i\n", inst->settings->width, inst->settings->height);
} }
void guac_rdp_ui_set_cursor(rdpInst* inst, RD_HCURSOR cursor) { void guac_rdp_ui_set_cursor(freerdp* inst, rdpPointer* cursor) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_set_cursor: STUB\n"); guac_client_log_info(client, "guac_rdp_ui_set_cursor: STUB\n");
} }
void guac_rdp_ui_destroy_cursor(rdpInst* inst, RD_HCURSOR cursor) { void guac_rdp_ui_destroy_cursor(freerdp* inst, rdpPointer* cursor) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_destroy_cursor: STUB\n"); guac_client_log_info(client, "guac_rdp_ui_destroy_cursor: STUB\n");
} }
RD_HCURSOR guac_rdp_ui_create_cursor(rdpInst* inst, unsigned int x, unsigned int y, int width, int height, uint8* andmask, uint8* xormask, int bpp) { rdpPointer* guac_rdp_ui_create_cursor(freerdp* inst, unsigned int x, unsigned int y, int width, int height, uint8* andmask, uint8* xormask, int bpp) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_create_cursor: STUB\n"); guac_client_log_info(client, "guac_rdp_ui_create_cursor: STUB\n");
return guac_client_alloc_buffer(client); return (rdpPointer*) guac_client_alloc_buffer(client);
} }
void guac_rdp_ui_set_null_cursor(rdpInst* inst) { void guac_rdp_ui_set_null_cursor(freerdp* inst) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_set_null_cursor: STUB\n"); guac_client_log_info(client, "guac_rdp_ui_set_null_cursor: STUB\n");
} }
void guac_rdp_ui_set_default_cursor(rdpInst* inst) { void guac_rdp_ui_set_default_cursor(freerdp* inst) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_set_default_cursor: STUB\n"); guac_client_log_info(client, "guac_rdp_ui_set_default_cursor: STUB\n");
} }
RD_HPALETTE guac_rdp_ui_create_colormap(rdpInst* inst, RD_PALETTE* colors) { void guac_rdp_ui_move_pointer(freerdp* inst, int x, int y) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_log_info(client, "guac_rdp_ui_create_colormap: STUB\n");
return NULL;
}
void guac_rdp_ui_move_pointer(rdpInst* inst, int x, int y) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_move_pointer: STUB\n"); guac_client_log_info(client, "guac_rdp_ui_move_pointer: STUB\n");
} }
void guac_rdp_ui_set_colormap(rdpInst* inst, RD_HPALETTE map) { rdpBitmap* guac_rdp_ui_create_surface(freerdp* inst, int width, int height, rdpBitmap* old) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_set_colormap: STUB\n");
}
RD_HBITMAP guac_rdp_ui_create_surface(rdpInst* inst, int width, int height, RD_HBITMAP old) {
/* If old provided, just return that one ... */ /* If old provided, just return that one ... */
if (old != NULL) if (old != NULL)
@ -596,15 +543,15 @@ RD_HBITMAP guac_rdp_ui_create_surface(rdpInst* inst, int width, int height, RD_H
/* Otherwise allocate and return new buffer */ /* Otherwise allocate and return new buffer */
else { else {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
return (RD_HBITMAP) guac_client_alloc_buffer(client); return (rdpBitmap*) guac_client_alloc_buffer(client);
} }
} }
void guac_rdp_ui_set_surface(rdpInst* inst, RD_HBITMAP surface) { void guac_rdp_ui_set_surface(freerdp* inst, rdpBitmap* surface) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
@ -620,32 +567,16 @@ void guac_rdp_ui_set_surface(rdpInst* inst, RD_HBITMAP surface) {
guac_client_data->current_surface = GUAC_DEFAULT_LAYER; guac_client_data->current_surface = GUAC_DEFAULT_LAYER;
} }
else { else {
guac_client_data->current_surface = surface; guac_client_data->current_surface = (guac_layer*) surface;
} }
} }
void guac_rdp_ui_destroy_surface(rdpInst* inst, RD_HBITMAP surface) { void guac_rdp_ui_destroy_surface(freerdp* inst, rdpBitmap* surface) {
/* Free buffer */ /* Free buffer */
guac_client* client = (guac_client*) inst->param1; guac_client* client = ((rdp_freerdp_context*) inst->context)->client;
guac_client_free_buffer(client, (guac_layer*) surface); guac_client_free_buffer(client, (guac_layer*) surface);
} }
void guac_rdp_ui_channel_data(rdpInst* inst, int chan_id, char* data, int data_size, int flags, int total_size) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_channel_data: STUB\n");
}
RD_HPALETTE guac_rdp_ui_create_palette(rdpInst* inst, RD_PALETTE* colours) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_create_palette: STUB\n");
return NULL;
}
void guac_rdp_ui_set_palette(rdpInst* inst, RD_HPALETTE map) {
guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_set_palette: STUB\n");
}