Path: utzoo!utgpu!watmath!att!ucbvax!BERSERKLY.CRAY.COM!dab From: dab@BERSERKLY.CRAY.COM (David Borman) Newsgroups: comp.protocols.tcp-ip Subject: Telnet source code Message-ID: <8911141933.AA13055@berserkly.cray.com> Date: 14 Nov 89 19:33:55 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 141 The latest copy of source for both telnet and telnetd are now available for anonymous ftp from ucbarpa.berkeley.edu. There is a single compressed tar file, pub/telnet.tar.Z, which has both the client and the server code. This file also has diffs from the 4.3BSD pty/terminal driver to add the necessary support needed to run a server telnetd that supports linemode. If you had previously gotten a copy of the telnet from ucbarpa, you should get this new copy. This is the basis for both telnet and telnetd that will be released in 4.4BSD. These new versions have support for both SysV termio structures, and POSIX termios structures. Attached is the README file that is included in the tar file. -Dave Borman, dab@cray.com November 14, 1989 This is a distribution of both client and server telnet. These programs have been compiled and run on BSD4.3, BSD4.4, and Cray UNICOS 5.0/5.1. In addition, the telnet client source has been compiled an run on SunOS 3.5 and DYNIX V3.0.12 Questions/comments go to Dave Borman Cray Research, Inc. 1440 Northland Drive Mendota Heights, MN 55120 dab@cray.com. README: You are reading it. kern.diff: This file contains the diffs for the changes needed for the kernel to support LINEMODE is the server. There is a new bit in the terminal state word, TS_EXTPROC. When this bit is set, several aspects of the terminal driver are disabled. Input line editing, character echo, and mapping of signals are all disabled. This allows the telnetd to turn of these functions when in linemode, but still keep track of what state the user wants the terminal to be in. New ioctl()s: TIOCEXT Turn on/off the TS_EXTPROC bit TIOCGSTATE Get t_state of tty to look at TS_EXTPROC bit TIOCSIG Generate a signal to processes in the current process group of the pty. There is a new mode for packet driver, the TIOCPKT_IOCTL bit. When packet mode is turned on in the pty, and the TS_EXTPROC bit is set, then whenever the state of the pty is changed, the next read on the master side of the pty will have the TIOCPKT_IOCTL bit set, and the data will contain the following: struct xx { struct sgttyb a; struct tchars b; struct ltchars c; int t_state; int t_flags; } This allows the process on the server side of the pty to know when the state of the terminal has changed, and what the new state is. stty.diff: This file contains the changes needed for the stty(1) program to report on the current status of the TS_EXTPROC bit. It also allows the user to turn on/off the TS_EXTPROC bit. This is useful because it allows the user to say "stty -extproc", and the LINEMODE option will be automatically disabled, and saying "stty extproc" will re-enable the LINEMODE option. telnet.state: Both the client and server have code in them to deal with option negotiation loops. The algorithm that is used is described in this file. telnet: This directory contains the client code. No kernel changes are needed to use this code. telnetd: This directory contains the server code. If LINEMODE or KLUDGELINEMODE are defined, then the kernel modifications listed above are needed. arpa: This directory has a new The following TELNET options are supported: LINEMODE: The LINEMODE option is supported as per RFC1116. The FORWARDMASK option is not currently supported. BINARY: The client has the ability to turn on/off the BINARY option in each direction. Turning on BINARY from server to client causes the LITOUT bit to get set in the terminal driver on both ends, turning on BINARY from the client to the server causes the PASS8 bit to get set in the terminal driver on both ends. TERMINAL-TYPE: This is supported as per RFC1091. On the server side, when a terminal type is received, termcap/terminfo is consulted to determine if it is a known terminal type. It keeps requesting terminal types until it gets one that it recongnizes, or hits the end of the list. The server side looks up the entry in the termcap/terminfo data base, and generates a list of names which it then passes one at a time to each request for a terminal type, duplicating the last entry in the list before cycling back to the beginning. NAWS: The Negotiate about Window Size, as per RFC 1073. TERMINAL-SPEED: Implemented as per RFC 1079 TOGGLE-FLOW-CONTROL: Implemented as per RFC 1080 TIMING-MARK: As per RFC 860 SGA: As per RFC 858 ECHO: As per RFC 857 STATUS: The server will send its current status upon request. It does not ask for the clients status. The client will request the servers current status from the "send getstatus" command. The X-DISPLAY-LOCATION option is not supported. Look at the Makefile for comments about #define paramaters that need to be set up for your individual site.