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

Function cupsGetDevices

cups/getdevices.c:35–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 */
34
35ipp_status_t /* O - Request status - @code IPP_OK@ on success. */
36cupsGetDevices(
37 http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
38 int timeout, /* I - Timeout in seconds or @code CUPS_TIMEOUT_DEFAULT@ */
39 const char *include_schemes, /* I - Comma-separated URI schemes to include or @code CUPS_INCLUDE_ALL@ */
40 const char *exclude_schemes, /* I - Comma-separated URI schemes to exclude or @code CUPS_EXCLUDE_NONE@ */
41 cups_device_cb_t callback, /* I - Callback function */
42 void *user_data) /* I - User data pointer */
43{
44 ipp_t *request, /* CUPS-Get-Devices request */
45 *response; /* CUPS-Get-Devices response */
46 ipp_attribute_t *attr; /* Current attribute */
47 const char *device_class, /* device-class value */
48 *device_id, /* device-id value */
49 *device_info, /* device-info value */
50 *device_location, /* device-location value */
51 *device_make_and_model, /* device-make-and-model value */
52 *device_uri; /* device-uri value */
53 int blocking; /* Current blocking-IO mode */
54 cups_option_t option; /* in/exclude-schemes option */
55 http_status_t status; /* HTTP status of request */
56 ipp_state_t state; /* IPP response state */
57
58
59 /*
60 * Range check input...
61 */
62
63 DEBUG_printf(("cupsGetDevices(http=%p, timeout=%d, include_schemes=\"%s\", exclude_schemes=\"%s\", callback=%p, user_data=%p)", (void *)http, timeout, include_schemes, exclude_schemes, (void *)callback, user_data));
64
65 if (!callback)
66 return (IPP_STATUS_ERROR_INTERNAL);
67
68 if (!http)
69 http = _cupsConnect();
70
71 if (!http)
72 return (IPP_STATUS_ERROR_SERVICE_UNAVAILABLE);
73
74 /*
75 * Create a CUPS-Get-Devices request...
76 */
77
78 request = ippNewRequest(IPP_OP_CUPS_GET_DEVICES);
79
80 if (timeout > 0)
81 ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "timeout",
82 timeout);
83
84 if (include_schemes)
85 {
86 option.name = "include-schemes";
87 option.value = (char *)include_schemes;
88
89 cupsEncodeOptions2(request, 1, &option, IPP_TAG_OPERATION);
90 }
91
92 if (exclude_schemes)

Callers 2

do_am_printerFunction · 0.85
show_devicesFunction · 0.85

Calls 15

_cupsConnectFunction · 0.85
ippNewRequestFunction · 0.85
ippAddIntegerFunction · 0.85
cupsEncodeOptions2Function · 0.85
cupsSendRequestFunction · 0.85
ippLengthFunction · 0.85
httpUpdateFunction · 0.85
httpFlushFunction · 0.85
cupsDoAuthenticationFunction · 0.85
httpReconnect2Function · 0.85
ippDeleteFunction · 0.85
_cupsSetHTTPErrorFunction · 0.85

Tested by

no test coverage detected