# HTTP and IPP APIs

Header | cups/cups.h
--- | ---
Library | -lcups
See Also | Programming: Introduction to CUPS Programming Programming: CUPS API References: CUPS Implementation of IPP

## Contents

- Overview
  - Creating URI Strings
  - Sending Requests with Files
  - Asynchronous Request Processing
- Functions
  - cupsDoAuthentication
  - cupsDoFileRequest
  - cupsDoIORequest
  - cupsDoRequest
  - cupsEncodeOptions
  - cupsEncodeOptions2
  - cupsGetDevices
  - cupsGetFd
  - cupsGetFile
  - cupsGetResponse
  - cupsLastError
  - cupsLastErrorString
  - cupsPutFd
  - cupsPutFile
  - cupsReadResponseData
  - cupsSendRequest
  - cupsWriteRequestData
  - httpAddCredential
  - httpAddrAny
  - httpAddrEqual
  - httpAddrLength
  - httpAddrLocalhost
  - httpAddrLookup
  - httpAddrString
  - httpAssembleURI
  - httpAssembleURIf
  - httpBlocking
  - httpCheck
  - httpClearCookie
  - httpClearFields
  - httpClose
  - httpConnect
  - httpConnectEncrypt
  - httpCopyCredentials
  - httpDecode64
  - httpDecode64_2
  - httpDelete
  - httpEncode64
  - httpEncode64_2
  - httpEncryption
  - httpError
  - httpFlush
  - httpFlushWrite
  - httpFreeCredentials
  - httpGet
  - httpGetAuthString
  - httpGetBlocking
  - httpGetCookie
  - httpGetDateString
  - httpGetDateString2
  - httpGetDateTime
  - httpGetFd
  - httpGetField
  - httpGetHostByName
  - httpGetHostname
  - httpGetLength
  - httpGetLength2
  - httpGetState
  - httpGetStatus
  - httpGetSubField
  - httpGetSubField2
  - httpGetVersion
  - httpGets
  - httpHead
  - httpInitialize
  - httpMD5
  - httpMD5Final
  - httpMD5String
  - httpOptions
  - httpPost
  - httpPut
  - httpRead
  - httpRead2
  - httpReconnect
  - httpReconnect2
  - httpSeparate
  - httpSeparate2
  - httpSeparateURI
  - httpSetAuthString
  - httpSetCookie
  - httpSetCredentials
  - httpSetExpect
  - httpSetField
  - httpSetLength
  - httpSetTimeout
  - httpStatus
  - httpTrace
  - httpUpdate
  - httpWait
  - httpWrite
  - httpWrite2
  - ippAddBoolean
  - ippAddBooleans
  - ippAddCollection
  - ippAddCollections
  - ippAddDate
  - ippAddInteger
  - ippAddIntegers
  - ippAddOctetString
  - ippAddOutOfBand
  - ippAddRange
  - ippAddRanges
  - ippAddResolution
  - ippAddResolutions
  - ippAddSeparator
  - ippAddString
  - ippAddStrings
  - ippAttributeString
  - ippCopyAttribute
  - ippCopyAttributes
  - ippDateToTime
  - ippDelete
  - ippDeleteAttribute
  - ippDeleteValues
  - ippEnumString
  - ippEnumValue
  - ippErrorString
  - ippErrorValue
  - ippFindAttribute
  - ippFindNextAttribute
  - ippFirstAttribute
  - ippGetBoolean
  - ippGetCollection
  - ippGetCount
  - ippGetDate
  - ippGetGroupTag
  - ippGetInteger
  - ippGetName
  - ippGetOperation
  - ippGetRange
  - ippGetRequestId
  - ippGetResolution
  - ippGetState
  - ippGetStatusCode
  - ippGetString
  - ippGetValueTag
  - ippGetVersion
  - ippLength
  - ippNew
  - ippNewRequest
  - ippNextAttribute
  - ippOpString
  - ippOpValue
  - ippPort
  - ippRead
  - ippReadFile
  - ippReadIO
  - ippSetBoolean
  - ippSetCollection
  - ippSetDate
  - ippSetGroupTag
  - ippSetInteger
  - ippSetName
  - ippSetOperation
  - ippSetPort
  - ippSetRange
  - ippSetRequestId
  - ippSetResolution
  - ippSetState
  - ippSetStatusCode
  - ippSetString
  - ippSetValueTag
  - ippSetVersion
  - ippTagString
  - ippTagValue
  - ippTimeToDate
  - ippWrite
  - ippWriteFile
  - ippWriteIO
- Data Types
  - gss_auth_identity_desc
  - http_addr_t
  - http_addrlist_t
  - http_auth_t
  - http_credential_t
  - http_encoding_t
  - http_encryption_t
  - http_field_t
  - http_keepalive_t
  - http_state_t
  - http_status_t
  - http_t
  - http_timeout_cb_t
  - http_uri_coding_t
  - http_uri_status_t
  - http_version_t
  - ipp_attribute_t
  - ipp_copycb_t
  - ipp_dstate_t
  - ipp_finish_t
  - ipp_iocb_t
  - ipp_jcollate_t
  - ipp_orient_t
  - ipp_pstate_t
  - ipp_quality_t
  - ipp_res_t
  - ipp_state_t
  - ipp_t
  - ipp_uchar_t
- Structures
  - gss_auth_identity
  - http_addrlist_s
  - http_credential_s
  - pollfd
- Constants
  - http_auth_e
  - http_encoding_e
  - http_encryption_e
  - http_field_e
  - http_keepalive_e
  - http_state_e
  - http_status_e
  - http_uri_coding_e
  - http_uri_status_e
  - http_version_e
  - ipp_dstate_e
  - ipp_finish_e
  - ipp_jcollate_e
  - ipp_jstate_e
  - ipp_op_e
  - ipp_orient_e
  - ipp_pstate_e
  - ipp_quality_e
  - ipp_res_e
  - ipp_state_e
  - ipp_status_e
  - ipp_tag_e

## Overview

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);

## Functions

### CUPS 1.1.20/OS X 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_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/OS X 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/OS X 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.

### CUPS 1.4/OS X 10.6 cupsGetDevices

Get available printer devices.

ipp_status_t cupsGetDevices (
http_t *http,
int timeout,
const char *include_schemes,
const char *exclude_schemes,
cups_device_cb_t callback,
void *user_data
);

#### Parameters

http
  Connection to server or `CUPS_HTTP_DEFAULT`
timeout
  Timeout in seconds or `CUPS_TIMEOUT_DEFAULT`
include_schemes
  Comma-separated URI schemes to include or `CUPS_INCLUDE_ALL`
exclude_schemes
  Comma-separated URI schemes to exclude or `CUPS_EXCLUDE_NONE`
callback
  Callback function
user_data
  User data pointer

#### Return Value

Request status - `IPP_OK` on success.

#### Discussion

This function sends a CUPS-Get-Devices request and streams the discovered devices to the specified callback function. The "timeout" parameter controls how long the request lasts, while the "include_schemes" and "exclude_schemes" parameters provide comma-delimited lists of backends to include or omit from the request respectively.

### CUPS 1.1.20/OS X 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_OK` when the file is successfully retrieved.

### CUPS 1.1.20/OS X 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_OK` when the file is successfully retrieved.

### CUPS 1.4/OS X 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.

### 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/OS X 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 1.1.20/OS X 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_CREATED` when the file is stored successfully.

### CUPS 1.1.20/OS X 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.

### CUPS 1.4/OS X 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.4/OS X 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_CONTINUE` on a successful send of the request.
Note: Unlike `cupsDoFileRequest`, `cupsDoIORequest`, and `cupsDoRequest`, the request is NOT freed with `ippDelete`.

### CUPS 1.4/OS X 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_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.

### CUPS 1.5/OS X 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/OS X 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 1.2/OS X 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

### CUPS 1.2/OS X 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.2/OS X 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/OS X 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.2/OS X 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/OS X 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/OS X 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.

### httpBlocking

Set blocking/non-blocking behavior on a connection.

void httpBlocking (
http_t *http,
int b
);

#### Parameters

http
  Connection to server
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
  Connection to server

#### Return Value

0 = no data, 1 = data available

### CUPS 1.1.19/OS X 10.3 httpClearCookie

Clear the cookie value(s).

void httpClearCookie (
http_t *http
);

#### Parameters

http
  Connection to server

