# poderosaproject/poderosa architecture

> Architecture diagram of the GitHub repository poderosaproject/poderosa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/poderosaproject/poderosa
- Repository: https://github.com/poderosaproject/poderosa

## Overview

##### Project type and purpose
- This is a Windows desktop terminal‐emulator application (“Poderosa”).
- Primary purpose: provide SSH (with agent/X11/port forwarding), SFTP/SCP, Telnet, serial‐port, pipe, X/ZModem transfers, macro scripting, plugin extensibility, benchmarking.

##### High‐level architectural overview
- Layered, modular desktop application with a plugin/extension‐point framework.
- Core layers (UI, Core services, TerminalEmulator engine, Protocols engines) link together.
- Extension points let you drop in feature modules (SFTP, PortForward, Serial, XZModem, Macro, etc.).

##### Main components
A. UI Layer
- Executable/Executable.csproj: application entry‐point, bootstraps UI.
B. Core Services
- Core/Core.csproj: application shell, command/ menu management, plugin loader (ExtensionPointList, PluginList), session/view management, serialization, preferences, macro engine host.
- Plugin/Plugin.csproj: low‐level extension‐point definitions, versioning, remoting, startup.
C. Terminal Emulation Engine
D. Protocol Implementations
- Protocols/Protocols.csproj and Granados/Granados.csproj: SSH1/SSH2 (Cryptography, key‐formats, agent, forwarding, port‐forwarding), Telnet, Cygwin bridge, SOCKS; Granados is SSH library (blowfish, RSA, DH…).
E. Session Management
- TerminalSession/TerminalSession.csproj: UI tab pages, session lifecycle, login dialogs (SSH, Telnet, Cygwin), copy/paste, macros, storage per window.
F. Feature Plugins
- SFTP/SFTP.csproj, SerialPort/SerialPort.csproj, Pipe/Pipe.csproj, XZModem/XZModem.csproj, Macro/Macro.csproj, PortForwarding/PortForwarding.csproj, ContributedPlugins.
- Each plugin implements ITerminalPlugin or IExtensionPoint, provides dialogs, settings serialization, integrates into Core services.
G. Benchmark & Test Suites
- Benchmark, CoreTest, GranadosTest, ProtocolsTest, TerminalEmulatorTest: performance tests, unit tests.
H. Build & Documentation
- build/ scripts, howtobuild.txt; Doc/ for API docs and user/developer manuals.

##### Relationships & data flows
- [Executable] → initializes → [Core Services]
- [Core Services] ↔ loads ↔ [Plugin Framework]
- [Core Services] ↔ hosts ↔ [UI Layer]
- [UI Layer] ↔ commands/events ↔ [Core Services]
- [Core Services] ↔ instantiates ↔ [TerminalSession Manager]
- [TerminalSession] ↔ uses ↔ [TerminalEmulator Engine]
- [TerminalEmulator Engine] ↔ uses ↔ [Protocols Layer]
- [Protocols Layer] (Granados for SSH) ↔ communicates ↔ external network/serial ports/pipes
- Plugins hook into Core → add new Protocols or UI panels.
- Macro engine invoked by Core services on TerminalSession I/O.

