]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - doc/help/api-filter.html
Update all references to OS X to macOS.
[thirdparty/cups.git] / doc / help / api-filter.html
index 2b3975259b9455b7b3f9a3507ac20c18b9bfdcc5..d159656dee0cf783fcaa8e0ca08b793bc15934aa 100644 (file)
@@ -1,10 +1,11 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <!-- SECTION: Programming -->
 <head>
-<title>Filter and Backend Programming</title>
-<meta name="keywords" content="Programming">
-<meta name="creator" content="Mini-XML v2.5">
+       <title>Filter and Backend Programming   </title>
+       <meta name="keywords" content="Programming">
+       <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+       <meta name="creator" content="Mini-XML v2.7">
 <style type="text/css"><!--
 BODY {
   font-family: lucida grande, geneva, helvetica, arial, sans-serif;
@@ -24,14 +25,37 @@ PRE {
 }
 
 PRE.command {
+  border: dotted thin #7f7f7f;
   margin-left: 36pt;
+  padding: 10px;
+}
+
+P.compact {
+  margin: 0;
+}
+
+P.example {
+  font-style: italic;
+  margin-left: 36pt;
+}
+
+DL.man DD {
+  margin-left: 5em;
+}
+
+DL.man DT {
+  margin-left: 0;
+}
+
+PRE.man {
+  margin: 0;
 }
 
 PRE.example {
   background: #eeeeee;
   border: dotted thin #999999;
   margin-left: 36pt;
-  padding: 10px;
+  padding: 10pt;
 }
 
 PRE.command EM, PRE.example EM {
@@ -49,25 +73,47 @@ P.formula {
 }
 
 BLOCKQUOTE {
-  background: #cccccc;
+  background: #eeeeee;
   border: solid thin #999999;
   padding: 10pt;
 }
 
+A IMG {
+  border: none;
+}
+
+A:link:hover IMG {
+  background: #f0f0f0;
+  border-radius: 10px;
+  -moz-border-radius: 10px;
+}
+
 A:link, A:visited {
+  font-weight: inherit;
   text-decoration: none;
-  font-weight: bold;
 }
 
 A:link:hover, A:visited:hover, A:active {
   text-decoration: underline;
-  font-weight: bold;
 }
 
 SUB, SUP {
   font-size: 50%;
 }
 
+TR.data, TD.data, TR.data TD {
+  margin-top: 10pt;
+  padding: 5pt;
+  border-bottom: solid 1pt #999999;
+}
+
+TR.data TH {
+  border-bottom: solid 1pt #999999;
+  padding-top: 10pt;
+  padding-left: 5pt;
+  text-align: left;
+}
+
 DIV.table TABLE {
   border: solid thin #999999;
   border-collapse: collapse;
@@ -111,19 +157,23 @@ DIV.figure CAPTION {
 }
 
 TH.label {
-  padding-top: 5pt;
   text-align: right;
   vertical-align: top;
 }
 
+TH.sublabel {
+  text-align: right;
+  font-weight: normal;
+}
+
 HR {
   border: solid thin;
 }
 
 SPAN.info {
-  background: #000000;
-  border: thin solid #000000;
-  color: #ffffff;
+  background: black;
+  border: thin solid black;
+  color: white;
   font-size: 80%;
   font-style: italic;
   font-weight: bold;
@@ -135,10 +185,64 @@ H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
   font-size: 100%;
 }
 
+H1.title {
+}
+
 H2.title, H3.title {
   border-bottom: solid 2pt #000000;
 }
 
+DIV.indent, TABLE.indent {
+  margin-top: 2em;
+  margin-left: auto;
+  margin-right: auto;
+  width: 90%;
+}
+
+TABLE.indent {
+  border-collapse: collapse;
+}
+
+TABLE.indent TD, TABLE.indent TH {
+  padding: 0;
+}
+
+TABLE.list {
+  border-collapse: collapse;
+  margin-left: auto;
+  margin-right: auto;
+  width: 90%;
+}
+
+TABLE.list TH {
+  background: white;
+  border-bottom: solid thin #cccccc;
+  color: #444444;
+  padding-top: 10pt;
+  padding-left: 5pt;
+  text-align: left;
+  vertical-align: bottom;
+  white-space: nowrap;
+}
+
+TABLE.list TH A {
+  color: #4444cc;
+}
+
+TABLE.list TD {
+  border-bottom: solid thin #eeeeee;
+  padding-top: 5pt;
+  padding-left: 5pt;
+}
+
+TABLE.list TR:nth-child(even) {
+  background: #f8f8f8;
+}
+
+TABLE.list TR:nth-child(odd) {
+  background: #f4f4f4;
+}
+
 DT {
   margin-left: 36pt;
   margin-top: 12pt;
@@ -157,11 +261,6 @@ P.summary {
   font-family: monaco, courier, monospace;
 }
 
-SPAN.message {
-  font-style: italic;
-  font-size: smaller;
-}
-
 DIV.summary TABLE {
   border: solid thin #999999;
   border-collapse: collapse;
@@ -254,12 +353,9 @@ div.contents ul.subcontents li {
 <body>
 <div class='body'>
 <!--
-  "$Id: api-filter.header 7285 2008-02-01 23:57:39Z mike $"
+  Filter and backend programming header for CUPS.
 
-  Filter and backend programming header for the Common UNIX Printing System
-  (CUPS).
-
-  Copyright 2008 by Apple Inc.
+  Copyright 2008-2016 by Apple Inc.
 
   These coded instructions, statements, and computer programs are the
   property of Apple Inc. and are protected by Federal copyright
@@ -268,15 +364,15 @@ div.contents ul.subcontents li {
   file is missing or damaged, see the license at "http://www.cups.org/".
 -->
 
-<h1 class="title">Filter and Backend Programming</h1>
+<h1 class='title'>Filter and Backend Programming</h1>
 
 <div class='summary'><table summary='General Information'>
 <thead>
 <tr>
        <th>Headers</th>
        <th>cups/backend.h<br>
-       cups/sidechannel.h<br>
-       cups/snmp.h</th>
+       cups/ppd.h<br>
+       cups/sidechannel.h</th>
 </tr>
 </thead>
 <tbody>
@@ -289,75 +385,62 @@ div.contents ul.subcontents li {
        <td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
        Programming: <a href='api-cups.html' target='_top'>CUPS API</a><br>
        Programming: <a href='api-ppd.html' target='_top'>PPD API</a><br>
-       Programming: <a href='api-raster.html' target='_top'>Raster API</a></td>
+       Programming: <a href='api-raster.html' target='_top'>Raster API</a><br>
+       Programming: <a href='postscript-driver.html' target='_top'>Developing PostScript Printer Drivers</a><br>
+       Programming: <a href='raster-driver.html' target='_top'>Developing Raster Printer Drivers</a><br>
+       Specifications: <a href='spec-design.html' target='_top'>CUPS Design Description</a></td>
 </tr>
 </tbody>
 </table></div>
 <h2 class="title">Contents</h2>
 <ul class="contents">
-</li>
 <li><a href="#OVERVIEW">Overview</a><ul class="subcontents">
-<li><a href="#SECURITY">Security Considerations</a></li>
-<li><a href="#TEMPFILES">Temporary Files</a></li>
-<li><a href="#COPIES">Copy Generation</a></li>
-<li><a href="#EXITCODES">Exit Codes</a></li>
-<li><a href="#ENVIRONMENT">Environment Variables</a></li>
-<li><a href="#MESSAGES">Communicating with the Scheduler</a></li>
-<li><a href="#COMMUNICATING">Communicating with the Backend</a></li>
-<li><a href="#SNMP">Doing SNMP Queries with Network Printers</a></li>
+       <li><a href="#SECURITY">Security Considerations</a></li>
+       <li><a href="#SIGNALS">Canceled Jobs and Signal Handling</a></li>
+       <li><a href="#PERMISSIONS">File Permissions</a></li>
+       <li><a href="#TEMPFILES">Temporary Files</a></li>
+       <li><a href="#COPIES">Copy Generation</a></li>
+       <li><a href="#EXITCODES">Exit Codes</a></li>
+       <li><a href="#ENVIRONMENT">Environment Variables</a></li>
+       <li><a href="#MESSAGES">Communicating with the Scheduler</a></li>
+       <li><a href="#COMMUNICATING_BACKEND">Communicating with the Backend</a></li>
+       <li><a href="#COMMUNICATING_FILTER">Communicating with Filters</a></li>
+       <li><a href="#SNMP">Doing SNMP Queries with Network Printers</a></li>
 </ul></li>
+<li><a href="#SANDBOXING">Sandboxing on macOS</a></li>
 <li><a href="#FUNCTIONS">Functions</a><ul class="code">
-<li><a href="#cupsBackChannelRead" title="Read data from the backchannel.">cupsBackChannelRead</a></li>
-<li><a href="#cupsBackChannelWrite" title="Write data to the backchannel.">cupsBackChannelWrite</a></li>
-<li><a href="#cupsBackendDeviceURI" title="Get the device URI for a backend.">cupsBackendDeviceURI</a></li>
-<li><a href="#cupsSNMPClose" title="Close a SNMP socket.">cupsSNMPClose</a></li>
-<li><a href="#cupsSNMPCopyOID" title="Copy an OID.">cupsSNMPCopyOID</a></li>
-<li><a href="#cupsSNMPDefaultCommunity" title="Get the default SNMP community name.">cupsSNMPDefaultCommunity</a></li>
-<li><a href="#cupsSNMPIsOID" title="Test whether a SNMP response contains the specified OID.">cupsSNMPIsOID</a></li>
-<li><a href="#cupsSNMPIsOIDPrefixed" title="Test whether a SNMP response uses the specified
-OID prefix.">cupsSNMPIsOIDPrefixed</a></li>
-<li><a href="#cupsSNMPOpen" title="Open a SNMP socket.">cupsSNMPOpen</a></li>
-<li><a href="#cupsSNMPRead" title="Read and parse a SNMP response.">cupsSNMPRead</a></li>
-<li><a href="#cupsSNMPSetDebug" title="Enable/disable debug logging to stderr.">cupsSNMPSetDebug</a></li>
-<li><a href="#cupsSNMPWalk" title="Enumerate a group of OIDs.">cupsSNMPWalk</a></li>
-<li><a href="#cupsSNMPWrite" title="Send an SNMP query packet.">cupsSNMPWrite</a></li>
-<li><a href="#cupsSideChannelDoRequest" title="Send a side-channel command to a backend and wait for a response.">cupsSideChannelDoRequest</a></li>
-<li><a href="#cupsSideChannelRead" title="Read a side-channel message.">cupsSideChannelRead</a></li>
-<li><a href="#cupsSideChannelWrite" title="Write a side-channel message.">cupsSideChannelWrite</a></li>
-</ul>
+       <li><a href="#cupsBackChannelRead" title="Read data from the backchannel.">cupsBackChannelRead</a></li>
+       <li><a href="#cupsBackChannelWrite" title="Write data to the backchannel.">cupsBackChannelWrite</a></li>
+       <li><a href="#cupsBackendDeviceURI" title="Get the device URI for a backend.">cupsBackendDeviceURI</a></li>
+       <li><a href="#cupsBackendReport" title="Write a device line from a backend.">cupsBackendReport</a></li>
+       <li><a href="#cupsSideChannelDoRequest" title="Send a side-channel command to a backend and wait for a response.">cupsSideChannelDoRequest</a></li>
+       <li><a href="#cupsSideChannelRead" title="Read a side-channel message.">cupsSideChannelRead</a></li>
+       <li><a href="#cupsSideChannelSNMPGet" title="Query a SNMP OID's value.">cupsSideChannelSNMPGet</a></li>
+       <li><a href="#cupsSideChannelSNMPWalk" title="Query multiple SNMP OID values.">cupsSideChannelSNMPWalk</a></li>
+       <li><a href="#cupsSideChannelWrite" title="Write a side-channel message.">cupsSideChannelWrite</a></li>
+</ul></li>
 <li><a href="#TYPES">Data Types</a><ul class="code">
-       <li><a href="#cups_asn1_t" title="ASN1 request/object types">cups_asn1_t</a></li>
        <li><a href="#cups_backend_t" title="Backend exit codes">cups_backend_t</a></li>
        <li><a href="#cups_sc_bidi_t" title="Bidirectional capabilities">cups_sc_bidi_t</a></li>
        <li><a href="#cups_sc_command_t" title="Request command codes">cups_sc_command_t</a></li>
+       <li><a href="#cups_sc_connected_t" title="Connectivity values">cups_sc_connected_t</a></li>
        <li><a href="#cups_sc_state_t" title="Printer state bits">cups_sc_state_t</a></li>
        <li><a href="#cups_sc_status_t" title="Response status codes">cups_sc_status_t</a></li>
-       <li><a href="#cups_snmp_cb_t" title="Prototypes...">cups_snmp_cb_t</a></li>
-       <li><a href="#cups_snmp_t" title="SNMP data packet">cups_snmp_t</a></li>
-</ul></li>
-<li><a href="#STRUCTURES">Structures</a><ul class="code">
-       <li><a href="#cups_snmp_hexstring_s" title="Hex-STRING value">cups_snmp_hexstring_s</a></li>
-       <li><a href="#cups_snmp_s" title="SNMP data packet">cups_snmp_s</a></li>
-</ul></li>
-<li><a href="#UNIONS">Unions</a><ul class="code">
-       <li><a href="#cups_snmp_value_u" title="Object value">cups_snmp_value_u</a></li>
+       <li><a href="#cups_sc_walk_func_t" title="SNMP walk callback">cups_sc_walk_func_t</a></li>
 </ul></li>
 <li><a href="#ENUMERATIONS">Constants</a><ul class="code">
-       <li><a href="#cups_asn1_e" title="ASN1 request/object types">cups_asn1_e</a></li>
        <li><a href="#cups_backend_e" title="Backend exit codes">cups_backend_e</a></li>
-       <li><a href="#cups_sc_bidi_e" title="Bidirectional capabilities">cups_sc_bidi_e</a></li>
+       <li><a href="#cups_sc_bidi_e" title="Bidirectional capability values">cups_sc_bidi_e</a></li>
        <li><a href="#cups_sc_command_e" title="Request command codes">cups_sc_command_e</a></li>
+       <li><a href="#cups_sc_connected_e" title="Connectivity values">cups_sc_connected_e</a></li>
        <li><a href="#cups_sc_state_e" title="Printer state bits">cups_sc_state_e</a></li>
        <li><a href="#cups_sc_status_e" title="Response status codes">cups_sc_status_e</a></li>
 </ul></li>
 </ul>
 <!--
-  "$Id: api-filter.shtml 7288 2008-02-06 01:39:05Z mike $"
+  Filter and backend programming introduction for CUPS.
 
-  Filter and backend programming introduction for the Common UNIX Printing
-  System (CUPS).
-
-  Copyright 2007-2008 by Apple Inc.
+  Copyright 2007-2016 by Apple Inc.
   Copyright 1997-2006 by Easy Software Products, all rights reserved.
 
   These coded instructions, statements, and computer programs are the
@@ -369,9 +452,11 @@ OID prefix.">cupsSNMPIsOIDPrefixed</a></li>
 
 <h2 class='title'><a name="OVERVIEW">Overview</a></h2>
 
-<p>Filters, printer drivers, port monitors, and backends use a common interface
-for processing print jobs and communicating status information to the scheduler.
-Each filter is run with a standard set of command-line arguments:<p>
+<p>Filters (which include printer drivers and port monitors) and backends
+are used to convert job files to a printable format and send that data to the
+printer itself. All of these programs use a common interface for processing
+print jobs and communicating status information to the scheduler. Each is run
+with a standard set of command-line arguments:<p>
 
 <dl class="code">
 
@@ -391,7 +476,7 @@ Each filter is run with a standard set of command-line arguments:<p>
        <dd>The options that were provided when the job was submitted</dd>
 
        <dt>argv[6]</dt>
-       <dd>The file to print (first filter only)</dd>
+       <dd>The file to print (first program only)</dd>
 </dl>
 
 <p>The scheduler runs one or more of these programs to print any given job. The
@@ -400,10 +485,16 @@ the remaining filters read from the standard input and write to the standard
 output. The backend is the last filter in the chain and writes to the
 device.</p>
 
+<p>Filters are always run as a non-privileged user, typically "lp", with no
+connection to the user's desktop. Backends are run either as a non-privileged
+user or as root if the file permissions do not allow user or group execution.
+The <a href="#PERMISSIONS">file permissions</a> section talks about this in
+more detail.</p>
+
 <h3><a name="SECURITY">Security Considerations</a></h3>
 
 <p>It is always important to use security programming practices. Filters and
-most backends are run as a non-priviledged user, so the major security
+most backends are run as a non-privileged user, so the major security
 consideration is resource utilization - filters should not depend on unlimited
 amounts of CPU, memory, or disk space, and should protect against conditions
 that could lead to excess usage of any resource like infinite loops and
@@ -426,10 +517,48 @@ user may not be the same as the local user and/or there may not be a local home
 directory to write to.</p>
 
 <p>In addition, some operating systems provide additional security mechanisms
-that further limit file system access, even for backends running as root.  On
-Mac OS X, for example, no backend may write to a user's home directory.</p>
+that further limit file system access, even for backends running as root. On
+macOS, for example, no backend may write to a user's home directory. See the <a href="#SANDBOXING">Sandboxing on macOS</a> section for more information.</p>
 </blockquote>
 
+<h3><a name="SIGNALS">Canceled Jobs and Signal Handling</a></h3>
+
+<p>The scheduler sends <code>SIGTERM</code> when a printing job is canceled or
+held. Filters, backends, and port monitors <em>must</em> catch
+<code>SIGTERM</code> and perform any cleanup necessary to produce a valid output
+file or return the printer to a known good state. The recommended behavior is to
+end the output on the current page, preferably on the current line or object
+being printed.</p>
+
+<p>Filters and backends may also receive <code>SIGPIPE</code> when an upstream or downstream filter/backend exits with a non-zero status. Developers should generally ignore <code>SIGPIPE</code> at the beginning of <code>main()</code> with the following function call:</p>
+
+<pre class="example">
+#include &lt;signal.h&gt;>
+
+...
+
+int
+main(int argc, char *argv[])
+{
+  signal(SIGPIPE, SIG_IGN);
+
+  ...
+}
+</pre>
+
+<h3><a name="PERMISSIONS">File Permissions</a></h3>
+
+<p>For security reasons, CUPS will only run filters and backends that are owned
+by root and do not have world or group write permissions. The recommended
+permissions for filters and backends are 0555 - read and execute but no write.
+Backends that must run as root should use permissions of 0500 - read and execute
+by root, no access for other users. Write permissions can be enabled for the
+root user only.</p>
+
+<p>To avoid a warning message, the directory containing your filter(s) must also
+be owned by root and have world and group write disabled - permissions of 0755
+or 0555 are strongly encouraged.</p>
+
 <h3><a name="TEMPFILES">Temporary Files</a></h3>
 
 <p>Temporary files should be created in the directory specified by the
@@ -454,13 +583,14 @@ or 1 when they encounter an error. Backends can return any of the
 
 <h3><a name="ENVIRONMENT">Environment Variables</a></h3>
 
-<p>The following environment variables are defined by the printing system:</p>
+<p>The following environment variables are defined by the printing system
+when running print filters and backends:</p>
 
 <dl class="code">
 
-       <dt>APPLE_LANGUAGES</dt>
+       <dt>APPLE_LANGUAGE</dt>
        <dd>The Apple language identifier associated with the job
-       (Mac OS X only).</dd>
+       (macOS only).</dd>
 
        <dt>CHARSET</dt>
        <dd>The job character set, typically "utf-8".</dd>
@@ -475,10 +605,15 @@ or 1 when they encounter an error. Backends can return any of the
        application/postscript).</dd>
 
        <dt>CUPS_CACHEDIR</dt>
-       <dd>The directory where cache files can be stored.</dd>
+       <dd>The directory where cache files can be stored. Cache files can be
+       used to retain information between jobs or files in a job.</dd>
 
        <dt>CUPS_DATADIR</dt>
-       <dd>The directory where data files can be found.</dd>
+       <dd>The directory where (read-only) CUPS data files can be found.</dd>
+
+       <dt>CUPS_FILETYPE</dt>
+       <dd>The type of file being printed: "job-sheet" for a banner page and
+       "document" for a regular print file.</dd>
 
        <dt>CUPS_SERVERROOT</dt>
        <dd>The root directory of the server.</dd>
@@ -498,19 +633,23 @@ or 1 when they encounter an error. Backends can return any of the
        file for this printer.</dd>
 
        <dt>PRINTER</dt>
-       <dd>The name of the printer.</dd>
+       <dd>The queue name of the class or printer.</dd>
 
        <dt>RIP_CACHE</dt>
        <dd>The recommended amount of memory to use for Raster Image
        Processors (RIPs).</dd>
 
+       <dt>TMPDIR</dt>
+       <dd>The directory where temporary files should be created.</dd>
+
 </dl>
 
 <h3><a name="MESSAGES">Communicating with the Scheduler</a></h3>
 
-<p>Filters and backends communicate wih the scheduler by writing messages
-to the standard error file. For example, the following code sets the current
-printer state message to "Printing page 5":</p>
+<p>Filters and backends communicate with the scheduler by writing messages
+to the standard error file. The scheduler reads messages from all filters in
+a job and processes the message based on its prefix. For example, the following
+code sets the current printer state message to "Printing page 5":</p>
 
 <pre class="example">
 int page = 5;
@@ -529,10 +668,13 @@ prefix strings:</p>
 
        <dt>ATTR: attribute=value [attribute=value]</dt>
        <dd>Sets the named printer or job attribute(s). Typically this is used
-       to set the <code>marker-colors</code>, <code>marker-levels</code>,
-       <code>marker-names</code>, <code>marker-types</code>,
-       <code>printer-alert</code>, and <code>printer-alert-description</code>
-       printer attributes.</dd>
+       to set the <code>marker-colors</code>, <code>marker-high-levels</code>,
+       <code>marker-levels</code>, <code>marker-low-levels</code>,
+       <code>marker-message</code>, <code>marker-names</code>,
+       <code>marker-types</code>, <code>printer-alert</code>, and
+       <code>printer-alert-description</code> printer attributes. Standard
+       <code>marker-types</code> values are listed in <a href='#TABLE1'>Table
+       1</a>. String values need special handling - see <a href="#ATTR_STRINGS">Reporting Attribute String Values</a> below.</dd>
 
        <dt>CRIT: message</dt>
        <dd>Sets the printer-state-message attribute and adds the specified
@@ -554,7 +696,8 @@ prefix strings:</p>
 
        <dt>ERROR: message</dt>
        <dd>Sets the printer-state-message attribute and adds the specified
-       message to the current error log file using the "error" log level.</dd>
+       message to the current error log file using the "error" log level.
+       Use "ERROR:" messages for non-persistent processing errors.</dd>
 
        <dt>INFO: message</dt>
        <dd>Sets the printer-state-message attribute. If the current log level
@@ -571,12 +714,20 @@ prefix strings:</p>
        #-copies to the job-media-sheets-completed attribute. The second
        form sets the job-media-sheets-completed attribute to #-pages.</dd>
 
-       <dt>STATE: printer-state-reason [printer-state-reason ...]</dt>
+       <dt>PPD: keyword=value [keyword=value ...]</dt>
+       <dd>Changes or adds keywords to the printer's PPD file. Typically
+       this is used to update installable options or default media settings
+       based on the printer configuration.</dd>
+
        <dt>STATE: + printer-state-reason [printer-state-reason ...]</dt>
        <dt>STATE: - printer-state-reason [printer-state-reason ...]</dt>
-       <dd>Sets, adds, or removes printer-state-reason keywords to the
-       current queue. Typically this is used to indicate media, ink, and
-       toner conditions on a printer.</dd>
+       <dd>Sets or clears printer-state-reason keywords for the current queue.
+       Typically this is used to indicate persistent media, ink, toner, and
+       configuration conditions or errors on a printer.
+       <a href='#TABLE2'>Table 2</a> lists some of the standard "printer-state-reasons" keywords from the <a href="http://www.iana.org/assignments/ipp-registrations/ipp-registrations.xhtml#ipp-registrations-4">IANA IPP Registry</a> -
+       use vendor-prefixed ("com.example.foo") keywords for custom states. See
+       <a href="#MANAGING_STATE">Managing Printer State in a Filter</a> for more
+       information.
 
        <dt>WARNING: message</dt>
        <dd>Sets the printer-state-message attribute and adds the specified
@@ -588,12 +739,366 @@ prefix strings:</p>
 <p>Messages without one of these prefixes are treated as if they began with
 the "DEBUG:" prefix string.</p>
 
-<h3><a name="COMMUNICATING">Communicating with the Backend</a></h3>
+<div class='table'><table width='80%' summary='Table 1: Standard marker-types Values'>
+<caption>Table 1: <a name='TABLE1'>Standard marker-types Values</a></caption>
+<thead>
+<tr>
+       <th>marker-type</th>
+       <th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+       <td>developer</td>
+       <td>Developer unit</td>
+</tr>
+<tr>
+       <td>fuser</td>
+       <td>Fuser unit</td>
+</tr>
+<tr>
+       <td>fuser-cleaning-pad</td>
+       <td>Fuser cleaning pad</td>
+</tr>
+<tr>
+       <td>fuser-oil</td>
+       <td>Fuser oil</td>
+</tr>
+<tr>
+       <td>ink</td>
+       <td>Ink supply</td>
+</tr>
+<tr>
+       <td>opc</td>
+       <td>Photo conductor</td>
+</tr>
+<tr>
+       <td>solid-wax</td>
+       <td>Wax supply</td>
+</tr>
+<tr>
+       <td>staples</td>
+       <td>Staple supply</td>
+</tr>
+<tr>
+       <td>toner</td>
+       <td>Toner supply</td>
+</tr>
+<tr>
+       <td>transfer-unit</td>
+       <td>Transfer unit</td>
+</tr>
+<tr>
+       <td>waste-ink</td>
+       <td>Waste ink tank</td>
+</tr>
+<tr>
+       <td>waste-toner</td>
+       <td>Waste toner tank</td>
+</tr>
+<tr>
+       <td>waste-wax</td>
+       <td>Waste wax tank</td>
+</tr>
+</tbody>
+</table></div>
+
+<br>
+
+<div class='table'><table width='80%' summary='Table 2: Standard State Keywords'>
+<caption>Table 2: <a name='TABLE2'>Standard State Keywords</a></caption>
+<thead>
+<tr>
+       <th>Keyword</th>
+       <th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+       <td>connecting-to-device</td>
+       <td>Connecting to printer but not printing yet.</td>
+</tr>
+<tr>
+       <td>cover-open</td>
+       <td>The printer's cover is open.</td>
+</tr>
+<tr>
+       <td>input-tray-missing</td>
+       <td>The paper tray is missing.</td>
+</tr>
+<tr>
+       <td>marker-supply-empty</td>
+       <td>The printer is out of ink.</td>
+</tr>
+<tr>
+       <td>marker-supply-low</td>
+       <td>The printer is almost out of ink.</td>
+</tr>
+<tr>
+       <td>marker-waste-almost-full</td>
+       <td>The printer's waste bin is almost full.</td>
+</tr>
+<tr>
+       <td>marker-waste-full</td>
+       <td>The printer's waste bin is full.</td>
+</tr>
+<tr>
+       <td>media-empty</td>
+       <td>The paper tray (any paper tray) is empty.</td>
+</tr>
+<tr>
+       <td>media-jam</td>
+       <td>There is a paper jam.</td>
+</tr>
+<tr>
+       <td>media-low</td>
+       <td>The paper tray (any paper tray) is almost empty.</td>
+</tr>
+<tr>
+       <td>media-needed</td>
+       <td>The paper tray needs to be filled (for a job that is printing).</td>
+</tr>
+<tr>
+       <td>paused</td>
+       <td>Stop the printer.</td>
+</tr>
+<tr>
+       <td>timed-out</td>
+       <td>Unable to connect to printer.</td>
+</tr>
+<tr>
+       <td>toner-empty</td>
+       <td>The printer is out of toner.</td>
+</tr>
+<tr>
+       <td>toner-low</td>
+       <td>The printer is low on toner.</td>
+</tr>
+</tbody>
+</table></div>
+
+
+<h4><a name="ATTR_STRINGS">Reporting Attribute String Values</a></h4>
+
+<p>When reporting string values using "ATTR:" messages, a filter or backend must take special care to appropriately quote those values. The scheduler uses the CUPS option parsing code for attributes, so the general syntax is:</p>
+
+<pre class="example">
+name=simple
+name=simple,simple,...
+name='complex value'
+name="complex value"
+name='"complex value"','"complex value"',...
+</pre>
+
+<p>Simple values are strings that do not contain spaces, quotes, backslashes, or the comma and can be placed verbatim in the "ATTR:" message, for example:</p>
+
+<pre class="example">
+int levels[4] = { 40, 50, 60, 70 }; /* CMYK */
+
+fputs("ATTR: marker-colors=#00FFFF,#FF00FF,#FFFF00,#000000\n", stderr);
+fputs("ATTR: marker-high-levels=100,100,100,100\n", stderr);
+fprintf(stderr, "ATTR: marker-levels=%d,%d,%d,%d\n", levels[0], levels[1],
+        levels[2], levels[3], levels[4]);
+fputs("ATTR: marker-low-levels=5,5,5,5\n", stderr);
+fputs("ATTR: marker-types=toner,toner,toner,toner\n", stderr);
+</pre>
+
+<p>Complex values that contains spaces, quotes, backslashes, or the comma must be quoted. For a single value a single set of quotes is sufficient:</p>
+
+<pre class="example">
+fputs("ATTR: marker-message='Levels shown are approximate.'\n", stderr);
+</pre>
+
+<p>When multiple values are reported, each value must be enclosed by a set of single and double quotes:</p>
+
+<pre class="example">
+fputs("ATTR: marker-names='\"Cyan Toner\"','\"Magenta Toner\"',"
+      "'\"Yellow Toner\"','\"Black Toner\"'\n", stderr);
+</pre>
+
+<p>The IPP backend includes a <var>quote_string</var> function that may be used to properly quote a complex value in an "ATTR:" message:</p>
+
+<pre class="example">
+static const char *                     /* O - Quoted string */
+quote_string(const char *s,             /* I - String */
+             char       *q,             /* I - Quoted string buffer */
+             size_t     qsize)          /* I - Size of quoted string buffer */
+{
+  char  *qptr,                          /* Pointer into string buffer */
+        *qend;                          /* End of string buffer */
+
+
+  qptr = q;
+  qend = q + qsize - 5;
+
+  if (qend &lt; q)
+  {
+    *q = '\0';
+    return (q);
+  }
+
+  *qptr++ = '\'';
+  *qptr++ = '\"';
+
+  while (*s && qptr &lt; qend)
+  {
+    if (*s == '\\' || *s == '\"' || *s == '\'')
+    {
+      if (qptr &lt; (qend - 4))
+      {
+        *qptr++ = '\\';
+        *qptr++ = '\\';
+        *qptr++ = '\\';
+      }
+      else
+        break;
+    }
+
+    *qptr++ = *s++;
+  }
+
+  *qptr++ = '\"';
+  *qptr++ = '\'';
+  *qptr   = '\0';
+
+  return (q);
+}
+</pre>
+
+
+<h4><a name="MANAGING_STATE">Managing Printer State in a Filter</a></h4>
+
+<p>Filters are responsible for managing the state keywords they set using
+"STATE:" messages. Typically you will update <em>all</em> of the keywords that
+are used by the filter at startup, for example:</p>
+
+<pre class="example">
+if (foo_condition != 0)
+  fputs("STATE: +com.example.foo\n", stderr);
+else
+  fputs("STATE: -com.example.foo\n", stderr);
+
+if (bar_condition != 0)
+  fputs("STATE: +com.example.bar\n", stderr);
+else
+  fputs("STATE: -com.example.bar\n", stderr);
+</pre>
+
+<p>Then as conditions change, your filter sends "STATE: +keyword" or "STATE:
+-keyword" messages as necessary to set or clear the corresponding keyword,
+respectively.</p>
+
+<p>State keywords are often used to notify the user of issues that span across
+jobs, for example "media-empty-warning" that indicates one or more paper trays
+are empty. These keywords should not be cleared unless the corresponding issue
+no longer exists.</p>
+
+<p>Filters should clear job-related keywords on startup and exit so that they
+do not remain set between jobs.  For example, "connecting-to-device" is a job
+sub-state and not an issue that applies when a job is not printing.</p>
+
+<blockquote><b>Note:</b>
+
+<p>"STATE:" messages often provide visible alerts to the user. For example,
+on macOS setting a printer-state-reason value with an "-error" or
+"-warning" suffix will cause the printer's dock item to bounce if the
+corresponding reason is localized with a cupsIPPReason keyword in the
+printer's PPD file.</p>
+
+<p>When providing a vendor-prefixed keyword, <em>always</em> provide the
+corresponding standard keyword (if any) to allow clients to respond to the
+condition correctly. For example, if you provide a vendor-prefixed keyword
+for a low cyan ink condition ("com.example.cyan-ink-low") you must also set the
+"marker-supply-low-warning" keyword. In such cases you should also refrain
+from localizing the vendor-prefixed keyword in the PPD file - otherwise both
+the generic and vendor-specific keyword will be shown in the user
+interface.</p>
+
+</blockquote>
+
+<h4><a name="REPORTING_SUPPLIES">Reporting Supply Levels</a></h4>
+
+<p>CUPS tracks several "marker-*" attributes for ink/toner supply level
+reporting. These attributes allow applications to display the current supply
+levels for a printer without printer-specific software. <a href="#TABLE3">Table 3</a> lists the marker attributes and what they represent.</p>
+
+<p>Filters set marker attributes by sending "ATTR:" messages to stderr. For
+example, a filter supporting an inkjet printer with black and tri-color ink
+cartridges would use the following to initialize the supply attributes:</p>
+
+<pre class="example">
+fputs("ATTR: marker-colors=#000000,#00FFFF#FF00FF#FFFF00\n", stderr);
+fputs("ATTR: marker-low-levels=5,10\n", stderr);
+fputs("ATTR: marker-names=Black,Tri-Color\n", stderr);
+fputs("ATTR: marker-types=ink,ink\n", stderr);
+</pre>
+
+<p>Then periodically the filter queries the printer for its current supply
+levels and updates them with a separate "ATTR:" message:</p>
+
+<pre class="example">
+int black_level, tri_level;
+...
+fprintf(stderr, "ATTR: marker-levels=%d,%d\n", black_level, tri_level);
+</pre>
+
+<div class='table'><table width='80%' summary='Table 3: Supply Level Attributes'>
+<caption>Table 3: <a name='TABLE3'>Supply Level Attributes</a></caption>
+<thead>
+<tr>
+       <th>Attribute</th>
+       <th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+       <td>marker-colors</td>
+       <td>A list of comma-separated colors; each color is either "none" or one or
+       more hex-encoded sRGB colors of the form "#RRGGBB".</td>
+</tr>
+<tr>
+       <td>marker-high-levels</td>
+       <td>A list of comma-separated "almost full" level values from 0 to 100; a
+       value of 100 should be used for supplies that are consumed/emptied like ink
+       cartridges.</td>
+</tr>
+<tr>
+       <td>marker-levels</td>
+       <td>A list of comma-separated level values for each supply. A value of -1
+       indicates the level is unavailable, -2 indicates unknown, and -3 indicates
+       the level is unknown but has not yet reached capacity. Values from 0 to 100
+       indicate the corresponding percentage.</td>
+</tr>
+<tr>
+       <td>marker-low-levels</td>
+       <td>A list of comma-separated "almost empty" level values from 0 to 100; a
+       value of 0 should be used for supplies that are filled like waste ink
+       tanks.</td>
+</tr>
+<tr>
+       <td>marker-message</td>
+       <td>A human-readable supply status message for the user like "12 pages of
+       ink remaining."</td>
+</tr>
+<tr>
+       <td>marker-names</td>
+       <td>A list of comma-separated supply names like "Cyan Ink", "Fuser",
+       etc.</td>
+</tr>
+<tr>
+       <td>marker-types</td>
+       <td>A list of comma-separated supply types; the types are listed in
+       <a href="#TABLE1">Table 1</a>.</td>
+</tr>
+</tbody>
+</table></div>
+
+<h3><a name="COMMUNICATING_BACKEND">Communicating with the Backend</a></h3>
 
 <p>Filters can communicate with the backend via the
 <a href="#cupsBackChannelRead"><code>cupsBackChannelRead</code></a> and
 <a href="#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest</code></a>
-functions. The 
+functions. The
 <a href="#cupsBackChannelRead"><code>cupsBackChannelRead</code></a> function
 reads data that has been sent back from the device and is typically used to
 obtain status and configuration information. For example, the following code
@@ -609,7 +1114,11 @@ ssize_t bytes;
 bytes = cupsBackChannelRead(buffer, sizeof(buffer), 0.0);
 </pre>
 
-The
+<p>Filters can also use <code>select()</code> or <code>poll()</code> on the
+back-channel file descriptor (3 or <code>CUPS_BC_FD</code>) to read data only
+when it is available.</p>
+
+<p>The
 <a href="#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest</code></a>
 function allows you to get out-of-band status information and do synchronization
 with the device. For example, the following code gets the current IEEE-1284
@@ -622,19 +1131,54 @@ char data[2049];
 int datalen;
 <a href="#cups_sc_status_t">cups_sc_status_t</a> status;
 
-/* Tell cupsSideChannelDoRequest() how big our buffer is, less 1 byte for nul-termination... */
+/* Tell cupsSideChannelDoRequest() how big our buffer is, less 1 byte for
+   nul-termination... */
 datalen = sizeof(data) - 1;
 
 /* Get the IEEE-1284 device ID, waiting for up to 1 second */
 status = <a href="#cupsSideChannelDoRequest">cupsSideChannelDoRequest</a>(CUPS_SC_CMD_GET_DEVICE_ID, data, &amp;datalen, 1.0);
 
 /* Use the returned value if OK was returned and the length is non-zero */
-if (status == CUPS_SC_STATUS_OK && datalen > 0)
+if (status == CUPS_SC_STATUS_OK &amp;&amp; datalen > 0)
   data[datalen] = '\0';
 else
   data[0] = '\0';
 </pre>
 
+<h4><a name="DRAIN_OUTPUT">Forcing All Output to a Printer</a></h4>
+
+<p>The
+<a href="#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest</code></a>
+function allows you to tell the backend to send all pending data to the printer.
+This is most often needed when sending query commands to the printer. For example:</p>
+
+<pre class="example">
+#include &lt;cups/cups.h&gt;
+#include &lt;cups/sidechannel.h&gt;
+
+char data[1024];
+int datalen = sizeof(data);
+<a href="#cups_sc_status_t">cups_sc_status_t</a> status;
+
+/* Flush pending output to stdout */
+fflush(stdout);
+
+/* Drain output to backend, waiting for up to 30 seconds */
+status = <a href="#cupsSideChannelDoRequest">cupsSideChannelDoRequest</a>(CUPS_SC_CMD_DRAIN_OUTPUT, data, &amp;datalen, 30.0);
+
+/* Read the response if the output was sent */
+if (status == CUPS_SC_STATUS_OK)
+{
+  ssize_t bytes;
+
+  /* Wait up to 10.0 seconds for back-channel data */
+  bytes = cupsBackChannelRead(data, sizeof(data), 10.0);
+  /* do something with the data from the printer */
+}
+</pre>
+
+<h3><a name="COMMUNICATING_FILTER">Communicating with Filters</a></h3>
+
 <p>Backends communicate with filters using the reciprocal functions
 <a href="#cupsBackChannelWrite"><code>cupsBackChannelWrite</code></a>,
 <a href="#cupsSideChannelRead"><code>cupsSideChannelRead</code></a>, and
@@ -647,6 +1191,9 @@ recommend writing back-channel data using a timeout of 1.0 seconds:</p>
 char buffer[8192];
 ssize_t bytes;
 
+/* Obtain data from printer/device */
+...
+
 /* Use a timeout of 1.0 seconds to give filters a chance to read */
 cupsBackChannelWrite(buffer, bytes, 1.0);
 </pre>
@@ -657,10 +1204,7 @@ Backends can either poll for commands using a <code>timeout</code> of 0.0, wait
 indefinitely for commands using a <code>timeout</code> of -1.0 (probably in a
 separate thread for that purpose), or use <code>select</code> or
 <code>poll</code> on the <code>CUPS_SC_FD</code> file descriptor (4) to handle
-input and output on several file descriptors at the same time. Backends can pass
-<code>NULL</code> for the <code>data</code> and <code>datalen</code> parameters
-since none of the commands sent by upstream filters contain any data at this
-time.</p>
+input and output on several file descriptors at the same time.</p>
 
 <p>Once a command is processed, the backend uses the
 <a href="#cupsSideChannelWrite"><code>cupsSideChannelWrite</code></a> function
@@ -672,16 +1216,15 @@ side-channel command and respond to it:</p>
 
 <a href="#cups_sc_command_t">cups_sc_command_t</a> command;
 <a href="#cups_sc_status_t">cups_sc_status_t</a> status;
+char data[2048];
+int datalen = sizeof(data);
 
 /* Poll for a command... */
-if (!<a href="#cupsSideChannelRead">cupsSideChannelRead</a>(&amp;command, &amp;status, NULL, NULL, 0.0))
+if (!<a href="#cupsSideChannelRead">cupsSideChannelRead</a>(&amp;command, &amp;status, data, &amp;datalen, 0.0))
 {
-  char data[2048];
-  int datalen;
-
   switch (command)
   {
-    /* handle supported commands, file data/datalen/status with values as needed */
+    /* handle supported commands, fill data/datalen/status with values as needed */
 
     default :
         status  = CUPS_SC_STATUS_NOT_IMPLEMENTED;
@@ -702,74 +1245,74 @@ piece of information is associated with an Object Identifier (OID), and
 every printer has a <em>community</em> name associated with it. OIDs can be
 queried directly or by "walking" over a range of OIDs with a common prefix.</p>
 
-<p>The CUPS SNMP functions provide a simple API for querying network printers.
-Queries are made using a datagram socket that is created using
-<a href="#cupsSNMPOpen"><code>cupsSNMPOpen</code></a> and destroyed using
-<a href="#cupsSNMPClose"><code>cupsSNMPClose</code></a>:</p>
-
-<pre class="example">
-#include &lt;cups/snmp.h&gt;
-
-int snmp = <a href="#cupsSNMPOpen">cupsSNMPOpen</a>(AF_INET);
+<p>The two CUPS SNMP functions provide a simple API for querying network
+printers through the side-channel interface. Each accepts a string containing
+an OID like ".1.3.6.1.2.1.43.10.2.1.4.1.1" (the standard page counter OID)
+along with a timeout for the query.</p>
 
-/* do some queries */
-
-<a href="#cupsSNMPClose">cupsSNMPClose</a>(snmp);
-</pre>
-
-<p>OIDs are simple C arrays of integers, terminated by a value of -1. For
-example, the page counter OID .1.3.6.1.2.1.43.10.2.1.4.1.1 would be:</p>
+<p>The <a href="#cupsSideChannelSNMPGet"><code>cupsSideChannelSNMPGet</code></a>
+function queries a single OID and returns the value as a string in a buffer
+you supply:</p>
 
 <pre class="example">
-int page_counter_oid[] = { 1, 3, 6, 1, 2, 1, 43, 10, 2, 1, 4, 1, 1, -1 };
-</pre>
-
-<p>You send a query using
-<a href="#cupsSNMPWrite"><code>cupsSNMPWrite</code></a> and read the value back
-using <a href="#cupsSNMPRead"><code>cupsSNMPRead</code></a>. The value is read
-into a structure called <a href="#cups_snmp_t"><code>cups_snmp_t</code></a>:</p>
-
-<pre class="example">
-#include &lt;cups/snmp.h&gt;
+#include &lt;cups/sidechannel.h&gt;
 
-int page_counter_oid[] = { 1, 3, 6, 1, 2, 1, 43, 10, 2, 1, 4, 1, 1, -1 };
-http_addrlist_t *host = httpAddrGetList("myprinter", AF_UNSPEC, "161");
-int snmp = <a href="#cupsSNMPOpen">cupsSNMPOpen</a>(host->addr.addr.sa_family);
-<a href="#cups_snmp_t">cups_snmp_t</a> packet;
+char data[512];
+int datalen = sizeof(data);
 
-<a href="#cupsSNMPWrite">cupsSNMPWrite</a>(snmp, &amp;(host->addr), CUPS_SNMP_VERSION_1,
-                <a href="#cupsSNMPDefaultCommunity">cupsSNMPDefaultCommunity</a>(), CUPS_ASN1_GET_REQUEST, 1,
-                page_counter_oid);
-if (<a href="#cupsSNMPRead">cupsSNMPRead</a>(snmp, &amp;packet, 5000))
+if (<a href="#cupsSideChannelSNMPGet">cupsSideChannelSNMPGet</a>(".1.3.6.1.2.1.43.10.2.1.4.1.1", data, &amp;datalen, 5.0)
+        == CUPS_SC_STATUS_OK)
 {
   /* Do something with the value */
-  printf("Page counter is: %d\n", packet.object_value.integer);
+  printf("Page counter is: %s\n", data);
 }
 </pre>
 
-<p>The <a href="#cupsSNMPWalk"><code>cupsSNMPWalk</code></a> function allows you
-to query a whole group of OIDs, calling a function of your choice for each OID
-that is found:</p>
+<p>The
+<a href="#cupsSideChannelSNMPWalk"><code>cupsSideChannelSNMPWalk</code></a>
+function allows you to query a whole group of OIDs, calling a function of your
+choice for each OID that is found:</p>
 
 <pre class="example">
-#include &lt;cups/snmp.h&gt;
+#include &lt;cups/sidechannel.h&gt;
 
 void
-my_callback(<a href="#cups_snmp_t">cups_snmp_t</a> *packet, void *data)
+my_callback(const char *oid, const char *data, int datalen, void *context)
 {
   /* Do something with the value */
+  printf("%s=%s\n", oid, data);
 }
 
-int printer_mib_oid[] = { 1, 3, 6, 1, 2, 1, 43, -1 };
-http_addrlist_t *host = httpAddrGetList("myprinter", AF_UNSPEC, "161");
-int snmp = <a href="#cupsSNMPOpen">cupsSNMPOpen</a>(host->addr.addr.sa_family);
+...
+
 void *my_data;
 
-<a href="#cupsSNMPWalk">cupsSNMPWalk</a>(snmp, &amp;(host->addr), CUPS_SNMP_VERSION_1,
-               <a href="#cupsSNMPDefaultCommunity">cupsSNMPDefaultCommunity</a>(), printer_mib_oid, my_callback, my_data);
+<a href="#cupsSideChannelSNMPWalk">cupsSNMPSideChannelWalk</a>(".1.3.6.1.2.1.43", 5.0, my_callback, my_data);
 </pre>
+
+<h2><a name="SANDBOXING">Sandboxing on macOS</a></h2>
+
+<p>Starting with macOS 10.6, filters and backends are run inside a security "sandbox" which further limits (beyond the normal UNIX user/group permissions) what a filter or backend can do. This helps to both secure the printing system from malicious software and enforce the functional separation of components in the CUPS filter chain. What follows is a list of actions that are explicitly allowed for all filters and backends:</p>
+
+<ol>
+
+       <li>Reading of files: pursuant to normal UNIX file permissions, filters and backends can read files for the current job from the <var>/private/var/spool/cups</var> directory and other files on mounted filesystems <em>except</em> for user home directories under <var>/Users</var>.</li>
+
+       <li>Writing of files: pursuant to normal UNIX file permissions, filters and backends can read/write files to the cache directory specified by the <code>CUPS_CACHEDIR</code> environment variable, to the state directory specified by the <code>CUPS_STATEDIR</code> environment variable, to the temporary directory specified by the <code>TMPDIR</code> environment variable, and under the <var>/private/var/db</var>, <var>/private/var/folders</var>, <var>/private/var/lib</var>, <var>/private/var/mysql</var>, <var>/private/var/run</var>, <var>/private/var/spool</var> (except <var>/private/var/spool/cups</var>), <var>/Library/Application&nbsp;Support</var>, <var>/Library/Caches</var>, <var>/Library/Logs</var>, <var>/Library/Preferences</var>, <var>/Library/WebServer</var>, and <var>/Users/Shared</var> directories.</li>
+
+       <li>Execution of programs: pursuant to normal UNIX file permissions, filters and backends can execute any program not located under the <var>/Users</var> directory. Child processes inherit the sandbox and are subject to the same restrictions as the parent.</li>
+
+       <li>Bluetooth and USB: backends can access Bluetooth and USB printers through IOKit. <em>Filters cannot access Bluetooth and USB printers directly.</em></li>
+
+       <li>Network: filters and backends can access UNIX domain sockets under the <var>/private/tmp</var>, <var>/private/var/run</var>, and <var>/private/var/tmp</var> directories. Backends can also create IPv4 and IPv6 TCP (outgoing) and UDP (incoming and outgoing) socket, and bind to local source ports. <em>Filters cannot directly create IPv4 and IPv6 TCP or UDP sockets.</em></li>
+
+       <li>Notifications: filters and backends can send notifications via the Darwin <code>notify_post()</code> API.</li>
+
+</ol>
+
+<blockquote><b>Note:</b> The sandbox profile used in CUPS 2.0 still allows some actions that are not listed above - these privileges will be removed over time until the profile matches the list above.</blockquote>
 <h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.2&nbsp;</span><a name="cupsBackChannelRead">cupsBackChannelRead</a></h3>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.2/macOS 10.5&nbsp;</span><a name="cupsBackChannelRead">cupsBackChannelRead</a></h3>
 <p class="description">Read data from the backchannel.</p>
 <p class="code">
 ssize_t cupsBackChannelRead (<br>
@@ -780,22 +1323,21 @@ ssize_t cupsBackChannelRead (<br>
 <h4 class="parameters">Parameters</h4>
 <dl>
 <dt>buffer</dt>
-<dd class="description">Buffer to read</dd>
+<dd class="description">Buffer to read into</dd>
 <dt>bytes</dt>
 <dd class="description">Bytes to read</dd>
 <dt>timeout</dt>
-<dd class="description">Timeout in seconds</dd>
+<dd class="description">Timeout in seconds, typically 0.0 to poll</dd>
 </dl>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">Bytes read or -1 on error</p>
 <h4 class="discussion">Discussion</h4>
-<p class="discussion">Reads up to &quot;bytes&quot; bytes from the backchannel. The &quot;timeout&quot;
-parameter controls how many seconds to wait for the data - use
-0.0 to return immediately if there is no data, -1.0 to wait
-for data indefinitely.
+<p class="discussion">Reads up to &quot;bytes&quot; bytes from the backchannel/backend. The &quot;timeout&quot;
+parameter controls how many seconds to wait for the data - use 0.0 to
+return immediately if there is no data, -1.0 to wait for data indefinitely.
 
 </p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.2&nbsp;</span><a name="cupsBackChannelWrite">cupsBackChannelWrite</a></h3>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.2/macOS 10.5&nbsp;</span><a name="cupsBackChannelWrite">cupsBackChannelWrite</a></h3>
 <p class="description">Write data to the backchannel.</p>
 <p class="code">
 ssize_t cupsBackChannelWrite (<br>
@@ -810,18 +1352,18 @@ ssize_t cupsBackChannelWrite (<br>
 <dt>bytes</dt>
 <dd class="description">Bytes to write</dd>
 <dt>timeout</dt>
-<dd class="description">Timeout in seconds</dd>
+<dd class="description">Timeout in seconds, typically 1.0</dd>
 </dl>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">Bytes written or -1 on error</p>
 <h4 class="discussion">Discussion</h4>
-<p class="discussion">Writes &quot;bytes&quot; bytes to the backchannel. The &quot;timeout&quot; parameter
+<p class="discussion">Writes &quot;bytes&quot; bytes to the backchannel/filter. The &quot;timeout&quot; parameter
 controls how many seconds to wait for the data to be written - use
 0.0 to return immediately if the data cannot be written, -1.0 to wait
 indefinitely.
 
 </p>
-<h3 class="function"><a name="cupsBackendDeviceURI">cupsBackendDeviceURI</a></h3>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.2/macOS 10.5&nbsp;</span><a name="cupsBackendDeviceURI">cupsBackendDeviceURI</a></h3>
 <p class="description">Get the device URI for a backend.</p>
 <p class="code">
 const char *cupsBackendDeviceURI (<br>
@@ -838,218 +1380,42 @@ const char *cupsBackendDeviceURI (<br>
 <p class="discussion">The &quot;argv&quot; argument is the argv argument passed to main(). This
 function returns the device URI passed in the DEVICE_URI environment
 variable or the device URI passed in argv[0], whichever is found
-first.</p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsSNMPClose">cupsSNMPClose</a></h3>
-<p class="description">Close a SNMP socket.</p>
-<p class="code">
-void cupsSNMPClose (<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int fd<br>
-);</p>
-<h4 class="parameters">Parameters</h4>
-<dl>
-<dt>fd</dt>
-<dd class="description">SNMP socket file descriptor</dd>
-</dl>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsSNMPCopyOID">cupsSNMPCopyOID</a></h3>
-<p class="description">Copy an OID.</p>
-<p class="code">
-int *cupsSNMPCopyOID (<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int *dst,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;const int *src,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int dstsize<br>
-);</p>
-<h4 class="parameters">Parameters</h4>
-<dl>
-<dt>dst</dt>
-<dd class="description">Destination OID</dd>
-<dt>src</dt>
-<dd class="description">Source OID</dd>
-<dt>dstsize</dt>
-<dd class="description">Number of integers in dst</dd>
-</dl>
-<h4 class="returnvalue">Return Value</h4>
-<p class="description">New OID</p>
-<h4 class="discussion">Discussion</h4>
-<p class="discussion">The array pointed to by &quot;src&quot; is terminated by the value -1.
+first.
 
 </p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsSNMPDefaultCommunity">cupsSNMPDefaultCommunity</a></h3>
-<p class="description">Get the default SNMP community name.</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.4/macOS 10.6&nbsp;</span><a name="cupsBackendReport">cupsBackendReport</a></h3>
+<p class="description">Write a device line from a backend.</p>
 <p class="code">
-const char *cupsSNMPDefaultCommunity (void);</p>
-<h4 class="returnvalue">Return Value</h4>
-<p class="description">Default community name</p>
-<h4 class="discussion">Discussion</h4>
-<p class="discussion">The default community name is the first community name found in the
-snmp.conf file. If no community name is defined there, &quot;public&quot; is used.
-
-</p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsSNMPIsOID">cupsSNMPIsOID</a></h3>
-<p class="description">Test whether a SNMP response contains the specified OID.</p>
-<p class="code">
-int cupsSNMPIsOID (<br>
-&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_snmp_t">cups_snmp_t</a> *packet,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;const int *oid<br>
+void cupsBackendReport (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *device_scheme,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *device_uri,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *device_make_and_model,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *device_info,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *device_id,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *device_location<br>
 );</p>
 <h4 class="parameters">Parameters</h4>
 <dl>
-<dt>packet</dt>
-<dd class="description">Response packet</dd>
-<dt>oid</dt>
-<dd class="description">OID</dd>
+<dt>device_scheme</dt>
+<dd class="description">device-scheme string</dd>
+<dt>device_uri</dt>
+<dd class="description">device-uri string</dd>
+<dt>device_make_and_model</dt>
+<dd class="description">device-make-and-model string or <code>NULL</code></dd>
+<dt>device_info</dt>
+<dd class="description">device-info string or <code>NULL</code></dd>
+<dt>device_id</dt>
+<dd class="description">device-id string or <code>NULL</code></dd>
+<dt>device_location</dt>
+<dd class="description">device-location string or <code>NULL</code></dd>
 </dl>
-<h4 class="returnvalue">Return Value</h4>
-<p class="description">1 if equal, 0 if not equal</p>
 <h4 class="discussion">Discussion</h4>
-<p class="discussion">The array pointed to by &quot;oid&quot; is terminated by the value -1.
+<p class="discussion">This function writes a single device line to stdout for a backend.
+It handles quoting of special characters in the device-make-and-model,
+device-info, device-id, and device-location strings.
 
 </p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsSNMPIsOIDPrefixed">cupsSNMPIsOIDPrefixed</a></h3>
-<p class="description">Test whether a SNMP response uses the specified
-OID prefix.</p>
-<p class="code">
-int cupsSNMPIsOIDPrefixed (<br>
-&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_snmp_t">cups_snmp_t</a> *packet,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;const int *prefix<br>
-);</p>
-<h4 class="parameters">Parameters</h4>
-<dl>
-<dt>packet</dt>
-<dd class="description">Response packet</dd>
-<dt>prefix</dt>
-<dd class="description">OID prefix</dd>
-</dl>
-<h4 class="returnvalue">Return Value</h4>
-<p class="description">1 if prefixed, 0 if not prefixed</p>
-<h4 class="discussion">Discussion</h4>
-<p class="discussion">The array pointed to by &quot;prefix&quot; is terminated by the value -1.
-
-</p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsSNMPOpen">cupsSNMPOpen</a></h3>
-<p class="description">Open a SNMP socket.</p>
-<p class="code">
-int cupsSNMPOpen (<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int family<br>
-);</p>
-<h4 class="parameters">Parameters</h4>
-<dl>
-<dt>family</dt>
-<dd class="description">Address family - <code>AF_INET</code> or <code>AF_INET6</code></dd>
-</dl>
-<h4 class="returnvalue">Return Value</h4>
-<p class="description">SNMP socket file descriptor</p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsSNMPRead">cupsSNMPRead</a></h3>
-<p class="description">Read and parse a SNMP response.</p>
-<p class="code">
-<a href="#cups_snmp_t">cups_snmp_t</a> *cupsSNMPRead (<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int fd,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_snmp_t">cups_snmp_t</a> *packet,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int msec<br>
-);</p>
-<h4 class="parameters">Parameters</h4>
-<dl>
-<dt>fd</dt>
-<dd class="description">SNMP socket file descriptor</dd>
-<dt>packet</dt>
-<dd class="description">SNMP packet buffer</dd>
-<dt>msec</dt>
-<dd class="description">Timeout in milliseconds</dd>
-</dl>
-<h4 class="returnvalue">Return Value</h4>
-<p class="description">SNMP packet or <code>NULL</code> if none</p>
-<h4 class="discussion">Discussion</h4>
-<p class="discussion">If &quot;timeout&quot; is negative, <code>cupsSNMPRead</code> will wait for a response
-indefinitely.
-
-</p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsSNMPSetDebug">cupsSNMPSetDebug</a></h3>
-<p class="description">Enable/disable debug logging to stderr.</p>
-<p class="code">
-void cupsSNMPSetDebug (<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int level<br>
-);</p>
-<h4 class="parameters">Parameters</h4>
-<dl>
-<dt>level</dt>
-<dd class="description">1 to enable debug output, 0 otherwise</dd>
-</dl>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsSNMPWalk">cupsSNMPWalk</a></h3>
-<p class="description">Enumerate a group of OIDs.</p>
-<p class="code">
-int cupsSNMPWalk (<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int fd,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;http_addr_t *address,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int version,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;const char *community,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;const int *prefix,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int msec,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_snmp_cb_t">cups_snmp_cb_t</a> cb,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;void *data<br>
-);</p>
-<h4 class="parameters">Parameters</h4>
-<dl>
-<dt>fd</dt>
-<dd class="description">SNMP socket</dd>
-<dt>address</dt>
-<dd class="description">Address to query</dd>
-<dt>version</dt>
-<dd class="description">SNMP version</dd>
-<dt>community</dt>
-<dd class="description">Community name</dd>
-<dt>prefix</dt>
-<dd class="description">OID prefix</dd>
-<dt>msec</dt>
-<dd class="description">Timeout for each response in milliseconds</dd>
-<dt>cb</dt>
-<dd class="description">Function to call for each response</dd>
-<dt>data</dt>
-<dd class="description">User data pointer that is passed to the callback function</dd>
-</dl>
-<h4 class="returnvalue">Return Value</h4>
-<p class="description">Number of OIDs found or -1 on error</p>
-<h4 class="discussion">Discussion</h4>
-<p class="discussion">This function queries all of the OIDs with the specified OID prefix,
-calling the &quot;cb&quot; function for every response that is received.<br>
-<br>
-The array pointed to by &quot;prefix&quot; is terminated by the value -1.
-
-</p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsSNMPWrite">cupsSNMPWrite</a></h3>
-<p class="description">Send an SNMP query packet.</p>
-<p class="code">
-int cupsSNMPWrite (<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int fd,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;http_addr_t *address,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int version,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;const char *community,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_asn1_t">cups_asn1_t</a> request_type,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;const unsigned request_id,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;const int *oid<br>
-);</p>
-<h4 class="parameters">Parameters</h4>
-<dl>
-<dt>fd</dt>
-<dd class="description">SNMP socket</dd>
-<dt>address</dt>
-<dd class="description">Address to send to</dd>
-<dt>version</dt>
-<dd class="description">SNMP version</dd>
-<dt>community</dt>
-<dd class="description">Community name</dd>
-<dt>request_type</dt>
-<dd class="description">Request type</dd>
-<dt>request_id</dt>
-<dd class="description">Request ID</dd>
-<dt>oid</dt>
-<dd class="description">OID</dd>
-</dl>
-<h4 class="returnvalue">Return Value</h4>
-<p class="description">1 on success, 0 on error</p>
-<h4 class="discussion">Discussion</h4>
-<p class="discussion">The array pointed to by &quot;oid&quot; is terminated by the value -1.
-
-</p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.3&nbsp;</span><a name="cupsSideChannelDoRequest">cupsSideChannelDoRequest</a></h3>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.3/macOS 10.5&nbsp;</span><a name="cupsSideChannelDoRequest">cupsSideChannelDoRequest</a></h3>
 <p class="description">Send a side-channel command to a backend and wait for a response.</p>
 <p class="code">
 <a href="#cups_sc_status_t">cups_sc_status_t</a> cupsSideChannelDoRequest (<br>
@@ -1083,7 +1449,7 @@ pointed to by the &quot;data&quot; parameter.  cupsSideChannelDoRequest() will
 update the value to contain the number of data bytes in the buffer.
 
 </p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.3&nbsp;</span><a name="cupsSideChannelRead">cupsSideChannelRead</a></h3>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.3/macOS 10.5&nbsp;</span><a name="cupsSideChannelRead">cupsSideChannelRead</a></h3>
 <p class="description">Read a side-channel message.</p>
 <p class="code">
 int cupsSideChannelRead (<br>
@@ -1119,7 +1485,94 @@ pointed to by the &quot;data&quot; parameter.  cupsSideChannelDoRequest() will
 update the value to contain the number of data bytes in the buffer.
 
 </p>
-<h3 class="function"><span class="info">&nbsp;CUPS 1.3&nbsp;</span><a name="cupsSideChannelWrite">cupsSideChannelWrite</a></h3>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.4/macOS 10.6&nbsp;</span><a name="cupsSideChannelSNMPGet">cupsSideChannelSNMPGet</a></h3>
+<p class="description">Query a SNMP OID's value.</p>
+<p class="code">
+<a href="#cups_sc_status_t">cups_sc_status_t</a> cupsSideChannelSNMPGet (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *oid,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;char *data,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int *datalen,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;double timeout<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>oid</dt>
+<dd class="description">OID to query</dd>
+<dt>data</dt>
+<dd class="description">Buffer for OID value</dd>
+<dt>datalen</dt>
+<dd class="description">Size of OID buffer on entry, size of value on return</dd>
+<dt>timeout</dt>
+<dd class="description">Timeout in seconds</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">Query status</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">This function asks the backend to do a SNMP OID query on behalf of the
+filter, port monitor, or backend using the default community name.<br>
+<br>
+&quot;oid&quot; contains a numeric OID consisting of integers separated by periods,
+for example &quot;.1.3.6.1.2.1.43&quot;.  Symbolic names from SNMP MIBs are not
+supported and must be converted to their numeric forms.<br>
+<br>
+On input, &quot;data&quot; and &quot;datalen&quot; provide the location and size of the
+buffer to hold the OID value as a string. HEX-String (binary) values are
+converted to hexadecimal strings representing the binary data, while
+NULL-Value and unknown OID types are returned as the empty string.
+The returned &quot;datalen&quot; does not include the trailing nul.
+
+<code>CUPS_SC_STATUS_NOT_IMPLEMENTED</code> is returned by backends that do not
+support SNMP queries.  <code>CUPS_SC_STATUS_NO_RESPONSE</code> is returned when
+the printer does not respond to the SNMP query.
+
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.4/macOS 10.6&nbsp;</span><a name="cupsSideChannelSNMPWalk">cupsSideChannelSNMPWalk</a></h3>
+<p class="description">Query multiple SNMP OID values.</p>
+<p class="code">
+<a href="#cups_sc_status_t">cups_sc_status_t</a> cupsSideChannelSNMPWalk (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *oid,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;double timeout,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_sc_walk_func_t">cups_sc_walk_func_t</a> cb,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;void *context<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>oid</dt>
+<dd class="description">First numeric OID to query</dd>
+<dt>timeout</dt>
+<dd class="description">Timeout for each query in seconds</dd>
+<dt>cb</dt>
+<dd class="description">Function to call with each value</dd>
+<dt>context</dt>
+<dd class="description">Application-defined pointer to send to callback</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">Status of first query of <code>CUPS_SC_STATUS_OK</code> on success</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">This function asks the backend to do multiple SNMP OID queries on behalf
+of the filter, port monitor, or backend using the default community name.
+All OIDs under the &quot;parent&quot; OID are queried and the results are sent to
+the callback function you provide.<br>
+<br>
+&quot;oid&quot; contains a numeric OID consisting of integers separated by periods,
+for example &quot;.1.3.6.1.2.1.43&quot;.  Symbolic names from SNMP MIBs are not
+supported and must be converted to their numeric forms.<br>
+<br>
+&quot;timeout&quot; specifies the timeout for each OID query. The total amount of
+time will depend on the number of OID values found and the time required
+for each query.<br>
+<br>
+&quot;cb&quot; provides a function to call for every value that is found. &quot;context&quot;
+is an application-defined pointer that is sent to the callback function
+along with the OID and current data. The data passed to the callback is the
+same as returned by <a href="#cupsSideChannelSNMPGet"><code>cupsSideChannelSNMPGet</code></a>.
+
+<code>CUPS_SC_STATUS_NOT_IMPLEMENTED</code> is returned by backends that do not
+support SNMP queries.  <code>CUPS_SC_STATUS_NO_RESPONSE</code> is returned when
+the printer does not respond to the first SNMP query.
+
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.3/macOS 10.5&nbsp;</span><a name="cupsSideChannelWrite">cupsSideChannelWrite</a></h3>
 <p class="description">Write a side-channel message.</p>
 <p class="code">
 int cupsSideChannelWrite (<br>
@@ -1150,11 +1603,6 @@ responses to a filter, driver, or port monitor program.
 
 </p>
 <h2 class="title"><a name="TYPES">Data Types</a></h2>
-<h3 class="typedef"><a name="cups_asn1_t">cups_asn1_t</a></h3>
-<p class="description">ASN1 request/object types</p>
-<p class="code">
-typedef enum <a href="#cups_asn1_e">cups_asn1_e</a> cups_asn1_t;
-</p>
 <h3 class="typedef"><a name="cups_backend_t">cups_backend_t</a></h3>
 <p class="description">Backend exit codes</p>
 <p class="code">
@@ -1170,6 +1618,11 @@ typedef enum <a href="#cups_sc_bidi_e">cups_sc_bidi_e</a> cups_sc_bidi_t;
 <p class="code">
 typedef enum <a href="#cups_sc_command_e">cups_sc_command_e</a> cups_sc_command_t;
 </p>
+<h3 class="typedef"><a name="cups_sc_connected_t">cups_sc_connected_t</a></h3>
+<p class="description">Connectivity values</p>
+<p class="code">
+typedef enum <a href="#cups_sc_connected_e">cups_sc_connected_e</a> cups_sc_connected_t;
+</p>
 <h3 class="typedef"><a name="cups_sc_state_t">cups_sc_state_t</a></h3>
 <p class="description">Printer state bits</p>
 <p class="code">
@@ -1180,138 +1633,12 @@ typedef enum <a href="#cups_sc_state_e">cups_sc_state_e</a> cups_sc_state_t;
 <p class="code">
 typedef enum <a href="#cups_sc_status_e">cups_sc_status_e</a> cups_sc_status_t;
 </p>
-<h3 class="typedef"><a name="cups_snmp_cb_t">cups_snmp_cb_t</a></h3>
-<p class="description">Prototypes...</p>
-<p class="code">
-typedef void (*cups_snmp_cb_t)(<a href="#cups_snmp_t">cups_snmp_t</a> *packet, void *data);
-</p>
-<h3 class="typedef"><a name="cups_snmp_t">cups_snmp_t</a></h3>
-<p class="description">SNMP data packet</p>
+<h3 class="typedef"><a name="cups_sc_walk_func_t">cups_sc_walk_func_t</a></h3>
+<p class="description">SNMP walk callback</p>
 <p class="code">
-typedef struct <a href="#cups_snmp_s">cups_snmp_s</a> cups_snmp_t;
+typedef void (*cups_sc_walk_func_t)(const char *oid, const char *data, int datalen, void *context);
 </p>
-<h2 class="title"><a name="STRUCTURES">Structures</a></h2>
-<h3 class="struct"><a name="cups_snmp_hexstring_s">cups_snmp_hexstring_s</a></h3>
-<p class="description">Hex-STRING value</p>
-<p class="code">struct cups_snmp_hexstring_s {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;unsigned char bytes[CUPS_SNMP_MAX_STRING];<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int num_bytes;<br>
-};</p>
-<h4 class="members">Members</h4>
-<dl>
-<dt>bytes[CUPS_SNMP_MAX_STRING] </dt>
-<dd class="description">Bytes in string</dd>
-<dt>num_bytes </dt>
-<dd class="description">Number of bytes</dd>
-</dl>
-<h3 class="struct"><a name="cups_snmp_s">cups_snmp_s</a></h3>
-<p class="description">SNMP data packet</p>
-<p class="code">struct cups_snmp_s {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;http_addr_t address;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;char community[CUPS_SNMP_MAX_STRING];<br>
-&nbsp;&nbsp;&nbsp;&nbsp;const char *error;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int error_index;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int error_status;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int object_name[CUPS_SNMP_MAX_OID];<br>
-&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_asn1_t">cups_asn1_t</a> object_type;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;union <a href="#cups_snmp_value_u">cups_snmp_value_u</a> object_value;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int request_id;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_asn1_t">cups_asn1_t</a> request_type;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int version;<br>
-};</p>
-<h4 class="members">Members</h4>
-<dl>
-<dt>address </dt>
-<dd class="description">Source address</dd>
-<dt>community[CUPS_SNMP_MAX_STRING] </dt>
-<dd class="description">Community name</dd>
-<dt>error </dt>
-<dd class="description">Encode/decode error</dd>
-<dt>error_index </dt>
-<dd class="description">error-index value</dd>
-<dt>error_status </dt>
-<dd class="description">error-status value</dd>
-<dt>object_name[CUPS_SNMP_MAX_OID] </dt>
-<dd class="description">object-name value</dd>
-<dt>object_type </dt>
-<dd class="description">object-value type</dd>
-<dt>object_value </dt>
-<dd class="description">object-value value</dd>
-<dt>request_id </dt>
-<dd class="description">request-id value</dd>
-<dt>request_type </dt>
-<dd class="description">Request type</dd>
-<dt>version </dt>
-<dd class="description">Version number</dd>
-</dl>
-<h2 class="title"><a name="UNIONS">Unions</a></h2>
-<h3 class="union"><a name="cups_snmp_value_u">cups_snmp_value_u</a></h3>
-<p class="description">Object value</p>
-<p class="code">union cups_snmp_value_u {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int boolean;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;unsigned counter;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;unsigned gauge;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;struct <a href="#cups_snmp_hexstring_s">cups_snmp_hexstring_s</a> hex_string;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int integer;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;int oid[CUPS_SNMP_MAX_OID];<br>
-&nbsp;&nbsp;&nbsp;&nbsp;char string[CUPS_SNMP_MAX_STRING];<br>
-&nbsp;&nbsp;&nbsp;&nbsp;unsigned timeticks;<br>
-};</p>
-<h4 class="members">Members</h4>
-<dl>
-<dt>boolean </dt>
-<dd class="description">Boolean value</dd>
-<dt>counter </dt>
-<dd class="description">Counter value</dd>
-<dt>gauge </dt>
-<dd class="description">Gauge value</dd>
-<dt>hex_string </dt>
-<dd class="description">Hex string value</dd>
-<dt>integer </dt>
-<dd class="description">Integer value</dd>
-<dt>oid[CUPS_SNMP_MAX_OID] </dt>
-<dd class="description">OID value</dd>
-<dt>string[CUPS_SNMP_MAX_STRING] </dt>
-<dd class="description">String value</dd>
-<dt>timeticks </dt>
-<dd class="description">Timeticks  value</dd>
-</dl>
 <h2 class="title"><a name="ENUMERATIONS">Constants</a></h2>
-<h3 class="enumeration"><a name="cups_asn1_e">cups_asn1_e</a></h3>
-<p class="description">ASN1 request/object types</p>
-<h4 class="constants">Constants</h4>
-<dl>
-<dt>CUPS_ASN1_BIT_STRING </dt>
-<dd class="description">BIT STRING</dd>
-<dt>CUPS_ASN1_BOOLEAN </dt>
-<dd class="description">BOOLEAN</dd>
-<dt>CUPS_ASN1_COUNTER </dt>
-<dd class="description">32-bit unsigned aka Counter32</dd>
-<dt>CUPS_ASN1_END_OF_CONTENTS </dt>
-<dd class="description">End-of-contents</dd>
-<dt>CUPS_ASN1_GAUGE </dt>
-<dd class="description">32-bit unsigned aka Gauge32</dd>
-<dt>CUPS_ASN1_GET_NEXT_REQUEST </dt>
-<dd class="description">GetNextRequest-PDU</dd>
-<dt>CUPS_ASN1_GET_REQUEST </dt>
-<dd class="description">GetRequest-PDU</dd>
-<dt>CUPS_ASN1_GET_RESPONSE </dt>
-<dd class="description">GetResponse-PDU</dd>
-<dt>CUPS_ASN1_HEX_STRING </dt>
-<dd class="description">Binary string aka Hex-STRING</dd>
-<dt>CUPS_ASN1_INTEGER </dt>
-<dd class="description">INTEGER or ENUMERATION</dd>
-<dt>CUPS_ASN1_NULL_VALUE </dt>
-<dd class="description">NULL VALUE</dd>
-<dt>CUPS_ASN1_OCTET_STRING </dt>
-<dd class="description">OCTET STRING</dd>
-<dt>CUPS_ASN1_OID </dt>
-<dd class="description">OBJECT IDENTIFIER</dd>
-<dt>CUPS_ASN1_SEQUENCE </dt>
-<dd class="description">SEQUENCE</dd>
-<dt>CUPS_ASN1_TIMETICKS </dt>
-<dd class="description">32-bit unsigned aka Timeticks32</dd>
-</dl>
 <h3 class="enumeration"><a name="cups_backend_e">cups_backend_e</a></h3>
 <p class="description">Backend exit codes</p>
 <h4 class="constants">Constants</h4>
@@ -1326,11 +1653,15 @@ typedef struct <a href="#cups_snmp_s">cups_snmp_s</a> cups_snmp_t;
 <dd class="description">Job failed, hold job</dd>
 <dt>CUPS_BACKEND_OK </dt>
 <dd class="description">Job completed successfully</dd>
+<dt>CUPS_BACKEND_RETRY </dt>
+<dd class="description">Job failed, retry this job later</dd>
+<dt>CUPS_BACKEND_RETRY_CURRENT </dt>
+<dd class="description">Job failed, retry this job immediately</dd>
 <dt>CUPS_BACKEND_STOP </dt>
 <dd class="description">Job failed, stop queue</dd>
 </dl>
 <h3 class="enumeration"><a name="cups_sc_bidi_e">cups_sc_bidi_e</a></h3>
-<p class="description">Bidirectional capabilities</p>
+<p class="description">Bidirectional capability values</p>
 <h4 class="constants">Constants</h4>
 <dl>
 <dt>CUPS_SC_BIDI_NOT_SUPPORTED </dt>
@@ -1346,13 +1677,28 @@ typedef struct <a href="#cups_snmp_s">cups_snmp_s</a> cups_snmp_t;
 <dd class="description">Drain all pending output</dd>
 <dt>CUPS_SC_CMD_GET_BIDI </dt>
 <dd class="description">Return bidirectional capabilities</dd>
+<dt>CUPS_SC_CMD_GET_CONNECTED <span class="info">&nbsp;CUPS 1.5/macOS 10.7&nbsp;</span></dt>
+<dd class="description">Return whether the backend is &quot;connected&quot; to the printer </dd>
 <dt>CUPS_SC_CMD_GET_DEVICE_ID </dt>
 <dd class="description">Return the IEEE-1284 device ID</dd>
 <dt>CUPS_SC_CMD_GET_STATE </dt>
 <dd class="description">Return the device state</dd>
+<dt>CUPS_SC_CMD_SNMP_GET <span class="info">&nbsp;CUPS 1.4/macOS 10.6&nbsp;</span></dt>
+<dd class="description">Query an SNMP OID </dd>
+<dt>CUPS_SC_CMD_SNMP_GET_NEXT <span class="info">&nbsp;CUPS 1.4/macOS 10.6&nbsp;</span></dt>
+<dd class="description">Query the next SNMP OID </dd>
 <dt>CUPS_SC_CMD_SOFT_RESET </dt>
 <dd class="description">Do a soft reset</dd>
 </dl>
+<h3 class="enumeration"><a name="cups_sc_connected_e">cups_sc_connected_e</a></h3>
+<p class="description">Connectivity values</p>
+<h4 class="constants">Constants</h4>
+<dl>
+<dt>CUPS_SC_CONNECTED </dt>
+<dd class="description">Backend is &quot;connected&quot; to printer</dd>
+<dt>CUPS_SC_NOT_CONNECTED </dt>
+<dd class="description">Backend is not &quot;connected&quot; to printer</dd>
+</dl>
 <h3 class="enumeration"><a name="cups_sc_state_e">cups_sc_state_e</a></h3>
 <p class="description">Printer state bits</p>
 <h4 class="constants">Constants</h4>
@@ -1370,9 +1716,9 @@ typedef struct <a href="#cups_snmp_s">cups_snmp_s</a> cups_snmp_t;
 <dt>CUPS_SC_STATE_MEDIA_LOW </dt>
 <dd class="description">Paper low condition</dd>
 <dt>CUPS_SC_STATE_OFFLINE </dt>
-<dd class="description">Device is off-line</dd>
+<dd class="description">Device is offline</dd>
 <dt>CUPS_SC_STATE_ONLINE </dt>
-<dd class="description">Device is on-line</dd>
+<dd class="description">Device is online</dd>
 </dl>
 <h3 class="enumeration"><a name="cups_sc_status_e">cups_sc_status_e</a></h3>
 <p class="description">Response status codes</p>