### httpClearFields

Clear HTTP request fields.

void httpClearFields (
http_t *http
);

#### Parameters

http
  Connection to server

### httpClose

Close an HTTP connection.

void httpClose (
http_t *http
);

#### Parameters

http
  Connection to server

### 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 `httpConnectEncrypt` instead.

### 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

### CUPS 1.5/OS X 10.7 httpCopyCredentials

Copy the credentials associated with an encrypted connection.

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

#### Parameters

http
  Connection to server
credentials
  Array of credentials

#### Return Value

Status of call (0 = success)

### 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/OS X 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
  Connection to server
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/OS X 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
  Connection to server
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
  Connection to server

#### Return Value

Error code (errno) value

### httpFlush

Flush data from a HTTP connection.

void httpFlush (
http_t *http
);

#### Parameters

http
  Connection to server

### CUPS 1.2/OS X 10.5 httpFlushWrite

Flush data in write buffer.

int httpFlushWrite (
http_t *http
);

#### Parameters

http
  Connection to server

#### 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
  Connection to server
uri
  URI to get

#### Return Value

Status of call (0 = success)

### CUPS 1.3/OS X 10.5 httpGetAuthString

Get the current authorization string.

char *httpGetAuthString (
http_t *http
);

#### Parameters

http
  Connection to server

#### 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/OS X 10.5 httpGetBlocking

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

int httpGetBlocking (
http_t *http
);

#### Parameters

http
  Connection to server

#### Return Value

1 if blocking, 0 if non-blocking

### CUPS 1.1.19/OS X 10.3 httpGetCookie

Get any cookie data from the response.

const char *httpGetCookie (
http_t *http
);

#### Parameters

http
  HTTP connecion

#### 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/OS X 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 1.2/OS X 10.5 httpGetFd

Get the file descriptor associated with a connection.

int httpGetFd (
http_t *http
);

#### Parameters

http
  Connection to server

#### 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
  Connection to server
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/OS X 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(). Otherwise, return the FQDN for the local system using both gethostname() and gethostbyname() to get the local hostname with domain.

### DEPRECATED httpGetLength

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

int httpGetLength (
http_t *http
);

#### Parameters

http
  Connection to server

#### 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/OS X 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
  Connection to server

#### Return Value

Content length

#### Discussion

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

### httpGetState

Get the current state of the HTTP request.

http_state_t httpGetState (
http_t *http
);

#### Parameters

http
  Connection to server

#### Return Value

HTTP state

### CUPS 1.2/OS X 10.5 httpGetStatus

Get the status of the last HTTP request.

http_status_t httpGetStatus (
http_t *http
);

#### Parameters

http
  Connection to server

#### 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
  Connection to server
field
  Field index
name
  Name of sub-field
value
  Value string

#### Return Value

Value or NULL

### CUPS 1.2/OS X 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
  Connection to server
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
  Connection to server

#### 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
  Connection to server

#### Return Value

Line or NULL

### httpHead

Send a HEAD request to the server.

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

#### Parameters

http
  Connection to server
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);

### 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
  Connection to server
uri
  URI for options

#### Return Value

Status of call (0 = success)

### httpPost

Send a POST request to the server.

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

#### Parameters

http
  Connection to server
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
  Connection to server
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
  Connection to server
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/OS X 10.5 httpRead2

Read data from a HTTP connection.

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

#### Parameters

http
  Connection to server
buffer
  Buffer for data
length
  Maximum number of bytes

#### Return Value

Number of bytes read

### httpReconnect

Reconnect to a HTTP server.

int httpReconnect (
http_t *http
);

#### Parameters

http
  Connection to server

#### Return Value

0 on success, non-zero on failure

### httpReconnect2

Reconnect to a HTTP server with timeout and optional cancel.

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

#### Parameters

http
  Connection to server
msec
  Timeout in milliseconds
cancel
  Pointer to "cancel" variable

#### Return Value

0 on success, non-zero on failure

### 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/OS X 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/OS X 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/OS X 10.5 httpSetAuthString

Set the current authorization string.

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

#### Parameters

http
  Connection to server
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/OS X 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/OS X 10.7 httpSetCredentials

Set the credentials associated with an encrypted connection.

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

#### Parameters

