⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ckctel.h

📁 C-Kermit源码。是使用串口/Modem和网络通讯的程序
💻 H
📖 第 1 页 / 共 3 页
字号:
#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_FORWARD_X)?(x):\        ((x)>=TELOPT_PRAGMA_LOGON && (x)<=TELOPT_PRAGMA_HEARTBEAT)?(x)-89: \        ((x) == TELOPT_IBM_SAK)?(x)-148: NTELOPTS)#define	TELOPT_OK(x)	(((x) >= TELOPT_BINARY && (x) <= TELOPT_FORWARD_X) ||\             ((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",/* 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#define MAXFWDX 64                      /* Num of X windows to be fwd'd */#endif /* MAXFWDX *//* Telnet State structures and definitions */struct _telopt_state {  unsigned char def_server_me_mode;   /* Default Negotiation Mode */  unsigned char def_server_u_mode;    /* Default Negotiation Mode */  unsigned char def_client_me_mode;   /* Default Negotiation Mode */  unsigned char def_client_u_mode;    /* Default Negotiation Mode */  unsigned char me_mode;              /* Telnet Negotiation Mode */  unsigned char u_mode;               /* Telnet Negotiation Mode */  unsigned char me;                   /* Am I ?                  */  unsigned char u;                    /* Are you?                */  unsigned char unanswered_will;      /* Sent Will, Waiting for DO/DONT */  unsigned char unanswered_do;        /* Send DO, Waiting for WILL/WONT */  unsigned char unanswered_wont;      /* Sent WONT, Waiting for DONT */  unsigned char unanswered_dont;      /* Sent DONT, Waiting for WONT */  unsigned char unanswered_sb;        /* Sent SB,   Waiting for SB (server) */  union {#ifdef IKS_OPTION    struct _telopt_kermit {         /* Kermit Option States */      unsigned char me_start;       /* I have a Server active */      unsigned char me_req_start;   /* Sent Req-Start, Waiting for response */      unsigned char me_req_stop;    /* Sent Req-Stop, Waiting for response  */      unsigned char u_start;        /* You have a Server active */      unsigned char sop;            /* Have we received the SOP char? */    } kermit;#endif /* IKS_OPTION */#ifdef CK_ENCRYPTION    struct _telopt_encrypt {        /* Encryption Option States */      unsigned char need_to_send;      unsigned char  stop;          /* Is encryption stopped?   */    } encrypt;#endif /* CK_ENCRYPTION */#ifdef CK_NAWS    struct _telopt_naws {           /* NAWS Option Information  */      unsigned char need_to_send;      int x;                        /* Last Width               */      int y;                        /* Last Height              */    } naws;#endif /* CK_NAWS */#ifdef CK_SSL    struct _telopt_start_tls {      /* Start TLS Option             */       unsigned char u_follows;     /* u ready for TLS negotiation  */       unsigned char me_follows;    /* me ready for TLS negotiation */    } start_tls;#endif /* CK_SSL */    struct _telopt_term {          /* Terminal Type            */       unsigned char need_to_send;       unsigned char type[41];     /* Last terminal type       */    } term;#ifdef CK_ENVIRONMENT    struct _telopt_new_env {       unsigned char need_to_send;       unsigned char * str;       int             len;    } env;#ifdef CK_XDISPLOC    struct _telopt_xdisp {       unsigned char need_to_send;    } xdisp;#endif /* CK_XDISPLOC */#endif /* CK_ENVIRONMENT */#ifdef CK_SNDLOC    struct _telopt_sndloc {       unsigned char need_to_send;    } sndloc;#endif /* CK_SNDLOC */#ifdef CK_FORWARD_X    struct _telopt_fwd_x {        unsigned char need_to_send;        int listen_socket;        struct _channel {            int fd;            int id;        } channel[MAXFWDX];#ifdef NT        int thread_started;#endif /* NT */    } forward_x;#endif /* CK_FORWARD_X */    /* additional options such as New Environment or Send Location */  } sb;};typedef struct _telopt_state telopt_state, *p_telopt_state;/* telopt_states[] is the array of structs which the state of each telnet *//* option is stored.  We allocate one more than we need in case we are    *//* sent telnet options that we do not recognize.  If by some chance the   *//* TELOPT_OK() check is skipped, TELOPT_INDEX() will force the option to  *//* use the extra cell.                                                    */#ifdef TELOPT_STATEStelopt_state telopt_states[NTELOPTS+1];#else /* TELOPT_STATES */extern telopt_state telopt_states[];#endif /* TELOPT_STATES */#define TELOPT_ME(x) (telopt_states[TELOPT_INDEX(x)].me)#define TELOPT_U(x)  (telopt_states[TELOPT_INDEX(x)].u)#define TELOPT_ME_MODE(x) \        (telopt_states[TELOPT_INDEX(x)].me_mode)#define TELOPT_U_MODE(x)  \        (telopt_states[TELOPT_INDEX(x)].u_mode)#define TELOPT_UNANSWERED_WILL(x) \        (telopt_states[TELOPT_INDEX(x)].unanswered_will)#define TELOPT_UNANSWERED_DO(x)   \        (telopt_states[TELOPT_INDEX(x)].unanswered_do)#define TELOPT_UNANSWERED_WONT(x) \        (telopt_states[TELOPT_INDEX(x)].unanswered_wont)#define TELOPT_UNANSWERED_DONT(x)   \        (telopt_states[TELOPT_INDEX(x)].unanswered_dont)#define TELOPT_UNANSWERED_SB(x)   \        (telopt_states[TELOPT_INDEX(x)].unanswered_sb)#define TELOPT_SB(x) \        (telopt_states[TELOPT_INDEX(x)].sb)#define TELOPT_DEF_S_ME_MODE(x) \        (telopt_states[TELOPT_INDEX(x)].def_server_me_mode)#define TELOPT_DEF_S_U_MODE(x)  \        (telopt_states[TELOPT_INDEX(x)].def_server_u_mode)#define TELOPT_DEF_C_ME_MODE(x) \        (telopt_states[TELOPT_INDEX(x)].def_client_me_mode)#define TELOPT_DEF_C_U_MODE(x)  \        (telopt_states[TELOPT_INDEX(x)].def_client_u_mode)#ifdef TELOPT_MODESchar * telopt_modes[4] = {    "REFUSED", "ACCEPTED", "REQUESTED", "REQUIRED"};#else /* TELOPT_MODES */extern char * telopt_modes[];#endif /* TELOPT_MODES */#ifdef TELOPT_MACRO#define	TELOPT_MODE_OK(x) ((unsigned int)(x) <= TN_NG_MU)#define	TELOPT_MODE(x) (TELOPT_MODE_OK(x)?telopt_modes[(x)-TN_NG_RF]:"UNKNOWN")#else /* TELOPT_MACRO */_PROTOTYP(int telopt_mode_ok,(int));_PROTOTYP(CHAR * telopt_mode,(int));#define TELOPT_MODE_OK(x) telopt_mode_ok(x)#define TELOPT_MODE(x)    telopt_mode(x)#endif /* TELOPT_MACRO *//* Sub-option qualifiers */#define	TELQUAL_IS	0	/* option is... */#define	TELQUAL_SEND	1	/* send option */#define	TELQUAL_INFO	2	/* ENVIRON: informational version of IS */#define	TELQUAL_REPLY	2	/* AUTHENTICATION: client version of IS */#define	TELQUAL_NAME	3	/* AUTHENTICATION: client version of IS */#define TEL_ENV_VAR     0#define TEL_ENV_VALUE   1#define TEL_ENV_ESC     2#define TEL_ENV_USERVAR 3#define	LFLOW_OFF		0	/* Disable remote flow control */#define	LFLOW_ON		1	/* Enable remote flow control */#define	LFLOW_RESTART_ANY	2	/* Restart output on any char */#define	LFLOW_RESTART_XON	3	/* Restart output only on XON *//* * LINEMODE suboptions */#define	LM_MODE		1#define	LM_FORWARDMASK	2#define	LM_SLC		3#define	MODE_EDIT	0x01#define	MODE_TRAPSIG	0x02#define	MODE_ACK	0x04#define MODE_SOFT_TAB	0x08#define MODE_LIT_ECHO	0x10#define	MODE_MASK	0x1f/* Not part of protocol, but needed to simplify things... */#define MODE_FLOW		0x0100#define MODE_ECHO		0x0200#define MODE_INBIN		0x0400#define MODE_OUTBIN		0x0800#define MODE_FORCE		0x1000#define	SLC_SYNCH	1#define	SLC_BRK		2#define	SLC_IP		3#define	SLC_AO		4#define	SLC_AYT		5#define	SLC_EOR		6#define	SLC_ABORT	7#define	SLC_EOF		8#define	SLC_SUSP	9#define	SLC_EC		10#define	SLC_EL		11#define	SLC_EW		12#define	SLC_RP		13#define	SLC_LNEXT	14#define	SLC_XON		15#define	SLC_XOFF	16#define	SLC_FORW1	17#define	SLC_FORW2	18#define SLC_MCL         19#define SLC_MCR         20#define SLC_MCWL        21#define SLC_MCWR        22#define SLC_MCBOL       23#define SLC_MCEOL       24#define SLC_INSRT       25#define SLC_OVER        26#define SLC_ECR         27#define SLC_EWR         28#define SLC_EBOL        29#define SLC_EEOL        30#define	NSLC		30/* * For backwards compatability, we define SLC_NAMES to be the * list of names if SLC_NAMES is not defined. */#define	SLC_NAMELIST	"0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \			"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \			"LNEXT", "XON", "XOFF", "FORW1", "FORW2", \                        "MCL", "MCR", "MCWL", "MCWR", "MCBOL", "MCEOL", \                        "INSRT", "OVER", "ECR", "EWR", "EBOL", "EEOL", 0#ifdef	SLC_NAMESchar *slc_names[] = {	SLC_NAMELIST};#elseextern char *slc_names[];#define	SLC_NAMES SLC_NAMELIST#endif#define	SLC_NAME_OK(x)	((unsigned int)(x) <= NSLC)#define SLC_NAME(x)	(SLC_NAME_OK(x)?slc_names[x]:"UNKNOWN")#define	SLC_NOSUPPORT	0#define	SLC_CANTCHANGE	1#define	SLC_VARIABLE	2#define	SLC_DEFAULT	3#define	SLC_LEVELBITS	0x03#define	SLC_FUNC	0#define	SLC_FLAGS	1#define	SLC_VALUE	2#define	SLC_ACK		0x80#define	SLC_FLUSHIN	0x40

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -