[cups.development] Device Uri

Naa Nu getmorek at gmail.com
Thu Jan 27 20:28:32 PST 2011


Thanks Michael Sweet.

On Thu, Jan 27, 2011 at 9:32 PM, Michael Sweet <msweet at apple.com> wrote:

> On Jan 27, 2011, at 5:45 AM, Naa Nu wrote:
> > Hello,
> >
> > How can i get the Device URI using any CUPS method  or any subscription
> attribute method.
>
> The device URI of an existing print queue? Use the
> IPP_GET_PRINTER_ATTRIBUTES request like so:
>
>    #include <cups/cups.h>
>
>    const char *printer; /* printer name */
>    ipp_t *request, *response;
>    ipp_attribute_t *device_uri;
>    char printer_uri[1024];
>
>    httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri),
> "ipp", NULL, "localhost", 0, "/printers/%s", printer);
>
>    request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
>    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
> NULL, printer_uri);
>    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
> "requested-attributes", NULL, "device-uri");
>
>    response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
>
>    device_uri = ippFindAttribute(response, "device-uri", IPP_TAG_URI);
>    /* device-uri string is in device_uri->values[0].string.text */
>
> ________________________________________________________________________
> Michael Sweet, Senior Printing System Engineer, PWG Chair
>
> _______________________________________________
> cups-dev mailing list
> cups-dev at easysw.com
> http://lists.easysw.com/mailman/listinfo/cups-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cups.org/pipermail/cups/attachments/20110127/3f80ed01/attachment.html>


More information about the cups mailing list