source: server/lib/gutenbach/ipp/operations.py @ ef8df33

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

Move more ipp-specific code into ipp/operations from server/requests; Fix more bugs

  • Property mode set to 100644
File size: 30.4 KB
Line 
1from .value import Value
2from .attribute import Attribute
3from .attributegroup import AttributeGroup
4from .request import Request
5import constants as consts
6import exceptions as err
7import logging
8
9logger = logging.getLogger(__name__)
10
11def verify_operations(request):
12    """Pretty much all requests have the first attribute group for
13    operation attributes, and these all have 'attributes-charset' and
14    'attributes-natural-language' as the first two attributes.  This
15    method just generically verifies that these attributes are there.
16
17    """
18
19    # XXX: check version
20    if False:
21        raise err.VersionNotSupported(str(request.version))
22
23    # check operation id
24    if False:
25        raise err.OperationNotSupported(str(request.operation_id))
26
27    # check operation attributes tag
28    op_attrs = request.attribute_groups[0]
29    if op_attrs.tag != consts.AttributeTags.OPERATION:
30        raise err.BadRequest(
31            "Attribute group does not have OPERATION tag: 0x%x" % op_attrs.tag)
32
33    # # check compression
34    # if False:
35    #     raise err.CompressionNotSupported
36
37    # # check document format
38    # if False:
39    #     raise err.DocumentFormatNotSupported
40
41    # # check document uri
42    # if False:
43    #     raise err.UriSchemeNotSupported
44
45    # check charset
46    charset_attr = op_attrs.attributes[0]
47    if charset_attr.name != 'attributes-charset':
48        raise err.BadRequest(
49            "Attribute is not attributes-charset: %s" % charset_attr.name)
50    if len(charset_attr.values) != 1:
51        raise err.BadRequest(
52            "Too many values for attributes-charset: %d" % len(charset_attr.values))
53    # check charset value
54    charset_value = charset_attr.values[0]
55    if charset_value.tag != consts.operations_attribute_value_tags['attributes-charset']:
56        raise err.BadRequest(
57            "Wrong tag for charset value: 0x%x" % charset_value.tag)
58    if charset_value.value != 'utf-8':
59        raise err.CharsetNotSupported(str(charset_value.value))
60
61    # check for attributes-natural-language
62    natlang_attr = op_attrs.attributes[1]
63    if natlang_attr.name != 'attributes-natural-language':
64        raise err.BadRequest(
65            "Attribute is not attributes-natural-language: %s" % natlang_attr.name)
66    if len(charset_attr.values) != 1:
67        raise err.BadRequest(
68            "Too many values for attributes-natural-language: %s" % len(natlang_attr.values))
69    # check natural language value
70    natlang_value = natlang_attr.values[0]
71    if natlang_value.tag != consts.operations_attribute_value_tags['attributes-natural-language']:
72        raise err.BadRequest(
73            "Natural language value does not have NATURAL_LANGUAGE tag: 0x%x" % natlang_value.tag)
74    if natlang_value.value != 'en-us':
75        raise err.Attributes(
76            "Invalid natural language value: %s" % natlang_value.value, [natlang_attr])
77
78    return dict([(attr.name, attr.values) for attr in op_attrs.attributes])
79
80def verify_printer_uri(values):
81    if len(values) != 1:
82        raise err.BadRequest(
83            "Requesting printer uri attribute has too many values: %d" % len(values))
84    uri_value = values[0]
85    if uri_value.tag != consts.operations_attribute_value_tags['printer-uri']:
86        raise err.BadRequest(
87            "Bad value tag (expected URI): 0x%x" % uri_value_tag)
88   
89    # actually get the printer name
90    # XXX: hack -- CUPS will strip the port from the request, so
91    # we can't do an exact comparison (also the hostname might be
92    # different, depending on the CNAME or whether it's localhost)
93    uri = uri_value.value.split("/")[-1]
94    return uri
95
96def verify_requesting_username(values):
97    if len(values) != 1:
98        raise err.BadRequest(
99            "Requesting user name attribute has too many values: %d" % len(values))
100    requser_value = values[0]
101    if requser_value.tag != consts.operations_attribute_value_tags['requesting-user-name']:
102        raise err.BadRequest(
103            "Bad value tag (expected NAME_WITHOUT_LANGUAGE): 0x%x" % requser_value.tag)
104   
105    return requser_value.value
106
107def make_empty_response(request):
108    # Operation attributes -- typically the same for any request
109    attributes = [
110        Attribute(
111            'attributes-charset',
112            [Value(consts.operations_attribute_value_tags['attributes-charset'], 'utf-8')]),
113        Attribute(
114            'attributes-natural-language',
115            [Value(consts.operations_attribute_value_tags['attributes-natural-language'],
116                   'en-us')])
117        ]
118    # Put the operation attributes in a group
119    attribute_group = AttributeGroup(
120        consts.AttributeTags.OPERATION,
121        attributes)
122
123    # Set up the default response -- handlers will override these
124    # values if they need to
125    response_kwargs = {}
126    response_kwargs['version']          = request.version
127    response_kwargs['operation_id']     = consts.StatusCodes.OK
128    response_kwargs['request_id']       = request.request_id
129    response_kwargs['attribute_groups'] = [attribute_group]
130    response = Request(**response_kwargs)
131
132    return response
133
134def make_job_attributes(attrs, request, response):
135    ipp_attrs = []
136    for attr, vals in attrs:
137        ipp_vals = [Value(
138            tag=consts.job_attribute_value_tags[attr],
139            value=val) for val in vals]
140        ipp_attrs.append(Attribute(name=attr, values=ipp_vals))
141    response.attribute_groups.append(AttributeGroup(
142        consts.AttributeTags.JOB, ipp_attrs))
143
144def make_printer_attributes(attrs, request, response):
145    ipp_attrs = []
146    for attr, vals in attrs:
147        ipp_vals = [Value(
148            tag=consts.printer_attribute_value_tags[attr],
149            value=val) for val in vals]
150        ipp_attrs.append(Attribute(name=attr, values=ipp_vals))
151    response.attribute_groups.append(AttributeGroup(
152        consts.AttributeTags.PRINTER, ipp_attrs))
153
154#### GET-JOBS
155
156def verify_get_jobs_request(request):
157    """RFC 2911 3.2.6.1 Get-Jobs Request
158
159    The client submits the Get-Jobs request to a Printer object.
160   
161    The following groups of attributes are part of the Get-Jobs
162    Request:
163
164    Group 1: Operation Attributes
165        Natural Language and Character Set:
166            The 'attributes-charset' and
167            'attributes-natural-language' attributes as described
168            in section 3.1.4.1.
169        Target:
170            The 'printer-uri' (uri) operation attribute which is
171            the target for this operation as described in section
172            3.1.5.
173        Requesting User Name:
174            The 'requesting-user-name' (name(MAX)) attribute
175            SHOULD be supplied by the client as described in
176            section 8.3.
177        'limit' (integer(1:MAX)):
178            The client OPTIONALLY supplies this attribute. The
179            Printer object MUST support this attribute. It is an
180            integer value that determines the maximum number of
181            jobs that a client will receive from the Printer even
182            if 'which-jobs' or 'my-jobs' constrain which jobs are
183            returned. The limit is a 'stateless limit' in that if
184            the value supplied by the client is 'N', then only the
185            first 'N' jobs are returned in the Get-Jobs Response.
186            There is no mechanism to allow for the next 'M' jobs
187            after the first 'N' jobs. If the client does not
188            supply this attribute, the Printer object responds
189            with all applicable jobs.
190        'requested-attributes' (1setOf type2 keyword):
191            The client OPTIONALLY supplies this attribute. The
192            Printer object MUST support this attribute. It is a
193            set of Job attribute names and/or attribute groups
194            names in whose values the requester is
195            interested. This set of attributes is returned for
196            each Job object that is returned. The allowed
197            attribute group names are the same as those defined in
198            the Get-Job-Attributes operation in section 3.3.4. If
199            the client does not supply this attribute, the Printer
200            MUST respond as if the client had supplied this
201            attribute with two values: 'job-uri' and 'job-id'.
202        'which-jobs' (type2 keyword):
203            The client OPTIONALLY supplies this attribute. The
204            Printer object MUST support this attribute. It
205            indicates which Job objects MUST be returned by the
206            Printer object. The values for this attribute are:
207             - 'completed': This includes any Job object whose
208               state is 'completed', 'canceled', or 'aborted'.
209             - 'not-completed': This includes any Job object whose
210               state is 'pending', 'processing',
211               'processing-stopped', or 'pending-held'.
212            A Printer object MUST support both values. However, if
213            the implementation does not keep jobs in the
214            'completed', 'canceled', and 'aborted' states, then it
215            returns no jobs when the 'completed' value is
216            supplied.  If a client supplies some other value, the
217            Printer object MUST copy the attribute and the
218            unsupported value to the Unsupported Attributes
219            response group, reject the request, and return the
220            'client-error-attributes-or-values-not-supported'
221            status code.  If the client does not supply this
222            attribute, the Printer object MUST respond as if the
223            client had supplied the attribute with a value of
224            'not-completed'.
225        'my-jobs' (boolean):
226            The client OPTIONALLY supplies this attribute. The
227            Printer object MUST support this attribute. It
228            indicates whether jobs from all users or just the jobs
229            submitted by the requesting user of this request MUST
230            be considered as candidate jobs to be returned by the
231            Printer object. If the client does not supply this
232            attribute, the Printer object MUST respond as if the
233            client had supplied the attribute with a value of
234            'false', i.e., jobs from all users. The means for
235            authenticating the requesting user and matching the
236            jobs is described in section 8.
237
238    """
239
240    out = {}
241
242    # generic operations verification
243    attrs = verify_operations(request)
244
245    # requested printer uri
246    if 'printer-uri' not in attrs:
247        raise err.BadRequest("Missing 'printer-uri' attribute")
248    out['printer-uri'] = verify_printer_uri(attrs['printer-uri'])
249   
250    # requesting username
251    if 'requesting-user-name' not in attrs:
252        logger.warning("Missing 'requesting-user-name' attribute")
253    else:
254        out['requesting-user-name'] = verify_requesting_username(attrs['requesting-user-name'])
255
256    if 'limit' in attrs:
257        out['limit'] = None # XXX
258
259    if 'requested-attributes' in attrs:
260        out['requested-attributes'] = None # XXX
261
262    if 'which-jobs' in attrs:
263        out['which-jobs'] = None # XXX
264
265    if 'my-jobs' in attrs:
266        out['my-jobs'] = None # XXX
267
268    return out
269
270def make_get_jobs_response(jobs, request):
271    """RFC 2911: 3.2.6.2 Get-Jobs Response
272       
273    The Printer object returns all of the Job objects up to the number
274    specified by the 'limit' attribute that match the criteria as
275    defined by the attribute values supplied by the client in the
276    request. It is possible that no Job objects are returned since
277    there may literally be no Job objects at the Printer, or there may
278    be no Job objects that match the criteria supplied by the
279    client. If the client requests any Job attributes at all, there is
280    a set of Job Object Attributes returned for each Job object.
281
282    It is not an error for the Printer to return 0 jobs. If the
283    response returns 0 jobs because there are no jobs matching the
284    criteria, and the request would have returned 1 or more jobs
285    with a status code of 'successful-ok' if there had been jobs
286    matching the criteria, then the status code for 0 jobs MUST be
287    'successful-ok'.
288
289    Group 1: Operation Attributes
290        Status Message:
291            In addition to the REQUIRED status code returned in
292            every response, the response OPTIONALLY includes a
293            'status-message' (text(255)) and/or a
294            'detailed-status-message' (text(MAX)) operation
295            attribute as described in sections 13 and 3.1.6.
296        Natural Language and Character Set:
297            The 'attributes-charset' and
298            'attributes-natural-language' attributes as described
299            in section 3.1.4.2.
300
301    Group 2: Unsupported Attributes
302        See section 3.1.7 for details on returning Unsupported
303        Attributes.  The response NEED NOT contain the
304        'requested-attributes' operation attribute with any
305        supplied values (attribute keywords) that were requested
306        by the client but are not supported by the IPP object.  If
307        the Printer object does return unsupported attributes
308        referenced in the 'requested-attributes' operation
309        attribute and that attribute included group names, such as
310        'all', the unsupported attributes MUST NOT include
311        attributes described in the standard but not supported by
312        the implementation.
313
314    Groups 3 to N: Job Object Attributes
315        The Printer object responds with one set of Job Object
316        Attributes for each returned Job object. The Printer
317        object ignores (does not respond with) any requested
318        attribute or value which is not supported or which is
319        restricted by the security policy in force, including
320        whether the requesting user is the user that submitted the
321        job (job originating user) or not (see section
322        8). However, the Printer object MUST respond with the
323        'unknown' value for any supported attribute (including all
324        REQUIRED attributes) for which the Printer object does not
325        know the value, unless it would violate the security
326        policy. See the description of the 'out-of- band' values
327        in the beginning of Section 4.1.
328
329        Jobs are returned in the following order:
330        - If the client requests all 'completed' Jobs (Jobs in the
331          'completed', 'aborted', or 'canceled' states), then the
332          Jobs are returned newest to oldest (with respect to
333          actual completion time)
334        - If the client requests all 'not-completed' Jobs (Jobs in
335          the 'pending', 'processing', 'pending-held', and
336          'processing- stopped' states), then Jobs are returned in
337          relative chronological order of expected time to
338          complete (based on whatever scheduling algorithm is
339          configured for the Printer object).
340
341    """
342
343    response = make_empty_response(request)
344    # XXX: we need to honor the things that the request actually asks for
345    for job in jobs:
346        make_job_attributes(job, request, response)
347    return response
348
349## GET-PRINTER-ATTRIBUTES
350
351def verify_get_printer_attributes_request(request):
352    """RFC 2911: 3.2.5.1 Get-Printer-Attributes Request
353
354    The following sets of attributes are part of the Get-Printer-
355    Attributes Request:
356
357    Group 1: Operation Attributes
358        Natural Language and Character Set:
359            The 'attributes-charset' and 'attributes-natural-language'
360            attributes as described in section 3.1.4.1.
361        Target:
362            The 'printer-uri' (uri) operation attribute which is the
363            target for this operation as described in section 3.1.5.
364        Requesting User Name:
365            The 'requesting-user-name' (name(MAX)) attribute SHOULD be
366            supplied by the client as described in section 8.3.
367        'requested-attributes' (1setOf keyword):
368            The client OPTIONALLY supplies a set of attribute names
369            and/or attribute group names in whose values the requester
370            is interested. The Printer object MUST support this
371            attribute.  If the client omits this attribute, the
372            Printer MUST respond as if this attribute had been
373            supplied with a value of 'all'.
374        'document-format' (mimeMediaType):
375            The client OPTIONALLY supplies this attribute. The Printer
376            object MUST support this attribute. This attribute is
377            useful for a Printer object to determine the set of
378            supported attribute values that relate to the requested
379            document format.  The Printer object MUST return the
380            attributes and values that it uses to validate a job on a
381            create or Validate-Job operation in which this document
382            format is supplied. The Printer object SHOULD return only
383            (1) those attributes that are supported for the specified
384            format and (2) the attribute values that are supported for
385            the specified document format. By specifying the document
386            format, the client can get the Printer object to eliminate
387            the attributes and values that are not supported for a
388            specific document format. For example, a Printer object
389            might have multiple interpreters to support both
390            'application/postscript' (for PostScript) and 'text/plain'
391            (for text) documents. However, for only one of those
392            interpreters might the Printer object be able to support
393            'number-up' with values of '1', '2', and '4'. For the
394            other interpreter it might be able to only support
395            'number-up' with a value of '1'.  Thus a client can use
396            the Get-Printer-Attributes operation to obtain the
397            attributes and values that will be used to accept/reject a
398            create job operation.
399
400            If the Printer object does not distinguish between
401            different sets of supported values for each different
402            document format when validating jobs in the create and
403            Validate-Job operations, it MUST NOT distinguish between
404            different document formats in the Get-Printer-Attributes
405            operation. If the Printer object does distinguish between
406            different sets of supported values for each different
407            document format specified by the client, this
408            specialization applies only to the following Printer
409            object attributes:
410
411            - Printer attributes that are Job Template attributes
412              ('xxx- default' 'xxx-supported', and 'xxx-ready' in the
413              Table in Section 4.2),
414
415            - 'pdl-override-supported',
416            - 'compression-supported',
417            - 'job-k-octets-supported',
418            - 'job-impressions-supported',
419            - 'job-media-sheets-supported',
420            - 'printer-driver-installer',
421            - 'color-supported', and
422            - 'reference-uri-schemes-supported'
423
424            The values of all other Printer object attributes
425            (including 'document-format-supported') remain invariant
426            with respect to the client supplied document format
427            (except for new Printer description attribute as
428            registered according to section 6.2).
429
430            If the client omits this 'document-format' operation
431            attribute, the Printer object MUST respond as if the
432            attribute had been supplied with the value of the Printer
433            object's 'document-format- default' attribute. It is
434            RECOMMENDED that the client always supply a value for
435            'document-format', since the Printer object's
436            'document-format-default' may be
437            'application/octet-stream', in which case the returned
438            attributes and values are for the union of the document
439            formats that the Printer can automatically sense.  For
440            more details, see the description of the 'mimeMediaType'
441            attribute syntax in section 4.1.9.
442
443            If the client supplies a value for the 'document-format'
444            Operation attribute that is not supported by the Printer,
445            i.e., is not among the values of the Printer object's
446            'document-format-supported' attribute, the Printer object
447            MUST reject the operation and return the
448            'client-error-document-format-not-supported' status code.
449
450    """
451
452    out = {}
453
454    # generic operations verification
455    attrs = verify_operations(request)
456
457    # requested printer uri
458    if 'printer-uri' not in attrs:
459        raise err.BadRequest("Missing 'printer-uri' attribute")
460    out['printer-uri']  = verify_printer_uri(attrs['printer-uri'])
461
462    # requesting username
463    if 'requesting-user-name' not in attrs:
464        logger.warning("Missing 'requesting-user-name' attribute")
465    else:
466        out['requesting-user-name'] = verify_requesting_username(attrs['requesting-user-name'])
467
468    if 'requested-attributes' in attrs:
469        out['requested-attributes'] = None # XXX
470
471    if 'document-format' in attrs:
472        out['document-format'] = None # XXX
473
474    return out
475
476
477def make_get_printer_attributes_response(attrs, request):
478    """3.2.5.2 Get-Printer-Attributes Response
479
480    The Printer object returns the following sets of attributes as
481    part of the Get-Printer-Attributes Response:
482
483    Group 1: Operation Attributes
484        Status Message:
485            In addition to the REQUIRED status code returned in every
486            response, the response OPTIONALLY includes a
487            'status-message' (text(255)) and/or a
488            'detailed-status-message' (text(MAX)) operation attribute
489            as described in sections 13 and 3.1.6.
490        Natural Language and Character Set:
491            The 'attributes-charset' and 'attributes-natural-language'
492            attributes as described in section 3.1.4.2.
493
494    Group 2: Unsupported Attributes
495        See section 3.1.7 for details on returning Unsupported
496        Attributes.  The response NEED NOT contain the
497        'requested-attributes' operation attribute with any supplied
498        values (attribute keywords) that were requested by the client
499        but are not supported by the IPP object.  If the Printer
500        object does return unsupported attributes referenced in the
501        'requested-attributes' operation attribute and that attribute
502        included group names, such as 'all', the unsupported
503        attributes MUST NOT include attributes described in the
504        standard but not supported by the implementation.
505
506    Group 3: Printer Object Attributes
507        This is the set of requested attributes and their current
508        values.  The Printer object ignores (does not respond with)
509        any requested attribute which is not supported. The Printer
510        object MAY respond with a subset of the supported attributes
511        and values, depending on the security policy in
512        force. However, the Printer object MUST respond with the
513        'unknown' value for any supported attribute (including all
514        REQUIRED attributes) for which the Printer object does not
515        know the value. Also the Printer object MUST respond with the
516        'no-value' for any supported attribute (including all REQUIRED
517        attributes) for which the system administrator has not
518        configured a value. See the description of the 'out-of-band'
519        values in the beginning of Section 4.1.
520
521    """
522
523    response = make_empty_response(request)
524    make_printer_attributes(attrs, request, response)
525    return response
526
527
528def verify_cups_get_default_request(request):
529    """CUPS-Get-Default Request
530   
531    The following groups of attributes are supplied as part of the
532    CUPS-Get-Default request:
533
534    Group 1: Operation Attributes
535        Natural Language and Character Set:
536            The 'attributes-charset' and
537            'attributes-natural-language' attributes as described
538            in section 3.1.4.1 of the IPP Model and Semantics
539            document.
540        'requested-attributes' (1setOf keyword):
541            The client OPTIONALLY supplies a set of attribute
542            names and/or attribute group names in whose values the
543            requester is interested. If the client omits this
544            attribute, the server responds as if this attribute
545            had been supplied with a value of 'all'.
546
547    (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_DEFAULT )
548
549    """
550
551    return {}
552
553def make_cups_get_default_response(attrs, request):
554    """CUPS-Get-Default Response
555
556    The following groups of attributes are send as part of the
557    CUPS-Get-Default Response:
558
559    Group 1: Operation Attributes
560        Status Message:
561            The standard response status message.
562        Natural Language and Character Set:
563            The 'attributes-charset' and
564            'attributes-natural-language' attributes as described
565            in section 3.1.4.2 of the IPP Model and Semantics
566            document.
567
568    Group 2: Printer Object Attributes
569        The set of requested attributes and their current values.
570
571    (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_DEFAULT )
572
573    """
574
575    response = make_empty_response(request)
576    make_printer_attributes(attrs, request, response)
577    return response
578
579def verify_cups_get_printers_request(request):
580    """CUPS-Get-Printers Request
581   
582    The following groups of attributes are supplied as part of the
583    CUPS-Get-Printers request:
584
585    Group 1: Operation Attributes
586        Natural Language and Character Set:
587            The 'attributes-charset' and
588            'attributes-natural-language' attributes as described
589            in section 3.1.4.1 of the IPP Model and Semantics
590            document.
591        'first-printer-name' (name(127)):CUPS 1.2/Mac OS X 10.5
592            The client OPTIONALLY supplies this attribute to
593            select the first printer that is returned.
594        'limit' (integer (1:MAX)):
595            The client OPTIONALLY supplies this attribute limiting
596            the number of printers that are returned.
597        'printer-location' (text(127)): CUPS 1.1.7
598            The client OPTIONALLY supplies this attribute to
599            select which printers are returned.
600        'printer-type' (type2 enum): CUPS 1.1.7
601            The client OPTIONALLY supplies a printer type
602            enumeration to select which printers are returned.
603        'printer-type-mask' (type2 enum): CUPS 1.1.7
604            The client OPTIONALLY supplies a printer type mask
605            enumeration to select which bits are used in the
606            'printer-type' attribute.
607        'requested-attributes' (1setOf keyword) :
608            The client OPTIONALLY supplies a set of attribute
609            names and/or attribute group names in whose values the
610            requester is interested. If the client omits this
611            attribute, the server responds as if this attribute
612            had been supplied with a value of 'all'.
613        'requested-user-name' (name(127)) : CUPS 1.2/Mac OS X 10.5
614            The client OPTIONALLY supplies a user name that is
615            used to filter the returned printers.
616
617    (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_PRINTERS )
618
619    """
620
621    return {}
622
623def make_cups_get_printers_response(printers, request):
624    """CUPS-Get-Printers Response
625
626    The following groups of attributes are send as part of the
627    CUPS-Get-Printers Response:
628
629    Group 1: Operation Attributes
630        Status Message:
631            The standard response status message.
632        Natural Language and Character Set:
633            The 'attributes-charset' and
634            'attributes-natural-language' attributes as described
635            in section 3.1.4.2 of the IPP Model and Semantics
636            document.
637           
638    Group 2: Printer Object Attributes
639        The set of requested attributes and their current values
640        for each printer.
641
642    (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_PRINTERS )
643
644    """
645
646    response = make_empty_response(request)
647    for printer in printers:
648        make_printer_attributes(printer, request, response)
649    return response
650
651def verify_cups_get_classes_request(request):
652    """CUPS-Get-Classes Request
653
654    The following groups of attributes are supplied as part of the
655    CUPS-Get-Classes request:
656
657    Group 1: Operation Attributes
658        Natural Language and Character Set:
659            The 'attributes-charset' and
660            'attributes-natural-language' attributes as described
661            in section 3.1.4.1 of the IPP Model and Semantics
662            document.
663        'first-printer-name' (name(127)):CUPS 1.2/Mac OS X 10.5
664            The client OPTIONALLY supplies this attribute to
665            select the first printer that is returned.
666        'limit' (integer (1:MAX)):
667            The client OPTIONALLY supplies this attribute limiting
668            the number of printer classes that are returned.
669        'printer-location' (text(127)): CUPS 1.1.7
670            The client OPTIONALLY supplies this attribute to
671            select which printer classes are returned.
672        'printer-type' (type2 enum): CUPS 1.1.7
673            The client OPTIONALLY supplies a printer type
674            enumeration to select which printer classes are
675            returned.
676        'printer-type-mask' (type2 enum): CUPS 1.1.7
677            The client OPTIONALLY supplies a printer type mask
678            enumeration to select which bits are used in the
679            'printer-type' attribute.
680        'requested-attributes' (1setOf keyword) :
681            The client OPTIONALLY supplies a set of attribute
682            names and/or attribute group names in whose values the
683            requester is interested. If the client omits this
684            attribute, the server responds as if this attribute
685            had been supplied with a value of 'all'.
686        'requested-user-name' (name(127)) : CUPS 1.2/Mac OS X 10.5
687            The client OPTIONALLY supplies a user name that is
688            used to filter the returned printers.
689
690    (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_CLASSES )
691
692    """
693
694    return {}
695
696def make_cups_get_classes_response(request):
697    """CUPS-Get-Classes Response
698
699    The following groups of attributes are send as part of the
700    CUPS-Get-Classes Response:
701
702    Group 1: Operation Attributes
703        Status Message:
704            The standard response status message.
705        Natural Language and Character Set:
706            The 'attributes-charset' and
707            'attributes-natural-language' attributes as described
708            in section 3.1.4.2 of the IPP Model and Semantics
709            document.
710
711    Group 2: Printer Class Object Attributes
712        The set of requested attributes and their current values
713        for each printer class.
714
715    (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_CLASSES )
716
717    """
718
719    response = make_empty_response(request)
720    return response
Note: See TracBrowser for help on using the repository browser.