home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / c-kermit / ckcker.h < prev    next >
C/C++ Source or Header  |  2020-01-01  |  46KB  |  1,426 lines

  1. /* ckcker.h -- Symbol and macro definitions for C-Kermit */
  2.  
  3. /*
  4.   Author: Frank da Cruz <fdc@columbia.edu>,
  5.   Columbia University Academic Information Systems, New York City.
  6.  
  7.   Copyright (C) 1985, 2009,
  8.     Trustees of Columbia University in the City of New York.
  9.     All rights reserved.  See the C-Kermit COPYING.TXT file or the
  10.     copyright text in the ckcmai.c module for disclaimer and permissions.
  11. */
  12.  
  13. #ifndef CKCKER_H
  14. #define CKCKER_H
  15.  
  16. #define I_AM_KERMIT  0            /* Personalities */
  17. #define I_AM_TELNET  1
  18. #define I_AM_RLOGIN  2
  19. #define I_AM_IKSD    3
  20. #define I_AM_FTP     4
  21. #define I_AM_HTTP    5
  22. #define I_AM_SSHSUB  6
  23. #define I_AM_SSH     7
  24.  
  25. #ifndef NOSTREAMING
  26. #ifndef STREAMING
  27. #define STREAMING
  28. #endif /* STREAMING */
  29. #endif /* NOSTREAMING */
  30. /*
  31.   If NEWDEFAULTS is defined then:
  32.    - RECEIVE PACKET-LENGTH is 4095 rather than 90
  33.    - WINDOW is 30 rather than 1
  34.    - BLOCK-CHECK is 3 rather than 1
  35.    - FILE TYPE is BINARY rather than TEXT
  36. */
  37. #ifdef BIGBUFOK                /* (was OS2) */
  38. #ifndef NEWDEFAULTS
  39. #define NEWDEFAULTS
  40. #endif /* NEWDEFAULTS */
  41. #endif /* BIGBUFOK */
  42.  
  43. #ifdef NOICP                /* No Interactive Command Parser */
  44. #ifndef NOSPL                /* implies... */
  45. #define NOSPL                /* No Script Programming Language */
  46. #endif /* NOSPL */
  47. #ifndef NOCSETS                /* No character-set translation */
  48. #define NOCSETS                /* because the only way to set it up */
  49. #endif /* NOCSETS */            /* is with interactive commands */
  50. #endif /* NOICP */
  51.  
  52. #ifdef pdp11                /* There is a maximum number of */
  53. #ifndef NOCKSPEED            /* of -D's allowed on the CC */
  54. #define NOCKSPEED            /* command line, so some of them */
  55. #endif /* NOCKSPEED */            /* have to go here... */
  56. #ifndef NOREDIRECT
  57. #define NOREDIRECT
  58. #endif /* NOREDIRECT */
  59. #ifdef WHATAMI
  60. #undef WHATAMI
  61. #endif /* WHATAMI */
  62. #endif /* pdp11 */
  63.  
  64. #ifdef UIDBUFLEN
  65. #define LOGINLEN UIDBUFLEN
  66. #else
  67. #define LOGINLEN 32            /* Length of server login field */
  68. #endif /* UIDBUFLEN */
  69.  
  70. /* Bell values */
  71.  
  72. #define XYB_NONE  0            /* No bell */
  73. #define XYB_AUD   1            /* Audible bell */
  74. #define XYB_VIS   2            /* Visible bell */
  75. #define XYB_BEEP  0            /* Audible Beep */
  76. #define XYB_SYS   4            /* Audible System Sounds */
  77.  
  78. /* File status bits */
  79.  
  80. #define FS_OK   1            /* File transferred OK */
  81. #define FS_REFU 2            /* File was refused */
  82. #define FS_DISC 4            /* File was discarded */
  83. #define FS_INTR 8            /* Transfer was interrupted by user */
  84. #define FS_ERR  16            /* Fatal error during transfer */
  85.  
  86. /* Control-character (un)prefixing options */
  87.  
  88. #define PX_ALL  0            /* Prefix all control chars */
  89. #define PX_CAU  1            /* Unprefix cautiously */
  90. #define PX_WIL  2            /* Unprefix with wild abandon */
  91. #define PX_NON  3            /* Unprefix all (= prefix none) */
  92.  
  93. /* Destination codes */
  94.  
  95. #define  DEST_D 0    /*  DISK */
  96. #define  DEST_S 1    /*  SCREEN */
  97. #define  DEST_P 2    /*  PRINTER */
  98. #define  DEST_N 3    /*  NOWHERE (calibration run) */
  99.  
  100. /* File transfer protocols */
  101.  
  102. #define  PROTO_K    0    /*   Kermit   */
  103. #ifdef CK_XYZ
  104. #define  PROTO_X    1    /*   XMODEM     */
  105. #define  PROTO_XC   2    /*   XMODEM-CRC */
  106. #define  PROTO_Y    3    /*   YMODEM     */
  107. #define  PROTO_G    4    /*   YMODEM-g */
  108. #define  PROTO_Z    5    /*   ZMODEM   */
  109. #define  PROTO_O    6   /*   OTHER    */
  110. #define  NPROTOS    7   /*   How many */
  111. #else
  112. #define  NPROTOS    1   /*   How many */
  113. #endif /* CK_XYZ */
  114.  
  115. struct ck_p {                /* C-Kermit Protocol info structure */
  116.     char * p_name;            /* Protocol name */
  117.     int rpktlen;            /* Packet length - receive */
  118.     int spktlen;            /* Packet length - send */
  119.     int spktflg;            /* ... */
  120.     int winsize;            /* Window size */
  121.     int prefix;                /* Control-char prefixing options */
  122.     int fnca;                /* Filename collision action */
  123.     int fncn;                /* Filename conversion */
  124.     int fnsp;                /* Send filename path stripping */
  125.     int fnrp;                /* Receive filename path stripping */
  126.     char * h_b_init;        /* Host receive initiation string - text   */
  127.     char * h_t_init;        /* Host receive initiation string - binary */
  128.     char * h_x_init;        /* Host server string */
  129.     char * p_b_scmd;        /* SEND cmd for external protocol - text   */
  130.     char * p_t_scmd;        /* SEND cmd for external protocol - binary */
  131.     char * p_b_rcmd;        /* RECV cmd for external protocol - text   */
  132.     char * p_t_rcmd;        /* RECV cmd for external protocol - binary */
  133. };
  134.  
  135. struct filelist {            /* Send-file list element */
  136.     char * fl_name;            /* Filename */
  137.     int fl_mode;            /* Transfer mode */
  138.     char * fl_alias;            /* Name to send the file under */
  139.     struct filelist * fl_next;        /* Pointer to next element */
  140. };
  141.  
  142. /* Kermit system IDs and associated properties... */
  143.  
  144. struct sysdata {
  145.     char *sid_code;    /* Kermit system ID code */
  146.     char *sid_name;    /* Descriptive name */
  147.     short sid_unixlike;    /* Tree-structured directory with separators */
  148.     char  sid_dirsep;    /* Directory separator character if unixlike */
  149.     short sid_dev;    /* Can start with dev: */
  150.     short sid_case;    /* Bit mapped: 1 = case matters, 2 = case preserved */
  151.     short sid_recfm;    /* Text record separator */
  152. /*
  153.    0 = unknown or nonstream
  154.    1 = cr
  155.    2 = lf
  156.    3 = crlf
  157. */
  158. };
  159.  
  160. struct ssh_pf {                /* SSH port forwarding */
  161.     int    p1;                /* port to be forwarded */
  162.     char * host;            /* host */
  163.     int    p2;                /* port */
  164. };
  165.  
  166. #define SET_ON   1    /* General values for settings that can be ON */
  167. #define SET_OFF  0            /* OFF, */
  168. #define SET_AUTO 2            /* or AUTO */
  169.  
  170. #define PATH_OFF 0    /* Pathnames off (to be stripped) */
  171. #define PATH_REL 1      /* Pathnames on, left relative if possible */
  172. #define PATH_ABS 2      /* Pathnames absolute always */
  173. #define PATH_AUTO 4    /* Pathnames handled automatically */
  174.  
  175. /* GET Options */
  176.  
  177. #define GOPT_DEL 1            /* Delete source file */
  178. #define GOPT_REC 2            /* Recursive */
  179. #define GOPT_RES 4            /* Recover (Resend) */
  180. #define GOPT_CMD 8            /* Filename is a Command */
  181.  
  182. /* GET Transfer Modes */
  183.  
  184. #define GMOD_TXT 0            /* Text */
  185. #define GMOD_BIN 1            /* Binary */
  186. #define GMOD_AUT 2            /* Auto */
  187. #define GMOD_LBL 3            /* Labeled */
  188.  
  189. /* GET Filename Options */
  190.  
  191. #define GNAM_LIT 0            /* Literal */
  192. #define GNAM_CNV 1            /* Converted */
  193.  
  194. /* GET Pathname Options */
  195.  
  196. #define GPTH_OFF 0            /* Pathnames Off */
  197. #define GPTH_REL 1            /* Pathnames Relative */
  198. #define GPTH_ABX 2            /* Pathnames Absolute */
  199.  
  200. #ifndef NOSPL
  201. /*
  202.   The IF REMOTE-ONLY command is available only in versions
  203.   that actually can be used in remote mode, and only if we have
  204.   an interactive command parser.
  205. */
  206. #define CK_IFRO
  207. #ifdef MAC
  208. #undef CK_IFRO
  209. #else
  210. #ifdef GEMDOS
  211. #undef CK_IFRO
  212. #endif /* GEMDOS */
  213. #endif /* MAC */
  214. #endif /* NOSPL */
  215.  
  216. /* Systems whose CONNECT modules can execute Application Program Commands */
  217.  
  218. #ifdef NOSPL                /* Script programming language */
  219. #ifdef CK_APC                /* is required for APC. */
  220. #undef CK_APC
  221. #endif /* CK_APC */
  222. #ifndef NOAPC
  223. #define NOAPC
  224. #endif /* NOAPC */
  225. #ifndef NOAUTODL
  226. #define NOAUTODL
  227. #endif /* NOAUTODL */
  228. #endif /* NOSPL */
  229.  
  230. #ifndef NOAPC                /* Unless they said NO APC */
  231. #ifndef CK_APC                /* And they didn't already define it */
  232. #ifdef OS2                /* OS/2 gets it */
  233. #define CK_APC
  234. #endif /* OS2 */
  235. #ifdef UNIX                /* UNIX gets it */
  236. #define CK_APC
  237. #endif /* UNIX */
  238. #ifdef VMS                /* VMS too */
  239. #define CK_APC
  240. #endif /* VMS */
  241. #endif /* CK_APC */
  242. #endif /* NOAPC */
  243.  
  244. #ifdef CK_APC                /* APC buffer length */
  245. #ifndef APCBUFLEN            /* Should be no bigger than */
  246. #ifdef NOSPL                /* command buffer length */
  247. #define APCBUFLEN 608            /* (see ckucmd.h) but we can't */
  248. #else                    /* reference ckucmd.h symbols here */
  249. #define APCBUFLEN 4096
  250. #endif /* NOSPL */
  251. #endif /* APCBUFLEN */
  252. #define APC_OFF   0    /* APC OFF (disabled) */
  253. #define APC_ON    1    /* APC ON (enabled for non-dangerous commands) */
  254. #define APC_UNCH  2    /* APC UNCHECKED (enabled for ALL commands) bitmask */
  255. #define APC_NOINP 4     /* APC (enabled with no input allowed - bitmask) */
  256. #define APC_INACTIVE 0    /* APC not in use */
  257. #define APC_REMOTE   1    /* APC in use from Remote */
  258. #define APC_LOCAL    2    /* APC being used from within Kermit */
  259. #ifndef NOAUTODL
  260. #ifndef CK_AUTODL    /* Autodownload */
  261. #ifdef OS2
  262. #define CK_AUTODL
  263. #else
  264. #ifdef UNIX
  265. #define CK_AUTODL
  266. #else
  267. #ifdef VMS
  268. #define CK_AUTODL
  269. #else
  270. #ifdef CK_AUTODL
  271. #undef CK_AUTODL
  272. #endif /* CK_AUTODL  */
  273. #endif /* NOAUTODL */
  274. #endif /* VMS */
  275. #endif /* UNIX */
  276. #endif /* OS2 */
  277. #endif /* CK_AUTODL */
  278.  
  279. #else  /* CK_APC not defined */
  280.  
  281. #ifdef NOICP
  282. #ifdef UNIX
  283. #ifndef CK_AUTODL
  284. #define CK_AUTODL
  285. #endif /* CK_AUTODL */
  286. #endif /* UNIX */
  287. #else  /* Not NOICP... */
  288. #ifdef CK_AUTODL
  289. #undef CK_AUTODL
  290. #endif /* CK_AUTODL */
  291. #endif /* NOICP */
  292. #endif /* CK_APC */
  293.  
  294. #ifdef NOAUTODL
  295. #ifdef CK_AUTODL
  296. #undef CK_AUTODL
  297. #endif /* CK_AUTODL */
  298. #endif /* NOAUTODL */
  299.  
  300. /* Codes for what we are doing now - bit mask values */
  301.  
  302. #define W_NOTHING    0            /* Nothing */
  303. #define W_INIT       1            /* Initializing protocol */
  304. #define W_SEND       2            /* SENDing or MAILing */
  305. #define W_RECV       4            /* RECEIVEing or GETting */
  306. #define W_REMO       8            /* Doing a REMOTE command */
  307. #define W_CONNECT   16            /* CONNECT mode */
  308. #define W_COMMAND   32            /* Command mode */
  309. #define W_DIALING   64            /* Dialing a modem */
  310. #define W_FTP      128            /* FTP */
  311. #define W_FT_DELE   64            /* FTP MDELETE */
  312. #define W_KERMIT (W_INIT|W_SEND|W_RECV|W_REMO) /* Kermit protocol */
  313. #define W_XFER (W_INIT|W_SEND|W_RECV|W_REMO|W_FTP) /* File xfer any protocol */
  314.  
  315. #ifndef NOWHATAMI
  316. #ifndef WHATAMI
  317. #define WHATAMI
  318. #endif /* WHATAMI */
  319. #endif /* NOWHATAMI */
  320.  
  321. #ifdef WHATAMI                /* Bit mask positions for WHATAMI */
  322. #define WMI_SERVE   1            /* Server mode */
  323. #define WMI_FMODE   2            /* File transfer mode */
  324. #define WMI_FNAME   4            /* File name conversion */
  325. #define WMI_STREAM  8            /* I have a reliable transport */
  326. #define WMI_CLEAR  16            /* I have a clear channel */
  327. #define WMI_FLAG   32            /* Flag that WHATAMI field is valid */
  328. /* WHATAMI2 bits... */
  329. #define WMI2_XMODE  1            /* Transfer mode auto(0)/manual(1) */
  330. #define WMI2_RECU   2            /* Transfer is recursive */
  331. #define WMI2_FLAG  32            /* Flag that WHATAMI2 field is valid */
  332. #endif /* WHATAMI */
  333.  
  334. /* Terminal types */
  335. #define VT100     0            /* Also for VT52 mode */
  336. #define TEKTRONIX 1
  337.  
  338. /* Normal packet and window size */
  339.  
  340. #define MAXPACK 94            /* Maximum unextended packet size */
  341.                     /* Can't be more than 94. */
  342. #ifdef pdp11                /* Maximum sliding window slots */
  343. #define MAXWS  8
  344. #else
  345. #define MAXWS 32            /* Can't be more than 32. */
  346. #endif /* pdp11 */
  347.  
  348. /* Maximum long packet size for sending packets */
  349. /* Override these from cc command line via -DMAXSP=nnn */
  350.  
  351. #ifdef IRIX                /* Irix 6.4 and earlier has */
  352. #ifndef MAXSP                /* Telnet server bug */
  353. #ifdef IRIX65
  354. #define MAXSP 9024
  355. #else
  356. #define MAXSP 4000
  357. #endif /* IRIX65 */
  358. #endif /* MAXSP */
  359. #endif /* IRIX */
  360.  
  361. #ifdef DYNAMIC
  362. #ifndef MAXSP
  363. #define MAXSP 9024
  364. #endif /* MAXSP */
  365. #else  /* not DYNAMIC */
  366. #ifndef MAXSP
  367. #ifdef pdp11
  368. #define MAXSP 1024
  369. #else
  370. #define MAXSP 2048
  371. #endif /* pdp11 */
  372. #endif /* MAXSP */
  373. #endif /* DYNAMIC */
  374.  
  375. /* Maximum long packet size for receiving packets */
  376. /* Override these from cc command line via -DMAXRP=nnn */
  377.  
  378. #ifdef DYNAMIC
  379. #ifndef MAXRP
  380. #define MAXRP 9024
  381. #endif /* MAXRP */
  382. #else  /* not DYNAMIC */
  383. #ifndef MAXRP
  384. #ifdef pdp11
  385. #define MAXRP 1024
  386. #else
  387. #define MAXRP 2048
  388. #endif /* pdp11 */
  389. #endif /* MAXRP */
  390. #endif /* DYNAMIC */
  391. /*
  392.   Default sizes for windowed packet buffers.
  393.   Override these from cc command line via -DSBSIZ=nnn, -DRBSIZ=nnn.
  394.   Or just -DBIGBUFOK.
  395. */
  396. #ifndef MAXGETPATH            /* Maximum number of directories */
  397. #ifdef BIGBUFOK                /* for GET path... */
  398. #define MAXGETPATH 128
  399. #else
  400. #define MAXGETPATH 16
  401. #endif /* BIGBUFOK */
  402. #endif /* MAXGETPATH */
  403.  
  404. #ifndef NOSPL                /* Query buffer length */
  405. #ifdef OS2
  406. #define QBUFL 4095
  407. #else
  408. #ifdef BIGBUFOK
  409. #define QBUFL 4095
  410. #else
  411. #define QBUFL 1023
  412. #endif /* BIGBUFOK */
  413. #endif /* OS2 */
  414. #endif /* NOSPL */
  415.  
  416. #ifdef DYNAMIC
  417. #ifndef SBSIZ
  418. #ifdef BIGBUFOK                /* If big buffers are safe... */
  419. #define SBSIZ 290000            /* Allow for 10 x 9024 or 20 x 4096 */
  420. #else                    /* Otherwise... */
  421. #ifdef pdp11
  422. #define SBSIZ 3020
  423. #else
  424. #define SBSIZ 9050            /* Allow for 3 x 3000, etc. */
  425. #endif /* pdp11 */
  426. #endif /* BIGBUFOK */
  427. #endif /* SBSIZ */
  428.  
  429. #ifndef RBSIZ
  430. #ifdef BIGBUFOK
  431. #define RBSIZ 290000
  432. #else
  433. #ifdef pdp11
  434. #define RBSIZ 3020
  435. #else
  436. #define RBSIZ 9050
  437. #endif /* pdp11 */
  438. #endif /* BIGBUFOK */
  439. #endif /* RBSIZ */
  440. #else  /* not DYNAMIC */
  441. #ifdef pdp11
  442. #define SBSIZ 3020
  443. #define RBSIZ 3020
  444. #else
  445. #ifndef SBSIZ
  446. #define SBSIZ (MAXSP * (MAXWS + 1))
  447. #endif /* SBSIZ */
  448. #ifndef RBSIZ
  449. #define RBSIZ (MAXRP * (MAXWS + 1))
  450. #endif /* RBSIZ */
  451. #endif /* pdp11 */
  452. #endif /* DYNAMIC */
  453.  
  454. #ifdef BIGBUFOK
  455. #define PKTMSGLEN 1023
  456. #else
  457. #define PKTMSGLEN 80
  458. #endif /* BIGBUFOK */
  459.  
  460. /* Kermit parameters and defaults */
  461.  
  462. #define CTLQ       '#'            /* Control char prefix I will use */
  463. #define MYEBQ       '&'            /* 8th-Bit prefix char I will use */
  464. #define MYRPTQ       '~'            /* Repeat count prefix I will use */
  465.  
  466. #define MAXTRY        10            /* Times to retry a packet */
  467. #define MYPADN        0            /* How many padding chars I need */
  468. #define MYPADC        '\0'        /* Which padding character I need */
  469.  
  470. #define DMYTIM        8            /* Initial timeout interval to use. */
  471. #define URTIME        15            /* Timeout interval to use on me. */
  472. #define DSRVTIM     0            /* Default server cmd wait timeout. */
  473.  
  474. #define DEFTRN        0            /* Default line turnaround handshake */
  475.  
  476. #define MYEOL        CR            /* Incoming packet terminator. */
  477.  
  478. #ifdef NEWDEFAULTS
  479. #define DRPSIZ      4095            /* Default incoming packet size. */
  480. #define DFWSIZ      30            /* Default window size */
  481. #define DFBCT        3            /* Default block-check type */
  482. #else
  483. #define DRPSIZ        90            /* Default incoming packet size. */
  484. #define DFWSIZ       1            /* Default window size */
  485. #define DFBCT        3            /* Default block-check type */
  486. #endif /* NEWDEFAULTS */
  487.  
  488. /* The HP-UX 5 and 6 Telnet servers can only swallow 513 bytes at once */
  489.  
  490. #ifdef HPUX5
  491. #ifdef DRPSIZ
  492. #undef DRPSIZ
  493. #endif /* DRPSIZ */
  494. #define DRPSIZ 500
  495. #else
  496. #ifdef HPUX6
  497. #ifdef DRPSIZ
  498. #undef DRPSIZ
  499. #endif /* DRPSIZ */
  500. #define DRPSIZ 500
  501. #endif /* HPUX6 */
  502. #endif /* HPUX5 */
  503.  
  504. #define DSPSIZ        90            /* Default outbound packet size. */
  505. #define DDELAY      1            /* Default delay. */
  506. #define DSPEED        9600        /* Default line speed. */
  507.  
  508. #ifdef OS2                /* Default CONNECT-mode */
  509. #define DFESC 29            /* escape character */
  510. #else
  511. #ifdef NEXT                /* Ctrl-] for PC and NeXT */
  512. #define DFESC 29
  513. #else
  514. #ifdef GEMDOS                /* And Atari ST */
  515. #define DFESC 29
  516. #else
  517. #define DFESC 28            /* Ctrl-backslash for others */
  518. #endif /* GEMDOS */
  519. #endif /* NEXT */
  520. #endif /* OS2 */
  521.  
  522. #ifdef NOPUSH                /* NOPUSH implies NOJC */
  523. #ifndef NOJC                /* (no job control) */
  524. #define NOJC
  525. #endif /* NOJC */
  526. #endif /* NOPUSH */
  527.  
  528. #ifdef UNIX                /* Default for SET SUSPEND */
  529. #ifdef NOJC                /* UNIX but job control disabled */
  530. #define DFSUSP      0
  531. #else                    /* UNIX, job control enabled. */
  532. #define DFSUSP      1
  533. #endif /* NOJC */
  534. #else
  535. #define DFSUSP      0
  536. #endif /* UNIX */
  537.  
  538. #ifndef DFCDMSG
  539. #ifdef UNIXOROSK
  540. #define DFCDMSG "{{./.readme}{README.TXT}{READ.ME}}"
  541. #else
  542. #define DFCDMSG "{{README.TXT}{READ.ME}}"
  543. #endif /* UNIXOROSK */
  544. #endif /* DFCDMSG */
  545.  
  546. #define NSNDEXCEPT 64        /* Max patterns for /EXCEPT: list */
  547.  
  548. /* Files */
  549.  
  550. #define ZCTERM      0            /* Console terminal */
  551. #define ZSTDIO      1        /* Standard input/output */
  552. #define ZIFILE        2        /* Current input file (SEND, etc) (in) */
  553. #define ZOFILE      3            /* Current output file (RECEIVE, GET) (out) */
  554. #define ZDFILE      4            /* Current debugging log file (out) */
  555. #define ZTFILE      5            /* Current transaction log file (out) */
  556. #define ZPFILE      6            /* Current packet log file (out) */
  557. #define ZSFILE      7        /* Current session log file (out) */
  558. #define ZSYSFN        8        /* Input/Output from a system function */
  559. #define ZRFILE      9           /* Local file for READ (in) */
  560. #define ZWFILE     10           /* Local file for WRITE (out) */
  561. #define ZMFILE     11        /* Miscellaneous file, e.g. for XLATE */
  562. #define ZDIFIL     12        /* DIAL log */
  563. #define ZNFILS     13            /* How many defined file numbers */
  564.  
  565. #ifdef CKCHANNELIO
  566.  
  567. /* File modes */
  568.  
  569. #define FM_REA      1            /* Read */
  570. #define FM_WRI      2            /* Write */
  571. #define FM_APP      4            /* Append */
  572. #define FM_RWA      7            /* Read/Write/Append mask */
  573. #define FM_BIN      8            /* Binary */
  574. #define FM_RWB     15            /* Read/Write/Append/Binary mask */
  575. #define FM_CMD     16            /* Command */
  576. #define FM_EOF     64            /* (status) At EOF */
  577.  
  578. /* File errors */
  579.  
  580. #define FX_NER      0            /* No error */
  581. #define FX_SYS     -1            /* System error */
  582. #define FX_EOF     -2            /* End of file */
  583. #define FX_NOP     -3            /* Channel not open */
  584. #define FX_CHN     -4            /* Channel out of range */
  585. #define FX_RNG     -5            /* Argument range error */
  586. #define FX_FNF     -6            /* File not found */
  587. #define FX_BFN     -7            /* Bad or missing filename */
  588. #define FX_NMF     -8            /* No more files */
  589. #define FX_FOP     -9            /* Forbidden operation */
  590. #define FX_ACC    -10            /* Access denied */
  591. #define FX_BOM    -11            /* Bad combination of open modes */
  592. #define FX_OFL    -12            /* Buffer overflow */
  593. #define FX_LNU    -13            /* Current line number unknown */
  594. #define FX_ROO    -14            /* Set Root violation */
  595. #define FX_NYI    -99            /* Feature not implemented yet */
  596. #define FX_UNK   -999            /* Unknown error */
  597.  
  598. _PROTOTYP( int z_open, (char *, int) );
  599. _PROTOTYP( int z_close, (int) );
  600. _PROTOTYP( int z_out, (int, char *, int, int) );
  601. _PROTOTYP( int z_in, (int, char *, int, int, int) );
  602. _PROTOTYP( int z_flush, (int) );
  603. _PROTOTYP( int z_seek, (int, CK_OFF_T) );
  604. _PROTOTYP( int z_line, (int, CK_OFF_T) );
  605. _PROTOTYP( int z_getmode, (int) );
  606. _PROTOTYP( int z_getfnum, (int) );
  607. _PROTOTYP( CK_OFF_T z_getpos, (int) );
  608. _PROTOTYP( CK_OFF_T z_getline, (int) );
  609. _PROTOTYP( CK_OFF_T z_count, (int, int) );
  610. _PROTOTYP( char * z_getname, (int) );
  611. _PROTOTYP( char * ckferror, (int) );
  612. #endif /* CKCHANNELIO */
  613.  
  614. _PROTOTYP( int scanfile, (char *, int *, int) );
  615. _PROTOTYP( int scanstring, (char *) );
  616.  
  617. /*  Buffered file i/o ...  */
  618. #ifdef OS2                /* K-95 */
  619. #define INBUFSIZE 32768
  620. #define OBUFSIZE 32768
  621. #else
  622. #ifdef pdp11
  623. #define INBUFSIZE 512
  624. #define OBUFSIZE 512
  625. #else
  626. /* In VMS, allow for longest possible RMS record */
  627. #ifdef VMS
  628. #define INBUFSIZE 32768            /* File input buffer size */
  629. #define OBUFSIZE 32768            /* File output buffer size */
  630. #else  /* Not VMS */
  631. #ifdef STRATUS
  632. #ifdef DYNAMIC
  633. #define INBUFSIZE 32767            /* File input buffer size */
  634. #define OBUFSIZE 32767            /* File output buffer size */
  635. #else /* STRATUS, not DYNAMIC */
  636. #define INBUFSIZE 4096            /* File input buffer size */
  637. #define OBUFSIZE 4096            /* File output buffer size */
  638. #endif /* DYNAMIC */
  639. #else /* not STRATUS */
  640. #ifdef BIGBUFOK                /* Systems where memory is */
  641. #define INBUFSIZE 32768            /* not a problem... */
  642. #define OBUFSIZE 32768
  643. #else /* Not BIGBUFOK */
  644. #define INBUFSIZE 1024
  645. #define OBUFSIZE 1024
  646. #endif /* BIGBUFOK */
  647. #endif /* STRATUS */
  648. #endif /* VMS */
  649. #endif /* pdp11 */
  650. #endif /* OS2 */
  651.  
  652. /* File-transfer character in/out macros for buffered i/o */
  653.  
  654. /* Get the next file byte */
  655. #ifndef CKCMAI
  656. #ifndef NOXFER
  657. extern char ** sndarray;
  658. #endif /* NOXFER */
  659. #endif /* CKCMAI */
  660. #ifdef NOSPL
  661. #define zminchar() (((--zincnt)>=0) ? ((int)(*zinptr++) & 0377) : zinfill())
  662. #else
  663. #ifdef NOXFER
  664. #define zminchar() (((--zincnt)>=0) ? ((int)(*zinptr++) & 0377) : zinfill())
  665. #else
  666. #define zminchar() \
  667. (sndarray?agnbyte():(((--zincnt)>=0) ? ((int)(*zinptr++) & 0377) : zinfill()))
  668. #endif /* NOXFER */
  669. #endif /* NOSPL */
  670.  
  671. /* Stuff a character into the input buffer */
  672. #define zmstuff(c) zinptr--, *zinptr = c, zincnt++
  673.  
  674. /* Put a character to a file */
  675. #define zmchout(c) \
  676. ((*zoutptr++=(char)(c)),(((++zoutcnt)>=zobufsize)?zoutdump():0))
  677.  
  678. /* Screen functions */
  679.  
  680. #define XYFD_N 0            /* File transfer display: None, Off */
  681. #define XYFD_R 1            /* Regular, Dots */
  682. #define XYFD_C 2            /* Cursor-positioning (e.g. curses) */
  683. #define XYFD_S 3            /* CRT Screen */
  684. #define XYFD_B 4            /* Brief */
  685. #define XYFD_G 5                        /* GUI */
  686.  
  687. #ifdef NODISPLAY
  688. #define xxscreen(a,b,c,d)
  689. #define ckscreen(a,b,c,d)
  690. #else
  691. _PROTOTYP( VOID ckscreen, (int, char, CK_OFF_T, char *) );
  692. #ifdef VMS
  693. #define xxscreen(a,b,c,d) \
  694. if (local && fdispla != XYFD_N) \
  695. ckscreen((int)a,(char)b,(CK_OFF_T)c,(char *)d)
  696. #else
  697. #define xxscreen(a,b,c,d) \
  698. if (local && !backgrd && fdispla != XYFD_N) \
  699. ckscreen((int)a,(char)b,(CK_OFF_T)c,(char *)d)
  700. #endif /* VMS */
  701. #endif /* NODISPLAY */
  702.  
  703. #define SCR_FN 1        /* filename */
  704. #define SCR_AN 2        /* as-name */
  705. #define SCR_FS 3     /* file-size */
  706. #define SCR_XD 4        /* x-packet data */
  707. #define SCR_ST 5          /* File status: */
  708. #define   ST_OK   0       /*  Transferred OK */
  709. #define   ST_DISC 1     /*  Discarded */
  710. #define   ST_INT  2     /*  Interrupted */
  711. #define   ST_SKIP 3     /*  Skipped */
  712. #define   ST_ERR  4     /*  Fatal Error */
  713. #define   ST_REFU 5     /*  Refused (use Attribute codes for reason) */
  714. #define   ST_INC  6    /*  Incompletely received */
  715. #define   ST_MSG  7    /*  Informational message */
  716. #define   ST_SIM  8    /*  Transfer simulated (e.g. would be sent) */
  717. #define SCR_PN 6        /* packet number */
  718. #define SCR_PT 7        /* packet type or pseudotype */
  719. #define SCR_TC 8        /* transaction complete */
  720. #define SCR_EM 9        /* error message */
  721. #define SCR_WM 10       /* warning message */
  722. #define SCR_TU 11    /* arbitrary undelimited text */
  723. #define SCR_TN 12       /* arbitrary new text, delimited at beginning */
  724. #define SCR_TZ 13       /* arbitrary text, delimited at end */
  725. #define SCR_QE 14    /* quantity equals (e.g. "foo: 7") */
  726. #define SCR_CW 15    /* close screen window */
  727. #define SCR_CD 16       /* display current directory */
  728. #define SCR_MS 17    /* message from client */
  729.  
  730. /* Skip reasons */
  731.  
  732. #define SKP_DAT 1            /* Date-Time (Older) */
  733. #define SKP_EQU 2            /* Date-Time (Equal) */
  734. #define SKP_TYP 3            /* Type */
  735. #define SKP_SIZ 4            /* Size */
  736. #define SKP_NAM 5            /* Name collision */
  737. #define SKP_EXL 6            /* Exception list */
  738. #define SKP_DOT 7            /* Dot file */
  739. #define SKP_BKU 8            /* Backup file */
  740. #define SKP_RES 9            /* Recovery not needed */
  741. #define SKP_ACC 10            /* Access denied */
  742. #define SKP_NRF 11            /* Not a regular file */
  743. #define SKP_SIM 12            /* Simulation (WOULD BE SENT) */
  744. #define SKP_XUP 13 /* Simulation: Would be sent because remote file older */
  745. #define SKP_XNX 14 /* Simulation: ditto, because remote file does not exist */
  746.  
  747. /* Macros */
  748.  
  749. #ifndef CKCMAI
  750. extern int tcp_incoming;        /* Used by ENABLE macro */
  751. #endif /* CKCMAI */
  752.  
  753. #ifndef TCPSOCKET
  754. /*
  755.   ENABLED tells whether a server-side service is enabled.
  756.   0 = disabled, 1 = local, 2 = remote.
  757.   A "set host *" connection is technically local but logically remote
  758. */
  759. #define ENABLED(x) ((local && (x & 1)) || (!local && (x & 2)))
  760. #else
  761. #define ENABLED(x) (((local && !tcp_incoming) && (x & 1)) || \
  762. ((!local || tcp_incoming) && (x&2)))
  763. #endif /* TCPSOCKET */
  764.  
  765. /* These are from the book */
  766.  
  767. #define tochar(ch)  (((ch) + SP ) & 0xFF )    /* Number to character */
  768. #define xunchar(ch) (((ch) - SP ) & 0xFF )    /* Character to number */
  769. #define ctl(ch)     (((ch) ^ 64 ) & 0xFF )    /* Control/Uncontrol toggle */
  770. #define unpar(ch)   (((ch) & 127) & 0xFF )    /* Clear parity bit */
  771.  
  772. #ifndef NOLOCAL                /* CONNECT return status codes */
  773.  
  774. /* Users will see the numbers so they can't be changed */
  775. /* Numbers >= 100 indicate connection loss */
  776.  
  777. #define CSX_NONE        0        /* No CONNECT yet so no status */
  778. #define CSX_ESCAPE      1        /* User Escaped back */
  779. #define CSX_TRIGGER     2        /* Trigger was encountered */
  780. #define CSX_IKSD        3        /* IKSD autosynchronization */
  781. #define CSX_APC         4        /* Application Program Command */
  782. #define CSX_IDLE        5        /* Idle limit exceeded */
  783. #define CSX_TN_ERR      6        /* Telnet Error */
  784. #define CSX_MACRO       7               /* Macro bound to keystroke */
  785. #define CSX_TIME        8               /* Time Limit exceeded */
  786. #define CSX_INTERNAL  100        /* Internal error */
  787. #define CSX_CARRIER   101        /* Carrier required but not detected */
  788. #define CSX_IOERROR   102        /* I/O error on connection */
  789. #define CSX_HOSTDISC  103        /* Disconnected by host */
  790. #define CSX_USERDISC  104        /* Disconnected by user */
  791. #define CSX_SESSION   105        /* Session Limit exceeded */
  792. #define CSX_TN_POL    106        /* Rejected due to Telnet Policy */
  793. #define CSX_KILL_SIG  107               /* Received Kill Signal */
  794.  
  795. /* SET TERMINAL IDLE-ACTION values */
  796.  
  797. #define IDLE_RET  0            /* Return to prompt */
  798. #define IDLE_EXIT 1            /* Exit from Kermit */
  799. #define IDLE_HANG 2            /* Hangup the connection */
  800. #define IDLE_OUT  3            /* OUTPUT a string */
  801. #define IDLE_TNOP 4            /* TELNET NOP */
  802. #define IDLE_TAYT 5            /* TELNET AYT */
  803. #endif /* NOLOCAL */
  804.  
  805. /* Modem and dialing definitions */
  806.  
  807. #ifndef NODIAL
  808.  
  809. /* Modem capabilities (bit values) */
  810. #define CKD_AT   1            /* Hayes AT commands and responses */
  811. #define CKD_V25  2            /* V.25bis commands and responses */
  812. #define CKD_SB   4            /* Speed buffering */
  813. #define CKD_EC   8            /* Error correction */
  814. #define CKD_DC  16            /* Data compression */
  815. #define CKD_HW  32            /* Hardware flow control */
  816. #define CKD_SW  64            /* (Local) software flow control */
  817. #define CKD_KS 128            /* Kermit spoofing */
  818. #define CKD_TB 256            /* Made by Telebit */
  819. #define CKD_ID 512            /* Has Caller ID */
  820.  
  821. /* DIAL command result codes */
  822. #define DIA_UNK   -1            /* No DIAL command given yet */
  823. #define DIA_OK     0            /* DIAL succeeded */
  824. #define DIA_NOMO   1            /* Modem type not specified */
  825. #define DIA_NOLI   2            /* Communication line not spec'd */
  826. #define DIA_OPEN   3            /* Line can't be opened */
  827. #define DIA_NOSP   4            /* Speed not specified */
  828. #define DIA_HANG   5            /* Hangup failure */
  829. #define DIA_IE     6            /* Internal error (malloc, etc) */
  830. #define DIA_IO     7            /* I/O error */
  831. #define DIA_TIMO   8            /* Dial timeout expired */
  832. #define DIA_INTR   9            /* Dialing interrupted by user */
  833. #define DIA_NRDY  10            /* Modem not ready */
  834. #define DIA_PART  11            /* Partial dial command OK */
  835. #define DIA_DIR   12            /* Dialing directory error */
  836. #define DIA_HUP   13            /* Modem was hung up OK */
  837. #define DIA_NRSP  19            /* No response from modem */
  838. #define DIA_ERR   20            /* Modem command error */
  839. #define DIA_NOIN  21            /* Failure to initialize modem */
  840. #define DIA_BUSY  22            /* Phone busy */
  841. #define DIA_NOCA  23            /* No carrier */
  842. #define DIA_NODT  24            /* No dialtone */
  843. #define DIA_RING  25            /* Ring, incoming call */
  844. #define DIA_NOAN  26            /* No answer */
  845. #define DIA_DISC  27            /* Disconnected */
  846. #define DIA_VOIC  28            /* Answered by voice */
  847. #define DIA_NOAC  29            /* Access denied, forbidden call */
  848. #define DIA_BLCK  30            /* Blacklisted */
  849. #define DIA_DELA  31            /* Delayed */
  850. #define DIA_FAX   32            /* Fax */
  851. #define DIA_DIGI  33                    /* Digital Line */
  852. #define DIA_TAPI  34            /* TAPI dialing failure */
  853. #define DIA_UERR  98            /* Unknown error */
  854. #define DIA_UNSP  99        /* Unspecified failure detected by modem */
  855.  
  856. #define MDMINF    struct mdminf
  857.  
  858. MDMINF {            /* Structure for modem-specific information */
  859.  
  860.     char * name;        /* Descriptive name */
  861.     char * pulse;        /* Command to force pulse dialing */
  862.     char * tone;        /* Command to force tone dialing */
  863.     int    dial_time;        /* Time modem allows for dialing (secs) */
  864.     char * pause_chars;        /* Character(s) to tell modem to pause */
  865.     int       pause_time;        /* Time associated with pause chars (secs) */
  866.     char * wake_str;        /* String to wakeup modem & put in cmd mode */
  867.     int       wake_rate;        /* Delay between wake_str characters (msecs) */
  868.     char * wake_prompt;        /* String prompt after wake_str */
  869.     char * dmode_str;        /* String to put modem in dialing mode */
  870.     char * dmode_prompt;    /* String prompt for dialing mode */
  871.     char * dial_str;        /* Dialing string, with "%s" for number */
  872.     int    dial_rate;        /* Interchar delay to modem (msec) */
  873.     int    esc_time;        /* Escape sequence guard time (msec) */
  874.     int    esc_char;        /* Escape character */
  875.     char * hup_str;        /* Hangup string */
  876.     char * hwfc_str;        /* Hardware flow control string */
  877.     char * swfc_str;        /* Software flow control string */
  878.     char * nofc_str;        /* No flow control string */
  879.     char * ec_on_str;        /* Error correction on string */
  880.     char * ec_off_str;        /* Error correction off string */
  881.     char * dc_on_str;        /* Data compression on string */
  882.     char * dc_off_str;        /* Data compression off string */
  883.     char * aa_on_str;        /* Autoanswer on string */
  884.     char * aa_off_str;        /* Autoanswer off string */
  885.     char * sb_on_str;        /* Speed buffering on string */
  886.     char * sb_off_str;        /* Speed buffering off string */
  887.     char * sp_on_str;        /* Speaker on string */
  888.     char * sp_off_str;        /* Speaker off string */
  889.     char * vol1_str;        /* Volume low string */
  890.     char * vol2_str;        /* Volume med string */
  891.     char * vol3_str;        /* Volume high string */
  892.     char * ignoredt;        /* Ignore dialtone string */
  893.     char * ini2;        /* Last-minute init string */
  894.     long   max_speed;        /* Maximum interface speed */
  895.     long   capas;        /* Capability bits */
  896.     /* function to read modem's response string to a non-dialing command */
  897.     _PROTOTYP( int (*ok_fn), (int,int) );
  898. };
  899. #endif /* NODIAL */
  900.  
  901. /* Symbols for File Attributes */
  902.  
  903. #define AT_XALL  0            /* All of them */
  904. #define AT_ALLY  1            /* All of them on (Yes) */
  905. #define AT_ALLN  2            /* All of them off (no) */
  906. #define AT_LENK  3            /* Length in K */
  907. #define AT_FTYP  4            /* File Type */
  908. #define AT_DATE  5            /* Creation date */
  909. #define AT_CREA  6            /* Creator */
  910. #define AT_ACCT  7            /* Account */
  911. #define AT_AREA  8            /* Area */
  912. #define AT_PSWD  9            /* Password for area */
  913. #define AT_BLKS 10            /* Blocksize */
  914. #define AT_ACCE 11            /* Access */
  915. #define AT_ENCO 12            /* Encoding */
  916. #define AT_DISP 13            /* Disposition */
  917. #define AT_LPRO 14            /* Local Protection */
  918. #define AT_GPRO 15            /* Generic Protection */
  919. #define AT_SYSI 16            /* System ID */
  920. #define AT_RECF 17            /* Record Format */
  921. #define AT_SYSP 18            /* System-Dependent Parameters */
  922. #define AT_LENB 19            /* Length in Bytes */
  923. #define AT_EOA  20            /* End of Attributes */
  924.  
  925. /* Kermit packet information structure */
  926.  
  927. struct pktinfo {            /* Packet information structure */
  928.     CHAR *bf_adr;            /*  buffer address */
  929.     int   bf_len;            /*  buffer length */
  930.     CHAR *pk_adr;            /* Packet address within buffer */
  931.     int   pk_len;            /*  length of data within buffer */
  932.     int   pk_typ;            /*  packet type */
  933.     int   pk_seq;            /*  packet sequence number */
  934.     int   pk_rtr;            /*  retransmission count */
  935. };
  936.  
  937. /* Send Modes (indicating which type of SEND command was used) */
  938.  
  939. #define SM_SEND     0
  940. #define SM_MSEND    1
  941. #define SM_RESEND   2
  942. #define SM_PSEND    3
  943. #define SM_MAIL     4
  944. #define SM_PRINT    5
  945.  
  946. #define OPTBUFLEN 256
  947.  
  948. /* File-related symbols and structures */
  949. /* Used by SET FILE command but also by protocol and i/o modules */
  950.  
  951. #define XMODE_A 0    /* Transfer mode Automatic */
  952. #define XMODE_M 1    /* Transfer mode Manual    */
  953.  
  954. #define   XYFILN 0      /*  Naming  */
  955. #define     XYFN_L 0    /*    Literal */
  956. #define     XYFN_C 1    /*    Converted */
  957. #define   XYFILT 1      /*  Type    */
  958. #define     XYFT_T 0    /*    Text  */
  959. #define     XYFT_B 1    /*    Binary */
  960. #define     XYFT_I 2    /*    Image or Block (VMS) */
  961. #define     XYFT_L 3    /*    Labeled (tagged binary) (VMS or OS/2) */
  962. #define     XYFT_U 4    /*    Binary Undefined (VMS) */
  963. #define     XYFT_M 5    /*    MacBinary (Macintosh) */
  964. #define     XYFT_X 6    /*    TENEX (FTP TYPE L 8) */
  965. #define     XYFT_D 99   /*    Debug (for session logs) */
  966. #define   XYFILW 2      /*  Warning */
  967. #define   XYFILD 3      /*  Display */
  968. #define   XYFILC 4      /*  Character set */
  969. #define   XYFILF 5      /*  Record Format */
  970. #define     XYFF_S  0   /*    Stream */
  971. #define     XYFF_V  1   /*    Variable */
  972. #define     XYFF_VB 2   /*    Variable with RCW's */
  973. #define     XYFF_F  3   /*    Fixed length */
  974. #define     XYFF_U  4   /*    Undefined */
  975. #define   XYFILR 6      /*  Record length */
  976. #define   XYFILO 7      /*  Organization */
  977. #define     XYFO_S 0    /*    Sequential */
  978. #define     XYFO_I 1    /*    Indexed */
  979. #define     XYFO_R 2    /*    Relative */
  980. #define   XYFILP 8      /*  Printer carriage control */
  981. #define     XYFP_N 0    /*    Newline (imbedded control characters) */
  982. #define     XYFP_F 1    /*    FORTRAN (space, 1, +, etc, in column 1 */
  983. #define     XYFP_P 2    /*    Special printer carriage controls */
  984. #define     XYFP_X 4    /*    None */
  985. #define   XYFILX 9      /*  Collision Action */
  986. #define     XYFX_A 3    /*    Append */
  987. #define     XYFX_Q 5    /*    Ask */
  988. #define     XYFX_B 2    /*    Backup */
  989. #define     XYFX_D 4    /*    Discard */
  990. #define     XYFX_R 0    /*    Rename */
  991. #define     XYFX_X 1    /*    Replace */
  992. #define     XYFX_U 6    /*    Update */
  993. #define     XYFX_M 7    /*    Modtimes differ */
  994. #define   XYFILB 10     /*  Blocksize */
  995. #define   XYFILZ 11     /*  Disposition */
  996. #define     XYFZ_N 0    /*    New, Create */
  997. #define     XYFZ_A 1    /*    New, append if file exists, else create */
  998. #define     XYFZ_O 2    /*    Old, file must exist */
  999. #define   XYFILS 12     /*  File Byte Size */
  1000. #define   XYFILL 13     /*  File Label (VMS) */
  1001. #define   XYFILI 14     /*  File Incomplete */
  1002. #define   XYFILQ 15     /*  File path action (strip or not) */
  1003. #define   XYFILG 16     /*  File download directory */
  1004. #define   XYFILA 17     /*  Line terminator for local text files */
  1005. #define     XYFA_L 012  /*    LF (as in UNIX) */
  1006. #define     XYFA_C 015  /*    CR (as in OS-9 or Mac OS) */
  1007. #define     XYFA_2 000  /*  CRLF -- Note: this must be defined as 0 */
  1008. #define   XYFILY 18     /*  Destination */
  1009. #define   XYFILV 19    /*  EOF Detection Method */
  1010. #define     XYEOF_L 0   /*    File length */
  1011. #define     XYEOF_Z 1   /*    Ctrl-Z in file */
  1012. #define   XYFILH   20   /*  OUTPUT parameters - buffered, blocking, etc */
  1013. #define   XYFIBP   21    /*  BINARY-PATTERN */
  1014. #define   XYFITP   22   /*  TEXT-PATTERN */
  1015. #define   XYFIPA   23   /*  PATTERNS ON/OFF */
  1016. #define   XYFILU   24   /*  UCS ... */
  1017. #define   XYF_PRM  25   /*  PERMISSIONS, PROTECTION */
  1018. #define   XYF_INSP 26   /*  INSPECTION (SCAN) */
  1019. #define   XYF_DFLT 27   /*  DEFAULT (character sets) */
  1020. #define   XYF_SSPA 28   /*  STRINGSPACE */
  1021. #define   XYF_LSIZ 29   /*  LISTSIZE */
  1022.  
  1023. /* File Type (return code) definitions and corresponding name strings */
  1024.  
  1025. #define FT_7BIT 0            /* 7-bit text */
  1026. #define FT_8BIT 1            /* 8-bit text */
  1027. #define FT_UTF8 2            /* UTF8 */
  1028. #define FT_UCS2 3            /* UCS2 */
  1029. #define FT_TEXT 4            /* Unknown text */
  1030. #define FT_BIN  5            /* Binary */
  1031. #define SCANFILEBUF 49152        /* Size of file scan (48K) */
  1032.  
  1033. /* Connection closed reasons */
  1034.  
  1035. #define WC_REMO   0            /* Closed by remote */
  1036. #define WC_CLOS   1            /* Closed from our end */
  1037. #define WC_TELOPT 2            /* Telnet negotiation failure */
  1038.  
  1039. #ifdef BIGBUFOK
  1040. #define FTPATTERNS 256
  1041. #else
  1042. #define FTPATTERNS 64
  1043. #endif /* BIGBUFOK */
  1044.  
  1045. #define SYS_UNK    0            /* Selected server system types */
  1046. #define SYS_UNIX   1
  1047. #define SYS_WIN32  2
  1048. #define SYS_VMS    3
  1049. #define SYS_OS2    4
  1050. #define SYS_DOS    5
  1051. #define SYS_TOPS10 6
  1052. #define SYS_TOPS20 7
  1053. #define SYS_VOS    8
  1054. #define SYS_DG     9
  1055. #define SYS_OSK    10
  1056. #define SYS_MAX    11
  1057.  
  1058. #ifdef CK_SMALL
  1059. #define PWBUFL 63
  1060. #else
  1061. #define PWBUFL 255
  1062. #endif /* CK_SMALL */
  1063.  
  1064. #ifdef OS2
  1065. struct tt_info_rec {            /* Terminal emulation info */
  1066.     char  *x_name;
  1067.     char *x_aliases[4];
  1068.     char  *x_id;
  1069. };
  1070. #endif /* OS2 */
  1071.  
  1072. /* BEEP TYPES */
  1073. #define BP_BEL  0            /* Terminal bell */
  1074. #define BP_NOTE 1            /* Info */
  1075. #define BP_WARN 2            /* Warning */
  1076. #define BP_FAIL 3            /* Error */
  1077.  
  1078. #ifndef NOIKSD
  1079. #ifdef IKSDB                /* IKSD Database definitions */
  1080.  
  1081. /* Field values */
  1082.  
  1083. #define DBF_INUSE    1            /* Flag bits... In use */
  1084. #define DBF_USER     2            /* Real user (versus anonymous) */
  1085. #define DBF_LOGGED   4            /* Logged in (versus not) */
  1086.  
  1087. /* Data Definitions... */
  1088.  
  1089. /* Numeric fields, hex, right justified, 0-filled on left */
  1090.  
  1091. #define db_FLAGS     0            /* Field 0: Flags */
  1092. #define DB_FLAGS     0            /* Offset: 0 */
  1093. #define dB_FLAGS     4            /* Length: 4 (hex digits) */
  1094.  
  1095. #define db_ATYPE     1            /* Field 1: Authentication type */
  1096. #define DB_ATYPE     4            /* 4 hex digits */
  1097. #define dB_ATYPE     4
  1098.  
  1099. #define db_AMODE     2            /* Field 2: Authentication mode */
  1100. #define DB_AMODE     8            /* 4 hex digits */
  1101. #define dB_AMODE     4
  1102.  
  1103. #define db_STATE     3            /* Field 3: State - 4 hex digits*/
  1104. #define DB_STATE    12            /* 4 hex digits */
  1105. #define dB_STATE     4
  1106.  
  1107. #define db_MYPID     4            /* Field 4: My PID */
  1108. #define DB_MYPID    16            /* 16 hex digits left padded with 0 */
  1109. #define dB_MYPID    16
  1110.  
  1111. #define db_SADDR     5            /* Field 5: Server (my) IP address */
  1112. #define DB_SADDR    32            /* 16 hex digits left padded with 0 */
  1113. #define dB_SADDR    16
  1114.  
  1115. #define db_CADDR     6            /* Field 6: Client IP address */
  1116. #define DB_CADDR    48            /* 16 hex digits left padded with 0 */
  1117. #define dB_CADDR    16
  1118.  
  1119. /* Date-time fields (17 right-adjusted in 18 for Y10K readiness) */
  1120.  
  1121. #define db_START     7            /* Field 7: Session start date-time */
  1122. #define DB_START    65            /* 64 is leading space for Y10K */
  1123. #define dB_START    17
  1124.  
  1125. #define db_LASTU     8            /* Field 8: Last lastu date-time */
  1126. #define DB_LASTU    83            /* 82 is leading space for Y10K */
  1127. #define dB_LASTU    17
  1128.  
  1129. #define db_ULEN      9            /* Field 9: Length of Username */
  1130. #define DB_ULEN    100            /* 4 hex digits */
  1131. #define dB_ULEN      4
  1132.  
  1133. #define db_DLEN     10            /* Field 10: Length of Directory */
  1134. #define DB_DLEN    104            /* 4 hex digits */
  1135. #define dB_DLEN      4
  1136.  
  1137. #define db_ILEN     11            /* Field 11: Length of Info */
  1138. #define DB_ILEN    108            /* 4 hex digits */
  1139. #define dB_ILEN      4
  1140.  
  1141. #define db_PAD1     12            /* Field 12: (Reserved) */
  1142. #define DB_PAD1    112            /* filled with spaces */
  1143. #define dB_PAD1    912
  1144.  
  1145. /* String fields, all right-padded with blanks */
  1146.  
  1147. #define db_USER     13            /* Field 13: Username */
  1148. #define DB_USER   1024            /* right-padded with spaces */
  1149. #define dB_USER   1024
  1150.  
  1151. #define db_DIR      14            /* Field 14: Current directory */
  1152. #define DB_DIR    2048            /* right-padded with spaces */
  1153. #define dB_DIR    1024
  1154.  
  1155. #define db_INFO     15            /* Field 15: State-specific info */
  1156. #define DB_INFO   3072            /* right-padded with spaces */
  1157. #define dB_INFO   1024
  1158.  
  1159. #define DB_RECL   4096            /* Database record length */
  1160.  
  1161. /* Offset, length, and type of each field thru its db_XXX symbol */
  1162.  
  1163. #define DBT_HEX 1            /* Hexadecimal number */
  1164. #define DBT_STR 2            /* String */
  1165. #define DBT_DAT 3            /* Date-Time yyyymmdd hh:mm:ss */
  1166. #define DBT_UND 9            /* Undefined and blank */
  1167.  
  1168. struct iksdbfld {
  1169.     int off;                /* Position (offset) */
  1170.     int len;                /* Length (bytes) */
  1171.     int typ;                /* Data type */
  1172. };
  1173. _PROTOTYP(int dbinit, (void));
  1174. _PROTOTYP(int initslot, (int));
  1175. _PROTOTYP(int getslot, (void));
  1176. _PROTOTYP(int freeslot, (int));
  1177. _PROTOTYP(int updslot, (int));
  1178. _PROTOTYP(int slotstate, (int, char *, char *, char *));
  1179. _PROTOTYP(int slotdir, (char *, char *));
  1180. #endif /* IKSDB */
  1181. #endif /* NOIKSD */
  1182.  
  1183. /* ANSI forward declarations for protocol-related functions. */
  1184.  
  1185. _PROTOTYP( int input, (void) );
  1186. _PROTOTYP( int inibufs, (int, int) );
  1187. _PROTOTYP( int makebuf, (int, int, CHAR [], struct pktinfo *) );
  1188. _PROTOTYP( int mksbuf, (int) );
  1189. _PROTOTYP( int mkrbuf, (int) );
  1190. _PROTOTYP( int spack, (char, int, int, CHAR *) );
  1191. _PROTOTYP( VOID proto, (void) );
  1192. _PROTOTYP( int rpack, (void) );
  1193. _PROTOTYP( int ack, (void) );
  1194. _PROTOTYP( int nack, (int) );
  1195. _PROTOTYP( int ackn, (int) );
  1196. _PROTOTYP( int ack1, (CHAR *) );
  1197. _PROTOTYP( int ackns, (int, CHAR *) );
  1198. #ifdef STREAMING
  1199. _PROTOTYP( int fastack, (void) );
  1200. #endif /* STREAMING */
  1201. _PROTOTYP( int resend, (int) );
  1202. _PROTOTYP( int errpkt, (CHAR *) );
  1203. _PROTOTYP( VOID logpkt, (char, int, CHAR *, int) );
  1204. _PROTOTYP( CHAR dopar, (CHAR) );
  1205. _PROTOTYP( int chk1, (CHAR *, int) );
  1206. _PROTOTYP( unsigned int chk2, (CHAR *, int) );
  1207. _PROTOTYP( unsigned int chk3, (CHAR *, int) );
  1208. _PROTOTYP( int sipkt, (char) );
  1209. _PROTOTYP( int sopkt, (void) );
  1210. _PROTOTYP( int sinit, (void) );
  1211. _PROTOTYP( VOID rinit, (CHAR *) );
  1212. _PROTOTYP( int spar, (CHAR *) );
  1213. _PROTOTYP( int rcvfil, (char *) );
  1214. _PROTOTYP( CHAR * rpar, (void) );
  1215. _PROTOTYP( int gnfile, (void) );
  1216. _PROTOTYP( int getsbuf, (int) );
  1217. _PROTOTYP( int getrbuf, (void) );
  1218. _PROTOTYP( int freesbuf, (int) );
  1219. _PROTOTYP( int freerbuf, (int) );
  1220. _PROTOTYP( int dumpsbuf, (void) );
  1221. _PROTOTYP( int dumprbuf, (void) );
  1222. _PROTOTYP( VOID freerpkt, (int) );
  1223. _PROTOTYP( int chkwin, (int, int, int) );
  1224. _PROTOTYP( int rsattr, (CHAR *) );
  1225. _PROTOTYP( char *getreason, (char *) );
  1226. _PROTOTYP( int scmd, (char, CHAR *) );
  1227. _PROTOTYP( int encstr, (CHAR *) );
  1228. _PROTOTYP( int decode, (CHAR *, int (*)(char), int) );
  1229. _PROTOTYP( int bdecode, (CHAR *, int (*)(char)) );
  1230. _PROTOTYP( int fnparse, (char *) );
  1231. _PROTOTYP( int syscmd, (char *, char *) );
  1232. _PROTOTYP( int cwd, (char *) );
  1233. _PROTOTYP( int remset, (char *) );
  1234. _PROTOTYP( int initattr, (struct zattr *) );
  1235. _PROTOTYP( int gattr, (CHAR *, struct zattr *) );
  1236. _PROTOTYP( int adebu, (char *, struct zattr *) );
  1237. _PROTOTYP( int canned, (CHAR *) );
  1238. _PROTOTYP( int opent, (struct zattr *) );
  1239. _PROTOTYP( int ckopenx, (struct zattr *) );
  1240. _PROTOTYP( int opena, (char *, struct zattr *) );
  1241. _PROTOTYP( int openi, (char *) );
  1242. _PROTOTYP( int openo, (char *, struct zattr *, struct filinfo *) );
  1243. _PROTOTYP( int openc, (int, char *) );
  1244. _PROTOTYP( int reof, (char *, struct zattr *) );
  1245. _PROTOTYP( VOID reot, (void) );
  1246. _PROTOTYP( int sfile, (int) );
  1247. _PROTOTYP( int sattr, (int, int) );
  1248. _PROTOTYP( int sdata, (void) );
  1249. _PROTOTYP( int seof, (int) );
  1250. _PROTOTYP( int sxeof, (int) );
  1251. _PROTOTYP( int seot, (void) );
  1252. _PROTOTYP( int window, (int) );
  1253. _PROTOTYP( int clsif, (void) );
  1254. _PROTOTYP( int clsof, (int) );
  1255. _PROTOTYP( CHAR setgen, (char, char *, char *, char *) );
  1256. _PROTOTYP( int getpkt, (int, int) );
  1257. _PROTOTYP( int maxdata, (void) );
  1258. _PROTOTYP( int putsrv, (char) );
  1259. _PROTOTYP( int puttrm, (char) );
  1260. _PROTOTYP( int putque, (char) );
  1261. _PROTOTYP( int putfil, (char) );
  1262. _PROTOTYP( int putmfil, (char) );
  1263. _PROTOTYP( int zputfil, (char) );
  1264. _PROTOTYP( VOID zdstuff, (CHAR) );
  1265. _PROTOTYP( int tinit, (int) );
  1266. _PROTOTYP( VOID pktinit, (void) );
  1267. _PROTOTYP( VOID resetc, (void) );
  1268. _PROTOTYP( VOID xsinit, (void) );
  1269. _PROTOTYP( int adjpkl, (int,int,int) );
  1270. _PROTOTYP( int chktimo, (int,int) );
  1271. _PROTOTYP( int nxtpkt, (void) );
  1272. _PROTOTYP( VOID rcalcpsz, (void) );
  1273. _PROTOTYP( int srinit, (int, int, int) );
  1274. _PROTOTYP( VOID tstats, (void) );
  1275. _PROTOTYP( VOID fstats, (void) );
  1276. _PROTOTYP( VOID intmsg, (long) );
  1277. _PROTOTYP( VOID ermsg, (char *) );
  1278. _PROTOTYP( int chkint, (void) );
  1279. _PROTOTYP( VOID sdebu, (int) );
  1280. _PROTOTYP( VOID rdebu, (CHAR *, int) );
  1281. _PROTOTYP( char * dbchr, ( int ) );
  1282. #ifdef COMMENT
  1283. _PROTOTYP( SIGTYP stptrap, (int, int) );
  1284. _PROTOTYP( SIGTYP trap, (int, int) );
  1285. #else
  1286. _PROTOTYP( SIGTYP stptrap, (int) );
  1287. _PROTOTYP( SIGTYP trap, (int) );
  1288. #endif /* COMMENT */
  1289. _PROTOTYP( char * ck_errstr, (void) );
  1290. #ifndef NOXFER
  1291. _PROTOTYP( int agnbyte, (void) );
  1292. #endif /* NOXFER */
  1293. _PROTOTYP( int xgnbyte, (int, int, int (*)(void)) );
  1294. _PROTOTYP( int xpnbyte, (int, int, int, int (*)(char)) );
  1295.  
  1296. /* User interface functions needed by main program, etc. */
  1297.  
  1298. _PROTOTYP( int doconect, (int,int) );
  1299. _PROTOTYP( VOID setflow, (void) );
  1300. _PROTOTYP( VOID prescan, (int) );
  1301. _PROTOTYP( VOID setint, (void) );
  1302. _PROTOTYP( VOID doinit, (void) );
  1303. _PROTOTYP( VOID dofast, (void) );
  1304. _PROTOTYP( VOID cmdini, (void) );
  1305. _PROTOTYP( int dotake, (char *) );
  1306. _PROTOTYP( int cmdlin, (void) );
  1307. #ifdef OS2
  1308. _PROTOTYP( int conect, (int) );
  1309. #else /* OS2 */
  1310. _PROTOTYP( int conect, (void) );
  1311. #endif /* OS2 */
  1312. _PROTOTYP( int ckcgetc, (int) );
  1313. _PROTOTYP( int ckcputc, (int) );
  1314. _PROTOTYP (int mdmhup, (void) );
  1315. _PROTOTYP( VOID herald, (void) );
  1316. _PROTOTYP( VOID fixcmd, (void) );
  1317. _PROTOTYP( int doarg, (char) );
  1318. _PROTOTYP( int doxarg, (char **, int) );
  1319. _PROTOTYP( VOID usage, (void) );
  1320. _PROTOTYP( VOID doclean, (int) );
  1321. _PROTOTYP( int sndhlp, (void) );
  1322. _PROTOTYP( int sndstring, (char *) );
  1323. _PROTOTYP( VOID ckhost, (char *, int) );
  1324. _PROTOTYP( int gettcs, (int, int) );
  1325. _PROTOTYP( VOID getdialenv, (void) );
  1326. _PROTOTYP( VOID setprefix, (int) );
  1327. _PROTOTYP(VOID initproto,(int,char *,char *,char *,char *,char *,char*,char*));
  1328. _PROTOTYP( VOID initpat, (void) );
  1329. _PROTOTYP( VOID initcsets, (void) );
  1330. _PROTOTYP( char * getsysid, (char *) );
  1331. _PROTOTYP( int getsysix, (char *) );
  1332. #ifdef CK_TIMERS
  1333. _PROTOTYP( VOID rttinit, (void) );
  1334. _PROTOTYP( int getrtt, (int, int) );
  1335. #endif /* CK_TIMERS */
  1336.  
  1337. _PROTOTYP( int is_a_tty, (int) );
  1338. _PROTOTYP( int snddir, (char *) );
  1339. _PROTOTYP( int snddel, (char *) );
  1340. _PROTOTYP( int sndtype, (char *) );
  1341. _PROTOTYP( int dooutput, (char *, int) );
  1342. _PROTOTYP( int isabsolute, (char *) );
  1343. _PROTOTYP( VOID whoarewe, (void) );
  1344. _PROTOTYP( int ckmkdir, (int, char *, char **, int, int) );
  1345. _PROTOTYP( int autoexitchk, (CHAR) );
  1346. _PROTOTYP( VOID fcps, (void) );
  1347. #ifdef OS2
  1348. _PROTOTYP( VOID logchar, (unsigned short) );
  1349. #else /* OS2 */
  1350. _PROTOTYP( VOID logchar, (char) );
  1351. #endif /* OS2 */
  1352. _PROTOTYP( VOID logstr, (char *, int) );
  1353.  
  1354. _PROTOTYP( VOID dologend, (void) );
  1355. #ifdef NOLOCAL
  1356. #define dologshow()
  1357. #else
  1358. _PROTOTYP( long dologshow, (int) );
  1359. #endif /* NOLOCAL */
  1360.  
  1361. #ifdef NODISPLAY
  1362. #define fxdinit(a)
  1363. #else
  1364. _PROTOTYP( VOID fxdinit, (int) );
  1365. #endif /* NODISPLAY */
  1366.  
  1367. _PROTOTYP( int fileselect, (char *,
  1368.                 char *, char *, char *, char *,
  1369.                 CK_OFF_T, CK_OFF_T,
  1370.                 int, int,
  1371.                 char **) );
  1372. _PROTOTYP( char * whoami, (void) );
  1373. _PROTOTYP( int shoesc, (int) );
  1374.  
  1375. #ifdef CK_APC
  1376. _PROTOTYP( int chkspkt, (char *) );
  1377. _PROTOTYP( int kstart, (CHAR) );
  1378. _PROTOTYP( VOID autodown, (int));
  1379. #ifdef CK_XYZ
  1380. _PROTOTYP( int zstart, (CHAR) );
  1381. #endif /* CK_XYZ */
  1382. #ifdef OS2
  1383. _PROTOTYP(void apc_command, (int, char*));
  1384. #endif /* OS2 */
  1385. #endif /* CK_APC */
  1386.  
  1387. /* User Query data structures and functions */
  1388.  
  1389. struct txtbox {
  1390.     char * t_buf;            /* Destination buffer address */
  1391.     int    t_len;            /* Destination buffer length */
  1392.     char * t_lbl;            /* Label for this field */
  1393.     char * t_dflt;            /* Default response for this field */
  1394.     int    t_echo;            /* 0 = no, 1 = yes, 2 = asterisks */
  1395. };
  1396.  
  1397. #define DEFAULT_UQ_TIMEOUT  0
  1398. _PROTOTYP(int uq_ok, (char *,char *,int,char **,int) );
  1399. _PROTOTYP(int uq_txt, (char *,char *,int,char **,char *,int,char *,int));
  1400. _PROTOTYP(int uq_mtxt, (char *,char **,int,struct txtbox[]) );
  1401. _PROTOTYP(int uq_file, (char *,char *,int,char **,char *,char *,int));
  1402.  
  1403. #ifdef CK_URL
  1404. struct urlopt {
  1405.     char * nam;
  1406.     char * val;
  1407. };
  1408. #define MAX_URL_OPTS    16
  1409. struct urldata {
  1410.     char * sav;            /* The URL itself */
  1411.     char * svc;            /* Service */
  1412.     char * usr;            /* User */
  1413.     char * psw;            /* Password */
  1414.     char * hos;            /* Host */
  1415.     char * por;            /* Port */
  1416.     char * pth;            /* Path */
  1417.     int    nopts;               /* number of options */
  1418.     struct urlopt opt[MAX_URL_OPTS];   /* options */
  1419. };
  1420. _PROTOTYP(int urlparse, (char *, struct urldata *));
  1421. #endif /* CK_URL */
  1422.  
  1423. #endif /* CKCKER_H */
  1424.  
  1425. /* End of ckcker.h */
  1426.