libguac  0.9.9
Data Structures | Functions | Variables
client.h File Reference

Functions and structure contents for the Guacamole proxy client. More...

Go to the source code of this file.

Data Structures

struct  guac_client_info
 Information exposed by the remote client during the connection handshake which can be used by a client plugin. More...
 
struct  guac_client
 Guacamole proxy client. More...
 

Functions

guac_clientguac_client_alloc ()
 Returns a new, barebones guac_client. More...
 
void guac_client_free (guac_client *client)
 Free all resources associated with the given client. More...
 
int guac_client_handle_instruction (guac_client *client, guac_instruction *instruction)
 Call the appropriate handler defined by the given client for the given instruction. More...
 
void guac_client_log (guac_client *client, guac_client_log_level level, const char *format,...)
 Writes a message in the log used by the given client. More...
 
void vguac_client_log (guac_client *client, guac_client_log_level level, const char *format, va_list ap)
 Writes a message in the log used by the given client. More...
 
void guac_client_stop (guac_client *client)
 Signals the given client to stop gracefully. More...
 
void guac_client_abort (guac_client *client, guac_protocol_status status, const char *format,...)
 Signals the given client to stop gracefully, while also signalling via the Guacamole protocol that an error has occurred. More...
 
void vguac_client_abort (guac_client *client, guac_protocol_status status, const char *format, va_list ap)
 Signals the given client to stop gracefully, while also signalling via the Guacamole protocol that an error has occurred. More...
 
guac_layerguac_client_alloc_buffer (guac_client *client)
 Allocates a new buffer (invisible layer). More...
 
guac_layerguac_client_alloc_layer (guac_client *client)
 Allocates a new layer. More...
 
void guac_client_free_buffer (guac_client *client, guac_layer *layer)
 Returns the given buffer to the pool of available buffers, such that it can be reused by any subsequent call to guac_client_allow_buffer(). More...
 
void guac_client_free_layer (guac_client *client, guac_layer *layer)
 Returns the given layer to the pool of available layers, such that it can be reused by any subsequent call to guac_client_allow_layer(). More...
 
guac_streamguac_client_alloc_stream (guac_client *client)
 Allocates a new stream. More...
 
void guac_client_free_stream (guac_client *client, guac_stream *stream)
 Returns the given stream to the pool of available streams, such that it can be reused by any subsequent call to guac_client_alloc_stream(). More...
 
guac_objectguac_client_alloc_object (guac_client *client)
 Allocates a new object. More...
 
void guac_client_free_object (guac_client *client, guac_object *object)
 Returns the given object to the pool of available objects, such that it can be reused by any subsequent call to guac_client_alloc_object(). More...
 
void guac_client_stream_png (guac_client *client, guac_socket *socket, guac_composite_mode mode, const guac_layer *layer, int x, int y, cairo_surface_t *surface)
 Streams the image data of the given surface over an image stream ("img" instruction) as PNG-encoded data. More...
 
void guac_client_stream_jpeg (guac_client *client, guac_socket *socket, guac_composite_mode mode, const guac_layer *layer, int x, int y, cairo_surface_t *surface, int quality)
 Streams the image data of the given surface over an image stream ("img" instruction) as JPEG-encoded data at the given quality. More...
 
void guac_client_stream_webp (guac_client *client, guac_socket *socket, guac_composite_mode mode, const guac_layer *layer, int x, int y, cairo_surface_t *surface, int quality, int lossless)
 Streams the image data of the given surface over an image stream ("img" instruction) as WebP-encoded data at the given quality. More...
 
int guac_client_supports_webp (guac_client *client)
 Returns whether the given client supports WebP. More...
 

Variables

const guac_layerGUAC_DEFAULT_LAYER
 The default Guacamole client layer, layer 0.
 

Detailed Description

Functions and structure contents for the Guacamole proxy client.

Function Documentation

void guac_client_abort ( guac_client client,
guac_protocol_status  status,
const char *  format,
  ... 
)

Signals the given client to stop gracefully, while also signalling via the Guacamole protocol that an error has occurred.

