]> git.ipfire.org Git - thirdparty/cups.git/blob - backend/backend-private.h
Merge changes from CUPS 1.4svn-r7961.
[thirdparty/cups.git] / backend / backend-private.h
1 /*
2 * "$Id: backend-private.h 7810 2008-07-29 01:11:15Z mike $"
3 *
4 * Backend support definitions for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 2007-2008 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
8 *
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * "LICENSE" which should have been included with this file. If this
13 * file is missing or damaged, see the license at "http://www.cups.org/".
14 *
15 * This file is subject to the Apple OS-Developed Software exception.
16 */
17
18 #ifndef _CUPS_BACKEND_PRIVATE_H_
19 # define _CUPS_BACKEND_PRIVATE_H_
20
21
22 /*
23 * Include necessary headers.
24 */
25
26 # include <cups/backend.h>
27 # include <cups/sidechannel.h>
28 # include <cups/ppd-private.h>
29 # include <cups/debug.h>
30 # include <cups/i18n.h>
31 # include <cups/snmp-private.h>
32 # include <stdlib.h>
33 # include <errno.h>
34 # include <cups/string.h>
35 # include <signal.h>
36
37
38 /*
39 * C++ magic...
40 */
41
42 # ifdef __cplusplus
43 extern "C" {
44 # endif /* __cplusplus */
45
46
47 /*
48 * OID constants...
49 */
50
51 /* Host MIB */
52 #define CUPS_OID_mib2 1,3,6,1,2,1
53
54 #define CUPS_OID_system CUPS_OID_mib2,1
55 #define CUPS_OID_sysLocation CUPS_OID_system,6
56
57 #define CUPS_OID_host CUPS_OID_mib2,25
58
59 #define CUPS_OID_hrSystem CUPS_OID_host,1
60
61 #define CUPS_OID_hrStorage CUPS_OID_host,2
62
63 #define CUPS_OID_hrDevice CUPS_OID_host,3
64 #define CUPS_OID_hrDeviceTable CUPS_OID_hrDevice,2
65 #define CUPS_OID_hrDeviceEntry CUPS_OID_hrDeviceTable,1
66 #define CUPS_OID_hrDeviceIndex CUPS_OID_hrDeviceEntry,1
67 #define CUPS_OID_hrDeviceType CUPS_OID_hrDeviceEntry,2
68 #define CUPS_OID_hrDeviceDescr CUPS_OID_hrDeviceEntry,3
69
70 #define CUPS_OID_hrPrinterTable CUPS_OID_hrDevice,5
71 #define CUPS_OID_hrPrinterEntry CUPS_OID_hrPrinterTable,1
72 #define CUPS_OID_hrPrinterStatus CUPS_OID_hrPrinterEntry,1
73 #define CUPS_OID_hrPrinterDetectedErrorState CUPS_OID_hrPrinterEntry,2
74
75 /* Printer MIB */
76 #define CUPS_OID_printmib CUPS_OID_mib2,43
77
78 #define CUPS_OID_prtGeneral CUPS_OID_printmib,5
79 #define CUPS_OID_prtGeneralTable CUPS_OID_prtGeneral,1
80 #define CUPS_OID_prtGeneralEntry CUPS_OID_prtGeneralTable,1
81 #define CUPS_OID_prtGeneralPrinterName CUPS_OID_prtGeneralEntry,16
82 #define CUPS_OID_prtGeneralSerialNumber CUPS_OID_prtGeneralEntry,17
83
84 #define CUPS_OID_prtCover CUPS_OID_printmib,6
85 #define CUPS_OID_prtCoverTable CUPS_OID_prtCover,1
86 #define CUPS_OID_prtCoverEntry CUPS_OID_prtCoverTable,1
87 #define CUPS_OID_prtCoverDescription CUPS_OID_prtCoverEntry,2
88 #define CUPS_OID_prtCoverStatus CUPS_OID_prtCoverEntry,3
89
90 #define CUPS_OID_prtMarker CUPS_OID_printmib,10
91 #define CUPS_OID_prtMarkerTable CUPS_OID_prtMarker,2
92 #define CUPS_OID_prtMarkerEntry CUPS_OID_prtMarkerTable,1
93 #define CUPS_OID_prtMarkerLifeCount CUPS_OID_prtMarkerEntry,4
94
95 #define CUPS_OID_prtMarkerSupplies CUPS_OID_printmib,11
96 #define CUPS_OID_prtMarkerSuppliesTable CUPS_OID_prtMarkerSupplies,1
97 #define CUPS_OID_prtMarkerSuppliesEntry CUPS_OID_prtMarkerSuppliesTable,1
98 #define CUPS_OID_prtMarkerSuppliesIndex CUPS_OID_prtMarkerSuppliesEntry,1
99 #define CUPS_OID_prtMarkerSuppliesMarkerIndex CUPS_OID_prtMarkerSuppliesEntry,2
100 #define CUPS_OID_prtMarkerSuppliesColorantIndex CUPS_OID_prtMarkerSuppliesEntry,3
101 #define CUPS_OID_prtMarkerSuppliesClass CUPS_OID_prtMarkerSuppliesEntry,4
102 #define CUPS_OID_prtMarkerSuppliesType CUPS_OID_prtMarkerSuppliesEntry,5
103 #define CUPS_OID_prtMarkerSuppliesDescription CUPS_OID_prtMarkerSuppliesEntry,6
104 #define CUPS_OID_prtMarkerSuppliesSupplyUnit CUPS_OID_prtMarkerSuppliesEntry,7
105 #define CUPS_OID_prtMarkerSuppliesMaxCapacity CUPS_OID_prtMarkerSuppliesEntry,8
106 #define CUPS_OID_prtMarkerSuppliesLevel CUPS_OID_prtMarkerSuppliesEntry,9
107
108 #define CUPS_OID_prtMarkerColorant CUPS_OID_printmib,12
109 #define CUPS_OID_prtMarkerColorantTable CUPS_OID_prtMarkerColorant,1
110 #define CUPS_OID_prtMarkerColorantEntry CUPS_OID_prtMarkerColorantTable,1
111 #define CUPS_OID_prtMarkerColorantIndex CUPS_OID_prtMarkerColorantEntry,1
112 #define CUPS_OID_prtMarkerColorantMarkerIndex CUPS_OID_prtMarkerColorantEntry,2
113 #define CUPS_OID_prtMarkerColorantRole CUPS_OID_prtMarkerColorantEntry,3
114 #define CUPS_OID_prtMarkerColorantValue CUPS_OID_prtMarkerColorantEntry,4
115 #define CUPS_OID_prtMarkerColorantTonality CUPS_OID_prtMarkerColorantEntry,5
116
117 #define CUPS_OID_prtInterpreter CUPS_OID_printmib,15
118 #define CUPS_OID_prtInterpreterTable CUPS_OID_prtInterpreter,1
119 #define CUPS_OID_prtInterpreterEntry CUPS_OID_prtInterpreterTable,1
120 #define CUPS_OID_prtInterpreterLangFamily CUPS_OID_prtInterpreterEntry,2
121 #define CUPS_OID_prtInterpreterLangLevel CUPS_OID_prtInterpreterEntry,3
122
123 /* Printer Port Monitor MIB */
124 #define CUPS_OID_enterprises 1,3,6,1,4,1
125 #define CUPS_OID_pwg CUPS_OID_enterprises,2699,1
126 #define CUPS_OID_ppmMIB CUPS_OID_pwg,2
127 #define CUPS_OID_ppmMIBObjects CUPS_OID_ppmMIB,1
128
129 #define CUPS_OID_ppmGeneral CUPS_OID_ppmMIBObjects,1
130
131 #define CUPS_OID_ppmPrinter CUPS_OID_ppmMIBObjects,2
132 #define CUPS_OID_ppmPrinterTable CUPS_OID_ppmPrinter,1
133 #define CUPS_OID_ppmPrinterEntry CUPS_OID_ppmPrinterTable,1
134 #define CUPS_OID_ppmPrinterIndex CUPS_OID_ppmPrinterEntry,1
135 #define CUPS_OID_ppmPrinterName CUPS_OID_ppmPrinterEntry,2
136 #define CUPS_OID_ppmPrinterIEEE1284DeviceId CUPS_OID_ppmPrinterEntry,3
137 #define CUPS_OID_ppmPrinterNumberOfPorts CUPS_OID_ppmPrinterEntry,4
138 #define CUPS_OID_ppmPrinterPreferredPortIndex CUPS_OID_ppmPrinterEntry,5
139 #define CUPS_OID_ppmPrinterHrDeviceIndex CUPS_OID_ppmPrinterEntry,6
140 #define CUPS_OID_ppmPrinterSnmpCommunityName CUPS_OID_ppmPrinterEntry,7
141 #define CUPS_OID_ppmPrinterSnmpQueryEnabled CUPS_OID_ppmPrinterEntry,8
142
143 #define CUPS_OID_ppmPort CUPS_OID_ppmMIBObjects,3
144 #define CUPS_OID_ppmPortTable CUPS_OID_ppmPort,1
145 #define CUPS_OID_ppmPortEntry CUPS_OID_ppmPortTable,1
146 #define CUPS_OID_ppmPortIndex CUPS_OID_ppmPortEntry,1
147 #define CUPS_OID_ppmPortEnabled CUPS_OID_ppmPortEntry,2
148 #define CUPS_OID_ppmPortName CUPS_OID_ppmPortEntry,3
149 #define CUPS_OID_ppmPortServiceNameOrURI CUPS_OID_ppmPortEntry,4
150 #define CUPS_OID_ppmPortProtocolType CUPS_OID_ppmPortEntry,5
151 #define CUPS_OID_ppmPortProtocolTargetPort CUPS_OID_ppmPortEntry,6
152 #define CUPS_OID_ppmPortProtocolAltSourceEnabled CUPS_OID_ppmPortEntry,7
153 #define CUPS_OID_ppmPortPrtChannelIndex CUPS_OID_ppmPortEntry,8
154 #define CUPS_OID_ppmPortLprByteCountEnabled CUPS_OID_ppmPortEntry,9
155
156
157 /*
158 * State constants...
159 */
160
161 #define CUPS_TC_other 1
162 #define CUPS_TC_unknown 2
163
164 #define CUPS_TC_idle 3
165 #define CUPS_TC_printing 4
166 #define CUPS_TC_warmup 5
167
168 /* These come from the hrPrinterDetectedErrorState OCTET-STRING */
169 #define CUPS_TC_lowPaper 0x8000
170 #define CUPS_TC_noPaper 0x4000
171 #define CUPS_TC_lowToner 0x2000
172 #define CUPS_TC_noToner 0x1000
173 #define CUPS_TC_doorOpen 0x0800
174 #define CUPS_TC_jammed 0x0400
175 #define CUPS_TC_offline 0x0200
176 #define CUPS_TC_serviceRequested 0x0100
177 #define CUPS_TC_inputTrayMissing 0x0080
178 #define CUPS_TC_outputTrayMissing 0x0040
179 #define CUPS_TC_markerSupplyMissing 0x0020
180 #define CUPS_TC_outputNearFull 0x0010
181 #define CUPS_TC_outputFull 0x0008
182 #define CUPS_TC_inputTrayEmpty 0x0004
183 #define CUPS_TC_overduePreventMaint 0x0002
184
185 #define CUPS_TC_prtCoverStatus_coverOpen 3
186 #define CUPS_TC_prtCoverStatus_coverClosed 4
187 #define CUPS_TC_prtCoverStatus_interlockOpen 5
188 #define CUPS_TC_prtCoverStatus_interlockClosed 6
189
190 #define CUPS_TC_langPCL 3
191 #define CUPS_TC_langHPGL 4
192 #define CUPS_TC_langPJL 5
193 #define CUPS_TC_langPS 6
194 #define CUPS_TC_langEscapeP 9
195 #define CUPS_TC_langCCITT 26
196 #define CUPS_TC_langLIPS 39
197 #define CUPS_TC_langTIFF 40
198 #define CUPS_TC_langPCLXL 47
199 #define CUPS_TC_langPDF 54
200 #define CUPS_TC_langJPEG 61
201
202 #define CUPS_TC_supplyThatIsConsumed 3
203 #define CUPS_TC_receptacleThatIsFilled 4
204
205 #define CUPS_TC_process 3
206 #define CUPS_TC_spot 4
207
208 #define CUPS_TC_toner 3
209 #define CUPS_TC_wasteToner 4
210 #define CUPS_TC_ink 5
211 #define CUPS_TC_inkCartridge 6
212 #define CUPS_TC_inkRibbon 7
213 #define CUPS_TC_wasteInk 8
214 #define CUPS_TC_opc 9
215 #define CUPS_TC_developer 10
216 #define CUPS_TC_fuserOil 11
217 #define CUPS_TC_solidWax 12
218 #define CUPS_TC_ribbonWax 13
219 #define CUPS_TC_wasteWax 14
220 #define CUPS_TC_fuser 15
221 #define CUPS_TC_coronaWire 16
222 #define CUPS_TC_fuserOilWick 17
223 #define CUPS_TC_cleanerUnit 18
224 #define CUPS_TC_fuserCleaningPad 19
225 #define CUPS_TC_transferUnit 20
226 #define CUPS_TC_tonerCartridge 21
227 #define CUPS_TC_fuserOiler 22
228 #define CUPS_TC_water 23
229 #define CUPS_TC_wasteWater 24
230 #define CUPS_TC_glueWaterAdditive 25
231 #define CUPS_TC_wastePaper 26
232 #define CUPS_TC_bindingSupply 27
233 #define CUPS_TC_bandingSupply 28
234 #define CUPS_TC_stitchingWire 29
235 #define CUPS_TC_shrinkWrap 30
236 #define CUPS_TC_paperWrap 31
237 #define CUPS_TC_staples 32
238 #define CUPS_TC_inserts 33
239 #define CUPS_TC_covers 34
240
241
242 /*
243 * Prototypes...
244 */
245
246 extern void backendCheckSideChannel(int snmp_fd, http_addr_t *addr);
247 extern int backendDrainOutput(int print_fd, int device_fd);
248 extern int backendGetDeviceID(int fd, char *device_id,
249 int device_id_size,
250 char *make_model,
251 int make_model_size,
252 const char *scheme, char *uri,
253 int uri_size);
254 extern int backendGetMakeModel(const char *device_id,
255 char *make_model,
256 int make_model_size);
257 extern void backendNetworkSideCB(int print_fd, int device_fd,
258 int snmp_fd, http_addr_t *addr,
259 int use_bc);
260 extern ssize_t backendRunLoop(int print_fd, int device_fd, int snmp_fd,
261 http_addr_t *addr, int use_bc,
262 void (*side_cb)(int print_fd,
263 int device_fd,
264 int snmp_fd,
265 http_addr_t *addr,
266 int use_bc));
267 extern int backendSNMPSupplies(int snmp_fd, http_addr_t *addr,
268 int *page_count,
269 int *printer_state);
270
271 # ifdef __cplusplus
272 }
273 # endif /* __cplusplus */
274 #endif /* !_CUPS_BACKEND_PRIVATE_H_ */
275
276
277 /*
278 * End of "$Id: backend-private.h 7810 2008-07-29 01:11:15Z mike $".
279 */