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