Note that this is a completely cooperative signal, and can be ignored by the client or the hosting daemon. The message given will be logged to the system logs.

Parameters
clientThe proxy client to signal to stop.
statusThe status to send over the Guacamole protocol.
formatA printf-style format string to log.
...Arguments to use when filling the format string for printing.
guac_client* guac_client_alloc ( )

Returns a new, barebones guac_client.

This new guac_client has no handlers set, but is otherwise usable.

Returns
A pointer to the new client.
guac_layer* guac_client_alloc_buffer ( guac_client client)

Allocates a new buffer (invisible layer).

An arbitrary index is automatically assigned if no existing buffer is available for use.

Parameters
clientThe proxy client to allocate the buffer for.
Returns
The next available buffer, or a newly allocated buffer.
guac_layer* guac_client_alloc_layer ( guac_client client)

Allocates a new layer.

An arbitrary index is automatically assigned if no existing layer is available for use.

Parameters
clientThe proxy client to allocate the layer buffer for.
Returns
The next available layer, or a newly allocated layer.
guac_object* guac_client_alloc_object ( guac_client client)

Allocates a new object.

An arbitrary index is automatically assigned if no previously-allocated object is available for use.

Parameters
clientThe proxy client to allocate the object for.
Returns
The next available object, or a newly allocated object.
guac_stream* guac_client_alloc_stream ( guac_client client)

Allocates a new stream.

An arbitrary index is automatically assigned if no previously-allocated stream is available for use.

Parameters
clientThe proxy client to allocate the layer buffer for.
Returns
The next available stream, or a newly allocated stream.
void guac_client_free ( guac_client client)

Free all resources associated with the given client.

Parameters
clientThe proxy client to free all reasources of.
void guac_client_free_buffer ( guac_client client,
guac_layer layer 
)

Returns the given buffer to the pool of available buffers, such that it can be reused by any subsequent call to guac_client_allow_buffer().

Parameters
clientThe proxy client to return the buffer to.
layerThe buffer to return to the pool of available buffers.
void guac_client_free_layer ( guac_client client,
guac_layer layer 
)

Returns the given layer to the pool of available layers, such that it can be reused by any subsequent call to guac_client_allow_layer().

Parameters
clientThe proxy client to return the layer to.
layerThe buffer to return to the pool of available layer.
void guac_client_free_object ( guac_client client,
guac_object object 
)

Returns the given object to the pool of available objects, such that it can be reused by any subsequent call to guac_client_alloc_object().

Parameters
clientThe proxy client to return the object to.
objectThe object to return to the pool of available object.
void guac_client_free_stream ( guac_client client,
guac_stream stream 
)

Returns the given stream to the pool of available streams, such that it can be reused by any subsequent call to guac_client_alloc_stream().

Parameters
clientThe proxy client to return the buffer to.
streamThe stream to return to the pool of available stream.
int guac_client_handle_instruction ( guac_client client,
guac_instruction instruction 
)

Call the appropriate handler defined by the given client for the given instruction.

A comparison is made between the instruction opcode and the initial handler lookup table defined in client-handlers.c. The intial handlers will in turn call the client's handler (if defined).

Parameters
clientThe proxy client whose handlers should be called.
instructionThe instruction to pass to the proxy client via the appropriate handler.
Returns
Non-negative if the instruction was handled successfully, or negative if an error occurred.
void guac_client_log ( guac_client client,
guac_client_log_level  level,
const char *  format,
  ... 
)

Writes a message in the log used by the given client.

The logger used will normally be defined by guacd (or whichever program loads the proxy client) by setting the logging handlers of the client when it is loaded.

Parameters
clientThe proxy client logging this message.
levelThe level at which to log this message.
formatA printf-style format string to log.
...Arguments to use when filling the format string for printing.
void guac_client_stop ( guac_client client)

Signals the given client to stop gracefully.

This is a completely cooperative signal, and can be ignored by the client or the hosting daemon.

Parameters
clientThe proxy client to signal to stop.
void guac_client_stream_jpeg ( guac_client client,
guac_socket socket,
guac_composite_mode  mode,
const guac_layer layer,
int  x,
int  y,
cairo_surface_t *  surface,
int  quality 
)