http
  Connection to server
credentials
  Array of credentials

#### Return Value

Status of call (0 = success)

### CUPS 1.2/OS X 10.5 httpSetExpect

Set the Expect: header in a request.

void httpSetExpect (
http_t *http,
http_status_t expect
);

#### Parameters

http
  Connection to server
expect
  HTTP status to expect (HTTP_CONTINUE)

#### Discussion

Currently only HTTP_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
  Connection to server
field
  Field index
value
  Value

### CUPS 1.2/OS X 10.5 httpSetLength

Set the content-length and content-encoding.

void httpSetLength (
http_t *http,
size_t length
);

#### Parameters

http
  Connection to server
length
  Length (0 for chunked)

### CUPS 1.5/OS X 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
  Connection to server
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.

### 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
  Connection to server
uri
  URI for trace

#### Return Value

Status of call (0 = success)

### httpUpdate

Update the current HTTP state for incoming data.

http_status_t httpUpdate (
http_t *http
);

#### Parameters

http
  Connection to server

#### Return Value

HTTP status

### CUPS 1.1.19/OS X 10.3 httpWait

Wait for data available on a connection.

int httpWait (
http_t *http,
int msec
);

#### Parameters

http
  Connection to server
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
  Connection to server
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/OS X 10.5 httpWrite2

Write data to a HTTP connection.

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

#### Parameters

http
  Connection to server
buffer
  Buffer for data
length
  Number of bytes to write

#### Return Value

Number of bytes written

### 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` or `ippNewRequest` 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` or `ippNewRequest` 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/OS X 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` or `ippNewRequest` 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/OS X 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` or `ippNewRequest` 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` or `ippNewRequest` 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` or `ippNewRequest` 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` or `ippNewRequest` 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/OS X 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` or `ippNewRequest` 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/OS X 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` or `ippNewRequest` 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` or `ippNewRequest` 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` or `ippNewRequest` 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` or `ippNewRequest` 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` or `ippNewRequest` 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` or `ippNewRequest` 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` or `ippNewRequest` 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.

### 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` or `ippNewRequest` 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/OS X 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.6/OS X 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/OS X 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, @code@ 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.

### 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/OS X 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/OS X 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/OS X 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

### 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

### CUPS 1.6/OS X 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/OS X 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 -1 on error

#### Discussion

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

### CUPS 1.6/OS X 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/OS X 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 -1 on error

### CUPS 1.6/OS X 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/OS X 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/OS X 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 -1 on error

#### Discussion

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

### CUPS 1.6/OS X 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.6/OS X 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 -1 on error

### CUPS 1.6/OS X 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 -1

#### Discussion

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

### CUPS 1.6/OS X 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 -1 on error

### CUPS 1.6/OS X 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 -1

#### Discussion

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

### CUPS 1.6/OS X 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/OS X 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/OS X 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/OS X 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 -1 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/OS X 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.6/OS X 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/OS X 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/OS X 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/OS X 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/OS X 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/OS X 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 the IPP message containing the attribute that was previously created using the `ippNew` or `ippNewRequest` 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/OS X 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 the IPP message containing the attribute that was previously created using the `ippNew` or `ippNewRequest` 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/OS X 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 the IPP message containing the attribute that was previously created using the `ippNew` or `ippNewRequest` 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/OS X 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 the IPP message containing the attribute that was previously created using the `ippNew` or `ippNewRequest` 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/OS X 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 the IPP message containing the attribute that was previously created using the `ippNew` or `ippNewRequest` 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/OS X 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 the IPP message containing the attribute that was previously created using the `ippNew` or `ippNewRequest` functions.
The `attr` parameter may be modified as a result of setting the value.

### CUPS 1.6/OS X 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` or `ippNewRequest` functions.

### ippSetPort

Set the default port number.

void ippSetPort (
int p
);

#### Parameters

p
  Port number to use

### CUPS 1.6/OS X 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 the IPP message containing the attribute that was previously created using the `ippNew` or `ippNewRequest` 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/OS X 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` or `ippNewRequest` functions.
The `request_id` parameter must be greater than 0.

### CUPS 1.6/OS X 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 the IPP message containing the attribute that was previously created using the `ippNew` or `ippNewRequest` 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/OS X 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/OS X 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` or `ippNewRequest` functions.

