source: server/lib/gutenbach/ipp/constants.py @ f6e2532

no-cups
Last change on this file since f6e2532 was f6e2532, checked in by Jessica B. Hamrick <jhamrick@…>, 12 years ago

Constants; small changes in printer

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