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

Function cupsCopyDestInfo

cups/dest-options.c:675–839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

673 */
674
675cups_dinfo_t * /* O - Destination information */
676cupsCopyDestInfo(
677 http_t *http, /* I - Connection to destination */
678 cups_dest_t *dest) /* I - Destination */
679{
680 cups_dinfo_t *dinfo; /* Destination information */
681 unsigned dflags; /* Destination flags */
682 ipp_t *request, /* Get-Printer-Attributes request */
683 *response; /* Supported attributes */
684 int tries, /* Number of tries so far */
685 delay, /* Current retry delay */
686 prev_delay; /* Next retry delay */
687 const char *uri; /* Printer URI */
688 char resource[1024]; /* URI resource path */
689 int version; /* IPP version */
690 ipp_status_t status; /* Status of request */
691 _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
692 static const char * const requested_attrs[] =
693 { /* Requested attributes */
694 "job-template",
695 "media-col-database",
696 "printer-description"
697 };
698
699
700 DEBUG_printf(("cupsCopyDestInfo(http=%p, dest=%p(%s))", (void *)http, (void *)dest, dest ? dest->name : ""));
701
702 /*
703 * Range check input...
704 */
705
706 if (!dest)
707 return (NULL);
708
709 /*
710 * Get the default connection as needed...
711 */
712
713 if (!http)
714 {
715 DEBUG_puts("1cupsCopyDestInfo: Default server connection.");
716 http = _cupsConnect();
717 dflags = CUPS_DEST_FLAGS_NONE;
718
719 if (!http)
720 return (NULL);
721 }
722#ifdef AF_LOCAL
723 else if (httpAddrFamily(http->hostaddr) == AF_LOCAL)
724 {
725 DEBUG_puts("1cupsCopyDestInfo: Connection to server (domain socket).");
726 dflags = CUPS_DEST_FLAGS_NONE;
727 }
728#endif /* AF_LOCAL */
729 else
730 {
731 // Guess the destination flags based on the printer URI's host and port...
732 char scheme[32], /* URI scheme */

Callers 4

mainFunction · 0.85
cupsCancelDestJobFunction · 0.85
cupsCreateJobFunction · 0.85
run_queryFunction · 0.85

Calls 15

_cupsGlobalsFunction · 0.85
_cupsConnectFunction · 0.85
cupsGetOptionFunction · 0.85
httpSeparateURIFunction · 0.85
httpAddrPortFunction · 0.85
_cupsGetDestResourceFunction · 0.85
ippNewRequestFunction · 0.85
ippSetVersionFunction · 0.85
ippAddStringFunction · 0.85
cupsUserFunction · 0.85
ippAddStringsFunction · 0.85
cupsDoRequestFunction · 0.85

Tested by 2

mainFunction · 0.68
run_queryFunction · 0.68