You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2017/07/06 02:59:38 UTC

[04/13] incubator-guacamole-server git commit: GUACAMOLE-337: Limit public libguacd API to simply user handshake handling and SSL/TLS sockets.

GUACAMOLE-337: Limit public libguacd API to simply user handshake handling and SSL/TLS sockets.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/6c484c1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/6c484c1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/6c484c1e

Branch: refs/heads/master
Commit: 6c484c1efdcf525e97d4b7167123cbbb4e7471f6
Parents: 7f3b985
Author: Michael Jumper <mj...@apache.org>
Authored: Sat Jun 10 19:16:22 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat Jul 1 16:05:12 2017 -0700

----------------------------------------------------------------------
 src/libguacd/Makefile.am     |  6 +++--
 src/libguacd/libguacd/log.h  | 42 --------------------------------
 src/libguacd/libguacd/user.h | 48 -------------------------------------
 src/libguacd/log.c           |  2 +-
 src/libguacd/log.h           | 42 ++++++++++++++++++++++++++++++++
 src/libguacd/user.c          | 50 ++++++++++++++++++++++++++++++++++++---
 6 files changed, 94 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/6c484c1e/src/libguacd/Makefile.am
----------------------------------------------------------------------
diff --git a/src/libguacd/Makefile.am b/src/libguacd/Makefile.am
index a8d2a9f..6018b97 100644
--- a/src/libguacd/Makefile.am
+++ b/src/libguacd/Makefile.am
@@ -23,10 +23,12 @@ lib_LTLIBRARIES = libguacd.la
 
 libguacdincdir = $(includedir)/libguacd
 
-libguacdinc_HEADERS =    \
-    libguacd/log.h       \
+libguacdinc_HEADERS = \
     libguacd/user.h
 
+noinst_HEADERS = \
+    log.h
+
 libguacd_la_SOURCES = \
     log.c             \
     user.c

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/6c484c1e/src/libguacd/libguacd/log.h
----------------------------------------------------------------------
diff --git a/src/libguacd/libguacd/log.h b/src/libguacd/libguacd/log.h
deleted file mode 100644
index 76509e3..0000000
--- a/src/libguacd/libguacd/log.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef LIBGUACD_LOG_H
-#define LIBGUACD_LOG_H
-
-#include "config.h"
-
-#include <guacamole/client.h>
-
-/**
- * Prints an error message using the logging facilities of the given client,
- * automatically including any information present in guac_error. This function
- * accepts parameters identically to printf.
- */
-void guacd_client_log_guac_error(guac_client* client,
-        guac_client_log_level level, const char* message);
-
-/**
- * Logs a reasonable explanatory message regarding handshake failure based on
- * the current value of guac_error.
- */
-void guacd_client_log_handshake_failure(guac_client* client);
-
-#endif
-

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/6c484c1e/src/libguacd/libguacd/user.h
----------------------------------------------------------------------
diff --git a/src/libguacd/libguacd/user.h b/src/libguacd/libguacd/user.h
index cb2a8b3..8c1db68 100644
--- a/src/libguacd/libguacd/user.h
+++ b/src/libguacd/libguacd/user.h
@@ -47,40 +47,6 @@
 #define GUACD_CLIENT_MAX_CONNECTIONS 65536
 
 /**
- * Parameters required by the user input thread.
- */
-typedef struct guacd_user_input_thread_params {
-
-    /**
-     * The parser which will be used throughout the user's session.
-     */
-    guac_parser* parser;
-
-    /**
-     * A reference to the connected user.
-     */
-    guac_user* user;
-
-} guacd_user_input_thread_params;
-
-/**
- * Starts the input/output threads of a new user. This function will block
- * until the user disconnects. If an error prevents the input/output threads
- * from starting, guac_user_stop() will be invoked on the given user.
- *
- * @param parser
- *     The guac_parser to use to handle all input from the given user.
- *
- * @param user
- *     The user whose associated I/O transfer threads should be started.
- *
- * @return
- *     Zero if the I/O threads started successfully and user has disconnected,
- *     or non-zero if the I/O threads could not be started.
- */
-int guacd_user_start(guac_parser* parser, guac_user* user);
-
-/**
  * Handles the initial handshake of a user and all subsequent I/O. This
  * function blocks until the user disconnects.
  *
@@ -95,19 +61,5 @@ int guacd_user_start(guac_parser* parser, guac_user* user);
  */
 int guacd_handle_user(guac_user* user);
 
