http_t *http; /* Connection to server */
+ DEBUG_printf(("cupsConnectDest(dest=%p, flags=0x%x, msec=%d, cancel=%p(%d), resource=\"%s\", resourcesize=" CUPS_LLFMT ", cb=%p, user_data=%p)", dest, flags, msec, cancel, cancel ? *cancel : -1, resource, CUPS_LLCAST resourcesize, cb, user_data));
+
/*
* Range check input...
*/
request = ippNewRequest(IPP_OP_CUPS_CREATE_LOCAL_PRINTER);
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, "ipp://localhost/");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL, device_uri);
}
dest->name = _cupsStrAlloc(name);
- dest->num_options = cupsAddOption("printer-uri-supported", uri, dest->num_options, &(dest->options));
+ dest->num_options = cupsAddOption("device-uri", uri, dest->num_options, &(dest->options));
dest->num_options = cupsAddOption("printer-info", name, dest->num_options, &(dest->options));
return (dest);
resolve.end_time.tv_sec += 75;
if (cb)
- (*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_RESOLVING,
- dest);
+ (*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_RESOLVING, dest);
if ((uri = _httpResolveURI(uri, tempuri, sizeof(tempuri), _HTTP_RESOLVE_FQDN, cups_dnssd_resolve_cb, &resolve)) == NULL)
{
* If the cancel variable is set, return immediately.
*/
- if (*resolve->cancel)
+ if (resolve->cancel && *(resolve->cancel))
+ {
+ DEBUG_puts("4cups_dnssd_resolve_cb: Canceled.");
return (0);
+ }
/*
* Otherwise check the end time...
gettimeofday(&curtime, NULL);
- return (curtime.tv_sec > resolve->end_time.tv_sec ||
+ DEBUG_printf(("4cups_dnssd_resolve_cb: curtime=%d.%06d, end_time=%d.%06d", (int)curtime.tv_sec, curtime.tv_usec, (int)resolve->end_time.tv_sec, resolve->end_time.tv_usec));
+
+ return (curtime.tv_sec < resolve->end_time.tv_sec ||
(curtime.tv_sec == resolve->end_time.tv_sec &&
- curtime.tv_usec > resolve->end_time.tv_usec));
+ curtime.tv_usec < resolve->end_time.tv_usec));
}
/*
- * "$Id$"
- *
* HTTP support routines for CUPS.
*
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
#endif /* DEBUG */
- DEBUG_printf(("4_httpResolveURI(uri=\"%s\", resolved_uri=%p, "
- "resolved_size=" CUPS_LLFMT ")", uri, resolved_uri,
- CUPS_LLCAST resolved_size));
+ DEBUG_printf(("_httpResolveURI(uri=\"%s\", resolved_uri=%p, resolved_size=" CUPS_LLFMT ", options=0x%x, cb=%p, context=%p)", uri, resolved_uri, CUPS_LLCAST resolved_size, options, cb, context));
/*
* Get the device URI...
if (options & _HTTP_RESOLVE_STDERR)
_cupsLangPrintFilter(stderr, "ERROR", _("Bad device-uri \"%s\"."), uri);
- DEBUG_printf(("6_httpResolveURI: httpSeparateURI returned %d!", status));
- DEBUG_puts("5_httpResolveURI: Returning NULL");
+ DEBUG_printf(("2_httpResolveURI: httpSeparateURI returned %d!", status));
+ DEBUG_puts("2_httpResolveURI: Returning NULL");
return (NULL);
}
if (regtype <= hostname)
{
- DEBUG_puts("5_httpResolveURI: Bad hostname, returning NULL");
+ DEBUG_puts("2_httpResolveURI: Bad hostname, returning NULL");
return (NULL);
}
uribuf.resource = resource;
uribuf.uuid = uuid;
- DEBUG_printf(("6_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
+ DEBUG_printf(("2_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
"domain=\"%s\"\n", hostname, regtype, domain));
if (options & _HTTP_RESOLVE_STDERR)
{
if (cb && !(*cb)(context))
{
- DEBUG_puts("5_httpResolveURI: callback returned 0 (stop)");
+ DEBUG_puts("2_httpResolveURI: callback returned 0 (stop)");
break;
}
{
if (errno != EINTR && errno != EAGAIN)
{
- DEBUG_printf(("5_httpResolveURI: poll error: %s", strerror(errno)));
+ DEBUG_printf(("2_httpResolveURI: poll error: %s", strerror(errno)));
break;
}
}
uri = resolved_uri;
}
- DEBUG_printf(("5_httpResolveURI: Returning \"%s\"", uri));
+ DEBUG_printf(("2_httpResolveURI: Returning \"%s\"", uri));
return (uri);
}
uint8_t valueLen; /* Length of value */
- DEBUG_printf(("7http_resolve_cb(sdRef=%p, flags=%x, interfaceIndex=%u, "
+ DEBUG_printf(("4http_resolve_cb(sdRef=%p, flags=%x, interfaceIndex=%u, "
"errorCode=%d, fullName=\"%s\", hostTarget=\"%s\", port=%u, "
"txtLen=%u, txtRecord=%p, context=%p)", sdRef, flags,
interfaceIndex, errorCode, fullName, hostTarget, port, txtLen,
fprintf(stderr, "DEBUG: Found UUID %s, looking for %s.", uuid,
uribuf->uuid);
- DEBUG_printf(("7http_resolve_cb: Found UUID %s, looking for %s.", uuid,
+ DEBUG_printf(("5http_resolve_cb: Found UUID %s, looking for %s.", uuid,
uribuf->uuid));
return;
}
http_addrlist_t *addrlist, /* List of addresses */
*addr; /* Current address */
- DEBUG_printf(("8http_resolve_cb: Looking up \"%s\".", hostTarget));
+ DEBUG_printf(("5http_resolve_cb: Looking up \"%s\".", hostTarget));
snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port));
if ((addrlist = httpAddrGetList(hostTarget, AF_UNSPEC, fqdn)) != NULL)
if (!error)
{
- DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
+ DEBUG_printf(("5http_resolve_cb: Found \"%s\".", fqdn));
if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
_cups_strcasecmp(hostptr, ".local"))
}
#ifdef DEBUG
else
- DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
+ DEBUG_printf(("5http_resolve_cb: \"%s\" did not resolve: %d",
httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
error));
#endif /* DEBUG */
else
httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, (int)uribuf->bufsize, scheme, NULL, hostTarget, ntohs(port), resource);
- DEBUG_printf(("8http_resolve_cb: Resolved URI is \"%s\"...", uribuf->buffer));
+ DEBUG_printf(("5http_resolve_cb: Resolved URI is \"%s\"...", uribuf->buffer));
}
#elif defined(HAVE_AVAHI)
size_t valueLen = 0; /* Length of "rp" key */
- DEBUG_printf(("7http_resolve_cb(resolver=%p, "
+ DEBUG_printf(("4http_resolve_cb(resolver=%p, "
"interface=%d, protocol=%d, event=%d, name=\"%s\", "
"type=\"%s\", domain=\"%s\", hostTarget=\"%s\", address=%p, "
"port=%d, txt=%p, flags=%d, context=%p)",
fprintf(stderr, "DEBUG: Found UUID %s, looking for %s.", uuid,
uribuf->uuid);
- DEBUG_printf(("7http_resolve_cb: Found UUID %s, looking for %s.", uuid,
+ DEBUG_printf(("5http_resolve_cb: Found UUID %s, looking for %s.", uuid,
uribuf->uuid));
return;
}
http_addrlist_t *addrlist, /* List of addresses */
*addr; /* Current address */
- DEBUG_printf(("8http_resolve_cb: Looking up \"%s\".", hostTarget));
+ DEBUG_printf(("5http_resolve_cb: Looking up \"%s\".", hostTarget));
snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port));
if ((addrlist = httpAddrGetList(hostTarget, AF_UNSPEC, fqdn)) != NULL)
if (!error)
{
- DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
+ DEBUG_printf(("5http_resolve_cb: Found \"%s\".", fqdn));
if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
_cups_strcasecmp(hostptr, ".local"))
}
#ifdef DEBUG
else
- DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
+ DEBUG_printf(("5http_resolve_cb: \"%s\" did not resolve: %d",
httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
error));
#endif /* DEBUG */
httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, uribuf->bufsize, scheme,
NULL, hostTarget, port, resource);
- DEBUG_printf(("8http_resolve_cb: Resolved URI is \"%s\".", uribuf->buffer));
+ DEBUG_printf(("5http_resolve_cb: Resolved URI is \"%s\".", uribuf->buffer));
avahi_simple_poll_quit(uribuf->poll);
}
#endif /* HAVE_DNSSD */
-
-
-/*
- * End of "$Id$".
- */