libguac  0.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Enumerations | Functions
protocol.h File Reference

Provides functions and structures required for communicating using the Guacamole protocol over a guac_socket connection, such as that provided by guac_client objects. More...

Go to the source code of this file.

Enumerations

enum  guac_protocol_status {
  GUAC_PROTOCOL_STATUS_SUCCESS = 0x0000, GUAC_PROTOCOL_STATUS_UNSUPPORTED = 0x0100, GUAC_PROTOCOL_STATUS_SERVER_ERROR = 0x0200, GUAC_PROTOCOL_STATUS_SERVER_BUSY = 0x0201,
  GUAC_PROTOCOL_STATUS_UPSTREAM_TIMEOUT = 0x202, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR = 0x203, GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND = 0x204, GUAC_PROTOCOL_STATUS_RESOURCE_CONFLICT = 0x205,
  GUAC_PROTOCOL_STATUS_CLIENT_BAD_REQUEST = 0x300, GUAC_PROTOCOL_STATUS_CLIENT_UNAUTHORIZED = 0x0301, GUAC_PROTOCOL_STATUS_CLIENT_FORBIDDEN = 0x0303, GUAC_PROTOCOL_STATUS_CLIENT_TIMEOUT = 0x308,
  GUAC_PROTOCOL_STATUS_CLIENT_OVERRUN = 0x30D, GUAC_PROTOCOL_STATUS_CLIENT_BAD_TYPE = 0x30F, GUAC_PROTOCOL_STATUS_CLIENT_TOO_MANY = 0x31D
}
 Set of all possible status codes returned by protocol operations. More...
enum  guac_composite_mode {
  GUAC_COMP_ROUT = 0x2, GUAC_COMP_ATOP = 0x6, GUAC_COMP_XOR = 0xA, GUAC_COMP_ROVER = 0xB,
  GUAC_COMP_OVER = 0xE, GUAC_COMP_PLUS = 0xF, GUAC_COMP_RIN = 0x1, GUAC_COMP_IN = 0x4,
  GUAC_COMP_OUT = 0x8, GUAC_COMP_RATOP = 0x9, GUAC_COMP_SRC = 0xC
}
 Composite modes used by Guacamole draw instructions. More...
enum  guac_transfer_function {
  GUAC_TRANSFER_BINARY_BLACK = 0x0, GUAC_TRANSFER_BINARY_WHITE = 0xF, GUAC_TRANSFER_BINARY_SRC = 0x3, GUAC_TRANSFER_BINARY_DEST = 0x5,
  GUAC_TRANSFER_BINARY_NSRC = 0xC, GUAC_TRANSFER_BINARY_NDEST = 0xA, GUAC_TRANSFER_BINARY_AND = 0x1, GUAC_TRANSFER_BINARY_NAND = 0xE,
  GUAC_TRANSFER_BINARY_OR = 0x7, GUAC_TRANSFER_BINARY_NOR = 0x8, GUAC_TRANSFER_BINARY_XOR = 0x6, GUAC_TRANSFER_BINARY_XNOR = 0x9,
  GUAC_TRANSFER_BINARY_NSRC_AND = 0x4, GUAC_TRANSFER_BINARY_NSRC_NAND = 0xB, GUAC_TRANSFER_BINARY_NSRC_OR = 0xD, GUAC_TRANSFER_BINARY_NSRC_NOR = 0x2,
  GUAC_TRANSFER_BINARY_NDEST_AND = 0x2, GUAC_TRANSFER_BINARY_NDEST_NAND = 0xD, GUAC_TRANSFER_BINARY_NDEST_OR = 0xB, GUAC_TRANSFER_BINARY_NDEST_NOR = 0x4
}
 Default transfer functions. More...
enum  guac_line_cap_style { GUAC_LINE_CAP_BUTT = 0x0, GUAC_LINE_CAP_ROUND = 0x1, GUAC_LINE_CAP_SQUARE = 0x2 }
 Supported line cap styles.
enum  guac_line_join_style { GUAC_LINE_JOIN_BEVEL = 0x0, GUAC_LINE_JOIN_MITER = 0x1, GUAC_LINE_JOIN_ROUND = 0x2 }
 Supported line join styles.

