Description
(This description is written in terms of the TIP which, of course, embodies a User TELNET.)
Remote Controlled Echoing is an attempt to remove the echo responsibility from the Terminal Handler and push it off into the TIP; wakeup processing is still handled at the server. The process' interface (system calls, etc.) to the server's Terminal Handler need not change, but the (abbreviated) Terminal Handler (actually a Server TELNET) must find a way to relay the process' echo requirements to the TIP. It does this with TELNET commands and control information. System calls and echo parameters (break classes, etc.) peculiar to a particular serving Host must be interpreted by the Server Telnet commands.
Character Flow
Refer to figure 1. A character received from a full-duplex terminal will be converted to its NVT equivalent and placed in both the transmission AND the input buffers. The TIP's transmission strategy determines when it will be removed from the transmission buffer; the server's RCE control commands dictate when it will be removed from the input buffer.
A character received from the server will be placed in the output buffer.
Of the three labeled paths DISCARD, ECHO and OUTPUT, exactly one is enabled at all times. RCE commands dictate which one. Thus characters may
- (DISCARD:) be removed in sequence from the input buffer and discarded,
- (ECHO:) be removed in sequence from the input buffer and placed in the print buffer, of
- (OUTPUT:) be removed in sequence from the output buffer and placed in the print buffer.
From the print buffer they will be converted from NVT characters and be immediately send to the terminal's printer.
+----------------------+
| Terminal Keyboard |
+----------------------+
|
Convert to NVT characters
To +-------------------+ |
Server <----|Transmission Buffer| |
+-------------------+ | +-----From Server
^ | |
|------------------+ |
V V
+-----------------+ +-----------------+
| Input Buffer | | Output Buffer |
+-----------------+ +-----------------+
| | |
DISCARD | +--ECHO---+ +---+ OUTPUT
| | |
V V V
To +----------------------+
Oblivion | Print Buffer |
+----------------------+
|
Convert from
NVT Characters
|
V
To Terminal Printer
Figure 1. Character Flow within the TIP
Commands: Server to Host
The following are the proposed TELNET commands sent by the server process to the TIP. Commands (2) thru (5) should not be sent if RCE is not being used.
-
Use Remote Controlled Echoing. The server asks the TIP to employ the echo strategy described in this document. The TIP can respond either YES (I will use it) or NO. (It is suggested that the response YES also be "Use RCE" to eliminate race conditions.)
-
Set Break Action. This is actually 2 commands. The server can set the break action to echo or not echo a break character.
-
Set Break Classes. This command specifies those equivalence classes which are to be considered break classes. It will be a two (8-bit) byte command.
Note: The envisioned implementation requires the TIP to have a table with one entry per ASCII character. Each entry is formatted with one bit position for each equivalence class, and a bit is set or reset according as the given character is or is not a member of that class. The server sends a "Set Break Classes" command (1st byte) followed by a formatted control word (2nd byte) to the TIP with bit positions set for those equivalence classes which represent break classes for the server process.
When a (virtual) character is taken from the input buffer the TIP does a table look-up indexed by the character. If a simple ANDing of the table entry with the terminal's control word yields a non-zero result, a break was received. (Receipt of a break character enables the OUTPUT path.)
-
Move to Break (MTB). This command directs the TIP to move characters in sequence from the input buffer to the print buffer until a break character is encountered. The break character will be moved or discarded depending on the previously-specified break action. (Essentially, MTB enables the ECHO path.)
-
Delete to Break (DTB). This command directs the TIP to move characters in sequence from the input buffer and discard them until a break character is encountered. The break character will also be discarded. This provides a convenient mechanism for hiding a user's input. (DTB enables the DISCARD path.)
Commands: User to Server
The USER may send (via TIP) a request to the server process requesting that it "Use Remote Controlled Echoing" to which the server must respond "YES" or "NO".
General Operation
Very simply, the Remote Controlled Echoing strategy works as follows: The Server TELNET will tell the TIP to (essentially)
- echo a message,
- print the process' response to that message,
- echo the next message
- print the response to that message
. . .
etc., to effect an orderly listing of inputs and responses much as would be imposed when using a half-duplex device.
The actual interaction depends on the control commands. When a terminal-serving process is invoked on behalf of a TIP user, the Server TELNET will send the "Use RCE" command; the TIP will respond "YES". Then the Server TELNET will send the "Set Break Action" and "Set Break Classes" commands to properly reflect the break strategy requested by the terminal-serving process. Lastly the Server TELNET will send an MTB command. This enables the ECHO path.
The TIP removes characters from the input buffer and places them in the print buffer. When it encounters a break character, it performs the break action specified, and enables the OUTPUT path.
Characters are then moved in sequence from the output buffer to the print buffer. When an MTB (or, DTB) is encountered, it is discarded and the ECHO (DISCARD) path is enabled.
Etcetera.
The Server TELNET may change the break action or break classes after an interaction, but should normally do so prior to sending the MTB or DTB commands. It should only send an MTB (DTB) after all process output from the previous message has been sent.
Why Does This Work?
The RCE strategy described above produces the correct result at the user's terminal because it is in essence the same scheme used by the Terminal Handler which normally provides the echoing at the serving site. Initially, the characters are echoed as they are typed; then a break character is keyed, echoing is suspended. If the process produces any output response, it is printed before echoing of subsequent input.
Echoing of the next command begins, if there is type-ahead, with the characters in the input buffer, and even if the input buffer is emptied immediate echoing of keyed input from the terminal is provided since the ECHO path remains enabled up to a break.
An Example
(In the following, we assume all break characters are also wakeup characters and (carelessly) treat the two interchangeably.)
Suppose a TIP user attempts to login to a remote server with the properly formatted message
LOG NAME PASSWORD [CR]
and that the Server TELNET has requested the use of RCE. Presuming that the break (and wakeup) characters sets are appropriately defined to include space and CR (and that the break action specifies they should be echoed), the primary sequence of RCE commands which will drive the TIP to produce the correct printout at the user's terminal is:
- MTB (to print "LOG "), and since the space is a break character,
- MTB (to print "NAME "),
- DTB (to delete "PASSWORD [CR]" (See section VI, number 11)), and perhaps a message followed by
- MTB (to reenable the echo path).
We investigate in some detail how interaction at the process/Server TELNET interface causes these commands to be send to the TIP.
When the EXEC is invoked, it issues a system call to set its break classes. The Server TELNET interprets the system call in terms of the classes supported by RCE, and sends the appropriate two-byte "Set Break Classes" (SBC) command to the TIP. A space is among the characters of the break set.
The EXEC asks for input, so the Server TELNET send MTB ((1) above). We presume the EXEC blocks until some input is available.
The EXEC is awakened when the first space arrives; it recognizes the LOG command to be a call upon the LOGIN subsystem which it (promptly!) invokes.
The LOGIN process issues a system call to set its break classes (this time both space and CR are included, and, as before, the Server TELNET forwards the command as an SBC). Then it asks for input (so the Server TELNET sends MTB ((2) above)), and blocks until the second space arrives.
When the LOGIN process has verified the existence of a user with name NAME, it issues a system call to suppress printing of the next parameter (the password). In compliance, the Server TELNET sends DTB ((3) above).
Once the password has been examined and verified, a message like
[CR][LF] LOGIN COMPLETED [CR][LF]
can be sent, followed by a request for input. The Server TELNET thus forwards an MTB ((4) above) and the sequence is completed.
Another example
Suppose in the above example the user had typed
LOG NAME[CR]
When the LOGIN process regained control, it would have noted that the break was a CR instead of a space. It then could have issued
[LF]password =
which the Server TELNET would follow (when LOGIN requests print suppression) with DTB. When the TIP had finished its output, the DISCARD path would be enabled and the user's terminal would have printed:
LOG NAME[CR]
password =
^
with the cursor positioned just after the =. The TIP will hide the characters of the password.
Another Example
Suppose a user were using a text editor, TEXT, to create a source file of English sentences. The TEXT subprocess might allow only non-formatting control characters (e.g., "Control-C") as break characters. The RCE strategy would allow the user to receive immediate echoing for all his input until he typed such a control character.