### CUPS 1.6/OS X 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 the IPP message containing the attribute that was previously created using the `ippNew` or `ippNewRequest` 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/OS X 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 the IPP message containing the attribute that was previously created using the `ippNew` or `ippNewRequest` 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/OS X 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` or `ippNewRequest` functions.
The valid version numbers are currently 1.0, 1.1, 2.0, 2.1, and 2.2.

### CUPS 1.4/OS X 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/OS X 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

### 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/OS X 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/OS X 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

## Data Types

### gss_auth_identity_desc

Local functions...

typedef struct gss_auth_identity gss_auth_identity_desc;

### CUPS 1.2/OS X 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/OS X 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/OS X 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_status_t

HTTP status codes

typedef enum http_status_e http_status_t;

### http_t

HTTP connection type

typedef struct _http_s http_t;

### CUPS 1.5/OS X 10.7 http_timeout_cb_t

HTTP timeout callback

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

### 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/OS X 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

Finishings

typedef enum ipp_finish_e ipp_finish_t;

### CUPS 1.2/OS X 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;

## Structures

### 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/OS X 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/OS X 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

## Constants

### 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/OS X 10.5
  GSSAPI authentication in use
HTTP_AUTH_NONE
  No authentication in use

### http_encoding_e

HTTP transfer encoding values

#### Constants

HTTP_ENCODE_CHUNKED
  Data is chunked
HTTP_ENCODE_FIELDS
  Sending HTTP fields
HTTP_ENCODE_LENGTH
  Data is sent with Content-Length

### http_encryption_e

HTTP encryption values

#### Constants

HTTP_ENCRYPT_ALWAYS
  Always encrypt (SSL)
HTTP_ENCRYPT_IF_REQUESTED
  Encrypt if requested (TLS upgrade)
HTTP_ENCRYPT_NEVER
  Never encrypt
HTTP_ENCRYPT_REQUIRED
  Encryption is required (TLS upgrade)

### http_field_e

HTTP field names

#### Constants

HTTP_FIELD_ACCEPT_LANGUAGE
  Accept-Language field
HTTP_FIELD_ACCEPT_RANGES
  Accept-Ranges 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_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_CLOSE
  CLOSE command, waiting for blank line
HTTP_DELETE
  DELETE command, waiting for blank line
HTTP_GET
  GET command, waiting for blank line
HTTP_GET_SEND
  GET command, sending data
HTTP_HEAD
  HEAD command, waiting for blank line
HTTP_OPTIONS
  OPTIONS command, waiting for blank line
HTTP_POST
  POST command, waiting for blank line
HTTP_POST_RECV
  POST command, receiving data
HTTP_POST_SEND
  POST command, sending data
HTTP_PUT
  PUT command, waiting for blank line
HTTP_PUT_RECV
  PUT command, receiving data
HTTP_STATUS
  Command complete, sending status
HTTP_TRACE
  TRACE command, waiting for blank line
HTTP_WAITING
  Waiting for command

### http_status_e

HTTP status codes

#### Constants

HTTP_ACCEPTED
  DELETE command was successful
HTTP_AUTHORIZATION_CANCELED CUPS 1.4
  User canceled authorization
HTTP_BAD_GATEWAY
  Bad gateway
HTTP_BAD_REQUEST
  Bad request
HTTP_CONFLICT
  Request is self-conflicting
HTTP_CONTINUE
  Everything OK, keep going...
HTTP_CREATED
  PUT command was successful
HTTP_ERROR
  An error response from httpXxxx()
HTTP_EXPECTATION_FAILED
  The expectation given in an Expect header field was not met
HTTP_FORBIDDEN
  Forbidden to access this URI
HTTP_GATEWAY_TIMEOUT
  Gateway connection timed out
HTTP_GONE
  Server has gone away
HTTP_LENGTH_REQUIRED
  A content length or encoding is required
HTTP_METHOD_NOT_ALLOWED
  Method is not allowed
HTTP_MOVED_PERMANENTLY
  Document has moved permanently
HTTP_MOVED_TEMPORARILY
  Document has moved temporarily
HTTP_MULTIPLE_CHOICES
  Multiple files match request