Functions

int guac_protocol_send_ack (guac_socket *socket, guac_stream *stream, const char *error, guac_protocol_status status)
 Sends an ack instruction over the given guac_socket connection.
int guac_protocol_send_args (guac_socket *socket, const char **args)
 Sends an args instruction over the given guac_socket connection.
int guac_protocol_send_connect (guac_socket *socket, const char **args)
 Sends a connect instruction over the given guac_socket connection.
int guac_protocol_send_disconnect (guac_socket *socket)
 Sends a disconnect instruction over the given guac_socket connection.
int guac_protocol_send_error (guac_socket *socket, const char *error, guac_protocol_status status)
 Sends an error instruction over the given guac_socket connection.
int guac_protocol_send_log (guac_socket *socket, const char *format,...)
 Sends a log instruction over the given guac_socket connection.
int vguac_protocol_send_log (guac_socket *socket, const char *format, va_list args)
 Sends a log instruction over the given guac_socket connection.
int guac_protocol_send_nest (guac_socket *socket, int index, const char *data)
 Sends a nest instruction over the given guac_socket connection.
int guac_protocol_send_nop (guac_socket *socket)
 Sends a nop instruction (null-operation) over the given guac_socket connection.
int guac_protocol_send_set (guac_socket *socket, const guac_layer *layer, const char *name, const char *value)
 Sends a set instruction over the given guac_socket connection.
int guac_protocol_send_select (guac_socket *socket, const char *protocol)
 Sends a select instruction over the given guac_socket connection.
int guac_protocol_send_sync (guac_socket *socket, guac_timestamp timestamp)
 Sends a sync instruction over the given guac_socket connection.
int guac_protocol_send_audio (guac_socket *socket, const guac_stream *stream, int channel, const char *mimetype, double duration)
 Sends an audio instruction over the given guac_socket connection.
int guac_protocol_send_file (guac_socket *socket, const guac_stream *stream, const char *mimetype, const char *name)
 Sends a file instruction over the given guac_socket connection.
int guac_protocol_send_pipe (guac_socket *socket, const guac_stream *stream, const char *mimetype, const char *name)
 Sends a pipe instruction over the given guac_socket connection.
int guac_protocol_send_blob (guac_socket *socket, const guac_stream *stream, void *data, int count)
 Writes a block of data to the currently in-progress blob which was already created.
int guac_protocol_send_end (guac_socket *socket, const guac_stream *stream)
 Sends an end instruction over the given guac_socket connection.
int guac_protocol_send_video (guac_socket *socket, const guac_stream *stream, const guac_layer *layer, const char *mimetype, double duration)
 Sends a video instruction over the given guac_socket connection.
int guac_protocol_send_arc (guac_socket *socket, const guac_layer *layer, int x, int y, int radius, double startAngle, double endAngle, int negative)
 Sends an arc instruction over the given guac_socket connection.
int guac_protocol_send_cfill (guac_socket *socket, guac_composite_mode mode, const guac_layer *layer, int r, int g, int b, int a)
 Sends a cfill instruction over the given guac_socket connection.
int guac_protocol_send_clip (guac_socket *socket, const guac_layer *layer)
 Sends a clip instruction over the given guac_socket connection.
int guac_protocol_send_close (guac_socket *socket, const guac_layer *layer)
 Sends a close instruction over the given guac_socket connection.
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)
 Sends a copy instruction over the given guac_socket connection.
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 cstroke instruction over the given guac_socket connection.
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 cursor instruction over the given guac_socket connection.
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 a curve instruction over the given guac_socket connection.
int guac_protocol_send_identity (guac_socket *socket, const guac_layer *layer)
 Sends an identity instruction over the given guac_socket connection.
int guac_protocol_send_lfill (guac_socket *socket, guac_composite_mode mode, const guac_layer *layer, const guac_layer *srcl)
 Sends an lfill instruction over the given guac_socket connection.
