What is Proxy32?

Proxy32 is "Native" XP/Vista/7 Desktop and Terminal environment for CYGWIN.

What do you mean by "Native" Desktop&Terminal?

Terminal (and Desktop) requires some type of access to Windows GUI Drawing functions just to draw itself on Windows Monitor. There are two ways to draw GUI/Window in CYGWIN software:

Proxy32 is using "Native" Windows drawing, so it does not have the overheads of using TCP/IP link for passing drawing requests and converting from one drawing language to another during the runtime.

Proxy32 is Native to Windows because it is written in C++ and using Win32 API. It does not use any kind of portable (cross-platform) run-time environment like Java or CLR/.NET.

Where does the name Proxy32 came from?

Once upon a time I wanted to add some simple "external" layer of automation to the CYGWIN XTerm terminal so that user can add shortcuts to frequently used commands and scripts (lists of commands) "on the fly" without need to do any programming. The tool of choice to write such a layer would be tcl/Expect/Tk at that time, but I wanted my software to be pure C++ without any dependency on tcl interpreter or Expect and Tk libraries. During the Spring of 2002 this "external" layer of automation was ready in the form of the standalone CYGWIN program called "telnet proxy". It was loading list of commands and shortcuts from the "config" text file on the start and showing list of commands with shortcuts in its own terminal window. To use automation, any telnet terminal had to make telnet connection via "telnet proxy" to the destination remote host (instead of connecting directly to remote host). Later, when user was pressing command "shortcut letter" in "telnet proxy" terminal window, "telnet proxy" was injecting command into telnet byte stream towards the remote host. At that time COMMAND/SCRIPT/PLUGIN Launchers and Telnet session sharing were already supported, though LauncherTree existed in its prehistoric form of text-choice menu shown in "telnet proxy" terminal window.

When I converted software to Java/Swing GUI in 2003-2004, the need for "telnet-proxying" for external terminal was eliminated. Java version had real Swing-based GUI LauncherTree window and it had real terminal of its own that was executing COMMAND/SCRIPT/PLUGIN Launchers from LauncherTree when user double-clicked on them. Built-in Java Terminal was supporting ssh by using local CYGWIN OpenSSH ssh client as backend (via "ptyopen" CYGWIN program that was, probably, originated in examples for W. Richard Stevens 1992 book). Even so it was not pure telnet proxying, the name "Proxy" was stuck as it was implying that the software is "proxying" between user and remote host by sending commands on behalf of the terminal user instead of having user type commands manually into the terminal.

In 2005 I have converted software to C++ to use only Windows low level native Win32 API (to reduce memory consumption and to have direct access to COM-PORTs). As the software was using Windows Win32 API, the name has changed to "Proxy32" to avoid confusion with older Java/Swing version.

What can I do in Proxy32?

Short answer:

"Everything you can do in CYGWIN as Proxy32 is just another GUI interface to work with CYGWIN. For the question "What one can do in CYGWIN?", the answer is "Almost all that you can do in LINUX" (as most of the CYGWIN software is ported from LINUX world). And in LINUX one can do almost anything as LINUX has wide variety of software for all imaginable intents and purposes.

Technical details:

Well, does Proxy32 add something new to the CYGWIN capabilities? The answer is: yes.

For starters, Proxy32 has LauncherTree. It allows user to build all launchers (to start terminals, scripts and applications) into one big GUI tree. This LauncherTree is somewhat similar to the Favorites/Bookmarks Tree in major browsers, except that it "bookmarks" not only web-page url's but several different actions (creating terminals, executing commands and scripts into terminals, starting Windows applications). Tree is editable by GUI means (Launcher Editor dialogs and Drag-and-drop). It is saved/loaded/exported/imported in XML format. XML format allows bulk edits and easy transfer of user-created LauncherTree to another user.

The rest of the unique Proxy32 capabilities is mostly on the terminal side.

What is CYGWIN?

Short answer:

CYGWIN is

Technical details:

LINUX software is sending system requests (for example, read the file or print the text) to the LINUX kernel in the format that is understood only by LINUX kernel. The heart of the CYGWIN project is CYGWIN1.DLL that can translate LINUX style system requests into Windows style system requests and pass them to Windows for execution. The other core component of the CYGWIN project is CYGWIN GCC compiler that can take the original source code of LINUX software and build this software in a way that it will direct its system requests to CYGWIN1.DLL instead of sending them to LINUX kernel. Once software is rebuilt to use CYGWIN1.DLL instead of using LINUX Kernel, it will run on Windows if CYGWIN1.DLL is present.

All the software that was rebuilt to use CYGWIN1.DLL is part of CYGWIN project. All this software (together with CYGWIN1.DLL and CYGWIN GCC compiler) is available for download from the home page of CYGWIN project http://www.cygwin.com.

