Appendix B. Guacamole protocol reference

Drawing instructions

arc

The arc instruction adds the specified arc subpath to the existing path, creating a new path if no path exists. The path created can be modified further by other path-type instructions, and finally stroked, filled, and/or closed.

layer

The layer which should have the specified arc subpath added.

x

The X coordinate of the center of the circle containing the arc to be drawn.

y

The Y coordinate of the center of the circle containing the arc to be drawn.

radius

The radius of the circle containing the arc to be drawn, in pixels.

start

The starting angle of the arc to be drawn, in radians.

end

The ending angle of the arc to be drawn, in radians.

negative

Non-zero if the arc should be drawn from START to END in order of decreasing angle, zero otherwise.

cfill

Fills the current path with the specified color. This instruction completes the current path. Future path instructions will begin a new path.

mask

The channel mask to apply when filling the current path in the specified layer.

layer

The layer whose path should be filled.

r

The red component of the color to use to fill the current path in the specified layer.

g

The green component of the color to use to fill the current path in the specified layer.

b

The blue component of the color to use to fill the current path in the specified layer.

a

The alpha component of the color to use to fill the current path in the specified layer.

clip

Applies the current path as the clipping path. Future operations will only draw within the current path. Note that future clip instructions will also be limited by this path. To set a completely new clipping path, you must first reset the layer with a reset instruction. If you wish to only reset the clipping path, but preserve the current transform matrix, push the layer state before setting the clipping path, and pop the layer state to reset.

layer

The layer whose clipping path should be set.

close

Closes the current path by connecting the start and end points with a straight line.

layer

The layer whose path should be closed.

copy

Copies image data from the specified rectangle of the specified layer or buffer to a different location of another specified layer or buffer.

srclayer

The index of the layer to copy image data from.

srcx

The X coordinate of the upper-left corner of the source rectangle within the source layer.

srcy

The Y coordinate of the upper-left corner of the source rectangle within the source layer.

srcwidth

The width of the source rectangle within the source layer.

srcheight

The height of the source rectangle within the source layer.

mask

The channel mask to apply when drawing the image data on the destination layer.

dstlayer

The index of the layer to draw the image data to.

dstx

The X coordinate of the upper-left corner of the destination within the destination layer.

dsty

The Y coordinate of the upper-left corner of the destination within the destination layer.

cstroke

Strokes the current path with the specified color. This instruction completes the current path. Future path instructions will begin a new path.

mask

The channel mask to apply when stroking the current path in the specified layer.

layer

The layer whose path should be stroked.

cap

The index of the line cap style to use. This can be either butt (0), round (1), or square (2).

join

The index of the line join style to use. This can be either bevel (0), miter (1), or round (2).

thickness

The thickness of the stroke to draw, in pixels.

r

The red component of the color to use to stroke the current path in the specified layer.

g

The green component of the color to use to stroke the current path in the specified layer.

b

The blue component of the color to use to stroke the current path in the specified layer.

a

The alpha component of the color to use to stroke the current path in the specified layer.

cursor

Sets the client's cursor to the image data from the specified rectangle of a layer, with the specified hotspot.

x

The X coordinate of the cursor's hotspot.

y

The Y coordinate of the cursor's hotspot.

srclayer

The index of the layer to copy image data from.

srcx

The X coordinate of the upper-left corner of the source rectangle within the source layer.

srcy

The Y coordinate of the upper-left corner of the source rectangle within the source layer.

srcwidth

The width of the source rectangle within the source layer.

srcheight

The height of the source rectangle within the source layer.

curve

Adds the specified cubic bezier curve subpath.

layer

The layer which should have the specified curve subpath added.

cp1x

The X coordinate of the first control point of the curve.

cp1y

The Y coordinate of the first control point of the curve.

cp2x

The X coordinate of the second control point of the curve.

cp2y

The Y coordinate of the second control point of the curve.

x

The X coordinate of the endpoint of the curve.

y

The Y coordinate of the endpoint of the curve.

dispose

Removes the specified layer. The specified layer will be recreated as a new layer if it is referenced again.

layer

The layer to remove.

distort