int guac_protocol_send_line (guac_socket *socket, const guac_layer *layer, int x, int y)
 Sends a line instruction over the given guac_socket connection.
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 an lstroke instruction over the given guac_socket connection.
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 png instruction over the given guac_socket connection.
int guac_protocol_send_pop (guac_socket *socket, const guac_layer *layer)
 Sends a pop instruction over the given guac_socket connection.
int guac_protocol_send_push (guac_socket *socket, const guac_layer *layer)
 Sends a push instruction over the given guac_socket connection.
int guac_protocol_send_rect (guac_socket *socket, const guac_layer *layer, int x, int y, int width, int height)
 Sends a rect instruction over the given guac_socket connection.
int guac_protocol_send_reset (guac_socket *socket, const guac_layer *layer)
 Sends a reset instruction over the given guac_socket connection.
int guac_protocol_send_start (guac_socket *socket, const guac_layer *layer, int x, int y)
 Sends a start instruction over the given guac_socket connection.
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)
 Sends a transfer instruction over the given guac_socket connection.
int guac_protocol_send_transform (guac_socket *socket, const guac_layer *layer, double a, double b, double c, double d, double e, double f)
 Sends a transform instruction over the given guac_socket connection.
int guac_protocol_send_dispose (guac_socket *socket, const guac_layer *layer)
 Sends a dispose instruction over the given guac_socket connection.
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 distort instruction over the given guac_socket connection.
int guac_protocol_send_move (guac_socket *socket, const guac_layer *layer, const guac_layer *parent, int x, int y, int z)
 Sends a move instruction over the given guac_socket connection.
int guac_protocol_send_shade (guac_socket *socket, const guac_layer *layer, int a)
 Sends a shade instruction over the given guac_socket connection.
int guac_protocol_send_size (guac_socket *socket, const guac_layer *layer, int w, int h)
 Sends a size instruction over the given guac_socket connection.
int guac_protocol_send_clipboard (guac_socket *socket, const char *data)
 Sends a clipboard instruction over the given guac_socket connection.
int guac_protocol_send_name (guac_socket *socket, const char *name)
 Sends a name instruction over the given guac_socket connection.
int guac_protocol_decode_base64 (char *base64)
 Decodes the given base64-encoded string in-place.

Detailed Description

Provides functions and structures required for communicating using the Guacamole protocol over a guac_socket connection, such as that provided by guac_client objects.

Enumeration Type Documentation

Composite modes used by Guacamole draw instructions.

Each composite mode maps to a unique channel mask integer.

Set of all possible status codes returned by protocol operations.

These codes relate to Guacamole server/client communication, and not to internal communication of errors within libguac and linked software.

In general:

0x0000 - 0x00FF: Successful operations.
0x0100 - 0x01FF: Operations that failed due to implementation status.
0x0200 - 0x02FF: Operations that failed due to environmental.
0x0300 - 0x03FF: Operations that failed due to user action.

There is a general correspondence of these status codes with HTTP response codes.

Enumerator:
GUAC_PROTOCOL_STATUS_SUCCESS 

The operation succeeded.

GUAC_PROTOCOL_STATUS_UNSUPPORTED 

The requested operation is unsupported.

GUAC_PROTOCOL_STATUS_SERVER_ERROR 

The operation could not be performed due to an internal failure.

GUAC_PROTOCOL_STATUS_SERVER_BUSY 

The operation could not be performed due as the server is busy.

GUAC_PROTOCOL_STATUS_UPSTREAM_TIMEOUT 

The operation could not be performed because the upstream server is not responding.

GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR 

The operation was unsuccessful due to an error or otherwise unexpected condition of the upstream server.

GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND 

The operation could not be performed as the requested resource does not exist.

GUAC_PROTOCOL_STATUS_RESOURCE_CONFLICT 

The operation could not be performed as the requested resource is already in use.

GUAC_PROTOCOL_STATUS_CLIENT_BAD_REQUEST 

The operation could not be performed because bad parameters were given.

GUAC_PROTOCOL_STATUS_CLIENT_UNAUTHORIZED 

Permission was denied to perform the operation, as the user is not yet authorized (not yet logged in, for example).

GUAC_PROTOCOL_STATUS_CLIENT_FORBIDDEN 

Permission was denied to perform the operation, and this permission will not be granted even if the user is authorized.

