1backend(7)                        Apple Inc.                        backend(7)
2
3
4

NAME

6       backend - cups backend transmission interfaces
7

SYNOPSIS

9       backend
10       backend job user title num-copies options [ filename ]
11
12       #include <cups/cups.h>
13
14       const char *cupsBackendDeviceURI(char **argv);
15
16       void cupsBackendReport(const char *device_scheme,
17                              const char *device_uri,
18                              const char *device_make_and_model,
19                              const char *device_info,
20                              const char *device_id,
21                              const char *device_location);
22
23       ssize_t cupsBackChannelWrite(const char *buffer,
24                                    size_t bytes, double timeout);
25
26       int cupsSideChannelRead(cups_sc_command_t *command,
27                               cups_sc_status_t *status, char *data,
28                               int *datalen, double timeout);
29
30       int cupsSideChannelWrite(cups_sc_command_t command,
31                                cups_sc_status_t status, const char *data,
32                                int datalen, double timeout);
33

DESCRIPTION

35       Backends  are  a  special type of filter(7) which is used to send print
36       data to and discover different devices on the system.
37
38       Like filters, backends must be capable of reading from  a  filename  on
39       the command-line or from the standard input, copying the standard input
40       to a temporary file as required by the physical interface.
41
42       The command name (argv[0]) is set to the device URI of the  destination
43       printer.  Authentication  information in argv[0] is removed, so backend
44       developers are urged to use the DEVICE_URI environment  variable  when‐
45       ever authentication information is required. The cupsBackendDeviceURI()
46       function may be used to retrieve the correct device URI.
47
48       Back-channel data from the device should be relayed to the job  filters
49       using the cupsBackChannelWrite function.
50
51       Backends  are  responsible  for reading side-channel requests using the
52       cupsSideChannelRead() function and responding with the cupsSideChannel‐
53       Write()  function.  The CUPS_SC_FD constant defines the file descriptor
54       that should be monitored for incoming requests.
55
56   DEVICE DISCOVERY
57       When run with no arguments, the backend should  list  the  devices  and
58       schemes  it supports or is advertising to the standard output. The out‐
59       put consists of zero or more lines consisting of any of  the  following
60       forms:
61
62           device-class scheme "Unknown" "device-info"
63           device-class device-uri "device-make-and-model" "device-info"
64           device-class device-uri "device-make-and-model" "device-info" "device-id"
65           device-class device-uri "device-make-and-model" "device-info" "device-id" "device-location"
66
67       The  cupsBackendReport()  function  can be used to generate these lines
68       and handle any necessary escaping of characters in the various strings.
69
70       The device-class field is one of the following values:
71
72       direct
73            The device-uri refers to a specific direct-access device  with  no
74            options, such as a parallel, USB, or SCSI device.
75
76       file The device-uri refers to a file on disk.
77
78       network
79            The  device-uri  refers  to a networked device and conforms to the
80            general form for network URIs.
81
82       serial
83            The device-uri refers to a serial device  with  configurable  baud
84            rate  and  other options. If the device-uri contains a baud value,
85            it represents the maximum baud rate supported by the device.
86
87       The scheme field provides the URI scheme that is supported by the back‐
88       end.  Backends  should use this form only when the backend supports any
89       URI using that scheme. The device-uri field specifies the full  URI  to
90       use when communicating with the device.
91
92       The  device-make-and-model  field  specifies  the make and model of the
93       device, e.g. "Example Foojet 2000". If the make and model is not known,
94       you must report "Unknown".
95
96       The  device-info  field  specifies  additional  information  about  the
97       device. Typically this includes the make and model along with the  port
98       number or network address, e.g. "Example Foojet 2000 USB #1".
99
100       The  optional  device-id field specifies the IEEE-1284 device ID string
101       for the device, which is used to select a matching driver.
102
103       The optional device-location field specifies the physical  location  of
104       the  device,  which  is often used to pre-populate the printer-location
105       attribute when adding a printer.
106
107   PERMISSIONS
108       Backends without world read and execute permissions are run as the root
109       user. Otherwise, the backend is run using an unprivileged user account,
110       typically "lp".
111

EXIT STATUS

113       The following exit codes are defined for backends:
114
115       CUPS_BACKEND_OK
116            The print file was  successfully  transmitted  to  the  device  or
117            remote server.
118
119       CUPS_BACKEND_FAILED
120            The  print  file was not successfully transmitted to the device or
121            remote server. The scheduler will respond to this by canceling the
122            job,  retrying  the  job,  or  stopping the queue depending on the
123            state of the printer-error-policy attribute.
124
125       CUPS_BACKEND_AUTH_REQUIRED
126            The print file was  not  successfully  transmitted  because  valid
127            authentication information is required. The scheduler will respond
128            to this by holding the job and adding the 'cups-held-for-authenti‐
129            cation' keyword to the "job-reasons" Job Description attribute.
130
131       CUPS_BACKEND_HOLD
132            The  print file was not successfully transmitted because it cannot
133            be printed at this time. The scheduler will  respond  to  this  by
134            holding the job.
135
136       CUPS_BACKEND_STOP
137            The  print file was not successfully transmitted because it cannot
138            be printed at this time. The scheduler will  respond  to  this  by
139            stopping the queue.
140
141       CUPS_BACKEND_CANCEL
142            The  print  file  was  not successfully transmitted because one or
143            more attributes are not supported or the job was canceled  at  the
144            printer. The scheduler will respond to this by canceling the job.
145
146       CUPS_BACKEND_RETRY
147            The  print file was not successfully transmitted because of a tem‐
148            porary issue. The scheduler will retry the job at a future time  -
149            other jobs may print before this one.
150
151       CUPS_BACKEND_RETRY_CURRENT
152            The  print file was not successfully transmitted because of a tem‐
153            porary issue. The scheduler will retry the job immediately without
154            allowing intervening jobs.
155
156       All other exit code values are reserved.
157

ENVIRONMENT

159       In  addition  to  the  environment variables listed in cups(1) and fil‐
160       ter(7), CUPS backends can expect the following environment variable:
161
162       DEVICE_URI
163            The device URI associated with the printer.
164

FILES

166       /etc/cups/cups-files.conf
167

NOTES

169       CUPS backends are not generally designed to  be  run  directly  by  the
170       user. Aside from the device URI issue ( argv[0] and DEVICE_URI environ‐
171       ment variable contain the device URI), CUPS backends also  expect  spe‐
172       cific  environment variables and file descriptors, and typically run in
173       a user session that (on macOS) has additional restrictions that  affect
174       how it runs. Backends can also be installed with restricted permissions
175       (0500 or 0700) that tell the scheduler to run them as the  "root"  user
176       instead of an unprivileged user (typically "lp") on the system.
177
178       Unless  you  are a developer and know what you are doing, please do not
179       run backends directly. Instead, use the lp(1)  or  lpr(1)  programs  to
180       send  print jobs or lpinfo(8) to query for available printers using the
181       backend. The one exception is the SNMP backend - see  cups-snmp(8)  for
182       more information.
183

SEE ALSO

185       cups(1),  cups-files.conf(5), cups-snmp(8), cupsd(8), filter(7), lp(1),
186       lpinfo(8), lpr(1),
187       CUPS Online Help (http://localhost:631/help)
188
190       Copyright © 2007-2017 by Apple Inc.
191
192
193
1944 April 2014                         CUPS                           backend(7)
Impressum