Select Git revision
TELNET.pmod
TELNET.pmod 24.17 KiB
//
// $Id: TELNET.pmod,v 1.14 2000/12/28 15:03:30 grubba Exp $
//
// The TELNET protocol as described by RFC 764 and others.
//
// Henrik Grubbström <grubba@idonex.se> 1998-04-04
//
#pike __REAL_VERSION__
// #define TELNET_DEBUG
#ifdef TELNET_DEBUG
#define DWRITE(X) werror(X)
#else
#define DWRITE(X)
#endif /* TELNET_DEBUG */
//! Implements TELNET as described by RFC 764 and RFC 854
//!
//! Also implements the Q method of TELNET option negotiation
//! as specified by RFC 1143.
//! Table of IAC-codes.
class TelnetCodes {
constant IAC = 255; /* interpret as command: */
constant DONT = 254; /* you are not to use option */
constant DO = 253; /* please, you use option */
constant WONT = 252; /* I won't use option */
constant WILL = 251; /* I will use option */
constant SB = 250; /* interpret as subnegotiation */
constant GA = 249; /* you may reverse the line */
constant EL = 248; /* erase the current line */
constant EC = 247; /* erase the current character */
constant AYT = 246; /* are you there */
constant AO = 245; /* abort output--but let prog finish */
constant IP = 244; /* interrupt process--permanently */
constant BREAK = 243; /* break */
constant DM = 242; /* data mark--for connect. cleaning */
constant NOP = 241; /* nop */
constant SE = 240; /* end sub negotiation */
constant EOR = 239; /* end of record (transparent mode) */
constant ABORT = 238; /* Abort process */
constant SUSP = 237; /* Suspend process */
constant xEOF = 236; /* End of file: EOF is already used... */
constant SYNCH = 242; /* for telfunc calls */
};
inherit TelnetCodes;
//! Table of TELNET options.
class Telopts {
constant TELOPT_BINARY = 0; /* 8-bit data path */
constant TELOPT_ECHO = 1; /* echo */
constant TELOPT_RCP = 2; /* prepare to reconnect */
constant TELOPT_SGA = 3; /* suppress go ahead */
constant TELOPT_NAMS = 4; /* approximate message size */
constant TELOPT_STATUS = 5; /* give status */
constant TELOPT_TM = 6; /* timing mark */
constant TELOPT_RCTE = 7; /* remote controlled transmission and echo */
constant TELOPT_NAOL = 8; /* negotiate about output line width */
constant TELOPT_NAOP = 9; /* negotiate about output page size */
constant TELOPT_NAOCRD = 10; /* negotiate about CR disposition */
constant TELOPT_NAOHTS = 11; /* negotiate about horizontal tabstops */
constant TELOPT_NAOHTD = 12; /* negotiate about horizontal tab disposition */
constant TELOPT_NAOFFD = 13; /* negotiate about formfeed disposition */