Actual calls to freerdp functions

This commit is contained in:
Michael Jumper 2011-03-25 22:49:48 -07:00
parent fb953b0892
commit ff6d6fc404
2 changed files with 77 additions and 2 deletions

View File

@ -46,6 +46,7 @@ AC_PROG_LIBTOOL
AC_CHECK_LIB([guac], [guac_get_client],, AC_MSG_ERROR("libguac is required for communication via the guacamole protocol"))
AC_CHECK_LIB([png], [png_write_png],, AC_MSG_ERROR("libpng is required for writing png messages"))
AC_CHECK_LIB([freerdp], [freerdp_new],, AC_MSG_ERROR("libfreerdp is required"))
AC_CHECK_LIB([freerdpchanman], [freerdp_chanman_new],, AC_MSG_ERROR("libfreerdp is required"))
# Checks for header files.
AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h])

View File

@ -35,12 +35,19 @@
*
* ***** END LICENSE BLOCK ***** */
#include <stdlib.h>
#include <string.h>
#include <freerdp/freerdp.h>
#include <freerdp/chanman.h>
#include <guacamole/log.h>
#include <guacamole/guacio.h>
#include <guacamole/protocol.h>
#include <guacamole/client.h>
#define RDP_DEFAULT_PORT 3389
/* Client plugin arguments */
const char* GUAC_CLIENT_ARGS[] = {
"hostname",
@ -50,10 +57,77 @@ const char* GUAC_CLIENT_ARGS[] = {
int guac_client_init(guac_client* client, int argc, char** argv) {
rdpInst* rdp_inst;
rdpChanMan* chanman;
rdpSet* settings;
char* hostname;
int port = RDP_DEFAULT_PORT;
if (argc < 2) {
guac_send_error(client->io, "Wrong argument count received.");
guac_flush(client->io);
return 1;
}
/* If port specified, use it */
if (argv[1][0] != '\0')
port = atoi(argv[1]);
hostname = argv[0];
/* Get channel manager */
chanman = freerdp_chanman_new();
/* INIT SETTINGS */
settings = malloc(sizeof(rdpSet));
memset(settings, 0, sizeof(rdpSet));
/* 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->rdp5_performanceflags =
RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS;
settings->off_screen_bitmaps = 1;
settings->triblt = 0;
settings->new_cursors = 1;
settings->rdp_version = 5;
/* Init chanman here? */
/* Init client */
rdp_inst = freerdp_new(settings);
if (rdp_inst == NULL) {
guac_send_error(client->io, "Error initializing RDP client");
guac_flush(client->io);
return 1;
}
/* freerdp_chanman_pre_connect ? */
/* rdp_inst->rdp_connect(rdp_inst) */
/* rdp_inst->rdp_disconnect(rdp_inst) */
/* freerdp_chanman_post_connect ? */
freerdp_free(rdp_inst);
freerdp_chanman_free(chanman);
free(settings);
/* STUB */
guac_send_error(client->io, "STUB");
return -1;
return 1;
}