CUPS API Programming Guide

Michael R Sweet

Copyright 2007-2017 by Apple Inc.

Contents

Overview

The IPP Sample project provides APIs for IPP client and server applications in the "cups" library. Most library functions are accessed by including the <cups/cups.h> header, while the raster functions are found in the <cups/raster.h> header.

Compiling Programs

The library can be used from any C, C++, or Objective C program. The method of compiling against the library varies depending on the operating system and installation of the IPP Sample project.

The following simple program lists the available printers on the network:

#include <stdio.h>
#include <cups/cups.h>

int main(void)
{
  int i;
  cups_dest_t *dests, *dest;
  int num_dests = cupsGetDests(&dests);

  for (i = num_dests, dest = dests; i > 0; i --, dest ++)
  {
    if (dest->instance)
      printf("%s/%s\n", dest->name, dest->instance);
    else
      puts(dest->name);
  }

  return (0);
}

CUPS API

The CUPS API provides the convenience functions needed to support applications, filters, printer drivers, and backends that need to interface with the CUPS scheduler.

Clients and Servers

CUPS is based on the Internet Printing Protocol ("IPP"), which allows clients (applications) to communicate with a server (the scheduler) to get a list of printers, send print jobs, and so forth. You identify which server you want to communicate with using a pointer to the opaque structure http_t. All of the examples in this document use the CUPS_HTTP_DEFAULT constant, referring to the default connection to the scheduler. The HTTP and IPP APIs document provides more information on server connections.

Printers and Classes

Printers and classes (collections of printers) are accessed through the cups_dest_t structure which includes the name (name), instance (instance - a way of selecting certain saved options/settings), and the options and attributes associated with that destination (num_options and options). Destinations are created using the cupsGetDests function and freed using the cupsFreeDests function. The cupsGetDest function finds a specific destination for printing:

#include <cups/cups.h>

cups_dest_t *dests;
int num_dests = cupsGetDests(&dests);
cups_dest_t *dest = cupsGetDest("name", NULL, num_dests, dests);

/* do something with dest */

cupsFreeDests(num_dests, dests);

Passing NULL to cupsGetDest for the destination name will return the default destination. Similarly, passing a NULL instance will return the default instance for that destination.

Table 1: Printer Attributes
Attribute Name Description
"auth-info-required" The type of authentication required for printing to this destination: "none", "username,password", "domain,username,password", or "negotiate" (Kerberos)
"printer-info" The human-readable description of the destination such as "My Laser Printer".
"printer-is-accepting-jobs" "true" if the destination is accepting new jobs, "false" if not.
"printer-is-shared" "true" if the destination is being shared with other computers, "false" if not.
"printer-location" The human-readable location of the destination such as "Lab 4".
"printer-make-and-model" The human-readable make and model of the destination such as "HP LaserJet 4000 Series".
"printer-state" "3" if the destination is idle, "4" if the destination is printing a job, and "5" if the destination is stopped.
"printer-state-change-time" The UNIX time when the destination entered the current state.
"printer-state-reasons" Additional comma-delimited state keywords for the destination such as "media-tray-empty-error" and "toner-low-warning".
"printer-type" The cups_printer_t value associated with the destination.

Options

Options are stored in arrays of cups_option_t structures. Each option has a name (name) and value (value) associated with it. The cups_dest_t num_options and options members contain the default options for a particular destination, along with several informational attributes about the destination as shown in Table 1. The cupsGetOption function gets the value for the named option. For example, the following code lists the available destinations and their human-readable descriptions:

#include <cups/cups.h>

cups_dest_t *dests;
int num_dests = cupsGetDests(&dests);
cups_dest_t *dest;
int i;
const char *value;

for (i = num_dests, dest = dests; i > 0; i --, dest ++)
  if (dest->instance == NULL)
  {
    value = cupsGetOption("printer-info", dest->num_options, dest->options);
    printf("%s (%s)\n", dest->name, value ? value : "no description");
  }

cupsFreeDests(num_dests, dests);

You can create your own option arrays using the cupsAddOption function, which adds a single named option to an array:

#include <cups/cups.h>

int num_options = 0;
cups_option_t *options = NULL;

/* The returned num_options value is updated as needed */
num_options = cupsAddOption("first", "value", num_options, &options);

/* This adds a second option value */
num_options = cupsAddOption("second", "value", num_options, &options);

/* This replaces the first option we added */
num_options = cupsAddOption("first", "new value", num_options, &options);

Use a for loop to copy the options from a destination:

#include <cups/cups.h>

int i;
int num_options = 0;
cups_option_t *options = NULL;
cups_dest_t *dest;

for (i = 0; i < dest->num_options; i ++)
  num_options = cupsAddOption(dest->options[i].name, dest->options[i].value,
                              num_options, &options);

Use the cupsFreeOptions function to free the options array when you are done using it:

cupsFreeOptions(num_options, options);

Print Jobs

Print jobs are identified by a locally-unique job ID number from 1 to 231-1 and have options and one or more files for printing to a single destination. The cupsPrintFile function creates a new job with one file. The following code prints the CUPS test page file:

#include <cups/cups.h>

cups_dest_t *dest;
int num_options;
cups_option_t *options;
int job_id;

/* Print a single file */
job_id = cupsPrintFile(dest->name, "/usr/share/cups/data/testprint.ps",
                        "Test Print", num_options, options);

The cupsPrintFiles function creates a job with multiple files. The files are provided in a char * array:

#include <cups/cups.h>

cups_dest_t *dest;
int num_options;
cups_option_t *options;
int job_id;
char *files[3] = { "file1.pdf", "file2.pdf", "file3.pdf" };

/* Print three files */
job_id = cupsPrintFiles(dest->name, 3, files, "Test Print", num_options, options);

Finally, the cupsCreateJob function creates a new job with no files in it. Files are added using the cupsStartDocument, cupsWriteRequestData, and cupsFinishDocument functions. The following example creates a job with 10 text files for printing:

#include <cups/cups.h>

cups_dest_t *dest;
int num_options;
cups_option_t *options;
int job_id;
int i;
char buffer[1024];

/* Create the job */
job_id = cupsCreateJob(CUPS_HTTP_DEFAULT, dest->name, "10 Text Files",
                       num_options, options);

/* If the job is created, add 10 files */
if (job_id > 0)
{
  for (i = 1; i <= 10; i ++)
  {
    snprintf(buffer, sizeof(buffer), "file%d.txt", i);

    cupsStartDocument(CUPS_HTTP_DEFAULT, dest->name, job_id, buffer,
                      CUPS_FORMAT_TEXT, i == 10);

    snprintf(buffer, sizeof(buffer),
             "File %d\n"
             "\n"
             "One fish,\n"
             "Two fish,\n
             "Red fish,\n
             "Blue fish\n", i);

    /* cupsWriteRequestData can be called as many times as needed */
    cupsWriteRequestData(CUPS_HTTP_DEFAULT, buffer, strlen(buffer));

    cupsFinishDocument(CUPS_HTTP_DEFAULT, dest->name);
  }
}

Once you have created a job, you can monitor its status using the cupsGetJobs function, which returns an array of cups_job_t structures. Each contains the job ID (id), destination name (dest), title (title), and other information associated with the job. The job array is freed using the cupsFreeJobs function. The following example monitors a specific job ID, showing the current job state once every 5 seconds until the job is completed:

#include <cups/cups.h>

cups_dest_t *dest;
int job_id;
int num_jobs;
cups_job_t *jobs;
int i;
ipp_jstate_t job_state = IPP_JOB_PENDING;

while (job_state < IPP_JOB_STOPPED)
{
  /* Get my jobs (1) with any state (-1) */
  num_jobs = cupsGetJobs(&jobs, dest->name, 1, -1);

  /* Loop to find my job */
  job_state = IPP_JOB_COMPLETED;

  for (i = 0; i < num_jobs; i ++)
    if (jobs[i].id == job_id)
    {
      job_state = jobs[i].state;
      break;
    }

  /* Free the job array */
  cupsFreeJobs(num_jobs, jobs);

  /* Show the current state */
  switch (job_state)
  {
    case IPP_JOB_PENDING :
        printf("Job %d is pending.\n", job_id);
        break;
    case IPP_JOB_HELD :
        printf("Job %d is held.\n", job_id);
        break;
    case IPP_JOB_PROCESSING :
        printf("Job %d is processing.\n", job_id);
        break;
    case IPP_JOB_STOPPED :
        printf("Job %d is stopped.\n", job_id);
        break;
    case IPP_JOB_CANCELED :
        printf("Job %d is canceled.\n", job_id);
        break;
    case IPP_JOB_ABORTED :
        printf("Job %d is aborted.\n", job_id);
        break;
    case IPP_JOB_COMPLETED :
        printf("Job %d is completed.\n", job_id);
        break;
  }

  /* Sleep if the job is not finished */
  if (job_state < IPP_JOB_STOPPED)
    sleep(5);
}

To cancel a job, use the cupsCancelJob function with the job ID:

#include <cups/cups.h>

cups_dest_t *dest;
int job_id;

cupsCancelJob(dest->name, job_id);

Error Handling

If any of the CUPS API printing functions returns an error, the reason for that error can be found by calling the cupsLastError and cupsLastErrorString functions. cupsLastError returns the last IPP error code (ipp_status_t) that was encountered, while cupsLastErrorString returns a (localized) human-readable string that can be shown to the user. For example, if any of the job creation functions returns a job ID of 0, you can use cupsLastErrorString to show the reason why the job could not be created:

#include <cups/cups.h>

int job_id;

if (job_id == 0)
  puts(cupsLastErrorString());

Passwords and Authentication

CUPS supports authentication of any request, including submission of print jobs. The default mechanism for getting the username and password is to use the login user and a password from the console.

To support other types of applications, in particular Graphical User Interfaces ("GUIs"), the CUPS API provides functions to set the default username and to register a callback function that returns a password string.

The cupsSetPasswordCB function is used to set a password callback in your program. Only one function can be used at any time.

The cupsSetUser function sets the current username for authentication. This function can be called by your password callback function to change the current username as needed.

The following example shows a simple password callback that gets a username and password from the user:

#include <cups/cups.h>

const char *
my_password_cb(const char *prompt)
{
  char	user[65];


  puts(prompt);

  /* Get a username from the user */
  printf("Username: ");
  if (fgets(user, sizeof(user), stdin) == NULL)
    return (NULL);

  /* Strip the newline from the string and set the user */
  user[strlen(user) - 1] = '\0';

  cupsSetUser(user);

  /* Use getpass() to ask for the password... */
  return (getpass("Password: "));
}

cupsSetPasswordCB(my_password_cb);

Similarly, a GUI could display the prompt string in a window with input fields for the username and password. The username should default to the string returned by the cupsUser function.

HTTP and IPP APIs

The CUPS HTTP and IPP APIs provide low-level access to the HTTP and IPP protocols and CUPS scheduler. They are typically used by monitoring and administration programs to perform specific functions not supported by the high-level CUPS API functions.

The HTTP APIs use an opaque structure called http_t to manage connections to a particular HTTP or IPP server. The httpConnectEncrypt function is used to create an instance of this structure for a particular server. The constant CUPS_HTTP_DEFAULT can be used with all of the cups functions to refer to the default CUPS server - the functions create a per-thread http_t as needed.

The IPP APIs use two opaque structures for requests (messages sent to the CUPS scheduler) and responses (messages sent back to your application from the scheduler). The ipp_t type holds a complete request or response and is allocated using the ippNew or ippNewRequest functions and freed using the ippDelete function.

The second opaque structure is called ipp_attribute_t and holds a single IPP attribute which consists of a group tag (ippGetGroupTag), a value type tag (ippGetValueTag), the attribute name (ippGetName), and 1 or more values (ippGetCount, ippGetBoolean, ippGetCollection, ippGetDate, ippGetInteger, ippGetRange, ippGetResolution, and ippGetString). Attributes are added to an ipp_t pointer using one of the ippAdd functions. For example, use ippAddString to add the "printer-uri" and "requesting-user-name" string attributes to a request:

ipp_t *request = ippNewRequest(IPP_GET_JOBS);

ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
             NULL, "ipp://localhost/printers/");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
             NULL, cupsUser());

Once you have created an IPP request, use the cups functions to send the request to and read the response from the server. For example, the cupsDoRequest function can be used for simple query operations that do not involve files:

#include <cups/cups.h>


ipp_t *get_jobs(void)
{
  ipp_t *request = ippNewRequest(IPP_GET_JOBS);

  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
               NULL, "ipp://localhost/printers/");
  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
               NULL, cupsUser());

  return (cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/"));
}

The cupsDoRequest function frees the request and returns an IPP response or NULL pointer if the request could not be sent to the server. Once you have a response from the server, you can either use the ippFindAttribute and ippFindNextAttribute functions to find specific attributes, for example:

ipp_t *response;
ipp_attribute_t *attr;

attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM);

You can also walk the list of attributes with a simple for loop like this:

ipp_t *response;
ipp_attribute_t *attr;

for (attr = ippFirstAttribute(response); attr != NULL; attr = ippNextAttribute(response))
  if (ippGetName(attr) == NULL)
    puts("--SEPARATOR--");
  else
    puts(ippGetName(attr));

The for loop approach is normally used when collecting attributes for multiple objects (jobs, printers, etc.) in a response. Attributes with NULL names indicate a separator between the attributes of each object. For example, the following code will list the jobs returned from our previous get_jobs example code:

ipp_t *response = get_jobs();

if (response != NULL)
{
  ipp_attribute_t *attr;
  const char *attrname;
  int job_id = 0;
  const char *job_name = NULL;
  const char *job_originating_user_name = NULL;

  puts("Job ID  Owner             Title");
  puts("------  ----------------  ---------------------------------");

  for (attr = ippFirstAttribute(response); attr != NULL; attr = ippNextAttribute(response))
  {
   /* Attributes without names are separators between jobs */
    attrname = ippGetName(attr);
    if (attrname == NULL)
    {
      if (job_id > 0)
      {
        if (job_name == NULL)
          job_name = "(withheld)";

        if (job_originating_user_name == NULL)
          job_originating_user_name = "(withheld)";

        printf("%5d  %-16s  %s\n", job_id, job_originating_user_name, job_name);
      }

      job_id = 0;
      job_name = NULL;
      job_originating_user_name = NULL;
      continue;
    }
    else if (!strcmp(attrname, "job-id") && ippGetValueTag(attr) == IPP_TAG_INTEGER)
      job_id = ippGetInteger(attr, 0);
    else if (!strcmp(attrname, "job-name") && ippGetValueTag(attr) == IPP_TAG_NAME)
      job_name = ippGetString(attr, 0, NULL);
    else if (!strcmp(attrname, "job-originating-user-name") &&
             ippGetValueTag(attr) == IPP_TAG_NAME)
      job_originating_user_name = ippGetString(attr, 0, NULL);
  }

  if (job_id > 0)
  {
    if (job_name == NULL)
      job_name = "(withheld)";

    if (job_originating_user_name == NULL)
      job_originating_user_name = "(withheld)";

    printf("%5d  %-16s  %s\n", job_id, job_originating_user_name, job_name);
  }
}

Creating URI Strings

To ensure proper encoding, the httpAssembleURIf function must be used to format a "printer-uri" string for all printer-based requests:

const char *name = "Foo";
char uri[1024];
ipp_t *request;

httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, cupsServer(),
                 ippPort(), "/printers/%s", name);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);

Sending Requests with Files

The cupsDoFileRequest and cupsDoIORequest functions are used for requests involving files. The cupsDoFileRequest function attaches the named file to a request and is typically used when sending a print file or changing a printer's PPD file:

const char *filename = "/usr/share/cups/data/testprint.ps";
const char *name = "Foo";
char uri[1024];
char resource[1024];
ipp_t *request = ippNewRequest(IPP_PRINT_JOB);
ipp_t *response;

/* Use httpAssembleURIf for the printer-uri string */
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, cupsServer(),
                 ippPort(), "/printers/%s", name);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
             NULL, cupsUser());
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
             NULL, "testprint.ps");

/* Use snprintf for the resource path */
snprintf(resource, sizeof(resource), "/printers/%s", name);

response = cupsDoFileRequest(CUPS_HTTP_DEFAULT, request, resource, filename);

The cupsDoIORequest function optionally attaches a file to the request and optionally saves a file in the response from the server. It is used when using a pipe for the request attachment or when using a request that returns a file, currently only CUPS_GET_DOCUMENT and CUPS_GET_PPD. For example, the following code will download the PPD file for the sample HP LaserJet printer driver:

char tempfile[1024];
int tempfd;
ipp_t *request = ippNewRequest(CUPS_GET_PPD);
ipp_t *response;

ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name",
             NULL, "laserjet.ppd");

tempfd = cupsTempFd(tempfile, sizeof(tempfile));

response = cupsDoIORequest(CUPS_HTTP_DEFAULT, request, "/", -1, tempfd);

The example passes -1 for the input file descriptor to specify that no file is to be attached to the request. The PPD file attached to the response is written to the temporary file descriptor we created using the cupsTempFd function.

Asynchronous Request Processing

The cupsSendRequest and cupsGetResponse support asynchronous communications with the server. Unlike the other request functions, the IPP request is not automatically freed, so remember to free your request with the ippDelete function.

File data is attached to the request using the cupsWriteRequestData function, while file data returned from the server is read using the cupsReadResponseData function. We can rewrite the previous CUPS_GET_PPD example to use the asynchronous functions quite easily:

char tempfile[1024];
int tempfd;
ipp_t *request = ippNewRequest(CUPS_GET_PPD);
ipp_t *response;

ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name",
             NULL, "laserjet.ppd");

tempfd = cupsTempFd(tempfile, sizeof(tempfile));

if (cupsSendRequest(CUPS_HTTP_DEFAULT, request, "/") == HTTP_CONTINUE)
{
  response = cupsGetResponse(CUPS_HTTP_DEFAULT, "/");

  if (response != NULL)
  {
    ssize_t bytes;
    char buffer[8192];

    while ((bytes = cupsReadResponseData(CUPS_HTTP_DEFAULT, buffer, sizeof(buffer))) > 0)
      write(tempfd, buffer, bytes);
  }
}

/* Free the request! */
ippDelete(request);

The cupsSendRequest function returns the initial HTTP request status, typically either HTTP_CONTINUE or HTTP_UNAUTHORIZED. The latter status is returned when the request requires authentication of some sort. The cupsDoAuthentication function must be called when your see HTTP_UNAUTHORIZED and the request re-sent. We can add authentication support to our example code by using a do ... while loop:

char tempfile[1024];
int tempfd;
ipp_t *request = ippNewRequest(CUPS_GET_PPD);
ipp_t *response;
http_status_t status;

ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name",
             NULL, "laserjet.ppd");

tempfd = cupsTempFd(tempfile, sizeof(tempfile));

/* Loop for authentication */
do
{
  status = cupsSendRequest(CUPS_HTTP_DEFAULT, request, "/");

  if (status == HTTP_UNAUTHORIZED)
  {
    /* Try to authenticate, break out of the loop if that fails */
    if (cupsDoAuthentication(CUPS_HTTP_DEFAULT, "POST", "/"))
      break;
  }
}
while (status != HTTP_CONTINUE && status != HTTP_UNAUTHORIZED);

if (status == HTTP_CONTINUE)
{
  response = cupsGetResponse(CUPS_HTTP_DEFAULT, "/");

  if (response != NULL)
  {
    ssize_t bytes;
    char buffer[8192];

    while ((bytes = cupsReadResponseData(CUPS_HTTP_DEFAULT, buffer, sizeof(buffer))) > 0)
      write(tempfd, buffer, bytes);
  }
}

/* Free the request! */
ippDelete(request);

Raster API

The CUPS raster API provides a standard interface for reading and writing CUPS raster streams which are used for printing to raster printers. Because the raster format is updated from time to time, it is important to use this API to avoid incompatibilities with newer versions of CUPS.

Two kinds of CUPS filters use the CUPS raster API - raster image processor (RIP) filters such as pstoraster and cgpdftoraster (macOS) that produce CUPS raster files and printer driver filters that convert CUPS raster files into a format usable by the printer. Printer driver filters are by far the most common.

CUPS raster files (application/vnd.cups-raster) consists of a stream of raster page descriptions produced by one of the RIP filters such as pstoraster, imagetoraster, or cgpdftoraster. CUPS raster files are referred to using the cups_raster_t type and are opened using the cupsRasterOpen function. For example, to read raster data from the standard input, open file descriptor 0:

#include <cups/raster.h>>

cups_raster_t *ras = cupsRasterOpen(0, CUPS_RASTER_READ);

Each page of data begins with a page dictionary structure called cups_page_header2_t. This structure contains the colorspace, bits per color, media size, media type, hardware resolution, and so forth used for the page.

You read the page header using the cupsRasterReadHeader2 function:

#include <cups/raster.h>>

cups_raster_t *ras = cupsRasterOpen(0, CUPS_RASTER_READ);
cups_page_header2_t header;

while (cupsRasterReadHeader2(ras, &header))
{
  /* setup this page */

  /* read raster data */

  /* finish this page */
}

After the page dictionary comes the page data which is a full-resolution, possibly compressed bitmap representing the page in the printer's output colorspace. You read uncompressed raster data using the cupsRasterReadPixels function. A for loop is normally used to read the page one line at a time:

#include <cups/raster.h>>

cups_raster_t *ras = cupsRasterOpen(0, CUPS_RASTER_READ);
cups_page_header2_t header;
int page = 0;
int y;
char *buffer;

while (cupsRasterReadHeader2(ras, &header))
{
  /* setup this page */
  page ++;
  fprintf(stderr, "PAGE: %d %d\n", page, header.NumCopies);

  /* allocate memory for 1 line */
  buffer = malloc(header.cupsBytesPerLine);

  /* read raster data */
  for (y = 0; y < header.cupsHeight; y ++)
  {
    if (cupsRasterReadPixels(ras, buffer, header.cupsBytesPerLine) == 0)
      break;

    /* write raster data to printer on stdout */
  }

  /* finish this page */
}

When you are done reading the raster data, call the cupsRasterClose function to free the memory used to read the raster file:

cups_raster_t *ras;

cupsRasterClose(ras);

Functions

cupsAddDest

Add a destination to the list of destinations.

int cupsAddDest (
    const char *name,
    const char *instance,
    int num_dests,
    cups_dest_t **dests
);

Parameters

name
Destination name
instance
Instance name or NULL for none/primary
num_dests
Number of destinations
dests
Destinations

Return Value

New number of destinations

Discussion

This function cannot be used to add a new class or printer queue, it only adds a new container of saved options for the named destination or instance.

If the named destination already exists, the destination list is returned unchanged. Adding a new instance of a destination creates a copy of that destination's options.

Use the cupsSaveDests function to save the updated list of destinations to the user's lpoptions file.

cupsAddOption

Add an option to an option array.

int cupsAddOption (
    const char *name,
    const char *value,
    int num_options,
    cups_option_t **options
);

Parameters

name
Name of option
value
Value of option
num_options
Number of options
options
Pointer to options

Return Value

Number of options

Discussion

New option arrays can be initialized simply by passing 0 for the "num_options" parameter.

cupsCancelDestJob

Include necessary headers...

ipp_status_t cupsCancelDestJob (
    http_t *http,
    cups_dest_t *dest,
    int job_id
);

Parameters

http
Connection to destination
dest
Destination
job_id
Job ID

Return Value

Cancel a job on a destination.

The "job_id" is the number returned by cupsCreateDestJob.

Returns IPP_STATUS_OK on success and IPP_STATUS_ERRPR_NOT_AUTHORIZED or IPP_STATUS_ERROR_FORBIDDEN on failure.

cupsCancelJob

Cancel a print job on the default server.

int cupsCancelJob (
    const char *name,
    int job_id
);

Parameters

name
Name of printer or class
job_id
Job ID, CUPS_JOBID_CURRENT for the current job, or CUPS_JOBID_ALL for all jobs

Return Value

1 on success, 0 on failure

Discussion

Pass CUPS_JOBID_ALL to cancel all jobs or CUPS_JOBID_CURRENT to cancel the current job on the named destination.

Use the cupsLastError and cupsLastErrorString functions to get the cause of any failure.

 CUPS 1.4/macOS 10.6 cupsCancelJob2

Cancel or purge a print job.