Do I have to have some basic CYGWIN/LINUX knowledge before I can start using Proxy32?

Short answer:

Yes. Proxy32 will, probably, give user the fastest and easiest way to access CYGWIN Bash prompt. It will also help user to organize growing CYGWIN knowledge (commands) in the ready-to-use and documented form. But except for those two differences, user still has to go through the learning of CYGWIN commands, regardless of using or not using Proxy32.

Technical details:

When one downloads and runs Proxy32.exe file, it will automatically create CYGWIN installation (with pre-selected set of packages) and start CYGWIN bash in Proxy32 Terminal at the end of installation process. Several minutes after clicking "Install" button in Proxy32, user will have CYGWIN Bash shell prompt in open terminal window inside of "Workspace0".

Then one can start learning LINUX/CYGWIN commands that can be executed at Bash prompt.

In Proxy32 user can save useful command as "COMMAND Launcher" on LauncherTree. This way the command will be saved in the form that is ready for future execution by double-click on it. Also, user can attach extensive tooltip text to the "COMMAND Launcher", for example, to show sample printout of the command that is configured in this "COMMAND Launcher". "COMMAND Launchers" can be grouped into "SUBTREE"s on LauncherTree. LauncherTree is searchable (using PERL REGEX).

Why Proxy32 is not licensed under GPL?

Proxy32 process does not link to any static or dynamic CYGWIN library, so it does not have to be licensed under GPL. Proxy32 built-in terminal is using Windows inter process communication (IPC) mechanism to control standalone CYGWIN TTY-driver process called "proxycygterm". I have derived "proxycygterm" code from "cygterm" code in March 2006 to use it as new Proxy32 to CYGWIN TTY interface. Source code of "proxycygterm" is published here (as "cygterm" code is licensed under GPL). GPL source code of unmodified CYGWIN binaries that Proxy32.exe installs is located here.

How Proxy32 terminal controls external backends (SHELLs)?

One can think of external backend as local child process that user is interacting with by the means of the terminal. This child process in turn can represent either local shell or remote host via TELNET/FTP/SSH/SFTP/COM-PORT connection. Proxy32 built-in terminal is using Windows inter process communication (IPC) mechanism to control standalone external backends. Proxy32 terminal on "connect" starts configured "backend" as child process and communicates with it via STDIN/STDOUT/STDERR pipes. Most powerful backend is CYGWIN TTY-driver process called "proxycygterm". It creates CYGWIN TTY and starts any configured CYGWIN application on this TTY. On resize of Proxy32 terminal it sends Telnet NAWS command to STDIN of proxycygterm to resize slave TTY to match new size of the Proxty32 terminal. If backend command line does not contain word "proxycygterm" then NAWS command is not sent to STDIN of backend process. If backend process exited or died, Proxy32 terminal disconnects. If user "disconnects" Proxy32 terminal manually, backend process and all process tree it has created is killed.

Example of command line of backend process (SHELL) to launch CYGWIN Bash on proxycygterm TTY in the Proxy32 terminal: “proxycygterm.exe -s ‘/usr/bin/bash -i -l’” Command line is shown as it is entered into configuration of the SHELL-TERMINAL launcher.

What external backends (SHELLs) one can use with Proxy32 terminal?

Backends are very important as they extend functionality of the Proxy32 terminal.

Which communication protocols are supported to connect Proxy32 terminal to remote host?

How to connect Proxy32 terminal to cluster of remote hosts?

One can use in SHELL-TERMINAL launcher command line proxycygterm.exe -s '/usr/bin/screen -s bash'. It will start local CYGWIN "screen" application (for multiplexing multiple virtual vt100 terminals into one physical terminal) on the CYGWIN TTY created by interface program proxycygterm.exe. Once you see screen application initialized and started bash shell, use sequence of 3 keyboard commands ^aS then ^aTAB then ^ac to split window in two parts, switch to newly created split, create second virtual vt100 terminal and start new shell in the second virtual terminal. Then you can use both virtual terminals independently and switch keyboard input between them with ^aTAB (means "press Ctrl-a first, then press TAB"). Further use of ^aS then ^aTAB then ^ac will create more virtual vt100 terminals in the same physical proxy32 terminal. This mode is convenient to control multiple connections from single physical proxy32 terminal window under control of single script/plugin. Such operation allows to simulate functionality of "cluster" (or "vector") terminal when multiple connections to several network nodes working in redundant load sharing cluster are established in one terminal window and under control of single script/plugin. Issuing command ^a:caption always "%w" will force status line under the screen of every virtual terminal.

What is Proxy32 terminal session sharing?

