Provided by Colasoft Co., Ltd.

LPD ( Line Printer Daemon )

Home > Protocols > LPD Update: 2005-11-24 11:54:38    I have words to say about this protocol
On this page
SUMMARY
Protocol : Line Printer Daemon
Protocol suite : Unix
Layer : Application Layer
DESCRIPTION
The Line Printer Daemon protocol (or LPR, LPD) also known as the Berkeley printing system, is a set of programs that provide printer spooling and network print server functionality for Unix-like systems. The most common implementations of LPD are the official BSD UNIX operating system and the LPRng project. The Common UNIX Printing System (or CUPS), which is more common on modern Linux distributions, borrows heavily from LPD.

Message formats
LPD is a TCP-based protocol. The port on which a line printer daemon listens is 515. The source port must be in the range 721 to 731, inclusive. A line printer daemon responds to commands send to its port. All commands begin with a single octet code, which is a binary number which represents the requested function. The code is immediately followed by the ASCII name of the printer queue name on which the function is to be performed. If there are other operands to the command, they are separated from the printer queue name with white space (ASCII space, horizontal tab, vertical tab, and form feed). The end of the command is indicated with an ASCII line feed character.


Daemon commands
The verbs in the command names should be interpreted as statements made to the daemon. Thus, the command "Print any waiting jobs" is an imperative to the line printer daemon to which it is sent. A new connection must be made for each command to be given to the daemon.

  • Print any waiting jobs
    This command starts the printing process if it not already running.


  • Receive a printer job
    Receiving a job is controlled by a second level of commands. The daemon is given commands by sending them over the same connection.


  • Send queue state (short)
    If the user names or job numbers or both are supplied then only those jobs for those users or with those numbers will be sent.


  • Send queue state (long)
    If the user names or job numbers or both are supplied then only those jobs for those users or with those numbers will be sent.


  • Remove jobs
    This command deletes the print jobs from the specified queue which are listed as the other operands. If only the agent is given, the command is to delete the currently active job. Unless the agent is "root", it is not possible to delete a job which is not owned by the user. This is also the case for specifying user names instead of numbers. That is, agent "root" can delete jobs by user name but no other agents can.


Receive job subcommands
These commands are processed when the line printer daemon has been given the receive job command. The daemon will continue to process commands until the connection is closed.

After a subcommand is sent, the client must wait for an acknowledgement from the daemon. A positive acknowledgement is an octet of zero bits. A negative acknowledgement is an octet of any other pattern.

LPD clients should be able to sent the receive data file and receive control file subcommands in either order. LPD servers must be able to receive the control file subcommand first and should be able to receive the data file subcommand first.


Control file lines
Each line of the control file consists of a single, printable ASCII character which represents a function to be performed when the file is printed. Interpretation of these command characters are case- sensitive. The rest of the line after the command character is the command's operand. No leading white space is permitted after the command character. The line ends with an ASCII new line.

Those commands which have a lower case letter as a command code are used to specify an actual printing request. The commands which use upper case are used to describe parametric values or background conditions.

