home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckc095.zip / ckcker.h < prev    next >
C/C++ Source or Header  |  1989-08-31  |  5KB  |  115 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, 1989, 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. /* Mnemonics for ASCII characters */
  14.  
  15. #define NUL       000            /* ASCII Null */
  16. #define SOH       001            /* ASCII Start of header */
  17. #define BEL        007        /* ASCII Bell (Beep) */
  18. #define BS         010        /* ASCII Backspace */
  19. #define LF         012            /* ASCII Linefeed */
  20. #define CR         015        /* ASCII Carriage Return */
  21. #define XON       021            /* ASCII XON */
  22. #define SP       040        /* ASCII Space */
  23. #define DEL       0177        /* ASCII Delete (Rubout) */
  24.  
  25. /* Packet buffer and window sizes, will probably need to be #ifdef'd for */
  26. /* each system. */
  27.  
  28. #define MAXSP 2048            /* Send packet buffer size  */
  29. #ifdef vms
  30. #define MAXRP 1920            /* Receive packet buffer size  */
  31. #else
  32. #define MAXRP 1024            /* Receive packet buffer size  */
  33. #endif
  34. #define MAXWS 1                /* Maximum window size */
  35.  
  36. /* Kermit parameters and defaults */
  37.  
  38. #define MAXPACK       94        /* Maximum unextended packet size */
  39. #define CTLQ       '#'        /* Control char prefix I will use */
  40. #define MYEBQ       '&'        /* 8th-Bit prefix char I will use */
  41. #define MYRPTQ       '~'        /* Repeat count prefix I will use */
  42.  
  43. #define MAXTRY        10          /* Times to retry a packet */
  44. #define MYPADN        0          /* How many padding chars I need */
  45. #define MYPADC        '\0'      /* Which padding character I need */
  46.  
  47. #define DMYTIM        7          /* Default timeout interval to use. */
  48. #define URTIME        10          /* Timeout interval to be used on me. */
  49. #define DSRVTIM     30        /* Default server command wait timeout. */
  50.  
  51. #define DEFTRN        0           /* Default line turnaround handshake */
  52. #define DEFPAR        0           /* Default parity */
  53. #define MYEOL        CR          /* End-Of-Line character I need on packets. */
  54.  
  55. #define DRPSIZ        90            /* Default incoming packet size. */
  56. #define DSPSIZ        90            /* Default outbound packet size. */
  57.  
  58. #define DDELAY      5        /* Default delay. */
  59. #define DSPEED        9600     /* Default line speed. */
  60.  
  61. /* Files */
  62.  
  63. #define ZCTERM      0            /* Console terminal */
  64. #define ZSTDIO      1        /* Standard input/output */
  65. #define ZIFILE        2        /* Current input file */
  66. #define ZOFILE      3            /* Current output file */
  67. #define ZDFILE      4            /* Current debugging log file */
  68. #define ZTFILE      5            /* Current transaction log file */
  69. #define ZPFILE      6            /* Current packet log file */
  70. #define ZSFILE      7        /* Current session log file */
  71. #define ZSYSFN        8        /* Input from a system function */
  72. #define ZNFILS      9            /* How many defined file numbers */
  73.  
  74. /*
  75.  * (PWP) this is used to avoid gratuitous function calls while encoding
  76.  * or decoding a packet.  The previous way involved 2 nested function calls 
  77.  * for EACH character of the file.  This way, we only do 2 calls per K of
  78.  * data.  This reduces packet encoding time to 1% of its former cost.
  79.  */
  80. #define INBUFSIZE 1024    /* size of the buffered file input and output buffer */
  81.  
  82. /* get/put the next file character; like getc()/putc() macros */
  83. #define zminchar() (((--zincnt)>=0) ? ((int)(*zinptr++) & 0377) : zinfill())
  84. #define zmchout(c) \
  85. ((*zoutptr++ = (CHAR)(c)), ((++zoutcnt) >= INBUFSIZE) ? zoutdump() : 0)
  86.  
  87. /* Screen functions */
  88.  
  89. #define SCR_FN 1        /* filename */
  90. #define SCR_AN 2        /* as-name */
  91. #define SCR_FS 3     /* file-size */
  92. #define SCR_XD 4        /* x-packet data */
  93. #define SCR_ST 5          /* File status: */
  94. #define   ST_OK   0       /*  Transferred OK */
  95. #define   ST_DISC 1     /*  Discarded */
  96. #define   ST_INT  2     /*  Interrupted */
  97. #define   ST_SKIP 3     /*  Skipped */
  98. #define   ST_ERR  4     /*  Fatal Error */
  99. #define SCR_PN 6        /* packet number */
  100. #define SCR_PT 7        /* packet type or pseudotype */
  101. #define SCR_TC 8        /* transaction complete */
  102. #define SCR_EM 9        /* error message */
  103. #define SCR_WM 10       /* warning message */
  104. #define SCR_TU 11    /* arbitrary undelimited text */
  105. #define SCR_TN 12       /* arbitrary new text, delimited at beginning */
  106. #define SCR_TZ 13       /* arbitrary text, delimited at end */
  107. #define SCR_QE 14    /* quantity equals (e.g. "foo: 7") */
  108.  
  109. /* Macros */
  110.  
  111. #define tochar(ch)  ((ch) + SP )    /* Number to character */
  112. #define xunchar(ch) ((ch) - SP )    /* Character to number */
  113. #define ctl(ch)     ((ch) ^ 64 )    /* Controllify/Uncontrollify */
  114. #define unpar(ch)   ((ch) & 127)    /* Clear parity bit */
  115.