3 <META NAME="COPYRIGHT" CONTENT="Copyright 1997-2003, All Rights Reserved">
4 <META NAME="DOCNUMBER" CONTENT="CUPS-SDD-1.2">
5 <META NAME="Author" CONTENT="Easy Software Products">
6 <TITLE>CUPS Software Design Description</TITLE>
12 <H2>Identification</H2>
14 This software design description document provides general information
15 on the architecture and coding of the Common UNIX Printing System
16 ("CUPS") Version 1.2.
18 <EMBED SRC="system-overview.shtml">
20 <H2>Document Overview</H2>
22 This software design description document is organized into the
31 <LI>3 - Design Overview
37 <EMBED SRC="references.shtml">
39 <H1>Design Overview</H1>
41 CUPS is composed of 9 software sub-systems that operate together to
42 perform common printing tasks:
52 <LI>CUPS Application Programmers Interface
54 <LI>CUPS Imaging Library
68 The backends implement communications over a number of different interfaces.
69 All backends are called with a common set of arguments:
73 <LI>Device URI - the Uniform Resource Identifier for the output device
74 (e.g. <CODE>parallel:/dev/plp</CODE>,
75 <CODE>ipp://hostname/resource</CODE>).
77 <LI>Job Identifier - the job identifier for this job (integer).
79 <LI>User Name - the user associated with this job (name string).
81 <LI>Title - the title/job-name associated with this job (name string).
83 <LI>Copies - the number of copies required (integer).
85 <LI>Options - the options associated with this job (space separated
88 <LI>Filename (optional) - the file to print; if this option is not
89 specified, the backend must read the print file from the standard
94 <P>Backends are named using the scheme of the URI, so a URI of
95 "ipp://hostname/resource" would be processed by the "ipp" backend.
99 <P>The ipp backend sends the specified job to a network printer or host using
100 the Internet Printing Protocol. The URI is as specified by the
101 <CODE>printer-uri-supported</CODE> attribute from the printer or host.
105 <P>The lpd backend sends the specified job to a network printer or host using
106 the Line Printer Daemon protocol. The URI is of the form:
108 <UL><PRE>lpd://hostname/queue
113 <P>The parallel backend sends the specified job to a local printer connected
114 via the specified parallel port device. The URI is of the form:
116 <UL><PRE>parallel:/dev/file
121 <P>The serial backend sends the specified job to a local printer connected
122 via the specified serial port device. The URI is of the form:
124 <UL><PRE>serial:/dev/file?option[+option+...]
127 The options can be any combination of the following:
131 <LI><CODE>baud=<I>rate</I></CODE> - Sets the baud rate for the device.
133 <LI><CODE>bits=<I>7 or 8</I></CODE> - Sets the number of data bits.
135 <LI><CODE>parity=<I>even</I></CODE> - Sets even parity checking.
137 <LI><CODE>parity=<I>odd</I></CODE> - Sets odd parity checking.
139 <LI><CODE>parity=<I>none</I></CODE> - Turns parity checking off.
141 <LI><CODE>flow=dtrdsr<I></I></CODE> - Turns DTR/DSR (hardware) flow
144 <LI><CODE>flow=hard<I></I></CODE> - Turns RTS/CTS
145 (hardware) flow control on.
147 <LI><CODE>flow=none<I></I></CODE> - Turns flow control off.
149 <LI><CODE>flow=rtscts<I></I></CODE> - Turns RTS/CTS
150 (hardware) flow control on.
152 <LI><CODE>flow=xonxoff<I></I></CODE> - Turns XON/XOFF
153 (software) flow control on.
159 <P>The socket backend sends the specified job to a network host using the
160 AppSocket protocol commonly used by Hewlett-Packard and Tektronix
161 printers. The URI is of the form:
163 <UL><PRE>socket://hostname[:port]
166 The default port number is 9100.
170 <P>The usb backend sends the specified job to a local printer connected
171 via the specified usb port device. The URI is of the form:
173 <UL><PRE>usb:/dev/file
176 <H2>Berkeley Commands</H2>
178 <P>The Berkeley commands provide a simple command-line interface to CUPS
179 to submit and control print jobs. It is provided for compatibility with
180 existing software that is hardcoded to use the Berkeley commands.
184 The lpc command allows users and administrators to check the status and
185 control print queues. The version provided with CUPS supports the following
190 <LI>quit - Quits the lpc command.
192 <LI>status - Shows the status of printers and jobs in the queue.
198 <P>The lpq command shows the current queue status.
202 <P>The lpr command submits a job for printing. The CUPS version of lpr silently
203 ignores the "i", "t", "m", "h", and "s" options.
207 <P>The lprm removes one or more print jobs.
211 <P>The Common Gateway Interface (CGI) programs provide a web-based
212 status interface to monitor the status of printers, classes, and jobs.
213 Each of the CGIs utilize HTML template files that can be customized to
214 provide alternate appearances.
218 <P>The admin CGI provides administration interfaces for printers and
219 classes. The user can add, modify, delete, start, stop, and configure
220 printers and classes using "wizard" interfaces.
224 <P>The classes CGI lists the available printer classes and any pending
225 jobs for the class. The user can click on individual classes to limit
226 the display and click on jobs to see the job status.
230 <P>The jobs CGI lists the queued print jobs in order of priority. The
231 list can be limited by printer or job.
233 <H3>printers.cgi</H3>
235 <P>The printers CGI lists the available printer queues and any pending
236 jobs for the printer. The user can click on individual printers to
237 limit the display and click on jobs to see the job status.
239 <H2>CUPS Application Programmers Interface</H2>
241 <P>The CUPS Application Programmers Interface ("API") provides common
242 convenience, HTTP, IPP, language, and PPD functions used by the CUPS
245 <H3>Convenience Functions</H3>
247 <P>Convenience functions are provided to submit an IPP request, send a
248 print file, cancel a job, get a list of available printers, get a list
249 of available classes, get the default printer or class, get the default
250 server name, get the local username, and get a password string.
252 <H3>HTTP Functions</H3>
254 <P>The HTTP functions provide functions to connect to HTTP servers,
255 issue requests, read data from a server, and write data to a server.
257 <H3>IPP Functions</H3>
259 <P>The IPP function provide functions to manage IPP request data and
260 attributes, read IPP responses from a server, and write IPP requests to
263 <H3>Language Functions</H3>
265 <P>The language functions provide a standard interface for retrieving
266 common textual messages for a particular locale and determining the
267 correct encoding (e.g. US ASCII, UTF-8, ISO-8859-1, etc.)
269 <H3>PPD Functions</H3>
271 <P>The PostScript Printer Description functions manage PPD files,
272 select options, check for option conflicts, and emit selected options
273 in the correct order.
275 <H2>CUPS Imaging Library</H2>
277 <P>The CUPS imaging library provides colorspace conversion, color
278 management, image management, scaling, image file, and raster functions
279 used by the CUPS raster filters.
281 <H3>Colorspace Conversion Functions</H3>
283 <P>The colorspace conversion functions handle conversion of grayscale
284 and RGB colors to grayscale, RGB, K, CMY, CMYK, and CMYKcm colorspaces.
286 <H3>Color Management Functions</H3>
288 <P>The color management functions handle gamut mapping and density
289 correction. These are integrated with the colorspace conversion
290 functions so that colorspace conversion and color management are
291 processed in a single step.
293 <H3>Image Management Functions</H3>
295 <P>The image management functions manage a tiled image database that is
296 swapped to/from disk as needed.
298 <H3>Scaling Functions</H3>
300 <P>The scaling functions provide image scaling services using
301 nearest-neighbor sampling and bilinear interpolation as appropriate.
303 <H3>Image File Functions</H3>
305 <P>The image file functions handle loading of all image file formats.
307 <H3>Raster Functions</H3>
309 <P>The raster functions manage streams of CUPS raster data (described
310 in the Interface Design Document) used by non-PostScript printer
311 drivers and raster filters.
315 <P>The daemons provide additional network functions for the scheduler.
316 Currently only two daemons are provided with CUPS.
318 <H3>Line Printer Daemon</H3>
320 <P>The line printer daemon provides remote LPD client support and is
321 run by the <CODE>inetd(8)</CODE> daemon as needed.
323 <H3>Polling Daemon</H3>
325 <P>The polling daemon is used to poll a remote server for a list of
326 available printers and provide it to the scheduler for addition. A
327 separate polling daemon is run by the scheduler for every remote
328 system listed for polling in the scheduler configuration file.
332 <P>The filters implement file conversion services for CUPS. All filters
333 are called with a common set of arguments:
337 <LI>Printer name - the name of the destination printer (name string).
339 <LI>Job Identifier - the job identifier for this job (integer).
341 <LI>User Name - the user associated with this job (name string).
343 <LI>Title - the title/job-name associated with this job (name string).
345 <LI>Copies - the number of copies required (integer).
347 <LI>Options - the options associated with this job (space separated
350 <LI>Filename (optional) - the file to print; if this option is not
351 specified, the filter must read the input file from the standard
356 <P>Filters are added to the MIME conversion data file and implement all
357 necessary conversions from one file type to another.
361 <P>The hpgltops filter converts HP-GL/2 files into PostScript.
365 <P>The imagetops filter converts image files into PostScript.
367 <H3>imagetoraster</H3>
369 <P>The imagetoraster filter converts image files into CUPS raster data.
373 <P>The pdftops filter converts PDF files into PostScript.
377 <P>The pstops filter inserts printer-specific commands from PPD files and
378 performs page filtering as requested by the user.
382 <P>The pstoraster filter converts PostScript program data into CUPS
385 <H3>rastertoepson</H3>
387 <P>The rastertoepson filter handles converting CUPS raster data to
388 ESC/P and supports both color and black-and-white printers.
392 <P>The rastertohp filter handles converting CUPS raster data to HP-PCL
393 and supports both color and black-and-white printers.
397 <P>The texttops filter converts text files into PostScript.
401 <P>The scheduler is a fully-functional HTTP/1.1 and IPP/1.1 server that
402 manages the printers, classes, and jobs in the system. It also handles
403 a simple broadcast-based directory service so that remote print queues
404 and classes can be accessed transparently from the local system.
406 <H3>Authorization</H3>
408 <P>The authorization module is responsible for performing access
409 control and authentication for all HTTP and IPP requests entering the
414 <P>The classes module is responsible for managing printer classes in
415 the system. Each class is a collection of local and/or remote
416 printers. The classes module also reads and writes the classes
421 <P>The client module is responsible for all HTTP client
422 communications. It handles listening on selected interfaces, accepting
423 connections from prospective clients, processing incoming HTTP
424 requests, and sending HTTP responses to those requests. The client
425 module also is responsible for executing the external CGI programs as
426 needed to support web-based printer, class, and job status monitoring
429 <P>Once authorized, all IPP requests are sent to the IPP module.
431 <H3>Configuration</H3>
433 <P>The configuration module is responsible for reading the CUPS
434 configuration file and initializing the appropriate data structures and
435 values. The configuration module also stops CUPS services before
436 reading the configuration file and restarts them after the
437 configuration file has been read.
441 <P>The devices module is responsible for managing the list of available
442 devices for the CUPS-Get-Devices operation.
444 <H3>Directory Services</H3>
446 <P>The directory services module sends and recieves printer state
447 information over a broadcast socket. Remote printers and classes are
448 automatically added to or removed from the local printer and class
451 <P>The directory services module can only recieve printer state information
452 over a single UDP port, however it can broadcast to multiple addresses and
457 <P>The IPP module handles IPP requests and acts accordingly. URI
458 validation is also performed here, as a client can post IPP data to any
459 URI on the server which might sidestep the access control or
460 authentication of the HTTP server.
464 <P>The jobs module manages print jobs, starts filter and backend
465 processes for jobs to be printed, and monitors status messages from
466 those filters and backends.
470 <P>The logging module manages the access, error, and page log files
471 that are generated by the scheduler.
475 <P>The main module is responsible for timing out and dispatching input
476 and output for client connections. It also watches for incoming
477 <CODE>SIGHUP</CODE> and <CODE>SIGCHLD</CODE> signals, reloads the
478 server configuration files as needed, and handles child process errors
483 <P>The Multimedia Internet Mail Exchange module manages a MIME type and
484 conversion database that supports file typing by extension and content
485 and least-cost file filtering from a source to a destination file type.
489 <P>The PPDs module is responsible for managing the list of available
490 PPD files for the CUPS-Get-PPDs operation.
494 <P>The printers module is responsible for managing printers and PPD
495 files in the system. The printers module also reads and writes the
496 printers configuration file.
498 <H2>System V Commands</H2>
500 <P>The System V commands provide a robust command-line interface to
501 CUPS to submit and control printers and jobs.
505 <P>The accept command tells the scheduler to accept new jobs for specific
510 <P>The cancel command tells the scheduler to cancel one or more jobs that are
515 <P>The disable command tells the scheduler to stop printing jobs on the
520 <P>The enable command tells the scheduler to start printing jobs on the
525 <P>The lp command submits submits files for printing. Unlike the standard
526 System V lp command, a single CUPS lp command will generate a separate
527 job ID for each file that is printed. Also, the Solaris "f", "H", "P", "S",
528 and "y" options are silently ignored.
532 <P>The lpadmin command manages printer queues and classes. The Solaris
533 "A", "F", "I", "M", "P", "Q", "S", "T", "U", "W", "f", "l", "m", "o",
534 "s", "t", and "u" options are not supported, and new options "P" (PPD
535 file) and "E" (enable and accept) are provided to configure
536 CUPS-specific features.
540 <P>The lpinfo command lists the available PPD files or devices as selected
545 <P>The lpmove command moves a print job to a new destination.
549 <P>The lpoptions command manages user-defined printers and options.
553 <P>The lpstat command lists printers, classes, and jobs as requested by the
558 <P>The reject command tells the scheduler not to accept new jobs for specific
561 <EMBED SRC="glossary.shtml">