diff --git a/src/libguac/client.c b/src/libguac/client.c index 80eb4ea7..64404534 100644 --- a/src/libguac/client.c +++ b/src/libguac/client.c @@ -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) { diff --git a/src/libguac/guacamole/client.h b/src/libguac/guacamole/client.h index 2d01573c..88d1f416 100644 --- a/src/libguac/guacamole/client.h +++ b/src/libguac/guacamole/client.h @@ -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 diff --git a/src/libguac/guacamole/user.h b/src/libguac/guacamole/user.h index f920c325..702160fa 100644 --- a/src/libguac/guacamole/user.h +++ b/src/libguac/guacamole/user.h @@ -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 diff --git a/src/libguac/user.c b/src/libguac/user.c index 9145b275..aaa51bb9 100644 --- a/src/libguac/user.c +++ b/src/libguac/user.c @@ -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) {