]> git.ipfire.org Git - thirdparty/cups.git/blob - man/backend.7
Changelog
[thirdparty/cups.git] / man / backend.7
1 .\"
2 .\" Backend man page for CUPS.
3 .\"
4 .\" Copyright © 2007-2019 by Apple Inc.
5 .\" Copyright © 1997-2006 by Easy Software Products.
6 .\"
7 .\" Licensed under Apache License v2.0. See the file "LICENSE" for more
8 .\" information.
9 .\"
10 .TH backend 7 "CUPS" "26 April 2019" "Apple Inc."
11 .SH NAME
12 backend \- cups backend transmission interfaces
13 .SH SYNOPSIS
14 .B backend
15 .br
16 .B backend
17 .I job
18 .I user
19 .I title
20 .I num-copies
21 .I options
22 [
23 .I filename
24 ]
25 .nf
26
27 \fB#include <cups/cups.h>\fR
28
29 \fBconst char *cupsBackendDeviceURI\fR(\fBchar **\fIargv\fR);
30
31 \fBvoid cupsBackendReport\fR(\fBconst char *\fIdevice_scheme\fR,
32 \fBconst char *\fIdevice_uri\fR,
33 \fBconst char *\fIdevice_make_and_model\fR,
34 \fBconst char *\fIdevice_info\fR,
35 \fBconst char *\fIdevice_id\fR,
36 \fBconst char *\fIdevice_location\fR);
37
38 \fBssize_t cupsBackChannelWrite\fR(\fBconst char *\fIbuffer\fR,
39 \fBsize_t \fIbytes\fR, \fBdouble \fItimeout\fR);
40
41 \fBint cupsSideChannelRead\fR(\fBcups_sc_command_t *\fIcommand\fR,
42 \fBcups_sc_status_t *\fIstatus\fR, \fBchar *\fIdata\fR,
43 \fBint *\fIdatalen\fR, \fBdouble \fItimeout\fR);
44
45 \fBint cupsSideChannelWrite\fR(\fBcups_sc_command_t \fIcommand\fR,
46 \fBcups_sc_status_t \fIstatus\fR, \fBconst char *\fIdata\fR,
47 \fBint \fIdatalen\fR, \fBdouble \fItimeout\fR);
48 .fi
49 .SH DESCRIPTION
50 Backends are a special type of
51 .BR filter (7)
52 which is used to send print data to and discover different devices on the system.
53 .LP
54 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 .LP
56 The command name (\fIargv[0]\fR) is set to the device URI of the destination printer.
57 Authentication information in
58 .I argv[0]
59 is removed, so backend developers are urged to use the
60 .B DEVICE_URI
61 environment variable whenever authentication information is required. The
62 .BR cupsBackendDeviceURI ()
63 function may be used to retrieve the correct device URI.
64 .LP
65 Back-channel data from the device should be relayed to the job filters using the \fIcupsBackChannelWrite\fR function.
66 .LP
67 Backends are responsible for reading side-channel requests using the
68 .BR cupsSideChannelRead ()
69 function and responding with the
70 .BR cupsSideChannelWrite ()
71 function. The
72 .B CUPS_SC_FD
73 constant defines the file descriptor that should be monitored for incoming requests.
74 .SS DEVICE DISCOVERY
75 When run with no arguments, the backend should list the devices and schemes it supports or is advertising to the standard output.
76 The output consists of zero or more lines consisting of any of the following forms:
77 .nf
78
79 device-class scheme "Unknown" "device-info"
80 device-class device-uri "device-make-and-model" "device-info"
81 device-class device-uri "device-make-and-model" "device-info" "device-id"
82 device-class device-uri "device-make-and-model" "device-info" "device-id" "device-location"
83 .fi
84 .LP
85 The
86 .BR cupsBackendReport ()
87 function can be used to generate these lines and handle any necessary escaping of characters in the various strings.
88 .LP
89 The
90 .I device-class
91 field is one of the following values:
92 .TP 5
93 .B direct
94 The device-uri refers to a specific direct-access device with no options, such as a parallel, USB, or SCSI device.
95 .TP 5
96 .B file
97 The device-uri refers to a file on disk.
98 .TP 5
99 .B network
100 The device-uri refers to a networked device and conforms to the general form for
101 network URIs.
102 .TP 5
103 .B serial
104 The device-uri refers to a serial device with configurable baud rate and other options.
105 If the device-uri contains a baud value, it represents the maximum baud rate supported by the device.
106 .LP
107 The
108 .I scheme
109 field provides the URI scheme that is supported by the backend.
110 Backends should use this form only when the backend supports any URI using that scheme.
111 The
112 .I device-uri
113 field specifies the full URI to use when communicating with the device.
114 .LP
115 The
116 .I device-make-and-model
117 field specifies the make and model of the device, e.g. "Example Foojet 2000".
118 If the make and model is not known, you must report "Unknown".
119 .LP
120 The
121 .I device-info
122 field specifies additional information about the device.
123 Typically this includes the make and model along with the port number or network address, e.g. "Example Foojet 2000 USB #1".
124 .LP
125 The optional
126 .I device-id
127 field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver.
128 .LP
129 The optional
130 .I device-location
131 field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer.
132 .SS PERMISSIONS
133 Backends without world read and execute permissions are run as the root user.
134 Otherwise, the backend is run using an unprivileged user account, typically "lp".
135 .SH EXIT STATUS
136 The following exit codes are defined for backends:
137 .TP 5
138 .B CUPS_BACKEND_OK
139 The print file was successfully transmitted to the device or remote server.
140 .TP 5
141 .B CUPS_BACKEND_FAILED
142 .br
143 The print file was not successfully transmitted to the device or remote server.
144 The scheduler will respond to this by canceling the job, retrying the job, or stopping the queue depending on the state of the
145 .I printer-error-policy
146 attribute.
147 .TP 5
148 .B CUPS_BACKEND_AUTH_REQUIRED
149 The print file was not successfully transmitted because valid authentication information is required.
150 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.
151 .TP 5
152 .B CUPS_BACKEND_HOLD
153 The print file was not successfully transmitted because it cannot be printed at this time.
154 The scheduler will respond to this by holding the job.
155 .TP 5
156 .B CUPS_BACKEND_STOP
157 The print file was not successfully transmitted because it cannot be printed at this time.
158 The scheduler will respond to this by stopping the queue.
159 .TP 5
160 .B CUPS_BACKEND_CANCEL
161 The print file was not successfully transmitted because one or more attributes are not supported or the job was canceled at the printer.
162 The scheduler will respond to this by canceling the job.
163 .TP 5
164 .B CUPS_BACKEND_RETRY
165 The print file was not successfully transmitted because of a temporary issue.
166 The scheduler will retry the job at a future time - other jobs may print before this one.
167 .TP 5
168 .B CUPS_BACKEND_RETRY_CURRENT
169 The print file was not successfully transmitted because of a temporary issue.
170 The scheduler will retry the job immediately without allowing intervening jobs.
171 .PP
172 All other exit code values are reserved.
173 .SH ENVIRONMENT
174 In addition to the environment variables listed in
175 .BR cups (1)
176 and
177 .BR filter (7),
178 CUPS backends can expect the following environment variable:
179 .TP 5
180 .B DEVICE_URI
181 The device URI associated with the printer.
182 .SH FILES
183 .I /etc/cups/cups-files.conf
184 .SH NOTES
185 CUPS backends are not generally designed to be run directly by the user.
186 Aside from the device URI issue (
187 .I argv[0]
188 and
189 .B DEVICE_URI
190 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 macOS) has additional restrictions that affect how it runs.
191 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.
192 .LP
193 Unless you are a developer and know what you are doing, please do not run backends directly.
194 Instead, use the
195 .BR lp (1)
196 or
197 .BR lpr (1)
198 programs to send print jobs or
199 .BR lpinfo (8)
200 to query for available printers using the backend.
201 The one exception is the SNMP backend - see
202 .BR cups-snmp (8)
203 for more information.
204 .SH NOTES
205 CUPS printer drivers and backends are deprecated and will no longer be supported in a future feature release of CUPS.
206 Printers that do not support IPP can be supported using applications such as
207 .BR ippeveprinter (1).
208 .SH SEE ALSO
209 .IR cups (1),
210 .IR cups-files.conf (5),
211 .IR cups-snmp (8),
212 .IR cupsd (8),
213 .IR filter (7),
214 .IR lp (1),
215 .IR lpinfo (8),
216 .IR lpr (1),
217 .br
218 CUPS Online Help (http://localhost:631/help)
219 .SH COPYRIGHT
220 Copyright \[co] 2007-2019 by Apple Inc.