Streams the image data of the given surface over an image stream ("img" instruction) as JPEG-encoded data at the given quality.

The image stream will be automatically allocated and freed.

Parameters
clientThe Guacamole client from which the image stream should be allocated.
socketThe socket over which instructions associated with the image stream should be sent.
modeThe composite mode to use when rendering the image over the given layer.
layerThe destination layer.
xThe X coordinate of the upper-left corner of the destination rectangle within the given layer.
yThe Y coordinate of the upper-left corner of the destination rectangle within the given layer.
surfaceA Cairo surface containing the image data to be streamed.
qualityThe JPEG image quality, which must be an integer value between 0 and 100 inclusive.
void guac_client_stream_png ( guac_client client,
guac_socket socket,
guac_composite_mode  mode,
const guac_layer layer,
int  x,
int  y,
cairo_surface_t *  surface 
)

Streams the image data of the given surface over an image stream ("img" instruction) as PNG-encoded data.

The image stream will be automatically allocated and freed.

Parameters
clientThe Guacamole client from which the image stream should be allocated.
socketThe socket over which instructions associated with the image stream should be sent.
modeThe composite mode to use when rendering the image over the given layer.
layerThe destination layer.
xThe X coordinate of the upper-left corner of the destination rectangle within the given layer.
yThe Y coordinate of the upper-left corner of the destination rectangle within the given layer.
surfaceA Cairo surface containing the image data to be streamed.
void guac_client_stream_webp ( guac_client client,
guac_socket socket,
guac_composite_mode  mode,
const guac_layer layer,
int  x,
int  y,
cairo_surface_t *  surface,
int  quality,
int  lossless 
)

Streams the image data of the given surface over an image stream ("img" instruction) as WebP-encoded data at the given quality.

The image stream will be automatically allocated and freed. If the server does not support WebP, this function has no effect, so be sure to check the result of guac_client_supports_webp() prior to calling this function.

Parameters
clientThe Guacamole client from which the image stream should be allocated.
socketThe socket over which instructions associated with the image stream should be sent.
modeThe composite mode to use when rendering the image over the given layer.
layerThe destination layer.
xThe X coordinate of the upper-left corner of the destination rectangle within the given layer.
yThe Y coordinate of the upper-left corner of the destination rectangle within the given layer.
surfaceA Cairo surface containing the image data to be streamed.
qualityThe WebP image quality, which must be an integer value between 0 and 100 inclusive. For lossy images, larger values indicate improving quality at the expense of larger file size. For lossless images, this dictates the quality of compression, with larger values producing smaller files at the expense of speed.
losslessZero to encode a lossy image, non-zero to encode losslessly.
int guac_client_supports_webp ( guac_client client)

Returns whether the given client supports WebP.

If the client does not support WebP, or the server cannot encode WebP images, zero is returned.

Parameters
clientThe Guacamole client to check for WebP support.
Returns
Non-zero if the given client claims to support WebP and the server has been built with WebP support, zero otherwise.
void vguac_client_abort ( guac_client client,
guac_protocol_status  status,
const char *  format,
va_list  ap 
)

Signals the given client to stop gracefully, while also signalling via the Guacamole protocol that an error has occurred.

Note that this is a completely cooperative signal, and can be ignored by the client or the hosting daemon. The message given will be logged to the system logs.

Parameters
clientThe proxy client to signal to stop.
statusThe status to send over the Guacamole protocol.
formatA printf-style format string to log.
apThe va_list containing the arguments to be used when filling the format string for printing.
void vguac_client_log ( guac_client client,
guac_client_log_level  level,
const char *  format,
va_list  ap 
)

Writes a message in the log used by the given client.

The logger used will normally be defined by guacd (or whichever program loads the proxy client) by setting the logging handlers of the client when it is loaded.

Parameters
clientThe proxy client logging this message.
levelThe level at which to log this message.
formatA printf-style format string to log.
apThe va_list containing the arguments to be used when filling the format string for printing.