2013-12-29 04:53:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Glyptodon LLC
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
2011-03-17 06:46:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef _GUAC_CLIENT_HANDLERS__H
|
|
|
|
#define _GUAC_CLIENT_HANDLERS__H
|
|
|
|
|
2011-03-18 07:55:14 +00:00
|
|
|
/**
|
|
|
|
* Provides initial handler functions and a lookup structure for automatically
|
|
|
|
* handling client instructions. This is used only internally within libguac,
|
|
|
|
* and is not installed along with the library.
|
|
|
|
*
|
|
|
|
* @file client-handlers.h
|
|
|
|
*/
|
|
|
|
|
2014-01-01 22:44:28 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "client.h"
|
|
|
|
#include "instruction.h"
|
|
|
|
|
2011-03-18 07:55:14 +00:00
|
|
|
/**
|
|
|
|
* Internal handler for Guacamole instructions.
|
|
|
|
*/
|
2011-11-21 07:09:02 +00:00
|
|
|
typedef int __guac_instruction_handler(guac_client* client, guac_instruction* copied);
|
2011-03-17 06:46:02 +00:00
|
|
|
|
2011-03-18 07:55:14 +00:00
|
|
|
/**
|
|
|
|
* Structure mapping an instruction opcode to an instruction handler.
|
|
|
|
*/
|
2011-03-17 06:46:02 +00:00
|
|
|
typedef struct __guac_instruction_handler_mapping {
|
|
|
|
|
2011-03-18 07:55:14 +00:00
|
|
|
/**
|
|
|
|
* The instruction opcode which maps to a specific handler.
|
|
|
|
*/
|
2011-03-17 06:46:02 +00:00
|
|
|
char* opcode;
|
2011-03-18 07:55:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The handler which maps to a specific opcode.
|
|
|
|
*/
|
2011-03-17 06:46:02 +00:00
|
|
|
__guac_instruction_handler* handler;
|
|
|
|
|
|
|
|
} __guac_instruction_handler_mapping;
|
|
|
|
|
2011-03-18 07:55:14 +00:00
|
|
|
/**
|
|
|
|
* Internal initial handler for the sync instruction. When a sync instruction
|
|
|
|
* is received, this handler will be called. Sync instructions are automatically
|
|
|
|
* handled, thus there is no client handler for sync instruction.
|
|
|
|
*/
|
2011-11-21 07:09:02 +00:00
|
|
|
int __guac_handle_sync(guac_client* client, guac_instruction* instruction);
|
2011-03-18 07:55:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal initial handler for the mouse instruction. When a mouse instruction
|
|
|
|
* is received, this handler will be called. The client's mouse handler will
|
|
|
|
* be invoked if defined.
|
|
|
|
*/
|
2011-11-21 07:09:02 +00:00
|
|
|
int __guac_handle_mouse(guac_client* client, guac_instruction* instruction);
|
2011-03-18 07:55:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal initial handler for the key instruction. When a key instruction
|
|
|
|
* is received, this handler will be called. The client's key handler will
|
|
|
|
* be invoked if defined.
|
|
|
|
*/
|
2011-11-21 07:09:02 +00:00
|
|
|
int __guac_handle_key(guac_client* client, guac_instruction* instruction);
|
2011-03-18 07:55:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal initial handler for the clipboard instruction. When a clipboard instruction
|
|
|
|
* is received, this handler will be called. The client's clipboard handler will
|
|
|
|
* be invoked if defined.
|
|
|
|
*/
|
2011-11-21 07:09:02 +00:00
|
|
|
int __guac_handle_clipboard(guac_client* client, guac_instruction* instruction);
|
2013-09-27 05:27:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal initial handler for the file instruction. When a file instruction
|
|
|
|
* is received, this handler will be called. The client's file handler will
|
|
|
|
* be invoked if defined.
|
|
|
|
*/
|
|
|
|
int __guac_handle_file(guac_client* client, guac_instruction* instruction);
|
|
|
|
|
2013-10-28 02:53:34 +00:00
|
|
|
/**
|
|
|
|
* Internal initial handler for the ack instruction. When a ack instruction
|
|
|
|
* is received, this handler will be called. The client's ack handler will
|
|
|
|
* be invoked if defined.
|
|
|
|
*/
|
|
|
|
int __guac_handle_ack(guac_client* client, guac_instruction* instruction);
|
|
|
|
|
2013-09-27 05:27:18 +00:00
|
|
|
/**
|
|
|
|
* Internal initial handler for the blob instruction. When a blob instruction
|
|
|
|
* is received, this handler will be called. The client's blob handler will
|
|
|
|
* be invoked if defined.
|
|
|
|
*/
|
|
|
|
int __guac_handle_blob(guac_client* client, guac_instruction* instruction);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal initial handler for the end instruction. When a end instruction
|
|
|
|
* is received, this handler will be called. The client's end handler will
|
|
|
|
* be invoked if defined.
|
|
|
|
*/
|
|
|
|
int __guac_handle_end(guac_client* client, guac_instruction* instruction);
|
2011-03-18 07:55:14 +00:00
|
|
|
|
2012-10-21 21:52:00 +00:00
|
|
|
/**
|
|
|
|
* Internal initial handler for the size instruction. When a size instruction
|
|
|
|
* is received, this handler will be called. The client's size handler will
|
|
|
|
* be invoked if defined.
|
|
|
|
*/
|
|
|
|
int __guac_handle_size(guac_client* client, guac_instruction* instruction);
|
|
|
|
|
2011-03-18 07:55:14 +00:00
|
|
|
/**
|
|
|
|
* Internal initial handler for the disconnect instruction. When a disconnect instruction
|
|
|
|
* is received, this handler will be called. Disconnect instructions are automatically
|
|
|
|
* handled, thus there is no client handler for disconnect instruction.
|
|
|
|
*/
|
2011-11-21 07:09:02 +00:00
|
|
|
int __guac_handle_disconnect(guac_client* client, guac_instruction* instruction);
|
2011-03-17 06:46:02 +00:00
|
|
|
|
2011-03-18 07:55:14 +00:00
|
|
|
/**
|
|
|
|
* Instruction handler mapping table. This is a NULL-terminated array of
|
|
|
|
* __guac_instruction_handler_mapping structures, each mapping an opcode
|
|
|
|
* to a __guac_instruction_handler. The end of the array must be marked
|
|
|
|
* with a __guac_instruction_handler_mapping with the opcode set to
|
|
|
|
* NULL (the NULL terminator).
|
|
|
|
*/
|
2011-03-17 06:46:02 +00:00
|
|
|
extern __guac_instruction_handler_mapping __guac_instruction_handler_map[];
|
|
|
|
|
|
|
|
#endif
|