#include <freerdp/chanman.h>
#include <freerdp/constants/core.h>
-#include <guacamole/log.h>
-#include <guacamole/guacio.h>
+#include <guacamole/socket.h>
#include <guacamole/protocol.h>
#include <guacamole/client.h>
/* get rdp fds */
if (rdp_inst->rdp_get_fds(rdp_inst, read_fds, &read_count, write_fds, &write_count) != 0) {
- guac_log_error("Unable to read RDP file descriptors.");
+ guac_client_log_error(client, "Unable to read RDP file descriptors.");
return 1;
}
/* get channel fds */
if (freerdp_chanman_get_fds(chanman, rdp_inst, read_fds, &read_count, write_fds, &write_count) != 0) {
- guac_log_error("Unable to read RDP channel file descriptors.");
+ guac_client_log_error(client, "Unable to read RDP channel file descriptors.");
return 1;
}
/* If no file descriptors, error */
if (max_fd == 0) {
- guac_log_error("No file descriptors");
+ guac_client_log_error(client, "No file descriptors");
return 1;
}
(errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */
{
- guac_log_error("Error waiting for file descriptor.");
+ guac_client_log_error(client, "Error waiting for file descriptor.");
return 1;
}
}
/* check the libfreerdp fds */
if (rdp_inst->rdp_check_fds(rdp_inst) != 0) {
- guac_log_error("Error handling RDP file descriptors.");
+ guac_client_log_error(client, "Error handling RDP file descriptors.");
return 1;
}
/* check channel fds */
if (freerdp_chanman_check_fds(chanman, rdp_inst) != 0) {
- guac_log_error("Error handling RDP channel file descriptors.");
+ guac_client_log_error(client, "Error handling RDP channel file descriptors.");
return 1;
}
int port = RDP_DEFAULT_PORT;
if (argc < 2) {
- guac_send_error(client->io, "Wrong argument count received.");
- guac_flush(client->io);
+ guac_protocol_send_error(client->socket, "Wrong argument count received.");
+ guac_socket_flush(client->socket);
return 1;
}
/* Init client */
rdp_inst = freerdp_new(settings);
if (rdp_inst == NULL) {
- guac_send_error(client->io, "Error initializing RDP client");
- guac_flush(client->io);
+ guac_protocol_send_error(client->socket, "Error initializing RDP client");
+ guac_socket_flush(client->socket);
return 1;
}
guac_client_data->rdp_inst = rdp_inst;
/* Init chanman (pre-connect) */
if (freerdp_chanman_pre_connect(chanman, rdp_inst)) {
- guac_send_error(client->io, "Error initializing RDP client channel manager");
- guac_flush(client->io);
+ 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_send_error(client->io, "Error connecting to RDP server");
- guac_flush(client->io);
+ 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_send_error(client->io, "Error initializing RDP client channel manager");
- guac_flush(client->io);
+ guac_protocol_send_error(client->socket, "Error initializing RDP client channel manager");
+ guac_socket_flush(client->socket);
return 1;
}
keymap->flags & KBDFLAGS_EXTENDED,
keymap->scancode);
else
- guac_log_info("unmapped keysym: 0x%x", keysym);
+ guac_client_log_info(client, "unmapped keysym: 0x%x", keysym);
}
#include <cairo/cairo.h>
-#include <guacamole/log.h>
-#include <guacamole/guacio.h>
+#include <guacamole/socket.h>
#include <guacamole/client.h>
#include <guacamole/protocol.h>
void guac_rdp_ui_error(rdpInst* inst, const char* text) {
guac_client* client = (guac_client*) inst->param1;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
- guac_send_error(io, text);
- guac_flush(io);
+ guac_protocol_send_error(socket, text);
+ guac_socket_flush(socket);
}
void guac_rdp_ui_warning(rdpInst* inst, const char* text) {
- guac_log_info("guac_rdp_ui_warning: %s\n", text);
+ guac_client* client = (guac_client*) inst->param1;
+ guac_client_log_info(client, "guac_rdp_ui_warning: %s\n", text);
}
void guac_rdp_ui_unimpl(rdpInst* inst, const char* text) {
- guac_log_info("guac_rdp_ui_unimpl: %s\n", text);
+ guac_client* client = (guac_client*) inst->param1;
+ guac_client_log_info(client, "guac_rdp_ui_unimpl: %s\n", text);
}
void guac_rdp_ui_begin_update(rdpInst* inst) {
void guac_rdp_ui_end_update(rdpInst* inst) {
guac_client* client = (guac_client*) inst->param1;
- GUACIO* io = client->io;
- guac_flush(io);
+ guac_socket* socket = client->socket;
+ guac_socket_flush(socket);
}
void guac_rdp_ui_desktop_save(rdpInst* inst, int offset, int x, int y, int cx, int cy) {
- guac_log_info("guac_rdp_ui_desktop_save: STUB\n");
+ 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_log_info("guac_rdp_ui_desktop_restore: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ guac_client_log_info(client, "guac_rdp_ui_desktop_restore: STUB\n");
}
/* Allocate buffer */
guac_client* client = (guac_client*) inst->param1;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
guac_layer* buffer = guac_client_alloc_buffer(client);
int x, y;
}
surface = cairo_image_surface_create_for_data(image_buffer, CAIRO_FORMAT_RGB24, width, height, stride);
- guac_send_png(io, GUAC_COMP_SRC, buffer, 0, 0, surface);
- guac_flush(io);
+ guac_protocol_send_png(socket, GUAC_COMP_SRC, buffer, 0, 0, surface);
+ guac_socket_flush(socket);
/* Free surface */
cairo_surface_destroy(surface);
guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
int dx, dy;
int stride;
}
surface = cairo_image_surface_create_for_data(image_buffer, CAIRO_FORMAT_RGB24, cx, cy, stride);
- guac_send_png(io, GUAC_COMP_OVER, current_surface, x, y, surface);
- guac_flush(io);
+ guac_protocol_send_png(socket, GUAC_COMP_OVER, current_surface, x, y, surface);
+ guac_socket_flush(socket);
/* Free surface */
cairo_surface_destroy(surface);
}
void guac_rdp_ui_line(rdpInst* inst, uint8 opcode, int startx, int starty, int endx, int endy, RD_PEN* pen) {
- guac_log_info("guac_rdp_ui_line: STUB\n");
+ 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 = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
unsigned char red, green, blue;
}
/* Send rectangle */
- guac_send_rect(io, GUAC_COMP_OVER, current_surface,
+ guac_protocol_send_rect(socket, GUAC_COMP_OVER, current_surface,
x, y, cx, cy,
red, green, blue, 0xFF);
}
void guac_rdp_ui_polygon(rdpInst* inst, uint8 opcode, uint8 fillmode, RD_POINT* point, int npoints, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) {
- guac_log_info("guac_rdp_ui_polygon: STUB\n");
+ 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_log_info("guac_rdp_ui_polyline: STUB\n");
+ 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_log_info("guac_rdp_ui_ellipse: STUB\n");
+ 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;
const guac_layer* current_surface = guac_client_data->current_surface;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
/* NOTE: Originally: Stencil=SRC, FG=ATOP, BG=RATOP */
/* Temporarily removed BG drawing... */
/* Foreground */
- guac_send_rect(io, GUAC_COMP_ATOP, glyph,
+ guac_protocol_send_rect(socket, GUAC_COMP_ATOP, glyph,
0, 0, width, height,
guac_client_data->foreground.red,
guac_client_data->foreground.green,
255);
/* Background */
- /*guac_send_rect(io, GUAC_COMP_OVER, current_surface,
+ /*guac_protocol_send_rect(socket, GUAC_COMP_OVER, current_surface,
x, y, width, height,
guac_client_data->background.red,
guac_client_data->background.green,
255);*/
/* Draw */
- guac_send_copy(io,
+ guac_protocol_send_copy(socket,
(guac_layer*) glyph, 0, 0, width, height,
GUAC_COMP_OVER, current_surface, x, y);
}
uint32 guac_rdp_ui_get_toggle_keys_state(rdpInst* inst) {
- guac_log_info("guac_rdp_ui_get_toggle_keys_state: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ guac_client_log_info(client, "guac_rdp_ui_get_toggle_keys_state: STUB\n");
return 0;
}
void guac_rdp_ui_bell(rdpInst* inst) {
- guac_log_info("guac_rdp_ui_bell: STUB\n");
+ 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_log_info("guac_rdp_ui_destblt: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ 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) {
- guac_log_info("guac_rdp_ui_patblt: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ 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) {
guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
- guac_send_copy(io,
+ guac_protocol_send_copy(socket,
GUAC_DEFAULT_LAYER, srcx, srcy, cx, cy,
GUAC_COMP_OVER, current_surface, x, y);
guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
if (opcode != 204)
- guac_log_info("guac_rdp_ui_memblt: opcode=%i, index=%i\n", opcode,
+ guac_client_log_info(client,
+ "guac_rdp_ui_memblt: opcode=%i, index=%i\n", opcode,
((guac_layer*) src)->index);
- guac_send_copy(io,
+ guac_protocol_send_copy(socket,
(guac_layer*) src, srcx, srcy, width, height,
GUAC_COMP_OVER, current_surface, x, y);
}
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) {
- guac_log_info("guac_rdp_ui_triblt: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ 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) {
/* Allocate buffer */
guac_client* client = (guac_client*) inst->param1;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
guac_layer* glyph = guac_client_alloc_buffer(client);
int x, y, i;
}
surface = cairo_image_surface_create_for_data(image_buffer, CAIRO_FORMAT_ARGB32, width, height, stride);
- guac_send_png(io, GUAC_COMP_SRC, glyph, 0, 0, surface);
- guac_flush(io);
+ guac_protocol_send_png(socket, GUAC_COMP_SRC, glyph, 0, 0, surface);
+ guac_socket_flush(socket);
/* Free surface */
cairo_surface_destroy(surface);
guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
- guac_send_clip(io, current_surface, x, y, cx, cy);
+ guac_protocol_send_clip(socket, current_surface, x, y, cx, cy);
}
guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
- guac_send_clip(io, current_surface, 0, 0, inst->settings->width, inst->settings->height);
+ guac_protocol_send_clip(socket, current_surface, 0, 0, inst->settings->width, inst->settings->height);
}
void guac_rdp_ui_resize_window(rdpInst* inst) {
- guac_log_info("guac_rdp_ui_resize_window: %ix%i\n", inst->settings->width, inst->settings->height);
+ guac_client* client = (guac_client*) inst->param1;
+ 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) {
- guac_log_info("guac_rdp_ui_set_cursor: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ guac_client_log_info(client, "guac_rdp_ui_set_cursor: STUB\n");
}
void guac_rdp_ui_destroy_cursor(rdpInst* inst, RD_HCURSOR cursor) {
- guac_log_info("guac_rdp_ui_destroy_cursor: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ 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) {
guac_client* client = (guac_client*) inst->param1;
- guac_log_info("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);
}
void guac_rdp_ui_set_null_cursor(rdpInst* inst) {
- guac_log_info("guac_rdp_ui_set_null_cursor: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ guac_client_log_info(client, "guac_rdp_ui_set_null_cursor: STUB\n");
}
void guac_rdp_ui_set_default_cursor(rdpInst* inst) {
- guac_log_info("guac_rdp_ui_set_default_cursor: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ 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) {
- guac_log_info("guac_rdp_ui_create_colormap: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ 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_log_info("guac_rdp_ui_move_pointer: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ guac_client_log_info(client, "guac_rdp_ui_move_pointer: STUB\n");
}
void guac_rdp_ui_set_colormap(rdpInst* inst, RD_HPALETTE map) {
- guac_log_info("guac_rdp_ui_set_colormap: STUB\n");
+ 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) {
guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
- GUACIO* io = client->io;
+ guac_socket* socket = client->socket;
- guac_log_info("guac_rdp_ui_set_surface: %p (index=%i)\n", surface, surface != NULL ? ((guac_layer*) surface)->index : 0);
+ guac_client_log_info(client, "guac_rdp_ui_set_surface: %p (index=%i)\n", surface, surface != NULL ? ((guac_layer*) surface)->index : 0);
/* Init desktop */
if (surface == NULL) {
- guac_send_name(io, inst->settings->server);
- guac_send_size(io, inst->settings->width, inst->settings->height);
- guac_flush(io);
+ guac_protocol_send_name(socket, inst->settings->server);
+ guac_protocol_send_size(socket, inst->settings->width, inst->settings->height);
+ guac_socket_flush(socket);
guac_client_data->current_surface = GUAC_DEFAULT_LAYER;
}
}
void guac_rdp_ui_channel_data(rdpInst* inst, int chan_id, char* data, int data_size, int flags, int total_size) {
- guac_log_info("guac_rdp_ui_channel_data: STUB\n");
+ 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_log_info("guac_rdp_ui_create_palette: STUB\n");
+ 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_log_info("guac_rdp_ui_set_palette: STUB\n");
+ guac_client* client = (guac_client*) inst->param1;
+ guac_client_log_info(client, "guac_rdp_ui_set_palette: STUB\n");
}