📄 ckctel.h
字号:
/* ckctel.h -- Symbol and macro definitions for C-Kermit telnet support *//* Authors: Jeffrey E Altman <jaltman@secure-endpoints.com>, Secure Endpoints Inc., New York City Frank da Cruz <fdc@columbia.edu> Columbia University Academic Information Systems, New York City. Copyright (C) 1985, 2004, Trustees of Columbia University in the City of New York. All rights reserved. See the C-Kermit COPYING.TXT file or the copyright text in the ckcmai.c module for disclaimer and permissions. Notes: . Only one source file should include #defines for TELCMDS, TELOPTS, TELOPT_STATES, SLC_NAMES, and AUTH_NAMES. . This file should be used inplace of "arpa/telnet.h"*/#ifndef CKCTEL_H#define CKCTEL_H#ifdef TNCODE/* Definitions for the TELNET protocol. can't rely on library header files for any of them.*/#ifndef IAC /* First the telnet commands */#define IAC 255#endif /* IAC */#ifndef DONT#define DONT 254#endif /* DONT */#ifndef DO#define DO 253#endif /* DO */#ifndef WONT#define WONT 252#endif /* WONT */#ifndef WILL#define WILL 251#endif /* WILL */#ifndef SB#define SB 250#endif /* SB */#ifndef TN_GA#define TN_GA 249#endif /* TN_GA */#ifndef TN_EL#define TN_EL 248#endif /* TN_EL */#ifndef TN_EC#define TN_EC 247#endif /* TN_EC */#ifndef TN_AYT#define TN_AYT 246#endif /* TN_AYT */#ifndef TN_AO#define TN_AO 245#endif /* TN_AO */#ifndef TN_IP#define TN_IP 244#endif /* TN_IP */#ifndef BREAK#define BREAK 243#endif /* BREAK */#ifndef TN_DM#define TN_DM 242#endif /* TN_DM */#ifndef TN_NOP#define TN_NOP 241#endif /* TN_NOP */#ifndef SE#define SE 240#endif /* SE */#ifndef TN_EOR#define TN_EOR 239#endif /* TN_EOR */#ifndef TN_ABORT#define TN_ABORT 238#endif /* TN_ABORT */#ifndef TN_SUSP#define TN_SUSP 237#endif /* TN_SUSP */#ifndef TN_EOF#define TN_EOF 236#endif /* TN_EOF */#ifndef LAST_TN_CMD#define LAST_TN_CMD 236#define TN_SAK 200 /* IBM Secure Attention Key */#endif /* LAST_TN_CMD */#define SYNCH 242 /* for telfunc calls */#ifdef TELCMDSchar *telcmds[] = { "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0};#else /* TELCMDS */extern char *telcmds[];#endif /* TELCMDS */#define TELCMD_FIRST TN_EOF#define TELCMD_LAST IAC#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ (unsigned int)(x) >= TELCMD_FIRST || \ (unsigned int)(x) == TN_SAK)#define TELCMD(x) (TELCMD_OK(x)? ((x) == TN_SAK?"SAK": \ telcmds[(x)-TELCMD_FIRST]):"UNKNOWN")/* Then the options *//* NB: the following platforms have TELOPT_AUTHENTICATION defined as *//* 45 instead of 37. */#ifdef TELOPT_AUTHENTICATION#ifdef __osf__#undef TELOPT_AUTHENTICATION#endif /* __osf__ */#ifndef IRIX#undef TELOPT_AUTHENTICATION#endif /* IRIX */#ifndef ultrix#undef TELOPT_AUTHENTICATION#endif /* ultrix */#endif /* TELOPT_AUTHENTICATION *//* telnet options */#ifndef TELOPT_BINARY#define TELOPT_BINARY 0 /* 8-bit data path (RFC 856)*/#endif#ifndef TELOPT_ECHO#define TELOPT_ECHO 1 /* echo (RFC 857)*/#endif#ifndef TELOPT_RCP#define TELOPT_RCP 2 /* prepare to reconnect (NIC 50005)*/#endif#ifndef TELOPT_SGA#define TELOPT_SGA 3 /* suppress go ahead (RFC 858) */#endif#ifndef TELOPT_NAMS#define TELOPT_NAMS 4 /* approximate message size (ETHERNET) */#endif#ifndef TELOPT_STATUS#define TELOPT_STATUS 5 /* give status (RFC 859) */#endif#ifndef TELOPT_TM#define TELOPT_TM 6 /* timing mark (RFC 860) */#endif#ifndef TELOPT_RCTE#define TELOPT_RCTE 7 /* remote controlled transmission and echo */#endif /* (RFC 726) */#ifndef TELOPT_NAOL#define TELOPT_NAOL 8 /* negotiate about output line width */#endif /* (NIC 50005) */#ifndef TELOPT_NAOP#define TELOPT_NAOP 9 /* negotiate about output page size */#endif /* (NIC 50005) */#ifndef TELOPT_NAOCRD#define TELOPT_NAOCRD 10 /* negotiate about CR disposition (RFC 652) */#endif /* [Historic] */#ifndef TELOPT_NAOHTS#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */#endif /* (RFC 653) [Historic] */#ifndef TELOPT_NAOHTD#define TELOPT_NAOHTD 12 /* negotiate about horiz tab disposition */#endif /* (RFC 654) [Historic] */#ifndef TELOPT_NAOFFD#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */#endif /* (RFC 655) [Historic] */#ifndef TELOPT_NAOVTS#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */#endif /* (RFC 656) [Historic] */#ifndef TELOPT_NAOVTD#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */#endif /* (RFC 657) [Historic] */#ifndef TELOPT_NAOLFD#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */#endif /* (RFC 658) [Historic] */#ifndef TELOPT_XASCII#define TELOPT_XASCII 17 /* extended ascii character set */#endif /* (RFC 698) */#ifndef TELOPT_LOGOUT#define TELOPT_LOGOUT 18 /* force logout (RFC 727) */#endif#ifndef TELOPT_BM#define TELOPT_BM 19 /* byte macro (RFC 735) */#endif#ifndef TELOPT_DET#define TELOPT_DET 20 /* data entry terminal (RFC 1043, 732) */#endif#ifndef TELOPT_SUPDUP#define TELOPT_SUPDUP 21 /* supdup protocol (RFC 736, 734) */#endif#ifndef TELOPT_SUPDUPOUTPUT#define TELOPT_SUPDUPOUTPUT 22 /* supdup output (RFC 749) */#endif#ifndef TELOPT_SNDLOC#define TELOPT_SNDLOC 23 /* send location (RFC 779) */#endif#ifndef TELOPT_TTYPE#define TELOPT_TTYPE 24 /* terminal type (RFC 1091) */#endif#ifndef TELOPT_EOR#define TELOPT_EOR 25 /* end of record (RFC 885) */#endif#ifndef TELOPT_TUID#define TELOPT_TUID 26 /* TACACS user identification (RFC 927) */#endif#ifndef TELOPT_OUTMRK#define TELOPT_OUTMRK 27 /* output marking (RFC 933) */#endif#ifndef TELOPT_TTYLOC#define TELOPT_TTYLOC 28 /* terminal location number (RFC 946) */#endif#ifndef TELOPT_3270REGIME#define TELOPT_3270REGIME 29 /* 3270 regime (RFC 1041) */#endif#ifndef TELOPT_X3PAD#define TELOPT_X3PAD 30 /* X.3 PAD (RFC 1053) */#endif#ifndef TELOPT_NAWS#define TELOPT_NAWS 31 /* window size (RFC 1073) */#endif#ifndef TELOPT_TSPEED#define TELOPT_TSPEED 32 /* terminal speed (RFC 1079) */#endif#ifndef TELOPT_LFLOW#define TELOPT_LFLOW 33 /* remote flow control (RFC 1372) */#endif#ifndef TELOPT_LINEMODE#define TELOPT_LINEMODE 34 /* Linemode option (RFC 1184) */#endif#ifndef TELOPT_XDISPLOC#define TELOPT_XDISPLOC 35 /* X Display Location (RFC 1096) */#endif#ifndef TELOPT_OLD_ENVIRON#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables (RFC 1408) */#endif#ifndef TELOPT_AUTHENTICATION#define TELOPT_AUTHENTICATION 37/* Authenticate (RFC 2941) */#endif#ifndef TELOPT_ENCRYPTION#define TELOPT_ENCRYPTION 38 /* Encryption option (RFC 2946) */#endif#ifndef TELOPT_NEWENVIRON#define TELOPT_NEWENVIRON 39 /* New - Environment variables (RFC 1572) */#endif#ifndef TELOPT_3270E#define TELOPT_3270E 40 /* 3270 Extended (RFC 1647) */#endif#ifndef TELOPT_XAUTH#define TELOPT_XAUTH 41 /* ??? (Earhart) */#endif#ifndef TELOPT_CHARSET#define TELOPT_CHARSET 42 /* Character-set (RFC 2066) */#endif#ifndef TELOPT_RSP#define TELOPT_RSP 43 /* Remote Serial Port (Barnes) */#endif#ifndef TELOPT_COMPORT#define TELOPT_COMPORT 44 /* Com Port Control (RFC 2217) */#endif#ifndef TELOPT_SLE#define TELOPT_SLE 45 /* Suppress Local Echo (Atmar) - [rejected] */#endif#ifndef TELOPT_START_TLS#define TELOPT_START_TLS 46 /* Telnet over Transport Layer Security */#endif /* (Boe) */#ifndef TELOPT_KERMIT#define TELOPT_KERMIT 47 /* Kermit (RFC 2840) */#endif#ifndef TELOPT_SEND_URL#define TELOPT_SEND_URL 48 /* Send URL */#endif#ifndef TELOPT_FORWARD_X#define TELOPT_FORWARD_X 49 /* X Windows Forwarding (Altman) */#endif /* TELOPT_FORWARD_X */#ifndef TELOPT_STDERR#define TELOPT_STDERR 50 /* Redirected Stderr (Altman) */#endif /* TELOPT_STDERR */#ifndef TELOPT_PRAGMA_LOGON#define TELOPT_PRAGMA_LOGON 138 /* Encrypted Logon option (PragmaSys) */#endif#ifndef TELOPT_SSPI_LOGON#define TELOPT_SSPI_LOGON 139 /* MS SSPI Logon option (PragmaSys) */#endif#ifndef TELOPT_PRAGMA_HEARTBEAT /* Server Send Heartbeat option (PragmaSys) */#define TELOPT_PRAGMA_HEARTBEAT 140#endif#define TELOPT_IBM_SAK 200 /* IBM Secure Attention Key *//* IBM Secure Attention Key (SAK) Option In addition to terminal negotiation, the telnet command allows negotiation for the Secure Attention Key (SAK) option. This option, when supported, provides the local user with a secure communication path to the remote host for tasks such as changing user IDs or passwords. If the remote host supports the SAK function, a trusted shell is opened on the remote host when the telnet send sak subcommand is issued. The SAK function can also be assigned to a single key available in telnet input mode, using the set sak subcommand. TN_SAK Sends the TELNET SAK (Secure Attention Key) sequence, which causes the remote system to invoke the trusted shell. If the SAK is not supported, then an error message is displayed that reads: Remote side does not support SAK.*/#ifndef TELOPT_EXOPL#define TELOPT_EXOPL 255 /* Extended-options-list (RFC 861) */#endif#ifdef NTELOPTS#undef NTELOPTS#endif /* NTELOPTS *//* The Telnet Option space is no longer being allocated by ICANN as a *//* continuous list. In other words it is becoming sparse. But we do *//* not want to have to allocate memory for a long list of strings and *//* structs which will never be used. Therefore, the NTELOPTS define *//* can no longer be equal to TELOPT_LAST+1. In fact, the notion of *//* TELOPT_FIRST and TELOPT_LAST no longer make sense. */#define NTELOPTS 55#define TELOPT_FIRST TELOPT_BINARY#define TELOPT_LAST TELOPT_IBM_SAK/* The following macros speed us up at runtime but are too complex for some preprocessors / compilers; if your compiler bombs on ckctel.c with "Instruction table overflow" or somesuch, rebuild with -DNOTOMACROS.*/#ifndef NOTOMACROS#ifndef TELOPT_MACRO#define TELOPT_MACRO#endif /* TELOPT_MACRO */#endif /* NOTOMACROS */#ifdef TELOPT_MACRO#define TELOPT_INDEX(x) (((x)>=0 && (x)<= TELOPT_STDERR)?(x):\ ((x)>=TELOPT_PRAGMA_LOGON && (x)<=TELOPT_PRAGMA_HEARTBEAT)?(x)-87: \ ((x) == TELOPT_IBM_SAK)?(x)-146: NTELOPTS)#define TELOPT_OK(x) (((x) >= TELOPT_BINARY && (x) <= TELOPT_STDERR) ||\ ((x) >= TELOPT_PRAGMA_LOGON && (x) <= TELOPT_PRAGMA_HEARTBEAT) ||\ ((x) == TELOPT_IBM_SAK))#define TELOPT(x) (TELOPT_OK(x)?telopts[TELOPT_INDEX(x)]:"UNKNOWN")#else /* TELOPT_MACRO */_PROTOTYP(int telopt_index,(int));_PROTOTYP(int telopt_ok,(int));_PROTOTYP(CHAR * telopt, (int));#define TELOPT_INDEX(x) telopt_index(x)#define TELOPT_OK(x) telopt_ok(x)#define TELOPT(x) telopt(x)#endif /* TELOPT_MACRO */#ifdef TELOPTSchar *telopts[NTELOPTS+2] = {/* 0 */ "BINARY", "ECHO", "RCP", "SUPPRESS-GO-AHEAD",/* 4 */ "NAME", "STATUS", "TIMING-MARK", "RCTE",/* 8 */ "NAOL", "NAOP", "NAOCRD", "NAOHTS",/* 12 */ "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD",/* 16 */ "NAOLFD", "EXTEND-ASCII", "LOGOUT", "BYTE-MACRO",/* 20 */ "DATA-ENTRY-TERMINAL", "SUPDUP", "SUPDUP-OUTPUT", "SEND-LOCATION",/* 24 */ "TERMINAL-TYPE", "END-OF-RECORD", "TACACS-UID", "OUTPUT-MARKING",/* 28 */ "TTYLOC", "3270-REGIME", "X.3-PAD", "NAWS",/* 32 */ "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC",/* 36 */ "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPTION", "NEW-ENVIRONMENT",/* 40 */ "TN3270E","xauth","CHARSET", "remote-serial-port",/* 44 */ "COM-PORT-CONTROL","suppress-local-echo","START-TLS","KERMIT",/* 48 */ "send-url","FORWARD-X","stderr",/* 138 */ "pragma-logon", "sspi-logon", "pragma-heartbeat",/* 200 */ "ibm-sak", "unknown", 0};#else /*TELOPTS */extern char * telopts[];#endif /* TELOPTS *//* TELNET Newline Mode */#define TNL_CR 0 /* CR sends bare carriage return */#define TNL_CRNUL 1 /* CR and NUL */#define TNL_CRLF 2 /* CR and LF */#define TNL_LF 3 /* LF instead of CR *//* TELNET Negotiation Mode */#define TN_NG_RF 0 /* Negotiation REFUSED */#define TN_NG_AC 1 /* Negotiation ACCEPTED */#define TN_NG_RQ 2 /* Negotiation REQUESTED */#define TN_NG_MU 3 /* Negotiation REQUIRED (must) *//* Systems where we know we can define TELNET NAWS automatically. */#ifndef CK_NAWS /* In other words, if both */#ifdef CK_TTGWSIZ /* TNCODE and TTGWSIZ are defined */#define CK_NAWS /* then we can do NAWS. */#endif /* CK_TTGWSIZ */#endif /* CK_NAWS */#ifdef CK_FORWARD_X#ifndef MAXFWDX#define MAXFWDX 64 /* Num of X windows to be fwd'd */#endif /* MAXFWDX */#endif /* CK_FORWARD_X */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -