 |
An Overview of the
Common UNIX Printing System
October 4, 1999
Michael Sweet, Easy Software Products
Copyright 1998-1999, All Rights Reserved.
|
This whitepaper describes the Common UNIX Printing
SystemTM ("CUPSTM"), a portable and extensible
printing system for UNIX®. CUPS is being developed by
Easy Software Products, a software firm located in Hollywood, Maryland
that has been selling commercial software for Silicon
Graphics®, Sun®, and HP workstations
since 1993 through more than 40 distributors serving over 80 countries
worldwide.
Additional information on CUPS is available on the World Wide Web at
"http://www.cups.org".
Background
Printing within UNIX has historically been done using one of two
printing systems - the Berkeley Line Printer Daemon ("LPD") [RFC1179]
and the AT&T Line Printer system. Replacements for these printing
systems have emerged [LPRng, Palladin, PLP], however none of the
replacements change the fundamental capabilities of these systems.
Over the last few years several attempts at developing a standard
printing interface have been made, including the draft POSIX Printing
standard [IEEE-1387.4, last updated in 1994] and Internet Printing
Protocol [IETF-IPP]. The POSIX printing standard defines a common set
of command-line tools as well as a C interface for printer
administration and print jobs. The Internet Printing Protocol defines
extensions to the HyperText Transport Protocol 1.1 [RFC2068] to provide
support for remote printing services.
Weaknesses in Existing Printing Systems
Easy Software Products has identified several major weaknesses in
the printing systems currently in use:
- Users must print text or Adobe®
PostScriptTM files; other formats may be
supported, but not universally.
- Lack of a standard command-line interface; each operating
system and driver package provides different command-line
options, e.g. setting the media size with one driver may
involve passing a single option ("letter") while another
requires two ("mediasize letter").
- Lack of a standard application interface; most UNIX
applications either do not provide an interface for sending
printer options, or restrict the options to those in printer
description files supplied with the application.
- Remote printing problems; no vendor seems to use the same
remote printing protocol (many use an "enhanced" version of the
LPD protocol with vendor-specific extensions).
- Client printer administration hassles; most vendors
require that you install remote printers on each client by
hand, and many do not even provide the ability to browse
printers on the "server" system.
- Drivers typically are hardcoded to handle printing to
parallel or serial printers; support for other types of
interfaces or networking protocols requires that a driver be
rewritten to support them.
- Security, accounting, and quotas; most printing systems do
not support access control lists ("ACLs"), and printer
accounting and quotas are not well supported, if at all.
Goals of CUPS
The basic goals of CUPS are:
- Provide standard support for text (US ASCII, UTF-8, and
ISO-8859-x), Adobe PostScript, PDF, HP-GL/2, TIFF, JPEG, PNG,
PBM, PGM, PPM, GIF, SGI RGB, Sun Raster, and Kodak
PhotoCDTM files.
- Provide a standard command-line interface with a standard
minimum set of options (media size and so forth).
- Provide a standard application interface.
- Provide a common remote printing interface (IPP).
- Provide a printer browsing interface and allow users to
print to remote printers using a "printer@server" notation
rather than adding the printer locally.
- Provide a scheduler extension interface to support
different interfaces separate from the printer driver (e.g.
serial, parallel, lpd, tftp, ipp, etc.)
- Provide a standard interface for ACLs, quotas, accounting,
and logging.
Design Overview
Like most printing systems, CUPS is designed around a central print
scheduling process that dispatches print jobs, processes administrative
commands, provides printer status information to local and remote
programs, and informs users as needed. Figure 1 shows the basic
organization of CUPS.
Figure 1 - CUPS Block Diagram
Scheduler
The scheduler is a HTTP/1.1 server application that handles HTTP
requests. Besides handling printer requests via IPP POST requests, the
scheduler also acts as a full-featured web server for documentation and
status monitoring.
The scheduler also monitors the LAN for printer browsing information
and dispatches print jobs as needed using the appropriate filters and
backends.
Configuration Files
The configuration files consist of:
- A HTTP server configuration file.
- Printer and class definition files.
- MIME type and conversion rule files.
- PostScript Printer Description (PPD) files.
The HTTP server configuration file is purposely similar to the
Apache server configuration file and defines all of the access control
properties for the server.
The printer and class definition files list the available printer
queues and classes. Printer classes are collections of printers. Jobs
sent to a class are forwarded to the first available printer in the
class, round-robin fashion.
The MIME type files list the supported MIME types (text/plain,
application/postscript, etc.) and "magic" rules for automatically
detecting the format of a file. These are used by the HTTP server to
determine the Content-Type field for GET and HEAD
requests, and by the IPP request handler to determine the file type
when a Print-Job request is received with a
document-format of application/octet-stream.
The MIME conversion rule files list the available filters. These
files are augmented by cupsFilter entries in the printer PPD
files. The filters are used when a job is dispatched so that an
application can send a convenient file format to the printing system
which then converts the document into a printable format as needed.
Each filter has a relative cost associated with it, and the filtering
algorithm chooses the set of filters that will convert the file to the
needed format with the lowest total "cost".
The PPD files describe the capabilities of PostScript printers.
There is one PPD file for each printer.
CUPS Interface Library
The CUPS interface library contains CUPS-specific convenience functions
for queuing print jobs, etc. It also contains functions to access
resources via HTTP and IPP, perform MIME typing and conversion, and
manipulate PPD files.
Filters
A filter program reads from the standard input or from a file if a
filename is supplied. All filters must support a common set of options
including printer name, job ID, username, job title, number of copies,
and job options. All output is sent to the standard output.
Backends
A backend program is a special filter that writes incoming data to a
device or network connection. Backends for serial, parallel, LPD,
IPP, SMB, and AppSocket (JetDirect) connections are provided in
CUPS 1.0.
Berkeley and System V Commands
CUPS provides the System V and Berkeley command-line interfaces
for submitting jobs and checking the printer status. The "lpstat" and
"lpc status" commands also show network printers ("printer@hostname")
when printer browsing is enabled.
The System V administation commands are supplied for managing
printers local to the system. The Berkeley printer administration tool
("lpc") is only supported in a "read-only" mode to check the current
status of the printer queues and scheduler.
Summary
The Common UNIX Printing System provides a modern printing interface
for UNIX applications that is both flexible and user-friendly. The
software provides System V and Berkeley compatible command-line
interfaces to ensure compatibility with existing applications.
Licensing
CUPS is available under the terms of the GNU General Public License
which means that it is basically free except for binary-only
distribution. Vendors wishing to license CUPS for their printing
solution should contact Easy Software Products at:
Attn: CUPS Licensing
Easy Software Products
44141 Airport View Drive Suite 204
Hollywood, Maryland 20636-3111 USA
+1.301.373.9600
cups-info@cups.org
References
- IEEE-1387.4
- System Administration - Part 4: Printing Interfaces (draft)
- IETF-IPP
- Internet Printing Protocol/1.0
- LPRng
- An enhanced, extended, and portable implementation of the Berkeley LPR
print spooler functionality
- Palladin
- A printing system developed at the Massachussetts Institute of Technology
- PLP
- The Portable Line Printer spooler system
- RFC1179
- Line Printer Daemon Protocol
- RFC2046
- Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types
- RFC2068
- Hypertext Transfer Protocol -- HTTP/1.1
Trademarks
The Common UNIX Printing System, CUPS, and the CUPS logo are
trademarks of Easy Software Products. All other trademarks are the
property of their respective owners.