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, 2017
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			/* Allow for 10 x 9024 or 20 x 4096 */
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 predefined file numbers (old) */
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 #define FM_STDIN  128                   /* Standard input */
578 #define FM_STDOUT 256                   /* Standard output */
579 #define FM_STDERR 512                   /* Standard error */
580 #define FM_STDM   896                   /* Standard in/out/err mask */
581 
582 /* File errors */
583 
584 #define FX_NER      0			/* No error */
585 #define FX_SYS     -1			/* System error */
586 #define FX_EOF     -2			/* End of file */
587 #define FX_NOP     -3			/* Channel not open */
588 #define FX_CHN     -4			/* Channel out of range */
589 #define FX_RNG     -5			/* Argument range error */
590 #define FX_FNF     -6			/* File not found */
591 #define FX_BFN     -7			/* Bad or missing filename */
592 #define FX_NMF     -8			/* No more files */
593 #define FX_FOP     -9			/* Forbidden operation */
594 #define FX_ACC    -10			/* Access denied */
595 #define FX_BOM    -11			/* Bad combination of open modes */
596 #define FX_OFL    -12			/* Buffer overflow */
597 #define FX_LNU    -13			/* Current line number unknown */
598 #define FX_ROO    -14			/* Set Root violation */
599 #define FX_NYI    -99			/* Feature not implemented yet */
600 #define FX_UNK   -999			/* Unknown error */
601 
602 _PROTOTYP( int z_open, (char *, int) );
603 _PROTOTYP( int z_close, (int) );
604 _PROTOTYP( int z_out, (int, char *, int, int) );
605 _PROTOTYP( int z_in, (int, char *, int, int, int) );
606 _PROTOTYP( int z_flush, (int) );
607 _PROTOTYP( int z_seek, (int, CK_OFF_T) );
608 _PROTOTYP( int z_line, (int, CK_OFF_T) );
609 _PROTOTYP( int z_getmode, (int) );
610 _PROTOTYP( int z_getfnum, (int) );
611 _PROTOTYP( CK_OFF_T z_getpos, (int) );
612 _PROTOTYP( CK_OFF_T z_getline, (int) );
613 _PROTOTYP( CK_OFF_T z_count, (int, int) );
614 _PROTOTYP( char * z_getname, (int) );
615 _PROTOTYP( char * ckferror, (int) );
616 #endif /* CKCHANNELIO */
617 
618 _PROTOTYP( int scanfile, (char *, int *, int) );
619 _PROTOTYP( int scanstring, (char *) );
620 
621 /*  Buffered file i/o ...  */
622 #ifdef OS2				/* K-95 */
623 #define INBUFSIZE 32768
624 #define OBUFSIZE 32768
625 #else
626 #ifdef pdp11
627 #define INBUFSIZE 512
628 #define OBUFSIZE 512
629 #else
630 /* In VMS, allow for longest possible RMS record */
631 #ifdef VMS
632 #define INBUFSIZE 32768			/* File input buffer size */
633 #define OBUFSIZE 32768			/* File output buffer size */
634 #else  /* Not VMS */
635 #ifdef STRATUS
636 #ifdef DYNAMIC
637 #define INBUFSIZE 32767			/* File input buffer size */
638 #define OBUFSIZE 32767			/* File output buffer size */
639 #else /* STRATUS, not DYNAMIC */
640 #define INBUFSIZE 4096			/* File input buffer size */
641 #define OBUFSIZE 4096			/* File output buffer size */
642 #endif /* DYNAMIC */
643 #else /* not STRATUS */
644 #ifdef BIGBUFOK				/* Systems with some memory */
645 #define INBUFSIZE 32768			/* 32K for packet buffers */
646 #define OBUFSIZE 32768
647 #else /* Not BIGBUFOK */
648 #define INBUFSIZE 1024
649 #define OBUFSIZE 1024
650 #endif /* BIGBUFOK */
651 #endif /* STRATUS */
652 #endif /* VMS */
653 #endif /* pdp11 */
654 #endif /* OS2 */
655 
656 /* File-transfer character in/out macros for buffered i/o */
657 
658 /* Get the next file byte */
659 #ifndef CKCMAI
660 #ifndef NOXFER
661 extern char ** sndarray;
662 #endif /* NOXFER */
663 #endif /* CKCMAI */
664 #ifdef NOSPL
665 #define zminchar() (((--zincnt)>=0) ? ((int)(*zinptr++) & 0377) : zinfill())
666 #else
667 #ifdef NOXFER
668 #define zminchar() (((--zincnt)>=0) ? ((int)(*zinptr++) & 0377) : zinfill())
669 #else
670 #define zminchar() \
671 (sndarray?agnbyte():(((--zincnt)>=0) ? ((int)(*zinptr++) & 0377) : zinfill()))
672 #endif /* NOXFER */
673 #endif /* NOSPL */
674 
675 /* Stuff a character into the input buffer */
676 #define zmstuff(c) zinptr--, *zinptr = c, zincnt++
677 
678 /* Put a character to a file */
679 #define zmchout(c) \
680 ((*zoutptr++=(char)(c)),(((++zoutcnt)>=zobufsize)?zoutdump():0))
681 
682 /* Screen functions */
683 
684 #define XYFD_N 0			/* File transfer display: None, Off */
685 #define XYFD_R 1			/* Regular, Dots */
686 #define XYFD_C 2			/* Cursor-positioning (e.g. curses) */
687 #define XYFD_S 3			/* CRT Screen */
688 #define XYFD_B 4			/* Brief */
689 #define XYFD_G 5                        /* GUI */
690 
691 #ifdef NODISPLAY
692 #define xxscreen(a,b,c,d)
693 #define ckscreen(a,b,c,d)
694 #else
695 _PROTOTYP( VOID ckscreen, (int, char, CK_OFF_T, char *) );
696 #ifdef VMS
697 #define xxscreen(a,b,c,d) \
698 if (local && fdispla != XYFD_N) \
699 ckscreen((int)a,(char)b,(CK_OFF_T)c,(char *)d)
700 #else
701 #define xxscreen(a,b,c,d) \
702 if (local && !backgrd && fdispla != XYFD_N) \
703 ckscreen((int)a,(char)b,(CK_OFF_T)c,(char *)d)
704 #endif /* VMS */
705 #endif /* NODISPLAY */
706 
707 #define SCR_FN 1    	/* filename */
708 #define SCR_AN 2    	/* as-name */
709 #define SCR_FS 3 	/* file-size */
710 #define SCR_XD 4    	/* x-packet data */
711 #define SCR_ST 5      	/* File status: */
712 #define   ST_OK   0   	/*  Transferred OK */
713 #define   ST_DISC 1 	/*  Discarded */
714 #define   ST_INT  2     /*  Interrupted */
715 #define   ST_SKIP 3 	/*  Skipped */
716 #define   ST_ERR  4 	/*  Fatal Error */
717 #define   ST_REFU 5     /*  Refused (use Attribute codes for reason) */
718 #define   ST_INC  6	/*  Incompletely received */
719 #define   ST_MSG  7	/*  Informational message */
720 #define   ST_SIM  8	/*  Transfer simulated (e.g. would be sent) */
721 #define SCR_PN 6    	/* packet number */
722 #define SCR_PT 7    	/* packet type or pseudotype */
723 #define SCR_TC 8    	/* transaction complete */
724 #define SCR_EM 9    	/* error message */
725 #define SCR_WM 10   	/* warning message */
726 #define SCR_TU 11	/* arbitrary undelimited text */
727 #define SCR_TN 12   	/* arbitrary new text, delimited at beginning */
728 #define SCR_TZ 13   	/* arbitrary text, delimited at end */
729 #define SCR_QE 14	/* quantity equals (e.g. "foo: 7") */
730 #define SCR_CW 15	/* close screen window */
731 #define SCR_CD 16       /* display current directory */
732 #define SCR_MS 17	/* message from client */
733 
734 /* Skip reasons */
735 
736 #define SKP_DAT 1			/* Date-Time (Older) */
737 #define SKP_EQU 2			/* Date-Time (Equal) */
738 #define SKP_TYP 3			/* Type */
739 #define SKP_SIZ 4			/* Size */
740 #define SKP_NAM 5			/* Name collision */
741 #define SKP_EXL 6			/* Exception list */
742 #define SKP_DOT 7			/* Dot file */
743 #define SKP_BKU 8			/* Backup file */
744 #define SKP_RES 9			/* Recovery not needed */
745 #define SKP_ACC 10			/* Access denied */
746 #define SKP_NRF 11			/* Not a regular file */
747 #define SKP_SIM 12			/* Simulation (WOULD BE SENT) */
748 #define SKP_XUP 13 /* Simulation: Would be sent because remote file older */
749 #define SKP_XNX 14 /* Simulation: ditto, because remote file does not exist */
750 
751 /* Macros */
752 
753 #ifndef CKCMAI
754 extern int tcp_incoming;		/* Used by ENABLE macro */
755 #endif /* CKCMAI */
756 
757 #ifndef TCPSOCKET
758 /*
759   ENABLED tells whether a server-side service is enabled.
760   0 = disabled, 1 = local, 2 = remote.
761   A "set host *" connection is technically local but logically remote
762 */
763 #define ENABLED(x) ((local && (x & 1)) || (!local && (x & 2)))
764 #else
765 #define ENABLED(x) (((local && !tcp_incoming) && (x & 1)) || \
766 ((!local || tcp_incoming) && (x&2)))
767 #endif /* TCPSOCKET */
768 
769 /* These are from the book */
770 
771 #define tochar(ch)  (((ch) + SP ) & 0xFF )	/* Number to character */
772 #define xunchar(ch) (((ch) - SP ) & 0xFF )	/* Character to number */
773 #define ctl(ch)     (((ch) ^ 64 ) & 0xFF )	/* Control/Uncontrol toggle */
774 #define unpar(ch)   (((ch) & 127) & 0xFF )	/* Clear parity bit */
775 
776 #ifndef NOLOCAL				/* CONNECT return status codes */
777 
778 /* Users will see the numbers so they can't be changed */
779 /* Numbers >= 100 indicate connection loss */
780 
781 #define CSX_NONE        0		/* No CONNECT yet so no status */
782 #define CSX_ESCAPE      1		/* User Escaped back */
783 #define CSX_TRIGGER     2		/* Trigger was encountered */
784 #define CSX_IKSD        3		/* IKSD autosynchronization */
785 #define CSX_APC         4		/* Application Program Command */
786 #define CSX_IDLE        5		/* Idle limit exceeded */
787 #define CSX_TN_ERR      6		/* Telnet Error */
788 #define CSX_MACRO       7               /* Macro bound to keystroke */
789 #define CSX_TIME        8               /* Time Limit exceeded */
790 #define CSX_INTERNAL  100		/* Internal error */
791 #define CSX_CARRIER   101		/* Carrier required but not detected */
792 #define CSX_IOERROR   102		/* I/O error on connection */
793 #define CSX_HOSTDISC  103		/* Disconnected by host */
794 #define CSX_USERDISC  104		/* Disconnected by user */
795 #define CSX_SESSION   105		/* Session Limit exceeded */
796 #define CSX_TN_POL    106		/* Rejected due to Telnet Policy */
797 #define CSX_KILL_SIG  107               /* Received Kill Signal */
798 
799 /* SET TERMINAL IDLE-ACTION values */
800 
801 #define IDLE_RET  0			/* Return to prompt */
802 #define IDLE_EXIT 1			/* Exit from Kermit */
803 #define IDLE_HANG 2			/* Hangup the connection */
804 #define IDLE_OUT  3			/* OUTPUT a string */
805 #define IDLE_TNOP 4			/* TELNET NOP */
806 #define IDLE_TAYT 5			/* TELNET AYT */
807 #endif /* NOLOCAL */
808 
809 /* Modem and dialing definitions */
810 
811 #ifndef NODIAL
812 
813 /* Modem capabilities (bit values) */
814 #define CKD_AT   1			/* Hayes AT commands and responses */
815 #define CKD_V25  2			/* V.25bis commands and responses */
816 #define CKD_SB   4			/* Speed buffering */
817 #define CKD_EC   8			/* Error correction */
818 #define CKD_DC  16			/* Data compression */
819 #define CKD_HW  32			/* Hardware flow control */
820 #define CKD_SW  64			/* (Local) software flow control */
821 #define CKD_KS 128			/* Kermit spoofing */
822 #define CKD_TB 256			/* Made by Telebit */
823 #define CKD_ID 512			/* Has Caller ID */
824 
825 /* DIAL command result codes */
826 #define DIA_UNK   -1			/* No DIAL command given yet */
827 #define DIA_OK     0			/* DIAL succeeded */
828 #define DIA_NOMO   1			/* Modem type not specified */
829 #define DIA_NOLI   2			/* Communication line not spec'd */
830 #define DIA_OPEN   3			/* Line can't be opened */
831 #define DIA_NOSP   4			/* Speed not specified */
832 #define DIA_HANG   5			/* Hangup failure */
833 #define DIA_IE     6			/* Internal error (malloc, etc) */
834 #define DIA_IO     7			/* I/O error */
835 #define DIA_TIMO   8			/* Dial timeout expired */
836 #define DIA_INTR   9			/* Dialing interrupted by user */
837 #define DIA_NRDY  10			/* Modem not ready */
838 #define DIA_PART  11			/* Partial dial command OK */
839 #define DIA_DIR   12			/* Dialing directory error */
840 #define DIA_HUP   13			/* Modem was hung up OK */
841 #define DIA_NRSP  19			/* No response from modem */
842 #define DIA_ERR   20			/* Modem command error */
843 #define DIA_NOIN  21			/* Failure to initialize modem */
844 #define DIA_BUSY  22			/* Phone busy */
845 #define DIA_NOCA  23			/* No carrier */
846 #define DIA_NODT  24			/* No dialtone */
847 #define DIA_RING  25			/* Ring, incoming call */
848 #define DIA_NOAN  26			/* No answer */
849 #define DIA_DISC  27			/* Disconnected */
850 #define DIA_VOIC  28			/* Answered by voice */
851 #define DIA_NOAC  29			/* Access denied, forbidden call */
852 #define DIA_BLCK  30			/* Blacklisted */
853 #define DIA_DELA  31			/* Delayed */
854 #define DIA_FAX   32			/* Fax */
855 #define DIA_DIGI  33                    /* Digital Line */
856 #define DIA_TAPI  34			/* TAPI dialing failure */
857 #define DIA_UERR  98			/* Unknown error */
858 #define DIA_UNSP  99		/* Unspecified failure detected by modem */
859 
860 #define MDMINF	struct mdminf
861 
862 MDMINF {			/* Structure for modem-specific information */
863 
864     char * name;		/* Descriptive name */
865     char * pulse;		/* Command to force pulse dialing */
866     char * tone;		/* Command to force tone dialing */
867     int    dial_time;		/* Time modem allows for dialing (secs) */
868     char * pause_chars;		/* Character(s) to tell modem to pause */
869     int	   pause_time;		/* Time associated with pause chars (secs) */
870     char * wake_str;		/* String to wakeup modem & put in cmd mode */
871     int	   wake_rate;		/* Delay between wake_str characters (msecs) */
872     char * wake_prompt;		/* String prompt after wake_str */
873     char * dmode_str;		/* String to put modem in dialing mode */
874     char * dmode_prompt;	/* String prompt for dialing mode */
875     char * dial_str;		/* Dialing string, with "%s" for number */
876     int    dial_rate;		/* Interchar delay to modem (msec) */
877     int    esc_time;		/* Escape sequence guard time (msec) */
878     int    esc_char;		/* Escape character */
879     char * hup_str;		/* Hangup string */
880     char * hwfc_str;		/* Hardware flow control string */
881     char * swfc_str;		/* Software flow control string */
882     char * nofc_str;		/* No flow control string */
883     char * ec_on_str;		/* Error correction on string */
884     char * ec_off_str;		/* Error correction off string */
885     char * dc_on_str;		/* Data compression on string */
886     char * dc_off_str;		/* Data compression off string */
887     char * aa_on_str;		/* Autoanswer on string */
888     char * aa_off_str;		/* Autoanswer off string */
889     char * sb_on_str;		/* Speed buffering on string */
890     char * sb_off_str;		/* Speed buffering off string */
891     char * sp_on_str;		/* Speaker on string */
892     char * sp_off_str;		/* Speaker off string */
893     char * vol1_str;		/* Volume low string */
894     char * vol2_str;		/* Volume med string */
895     char * vol3_str;		/* Volume high string */
896     char * ignoredt;		/* Ignore dialtone string */
897     char * ini2;		/* Last-minute init string */
898     long   max_speed;		/* Maximum interface speed */
899     long   capas;		/* Capability bits */
900     /* function to read modem's response string to a non-dialing command */
901     _PROTOTYP( int (*ok_fn), (int,int) );
902 };
903 #endif /* NODIAL */
904 
905 /* Symbols for File Attributes */
906 
907 #define AT_XALL  0			/* All of them */
908 #define AT_ALLY  1			/* All of them on (Yes) */
909 #define AT_ALLN  2			/* All of them off (no) */
910 #define AT_LENK  3			/* Length in K */
911 #define AT_FTYP  4			/* File Type */
912 #define AT_DATE  5			/* Creation date */
913 #define AT_CREA  6			/* Creator */
914 #define AT_ACCT  7			/* Account */
915 #define AT_AREA  8			/* Area */
916 #define AT_PSWD  9			/* Password for area */
917 #define AT_BLKS 10			/* Blocksize */
918 #define AT_ACCE 11			/* Access */
919 #define AT_ENCO 12			/* Encoding */
920 #define AT_DISP 13			/* Disposition */
921 #define AT_LPRO 14			/* Local Protection */
922 #define AT_GPRO 15			/* Generic Protection */
923 #define AT_SYSI 16			/* System ID */
924 #define AT_RECF 17			/* Record Format */
925 #define AT_SYSP 18			/* System-Dependent Parameters */
926 #define AT_LENB 19			/* Length in Bytes */
927 #define AT_EOA  20			/* End of Attributes */
928 
929 /* Kermit packet information structure */
930 
931 struct pktinfo {			/* Packet information structure */
932     CHAR *bf_adr;			/*  buffer address */
933     int   bf_len;			/*  buffer length */
934     CHAR *pk_adr;			/* Packet address within buffer */
935     int   pk_len;			/*  length of data within buffer */
936     int   pk_typ;			/*  packet type */
937     int   pk_seq;			/*  packet sequence number */
938     int   pk_rtr;			/*  retransmission count */
939 };
940 
941 /* Send Modes (indicating which type of SEND command was used) */
942 
943 #define SM_SEND     0
944 #define SM_MSEND    1
945 #define SM_RESEND   2
946 #define SM_PSEND    3
947 #define SM_MAIL     4
948 #define SM_PRINT    5
949 
950 #define OPTBUFLEN 256
951 
952 /* File-related symbols and structures */
953 /* Used by SET FILE command but also by protocol and i/o modules */
954 
955 #define XMODE_A 0	/* Transfer mode Automatic */
956 #define XMODE_M 1	/* Transfer mode Manual    */
957 
958 #define   XYFILN 0  	/*  Naming  */
959 #define     XYFN_L 0	/*    Literal */
960 #define     XYFN_C 1	/*    Converted */
961 #define   XYFILT 1  	/*  Type    */
962 #define     XYFT_T 0    /*    Text  */
963 #define     XYFT_B 1    /*    Binary */
964 #define     XYFT_I 2    /*    Image or Block (VMS) */
965 #define     XYFT_L 3	/*    Labeled (tagged binary) (VMS or OS/2) */
966 #define     XYFT_U 4    /*    Binary Undefined (VMS) */
967 #define     XYFT_M 5	/*    MacBinary (Macintosh) */
968 #define     XYFT_X 6	/*    TENEX (FTP TYPE L 8) */
969 #define     XYFT_D 99   /*    Debug (for session logs) */
970 #define   XYFILW 2      /*  Warning */
971 #define   XYFILD 3      /*  Display */
972 #define   XYFILC 4      /*  Character set */
973 #define   XYFILF 5      /*  Record Format */
974 #define     XYFF_S  0   /*    Stream */
975 #define     XYFF_V  1   /*    Variable */
976 #define     XYFF_VB 2   /*    Variable with RCW's */
977 #define     XYFF_F  3   /*    Fixed length */
978 #define     XYFF_U  4   /*    Undefined */
979 #define   XYFILR 6      /*  Record length */
980 #define   XYFILO 7      /*  Organization */
981 #define     XYFO_S 0    /*    Sequential */
982 #define     XYFO_I 1    /*    Indexed */
983 #define     XYFO_R 2    /*    Relative */
984 #define   XYFILP 8      /*  Printer carriage control */
985 #define     XYFP_N 0    /*    Newline (imbedded control characters) */
986 #define     XYFP_F 1    /*    FORTRAN (space, 1, +, etc, in column 1 */
987 #define     XYFP_P 2    /*    Special printer carriage controls */
988 #define     XYFP_X 4    /*    None */
989 #define   XYFILX 9      /*  Collision Action */
990 #define     XYFX_A 3    /*    Append */
991 #define     XYFX_Q 5    /*    Ask */
992 #define     XYFX_B 2    /*    Backup */
993 #define     XYFX_D 4    /*    Discard */
994 #define     XYFX_R 0    /*    Rename */
995 #define     XYFX_X 1    /*    Replace */
996 #define     XYFX_U 6    /*    Update */
997 #define     XYFX_M 7    /*    Modtimes differ */
998 #define   XYFILB 10     /*  Blocksize */
999 #define   XYFILZ 11     /*  Disposition */
1000 #define     XYFZ_N 0    /*    New, Create */
1001 #define     XYFZ_A 1    /*    New, append if file exists, else create */
1002 #define     XYFZ_O 2    /*    Old, file must exist */
1003 #define   XYFILS 12     /*  File Byte Size */
1004 #define   XYFILL 13     /*  File Label (VMS) */
1005 #define   XYFILI 14     /*  File Incomplete */
1006 #define   XYFILQ 15     /*  File path action (strip or not) */
1007 #define   XYFILG 16     /*  File download directory */
1008 #define   XYFILA 17     /*  Line terminator for local text files */
1009 #define     XYFA_L 012  /*    LF (as in UNIX) */
1010 #define     XYFA_C 015  /*    CR (as in OS-9 or Mac OS) */
1011 #define     XYFA_2 000  /*  CRLF -- Note: this must be defined as 0 */
1012 #define   XYFILY 18     /*  Destination */
1013 #define   XYFILV 19	/*  EOF Detection Method */
1014 #define     XYEOF_L 0   /*    File length */
1015 #define     XYEOF_Z 1   /*    Ctrl-Z in file */
1016 #define   XYFILH   20   /*  OUTPUT parameters - buffered, blocking, etc */
1017 #define   XYFIBP   21	/*  BINARY-PATTERN */
1018 #define   XYFITP   22   /*  TEXT-PATTERN */
1019 #define   XYFIPA   23   /*  PATTERNS ON/OFF */
1020 #define   XYFILU   24   /*  UCS ... */
1021 #define   XYF_PRM  25   /*  PERMISSIONS, PROTECTION */
1022 #define   XYF_INSP 26   /*  INSPECTION (SCAN) */
1023 #define   XYF_DFLT 27   /*  DEFAULT (character sets) */
1024 #define   XYF_SSPA 28   /*  STRINGSPACE */
1025 #define   XYF_LSIZ 29   /*  LISTSIZE */
1026 
1027 /* File Type (return code) definitions and corresponding name strings */
1028 
1029 #define FT_7BIT 0			/* 7-bit text */
1030 #define FT_8BIT 1			/* 8-bit text */
1031 #define FT_UTF8 2			/* UTF8 */
1032 #define FT_UCS2 3			/* UCS2 */
1033 #define FT_TEXT 4			/* Unknown text */
1034 #define FT_BIN  5			/* Binary */
1035 #define SCANFILEBUF 49152		/* Size of file scan (48K) */
1036 
1037 /* Connection closed reasons */
1038 
1039 #define WC_REMO   0			/* Closed by remote */
1040 #define WC_CLOS   1			/* Closed from our end */
1041 #define WC_TELOPT 2			/* Telnet negotiation failure */
1042 
1043 #ifdef BIGBUFOK
1044 #define FTPATTERNS 256
1045 #else
1046 #define FTPATTERNS 64
1047 #endif /* BIGBUFOK */
1048 
1049 #define SYS_UNK    0			/* Selected server system types */
1050 #define SYS_UNIX   1
1051 #define SYS_WIN32  2
1052 #define SYS_VMS    3
1053 #define SYS_OS2    4
1054 #define SYS_DOS    5
1055 #define SYS_TOPS10 6
1056 #define SYS_TOPS20 7
1057 #define SYS_VOS    8
1058 #define SYS_DG     9
1059 #define SYS_OSK    10
1060 #define SYS_MAX    11
1061 
1062 #ifdef CK_SMALL
1063 #define PWBUFL 63
1064 #else
1065 #define PWBUFL 255
1066 #endif /* CK_SMALL */
1067 
1068 #ifdef OS2
1069 struct tt_info_rec {			/* Terminal emulation info */
1070     char  *x_name;
1071     char *x_aliases[4];
1072     char  *x_id;
1073 };
1074 #endif /* OS2 */
1075 
1076 /* BEEP TYPES */
1077 #define BP_BEL  0			/* Terminal bell */
1078 #define BP_NOTE 1			/* Info */
1079 #define BP_WARN 2			/* Warning */
1080 #define BP_FAIL 3			/* Error */
1081 
1082 #ifndef NOIKSD
1083 #ifdef IKSDB				/* IKSD Database definitions */
1084 
1085 /* Field values */
1086 
1087 #define DBF_INUSE    1			/* Flag bits... In use */
1088 #define DBF_USER     2			/* Real user (versus anonymous) */
1089 #define DBF_LOGGED   4			/* Logged in (versus not) */
1090 
1091 /* Data Definitions... */
1092 
1093 /* Numeric fields, hex, right justified, 0-filled on left */
1094 
1095 #define db_FLAGS     0			/* Field 0: Flags */
1096 #define DB_FLAGS     0			/* Offset: 0 */
1097 #define dB_FLAGS     4			/* Length: 4 (hex digits) */
1098 
1099 #define db_ATYPE     1			/* Field 1: Authentication type */
1100 #define DB_ATYPE     4			/* 4 hex digits */
1101 #define dB_ATYPE     4
1102 
1103 #define db_AMODE     2			/* Field 2: Authentication mode */
1104 #define DB_AMODE     8			/* 4 hex digits */
1105 #define dB_AMODE     4
1106 
1107 #define db_STATE     3			/* Field 3: State - 4 hex digits*/
1108 #define DB_STATE    12			/* 4 hex digits */
1109 #define dB_STATE     4
1110 
1111 #define db_MYPID     4			/* Field 4: My PID */
1112 #define DB_MYPID    16			/* 16 hex digits left padded with 0 */
1113 #define dB_MYPID    16
1114 
1115 #define db_SADDR     5			/* Field 5: Server (my) IP address */
1116 #define DB_SADDR    32			/* 16 hex digits left padded with 0 */
1117 #define dB_SADDR    16
1118 
1119 #define db_CADDR     6			/* Field 6: Client IP address */
1120 #define DB_CADDR    48			/* 16 hex digits left padded with 0 */
1121 #define dB_CADDR    16
1122 
1123 /* Date-time fields (17 right-adjusted in 18 for Y10K readiness) */
1124 
1125 #define db_START     7			/* Field 7: Session start date-time */
1126 #define DB_START    65			/* 64 is leading space for Y10K */
1127 #define dB_START    17
1128 
1129 #define db_LASTU     8			/* Field 8: Last lastu date-time */
1130 #define DB_LASTU    83			/* 82 is leading space for Y10K */
1131 #define dB_LASTU    17
1132 
1133 #define db_ULEN      9			/* Field 9: Length of Username */
1134 #define DB_ULEN    100			/* 4 hex digits */
1135 #define dB_ULEN      4
1136 
1137 #define db_DLEN     10			/* Field 10: Length of Directory */
1138 #define DB_DLEN    104			/* 4 hex digits */
1139 #define dB_DLEN      4
1140 
1141 #define db_ILEN     11			/* Field 11: Length of Info */
1142 #define DB_ILEN    108			/* 4 hex digits */
1143 #define dB_ILEN      4
1144 
1145 #define db_PAD1     12			/* Field 12: (Reserved) */
1146 #define DB_PAD1    112			/* filled with spaces */
1147 #define dB_PAD1    912
1148 
1149 /* String fields, all right-padded with blanks */
1150 
1151 #define db_USER     13			/* Field 13: Username */
1152 #define DB_USER   1024			/* right-padded with spaces */
1153 #define dB_USER   1024
1154 
1155 #define db_DIR      14			/* Field 14: Current directory */
1156 #define DB_DIR    2048			/* right-padded with spaces */
1157 #define dB_DIR    1024
1158 
1159 #define db_INFO     15			/* Field 15: State-specific info */
1160 #define DB_INFO   3072			/* right-padded with spaces */
1161 #define dB_INFO   1024
1162 
1163 #define DB_RECL   4096			/* Database record length */
1164 
1165 /* Offset, length, and type of each field thru its db_XXX symbol */
1166 
1167 #define DBT_HEX 1			/* Hexadecimal number */
1168 #define DBT_STR 2			/* String */
1169 #define DBT_DAT 3			/* Date-Time yyyymmdd hh:mm:ss */
1170 #define DBT_UND 9			/* Undefined and blank */
1171 
1172 struct iksdbfld {
1173     int off;				/* Position (offset) */
1174     int len;				/* Length (bytes) */
1175     int typ;				/* Data type */
1176 };
1177 _PROTOTYP(int dbinit, (void));
1178 _PROTOTYP(int initslot, (int));
1179 _PROTOTYP(int getslot, (void));
1180 _PROTOTYP(int freeslot, (int));
1181 _PROTOTYP(int updslot, (int));
1182 _PROTOTYP(int slotstate, (int, char *, char *, char *));
1183 _PROTOTYP(int slotdir, (char *, char *));
1184 #endif /* IKSDB */
1185 #endif /* NOIKSD */
1186 
1187 /* ANSI forward declarations for protocol-related functions. */
1188 
1189 _PROTOTYP( int input, (void) );
1190 _PROTOTYP( int inibufs, (int, int) );
1191 _PROTOTYP( int makebuf, (int, int, CHAR [], struct pktinfo *) );
1192 _PROTOTYP( int mksbuf, (int) );
1193 _PROTOTYP( int mkrbuf, (int) );
1194 _PROTOTYP( int spack, (char, int, int, CHAR *) );
1195 _PROTOTYP( VOID proto, (void) );
1196 _PROTOTYP( int rpack, (void) );
1197 _PROTOTYP( int ack, (void) );
1198 _PROTOTYP( int nack, (int) );
1199 _PROTOTYP( int ackn, (int) );
1200 _PROTOTYP( int ack1, (CHAR *) );
1201 _PROTOTYP( int ackns, (int, CHAR *) );
1202 #ifdef STREAMING
1203 _PROTOTYP( int fastack, (void) );
1204 #endif /* STREAMING */
1205 _PROTOTYP( int resend, (int) );
1206 _PROTOTYP( int errpkt, (CHAR *) );
1207 _PROTOTYP( VOID logpkt, (char, int, CHAR *, int) );
1208 _PROTOTYP( CHAR dopar, (CHAR) );
1209 _PROTOTYP( int chk1, (CHAR *, int) );
1210 _PROTOTYP( unsigned int chk2, (CHAR *, int) );
1211 _PROTOTYP( unsigned int chk3, (CHAR *, int) );
1212 _PROTOTYP( int sipkt, (char) );
1213 _PROTOTYP( int sopkt, (void) );
1214 _PROTOTYP( int sinit, (void) );
1215 _PROTOTYP( VOID rinit, (CHAR *) );
1216 _PROTOTYP( int spar, (CHAR *) );
1217 _PROTOTYP( int rcvfil, (char *) );
1218 _PROTOTYP( CHAR * rpar, (void) );
1219 _PROTOTYP( int gnfile, (void) );
1220 _PROTOTYP( int getsbuf, (int) );
1221 _PROTOTYP( int getrbuf, (void) );
1222 _PROTOTYP( int freesbuf, (int) );
1223 _PROTOTYP( int freerbuf, (int) );
1224 _PROTOTYP( int dumpsbuf, (void) );
1225 _PROTOTYP( int dumprbuf, (void) );
1226 _PROTOTYP( VOID freerpkt, (int) );
1227 _PROTOTYP( int chkwin, (int, int, int) );
1228 _PROTOTYP( int rsattr, (CHAR *) );
1229 _PROTOTYP( char *getreason, (char *) );
1230 _PROTOTYP( int scmd, (char, CHAR *) );
1231 _PROTOTYP( int encstr, (CHAR *) );
1232 _PROTOTYP( int decode, (CHAR *, int (*)(char), int) );
1233 _PROTOTYP( int bdecode, (CHAR *, int (*)(char)) );
1234 _PROTOTYP( int fnparse, (char *) );
1235 _PROTOTYP( int syscmd, (char *, char *) );
1236 _PROTOTYP( int cwd, (char *) );
1237 _PROTOTYP( int remset, (char *) );
1238 _PROTOTYP( int initattr, (struct zattr *) );
1239 _PROTOTYP( int gattr, (CHAR *, struct zattr *) );
1240 _PROTOTYP( int adebu, (char *, struct zattr *) );
1241 _PROTOTYP( int canned, (CHAR *) );
1242 _PROTOTYP( int opent, (struct zattr *) );
1243 _PROTOTYP( int ckopenx, (struct zattr *) );
1244 _PROTOTYP( int opena, (char *, struct zattr *) );
1245 _PROTOTYP( int openi, (char *) );
1246 _PROTOTYP( int openo, (char *, struct zattr *, struct filinfo *) );
1247 _PROTOTYP( int openc, (int, char *) );
1248 _PROTOTYP( int reof, (char *, struct zattr *) );
1249 _PROTOTYP( VOID reot, (void) );
1250 _PROTOTYP( int sfile, (int) );
1251 _PROTOTYP( int sattr, (int, int) );
1252 _PROTOTYP( int sdata, (void) );
1253 _PROTOTYP( int seof, (int) );
1254 _PROTOTYP( int sxeof, (int) );
1255 _PROTOTYP( int seot, (void) );
1256 _PROTOTYP( int window, (int) );
1257 _PROTOTYP( int clsif, (void) );
1258 _PROTOTYP( int clsof, (int) );
1259 _PROTOTYP( CHAR setgen, (char, char *, char *, char *) );
1260 _PROTOTYP( int getpkt, (int, int) );
1261 _PROTOTYP( int maxdata, (void) );
1262 _PROTOTYP( int putsrv, (char) );
1263 _PROTOTYP( int puttrm, (char) );
1264 _PROTOTYP( int putque, (char) );
1265 _PROTOTYP( int putfil, (char) );
1266 _PROTOTYP( int putmfil, (char) );
1267 _PROTOTYP( int zputfil, (char) );
1268 _PROTOTYP( VOID zdstuff, (CHAR) );
1269 _PROTOTYP( int tinit, (int) );
1270 _PROTOTYP( VOID pktinit, (void) );
1271 _PROTOTYP( VOID resetc, (void) );
1272 _PROTOTYP( VOID xsinit, (void) );
1273 _PROTOTYP( int adjpkl, (int,int,int) );
1274 _PROTOTYP( int chktimo, (int,int) );
1275 _PROTOTYP( int nxtpkt, (void) );
1276 _PROTOTYP( VOID rcalcpsz, (void) );
1277 _PROTOTYP( int srinit, (int, int, int) );
1278 _PROTOTYP( VOID tstats, (void) );
1279 _PROTOTYP( VOID fstats, (void) );
1280 _PROTOTYP( VOID intmsg, (long) );
1281 _PROTOTYP( VOID ermsg, (char *) );
1282 _PROTOTYP( int chkint, (void) );
1283 _PROTOTYP( VOID sdebu, (int) );
1284 _PROTOTYP( VOID rdebu, (CHAR *, int) );
1285 _PROTOTYP( char * dbchr, ( int ) );
1286 #ifdef COMMENT
1287 _PROTOTYP( SIGTYP stptrap, (int, int) );
1288 _PROTOTYP( SIGTYP trap, (int, int) );
1289 #else
1290 _PROTOTYP( SIGTYP stptrap, (int) );
1291 _PROTOTYP( SIGTYP trap, (int) );
1292 #endif /* COMMENT */
1293 _PROTOTYP( char * ck_errstr, (void) );
1294 #ifndef NOXFER
1295 _PROTOTYP( int agnbyte, (void) );
1296 #endif /* NOXFER */
1297 _PROTOTYP( int xgnbyte, (int, int, int (*)(void)) );
1298 _PROTOTYP( int xpnbyte, (int, int, int, int (*)(char)) );
1299 
1300 /* User interface functions needed by main program, etc. */
1301 
1302 _PROTOTYP( int doconect, (int,int) );
1303 _PROTOTYP( VOID setflow, (void) );
1304 _PROTOTYP( VOID prescan, (int) );
1305 _PROTOTYP( VOID setint, (void) );
1306 _PROTOTYP( VOID doinit, (void) );
1307 _PROTOTYP( VOID dofast, (void) );
1308 _PROTOTYP( VOID cmdini, (void) );
1309 _PROTOTYP( int dotake, (char *) );
1310 _PROTOTYP( int cmdlin, (void) );
1311 #ifdef OS2
1312 _PROTOTYP( int conect, (int) );
1313 #else /* OS2 */
1314 _PROTOTYP( int conect, (void) );
1315 #endif /* OS2 */
1316 #ifdef COMMENT
1317 /* Only used in Unix CONNECT module where it is defined before use */
1318 _PROTOTYP( int ckcgetc, (int) );
1319 #endif /* COMMENT */
1320 _PROTOTYP( int ckcputc, (int) );
1321 _PROTOTYP (int mdmhup, (void) );
1322 _PROTOTYP( VOID herald, (void) );
1323 _PROTOTYP( VOID fixcmd, (void) );
1324 _PROTOTYP( int doarg, (char) );
1325 _PROTOTYP( int doxarg, (char **, int) );
1326 _PROTOTYP( VOID usage, (void) );
1327 _PROTOTYP( VOID doclean, (int) );
1328 _PROTOTYP( int sndhlp, (void) );
1329 _PROTOTYP( int sndstring, (char *) );
1330 _PROTOTYP( VOID ckhost, (char *, int) );
1331 _PROTOTYP( int gettcs, (int, int) );
1332 _PROTOTYP( VOID getdialenv, (void) );
1333 _PROTOTYP( VOID setprefix, (int) );
1334 _PROTOTYP(VOID initproto,(int,char *,char *,char *,char *,char *,char*,char*));
1335 _PROTOTYP( VOID initpat, (void) );
1336 _PROTOTYP( VOID initcsets, (void) );
1337 _PROTOTYP( char * getsysid, (char *) );
1338 _PROTOTYP( int getsysix, (char *) );
1339 #ifdef CK_TIMERS
1340 _PROTOTYP( VOID rttinit, (void) );
1341 _PROTOTYP( int getrtt, (int, int) );
1342 #endif /* CK_TIMERS */
1343 
1344 _PROTOTYP( int is_a_tty, (int) );
1345 _PROTOTYP( int snddir, (char *) );
1346 _PROTOTYP( int snddel, (char *) );
1347 _PROTOTYP( int sndtype, (char *) );
1348 _PROTOTYP( int dooutput, (char *, int) );
1349 _PROTOTYP( int isabsolute, (char *) );
1350 _PROTOTYP( VOID whoarewe, (void) );
1351 _PROTOTYP( int ckmkdir, (int, char *, char **, int, int) );
1352 _PROTOTYP( int autoexitchk, (CHAR) );
1353 _PROTOTYP( VOID fcps, (void) );
1354 #ifdef OS2
1355 _PROTOTYP( VOID logchar, (unsigned short) );
1356 #else /* OS2 */
1357 _PROTOTYP( VOID logchar, (char) );
1358 #endif /* OS2 */
1359 _PROTOTYP( VOID logstr, (char *, int) );
1360 
1361 _PROTOTYP( VOID dologend, (void) );
1362 #ifdef NOLOCAL
1363 #define dologshow()
1364 #else
1365 _PROTOTYP( long dologshow, (int) );
1366 #endif /* NOLOCAL */
1367 
1368 #ifdef NODISPLAY
1369 #define fxdinit(a)
1370 #else
1371 _PROTOTYP( VOID fxdinit, (int) );
1372 #endif /* NODISPLAY */
1373 
1374 _PROTOTYP( int fileselect, (char *,
1375 			    char *, char *, char *, char *,
1376 			    CK_OFF_T, CK_OFF_T,
1377 			    int, int,
1378 			    char **) );
1379 _PROTOTYP( char * whoami, (void) );
1380 _PROTOTYP( int shoesc, (int) );
1381 
1382 #ifdef CK_APC
1383 _PROTOTYP( int chkspkt, (char *) );
1384 _PROTOTYP( int kstart, (CHAR) );
1385 _PROTOTYP( VOID autodown, (int));
1386 #ifdef CK_XYZ
1387 _PROTOTYP( int zstart, (CHAR) );
1388 #endif /* CK_XYZ */
1389 #ifdef OS2
1390 _PROTOTYP(void apc_command, (int, char*));
1391 #endif /* OS2 */
1392 #endif /* CK_APC */
1393 
1394 /* User Query data structures and functions */
1395 
1396 struct txtbox {
1397     char * t_buf;			/* Destination buffer address */
1398     int    t_len;			/* Destination buffer length */
1399     char * t_lbl;			/* Label for this field */
1400     char * t_dflt;			/* Default response for this field */
1401     int    t_echo;			/* 0 = no, 1 = yes, 2 = asterisks */
1402 };
1403 
1404 #define DEFAULT_UQ_TIMEOUT  0
1405 _PROTOTYP(int uq_ok, (char *,char *,int,char **,int) );
1406 _PROTOTYP(int uq_txt, (char *,char *,int,char **,char *,int,char *,int));
1407 _PROTOTYP(int uq_mtxt, (char *,char **,int,struct txtbox[]) );
1408 _PROTOTYP(int uq_file, (char *,char *,int,char **,char *,char *,int));
1409 
1410 #ifdef CK_URL
1411 struct urlopt {
1412     char * nam;
1413     char * val;
1414 };
1415 #define MAX_URL_OPTS    16
1416 struct urldata {
1417     char * sav;			/* The URL itself */
1418     char * svc;			/* Service */
1419     char * usr;			/* User */
1420     char * psw;			/* Password */
1421     char * hos;			/* Host */
1422     char * por;			/* Port */
1423     char * pth;			/* Path */
1424     int    nopts;               /* number of options */
1425     struct urlopt opt[MAX_URL_OPTS];   /* options */
1426 };
1427 _PROTOTYP(int urlparse, (char *, struct urldata *));
1428 #endif /* CK_URL */
1429 
1430 #endif /* CKCKER_H */
1431 
1432 /* End of ckcker.h */
1433