Sets the given affine transformation matrix to the layer. Unlike transform, this operation is independent of any previously sent transformation matrix. This operation can be undone by setting the layer's transformation matrix to the identity matrix using distort

layer

The layer to distort.

a

The matrix value in row 1, column 1.

b

The matrix value in row 2, column 1.

c

The matrix value in row 1, column 2.

d

The matrix value in row 2, column 2.

e

The matrix value in row 1, column 3.

f

The matrix value in row 2, column 3.

identity

Resets the transform matrix of the specified layer to the identity matrix.

layer

The layer whose transform matrix should be reset.

lfill

Fills the current path with a tiled pattern of the image data from the specified layer. This instruction completes the current path. Future path instructions will begin a new path.

mask

The channel mask to apply when filling the current path in the specified layer.

layer

The layer whose path should be filled.

srclayer

The layer to use as the pattern.

line

Adds the specified line subpath.

layer

The layer which should have the specified line subpath added.

x

The X coordinate of the endpoint of the line.

y

The Y coordinate of the endpoint of the line.

lstroke

Strokes the current path with a tiled pattern of the image data from the specified layer. This instruction completes the current path. Future path instructions will begin a new path.

mask

The channel mask to apply when filling the current path in the specified layer.

layer

The layer whose path should be filled.

cap

The index of the line cap style to use. This can be either butt (0), round (1), or square (2).

join

The index of the line join style to use. This can be either bevel (0), miter (1), or round (2).

thickness

The thickness of the stroke to draw, in pixels.

srclayer

The layer to use as the pattern.

move

Moves the given layer to the given location within the specified parent layer. This operation is applicable only to layers, and cannot be applied to buffers (layers with negative indices). Applying this operation to the default layer (layer 0) also has no effect.

layer

The layer to move.

parent

The layer that should be the parent of the given layer.

x

The X coordinate to move the layer to.

y

The Y coordinate to move the layer to.

z

The relative Z-ordering of this layer. Layers with larger values will appear above layers with smaller values.

pop

Restores the previous state of the specified layer from the stack. The state restored includes the transformation matrix and clipping path.

layer

The layer whose state should be restored.

push

Saves the current state of the specified layer to the stack. The state saved includes the current transformation matrix and clipping path.

layer

The layer whose state should be saved.

rect

Adds a rectangular path to the specified layer.

mask

The channel mask to apply when drawing the image data.

layer

The destination layer.

x

The X coordinate of the upper-left corner of the rectangle to draw.

y

The Y coordinate of the upper-left corner of the rectangle to draw.

width

The width of the rectangle to draw.

height

The width of the rectangle to draw.

reset

Resets the transformation and clip state of the layer.

layer

The layer whose state should be reset.

set

Sets the given client-side property to the specified value. Currently there is only one property: miter-limit, the maximum distance between the inner and outer points of a miter joint, proportional to stroke width (if miter-limit is set to 10.0, the default, then the maximum distance between the points of the joint is 10 times the stroke width).

layer

The layer whose property should be set.

property

The name of the property to set.

value

The value to set the given property to.

shade

Sets the opacity of the given layer.

layer

The layer whose opacity should be set.

opacity

The opacity of the layer, where 0 is completely transparent, and 255 is completely opaque.

size

Sets the size of the specified layer.

layer

The layer to resize.

width

The new width of the layer

height

The new height of the layer

start

Starts a new subpath at the specified point.

layer

The layer which should start a new subpath.

x

The X coordinate of the first point of the new subpath.

y

The Y coordinate of the first point of the new subpath.

transfer

