CL-TELNETD

Introduction

CL-TELNETD is a TELNET protocol server implementation written in Common Lisp. It currently is designed for use with SBCL and its native thread support on Linux/x86, however it could be ported to other platforms. CL-TELNETD aims to implement as many of the TELNET protocol extensions as is possible and practical.

The TELNET protocol is notorious for its numerous option and its complex option negotiation. CL-TELNETD will implement Dan Bernstein’s Q Method of option negotiation, widely perceived to be the Right Way of getting TELNET options to work even if the client is a moronic implementation such as Windows Telnet. Not all options will be implemented, particularly those which seem to have no useful purpose on the modern network, eg SPX Authentication and Extended ASCII Option. Initially no effort will be expended on implementing the plethora of authentication and encryption options, since there are other products such as SSH which have largely supplanted the use of TELNET for this purpose.

CL-TELNET is not fully implmented yet, but it is well on the way towards being functional enough so that a bare, unadorned stream can be used. Option negotiation needs to be implemented at least to the point where the server can say DONT or WONT to any requests. After that progress is a matter of implementing various protocol options and gluing in some support for terminak handling with CL-NCURSES.

Design

The TELNET server is implemented as an instance of TELNET-LISTENER (which perhaps should be renamed ‘TELNET-SERVER’). This is simply a configuration object which contains all the assorted configuration options and references to the runtime objects and thread handles. Once a TELNET-LISTENER is instantiated it must be passed to START-LISTENING which spawns the appropriate number of listener threads and a master thread which will monitor them. Each listener thread then runs ACCEPT-CONNECTION which creates a socket on the configured port, makes a TELNET-STREAM of that socket, and then blocks until a connection is made to it. The master thread runs a bookkeeping cycle in CYCLE-MASTER-THREAD which recycles dead threads, spawns new ones as necessary, and otherwise sleeps.

The implementation of the TELNET protocol actually lives in the TELNET-STREAM class and its methods. It is at the moment not a ‘real’ stream, but is instead a wrapper around the FD-STREAM which is from the socket. The TELNET-STREAM implements the appropriate CL stream functions, and invisibly handles any TELNET protocol in-band signals (using TELNET IAC), presenting to the user a programmable terminal stream. If the user writes data to the stream which requires escaping with IAC for the TELNET protocol it is automatically performed by the TELNET-STREAM implementation. Also, a number of configuration options and methods to manipulate them are provided to the user so that TELNET protocol options can be changed while a session is in progress. These are not intended to be used directly, but are instead supposed to be used with low-level terminal control on the stream.

Mailing Lists

Download

There are no released files yet. Please see the CVS repository.

CVS

You can browse the CVS repository or download the current development tree via anonymous CVS.

Back to Common-lisp.net.

Valid XHTML 1.1