diff -Naur a/backend/src/cnij_backend_common.c b/backend/src/cnij_backend_common.c --- a/backend/src/cnij_backend_common.c 2010-02-23 04:57:49.000000000 +0100 +++ b/backend/src/cnij_backend_common.c 2011-11-17 12:59:27.482025762 +0100 @@ -38,6 +38,7 @@ // CUPS Header #include #include +#include // Header file for CANON #include "cnij_backend_common.h" --- a/cngpijmon/src/bjcupsmon_cups.c 2012-03-17 12:32:43.230805896 +0100 +++ b/cngpijmon/src/bjcupsmon_cups.c 2012-03-17 12:34:23.179018171 +0100 @@ -18,8 +18,10 @@ */ /*** Includes ***/ +#define _IPP_PRIVATE_STRUCTURES 1 #include #include +#include #include #include --- a/cngpij/cngpij/bjcups.c 2012-07-31 05:22:51.613991808 -0400 +++ b/cngpij/cngpij/bjcups.c 2012-07-31 05:23:14.780658321 -0400 @@ -21,6 +21,7 @@ #include #endif // HAVE_CONFIG_H +#define _IPP_PRIVATE_STRUCTURES 1 #include #include #include diff -Naur a/cngpij/cngpij/bjcups.c b/cngpij/cngpij/bjcups.c --- a/cngpij/cngpij/bjcups.c 2019-10-31 15:00:19.000000000 +0200 +++ b/cngpij/cngpij/bjcups.c 2019-10-31 15:14:44.505666529 +0200 @@ -66,6 +66,48 @@ extern int GetIPCData(LPIPCU pipc, char *sname); +#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) +#define HAVE_CUPS_1_6 1 +#endif + +#ifndef HAVE_CUPS_1_6 +#define ippGetCount(attr) attr->num_values +#define ippGetGroupTag(attr) attr->group_tag +#define ippGetValueTag(attr) attr->value_tag +#define ippGetName(attr) attr->name +#define ippGetBoolean(attr, element) attr->values[element].boolean +#define ippGetInteger(attr, element) attr->values[element].integer +#define ippGetStatusCode(ipp) ipp->request.status.status_code +#define ippGetString(attr, element, language) attr->values[element].string.text + +static ipp_attribute_t * ippFirstAttribute( ipp_t *ipp ) +{ + if (!ipp) + return (NULL); + return (ipp->current = ipp->attrs); +} + +static ipp_attribute_t * ippNextAttribute( ipp_t *ipp ) +{ + if (!ipp || !ipp->current) + return (NULL); + return (ipp->current = ipp->current->next); +} + +static int ippSetOperation( ipp_t *ipp, ipp_op_t op ) +{ + ipp->request.op.operation_id = op; + return (1); +} + +static int ippSetRequestId( ipp_t *ipp, int request_id ) +{ + ipp->request.any.request_id = request_id; + return (1); +} +#endif + + int get_value_and_param_array(short id, short** value, char*** param) { int count; @@ -689,8 +731,8 @@ else { pRequest = ippNew(); - pRequest->request.op.operation_id = CUPS_GET_PRINTERS; - pRequest->request.op.request_id = 1; + ippSetOperation(pRequest, CUPS_GET_PRINTERS); + ippSetRequestId(pRequest, 1); pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19 @@ -699,29 +741,29 @@ 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) { fputs("ERROR: IPP ERROR\n", stderr); goto onErr; } 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(pAttribute); } 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, ""); } - 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, ""); } - pAttribute = pAttribute->next; + pAttribute = ippNextAttribute(pAttribute); } if (strcasecmp(pDestName, pPrinter) == 0) { @@ -730,7 +772,7 @@ } if (pAttribute != NULL) - pAttribute = pAttribute->next; + pAttribute = ippNextAttribute(pAttribute); } }