Add nest instruction.

This commit is contained in:
Michael Jumper 2012-10-19 13:45:06 -07:00
parent ffc6b389b8
commit 518903483d
2 changed files with 27 additions and 0 deletions

View File

@ -215,6 +215,22 @@ int guac_protocol_send_disconnect(guac_socket* socket);
*/
int guac_protocol_send_error(guac_socket* socket, const char* error);
/**
* Sends a nest instruction over the given guac_socket connection.
*
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
* @param socket The guac_socket connection to use.
* @param index The integer index of the stram to send the protocol
* data over.
* @param data A string containing protocol data, which must be UTF-8
* encoded and null-terminated.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_nest(guac_socket* socket, int index,
const char* data);
/**
* Sends a set instruction over the given guac_socket connection.
*

View File

@ -715,6 +715,17 @@ int guac_protocol_send_name(guac_socket* socket, const char* name) {
}
int guac_protocol_send_nest(guac_socket* socket, int index,
const char* data) {
return
guac_socket_write_string(socket, "4.nest,")
|| __guac_socket_write_length_int(socket, index)
|| guac_socket_write_string(socket, ",")
|| __guac_socket_write_length_string(socket, data)
|| guac_socket_write_string(socket, ";");
}
int guac_protocol_send_png(guac_socket* socket, guac_composite_mode mode,
const guac_layer* layer, int x, int y, cairo_surface_t* surface) {