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