GUACAMOLE-629: Merge add support for updating connection parameters of in-progress connections.
This commit is contained in:
commit
760f7a649a
@ -237,6 +237,36 @@ typedef int guac_user_file_handler(guac_user* user, guac_stream* stream,
|
|||||||
typedef int guac_user_pipe_handler(guac_user* user, guac_stream* stream,
|
typedef int guac_user_pipe_handler(guac_user* user, guac_stream* stream,
|
||||||
char* mimetype, char* name);
|
char* mimetype, char* name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for Guacamole argument value (argv) streams received from a user.
|
||||||
|
* Argument value streams are real-time revisions to the connection parameters
|
||||||
|
* of an in-progress connection. Each such argument value stream begins when
|
||||||
|
* the user sends a "argv" instruction. To handle received data along this
|
||||||
|
* stream, implementations of this handler must assign blob and end handlers to
|
||||||
|
* the given stream object.
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* The user that opened the argument value stream.
|
||||||
|
*
|
||||||
|
* @param stream
|
||||||
|
* The stream object allocated by libguac to represent the argument value
|
||||||
|
* stream opened by the user.
|
||||||
|
*
|
||||||
|
* @param mimetype
|
||||||
|
* The mimetype of the data that will be sent along the stream.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* The name of the connection parameter being updated. It is up to the
|
||||||
|
* implementation of this handler to decide whether and how to update a
|
||||||
|
* connection parameter.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* Zero if the opening of the argument value stream has been handled
|
||||||
|
* successfully, or non-zero if an error occurs.
|
||||||
|
*/
|
||||||
|
typedef int guac_user_argv_handler(guac_user* user, guac_stream* stream,
|
||||||
|
char* mimetype, char* name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for Guacamole stream blobs. Each blob originates from a "blob"
|
* Handler for Guacamole stream blobs. Each blob originates from a "blob"
|
||||||
* instruction which was associated with a previously-created stream.
|
* instruction which was associated with a previously-created stream.
|
||||||
|
@ -475,6 +475,27 @@ struct guac_user {
|
|||||||
*/
|
*/
|
||||||
guac_user_audio_handler* audio_handler;
|
guac_user_audio_handler* audio_handler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for argv events (updates to the connection parameters of an
|
||||||
|
* in-progress connection) sent by the Guacamole web-client.
|
||||||
|
*
|
||||||
|
* The handler takes a guac_stream which contains the stream index and
|
||||||
|
* will persist through the duration of the transfer, the mimetype of
|
||||||
|
* the data being transferred, and the argument (connection parameter)
|
||||||
|
* name.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* int argv_handler(guac_user* user, guac_stream* stream,
|
||||||
|
* char* mimetype, char* name);
|
||||||
|
*
|
||||||
|
* int guac_user_init(guac_user* user, int argc, char** argv) {
|
||||||
|
* user->argv_handler = argv_handler;
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
guac_user_argv_handler* argv_handler;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,6 +49,7 @@ __guac_instruction_handler_mapping __guac_instruction_handler_map[] = {
|
|||||||
{"get", __guac_handle_get},
|
{"get", __guac_handle_get},
|
||||||
{"put", __guac_handle_put},
|
{"put", __guac_handle_put},
|
||||||
{"audio", __guac_handle_audio},
|
{"audio", __guac_handle_audio},
|
||||||
|
{"argv", __guac_handle_argv},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -382,6 +383,30 @@ int __guac_handle_pipe(guac_user* user, int argc, char** argv) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __guac_handle_argv(guac_user* user, int argc, char** argv) {
|
||||||
|
|
||||||
|
/* Pull corresponding stream */
|
||||||
|
int stream_index = atoi(argv[0]);
|
||||||
|
guac_stream* stream = __init_input_stream(user, stream_index);
|
||||||
|
if (stream == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* If supported, call handler */
|
||||||
|
if (user->argv_handler)
|
||||||
|
return user->argv_handler(
|
||||||
|
user,
|
||||||
|
stream,
|
||||||
|
argv[1], /* mimetype */
|
||||||
|
argv[2] /* name */
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Otherwise, abort */
|
||||||
|
guac_protocol_send_ack(user->socket, stream,
|
||||||
|
"Reconfiguring in-progress connections unsupported",
|
||||||
|
GUAC_PROTOCOL_STATUS_UNSUPPORTED);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int __guac_handle_ack(guac_user* user, int argc, char** argv) {
|
int __guac_handle_ack(guac_user* user, int argc, char** argv) {
|
||||||
|
|
||||||
guac_stream* stream;
|
guac_stream* stream;
|
||||||
|
@ -120,6 +120,13 @@ __guac_instruction_handler __guac_handle_file;
|
|||||||
*/
|
*/
|
||||||
__guac_instruction_handler __guac_handle_pipe;
|
__guac_instruction_handler __guac_handle_pipe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal initial handler for the argv instruction. When a argv instruction
|
||||||
|
* is received, this handler will be called. The client's argv handler will
|
||||||
|
* be invoked if defined.
|
||||||
|
*/
|
||||||
|
__guac_instruction_handler __guac_handle_argv;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal initial handler for the ack instruction. When a ack instruction
|
* Internal initial handler for the ack instruction. When a ack instruction
|
||||||
* is received, this handler will be called. The client's ack handler will
|
* is received, this handler will be called. The client's ack handler will
|
||||||
|
Loading…
Reference in New Issue
Block a user