libguac  0.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
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 
24 #ifndef _GUAC_CLIENT_H
25 #define _GUAC_CLIENT_H
26 
33 #include "instruction.h"
34 #include "layer.h"
35 #include "pool.h"
36 #include "protocol.h"
37 #include "socket.h"
38 #include "stream.h"
39 #include "timestamp.h"
40 
41 #include <stdarg.h>
42 
46 #define GUAC_CLIENT_MAX_STREAMS 64
47 
51 #define GUAC_CLIENT_CLOSED_STREAM_INDEX -1
52 
53 typedef struct guac_client guac_client;
54 
60 
64 typedef int guac_client_mouse_handler(guac_client* client, int x, int y, int button_mask);
65 
69 typedef int guac_client_key_handler(guac_client* client, int keysym, int pressed);
70 
74 typedef int guac_client_clipboard_handler(guac_client* client, char* copied);
75 
80  int width, int height);
81 
85 typedef int guac_client_file_handler(guac_client* client, guac_stream* stream,
86  char* mimetype, char* filename);
87 
91 typedef int guac_client_pipe_handler(guac_client* client, guac_stream* stream,
92  char* mimetype, char* name);
93 
97 typedef int guac_client_blob_handler(guac_client* client, guac_stream* stream,
98  void* data, int length);
99 
103 typedef int guac_client_ack_handler(guac_client* client, guac_stream* stream,
104  char* error, guac_protocol_status status);
105 
109 typedef int guac_client_end_handler(guac_client* client, guac_stream* stream);
110 
114 typedef int guac_client_audio_handler(guac_client* client, char* mimetype);
115 
119 typedef int guac_client_video_handler(guac_client* client, char* mimetype);
120 
126 
130 typedef void guac_client_log_handler(guac_client* client, const char* format, va_list args);
131 
135 typedef int guac_client_init_handler(guac_client* client, int argc, char** argv);
136 
140 #define GUAC_CLIENT_MOUSE_LEFT 0x01
141 
145 #define GUAC_CLIENT_MOUSE_MIDDLE 0x02
146 
150 #define GUAC_CLIENT_MOUSE_RIGHT 0x04
151 
159 #define GUAC_CLIENT_MOUSE_SCROLL_UP 0x08
160 
168 #define GUAC_CLIENT_MOUSE_SCROLL_DOWN 0x10
169 
176 #define GUAC_BUFFER_POOL_INITIAL_SIZE 1024
177 
182 typedef enum guac_client_state {
183 
189 
195 
197 
202 typedef struct guac_client_info {
203 
211 
219 
224  const char** audio_mimetypes;
225 
230  const char** video_mimetypes;
231 
240 
242 
249 struct guac_client {
250 
259 
267 
273 
279 
285 
291  void* data;
292 
308 
335 
353 
374 
391 
410 
429 
448 
467 
485 
508 
532 
556 
562  guac_pool* __buffer_pool;
563 
569  guac_pool* __layer_pool;
570 
574  guac_pool* __stream_pool;
575 
579  guac_stream __output_streams[GUAC_CLIENT_MAX_STREAMS];
580 
584  guac_stream __input_streams[GUAC_CLIENT_MAX_STREAMS];
585 
586 };
587 
595 
601 void guac_client_free(guac_client* client);
602 
614 
625 void guac_client_log_info(guac_client* client, const char* format, ...);
626 
637 void guac_client_log_error(guac_client* client, const char* format, ...);
638 
650 void vguac_client_log_info(guac_client* client, const char* format, va_list ap);
651 
663 void vguac_client_log_error(guac_client* client, const char* format, va_list ap);
664 
672 void guac_client_stop(guac_client* client);
673 
686  const char* format, ...);
687 
701  const char* format, va_list ap);
702 
711 
720 
728 void guac_client_free_buffer(guac_client* client, guac_layer* layer);
729 
737 void guac_client_free_layer(guac_client* client, guac_layer* layer);
738 
747 
755 void guac_client_free_stream(guac_client* client, guac_stream* stream);
756 
760 extern const guac_layer* GUAC_DEFAULT_LAYER;
761 
762 #endif