Skip to content

Commit

Permalink
Report all supported Job Creation attributes and their values (Issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Jun 18, 2018
1 parent b5443ab commit 91505c0
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 11 deletions.
4 changes: 3 additions & 1 deletion CHANGES.md
@@ -1,4 +1,4 @@
CHANGES - 2.3b6 - 2018-06-12
CHANGES - 2.3b6 - 2018-06-18
============================

Changes in CUPS v2.3b6
Expand All @@ -7,6 +7,8 @@ Changes in CUPS v2.3b6
- Localization update (Issue #5339)
- Fixed a regression in the changes to ippValidateAttribute (Issue #5322,
Issue #5330)
- The scheduler did not report all of the supported job options and values
(Issue #5340)
- Fixed a memory leak for some IPP (extension) syntaxes.


Expand Down
34 changes: 33 additions & 1 deletion cups/encode.c
Expand Up @@ -129,6 +129,9 @@ static const _ipp_option_t ipp_options[] =
cups_schemes },
{ 1, "finishings", IPP_TAG_ENUM, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 1, "finishings-col", IPP_TAG_BEGIN_COLLECTION, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 1, "finishings-col-default", IPP_TAG_BEGIN_COLLECTION, IPP_TAG_PRINTER },
{ 1, "finishings-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
{ 0, "fit-to-page", IPP_TAG_BOOLEAN, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
Expand All @@ -142,6 +145,7 @@ static const _ipp_option_t ipp_options[] =
{ 1, "include-schemes", IPP_TAG_NAME, IPP_TAG_OPERATION,
IPP_TAG_ZERO,
cups_schemes },
{ 0, "ipp-attribute-fidelity", IPP_TAG_BOOLEAN, IPP_TAG_OPERATION },
{ 0, "job-account-id", IPP_TAG_NAME, IPP_TAG_JOB },
{ 0, "job-account-id-default",IPP_TAG_NAME, IPP_TAG_PRINTER },
{ 0, "job-accounting-user-id", IPP_TAG_NAME, IPP_TAG_JOB },
Expand All @@ -150,6 +154,7 @@ static const _ipp_option_t ipp_options[] =
{ 0, "job-cancel-after", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "job-cancel-after-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "job-hold-until", IPP_TAG_KEYWORD, IPP_TAG_JOB },
{ 0, "job-hold-until-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 0, "job-id", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
{ 0, "job-impressions", IPP_TAG_INTEGER, IPP_TAG_OPERATION },
{ 0, "job-impressions-completed", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
Expand All @@ -158,6 +163,8 @@ static const _ipp_option_t ipp_options[] =
{ 0, "job-k-octets-completed",IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
{ 0, "job-media-sheets", IPP_TAG_INTEGER, IPP_TAG_OPERATION },
{ 0, "job-media-sheets-completed", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
{ 0, "job-name", IPP_TAG_NAME, IPP_TAG_OPERATION,
IPP_TAG_JOB },
{ 0, "job-page-limit", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "job-pages", IPP_TAG_INTEGER, IPP_TAG_OPERATION },
{ 0, "job-pages-completed", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
Expand All @@ -168,6 +175,7 @@ static const _ipp_option_t ipp_options[] =
IPP_TAG_ZERO,
ipp_job_creation },
{ 0, "job-priority", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "job-priority-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "job-quota-period", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 1, "job-sheets", IPP_TAG_NAME, IPP_TAG_JOB },
{ 1, "job-sheets-default", IPP_TAG_NAME, IPP_TAG_PRINTER },
Expand Down Expand Up @@ -212,6 +220,9 @@ static const _ipp_option_t ipp_options[] =
IPP_TAG_DOCUMENT },
{ 0, "mirror", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
{ 0, "mirror-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
{ 0, "multiple-document-handling", IPP_TAG_KEYWORD, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "multiple-document-handling-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 0, "natural-scaling", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "natural-scaling-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "notify-charset", IPP_TAG_CHARSET, IPP_TAG_SUBSCRIPTION },
Expand All @@ -227,18 +238,26 @@ static const _ipp_option_t ipp_options[] =
{ 0, "number-up", IPP_TAG_INTEGER, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "number-up-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "number-up-layout", IPP_TAG_KEYWORD, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "number-up-layout-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 0, "orientation-requested", IPP_TAG_ENUM, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "orientation-requested-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
{ 0, "output-bin", IPP_TAG_KEYWORD, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "output-bin-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 1, "overrides", IPP_TAG_BEGIN_COLLECTION, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "page-bottom", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "page-bottom-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "page-delivery", IPP_TAG_KEYWORD, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "page-delivery-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 0, "page-left", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "page-left-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 1, "page-ranges", IPP_TAG_RANGE, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 1, "page-ranges-default", IPP_TAG_RANGE, IPP_TAG_PRINTER },
{ 0, "page-right", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "page-right-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "page-top", IPP_TAG_INTEGER, IPP_TAG_JOB },
Expand Down Expand Up @@ -279,9 +298,21 @@ static const _ipp_option_t ipp_options[] =
{ 0, "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
{ 0, "prettyprint-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
{ 0, "print-color-mode", IPP_TAG_KEYWORD, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "print-color-mode-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 0, "print-content-optimize", IPP_TAG_KEYWORD, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "print-content-optimize-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 0, "print-quality", IPP_TAG_ENUM, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "print-quality-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
{ 0, "print-rendering-intent", IPP_TAG_KEYWORD, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "print-rendering-intent-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 0, "print-scaling", IPP_TAG_KEYWORD, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "print-scaling-default", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 1, "printer-alert", IPP_TAG_STRING, IPP_TAG_PRINTER },
{ 1, "printer-alert-description", IPP_TAG_TEXT, IPP_TAG_PRINTER },
{ 1, "printer-commands", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
Expand All @@ -303,6 +334,7 @@ static const _ipp_option_t ipp_options[] =
{ 1, "printer-output-tray", IPP_TAG_STRING, IPP_TAG_PRINTER },
{ 0, "printer-resolution", IPP_TAG_RESOLUTION, IPP_TAG_JOB,
IPP_TAG_DOCUMENT },
{ 0, "printer-resolution-default", IPP_TAG_RESOLUTION, IPP_TAG_PRINTER },
{ 0, "printer-state", IPP_TAG_ENUM, IPP_TAG_PRINTER },
{ 0, "printer-state-change-time", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 1, "printer-state-reasons", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
Expand Down
21 changes: 18 additions & 3 deletions scheduler/job.c
@@ -1,10 +1,11 @@
/*
* Job management routines for the CUPS scheduler.
*
* Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
* Copyright © 2007-2018 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/

/*
Expand Down Expand Up @@ -3815,6 +3816,20 @@ get_options(cupsd_job_t *job, /* I - Job */
cupsdLogJob(job, CUPSD_LOG_DEBUG2, "After mapping finishings %s=%s", pwgppd->name, pwgppd->value);
}

/*
* Map page-delivery values...
*/

if ((attr = ippFindAttribute(job->attrs, "page-delivery", IPP_TAG_KEYWORD)) != NULL && !ippFindAttribute(job->attrs, "outputorder", IPP_TAG_ZERO))
{
const char *page_delivery = ippGetString(attr, 0, NULL);

if (!strncmp(page_delivery, "same-order", 10))
num_pwgppds = cupsAddOption("OutputOrder", "Normal", num_pwgppds, &pwgppds);
else if (!strncmp(page_delivery, "reverse-order", 13))
num_pwgppds = cupsAddOption("OutputOrder", "Reverse", num_pwgppds, &pwgppds);
}

/*
* Figure out how much room we need...
*/
Expand Down
50 changes: 44 additions & 6 deletions scheduler/printers.c
@@ -1,10 +1,11 @@
/*
* Printer routines for the CUPS scheduler.
*
* Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
* Copyright © 2007-2018 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/

/*
Expand Down Expand Up @@ -148,8 +149,32 @@ cupsdCreateCommonData(void)
struct statfs spoolinfo; /* FS info for spool directory */
double spoolsize; /* FS size */
#endif /* HAVE_STATVFS */
static const int nups[] = /* number-up-supported values */
static const char * const page_delivery[] =
{ /* page-delivery-supported values */
"reverse-order",
"same-order"
};
static const char * const print_scaling[] =
{ /* print-scaling-supported values */
"auto",
"auto-fit",
"fill",
"fit",
"none"
};
static const int number_up[] = /* number-up-supported values */
{ 1, 2, 4, 6, 9, 16 };
static const char * const number_up_layout[] =
{ /* number-up-layout-supported values */
"btlr",
"btrl",
"lrbt",
"lrtb",
"rlbt",
"rltb",
"tblr",
"tbrl"
};
static const int orients[4] =/* orientation-requested-supported values */
{
IPP_PORTRAIT,
Expand Down Expand Up @@ -290,6 +315,7 @@ cupsdCreateCommonData(void)
{ /* job-creation-attributes-supported */
"copies",
"finishings",
"finishings-col",
"ipp-attribute-fidelity",
"job-hold-until",
"job-name",
Expand All @@ -299,11 +325,14 @@ cupsdCreateCommonData(void)
"media-col",
"multiple-document-handling",
"number-up",
"output-bin",
"number-up-layout",
"orientation-requested",
"output-bin",
"page-delivery",
"page-ranges",
"print-color-mode",
"print-quality",
"print-scaling",
"printer-resolution",
"sides"
};
Expand Down Expand Up @@ -601,7 +630,10 @@ cupsdCreateCommonData(void)

/* number-up-supported */
ippAddIntegers(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"number-up-supported", sizeof(nups) / sizeof(nups[0]), nups);
"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,
Expand All @@ -611,6 +643,9 @@ cupsdCreateCommonData(void)
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);

/* page-ranges-supported */
ippAddBoolean(CommonData, IPP_TAG_PRINTER, "page-ranges-supported", 1);

Expand All @@ -628,6 +663,9 @@ cupsdCreateCommonData(void)
ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
"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);

/* printer-get-attributes-supported */
ippAddString(CommonData, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "printer-get-attributes-supported", NULL, "document-format");

Expand Down

0 comments on commit 91505c0

Please sign in to comment.