GUACAMOLE-629: Add convenience functions for immediately sending the current value of a connection parameter.

This commit is contained in:
Michael Jumper 2019-07-30 13:51:10 -07:00
parent c3a295e9b7
commit ca073db5b6
4 changed files with 93 additions and 0 deletions

View File

@ -516,6 +516,26 @@ int guac_client_get_processing_lag(guac_client* client) {
}
void guac_client_stream_argv(guac_client* client, guac_socket* socket,
const char* mimetype, const char* name, const char* value) {
/* Allocate new stream for argument value */
guac_stream* stream = guac_client_alloc_stream(client);
/* Declare stream as containing connection parameter data */
guac_protocol_send_argv(socket, stream, mimetype, name);
/* Write parameter data */
guac_protocol_send_blobs(socket, stream, value, strlen(value));
/* Terminate stream */
guac_protocol_send_end(socket, stream);
/* Free allocated stream */
guac_client_free_stream(client, stream);
}
void guac_client_stream_png(guac_client* client, guac_socket* socket,
guac_composite_mode mode, const guac_layer* layer, int x, int y,
cairo_surface_t* surface) {

View File

@ -548,6 +548,33 @@ int guac_client_load_plugin(guac_client* client, const char* protocol);
*/
int guac_client_get_processing_lag(guac_client* client);
/**
* Streams the given connection parameter value over an argument value stream
* ("argv" instruction), exposing the current value of the named connection
* parameter to all users of the given client. The argument value stream will
* be automatically allocated and freed.
*
* @param client
* The Guacamole client for which the argument value stream should be
* allocated.
*
* @param socket
* The socket over which instructions associated with the argument value
* stream should be sent.
*
* @param mimetype
* The mimetype of the data within the connection parameter value being
* sent.
*
* @param name
* The name of the connection parameter being sent.
*
* @param value
* The current value of the connection parameter being sent.
*/
void guac_client_stream_argv(guac_client* client, guac_socket* socket,
const char* mimetype, const char* name, const char* value);
/**
* Streams the image data of the given surface over an image stream ("img"
* instruction) as PNG-encoded data. The image stream will be automatically

View File

@ -676,6 +676,32 @@ guac_object* guac_user_alloc_object(guac_user* user);
*/
void guac_user_free_object(guac_user* user, guac_object* object);
/**
* Streams the given connection parameter value over an argument value stream
* ("argv" instruction), exposing the current value of the named connection
* parameter to the given user. The argument value stream will be automatically
* allocated and freed.
*
* @param user
* The Guacamole user who should receive the connection parameter value.
*
* @param socket
* The socket over which instructions associated with the argument value
* stream should be sent.
*
* @param mimetype
* The mimetype of the data within the connection parameter value being
* sent.
*
* @param name
* The name of the connection parameter being sent.
*
* @param value
* The current value of the connection parameter being sent.
*/
void guac_user_stream_argv(guac_user* user, guac_socket* socket,
const char* mimetype, const char* name, const char* value);
/**
* Streams the image data of the given surface over an image stream ("img"
* instruction) as PNG-encoded data. The image stream will be automatically

View File

@ -229,6 +229,26 @@ void guac_user_log(guac_user* user, guac_client_log_level level,
}
void guac_user_stream_argv(guac_user* user, guac_socket* socket,
const char* mimetype, const char* name, const char* value) {
/* Allocate new stream for argument value */
guac_stream* stream = guac_user_alloc_stream(user);
/* Declare stream as containing connection parameter data */
guac_protocol_send_argv(socket, stream, mimetype, name);
/* Write parameter data */
guac_protocol_send_blobs(socket, stream, value, strlen(value));
/* Terminate stream */
guac_protocol_send_end(socket, stream);
/* Free allocated stream */
guac_user_free_stream(user, stream);
}
void guac_user_stream_png(guac_user* user, guac_socket* socket,
guac_composite_mode mode, const guac_layer* layer, int x, int y,
cairo_surface_t* surface) {