Test for VNC repeater support and cairo_format_stride_for_width().

This commit is contained in:
Michael Jumper 2013-07-08 13:03:04 -07:00
parent e6ec853edb
commit 0f609cb666
4 changed files with 69 additions and 11 deletions

View File

@ -72,7 +72,8 @@ AC_SUBST(CUNIT_LIBS)
# Library functions # Library functions
AC_FUNC_MALLOC AC_FUNC_MALLOC
AC_FUNC_REALLOC AC_FUNC_REALLOC
AC_CHECK_FUNCS([clock_gettime gettimeofday memmove memset select strdup png_get_io_ptr nanosleep]) AC_CHECK_FUNCS([clock_gettime gettimeofday memmove memset select strdup png_get_io_ptr \
cairo_format_stride_for_width nanosleep])
# Typedefs # Typedefs
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
@ -134,6 +135,31 @@ AM_CONDITIONAL([ENABLE_VNC], [test "x${have_libvncserver}" = "xyes"])
AC_SUBST(VNC_LIBS) AC_SUBST(VNC_LIBS)
#
# Repeater support within libVNCServer
#
if test "x${have_libvncserver}" = "xyes"
then
have_vnc_repeater=yes
AC_CHECK_MEMBERS([rfbClient.destHost, rfbClient.destPort],
[], [have_vnc_repeater=no],
[[#include <rfb/rfbclient.h>]])
if test "x${have_vnc_repeater}" = "xno"
then
AC_MSG_WARN([
--------------------------------------------
No repeater support found in libvncclient.
Support for VNC repeaters will not be built.
--------------------------------------------])
else
AC_DEFINE([ENABLE_VNC_REPEATER])
fi
fi
# #
# FreeRDP # FreeRDP
# #

View File

@ -45,6 +45,11 @@
#include "client.h" #include "client.h"
#include "rdp_glyph.h" #include "rdp_glyph.h"
/* Define cairo_format_stride_for_width() if missing */
#ifndef HAVE_CAIRO_FORMAT_STRIDE_FOR_WIDTH
#define cairo_format_stride_for_width(format, width) (width*4)
#endif
void guac_rdp_glyph_new(rdpContext* context, rdpGlyph* glyph) { void guac_rdp_glyph_new(rdpContext* context, rdpGlyph* glyph) {
int x, y, i; int x, y, i;

View File

@ -57,11 +57,30 @@ const char* GUAC_CLIENT_ARGS[] = {
"password", "password",
"swap-red-blue", "swap-red-blue",
"color-depth", "color-depth",
#ifdef ENABLE_VNC_REPEATER
"dest-host", "dest-host",
"dest-port", "dest-port",
#endif
NULL NULL
}; };
enum VNC_ARGS_IDX {
IDX_HOSTNAME,
IDX_PORT,
IDX_READ_ONLY,
IDX_ENCODINGS,
IDX_PASSWORD,
IDX_SWAP_RED_BLUE,
IDX_COLOR_DEPTH,
#ifdef ENABLE_VNC_REPEATER
IDX_DEST_HOST,
IDX_DEST_PORT,
#endif
VNC_ARGS_COUNT
};
char* __GUAC_CLIENT = "GUAC_CLIENT"; char* __GUAC_CLIENT = "GUAC_CLIENT";
int guac_client_init(guac_client* client, int argc, char** argv) { int guac_client_init(guac_client* client, int argc, char** argv) {
@ -78,7 +97,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/*** PARSE ARGUMENTS ***/ /*** PARSE ARGUMENTS ***/
if (argc < 9) { if (argc != VNC_ARGS_COUNT) {
guac_protocol_send_error(client->socket, "Wrong argument count received."); guac_protocol_send_error(client->socket, "Wrong argument count received.");
guac_socket_flush(client->socket); guac_socket_flush(client->socket);
return 1; return 1;
@ -89,13 +108,13 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
client->data = guac_client_data; client->data = guac_client_data;
/* Set read-only flag */ /* Set read-only flag */
read_only = (strcmp(argv[2], "true") == 0); read_only = (strcmp(argv[IDX_READ_ONLY], "true") == 0);
/* Set red/blue swap flag */ /* Set red/blue swap flag */
guac_client_data->swap_red_blue = (strcmp(argv[5], "true") == 0); guac_client_data->swap_red_blue = (strcmp(argv[IDX_SWAP_RED_BLUE], "true") == 0);
/* Freed after use by libvncclient */ /* Freed after use by libvncclient */
guac_client_data->password = strdup(argv[4]); guac_client_data->password = strdup(argv[IDX_PASSWORD]);
/*** INIT RFB CLIENT ***/ /*** INIT RFB CLIENT ***/
@ -133,16 +152,19 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
rfb_client->serverHost = strdup(argv[0]); rfb_client->serverHost = strdup(argv[0]);
rfb_client->serverPort = atoi(argv[1]); rfb_client->serverPort = atoi(argv[1]);
#ifdef ENABLE_VNC_REPEATER
/* Set repeater parameters if specified */ /* Set repeater parameters if specified */
if(argv[7][0] != '\0') if(argv[IDX_DEST_HOST][0] != '\0')
rfb_client->destHost = strdup(argv[7]); rfb_client->destHost = strdup(argv[IDX_DEST_HOST]);
if(argv[8][0] != '\0') if(argv[IDX_DEST_PORT][0] != '\0')
rfb_client->destPort = atoi(argv[8]); rfb_client->destPort = atoi(argv[IDX_DEST_PORT]);
#endif
/* Set encodings if specified */ /* Set encodings if specified */
if (argv[3][0] != '\0') if (argv[IDX_ENCODINGS][0] != '\0')
rfb_client->appData.encodingsString = guac_client_data->encodings = strdup(argv[3]); rfb_client->appData.encodingsString = guac_client_data->encodings
= strdup(argv[IDX_ENCODINGS]);
else else
guac_client_data->encodings = NULL; guac_client_data->encodings = NULL;

View File

@ -51,6 +51,11 @@
#include "client.h" #include "client.h"
#include "convert.h" #include "convert.h"
/* Define cairo_format_stride_for_width() if missing */
#ifndef HAVE_CAIRO_FORMAT_STRIDE_FOR_WIDTH
#define cairo_format_stride_for_width(format, width) (width*4)
#endif
void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) { void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) {
guac_client* gc = rfbClientGetClientData(client, __GUAC_CLIENT); guac_client* gc = rfbClientGetClientData(client, __GUAC_CLIENT);