-/**
- * The thread which handles all user input, calling event handlers for received
- * instructions.
- *
- * @param data
- *     A pointer to a guacd_user_input_thread_params structure describing the
- *     user whose input is being handled and the guac_parser with which to
- *     handle it.
- *
- * @return
- *     Always NULL.
- */
-void* guacd_user_input_thread(void* data);
-
 #endif
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/6c484c1e/src/libguacd/log.c
----------------------------------------------------------------------
diff --git a/src/libguacd/log.c b/src/libguacd/log.c
index 76d4974..180cc97 100644
--- a/src/libguacd/log.c
+++ b/src/libguacd/log.c
@@ -18,7 +18,7 @@
  */
 
 #include "config.h"
-#include "libguacd/log.h"
+#include "log.h"
 
 #include <guacamole/client.h>
 #include <guacamole/error.h>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/6c484c1e/src/libguacd/log.h
----------------------------------------------------------------------
diff --git a/src/libguacd/log.h b/src/libguacd/log.h
new file mode 100644
index 0000000..76509e3
--- /dev/null
+++ b/src/libguacd/log.h
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef LIBGUACD_LOG_H
+#define LIBGUACD_LOG_H
+
+#include "config.h"
+
+#include <guacamole/client.h>
+
+/**
+ * Prints an error message using the logging facilities of the given client,
+ * automatically including any information present in guac_error. This function
+ * accepts parameters identically to printf.
+ */
+void guacd_client_log_guac_error(guac_client* client,
+        guac_client_log_level level, const char* message);
+
+/**
+ * Logs a reasonable explanatory message regarding handshake failure based on
+ * the current value of guac_error.
+ */
+void guacd_client_log_handshake_failure(guac_client* client);
+
+#endif
+

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/6c484c1e/src/libguacd/user.c
----------------------------------------------------------------------
diff --git a/src/libguacd/user.c b/src/libguacd/user.c
index db39fce..a0c1759 100644
--- a/src/libguacd/user.c
+++ b/src/libguacd/user.c
@@ -19,8 +19,8 @@
 
 #include "config.h"
 
-#include "libguacd/log.h"
 #include "libguacd/user.h"
+#include "log.h"
 
 #include <guacamole/client.h>
 #include <guacamole/error.h>
@@ -34,6 +34,23 @@
 #include <string.h>
 
 /**
+ * Parameters required by the user input thread.
+ */
+typedef struct guacd_user_input_thread_params {
+
+    /**
+     * The parser which will be used throughout the user's session.
+     */
+    guac_parser* parser;
+
+    /**
+     * A reference to the connected user.
+     */
+    guac_user* user;
+
+} guacd_user_input_thread_params;
+
+/**
  * Copies the given array of mimetypes (strings) into a newly-allocated NULL-
  * terminated array of strings. Both the array and the strings within the array
  * are newly-allocated and must be later freed via guacd_free_mimetypes().
@@ -91,7 +108,19 @@ static void guacd_free_mimetypes(char** mimetypes) {
 
 }
 
-void* guacd_user_input_thread(void* data) {
+/**
+ * The thread which handles all user input, calling event handlers for received
+ * instructions.
+ *
+ * @param data
+ *     A pointer to a guacd_user_input_thread_params structure describing the
+ *     user whose input is being handled and the guac_parser with which to
+ *     handle it.
+ *
+ * @return
+ *     Always NULL.
+ */
+static void* guacd_user_input_thread(void* data) {
 
     guacd_user_input_thread_params* params = (guacd_user_input_thread_params*) data;
     guac_user* user = params->user;
@@ -143,7 +172,22 @@ void* guacd_user_input_thread(void* data) {
 
 }
 
-int guacd_user_start(guac_parser* parser, guac_user* user) {
+/**
+ * Starts the input/output threads of a new user. This function will block
+ * until the user disconnects. If an error prevents the input/output threads
+ * from starting, guac_user_stop() will be invoked on the given user.
+ *
+ * @param parser
+ *     The guac_parser to use to handle all input from the given user.
+ *
+ * @param user
+ *     The user whose associated I/O transfer threads should be started.
+ *
+ * @return
+ *     Zero if the I/O threads started successfully and user has disconnected,
+ *     or non-zero if the I/O threads could not be started.
+ */
+static int guacd_user_start(guac_parser* parser, guac_user* user) {
 
     guacd_user_input_thread_params params = {
         .parser = parser,