backend - cups backend transmission interfaces
const char *cupsBackendDeviceURI(char **argv);
void cupsBackendReport(const char *device_scheme,
const char *device_uri,
const char *device_make_and_model,
const char *device_info,
const char *device_id,
const char *device_location);
ssize_t cupsBackChannelWrite(const char *buffer,
size_t bytes, double timeout);
int cupsSideChannelRead(cups_sc_command_t *command,
cups_sc_status_t *status, char *data,
int *datalen, double timeout);
int cupsSideChannelWrite(cups_sc_command_t command,
cups_sc_status_t status, const char *data,
int datalen, double timeout);
Backends are a special type of
which is used to send print data to and discover different devices on the system.
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.
The command name (argv) is set to the device URI of the destination printer. Authentication information in
is removed, so backend developers are urged to use the
environment variable whenever authentication information is required. The
function may be used to retrieve the correct device URI.
Back-channel data from the device should be relayed to the job filters using the cupsBackChannelWrite function.
Backends are responsible for reading side-channel requests using the
function and responding with the
constant defines the file descriptor that should be monitored for incoming requests.
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:
device-class scheme "Unknown" "device-info"
device-class device-uri "device-make-and-model" "device-info"
device-class device-uri "device-make-and-model" "device-info" "device-id"
device-class device-uri "device-make-and-model" "device-info" "device-id" "device-location"
function can be used to generate these lines and handle any necessary escaping of characters in the various strings.
field is one of the following values:
- The device-uri refers to a specific direct-access device with no options, such as a parallel, USB, or SCSI device.
- The device-uri refers to a file on disk.
- The device-uri refers to a networked device and conforms to the general form for
- 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.
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
field specifies the full URI to use when communicating with the device.
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".
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".
field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver.
field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer.
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".
The following exit codes are defined for backends:
- The print file was successfully transmitted to the device or remote server.
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
- 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.
- 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.
- 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.
- 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.
- 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.
- The print file was not successfully transmitted because of a temporary issue. The scheduler will retry the job immediately without allowing intervening jobs.
All other exit code values are reserved.
In addition to the environment variables listed in
CUPS backends can expect the following environment variable:
CUPS backends are not generally designed to be run directly by the user. Aside from the device URI issue (
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.
- The device URI associated with the printer.
Unless you are a developer and know what you are doing, please do not run backends directly. Instead, use the
programs to send print jobs or
to query for available printers using the backend. The one exception is the SNMP backend - see
for more information.
CUPS Online Help (http://localhost:631/help)
Copyright © 2007-2017 by Apple Inc.