4 .\" Backend man page for CUPS.
6 .\" Copyright 2007-2014 by Apple Inc.
7 .\" Copyright 1997-2006 by Easy Software Products.
9 .\" These coded instructions, statements, and computer programs are the
10 .\" property of Apple Inc. and are protected by Federal copyright
11 .\" law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 .\" which should have been included with this file. If this file is
13 .\" file is missing or damaged, see the license at "http://www.cups.org/".
15 .TH backend 7 "CUPS" "4 April 2014" "Apple Inc."
17 backend \- cups backend transmission interfaces
32 \fB#include <cups/cups.h>\fR
34 \fBconst char *cupsBackendDeviceURI\fR(\fBchar **\fIargv\fR);
36 \fBvoid cupsBackendReport\fR(\fBconst char *\fIdevice_scheme\fR,
37 \fBconst char *\fIdevice_uri\fR,
38 \fBconst char *\fIdevice_make_and_model\fR,
39 \fBconst char *\fIdevice_info\fR,
40 \fBconst char *\fIdevice_id\fR,
41 \fBconst char *\fIdevice_location\fR);
43 \fBssize_t cupsBackChannelWrite\fR(\fBconst char *\fIbuffer\fR,
44 \fBsize_t \fIbytes\fR, \fBdouble \fItimeout\fR);
46 \fBint cupsSideChannelRead\fR(\fBcups_sc_command_t *\fIcommand\fR,
47 \fBcups_sc_status_t *\fIstatus\fR, \fBchar *\fIdata\fR,
48 \fBint *\fIdatalen\fR, \fBdouble \fItimeout\fR);
50 \fBint cupsSideChannelWrite\fR(\fBcups_sc_command_t \fIcommand\fR,
51 \fBcups_sc_status_t \fIstatus\fR, \fBconst char *\fIdata\fR,
52 \fBint \fIdatalen\fR, \fBdouble \fItimeout\fR);
55 Backends are a special type of
57 which is used to send print data to and discover different devices on the system.
59 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.
61 The command name (\fIargv[0]\fR) is set to the device URI of the destination printer. Authentication information in
63 is removed, so backend developers are urged to use the
65 environment variable whenever authentication information is required. The
66 .BR cupsBackendDeviceURI ()
67 function may be used to retrieve the correct device URI.
69 Back-channel data from the device should be relayed to the job filters using the \fIcupsBackChannelWrite\fR function.
71 Backends are responsible for reading side-channel requests using the
72 .BR cupsSideChannelRead ()
73 function and responding with the
74 .BR cupsSideChannelWrite()
77 constant defines the file descriptor that should be monitored for incoming requests.
79 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:
82 device-class scheme "Unknown" "device-info"
83 device-class device-uri "device-make-and-model" "device-info"
84 device-class device-uri "device-make-and-model" "device-info" "device-id"
85 device-class device-uri "device-make-and-model" "device-info" "device-id" "device-location"
89 .BR cupsBackendReport ()
90 function can be used to generate these lines and handle any necessary escaping of characters in the various strings.
94 field is one of the following values:
97 The device-uri refers to a specific direct-access device with no options, such as a parallel, USB, or SCSI device.
100 The device-uri refers to a file on disk.
103 The device-uri refers to a networked device and conforms to the general form for
107 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.
111 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
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". If the make and model is not known, you must report "Unknown".
121 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".
125 field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver.
129 field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer.
131 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".
133 The following exit codes are defined for backends:
136 The print file was successfully transmitted to the device or remote server.
138 .B CUPS_BACKEND_FAILED
140 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
141 .I printer-error-policy
144 .B CUPS_BACKEND_AUTH_REQUIRED
145 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.
148 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.
151 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.
153 .B CUPS_BACKEND_CANCEL
154 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.
156 .B CUPS_BACKEND_RETRY
157 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.
159 .B CUPS_BACKEND_RETRY_CURRENT
160 The print file was not successfully transmitted because of a temporary issue. The scheduler will retry the job immediately without allowing intervening jobs.
162 All other exit code values are reserved.
164 In addition to the environment variables listed in
168 CUPS backends can expect the following environment variable:
171 The device URI associated with the printer.
173 .I /etc/cups/cups-files.conf
175 CUPS backends are not generally design to be run directly by the user. Aside from the device URI issue (
179 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 OS X) 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.
181 Unless you are a developer and know what you are doing, please do not run backends directly. Instead, use the
185 programs to send print jobs or
187 to query for available printers using the backend. The one exception is the SNMP backend - see
189 for more information.
192 .IR cups-files.conf (5),
200 CUPS Online Help (http://localhost:631/help)
202 Copyright \[co] 2007-2014 by Apple Inc.