From ce89b4dedcbbdfabf76d716629bb694bac7cee9c Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 21 Sep 2022 13:25:46 -0400 Subject: [PATCH] Add IPP FaxOut attributes and values for fax queues (Issue #459) --- CHANGES.md | 3 +- scheduler/printers.c | 398 +++++++++++++++++++++++-------------------- 2 files changed, 212 insertions(+), 189 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 89c2683291..f464d1aa3c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,7 +18,8 @@ Changes in CUPS v2.4.3 (TBA) - Fixed memory leaks in `create_local_bg_thread()` (Issue #466) - Fixed TLS certificate generation bugs. - Ignore some of IPP defaults if the application sends its PPD alternative (Issue #484) -- Look for default printer on network if needed (Issue ##452) +- Now look for default printer on network if needed (Issue #452) +- Now report fax attributes and values as needed (Issue #459) - Now localize HTTP responses using the Content-Language value (Issue #426) - Raised file size limit for importing PPD via Web UI (Issue #433) - Update print-color-mode if the printer is modified via ColorModel PPD option (Issue #451) diff --git a/scheduler/printers.c b/scheduler/printers.c index 11dd4b8e1b..3ca91fd455 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -198,10 +198,6 @@ cupsdCreateCommonData(void) "third-shift", "weekend" }; - static const char * const features[] =/* ipp-features-supported values */ - { - "subscription-object" - }; static const char * const versions[] =/* ipp-versions-supported values */ { "1.0", @@ -316,31 +312,6 @@ cupsdCreateCommonData(void) "server-started", "server-stopped" }; - static const char * const job_creation[] = - { /* job-creation-attributes-supported */ - "copies", - "finishings", - "finishings-col", - "ipp-attribute-fidelity", - "job-hold-until", - "job-name", - "job-priority", - "job-sheets", - "media", - "media-col", - "multiple-document-handling", - "number-up", - "number-up-layout", - "orientation-requested", - "output-bin", - "page-delivery", - "page-ranges", - "print-color-mode", - "print-quality", - "print-scaling", - "printer-resolution", - "sides" - }; static const char * const job_settable[] = { /* job-settable-attributes-supported */ "copies", @@ -408,8 +379,7 @@ cupsdCreateCommonData(void) #ifdef HAVE_STATVFS if (statvfs(RequestRoot, &spoolinfo)) k_supported = INT_MAX; - else if ((spoolsize = (double)spoolinfo.f_frsize * spoolinfo.f_blocks / 1024) > - INT_MAX) + else if ((spoolsize = (double)spoolinfo.f_frsize * spoolinfo.f_blocks / 1024) > INT_MAX) k_supported = INT_MAX; else k_supported = (int)spoolsize; @@ -417,8 +387,7 @@ cupsdCreateCommonData(void) #elif defined(HAVE_STATFS) if (statfs(RequestRoot, &spoolinfo)) k_supported = INT_MAX; - else if ((spoolsize = (double)spoolinfo.f_bsize * spoolinfo.f_blocks / 1024) > - INT_MAX) + else if ((spoolsize = (double)spoolinfo.f_bsize * spoolinfo.f_blocks / 1024) > INT_MAX) k_supported = INT_MAX; else k_supported = (int)spoolsize; @@ -433,74 +402,43 @@ cupsdCreateCommonData(void) */ /* charset-configured */ - ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_CHARSET | IPP_TAG_COPY, - "charset-configured", NULL, "utf-8"); + ippAddString(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_CHARSET), "charset-configured", NULL, "utf-8"); /* charset-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_CHARSET | IPP_TAG_COPY, - "charset-supported", sizeof(charsets) / sizeof(charsets[0]), - NULL, charsets); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_CHARSET), "charset-supported", sizeof(charsets) / sizeof(charsets[0]), NULL, charsets); /* compression-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "compression-supported", - sizeof(compressions) / sizeof(compressions[0]), - NULL, compressions); - - /* copies-supported */ - ippAddRange(CommonData, IPP_TAG_PRINTER, "copies-supported", 1, MaxCopies); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "compression-supported", sizeof(compressions) / sizeof(compressions[0]), NULL, compressions); /* cups-version */ - ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_TEXT | IPP_TAG_COPY, - "cups-version", NULL, &CUPS_SVERSION[6]); - - /* generated-natural-language-supported (no IPP_TAG_COPY) */ - ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE, - "generated-natural-language-supported", NULL, DefaultLanguage); + ippAddString(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_TEXT), "cups-version", NULL, &CUPS_SVERSION[6]); - /* ipp-features-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "ipp-features-supported", sizeof(features) / sizeof(features[0]), NULL, features); + /* generated-natural-language-supported (not const) */ + ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE, "generated-natural-language-supported", NULL, DefaultLanguage); /* ipp-versions-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "ipp-versions-supported", sizeof(versions) / sizeof(versions[0]), - NULL, versions); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "ipp-versions-supported", sizeof(versions) / sizeof(versions[0]), NULL, versions); /* ippget-event-life */ - ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER, - "ippget-event-life", 15); + ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "ippget-event-life", 15); /* job-cancel-after-supported */ - ippAddRange(CommonData, IPP_TAG_PRINTER, "job-cancel-after-supported", - 0, INT_MAX); - - /* job-creation-attributes-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "job-creation-attributes-supported", - sizeof(job_creation) / sizeof(job_creation[0]), - NULL, job_creation); + ippAddRange(CommonData, IPP_TAG_PRINTER, "job-cancel-after-supported", 0, INT_MAX); /* job-hold-until-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "job-hold-until-supported", sizeof(holds) / sizeof(holds[0]), - NULL, holds); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "job-hold-until-supported", sizeof(holds) / sizeof(holds[0]), NULL, holds); /* job-ids-supported */ ippAddBoolean(CommonData, IPP_TAG_PRINTER, "job-ids-supported", 1); /* job-k-octets-supported */ - ippAddRange(CommonData, IPP_TAG_PRINTER, "job-k-octets-supported", 0, - k_supported); + ippAddRange(CommonData, IPP_TAG_PRINTER, "job-k-octets-supported", 0, k_supported); /* job-priority-supported */ - ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER, - "job-priority-supported", 100); + ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "job-priority-supported", 100); /* job-settable-attributes-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "job-settable-attributes-supported", - sizeof(job_settable) / sizeof(job_settable[0]), - NULL, job_settable); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "job-settable-attributes-supported", sizeof(job_settable) / sizeof(job_settable[0]), NULL, job_settable); /* job-sheets-supported */ if (cupsArrayCount(Banners) > 0) @@ -510,101 +448,70 @@ cupsdCreateCommonData(void) */ if (Classification && !ClassifyOverride) - attr = ippAddString(CommonData, IPP_TAG_PRINTER, - IPP_TAG_NAME | IPP_TAG_COPY, - "job-sheets-supported", NULL, Classification); + attr = ippAddString(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_NAME), "job-sheets-supported", NULL, Classification); else - attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, - IPP_TAG_NAME | IPP_TAG_COPY, - "job-sheets-supported", cupsArrayCount(Banners) + 1, - NULL, NULL); + attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_NAME), "job-sheets-supported", cupsArrayCount(Banners) + 1, NULL, NULL); if (attr == NULL) - cupsdLogMessage(CUPSD_LOG_EMERG, - "Unable to allocate memory for " - "job-sheets-supported attribute: %s!", strerror(errno)); + { + cupsdLogMessage(CUPSD_LOG_EMERG, "Unable to allocate memory for job-sheets-supported attribute: %s!", strerror(errno)); + } else if (!Classification || ClassifyOverride) { cupsd_banner_t *banner; /* Current banner */ - attr->values[0].string.text = _cupsStrAlloc("none"); - for (i = 1, banner = (cupsd_banner_t *)cupsArrayFirst(Banners); - banner; - i ++, banner = (cupsd_banner_t *)cupsArrayNext(Banners)) + for (i = 1, banner = (cupsd_banner_t *)cupsArrayFirst(Banners); banner; i ++, banner = (cupsd_banner_t *)cupsArrayNext(Banners)) attr->values[i].string.text = banner->name; } } else - ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_NAME | IPP_TAG_COPY, - "job-sheets-supported", NULL, "none"); + { + ippAddString(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_NAME), "job-sheets-supported", NULL, "none"); + } /* jpeg-k-octets-supported */ - ippAddRange(CommonData, IPP_TAG_PRINTER, "jpeg-k-octets-supported", 0, - k_supported); + ippAddRange(CommonData, IPP_TAG_PRINTER, "jpeg-k-octets-supported", 0, k_supported); /* jpeg-x-dimension-supported */ - ippAddRange(CommonData, IPP_TAG_PRINTER, "jpeg-x-dimension-supported", 0, - 65535); + ippAddRange(CommonData, IPP_TAG_PRINTER, "jpeg-x-dimension-supported", 0, 65535); /* jpeg-y-dimension-supported */ - ippAddRange(CommonData, IPP_TAG_PRINTER, "jpeg-y-dimension-supported", 1, - 65535); + ippAddRange(CommonData, IPP_TAG_PRINTER, "jpeg-y-dimension-supported", 1, 65535); /* media-col-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "media-col-supported", - sizeof(media_col_supported) / - sizeof(media_col_supported[0]), NULL, - media_col_supported); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "media-col-supported", sizeof(media_col_supported) / sizeof(media_col_supported[0]), NULL, media_col_supported); /* multiple-document-handling-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "multiple-document-handling-supported", - sizeof(multiple_document_handling) / - sizeof(multiple_document_handling[0]), NULL, - multiple_document_handling); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "multiple-document-handling-supported", sizeof(multiple_document_handling) / sizeof(multiple_document_handling[0]), NULL, multiple_document_handling); /* multiple-document-jobs-supported */ - ippAddBoolean(CommonData, IPP_TAG_PRINTER, - "multiple-document-jobs-supported", 1); + ippAddBoolean(CommonData, IPP_TAG_PRINTER, "multiple-document-jobs-supported", 1); /* multiple-operation-time-out */ - ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER, - "multiple-operation-time-out", MultipleOperationTimeout); + ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "multiple-operation-time-out", MultipleOperationTimeout); /* multiple-operation-time-out-action */ ippAddString(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "multiple-operation-time-out-action", NULL, "process-job"); - /* natural-language-configured (no IPP_TAG_COPY) */ - ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE, - "natural-language-configured", NULL, DefaultLanguage); + /* natural-language-configured (not const) */ + ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE, "natural-language-configured", NULL, DefaultLanguage); /* notify-attributes-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "notify-attributes-supported", - (int)(sizeof(notify_attrs) / sizeof(notify_attrs[0])), - NULL, notify_attrs); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "notify-attributes-supported", (int)(sizeof(notify_attrs) / sizeof(notify_attrs[0])), NULL, notify_attrs); /* notify-lease-duration-supported */ - ippAddRange(CommonData, IPP_TAG_PRINTER, - "notify-lease-duration-supported", 0, - MaxLeaseDuration ? MaxLeaseDuration : 2147483647); + ippAddRange(CommonData, IPP_TAG_PRINTER, "notify-lease-duration-supported", 0, MaxLeaseDuration ? MaxLeaseDuration : 2147483647); /* notify-max-events-supported */ - ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER, - "notify-max-events-supported", MaxEvents); + ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "notify-max-events-supported", MaxEvents); /* notify-events-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "notify-events-supported", - (int)(sizeof(notify_events) / sizeof(notify_events[0])), - NULL, notify_events); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "notify-events-supported", (int)(sizeof(notify_events) / sizeof(notify_events[0])), NULL, notify_events); /* notify-pull-method-supported */ - ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "notify-pull-method-supported", NULL, "ippget"); + ippAddString(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "notify-pull-method-supported", NULL, "ippget"); /* notify-schemes-supported */ snprintf(filename, sizeof(filename), "%s/notifier", ServerBin); @@ -613,19 +520,16 @@ cupsdCreateCommonData(void) notifiers = cupsArrayNew((cups_array_func_t)strcmp, NULL); while ((dent = cupsDirRead(dir)) != NULL) - if (S_ISREG(dent->fileinfo.st_mode) && - (dent->fileinfo.st_mode & S_IXOTH) != 0) + { + if (S_ISREG(dent->fileinfo.st_mode) && (dent->fileinfo.st_mode & S_IXOTH) != 0) cupsArrayAdd(notifiers, _cupsStrAlloc(dent->filename)); + } if (cupsArrayCount(notifiers) > 0) { - attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, - "notify-schemes-supported", - cupsArrayCount(notifiers), NULL, NULL); + attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "notify-schemes-supported", cupsArrayCount(notifiers), NULL, NULL); - for (i = 0, notifier = (char *)cupsArrayFirst(notifiers); - notifier; - i ++, notifier = (char *)cupsArrayNext(notifiers)) + for (i = 0, notifier = (char *)cupsArrayFirst(notifiers); notifier; i ++, notifier = (char *)cupsArrayNext(notifiers)) attr->values[i].string.text = notifier; } @@ -634,19 +538,16 @@ cupsdCreateCommonData(void) } /* number-up-supported */ - ippAddIntegers(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER, - "number-up-supported", sizeof(number_up) / sizeof(number_up[0]), number_up); + ippAddIntegers(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "number-up-supported", sizeof(number_up) / sizeof(number_up[0]), number_up); /* number-up-layout-supported */ ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "number-up-layout-supported", sizeof(number_up_layout) / sizeof(number_up_layout[0]), NULL, number_up_layout); /* operations-supported */ - ippAddIntegers(CommonData, IPP_TAG_PRINTER, IPP_TAG_ENUM, - "operations-supported", sizeof(ops) / sizeof(ops[0]), ops); + ippAddIntegers(CommonData, IPP_TAG_PRINTER, IPP_TAG_ENUM, "operations-supported", sizeof(ops) / sizeof(ops[0]), ops); /* orientation-requested-supported */ - ippAddIntegers(CommonData, IPP_TAG_PRINTER, IPP_TAG_ENUM, - "orientation-requested-supported", 4, orients); + ippAddIntegers(CommonData, IPP_TAG_PRINTER, IPP_TAG_ENUM, "orientation-requested-supported", 4, orients); /* page-delivery-supported */ ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "page-delivery-supported", sizeof(page_delivery) / sizeof(page_delivery[0]), NULL, page_delivery); @@ -655,18 +556,13 @@ cupsdCreateCommonData(void) ippAddBoolean(CommonData, IPP_TAG_PRINTER, "page-ranges-supported", 1); /* pdf-k-octets-supported */ - ippAddRange(CommonData, IPP_TAG_PRINTER, "pdf-k-octets-supported", 0, - k_supported); + ippAddRange(CommonData, IPP_TAG_PRINTER, "pdf-k-octets-supported", 0, k_supported); /* pdf-versions-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "pdf-versions-supported", - sizeof(pdf_versions) / sizeof(pdf_versions[0]), NULL, - pdf_versions); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "pdf-versions-supported", sizeof(pdf_versions) / sizeof(pdf_versions[0]), NULL, pdf_versions); /* pdl-override-supported */ - ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "pdl-override-supported", NULL, "attempted"); + ippAddString(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "pdl-override-supported", NULL, "attempted"); /* print-scaling-supported */ ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "print-scaling-supported", sizeof(print_scaling) / sizeof(print_scaling[0]), NULL, print_scaling); @@ -675,28 +571,18 @@ cupsdCreateCommonData(void) ippAddString(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "printer-get-attributes-supported", NULL, "document-format"); /* printer-op-policy-supported */ - attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_NAME | IPP_TAG_COPY, - "printer-op-policy-supported", cupsArrayCount(Policies), - NULL, NULL); - for (i = 0, p = (cupsd_policy_t *)cupsArrayFirst(Policies); - p; - i ++, p = (cupsd_policy_t *)cupsArrayNext(Policies)) + attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_NAME), "printer-op-policy-supported", cupsArrayCount(Policies), NULL, NULL); + for (i = 0, p = (cupsd_policy_t *)cupsArrayFirst(Policies); p; i ++, p = (cupsd_policy_t *)cupsArrayNext(Policies)) attr->values[i].string.text = p->name; /* printer-settable-attributes-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "printer-settable-attributes-supported", - sizeof(printer_settable) / sizeof(printer_settable[0]), - NULL, printer_settable); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "printer-settable-attributes-supported", sizeof(printer_settable) / sizeof(printer_settable[0]), NULL, printer_settable); /* server-is-sharing-printers */ - ippAddBoolean(CommonData, IPP_TAG_PRINTER, "server-is-sharing-printers", - BrowseLocalProtocols != 0 && Browsing); + ippAddBoolean(CommonData, IPP_TAG_PRINTER, "server-is-sharing-printers", BrowseLocalProtocols != 0 && Browsing); /* which-jobs-supported */ - ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY, - "which-jobs-supported", - sizeof(which_jobs) / sizeof(which_jobs[0]), NULL, which_jobs); + ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "which-jobs-supported", sizeof(which_jobs) / sizeof(which_jobs[0]), NULL, which_jobs); } @@ -3661,9 +3547,7 @@ add_printer_formats(cupsd_printer_t *p) /* I - Printer */ if (p->raw) { - ippAddStrings(p->attrs, IPP_TAG_PRINTER, - (ipp_tag_t)(IPP_TAG_MIMETYPE | IPP_TAG_COPY), - "document-format-supported", NumMimeTypes, NULL, MimeTypes); + ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_MIMETYPE), "document-format-supported", NumMimeTypes, NULL, MimeTypes); return; } @@ -3928,24 +3812,92 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ urf_fn[64], /* FN (finishings) value */ urf_pq[32], /* PQ (print-quality) value */ urf_rs[32]; /* RS (resolution) value */ + static const char * const cover_sheet_info[] = + { /* cover-sheet-info-supported values */ + "from-name", + "subject", + "to-name" + }; + static const char * const features_print[] = + { /* ipp-features-supported values */ + "ipp-everywhere", + "ipp-everywhere-server", + "subscription-object" + }; + static const char * const features_faxout[] = + { /* ipp-features-supported values */ + "faxout", + "subscription-object" + }; + static const char * const job_creation_print[] = + { /* job-creation-attributes-supported */ + "copies", + "finishings", + "finishings-col", + "ipp-attribute-fidelity", + "job-hold-until", + "job-name", + "job-priority", + "job-sheets", + "media", + "media-col", + "multiple-document-handling", + "number-up", + "number-up-layout", + "orientation-requested", + "output-bin", + "page-delivery", + "page-ranges", + "print-color-mode", + "print-quality", + "print-scaling", + "printer-resolution", + "sides" + }; + static const char * const job_creation_faxout[] = + { /* job-creation-attributes-supported */ + "confirmation-sheet-print", + "copies", + "cover-sheet-info", + "destination-uris", + "ipp-attribute-fidelity", + "job-hold-until", + "job-name", + "job-priority", + "job-sheets", + "media", + "media-col", + "multiple-document-handling", + "number-of-retries", + "number-up", + "number-up-layout", + "orientation-requested", + "page-ranges", + "print-color-mode", + "print-quality", + "print-scaling", + "printer-resolution", + "retry-interval", + "retry-time-out" + }; static const char * const pwg_raster_document_types[] = - { - "black_1", - "sgray_8", - "srgb_8" - }; + { /* pwg-raster-document-type-supported values */ + "black_1", + "sgray_8", + "srgb_8" + }; static const char * const sides[3] = /* sides-supported values */ - { - "one-sided", - "two-sided-long-edge", - "two-sided-short-edge" - }; + { + "one-sided", + "two-sided-long-edge", + "two-sided-short-edge" + }; static const char * const standard_commands[] = - { /* Standard CUPS commands */ - "AutoConfigure", - "Clean", - "PrintSelfTestPage" - }; + { /* Standard CUPS commands */ + "AutoConfigure", + "Clean", + "PrintSelfTestPage" + }; /* @@ -4004,6 +3956,77 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ p->ppd_attrs = ippNew(); + if (p->type & CUPS_PRINTER_FAX) + { + /* confirmation-sheet-print-default */ + ippAddBoolean(p->ppd_attrs, IPP_TAG_PRINTER, "confirmation-sheet-default", 0); + + /* copies-supported */ + ippAddRange(p->ppd_attrs, IPP_TAG_PRINTER, "copies-supported", 1, 1); + + /* cover-sheet-info-default */ + ippAddOutOfBand(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_NOVALUE, "cover-sheet-info-default"); + + /* cover-sheet-info-supported */ + ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "cover-sheet-info-supported", sizeof(cover_sheet_info) / sizeof(cover_sheet_info[0]), NULL, cover_sheet_info); + + /* destination-uri-schemes-supported */ + ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_URISCHEME), "destination-uri-schemes-supported", NULL, "tel"); + + /* destination-uri-supported */ + ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "destination-uri-supported", NULL, "destination-uri"); + + /* from-name-supported */ + ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "from-name-supported", 1023); + + /* ipp-features-supported */ + ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "ipp-features-supported", sizeof(features_faxout) / sizeof(features_faxout[0]), NULL, features_faxout); + + /* job-creation-attributes-supported */ + ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "job-creation-attributes-supported", sizeof(job_creation_faxout) / sizeof(job_creation_faxout[0]), NULL, job_creation_faxout); + + /* message-supported */ + ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "message-supported", 1023); + + /* multiple-destination-uris-supported */ + ippAddBoolean(p->ppd_attrs, IPP_TAG_PRINTER, "multiple-destination-uris-supported", 0); + + /* number-of-retries-default */ + ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "number-of-retries-default", 3); + + /* number-of-retries-supported */ + ippAddRange(p->ppd_attrs, IPP_TAG_PRINTER, "number-of-retries-supported", 0, 99); + + /* retry-interval-default */ + ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "retry-interval-default", 60); + + /* retry-interval-supported */ + ippAddRange(p->ppd_attrs, IPP_TAG_PRINTER, "retry-interval-supported", 30, 300); + + /* retry-time-out-default */ + ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "retry-time-out-default", 60); + + /* retry-time-out-supported */ + ippAddRange(p->ppd_attrs, IPP_TAG_PRINTER, "retry-time-out-supported", 30, 300); + + /* subject-supported */ + ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "subject-supported", 1023); + + /* to-name-supported */ + ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "to-name-supported", 1023); + } + else + { + /* copies-supported */ + ippAddRange(p->ppd_attrs, IPP_TAG_PRINTER, "copies-supported", 1, MaxCopies); + + /* ipp-features-supported */ + ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "ipp-features-supported", sizeof(features_print) / sizeof(features_print[0]), NULL, features_print); + + /* job-creation-attributes-supported */ + ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "job-creation-attributes-supported", sizeof(job_creation_print) / sizeof(job_creation_print[0]), NULL, job_creation_print); + } + if ((ppd = _ppdOpenFile(ppd_name, _PPD_LOCALIZATION_NONE)) != NULL) { /* @@ -4013,8 +4036,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ p->pc = _ppdCacheCreateWithPPD(ppd); if (!p->pc) - cupsdLogMessage(CUPSD_LOG_WARN, "Unable to create cache of \"%s\": %s", - ppd_name, cupsLastErrorString()); + cupsdLogMessage(CUPSD_LOG_WARN, "Unable to create cache of \"%s\": %s", ppd_name, cupsLastErrorString()); ppdMarkDefaults(ppd); -- 2.47.2