How teratermproject/teraterm works
Main components
• Core Terminal Emulator Engine:
– This is found primarily in the “teraterm” directory (and possibly “TTProxy” for advanced network or proxy handling).
– It comprises the main terminal UI, window management, input handling, and display (using Win32 APIs).
• Communication & Protocol Handlers:
– Code for handling various connections (serial, telnet, SSH, etc.) appears in directories like “teraterm”, “ttssh2”, “ttssh2/argon2”, “ttssh2/libsshagentc”, “ttssh2/ttxssh” and possibly “cygwin” support for Unix emulation.
– These components manage the low-level system calls, protocol negotiation, and network I/O.
• Plugin and Extension Support:
– Directories such as “ttpmenu”, “ttpmacro”, “ttssh2” (with its various submodules) indicate that the system supports external plugins and built-in macro functions.
– The “TTX…” directories (like TTXAdditional, TTXKanjiMenu, TTXSamples) provide sample extensions or additional functionalities that might be loaded or activated in a plugin-like manner.
• Supporting Libraries & External Dependencies:
– “libs” and the “buildtools” directories indicate usage of external libraries (e.g., OpenSSL, LibreSSL, zlib, oniguruma, SFMT) and scripts to configure or build them.
– They might be wrapped by custom CMake modules that feed into the build system.
• Build, Testing, and Deployment Infrastructure:
– The project includes CI configurations (.github/workflows for msbuild and cmake), various installer scripts and packaging tools (“installer” directory), as well as tests (“tests”).
– These represent the integration and deployment pipelines that ensure the application is built correctly across platforms.
Relationships and data flows
• At the center, the terminal emulator core acts as the “orchestrator,” interfacing with UI components (user inputs, windowing), and calling into connection modules.
• Plugin and macro layers “hook” into the core terminal processing so that macros and plugins (like TTX samples and TTPMacro) extend or modify behavior.
• The build system (CMake, MSBuild solution files) feeds into the automation/CI pipelines and is integrated with the installer tools that produce final releases.
Architectural patterns and design principles
• Modular Architecture: The project is split into distinct functional modules (core engine, communication, plugins, libraries, and build infrastructure).
• Separation of Concerns: UI, protocol handling, and platform abstraction are separated (e.g., by the “teraterm/common” and “teraterm/teraterm” subdirectories) so that changes in one area do not disrupt another.
• Plug-in Architecture: The existence of many extension-sample directories and separate plugin modules demonstrates a design that supports extensibility and easy feature addition.
• Top layer: User Interface (Windows UI, terminal display, input handling)
• Middle layer: Core Engine, Communication Protocol Handlers, and Plugin system
• Lower layer: External Libraries and system-level dependencies
• Side layer: Build, test, and packaging/installer infrastructure