HTTP_NOT_ACCEPTABLE
  Not Acceptable
HTTP_NOT_AUTHORITATIVE
  Information isn't authoritative
HTTP_NOT_FOUND
  URI was not found
HTTP_NOT_IMPLEMENTED
  Feature not implemented
HTTP_NOT_MODIFIED
  File not modified
HTTP_NOT_SUPPORTED
  HTTP version not supported
HTTP_NO_CONTENT
  Successful command, no new data
HTTP_OK
  OPTIONS/GET/HEAD/POST/TRACE command was successful
HTTP_PARTIAL_CONTENT
  Only a partial file was recieved/sent
HTTP_PAYMENT_REQUIRED
  Payment required
HTTP_PKI_ERROR CUPS 1.5/OS X 10.7
  Error negotiating a secure connection
HTTP_PRECONDITION
  Precondition failed
HTTP_PROXY_AUTHENTICATION
  Proxy Authentication is Required
HTTP_REQUESTED_RANGE
  The requested range is not satisfiable
HTTP_REQUEST_TIMEOUT
  Request timed out
HTTP_REQUEST_TOO_LARGE
  Request entity too large
HTTP_RESET_CONTENT
  Content was reset/recreated
HTTP_SEE_OTHER
  See this other link...
HTTP_SERVER_ERROR
  Internal server error
HTTP_SERVICE_UNAVAILABLE
  Service is unavailable
HTTP_SWITCHING_PROTOCOLS
  HTTP upgrade to TLS/SSL
HTTP_UNAUTHORIZED
  Unauthorized to access host
HTTP_UNSUPPORTED_MEDIATYPE
  The requested media type is unsupported
HTTP_UPGRADE_REQUIRED
  Upgrade to SSL/TLS required
HTTP_URI_TOO_LONG
  URI too long
HTTP_USE_PROXY
  Must use a proxy to access this URI

### 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_BAD_ARGUMENTS
  Bad arguments to function (error)
HTTP_URI_BAD_HOSTNAME
  Bad hostname in URI (error)
HTTP_URI_BAD_PORT
  Bad port number in URI (error)
HTTP_URI_BAD_RESOURCE
  Bad resource in URI (error)
HTTP_URI_BAD_SCHEME
  Bad scheme in URI (error)
HTTP_URI_BAD_URI
  Bad/empty URI (error)
HTTP_URI_BAD_USERNAME
  Bad username in URI (error)
HTTP_URI_MISSING_RESOURCE
  Missing resource in URI (warning)
HTTP_URI_MISSING_SCHEME
  Missing scheme in URI (warning)
HTTP_URI_OK
  URI decoded OK
HTTP_URI_OVERFLOW
  URI buffer for httpAssembleURI is too small
HTTP_URI_UNKNOWN_SCHEME
  Unknown scheme in URI (warning)

### http_version_e

HTTP version numbers

#### Constants

HTTP_0_9
  HTTP/0.9
HTTP_1_0
  HTTP/1.0
HTTP_1_1
  HTTP/1.1

### ipp_dstate_e

Document states

#### Constants

IPP_DOCUMENT_ABORTED
IPP_DOCUMENT_CANCELED
IPP_DOCUMENT_COMPLETED
IPP_DOCUMENT_PENDING
IPP_DOCUMENT_PROCESSING

### ipp_finish_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_COVER
  Add cover
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_JOB_OFFSET
  Offset for binding (any type)
IPP_FINISHINGS_NONE
  No finishing
IPP_FINISHINGS_PUNCH
  Punch (any location/count)
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_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_JOB_COLLATED_DOCUMENTS
IPP_JOB_UNCOLLATED_DOCUMENTS
IPP_JOB_UNCOLLATED_SHEETS

### ipp_jstate_e

Job states

#### Constants

IPP_JOB_ABORTED
  Job has aborted due to error
IPP_JOB_CANCELED
  Job has been canceled
IPP_JOB_COMPLETED
  Job has completed successfully
IPP_JOB_HELD
  Job is held for printing
IPP_JOB_PENDING
  Job is waiting to be printed
IPP_JOB_PROCESSING
  Job is currently printing
IPP_JOB_STOPPED
  Job has been stopped

### ipp_op_e

IPP operations

#### Constants

