BSD 4_4_Lite2 development
[unix-history] / usr / src / contrib / kermit-5A.188 / ckcker.h
CommitLineData
fb8bfabd
C
1/* ckcker.h -- Symbol and macro definitions for C-Kermit */
2
3/*
4 Author: Frank da Cruz (fdc@columbia.edu, FDCCU@CUVMA.BITNET),
5 Columbia University Center for Computing Activities.
6 First released January 1985.
7 Copyright (C) 1985, 1992, Trustees of Columbia University in the City of New
8 York. Permission is granted to any individual or institution to use this
9 software as long as it is not sold for profit. This copyright notice must be
10 retained. This software may not be included in commercial products without
11 written permission of Columbia University.
12*/
13
14#ifndef CKCKER_H
15#define CKCKER_H
16
17#ifdef NOICP /* No Interactive Command Parser */
18#ifndef NOSPL /* implies... */
19#define NOSPL /* No Script Programming Language */
20#endif /* NOSPL */
21#endif /* NOICP */
22
23/* Codes for what we are doing now */
24
25#define W_NOTHING 0 /* Nothing */
26#define W_SEND 2 /* SENDing or MAILing */
27#define W_RECV 4 /* RECEIVEing or GETting */
28#define W_REMO 8 /* Doing a REMOTE command */
29#define W_CONNECT 16 /* CONNECT mode */
30#define W_COMMAND 32 /* Command mode */
31
32/* Terminal types */
33#define VT100 0 /* Also for VT52 mode */
34#define TEKTRONIX 1
35
36/* Normal packet and window size */
37
38#define MAXPACK 94 /* Maximum unextended packet size */
39 /* Can't be more than 94! */
40#define MAXWS 31 /* Maximum window size */
41 /* Can't be more than 31! */
42
43/* Maximum long packet size for sending packets */
44/* Override these from cc command line via -DMAXSP=nnn */
45
46#ifdef DYNAMIC
47#ifndef MAXSP
48#define MAXSP 9024
49#endif /* MAXSP */
50#else /* not DYNAMIC */
51#ifndef MAXSP
52#define MAXSP 2048
53#endif /* MAXSP */
54#endif /* DYNAMIC */
55
56/* Maximum long packet size for receiving packets */
57/* Override these from cc command line via -DMAXRP=nnn */
58
59#ifdef DYNAMIC
60#ifndef MAXRP
61#define MAXRP 9024
62#endif /* MAXRP */
63#else /* not DYNAMIC */
64#ifndef MAXRP
65#define MAXRP 2048
66#endif /* MAXRP */
67#endif /* DYNAMIC */
68
69#ifdef COMMENT /* Restriction removed in edit 185 */
70#ifdef VMS /* Dynamic or not, */
71#undef MAXSP /* VMS seems to have an intrinsic */
72#define MAXSP 1920 /* limit of about 1920. */
73#undef MAXRP
74#define MAXRP 1920
75#endif /* VMS */
76#endif /* COMMENT */
77
78/* Default sizes for windowed packet buffers */
79/* Override these from cc command line via -DSBSIZ=nnn, -DRBSIZ=nnn */
80
81#ifdef DYNAMIC
82#ifndef SBSIZ
83#define SBSIZ 9050
84#endif /* SBSIZ */
85#ifndef RBSIZ
86#define RBSIZ 9050
87#endif /* RBSIZ */
88#else /* not DYNAMIC */
89#ifndef SBSIZ
90#define SBSIZ (MAXPACK * (MAXWS + 1))
91#endif /* SBSIZ */
92#ifndef RBSIZ
93#define RBSIZ (MAXPACK * (MAXWS + 1))
94#endif /* RBSIZ */
95#endif /* DYNAMIC */
96
97#ifdef COMMENT /* Restriction removed in edit 185 */
98#ifdef VMS /* VMS again... */
99#undef SBSIZ
100#define SBSIZ 1930
101#undef RBSIZ
102#define RBSIZ 1930
103#endif /* VMS */
104#endif /* COMMENT */
105
106/* Kermit parameters and defaults */
107
108#define CTLQ '#' /* Control char prefix I will use */
109#define MYEBQ '&' /* 8th-Bit prefix char I will use */
110#define MYRPTQ '~' /* Repeat count prefix I will use */
111
112#define MAXTRY 10 /* Times to retry a packet */
113#define MYPADN 0 /* How many padding chars I need */
114#define MYPADC '\0' /* Which padding character I need */
115
116#define DMYTIM 7 /* Default timeout interval to use. */
117#define URTIME 10 /* Timeout interval to use on me. */
118#define DSRVTIM 0 /* Default server cmd wait timeout. */
119
120#define DEFTRN 0 /* Default line turnaround handshake */
121#define DEFPAR 0 /* Default parity */
122#define MYEOL CR /* Incoming packet terminator. */
123
124#define DRPSIZ 90 /* Default incoming packet size. */
125#define DSPSIZ 90 /* Default outbound packet size. */
126
127#define DDELAY 5 /* Default delay. */
128#define DSPEED 9600 /* Default line speed. */
129
130#ifdef OS2 /* Default CONNECT-mode */
131#define DFESC 29 /* escape character */
132#else
133#ifdef NEXT /* Ctrl-] for PC and NeXT */
134#define DFESC 29
135#else
136#ifdef GEMDOS /* And Atari ST */
137#define DFESC 29
138#else
139#define DFESC 28 /* Ctrl-backslash for others */
140#endif /* GEMDOS */
141#endif /* NEXT */
142#endif /* OS2 */
143
144#ifdef NOPUSH /* NOPUSH implies NOJC */
145#ifndef NOJC /* (no job control) */
146#define NOJC
147#endif /* NOJC */
148#endif /* NOPUSH */
149
150#ifdef UNIX /* Default for SET SUSPEND */
151#ifdef NOJC /* UNIX but job control disabled */
152#define DFSUSP 0
153#else /* UNIX, job control enabled. */
154#define DFSUSP 1
155#endif /* NOJC */
156#else
157#define DFSUSP 0
158#endif /* UNIX */
159
160/* Files */
161
162#define ZCTERM 0 /* Console terminal */
163#define ZSTDIO 1 /* Standard input/output */
164#define ZIFILE 2 /* Current input file (SEND, etc) (in) */
165#define ZOFILE 3 /* Current output file (RECEIVE, GET) (out) */
166#define ZDFILE 4 /* Current debugging log file (out) */
167#define ZTFILE 5 /* Current transaction log file (out) */
168#define ZPFILE 6 /* Current packet log file (out) */
169#define ZSFILE 7 /* Current session log file (out) */
170#define ZSYSFN 8 /* Input/Output from a system function */
171#define ZRFILE 9 /* Local file for READ (in) */
172#define ZWFILE 10 /* Local file for WRITE (out) */
173#define ZNFILS 11 /* How many defined file numbers */
174
175/*
176 Buffered file i/o is used to avoid gratuitous function calls while encoding a
177 packet. The previous way involved 2 nested function calls for EACH character
178 of the file. This way, we only do 2 calls per K of data. This reduces
179 packet encoding time to 1% of its former cost. Originally added by Paul
180 Placeway.
181*/
182#ifdef VMS /* In VMS, allow for longest possible RMS record */
183#ifdef DYNAMIC
184#define INBUFSIZE 32768 /* File input buffer size */
185#define OBUFSIZE 32768 /* File output buffer size */
186#else
187#define INBUFSIZE 4096 /* File input buffer size */
188#define OBUFSIZE 4096 /* File output buffer size */
189#endif /* DYNAMIC */
190#else /* Not VMS */ /* For all others, just use a 1K buffer */
191#define INBUFSIZE 1024
192#define OBUFSIZE 1024
193#endif /* VMS */
194
195/* get the next char; sorta like a getc() macro */
196#define zminchar() (((--zincnt)>=0) ? ((int)(*zinptr++) & 0377) : zinfill())
197
198/* stuff a character into the input buffer */
199#define zmstuff(c) zinptr--, *zinptr = c, zincnt++
200
201/* put a character to a file, like putchar() macro */
202#define zmchout(c) \
203((*zoutptr++=(char)(c)),(((++zoutcnt)>=OBUFSIZE)?zoutdump():0))
204
205/* Screen functions */
206
207#define SCR_FN 1 /* filename */
208#define SCR_AN 2 /* as-name */
209#define SCR_FS 3 /* file-size */
210#define SCR_XD 4 /* x-packet data */
211#define SCR_ST 5 /* File status: */
212#define ST_OK 0 /* Transferred OK */
213#define ST_DISC 1 /* Discarded */
214#define ST_INT 2 /* Interrupted */
215#define ST_SKIP 3 /* Skipped */
216#define ST_ERR 4 /* Fatal Error */
217#define ST_REFU 5 /* Refused (use Attribute codes for reason) */
218#define ST_INC 6 /* Incompletely received */
219#define SCR_PN 6 /* packet number */
220#define SCR_PT 7 /* packet type or pseudotype */
221#define SCR_TC 8 /* transaction complete */
222#define SCR_EM 9 /* error message */
223#define SCR_WM 10 /* warning message */
224#define SCR_TU 11 /* arbitrary undelimited text */
225#define SCR_TN 12 /* arbitrary new text, delimited at beginning */
226#define SCR_TZ 13 /* arbitrary text, delimited at end */
227#define SCR_QE 14 /* quantity equals (e.g. "foo: 7") */
228#define SCR_CW 15 /* close screen window */
229
230/* Macros */
231
232#define tochar(ch) (((ch) + SP ) & 0xFF ) /* Number to character */
233#define xunchar(ch) (((ch) - SP ) & 0xFF ) /* Character to number */
234#define ctl(ch) (((ch) ^ 64 ) & 0xFF ) /* Controllify/Uncontrollify */
235#define unpar(ch) (((ch) & 127) & 0xFF ) /* Clear parity bit */
236
237/* Symbols for File Attributes */
238
239#define AT_XALL 0 /* All of them */
240#define AT_ALLY 1 /* All of them on (Yes) */
241#define AT_ALLN 2 /* All of them off (no) */
242#define AT_LENK 3 /* Length in K */
243#define AT_FTYP 4 /* File Type */
244#define AT_DATE 5 /* Creation date */
245#define AT_CREA 6 /* Creator */
246#define AT_ACCT 7 /* Account */
247#define AT_AREA 8 /* Area */
248#define AT_PSWD 9 /* Password for area */
249#define AT_BLKS 10 /* Blocksize */
250#define AT_ACCE 11 /* Access */
251#define AT_ENCO 12 /* Encoding */
252#define AT_DISP 13 /* Disposition */
253#define AT_LPRO 14 /* Local Protection */
254#define AT_GPRO 15 /* Generic Protection */
255#define AT_SYSI 16 /* System ID */
256#define AT_RECF 17 /* Record Format */
257#define AT_SYSP 18 /* System-Dependent Parameters */
258#define AT_LENB 19 /* Length in Bytes */
259
260/* Kermit packet information structure */
261
262struct pktinfo { /* Packet information structure */
263 CHAR *bf_adr; /* buffer address */
264 int bf_len; /* buffer length */
265 CHAR *pk_adr; /* Packet address within buffer */
266 int pk_len; /* length of data within buffer */
267 int pk_typ; /* packet type */
268 int pk_seq; /* packet sequence number */
269 int pk_flg; /* ack'd bit */
270 int pk_rtr; /* retransmission count */
271};
272
273/* File-related symbols and structures */
274
275#define XYFILN 0 /* Naming */
276#define XYFILT 1 /* Type */
277#define XYFT_T 0 /* Text */
278#define XYFT_B 1 /* Binary */
279#define XYFT_I 2 /* Image or Block (VMS) */
280#define XYFT_L 3 /* Labeled (tagged binary) (VMS) */
281#define XYFT_U 4 /* Binary Undefined (VMS) */
282#define XYFILW 2 /* Warning */
283#define XYFILD 3 /* Display */
284#define XYFD_N 0 /* None, Off */
285#define XYFD_R 1 /* Regular, Dots */
286#define XYFD_C 2 /* Cursor-positioning (e.g. with curses) */
287#define XYFD_S 3 /* Simple counter */
288#define XYFILC 4 /* Character set */
289#define XYFILF 5 /* Record Format */
290#define XYFF_S 0 /* Stream */
291#define XYFF_V 1 /* Variable */
292#define XYFF_VB 2 /* Variable with RCW's */
293#define XYFF_F 3 /* Fixed length */
294#define XYFF_U 4 /* Undefined */
295#define XYFILR 6 /* Record length */
296#define XYFILO 7 /* Organization */
297#define XYFO_S 0 /* Sequential */
298#define XYFO_I 1 /* Indexed */
299#define XYFO_R 2 /* Relative */
300#define XYFILP 8 /* Printer carriage control */
301#define XYFP_N 0 /* Newline (imbedded control characters) */
302#define XYFP_F 1 /* FORTRAN (space, 1, +, etc, in column 1 */
303#define XYFP_P 2 /* Special printer carriage controls */
304#define XYFP_X 4 /* None */
305#define XYFILX 9 /* Collision Action */
306#define XYFX_A 3 /* Append */
307#define XYFX_Q 5 /* Ask */
308#define XYFX_B 2 /* Backup */
309#define XYFX_D 4 /* Discard */
310#define XYFX_R 0 /* Rename */
311#define XYFX_X 1 /* Replace */
312#define XYFX_U 6 /* Update */
313#define XYFILB 10 /* Blocksize */
314#define XYFILZ 11 /* Disposition */
315#define XYFZ_N 0 /* New, Create */
316#define XYFZ_A 1 /* New, append if file exists, else create */
317#define XYFZ_O 2 /* Old, file must exist */
318#define XYFZ_X 3 /* Output to pipe/process */
319#define XYFZ_Y 4 /* Input from pipe/process */
320#define XYFILS 12 /* File Byte Size */
321#define XYFILL 13 /* File Label (VMS) */
322#define XYFILI 14 /* File Incomplete */
323
324/* ANSI-style forward declarations for protocol-related functions. */
325
326_PROTOTYP( int input, (void) );
327_PROTOTYP( int inibufs, (int, int) );
328_PROTOTYP( int makebuf, (int, int, CHAR [], struct pktinfo *) );
329_PROTOTYP( int mksbuf, (int) );
330_PROTOTYP( int mkrbuf, (int) );
331_PROTOTYP( int spack, (char, int, int, CHAR *) );
332_PROTOTYP( VOID proto, (void) );
333_PROTOTYP( int rpack, (void) );
334_PROTOTYP( int ack1, (CHAR *) );
335_PROTOTYP( int ackn, (int) );
336_PROTOTYP( int ackns, (int, CHAR *) );
337_PROTOTYP( int nack, (int) );
338_PROTOTYP( int resend, (int) );
339_PROTOTYP( int errpkt, (CHAR *) );
340_PROTOTYP( VOID logpkt, (char, int, CHAR *) );
341_PROTOTYP( CHAR dopar, (CHAR) );
342_PROTOTYP( int chk1, (CHAR *) );
343_PROTOTYP( unsigned int chk2, (CHAR *) );
344_PROTOTYP( unsigned int chk3, (CHAR *) );
345_PROTOTYP( int sipkt, (char) );
346_PROTOTYP( int sinit, (void) );
347_PROTOTYP( VOID rinit, (CHAR *) );
348_PROTOTYP( int spar, (CHAR *) );
349_PROTOTYP( int rcvfil, (char *) );
350_PROTOTYP( CHAR * rpar, (void) );
351_PROTOTYP( CHAR * rpar, (void) );
352_PROTOTYP( int gnfile, (void) );
353_PROTOTYP( int getsbuf, (int) );
354_PROTOTYP( int getrbuf, (void) );
355_PROTOTYP( int freesbuf, (int) );
356_PROTOTYP( int freerbuf, (int) );
357_PROTOTYP( int dumpsbuf, (void) );
358_PROTOTYP( int dumprbuf, (void) );
359_PROTOTYP( VOID freerpkt, (int) );
360_PROTOTYP( int chkwin, (int, int, int) );
361_PROTOTYP( int rsattr, (CHAR *) );
362_PROTOTYP( char *getreason, (char *) );
363_PROTOTYP( int scmd, (char, CHAR *) );
364_PROTOTYP( int encstr, (CHAR *) );
365_PROTOTYP( int decode, (CHAR *, int (*)(char), int) );
366_PROTOTYP( int fnparse, (char *) );
367_PROTOTYP( int syscmd, (char *, char *) );
368_PROTOTYP( int cwd, (char *) );
369_PROTOTYP( VOID screen, (int, char, long, char *) );
370_PROTOTYP( int remset, (char *) );
371_PROTOTYP( int initattr, (struct zattr *) );
372_PROTOTYP( int gattr, (CHAR *, struct zattr *) );
373_PROTOTYP( int adebu, (char *, struct zattr *) );
374_PROTOTYP( int canned, (CHAR *) );
375_PROTOTYP( int opent, (struct zattr *) );
376_PROTOTYP( int opena, (char *, struct zattr *) );
377_PROTOTYP( int openi, (char *) );
378_PROTOTYP( int openo, (char *, struct zattr *, struct filinfo *) );
379_PROTOTYP( int reof, (char *, struct zattr *) );
380_PROTOTYP( VOID reot, (void) );
381_PROTOTYP( int sfile, (int) );
382_PROTOTYP( int sattr, (int) );
383_PROTOTYP( int sdata, (void) );
384_PROTOTYP( int seof, (CHAR *) );
385_PROTOTYP( int sxeof, (CHAR *) );
386_PROTOTYP( int seot, (void) );
387_PROTOTYP( int window, (int) );
388_PROTOTYP( int errmsg, (char *) );
389_PROTOTYP( int clsif, (void) );
390_PROTOTYP( int clsof, (int) );
391_PROTOTYP( CHAR setgen, (char, char *, char *, char *) );
392_PROTOTYP( int getpkt, (int, int) );
393_PROTOTYP( int putsrv, (char) );
394_PROTOTYP( int puttrm, (char) );
395_PROTOTYP( int putfil, (char) );
396_PROTOTYP( VOID zdstuff, (CHAR) );
397_PROTOTYP( int tinit, (void) );
398_PROTOTYP( VOID pktinit, (void) );
399_PROTOTYP( VOID rinit, (CHAR *) );
400_PROTOTYP( VOID resetc, (void) );
401_PROTOTYP( VOID xsinit, (void) );
402_PROTOTYP( int adjpkl, (int,int,int) );
403_PROTOTYP( int chktimo, (int,int) );
404_PROTOTYP( int nxtpkt, (void) );
405_PROTOTYP( int ack, (void) );
406_PROTOTYP( int ackns, (int, CHAR *) );
407_PROTOTYP( int ackn, (int) );
408_PROTOTYP( int ack1, (CHAR *) );
409_PROTOTYP( int nack, (int) );
410_PROTOTYP( VOID rcalcpsz, (void) );
411_PROTOTYP( int resend, (int) );
412_PROTOTYP( int errpkt, (CHAR *) );
413_PROTOTYP( VOID srinit, (void) );
414_PROTOTYP( VOID tstats, (void) );
415_PROTOTYP( VOID fstats, (void) );
416_PROTOTYP( VOID intmsg, (long) );
417_PROTOTYP( VOID ermsg, (char *) );
418_PROTOTYP( int chkint, (void) );
419_PROTOTYP( VOID sdebu, (int) );
420_PROTOTYP( VOID rdebu, (CHAR *, int) );
421_PROTOTYP( char * dbchr, ( int ) );
422#ifdef COMMENT
423_PROTOTYP( SIGTYP stptrap, (int, int) );
424_PROTOTYP( SIGTYP trap, (int, int) );
425#else
426_PROTOTYP( SIGTYP stptrap, (int) );
427_PROTOTYP( SIGTYP trap, (int) );
428#endif /* COMMENT */
429
430/* User interface functions needed by main program, etc. */
431
432_PROTOTYP( VOID prescan, (void) );
433_PROTOTYP( VOID setint, (void) );
434_PROTOTYP( VOID cmdini, (void) );
435_PROTOTYP( int dotake, (char *) );
436_PROTOTYP( int cmdlin, (void) );
437_PROTOTYP( int conect, (void) );
438_PROTOTYP( int ckcgetc, (int) );
439_PROTOTYP( int ckcputc, (int) );
440_PROTOTYP (int mdmhup, (void) );
441_PROTOTYP( VOID herald, (void) );
442_PROTOTYP( VOID fixcmd, (void) );
443_PROTOTYP( int doarg, (char) );
444_PROTOTYP( VOID usage, (void) );
445_PROTOTYP( VOID doclean, (void) );
446_PROTOTYP( int sndhlp, (void) );
447_PROTOTYP( VOID ckhost, (char *, int) );
448_PROTOTYP( int gettcs, (int, int) );
449
450#ifdef KANJI
451_PROTOTYP( int zkanji, (int (*)(void)) ); /* Kanji function prototypes */
452_PROTOTYP( int zkanjf, (void) );
453_PROTOTYP( int zkanjz, (void) );
454_PROTOTYP( int xkanjz, (int (*)(char) ) );
455_PROTOTYP( int xkanji, (int, int (*)(char) ) );
456#endif /* KANJI */
457
458#endif /* CKCKER_H */
459
460/* End of ckcker.h */