# struct scb { /* NOTE Fields s_state, s_rstate, s_sstate locations in structure and value conventions must not change; they are used by the tcp/application buffering routines which are common across different applications */ int s_state; /* Connection state bits */ int s_rstate; /* Rcv from net state */ /* NORMAL */ /* URGENTM - urgent mode */ /* ignore nonspecial chars */ int s_sstate; /* Send to net state */ /* NORMAL */ /* BLOCK - don't read pty - local buffers full */ /* Per application variables - these may change for different applications */ int s_rspecial; /* Rcv from net char handling */ /* NORMAL */ /* '\r' (13), IAC, WILL, WONT, DO, DONT - processing special chars */ int s_sspecial; /* Send to net char handling */ /* NORMAL */ /* '\r' (13) */ long s_rtime; /* Time last received data */ int s_tmngo; /* Timing mark negot. status - used to see if foreign applic. is alive */ /* NORMAL - no req. outstanding */ /* DO - IAC DO TM sent */ int s_echom; /* Echo mode */ /* WILL - server end does echoing wh. means that echoing will be left to local pgm control */ /* WONT - force server end not to echo */ int s_echongo; /* Echo negotiation request outstanding */ /* NORMAL - no req. outstanding */ /* WILL - IAC WILL ECHO sent */ /* WONT - IAC WONT ECHO sent */ int s_sga; /* Server suppress go ahead state */ /* WILL - will sga */ /* WONT - wont sga */ int s_sgango; /* Server suppress go ahead request outstanding */ /* NORMAL */ /* WILL - IAC WILL SGA sent */ /* WONT - IAC WONT SGA sent */ int s_usga; /* User end suppress go ahead state */ /* WILL - will sga */ /* WONT - wont sga */ int s_usgango; /* Request to user end re sga outstanding */ /* NORMAL - no outstanding req */ /* DO - IAC DO SGA sent */ /* DONT - IAC DONT SGA sent */ }; #define TELNETICP 23 /* Telnet tcp well known socket no. */ #define NORMAL 0 #define URGENTM 1 #define BLOCK 1 #define IAC 255 #define WILL 251 #define WONT 252 #define DO 253 #define DONT 254 #define DM 242 #define BRK 243 #define IP 244 #define AO 245 #define AYT 246 #define EC 247 #define ECHO 1 #define SGA 3 #define TM 6 #define NUL 0 /* Telnet timeout time */ #define TELTIMEOUT 1800 /* 30 minutes */ /* Telnet connection state bits */ #define OPENING 0 #define DRCV 01 #define DSND 02 #define UCLOSED 04 /* Location in tty struct of special chars - for ttymod to find values for special chars */ #define CERASE 2 #define CINTR 15 #define CSILENT 30 /* Pty flag2 bits of interest */ #define FORCECHOM 04000 /* Force echo mode ala FECHO bit */ #define FECHO 010000 extern struct scb scb; extern int pty; extern FILE *ptyr, *ptyw; extern int nptyerr; #define NPTYERR 20