MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cups_dnssd_resolve

Function cups_dnssd_resolve

cups/dest.c:3272–3316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3270 */
3271
3272static const char * /* O - Resolved URI or NULL */
3273cups_dnssd_resolve(
3274 cups_dest_t *dest, /* I - Destination */
3275 const char *uri, /* I - Current printer URI */
3276 int msec, /* I - Time in milliseconds */
3277 int *cancel, /* I - Pointer to "cancel" variable */
3278 cups_dest_cb_t cb, /* I - Callback */
3279 void *user_data) /* I - User data for callback */
3280{
3281 char tempuri[1024]; /* Temporary URI buffer */
3282 _cups_dnssd_resolve_t resolve; /* Resolve data */
3283
3284
3285 /*
3286 * Resolve the URI...
3287 */
3288
3289 resolve.cancel = cancel;
3290 resolve.end_time = _cupsGetClock();
3291 if (msec > 0)
3292 resolve.end_time += 0.001 * msec;
3293 else
3294 resolve.end_time += 75.0;
3295
3296 if (cb)
3297 (*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_RESOLVING, dest);
3298
3299 if ((uri = _httpResolveURI(uri, tempuri, sizeof(tempuri), _HTTP_RESOLVE_DEFAULT, cups_dnssd_resolve_cb, &resolve)) == NULL)
3300 {
3301 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unable to resolve printer-uri."), 1);
3302
3303 if (cb)
3304 (*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_ERROR, dest);
3305
3306 return (NULL);
3307 }
3308
3309 /*
3310 * Save the resolved URI...
3311 */
3312
3313 dest->num_options = cupsAddOption("device-uri", uri, dest->num_options, &dest->options);
3314
3315 return (cupsGetOption("device-uri", dest->num_options, dest->options));
3316}
3317
3318
3319/*

Callers 3

cupsConnectDestFunction · 0.85
_cupsGetDestResourceFunction · 0.85
cupsSetDests2Function · 0.85

Calls 4

_cupsGetClockFunction · 0.85
_cupsSetErrorFunction · 0.85
cupsAddOptionFunction · 0.85
cupsGetOptionFunction · 0.85

Tested by

no test coverage detected