source: trunk/third/lprng/doc/LPRng-HOWTO-18.html @ 14517

Revision 14517, 36.8 KB checked in by mwhitson, 25 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14516, which included commits to RCS files with non-trunk default branches.
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2<HTML>
3<HEAD>
4 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
5 <TITLE> LPRng-HOWTO: RFC 1179 - Line Printer Daemon Protocol</TITLE>
6 <LINK HREF="LPRng-HOWTO-19.html" REL=next>
7 <LINK HREF="LPRng-HOWTO-17.html" REL=previous>
8 <LINK HREF="LPRng-HOWTO.html#toc18" REL=contents>
9</HEAD>
10<BODY>
11<A HREF="LPRng-HOWTO-19.html">Next</A>
12<A HREF="LPRng-HOWTO-17.html">Previous</A>
13<A HREF="LPRng-HOWTO.html#toc18">Contents</A>
14<HR>
15<H2><A NAME="rfc1179ref"></A> <A NAME="s18">18. RFC 1179 - Line Printer Daemon Protocol</A></H2>
16
17<P>RFC1179 can be obtained from the LPRng distribution, in the LPRng_DOC/rfc1179 directory,
18or from one of many sites which mirror the RFCs.
19<P>This RFC is an <EM>informational</EM> RFC,
20which means that the information in it is meant as a guide to users,
21and not as a fixed standard.
22In addition,
23the RFC tried to document the behavior of the BSD LPD print server,
24and left out many details dealing with error recover,
25error messages,
26extensions to the protocol,
27etc.
28<P>In this section,
29I will try to explain what RFC1179 specifies as a protocol,
30and many of the problems encountered in trying to use it.
31<H2><A NAME="socketlinger"></A> <A NAME="retrynolink"></A> <A NAME="retryeconnrefused"></A> <A NAME="reuseaddr"></A> <A NAME="originateport"></A> <A NAME="lpdport"></A> <A NAME="ss18.1">18.1 Ports and Connections</A>
32</H2>
33
34<P>Options used:
35<UL>
36<LI> <CODE>lpd_port=</CODE><EM>Port for LPD to accept connection</EM></LI>
37<LI> <CODE>originate_port=</CODE><EM>Ports to originate connections on</EM></LI>
38<LI> <CODE>reuse_addr</CODE><EM>&nbsp;&nbsp;Set SO_REUSEADDR flag on connection</EM></LI>
39<LI> <CODE>retry_econnrefused</CODE><EM>&nbsp;&nbsp;Retry on connect ECONNREFUSED error</EM></LI>
40<LI> <CODE>retry_nolink</CODE><EM>&nbsp;&nbsp;Retry on device open or connection ffailure</EM></LI>
41<LI> <CODE>socket_linger#</CODE><EM>&nbsp;&nbsp;Linger time for sockets</EM></LI>
42</UL>
43<P>RFC1179 requires that the <CODE>lpd</CODE> server listen for TCP/IP connections
44on port 515.
45This port is registered with the Internet Naming Authority,
46and the <CODE>/etc/services</CODE> file or TCP/IP services database usually has an entry:
47<BLOCKQUOTE><CODE>
48<PRE>
49printer     515/tcp     spooler     # line printer spooler
50</PRE>
51</CODE></BLOCKQUOTE>
52<P>RFC1179 explicitly states that all connections to port 515 must originate from
53ports 721-731.
54The reason for this restriction is due to the UNIX concept of <EM>reserved</EM>
55and <EM>privileged</EM> ports.
56By convention,
57ports in the range 1-1023 can only <B>bound</B> by processes whose Effective User ID (EUID)
58is 0 (root).
59This,
60ordinary users could not originate a connection from the reserved or privileged port range.
61<P>In a UNIX environment,  this means that the user programs
62<CODE>lpr</CODE>,
63<CODE>lprm</CODE>,
64<CODE>lpq</CODE>,
65and
66<CODE>lpc</CODE>
67would have to be SETUID root.
68<P>As experience has shown, for security purposes,
69the fewer programs that need to have privileged status,
70the better.
71LPRng uses the
72<CODE>lpd_port=printer</CODE> configuration option to set the actual port to be use.
73By default, this is port 515, but can be set to other values.
74<P>The restriction of originating ports to 721-731 causes another set of problems.
75Part of the TCP/IP protocol is concerned with avoiding communications problems
76resulting from the arrival of old or <EM>stale</EM> packets.
77When a connection between
78<CODE>sourcehost, sourceport</CODE> and <CODE>desthost, destport</CODE>
79is made,
80a set of sequence numbers is established and used for sending and acknowledgement of data.
81When the connection terminates,
82the TCP/IP protocol restricts the establishment of a new connection between
83<CODE>sourcehost, sourceport</CODE> and <CODE>desthost, destport</CODE> for a period long
84enough for all <EM>stale</EM> packets to be removed from the system.
85This is approximately 10 minutes long.
86<P>In order to simplify assignments of ports,
87timing out connections, and other matters,
88many TCP/IP packages do keep track of explicit connections
89<EM>originating</EM> from a port,
90but simply prevent the port from being reused for either origination
91or reception of a connection.
92They do,
93however,
94keep track of the active connections <B>to</B> a port,
95and perform timeouts on these.
96This is usually much simpler to implement,
97as it can be done with a list attached to the port.
98<P>This implementation method creates some problems when
99a large number of connections must be originated from a
100relatively small number of port numbers.
101Observe what happens when host 1 tries to send a large number of jobs to a server 2.
102The following connections are established and terminated:<BR>
103<CODE>host 1, port 721</CODE> and <CODE>host 2, port 515</CODE><BR>
104<CODE>host 1, port 722</CODE> and <CODE>host 2, port 515</CODE><BR>
105<CODE>host 1, port 723</CODE> and <CODE>host 2, port 515</CODE><BR>
106<CODE>host 1, port 724</CODE> and <CODE>host 2, port 515</CODE><BR>
107<CODE>host 1, port 725</CODE> and <CODE>host 2, port 515</CODE><BR>
108<CODE>host 1, port 726</CODE> and <CODE>host 2, port 515</CODE><BR>
109<CODE>host 1, port 727</CODE> and <CODE>host 2, port 515</CODE><BR>
110<CODE>host 1, port 728</CODE> and <CODE>host 2, port 515</CODE><BR>
111<CODE>host 1, port 729</CODE> and <CODE>host 2, port 515</CODE><BR>
112<CODE>host 1, port 730</CODE> and <CODE>host 2, port 515</CODE><BR>
113<CODE>host 1, port 731</CODE> and <CODE>host 2, port 515</CODE>
114<P>Now according to the RFC1179 rules and the TCP/IP protocol,
115we will have to wait until one of these connections terminates before we
116can make another.
117On the originating system,
118if the TCP/IP implementation does timeouts on the originating port,
119we will have to wait for the timeout to elapse before we can make a new
120connection.
121Unfortunately,  there is no way to find out what the status of the port
122is,  so we will have to try them each in turn until we get
123a successful connection.
124<P>The LPRng code has tried to provide several methods to deal with
125these problems.
126Firstly,
127the
128<CODE>originate_port=512 1023</CODE>
129option specifies the range
130of ports used to originate connections
131when the software is running either as ROOT or SETUID root.
132By strict RFC1179 rules,
133this should be
134<CODE>originate_port=721 731</CODE>,
135but it turns out that most BSD LPD based implementations only
136check for a <EM>reserved</EM> originating port.
137By using 512 ports we get a greatly reduced rate of errors due
138to lack of ports due to pending timeouts.
139<P>However,
140on some systems which are acting as servers for a large number of
141printers even increasing this port range is insufficient,
142and steps need to be taken use the originating port numbers
143more efficiently.
144The Berkeley TCP/IP implementation
145<CODE>getsockopt()</CODE>
146and
147<CODE>setsockopt()</CODE>
148allows the user to manipulate some of the underlying timeouts and options
149of the TCP/IP network.
150When a TCP/IP connection is established,
151the
152<CODE>setsockopt()</CODE>
153facility can be used to set the
154<CODE>SO_REUSEADDR</CODE>
155flag on the connection.
156This flag effectively sets the timeout value on the ports
157and connections to 0,
158allowing immediate reuse of the ports.
159When done on an originating end of a connection,
160this will allow the originating port number to be reused immediately.
161<P>It would appear that by setting
162<CODE>SO_REUSEADDR</CODE>
163on the originating end that we have solved our problems.
164However,
165unless the destination end of the connection sets its
166<CODE>SO_REUSEADDR</CODE>
167flag on the connection,
168it will still do a timeout.
169Thus when we try to make a connection from a port
170that was active within a short period of time to the
171same host,
172then it will reject the connection until the
173timeout is over.
174<P>The
175<CODE>reuse_addr</CODE>
176flag (default off) forces
177the LPRng software to set the
178<CODE>SO_REUSEADDR</CODE>
179flag on originating connections.
180As indicated,
181this will allow ports to be reused immediately for outgoing connections,
182rather than waiting for a timeout.
183<P>While the
184<CODE>reuse_addr</CODE>
185flag usually allows us to reuse ports,
186there is still the problem of dealing with connections failing due to the
187remote site rejecting the connection due to a pending timeout
188from a previous connection.
189A careful study of the original BSD TCP/IP network code and of some
190others indicates that when a connection fails due to a pending timeout,
191an ECONNREFUSED error code is returned to a
192<CODE>connect()</CODE> system call.
193If this happens and we suspect that the remote site is rejecting
194the connection due to a timeout problem,
195then we should retry making the connection but from a new port,
196and continue retrying until all possible ports are used.
197<P>The <CODE>retry_econnrefused</CODE> (default on) flag is used to
198specify that we retry connections in this manner.
199When this is set,
200a <CODE>connection refused</CODE>
201error causes the connection to be retried using a new port.
202This will be repeated until all available ports have been tried.
203<P>When
204printing a job and the <CODE>lpd</CODE> server connection to a remote
205site or device open fails,
206the <CODE>retry_nolink</CODE> (default on)
207will cause the attempt to be retried indefinitely.
208The combination of <CODE>retry_econnrefused</CODE> and <CODE>retry_nolink</CODE>
209will provide robust connection attempts to remote systems.
210<P>While the above problems cause difficulties when making connections,
211there are also problems when terminating connections.
212After closing a socket,
213the TCP/IP software will try to flush any pending data to the destination.
214Unfortunately,
215on some systems it will only do this while the process is active.
216This has caused problems on systems which terminate
217a process it has received an abnormal (signal caused) termination.
218<P>The <CODE>setsockopt()</CODE> SO_LINGER option allows the user to specify
219that when a socket is closed normally,
220that the process should block until pending data is flushed or
221for the <CODE>socket_linger</CODE> period.
222If <CODE>socket_linger</CODE> is 0,
223then no SO_LINGER operation is done.
224<P>In summary, if you experience problems with connection failures due
225to port exhaustion,
226first try setting the
227<CODE>reuse_port</CODE> flag,
228and you should see a reduction.
229Check to ensure that the <CODE>retry_econnrefused</CODE>
230and <CODE>retry_nolink</CODE> flags are set,
231and the error code in the log and status files.
232If the failures continue,  then the problem is caused by the
233remote end having timeout limitations and there is little you
234can do except to set a very long <CODE>connect_retry</CODE>
235interval, say <CODE>connect_retry=120</CODE> (2 minutes).
236<H2><A NAME="remotesupport"></A> <A NAME="ss18.2">18.2 Protocol Requests and Replies</A>
237</H2>
238
239<P>Options used:
240<UL>
241<LI> <CODE>remote_support=</CODE><EM>Remote operations supported</EM></LI>
242</UL>
243<P>After a connection has been established,
244a request can be sent to the <CODE>lpd</CODE>
245server.
246The request consists of a single octet indicating the request type,
247followed by the printer (or print queue) name, followed by
248a set of options for the request,
249followed by a LF (line feed) character.
250<BLOCKQUOTE><CODE>
251<PRE>
252\NNNprinter[ options]\n
253  NNN    Operation
254</PRE>
255</CODE></BLOCKQUOTE>
256<P>
257<CENTER><TABLE BORDER><TR><TD>
258<BR>
259NNN</TD><TD>RFC1179</TD><TD>Operation</TD><TD>program</TD></TR><TR><TD>
2601</TD><TD>yes</TD><TD>start print</TD><TD><CODE>lpc</CODE></TD></TR><TR><TD>
2612</TD><TD>yes</TD><TD>transfer a printer job</TD><TD><CODE>lpr</CODE></TD></TR><TR><TD>
2623</TD><TD>yes</TD><TD>print short form of queue status</TD><TD><CODE>lpq</CODE></TD></TR><TR><TD>
2634</TD><TD>yes</TD><TD>print long form of queue status</TD><TD><CODE>lpq</CODE></TD></TR><TR><TD>
2645</TD><TD>yes</TD><TD>remove jobs</TD><TD><CODE>lprm</CODE></TD></TR><TR><TD>
2656</TD><TD>LPRng</TD><TD>do control operation</TD><TD><CODE>lpc</CODE></TD></TR><TR><TD>
2667</TD><TD>LPRng</TD><TD>transfer a block format print job</TD><TD><CODE>lpr</CODE></TD></TR><TR><TD>
2678</TD><TD>LPRng</TD><TD>secure command transfer</TD><TD><CODE>lpc</CODE></TD></TR><TR><TD>
2689</TD><TD>LPRng</TD><TD>verbose status information</TD><TD><CODE>lpq</CODE></TD></TR><TR><TD>
269
270</TD></TR></TABLE></CENTER>
271<P>After the request has been sent,
272then a reply will be returned.
273In general the reply has the following form:
274<BLOCKQUOTE><CODE>
275<PRE>
276\000\n    Success
277\NNN\n    Failure (NNN is error code)
278text\n    Text or status information
279</PRE>
280</CODE></BLOCKQUOTE>
281<P>As can be seen,
282this protocol is extremely simple,
283but there are a set of problems due to the loosely written language of RFC1179.
284<OL>
285<LI>Firstly,
286while RFC1179 sets limits on the lengths of commands,
287it does not strictly set limits on the characters set used in the commands.
288This can result in problems when trying to print status information,
289headers on banners,
290and other details.</LI>
291<LI>The original RFC1179 protocol did not provide any way to do remote control
292of queues or LPD servers.
293This has been added to the protocol.
294As a side effect,
295if you try to use
296<CODE>lpc</CODE> to control a non-LPRng printer,
297it will not work.</LI>
298<LI>You can specify that a network printer is non-LPRng by using the
299<CODE>remote_support=RQVMC</CODE> option and specify the operations
300supported by the printer.
301The letters R, Q, V, M, and C stand for
302<CODE>lpr</CODE>,
303<CODE>lpq</CODE>,
304<CODE>lpq -v</CODE> (verbose),
305verbose <CODE>lpq</CODE>,
306<CODE>lprm</CODE>,
307and <CODE>lpc</CODE> operations respectively,
308and indicate that these are supported.
309If <CODE>remote_support</CODE> does not allow a particular operation,
310then the LPRng software will not send a corresponding request to the printer.
311For example,
312<CODE>remote_support=R</CODE>
313would restrict operations to spooling jobs only,
314and the LPRng software would not query the printer for status.</LI>
315</OL>
316<H2><A NAME="useshorthost"></A> <A NAME="longnumber"></A> <A NAME="senddatafirst"></A> <A NAME="ss18.3">18.3 Job Transfer</A>
317</H2>
318
319<P>Options used:
320<UL>
321<LI> <CODE>longnumber</CODE><EM>&nbsp;&nbsp;Long job number (6 digits)</EM></LI>
322<LI> <CODE>send_data_first</CODE><EM>&nbsp;&nbsp;Send data files first</EM></LI>
323<LI> <CODE>use_shorthost</CODE><EM>&nbsp;&nbsp;Use short hostname</EM></LI>
324</UL>
325<P>A job transfer operation starts with a job transfer request,
326followed by several file transfer operations.
327At the end of the file transfers,
328the connection should be closed.
329<P>A file transfer request has the form:
330<CENTER><TABLE BORDER><TR><TD>
331<BR>
332Command</TD><TD>Purpose</TD></TR><TR><TD>
333\001\n</TD><TD>abort</TD></TR><TR><TD>
334\002nnnn cfname</TD><TD>control file transfer</TD></TR><TR><TD>
335\003nnnn dfname</TD><TD>data file transfer</TD></TR><TR><TD>
336
337</TD></TR></TABLE></CENTER>
338<P>The abort operation is used to terminate job transfer and indicate that
339the job should not be processed for printing.
340The connection will be closed and the partly transferred job
341will be discarded.
342<P>The control file and data file transfer commands have a length (in bytes)
343of the file and the name of the file to be transferred.
344When the command is received,
345the server will reply with a status line:
346<CENTER><TABLE BORDER><TR><TD>
347<BR>
348Status</TD><TD>Purpose</TD></TR><TR><TD>
349\000</TD><TD>Accepted, proceed</TD></TR><TR><TD>
350\nnn</TD><TD>Rejected with error code</TD></TR><TR><TD>
351
352</TD></TR></TABLE></CENTER>
353<P>The reply is only a single octet.
354Some defective implementations of RFC1179 send a LF after the octet,
355which makes life very difficult.
356LPRng makes an effort to detect these non-conforming RFC1179 systems
357and will accept jobs from them.
358However,  it will not send jobs to them.
359<P>If LPRng sends a reject code, as an extension to RFC1179 it also
360sends an error message.   Note that the values for error codes
361are not defined,
362nor are their causes.
363LPRng uses the following values for error codes,
364which appear to be compatible with many,
365but not all, of the BSD LPD based systems:
366<CENTER><TABLE BORDER><TR><TD>
367<BR>
368Code</TD><TD>Error</TD></TR><TR><TD>
369\000</TD><TD>Accepted, proceed</TD></TR><TR><TD>
370\001</TD><TD>Queue not accepting jobs</TD></TR><TR><TD>
371\002</TD><TD>Queue temporarily full, retry later</TD></TR><TR><TD>
372\003</TD><TD>Bad job format, do not retry</TD></TR><TR><TD>
373
374</TD></TR></TABLE></CENTER>
375<P>When the sender gets the reply indicating success,
376it sends the <CODE>nnnn</CODE> bytes of the control or data file,
377followed by a <CODE>\000</CODE> octet.
378The receiver will then reply as above;
379a single <CODE>\000</CODE> octet indicating success.
380<P>The above procedure is carried out until all data files and the control
381file of a job are transferred.
382<P>RFC1179 is silent on the following issues:
383<OL>
384<LI>When sending a job,
385do you send the control file first, followed by the data file(s),
386or the data files first?</LI>
387<LI>When sending multiple jobs,
388can you send them on a single connection,
389or do you have to establish a new connection for each job?</LI>
390</OL>
391<P>LPRng will <EM>accept</EM> jobs whether they are sent control or data files
392first.
393By default,
394it sends the control file first,
395followed by the data file.
396If the destination system requires that the data files
397be sent first,
398the <CODE>send_data_first</CODE> printcap option can be used to force
399data files to be sent first.
400<P>RFC1179 states that:
401<BLOCKQUOTE>
402The name of the control file ... should start with ASCII "cfA", followed by a three
403digit job number, followed by the host name which has constructed the
404control file.
405</BLOCKQUOTE>
406<P>The <EM>should</EM> in this wording indicates that this is simply a guideline,
407and that other formats are possible.
408Some of the major problems with this format are as follows:
409<OL>
410<LI> The restriction to 3 digits means that at most 1000 jobs
411can be in a queue.
412Strangely,  some systems generate far more than 1000 jobs a day,
413and need to archive them on a regular basis.
414The <CODE>longnumber</CODE> option will allow LPRng to use a 6 digit
415job number for files in the print queue.</LI>
416<LI>The host name format is not specified.
417Some implementations consider that this is the short host name,
418while others think it is the fully qualified domain name (FQDN).
419LPRng,
420by default,
421will use the FQDN host name.
422However,  the <CODE>use_shorthost</CODE> option will force it to
423use short host names in control and data files.</LI>
424<LI>The <CODE>cfA</CODE> control file name was modified to allow the
425job priority to be used as the A letter of the control file.
426By default,
427this is A (lowest, i.e. <CODE>cfA</CODE>) and
428but can range to Z (highest, i.e. <CODE>cfZ</CODE>).
429All known spoolers except LPRng seem to ignore the actual value of
430the letter.</LI>
431</OL>
432<H2><A NAME="ss18.4">18.4 Data File Transfer</A>
433</H2>
434
435<P>As discussed,
436a data file is transferred using the command below.
437<CENTER><TABLE BORDER><TR><TD>
438<BR>
439Command</TD><TD>Purpose</TD></TR><TR><TD>
440\003nnnn dfname</TD><TD>data file transfer</TD></TR><TR><TD>
441
442</TD></TR></TABLE></CENTER>
443<P>From RFC1179:
444<BLOCKQUOTE>
445The data file may contain any 8 bit values at all.  The total number
446of bytes in the stream may be sent as the first operand, otherwise
447the field should be cleared to 0.  The name of the data file should
448start with ASCII "dfA".  This should be followed by a three digit job
449number.  The job number should be followed by the host name which has
450constructed the data file.  Interpretation of the contents of the
451data file is determined by the contents of the corresponding control
452file.
453</BLOCKQUOTE>
454<P>There are several surprises in RFC1179.
455<OL>
456<LI>Apparently a job should only consist of a single data file.
457This is a severe limitation,  and in fact the BSD LPR and other
458print spoolers process jobs with multiple data files.
459By convention, these data files have names of the form
460<CODE>dfA</CODE>,
461<CODE>dfB</CODE>,
462...
463<CODE>dfZ</CODE>,
464<CODE>dfa</CODE>,
465<CODE>dfz</CODE>.</LI>
466<LI>The RFC does not specify that the control file and data file job numbers
467must be identical.
468Most implementations follow this convention, which simplifies life
469tremendously.</LI>
470<LI>The RFC does not specify that the control file and data file job host names
471must be identical.
472Most implementations follow this convention, which simplifies life
473tremendously.</LI>
474<LI>A zero length data file does not cause a data transfer to take place.
475LPRng modifies this action to be slightly different.
476When a zero length data file transfer is indicated,
477all of the input until the connection is closed is used as the
478contents of the data file.
479<P>When 'piping' into the <CODE>lpr</CODE> program,
480this can be very useful as it eliminates the need to create temporary
481files on the senders host.
482The <CODE>lpr -k</CODE> option for details.
483Note that some print spoolers do not use this interpretation,
484and this option should be used carefully.
485</LI>
486</OL>
487<H2><A NAME="ss18.5">18.5 Control File Contents</A>
488</H2>
489
490<P>The control file consists of a set of lines which either provide
491printing information or specify data files to be printed.
492The information lines start with upper case letters or digits,
493while the data files lines start with lower case letters.
494Here is a sample control file:
495<BLOCKQUOTE><CODE>
496<PRE>
497Hastart4.astart.com
498J(stdin)
499CA
500Lpapowell
501Apapowell@astart4+955
502Ppapowell
503fdfA955astart4.astart.com
504N(stdin)
505UdfA955astart4.astart.com
506</PRE>
507</CODE></BLOCKQUOTE>
508<P>The following are the letters and their meanings in the control file.
509<CENTER><TABLE BORDER><TR><TD>
510<BR>
511X</TD><TD>RFC1179</TD><TD>Meaning</TD></TR><TR><TD>
512A</TD><TD>LPRng</TD><TD>Identifier for job</TD></TR><TR><TD>
513C</TD><TD>RFC1179</TD><TD>Class for banner page</TD></TR><TR><TD>
514H</TD><TD>RFC1179</TD><TD>Host name</TD></TR><TR><TD>
515I</TD><TD>RFC1179</TD><TD>Indent Printing</TD></TR><TR><TD>
516J</TD><TD>RFC1179</TD><TD>Job name for banner page</TD></TR><TR><TD>
517L</TD><TD>RFC1179</TD><TD>Print banner page</TD></TR><TR><TD>
518M</TD><TD>RFC1179</TD><TD>Mail When Printed</TD></TR><TR><TD>
519N</TD><TD>RFC1179</TD><TD>Name of source file</TD></TR><TR><TD>
520P</TD><TD>RFC1179</TD><TD>User identification</TD></TR><TR><TD>
521Q</TD><TD>LPRng</TD><TD>Queue name</TD></TR><TR><TD>
522R</TD><TD>LPRng</TD><TD>Accounting info</TD></TR><TR><TD>
523S</TD><TD>RFC1179</TD><TD>Symbolic link data</TD></TR><TR><TD>
524T</TD><TD>RFC1179</TD><TD>Title for pr</TD></TR><TR><TD>
525U</TD><TD>RFC1179</TD><TD>Unlink data file</TD></TR><TR><TD>
526W</TD><TD>RFC1179</TD><TD>Width of output</TD></TR><TR><TD>
527Z</TD><TD>LPRng</TD><TD>Filter options</TD></TR><TR><TD>
5281</TD><TD>RFC1179</TD><TD>troff R font</TD></TR><TR><TD>
5292</TD><TD>RFC1179</TD><TD>troff I font</TD></TR><TR><TD>
5303</TD><TD>RFC1179</TD><TD>troff B font</TD></TR><TR><TD>
5314</TD><TD>RFC1179</TD><TD>troff S font</TD></TR><TR><TD>
532c</TD><TD>RFC1179</TD><TD>Plot CIF file</TD></TR><TR><TD>
533d</TD><TD>RFC1179</TD><TD>Print DVI file</TD></TR><TR><TD>
534f</TD><TD>RFC1179</TD><TD>Print formatted file</TD></TR><TR><TD>
535g</TD><TD>RFC1179</TD><TD>Plot file</TD></TR><TR><TD>
536k</TD><TD>RFC1179</TD><TD>Reserved for use by Kerberized LPR clients and servers.</TD></TR><TR><TD>
537l</TD><TD>RFC1179</TD><TD>Print file leaving control characters</TD></TR><TR><TD>
538n</TD><TD>RFC1179</TD><TD>Print ditroff output file</TD></TR><TR><TD>
539o</TD><TD>RFC1179</TD><TD>Print Postscript output file</TD></TR><TR><TD>
540p</TD><TD>RFC1179</TD><TD>Print file with 'pr' format</TD></TR><TR><TD>
541t</TD><TD>RFC1179</TD><TD>Print troff output file</TD></TR><TR><TD>
542v</TD><TD>RFC1179</TD><TD>Print raster file</TD></TR><TR><TD>
543z</TD><TD>RFC1179</TD><TD>Reserved for future use with the Palladium print system.</TD></TR><TR><TD>
544
545</TD></TR></TABLE></CENTER>
546<P>The
547<CODE>A</CODE> (Identifier)
548line was introduced to record a unique
549system wide job identifier for LPRng submitted jobs.
550This is basically formed from the user name,
551job number, and host at the time of submission.
552For example: <CODE>papowell@astart4+955</CODE>
553is job number 995 submitted by papowell from host astart4.
554<P>The
555<CODE>C</CODE> (Class)
556line is set by the <CODE>lpr -C class</CODE> option,
557and the value can be used to control printing.
558For example,
559the <CODE>lpc class zone </CODE> command would restrict job printing to
560only jobs with class <CODE>zone</CODE>.
561<P>The
562<CODE>H</CODE> (hostname),
563<CODE>P</CODE> (username),
564and
565<CODE>J</CODE> (jobname)
566fields are used to identify the host and user which sent the job,
567and to provide information to be displayed by <CODE>lpq</CODE>
568when reporting job status.
569<P>The
570<CODE>L</CODE> (print banner page) field is one that has caused many
571problems for users.
572RFC1179 indicates that its presence causes the banner page to be printed,
573and its absence suppresses banner pages.
574The <CODE>lpr -h</CODE> option suppresses putting this line into the
575control file.
576Usually the <CODE>L</CODE> field is a duplicate of the <CODE>P</CODE>
577field.
578<P>The <CODE>M</CODE> (mail information)
579field supplies a mail address for LPRng to send mail to when
580a job is completed.
581See
582<A HREF="LPRng-HOWTO-17.html#mail">LPR -m and user logging</A>
583for more details.
584<P>The <CODE>N</CODE> (file name) field is usually provided to identify
585the file name corresponding to the data file.
586This can be used to print names on page separators, etc.
587LPRng largely ignores this line.
588<P>The
589<CODE>I</CODE> (indent)
590and
591<CODE>W</CODE> (width)
592fields are supposed to specify a page indent and width for printing.
593These fields are passed to filters if they are present.
594<P>The <CODE>Q</CODE> (queue name)
595field is an LPRng extension,
596and contains the name of the print queue the job was originally sent to.
597See
598<A HREF="LPRng-HOWTO-11.html#qq">qq printcap option</A> for details.
599<P>The <CODE>R</CODE> (accounting info) field was added by LPRng to allow
600a specified account to be billed for job printing.
601The <CODE>lpr -Rname</CODE> option can be used to specify the accounting name.
602<P>The
603<CODE>S</CODE> (symbolic link)
604and
605<CODE>U</CODE> (unlink after printing)
606lines were used by the original BSD LPD print system to control
607how it passed files to the print server.
608LPRng ignores these lines.
609In fact, it will remove <CODE>S</CODE> lines and force the <CODE>U</CODE>
610lines to refer only to job data files.
611This closes a nasty security loophole on non-LPRng print spoolers.
612<P>The <CODE>T</CODE> (pr job title) is used with the <CODE>lpr -p</CODE>
613operation to supply a banner to the <CODE>pr</CODE> program.
614<P>The <CODE>Z</CODE> (filter options) value is specified with
615<CODE>lpr -Zoption</CODE> and is passed to the data file filters
616during the printing operation.
617See
618<A HREF="LPRng-HOWTO-13.html#secfilter">Filters</A> for details on how the
619this is used during the printing process.
620<P>All of the lower case letters are reserved for format specifications for
621data files.
622In the control file, these are followed by the name of the data file
623to which they correspond.
624While in principle different data files in the control file can have
625different formats,
626this has not been implemented in any known spooling system.
627See
628<A HREF="LPRng-HOWTO-13.html#secfilter">Filters</A> for details on how the
629data file formats are used during the printing process.
630<H2><A NAME="ss18.6">18.6 LPQ Requests</A>
631</H2>
632
633<P>The RFC1179 protocol specifies that <CODE>lpq</CODE> print status
634requests can be sent to the <CODE>lpd</CODE> server.
635The lpq requests have the format:
636<BLOCKQUOTE><CODE>
637<PRE>
638\003printer [id]* \n    short
639\004printer [id]* \n    long
640\009printer [id]* \n    LPRng extension- verbose
641</PRE>
642</CODE></BLOCKQUOTE>
643<P>The <CODE>lpd</CODE> print server will then return queue status
644and close the data connection.
645<P>RFC1179 does not state in any manner what the format of the queue status
646should be.
647Thus, implementors have been free to augment or change the status as
648they like.
649Even the BSD LPR status format has been changed from different versions.
650<P>See
651<A HREF="LPRng-HOWTO-17.html#statusref">Status Monitoring and Logging</A>
652for information on the formats returned.
653<P>The <CODE>id</CODE> values are used to select the jobs to be displayed.
654LPRng displays any job whose ID, hostname, or user name information
655from the control file
656<CODE>A</CODE>,
657<CODE>H</CODE>,
658or
659<CODE>P</CODE> fields match any of the id values.
660<P>Note that since there is no identification of the information requestor,
661then restriction of information is almost impossible.
662<P>
663<H2><A NAME="ss18.7">18.7 LPRM Requests</A>
664</H2>
665
666<P>The RFC1179 protocol specifies that <CODE>lprm</CODE> job removal
667requests can be sent to the <CODE>lpd</CODE> server.
668The lpq requests have the format:
669<BLOCKQUOTE><CODE>
670<PRE>
671\005printer user [id]* \n
672</PRE>
673</CODE></BLOCKQUOTE>
674<P>The <CODE>lpd</CODE> print server will search the specified print queue
675and remove any job whose ID, hostname, or user name information
676from the control file
677<CODE>A</CODE>,
678<CODE>H</CODE>,
679or
680<CODE>P</CODE> fields match any of the id values
681and for which the user has permission to perform a removal operation.
682See the
683<A HREF="LPRng-HOWTO-14.html#lpdpermsref">/etc/lpd.perms</A> file for details on
684permissions.
685<P>Most RFC1179 compatible spoolers use the user information in the
686request as the name of the user which spooled the job.
687However,
688in a network environment this is extremely easy to fabricate,
689and is at best a weak type of authentication.
690<H2><A NAME="lpcreread"></A> <A NAME="ss18.8">18.8 LPC Requests</A>
691</H2>
692
693<P>LPRng has extended the RFC1179 protocol to allow queue and printer control
694commands to be sent to the LPD server.
695The format of these commands are:
696<P>
697<BLOCKQUOTE><CODE>
698<PRE>
699\006printer user key [options]
700</PRE>
701</CODE></BLOCKQUOTE>
702<P>The following commands are supported.
703<CENTER><TABLE BORDER><TR><TD>
704<BR>
705Command</TD><TD>Operation</TD></TR><TR><TD>
706<CODE> active [printer[@host]]</CODE></TD><TD>check to see if server accepting connections</TD></TR><TR><TD>
707<CODE> abort   (printer[@host] | all)  </CODE></TD><TD>terminate server process printing job</TD></TR><TR><TD>
708<CODE> disable (printer[@host] | all)  </CODE></TD><TD>disable queueing</TD></TR><TR><TD>
709<CODE> debug   (printer[@host] | all) debugparms </CODE></TD><TD>set debug level for printer</TD></TR><TR><TD>
710<CODE> enable  (printer[@host] | all)  </CODE></TD><TD>enable queueing</TD></TR><TR><TD>
711<CODE> hold    (printer[@host] | all) (name[@host] | job | all)* </CODE></TD><TD>hold job</TD></TR><TR><TD>
712<CODE> holdall (printer[@host] | all)  </CODE></TD><TD>hold all jobs on</TD></TR><TR><TD>
713<CODE> kill    (printer[@host] | all)  </CODE></TD><TD>stop and restart server</TD></TR><TR><TD>
714<CODE> lpd [printer[@host]]  </CODE></TD><TD>get LPD PID for server</TD></TR><TR><TD>
715<CODE> lpq (printer[@host] | all) (name[@host] | job | all)*     </CODE></TD><TD>invoke LPQ</TD></TR><TR><TD>
716<CODE> lprm (printer[@host] | all) (name[@host]|host|job| all)*  </CODE></TD><TD>invoke LPRM</TD></TR><TR><TD>
717<CODE> move printer (user|jobid)* target </CODE></TD><TD>move jobs to new queue</TD></TR><TR><TD>
718<CODE> noholdall (printer[@host] | all)  </CODE></TD><TD>hold all jobs off</TD></TR><TR><TD>
719<CODE> printcap (printer[@host] | all) </CODE></TD><TD>report printcap values</TD></TR><TR><TD>
720<CODE> quit                            </CODE></TD><TD>exit LPC</TD></TR><TR><TD>
721<CODE> redirect (printer[@host] | all) (printer@host | off )*    </CODE></TD><TD>redirect jobs</TD></TR><TR><TD>
722<CODE> release  (printer[@host] | all) (name[@host] | job | all)* </CODE></TD><TD>release job</TD></TR><TR><TD>
723<CODE> reread [printer[@host]]</CODE></TD><TD>LPD reread database information</TD></TR><TR><TD>
724<CODE> start   (printer[@host] | all)  </CODE></TD><TD>start printing</TD></TR><TR><TD>
725<CODE> status  (printer[@host] | all)  </CODE></TD><TD>status of printers</TD></TR><TR><TD>
726<CODE> stop    (printer[@host] | all)  </CODE></TD><TD>stop printing</TD></TR><TR><TD>
727<CODE> topq    (printer[@host] | all) (name[@host] | job | all)* </CODE></TD><TD>reorder job</TD></TR><TR><TD>
728<CODE> defaultq                         </CODE></TD><TD>default queue for LPD server</TD></TR><TR><TD>
729<CODE> local    (printer | all)  </CODE></TD><TD>client printcap and configuration information</TD></TR><TR><TD>
730<CODE> server    (printer | all)  </CODE></TD><TD>server printcap and configuration information</TD></TR><TR><TD>
731
732</TD></TR></TABLE></CENTER>
733<P>Many of these commands support extremely specialized operations for
734print queue management,
735However, the following are the most commonly used and are supported by
736the BSD LPD print spooling system as well:
737<UL>
738<LI><CODE> start, stop, enable, disable </CODE><BR>
739 Start and stop will start and stop printing for a specified queue.
740Enable and disable enable and disable sending and/or accepting jobs
741for the queue.</LI>
742<LI><CODE> abort, kill </CODE><BR>
743Abort will cause the process doing the actual job printing to be terminated.
744Kill does an abort, and then restarts the printing process.
745These commands are used to restart a queue printing after some disaster.</LI>
746<LI><CODE> topq </CODE>
747Places selected jobs at the top of the print queue.</LI>
748<LI><CODE> status </CODE><BR>
749Shows a status display of the print spools on the server.</LI>
750</UL>
751<P>The following commands are extensions to the basic set provided by the
752BSD LPD system.
753<UL>
754<LI><CODE> lpq, lprm </CODE><BR>
755Invokes the lpq or lprm program from lpc.
756Useful when in the interactive mode.</LI>
757<LI><CODE> hold, holdall, release </CODE><BR>
758The hold command will cause the selected jobs to be held until
759released.
760The holdall jobs sets all jobs submitted to the queue to be held until
761released.
762The release command releases jobs for printing.
763If a job has had an error and is in the error state,
764the release command will cause it to be reprinted.</LI>
765<LI><CODE> move, redirect </CODE><BR>
766The move command will move selected jobs to the specified spool queue.
767The redirect command sends all jobs submitted to the queue to be
768sent to the specified queue.</LI>
769<LI><CODE> active, lpd, reread </CODE><BR>
770The active command will connect to the server for the printer.
771This is used to check to see if non-LPRng print servers are active.
772The lpd command will connect to the server and
773get the process id (PID) of the <CODE>lpd</CODE> server.
774The reread command causes a SIGHUP signal to be sent to the lpd process,
775causing it to reread the
776<CODE>/etc/lpd.conf</CODE>,
777<CODE>/etc/printcap</CODE>,
778or
779<CODE>/etc/lpd.perms</CODE> files.
780This is usually done when some important configuration information has
781been modified and the administrator wants to have the server use the
782new information.</LI>
783<LI><CODE> debug </CODE><BR>
784This is a desperation facility for developers that allows dynamic enabling
785of debug information generation.
786Not normally used in general operation.</LI>
787<LI><CODE> local, server  </CODE><BR>
788These commands will print out the configuration information in the
789local
790<CODE>/etc/lpd.conf</CODE> file,
791as well as the printcap information for the specified printers;
792<CODE>local</CODE>
793prints what the LPRng clients (<CODE>lpr, lpq, ...</CODE>) would use
794while
795<CODE>server</CODE>
796prints what the LPRng server (<CODE>lpd</CODE>) would use if running on this host.
797This is an extremely useful diagnostic tool for administrators.
798Not normally used in general operation.</LI>
799</UL>
800<H2><A NAME="blocktransfer"></A> <A NAME="sendblockformat"></A> <A NAME="ss18.9">18.9 Block Job Transfer</A>
801</H2>
802
803<P>Options used:
804<UL>
805<LI> <CODE>send_block_format</CODE><EM>&nbsp;&nbsp;Transfer job as a block</EM></LI>
806</UL>
807<P>In normal job transfer operations,
808the sender and receiver have a handshake interaction in order to transfer
809a print job.
810Each file is sent individually.
811The <CODE>send_block_format</CODE> option forces
812a Block Job Transfer operation.
813This causes the sender to transfer a single file containing all the
814job printing information,
815including control file and data files.
816<P>The transfer command line has the form:
817<BLOCKQUOTE><CODE>
818<PRE>
819\007printer size\n
820</PRE>
821</CODE></BLOCKQUOTE>
822<P>The receiver will return any acknowledgement of a single 0 octet,
823and then the size bytes of the job will be transferred by the sender.
824At the end of the transfer a single 0 octet is added,
825and the receiver will indicate success by returning a single 0 octet.
826Any other value returned by the receiver indicates an error condition.
827<P>The file transferred by the sender is simply the command lines that it
828would have normally sent for job transfer,
829followed by the control or data file values.
830<H2><A NAME="ss18.10">18.10 Authenticated Transfer</A>
831</H2>
832
833<P>RFC1179 does not provide any authentication or encryption mechanism
834for the transfer of jobs or commands to the <CODE>lpd</CODE>
835print server.
836The Authenticated Transfer operation was added to allow an encrypted
837or authenticated transfer of print jobs or commands.
838<P>Since there are various restrictions on the incorporation of authentication
839facilities into programs,
840LPRng supports authentication by providing a simple interface to
841encryption programs.
842<P>The idea is that when authentication is required when sending a job,
843LPRng will generate a block transfer job as described for the
844<A HREF="#blocktransfer">Block Transfer operation,</A>
845and then invoke a set of programs to encryt and transfer the file,
846and encrypt and transfer the returned status.
847<P>Similarly,
848when sending a command,
849the command information will be placed in a file
850and the encrypted file will be transferred.
851<P>This technique means that the programs and support to do encryption
852are external to LPRng,
853and can use any type of method that they choose to implement the
854secure and/or authenticated transfer.
855<P>See
856<A HREF="LPRng-HOWTO-16.html#authref">Authentication and Encryption</A>
857for details on the authentication interface.
858<HR>
859<A HREF="LPRng-HOWTO-19.html">Next</A>
860<A HREF="LPRng-HOWTO-17.html">Previous</A>
861<A HREF="LPRng-HOWTO.html#toc18">Contents</A>
862</BODY>
863</HTML>
Note: See TracBrowser for help on using the repository browser.