Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
GUACAMOLE-1538: Only the core functionality of the terminal lib shoul…
Browse files Browse the repository at this point in the history
…d be public.
  • Loading branch information
jmuehlner committed Mar 1, 2022
1 parent ad0155b commit 46e8133
Show file tree
Hide file tree
Showing 35 changed files with 298 additions and 325 deletions.
3 changes: 1 addition & 2 deletions doc/libguac-terminal/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ SHOW_INCLUDE_FILES = NO
CASE_SENSE_NAMES = YES
FILE_PATTERNS = *.h
STRIP_FROM_PATH = ../../src/terminal
INPUT = ../../src/terminal/terminal/
EXCLUDE = ../../src/terminal/terminal/terminal_priv.h
INPUT = ../../src/terminal/terminal/terminal.h
JAVADOC_AUTOBRIEF = YES
TAB_SIZE = 4
TYPEDEF_HIDES_STRUCT = YES
Expand Down
1 change: 1 addition & 0 deletions src/protocols/ssh/argv.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <guacamole/user.h>

#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Expand Down
22 changes: 12 additions & 10 deletions src/protocols/ssh/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <libssh2.h>
#include <libssh2_sftp.h>
#include <guacamole/client.h>
#include <guacamole/socket.h>
#include <guacamole/timestamp.h>
#include <guacamole/wol.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
Expand Down Expand Up @@ -98,7 +100,7 @@ static guac_common_ssh_user* guac_ssh_get_user(guac_client* client) {
guac_client_log(client, GUAC_LOG_DEBUG,
"Initial import failed: %s",
guac_common_ssh_key_error());

guac_client_log(client, GUAC_LOG_DEBUG,
"Re-attempting private key import (WITH passphrase)");

Expand Down Expand Up @@ -148,23 +150,23 @@ static guac_common_ssh_user* guac_ssh_get_user(guac_client* client) {
* A function used to generate a terminal prompt to gather additional
* credentials from the guac_client during a connection, and using
* the specified string to generate the prompt for the user.
*
*
* @param client
* The guac_client object associated with the current connection
* where additional credentials are required.
*
*
* @param cred_name
* The prompt text to display to the screen when prompting for the
* additional credentials.
*
* @return
*
* @return
* The string of credentials gathered from the user.
*/
static char* guac_ssh_get_credential(guac_client *client, char* cred_name) {

guac_ssh_client* ssh_client = (guac_ssh_client*) client->data;
return guac_terminal_prompt(ssh_client->term, cred_name, false);

}

void* ssh_input_thread(void* data) {
Expand Down Expand Up @@ -206,17 +208,17 @@ void* ssh_client_thread(void* data) {
if (settings->wol_send_packet) {
guac_client_log(client, GUAC_LOG_DEBUG, "Sending Wake-on-LAN packet, "
"and pausing for %d seconds.", settings->wol_wait_time);

/* Send the Wake-on-LAN request. */
if (guac_wol_wake(settings->wol_mac_addr, settings->wol_broadcast_addr,
settings->wol_udp_port))
return NULL;

/* If wait time is specified, sleep for that amount of time. */
if (settings->wol_wait_time > 0)
guac_timestamp_msleep(settings->wol_wait_time * 1000);
}

/* Init SSH base libraries */
if (guac_common_ssh_init(client)) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
Expand Down Expand Up @@ -360,7 +362,7 @@ void* ssh_client_thread(void* data) {
if (!settings->sftp_disable_upload)
guac_terminal_set_upload_path_handler(ssh_client->term,
guac_sftp_set_upload_path);

if (!settings->sftp_disable_download)
guac_terminal_set_file_download_handler(ssh_client->term,
guac_sftp_download_file);
Expand Down
1 change: 1 addition & 0 deletions src/protocols/telnet/argv.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <guacamole/socket.h>
#include <guacamole/user.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Expand Down
1 change: 1 addition & 0 deletions src/protocols/telnet/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <guacamole/argv.h>
#include <guacamole/client.h>
Expand Down
7 changes: 4 additions & 3 deletions src/protocols/telnet/telnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <guacamole/client.h>
#include <guacamole/protocol.h>
#include <guacamole/timestamp.h>
#include <guacamole/wol.h>
#include <libtelnet.h>

Expand Down Expand Up @@ -559,17 +560,17 @@ void* guac_telnet_client_thread(void* data) {
pthread_t input_thread;
char buffer[8192];
int wait_result;

/* If Wake-on-LAN is enabled, attempt to wake. */
if (settings->wol_send_packet) {
guac_client_log(client, GUAC_LOG_DEBUG, "Sending Wake-on-LAN packet, "
"and pausing for %d seconds.", settings->wol_wait_time);

/* Send the Wake-on-LAN request. */
if (guac_wol_wake(settings->wol_mac_addr, settings->wol_broadcast_addr,
settings->wol_udp_port))
return NULL;

/* If wait time is specified, sleep for that amount of time. */
if (settings->wol_wait_time > 0)
guac_timestamp_msleep(settings->wol_wait_time * 1000);
Expand Down
12 changes: 6 additions & 6 deletions src/terminal/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@
# to you by the ASF under the Apache License, Version 2.0, as described above.
#

AUTOMAKE_OPTIONS = foreign
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4

lib_LTLIBRARIES = libguac-terminal.la

libguac_terminalincdir = $(includedir)/guacamole/terminal

noinst_HEADERS = \
terminal/terminal-priv.h

libguac_terminalinc_HEADERS = \
noinst_HEADERS = \
terminal/buffer.h \
terminal/char-mappings.h \
terminal/common.h \
Expand All @@ -43,12 +40,15 @@ libguac_terminalinc_HEADERS = \
terminal/palette.h \
terminal/scrollbar.h \
terminal/select.h \
terminal/terminal.h \
terminal/terminal-priv.h \
terminal/terminal-handlers.h \
terminal/types.h \
terminal/typescript.h \
terminal/xparsecolor.h

libguac_terminalinc_HEADERS = \
terminal/terminal.h

libguac_terminal_la_SOURCES = \
buffer.c \
char-mappings.c \
Expand Down
1 change: 0 additions & 1 deletion src/terminal/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

#include "config.h"

#include "terminal/buffer.h"
#include "terminal/common.h"
Expand Down
1 change: 0 additions & 1 deletion src/terminal/char-mappings.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

#include "config.h"

const int vt100_map[] = {
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
Expand Down
1 change: 0 additions & 1 deletion src/terminal/color-scheme.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

#include "config.h"

#include "terminal/color-scheme.h"
#include "terminal/palette.h"
Expand Down
1 change: 0 additions & 1 deletion src/terminal/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

#include "config.h"
#include "terminal/types.h"

#include <stdbool.h>
Expand Down
3 changes: 2 additions & 1 deletion src/terminal/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
* under the License.
*/

#include "config.h"

#include "common/surface.h"
#include "terminal/common.h"
#include "terminal/display.h"
#include "terminal/palette.h"
#include "terminal/terminal.h"
#include "terminal/terminal-priv.h"
#include "terminal/types.h"

#include <math.h>
Expand Down
1 change: 0 additions & 1 deletion src/terminal/named-colors.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

#include "config.h"
#include "terminal/palette.h"

#include <ctype.h>
Expand Down
1 change: 0 additions & 1 deletion src/terminal/palette.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

#include "config.h"
#include "terminal/palette.h"

const guac_terminal_color GUAC_TERMINAL_INITIAL_PALETTE[256] = {
Expand Down
1 change: 0 additions & 1 deletion src/terminal/scrollbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

#include "config.h"
#include "terminal/scrollbar.h"

#include <guacamole/client.h>
Expand Down
1 change: 0 additions & 1 deletion src/terminal/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

#include "config.h"

#include "common/clipboard.h"
#include "terminal/buffer.h"
Expand Down
1 change: 0 additions & 1 deletion src/terminal/terminal-stdin-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

#include "config.h"
#include "terminal/common.h"
#include "terminal/terminal.h"
#include "terminal/terminal-priv.h"
Expand Down
1 change: 0 additions & 1 deletion src/terminal/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

#include "config.h"

#include "common/clipboard.h"
#include "common/cursor.h"
Expand Down
1 change: 0 additions & 1 deletion src/terminal/terminal/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
*/


#include "config.h"

#include "types.h"

Expand Down
1 change: 0 additions & 1 deletion src/terminal/terminal/char-mappings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* @file char-mappings.h
*/

#include "config.h"

/**
* VT100 graphics mapping. Each entry is the corresponding Unicode codepoint
Expand Down
7 changes: 3 additions & 4 deletions src/terminal/terminal/color-scheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,17 @@
* under the License.
*/

#ifndef GUAC_TERMINAL_GET_COLOR_SCHEME_H
#define GUAC_TERMINAL_GET_COLOR_SCHEME_H
#ifndef GUAC_TERMINAL_COLOR_SCHEME_H
#define GUAC_TERMINAL_COLOR_SCHEME_H

/**
* Definitions and functions related to color scheme handling.
*
* @file color-scheme.h
*/

#include "config.h"

#include "terminal/palette.h"
#include "palette.h"

#include <guacamole/client.h>

Expand Down
1 change: 0 additions & 1 deletion src/terminal/terminal/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* @file common.h
*/

#include "config.h"
#include "types.h"

#include <stdbool.h>
Expand Down
1 change: 0 additions & 1 deletion src/terminal/terminal/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* @file display.h
*/

#include "config.h"

#include "common/surface.h"
#include "palette.h"
Expand Down
3 changes: 1 addition & 2 deletions src/terminal/terminal/named-colors.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
* @file named-colors.h
*/

#include "config.h"
#include "terminal/palette.h"
#include "palette.h"

/**
* Searches for the color having the given name, storing that color within the
Expand Down
1 change: 0 additions & 1 deletion src/terminal/terminal/palette.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
* @file palette.h
*/

#include "config.h"

#include <stdint.h>

Expand Down
1 change: 0 additions & 1 deletion src/terminal/terminal/scrollbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
* @file scrollbar.h
*/

#include "config.h"

#include <guacamole/client.h>
#include <guacamole/layer.h>
Expand Down
1 change: 0 additions & 1 deletion src/terminal/terminal/select.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* @file select.h
*/

#include "config.h"
#include "terminal.h"

#include <stdbool.h>
Expand Down
1 change: 1 addition & 0 deletions src/terminal/terminal/terminal-handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include "config.h"

#include "display.h"
#include "terminal.h"

/**
Expand Down
Loading

0 comments on commit 46e8133

Please sign in to comment.