class2.h
上传用户:weiyuanprp
上传日期:2020-05-20
资源大小:1169k
文件大小:7k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. /* $Id: class2.h,v 1.3 2008/04/26 22:34:29 faxguy Exp $ */
  2. /*
  3.  * Copyright (c) 1990-1996 Sam Leffler
  4.  * Copyright (c) 1991-1996 Silicon Graphics, Inc.
  5.  * HylaFAX is a trademark of Silicon Graphics
  6.  *
  7.  * Permission to use, copy, modify, distribute, and sell this software and 
  8.  * its documentation for any purpose is hereby granted without fee, provided
  9.  * that (i) the above copyright notices and this permission notice appear in
  10.  * all copies of the software and related documentation, and (ii) the names of
  11.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  12.  * publicity relating to the software without the specific, prior written
  13.  * permission of Sam Leffler and Silicon Graphics.
  14.  * 
  15.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  16.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  17.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  18.  * 
  19.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  20.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  21.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  22.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  23.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  24.  * OF THIS SOFTWARE.
  25.  */
  26. #ifndef _class2_
  27. #define _class2_
  28. /*
  29.  * Fax Modem Definitions for:
  30.  *
  31.  * Class 2 (nominally SP-2388-A of August 30, 1991)
  32.  * Class 2.0 (TIA/EIA-592)
  33.  * T.class2 (ITU-T)
  34.  */
  35. #define BIT(i) (1<<(i))
  36. // bit ordering directives +fbor=<n>
  37. const u_short BOR_C_DIR = 0; // phase C direct
  38. const u_short BOR_C_REV = 1; // phase C reversed
  39. const u_short BOR_C = 0x1;
  40. const u_short BOR_BD_DIR = (0<<1); // phase B/D direct
  41. const u_short BOR_BD_REV = (1<<1); // phase B/D reversed
  42. const u_short BOR_BD = 0x2;
  43. // service types returned by +fclass=?
  44. const u_short SERVICE_DATA  = BIT(0); // data service
  45. const u_short SERVICE_CLASS1 = BIT(1); // class 1 interface
  46. const u_short SERVICE_CLASS2 = BIT(2); // class 2 interface
  47. const u_short SERVICE_CLASS20 = BIT(3); // class 2.0 interface
  48. const u_short SERVICE_CLASS10 = BIT(4); // class 1.0 interface
  49. const u_short SERVICE_CLASS21 = BIT(5); // class 2.1 interface
  50. const u_short SERVICE_VOICE  = BIT(8); // voice service (ZyXEL extension)
  51. const u_short SERVICE_ALL  = BIT(9)-1;
  52. // t.30 session subparameter codes
  53. const u_int VR_NORMAL = 0x00; // 98 lpi
  54. const u_int VR_FINE = 0x01; // 196 lpi
  55. const u_int VR_R8 = 0x02; // R8  x 15.4 l/mm
  56. const u_int VR_R16 = 0x04; // R16 x 15.4 l/mm
  57. const u_int VR_200X100 = 0x08; // 200 dpi x 100 l/25.4mm
  58. const u_int VR_200X200 = 0x10; // 200 dpi x 200 l/25.4mm
  59. const u_int VR_200X400 = 0x20; // 200 dpi x 400 l/25.4mm
  60. const u_int VR_300X300 = 0x40; // 300 dpi x 300 l/25.4mm
  61. const u_int VR_ALL = 0x7F;
  62. const u_short BR_2400 = 0; // 2400 bit/s
  63. const u_short BR_4800 = 1; // 4800 bit/s
  64. const u_short BR_7200 = 2; // 7200 bit/s
  65. const u_short BR_9600 = 3; // 9600 bit/s
  66. const u_short BR_12000 = 4; // 12000 bit/s
  67. const u_short BR_14400 = 5; // 14400 bit/s
  68. const u_short BR_16800 = 6; // 16800 bit/s
  69. const u_short BR_19200 = 7; // 19200 bit/s
  70. const u_short BR_21600 = 8; // 21600 bit/s
  71. const u_short BR_24000 = 9; // 24000 bit/s
  72. const u_short BR_26400 = 10; // 26400 bit/s
  73. const u_short BR_28800 = 11; // 28800 bit/s
  74. const u_short BR_31200 = 12; // 31200 bit/s
  75. const u_short BR_33600 = 13; // 33600 bit/s
  76. const u_short BR_ALL = BIT(BR_33600+1)-1;
  77. const u_short WD_A4 = 0; // 1728 pixels in 215 mm
  78. const u_short WD_B4 = 1; // 2048 pixels in 255 mm
  79. const u_short WD_A3 = 2; // 2432 pixels in 303 mm
  80. const u_short WD_ALL = BIT(WD_A3+1)-1;
  81. const u_short LN_A4 = 0; // A4, 297 mm
  82. const u_short LN_B4 = 1; // B4, 364 mm
  83. const u_short LN_INF = 2; // Unlimited length
  84. const u_short LN_ALL = BIT(LN_INF+1)-1;
  85. const u_short LN_LET = 3; // XXX US Letter size (used internally)
  86. const u_short DF_1DMH = 0; // 1-D Modified Huffman
  87. const u_short DF_2DMR = 1; // 2-D Modified Read
  88. const u_short DF_2DMRUNCOMP = 2; // 2-D Uncompressed Mode
  89. const u_short DF_2DMMR = 3; // 2-D Modified Modified Read
  90. const u_short DF_JBIG = 4; // Single-progression sequential coding (Rec. T.85)
  91. const u_short DF_ALL = (BIT(DF_JBIG+1)-1) ^ BIT(DF_2DMRUNCOMP); // no uncompressed
  92. /*
  93.  * The EC definition varies between the Class 2 and Class 2.0 spec, so
  94.  * this is a merger of both of them.
  95.  */
  96. const u_short EC_DISABLE = 0; // disable ECM
  97. const u_short EC_ENABLE64 = 1; // enable T.30 Annex A, 64-byte ECM
  98. const u_short EC_ENABLE256 = 2; // enable T.30 Annex A, 256-byte ECM
  99. const u_short EC_ECLHALF = 3; // enable T.30 Annex C, half duplex
  100. const u_short EC_ECLFULL = 4; // enable T.30 Annex C, full duplex
  101. const u_short EC_ALL = BIT(EC_ECLFULL+1)-1;
  102. const u_short BF_DISABLE = 0; // disable file transfer modes
  103. const u_short BF_ENABLE = 1; // select BFT, T.434
  104. const u_short BF_DTM = 2; // select Document Transfer Mode
  105. const u_short BF_EDI = 4; // select Edifact Mode
  106. const u_short BF_BTM = 8; // select Basic Transfer Mode
  107. const u_short BF_CM = 10; // select character mode T.4 Annex D
  108. const u_short BF_MM = 20; // select Mixed mode, T.4 Annex E
  109. const u_short BF_PM = 40; // select Processable mode, T.505
  110. const u_short BF_ALL = 0x3;
  111. const u_short ST_0MS = 0; // scan time/line: 0 ms/0 ms
  112. const u_short ST_5MS = 1; // scan time/line: 5 ms/5 ms
  113. const u_short ST_10MS2 = 2; // scan time/line: 10 ms/5 ms
  114. const u_short ST_10MS = 3; // scan time/line: 10 ms/10 ms
  115. const u_short ST_20MS2 = 4; // scan time/line: 20 ms/10 ms
  116. const u_short ST_20MS = 5; // scan time/line: 20 ms/20 ms
  117. const u_short ST_40MS2 = 6; // scan time/line: 40 ms/20 ms
  118. const u_short ST_40MS = 7; // scan time/line: 40 ms/40 ms
  119. const u_short ST_ALL = BIT(ST_40MS+1)-1;
  120. const u_short JP_NONE = 0; // disable JPEG
  121. const u_short JP_GREY = 1; // Greyscale JPEG (T.4 Annex E and T.81)
  122. const u_short JP_COLOR = 2; // Full-color JPEG (T.4 Annex E and T.81)
  123. const u_short JP_HUFFMAN= 3; // Enable preferred Huffman tables
  124. const u_short JP_12BIT = 4; // 12 bits/pel/component
  125. const u_short JP_NOSUB = 5; // no subsampling
  126. const u_short JP_ILLUM = 6; // custom illuminant
  127. const u_short JP_GAMUT = 7; // custom gamut range
  128. const u_short JP_ALL = BIT(JP_GAMUT+1)-1;
  129. // post page message codes
  130. const u_short PPM_MPS = 0; // another page next, same document
  131. const u_short PPM_EOM = 1; // another document next
  132. const u_short PPM_EOP = 2; // no more pages or documents
  133. const u_short PPM_PRI_MPS = 4; // another page, procedure interrupt
  134. const u_short PPM_PRI_EOM = 5; // another doc, procedure interrupt
  135. const u_short PPM_PRI_EOP = 6; // all done, procedure interrupt
  136. // post page response codes
  137. const u_short PPR_MCF = 1; // page good
  138. const u_short PPR_RTN = 2; // page bad, retrain requested
  139. const u_short PPR_RTP = 3; // page good, retrain requested
  140. const u_short PPR_PIN = 4; // page bad, interrupt requested
  141. const u_short PPR_PIP = 5; // page good, interrupt requested
  142. // important stream transfer codes
  143. // These are actual (char) recived, so thes aren't unsigned int
  144. const int DLE = 16; // transparent character escape
  145. const int SUB = 26; // <DLE><SUB> => <DLE><DLE> for Class 2.0
  146. const int ETX = 3; // <DLE><ETX> means end of transfer
  147. const int DC1 = 17; // start data transfer (Class 2)
  148. const int DC2 = 18; // start data transfer (Class 2.0 and ZyXEL)
  149. const int CAN = 24; // abort data transfer
  150. const int EOT = 4; // end transmission (Class 1.0)
  151. #endif /* _class2_ */