From 9c53b853939704c4a34772285739c60a43ed34d6 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 5 Sep 2012 00:47:21 -0700 Subject: [PATCH] Fix includes, renamed time.h to timestamp.h --- libguac/include/client.h | 58 ++++++++++++++++++++++++- libguac/include/layer.h | 38 ---------------- libguac/include/protocol.h | 2 +- libguac/include/resource.h | 21 --------- libguac/include/{time.h => timestamp.h} | 2 +- libguac/src/Makefile.am | 2 +- libguac/src/client.c | 15 ++++--- libguac/src/protocol.c | 8 ++-- 8 files changed, 74 insertions(+), 72 deletions(-) rename libguac/include/{time.h => timestamp.h} (99%) diff --git a/libguac/include/client.h b/libguac/include/client.h index 8cf9a553..9481ab5a 100644 --- a/libguac/include/client.h +++ b/libguac/include/client.h @@ -43,8 +43,9 @@ #include "instruction.h" #include "layer.h" +#include "resource.h" #include "socket.h" -#include "time.h" +#include "timestamp.h" /** * Provides functions and structures required for defining (and handling) a proxy client. @@ -476,6 +477,61 @@ void vguac_client_log_error(guac_client* client, const char* format, va_list ap) */ void guac_client_stop(guac_client* client); +/** + * Allocates a new buffer (invisible layer). An arbitrary index is + * automatically assigned if no existing buffer is available for use. + * + * @param client The proxy client to allocate the buffer for. + * @return The next available buffer, or a newly allocated buffer. + */ +guac_layer* guac_client_alloc_buffer(guac_client* client); + +/** + * Allocates a new layer. An arbitrary index is automatically assigned + * if no existing layer is available for use. + * + * @param client The proxy client to allocate the layer buffer for. + * @return The next available layer, or a newly allocated layer. + */ +guac_layer* guac_client_alloc_layer(guac_client* client); + +/** + * Returns the given buffer to the pool of available buffers, such that it + * can be reused by any subsequent call to guac_client_allow_buffer(). + * + * @param client The proxy client to return the buffer to. + * @param layer The buffer to return to the pool of available buffers. + */ +void guac_client_free_buffer(guac_client* client, guac_layer* layer); + +/** + * Returns the given layer to the pool of available layers, such that it + * can be reused by any subsequent call to guac_client_allow_layer(). + * + * @param client The proxy client to return the layer to. + * @param layer The buffer to return to the pool of available layer. + */ +void guac_client_free_layer(guac_client* client, guac_layer* layer); + +/** + * Allocates a new resource. An arbitrary index is automatically assigned + * if no existing resource index is available for use. + * + * @param client The proxy client to allocate the resource for. + * @return The next available resource, or a newly allocated resource. + */ +guac_resource* guac_client_alloc_resource(guac_client* client); + +/** + * Frees an existing resource, re-adding it to the client's resource + * pool, such that it can be reused by a subsequent call to + * guac_client_alloc_resource(). + * + * @param client The proxy client to free the resource for. + * @oaran resource The resource to return to the resource pool. + */ +void guac_client_free_resource(guac_client* client, guac_resource* resource); + /** * The default Guacamole client layer, layer 0. */ diff --git a/libguac/include/layer.h b/libguac/include/layer.h index b76f4301..b02ec6e3 100644 --- a/libguac/include/layer.h +++ b/libguac/include/layer.h @@ -38,8 +38,6 @@ #ifndef _GUAC_LAYER_H #define _GUAC_LAYER_H -#include "client.h" - /** * Provides functions and structures required for allocating and using layers. * @@ -78,41 +76,5 @@ struct guac_layer { }; -/** - * Allocates a new buffer (invisible layer). An arbitrary index is - * automatically assigned if no existing buffer is available for use. - * - * @param client The proxy client to allocate the buffer for. - * @return The next available buffer, or a newly allocated buffer. - */ -guac_layer* guac_client_alloc_buffer(guac_client* client); - -/** - * Allocates a new layer. An arbitrary index is automatically assigned - * if no existing layer is available for use. - * - * @param client The proxy client to allocate the layer buffer for. - * @return The next available layer, or a newly allocated layer. - */ -guac_layer* guac_client_alloc_layer(guac_client* client); - -/** - * Returns the given buffer to the pool of available buffers, such that it - * can be reused by any subsequent call to guac_client_allow_buffer(). - * - * @param client The proxy client to return the buffer to. - * @param layer The buffer to return to the pool of available buffers. - */ -void guac_client_free_buffer(guac_client* client, guac_layer* layer); - -/** - * Returns the given layer to the pool of available layers, such that it - * can be reused by any subsequent call to guac_client_allow_layer(). - * - * @param client The proxy client to return the layer to. - * @param layer The buffer to return to the pool of available layer. - */ -void guac_client_free_layer(guac_client* client, guac_layer* layer); - #endif diff --git a/libguac/include/protocol.h b/libguac/include/protocol.h index ba44aac3..62ade022 100644 --- a/libguac/include/protocol.h +++ b/libguac/include/protocol.h @@ -43,7 +43,7 @@ #include "layer.h" #include "resource.h" #include "socket.h" -#include "time.h" +#include "timestamp.h" /** * Provides functions and structures required for communicating using the diff --git a/libguac/include/resource.h b/libguac/include/resource.h index eda0e204..5e03cd0d 100644 --- a/libguac/include/resource.h +++ b/libguac/include/resource.h @@ -39,8 +39,6 @@ #ifndef _GUAC_RESOURCE_H #define _GUAC_RESOURCE_H -#include "client.h" - /** * Provides functions and structures required for handling resources. * @@ -88,23 +86,4 @@ typedef int guac_resource_accept_handler(guac_resource* resource, const char* mi */ typedef int guac_resource_reject_handler(guac_resource* resource); -/** - * Allocates a new resource. An arbitrary index is automatically assigned - * if no existing resource index is available for use. - * - * @param client The proxy client to allocate the resource for. - * @return The next available resource, or a newly allocated resource. - */ -guac_resource* guac_client_alloc_resource(guac_client* client); - -/** - * Frees an existing resource, re-adding it to the client's resource - * pool, such that it can be reused by a subsequent call to - * guac_client_alloc_resource(). - * - * @param client The proxy client to free the resource for. - * @oaran resource The resource to return to the resource pool. - */ -void guac_client_free_resource(guac_client* client, guac_resource* resource); - #endif diff --git a/libguac/include/time.h b/libguac/include/timestamp.h similarity index 99% rename from libguac/include/time.h rename to libguac/include/timestamp.h index 08ac665d..baff204c 100644 --- a/libguac/include/time.h +++ b/libguac/include/timestamp.h @@ -43,7 +43,7 @@ /** * Provides functions and structures for creating timestamps. * - * @file time.h + * @file timestamp.h */ /** diff --git a/libguac/src/Makefile.am b/libguac/src/Makefile.am index 21a8cc34..8779c50c 100644 --- a/libguac/src/Makefile.am +++ b/libguac/src/Makefile.am @@ -48,7 +48,7 @@ libguacinc_HEADERS = \ ../include/protocol.h \ ../include/resource.h \ ../include/socket.h \ - ../include/time.h + ../include/timestamp.h noinst_HEADERS = \ ../include/client-handlers.h \ diff --git a/libguac/src/client.c b/libguac/src/client.c index f5b6ccf1..13534d98 100644 --- a/libguac/src/client.c +++ b/libguac/src/client.c @@ -35,16 +35,19 @@ * * ***** END LICENSE BLOCK ***** */ -#include -#include -#include #include +#include +#include +#include -#include "socket.h" -#include "protocol.h" #include "client.h" #include "client-handlers.h" #include "error.h" +#include "layer.h" +#include "plugin.h" +#include "protocol.h" +#include "socket.h" +#include "time.h" #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MAX(a, b) (((a) > (b)) ? (a) : (b)) @@ -263,7 +266,7 @@ guac_client* guac_client_alloc() { memset(client, 0, sizeof(guac_client)); client->last_received_timestamp = - client->last_sent_timestamp = guac_protocol_get_timestamp(); + client->last_sent_timestamp = guac_timestamp_current(); client->state = GUAC_CLIENT_RUNNING; diff --git a/libguac/src/protocol.c b/libguac/src/protocol.c index 3eddce77..19bbaaa3 100644 --- a/libguac/src/protocol.c +++ b/libguac/src/protocol.c @@ -66,10 +66,12 @@ #include #endif -#include "socket.h" -#include "protocol.h" #include "error.h" +#include "instruction.h" +#include "layer.h" #include "palette.h" +#include "protocol.h" +#include "socket.h" #include "unicode.h" /* Output formatting functions */ @@ -600,7 +602,7 @@ guac_instruction* guac_protocol_expect_instruction(guac_socket* socket, int usec guac_instruction* instruction; /* Wait for data until timeout */ - if (guac_protocol_instructions_waiting(socket, usec_timeout) <= 0) + if (guac_instruction_waiting(socket, usec_timeout) <= 0) return NULL; /* Read available instruction */