##### Architectural patterns & principles
- Layered architecture: separation of concerns among UI, core, emulation, protocols.
- Plugin/Extension‐point pattern: Core exposes points, Plugin projects implement.
- Model–View–Controller-ish: Core serves as controller, UI as view, session/emulator as model.
- Dependency inversion: high‐level Core depends on abstraction (IProtocol, IPlugin).
- Event‐driven: UI and TerminalEmulator communicate via events and commands.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Executable
    Executable["Executable\n(Executable.csproj, Main.cs, UIRoot.cs)"] 
    class Executable core
    click Executable "https://github.com/poderosaproject/poderosa/blob/master/Executable/Executable.csproj"

    %% Core Services
    Core["Core Services\n(Core.csproj, CommandManager.cs, PluginList.cs, ExtensionPointList.cs,\nSession.cs, Serialize.cs, Preferences.cs, MacroEngineEx.cs,\nMainWindow.cs, PoderosaForm.cs)"]
    class Core core
    click Core "https://github.com/poderosaproject/poderosa/blob/master/Core/Core.csproj"

    %% Plugin Framework
    Plugin["Plugin Framework\n(Plugin.csproj, ExtensionPoint.cs, PluginList.cs, PoderosaStartup.cs,\nRemoting.cs, VersionInfo.cs)"]
    class Plugin plugin
    click Plugin "https://github.com/poderosaproject/poderosa/blob/master/Plugin/Plugin.csproj"

    %% UI Layer
    UI["UI Layer\n(UI.csproj, ColorDialog.cs, PaneSplitter.cs, TabBar.cs,\nThreeButtonMessageBox.cs,\nOptionDialog.cs, ConnectionOptionPanel.cs,\nDisplayOptionPanel.cs, SSHOptionPanel.cs,\nFontDialog.cs, AgentKeyListDialog.cs,\nPreferenceEditor.cs, MRUPlugin.cs)"]
    class UI ui
    click UI "https://github.com/poderosaproject/poderosa/blob/master/UI/UI.csproj"

    %% Session Management
    Session["TerminalSession Manager\n(TerminalSession.csproj, TerminalSession.cs,\nOpenSessionDialog.cs, OpenSessionTabPageSSH.cs,\nOpenSessionTabPageTelnet.cs, CygwinLoginDialog.cs,\nStoragePerWindow.cs, TerminalSessionPlugin.cs)"]
    class Session sessionEmu
    click Session "https://github.com/poderosaproject/poderosa/blob/master/TerminalSession/TerminalSession.csproj"

    %% Terminal Emulator Engine
    Engine["TerminalEmulator Engine\n(TerminalEmulator.csproj, EscapeSequenceEngine.cs,\nTerminalEmulator.cs, TerminalControl.cs, Sixel.cs,\nShellScheme.cs, Resources)"]
    class Engine sessionEmu
    click Engine "https://github.com/poderosaproject/poderosa/blob/master/TerminalEmulator/TerminalEmulator.csproj"

    %% Protocols Layer
    subgraph "Protocols Layer"
        Protocols["Protocols Layer\n(Protocols.csproj, SSH.cs, Telnet.cs,\nCygwinBridge/, socks.cs,\nTerminalConnection.cs, ProtocolOptions.cs)"]
        class Protocols protocols
        click Protocols "https://github.com/poderosaproject/poderosa/blob/master/Protocols/Protocols.csproj"

        Granados["Granados Library\n(Granados.csproj, ConnectionParameter.cs,\nSSH2Connection.cs, AlgorithmSupport.cs,\nPoderosa/KeyFormat/, Poderosa/SFTP/, Poderosa/SCP/)"]
        class Granados protocols
        click Granados "https://github.com/poderosaproject/poderosa/blob/master/Granados/Granados.csproj"
    end

    %% Feature Plugins
    subgraph "Feature Plugins" style dashed
        SFTP["SFTP Plugin\n(SFTP.csproj)"] 
        click SFTP "https://github.com/poderosaproject/poderosa/blob/master/SFTP/SFTP.csproj"
        Serial["SerialPort Plugin\n(SerialPort.csproj)"] 
        click Serial "https://github.com/poderosaproject/poderosa/blob/master/SerialPort/SerialPort.csproj"
        Pipe["Pipe Plugin\n(Pipe.csproj)"] 
        click Pipe "https://github.com/poderosaproject/poderosa/blob/master/Pipe/Pipe.csproj"
        XZ["XZModem Plugin\n(XZModem.csproj)"] 
        click XZ "https://github.com/poderosaproject/poderosa/blob/master/XZModem/XZModem.csproj"
        Macro["Macro Plugin\n(Macro.csproj)"] 
        click Macro "https://github.com/poderosaproject/poderosa/blob/master/Macro/Macro.csproj"
        PF["PortForwarding Plugin\n(PortForwarding.csproj)"] 
        click PF "https://github.com/poderosaproject/poderosa/blob/master/PortForwarding/Portforwarding.csproj"
        EP["ExtendPaste Plugin\n(ExtendPaste.csproj)"] 
        click EP "https://github.com/poderosaproject/poderosa/blob/master/ContributedPlugins/ExtendPaste/ExtendPaste.csproj"
    end
    class SFTP,Serial,Pipe,XZ,Macro,PF,EP plugin

    %% External Resources
    Network["Network/SSH Server"]:::external
    SerialPortExt["Serial Port"]:::external
    NamedPipe["Named Pipe"]:::external
    FileSystem["File System\n(SFTP/SCP)"]:::external

    %% Build & Documentation & Tests
    subgraph Ancillary
        Build["Build Scripts\n(build/, howtobuild.txt)"] 
        click Build "https://github.com/poderosaproject/poderosa/tree/master/build/"
        Doc["Documentation\n(Doc/)"] 
        click Doc "https://github.com/poderosaproject/poderosa/tree/master/Doc/"
        Bench["Benchmark Suite\n(Benchmark.csproj)"] 
        click Bench "https://github.com/poderosaproject/poderosa/blob/master/Benchmark/Benchmark.csproj"
        CoreT["Core Tests\n(CoreTest.csproj)"] 
        click CoreT "https://github.com/poderosaproject/poderosa/blob/master/CoreTest/CoreTest.csproj"
        GranT["Granados Tests\n(GranadosTest.csproj)"] 
        click GranT "https://github.com/poderosaproject/poderosa/blob/master/GranadosTest/GranadosTest.csproj"
        ProtT["Protocols Tests\n(ProtocolsTest.csproj)"] 
        click ProtT "https://github.com/poderosaproject/poderosa/blob/master/ProtocolsTest/ProtocolsTest.csproj"
        EmuT["Emulator Tests\n(TerminalEmulatorTest.csproj)"] 
        click EmuT "https://github.com/poderosaproject/poderosa/blob/master/TerminalEmulatorTest/TerminalEmulatorTest.csproj"
    end
    class Build,Doc,Bench,CoreT,GranT,ProtT,EmuT testDocs

    %% Connections
    Executable -->|"initializes"| Core
    Core -->|"loads"| Plugin
    Core -->|"hosts"| UI
    UI -->|"user commands/events"| Core
    Core -->|"instantiates"| Session
    Session -->|"uses"| Engine
    Engine -->|"uses"| Protocols
    Protocols -->|"uses cryptography"| Granados
    Protocols -->|"connects"| Network
    Protocols -->|"connects"| SerialPortExt
    Protocols -->|"connects"| NamedPipe
    Protocols -->|"reads/writes"| FileSystem
    Plugin -->|"extends"| Core
    Plugin -->|"provides protocols/UI"| Core

    %% Feature plugin integrations
    Plugin --- SFTP
    Plugin --- Serial
    Plugin --- Pipe
    Plugin --- XZ
    Plugin --- Macro
    Plugin --- PF
    Plugin --- EP

    %% Build & Docs relationships
    Executable -.->|supports build/tests/docs| Build
    Executable -.-> Doc
    Executable -.-> Bench
    Executable -.-> CoreT
    Executable -.-> GranT
    Executable -.-> ProtT
    Executable -.-> EmuT

    %% Styles
    classDef core fill:#add8e6,stroke:#000,stroke-width:1px
    classDef plugin fill:#dda0dd,stroke:#000,stroke-width:1px
    classDef ui fill:#90ee90,stroke:#000,stroke-width:1px
    classDef sessionEmu fill:#ffa500,stroke:#000,stroke-width:1px
    classDef protocols fill:#ffff99,stroke:#000,stroke-width:1px
    classDef external fill:#d3d3d3,stroke:#000,stroke-width:1px
    classDef testDocs fill:#f0f0f0,stroke:#000,stroke-width:1px
```
