GUAC-236: Add argument parsing stubs to instruction handlers.

This commit is contained in:
Michael Jumper 2016-02-26 18:35:15 -08:00
parent d530d92651
commit 0e5a7bb5c2
12 changed files with 262 additions and 0 deletions

View File

@ -21,9 +21,29 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
#include <string.h>
int guacenc_handle_blob(int argc, const char** argv) { int guacenc_handle_blob(int argc, const char** argv) {
/* Verify argument count */
if (argc < 2) {
guacenc_log(GUAC_LOG_DEBUG, "\"blob\" instruction incomplete");
return 1;
}
/* Parse arguments */
int index = atoi(argv[0]);
const char* data = argv[1];
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "blob: stream=%i data=[%i chars]",
index, strlen(data));
return 0; return 0;
} }

View File

@ -21,9 +21,32 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_cfill(int argc, const char** argv) { int guacenc_handle_cfill(int argc, const char** argv) {
/* Verify argument count */
if (argc < 6) {
guacenc_log(GUAC_LOG_DEBUG, "\"cfill\" instruction incomplete");
return 1;
}
/* Parse arguments */
int mask = atoi(argv[0]);
int index = atoi(argv[1]);
int r = atoi(argv[2]);
int g = atoi(argv[3]);
int b = atoi(argv[4]);
int a = atoi(argv[5]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "cfill: mask=0x%X layer=%i "
"rgba(%i, %i, %i, %i)", mask, index, r, g, b, a);
return 0; return 0;
} }

View File

@ -21,9 +21,36 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_copy(int argc, const char** argv) { int guacenc_handle_copy(int argc, const char** argv) {
/* Verify argument count */
if (argc < 9) {
guacenc_log(GUAC_LOG_DEBUG, "\"copy\" instruction incomplete");
return 1;
}
/* Parse arguments */
int src_index = atoi(argv[0]);
int src_x = atoi(argv[1]);
int src_y = atoi(argv[2]);
int src_w = atoi(argv[3]);
int src_h = atoi(argv[4]);
int mask = atoi(argv[5]);
int dst_index = atoi(argv[6]);
int dst_x = atoi(argv[7]);
int dst_y = atoi(argv[8]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "copy: src_layer=%i (%i, %i) %ix%i mask=0x%X "
"dst_layer=%i (%i, %i)", src_index, src_x, src_y, src_w, src_h,
mask, dst_index, dst_x, dst_y);
return 0; return 0;
} }

View File

@ -21,9 +21,34 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_cursor(int argc, const char** argv) { int guacenc_handle_cursor(int argc, const char** argv) {
/* Verify argument count */
if (argc < 7) {
guacenc_log(GUAC_LOG_DEBUG, "\"cursor\" instruction incomplete");
return 1;
}
/* Parse arguments */
int hotspot_x = atoi(argv[0]);
int hotspot_y = atoi(argv[1]);
int src_index = atoi(argv[2]);
int src_x = atoi(argv[3]);
int src_y = atoi(argv[4]);
int src_w = atoi(argv[5]);
int src_h = atoi(argv[6]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "cursor: hotspot (%i, %i) "
"src_layer=%i (%i, %i) %ix%i", hotspot_x, hotspot_y,
src_index, src_x, src_y, src_w, src_h);
return 0; return 0;
} }

View File

@ -21,9 +21,26 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_dispose(int argc, const char** argv) { int guacenc_handle_dispose(int argc, const char** argv) {
/* Verify argument count */
if (argc < 1) {
guacenc_log(GUAC_LOG_DEBUG, "\"dispose\" instruction incomplete");
return 1;
}
/* Parse arguments */
int index = atoi(argv[0]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "dispose: layer=%i", index);
return 0; return 0;
} }

View File

@ -21,9 +21,26 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_end(int argc, const char** argv) { int guacenc_handle_end(int argc, const char** argv) {
/* Verify argument count */
if (argc < 1) {
guacenc_log(GUAC_LOG_DEBUG, "\"end\" instruction incomplete");
return 1;
}
/* Parse arguments */
int index = atoi(argv[0]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "end: stream=%i", index);
return 0; return 0;
} }

View File

