1 /*	$Id$ */
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 
37 // bit ordering directives +fbor=<n>
38 const u_short BOR_C_DIR	= 0;		// phase C direct
39 const u_short BOR_C_REV	= 1;		// phase C reversed
40 const u_short BOR_C		= 0x1;
41 const u_short BOR_BD_DIR	= (0<<1);	// phase B/D direct
42 const u_short BOR_BD_REV	= (1<<1);	// phase B/D reversed
43 const u_short BOR_BD	= 0x2;
44 
45 // service types returned by +fclass=?
46 const u_short SERVICE_DATA	 = BIT(0);	// data service
47 const u_short SERVICE_CLASS1 = BIT(1);	// class 1 interface
48 const u_short SERVICE_CLASS2 = BIT(2);	// class 2 interface
49 const u_short SERVICE_CLASS20 = BIT(3);	// class 2.0 interface
50 const u_short SERVICE_CLASS10 = BIT(4);	// class 1.0 interface
51 const u_short SERVICE_CLASS21 = BIT(5);	// class 2.1 interface
52 const u_short SERVICE_VOICE	 = BIT(8);	// voice service (ZyXEL extension)
53 const u_short SERVICE_ALL	 = BIT(9)-1;
54 
55 // t.30 session subparameter codes
56 const u_int VR_NORMAL	= 0x00;		// 98 lpi
57 const u_int VR_FINE	= 0x01;		// 196 lpi
58 const u_int VR_R8	= 0x02;		// R8  x 15.4 l/mm
59 const u_int VR_R16	= 0x04;		// R16 x 15.4 l/mm
60 const u_int VR_200X100	= 0x08;		// 200 dpi x 100 l/25.4mm
61 const u_int VR_200X200	= 0x10;		// 200 dpi x 200 l/25.4mm
62 const u_int VR_200X400	= 0x20;		// 200 dpi x 400 l/25.4mm
63 const u_int VR_300X300	= 0x40;		// 300 dpi x 300 l/25.4mm
64 const u_int VR_ALL	= 0x7F;
65 
66 const u_short BR_2400	= 0;		// 2400 bit/s
67 const u_short BR_4800	= 1;		// 4800 bit/s
68 const u_short BR_7200	= 2;		// 7200 bit/s
69 const u_short BR_9600	= 3;		// 9600 bit/s
70 const u_short BR_12000	= 4;		// 12000 bit/s
71 const u_short BR_14400	= 5;		// 14400 bit/s
72 const u_short BR_16800	= 6;		// 16800 bit/s
73 const u_short BR_19200	= 7;		// 19200 bit/s
74 const u_short BR_21600	= 8;		// 21600 bit/s
75 const u_short BR_24000	= 9;		// 24000 bit/s
76 const u_short BR_26400	= 10;		// 26400 bit/s
77 const u_short BR_28800	= 11;		// 28800 bit/s
78 const u_short BR_31200	= 12;		// 31200 bit/s
79 const u_short BR_33600	= 13;		// 33600 bit/s
80 const u_short BR_ALL	= BIT(BR_33600+1)-1;
81 
82 const u_short WD_A4	= 0;		// 1728 pixels in 215 mm
83 const u_short WD_B4	= 1;		// 2048 pixels in 255 mm
84 const u_short WD_A3	= 2;		// 2432 pixels in 303 mm
85 const u_short WD_ALL	= BIT(WD_A3+1)-1;
86 
87 const u_short LN_A4		= 0;		// A4, 297 mm
88 const u_short LN_B4		= 1;		// B4, 364 mm
89 const u_short LN_INF	= 2;		// Unlimited length
90 const u_short LN_ALL	= BIT(LN_INF+1)-1;
91 
92 const u_short LN_LET	= 3;		// XXX US Letter size (used internally)
93 
94 const u_short DF_1DMH	= 0;		// 1-D Modified Huffman
95 const u_short DF_2DMR	= 1;		// 2-D Modified Read
96 const u_short DF_2DMRUNCOMP	= 2;	// 2-D Uncompressed Mode
97 const u_short DF_2DMMR	= 3;		// 2-D Modified Modified Read
98 const u_short DF_JBIG	= 4;		// Single-progression sequential coding (Rec. T.85)
99 const u_short DF_ALL	= BIT(DF_JBIG+1)-1 ^ BIT(DF_2DMRUNCOMP);	// no uncompressed
100 
101 /*
102  * The EC definition varies between the Class 2 and Class 2.0 spec, so
103  * this is a merger of both of them.
104  */
105 const u_short EC_DISABLE	= 0;		// disable ECM
106 const u_short EC_ENABLE64	= 1;		// enable T.30 Annex A, 64-byte ECM
107 const u_short EC_ENABLE256	= 2;		// enable T.30 Annex A, 256-byte ECM
108 const u_short EC_ECLHALF	= 3;		// enable T.30 Annex C, half duplex
109 const u_short EC_ECLFULL	= 4;		// enable T.30 Annex C, full duplex
110 const u_short EC_ALL		= BIT(EC_ECLFULL+1)-1;
111 
112 const u_short BF_DISABLE	= 0;		// disable file transfer modes
113 const u_short BF_ENABLE	= 1;		// select BFT, T.434
114 const u_short BF_DTM	= 2;		// select Document Transfer Mode
115 const u_short BF_EDI	= 4;		// select Edifact Mode
116 const u_short BF_BTM	= 8;		// select Basic Transfer Mode
117 const u_short BF_CM		= 10;		// select character mode T.4 Annex D
118 const u_short BF_MM		= 20;		// select Mixed mode, T.4 Annex E
119 const u_short BF_PM		= 40;		// select Processable mode, T.505
120 const u_short BF_ALL	= 0x3;
121 
122 const u_short ST_0MS	= 0;		// scan time/line: 0 ms/0 ms
123 const u_short ST_5MS	= 1;		// scan time/line: 5 ms/5 ms
124 const u_short ST_10MS2	= 2;		// scan time/line: 10 ms/5 ms
125 const u_short ST_10MS	= 3;		// scan time/line: 10 ms/10 ms
126 const u_short ST_20MS2	= 4;		// scan time/line: 20 ms/10 ms
127 const u_short ST_20MS	= 5;		// scan time/line: 20 ms/20 ms
128 const u_short ST_40MS2	= 6;		// scan time/line: 40 ms/20 ms
129 const u_short ST_40MS	= 7;		// scan time/line: 40 ms/40 ms
130 const u_short ST_ALL	= BIT(ST_40MS+1)-1;
131 
132 const u_short JP_NONE	= 0;		// disable JPEG
133 const u_short JP_GREY	= 1;		// Greyscale JPEG (T.4 Annex E and T.81)
134 const u_short JP_COLOR	= 2;		// Full-color JPEG (T.4 Annex E and T.81)
135 const u_short JP_HUFFMAN= 3;		// Enable preferred Huffman tables
136 const u_short JP_12BIT	= 4;		// 12 bits/pel/component
137 const u_short JP_NOSUB	= 5;		// no subsampling
138 const u_short JP_ILLUM	= 6;		// custom illuminant
139 const u_short JP_GAMUT	= 7;		// custom gamut range
140 const u_short JP_ALL	= BIT(JP_GAMUT+1)-1;
141 
142 // post page message codes
143 const u_short PPM_MPS	= 0;		// another page next, same document
144 const u_short PPM_EOM	= 1;		// another document next
145 const u_short PPM_EOP	= 2;		// no more pages or documents
146 const u_short PPM_PRI_MPS	= 4;		// another page, procedure interrupt
147 const u_short PPM_PRI_EOM	= 5;		// another doc, procedure interrupt
148 const u_short PPM_PRI_EOP	= 6;		// all done, procedure interrupt
149 // Extra message codes for decodePPM() use.
150 // Must not conflict with the related FCF_XXX / FCF_PRI_XXX flags from class2.h
151 const u_short PPH_SKIP	= 251;		// page actually has to be skipped
152 
153 // post page response codes
154 const u_short PPR_MCF	= 1;		// page good
155 const u_short PPR_RTN	= 2;		// page bad, retrain requested
156 const u_short PPR_RTP	= 3;		// page good, retrain requested
157 const u_short PPR_PIN	= 4;		// page bad, interrupt requested
158 const u_short PPR_PIP	= 5;		// page good, interrupt requested
159 
160 // important stream transfer codes
161 // These are actual (char) recived, so thes aren't unsigned int
162 const int DLE = 16;		// transparent character escape
163 const int SUB = 26;		// <DLE><SUB> => <DLE><DLE> for Class 2.0
164 const int ETX = 3;		// <DLE><ETX> means end of transfer
165 const int DC1 = 17;		// start data transfer (Class 2)
166 const int DC2 = 18;		// start data transfer (Class 2.0 and ZyXEL)
167 const int CAN = 24;		// abort data transfer
168 const int EOT = 4;		// end transmission (Class 1.0)
169 #endif /* _class2_ */
170