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