[WIP]: Code cleanup

This commit is contained in:
Virtually Nick 2022-09-19 16:03:53 -04:00
parent 4dae4fe5c1
commit 2268df76a9
26 changed files with 306 additions and 262 deletions

View File

@ -33,13 +33,13 @@ guac_argv_callback guac_spice_argv_callback;
/** /**
* The name of the parameter Guacamole will use to specify/update the username * The name of the parameter Guacamole will use to specify/update the username
* for the SPICE connection. * for the Spice connection.
*/ */
#define GUAC_SPICE_ARGV_USERNAME "username" #define GUAC_SPICE_ARGV_USERNAME "username"
/** /**
* The name of the parameter Guacamole will use to specify/update the password * The name of the parameter Guacamole will use to specify/update the password
* for the SPICE connection. * for the Spice connection.
*/ */
#define GUAC_SPICE_ARGV_PASSWORD "password" #define GUAC_SPICE_ARGV_PASSWORD "password"

View File

@ -27,14 +27,14 @@
#include <glib-unix.h> #include <glib-unix.h>
/** /**
* Handler invoked when an authentication error is received from the SPICE * Handler invoked when an authentication error is received from the Spice
* server, which retrieves the credentials from the Guacamole Client accessing * server, which retrieves the credentials from the Guacamole Client accessing
* the connection, if those credentials have not been explicitly set in the * the connection, if those credentials have not been explicitly set in the
* configuration. Returns TRUE if credentials are successfully retrieved, or * configuration. Returns TRUE if credentials are successfully retrieved, or
* FALSE otherwise. * FALSE otherwise.
* *
* @param client * @param client
* The guac_client that is attempting to connect to the SPICE server and * The guac_client that is attempting to connect to the Spice server and
* that will be asked for the credentials. * that will be asked for the credentials.
* *
* @return * @return

View File

@ -32,9 +32,7 @@ void guac_spice_client_audio_playback_data_handler(
SpicePlaybackChannel* channel, gpointer data, gint size, SpicePlaybackChannel* channel, gpointer data, gint size,
guac_client* client) { guac_client* client) {
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback data handler.");
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
guac_audio_stream_write_pcm(spice_client->audio_playback, data, size); guac_audio_stream_write_pcm(spice_client->audio_playback, data, size);
} }
@ -42,7 +40,8 @@ void guac_spice_client_audio_playback_data_handler(
void guac_spice_client_audio_playback_delay_handler( void guac_spice_client_audio_playback_delay_handler(
SpicePlaybackChannel* channel, guac_client* client) { SpicePlaybackChannel* channel, guac_client* client) {
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback delay handler."); guac_client_log(client, GUAC_LOG_WARNING,
"Delay handler for audio playback is not currently implemented.");
} }
@ -50,31 +49,30 @@ void guac_spice_client_audio_playback_start_handler(
SpicePlaybackChannel* channel, gint format, gint channels, gint rate, SpicePlaybackChannel* channel, gint format, gint channels, gint rate,
guac_client* client) { guac_client* client) {
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback start handler."); guac_client_log(client, GUAC_LOG_DEBUG, "Starting audio playback.");
guac_client_log(client, GUAC_LOG_DEBUG, "Format: %d", format); guac_client_log(client, GUAC_LOG_DEBUG, "Format: %d", format);
guac_client_log(client, GUAC_LOG_DEBUG, "Channels: %d", channels); guac_client_log(client, GUAC_LOG_DEBUG, "Channels: %d", channels);
guac_client_log(client, GUAC_LOG_DEBUG, "Rate: %d", rate); guac_client_log(client, GUAC_LOG_DEBUG, "Rate: %d", rate);
guac_spice_client* spice_client = (guac_spice_client*) client->data; /* Spice only supports a single audio format. */
int bps = 16;
if (format != SPICE_AUDIO_FMT_S16) { if (format != SPICE_AUDIO_FMT_S16) {
guac_client_log(client, GUAC_LOG_WARNING, "Unknown Spice audio format: %d", format); guac_client_log(client, GUAC_LOG_WARNING, "Unknown Spice audio format: %d", format);
return; return;
} }
spice_client->audio_playback = guac_audio_stream_alloc(client, NULL, rate, channels, bps); /* Allocate the stream. */
guac_spice_client* spice_client = (guac_spice_client*) client->data;
spice_client->audio_playback = guac_audio_stream_alloc(client, NULL, rate, channels, 16);
} }
void guac_spice_client_audio_playback_stop_handler( void guac_spice_client_audio_playback_stop_handler(
SpicePlaybackChannel* channel, guac_client* client) { SpicePlaybackChannel* channel, guac_client* client) {
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback stop handler."); guac_client_log(client, GUAC_LOG_DEBUG, "Stoppig audio playback..");
/* Free the audio stream. */
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
guac_audio_stream_free(spice_client->audio_playback); guac_audio_stream_free(spice_client->audio_playback);
} }
@ -110,14 +108,8 @@ static int guac_spice_audio_parse_mimetype(const char* mimetype, int* rate,
int parsed_channels = 1; int parsed_channels = 1;
int parsed_bps; int parsed_bps;
/* PCM audio with one byte per sample */
if (strncmp(mimetype, "audio/L8;", 9) == 0) {
mimetype += 8; /* Advance to semicolon ONLY */
parsed_bps = 1;
}
/* PCM audio with two bytes per sample */ /* PCM audio with two bytes per sample */
else if (strncmp(mimetype, "audio/L16;", 10) == 0) { if (strncmp(mimetype, "audio/L16;", 10) == 0) {
mimetype += 9; /* Advance to semicolon ONLY */ mimetype += 9; /* Advance to semicolon ONLY */
parsed_bps = 2; parsed_bps = 2;
} }
@ -175,6 +167,27 @@ static int guac_spice_audio_parse_mimetype(const char* mimetype, int* rate,
} }
/**
* A callback function that is invoked to send audio data from the given
* stream to the Spice server.
*
* @param user
* The user who owns the connection and the stream. This is unused by
* this function.
*
* @param stream
* The stream where the audio data originated. This is unused by this
* function.
*
* @param data
* The audio data to send.
*
* @param length
* The number of bytes of audio data to send.
*
* @return
* Zero on success, non-zero on error.
*/
static int guac_spice_audio_blob_handler(guac_user* user, guac_stream* stream, static int guac_spice_audio_blob_handler(guac_user* user, guac_stream* stream,
void* data, int length) { void* data, int length) {
@ -188,6 +201,19 @@ static int guac_spice_audio_blob_handler(guac_user* user, guac_stream* stream,
} }
/**
* A callback function that is called when the audio stream ends sending data
* to the Spice server.
*
* @param user
* The user who owns the connection and the stream.
*
* @param stream
* The stream that was sending the audio data.
*
* @return
* Zero on success, non-zero on failure.
*/
static int guac_spice_audio_end_handler(guac_user* user, guac_stream* stream) { static int guac_spice_audio_end_handler(guac_user* user, guac_stream* stream) {
/* Ignore - the RECORD_CHANNEL channel will simply not receive anything */ /* Ignore - the RECORD_CHANNEL channel will simply not receive anything */
@ -218,7 +244,7 @@ int guac_spice_client_audio_record_handler(guac_user* user, guac_stream* stream,
return 0; return 0;
} }
/* Init stream data */ /* Initialize stream handlers */
stream->blob_handler = guac_spice_audio_blob_handler; stream->blob_handler = guac_spice_audio_blob_handler;
stream->end_handler = guac_spice_audio_end_handler; stream->end_handler = guac_spice_audio_end_handler;
@ -253,7 +279,7 @@ int guac_spice_client_audio_record_handler(guac_user* user, guac_stream* stream,
static void guac_spice_audio_stream_ack(guac_user* user, guac_stream* stream, static void guac_spice_audio_stream_ack(guac_user* user, guac_stream* stream,
const char* message, guac_protocol_status status) { const char* message, guac_protocol_status status) {
/* Do not send ack unless both sides of the audio stream are ready */ /* Do not send if the connection owner or stream is null. */
if (user == NULL || stream == NULL) if (user == NULL || stream == NULL)
return; return;
@ -263,6 +289,20 @@ static void guac_spice_audio_stream_ack(guac_user* user, guac_stream* stream,
} }
/**
* A callback that is invoked for the connection owner when audio recording
* starts, which will notify the client the owner is connected from to start
* sending audio data.
*
* @param owner
* The owner of the connection.
*
* @param data
* A pointer to the guac_client associated with this connection.
*
* @return
* Always NULL;
*/
static void* spice_client_record_start_callback(guac_user* owner, void* data) { static void* spice_client_record_start_callback(guac_user* owner, void* data) {
guac_spice_client* spice_client = (guac_spice_client*) data; guac_spice_client* spice_client = (guac_spice_client*) data;
@ -274,6 +314,19 @@ static void* spice_client_record_start_callback(guac_user* owner, void* data) {
} }
/**
* A callback that is invoked for the connection owner when audio recording
* is stopped, telling the client to stop sending audio data.
*
* @param owner
* The user who owns this connection.
*
* @param data
* A pointer to the guac_client associated with this connection.
*
* @return
* Always NULL;
*/
static void* spice_client_record_stop_callback(guac_user* owner, void* data) { static void* spice_client_record_stop_callback(guac_user* owner, void* data) {
guac_spice_client* spice_client = (guac_spice_client*) data; guac_spice_client* spice_client = (guac_spice_client*) data;

View File

@ -28,7 +28,7 @@
/** /**
* A callback function invoked with the SPICE client receives audio playback * A callback function invoked with the SPICE client receives audio playback
* data from the SPICE server. * data from the Spice server.
* *
* @param channel * @param channel
* The SpicePlaybackChannel on which the data was sent. * The SpicePlaybackChannel on which the data was sent.
@ -47,7 +47,7 @@ void guac_spice_client_audio_playback_data_handler(
guac_client* client); guac_client* client);
/** /**
* A callback function invoked when the SPICE server requests the audio playback * A callback function invoked when the Spice server requests the audio playback
* delay value from the client. * delay value from the client.
* *
* @param channel * @param channel
@ -60,7 +60,7 @@ void guac_spice_client_audio_playback_delay_handler(
SpicePlaybackChannel* channel, guac_client* client); SpicePlaybackChannel* channel, guac_client* client);
/** /**
* A callback function invoked by the client when the SPICE server sends a * A callback function invoked by the client when the Spice server sends a
* signal indicating that it is starting an audio transmission. * signal indicating that it is starting an audio transmission.
* *
* @param channel * @param channel
@ -101,8 +101,8 @@ void guac_spice_client_audio_playback_stop_handler(
guac_user_audio_handler guac_spice_client_audio_record_handler; guac_user_audio_handler guac_spice_client_audio_record_handler;
/** /**
* The callback function invoked by the client when the SPICE server requests * The callback function invoked by the Spice client when the Spice server
* that the client begin recording audio data to send to the server. * requests that the client begin recording audio data to send to the server.
* *
* @param channel * @param channel
* The SpiceRecordChannel on which the record event is being requested. * The SpiceRecordChannel on which the record event is being requested.
@ -123,7 +123,7 @@ void guac_spice_client_audio_record_start_handler(SpiceRecordChannel* channel,
gint format, gint channels, gint rate, guac_client* client); gint format, gint channels, gint rate, guac_client* client);
/** /**
* The callback function invoked by the client when the SPICE server sends * The callback function invoked by the Spice client when the Spice server sends
* an event requesting that recording be stopped. * an event requesting that recording be stopped.
* *
* @param channel * @param channel

View File

@ -39,8 +39,8 @@ int guac_spice_clipboard_handler(guac_user* user, guac_stream* stream,
/* Some versions of VDAgent do not support sending clipboard data. */ /* Some versions of VDAgent do not support sending clipboard data. */
if (!spice_main_channel_agent_test_capability(spice_client->main_channel, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) { if (!spice_main_channel_agent_test_capability(spice_client->main_channel, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) {
guac_client_log(user->client, GUAC_LOG_WARNING, "SPICE Agent does not " guac_client_log(user->client, GUAC_LOG_WARNING, "Spice guest agent does"
" support sending clipboard data on demend."); " not support sending clipboard data on demand.");
return 0; return 0;
} }
@ -71,17 +71,13 @@ int guac_spice_clipboard_end_handler(guac_user* user, guac_stream* stream) {
guac_spice_client* spice_client = (guac_spice_client*) user->client->data; guac_spice_client* spice_client = (guac_spice_client*) user->client->data;
/* Send via VNC only if finished connecting */ /* Send via Spice only if finished connecting */
if (spice_client->main_channel != NULL) { if (spice_client->main_channel != NULL) {
spice_main_channel_clipboard_selection_notify(spice_client->main_channel, spice_main_channel_clipboard_selection_notify(spice_client->main_channel,
VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD,
VD_AGENT_CLIPBOARD_UTF8_TEXT, VD_AGENT_CLIPBOARD_UTF8_TEXT,
(const unsigned char*) spice_client->clipboard->buffer, (const unsigned char*) spice_client->clipboard->buffer,
spice_client->clipboard->length); spice_client->clipboard->length);
/* Release the grab on the agent clipboard. */
// spice_main_channel_clipboard_selection_release(spice_client->main_channel,
// VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD);
} }
return 0; return 0;
@ -93,6 +89,7 @@ void guac_spice_clipboard_selection_handler(SpiceMainChannel* channel,
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
/* Loop through clipboard types - currently Guacamole only supports text. */
switch (type) { switch (type) {
case VD_AGENT_CLIPBOARD_UTF8_TEXT: case VD_AGENT_CLIPBOARD_UTF8_TEXT:
guac_client_log(client, GUAC_LOG_DEBUG, "Notifying client of text " guac_client_log(client, GUAC_LOG_DEBUG, "Notifying client of text "
@ -125,15 +122,16 @@ void guac_spice_clipboard_selection_grab_handler(SpiceMainChannel* channel,
return; return;
} }
/* Loop through the data types sent by the SPICE server and process them. */ /* Loop through the data types sent by the Spice server and process them. */
for (int i = 0; i < ntypes; i++) { for (int i = 0; i < ntypes; i++) {
/* At present, Guacamole only supports text. */
/* Currently Guacamole only supports text. */
if (types[i] != VD_AGENT_CLIPBOARD_UTF8_TEXT) { if (types[i] != VD_AGENT_CLIPBOARD_UTF8_TEXT) {
guac_client_log(client, GUAC_LOG_WARNING, "Unsupported clipboard data type: %d", types[i]); guac_client_log(client, GUAC_LOG_WARNING, "Unsupported clipboard data type: %d", types[i]);
continue; continue;
} }
/* Reset our clipboard and request the data from the SPICE serer. */ /* Reset our clipboard and request the data from the Spice serer. */
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
guac_common_clipboard_reset(spice_client->clipboard, "text/plain"); guac_common_clipboard_reset(spice_client->clipboard, "text/plain");
spice_main_channel_clipboard_selection_request(channel, selection, types[i]); spice_main_channel_clipboard_selection_request(channel, selection, types[i]);
@ -149,6 +147,7 @@ void guac_spice_clipboard_selection_release_handler(SpiceMainChannel* channel,
guac_client_log(client, GUAC_LOG_DEBUG, "Notifying client of clipboard" guac_client_log(client, GUAC_LOG_DEBUG, "Notifying client of clipboard"
" release in the guest."); " release in the guest.");
/* Transfer data from guest to Guacamole clipboard. */
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
guac_common_clipboard_send(spice_client->clipboard, client); guac_common_clipboard_send(spice_client->clipboard, client);
@ -160,11 +159,13 @@ void guac_spice_clipboard_selection_request_handler(SpiceMainChannel* channel,
guac_client_log(client, GUAC_LOG_DEBUG, "Requesting clipboard data from" guac_client_log(client, GUAC_LOG_DEBUG, "Requesting clipboard data from"
" the client."); " the client.");
/* Guacamole only supports one clipboard selection type. */
if (selection != VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD) { if (selection != VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD) {
guac_client_log(client, GUAC_LOG_WARNING, "Unsupported selection type: %d", selection); guac_client_log(client, GUAC_LOG_WARNING, "Unsupported selection type: %d", selection);
return; return;
} }
/* Currently Guacamole only implements text support - other types are images. */
if (type != VD_AGENT_CLIPBOARD_UTF8_TEXT) { if (type != VD_AGENT_CLIPBOARD_UTF8_TEXT) {
guac_client_log(client, GUAC_LOG_WARNING, "Unsupported clipboard data type: %d", type); guac_client_log(client, GUAC_LOG_WARNING, "Unsupported clipboard data type: %d", type);
return; return;
@ -173,6 +174,7 @@ void guac_spice_clipboard_selection_request_handler(SpiceMainChannel* channel,
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
guac_client_log(client, GUAC_LOG_DEBUG, "Sending clipboard data to server: %s", spice_client->clipboard->buffer); guac_client_log(client, GUAC_LOG_DEBUG, "Sending clipboard data to server: %s", spice_client->clipboard->buffer);
/* Send the clipboard data to the guest. */
spice_main_channel_clipboard_selection_notify(channel, spice_main_channel_clipboard_selection_notify(channel,
selection, selection,
type, type,

View File

@ -43,11 +43,11 @@ guac_user_blob_handler guac_spice_clipboard_blob_handler;
guac_user_end_handler guac_spice_clipboard_end_handler; guac_user_end_handler guac_spice_clipboard_end_handler;
/** /**
* A handler that will be registered with the SPICE client to handle clipboard * A handler that will be registered with the Spice client to handle clipboard
* data sent from the SPICE server to the client. * data sent from the Spice server to the client.
* *
* @param channel * @param channel
* The main SPICE channel on which this event was fired. * The main Spice channel on which this event was fired.
* *
* @param selection * @param selection
* The clipboard on which the selection occurred. * The clipboard on which the selection occurred.
@ -70,15 +70,15 @@ void guac_spice_clipboard_selection_handler(SpiceMainChannel* channel,
guac_client* client); guac_client* client);
/** /**
* A handler that will be registered with the SPICE client to handle clipboard * A handler that will be registered with the Spice client to handle clipboard
* events where the guest (vdagent) within the SPICE server notifies the client * events where the guest (vdagent) within the Spice server notifies the client
* that data is available on the clipboard. * that data is available on the clipboard.
* *
* @param channel * @param channel
* The main SpiceChannel on which this event is fired. * The main SpiceChannel on which this event is fired.
* *
* @param selection * @param selection
* The SPICE clipboard from which the event is fired. * The Spice clipboard from which the event is fired.
* *
* @param types * @param types
* The type of data being sent by the agent. * The type of data being sent by the agent.
@ -93,14 +93,14 @@ void guac_spice_clipboard_selection_grab_handler(SpiceMainChannel* channel,
guint selection, guint32* types, guint ntypes, guac_client* client); guint selection, guint32* types, guint ntypes, guac_client* client);
/** /**
* A handler that will be called by the SPICE client when the SPICE server * A handler that will be called by the Spice client when the Spice server
* is done with the clipboard and releases control of it. * is done with the clipboard and releases control of it.
* *
* @param chennl * @param chennl
* The main SPICE channel on which this event is fired. * The main Spice channel on which this event is fired.
* *
* @param selection * @param selection
* The SPICE server clipboard releasing control. * The Spice server clipboard releasing control.
* *
* @param client * @param client
* The guac_client that was registered with the callback. * The guac_client that was registered with the callback.
@ -109,17 +109,17 @@ void guac_spice_clipboard_selection_release_handler(SpiceMainChannel* channel,
guint selection, guac_client* client); guint selection, guac_client* client);
/** /**
* A handler that will be called by the SPICE client when the SPICE server * A handler that will be called by the Spice client when the Spice server
* would like to check and receive the contents of the client's clipboard. * would like to check and receive the contents of the client's clipboard.
* *
* @param channel * @param channel
* The main SPICE channel on which this event is fired. * The main Spice channel on which this event is fired.
* *
* @param selection * @param selection
* The SPICE server clipboard that is requesting data. * The Spice server clipboard that is requesting data.
* *
* @param type * @param type
* The type of data to be sent to the SPICE server. * The type of data to be sent to the Spice server.
* *
* @param client * @param client
* The guac_client object that was registered with the callback. * The guac_client object that was registered with the callback.

View File

@ -33,11 +33,6 @@
#include <guacamole/socket.h> #include <guacamole/socket.h>
#include <spice-client-glib-2.0/spice-client.h> #include <spice-client-glib-2.0/spice-client.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
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
@ -46,8 +41,9 @@
void guac_spice_cursor_hide(SpiceChannel* channel, guac_client* client) { void guac_spice_cursor_hide(SpiceChannel* channel, guac_client* client) {
guac_client_log(client, GUAC_LOG_TRACE, "Cursor hide signal received."); guac_client_log(client, GUAC_LOG_TRACE, "Hiding the cursor.");
/* Set the cursor to a blank image, hiding it. */
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
guac_common_cursor_set_blank(spice_client->display->cursor); guac_common_cursor_set_blank(spice_client->display->cursor);
} }
@ -55,14 +51,16 @@ void guac_spice_cursor_hide(SpiceChannel* channel, guac_client* client) {
void guac_spice_cursor_move(SpiceChannel* channel, int x, int y, void guac_spice_cursor_move(SpiceChannel* channel, int x, int y,
guac_client* client) { guac_client* client) {
guac_client_log(client, GUAC_LOG_TRACE, "Cursor move signal received."); guac_client_log(client, GUAC_LOG_TRACE, "Cursor move signal received: %d, %d", x, y);
/* Update the cursor with the new coordinates. */
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
guac_common_cursor_update(spice_client->display->cursor, client->__owner, x, y, spice_client->display->cursor->button_mask); guac_common_cursor_update(spice_client->display->cursor, client->__owner, x, y, spice_client->display->cursor->button_mask);
} }
void guac_spice_cursor_reset(SpiceChannel* channel, guac_client* client) { void guac_spice_cursor_reset(SpiceChannel* channel, guac_client* client) {
guac_client_log(client, GUAC_LOG_DEBUG, "Cursor reset signal received, not yet implemented"); guac_client_log(client, GUAC_LOG_DEBUG,
"Cursor reset signal received, not yet implemented");
} }
void guac_spice_cursor_set(SpiceChannel* channel, int width, int height, void guac_spice_cursor_set(SpiceChannel* channel, int width, int height,

View File

@ -25,20 +25,20 @@
#include <spice-client-glib-2.0/spice-client.h> #include <spice-client-glib-2.0/spice-client.h>
/** /**
* The callback function that is executed when the cursor hide signal is received * The callback function that is executed when the cursor hide signal is
* from the SPICE server. * received from the Spice server.
* *
* @param channel * @param channel
* The channel which received the cursor hide event. * The channel which received the cursor hide event.
* *
* @param client * @param client
* The guac_client associated with this session. * The guac_client associated with this Spice session.
*/ */
void guac_spice_cursor_hide(SpiceCursorChannel* channel, guac_client* client); void guac_spice_cursor_hide(SpiceCursorChannel* channel, guac_client* client);
/** /**
* The callback function that is executed when the cursor move signal is * The callback function that is executed when the cursor move signal is
* received from the server. * received from the Spice server.
* *
* @param channel * @param channel
* The channel that received the cursor move event. * The channel that received the cursor move event.
@ -50,7 +50,7 @@ void guac_spice_cursor_hide(SpiceCursorChannel* channel, guac_client* client);
* The y position of the cursor. * The y position of the cursor.
* *
* @param client * @param client
* The guac_client associated with this SPICE session. * The guac_client associated with this Spice session.
*/ */
void guac_spice_cursor_move(SpiceCursorChannel* channel, int x, int y, void guac_spice_cursor_move(SpiceCursorChannel* channel, int x, int y,
guac_client* client); guac_client* client);
@ -63,13 +63,13 @@ void guac_spice_cursor_move(SpiceCursorChannel* channel, int x, int y,
* The channel that received the cursor reset signal. * The channel that received the cursor reset signal.
* *
* @param client * @param client
* The guac_client associated with this SPICE session. * The guac_client associated with this Spice session.
*/ */
void guac_spice_cursor_reset(SpiceCursorChannel* channel, guac_client* client); void guac_spice_cursor_reset(SpiceCursorChannel* channel, guac_client* client);
/** /**
* The callback function that is executed in response to receiving the cursor * The callback function that is executed in response to receiving the cursor
* set signal from the SPICE server, which sets the width, height, and image * set signal from the Spice server, which sets the width, height, and image
* of the cursor, and the x and y coordinates of the cursor hotspot. * of the cursor, and the x and y coordinates of the cursor hotspot.
* *
* @param channel * @param channel
@ -92,7 +92,7 @@ void guac_spice_cursor_reset(SpiceCursorChannel* channel, guac_client* client);
* or NULL if the default cursor image should be used. * or NULL if the default cursor image should be used.
* *
* @param client * @param client
* The guac_client associated with this SPICE session. * The guac_client associated with this Spice session.
*/ */
void guac_spice_cursor_set(SpiceCursorChannel* channel, int width, int height, void guac_spice_cursor_set(SpiceCursorChannel* channel, int width, int height,
int x, int y, gpointer* rgba, guac_client* client); int x, int y, gpointer* rgba, guac_client* client);

View File

@ -32,11 +32,6 @@
#include <guacamole/socket.h> #include <guacamole/socket.h>
#include <spice-client-glib-2.0/spice-client.h> #include <spice-client-glib-2.0/spice-client.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
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
@ -46,7 +41,9 @@
void guac_spice_client_display_update(SpiceChannel* channel, int x, void guac_spice_client_display_update(SpiceChannel* channel, int x,
int y, int w, int h, guac_client* client) { int y, int w, int h, guac_client* client) {
guac_client_log(client, GUAC_LOG_DEBUG, "Received request to update Spice display: %d, %d, %d, %d", x, y, w, h); guac_client_log(client, GUAC_LOG_TRACE,
"Received request to update Spice display: %d, %d, %d, %d",
x, y, w, h);
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
/* Retrieve the primary display buffer */ /* Retrieve the primary display buffer */
@ -94,7 +91,7 @@ void guac_spice_client_display_update(SpiceChannel* channel, int x,
void guac_spice_client_display_gl_draw(SpiceChannel* channel, int x, void guac_spice_client_display_gl_draw(SpiceChannel* channel, int x,
int y, int w, int h, guac_client* client) { int y, int w, int h, guac_client* client) {
guac_client_log(client, GUAC_LOG_DEBUG, "Received gl draw request."); guac_client_log(client, GUAC_LOG_TRACE, "Received GL draw request.");
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
@ -109,13 +106,8 @@ void guac_spice_client_display_gl_draw(SpiceChannel* channel, int x,
void guac_spice_client_display_mark(SpiceChannel* channel, gint mark, void guac_spice_client_display_mark(SpiceChannel* channel, gint mark,
guac_client* client) { guac_client* client) {
guac_client_log(client, GUAC_LOG_DEBUG, "Received signal to mark display."); guac_client_log(client, GUAC_LOG_DEBUG,
"Received signal to mark display, which currently has no effect.");
int channelId;
g_object_get(channel, "channel-id", &channelId, NULL);
guac_client_log(client, GUAC_LOG_DEBUG, "Channel %i marked as available.", channelId);
} }
@ -125,10 +117,12 @@ void guac_spice_client_display_primary_create(SpiceChannel* channel,
guac_client_log(client, GUAC_LOG_DEBUG, "Received request to create primary display."); guac_client_log(client, GUAC_LOG_DEBUG, "Received request to create primary display.");
/* Allocate the Guacamole display. */
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
spice_client->display = guac_common_display_alloc(client, spice_client->display = guac_common_display_alloc(client,
width, height); width, height);
/* Create a matching Cairo image surface. */
guac_client_log(client, GUAC_LOG_TRACE, "Creating Cairo image surface."); guac_client_log(client, GUAC_LOG_TRACE, "Creating Cairo image surface.");
cairo_surface_t* surface = cairo_image_surface_create_for_data(imgdata, CAIRO_FORMAT_RGB24, cairo_surface_t* surface = cairo_image_surface_create_for_data(imgdata, CAIRO_FORMAT_RGB24,
width, height, stride); width, height, stride);
@ -138,9 +132,11 @@ void guac_spice_client_display_primary_create(SpiceChannel* channel,
guac_common_surface_draw(spice_client->display->default_surface, guac_common_surface_draw(spice_client->display->default_surface,
0, 0, surface); 0, 0, surface);
/* Flush the default surface. */
guac_client_log(client, GUAC_LOG_TRACE, "Flushing the default surface."); guac_client_log(client, GUAC_LOG_TRACE, "Flushing the default surface.");
guac_common_surface_flush(spice_client->display->default_surface); guac_common_surface_flush(spice_client->display->default_surface);
/* Mark the end of the frame and flush the socket. */
guac_client_end_frame(client); guac_client_end_frame(client);
guac_socket_flush(client->socket); guac_socket_flush(client->socket);
@ -152,6 +148,7 @@ void guac_spice_client_display_primary_destroy(SpiceChannel* channel,
guac_client_log(client, GUAC_LOG_DEBUG, "Received request to destroy the primary display."); guac_client_log(client, GUAC_LOG_DEBUG, "Received request to destroy the primary display.");
/* Free the Guacamole display. */
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
guac_common_display_free(spice_client->display); guac_common_display_free(spice_client->display);

View File

@ -24,9 +24,14 @@
#include <spice-client-glib-2.0/spice-client.h> #include <spice-client-glib-2.0/spice-client.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
/** /**
* Callback invoked by the SPICE library when it receives a new binary image * Callback invoked by the Spice library when it receives a new binary image
* data from the SPICE server. The image itself will be stored in the designated * data from the Spice server. The image itself will be stored in the designated
* sub-rectangle of client->framebuffer. * sub-rectangle of client->framebuffer.
* *
* @param channel * @param channel
@ -54,7 +59,7 @@ void guac_spice_client_display_update(SpiceDisplayChannel* channel, int x,
/** /**
* The callback function invoked when the RED_DISPLAY_MARK command is received * The callback function invoked when the RED_DISPLAY_MARK command is received
* from the SPICE server and the display should be exposed. * from the Spice server and the display should be exposed.
* *
* @param channel * @param channel
* The SpiceDisplayChannel on which the event was received. * The SpiceDisplayChannel on which the event was received.
@ -70,13 +75,13 @@ void guac_spice_client_display_mark(SpiceDisplayChannel* channel, gint mark,
/** /**
* The callback function invoked when primary display buffer data is sent from * The callback function invoked when primary display buffer data is sent from
* the SPICE server to the client. * the Spice server to the client.
* *
* @param channel * @param channel
* The SpiceDisplayChannel on which this event was received. * The SpiceDisplayChannel on which this event was received.
* *
* @param format * @param format
* The SPICE format of the received data. * The Spice format of the received data.
* *
* @param width * @param width
* The total width of the display. * The total width of the display.
@ -132,7 +137,7 @@ void guac_spice_client_display_mark(SpiceDisplayChannel* channel,
gboolean marked, guac_client* client); gboolean marked, guac_client* client);
/** /**
* Callback invoked by the SPICE client when it receives a CopyRect message. * Callback invoked by the Spice client when it receives a CopyRect message.
* CopyRect specified a rectangle of source data within the display and a * CopyRect specified a rectangle of source data within the display and a
* set of X/Y coordinates to which that rectangle should be copied. * set of X/Y coordinates to which that rectangle should be copied.
* *

View File

@ -46,7 +46,7 @@ typedef struct guac_spice_file_download_status {
} guac_spice_file_download_status; } guac_spice_file_download_status;
/** /**
* Function which uses Linux's fanotify facility to monitor the "Download" * Function which uses Linux's inotify facility to monitor the "Download"
* directory of a shared folder for changes and trigger the automatic download * directory of a shared folder for changes and trigger the automatic download
* of that data to the Guacamole user who has access to the shared folder. * of that data to the Guacamole user who has access to the shared folder.
* *

View File

@ -48,7 +48,7 @@
#include <string.h> #include <string.h>
/** /**
* Handle events for the main SPICE channel, taking the appropriate action * Handle events for the main Spice channel, taking the appropriate action
* for known events, and logging warnings for unknowns and non-fatal events. * for known events, and logging warnings for unknowns and non-fatal events.
* *
* @param channel * @param channel
@ -72,7 +72,7 @@ static void guac_spice_client_main_channel_handler(SpiceChannel *channel,
/* Channel has been closed, so we abort the connection. */ /* Channel has been closed, so we abort the connection. */
case SPICE_CHANNEL_CLOSED: case SPICE_CHANNEL_CLOSED:
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR, guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"Disconnected from SPICE server."); "Disconnected from Spice server.");
break; break;
/* Channel has been opened - log it and do nothing else. */ /* Channel has been opened - log it and do nothing else. */
@ -100,25 +100,25 @@ static void guac_spice_client_main_channel_handler(SpiceChannel *channel,
/* TLS error, abort the connection with a warning. */ /* TLS error, abort the connection with a warning. */
case SPICE_CHANNEL_ERROR_TLS: case SPICE_CHANNEL_ERROR_TLS:
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR, guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"TLS failure connecting to SPICE server."); "TLS failure connecting to Spice server.");
break; break;
/* I/O error, abort the connection with a warning. */ /* I/O error, abort the connection with a warning. */
case SPICE_CHANNEL_ERROR_IO: case SPICE_CHANNEL_ERROR_IO:
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR, guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"IO error communicating with SPICE server."); "IO error communicating with Spice server.");
break; break;
/* SPICE link error, abort the connection with a warning. */ /* SPICE link error, abort the connection with a warning. */
case SPICE_CHANNEL_ERROR_LINK: case SPICE_CHANNEL_ERROR_LINK:
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR, guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"Link error communicating with SPICE server."); "Link error communicating with Spice server.");
break; break;
/* Connect error, abort the connection with a warning. */ /* Connect error, abort the connection with a warning. */
case SPICE_CHANNEL_ERROR_CONNECT: case SPICE_CHANNEL_ERROR_CONNECT:
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR, guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"Connection error communicating with SPICe server."); "Connection error communicating with Spice server.");
break; break;
/* Some other unknown event - log it and move on. */ /* Some other unknown event - log it and move on. */
@ -134,7 +134,7 @@ int guac_client_init(guac_client* client) {
/* Set client args */ /* Set client args */
client->args = GUAC_SPICE_CLIENT_ARGS; client->args = GUAC_SPICE_CLIENT_ARGS;
guac_client_log(client, GUAC_LOG_DEBUG, "Initializing SPICE client."); guac_client_log(client, GUAC_LOG_DEBUG, "Initializing Spice client.");
/* Alloc client data */ /* Alloc client data */
guac_spice_client* spice_client = calloc(1, sizeof(guac_spice_client)); guac_spice_client* spice_client = calloc(1, sizeof(guac_spice_client));

View File

@ -40,9 +40,9 @@
#define GUAC_SPICE_FRAME_TIMEOUT 0 #define GUAC_SPICE_FRAME_TIMEOUT 0
/** /**
* The amount of time to wait for a new message from the SPICE server when * The amount of time to wait for a new message from the Spice server when
* beginning a new frame. This value must be kept reasonably small such that * beginning a new frame. This value must be kept reasonably small such that
* a slow SPICE server will not prevent external events from being handled (such * a slow Spice server will not prevent external events from being handled (such
* as the stop signal from guac_client_stop()), but large enough that the * as the stop signal from guac_client_stop()), but large enough that the
* message handling loop does not eat up CPU spinning. * message handling loop does not eat up CPU spinning.
*/ */

View File

@ -40,7 +40,7 @@
* The keysym being pressed. * The keysym being pressed.
* *
* @return * @return
* Zero if the keysym was successfully decomposed and sent to the SPICE * Zero if the keysym was successfully decomposed and sent to the Spice
* server as a pair of key events (the dead key and base key), non-zero * server as a pair of key events (the dead key and base key), non-zero
* otherwise. * otherwise.
*/ */

View File

@ -36,7 +36,7 @@ guac_user_mouse_handler guac_spice_user_mouse_handler;
guac_user_key_handler guac_spice_user_key_handler; guac_user_key_handler guac_spice_user_key_handler;
/** /**
* A callback that is invoked when the SPICE server updates the mouse mode. * A callback that is invoked when the Spice server updates the mouse mode.
* *
* @param channel * @param channel
* The channel on which the update occurred. * The channel on which the update occurred.

View File

@ -29,14 +29,14 @@
/** /**
* Translates the given keysym into the corresponding lock flag, as would be * Translates the given keysym into the corresponding lock flag, as would be
* required by the SPICE synchronize event. If the given keysym does not * required by the Spice synchronize event. If the given keysym does not
* represent a lock key, zero is returned. * represent a lock key, zero is returned.
* *
* @param keysym * @param keysym
* The keysym to translate into a SPICE lock flag. * The keysym to translate into a Spice lock flag.
* *
* @return * @return
* The SPICE lock flag which corresponds to the given keysym, or zero if the * The Spice lock flag which corresponds to the given keysym, or zero if the
* given keysym does not represent a lock key. * given keysym does not represent a lock key.
*/ */
static int guac_spice_keyboard_lock_flag(int keysym) { static int guac_spice_keyboard_lock_flag(int keysym) {
@ -64,17 +64,17 @@ static int guac_spice_keyboard_lock_flag(int keysym) {
} }
/** /**
* Immediately sends an SPICE key event having the given scancode and flags. * Immediately sends an Spice key event having the given scancode and flags.
* *
* @param spice_client * @param spice_client
* The SPICE client instance associated with the SPICE session along which the * The Spice client instance associated with the SPICE session along which the
* key event should be sent. * key event should be sent.
* *
* @param scancode * @param scancode
* The scancode of the key to press or release via the SPICE key event. * The scancode of the key to press or release via the Spice key event.
* *
* @param flags * @param flags
* Any SPICE-specific flags required for the provided scancode to have the * Any Spice-specific flags required for the provided scancode to have the
* intended meaning, such as KBD_FLAGS_EXTENDED. The possible flags and * intended meaning, such as KBD_FLAGS_EXTENDED. The possible flags and
* their meanings are dictated by SPICE. KBD_FLAGS_DOWN and KBD_FLAGS_UP * their meanings are dictated by SPICE. KBD_FLAGS_DOWN and KBD_FLAGS_UP
* need not be specified here - they will automatically be added depending * need not be specified here - they will automatically be added depending
@ -97,17 +97,17 @@ static void guac_spice_send_key_event(guac_spice_client* spice_client,
} }
/** /**
* Immediately sends an SPICE synchonize event having the given flags. An SPICE * Immediately sends an Spice synchonize event having the given flags. A Spice
* synchronize event sets the state of remote lock keys absolutely, where a * synchronize event sets the state of remote lock keys absolutely, where a
* lock key will be active only if its corresponding flag is set in the event. * lock key will be active only if its corresponding flag is set in the event.
* *
* @param spice_client * @param spice_client
* The SPICE client instance associated with the SPICE session along which the * The Spice client instance associated with the Spice session along which the
* synchronize event should be sent. * synchronize event should be sent.
* *
* @param modifiers * @param modifiers
* Bitwise OR of the flags representing the lock keys which should be set, * Bitwise OR of the flags representing the lock keys which should be set,
* if any, as dictated by the SPICE protocol. If no flags are set, then no * if any, as dictated by the Spice protocol. If no flags are set, then no
* lock keys will be active. * lock keys will be active.
*/ */
static void guac_spice_send_synchronize_event(guac_spice_client* spice_client, static void guac_spice_send_synchronize_event(guac_spice_client* spice_client,
@ -132,7 +132,7 @@ static void guac_spice_send_synchronize_event(guac_spice_client* spice_client,
* returned. * returned.
* *
* @param keyboard * @param keyboard
* The guac_spice_keyboard associated with the current SPICE session. * The guac_spice_keyboard associated with the current Spice session.
* *
* @param keysym * @param keysym
* The keysym of the key to lookup within the given keyboard. * The keysym of the key to lookup within the given keyboard.
@ -188,7 +188,7 @@ static int guac_spice_count_bits(unsigned int value) {
} }
/** /**
* Returns an estimated cost for sending the necessary SPICE events to type the * Returns an estimated cost for sending the necessary Spice events to type the
* key described by the given guac_spice_keysym_desc, given the current lock and * key described by the given guac_spice_keysym_desc, given the current lock and
* modifier state of the keyboard. A higher cost value indicates that a greater * modifier state of the keyboard. A higher cost value indicates that a greater
* number of events are expected to be required. * number of events are expected to be required.
@ -234,10 +234,10 @@ static int guac_spice_keyboard_get_cost(guac_spice_keyboard* keyboard,
/** /**
* Returns a pointer to the guac_spice_key structure representing the * Returns a pointer to the guac_spice_key structure representing the
* definition(s) and state of the key having the given keysym. If no such key * definition(s) and state of the key having the given keysym. If no such key
* is defined within the keyboard layout of the SPICE server, NULL is returned. * is defined within the keyboard layout of the Spice server, NULL is returned.
* *
* @param keyboard * @param keyboard
* The guac_spice_keyboard associated with the current SPICE session. * The guac_spice_keyboard associated with the current Spice session.
* *
* @param keysym * @param keysym
* The keysym of the key to lookup within the given keyboard. * The keysym of the key to lookup within the given keyboard.
@ -245,7 +245,7 @@ static int guac_spice_keyboard_get_cost(guac_spice_keyboard* keyboard,
* @return * @return
* A pointer to the guac_spice_key structure representing the definition(s) * A pointer to the guac_spice_key structure representing the definition(s)
* and state of the key having the given keysym, or NULL if no such key is * and state of the key having the given keysym, or NULL if no such key is
* defined within the keyboard layout of the SPICE server. * defined within the keyboard layout of the Spice server.
*/ */
static guac_spice_key* guac_spice_keyboard_get_key(guac_spice_keyboard* keyboard, static guac_spice_key* guac_spice_keyboard_get_key(guac_spice_keyboard* keyboard,
int keysym) { int keysym) {
@ -265,7 +265,7 @@ static guac_spice_key* guac_spice_keyboard_get_key(guac_spice_keyboard* keyboard
* current keyboard lock and modifier states. * current keyboard lock and modifier states.
* *
* @param keyboard * @param keyboard
* The guac_spice_keyboard associated with the current SPICE session. * The guac_spice_keyboard associated with the current Spice session.
* *
* @param key * @param key
* The key whose lowest-cost possible definition should be retrieved. * The key whose lowest-cost possible definition should be retrieved.
@ -312,7 +312,7 @@ static const guac_spice_keysym_desc* guac_spice_keyboard_get_definition(guac_spi
* logged. * logged.
* *
* @param keyboard * @param keyboard
* The guac_spice_keyboard associated with the current SPICE session. * The guac_spice_keyboard associated with the current Spice session.
* *
* @param mapping * @param mapping
* The keysym/scancode mapping that should be added to the given keyboard. * The keysym/scancode mapping that should be added to the given keyboard.
@ -364,7 +364,7 @@ static void guac_spice_keyboard_add_mapping(guac_spice_keyboard* keyboard,
* Loads all keysym/scancode mappings declared within the given keymap and its * Loads all keysym/scancode mappings declared within the given keymap and its
* parent keymap, if any. These mappings are stored within the given * parent keymap, if any. These mappings are stored within the given
* guac_spice_keyboard structure for future use in translating keysyms to the * guac_spice_keyboard structure for future use in translating keysyms to the
* scancodes required by SPICE key events. * scancodes required by Spice key events.
* *
* @param keyboard * @param keyboard
* The guac_spice_keyboard which should be initialized with the * The guac_spice_keyboard which should be initialized with the
@ -449,11 +449,11 @@ unsigned int guac_spice_keyboard_get_modifier_flags(guac_spice_keyboard* keyboar
} }
/** /**
* Presses/releases the requested key by sending one or more SPICE key events, as * Presses/releases the requested key by sending one or more Spice key events, as
* defined within the keymap defining that key. * defined within the keymap defining that key.
* *
* @param keyboard * @param keyboard
* The guac_spice_keyboard associated with the current SPICE session. * The guac_spice_keyboard associated with the current Spice session.
* *
* @param key * @param key
* The guac_spice_keysym_desc of the key being pressed or released, as * The guac_spice_keysym_desc of the key being pressed or released, as
@ -464,7 +464,7 @@ unsigned int guac_spice_keyboard_get_modifier_flags(guac_spice_keyboard* keyboar
* *
* @return * @return
* Zero if the key was successfully pressed/released, non-zero if the key * Zero if the key was successfully pressed/released, non-zero if the key
* cannot be sent using SPICE key events. * cannot be sent using Spice key events.
*/ */
static const guac_spice_keysym_desc* guac_spice_keyboard_send_defined_key(guac_spice_keyboard* keyboard, static const guac_spice_keysym_desc* guac_spice_keyboard_send_defined_key(guac_spice_keyboard* keyboard,
guac_spice_key* key, int pressed) { guac_spice_key* key, int pressed) {
@ -643,7 +643,7 @@ void guac_spice_keyboard_set_indicators(SpiceChannel* channel, guac_client* clie
g_object_get(channel, SPICE_PROPERTY_KEY_MODIFIERS, &modifiers, NULL); g_object_get(channel, SPICE_PROPERTY_KEY_MODIFIERS, &modifiers, NULL);
/* Update with received locks */ /* Update with received locks */
guac_client_log(client, GUAC_LOG_DEBUG, "Received updated keyboard lock flags from SPICE server: 0x%X", modifiers); guac_client_log(client, GUAC_LOG_DEBUG, "Received updated keyboard lock flags from Spice server: 0x%X", modifiers);
keyboard->modifiers = modifiers; keyboard->modifiers = modifiers;
complete: complete:

View File

@ -39,7 +39,7 @@
#define GUAC_SPICE_KEY_MAX_DEFINITIONS 4 #define GUAC_SPICE_KEY_MAX_DEFINITIONS 4
/** /**
* All possible sources of SPICE key events tracked by guac_spice_keyboard. * All possible sources of Spice key events tracked by guac_spice_keyboard.
*/ */
typedef enum guac_spice_key_source { typedef enum guac_spice_key_source {
@ -50,7 +50,7 @@ typedef enum guac_spice_key_source {
GUAC_SPICE_KEY_SOURCE_CLIENT = 0, GUAC_SPICE_KEY_SOURCE_CLIENT = 0,
/** /**
* The key event is being synthesized internally within the SPICE support. * The key event is being synthesized internally within the Spice support.
*/ */
GUAC_SPICE_KEY_SOURCE_SYNTHETIC = 1 GUAC_SPICE_KEY_SOURCE_SYNTHETIC = 1
@ -58,15 +58,15 @@ typedef enum guac_spice_key_source {
/** /**
* A representation of a single key within the overall local keyboard, * A representation of a single key within the overall local keyboard,
* including the definition of that key within the SPICE server's keymap and * including the definition of that key within the Spice server's keymap and
* whether the key is currently pressed locally. * whether the key is currently pressed locally.
*/ */
typedef struct guac_spice_key { typedef struct guac_spice_key {
/** /**
* All definitions of this key within the SPICE server's keymap (keyboard * All definitions of this key within the Spice server's keymap (keyboard
* layout). Each definition describes which scancode corresponds to this * layout). Each definition describes which scancode corresponds to this
* key from the perspective of the SPICE server, as well as which other * key from the perspective of the Spice server, as well as which other
* scancodes must be pressed/released for this key to have the desired * scancodes must be pressed/released for this key to have the desired
* meaning. * meaning.
*/ */
@ -74,7 +74,7 @@ typedef struct guac_spice_key {
/** /**
* The number of definitions within the definitions array. If this key does * The number of definitions within the definitions array. If this key does
* not exist within the SPICE server's keymap, this will be 0. * not exist within the Spice server's keymap, this will be 0.
*/ */
int num_definitions; int num_definitions;
@ -93,18 +93,18 @@ typedef struct guac_spice_key {
} guac_spice_key; } guac_spice_key;
/** /**
* The current keyboard state of an SPICE session. * The current keyboard state of an Spice session.
*/ */
typedef struct guac_spice_keyboard { typedef struct guac_spice_keyboard {
/** /**
* The guac_client associated with the SPICE session whose keyboard state is * The guac_client associated with the Spice session whose keyboard state is
* being managed by this guac_spice_keyboard. * being managed by this guac_spice_keyboard.
*/ */
guac_client* client; guac_client* client;
/** /**
* The local state of all known lock keys, as a bitwise OR of all SPICE lock * The local state of all known lock keys, as a bitwise OR of all Spice lock
* key flags. Legal flags are KBD_SYNC_SCROLL_LOCK, KBD_SYNC_NUM_LOCK, * key flags. Legal flags are KBD_SYNC_SCROLL_LOCK, KBD_SYNC_NUM_LOCK,
* KBD_SYNC_CAPS_LOCK, and KBD_SYNC_KANA_LOCK. * KBD_SYNC_CAPS_LOCK, and KBD_SYNC_KANA_LOCK.
*/ */
@ -124,7 +124,7 @@ typedef struct guac_spice_keyboard {
/** /**
* The local state of all keys, as well as the necessary information to * The local state of all keys, as well as the necessary information to
* translate received keysyms into scancodes or sequences of scancodes for * translate received keysyms into scancodes or sequences of scancodes for
* SPICE. The state of each key is updated based on received Guacamole key * Spice. The state of each key is updated based on received Guacamole key
* events, while the information describing the behavior and scancode * events, while the information describing the behavior and scancode
* mapping of each key is populated based on an associated keymap. * mapping of each key is populated based on an associated keymap.
* *
@ -149,8 +149,8 @@ typedef struct guac_spice_keyboard {
/** /**
* The total number of keys that the user of the connection is currently * The total number of keys that the user of the connection is currently
* holding down. This value indicates only the client-side keyboard state. * holding down. This value indicates only the client-side keyboard state.
* It DOES NOT indicate the number of keys currently pressed within the SPICE * It DOES NOT indicate the number of keys currently pressed within the
* server. * Spice server.
*/ */
int user_pressed_keys; int user_pressed_keys;
@ -159,12 +159,12 @@ typedef struct guac_spice_keyboard {
/** /**
* Allocates a new guac_spice_keyboard which manages the keyboard state of the * Allocates a new guac_spice_keyboard which manages the keyboard state of the
* SPICE session associated with the given guac_client. Keyboard events will be * SPICE session associated with the given guac_client. Keyboard events will be
* dynamically translated from keysym to SPICE scancode according to the * dynamically translated from keysym to Spice scancode according to the
* provided keymap. The returned guac_spice_keyboard must eventually be freed * provided keymap. The returned guac_spice_keyboard must eventually be freed
* with guac_spice_keyboard_free(). * with guac_spice_keyboard_free().
* *
* @param client * @param client
* The guac_client associated with the SPICE session whose keyboard state is * The guac_client associated with the Spice session whose keyboard state is
* to be managed by the newly-allocated guac_spice_keyboard. * to be managed by the newly-allocated guac_spice_keyboard.
* *
* @param keymap * @param keymap
@ -172,7 +172,7 @@ typedef struct guac_spice_keyboard {
* *
* @return * @return
* A newly-allocated guac_spice_keyboard which manages the keyboard state * A newly-allocated guac_spice_keyboard which manages the keyboard state
* for the SPICE session associated given guac_client. * for the Spice session associated given guac_client.
*/ */
guac_spice_keyboard* guac_spice_keyboard_alloc(guac_client* client, guac_spice_keyboard* guac_spice_keyboard_alloc(guac_client* client,
const guac_spice_keymap* keymap); const guac_spice_keymap* keymap);
@ -228,7 +228,7 @@ int guac_spice_keyboard_is_pressed(guac_spice_keyboard* keyboard, int keysym);
* @see GUAC_SPICE_KEYMAP_MODIFIER_ALTGR * @see GUAC_SPICE_KEYMAP_MODIFIER_ALTGR
* *
* @param keyboard * @param keyboard
* The guac_spice_keyboard associated with the current SPICE session. * The guac_spice_keyboard associated with the current Spice session.
* *
* @return * @return
* The local state of all known modifier keys. * The local state of all known modifier keys.
@ -240,7 +240,7 @@ unsigned int guac_spice_keyboard_get_modifier_flags(guac_spice_keyboard* keyboar
* synchronizing the remote state of those keys if it is expected to differ. * synchronizing the remote state of those keys if it is expected to differ.
* *
* @param keyboard * @param keyboard
* The guac_spice_keyboard associated with the current SPICE session. * The guac_spice_keyboard associated with the current Spice session.
* *
* @param set_modifiers * @param set_modifiers
* The lock key flags which should be set. Legal flags are * The lock key flags which should be set. Legal flags are
@ -264,7 +264,7 @@ void guac_spice_keyboard_update_locks(guac_spice_keyboard* keyboard,
* @see GUAC_SPICE_KEYMAP_MODIFIER_ALTGR * @see GUAC_SPICE_KEYMAP_MODIFIER_ALTGR
* *
* @param keyboard * @param keyboard
* The guac_spice_keyboard associated with the current SPICE session. * The guac_spice_keyboard associated with the current Spice session.
* *
* @param set_modifiers * @param set_modifiers
* The modifier key flags which should be set. * The modifier key flags which should be set.
@ -277,7 +277,7 @@ void guac_spice_keyboard_update_modifiers(guac_spice_keyboard* keyboard,
/** /**
* Updates the local state of the given keysym, sending the key events required * Updates the local state of the given keysym, sending the key events required
* to replicate that state remotely (on the SPICE server). The key events sent * to replicate that state remotely (on the Spice server). The key events sent
* will depend on the current keymap. * will depend on the current keymap.
* *
* @param keyboard * @param keyboard
@ -300,20 +300,20 @@ int guac_spice_keyboard_update_keysym(guac_spice_keyboard* keyboard,
int keysym, int pressed, guac_spice_key_source source); int keysym, int pressed, guac_spice_key_source source);
/** /**
* Releases all currently pressed keys, sending key release events to the SPICE * Releases all currently pressed keys, sending key release events to the Spice
* server as necessary. Lock states (Caps Lock, etc.) are not affected. * server as necessary. Lock states (Caps Lock, etc.) are not affected.
* *
* @param keyboard * @param keyboard
* The guac_spice_keyboard associated with the current SPICE session. * The guac_spice_keyboard associated with the current Spice session.
*/ */
void guac_spice_keyboard_reset(guac_spice_keyboard* keyboard); void guac_spice_keyboard_reset(guac_spice_keyboard* keyboard);
/** /**
* Callback which is invoked when the SPICE server reports changes to keyboard * Callback which is invoked when the Spice server reports changes to keyboard
* lock status using a Server Set Keyboard Indicators PDU. * lock status using a Server Set Keyboard Indicators PDU.
* *
* @param channel * @param channel
* The spiceContext associated with the current SPICE session. * The spiceContext associated with the current Spice session.
* *
* @param client * @param client
* The guac_client object associated with the callback. * The guac_client object associated with the callback.

View File

@ -86,7 +86,7 @@
#define GUAC_SPICE_KEYMAP_MODIFIER_ALTGR 2 #define GUAC_SPICE_KEYMAP_MODIFIER_ALTGR 2
/** /**
* Represents a keysym-to-scancode mapping for SPICE, with extra information * Represents a keysym-to-scancode mapping for Spice, with extra information
* about the state of prerequisite keysyms. * about the state of prerequisite keysyms.
*/ */
typedef struct guac_spice_keysym_desc { typedef struct guac_spice_keysym_desc {
@ -102,7 +102,7 @@ typedef struct guac_spice_keysym_desc {
int scancode; int scancode;
/** /**
* Required SPICE-specific flags that must be sent along with the scancode. * Required Spice-specific flags that must be sent along with the scancode.
*/ */
int flags; int flags;
@ -111,7 +111,7 @@ typedef struct guac_spice_keysym_desc {
* associated scancode to be interpreted as this keysym. * associated scancode to be interpreted as this keysym.
* *
* If the associated keysym is pressed, and any of these modifiers are not * If the associated keysym is pressed, and any of these modifiers are not
* currently active, Guacamole's SPICE support must send additional events * currently active, Guacamole's Spice support must send additional events
* to activate these modifiers prior to sending the scancode for this * to activate these modifiers prior to sending the scancode for this
* keysym. * keysym.
* *
@ -125,7 +125,7 @@ typedef struct guac_spice_keysym_desc {
* associated scancode to be interpreted as this keysym. * associated scancode to be interpreted as this keysym.
* *
* If the associated keysym is pressed, and any of these modifiers are * If the associated keysym is pressed, and any of these modifiers are
* currently active, Guacamole's SPICE support must send additional events * currently active, Guacamole's Spice support must send additional events
* to deactivate these modifiers prior to sending the scancode for this * to deactivate these modifiers prior to sending the scancode for this
* keysym. * keysym.
* *

View File

@ -39,7 +39,7 @@
#include <syslog.h> #include <syslog.h>
/** /**
* Callback invoked by SPICE when an informational message needs to be * Callback invoked by Spice when an informational message needs to be
* logged. * logged.
* *
* @param format * @param format
@ -52,7 +52,7 @@
void guac_spice_client_log_info(const char* format, ...); void guac_spice_client_log_info(const char* format, ...);
/** /**
* Callback invoked by SPICE when an error message needs to be logged. * Callback invoked by Spice when an error message needs to be logged.
* *
* @param format * @param format
* A printf-style format string to log. * A printf-style format string to log.

View File

@ -95,24 +95,24 @@ const char* GUAC_SPICE_CLIENT_ARGS[] = {
enum SPICE_ARGS_IDX { enum SPICE_ARGS_IDX {
/** /**
* The hostname of the SPICE server (or repeater) to connect to. * The hostname of the Spice server to connect to.
*/ */
IDX_HOSTNAME, IDX_HOSTNAME,
/** /**
* The port of the SPICE server (or repeater) to connect to. * The port of the Spice server to connect to.
*/ */
IDX_PORT, IDX_PORT,
/** /**
* Whether or not the connection to the SPICE server should be made via * Whether or not the connection to the Spice server should be made via
* TLS. * TLS.
*/ */
IDX_TLS, IDX_TLS,
/** /**
* The verification mode that should be used to validate TLS connections * The verification mode that should be used to validate TLS connections
* to the SPICE server. * to the Spice server.
*/ */
IDX_TLS_VERIFY, IDX_TLS_VERIFY,
@ -134,7 +134,7 @@ enum SPICE_ARGS_IDX {
IDX_PUBKEY, IDX_PUBKEY,
/** /**
* The proxy server to connect through when connecting to the SPICE server. * The proxy server to connect through when connecting to the Spice server.
*/ */
IDX_PROXY, IDX_PROXY,
@ -145,7 +145,7 @@ enum SPICE_ARGS_IDX {
IDX_READ_ONLY, IDX_READ_ONLY,
/** /**
* Space-separated list of encodings to use within the SPICE session. If not * Space-separated list of encodings to use within the Spice session. If not
* specified, this will be: * specified, this will be:
* *
* "zrle ultra copyrect hextile zlib corre rre raw". * "zrle ultra copyrect hextile zlib corre rre raw".
@ -153,18 +153,18 @@ enum SPICE_ARGS_IDX {
IDX_ENCODINGS, IDX_ENCODINGS,
/** /**
* The username to send to the SPICE server if authentication is requested. * The username to send to the Spice server if authentication is requested.
*/ */
IDX_USERNAME, IDX_USERNAME,
/** /**
* The password to send to the SPICE server if authentication is requested. * The password to send to the Spice server if authentication is requested.
*/ */
IDX_PASSWORD, IDX_PASSWORD,
/** /**
* "true" if the red and blue components of each color should be swapped, * "true" if the red and blue components of each color should be swapped,
* "false" or blank otherwise. This is mainly used for SPICE servers that do * "false" or blank otherwise. This is mainly used for Spice servers that do
* not properly handle colors. * not properly handle colors.
*/ */
IDX_SWAP_RED_BLUE, IDX_SWAP_RED_BLUE,
@ -187,10 +187,10 @@ enum SPICE_ARGS_IDX {
IDX_AUTORETRY, IDX_AUTORETRY,
/** /**
* The encoding to use for clipboard data sent to the SPICE server if we are * The encoding to use for clipboard data sent to the Spice server if we are
* going to be deviating from the standard (which mandates ISO 8829-1). * going to be deviating from the standard (which mandates ISO 8829-1).
* Valid values are "ISO8829-1" (the only legal value with respect to the * Valid values are "ISO8829-1" (the only legal value with respect to the
* SPICE standard), "UTF-8", "UTF-16", and "CP2252". * Spice standard), "UTF-8", "UTF-16", and "CP2252".
*/ */
IDX_CLIPBOARD_ENCODING, IDX_CLIPBOARD_ENCODING,
@ -216,7 +216,7 @@ enum SPICE_ARGS_IDX {
IDX_FILE_DIRECTORY, IDX_FILE_DIRECTORY,
/** /**
* Whether or not the shared directory should be read-only to the SPICE * Whether or not the shared directory should be read-only to the Spice
* server. * server.
*/ */
IDX_FILE_TRANSFER_RO, IDX_FILE_TRANSFER_RO,
@ -242,20 +242,20 @@ enum SPICE_ARGS_IDX {
/** /**
* The name of the keymap chosen as the layout of the server. Legal names * The name of the keymap chosen as the layout of the server. Legal names
* are defined within the *.keymap files in the "keymaps" directory of the * are defined within the *.keymap files in the "keymaps" directory of the
* source for Guacamole's SPICE support. * source for Guacamole's Spice support.
*/ */
IDX_SERVER_LAYOUT, IDX_SERVER_LAYOUT,
#ifdef ENABLE_COMMON_SSH #ifdef ENABLE_COMMON_SSH
/** /**
* "true" if SFTP should be enabled for the SPICE connection, "false" or * "true" if SFTP should be enabled for the Spice connection, "false" or
* blank otherwise. * blank otherwise.
*/ */
IDX_ENABLE_SFTP, IDX_ENABLE_SFTP,
/** /**
* The hostname of the SSH server to connect to for SFTP. If blank, the * The hostname of the SSH server to connect to for SFTP. If blank, the
* hostname of the SPICE server will be used. * hostname of the Spice server will be used.
*/ */
IDX_SFTP_HOSTNAME, IDX_SFTP_HOSTNAME,
@ -651,7 +651,7 @@ void guac_spice_settings_free(guac_spice_settings* settings) {
free(settings->username); free(settings->username);
#ifdef ENABLE_SPICE_REPEATER #ifdef ENABLE_SPICE_REPEATER
/* Free SPICE repeater settings */ /* Free Spice repeater settings */
free(settings->dest_host); free(settings->dest_host);
#endif #endif

View File

@ -34,17 +34,17 @@
#define GUAC_SPICE_DEFAULT_RECORDING_NAME "recording" #define GUAC_SPICE_DEFAULT_RECORDING_NAME "recording"
/** /**
* SPICE-specific client data. * Spice-specific client data.
*/ */
typedef struct guac_spice_settings { typedef struct guac_spice_settings {
/** /**
* The hostname of the SPICE server (or repeater) to connect to. * The hostname of the Spice server (or repeater) to connect to.
*/ */
char* hostname; char* hostname;
/** /**
* The port of the SPICE server (or repeater) to connect to. * The port of the Spice server (or repeater) to connect to.
*/ */
char* port; char* port;
@ -55,13 +55,13 @@ typedef struct guac_spice_settings {
/** /**
* The type of TLS validation that should be done for encrypted connections * The type of TLS validation that should be done for encrypted connections
* to SPICE servers. * to Spice servers.
*/ */
SpiceSessionVerify tls_verify; SpiceSessionVerify tls_verify;
/** /**
* One or more Base64-encoded certificates to use to validate TLS * One or more Base64-encoded certificates to use to validate TLS
* connections to the SPICE server. * connections to the Spice server.
*/ */
char* ca; char* ca;
@ -72,12 +72,12 @@ typedef struct guac_spice_settings {
char* ca_file; char* ca_file;
/** /**
* The public key of the SPICE server for TLS verification. * The public key of the Spice server for TLS verification.
*/ */
char* pubkey; char* pubkey;
/** /**
* SPICE supports connecting to remote servers via a proxy server. You can * Spice supports connecting to remote servers via a proxy server. You can
* specify the proxy server to use in this property. * specify the proxy server to use in this property.
*/ */
char* proxy; char* proxy;
@ -93,7 +93,7 @@ typedef struct guac_spice_settings {
char* password; char* password;
/** /**
* Space-separated list of encodings to use within the SPICE session. * Space-separated list of encodings to use within the Spice session.
*/ */
char* encodings; char* encodings;
@ -161,8 +161,8 @@ typedef struct guac_spice_settings {
int retries; int retries;
/** /**
* The encoding to use for clipboard data sent to the SPICE server, or NULL * The encoding to use for clipboard data sent to the Spice server, or NULL
* to use the encoding required by the SPICE standard. * to use the encoding required by the Spice standard.
*/ */
char* clipboard_encoding; char* clipboard_encoding;
@ -182,7 +182,7 @@ typedef struct guac_spice_settings {
#ifdef ENABLE_COMMON_SSH #ifdef ENABLE_COMMON_SSH
/** /**
* Whether SFTP should be enabled for the SPICE connection. * Whether SFTP should be enabled for the Spice connection.
*/ */
bool enable_sftp; bool enable_sftp;

View File

@ -22,7 +22,7 @@
/** /**
* The key used to store and retrieve Guacamole-related data from within the * The key used to store and retrieve Guacamole-related data from within the
* SPICE client structure. * Spice client structure.
*/ */
#define GUAC_SPICE_CLIENT_KEY "GUAC_SPICE" #define GUAC_SPICE_CLIENT_KEY "GUAC_SPICE"
@ -125,54 +125,54 @@
#define GUAC_SPICE_PARAMETER_TLS_VERIFY_SUBJECT "subject" #define GUAC_SPICE_PARAMETER_TLS_VERIFY_SUBJECT "subject"
/** /**
* The property within a SPICE client channel that indicates if the SPICE * The property within a Spice client channel that indicates if the SPICE
* agent is connected. * agent is connected.
*/ */
#define SPICE_PROPERTY_AGENT_CONNECTED "agent-connected" #define SPICE_PROPERTY_AGENT_CONNECTED "agent-connected"
/** /**
* The SPICE client property that defines CA certificates used to validate * The Spice client property that defines CA certificates used to validate
* the TLS connection to the SPICE server. * the TLS connection to the Spice server.
*/ */
#define SPICE_PROPERTY_CA "ca" #define SPICE_PROPERTY_CA "ca"
/** /**
* The SPICE client property that defines a path on the server running guacd * The Spice client property that defines a path on the server running guacd
* to the file containing the certificate authority certificates to use to * to the file containing the certificate authority certificates to use to
* validate the TLS connection to the SPICE server. * validate the TLS connection to the Spice server.
*/ */
#define SPICE_PROPERTY_CA_FILE "ca-file" #define SPICE_PROPERTY_CA_FILE "ca-file"
/** /**
* The property that the SPICE client uses to set the image cache size. If * The property that the Spice client uses to set the image cache size. If
* undefined a default of 0 will be used. * undefined a default of 0 will be used.
*/ */
#define SPICE_PROPERTY_CACHE_SIZE "cache-size" #define SPICE_PROPERTY_CACHE_SIZE "cache-size"
/** /**
* The SPICE client channel property that stores the identifier of the channel. * The Spice client channel property that stores the identifier of the channel.
*/ */
#define SPICE_PROPERTY_CHANNEL_ID "channel-id" #define SPICE_PROPERTY_CHANNEL_ID "channel-id"
/** /**
* THe SPICE client channel property that stores the type of the channel. * THe Spice client channel property that stores the type of the channel.
*/ */
#define SPICE_PROPERTY_CHANNEL_TYPE "channel-type" #define SPICE_PROPERTY_CHANNEL_TYPE "channel-type"
/** /**
* SPICE library property that determines whether or not the sockets are provided * Spice library property that determines whether or not the sockets are provided
* by the client. * by the client.
*/ */
#define SPICE_PROPERTY_CLIENT_SOCKETS "client-sockets" #define SPICE_PROPERTY_CLIENT_SOCKETS "client-sockets"
/** /**
* The property that tells the SPICE client the color depth to use when * The property that tells the Spice client the color depth to use when
* allocating new displays. * allocating new displays.
*/ */
#define SPICE_PROPERTY_COLOR_DEPTH "color-depth" #define SPICE_PROPERTY_COLOR_DEPTH "color-depth"
/** /**
* The property that tells the SPICE client to enable audio playback and * The property that tells the Spice client to enable audio playback and
* recording. The SPICE client default is TRUE. * recording. The SPICE client default is TRUE.
*/ */
#define SPICE_PROPERTY_ENABLE_AUDIO "enable-audio" #define SPICE_PROPERTY_ENABLE_AUDIO "enable-audio"
@ -183,13 +183,13 @@
#define SPICE_PROPERTY_ENABLE_USBREDIR "enable-usbredir" #define SPICE_PROPERTY_ENABLE_USBREDIR "enable-usbredir"
/** /**
* The property that contains the hostname, IP address, or URL of the SPICE * The property that contains the hostname, IP address, or URL of the Spice
* server that the client should attempt to connect to. * server that the client should attempt to connect to.
*/ */
#define SPICE_PROPERTY_HOST "host" #define SPICE_PROPERTY_HOST "host"
/** /**
* A read-only property exposed by the SPICE client library indicating the * A read-only property exposed by the Spice client library indicating the
* current state of key modifiers - such as lock keys - on the server. * current state of key modifiers - such as lock keys - on the server.
*/ */
#define SPICE_PROPERTY_KEY_MODIFIERS "key-modifiers" #define SPICE_PROPERTY_KEY_MODIFIERS "key-modifiers"
@ -201,88 +201,88 @@
/** /**
* The property used to toggle the playback and/or record * The property used to toggle the playback and/or record
* mute status on the SPICE server. * mute status on the Spice server.
*/ */
#define SPICE_PROPERTY_MUTE "mute" #define SPICE_PROPERTY_MUTE "mute"
/** /**
* The property used to get or set the number of audio playback and/or recording * The property used to get or set the number of audio playback and/or recording
* channels that will be available between the SPICE server and client. * channels that will be available between the Spice server and client.
*/ */
#define SPICE_PROPERTY_NUM_CHANNELS "nchannels" #define SPICE_PROPERTY_NUM_CHANNELS "nchannels"
/** /**
* The property used to tell the SPICE client the password to send on to the * The property used to tell the Spice client the password to send on to the
* SPICE server for authentication. * SPICE server for authentication.
*/ */
#define SPICE_PROPERTY_PASSWORD "password" #define SPICE_PROPERTY_PASSWORD "password"
/** /**
* The property used to set the unencrypted communication port for communicating * The property used to set the unencrypted communication port for communicating
* with the SPICE server. * with the Spice server.
*/ */
#define SPICE_PROPERTY_PORT "port" #define SPICE_PROPERTY_PORT "port"
/** /**
* The property that the SPICE client uses to set the proxy server that is used * The property that the Spice client uses to set the proxy server that is used
* to connect to the SPICE server. * to connect to the Spice server.
*/ */
#define SPICE_PROPERTY_PROXY "proxy" #define SPICE_PROPERTY_PROXY "proxy"
/** /**
* The property used by the SPICE client to tell the server that the session * The property used by the Spice client to tell the server that the session
* should be read-only. * should be read-only.
*/ */
#define SPICE_PROPERTY_READ_ONLY "read-only" #define SPICE_PROPERTY_READ_ONLY "read-only"
/** /**
* The property that the SPICE client uses to determine a local (to guacd) * The property that the Spice client uses to determine a local (to guacd)
* directory that will be shared with the SPICE server. * directory that will be shared with the Spice server.
*/ */
#define SPICE_PROPERTY_SHARED_DIR "shared-dir" #define SPICE_PROPERTY_SHARED_DIR "shared-dir"
/** /**
* The property that tells the SPICE client that the shared directory should be * The property that tells the Spice client that the shared directory should be
* read-only to the SPICE server and should not allow writes. * read-only to the Spice server and should not allow writes.
*/ */
#define SPICE_PROPERTY_SHARED_DIR_RO "share-dir-ro" #define SPICE_PROPERTY_SHARED_DIR_RO "share-dir-ro"
/** /**
* The property within the SPICE client that is used to set the port used for * The property within the Spice client that is used to set the port used for
* secure, TLS-based communication with the SPICE server. * secure, TLS-based communication with the Spice server.
*/ */
#define SPICE_PROPERTY_TLS_PORT "tls-port" #define SPICE_PROPERTY_TLS_PORT "tls-port"
/** /**
* The property that is used to set the username that the SPICE client will use * The property that is used to set the username that the Spice client will use
* to authenticate with the server. * to authenticate with the server.
*/ */
#define SPICE_PROPERTY_USERNAME "username" #define SPICE_PROPERTY_USERNAME "username"
/** /**
* The property that tells the SPICE client whether or not to verify the * The property that tells the Spiec client whether or not to verify the
* certificate presented by the SPICE server in TLS communications. * certificate presented by the Spice server in TLS communications.
*/ */
#define SPICE_PROPERTY_VERIFY "verify" #define SPICE_PROPERTY_VERIFY "verify"
/** /**
* The property used to get or set the playback and/or recording volume of audio * The property used to get or set the playback and/or recording volume of audio
* on the SPICE server to the remote client. * on the Spice server to the remote client.
*/ */
#define SPICE_PROPERTY_VOLUME "volume" #define SPICE_PROPERTY_VOLUME "volume"
/** /**
* The signal sent by the SPICE client when a new channel is created. * The signal sent by the Spice client when a new channel is created.
*/ */
#define SPICE_SIGNAL_CHANNEL_NEW "channel-new" #define SPICE_SIGNAL_CHANNEL_NEW "channel-new"
/** /**
* The signal sent by the SPICE client when a channel is destroyed. * The signal sent by the Spice client when a channel is destroyed.
*/ */
#define SPICE_SIGNAL_CHANNEL_DESTROY "channel-destroy" #define SPICE_SIGNAL_CHANNEL_DESTROY "channel-destroy"
/** /**
* The signal sent by the SPICE client when an event occurs on a channel. * The signal sent by the Spice client when an event occurs on a channel.
*/ */
#define SPICE_SIGNAL_CHANNEL_EVENT "channel-event" #define SPICE_SIGNAL_CHANNEL_EVENT "channel-event"
@ -309,7 +309,7 @@
#define SPICE_SIGNAL_CURSOR_SET "cursor-set" #define SPICE_SIGNAL_CURSOR_SET "cursor-set"
/** /**
* The signal sent by the SPICE client when the client is disconnected from * The signal sent by the Spice client when the client is disconnected from
* the server. * the server.
*/ */
#define SPICE_SIGNAL_DISCONNECTED "disconnected" #define SPICE_SIGNAL_DISCONNECTED "disconnected"
@ -348,24 +348,24 @@
#define SPICE_SIGNAL_INPUTS_MODIFIERS "inputs-modifiers" #define SPICE_SIGNAL_INPUTS_MODIFIERS "inputs-modifiers"
/** /**
* The signal sent by the SPICE client when the connected status or capabilities * The signal sent by the Spice client when the connected status or capabilities
* of a channel change. * of a channel change.
*/ */
#define SPICE_SIGNAL_MAIN_AGENT_UPDATE "main-agent-update" #define SPICE_SIGNAL_MAIN_AGENT_UPDATE "main-agent-update"
/** /**
* Signal fired by the SPICE client when clipboard selection data is available. * Signal fired by the Spice client when clipboard selection data is available.
*/ */
#define SPICE_SIGNAL_MAIN_CLIPBOARD_SELECTION "main-clipboard-selection" #define SPICE_SIGNAL_MAIN_CLIPBOARD_SELECTION "main-clipboard-selection"
/** /**
* A signal fired by the SPICE client when clipboard selection data is available * A signal fired by the Spice client when clipboard selection data is available
* from the guest, and of what type. * from the guest, and of what type.
*/ */
#define SPICE_SIGNAL_MAIN_CLIPBOARD_SELECTION_GRAB "main-clipboard-selection-grab" #define SPICE_SIGNAL_MAIN_CLIPBOARD_SELECTION_GRAB "main-clipboard-selection-grab"
/** /**
* A signal fired by the SPICE client when clipboard selection data is no longer * A signal fired by the Spice client when clipboard selection data is no longer
* available from the guest. * available from the guest.
*/ */
#define SPICE_SIGNAL_MAIN_CLIPBOARD_SELECTION_RELEASE "main-clipboard-selection-release" #define SPICE_SIGNAL_MAIN_CLIPBOARD_SELECTION_RELEASE "main-clipboard-selection-release"
@ -381,19 +381,19 @@
#define SPICE_SIGNAL_MAIN_MOUSE_UPDATE "main-mouse-update" #define SPICE_SIGNAL_MAIN_MOUSE_UPDATE "main-mouse-update"
/** /**
* A signal sent by the SPICE client when the server has indicated that live * A signal sent by the Spice client when the server has indicated that live
* migration has started. * migration has started.
*/ */
#define SPICE_SIGNAL_MIGRATION_STARTED "migration-started" #define SPICE_SIGNAL_MIGRATION_STARTED "migration-started"
/** /**
* The signal sent by the SPICE client when a MM time discontinuity is * The signal sent by the Spice client when a MM time discontinuity is
* detected. * detected.
*/ */
#define SPICE_SIGNAL_MM_TIME_RESET "mm-time-reset" #define SPICE_SIGNAL_MM_TIME_RESET "mm-time-reset"
/** /**
* The signal fired by the SPICE client when a new file transfer task has been * The signal fired by the Spice client when a new file transfer task has been
* initiated. * initiated.
*/ */
#define SPICE_SIGNAL_NEW_FILE_TRANSFER "new-file-transfer" #define SPICE_SIGNAL_NEW_FILE_TRANSFER "new-file-transfer"
@ -421,7 +421,7 @@
#define SPICE_SIGNAL_PLAYBACK_STOP "playback-stop" #define SPICE_SIGNAL_PLAYBACK_STOP "playback-stop"
/** /**
* A signal indicating that the SPICE server would like to capture audio data * A signal indicating that the Spice server would like to capture audio data
* from the client, along with the required format of that data. * from the client, along with the required format of that data.
*/ */
#define SPICE_SIGNAL_RECORD_START "record-start" #define SPICE_SIGNAL_RECORD_START "record-start"
@ -437,7 +437,7 @@
#define SPICE_SIGNAL_SHARE_FOLDER "notify::share-folder" #define SPICE_SIGNAL_SHARE_FOLDER "notify::share-folder"
/** /**
* The signal indicating that the SPICE server has gone to streaming mode. * The signal indicating that the Spice server has gone to streaming mode.
*/ */
#define SPICE_SIGNAL_STREAMING_MODE "streaming-mode" #define SPICE_SIGNAL_STREAMING_MODE "streaming-mode"

View File

@ -26,12 +26,12 @@
#define SPICE_DEFAULT_HOST "localhost" #define SPICE_DEFAULT_HOST "localhost"
/** /**
* The default SPICE port number to connect to if none is specified. * The default Spice port number to connect to if none is specified.
*/ */
#define SPICE_DEFAULT_PORT "5900" #define SPICE_DEFAULT_PORT "5900"
/** /**
* The default encodings to use for the SPICE clipboard. * The default encodings to use for the Spice clipboard.
*/ */
#define SPICE_DEFAULT_ENCODINGS "zrle ultra copyrect hextile zlib corre rre raw" #define SPICE_DEFAULT_ENCODINGS "zrle ultra copyrect hextile zlib corre rre raw"

View File

@ -53,23 +53,17 @@ SpiceSession* guac_spice_get_session(guac_client* client) {
guac_client_log(client, GUAC_LOG_DEBUG, "Initializing new SPICE session."); guac_client_log(client, GUAC_LOG_DEBUG, "Initializing new SPICE session.");
/* Set up the SPICE session and Guacamole client. */ /* Set up the Spice session and Guacamole client. */
guac_spice_client* spice_client = (guac_spice_client*) client->data; guac_spice_client* spice_client = (guac_spice_client*) client->data;
guac_spice_settings* spice_settings = spice_client->settings; guac_spice_settings* spice_settings = spice_client->settings;
/* Create a new SPICE client. */ /* Create a new Spice client. */
SpiceSession* spice_session = spice_session_new(); SpiceSession* spice_session = spice_session_new();
guac_client_log(client, GUAC_LOG_DEBUG, "Registering new channel callback.");
/* Register a callback for handling new channel events. */ /* Register a callback for handling new channel events. */
g_signal_connect(spice_session, SPICE_SIGNAL_CHANNEL_NEW, g_signal_connect(spice_session, SPICE_SIGNAL_CHANNEL_NEW,
G_CALLBACK(guac_spice_client_channel_handler), client); G_CALLBACK(guac_spice_client_channel_handler), client);
guac_client_log(client, GUAC_LOG_DEBUG, "Setting up connection properties.");
guac_client_log(client, GUAC_LOG_DEBUG, "Setting up host/port.");
/* Set hostname and port */ /* Set hostname and port */
g_object_set(spice_session, SPICE_PROPERTY_HOST, spice_settings->hostname, NULL); g_object_set(spice_session, SPICE_PROPERTY_HOST, spice_settings->hostname, NULL);
guac_client_log(client, GUAC_LOG_DEBUG, "Connecting to host %s", guac_client_log(client, GUAC_LOG_DEBUG, "Connecting to host %s",
@ -100,6 +94,7 @@ SpiceSession* guac_spice_get_session(guac_client* client) {
spice_client->keyboard = guac_spice_keyboard_alloc(client, spice_client->keyboard = guac_spice_keyboard_alloc(client,
spice_settings->server_layout); spice_settings->server_layout);
/* If file transfer is enabled, set up the required properties. */
if (spice_settings->file_transfer) { if (spice_settings->file_transfer) {
guac_client_log(client, GUAC_LOG_DEBUG, "File transfer enabled, configuring Spice client."); guac_client_log(client, GUAC_LOG_DEBUG, "File transfer enabled, configuring Spice client.");
g_object_set(spice_session, SPICE_PROPERTY_SHARED_DIR, spice_settings->file_directory, NULL); g_object_set(spice_session, SPICE_PROPERTY_SHARED_DIR, spice_settings->file_directory, NULL);
@ -113,12 +108,9 @@ SpiceSession* guac_spice_get_session(guac_client* client) {
guac_client_for_owner(client, guac_spice_folder_expose, guac_client_for_owner(client, guac_spice_folder_expose,
spice_client->shared_folder); spice_client->shared_folder);
} }
else {
guac_client_log(client, GUAC_LOG_DEBUG, "Disabling file transfer.");
g_object_set(spice_session, SPICE_PROPERTY_SHARED_DIR, NULL, NULL);
}
guac_client_log(client, GUAC_LOG_DEBUG, "Finished setting properties."); else
g_object_set(spice_session, SPICE_PROPERTY_SHARED_DIR, NULL, NULL);
/* Return the configured session. */ /* Return the configured session. */
return spice_session; return spice_session;
@ -157,12 +149,8 @@ void* guac_spice_client_thread(void* data) {
"Unable to connect to SPICE server."); "Unable to connect to SPICE server.");
return NULL; return NULL;
} }
guac_client_log(client, GUAC_LOG_DEBUG, "Configuration completed, flushing socket.");
guac_socket_flush(client->socket); guac_socket_flush(client->socket);
// guac_timestamp last_frame_end = guac_timestamp_current();
guac_client_log(client, GUAC_LOG_DEBUG, "Connection configuration finished, calling spice_session_connect."); guac_client_log(client, GUAC_LOG_DEBUG, "Connection configuration finished, calling spice_session_connect.");
@ -193,6 +181,7 @@ void* guac_spice_client_thread(void* data) {
g_object_unref(spice_client->spice_session); g_object_unref(spice_client->spice_session);
spice_client->spice_session = NULL; spice_client->spice_session = NULL;
} }
guac_client_stop(client); guac_client_stop(client);
guac_client_log(client, GUAC_LOG_INFO, "Internal SPICE client disconnected"); guac_client_log(client, GUAC_LOG_INFO, "Internal SPICE client disconnected");
return NULL; return NULL;

View File

@ -46,42 +46,42 @@
#include <pthread.h> #include <pthread.h>
/** /**
* SPICE-specific client data. * Spice-specific client data.
*/ */
typedef struct guac_spice_client { typedef struct guac_spice_client {
/** /**
* The SPICE client thread. * The Spice client thread.
*/ */
pthread_t client_thread; pthread_t client_thread;
/** /**
* The underlying SPICE session. * The underlying Spice session.
*/ */
SpiceSession* spice_session; SpiceSession* spice_session;
/** /**
* The main SPICE channel. * The main Spice channel.
*/ */
SpiceMainChannel* main_channel; SpiceMainChannel* main_channel;
/** /**
* The SPICE audio playback channel. * The Spice audio playback channel.
*/ */
SpicePlaybackChannel* playback_channel; SpicePlaybackChannel* playback_channel;
/** /**
* The SPICE audio recording/input channel. * The Spice audio recording/input channel.
*/ */
SpiceRecordChannel* record_channel; SpiceRecordChannel* record_channel;
/** /**
* The SPICE channel that handles the cursor display and events. * The Spice channel that handles the cursor display and events.
*/ */
SpiceCursorChannel* cursor_channel; SpiceCursorChannel* cursor_channel;
/** /**
* The SPICE channel that handles mouse and keyboard inputs. * The Spice channel that handles mouse and keyboard inputs.
*/ */
SpiceInputsChannel* inputs_channel; SpiceInputsChannel* inputs_channel;
@ -96,7 +96,7 @@ typedef struct guac_spice_client {
guac_common_display* display; guac_common_display* display;
/** /**
* The SPICE display channel. * The Spice display channel.
*/ */
SpiceDisplayChannel* spice_display; SpiceDisplayChannel* spice_display;
@ -149,16 +149,16 @@ typedef struct guac_spice_client {
pthread_mutexattr_t attributes; pthread_mutexattr_t attributes;
/** /**
* Lock which is used to synchronizes access to SPICE data structures * Lock which is used to synchronizes access to Spice data structures
* between user input and client threads. It prevents input handlers * between user input and client threads. It prevents input handlers
* from running when SPICE data structures are allocated or freed * from running when Spice data structures are allocated or freed
* by the client thread. * by the client thread.
*/ */
pthread_rwlock_t lock; pthread_rwlock_t lock;
/** /**
* Lock which synchronizes the sending of each SPICE message, ensuring * Lock which synchronizes the sending of each Spice message, ensuring
* attempts to send SPICE messages never overlap. * attempts to send Spice messages never overlap.
*/ */
pthread_mutex_t message_lock; pthread_mutex_t message_lock;
@ -175,27 +175,27 @@ typedef struct guac_spice_client {
} guac_spice_client; } guac_spice_client;
/** /**
* Allocates a new rfbClient instance given the parameters stored within the * Allocates a new Spice client session given the parameters stored within the
* client, returning NULL on failure. * client, returning NULL on failure.
* *
* @param client * @param client
* The guac_client associated with the settings of the desired SPICE * The guac_client associated with the settings of the desired Spice
* connection. * connection.
* *
* @return * @return
* A new rfbClient instance allocated and connected according to the * A new Spice session instance allocated and connected according to the
* parameters stored within the given client, or NULL if connecting to the * parameters stored within the given client, or NULL if connecting to the
* SPICE server fails. * Spice server fails.
*/ */
SpiceSession* guac_spice_get_session(guac_client* client); SpiceSession* guac_spice_get_session(guac_client* client);
/** /**
* SPICE client thread. This thread initiates the SPICE connection and * Spice client thread. This thread initiates the Spice connection and
* ultimately runs throughout the duration of the client, existing as a single * ultimately runs throughout the duration of the client, existing as a single
* instance, shared by all users. * instance, shared by all users.
* *
* @param data * @param data
* The guac_client instance associated with the requested SPICE connection. * The guac_client instance associated with the requested Spice connection.
* *
* @return * @return
* Always NULL. * Always NULL.

View File

@ -55,7 +55,7 @@ int guac_spice_user_join_handler(guac_user* user, int argc, char** argv) {
/* Store settings at user level */ /* Store settings at user level */
user->data = settings; user->data = settings;
/* Connect via SPICE if owner */ /* Connect via Spice if owner */
if (user->owner) { if (user->owner) {
/* Store owner's settings at client level */ /* Store owner's settings at client level */