libguac  1.4.0
user.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef _GUAC_USER_H
21 #define _GUAC_USER_H
22 
31 #include "client-types.h"
32 #include "layer-types.h"
33 #include "pool-types.h"
34 #include "socket-types.h"
35 #include "stream-types.h"
36 #include "timestamp-types.h"
37 #include "user-constants.h"
38 #include "user-fntypes.h"
39 #include "user-types.h"
40 
41 #include <cairo/cairo.h>
42 
43 #include <pthread.h>
44 #include <stdarg.h>
45 
47 
55 
63 
68  const char** audio_mimetypes;
69 
74  const char** video_mimetypes;
75 
81  const char** image_mimetypes;
82 
91 
97  const char* timezone;
98 
104 
105 };
106 
107 struct guac_user {
108 
113 
120 
127  char* user_id;
128 
133  int owner;
134 
141  int active;
142 
149  guac_user* __prev;
150 
157  guac_user* __next;
158 
164 
171 
177 
183 
187  guac_pool* __stream_pool;
188 
192  guac_stream* __output_streams;
193 
197  guac_stream* __input_streams;
198 
202  guac_pool* __object_pool;
203 
207  guac_object* __objects;
208 
212  void* data;
213 
240 
258 
279 
296 
315 
334 
353 
372 
390 
409 
428 
448 
468 
490 
511 
532 
533 };
534 
542 
548 void guac_user_free(guac_user* user);
549 
572 int guac_user_handle_connection(guac_user* user, int usec_timeout);
573 
597 int guac_user_handle_instruction(guac_user* user, const char* opcode,
598  int argc, char** argv);
599 
612 
620 void guac_user_free_stream(guac_user* user, guac_stream* stream);
621 
628 void guac_user_stop(guac_user* user);
629 
642  const char* format, ...);
643 
657  const char* format, va_list ap);
658 
670  const char* format, ...);
671 
684  const char* format, va_list ap);
685 
697 
708 void guac_user_free_object(guac_user* user, guac_object* object);
709 
733 void guac_user_stream_argv(guac_user* user, guac_socket* socket,
734  const char* mimetype, const char* name, const char* value);
735 
765 void guac_user_stream_png(guac_user* user, guac_socket* socket,
766  guac_composite_mode mode, const guac_layer* layer, int x, int y,
767  cairo_surface_t* surface);
768 
803 void guac_user_stream_jpeg(guac_user* user, guac_socket* socket,
804  guac_composite_mode mode, const guac_layer* layer, int x, int y,
805  cairo_surface_t* surface, int quality);
806 
849 void guac_user_stream_webp(guac_user* user, guac_socket* socket,
850  guac_composite_mode mode, const guac_layer* layer, int x, int y,
851  cairo_surface_t* surface, int quality, int lossless);
852 
863 
876 
913 char* guac_user_parse_args_string(guac_user* user, const char** arg_names,
914  const char** argv, int index, const char* default_value);
915 
946 int guac_user_parse_args_int(guac_user* user, const char** arg_names,
947  const char** argv, int index, int default_value);
948 
982 int guac_user_parse_args_boolean(guac_user* user, const char** arg_names,
983  const char** argv, int index, int default_value);
984 
985 #endif
986 
guac_user_end_handler * end_handler
Handler for stream end events sent by the Guacamole web-client.
Definition: user.h:389
guac_object * guac_user_alloc_object(guac_user *user)
Allocates a new object.
guac_user_info info
Information structure containing properties exposed by the remote user during the initial handshake p...
Definition: user.h:182
void vguac_user_log(guac_user *user, guac_client_log_level level, const char *format, va_list ap)
Writes a message in the log used by the given user.
guac_user_key_handler * key_handler
Handler for key events sent by the Guacamole web-client.
Definition: user.h:257
int guac_user_get_handler(guac_user *user, guac_object *object, char *name)
Handler for Guacamole object get requests.
Definition: user-fntypes.h:472
guac_user_sync_handler * sync_handler
Handler for sync events sent by the Guacamole web-client.
Definition: user.h:408
int optimal_resolution
The DPI of the physical remote display if configured for the optimal width/height combination describ...
Definition: user.h:90
int guac_user_audio_handler(guac_user *user, guac_stream *stream, char *mimetype)
Handler for Guacamole audio streams received from a user.
Definition: user-fntypes.h:183
Type definitions related to the guac_socket object.
int guac_user_sync_handler(guac_user *user, guac_timestamp timestamp)
Handler for Guacamole sync events.
Definition: user-fntypes.h:451
guac_user_get_handler * get_handler
Handler for get events sent by the Guacamole web-client.
Definition: user.h:447
int processing_lag
The overall lag experienced by the user relative to the stream of frames, roughly excluding network l...
Definition: user.h:176
guac_user_touch_handler * touch_handler
Handler for touch events sent by the Guacamole web-client.
Definition: user.h:531
guac_protocol_version
The set of protocol versions known to guacd to handle negotiation or feature support between differin...
Definition: protocol-types.h:283
int guac_user_size_handler(guac_user *user, int width, int height)
Handler for Guacamole size events, invoked when a "size" instruction has been received from a user...
Definition: user-fntypes.h:227
Type definitions related to Guacamole protocol streams.
guac_timestamp last_received_timestamp
The time (in milliseconds) of receipt of the last sync message from the user.
Definition: user.h:163
The core I/O object of Guacamole.
Definition: socket.h:39
int guac_user_mouse_handler(guac_user *user, int x, int y, int button_mask)
Handler for Guacamole mouse events, invoked when a "mouse" instruction has been received from a user...
Definition: user-fntypes.h:95
int guac_user_end_handler(guac_user *user, guac_stream *stream)
Handler for Guacamole stream "end" instructions.
Definition: user-fntypes.h:381
guac_user_blob_handler * blob_handler
Handler for blob events sent by the Guacamole web-client.
Definition: user.h:371
void * data
Arbitrary user-specific data.
Definition: user.h:212
guac_user_file_handler * file_handler
Handler for file events sent by the Guacamole web-client.
Definition: user.h:314
int guac_user_supports_webp(guac_user *user)
Returns whether the given user supports WebP.
guac_user_mouse_handler * mouse_handler
Handler for mouse events sent by the Gaucamole web-client.
Definition: user.h:239
Type definitions related to the Guacamole client structure, guac_client.
void guac_user_stream_webp(guac_user *user, 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 ...
Represents a single object within the Guacamole protocol.
Definition: object.h:32
guac_user_pipe_handler * pipe_handler
Handler for pipe events sent by the Guacamole web-client.
Definition: user.h:333
void guac_user_stop(guac_user *user)
Signals the given user that it must disconnect, or advises cooperating services that the given user i...
guac_user_clipboard_handler * clipboard_handler
Handler for clipboard events sent by the Guacamole web-client.
Definition: user.h:278
guac_user_ack_handler * ack_handler
Handler for ack events sent by the Guacamole web-client.
Definition: user.h:352
const char ** image_mimetypes
NULL-terminated array of client-supported image mimetypes.
Definition: user.h:81
int owner
Non-zero if this user is the owner of the associated connection, zero otherwise.
Definition: user.h:133
int guac_user_supports_required(guac_user *user)
Returns whether the given user supports the "required" instruction.
guac_user_audio_handler * audio_handler
Handler for audio events sent by the Guacamole web-client.
Definition: user.h:489
int guac_user_parse_args_boolean(guac_user *user, const char **arg_names, const char **argv, int index, int default_value)
Automatically handles a single boolean argument received from a joining user, returning the value of ...
Function type definitions related to the guac_user object.
int guac_user_handle_connection(guac_user *user, int usec_timeout)
Handles all I/O for the portion of a user&#39;s Guacamole connection following the initial "select" instr...
guac_user_size_handler * size_handler
Handler for size events sent by the Guacamole web-client.
Definition: user.h:295
int optimal_width
The number of pixels the remote client requests for the display width.
Definition: user.h:54
Representation of a physical connection within a larger logical connection which may be shared...
Definition: user.h:107
Information exposed by the remote client during the connection handshake which can be used by a clien...
Definition: user.h:46
int guac_user_blob_handler(guac_user *user, guac_stream *stream, void *data, int length)
Handler for Guacamole stream blobs.
Definition: user-fntypes.h:335
void guac_user_stream_argv(guac_user *user, guac_socket *socket, const char *mimetype, const char *name, const char *value)
Streams the given connection parameter value over an argument value stream ("argv" instruction)...
int guac_user_argv_handler(guac_user *user, guac_stream *stream, char *mimetype, char *name)
Handler for Guacamole argument value (argv) streams received from a user.
Definition: user-fntypes.h:312
guac_user_leave_handler * leave_handler
Handler for leave events fired by the guac_client when a guac_user is leaving an active connection...
Definition: user.h:427
int optimal_height
The number of pixels the remote client requests for the display height.
Definition: user.h:62
Type definitions related to the guac_pool pool of unique integers.
int last_frame_duration
The duration of the last frame rendered by the user, in milliseconds.
Definition: user.h:170
int guac_user_handle_instruction(guac_user *user, const char *opcode, int argc, char **argv)
Call the appropriate handler defined by the given user for the given instruction. ...
int guac_user_key_handler(guac_user *user, int keysym, int pressed)
Handler for Guacamole key events, invoked when a "key" event has been received from a user...
Definition: user-fntypes.h:161
int active
Non-zero if this user is active (connected), and zero otherwise.
Definition: user.h:141
void guac_user_log(guac_user *user, guac_client_log_level level, const char *format,...)
Writes a message in the log used by the given user.
const char ** video_mimetypes
NULL-terminated array of client-supported video mimetypes.
Definition: user.h:74
int64_t guac_timestamp
An arbitrary timestamp denoting a relative time value in milliseconds.
Definition: timestamp-types.h:34
int guac_user_file_handler(guac_user *user, guac_stream *stream, char *mimetype, char *filename)
Handler for Guacamole file streams received from a user.
Definition: user-fntypes.h:253
int guac_user_touch_handler(guac_user *user, int id, int x, int y, int x_radius, int y_radius, double angle, double force)
Handler for Guacamole touch events, invoked when a "touch" instruction has been received from a user...
Definition: user-fntypes.h:140
int guac_user_clipboard_handler(guac_user *user, guac_stream *stream, char *mimetype)
Handler for Guacamole clipboard streams received from a user.
Definition: user-fntypes.h:206
Guacamole proxy client.
Definition: client.h:46
void guac_user_free_stream(guac_user *user, guac_stream *stream)
Returns the given stream to the pool of available streams, such that it can be reused by any subseque...
int guac_user_parse_args_int(guac_user *user, const char **arg_names, const char **argv, int index, int default_value)
Automatically handles a single integer argument received from a joining user, returning the integer v...
const char ** audio_mimetypes
NULL-terminated array of client-supported audio mimetypes.
Definition: user.h:68
A pool of integers.
Definition: pool.h:34
guac_user_argv_handler * argv_handler
Handler for argv events (updates to the connection parameters of an in-progress connection) sent by t...
Definition: user.h:510
int guac_user_ack_handler(guac_user *user, guac_stream *stream, char *error, guac_protocol_status status)
Handler for Guacamole stream "ack" instructions.
Definition: user-fntypes.h:364
guac_stream * guac_user_alloc_stream(guac_user *user)
Allocates a new stream.
void guac_user_free(guac_user *user)
Frees the given user and all associated resources.
guac_socket * socket
This user&#39;s actual socket.
Definition: user.h:119
int guac_user_pipe_handler(guac_user *user, guac_stream *stream, char *mimetype, char *name)
Handler for Guacamole pipe streams received from a user.
Definition: user-fntypes.h:282
char * guac_user_parse_args_string(guac_user *user, const char **arg_names, const char **argv, int index, const char *default_value)
Automatically handles a single argument received from a joining user, returning a newly-allocated str...
int guac_user_put_handler(guac_user *user, guac_object *object, guac_stream *stream, char *mimetype, char *name)
Handler for Guacamole object put requests.
Definition: user-fntypes.h:499
Type definitions related to Guacamole layers.
int guac_user_leave_handler(guac_user *user)
Handler for Guacamole leave events.
Definition: user-fntypes.h:430
guac_composite_mode
Composite modes used by Guacamole draw instructions.
Definition: protocol-types.h:170
void guac_user_abort(guac_user *user, guac_protocol_status status, const char *format,...)
Signals the given user to stop gracefully, while also signalling via the Guacamole protocol that an e...
void guac_user_stream_jpeg(guac_user *user, 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_protocol_status
Set of all possible status codes returned by protocol operations.
Definition: protocol-types.h:44
Represents a single layer within the Guacamole protocol.
Definition: layer.h:34
Represents a single stream within the Guacamole protocol.
Definition: stream.h:32
guac_protocol_version protocol_version
The Guacamole protocol version that the remote system supports, allowing for feature support to be ne...
Definition: user.h:103
const char * timezone
The timezone of the remote system.
Definition: user.h:97
guac_client * client
The guac_client to which this user belongs.
Definition: user.h:112
void vguac_user_abort(guac_user *user, guac_protocol_status status, const char *format, va_list ap)
Signals the given user to stop gracefully, while also signalling via the Guacamole protocol that an e...
void guac_user_free_object(guac_user *user, guac_object *object)
Returns the given object to the pool of available objects, such that it can be reused by any subseque...
guac_client_log_level
All supported log levels used by the logging subsystem of each Guacamole client.
Definition: client-types.h:62
guac_user_put_handler * put_handler
Handler for put events sent by the Guacamole web-client.
Definition: user.h:467
guac_user * guac_user_alloc()
Allocates a new, blank user, not associated with any specific client or socket.
void guac_user_stream_png(guac_user *user, 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...
char * user_id
The unique identifier allocated for this user, which may be used within the Guacamole protocol to ref...
Definition: user.h:127
Type definitions related to Guacamole protocol timestamps.
Type definitions related to the guac_user object.
Constants related to the Guacamole user structure, guac_user.