[cups] how to use IPP_OP_GET_PRINTER_SUPPORTED_VALUES to get supportedvalues

Fish Shu shumenghui at gmail.com
Tue Apr 14 05:15:30 PDT 2015

I want to use request = ippNewRequest(IPP_GET_PRINTER_SUPPORTED_VALUES)to
get printer's supportedvalues like color_supported or duplex_supported,but
How to? thinks for you help. I tried using the following method´╝îbut failed.

#include <iostream>

#include <cups/cups.h>

using namespace std;

int main(int argc, char *argv) {

    char uri[HTTP_MAX_URI;

    std::string result;
    ipp_t *request, *answer;
    ipp_attribute_t *attr;
    httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
                     "localhost", 0, "/printers/%s", argv[1]);

    request = ippNewRequest(IPP_GET_PRINTER_SUPPORTED_VALUES);
    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
                                               "attributes-charset", NULL,
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
NULL, "en");

    answer = cupsDoRequest (NULL, request, "/");

    for (attr = ippFirstAttribute (answer); attr; attr = ippNextAttribute
        std::cout << ippGetName (attr) <<  std::endl;
        if(ippGetString (attr, 0 ,NULL) )
            std::cout << ippGetString (attr, 0 ,NULL) << std::endl;
            std::cout << "NULL"<< std::endl;
    return 0;


More information about the cups mailing list