]> git.ipfire.org Git - thirdparty/cups.git/blame - doc/help/man-backend.html
Merge pull request #1311 from weblate/weblate-cups-cups
[thirdparty/cups.git] / doc / help / man-backend.html
CommitLineData
cc7359ae 1<!DOCTYPE html>
94436c5a 2<html>
cc7359ae 3 <head>
4e3aaa5e 4 <meta name="creator" content="mantohtml v2.0.2">
cc7359ae
MS
5 <title>backend(7)</title>
6 </head>
7 <body>
8 <h1 id="backend-7">backend(7)</h1>
9 <h2 id="backend-7.name">Name</h2>
10<p>backend - cups backend transmission interfaces
11</p>
12 <h2 id="backend-7.synopsis">Synopsis</h2>
13<p><strong>backend</strong>
c277f98c 14<br>
cc7359ae
MS
15<strong>backend</strong>
16<em>job</em>
17<em>user</em>
18<em>title</em>
19<em>num-copies</em>
20<em>options</em>
bfbd0197 21[
cc7359ae 22<em>filename</em>
c277f98c 23]
cc7359ae
MS
24</p>
25 <pre>
26<strong>#include &lt;cups/cups.h></strong>
bfbd0197 27
cc7359ae 28<strong>const char *cupsBackendDeviceURI</strong>(<strong>char **</strong><em>argv</em>);
bfbd0197 29
cc7359ae
MS
30<strong>void cupsBackendReport</strong>(<strong>const char *</strong><em>device_scheme</em>,
31 <strong>const char *</strong><em>device_uri</em>,
32 <strong>const char *</strong><em>device_make_and_model</em>,
33 <strong>const char *</strong><em>device_info</em>,
34 <strong>const char *</strong><em>device_id</em>,
35 <strong>const char *</strong><em>device_location</em>);
bfbd0197 36
cc7359ae
MS
37<strong>ssize_t cupsBackChannelWrite</strong>(<strong>const char *</strong><em>buffer</em>,
38 <strong>size_t </strong><em>bytes</em>, <strong>double </strong><em>timeout</em>);
94436c5a 39
cc7359ae
MS
40<strong>int cupsSideChannelRead</strong>(<strong>cups_sc_command_t *</strong><em>command</em>,
41 <strong>cups_sc_status_t *</strong><em>status</em>, <strong>char *</strong><em>data</em>,
42 <strong>int *</strong><em>datalen</em>, <strong>double </strong><em>timeout</em>);
bfbd0197 43
cc7359ae
MS
44<strong>int cupsSideChannelWrite</strong>(<strong>cups_sc_command_t </strong><em>command</em>,
45 <strong>cups_sc_status_t </strong><em>status</em>, <strong>const char *</strong><em>data</em>,
46 <strong>int </strong><em>datalen</em>, <strong>double </strong><em>timeout</em>);
bfbd0197 47</pre>
cc7359ae
MS
48 <h2 id="backend-7.description">Description</h2>
49<p>Backends are a special type of
4e3aaa5e 50<a href="filter.html"><strong>filter</strong>(7)</a>
cc7359ae 51
bfbd0197 52which is used to send print data to and discover different devices on the system.
cc7359ae
MS
53</p>
54 <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.
55</p>
56 <p>The command name (<em>argv[0]</em>) is set to the device URI of the destination printer.
87030afb 57Authentication information in
cc7359ae 58<em>argv[0]</em>
bfbd0197 59is removed, so backend developers are urged to use the
cc7359ae 60<strong>DEVICE_URI</strong>
bfbd0197 61environment variable whenever authentication information is required. The
cc7359ae
MS
62<strong>cupsBackendDeviceURI</strong>()
63
bfbd0197 64function may be used to retrieve the correct device URI.
cc7359ae
MS
65</p>
66 <p>Back-channel data from the device should be relayed to the job filters using the <em>cupsBackChannelWrite</em> function.
67</p>
68 <p>Backends are responsible for reading side-channel requests using the
69<strong>cupsSideChannelRead</strong>()
70
bfbd0197 71function and responding with the
cc7359ae
MS
72<strong>cupsSideChannelWrite</strong>()
73
bfbd0197 74function. The
cc7359ae 75<strong>CUPS_SC_FD</strong>
bfbd0197 76constant defines the file descriptor that should be monitored for incoming requests.
cc7359ae
MS
77</p>
78 <h3 id="backend-7.description.device-discovery">Device Discovery</h3>
79<p>When run with no arguments, the backend should list the devices and schemes it supports or is advertising to the standard output.
87030afb 80The output consists of zero or more lines consisting of any of the following forms:
cc7359ae
MS
81</p>
82 <pre>
83 device-class scheme &quot;Unknown&quot; &quot;device-info&quot;
84 device-class device-uri &quot;device-make-and-model&quot; &quot;device-info&quot;
85 device-class device-uri &quot;device-make-and-model&quot; &quot;device-info&quot; &quot;device-id&quot;
86 device-class device-uri &quot;device-make-and-model&quot; &quot;device-info&quot; &quot;device-id&quot; &quot;device-location&quot;
94436c5a 87</pre>
cc7359ae
MS
88 <p>The
89<strong>cupsBackendReport</strong>()
90
bfbd0197 91function can be used to generate these lines and handle any necessary escaping of characters in the various strings.
cc7359ae
MS
92</p>
93 <p>The
94<em>device-class</em>
bfbd0197 95field is one of the following values:
cc7359ae
MS
96</p>
97 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>direct</strong><br>
98The device-uri refers to a specific direct-access device with no options, such as a parallel, USB, or SCSI device.
99</p>
100 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>file</strong><br>
101The device-uri refers to a file on disk.
102</p>
103 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>network</strong><br>
104The device-uri refers to a networked device and conforms to the general form for
bfbd0197 105network URIs.
cc7359ae
MS
106</p>
107 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>serial</strong><br>
108The device-uri refers to a serial device with configurable baud rate and other options.
87030afb 109If the device-uri contains a baud value, it represents the maximum baud rate supported by the device.
cc7359ae
MS
110</p>
111 <p>The
112<em>scheme</em>
87030afb
MS
113field provides the URI scheme that is supported by the backend.
114Backends should use this form only when the backend supports any URI using that scheme.
115The
cc7359ae 116<em>device-uri</em>
bfbd0197 117field specifies the full URI to use when communicating with the device.
cc7359ae
MS
118</p>
119 <p>The
120<em>device-make-and-model</em>
121field specifies the make and model of the device, e.g. &quot;Example Foojet 2000&quot;.
122If the make and model is not known, you must report &quot;Unknown&quot;.
123</p>
124 <p>The
125<em>device-info</em>
87030afb 126field specifies additional information about the device.
cc7359ae
MS
127Typically this includes the make and model along with the port number or network address, e.g. &quot;Example Foojet 2000 USB #1&quot;.
128</p>
129 <p>The optional
130<em>device-id</em>
bfbd0197 131field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver.
cc7359ae
MS
132</p>
133 <p>The optional
134<em>device-location</em>
bfbd0197 135field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer.
cc7359ae
MS
136</p>
137 <h3 id="backend-7.description.permissions">Permissions</h3>
138<p>Backends without world read and execute permissions are run as the root user.
139Otherwise, the backend is run using an unprivileged user account, typically &quot;lp&quot;.
140</p>
141 <h2 id="backend-7.exit-status">Exit Status</h2>
142<p>The following exit codes are defined for backends:
143</p>
144 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>CUPS_BACKEND_OK</strong><br>
145The print file was successfully transmitted to the device or remote server.
146</p>
147 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>CUPS_BACKEND_FAILED</strong><br>
148<br>
87030afb
MS
149The print file was not successfully transmitted to the device or remote server.
150The scheduler will respond to this by canceling the job, retrying the job, or stopping the queue depending on the state of the
cc7359ae 151<em>printer-error-policy</em>
94436c5a 152attribute.
cc7359ae
MS
153</p>
154 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>CUPS_BACKEND_AUTH_REQUIRED</strong><br>
155The print file was not successfully transmitted because valid authentication information is required.
156The scheduler will respond to this by holding the job and adding the 'cups-held-for-authentication' keyword to the &quot;job-reasons&quot; Job Description attribute.
157</p>
158 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>CUPS_BACKEND_HOLD</strong><br>
159The print file was not successfully transmitted because it cannot be printed at this time.
87030afb 160The scheduler will respond to this by holding the job.
cc7359ae
MS
161</p>
162 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>CUPS_BACKEND_STOP</strong><br>
163The print file was not successfully transmitted because it cannot be printed at this time.
87030afb 164The scheduler will respond to this by stopping the queue.
cc7359ae
MS
165</p>
166 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>CUPS_BACKEND_CANCEL</strong><br>
167The print file was not successfully transmitted because one or more attributes are not supported or the job was canceled at the printer.
87030afb 168The scheduler will respond to this by canceling the job.
cc7359ae
MS
169</p>
170 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>CUPS_BACKEND_RETRY</strong><br>
171The print file was not successfully transmitted because of a temporary issue.
87030afb 172The scheduler will retry the job at a future time - other jobs may print before this one.
cc7359ae
MS
173</p>
174 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>CUPS_BACKEND_RETRY_CURRENT</strong><br>
175The print file was not successfully transmitted because of a temporary issue.
87030afb 176The scheduler will retry the job immediately without allowing intervening jobs.
cc7359ae
MS
177</p>
178 <p>All other exit code values are reserved.
179</p>
180 <h2 id="backend-7.environment">Environment</h2>
181<p>In addition to the environment variables listed in
4e3aaa5e 182<a href="cups.html"><strong>cups</strong>(1)</a>
cc7359ae 183
bfbd0197 184and
4e3aaa5e 185<a href="filter.html"><strong>filter</strong>(7),</a>
cc7359ae 186
bfbd0197 187CUPS backends can expect the following environment variable:
cc7359ae
MS
188</p>
189 <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>DEVICE_URI</strong><br>
190The device URI associated with the printer.
191</p>
192 <h2 id="backend-7.files">Files</h2>
193<p><em>/etc/cups/cups-files.conf</em>
194</p>
195 <h2 id="backend-7.notes">Notes</h2>
196<p>CUPS backends are not generally designed to be run directly by the user.
87030afb 197Aside from the device URI issue (
cc7359ae 198<em>argv[0]</em>
bfbd0197 199and
cc7359ae 200<strong>DEVICE_URI</strong>
87030afb 201environment variable contain the device URI), CUPS backends also expect specific environment variables and file descriptors, and typically run in a user session that (on macOS) has additional restrictions that affect how it runs.
cc7359ae
MS
202Backends can also be installed with restricted permissions (0500 or 0700) that tell the scheduler to run them as the &quot;root&quot; user instead of an unprivileged user (typically &quot;lp&quot;) on the system.
203</p>
204 <p>Unless you are a developer and know what you are doing, please do not run backends directly.
87030afb 205Instead, use the
4e3aaa5e 206<a href="lp.html"><strong>lp</strong>(1)</a>
cc7359ae 207
bfbd0197 208or
4e3aaa5e 209<a href="lpr.html"><strong>lpr</strong>(1)</a>
cc7359ae 210
bfbd0197 211programs to send print jobs or
4e3aaa5e 212<a href="lpinfo.html"><strong>lpinfo</strong>(8)</a>
cc7359ae 213
87030afb
MS
214to query for available printers using the backend.
215The one exception is the SNMP backend - see
4e3aaa5e 216<a href="cups-snmp.html"><strong>cups-snmp</strong>(8)</a>
cc7359ae 217
bfbd0197 218for more information.
cc7359ae
MS
219</p>
220 <h2 id="backend-7.notes">Notes</h2>
221<p>CUPS printer drivers and backends are deprecated and will no longer be supported in a future feature release of CUPS.
87030afb 222Printers that do not support IPP can be supported using applications such as
4e3aaa5e 223<a href="ippeveprinter.html"><strong>ippeveprinter</strong>(1).</a>
cc7359ae
MS
224
225</p>
226 <h2 id="backend-7.see-also">See Also</h2>
227<p><em>cups</em>(1),
228
229<em>cups-files.conf</em>(5),
230
231<em>cups-snmp</em>(8),
232
233<em>cupsd</em>(8),
234
235<em>filter</em>(7),
236
237<em>lp</em>(1),
238
239<em>lpinfo</em>(8),
240
241<em>lpr</em>(1),
242
bfbd0197
MS
243<br>
244CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
cc7359ae
MS
245</p>
246 <h2 id="backend-7.copyright">Copyright</h2>
76b6aade 247<p>Copyright &copy; 2020-2024 by OpenPrinting.
cc7359ae 248 </body>
94436c5a 249</html>