int guac_protocol_send_copy(guac_socket* socket, const guac_layer* srcl, int srcx, int srcy, int w, int h, guac_composite_mode mode, const guac_layer* dstl, int dstx, int dsty) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "4.copy,") || __guac_socket_write_length_int(socket, srcl->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, srcx) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, srcy) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, w) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, h) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, mode) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, dstl->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, dstx) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, dsty) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_cstroke(guac_socket* socket, guac_composite_mode mode, const guac_layer* layer, guac_line_cap_style cap, guac_line_join_style join, int thickness, int r, int g, int b, int a) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "7.cstroke,") || __guac_socket_write_length_int(socket, mode) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, layer->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, cap) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, join) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, thickness) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, r) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, g) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, b) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, a) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_transfer(guac_socket* socket, const guac_layer* srcl, int srcx, int srcy, int w, int h, guac_transfer_function fn, const guac_layer* dstl, int dstx, int dsty) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "8.transfer,") || __guac_socket_write_length_int(socket, srcl->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, srcx) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, srcy) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, w) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, h) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, fn) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, dstl->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, dstx) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, dsty) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
ssize_t __guac_socket_write_length_string(guac_socket* socket, const char* str) { return guac_socket_write_int(socket, guac_utf8_strlen(str)) || guac_socket_write_string(socket, ".") || guac_socket_write_string(socket, str); }
int guac_protocol_send_arc(guac_socket* socket, const guac_layer* layer, int x, int y, int radius, double startAngle, double endAngle, int negative) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "3.arc,") || __guac_socket_write_length_int(socket, layer->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, x) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, y) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, radius) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_double(socket, startAngle) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_double(socket, endAngle) || guac_socket_write_string(socket, ",") || guac_socket_write_string(socket, negative ? "1.1" : "1.0") || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_end(guac_socket* socket, const guac_stream* stream) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "3.end,") || __guac_socket_write_length_int(socket, stream->index) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_distort(guac_socket* socket, const guac_layer* layer, double a, double b, double c, double d, double e, double f) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "7.distort,") || __guac_socket_write_length_int(socket, layer->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_double(socket, a) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_double(socket, b) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_double(socket, c) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_double(socket, d) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_double(socket, e) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_double(socket, f) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_name(guac_socket* socket, const char* name) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "4.name,") || __guac_socket_write_length_string(socket, name) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_curve(guac_socket* socket, const guac_layer* layer, int cp1x, int cp1y, int cp2x, int cp2y, int x, int y) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "5.curve,") || __guac_socket_write_length_int(socket, layer->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, cp1x) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, cp1y) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, cp2x) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, cp2y) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, x) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, y) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_cursor(guac_socket* socket, int x, int y, const guac_layer* srcl, int srcx, int srcy, int w, int h) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "6.cursor,") || __guac_socket_write_length_int(socket, x) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, y) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, srcl->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, srcx) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, srcy) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, w) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, h) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_ready(guac_socket* socket, const char* id) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "5.ready,") || __guac_socket_write_length_string(socket, id) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_reset(guac_socket* socket, const guac_layer* layer) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "5.reset,") || __guac_socket_write_length_int(socket, layer->index) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_select(guac_socket* socket, const char* protocol) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "6.select,") || __guac_socket_write_length_string(socket, protocol) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_sync(guac_socket* socket, guac_timestamp timestamp) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "4.sync,") || __guac_socket_write_length_int(socket, timestamp) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_undefine(guac_socket* socket, const guac_object* object) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "8.undefine,") || __guac_socket_write_length_int(socket, object->index) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
void guac_rdp_process_seamrdp_event(guac_client* client, RDP_EVENT* event) { char *input; int length_raw, length_base64; input = (char*)(event->user_data); length_raw = strlen(input); length_base64 = (length_raw+2) / 3 * 4; guac_socket_write_string(client->socket, "7.seamrdp,"); guac_socket_write_int (client->socket, length_base64); guac_socket_write_string(client->socket, "."); guac_socket_write_base64(client->socket, input, length_raw); guac_socket_flush_base64(client->socket); guac_socket_write_string(client->socket, ";"); }
int guac_protocol_send_error(guac_socket* socket, const char* error, guac_protocol_status status) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "5.error,") || __guac_socket_write_length_string(socket, error) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, status) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_nest(guac_socket* socket, int index, const char* data) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "4.nest,") || __guac_socket_write_length_int(socket, index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_string(socket, data) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_clipboard(guac_socket* socket, const guac_stream* stream, const char* mimetype) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "9.clipboard,") || __guac_socket_write_length_int(socket, stream->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_string(socket, mimetype) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_filesystem(guac_socket* socket, const guac_object* object, const char* name) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "10.filesystem,") || __guac_socket_write_length_int(socket, object->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_string(socket, name) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_cfill(guac_socket* socket, guac_composite_mode mode, const guac_layer* layer, int r, int g, int b, int a) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "5.cfill,") || __guac_socket_write_length_int(socket, mode) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, layer->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, r) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, g) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, b) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, a) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_img(guac_socket* socket, const guac_stream* stream, guac_composite_mode mode, const guac_layer* layer, const char* mimetype, int x, int y) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "3.img,") || __guac_socket_write_length_int(socket, stream->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, mode) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, layer->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_string(socket, mimetype) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, x) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, y) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_disconnect(guac_socket* socket) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "10.disconnect;"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_size(guac_socket* socket, const guac_layer* layer, int w, int h) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "4.size,") || __guac_socket_write_length_int(socket, layer->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, w) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, h) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
static int __guac_protocol_send_args(guac_socket* socket, const char** args) { int i; if (guac_socket_write_string(socket, "4.args")) return -1; for (i=0; args[i] != NULL; i++) { if (guac_socket_write_string(socket, ",")) return -1; if (__guac_socket_write_length_string(socket, args[i])) return -1; } return guac_socket_write_string(socket, ";"); }
int guac_protocol_send_set(guac_socket* socket, const guac_layer* layer, const char* name, const char* value) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "3.set,") || __guac_socket_write_length_int(socket, layer->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_string(socket, name) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_string(socket, value) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_nop(guac_socket* socket) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "3.nop;"); guac_socket_instruction_end(socket); return ret_val; }
int vguac_protocol_send_log(guac_socket* socket, const char* format, va_list args) { int ret_val; /* Copy log message into buffer */ char message[4096]; vsnprintf(message, sizeof(message), format, args); /* Log to instruction */ guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "3.log,") || __guac_socket_write_length_string(socket, message) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_video(guac_socket* socket, const guac_stream* stream, const guac_layer* layer, const char* mimetype, double duration) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "5.video,") || __guac_socket_write_length_int(socket, stream->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, layer->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_string(socket, mimetype) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_double(socket, duration) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }
int guac_protocol_send_body(guac_socket* socket, const guac_object* object, const guac_stream* stream, const char* mimetype, const char* name) { int ret_val; guac_socket_instruction_begin(socket); ret_val = guac_socket_write_string(socket, "4.body,") || __guac_socket_write_length_int(socket, object->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_int(socket, stream->index) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_string(socket, mimetype) || guac_socket_write_string(socket, ",") || __guac_socket_write_length_string(socket, name) || guac_socket_write_string(socket, ";"); guac_socket_instruction_end(socket); return ret_val; }