CUPS_ACCEPT_JOBS
  Accept new jobs on a printer
CUPS_ADD_MODIFY_CLASS
  Add or modify a class
CUPS_ADD_MODIFY_PRINTER
  Add or modify a printer
CUPS_AUTHENTICATE_JOB CUPS 1.2/OS X 10.5
  Authenticate a job
CUPS_DELETE_CLASS
  Delete a class
CUPS_DELETE_PRINTER
  Delete a printer
CUPS_GET_CLASSES DEPRECATED
  Get a list of classes
CUPS_GET_DEFAULT
  Get the default printer
CUPS_GET_DEVICES
  Get a list of supported devices
CUPS_GET_DOCUMENT CUPS 1.4/OS X 10.6
  Get a document file
CUPS_GET_PPD CUPS 1.3/OS X 10.5
  Get a PPD file
CUPS_GET_PPDS
  Get a list of supported drivers
CUPS_GET_PRINTERS
  Get a list of printers and/or classes
CUPS_MOVE_JOB
  Move a job to a different printer
CUPS_REJECT_JOBS
  Reject new jobs on a printer
CUPS_SET_DEFAULT
  Set the default printer
IPP_CANCEL_JOB
  Cancel a job
IPP_CANCEL_JOBS
  Cancel-Jobs
IPP_CANCEL_MY_JOBS
  Cancel-My-Jobs
IPP_CANCEL_SUBSCRIPTION CUPS 1.2/OS X 10.5
  Cancel a subscription
IPP_CLOSE_JOB
  Close-Job
IPP_CREATE_JOB
  Create an empty print job
IPP_CREATE_JOB_SUBSCRIPTION CUPS 1.2/OS X 10.5
  Create a job subscription
IPP_CREATE_PRINTER_SUBSCRIPTION CUPS 1.2/OS X 10.5
  Create a printer subscription
IPP_DISABLE_PRINTER
  Stop a printer
IPP_ENABLE_PRINTER
  Start a printer
IPP_GET_JOBS
  Get a list of jobs
IPP_GET_JOB_ATTRIBUTES
  Get job attributes
IPP_GET_NOTIFICATIONS CUPS 1.2/OS X 10.5
  Get notification events
IPP_GET_PRINTER_ATTRIBUTES
  Get printer attributes
IPP_GET_PRINTER_SUPPORTED_VALUES
  Get supported attribute values
IPP_GET_SUBSCRIPTIONS CUPS 1.2/OS X 10.5
  Get list of subscriptions
IPP_GET_SUBSCRIPTION_ATTRIBUTES CUPS 1.2/OS X 10.5
  Get subscription attributes
IPP_HOLD_JOB
  Hold a job for printing
IPP_IDENTIFY_PRINTER
  Identify-Printer (proposed IPP JPS3)
IPP_OP_CUPS_INVALID
  Invalid operation name for `ippOpValue`
IPP_PAUSE_PRINTER
  Stop a printer
IPP_PRINT_JOB
  Print a single file
IPP_PURGE_JOBS
  Cancel all jobs
IPP_RELEASE_JOB
  Release a job for printing
IPP_RENEW_SUBSCRIPTION CUPS 1.2/OS X 10.5
  Renew a printer subscription
IPP_RESTART_JOB
  Reprint a job
IPP_RESUBMIT_JOB
  Resubmit-Job
IPP_RESUME_PRINTER
  Start a printer
IPP_SEND_DOCUMENT
  Add a file to a job
IPP_SET_JOB_ATTRIBUTES
  Set job attributes
IPP_VALIDATE_DOCUMENT
  Validate-Document (proposed IPP JPS3)
IPP_VALIDATE_JOB
  Validate job options

### ipp_orient_e

Orientation values

#### Constants

IPP_LANDSCAPE
  90 degrees counter-clockwise
IPP_PORTRAIT
  No rotation
IPP_REVERSE_LANDSCAPE
  90 degrees clockwise
IPP_REVERSE_PORTRAIT
  180 degrees

### ipp_pstate_e

Printer states

#### Constants

IPP_PRINTER_IDLE
  Printer is idle
IPP_PRINTER_PROCESSING
  Printer is working
IPP_PRINTER_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_ATTRIBUTE
  One or more attributes need to be sent/received
