1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 3<html> 4 <head> 5 <meta name="generator" content="HTML Tidy, see www.w3.org"> 6 <title>Opening the Output Device </title> 7 <meta name="GENERATOR" content= 8 "Modular DocBook HTML Stylesheet Version 1.7"> 9 <link rel="HOME" title=" LPRng Reference Manual" href= 10 "index.htm"> 11 <link rel="UP" title="Job Processing" href="jobsteps.htm"> 12 <link rel="PREVIOUS" title="Spool Queue Processing " href= 13 "spoolq.htm"> 14 <link rel="NEXT" title="Printing Banners " href= 15 "bannerprinting.htm"> 16 </head> 17 18 <body class="SECT1" bgcolor="#FFFFFF" text="#000000" link= 19 "#0000FF" vlink="#840084" alink="#0000FF"> 20 <div class="NAVHEADER"> 21 <table summary="Header navigation table" width="100%" border= 22 "0" cellpadding="0" cellspacing="0"> 23 <tr> 24 <th colspan="3" align="center">LPRng Reference Manual: 5 25 Sep 2003 (For LPRng-3.8.22)</th> 26 </tr> 27 28 <tr> 29 <td width="10%" align="left" valign="bottom"><a href= 30 "spoolq.htm" accesskey="P">Prev</a></td> 31 32 <td width="80%" align="center" valign="bottom">Chapter 33 15. Job Processing</td> 34 35 <td width="10%" align="right" valign="bottom"><a href= 36 "bannerprinting.htm" accesskey="N">Next</a></td> 37 </tr> 38 </table> 39 <hr align="LEFT" width="100%"> 40 </div> 41 42 <div class="SECT1"> 43 <h1 class="SECT1"><a name="OPENDEVICE">15.5. Opening the 44 Output Device</a></h1> 45 46 <p>Options used:</p> 47 48 <ul> 49 <li> 50 <p><var class="LITERAL">achk</var> FLAG <span class= 51 "emphasis"><i class="EMPHASIS">Accounting check at 52 start</i></span></p> 53 </li> 54 55 <li> 56 <p><var class="LITERAL">af=</var><span class= 57 "emphasis"><i class="EMPHASIS">Accounting 58 File</i></span></p> 59 </li> 60 61 <li> 62 <p><var class="LITERAL">ar</var> FLAG <span class= 63 "emphasis"><i class="EMPHASIS">Remote printer accounting 64 enabled</i></span></p> 65 </li> 66 67 <li> 68 <p><var class="LITERAL">as=</var><span class= 69 "emphasis"><i class="EMPHASIS">Accounting at 70 start</i></span></p> 71 </li> 72 73 <li> 74 <p><var class="LITERAL">connect_grace=</var><span class= 75 "emphasis"><i class="EMPHASIS">Time between 76 jobs</i></span></p> 77 </li> 78 79 <li> 80 <p><var class="LITERAL">connect_interval=</var><span 81 class="emphasis"><i class="EMPHASIS">Connection 82 interval</i></span></p> 83 </li> 84 85 <li> 86 <p><var class="LITERAL">connect_timeout=</var><span 87 class="emphasis"><i class="EMPHASIS">Connection 88 timeout</i></span></p> 89 </li> 90 91 <li> 92 <p><var class="LITERAL">control_filter=</var><span class= 93 "emphasis"><i class="EMPHASIS">Control file 94 filter</i></span></p> 95 </li> 96 97 <li> 98 <p><var class="LITERAL">ff=</var><span class= 99 "emphasis"><i class="EMPHASIS">form feed</i></span></p> 100 </li> 101 102 <li> 103 <p><var class="LITERAL">fo</var> FLAG <span class= 104 "emphasis"><i class="EMPHASIS">form feed on 105 open</i></span></p> 106 </li> 107 108 <li> 109 <p><var class="LITERAL">la</var> FLAG <span class= 110 "emphasis"><i class="EMPHASIS">Local printer accounting 111 enabled</i></span></p> 112 </li> 113 114 <li> 115 <p><var class="LITERAL">ld=</var><span class= 116 "emphasis"><i class="EMPHASIS">leader on open 117 (initialization string)</i></span></p> 118 </li> 119 120 <li> 121 <p><var class="LITERAL">lk</var> FLAG <span class= 122 "emphasis"><i class="EMPHASIS">Lock IO 123 device</i></span></p> 124 </li> 125 126 <li> 127 <p><var class="LITERAL">lp=</var><span class= 128 "emphasis"><i class="EMPHASIS">IO device 129 pathname</i></span></p> 130 </li> 131 132 <li> 133 <p><var class="LITERAL">nb</var> FLAG <span class= 134 "emphasis"><i class="EMPHASIS">Nonblocking device 135 open</i></span></p> 136 </li> 137 138 <li> 139 <p><var class="LITERAL">network_connect_grace=</var><span 140 class="emphasis"><i class="EMPHASIS">Interval in secs 141 between jobs</i></span></p> 142 </li> 143 144 <li> 145 <p><var class="LITERAL">of=</var><span class= 146 "emphasis"><i class="EMPHASIS">of filter</i></span></p> 147 </li> 148 149 <li> 150 <p><var class="LITERAL">retry_econnrefused</var> FLAG 151 <span class="emphasis"><i class="EMPHASIS">Retry if open 152 failed</i></span></p> 153 </li> 154 155 <li> 156 <p><var class="LITERAL">retry_nolink</var> FLAG <span 157 class="emphasis"><i class="EMPHASIS">Retry if open 158 failed</i></span></p> 159 </li> 160 161 <li> 162 <p><var class="LITERAL">rm=</var><span class= 163 "emphasis"><i class="EMPHASIS">the remote machine to send 164 the job to</i></span></p> 165 </li> 166 167 <li> 168 <p><var class="LITERAL">rp=</var><span class= 169 "emphasis"><i class="EMPHASIS">the remote print queue to 170 send the job to</i></span></p> 171 </li> 172 173 <li> 174 <p><var class="LITERAL">rw</var> FLAG <span class= 175 "emphasis"><i class="EMPHASIS">device opened RW 176 flag</i></span></p> 177 </li> 178 179 <li> 180 <p><var class="LITERAL">server_tmp_dir=</var><span class= 181 "emphasis"><i class="EMPHASIS">temporary 182 directory</i></span></p> 183 </li> 184 </ul> 185 Sequence of Operations: 186 187 <ol type="1"> 188 <li> 189 <p>During the server operations, it will try to create 190 temporary files in the print queue spool directory. If 191 this is not desirable, it will create them in the <var 192 class="LITERAL">server_tmp_dir</var> directory.</p> 193 </li> 194 195 <li> 196 <p>If the accounting file specified by <var class= 197 "LITERAL">af</var> exists, it is opened (af_fd) and the 198 af_fd is passed as file descriptor 3 to all filters. If 199 the <var class="LITERAL">af</var> value has the form <var 200 class="LITERAL">af=|/program</var> then the program is 201 started and the program <acronym class= 202 "ACRONYM">STDIN</acronym> is used as af_fd. If the <var 203 class="LITERAL">af</var> value has the form <var class= 204 "LITERAL">af=host%port</var>, then a TCP/IP connection to 205 the corresponding port on the remote host is made and the 206 port used as af_fd. In the latter two cases, the filter 207 <acronym class="ACRONYM">STDIN</acronym> (file descriptor 208 0) is actually opened read/write, and is used when 209 information is needed from the accounting filter or 210 remote server. See <a href= 211 "accountingref.htm#ACCOUNTINGSERVER">Accounting Printcap 212 Options</a> for more information on the <b class= 213 "APPLICATION">LPRng</b> accounting support.</p> 214 </li> 215 216 <li> 217 <p><a name="ACCOUNTSTART"></a> If <var class= 218 "LITERAL">la</var> (local accounting) is true and we are 219 printing a job or <var class="LITERAL">ar</var> (remote 220 accounting) is true and we are transferring a job, the 221 <var class="LITERAL">as</var> value is examined. If it is 222 a filter (program) specification, then the program is 223 started with its <acronym class="ACRONYM">STDIN</acronym> 224 attached to <tt class="FILENAME">/dev/null</tt>, <acronym 225 class="ACRONYM">STDOUT</acronym> will be read by the 226 print spooler, <acronym class="ACRONYM">STDERR</acronym> 227 output will be written to the error log. The lpd program 228 will wait until the accounting filter program terminates, 229 and examine the error code for action, as for the other 230 filters (see <a href= 231 "printingjob.htm#ERRORCODES">errorcodes</a> below). If 232 the exit status is 0, (JSUCC) then the printing process 233 will continue, if JHOLD the job will be held, if JREMOVE 234 the job will be removed, if JFAIL the job processing will 235 terminate with a JFAIL indication, otherwise the job 236 processing will terminate with a JABORT indication.</p> 237 </li> 238 239 <li> 240 <p>If the accounting filter exited with a JSUCC (no error 241 code) and the <var class="LITERAL">achk</var> (accounting 242 check) flag is set, the line read from the accounting 243 filter <acronym class="ACRONYM">STDOUT</acronym> will be 244 examined. This line should be <var class= 245 "LITERAL">accept</var>, <var class="LITERAL">hold</var>, 246 <var class="LITERAL">fail</var>, <var class= 247 "LITERAL">remove</var>, otherwise the job processing 248 terminates with a JABORT indication. An <var class= 249 "LITERAL">accept</var> will allow the job to be printed, 250 <var class="LITERAL">hold</var> will hold the job, <var 251 class="LITERAL">fail</var> will cause the job to fail, 252 <var class="LITERAL">remove</var> will cause the job to 253 be removed.</p> 254 </li> 255 256 <li> 257 <p>If the <var class="LITERAL">connect_grace</var> value 258 is non-zero and the server is opening a device or <var 259 class="LITERAL">network_connect_grace</var> is non-zero 260 and a network connection is being made, the server will 261 pause the specified time. This is to accommodate devices 262 which need a recovery time between jobs.</p> 263 </li> 264 265 <li> 266 <p>The <var class="LITERAL">lp</var> option is checked to 267 determine the type of IO device.</p> 268 269 <div class="INFORMALTABLE"> 270 <a name="AEN7143"></a> 271 272 <table border="1" frame="border" rules="all" class= 273 "CALSTABLE"> 274 <col> 275 <col> 276 277 <thead> 278 <tr> 279 <th>Format</th> 280 281 <th>Meaning</th> 282 </tr> 283 </thead> 284 285 <tbody> 286 <tr> 287 <td><tt class="FILENAME">/pathname</tt></td> 288 289 <td>Absolute pathname of IO device</td> 290 </tr> 291 292 <tr> 293 <td><var class="LITERAL">pr@host</var></td> 294 295 <td>transfer to <var class="LITERAL">pr</var> on 296 remote <var class="LITERAL">host</var></td> 297 </tr> 298 299 <tr> 300 <td><var class="LITERAL">host%port</var></td> 301 302 <td>open a TCP/IP connection to port on host. 303 host can be name or IP address</td> 304 </tr> 305 306 <tr> 307 <td><var class="LITERAL">|filter</var></td> 308 309 <td>run the filter program; it <acronym class= 310 "ACRONYM">STDIN</acronym> will be used as 311 device</td> 312 </tr> 313 </tbody> 314 </table> 315 </div> 316 <br> 317 <br> 318 </li> 319 320 <li> 321 <p>The IO device specified by <var class= 322 "LITERAL">lp</var> is opened write-only or read-write if 323 the <var class="LITERAL">rw</var> flag is true, and the 324 resulting file descriptor is io_fd. If the <var class= 325 "LITERAL">nb</var> flag is set, a non-blocking open will 326 be done as well. If the <var class="LITERAL">lk</var> 327 (lock device) flag is true, the device will be locked 328 against use by other <b class="APPLICATION">lpd</b> 329 servers.</p> 330 </li> 331 332 <li> 333 <p>If a <var class="LITERAL">host%port</var> combination, 334 a TCP/IP connection will be opened to the remote port and 335 the connection will be used as io_fd.</p> 336 </li> 337 338 <li> 339 <p>If a filter program is specified, the filter program 340 will be run and the <acronym class= 341 "ACRONYM">STDIN</acronym> of the filter will be used as 342 the device file descriptor.</p> 343 </li> 344 345 <li> 346 <p>If a <var class="LITERAL">rp@rm</var> combination, or 347 none of the above combinations are true and the <var 348 class="LITERAL">rm</var> and <var class= 349 "LITERAL">rp</var> values are non-zero, then the job will 350 be transferred to a remote printer. The type of operation 351 will be a job transfer, rather than printing 352 operation.</p> 353 </li> 354 355 <li> 356 <p>If the <var class="LITERAL">connect_timeout</var> 357 value is non-zero, a timeout is setup for the device or 358 socket open. If the device or connection open does not 359 succeed within the timeout, then the open operation 360 fails.</p> 361 </li> 362 363 <li> 364 <p>If a connection is to a network address (i.e. - <code 365 class="FUNCTION">connect()</code> system call) and the 366 connection attempt fails with an <acronym class= 367 "ACRONYM">ECONNREFUSED</acronym> error, if the <var 368 class="LITERAL">retry_econnrefused</var> flag is set then 369 the connection attempt is retried, but this time using an 370 alternative port number. See <a href= 371 "rfc1179ref.htm">RFC1179</a> for details. This is 372 repeated until all of the possible originating port 373 numbers are exhausted.</p> 374 </li> 375 376 <li> 377 <p>If the open or connect operation fails, and the <var 378 class="LITERAL">retry_nolink</var> flag is set, then the 379 server will pause for a minimum of <var class= 380 "LITERAL">connect_grace</var> plus a multiple of <var 381 class="LITERAL">connect_interval</var> seconds based on 382 the number of attempts before retrying the open 383 operation. Note that the interval may increase as the 384 number of attempts increases.</p> 385 </li> 386 387 <li> 388 <p>If printing a job and the <var class= 389 "LITERAL">:of</var> filter is specified, it is created 390 with its <acronym class="ACRONYM">STDOUT</acronym> (fd 1) 391 attached to the io_fd. Its stdin (of_fd) will be used in 392 the steps listed below. If there is no <var class= 393 "LITERAL">:of</var> filter, then the of_fd value will be 394 the io_fd descriptor.</p> 395 </li> 396 397 <li> 398 <p>If transferring a job and the <var class= 399 "LITERAL">control_filter</var> option is specified, then 400 the program specified by the <var class= 401 "LITERAL">control_filter</var> value will be run. It will 402 have its <acronym class="ACRONYM">STDIN</acronym> set to 403 the control file, and its <acronym class= 404 "ACRONYM">STDOUT</acronym> output will be used as the new 405 value of the control file to transfer to the remote host. 406 See <a href="filteroptions.htm">Filter Command Line 407 Options and Environment Variables</a> for details of 408 options passed to the control filter, and <a href= 409 "printingjob.htm#ERRORCODES">errorcodes</a> for the exit 410 codes of the filter.</p> 411 </li> 412 413 <li> 414 <p>If the operation is a job transfer, the operation 415 proceeds as outlined in <a href= 416 "rfc1179ref.htm">RFC1179</a>, and then the <a href= 417 "normalterm.htm">Normal Termination</a> operations are 418 carried out.</p> 419 </li> 420 421 <li> 422 <p>If the operation is a print operation and the <var 423 class="LITERAL">ld</var> (leader on open) value is 424 provided, the string is translated (escapes removed) and 425 written to the of_fd file descriptor.</p> 426 </li> 427 428 <li> 429 <p>If the <var class="LITERAL">fo</var> (form feed on 430 open) flag is true, then the <var class= 431 "LITERAL">ff</var> (form feed) string is translated 432 (escapes removed) and written to the of_fd file 433 descriptor.</p> 434 </li> 435 </ol> 436 <br> 437 <br> 438 </div> 439 440 <div class="NAVFOOTER"> 441 <hr align="LEFT" width="100%"> 442 443 <table summary="Footer navigation table" width="100%" border= 444 "0" cellpadding="0" cellspacing="0"> 445 <tr> 446 <td width="33%" align="left" valign="top"><a href= 447 "spoolq.htm" accesskey="P">Prev</a></td> 448 449 <td width="34%" align="center" valign="top"><a href= 450 "index.htm" accesskey="H">Home</a></td> 451 452 <td width="33%" align="right" valign="top"><a href= 453 "bannerprinting.htm" accesskey="N">Next</a></td> 454 </tr> 455 456 <tr> 457 <td width="33%" align="left" valign="top">Spool Queue 458 Processing</td> 459 460 <td width="34%" align="center" valign="top"><a href= 461 "jobsteps.htm" accesskey="U">Up</a></td> 462 463 <td width="33%" align="right" valign="top">Printing 464 Banners</td> 465 </tr> 466 </table> 467 </div> 468 </body> 469</html> 470 471