Some commands must be included in every control file. These are 'H' (responsible host) and 'P' (responsible user). Additionally, there must be at least one lower case command to produce any output.

  • C - Class for banner page
    This command sets the class name to be printed on the banner page. The name must be 31 or fewer octets. The name can be omitted. If it is, the name of the host on which the file is printed will be used. The class is conventionally used to display the host from which the printing job originated. It will be ignored unless the print banner command ('L') is also used.


  • H - Host name
    This command specifies the name of the host which is to be treated as the source of the print job. The command must be included in the control file. The name of the host must be 31 or fewer octets.


  • I - Indent Printing
    This command specifies that, for files which are printed with the 'f', of columns given. (It is ignored for other output generating commands.) The identing count operand must be all decimal digits.


  • J - Job name for banner page
    This command sets the job name to be printed on the banner page. The name of the job must be 99 or fewer octets. It can be omitted. The job name is conventionally used to display the name of the file or files which were "printed". It will be ignored unless the print banner command ('L') is also used.


  • L - Print banner page
    This command causes the banner page to be printed. The user name can be omitted. The class name for banner page and job name for banner page commands must precede this command in the control file to be effective.


  • M - Mail When Printed
    This entry causes mail to be sent to the user given as the operand at the host specified by the 'H' entry when the printing operation ends (successfully or unsuccessfully).


  • N - Name of source file
    This command specifies the name of the file from which the data file was constructed. It is returned on a query and used in printing with the 'p' command when no title has been given. It must be 131 or fewer octets.


  • P - User identification
    This command specifies the user identification of the entity requesting the printing job. This command must be included in the control file. The user identification must be 31 or fewer octets.


  • S - Symbolic link data
    This command is used to record symbolic link data on a Unix system so that changing a file's directory entry after a file is printed will not print the new file. It is ignored if the data file is not symbolically linked.


  • T - Title for pr
    This command provides a title for a file which is to be printed with either the 'p' command. (It is ignored by all of the other printing commands.) The title must be 79 or fewer octets.


  • U - Unlink data file
    This command indicates that the specified file is no longer needed. This should only be used for data files.


  • W - Width of output
    This command limits the output to the specified number of columns for the 'f', 'l', and 'p' commands. It is ignored for other output generating commands.) The width count operand must be all decimal digits. It may be silently reduced to some lower value. The default value for the width is 132.


  • 1 - troff R font
    This command specifies the file name for the troff R font. This is the font which is printed using Times Roman by default.


  • 2 - troff I font
    This command specifies the file name for the troff I font. This is the font which is printed using Times Italic by default.


  • 3 - troff B font
    This command specifies the file name for the troff B font. This is the font which is printed using Times Bold by default.


  • 4 - troff S font
    This command specifies the file name for the troff S font. This is the font which is printed using Special Mathematical Font by default.


  • c - Plot CIF file
    This command causes the data file to be plotted, treating the data as CIF (CalTech Intermediate Form) graphics language.


  • d - Print DVI file
    This command causes the data file to be printed, treating the data as DVI (TeX output).


  • f - Print formatted file
    This command cause the data file to be printed as a plain text file, providing page breaks as necessary. Any ASCII control characters which are not in the following list are discarded: HT, CR, FF, LF, and BS.


  • g - Plot file
    This command causes the data file to be plotted, treating the data as output from the Berkeley Unix plot library.


  • k - Reserved for use by Kerberized LPR clients and servers.


  • l - Print file leaving control characters
    This command causes the specified data file to printed without filtering the control characters (as is done with the 'f' command).


  • n - Print ditroff output file
    This command prints the data file to be printed, treating the data as ditroff output.


  • o - Print Postscript output file
    This command prints the data file to be printed, treating the data as standard Postscript input.


  • p - Print file with 'pr' format
    This command causes the data file to be printed with a heading, page numbers, and pagination. The heading should include the date and time that printing was started, the title, and a page number identifier followed by the page number. The title is the name of file as specified by the 'N' command, unless the 'T' command (title) has been given. After a page of text has been printed, a new page is started with a new page number. (There is no way to specify the length of the page.)


  • r - File to print with FORTRAN carriage control
    This command causes the data file to be printed, interpreting the first column of each line as FORTRAN carriage control. The FORTRAN standard limits this to blank, "1", "0", and "+" carriage controls. Most FORTRAN programmers also expect "-" (triple space) to work as well.


  • t - Print troff output file
    This command prints the data file as Graphic Systems C/A/T phototypesetter input. This is the standard output of the Unix "troff" command.


  • v - Print raster file
    This command prints a Sun raster format file.


Top of Page

EXAMPLES

Top of Page


PROTOCOL RELATIONS
Parent layer
Child layer
TCP
LPD
Top of Page

GLOSSARY
ASCII
ASCII (American Standard Code for Information Interchange) is the most common format for text files in computers and on the Internet. In an ASCII file, each alphabetic, numeric, or special character is represented with a 7-bit binary number (a string of seven 0s or 1s). 128 possible characters are defined.

Unix and DOS-based operating systems use ASCII for text files. Windows NT and 2000 uses a newer code, Unicode. IBM's S/390 systems use a proprietary 8-bit code called EBCDIC. Conversion programs allow different operating systems to change a file from one code to another.

ASCII was developed by the American National Standards Institute (ANSI).

BSD
BSD (Berkeley Software Distribution) is the Unix derivative distributed by the University of California, Berkeley starting in the 1970s. The name is also used collectively for the modern descendants of these distributions.

Binary
Binary is pertaining to a number system that has just two unique digits. For most purposes, we use the decimal number system, which has ten unique digits, 0 through 9. All other numbers are then formed by combining these ten digits. Computers are based on the binary numbering system, which consists of just two unique numbers, 0 and 1. All operations that are possible in the decimal system (addition, subtraction, multiplication, division) are equally possible in the binary system.

