00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _GUAC_CLIENT_H
00040 #define _GUAC_CLIENT_H
00041
00042 #include <stdarg.h>
00043
00044 #include "instruction.h"
00045 #include "layer.h"
00046 #include "pool.h"
00047 #include "socket.h"
00048 #include "stream.h"
00049 #include "timestamp.h"
00050
00057 typedef struct guac_client guac_client;
00058
00063 typedef int guac_client_handle_messages(guac_client* client);
00064
00068 typedef int guac_client_mouse_handler(guac_client* client, int x, int y, int button_mask);
00069
00073 typedef int guac_client_key_handler(guac_client* client, int keysym, int pressed);
00074
00078 typedef int guac_client_clipboard_handler(guac_client* client, char* copied);
00079
00083 typedef int guac_client_size_handler(guac_client* client,
00084 int width, int height);
00085
00089 typedef int guac_client_audio_handler(guac_client* client, char* mimetype);
00090
00094 typedef int guac_client_video_handler(guac_client* client, char* mimetype);
00095
00100 typedef int guac_client_free_handler(guac_client* client);
00101
00105 typedef void guac_client_log_handler(guac_client* client, const char* format, va_list args);
00106
00110 typedef int guac_client_init_handler(guac_client* client, int argc, char** argv);
00111
00115 #define GUAC_CLIENT_MOUSE_LEFT 0x01
00116
00120 #define GUAC_CLIENT_MOUSE_MIDDLE 0x02
00121
00125 #define GUAC_CLIENT_MOUSE_RIGHT 0x04
00126
00134 #define GUAC_CLIENT_MOUSE_SCROLL_UP 0x08
00135
00143 #define GUAC_CLIENT_MOUSE_SCROLL_DOWN 0x10
00144
00151 #define GUAC_BUFFER_POOL_INITIAL_SIZE 1024
00152
00157 typedef enum guac_client_state {
00158
00163 GUAC_CLIENT_RUNNING,
00164
00169 GUAC_CLIENT_STOPPING
00170
00171 } guac_client_state;
00172
00177 typedef struct guac_client_info {
00178
00185 int optimal_width;
00186
00193 int optimal_height;
00194
00199 const char** audio_mimetypes;
00200
00205 const char** video_mimetypes;
00206
00207 } guac_client_info;
00208
00215 struct guac_client {
00216
00224 guac_socket* socket;
00225
00232 guac_client_state state;
00233
00238 guac_timestamp last_received_timestamp;
00239
00244 guac_timestamp last_sent_timestamp;
00245
00250 guac_client_info info;
00251
00257 void* data;
00258
00273 guac_client_handle_messages* handle_messages;
00274
00300 guac_client_mouse_handler* mouse_handler;
00301
00318 guac_client_key_handler* key_handler;
00319
00339 guac_client_clipboard_handler* clipboard_handler;
00340
00356 guac_client_size_handler* size_handler;
00357
00379 guac_client_free_handler* free_handler;
00380
00403 guac_client_log_handler* log_info_handler;
00404
00405
00428 guac_client_log_handler* log_error_handler;
00429
00435 guac_pool* __buffer_pool;
00436
00442 guac_pool* __layer_pool;
00443
00447 guac_pool* __stream_pool;
00448
00449 };
00450
00457 guac_client* guac_client_alloc();
00458
00464 void guac_client_free(guac_client* client);
00465
00476 int guac_client_handle_instruction(guac_client* client, guac_instruction* instruction);
00477
00488 void guac_client_log_info(guac_client* client, const char* format, ...);
00489
00500 void guac_client_log_error(guac_client* client, const char* format, ...);
00501
00513 void vguac_client_log_info(guac_client* client, const char* format, va_list ap);
00514
00526 void vguac_client_log_error(guac_client* client, const char* format, va_list ap);
00527
00535 void guac_client_stop(guac_client* client);
00536
00544 guac_layer* guac_client_alloc_buffer(guac_client* client);
00545
00553 guac_layer* guac_client_alloc_layer(guac_client* client);
00554
00562 void guac_client_free_buffer(guac_client* client, guac_layer* layer);
00563
00571 void guac_client_free_layer(guac_client* client, guac_layer* layer);
00572
00580 guac_stream* guac_client_alloc_stream(guac_client* client);
00581
00589 void guac_client_free_stream(guac_client* client, guac_stream* stream);
00590
00591
00595 extern const guac_layer* GUAC_DEFAULT_LAYER;
00596
00597 #endif