#include <cups/cups.h>
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);
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[0]) is set to the device URI of the destination printer. Authentication information in argv[0] is removed, so backend developers are urged to use the DEVICE_URI environment variable whenever authentication information is required. The cupsBackendDeviceURI() 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 cupsSideChannelRead() function and responding with the cupsSideChannelWrite() function. The CUPS_SC_FD constant defines the file descriptor that should be monitored for incoming requests.
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"
The cupsBackendReport() function can be used to generate these lines and handle any necessary escaping of characters in the various strings.
The device-class field is one of the following values:
The scheme 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 device-uri field specifies the full URI to use when communicating with the device.
The device-make-and-model 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".
The device-info 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".
The optional device-id field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver.
The optional device-location field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer.
All other exit code values are reserved.
Unless you are a developer and know what you are doing, please do not run backends directly. Instead, use the lp(1) or lpr(1) programs to send print jobs or lpinfo(8) to query for available printers using the backend. The one exception is the SNMP backend - see cups-snmp(8) for more information.