class Mud::Net::Telnet
- Mud::Net::Telnet
- Reference
- Object
Overview
A Telnet protocol manager (RFC 854).
The game implementation assumes a few things about a client connection:
- UTF-8 encoding of text in both directions,
- terminal emulation on the client side that supports ANSI control codes to modify the presentation of text.
In order to guarantee these assumptions hold, when we open a new Telnet connection we negotiate the following options:
- Binary Transmission (RFC 856), to ensure 8-bit clean data transfer,
- Terminal Type (RFC 1091), to query the client's terminal capabilites,
Additionally the interface is intended to be used with Line-editing on the client side such that the server receives content a line at a time. To guarantee this we try to negotiate (but don't require):
- Linemode (RFC 1184), to set the required line-editing configuration.
If during initial negotiations any of these options are rejected, then the client is informed of the incompability and the connection is closed. Otherwise we begin sub-negotiations to check for the right terminal type and line-editing configuration.
Once all the configuration is complete the game can start to talk to the client, safe in the above assumptions.
The implementation below has been tested against the following Telnet client programs:
- Inetutils telnet on xterm
- OpenBSD telnet on xterm
- Windows 10 telnet on CMD
- PuTTY telnet
Defined in:
net/telnet.crConstant Summary
-
BRK =
243_u8
-
BT =
0_u8
-
DO =
253_u8
-
DONT =
254_u8
-
IAC =
255_u8
-
IP =
244_u8
-
LM =
34_u8
-
SB =
250_u8
-
SE =
240_u8
-
TERMS =
["XTERM", "ANSI"]
-
Accepted terminal types
-
TT =
24_u8
-
WILL =
251_u8
-
WONT =
252_u8
Constructors
Instance Method Summary
-
#command(b)
Interprets input byte as part of a command.
-
#data(b, str)
Interprets input byte as data.
-
#negotiate
Responds to Telnet negotiations.
-
#negotiate_bt(option)
Negotiates the binary transmission option.
-
#negotiate_lm(option)
Attempts to negotiate the linemode option.
-
#negotiate_tt(option)
Negotiates the terminal type option.
-
#negotiated?
Returns whether all prerequisite negotiations have succeeded?
-
#parse?(buf : Bytes) : Array(String)
Processes bytes read from Telnet stream.
-
#subnegotiation(b, sub)
Interprets input byte as part of a subnegotiation.