home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckl196.zip / ckctel.h < prev    next >
C/C++ Source or Header  |  1999-12-31  |  33KB  |  990 lines

  1. /* ckctel.h -- Symbol and macro definitions for C-Kermit telnet support */
  2.  
  3. /*
  4.   Authors: Jeffrey Altman <jaltman@columbia.edu>,
  5.            Frank da Cruz <fdc@columbia.edu>
  6.   Columbia University Academic Information Systems, New York City.
  7.  
  8.   Copyright (C) 1985, 2000,
  9.     Trustees of Columbia University in the City of New York.
  10.     All rights reserved.  See the C-Kermit COPYING.TXT file or the
  11.     copyright text in the ckcmai.c module for disclaimer and permissions.
  12.  
  13.   Notes:
  14.   . Only one source file should include #defines for
  15.     TELCMDS, TELOPTS, TELOPT_STATES, SLC_NAMES, and AUTH_NAMES.
  16.   . This file should be used inplace of "arpa/telnet.h"
  17. */
  18.  
  19. #ifndef CKCTEL_H
  20. #define    CKCTEL_H
  21.  
  22. /*
  23.   Definitions for the TELNET protocol.
  24.   can't rely on library header files for any of them.
  25. */
  26. #ifndef IAC                /* First the telnet commands */
  27. #define IAC 255
  28. #endif /* IAC */
  29. #ifndef DONT
  30. #define DONT 254
  31. #endif /* DONT */
  32. #ifndef DO
  33. #define DO 253
  34. #endif /* DO */
  35. #ifndef WONT
  36. #define WONT 252
  37. #endif /* WONT */
  38. #ifndef WILL
  39. #define WILL 251
  40. #endif /* WILL */
  41. #ifndef SB
  42. #define SB 250
  43. #endif /* SB */
  44. #ifndef TN_GA
  45. #define TN_GA 249
  46. #endif /* TN_GA */
  47. #ifndef TN_EL
  48. #define TN_EL 248
  49. #endif /* TN_EL */
  50. #ifndef TN_EC
  51. #define TN_EC 247
  52. #endif /* TN_EC */
  53. #ifndef TN_AYT
  54. #define TN_AYT 246
  55. #endif /* TN_AYT */
  56. #ifndef TN_AO
  57. #define TN_AO 245
  58. #endif /* TN_AO */
  59. #ifndef TN_IP
  60. #define TN_IP 244
  61. #endif /* TN_IP */
  62. #ifndef BREAK
  63. #define BREAK 243
  64. #endif /* BREAK */
  65. #ifndef TN_DM
  66. #define TN_DM 242
  67. #endif /* TN_DM */
  68. #ifndef TN_NOP
  69. #define TN_NOP 241
  70. #endif /* TN_NOP */
  71. #ifndef SE
  72. #define SE 240
  73. #endif /* SE */
  74. #ifndef TN_EOR
  75. #define TN_EOR 239
  76. #endif /* TN_EOR */
  77. #ifndef TN_ABORT
  78. #define TN_ABORT 238
  79. #endif /* TN_ABORT */
  80. #ifndef TN_SUSP
  81. #define TN_SUSP 237
  82. #endif /* TN_SUSP */
  83. #ifndef TN_EOF
  84. #define TN_EOF 236
  85. #endif /* TN_EOF */
  86. #ifndef LAST_TN_CMD
  87. #define LAST_TN_CMD 236
  88.  
  89. #define TN_SAK 200              /* IBM Secure Attention Key */
  90. #endif /* LAST_TN_CMD */
  91.  
  92. #define SYNCH    242        /* for telfunc calls */
  93.  
  94. #ifdef TELCMDS
  95. char *telcmds[] = {
  96.     "EOF", "SUSP", "ABORT", "EOR",
  97.     "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
  98.     "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0
  99. };
  100. #else /* TELCMDS */
  101. extern char *telcmds[];
  102. #endif /* TELCMDS */
  103.  
  104. #define    TELCMD_FIRST    TN_EOF
  105. #define    TELCMD_LAST    IAC
  106. #define    TELCMD_OK(x)    ((unsigned int)(x) <= TELCMD_LAST && \
  107.              (unsigned int)(x) >= TELCMD_FIRST || \
  108.                           (unsigned int)(x) == TN_SAK)
  109. #define    TELCMD(x)    (TELCMD_OK(x)? ((x) == TN_SAK?"SAK": \
  110.                          telcmds[(x)-TELCMD_FIRST]):"UNKNOWN")
  111.  
  112. /* Then the options */
  113. /* NB: the following platforms have TELOPT_AUTHENTICATION defined as */
  114. /* 45 instead of 37.                                                 */
  115. #ifdef TELOPT_AUTHENTICATION
  116. #ifdef __osf__
  117. #undef TELOPT_AUTHENTICATION
  118. #endif /* __osf__ */
  119. #ifndef IRIX
  120. #undef TELOPT_AUTHENTICATION
  121. #endif /* IRIX */
  122. #ifndef ultrix
  123. #undef TELOPT_AUTHENTICATION
  124. #endif /* ultrix */
  125. #endif /* TELOPT_AUTHENTICATION */
  126.  
  127. /* telnet options */
  128. #ifndef TELOPT_BINARY
  129. #define TELOPT_BINARY    0    /* 8-bit data path (RFC 856)*/
  130. #endif
  131. #ifndef TELOPT_ECHO
  132. #define TELOPT_ECHO    1    /* echo (RFC 857)*/
  133. #endif
  134. #ifndef TELOPT_RCP
  135. #define    TELOPT_RCP    2    /* prepare to reconnect (NIC 50005)*/
  136. #endif
  137. #ifndef    TELOPT_SGA
  138. #define    TELOPT_SGA    3    /* suppress go ahead (RFC 858) */
  139. #endif
  140. #ifndef    TELOPT_NAMS
  141. #define    TELOPT_NAMS    4    /* approximate message size (ETHERNET) */
  142. #endif
  143. #ifndef    TELOPT_STATUS
  144. #define    TELOPT_STATUS    5    /* give status (RFC 859) */
  145. #endif
  146. #ifndef    TELOPT_TM
  147. #define    TELOPT_TM    6    /* timing mark (RFC 860) */
  148. #endif
  149. #ifndef    TELOPT_RCTE
  150. #define    TELOPT_RCTE    7    /* remote controlled transmission and echo */
  151. #endif                          /* (RFC 726) */
  152. #ifndef TELOPT_NAOL
  153. #define TELOPT_NAOL     8    /* negotiate about output line width */
  154. #endif                          /* (NIC 50005) */
  155. #ifndef TELOPT_NAOP
  156. #define TELOPT_NAOP     9    /* negotiate about output page size */
  157. #endif                          /* (NIC 50005) */
  158. #ifndef TELOPT_NAOCRD
  159. #define TELOPT_NAOCRD    10    /* negotiate about CR disposition (RFC 652) */
  160. #endif                          /* [Historic] */
  161. #ifndef TELOPT_NAOHTS
  162. #define TELOPT_NAOHTS    11    /* negotiate about horizontal tabstops */
  163. #endif                          /* (RFC 653) [Historic] */
  164. #ifndef TELOPT_NAOHTD
  165. #define TELOPT_NAOHTD    12    /* negotiate about horiz tab disposition */
  166. #endif                          /* (RFC 654) [Historic] */
  167. #ifndef TELOPT_NAOFFD
  168. #define TELOPT_NAOFFD    13    /* negotiate about formfeed disposition */
  169. #endif                          /* (RFC 655) [Historic] */
  170. #ifndef TELOPT_NAOVTS
  171. #define TELOPT_NAOVTS    14    /* negotiate about vertical tab stops */
  172. #endif                          /* (RFC 656) [Historic] */
  173. #ifndef TELOPT_NAOVTD
  174. #define TELOPT_NAOVTD    15    /* negotiate about vertical tab disposition */
  175. #endif                          /* (RFC 657) [Historic] */
  176. #ifndef TELOPT_NAOLFD
  177. #define TELOPT_NAOLFD    16    /* negotiate about output LF disposition */
  178. #endif                          /* (RFC 658) [Historic] */
  179. #ifndef TELOPT_XASCII
  180. #define TELOPT_XASCII    17    /* extended ascii character set */
  181. #endif                          /* (RFC 698) */
  182. #ifndef    TELOPT_LOGOUT
  183. #define    TELOPT_LOGOUT    18    /* force logout (RFC 727) */
  184. #endif
  185. #ifndef    TELOPT_BM
  186. #define    TELOPT_BM    19    /* byte macro (RFC 735) */
  187. #endif
  188. #ifndef    TELOPT_DET
  189. #define    TELOPT_DET    20    /* data entry terminal (RFC 1043, 732) */
  190. #endif
  191. #ifndef    TELOPT_SUPDUP
  192. #define    TELOPT_SUPDUP    21    /* supdup protocol (RFC 736, 734) */
  193. #endif
  194. #ifndef    TELOPT_SUPDUPOUTPUT
  195. #define    TELOPT_SUPDUPOUTPUT 22    /* supdup output (RFC 749) */
  196. #endif
  197. #ifndef    TELOPT_SNDLOC
  198. #define    TELOPT_SNDLOC    23    /* send location (RFC 779) */
  199. #endif
  200. #ifndef    TELOPT_TTYPE
  201. #define    TELOPT_TTYPE    24    /* terminal type (RFC 1091) */
  202. #endif
  203. #ifndef    TELOPT_EOR
  204. #define    TELOPT_EOR    25    /* end or record (RFC 885) */
  205. #endif
  206. #ifndef    TELOPT_TUID
  207. #define    TELOPT_TUID    26    /* TACACS user identification (RFC 927) */
  208. #endif
  209. #ifndef    TELOPT_OUTMRK
  210. #define    TELOPT_OUTMRK    27    /* output marking (RFC 933) */
  211. #endif
  212. #ifndef    TELOPT_TTYLOC
  213. #define    TELOPT_TTYLOC    28    /* terminal location number (RFC 946) */
  214. #endif
  215. #ifndef    TELOPT_3270REGIME
  216. #define    TELOPT_3270REGIME 29    /* 3270 regime (RFC 1041) */
  217. #endif
  218. #ifndef    TELOPT_X3PAD
  219. #define    TELOPT_X3PAD    30    /* X.3 PAD (RFC 1053) */
  220. #endif
  221. #ifndef    TELOPT_NAWS
  222. #define    TELOPT_NAWS    31    /* window size (RFC 1073) */
  223. #endif
  224. #ifndef    TELOPT_TSPEED
  225. #define    TELOPT_TSPEED    32    /* terminal speed (RFC 1079) */
  226. #endif
  227. #ifndef    TELOPT_LFLOW
  228. #define    TELOPT_LFLOW    33    /* remote flow control (RFC 1372) */
  229. #endif
  230. #ifndef TELOPT_LINEMODE
  231. #define TELOPT_LINEMODE    34    /* Linemode option (RFC 1184) */
  232. #endif
  233. #ifndef TELOPT_XDISPLOC
  234. #define TELOPT_XDISPLOC    35    /* X Display Location (RFC 1096) */
  235. #endif
  236. #ifndef TELOPT_OLD_ENVIRON
  237. #define TELOPT_OLD_ENVIRON 36    /* Old - Environment variables (RFC 1408) */
  238. #endif
  239. #ifndef    TELOPT_AUTHENTICATION
  240. #define    TELOPT_AUTHENTICATION 37/* Authenticate (RFC 1409) */
  241. #endif
  242. #ifndef    TELOPT_ENCRYPTION
  243. #define    TELOPT_ENCRYPTION 38    /* Encryption option (Borman,Tso) */
  244. #endif
  245. #ifndef TELOPT_NEWENVIRON
  246. #define TELOPT_NEWENVIRON 39    /* New - Environment variables (RFC 1572) */
  247. #endif
  248. #ifndef TELOPT_3270E
  249. #define TELOPT_3270E    40      /* 3270 Extended (RFC 1647) */
  250. #endif
  251. #ifndef TELOPT_XAUTH
  252. #define TELOPT_XAUTH    41      /* ??? (Earhart) */
  253. #endif
  254. #ifndef TELOPT_CHARSET
  255. #define TELOPT_CHARSET  42      /* Character-set (RFC 2066) */
  256. #endif
  257. #ifndef TELOPT_RSP
  258. #define TELOPT_RSP      43      /* Remote Serial Port (Barnes) */
  259. #endif
  260. #ifndef TELOPT_COM_PORT
  261. #define TELOPT_COM_PORT 44      /* Com Port Control (RFC 2217) */
  262. #endif
  263. #ifndef TELOPT_SLE
  264. #define TELOPT_SLE      45      /* Suppress Local Echo (Atmar) - rejected */
  265. #endif
  266. #ifndef TELOPT_START_TLS
  267. #define TELOPT_START_TLS 46     /* Start TLS Authentication/Encryption */
  268. #endif                          /* (Boe) */
  269. #ifndef TELOPT_KERMIT
  270. #define TELOPT_KERMIT   47      /* Kermit (altman) */
  271. #endif
  272. #ifndef TELOPT_SEND_URL
  273. #define TELOPT_SEND_URL 48      /* Send URL */
  274. #endif
  275.  
  276. #ifndef TELOPT_FORWARD_X
  277. #define TELOPT_FORWARD_X 49     /* X Windows Forwarding (not yet allocated) */
  278. #endif /* TELOPT_FORWARD_X */
  279.  
  280. #ifndef TELOPT_PRAGMA_LOGON
  281. #define TELOPT_PRAGMA_LOGON 138 /* Encrypted Logon option (PragmaSys) */
  282. #endif
  283. #ifndef TELOPT_SSPI_LOGON
  284. #define TELOPT_SSPI_LOGON 139   /* MS SSPI Logon option (PragmaSys) */
  285. #endif
  286. #ifndef TELOPT_PRAGMA_HEARTBEAT
  287.                 /* Server Send Heartbeat option (PragmaSys) */
  288. #define TELOPT_PRAGMA_HEARTBEAT 140
  289. #endif
  290.  
  291. #define TELOPT_IBM_SAK 200      /* IBM Secure Attention Key */
  292.  
  293. /*
  294.   IBM Secure Attention Key (SAK) Option
  295.  
  296.   In addition to terminal negotiation, the telnet command allows
  297.   negotiation for the Secure Attention Key (SAK)
  298.   option. This option, when supported, provides the local user with
  299.   a secure communication path to the remote
  300.   host for tasks such as changing user IDs or passwords. If the remote
  301.   host supports the SAK function, a trusted
  302.   shell is opened on the remote host when the telnet send sak
  303.   subcommand is issued. The SAK function can
  304.   also be assigned to a single key available in telnet input mode,
  305.   using the set sak subcommand.
  306.  
  307.   TN_SAK
  308.  
  309.   Sends the TELNET SAK (Secure Attention Key) sequence, which causes
  310.   the remote system to invoke the trusted shell. If the SAK is not
  311.   supported, then an error message is displayed that reads:
  312.     Remote side does not support SAK.
  313. */
  314.  
  315. #ifndef    TELOPT_EXOPL
  316. #define    TELOPT_EXOPL    255    /* Extended-options-list (RFC 861) */
  317. #endif
  318.  
  319. #ifdef NTELOPTS
  320. #undef NTELOPTS
  321. #endif /* NTELOPTS */
  322. /* The Telnet Option space is no longer being allocated by ICANN as a */
  323. /* continuous list.  In other words it is becoming sparse.  But we do */
  324. /* not want to have to allocate memory for a long list of strings and */
  325. /* structs which will never be used.  Therefore, the NTELOPTS define  */
  326. /* can no longer be equal to TELOPT_LAST+1.  In fact, the notion of   */
  327. /* TELOPT_FIRST and TELOPT_LAST no longer make sense.                 */
  328. #define    NTELOPTS        54
  329.  
  330. #define TELOPT_FIRST     TELOPT_BINARY
  331. #define TELOPT_LAST      TELOPT_IBM_SAK
  332.  
  333. /*
  334.   The following macros speed us up at runtime but are too complex
  335.   for some preprocessors / compilers; if your compiler bombs on ckctel.c
  336.   with "Instruction table overflow" or somesuch, rebuild with -DNOTOMACROS.
  337. */
  338. #ifndef NOTOMACROS
  339. #ifndef TELOPT_MACRO
  340. #define TELOPT_MACRO
  341. #endif /* TELOPT_MACRO */
  342. #endif /* NOTOMACROS */
  343.  
  344. #ifdef TELOPT_MACRO
  345. #define TELOPT_INDEX(x) (((x)>=0 && (x)<= TELOPT_FORWARD_X)?(x):\
  346.         ((x)>=TELOPT_PRAGMA_LOGON && (x)<=TELOPT_PRAGMA_HEARTBEAT)?(x)-89: \
  347.         ((x) == TELOPT_IBM_SAK)?(x)-148: NTELOPTS)
  348.  
  349. #define    TELOPT_OK(x)    (((x) >= TELOPT_BINARY && (x) <= TELOPT_FORWARD_X) ||\
  350.              ((x) >= TELOPT_PRAGMA_LOGON && (x) <= TELOPT_PRAGMA_HEARTBEAT) ||\
  351.              ((x) == TELOPT_IBM_SAK))
  352. #define    TELOPT(x)    (TELOPT_OK(x)?telopts[TELOPT_INDEX(x)]:"UNKNOWN")
  353. #else /* TELOPT_MACRO */
  354. _PROTOTYP(int telopt_index,(int));
  355. _PROTOTYP(int telopt_ok,(int));
  356. _PROTOTYP(CHAR * telopt, (int));
  357.  
  358. #define TELOPT_INDEX(x) telopt_index(x)
  359. #define TELOPT_OK(x)    telopt_ok(x)
  360. #define TELOPT(x)       telopt(x)
  361. #endif /* TELOPT_MACRO */
  362.  
  363. #ifdef TELOPTS
  364. char *telopts[NTELOPTS+2] = {
  365. /*   0 */ "BINARY",   "ECHO",         "RCP",  "SUPPRESS-GO-AHEAD",
  366. /*   4 */ "NAME",   "STATUS", "TIMING-MARK", "RCTE",
  367. /*   8 */ "NAOL", "NAOP",  "NAOCRD", "NAOHTS",
  368. /*  12 */ "NAOHTD", "NAOFFD", "NAOVTS",  "NAOVTD",
  369. /*  16 */ "NAOLFD", "EXTEND-ASCII", "LOGOUT", "BYTE-MACRO",
  370. /*  20 */ "DATA-ENTRY-TERMINAL", "SUPDUP", "SUPDUP-OUTPUT",  "SEND-LOCATION",
  371. /*  24 */ "TERMINAL-TYPE",  "END-OF-RECORD", "TACACS-UID", "OUTPUT-MARKING",
  372. /*  28 */ "TTYLOC", "3270-REGIME", "X.3-PAD", "NAWS",
  373. /*  32 */ "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC",
  374. /*  36 */ "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPTION", "NEW-ENVIRONMENT",
  375. /*  40 */ "TN3270E","XAUTH","CHARSET", "remote-serial-port",
  376. /*  44 */ "COM-PORT-CONTROL","suppress-local-echo","start-tls","kermit",
  377. /*  48 */ "send-url", "forward-X",
  378. /* 138 */ "pragma-logon", "sspi-logon", "pragma-heartbeat",
  379. /* 200 */ "ibm-sak",
  380.           "unknown",
  381.     0
  382. };
  383. #else /*TELOPTS */
  384. extern char * telopts[];
  385. #endif /* TELOPTS */
  386.  
  387. /* TELNET Newline Mode */
  388.  
  389. #define TNL_CR     0            /* CR sends bare carriage return */
  390. #define TNL_CRNUL  1            /* CR and NUL */
  391. #define TNL_CRLF   2            /* CR and LF */
  392. #define TNL_LF     3            /* LF instead of CR */
  393.  
  394. /* TELNET Negotiation Mode */
  395.  
  396. #define    TN_NG_RF  0            /*  Negotiation REFUSED */
  397. #define    TN_NG_AC  1            /*  Negotiation ACCEPTED */
  398. #define    TN_NG_RQ  2            /*  Negotiation REQUESTED */
  399. #define    TN_NG_MU  3            /*  Negotiation REQUIRED (must) */
  400.  
  401.  
  402. /* Systems where we know we can define TELNET NAWS automatically. */
  403.  
  404. #ifndef CK_NAWS                /* In other words, if both */
  405. #ifdef CK_TTGWSIZ            /* TNCODE and TTGWSIZ are defined */
  406. #define CK_NAWS                /* then we can do NAWS. */
  407. #endif /* CK_TTGWSIZ */
  408. #endif /* CK_NAWS */
  409.  
  410. #ifdef CK_FORWARD_X
  411. #define MAXFWDX 64                      /* Num of X windows to be fwd'd */
  412. #endif /* MAXFWDX */
  413.  
  414. /* Telnet State structures and definitions */
  415. struct _telopt_state {
  416.   unsigned char def_server_me_mode;   /* Default Negotiation Mode */
  417.   unsigned char def_server_u_mode;    /* Default Negotiation Mode */
  418.   unsigned char def_client_me_mode;   /* Default Negotiation Mode */
  419.   unsigned char def_client_u_mode;    /* Default Negotiation Mode */
  420.   unsigned char me_mode;              /* Telnet Negotiation Mode */
  421.   unsigned char u_mode;               /* Telnet Negotiation Mode */
  422.   unsigned char me;                   /* Am I ?                  */
  423.   unsigned char u;                    /* Are you?                */
  424.   unsigned char unanswered_will;      /* Sent Will, Waiting for DO/DONT */
  425.   unsigned char unanswered_do;        /* Send DO, Waiting for WILL/WONT */
  426.   unsigned char unanswered_wont;      /* Sent WONT, Waiting for DONT */
  427.   unsigned char unanswered_dont;      /* Sent DONT, Waiting for WONT */
  428.   unsigned char unanswered_sb;        /* Sent SB,   Waiting for SB (server) */
  429.   union {
  430. #ifdef IKS_OPTION
  431.     struct _telopt_kermit {         /* Kermit Option States */
  432.       unsigned char me_start;       /* I have a Server active */
  433.       unsigned char me_req_start;   /* Sent Req-Start, Waiting for response */
  434.       unsigned char me_req_stop;    /* Sent Req-Stop, Waiting for response  */
  435.       unsigned char u_start;        /* You have a Server active */
  436.       unsigned char sop;            /* Have we received the SOP char? */
  437.     } kermit;
  438. #endif /* IKS_OPTION */
  439. #ifdef CK_ENCRYPTION
  440.     struct _telopt_encrypt {        /* Encryption Option States */
  441.       unsigned char need_to_send;
  442.       unsigned char  stop;          /* Is encryption stopped?   */
  443.     } encrypt;
  444. #endif /* CK_ENCRYPTION */
  445. #ifdef CK_NAWS
  446.     struct _telopt_naws {           /* NAWS Option Information  */
  447.       unsigned char need_to_send;
  448.       int x;                        /* Last Width               */
  449.       int y;                        /* Last Height              */
  450.     } naws;
  451. #endif /* CK_NAWS */
  452. #ifdef CK_SSL
  453.     struct _telopt_start_tls {      /* Start TLS Option             */
  454.        unsigned char u_follows;     /* u ready for TLS negotiation  */
  455.        unsigned char me_follows;    /* me ready for TLS negotiation */
  456.     } start_tls;
  457. #endif /* CK_SSL */
  458.     struct _telopt_term {          /* Terminal Type            */
  459.        unsigned char need_to_send;
  460.        unsigned char type[41];     /* Last terminal type       */
  461.     } term;
  462. #ifdef CK_ENVIRONMENT
  463.     struct _telopt_new_env {
  464.        unsigned char need_to_send;
  465.        unsigned char * str;
  466.        int             len;
  467.     } env;
  468. #ifdef CK_XDISPLOC
  469.     struct _telopt_xdisp {
  470.        unsigned char need_to_send;
  471.     } xdisp;
  472. #endif /* CK_XDISPLOC */
  473. #endif /* CK_ENVIRONMENT */
  474. #ifdef CK_SNDLOC
  475.     struct _telopt_sndloc {
  476.        unsigned char need_to_send;
  477.     } sndloc;
  478. #endif /* CK_SNDLOC */
  479. #ifdef CK_FORWARD_X
  480.     struct _telopt_fwd_x {
  481.         unsigned char need_to_send;
  482.         int listen_socket;
  483.         struct _channel {
  484.             int fd;
  485.             int id;
  486.         } channel[MAXFWDX];
  487. #ifdef NT
  488.         int thread_started;
  489. #endif /* NT */
  490.     } forward_x;
  491. #endif /* CK_FORWARD_X */
  492.     /* additional options such as New Environment or Send Location */
  493.   } sb;
  494. };
  495. typedef struct _telopt_state telopt_state, *p_telopt_state;
  496.  
  497. /* telopt_states[] is the array of structs which the state of each telnet */
  498. /* option is stored.  We allocate one more than we need in case we are    */
  499. /* sent telnet options that we do not recognize.  If by some chance the   */
  500. /* TELOPT_OK() check is skipped, TELOPT_INDEX() will force the option to  */
  501. /* use the extra cell.                                                    */
  502.  
  503. #ifdef TELOPT_STATES
  504. telopt_state telopt_states[NTELOPTS+1];
  505. #else /* TELOPT_STATES */
  506. extern telopt_state telopt_states[];
  507. #endif /* TELOPT_STATES */
  508.  
  509. #define TELOPT_ME(x) (telopt_states[TELOPT_INDEX(x)].me)
  510. #define TELOPT_U(x)  (telopt_states[TELOPT_INDEX(x)].u)
  511. #define TELOPT_ME_MODE(x) \
  512.         (telopt_states[TELOPT_INDEX(x)].me_mode)
  513. #define TELOPT_U_MODE(x)  \
  514.         (telopt_states[TELOPT_INDEX(x)].u_mode)
  515. #define TELOPT_UNANSWERED_WILL(x) \
  516.         (telopt_states[TELOPT_INDEX(x)].unanswered_will)
  517. #define TELOPT_UNANSWERED_DO(x)   \
  518.         (telopt_states[TELOPT_INDEX(x)].unanswered_do)
  519. #define TELOPT_UNANSWERED_WONT(x) \
  520.         (telopt_states[TELOPT_INDEX(x)].unanswered_wont)
  521. #define TELOPT_UNANSWERED_DONT(x)   \
  522.         (telopt_states[TELOPT_INDEX(x)].unanswered_dont)
  523. #define TELOPT_UNANSWERED_SB(x)   \
  524.         (telopt_states[TELOPT_INDEX(x)].unanswered_sb)
  525. #define TELOPT_SB(x) \
  526.         (telopt_states[TELOPT_INDEX(x)].sb)
  527. #define TELOPT_DEF_S_ME_MODE(x) \
  528.         (telopt_states[TELOPT_INDEX(x)].def_server_me_mode)
  529. #define TELOPT_DEF_S_U_MODE(x)  \
  530.         (telopt_states[TELOPT_INDEX(x)].def_server_u_mode)
  531. #define TELOPT_DEF_C_ME_MODE(x) \
  532.         (telopt_states[TELOPT_INDEX(x)].def_client_me_mode)
  533. #define TELOPT_DEF_C_U_MODE(x)  \
  534.         (telopt_states[TELOPT_INDEX(x)].def_client_u_mode)
  535.  
  536. #ifdef TELOPT_MODES
  537. char * telopt_modes[4] = {
  538.     "REFUSED", "ACCEPTED", "REQUESTED", "REQUIRED"
  539. };
  540. #else /* TELOPT_MODES */
  541. extern char * telopt_modes[];
  542. #endif /* TELOPT_MODES */
  543.  
  544. #ifdef TELOPT_MACRO
  545. #define    TELOPT_MODE_OK(x) ((unsigned int)(x) <= TN_NG_MU)
  546. #define    TELOPT_MODE(x) (TELOPT_MODE_OK(x)?telopt_modes[(x)-TN_NG_RF]:"UNKNOWN")
  547. #else /* TELOPT_MACRO */
  548. _PROTOTYP(int telopt_mode_ok,(int));
  549. _PROTOTYP(CHAR * telopt_mode,(int));
  550.  
  551. #define TELOPT_MODE_OK(x) telopt_mode_ok(x)
  552. #define TELOPT_MODE(x)    telopt_mode(x)
  553. #endif /* TELOPT_MACRO */
  554.  
  555. /* Sub-option qualifiers */
  556. #define    TELQUAL_IS    0    /* option is... */
  557. #define    TELQUAL_SEND    1    /* send option */
  558. #define    TELQUAL_INFO    2    /* ENVIRON: informational version of IS */
  559. #define    TELQUAL_REPLY    2    /* AUTHENTICATION: client version of IS */
  560. #define    TELQUAL_NAME    3    /* AUTHENTICATION: client version of IS */
  561.  
  562. #define TEL_ENV_VAR     0
  563. #define TEL_ENV_VALUE   1
  564. #define TEL_ENV_ESC     2
  565. #define TEL_ENV_USERVAR 3
  566.  
  567. #define    LFLOW_OFF        0    /* Disable remote flow control */
  568. #define    LFLOW_ON        1    /* Enable remote flow control */
  569. #define    LFLOW_RESTART_ANY    2    /* Restart output on any char */
  570. #define    LFLOW_RESTART_XON    3    /* Restart output only on XON */
  571.  
  572. /*
  573.  * LINEMODE suboptions
  574.  */
  575.  
  576. #define    LM_MODE        1
  577. #define    LM_FORWARDMASK    2
  578. #define    LM_SLC        3
  579.  
  580. #define    MODE_EDIT    0x01
  581. #define    MODE_TRAPSIG    0x02
  582. #define    MODE_ACK    0x04
  583. #define MODE_SOFT_TAB    0x08
  584. #define MODE_LIT_ECHO    0x10
  585.  
  586. #define    MODE_MASK    0x1f
  587.  
  588. /* Not part of protocol, but needed to simplify things... */
  589. #define MODE_FLOW        0x0100
  590. #define MODE_ECHO        0x0200
  591. #define MODE_INBIN        0x0400
  592. #define MODE_OUTBIN        0x0800
  593. #define MODE_FORCE        0x1000
  594.  
  595. #define    SLC_SYNCH    1
  596. #define    SLC_BRK        2
  597. #define    SLC_IP        3
  598. #define    SLC_AO        4
  599. #define    SLC_AYT        5
  600. #define    SLC_EOR        6
  601. #define    SLC_ABORT    7
  602. #define    SLC_EOF        8
  603. #define    SLC_SUSP    9
  604. #define    SLC_EC        10
  605. #define    SLC_EL        11
  606. #define    SLC_EW        12
  607. #define    SLC_RP        13
  608. #define    SLC_LNEXT    14
  609. #define    SLC_XON        15
  610. #define    SLC_XOFF    16
  611. #define    SLC_FORW1    17
  612. #define    SLC_FORW2    18
  613. #define SLC_MCL         19
  614. #define SLC_MCR         20
  615. #define SLC_MCWL        21
  616. #define SLC_MCWR        22
  617. #define SLC_MCBOL       23
  618. #define SLC_MCEOL       24
  619. #define SLC_INSRT       25
  620. #define SLC_OVER        26
  621. #define SLC_ECR         27
  622. #define SLC_EWR         28
  623. #define SLC_EBOL        29
  624. #define SLC_EEOL        30
  625.  
  626. #define    NSLC        30
  627.  
  628. /*
  629.  * For backwards compatability, we define SLC_NAMES to be the
  630.  * list of names if SLC_NAMES is not defined.
  631.  */
  632. #define    SLC_NAMELIST    "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
  633.             "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
  634.             "LNEXT", "XON", "XOFF", "FORW1", "FORW2", \
  635.                         "MCL", "MCR", "MCWL", "MCWR", "MCBOL", "MCEOL", \
  636.                         "INSRT", "OVER", "ECR", "EWR", "EBOL", "EEOL", 0
  637. #ifdef    SLC_NAMES
  638. char *slc_names[] = {
  639.     SLC_NAMELIST
  640. };
  641. #else
  642. extern char *slc_names[];
  643. #define    SLC_NAMES SLC_NAMELIST
  644. #endif
  645.  
  646. #define    SLC_NAME_OK(x)    ((unsigned int)(x) <= NSLC)
  647. #define SLC_NAME(x)    (SLC_NAME_OK(x)?slc_names[x]:"UNKNOWN")
  648.  
  649. #define    SLC_NOSUPPORT    0
  650. #define    SLC_CANTCHANGE    1
  651. #define    SLC_VARIABLE    2
  652. #define    SLC_DEFAULT    3
  653. #define    SLC_LEVELBITS    0x03
  654.  
  655. #define    SLC_FUNC    0
  656. #define    SLC_FLAGS    1
  657. #define    SLC_VALUE    2
  658.  
  659. #define    SLC_ACK        0x80
  660. #define    SLC_FLUSHIN    0x40
  661. #define    SLC_FLUSHOUT    0x20
  662.  
  663. #define    OLD_ENV_VAR    1
  664. #define    OLD_ENV_VALUE    0
  665. #define    NEW_ENV_VAR    0
  666. #define    NEW_ENV_VALUE    1
  667. #define    ENV_ESC        2
  668. #define ENV_USERVAR    3
  669.  
  670. #define FWDX_SCREEN     0
  671. #define FWDX_OPEN       1
  672. #define FWDX_CLOSE      2
  673. #define FWDX_DATA       3
  674.  
  675. /*
  676.  * AUTHENTICATION suboptions
  677.  */
  678.  
  679. /*
  680.  * Who is authenticating who ...
  681.  */
  682. #define    AUTH_CLIENT_TO_SERVER    0    /* Client authenticating server */
  683. #define    AUTH_SERVER_TO_CLIENT    1    /* Server authenticating client */
  684. #define    AUTH_WHO_MASK        1
  685.  
  686. /*
  687.  * amount of authentication done
  688.  */
  689. #define    AUTH_HOW_ONE_WAY    0
  690. #define    AUTH_HOW_MUTUAL        2
  691. #define    AUTH_HOW_MASK        2
  692.  
  693. /*
  694.  * should we be encrypting?
  695.  */
  696. #define AUTH_ENCRYPT_OFF         0
  697. #define AUTH_ENCRYPT_USING_TELOPT    4
  698. #define AUTH_ENCRYPT_AFTER_EXCHANGE 16
  699. #define AUTH_ENCRYPT_RESERVED       20
  700. #define AUTH_ENCRYPT_MASK        20
  701.  
  702. /*
  703.  * will we be forwarding?
  704.  * if we want to activate the use of this flag then
  705.  *   #define USE_INI_CRED_FWD
  706.  */
  707. #define INI_CRED_FWD_OFF    0
  708. #define INI_CRED_FWD_ON        8
  709. #define INI_CRED_FWD_MASK    8
  710. #define USE_INI_CRED_FWD
  711.  
  712. #define    AUTHTYPE_NULL        0
  713. #define    AUTHTYPE_KERBEROS_V4    1
  714. #define    AUTHTYPE_KERBEROS_V5    2
  715. #define    AUTHTYPE_SPX        3
  716. #define    AUTHTYPE_MINK        4
  717. #define AUTHTYPE_SRP            5
  718. #define AUTHTYPE_RSA            6
  719. #define AUTHTYPE_SSL            7
  720. #define AUTHTYPE_LOKI          10
  721. #define AUTHTYPE_SSA           11
  722. #define AUTHTYPE_KEA_SJ        12
  723. #define AUTHTYPE_KEA_INTEG     13
  724. #define AUTHTYPE_DSS           14
  725. #define AUTHTYPE_NTLM          15
  726. #ifdef AUTHTYPE_CNT
  727. #undef AUTHTYPE_CNT
  728. #endif /* AUTHTYPE_CNT */
  729. #define    AUTHTYPE_CNT           16
  730.  
  731. /*
  732.  * AUTHTYPEs Last updated 21 March 1999
  733.  * from http://www.isi.edu/in-notes/iana/assignments/telnet-options
  734.  */
  735.  
  736. #define    AUTHTYPE_AUTO        99
  737.  
  738. #ifdef    AUTH_NAMES
  739. char *authtype_names[] = {
  740.     "NULL",                     /* RFC 1416 */
  741.     "KERBEROS_V4",              /* RFC 1416 */
  742.     "KERBEROS_V5",              /* RFC 1416 */
  743.     "SPX",                      /* RFC 1416 */
  744.     "MINK",                     /* Unknown */
  745.     "SRP",                      /* Wu */
  746.     "RSA",                      /* RFC 1416 */
  747.     "SSL",                      /* Hudson */
  748.     "IANA_8",                   /* not assigned by IANA */
  749.     "IANA_9",                   /* not assigned by IANA */
  750.     "LOKI",                     /* RFC 1416 */
  751.     "SSA",                      /* Schoch */
  752.     "KEA_SJ",                   /* Horting */
  753.     "KEA_SJ_INTEG",             /* Horting */
  754.     "DSS",                      /* Horting */
  755.     "NTLM",                     /* Kahn <louisk@microsoft.com> */
  756.     0
  757. };
  758. char * authmode_names[] = {
  759.     "CLIENT_TO_SERVER|ONE_WAY",
  760.     "SERVER_TO_CLIENT|ONE_WAY",
  761.     "CLIENT_TO_SERVER|MUTUAL",
  762.     "SERVER_TO_CLIENT|MUTUAL",
  763.     "CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_USING_TELOPT",
  764.     "SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_USING_TELOPT",
  765.     "CLIENT_TO_SERVER|MUTUAL|ENCRYPT_USING_TELOPT",
  766.     "SERVER_TO_CLIENT|MUTUAL|ENCRYPT_USING_TELOPT",
  767.     "CLIENT_TO_SERVER|ONE_WAY|CRED_FWD",
  768.     "SERVER_TO_CLIENT|ONE_WAY|CRED_FWD",
  769.     "CLIENT_TO_SERVER|MUTUAL|CRED_FWD",
  770.     "SERVER_TO_CLIENT|MUTUAL|CRED_FWD",
  771.     "CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_USING_TELOPT|CRED_FWD",
  772.     "SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_USING_TELOPT|CRED_FWD",
  773.     "CLIENT_TO_SERVER|MUTUAL|ENCRYPT_USING_TELOPT|CRED_FWD",
  774.     "SERVER_TO_CLIENT|MUTUAL|ENCRYPT_USING_TELOPT|CRED_FWD",
  775.     "CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_AFTER_EXCHANGE",
  776.     "SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_AFTER_EXCHANGE",
  777.     "CLIENT_TO_SERVER|MUTUAL|ENCRYPT_AFTER_EXCHANGE",
  778.     "SERVER_TO_CLIENT|MUTUAL|ENCRYPT_AFTER_EXCHANGE",
  779.     "CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_RESERVED",
  780.     "SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_RESERVED",
  781.     "CLIENT_TO_SERVER|MUTUAL|ENCRYPT_RESERVED",
  782.     "SERVER_TO_CLIENT|MUTUAL|ENCRYPT_RESERVED",
  783.     "CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_AFTER_EXCHANGE|CRED_FWD",
  784.     "SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_AFTER_EXCHANGE|CRED_FWD",
  785.     "CLIENT_TO_SERVER|MUTUAL|ENCRYPT_AFTER_EXCHANGE|CRED_FWD",
  786.     "SERVER_TO_CLIENT|MUTUAL|ENCRYPT_AFTER_EXCHANGE|CRED_FWD",
  787.     "CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_RESERVED|CRED_FWD",
  788.     "SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_RESERVED|CRED_FWD",
  789.     "CLIENT_TO_SERVER|MUTUAL|ENCRYPT_RESERVED|CRED_FWD",
  790.     "SERVER_TO_CLIENT|MUTUAL|ENCRYPT_RESERVED|CRED_FWD",
  791.     0
  792. };
  793. #else
  794. extern char *authtype_names[];
  795. extern char *authmode_names[];
  796. #endif
  797. #define AUTHMODE_CNT  32
  798.  
  799. #define    AUTHTYPE_NAME_OK(x)    ((unsigned int)(x) < AUTHTYPE_CNT)
  800. #define    AUTHTYPE_NAME(x)      (AUTHTYPE_NAME_OK(x)?authtype_names[x]:"UNKNOWN")
  801.  
  802. #define    AUTHMODE_NAME_OK(x)    ((unsigned int)(x) < AUTHMODE_CNT)
  803. #define    AUTHMODE_NAME(x)      (AUTHMODE_NAME_OK(x)?authmode_names[x]:"UNKNOWN")
  804.  
  805. /* Kerberos Authentication Message Identifiers */
  806. #define    KRB_AUTH        0    /* Authentication data follows */
  807. #define    KRB_REJECT        1    /* Rejected (reason might follow) */
  808. #define    KRB_ACCEPT        2    /* Accepted */
  809. #define KRB4_CHALLENGE        3
  810. #define KRB4_RESPONSE        4
  811. #define    KRB5_RESPONSE        3    /* Response for mutual auth. */
  812. #define KRB5_FORWARD            4       /* Forwarded credentials follow */
  813. #define KRB5_FORWARD_ACCEPT     5       /* Forwarded credentials accepted */
  814. #define KRB5_FORWARD_REJECT     6       /* Forwarded credentials rejected */
  815.  
  816. /* Secure Remote Password Authentication Message Identifiers */
  817. #define    SRP_AUTH        0    /* Authentication data follows */
  818. #define    SRP_REJECT        1    /* Rejected (reason might follow) */
  819. #define    SRP_ACCEPT        2    /* Accepted */
  820. #define SRP_CHALLENGE        3
  821. #define SRP_RESPONSE        4
  822. #define SRP_EXP                 8       /* */
  823. #define SRP_PARAMS              9       /* */
  824.  
  825. /* Telnet Auth using KEA and SKIPJACK */
  826.  
  827. #define KEA_CERTA_RA              1
  828. #define KEA_CERTB_RB_IVB_NONCEB   2
  829. #define KEA_IVA_RESPONSEB_NONCEA  3
  830. #define KEA_RESPONSEA             4
  831.  
  832. /* Tim Hudson's SSL Authentication Message Identifiers */
  833. #define SSL_START     1
  834. #define SSL_ACCEPT    2
  835. #define SSL_REJECT    3
  836.  
  837. /* Microsoft NTLM Authentication Message Identifiers */
  838. #define NTLM_AUTH   0
  839. #define NTLM_CHALLENGE 1
  840. #define NTLM_RESPONSE  2
  841. #define NTLM_ACCEPT 3
  842. #define NTLM_REJECT 4
  843.  
  844. /* Generic Constants */
  845. #define AUTH_SUCCESS    0
  846. #define AUTH_FAILURE    255
  847.  
  848. /*
  849.  * ENCRYPTion suboptions
  850.  */
  851. #define    ENCRYPT_IS        0    /* I pick encryption type ... */
  852. #define    ENCRYPT_SUPPORT        1    /* I support encryption types ... */
  853. #define    ENCRYPT_REPLY        2    /* Initial setup response */
  854. #define    ENCRYPT_START        3    /* Am starting to send encrypted */
  855. #define    ENCRYPT_END        4    /* Am ending encrypted */
  856. #define    ENCRYPT_REQSTART    5    /* Request you start encrypting */
  857. #define    ENCRYPT_REQEND        6    /* Request you send encrypting */
  858. #define    ENCRYPT_ENC_KEYID    7
  859. #define    ENCRYPT_DEC_KEYID    8
  860. #define    ENCRYPT_CNT        9
  861.  
  862. #define    ENCTYPE_ANY        0
  863. #define    ENCTYPE_DES_CFB64    1
  864. #define    ENCTYPE_DES_OFB64    2
  865. #define ENCTYPE_DES3_CFB64      3
  866. #define ENCTYPE_DES3_OFB64      4
  867. #define ENCTYPE_CAST5_40_CFB64  8
  868. #define ENCTYPE_CAST5_40_OFB64  9
  869. #define ENCTYPE_CAST128_CFB64   10
  870. #define ENCTYPE_CAST128_OFB64   11
  871. #ifdef ENCTYPE_CNT
  872. #undef ENCTYPE_CNT
  873. #endif
  874. #define ENCTYPE_CNT             12
  875.  
  876. #ifdef    ENCRYPT_NAMES
  877. char *encrypt_names[] = {
  878.     "IS", "SUPPORT", "REPLY", "START", "END",
  879.     "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
  880.     0
  881. };
  882. char *enctype_names[] = {
  883.     "ANY",
  884.     "DES_CFB64",                /* Ts'o */
  885.     "DES_OFB64",                /* Ts'o */
  886.     "DES3_CFB64",               /* Altman */
  887.     "DES3_OFB64",               /* Altman */
  888.     "UNKNOWN-5",
  889.     "UNKNOWN-6",
  890.     "UNKNOWN-7",
  891.     "CAST5_40_CFB64",           /* Wu */
  892.     "CAST5_40_OFB64",           /* Wu */
  893.     "CAST128_CFB64",            /* Wu */
  894.     "CAST128_OFB64",            /* Wu */
  895.     0
  896. };
  897. #else
  898. extern char *encrypt_names[];
  899. extern char *enctype_names[];
  900. #endif
  901.  
  902. #define    ENCRYPT_NAME_OK(x)    ((unsigned int)(x) < ENCRYPT_CNT)
  903. #define    ENCRYPT_NAME(x)        encrypt_names[x]
  904.  
  905. #define    ENCTYPE_NAME_OK(x)    ((unsigned int)(x) < ENCTYPE_CNT)
  906. #define    ENCTYPE_NAME(x)        enctype_names[x]
  907.  
  908. /* For setting the state of validUser */
  909.  
  910. #define AUTH_REJECT     0       /* Rejected */
  911. #define AUTH_UNKNOWN    1       /* We don't know who he is, but he's okay */
  912. #define AUTH_OTHER      2       /* We know him, but not his name */
  913. #define AUTH_USER       3       /* We know he name */
  914. #define AUTH_VALID      4       /* We know him, and he needs no password */
  915.  
  916. /* Kermit Option Subnegotiations */
  917.  
  918. #define KERMIT_START      0
  919. #define KERMIT_STOP       1
  920. #define KERMIT_REQ_START  2
  921. #define KERMIT_REQ_STOP   3
  922. #define KERMIT_SOP        4
  923. #define KERMIT_RESP_START 8
  924. #define KERMIT_RESP_STOP  9
  925.  
  926. /* For SET TELNET AUTH HOW  */
  927. #define TN_AUTH_HOW_ANY     0
  928. #define TN_AUTH_HOW_ONE_WAY 1
  929. #define TN_AUTH_HOW_MUTUAL  2
  930.  
  931. /* For SET TELNET AUTH ENCRYPT */
  932. #define TN_AUTH_ENC_ANY     0
  933. #define TN_AUTH_ENC_NONE    1
  934. #define TN_AUTH_ENC_TELOPT  2
  935. #define TN_AUTH_ENC_EXCH    3  /* not used in Kermit */
  936.  
  937. /* Telnet protocol functions defined in C-Kermit */
  938.  
  939. _PROTOTYP( int tn_ini, (void) );    /* Telnet protocol support */
  940. _PROTOTYP( int tn_reset, (void));
  941. _PROTOTYP( int tn_set_modes, (void));
  942. _PROTOTYP( int tn_sopt, (int, int) );
  943. _PROTOTYP( int tn_doop, (CHAR, int, int (*)(int) ) );
  944. _PROTOTYP( int tn_sttyp, (void) );
  945. _PROTOTYP( int tn_snenv, (CHAR *, int) ) ;
  946. _PROTOTYP( int tn_rnenv, (CHAR *, int) ) ;
  947. _PROTOTYP( int tn_wait, (char *) ) ;
  948. _PROTOTYP( int tn_push, (void) ) ;
  949. _PROTOTYP( int tnsndbrk, (void) );
  950. _PROTOTYP( VOID tn_debug, (char *));
  951. #ifdef IKS_OPTION
  952. _PROTOTYP( int tn_siks, (int) );
  953. _PROTOTYP( int iks_wait, (int, int) );
  954. #endif /* IKS_OPTION */
  955. #ifdef CK_NAWS
  956. _PROTOTYP( int tn_snaws, (void) );
  957. #endif /* CK_NAWS */
  958. #ifdef CK_XDISPLOC
  959. _PROTOTYP( int tn_sxdisploc, (void) );
  960. #endif /* CK_XDISPLOC */
  961. #ifdef CK_SNDLOC
  962. _PROTOTYP( int tn_sndloc, (void) );
  963. #endif /* CK_SNDLOC */
  964. #ifdef CK_FORWARD_X
  965. _PROTOTYP( int fwdx_create_listen_socket,(int));
  966. _PROTOTYP( int fwdx_open_client_channel,(int));
  967. _PROTOTYP( int fwdx_open_server_channel,(VOID));
  968. _PROTOTYP( int fwdx_close_channel,(int));
  969. _PROTOTYP( int fwdx_write_data_to_channel,(int, char *,int));
  970. _PROTOTYP( int fwdx_send_data_from_channel,(int, char *,int));
  971. _PROTOTYP( int fwdx_close_all,(VOID));
  972. _PROTOTYP( int fwdx_tn_sb,(unsigned char *, int));
  973. _PROTOTYP( int tn_sndfwdx, (void));
  974. _PROTOTYP( int fwdx_send_close,(int));
  975. _PROTOTYP( int fwdx_send_open,(int));
  976. _PROTOTYP( VOID fwdx_check_sockets,(fd_set *));
  977. _PROTOTYP( int fwdx_init_fd_set,(fd_set *));
  978. #ifdef NT
  979. _PROTOTYP( VOID fwdx_thread,(VOID *));
  980. #endif /* NT */
  981. #endif /* CK_FORWARD_X */
  982.  
  983. #ifndef CKCTEL_C            /* These are declared in ckctel.c */
  984. extern int tn_init;                     /* Telnet protocol initialized flag */
  985. extern char *tn_term;            /* Terminal type override */
  986. extern int sstelnet;                    /* Server side telnet? */
  987. extern int tn_deb;            /* Telnet option debugging flag */
  988. #endif /* CKCTEL_C */
  989. #endif /* CKCTEL_H */
  990.