@ -21,9 +21,34 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_img(int argc, const char** argv) { int guacenc_handle_img(int argc, const char** argv) {
/* Verify argument count */
if (argc < 6) {
guacenc_log(GUAC_LOG_DEBUG, "\"img\" instruction incomplete");
return 1;
}
/* Parse arguments */
int stream_index = atoi(argv[0]);
int mask = atoi(argv[1]);
int layer_index = atoi(argv[2]);
const char* mimetype = argv[3];
int x = atoi(argv[4]);
int y = atoi(argv[5]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "img: stream=%i mask=0x%X layer=%i "
"mimetype=%s (%i, %i)", stream_index, mask, layer_index,
mimetype, x, y);
return 0; return 0;
} }

View File

@ -21,9 +21,31 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_move(int argc, const char** argv) { int guacenc_handle_move(int argc, const char** argv) {
/* Verify argument count */
if (argc < 5) {
guacenc_log(GUAC_LOG_DEBUG, "\"move\" instruction incomplete");
return 1;
}
/* Parse arguments */
int layer_index = atoi(argv[0]);
int parent_index = atoi(argv[1]);
int x = atoi(argv[2]);
int y = atoi(argv[3]);
int z = atoi(argv[4]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "move: layer=%i parent=%i (%i, %i) z=%i",
layer_index, parent_index, x, y, z);
return 0; return 0;
} }

View File

@ -21,9 +21,31 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_rect(int argc, const char** argv) { int guacenc_handle_rect(int argc, const char** argv) {
/* Verify argument count */
if (argc < 5) {
guacenc_log(GUAC_LOG_DEBUG, "\"rect\" instruction incomplete");
return 1;
}
/* Parse arguments */
int index = atoi(argv[0]);
int x = atoi(argv[1]);
int y = atoi(argv[2]);
int width = atoi(argv[3]);
int height = atoi(argv[4]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "rect: layer=%i (%i, %i) %ix%i",
index, x, y, width, height);
return 0; return 0;
} }

View File

@ -21,9 +21,27 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_shade(int argc, const char** argv) { int guacenc_handle_shade(int argc, const char** argv) {
/* Verify argument count */
if (argc < 2) {
guacenc_log(GUAC_LOG_DEBUG, "\"shade\" instruction incomplete");
return 1;
}
/* Parse arguments */
int index = atoi(argv[0]);
int opacity = atoi(argv[1]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "shade: layer=%i opacity=0x%X", index, opacity);
return 0; return 0;
} }

View File

@ -21,9 +21,28 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_size(int argc, const char** argv) { int guacenc_handle_size(int argc, const char** argv) {
/* Verify argument count */
if (argc < 3) {
guacenc_log(GUAC_LOG_DEBUG, "\"size\" instruction incomplete");
return 1;
}
/* Parse arguments */
int index = atoi(argv[0]);
int width = atoi(argv[1]);
int height = atoi(argv[2]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "size: layer=%i %ix%i", index, width, height);
return 0; return 0;
} }

View File

@ -21,9 +21,36 @@
*/ */
#include "config.h" #include "config.h"
#include "log.h"
#include <guacamole/client.h>
#include <stdlib.h>
int guacenc_handle_transfer(int argc, const char** argv) { int guacenc_handle_transfer(int argc, const char** argv) {
/* Verify argument count */
if (argc < 9) {
guacenc_log(GUAC_LOG_DEBUG, "\"transform\" instruction incomplete");
return 1;
}
/* Parse arguments */
int src_index = atoi(argv[0]);
int src_x = atoi(argv[1]);
int src_y = atoi(argv[2]);
int src_w = atoi(argv[3]);
int src_h = atoi(argv[4]);
int function = atoi(argv[5]);
int dst_index = atoi(argv[6]);
int dst_x = atoi(argv[7]);
int dst_y = atoi(argv[8]);
/* STUB */ /* STUB */
guacenc_log(GUAC_LOG_DEBUG, "transform: src_layer=%i (%i, %i) %ix%i "
"function=0x%X dst_layer=%i (%i, %i)", src_index, src_x, src_y,
src_w, src_h, function, dst_index, dst_x, dst_y);
return 0; return 0;
} }