IPP_DATA
  IPP request data needs to be sent/received
IPP_ERROR
  An error occurred
IPP_HEADER
  The request header needs to be sent/received
IPP_IDLE
  Nothing is happening/request completed

### ipp_status_e

IPP status codes

#### Constants

CUPS_SEE_OTHER
  cups-see-other
IPP_ATTRIBUTES
  client-error-attributes-or-values-not-supported
IPP_ATTRIBUTES_NOT_SETTABLE
  client-error-attributes-not-settable
IPP_AUTHENTICATION_CANCELED CUPS 1.5/OS X 10.7
  Authentication canceled by user
IPP_BAD_REQUEST
  client-error-bad-request
IPP_CHARSET
  client-error-charset-not-supported
IPP_COMPRESSION_ERROR
  client-error-compression-error
IPP_COMPRESSION_NOT_SUPPORTED
  client-error-compression-not-supported
IPP_CONFLICT
  client-error-conflicting-attributes
IPP_DEVICE_ERROR
  server-error-device-error
IPP_DOCUMENT_ACCESS_ERROR
  client-error-document-access-error
IPP_DOCUMENT_FORMAT
  client-error-document-format-not-supported
IPP_DOCUMENT_FORMAT_ERROR
  client-error-document-format-error
IPP_DOCUMENT_PASSWORD_ERROR
  client-error-document-password-error
IPP_DOCUMENT_PERMISSION_ERROR
  client-error-document-permission-error
IPP_DOCUMENT_SECURITY_ERROR
  client-error-document-security-error
IPP_DOCUMENT_UNPRINTABLE_ERROR
  client-error-document-unprintable-error
IPP_ERROR_JOB_CANCELED
  server-error-job-canceled
IPP_FORBIDDEN
  client-error-forbidden
IPP_GONE
  client-error-gone
IPP_IGNORED_ALL_SUBSCRIPTIONS
  client-error-ignored-all-subscriptions
IPP_INTERNAL_ERROR
  server-error-internal-error
IPP_MULTIPLE_JOBS_NOT_SUPPORTED
  server-error-multiple-document-jobs-not-supported
IPP_NOT_ACCEPTING
  server-error-not-accepting-jobs
IPP_NOT_AUTHENTICATED
  client-error-not-authenticated
IPP_NOT_AUTHORIZED
  client-error-not-authorized
IPP_NOT_FOUND
  client-error-not-found
IPP_NOT_POSSIBLE
  client-error-not-possible
IPP_OK
  successful-ok
IPP_OK_CONFLICT
  successful-ok-conflicting-attributes
IPP_OK_EVENTS_COMPLETE
  successful-ok-events-complete
IPP_OK_IGNORED_SUBSCRIPTIONS
  successful-ok-ignored-subscriptions
IPP_OK_SUBST
  successful-ok-ignored-or-substituted-attributes
IPP_OK_TOO_MANY_EVENTS
  successful-ok-too-many-events
IPP_OPERATION_NOT_SUPPORTED
  server-error-operation-not-supported
IPP_PKI_ERROR CUPS 1.5/OS X 10.7
  Error negotiating a secure connection
IPP_PRINTER_BUSY
  server-error-busy
IPP_PRINTER_IS_DEACTIVATED
  server-error-printer-is-deactivated
IPP_REQUEST_ENTITY
  client-error-request-entity-too-large
IPP_REQUEST_VALUE
  client-error-request-value-too-long
IPP_SERVICE_UNAVAILABLE
  server-error-service-unavailable
IPP_STATUS_CUPS_INVALID
  Invalid status name for `ippErrorValue`
IPP_TEMPORARY_ERROR
  server-error-temporary-error
IPP_TIMEOUT
  client-error-timeout
IPP_TOO_MANY_DOCUMENTS
  server-error-too-many-documents
IPP_TOO_MANY_JOBS
  server-error-too-many-jobs
IPP_TOO_MANY_SUBSCRIPTIONS
  client-error-too-many-subscriptions
IPP_UPGRADE_REQUIRED
  TLS upgrade required
IPP_URI_SCHEME
  client-error-uri-scheme-not-supported
IPP_VERSION_NOT_SUPPORTED
  server-error-version-not-supported

### 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