diff -Nur cnijfilter-source-3.20-1.orig/backend/src/cnij_backend_common.c cnijfilter-source-3.20-1/backend/src/cnij_backend_common.c --- cnijfilter-source-3.20-1.orig/backend/src/cnij_backend_common.c 2009-05-27 07:46:41.000000000 +0200 +++ cnijfilter-source-3.20-1/backend/src/cnij_backend_common.c 2012-08-15 15:28:06.172143834 +0200 @@ -38,6 +38,7 @@ // CUPS Header #include #include +#include // Header file for CANON #include "cnij_backend_common.h" diff -Nur cnijfilter-source-3.20-1.orig/cngpij/cngpij/bjcups.c cnijfilter-source-3.20-1/cngpij/cngpij/bjcups.c --- cnijfilter-source-3.20-1.orig/cngpij/cngpij/bjcups.c 2009-06-11 06:10:32.000000000 +0200 +++ cnijfilter-source-3.20-1/cngpij/cngpij/bjcups.c 2012-08-15 15:28:06.173143833 +0200 @@ -21,6 +21,7 @@ #include #endif // HAVE_CONFIG_H +#define _IPP_PRIVATE_STRUCTURES 1 #include #include #include diff -Nur cnijfilter-source-3.90-1.orig/cngpijmon/src/bjcupsmon_cups.c cnijfilter-source-3.90-1/cngpijmon/src/bjcupsmon_cups.c --- cnijfilter-source-3.90-1.orig/cngpijmon/src/bjcupsmon_cups.c 2012-10-02 08:59:31.000000000 +0330 +++ cnijfilter-source-3.90-1/cngpijmon/src/bjcupsmon_cups.c 2020-01-26 23:59:44.324580174 +0330 @@ -213,24 +213,17 @@ retVal = ID_ERR_CUPS_API_FAILED; } else { - pRequest = ippNew(); + pRequest = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); - pRequest->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - pRequest->request.op.request_id = 1; - - pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19 - - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(pLanguage)); - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, pLanguage->language); ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, pURI); if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) { - if (pResponse->request.status.status_code > IPP_OK_CONFLICT) { + if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) { retVal = ID_ERR_CUPS_API_FAILED; } else { if ((pAttribute = ippFindAttribute(pResponse, "printer-state", IPP_TAG_ENUM)) != NULL) { - printerState = (ipp_state_t)pAttribute->values[0].integer; + printerState = ippGetInteger(pAttribute, 0); } } @@ -286,19 +279,12 @@ retVal = ID_ERR_CUPS_API_FAILED; } else { - pRequest = ippNew(); - - pRequest->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - pRequest->request.op.request_id = 1; - - pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19 + pRequest = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(pLanguage)); - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, pLanguage->language); ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printerURI); if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) { - if (pResponse->request.status.status_code > IPP_OK_CONFLICT) { + if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) { retVal = ID_ERR_CUPS_API_FAILED; } else { @@ -310,7 +296,7 @@ //} pAttribute = ippFindAttribute(pResponse, "printer-state-message", IPP_TAG_TEXT); if (pAttribute != NULL) { - strncpy(pStatus, pAttribute->values[0].string.text, bufSize); + strncpy(pStatus, ippGetString(pAttribute, 0, NULL), bufSize); } } ippDelete(pResponse); @@ -367,21 +353,14 @@ retVal = ID_ERR_CUPS_API_FAILED; } else { - pRequest = ippNew(); + pRequest = ippNewRequest(IPP_CANCEL_JOB); - pRequest->request.op.operation_id = IPP_CANCEL_JOB; - pRequest->request.op.request_id = 1; - - pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19 - - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(pLanguage)); - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, pLanguage->language); ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printerURI); ippAddInteger(pRequest, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", jobID); ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser()); if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/jobs/")) != NULL) { - if (pResponse->request.status.status_code > IPP_OK_CONFLICT) { + if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) { retVal = ID_ERR_CUPS_API_FAILED; } ippDelete(pResponse); @@ -442,45 +421,38 @@ retVal = ID_ERR_CUPS_API_FAILED; } else { - pRequest = ippNew(); - - pRequest->request.op.operation_id = IPP_GET_JOBS; - pRequest->request.op.request_id = 1; + pRequest = ippNewRequest(IPP_GET_JOBS); - pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19 - - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(pLanguage)); - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, pLanguage->language); ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, pURI); //for CUPS 1.4.3 STR #3383 ippAddStrings(pRequest, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes",(int)(sizeof(jobattrs) / sizeof(jobattrs[0])), NULL, jobattrs); if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) { - if (pResponse->request.status.status_code > IPP_OK_CONFLICT) { + if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) { retVal = ID_ERR_CUPS_API_FAILED; } else { - pAttribute = pResponse->attrs; + pAttribute = ippFirstAttribute(pResponse); while (pAttribute != NULL) { - while (pAttribute != NULL && pAttribute->group_tag != IPP_TAG_JOB) { - pAttribute = pAttribute->next; + while (pAttribute != NULL && ippGetGroupTag(pAttribute) != IPP_TAG_JOB) { + pAttribute = ippNextAttribute(pResponse); } if (pAttribute == NULL) { break; } - while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_JOB) { - if (strcmp(pAttribute->name, "job-id") == 0 && pAttribute->value_tag == IPP_TAG_INTEGER) { - jobID = pAttribute->values[0].integer; + while (pAttribute != NULL && ippGetGroupTag(pAttribute) == IPP_TAG_JOB) { + if (strcmp(ippGetName(pAttribute), "job-id") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_INTEGER) { + jobID = ippGetInteger(pAttribute, 0); } - if (strcmp(pAttribute->name, "job-state") == 0 && pAttribute->value_tag == IPP_TAG_ENUM) { - jobState = (ipp_jstate_t)pAttribute->values[0].integer; + if (strcmp(ippGetName(pAttribute), "job-state") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_ENUM) { + jobState = ippGetInteger(pAttribute, 0); } - if (strcmp(pAttribute->name, "job-originating-user-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) { - pJobUserName = pAttribute->values[0].string.text; + if (strcmp(ippGetName(pAttribute), "job-originating-user-name") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_NAME) { + pJobUserName = ippGetString(pAttribute, 0, NULL); } - pAttribute = pAttribute->next; + pAttribute = ippNextAttribute(pResponse); } if (jobState == IPP_JOB_PROCESSING) { if (pJobUserName != NULL) { @@ -497,7 +469,7 @@ } if (pAttribute != NULL) - pAttribute = pAttribute->next; + pAttribute = ippNextAttribute(pResponse); } } @@ -553,40 +525,33 @@ retVal = ID_ERR_CUPS_API_FAILED; } else { - pRequest = ippNew(); - - pRequest->request.op.operation_id = CUPS_GET_PRINTERS; - pRequest->request.op.request_id = 1; + pRequest = ippNewRequest(CUPS_GET_PRINTERS); - pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19 - - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(pLanguage)); - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, pLanguage->language); ippAddStrings(pRequest, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", sizeof(attributes) / sizeof(attributes[0]), NULL, attributes); if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) { - if (pResponse->request.status.status_code > IPP_OK_CONFLICT) { + if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) { retVal = ID_ERR_CUPS_API_FAILED; } else { - pAttribute = pResponse->attrs; + pAttribute = ippFirstAttribute(pResponse); while (pAttribute != NULL) { - while (pAttribute != NULL && pAttribute->group_tag != IPP_TAG_PRINTER) { - pAttribute = pAttribute->next; + while (pAttribute != NULL && ippGetGroupTag(pAttribute != IPP_TAG_PRINTER)) { + pAttribute = ippNextAttribute(pResponse); } if (pAttribute == NULL) { break; } - while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_PRINTER) { - if (strcmp(pAttribute->name, "printer-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) { - pPrinter = pAttribute->values[0].string.text; + while (pAttribute != NULL && ippGetGroupTag(pAttribute) == IPP_TAG_PRINTER) { + if (strcmp(ippGetName(pAttribute), "printer-name") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_NAME) { + pPrinter = ippGetString(pAttribute, 0, NULL); } - if (strcmp(pAttribute->name, "printer-uri-supported") == 0 && pAttribute->value_tag == IPP_TAG_URI) { - pUri = pAttribute->values[0].string.text; + if (strcmp(ippGetName(pAttribute), "printer-uri-supported") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_URI) { + pUri = ippGetString(pAttribute, 0, NULL); } - pAttribute = pAttribute->next; + pAttribute = ippNextAttribute(pResponse); } // Tora 020418: Compare two printer names ignoring the character case. @@ -603,7 +568,7 @@ } if (pAttribute != NULL) - pAttribute = pAttribute->next; + pAttribute = ippNextAttribute(pResponse); } } @@ -656,40 +621,33 @@ retVal = ID_ERR_CUPS_API_FAILED; } else { - pRequest = ippNew(); - - pRequest->request.op.operation_id = CUPS_GET_PRINTERS; - pRequest->request.op.request_id = 1; - - pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19 - - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(pLanguage)); - ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, pLanguage->language); + pRequest = ippNewRequest(CUPS_GET_PRINTERS); + ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, NULL); if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) { - if (pResponse->request.status.status_code > IPP_OK_CONFLICT) { + if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) { retVal = ID_ERR_CUPS_API_FAILED; } else { - pAttribute = pResponse->attrs; + pAttribute = ippFirstAttribute(pResponse); while (pAttribute != NULL) { - while (pAttribute != NULL && pAttribute->group_tag != IPP_TAG_PRINTER) { - pAttribute = pAttribute->next; + while (pAttribute != NULL && ippGetGroupTag(pAttribute) != IPP_TAG_PRINTER) { + pAttribute = ippNextAttribute(pResponse); } if (pAttribute == NULL) { break; } - while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_PRINTER) { - if (strcmp(pAttribute->name, "printer-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) { - pPrinter = pAttribute->values[0].string.text; + while (pAttribute != NULL && ippGetGroupTag(pAttribute) == IPP_TAG_PRINTER) { + if (strcmp(ippGetName(pAttribute), "printer-name") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_NAME) { + pPrinter = ippGetString(pAttribute, 0, NULL); } - if (strcmp(pAttribute->name, "device-uri") == 0 && pAttribute->value_tag == IPP_TAG_URI) { - pDUri = pAttribute->values[0].string.text; + if (strcmp(ippGetName(pAttribute), "device-uri") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_URI) { + pDUri = ippGetString(pAttribute, 0, NULL); } - pAttribute = pAttribute->next; + pAttribute = ippNextAttribute(pResponse); } if (strcasecmp(pDestName, pPrinter) == 0) { @@ -698,7 +656,7 @@ } if (pAttribute != NULL) - pAttribute = pAttribute->next; + pAttribute = ippNextAttribute(pResponse); } }