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