GUACAMOLE-422: Rename new opcode handler function.
This commit is contained in:
parent
c750b18f60
commit
379fce2d77
@ -544,6 +544,32 @@ void guac_user_free(guac_user* user);
|
||||
*/
|
||||
int guac_user_handle_connection(guac_user* user, int usec_timeout);
|
||||
|
||||
/**
|
||||
* Call the appropriate handler defined by the given user for the given
|
||||
* instruction. A comparison is made between the instruction opcode and the
|
||||
* initial handler lookup table defined in user-handlers.c. The initial handlers
|
||||
* will in turn call the user's handler (if defined).
|
||||
*
|
||||
* @param user
|
||||
* The user whose handlers should be called.
|
||||
*
|
||||
* @param opcode
|
||||
* The opcode of the instruction to pass to the user via the appropriate
|
||||
* handler.
|
||||
*
|
||||
* @param argc
|
||||
* The number of arguments which are part of the instruction.
|
||||
*
|
||||
* @param argv
|
||||
* An array of all arguments which are part of the instruction.
|
||||
*
|
||||
* @return
|
||||
* Non-negative if the instruction was handled successfully, or negative
|
||||
* if an error occurred.
|
||||
*/
|
||||
int guac_user_handle_instruction(guac_user* user, const char* opcode,
|
||||
int argc, char** argv);
|
||||
|
||||
/**
|
||||
* Allocates a new stream. An arbitrary index is automatically assigned
|
||||
* if no previously-allocated stream is available for use.
|
||||
|
@ -693,7 +693,7 @@ void guac_free_mimetypes(char** mimetypes) {
|
||||
|
||||
}
|
||||
|
||||
int guac_user_handle_instruction(__guac_instruction_handler_mapping* map,
|
||||
int __guac_user_call_opcode_handler(__guac_instruction_handler_mapping* map,
|
||||
guac_user* user, const char* opcode, int argc, char** argv) {
|
||||
|
||||
/* For each defined instruction */
|
||||
|
@ -261,8 +261,10 @@ char** guac_copy_mimetypes(char** mimetypes, int count);
|
||||
/**
|
||||
* Call the appropriate handler defined by the given user for the given
|
||||
* instruction. A comparison is made between the instruction opcode and the
|
||||
* initial handler lookup table defined in user-handlers.c. The intial handlers
|
||||
* will in turn call the user's handler (if defined).
|
||||
* initial handler lookup table defined in the map that is provided to this
|
||||
* function. If an entry for the instruction is found in the provided map,
|
||||
* the handler defined in that map will be called and the value returned. If
|
||||
* no match is found, it is silently ignored.
|
||||
*
|
||||
* @param map
|
||||
* The array that holds the opcode to handler mappings.
|
||||
@ -284,7 +286,7 @@ char** guac_copy_mimetypes(char** mimetypes, int count);
|
||||
* Non-negative if the instruction was handled successfully, or negative
|
||||
* if an error occurred.
|
||||
*/
|
||||
int guac_user_handle_instruction(__guac_instruction_handler_mapping* map,
|
||||
int __guac_user_call_opcode_handler(__guac_instruction_handler_mapping* map,
|
||||
guac_user* user, const char* opcode, int argc, char** argv);
|
||||
|
||||
#endif
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "guacamole/protocol.h"
|
||||
#include "guacamole/socket.h"
|
||||
#include "guacamole/user.h"
|
||||
#include "user-handlers.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
@ -161,7 +162,7 @@ static void* guac_user_input_thread(void* data) {
|
||||
guac_error_message = NULL;
|
||||
|
||||
/* Call handler, stop on error */
|
||||
if (guac_user_handle_instruction(__guac_instruction_handler_map,
|
||||
if (__guac_user_call_opcode_handler(__guac_instruction_handler_map,
|
||||
user, parser->opcode, parser->argc, parser->argv) < 0) {
|
||||
|
||||
/* Log error */
|
||||
@ -266,7 +267,7 @@ int guac_user_handle_connection(guac_user* user, int usec_timeout) {
|
||||
parser->opcode);
|
||||
|
||||
/* Run instruction handler for opcode with arguments. */
|
||||
if (guac_user_handle_instruction(__guac_handshake_handler_map, user,
|
||||
if (__guac_user_call_opcode_handler(__guac_handshake_handler_map, user,
|
||||
parser->opcode, parser->argc, parser->argv)) {
|
||||
|
||||
guac_user_log_handshake_failure(user);
|
||||
|
@ -167,6 +167,13 @@ void guac_user_free_object(guac_user* user, guac_object* object) {
|
||||
|
||||
}
|
||||
|
||||
int guac_user_handle_instruction(guac_user* user, const char* opcode, int argc, char** argv) {
|
||||
|
||||
return __guac_user_call_opcode_handler(__guac_instruction_handler_map,
|
||||
user, opcode, argc, argv);
|
||||
|
||||
}
|
||||
|
||||
void guac_user_stop(guac_user* user) {
|
||||
user->active = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user