|
|
1.1 root 1: /* ckcker.h -- Symbol and macro definitions for C-Kermit */
2:
3: /*
4: Author: Frank da Cruz ([email protected], [email protected]),
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:
262: struct 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 */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.