]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
More man page updates.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 4 Apr 2014 19:02:20 +0000 (19:02 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 4 Apr 2014 19:02:20 +0000 (19:02 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11793 a1ca3aef-8c08-0410-bb20-df032aa958be

doc/help/man-backend.html
doc/help/man-filter.html
man/backend.man
man/filter.man

index 9a682c3024d6f097e7d330b005dca6833fe24a76..0c0173e6caf6644434b0c7683617d954b8f84030 100644 (file)
 </head>
 <body>
 <h1 class="title">backend(7)</h1>
-
 <h2 class="title"><a name="NAME">Name</a></h2>
 backend - cups backend transmission interfaces
 <h2 class="title"><a name="SYNOPSIS">Synopsis</a></h2>
 <b>backend</b>
 <br>
 <b>backend</b>
-job user title num-copies options [
+<i>job</i>
+<i>user</i>
+<i>title</i>
+<i>num-copies</i>
+<i>options</i>
+[
 <i>filename</i>
 ]
-<h2 class="title"><a name="DESCRIPTION">Description</a></h2>
-Backends are a special type of <i>filter(7)</i> which is used to send print data
-to and discover different devices on the system.
-<p>Like filters, backends must be capable of reading from a filename on the
-command-line or from the standard input, copying the standard input to a
-temporary file as required by the physical interface.
-<p>The command name (argv[0]) is set to the device URI of the destination printer.
-Starting with CUPS 1.1.22, any authentication information in argv[0] is removed,
-so backend developers are urged to use the DEVICE_URI environment variable
-whenever authentication information is required. The CUPS API includes a
-<i>cupsBackendDeviceURI</i> function for retrieving the correct device URI.
-<p>Back-channel data from the device should be relayed to the job
-filters by writing to file descriptor 3. The CUPS API includes
-the <i>cupsBackChannelWrite</i> function for this purpose.
-<h2 class="title"><a name="WARNING">Warning</a></h2>
-CUPS backends are not generally design to be run directly by the user. Aside
-from the device URI issue (argv[0] and DEVICE_URI environment variable contain
-the device URI), CUPS backends also expect specific environment variables and
-file descriptors, and typically run in a user session that (on OS X) has
-additional restrictions that affect how it runs. Backends can also be installed
-with restricted permissions (0500 or 0700) that tell the scheduler to run them
-as the "root" user instead of an unprivileged user (typically "lp") on the
-system.
-<p>Unless you are a developer and know what you are doing, please do not run
-backends directly. Instead, use the <i>lp(1)</i> or <i>lpr(1)</i> programs to send
-a print job or <i>lpinfo(8)</i> program to query for available printers using the
-backend. The one exception is the SNMP backend - see <i>snmpbackend(8)</i> for
-more information.
-<h2 class="title"><a name="DEVICE_DISCOVERY">Device Discovery</a></h2>
-When run with no arguments, the backend should list the devices and schemes it
-supports or is advertising to stdout. The output consists of zero or more lines
-consisting of any of the following forms:
+<pre>
+
+<b>#include &lt;cups/cups.h></b>
+
+<b>const char *cupsBackendDeviceURI</b>(<b>char **</b><i>argv</i>);
+
+<b>void cupsBackendReport</b>(<b>const char *</b><i>device_scheme</i>,
+                       <b>const char *</b><i>device_uri</i>,
+                       <b>const char *</b><i>device_make_and_model</i>,
+                       <b>const char *</b><i>device_info</i>,
+                       <b>const char *</b><i>device_id</i>,
+                       <b>const char *</b><i>device_location</i>);
+
+<b>ssize_t cupsBackChannelWrite</b>(<b>const char *</b><i>buffer</i>,
+                             <b>size_t </b><i>bytes</i>, <b>double </b><i>timeout</i>);
 
+<b>int cupsSideChannelRead</b>(<b>cups_sc_command_t *</b><i>command</i>,
+                        <b>cups_sc_status_t *</b><i>status</i>, <b>char *</b><i>data</i>,
+                        <b>int *</b><i>datalen</i>, <b>double </b><i>timeout</i>);
+
+<b>int cupsSideChannelWrite</b>(<b>cups_sc_command_t </b><i>command</i>,
+                         <b>cups_sc_status_t </b><i>status</i>, <b>const char *</b><i>data</i>,
+                         <b>int </b><i>datalen</i>, <b>double </b><i>timeout</i>);
+</pre>
+<h2 class="title"><a name="DESCRIPTION">Description</a></h2>
+Backends are a special type of
+<a href="man-filter.html?TOPIC=Man+Pages"><b>filter</b>(7)</a>
+which is used to send print data to and discover different devices on the system.
+<p>Like filters, backends must be capable of reading from a filename on the command-line or from the standard input, copying the standard input to a temporary file as required by the physical interface.
+<p>The command name (<i>argv[0]</i>) is set to the device URI of the destination printer. Authentication information in
+<i>argv[0]</i>
+is removed, so backend developers are urged to use the
+<b>DEVICE_URI</b>
+environment variable whenever authentication information is required. The
+<b>cupsBackendDeviceURI</b>()
+function may be used to retrieve the correct device URI.
+<p>Back-channel data from the device should be relayed to the job filters using the <i>cupsBackChannelWrite</i> function.
+<p>Backends are responsible for reading side-channel requests using the
+<b>cupsSideChannelRead</b>()
+function and responding with the
+<b>cupsSideChannelWrite()</b>
+function. The
+<b>CUPS_SC_FD</b>
+constant defines the file descriptor that should be monitored for incoming requests.
+<h3><a name="DEVICE_DISCOVERY">Device Discovery</a></h3>
+When run with no arguments, the backend should list the devices and schemes it supports or is advertising to the standard output. The output consists of zero or more lines consisting of any of the following forms:
 <pre>
+
     device-class scheme "Unknown" "device-info"
     device-class device-uri "device-make-and-model" "device-info"
     device-class device-uri "device-make-and-model" "device-info" "device-id"
     device-class device-uri "device-make-and-model" "device-info" "device-id" "device-location"
 </pre>
-<p>The <i>device-class</i> field is one of the following values:
-<p style="margin-left: 5.0em; text-indent: -5.0em">direct
-<br>
-<br>
-The device-uri refers to a specific direct-access device with no options, such
-as a parallel, USB, or SCSI device.
-<p style="margin-left: 5.0em; text-indent: -5.0em">file
-<br>
-<br>
+<p>The
+<b>cupsBackendReport</b>()
+function can be used to generate these lines and handle any necessary escaping of characters in the various strings.
+<p>The
+<i>device-class</i>
+field is one of the following values:
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>direct</b>
+The device-uri refers to a specific direct-access device with no options, such as a parallel, USB, or SCSI device.
+<br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>file</b>
 The device-uri refers to a file on disk.
-<p style="margin-left: 5.0em; text-indent: -5.0em">network
-<br>
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>network</b>
 The device-uri refers to a networked device and conforms to the general form for
-network URIs.
-<p style="margin-left: 5.0em; text-indent: -5.0em">serial
-<br>
-<br>
-The device-uri refers to a serial device with configurable baud rate and other
-options. If the device-uri contains a baud value, it represents the maximum baud
-rate supported by the device.
-<p>The <i>scheme</i> field provides the URI scheme that is supported by the backend.
-Backends should use this form only when the backend supports any URI using that
-scheme. The <i>device-uri</i> field specifies the full URI to use when
-communicating with the device.
-<p>The <i>device-make-and-model</i> field specifies the make and model of the
-device, e.g. "Example Foojet 2000". If the make and model is not known, you must
-report "Unknown".
-<p>The <i>device-info</i> field specifies additional information about the device.
-Typically this includes the make and model along with the port number or network
-address, e.g. "Example Foojet 2000 USB #1".
-<p>The optional <i>device-id</i> field specifies the IEEE-1284 device ID string for
-the device, which is used to select a matching driver.
-<p>The optional <i>device-location</i> field specifies the physical location of
-the device, which is often used to pre-populate the printer-location attribute
-when adding a printer.
-<h2 class="title"><a name="PERMISSIONS">Permissions</a></h2>
-Backends without world execute permissions are run as the root user. Otherwise,
-the backend is run using an unprivileged user account, typically "lp".
-<h2 class="title"><a name="EXIT_CODES">Exit Codes</a></h2>
-The following exit codes are defined for backends; C API constants defined in
-the &lt;cups/backend.h> header file are defined in parenthesis:
-<p style="margin-left: 5.0em; text-indent: -5.0em">0 (CUPS_BACKEND_OK)
-<br>
 <br>
+network URIs.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>serial</b>
+The device-uri refers to a serial device with configurable baud rate and other options. If the device-uri contains a baud value, it represents the maximum baud rate supported by the device.
+<br>
+<p>The 
+<i>scheme</i>
+field provides the URI scheme that is supported by the backend. Backends should use this form only when the backend supports any URI using that scheme. The
+<i>device-uri</i>
+field specifies the full URI to use when communicating with the device.
+<p>The
+<i>device-make-and-model</i>
+field specifies the make and model of the device, e.g. "Example Foojet 2000". If the make and model is not known, you must report "Unknown".
+<p>The
+<i>device-info</i>
+field specifies additional information about the device. Typically this includes the make and model along with the port number or network address, e.g. "Example Foojet 2000 USB #1".
+<p>The optional
+<i>device-id</i>
+field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver.
+<p>The optional
+<i>device-location</i>
+field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer.
+<h3><a name="PERMISSIONS">Permissions</a></h3>
+Backends without world read and execute permissions are run as the root user. Otherwise, the backend is run using an unprivileged user account, typically "lp".
+<h2 class="title"><a name="EXIT_STATUS">Exit Status</a></h2>
+The following exit codes are defined for backends:
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_BACKEND_OK</b>
 The print file was successfully transmitted to the device or remote server.
-<p style="margin-left: 5.0em; text-indent: -5.0em">1 (CUPS_BACKEND_FAILED)
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_BACKEND_FAILED</b>
 <br>
-The print file was not successfully transmitted to the device or remote server.
-The scheduler will respond to this by canceling the job, retrying the job, or
-stopping the queue depending on the state of the error-policy attribute.
-<p style="margin-left: 5.0em; text-indent: -5.0em">2 (CUPS_BACKEND_AUTH_REQUIRED)
+The print file was not successfully transmitted to the device or remote server. The scheduler will respond to this by canceling the job, retrying the job, or stopping the queue depending on the state of the
 <br>
-<br>
-The print file was not successfully transmitted because valid authentication
-information is required. The scheduler will respond to this by holding the job
-and adding the "cups-held-for-authentication" keyword to the "job-reasons"
+<i>printer-error-policy</i>
 attribute.
-<p style="margin-left: 5.0em; text-indent: -5.0em">3 (CUPS_BACKEND_HOLD)
-<br>
-<br>
-The print file was not successfully transmitted because it cannot be printed at
-this time. The scheduler will respond to this by holding the job.
-<p style="margin-left: 5.0em; text-indent: -5.0em">4 (CUPS_BACKEND_STOP)
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_BACKEND_AUTH_REQUIRED</b>
+The print file was not successfully transmitted because valid authentication information is required. The scheduler will respond to this by holding the job and adding the 'cups-held-for-authentication' keyword to the "job-reasons" Job Description attribute.
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_BACKEND_HOLD</b>
+The print file was not successfully transmitted because it cannot be printed at this time. The scheduler will respond to this by holding the job.
 <br>
-The print file was not successfully transmitted because it cannot be printed at
-this time. The scheduler will respond to this by stopping the queue.
-<p style="margin-left: 5.0em; text-indent: -5.0em">5 (CUPS_BACKEND_CANCEL)
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_BACKEND_STOP</b>
+The print file was not successfully transmitted because it cannot be printed at this time. The scheduler will respond to this by stopping the queue.
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_BACKEND_CANCEL</b>
+The print file was not successfully transmitted because one or more attributes are not supported or the job was canceled at the printer. The scheduler will respond to this by canceling the job.
 <br>
-The print file was not successfully transmitted because one or more attributes
-are not supported or the job was canceled at the printer. The scheduler will
-respond to this by canceling the job.
-<p style="margin-left: 5.0em; text-indent: -5.0em">6 (CUPS_BACKEND_RETRY)
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_BACKEND_RETRY</b>
+The print file was not successfully transmitted because of a temporary issue. The scheduler will retry the job at a future time - other jobs may print before this one.
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_BACKEND_RETRY_CURRENT</b>
+The print file was not successfully transmitted because of a temporary issue. The scheduler will retry the job immediately without allowing intervening jobs.
 <br>
-The print file was not successfully transmitted because of a temporary issue.
-The scheduler will retry the job at a future time - other jobs may print before
-this one.
-<p style="margin-left: 5.0em; text-indent: -5.0em">7 (CUPS_BACKEND_RETRY_CURRENT)
-<br>
-<br>
-The print file was not successfully transmitted because of a temporary issue.
-The scheduler will retry the job immediately without allowing intervening jobs.
 <p>All other exit code values are reserved.
+<h2 class="title"><a name="ENVIRONMENT">Environment</a></h2>
+In addition to the environment variables listed in
+<a href="man-cups.html?TOPIC=Man+Pages"><b>cups</b>(1)</a>
+and
+<a href="man-filter.html?TOPIC=Man+Pages"><b>filter</b>(7),</a>
+CUPS backends can expect the following environment variable:
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>DEVICE_URI</b>
+The device URI associated with the printer.
+<br>
+<h2 class="title"><a name="FILES">Files</a></h2>
+<i>/etc/cups/cups-files.conf</i>
+<h2 class="title"><a name="NOTES">Notes</a></h2>
+CUPS backends are not generally design to be run directly by the user. Aside from the device URI issue (
+<i>argv[0]</i>
+and
+<b>DEVICE_URI</b>
+environment variable contain the device URI), CUPS backends also expect specific environment variables and file descriptors, and typically run in a user session that (on OS X) has additional restrictions that affect how it runs. Backends can also be installed with restricted permissions (0500 or 0700) that tell the scheduler to run them as the "root" user instead of an unprivileged user (typically "lp") on the system.
+<p>Unless you are a developer and know what you are doing, please do not run backends directly. Instead, use the
+<a href="man-lp.html?TOPIC=Man+Pages"><b>lp</b>(1)</a>
+or
+<a href="man-lpr.html?TOPIC=Man+Pages"><b>lpr</b>(1)</a>
+programs to send print jobs or
+<a href="man-lpinfo.html?TOPIC=Man+Pages"><b>lpinfo</b>(8)</a>
+to query for available printers using the backend. The one exception is the SNMP backend - see
+<a href="man-cups-snmp.html?TOPIC=Man+Pages"><b>cups-snmp</b>(8)</a>
+for more information.
 <h2 class="title"><a name="SEE_ALSO">See Also</a></h2>
-<i>cups-snmp(8)</i>, <i>cupsd(8)</i>, <i>cupsd.conf(5)</i>, <i>filter(7)</i>,
-<i>lpinfo(8)</i>,
-<br>
-<a href="http://localhost:631/help">http://localhost:631/help</a>
+<i>cups</i>(1),
+<i>cups-files.conf</i>(5),
+<i>cups-snmp</i>(8),
+<i>cupsd</i>(8),
+<i>filter</i>(7),
+<i>lp</i>(1),
+<i>lpinfo</i>(8),
+<i>lpr</i>(1),
+<br>
+CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright 2007-2013 by Apple Inc.
+Copyright &copy; 2007-2014 by Apple Inc.
 
 </body>
 </html>
index 4827d5ecb5665965579ac2b77381a20df50ddb49..a930d9267c86ac22f90f6c348c0bbba1eb6f1ac1 100644 (file)
 filter - cups file conversion filter interface
 <h2 class="title"><a name="SYNOPSIS">Synopsis</a></h2>
 <b>filter</b>
-job user title num-copies options [
+<i>job</i>
+<i>user</i>
+<i>title</i>
+<i>num-copies</i>
+<i>options</i>
+[
 <i>filename</i>
 ]
+<pre>
+
+<b>#include &lt;cups/cups.h></b>
+
+<b>ssize_t cupsBackChannelRead</b>(<b>char *</b><i>buffer</i>, <b>size_t </b><i>bytes</i>,
+                            <b>double </b><i>timeout</i>);
+
+<b>cups_sc_status_t cupsSideChannelDoRequest</b>(<b>cups_sc_command_t </b><i>command</i>,
+                                          <b>char *</b><i>data</i>, <b>int *</b><i>datalen</i>,
+                                          <b>double </b><i>timeout</i>);
+
+<b>#include &lt;cups/ppd.h></b>
+
+<b>const char *cupsGetOption</b>(<b>const char *</b><i>name</i>, <b>int </b><i>num_options</i>,
+                 <b>cups_option_t *</b><i>options</i>);
+
+<b>int cupsMarkOptions</b>(<b>ppd_file_t *</b><i>ppd</i>, <b>int </b><i>num_options</i>,
+                    <b>cups_option_t *</b><i>options</i>);
+
+<b>int cupsParseOptions</b>(<b>const char *</b><i>arg</i>, <b>int </b><i>num_options</i>,
+                     <b>cups_option_t **</b><i>options</i>);
+
+<b>ppd_choice_t *ppdFindMarkedChoice</b>(<b>ppd_file_t *</b><i>ppd</i>, <b>const char *</b><i>keyword</i>);
+
+<b>void ppdMarkDefaults</b>(<b>ppd_file_t *</b><i>ppd</i>);
+
+<b>ppd_file_t *ppdOpenFile</b>(<b>const char *</b><i>filename</i>);
+</pre>
 <h2 class="title"><a name="DESCRIPTION">Description</a></h2>
-The CUPS filter interface provides a standard method for adding support for
-new document types to CUPS. Each filter is capable of converting from one
-or more input formats to another format that can either be printed directly
-or piped into another filter to get it to a printable format.
-<p>Filters <b>must</b> be capable of reading from a filename on the command-line
-or from the standard input, copying the standard input to a temporary
-file as required by the file format. All output <b>must</b> be sent to the
-standard output.
-<p>The command name (argv[0]) is set to the name of the destination printer but is
-also available in the PRINTER environment variable.
-<h2 class="title"><a name="WARNING">Warning</a></h2>
-CUPS filters are not meant to be run directly by the user. Aside from the legacy
-System V interface issues (argv[0] is the printer name), CUPS filters also
-expect specific environment variables and file descriptors, and typically run in
-a user session that (on OS X) has additional restrictions that affect how it
-runs. Unless you are a developer and know what you are doing, please do not run
-filters directly. Instead, use the <i>cupsfilter(8)</i> program to use the
-appropriate filters to do the conversions you need.
-<h2 class="title"><a name="OPTIONS">Options</a></h2>
-Options passed on the command-line typically do not include the default choices
-the printer's PPD file. In addition, some options may be specified in multiple
-ways - "landscape" is a synonym for "orientation-requested=4", "media" is a
-synonym for "PageSize", "PageRegion", "InputSlot", and "MediaType", and "sides"
-is a synonym for the various "Duplex" options. Non-raster filters <b>must</b>
-support both explicit and implicit specification of PPD options - use the
-ppdMarkDefaults and cupsMarkOptions functions in the CUPS library to use the
-correct mapping, and ppdFindMarkedChoice to get the user-selected choice.
-<p>Raster filters should use option choices set through the raster page header, as
-those reflect the options in effect for a given page. Options specified on the
-command-line determine the default values for the entire job, which can be
-overridden on a per-page basis.
+The CUPS filter interface provides a standard method for adding support for new document types or printers to CUPS.
+Each filter is capable of converting from one or more input formats to another format that can either be printed directly or piped into another filter to get it to a printable format.
+<p>Filters <b>MUST</b> be capable of reading from a filename on the command-line or from the standard input, copying the standard input to a temporary file as required by the file format.
+All output <b>MUST</b> be sent to the standard output.
+Filters <b>MUST NOT</b> attempt to communicate directly with the printer, other processes, or other services.
+<p>The command name (<i>argv[0]</i>) is set to the name of the destination printer but is also available in the <b>PRINTER</b><i> environment variable.
+</i><h2 class="title"><a name="OPTIONS">Options</a></h2>
+Options are passed in <i>argv[5]</i> and are encoded from the corresponding IPP attributes used when the job was submitted. Use the
+<b>cupsParseOptions</b>()
+function to load the options into a <b>cups_option_t</b> array and the
+<b>cupsGetOption</b>()
+function to get the value of a specific attribute.
+Be careful to look for common aliases of IPP attributes such as "lansdscape" for the IPP "orientation-requested" attribute.
+<p>Options passed on the command-line typically do not include the default choices the printer's PPD file. Use the
+<b>ppdMarkDefaults</b>()
+and
+<b>cupsMarkOptions</b>()
+functions in the CUPS library to apply the options to the PPD defaults and map any IPP attributes to the corresponding PPD options.
+Use
+<b>ppdFindMarkedChoice</b>()
+to get the user-selected choice for a PPD option. For example, a filter might use the following code to determine the current value of the <b>Duplex</b> PPD option:
+<pre>
+
+    ppd_file_t *ppd = ppdOpenFile(getenv("PPD"));
+    cups_option_t *options = NULL;
+    int num_options = cupsParseOptions(argv[5], 0, &amp;options);
+
+    ppdMarkDefaults(ppd);
+    cupsMarkOptions(ppd, num_options, options);
+
+    ppd_choice_t *choice = ppdFindMarkedChoice(ppd, "Duplex");
+</pre>
+<p>Raster filters should use option choices set through the raster page header, as those reflect the options in effect for a given page.
+Options specified on the command-line determine the default values for the entire job, which can be overridden on a per-page basis.
 <h2 class="title"><a name="LOG_MESSAGES">Log Messages</a></h2>
-Messages sent to stderr are generally logged to
-printer-state-message attribute and the current <i>ErrorLog</i>.
+Messages sent to the standard error are generally stored in the printer's "printer-state-message" attribute and the current <b>ErrorLog</b> file.
 Each line begins with a standard prefix:
-<p style="margin-left: 5.0em; text-indent: -5.0em">ALERT: message
-<br>
-<br>
-Sets the printer-state-message attribute and adds the specified
-message to the current <i>ErrorLog</i> using the "alert" log level.
-<p style="margin-left: 5.0em; text-indent: -5.0em">ATTR: attribute=value [attribute=value]
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>ALERT: </b><i>message</i>
 <br>
+Sets the "printer-state-message" attribute and adds the specified message to the current <b>ErrorLog</b> using the "alert" log level.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>ATTR: </b><i>attribute=value </i>[ <i>... attribute=value</i>]
 <br>
-Sets the named job or printer attribute(s). The following job attributes can be
-set: "job-media-progress". The following printer attributes can be set:
+Sets the named job or printer attribute(s). The following job attributes can be set: "job-media-progress". The following printer attributes can be set:
 "auth-info-required", "marker-colors", "marker-high-levels", "marker-levels",
 "marker-low-levels", "marker-message", "marker-names", "marker-types",
 "printer-alert", and "printer-alert-description".
-<p style="margin-left: 5.0em; text-indent: -5.0em">CRIT: message
-<br>
-<br>
-Sets the printer-state-message attribute and adds the specified
-message to the current <i>ErrorLog</i> using the "critical" log level.
-<p style="margin-left: 5.0em; text-indent: -5.0em">DEBUG: message
-<br>
-<br>
-Sets the printer-state-message attribute and adds the specified
-message to the current <i>ErrorLog</i> using the "debug" log level.
-<p style="margin-left: 5.0em; text-indent: -5.0em">DEBUG2: message
-<br>
-<br>
-Sets the printer-state-message attribute and adds the specified
-message to the current <i>ErrorLog</i> using the "debug2" log level.
-<p style="margin-left: 5.0em; text-indent: -5.0em">EMERG: message
-<br>
-<br>
-Sets the printer-state-message attribute and adds the specified
-message to the current <i>ErrorLog</i> using the "emergency" log level.
-<p style="margin-left: 5.0em; text-indent: -5.0em">ERROR: message
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CRIT: </b><i>message</i>
 <br>
+Sets the "printer-state-message" attribute and adds the specified message to the current <b>ErrorLog</b> using the "critical" log level.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>DEBUG: </b><i>message</i>
 <br>
-Sets the printer-state-message attribute and adds the specified
-message to the current <i>ErrorLog</i> using the "error" log level.
-<p style="margin-left: 5.0em; text-indent: -5.0em">INFO: message
+Adds the specified message to the current <b>ErrorLog</b> using the "debug" log level.
+<b>DEBUG</b> messages are never stored in the "printer-state-message" attribute.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>DEBUG2: </b><i>message</i>
 <br>
 <br>
-Sets the printer-state-message attribute. If the current <i>LogLevel</i>
-is set to "debug2", also adds the specified message to the
-current <i>ErrorLog</i> using the "info" log level.
-<p style="margin-left: 5.0em; text-indent: -5.0em">NOTICE: message
+Adds the specified message to the current <b>ErrorLog</b> using the "debug2" log level.
+<b>DEBUG2</b> messages are never stored in the "printer-state-message" attribute.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>EMERG: </b><i>message</i>
 <br>
+Sets the "printer-state-message" attribute and adds the specified message to the current <b>ErrorLog</b> using the "emergency" log level.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>ERROR:</b><i> message</i>
 <br>
-Sets the printer-state-message attribute and adds the specified
-message to the current <i>ErrorLog</i> using the "notice" log level.
-<p style="margin-left: 5.0em; text-indent: -5.0em">PAGE: page-number #-copies
+Sets the "printer-state-message" attribute and adds the specified message to the current <b>ErrorLog</b> using the "error" log level.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>INFO:</b><i> message</i>
 <br>
-<p style="margin-left: 5.0em; text-indent: -5.0em">PAGE: total #-pages
+Sets the "printer-state-message" attribute. If the current <b>LogLevel</b> is set to "debug2", also adds the specified message to the current <b>ErrorLog</b> using the "info" log level.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>NOTICE:</b><i> message</i>
 <br>
+Sets the "printer-state-message" attribute and adds the specified message to the current <b>ErrorLog</b> using the "notice" log level.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>PAGE:</b><i> page-number #-copies</i>
 <br>
-Adds an entry to the current <i>PageLog</i>. The first form adds
-#-copies to the job-media-sheets-completed attribute. The second
-form sets the job-media-sheets-completed attribute to #-pages.
-<p style="margin-left: 5.0em; text-indent: -5.0em">PPD: Keyword=Value ... KeywordN=Value
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>PAGE:</b><i> total #-pages</i>
 <br>
+Adds an entry to the current <b>PageLog</b>. The first form adds <i>#-copies</i> to the "job-media-sheets-completed" attribute. The second form sets the "job-media-sheets-completed" attribute to <i>#-pages</i>.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>PPD:</b><i> Keyword=Value</i> [ <i>... KeywordN=Value</i> ]
 <br>
-Sets the named keywords in the printer's PPD file. This is typically
-used to update default option keywords such as DefaultPageSize and
-the various installable options in the PPD file.
-<p style="margin-left: 5.0em; text-indent: -5.0em">STATE: printer-state-reason [printer-state-reason ...]
+Sets the named keywords in the printer's PPD file. This is typically used to update default option keywords such as <b>DefaultPageSize</b> and the various installable options in the PPD file.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>STATE:</b><i> printer-state-reason </i>[ <i>... printer-state-reason</i> ]
 <br>
-<p style="margin-left: 5.0em; text-indent: -5.0em">STATE: + printer-state-reason [printer-state-reason ...]
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>STATE: +</b><i> printer-state-reason </i>[ <i>... printer-state-reason</i> ]
 <br>
-<p style="margin-left: 5.0em; text-indent: -5.0em">STATE: - printer-state-reason [printer-state-reason ...]
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>STATE: -</b><i> printer-state-reason </i>[ <i>... printer-state-reason</i> ]
 <br>
+Sets, adds, or removes "printer-state-reason" keywords for the current queue. Typically this is used to indicate media, ink, and toner conditions on a printer.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>WARNING:</b><i> message</i>
 <br>
-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.
-<p style="margin-left: 5.0em; text-indent: -5.0em">WARNING: message
-<br>
-<br>
-Sets the printer-state-message attribute and adds the specified
-message to the current <i>ErrorLog</i> using the "warning" log level.
+Sets the "printer-state-message" attribute and adds the specified message to the current <b>ErrorLog</b> using the "warning" log level.
 <h2 class="title"><a name="ENVIRONMENT_VARIABLES">Environment Variables</a></h2>
 The following environment variables are defined by the CUPS
 server when executing the filter:
-<p style="margin-left: 5.0em; text-indent: -5.0em">CHARSET
-<br>
-<br>
-The default text character set, typically utf-8.
-<p style="margin-left: 5.0em; text-indent: -5.0em">CLASS
-<br>
-<br>
-When a job is submitted to a printer class, contains the name of
-the destination printer class. Otherwise this environment
-variable will not be set.
-<p style="margin-left: 5.0em; text-indent: -5.0em">CONTENT_TYPE
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CHARSET</b>
+The default text character set, typically "utf-8".
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CLASS</b>
+When a job is submitted to a printer class, contains the name of the destination printer class. Otherwise this environment variable will not be set.
 <br>
-The MIME type associated with the file (e.g.
-application/postscript).
-<p style="margin-left: 5.0em; text-indent: -5.0em">CUPS_CACHEDIR
-<br>
-<br>
-The directory where semi-persistent cache files can be found.
-<p style="margin-left: 5.0em; text-indent: -5.0em">CUPS_DATADIR
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CONTENT_TYPE</b>
+The MIME media type associated with the submitted job file, for example "application/postscript".
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_CACHEDIR</b>
+The directory where semi-persistent cache files can be found and stored.
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_DATADIR</b>
 The directory where data files can be found.
-<p style="margin-left: 5.0em; text-indent: -5.0em">CUPS_FILETYPE
-<br>
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_FILETYPE</b>
 The type of file being printed: "job-sheet" for a banner page and "document"
-for a regular print file.
-<p style="margin-left: 5.0em; text-indent: -5.0em">CUPS_MAX_MESSAGE
-<br>
-<br>
-The maximum size of a message sent to stderr, including any leading prefix and
-the trailing newline.
-<p style="margin-left: 5.0em; text-indent: -5.0em">CUPS_SERVERROOT
 <br>
+for a regular print file.
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_MAX_MESSAGE</b>
+The maximum size of a message sent to <i>stderr</i>, including any leading prefix and the trailing newline.
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>CUPS_SERVERROOT</b>
 The root directory of the server.
-<p style="margin-left: 5.0em; text-indent: -5.0em">DEVICE_URI
-<br>
-<br>
-The device-uri associated with the printer.
-<p style="margin-left: 5.0em; text-indent: -5.0em">FINAL_CONTENT_TYPE
-<br>
-<br>
-The MIME type associated with the printer (e.g.
-application/vnd.cups-postscript).
-<p style="margin-left: 5.0em; text-indent: -5.0em">LANG
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>FINAL_CONTENT_TYPE</b>
+The MIME media type associated with the output destined for the printer, for example "application/vnd.cups-postscript".
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>LANG</b>
 The default language locale (typically C or en).
-<p style="margin-left: 5.0em; text-indent: -5.0em">PATH
-<br>
 <br>
-The standard execution path for external programs that may be run by
-the filter.
-<p style="margin-left: 5.0em; text-indent: -5.0em">PPD
-<br>
-<br>
-The full pathname of the PostScript Printer Description (PPD)
-file for this printer.
-<p style="margin-left: 5.0em; text-indent: -5.0em">PRINTER
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>PATH</b>
+The standard execution path for external programs that may be run by the filter.
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>PPD</b>
+The full pathname of the PostScript Printer Description (PPD) file for this printer.
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>PRINTER</b>
 The name of the printer.
-<p style="margin-left: 5.0em; text-indent: -5.0em">RIP_CACHE
-<br>
-<br>
-The recommended amount of memory to use for Raster Image
-Processors (RIPs).
-<p style="margin-left: 5.0em; text-indent: -5.0em">SOFTWARE
-<br>
 <br>
-The name and version number of the server (typically CUPS/1.2).
-<p style="margin-left: 5.0em; text-indent: -5.0em">TZ
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>RIP_CACHE</b>
+The recommended amount of memory to use for Raster Image Processors (RIPs).
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>SOFTWARE</b>
+The name and version number of the server (typically CUPS/<i>major.minor</i>).
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>TZ</b>
 The timezone of the server.
-<p style="margin-left: 5.0em; text-indent: -5.0em">USER
 <br>
+<p style="margin-left: 5.0em; text-indent: -5.0em"><b>USER</b>
+The user executing the filter, typically "lp" or "root"; consult the <i>cups-files.conf</i> file for the current setting.
 <br>
-The user executing the filter, typically "lp" or "root"; consult the
-<i>cupsd.conf(5)</i> file for the current setting.
-<h2 class="title"><a name="COMPATIBILITY">Compatibility</a></h2>
+<h2 class="title"><a name="CONFORMING_TO">Conforming To</a></h2>
 While the filter interface is compatible with System V interface
 scripts, it will only work with the System V interface script as the
 only filter.  Typically the interface script will be provided via the
 <i>lpadmin(8)</i> command using the <i>-i</i> option.
+<h2 class="title"><a name="NOTES">Notes</a></h2>
+CUPS filters are not meant to be run directly by the user.
+Aside from the legacy System V interface issues (<i>argv[0]</i> is the printer name), CUPS filters also expect specific environment variables and file descriptors, and typically run in a user session that (on OS X) has additional restrictions that affect how it runs.
+Unless you are a developer and know what you are doing, please do not run filters directly.
+Instead, use the
+<a href="man-cupsfilter.html?TOPIC=Man+Pages"><b>cupsfilter</b>(8)</a>
+program to use the appropriate filters to do the conversions you need.
 <h2 class="title"><a name="SEE_ALSO">See Also</a></h2>
-<i>backend(7)</i>, <i>cupsd(8)</i>, <i>cupsfilter(8)</i>,
+<a href="man-backend.html?TOPIC=Man+Pages"><b>backend</b>(7),</a>
+<a href="man-cups.html?TOPIC=Man+Pages"><b>cups</b>(1),</a>
+<a href="man-cups-files.conf.html?TOPIC=Man+Pages"><b>cups-files.conf</b>(5),</a>
+<a href="man-cupsd.html?TOPIC=Man+Pages"><b>cupsd</b>(8),</a>
+<a href="man-cupsfilter.html?TOPIC=Man+Pages"><b>cupsfilter</b>(8),</a>
 <br>
-<a href="http://localhost:631/help">http://localhost:631/help</a>
+CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright 2007-2013 by Apple Inc.
+Copyright &copy; 2007-2014 by Apple Inc.
 
 </body>
 </html>
index ebdd9d66aa4b1e07e65d0d9972b5b314035eaf42..4f95b79b72b6e14c4f6afcb27339be07472b0dff 100644 (file)
 .\"
 .\" "$Id$"
 .\"
-.\"   Backend man page for CUPS.
+.\" Backend man page for CUPS.
 .\"
-.\"   Copyright 2007-2013 by Apple Inc.
-.\"   Copyright 1997-2006 by Easy Software Products.
+.\" Copyright 2007-2014 by Apple Inc.
+.\" Copyright 1997-2006 by Easy Software Products.
 .\"
-.\"   These coded instructions, statements, and computer programs are the
-.\"   property of Apple Inc. and are protected by Federal copyright
-.\"   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
-.\"   which should have been included with this file.  If this file is
-.\"   file is missing or damaged, see the license at "http://www.cups.org/".
+.\" These coded instructions, statements, and computer programs are the
+.\" property of Apple Inc. and are protected by Federal copyright
+.\" law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+.\" which should have been included with this file.  If this file is
+.\" file is missing or damaged, see the license at "http://www.cups.org/".
 .\"
-.TH backend 7 "CUPS" "23 April 2012" "Apple Inc."
-
+.TH backend 7 "CUPS" "4 April 2014" "Apple Inc."
 .SH NAME
 backend \- cups backend transmission interfaces
 .SH SYNOPSIS
 .B backend
 .br
 .B backend
-job user title num-copies options [
+.I job
+.I user
+.I title
+.I num-copies
+.I options
+[
 .I filename
 ]
+.nf
+
+\fB#include <cups/cups.h>\fR
+
+\fBconst char *cupsBackendDeviceURI\fR(\fBchar **\fIargv\fR);
+
+\fBvoid cupsBackendReport\fR(\fBconst char *\fIdevice_scheme\fR,
+                       \fBconst char *\fIdevice_uri\fR,
+                       \fBconst char *\fIdevice_make_and_model\fR,
+                       \fBconst char *\fIdevice_info\fR,
+                       \fBconst char *\fIdevice_id\fR,
+                       \fBconst char *\fIdevice_location\fR);
+
+\fBssize_t cupsBackChannelWrite\fR(\fBconst char *\fIbuffer\fR,
+                             \fBsize_t \fIbytes\fR, \fBdouble \fItimeout\fR);
+
+\fBint cupsSideChannelRead\fR(\fBcups_sc_command_t *\fIcommand\fR,
+                        \fBcups_sc_status_t *\fIstatus\fR, \fBchar *\fIdata\fR,
+                        \fBint *\fIdatalen\fR, \fBdouble \fItimeout\fR);
+
+\fBint cupsSideChannelWrite\fR(\fBcups_sc_command_t \fIcommand\fR,
+                         \fBcups_sc_status_t \fIstatus\fR, \fBconst char *\fIdata\fR,
+                         \fBint \fIdatalen\fR, \fBdouble \fItimeout\fR);
+.fi
 .SH DESCRIPTION
-Backends are a special type of \fIfilter(7)\fR which is used to send print data
-to and discover different devices on the system.
+Backends are a special type of
+.BR filter (7)
+which is used to send print data to and discover different devices on the system.
 .LP
-Like filters, backends must be capable of reading from a filename on the
-command-line or from the standard input, copying the standard input to a
-temporary file as required by the physical interface.
+Like filters, backends must be capable of reading from a filename on the command-line or from the standard input, copying the standard input to a temporary file as required by the physical interface.
 .LP
-The command name (argv[0]) is set to the device URI of the destination printer.
-Starting with CUPS 1.1.22, any authentication information in argv[0] is removed,
-so backend developers are urged to use the DEVICE_URI environment variable
-whenever authentication information is required. The CUPS API includes a
-\fIcupsBackendDeviceURI\fR function for retrieving the correct device URI.
+The command name (\fIargv[0]\fR) is set to the device URI of the destination printer. Authentication information in
+.I argv[0]
+is removed, so backend developers are urged to use the
+.B DEVICE_URI
+environment variable whenever authentication information is required. The
+.BR cupsBackendDeviceURI ()
+function may be used to retrieve the correct device URI.
 .LP
-Back-channel data from the device should be relayed to the job
-filters by writing to file descriptor 3. The CUPS API includes
-the \fIcupsBackChannelWrite\fR function for this purpose.
-.SH WARNING
-CUPS backends are not generally design to be run directly by the user. Aside
-from the device URI issue (argv[0] and DEVICE_URI environment variable contain
-the device URI), CUPS backends also expect specific environment variables and
-file descriptors, and typically run in a user session that (on OS X) has
-additional restrictions that affect how it runs. Backends can also be installed
-with restricted permissions (0500 or 0700) that tell the scheduler to run them
-as the "root" user instead of an unprivileged user (typically "lp") on the
-system.
+Back-channel data from the device should be relayed to the job filters using the \fIcupsBackChannelWrite\fR function.
 .LP
-Unless you are a developer and know what you are doing, please do not run
-backends directly. Instead, use the \fIlp(1)\fR or \fIlpr(1)\fR programs to send
-a print job or \fIlpinfo(8)\fR program to query for available printers using the
-backend. The one exception is the SNMP backend - see \fIsnmpbackend(8)\fR for
-more information.
-.SH DEVICE DISCOVERY
-When run with no arguments, the backend should list the devices and schemes it
-supports or is advertising to stdout. The output consists of zero or more lines
-consisting of any of the following forms:
-
+Backends are responsible for reading side-channel requests using the
+.BR cupsSideChannelRead ()
+function and responding with the
+.BR cupsSideChannelWrite()
+function. The
+.B CUPS_SC_FD
+constant defines the file descriptor that should be monitored for incoming requests.
+.SS DEVICE DISCOVERY
+When run with no arguments, the backend should list the devices and schemes it supports or is advertising to the standard output. The output consists of zero or more lines consisting of any of the following forms:
 .nf
+
     device-class scheme "Unknown" "device-info"
     device-class device-uri "device-make-and-model" "device-info"
     device-class device-uri "device-make-and-model" "device-info" "device-id"
     device-class device-uri "device-make-and-model" "device-info" "device-id" "device-location"
 .fi
 .LP
-The \fIdevice-class\fR field is one of the following values:
+The
+.BR cupsBackendReport ()
+function can be used to generate these lines and handle any necessary escaping of characters in the various strings.
+.LP
+The
+.I device-class
+field is one of the following values:
 .TP 5
-direct
-.br
-The device-uri refers to a specific direct-access device with no options, such
-as a parallel, USB, or SCSI device.
+.B direct
+The device-uri refers to a specific direct-access device with no options, such as a parallel, USB, or SCSI device.
 .TP 5
-file
-.br
+.B file
 The device-uri refers to a file on disk.
 .TP 5
-network
-.br
+.B network
 The device-uri refers to a networked device and conforms to the general form for
 network URIs.
 .TP 5
-serial
-.br
-The device-uri refers to a serial device with configurable baud rate and other
-options. If the device-uri contains a baud value, it represents the maximum baud
-rate supported by the device.
+.B serial
+The device-uri refers to a serial device with configurable baud rate and other options. If the device-uri contains a baud value, it represents the maximum baud rate supported by the device.
 .LP
-The \fIscheme\fR field provides the URI scheme that is supported by the backend.
-Backends should use this form only when the backend supports any URI using that
-scheme. The \fIdevice-uri\fR field specifies the full URI to use when
-communicating with the device.
+The 
+.I scheme
+field provides the URI scheme that is supported by the backend. Backends should use this form only when the backend supports any URI using that scheme. The
+.I device-uri
+field specifies the full URI to use when communicating with the device.
 .LP
-The \fIdevice-make-and-model\fR field specifies the make and model of the
-device, e.g. "Example Foojet 2000". If the make and model is not known, you must
-report "Unknown".
+The
+.I device-make-and-model
+field specifies the make and model of the device, e.g. "Example Foojet 2000". If the make and model is not known, you must report "Unknown".
 .LP
-The \fIdevice-info\fR field specifies additional information about the device.
-Typically this includes the make and model along with the port number or network
-address, e.g. "Example Foojet 2000 USB #1".
+The
+.I device-info
+field specifies additional information about the device. Typically this includes the make and model along with the port number or network address, e.g. "Example Foojet 2000 USB #1".
 .LP
-The optional \fIdevice-id\fR field specifies the IEEE-1284 device ID string for
-the device, which is used to select a matching driver.
+The optional
+.I device-id
+field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver.
 .LP
-The optional \fIdevice-location\fR field specifies the physical location of
-the device, which is often used to pre-populate the printer-location attribute
-when adding a printer.
-.SH PERMISSIONS
-Backends without world execute permissions are run as the root user. Otherwise,
-the backend is run using an unprivileged user account, typically "lp".
-.SH EXIT CODES
-The following exit codes are defined for backends; C API constants defined in
-the <cups/backend.h> header file are defined in parenthesis:
+The optional
+.I device-location
+field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer.
+.SS PERMISSIONS
+Backends without world read and execute permissions are run as the root user. Otherwise, the backend is run using an unprivileged user account, typically "lp".
+.SH EXIT STATUS
+The following exit codes are defined for backends:
 .TP 5
-0 (CUPS_BACKEND_OK)
-.br
+.B CUPS_BACKEND_OK
 The print file was successfully transmitted to the device or remote server.
 .TP 5
-1 (CUPS_BACKEND_FAILED)
+.B CUPS_BACKEND_FAILED
 .br
-The print file was not successfully transmitted to the device or remote server.
-The scheduler will respond to this by canceling the job, retrying the job, or
-stopping the queue depending on the state of the error-policy attribute.
-.TP 5
-2 (CUPS_BACKEND_AUTH_REQUIRED)
-.br
-The print file was not successfully transmitted because valid authentication
-information is required. The scheduler will respond to this by holding the job
-and adding the "cups-held-for-authentication" keyword to the "job-reasons"
+The print file was not successfully transmitted to the device or remote server. The scheduler will respond to this by canceling the job, retrying the job, or stopping the queue depending on the state of the
+.I printer-error-policy
 attribute.
 .TP 5
-3 (CUPS_BACKEND_HOLD)
-.br
-The print file was not successfully transmitted because it cannot be printed at
-this time. The scheduler will respond to this by holding the job.
+.B CUPS_BACKEND_AUTH_REQUIRED
+The print file was not successfully transmitted because valid authentication information is required. The scheduler will respond to this by holding the job and adding the 'cups-held-for-authentication' keyword to the "job-reasons" Job Description attribute.
 .TP 5
-4 (CUPS_BACKEND_STOP)
-.br
-The print file was not successfully transmitted because it cannot be printed at
-this time. The scheduler will respond to this by stopping the queue.
+.B CUPS_BACKEND_HOLD
+The print file was not successfully transmitted because it cannot be printed at this time. The scheduler will respond to this by holding the job.
 .TP 5
-5 (CUPS_BACKEND_CANCEL)
-.br
-The print file was not successfully transmitted because one or more attributes
-are not supported or the job was canceled at the printer. The scheduler will
-respond to this by canceling the job.
+.B CUPS_BACKEND_STOP
+The print file was not successfully transmitted because it cannot be printed at this time. The scheduler will respond to this by stopping the queue.
 .TP 5
-6 (CUPS_BACKEND_RETRY)
-.br
-The print file was not successfully transmitted because of a temporary issue.
-The scheduler will retry the job at a future time - other jobs may print before
-this one.
+.B CUPS_BACKEND_CANCEL
+The print file was not successfully transmitted because one or more attributes are not supported or the job was canceled at the printer. The scheduler will respond to this by canceling the job.
 .TP 5
-7 (CUPS_BACKEND_RETRY_CURRENT)
-.br
-The print file was not successfully transmitted because of a temporary issue.
-The scheduler will retry the job immediately without allowing intervening jobs.
+.B CUPS_BACKEND_RETRY
+The print file was not successfully transmitted because of a temporary issue. The scheduler will retry the job at a future time - other jobs may print before this one.
+.TP 5
+.B CUPS_BACKEND_RETRY_CURRENT
+The print file was not successfully transmitted because of a temporary issue. The scheduler will retry the job immediately without allowing intervening jobs.
 .PP
 All other exit code values are reserved.
+.SH ENVIRONMENT
+In addition to the environment variables listed in
+.BR cups (1)
+and
+.BR filter (7),
+CUPS backends can expect the following environment variable:
+.TP 5
+.B DEVICE_URI
+The device URI associated with the printer.
+.SH FILES
+.I /etc/cups/cups-files.conf
+.SH NOTES
+CUPS backends are not generally design to be run directly by the user. Aside from the device URI issue (
+.I argv[0]
+and
+.B DEVICE_URI
+environment variable contain the device URI), CUPS backends also expect specific environment variables and file descriptors, and typically run in a user session that (on OS X) has additional restrictions that affect how it runs. Backends can also be installed with restricted permissions (0500 or 0700) that tell the scheduler to run them as the "root" user instead of an unprivileged user (typically "lp") on the system.
+.LP
+Unless you are a developer and know what you are doing, please do not run backends directly. Instead, use the
+.BR lp (1)
+or
+.BR lpr (1)
+programs to send print jobs or
+.BR lpinfo (8)
+to query for available printers using the backend. The one exception is the SNMP backend - see
+.BR cups-snmp (8)
+for more information.
 .SH SEE ALSO
-\fIcups-snmp(8)\fR, \fIcupsd(8)\fR, \fIcupsd.conf(5)\fR, \fIfilter(7)\fR,
-\fIlpinfo(8)\fR,
+.IR cups (1),
+.IR cups-files.conf (5),
+.IR cups-snmp (8),
+.IR cupsd (8),
+.IR filter (7),
+.IR lp (1),
+.IR lpinfo (8),
+.IR lpr (1),
 .br
-http://localhost:631/help
+CUPS Online Help (http://localhost:631/help)
 .SH COPYRIGHT
-Copyright 2007-2013 by Apple Inc.
+Copyright \[co] 2007-2014 by Apple Inc.
 .\"
 .\" End of "$Id$".
 .\"
index 738fde8cac66251bb7bb4ce2105a8b49a222c9dd..cd82ed304557d5245ee7f382a98daa83be745cae 100644 (file)
 .\"
 .\" "$Id$"
 .\"
-.\"   filter man page for CUPS.
+.\" filter man page for CUPS.
 .\"
-.\"   Copyright 2007-2013 by Apple Inc.
-.\"   Copyright 1997-2007 by Easy Software Products.
+.\" Copyright 2007-2014 by Apple Inc.
+.\" Copyright 1997-2007 by Easy Software Products.
 .\"
-.\"   These coded instructions, statements, and computer programs are the
-.\"   property of Apple Inc. and are protected by Federal copyright
-.\"   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
-.\"   which should have been included with this file.  If this file is
-.\"   file is missing or damaged, see the license at "http://www.cups.org/".
+.\" These coded instructions, statements, and computer programs are the
+.\" property of Apple Inc. and are protected by Federal copyright
+.\" law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+.\" which should have been included with this file.  If this file is
+.\" file is missing or damaged, see the license at "http://www.cups.org/".
 .\"
-.TH filter 7 "CUPS" "18 May 2012" "Apple Inc."
+.TH filter 7 "CUPS" "4 April 2014" "Apple Inc."
 .SH NAME
 filter \- cups file conversion filter interface
 .SH SYNOPSIS
 .B filter
-job user title num-copies options [
+.I job
+.I user
+.I title
+.I num-copies
+.I options
+[
 .I filename
 ]
+.nf
+
+\fB#include <cups/cups.h>\fR
+
+\fBssize_t cupsBackChannelRead\fR(\fBchar *\fIbuffer\fR, \fBsize_t \fIbytes\fR,
+                            \fBdouble \fItimeout\fR);
+
+\fBcups_sc_status_t cupsSideChannelDoRequest\fR(\fBcups_sc_command_t \fIcommand\fR,
+                                          \fBchar *\fIdata\fR, \fBint *\fIdatalen\fR,
+                                          \fBdouble \fItimeout\fR);
+
+\fB#include <cups/ppd.h>\fR
+
+\fBconst char *cupsGetOption\fR(\fBconst char *\fIname\fR, \fBint \fInum_options\fR,
+                 \fBcups_option_t *\fIoptions\fR);
+
+\fBint cupsMarkOptions\fR(\fBppd_file_t *\fIppd\fR, \fBint \fInum_options\fR,
+                    \fBcups_option_t *\fIoptions\fR);
+
+\fBint cupsParseOptions\fR(\fBconst char *\fIarg\fR, \fBint \fInum_options\fR,
+                     \fBcups_option_t **\fIoptions\fR);
+
+\fBppd_choice_t *ppdFindMarkedChoice\fR(\fBppd_file_t *\fIppd\fR, \fBconst char *\fIkeyword\fR);
+
+\fBvoid ppdMarkDefaults\fR(\fBppd_file_t *\fIppd\fR);
+
+\fBppd_file_t *ppdOpenFile\fR(\fBconst char *\fIfilename\fR);
+.fi
 .SH DESCRIPTION
-The CUPS filter interface provides a standard method for adding support for
-new document types to CUPS. Each filter is capable of converting from one
-or more input formats to another format that can either be printed directly
-or piped into another filter to get it to a printable format.
+The CUPS filter interface provides a standard method for adding support for new document types or printers to CUPS.
+Each filter is capable of converting from one or more input formats to another format that can either be printed directly or piped into another filter to get it to a printable format.
 .LP
-Filters \fBmust\fR be capable of reading from a filename on the command-line
-or from the standard input, copying the standard input to a temporary
-file as required by the file format. All output \fBmust\fR be sent to the
-standard output.
+Filters \fBMUST\fR be capable of reading from a filename on the command-line or from the standard input, copying the standard input to a temporary file as required by the file format.
+All output \fBMUST\fR be sent to the standard output.
+Filters \fBMUST NOT\fR attempt to communicate directly with the printer, other processes, or other services.
 .LP
-The command name (argv[0]) is set to the name of the destination printer but is
-also available in the PRINTER environment variable.
-.SH WARNING
-CUPS filters are not meant to be run directly by the user. Aside from the legacy
-System V interface issues (argv[0] is the printer name), CUPS filters also
-expect specific environment variables and file descriptors, and typically run in
-a user session that (on OS X) has additional restrictions that affect how it
-runs. Unless you are a developer and know what you are doing, please do not run
-filters directly. Instead, use the \fIcupsfilter(8)\fR program to use the
-appropriate filters to do the conversions you need.
+The command name (\fIargv[0]\fR) is set to the name of the destination printer but is also available in the \fBPRINTER\fI environment variable.
 .SH OPTIONS
-Options passed on the command-line typically do not include the default choices
-the printer's PPD file. In addition, some options may be specified in multiple
-ways - "landscape" is a synonym for "orientation-requested=4", "media" is a
-synonym for "PageSize", "PageRegion", "InputSlot", and "MediaType", and "sides"
-is a synonym for the various "Duplex" options. Non-raster filters \fBmust\fR
-support both explicit and implicit specification of PPD options - use the
-ppdMarkDefaults and cupsMarkOptions functions in the CUPS library to use the
-correct mapping, and ppdFindMarkedChoice to get the user-selected choice.
+Options are passed in \fIargv[5]\fR and are encoded from the corresponding IPP attributes used when the job was submitted. Use the
+.BR cupsParseOptions ()
+function to load the options into a \fBcups_option_t\fR array and the
+.BR cupsGetOption ()
+function to get the value of a specific attribute.
+Be careful to look for common aliases of IPP attributes such as "lansdscape" for the IPP "orientation-requested" attribute.
 .LP
-Raster filters should use option choices set through the raster page header, as
-those reflect the options in effect for a given page. Options specified on the
-command-line determine the default values for the entire job, which can be
-overridden on a per-page basis.
+Options passed on the command-line typically do not include the default choices the printer's PPD file. Use the
+.BR ppdMarkDefaults ()
+and
+.BR cupsMarkOptions ()
+functions in the CUPS library to apply the options to the PPD defaults and map any IPP attributes to the corresponding PPD options.
+Use
+.BR ppdFindMarkedChoice ()
+to get the user-selected choice for a PPD option. For example, a filter might use the following code to determine the current value of the \fBDuplex\fR PPD option:
+.nf
+
+    ppd_file_t *ppd = ppdOpenFile(getenv("PPD"));
+    cups_option_t *options = NULL;
+    int num_options = cupsParseOptions(argv[5], 0, &options);
+
+    ppdMarkDefaults(ppd);
+    cupsMarkOptions(ppd, num_options, options);
+
+    ppd_choice_t *choice = ppdFindMarkedChoice(ppd, "Duplex");
+.fi
+.LP
+Raster filters should use option choices set through the raster page header, as those reflect the options in effect for a given page.
+Options specified on the command-line determine the default values for the entire job, which can be overridden on a per-page basis.
 .SH LOG MESSAGES
-Messages sent to stderr are generally logged to
-printer-state-message attribute and the current \fIErrorLog\fR.
+Messages sent to the standard error are generally stored in the printer's "printer-state-message" attribute and the current \fBErrorLog\fR file.
 Each line begins with a standard prefix:
 .TP 5
-ALERT: message
-.br
-Sets the printer-state-message attribute and adds the specified
-message to the current \fIErrorLog\fR using the "alert" log level.
+\fBALERT: \fImessage\fR
+Sets the "printer-state-message" attribute and adds the specified message to the current \fBErrorLog\fR using the "alert" log level.
 .TP 5
-ATTR: attribute=value [attribute=value]
-.br
-Sets the named job or printer attribute(s). The following job attributes can be
-set: "job-media-progress". The following printer attributes can be set:
+\fBATTR: \fIattribute=value \fR[ \fI... attribute=value\fR]
+Sets the named job or printer attribute(s). The following job attributes can be set: "job-media-progress". The following printer attributes can be set:
 "auth-info-required", "marker-colors", "marker-high-levels", "marker-levels",
 "marker-low-levels", "marker-message", "marker-names", "marker-types",
 "printer-alert", and "printer-alert-description".
 .TP 5
-CRIT: message
-.br
-Sets the printer-state-message attribute and adds the specified
-message to the current \fIErrorLog\fR using the "critical" log level.
+\fBCRIT: \fImessage\fR
+Sets the "printer-state-message" attribute and adds the specified message to the current \fBErrorLog\fR using the "critical" log level.
 .TP 5
-DEBUG: message
-.br
-Sets the printer-state-message attribute and adds the specified
-message to the current \fIErrorLog\fR using the "debug" log level.
+\fBDEBUG: \fImessage\fR
+Adds the specified message to the current \fBErrorLog\fR using the "debug" log level.
+\fBDEBUG\fR messages are never stored in the "printer-state-message" attribute.
 .TP 5
-DEBUG2: message
+\fBDEBUG2: \fImessage\fR
 .br
-Sets the printer-state-message attribute and adds the specified
-message to the current \fIErrorLog\fR using the "debug2" log level.
+Adds the specified message to the current \fBErrorLog\fR using the "debug2" log level.
+\fBDEBUG2\fR messages are never stored in the "printer-state-message" attribute.
 .TP 5
-EMERG: message
-.br
-Sets the printer-state-message attribute and adds the specified
-message to the current \fIErrorLog\fR using the "emergency" log level.
+\fBEMERG: \fImessage\fR
+Sets the "printer-state-message" attribute and adds the specified message to the current \fBErrorLog\fR using the "emergency" log level.
 .TP 5
-ERROR: message
-.br
-Sets the printer-state-message attribute and adds the specified
-message to the current \fIErrorLog\fR using the "error" log level.
+\fBERROR:\fI message\fR
+Sets the "printer-state-message" attribute and adds the specified message to the current \fBErrorLog\fR using the "error" log level.
 .TP 5
-INFO: message
-.br
-Sets the printer-state-message attribute. If the current \fILogLevel\fR
-is set to "debug2", also adds the specified message to the
-current \fIErrorLog\fR using the "info" log level.
+\fBINFO:\fI message\fR
+Sets the "printer-state-message" attribute. If the current \fBLogLevel\fR is set to "debug2", also adds the specified message to the current \fBErrorLog\fR using the "info" log level.
 .TP 5
-NOTICE: message
-.br
-Sets the printer-state-message attribute and adds the specified
-message to the current \fIErrorLog\fR using the "notice" log level.
+\fBNOTICE:\fI message\fR
+Sets the "printer-state-message" attribute and adds the specified message to the current \fBErrorLog\fR using the "notice" log level.
 .TP 5
-PAGE: page-number #-copies
+\fBPAGE:\fI page-number #-copies\fR
 .TP 5
-PAGE: total #-pages
-.br
-Adds an entry to the current \fIPageLog\fR. The first form adds
-#-copies to the job-media-sheets-completed attribute. The second
-form sets the job-media-sheets-completed attribute to #-pages.
+\fBPAGE:\fI total #-pages\fR
+Adds an entry to the current \fBPageLog\fR. The first form adds \fI#-copies\fR to the "job-media-sheets-completed" attribute. The second form sets the "job-media-sheets-completed" attribute to \fI#-pages\fR.
 .TP 5
-PPD: Keyword=Value ... KeywordN=Value
-.br
-Sets the named keywords in the printer's PPD file. This is typically
-used to update default option keywords such as DefaultPageSize and
-the various installable options in the PPD file.
+\fBPPD:\fI Keyword=Value\fR [ \fI... KeywordN=Value\fR ]
+Sets the named keywords in the printer's PPD file. This is typically used to update default option keywords such as \fBDefaultPageSize\fR and the various installable options in the PPD file.
 .TP 5
-STATE: printer-state-reason [printer-state-reason ...]
+\fBSTATE:\fI printer-state-reason \fR[ \fI... printer-state-reason\fR ]
 .TP 5
-STATE: + printer-state-reason [printer-state-reason ...]
+\fBSTATE: +\fI printer-state-reason \fR[ \fI... printer-state-reason\fR ]
 .TP 5
-STATE: - printer-state-reason [printer-state-reason ...]
-.br
-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.
+\fBSTATE: -\fI printer-state-reason \fR[ \fI... printer-state-reason\fR ]
+Sets, adds, or removes "printer-state-reason" keywords for the current queue. Typically this is used to indicate media, ink, and toner conditions on a printer.
 .TP 5
-WARNING: message
-.br
-Sets the printer-state-message attribute and adds the specified
-message to the current \fIErrorLog\fR using the "warning" log level.
+\fBWARNING:\fI message\fR
+Sets the "printer-state-message" attribute and adds the specified message to the current \fBErrorLog\fR using the "warning" log level.
 .SH ENVIRONMENT VARIABLES
 The following environment variables are defined by the CUPS
 server when executing the filter:
 .TP 5
-CHARSET
-.br
-The default text character set, typically utf-8.
+.B CHARSET
+The default text character set, typically "utf-8".
 .TP 5
-CLASS
-.br
-When a job is submitted to a printer class, contains the name of
-the destination printer class. Otherwise this environment
-variable will not be set.
+.B CLASS
+When a job is submitted to a printer class, contains the name of the destination printer class. Otherwise this environment variable will not be set.
 .TP 5
-CONTENT_TYPE
-.br
-The MIME type associated with the file (e.g.
-application/postscript).
+.B CONTENT_TYPE
+The MIME media type associated with the submitted job file, for example "application/postscript".
 .TP 5
-CUPS_CACHEDIR
-.br
-The directory where semi-persistent cache files can be found.
+.B CUPS_CACHEDIR
+The directory where semi-persistent cache files can be found and stored.
 .TP 5
-CUPS_DATADIR
-.br
+.B CUPS_DATADIR
 The directory where data files can be found.
 .TP 5
-CUPS_FILETYPE
-.br
+.B CUPS_FILETYPE
 The type of file being printed: "job-sheet" for a banner page and "document"
 for a regular print file.
 .TP 5
-CUPS_MAX_MESSAGE
-.br
-The maximum size of a message sent to stderr, including any leading prefix and
-the trailing newline.
+.B CUPS_MAX_MESSAGE
+The maximum size of a message sent to \fIstderr\fR, including any leading prefix and the trailing newline.
 .TP 5
-CUPS_SERVERROOT
-.br
+.B CUPS_SERVERROOT
 The root directory of the server.
 .TP 5
-DEVICE_URI
-.br
-The device-uri associated with the printer.
-.TP 5
-FINAL_CONTENT_TYPE
-.br
-The MIME type associated with the printer (e.g.
-application/vnd.cups-postscript).
+.B FINAL_CONTENT_TYPE
+The MIME media type associated with the output destined for the printer, for example "application/vnd.cups-postscript".
 .TP 5
-LANG
-.br
+.B LANG
 The default language locale (typically C or en).
 .TP 5
-PATH
-.br
-The standard execution path for external programs that may be run by
-the filter.
+.B PATH
+The standard execution path for external programs that may be run by the filter.
 .TP 5
-PPD
-.br
-The full pathname of the PostScript Printer Description (PPD)
-file for this printer.
+.B PPD
+The full pathname of the PostScript Printer Description (PPD) file for this printer.
 .TP 5
-PRINTER
-.br
+.B PRINTER
 The name of the printer.
 .TP 5
-RIP_CACHE
-.br
-The recommended amount of memory to use for Raster Image
-Processors (RIPs).
+.B RIP_CACHE
+The recommended amount of memory to use for Raster Image Processors (RIPs).
 .TP 5
-SOFTWARE
-.br
-The name and version number of the server (typically CUPS/1.2).
+.B SOFTWARE
+The name and version number of the server (typically CUPS/\fImajor.minor\fR).
 .TP 5
-TZ
-.br
+.B TZ
 The timezone of the server.
 .TP 5
-USER
-.br
-The user executing the filter, typically "lp" or "root"; consult the
-\fIcupsd.conf(5)\fR file for the current setting.
-.SH COMPATIBILITY
+.B USER
+The user executing the filter, typically "lp" or "root"; consult the \fIcups-files.conf\fR file for the current setting.
+.SH CONFORMING TO
 While the filter interface is compatible with System V interface
 scripts, it will only work with the System V interface script as the
 only filter.  Typically the interface script will be provided via the
 \fIlpadmin(8)\fR command using the \fI-i\fR option.
+.SH NOTES
+CUPS filters are not meant to be run directly by the user.
+Aside from the legacy System V interface issues (\fIargv[0]\fR is the printer name), CUPS filters also expect specific environment variables and file descriptors, and typically run in a user session that (on OS X) has additional restrictions that affect how it runs.
+Unless you are a developer and know what you are doing, please do not run filters directly.
+Instead, use the
+.BR cupsfilter (8)
+program to use the appropriate filters to do the conversions you need.
 .SH SEE ALSO
-\fIbackend(7)\fR, \fIcupsd(8)\fR, \fIcupsfilter(8)\fR,
+.BR backend (7),
+.BR cups (1),
+.BR cups-files.conf (5),
+.BR cupsd (8),
+.BR cupsfilter (8),
 .br
-http://localhost:631/help
+CUPS Online Help (http://localhost:631/help)
 .SH COPYRIGHT
-Copyright 2007-2013 by Apple Inc.
+Copyright \[co] 2007-2014 by Apple Inc.
 .\"
 .\" End of "$Id$".
 .\"