1<!DOCTYPE HTML> 2<html> 3<!-- SECTION: Man Pages --> 4<head> 5 <link rel="stylesheet" type="text/css" href="/cups-printable.css"> 6 <title>backend(7)</title> 7</head> 8<body> 9<h1 class="title">backend(7)</h1> 10<h2 class="title"><a name="NAME">Name</a></h2> 11backend - cups backend transmission interfaces 12<h2 class="title"><a name="SYNOPSIS">Synopsis</a></h2> 13<b>backend</b> 14<br> 15<b>backend</b> 16<i>job</i> 17<i>user</i> 18<i>title</i> 19<i>num-copies</i> 20<i>options</i> 21[ 22<i>filename</i> 23] 24<pre class="man"> 25 26<b>#include <cups/cups.h></b> 27 28<b>const char *cupsBackendDeviceURI</b>(<b>char **</b><i>argv</i>); 29 30<b>void cupsBackendReport</b>(<b>const char *</b><i>device_scheme</i>, 31 <b>const char *</b><i>device_uri</i>, 32 <b>const char *</b><i>device_make_and_model</i>, 33 <b>const char *</b><i>device_info</i>, 34 <b>const char *</b><i>device_id</i>, 35 <b>const char *</b><i>device_location</i>); 36 37<b>ssize_t cupsBackChannelWrite</b>(<b>const char *</b><i>buffer</i>, 38 <b>size_t </b><i>bytes</i>, <b>double </b><i>timeout</i>); 39 40<b>int cupsSideChannelRead</b>(<b>cups_sc_command_t *</b><i>command</i>, 41 <b>cups_sc_status_t *</b><i>status</i>, <b>char *</b><i>data</i>, 42 <b>int *</b><i>datalen</i>, <b>double </b><i>timeout</i>); 43 44<b>int cupsSideChannelWrite</b>(<b>cups_sc_command_t </b><i>command</i>, 45 <b>cups_sc_status_t </b><i>status</i>, <b>const char *</b><i>data</i>, 46 <b>int </b><i>datalen</i>, <b>double </b><i>timeout</i>); 47</pre> 48<h2 class="title"><a name="DESCRIPTION">Description</a></h2> 49Backends are a special type of 50<a href="man-filter.html?TOPIC=Man+Pages"><b>filter</b>(7)</a> 51which is used to send print data to and discover different devices on the system. 52<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. 53<p>The command name (<i>argv[0]</i>) is set to the device URI of the destination printer. Authentication information in 54<i>argv[0]</i> 55is removed, so backend developers are urged to use the 56<b>DEVICE_URI</b> 57environment variable whenever authentication information is required. The 58<b>cupsBackendDeviceURI</b>() 59function may be used to retrieve the correct device URI. 60<p>Back-channel data from the device should be relayed to the job filters using the <i>cupsBackChannelWrite</i> function. 61<p>Backends are responsible for reading side-channel requests using the 62<b>cupsSideChannelRead</b>() 63function and responding with the 64<b>cupsSideChannelWrite()</b> 65function. The 66<b>CUPS_SC_FD</b> 67constant defines the file descriptor that should be monitored for incoming requests. 68<h3><a name="DEVICE_DISCOVERY">Device Discovery</a></h3> 69When 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: 70<pre class="man"> 71 72 device-class scheme "Unknown" "device-info" 73 device-class device-uri "device-make-and-model" "device-info" 74 device-class device-uri "device-make-and-model" "device-info" "device-id" 75 device-class device-uri "device-make-and-model" "device-info" "device-id" "device-location" 76</pre> 77<p>The 78<b>cupsBackendReport</b>() 79function can be used to generate these lines and handle any necessary escaping of characters in the various strings. 80<p>The 81<i>device-class</i> 82field is one of the following values: 83<dl class="man"> 84<dt><b>direct</b> 85<dd style="margin-left: 5.0em">The device-uri refers to a specific direct-access device with no options, such as a parallel, USB, or SCSI device. 86<dt><b>file</b> 87<dd style="margin-left: 5.0em">The device-uri refers to a file on disk. 88<dt><b>network</b> 89<dd style="margin-left: 5.0em">The device-uri refers to a networked device and conforms to the general form for 90network URIs. 91<dt><b>serial</b> 92<dd style="margin-left: 5.0em">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. 93</dl> 94<p>The 95<i>scheme</i> 96field 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 97<i>device-uri</i> 98field specifies the full URI to use when communicating with the device. 99<p>The 100<i>device-make-and-model</i> 101field 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". 102<p>The 103<i>device-info</i> 104field 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". 105<p>The optional 106<i>device-id</i> 107field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver. 108<p>The optional 109<i>device-location</i> 110field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer. 111<h3><a name="PERMISSIONS">Permissions</a></h3> 112Backends without world read and execute permissions are run as the root user. Otherwise, the backend is run using an unprivileged user account, typically "lp". 113<h2 class="title"><a name="EXIT_STATUS">Exit Status</a></h2> 114The following exit codes are defined for backends: 115<dl class="man"> 116<dt><b>CUPS_BACKEND_OK</b> 117<dd style="margin-left: 5.0em">The print file was successfully transmitted to the device or remote server. 118<dt><b>CUPS_BACKEND_FAILED</b> 119<dd style="margin-left: 5.0em"><br> 120The 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 121<i>printer-error-policy</i> 122attribute. 123<dt><b>CUPS_BACKEND_AUTH_REQUIRED</b> 124<dd style="margin-left: 5.0em">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. 125<dt><b>CUPS_BACKEND_HOLD</b> 126<dd style="margin-left: 5.0em">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. 127<dt><b>CUPS_BACKEND_STOP</b> 128<dd style="margin-left: 5.0em">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. 129<dt><b>CUPS_BACKEND_CANCEL</b> 130<dd style="margin-left: 5.0em">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. 131<dt><b>CUPS_BACKEND_RETRY</b> 132<dd style="margin-left: 5.0em">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. 133<dt><b>CUPS_BACKEND_RETRY_CURRENT</b> 134<dd style="margin-left: 5.0em">The print file was not successfully transmitted because of a temporary issue. The scheduler will retry the job immediately without allowing intervening jobs. 135</dl> 136<p>All other exit code values are reserved. 137<h2 class="title"><a name="ENVIRONMENT">Environment</a></h2> 138In addition to the environment variables listed in 139<a href="man-cups.html?TOPIC=Man+Pages"><b>cups</b>(1)</a> 140and 141<a href="man-filter.html?TOPIC=Man+Pages"><b>filter</b>(7),</a> 142CUPS backends can expect the following environment variable: 143<dl class="man"> 144<dt><b>DEVICE_URI</b> 145<dd style="margin-left: 5.0em">The device URI associated with the printer. 146</dl> 147<h2 class="title"><a name="FILES">Files</a></h2> 148<i>/etc/cups/cups-files.conf</i> 149<h2 class="title"><a name="NOTES">Notes</a></h2> 150CUPS backends are not generally design to be run directly by the user. Aside from the device URI issue ( 151<i>argv[0]</i> 152and 153<b>DEVICE_URI</b> 154environment 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. 155<p>Unless you are a developer and know what you are doing, please do not run backends directly. Instead, use the 156<a href="man-lp.html?TOPIC=Man+Pages"><b>lp</b>(1)</a> 157or 158<a href="man-lpr.html?TOPIC=Man+Pages"><b>lpr</b>(1)</a> 159programs to send print jobs or 160<a href="man-lpinfo.html?TOPIC=Man+Pages"><b>lpinfo</b>(8)</a> 161to query for available printers using the backend. The one exception is the SNMP backend - see 162<a href="man-cups-snmp.html?TOPIC=Man+Pages"><b>cups-snmp</b>(8)</a> 163for more information. 164<h2 class="title"><a name="SEE_ALSO">See Also</a></h2> 165<i>cups</i>(1), 166<i>cups-files.conf</i>(5), 167<i>cups-snmp</i>(8), 168<i>cupsd</i>(8), 169<i>filter</i>(7), 170<i>lp</i>(1), 171<i>lpinfo</i>(8), 172<i>lpr</i>(1), 173<br> 174CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>) 175<h2 class="title"><a name="COPYRIGHT">Copyright</a></h2> 176Copyright © 2007-2014 by Apple Inc. 177 178</body> 179</html> 180