150 lines
4.1 KiB
Markdown
150 lines
4.1 KiB
Markdown
# SecLink Terminal Demo
|
|
|
|
DOS terminal emulator combining the DVX windowed GUI with SecLink
|
|
encrypted serial communication. Connects to a remote BBS through the
|
|
SecLink proxy, providing a full ANSI terminal in a DVX-style
|
|
window with encrypted transport.
|
|
|
|
## Architecture
|
|
|
|
```
|
|
termdemo (DOS, 86Box)
|
|
|
|
|
+--- DVX GUI windowed desktop, ANSI terminal widget
|
|
|
|
|
+--- SecLink encrypted serial link
|
|
| |
|
|
| +--- packet HDLC framing, CRC, retransmit
|
|
| +--- security DH key exchange, XTEA-CTR cipher
|
|
| +--- rs232 ISR-driven UART I/O
|
|
|
|
|
COM port (86Box emulated modem)
|
|
|
|
|
TCP:2323
|
|
|
|
|
secproxy (Linux)
|
|
|
|
|
TCP:23
|
|
|
|
|
Remote BBS
|
|
```
|
|
|
|
All traffic between the terminal and the proxy is encrypted via
|
|
XTEA-CTR on SecLink channel 0. The proxy decrypts and forwards
|
|
plaintext to the BBS over telnet.
|
|
|
|
## Usage
|
|
|
|
```
|
|
termdemo [com_port] [baud_rate]
|
|
```
|
|
|
|
| Argument | Default | Description |
|
|
|-------------|---------|------------------------------|
|
|
| `com_port` | 1 | COM port number (1-4) |
|
|
| `baud_rate` | 115200 | Serial baud rate |
|
|
|
|
```
|
|
termdemo # COM1 at 115200
|
|
termdemo 2 # COM2 at 115200
|
|
termdemo 1 57600 # COM1 at 57600
|
|
termdemo -h # show usage
|
|
```
|
|
|
|
## Startup Sequence
|
|
|
|
1. Seed the RNG from hardware entropy
|
|
2. Open SecLink on the specified COM port (8N1, no handshake)
|
|
3. Perform DH key exchange (blocks until the proxy completes its side)
|
|
4. Initialize the DVX GUI (1024x768, 16bpp VESA)
|
|
5. Create a resizable terminal window with menu bar and status bar
|
|
6. Enter the main loop
|
|
|
|
The handshake completes in text mode before the GUI starts, so the
|
|
DOS console shows progress messages during connection setup.
|
|
|
|
## Main Loop
|
|
|
|
Each iteration:
|
|
|
|
1. `dvxUpdate()` -- process mouse, keyboard, paint, and window events
|
|
2. `secLinkPoll()` -- read serial data, decrypt, deliver to ring buffer
|
|
3. `wgtAnsiTermPoll()` -- drain ring buffer into the ANSI parser
|
|
|
|
## Data Flow
|
|
|
|
```
|
|
BBS -> proxy -> serial -> secLinkPoll() -> onRecv() -> ring buffer
|
|
-> commRead() -> wgtAnsiTermWrite() -> ANSI parser -> screen
|
|
|
|
Keyboard -> widgetAnsiTermOnKey() -> commWrite()
|
|
-> secLinkSend() -> serial -> proxy -> BBS
|
|
```
|
|
|
|
A 4KB ring buffer bridges the SecLink receive callback (which fires
|
|
during `secLinkPoll()`) and the terminal widget's comm read interface
|
|
(which is polled by `wgtAnsiTermPoll()`).
|
|
|
|
## GUI
|
|
|
|
- **Window**: resizable, titled "SecLink Terminal"
|
|
- **Menu bar**: File -> Quit
|
|
- **Terminal**: 80x25 ANSI terminal widget with 1000-line scrollback
|
|
- **Status bar**: shows COM port, baud rate, and encryption status
|
|
|
|
The ANSI terminal widget supports standard escape sequences including
|
|
cursor control, SGR colors (16-color CGA palette), erase, scroll,
|
|
insert/delete lines, and DEC private modes (cursor visibility, line
|
|
wrap).
|
|
|
|
## Test Setup
|
|
|
|
1. Start the SecLink proxy on the Linux host:
|
|
|
|
```
|
|
secproxy 2323 bbs.example.com 23
|
|
```
|
|
|
|
2. Configure 86Box with a COM port pointing at the proxy's listen port
|
|
(TCP client mode, port 2323, no telnet negotiation)
|
|
|
|
3. Run the terminal inside 86Box:
|
|
|
|
```
|
|
termdemo
|
|
```
|
|
|
|
4. The handshake completes, the GUI appears, and BBS output is
|
|
displayed in the terminal window
|
|
|
|
## Building
|
|
|
|
```
|
|
make # builds ../bin/termdemo.exe
|
|
make clean # removes objects and binary
|
|
```
|
|
|
|
The Makefile builds all dependency libraries automatically. Objects
|
|
are placed in `../obj/termdemo/`, the binary in `../bin/`.
|
|
|
|
## Dependencies
|
|
|
|
All libraries are in `../lib/`:
|
|
|
|
| Library | Purpose |
|
|
|------------------|--------------------------------------|
|
|
| `libdvx.a` | DVX windowed GUI and widget system |
|
|
| `libseclink.a` | Secure serial link wrapper |
|
|
| `libpacket.a` | HDLC framing and reliability |
|
|
| `libsecurity.a` | DH key exchange and XTEA cipher |
|
|
| `librs232.a` | ISR-driven UART serial driver |
|
|
|
|
Target: DJGPP cross-compiler, 486+ CPU, VESA VBE 2.0+ video.
|
|
|
|
## Files
|
|
|
|
```
|
|
termdemo/
|
|
termdemo.c terminal emulator program
|
|
Makefile DJGPP cross-compilation build
|
|
```
|