uri[1024]; // Printer URI
cups_ptype_t type = CUPS_PTYPE_DISCOVERED | CUPS_PTYPE_BW;
// Printer type
+ const char *uuid; // Printer UUID
bool saw_printer_type = false;
// Did we see a printer-type key?
int i; // Looping var
cups_dest_t *local; // Local printer
+ device->dest.num_options = cupsAddOption("UUID", value, device->dest.num_options,&device->dest.options);
+
for (i = data->num_local, local = data->local_dests; i > 0; i --, local ++)
{
const char *local_uuid = cupsGetOption("printer-uuid", local->num_options, local->options);
// Save the URI...
cups_dnssd_unquote(uriname, device->fullname, sizeof(uriname));
- httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), !strcmp(device->regtype, "_ipps._tcp") ? "ipps" : "ipp", NULL, uriname, 0, saw_printer_type ? "/cups" : "/");
+ if ((uuid = cupsGetOption("UUID", device->dest.num_options, device->dest.options)) != NULL)
+ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "dnssd", NULL, uriname, 0, saw_printer_type ? "/cups?uuid=%s" : "/?uuid=%s", uuid);
+ else
+ httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), "dnssd", NULL, uriname, 0, saw_printer_type ? "/cups" : "/");
DEBUG_printf("6cups_dnssd_query: device-uri=\"%s\"", uri);
char name[128], /* Sanitized printer name */
*nameptr, /* Pointer into name */
uri[1024]; /* printer-uri-supported value */
- const char *ptr; /* Pointer into attribute value */
+ const char *ptr, /* Pointer into attribute value */
+ *device_uri_ptr; /* Pointer into device URI */
char scheme[HTTP_MAX_URI], /* Scheme portion of URI */
userpass[HTTP_MAX_URI], /* Username portion of URI */
host[HTTP_MAX_URI], /* Host portion of URI */
return;
}
- ptr = ippGetString(device_uri, 0, NULL);
+ device_uri_ptr = ippGetString(device_uri, 0, NULL);
- if (!ptr || !ptr[0] || (strncmp(ptr, "ipp://", 6) && strncmp(ptr, "ipps://", 7)))
+ if (!device_uri_ptr || !device_uri_ptr[0] || (strncmp(device_uri_ptr, "dnssd://", 8) && strncmp(device_uri_ptr, "ipp://", 6) && strncmp(device_uri_ptr, "ipps://", 7)))
{
send_ipp_status(con, IPP_STATUS_ERROR_NOT_POSSIBLE, _("Bad device-uri \"%s\"."), ptr);
for (printer = (cupsd_printer_t *)cupsArrayGetFirst(Printers); printer; printer = (cupsd_printer_t *)cupsArrayGetNext(Printers))
{
- if (printer->device_uri && !strcmp(ptr, printer->device_uri))
+ if (printer->device_uri && !strcmp(device_uri_ptr, printer->device_uri))
{
printer->state_time = time(NULL);
send_ipp_status(con, IPP_STATUS_OK, _("Printer \"%s\" already exists."), printer->name);