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