Transfers image data from the specified rectangle of the specified layer or buffer to a different location of another specified layer or buffer, using the specified transfer function. For a list of available functions, see [[http://guac-dev.org/trac/browser/libguac/include/protocol.h|guacamole/protocol.h.

srclayer

The index of the layer to transfer image data from.

srcx

The X coordinate of the upper-left corner of the source rectangle within the source layer.

srcy

The Y coordinate of the upper-left corner of the source rectangle within the source layer.

srcwidth

The width of the source rectangle within the source layer.

srcheight

The height of the source rectangle within the source layer.

function

The index of the transfer function to use. For a list of available functions, see [[http://guac-dev.org/trac/browser/libguac/include/protocol.h|guacamole/protocol.h.

dstlayer

The index of the layer to draw the image data to.

dstx

The X coordinate of the upper-left corner of the destination within the destination layer.

dsty

The Y coordinate of the upper-left corner of the destination within the destination layer.

transform

Applies the specified transformation matrix to future operations. Unlike distort, this operation is dependent on any previously sent transformation matrices, and only affects future operations. This operation can be undone by setting the layer's transformation matrix to the identity matrix using identity, but image data already drawn will not be affected.

layer

The layer to apply the given transformation matrix to.

a

The matrix value in row 1, column 1.

b

The matrix value in row 2, column 1.

c

The matrix value in row 1, column 2.

d

The matrix value in row 2, column 2.

e

The matrix value in row 1, column 3.

f

The matrix value in row 2, column 3.

Streaming instructions

ack

The ack instruction acknowledges a received data blob, providing a status code and message indicating whether the operation associated with the blob succeeded or failed. A status code other than SUCCESS implicitly ends the stream.

stream

The index of the stream the corresponding blob was received on.

message

A human-readable error message. This typically is not exposed within any user interface, and mainly helps with debugging.

status

The Guacamole status code denoting success or failure.

Status codes

Several Guacamole instructions, and various other internals of the Guacamole core, use a common set of numeric status codes. These codes denote success or failure of operations, and can be rendered by user interfaces in a human-readable way.

CodeNameDescription
0SUCCESS

The operation succeeded. No error.

256UNSUPPORTED

The requested operation is unsupported.

512SERVER_ERROR

An internal error occurred, and the operation could not be performed.

513SERVER_BUSY

The operation could not be performed because the server is busy.

514UPSTREAM_TIMEOUT

The upstream server is not responding. In most cases, the upstream server is the remote desktop server.

515UPSTREAM_ERROR

The upstream server encountered an error. In most cases, the upstream server is the remote desktop server.

516RESOURCE_NOT_FOUND

An associated resource, such as a file or stream, could not be found, and thus the operation failed.

517RESOURCE_CONFLICT

A resource is already in use or locked, preventing the requested operation.

768CLIENT_BAD_REQUEST

The parameters of the request are illegal or otherwise invalid.

769CLIENT_UNAUTHORIZED

Permission was denied, because the user is not logged in. Note that the user may be logged into Guacamole, but still not logged in with respect to the remote desktop server.

771CLIENT_FORBIDDEN

Permission was denied, and logging in will not solve the problem.

776CLIENT_TIMEOUT

The client (usually the user of Guacamole or their browser) is taking too long to respond.

781CLIENT_OVERRUN

The client has sent more data than the protocol allows.

783CLIENT_BAD_TYPE

The client has sent data of an unexpected or illegal type.

797CLIENT_TOO_MANY

The client is already using too many resources. Existing resources must be freed before further requests are allowed.

audio

Allocates a new stream, associating it with the given audio metadata. Audio data will later be sent along the stream with blob instructions. The mimetype given must be a mimetype previously specified by the client during the handshake procedure. Playback will begin immediately and will continue as long as blobs are received along the stream.

stream

The index of the stream to allocate.

mimetype

The mimetype of the audio data being sent.

blob

Sends a blob of data along the given stream. This blob of data is arbitrary, base64-encoded data, and only has meaning to the Guacamole client or server through the metadata assigned to the stream when the stream was allocated.

stream

The index of the stream along which the given data should be sent.

data

The base64-encoded data to send.

clipboard

Allocates a new stream, associating it with the given clipboard metadata. The clipboard data will later be sent along the stream with blob instructions. If sent by the client, this data will be the contents of the client-side clipboard. If sent by the server, this data will be the contents of the clipboard within the remote desktop.

stream

The index of the stream to allocate.

mimetype

The mimetype of the clipboard data being sent. In most cases, this will be "text/plain".

end

The end instruction terminates an open stream, freeing any client-side or server-side resources. Data sent to a terminated stream will be ignored. Terminating a stream with the end instruction only denotes the end of the stream and does not imply an error.

stream

The index of the stream the corresponding blob was received on.

file

Allocates a new stream, associating it with the given arbitrary file metadata. The contents of the file will later be sent along the stream with blob instructions. The full size of the file need not be known ahead of time.

stream

The index of the stream to allocate.

mimetype

The mimetype of the file being sent.

filename

The name of the file, as it would be saved on a filesystem.

img

Allocates a new stream, associating it with the metadata of an image update, including the image type, the destination layer, and destination coordinates. The contents of the image will later be sent along the stream with blob instructions. The full size of the image need not be known ahead of time.

stream

The index of the stream to allocate.

mimetype

The mimetype of the image being sent.

mask

The channel mask to apply when drawing the image data.

layer

The destination layer.

x

The X coordinate of the upper-left corner of the destination within the destination layer.

y

The Y coordinate of the upper-left corner of the destination within the destination layer.

nest

Encodes part of one or more instructions within a single instruction, associating that packet of data with a stream index. Future nest instructions with the same stream index will append their data to the same logical stream on the client side. Once nested data is received on the client side, the client immediately executes any completed instructions within the associated stream, in order.

index

The index of the stream this data should be appended to. This index is completely arbitrary, and denotes only how nested data should be reassembled.

data

The protocol data, containing part of one or more instructions.

pipe

Allocates a new stream, associating it with the given arbitrary named pipe metadata. The contents of the pipe will later be sent along the stream with blob instructions. Pipes in the Guacamole protocol are unidirectional, named pipes, very similar to a UNIX FIFO or pipe. It is up to client-side code to handle pipe data appropriately, likely based upon the name of the pipe, which is arbitrary. Pipes may be opened by either the client or the server.

stream

The index of the stream to allocate.

mimetype

The mimetype of the data being sent along the pipe.

name

The arbitrary name of the pipe, which may have special meaning to client-side code.

video

Allocates a new stream, associating it with the given video metadata. Video data will later be sent along the stream with blob instructions. The mimetype given must be a mimetype previously specified by the client during the handshake procedure. Playback will begin immediately and will continue as long as blobs are received along the stream.

stream

The index of the stream to allocate.

layer

The index of the layer to stream the video data into. The effect of other drawing operations on this layer during playback is undefined, as the client codec implementation may leverage any rendering mechanism it sees fit, including hardware decoding.

mimetype

The mimetype of the video data being sent.

Object instructions

body

Allocates a new stream, associating it with the name of a stream previously requested by a get instruction. The contents of the stream will be sent later with blob instructions. The full size of the stream need not be known ahead of time.

object

The index of the object associated with this stream.

stream

The index of the stream to allocate.

mimetype

The mimetype of the data being sent.

name

The name of the stream associated with the object.

filesystem

Allocates a new object, associating it with the given arbitrary filesystem metadata. The contents of files and directories within the filesystem will later be sent along streams requested with get instructions or created with put instructions.

object

The index of the object to allocate.

name

The name of the filesystem.

get

Requests that a new stream be created, providing read access to the object stream having the given name. The requested stream will be created, in response, with a body instruction.

Stream names are arbitrary and dictated by the object from which they are requested, with the exception of the root stream of the object itself, which has the reserved name "/". The root stream of the object has the mimetype "application/vnd.glyptodon.guacamole.stream-index+json", and provides a simple JSON map of available stream names to their corresponding mimetypes. If the object contains a hierarchy of streams, some of these streams may also be "application/vnd.glyptodon.guacamole.stream-index+json".

For example, the ultimate content of the body stream provided in response to a get request for the root stream of an object containing two text streams, "A" and "B", would be the following:

{
    "A" : "text/plain",
    "B" : "text/plain"
}
object

The index of the object to request a stream from.

name

The name of the stream being requested from the given object.

put

Allocates a new stream, associating it with the given arbitrary object and stream name. The contents of the stream will later be sent with blob instructions.

object

The index of the object associated with this stream.

stream

The index of the stream to allocate.

mimetype

The mimetype of the data being sent.

name

The name of the stream within the given object to which data is being sent.

undefine

Undefines an existing object, allowing its index to be reused by another future object. The resource associated with the original object may or may not continue to exist - it simply no longer has an associated object.

object

The index of the object to undefine.

Client handshake instructions

audio

Specifies which audio mimetypes are supported by the client. Each parameter must be a single mimetype, listed in order of client preference, with the optimal mimetype being the first parameter. This is the third instruction sent during the handshake phase.

connect

Begins the connection using the previously specified protocol with the given arguments. This is the last instruction sent during the handshake phase.

The parameters of this instruction correspond exactly to the parameters of the received args instruction. If the received args instruction has, for example, three parameters, the responding connect instruction must also have three parameters.

image

Specifies which image mimetypes are supported by the client. Each parameter must be a single mimetype, listed in order of client preference, with the optimal mimetype being the first parameter. This is the fifth instruction sent during the handshake phase.

It is expected that the supported mimetypes will include at least "image/png" and "image/jpeg", and the server may safely assume that these mimetypes are supported, even if they are absent from the handshake.

select

Requests that the connection be made using the specified protocol. This is the first instruction sent during the handshake phase.

protocol

The protocol to use.

size

Specifies the client's optimal screen size and resolution. This is the second instruction sent during the handshake phase.

width

The optimal screen width.

height

The optimal screen height.

dpi

The optimal screen resolution, in approximate DPI.

video

Specifies which video mimetypes are supported by the client. Each parameter must be a single mimetype, listed in order of client preference, with the optimal mimetype being the first parameter. This is the fourth instruction sent during the handshake phase.

Server handshake instructions

args

Reports the expected format of the argument list for the protocol requested by the client. This message can be sent by the server during the handshake phase only.

The parameters of the args instruction are the names of all parameters accepted by the server for the protocol in selected by the client, in order. The client's responding connect instruction must the values of each of these parameters in the same order.

Client control instructions

disconnect

Notifies the server that the connection is about to be closed by the client. This message can be sent by the client during any phase, and takes no parameters.

sync

Reports that all operations as of the given server-relative timestamp have been completed. If a sync is received from the server, the client must respond with a corresponding sync once all previous operations have been completed, or the server may stop sending updates until the client catches up. For the client, sending a sync with a timestamp newer than any timestamp received from the server is an error.

Both client and server are expected to occasionally send sync to report on current operation execution state.

timestamp

A valid server-relative timestamp.

Server control instructions

error

Notifies the client that the connection is about to be closed due to the specified error. This message can be sent by the server during any phase.

text

An arbitrary message describing the error

status

The Guacamole status code describing the error. For a list of status codes, see the table in the section called “Status codes”.

log

The log instruction sends an arbitrary string for debugging purposes. This instruction will be ignored by Guacamole clients, but can be seen in protocol dumps if such dumps become necessary. Sending a log instruction can help add context when searching for the cause of a fault in protocol support.

message

An arbitrary, human-readable message.

nop

The nop instruction does absolutely nothing, has no parameters, and is universally ignored by Guacamole clients. Its main use is as a keep-alive signal, and may be sent by guacd or client plugins when there is no activity to ensure the socket is not closed due to timeout.

ready

The ready instruction sends the ID of a new connection and marks the beginning of the interactive phase of a new, successful connection. The ID sent is a completely arbitrary string, and has no standard format. It must be unique from all existing and future connections and may not match the name of any installed protocol support.

ID

An arbitrary, unique identifier for the current connection. This identifier must be unique from all existing and future connections, and may not match the name of any installed protocol support (such as "vnc" or "rdp").

sync

Indicates that the given timestamp is the current timestamp as of all previous operations. The client must respond to every sync instruction received.

Both client and server are expected to occasionally send sync to report on current operation execution state.

timestamp

A valid server-relative timestamp.

Client events

key

Sends the specified key press or release event.

keysym

The X11 keysym of the key being pressed or released.

pressed

0 if the key is not pressed, 1 if the key is pressed.

mouse

Sends the specified mouse movement or button press or release event (or combination thereof).

x

The current X coordinate of the mouse pointer.

y

The current Y coordinate of the mouse pointer.

mask

The button mask, representing the pressed or released status of each mouse button.