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 (Section 4.4.15) |
---|
44 | 0x0013 - 0x0015 RFC 3380 (Section 4) |
---|
45 | 0x0016 - 0x001b RFC 3995 (Section 7.1) |
---|
46 | 0x0022 - 0x0031 RFC 3998 (Section 14.3) |
---|
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 StatusCodes(SuccessCodes, ClientErrorCodes, ServerErrorCodes): |
---|
188 | pass |
---|
189 | |
---|
190 | class CUPSPrinterType(): |
---|
191 | """ |
---|
192 | Printer types as defined by cups_ptype_e in the CUPS API |
---|
193 | specification: |
---|
194 | |
---|
195 | http://www.cups.org/documentation.php/doc-1.3/api-cups.html#cups_ptype_e |
---|
196 | """ |
---|
197 | |
---|
198 | LOCAL = 0x000000 |
---|
199 | CLASS = 0x000001 |
---|
200 | REMOTE = 0x000002 |
---|
201 | BW = 0x000004 |
---|
202 | COLOR = 0x000008 |
---|
203 | |
---|
204 | DUPLEX = 0x000010 |
---|
205 | STAPLE = 0x000020 |
---|
206 | COPIES = 0x000040 |
---|
207 | COLLATE = 0x000080 |
---|
208 | |
---|
209 | PUNCH = 0x000100 |
---|
210 | COVER = 0x000200 |
---|
211 | BIND = 0x000400 |
---|
212 | SORT = 0x000800 |
---|
213 | |
---|
214 | SMALL = 0x001000 |
---|
215 | MEDIUM = 0x002000 |
---|
216 | LARGE = 0x004000 |
---|
217 | VARIABLE = 0x008000 |
---|
218 | |
---|
219 | IMPLICIT = 0x010000 |
---|
220 | DEFAULT = 0x020000 |
---|
221 | FAX = 0x040000 |
---|
222 | REJECTING = 0x080000 |
---|
223 | |
---|
224 | DELETE = 0x100000 |
---|
225 | NOT_SHARED = 0x200000 |
---|
226 | AUTHENTICATED = 0x400000 |
---|
227 | COMMANDS = 0x800000 |
---|
228 | |
---|
229 | OPTIONS = 0x00e6ff |
---|
230 | |
---|
231 | def __init__(self): pass |
---|
232 | |
---|
233 | class AttributeTags(): |
---|
234 | """ |
---|
235 | Contains constants for the attribute IPP tags, as defined by RFC |
---|
236 | 2565. |
---|
237 | """ |
---|
238 | |
---|
239 | ZERO_NAME_LENGTH = 0x00 |
---|
240 | OPERATION = 0x01 |
---|
241 | JOB = 0x02 |
---|
242 | END = 0x03 |
---|
243 | PRINTER = 0x04 |
---|
244 | UNSUPPORTED = 0x05 |
---|
245 | SUBSCRIPTION = 0x06 |
---|
246 | EVENT_NOTIFICATION = 0x07 |
---|
247 | |
---|
248 | def __init__(self): pass |
---|
249 | |
---|
250 | class OutOfBandTags(): |
---|
251 | """ |
---|
252 | Contains constants for the out-of-band value IPP tags, as defined |
---|
253 | by RFC 2565. |
---|
254 | """ |
---|
255 | |
---|
256 | UNSUPPORTED = 0x10 |
---|
257 | DEFAULT = 0x11 |
---|
258 | UNKNOWN = 0x12 |
---|
259 | NO_VALUE = 0x13 |
---|
260 | NOT_SETTABLE = 0x15 |
---|
261 | DELETE_ATTRIBUTE = 0x16 |
---|
262 | ADMIN_DEFINE = 0x17 |
---|
263 | |
---|
264 | def __init__(self): pass |
---|
265 | |
---|
266 | class IntegerTags(): |
---|
267 | """ |
---|
268 | Contains constants for the integer value IPP tags, as defined by |
---|
269 | RFC 2565. |
---|
270 | """ |
---|
271 | |
---|
272 | GENERIC = 0x20 |
---|
273 | INTEGER = 0x21 |
---|
274 | BOOLEAN = 0x22 |
---|
275 | ENUM = 0x23 |
---|
276 | |
---|
277 | def __init__(self): pass |
---|
278 | |
---|
279 | class OctetStringTags(): |
---|
280 | """ |
---|
281 | Contains constants for the octetString value IPP tags, as defined |
---|
282 | by RFC 2565. |
---|
283 | """ |
---|
284 | |
---|
285 | UNSPECIFIED_OCTETSTRING = 0x30 |
---|
286 | DATETIME = 0x31 |
---|
287 | RESOLUTION = 0x32 |
---|
288 | RANGE_OF_INTEGER = 0x33 |
---|
289 | BEG_COLLECTION = 0x34 |
---|
290 | TEXT_WITH_LANGUAGE = 0x35 |
---|
291 | NAME_WITH_LANGUAGE = 0x36 |
---|
292 | END_COLLECTION = 0x37 |
---|
293 | |
---|
294 | def __init__(self): pass |
---|
295 | |
---|
296 | class CharacterStringTags(): |
---|
297 | """ |
---|
298 | Contains constants for the character-string value IPP tags, as |
---|
299 | defined by RFC 2565. |
---|
300 | """ |
---|
301 | |
---|
302 | GENERIC = 0x40 |
---|
303 | TEXT_WITHOUT_LANGUAGE = 0x41 |
---|
304 | NAME_WITHOUT_LANGUAGE = 0x42 |
---|
305 | KEYWORD = 0x44 |
---|
306 | URI = 0x45 |
---|
307 | URI_SCHEME = 0x46 |
---|
308 | CHARSET = 0x47 |
---|
309 | NATURAL_LANGUAGE = 0x48 |
---|
310 | MIME_MEDIA_TYPE = 0x49 |
---|
311 | MEMBER_ATTR_NAME = 0x4a |
---|
312 | |
---|
313 | class Tags(AttributeTags, OutOfBandTags, IntegerTags, OctetStringTags, CharacterStringTags): |
---|
314 | pass |
---|