/*
- * "$Id$"
+ * Internet Printing Protocol support functions for CUPS.
*
- * Internet Printing Protocol support functions for CUPS.
+ * Copyright 2007-2017 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
- * Copyright 2007-2013 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- * ippAttributeString() - Convert the attribute's value to a string.
- * ippCreateRequestedArray() - Create a CUPS array of attribute names from
- * the given requested-attributes attribute.
- * ippEnumString() - Return a string corresponding to the enum
- * value.
- * ippEnumValue() - Return the value associated with a given enum
- * string.
- * ippErrorString() - Return a name for the given status code.
- * ippErrorValue() - Return a status code for the given name.
- * ippOpString() - Return a name for the given operation id.
- * ippOpValue() - Return an operation id for the given name.
- * ippPort() - Return the default IPP port number.
- * ippSetPort() - Set the default port number.
- * ippTagString() - Return the tag name corresponding to a tag
- * value.
- * ippTagValue() - Return the tag value corresponding to a tag
- * name.
- * ipp_col_string() - Convert a collection to a string.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
*/
/*
* Local globals...
*/
+static const char * const ipp_states[] =
+ {
+ "IPP_STATE_ERROR",
+ "IPP_STATE_IDLE",
+ "IPP_STATE_HEADER",
+ "IPP_STATE_ATTRIBUTE",
+ "IPP_STATE_DATA"
+ };
static const char * const ipp_status_oks[] = /* "OK" status codes */
{ /* (name) = abandoned standard value */
"successful-ok",
"client-error-document-password-error",
"client-error-document-permission-error",
"client-error-document-security-error",
- "client-error-document-unprintable-error"
+ "client-error-document-unprintable-error",
+ "client-error-account-info-needed",
+ "client-error-account-closed",
+ "client-error-account-limit-reached",
+ "client-error-account-authorization-failed",
+ "client-error-not-fetchable"
},
* const ipp_status_480s[] = /* Vendor client errors */
{
"Set-Printer-Attributes",
"Set-Job-Attributes",
"Get-Printer-Supported-Values",
- "Create-Printer-Subscription",
- "Create-Job-Subscription",
+ "Create-Printer-Subscriptions",
+ "Create-Job-Subscriptions",
"Get-Subscription-Attributes",
"Get-Subscriptions",
"Renew-Subscription",
"Suspend-Current-Job",
"Resume-Job",
- /* 0x0030 - 0x003e */
+ /* 0x0030 - 0x003f */
"Promote-Job",
"Schedule-Job-After",
"0x0032",
"Close-Job",
"Identify-Printer",
"Validate-Document",
- "Send-Hardcopy-Document"
+ "Add-Document-Images",
+ "Acknowledge-Document",
+
+ /* 0x0040 - 0x004f */
+ "Acknowledge-Identify-Printer",
+ "Acknowledge-Job",
+ "Fetch-Document",
+ "Fetch-Job",
+ "Get-Output-Device-Attributes",
+ "Update-Active-Jobs",
+ "Deregister-Output-Device",
+ "Update-Document-Status",
+ "Update-Job-Status",
+ "Update-Output-Device-Attributes",
+ "Get-Next-Document-Data",
+ "Allocate-Printer-Resources",
+ "Create-Printer",
+ "Deallocate-Printer-Resources",
+ "Delete-Printer",
+ "Get-Printers",
+
+ /* 0x0050 - 0x005f */
+ "Shutdown-One-Printer",
+ "Startup-One-Printer",
+ "Cancel-Resource",
+ "Create-Resource",
+ "Install-Resource",
+ "Send-Resource-Data",
+ "Set-Resource-Attributes",
+ "Create-Resource-Subscriptions",
+ "Create-System-Subscriptions",
+ "Disable-All-Printers",
+ "Enable-All-Printers",
+ "Get-System-Attributes",
+ "Get-System-Supported-Values",
+ "Pause-All-Printers",
+ "Pause-All-Printers-After-Current-Job",
+ "Register-Output-Device",
+
+ /* 0x0060 - 0x0064 */
+ "Restart-System",
+ "Resume-All-Printers",
+ "Set-System-Attributes",
+ "Shutdown-All-Printers",
+ "Startup-All-Printers"
},
* const ipp_cups_ops[] =
{
},
* const ipp_cups_ops2[] =
{
- "CUPS-Get-Document"
+ "CUPS-Get-Document",
+ "CUPS-Create-Local-Printer"
},
* const ipp_tag_names[] =
{ /* Value/group tag names */
"pending",
"4",
"processing",
- "6",
+ "processing-stopped", /* IPPSIX */
"canceled",
"aborted",
"completed"
"bale",
"booklet-maker",
"jog-offset",
- "15",
- "16",
+ "coat", /* Finishings 2.0 */
+ "laminate", /* Finishings 2.0 */
"17",
"18",
"19",
"staple-dual-top",
"staple-dual-right",
"staple-dual-bottom",
- "32",
- "33",
- "34",
- "35",
+ "staple-triple-left", /* Finishings 2.0 */
+ "staple-triple-top", /* Finishings 2.0 */
+ "staple-triple-right",/* Finishings 2.0 */
+ "staple-triple-bottom",/* Finishings 2.0 */
"36",
"37",
"38",
"67",
"68",
"69",
- "punch-top-left",
- "punch-bottom-left",
- "punch-top-right",
- "punch-bottom-right",
- "punch-dual-left",
- "punch-dual-top",
- "punch-dual-right",
- "punch-dual-bottom",
- "punch-triple-left",
- "punch-triple-top",
- "punch-triple-right",
- "punch-triple-bottom",
- "punch-quad-left",
- "punch-quad-top",
- "punch-quad-right",
- "punch-quad-bottom",
- "86",
- "87",
- "88",
- "89",
- "fold-accordian",
- "fold-double-gate",
- "fold-gate",
- "fold-half",
- "fold-half-z",
- "fold-left-gate",
- "fold-letter",
- "fold-parallel",
- "fold-poster",
- "fold-right-gate",
- "fold-z"
+ "punch-top-left", /* Finishings 2.0 */
+ "punch-bottom-left", /* Finishings 2.0 */
+ "punch-top-right", /* Finishings 2.0 */
+ "punch-bottom-right", /* Finishings 2.0 */
+ "punch-dual-left", /* Finishings 2.0 */
+ "punch-dual-top", /* Finishings 2.0 */
+ "punch-dual-right", /* Finishings 2.0 */
+ "punch-dual-bottom", /* Finishings 2.0 */
+ "punch-triple-left", /* Finishings 2.0 */
+ "punch-triple-top", /* Finishings 2.0 */
+ "punch-triple-right", /* Finishings 2.0 */
+ "punch-triple-bottom",/* Finishings 2.0 */
+ "punch-quad-left", /* Finishings 2.0 */
+ "punch-quad-top", /* Finishings 2.0 */
+ "punch-quad-right", /* Finishings 2.0 */
+ "punch-quad-bottom", /* Finishings 2.0 */
+ "punch-multiple-left",/* Finishings 2.1/Canon */
+ "punch-multiple-top", /* Finishings 2.1/Canon */
+ "punch-multiple-right",/* Finishings 2.1/Canon */
+ "punch-multiple-bottom",/* Finishings 2.1/Canon */
+ "fold-accordian", /* Finishings 2.0 */
+ "fold-double-gate", /* Finishings 2.0 */
+ "fold-gate", /* Finishings 2.0 */
+ "fold-half", /* Finishings 2.0 */
+ "fold-half-z", /* Finishings 2.0 */
+ "fold-left-gate", /* Finishings 2.0 */
+ "fold-letter", /* Finishings 2.0 */
+ "fold-parallel", /* Finishings 2.0 */
+ "fold-poster", /* Finishings 2.0 */
+ "fold-right-gate", /* Finishings 2.0 */
+ "fold-z", /* Finishings 2.0 */
+ "fold-engineering-z" /* Finishings 2.1 */
},
* const ipp_finishings_vendor[] =
{
"portrait",
"landscape",
"reverse-landscape",
- "reverse-portrait"
+ "reverse-portrait",
+ "none"
},
* const ipp_print_qualities[] =
{ /* print-quality enums */
* trailing nul. The buffer pointer can be NULL to get the required length,
* just like (v)snprintf.
*
- * @since CUPS 1.6/OS X 10.8@
+ * @since CUPS 1.6/macOS 10.8@
*/
size_t /* O - Number of bytes less nul */
ptr = ippEnumString(attr->name, val->integer);
if (buffer && bufptr < bufend)
- strlcpy(bufptr, ptr, bufend - bufptr + 1);
+ strlcpy(bufptr, ptr, (size_t)(bufend - bufptr + 1));
bufptr += strlen(ptr);
break;
case IPP_TAG_INTEGER :
if (buffer && bufptr < bufend)
- bufptr += snprintf(bufptr, bufend - bufptr + 1, "%d", val->integer);
+ bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%d", val->integer);
else
bufptr += snprintf(temp, sizeof(temp), "%d", val->integer);
break;
case IPP_TAG_BOOLEAN :
if (buffer && bufptr < bufend)
- strlcpy(bufptr, val->boolean ? "true" : "false",
- bufend - bufptr + 1);
+ strlcpy(bufptr, val->boolean ? "true" : "false", (size_t)(bufend - bufptr + 1));
bufptr += val->boolean ? 4 : 5;
break;
case IPP_TAG_RANGE :
if (buffer && bufptr < bufend)
- bufptr += snprintf(bufptr, bufend - bufptr + 1, "%d-%d",
- val->range.lower, val->range.upper);
+ bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%d-%d", val->range.lower, val->range.upper);
else
- bufptr += snprintf(temp, sizeof(temp), "%d-%d", val->range.lower,
- val->range.upper);
+ bufptr += snprintf(temp, sizeof(temp), "%d-%d", val->range.lower, val->range.upper);
break;
case IPP_TAG_RESOLUTION :
- if (buffer && bufptr < bufend)
- bufptr += snprintf(bufptr, bufend - bufptr + 1, "%dx%d%s",
- val->resolution.xres, val->resolution.yres,
- val->resolution.units == IPP_RES_PER_INCH ?
- "dpi" : "dpcm");
+ if (val->resolution.xres == val->resolution.yres)
+ {
+ if (buffer && bufptr < bufend)
+ bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%d%s", val->resolution.xres, val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
+ else
+ bufptr += snprintf(temp, sizeof(temp), "%d%s", val->resolution.xres, val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
+ }
+ else if (buffer && bufptr < bufend)
+ bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%dx%d%s", val->resolution.xres, val->resolution.yres, val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
else
- bufptr += snprintf(temp, sizeof(temp), "%dx%d%s",
- val->resolution.xres, val->resolution.yres,
- val->resolution.units == IPP_RES_PER_INCH ?
- "dpi" : "dpcm");
+ bufptr += snprintf(temp, sizeof(temp), "%dx%d%s", val->resolution.xres, val->resolution.yres, val->resolution.units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
break;
case IPP_TAG_DATE :
{
unsigned year; /* Year */
- year = (val->date[0] << 8) + val->date[1];
+ year = ((unsigned)val->date[0] << 8) + (unsigned)val->date[1];
if (val->date[9] == 0 && val->date[10] == 0)
snprintf(temp, sizeof(temp), "%04u-%02u-%02uT%02u:%02u:%02uZ",
val->date[10]);
if (buffer && bufptr < bufend)
- strlcpy(bufptr, temp, bufend - bufptr + 1);
+ strlcpy(bufptr, temp, (size_t)(bufend - bufptr + 1));
bufptr += strlen(temp);
}
bufptr ++;
if (buffer && bufptr < bufend)
- strlcpy(bufptr, val->string.language, bufend - bufptr);
+ strlcpy(bufptr, val->string.language, (size_t)(bufend - bufptr));
bufptr += strlen(val->string.language);
if (buffer && bufptr < bufend)
case IPP_TAG_BEGIN_COLLECTION :
if (buffer && bufptr < bufend)
- bufptr += ipp_col_string(val->collection, bufptr,
- bufend - bufptr + 1);
+ bufptr += ipp_col_string(val->collection, bufptr, (size_t)(bufend - bufptr + 1));
else
bufptr += ipp_col_string(val->collection, NULL, 0);
break;
else if (!isprint(*ptr & 255))
{
if (buffer && bufptr < bufend)
- bufptr += snprintf(bufptr, bufend - bufptr + 1, "\\%03o",
- *ptr & 255);
+ bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "\\%03o", *ptr & 255);
else
- bufptr += snprintf(temp, sizeof(temp), "\\%03o",
- *ptr & 255);
+ bufptr += snprintf(temp, sizeof(temp), "\\%03o", *ptr & 255);
}
else
{
default :
ptr = ippTagString(attr->value_tag);
if (buffer && bufptr < bufend)
- strlcpy(bufptr, ptr, bufend - bufptr + 1);
+ strlcpy(bufptr, ptr, (size_t)(bufend - bufptr + 1));
bufptr += strlen(ptr);
break;
}
else if (bufend)
*bufend = '\0';
- return (bufptr - buffer);
+ return ((size_t)(bufptr - buffer));
}
* "attribute-name")@ will return a non-NULL pointer. The array must be freed
* using the @code cupsArrayDelete@ function.
*
- * @since CUPS 1.7@
+ * @since CUPS 1.7/macOS 10.9@
*/
cups_array_t * /* O - CUPS array or @code NULL@ if all */
"k-octets",
"k-octets-processed",
"last-document",
+ "materials-col-actual", /* IPP 3D */
"media-actual",
"media-col-actual",
"media-input-tray-check-actual",
"media-sheets",
"media-sheets-completed",
"more-info",
+ "multiple-object-handling-actual", /* IPP 3D */
"number-up-actual",
"orientation-requested-actual",
"output-bin-actual",
"pages",
"pages-completed",
"pages-completed-current-copy",
+ "platform-temperature-actual", /* IPP 3D */
"presentation-direction-number-up-actual",
+ "print-accuracy-actual", /* IPP 3D */
+ "print-base-actual", /* IPP 3D */
"print-color-mode-actual",
"print-content-optimize-actual",
+ "print-objects-actual", /* IPP 3D */
"print-quality-actual",
"print-rendering-intent-actual",
"print-scaling-actual", /* IPP Paid Printing */
+ "print-supports-actual", /* IPP 3D */
"printer-resolution-actual",
"printer-up-time",
"separator-sheets-actual",
"insert-sheet",
"insert-sheet-default",
"insert-sheet-supported",
+ "material-amount-units-supported", /* IPP 3D */
+ "material-diameter-supported", /* IPP 3D */
+ "material-purpose-supported", /* IPP 3D */
+ "material-rate-supported", /* IPP 3D */
+ "material-rate-units-supported", /* IPP 3D */
+ "material-shell-thickness-supported",/* IPP 3D */
+ "material-temperature-supported", /* IPP 3D */
+ "material-type-supported", /* IPP 3D */
+ "materials-col", /* IPP 3D */
+ "materials-col-database", /* IPP 3D */
+ "materials-col-default", /* IPP 3D */
+ "materials-col-ready", /* IPP 3D */
+ "materials-col-supported", /* IPP 3D */
+ "max-materials-col-supported", /* IPP 3D */
"max-stitching-locations-supported",
"media",
"media-back-coating-supported",
"multiple-document-handling",
"multiple-document-handling-default",
"multiple-document-handling-supported",
+ "multiple-object-handling", /* IPP 3D */
+ "multiple-object-handling-default", /* IPP 3D */
+ "multiple-object-handling-supported",/* IPP 3D */
"number-up",
"number-up-default",
"number-up-supported",
"pdl-init-file-name-subdirectory-supported",
"pdl-init-file-name-supported",
"pdl-init-file-supported",
+ "platform-temperature", /* IPP 3D */
+ "platform-temperature-default", /* IPP 3D */
+ "platform-temperature-supported", /* IPP 3D */
"presentation-direction-number-up",
"presentation-direction-number-up-default",
"presentation-direction-number-up-supported",
+ "print-accuracy", /* IPP 3D */
+ "print-accuracy-default", /* IPP 3D */
+ "print-accuracy-supported", /* IPP 3D */
+ "print-base", /* IPP 3D */
+ "print-base-default", /* IPP 3D */
+ "print-base-supported", /* IPP 3D */
"print-color-mode",
"print-color-mode-default",
"print-color-mode-supported",
"print-content-optimize",
"print-content-optimize-default",
"print-content-optimize-supported",
+ "print-objects", /* IPP 3D */
+ "print-objects-default", /* IPP 3D */
+ "print-objects-supported", /* IPP 3D */
"print-quality",
"print-quality-default",
"print-quality-supported",
"print-scaling", /* IPP Paid Printing */
"print-scaling-default", /* IPP Paid Printing */
"print-scaling-supported", /* IPP Paid Printing */
+ "print-supports", /* IPP 3D */
+ "print-supports-default", /* IPP 3D */
+ "print-supports-supported", /* IPP 3D */
"printer-resolution",
"printer-resolution-default",
"printer-resolution-supported",
"job-state-reasons",
"job-uri",
"job-uuid",
+ "materials-col-actual", /* IPP 3D */
"media-actual",
"media-col-actual",
"media-check-input-tray-actual",
"multiple-document-handling-actual",
+ "multiple-object-handling-actual", /* IPP 3D */
"number-of-documents",
"number-of-intervening-jobs",
"number-up-actual",
"page-delivery-actual",
"page-order-received-actual",
"page-ranges-actual",
+ "platform-temperature-actual", /* IPP 3D */
"presentation-direction-number-up-actual",
+ "print-accuracy-actual", /* IPP 3D */
+ "print-base-actual", /* IPP 3D */
"print-color-mode-actual",
"print-content-optimize-actual",
+ "print-objects-actual", /* IPP 3D */
"print-quality-actual",
"print-rendering-intent-actual",
"print-scaling-actual", /* IPP Paid Printing */
+ "print-supports-actual", /* IPP 3D */
"printer-resolution-actual",
"separator-sheets-actual",
"sheet-collate-actual",
};
static const char * const job_template[] =
{ /* job-template group */
+ "accuracy-units-supported", /* IPP 3D */
"confirmation-sheet-print", /* IPP FaxOut */
"confirmation-sheet-print-default",
"copies",
"job-sheets-default",
"job-sheets-supported",
"logo-uri-schemes-supported",
+ "material-amount-units-supported", /* IPP 3D */
+ "material-diameter-supported", /* IPP 3D */
+ "material-purpose-supported", /* IPP 3D */
+ "material-rate-supported", /* IPP 3D */
+ "material-rate-units-supported", /* IPP 3D */
+ "material-shell-thickness-supported",/* IPP 3D */
+ "material-temperature-supported", /* IPP 3D */
+ "material-type-supported", /* IPP 3D */
+ "materials-col", /* IPP 3D */
+ "materials-col-database", /* IPP 3D */
+ "materials-col-default", /* IPP 3D */
+ "materials-col-ready", /* IPP 3D */
+ "materials-col-supported", /* IPP 3D */
+ "max-materials-col-supported", /* IPP 3D */
"max-save-info-supported",
"max-stitching-locations-supported",
"media",
"multiple-document-handling",
"multiple-document-handling-default",
"multiple-document-handling-supported",
+ "multiple-object-handling", /* IPP 3D */
+ "multiple-object-handling-default", /* IPP 3D */
+ "multiple-object-handling-supported",/* IPP 3D */
"number-of-retries", /* IPP FaxOut */
"number-of-retries-default",
"number-of-retries-supported",
"pdl-init-file-name-subdirectory-supported",
"pdl-init-file-name-supported",
"pdl-init-file-supported",
+ "platform-temperature", /* IPP 3D */
+ "platform-temperature-default", /* IPP 3D */
+ "platform-temperature-supported", /* IPP 3D */
"presentation-direction-number-up",
"presentation-direction-number-up-default",
"presentation-direction-number-up-supported",
+ "print-accuracy", /* IPP 3D */
+ "print-accuracy-default", /* IPP 3D */
+ "print-accuracy-supported", /* IPP 3D */
+ "print-base", /* IPP 3D */
+ "print-base-default", /* IPP 3D */
+ "print-base-supported", /* IPP 3D */
"print-color-mode",
"print-color-mode-default",
"print-color-mode-supported",
"print-content-optimize",
"print-content-optimize-default",
"print-content-optimize-supported",
+ "print-objects", /* IPP 3D */
+ "print-objects-default", /* IPP 3D */
+ "print-objects-supported", /* IPP 3D */
"print-quality",
"print-quality-default",
"print-quality-supported",
"print-scaling", /* IPP Paid Printing */
"print-scaling-default", /* IPP Paid Printing */
"print-scaling-supported", /* IPP Paid Printing */
+ "print-supports", /* IPP 3D */
+ "print-supports-default", /* IPP 3D */
+ "print-supports-supported", /* IPP 3D */
"printer-resolution",
"printer-resolution-default",
"printer-resolution-supported",
"pages-per-minute",
"pages-per-minute-color",
"pdf-k-octets-supported", /* CUPS extension */
+ "pdf-features-supported", /* IPP 3D */
"pdf-versions-supported", /* CUPS extension */
"pdl-override-supported",
"port-monitor", /* CUPS extension */
"printer-fax-modem-info", /* IPP FaxOut */
"printer-fax-modem-name", /* IPP FaxOut */
"printer-fax-modem-number", /* IPP FaxOut */
+ "printer-firmware-name", /* PWG 5110.1 */
+ "printer-firmware-patches", /* PWG 5110.1 */
+ "printer-firmware-string-version", /* PWG 5110.1 */
+ "printer-firmware-version", /* PWG 5110.1 */
"printer-geo-location",
"printer-get-attributes-supported",
"printer-icc-profiles",
"printer-icons",
+ "printer-id", /* CUPS extension */
"printer-info",
+ "printer-input-tray", /* IPP JPS3 */
"printer-is-accepting-jobs",
"printer-is-shared", /* CUPS extension */
+ "printer-is-temporary", /* CUPS extension */
"printer-kind", /* IPP Paid Printing */
"printer-location",
"printer-make-and-model",
"printer-native-formats",
"printer-organization",
"printer-organizational-unit",
+ "printer-output-tray", /* IPP JPS3 */
+ "printer-queue-id", /* CUPS extension */
"printer-settable-attributes-supported",
"printer-state",
"printer-state-change-date-time",
*/
if (isdigit(*enumstring & 255))
- return (strtol(enumstring, NULL, 0));
+ return ((int)strtol(enumstring, NULL, 0));
/*
* Otherwise look up the string...
else if (error == IPP_STATUS_CUPS_SEE_OTHER)
return ("cups-see-other");
else if (error >= IPP_STATUS_ERROR_BAD_REQUEST &&
- error <= IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE)
+ error <= IPP_STATUS_ERROR_ACCOUNT_AUTHORIZATION_FAILED)
return (ipp_status_400s[error - IPP_STATUS_ERROR_BAD_REQUEST]);
else if (error >= 0x480 &&
error <= IPP_STATUS_ERROR_CUPS_ACCOUNT_AUTHORIZATION_FAILED)
/*
* 'ippErrorValue()' - Return a status code for the given name.
*
- * @since CUPS 1.2/OS X 10.5@
+ * @since CUPS 1.2/macOS 10.5@
*/
ipp_status_t /* O - IPP status code */
ippErrorValue(const char *name) /* I - Name */
{
- int i;
+ size_t i; /* Looping var */
for (i = 0; i < (sizeof(ipp_status_oks) / sizeof(ipp_status_oks[0])); i ++)
/*
* 'ippOpString()' - Return a name for the given operation id.
*
- * @since CUPS 1.2/OS X 10.5@
+ * @since CUPS 1.2/macOS 10.5@
*/
const char * /* O - Name */
* See if the operation ID is a known value...
*/
- if (op >= IPP_OP_PRINT_JOB && op <= IPP_OP_VALIDATE_DOCUMENT)
+ if (op >= IPP_OP_PRINT_JOB && op < (ipp_op_t)(sizeof(ipp_std_ops) / sizeof(ipp_std_ops[0])))
return (ipp_std_ops[op]);
else if (op == IPP_OP_PRIVATE)
return ("windows-ext");
else if (op >= IPP_OP_CUPS_GET_DEFAULT && op <= IPP_OP_CUPS_GET_PPD)
return (ipp_cups_ops[op - IPP_OP_CUPS_GET_DEFAULT]);
- else if (op == IPP_OP_CUPS_GET_DOCUMENT)
- return (ipp_cups_ops2[0]);
+ else if (op >= IPP_OP_CUPS_GET_DOCUMENT && op <= IPP_OP_CUPS_CREATE_LOCAL_PRINTER)
+ return (ipp_cups_ops2[op - IPP_OP_CUPS_GET_DOCUMENT]);
/*
* No, build an "0xxxxx" operation string...
/*
* 'ippOpValue()' - Return an operation id for the given name.
*
- * @since CUPS 1.2/OS X 10.5@
+ * @since CUPS 1.2/macOS 10.5@
*/
ipp_op_t /* O - Operation ID */
ippOpValue(const char *name) /* I - Textual name */
{
- int i;
+ size_t i; /* Looping var */
if (!strncmp(name, "0x", 2))
if (!_cups_strcasecmp(name, ipp_cups_ops2[i]))
return ((ipp_op_t)(i + 0x4027));
+ if (!_cups_strcasecmp(name, "Create-Job-Subscription"))
+ return (IPP_OP_CREATE_JOB_SUBSCRIPTIONS);
+
+ if (!_cups_strcasecmp(name, "Create-Printer-Subscription"))
+ return (IPP_OP_CREATE_PRINTER_SUBSCRIPTIONS);
+
if (!_cups_strcasecmp(name, "CUPS-Add-Class"))
return (IPP_OP_CUPS_ADD_MODIFY_CLASS);
}
+/*
+ * 'ippStateString()' - Return the name corresponding to a state value.
+ *
+ * @since CUPS 2.0/OS 10.10@
+ */
+
+const char * /* O - State name */
+ippStateString(ipp_state_t state) /* I - State value */
+{
+ if (state >= IPP_STATE_ERROR && state <= IPP_STATE_DATA)
+ return (ipp_states[state - IPP_STATE_ERROR]);
+ else
+ return ("UNKNOWN");
+}
+
+
/*
* 'ippTagString()' - Return the tag name corresponding to a tag value.
*
- * The returned names are defined in RFC 2911 and 3382.
+ * The returned names are defined in RFC 8011 and the IANA IPP Registry.
*
- * @since CUPS 1.4/OS X 10.6@
+ * @since CUPS 1.4/macOS 10.6@
*/
const char * /* O - Tag name */
/*
* 'ippTagValue()' - Return the tag value corresponding to a tag name.
*
- * The tag names are defined in RFC 2911 and 3382.
+ * The tag names are defined in RFC 8011 and the IANA IPP Registry.
*
- * @since CUPS 1.4/OS X 10.6@
+ * @since CUPS 1.4/macOS 10.6@
*/
ipp_tag_t /* O - Tag value */
ippTagValue(const char *name) /* I - Tag name */
{
- int i; /* Looping var */
+ size_t i; /* Looping var */
for (i = 0; i < (sizeof(ipp_tag_names) / sizeof(ipp_tag_names[0])); i ++)
ipp_attribute_t *attr; /* Current member attribute */
+ if (!col)
+ {
+ if (buffer)
+ *buffer = '\0';
+
+ return (0);
+ }
+
bufptr = buffer;
bufend = buffer + bufsize - 1;
prefix = ' ';
if (buffer && bufptr < bufend)
- bufptr += snprintf(bufptr, bufend - bufptr + 1, "%s=", attr->name);
+ bufptr += snprintf(bufptr, (size_t)(bufend - bufptr + 1), "%s=", attr->name);
else
bufptr += strlen(attr->name) + 1;
if (buffer && bufptr < bufend)
- bufptr += ippAttributeString(attr, bufptr, bufend - bufptr + 1);
+ bufptr += ippAttributeString(attr, bufptr, (size_t)(bufend - bufptr + 1));
else
bufptr += ippAttributeString(attr, temp, sizeof(temp));
}
*bufptr = '}';
bufptr ++;
- return (bufptr - buffer);
+ return ((size_t)(bufptr - buffer));
}
-
-
-/*
- * End of "$Id$".
- */