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 #ifndef _GUAC_PROTOCOL_H
00039 #define _GUAC_PROTOCOL_H
00040
00041 #include <cairo/cairo.h>
00042
00043 #include "socket.h"
00044
00057 typedef int64_t guac_timestamp;
00058
00063 typedef enum guac_composite_mode {
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 GUAC_COMP_ROUT = 0x2,
00075 GUAC_COMP_ATOP = 0x6,
00076 GUAC_COMP_XOR = 0xA,
00077 GUAC_COMP_ROVER = 0xB,
00078 GUAC_COMP_OVER = 0xE,
00079 GUAC_COMP_PLUS = 0xF,
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 GUAC_COMP_RIN = 0x1,
00090 GUAC_COMP_IN = 0x4,
00091 GUAC_COMP_OUT = 0x8,
00092 GUAC_COMP_RATOP = 0x9,
00093 GUAC_COMP_SRC = 0xC
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106 } guac_composite_mode;
00107
00108
00113 typedef enum guac_transfer_function {
00114
00115
00116 GUAC_TRANSFER_BINARY_BLACK = 0x0,
00117 GUAC_TRANSFER_BINARY_WHITE = 0xF,
00118
00119
00120 GUAC_TRANSFER_BINARY_SRC = 0x3,
00121 GUAC_TRANSFER_BINARY_DEST = 0x5,
00122 GUAC_TRANSFER_BINARY_NSRC = 0xC,
00123 GUAC_TRANSFER_BINARY_NDEST = 0xA,
00124
00125
00126 GUAC_TRANSFER_BINARY_AND = 0x1,
00127 GUAC_TRANSFER_BINARY_NAND = 0xE,
00128
00129
00130 GUAC_TRANSFER_BINARY_OR = 0x7,
00131 GUAC_TRANSFER_BINARY_NOR = 0x8,
00132
00133
00134 GUAC_TRANSFER_BINARY_XOR = 0x6,
00135 GUAC_TRANSFER_BINARY_XNOR = 0x9,
00136
00137
00138 GUAC_TRANSFER_BINARY_NSRC_AND = 0x4,
00139 GUAC_TRANSFER_BINARY_NSRC_NAND = 0xB,
00140
00141
00142 GUAC_TRANSFER_BINARY_NSRC_OR = 0xD,
00143 GUAC_TRANSFER_BINARY_NSRC_NOR = 0x2,
00144
00145
00146 GUAC_TRANSFER_BINARY_NDEST_AND = 0x2,
00147 GUAC_TRANSFER_BINARY_NDEST_NAND = 0xD,
00148
00149
00150 GUAC_TRANSFER_BINARY_NDEST_OR = 0xB,
00151 GUAC_TRANSFER_BINARY_NDEST_NOR = 0x4
00152
00153 } guac_transfer_function;
00154
00158 typedef enum guac_line_cap_style {
00159 GUAC_LINE_CAP_BUTT = 0x0,
00160 GUAC_LINE_CAP_ROUND = 0x1,
00161 GUAC_LINE_CAP_SQUARE = 0x2
00162 } guac_line_cap_style;
00163
00167 typedef enum guac_line_join_style {
00168 GUAC_LINE_JOIN_BEVEL = 0x0,
00169 GUAC_LINE_JOIN_MITER = 0x1,
00170 GUAC_LINE_JOIN_ROUND = 0x2
00171 } guac_line_join_style;
00172
00173 typedef struct guac_layer guac_layer;
00174
00178 struct guac_layer {
00179
00183 int index;
00184
00188 guac_layer* __next;
00189
00194 guac_layer* __next_available;
00195
00196 };
00197
00201 typedef struct guac_instruction {
00202
00206 char* opcode;
00207
00211 int argc;
00212
00216 char** argv;
00217
00218 } guac_instruction;
00219
00220
00226 void guac_instruction_free(guac_instruction* instruction);
00227
00238 int guac_protocol_instructions_waiting(guac_socket* socket, int usec_timeout);
00239
00256 guac_instruction* guac_protocol_read_instruction(guac_socket* socket,
00257 int usec_timeout);
00258
00278 guac_instruction* guac_protocol_expect_instruction(guac_socket* socket,
00279 int usec_timeout, const char* opcode);
00280
00289 guac_timestamp guac_protocol_get_timestamp();
00290
00291
00292
00303 int guac_protocol_send_args(guac_socket* socket, const char** args);
00304
00315 int guac_protocol_send_connect(guac_socket* socket, const char** args);
00316
00326 int guac_protocol_send_disconnect(guac_socket* socket);
00327
00338 int guac_protocol_send_error(guac_socket* socket, const char* error);
00339
00352 int guac_protocol_send_set(guac_socket* socket, const guac_layer* layer,
00353 const char* name, const char* value);
00354
00365 int guac_protocol_send_select(guac_socket* socket, const char* protocol);
00366
00378 int guac_protocol_send_sync(guac_socket* socket, guac_timestamp timestamp);
00379
00380
00381
00399 int guac_protocol_send_arc(guac_socket* socket, const guac_layer* layer,
00400 int x, int y, int radius, double startAngle, double endAngle,
00401 int negative);
00402
00418 int guac_protocol_send_cfill(guac_socket* socket,
00419 guac_composite_mode mode, const guac_layer* layer,
00420 int r, int g, int b, int a);
00421
00432 int guac_protocol_send_clip(guac_socket* socket, const guac_layer* layer);
00433
00444 int guac_protocol_send_close(guac_socket* socket, const guac_layer* layer);
00445
00466 int guac_protocol_send_copy(guac_socket* socket,
00467 const guac_layer* srcl, int srcx, int srcy, int w, int h,
00468 guac_composite_mode mode, const guac_layer* dstl, int dstx, int dsty);
00469
00488 int guac_protocol_send_cstroke(guac_socket* socket,
00489 guac_composite_mode mode, const guac_layer* layer,
00490 guac_line_cap_style cap, guac_line_join_style join, int thickness,
00491 int r, int g, int b, int a);
00492
00509 int guac_protocol_send_cursor(guac_socket* socket, int x, int y,
00510 const guac_layer* srcl, int srcx, int srcy, int w, int h);
00511
00528 int guac_protocol_send_curve(guac_socket* socket, const guac_layer* layer,
00529 int cp1x, int cp1y, int cp2x, int cp2y, int x, int y);
00530
00541 int guac_protocol_send_identity(guac_socket* socket, const guac_layer* layer);
00542
00555 int guac_protocol_send_lfill(guac_socket* socket,
00556 guac_composite_mode mode, const guac_layer* layer,
00557 const guac_layer* srcl);
00558
00571 int guac_protocol_send_line(guac_socket* socket, const guac_layer* layer,
00572 int x, int y);
00573
00589 int guac_protocol_send_lstroke(guac_socket* socket,
00590 guac_composite_mode mode, const guac_layer* layer,
00591 guac_line_cap_style cap, guac_line_join_style join, int thickness,
00592 const guac_layer* srcl);
00593
00609 int guac_protocol_send_png(guac_socket* socket, guac_composite_mode mode,
00610 const guac_layer* layer, int x, int y, cairo_surface_t* surface);
00611
00622 int guac_protocol_send_pop(guac_socket* socket, const guac_layer* layer);
00623
00634 int guac_protocol_send_push(guac_socket* socket, const guac_layer* layer);
00635
00650 int guac_protocol_send_rect(guac_socket* socket, const guac_layer* layer,
00651 int x, int y, int width, int height);
00652
00663 int guac_protocol_send_reset(guac_socket* socket, const guac_layer* layer);
00664
00677 int guac_protocol_send_start(guac_socket* socket, const guac_layer* layer,
00678 int x, int y);
00679
00700 int guac_protocol_send_transfer(guac_socket* socket,
00701 const guac_layer* srcl, int srcx, int srcy, int w, int h,
00702 guac_transfer_function fn, const guac_layer* dstl, int dstx, int dsty);
00703
00720 int guac_protocol_send_transform(guac_socket* socket,
00721 const guac_layer* layer,
00722 double a, double b, double c,
00723 double d, double e, double f);
00724
00725
00726
00737 int guac_protocol_send_dispose(guac_socket* socket, const guac_layer* layer);
00738
00755 int guac_protocol_send_distort(guac_socket* socket,
00756 const guac_layer* layer,
00757 double a, double b, double c,
00758 double d, double e, double f);
00759
00775 int guac_protocol_send_move(guac_socket* socket, const guac_layer* layer,
00776 const guac_layer* parent, int x, int y, int z);
00777
00789 int guac_protocol_send_shade(guac_socket* socket, const guac_layer* layer,
00790 int a);
00791
00804 int guac_protocol_send_size(guac_socket* socket, const guac_layer* layer,
00805 int w, int h);
00806
00807
00808
00819 int guac_protocol_send_clipboard(guac_socket* socket, const char* data);
00820
00828 int guac_protocol_send_name(guac_socket* socket, const char* name);
00829
00830 #endif
00831