You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2018/04/02 19:20:45 UTC
[12/23] guacamole-server git commit: GUACAMOLE-269: Name functions
per Guacamole standards.
GUACAMOLE-269: Name functions per Guacamole standards.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/c286668b
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/c286668b
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/c286668b
Branch: refs/heads/master
Commit: c286668b797a149c77ae609d654d3e7899a9c36b
Parents: 9bd2832
Author: Nick Couchman <vn...@apache.org>
Authored: Tue Feb 27 09:23:30 2018 -0500
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu Mar 8 10:48:22 2018 -0500
----------------------------------------------------------------------
src/protocols/ssh/ssh.c | 9 +++++----
src/protocols/ssh/ttymode.c | 8 ++++----
src/protocols/ssh/ttymode.h | 8 ++++----
3 files changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/c286668b/src/protocols/ssh/ssh.c
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/ssh.c b/src/protocols/ssh/ssh.c
index 6b90a19..6aecde0 100644
--- a/src/protocols/ssh/ssh.c
+++ b/src/protocols/ssh/ssh.c
@@ -193,7 +193,7 @@ void* ssh_client_thread(void* data) {
}
/* Initialize a ttymode array */
- guac_ssh_ttymodes ssh_ttymodes = init_ttymodes();
+ guac_ssh_ttymodes ssh_ttymodes = guac_ssh_ttymodes_init();
/* Set up screen recording, if requested */
if (settings->recording_path != NULL) {
@@ -213,7 +213,7 @@ void* ssh_client_thread(void* data) {
settings->color_scheme, settings->backspace);
/* Add the backspace key to the ttymode array */
- add_ttymode(&ssh_ttymodes, GUAC_SSH_TTY_OP_VERASE, settings->backspace);
+ guac_ssh_ttymodes_add(&ssh_ttymodes, GUAC_SSH_TTY_OP_VERASE, settings->backspace);
/* Fail if terminal init failed */
if (ssh_client->term == NULL) {
@@ -304,8 +304,9 @@ void* ssh_client_thread(void* data) {
}
/* Request PTY */
- if (libssh2_channel_request_pty_ex(ssh_client->term_channel, "linux", sizeof("linux")-1, ttymodes_to_array(&ssh_ttymodes),
- sizeof_ttymodes(&ssh_ttymodes), ssh_client->term->term_width, ssh_client->term->term_height, 0, 0)) {
+ if (libssh2_channel_request_pty_ex(ssh_client->term_channel, "linux", sizeof("linux")-1,
+ guac_ssh_ttymodes_to_array(&ssh_ttymodes), guac_ssh_ttymodes_size(&ssh_ttymodes),
+ ssh_client->term->term_width, ssh_client->term->term_height, 0, 0)) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR, "Unable to allocate PTY.");
return NULL;
}
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/c286668b/src/protocols/ssh/ttymode.c
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/ttymode.c b/src/protocols/ssh/ttymode.c
index f1e21d3..f21e9f7 100644
--- a/src/protocols/ssh/ttymode.c
+++ b/src/protocols/ssh/ttymode.c
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>
-guac_ssh_ttymodes init_ttymodes() {
+guac_ssh_ttymodes guac_ssh_ttymodes_init() {
/* Simple allocation for a placeholder */
guac_ssh_ttymode* ttymode_array = malloc(1);
@@ -36,7 +36,7 @@ guac_ssh_ttymodes init_ttymodes() {
return empty_modes;
}
-void add_ttymode(guac_ssh_ttymodes *tty_modes, char opcode, uint32_t value) {
+void guac_ssh_ttymodes_add(guac_ssh_ttymodes *tty_modes, char opcode, uint32_t value) {
tty_modes->num_opcodes++;
tty_modes->ttymode_array = realloc(tty_modes->ttymode_array, sizeof(guac_ssh_ttymode) * tty_modes->num_opcodes);
tty_modes->ttymode_array[tty_modes->num_opcodes - 1].opcode = opcode;
@@ -44,14 +44,14 @@ void add_ttymode(guac_ssh_ttymodes *tty_modes, char opcode, uint32_t value) {
}
-int sizeof_ttymodes(guac_ssh_ttymodes *tty_modes) {
+int guac_ssh_ttymodes_size(guac_ssh_ttymodes *tty_modes) {
/* Each opcode pair is 5 bytes (1 opcode, 4 value)
Add one for the ending opcode */
return (tty_modes->num_opcodes * 5) + 1;
}
-char* ttymodes_to_array(guac_ssh_ttymodes *tty_modes) {
+char* guac_ssh_ttymodes_to_array(guac_ssh_ttymodes *tty_modes) {
/* Total data size should be number of tracked opcodes
plus one final byte for the TTY_OP_END code. */
int data_size = (tty_modes->num_opcodes * 5) + 1;
http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/c286668b/src/protocols/ssh/ttymode.h
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/ttymode.h b/src/protocols/ssh/ttymode.h
index 93f85bf..ca5569d 100644
--- a/src/protocols/ssh/ttymode.h
+++ b/src/protocols/ssh/ttymode.h
@@ -62,7 +62,7 @@ typedef struct guac_ssh_ttymodes {
* with a null array of guac_ssh_ttymode and opcodes
* set to zero.
*/
-guac_ssh_ttymodes init_ttymodes();
+guac_ssh_ttymodes guac_ssh_ttymodes_init();
/**
* Add an item to the opcode array. This resizes the
@@ -70,19 +70,19 @@ guac_ssh_ttymodes init_ttymodes();
* the specified opcode and value pair to the data
* structure.
*/
-void add_ttymode(guac_ssh_ttymodes *tty_modes, char opcode, uint32_t value);
+void guac_ssh_ttymodes_add(guac_ssh_ttymodes *tty_modes, char opcode, uint32_t value);
/**
* Retrieve the size, in bytes, of the ttymode_array
* in the given guac_ssh_ttymodes data structure.
*/
-int sizeof_ttymodes(guac_ssh_ttymodes *tty_modes);
+int guac_ssh_ttymodes_size(guac_ssh_ttymodes *tty_modes);
/**
* Convert the ttymodes data structure into a char
* pointer array suitable for passing into the
* libssh2_channel_request_pty_ex() function.
*/
-char* ttymodes_to_array(guac_ssh_ttymodes *tty_modes);
+char* guac_ssh_ttymodes_to_array(guac_ssh_ttymodes *tty_modes);
#endif