1 | #!/usr/bin/python |
---|
2 | |
---|
3 | class Misc(): |
---|
4 | """ |
---|
5 | Miscellaneous config options for the IPP server. |
---|
6 | """ |
---|
7 | |
---|
8 | IPP_VERSION = "1.1" |
---|
9 | IPP_PORT = 8000 |
---|
10 | |
---|
11 | def __init__(self): pass |
---|
12 | |
---|
13 | class JobStates(): |
---|
14 | """ |
---|
15 | Job state codes, as defined by RFC 2911, Section 4.3.7 |
---|
16 | """ |
---|
17 | |
---|
18 | PENDING = 3 |
---|
19 | HELD = 4 |
---|
20 | PROCESSING = 5 |
---|
21 | STOPPED = 6 |
---|
22 | CANCELLED = 7 |
---|
23 | ABORTED = 8 |
---|
24 | COMPLETE = 9 |
---|
25 | |
---|
26 | def __init__(self): pass |
---|
27 | |
---|
28 | class PrinterStates(): |
---|
29 | """ |
---|
30 | Printer state codes, as defined by RFC 2911, Section 4.4.11 |
---|
31 | """ |
---|
32 | |
---|
33 | IDLE = 3 |
---|
34 | PROCESSING = 4 |
---|
35 | STOPPED = 5 |
---|
36 | |
---|
37 | def __init__(self): pass |
---|
38 | |
---|
39 | class Operations(): |
---|
40 | """ |
---|
41 | IPP and CUPS IPP Operations, as defined in various RFCs: |
---|
42 | |
---|
43 | 0x0002 - 0x0012 RFC 2911 |
---|
44 | 0x0013 - 0x0015 RFC 3380 |
---|
45 | 0x0016 - 0x001b RFC 3995 |
---|
46 | 0x0022 - 0x0031 RFC 3998 |
---|
47 | 0x4000 - 0x4027 CUPS IPP Actions |
---|
48 | """ |
---|
49 | |
---|
50 | # These are defined in RFC 2911, Section 4.4.15 |
---|
51 | PRINT_JOB = 0x0002 |
---|
52 | PRINT_URI = 0x0003 |
---|
53 | VALIDATE_JOB = 0x0004 |
---|
54 | CREATE_JOB = 0x0005 |
---|
55 | SEND_DOCUMENT = 0x0006 |
---|
56 | SEND_URI = 0x0007 |
---|
57 | CANCEL_JOB = 0x0008 |
---|
58 | GET_JOB_ATTRIBUTES = 0x0009 |
---|
59 | GET_JOBS = 0x000a |
---|
60 | GET_PRINTER_ATTRIBUTES = 0x000b |
---|
61 | #HOLD_JOB = 0x000c |
---|
62 | #RELEASE_JOB = 0x000d |
---|
63 | #RESTART_JOB = 0x000e |
---|
64 | PAUSE_PRINTER = 0x0010 |
---|
65 | RESUME_PRINTER = 0x0011 |
---|
66 | #PURGE_JOBS = 0x0012 |
---|
67 | |
---|
68 | # These are defined in RFC 3380, Section 4 |
---|
69 | SET_PRINTER_ATTRIBUTES = 0x0013 |
---|
70 | SET_JOB_ATTRIBUTES = 0x0014 |
---|
71 | #GET_PRINTER_SUPPORTED_VALUES = 0x0015 |
---|
72 | |
---|
73 | # These are defined in RFC 3995, Section 7.1 |
---|
74 | #CREATE_PRINTER_SUBSCRIPTION = 0x0016 |
---|
75 | #CREATE_JOB_SUBSCRIPTION = 0x0017 |
---|
76 | #GET_SUBSCRIPTION_ATTRIBUTES = 0x0018 |
---|
77 | #GET_SUBSCRIPTIONS = 0x0019 |
---|
78 | #RENEW_SUBSCRIPTION = 0x001a |
---|
79 | #CANCEL_SUBSCRIPTION = 0x001b |
---|
80 | |
---|
81 | # These are defined in RFC 3998, Section 14.3 |
---|
82 | #ENABLE_PRINTER = 0x0022 |
---|
83 | #DISABLE_PRINTER = 0x0023 |
---|
84 | #PAUSE_PRINTER_AFTER_CURRENT_JOB = 0x0024 |
---|
85 | #HOLD_NEW_JOBS = 0x0025 |
---|
86 | #RELEASE_HELD_NEW_JOBS = 0x0026 |
---|
87 | #DEACTIVATE_PRINTER = 0x0027 |
---|
88 | #ACTIVATE_PRINTER = 0x0028 |
---|
89 | #RESTART_PRINTER = 0x0029 |
---|
90 | #SHUTDOWN_PRINTER = 0x002a |
---|
91 | #STARTUP_PRINTER = 0x002b |
---|
92 | #REPROCESS_JOB = 0x002c |
---|
93 | #CANCEL_CURRENT_JOB = 0x002d |
---|
94 | #SUSPEND_CURRENT_JOB = 0x002e |
---|
95 | #RESUME_JOB = 0x002f |
---|
96 | PROMOTE_JOB = 0x0030 |
---|
97 | #SCHEDULE_JOB_AFTER = 0x0031 |
---|
98 | |
---|
99 | # These are special CUPS actions, defined in: |
---|
100 | # http://www.cups.org/documentation.php/spec-ipp.html |
---|
101 | #PRIVATE = 0x4000 |
---|
102 | CUPS_GET_DEFAULT = 0x4001 |
---|
103 | CUPS_GET_PRINTERS = 0x4002 |
---|
104 | #CUPS_ADD_PRINTER = 0x4003 |
---|
105 | #CUPS_DELETE_PRINTER = 0x4004 |
---|
106 | #CUPS_GET_CLASSES = 0x4005 |
---|
107 | #CUPS_ADD_CLASS = 0x4006 |
---|
108 | #CUPS_DELETE_CLASS = 0x4007 |
---|
109 | #CUPS_ACCEPT_JOBS = 0x4008 |
---|
110 | #CUPS_REJECT_JOBS = 0x4009 |
---|
111 | #CUPS_SET_DEFAULT = 0x400a |
---|
112 | #CUPS_GET_DEVICES = 0x400b |
---|
113 | #CUPS_GET_PPDS = 0x400c |
---|
114 | #CUPS_MOVE_JOB = 0x400d |
---|
115 | #CUPS_AUTHENTICATE_JOB = 0x400e |
---|
116 | #CUPS_GET_PPD = 0x400f |
---|
117 | CUPS_GET_DOCUMENT = 0x4027 |
---|
118 | |
---|
119 | def __init__(self): pass |
---|
120 | |
---|
121 | class SuccessCodes(): |
---|
122 | """ |
---|
123 | Success status codes as defined in RFC 2911, Section 13 |
---|
124 | """ |
---|
125 | |
---|
126 | OK = 0x0000 |
---|
127 | OK_SUBST = 0x0001 |
---|
128 | OK_CONFLICT = 0x0002 |
---|
129 | OK_IGNORED_SUBSCRIPTIONS = 0x0003 |
---|
130 | OK_IGNORED_NOTIFICATIONS = 0x0004 |
---|
131 | OK_TOO_MANY_EVENTS = 0x0005 |
---|
132 | OK_BUT_CANCEL_SUBSCRIPTION = 0x0006 |
---|
133 | |
---|
134 | def __init__(self): pass |
---|
135 | |
---|
136 | class ClientErrorCodes(): |
---|
137 | """ |
---|
138 | Client error codes as defined in RFC 2911, Section 13 |
---|
139 | """ |
---|
140 | |
---|
141 | BAD_REQUEST = 0x0400 |
---|
142 | FORBIDDEN = 0x0401 |
---|
143 | NOT_AUTHENTICATED = 0x0402 |
---|
144 | NOT_AUTHORIZED = 0x0403 |
---|
145 | NOT_POSSIBLE = 0x0404 |
---|
146 | TIMEOUT = 0x0405 |
---|
147 | NOT_FOUND = 0x0406 |
---|
148 | GONE = 0x0407 |
---|
149 | REQUEST_ENTITY = 0x0408 |
---|
150 | REQUEST_VALUE = 0x0409 |
---|
151 | DOCUMENT_FORMAT = 0x040a |
---|
152 | ATTRIBUTES = 0x040b |
---|
153 | URI_SCHEME = 0x040c |
---|
154 | CHARSET = 0x040d |
---|
155 | CONFLICT = 0x040e |
---|
156 | COMPRESSION_NOT_SUPPORTED = 0x040f |
---|
157 | COMPRESSION_ERROR = 0x0410 |
---|
158 | DOCUMENT_FORMAT_ERROR = 0x0411 |
---|
159 | DOCUMENT_ACCESS_ERROR = 0x0412 |
---|
160 | ATTRIBUTES_NOT_SETTABLE = 0x0413 |
---|
161 | IGNORED_ALL_SUBSCRIPTIONS = 0x0414 |
---|
162 | TOO_MANY_SUBSCRIPTIONS = 0x0415 |
---|
163 | IGNORED_ALL_NOTIFICATIONS = 0x0416 |
---|
164 | PRINT_SUPPORT_FILE_NOT_FOUND = 0x0417 |
---|
165 | |
---|
166 | def __init__(self): pass |
---|
167 | |
---|
168 | class ServerErrorCodes(): |
---|
169 | """ |
---|
170 | Server error codes as defined in RFC 2911, Section 13 |
---|
171 | """ |
---|
172 | |
---|
173 | INTERNAL_ERROR = 0x0500 |
---|
174 | OPERATION_NOT_SUPPORTED = 0x0501 |
---|
175 | SERVICE_UNAVAILABLE = 0x0502 |
---|
176 | VERSION_NOT_SUPPORTED = 0x0503 |
---|
177 | DEVICE_ERROR = 0x0504 |
---|
178 | TEMPORARY_ERROR = 0x0505 |
---|
179 | NOT_ACCEPTING = 0x0506 |
---|
180 | PRINTER_BUSY = 0x0507 |
---|
181 | ERROR_JOB_CANCELLED = 0x0508 |
---|
182 | MULTIPLE_JOBS_NOT_SUPPORTED = 0x0509 |
---|
183 | PRINTER_IS_DEACTIVATED = 0x050a |
---|
184 | |
---|
185 | def __init__(self): pass |
---|
186 | |
---|
187 | class CUPSPrinterType(): |
---|
188 | """ |
---|
189 | Printer types as defined by cups_ptype_e in the CUPS API |
---|
190 | specification: |
---|
191 | |
---|
192 | http://www.cups.org/documentation.php/doc-1.3/api-cups.html#cups_ptype_e |
---|
193 | """ |
---|
194 | |
---|
195 | LOCAL = 0x000000 |
---|
196 | CLASS = 0x000001 |
---|
197 | REMOTE = 0x000002 |
---|
198 | BW = 0x000004 |
---|
199 | COLOR = 0x000008 |
---|
200 | |
---|
201 | DUPLEX = 0x000010 |
---|
202 | STAPLE = 0x000020 |
---|
203 | COPIES = 0x000040 |
---|
204 | COLLATE = 0x000080 |
---|
205 | |
---|
206 | PUNCH = 0x000100 |
---|
207 | COVER = 0x000200 |
---|
208 | BIND = 0x000400 |
---|
209 | SORT = 0x000800 |
---|
210 | |
---|
211 | SMALL = 0x001000 |
---|
212 | MEDIUM = 0x002000 |
---|
213 | LARGE = 0x004000 |
---|
214 | VARIABLE = 0x008000 |
---|
215 | |
---|
216 | IMPLICIT = 0x010000 |
---|
217 | DEFAULT = 0x020000 |
---|
218 | FAX = 0x040000 |
---|
219 | REJECTING = 0x080000 |
---|
220 | |
---|
221 | DELETE = 0x100000 |
---|
222 | NOT_SHARED = 0x200000 |
---|
223 | AUTHENTICATED = 0x400000 |
---|
224 | COMMANDS = 0x800000 |
---|
225 | |
---|
226 | OPTIONS = 0x00e6ff |
---|
227 | |
---|
228 | def __init__(self): pass |
---|
229 | |
---|
230 | class AttributeTags(): |
---|
231 | """ |
---|
232 | Contains constants for the attribute IPP tags, as defined by RFC |
---|
233 | 2565. |
---|
234 | """ |
---|
235 | |
---|
236 | ZERO_NAME_LENGTH = 0x00 |
---|
237 | OPERATION = 0x01 |
---|
238 | JOB = 0x02 |
---|
239 | END = 0x03 |
---|
240 | PRINTER = 0x04 |
---|
241 | UNSUPPORTED = 0x05 |
---|
242 | SUBSCRIPTION = 0x06 |
---|
243 | EVENT_NOTIFICATION = 0x07 |
---|
244 | |
---|
245 | def __init__(self): pass |
---|
246 | |
---|
247 | class OutOfBandTags(): |
---|
248 | """ |
---|
249 | Contains constants for the out-of-band value IPP tags, as defined |
---|
250 | by RFC 2565. |
---|
251 | """ |
---|
252 | |
---|
253 | UNSUPPORTED = 0x10 |
---|
254 | DEFAULT = 0x11 |
---|
255 | UNKNOWN = 0x12 |
---|
256 | NO_VALUE = 0x13 |
---|
257 | NOT_SETTABLE = 0x15 |
---|
258 | DELETE_ATTRIBUTE = 0x16 |
---|
259 | ADMIN_DEFINE = 0x17 |
---|
260 | |
---|
261 | def __init__(self): pass |
---|
262 | |
---|
263 | class IntegerTags(): |
---|
264 | """ |
---|
265 | Contains constants for the integer value IPP tags, as defined by |
---|
266 | RFC 2565. |
---|
267 | """ |
---|
268 | |
---|
269 | GENERIC = 0x20 |
---|
270 | INTEGER = 0x21 |
---|
271 | BOOLEAN = 0x22 |
---|
272 | ENUM = 0x23 |
---|
273 | |
---|
274 | def __init__(self): pass |
---|
275 | |
---|
276 | class OctetStringTags(): |
---|
277 | """ |
---|
278 | Contains constants for the octetString value IPP tags, as defined |
---|
279 | by RFC 2565. |
---|
280 | """ |
---|
281 | |
---|
282 | UNSPECIFIED_OCTETSTRING = 0x30 |
---|
283 | DATETIME = 0x31 |
---|
284 | RESOLUTION = 0x32 |
---|
285 | RANGE_OF_INTEGER = 0x33 |
---|
286 | BEG_COLLECTION = 0x34 |
---|
287 | TEXT_WITH_LANGUAGE = 0x35 |
---|
288 | NAME_WITH_LANGUAGE = 0x36 |
---|
289 | END_COLLECTION = 0x37 |
---|
290 | |
---|
291 | def __init__(self): pass |
---|
292 | |
---|
293 | class CharacterStringTags(): |
---|
294 | """ |
---|
295 | Contains constants for the character-string value IPP tags, as |
---|
296 | defined by RFC 2565. |
---|
297 | """ |
---|
298 | |
---|
299 | GENERIC = 0x40 |
---|
300 | TEXT_WITHOUT_LANGUAGE = 0x41 |
---|
301 | NAME_WITHOUT_LANGUAGE = 0x42 |
---|
302 | KEYWORD = 0x44 |
---|
303 | URI = 0x45 |
---|
304 | URI_SCHEME = 0x46 |
---|
305 | CHARSET = 0x47 |
---|
306 | NATURAL_LANGUAGE = 0x48 |
---|
307 | MIME_MEDIA_TYPE = 0x49 |
---|
308 | MEMBER_ATTR_NAME = 0x4a |
---|