From b4e7f956031116e9fa957673412709a091e16443 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 5 May 2014 15:35:37 -0700 Subject: [PATCH] GUAC-653: Move terminal code to common location. --- Makefile.am | 5 ++ configure.ac | 29 ++++++++-- src/protocols/ssh/Makefile.am | 29 ++-------- src/terminal/Makefile.am | 54 +++++++++++++++++++ src/{protocols/ssh => terminal}/blank.c | 0 src/{protocols/ssh => terminal}/blank.h | 0 src/{protocols/ssh => terminal}/buffer.c | 0 src/{protocols/ssh => terminal}/buffer.h | 0 .../ssh => terminal}/char_mappings.c | 0 .../ssh => terminal}/char_mappings.h | 0 src/{protocols/ssh => terminal}/common.c | 0 src/{protocols/ssh => terminal}/common.h | 0 src/{protocols/ssh => terminal}/cursor.c | 0 src/{protocols/ssh => terminal}/cursor.h | 0 src/{protocols/ssh => terminal}/display.c | 1 + src/{protocols/ssh => terminal}/display.h | 0 src/{protocols/ssh => terminal}/ibar.c | 0 src/{protocols/ssh => terminal}/ibar.h | 0 src/{protocols/ssh => terminal}/terminal.c | 0 src/{protocols/ssh => terminal}/terminal.h | 0 .../ssh => terminal}/terminal_handlers.c | 5 +- .../ssh => terminal}/terminal_handlers.h | 0 src/{protocols/ssh => terminal}/types.h | 0 23 files changed, 91 insertions(+), 32 deletions(-) create mode 100644 src/terminal/Makefile.am rename src/{protocols/ssh => terminal}/blank.c (100%) rename src/{protocols/ssh => terminal}/blank.h (100%) rename src/{protocols/ssh => terminal}/buffer.c (100%) rename src/{protocols/ssh => terminal}/buffer.h (100%) rename src/{protocols/ssh => terminal}/char_mappings.c (100%) rename src/{protocols/ssh => terminal}/char_mappings.h (100%) rename src/{protocols/ssh => terminal}/common.c (100%) rename src/{protocols/ssh => terminal}/common.h (100%) rename src/{protocols/ssh => terminal}/cursor.c (100%) rename src/{protocols/ssh => terminal}/cursor.h (100%) rename src/{protocols/ssh => terminal}/display.c (99%) rename src/{protocols/ssh => terminal}/display.h (100%) rename src/{protocols/ssh => terminal}/ibar.c (100%) rename src/{protocols/ssh => terminal}/ibar.h (100%) rename src/{protocols/ssh => terminal}/terminal.c (100%) rename src/{protocols/ssh => terminal}/terminal.h (100%) rename src/{protocols/ssh => terminal}/terminal_handlers.c (99%) rename src/{protocols/ssh => terminal}/terminal_handlers.h (100%) rename src/{protocols/ssh => terminal}/types.h (100%) diff --git a/Makefile.am b/Makefile.am index fb13630a..c6a56269 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,7 @@ ACLOCAL_AMFLAGS = -I m4 DIST_SUBDIRS = \ src/libguac \ src/common \ + src/terminal \ src/guacd \ src/protocols/rdp \ src/protocols/ssh \ @@ -38,6 +39,10 @@ SUBDIRS = \ src/guacd \ tests +if ENABLE_TERMINAL + SUBDIRS += src/terminal +endif + if ENABLE_RDP SUBDIRS += src/protocols/rdp endif diff --git a/configure.ac b/configure.ac index 471928c6..cfc36b43 100644 --- a/configure.ac +++ b/configure.ac @@ -87,8 +87,14 @@ AC_TYPE_SSIZE_T # Bundled libguac AC_SUBST([LIBGUAC_LTLIB], '$(top_builddir)/src/libguac/libguac.la') AC_SUBST([LIBGUAC_INCLUDE], '-I$(top_srcdir)/src/libguac') -AC_SUBST([COMMON_LTLIB], '$(top_builddir)/src/common/libguac_common.la') -AC_SUBST([COMMON_INCLUDE], '-I$(top_srcdir)/src/common') + +# Common non-libguac utility library +AC_SUBST([COMMON_LTLIB], '$(top_builddir)/src/common/libguac_common.la') +AC_SUBST([COMMON_INCLUDE], '-I$(top_srcdir)/src/common') + +# Terminal emulator +AC_SUBST([TERMINAL_LTLIB], '$(top_builddir)/src/terminal/libguac_terminal.la') +AC_SUBST([TERMINAL_INCLUDE], '-I$(top_srcdir)/src/terminal $(PANGO_CFLAGS) $(PANGOCAIRO_CFLAGS)') # Options AC_ARG_WITH(init_dir, @@ -186,6 +192,18 @@ have_pango=yes PKG_CHECK_MODULES([PANGO], [pango],, [have_pango=no]); PKG_CHECK_MODULES([PANGOCAIRO], [pangocairo],, [have_pango=no]); +# +# Terminal emulator +# + +have_terminal=yes +if test "x${have_pango}" = "xno" +then + have_terminal=no +fi + +AM_CONDITIONAL([ENABLE_TERMINAL], [test "x${have_terminal}" = "xyes"]) + # # libVNCServer # @@ -555,9 +573,9 @@ SSH_LIBS= AC_CHECK_LIB([ssh2], [libssh2_session_init_ex], [SSH_LIBS="$SSH_LIBS -lssh2"], [have_libssh2=no]) -AM_CONDITIONAL([ENABLE_SSH], [test "x${have_libssh2}" = "xyes" \ - -a "x${have_pango}" = "xyes" \ - -a "x${have_ssl}" = "xyes"]) +AM_CONDITIONAL([ENABLE_SSH], [test "x${have_libssh2}" = "xyes" \ + -a "x${have_terminal}" = "xyes" \ + -a "x${have_ssl}" = "xyes"]) AC_SUBST(SSH_LIBS) @@ -594,6 +612,7 @@ AM_CONDITIONAL([ENABLE_SSH_AGENT], AC_CONFIG_FILES([Makefile tests/Makefile src/common/Makefile + src/terminal/Makefile src/libguac/Makefile src/guacd/Makefile src/protocols/rdp/Makefile diff --git a/src/protocols/ssh/Makefile.am b/src/protocols/ssh/Makefile.am index 9f58eba5..ff8660dd 100644 --- a/src/protocols/ssh/Makefile.am +++ b/src/protocols/ssh/Makefile.am @@ -27,41 +27,22 @@ ACLOCAL_AMFLAGS = -I m4 lib_LTLIBRARIES = libguac-client-ssh.la libguac_client_ssh_la_SOURCES = \ - blank.c \ - buffer.c \ - char_mappings.c \ client.c \ clipboard.c \ - common.c \ - cursor.c \ - display.c \ guac_handlers.c \ - ibar.c \ sftp.c \ ssh_buffer.c \ ssh_client.c \ - ssh_key.c \ - terminal.c \ - terminal_handlers.c + ssh_key.c noinst_HEADERS = \ - blank.h \ - buffer.h \ - char_mappings.h \ client.h \ clipboard.h \ - common.h \ - cursor.h \ - display.h \ guac_handlers.h \ - ibar.h \ sftp.h \ ssh_buffer.h \ ssh_client.h \ - ssh_key.h \ - terminal.h \ - terminal_handlers.h \ - types.h + ssh_key.h # Add agent sources if enabled if ENABLE_SSH_AGENT @@ -69,7 +50,7 @@ libguac_client_ssh_la_SOURCES += ssh_agent.c noinst_HEADERS += ssh_agent.h endif -libguac_client_ssh_la_CFLAGS = -Werror -Wall -Iinclude @PANGO_CFLAGS@ @PANGOCAIRO_CFLAGS@ @LIBGUAC_INCLUDE@ @COMMON_INCLUDE@ -libguac_client_ssh_la_LIBADD = @LIBGUAC_LTLIB@ @COMMON_LTLIB@ -libguac_client_ssh_la_LDFLAGS = -version-info 0:0:0 @SSH_LIBS@ @SSL_LIBS@ @PTHREAD_LIBS@ @PANGO_LIBS@ @PANGOCAIRO_LIBS@ @CAIRO_LIBS@ +libguac_client_ssh_la_CFLAGS = -Werror -Wall -Iinclude @LIBGUAC_INCLUDE@ @COMMON_INCLUDE@ @TERMINAL_INCLUDE@ +libguac_client_ssh_la_LIBADD = @LIBGUAC_LTLIB@ @COMMON_LTLIB@ @TERMINAL_LTLIB@ +libguac_client_ssh_la_LDFLAGS = -version-info 0:0:0 @SSH_LIBS@ @SSL_LIBS@ @PTHREAD_LIBS@ diff --git a/src/terminal/Makefile.am b/src/terminal/Makefile.am new file mode 100644 index 00000000..7a48695c --- /dev/null +++ b/src/terminal/Makefile.am @@ -0,0 +1,54 @@ +# +# 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. +# + +AUTOMAKE_OPTIONS = foreign +ACLOCAL_AMFLAGS = -I m4 +AM_CFLAGS = -Werror -Wall -pedantic @PANGO_CFLAGS@ @PANGOCAIRO_CFLAGS@ @LIBGUAC_INCLUDE@ + +noinst_LTLIBRARIES = libguac_terminal.la + +noinst_HEADERS = \ + blank.h \ + buffer.h \ + char_mappings.h \ + common.h \ + cursor.h \ + display.h \ + ibar.h \ + terminal.h \ + terminal_handlers.h \ + types.h + +libguac_terminal_la_SOURCES = \ + blank.c \ + buffer.c \ + char_mappings.c \ + common.c \ + cursor.c \ + display.c \ + ibar.c \ + terminal.c \ + terminal_handlers.c + +libguac_terminal_la_LIBADD = @LIBGUAC_LTLIB@ +libguac_terminal_la_LDFLAGS = @PTHREAD_LIBS@ @PANGO_LIBS@ @PANGOCAIRO_LIBS@ @CAIRO_LIBS@ + diff --git a/src/protocols/ssh/blank.c b/src/terminal/blank.c similarity index 100% rename from src/protocols/ssh/blank.c rename to src/terminal/blank.c diff --git a/src/protocols/ssh/blank.h b/src/terminal/blank.h similarity index 100% rename from src/protocols/ssh/blank.h rename to src/terminal/blank.h diff --git a/src/protocols/ssh/buffer.c b/src/terminal/buffer.c similarity index 100% rename from src/protocols/ssh/buffer.c rename to src/terminal/buffer.c diff --git a/src/protocols/ssh/buffer.h b/src/terminal/buffer.h similarity index 100% rename from src/protocols/ssh/buffer.h rename to src/terminal/buffer.h diff --git a/src/protocols/ssh/char_mappings.c b/src/terminal/char_mappings.c similarity index 100% rename from src/protocols/ssh/char_mappings.c rename to src/terminal/char_mappings.c diff --git a/src/protocols/ssh/char_mappings.h b/src/terminal/char_mappings.h similarity index 100% rename from src/protocols/ssh/char_mappings.h rename to src/terminal/char_mappings.h diff --git a/src/protocols/ssh/common.c b/src/terminal/common.c similarity index 100% rename from src/protocols/ssh/common.c rename to src/terminal/common.c diff --git a/src/protocols/ssh/common.h b/src/terminal/common.h similarity index 100% rename from src/protocols/ssh/common.h rename to src/terminal/common.h diff --git a/src/protocols/ssh/cursor.c b/src/terminal/cursor.c similarity index 100% rename from src/protocols/ssh/cursor.c rename to src/terminal/cursor.c diff --git a/src/protocols/ssh/cursor.h b/src/terminal/cursor.h similarity index 100% rename from src/protocols/ssh/cursor.h rename to src/terminal/cursor.h diff --git a/src/protocols/ssh/display.c b/src/terminal/display.c similarity index 99% rename from src/protocols/ssh/display.c rename to src/terminal/display.c index d7d683da..a70d8c5f 100644 --- a/src/protocols/ssh/display.c +++ b/src/terminal/display.c @@ -32,6 +32,7 @@ #include #include #include +#include const guac_terminal_color guac_terminal_palette[16] = { diff --git a/src/protocols/ssh/display.h b/src/terminal/display.h similarity index 100% rename from src/protocols/ssh/display.h rename to src/terminal/display.h diff --git a/src/protocols/ssh/ibar.c b/src/terminal/ibar.c similarity index 100% rename from src/protocols/ssh/ibar.c rename to src/terminal/ibar.c diff --git a/src/protocols/ssh/ibar.h b/src/terminal/ibar.h similarity index 100% rename from src/protocols/ssh/ibar.h rename to src/terminal/ibar.h diff --git a/src/protocols/ssh/terminal.c b/src/terminal/terminal.c similarity index 100% rename from src/protocols/ssh/terminal.c rename to src/terminal/terminal.c diff --git a/src/protocols/ssh/terminal.h b/src/terminal/terminal.h similarity index 100% rename from src/protocols/ssh/terminal.h rename to src/terminal/terminal.h diff --git a/src/protocols/ssh/terminal_handlers.c b/src/terminal/terminal_handlers.c similarity index 99% rename from src/protocols/ssh/terminal_handlers.c rename to src/terminal/terminal_handlers.c index 60786283..be1436bd 100644 --- a/src/protocols/ssh/terminal_handlers.c +++ b/src/terminal/terminal_handlers.c @@ -24,7 +24,6 @@ #include "char_mappings.h" #include "common.h" -#include "sftp.h" #include "terminal.h" #include "terminal_handlers.h" @@ -885,7 +884,7 @@ int guac_terminal_guac_set_directory(guac_terminal* term, unsigned char c) { if (c == 0x9C || c == 0x5C || c == 0x07) { filename[length++] = '\0'; term->char_handler = guac_terminal_echo; - guac_sftp_set_upload_path(term->client, filename); + /*guac_sftp_set_upload_path(term->client, filename);*/ length = 0; } @@ -906,7 +905,7 @@ int guac_terminal_guac_download(guac_terminal* term, unsigned char c) { if (c == 0x9C || c == 0x5C || c == 0x07) { filename[length++] = '\0'; term->char_handler = guac_terminal_echo; - guac_sftp_download_file(term->client, filename); + /*guac_sftp_download_file(term->client, filename);*/ length = 0; } diff --git a/src/protocols/ssh/terminal_handlers.h b/src/terminal/terminal_handlers.h similarity index 100% rename from src/protocols/ssh/terminal_handlers.h rename to src/terminal/terminal_handlers.h diff --git a/src/protocols/ssh/types.h b/src/terminal/types.h similarity index 100% rename from src/protocols/ssh/types.h rename to src/terminal/types.h