Client
Clinet is a program which requests services of another program. It is a client part of a client-server architecture. Typically, a client is an application that runs on a personal computer or workstation and relies on a server to perform some operations. For example, an e-mail client is an application that enables you to send and receive e-mail.

Code
Written computer instructions. The term code is somewhat colloquial. For example, a programmer might say: "I wrote a lot of code this morning" or "There's one piece of code that doesn't work."

Code can appear in a variety of forms. The code that a programmer writes is called source code. After it has been compiled, it is called object code. Code that is ready to run is called executable code or machine code.

Command
Command is an instruction to a computer or device to perform a specific task. Commands come in different forms. They can be: special words (keywords) that a program understands, function keys
choices in a menu and buttons or other graphical objects on your screen

Every program that interacts with people responds to a specific set of commands. The set of commands and the syntax for entering them is called the user interface and varies from one program to another.

Daemon
Daemon is a process that runs in the background and performs a specified operation at predefined times or in response to certain events. The term daemon is a UNIX term, though many other operating systems provide support for daemons, though they're sometimes called other names. Windows, for example, refers to daemons as System Agents and services. Typical daemon processes include print spoolers, e-mail handlers, and other programs that perform administrative tasks for the operating system. The term comes from Greek mythology, where daemons were guardian spirits.

Data
* Distinct pieces of information, usually formatted in a special way. All software is divided into two general categories: data and programs. Programs are collections of instructions for manipulating data. Data can exist in a variety of forms -- as numbers or text on pieces of paper, as bits and bytes stored in electronic memory, or as facts stored in a person's mind. Strictly speaking, data is the plural of datum, a single piece of information. In practice, however, people use data as both the singular and plural form of the word.

* The term data is often used to distinguish binary machine-readable information from textual human-readable information. For example, some applications make a distinction between data files (files that contain binary data) and text files (files that contain ASCII data).

* In database management systems, data files are the files that store the database information, whereas other files, such as index files and data dictionaries, store administrative information, known as metadata.

LPD
LPD (Line printer daemon/line printer remote) is a printer protocol that uses TCP/IP to establish connections between printers and workstations on a network. The technology was developed originally for BSD UNIX and has since become the de facto cross-platform printing protocol.

LPRng
The application LPRng is an implementation of the Line Printer Daemon protocol (commonly known as the Berkeley printing system or LPR/LPD) that provides printer spooling and network print server functionality. It is an open-source project hosted on SourceForge and implemented by many open-source Unix-like operating systems.

Line printer
The Line printer is a form of high speed impact printer in which a line of type is printed at a time. Printed type is set at fixed positions and a line could consist of any number of character positions but 80 column, 128 column and 160 column variants were common.

Octet
An octet is 8 bits. It is equivalent to a byte, as long as the byte is also 8 bits. Bytes range from 4 - 10 bits, but octets are always 8 bits.

Port
Port is an interface on a computer to which you can connect a device. Personal computers have various types of ports. Internally, there are several ports for connecting disk drives, display screens, and keyboards. Externally, personal computers have ports for connecting modems, printers, mice, and other peripheral devices.

Almost all personal computers come with a serial RS-232C port or RS-422 port for connecting a modem or mouse and a parallel port for connecting a printer. On PCs, the parallel port is a Centronics interface that uses a 25-pin connector. SCSI (Small Computer System Interface) ports support higher transmission speeds than do conventional ports and enable you to attach up to seven devices to the same port.

Process
(n) An executing program. The term is used loosely as a synonym of task.
(v) To perform some useful operations on data.

Server
A computer or device on a network that manages network resources. For example, a file server is a computer and storage device dedicated to storing files. Any user on the network can store files on the server. A database server is a computer system that processes database queries. Servers are often dedicated, meaning that they perform no other tasks besides their server tasks. On multiprocessing operating systems, however, a single computer can execute several programs at once. A server in this case could refer to the program that is managing resources rather than the entire computer.

Spooling
Spooling is an acronym for simultaneous peripheral operations on-line (although this is thought by some to be a backronym). It refers to putting jobs in a buffer, a special area in memory, or on a disk where a device can access them when it is ready. This is similar to a sewing machine spool, which a person puts thread onto, and a machine pulls at its convenience.

