Removed client registry, use of UUID, and semaphore. Removed handshaking phase. (simplify proxy)

This commit is contained in:
Michael Jumper
2010-09-24 02:59:15 -07:00
parent a1440075d0
commit b3c1017b8e
8 changed files with 11 additions and 396 deletions

View File

@@ -21,10 +21,7 @@
#define _CLIENT_H
#include <png.h>
#include <uuid/uuid.h>
#include <semaphore.h>
#include "uuidtree.h"
#include "guacio.h"
/**
@@ -34,7 +31,6 @@
*/
typedef struct guac_client guac_client;
typedef struct guac_client_registry guac_client_registry;
typedef int guac_client_handle_messages(guac_client* client);
typedef int guac_client_mouse_handler(guac_client* client, int x, int y, int button_mask);
@@ -50,12 +46,6 @@ typedef int guac_client_free_handler(void* client);
*/
struct guac_client {
/**
* UUID identifying this client. Useful when identifying a client
* for connection handoff/resume.
*/
uuid_t uuid;
/**
* The GUACIO structure to be used to communicate with the web-client. It is
* expected that the implementor of any Guacamole proxy client will provide
@@ -64,11 +54,6 @@ struct guac_client {
*/
GUACIO* io;
/**
* Semaphore which will be locked while I/O is owned.
*/
sem_t io_lock;
/**
* Arbitrary reference to proxy client-specific data. Implementors of a
* Guacamole proxy client can store any data they want here, which can then
@@ -186,7 +171,6 @@ typedef int guac_client_init_handler(guac_client* client, int argc, char** argv)
* Initialize and return a new guac_client using the specified client init handler (guac_client_init_handler).
* This will normally be the guac_client_init function as provided by any of the pluggable proxy clients.
*
* @param registry The registry to use to register/find the client we need to return.
* @param client_fd The file descriptor associated with the socket associated with the connection to the
* web-client tunnel.
* @param client_init Function pointer to the client init handler which will initialize the new guac_client
@@ -195,7 +179,7 @@ typedef int guac_client_init_handler(guac_client* client, int argc, char** argv)
* @param argv The arguments being passed to this client.
* @return A pointer to the newly initialized (or found) client.
*/
guac_client* guac_get_client(int client_fd, guac_client_registry* registry, guac_client_init_handler* client_init, int argc, char** argv);
guac_client* guac_get_client(int client_fd, guac_client_init_handler* client_init, int argc, char** argv);
/**
* Enter the main network message handling loop for the given client.
@@ -208,9 +192,8 @@ void guac_start_client(guac_client* client);
* Free all resources associated with the given client.
*
* @param client The proxy client to free all reasources of.
* @param registry The registry to remove this client from when freed.
*/
void guac_free_client(guac_client* client, guac_client_registry* registry);
void guac_free_client(guac_client* client);
/**
* Allocate a libpng-compatible buffer to hold raw image data.
@@ -231,29 +214,4 @@ png_byte** guac_alloc_png_buffer(int w, int h, int bpp);
*/
void guac_free_png_buffer(png_byte** png_buffer, int h);
/**
* Represent the Guacamole "client registry" in which all
* currently connected clients are stored, indexed by UUID.
*/
struct guac_client_registry {
/**
* Root of the uuid tree
*/
guac_uuid_tree_node* root;
/**
* Semaphore controlling access to UUID tree.
*/
sem_t tree_lock;
};
guac_client_registry* guac_create_client_registry();
void guac_register_client(guac_client_registry* registry, guac_client* client);
guac_client* guac_find_client(guac_client_registry* registry, uuid_t uuid);
void guac_remove_client(guac_client_registry* registry, uuid_t uuid);
void guac_cleanup_registry(guac_client_registry* registry);
#endif

View File

@@ -1,52 +0,0 @@
/*
* Guacamole - Clientless Remote Desktop
* Copyright (C) 2010 Michael Jumper
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _UUIDTREE_H
#define _UUIDTREE_H
#include <uuid/uuid.h>
typedef struct guac_uuid_tree_node guac_uuid_tree_node;
/**
* Represents a single node of a tree storing objects by UUID.
*/
struct guac_uuid_tree_node {
/**
* The number of pointers used inside the next array.
*/
int used;
/**
* The next guac_uuid_tree_node if currently looking at any byte
* of the UUID except the last, or the stored object if looking at the
* last byte of the UUID.
*/
void* next[256];
};
guac_uuid_tree_node* guac_create_uuid_tree();
void guac_uuid_tree_put(guac_uuid_tree_node* tree, uuid_t uuid, void* obj);
void* guac_uuid_tree_get(guac_uuid_tree_node* tree, uuid_t uuid);
void guac_uuid_tree_remove(guac_uuid_tree_node* tree, uuid_t uuid);
void guac_cleanup_uuid_tree(guac_uuid_tree_node* tree);
#endif