home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / CKPM5X_S.ZIP / CKCKER.H < prev    next >
C/C++ Source or Header  |  1990-03-04  |  7KB  |  165 lines

  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, 1990, Trustees of Columbia University in the City of New 
  8.  York.  Permission is granted to any individual or institution to use, copy, or
  9.  redistribute this software so long as it is not sold for profit, provided this
  10.  copyright notice is retained. 
  11. */
  12.  
  13. /* Terminal modes */
  14. #define VT100     0         /* Also for VT52 mode */
  15. #define TEKTRONIX 1
  16.  
  17. #ifdef OS2          /* Keytable return values */
  18. #define ODSR 2
  19. #define IDSR 3
  20. #define OCTS 4
  21. #endif
  22.  
  23. /* Packet buffer and window sizes, will probably need to be #ifdef'd for */
  24. /* each system. */
  25.  
  26. #define MAXPACK 94          /* Maximum unextended packet size */
  27. #define MAXSP 2048          /* Send packet buffer size  */
  28. #ifdef vms
  29. #define MAXRP 1920          /* Receive packet buffer size  */
  30. #else
  31. #define MAXRP 2048          /* Receive packet buffer size  */
  32. #endif
  33. #define MAXWS 31            /* Maximum window size */
  34.  
  35. #define BIGSBUFSIZ (MAXPACK * (MAXWS + 1))
  36. #define BIGRBUFSIZ (MAXPACK * (MAXWS + 1))
  37.  
  38. /* Kermit parameters and defaults */
  39.  
  40. #define CTLQ       '#'          /* Control char prefix I will use */
  41. #define MYEBQ      '&'          /* 8th-Bit prefix char I will use */
  42. #define MYRPTQ     '~'          /* Repeat count prefix I will use */
  43.  
  44. #define MAXTRY      10          /* Times to retry a packet */
  45. #define MYPADN      0           /* How many padding chars I need */
  46. #define MYPADC      '\0'        /* Which padding character I need */
  47.  
  48. #define DMYTIM      7           /* Default timeout interval to use. */
  49. #define URTIME      10          /* Timeout interval to be used on me. */
  50. #define DSRVTIM     30          /* Default server command wait timeout. */
  51.  
  52. #define DEFTRN      0           /* Default line turnaround handshake */
  53. #define DEFPAR      0           /* Default parity */
  54. #define MYEOL       CR          /* End-Of-Line character I need on packets. */
  55.  
  56. #define DRPSIZ      90          /* Default incoming packet size. */
  57. #define DSPSIZ      90          /* Default outbound packet size. */
  58.  
  59. #define DDELAY      5           /* Default delay. */
  60. #define DSPEED      9600        /* Default line speed. */
  61.  
  62. /* Files */
  63.  
  64. #define ZCTERM      0           /* Console terminal */
  65. #define ZSTDIO      1       /* Standard input/output */
  66. #define ZIFILE      2       /* Current input file */
  67. #define ZOFILE      3           /* Current output file */
  68. #define ZDFILE      4           /* Current debugging log file */
  69. #define ZTFILE      5           /* Current transaction log file */
  70. #define ZPFILE      6           /* Current packet log file */
  71. #define ZSFILE      7       /* Current session log file */
  72. #define ZSYSFN      8       /* Input from a system function */
  73. #define ZNFILS      9           /* How many defined file numbers */
  74.  
  75. /*
  76.  * (PWP) this is used to avoid gratuitous function calls while encoding
  77.  * a packet.  The previous way involved 2 nested function calls for
  78.  * EACH character of the file.  This way, we only do 2 calls per K of
  79.  * data.  This reduces packet encoding time to 1% of its former cost.
  80.  */
  81. #define INBUFSIZE 1024  /* size of the buffered file input and output buffer */
  82.  
  83. /* get the next char; sorta like a getc() macro */
  84. #define zminchar() (((--zincnt)>=0) ? ((int)(*zinptr++) & 0377) : zinfill())
  85.  
  86. /* stuff a character into the input buffer */
  87. #define zmstuff(c) zinptr--, *zinptr = c, zincnt++
  88.  
  89. /* put a character to a file, like putchar() macro */
  90. #define zmchout(c) \
  91. ((*zoutptr++=(CHAR)(c)),((++zoutcnt)>=INBUFSIZE)?zoutdump():0)
  92.  
  93.  
  94. /* Screen functions */
  95.  
  96. #define SCR_FN 1        /* filename */
  97. #define SCR_AN 2        /* as-name */
  98. #define SCR_FS 3    /* file-size */
  99. #define SCR_XD 4        /* x-packet data */
  100. #define SCR_ST 5        /* File status: */
  101. #define   ST_OK   0     /*  Transferred OK */
  102. #define   ST_DISC 1     /*  Discarded */
  103. #define   ST_INT  2     /*  Interrupted */
  104. #define   ST_SKIP 3     /*  Skipped */
  105. #define   ST_ERR  4     /*  Fatal Error */
  106. #define SCR_PN 6        /* packet number */
  107. #define SCR_PT 7        /* packet type or pseudotype */
  108. #define SCR_TC 8        /* transaction complete */
  109. #define SCR_EM 9        /* error message */
  110. #define SCR_WM 10       /* warning message */
  111. #define SCR_TU 11   /* arbitrary undelimited text */
  112. #define SCR_TN 12       /* arbitrary new text, delimited at beginning */
  113. #define SCR_TZ 13       /* arbitrary text, delimited at end */
  114. #define SCR_QE 14   /* quantity equals (e.g. "foo: 7") */
  115.  
  116. /* Macros */
  117.  
  118. #define tochar(ch)  ((ch) + SP )    /* Number to character */
  119. #define xunchar(ch) ((ch) - SP )    /* Character to number */
  120. #define ctl(ch)     ((ch) ^ 64 )    /* Controllify/Uncontrollify */
  121. #define unpar(ch)   ((ch) & 127)    /* Clear parity bit */
  122.  
  123. /* Structure definitions for Kermit file attributes */
  124. /* All strings come as pointer and length combinations */
  125. /* Empty string (or for numeric variables, -1) = unused attribute. */
  126.  
  127. struct zstr {             /* string format */
  128.     int len;              /* length */
  129.     char *val;            /* value */
  130. };
  131. struct zattr {            /* Kermit File Attribute structure */
  132.     long lengthk;         /* (!) file length in K */
  133.     struct zstr type;     /* (") file type (text or binary) */
  134.     struct zstr date;     /* (#) file creation date [yy]yymmdd[ hh:mm[:ss]] */
  135.     struct zstr creator;  /* ($) file creator id */
  136.     struct zstr account;  /* (%) file account */
  137.     struct zstr area;     /* (&) area (e.g. directory) for file */
  138.     struct zstr passwd;   /* (') password for area */
  139.     long blksize;         /* (() file blocksize */
  140.     struct zstr access;   /* ()) file access: new, supersede, append, warn */
  141.     struct zstr encoding; /* (*) encoding (transfer syntax) */
  142.     struct zstr disp;     /* (+) disposition (mail, message, print, etc) */
  143.     struct zstr lprotect; /* (,) protection (local syntax) */
  144.     struct zstr gprotect; /* (-) protection (generic syntax) */
  145.     struct zstr systemid; /* (.) ID for system of origin */
  146.     struct zstr recfm;    /* (/) record format */
  147.     struct zstr sysparam; /* (0) system-dependent parameter string */
  148.     long length;          /* (1) exact length on system of origin */
  149.     struct zstr charset;  /* (2) transfer syntax character set */
  150.     struct zstr reply;    /* This goes last, used for attribute reply */
  151. };
  152.  
  153. /* Kermit packet information structure */
  154.  
  155. struct pktinfo {            /* Packet information structure */
  156.     CHAR *bf_adr;           /*  buffer address */
  157.     int   bf_len;           /*  buffer length */
  158.     CHAR *pk_adr;           /* Packet address within buffer */
  159.     int   pk_len;           /*  length of data within buffer */
  160.     int   pk_typ;           /*  packet type */
  161.     int   pk_seq;           /*  packet sequence number */
  162.     int   pk_flg;           /*  ack'd bit */
  163.     int   pk_rtr;           /*  retransmission count */
  164. };
  165.