GUAC_PROTOCOL_STATUS_CLIENT_TIMEOUT 

The client took too long to respond.

GUAC_PROTOCOL_STATUS_CLIENT_OVERRUN 

The client sent too much data.

GUAC_PROTOCOL_STATUS_CLIENT_BAD_TYPE 

The client sent data of an unsupported or unexpected type.

GUAC_PROTOCOL_STATUS_CLIENT_TOO_MANY 

The operation failed because the current client is already using too many resources.

Default transfer functions.

There is no current facility in the Guacamole protocol to define custom transfer functions.

Function Documentation

int guac_protocol_decode_base64 ( char *  base64)

Decodes the given base64-encoded string in-place.

The base64 string must be NULL-terminated.

Parameters
base64The base64-encoded string to decode.
Returns
The number of bytes resulting from the decode operation.
int guac_protocol_send_ack ( guac_socket socket,
guac_stream stream,
const char *  error,
guac_protocol_status  status 
)

Sends an ack 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.

Parameters
socketThe guac_socket connection to use.
streamThe guac_stream associated with the operation this ack is acknowledging.
errorThe human-readable description associated with the error or status update.
statusThe status code related to the error or status.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_arc ( guac_socket socket,
const guac_layer layer,
int  x,
int  y,
int  radius,
double  startAngle,
double  endAngle,
int  negative 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe destination layer.
xThe X coordinate of the center of the circle containing the arc.
yThe Y coordinate of the center of the circle containing the arc.
radiusThe radius of the circle containing the arc.
startAngleThe starting angle, in radians.
endAngleThe ending angle, in radians.
negativeZero if the arc should be drawn in order of increasing angle, non-zero otherwise.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_args ( guac_socket socket,
const char **  args 
)

Sends an args 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.

Parameters
socketThe guac_socket connection to use.
argsThe NULL-terminated array of argument names (strings).
Returns
Zero on success, non-zero on error.
int guac_protocol_send_audio ( guac_socket socket,
const guac_stream stream,
int  channel,
const char *  mimetype,
double  duration 
)

Sends an audio 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.

Parameters
socketThe guac_socket connection to use.
streamThe stream to use.
channelThe index of the audio channel to use.
mimetypeThe mimetype of the data being sent.
durationThe duration of the sound being sent, in milliseconds.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_blob ( guac_socket socket,
const guac_stream stream,
void *  data,
int  count 
)

Writes a block of data to the currently in-progress blob which was already created.

If an error occurs sending the instruction, a non-zero value is returned, and guac_error is set appropriately.

Parameters
socketThe guac_socket connection to use.
streamThe stream to use.
dataThe file data to write.
countThe number of bytes within the given buffer of file data that must be written.
Returns
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 
)

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.

Parameters
socketThe guac_socket connection to use.
modeThe composite mode to use.
layerThe destination layer.
rThe red component of the color of the rectangle.
gThe green component of the color of the rectangle.
bThe blue component of the color of the rectangle.
aThe alpha (transparency) component of the color of the rectangle.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_clip ( guac_socket socket,
const guac_layer layer 
)

Sends a clip 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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to set the clipping region of.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_clipboard ( guac_socket socket,
const char *  data 
)

Sends a clipboard 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.

Parameters
socketThe guac_socket connection to use.
dataThe clipboard data to send.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_close ( guac_socket socket,
const guac_layer layer 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe destination layer.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_connect ( guac_socket socket,
const char **  args 
)

Sends a connect 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.

Parameters
socketThe guac_socket connection to use.
argsThe NULL-terminated array of argument values (strings).
Returns
Zero on success, non-zero on error.
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 
)

Sends a copy 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.

Parameters
socketThe guac_socket connection to use.
srclThe source layer.
srcxThe X coordinate of the source rectangle.
srcyThe Y coordinate of the source rectangle.
wThe width of the source rectangle.
hThe height of the source rectangle.
modeThe composite mode to use.
dstlThe destination layer.
dstxThe X coordinate of the destination, where the source rectangle should be copied.
dstyThe Y coordinate of the destination, where the source rectangle should be copied.
Returns
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 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.