ipp_status_t cupsCancelJob2 (
    http_t *http,
    const char *name,
    int job_id,
    int purge
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
name
Name of printer or class
job_id
Job ID, CUPS_JOBID_CURRENT for the current job, or CUPS_JOBID_ALL for all jobs
purge
1 to purge, 0 to cancel

Return Value

IPP status

Discussion

Canceled jobs remain in the job history while purged jobs are removed from the job history.

Pass CUPS_JOBID_ALL to cancel all jobs or CUPS_JOBID_CURRENT to cancel the current job on the named destination.

Use the cupsLastError and cupsLastErrorString functions to get the cause of any failure.

 CUPS 1.6/macOS 10.8 cupsCheckDestSupported

Check that the option and value are supported by the destination.

int cupsCheckDestSupported (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    const char *option,
    const char *value
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
option
Option
value
Value

Return Value

1 if supported, 0 otherwise

Discussion

Returns 1 if supported, 0 otherwise.

 CUPS 1.6/macOS 10.8 cupsCloseDestJob

Close a job and start printing.

ipp_status_t cupsCloseDestJob (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *info,
    int job_id
);

Parameters

http
Connection to destination
dest
Destination
info
Destination information
job_id
Job ID

Return Value

IPP status code

Discussion

Use when the last call to cupsStartDocument passed 0 for "last_document". "job_id" is the job ID returned by cupsCreateDestJob. Returns IPP_STATUS_OK on success.

 CUPS 1.6/macOS 10.8 cupsConnectDest

Connect to the server for a destination.

http_t *cupsConnectDest (
    cups_dest_t *dest,
    unsigned flags,
    int msec,
    int *cancel,
    char *resource,
    size_t resourcesize,
    cups_dest_cb_t cb,
    void *user_data
);

Parameters

dest
Destination
flags
Connection flags
msec
Timeout in milliseconds
cancel
Pointer to "cancel" variable
resource
Resource buffer
resourcesize
Size of resource buffer
cb
Callback function
user_data
User data pointer

Return Value

Connection to server or NULL

Discussion

Connect to the destination, returning a new http_t connection object and optionally the resource path to use for the destination. These calls will block until a connection is made, the timeout expires, the integer pointed to by "cancel" is non-zero, or the callback function (or block) returns 0, The caller is responsible for calling httpClose() on the returned object.

 CUPS 1.6/macOS 10.8 cupsConnectDestBlock

Connect to the server for a destination.

http_t *cupsConnectDestBlock (
    cups_dest_t *dest,
    unsigned flags,
    int msec,
    int *cancel,
    char *resource,
    size_t resourcesize,
    cups_dest_block_t block
);

Parameters

dest
Destination
flags
Connection flags
msec
Timeout in milliseconds
cancel
Pointer to "cancel" variable
resource
Resource buffer
resourcesize
Size of resource buffer
block
Callback block

Return Value

Connection to server or NULL

Discussion

Connect to the destination, returning a new http_t connection object and optionally the resource path to use for the destination. These calls will block until a connection is made, the timeout expires, the integer pointed to by "cancel" is non-zero, or the callback function (or block) returns 0, The caller is responsible for calling httpClose() on the returned object.

cupsCopyDest

Callback block

int cupsCopyDest (
    cups_dest_t *dest,
    int num_dests,
    cups_dest_t **dests
);

Parameters

dest
num_dests
dests

Return Value

Copy a destination.

Make a copy of the destination to an array of destinations (or just a single copy) - for use with the cupsEnumDests* functions. The caller is responsible for calling cupsFreeDests() on the returned object(s).

 CUPS 1.6/macOS 10.8 cupsCopyDestConflicts

Get conflicts and resolutions for a new option/value pair.

int cupsCopyDestConflicts (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    int num_options,
    cups_option_t *options,
    const char *new_option,
    const char *new_value,
    int *num_conflicts,
    cups_option_t **conflicts,
    int *num_resolved,
    cups_option_t **resolved
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
num_options
Number of current options
options
Current options
new_option
New option
new_value
New value
num_conflicts
Number of conflicting options
conflicts
Conflicting options
num_resolved
Number of options to resolve
resolved
Resolved options

Return Value

1 if there is a conflict, 0 if none, -1 on error

Discussion

"num_options" and "options" represent the currently selected options by the user. "new_option" and "new_value" are the setting the user has just changed.

Returns 1 if there is a conflict, 0 if there are no conflicts, and -1 if there was an unrecoverable error such as a resolver loop.

If "num_conflicts" and "conflicts" are not NULL, they are set to contain the list of conflicting option/value pairs. Similarly, if "num_resolved" and "resolved" are not NULL they will be set to the list of changes needed to resolve the conflict.

If cupsCopyDestConflicts returns 1 but "num_resolved" and "resolved" are set to 0 and NULL, respectively, then the conflict cannot be resolved.

 CUPS 1.6/macOS 10.8 cupsCopyDestInfo

Get the supported values/capabilities for the destination.

cups_dinfo_t *cupsCopyDestInfo (
    http_t *http,
    cups_dest_t *dest
);

Parameters

http
Connection to destination
dest
Destination

Return Value

Destination information

Discussion

The caller is responsible for calling cupsFreeDestInfo on the return value. NULL is returned on error.

 CUPS 1.6/macOS 10.8 cupsCreateDestJob

Create a job on a destination.

ipp_status_t cupsCreateDestJob (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *info,
    int *job_id,
    const char *title,
    int num_options,
    cups_option_t *options
);

Parameters

http
Connection to destination
dest
Destination
info
Destination information
job_id
Job ID or 0 on error
title
Job name
num_options
Number of job options
options
Job options

Return Value

IPP status code

Discussion

Returns IPP_STATUS_OK or IPP_STATUS_OK_SUBST on success, saving the job ID in the variable pointed to by "job_id".

 CUPS 1.4/macOS 10.6 cupsCreateJob

Create an empty job for streaming.

int cupsCreateJob (
    http_t *http,
    const char *name,
    const char *title,
    int num_options,
    cups_option_t *options
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
name
Destination name
title
Title of job
num_options
Number of options
options
Options

Return Value

Job ID or 0 on error

Discussion

Use this function when you want to stream print data using the cupsStartDocument, cupsWriteRequestData, and cupsFinishDocument functions. If you have one or more files to print, use the cupsPrintFile2 or cupsPrintFiles2 function instead.

 CUPS 1.1.20/macOS 10.4 cupsDoAuthentication

Authenticate a request.

int cupsDoAuthentication (
    http_t *http,
    const char *method,
    const char *resource
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
method
Request method ("GET", "POST", "PUT")
resource
Resource path

Return Value

0 on success, -1 on error

Discussion

This function should be called in response to a HTTP_STATUS_UNAUTHORIZED status, prior to resubmitting your request.

cupsDoFileRequest

Do an IPP request with a file.

ipp_t *cupsDoFileRequest (
    http_t *http,
    ipp_t *request,
    const char *resource,
    const char *filename
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
request
IPP request
resource
HTTP resource for POST
filename
File to send or NULL for none

Return Value

Response data

Discussion

This function sends the IPP request and attached file to the specified server, retrying and authenticating as necessary. The request is freed with ippDelete.

 CUPS 1.3/macOS 10.5 cupsDoIORequest

Do an IPP request with file descriptors.

ipp_t *cupsDoIORequest (
    http_t *http,
    ipp_t *request,
    const char *resource,
    int infile,
    int outfile
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
request
IPP request
resource
HTTP resource for POST
infile
File to read from or -1 for none
outfile
File to write to or -1 for none

Return Value

Response data

Discussion

This function sends the IPP request with the optional input file "infile" to the specified server, retrying and authenticating as necessary. The request is freed with ippDelete.

If "infile" is a valid file descriptor, cupsDoIORequest copies all of the data from the file after the IPP request message.

If "outfile" is a valid file descriptor, cupsDoIORequest copies all of the data after the IPP response message to the file.

cupsDoRequest

Do an IPP request.

ipp_t *cupsDoRequest (
    http_t *http,
    ipp_t *request,
    const char *resource
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
request
IPP request
resource
HTTP resource for POST

Return Value

Response data

Discussion

This function sends the IPP request to the specified server, retrying and authenticating as necessary. The request is freed with ippDelete.

cupsEncodeOptions

Encode printer options into IPP attributes.

void cupsEncodeOptions (
    ipp_t *ipp,
    int num_options,
    cups_option_t *options
);

Parameters

ipp
Request to add to
num_options
Number of options
options
Options

Discussion

This function adds operation, job, and then subscription attributes, in that order. Use the cupsEncodeOptions2() function to add attributes for a single group.

 CUPS 1.2/macOS 10.5 cupsEncodeOptions2

Encode printer options into IPP attributes for a group.

void cupsEncodeOptions2 (
    ipp_t *ipp,
    int num_options,
    cups_option_t *options,
    ipp_tag_t group_tag
);

Parameters

ipp
Request to add to
num_options
Number of options
options
Options
group_tag
Group to encode

Discussion

This function only adds attributes for a single group. Call this function multiple times for each group, or use cupsEncodeOptions() to add the standard groups.

cupsEncryption

Get the current encryption settings.

http_encryption_t cupsEncryption (void);

Return Value

Encryption settings

Discussion

The default encryption setting comes from the CUPS_ENCRYPTION environment variable, then the ~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not set, the default is HTTP_ENCRYPTION_IF_REQUESTED.

Note: The current encryption setting is tracked separately for each thread in a program. Multi-threaded programs that override the setting via the cupsSetEncryption function need to do so in each thread for the same setting to be used.

 CUPS 1.6/macOS 10.8 cupsEnumDests

Enumerate available destinations with a callback function.

int cupsEnumDests (
    unsigned flags,
    int msec,
    int *cancel,
    cups_ptype_t type,
    cups_ptype_t mask,
    cups_dest_cb_t cb,
    void *user_data
);

Parameters

flags
Enumeration flags
msec
Timeout in milliseconds, -1 for indefinite
cancel
Pointer to "cancel" variable
type
Printer type bits
mask
Mask for printer type bits
cb
Callback function
user_data
User data

Return Value

1 on success, 0 on failure

Discussion

Destinations are enumerated from one or more sources. The callback function receives the user_data pointer, destination name, instance, number of options, and options which can be used as input to the cupsAddDest function. The function must return 1 to continue enumeration or 0 to stop.

Enumeration happens on the current thread and does not return until all destinations have been enumerated or the callback function returns 0.

 CUPS 1.6/macOS 10.8 cupsEnumDestsBlock

Enumerate available destinations with a block.

int cupsEnumDestsBlock (
    unsigned flags,
    int timeout,
    int *cancel,
    cups_ptype_t type,
    cups_ptype_t mask,
    cups_dest_block_t block
);

Parameters

flags
Enumeration flags
timeout
Timeout in milliseconds, 0 for indefinite
cancel
Pointer to "cancel" variable
type
Printer type bits
mask
Mask for printer type bits
block
Block

Return Value

1 on success, 0 on failure

Discussion

Destinations are enumerated from one or more sources. The block receives the destination name, instance, number of options, and options which can be used as input to the cupsAddDest function. The block must return 1 to continue enumeration or 0 to stop.

Enumeration happens on the current thread and does not return until all destinations have been enumerated or the block returns 0.

 CUPS 1.7/macOS 10.9 cupsFindDestDefault

Find the default value(s) for the given option.

ipp_attribute_t *cupsFindDestDefault (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    const char *option
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
option
Option/attribute name

Return Value

Default attribute or NULL for none

Discussion

The returned value is an IPP attribute. Use the ippGetBoolean, ippGetCollection, ippGetCount, ippGetDate, ippGetInteger, ippGetOctetString, ippGetRange, ippGetResolution, ippGetString, and ippGetValueTag functions to inspect the default value(s) as needed.

 CUPS 1.7/macOS 10.9 cupsFindDestReady

Find the default value(s) for the given option.

ipp_attribute_t *cupsFindDestReady (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    const char *option
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
option
Option/attribute name

Return Value

Default attribute or NULL for none

Discussion

The returned value is an IPP attribute. Use the ippGetBoolean, ippGetCollection, ippGetCount, ippGetDate, ippGetInteger, ippGetOctetString, ippGetRange, ippGetResolution, ippGetString, and ippGetValueTag functions to inspect the default value(s) as needed.

 CUPS 1.7/macOS 10.9 cupsFindDestSupported

Find the default value(s) for the given option.

ipp_attribute_t *cupsFindDestSupported (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    const char *option
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
option
Option/attribute name

Return Value

Default attribute or NULL for none

Discussion

The returned value is an IPP attribute. Use the ippGetBoolean, ippGetCollection, ippGetCount, ippGetDate, ippGetInteger, ippGetOctetString, ippGetRange, ippGetResolution, ippGetString, and ippGetValueTag functions to inspect the default value(s) as needed.

 CUPS 1.6/macOS 10.8 cupsFinishDestDocument

Finish the current document.

ipp_status_t cupsFinishDestDocument (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *info
);

Parameters

http
Connection to destination
dest
Destination
info
Destination information

Return Value

Status of document submission

Discussion

Returns IPP_STATUS_OK or IPP_STATUS_OK_SUBST on success.

 CUPS 1.4/macOS 10.6 cupsFinishDocument

Finish sending a document.

ipp_status_t cupsFinishDocument (
    http_t *http,
    const char *name
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
name
Destination name

Return Value

Status of document submission

Discussion

The document must have been started using cupsStartDocument.

cupsFreeDestInfo

Free destination information obtained using cupsCopyDestInfo.

void cupsFreeDestInfo (
    cups_dinfo_t *dinfo
);

Parameters

dinfo
Destination information

cupsFreeDests

Free the memory used by the list of destinations.

void cupsFreeDests (
    int num_dests,
    cups_dest_t *dests
);

Parameters

num_dests
Number of destinations
dests
Destinations

cupsFreeJobs

Free memory used by job data.

void cupsFreeJobs (
    int num_jobs,
    cups_job_t *jobs
);

Parameters

num_jobs
Number of jobs
jobs
Jobs

cupsFreeOptions

Free all memory used by options.

void cupsFreeOptions (
    int num_options,
    cups_option_t *options
);

Parameters

num_options
Number of options
options
Pointer to options

 DEPRECATED cupsGetClasses

Get a list of printer classes from the default server.

int cupsGetClasses (
    char ***classes
);

Parameters

classes
Classes

Return Value

Number of classes

Discussion

This function is deprecated and no longer returns a list of printer classes - use cupsGetDests instead.

cupsGetDefault

Get the default printer or class for the default server.

const char *cupsGetDefault (void);

Return Value

Default printer or NULL

Discussion

This function returns the default printer or class as defined by the LPDEST or PRINTER environment variables. If these environment variables are not set, the server default destination is returned. Applications should use the cupsGetDests and cupsGetDest functions to get the user-defined default printer, as this function does not support the lpoptions-defined default printer.

 CUPS 1.1.21/macOS 10.4 cupsGetDefault2

Get the default printer or class for the specified server.

const char *cupsGetDefault2 (
    http_t *http
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT

Return Value

Default printer or NULL

Discussion

This function returns the default printer or class as defined by the LPDEST or PRINTER environment variables. If these environment variables are not set, the server default destination is returned. Applications should use the cupsGetDests and cupsGetDest functions to get the user-defined default printer, as this function does not support the lpoptions-defined default printer.

cupsGetDest

Get the named destination from the list.

cups_dest_t *cupsGetDest (
    const char *name,
    const char *instance,
    int num_dests,
    cups_dest_t *dests
);

Parameters

name
Destination name or NULL for the default destination
instance
Instance name or NULL
num_dests
Number of destinations
dests
Destinations

Return Value

Destination pointer or NULL

Discussion

Use the cupsGetDests or cupsGetDests2 functions to get a list of supported destinations for the current user.

 CUPS 1.7/macOS 10.9 cupsGetDestMediaByIndex

Get a media name, dimension, and margins for a specific size.

int cupsGetDestMediaByIndex (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    int n,
    unsigned flags,
    cups_size_t *size
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
n
Media size number (0-based)
flags
Media flags
size
Media size information

Return Value

1 on success, 0 on failure

Discussion

The flags parameter determines which set of media are indexed. For example, passing CUPS_MEDIA_FLAGS_BORDERLESS will get the Nth borderless size supported by the printer.

 CUPS 1.6/macOS 10.8 cupsGetDestMediaByName

Get media names, dimensions, and margins.

int cupsGetDestMediaByName (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    const char *media,
    unsigned flags,
    cups_size_t *size
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
media
Media name
flags
Media matching flags
size
Media size information

Return Value

1 on match, 0 on failure

Discussion

The "media" string is a PWG media name. "Flags" provides some matching guidance (multiple flags can be combined):

CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer, CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size, CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with 2-sided printing, CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size, and CUPS_MEDIA_FLAGS_READY = if the printer supports media sensing, find the size amongst the "ready" media.

The matching result (if any) is returned in the "cups_size_t" structure.

Returns 1 when there is a match and 0 if there is not a match.

 CUPS 1.6/macOS 10.8 cupsGetDestMediaBySize

Get media names, dimensions, and margins.

int cupsGetDestMediaBySize (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    int width,
    int length,
    unsigned flags,
    cups_size_t *size
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
width
Media width in hundredths of of millimeters
length
Media length in hundredths of of millimeters
flags
Media matching flags
size
Media size information

Return Value

1 on match, 0 on failure

Discussion

"Width" and "length" are the dimensions in hundredths of millimeters. "Flags" provides some matching guidance (multiple flags can be combined):

CUPS_MEDIA_FLAGS_DEFAULT = find the closest size supported by the printer, CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size, CUPS_MEDIA_FLAGS_DUPLEX = find a size compatible with 2-sided printing, CUPS_MEDIA_FLAGS_EXACT = find an exact match for the size, and CUPS_MEDIA_FLAGS_READY = if the printer supports media sensing, find the size amongst the "ready" media.

The matching result (if any) is returned in the "cups_size_t" structure.

Returns 1 when there is a match and 0 if there is not a match.

 CUPS 1.7/macOS 10.9 cupsGetDestMediaCount

Get the number of sizes supported by a destination.

int cupsGetDestMediaCount (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    unsigned flags
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
flags
Media flags

Return Value

Number of sizes

Discussion

The flags parameter determines the set of media sizes that are counted. For example, passing CUPS_MEDIA_FLAGS_BORDERLESS will return the number of borderless sizes.

 CUPS 1.7/macOS 10.9 cupsGetDestMediaDefault

Get the default size for a destination.

int cupsGetDestMediaDefault (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    unsigned flags,
    cups_size_t *size
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
flags
Media flags
size
Media size information

Return Value

1 on success, 0 on failure

Discussion

The flags parameter determines which default size is returned. For example, passing CUPS_MEDIA_FLAGS_BORDERLESS will return the default borderless size, typically US Letter or A4, but sometimes 4x6 photo media.

 CUPS 2.0/macOS 10.10 cupsGetDestWithURI

Get a destination associated with a URI.

cups_dest_t *cupsGetDestWithURI (
    const char *name,
    const char *uri
);

Parameters

name
Desired printer name or NULL
uri
URI for the printer

Return Value

Destination or NULL

Discussion

"name" is the desired name for the printer. If NULL, a name will be created using the URI.

"uri" is the "ipp" or "ipps" URI for the printer.

cupsGetDests

Get the list of destinations from the default server.

int cupsGetDests (
    cups_dest_t **dests
);

Parameters

dests
Destinations

Return Value

Number of destinations

Discussion

Starting with CUPS 1.2, the returned list of destinations include the printer-info, printer-is-accepting-jobs, printer-is-shared, printer-make-and-model, printer-state, printer-state-change-time, printer-state-reasons, and printer-type attributes as options. CUPS 1.4 adds the marker-change-time, marker-colors, marker-high-levels, marker-levels, marker-low-levels, marker-message, marker-names, marker-types, and printer-commands attributes as well.

Use the cupsFreeDests function to free the destination list and the cupsGetDest function to find a particular destination.

 CUPS 1.1.21/macOS 10.4 cupsGetDests2

Get the list of destinations from the specified server.

int cupsGetDests2 (
    http_t *http,
    cups_dest_t **dests
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
dests
Destinations

Return Value

Number of destinations

Discussion

Starting with CUPS 1.2, the returned list of destinations include the printer-info, printer-is-accepting-jobs, printer-is-shared, printer-make-and-model, printer-state, printer-state-change-time, printer-state-reasons, and printer-type attributes as options. CUPS 1.4 adds the marker-change-time, marker-colors, marker-high-levels, marker-levels, marker-low-levels, marker-message, marker-names, marker-types, and printer-commands attributes as well.

Use the cupsFreeDests function to free the destination list and the cupsGetDest function to find a particular destination.

 CUPS 1.1.20/macOS 10.4 cupsGetFd

Get a file from the server.

http_status_t cupsGetFd (
    http_t *http,
    const char *resource,
    int fd
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
resource
Resource name
fd
File descriptor

Return Value

HTTP status

Discussion

This function returns HTTP_STATUS_OK when the file is successfully retrieved.

 CUPS 1.1.20/macOS 10.4 cupsGetFile

Get a file from the server.

http_status_t cupsGetFile (
    http_t *http,
    const char *resource,
    const char *filename
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
resource
Resource name
filename
Filename

Return Value

HTTP status

Discussion

This function returns HTTP_STATUS_OK when the file is successfully retrieved.

cupsGetJobs

Get the jobs from the default server.

int cupsGetJobs (
    cups_job_t **jobs,
    const char *name,
    int myjobs,
    int whichjobs
);

Parameters

jobs
Job data
name
NULL = all destinations, otherwise show jobs for named destination
myjobs
0 = all users, 1 = mine
whichjobs
CUPS_WHICHJOBS_ALL, CUPS_WHICHJOBS_ACTIVE, or CUPS_WHICHJOBS_COMPLETED

Return Value

Number of jobs

Discussion

A "whichjobs" value of CUPS_WHICHJOBS_ALL returns all jobs regardless of state, while CUPS_WHICHJOBS_ACTIVE returns jobs that are pending, processing, or held and CUPS_WHICHJOBS_COMPLETED returns jobs that are stopped, canceled, aborted, or completed.

 CUPS 1.1.21/macOS 10.4 cupsGetJobs2

Get the jobs from the specified server.

int cupsGetJobs2 (
    http_t *http,
    cups_job_t **jobs,
    const char *name,
    int myjobs,
    int whichjobs
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
jobs
Job data
name
NULL = all destinations, otherwise show jobs for named destination
myjobs
0 = all users, 1 = mine
whichjobs
CUPS_WHICHJOBS_ALL, CUPS_WHICHJOBS_ACTIVE, or CUPS_WHICHJOBS_COMPLETED

Return Value

Number of jobs

Discussion

A "whichjobs" value of CUPS_WHICHJOBS_ALL returns all jobs regardless of state, while CUPS_WHICHJOBS_ACTIVE returns jobs that are pending, processing, or held and CUPS_WHICHJOBS_COMPLETED returns jobs that are stopped, canceled, aborted, or completed.

 CUPS 1.4/macOS 10.6 cupsGetNamedDest

Get options for the named destination.

cups_dest_t *cupsGetNamedDest (
    http_t *http,
    const char *name,
    const char *instance
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
name
Destination name or NULL for the default destination
instance
Instance name or NULL

Return Value

Destination or NULL

Discussion

This function is optimized for retrieving a single destination and should be used instead of cupsGetDests and cupsGetDest when you either know the name of the destination or want to print to the default destination. If NULL is returned, the destination does not exist or there is no default destination.

If "http" is CUPS_HTTP_DEFAULT, the connection to the default print server will be used.

If "name" is NULL, the default printer for the current user will be returned.

The returned destination must be freed using cupsFreeDests with a "num_dests" value of 1.

cupsGetOption

Get an option value.

const char *cupsGetOption (
    const char *name,
    int num_options,
    cups_option_t *options
);

Parameters

name
Name of option
num_options
Number of options
options
Options

Return Value

Option value or NULL

cupsGetPassword

Get a password from the user.

const char *cupsGetPassword (
    const char *prompt
);

Parameters

prompt
Prompt string

Return Value

Password

Discussion

Uses the current password callback function. Returns NULL if the user does not provide a password.

Note: The current password callback function is tracked separately for each thread in a program. Multi-threaded programs that override the setting via the cupsSetPasswordCB or cupsSetPasswordCB2 functions need to do so in each thread for the same function to be used.

 CUPS 1.4/macOS 10.6 cupsGetPassword2

Get a password from the user using the advanced password callback.

const char *cupsGetPassword2 (
    const char *prompt,
    http_t *http,
    const char *method,
    const char *resource
);

Parameters

prompt
Prompt string
http
Connection to server or CUPS_HTTP_DEFAULT
method
Request method ("GET", "POST", "PUT")
resource
Resource path

Return Value

Password

Discussion

Uses the current password callback function. Returns NULL if the user does not provide a password.

Note: The current password callback function is tracked separately for each thread in a program. Multi-threaded programs that override the setting via the cupsSetPasswordCB or cupsSetPasswordCB2 functions need to do so in each thread for the same function to be used.

 DEPRECATED cupsGetPrinters

Get a list of printers from the default server.

int cupsGetPrinters (
    char ***printers
);

Parameters

printers
Printers

Return Value

Number of printers

Discussion

This function is deprecated and no longer returns a list of printers - use cupsGetDests instead.

 CUPS 1.4/macOS 10.6 cupsGetResponse

Get a response to an IPP request.

ipp_t *cupsGetResponse (
    http_t *http,
    const char *resource
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
resource
HTTP resource for POST

Return Value

Response or NULL on HTTP error

Discussion

Use this function to get the response for an IPP request sent using cupsSendRequest. For requests that return additional data, use cupsReadResponseData after getting a successful response, otherwise call httpFlush to complete the response processing.

 CUPS 2.2/macOS 10.12 cupsHashData

Perform a hash function on the given data.

ssize_t cupsHashData (
    const char *algorithm,
    const void *data,
    size_t datalen,
    unsigned char *hash,
    size_t hashsize
);

Parameters

algorithm
Algorithm name
data
Data to hash
datalen
Length of data to hash
hash
Hash buffer
hashsize
Size of hash buffer

Return Value

Size of hash or -1 on error

Discussion

The "algorithm" argument can be any of the registered, non-deprecated IPP hash algorithms for the "job-password-encryption" attribute, including "sha" for SHA-1, "sha-256" for SHA2-256, etc.

The "hash" argument points to a buffer of "hashsize" bytes and should be at least 64 bytes in length for all of the supported algorithms.

The returned hash is binary data.

cupsLastError

Return the last IPP status code received on the current thread.

ipp_status_t cupsLastError (void);

Return Value

IPP status code from last request

 CUPS 1.2/macOS 10.5 cupsLastErrorString

Return the last IPP status-message received on the current thread.

const char *cupsLastErrorString (void);

Return Value

status-message text from last request

 CUPS 2.0/macOS 10.10 cupsLocalizeDestMedia

Get the localized string for a destination media size.

const char *cupsLocalizeDestMedia (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    unsigned flags,
    cups_size_t *size
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
flags
Media flags
size
Media size

Return Value

Localized string

Discussion

The returned string is stored in the destination information and will become invalid if the destination information is deleted.

 CUPS 1.6/macOS 10.8 cupsLocalizeDestOption

Get the localized string for a destination option.

const char *cupsLocalizeDestOption (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    const char *option
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
option
Option to localize

Return Value

Localized string

Discussion

The returned string is stored in the destination information and will become invalid if the destination information is deleted.

 CUPS 1.6/macOS 10.8 cupsLocalizeDestValue

Get the localized string for a destination option+value pair.

const char *cupsLocalizeDestValue (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *dinfo,
    const char *option,
    const char *value
);

Parameters

http
Connection to destination
dest
Destination
dinfo
Destination information
option
Option to localize
value
Value to localize

Return Value

Localized string

Discussion

The returned string is stored in the destination information and will become invalid if the destination information is deleted.

 CUPS 1.2/macOS 10.5 cupsNotifySubject

Return the subject for the given notification message.

char *cupsNotifySubject (
    cups_lang_t *lang,
    ipp_t *event
);

Parameters

lang
Language data
event
Event data

Return Value

Subject string or NULL

Discussion

The returned string must be freed by the caller using free.

 CUPS 1.2/macOS 10.5 cupsNotifyText

Return the text for the given notification message.

char *cupsNotifyText (
    cups_lang_t *lang,
    ipp_t *event
);

Parameters

lang
Language data
event
Event data

Return Value

Message text or NULL

Discussion

The returned string must be freed by the caller using free.

cupsParseOptions

Parse options from a command-line argument.

int cupsParseOptions (
    const char *arg,
    int num_options,
    cups_option_t **options
);

Parameters

arg
Argument to parse
num_options
Number of options
options
Options found

Return Value

Number of options found

Discussion

This function converts space-delimited name/value pairs according to the PAPI text option ABNF specification. Collection values ("name={a=... b=... c=...}") are stored with the curley brackets intact - use cupsParseOptions on the value to extract the collection attributes.

cupsPrintFile

Print a file to a printer or class on the default server.

int cupsPrintFile (
    const char *name,
    const char *filename,
    const char *title,
    int num_options,
    cups_option_t *options
);

Parameters

name
Destination name
filename
File to print
title
Title of job
num_options
Number of options
options
Options

Return Value

Job ID or 0 on error

 CUPS 1.1.21/macOS 10.4 cupsPrintFile2

Print a file to a printer or class on the specified server.

int cupsPrintFile2 (
    http_t *http,
    const char *name,
    const char *filename,
    const char *title,
    int num_options,
    cups_option_t *options
);

Parameters

http
Connection to server
name
Destination name
filename
File to print
title
Title of job
num_options
Number of options
options
Options

Return Value

Job ID or 0 on error

cupsPrintFiles

Print one or more files to a printer or class on the default server.

int cupsPrintFiles (
    const char *name,
    int num_files,
    const char **files,
    const char *title,
    int num_options,
    cups_option_t *options
);

Parameters

name
Destination name
num_files
Number of files
files
File(s) to print
title
Title of job
num_options
Number of options
options
Options

Return Value

Job ID or 0 on error

 CUPS 1.1.21/macOS 10.4 cupsPrintFiles2

Print one or more files to a printer or class on the specified server.

int cupsPrintFiles2 (
    http_t *http,
    const char *name,
    int num_files,
    const char **files,
    const char *title,
    int num_options,
    cups_option_t *options
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
name
Destination name
num_files
Number of files
files
File(s) to print
title
Title of job
num_options
Number of options
options
Options

Return Value

Job ID or 0 on error

 CUPS 1.1.20/macOS 10.4 cupsPutFd

Put a file on the server.

http_status_t cupsPutFd (
    http_t *http,
    const char *resource,
    int fd
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
resource
Resource name
fd
File descriptor

Return Value

HTTP status

Discussion

This function returns HTTP_STATUS_CREATED when the file is stored successfully.

 CUPS 1.1.20/macOS 10.4 cupsPutFile

Put a file on the server.

http_status_t cupsPutFile (
    http_t *http,
    const char *resource,
    const char *filename
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
resource
Resource name
filename
Filename

Return Value

HTTP status

Discussion

This function returns HTTP_CREATED when the file is stored successfully.

cupsRasterClose

Close a raster stream.

void cupsRasterClose (
    cups_raster_t *r
);

Parameters

r
Stream to close

Discussion

The file descriptor associated with the raster stream must be closed separately as needed.

 CUPS 1.3/macOS 10.5 cupsRasterErrorString

Return the last error from a raster function.

const char *cupsRasterErrorString (void);

Return Value

Last error

Discussion

If there are no recent errors, NULL is returned.

 CUPS 2.2/macOS 10.12 cupsRasterInitPWGHeader

Initialize a page header for PWG Raster output.

int cupsRasterInitPWGHeader (
    cups_page_header2_t *h,
    pwg_media_t *media,
    const char *type,
    int xdpi,
    int ydpi,
    const char *sides,
    const char *sheet_back
);

Parameters

h
Page header
media
PWG media information
type
PWG raster type string
xdpi
Cross-feed direction (horizontal) resolution
ydpi
Feed direction (vertical) resolution
sides
IPP "sides" option value
sheet_back
Transform for back side or NULL for none

Return Value

1 on success, 0 on failure

Discussion

The "media" argument specifies the media to use.

The "type" argument specifies a "pwg-raster-document-type-supported" value that controls the color space and bit depth of the raster data.

The "xres" and "yres" arguments specify the raster resolution in dots per inch.

The "sheet_back" argument specifies a "pwg-raster-document-sheet-back" value to apply for the back side of a page. Pass NULL for the front side.

cupsRasterOpen

Open a raster stream using a file descriptor.

cups_raster_t *cupsRasterOpen (
    int fd,
    cups_mode_t mode
);

Parameters

fd
File descriptor
mode
Mode - CUPS_RASTER_READ, CUPS_RASTER_WRITE, CUPS_RASTER_WRITE_COMPRESSED, or CUPS_RASTER_WRITE_PWG

Return Value

New stream

Discussion

This function associates a raster stream with the given file descriptor. For most printer driver filters, "fd" will be 0 (stdin). For most raster image processor (RIP) filters that generate raster data, "fd" will be 1 (stdout).

When writing raster data, the CUPS_RASTER_WRITE, CUPS_RASTER_WRITE_COMPRESS, or CUPS_RASTER_WRITE_PWG mode can be used - compressed and PWG output is generally 25-50% smaller but adds a 100-300% execution time overhead.

cupsRasterOpenIO

Open a raster stream using a callback function.

cups_raster_t *cupsRasterOpenIO (
    cups_raster_iocb_t iocb,
    void *ctx,
    cups_mode_t mode
);

Parameters

iocb
Read/write callback
ctx
Context pointer for callback
mode
Mode - CUPS_RASTER_READ, CUPS_RASTER_WRITE, CUPS_RASTER_WRITE_COMPRESSED, or CUPS_RASTER_WRITE_PWG

Return Value

New stream

Discussion

This function associates a raster stream with the given callback function and context pointer.

When writing raster data, the CUPS_RASTER_WRITE, CUPS_RASTER_WRITE_COMPRESS, or CUPS_RASTER_WRITE_PWG mode can be used - compressed and PWG output is generally 25-50% smaller but adds a 100-300% execution time overhead.

 DEPRECATED cupsRasterReadHeader

Read a raster page header and store it in a version 1 page header structure.

unsigned cupsRasterReadHeader (
    cups_raster_t *r,
    cups_page_header_t *h
);

Parameters

r
Raster stream
h
Pointer to header data

Return Value

1 on success, 0 on failure/end-of-file

Discussion

This function is deprecated. Use cupsRasterReadHeader2 instead.

Version 1 page headers were used in CUPS 1.0 and 1.1 and contain a subset of the version 2 page header data. This function handles reading version 2 page headers and copying only the version 1 data into the provided buffer.

 CUPS 1.2/macOS 10.5 cupsRasterReadHeader2

Read a raster page header and store it in a version 2 page header structure.

unsigned cupsRasterReadHeader2 (
    cups_raster_t *r,
    cups_page_header2_t *h
);

Parameters

r
Raster stream
h
Pointer to header data

Return Value

1 on success, 0 on failure/end-of-file

cupsRasterReadPixels

Read raster pixels.

unsigned cupsRasterReadPixels (
    cups_raster_t *r,
    unsigned char *p,
    unsigned len
);

Parameters

r
Raster stream
p
Pointer to pixel buffer
len
Number of bytes to read

Return Value

Number of bytes read

Discussion

For best performance, filters should read one or more whole lines. The "cupsBytesPerLine" value from the page header can be used to allocate the line buffer and as the number of bytes to read.

 DEPRECATED cupsRasterWriteHeader

Write a raster page header from a version 1 page header structure.

unsigned cupsRasterWriteHeader (
    cups_raster_t *r,
    cups_page_header_t *h
);

Parameters

r
Raster stream
h
Raster page header

Return Value

1 on success, 0 on failure

Discussion

This function is deprecated. Use cupsRasterWriteHeader2 instead.

 CUPS 1.2/macOS 10.5 cupsRasterWriteHeader2

Write a raster page header from a version 2 page header structure.

unsigned cupsRasterWriteHeader2 (
    cups_raster_t *r,
    cups_page_header2_t *h
);

Parameters

r
Raster stream
h
Raster page header

Return Value

1 on success, 0 on failure

Discussion

The page header can be initialized using cupsRasterInterpretPPD.

cupsRasterWritePixels

Write raster pixels.

unsigned cupsRasterWritePixels (
    cups_raster_t *r,
    unsigned char *p,
    unsigned len
);

Parameters

r
Raster stream
p
Bytes to write
len
Number of bytes to write

Return Value

Number of bytes written

Discussion

For best performance, filters should write one or more whole lines. The "cupsBytesPerLine" value from the page header can be used to allocate the line buffer and as the number of bytes to write.

 CUPS 1.4/macOS 10.6 cupsReadResponseData

Read additional data after the IPP response.

ssize_t cupsReadResponseData (
    http_t *http,
    char *buffer,
    size_t length
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
buffer
Buffer to use
length
Number of bytes to read

Return Value

Bytes read, 0 on EOF, -1 on error

Discussion

This function is used after cupsGetResponse to read the PPD or document files from CUPS_GET_PPD and CUPS_GET_DOCUMENT requests, respectively.

 CUPS 1.3/macOS 10.5 cupsRemoveDest

Remove a destination from the destination list.

int cupsRemoveDest (
    const char *name,
    const char *instance,
    int num_dests,
    cups_dest_t **dests
);

Parameters

name
Destination name
instance
Instance name or NULL
num_dests
Number of destinations
dests
Destinations

Return Value

New number of destinations

Discussion

Removing a destination/instance does not delete the class or printer queue, merely the lpoptions for that destination/instance. Use the cupsSetDests or cupsSetDests2 functions to save the new options for the user.

 CUPS 1.2/macOS 10.5 cupsRemoveOption

Remove an option from an option array.

int cupsRemoveOption (
    const char *name,
    int num_options,
    cups_option_t **options
);

Parameters

name
Option name
num_options
Current number of options
options
Options

Return Value

New number of options

 CUPS 1.4/macOS 10.6 cupsSendRequest

Send an IPP request.

http_status_t cupsSendRequest (
    http_t *http,
    ipp_t *request,
    const char *resource,
    size_t length
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
request
IPP request
resource
Resource path
length
Length of data to follow or CUPS_LENGTH_VARIABLE

Return Value

Initial HTTP status

Discussion

Use cupsWriteRequestData to write any additional data (document, PPD file, etc.) for the request, cupsGetResponse to get the IPP response, and cupsReadResponseData to read any additional data following the response. Only one request can be sent/queued at a time per http_t connection.

Returns the initial HTTP status code, which will be HTTP_STATUS_CONTINUE on a successful send of the request.

Note: Unlike cupsDoFileRequest, cupsDoIORequest, and cupsDoRequest, the request is NOT freed with ippDelete.

cupsServer

Return the hostname/address of the current server.

const char *cupsServer (void);

Return Value

Server name

Discussion

The default server comes from the CUPS_SERVER environment variable, then the ~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not set, the default is the local system - either "localhost" or a domain socket path.

The returned value can be a fully-qualified hostname, a numeric IPv4 or IPv6 address, or a domain socket pathname.

Note: The current server is tracked separately for each thread in a program. Multi-threaded programs that override the server via the cupsSetServer function need to do so in each thread for the same server to be used.

 CUPS 1.5/macOS 10.7 cupsSetClientCertCB

Set the client certificate callback.

void cupsSetClientCertCB (
    cups_client_cert_cb_t cb,
    void *user_data
);

Parameters

cb
Callback function
user_data
User data pointer

Discussion

Pass NULL to restore the default callback.

Note: The current certificate callback is tracked separately for each thread in a program. Multi-threaded programs that override the callback need to do so in each thread for the same callback to be used.

 CUPS 1.5/macOS 10.7 cupsSetCredentials

Set the default credentials to be used for SSL/TLS connections.

int cupsSetCredentials (
    cups_array_t *credentials
);

Parameters

credentials
Array of credentials

Return Value

Status of call (0 = success)

Discussion

Note: The default credentials are tracked separately for each thread in a program. Multi-threaded programs that override the setting need to do so in each thread for the same setting to be used.

 CUPS 1.3/macOS 10.5 cupsSetDefaultDest

Set the default destination.

void cupsSetDefaultDest (
    const char *name,
    const char *instance,
    int num_dests,
    cups_dest_t *dests
);

Parameters

name
Destination name
instance
Instance name or NULL
num_dests
Number of destinations
dests
Destinations

cupsSetDests

Save the list of destinations for the default server.

void cupsSetDests (
    int num_dests,
    cups_dest_t *dests
);

Parameters

num_dests
Number of destinations
dests
Destinations

Discussion

This function saves the destinations to /etc/cups/lpoptions when run as root and ~/.cups/lpoptions when run as a normal user.

 CUPS 1.1.21/macOS 10.4 cupsSetDests2

Save the list of destinations for the specified server.

int cupsSetDests2 (
    http_t *http,
    int num_dests,
    cups_dest_t *dests
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
num_dests
Number of destinations
dests
Destinations

Return Value

0 on success, -1 on error

Discussion

This function saves the destinations to /etc/cups/lpoptions when run as root and ~/.cups/lpoptions when run as a normal user.

cupsSetEncryption

Set the encryption preference.

void cupsSetEncryption (
    http_encryption_t e
);

Parameters

e
New encryption preference

Discussion

The default encryption setting comes from the CUPS_ENCRYPTION environment variable, then the ~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not set, the default is HTTP_ENCRYPTION_IF_REQUESTED.

Note: The current encryption setting is tracked separately for each thread in a program. Multi-threaded programs that override the setting need to do so in each thread for the same setting to be used.

cupsSetPasswordCB

Set the password callback for CUPS.

void cupsSetPasswordCB (
    cups_password_cb_t cb
);

Parameters

cb
Callback function

Discussion

Pass NULL to restore the default (console) password callback, which reads the password from the console. Programs should call either this function or cupsSetPasswordCB2, as only one callback can be registered by a program per thread.

Note: The current password callback is tracked separately for each thread in a program. Multi-threaded programs that override the callback need to do so in each thread for the same callback to be used.

 CUPS 1.4/macOS 10.6 cupsSetPasswordCB2

Set the advanced password callback for CUPS.

void cupsSetPasswordCB2 (
    cups_password_cb2_t cb,
    void *user_data
);

Parameters

cb
Callback function
user_data
User data pointer

Discussion

Pass NULL to restore the default (console) password callback, which reads the password from the console. Programs should call either this function or cupsSetPasswordCB2, as only one callback can be registered by a program per thread.

Note: The current password callback is tracked separately for each thread in a program. Multi-threaded programs that override the callback need to do so in each thread for the same callback to be used.

cupsSetServer

Set the default server name and port.

void cupsSetServer (
    const char *server
);

Parameters

server
Server name

Discussion

The "server" string can be a fully-qualified hostname, a numeric IPv4 or IPv6 address, or a domain socket pathname. Hostnames and numeric IP addresses can be optionally followed by a colon and port number to override the default port 631, e.g. "hostname:8631". Pass NULL to restore the default server name and port.

Note: The current server is tracked separately for each thread in a program. Multi-threaded programs that override the server need to do so in each thread for the same server to be used.

 CUPS 1.5/macOS 10.7 cupsSetServerCertCB

Set the server certificate callback.

void cupsSetServerCertCB (
    cups_server_cert_cb_t cb,
    void *user_data
);

Parameters

cb
Callback function
user_data
User data pointer

Discussion

Pass NULL to restore the default callback.

Note: The current credentials callback is tracked separately for each thread in a program. Multi-threaded programs that override the callback need to do so in each thread for the same callback to be used.

cupsSetUser

Set the default user name.

void cupsSetUser (
    const char *user
);

Parameters

user
User name

Discussion

Pass NULL to restore the default user name.

Note: The current user name is tracked separately for each thread in a program. Multi-threaded programs that override the user name need to do so in each thread for the same user name to be used.

 CUPS 1.7/macOS 10.9 cupsSetUserAgent

Set the default HTTP User-Agent string.

void cupsSetUserAgent (
    const char *user_agent
);

Parameters

user_agent
User-Agent string or NULL

Discussion

Setting the string to NULL forces the default value containing the CUPS version, IPP version, and operating system version and architecture.

 CUPS 1.6/macOS 10.8 cupsStartDestDocument

Start a new document.

http_status_t cupsStartDestDocument (
    http_t *http,
    cups_dest_t *dest,
    cups_dinfo_t *info,
    int job_id,
    const char *docname,
    const char *format,
    int num_options,
    cups_option_t *options,
    int last_document
);

Parameters

http
Connection to destination
dest
Destination
info
Destination information
job_id
Job ID
docname
Document name
format
Document format
num_options
Number of document options
options
Document options
last_document
1 if this is the last document

Return Value

Status of document creation

Discussion

"job_id" is the job ID returned by cupsCreateDestJob. "docname" is the name of the document/file being printed, "format" is the MIME media type for the document (see CUPS_FORMAT_xxx constants), and "num_options" and "options" are the options do be applied to the document. "last_document" should be 1 if this is the last document to be submitted in the job. Returns HTTP_CONTINUE on success.

 CUPS 1.4/macOS 10.6 cupsStartDocument

Add a document to a job created with cupsCreateJob().

http_status_t cupsStartDocument (
    http_t *http,
    const char *name,
    int job_id,
    const char *docname,
    const char *format,
    int last_document
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
name
Destination name
job_id
Job ID from cupsCreateJob
docname
Name of document
format
MIME type or CUPS_FORMAT_foo
last_document
1 for last document in job, 0 otherwise

Return Value

HTTP status of request

Discussion

Use cupsWriteRequestData to write data for the document and cupsFinishDocument to finish the document and get the submission status.

The MIME type constants CUPS_FORMAT_AUTO, CUPS_FORMAT_PDF, CUPS_FORMAT_POSTSCRIPT, CUPS_FORMAT_RAW, and CUPS_FORMAT_TEXT are provided for the "format" argument, although any supported MIME type string can be supplied.

cupsUser

Return the current user's name.

const char *cupsUser (void);

Return Value

User name

Discussion

Note: The current user name is tracked separately for each thread in a program. Multi-threaded programs that override the user name with the cupsSetUser function need to do so in each thread for the same user name to be used.

 CUPS 1.7/macOS 10.9 cupsUserAgent

Return the default HTTP User-Agent string.

const char *cupsUserAgent (void);

Return Value

User-Agent string

 CUPS 1.4/macOS 10.6 cupsWriteRequestData

Write additional data after an IPP request.

http_status_t cupsWriteRequestData (
    http_t *http,
    const char *buffer,
    size_t length
);

Parameters

http
Connection to server or CUPS_HTTP_DEFAULT
buffer
Bytes to write
length
Number of bytes to write

Return Value

HTTP_STATUS_CONTINUE if OK or HTTP status on error

Discussion

This function is used after cupsSendRequest to provide a PPD and after cupsStartDocument to provide a document file.

get_error_buffer

Return a pointer to thread local storage.

_cups_raster_error_t *get_error_buffer (void);

Return Value

Pointer to error buffer

 CUPS 1.7/macOS 10.9 httpAcceptConnection

Accept a new HTTP client connection from the specified listening socket.

http_t *httpAcceptConnection (
    int fd,
    int blocking
);

Parameters

fd
Listen socket file descriptor
blocking
1 if the connection should be blocking, 0 otherwise

Return Value

HTTP connection or NULL

 CUPS 1.5/macOS 10.7 httpAddCredential

Allocates and adds a single credential to an array.

int httpAddCredential (
    cups_array_t *credentials,
    const void *data,
    size_t datalen
);

Parameters

credentials
Credentials array
data
PEM-encoded X.509 data
datalen
Length of data

Return Value

0 on success, -1 on error

Discussion

Use cupsArrayNew(NULL, NULL) to create a credentials array.

 CUPS 1.2/macOS 10.5 httpAddrAny

Check for the "any" address.

int httpAddrAny (
    const http_addr_t *addr
);

Parameters

addr
Address to check

Return Value

1 if "any", 0 otherwise

 CUPS 2.0/OS 10.10 httpAddrClose

Close a socket created by httpAddrConnect or httpAddrListen.

int httpAddrClose (
    http_addr_t *addr,
    int fd
);

Parameters

addr
Listen address or NULL
fd
Socket file descriptor

Return Value

0 on success, -1 on failure

Discussion

Pass NULL for sockets created with httpAddrConnect and the listen address for sockets created with httpAddrListen. This will ensure that domain sockets are removed when closed.

 CUPS 1.2/macOS 10.5 httpAddrConnect

Connect to any of the addresses in the list.

http_addrlist_t *httpAddrConnect (
    http_addrlist_t *addrlist,
    int *sock
);

Parameters

addrlist
List of potential addresses
sock
Socket

Return Value

Connected address or NULL on failure

 CUPS 1.7/macOS 10.9 httpAddrConnect2

Connect to any of the addresses in the list with a timeout and optional cancel.

http_addrlist_t *httpAddrConnect2 (
    http_addrlist_t *addrlist,
    int *sock,
    int msec,
    int *cancel
);

Parameters

addrlist
List of potential addresses
sock
Socket
msec
Timeout in milliseconds
cancel
Pointer to "cancel" variable

Return Value

Connected address or NULL on failure

 CUPS 1.7/macOS 10.9 httpAddrCopyList

Copy an address list.

http_addrlist_t *httpAddrCopyList (
    http_addrlist_t *src
);

Parameters

src
Source address list

Return Value

New address list or NULL on error

 CUPS 1.2/macOS 10.5 httpAddrEqual

Compare two addresses.

int httpAddrEqual (
    const http_addr_t *addr1,
    const http_addr_t *addr2
);

Parameters

addr1
First address
addr2
Second address

Return Value

1 if equal, 0 if not

httpAddrFamily

Get the address family of an address.

int httpAddrFamily (
    http_addr_t *addr
);

Parameters

addr
Address

Return Value

Address family

 CUPS 1.2/macOS 10.5 httpAddrFreeList

Free an address list.

void httpAddrFreeList (
    http_addrlist_t *addrlist
);

Parameters

addrlist
Address list to free

 CUPS 1.2/macOS 10.5 httpAddrGetList

Get a list of addresses for a hostname.

http_addrlist_t *httpAddrGetList (
    const char *hostname,
    int family,
    const char *service
);

Parameters

hostname
Hostname, IP address, or NULL for passive listen address
family
Address family or AF_UNSPEC
service
Service name or port number

Return Value

List of addresses or NULL

 CUPS 1.2/macOS 10.5 httpAddrLength

Return the length of the address in bytes.

int httpAddrLength (
    const http_addr_t *addr
);

Parameters

addr
Address

Return Value

Length in bytes

 CUPS 1.7/macOS 10.9 httpAddrListen

Create a listening socket bound to the specified address and port.

int httpAddrListen (
    http_addr_t *addr,
    int port
);

Parameters

addr
Address to bind to
port
Port number to bind to

Return Value

Socket or -1 on error

 CUPS 1.2/macOS 10.5 httpAddrLocalhost

Check for the local loopback address.

int httpAddrLocalhost (
    const http_addr_t *addr
);

Parameters

addr
Address to check

Return Value

1 if local host, 0 otherwise

 CUPS 1.2/macOS 10.5 httpAddrLookup

Lookup the hostname associated with the address.

char *httpAddrLookup (
    const http_addr_t *addr,
    char *name,
    int namelen
);

Parameters

addr
Address to lookup
name
Host name buffer
namelen
Size of name buffer

Return Value

Host name

 CUPS 1.7/macOS 10.9 httpAddrPort

Get the port number associated with an address.

int httpAddrPort (
    http_addr_t *addr
);

Parameters

addr
Address

Return Value

Port number

 CUPS 1.2/macOS 10.5 httpAddrString

Convert an address to a numeric string.

char *httpAddrString (
    const http_addr_t *addr,
    char *s,
    int slen
);

Parameters

addr
Address to convert
s
String buffer
slen
Length of string

Return Value

Numeric address string

 CUPS 1.2/macOS 10.5 httpAssembleURI

Assemble a uniform resource identifier from its components.

http_uri_status_t httpAssembleURI (
    http_uri_coding_t encoding,
    char *uri,
    int urilen,
    const char *scheme,
    const char *username,
    const char *host,
    int port,
    const char *resource
);

Parameters

encoding
Encoding flags
uri
URI buffer
urilen
Size of URI buffer
scheme
Scheme name
username
Username
host
Hostname or address
port
Port number
resource
Resource

Return Value

URI status

Discussion

This function escapes reserved characters in the URI depending on the value of the "encoding" argument. You should use this function in place of traditional string functions whenever you need to create a URI string.

 CUPS 1.2/macOS 10.5 httpAssembleURIf

Assemble a uniform resource identifier from its components with a formatted resource.

http_uri_status_t httpAssembleURIf (
    http_uri_coding_t encoding,
    char *uri,
    int urilen,
    const char *scheme,
    const char *username,
    const char *host,
    int port,
    const char *resourcef,
    ...
);

Parameters

encoding
Encoding flags
uri
URI buffer
urilen
Size of URI buffer
scheme
Scheme name
username
Username
host
Hostname or address
port
Port number
resourcef
Printf-style resource
...
Additional arguments as needed

Return Value

URI status

Discussion

This function creates a formatted version of the resource string argument "resourcef" and escapes reserved characters in the URI depending on the value of the "encoding" argument. You should use this function in place of traditional string functions whenever you need to create a URI string.

 CUPS 1.7/macOS 10.9 httpAssembleUUID

Assemble a name-based UUID URN conforming to RFC 4122.

char *httpAssembleUUID (
    const char *server,
    int port,
    const char *name,
    int number,
    char *buffer,
    size_t bufsize
);

Parameters

server
Server name
port
Port number
name
Object name or NULL
number
Object number or 0
buffer
String buffer
bufsize
Size of buffer

Return Value

UUID string

Discussion

This function creates a unique 128-bit identifying number using the server name, port number, random data, and optionally an object name and/or object number. The result is formatted as a UUID URN as defined in RFC 4122.

The buffer needs to be at least 46 bytes in size.

httpBlocking

Set blocking/non-blocking behavior on a connection.

void httpBlocking (
    http_t *http,
    int b
);

Parameters

http
HTTP connection
b
1 = blocking, 0 = non-blocking

httpCheck

Check to see if there is a pending response from the server.

int httpCheck (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

0 = no data, 1 = data available

 CUPS 1.1.19/macOS 10.3 httpClearCookie

Clear the cookie value(s).

void httpClearCookie (
    http_t *http
);

Parameters

http
HTTP connection

httpClearFields

Clear HTTP request fields.

void httpClearFields (
    http_t *http
);

Parameters

http
HTTP connection

httpClose

Close an HTTP connection.

void httpClose (
    http_t *http
);

Parameters

http
HTTP connection

 CUPS 2.0/OS 10.10 httpCompareCredentials

Compare two sets of X.509 credentials.

int httpCompareCredentials (
    cups_array_t *cred1,
    cups_array_t *cred2
);

Parameters

cred1
First set of X.509 credentials
cred2
Second set of X.509 credentials

Return Value

1 if they match, 0 if they do not

 DEPRECATED httpConnect

Connect to a HTTP server.

http_t *httpConnect (
    const char *host,
    int port
);

Parameters

host
Host to connect to
port
Port number

Return Value

New HTTP connection

Discussion

This function is deprecated - use httpConnect2 instead.

 CUPS 1.7/macOS 10.9 httpConnect2

Connect to a HTTP server.

http_t *httpConnect2 (
    const char *host,
    int port,
    http_addrlist_t *addrlist,
    int family,
    http_encryption_t encryption,
    int blocking,
    int msec,
    int *cancel
);

Parameters

host
Host to connect to
port
Port number
addrlist
List of addresses or NULL to lookup
family
Address family to use or AF_UNSPEC for any
encryption
Type of encryption to use
blocking
1 for blocking connection, 0 for non-blocking
msec
Connection timeout in milliseconds, 0 means don't connect
cancel
Pointer to "cancel" variable

Return Value

New HTTP connection

 DEPRECATED httpConnectEncrypt

Connect to a HTTP server using encryption.

http_t *httpConnectEncrypt (
    const char *host,
    int port,
    http_encryption_t encryption
);

Parameters

host
Host to connect to
port
Port number
encryption
Type of encryption to use

Return Value

New HTTP connection

Discussion

This function is now deprecated. Please use the httpConnect2 function instead.

httpCopyCredentials

Local functions...

int httpCopyCredentials (
    http_t *http,
    cups_array_t **credentials
);

Parameters

http
credentials

Return Value

Stubs for when TLS is not supported/available

httpCredentialsAreValidForName

int httpCredentialsAreValidForName (
    cups_array_t *credentials,
    const char *common_name
);

Parameters

credentials
common_name

Return Value

httpCredentialsGetExpiration

time_t httpCredentialsGetExpiration (
    cups_array_t *credentials
);

Parameters

credentials

Return Value

httpCredentialsGetTrust

http_trust_t httpCredentialsGetTrust (
    cups_array_t *credentials,
    const char *common_name
);

Parameters

credentials
common_name

Return Value

httpCredentialsString

size_t httpCredentialsString (
    cups_array_t *credentials,
    char *buffer,
    size_t bufsize
);

Parameters

credentials
buffer
bufsize

Return Value

 DEPRECATED httpDecode64

Base64-decode a string.

char *httpDecode64 (
    char *out,
    const char *in
);

Parameters

out
String to write to
in
String to read from

Return Value

Decoded string

Discussion

This function is deprecated. Use the httpDecode64_2() function instead which provides buffer length arguments.

 CUPS 1.1.21/macOS 10.4 httpDecode64_2

Base64-decode a string.

char *httpDecode64_2 (
    char *out,
    int *outlen,
    const char *in
);

Parameters

out
String to write to
outlen
Size of output string
in
String to read from

Return Value

Decoded string

httpDelete

Send a DELETE request to the server.

int httpDelete (
    http_t *http,
    const char *uri
);

Parameters

http
HTTP connection
uri
URI to delete

Return Value

Status of call (0 = success)

 DEPRECATED httpEncode64

Base64-encode a string.

char *httpEncode64 (
    char *out,
    const char *in
);

Parameters

out
String to write to
in
String to read from

Return Value

Encoded string

Discussion

This function is deprecated. Use the httpEncode64_2() function instead which provides buffer length arguments.

 CUPS 1.1.21/macOS 10.4 httpEncode64_2

Base64-encode a string.

char *httpEncode64_2 (
    char *out,
    int outlen,
    const char *in,
    int inlen
);

Parameters

out
String to write to
outlen
Size of output string
in
String to read from
inlen
Size of input string

Return Value

Encoded string

httpEncryption

Set the required encryption on the link.

int httpEncryption (
    http_t *http,
    http_encryption_t e
);

Parameters

http
HTTP connection
e
New encryption preference

Return Value

-1 on error, 0 on success

httpError

Get the last error on a connection.

int httpError (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Error code (errno) value

httpFieldValue

Return the HTTP field enumeration value for a field name.

http_field_t httpFieldValue (
    const char *name
);

Parameters

name
String name

Return Value

Field index

httpFlush

Flush data from a HTTP connection.

void httpFlush (
    http_t *http
);

Parameters

http
HTTP connection

 CUPS 1.2/macOS 10.5 httpFlushWrite

Flush data in write buffer.

int httpFlushWrite (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Bytes written or -1 on error

httpFreeCredentials

Free an array of credentials.

void httpFreeCredentials (
    cups_array_t *credentials
);

Parameters

credentials
Array of credentials

httpGet

Send a GET request to the server.

int httpGet (
    http_t *http,
    const char *uri
);

Parameters

http
HTTP connection
uri
URI to get

Return Value

Status of call (0 = success)

 CUPS 2.0/OS 10.10 httpGetActivity

Get the most recent activity for a connection.

time_t httpGetActivity (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Time of last read or write

Discussion

The return value is the UNIX time of the last read or write.

 CUPS 2.0/OS 10.10 httpGetAddress

Get the address of the connected peer of a connection.

http_addr_t *httpGetAddress (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Connected address or NULL

Discussion

Returns NULL if the socket is currently unconnected.

 CUPS 1.3/macOS 10.5 httpGetAuthString

Get the current authorization string.

char *httpGetAuthString (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Authorization string

Discussion

The authorization string is set by cupsDoAuthentication() and httpSetAuthString(). Use httpGetAuthString() to retrieve the string to use with httpSetField() for the HTTP_FIELD_AUTHORIZATION value.

 CUPS 1.2/macOS 10.5 httpGetBlocking

Get the blocking/non-block state of a connection.

int httpGetBlocking (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

1 if blocking, 0 if non-blocking

 CUPS 1.7/macOS 10.9 httpGetContentEncoding

Get a common content encoding, if any, between the client and server.

const char *httpGetContentEncoding (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Content-Coding value or NULL for the identity coding.

Discussion

This function uses the value of the Accepts-Encoding HTTP header and must be called after receiving a response from the server or a request from the client. The value returned can be use in subsequent requests (for clients) or in the response (for servers) in order to compress the content stream.

 CUPS 1.1.19/macOS 10.3 httpGetCookie

Get any cookie data from the response.

const char *httpGetCookie (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Cookie data or NULL

 DEPRECATED httpGetDateString

Get a formatted date/time string from a time value.

const char *httpGetDateString (
    time_t t
);

Parameters

t
UNIX time

Return Value

Date/time string

 CUPS 1.2/macOS 10.5 httpGetDateString2

Get a formatted date/time string from a time value.

const char *httpGetDateString2 (
    time_t t,
    char *s,
    int slen
);

Parameters

t
UNIX time
s
String buffer
slen
Size of string buffer

Return Value

Date/time string

httpGetDateTime

Get a time value from a formatted date/time string.

time_t httpGetDateTime (
    const char *s
);

Parameters

s
Date/time string

Return Value

UNIX time

 CUPS 2.0/OS 10.10 httpGetEncryption

Get the current encryption mode of a connection.

http_encryption_t httpGetEncryption (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Current encryption mode

Discussion

This function returns the encryption mode for the connection. Use the httpIsEncrypted function to determine whether a TLS session has been established.

 CUPS 1.7/macOS 10.9 httpGetExpect

Get the value of the Expect header, if any.

http_status_t httpGetExpect (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Expect: status, if any

Discussion

Returns HTTP_STATUS_NONE if there is no Expect header, otherwise returns the expected HTTP status code, typically HTTP_STATUS_CONTINUE.

 CUPS 1.2/macOS 10.5 httpGetFd

Get the file descriptor associated with a connection.

int httpGetFd (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

File descriptor or -1 if none

httpGetField

Get a field value from a request/response.

const char *httpGetField (
    http_t *http,
    http_field_t field
);

Parameters

http
HTTP connection
field
Field to get

Return Value

Field value

 DEPRECATED httpGetHostByName

Lookup a hostname or IPv4 address, and return address records for the specified name.

struct hostent *httpGetHostByName (
    const char *name
);

Parameters

name
Hostname or IP address

Return Value

Host entry

 CUPS 1.2/macOS 10.5 httpGetHostname

Get the FQDN for the connection or local system.

const char *httpGetHostname (
    http_t *http,
    char *s,
    int slen
);

Parameters

http
HTTP connection or NULL
s
String buffer for name
slen
Size of buffer

Return Value

FQDN for connection or system

Discussion

When "http" points to a connected socket, return the hostname or address that was used in the call to httpConnect() or httpConnectEncrypt(), or the address of the client for the connection from httpAcceptConnection(). Otherwise, return the FQDN for the local system using both gethostname() and gethostbyname() to get the local hostname with domain.

 CUPS 2.0/OS 10.10 httpGetKeepAlive

Get the current Keep-Alive state of the connection.

http_keepalive_t httpGetKeepAlive (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Keep-Alive state

 DEPRECATED httpGetLength

Get the amount of data remaining from the content-length or transfer-encoding fields.

int httpGetLength (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Content length

Discussion

This function is deprecated and will not return lengths larger than 2^31 - 1; use httpGetLength2() instead.

 CUPS 1.2/macOS 10.5 httpGetLength2

Get the amount of data remaining from the content-length or transfer-encoding fields.

off_t httpGetLength2 (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Content length

Discussion

This function returns the complete content length, even for content larger than 2^31 - 1.

 CUPS 2.0/OS 10.10 httpGetPending

Get the number of bytes that are buffered for writing.

size_t httpGetPending (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Number of bytes buffered

 CUPS 2.0/OS 10.10 httpGetReady

Get the number of bytes that can be read without blocking.

size_t httpGetReady (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Number of bytes available

 CUPS 2.0/OS 10.10 httpGetRemaining

Get the number of remaining bytes in the message body or current chunk.

size_t httpGetRemaining (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Remaining bytes

Discussion

The httpIsChunked function can be used to determine whether the message body is chunked or fixed-length.

httpGetState

Get the current state of the HTTP request.

http_state_t httpGetState (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

HTTP state

 CUPS 1.2/macOS 10.5 httpGetStatus

Get the status of the last HTTP request.

http_status_t httpGetStatus (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

HTTP status

 DEPRECATED httpGetSubField

Get a sub-field value.

char *httpGetSubField (
    http_t *http,
    http_field_t field,
    const char *name,
    char *value
);

Parameters

http
HTTP connection
field
Field index
name
Name of sub-field
value
Value string

Return Value

Value or NULL

 CUPS 1.2/macOS 10.5 httpGetSubField2

Get a sub-field value.

char *httpGetSubField2 (
    http_t *http,
    http_field_t field,
    const char *name,
    char *value,
    int valuelen
);

Parameters

http
HTTP connection
field
Field index
name
Name of sub-field
value
Value string
valuelen
Size of value buffer

Return Value

Value or NULL

httpGetVersion

Get the HTTP version at the other end.

http_version_t httpGetVersion (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

Version number

httpGets

Get a line of text from a HTTP connection.

char *httpGets (
    char *line,
    int length,
    http_t *http
);

Parameters

line
Line to read into
length
Max length of buffer
http
HTTP connection

Return Value

Line or NULL

httpHead

Send a HEAD request to the server.

int httpHead (
    http_t *http,
    const char *uri
);

Parameters

http
HTTP connection
uri
URI for head

Return Value

Status of call (0 = success)

httpInitialize

Initialize the HTTP interface library and set the default HTTP proxy (if any).

void httpInitialize (void);

 CUPS 2.0/OS 10.10 httpIsChunked

Report whether a message body is chunked.

int httpIsChunked (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

1 if chunked, 0 if not

Discussion

This function returns non-zero if the message body is composed of variable-length chunks.

 CUPS 2.0/OS 10.10 httpIsEncrypted

Report whether a connection is encrypted.

int httpIsEncrypted (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

1 if encrypted, 0 if not

Discussion

This function returns non-zero if the connection is currently encrypted.

httpLoadCredentials

int httpLoadCredentials (
    const char *path,
    cups_array_t **credentials,
    const char *common_name
);

Parameters

path
credentials
common_name

Return Value

httpMD5

Compute the MD5 sum of the username:group:password.

char *httpMD5 (
    const char *username,
    const char *realm,
    const char *passwd,
    char md5[33]
);

Parameters

username
User name
realm
Realm name
passwd
Password string
md5[33]
MD5 string

Return Value

MD5 sum

httpMD5Final

Combine the MD5 sum of the username, group, and password with the server-supplied nonce value, method, and request-uri.

char *httpMD5Final (
    const char *nonce,
    const char *method,
    const char *resource,
    char md5[33]
);

Parameters

nonce
Server nonce value
method
METHOD (GET, POST, etc.)
resource
Resource path
md5[33]
MD5 sum

Return Value

New sum

httpMD5String

Convert an MD5 sum to a character string.

char *httpMD5String (
    const unsigned char *sum,
    char md5[33]
);

Parameters

sum
MD5 sum data
md5[33]
MD5 sum in hex

Return Value

MD5 sum in hex

httpOptions

Send an OPTIONS request to the server.

int httpOptions (
    http_t *http,
    const char *uri
);

Parameters

http
HTTP connection
uri
URI for options

Return Value

Status of call (0 = success)

 CUPS 1.7/macOS 10.9 httpPeek

Peek at data from a HTTP connection.

ssize_t httpPeek (
    http_t *http,
    char *buffer,
    size_t length
);

Parameters

http
HTTP connection
buffer
Buffer for data
length
Maximum number of bytes

Return Value

Number of bytes copied

Discussion

This function copies available data from the given HTTP connection, reading a buffer as needed. The data is still available for reading using httpRead or httpRead2.

For non-blocking connections the usual timeouts apply.

httpPost

Send a POST request to the server.

int httpPost (
    http_t *http,
    const char *uri
);

Parameters

http
HTTP connection
uri
URI for post

Return Value

Status of call (0 = success)

httpPut

Send a PUT request to the server.

int httpPut (
    http_t *http,
    const char *uri
);

Parameters

http
HTTP connection
uri
URI to put

Return Value

Status of call (0 = success)

 DEPRECATED httpRead

Read data from a HTTP connection.

int httpRead (
    http_t *http,
    char *buffer,
    int length
);

Parameters

http
HTTP connection
buffer
Buffer for data
length
Maximum number of bytes

Return Value

Number of bytes read

Discussion

This function is deprecated. Use the httpRead2() function which can read more than 2GB of data.

 CUPS 1.2/macOS 10.5 httpRead2

Read data from a HTTP connection.

ssize_t httpRead2 (
    http_t *http,
    char *buffer,
    size_t length
);

Parameters

http
HTTP connection
buffer
Buffer for data
length
Maximum number of bytes

Return Value

Number of bytes read

 CUPS 1.7/macOS 10.9 httpReadRequest

Read a HTTP request from a connection.

http_state_t httpReadRequest (
    http_t *http,
    char *uri,
    size_t urilen
);

Parameters

http
HTTP connection
uri
URI buffer
urilen
Size of URI buffer

Return Value

New state of connection

 DEPRECATED httpReconnect

Reconnect to a HTTP server.

int httpReconnect (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

0 on success, non-zero on failure

Discussion

This function is deprecated. Please use the httpReconnect2 function instead.

httpReconnect2

Reconnect to a HTTP server with timeout and optional cancel.

int httpReconnect2 (
    http_t *http,
    int msec,
    int *cancel
);

Parameters

http
HTTP connection
msec
Timeout in milliseconds
cancel
Pointer to "cancel" variable

Return Value

0 on success, non-zero on failure

 CUPS 2.0/OS 10.10 httpResolveHostname

Resolve the hostname of the HTTP connection address.

const char *httpResolveHostname (
    http_t *http,
    char *buffer,
    size_t bufsize
);

Parameters

http
HTTP connection
buffer
Hostname buffer
bufsize
Size of buffer

Return Value

Resolved hostname or NULL

httpSaveCredentials

int httpSaveCredentials (
    const char *path,
    cups_array_t *credentials,
    const char *common_name
);

Parameters

path
credentials
common_name

Return Value

 DEPRECATED httpSeparate

Separate a Universal Resource Identifier into its components.

void httpSeparate (
    const char *uri,
    char *scheme,
    char *username,
    char *host,
    int *port,
    char *resource
);

Parameters

uri
Universal Resource Identifier
scheme
Scheme [32] (http, https, etc.)
username
Username [1024]
host
Hostname [1024]
port
Port number to use
resource
Resource/filename [1024]

Discussion

This function is deprecated; use the httpSeparateURI() function instead.

 CUPS 1.1.21/macOS 10.4 httpSeparate2

Separate a Universal Resource Identifier into its components.

void httpSeparate2 (
    const char *uri,
    char *scheme,
    int schemelen,
    char *username,
    int usernamelen,
    char *host,
    int hostlen,
    int *port,
    char *resource,
    int resourcelen
);

Parameters

uri
Universal Resource Identifier
scheme
Scheme (http, https, etc.)
schemelen
Size of scheme buffer
username
Username
usernamelen
Size of username buffer
host
Hostname
hostlen
Size of hostname buffer
port
Port number to use
resource
Resource/filename
resourcelen
Size of resource buffer

Discussion

This function is deprecated; use the httpSeparateURI() function instead.

 CUPS 1.2/macOS 10.5 httpSeparateURI

Separate a Universal Resource Identifier into its components.

http_uri_status_t httpSeparateURI (
    http_uri_coding_t decoding,
    const char *uri,
    char *scheme,
    int schemelen,
    char *username,
    int usernamelen,
    char *host,
    int hostlen,
    int *port,
    char *resource,
    int resourcelen
);

Parameters

decoding
Decoding flags
uri
Universal Resource Identifier
scheme
Scheme (http, https, etc.)
schemelen
Size of scheme buffer
username
Username
usernamelen
Size of username buffer
host
Hostname
hostlen
Size of hostname buffer
port
Port number to use
resource
Resource/filename
resourcelen
Size of resource buffer

Return Value

Result of separation

 CUPS 1.3/macOS 10.5 httpSetAuthString

Set the current authorization string.

void httpSetAuthString (
    http_t *http,
    const char *scheme,
    const char *data
);

Parameters

http
HTTP connection
scheme
Auth scheme (NULL to clear it)
data
Auth data (NULL for none)

Discussion

This function just stores a copy of the current authorization string in the HTTP connection object. You must still call httpSetField() to set HTTP_FIELD_AUTHORIZATION prior to issuing a HTTP request using httpGet(), httpHead(), httpOptions(), httpPost, or httpPut().

 CUPS 1.1.19/macOS 10.3 httpSetCookie

Set the cookie value(s).

void httpSetCookie (
    http_t *http,
    const char *cookie
);

Parameters

http
Connection
cookie
Cookie string

 CUPS 1.5/macOS 10.7 httpSetCredentials

Set the credentials associated with an encrypted connection.

int httpSetCredentials (
    http_t *http,
    cups_array_t *credentials
);

Parameters

http
HTTP connection
credentials
Array of credentials

Return Value

Status of call (0 = success)

 CUPS 1.7/macOS 10.9 httpSetDefaultField

Set the default value of an HTTP header.

void httpSetDefaultField (
    http_t *http,
    http_field_t field,
    const char *value
);

Parameters

http
HTTP connection
field
Field index
value
Value

Discussion

Currently only HTTP_FIELD_ACCEPT_ENCODING, HTTP_FIELD_SERVER, and HTTP_FIELD_USER_AGENT can be set.

 CUPS 1.2/macOS 10.5 httpSetExpect

Set the Expect: header in a request.

void httpSetExpect (
    http_t *http,
    http_status_t expect
);

Parameters

http
HTTP connection
expect
HTTP status to expect (HTTP_STATUS_CONTINUE)

Discussion

Currently only HTTP_STATUS_CONTINUE is supported for the "expect" argument.

httpSetField

Set the value of an HTTP header.

void httpSetField (
    http_t *http,
    http_field_t field,
    const char *value
);

Parameters

http
HTTP connection
field
Field index
value
Value

 CUPS 2.0/OS 10.10 httpSetKeepAlive

Set the current Keep-Alive state of a connection.

void httpSetKeepAlive (
    http_t *http,
    http_keepalive_t keep_alive
);

Parameters

http
HTTP connection
keep_alive
New Keep-Alive value

 CUPS 1.2/macOS 10.5 httpSetLength

Set the content-length and content-encoding.

void httpSetLength (
    http_t *http,
    size_t length
);

Parameters

http
HTTP connection
length
Length (0 for chunked)

 CUPS 1.5/macOS 10.7 httpSetTimeout

Set read/write timeouts and an optional callback.

void httpSetTimeout (
    http_t *http,
    double timeout,
    http_timeout_cb_t cb,
    void *user_data
);

Parameters

http
HTTP connection
timeout
Number of seconds for timeout, must be greater than 0
cb
Callback function or NULL
user_data
User data pointer

Discussion

The optional timeout callback receives both the HTTP connection and a user data pointer and must return 1 to continue or 0 to error (time) out.

 CUPS 2.0/OS 10.10 httpShutdown

Shutdown one side of an HTTP connection.

void httpShutdown (
    http_t *http
);

Parameters

http
HTTP connection

 CUPS 2.0/OS 10.10 httpStateString

Return the string describing a HTTP state value.

const char *httpStateString (
    http_state_t state
);

Parameters

state
HTTP state value

Return Value

State string

httpStatus

Return a short string describing a HTTP status code.

const char *httpStatus (
    http_status_t status
);

Parameters

status
HTTP status code

Return Value

Localized status string

Discussion

The returned string is localized to the current POSIX locale and is based on the status strings defined in RFC 2616.

httpTrace

Send an TRACE request to the server.

int httpTrace (
    http_t *http,
    const char *uri
);

Parameters

http
HTTP connection
uri
URI for trace

Return Value

Status of call (0 = success)

 CUPS 2.0/OS 10.10 httpURIStatusString

Return a string describing a URI status code.

const char *httpURIStatusString (
    http_uri_status_t status
);

Parameters

status
URI status code

Return Value

Localized status string

httpUpdate

Update the current HTTP state for incoming data.

http_status_t httpUpdate (
    http_t *http
);

Parameters

http
HTTP connection

Return Value

HTTP status

 CUPS 1.1.19/macOS 10.3 httpWait

Wait for data available on a connection.

int httpWait (
    http_t *http,
    int msec
);

Parameters

http
HTTP connection
msec
Milliseconds to wait

Return Value

1 if data is available, 0 otherwise

 DEPRECATED httpWrite

Write data to a HTTP connection.

int httpWrite (
    http_t *http,
    const char *buffer,
    int length
);

Parameters

http
HTTP connection
buffer
Buffer for data
length
Number of bytes to write

Return Value

Number of bytes written

Discussion

This function is deprecated. Use the httpWrite2() function which can write more than 2GB of data.

 CUPS 1.2/macOS 10.5 httpWrite2

Write data to a HTTP connection.

ssize_t httpWrite2 (
    http_t *http,
    const char *buffer,
    size_t length
);

Parameters

http
HTTP connection
buffer
Buffer for data
length
Number of bytes to write

Return Value

Number of bytes written

 CUPS 1.7/macOS 10.9 httpWriteResponse

Write a HTTP response to a client connection.

int httpWriteResponse (
    http_t *http,
    http_status_t status
);

Parameters

http
HTTP connection
status
Status code

Return Value

0 on success, -1 on error

ippAddBoolean

Add a boolean attribute to an IPP message.

ipp_attribute_t *ippAddBoolean (
    ipp_t *ipp,
    ipp_tag_t group,
    const char *name,
    char value
);

Parameters

ipp
IPP message
group
IPP group
name
Name of attribute
value
Value of attribute

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

ippAddBooleans

Add an array of boolean values.

ipp_attribute_t *ippAddBooleans (
    ipp_t *ipp,
    ipp_tag_t group,
    const char *name,
    int num_values,
    const char *values
);

Parameters

ipp
IPP message
group
IPP group
name
Name of attribute
num_values
Number of values
values
Values

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

 CUPS 1.1.19/macOS 10.3 ippAddCollection

Add a collection value.

ipp_attribute_t *ippAddCollection (
    ipp_t *ipp,
    ipp_tag_t group,
    const char *name,
    ipp_t *value
);

Parameters

ipp
IPP message
group
IPP group
name
Name of attribute
value
Value

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

 CUPS 1.1.19/macOS 10.3 ippAddCollections

Add an array of collection values.

ipp_attribute_t *ippAddCollections (
    ipp_t *ipp,
    ipp_tag_t group,
    const char *name,
    int num_values,
    const ipp_t **values
);

Parameters

ipp
IPP message
group
IPP group
name
Name of attribute
num_values
Number of values
values
Values

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

ippAddDate

Add a date attribute to an IPP message.

ipp_attribute_t *ippAddDate (
    ipp_t *ipp,
    ipp_tag_t group,
    const char *name,
    const ipp_uchar_t *value
);

Parameters

ipp
IPP message
group
IPP group
name
Name of attribute
value
Value

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

ippAddInteger

Add a integer attribute to an IPP message.

ipp_attribute_t *ippAddInteger (
    ipp_t *ipp,
    ipp_tag_t group,
    ipp_tag_t value_tag,
    const char *name,
    int value
);

Parameters

ipp
IPP message
group
IPP group
value_tag
Type of attribute
name
Name of attribute
value
Value of attribute

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

Supported values include enum (IPP_TAG_ENUM) and integer (IPP_TAG_INTEGER).

ippAddIntegers

Add an array of integer values.

ipp_attribute_t *ippAddIntegers (
    ipp_t *ipp,
    ipp_tag_t group,
    ipp_tag_t value_tag,
    const char *name,
    int num_values,
    const int *values
);

Parameters

ipp
IPP message
group
IPP group
value_tag
Type of attribute
name
Name of attribute
num_values
Number of values
values
Values

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

Supported values include enum (IPP_TAG_ENUM) and integer (IPP_TAG_INTEGER).

 CUPS 1.2/macOS 10.5 ippAddOctetString

Add an octetString value to an IPP message.

ipp_attribute_t *ippAddOctetString (
    ipp_t *ipp,
    ipp_tag_t group,
    const char *name,
    const void *data,
    int datalen
);

Parameters

ipp
IPP message
group
IPP group
name
Name of attribute
data
octetString data
datalen
Length of data in bytes

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

 CUPS 1.6/macOS 10.8 ippAddOutOfBand

Add an out-of-band value to an IPP message.

ipp_attribute_t *ippAddOutOfBand (
    ipp_t *ipp,
    ipp_tag_t group,
    ipp_tag_t value_tag,
    const char *name
);

Parameters

ipp
IPP message
group
IPP group
value_tag
Type of attribute
name
Name of attribute

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

Supported out-of-band values include unsupported-value (IPP_TAG_UNSUPPORTED_VALUE), default (IPP_TAG_DEFAULT), unknown (IPP_TAG_UNKNOWN), no-value (IPP_TAG_NOVALUE), not-settable (IPP_TAG_NOTSETTABLE), delete-attribute (IPP_TAG_DELETEATTR), and admin-define (IPP_TAG_ADMINDEFINE).

ippAddRange

Add a range of values to an IPP message.

ipp_attribute_t *ippAddRange (
    ipp_t *ipp,
    ipp_tag_t group,
    const char *name,
    int lower,
    int upper
);

Parameters

ipp
IPP message
group
IPP group
name
Name of attribute
lower
Lower value
upper
Upper value

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

The lower parameter must be less than or equal to the upper parameter.

ippAddRanges

Add ranges of values to an IPP message.

ipp_attribute_t *ippAddRanges (
    ipp_t *ipp,
    ipp_tag_t group,
    const char *name,
    int num_values,
    const int *lower,
    const int *upper
);

Parameters

ipp
IPP message
group
IPP group
name
Name of attribute
num_values
Number of values
lower
Lower values
upper
Upper values

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

ippAddResolution

Add a resolution value to an IPP message.

ipp_attribute_t *ippAddResolution (
    ipp_t *ipp,
    ipp_tag_t group,
    const char *name,
    ipp_res_t units,
    int xres,
    int yres
);

Parameters

ipp
IPP message
group
IPP group
name
Name of attribute
units
Units for resolution
xres
X resolution
yres
Y resolution

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

ippAddResolutions

Add resolution values to an IPP message.

ipp_attribute_t *ippAddResolutions (
    ipp_t *ipp,
    ipp_tag_t group,
    const char *name,
    int num_values,
    ipp_res_t units,
    const int *xres,
    const int *yres
);

Parameters

ipp
IPP message
group
IPP group
name
Name of attribute
num_values
Number of values
units
Units for resolution
xres
X resolutions
yres
Y resolutions

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

ippAddSeparator

Add a group separator to an IPP message.

ipp_attribute_t *ippAddSeparator (
    ipp_t *ipp
);

Parameters

ipp
IPP message

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

ippAddString

Add a language-encoded string to an IPP message.

ipp_attribute_t *ippAddString (
    ipp_t *ipp,
    ipp_tag_t group,
    ipp_tag_t value_tag,
    const char *name,
    const char *language,
    const char *value
);

Parameters

ipp
IPP message
group
IPP group
value_tag
Type of attribute
name
Name of attribute
language
Language code
value
Value

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

Supported string values include charset (IPP_TAG_CHARSET), keyword (IPP_TAG_KEYWORD), language (IPP_TAG_LANGUAGE), mimeMediaType (IPP_TAG_MIMETYPE), name (IPP_TAG_NAME), nameWithLanguage (IPP_TAG_NAMELANG), text (code IPP_TAG_TEXT@), textWithLanguage (IPP_TAG_TEXTLANG), uri (IPP_TAG_URI), and uriScheme (IPP_TAG_URISCHEME).

The language parameter must be non-NULL for nameWithLanguage and textWithLanguage string values and must be NULL for all other string values.

 CUPS 1.7/macOS 10.9 ippAddStringf

Add a formatted string to an IPP message.

ipp_attribute_t *ippAddStringf (
    ipp_t *ipp,
    ipp_tag_t group,
    ipp_tag_t value_tag,
    const char *name,
    const char *language,
    const char *format,
    ...
);

Parameters

ipp
IPP message
group
IPP group
value_tag
Type of attribute
name
Name of attribute
language
Language code (NULL for default)
format
Printf-style format string
...
Additional arguments as needed

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

Supported string values include charset (IPP_TAG_CHARSET), keyword (IPP_TAG_KEYWORD), language (IPP_TAG_LANGUAGE), mimeMediaType (IPP_TAG_MIMETYPE), name (IPP_TAG_NAME), nameWithLanguage (IPP_TAG_NAMELANG), text (code IPP_TAG_TEXT@), textWithLanguage (IPP_TAG_TEXTLANG), uri (IPP_TAG_URI), and uriScheme (IPP_TAG_URISCHEME).

The language parameter must be non-NULL for nameWithLanguage and textWithLanguage string values and must be NULL for all other string values.

The format parameter uses formatting characters compatible with the printf family of standard functions. Additional arguments follow it as needed. The formatted string is truncated as needed to the maximum length of the corresponding value type.

 CUPS 1.7/macOS 10.9 ippAddStringfv

Add a formatted string to an IPP message.

ipp_attribute_t *ippAddStringfv (
    ipp_t *ipp,
    ipp_tag_t group,
    ipp_tag_t value_tag,
    const char *name,
    const char *language,
    const char *format,
    va_list ap
);

Parameters

ipp
IPP message
group
IPP group
value_tag
Type of attribute
name
Name of attribute
language
Language code (NULL for default)
format
Printf-style format string
ap
Additional arguments

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

Supported string values include charset (IPP_TAG_CHARSET), keyword (IPP_TAG_KEYWORD), language (IPP_TAG_LANGUAGE), mimeMediaType (IPP_TAG_MIMETYPE), name (IPP_TAG_NAME), nameWithLanguage (IPP_TAG_NAMELANG), text (code IPP_TAG_TEXT@), textWithLanguage (IPP_TAG_TEXTLANG), uri (IPP_TAG_URI), and uriScheme (IPP_TAG_URISCHEME).

The language parameter must be non-NULL for nameWithLanguage and textWithLanguage string values and must be NULL for all other string values.

The format parameter uses formatting characters compatible with the printf family of standard functions. Additional arguments are passed in the stdarg pointer ap. The formatted string is truncated as needed to the maximum length of the corresponding value type.

ippAddStrings

Add language-encoded strings to an IPP message.

ipp_attribute_t *ippAddStrings (
    ipp_t *ipp,
    ipp_tag_t group,
    ipp_tag_t value_tag,
    const char *name,
    int num_values,
    const char *language,
    const char *const *values
);

Parameters

ipp
IPP message
group
IPP group
value_tag
Type of attribute
name
Name of attribute
num_values
Number of values
language
Language code (NULL for default)
values
Values

Return Value

New attribute

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

Supported string values include charset (IPP_TAG_CHARSET), keyword (IPP_TAG_KEYWORD), language (IPP_TAG_LANGUAGE), mimeMediaType (IPP_TAG_MIMETYPE), name (IPP_TAG_NAME), nameWithLanguage (IPP_TAG_NAMELANG), text (code IPP_TAG_TEXT@), textWithLanguage (IPP_TAG_TEXTLANG), uri (IPP_TAG_URI), and uriScheme (IPP_TAG_URISCHEME).

The language parameter must be non-NULL for nameWithLanguage and textWithLanguage string values and must be NULL for all other string values.

 CUPS 1.6/macOS 10.8 ippAttributeString

Convert the attribute's value to a string.

size_t ippAttributeString (
    ipp_attribute_t *attr,
    char *buffer,
    size_t bufsize
);

Parameters

attr
Attribute
buffer
String buffer or NULL
bufsize
Size of string buffer

Return Value

Number of bytes less nul

Discussion

Returns the number of bytes that would be written, not including the trailing nul. The buffer pointer can be NULL to get the required length, just like (v)snprintf.

 CUPS 1.7/macOS 10.9 ippContainsInteger

Determine whether an attribute contains the specified value or is within the list of ranges.

int ippContainsInteger (
    ipp_attribute_t *attr,
    int value
);

Parameters

attr
Attribute
value
Integer/enum value

Return Value

1 on a match, 0 on no match

Discussion

Returns non-zero when the attribute contains either a matching integer or enum value, or the value falls within one of the rangeOfInteger values for the attribute.

 CUPS 1.7/macOS 10.9 ippContainsString

Determine whether an attribute contains the specified string value.

int ippContainsString (
    ipp_attribute_t *attr,
    const char *value
);

Parameters

attr
Attribute
value
String value

Return Value

1 on a match, 0 on no match

Discussion

Returns non-zero when the attribute contains a matching charset, keyword, language, mimeMediaType, name, text, URI, or URI scheme value.

 CUPS 1.6/macOS 10.8 ippCopyAttribute

Copy an attribute.

ipp_attribute_t *ippCopyAttribute (
    ipp_t *dst,
    ipp_attribute_t *srcattr,
    int quickcopy
);

Parameters

dst
Destination IPP message
srcattr
Attribute to copy
quickcopy
1 for a referenced copy, 0 for normal

Return Value

New attribute

Discussion

The specified attribute, attr, is copied to the destination IPP message. When quickcopy is non-zero, a "shallow" reference copy of the attribute is created - this should only be done as long as the original source IPP message will not be freed for the life of the destination.

 CUPS 1.6/macOS 10.8 ippCopyAttributes

Copy attributes from one IPP message to another.

int ippCopyAttributes (
    ipp_t *dst,
    ipp_t *src,
    int quickcopy,
    ipp_copycb_t cb,
    void *context
);

Parameters

dst
Destination IPP message
src
Source IPP message
quickcopy
1 for a referenced copy, 0 for normal
cb
Copy callback or NULL for none
context
Context pointer

Return Value

1 on success, 0 on error

Discussion

Zero or more attributes are copied from the source IPP message, src, to the destination IPP message, dst. When quickcopy is non-zero, a "shallow" reference copy of the attribute is created - this should only be done as long as the original source IPP message will not be freed for the life of the destination.

The cb and context parameters provide a generic way to "filter" the attributes that are copied - the function must return 1 to copy the attribute or 0 to skip it. The function may also choose to do a partial copy of the source attribute itself.

 CUPS 1.7/macOS 10.9 ippCreateRequestedArray

Create a CUPS array of attribute names from the given requested-attributes attribute.

cups_array_t *ippCreateRequestedArray (
    ipp_t *request
);

Parameters

request
IPP request

Return Value

CUPS array or NULL if all

Discussion

This function creates a (sorted) CUPS array of attribute names matching the list of "requested-attribute" values supplied in an IPP request. All IANA- registered values are supported in addition to the CUPS IPP extension attributes.

The request parameter specifies the request message that was read from the client. NULL is returned if all attributes should be returned. Otherwise, the result is a sorted array of attribute names, where cupsArrayFind(array, "attribute-name") will return a non-NULL pointer. The array must be freed using the cupsArrayDelete function.

ippDateToTime

Convert from RFC 1903 Date/Time format to UNIX time in seconds.

time_t ippDateToTime (
    const ipp_uchar_t *date
);

Parameters

date
RFC 1903 date info

Return Value

UNIX time value

ippDelete

Delete an IPP message.

void ippDelete (
    ipp_t *ipp
);

Parameters

ipp
IPP message

 CUPS 1.1.19/macOS 10.3 ippDeleteAttribute

Delete a single attribute in an IPP message.

void ippDeleteAttribute (
    ipp_t *ipp,
    ipp_attribute_t *attr
);

Parameters

ipp
IPP message
attr
Attribute to delete

 CUPS 1.6/macOS 10.8 ippDeleteValues

Delete values in an attribute.

int ippDeleteValues (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    int count
);

Parameters

ipp
IPP message
attr
Attribute
element
Index of first value to delete (0-based)
count
Number of values to delete

Return Value

1 on success, 0 on failure

Discussion

The element parameter specifies the first value to delete, starting at 0. It must be less than the number of values returned by ippGetCount.

The attr parameter may be modified as a result of setting the value.

Deleting all values in an attribute deletes the attribute.

ippEnumString

Return a string corresponding to the enum value.

const char *ippEnumString (
    const char *attrname,
    int enumvalue
);

Parameters

attrname
Attribute name
enumvalue
Enum value

Return Value

Enum string

ippEnumValue

Return the value associated with a given enum string.

int ippEnumValue (
    const char *attrname,
    const char *enumstring
);

Parameters

attrname
Attribute name
enumstring
Enum string

Return Value

Enum value or -1 if unknown

ippErrorString

Return a name for the given status code.

const char *ippErrorString (
    ipp_status_t error
);

Parameters

error
Error status

Return Value

Text string

 CUPS 1.2/macOS 10.5 ippErrorValue

Return a status code for the given name.

ipp_status_t ippErrorValue (
    const char *name
);

Parameters

name
Name

Return Value

IPP status code

ippFindAttribute

Find a named attribute in a request.

ipp_attribute_t *ippFindAttribute (
    ipp_t *ipp,
    const char *name,
    ipp_tag_t type
);

Parameters

ipp
IPP message
name
Name of attribute
type
Type of attribute

Return Value

Matching attribute

Discussion

Starting with CUPS 2.0, the attribute name can contain a hierarchical list of attribute and member names separated by slashes, for example "media-col/media-size".

ippFindNextAttribute

Find the next named attribute in a request.

ipp_attribute_t *ippFindNextAttribute (
    ipp_t *ipp,
    const char *name,
    ipp_tag_t type
);

Parameters

ipp
IPP message
name
Name of attribute
type
Type of attribute

Return Value

Matching attribute

Discussion

Starting with CUPS 2.0, the attribute name can contain a hierarchical list of attribute and member names separated by slashes, for example "media-col/media-size".

 CUPS 1.6/macOS 10.8 ippFirstAttribute

Return the first attribute in the message.

ipp_attribute_t *ippFirstAttribute (
    ipp_t *ipp
);

Parameters

ipp
IPP message

Return Value

First attribute or NULL if none

 CUPS 1.6/macOS 10.8 ippGetBoolean

Get a boolean value for an attribute.

int ippGetBoolean (
    ipp_attribute_t *attr,
    int element
);

Parameters

attr
IPP attribute
element
Value number (0-based)

Return Value

Boolean value or 0 on error

Discussion

The element parameter specifies which value to get from 0 to ippGetCount(attr) - 1.

 CUPS 1.6/macOS 10.8 ippGetCollection

Get a collection value for an attribute.

ipp_t *ippGetCollection (
    ipp_attribute_t *attr,
    int element
);

Parameters

attr
IPP attribute
element
Value number (0-based)

Return Value

Collection value or NULL on error

Discussion

The element parameter specifies which value to get from 0 to ippGetCount(attr) - 1.

 CUPS 1.6/macOS 10.8 ippGetCount

Get the number of values in an attribute.

int ippGetCount (
    ipp_attribute_t *attr
);

Parameters

attr
IPP attribute

Return Value

Number of values or 0 on error

 CUPS 1.6/macOS 10.8 ippGetDate

Get a date value for an attribute.

const ipp_uchar_t *ippGetDate (
    ipp_attribute_t *attr,
    int element
);

Parameters

attr
IPP attribute
element
Value number (0-based)

Return Value

Date value or NULL

Discussion

The element parameter specifies which value to get from 0 to ippGetCount(attr) - 1.

 CUPS 1.6/macOS 10.8 ippGetGroupTag

Get the group associated with an attribute.

ipp_tag_t ippGetGroupTag (
    ipp_attribute_t *attr
);

Parameters

attr
IPP attribute

Return Value

Group tag or IPP_TAG_ZERO on error

 CUPS 1.6/macOS 10.8 ippGetInteger

Get the integer/enum value for an attribute.

int ippGetInteger (
    ipp_attribute_t *attr,
    int element
);

Parameters

attr
IPP attribute
element
Value number (0-based)

Return Value

Value or 0 on error

Discussion

The element parameter specifies which value to get from 0 to ippGetCount(attr) - 1.

 CUPS 1.6/macOS 10.8 ippGetName

Get the attribute name.

const char *ippGetName (
    ipp_attribute_t *attr
);

Parameters

attr
IPP attribute

Return Value

Attribute name or NULL for separators

 CUPS 1.7/macOS 10.9 ippGetOctetString

Get an octetString value from an IPP attribute.

void *ippGetOctetString (
    ipp_attribute_t *attr,
    int element,
    int *datalen
);

Parameters

attr
IPP attribute
element
Value number (0-based)
datalen
Length of octetString data

Return Value

Pointer to octetString data

Discussion

The element parameter specifies which value to get from 0 to ippGetCount(attr) - 1.

 CUPS 1.6/macOS 10.8 ippGetOperation

Get the operation ID in an IPP message.

ipp_op_t ippGetOperation (
    ipp_t *ipp
);

Parameters

ipp
IPP request message

Return Value

Operation ID or 0 on error

 CUPS 1.6/macOS 10.8 ippGetRange

Get a rangeOfInteger value from an attribute.

int ippGetRange (
    ipp_attribute_t *attr,
    int element,
    int *uppervalue
);

Parameters

attr
IPP attribute
element
Value number (0-based)
uppervalue
Upper value of range

Return Value

Lower value of range or 0

Discussion

The element parameter specifies which value to get from 0 to ippGetCount(attr) - 1.

 CUPS 1.6/macOS 10.8 ippGetRequestId

Get the request ID from an IPP message.

int ippGetRequestId (
    ipp_t *ipp
);

Parameters

ipp
IPP message

Return Value

Request ID or 0 on error

 CUPS 1.6/macOS 10.8 ippGetResolution

Get a resolution value for an attribute.

int ippGetResolution (
    ipp_attribute_t *attr,
    int element,
    int *yres,
    ipp_res_t *units
);

Parameters

attr
IPP attribute
element
Value number (0-based)
yres
Vertical/feed resolution
units
Units for resolution

Return Value

Horizontal/cross feed resolution or 0

Discussion

The element parameter specifies which value to get from 0 to ippGetCount(attr) - 1.

 CUPS 1.6/macOS 10.8 ippGetState

Get the IPP message state.

ipp_state_t ippGetState (
    ipp_t *ipp
);

Parameters

ipp
IPP message

Return Value

IPP message state value

 CUPS 1.6/macOS 10.8 ippGetStatusCode

Get the status code from an IPP response or event message.

ipp_status_t ippGetStatusCode (
    ipp_t *ipp
);

Parameters

ipp
IPP response or event message

Return Value

Status code in IPP message

ippGetString

Return the value...

const char *ippGetString (
    ipp_attribute_t *attr,
    int element,
    const char **language
);

Parameters

attr
IPP attribute
element
Value number (0-based)
language
Language code (NULL for don't care)

Return Value

Get the string and optionally the language code for an attribute.

The element parameter specifies which value to get from 0 to ippGetCount(attr) - 1.

 CUPS 1.6/macOS 10.8 ippGetValueTag

Get the value tag for an attribute.

ipp_tag_t ippGetValueTag (
    ipp_attribute_t *attr
);

Parameters

attr
IPP attribute

Return Value

Value tag or IPP_TAG_ZERO on error

 CUPS 1.6/macOS 10.8 ippGetVersion

Get the major and minor version number from an IPP message.

int ippGetVersion (
    ipp_t *ipp,
    int *minor
);

Parameters

ipp
IPP message
minor
Minor version number or NULL

Return Value

Major version number or 0 on error

ippLength

Compute the length of an IPP message.

size_t ippLength (
    ipp_t *ipp
);

Parameters

ipp
IPP message

Return Value

Size of IPP message

ippNew

Allocate a new IPP message.

ipp_t *ippNew (void);

Return Value

New IPP message

 CUPS 1.2/macOS 10.5 ippNewRequest

Allocate a new IPP request message.

ipp_t *ippNewRequest (
    ipp_op_t op
);

Parameters

op
Operation code

Return Value

IPP request message

Discussion

The new request message is initialized with the attributes-charset and attributes-natural-language attributes added. The attributes-natural-language value is derived from the current locale.

 CUPS 1.7/macOS 10.9 ippNewResponse

Allocate a new IPP response message.

ipp_t *ippNewResponse (
    ipp_t *request
);

Parameters

request
IPP request message

Return Value

IPP response message

Discussion

The new response message is initialized with the same version-number, request-id, attributes-charset, and attributes-natural-language as the provided request message. If the attributes-charset or attributes-natural-language attributes are missing from the request, "utf-8" and a value derived from the current locale are substituted, respectively.

 CUPS 1.6/macOS 10.8 ippNextAttribute

Return the next attribute in the message.

ipp_attribute_t *ippNextAttribute (
    ipp_t *ipp
);

Parameters

ipp
IPP message

Return Value

Next attribute or NULL if none

 CUPS 1.2/macOS 10.5 ippOpString

Return a name for the given operation id.

const char *ippOpString (
    ipp_op_t op
);

Parameters

op
Operation ID

Return Value

Name

 CUPS 1.2/macOS 10.5 ippOpValue

Return an operation id for the given name.

ipp_op_t ippOpValue (
    const char *name
);

Parameters

name
Textual name

Return Value

Operation ID

ippPort

Return the default IPP port number.

int ippPort (void);

Return Value

Port number

ippRead

Read data for an IPP message from a HTTP connection.

ipp_state_t ippRead (
    http_t *http,
    ipp_t *ipp
);

Parameters

http
HTTP connection
ipp
IPP data

Return Value

Current state

 CUPS 1.1.19/macOS 10.3 ippReadFile

Read data for an IPP message from a file.

ipp_state_t ippReadFile (
    int fd,
    ipp_t *ipp
);

Parameters

fd
HTTP data
ipp
IPP data

Return Value

Current state

 CUPS 1.2/macOS 10.5 ippReadIO

Read data for an IPP message.

ipp_state_t ippReadIO (
    void *src,
    ipp_iocb_t cb,
    int blocking,
    ipp_t *parent,
    ipp_t *ipp
);

Parameters

src
Data source
cb
Read callback function
blocking
Use blocking IO?
parent
Parent request, if any
ipp
IPP data

Return Value

Current state

 CUPS 1.6/macOS 10.8 ippSetBoolean

Set a boolean value in an attribute.

int ippSetBoolean (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    int boolvalue
);

Parameters

ipp
IPP message
attr
IPP attribute
element
Value number (0-based)
boolvalue
Boolean value

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The element parameter specifies which value to set from 0 to ippGetCount(attr).

 CUPS 1.6/macOS 10.8 ippSetCollection

Set a collection value in an attribute.

int ippSetCollection (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    ipp_t *colvalue
);

Parameters

ipp
IPP message
attr
IPP attribute
element
Value number (0-based)
colvalue
Collection value

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The element parameter specifies which value to set from 0 to ippGetCount(attr).

 CUPS 1.6/macOS 10.8 ippSetDate

Set a date value in an attribute.

int ippSetDate (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    const ipp_uchar_t *datevalue
);

Parameters

ipp
IPP message
attr
IPP attribute
element
Value number (0-based)
datevalue
Date value

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The element parameter specifies which value to set from 0 to ippGetCount(attr).

 CUPS 1.6/macOS 10.8 ippSetGroupTag

Set the group tag of an attribute.

int ippSetGroupTag (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    ipp_tag_t group_tag
);

Parameters

ipp
IPP message
attr
Attribute
group_tag
Group tag

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The group parameter specifies the IPP attribute group tag: none (IPP_TAG_ZERO, for member attributes), document (IPP_TAG_DOCUMENT), event notification (IPP_TAG_EVENT_NOTIFICATION), operation (IPP_TAG_OPERATION), printer (IPP_TAG_PRINTER), subscription (IPP_TAG_SUBSCRIPTION), or unsupported (IPP_TAG_UNSUPPORTED_GROUP).

 CUPS 1.6/macOS 10.8 ippSetInteger

Set an integer or enum value in an attribute.

int ippSetInteger (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    int intvalue
);

Parameters

ipp
IPP message
attr
IPP attribute
element
Value number (0-based)
intvalue
Integer/enum value

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The element parameter specifies which value to set from 0 to ippGetCount(attr).

 CUPS 1.6/macOS 10.8 ippSetName

Set the name of an attribute.

int ippSetName (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    const char *name
);

Parameters

ipp
IPP message
attr
IPP attribute
name
Attribute name

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

 CUPS 1.7/macOS 10.9 ippSetOctetString

Set an octetString value in an IPP attribute.

int ippSetOctetString (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    const void *data,
    int datalen
);

Parameters

ipp
IPP message
attr
IPP attribute
element
Value number (0-based)
data
Pointer to octetString data
datalen
Length of octetString data

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The element parameter specifies which value to set from 0 to ippGetCount(attr).

 CUPS 1.6/macOS 10.8 ippSetOperation

Set the operation ID in an IPP request message.

int ippSetOperation (
    ipp_t *ipp,
    ipp_op_t op
);

Parameters

ipp
IPP request message
op
Operation ID

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

ippSetPort

Set the default port number.

void ippSetPort (
    int p
);

Parameters

p
Port number to use

 CUPS 1.6/macOS 10.8 ippSetRange

Set a rangeOfInteger value in an attribute.

int ippSetRange (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    int lowervalue,
    int uppervalue
);

Parameters

ipp
IPP message
attr
IPP attribute
element
Value number (0-based)
lowervalue
Lower bound for range
uppervalue
Upper bound for range

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The element parameter specifies which value to set from 0 to ippGetCount(attr).

 CUPS 1.6/macOS 10.8 ippSetRequestId

Set the request ID in an IPP message.

int ippSetRequestId (
    ipp_t *ipp,
    int request_id
);

Parameters

ipp
IPP message
request_id
Request ID

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The request_id parameter must be greater than 0.

 CUPS 1.6/macOS 10.8 ippSetResolution

Set a resolution value in an attribute.

int ippSetResolution (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    ipp_res_t unitsvalue,
    int xresvalue,
    int yresvalue
);

Parameters

ipp
IPP message
attr
IPP attribute
element
Value number (0-based)
unitsvalue
Resolution units
xresvalue
Horizontal/cross feed resolution
yresvalue
Vertical/feed resolution

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The element parameter specifies which value to set from 0 to ippGetCount(attr).

 CUPS 1.6/macOS 10.8 ippSetState

Set the current state of the IPP message.

int ippSetState (
    ipp_t *ipp,
    ipp_state_t state
);

Parameters

ipp
IPP message
state
IPP state value

Return Value

1 on success, 0 on failure

 CUPS 1.6/macOS 10.8 ippSetStatusCode

Set the status code in an IPP response or event message.

int ippSetStatusCode (
    ipp_t *ipp,
    ipp_status_t status
);

Parameters

ipp
IPP response or event message
status
Status code

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

 CUPS 1.6/macOS 10.8 ippSetString

Set a string value in an attribute.

int ippSetString (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    const char *strvalue
);

Parameters

ipp
IPP message
attr
IPP attribute
element
Value number (0-based)
strvalue
String value

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The element parameter specifies which value to set from 0 to ippGetCount(attr).

 CUPS 1.7/macOS 10.9 ippSetStringf

Set a formatted string value of an attribute.

int ippSetStringf (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    const char *format,
    ...
);

Parameters

ipp
IPP message
attr
IPP attribute
element
Value number (0-based)
format
Printf-style format string
...
Additional arguments as needed

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The element parameter specifies which value to set from 0 to ippGetCount(attr).

The format parameter uses formatting characters compatible with the printf family of standard functions. Additional arguments follow it as needed. The formatted string is truncated as needed to the maximum length of the corresponding value type.

 CUPS 1.7/macOS 10.9 ippSetStringfv

Set a formatted string value of an attribute.

int ippSetStringfv (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    int element,
    const char *format,
    va_list ap
);

Parameters

ipp
IPP message
attr
IPP attribute
element
Value number (0-based)
format
Printf-style format string
ap
Pointer to additional arguments

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

The element parameter specifies which value to set from 0 to ippGetCount(attr).

The format parameter uses formatting characters compatible with the printf family of standard functions. Additional arguments follow it as needed. The formatted string is truncated as needed to the maximum length of the corresponding value type.

 CUPS 1.6/macOS 10.8 ippSetValueTag

Set the value tag of an attribute.

int ippSetValueTag (
    ipp_t *ipp,
    ipp_attribute_t **attr,
    ipp_tag_t value_tag
);

Parameters

ipp
IPP message
attr
IPP attribute
value_tag
Value tag

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The attr parameter may be modified as a result of setting the value.

Integer (IPP_TAG_INTEGER) values can be promoted to rangeOfInteger (IPP_TAG_RANGE) values, the various string tags can be promoted to name (IPP_TAG_NAME) or nameWithLanguage (IPP_TAG_NAMELANG) values, text (IPP_TAG_TEXT) values can be promoted to textWithLanguage (IPP_TAG_TEXTLANG) values, and all values can be demoted to the various out-of-band value tags such as no-value (IPP_TAG_NOVALUE). All other changes will be rejected.

Promoting a string attribute to nameWithLanguage or textWithLanguage adds the language code in the "attributes-natural-language" attribute or, if not present, the language code for the current locale.

 CUPS 1.6/macOS 10.8 ippSetVersion

Set the version number in an IPP message.

int ippSetVersion (
    ipp_t *ipp,
    int major,
    int minor
);

Parameters

ipp
IPP message
major
Major version number (major.minor)
minor
Minor version number (major.minor)

Return Value

1 on success, 0 on failure

Discussion

The ipp parameter refers to an IPP message previously created using the ippNew, ippNewRequest, or ippNewResponse functions.

The valid version numbers are currently 1.0, 1.1, 2.0, 2.1, and 2.2.

 CUPS 2.0/OS 10.10 ippStateString

Return the name corresponding to a state value.

const char *ippStateString (
    ipp_state_t state
);

Parameters

state
State value

Return Value

State name

 CUPS 1.4/macOS 10.6 ippTagString

Return the tag name corresponding to a tag value.

const char *ippTagString (
    ipp_tag_t tag
);

Parameters

tag
Tag value

Return Value

Tag name

Discussion

The returned names are defined in RFC 2911 and 3382.

 CUPS 1.4/macOS 10.6 ippTagValue

Return the tag value corresponding to a tag name.

ipp_tag_t ippTagValue (
    const char *name
);

Parameters

name
Tag name

Return Value

Tag value

Discussion

The tag names are defined in RFC 2911 and 3382.

ippTimeToDate

Convert from UNIX time to RFC 1903 format.

const ipp_uchar_t *ippTimeToDate (
    time_t t
);

Parameters

t
UNIX time value

Return Value

RFC-1903 date/time data

 CUPS 1.7/macOS 10.9 ippValidateAttribute

Validate the contents of an attribute.

int ippValidateAttribute (
    ipp_attribute_t *attr
);

Parameters

attr
Attribute

Return Value

1 if valid, 0 otherwise

Discussion

This function validates the contents of an attribute based on the name and value tag. 1 is returned if the attribute is valid, 0 otherwise. On failure, cupsLastErrorString() is set to a human-readable message.

 CUPS 1.7/macOS 10.9 ippValidateAttributes

Validate all attributes in an IPP message.

int ippValidateAttributes (
    ipp_t *ipp
);

Parameters

ipp
IPP message

Return Value

1 if valid, 0 otherwise

Discussion

This function validates the contents of the IPP message, including each attribute. Like ippValidateAttribute, cupsLastErrorString() is set to a human-readable message on failure.

ippWrite

Write data for an IPP message to a HTTP connection.

ipp_state_t ippWrite (
    http_t *http,
    ipp_t *ipp
);

Parameters

http
HTTP connection
ipp
IPP data

Return Value

Current state

 CUPS 1.1.19/macOS 10.3 ippWriteFile

Write data for an IPP message to a file.

ipp_state_t ippWriteFile (
    int fd,
    ipp_t *ipp
);

Parameters

fd
HTTP data
ipp
IPP data

Return Value

Current state

 CUPS 1.2/macOS 10.5 ippWriteIO

Write data for an IPP message.

ipp_state_t ippWriteIO (
    void *dst,
    ipp_iocb_t cb,
    int blocking,
    ipp_t *parent,
    ipp_t *ipp
);

Parameters

dst
Destination
cb
Write callback function
blocking
Use blocking IO?
parent
Parent IPP message
ipp
IPP data

Return Value

Current state

 CUPS 1.7/macOS 10.9 pwgFormatSizeName

Generate a PWG self-describing media size name.

int pwgFormatSizeName (
    char *keyword,
    size_t keysize,
    const char *prefix,
    const char *name,
    int width,
    int length,
    const char *units
);

Parameters

keyword
Keyword buffer
keysize
Size of keyword buffer
prefix
Prefix for PWG size or NULL for automatic
name
Size name or NULL
width
Width of page in 2540ths
length
Length of page in 2540ths
units
Units - "in", "mm", or NULL for automatic

Return Value

1 on success, 0 on failure

Discussion

This function generates a PWG self-describing media size name of the form "prefix_name_WIDTHxLENGTHunits". The prefix is typically "custom" or "roll" for user-supplied sizes but can also be "disc", "iso", "jis", "jpn", "na", "oe", "om", "prc", or "roc". A value of NULL automatically chooses "oe" or "om" depending on the units.

The size name may only contain lowercase letters, numbers, "-", and ".". If NULL is passed, the size name will contain the formatted dimensions.

The width and length are specified in hundredths of millimeters, equivalent to 1/100000th of a meter or 1/2540th of an inch. The width, length, and units used for the generated size name are calculated automatically if the units string is NULL, otherwise inches ("in") or millimeters ("mm") are used.

 CUPS 1.7/macOS 10.9 pwgInitSize

Initialize a pwg_size_t structure using IPP Job Template attributes.

int pwgInitSize (
    pwg_size_t *size,
    ipp_t *job,
    int *margins_set
);

Parameters

size
Size to initialize
job
Job template attributes
margins_set
1 if margins were set, 0 otherwise

Return Value

1 if size was initialized, 0 otherwise

Discussion

This function initializes a pwg_size_t structure from an IPP "media" or "media-col" attribute in the specified IPP message. 0 is returned if neither attribute is found in the message or the values are not valid.

The "margins_set" variable is initialized to 1 if any "media-xxx-margin" member attribute was specified in the "media-col" Job Template attribute, otherwise it is initialized to 0.

 CUPS 1.7/macOS 10.9 pwgMediaForLegacy

Find a PWG media size by ISO/IPP legacy name.

pwg_media_t *pwgMediaForLegacy (
    const char *legacy
);

Parameters

legacy
Legacy size name

Return Value

Matching size or NULL

Discussion

The "name" argument specifies the legacy ISO media size name, for example "iso-a4" or "na-letter".

 CUPS 1.7/macOS 10.9 pwgMediaForPPD

Find a PWG media size by Adobe PPD name.

pwg_media_t *pwgMediaForPPD (
    const char *ppd
);

Parameters

ppd
PPD size name

Return Value

Matching size or NULL

Discussion

The "ppd" argument specifies an Adobe page size name as defined in Table B.1 of the Adobe PostScript Printer Description File Format Specification Version 4.3.

If the name is non-standard, the returned PWG media size is stored in thread-local storage and is overwritten by each call to the function in the thread. Custom names can be of the form "Custom.WIDTHxLENGTH[units]" or "WIDTHxLENGTH[units]".

 CUPS 1.7/macOS 10.9 pwgMediaForPWG

Find a PWG media size by 5101.1 self-describing name.

pwg_media_t *pwgMediaForPWG (
    const char *pwg
);

Parameters

pwg
PWG size name

Return Value

Matching size or NULL

Discussion

The "pwg" argument specifies a self-describing media size name of the form "prefix_name_WIDTHxLENGTHunits" as defined in PWG 5101.1.

If the name is non-standard, the returned PWG media size is stored in thread-local storage and is overwritten by each call to the function in the thread.

 CUPS 1.7/macOS 10.9 pwgMediaForSize

Get the PWG media size for the given dimensions.

pwg_media_t *pwgMediaForSize (
    int width,
    int length
);

Parameters

width
Width in hundredths of millimeters
length
Length in hundredths of millimeters

Return Value

PWG media name

Discussion

The "width" and "length" are in hundredths of millimeters, equivalent to 1/100000th of a meter or 1/2540th of an inch.

If the dimensions are non-standard, the returned PWG media size is stored in thread-local storage and is overwritten by each call to the function in the thread.

Data Types

cups_adv_t

AdvanceMedia attribute values

typedef enum cups_adv_e cups_adv_t;

cups_bool_t

Boolean type

typedef enum cups_bool_e cups_bool_t;

 CUPS 1.5/macOS 10.7 cups_client_cert_cb_t

Client credentials callback

typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls, cups_array_t *distinguished_names, void *user_data);

cups_cspace_t

cupsColorSpace attribute values

typedef enum cups_cspace_e cups_cspace_t;

cups_cut_t

CutMedia attribute values

typedef enum cups_cut_e cups_cut_t;

 CUPS 1.6/macOS 10.8 cups_dest_block_t

Destination enumeration block

typedef int (*cups_dest_block_t(unsigned flags, cups_dest_t *dest);

 CUPS 1.6/macOS 10.8 cups_dest_cb_t

Destination enumeration callback

typedef int (*cups_dest_cb_t)(void *user_data, unsigned flags, cups_dest_t *dest);

cups_dest_t

Destination

typedef struct cups_dest_s cups_dest_t;

 CUPS 1.6/macOS 10.8 cups_dinfo_t

Destination capability and status information

typedef struct _cups_dinfo_s cups_dinfo_t;

cups_edge_t

LeadingEdge attribute values

typedef enum cups_edge_e cups_edge_t;

cups_interpret_cb_t

cupsRasterInterpretPPD callback function

typedef int (*cups_interpret_cb_t)(cups_page_header2_t *header, int preferred_bits);

cups_job_t

Job

typedef struct cups_job_s cups_job_t;

cups_jog_t

Jog attribute values

typedef enum cups_jog_e cups_jog_t;

cups_mode_t

cupsRasterOpen modes

typedef enum cups_mode_e cups_mode_t;

cups_option_t

Printer Options

typedef struct cups_option_s cups_option_t;

cups_order_t

cupsColorOrder attribute values

typedef enum cups_order_e cups_order_t;

cups_orient_t

Orientation attribute values

typedef enum cups_orient_e cups_orient_t;

 CUPS 1.2/macOS 10.5 cups_page_header2_t

Version 2 page header

typedef struct cups_page_header2_s cups_page_header2_t;

 DEPRECATED cups_page_header_t

Version 1 page header

typedef struct cups_page_header_s cups_page_header_t;

 CUPS 1.4/macOS 10.6 cups_password_cb2_t

New password callback

typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data);

cups_password_cb_t

Password callback

typedef const char *(*cups_password_cb_t)(const char *prompt);

cups_ptype_t

Printer type/capability bits

typedef unsigned cups_ptype_t;

cups_raster_iocb_t

cupsRasterOpenIO callback function

typedef ssize_t (*cups_raster_iocb_t)(void *ctx, unsigned char *buffer, size_t length);

cups_raster_t

Raster stream data

typedef struct _cups_raster_s cups_raster_t;

 CUPS 1.5/macOS 10.7 cups_server_cert_cb_t

Server credentials callback

typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls, cups_array_t *certs, void *user_data);

 CUPS 1.6/macOS 10.8 cups_size_t

Media Size

typedef struct cups_size_s cups_size_t;

gss_auth_identity_desc

Local functions...

typedef struct gss_auth_identity gss_auth_identity_desc;

 CUPS 1.2/macOS 10.5 http_addr_t

Socket address union, which makes using IPv6 and other address types easier and more portable.

typedef union _http_addr_u / http_addr_t;

 CUPS 1.2/macOS 10.5 http_addrlist_t

Socket address list, which is used to enumerate all of the addresses that are associated with a hostname.

typedef struct http_addrlist_s / http_addrlist_t;

http_auth_t

HTTP authentication types

typedef enum http_auth_e http_auth_t;

 CUPS 1.5/macOS 10.7 http_credential_t

HTTP credential data

typedef struct http_credential_s http_credential_t;

http_encoding_t

HTTP transfer encoding values

typedef enum http_encoding_e http_encoding_t;

http_encryption_t

HTTP encryption values

typedef enum http_encryption_e http_encryption_t;

http_field_t

HTTP field names

typedef enum http_field_e http_field_t;

http_keepalive_t

HTTP keep-alive values

typedef enum http_keepalive_e http_keepalive_t;

http_state_t

HTTP state values; states are server-oriented...

typedef enum http_state_e http_state_t;

http_t

HTTP connection type

typedef struct _http_s http_t;

 CUPS 1.5/macOS 10.7 http_timeout_cb_t

HTTP timeout callback

typedef int (*http_timeout_cb_t)(http_t *http, void *user_data);

 CUPS 2.0/OS 10.10 http_trust_t

Level of trust for credentials

typedef enum http_trust_e http_trust_t;

http_uri_coding_t

URI en/decode flags

typedef enum http_uri_coding_e http_uri_coding_t;

 CUPS 1.2 http_uri_status_t

URI separation status

typedef enum http_uri_status_e http_uri_status_t;

http_version_t

HTTP version numbers

typedef enum http_version_e http_version_t;

ipp_attribute_t

IPP attribute

typedef struct _ipp_attribute_s ipp_attribute_t;

ipp_copycb_t

The following structures are PRIVATE starting with CUPS 1.6/macOS 10.8. Please use the new accessor functions available in CUPS 1.6 and later, as these definitions will be moved to a private header file in a future release.

typedef int (*ipp_copycb_t)(void *context, ipp_t *dst, ipp_attribute_t *attr);

ipp_dstate_t

Document states

typedef enum ipp_dstate_e ipp_dstate_t;

ipp_finish_t

Job collation types

typedef enum ipp_finishings_e ipp_finish_t;

 CUPS 1.2/macOS 10.5 ipp_iocb_t

IPP IO Callback Function

typedef ssize_t (*ipp_iocb_t)(void *context, ipp_uchar_t *buffer, size_t bytes);

ipp_jcollate_t

Job collation types

typedef enum ipp_jcollate_e ipp_jcollate_t;

ipp_orient_t

Orientation values

typedef enum ipp_orient_e ipp_orient_t;

ipp_pstate_t

Printer states

typedef enum ipp_pstate_e ipp_pstate_t;

ipp_quality_t

Qualities

typedef enum ipp_quality_e ipp_quality_t;

ipp_res_t

Resolution units

typedef enum ipp_res_e ipp_res_t;

ipp_state_t

IPP states

typedef enum ipp_state_e ipp_state_t;

ipp_t

IPP request/response data

typedef struct _ipp_s ipp_t;

ipp_uchar_t

Unsigned 8-bit integer/character

typedef unsigned char ipp_uchar_t;

pwg_map_t

Map element - PPD to/from PWG

typedef struct pwg_map_s pwg_map_t;

pwg_media_t

Common media size data

typedef struct pwg_media_s pwg_media_t;

pwg_size_t

Size element - PPD to/from PWG

typedef struct pwg_size_s pwg_size_t;

Structures

cups_dest_s

Destination

struct cups_dest_s {
    char *name, *instance;
    int is_default;
    int num_options;
    cups_option_t *options;
};

Members

instance
Local instance name or NULL
is_default
Is this printer the default?
num_options
Number of options
options
Options

cups_job_s

Job

struct cups_job_s {
    time_t completed_time;
    time_t creation_time;
    char *dest;
    char *format;
    int id;
    int priority;
    time_t processing_time;
    int size;
    ipp_jstate_t state;
    char *title;
    char *user;
};

Members

completed_time
Time the job was completed
creation_time
Time the job was created
dest
Printer or class name
format
Document format
id
The job ID
priority
Priority (1-100)
processing_time
Time the job was processed
size
Size in kilobytes
state
Job state
title
Title/job name
user
User the submitted the job

cups_option_s

Printer Options

struct cups_option_s {
    char *name;
    char *value;
};

Members

name
Name of option
value
Value of option

 CUPS 1.2/macOS 10.5 cups_page_header2_s

Version 2 page header

struct cups_page_header2_s {
    unsigned AdvanceDistance;
    cups_adv_t AdvanceMedia;
    cups_bool_t Collate;
    cups_cut_t CutMedia;
    cups_bool_t Duplex;
    unsigned HWResolution[2];
    unsigned ImagingBoundingBox[4];
    cups_bool_t InsertSheet;
    cups_jog_t Jog;
    cups_edge_t LeadingEdge;
    cups_bool_t ManualFeed;
    unsigned Margins[2];
    char MediaClass[64];
    char MediaColor[64];
    unsigned MediaPosition;
    char MediaType[64];
    unsigned MediaWeight;
    cups_bool_t MirrorPrint;
    cups_bool_t NegativePrint;
    unsigned NumCopies;
    cups_orient_t Orientation;
    cups_bool_t OutputFaceUp;
    char OutputType[64];
    unsigned PageSize[2];
    cups_bool_t Separations;
    cups_bool_t TraySwitch;
    cups_bool_t Tumble;
    unsigned cupsBitsPerColor;
    unsigned cupsBitsPerPixel;
    float cupsBorderlessScalingFactor;
    unsigned cupsBytesPerLine;
    cups_order_t cupsColorOrder;
    cups_cspace_t cupsColorSpace;
    unsigned cupsCompression;
    unsigned cupsHeight;
    float cupsImagingBBox[4];
    unsigned cupsInteger[16];
    char cupsMarkerType[64];
    unsigned cupsMediaType;
    unsigned cupsNumColors;
    char cupsPageSizeName[64];
    float cupsPageSize[2];
    float cupsReal[16];
    char cupsRenderingIntent[64];
    unsigned cupsRowCount;
    unsigned cupsRowFeed;
    unsigned cupsRowStep;
    char cupsString[16][64];
    unsigned cupsWidth;
};

Members

AdvanceDistance
AdvanceDistance value in points
AdvanceMedia
AdvanceMedia value (cups_adv_t)
Collate
Collated copies value
CutMedia
CutMedia value (cups_cut_t)
Duplex
Duplexed (double-sided) value
HWResolution[2]
Resolution in dots-per-inch
ImagingBoundingBox[4]
Pixel region that is painted (points, left, bottom, right, top)
InsertSheet
InsertSheet value
Jog
Jog value (cups_jog_t)
LeadingEdge
LeadingEdge value (cups_edge_t)
ManualFeed
ManualFeed value
Margins[2]
Lower-lefthand margins in points
MediaClass[64]
MediaClass string
MediaColor[64]
MediaColor string
MediaPosition
MediaPosition value
MediaType[64]
MediaType string
MediaWeight
MediaWeight value in grams/m^2
MirrorPrint
MirrorPrint value
NegativePrint
NegativePrint value
NumCopies
Number of copies to produce
Orientation
Orientation value (cups_orient_t)
OutputFaceUp
OutputFaceUp value
OutputType[64]
OutputType string
PageSize[2]
Width and length of page in points
Separations
Separations value
TraySwitch
TraySwitch value
Tumble
Tumble value
cupsBitsPerColor
Number of bits for each color
cupsBitsPerPixel
Number of bits for each pixel
cupsBorderlessScalingFactor  CUPS 1.2/macOS 10.5 
Scaling that was applied to page data
cupsBytesPerLine
Number of bytes per line
cupsColorOrder
Order of colors
cupsColorSpace
True colorspace
cupsCompression
Device compression to use
cupsHeight
Height of page image in pixels
cupsImagingBBox[4]  CUPS 1.2/macOS 10.5 
Floating point ImagingBoundingBox (scaling factor not applied, left, bottom, right, top)
cupsInteger[16]  CUPS 1.2/macOS 10.5 
User-defined integer values
cupsMarkerType[64]  CUPS 1.2/macOS 10.5 
Ink/toner type
cupsMediaType
Media type code
cupsNumColors  CUPS 1.2/macOS 10.5 
Number of color compoents
cupsPageSizeName[64]  CUPS 1.2/macOS 10.5 
PageSize name
cupsPageSize[2]  CUPS 1.2/macOS 10.5 
Floating point PageSize (scaling * factor not applied)
cupsReal[16]  CUPS 1.2/macOS 10.5 
User-defined floating-point values
cupsRenderingIntent[64]  CUPS 1.2/macOS 10.5 
Color rendering intent
cupsRowCount
Rows per band
cupsRowFeed
Feed between bands
cupsRowStep
Spacing between lines
cupsString[16][64]  CUPS 1.2/macOS 10.5 
User-defined string values
cupsWidth
Width of page image in pixels

 DEPRECATED cups_page_header_s

Version 1 page header

struct cups_page_header_s {
    unsigned AdvanceDistance;
    cups_adv_t AdvanceMedia;
    cups_bool_t Collate;
    cups_cut_t CutMedia;
    cups_bool_t Duplex;
    unsigned HWResolution[2];
    unsigned ImagingBoundingBox[4];
    cups_bool_t InsertSheet;
    cups_jog_t Jog;
    cups_edge_t LeadingEdge;
    cups_bool_t ManualFeed;
    unsigned Margins[2];
    char MediaClass[64];
    char MediaColor[64];
    unsigned MediaPosition;
    char MediaType[64];
    unsigned MediaWeight;
    cups_bool_t MirrorPrint;
    cups_bool_t NegativePrint;
    unsigned NumCopies;
    cups_orient_t Orientation;
    cups_bool_t OutputFaceUp;
    char OutputType[64];
    unsigned PageSize[2];
    cups_bool_t Separations;
    cups_bool_t TraySwitch;
    cups_bool_t Tumble;
    unsigned cupsBitsPerColor;
    unsigned cupsBitsPerPixel;
    unsigned cupsBytesPerLine;
    cups_order_t cupsColorOrder;
    cups_cspace_t cupsColorSpace;
    unsigned cupsCompression;
    unsigned cupsHeight;
    unsigned cupsMediaType;
    unsigned cupsRowCount;
    unsigned cupsRowFeed;
    unsigned cupsRowStep;
    unsigned cupsWidth;
};

Members

AdvanceDistance
AdvanceDistance value in points
AdvanceMedia
AdvanceMedia value (cups_adv_t)
Collate
Collated copies value
CutMedia
CutMedia value (cups_cut_t)
Duplex
Duplexed (double-sided) value
HWResolution[2]
Resolution in dots-per-inch
ImagingBoundingBox[4]
Pixel region that is painted (points, left, bottom, right, top)
InsertSheet
InsertSheet value
Jog
Jog value (cups_jog_t)
LeadingEdge
LeadingEdge value (cups_edge_t)
ManualFeed
ManualFeed value
Margins[2]
Lower-lefthand margins in points
MediaClass[64]
MediaClass string
MediaColor[64]
MediaColor string
MediaPosition
MediaPosition value
MediaType[64]
MediaType string
MediaWeight
MediaWeight value in grams/m^2
MirrorPrint
MirrorPrint value
NegativePrint
NegativePrint value
NumCopies
Number of copies to produce
Orientation
Orientation value (cups_orient_t)
OutputFaceUp
OutputFaceUp value
OutputType[64]
OutputType string
PageSize[2]
Width and length of page in points
Separations
Separations value
TraySwitch
TraySwitch value
Tumble
Tumble value
cupsBitsPerColor
Number of bits for each color
cupsBitsPerPixel
Number of bits for each pixel
cupsBytesPerLine
Number of bytes per line
cupsColorOrder
Order of colors
cupsColorSpace
True colorspace
cupsCompression
Device compression to use
cupsHeight
Height of page image in pixels
cupsMediaType
Media type code
cupsRowCount
Rows per band
cupsRowFeed
Feed between bands
cupsRowStep
Spacing between lines
cupsWidth
Width of page image in pixels

 CUPS 1.6/macOS 10.8 cups_size_s

Media Size

struct cups_size_s {
    char media[128];
    int width, length, bottom, left, right, top;
};

Members

media[128]
Media name to use
top
Top margin in hundredths of millimeters

gss_auth_identity

Local functions...

struct gss_auth_identity {
    gss_buffer_t *credentialsRef;
    uint32_t flags;
    char *password;
    char *realm;
    uint32_t type;
    char *username;
};

Members

credentialsRef
flags
password
realm
type
username

 CUPS 1.2/macOS 10.5 http_addrlist_s

Socket address list, which is used to enumerate all of the addresses that are associated with a hostname.

struct http_addrlist_s {
    http_addr_t addr;
    struct http_addrlist_s *next;
};

Members

addr
Address
next
Pointer to next address in list

 CUPS 1.5/macOS 10.7 http_credential_s

HTTP credential data

struct http_credential_s {
    void *data;
    size_t datalen;
};

Members

data
Pointer to credential data
datalen
Credential length

pollfd

User data (unused)

struct pollfd *pollfds, unsigned int num_pollfds, int timeout, void *context) {
    void) context;
    void) timeout;
};

Members

context
timeout

pwg_map_s

Map element - PPD to/from PWG

struct pwg_map_s {
    char *pwg, *ppd;
};

Members

ppd
PPD option keyword

pwg_media_s

Common media size data

struct pwg_media_s {
    int width, length;
    const char *pwg, *legacy, *ppd;
};

Members

length
Length in 2540ths
ppd
Standard Adobe PPD name

pwg_size_s

Size element - PPD to/from PWG

struct pwg_size_s {
    pwg_map_t map;
    int width, length, left, bottom, right, top;
};

Members

map
Map element
top
Top margin in 2540ths

Constants

cups_adv_e

AdvanceMedia attribute values

Constants

CUPS_ADVANCE_FILE
Advance the roll after this file
CUPS_ADVANCE_JOB
Advance the roll after this job
CUPS_ADVANCE_NONE
Never advance the roll
CUPS_ADVANCE_PAGE
Advance the roll after this page
CUPS_ADVANCE_SET
Advance the roll after this set

cups_bool_e

Boolean type

Constants

CUPS_FALSE
Logical false
CUPS_TRUE
Logical true

cups_cspace_e

cupsColorSpace attribute values

Constants

CUPS_CSPACE_ADOBERGB  CUPS 1.4.5 
Red, green, blue (Adobe RGB)
CUPS_CSPACE_CIELab  CUPS 1.1.19/macOS 10.3 
CIE Lab
CUPS_CSPACE_CIEXYZ  CUPS 1.1.19/macOS 10.3 
CIE XYZ
CUPS_CSPACE_CMY
Cyan, magenta, yellow (DeviceCMY)
CUPS_CSPACE_CMYK
Cyan, magenta, yellow, black (DeviceCMYK)
CUPS_CSPACE_DEVICE1  CUPS 1.4.5 
DeviceN, 1 color
CUPS_CSPACE_DEVICE2  CUPS 1.4.5 
DeviceN, 2 colors
CUPS_CSPACE_DEVICE3  CUPS 1.4.5 
DeviceN, 3 colors
CUPS_CSPACE_DEVICE4  CUPS 1.4.5 
DeviceN, 4 colors
CUPS_CSPACE_DEVICE5  CUPS 1.4.5 
DeviceN, 5 colors
CUPS_CSPACE_DEVICE6  CUPS 1.4.5 
DeviceN, 6 colors
CUPS_CSPACE_DEVICE7  CUPS 1.4.5 
DeviceN, 7 colors
CUPS_CSPACE_DEVICE8  CUPS 1.4.5 
DeviceN, 8 colors
CUPS_CSPACE_DEVICE9  CUPS 1.4.5 
DeviceN, 9 colors
CUPS_CSPACE_DEVICEA  CUPS 1.4.5 
DeviceN, 10 colors
CUPS_CSPACE_DEVICEB  CUPS 1.4.5 
DeviceN, 11 colors
CUPS_CSPACE_DEVICEC  CUPS 1.4.5 
DeviceN, 12 colors
CUPS_CSPACE_DEVICED  CUPS 1.4.5 
DeviceN, 13 colors
CUPS_CSPACE_DEVICEE  CUPS 1.4.5 
DeviceN, 14 colors
CUPS_CSPACE_DEVICEF  CUPS 1.4.5 
DeviceN, 15 colors
CUPS_CSPACE_GMCK  DEPRECATED 
Gold, magenta, yellow, black
CUPS_CSPACE_GMCS  DEPRECATED 
Gold, magenta, yellow, silver
CUPS_CSPACE_GOLD  DEPRECATED 
Gold foil
CUPS_CSPACE_ICC1  CUPS 1.1.19/macOS 10.3 
ICC-based, 1 color
CUPS_CSPACE_ICC2  CUPS 1.1.19/macOS 10.3 
ICC-based, 2 colors
CUPS_CSPACE_ICC3  CUPS 1.1.19/macOS 10.3 
ICC-based, 3 colors
CUPS_CSPACE_ICC4  CUPS 1.1.19/macOS 10.3 
ICC-based, 4 colors
CUPS_CSPACE_ICC5  CUPS 1.1.19/macOS 10.3 
ICC-based, 5 colors
CUPS_CSPACE_ICC6  CUPS 1.1.19/macOS 10.3 
ICC-based, 6 colors
CUPS_CSPACE_ICC7  CUPS 1.1.19/macOS 10.3 
ICC-based, 7 colors
CUPS_CSPACE_ICC8  CUPS 1.1.19/macOS 10.3 
ICC-based, 8 colors
CUPS_CSPACE_ICC9  CUPS 1.1.19/macOS 10.3 
ICC-based, 9 colors
CUPS_CSPACE_ICCA  CUPS 1.1.19/macOS 10.3 
ICC-based, 10 colors
CUPS_CSPACE_ICCB  CUPS 1.1.19/macOS 10.3 
ICC-based, 11 colors
CUPS_CSPACE_ICCC  CUPS 1.1.19/macOS 10.3 
ICC-based, 12 colors
CUPS_CSPACE_ICCD  CUPS 1.1.19/macOS 10.3 
ICC-based, 13 colors
CUPS_CSPACE_ICCE  CUPS 1.1.19/macOS 10.3 
ICC-based, 14 colors
CUPS_CSPACE_ICCF  CUPS 1.1.19/macOS 10.3 
ICC-based, 15 colors
CUPS_CSPACE_K
Black (DeviceK)
CUPS_CSPACE_KCMY  DEPRECATED 
Black, cyan, magenta, yellow
CUPS_CSPACE_KCMYcm  DEPRECATED 
Black, cyan, magenta, yellow, light-cyan, light-magenta
CUPS_CSPACE_RGB
Red, green, blue (DeviceRGB, sRGB by default)
CUPS_CSPACE_RGBA
Red, green, blue, alpha (DeviceRGB, sRGB by default)
CUPS_CSPACE_RGBW  CUPS 1.2/macOS 10.5 
Red, green, blue, white (DeviceRGB, sRGB by default)
CUPS_CSPACE_SILVER  DEPRECATED 
Silver foil
CUPS_CSPACE_SRGB  CUPS 1.4.5 
Red, green, blue (sRGB)
CUPS_CSPACE_SW  CUPS 1.4.5 
Luminance (gamma 2.2)
CUPS_CSPACE_W
Luminance (DeviceGray, gamma 2.2 by default)
CUPS_CSPACE_WHITE  DEPRECATED 
White ink (as black)
CUPS_CSPACE_YMC  DEPRECATED 
Yellow, magenta, cyan
CUPS_CSPACE_YMCK  DEPRECATED 
Yellow, magenta, cyan, black

cups_cut_e

CutMedia attribute values

Constants

CUPS_CUT_FILE
Cut the roll after this file
CUPS_CUT_JOB
Cut the roll after this job
CUPS_CUT_NONE
Never cut the roll
CUPS_CUT_PAGE
Cut the roll after this page
CUPS_CUT_SET
Cut the roll after this set

cups_edge_e

LeadingEdge attribute values

Constants

CUPS_EDGE_BOTTOM
Leading edge is the bottom of the page
CUPS_EDGE_LEFT
Leading edge is the left of the page
CUPS_EDGE_RIGHT
Leading edge is the right of the page
CUPS_EDGE_TOP
Leading edge is the top of the page

cups_jog_e

Jog attribute values

Constants

CUPS_JOG_FILE
Move pages after this file
CUPS_JOG_JOB
Move pages after this job
CUPS_JOG_NONE
Never move pages
CUPS_JOG_SET
Move pages after this set

cups_mode_e

cupsRasterOpen modes

Constants

CUPS_RASTER_READ
Open stream for reading
CUPS_RASTER_WRITE
Open stream for writing
CUPS_RASTER_WRITE_COMPRESSED  CUPS 1.3/macOS 10.5 
Open stream for compressed writing
CUPS_RASTER_WRITE_PWG  CUPS 1.5/macOS 10.7 
Open stream for compressed writing in PWG Raster mode

cups_order_e

cupsColorOrder attribute values

Constants

CUPS_ORDER_BANDED
CCC MMM YYY KKK ...
CUPS_ORDER_CHUNKED
CMYK CMYK CMYK ...
CUPS_ORDER_PLANAR
CCC ... MMM ... YYY ... KKK ...

cups_orient_e

Orientation attribute values

Constants

CUPS_ORIENT_0
Don't rotate the page
CUPS_ORIENT_180
Turn the page upside down
CUPS_ORIENT_270
Rotate the page clockwise
CUPS_ORIENT_90
Rotate the page counter-clockwise

cups_ptype_e

Printer type/capability bit constants

Constants

CUPS_PRINTER_AUTHENTICATED  CUPS 1.2/macOS 10.5 
Printer requires authentication
CUPS_PRINTER_BIND
Can bind output
CUPS_PRINTER_BW
Can do B&W printing
CUPS_PRINTER_CLASS
Printer class
CUPS_PRINTER_COLLATE
Can collage copies
CUPS_PRINTER_COLOR
Can do color printing
CUPS_PRINTER_COMMANDS  CUPS 1.2/macOS 10.5 
Printer supports maintenance commands
CUPS_PRINTER_COPIES
Can do copies
CUPS_PRINTER_COVER
Can cover output
CUPS_PRINTER_DEFAULT
Default printer on network
CUPS_PRINTER_DELETE  CUPS 1.2/macOS 10.5 
Delete printer
CUPS_PRINTER_DUPLEX
Can do duplexing
CUPS_PRINTER_FAX
Fax queue
CUPS_PRINTER_LARGE
Can do D/E/A1/A0
CUPS_PRINTER_LOCAL
Local printer or class
CUPS_PRINTER_MEDIUM
Can do Tabloid/B/C/A3/A2
CUPS_PRINTER_MFP  CUPS 1.4/macOS 10.6 
Printer with scanning capabilities
CUPS_PRINTER_NOT_SHARED  CUPS 1.2/macOS 10.5 
Printer is not shared
CUPS_PRINTER_PUNCH
Can punch output
CUPS_PRINTER_REJECTING
Printer is rejecting jobs
CUPS_PRINTER_REMOTE
Remote printer or class
CUPS_PRINTER_SCANNER  CUPS 1.4/macOS 10.6 
Scanner-only device
CUPS_PRINTER_SMALL
Can do Letter/Legal/A4
CUPS_PRINTER_SORT
Can sort output
CUPS_PRINTER_STAPLE
Can staple output
CUPS_PRINTER_VARIABLE
Can do variable sizes

http_auth_e

HTTP authentication types

Constants

HTTP_AUTH_BASIC
Basic authentication in use
HTTP_AUTH_MD5
Digest authentication in use
HTTP_AUTH_MD5_INT
Digest authentication in use for body
HTTP_AUTH_MD5_SESS
MD5-session authentication in use
HTTP_AUTH_MD5_SESS_INT
MD5-session authentication in use for body
HTTP_AUTH_NEGOTIATE  CUPS 1.3/macOS 10.5 
GSSAPI authentication in use
HTTP_AUTH_NONE
No authentication in use

http_encoding_e

HTTP transfer encoding values

Constants

HTTP_ENCODING_CHUNKED
Data is chunked
HTTP_ENCODING_FIELDS
Sending HTTP fields
HTTP_ENCODING_LENGTH
Data is sent with Content-Length

http_encryption_e

HTTP encryption values

Constants

HTTP_ENCRYPTION_ALWAYS
Always encrypt (SSL)
HTTP_ENCRYPTION_IF_REQUESTED
Encrypt if requested (TLS upgrade)
HTTP_ENCRYPTION_NEVER
Never encrypt
HTTP_ENCRYPTION_REQUIRED
Encryption is required (TLS upgrade)

http_field_e

HTTP field names

Constants

HTTP_FIELD_ACCEPT_ENCODING  CUPS 1.7/macOS 10.9 
Accepting-Encoding field
HTTP_FIELD_ACCEPT_LANGUAGE
Accept-Language field
HTTP_FIELD_ACCEPT_RANGES
Accept-Ranges field
HTTP_FIELD_ALLOW  CUPS 1.7/macOS 10.9 
Allow field
HTTP_FIELD_AUTHORIZATION
Authorization field
HTTP_FIELD_CONNECTION
Connection field
HTTP_FIELD_CONTENT_ENCODING
Content-Encoding field
HTTP_FIELD_CONTENT_LANGUAGE
Content-Language field
HTTP_FIELD_CONTENT_LENGTH
Content-Length field
HTTP_FIELD_CONTENT_LOCATION
Content-Location field
HTTP_FIELD_CONTENT_MD5
Content-MD5 field
HTTP_FIELD_CONTENT_RANGE
Content-Range field
HTTP_FIELD_CONTENT_TYPE
Content-Type field
HTTP_FIELD_CONTENT_VERSION
Content-Version field
HTTP_FIELD_DATE
Date field
HTTP_FIELD_HOST
Host field
HTTP_FIELD_IF_MODIFIED_SINCE
If-Modified-Since field
HTTP_FIELD_IF_UNMODIFIED_SINCE
If-Unmodified-Since field
HTTP_FIELD_KEEP_ALIVE
Keep-Alive field
HTTP_FIELD_LAST_MODIFIED
Last-Modified field
HTTP_FIELD_LINK
Link field
HTTP_FIELD_LOCATION
Location field
HTTP_FIELD_MAX
Maximum field index
HTTP_FIELD_RANGE
Range field
HTTP_FIELD_REFERER
Referer field
HTTP_FIELD_RETRY_AFTER
Retry-After field
HTTP_FIELD_SERVER  CUPS 1.7/macOS 10.9 
Server field
HTTP_FIELD_TRANSFER_ENCODING
Transfer-Encoding field
HTTP_FIELD_UNKNOWN
Unknown field
HTTP_FIELD_UPGRADE
Upgrade field
HTTP_FIELD_USER_AGENT
User-Agent field
HTTP_FIELD_WWW_AUTHENTICATE
WWW-Authenticate field

http_keepalive_e

HTTP keep-alive values

Constants

HTTP_KEEPALIVE_OFF
No keep alive support
HTTP_KEEPALIVE_ON
Use keep alive

http_state_e

HTTP state values; states are server-oriented...

Constants

HTTP_STATE_CONNECT
CONNECT command, waiting for blank line
HTTP_STATE_DELETE
DELETE command, waiting for blank line
HTTP_STATE_ERROR
Error on socket
HTTP_STATE_GET
GET command, waiting for blank line
HTTP_STATE_GET_SEND
GET command, sending data
HTTP_STATE_HEAD
HEAD command, waiting for blank line
HTTP_STATE_OPTIONS
OPTIONS command, waiting for blank line
HTTP_STATE_POST
POST command, waiting for blank line
HTTP_STATE_POST_RECV
POST command, receiving data
HTTP_STATE_POST_SEND
POST command, sending data
HTTP_STATE_PUT
PUT command, waiting for blank line
HTTP_STATE_PUT_RECV
PUT command, receiving data
HTTP_STATE_STATUS
Command complete, sending status
HTTP_STATE_TRACE
TRACE command, waiting for blank line
HTTP_STATE_UNKNOWN_METHOD  CUPS 1.7/macOS 10.9 
Unknown request method, waiting for blank line
HTTP_STATE_UNKNOWN_VERSION  CUPS 1.7/macOS 10.9 
Unknown request method, waiting for blank line
HTTP_STATE_WAITING
Waiting for command

http_status_e

HTTP status codes

Constants

HTTP_STATUS_ACCEPTED
DELETE command was successful
HTTP_STATUS_BAD_GATEWAY
Bad gateway
HTTP_STATUS_BAD_REQUEST
Bad request
HTTP_STATUS_CONFLICT
Request is self-conflicting
HTTP_STATUS_CONTINUE
Everything OK, keep going...
HTTP_STATUS_CREATED
PUT command was successful
HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED  CUPS 1.4 
User canceled authorization
HTTP_STATUS_CUPS_PKI_ERROR  CUPS 1.5/macOS 10.7 
Error negotiating a secure connection
HTTP_STATUS_ERROR
An error response from httpXxxx()
HTTP_STATUS_EXPECTATION_FAILED
The expectation given in an Expect header field was not met
HTTP_STATUS_FORBIDDEN
Forbidden to access this URI
HTTP_STATUS_GATEWAY_TIMEOUT
Gateway connection timed out
HTTP_STATUS_GONE
Server has gone away
HTTP_STATUS_LENGTH_REQUIRED
A content length or encoding is required
HTTP_STATUS_METHOD_NOT_ALLOWED
Method is not allowed
HTTP_STATUS_MOVED_PERMANENTLY
Document has moved permanently
HTTP_STATUS_MOVED_TEMPORARILY
Document has moved temporarily
HTTP_STATUS_MULTIPLE_CHOICES
Multiple files match request
HTTP_STATUS_NONE  CUPS 1.7/macOS 10.9 
No Expect value
HTTP_STATUS_NOT_ACCEPTABLE
Not Acceptable
HTTP_STATUS_NOT_AUTHORITATIVE
Information isn't authoritative
HTTP_STATUS_NOT_FOUND
URI was not found
HTTP_STATUS_NOT_IMPLEMENTED
Feature not implemented
HTTP_STATUS_NOT_MODIFIED
File not modified
HTTP_STATUS_NOT_SUPPORTED
HTTP version not supported
HTTP_STATUS_NO_CONTENT
Successful command, no new data
HTTP_STATUS_OK
OPTIONS/GET/HEAD/POST/TRACE command was successful
HTTP_STATUS_PARTIAL_CONTENT
Only a partial file was received/sent
HTTP_STATUS_PAYMENT_REQUIRED
Payment required
HTTP_STATUS_PRECONDITION
Precondition failed
HTTP_STATUS_PROXY_AUTHENTICATION
Proxy Authentication is Required
HTTP_STATUS_REQUESTED_RANGE
The requested range is not satisfiable
HTTP_STATUS_REQUEST_TIMEOUT
Request timed out
HTTP_STATUS_REQUEST_TOO_LARGE
Request entity too large
HTTP_STATUS_RESET_CONTENT
Content was reset/recreated
HTTP_STATUS_SEE_OTHER
See this other link...
HTTP_STATUS_SERVER_ERROR
Internal server error
HTTP_STATUS_SERVICE_UNAVAILABLE
Service is unavailable
HTTP_STATUS_SWITCHING_PROTOCOLS
HTTP upgrade to TLS/SSL
HTTP_STATUS_UNAUTHORIZED
Unauthorized to access host
HTTP_STATUS_UNSUPPORTED_MEDIATYPE
The requested media type is unsupported
HTTP_STATUS_UPGRADE_REQUIRED
Upgrade to SSL/TLS required
HTTP_STATUS_URI_TOO_LONG
URI too long
HTTP_STATUS_USE_PROXY
Must use a proxy to access this URI

 CUPS 2.0/OS 10.10 http_trust_e

Level of trust for credentials

Constants

HTTP_TRUST_CHANGED
Credentials have changed
HTTP_TRUST_EXPIRED
Credentials are expired
HTTP_TRUST_INVALID
Credentials are invalid
HTTP_TRUST_OK
Credentials are OK/trusted
HTTP_TRUST_RENEWED
Credentials have been renewed
HTTP_TRUST_UNKNOWN
Credentials are unknown/new

http_uri_coding_e

URI en/decode flags

Constants

HTTP_URI_CODING_ALL
En/decode everything
HTTP_URI_CODING_HOSTNAME
En/decode the hostname portion
HTTP_URI_CODING_MOST
En/decode all but the query
HTTP_URI_CODING_NONE
Don't en/decode anything
HTTP_URI_CODING_QUERY
En/decode the query portion
HTTP_URI_CODING_RESOURCE
En/decode the resource portion
HTTP_URI_CODING_RFC6874
Use RFC 6874 address format
HTTP_URI_CODING_USERNAME
En/decode the username portion

 CUPS 1.2 http_uri_status_e

URI separation status

Constants

HTTP_URI_STATUS_BAD_ARGUMENTS
Bad arguments to function (error)
HTTP_URI_STATUS_BAD_HOSTNAME
Bad hostname in URI (error)
HTTP_URI_STATUS_BAD_PORT
Bad port number in URI (error)
HTTP_URI_STATUS_BAD_RESOURCE
Bad resource in URI (error)
HTTP_URI_STATUS_BAD_SCHEME
Bad scheme in URI (error)
HTTP_URI_STATUS_BAD_URI
Bad/empty URI (error)
HTTP_URI_STATUS_BAD_USERNAME
Bad username in URI (error)
HTTP_URI_STATUS_MISSING_RESOURCE
Missing resource in URI (warning)
HTTP_URI_STATUS_MISSING_SCHEME
Missing scheme in URI (warning)
HTTP_URI_STATUS_OK
URI decoded OK
HTTP_URI_STATUS_OVERFLOW
URI buffer for httpAssembleURI is too small
HTTP_URI_STATUS_UNKNOWN_SCHEME
Unknown scheme in URI (warning)

http_version_e

HTTP version numbers

Constants

HTTP_VERSION_0_9
HTTP/0.9
HTTP_VERSION_1_0
HTTP/1.0
HTTP_VERSION_1_1
HTTP/1.1

ipp_dstate_e

Document states

Constants

IPP_DOCUMENT_ABORTED
Document is aborted
IPP_DOCUMENT_CANCELED
Document is canceled
IPP_DOCUMENT_COMPLETED
Document is completed
IPP_DOCUMENT_PENDING
Document is pending
IPP_DOCUMENT_PROCESSING
Document is processing

ipp_finishings_e

Finishings

Constants

IPP_FINISHINGS_BALE
Bale (any type)
IPP_FINISHINGS_BIND
Bind
IPP_FINISHINGS_BIND_BOTTOM
Bind on bottom
IPP_FINISHINGS_BIND_LEFT
Bind on left
IPP_FINISHINGS_BIND_RIGHT
Bind on right
IPP_FINISHINGS_BIND_TOP
Bind on top
IPP_FINISHINGS_BOOKLET_MAKER
Fold to make booklet
IPP_FINISHINGS_COAT
Apply protective liquid or powder coating
IPP_FINISHINGS_COVER
Add cover
IPP_FINISHINGS_CUPS_FOLD_ACCORDIAN
Accordian-fold the paper vertically into four sections
IPP_FINISHINGS_CUPS_FOLD_DOUBLE_GATE
Fold the top and bottom quarters of the paper towards the midline, then fold in half vertically
IPP_FINISHINGS_CUPS_FOLD_GATE
Fold the top and bottom quarters of the paper towards the midline
IPP_FINISHINGS_CUPS_FOLD_HALF
Fold the paper in half vertically
IPP_FINISHINGS_CUPS_FOLD_HALF_Z
Fold the paper in half horizontally, then Z-fold the paper vertically
IPP_FINISHINGS_CUPS_FOLD_LEFT_GATE
Fold the top quarter of the paper towards the midline
IPP_FINISHINGS_CUPS_FOLD_LETTER
Fold the paper into three sections vertically; sometimes also known as a C fold
IPP_FINISHINGS_CUPS_FOLD_PARALLEL
Fold the paper in half vertically two times, yielding four sections
IPP_FINISHINGS_CUPS_FOLD_POSTER
Fold the paper in half horizontally and vertically; sometimes also called a cross fold
IPP_FINISHINGS_CUPS_FOLD_RIGHT_GATE
Fold the bottom quarter of the paper towards the midline
IPP_FINISHINGS_CUPS_FOLD_Z
Fold the paper vertically into three sections, forming a Z
IPP_FINISHINGS_CUPS_PUNCH_BOTTOM_LEFT
Punch 1 hole bottom left
IPP_FINISHINGS_CUPS_PUNCH_BOTTOM_RIGHT
Punch 1 hole bottom right
IPP_FINISHINGS_CUPS_PUNCH_DUAL_BOTTOM
Punch 2 holes bottom edge
IPP_FINISHINGS_CUPS_PUNCH_DUAL_LEFT
Punch 2 holes left side
IPP_FINISHINGS_CUPS_PUNCH_DUAL_RIGHT
Punch 2 holes right side
IPP_FINISHINGS_CUPS_PUNCH_DUAL_TOP
Punch 2 holes top edge
IPP_FINISHINGS_CUPS_PUNCH_QUAD_BOTTOM
Punch 4 holes bottom edge
IPP_FINISHINGS_CUPS_PUNCH_QUAD_LEFT
Punch 4 holes left side
IPP_FINISHINGS_CUPS_PUNCH_QUAD_RIGHT
Punch 4 holes right side
IPP_FINISHINGS_CUPS_PUNCH_QUAD_TOP
Punch 4 holes top edge
IPP_FINISHINGS_CUPS_PUNCH_TOP_LEFT
Punch 1 hole top left
IPP_FINISHINGS_CUPS_PUNCH_TOP_RIGHT
Punch 1 hole top right
IPP_FINISHINGS_CUPS_PUNCH_TRIPLE_BOTTOM
Punch 3 holes bottom edge
IPP_FINISHINGS_CUPS_PUNCH_TRIPLE_LEFT
Punch 3 holes left side
IPP_FINISHINGS_CUPS_PUNCH_TRIPLE_RIGHT
Punch 3 holes right side
IPP_FINISHINGS_CUPS_PUNCH_TRIPLE_TOP
Punch 3 holes top edge
IPP_FINISHINGS_EDGE_STITCH
Stitch along any side
IPP_FINISHINGS_EDGE_STITCH_BOTTOM
Stitch along bottom edge
IPP_FINISHINGS_EDGE_STITCH_LEFT
Stitch along left side
IPP_FINISHINGS_EDGE_STITCH_RIGHT
Stitch along right side
IPP_FINISHINGS_EDGE_STITCH_TOP
Stitch along top edge
IPP_FINISHINGS_FOLD
Fold (any type)
IPP_FINISHINGS_FOLD_ACCORDIAN
Accordian-fold the paper vertically into four sections
IPP_FINISHINGS_FOLD_DOUBLE_GATE
Fold the top and bottom quarters of the paper towards the midline, then fold in half vertically
IPP_FINISHINGS_FOLD_ENGINEERING_Z
Fold the paper vertically into two small sections and one larger, forming an elongated Z
IPP_FINISHINGS_FOLD_GATE
Fold the top and bottom quarters of the paper towards the midline
IPP_FINISHINGS_FOLD_HALF
Fold the paper in half vertically
IPP_FINISHINGS_FOLD_HALF_Z
Fold the paper in half horizontally, then Z-fold the paper vertically
IPP_FINISHINGS_FOLD_LEFT_GATE
Fold the top quarter of the paper towards the midline
IPP_FINISHINGS_FOLD_LETTER
Fold the paper into three sections vertically; sometimes also known as a C fold
IPP_FINISHINGS_FOLD_PARALLEL
Fold the paper in half vertically two times, yielding four sections
IPP_FINISHINGS_FOLD_POSTER
Fold the paper in half horizontally and vertically; sometimes also called a cross fold
IPP_FINISHINGS_FOLD_RIGHT_GATE
Fold the bottom quarter of the paper towards the midline
IPP_FINISHINGS_FOLD_Z
Fold the paper vertically into three sections, forming a Z
IPP_FINISHINGS_JOG_OFFSET
Offset for binding (any type)
IPP_FINISHINGS_LAMINATE
Apply protective (solid) material
IPP_FINISHINGS_NONE
No finishing
IPP_FINISHINGS_PUNCH
Punch (any location/count)
IPP_FINISHINGS_PUNCH_BOTTOM_LEFT
Punch 1 hole bottom left
IPP_FINISHINGS_PUNCH_BOTTOM_RIGHT
Punch 1 hole bottom right
IPP_FINISHINGS_PUNCH_DUAL_BOTTOM
Punch 2 holes bottom edge
IPP_FINISHINGS_PUNCH_DUAL_LEFT
Punch 2 holes left side
IPP_FINISHINGS_PUNCH_DUAL_RIGHT
Punch 2 holes right side
IPP_FINISHINGS_PUNCH_DUAL_TOP
Punch 2 holes top edge
IPP_FINISHINGS_PUNCH_MULTIPLE_BOTTOM
Pucnh multiple holes bottom edge
IPP_FINISHINGS_PUNCH_MULTIPLE_LEFT
Pucnh multiple holes left side
IPP_FINISHINGS_PUNCH_MULTIPLE_RIGHT
Pucnh multiple holes right side
IPP_FINISHINGS_PUNCH_MULTIPLE_TOP
Pucnh multiple holes top edge
IPP_FINISHINGS_PUNCH_QUAD_BOTTOM
Punch 4 holes bottom edge
IPP_FINISHINGS_PUNCH_QUAD_LEFT
Punch 4 holes left side
IPP_FINISHINGS_PUNCH_QUAD_RIGHT
Punch 4 holes right side
IPP_FINISHINGS_PUNCH_QUAD_TOP
Punch 4 holes top edge
IPP_FINISHINGS_PUNCH_TOP_LEFT
Punch 1 hole top left
IPP_FINISHINGS_PUNCH_TOP_RIGHT
Punch 1 hole top right
IPP_FINISHINGS_PUNCH_TRIPLE_BOTTOM
Punch 3 holes bottom edge
IPP_FINISHINGS_PUNCH_TRIPLE_LEFT
Punch 3 holes left side
IPP_FINISHINGS_PUNCH_TRIPLE_RIGHT
Punch 3 holes right side
IPP_FINISHINGS_PUNCH_TRIPLE_TOP
Punch 3 holes top edge
IPP_FINISHINGS_SADDLE_STITCH
Staple interior
IPP_FINISHINGS_STAPLE
Staple (any location)
IPP_FINISHINGS_STAPLE_BOTTOM_LEFT
Staple bottom left corner
IPP_FINISHINGS_STAPLE_BOTTOM_RIGHT
Staple bottom right corner
IPP_FINISHINGS_STAPLE_DUAL_BOTTOM
Two staples on bottom
IPP_FINISHINGS_STAPLE_DUAL_LEFT
Two staples on left
IPP_FINISHINGS_STAPLE_DUAL_RIGHT
Two staples on right
IPP_FINISHINGS_STAPLE_DUAL_TOP
Two staples on top
IPP_FINISHINGS_STAPLE_TOP_LEFT
Staple top left corner
IPP_FINISHINGS_STAPLE_TOP_RIGHT
Staple top right corner
IPP_FINISHINGS_STAPLE_TRIPLE_BOTTOM
Three staples on bottom
IPP_FINISHINGS_STAPLE_TRIPLE_LEFT
Three staples on left
IPP_FINISHINGS_STAPLE_TRIPLE_RIGHT
Three staples on right
IPP_FINISHINGS_STAPLE_TRIPLE_TOP
Three staples on top
IPP_FINISHINGS_TRIM
Trim (any type)
IPP_FINISHINGS_TRIM_AFTER_COPIES
Trim output after each copy
IPP_FINISHINGS_TRIM_AFTER_DOCUMENTS
Trim output after each document
IPP_FINISHINGS_TRIM_AFTER_JOB
Trim output after job
IPP_FINISHINGS_TRIM_AFTER_PAGES
Trim output after each page

ipp_jcollate_e

Job collation types

Constants

IPP_JCOLLATE_COLLATED_DOCUMENTS
IPP_JCOLLATE_UNCOLLATED_DOCUMENTS
IPP_JCOLLATE_UNCOLLATED_SHEETS

ipp_jstate_e

Job states

Constants

IPP_JSTATE_ABORTED
Job has aborted due to error
IPP_JSTATE_CANCELED
Job has been canceled
IPP_JSTATE_COMPLETED
Job has completed successfully
IPP_JSTATE_HELD
Job is held for printing
IPP_JSTATE_PENDING
Job is waiting to be printed
IPP_JSTATE_PROCESSING
Job is currently printing
IPP_JSTATE_STOPPED
Job has been stopped

ipp_op_e

IPP operations

Constants

IPP_OP_ACKNOWLEDGE_DOCUMENT
Acknowledge-Document
IPP_OP_ACKNOWLEDGE_IDENTIFY_PRINTER
Acknowledge-Identify-Printer
IPP_OP_ACKNOWLEDGE_JOB
Acknowledge-Job
IPP_OP_ACTIVATE_PRINTER
Start a printer
IPP_OP_ADD_DOCUMENT_IMAGES
Add-Document-Images
IPP_OP_CANCEL_CURRENT_JOB
Cancel the current job
IPP_OP_CANCEL_DOCUMENT
Cancel-Document
IPP_OP_CANCEL_JOB
Cancel a job
IPP_OP_CANCEL_JOBS
Cancel-Jobs
IPP_OP_CANCEL_MY_JOBS
Cancel-My-Jobs
IPP_OP_CANCEL_SUBSCRIPTION  CUPS 1.2/macOS 10.5 
Cancel a subscription
IPP_OP_CLOSE_JOB
Close-Job
IPP_OP_CREATE_JOB
Create an empty print job
IPP_OP_CREATE_JOB_SUBSCRIPTIONS  CUPS 1.2/macOS 10.5 
Create one of more job subscriptions
IPP_OP_CREATE_PRINTER_SUBSCRIPTIONS  CUPS 1.2/macOS 10.5 
Create one or more printer subscriptions
IPP_OP_CUPS_ACCEPT_JOBS
Accept new jobs on a printer
IPP_OP_CUPS_ADD_MODIFY_CLASS
Add or modify a class
IPP_OP_CUPS_ADD_MODIFY_PRINTER
Add or modify a printer
IPP_OP_CUPS_AUTHENTICATE_JOB  CUPS 1.2/macOS 10.5 
Authenticate a job
IPP_OP_CUPS_CREATE_LOCAL_PRINTER  CUPS 2.2 
Create a local (temporary) printer
IPP_OP_CUPS_DELETE_CLASS
Delete a class
IPP_OP_CUPS_DELETE_PRINTER
Delete a printer
IPP_OP_CUPS_GET_CLASSES  DEPRECATED 
Get a list of classes
IPP_OP_CUPS_GET_DEFAULT
Get the default printer
IPP_OP_CUPS_GET_DEVICES  DEPRECATED 
Get a list of supported devices
IPP_OP_CUPS_GET_DOCUMENT  CUPS 1.4/macOS 10.6 
Get a document file
IPP_OP_CUPS_GET_PPD  DEPRECATED 
Get a PPD file
IPP_OP_CUPS_GET_PPDS  DEPRECATED 
Get a list of supported drivers
IPP_OP_CUPS_GET_PRINTERS
Get a list of printers and/or classes
IPP_OP_CUPS_INVALID
Invalid operation name for ippOpValue
IPP_OP_CUPS_MOVE_JOB
Move a job to a different printer
IPP_OP_CUPS_REJECT_JOBS
Reject new jobs on a printer
IPP_OP_CUPS_SET_DEFAULT
Set the default printer
IPP_OP_DEACTIVATE_PRINTER
Stop a printer
IPP_OP_DELETE_DOCUMENT
Delete-Document
IPP_OP_DEREGISTER_OUTPUT_DEVICE
Deregister-Output-Device
IPP_OP_DISABLE_PRINTER
Stop a printer
IPP_OP_ENABLE_PRINTER
Start a printer
IPP_OP_FETCH_DOCUMENT
Fetch-Document
IPP_OP_FETCH_JOB
Fetch-Job
IPP_OP_GET_DOCUMENTS
Get-Documents
IPP_OP_GET_DOCUMENT_ATTRIBUTES
Get-Document-Attributes
IPP_OP_GET_JOBS
Get a list of jobs
IPP_OP_GET_JOB_ATTRIBUTES
Get job attributes
IPP_OP_GET_NEXT_DOCUMENT_DATA
Get-Next-Document-Data
IPP_OP_GET_NOTIFICATIONS  CUPS 1.2/macOS 10.5 
Get notification events
IPP_OP_GET_OUTPUT_DEVICE_ATTRIBUTES
Get-Output-Device-Attributes
IPP_OP_GET_PRINTER_ATTRIBUTES
Get printer attributes
IPP_OP_GET_PRINTER_SUPPORTED_VALUES
Get supported attribute values
IPP_OP_GET_SUBSCRIPTIONS  CUPS 1.2/macOS 10.5 
Get list of subscriptions
IPP_OP_GET_SUBSCRIPTION_ATTRIBUTES  CUPS 1.2/macOS 10.5 
Get subscription attributes
IPP_OP_HOLD_JOB
Hold a job for printing
IPP_OP_HOLD_NEW_JOBS
Hold new jobs
IPP_OP_IDENTIFY_PRINTER
Identify-Printer
IPP_OP_PAUSE_PRINTER
Stop a printer
IPP_OP_PAUSE_PRINTER_AFTER_CURRENT_JOB
Stop printer after the current job
IPP_OP_PRINT_JOB
Print a single file
IPP_OP_PRINT_URI
Print a single URL
IPP_OP_PROMOTE_JOB
Promote a job to print sooner
IPP_OP_PURGE_JOBS
Cancel all jobs
IPP_OP_RELEASE_HELD_NEW_JOBS
Release new jobs
IPP_OP_RELEASE_JOB
Release a job for printing
IPP_OP_RENEW_SUBSCRIPTION  CUPS 1.2/macOS 10.5 
Renew a printer subscription
IPP_OP_REPROCESS_JOB
Reprint a job
IPP_OP_RESTART_JOB
Reprint a job
IPP_OP_RESTART_PRINTER
Restart a printer
IPP_OP_RESUBMIT_JOB
Resubmit-Job
IPP_OP_RESUME_JOB
Resume the current job
IPP_OP_RESUME_PRINTER
Start a printer
IPP_OP_SCHEDULE_JOB_AFTER
Schedule a job to print after another
IPP_OP_SEND_DOCUMENT
Add a file to a job
IPP_OP_SEND_URI
Add a URL to a job
IPP_OP_SET_DOCUMENT_ATTRIBUTES
Set-Document-Attributes
IPP_OP_SET_JOB_ATTRIBUTES
Set job attributes
IPP_OP_SET_PRINTER_ATTRIBUTES
Set printer attributes
IPP_OP_SHUTDOWN_PRINTER
Turn a printer off
IPP_OP_STARTUP_PRINTER
Turn a printer on
IPP_OP_SUSPEND_CURRENT_JOB
Suspend the current job
IPP_OP_UPDATE_ACTIVE_JOBS
Update-Active-Jobs
IPP_OP_UPDATE_DOCUMENT_STATUS
Update-Document-Status
IPP_OP_UPDATE_JOB_STATUS
Update-Job-Status
IPP_OP_UPDATE_OUTPUT_DEVICE_ATTRIBUTES
Update-Output-Device-Attributes
IPP_OP_VALIDATE_DOCUMENT
Validate-Document
IPP_OP_VALIDATE_JOB
Validate job options

ipp_orient_e

Orientation values

Constants

IPP_ORIENT_LANDSCAPE
90 degrees counter-clockwise
IPP_ORIENT_NONE
No rotation
IPP_ORIENT_PORTRAIT
No rotation
IPP_ORIENT_REVERSE_LANDSCAPE
90 degrees clockwise
IPP_ORIENT_REVERSE_PORTRAIT
180 degrees

ipp_pstate_e

Printer states

Constants

IPP_PSTATE_IDLE
Printer is idle
IPP_PSTATE_PROCESSING
Printer is working
IPP_PSTATE_STOPPED
Printer is stopped

ipp_quality_e

Qualities

Constants

IPP_QUALITY_DRAFT
Draft quality
IPP_QUALITY_HIGH
High quality
IPP_QUALITY_NORMAL
Normal quality

ipp_res_e

Resolution units

Constants

IPP_RES_PER_CM
Pixels per centimeter
IPP_RES_PER_INCH
Pixels per inch

ipp_state_e

IPP states

Constants

IPP_STATE_ATTRIBUTE
One or more attributes need to be sent/received
IPP_STATE_DATA
IPP request data needs to be sent/received
IPP_STATE_ERROR
An error occurred
IPP_STATE_HEADER
The request header needs to be sent/received
IPP_STATE_IDLE
Nothing is happening/request completed

ipp_status_e

IPP status codes

Constants

IPP_STATUS_CUPS_INVALID
Invalid status name for ippErrorValue
IPP_STATUS_CUPS_SEE_OTHER
cups-see-other
IPP_STATUS_ERROR_ACCOUNT_AUTHORIZATION_FAILED
client-error-account-authorization-failed
IPP_STATUS_ERROR_ACCOUNT_CLOSED
client-error-account-closed
IPP_STATUS_ERROR_ACCOUNT_INFO_NEEDED
client-error-account-info-needed
IPP_STATUS_ERROR_ACCOUNT_LIMIT_REACHED
client-error-account-limit-reached
IPP_STATUS_ERROR_ATTRIBUTES_NOT_SETTABLE
client-error-attributes-not-settable
IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES
client-error-attributes-or-values-not-supported
IPP_STATUS_ERROR_BAD_REQUEST
client-error-bad-request
IPP_STATUS_ERROR_BUSY
server-error-busy
IPP_STATUS_ERROR_CHARSET
client-error-charset-not-supported
IPP_STATUS_ERROR_COMPRESSION_ERROR
client-error-compression-error
IPP_STATUS_ERROR_COMPRESSION_NOT_SUPPORTED
client-error-compression-not-supported
IPP_STATUS_ERROR_CONFLICTING
client-error-conflicting-attributes
IPP_STATUS_ERROR_CUPS_ACCOUNT_AUTHORIZATION_FAILED  DEPRECATED 
cups-error-account-authorization-failed
IPP_STATUS_ERROR_CUPS_ACCOUNT_CLOSED
cups-error-account-closed @deprecate@
IPP_STATUS_ERROR_CUPS_ACCOUNT_INFO_NEEDED  DEPRECATED 
cups-error-account-info-needed
IPP_STATUS_ERROR_CUPS_ACCOUNT_LIMIT_REACHED  DEPRECATED 
cups-error-account-limit-reached
IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED  CUPS 1.5/macOS 10.7 
cups-authentication-canceled - Authentication canceled by user
IPP_STATUS_ERROR_CUPS_PKI  CUPS 1.5/macOS 10.7 
cups-pki-error - Error negotiating a secure connection
IPP_STATUS_ERROR_CUPS_UPGRADE_REQUIRED
cups-upgrade-required - TLS upgrade required
IPP_STATUS_ERROR_DEVICE
server-error-device-error
IPP_STATUS_ERROR_DOCUMENT_ACCESS
client-error-document-access-error
IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR
client-error-document-format-error
IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED
client-error-document-format-not-supported
IPP_STATUS_ERROR_DOCUMENT_PASSWORD
client-error-document-password-error
IPP_STATUS_ERROR_DOCUMENT_PERMISSION
client-error-document-permission-error
IPP_STATUS_ERROR_DOCUMENT_SECURITY
client-error-document-security-error
IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE
client-error-document-unprintable-error
IPP_STATUS_ERROR_FORBIDDEN
client-error-forbidden
IPP_STATUS_ERROR_GONE
client-error-gone
IPP_STATUS_ERROR_IGNORED_ALL_SUBSCRIPTIONS
client-error-ignored-all-subscriptions
IPP_STATUS_ERROR_INTERNAL
server-error-internal-error
IPP_STATUS_ERROR_JOB_CANCELED
server-error-job-canceled
IPP_STATUS_ERROR_MULTIPLE_JOBS_NOT_SUPPORTED
server-error-multiple-document-jobs-not-supported
IPP_STATUS_ERROR_NOT_ACCEPTING_JOBS
server-error-not-accepting-jobs
IPP_STATUS_ERROR_NOT_AUTHENTICATED
client-error-not-authenticated
IPP_STATUS_ERROR_NOT_AUTHORIZED
client-error-not-authorized
IPP_STATUS_ERROR_NOT_FETCHABLE
client-error-not-fetchable
IPP_STATUS_ERROR_NOT_FOUND
client-error-not-found
IPP_STATUS_ERROR_NOT_POSSIBLE
client-error-not-possible
IPP_STATUS_ERROR_OPERATION_NOT_SUPPORTED
server-error-operation-not-supported
IPP_STATUS_ERROR_PRINTER_IS_DEACTIVATED
server-error-printer-is-deactivated
IPP_STATUS_ERROR_REQUEST_ENTITY
client-error-request-entity-too-large
IPP_STATUS_ERROR_REQUEST_VALUE
client-error-request-value-too-long
IPP_STATUS_ERROR_SERVICE_UNAVAILABLE
server-error-service-unavailable
IPP_STATUS_ERROR_TEMPORARY
server-error-temporary-error
IPP_STATUS_ERROR_TIMEOUT
client-error-timeout
IPP_STATUS_ERROR_TOO_MANY_DOCUMENTS
server-error-too-many-documents
IPP_STATUS_ERROR_TOO_MANY_JOBS
server-error-too-many-jobs
IPP_STATUS_ERROR_TOO_MANY_SUBSCRIPTIONS
client-error-too-many-subscriptions
IPP_STATUS_ERROR_URI_SCHEME
client-error-uri-scheme-not-supported
IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED
server-error-version-not-supported
IPP_STATUS_OK
successful-ok
IPP_STATUS_OK_CONFLICTING
successful-ok-conflicting-attributes
IPP_STATUS_OK_EVENTS_COMPLETE
successful-ok-events-complete
IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED
successful-ok-ignored-or-substituted-attributes
IPP_STATUS_OK_IGNORED_SUBSCRIPTIONS
successful-ok-ignored-subscriptions
IPP_STATUS_OK_TOO_MANY_EVENTS
successful-ok-too-many-events

ipp_tag_e

Format tags for attributes

Constants

IPP_TAG_ADMINDEFINE
Admin-defined value
IPP_TAG_BEGIN_COLLECTION
Beginning of collection value
IPP_TAG_BOOLEAN
Boolean value
IPP_TAG_CHARSET
Character set value
IPP_TAG_CUPS_INVALID
Invalid tag name for ippTagValue
IPP_TAG_DATE
Date/time value
IPP_TAG_DEFAULT
Default value
IPP_TAG_DELETEATTR
Delete-attribute value
IPP_TAG_DOCUMENT
Document group
IPP_TAG_END
End-of-attributes
IPP_TAG_END_COLLECTION
End of collection value
IPP_TAG_ENUM
Enumeration value
IPP_TAG_EVENT_NOTIFICATION
Event group
IPP_TAG_EXTENSION
Extension point for 32-bit tags
IPP_TAG_INTEGER
Integer value
IPP_TAG_JOB
Job group
IPP_TAG_KEYWORD
Keyword value
IPP_TAG_LANGUAGE
Language value
IPP_TAG_MEMBERNAME
Collection member name value
IPP_TAG_MIMETYPE
MIME media type value
IPP_TAG_NAME
Name value
IPP_TAG_NAMELANG
Name-with-language value
IPP_TAG_NOTSETTABLE
Not-settable value
IPP_TAG_NOVALUE
No-value value
IPP_TAG_OPERATION
Operation group
IPP_TAG_PRINTER
Printer group
IPP_TAG_RANGE
Range value
IPP_TAG_RESOLUTION
Resolution value
IPP_TAG_STRING
Octet string value
IPP_TAG_SUBSCRIPTION
Subscription group
IPP_TAG_TEXT
Text value
IPP_TAG_TEXTLANG
Text-with-language value
IPP_TAG_UNKNOWN
Unknown value
IPP_TAG_UNSUPPORTED_GROUP
Unsupported attributes group
IPP_TAG_UNSUPPORTED_VALUE
Unsupported value
IPP_TAG_URI
URI value
IPP_TAG_URISCHEME
URI scheme value
IPP_TAG_ZERO
Zero tag - used for separators