File cnijfilter-new-cups-ipp.patch of Package cnijfilter-mp495series

--- cnijfilter-source-3.80-1/cngpijmon/src/bjcupsmon_cups.c	2024/06/02 23:04:19	1.1
+++ cnijfilter-source-3.80-1/cngpijmon/src/bjcupsmon_cups.c	2024/06/02 23:27:09
@@ -217,8 +217,9 @@
 	else {
 		pRequest = ippNew();
 		
-		pRequest->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
-		pRequest->request.op.request_id   = 1;
+		ippSetOperation(pRequest, IPP_GET_PRINTER_ATTRIBUTES);
+		ippSetRequestId(pRequest, 1);
+
 		
 		pLanguage = bjcupsLangDefault();			// cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19 
 				
@@ -227,12 +228,12 @@
 		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(pRequest) > 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 = (ipp_state_t)ippGetInteger(pAttribute, 0);
 				}
 			}
 			
@@ -290,8 +291,9 @@
 		else {
 			pRequest = ippNew();
 			
-			pRequest->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
-			pRequest->request.op.request_id   = 1;
+			ippSetOperation(pRequest, IPP_GET_PRINTER_ATTRIBUTES);
+			ippSetRequestId(pRequest, 1);
+
 			
 			pLanguage = bjcupsLangDefault();		// cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
 			
@@ -300,7 +302,7 @@
 			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(pRequest) > IPP_OK_CONFLICT) {
 					retVal = ID_ERR_CUPS_API_FAILED;
 				}
 				else {
@@ -312,7 +314,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);
@@ -371,8 +373,9 @@
 			else {
 				pRequest = ippNew();
 				
-				pRequest->request.op.operation_id = IPP_CANCEL_JOB;
-				pRequest->request.op.request_id   = 1;
+				ippSetOperation(pRequest, IPP_CANCEL_JOB);
+				ippSetRequestId(pRequest, 1);
+
 				
 				pLanguage = bjcupsLangDefault();		// cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
 				
@@ -383,7 +386,7 @@
 				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(pRequest) > IPP_OK_CONFLICT) {
 						retVal = ID_ERR_CUPS_API_FAILED;
 					}
 					ippDelete(pResponse);
@@ -446,8 +449,8 @@
 	else {
 		pRequest = ippNew();
 		
-		pRequest->request.op.operation_id = IPP_GET_JOBS;
-		pRequest->request.op.request_id   = 1;
+		ippSetOperation(pRequest, IPP_GET_JOBS);
+		ippSetRequestId(pRequest, 1);
 		
 		pLanguage = bjcupsLangDefault();	// cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
 		
@@ -458,31 +461,31 @@
 		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(pRequest) > 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 = (ipp_jstate_t)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) {
@@ -499,7 +502,7 @@
 					}
 
 					if (pAttribute != NULL)
-						pAttribute = pAttribute->next;
+						pAttribute = ippNextAttribute(pResponse);
 				}
 			}
 			
@@ -557,8 +560,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
 		
@@ -567,28 +570,27 @@
 		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.
@@ -605,7 +607,7 @@
 					}
 
 					if (pAttribute != NULL)
-						 pAttribute = pAttribute->next;
+						pAttribute = ippNextAttribute(pResponse);
 				}
 			}
 			
@@ -660,8 +662,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
 		
@@ -670,28 +672,28 @@
 		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) {
@@ -700,7 +702,7 @@
 					}
 					
 					if (pAttribute != NULL)
-						 pAttribute = pAttribute->next;
+						pAttribute = ippNextAttribute(pResponse);
 				}
 			}
 			
--- cnijfilter-source-3.80-1/cngpij/cngpij/bjcups.c	2024/06/02 23:38:11	1.1
+++ cnijfilter-source-3.80-1/cngpij/cngpij/bjcups.c	2024/06/02 23:44:31
@@ -700,8 +700,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
 		
@@ -710,29 +710,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(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) {
@@ -741,7 +741,7 @@
 					}
 					
 					if (pAttribute != NULL)
-						 pAttribute = pAttribute->next;
+						pAttribute = ippNextAttribute(pResponse);
 				}
 			}
 			
--- cnijfilter-source-3.80-1/cngpijmnt/src/main.c	2024/06/02 23:46:07	1.1
+++ cnijfilter-source-3.80-1/cngpijmnt/src/main.c	2024/06/02 23:59:21
@@ -321,8 +321,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
 		
@@ -331,29 +331,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(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) {
@@ -362,7 +362,7 @@
 					}
 					
 					if (pAttribute != NULL)
-						 pAttribute = pAttribute->next;
+						pAttribute = ippNextAttribute(pResponse);
 				}
 			}
 			
openSUSE Build Service is sponsored by