libguac  0.9.9
client.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Glyptodon LLC
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 #ifndef _GUAC_CLIENT_H
24 #define _GUAC_CLIENT_H
25 
32 #include "client-fntypes.h"
33 #include "client-types.h"
34 #include "client-constants.h"
35 #include "instruction-types.h"
36 #include "layer-types.h"
37 #include "object-types.h"
38 #include "pool-types.h"
39 #include "socket-types.h"
40 #include "stream-types.h"
41 #include "timestamp-types.h"
42 
43 #include <cairo/cairo.h>
44 #include <stdarg.h>
45 
47 
55 
63 
69 
75 
82 
91 
92 };
93 
94 struct guac_client {
95 
104 
112 
118 
124 
130 
136  void* data;
137 
153 
180 
198 
219 
236 
255 
274 
293 
312 
330 
353 
377 
397 
417 
423  guac_pool* __buffer_pool;
424 
430  guac_pool* __layer_pool;
431 
435  guac_pool* __stream_pool;
436 
440  guac_stream* __output_streams;
441 
445  guac_stream* __input_streams;
446 
450  guac_pool* __object_pool;
451 
455  guac_object* __objects;
456 
465 
466 };
467 
475 
481 void guac_client_free(guac_client* client);
482 
500  guac_instruction* instruction);
501 
513  const char* format, ...);
514 
527  const char* format, va_list ap);
528 
536 void guac_client_stop(guac_client* client);
537 
550  const char* format, ...);
551 
565  const char* format, va_list ap);
566 
575 
584 
592 void guac_client_free_buffer(guac_client* client, guac_layer* layer);
593 
601 void guac_client_free_layer(guac_client* client, guac_layer* layer);
602 
611 
619 void guac_client_free_stream(guac_client* client, guac_stream* stream);
620 
632 
643 void guac_client_free_object(guac_client* client, guac_object* object);
644 
674 void guac_client_stream_png(guac_client* client, guac_socket* socket,
675  guac_composite_mode mode, const guac_layer* layer, int x, int y,
676  cairo_surface_t* surface);
677 
711 void guac_client_stream_jpeg(guac_client* client, guac_socket* socket,
712  guac_composite_mode mode, const guac_layer* layer, int x, int y,
713  cairo_surface_t* surface, int quality);
714 
756 void guac_client_stream_webp(guac_client* client, guac_socket* socket,
757  guac_composite_mode mode, const guac_layer* layer, int x, int y,
758  cairo_surface_t* surface, int quality, int lossless);
759 
772 
776 extern const guac_layer* GUAC_DEFAULT_LAYER;
777 
778 #endif
779 
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...
guac_client_blob_handler * blob_handler
Handler for blob events sent by the Guacamole web-client.
Definition: client.h:311
guac_client_put_handler * put_handler
Handler for put events sent by the Guacamole web-client.
Definition: client.h:416
int guac_client_put_handler(guac_client *client, guac_object *object, guac_stream *stream, char *mimetype, char *name)
Handler for Guacamole object put events.
Definition: client-fntypes.h:105
int guac_client_end_handler(guac_client *client, guac_stream *stream)
Handler for Guacamole stream end events.
Definition: client-fntypes.h:94
const guac_layer * GUAC_DEFAULT_LAYER
The default Guacamole client layer, layer 0.
int guac_client_supports_webp(guac_client *client)
Returns whether the given client supports WebP.
Constants related to the Guacamole client structure, guac_client.
guac_client_ack_handler * ack_handler
Handler for ack events sent by the Guacamole web-client.
Definition: client.h:292
int guac_client_blob_handler(guac_client *client, guac_stream *stream, void *data, int length)
Handler for Guacamole stream blob events.
Definition: client-fntypes.h:82
Type definitions related to the guac_socket object.
guac_client_get_handler * get_handler
Handler for get events sent by the Guacamole web-client.
Definition: client.h:396
guac_socket * socket
The guac_socket structure to be used to communicate with the web-client.
Definition: client.h:103
guac_object * guac_client_alloc_object(guac_client *client)
Allocates a new object.
guac_timestamp last_sent_timestamp
The time (in milliseconds) that the last sync message was sent to the client.
Definition: client.h:123
Type definitions related to Guacamole protocol streams.
The core I/O object of Guacamole.
Definition: socket.h:41
guac_stream * guac_client_alloc_stream(guac_client *client)
Allocates a new stream.
int guac_client_size_handler(guac_client *client, int width, int height)
Handler for Guacamole screen size events.
Definition: client-fntypes.h:64
Type definitions related to Guacamole protocol objects.
guac_client_state
Possible current states of the Guacamole client.
Definition: client-types.h:44
void * data
Arbitrary reference to proxy client-specific data.
Definition: client.h:136
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...
Type definitions related to the Guacamole client structure, guac_client.
guac_client_file_handler * file_handler
Handler for file events sent by the Guacamole web-client.
Definition: client.h:254
int guac_client_file_handler(guac_client *client, guac_stream *stream, char *mimetype, char *filename)
Handler for Guacamole file transfer events.
Definition: client-fntypes.h:70
guac_layer * guac_client_alloc_buffer(guac_client *client)
Allocates a new buffer (invisible layer).
Represents a single object within the Guacamole protocol.
Definition: object.h:35
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...
guac_client_info info
Information structure containing properties exposed by the remote client during the initial handshake...
Definition: client.h:129
int guac_client_pipe_handler(guac_client *client, guac_stream *stream, char *mimetype, char *name)
Handler for Guacamole pipe events.
Definition: client-fntypes.h:76
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.
guac_client_log_handler * log_handler
Logging handler.
Definition: client.h:376
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 ...
guac_client_size_handler * size_handler
Handler for size events sent by the Guacamole web-client.
Definition: client.h:235
int guac_client_key_handler(guac_client *client, int keysym, int pressed)
Handler for Guacamole key events.
Definition: client-fntypes.h:54
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 subseque...
Information exposed by the remote client during the connection handshake which can be used by a clien...
Definition: client.h:46
guac_client_clipboard_handler * clipboard_handler
Handler for clipboard events sent by the Guacamole web-client.
Definition: client.h:218
int guac_client_free_handler(guac_client *client)
Handler for freeing up any extra data allocated by the client implementation.
Definition: client-fntypes.h:122
int guac_client_ack_handler(guac_client *client, guac_stream *stream, char *error, guac_protocol_status status)
Handler for Guacamole stream ack events.
Definition: client-fntypes.h:88
int guac_client_clipboard_handler(guac_client *client, guac_stream *stream, char *mimetype)
Handler for Guacamole clipboard events.
Definition: client-fntypes.h:59
guac_client_mouse_handler * mouse_handler
Handler for mouse events sent by the Gaucamole web-client.
Definition: client.h:179
Type definitions related to the guac_pool pool of unique integers.
guac_client_state state
The current state of the client.
Definition: client.h:111
int guac_client_handle_instruction(guac_client *client, guac_instruction *instruction)
Call the appropriate handler defined by the given client for the given instruction.
int64_t guac_timestamp
An arbitrary timestamp denoting a relative time value in milliseconds.
Definition: timestamp-types.h:37
Function type definitions related to the Guacamole client structure, guac_client. ...
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 subseque...
int guac_client_mouse_handler(guac_client *client, int x, int y, int button_mask)
Handler for Guacamole mouse events.
Definition: client-fntypes.h:49
int guac_client_get_handler(guac_client *client, guac_object *object, char *name)
Handler for Guacamole object get events.
Definition: client-fntypes.h:99
Guacamole proxy client.
Definition: client.h:94
A pool of integers.
Definition: pool.h:35
guac_client * guac_client_alloc()
Returns a new, barebones guac_client.
int optimal_width
The number of pixels the remote client requests for the display width.
Definition: client.h:54
void guac_client_free(guac_client *client)
Free all resources associated with the given client.
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 ...
guac_client_end_handler * end_handler
Handler for stream end events sent by the Guacamole web-client.
Definition: client.h:329
guac_layer * guac_client_alloc_layer(guac_client *client)
Allocates a new layer.
Type definitions related to Guacamole layers.
guac_composite_mode
Composite modes used by Guacamole draw instructions.
Definition: protocol-types.h:138
guac_client_pipe_handler * pipe_handler
Handler for pipe events sent by the Guacamole web-client.
Definition: client.h:273
char ** image_mimetypes
NULL-terminated array of client-supported image mimetypes.
Definition: client.h:81
guac_client_free_handler * free_handler
Handler for freeing data when the client is being unloaded.
Definition: client.h:352
guac_protocol_status
Set of all possible status codes returned by protocol operations.
Definition: protocol-types.h:47
Represents a single layer within the Guacamole protocol.
Definition: layer.h:37
void guac_client_stop(guac_client *client)
Signals the given client to stop gracefully.
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 d...
Represents a single stream within the Guacamole protocol.
Definition: stream.h:35
void guac_client_log_handler(guac_client *client, guac_client_log_level level, const char *format, va_list args)
Handler for logging messages.
Definition: client-fntypes.h:127
guac_client_key_handler * key_handler
Handler for key events sent by the Guacamole web-client.
Definition: client.h:197
int optimal_resolution
The DPI of the physical remote display if configured for the optimal width/height combination describ...
Definition: client.h:90
int guac_client_handle_messages(guac_client *client)
Handler for server messages (where "server" refers to the server that the proxy client is connected t...
Definition: client-fntypes.h:44
guac_client_handle_messages * handle_messages
Handler for server messages.
Definition: client.h:152
Type definitions related to Guacamole instructions.
char ** audio_mimetypes
NULL-terminated array of client-supported audio mimetypes.
Definition: client.h:68
guac_client_log_level
All supported log levels used by the logging subsystem of each Guacamole client.
Definition: client-types.h:65
Represents a single instruction within the Guacamole protocol.
Definition: instruction.h:38
int optimal_height
The number of pixels the remote client requests for the display height.
Definition: client.h:62
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 subseque...
char ** video_mimetypes
NULL-terminated array of client-supported video mimetypes.
Definition: client.h:74
guac_timestamp last_received_timestamp
The time (in milliseconds) of receipt of the last sync message from the client.
Definition: client.h:117
Type definitions related to Guacamole protocol timestamps.
char * connection_id
The unique identifier allocated for the connection, which may be used within the Guacamole protocol t...
Definition: client.h:464
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.