2 .\" Backend man page for CUPS.
4 .\" Copyright © 2007-2019 by Apple Inc.
5 .\" Copyright © 1997-2006 by Easy Software Products.
7 .\" Licensed under Apache License v2.0. See the file "LICENSE" for more
10 .TH backend 7 "CUPS" "26 April 2019" "Apple Inc."
12 backend \- cups backend transmission interfaces
27 \fB#include <cups/cups.h>\fR
29 \fBconst char *cupsBackendDeviceURI\fR(\fBchar **\fIargv\fR);
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);
38 \fBssize_t cupsBackChannelWrite\fR(\fBconst char *\fIbuffer\fR,
39 \fBsize_t \fIbytes\fR, \fBdouble \fItimeout\fR);
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);
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);
50 Backends are a special type of
52 which is used to send print data to and discover different devices on the system.
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.
56 The command name (\fIargv[0]\fR) is set to the device URI of the destination printer.
57 Authentication information in
59 is removed, so backend developers are urged to use the
61 environment variable whenever authentication information is required. The
62 .BR cupsBackendDeviceURI ()
63 function may be used to retrieve the correct device URI.
65 Back-channel data from the device should be relayed to the job filters using the \fIcupsBackChannelWrite\fR function.
67 Backends are responsible for reading side-channel requests using the
68 .BR cupsSideChannelRead ()
69 function and responding with the
70 .BR cupsSideChannelWrite ()
73 constant defines the file descriptor that should be monitored for incoming requests.
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:
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"
86 .BR cupsBackendReport ()
87 function can be used to generate these lines and handle any necessary escaping of characters in the various strings.
91 field is one of the following values:
94 The device-uri refers to a specific direct-access device with no options, such as a parallel, USB, or SCSI device.
97 The device-uri refers to a file on disk.
100 The device-uri refers to a networked device and conforms to the general form for
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.
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.
113 field specifies the full URI to use when communicating with the device.
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".
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".
127 field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver.
131 field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer.
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".
136 The following exit codes are defined for backends:
139 The print file was successfully transmitted to the device or remote server.
141 .B CUPS_BACKEND_FAILED
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
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.
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.
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.
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.
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.
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.
172 All other exit code values are reserved.
174 In addition to the environment variables listed in
178 CUPS backends can expect the following environment variable:
181 The device URI associated with the printer.
183 .I /etc/cups/cups-files.conf
185 CUPS backends are not generally designed to be run directly by the user.
186 Aside from the device URI issue (
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.
193 Unless you are a developer and know what you are doing, please do not run backends directly.
198 programs to send print jobs or
200 to query for available printers using the backend.
201 The one exception is the SNMP backend - see
203 for more information.
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).
210 .IR cups-files.conf (5),
218 CUPS Online Help (http://localhost:631/help)
220 Copyright \[co] 2007-2019 by Apple Inc.