guacamole-spice-protocol/libguac/include/protocol.h

901 lines
32 KiB
C
Raw Normal View History

2010-12-08 21:14:04 +00:00
2011-02-16 02:04:36 +00:00
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
2010-12-08 21:14:04 +00:00
*
2011-02-16 02:04:36 +00:00
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
2010-12-08 21:14:04 +00:00
*
2011-02-16 02:04:36 +00:00
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
2010-12-08 21:14:04 +00:00
*
2011-02-16 02:04:36 +00:00
* The Original Code is libguac.
*
* The Initial Developer of the Original Code is
* Michael Jumper.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
2010-12-08 21:14:04 +00:00
#ifndef _GUAC_PROTOCOL_H
#define _GUAC_PROTOCOL_H
2010-12-08 21:14:04 +00:00
2011-03-27 23:32:49 +00:00
#include <cairo/cairo.h>
2010-12-08 21:14:04 +00:00
#include "socket.h"
2010-12-08 21:14:04 +00:00
/**
* Provides functions and structures required for communicating using the
* Guacamole protocol over a guac_socket connection, such as that provided by
2010-12-08 21:14:04 +00:00
* guac_client objects.
*
* @file protocol.h
*/
2011-11-21 10:05:05 +00:00
/**
* An arbitrary timestamp denoting a relative time value in milliseconds.
*/
typedef int64_t guac_timestamp;
2011-03-30 07:03:32 +00:00
/**
* Composite modes used by Guacamole draw instructions. Each
* composite mode maps to a unique channel mask integer.
*/
typedef enum guac_composite_mode {
2011-03-30 07:03:32 +00:00
/*
* A: Source where destination transparent = S n D'
* B: Source where destination opaque = S n D
* C: Destination where source transparent = D n S'
* D: Destination where source opaque = D n S
2011-03-30 07:03:32 +00:00
*
* 0 = Active, 1 = Inactive
*/
/* ABCD */
GUAC_COMP_ROUT = 0x2, /* 0010 - Clears destination where source opaque */
GUAC_COMP_ATOP = 0x6, /* 0110 - Fill where destination opaque only */
GUAC_COMP_XOR = 0xA, /* 1010 - XOR */
GUAC_COMP_ROVER = 0xB, /* 1011 - Fill where destination transparent only */
GUAC_COMP_OVER = 0xE, /* 1110 - Draw normally */
GUAC_COMP_PLUS = 0xF, /* 1111 - Add */
/* Unimplemented in client: */
/* NOT IMPLEMENTED: 0000 - Clear */
/* NOT IMPLEMENTED: 0011 - No operation */
/* NOT IMPLEMENTED: 0101 - Additive IN */
/* NOT IMPLEMENTED: 0111 - Additive ATOP */
/* NOT IMPLEMENTED: 1101 - Additive RATOP */
/* Buggy in webkit browsers, as they keep channel C on in all cases: */
GUAC_COMP_RIN = 0x1, /* 0001 */
GUAC_COMP_IN = 0x4, /* 0100 */
GUAC_COMP_OUT = 0x8, /* 1000 */
GUAC_COMP_RATOP = 0x9, /* 1001 */
GUAC_COMP_SRC = 0xC /* 1100 */
2012-02-21 16:20:32 +00:00
2012-02-27 09:02:04 +00:00
/* Bitwise composite operations (binary) */
/*
* A: S' & D'
* B: S' & D
* C: S & D'
* D: S & D
*
* 0 = Active, 1 = Inactive
*/
2011-03-30 07:03:32 +00:00
} guac_composite_mode;
2011-03-30 07:03:32 +00:00
/**
* Default transfer functions. There is no current facility in the
* Guacamole protocol to define custom transfer functions.
*/
typedef enum guac_transfer_function {
2012-02-27 21:14:19 +00:00
/* Constant functions */ /* ABCD */
GUAC_TRANSFER_BINARY_BLACK = 0x0, /* 0000 */
GUAC_TRANSFER_BINARY_WHITE = 0xF, /* 1111 */
2012-02-27 09:02:04 +00:00
2012-02-27 18:26:58 +00:00
/* Copy functions */
2012-02-27 21:14:19 +00:00
GUAC_TRANSFER_BINARY_SRC = 0x3, /* 0011 */
GUAC_TRANSFER_BINARY_DEST = 0x5, /* 0101 */
GUAC_TRANSFER_BINARY_NSRC = 0xC, /* 1100 */
GUAC_TRANSFER_BINARY_NDEST = 0xA, /* 1010 */
2012-02-27 09:02:04 +00:00
2012-02-27 18:26:58 +00:00
/* AND / NAND */
2012-02-27 21:14:19 +00:00
GUAC_TRANSFER_BINARY_AND = 0x1, /* 0001 */
GUAC_TRANSFER_BINARY_NAND = 0xE, /* 1110 */
2012-02-27 09:02:04 +00:00
2012-02-27 18:26:58 +00:00
/* OR / NOR */
2012-02-27 21:14:19 +00:00
GUAC_TRANSFER_BINARY_OR = 0x7, /* 0111 */
GUAC_TRANSFER_BINARY_NOR = 0x8, /* 1000 */
2012-02-27 09:02:04 +00:00
2012-02-27 18:26:58 +00:00
/* XOR / XNOR */
2012-02-27 21:14:19 +00:00
GUAC_TRANSFER_BINARY_XOR = 0x6, /* 0110 */
GUAC_TRANSFER_BINARY_XNOR = 0x9, /* 1001 */
2012-02-27 09:02:04 +00:00
2012-02-27 18:26:58 +00:00
/* AND / NAND with inverted source */
2012-02-27 21:14:19 +00:00
GUAC_TRANSFER_BINARY_NSRC_AND = 0x4, /* 0100 */
GUAC_TRANSFER_BINARY_NSRC_NAND = 0xB, /* 1011 */
2012-02-27 09:02:04 +00:00
2012-02-27 18:26:58 +00:00
/* OR / NOR with inverted source */
2012-02-27 21:14:19 +00:00
GUAC_TRANSFER_BINARY_NSRC_OR = 0xD, /* 1101 */
GUAC_TRANSFER_BINARY_NSRC_NOR = 0x2, /* 0010 */
2012-02-27 09:02:04 +00:00
2012-02-27 18:26:58 +00:00
/* AND / NAND with inverted destination */
2012-02-27 21:14:19 +00:00
GUAC_TRANSFER_BINARY_NDEST_AND = 0x2, /* 0010 */
GUAC_TRANSFER_BINARY_NDEST_NAND = 0xD, /* 1101 */
2012-02-27 09:02:04 +00:00
2012-02-27 18:26:58 +00:00
/* OR / NOR with inverted destination */
2012-02-27 21:14:19 +00:00
GUAC_TRANSFER_BINARY_NDEST_OR = 0xB, /* 1011 */
GUAC_TRANSFER_BINARY_NDEST_NOR = 0x4 /* 0100 */
2011-03-30 07:03:32 +00:00
} guac_transfer_function;
2011-03-30 07:03:32 +00:00
2012-03-06 20:42:38 +00:00
/**
* Supported line cap styles
*/
typedef enum guac_line_cap_style {
GUAC_LINE_CAP_BUTT = 0x0,
GUAC_LINE_CAP_ROUND = 0x1,
GUAC_LINE_CAP_SQUARE = 0x2
} guac_line_cap_style;
2012-03-06 20:42:38 +00:00
/**
* Supported line join styles
*/
typedef enum guac_line_join_style {
GUAC_LINE_JOIN_BEVEL = 0x0,
2012-03-12 06:17:16 +00:00
GUAC_LINE_JOIN_MITER = 0x1,
GUAC_LINE_JOIN_ROUND = 0x2
} guac_line_join_style;
2012-03-06 20:42:38 +00:00
/**
* Represents a single resource which can be requested or exposed via
* the Guacamole protocol.
*/
typedef struct guac_resource {
/**
* The index of this resource.
*/
int index;
/**
* Arbitrary data associated with this resource.
*/
void* data;
} guac_resource;
typedef struct guac_layer guac_layer;
/**
* Represents a single layer within the Guacamole protocol.
*/
struct guac_layer {
/**
* The index of this layer.
*/
int index;
2012-06-20 20:45:15 +00:00
/**
* The URI which must be passed via a resource instruction to denote
2012-06-20 20:45:15 +00:00
* a resource related to this layer. This value is automatically set
* upon allocation.
*/
char* uri;
2012-06-20 20:45:15 +00:00
/**
* The next allocated layer in the list of all layers.
*/
guac_layer* __next;
/**
* The next available (unused) layer in the list of
* allocated but free'd layers.
*/
guac_layer* __next_available;
};
2011-03-30 07:03:32 +00:00
2010-12-08 21:14:04 +00:00
/**
* Represents a single instruction within the Guacamole protocol.
*/
typedef struct guac_instruction {
/**
* The opcode of the instruction.
*/
char* opcode;
/**
* The number of arguments passed to this instruction.
*/
int argc;
/**
* Array of all arguments passed to this instruction.
2010-12-08 21:14:04 +00:00
*/
char** argv;
} guac_instruction;
/**
* Frees all memory allocated to the given instruction.
2010-12-08 21:14:04 +00:00
*
* @param instruction The instruction to free.
*/
void guac_instruction_free(guac_instruction* instruction);
2010-12-08 21:14:04 +00:00
/**
* Returns whether new instruction data is available on the given guac_socket
* connection for parsing.
2011-11-21 10:05:05 +00:00
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param usec_timeout The maximum number of microseconds to wait before
* giving up.
* @return A positive value if data is available, negative on error, or
* zero if no data is currently available.
*/
int guac_protocol_instructions_waiting(guac_socket* socket, int usec_timeout);
2010-12-08 21:14:04 +00:00
/**
* Reads a single instruction from the given guac_socket connection.
*
* If an error occurs reading the instruction, NULL is returned,
* and guac_error is set appropriately.
2010-12-08 21:14:04 +00:00
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param usec_timeout The maximum number of microseconds to wait before
* giving up.
* @return A new instruction if data was successfully read, NULL on
* error or if the instruction could not be read completely
* because the timeout elapsed, in which case guac_error will be
* set to GUAC_STATUS_INPUT_TIMEOUT and subsequent calls to
* guac_protocol_read_instruction() will return the parsed instruction
* once enough data is available.
2010-12-08 21:14:04 +00:00
*/
guac_instruction* guac_protocol_read_instruction(guac_socket* socket,
int usec_timeout);
2010-12-08 21:14:04 +00:00
2011-03-12 02:57:53 +00:00
/**
* Reads a single instruction with the given opcode from the given guac_socket
* connection.
2011-03-12 02:57:53 +00:00
*
* If an error occurs reading the instruction, NULL is returned,
* and guac_error is set appropriately.
*
* If the instruction read is not the expected instruction, NULL is returned,
* and guac_error is set to GUAC_STATUS_BAD_STATE.
2011-11-21 10:05:05 +00:00
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param usec_timeout The maximum number of microseconds to wait before
* giving up.
* @param opcode The opcode of the instruction to read.
* @return A new instruction if an instruction with the given opcode was read,
* NULL otherwise. If an instruction was read, but the instruction had
* a different opcode, NULL is returned and guac_error is set to
* GUAC_STATUS_BAD_STATE.
2011-03-12 02:57:53 +00:00
*/
guac_instruction* guac_protocol_expect_instruction(guac_socket* socket,
int usec_timeout, const char* opcode);
2011-03-12 02:57:53 +00:00
2010-12-08 21:14:04 +00:00
/**
* Returns an arbitrary timestamp. The difference between return values of any
* two calls is equal to the amount of time in milliseconds between those
* calls. The return value from a single call will not have any useful
* (or defined) meaning.
*
* @return An arbitrary millisecond timestamp.
*/
guac_timestamp guac_protocol_get_timestamp();
/* CONTROL INSTRUCTIONS */
2012-06-20 20:45:15 +00:00
/**
* Sends an args instruction over the given guac_socket connection.
2012-06-20 20:45:15 +00:00
*
* 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 args The NULL-terminated array of argument names (strings).
2012-06-20 20:45:15 +00:00
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_args(guac_socket* socket, const char** args);
2012-06-20 20:45:15 +00:00
/**
* Sends a connect instruction over the given guac_socket connection.
2010-12-08 21:14:04 +00:00
*
2011-11-21 10:05:05 +00:00
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param args The NULL-terminated array of argument values (strings).
* @return Zero on success, non-zero on error.
2010-12-08 21:14:04 +00:00
*/
int guac_protocol_send_connect(guac_socket* socket, const char** args);
2012-03-11 04:56:00 +00:00
/**
* Sends a data instruction over the given guac_socket connection.
2012-03-11 04:56:00 +00:00
*
* 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 resource The resource associated with the data being sent.
* @param data The data to send.
* @param size The number of bytes from the beginning of the given buffer
* of data to send.
2012-03-11 04:56:00 +00:00
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_data(guac_socket* socket, guac_resource* resource,
const unsigned char* data, size_t size);
2012-03-11 04:56:00 +00:00
/**
* Sends a disconnect 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.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_disconnect(guac_socket* socket);
2010-12-08 21:14:04 +00:00
/**
* Sends an end instruction over the given guac_socket connection.
2010-12-08 21:14:04 +00:00
*
2011-11-21 10:05:05 +00:00
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param resource The resource being closed.
* @return Zero on success, non-zero on error.
2010-12-08 21:14:04 +00:00
*/
int guac_protocol_send_end(guac_socket* socket, guac_resource* resource);
2012-06-20 20:45:15 +00:00
/**
* Sends an error instruction over the given guac_socket connection.
2012-06-20 20:45:15 +00:00
*
* 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 error The description associated with the error.
2012-06-20 20:45:15 +00:00
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_error(guac_socket* socket, const char* error);
2012-06-20 20:45:15 +00:00
/**
* Sends a resource 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 resource The resource being exposed.
* @param uri The URI this resource should be exposed to.
* @param mimetypes A NULL-terminated array of strings, where each string is
* an available mimetype.
2012-06-20 20:45:15 +00:00
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_resource(guac_socket* socket, guac_resource* resource,
const char* uri, const char** mimetypes);
2012-06-20 20:45:15 +00:00
2012-03-11 04:56:00 +00:00
/**
* Sends a set 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.
2012-03-13 19:06:11 +00:00
* @param layer The layer to set the parameter of.
2012-03-11 04:56:00 +00:00
* @param name The name of the parameter to set.
* @param value The value to set the parameter to.
* @return Zero on success, non-zero on error.
*/
2012-03-13 19:06:11 +00:00
int guac_protocol_send_set(guac_socket* socket, const guac_layer* layer,
const char* name, const char* value);
2012-03-11 04:56:00 +00:00
/**
* Sends a select 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 protocol The protocol to request.
2012-03-11 04:56:00 +00:00
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_select(guac_socket* socket, const char* protocol);
2010-12-08 21:14:04 +00:00
/**
* Sends a sync instruction over the given guac_socket connection. The
* current time in milliseconds should be passed in as the timestamp.
2010-12-08 21:14:04 +00:00
*
2011-11-21 10:05:05 +00:00
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param timestamp The current timestamp (in milliseconds).
* @return Zero on success, non-zero on error.
2010-12-08 21:14:04 +00:00
*/
int guac_protocol_send_sync(guac_socket* socket, guac_timestamp timestamp);
/* DRAWING INSTRUCTIONS */
/**
* Sends an arc 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 layer The destination layer.
* @param x The X coordinate of the center of the circle containing the arc.
* @param y The Y coordinate of the center of the circle containing the arc.
* @param radius The radius of the circle containing the arc.
* @param startAngle The starting angle, in radians.
* @param endAngle The ending angle, in radians.
2012-03-14 02:07:24 +00:00
* @param negative Zero if the arc should be drawn in order of increasing
* angle, non-zero otherwise.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_arc(guac_socket* socket, const guac_layer* layer,
2012-03-14 02:07:24 +00:00
int x, int y, int radius, double startAngle, double endAngle,
int negative);
/**
* Sends a cfill 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 mode The composite mode to use.
* @param layer The destination layer.
* @param r The red component of the color of the rectangle.
* @param g The green component of the color of the rectangle.
* @param b The blue component of the color of the rectangle.
* @param a The alpha (transparency) component of the color of the rectangle.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_cfill(guac_socket* socket,
guac_composite_mode mode, const guac_layer* layer,
int r, int g, int b, int a);
2010-12-08 21:14:04 +00:00
2012-02-20 20:41:23 +00:00
/**
* Sends a clip instruction over the given guac_socket connection.
2012-02-20 20:41:23 +00:00
*
* 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 layer The layer to set the clipping region of.
2012-02-20 20:41:23 +00:00
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_clip(guac_socket* socket, const guac_layer* layer);
2012-02-20 20:41:23 +00:00
/**
* Sends a close 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 layer The destination layer.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_close(guac_socket* socket, const guac_layer* layer);
2010-12-08 21:14:04 +00:00
/**
* Sends a copy instruction over the given guac_socket connection.
2010-12-08 21:14:04 +00:00
*
2011-11-21 10:05:05 +00:00
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param srcl The source layer.
2010-12-08 21:14:04 +00:00
* @param srcx The X coordinate of the source rectangle.
* @param srcy The Y coordinate of the source rectangle.
* @param w The width of the source rectangle.
* @param h The height of the source rectangle.
2011-03-30 07:03:32 +00:00
* @param mode The composite mode to use.
* @param dstl The destination layer.
2010-12-08 21:14:04 +00:00
* @param dstx The X coordinate of the destination, where the source rectangle
* should be copied.
* @param dsty The Y coordinate of the destination, where the source rectangle
* should be copied.
* @return Zero on success, non-zero on error.
2010-12-08 21:14:04 +00:00
*/
2011-11-26 00:34:43 +00:00
int guac_protocol_send_copy(guac_socket* socket,
const guac_layer* srcl, int srcx, int srcy, int w, int h,
guac_composite_mode mode, const guac_layer* dstl, int dstx, int dsty);
2010-12-08 21:14:04 +00:00
/**
* Sends a cstroke 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 mode The composite mode to use.
* @param layer The destination layer.
* @param cap The style of line cap to use when drawing the stroke.
* @param join The style of line join to use when drawing the stroke.
* @param thickness The thickness of the stroke in pixels.
* @param r The red component of the color of the rectangle.
* @param g The green component of the color of the rectangle.
* @param b The blue component of the color of the rectangle.
* @param a The alpha (transparency) component of the color of the rectangle.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_cstroke(guac_socket* socket,
guac_composite_mode mode, const guac_layer* layer,
guac_line_cap_style cap, guac_line_join_style join, int thickness,
int r, int g, int b, int a);
/**
* Sends a cursor 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 x The X coordinate of the cursor hotspot.
* @param y The Y coordinate of the cursor hotspot.
* @param srcl The source layer.
* @param srcx The X coordinate of the source rectangle.
* @param srcy The Y coordinate of the source rectangle.
* @param w The width of the source rectangle.
* @param h The height of the source rectangle.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_cursor(guac_socket* socket, int x, int y,
const guac_layer* srcl, int srcx, int srcy, int w, int h);
/**
* Sends a curve 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 layer The destination layer.
* @param cp1x The X coordinate of the first control point.
* @param cp1y The Y coordinate of the first control point.
* @param cp2x The X coordinate of the second control point.
* @param cp2y The Y coordinate of the second control point.
* @param x The X coordinate of the endpoint of the curve.
* @param y The Y coordinate of the endpoint of the curve.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_curve(guac_socket* socket, const guac_layer* layer,
int cp1x, int cp1y, int cp2x, int cp2y, int x, int y);
/**
* Sends an identity 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 layer The destination layer.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_identity(guac_socket* socket, const guac_layer* layer);
/**
* Sends an lfill 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 mode The composite mode to use.
* @param layer The destination layer.
* @param srcl The source layer.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_lfill(guac_socket* socket,
guac_composite_mode mode, const guac_layer* layer,
const guac_layer* srcl);
/**
* Sends a line 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 layer The destination layer.
* @param x The X coordinate of the endpoint of the line.
* @param y The Y coordinate of the endpoint of the line.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_line(guac_socket* socket, const guac_layer* layer,
int x, int y);
2011-07-21 22:15:58 +00:00
/**
* Sends an lstroke instruction over the given guac_socket connection.
2011-07-21 22:15:58 +00:00
*
2011-11-21 10:05:05 +00:00
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param mode The composite mode to use.
2011-07-21 22:15:58 +00:00
* @param layer The destination layer.
* @param cap The style of line cap to use when drawing the stroke.
* @param join The style of line join to use when drawing the stroke.
* @param thickness The thickness of the stroke in pixels.
* @param srcl The source layer.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_lstroke(guac_socket* socket,
guac_composite_mode mode, const guac_layer* layer,
guac_line_cap_style cap, guac_line_join_style join, int thickness,
const guac_layer* srcl);
/**
* Sends a png instruction over the given guac_socket connection. The PNG image
* data given will be automatically base64-encoded for transmission.
*
* 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 mode The composite mode to use.
* @param layer The destination layer.
* @param x The destination X coordinate.
* @param y The destination Y coordinate.
* @param surface A cairo surface containing the image data to send.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_png(guac_socket* socket, guac_composite_mode mode,
const guac_layer* layer, int x, int y, cairo_surface_t* surface);
/**
* Sends a pop 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 layer The layer to set the clipping region of.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_pop(guac_socket* socket, const guac_layer* layer);
/**
* Sends a push 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 layer The layer to set the clipping region of.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_push(guac_socket* socket, const guac_layer* layer);
/**
* Sends a rect 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 layer The destination layer.
* @param x The X coordinate of the rectangle.
* @param y The Y coordinate of the rectangle.
* @param width The width of the rectangle.
* @param height The height of the rectangle.
* @return Zero on success, non-zero on error.
2011-07-21 22:15:58 +00:00
*/
int guac_protocol_send_rect(guac_socket* socket, const guac_layer* layer,
int x, int y, int width, int height);
2011-07-21 22:15:58 +00:00
/**
* Sends a reset 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 layer The layer to set the clipping region of.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_reset(guac_socket* socket, const guac_layer* layer);
/**
* Sends a start 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 layer The destination layer.
* @param x The X coordinate of the first point of the subpath.
* @param y The Y coordinate of the first point of the subpath.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_start(guac_socket* socket, const guac_layer* layer,
int x, int y);
2011-07-21 22:15:58 +00:00
/**
* Sends a transfer instruction over the given guac_socket connection.
*
2011-11-21 10:05:05 +00:00
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param srcl The source layer.
* @param srcx The X coordinate of the source rectangle.
* @param srcy The Y coordinate of the source rectangle.
* @param w The width of the source rectangle.
* @param h The height of the source rectangle.
* @param fn The transfer function to use.
* @param dstl The destination layer.
* @param dstx The X coordinate of the destination, where the source rectangle
* should be copied.
* @param dsty The Y coordinate of the destination, where the source rectangle
* should be copied.
* @return Zero on success, non-zero on error.
2011-07-21 22:15:58 +00:00
*/
int guac_protocol_send_transfer(guac_socket* socket,
const guac_layer* srcl, int srcx, int srcy, int w, int h,
guac_transfer_function fn, const guac_layer* dstl, int dstx, int dsty);
2012-03-11 04:56:00 +00:00
/**
* Sends a transform 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 layer The layer to apply the given transform matrix to.
* @param a The first value of the affine transform matrix.
* @param b The second value of the affine transform matrix.
* @param c The third value of the affine transform matrix.
* @param d The fourth value of the affine transform matrix.
* @param e The fifth value of the affine transform matrix.
* @param f The sixth value of the affine transform matrix.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_transform(guac_socket* socket,
const guac_layer* layer,
double a, double b, double c,
double d, double e, double f);
/* LAYER INSTRUCTIONS */
/**
* Sends a dispose 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 layer The layer to dispose.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_dispose(guac_socket* socket, const guac_layer* layer);
2012-03-11 04:56:00 +00:00
/**
* Sends a distort 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 layer The layer to distort with the given transform matrix.
* @param a The first value of the affine transform matrix.
* @param b The second value of the affine transform matrix.
* @param c The third value of the affine transform matrix.
* @param d The fourth value of the affine transform matrix.
* @param e The fifth value of the affine transform matrix.
* @param f The sixth value of the affine transform matrix.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_distort(guac_socket* socket,
const guac_layer* layer,
double a, double b, double c,
double d, double e, double f);
/**
* Sends a move 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 layer The layer to move.
* @param parent The parent layer the specified layer will be positioned
* relative to.
* @param x The X coordinate of the layer.
* @param y The Y coordinate of the layer.
* @param z The Z index of the layer, relative to other layers in its parent.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_move(guac_socket* socket, const guac_layer* layer,
const guac_layer* parent, int x, int y, int z);
2012-03-11 04:56:00 +00:00
/**
* Sends a shade 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 layer The layer to shade.
* @param a The alpha value of the layer.
* @return Zero on success, non-zero on error.
*/
int guac_protocol_send_shade(guac_socket* socket, const guac_layer* layer,
int a);
2011-07-21 22:15:58 +00:00
2010-12-08 21:14:04 +00:00
/**
* Sends a size instruction over the given guac_socket connection.
2010-12-08 21:14:04 +00:00
*
2011-11-21 10:05:05 +00:00
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param layer The layer to resize.
* @param w The new width of the layer.
* @param h The new height of the layer.
* @return Zero on success, non-zero on error.
2010-12-08 21:14:04 +00:00
*/
int guac_protocol_send_size(guac_socket* socket, const guac_layer* layer,
int w, int h);
/* TEXT INSTRUCTIONS */
2010-12-08 21:14:04 +00:00
/**
* Sends a clipboard instruction over the given guac_socket connection.
2010-12-08 21:14:04 +00:00
*
2011-11-21 10:05:05 +00:00
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param data The clipboard data to send.
* @return Zero on success, non-zero on error.
2010-12-08 21:14:04 +00:00
*/
int guac_protocol_send_clipboard(guac_socket* socket, const char* data);
/**
* Sends a name instruction over the given guac_socket connection.
*
2011-11-26 00:34:43 +00:00
* @param socket The guac_socket connection to use.
* @param name The name to send within the name instruction.
* @return Zero on success, non-zero on error.
2011-11-21 10:05:05 +00:00
*/
int guac_protocol_send_name(guac_socket* socket, const char* name);
2011-11-21 10:05:05 +00:00
2010-12-08 21:14:04 +00:00
#endif