Pages

Research notes

These notes record the decisions taken from reading ENiGMA½, Mystic and Synchronet documentation and source, plus the protocol specs. Each section links to its sources.

Conventions adopted

Topic Decision Source
Colour codes Renegade/Mystic pipe codes: |00–|15 foreground in DOS order (1 = blue, 4 = red), |16–|23 background, |24–|31 iCE background. wiki.mysticbbs.com/doku.php?id=displaycodes, enigma-bbs.github.io/art/colour-codes
Screen codes Mystic set: |CL |CR |PA |PN |PE |DE |BE |[X## |[Y## |[A##..D## |[K |[0 |[1 |SA |RA |SS |RS |$R## |$L## |$C## |$D##c, with || and |PI as a literal pipe. Mystic displaycodes
Display codes ENiGMA's two-letter set (UN handle, UR real name, LO location, BN, SN, ND, TL/TR …) written %XX in art and |XX in strings. Mystic gives UN/LO other meanings, so ENiGMA's win. enigma-bbs.github.io/art/mci
View markers ENiGMA's %ET1, %VM1, %TL1 …: the marker's position in the art is where the widget is drawn. A repeated marker sets the focus colour. ENiGMA MCI docs
ACS ENiGMA syntax: CODE## or CODE[list], ! binds tightest, then & (or adjacency), then |. Unknown codes deny. enigma-bbs.github.io/configuration/acs
Menus Mystic's model (hotkeys, lightbar, fallback menu on failed ACS, FIRSTCMD becomes on-enter steps) with ENiGMA's history and noHistory. Mystic menus, ENiGMA menu-hjson
Art lookup ENiGMA: user theme, then parent theme, then shared art. Numbered files are random variants. Mystic's .cNNN width variants. .utf8ans for UTF-8 callers. enigma-bbs.github.io/art/general, Mystic display_files
Doors ENiGMA abracadabra: stdio io, drop file type, node maximum, minimum time left, {node}/{dropFile} placeholders. Time is capped at 546 minutes for legacy doors. enigma-bbs.github.io/doors

Protocol details that shaped the code

  • Telnet negotiation. On connect the server offers WILL ECHO and WILL SGA, asks DO SGA, offers and asks BINARY both ways, and asks DO TTYPE and DO NAWS. It never re-acknowledges a state it is already in, which avoids loops; Synchronet and ENiGMA do the same. If no IAC arrives within the negotiation window, the caller is served as raw TCP (for example nc). (RFC 854/856/857/858/1073/1091; Synchronet answer.cpp; ENiGMA telnet.js)

  • End of line. A server must treat CR LF and CR NUL alike (RFC 1123 §3.3.1). The decoder treats CR as Enter and drops one following LF or NUL, and also accepts a bare LF.

  • Probing. One burst, modelled on Synchronet:

    1. Save the cursor, jump to row and column 255, and request a cursor position report. The reply gives the screen size.
    2. Print U+2060 at column 1 and request another report. A reply below column 3 means UTF-8; CP437 terminals draw three glyphs.
    3. Send ESC[0c. CTerm answers ESC[=67;84;101;114;109;…c, which spells "CTerm".

    NetRunner answers every report with 1;1, which is read as CP437. Sizes of 231, 255 and 999 are not trusted.

  • Line wrap. CTerm, ANSI.SYS and ansilove wrap as soon as the last column is written, so .ans art leaves out the CR LF after full rows. The interpreter follows that rule for CP437 art and xterm's deferred wrap for UTF-8 text files. Output always goes out with autowrap off (ESC[?7l) and an explicit CR LF per row, which comes out the same on both kinds of terminal.

  • iCE colours. For CTerm the server sends ESC[?33h, after which SGR 5 means a bright background. Other terminals get aixterm codes 100–107.

  • SAUCE. The record is the last 128 bytes, an optional COMNT block sits before it, and 0x1A ends the content. TInfo1 is the width, and TFlags bit 0 marks iCE art. (acid.org/info/sauce/sauce.htm)

  • CP437. The high half follows unicode.org CP437.TXT; 0x01–0x1F and 0x7F follow IBMGRAPH.TXT. Text is never encoded to a byte the terminal acts on (NUL, BEL, BS, HT, LF, CR, ESC).

  • Drop files. DOOR.SYS has 52 lines (GAP format), DOOR32.SYS 11, DORINFOn.DEF 13 (n is the node number in hex), and CHAIN.TXT is WWIV's format. (wiki.synchro.net/ref:*)

  • RLogin. The client sends \0 client-user \0 server-user \0 term/speed \0 and the server answers \0. The BBS convention is that client-user carries the password and server-user the handle. (RFC 1282; Synchronet; SyncTERM rlogin.c)

  • SSH. RFC 4253/4252/4254, plus:

    • curve25519-sha256 (RFC 8731): the shared secret becomes an mpint from its raw bytes.
    • aes-gcm@openssh.com: the length field is clear and authenticated, and the 64-bit invocation counter increments per packet.
    • Strict KEX: sequence numbers reset after each NEWKEYS, and anything but key exchange before the first one is fatal.
    • The group 14 prime was cross-checked against phpseclib.

Feature checklist (from the scene)

Matrix and login, new user application, oneliners, last callers with action flags, who's online with activity, user list, conferences and areas with new scan and last-read pointers, a full-screen editor with quoting, private mail, node messages, teleconference, sysop page, bulletins with NEW flags, voting booth with user-added answers, door games with a hall of fame, settings, and sysop tools. All of these are implemented.

Not built yet:

  • File areas. X/Y/ZModem over telnet and SSH.
  • Echomail and netmail. FidoNet BinkP/BSO or QWK networking.
  • Achievements. A tiered stats system in the style of ENiGMA's.
  • Door servers. BBSLink and DoorParty.
  • SSH public-key login.