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

Function cupsConnectDest

cups/dest.c:586–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584 */
585
586http_t * /* O - Connection to destination or @code NULL@ */
587cupsConnectDest(
588 cups_dest_t *dest, /* I - Destination */
589 unsigned flags, /* I - Connection flags */
590 int msec, /* I - Timeout in milliseconds */
591 int *cancel, /* I - Pointer to "cancel" variable */
592 char *resource, /* I - Resource buffer */
593 size_t resourcesize, /* I - Size of resource buffer */
594 cups_dest_cb_t cb, /* I - Callback function */
595 void *user_data) /* I - User data pointer */
596{
597 const char *uri; /* Printer URI */
598 char scheme[32], /* URI scheme */
599 userpass[256], /* Username and password (unused) */
600 hostname[256], /* Hostname */
601 tempresource[1024]; /* Temporary resource buffer */
602 int port; /* Port number */
603 char portstr[16]; /* Port number string */
604 http_encryption_t encryption; /* Encryption to use */
605 http_addrlist_t *addrlist; /* Address list for server */
606 http_t *http; /* Connection to server */
607
608
609 DEBUG_printf(("cupsConnectDest(dest=%p, flags=0x%x, msec=%d, cancel=%p(%d), resource=\"%s\", resourcesize=" CUPS_LLFMT ", cb=%p, user_data=%p)", (void *)dest, flags, msec, (void *)cancel, cancel ? *cancel : -1, resource, CUPS_LLCAST resourcesize, (void *)cb, user_data));
610
611 /*
612 * Range check input...
613 */
614
615 if (!dest)
616 {
617 if (resource)
618 *resource = '\0';
619
620 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
621 return (NULL);
622 }
623
624 if (!resource || resourcesize < 1)
625 {
626 resource = tempresource;
627 resourcesize = sizeof(tempresource);
628 }
629
630 /*
631 * Grab the printer URI...
632 */
633
634 if (flags & CUPS_DEST_FLAGS_DEVICE)
635 {
636 if ((uri = cupsGetOption("device-uri", dest->num_options, dest->options)) != NULL)
637 {
638#ifdef HAVE_DNSSD
639 if (strstr(uri, "._tcp"))
640 uri = cups_dnssd_resolve(dest, uri, msec, cancel, cb, user_data);
641#endif /* HAVE_DNSSD */
642 }
643 }

Callers 4

list_optionsFunction · 0.85
mainFunction · 0.85
cupsConnectDestBlockFunction · 0.85
run_queryFunction · 0.85

Calls 10

_cupsSetErrorFunction · 0.85
cupsGetOptionFunction · 0.85
cups_dnssd_resolveFunction · 0.85
_cupsCreateDestFunction · 0.85
cupsAddOptionFunction · 0.85
httpSeparateURIFunction · 0.85
httpAddrGetListFunction · 0.85
httpAddrFreeListFunction · 0.85
httpConnect2Function · 0.85
httpReconnect2Function · 0.85

Tested by 2

mainFunction · 0.68
run_queryFunction · 0.68