Telnet Server Service
6-5
Network Tools Library Services
6.2
Telnet Server Service
6.2.1
Synopsis
The Telnet Server service provides a mechanism for exposing a stream IO
connection to any remote telnet client console.
A telnet connection is basically just a TCP connection to the “well-known” port
designated for telnet. However, there is some data translation that occurs on
the stream. Telnet has a set of commands that can change the behavior of the
terminal, and can perform some character translation. The telnet server sup-
plied here is designed to convert a normal TTY stream to a telnet stream and
back. This allows any application to treat a telnet session as any other TTY
session (like a serial port).
Connection to an application is achieved by use of an application supplied call-
back function that telnet calls when a new connection is established. This call-
back function returns the file descriptor of one end of a full duplex communica-
tions pipe. By allowing multiple calls to the callback function, console applica-
tions can be written to work with multiple IO streams.
6.2.2
Telnet Parameter Structure
The following structure defines the unique parameters of the Telnet service.
It is located in the file: src\nettools\inc\telnetif.h.
//
// Telnet Parameter Structure
//
typedef struct _ntparam_telnet {
int MaxCon; // Max number of telnet connections
int (*Callback)(PSA); // Connect function returns local pipe
} NTPARAM_TELNET;
-
MaxCon – Maximum number of simultaneous telnet sessions (1 to 24)
-
Callback – Pointer to a callback function which takes a pointer to a sock-
addr structure, and returns a local file descriptor to one end of a full duplex
communications pipe.
This structure is used both when specifying the service to the configuration
system or when bypassing the configuration and invoking the service API di-
rectly.