diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-10-14 22:27:51 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-10-14 22:27:51 +0000 |
commit | e72d6077b475bc6142afc3b5967db113922c76f5 (patch) | |
tree | 45bdb7b69ec4c1dbcfadc1fa568b1d6b341a6f0f /misc/rfc854-telnet.txt | |
parent | 44eac9521632f8da42f73085db945bdba45f8311 (diff) | |
download | libbu++-e72d6077b475bc6142afc3b5967db113922c76f5.tar.gz libbu++-e72d6077b475bc6142afc3b5967db113922c76f5.tar.bz2 libbu++-e72d6077b475bc6142afc3b5967db113922c76f5.tar.xz libbu++-e72d6077b475bc6142afc3b5967db113922c76f5.zip |
Fixed an interesting ideosyncacy in Bu::Hash in a safe way, I should try to do
this with the Bu::Archive next. Basically, there's one generic template
function that will convert anything that can safely cast to a uint32_t and that
supports direct comparisson, and doesn't have it's own override already to be
a Hash key, such as char, uint8_t, uint64_t, etc.
The Telnet protocol handler does everything I need it too for now, next up for
it is escape sequence handling, it would be nice to make this general too, by
using the termcap database or something, but there is an ANSI/ISO standard now,
I may just go ahead and use that. Also, it looks like it'd be pretty easy to
make the canonical mode editing functions be pluggable to facilitate different
types of editing, but that can be done down the road as well.
Diffstat (limited to '')
-rw-r--r-- | misc/rfc854-telnet.txt | 854 |
1 files changed, 854 insertions, 0 deletions
diff --git a/misc/rfc854-telnet.txt b/misc/rfc854-telnet.txt new file mode 100644 index 0000000..e794bf7 --- /dev/null +++ b/misc/rfc854-telnet.txt | |||
@@ -0,0 +1,854 @@ | |||
1 | |||
2 | Network Working Group J. Postel | ||
3 | Request for Comments: 854 J. Reynolds | ||
4 | ISI | ||
5 | Obsoletes: NIC 18639 May 1983 | ||
6 | |||
7 | TELNET PROTOCOL SPECIFICATION | ||
8 | |||
9 | |||
10 | This RFC specifies a standard for the ARPA Internet community. Hosts on | ||
11 | the ARPA Internet are expected to adopt and implement this standard. | ||
12 | |||
13 | INTRODUCTION | ||
14 | |||
15 | The purpose of the TELNET Protocol is to provide a fairly general, | ||
16 | bi-directional, eight-bit byte oriented communications facility. Its | ||
17 | primary goal is to allow a standard method of interfacing terminal | ||
18 | devices and terminal-oriented processes to each other. It is | ||
19 | envisioned that the protocol may also be used for terminal-terminal | ||
20 | communication ("linking") and process-process communication | ||
21 | (distributed computation). | ||
22 | |||
23 | GENERAL CONSIDERATIONS | ||
24 | |||
25 | A TELNET connection is a Transmission Control Protocol (TCP) | ||
26 | connection used to transmit data with interspersed TELNET control | ||
27 | information. | ||
28 | |||
29 | The TELNET Protocol is built upon three main ideas: first, the | ||
30 | concept of a "Network Virtual Terminal"; second, the principle of | ||
31 | negotiated options; and third, a symmetric view of terminals and | ||
32 | processes. | ||
33 | |||
34 | 1. When a TELNET connection is first established, each end is | ||
35 | assumed to originate and terminate at a "Network Virtual Terminal", | ||
36 | or NVT. An NVT is an imaginary device which provides a standard, | ||
37 | network-wide, intermediate representation of a canonical terminal. | ||
38 | This eliminates the need for "server" and "user" hosts to keep | ||
39 | information about the characteristics of each other's terminals and | ||
40 | terminal handling conventions. All hosts, both user and server, map | ||
41 | their local device characteristics and conventions so as to appear to | ||
42 | be dealing with an NVT over the network, and each can assume a | ||
43 | similar mapping by the other party. The NVT is intended to strike a | ||
44 | balance between being overly restricted (not providing hosts a rich | ||
45 | enough vocabulary for mapping into their local character sets), and | ||
46 | being overly inclusive (penalizing users with modest terminals). | ||
47 | |||
48 | NOTE: The "user" host is the host to which the physical terminal | ||
49 | is normally attached, and the "server" host is the host which is | ||
50 | normally providing some service. As an alternate point of view, | ||
51 | |||
52 | |||
53 | |||
54 | |||
55 | Postel & Reynolds [Page 1] | ||
56 | |||
57 | |||
58 | |||
59 | RFC 854 May 1983 | ||
60 | |||
61 | |||
62 | applicable even in terminal-to-terminal or process-to-process | ||
63 | communications, the "user" host is the host which initiated the | ||
64 | communication. | ||
65 | |||
66 | 2. The principle of negotiated options takes cognizance of the fact | ||
67 | that many hosts will wish to provide additional services over and | ||
68 | above those available within an NVT, and many users will have | ||
69 | sophisticated terminals and would like to have elegant, rather than | ||
70 | minimal, services. Independent of, but structured within the TELNET | ||
71 | Protocol are various "options" that will be sanctioned and may be | ||
72 | used with the "DO, DON'T, WILL, WON'T" structure (discussed below) to | ||
73 | allow a user and server to agree to use a more elaborate (or perhaps | ||
74 | just different) set of conventions for their TELNET connection. Such | ||
75 | options could include changing the character set, the echo mode, etc. | ||
76 | |||
77 | The basic strategy for setting up the use of options is to have | ||
78 | either party (or both) initiate a request that some option take | ||
79 | effect. The other party may then either accept or reject the | ||
80 | request. If the request is accepted the option immediately takes | ||
81 | effect; if it is rejected the associated aspect of the connection | ||
82 | remains as specified for an NVT. Clearly, a party may always refuse | ||
83 | a request to enable, and must never refuse a request to disable some | ||
84 | option since all parties must be prepared to support the NVT. | ||
85 | |||
86 | The syntax of option negotiation has been set up so that if both | ||
87 | parties request an option simultaneously, each will see the other's | ||
88 | request as the positive acknowledgment of its own. | ||
89 | |||
90 | 3. The symmetry of the negotiation syntax can potentially lead to | ||
91 | nonterminating acknowledgment loops -- each party seeing the incoming | ||
92 | commands not as acknowledgments but as new requests which must be | ||
93 | acknowledged. To prevent such loops, the following rules prevail: | ||
94 | |||
95 | a. Parties may only request a change in option status; i.e., a | ||
96 | party may not send out a "request" merely to announce what mode it | ||
97 | is in. | ||
98 | |||
99 | b. If a party receives what appears to be a request to enter some | ||
100 | mode it is already in, the request should not be acknowledged. | ||
101 | This non-response is essential to prevent endless loops in the | ||
102 | negotiation. It is required that a response be sent to requests | ||
103 | for a change of mode -- even if the mode is not changed. | ||
104 | |||
105 | c. Whenever one party sends an option command to a second party, | ||
106 | whether as a request or an acknowledgment, and use of the option | ||
107 | will have any effect on the processing of the data being sent from | ||
108 | the first party to the second, then the command must be inserted | ||
109 | in the data stream at the point where it is desired that it take | ||
110 | |||
111 | |||
112 | Postel & Reynolds [Page 2] | ||
113 | |||
114 | |||
115 | |||
116 | RFC 854 May 1983 | ||
117 | |||
118 | |||
119 | effect. (It should be noted that some time will elapse between | ||
120 | the transmission of a request and the receipt of an | ||
121 | acknowledgment, which may be negative. Thus, a host may wish to | ||
122 | buffer data, after requesting an option, until it learns whether | ||
123 | the request is accepted or rejected, in order to hide the | ||
124 | "uncertainty period" from the user.) | ||
125 | |||
126 | Option requests are likely to flurry back and forth when a TELNET | ||
127 | connection is first established, as each party attempts to get the | ||
128 | best possible service from the other party. Beyond that, however, | ||
129 | options can be used to dynamically modify the characteristics of the | ||
130 | connection to suit changing local conditions. For example, the NVT, | ||
131 | as will be explained later, uses a transmission discipline well | ||
132 | suited to the many "line at a time" applications such as BASIC, but | ||
133 | poorly suited to the many "character at a time" applications such as | ||
134 | NLS. A server might elect to devote the extra processor overhead | ||
135 | required for a "character at a time" discipline when it was suitable | ||
136 | for the local process and would negotiate an appropriate option. | ||
137 | However, rather than then being permanently burdened with the extra | ||
138 | processing overhead, it could switch (i.e., negotiate) back to NVT | ||
139 | when the detailed control was no longer necessary. | ||
140 | |||
141 | It is possible for requests initiated by processes to stimulate a | ||
142 | nonterminating request loop if the process responds to a rejection by | ||
143 | merely re-requesting the option. To prevent such loops from | ||
144 | occurring, rejected requests should not be repeated until something | ||
145 | changes. Operationally, this can mean the process is running a | ||
146 | different program, or the user has given another command, or whatever | ||
147 | makes sense in the context of the given process and the given option. | ||
148 | A good rule of thumb is that a re-request should only occur as a | ||
149 | result of subsequent information from the other end of the connection | ||
150 | or when demanded by local human intervention. | ||
151 | |||
152 | Option designers should not feel constrained by the somewhat limited | ||
153 | syntax available for option negotiation. The intent of the simple | ||
154 | syntax is to make it easy to have options -- since it is | ||
155 | correspondingly easy to profess ignorance about them. If some | ||
156 | particular option requires a richer negotiation structure than | ||
157 | possible within "DO, DON'T, WILL, WON'T", the proper tack is to use | ||
158 | "DO, DON'T, WILL, WON'T" to establish that both parties understand | ||
159 | the option, and once this is accomplished a more exotic syntax can be | ||
160 | used freely. For example, a party might send a request to alter | ||
161 | (establish) line length. If it is accepted, then a different syntax | ||
162 | can be used for actually negotiating the line length -- such a | ||
163 | "sub-negotiation" might include fields for minimum allowable, maximum | ||
164 | allowable and desired line lengths. The important concept is that | ||
165 | |||
166 | |||
167 | |||
168 | |||
169 | Postel & Reynolds [Page 3] | ||
170 | |||
171 | |||
172 | |||
173 | RFC 854 May 1983 | ||
174 | |||
175 | |||
176 | such expanded negotiations should never begin until some prior | ||
177 | (standard) negotiation has established that both parties are capable | ||
178 | of parsing the expanded syntax. | ||
179 | |||
180 | In summary, WILL XXX is sent, by either party, to indicate that | ||
181 | party's desire (offer) to begin performing option XXX, DO XXX and | ||
182 | DON'T XXX being its positive and negative acknowledgments; similarly, | ||
183 | DO XXX is sent to indicate a desire (request) that the other party | ||
184 | (i.e., the recipient of the DO) begin performing option XXX, WILL XXX | ||
185 | and WON'T XXX being the positive and negative acknowledgments. Since | ||
186 | the NVT is what is left when no options are enabled, the DON'T and | ||
187 | WON'T responses are guaranteed to leave the connection in a state | ||
188 | which both ends can handle. Thus, all hosts may implement their | ||
189 | TELNET processes to be totally unaware of options that are not | ||
190 | supported, simply returning a rejection to (i.e., refusing) any | ||
191 | option request that cannot be understood. | ||
192 | |||
193 | As much as possible, the TELNET protocol has been made server-user | ||
194 | symmetrical so that it easily and naturally covers the user-user | ||
195 | (linking) and server-server (cooperating processes) cases. It is | ||
196 | hoped, but not absolutely required, that options will further this | ||
197 | intent. In any case, it is explicitly acknowledged that symmetry is | ||
198 | an operating principle rather than an ironclad rule. | ||
199 | |||
200 | A companion document, "TELNET Option Specifications," should be | ||
201 | consulted for information about the procedure for establishing new | ||
202 | options. | ||
203 | |||
204 | THE NETWORK VIRTUAL TERMINAL | ||
205 | |||
206 | The Network Virtual Terminal (NVT) is a bi-directional character | ||
207 | device. The NVT has a printer and a keyboard. The printer responds | ||
208 | to incoming data and the keyboard produces outgoing data which is | ||
209 | sent over the TELNET connection and, if "echoes" are desired, to the | ||
210 | NVT's printer as well. "Echoes" will not be expected to traverse the | ||
211 | network (although options exist to enable a "remote" echoing mode of | ||
212 | operation, no host is required to implement this option). The code | ||
213 | set is seven-bit USASCII in an eight-bit field, except as modified | ||
214 | herein. Any code conversion and timing considerations are local | ||
215 | problems and do not affect the NVT. | ||
216 | |||
217 | TRANSMISSION OF DATA | ||
218 | |||
219 | Although a TELNET connection through the network is intrinsically | ||
220 | full duplex, the NVT is to be viewed as a half-duplex device | ||
221 | operating in a line-buffered mode. That is, unless and until | ||
222 | |||
223 | |||
224 | |||
225 | |||
226 | Postel & Reynolds [Page 4] | ||
227 | |||
228 | |||
229 | |||
230 | RFC 854 May 1983 | ||
231 | |||
232 | |||
233 | options are negotiated to the contrary, the following default | ||
234 | conditions pertain to the transmission of data over the TELNET | ||
235 | connection: | ||
236 | |||
237 | 1) Insofar as the availability of local buffer space permits, | ||
238 | data should be accumulated in the host where it is generated | ||
239 | until a complete line of data is ready for transmission, or | ||
240 | until some locally-defined explicit signal to transmit occurs. | ||
241 | This signal could be generated either by a process or by a | ||
242 | human user. | ||
243 | |||
244 | The motivation for this rule is the high cost, to some hosts, | ||
245 | of processing network input interrupts, coupled with the | ||
246 | default NVT specification that "echoes" do not traverse the | ||
247 | network. Thus, it is reasonable to buffer some amount of data | ||
248 | at its source. Many systems take some processing action at the | ||
249 | end of each input line (even line printers or card punches | ||
250 | frequently tend to work this way), so the transmission should | ||
251 | be triggered at the end of a line. On the other hand, a user | ||
252 | or process may sometimes find it necessary or desirable to | ||
253 | provide data which does not terminate at the end of a line; | ||
254 | therefore implementers are cautioned to provide methods of | ||
255 | locally signaling that all buffered data should be transmitted | ||
256 | immediately. | ||
257 | |||
258 | 2) When a process has completed sending data to an NVT printer | ||
259 | and has no queued input from the NVT keyboard for further | ||
260 | processing (i.e., when a process at one end of a TELNET | ||
261 | connection cannot proceed without input from the other end), | ||
262 | the process must transmit the TELNET Go Ahead (GA) command. | ||
263 | |||
264 | This rule is not intended to require that the TELNET GA command | ||
265 | be sent from a terminal at the end of each line, since server | ||
266 | hosts do not normally require a special signal (in addition to | ||
267 | end-of-line or other locally-defined characters) in order to | ||
268 | commence processing. Rather, the TELNET GA is designed to help | ||
269 | a user's local host operate a physically half duplex terminal | ||
270 | which has a "lockable" keyboard such as the IBM 2741. A | ||
271 | description of this type of terminal may help to explain the | ||
272 | proper use of the GA command. | ||
273 | |||
274 | The terminal-computer connection is always under control of | ||
275 | either the user or the computer. Neither can unilaterally | ||
276 | seize control from the other; rather the controlling end must | ||
277 | relinguish its control explicitly. At the terminal end, the | ||
278 | hardware is constructed so as to relinquish control each time | ||
279 | that a "line" is terminated (i.e., when the "New Line" key is | ||
280 | typed by the user). When this occurs, the attached (local) | ||
281 | |||
282 | |||
283 | Postel & Reynolds [Page 5] | ||
284 | |||
285 | |||
286 | |||
287 | RFC 854 May 1983 | ||
288 | |||
289 | |||
290 | computer processes the input data, decides if output should be | ||
291 | generated, and if not returns control to the terminal. If | ||
292 | output should be generated, control is retained by the computer | ||
293 | until all output has been transmitted. | ||
294 | |||
295 | The difficulties of using this type of terminal through the | ||
296 | network should be obvious. The "local" computer is no longer | ||
297 | able to decide whether to retain control after seeing an | ||
298 | end-of-line signal or not; this decision can only be made by | ||
299 | the "remote" computer which is processing the data. Therefore, | ||
300 | the TELNET GA command provides a mechanism whereby the "remote" | ||
301 | (server) computer can signal the "local" (user) computer that | ||
302 | it is time to pass control to the user of the terminal. It | ||
303 | should be transmitted at those times, and only at those times, | ||
304 | when the user should be given control of the terminal. Note | ||
305 | that premature transmission of the GA command may result in the | ||
306 | blocking of output, since the user is likely to assume that the | ||
307 | transmitting system has paused, and therefore he will fail to | ||
308 | turn the line around manually. | ||
309 | |||
310 | The foregoing, of course, does not apply to the user-to-server | ||
311 | direction of communication. In this direction, GAs may be sent at | ||
312 | any time, but need not ever be sent. Also, if the TELNET | ||
313 | connection is being used for process-to-process communication, GAs | ||
314 | need not be sent in either direction. Finally, for | ||
315 | terminal-to-terminal communication, GAs may be required in | ||
316 | neither, one, or both directions. If a host plans to support | ||
317 | terminal-to-terminal communication it is suggested that the host | ||
318 | provide the user with a means of manually signaling that it is | ||
319 | time for a GA to be sent over the TELNET connection; this, | ||
320 | however, is not a requirement on the implementer of a TELNET | ||
321 | process. | ||
322 | |||
323 | Note that the symmetry of the TELNET model requires that there is | ||
324 | an NVT at each end of the TELNET connection, at least | ||
325 | conceptually. | ||
326 | |||
327 | STANDARD REPRESENTATION OF CONTROL FUNCTIONS | ||
328 | |||
329 | As stated in the Introduction to this document, the primary goal | ||
330 | of the TELNET protocol is the provision of a standard interfacing | ||
331 | of terminal devices and terminal-oriented processes through the | ||
332 | network. Early experiences with this type of interconnection have | ||
333 | shown that certain functions are implemented by most servers, but | ||
334 | that the methods of invoking these functions differ widely. For a | ||
335 | human user who interacts with several server systems, these | ||
336 | differences are highly frustrating. TELNET, therefore, defines a | ||
337 | standard representation for five of these functions, as described | ||
338 | |||
339 | |||
340 | Postel & Reynolds [Page 6] | ||
341 | |||
342 | |||
343 | |||
344 | RFC 854 May 1983 | ||
345 | |||
346 | |||
347 | below. These standard representations have standard, but not | ||
348 | required, meanings (with the exception that the Interrupt Process | ||
349 | (IP) function may be required by other protocols which use | ||
350 | TELNET); that is, a system which does not provide the function to | ||
351 | local users need not provide it to network users and may treat the | ||
352 | standard representation for the function as a No-operation. On | ||
353 | the other hand, a system which does provide the function to a | ||
354 | local user is obliged to provide the same function to a network | ||
355 | user who transmits the standard representation for the function. | ||
356 | |||
357 | Interrupt Process (IP) | ||
358 | |||
359 | Many systems provide a function which suspends, interrupts, | ||
360 | aborts, or terminates the operation of a user process. This | ||
361 | function is frequently used when a user believes his process is | ||
362 | in an unending loop, or when an unwanted process has been | ||
363 | inadvertently activated. IP is the standard representation for | ||
364 | invoking this function. It should be noted by implementers | ||
365 | that IP may be required by other protocols which use TELNET, | ||
366 | and therefore should be implemented if these other protocols | ||
367 | are to be supported. | ||
368 | |||
369 | Abort Output (AO) | ||
370 | |||
371 | Many systems provide a function which allows a process, which | ||
372 | is generating output, to run to completion (or to reach the | ||
373 | same stopping point it would reach if running to completion) | ||
374 | but without sending the output to the user's terminal. | ||
375 | Further, this function typically clears any output already | ||
376 | produced but not yet actually printed (or displayed) on the | ||
377 | user's terminal. AO is the standard representation for | ||
378 | invoking this function. For example, some subsystem might | ||
379 | normally accept a user's command, send a long text string to | ||
380 | the user's terminal in response, and finally signal readiness | ||
381 | to accept the next command by sending a "prompt" character | ||
382 | (preceded by <CR><LF>) to the user's terminal. If the AO were | ||
383 | received during the transmission of the text string, a | ||
384 | reasonable implementation would be to suppress the remainder of | ||
385 | the text string, but transmit the prompt character and the | ||
386 | preceding <CR><LF>. (This is possibly in distinction to the | ||
387 | action which might be taken if an IP were received; the IP | ||
388 | might cause suppression of the text string and an exit from the | ||
389 | subsystem.) | ||
390 | |||
391 | It should be noted, by server systems which provide this | ||
392 | function, that there may be buffers external to the system (in | ||
393 | |||
394 | |||
395 | |||
396 | |||
397 | Postel & Reynolds [Page 7] | ||
398 | |||
399 | |||
400 | |||
401 | RFC 854 May 1983 | ||
402 | |||
403 | |||
404 | the network and the user's local host) which should be cleared; | ||
405 | the appropriate way to do this is to transmit the "Synch" | ||
406 | signal (described below) to the user system. | ||
407 | |||
408 | Are You There (AYT) | ||
409 | |||
410 | Many systems provide a function which provides the user with | ||
411 | some visible (e.g., printable) evidence that the system is | ||
412 | still up and running. This function may be invoked by the user | ||
413 | when the system is unexpectedly "silent" for a long time, | ||
414 | because of the unanticipated (by the user) length of a | ||
415 | computation, an unusually heavy system load, etc. AYT is the | ||
416 | standard representation for invoking this function. | ||
417 | |||
418 | Erase Character (EC) | ||
419 | |||
420 | Many systems provide a function which deletes the last | ||
421 | preceding undeleted character or "print position"* from the | ||
422 | stream of data being supplied by the user. This function is | ||
423 | typically used to edit keyboard input when typing mistakes are | ||
424 | made. EC is the standard representation for invoking this | ||
425 | function. | ||
426 | |||
427 | *NOTE: A "print position" may contain several characters | ||
428 | which are the result of overstrikes, or of sequences such as | ||
429 | <char1> BS <char2>... | ||
430 | |||
431 | Erase Line (EL) | ||
432 | |||
433 | Many systems provide a function which deletes all the data in | ||
434 | the current "line" of input. This function is typically used | ||
435 | to edit keyboard input. EL is the standard representation for | ||
436 | invoking this function. | ||
437 | |||
438 | THE TELNET "SYNCH" SIGNAL | ||
439 | |||
440 | Most time-sharing systems provide mechanisms which allow a | ||
441 | terminal user to regain control of a "runaway" process; the IP and | ||
442 | AO functions described above are examples of these mechanisms. | ||
443 | Such systems, when used locally, have access to all of the signals | ||
444 | supplied by the user, whether these are normal characters or | ||
445 | special "out of band" signals such as those supplied by the | ||
446 | teletype "BREAK" key or the IBM 2741 "ATTN" key. This is not | ||
447 | necessarily true when terminals are connected to the system | ||
448 | through the network; the network's flow control mechanisms may | ||
449 | cause such a signal to be buffered elsewhere, for example in the | ||
450 | user's host. | ||
451 | |||
452 | |||
453 | |||
454 | Postel & Reynolds [Page 8] | ||
455 | |||
456 | |||
457 | |||
458 | RFC 854 May 1983 | ||
459 | |||
460 | |||
461 | To counter this problem, the TELNET "Synch" mechanism is | ||
462 | introduced. A Synch signal consists of a TCP Urgent notification, | ||
463 | coupled with the TELNET command DATA MARK. The Urgent | ||
464 | notification, which is not subject to the flow control pertaining | ||
465 | to the TELNET connection, is used to invoke special handling of | ||
466 | the data stream by the process which receives it. In this mode, | ||
467 | the data stream is immediately scanned for "interesting" signals | ||
468 | as defined below, discarding intervening data. The TELNET command | ||
469 | DATA MARK (DM) is the synchronizing mark in the data stream which | ||
470 | indicates that any special signal has already occurred and the | ||
471 | recipient can return to normal processing of the data stream. | ||
472 | |||
473 | The Synch is sent via the TCP send operation with the Urgent | ||
474 | flag set and the DM as the last (or only) data octet. | ||
475 | |||
476 | When several Synchs are sent in rapid succession, the Urgent | ||
477 | notifications may be merged. It is not possible to count Urgents | ||
478 | since the number received will be less than or equal the number | ||
479 | sent. When in normal mode, a DM is a no operation; when in urgent | ||
480 | mode, it signals the end of the urgent processing. | ||
481 | |||
482 | If TCP indicates the end of Urgent data before the DM is found, | ||
483 | TELNET should continue the special handling of the data stream | ||
484 | until the DM is found. | ||
485 | |||
486 | If TCP indicates more Urgent data after the DM is found, it can | ||
487 | only be because of a subsequent Synch. TELNET should continue | ||
488 | the special handling of the data stream until another DM is | ||
489 | found. | ||
490 | |||
491 | "Interesting" signals are defined to be: the TELNET standard | ||
492 | representations of IP, AO, and AYT (but not EC or EL); the local | ||
493 | analogs of these standard representations (if any); all other | ||
494 | TELNET commands; other site-defined signals which can be acted on | ||
495 | without delaying the scan of the data stream. | ||
496 | |||
497 | Since one effect of the SYNCH mechanism is the discarding of | ||
498 | essentially all characters (except TELNET commands) between the | ||
499 | sender of the Synch and its recipient, this mechanism is specified | ||
500 | as the standard way to clear the data path when that is desired. | ||
501 | For example, if a user at a terminal causes an AO to be | ||
502 | transmitted, the server which receives the AO (if it provides that | ||
503 | function at all) should return a Synch to the user. | ||
504 | |||
505 | Finally, just as the TCP Urgent notification is needed at the | ||
506 | TELNET level as an out-of-band signal, so other protocols which | ||
507 | make use of TELNET may require a TELNET command which can be | ||
508 | viewed as an out-of-band signal at a different level. | ||
509 | |||
510 | |||
511 | Postel & Reynolds [Page 9] | ||
512 | |||
513 | |||
514 | |||
515 | RFC 854 May 1983 | ||
516 | |||
517 | |||
518 | By convention the sequence [IP, Synch] is to be used as such a | ||
519 | signal. For example, suppose that some other protocol, which uses | ||
520 | TELNET, defines the character string STOP analogously to the | ||
521 | TELNET command AO. Imagine that a user of this protocol wishes a | ||
522 | server to process the STOP string, but the connection is blocked | ||
523 | because the server is processing other commands. The user should | ||
524 | instruct his system to: | ||
525 | |||
526 | 1. Send the TELNET IP character; | ||
527 | |||
528 | 2. Send the TELNET SYNC sequence, that is: | ||
529 | |||
530 | Send the Data Mark (DM) as the only character | ||
531 | in a TCP urgent mode send operation. | ||
532 | |||
533 | 3. Send the character string STOP; and | ||
534 | |||
535 | 4. Send the other protocol's analog of the TELNET DM, if any. | ||
536 | |||
537 | The user (or process acting on his behalf) must transmit the | ||
538 | TELNET SYNCH sequence of step 2 above to ensure that the TELNET IP | ||
539 | gets through to the server's TELNET interpreter. | ||
540 | |||
541 | The Urgent should wake up the TELNET process; the IP should | ||
542 | wake up the next higher level process. | ||
543 | |||
544 | THE NVT PRINTER AND KEYBOARD | ||
545 | |||
546 | The NVT printer has an unspecified carriage width and page length | ||
547 | and can produce representations of all 95 USASCII graphics (codes | ||
548 | 32 through 126). Of the 33 USASCII control codes (0 through 31 | ||
549 | and 127), and the 128 uncovered codes (128 through 255), the | ||
550 | following have specified meaning to the NVT printer: | ||
551 | |||
552 | NAME CODE MEANING | ||
553 | |||
554 | NULL (NUL) 0 No Operation | ||
555 | Line Feed (LF) 10 Moves the printer to the | ||
556 | next print line, keeping the | ||
557 | same horizontal position. | ||
558 | Carriage Return (CR) 13 Moves the printer to the left | ||
559 | margin of the current line. | ||
560 | |||
561 | |||
562 | |||
563 | |||
564 | |||
565 | |||
566 | |||
567 | |||
568 | Postel & Reynolds [Page 10] | ||
569 | |||
570 | |||
571 | |||
572 | RFC 854 May 1983 | ||
573 | |||
574 | |||
575 | In addition, the following codes shall have defined, but not | ||
576 | required, effects on the NVT printer. Neither end of a TELNET | ||
577 | connection may assume that the other party will take, or will | ||
578 | have taken, any particular action upon receipt or transmission | ||
579 | of these: | ||
580 | |||
581 | BELL (BEL) 7 Produces an audible or | ||
582 | visible signal (which does | ||
583 | NOT move the print head). | ||
584 | Back Space (BS) 8 Moves the print head one | ||
585 | character position towards | ||
586 | the left margin. | ||
587 | Horizontal Tab (HT) 9 Moves the printer to the | ||
588 | next horizontal tab stop. | ||
589 | It remains unspecified how | ||
590 | either party determines or | ||
591 | establishes where such tab | ||
592 | stops are located. | ||
593 | Vertical Tab (VT) 11 Moves the printer to the | ||
594 | next vertical tab stop. It | ||
595 | remains unspecified how | ||
596 | either party determines or | ||
597 | establishes where such tab | ||
598 | stops are located. | ||
599 | Form Feed (FF) 12 Moves the printer to the top | ||
600 | of the next page, keeping | ||
601 | the same horizontal position. | ||
602 | |||
603 | All remaining codes do not cause the NVT printer to take any | ||
604 | action. | ||
605 | |||
606 | The sequence "CR LF", as defined, will cause the NVT to be | ||
607 | positioned at the left margin of the next print line (as would, | ||
608 | for example, the sequence "LF CR"). However, many systems and | ||
609 | terminals do not treat CR and LF independently, and will have to | ||
610 | go to some effort to simulate their effect. (For example, some | ||
611 | terminals do not have a CR independent of the LF, but on such | ||
612 | terminals it may be possible to simulate a CR by backspacing.) | ||
613 | Therefore, the sequence "CR LF" must be treated as a single "new | ||
614 | line" character and used whenever their combined action is | ||
615 | intended; the sequence "CR NUL" must be used where a carriage | ||
616 | return alone is actually desired; and the CR character must be | ||
617 | avoided in other contexts. This rule gives assurance to systems | ||
618 | which must decide whether to perform a "new line" function or a | ||
619 | multiple-backspace that the TELNET stream contains a character | ||
620 | following a CR that will allow a rational decision. | ||
621 | |||
622 | Note that "CR LF" or "CR NUL" is required in both directions | ||
623 | |||
624 | |||
625 | Postel & Reynolds [Page 11] | ||
626 | |||
627 | |||
628 | |||
629 | RFC 854 May 1983 | ||
630 | |||
631 | |||
632 | (in the default ASCII mode), to preserve the symmetry of the | ||
633 | NVT model. Even though it may be known in some situations | ||
634 | (e.g., with remote echo and suppress go ahead options in | ||
635 | effect) that characters are not being sent to an actual | ||
636 | printer, nonetheless, for the sake of consistency, the protocol | ||
637 | requires that a NUL be inserted following a CR not followed by | ||
638 | a LF in the data stream. The converse of this is that a NUL | ||
639 | received in the data stream after a CR (in the absence of | ||
640 | options negotiations which explicitly specify otherwise) should | ||
641 | be stripped out prior to applying the NVT to local character | ||
642 | set mapping. | ||
643 | |||
644 | The NVT keyboard has keys, or key combinations, or key sequences, | ||
645 | for generating all 128 USASCII codes. Note that although many | ||
646 | have no effect on the NVT printer, the NVT keyboard is capable of | ||
647 | generating them. | ||
648 | |||
649 | In addition to these codes, the NVT keyboard shall be capable of | ||
650 | generating the following additional codes which, except as noted, | ||
651 | have defined, but not reguired, meanings. The actual code | ||
652 | assignments for these "characters" are in the TELNET Command | ||
653 | section, because they are viewed as being, in some sense, generic | ||
654 | and should be available even when the data stream is interpreted | ||
655 | as being some other character set. | ||
656 | |||
657 | Synch | ||
658 | |||
659 | This key allows the user to clear his data path to the other | ||
660 | party. The activation of this key causes a DM (see command | ||
661 | section) to be sent in the data stream and a TCP Urgent | ||
662 | notification is associated with it. The pair DM-Urgent is to | ||
663 | have required meaning as defined previously. | ||
664 | |||
665 | Break (BRK) | ||
666 | |||
667 | This code is provided because it is a signal outside the | ||
668 | USASCII set which is currently given local meaning within many | ||
669 | systems. It is intended to indicate that the Break Key or the | ||
670 | Attention Key was hit. Note, however, that this is intended to | ||
671 | provide a 129th code for systems which require it, not as a | ||
672 | synonym for the IP standard representation. | ||
673 | |||
674 | Interrupt Process (IP) | ||
675 | |||
676 | Suspend, interrupt, abort or terminate the process to which the | ||
677 | NVT is connected. Also, part of the out-of-band signal for | ||
678 | other protocols which use TELNET. | ||
679 | |||
680 | |||
681 | |||
682 | Postel & Reynolds [Page 12] | ||
683 | |||
684 | |||
685 | |||
686 | RFC 854 May 1983 | ||
687 | |||
688 | |||
689 | Abort Output (AO) | ||
690 | |||
691 | Allow the current process to (appear to) run to completion, but | ||
692 | do not send its output to the user. Also, send a Synch to the | ||
693 | user. | ||
694 | |||
695 | Are You There (AYT) | ||
696 | |||
697 | Send back to the NVT some visible (i.e., printable) evidence | ||
698 | that the AYT was received. | ||
699 | |||
700 | Erase Character (EC) | ||
701 | |||
702 | The recipient should delete the last preceding undeleted | ||
703 | character or "print position" from the data stream. | ||
704 | |||
705 | Erase Line (EL) | ||
706 | |||
707 | The recipient should delete characters from the data stream | ||
708 | back to, but not including, the last "CR LF" sequence sent over | ||
709 | the TELNET connection. | ||
710 | |||
711 | The spirit of these "extra" keys, and also the printer format | ||
712 | effectors, is that they should represent a natural extension of | ||
713 | the mapping that already must be done from "NVT" into "local". | ||
714 | Just as the NVT data byte 68 (104 octal) should be mapped into | ||
715 | whatever the local code for "uppercase D" is, so the EC character | ||
716 | should be mapped into whatever the local "Erase Character" | ||
717 | function is. Further, just as the mapping for 124 (174 octal) is | ||
718 | somewhat arbitrary in an environment that has no "vertical bar" | ||
719 | character, the EL character may have a somewhat arbitrary mapping | ||
720 | (or none at all) if there is no local "Erase Line" facility. | ||
721 | Similarly for format effectors: if the terminal actually does | ||
722 | have a "Vertical Tab", then the mapping for VT is obvious, and | ||
723 | only when the terminal does not have a vertical tab should the | ||
724 | effect of VT be unpredictable. | ||
725 | |||
726 | TELNET COMMAND STRUCTURE | ||
727 | |||
728 | All TELNET commands consist of at least a two byte sequence: the | ||
729 | "Interpret as Command" (IAC) escape character followed by the code | ||
730 | for the command. The commands dealing with option negotiation are | ||
731 | three byte sequences, the third byte being the code for the option | ||
732 | referenced. This format was chosen so that as more comprehensive use | ||
733 | of the "data space" is made -- by negotiations from the basic NVT, of | ||
734 | course -- collisions of data bytes with reserved command values will | ||
735 | be minimized, all such collisions requiring the inconvenience, and | ||
736 | |||
737 | |||
738 | |||
739 | Postel & Reynolds [Page 13] | ||
740 | |||
741 | |||
742 | |||
743 | RFC 854 May 1983 | ||
744 | |||
745 | |||
746 | inefficiency, of "escaping" the data bytes into the stream. With the | ||
747 | current set-up, only the IAC need be doubled to be sent as data, and | ||
748 | the other 255 codes may be passed transparently. | ||
749 | |||
750 | The following are the defined TELNET commands. Note that these codes | ||
751 | and code sequences have the indicated meaning only when immediately | ||
752 | preceded by an IAC. | ||
753 | |||
754 | NAME CODE MEANING | ||
755 | |||
756 | SE 240 End of subnegotiation parameters. | ||
757 | NOP 241 No operation. | ||
758 | Data Mark 242 The data stream portion of a Synch. | ||
759 | This should always be accompanied | ||
760 | by a TCP Urgent notification. | ||
761 | Break 243 NVT character BRK. | ||
762 | Interrupt Process 244 The function IP. | ||
763 | Abort output 245 The function AO. | ||
764 | Are You There 246 The function AYT. | ||
765 | Erase character 247 The function EC. | ||
766 | Erase Line 248 The function EL. | ||
767 | Go ahead 249 The GA signal. | ||
768 | SB 250 Indicates that what follows is | ||
769 | subnegotiation of the indicated | ||
770 | option. | ||
771 | WILL (option code) 251 Indicates the desire to begin | ||
772 | performing, or confirmation that | ||
773 | you are now performing, the | ||
774 | indicated option. | ||
775 | WON'T (option code) 252 Indicates the refusal to perform, | ||
776 | or continue performing, the | ||
777 | indicated option. | ||
778 | DO (option code) 253 Indicates the request that the | ||
779 | other party perform, or | ||
780 | confirmation that you are expecting | ||
781 | the other party to perform, the | ||
782 | indicated option. | ||
783 | DON'T (option code) 254 Indicates the demand that the | ||
784 | other party stop performing, | ||
785 | or confirmation that you are no | ||
786 | longer expecting the other party | ||
787 | to perform, the indicated option. | ||
788 | IAC 255 Data Byte 255. | ||
789 | |||
790 | |||
791 | |||
792 | |||
793 | |||
794 | |||
795 | |||
796 | Postel & Reynolds [Page 14] | ||
797 | |||
798 | |||
799 | |||
800 | RFC 854 May 1983 | ||
801 | |||
802 | |||
803 | CONNECTION ESTABLISHMENT | ||
804 | |||
805 | The TELNET TCP connection is established between the user's port U | ||
806 | and the server's port L. The server listens on its well known port L | ||
807 | for such connections. Since a TCP connection is full duplex and | ||
808 | identified by the pair of ports, the server can engage in many | ||
809 | simultaneous connections involving its port L and different user | ||
810 | ports U. | ||
811 | |||
812 | Port Assignment | ||
813 | |||
814 | When used for remote user access to service hosts (i.e., remote | ||
815 | terminal access) this protocol is assigned server port 23 | ||
816 | (27 octal). That is L=23. | ||
817 | |||
818 | |||
819 | |||
820 | |||
821 | |||
822 | |||
823 | |||
824 | |||
825 | |||
826 | |||
827 | |||
828 | |||
829 | |||
830 | |||
831 | |||
832 | |||
833 | |||
834 | |||
835 | |||
836 | |||
837 | |||
838 | |||
839 | |||
840 | |||
841 | |||
842 | |||
843 | |||
844 | |||
845 | |||
846 | |||
847 | |||
848 | |||
849 | |||
850 | |||
851 | |||
852 | |||
853 | Postel & Reynolds [Page 15] | ||
854 | |||