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