Parameters
socketThe guac_socket connection to use.
modeThe composite mode to use.
layerThe destination layer.
capThe style of line cap to use when drawing the stroke.
joinThe style of line join to use when drawing the stroke.
thicknessThe thickness of the stroke in pixels.
rThe red component of the color of the rectangle.
gThe green component of the color of the rectangle.
bThe blue component of the color of the rectangle.
aThe alpha (transparency) component of the color of the rectangle.
Returns
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 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.

Parameters
socketThe guac_socket connection to use.
xThe X coordinate of the cursor hotspot.
yThe Y coordinate of the cursor hotspot.
srclThe source layer.
srcxThe X coordinate of the source rectangle.
srcyThe Y coordinate of the source rectangle.
wThe width of the source rectangle.
hThe height of the source rectangle.
Returns
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 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.

Parameters
socketThe guac_socket connection to use.
layerThe destination layer.
cp1xThe X coordinate of the first control point.
cp1yThe Y coordinate of the first control point.
cp2xThe X coordinate of the second control point.
cp2yThe Y coordinate of the second control point.
xThe X coordinate of the endpoint of the curve.
yThe Y coordinate of the endpoint of the curve.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_disconnect ( guac_socket socket)

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.

Parameters
socketThe guac_socket connection to use.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_dispose ( guac_socket socket,
const guac_layer layer 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to dispose.
Returns
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 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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to distort with the given transform matrix.
aThe first value of the affine transform matrix.
bThe second value of the affine transform matrix.
cThe third value of the affine transform matrix.
dThe fourth value of the affine transform matrix.
eThe fifth value of the affine transform matrix.
fThe sixth value of the affine transform matrix.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_end ( guac_socket socket,
const guac_stream stream 
)

Sends an end 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.

Parameters
socketThe guac_socket connection to use.
streamThe stream to use.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_error ( guac_socket socket,
const char *  error,
guac_protocol_status  status 
)

Sends an error 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.

Parameters
socketThe guac_socket connection to use.
errorThe human-readable description associated with the error.
statusThe status code related to the error.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_file ( guac_socket socket,
const guac_stream stream,
const char *  mimetype,
const char *  name 
)

Sends a file 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.

Parameters
socketThe guac_socket connection to use.
streamThe stream to use.
mimetypeThe mimetype of the data being sent.
nameA name describing the file being sent.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_identity ( guac_socket socket,
const guac_layer layer 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe destination layer.
Returns
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 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.

Parameters
socketThe guac_socket connection to use.
modeThe composite mode to use.
layerThe destination layer.
srclThe source layer.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_line ( guac_socket socket,
const guac_layer layer,
int  x,
int  y 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe destination layer.
xThe X coordinate of the endpoint of the line.
yThe Y coordinate of the endpoint of the line.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_log ( guac_socket socket,
const char *  format,
  ... 
)

Sends a log instruction over the given guac_socket connection.

This is mainly useful in debugging.

If an error occurs sending the instruction, a non-zero value is returned, and guac_error is set appropriately.

Parameters
socketThe guac_socket connection to use.
formatA printf-style format string to log.
...Arguments to use when filling the format string for printing.
Returns
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 an lstroke 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.

Parameters
socketThe guac_socket connection to use.
modeThe composite mode to use.
layerThe destination layer.
capThe style of line cap to use when drawing the stroke.
joinThe style of line join to use when drawing the stroke.
thicknessThe thickness of the stroke in pixels.
srclThe source layer.
Returns
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 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to move.
parentThe parent layer the specified layer will be positioned relative to.
xThe X coordinate of the layer.
yThe Y coordinate of the layer.
zThe Z index of the layer, relative to other layers in its parent.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_name ( guac_socket socket,
const char *  name 
)

Sends a name instruction over the given guac_socket connection.

Parameters
socketThe guac_socket connection to use.
nameThe name to send within the name instruction.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_nest ( guac_socket socket,
int  index,
const char *  data 
)

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.

Parameters
socketThe guac_socket connection to use.
indexThe integer index of the stram to send the protocol data over.
dataA string containing protocol data, which must be UTF-8 encoded and null-terminated.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_nop ( guac_socket socket)

Sends a nop instruction (null-operation) 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.

Parameters
socketThe guac_socket connection to use.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_pipe ( guac_socket socket,
const guac_stream stream,
const char *  mimetype,
const char *  name 
)

Sends a pipe 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.

Parameters
socketThe guac_socket connection to use.
streamThe stream to use.
mimetypeThe mimetype of the data being sent.
nameAn arbitrary name uniquely identifying this pipe.
Returns
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 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.

Parameters
socketThe guac_socket connection to use.
modeThe composite mode to use.
layerThe destination layer.
xThe destination X coordinate.
yThe destination Y coordinate.
surfaceA cairo surface containing the image data to send.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_pop ( guac_socket socket,
const guac_layer layer 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to set the clipping region of.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_push ( 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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to set the clipping region of.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_rect ( guac_socket socket,
const guac_layer layer,
int  x,
int  y,
int  width,
int  height 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe destination layer.
xThe X coordinate of the rectangle.
yThe Y coordinate of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_reset ( guac_socket socket,
const guac_layer layer 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to set the clipping region of.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_select ( guac_socket socket,
const char *  protocol 
)

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.

Parameters
socketThe guac_socket connection to use.
protocolThe protocol to request.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_set ( guac_socket socket,
const guac_layer layer,
const char *  name,
const char *  value 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to set the parameter of.
nameThe name of the parameter to set.
valueThe value to set the parameter to.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_shade ( guac_socket socket,
const guac_layer layer,
int  a 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to shade.
aThe alpha value of the layer.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_size ( guac_socket socket,
const guac_layer layer,
int  w,
int  h 
)

Sends a size 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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to resize.
wThe new width of the layer.
hThe new height of the layer.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_start ( guac_socket socket,
const guac_layer layer,
int  x,
int  y 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe destination layer.
xThe X coordinate of the first point of the subpath.
yThe Y coordinate of the first point of the subpath.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_sync ( guac_socket socket,
guac_timestamp  timestamp 
)

Sends a sync instruction over the given guac_socket connection.

The current time in milliseconds should be passed in as the timestamp.

If an error occurs sending the instruction, a non-zero value is returned, and guac_error is set appropriately.

Parameters
socketThe guac_socket connection to use.
timestampThe current timestamp (in milliseconds).
Returns
Zero on success, non-zero on error.
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 
)

Sends a transfer 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.

Parameters
socketThe guac_socket connection to use.
srclThe source layer.
srcxThe X coordinate of the source rectangle.
srcyThe Y coordinate of the source rectangle.
wThe width of the source rectangle.
hThe height of the source rectangle.
fnThe transfer function to use.
dstlThe destination layer.
dstxThe X coordinate of the destination, where the source rectangle should be copied.
dstyThe Y coordinate of the destination, where the source rectangle should be copied.
Returns
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 
)

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.

Parameters
socketThe guac_socket connection to use.
layerThe layer to apply the given transform matrix to.
aThe first value of the affine transform matrix.
bThe second value of the affine transform matrix.
cThe third value of the affine transform matrix.
dThe fourth value of the affine transform matrix.
eThe fifth value of the affine transform matrix.
fThe sixth value of the affine transform matrix.
Returns
Zero on success, non-zero on error.
int guac_protocol_send_video ( guac_socket socket,
const guac_stream stream,
const guac_layer layer,
const char *  mimetype,
double  duration 
)

Sends a video 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.

Parameters
socketThe guac_socket connection to use.
streamThe stream to use.
layerThe destination layer.
mimetypeThe mimetype of the data being sent.
durationThe duration of the video being sent, in milliseconds.
Returns
Zero on success, non-zero on error.
int vguac_protocol_send_log ( guac_socket socket,
const char *  format,
va_list  args 
)

Sends a log instruction over the given guac_socket connection.

This is mainly useful in debugging.

If an error occurs sending the instruction, a non-zero value is returned, and guac_error is set appropriately.

Parameters
socketThe guac_socket connection to use.
formatA printf-style format string to log.
apThe va_list containing the arguments to be used when filling the format string for printing.