Often the whole team of people working on different computers and even from different locations should share single terminal session. Shared session means all team is typing on "remotely-shared" keyboard (one at the time) and viewing "remotely-shared" screen with output of remote host (simultaneously). This "shared" Proxy32 terminal session can be login session to remote host or session of local Proxy32 terminal CYGWIN bash shell activities. When such "sharing" may be needed:

Which communication protocols are supported to share existing Proxy32 terminal session with remote users?

Every Proxy32 terminal window has built-in TELNET/TLS server and one "serving/listening" COM-PORT to share existing terminal session with remote users. Remote users connect via TELNET, TELNET/TLS or Serial protocol to Proxy32 terminal to receive copy of the output from remote host and to be able to type commands into shared terminal session. One user at the time can type commands to the remote host (shared session means shared keyboard and shared screen), otherwise remote host will be confused. Local User at the Proxy32 terminal can switch Remote users into "read only" mode when they will receive output from remote host but they cannot type commands to the host.

What is Proxy32 PLUGIN?

Proxy32 PLUGIN is a child process that is started from the terminal and receives control over the interaction with remote host. Proxy32 PLUGIN interface to terminal is better that ActiveX/COM programmer's interface used in the other automated terminals:

Here is the brief description of the PLUGIN interface to control the terminal and remote host:

To automatically finish login for the SHELL-TERMINAL launcher with the following command line:

“proxycygterm.exe -s ‘/usr/bin/ftp 192.168.1.9 21′” 

one can place PLUGIN launcher with the following command line under the SHELL-TERMINAL launcher:

perl -e '
$a="";while(){sysread STDIN,$_,10000;syswrite STDERR,$_;$a.=$_;last if $a=~/Name/;}
syswrite STDOUT,\'belous\';syswrite STDOUT,"\r\n";
$a="";while(){sysread STDIN,$_,10000;syswrite STDERR,$_;$a.=$_;last if $a=~/assword:/;}
syswrite STDOUT,\'test123\';syswrite STDOUT,"\r\n";
$a="";while(){sysread STDIN,$_,10000;syswrite STDERR,$_;$a.=$_;last if $a=~/ftp>/;}
'

There are seven lines of code here (1-7):

  1. starts PERL interpreter and tells it that the PERL script to be executed is located in the string that will be in the command line of the interpreter (following -e command line switch). Single quote at the end of the line starts the string that contains in-line PERL script.
  2. Infinite loop: Reads bytes from remote host (STDIN), relays them to terminal screen (STDERR) and scans them for the presence of the prompt/phrase Name. Loop is exited when prompt is found.
  3. sends user name belous to remote host (STDOUT) followed by the CR/NL
  4. Infinite loop: Reads bytes from remote host (STDIN), relays them to terminal screen (STDERR) and scans them for the presence of the prompt/phrase assword:. Loop is exited when prompt is found.
  5. sends user password test123 to remote host (STDOUT) followed by the CR/NL
  6. Infinite loop: Reads bytes from remote host (STDIN), relays them to terminal screen (STDERR) and scans them for the presence of the prompt/phrase ftp>. Loop is exited when prompt is found. This is the last line of the PERL script, PLUGIN is exiting here and connection between remote host and user`s screen and keyboard is automatically restored.
  7. single quote on this line signifies the end of the string that contains in-line PERL script

Note that this PLUGIN is designed to be started automatically on connect of the terminal. Autostart of the PLUGIN is achieved by placing PLUGIN launcher directly under the SHELL-TERMINAL launcher on the LauncherTree. When user double-clicks on the SHELL-TERMINAL launcher, terminal connects and then it looks for PLUGIN/I-SCRIPT launcher located directly under SHELL-TERMINAL. If such PLUGIN/I-SCRIPT launcher is found under SHELL-TERMINAL Launcher, it is executed immediately without user intervention. If PLUGIN Launcher is started manually, it will be too late to catch Name prompt from ftp server. Then PLUGIN will start reading from remote host after the Name prompt is already gone. PLUGIN will hung waiting for Name prompt in indefinite loop (until it is killed by user).

More info about PLUGINs can be found here.

What is running Proxy32 on Separate Windows Desktop?

Proxy32 can create Separate Windows Desktop and start Proxy32 GUI on it. In this case programs started on Common Windows Desktop will be unable to interact with Proxy32 GUI (manipulate Proxy32 windows and send mouse and keyboard events into them). When Proxy32 GUI is started on the Separate Windows Desktop, it allows user to switch back and forth between Separate and Common Windows Desktops via special key combination. Running Proxy32 on the Separate Windows Desktop can be used for executing mission-critical tasks when user wants to avoid any interference from the other Windows applications.