From: Michael R Sweet Date: Tue, 24 Apr 2018 20:17:19 +0000 (-0400) Subject: Add resource and system object/state values. X-Git-Tag: v2.3b5~26 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fcups.git;a=commitdiff_plain;h=17cc92f131468b72d7be4c6e0a94b869c26b7341 Add resource and system object/state values. --- diff --git a/cups/ipp-support.c b/cups/ipp-support.c index 5512ce9bd..80633161b 100644 --- a/cups/ipp-support.c +++ b/cups/ipp-support.c @@ -616,7 +616,21 @@ static const char * const ipp_document_states[] = { /* printer-state enums */ "idle", "processing", - "stopped", + "stopped" + }, + * const ipp_resource_states[] = + { /* resource-state enums */ + "pending", + "available", + "installed", + "canceled", + "aborted" + }, + * const ipp_system_states[] = + { /* system-state enums */ + "idle", + "processing", + "stopped" }; @@ -1923,59 +1937,31 @@ ippEnumString(const char *attrname, /* I - Attribute name */ * Check for standard enum values... */ - if (!strcmp(attrname, "document-state") && - enumvalue >= 3 && - enumvalue < (3 + (int)(sizeof(ipp_document_states) / - sizeof(ipp_document_states[0])))) + if (!strcmp(attrname, "document-state") && enumvalue >= 3 && enumvalue < (3 + (int)(sizeof(ipp_document_states) / sizeof(ipp_document_states[0])))) return (ipp_document_states[enumvalue - 3]); - else if (!strcmp(attrname, "finishings") || - !strcmp(attrname, "finishings-actual") || - !strcmp(attrname, "finishings-default") || - !strcmp(attrname, "finishings-ready") || - !strcmp(attrname, "finishings-supported") || - !strcmp(attrname, "job-finishings") || - !strcmp(attrname, "job-finishings-default") || - !strcmp(attrname, "job-finishings-supported")) + else if (!strcmp(attrname, "finishings") || !strcmp(attrname, "finishings-actual") || !strcmp(attrname, "finishings-default") || !strcmp(attrname, "finishings-ready") || !strcmp(attrname, "finishings-supported") || !strcmp(attrname, "job-finishings") || !strcmp(attrname, "job-finishings-default") || !strcmp(attrname, "job-finishings-supported")) { - if (enumvalue >= 3 && - enumvalue < (3 + (int)(sizeof(ipp_finishings) / - sizeof(ipp_finishings[0])))) + if (enumvalue >= 3 && enumvalue < (3 + (int)(sizeof(ipp_finishings) / sizeof(ipp_finishings[0])))) return (ipp_finishings[enumvalue - 3]); - else if (enumvalue >= 0x40000000 && - enumvalue <= (0x40000000 + (int)(sizeof(ipp_finishings_vendor) / - sizeof(ipp_finishings_vendor[0])))) + else if (enumvalue >= 0x40000000 && enumvalue <= (0x40000000 + (int)(sizeof(ipp_finishings_vendor) / sizeof(ipp_finishings_vendor[0])))) return (ipp_finishings_vendor[enumvalue - 0x40000000]); } - else if ((!strcmp(attrname, "job-collation-type") || - !strcmp(attrname, "job-collation-type-actual")) && - enumvalue >= 3 && - enumvalue < (3 + (int)(sizeof(ipp_job_collation_types) / - sizeof(ipp_job_collation_types[0])))) + else if ((!strcmp(attrname, "job-collation-type") || !strcmp(attrname, "job-collation-type-actual")) && enumvalue >= 3 && enumvalue < (3 + (int)(sizeof(ipp_job_collation_types) / sizeof(ipp_job_collation_types[0])))) return (ipp_job_collation_types[enumvalue - 3]); - else if (!strcmp(attrname, "job-state") && - enumvalue >= IPP_JSTATE_PENDING && enumvalue <= IPP_JSTATE_COMPLETED) + else if (!strcmp(attrname, "job-state") && enumvalue >= IPP_JSTATE_PENDING && enumvalue <= IPP_JSTATE_COMPLETED) return (ipp_job_states[enumvalue - IPP_JSTATE_PENDING]); else if (!strcmp(attrname, "operations-supported")) return (ippOpString((ipp_op_t)enumvalue)); - else if ((!strcmp(attrname, "orientation-requested") || - !strcmp(attrname, "orientation-requested-actual") || - !strcmp(attrname, "orientation-requested-default") || - !strcmp(attrname, "orientation-requested-supported")) && - enumvalue >= 3 && - enumvalue < (3 + (int)(sizeof(ipp_orientation_requesteds) / - sizeof(ipp_orientation_requesteds[0])))) + else if ((!strcmp(attrname, "orientation-requested") || !strcmp(attrname, "orientation-requested-actual") || !strcmp(attrname, "orientation-requested-default") || !strcmp(attrname, "orientation-requested-supported")) && enumvalue >= 3 && enumvalue < (3 + (int)(sizeof(ipp_orientation_requesteds) / sizeof(ipp_orientation_requesteds[0])))) return (ipp_orientation_requesteds[enumvalue - 3]); - else if ((!strcmp(attrname, "print-quality") || - !strcmp(attrname, "print-quality-actual") || - !strcmp(attrname, "print-quality-default") || - !strcmp(attrname, "print-quality-supported")) && - enumvalue >= 3 && - enumvalue < (3 + (int)(sizeof(ipp_print_qualities) / - sizeof(ipp_print_qualities[0])))) + else if ((!strcmp(attrname, "print-quality") || !strcmp(attrname, "print-quality-actual") || !strcmp(attrname, "print-quality-default") || !strcmp(attrname, "print-quality-supported")) && enumvalue >= 3 && enumvalue < (3 + (int)(sizeof(ipp_print_qualities) / sizeof(ipp_print_qualities[0])))) return (ipp_print_qualities[enumvalue - 3]); - else if (!strcmp(attrname, "printer-state") && - enumvalue >= IPP_PSTATE_IDLE && enumvalue <= IPP_PSTATE_STOPPED) + else if (!strcmp(attrname, "printer-state") && enumvalue >= IPP_PSTATE_IDLE && enumvalue <= IPP_PSTATE_STOPPED) return (ipp_printer_states[enumvalue - IPP_PSTATE_IDLE]); + else if (!strcmp(attrname, "resource-state") && enumvalue >= IPP_RSTATE_PENDING && enumvalue <= IPP_RSTATE_ABORTED) + return (ipp_resource_states[enumvalue - IPP_RSTATE_PENDING]); + else if (!strcmp(attrname, "system-state") && enumvalue >= IPP_SSTATE_IDLE && enumvalue <= IPP_SSTATE_STOPPED) + return (ipp_system_states[enumvalue - IPP_SSTATE_IDLE]); /* * Not a standard enum value, just return the decimal equivalent... @@ -2067,6 +2053,16 @@ ippEnumValue(const char *attrname, /* I - Attribute name */ num_strings = (int)(sizeof(ipp_printer_states) / sizeof(ipp_printer_states[0])); strings = ipp_printer_states; } + else if (!strcmp(attrname, "resource-state")) + { + num_strings = (int)(sizeof(ipp_resource_states) / sizeof(ipp_resource_states[0])); + strings = ipp_resource_states; + } + else if (!strcmp(attrname, "system-state")) + { + num_strings = (int)(sizeof(ipp_system_states) / sizeof(ipp_system_states[0])); + strings = ipp_system_states; + } else return (-1); diff --git a/cups/ipp.h b/cups/ipp.h index 58f0f0b9a..80f5528b5 100644 --- a/cups/ipp.h +++ b/cups/ipp.h @@ -490,6 +490,22 @@ typedef enum ipp_res_e /**** Resolution units ****/ IPP_RES_PER_CM /* Pixels per centimeter */ } ipp_res_t; +typedef enum ipp_rstate_e /**** resource-state values ****/ +{ + IPP_RSTATE_PENDING = 3, /* Resource is created but has no data yet. */ + IPP_RSTATE_AVAILABLE, /* Resource is available for installation. */ + IPP_RSTATE_INSTALLED, /* Resource is installed. */ + IPP_RSTATE_CANCELED, /* Resource has been canceled and is pending deletion. */ + IPP_RSTATE_ABORTED /* Resource has been aborted and is pending deletion. */ +} ipp_rstate_t; + +typedef enum ipp_sstate_e /**** system-state values ****/ +{ + IPP_SSTATE_IDLE = 3, /* At least one printer is idle and none are processing a job. */ + IPP_SSTATE_PROCESSING, /* At least one printer is processing a job. */ + IPP_SSTATE_STOPPED /* All printers are stopped. */ +} ipp_sstate_t; + typedef enum ipp_state_e /**** ipp_t state values ****/ { IPP_STATE_ERROR = -1, /* An error occurred */