~~NOTOC~~ ====== Telnet IAC Protocol ====== Oddly, one of the oldest Internet protocols goes misunderstood. The Internet took a different approach to specifying session settings. IAC (Interpret As Command) is a 3 byte pattern from Client to Server and/or Server to Client. This allows a form of handshake, usually established at the start of a new connection ~ but it is not limited to the start, changes can be implemented on the fly. {{ :telnet2.gif |}} __Terms__ NVT (Network Virtual Terminal) is an imaginary device which provides a standard, network-wide, intermediate representation of a canonical terminal. This eliminates the need for "server" and "user" hosts to keep information about the characteristics of each other's terminals and terminal handling conventions. All hosts, both user and server, map their local device characteristics and conventions so as to appear to be dealing with an NVT over the network, and each can assume a similar mapping by the other party. The NVT is intended to strike a balance between being overly restricted (not providing hosts a rich enough vocabulary for mapping into their local character sets), and being overly inclusive (penalizing users with modest terminals). TCP (Transmission Control Protocol) is the type of connection used to transmit data with interspersed TELNET control information. IAC has a lead byte of 255 aka 0xFF in C hex notation. The second byte of the 3 byte pattern denotes WILL, DO, WON'T and DON'T. ^ COMMAND ^ DECIMAL ^ HEX ^ DESCRIPTION | ^ WILL | 251 | 0xFB | Sender wants to do something. | ^ DO | 252 | 0xFC | Sender wants the other end to do something. | ^ WONT | 253 | 0xFD | Sender doesn't want to do something. | ^ DONT | 254 | 0xFE | Sender wants the other not to do something. | For example, if the server (or BBS in this case) wants the client to go to CHAR-BY-CHAR mode, it would send 0xFF 0xFB 0x03 (see below for 0x03) and expects the client (Terminal) to response 0xFF 0xFC 0x03. So, if you understand the commands, now you need to know the expected responses. ===== Responses ===== ^ SENDER\\ SENDS ^ RECEIVER\\ RESPONSES ^ \\ DESCRIPTION | ^ WILL ^ DO | The sender would like to use a certain facility. If the receiver\\ can handle the request it will DO it. //Option is now in effect.// | ^ WILL ^ DONT | In this scenario the receiver says it cannot support the option.\\ //Option is **not** in effect.// | ^ DO ^ WILL | The sender says it can handle traffic from the sender if\\ the sender wishes to use a certain option. //Option is now in effect.// | ^ DO ^ WONT | Receiver says it cannot support the option.\\ //Option is **not** in effect.// | ^ WONT ^ DONT | Option is disabled. DONT is the only valid response. | ^ DONT ^ WONT | Option is disabled. WONT is the only valid response. | ===== Some Options ===== ((RFC1060)) ^ DECIMAL ^ HEX ^ DESCRIPTION | ^ 0 ^ 0x00 | Binary Transmission | ^ 1 ^ 0x01 | Echo | ^ 2 ^ 0x02 | Reconnection | ^ 3 ^ 0x03 | Suppress Go Ahead | ^ 4 ^ 0x04 | Approximate Message Size Negotiation | ^ 5 ^ 0x05 | Status | ^ 6 ^ 0x06 | Timing Mark | ^ 7 ^ 0x07 | Remote Controlled Transmission and Echo | ^ 8 ^ 0x08 | Output Line Width | ^ 9 ^ 0x09 | Output Page Size (Height/Lines) | ^ 10 ^ 0x0A | Output Carriage-Return Disposition | ^ 11 ^ 0x0B | Output Horizontal Tab Stop | ^ 12 ^ 0x0C | Output Horizontal Tab Disposition | ^ 13 ^ 0x0D | Output Formfeed Disposition | ^ 14 ^ 0x0E | Output Vertical Tab Stop | ^ 15 ^ 0x0F | Output Vertical Tab Disposition | ^ 16 ^ 0x10 | Output Linefeed Disposition | ^ 17 ^ 0x11 | Extended ASCII | ^ 18 ^ 0x12 | Logout | ^ 19 ^ 0x13 | Byte Macro | ^ 20 ^ 0x14 | Data Entry Terminal | ^ 21 ^ 0x15 | SUPDUP | ^ 22 ^ 0x16 | SUPDUP Output | ^ 23 ^ 0x17 | Send Location | ^ 24 ^ 0x18 | Terminal Type | ^ 25 ^ 0x19 | End of Record | ^ 26 ^ 0x1A | TACACS User Identification | ^ 27 ^ 0x1B | Output Marking | ^ 28 ^ 0x1C | Terminal Location Number | ^ 29 ^ 0x1D | Telnet 3270 Regime | ^ 30 ^ 0x1E | X.3 PAD | ^ 31 ^ 0x1F | Window Size (NAWS) | ^ 32 ^ 0x20 | Terminal Speed | ^ 33 ^ 0x21 | Remote Flow Control | ^ 34 ^ 0x22 | Line Mode | ^ 35 ^ 0x23 | X Display Location | ^ 36 ^ 0x24 | Environment Variables | ^ 37 ^ 0x25 | Authentication | ^ 38 ^ 0x26 | Encryption Option | ^ 39 ^ 0x27 | Authentication | ^ 40 ^ 0x28 | TN3270E | ^ 41 ^ 0x29 | XAUTH | ^ 42 ^ 0x30 | CHARSET | ^ 43 ^ 0x31 | RSP Telnet Remote Serial Port | ^ 44 ^ 0x32 | Comport Control | ^ 45 ^ 0x33 | Telnet Suppress Local Echo | ^ 46 ^ 0x34 | Telnet Start TLS | ^ 47 ^ 0x35 | KERMIT | ^ 48 ^ 0x36 | Send-URL | ^ 49 ^ 0x37 | Forward_X | ^ 138 ^ 0x8A | TELOPT PRAGMA LOGON | ^ 139 ^ 0x8B | TELOPT SSPI LOGON | ^ 140 ^ 0x8C | TELOPT PRAGMA HEARTBEAT | ^ 255 ^ 0xFF | Extended Options List | ==== Additional IAC Codes ==== ^ COMMAND ^ DECIMAL ^ HEX ^ DESCRIPTION | ^ SB | 250 | 0xFA | Indicates that what follows is sub-negotiation of the indicated option. | ^ GA | 249 | 0xF9 | The Go Ahead Signal | ^ EL | 248 | 0xF8 | The Erase Line Function | ^ EC | 247 | 0xF7 | The Erase Character Function | ^ AYT | 246 | 0xF6 | The Are You There Function | ^ AO | 245 | 0xF5 | The Abort Output Function | ^ IP | 244 | 0xF4 | The Interrupt Process Function | ^ BRK | 243 | 0xF3 | The NVT Character Break Function | ^ DM | 242 | 0xF2 | The data stream portion of a Synch. This should always be\\ accompanied by a TCP Urgent notification. | ^ NOP | 241 | 0xF1 | No Operation. (Sometimes used as a heartbeat). | ^ SE | 240 | 0xF0 | End of sub-negotiation parameters. | === Interrupt Process (IP) === Many systems provide a function which suspends, interrupts, aborts, or terminates the operation of a user process. This function is frequently used when a user believes his process is in an unending loop, or when an unwanted process has been inadvertently activated. IP is the standard representation for invoking this function. It should be noted by implementers that IP may be required by other protocols which use TELNET, and therefore should be implemented if these other protocols are to be supported. === Abort Output (AO) === Many systems provide a function which allows a process, which is generating output, to run to completion (or to reach the same stopping point it would reach if running to completion) but without sending the output to the user's terminal. Further, this function typically clears any output already produced but not yet actually printed (or displayed) on the user's terminal. AO is the standard representation for invoking this function. For example, some subsystem might normally accept a user's command, send a long text string to the user's terminal in response, and finally signal readiness to accept the next command by sending a "prompt" character (preceded by ) to the user's terminal. If the AO were received during the transmission of the text string, a reasonable implementation would be to suppress the remainder of the text string, but transmit the prompt character and the preceding . (This is possibly in distinction to the action which might be taken if an IP were received; the IP might cause suppression of the text string and an exit from the subsystem.) It should be noted, by server systems which provide this function, that there may be buffers external to the system (in the network and the user's local host) which should be cleared; the appropriate way to do this is to transmit the "Synch" signal (described below) to the user system. === Are You There (AYT) === Many systems provide a function which provides the user with some visible (e.g., printable) evidence that the system is still up and running. This function may be invoked by the user when the system is unexpectedly "silent" for a long time, because of the unanticipated (by the user) length of a computation, an unusually heavy system load, etc. AYT is the standard representation for invoking this function. === Erase Character (EC) === Many systems provide a function which deletes the last preceding undeleted character or "print position"* from the stream of data being supplied by the user. This function is typically used to edit keyboard input when typing mistakes are made. EC is the standard representation for invoking this function. NOTE: A "print position" may contain several characters which are the result of overstrikes, or of sequences such as BS ... === Erase Line (EL) === Many systems provide a function which deletes all the data in the current "line" of input. This function is typically used to edit keyboard input. EL is the standard representation for invoking this function.