class BBS::Gateway::Negotiation
The gateway’s side of the telnet negotiation with the other board, as its telnet client: it agrees to echo and go-ahead suppression, reports the caller’s window size and terminal type when asked (not for a PETSCII caller, who is a Commodore to the other board), passes BINARY on to the caller, and refuses the rest. Each option is answered once, so a board that asks again gets no loop.
Constants
- AGREE
-
The answer to each telnet command that agrees with it.
- BYTE_MASK
-
The low byte of a 16-bit NAWS value.
- TTYPE
-
TelnetTERMINAL-TYPE option code. - TTYPE_IS
-
TERMINAL-TYPE subnegotiation: the type follows.
- TTYPE_SEND
-
TERMINAL-TYPE subnegotiation: the other side asks for the type.
Public Class Methods
# File lib/bbs/gateway/negotiation.rb, line 33 def initialize(session, terminal:, petscii:, remote:, client:) @session = session @terminal = terminal @petscii = petscii @remote = remote @client = client @answered = {} @binary = { WILL => false, DO => false } end
Creates the negotiation of one crossing.
- session
-
the caller’s
BBS::Session, for its window size - terminal
-
the terminal type reported when the other board asks
- petscii
-
whether the other board is to take the caller for a Commodore: no window size, no terminal type
- remote
-
a callable given the bytes (a String) for the other board
- client
-
a callable given the bytes for the caller’s terminal
Public Instance Methods
Source
# File lib/bbs/gateway/negotiation.rb, line 45 def command(command, argument) command == SB ? subnegotiation(argument) : answer(command, argument) end
Answers one command of the other board, as Telnet::Parser gives it: argument is the option, or the bytes of a subnegotiation.
Source
# File lib/bbs/gateway/negotiation.rb, line 51 def window(cols, rows) naws(cols, rows) if @naws nil end
Tells the other board the caller’s new window size, when it asked for it. Returns nil.