]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add CUPS_DEST_FLAGS_DEVICE flag for cupsConnectDest.
authorMichael Sweet <michael.r.sweet@gmail.com>
Tue, 20 Jun 2017 17:08:15 +0000 (13:08 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Tue, 20 Jun 2017 17:08:15 +0000 (13:08 -0400)
CHANGES.md
cups/cups.h
cups/dest.c

index 5d950f4776dd0f9a16f764b6925af7f837c42419..ad51b0debefad3f5c128bce6644374cabd6da068 100644 (file)
@@ -9,12 +9,12 @@ CHANGES IN CUPS V2.2.4
   (Issue #4989)
 - The CUPS build system now supports cross-compilation (Issue #4897)
 - Added a new CUPS Programming Manual to replace the aging API documentation.
-- Added the cupsAddIntegerOption and cupsGetIntegerOption functions
+- Added the `cupsAddIntegerOption` and `cupsGetIntegerOption` functions
   (Issue #4992)
-- The cupsGetDests and cupsCreateJob functions now support Bonjour printers
+- The `cupsGetDests` and `cupsCreateJob` functions now support Bonjour printers
   (Issue #4993)
 - Added a USB quirk rule for Lexmark E260dn printers (Issue #4994)
-- Fixed a potential buffer overflow in the cupstestppd utility (Issue #4996)
+- Fixed a potential buffer overflow in the `cupstestppd` utility (Issue #4996)
 - IPP Everywhere improvements (Issue #4998)
 - Fixed the "cancel all jobs" function in the web interface for several
   languages (Issue #4999)
@@ -26,11 +26,15 @@ CHANGES IN CUPS V2.2.4
   haven't yet been added (Issue #5006)
 - Fixed a typo in the mime.types file.
 - Fixed a bug in the Spanish web interface template (Issue #5016)
-- The cupsEnumDests* and cupsGetDest* functions now report the value of the
+- The `cupsEnumDests*` and `cupsGetDest*` functions now report the value of the
   "printer-is-temporary" Printer Status attribute (Issue #5028)
 - Added Chinese localization (Issue #5029)
-- The cupsCheckDestSupported function did not support NULL values (Issue #5031)
+- The `cupsCheckDestSupported` function did not support `NULL` values
+  (Issue #5031)
 - Fixed some issues in the RPM spec file (Issue #5032)
+- The `cupsConnectDest` function now supports the `CUPS_DEST_FLAGS_DEVICE` flag
+  for explicitly connecting to the device (printer) associated with the
+  destination.
 
 
 CHANGES IN CUPS V2.2.3
index ce299da70a3c05d01fcf30ea34f55e9a9fc734f3..a73cf7aebe41f6bafaee0ca836925543b6bdeb7c 100644 (file)
@@ -92,6 +92,8 @@ extern "C" {
                                        /* A connection is being established */
 #  define CUPS_DEST_FLAGS_CANCELED     0x40
                                        /* Operation was canceled */
+#  define CUPS_DEST_FLAGS_DEVICE        0x80
+                                        /* For @link cupsConnectDest@: Connect to device */
 
 /* Flags for cupsGetDestMediaByName/Size */
 #  define CUPS_MEDIA_FLAGS_DEFAULT     0x00
index 3ff285d8c2e446b54b30c3afc08bca34c0b78705..5cc5c3d947e408dced6fd3a2eb5291f34930cc8d 100644 (file)
@@ -579,6 +579,11 @@ _cupsAppleSetUseLastPrinter(
  * returns 0.  The caller is responsible for calling @link httpClose@ on the
  * returned connection.
  *
+ * Starting with CUPS 2.2.4, the caller can pass  @code CUPS_DEST_FLAGS_DEVICE@
+ * for the "flags" argument to connect directly to the device associated with
+ * the destination.  Otherwise, the connection is made to the CUPS scheduler
+ * associated with the destination.
+ *
  * @since CUPS 1.6/macOS 10.8@
  */
 
@@ -630,7 +635,20 @@ cupsConnectDest(
   * Grab the printer URI...
   */
 
-  if ((uri = cupsGetOption("printer-uri-supported", dest->num_options, dest->options)) == NULL)
+  if (flags & CUPS_DEST_FLAGS_DEVICE)
+  {
+    if ((uri = cupsGetOption("resolved-device-uri", dest->num_options, dest->options)) == NULL)
+    {
+      if ((uri = cupsGetOption("device-uri", dest->num_options, dest->options)) != NULL)
+      {
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+        if (strstr(uri, "._tcp"))
+          uri = cups_dnssd_resolve(dest, uri, msec, cancel, cb, user_data);
+#endif /* HAVE_DNSSD || HAVE_AVAHI */
+      }
+    }
+  }
+  else if ((uri = cupsGetOption("printer-uri-supported", dest->num_options, dest->options)) == NULL)
   {
     if ((uri = cupsGetOption("resolved-device-uri", dest->num_options, dest->options)) == NULL)
     {
@@ -755,6 +773,11 @@ cupsConnectDest(
  * pointed to by "cancel" is non-zero, or the block returns 0.  The caller is
  * responsible for calling @link httpClose@ on the returned connection.
  *
+ * Starting with CUPS 2.2.4, the caller can pass  @code CUPS_DEST_FLAGS_DEVICE@
+ * for the "flags" argument to connect directly to the device associated with
+ * the destination.  Otherwise, the connection is made to the CUPS scheduler
+ * associated with the destination.
+ *
  * @since CUPS 1.6/macOS 10.8@ @exclude all@
  */