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

Function cupsGetDests2

cups/dest.c:1647–1719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1645 */
1646
1647int /* O - Number of destinations */
1648cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
1649 cups_dest_t **dests) /* O - Destinations */
1650{
1651 _cups_getdata_t data; /* Enumeration data */
1652
1653
1654 DEBUG_printf(("cupsGetDests2(http=%p, dests=%p)", (void *)http, (void *)dests));
1655
1656/*
1657 * Range check the input...
1658 */
1659
1660 if (!dests)
1661 {
1662 _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad NULL dests pointer"), 1);
1663 DEBUG_puts("1cupsGetDests2: NULL dests pointer, returning 0.");
1664 return (0);
1665 }
1666
1667 /*
1668 * Connect to the server as needed...
1669 */
1670
1671 if (!http)
1672 {
1673 if ((http = _cupsConnect()) == NULL)
1674 {
1675 *dests = NULL;
1676
1677 return (0);
1678 }
1679 }
1680
1681 /*
1682 * Grab the printers and classes...
1683 */
1684
1685 data.num_dests = 0;
1686 data.dests = NULL;
1687
1688 if (!httpAddrLocalhost(httpGetAddress(http)))
1689 {
1690 /*
1691 * When talking to a remote cupsd, just enumerate printers on the remote
1692 * cupsd.
1693 */
1694
1695 cups_enum_dests(http, 0, _CUPS_DNSSD_GET_DESTS, NULL, 0, CUPS_PRINTER_DISCOVERED, (cups_dest_cb_t)cups_get_cb, &data);
1696 }
1697 else
1698 {
1699 /*
1700 * When talking to a local cupsd, enumerate both local printers and ones we
1701 * can find on the network...
1702 */
1703
1704 cups_enum_dests(http, 0, _CUPS_DNSSD_GET_DESTS, NULL, 0, 0, (cups_dest_cb_t)cups_get_cb, &data);

Callers 2

mainFunction · 0.85
cupsGetDestsFunction · 0.85

Calls 5

_cupsSetErrorFunction · 0.85
_cupsConnectFunction · 0.85
httpAddrLocalhostFunction · 0.85
httpGetAddressFunction · 0.85
cups_enum_destsFunction · 0.85

Tested by 1

mainFunction · 0.68