libguac  0.9.12-incubating
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 
92 };
93 
94 struct guac_user {
95 
100 
107 
114  char* user_id;
115 
120  int owner;
121 
128  int active;
129 
136  guac_user* __prev;
137 
144  guac_user* __next;
145 
151 
158 
164 
170 
174  guac_pool* __stream_pool;
175 
179  guac_stream* __output_streams;
180 
184  guac_stream* __input_streams;
185 
189  guac_pool* __object_pool;
190 
194  guac_object* __objects;
195 
199  void* data;
200 
227 
245 
266 
283 
302 
321 
340 
359 
377 
396 
415 
435 
455 
477 
478 };
479 
487 
493 void guac_user_free(guac_user* user);
494 
518 int guac_user_handle_instruction(guac_user* user, const char* opcode,
519  int argc, char** argv);
520 
529 
537 void guac_user_free_stream(guac_user* user, guac_stream* stream);
538 
545 void guac_user_stop(guac_user* user);
546 
559  const char* format, ...);
560 
574  const char* format, va_list ap);
575 
587  const char* format, ...);
588 
601  const char* format, va_list ap);
602 
614 
625 void guac_user_free_object(guac_user* user, guac_object* object);
626 
656 void guac_user_stream_png(guac_user* user, guac_socket* socket,
657  guac_composite_mode mode, const guac_layer* layer, int x, int y,
658  cairo_surface_t* surface);
659 
694 void guac_user_stream_jpeg(guac_user* user, guac_socket* socket,
695  guac_composite_mode mode, const guac_layer* layer, int x, int y,
696  cairo_surface_t* surface, int quality);
697 
740 void guac_user_stream_webp(guac_user* user, guac_socket* socket,
741  guac_composite_mode mode, const guac_layer* layer, int x, int y,
742  cairo_surface_t* surface, int quality, int lossless);
743 
756 
793 char* guac_user_parse_args_string(guac_user* user, const char** arg_names,
794  const char** argv, int index, const char* default_value);
795 
826 int guac_user_parse_args_int(guac_user* user, const char** arg_names,
827  const char** argv, int index, int default_value);
828 
862 int guac_user_parse_args_boolean(guac_user* user, const char** arg_names,
863  const char** argv, int index, int default_value);
864 
865 #endif
866 
guac_user_end_handler * end_handler
Handler for stream end events sent by the Guacamole web-client.
Definition: user.h:376
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:169
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:244
int guac_user_get_handler(guac_user *user, guac_object *object, char *name)
Handler for Guacamole object get requests.
Definition: user-fntypes.h:397
guac_user_sync_handler * sync_handler
Handler for sync events sent by the Guacamole web-client.
Definition: user.h:395
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:138
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:376
guac_user_get_handler * get_handler
Handler for get events sent by the Guacamole web-client.
Definition: user.h:434
int processing_lag
The overall lag experienced by the user relative to the stream of frames, roughly excluding network l...
Definition: user.h:163
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:182
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:150
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:306
guac_user_blob_handler * blob_handler
Handler for blob events sent by the Guacamole web-client.
Definition: user.h:358
void * data
Arbitrary user-specific data.
Definition: user.h:199
guac_user_file_handler * file_handler
Handler for file events sent by the Guacamole web-client.
Definition: user.h:301
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:226
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:320
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:265
guac_user_ack_handler * ack_handler
Handler for ack events sent by the Guacamole web-client.
Definition: user.h:339
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:120
guac_user_audio_handler * audio_handler
Handler for audio events sent by the Guacamole web-client.
Definition: user.h:476
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.
guac_user_size_handler * size_handler
Handler for size events sent by the Guacamole web-client.
Definition: user.h:282
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:94
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:260
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:414
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:157
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:116
int active
Non-zero if this user is active (connected), and zero otherwise.
Definition: user.h:128
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:208
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:161
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
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:289
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:106
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:237
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:424
Type definitions related to Guacamole layers.
int guac_user_leave_handler(guac_user *user)
Handler for Guacamole leave events.
Definition: user-fntypes.h:355
guac_composite_mode
Composite modes used by Guacamole draw instructions.
Definition: protocol-types.h:141
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_client * client
The guac_client to which this user belongs.
Definition: user.h:99
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:454
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:114
Type definitions related to Guacamole protocol timestamps.
Type definitions related to the guac_user object.
Constants related to the Guacamole user structure, guac_user.