]> git.ipfire.org Git - thirdparty/cups.git/blame_incremental - doc/help/man-backend.html
Merge pull request #1330 from weblate/weblate-cups-cups
[thirdparty/cups.git] / doc / help / man-backend.html
... / ...
CommitLineData
1<!DOCTYPE html>
2<html>
3 <head>
4 <meta name="creator" content="mantohtml v2.0.2">
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>
14<br>
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>
21[
22<em>filename</em>
23]
24</p>
25 <pre>
26<strong>#include &lt;cups/cups.h></strong>
27
28<strong>const char *cupsBackendDeviceURI</strong>(<strong>char **</strong><em>argv</em>);
29
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>);
36
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>);
39
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>);
43
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>);
47</pre>
48 <h2 id="backend-7.description">Description</h2>
49<p>Backends are a special type of
50<a href="filter.html"><strong>filter</strong>(7)</a>
51
52which is used to send print data to and discover different devices on the system.
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.
57Authentication information in
58<em>argv[0]</em>
59is removed, so backend developers are urged to use the
60<strong>DEVICE_URI</strong>
61environment variable whenever authentication information is required. The
62<strong>cupsBackendDeviceURI</strong>()
63
64function may be used to retrieve the correct device URI.
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
71function and responding with the
72<strong>cupsSideChannelWrite</strong>()
73
74function. The
75<strong>CUPS_SC_FD</strong>
76constant defines the file descriptor that should be monitored for incoming requests.
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.
80The output consists of zero or more lines consisting of any of the following forms:
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;
87</pre>
88 <p>The
89<strong>cupsBackendReport</strong>()
90
91function can be used to generate these lines and handle any necessary escaping of characters in the various strings.
92</p>
93 <p>The
94<em>device-class</em>
95field is one of the following values:
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
105network URIs.
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.
109If the device-uri contains a baud value, it represents the maximum baud rate supported by the device.
110</p>
111 <p>The
112<em>scheme</em>
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
116<em>device-uri</em>
117field specifies the full URI to use when communicating with the device.
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>
126field specifies additional information about the device.
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>
131field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver.
132</p>
133 <p>The optional
134<em>device-location</em>
135field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer.
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>
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
151<em>printer-error-policy</em>
152attribute.
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.
160The scheduler will respond to this by holding the job.
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.
164The scheduler will respond to this by stopping the queue.
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.
168The scheduler will respond to this by canceling the job.
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.
172The scheduler will retry the job at a future time - other jobs may print before this one.
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.
176The scheduler will retry the job immediately without allowing intervening jobs.
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
182<a href="cups.html"><strong>cups</strong>(1)</a>
183
184and
185<a href="filter.html"><strong>filter</strong>(7),</a>
186
187CUPS backends can expect the following environment variable:
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.
197Aside from the device URI issue (
198<em>argv[0]</em>
199and
200<strong>DEVICE_URI</strong>
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.
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.
205Instead, use the
206<a href="lp.html"><strong>lp</strong>(1)</a>
207
208or
209<a href="lpr.html"><strong>lpr</strong>(1)</a>
210
211programs to send print jobs or
212<a href="lpinfo.html"><strong>lpinfo</strong>(8)</a>
213
214to query for available printers using the backend.
215The one exception is the SNMP backend - see
216<a href="cups-snmp.html"><strong>cups-snmp</strong>(8)</a>
217
218for more information.
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.
222Printers that do not support IPP can be supported using applications such as
223<a href="ippeveprinter.html"><strong>ippeveprinter</strong>(1).</a>
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
243<br>
244CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
245</p>
246 <h2 id="backend-7.copyright">Copyright</h2>
247<p>Copyright &copy; 2020-2024 by OpenPrinting.
248 </body>
249</html>