[comp.unix.wizards] 4.2BSD LPR Spooler Protocol

merlin@hqda-ai.UUCP (04/01/87)

     I need some help.  I have a Sun 3/160 running 4.2BSD.  It's
connected to a Symbolics Lisp machine via an ethernet.  The
Symbolics is naked, but the Sun has a printer.  I'd like to get
the Symbolics to print using the UCB spooler system.

     I have been able to get the TCP connections properly
configured, but I'm having trouble with the protocol.  The manuals
say that the valid requests to the lp daemon are:

1:   ^A printer	    	 Search for and print jobs for "printer"
2:   ^B printer	    	 Accept a new job for "printer"
3:   ^C printer [users...] [jobs...]
     	       	    	 Short list of current queue state
4:   ^D printer [users...] [jobs...]
     	       	    	 Long list of current queue state
5:   ^E printer person [users...] [jobs...]
     	       	    	 Remove jobs from queue

     I'm most interested in number 2, but it might be nice to
implement the others, as well.  I don't have any further
documentation on what, exactly, the protocol is.  Obviously
something follows most of these commands, but I don't know what.

     Is there anyone out there who has documentation on this?  If
so, and you'd be willing to mail it to me, please let me know.
(Don't just mail it off, 'cause I don't want to waste bandwidth
with 20 copies of the same document.)

     Eternally perplexed,
-- 
David S. Hayes, The Merlin of Avalon	PhoneNet:  (202) 694-6900
UUCP:  *!seismo!sundc!hqda-ai!merlin	ARPA:  merlin%hqda-ai.uucp@brl.arpa

krishnan@sunybcs.UUCP (04/03/87)

These are the comments I extracted from the program I wrote for printing
from a Lisp Machine ( Symbolics or TI's ) to a printer on a Unix machine.
The top level interface was designed by Bill Baxter.



;;; The 4.3 BSD line printer protocol is described below. This is implemented
;;; by the function lpd
;;;
;;; The lisp machine is a client which talks with the Unix machine through 
;;; the lpd port # 515 and a local port 515. The  local port number should 
;;; less than 1023 for "lpd" on the Unix machine to acknowledge the request.
;;;
;;; The following protocol is followed for each of the necessary operations
;;; while sending a job to be queued.
;;;
;;; Printing a file "lpr" ::
;;;
;;;            1) Send the string "^Bprinter\n"
;;;            2) Check for a response of 0 from the Unix machine
;;;            3) Send the data file over using the sub-protocol described below.
;;;               3.1) Send the string "^C<no-of-bytes> <file-name>\n"
;;;               3.2) Send the data file
;;;               3.3) Check for a response of 0 from the Unix machine
;;;            4) Send the control file using the same sub-protocol
;;;
;;;
;;; Checking the queue "lpq" ::
;;;
;;;            1) Send the string "^Cprinter\n"
;;;
;;; Checking the queue more thoroughly "lpq -l" ::
;;;
;;;            1) Send the string "^Dprinter\n"
;;;
;;; Removing jobs from a queue "lprm"
;;;
;;;            1) Send the string "^Eprinter person job-number\n"
;;;
;;; Note that you cannot remove a remote job unless the request comes from the
;;; machine where the print request was originally made
;;;
;;; This program does not incorporate a local queue and relies on the
;;; queue of the Unix machine.
;;;
;;; Examples:
;;;
;;;    Lpr file-name qms ellie :landscape ( t/nil )
;;;
;;; The program keeps track of the default file name, the default-host, and the
;;; default-printer. Once a command has been issued with the the necessary keyword
;;; parameters, the default parameters are updated suitably. 
;;;
;;; Now the user can simply type
;;;
;;; Lpr 
;;;
;;; to print the file again.
;;;
;;; To display the queue, the user can simply type
;;;
;;; Lpq
;;;
;;; The default host name, and the default printer are "ellie" and "qms" 
;;; "qms" respectively until they are explicitly changed by invoking the
;;; function with a keyword parameter
;;;
;;; To remove this job from the queue, the user can type
;;;
;;; Lprm
;;;
;;; The job number is understood to be the last job spooled
;;;
;;;
;;; Job numbers can be explicitly specified by typing
;;;
;;; Lprm :job <job-number>
;;;


There is a security problem if you want to control access to printers.
This arises because, the Unix host has to make the symbolics a trusted
host for printing by including it in the "hosts.lpd" file. We are
currently working on a solution to that problem.

			G. Krishnan




--------------
UUCP   : {cmc12,hao,harpo}!seismo!rochester!rocksvax!sunybcs!krishnan
         ...{allegra,decvax,watmath}!sunybcs!krishnan
CSNET  :  krishnan@buffalo
ARPA   :  krishnan%buffalo@csnet-relay
BITNET :  krishnan@sunybcs
--------------