TCP
TCP (Transmission Control Protocol) is one of the main protocols in TCP/IP networks. TCP is one of the main protocols in TCP/IP networks. Whereas the IP protocol deals only with packets, TCP enables two hosts to establish a connection and exchange streams of data. TCP guarantees delivery of data and also guarantees that packets will be delivered in the same order in which they were sent.

Unix
Unix or UNIX is a computer operating system originally developed in the 1960s and 1970s by a group of AT&T Bell Labs employees including Ken Thompson, Dennis Ritchie, and Douglas McIlroy. Today's Unix systems are split into various branches, developed over time by AT&T, several other commercial vendors, as well as several non-profit organizations.

Top of Page

REFERENCES
RFCs:
[RFC 1179] Line printer daemon protocol.
                


Top of Page

OTHER PROTOCOLS OF TCP/IP SUITE
AARP   RRP   RTP Video   RTP Audio   RTP   COPS   Gopher   HSRP   ICP   MPLS   IEEE 802.2   CIP   FTP - Data   FTP - Ctrl   IMAPS   IP Fragment   LDAPS   PUP   MSSQL   RSH   SQL   POP3s   RTELNET   RSVP   STP   VLAN   MSN   H.323   MSRDP   HTTPS   WINS   LPD   GTP   ICMPv6   POP   TELNET   H.225   VRRP   PIM   RARP   SAP   OSPF   RLOGIN   SCTP   SIP   RTCP   PPPoE   Mobile IP   IMAP3   WhoIs   SLP   NCP   PPTP   MGCP   LDAP   L2TP   Kerberos   IPv6   GRE   Ethernet SNAP   AFP   CIFS   IEEE 802.3   Finger   NBDGM   NetBEUI   NBSSN   ESP   EIGRP   EGP   DHCP   CGMP   CDP   BOOTP   AH   NBNS   EthernetII   ICQ   PPP   ARP   RIP   IPX   IGRP   IGMP   SSH   RPC   NetBIOS   TFTP   SNMP   SNA   SMB   RADIUS   NTP   NNTP   UDP   TCP   BGP   DNS   SOCKS   IMAP   RTSP   NFS   ICMP   IP   FTP   Telnet   POP3   SMTP   HTTP  
Search RFCs:

Advanced Search
Search Glossary:
Exact search
Fuzzy search


All Protocols
Submit a Request

Recommend an Article

 Layer 7 Application Layer
  AFP
  BOOTP
  CIFS
  CIP
  COPS
  DHCP
  DNS
  Finger
  FTP
  FTP - Ctrl
  FTP - Data
  Gopher
  HSRP
  HTTP
  HTTPS
  ICP
  ICQ
  IMAP
  IMAP3
  IMAPS
  Kerberos
  LPD
  MGCP
  MSN
  MSRDP
  MSSQL
  NCP
  NFS
  NNTP
  NTP
  POP
  POP3
  POP3s
  RADIUS
  RLOGIN
  RRP
  RSH
  RTCP
  RTELNET
  RTP
  RTP Audio
  RTP Video
  RTSP
  SAP
  SIP
  SLP
  SMB
  SMTP
  SNA
  SNMP
  SOCKS
  SSH
  Telnet
  TELNET
  TFTP
  WhoIs
  WINS
 Layer 6 Presentation Layer
  NBNS
  NBSSN
  NCP
  NetBIOS
 Layer 5 Session Layer
  LDAP
  LDAPS
  NCP
  NetBEUI
  RPC
 Layer 4 Transport Layer
  H.225
  H.323
  NBDGM
  NetBEUI
  PUP
  SCTP
  TCP
  UDP
 Layer 3 Network Layer
  AARP
  AH
  BGP
  EGP
  EIGRP
  ESP
  GRE
  GTP
  ICMP
  ICMPv6
  IGMP
  IGRP
  IP
  IP Fragment
  IPv6
  IPX
  Mobile IP
  MPLS
  OSPF
  PIM
  PPPoE
  RIP
  RSVP
  STP
  VRRP
 Layer 2 Data Link Layer
  ARP
  CDP
  CGMP
  Ethernet SNAP
  EthernetII
  IEEE 802.2
  IEEE 802.3
  L2TP
  PPP
  PPTP
  RARP
  SQL
  VLAN
 Layer 1 Physical Layer
© 2006 - 2007 Colasoft Co., Ltd. All rights reserved.