source: server/lib/gutenbach/ipp/object_attributes/printer_description_attributes.py @ aded2d1

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

Checkpoint, creating classes for specific IPP attributes

  • Property mode set to 100644
File size: 24.5 KB
Line 
1__all__ = [
2    'PrinterUriSupported',
3    'UriAuthenticationSupported',
4    'UriSecuritySupported',
5    'PrinterName',
6    'PrinterLocation',
7    'PrinterInfo',
8    'PrinterMoreInfo',
9    'PrinterDriverInstaller',
10    'PrinterMakeAndModel',
11    'PrinterMoreInfoManufacturer',
12    'PrinterState',
13    'PrinterStateReasons',
14    'PrinterStateMessage',
15    'IppVersionsSupported',
16    'OperationsSupported',
17    'MultipleDocumentJobsSupported',
18    'CharsetConfigured',
19    'CharsetSupported',
20    'NaturalLanguageConfigured',
21    'GeneratedNaturalLanguageSupported',
22    'DocumentFormatDefault',
23    'DocumentFormatSupported',
24    'PrinterIsAcceptingJobs',
25    'QueuedJobCount',
26    'PrinterMessageFromOperator',
27    'ColorSupported',
28    'ReferenceUriSchemeSupported',
29    'PdlOverrideSupported',
30    'PrinterUpTime',
31    'PrinterCurrentTime',
32    'MultipleOperationTimeOut',
33    'CompressionSupported',
34    'JobKOctetsSupported',
35    'JobImpressionsSupported',
36    'JobMediaSheetsSupported',
37    'PagesPerMinute',
38    'PagesPerMinuteColor'
39]
40
41from ..attribute import Attribute
42from ..value import Value
43from ..exceptions import ClientErrorAttributes
44from ..constants import *
45
46class PrinterUriSupported(Attribute):
47    """4.4.1 printer-uri-supported (1setOf uri)
48
49    This REQUIRED Printer attribute contains at least one URI for the
50    Printer object. It OPTIONALLY contains more than one URI for the
51    Printer object.
52
53    An administrator determines a Printer object's URI(s) and
54    configures this attribute to contain those URIs by some means
55    outside the scope of this IPP/1.1 document. The precise format of
56    this URI is implementation dependent and depends on the protocol.
57    See the next two sections for a description of the 'uri-security-
58    supported' and 'uri-authentication-supported' attributes, both of
59    which are the REQUIRED companion attributes to this 'printer-uri-
60    supported' attribute. See section 2.4 on Printer object identity
61    and section 8.2 on security and URIs for more information.
62   
63    """
64   
65    def __init__(self, *vals):
66        super(type(self), self).__init__(
67            'printer-uri-supported',
68            [Value(CharacterStringTags.URI, val) for val in vals])
69
70
71class UriAuthenticationSupported(Attribute):
72    """4.4.2 uri-authentication-supported (1setOf type2 keyword)
73
74    This REQUIRED Printer attribute MUST have the same cardinality
75    (contain the same number of values) as the 'printer-uri-supported'
76    attribute. This attribute identifies the Client Authentication
77    mechanism associated with each URI listed in the 'printer-uri-
78    supported' attribute. The Printer object uses the specified
79    mechanism to identify the authenticated user (see section
80    8.3). The 'i th' value in 'uri-authentication-supported'
81    corresponds to the 'i th' value in 'printer-uri-supported' and it
82    describes the authentication mechanisms used by the Printer when
83    accessed via that URI. See [RFC2910] for more details on Client
84    Authentication.
85
86    """
87   
88    def __init__(self, val):
89        super(type(self), self).__init__(
90            'uri-authentication-supported',
91            [Value(CharacterStringTags.KEYWORD, val)])
92
93class UriSecuritySupported(Attribute):
94    """4.4.3 uri-security-supported (1setOf type2 keyword)
95
96    This REQUIRED Printer attribute MUST have the same cardinality
97    (contain the same number of values) as the 'printer-uri-supported'
98    attribute. This attribute identifies the security mechanisms used
99    for each URI listed in the 'printer-uri-supported' attribute. The
100    'i th' value in 'uri-security-supported' corresponds to the 'i th'
101    value in 'printer-uri-supported' and it describes the security
102    mechanisms used for accessing the Printer object via that URI. See
103    [RFC2910] for more details on security mechanisms.
104
105    The following standard keyword values are defined:
106        'none': There are no secure communication channel protocols in
107                use for the given URI.
108        'ssl3': SSL3 [SSL] is the secure communications channel
109                protocol in use for the given URI.
110        'tls':  TLS [RFC2246] is the secure communications channel
111                protocol in use for the given URI.
112
113    This attribute is orthogonal to the definition of a Client
114    Authentication mechanism. Specifically, 'none' does not exclude
115    Client Authentication. See section 4.4.2.
116
117    """
118   
119    def __init__(self, val):
120        super(type(self), self).__init__(
121            'uri-security-supported',
122            [Value(CharacterStringTags.KEYWORD, val)])
123
124class PrinterName(Attribute):
125    """4.4.4 printer-name (name(127))
126
127    This REQUIRED Printer attribute contains the name of the Printer
128    object. It is a name that is more end-user friendly than a URI. An
129    administrator determines a printer's name and sets this attribute
130    to that name. This name may be the last part of the printer's URI
131    or it may be unrelated. In non-US-English locales, a name may
132    contain characters that are not allowed in a URI.
133
134    """
135   
136    def __init__(self, val):
137        super(type(self), self).__init__(
138            'printer-name',
139            [Value(CharacterStringTags.NAME_WITHOUT_LANGUAGE, val)])
140
141class PrinterLocation(Attribute):
142    """4.4.5 printer-location (text(127))
143
144    """
145
146    def __init__(self, val):
147        raise ClientErrorAttributes, "printer-location"
148
149class PrinterInfo(Attribute):
150    """4.4.6 printer-info (text(127))
151
152    """
153
154    def __init__(self, val):
155        raise ClientErrorAttributes, "printer-info"
156
157class PrinterMoreInfo(Attribute):
158    """4.4.7 printer-more-info (uri)
159
160    """
161
162    def __init__(self, val):
163        raise ClientErrorAttributes, "printer-more-info"
164
165class PrinterDriverInstaller(Attribute):
166    """4.4.8 printer-driver-installer (uri)
167
168    """
169
170    def __init__(self, val):
171        raise ClientErrorAttributes, "printer-driver-installer"
172
173class PrinterMakeAndModel(Attribute):
174    """4.4.9 printer-make-and-model (text(127))
175
176    """
177
178    def __init__(self, val):
179        raise ClientErrorAttributes, "printer-make-and-model"
180
181class PrinterMoreInfoManufacturer(Attribute):
182    """4.4.10 printer-more-info-manufacturer (uri)
183
184    """
185
186    def __init__(self, val):
187        raise ClientErrorAttributes, "printer-more-info-manufacturer"
188
189class PrinterState(Attribute):
190    """4.4.11 printer-state (type1 enum)
191
192    This REQUIRED Printer attribute identifies the current state of
193    the device. The 'printer-state reasons' attribute augments the
194    'printer-state' attribute to give more detailed information about
195    the Printer in the given printer state.
196
197    A Printer object need only update this attribute before responding
198    to an operation which requests the attribute; the Printer object
199    NEED NOT update this attribute continually, since asynchronous
200    event notification is not part of IPP/1.1. A Printer NEED NOT
201    implement
202
203    """
204   
205    def __init__(self, val):
206        super(type(self), self).__init__(
207            'printer-state',
208            [Value(IntegerTags.ENUM, val)])
209
210class PrinterStateReasons(Attribute):
211    """4.4.12 printer-state-reasons (1setOf type2 keyword)
212
213    This REQUIRED Printer attribute supplies additional detail about
214    the device's state. Some of the these value definitions indicate
215    conformance requirements; the rest are OPTIONAL.
216
217    Each keyword value MAY have a suffix to indicate its level of
218    severity. The three levels are: report (least severe), warning,
219    and error (most severe).
220
221    """
222   
223    def __init__(self, val):
224        super(type(self), self).__init__(
225            'printer-state-reasons',
226            [Value(CharacterStringTags.KEYWORD, val)])
227
228class PrinterStateMessage(Attribute):
229    """4.4.13 printer-state-message (text(MAX))
230
231    """
232
233    def __init__(self, val):
234        raise ClientErrorAttributes, "printer-state-message"
235
236class IppVersionsSupported(Attribute):
237    """4.4.14 ipp-versions-supported (1setOf type2 keyword)
238
239    This REQUIRED attribute identifies the IPP protocol version(s)
240    that this Printer supports, including major and minor versions,
241    i.e., the version numbers for which this Printer implementation
242    meets the conformance requirements. For version number validation,
243    the Printer matches the (two-octet binary) 'version-number'
244    parameter supplied by the client in each request (see sections
245    3.1.1 and 3.1.8) with the (US-ASCII) keyword values of this
246    attribute.
247
248    The following standard keyword values are defined:
249
250    '1.0': Meets the conformance requirement of IPP version 1.0 as
251           specified in RFC 2566 [RFC2566] and RFC 2565 [RFC2565]
252           including any extensions registered according to Section 6
253           and any extension defined in this version or any future
254           version of the IPP 'Model and Semantics' document or the
255           IPP 'Encoding and Transport' document following the rules,
256           if any, when the 'version-number' parameter is '1.0'.
257
258    '1.1': Meets the conformance requirement of IPP version 1.1 as
259           specified in this document and [RFC2910] including any
260           extensions registered according to Section 6 and any
261           extension defined in any future versions of the IPP 'Model
262           and Semantics' document or the IPP Encoding and Transport
263           document following the rules, if any, when the
264           'version-number' parameter is '1.1'.
265
266    """
267   
268    def __init__(self, *vals):
269        super(type(self), self).__init__(
270            'ipp-versions-supported',
271            [Value(CharacterStringTags.KEYWORD, val) for val in vals])
272
273class OperationsSupported(Attribute):
274    """4.4.15 operations-supported (1setOf type2 enum)
275
276    This REQUIRED Printer attribute specifies the set of supported
277    operations for this Printer object and contained Job objects.
278    This attribute is encoded as any other enum attribute syntax
279    according to [RFC2910] as 32-bits. However, all 32-bit enum values
280    for this attribute MUST NOT exceed 0x00008FFF, since these same
281    values are also passed in two octets in the 'operation-id'
282    parameter (see section 3.1.1) in each Protocol request with the
283    two high order octets omitted in order to indicate the operation
284    being performed [RFC2910].
285
286    """
287   
288    def __init__(self, *vals):
289        super(type(self), self).__init__(
290            'operations-supported',
291            [Value(IntegerTags.ENUM, val) for val in vals])
292
293class MultipleDocumentJobsSupported(Attribute):
294    """4.4.16 multiple-document-jobs-supported (boolean)
295
296    This Printer attribute indicates whether or not the Printer
297    supports more than one document per job, i.e., more than one
298    Send-Document or Send-Data operation with document data. If the
299    Printer supports the Create-Job and Send-Document operations (see
300    section 3.2.4 and 3.3.1), it MUST support this attribute.
301
302    """
303   
304    def __init__(self, val):
305        super(type(self), self).__init__(
306            'multiple-document-jobs-supported',
307            [Value(IntegerTags.BOOLEAN, val)])
308
309class CharsetConfigured(Attribute):
310    """4.4.17 charset-configured (charset)
311
312    This REQUIRED Printer attribute identifies the charset that the
313    Printer object has been configured to represent 'text' and 'name'
314    Printer attributes that are set by the operator, system
315    administrator, or manufacturer, i.e., for 'printer-name' (name),
316    'printer-location' (text), 'printer-info' (text), and
317    'printer-make- and-model' (text). Therefore, the value of the
318    Printer object's 'charset-configured' attribute MUST also be among
319    the values of the Printer object's 'charset-supported' attribute.
320
321    """
322   
323    def __init__(self, val):
324        super(type(self), self).__init__(
325            'charset-configured',
326            [Value(CharacterStringTags.CHARSET, val)])
327
328class CharsetSupported(Attribute):
329    """4.4.18 charset-supported (1setOf charset)
330
331    This REQUIRED Printer attribute identifies the set of charsets
332    that the Printer and contained Job objects support in attributes
333    with attribute syntax 'text' and 'name'. At least the value
334    'utf-8' MUST be present, since IPP objects MUST support the UTF-8
335    [RFC2279] charset. If a Printer object supports a charset, it
336    means that for all attributes of syntax 'text' and 'name' the IPP
337    object MUST (1) accept the charset in requests and return the
338    charset in responses as needed.
339
340    If more charsets than UTF-8 are supported, the IPP object MUST
341    perform charset conversion between the charsets as described in
342    Section 3.1.4.2.
343
344    """
345   
346    def __init__(self, *vals):
347        super(type(self), self).__init__(
348            'charset-supported',
349            [Value(CharacterStringTags.CHARSET, val) for val in vals])
350
351class NaturalLanguageConfigured(Attribute):
352    """4.4.19 natural-language-configured (naturalLanguage)
353
354    This REQUIRED Printer attribute identifies the natural language
355    that the Printer object has been configured to represent 'text'
356    and 'name' Printer attributes that are set by the operator, system
357    administrator, or manufacturer, i.e., for 'printer-name' (name),
358    'printer-location' (text), 'printer-info' (text), and
359    'printer-make- and-model' (text). When returning these Printer
360    attributes, the Printer object MAY return them in the configured
361    natural language specified by this attribute, instead of the
362    natural language requested by the client in the
363    'attributes-natural-language' operation attribute. See Section
364    3.1.4.1 for the specification of the OPTIONAL multiple natural
365    language support. Therefore, the value of the Printer object's
366    'natural-language-configured' attribute MUST also be among the
367    values of the Printer object's 'generated-natural-
368    language-supported' attribute.
369
370    """
371   
372    def __init__(self, val):
373        super(type(self), self).__init__(
374            'natural-language-configured',
375            [Value(CharacterStringTags.NATURAL_LANGUAGE, val)])
376
377class GeneratedNaturalLanguageSupported(Attribute):
378    """4.4.20 generated-natural-language-supported (1setOf naturalLanguage)
379
380    This REQUIRED Printer attribute identifies the natural language(s)
381    that the Printer object and contained Job objects support in
382    attributes with attribute syntax 'text' and 'name'. The natural
383    language(s) supported depends on implementation and/or
384    configuration.  Unlike charsets, IPP objects MUST accept requests
385    with any natural language or any Natural Language Override whether
386    the natural language is supported or not.
387
388    If a Printer object supports a natural language, it means that for
389    any of the attributes for which the Printer or Job object
390    generates messages, i.e., for the 'job-state-message' and
391    'printer-state- message' attributes and Operation Messages (see
392    Section 3.1.5) in operation responses, the Printer and Job objects
393    MUST be able to generate messages in any of the Printer's
394    supported natural languages. See section 3.1.4 for the definition
395    of 'text' and 'name' attributes in operation requests and
396    responses.
397
398    Note: A Printer object that supports multiple natural languages,
399    often has separate catalogs of messages, one for each natural
400    language supported.
401
402    """
403   
404    def __init__(self, *vals):
405        super(type(self), self).__init__(
406            'generated-natural-language-supported',
407            [Value(CharacterStringTags.NATURAL_LANGUAGE, val) for val in vals])
408
409class DocumentFormatDefault(Attribute):
410    """4.4.21 document-format-default (mimeMediaType)
411
412    This REQUIRED Printer attribute identifies the document format
413    that the Printer object has been configured to assume if the
414    client does not supply a 'document-format' operation attribute in
415    any of the operation requests that supply document data. The
416    standard values for this attribute are Internet Media types
417    (sometimes called MIME types). For further details see the
418    description of the 'mimeMediaType' attribute syntax in Section
419    4.1.9.
420
421    """
422   
423    def __init__(self, val):
424        super(type(self), self).__init__(
425            'document-format-default',
426            [Value(CharacterStringTags.MIME_MEDIA_TYPE, val)])
427
428class DocumentFormatSupported(Attribute):
429    """4.4.22 document-format-supported (1setOf mimeMediaType)
430
431    This REQUIRED Printer attribute identifies the set of document
432    formats that the Printer object and contained Job objects can
433    support. For further details see the description of the
434    'mimeMediaType' attribute syntax in Section 4.1.9.
435
436    """
437   
438    def __init__(self, *vals):
439        super(type(self), self).__init__(
440            'document-format-supported',
441            [Value(CharacterStringTags.MIME_MEDIA_TYPE, val) for val in vals])
442
443class PrinterIsAcceptingJobs(Attribute):
444    """4.4.23 printer-is-accepting-jobs (boolean)
445
446    This REQUIRED Printer attribute indicates whether the printer is
447    currently able to accept jobs, i.e., is accepting Print-Job,
448    Print- URI, and Create-Job requests. If the value is 'true', the
449    printer is accepting jobs. If the value is 'false', the Printer
450    object is currently rejecting any jobs submitted to it. In this
451    case, the Printer object returns the
452    'server-error-not-accepting-jobs' status code.
453
454    This value is independent of the 'printer-state' and
455    'printer-state- reasons' attributes because its value does not
456    affect the current job; rather it affects future jobs. This
457    attribute, when 'false', causes the Printer to reject jobs even
458    when the 'printer-state' is 'idle' or, when 'true', causes the
459    Printer object to accepts jobs even when the 'printer-state' is
460    'stopped'.
461
462    """
463   
464    def __init__(self, val):
465        super(type(self), self).__init__(
466            'printer-is-accepting-jobs',
467            [Value(IntegerTags.BOOLEAN, val)])
468
469class QueuedJobCount(Attribute):
470    """4.4.24 queued-job-count (integer(0:MAX))
471
472    This REQUIRED Printer attribute contains a count of the number of
473    jobs that are either 'pending', 'processing', 'pending-held', or
474    'processing-stopped' and is set by the Printer object.
475
476    """
477   
478    def __init__(self, val):
479        super(type(self), self).__init__(
480            'queued-job-count',
481            [Value(IntegerTags.INTEGER, val)])
482
483class PrinterMessageFromOperator(Attribute):
484    """4.4.25 printer-message-from-operator (text(127))
485
486    """
487
488    def __init__(self, val):
489        raise ClientErrorAttributes, "printer-message-from-operator"
490
491class ColorSupported(Attribute):
492    """4.4.26 color-supported (boolean)
493
494    """
495
496    def __init__(self, val):
497        raise ClientErrorAttributes, "color-supported"
498
499class ReferenceUriSchemeSupported(Attribute):
500    """4.4.27 reference-uri-schemes-supported (1setOf uriScheme)
501
502    """
503
504    def __init__(self, *vals):
505        raise ClientErrorAttributes, "reference-uri-scheme-supported"
506
507class PdlOverrideSupported(Attribute):
508    """4.4.28 pdl-override-supported (type2 keyword)
509
510    This REQUIRED Printer attribute expresses the ability for a
511    particular Printer implementation to either attempt to override
512    document data instructions with IPP attributes or not.  This
513    attribute takes on the following keyword values:
514
515    - 'attempted': This value indicates that the Printer object
516      attempts to make the IPP attribute values take precedence over
517      embedded instructions in the document data, however there is no
518      guarantee.
519
520    - 'not-attempted': This value indicates that the Printer object
521      makes no attempt to make the IPP attribute values take
522      precedence over embedded instructions in the document data.
523
524    Section 15 contains a full description of how this attribute
525    interacts with and affects other IPP attributes, especially the
526    'ipp-attribute-fidelity' attribute.
527
528    """
529   
530    def __init__(self, val):
531        super(type(self), self).__init__(
532            'pdl-override-supported',
533            [Value(CharacterStringTags.KEYWORD, val)])
534
535class PrinterUpTime(Attribute):
536    """4.4.29 printer-up-time (integer(1:MAX))
537
538    This REQUIRED Printer attribute indicates the amount of time (in
539    seconds) that this Printer instance has been up and running. The
540    value is a monotonically increasing value starting from 1 when the
541    Printer object is started-up (initialized, booted, etc.). This
542    value is used to populate the Event Time Job Description Job
543    attributes 'time-at-creation', 'time-at-processing', and
544    'time-at-completed' (see section 4.3.14).
545
546    If the Printer object goes down at some value 'n', and comes back
547    up, the implementation MAY:
548
549        1. Know how long it has been down, and resume at some value
550           greater than 'n', or
551
552        2. Restart from 1.
553
554    In other words, if the device or devices that the Printer object
555    is representing are restarted or power cycled, the Printer object
556    MAY continue counting this value or MAY reset this value to 1
557    depending on implementation. However, if the Printer object
558    software ceases running, and restarts without knowing the last
559    value for 'printer- up-time', the implementation MUST reset this
560    value to 1. If this value is reset and the Printer has persistent
561    jobs, the Printer MUST reset the 'time-at-xxx(integer) Event Time
562    Job Description attributes according to Section 4.3.14. An
563    implementation MAY use both implementation alternatives, depending
564    on warm versus cold start, respectively.
565
566    """
567   
568    def __init__(self, val):
569        super(type(self), self).__init__(
570            'printer-up-time',
571            [Value(IntegerTags.INTEGER, val)])
572
573class PrinterCurrentTime(Attribute):
574    """4.4.30 printer-current-time (dateTime)
575
576    """
577
578    def __init__(self, val):
579        raise ClientErrorAttributes, "printer-current-time"
580
581class MultipleOperationTimeOut(Attribute):
582    """4.4.31 multiple-operation-time-out (integer(1:MAX))
583
584    This Printer attributes identifies the minimum time (in seconds)
585    that the Printer object waits for additional Send-Document or
586    Send-URI operations to follow a still-open Job object before
587    taking any recovery actions, such as the ones indicated in section
588    3.3.1. If the Printer object supports the Create-Job and
589    Send-Document operations (see section 3.2.4 and 3.3.1), it MUST
590    support this attribute.
591
592    It is RECOMMENDED that vendors supply a value for this attribute
593    that is between 60 and 240 seconds. An implementation MAY allow a
594    system administrator to set this attribute (by means outside this
595    IPP/1.1 document). If so, the system administrator MAY be able to
596    set values outside this range.
597
598    """
599   
600    def __init__(self, val):
601        super(type(self), self).__init__(
602            'multiple-operation-time-out',
603            [Value(IntegerTags.INTEGER, val)])
604
605class CompressionSupported(Attribute):
606    """4.4.32 compression-supported (1setOf type3 keyword)
607
608    This REQUIRED Printer attribute identifies the set of supported
609    compression algorithms for document data. Compression only applies
610    to the document data; compression does not apply to the encoding
611    of the IPP operation itself. The supported values are used to
612    validate the client supplied 'compression' operation attributes in
613    Print-Job, Send-Document, and Send-URI requests.
614
615    Standard keyword values are :
616        'none': no compression is used.
617        'deflate': ZIP public domain inflate/deflate) compression
618            technology in RFC 1951 [RFC1951]
619        'gzip' GNU zip compression technology described in RFC 1952
620            [RFC1952].
621        'compress': UNIX compression technology in RFC 1977 [RFC1977]
622
623    """
624   
625    def __init__(self, *vals):
626        super(type(self), self).__init__(
627            'compression-supported',
628            [Value(CharacterStringTags.KEYWORD, val) for val in vals])
629
630class JobKOctetsSupported(Attribute):
631    """4.4.33 job-k-octets-supported (rangeOfInteger(0:MAX))
632
633    """
634
635    def __init__(self, val):
636        raise ClientErrorAttributes, "job-k-octets-supported"
637
638class JobImpressionsSupported(Attribute):
639    """4.4.34 job-impressions-supported (rangeOfInteger(0:MAX))
640
641    """
642
643    def __init__(self, val):
644        raise ClientErrorAttributes, "job-impressions-supported"
645
646class JobMediaSheetsSupported(Attribute):
647    """4.4.35 job-media-sheets-supported (rangeOfInteger(0:MAX))
648
649    """
650
651    def __init__(self, val):
652        raise ClientErrorAttributes, "job-media-sheets-supported"
653
654class PagesPerMinute(Attribute):
655    """4.4.36 pages-per-minute (integer(0:MAX))
656
657    """
658
659    def __init__(self, val):
660        raise ClientErrorAttributes, "pages-per-minute"
661
662class PagesPerMinuteColor(Attribute):
663    """4.4.37 pages-per-minute-color (integer(0:MAX))
664
665    """
666
667    def __init__(self, val):
668        raise ClientErrorAttributes, "pages-per-minute-color"
669   
Note: See TracBrowser for help on using the repository browser.